Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

Eight proofs of the kind an intro-to-proofs course sets, taken from the set.mm libraries metacalc builds and printed as goal trees.

Reading a statement

A Metamath statement is a line of symbols separated by spaces. The first symbol, ⊢, is the turnstile and means “is provable”. Everything after it is the claim. The last column shows the ASCII token that a Metamath source file uses for each symbol.

SymbolRead asIn a source file
⊢is provable|-
( )grouping( )
→implies->
↔if and only if<->
¬not-.
∧and/\
∨or\/
=equals=
∈is an element ofe.
⊆is a subset ofC_
‘applied to, as in ( 𝐹 ‘ 𝐴 )`
𝜑 𝜓 𝜒any statementph ps ch
𝐴 𝐵 𝐶 𝐺 𝑅 𝑋any class, which you can read as a setA B C G R X
Grp Mnd Ring Rngis a group, a monoid, a ring, a non-unital ringGrp Mnd Ring Rng
Base +g 0g .rthe set, the operation, the identity and the multiplication of a structureBase +g 0g .r
+ 0 ·an operation or element that the hypotheses name, underlined with dots.+ .0. .x.

A theorem can have hypotheses, written “given” on the library pages. To use such a theorem you first need a proof of each hypothesis. Where an example has hypotheses, they are listed before its tree.

Reading a goal tree

A proof is written backward, from what you want to show. The root is the goal. Each line is a statement followed by a label, the theorem applied to it. A label that is a link opens that theorem on its library page.

Applying a theorem to a goal means choosing a theorem whose conclusion matches the goal once its variables are replaced by statements. The theorem’s hypotheses, with the same replacements made, become new goals, and they are the lines indented under the goal. In the tree of example 1, mpd is applied to the first goal, and ax-1 closes both goals under it.

A goal closes when the theorem applied to it has no hypotheses, as ax-1 does. A label such as syl.1 is a hypothesis of the theorem being proved, so that goal is already given and its label is not a link. Each theorem applied has its own proof, which the tree does not expand.

The root statement of each example is also drawn in the calculator’s font. These images are renderings of the statement on a 96 by 64 pixel screen, enlarged four times.

1. Every statement implies itself

id, propositional calculus library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ ( 𝜑 → 𝜑 ) mpd
    • ⊢ ( 𝜑 → ( 𝜑 → 𝜑 ) ) ax-1
    • ⊢ ( 𝜑 → ( ( 𝜑 → 𝜑 ) → 𝜑 ) ) ax-1

mpd combines ( 𝜑 → 𝜓 ) and ( 𝜑 → ( 𝜓 → 𝜒 ) ) into ( 𝜑 → 𝜒 ). The statement 𝜓 does not appear in the goal, so you choose it. With 𝜓 as ( 𝜑 → 𝜑 ), both subgoals are instances of the axiom ax-1, ( 𝜑 → ( 𝜓 → 𝜑 ) ).

2. Chaining implications

If 𝜑 implies 𝜓 and 𝜓 implies 𝜒, then 𝜑 implies 𝜒.

Hypotheses:

  • ⊢ ( 𝜑 → 𝜓 )
  • ⊢ ( 𝜓 → 𝜒 )

syl, propositional calculus library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ ( 𝜑 → 𝜒 ) mpd
    • ⊢ ( 𝜑 → 𝜓 ) syl.1
    • ⊢ ( 𝜑 → ( 𝜓 → 𝜒 ) ) a1i
      • ⊢ ( 𝜓 → 𝜒 ) syl.2

This is the hypothetical syllogism. The proof applies mpd to the goal. The first subgoal is the first hypothesis. For the second, a1i turns the second hypothesis ( 𝜓 → 𝜒 ) into ( 𝜑 → ( 𝜓 → 𝜒 ) ), which says that a proven statement still holds when 𝜑 is assumed.

3. The contrapositive

If 𝜑 implies 𝜓, then not 𝜓 implies not 𝜑.

Hypotheses:

  • ⊢ ( 𝜑 → 𝜓 )

con3i, propositional calculus library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ ( ¬ 𝜓 → ¬ 𝜑 ) nsyl
    • ⊢ ( ¬ 𝜓 → ¬ 𝜓 ) id
    • ⊢ ( 𝜑 → 𝜓 ) con3i.a

The proof applies nsyl, which chains an implication whose conclusion is a negation, ( 𝜑 → ¬ 𝜓 ), with an implication ( 𝜒 → 𝜓 ). Here the first one is ( ¬ 𝜓 → ¬ 𝜓 ), which id from the first example proves, and the second one is your hypothesis.

4. Proof by cases

If 𝜓 follows from 𝜑 and also follows from not 𝜑, then 𝜓 holds.

Hypotheses:

  • ⊢ ( 𝜑 → 𝜓 )
  • ⊢ ( ¬ 𝜑 → 𝜓 )

pm2.61i, propositional calculus library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ 𝜓 pm2.18i
    • ⊢ ( ¬ 𝜓 → 𝜓 ) nsyl4
      • ⊢ ( 𝜑 → 𝜓 ) pm2.61i.1
      • ⊢ ( ¬ 𝜑 → 𝜓 ) pm2.61i.2

nsyl4 combines the two hypotheses into ( ¬ 𝜓 → 𝜓 ), and pm2.18i turns that into 𝜓. The cases are 𝜑 and ¬ 𝜑, and the library assumes classical logic, so one of them always holds.

5. De Morgan’s law

Not both 𝜑 and 𝜓 holds exactly when 𝜑 fails or 𝜓 fails.

ianor, propositional calculus library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ ( ¬ ( 𝜑 ∧ 𝜓 ) ↔ ( ¬ 𝜑 ∨ ¬ 𝜓 ) ) bitr3i
    • ⊢ ( ( 𝜑 → ¬ 𝜓 ) ↔ ¬ ( 𝜑 ∧ 𝜓 ) ) imnan
    • ⊢ ( ( 𝜑 → ¬ 𝜓 ) ↔ ( ¬ 𝜑 ∨ ¬ 𝜓 ) ) pm4.62

The proof chains two equivalences. imnan says ( 𝜑 → ¬ 𝜓 ) is equivalent to ¬ ( 𝜑 ∧ 𝜓 ), and pm4.62 says it is equivalent to ( ¬ 𝜑 ∨ ¬ 𝜓 ). bitr3i joins them through the shared middle statement.

6. Subset is transitive

If 𝐴 is a subset of 𝐵 and 𝐵 is a subset of 𝐶, then 𝐴 is a subset of 𝐶.

Hypotheses:

  • ⊢ 𝐴 ⊆ 𝐵
  • ⊢ 𝐵 ⊆ 𝐶

sstri, ring theory library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ 𝐴 ⊆ 𝐶 mp2
    • ⊢ 𝐴 ⊆ 𝐵 sstri.1
    • ⊢ 𝐵 ⊆ 𝐶 sstri.2
    • ⊢ ( 𝐴 ⊆ 𝐵 → ( 𝐵 ⊆ 𝐶 → 𝐴 ⊆ 𝐶 ) ) sstr2

The proof applies mp2, which takes two proven statements 𝜑 and 𝜓 and a proof of ( 𝜑 → ( 𝜓 → 𝜒 ) ) and concludes 𝜒. The implication is sstr2, the same fact stated as one implication, so the proof only has to feed the two hypotheses into it.

7. A group’s identity works on the left

In a group 𝐺 with underlying set 𝐵, operation + and identity element 0, adding 0 on the left of any element 𝑋 of 𝐵 gives 𝑋.

Hypotheses:

  • ⊢ 𝐵 = ( Base ‘ 𝐺 )
  • ⊢ + = ( +g ‘ 𝐺 )
  • ⊢ 0 = ( 0g ‘ 𝐺 )

grplid, ring theory library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ ( ( 𝐺 ∈ Grp ∧ 𝑋 ∈ 𝐵 ) → ( 0 + 𝑋 ) = 𝑋 ) sylan
    • ⊢ ( 𝐺 ∈ Grp → 𝐺 ∈ Mnd ) grpmnd
    • ⊢ ( ( 𝐺 ∈ Mnd ∧ 𝑋 ∈ 𝐵 ) → ( 0 + 𝑋 ) = 𝑋 ) mndlid
      • ⊢ 𝐵 = ( Base ‘ 𝐺 ) grpbn0.b
      • ⊢ + = ( +g ‘ 𝐺 ) grplid.p
      • ⊢ 0 = ( 0g ‘ 𝐺 ) grplid.o

In the statement, 𝐺 ∈ Grp says 𝐺 is a group, and ( 0 + 𝑋 ) adds the identity to 𝑋, where + and 0 are the operation and identity the hypotheses name. The proof applies sylan to reduce the goal to the same fact for monoids. grpmnd shows that every group is a monoid, and mndlid is the monoid theorem.

8. Zero times anything is zero in a ring

In a ring 𝑅 with underlying set 𝐵, multiplication · and zero 0, 0 · 𝑋 = 0 for every element 𝑋 of 𝐵.

Hypotheses:

  • ⊢ 𝐵 = ( Base ‘ 𝑅 )
  • ⊢ · = ( .r ‘ 𝑅 )
  • ⊢ 0 = ( 0g ‘ 𝑅 )

ringlz, ring theory library

A rendering of the statement in the calculator’s font, not a screen capture.

  • ⊢ ( ( 𝑅 ∈ Ring ∧ 𝑋 ∈ 𝐵 ) → ( 0 · 𝑋 ) = 0 ) sylan
    • ⊢ ( 𝑅 ∈ Ring → 𝑅 ∈ Rng ) ringrng
    • ⊢ ( ( 𝑅 ∈ Rng ∧ 𝑋 ∈ 𝐵 ) → ( 0 · 𝑋 ) = 0 ) rnglz
      • ⊢ 𝐵 = ( Base ‘ 𝑅 ) ringz.b
      • ⊢ · = ( .r ‘ 𝑅 ) ringz.t
      • ⊢ 0 = ( 0g ‘ 𝑅 ) ringz.z

In the statement, 𝑅 ∈ Ring says 𝑅 is a ring, and ( 0 · 𝑋 ) multiplies 𝑋 by zero, where · and 0 are the multiplication and zero the hypotheses name. The proof has the same shape as example 7, with ringrng and rnglz in place of grpmnd and mndlid. ringrng shows that a ring is a non-unital ring, which is a ring without the requirement of a multiplicative identity, and rnglz proves the fact there.