# Documentation

Mathlib.LinearAlgebra.CliffordAlgebra.Fold

# Recursive computation rules for the Clifford algebra #

This file provides API for a special case CliffordAlgebra.foldr of the universal property CliffordAlgebra.lift with A = Module.End R N for some arbitrary module N. This specialization resembles the list.foldr operation, allowing a bilinear map to be "folded" along the generators.

For convenience, this file also provides CliffordAlgebra.foldl, implemented via CliffordAlgebra.reverse

## Main definitions #

• CliffordAlgebra.foldr: a computation rule for building linear maps out of the clifford algebra starting on the right, analogous to using list.foldr on the generators.
• CliffordAlgebra.foldl: a computation rule for building linear maps out of the clifford algebra starting on the left, analogous to using list.foldl on the generators.

## Main statements #

• CliffordAlgebra.right_induction: an induction rule that adds generators from the right.
• CliffordAlgebra.left_induction: an induction rule that adds generators from the left.
def CliffordAlgebra.foldr {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) :

Fold a bilinear map along the generators of a term of the clifford algebra, with the rule given by foldr Q f hf n (ι Q m * x) = f m (foldr Q f hf n x).

For example, foldr f hf n (r • ι R u + ι R v * ι R w) = r • f u n + f v (f w n).

Instances For
@[simp]
theorem CliffordAlgebra.foldr_ι {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (m : M) :
↑(↑() n) (↑() m) = ↑(f m) n
@[simp]
theorem CliffordAlgebra.foldr_algebraMap {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (r : R) :
↑(↑() n) (↑() r) = r n
@[simp]
theorem CliffordAlgebra.foldr_one {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) :
↑(↑() n) 1 = n
@[simp]
theorem CliffordAlgebra.foldr_mul {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (a : ) (b : ) :
↑(↑() n) (a * b) = ↑(↑() (↑(↑() n) b)) a
theorem CliffordAlgebra.foldr_prod_map_ι {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (l : List M) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) :
↑(↑() n) (List.prod (List.map (↑()) l)) = List.foldr (fun m n => ↑(f m) n) n l

This lemma demonstrates the origin of the foldr name.

def CliffordAlgebra.foldl {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) :

Fold a bilinear map along the generators of a term of the clifford algebra, with the rule given by foldl Q f hf n (ι Q m * x) = f m (foldl Q f hf n x).

For example, foldl f hf n (r • ι R u + ι R v * ι R w) = r • f u n + f v (f w n).

Instances For
@[simp]
theorem CliffordAlgebra.foldl_reverse {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (x : ) :
↑(↑() n) (CliffordAlgebra.reverse x) = ↑(↑() n) x
@[simp]
theorem CliffordAlgebra.foldr_reverse {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (x : ) :
↑(↑() n) (CliffordAlgebra.reverse x) = ↑(↑() n) x
@[simp]
theorem CliffordAlgebra.foldl_ι {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (m : M) :
↑(↑() n) (↑() m) = ↑(f m) n
@[simp]
theorem CliffordAlgebra.foldl_algebraMap {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (r : R) :
↑(↑() n) (↑() r) = r n
@[simp]
theorem CliffordAlgebra.foldl_one {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) :
↑(↑() n) 1 = n
@[simp]
theorem CliffordAlgebra.foldl_mul {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) (a : ) (b : ) :
↑(↑() n) (a * b) = ↑(↑() (↑(↑() n) a)) b
theorem CliffordAlgebra.foldl_prod_map_ι {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (l : List M) (f : M →ₗ[R] N →ₗ[R] N) (hf : ∀ (m : M) (x : N), ↑(f m) (↑(f m) x) = Q m x) (n : N) :
↑(↑() n) (List.prod (List.map (↑()) l)) = List.foldl (fun m n => ↑(f n) m) n l

This lemma demonstrates the origin of the foldl name.

theorem CliffordAlgebra.right_induction {R : Type u_1} {M : Type u_2} [] [] [Module R M] (Q : ) {P : } (hr : (r : R) → P (↑() r)) (h_add : (x y : ) → P xP yP (x + y)) (h_ι_mul : (m : M) → (x : ) → P xP (x * ↑() m)) (x : ) :
P x
theorem CliffordAlgebra.left_induction {R : Type u_1} {M : Type u_2} [] [] [Module R M] (Q : ) {P : } (hr : (r : R) → P (↑() r)) (h_add : (x y : ) → P xP yP (x + y)) (h_mul_ι : (x : ) → (m : M) → P xP (↑() m * x)) (x : ) :
P x

### Versions with extra state #

def CliffordAlgebra.foldr'Aux {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] →ₗ[R] N) :

Auxiliary definition for CliffordAlgebra.foldr'

Instances For
theorem CliffordAlgebra.foldr'Aux_apply_apply {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] →ₗ[R] N) (m : M) (x_fx : ) :
↑(↑() m) x_fx = (↑() m * x_fx.fst, ↑(f m) x_fx)
theorem CliffordAlgebra.foldr'Aux_foldr'Aux {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] →ₗ[R] N) (hf : ∀ (m : M) (x : ) (fx : N), ↑(f m) (↑() m * x, ↑(f m) (x, fx)) = Q m fx) (v : M) (x_fx : ) :
↑(↑() v) (↑(↑() v) x_fx) = Q v x_fx
def CliffordAlgebra.foldr' {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] →ₗ[R] N) (hf : ∀ (m : M) (x : ) (fx : N), ↑(f m) (↑() m * x, ↑(f m) (x, fx)) = Q m fx) (n : N) :

Fold a bilinear map along the generators of a term of the clifford algebra, with the rule given by foldr' Q f hf n (ι Q m * x) = f m (x, foldr' Q f hf n x). Note this is like CliffordAlgebra.foldr, but with an extra x argument. Implement the recursion scheme F[n0](m * x) = f(m, (x, F[n0](x))).

Instances For
theorem CliffordAlgebra.foldr'_algebraMap {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] →ₗ[R] N) (hf : ∀ (m : M) (x : ) (fx : N), ↑(f m) (↑() m * x, ↑(f m) (x, fx)) = Q m fx) (n : N) (r : R) :
↑() (↑() r) = r n
theorem CliffordAlgebra.foldr'_ι {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] →ₗ[R] N) (hf : ∀ (m : M) (x : ) (fx : N), ↑(f m) (↑() m * x, ↑(f m) (x, fx)) = Q m fx) (n : N) (m : M) :
↑() (↑() m) = ↑(f m) (1, n)
theorem CliffordAlgebra.foldr'_ι_mul {R : Type u_1} {M : Type u_2} {N : Type u_3} [] [] [] [Module R M] [Module R N] (Q : ) (f : M →ₗ[R] →ₗ[R] N) (hf : ∀ (m : M) (x : ) (fx : N), ↑(f m) (↑() m * x, ↑(f m) (x, fx)) = Q m fx) (n : N) (m : M) (x : ) :
↑() (↑() m * x) = ↑(f m) (x, ↑() x)