math / data /lean /OAI /Algebra /Finitistic /Bar /MultibarBlocks.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
8.9 kB
import OAI.Algebra.Finitistic.Bar.MultibarSigns
namespace OAI
open scoped TensorProduct
open TensorProduct TrivSqZeroExt
noncomputable section
namespace DerivedBar.Multibar
universe u
/-- `false` records a D slot, `true` an X slot. The leading D is separate. -/
def count : List Bool β†’ β„•
| [] => 0
| false :: p => count p
| true :: p => count p + 1
/-- Number of ordered pairs consisting of a D slot followed by an X slot. -/
def inversions : List Bool β†’ β„•
| [] => 0
| false :: p => count p + inversions p
| true :: p => inversions p
/-- The r+1 block lengths, with no empty-list ambiguity at r=0. -/
def Blocks : β„• β†’ Type
| 0 => β„•
| r+1 => β„• Γ— Blocks r
def total : (r : β„•) β†’ Blocks r β†’ β„•
| 0, i => i
| r+1, (i, tail) => i + total r tail
/-- This recursive sum is exactly Ξ£β±Ό (r-j)iβ±Ό. -/
def exponent : (r : β„•) β†’ Blocks r β†’ β„•
| 0, _ => 0
| r+1, (i, tail) => (r+1)*i + exponent r tail
def pattern : (r : β„•) β†’ Blocks r β†’ List Bool
| 0, i => List.replicate i false
| r+1, (i, tail) => List.replicate i false ++ true :: pattern r tail
@[simp] theorem count_bases (i : β„•) (p : List Bool) :
count (List.replicate i false ++ p) = count p := by
induction i with
| zero => rfl
| succ i ih => simpa [List.replicate_succ, count] using ih
@[simp] theorem inversions_bases (i : β„•) (p : List Bool) :
inversions (List.replicate i false ++ p) = i * count p + inversions p := by
induction i with
| zero => simp
| succ i ih =>
simp only [List.replicate_succ, List.cons_append, inversions, count_bases, ih]
rw [Nat.succ_mul]
omega
@[simp] theorem count_pattern (r : β„•) (b : Blocks r) : count (pattern r b) = r := by
induction r with
| zero => simpa [pattern, count] using count_bases b []
| succ r ih =>
rcases b with ⟨i, tail⟩
simp [pattern, count, ih]
/-- The actual word length agrees with source cohomological degree -r-Ξ£iβ±Ό. -/
@[simp] theorem length_pattern (r : β„•) (b : Blocks r) :
(pattern r b).length = r + total r b := by
induction r with
| zero =>
change β„• at b
simp [pattern, total]
| succ r ih =>
rcases b with ⟨i, tail⟩
simp only [pattern, List.length_append, List.length_replicate, List.length_cons, ih, total]
omega
/-- The combinatorial rescaling is exactly the component factor in prop:bar-splitting. -/
@[simp] theorem inversions_pattern (r : β„•) (b : Blocks r) :
inversions (pattern r b) = exponent r b := by
induction r with
| zero =>
change β„• at b
simpa [pattern, exponent, inversions, count] using inversions_bases b []
| succ r ih =>
rcases b with ⟨i, tail⟩
simp [pattern, inversions, count, exponent, ih, Nat.mul_comm]
variable (k D X N : Type u) [Field k] [Ring D] [Algebra k D]
[AddCommGroup X] [Module k X] [Module D X] [Module Dᡐᡒᡖ X]
[SMulCommClass D Dᡐᡒᡖ X] [IsScalarTower k D X] [IsScalarTower k Dᡐᡒᡖ X]
[AddCommGroup N] [Module k N]
/-- Genuine iterated tensors over k for a prescribed D/X pattern, ending in N.
No ordinary tensor over D is used in these bar terms. -/
@[reducible] def patternTerm : List Bool β†’ ModuleCat k
| [] => ModuleCat.of k N
| false :: p => ModuleCat.of k (D βŠ—[k] patternTerm p)
| true :: p => ModuleCat.of k (X βŠ—[k] patternTerm p)
/-- Inclusion of each D/X tensor into the actual A bar term. -/
def embed : (p : List Bool) β†’ patternTerm k D X N p β†’β‚—[k]
DerivedBar.term k (TrivSqZeroExt D X) N p.length
| [] => LinearMap.id
| false :: p => TensorProduct.map (inlAlgHom k D X).toLinearMap (embed p)
| true :: p => TensorProduct.map ((inrHom D X).restrictScalars k) (embed p)
/-- Slotwise projection back to the prescribed tensor; this proves no tensor relations were lost. -/
def extract : (p : List Bool) β†’ DerivedBar.term k (TrivSqZeroExt D X) N p.length β†’β‚—[k]
patternTerm k D X N p
| [] => LinearMap.id
| false :: p => TensorProduct.map (fstHom k D X).toLinearMap (extract p)
| true :: p => TensorProduct.map ((sndHom D X).restrictScalars k) (extract p)
/-- Every block inclusion has an actual linear left inverse. -/
theorem extract_embed (p : List Bool) (v : patternTerm k D X N p) :
extract k D X N p (embed k D X N p v) = v := by
induction p with
| nil => rfl
| cons b p ih =>
cases b <;>
dsimp only [patternTerm, embed, extract] at * <;>
induction v using TensorProduct.inductionOn with
| tmul a v =>
change a βŠ—β‚œ[k] extract k D X N p (embed k D X N p v) = a βŠ—β‚œ[k] v
rw [ih]
| add v w hv hw => simp only [map_add, hv, hw]
/-- Each tensor embeds into its correct count subspace. -/
theorem embed_mem (p : List Bool) (v : patternTerm k D X N p) :
embed k D X N p v ∈ SquareZero.weight k D X N p.length (count p) := by
induction p with
| nil => exact Submodule.subset_span (SquareZero.Word.nil v)
| cons b p ih =>
cases b <;>
dsimp only [patternTerm, embed, extract] at * <;>
induction v using TensorProduct.inductionOn with
| tmul a v =>
first
| exact SquareZero.base_tmul_mem a (ih v)
| exact SquareZero.ideal_tmul_mem a (ih v)
| add v w hv hw =>
simpa only [map_add] using Submodule.add_mem _ hv hw
/-- Evaluation of the constructed sign operator on genuine pattern tensors. -/
theorem signedProjection_embed (p : List Bool) (v : patternTerm k D X N p) :
SquareZero.signedProjection k D X N p.length (count p) (embed k D X N p v) =
(-1 : k)^(inversions p) β€’ embed k D X N p v := by
induction p with
| nil => simp [embed, count, inversions, SquareZero.signedProjection]
| cons b p ih =>
cases b <;>
dsimp only [patternTerm, embed, extract] at * <;>
induction v using TensorProduct.inductionOn with
| tmul a v =>
first
| change SquareZero.signedProjection k D X N (p.length+1) (count p)
((inl a : TrivSqZeroExt D X) βŠ—β‚œ[k] embed k D X N p v) = _
rw [SquareZero.signedProjection_base, ih, TensorProduct.tmul_smul, smul_smul,
← pow_add]
rfl
| change SquareZero.signedProjection k D X N (p.length+1) (count p+1)
((inr a : TrivSqZeroExt D X) βŠ—β‚œ[k] embed k D X N p v) = _
rw [SquareZero.signedProjection_ideal_succ, ih, TensorProduct.tmul_smul]
rfl
| add v w hv hw => simp only [map_add, hv, hw, smul_add]
/-- The source block tensor, including the exterior D coefficient. -/
abbrev blockTerm (r : β„•) (b : Blocks r) := D βŠ—[k] patternTerm k D X N (pattern r b)
def blockEmbed (r : β„•) (b : Blocks r) : blockTerm k D X N r b β†’β‚—[D]
D βŠ—[k] DerivedBar.term k (TrivSqZeroExt D X) N (pattern r b).length :=
AlgebraTensorModule.lTensor D D (embed k D X N (pattern r b))
def blockExtract (r : β„•) (b : Blocks r) :
D βŠ—[k] DerivedBar.term k (TrivSqZeroExt D X) N (pattern r b).length β†’β‚—[D]
blockTerm k D X N r b :=
AlgebraTensorModule.lTensor D D (extract k D X N (pattern r b))
theorem blockExtract_embed (r : β„•) (b : Blocks r) (v : blockTerm k D X N r b) :
blockExtract k D X N r b (blockEmbed k D X N r b v) = v := by
induction v using TensorProduct.inductionOn with
| tmul d v =>
change d βŠ—β‚œ[k] extract k D X N (pattern r b) (embed k D X N (pattern r b) v) = _
rw [extract_embed]
| add v w hv hw => simp only [map_add, hv, hw]
/-- Actual block tensors inject, with no D-flatness hypothesis. -/
theorem blockEmbed_injective (r : β„•) (b : Blocks r) :
Function.Injective (blockEmbed k D X N r b) :=
Function.LeftInverse.injective (blockExtract_embed k D X N r b)
theorem blockEmbed_mem (r : β„•) (b : Blocks r) (v : blockTerm k D X N r b) :
blockEmbed k D X N r b v ∈
SquareZero.twoSidedWeight k D X N (pattern r b).length r := by
induction v using TensorProduct.inductionOn with
| tmul d v =>
have h := SquareZero.tensor_weight_mem d (embed_mem k D X N (pattern r b) v)
simpa only [count_pattern, blockEmbed, AlgebraTensorModule.lTensor_tmul] using h
| add v w hv hw => simpa only [map_add] using Submodule.add_mem _ hv hw
/-- The D-linear rescaling on each source block is exactly (-1)^(Ξ£β±Ό(r-j)iβ±Ό). -/
theorem sign_on_block (r : β„•) (b : Blocks r) (v : blockTerm k D X N r b) :
SquareZero.twoSidedSignedProjection k D X N (pattern r b).length r
(blockEmbed k D X N r b v) =
(-1 : k)^(exponent r b) β€’ blockEmbed k D X N r b v := by
induction v using TensorProduct.inductionOn with
| tmul d v =>
change d βŠ—β‚œ[k] SquareZero.signedProjection k D X N (pattern r b).length r
(embed k D X N (pattern r b) v) = _
have h := signedProjection_embed k D X N (pattern r b) v
rw [count_pattern, inversions_pattern] at h
rw [h, TensorProduct.tmul_smul]
rfl
| add v w hv hw => simp only [map_add, hv, hw, smul_add]
end DerivedBar.Multibar
end
end OAI