l3lab/ntp-mathlib huggingface dataset:
theorem div_mul_div_cancel (a : G₀) (hc : c ≠ 0) : a / c * (c / b) = a / b := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : GroupWithZero G₀
a✝ b c a : G₀
hc : c ≠ 0
⊢ a / c * (c / b) = a / b

Next tactic:
rw [← mul_div_assoc, div_mul_cancel _ hc]
theorem div_mul_cancel_of_imp {a b : G₀} (h : b = 0 → a = 0) : a / b * b = a :=
  Classical.by_cases (fun hb : b = 0 => by 

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : GroupWithZero G₀
a✝ b✝ c a b : G₀
h : b = 0 → a = 0
hb : b = 0
⊢ a / b * b = a

Next tactic:
simp [*]
theorem mul_div_cancel_of_imp {a b : G₀} (h : b = 0 → a = 0) : a * b / b = a :=
  Classical.by_cases (fun hb : b = 0 => by 

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : GroupWithZero G₀
a✝ b✝ c a b : G₀
h : b = 0 → a = 0
hb : b = 0
⊢ a * b / b = a

Next tactic:
simp [*]
theorem mul_div_cancel_left_of_imp {a b : G₀} (h : a = 0 → b = 0) : a * b / a = b := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : CommGroupWithZero G₀
a✝ b✝ c d a b : G₀
h : a = 0 → b = 0
⊢ a * b / a = b

Next tactic:
rw [mul_comm, mul_div_cancel_of_imp h]
theorem mul_div_cancel_of_imp' {a b : G₀} (h : b = 0 → a = 0) : b * (a / b) = a := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : CommGroupWithZero G₀
a✝ b✝ c d a b : G₀
h : b = 0 → a = 0
⊢ b * (a / b) = a

Next tactic:
rw [mul_comm, div_mul_cancel_of_imp h]
theorem mul_eq_mul_of_div_eq_div (a : G₀) {b : G₀} (c : G₀) {d : G₀} (hb : b ≠ 0) (hd : d ≠ 0)
    (h : a / b = c / d) : a * d = c * b := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : CommGroupWithZero G₀
a✝ b✝ c✝ d✝ a b c d : G₀
hb : b ≠ 0
hd : d ≠ 0
h : a / b = c / d
⊢ a * d = c * b

Next tactic:
rw [← mul_one a, ← div_self hb, ← mul_comm_div, h, div_mul_eq_mul_div, div_mul_cancel _ hd]
theorem div_helper (b : G₀) (h : a ≠ 0) : 1 / (a * b) * a = 1 / b := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : CommGroupWithZero G₀
a b✝ c d b : G₀
h : a ≠ 0
⊢ 1 / (a * b) * a = 1 / b

Next tactic:
rw [div_mul_eq_mul_div, one_mul, div_mul_right _ h]
theorem div_div_div_cancel_left' (a b : G₀) (hc : c ≠ 0) : c / a / (c / b) = b / a := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝¹ : MonoidWithZero M₀
inst✝ : CommGroupWithZero G₀
a✝ b✝ c d a b : G₀
hc : c ≠ 0
⊢ c / a / (c / b) = b / a

Next tactic:
rw [div_div_div_eq, mul_comm, mul_div_mul_right _ _ hc]
theorem eq_on_inv₀ (f g : F') (h : f a = g a) : f a⁻¹ = g a⁻¹ := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝⁵ : MonoidWithZero M₀
inst✝⁴ : GroupWithZero G₀
inst✝³ : Nontrivial M₀
inst✝² : MonoidWithZero M₀'
inst✝¹ : MonoidWithZeroHomClass F G₀ M₀
inst✝ : MonoidWithZeroHomClass F' G₀ M₀'
f✝ : F
a : G₀
f g : F'
h : f a = g a
⊢ f a⁻¹ = g a⁻¹

Next tactic:
rcases eq_or_ne a 0 with (rfl | ha)
theorem eq_on_inv₀ (f g : F') (h : f a = g a) : f a⁻¹ = g a⁻¹ := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · 

Proof state:
case inl
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝⁵ : MonoidWithZero M₀
inst✝⁴ : GroupWithZero G₀
inst✝³ : Nontrivial M₀
inst✝² : MonoidWithZero M₀'
inst✝¹ : MonoidWithZeroHomClass F G₀ M₀
inst✝ : MonoidWithZeroHomClass F' G₀ M₀'
f✝ : F
f g : F'
h : f 0 = g 0
⊢ f 0⁻¹ = g 0⁻¹

Next tactic:
rw [inv_zero, map_zero, map_zero]
theorem eq_on_inv₀ (f g : F') (h : f a = g a) : f a⁻¹ = g a⁻¹ := by
  rcases eq_or_ne a 0 with (rfl | ha)
  · rw [inv_zero, map_zero, map_zero]
  · 

Proof state:
case inr
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝⁵ : MonoidWithZero M₀
inst✝⁴ : GroupWithZero G₀
inst✝³ : Nontrivial M₀
inst✝² : MonoidWithZero M₀'
inst✝¹ : MonoidWithZeroHomClass F G₀ M₀
inst✝ : MonoidWithZeroHomClass F' G₀ M₀'
f✝ : F
a : G₀
f g : F'
h : f a = g a
ha : a ≠ 0
⊢ f a⁻¹ = g a⁻¹

Next tactic:
exact (IsUnit.mk0 a ha).eq_on_inv f g h
/-- A monoid homomorphism between groups with zeros sending `0` to `0` sends `a⁻¹` to `(f a)⁻¹`. -/
@[simp]
theorem map_inv₀ : f a⁻¹ = (f a)⁻¹ := by
  

Proof state:
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝³ : MonoidWithZero M₀
inst✝² : GroupWithZero G₀
inst✝¹ : GroupWithZero G₀'
inst✝ : MonoidWithZeroHomClass F G₀ G₀'
f : F
a b : G₀
⊢ f a⁻¹ = (f a)⁻¹

Next tactic:
by_cases h : a = 0
/-- A monoid homomorphism between groups with zeros sending `0` to `0` sends `a⁻¹` to `(f a)⁻¹`. -/
@[simp]
theorem map_inv₀ : f a⁻¹ = (f a)⁻¹ := by
  by_cases h : a = 0
  · 

Proof state:
case pos
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝³ : MonoidWithZero M₀
inst✝² : GroupWithZero G₀
inst✝¹ : GroupWithZero G₀'
inst✝ : MonoidWithZeroHomClass F G₀ G₀'
f : F
a b : G₀
h : a = 0
⊢ f a⁻¹ = (f a)⁻¹

Next tactic:
simp [h, map_zero f]
/-- A monoid homomorphism between groups with zeros sending `0` to `0` sends `a⁻¹` to `(f a)⁻¹`. -/
@[simp]
theorem map_inv₀ : f a⁻¹ = (f a)⁻¹ := by
  by_cases h : a = 0
  · simp [h, map_zero f]
  · 

Proof state:
case neg
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝³ : MonoidWithZero M₀
inst✝² : GroupWithZero G₀
inst✝¹ : GroupWithZero G₀'
inst✝ : MonoidWithZeroHomClass F G₀ G₀'
f : F
a b : G₀
h : ¬a = 0
⊢ f a⁻¹ = (f a)⁻¹

Next tactic:
apply eq_inv_of_mul_eq_one_left
/-- A monoid homomorphism between groups with zeros sending `0` to `0` sends `a⁻¹` to `(f a)⁻¹`. -/
@[simp]
theorem map_inv₀ : f a⁻¹ = (f a)⁻¹ := by
  by_cases h : a = 0
  · simp [h, map_zero f]
  · apply eq_inv_of_mul_eq_one_left
    

Proof state:
case neg.h
α : Type u_1
M₀ : Type u_2
G₀ : Type u_3
M₀' : Type u_4
G₀' : Type u_5
F : Type u_6
F' : Type u_7
inst✝³ : MonoidWithZero M₀
inst✝² : GroupWithZero G₀
inst✝¹ : GroupWithZero G₀'
inst✝ : MonoidWithZeroHomClass F G₀ G₀'
f : F
a b : G₀
h : ¬a = 0
⊢ f a⁻¹ * f a = 1

Next tactic:
rw [← map_mul, inv_mul_cancel h, map_one]
theorem ι_eq_v_add_smul_e0 (m : M) (r : R) : ι (Q' Q) (m, r) = v Q m + r • e0 Q := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
r : R
⊢ (ι (Q' Q)) (m, r) = (v Q) m + r • e0 Q

Next tactic:
rw [e0, v, LinearMap.comp_apply, LinearMap.inl_apply, ← LinearMap.map_smul, Prod.smul_mk,
    smul_zero, smul_eq_mul, mul_one, ← LinearMap.map_add, Prod.mk_add_mk, zero_add, add_zero]
theorem e0_mul_e0 : e0 Q * e0 Q = -1 :=
  (ι_sq_scalar _ _).trans <| by 

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
⊢ (algebraMap R (CliffordAlgebra (Q' Q))) ((Q' Q) (0, 1)) = -1

Next tactic:
simp
theorem v_sq_scalar (m : M) : v Q m * v Q m = algebraMap _ _ (Q m) :=
  (ι_sq_scalar _ _).trans <| by 

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (algebraMap R (CliffordAlgebra (Q' Q))) ((Q' Q) ((LinearMap.inl R M R) m)) =
    (algebraMap R (CliffordAlgebra (Q' Q))) (Q m)

Next tactic:
simp
theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ -(e0 Q * (v Q) m) = (v Q) m * e0 Q

Next tactic:
refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q := by
  refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (algebraMap R (CliffordAlgebra (Q' Q))) (QuadraticForm.polar ⇑(Q' Q) (0, 1) ((LinearMap.inl R M R) m)) = 0

Next tactic:
dsimp [QuadraticForm.polar]
theorem neg_e0_mul_v (m : M) : -(e0 Q * v Q m) = v Q m * e0 Q := by
  refine' neg_eq_of_add_eq_zero_right ((ι_mul_ι_add_swap _ _).trans _)
  dsimp [QuadraticForm.polar]
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (algebraMap R (CliffordAlgebra (Q' Q))) (Q (0 + m) + -((1 + 0) * (1 + 0)) - (Q 0 + -(1 * 1)) - (Q m + -(0 * 0))) = 0

Next tactic:
simp only [add_zero, mul_zero, mul_one, zero_add, neg_zero, QuadraticForm.map_zero,
    add_sub_cancel, sub_self, map_zero, zero_sub]
theorem neg_v_mul_e0 (m : M) : -(v Q m * e0 Q) = e0 Q * v Q m := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ -((v Q) m * e0 Q) = e0 Q * (v Q) m

Next tactic:
rw [neg_eq_iff_eq_neg]
theorem neg_v_mul_e0 (m : M) : -(v Q m * e0 Q) = e0 Q * v Q m := by
  rw [neg_eq_iff_eq_neg]
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (v Q) m * e0 Q = -(e0 Q * (v Q) m)

Next tactic:
exact (neg_e0_mul_v _ m).symm
@[simp]
theorem e0_mul_v_mul_e0 (m : M) : e0 Q * v Q m * e0 Q = v Q m := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ e0 Q * (v Q) m * e0 Q = (v Q) m

Next tactic:
rw [← neg_v_mul_e0, ← neg_mul, mul_assoc, e0_mul_e0, mul_neg_one, neg_neg]
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
⊢ CliffordAlgebra Q →ₐ[R] ↥(even (Q' Q))

Next tactic:
refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · 

Proof state:
case refine'_1
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
⊢ M →ₗ[R] ↥(even (Q' Q))

Next tactic:
refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · 

Proof state:
case refine'_1.refine'_1
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
⊢ M →ₗ[R] CliffordAlgebra (Q' Q)

Next tactic:
exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
    

Proof state:
case refine'_1.refine'_2
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ LinearMap.range (ι (Q' Q)) ^ ↑{ val := 2, property := (_ : ↑2 = ↑2) }

Next tactic:
rw [Subtype.coe_mk, pow_two]
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
    rw [Subtype.coe_mk, pow_two]
    

Proof state:
case refine'_1.refine'_2
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ LinearMap.range (ι (Q' Q)) * LinearMap.range (ι (Q' Q))

Next tactic:
exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
    rw [Subtype.coe_mk, pow_two]
    exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
  · 

Proof state:
case refine'_2
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (LinearMap.codRestrict (⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i) (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q)
          (_ : ∀ (m : M), (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ ⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i))
        m *
      (LinearMap.codRestrict (⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i) (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q)
          (_ : ∀ (m : M), (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ ⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i))
        m =
    (algebraMap R ↥(even (Q' Q))) (Q m)

Next tactic:
ext1
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
    rw [Subtype.coe_mk, pow_two]
    exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
  · ext1
    

Proof state:
case refine'_2.a
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ ↑((LinearMap.codRestrict (⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i) (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q)
            (_ : ∀ (m : M), (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ ⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i))
          m *
        (LinearMap.codRestrict (⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i) (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q)
            (_ : ∀ (m : M), (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ ⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i))
          m) =
    ↑((algebraMap R ↥(even (Q' Q))) (Q m))

Next tactic:
rw [Subalgebra.coe_mul]
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
    rw [Subtype.coe_mk, pow_two]
    exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
  · ext1
    rw [Subalgebra.coe_mul]  -- porting note: was part of the `dsimp only` below
    

Proof state:
case refine'_2.a
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ ↑((LinearMap.codRestrict (⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i) (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q)
            (_ : ∀ (m : M), (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ ⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i))
          m) *
      ↑((LinearMap.codRestrict (⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i) (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q)
            (_ : ∀ (m : M), (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ ⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i))
          m) =
    ↑((algebraMap R ↥(even (Q' Q))) (Q m))

Next tactic:
erw [LinearMap.codRestrict_apply]
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
    rw [Subtype.coe_mk, pow_two]
    exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
  · ext1
    rw [Subalgebra.coe_mul]  -- porting note: was part of the `dsimp only` below
    erw [LinearMap.codRestrict_apply] -- porting note: was part of the `dsimp only` below
    

Proof state:
case refine'_2.a
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m * (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m = ↑((algebraMap R ↥(even (Q' Q))) (Q m))

Next tactic:
dsimp only [LinearMap.comp_apply, LinearMap.mulLeft_apply, Subalgebra.coe_algebraMap]
/-- The embedding from the smaller algebra into the new larger one. -/
def toEven : CliffordAlgebra Q →ₐ[R] CliffordAlgebra.even (Q' Q) := by
  refine' CliffordAlgebra.lift Q ⟨_, fun m => _⟩
  · refine' LinearMap.codRestrict _ _ fun m => Submodule.mem_iSup_of_mem ⟨2, rfl⟩ _
    · exact (LinearMap.mulLeft R <| e0 Q).comp (v Q)
    rw [Subtype.coe_mk, pow_two]
    exact Submodule.mul_mem_mul (LinearMap.mem_range_self _ _) (LinearMap.mem_range_self _ _)
  · ext1
    rw [Subalgebra.coe_mul]  -- porting note: was part of the `dsimp only` below
    erw [LinearMap.codRestrict_apply] -- porting note: was part of the `dsimp only` below
    dsimp only [LinearMap.comp_apply, LinearMap.mulLeft_apply, Subalgebra.coe_algebraMap]
    

Proof state:
case refine'_2.a
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ e0 Q * (v Q) m * (e0 Q * (v Q) m) = (algebraMap R (CliffordAlgebra (Q' Q))) (Q m)

Next tactic:
rw [← mul_assoc, e0_mul_v_mul_e0, v_sq_scalar]
@[simp]
theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (Q' Q)) = e0 Q * v Q m := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ ↑((toEven Q) ((ι Q) m)) = e0 Q * (v Q) m

Next tactic:
rw [toEven, CliffordAlgebra.lift_ι_apply]
@[simp]
theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (Q' Q)) = e0 Q * v Q m := by
  rw [toEven, CliffordAlgebra.lift_ι_apply]
  -- porting note: was `rw`
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ ↑((LinearMap.codRestrict (⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i) (LinearMap.comp (LinearMap.mulLeft R (e0 Q)) (v Q))
          (_ : ∀ (m : M), (LinearMap.mulLeft R (e0 Q) ∘ₗ v Q) m ∈ ⨆ i, LinearMap.range (ι (Q' Q)) ^ ↑i))
        m) =
    e0 Q * (v Q) m

Next tactic:
erw [LinearMap.codRestrict_apply]
@[simp]
theorem toEven_ι (m : M) : (toEven Q (ι Q m) : CliffordAlgebra (Q' Q)) = e0 Q * v Q m := by
  rw [toEven, CliffordAlgebra.lift_ι_apply]
  -- porting note: was `rw`
  erw [LinearMap.codRestrict_apply]
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
m : M
⊢ (LinearMap.comp (LinearMap.mulLeft R (e0 Q)) (v Q)) m = e0 Q * (v Q) m

Next tactic:
rw [LinearMap.coe_comp, Function.comp_apply, LinearMap.mulLeft_apply]
/-- The embedding from the even subalgebra with an extra dimension into the original algebra. -/
def ofEven : CliffordAlgebra.even (Q' Q) →ₐ[R] CliffordAlgebra Q := by
  /-
    Recall that we need:
     * `f ⟨0,1⟩ ⟨x,0⟩ = ι x`
     * `f ⟨x,0⟩ ⟨0,1⟩ = -ι x`
     * `f ⟨x,0⟩ ⟨y,0⟩ = ι x * ι y`
     * `f ⟨0,1⟩ ⟨0,1⟩ = -1`
    -/
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
⊢ ↥(even (Q' Q)) →ₐ[R] CliffordAlgebra Q

Next tactic:
let f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
    ((Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
          (ι Q).comp (LinearMap.fst _ _ _) +
            (Algebra.linearMap R _).comp (LinearMap.snd _ _ _)).compl₂
      ((ι Q).comp (LinearMap.fst _ _ _) - (Algebra.linearMap R _).comp (LinearMap.snd _ _ _))
/-- The embedding from the even subalgebra with an extra dimension into the original algebra. -/
def ofEven : CliffordAlgebra.even (Q' Q) →ₐ[R] CliffordAlgebra Q := by
  /-
    Recall that we need:
     * `f ⟨0,1⟩ ⟨x,0⟩ = ι x`
     * `f ⟨x,0⟩ ⟨0,1⟩ = -ι x`
     * `f ⟨x,0⟩ ⟨y,0⟩ = ι x * ι y`
     * `f ⟨0,1⟩ ⟨0,1⟩ = -1`
    -/
  let f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
    ((Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
          (ι Q).comp (LinearMap.fst _ _ _) +
            (Algebra.linearMap R _).comp (LinearMap.snd _ _ _)).compl₂
      ((ι Q).comp (LinearMap.fst _ _ _) - (Algebra.linearMap R _).comp (LinearMap.snd _ _ _))
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
  LinearMap.compl₂
    (AlgHom.toLinearMap (Algebra.lmul R (CliffordAlgebra Q)) ∘ₗ
      (ι Q ∘ₗ LinearMap.fst R M R + Algebra.linearMap R (CliffordAlgebra Q) ∘ₗ LinearMap.snd R M R))
    (ι Q ∘ₗ LinearMap.fst R M R - Algebra.linearMap R (CliffordAlgebra Q) ∘ₗ LinearMap.snd R M R)
⊢ ↥(even (Q' Q)) →ₐ[R] CliffordAlgebra Q

Next tactic:
haveI f_apply : ∀ x y, f x y = (ι Q x.1 + algebraMap R _ x.2) * (ι Q y.1 - algebraMap R _ y.2) :=
    fun x y => by rfl
/-- The embedding from the even subalgebra with an extra dimension into the original algebra. -/
def ofEven : CliffordAlgebra.even (Q' Q) →ₐ[R] CliffordAlgebra Q := by
  /-
    Recall that we need:
     * `f ⟨0,1⟩ ⟨x,0⟩ = ι x`
     * `f ⟨x,0⟩ ⟨0,1⟩ = -ι x`
     * `f ⟨x,0⟩ ⟨y,0⟩ = ι x * ι y`
     * `f ⟨0,1⟩ ⟨0,1⟩ = -1`
    -/
  let f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
    ((Algebra.lmul R (CliffordAlgebra Q)).toLinearMap.comp <|
          (ι Q).comp (LinearMap.fst _ _ _) +
            (Algebra.linearMap R _).comp (LinearMap.snd _ _ _)).compl₂
      ((ι Q).comp (LinearMap.fst _ _ _) - (Algebra.linearMap R _).comp (LinearMap.snd _ _ _))
  haveI f_apply : ∀ x y, f x y = (ι Q x.1 + algebraMap R _ x.2) * (ι Q y.1 - algebraMap R _ y.2) :=
    fun x y => by 

Proof state:
R : Type u_1
M : Type u_2
inst✝² : CommRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q : QuadraticForm R M
f : M × R →ₗ[R] M × R →ₗ[R] CliffordAlgebra Q :=
  LinearMap.compl₂
    (AlgHom.toLinearMap (Algebra.lmul R (CliffordAlgebra Q)) ∘ₗ
      (ι Q ∘ₗ LinearMap.fst R M R + Algebra.linearMap R (CliffordAlgebra Q) ∘ₗ LinearMap.snd R M R))
    (ι Q ∘ₗ LinearMap.fst R M R - Algebra.linearMap R (CliffordAlgebra Q) ∘ₗ LinearMap.snd R M R)
x y : M × R
⊢ (f x) y = ((ι Q) x.1 + (algebraMap R (CliffordAlgebra Q)) x.2) * ((ι Q) y.1 - (algebraMap R (CliffordAlgebra Q)) y.2)

Next tactic:
rfl