Chapter 2 · Logic

Not, false and if-and-only-if

You are reading the whole lesson on one page. Back to one step at a time

Step 1 of 22 · Concept

False has no proof

In this lesson you prove "not" and "if and only if", and meet a proof that rests on an axiom.

Two propositions are special. True always holds, and trivial proves it:

example : True := by trivial

False has no proof at all. A hypothesis h : False means the hypotheses contradict each other: they can never all hold.

theorem nn_intro (p : Prop) (hp : p) : ¬¬p := by
  intro hn
  exact hn hp
theorem nn_intro' (p : Prop) (hp : p) : ¬¬p := by
  intro hn
  contradiction
theorem clash (p : Prop) (hp : p) (hn : ¬p) : 1 = 2 := by
  exfalso
  exact hn hp
example : True := by trivial
theorem anything (p q : Prop) (hp : p) (hn : ¬p) : q := by
  exact hp
theorem tollens (p q : Prop) (hpq : p → q) (hnq : ¬q) : ¬p := by
  sorry
theorem and_comm' (p q : Prop) : p ∧ q ↔ q ∧ p := by
  constructor
  · intro h
    constructor
    · exact h.2
    · exact h.1
  · intro h
    constructor
    · exact h.2
    · exact h.1
theorem iff_swap (p q : Prop) (h : p ↔ q) : q ↔ p := by
  sorry
theorem or_not (p q : Prop) (h : p ∨ q) (hn : ¬p) : q := by
  sorry
theorem p_or_not (p : Prop) : p ∨ ¬p := by
  by_cases h : p
  · exact Or.inl h
  · exact Or.inr h
#print axioms p_or_not
theorem not_either (p q : Prop) : ¬(p ∨ q) ↔ ¬p ∧ ¬q := by
  sorry
theorem contra (p q : Prop) (h : ¬q → ¬p) (hp : p) : q := by
  sorry
Terminal
Step 1 of 9See a double negation proved

Keyboard shortcuts

The step

ContinueEnter
Previous / next stepAlt+[ · Alt+]
Move along the steps bar← → Home End, then Enter
From a quiz's title to its answers↓
Skip to the stepTab, then Enter (first on the page)
Course outlineAlt+O
These shortcuts?

The workspace

Run the stepCtrl+Enter (⌘↵ on a Mac)
Lesson → editor → consoleF6 (Shift+F6 back)
Output ↔ TerminalCtrl+`
Focus the editorCtrl+. (⌘. on a Mac)
Hide or show the lessonAlt+L
Restore, close a messageEsc (outside the editor and the terminal)

The editor

Leave the editorF6 (Shift+F6 back); or Ctrl+M (⌃⇧M on a Mac), then Tab moves the focus (not in the vim mode)
Open a file by nameCtrl+P (⌘P on a Mac)
All commandsCtrl+Shift+P (⌘⇧P on a Mac) or F1
Go to a lineCtrl+G (⌃G on a Mac)
Show or hide the filesCtrl+B (⌘B on a Mac)
Previous / next file tabCtrl+Shift+[ · Ctrl+Shift+] (⌘⇧[ · ⌘⇧] on a Mac)
The file tabs← → Home End on a tab; Delete closes it
Save the files nowCtrl+S (⌘S on a Mac)
Go to a symbol in the fileCtrl+Shift+O (⌘⇧O on a Mac)
Go to the definitionF12
Format the fileCtrl+Shift+F (⌘⇧F on a Mac), or Shift+Alt+F
Go back / forward after a jumpAlt+← · Alt+→ (⌃- · ⌃⇧- on a Mac)