Skip to content

Commit 8538cfc

Browse files
committed
General clean up and improve the proof doc
1 parent 724220b commit 8538cfc

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

src/geometric_algebra/nursery/talk.lean

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ universe u
77

88
variables (α : Type u)
99

10-
/--
10+
/-
1111
Groups defined three ways
1212
-/
1313
namespace Group
@@ -54,7 +54,7 @@ end in_real_lean
5454

5555
end Group
5656

57-
/--
57+
/-
5858
An example of a proof
5959
-/
6060
namespace proof_demo
@@ -85,7 +85,7 @@ end
8585
end proof_demo
8686

8787

88-
/-- An example of geometric algebra -/
88+
/- An example of geometric algebra -/
8989
namespace GA
9090

9191
namespace first
@@ -94,19 +94,14 @@ variables (K : Type u) [field K]
9494

9595
variables (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
10098
local postfix `²`:80 := sqr
10199

102100
structure 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 :=
118113
begin
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ₛ,
145149
end
146150

0 commit comments

Comments
 (0)