CS 227 proof tools

How to use Proof Checker Pro

Proof Checker Pro reads a proof as a short program. You state the problem, enter one proof command per line, and use the goal and compiler messages to decide what to write next.

Quick start

  1. Enter any predicate definitions.
  2. Enter one axiom per line. The checker supplies Roman numerals.
  3. Enter the goal.
  4. Write one proof command per line.
  5. Watch the current goal, pretend worlds, checkmarks, and compiler output as you type.
The checker runs automatically. The Compile proof button is useful when you want to recheck deliberately, but you do not need to press it after every line.

Enter the problem

Predicate definitions

Definitions give a short name to a longer statement. Formal parameters begin with lowercase letters.

FAS(c) = (∀ d in Creatures)(S(d) → F(c, d))
FAM(c) = (∀ d in Creatures)(M(d) → F(c, d))

The goal display shows both the short name and its expansion when that information is useful.

Axioms

Enter one axiom per line. Do not type the Roman numerals unless you want to supply a particular label yourself.

(∀ c in Creatures)(S(c) → M(c))
(∀ c in Creatures)(M(c) → V(c))

These become Axioms I and II. You may cite an axiom by writing its Roman numeral after a rule name.

Goal

(∀ c in Creatures)(S(c) → V(c))

The current-goal display changes whenever you enter or leave a pretend world.

Define inductive types and recursive functions

An inductive declaration lists every way an object of a type can be constructed. Constructor names begin uppercase; constructor-field names begin lowercase.

inductive BinaryTree
    Leaf
    InternalNode(left: BinaryTree, right: BinaryTree)
end

A recursive function gives exactly one equation for each constructor. Recursive calls may use only the direct recursive parts named by that constructor.

recursive count(tree: BinaryTree): Natural
    count(Leaf) = 1
    count(InternalNode(left, right))
        = count(left) + count(right) + 1
end

Recursive properties use the same pattern:

recursive predicate Perfect(tree: BinaryTree)
    Perfect(Leaf) = True
    Perfect(InternalNode(left, right))
        = Perfect(left) ∧ Perfect(right)
          ∧ height(left) = height(right)
end

Use a definition explicitly in a proof:

count(InternalNode(Left, Right))
    = count(Left) + count(Right) + 1
    by definition of count

Structural induction

Induct on t
  BaseCase Leaf
    ...
  therefore P(Leaf) by induction case

  InductiveCase InternalNode(Left, Right)
    For induction assume:
      P(Left)
      P(Right)
    ...
  therefore P(InternalNode(Left, Right)) by induction case

therefore (∀ t in BinaryTrees)P(t) by induction

Use BaseCase for a constructor with no recursive parts and InductiveCase for a constructor with one or more recursive parts. The first line of every inductive case must be For induction assume:. Then state the original theorem once for each immediate recursive part. The checker verifies each hypothesis instead of supplying it, and each correct hypothesis becomes a numbered proof line that can be cited later.

Current boundary: a recursive definition has one structural argument. Mutual recursion and parameterized types such as List<A> are not yet supported.

Follow the shape of the goal

The outermost part of the goal usually determines the first move.

Goal begins withFirst move
(∀ c in Creatures) P(c)Introduce an arbitrary creature with Pretend Bob is a Creature.
P → QOpen a make-believe world with Make believe P or Assume P.
P ∧ QEstablish both parts, then use and introduction.
P ∨ QEstablish one side, then use or introduction.
(∃ c) P(c)Find a particular witness, establish the required instance, then use EG.

The Hint button follows this same strategy. It first simplifies universal and implication goals, then searches for useful instantiations and detachments.

Pretend worlds and scope

Universal generalization, make-believe, existential instantiation, proof by cases, and proof by contradiction create temporary worlds. The editor draws vertical rails to show their nesting.

Pretend Bob is a Creature.
  Make believe S(Bob).
    S(Bob) → M(Bob) by UI I
    M(Bob) by detachment 2, 3
  therefore S(Bob) → M(Bob) by MB 4
therefore (∀ c in Creatures)(S(c) → M(c)) by UG 5
  • A line may use facts from its current world and any enclosing world.
  • A fact created in a world cannot be used after that world has closed.
  • Write introduced individuals with an uppercase first letter: Bob, X, or F.
  • Indentation is added automatically. Spaces you type are accepted, but the scope comes from the proof commands.

When the current goal has been established inside a world, the checker offers a button that inserts the appropriate pop-out line.

Proof-rule recipes

Universal instantiation — UI

S(Bob) → M(Bob) by UI I

Replace one or more leading universally quantified variables with specific objects.

Detachment

M(Bob) by detachment 2, 3

Cite an implication and its matching if-part. The order of the references does not matter.

Universal generalization — UG

Pretend Bob is a Creature.
...
therefore (∀ c in Creatures)P(c) by UG

The name must be arbitrary, and the needed instance must be proved inside that world.

Make-believe — MB

Make believe P.
...
therefore P → Q by MB

Assume the if-part, establish the then-part, and pop out with the implication.

Existential rules — EI and EG

Let Ari be a witness such that P(Ari) by EI I
...
therefore R by EI

(∃ k) 2k = N by EG 6

EI opens a temporary witness world. EG concludes that a witness exists from one established instance.

And rules

P ∧ Q by and introduction 2, 3
P by and elimination 4

Introduction joins two established statements. Elimination extracts either part of a conjunction.

Or and proof by cases

P ∨ Q by or introduction 2
Case 1: Make believe P by cases III
...
therefore R by case
Case 2: Make believe Q by cases III
...
therefore R by case
therefore R by cases III

Both branches must start from the same disjunction and end with the same conclusion.

Proof by contradiction

For contradiction assume ¬P.
...
Contradiction from lines 4, 7
therefore P by contradiction

A contradiction is a statement paired with its negation, or opposing comparisons such as X < Y and X ≥ Y.

De Morgan and double negation

¬P ∨ ¬Q by De Morgan 3
P by double negation 5

De Morgan converts between the recognized equivalent forms. Double negation adds or removes exactly two negations.

Biconditionals

P ↔ Q by iff introduction 4, 8
P → Q by iff elimination 9

Introduction needs both directions. Elimination extracts either direction.

Algebra

N^2 = 4J^2 + 4J + 1 by algebra

The checker handles polynomial algebra and can substitute from available equalities.

Restating an axiom

P by axiom II

Use this when an axiom already says exactly what the proof line needs.

References are optional when the source is unambiguous. If several earlier lines could justify a move, cite the intended axiom or line numbers.

A complete example

Axioms

(∀ c in Creatures)(S(c) → M(c))
(∀ c in Creatures)(M(c) → V(c))

Goal

(∀ c in Creatures)(S(c) → V(c))

Proof

Pretend Bob is a Creature.
  Make believe S(Bob).
    S(Bob) → M(Bob) by UI I
    M(Bob) by detachment 2, 3
    M(Bob) → V(Bob) by UI II
    V(Bob) by detachment 4, 5
  therefore S(Bob) → V(Bob) by MB 6
therefore (∀ c in Creatures)(S(c) → V(c)) by UG 7

The first line reduces the universal goal to a statement about arbitrary Bob. The second line reduces the implication goal to V(Bob). The two UI–detachment pairs establish that goal. MB and UG then close the worlds in reverse order.

Use the compiler feedback

  • A green checkmark means that line compiles in its current world.
  • A red × means the compiler cannot justify that line. Select it to jump to the corresponding diagnostic.
  • The compiler stops trusting later lines after the first error, because their scopes or sources may depend on the broken line.
  • The gray column beside the proof shows expanded predicate definitions.
  • The current-goal panel tells you what remains to be established in the innermost world.

Frequent errors

  • No available line matches: check the formula and cite the intended source.
  • Line belongs to a closed world: that temporary fact is no longer available.
  • Individual must begin uppercase: use Bob, not bob.
  • Cannot infer references: add the axiom or line numbers after the rule name.
  • Goal is not complete: establish the displayed goal and then close the current world.

Notation and typing shortcuts

TypeBecomesMeaning
\forall∀for every
\exists∃there exists
\neg or \not¬not
/\ or and∧and
\/ or or∨or
->→implies
<->↔if and only if
<=≤less than or equal to
>=≥greater than or equal to

Periods at the ends of proof commands are optional. Pressing Space after a completed shortcut performs the conversion while you type.