l3lab/ntp-mathlib huggingface dataset:
/-- Convert between two algebras of different quadratic form, sending vector to vectors, scalars to
scalars, and adjusting products by a contraction term.

This is $\lambda_B$ from [bourbaki2007][] $9 Lemma 2. -/
def changeForm (h : B.toQuadraticForm = Q' - Q) : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' :=
  foldr Q (changeFormAux Q' B)
    (fun m x =>
      (changeFormAux_changeFormAux Q' B m x).trans <| by
        

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h✝ : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
h : BilinForm.toQuadraticForm B = Q' - Q
m : M
x : CliffordAlgebra Q'
⊢ (Q' m - BilinForm.bilin B m m) • x = Q m • x

Next tactic:
dsimp only [← BilinForm.toQuadraticForm_apply]
/-- Convert between two algebras of different quadratic form, sending vector to vectors, scalars to
scalars, and adjusting products by a contraction term.

This is $\lambda_B$ from [bourbaki2007][] $9 Lemma 2. -/
def changeForm (h : B.toQuadraticForm = Q' - Q) : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' :=
  foldr Q (changeFormAux Q' B)
    (fun m x =>
      (changeFormAux_changeFormAux Q' B m x).trans <| by
        dsimp only [← BilinForm.toQuadraticForm_apply]
        

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h✝ : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
h : BilinForm.toQuadraticForm B = Q' - Q
m : M
x : CliffordAlgebra Q'
⊢ (Q' m - (BilinForm.toQuadraticForm B) m) • x = Q m • x

Next tactic:
rw [h, QuadraticForm.sub_apply, sub_sub_cancel]
theorem changeForm.associated_neg_proof [Invertible (2 : R)] :
    (QuadraticForm.associated (R := R) (M := M) (-Q)).toQuadraticForm = 0 - Q := by
  

Proof state:
R : Type u1
inst✝³ : CommRing R
M : Type u2
inst✝² : AddCommGroup M
inst✝¹ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
inst✝ : Invertible 2
⊢ BilinForm.toQuadraticForm (QuadraticForm.associated (-Q)) = 0 - Q

Next tactic:
simp [QuadraticForm.toQuadraticForm_associated]
@[simp]
theorem changeForm_one : changeForm h (1 : CliffordAlgebra Q) = 1 := by
  

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
⊢ (changeForm h) 1 = 1

Next tactic:
simpa using changeForm_algebraMap h (1 : R)
@[simp]
theorem changeForm_ι (m : M) : changeForm h (ι (M := M) Q m) = ι (M := M) Q' m :=
  (foldr_ι _ _ _ _ _).trans <|
    Eq.symm <| by 

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
m : M
⊢ (ι Q') m = ((changeFormAux Q' B) m) 1

Next tactic:
rw [changeFormAux_apply_apply, mul_one, contractLeft_one, sub_zero]
theorem changeForm_ι_mul (m : M) (x : CliffordAlgebra Q) :
    changeForm h (ι (M := M) Q m * x) = ι (M := M) Q' m * changeForm h x
    - contractLeft (Q := Q') (BilinForm.toLin B m) (changeForm h x) :=
-- Porting note: original statement
--    - BilinForm.toLin B m⌋changeForm h x :=
  (foldr_mul _ _ _ _ _ _).trans <| by 

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
m : M
x : CliffordAlgebra Q
⊢ ((foldr Q (changeFormAux Q' B)
          (_ : ∀ (m : M) (x : CliffordAlgebra Q'), ((changeFormAux Q' B) m) (((changeFormAux Q' B) m) x) = Q m • x))
        (((foldr Q (changeFormAux Q' B)
              (_ : ∀ (m : M) (x : CliffordAlgebra Q'), ((changeFormAux Q' B) m) (((changeFormAux Q' B) m) x) = Q m • x))
            1)
          x))
      ((ι Q) m) =
    (ι Q') m * (changeForm h) x - (contractLeft ((BilinForm.toLin B) m)) ((changeForm h) x)

Next tactic:
rw [foldr_ι]
theorem changeForm_ι_mul (m : M) (x : CliffordAlgebra Q) :
    changeForm h (ι (M := M) Q m * x) = ι (M := M) Q' m * changeForm h x
    - contractLeft (Q := Q') (BilinForm.toLin B m) (changeForm h x) :=
-- Porting note: original statement
--    - BilinForm.toLin B m⌋changeForm h x :=
  (foldr_mul _ _ _ _ _ _).trans <| by rw [foldr_ι]; 

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
m : M
x : CliffordAlgebra Q
⊢ ((changeFormAux Q' B) m)
      (((foldr Q (changeFormAux Q' B)
            (_ : ∀ (m : M) (x : CliffordAlgebra Q'), ((changeFormAux Q' B) m) (((changeFormAux Q' B) m) x) = Q m • x))
          1)
        x) =
    (ι Q') m * (changeForm h) x - (contractLeft ((BilinForm.toLin B) m)) ((changeForm h) x)

Next tactic:
rfl
theorem changeForm_ι_mul_ι (m₁ m₂ : M) :
    changeForm h (ι Q m₁ * ι Q m₂) = ι Q' m₁ * ι Q' m₂ - algebraMap _ _ (B m₁ m₂) := by
  

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
m₁ m₂ : M
⊢ (changeForm h) ((ι Q) m₁ * (ι Q) m₂) =
    (ι Q') m₁ * (ι Q') m₂ - (algebraMap R (CliffordAlgebra Q')) (BilinForm.bilin B m₁ m₂)

Next tactic:
rw [changeForm_ι_mul, changeForm_ι, contractLeft_ι, BilinForm.toLin_apply]
/-- Theorem 23 of [grinberg_clifford_2016][] -/
theorem changeForm_contractLeft (d : Module.Dual R M) (x : CliffordAlgebra Q) :
    -- Porting note: original statement
    --    changeForm h (d⌋x) = d⌋changeForm h x := by
    changeForm h (contractLeft (Q := Q) d x) = contractLeft (Q := Q') d (changeForm h x) := by
  

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
d : Module.Dual R M
x : CliffordAlgebra Q
⊢ (changeForm h) ((contractLeft d) x) = (contractLeft d) ((changeForm h) x)

Next tactic:
induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
/-- Theorem 23 of [grinberg_clifford_2016][] -/
theorem changeForm_contractLeft (d : Module.Dual R M) (x : CliffordAlgebra Q) :
    -- Porting note: original statement
    --    changeForm h (d⌋x) = d⌋changeForm h x := by
    changeForm h (contractLeft (Q := Q) d x) = contractLeft (Q := Q') d (changeForm h x) := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · 

Proof state:
case hr
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
d : Module.Dual R M
r : R
⊢ (changeForm h) ((contractLeft d) ((algebraMap R (CliffordAlgebra Q)) r)) =
    (contractLeft d) ((changeForm h) ((algebraMap R (CliffordAlgebra Q)) r))

Next tactic:
simp only [contractLeft_algebraMap, changeForm_algebraMap, map_zero]
/-- Theorem 23 of [grinberg_clifford_2016][] -/
theorem changeForm_contractLeft (d : Module.Dual R M) (x : CliffordAlgebra Q) :
    -- Porting note: original statement
    --    changeForm h (d⌋x) = d⌋changeForm h x := by
    changeForm h (contractLeft (Q := Q) d x) = contractLeft (Q := Q') d (changeForm h x) := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · simp only [contractLeft_algebraMap, changeForm_algebraMap, map_zero]
  · 

Proof state:
case h_add
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
d : Module.Dual R M
x y : CliffordAlgebra Q
hx : (changeForm h) ((contractLeft d) x) = (contractLeft d) ((changeForm h) x)
hy : (changeForm h) ((contractLeft d) y) = (contractLeft d) ((changeForm h) y)
⊢ (changeForm h) ((contractLeft d) (x + y)) = (contractLeft d) ((changeForm h) (x + y))

Next tactic:
rw [map_add, map_add, map_add, map_add, hx, hy]
/-- Theorem 23 of [grinberg_clifford_2016][] -/
theorem changeForm_contractLeft (d : Module.Dual R M) (x : CliffordAlgebra Q) :
    -- Porting note: original statement
    --    changeForm h (d⌋x) = d⌋changeForm h x := by
    changeForm h (contractLeft (Q := Q) d x) = contractLeft (Q := Q') d (changeForm h x) := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · simp only [contractLeft_algebraMap, changeForm_algebraMap, map_zero]
  · rw [map_add, map_add, map_add, map_add, hx, hy]
  · 

Proof state:
case h_mul_ι
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
d : Module.Dual R M
m : CliffordAlgebra Q
x : M
hx : (changeForm h) ((contractLeft d) m) = (contractLeft d) ((changeForm h) m)
⊢ (changeForm h) ((contractLeft d) ((ι Q) x * m)) = (contractLeft d) ((changeForm h) ((ι Q) x * m))

Next tactic:
simp only [contractLeft_ι_mul, changeForm_ι_mul, map_sub, LinearMap.map_smul]
/-- Theorem 23 of [grinberg_clifford_2016][] -/
theorem changeForm_contractLeft (d : Module.Dual R M) (x : CliffordAlgebra Q) :
    -- Porting note: original statement
    --    changeForm h (d⌋x) = d⌋changeForm h x := by
    changeForm h (contractLeft (Q := Q) d x) = contractLeft (Q := Q') d (changeForm h x) := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · simp only [contractLeft_algebraMap, changeForm_algebraMap, map_zero]
  · rw [map_add, map_add, map_add, map_add, hx, hy]
  · simp only [contractLeft_ι_mul, changeForm_ι_mul, map_sub, LinearMap.map_smul]
    

Proof state:
case h_mul_ι
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
d : Module.Dual R M
m : CliffordAlgebra Q
x : M
hx : (changeForm h) ((contractLeft d) m) = (contractLeft d) ((changeForm h) m)
⊢ d x • (changeForm h) m -
      ((ι Q') x * (changeForm h) ((contractLeft d) m) -
        (contractLeft ((BilinForm.toLin B) x)) ((changeForm h) ((contractLeft d) m))) =
    d x • (changeForm h) m - (ι Q') x * (contractLeft d) ((changeForm h) m) -
      (contractLeft d) ((contractLeft ((BilinForm.toLin B) x)) ((changeForm h) m))

Next tactic:
rw [← hx, contractLeft_comm, ← sub_add, sub_neg_eq_add, ← hx]
theorem changeForm_self_apply (x : CliffordAlgebra Q) : changeForm (Q' := Q)
    changeForm.zero_proof x = x := by
  

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
x : CliffordAlgebra Q
⊢ (changeForm (_ : BilinForm.toQuadraticForm 0 = Q - Q)) x = x

Next tactic:
induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
theorem changeForm_self_apply (x : CliffordAlgebra Q) : changeForm (Q' := Q)
    changeForm.zero_proof x = x := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · 

Proof state:
case hr
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
r : R
⊢ (changeForm (_ : BilinForm.toQuadraticForm 0 = Q - Q)) ((algebraMap R (CliffordAlgebra Q)) r) =
    (algebraMap R (CliffordAlgebra Q)) r

Next tactic:
simp_rw [changeForm_algebraMap]
theorem changeForm_self_apply (x : CliffordAlgebra Q) : changeForm (Q' := Q)
    changeForm.zero_proof x = x := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · simp_rw [changeForm_algebraMap]
  · 

Proof state:
case h_add
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
x y : CliffordAlgebra Q
hx : (changeForm (_ : BilinForm.toQuadraticForm 0 = Q - Q)) x = x
hy : (changeForm (_ : BilinForm.toQuadraticForm 0 = Q - Q)) y = y
⊢ (changeForm (_ : BilinForm.toQuadraticForm 0 = Q - Q)) (x + y) = x + y

Next tactic:
rw [map_add, hx, hy]
theorem changeForm_self_apply (x : CliffordAlgebra Q) : changeForm (Q' := Q)
    changeForm.zero_proof x = x := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · simp_rw [changeForm_algebraMap]
  · rw [map_add, hx, hy]
  · 

Proof state:
case h_mul_ι
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
m : CliffordAlgebra Q
x : M
hx : (changeForm (_ : BilinForm.toQuadraticForm 0 = Q - Q)) m = m
⊢ (changeForm (_ : BilinForm.toQuadraticForm 0 = Q - Q)) ((ι Q) x * m) = (ι Q) x * m

Next tactic:
rw [changeForm_ι_mul, hx, map_zero, LinearMap.zero_apply, map_zero, LinearMap.zero_apply,
      sub_zero]
/-- This is [bourbaki2007][] $9 Lemma 3. -/
theorem changeForm_changeForm (x : CliffordAlgebra Q) :
    changeForm h' (changeForm h x) = changeForm (changeForm.add_proof h h') x := by
  

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
x : CliffordAlgebra Q
⊢ (changeForm h') ((changeForm h) x) = (changeForm (_ : BilinForm.toQuadraticForm (B + B') = Q'' - Q)) x

Next tactic:
induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
/-- This is [bourbaki2007][] $9 Lemma 3. -/
theorem changeForm_changeForm (x : CliffordAlgebra Q) :
    changeForm h' (changeForm h x) = changeForm (changeForm.add_proof h h') x := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · 

Proof state:
case hr
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
r : R
⊢ (changeForm h') ((changeForm h) ((algebraMap R (CliffordAlgebra Q)) r)) =
    (changeForm (_ : BilinForm.toQuadraticForm (B + B') = Q'' - Q)) ((algebraMap R (CliffordAlgebra Q)) r)

Next tactic:
simp_rw [changeForm_algebraMap]
/-- This is [bourbaki2007][] $9 Lemma 3. -/
theorem changeForm_changeForm (x : CliffordAlgebra Q) :
    changeForm h' (changeForm h x) = changeForm (changeForm.add_proof h h') x := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · simp_rw [changeForm_algebraMap]
  · 

Proof state:
case h_add
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
x y : CliffordAlgebra Q
hx : (changeForm h') ((changeForm h) x) = (changeForm (_ : BilinForm.toQuadraticForm (B + B') = Q'' - Q)) x
hy : (changeForm h') ((changeForm h) y) = (changeForm (_ : BilinForm.toQuadraticForm (B + B') = Q'' - Q)) y
⊢ (changeForm h') ((changeForm h) (x + y)) = (changeForm (_ : BilinForm.toQuadraticForm (B + B') = Q'' - Q)) (x + y)

Next tactic:
rw [map_add, map_add, map_add, hx, hy]
/-- This is [bourbaki2007][] $9 Lemma 3. -/
theorem changeForm_changeForm (x : CliffordAlgebra Q) :
    changeForm h' (changeForm h x) = changeForm (changeForm.add_proof h h') x := by
  induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
  · simp_rw [changeForm_algebraMap]
  · rw [map_add, map_add, map_add, hx, hy]
  · 

Proof state:
case h_mul_ι
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
m : CliffordAlgebra Q
x : M
hx : (changeForm h') ((changeForm h) m) = (changeForm (_ : BilinForm.toQuadraticForm (B + B') = Q'' - Q)) m
⊢ (changeForm h') ((changeForm h) ((ι Q) x * m)) =
    (changeForm (_ : BilinForm.toQuadraticForm (B + B') = Q'' - Q)) ((ι Q) x * m)

Next tactic:
rw [changeForm_ι_mul, map_sub, changeForm_ι_mul, changeForm_ι_mul, hx, sub_sub, map_add,
      LinearMap.add_apply, map_add, LinearMap.add_apply, changeForm_contractLeft, hx,
      add_comm (_ : CliffordAlgebra Q'')]
/-- Any two algebras whose quadratic forms differ by a bilinear form are isomorphic as modules.

This is $\bar \lambda_B$ from [bourbaki2007][] $9 Proposition 3. -/
@[simps apply]
def changeFormEquiv : CliffordAlgebra Q ≃ₗ[R] CliffordAlgebra Q' :=
  { changeForm h with
    toFun := changeForm h
    invFun := changeForm (changeForm.neg_proof h)
    left_inv := fun x => by
      

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
src✝ : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' := changeForm h
x : CliffordAlgebra Q
⊢ (changeForm (_ : BilinForm.toQuadraticForm (-B) = Q - Q'))
      (AddHom.toFun
        {
            toAddHom :=
              { toFun := ⇑(changeForm h),
                map_add' :=
                  (_ :
                    ∀ (x y : CliffordAlgebra Q),
                      AddHom.toFun src✝.toAddHom (x + y) =
                        AddHom.toFun src✝.toAddHom x + AddHom.toFun src✝.toAddHom y) },
            map_smul' :=
              (_ :
                ∀ (r : R) (x : CliffordAlgebra Q),
                  AddHom.toFun src✝.toAddHom (r • x) = (RingHom.id R) r • AddHom.toFun src✝.toAddHom x) }.toAddHom
        x) =
    x

Next tactic:
dsimp only
/-- Any two algebras whose quadratic forms differ by a bilinear form are isomorphic as modules.

This is $\bar \lambda_B$ from [bourbaki2007][] $9 Proposition 3. -/
@[simps apply]
def changeFormEquiv : CliffordAlgebra Q ≃ₗ[R] CliffordAlgebra Q' :=
  { changeForm h with
    toFun := changeForm h
    invFun := changeForm (changeForm.neg_proof h)
    left_inv := fun x => by
      dsimp only
      

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
src✝ : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' := changeForm h
x : CliffordAlgebra Q
⊢ (changeForm (_ : BilinForm.toQuadraticForm (-B) = Q - Q')) ((changeForm h) x) = x

Next tactic:
exact (changeForm_changeForm _ _ x).trans <| by simp_rw [add_right_neg, changeForm_self_apply]
/-- Any two algebras whose quadratic forms differ by a bilinear form are isomorphic as modules.

This is $\bar \lambda_B$ from [bourbaki2007][] $9 Proposition 3. -/
@[simps apply]
def changeFormEquiv : CliffordAlgebra Q ≃ₗ[R] CliffordAlgebra Q' :=
  { changeForm h with
    toFun := changeForm h
    invFun := changeForm (changeForm.neg_proof h)
    left_inv := fun x => by
      dsimp only
      exact (changeForm_changeForm _ _ x).trans <| by 

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
src✝ : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' := changeForm h
x : CliffordAlgebra Q
⊢ (changeForm (_ : BilinForm.toQuadraticForm (B + -B) = Q - Q)) x = x

Next tactic:
simp_rw [add_right_neg, changeForm_self_apply]
/-- Any two algebras whose quadratic forms differ by a bilinear form are isomorphic as modules.

This is $\bar \lambda_B$ from [bourbaki2007][] $9 Proposition 3. -/
@[simps apply]
def changeFormEquiv : CliffordAlgebra Q ≃ₗ[R] CliffordAlgebra Q' :=
  { changeForm h with
    toFun := changeForm h
    invFun := changeForm (changeForm.neg_proof h)
    left_inv := fun x => by
      dsimp only
      exact (changeForm_changeForm _ _ x).trans <| by simp_rw [add_right_neg, changeForm_self_apply]
    right_inv := fun x => by
      

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
src✝ : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' := changeForm h
x : CliffordAlgebra Q'
⊢ AddHom.toFun
      {
          toAddHom :=
            { toFun := ⇑(changeForm h),
              map_add' :=
                (_ :
                  ∀ (x y : CliffordAlgebra Q),
                    AddHom.toFun src✝.toAddHom (x + y) = AddHom.toFun src✝.toAddHom x + AddHom.toFun src✝.toAddHom y) },
          map_smul' :=
            (_ :
              ∀ (r : R) (x : CliffordAlgebra Q),
                AddHom.toFun src✝.toAddHom (r • x) = (RingHom.id R) r • AddHom.toFun src✝.toAddHom x) }.toAddHom
      ((changeForm (_ : BilinForm.toQuadraticForm (-B) = Q - Q')) x) =
    x

Next tactic:
dsimp only
/-- Any two algebras whose quadratic forms differ by a bilinear form are isomorphic as modules.

This is $\bar \lambda_B$ from [bourbaki2007][] $9 Proposition 3. -/
@[simps apply]
def changeFormEquiv : CliffordAlgebra Q ≃ₗ[R] CliffordAlgebra Q' :=
  { changeForm h with
    toFun := changeForm h
    invFun := changeForm (changeForm.neg_proof h)
    left_inv := fun x => by
      dsimp only
      exact (changeForm_changeForm _ _ x).trans <| by simp_rw [add_right_neg, changeForm_self_apply]
    right_inv := fun x => by
      dsimp only
      

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
src✝ : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' := changeForm h
x : CliffordAlgebra Q'
⊢ (changeForm h) ((changeForm (_ : BilinForm.toQuadraticForm (-B) = Q - Q')) x) = x

Next tactic:
exact (changeForm_changeForm _ _ x).trans <|
        by simp_rw [add_left_neg, changeForm_self_apply]
/-- Any two algebras whose quadratic forms differ by a bilinear form are isomorphic as modules.

This is $\bar \lambda_B$ from [bourbaki2007][] $9 Proposition 3. -/
@[simps apply]
def changeFormEquiv : CliffordAlgebra Q ≃ₗ[R] CliffordAlgebra Q' :=
  { changeForm h with
    toFun := changeForm h
    invFun := changeForm (changeForm.neg_proof h)
    left_inv := fun x => by
      dsimp only
      exact (changeForm_changeForm _ _ x).trans <| by simp_rw [add_right_neg, changeForm_self_apply]
    right_inv := fun x => by
      dsimp only
      exact (changeForm_changeForm _ _ x).trans <|
        by 

Proof state:
R : Type u1
inst✝² : CommRing R
M : Type u2
inst✝¹ : AddCommGroup M
inst✝ : Module R M
Q Q' Q'' : QuadraticForm R M
B B' : BilinForm R M
h : BilinForm.toQuadraticForm B = Q' - Q
h' : BilinForm.toQuadraticForm B' = Q'' - Q'
src✝ : CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q' := changeForm h
x : CliffordAlgebra Q'
⊢ (changeForm (_ : BilinForm.toQuadraticForm (-B + B) = Q' - Q')) x = x

Next tactic:
simp_rw [add_left_neg, changeForm_self_apply]
theorem mem_iff_boolIndicator (x : α) : x ∈ s ↔ s.boolIndicator x = true := by
  

Proof state:
α : Type u_1
s : Set α
x : α
⊢ x ∈ s ↔ boolIndicator s x = true

Next tactic:
unfold boolIndicator
theorem mem_iff_boolIndicator (x : α) : x ∈ s ↔ s.boolIndicator x = true := by
  unfold boolIndicator
  

Proof state:
α : Type u_1
s : Set α
x : α
⊢ x ∈ s ↔ (if x ∈ s then true else false) = true

Next tactic:
split_ifs with h