Skip to content

Commit

Permalink
Repalce let with have at more places.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkomarath committed May 1, 2024
1 parent f026ef3 commit 9130fbd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lean4.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ it to construct proofs by itself.
The same theorem, proved using tactics.
-/
theorem even_mul_even_is_even {n m : Nat} (hn : Even n) (hm : Even m) : Even (n*m) := by
let ⟨k1, hk1⟩ := hn
let ⟨k2, hk2⟩ := hm
have ⟨k1, hk1⟩ := hn
have ⟨k2, hk2⟩ := hm
apply Exists.intro $ k1 * (2 * k2)
calc
n*m = (2 * k1) * (2 * k2) := by rw [hk1, hk2]
Expand All @@ -161,7 +161,7 @@ Let us work with implications.
-/
theorem succ_of_even_is_odd' {n : Nat} : Even n → Odd (n+1) :=
fun hn =>
let ⟨k, hk⟩ := hn
have ⟨k, hk⟩ := hn
Exists.intro k (
calc
n + 1 = 2 * k + 1 := by rw [hk]
Expand All @@ -183,7 +183,7 @@ Same theorem, now using tactics.
-/
theorem succ_of_even_is_odd {n : Nat} : Even n → Odd (n+1) := by
intro hn
let ⟨k, hk⟩ := hn
have ⟨k, hk⟩ := hn
apply Exists.intro k
rw [hk]
Expand Down Expand Up @@ -393,9 +393,9 @@ theorem identity_element_unique : ∀ e' : G, is_identity e' → e' = e := by
intro e'
intro h
specialize h e
let ⟨h1, _⟩ := h
have ⟨h1, _⟩ := h
have h' := identity e'
let ⟨_, h2⟩ := h'
have ⟨_, h2⟩ := h'
exact Eq.trans (Eq.symm h2) h1
/-
Note that we used the `identity` axiom.
Expand All @@ -407,8 +407,8 @@ Left cancellation. We have to use both `identity` and `inverse` axioms from
-/
theorem left_cancellation : ∀ x y : G, a * x = a * y → x = y := by
have h1 := inverse a
let ⟨ai, a_inv⟩ := h1
let ⟨_, h2⟩ := a_inv
have ⟨ai, a_inv⟩ := h1
have ⟨_, h2⟩ := a_inv
intro x y
intro h3
calc
Expand Down

0 comments on commit 9130fbd

Please sign in to comment.