@@ -7,7 +7,7 @@ universe u
77
88variables (α : Type u)
99
10- /--
10+ /-
1111Groups defined three ways
1212-/
1313namespace Group
@@ -54,7 +54,7 @@ end in_real_lean
5454
5555end Group
5656
57- /--
57+ /-
5858An example of a proof
5959-/
6060namespace proof_demo
8585end proof_demo
8686
8787
88- /-- An example of geometric algebra -/
88+ /- An example of geometric algebra -/
8989namespace GA
9090
9191namespace first
@@ -94,19 +94,14 @@ variables (K : Type u) [field K]
9494
9595variables (V : Type u) [add_comm_group V] [vector_space K V]
9696
97- #print linear_map
98-
99- def sqr {α : Type u} [has_mul α] (x : α) := x*x
97+ def sqr {α : Type u} [has_mul α] (x : α) := x * x
10098local postfix `²`:80 := sqr
10199
102100structure GA (G : Type u) [ring G] [algebra K G] :=
103101(fₛ : K →+* G)
104102(fᵥ : V →ₗ[K] G)
105- -- (infix ` ❍ `:70 := has_mul.mul)
106103(contraction : ∀ v : V, ∃ k : K, (fᵥ v)² = fₛ k)
107104
108- -- local infix ` ❍ `:70 := has_mul.mul
109-
110105/-
111106 Symmetrised product of two vectors must be a scalar
112107-/
@@ -116,31 +111,40 @@ example
116111 let a := ga.fᵥ aᵥ, b := ga.fᵥ bᵥ, k := ga.fₛ kₛ in
117112 a * b + b * a = k :=
118113begin
114+ -- vectors aᵥ bᵥ
119115 assume aᵥ bᵥ,
120- -- some tricks to unfold the `let`s and make things look tidy
121- delta,
116+
117+ -- multivectors a b
122118 set a := ga.fᵥ aᵥ,
123119 set b := ga.fᵥ bᵥ,
124120
125- -- collect square terms
121+ -- simplify the goal by definition, i.e. remove let etc.
122+ delta,
123+
124+ -- rewrite the goal to square terms
126125 rw (show a * b + b * a = (a + b)² - a² - b², from begin
127126 unfold sqr,
128127 simp only [left_distrib, right_distrib],
129128 abel,
130129 end ),
131130
132- -- replace them with a scalar using the ga axiom
131+ -- rewrite square terms of vectors
132+ -- to scalars using the contraction axiom
133133 obtain ⟨kabₛ, hab⟩ := ga.contraction (aᵥ + bᵥ),
134134 obtain ⟨kaₛ, ha⟩ := ga.contraction (aᵥ),
135135 obtain ⟨kbₛ, hb⟩ := ga.contraction (bᵥ),
136+
137+ -- map the above to multivectors
136138 rw [
137139 show (a + b)² = ga.fₛ kabₛ, by rw [← hab, linear_map.map_add],
138- show a² = ga.fₛ kaₛ, by rw ha ,
139- show b² = ga.fₛ kbₛ, by rw hb
140+ show a² = ga.fₛ kaₛ, by rw [← ha] ,
141+ show b² = ga.fₛ kbₛ, by rw [← hb]
140142 ],
141143
142- -- rearrange, solve by inspection
144+ -- collect scalars
143145 simp only [← ring_hom.map_sub],
146+
147+ -- use the scalars as the witness of the existence
144148 use kabₛ - kaₛ - kbₛ,
145149end
146150
0 commit comments