CS208 Logic & Algorithms

Semester 1: Logic

Proof rules for Predicate Logic

With an understanding of scope and substitution, we can now look at the proof rules for Predicate Logic. The videos below introduce the rules and show how to use them in the interactive proof editor. There are exercises throughout the page to help you understand how the rules work, and so how the quantifiers work.

Slides for the videos below (PDF)

Proof rules for “for all”

Enter any notes to yourself here

Using the Proof Editor

Enter any notes to yourself here

Exercises

These exercises use the new rules for “for all”, as well as the rules for the propositional connectives:

Proof commands...

The blue boxes represent parts of the proof that are unfinished. The comments (in green) tells you what the current goal is. Either the goal is unfocused:

{ goal: <some formula> }

or there is a formula is focus:

{ focus: <formula1>; goal: <formula2> }

The commands that you can use differ according to which mode youare in. The commands correspond directly to the proof rules given in the videos.

Unfocused mode

These rules can be used when there is no formula in the focus. These rules either act on the conclusion directly to break it down into simpler sub-goals, or switch to focused mode (the use command).

Focused mode

These rules apply when there is a formula in focus. These rules either act upon the formula in focus, or finish the proof when the focused formula is the same as the goal.

  1. For all things, if p and q are true, then p is true:

    (config (solution (Rule(Introduce x)((Rule(Introduce x-is-p-and-q)((Rule(Use x-is-p-and-q)((Rule Conj_elim1((Rule Close())))))))))) (goal "all x. (p(x) /\ q(x)) -> p(x)"))
  2. If p is true for all things, then it is true for the specific individual a().

    (config (solution (Rule(Introduce everything-is-p)((Rule(Use everything-is-p)((Rule(Instantiate(Fun a()))((Rule Close())))))))) (goal "(all x. p(x)) -> p(a())"))
  3. If p and q are true for all things, then p is true for all things.

    (config (solution (Rule(Introduce all-p-and-q)((Rule(Introduce y)((Rule(Use all-p-and-q)((Rule(Instantiate(Var y))((Rule Conj_elim1((Rule Close())))))))))))) (goal "(all x. p(x) /\ q(x)) -> (all y. p(y))"))

Proof rules for “exists”

Enter any notes to yourself here

Using the Proof Editor

Enter any notes to yourself here

Exercises

These exercises use the new rules for “exists”, as well as the rules for the propositional connectives:

Proof commands...

The blue boxes represent parts of the proof that are unfinished. The comments (in green) tells you what the current goal is. Either the goal is unfocused:

{ goal: <some formula> }

or there is a formula is focus:

{ focus: <formula1>; goal: <formula2> }

The commands that you can use differ according to which mode youare in. The commands correspond directly to the proof rules given in the videos.

Unfocused mode

These rules can be used when there is no formula in the focus. These rules either act on the conclusion directly to break it down into simpler sub-goals, or switch to focused mode (the use command).

Focused mode

These rules apply when there is a formula in focus. These rules either act upon the formula in focus, or finish the proof when the focused formula is the same as the goal.

  1. If p is true for a(), then there exists a thing for which p is true:

    (config (solution (Rule(Introduce a-is-p)((Rule(Exists(Fun a()))((Rule(Use a-is-p)((Rule Close())))))))) (goal "p(a()) -> (ex x. p(x))"))
  2. If something exists that has two properties, then something exists that has one of those properties:

    (config (solution (Rule(Introduce exists-a-p-and-q)((Rule(Use exists-a-p-and-q)((Rule(ExElim x x-is-p-and-q)((Rule(Exists(Var x))((Rule(Use x-is-p-and-q)((Rule Conj_elim1((Rule Close())))))))))))))) (goal "(ex x. p(x) /\ q(x)) -> (ex z. p(z))"))
  3. If something exists that has one of two properties, then either there exists something that has the first property, or one that has the second:

    (config (solution (Rule(Introduce exists-a-p-or-q)((Rule(Use exists-a-p-or-q)((Rule(ExElim x x-is-p-or-q)((Rule(Use x-is-p-or-q)((Rule(Cases x-is-p x-is-q)((Rule Left((Rule(Exists(Var x))((Rule(Use x-is-p)((Rule Close())))))))(Rule Right((Rule(Exists(Var x))((Rule(Use x-is-q)((Rule Close())))))))))))))))))) (goal "(ex x. p(x) \/ q(x)) -> ((ex z. p(z)) \/ (ex z. q(z)))"))

Exercises combining ∀ and ∃

These exercises combine “for all” and “exists”:

Proof commands...

The blue boxes represent parts of the proof that are unfinished. The comments (in green) tells you what the current goal is. Either the goal is unfocused:

{ goal: <some formula> }

or there is a formula is focus:

{ focus: <formula1>; goal: <formula2> }

The commands that you can use differ according to which mode youare in. The commands correspond directly to the proof rules given in the videos.

Unfocused mode

These rules can be used when there is no formula in the focus. These rules either act on the conclusion directly to break it down into simpler sub-goals, or switch to focused mode (the use command).

Focused mode

These rules apply when there is a formula in focus. These rules either act upon the formula in focus, or finish the proof when the focused formula is the same as the goal.

  1. If every p has something that is r-related to it, and a() is a p, then there is something r-related to a().

    (config (solution (Rule(Introduce H)((Rule(Introduce a-is-p)((Rule(Use H)((Rule(Instantiate(Fun a()))((Rule Implies_elim((Rule(Use a-is-p)((Rule Close())))(Rule Close())))))))))))) (goal "(all x. p(x) -> (ex y. r(x,y))) -> p(a()) -> (ex z. r(a(),z))"))
  2. If everything is not p, then there does not exist a p:

    (config (solution (Rule(Introduce H)((Rule(NotIntro exists-p)((Rule(Use exists-p)((Rule(ExElim y y-is-p)((Rule(Use H)((Rule(Instantiate(Var y))((Rule NotElim((Rule(Use y-is-p)((Rule Close())))))))))))))))))) (goal "(all x. ¬p(x)) -> ¬(ex y. p(y))"))
  3. If there exists a non-p, then not everything is a p:

    (config (solution (Rule(Introduce H)((Rule(NotIntro all-are-p)((Rule(Use H)((Rule(ExElim x x-is-not-p)((Rule(Use x-is-not-p)((Rule NotElim((Rule(Use all-are-p)((Rule(Instantiate(Var x))((Rule Close())))))))))))))))))) (goal "(ex x. ¬p(x)) -> ¬(all y. p(y))"))
  4. Quantifier order can be swapped, when they are the same quantifier:

    (config (solution (Rule(Introduce H)((Rule(Introduce x)((Rule(Introduce y)((Rule(Use H)((Rule(Instantiate(Var y))((Rule(Instantiate(Var x))((Rule Close())))))))))))))) (goal "(all x. all y. R(x,y)) -> (all x. all y. R(y,x))"))