diff --git a/lean/OAI/Algebra/DepthFive/FourPathTrace.lean b/lean/OAI/Algebra/DepthFive/FourPathTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..77a9e79ebeb4d9cd987f6042fb6acbb3c75bb148 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/FourPathTrace.lean @@ -0,0 +1,164 @@ +import OAI.Algebra.DepthFive.TraceComplexification + +namespace OAI + +/-! Elimination of the second source index in the four-path trace formula. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {I P G : Type*} [Fintype I] [AddCommGroup G] [DecidableEq G] + +/-- Extending finite source weights by zero gives the unique weight at a +specified occupation vector; this lemma also handles invalid occupations. -/ +theorem sum_source_eq_zeroExtend {I : Type u_1} {G : Type u_3} + [Fintype I] [AddCommGroup G] [DecidableEq G] (occupation : I → G) + (hinj : Function.Injective occupation) (weight : I → ℝ) (x : G) : + (∑ k, if occupation k = x then weight k else 0) = + Function.extend occupation weight (fun _ => 0) x := by + classical + by_cases hx : ∃ k, occupation k = x + · obtain ⟨k, rfl⟩ := hx + rw [hinj.extend_apply] + simp [hinj.eq_iff] + · rw [Function.extend_apply' _ _ _ hx] + apply Finset.sum_eq_zero + intro k hk + simp [show occupation k ≠ x from fun h => hx ⟨k, h⟩] + +/-- The second source in a compatible four-path term is uniquely determined. +The zero extension records absent (invalid) source occupations exactly. -/ +theorem fourPath_eliminate_source (occupation : I → G) + (hinj : Function.Injective occupation) (wq ws : I → ℝ) + (M ep eq er es : G) (A C : ℝ) : + (∑ k, if M + ep = occupation k + eq ∧ M + er = occupation k + es then + A * wq k * C * ws k else 0) = + if ep - eq = er - es then + A * Function.extend occupation wq (fun _ => 0) (M + ep - eq) * C * + Function.extend occupation ws (fun _ => 0) (M + ep - eq) + else 0 := by + classical + let x := M + ep - eq + have hfirst (k : I) : M + ep = occupation k + eq ↔ occupation k = x := by + dsimp [x] + constructor + · intro h + exact (eq_sub_iff_add_eq).2 h.symm + · intro h + exact ((eq_sub_iff_add_eq).1 h).symm + have hsecond : M + er = x + es ↔ ep - eq = er - es := by + have hx : x + es = M + ((ep - eq) + es) := by dsimp [x]; abel + rw [hx, add_left_cancel_iff, eq_comm, ← eq_sub_iff_add_eq] + by_cases hx : ∃ k, occupation k = x + · obtain ⟨k, hk⟩ := hx + have heq (l : I) : M + ep = occupation l + eq ↔ l = k := by + rw [hfirst, ← hk, hinj.eq_iff] + have hsec : M + er = occupation k + es ↔ ep - eq = er - es := by + rw [hk] + exact hsecond + change _ = if ep - eq = er - es then + A * Function.extend occupation wq (fun _ => 0) x * C * + Function.extend occupation ws (fun _ => 0) x else 0 + rw [← hk, hinj.extend_apply, hinj.extend_apply] + rw [Finset.sum_eq_single k] + · simp [heq, hsec] + · intro l hl hlk + simp [heq, hlk] + · simp + · have hzq := Function.extend_apply' (f := occupation) wq (fun _ => (0 : ℝ)) x hx + change _ = if ep - eq = er - es then + A * Function.extend occupation wq (fun _ => 0) x * C * + Function.extend occupation ws (fun _ => 0) x else 0 + rw [hzq] + simp only [mul_zero, zero_mul, ite_self] + apply Finset.sum_eq_zero + intro k hk + have hne : occupation k ≠ x := fun h => hx ⟨k, h⟩ + simp [hfirst, hne] + +/-- The full four-path sum with the second source eliminated and invalid +source occupations retained through zero extension. -/ +theorem fourPath_sum_eliminate_source [Fintype P] + (occupation : I → G) (hinj : Function.Injective occupation) + (eps : P → G) (weight : I → P → ℝ) : + (∑ i, ∑ k, ∑ p, ∑ q, ∑ r, ∑ s, + if occupation i + eps p = occupation k + eps q ∧ + occupation i + eps r = occupation k + eps s then + weight i p * weight k q * weight i r * weight k s else 0) = + ∑ i, ∑ p, ∑ q, ∑ r, ∑ s, + if eps p - eps q = eps r - eps s then + weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0) + (occupation i + eps p - eps q) * weight i r * + Function.extend occupation (fun k => weight k s) (fun _ => 0) + (occupation i + eps p - eps q) else 0 := by + classical + apply Finset.sum_congr rfl + intro i hi + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro p hp + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro q hq + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro r hr + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro s hs + exact fourPath_eliminate_source occupation hinj (fun k => weight k q) + (fun k => weight k s) (occupation i) (eps p) (eps q) (eps r) (eps s) + (weight i p) (weight i r) + +/-- The complex four-path trace with its second source removed. The signed +shift identity is required only for nonzero path weights, so invalid-path +fallback target indices do not affect the identity. -/ +theorem complex_path_second_trace_eliminate_source + {J : Type*} [Fintype J] [Fintype P] [DecidableEq I] [DecidableEq J] + (occupation : I → G) (hinj : Function.Injective occupation) + (targetOccupation : J → G) (htarget : Function.Injective targetOccupation) + (eps : P → G) (shift : I → P → J) (weight : I → P → ℝ) + (hshift : ∀ i p, weight i p ≠ 0 → + targetOccupation (shift i p) = occupation i + eps p) : + let A := pathShiftMatrix shift (fun i p => (weight i p : ℂ)) + ((A.conjTranspose * A) ^ 2).trace.re = + ∑ i, ∑ p, ∑ q, ∑ r, ∑ s, + if eps p - eps q = eps r - eps s then + weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0) + (occupation i + eps p - eps q) * weight i r * + Function.extend occupation (fun k => weight k s) (fun _ => 0) + (occupation i + eps p - eps q) else 0 := by + classical + dsimp + rw [complex_path_second_trace_four_paths, ← fourPath_sum_eliminate_source occupation hinj] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro k hk + apply Finset.sum_congr rfl + intro p hp + apply Finset.sum_congr rfl + intro q hq + apply Finset.sum_congr rfl + intro r hr + apply Finset.sum_congr rfl + intro s hs + by_cases hz : weight i p * weight k q * weight i r * weight k s = 0 + · simp [hz] + · have hp' : weight i p ≠ 0 := by intro h; simp [h] at hz + have hq' : weight k q ≠ 0 := by intro h; simp [h] at hz + have hr' : weight i r ≠ 0 := by intro h; simp [h] at hz + have hs' : weight k s ≠ 0 := by intro h; simp [h] at hz + have h₁ : shift i p = shift k q ↔ occupation i + eps p = occupation k + eps q := by + rw [← htarget.eq_iff, hshift i p hp', hshift k q hq'] + have h₂ : shift i r = shift k s ↔ occupation i + eps r = occupation k + eps s := by + rw [← htarget.eq_iff, hshift i r hr', hshift k s hs'] + simp only [h₁, h₂] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/FractionRounding.lean b/lean/OAI/Algebra/DepthFive/FractionRounding.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed6f3b07ad4525e2abe8c82e3909bfa894201ac6 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/FractionRounding.lean @@ -0,0 +1,119 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace Problem335 + +/-- Quantitative monotonicity of the fraction used in the rounded rank parameters. -/ +theorem fraction_rounding_ratio_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v) + (hxa : x ≤ a) (hax : a ≤ x + 1) : + 1 ≤ (a / (a + v)) / (x / (x + v)) ∧ + (a / (a + v)) / (x / (x + v)) ≤ 1 + 1 / x := by + have ha : 0 < a := lt_of_lt_of_le hx hxa + have hxv : 0 < x + v := add_pos hx hv + have hav : 0 < a + v := add_pos ha hv + have hratio : (a / (a + v)) / (x / (x + v)) = + a * (x + v) / (x * (a + v)) := by field_simp + rw [hratio] + constructor + · apply (le_div_iff₀ (mul_pos hx hav)).mpr + nlinarith + · apply (div_le_iff₀ (mul_pos hx hav)).mpr + have hxne : x ≠ 0 := ne_of_gt hx + field_simp + nlinarith + +/-- Rounding upward by at most one changes the logarithm by at most `1/x`. -/ +theorem fraction_rounding_log_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v) + (hxa : x ≤ a) (hax : a ≤ x + 1) : + 0 ≤ Real.log ((a / (a + v)) / (x / (x + v))) ∧ + Real.log ((a / (a + v)) / (x / (x + v))) ≤ 1 / x := by + obtain ⟨hlo, hhi⟩ := fraction_rounding_ratio_bounds hx hv hxa hax + constructor + · exact Real.log_nonneg hlo + · have hpos : 0 < (a / (a + v)) / (x / (x + v)) := lt_of_lt_of_le zero_lt_one hlo + have hlog := Real.log_le_sub_one_of_pos hpos + linarith + +/-- Once the unrounded value is at least one, the logarithmic loss is `2/a`. -/ +theorem fraction_rounding_log_le_two_div {x v a : ℝ} (hx : 1 ≤ x) (hv : 0 < v) + (hxa : x ≤ a) (hax : a ≤ x + 1) : + Real.log ((a / (a + v)) / (x / (x + v))) ≤ 2 / a := by + have hxpos : 0 < x := zero_lt_one.trans_le hx + have hapos : 0 < a := hxpos.trans_le hxa + apply (fraction_rounding_log_bounds hxpos hv hxa hax).2.trans + apply (div_le_div_iff₀ hxpos hapos).mpr + nlinarith + +/-- Equivalent multiplicative exponential form of the rounding estimate. -/ +theorem fraction_rounding_bounds {x v a : ℝ} (hx : 0 < x) (hv : 0 < v) + (hxa : x ≤ a) (hax : a ≤ x + 1) : + x / (x + v) ≤ a / (a + v) ∧ + a / (a + v) ≤ x / (x + v) * Real.exp (1 / x) := by + have hbase : 0 < x / (x + v) := div_pos hx (add_pos hx hv) + obtain ⟨hlo, hhi⟩ := fraction_rounding_ratio_bounds hx hv hxa hax + constructor + · exact (one_le_div hbase).mp hlo + · have hexp : 1 + 1 / x ≤ Real.exp (1 / x) := by + simpa [add_comm] using Real.add_one_le_exp (1 / x) + have hratio := hhi.trans hexp + exact (div_le_iff₀ hbase).mp hratio |>.trans_eq (mul_comm _ _) + +/-- The ceiling specialization used for both parameters `a` and `b`. -/ +theorem fraction_natCeil_log_bounds {x v : ℝ} (hx : 0 < x) (hv : 0 < v) : + 0 ≤ Real.log (((⌈x⌉₊ : ℝ) / ((⌈x⌉₊ : ℝ) + v)) / (x / (x + v))) ∧ + Real.log (((⌈x⌉₊ : ℝ) / ((⌈x⌉₊ : ℝ) + v)) / (x / (x + v))) ≤ 1 / x := by + apply fraction_rounding_log_bounds hx hv + · exact Nat.le_ceil x + · exact le_of_lt (Nat.ceil_lt_add_one (le_of_lt hx)) + +/-- The first rank parameter has ideal fraction `1/s`; here `s = sqrt n`. -/ +theorem fraction_natCeil_inverse_bounds {s v : ℝ} (hs : 1 < s) (hv : 0 < v) : + let a : ℝ := ⌈v / (s - 1)⌉₊ + 1 / s ≤ a / (a + v) ∧ + a / (a + v) ≤ 1 / s * Real.exp ((s - 1) / v) := by + have hsm : 0 < s - 1 := sub_pos.mpr hs + have hx : 0 < v / (s - 1) := div_pos hv hsm + have hbase : (v / (s - 1)) / (v / (s - 1) + v) = 1 / s := by + field_simp + ring + have hinv : 1 / (v / (s - 1)) = (s - 1) / v := by + rw [one_div_div] + have h := fraction_rounding_bounds hx hv (Nat.le_ceil _) (le_of_lt (Nat.ceil_lt_add_one hx.le)) + simpa only [hbase, hinv] using h + +/-- The first rounded parameter has reciprocal at most its ideal reciprocal. -/ +theorem fraction_natCeil_reciprocal_le {s v : ℝ} (hs : 1 < s) (hv : 0 < v) : + let a : ℝ := ⌈v / (s - 1)⌉₊ + (a / (a + v))⁻¹ ≤ s := by + dsimp + have h := (fraction_natCeil_inverse_bounds hs hv).1 + have hspos : 0 < s := zero_lt_one.trans hs + have hpos : 0 < (⌈v / (s - 1)⌉₊ : ℝ) / ((⌈v / (s - 1)⌉₊ : ℝ) + v) := + lt_of_lt_of_le (one_div_pos.mpr hspos) h + rw [inv_eq_one_div] + apply (div_le_iff₀ hpos).mpr + nlinarith [(div_le_iff₀ hspos).mp h] + +/-- The second rank parameter is rounded from a prescribed target fraction `p`. -/ +theorem fraction_natCeil_target_bounds {p v : ℝ} (hp : 0 < p) (hp1 : p < 1) + (hv : 0 < v) : + let b : ℝ := ⌈v * p / (1 - p)⌉₊ + p ≤ b / (b + v) ∧ + b / (b + v) ≤ p * Real.exp ((1 - p) / (v * p)) := by + have hpm : 0 < 1 - p := sub_pos.mpr hp1 + have hx : 0 < v * p / (1 - p) := div_pos (mul_pos hv hp) hpm + have hbase : (v * p / (1 - p)) / (v * p / (1 - p) + v) = p := by + field_simp + ring + have hinv : 1 / (v * p / (1 - p)) = (1 - p) / (v * p) := by + rw [one_div_div] + have h := fraction_rounding_bounds hx hv (Nat.le_ceil _) (le_of_lt (Nat.ceil_lt_add_one hx.le)) + simpa only [hbase, hinv] using h + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/GateCardinality.lean b/lean/OAI/Algebra/DepthFive/GateCardinality.lean new file mode 100644 index 0000000000000000000000000000000000000000..8103a1527b3500911e8d6bdb51a902ff23e7c9b2 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/GateCardinality.lean @@ -0,0 +1,33 @@ +import OAI.Algebra.DepthFive.Basic + +namespace OAI + +namespace Problem335 + +/-- The numerical size estimate used after instantiating the block circuit. -/ +theorem circuitSize_le_block_bound {K : Type*} [CommSemiring K] {n r t : ℕ} + (c : Depth5Circuit K n) + (hleaf : c.leafCount ≤ n ^ 3) + (hbottom : c.bottomCount ≤ n ^ 3) + (hlower : c.lowerCount ≤ r * n ^ (t + 1)) + (hmiddle : c.middleCount ≤ r * n ^ 2) + (hupper : c.upperCount ≤ n ^ (r - 1)) : + circuitSize c ≤ 2 * n ^ 3 + r * n ^ 2 + r * n ^ (t + 1) + + n ^ (r - 1) + 1 := by + unfold circuitSize + omega + +/-- Specialization of the block count to the precise upper gate bound. -/ +theorem circuitSize_le_upperGateBound {K : Type*} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) + (hleaf : c.leafCount ≤ n ^ 3) + (hbottom : c.bottomCount ≤ n ^ 3) + (hlower : c.lowerCount ≤ ceilDiv n (ceilSqrt n) * n ^ (ceilSqrt n + 1)) + (hmiddle : c.middleCount ≤ ceilDiv n (ceilSqrt n) * n ^ 2) + (hupper : c.upperCount ≤ n ^ (ceilDiv n (ceilSqrt n) - 1)) : + circuitSize c ≤ upperGateBound n := by + exact circuitSize_le_block_bound c hleaf hbottom hlower hmiddle hupper + +end Problem335 + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/GateSums.lean b/lean/OAI/Algebra/DepthFive/GateSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..eca9b65864e71c90df29b3b5a5ea16c289b4b0ac --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/GateSums.lean @@ -0,0 +1,108 @@ +import OAI.Algebra.DepthFive.Basic + +namespace OAI + +noncomputable section + +open scoped BigOperators + +namespace Problem335 + +/-- The combined coefficient of all wires from a fixed predecessor. +Wire multiplicity is absorbed into this coefficient, not charged as gates. -/ +def gateCoefficient {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] + (inputs : List (K × ι)) (i : ι) : K := + (inputs.map (fun entry => if entry.2 = i then entry.1 else 0)).sum + +@[simp] theorem gateCoefficient_nil {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] + (i : ι) : gateCoefficient ([] : List (K × ι)) i = 0 := by + simp [gateCoefficient] + +@[simp] theorem gateCoefficient_cons {K ι : Type*} [AddCommMonoid K] [DecidableEq ι] + (entry : K × ι) (inputs : List (K × ι)) (i : ι) : + gateCoefficient (entry :: inputs) i = + (if entry.2 = i then entry.1 else 0) + gateCoefficient inputs i := by + simp [gateCoefficient] + +/-- Any finite list of weighted inputs can be regrouped over its finite gate type. -/ +theorem list_weighted_sum_eq_sum {K R ι : Type*} [Semiring K] [Semiring R] + [Fintype ι] [DecidableEq ι] (f : K →+* R) (value : ι → R) + (inputs : List (K × ι)) : + (inputs.map (fun entry => f entry.1 * value entry.2)).sum = + ∑ i, f (gateCoefficient inputs i) * value i := by + induction inputs with + | nil => simp + | cons entry inputs ih => + simp only [List.map_cons, List.sum_cons, gateCoefficient_cons, + map_add, add_mul, Finset.sum_add_distrib] + rw [← ih] + congr 1 + simp [apply_ite, ite_mul] + +/-- A combined coefficient vanishes if its predecessor does not occur. -/ +theorem gateCoefficient_eq_zero_of_not_mem {K ι : Type*} + [AddCommMonoid K] [DecidableEq ι] (inputs : List (K × ι)) (i : ι) + (h : ∀ entry ∈ inputs, entry.2 ≠ i) : gateCoefficient inputs i = 0 := by + unfold gateCoefficient + apply List.sum_eq_zero + intro x hx + obtain ⟨entry, hentry, rfl⟩ := List.mem_map.mp hx + simp [h entry hentry] + +/-- A nonzero combined coefficient must come from an actual wire. -/ +theorem exists_mem_of_gateCoefficient_ne_zero {K ι : Type*} + [AddCommMonoid K] [DecidableEq ι] (inputs : List (K × ι)) (i : ι) + (h : gateCoefficient inputs i ≠ 0) : ∃ entry ∈ inputs, entry.2 = i := by + by_contra hn + apply h + apply gateCoefficient_eq_zero_of_not_mem + intro entry hentry heq + exact hn ⟨entry, hentry, heq⟩ + +theorem bottomValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.bottomCount) : + bottomValue c i = ∑ j : Fin c.leafCount, + MvPolynomial.C (gateCoefficient (c.bottomInputs i) j) * d5LeafValue (c.leaves j) := by + exact list_weighted_sum_eq_sum MvPolynomial.C (fun j => d5LeafValue (c.leaves j)) _ + +theorem middleValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.middleCount) : + middleValue c i = ∑ j : Fin c.lowerCount, + MvPolynomial.C (gateCoefficient (c.middleInputs i) j) * lowerValue c j := by + exact list_weighted_sum_eq_sum MvPolynomial.C (lowerValue c) _ + +theorem circuitValue_eq_sum {K : Type*} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) : + circuitValue c = ∑ j : Fin c.upperCount, + MvPolynomial.C (gateCoefficient c.outputInputs j) * upperValue c j := by + exact list_weighted_sum_eq_sum MvPolynomial.C (upperValue c) _ + +/-- Aggregating wires preserves the bottom homogeneous-degree constraint. -/ +theorem bottomDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.bottomCount) (j : Fin c.leafCount) + (h : gateCoefficient (c.bottomInputs i) j ≠ 0) : + d5LeafDegree (c.leaves j) = c.bottomDegree i := by + obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h + simpa [heq] using c.bottomHomogeneous i entry hentry + +/-- Aggregating wires preserves the middle homogeneous-degree constraint. -/ +theorem middleDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.middleCount) (j : Fin c.lowerCount) + (h : gateCoefficient (c.middleInputs i) j ≠ 0) : + ((c.lowerInputs j).map c.bottomDegree).sum = c.middleDegree i := by + obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h + simpa [heq] using c.middleHomogeneous i entry hentry + +/-- Aggregating wires preserves the output homogeneous-degree constraint. -/ +theorem outputDegree_of_gateCoefficient_ne_zero {K : Type*} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (j : Fin c.upperCount) + (h : gateCoefficient c.outputInputs j ≠ 0) : + ((c.upperInputs j).map c.middleDegree).sum = c.outputDegree := by + obtain ⟨entry, hentry, heq⟩ := exists_mem_of_gateCoefficient_ne_zero _ _ h + simpa [heq] using c.outputHomogeneous entry hentry + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/HighDegreeWeights.lean b/lean/OAI/Algebra/DepthFive/HighDegreeWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..12971ad85c17f9944686213cedd05bbf4dcc3212 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/HighDegreeWeights.lean @@ -0,0 +1,143 @@ +import OAI.Algebra.DepthFive.ProductCost +import OAI.Algebra.DepthFive.LowDegreeWeights + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- Remaining unexpanded factors cost at most one factor of five per large +occurrence, and a total exponential error for the low occurrences. -/ +theorem remaining_degreeWeight_product_bound {ι : Type*} (I : Finset ι) + (e : ι → ℕ) {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) + (hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) + (hqsqrt : q ≤ 2 / Real.sqrt n) + (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) + (he : ∀ i ∈ I, 0 < e i) (hsum : (∑ i ∈ I, (e i : ℝ)) ≤ n) : + (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ + (5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) := by + classical + have hq1 : q ≤ 1 := by linarith + have ht : 0 < n / (4 * s) := by positivity + have hcorr : (∑ i ∈ I with (e i : ℝ) < n / (4 * s), + q ^ (1 - s * e i / n)) ≤ 6 * Real.sqrt n := by + apply sum_small_degree_corrections_le + (I.filter (fun i => (e i : ℝ) < n / (4 * s))) n s q + (fun i => (e i : ℝ)) hn hs.le hshi hq hq1 hqsqrt + · intro i hi + exact_mod_cast he i (Finset.mem_filter.mp hi).1 + · intro i hi + obtain ⟨hI, hlow⟩ := Finset.mem_filter.mp hi + obtain ⟨_, h⟩ := low_degree_offset hn hs (he i hI) hlow + have hid : s * e i / n = 2 * (s * e i / (2 * n)) := by ring + rw [hid] + linarith + · exact (Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun i _ _ => Nat.cast_nonneg (e i))).trans hsum + have herr : (∑ i ∈ I with (e i : ℝ) < n / (4 * s), + 4 * q ^ (1 - s * e i / n)) ≤ 24 * Real.sqrt n := by + rw [← Finset.mul_sum] + linarith + have hlow : ∀ i ∈ I, (e i : ℝ) < n / (4 * s) → + degreeWeight q (1 / 2 - s / (2 * n)) (e i) ≤ + Real.exp (4 * q ^ (1 - s * e i / n)) := by + intro i hi hlow + have hw := low_degreeWeight_le_with_correction hn hs hq hqhalf hqsmall + (he i hi) hlow + have hd : 0 ≤ degreeDistance n s (e i) := nearestIntegerDistance_nonneg _ + have hp : q ^ (degreeDistance n s (e i) / 2) ≤ 1 := + Real.rpow_le_one hq.le hq1 (by positivity) + exact hw.trans (by + simpa only [one_mul] using mul_le_mul_of_nonneg_right hp + (Real.exp_pos (4 * q ^ (1 - s * e i / n))).le) + have h := prod_high_low_cost_le_rpow I + (fun i => degreeWeight q (1 / 2 - s / (2 * n)) (e i)) + (fun i => 4 * q ^ (1 - s * e i / n)) (fun i => (e i : ℝ)) + (n / (4 * s)) 5 (24 * Real.sqrt n) n ht + (fun i _ => degreeWeight_nonneg hq.le _ _) (by norm_num) + (fun i _ => Nat.cast_nonneg (e i)) hsum + (fun i _ _ => degreeWeight_le_five hq hqhalf _ _) hlow herr + have hdiv : n / (n / (4 * s)) = 4 * s := by + field_simp + simpa only [hdiv] using h + +/-- The actual factor weights in the one-high case obey the strong power +saving required by the homogeneous depth-five circuit rank argument. -/ +theorem high_degreeWeight_product_bound {ι : Type*} (I : Finset ι) + (e : ι → ℕ) (d : ℕ) {n s q : ℝ} (hn : 1 ≤ n) (hs : 0 < s) + (hshi : s ≤ Real.sqrt n) (hq : 0 < q) (hqhalf : q ≤ 1 / 2) + (hqsqrt : q ≤ 2 / Real.sqrt n) (hqpow : q ≤ n ^ (-(2 : ℝ) / 5)) + (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) + (hlam : (3 : ℝ) / 8 ≤ 1 / 2 - s / (2 * n)) + (htone : 1 < n / (4 * s)) (hd : n / (4 * s) ≤ (d : ℝ)) + (he : ∀ i ∈ I, 0 < e i) (hsum : (∑ i ∈ I, (e i : ℝ)) ≤ n) : + degreeWeight q (1 / 2 - s / (2 * n)) 1 ^ d * + (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ + (5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) * + n ^ (-(3 * Real.sqrt n) / 160) := by + have hn0 : 0 < n := by linarith + have hq1 : q ≤ 1 := by linarith + have hdist : degreeDistance n s 1 = 1 / 2 - s / (2 * n) := by + simpa using degreeDistance_odd hn0 hs (by decide : 0 < (1 : ℕ)) + (by simpa using htone) (by decide : Odd (1 : ℕ)) + have hlinear : degreeWeight q (1 / 2 - s / (2 * n)) 1 ≤ + q ^ ((1 / 2 - s / (2 * n)) / 2) := by + simpa only [hdist] using low_odd_degreeWeight_le hn0 hs hq hqhalf hqsmall + (by decide : 0 < (1 : ℕ)) (by simpa using htone) (by decide : Odd (1 : ℕ)) + have hlinpow := linear_factor_cost_power_le + (degreeWeight q (1 / 2 - s / (2 * n)) 1) q + (1 / 2 - s / (2 * n)) (n / (4 * s)) d + (degreeWeight_nonneg hq.le _ _) hq hq1 (by linarith) hlinear hd + have hprod := remaining_degreeWeight_product_bound I e hn0 hs hshi hq + hqhalf hqsqrt hqsmall he hsum + have ht : Real.sqrt n / 4 ≤ n / (4 * s) := by + apply (le_div_iff₀ (by positivity : 0 < 4 * s)).mpr + have hm := mul_le_mul_of_nonneg_left hshi (Real.sqrt_nonneg n) + nlinarith [Real.sq_sqrt hn0.le] + have hpower := one_high_power_saving n q (1 / 2 - s / (2 * n)) + (n / (4 * s)) hn hq.le hqpow hlam ht + calc + _ ≤ q ^ ((1 / 2 - s / (2 * n)) * (n / (4 * s)) / 2) * + ((5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n)) := + mul_le_mul hlinpow hprod + (Finset.prod_nonneg (fun i _ => degreeWeight_nonneg hq.le _ _)) + (Real.rpow_nonneg hq.le _) + _ ≤ n ^ (-(3 * Real.sqrt n) / 160) * + ((5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n)) := + mul_le_mul_of_nonneg_right hpower (by positivity) + _ = _ := by ring + +/-- The circuit interface only assumes `n ≥ 64`: the required slope and +threshold bounds follow from `s ≤ sqrt n`. This adapter reconciles the +canonical high-weight estimate with the circuit product interface. -/ +theorem expanded_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ) + (d : ℕ) {n s q : ℝ} (hn : 64 ≤ n) (hs : 0 < s) (hshi : s ≤ Real.sqrt n) + (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n) + (hqpow : q ≤ n ^ (-(2 / 5 : ℝ))) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) + (he : ∀ i ∈ I, 0 < e i) (hsum : ∑ i ∈ I, (e i : ℝ) ≤ n) + (hd : n / (4 * s) ≤ (d : ℝ)) : + (degreeWeight q (1 / 2 - s / (2 * n)) 1) ^ d * + (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ + (5 : ℝ) ^ (4 * s) * Real.exp (24 * Real.sqrt n) * + n ^ (-(3 * Real.sqrt n / 160)) := by + have hn0 : 0 < n := by linarith + have hsq := Real.sq_sqrt hn0.le + have hsqrt := Real.sqrt_nonneg n + have hsqrt8 : 8 ≤ Real.sqrt n := by nlinarith + have ht : Real.sqrt n / 4 ≤ n / (4 * s) := by + apply (le_div_iff₀ (by positivity : 0 < 4 * s)).mpr + nlinarith [mul_le_mul_of_nonneg_left hshi hsqrt] + have hdiv : s / (2 * n) ≤ 1 / 8 := by + apply (div_le_iff₀ (by positivity : 0 < 2 * n)).mpr + nlinarith + simpa only [neg_div] using high_degreeWeight_product_bound I e d + (by linarith) hs hshi hq hqhalf hqsqrt (by simpa only [neg_div] using hqpow) + hqsmall (by linarith) (by linarith) hd he hsum + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/Homogeneity.lean b/lean/OAI/Algebra/DepthFive/Homogeneity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d84da0df9a1d78c528c170166336654924b8b082 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/Homogeneity.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.DepthFive.Basic + +namespace OAI + +noncomputable section + +namespace Problem335 + +universe u v w + +/-- Homogeneity is preserved by a list sum, including the empty sum. -/ +theorem isHomogeneous_list_sum {K : Type u} [CommSemiring K] + {σ : Type v} {ι : Type w} (l : List ι) (f : ι → MvPolynomial σ K) (d : ℕ) + (h : ∀ i ∈ l, (f i).IsHomogeneous d) : + (l.map f).sum.IsHomogeneous d := by + induction l with + | nil => simpa using MvPolynomial.isHomogeneous_zero σ K d + | cons a l ih => + simp only [List.map_cons, List.sum_cons] + exact (h a (by simp)).add (ih (fun i hi => h i (by simp [hi]))) + +/-- A product's formal degree is the sum of its factors' formal degrees. -/ +theorem isHomogeneous_list_prod {K : Type u} [CommSemiring K] + {σ : Type v} {ι : Type w} (l : List ι) (f : ι → MvPolynomial σ K) (d : ι → ℕ) + (h : ∀ i ∈ l, (f i).IsHomogeneous (d i)) : + (l.map f).prod.IsHomogeneous (l.map d).sum := by + induction l with + | nil => simpa using MvPolynomial.isHomogeneous_one (σ := σ) K + | cons a l ih => + simp only [List.map_cons, List.prod_cons, List.sum_cons] + exact (h a (by simp)).mul (ih (fun i hi => h i (by simp [hi]))) + +theorem d5LeafValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} + (x : D5Leaf K n) : (d5LeafValue x).IsHomogeneous (d5LeafDegree x) := by + cases x with + | scalar a => exact MvPolynomial.isHomogeneous_C _ a + | «variable» i => exact MvPolynomial.isHomogeneous_X K i + +theorem bottomValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.bottomCount) : + (bottomValue c i).IsHomogeneous (c.bottomDegree i) := by + unfold bottomValue + apply isHomogeneous_list_sum + intro entry hentry + rw [← c.bottomHomogeneous i entry hentry] + exact (d5LeafValue_isHomogeneous (c.leaves entry.2)).C_mul entry.1 + +theorem lowerValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.lowerCount) : + (lowerValue c i).IsHomogeneous ((c.lowerInputs i).map c.bottomDegree).sum := by + unfold lowerValue + apply isHomogeneous_list_prod + intro j _ + exact bottomValue_isHomogeneous c j + +theorem middleValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.middleCount) : + (middleValue c i).IsHomogeneous (c.middleDegree i) := by + unfold middleValue + apply isHomogeneous_list_sum + intro entry hentry + rw [← c.middleHomogeneous i entry hentry] + exact (lowerValue_isHomogeneous c entry.2).C_mul entry.1 + +theorem upperValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) (i : Fin c.upperCount) : + (upperValue c i).IsHomogeneous ((c.upperInputs i).map c.middleDegree).sum := by + unfold upperValue + apply isHomogeneous_list_prod + intro j _ + exact middleValue_isHomogeneous c j + +theorem circuitValue_isHomogeneous {K : Type u} [CommSemiring K] {n : ℕ} + (c : Depth5Circuit K n) : + (circuitValue c).IsHomogeneous c.outputDegree := by + unfold circuitValue + apply isHomogeneous_list_sum + intro entry hentry + rw [← c.outputHomogeneous entry hentry] + exact (upperValue_isHomogeneous c entry.2).C_mul entry.1 + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/HomogeneousSpaceDimension.lean b/lean/OAI/Algebra/DepthFive/HomogeneousSpaceDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..c431f3b332739e85ea60113a23b1a29013d8eb2f --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/HomogeneousSpaceDimension.lean @@ -0,0 +1,62 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem335 + +universe u v w + +/-- Degree-exact exponent vectors are multisets of the indicated cardinality. -/ +def degreeExponentsEquivSym (σ : Type u) (d : ℕ) : + { m : σ →₀ ℕ // m.degree = d } ≃ Sym σ d := by + classical + exact (Sym.equivNatSum σ d).symm + +/-- The number of monomials of total degree `d`. -/ +theorem card_degree_exponents (σ : Type u) [Fintype σ] (d : ℕ) : + Nat.card { m : σ →₀ ℕ // m.degree = d } = + Nat.multichoose (Fintype.card σ) d := by + rw [Nat.card_congr (degreeExponentsEquivSym σ d)] + simpa only [Nat.card_eq_fintype_card] using Sym.natCard_sym_eq_multichoose (α := σ) d + +/-- Homogeneous polynomial spaces in finitely many variables are finite modules. -/ +instance homogeneousSubmodule_finite (K : Type u) [CommSemiring K] + (σ : Type v) [Finite σ] (d : ℕ) : + Module.Finite K (MvPolynomial.homogeneousSubmodule σ K d) := + Module.Finite.of_fg (MvPolynomial.homogeneousSubmodule_fg σ K d) + +/-- Exact dimension of the homogeneous polynomial space. -/ +theorem homogeneousSubmodule_finrank (K : Type u) [Field K] + (σ : Type v) [Fintype σ] (d : ℕ) : + Module.finrank K (MvPolynomial.homogeneousSubmodule σ K d) = + Nat.multichoose (Fintype.card σ) d := by + rw [MvPolynomial.homogeneousSubmodule_eq_finsupp_supported] + change Module.finrank K (MvPolynomial.restrictSupport K {m : σ →₀ ℕ | m.degree = d}) = _ + rw [Module.finrank_eq_nat_card_basis (MvPolynomial.basisRestrictSupport K _)] + exact card_degree_exponents σ d + +/-- The usual stars-and-bars presentation of homogeneous dimension. -/ +theorem homogeneousSubmodule_finrank_choose (K : Type u) [Field K] + (σ : Type v) [Fintype σ] (d : ℕ) : + Module.finrank K (MvPolynomial.homogeneousSubmodule σ K d) = + Nat.choose (Fintype.card σ + d - 1) d := by + rw [homogeneousSubmodule_finrank, Nat.multichoose_eq] + +/-- Dimension of the separate-variable source/intermediate spaces used by the rank measure. -/ +theorem homogeneousTensor_finrank (K : Type u) [Field K] + (σ : Type v) [Fintype σ] (τ : Type w) [Fintype τ] (a b : ℕ) : + Module.finrank K (TensorProduct K + (MvPolynomial.homogeneousSubmodule σ K a) + (MvPolynomial.homogeneousSubmodule τ K b)) = + Nat.choose (Fintype.card σ + a - 1) a * + Nat.choose (Fintype.card τ + b - 1) b := by + rw [Module.finrank_tensorProduct, homogeneousSubmodule_finrank_choose, + homogeneousSubmodule_finrank_choose] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmBidegree.lean b/lean/OAI/Algebra/DepthFive/ImmBidegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..31dcd4b04f1396d140073905397f8484689180f8 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmBidegree.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.DepthFive.ImmDegree +import OAI.Algebra.DepthFive.OperatorRank + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- With a layerwise partition, IMM is already in the selected bidegree. -/ +theorem imm_mem_bidegreeSubmodule (K : Type*) [CommSemiring K] (n : ℕ) + (side : Fin n → Bool) : + imm K n ∈ bidegreeSubmodule (fun x => side x.1) + (Finset.univ.filter (fun t => side t = true)).card + (Finset.univ.filter (fun t => side t = false)).card := by + classical + have h := imm_isWeightedHomogeneous K n (bidegreeWeight side) + have hs : (∑ t, bidegreeWeight side t) = + ((Finset.univ.filter (fun t => side t = true)).card, + (Finset.univ.filter (fun t => side t = false)).card) := by + apply Prod.ext + · simp only [Prod.fst_sum, Finset.card_filter] + apply Finset.sum_congr rfl + intro t ht + cases hs : side t <;> simp [bidegreeWeight, hs] + · simp only [Prod.snd_sum, Finset.card_filter] + apply Finset.sum_congr rfl + intro t ht + cases hs : side t <;> simp [bidegreeWeight, hs] + rw [hs] at h + exact h + +/-- A bidegree projection does not change IMM when the selected index is its layer count. -/ +theorem bidegreeComponent_imm (K : Type*) [CommSemiring K] (n : ℕ) + (side : Fin n → Bool) : + bidegreeComponent (fun x => side x.1) + (Finset.univ.filter (fun t => side t = true)).card + (Finset.univ.filter (fun t => side t = false)).card (imm K n) = imm K n := + bidegreeComponent_eq_self (imm_mem_bidegreeSubmodule K n side) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmBlocks.lean b/lean/OAI/Algebra/DepthFive/ImmBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1f63d27016f7c6f45d8cbe8ba35a787274787ac --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmBlocks.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.DepthFive.Basic +import OAI.Algebra.DepthFive.MatrixPaths + +namespace OAI + +noncomputable section + +namespace Problem335 + +variable {K : Type*} [CommSemiring K] {n : ℕ} + +/-- Each block of layer labels represents the product of its matrices. -/ +def immBlock (K : Type*) [CommSemiring K] (n : ℕ) (labels : List (Fin n)) : + Matrix (Fin n) (Fin n) (MvPolynomial (Fin n × Fin n × Fin n) K) := + (labels.map (immLayer K n)).prod + +/-- Regrouping consecutive layers does not change the iterated matrix product. -/ +theorem imm_eq_blocks_prod (hn : 0 < n) (blocks : List (List (Fin n))) + (hblocks : blocks.flatten = List.finRange n) : + imm K n = ((blocks.map (immBlock K n)).prod) ⟨0, hn⟩ ⟨0, hn⟩ := by + have hm : (blocks.map (fun b : List (Fin n) => b.map (immLayer K n))).flatten = + (List.finRange n).map (immLayer K n) := by + rw [← List.map_flatten, hblocks] + have hp : (blocks.map (immBlock K n)).prod = + ((List.finRange n).map (immLayer K n)).prod := by + change (blocks.map (fun b : List (Fin n) => (b.map (immLayer K n)).prod)).prod = _ + simpa only [List.prod_flatten, List.map_map, Function.comp_def] using + congrArg List.prod hm + rw [hp] + simp only [imm, dite_eq_left hn, List.ofFn_eq_map] + + +/-- The outer path expansion of the block matrices computes `imm`. -/ +theorem imm_eq_blocks_path_sum (hn : 0 < n) (blocks : List (List (Fin n))) + (hblocks : blocks.flatten = List.finRange n) : + imm K n = + ((matrixEntryPaths (List.finRange blocks.length) (⟨0, hn⟩ : Fin n) ⟨0, hn⟩).map + (fun p => (p.map (fun e => + immBlock K n (blocks.get e.1) e.2.1 e.2.2)).prod)).sum := by + rw [matrixEntryPaths_sum_prod (fun j : Fin blocks.length => immBlock K n (blocks.get j))] + rw [imm_eq_blocks_prod hn blocks hblocks] + simp [← List.ofFn_eq_map] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmCompatibleTrace.lean b/lean/OAI/Algebra/DepthFive/ImmCompatibleTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f144c47fb7d17250f929c7f5059f641881a5c47 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmCompatibleTrace.lean @@ -0,0 +1,62 @@ +import OAI.Algebra.DepthFive.ImmSecondLocalBound +import OAI.Algebra.DepthFive.ImmPairingReindex +import OAI.Algebra.DepthFive.ImmProfileCompatibility + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Problem335 + +private def totalImmProfile (n : ℕ) + (P : List (Fin n × Fin n × Fin n)) : Fin n → Fin n × Fin n := + if h : P.map Prod.fst = List.finRange n then edgeProfile P h else fun t => (t, t) + +private theorem totalImmProfile_get (n : ℕ) (hn : 0 < n) + (p : Fin (immPaths n hn).length) : + totalImmProfile n ((immPaths n hn).get p) = FockLayerProfile.immProfile n hn p := by + simp only [totalImmProfile, dite_eq_left (immPaths_labels n hn _ (List.get_mem _ p)), + FockLayerProfile.immProfile] + +private theorem totalImmProfile_internal (d : ℕ) (p : Fin d → Fin (d + 1)) : + totalImmProfile (d + 1) (immInternalPathEdges d p) = immInternalCoordinate d p := by + funext t + simp only [totalImmProfile, dite_eq_left (immInternalPathEdges_labels d p), + edgeProfile_immInternalPathEdges] + +/-- The actual second trace is bounded by the compatible endpoint-path local +occupation sum, with one source sum and no remaining representation hypotheses. -/ +theorem immNormalizedMatrix_second_trace_le_compatible + (d : ℕ) (side : Fin (d + 1) → Bool) (a b : ℕ) : + let A := immNormalizedMatrix (d + 1) side a b + ((A.conjTranspose * A) ^ 2).trace.re ≤ + ∑ M : ImmSourceIndex (d + 1) side a b, + ∑ x : {x : Fin d → Pairings.Labels (Fin (d + 1)) // MomentPairing.Compatible 0 x}, + ∏ t : Fin (d + 1), LocalMoments.localPolynomial (side t) + (fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x.1 t).p + (MomentPairing.layerLabels 0 x.1 t).q + (MomentPairing.layerLabels 0 x.1 t).r := by + classical + refine (immNormalizedMatrix_second_trace_le_localPolynomial_sum + (d + 1) (Nat.succ_pos d) side a b).trans_eq ?_ + apply Finset.sum_congr rfl + intro M hM + have h := sum_four_immPaths_compatible_eq d side + (fun P Q R _ => ∏ t : Fin (d + 1), LocalMoments.localPolynomial (side t) + (fun y => M.1 (t, y)) (totalImmProfile (d + 1) P t) + (totalImmProfile (d + 1) Q t) (totalImmProfile (d + 1) R t)) + simp only [totalImmProfile_get, totalImmProfile_internal] at h + convert h using 1 + · rfl + · apply Finset.sum_congr rfl + intro x hx + apply Finset.prod_congr rfl + intro t ht + rw [show x.1 = (fun i => ⟨(x.1 i).p, (x.1 i).q, (x.1 i).r, (x.1 i).s⟩) from rfl, + layerLabels_immInternalCoordinate] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmDegree.lean b/lean/OAI/Algebra/DepthFive/ImmDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d52ac50c4e2357be32a99bdb77004ed452707ab --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmDegree.lean @@ -0,0 +1,166 @@ +import OAI.Algebra.DepthFive.Basic + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {K : Type*} [CommSemiring K] + +/-- A product of matrices whose entries are linear is homogeneous in its length. -/ +theorem matrix_list_prod_isHomogeneous {σ ι : Type*} [Fintype ι] [DecidableEq ι] + (L : List (Matrix ι ι (MvPolynomial σ K))) + (hL : ∀ A ∈ L, ∀ i j, (A i j).IsHomogeneous 1) (i j : ι) : + (L.prod i j).IsHomogeneous L.length := by + induction L generalizing i j with + | nil => + simp only [List.prod_nil, List.length_nil, Matrix.one_apply] + split_ifs + · exact MvPolynomial.isHomogeneous_one σ K + · exact MvPolynomial.isHomogeneous_zero σ K 0 + | cons A L ih => + simp only [List.prod_cons, List.length_cons, Matrix.mul_apply] + apply MvPolynomial.IsHomogeneous.sum + intro k hk + simpa only [Nat.add_comm] using + (hL A (List.mem_cons_self) i k).mul + (ih (fun B hB => hL B (List.mem_cons_of_mem A hB)) k j) + +/-- The iterated matrix multiplication polynomial has its expected degree. -/ +theorem imm_isHomogeneous (K : Type*) [CommSemiring K] (n : ℕ) : + (imm K n).IsHomogeneous n := by + classical + unfold imm + split_ifs with hn + · simpa only [List.length_ofFn] using + matrix_list_prod_isHomogeneous (List.ofFn (fun t : Fin n => immLayer K n t)) + (by + intro A hA i j + obtain ⟨t, rfl⟩ := List.mem_ofFn.mp hA + exact MvPolynomial.isHomogeneous_X K (t, i, j)) + (⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n) + · exact MvPolynomial.isHomogeneous_zero _ _ _ + +/-- Matrix multiplication adds weighted degrees, including repeated layer occurrences. -/ +theorem matrix_list_map_prod_isWeightedHomogeneous {σ ι τ M : Type*} + [Fintype ι] [DecidableEq ι] [AddCommMonoid M] + (w : σ → M) (A : τ → Matrix ι ι (MvPolynomial σ K)) (d : τ → M) + (L : List τ) (hA : ∀ t ∈ L, ∀ i j, (A t i j).IsWeightedHomogeneous w (d t)) + (i j : ι) : + ((L.map A).prod i j).IsWeightedHomogeneous w (L.map d).sum := by + induction L generalizing i j with + | nil => + simp only [List.map_nil, List.prod_nil, List.sum_nil, Matrix.one_apply] + split_ifs + · exact MvPolynomial.isWeightedHomogeneous_one K w + · exact MvPolynomial.isWeightedHomogeneous_zero K w 0 + | cons t L ih => + simp only [List.map_cons, List.prod_cons, List.sum_cons, Matrix.mul_apply] + apply MvPolynomial.IsWeightedHomogeneous.sum + intro k hk + exact (hA t List.mem_cons_self i k).mul + (ih (fun s hs => hA s (List.mem_cons_of_mem t hs)) k j) + +/-- Every monomial of IMM uses each matrix layer once, expressed with arbitrary additive weights. -/ +theorem imm_isWeightedHomogeneous (K : Type*) [CommSemiring K] (n : ℕ) + {M : Type*} [AddCommMonoid M] (w : Fin n → M) : + (imm K n).IsWeightedHomogeneous (fun x => w x.1) (∑ t, w t) := by + classical + unfold imm + split_ifs with hn + · simpa only [← List.ofFn_eq_map, List.sum_ofFn] using + matrix_list_map_prod_isWeightedHomogeneous + (fun x : Fin n × Fin n × Fin n => w x.1) (immLayer K n) w (List.finRange n) + (fun t ht i j => MvPolynomial.isWeightedHomogeneous_X K _ (t, i, j)) + (⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n) + · exact MvPolynomial.isWeightedHomogeneous_zero _ _ _ + +/-- The degree in any selected collection of matrix layers is its cardinality. -/ +theorem imm_layers_isWeightedHomogeneous (K : Type*) [CommSemiring K] (n : ℕ) + (s : Finset (Fin n)) : + (imm K n).IsWeightedHomogeneous (fun x => if x.1 ∈ s then 1 else 0) s.card := by + classical + simpa using imm_isWeightedHomogeneous K n (fun t => if t ∈ s then (1 : ℕ) else 0) + +/-- A support monomial has degree exactly one in each individual matrix layer. -/ +theorem imm_support_layer_weight (K : Type*) [CommSemiring K] (n : ℕ) + (t : Fin n) {d : (Fin n × Fin n × Fin n) →₀ ℕ} (hd : d ∈ (imm K n).support) : + Finsupp.weight (fun x : Fin n × Fin n × Fin n => if x.1 = t then (1 : ℕ) else 0) d = 1 := by + classical + simpa using + (imm_isWeightedHomogeneous K n (fun s => if s = t then (1 : ℕ) else 0)) + (MvPolynomial.mem_support_iff.mp hd) + +/-- IMM is multilinear in every matrix-entry variable. -/ +theorem imm_degreeOf_le_one (K : Type*) [CommSemiring K] (n : ℕ) + (x : Fin n × Fin n × Fin n) : (imm K n).degreeOf x ≤ 1 := by + classical + apply MvPolynomial.degreeOf_le_iff.mpr + intro d hd + have hdeg := imm_support_layer_weight K n x.1 hd + rw [Finsupp.weight_apply, Finsupp.sum] at hdeg + by_cases hx : d x = 0 + · simp [hx] + · calc + d x = d x • (if x.1 = x.1 then (1 : ℕ) else 0) := by simp + _ ≤ ∑ y ∈ d.support, d y • (if y.1 = x.1 then (1 : ℕ) else 0) := + Finset.single_le_sum (f := fun y => d y • (if y.1 = x.1 then (1 : ℕ) else 0)) + (fun y hy => Nat.zero_le _) (Finsupp.mem_support_iff.mpr hx) + _ = 1 := hdeg + +/-- Evaluation assigning every matrix layer the identity matrix. -/ +def immIdentityEvaluation (K : Type*) [CommSemiring K] (n : ℕ) : + MvPolynomial (Fin n × Fin n × Fin n) K →+* K := + MvPolynomial.eval (fun x => if x.2.1 = x.2.2 then 1 else 0) + +@[simp] theorem immIdentityEvaluation_layer (n : ℕ) (t : Fin n) : + (immIdentityEvaluation K n).mapMatrix (immLayer K n t) = 1 := by + classical + ext i j + simp [immIdentityEvaluation, immLayer, Matrix.one_apply] + +/-- Evaluation at identity matrices sends any product of variable layers to the identity. -/ +theorem immIdentityEvaluation_layers (n : ℕ) (L : List (Fin n)) : + (immIdentityEvaluation K n).mapMatrix ((L.map (immLayer K n)).prod) = 1 := by + classical + rw [map_list_prod, List.map_map] + simp only [Function.comp_def, immIdentityEvaluation_layer] + simp + +@[simp] theorem immIdentityEvaluation_imm (n : ℕ) (hn : 0 < n) : + immIdentityEvaluation K n (imm K n) = 1 := by + classical + unfold imm + simp only [dite_eq_left hn] + have h : (immIdentityEvaluation K n).mapMatrix + (List.ofFn (fun t : Fin n => immLayer K n t)).prod = 1 := by + rw [map_list_prod, List.map_ofFn] + simp only [Function.comp_def, immIdentityEvaluation_layer] + simp + exact congrArg (fun A : Matrix (Fin n) (Fin n) K => + A ⟨0, hn⟩ ⟨0, hn⟩) h + +/-- IMM does not vanish over any nontrivial coefficient semiring when its size is positive. -/ +theorem imm_ne_zero (K : Type*) [CommSemiring K] [Nontrivial K] (n : ℕ) (hn : 0 < n) : + imm K n ≠ 0 := by + intro h + have he := immIdentityEvaluation_imm (K := K) n hn + rw [h, map_zero] at he + exact zero_ne_one he + +/-- The total degree of IMM is the number of matrix layers. -/ +theorem imm_totalDegree (K : Type*) [CommSemiring K] [Nontrivial K] (n : ℕ) : + (imm K n).totalDegree = n := by + by_cases hn : 0 < n + · exact (imm_isHomogeneous K n).totalDegree (imm_ne_zero K n hn) + · have hn0 : n = 0 := Nat.eq_zero_of_not_pos hn + subst n + simp [imm] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmFiniteMatrix.lean b/lean/OAI/Algebra/DepthFive/ImmFiniteMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..43c4ed9f4aaec9340dff82a22fa2a85f333b21e7 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmFiniteMatrix.lean @@ -0,0 +1,190 @@ +import OAI.Algebra.DepthFive.FiniteOperator +import OAI.Algebra.DepthFive.ImmFockMatrix +import OAI.Algebra.DepthFive.FockBidegreeBasis +import OAI.Algebra.DepthFive.TraceExpansion +import OAI.Algebra.DepthFive.PathInjectivity + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- The number of derivative layers in a layerwise partition. -/ +def immLayerVCount {n : ℕ} (side : Fin n → Bool) : ℕ := + (Finset.univ.filter (fun t => side t = true)).card + +/-- The number of multiplication layers in a layerwise partition. -/ +def immLayerUCount {n : ℕ} (side : Fin n → Bool) : ℕ := + (Finset.univ.filter (fun t => side t = false)).card + +/-- Source exponent vectors for the finite IMM operator. -/ +abbrev ImmSourceIndex (n : ℕ) (side : Fin n → Bool) (a b : ℕ) := + BidegreeIndex (fun x : Fin n × Fin n × Fin n => side x.1) a b + +/-- Target exponent vectors for the finite IMM operator. -/ +abbrev ImmTargetIndex (n : ℕ) (side : Fin n → Bool) (a b : ℕ) := + BidegreeIndex (fun x : Fin n × Fin n × Fin n => side x.1) + (a - immLayerVCount side) (b + immLayerUCount side) + +/-- The actual finite IMM map written in factorial-normalized source and target bases. -/ +def immNormalizedMatrix (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : + Matrix (ImmTargetIndex n side a b) (ImmSourceIndex n side a b) ℂ := + LinearMap.toMatrix + (bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) (fun x => side x.1) a b) + (bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) (fun x => side x.1) + (a - immLayerVCount side) (b + immLayerUCount side)) + (finiteMixedOperator (K := ℂ) (σ := Fin n × Fin n × Fin n) (fun x => side x.1) a b + (immLayerVCount side) (immLayerUCount side) (imm ℂ n)) + +/-- Each finite normalized matrix entry is exactly the weighted sum of its IMM path shifts. -/ +theorem immNormalizedMatrix_apply (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) + (a b : ℕ) (e : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b) : + immNormalizedMatrix n side a b e d = + ∑ p : Fin (immPaths n hn).length, + if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 + then (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ) else 0 := by + classical + unfold immNormalizedMatrix + rw [LinearMap.toMatrix_apply, bidegreeComplexFockBasis_repr] + change (Real.sqrt (multiFactorial e.1 : ℝ) : ℂ) * + (mixedOperator (fun x => side x.1) + (bidegreeComponent (fun x => side x.1) (immLayerVCount side) (immLayerUCount side) + (imm ℂ n)) + ((bidegreeComplexFockBasis (σ := Fin n × Fin n × Fin n) + (fun x => side x.1) a b d) : MvPolynomial (Fin n × Fin n × Fin n) ℂ)).coeff e.1 = _ + rw [bidegreeComplexFockBasis_apply] + simp only [immLayerVCount, immLayerUCount, bidegreeComponent_imm] + rw [← complexFockBasis_repr] + exact complexFockBasis_repr_mixedOperator_imm n hn (fun x => side x.1) d.1 e.1 + +/-- The finite normalized matrix computes exactly the manuscript's rank measure. -/ +theorem immNormalizedMatrix_rank (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : + (immNormalizedMatrix n side a b).rank = + bidegreeRank (fun x => side x.1) a b + (immLayerVCount side) (immLayerUCount side) (imm ℂ n) := by + rw [immNormalizedMatrix, ← RankMeasure.mapRank_eq_matrixRank, finiteMixedOperator_rank] + +/-- The genuine target occupation, with an irrelevant fallback for zero-amplitude paths. -/ +def immTargetShift (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) + [Nonempty (ImmTargetIndex n side a b)] + (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) : + ImmTargetIndex n side a b := by + classical + exact if h : Finsupp.weight (bidegreeWeight (fun x => side x.1)) + (immPathOccupation n hn (fun x => side x.1) d.1 p) = + (a - immLayerVCount side, b + immLayerUCount side) + then ⟨_, h⟩ else Classical.choice inferInstance + +/-- Nonzero paths never use the arbitrary fallback index. -/ +theorem immTargetShift_val_of_amplitude_ne_zero (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] + (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) + (hp : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0) : + (immTargetShift n hn side a b d p).1 = + immPathOccupation n hn (fun x => side x.1) d.1 p := by + have h := immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hp + unfold immTargetShift + split_ifs with hdegree + · rfl + · exact False.elim (hdegree h) + +/-- The actual normalized IMM matrix is the finite weighted path-shift matrix. -/ +theorem immNormalizedMatrix_eq_pathShiftMatrix (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] : + immNormalizedMatrix n side a b = + pathShiftMatrix (immTargetShift n hn side a b) + (fun d p => (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ)) := by + classical + ext e d + rw [immNormalizedMatrix_apply n hn side a b e d] + unfold pathShiftMatrix + apply Finset.sum_congr rfl + intro p hp + by_cases ha : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 + · simp [ha] + · have hs := immTargetShift_val_of_amplitude_ne_zero n hn side a b d p ha + have he : immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 ↔ + immTargetShift n hn side a b d p = e := by + rw [Subtype.ext_iff, hs] + simp only [he] + +/-- Distinct nonzero path contributions cannot reach the same occupation vector. -/ +theorem immPathOccupation_injective_of_nonzero (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (d : (Fin n × Fin n × Fin n) →₀ ℕ) + (p q : Fin (immPaths n hn).length) + (hp : immPathAmplitude n hn (fun x => side x.1) d p ≠ 0) + (hq : immPathAmplitude n hn (fun x => side x.1) d q ≠ 0) + (heq : immPathOccupation n hn (fun x => side x.1) d p = + immPathOccupation n hn (fun x => side x.1) d q) : p = q := by + have hsp := signedOccupation_path_of_amplitude_ne_zero (fun x : Fin n × Fin n × Fin n => side x.1) + ((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d hp + have hsq := signedOccupation_path_of_amplitude_ne_zero (fun x : Fin n × Fin n × Fin n => side x.1) + ((immPaths n hn).get q) (immPaths_nodup n hn _ (List.get_mem _ q)) d hq + have hs := congrArg signedOccupation heq + change signedOccupation (pathOccupation _ _ _) = + signedOccupation (pathOccupation _ _ _) at hs + rw [hsp, hsq] at hs + have hshift := add_left_cancel hs + apply immPaths_get_injective n hn + apply edgeListShift_injective_of_labels side (List.finRange n) (List.nodup_finRange n) + _ _ (immPaths_labels n hn _ (List.get_mem _ p)) + (immPaths_labels n hn _ (List.get_mem _ q)) + simpa only [edgeListShift_eq_sum, occupationShift] using hshift + +/-- Any collision of distinct finite shifts has a zero-amplitude contribution. -/ +theorem immTargetShift_collision_zero (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] + (d : ImmSourceIndex n side a b) (p q : Fin (immPaths n hn).length) + (hpq : p ≠ q) (hs : immTargetShift n hn side a b d p = + immTargetShift n hn side a b d q) : + immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 ∨ + immPathAmplitude n hn (fun x => side x.1) d.1 q = 0 := by + by_cases hp : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 + · exact Or.inl hp + by_cases hq : immPathAmplitude n hn (fun x => side x.1) d.1 q = 0 + · exact Or.inr hq + apply False.elim + apply hpq + apply immPathOccupation_injective_of_nonzero n hn side d.1 p q hp hq + have hv := congrArg Subtype.val hs + simpa only [immTargetShift_val_of_amplitude_ne_zero n hn side a b d p hp, + immTargetShift_val_of_amplitude_ne_zero n hn side a b d q hq] using hv + +/-- All entries of the normalized IMM operator are real, so adjoint equals transpose. -/ +theorem immNormalizedMatrix_conjTranspose (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) : + (immNormalizedMatrix n side a b).conjTranspose = + (immNormalizedMatrix n side a b).transpose := by + classical + ext d e + simp only [Matrix.conjTranspose_apply, Matrix.transpose_apply, + immNormalizedMatrix_apply n hn side a b] + simp only [star_sum] + apply Finset.sum_congr rfl + intro p hp + split_ifs <;> simp + +/-- The first Gram trace of the actual IMM operator is its total path occupation mass. -/ +theorem immNormalizedMatrix_first_trace (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) [Nonempty (ImmTargetIndex n side a b)] : + Matrix.trace ((immNormalizedMatrix n side a b).conjTranspose * + immNormalizedMatrix n side a b) = + ∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length, + ((immPathAmplitude n hn (fun x => side x.1) d.1 p) ^ 2 : ℝ) := by + classical + rw [immNormalizedMatrix_conjTranspose n hn side a b, + immNormalizedMatrix_eq_pathShiftMatrix n hn side a b, + pathShiftMatrix_first_trace] + · simp + · intro d p q hpq hs + rcases immTargetShift_collision_zero n hn side a b d p q hpq hs with hp | hq + · simp [hp] + · simp [hq] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmFirstMomentBound.lean b/lean/OAI/Algebra/DepthFive/ImmFirstMomentBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5196cf8e77fe69dbd6cabb3608cfcdd47cf1772 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmFirstMomentBound.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.DepthFive.ImmFirstTrace +import OAI.Algebra.DepthFive.PathMassLowerBound + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix + +namespace Problem335 + +/-- The independent geometric benchmark for one IMM path. -/ +def immFirstMomentMean (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : ℝ := + ((a : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true}) ^ + immLayerVCount side * + (1 + (b : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false}) ^ + immLayerUCount side + +/-- The explicit finite-size occupation loss, before parameter specialization. -/ +def immFirstMomentLoss (n : ℕ) (side : Fin n → Bool) (a b : ℕ) : ℝ := + (immLayerVCount side : ℝ) ^ 2 / a + + (immLayerVCount side : ℝ) ^ 2 / + (2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true}) + + (immLayerUCount side : ℝ) ^ 2 / b + + (immLayerUCount side : ℝ) ^ 2 / + (2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false}) + +/-- First-moment lower bound for the actual finite normalized IMM matrix. +The only hypotheses are positive occupation totals, nonempty variable groups, +and the elementary order range required by the occupation ratio estimate. -/ +theorem immNormalizedMatrix_first_moment_lower + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) + [Nonempty {x : Fin n × Fin n × Fin n // side x.1 = true}] + [Nonempty {x : Fin n × Fin n × Fin n // side x.1 = false}] + (ha : 0 < a) (hb : 0 < b) + (hk : 2 * immLayerVCount side ≤ a) (hm : 2 * immLayerUCount side ≤ b) : + (Fintype.card (ImmSourceIndex n side a b) : ℝ) * (n : ℝ) ^ (n - 1) * + (Real.exp (-immFirstMomentLoss n side a b) * immFirstMomentMean n side a b) ≤ + ((immNormalizedMatrix n side a b).conjTranspose * + immNormalizedMatrix n side a b).trace.re := by + classical + apply immNormalizedMatrix_first_trace_lower_of_average n hn side a b + intro p + have h := immPath_source_mass_lower n hn side a b ((immPaths n hn).get p) + (List.get_mem _ p) ha hb hk hm + change _ ≤ (∑ d : ImmSourceIndex n side a b, + immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) / + (Fintype.card (ImmSourceIndex n side a b) : ℝ) at h + convert h using 1 + apply congrArg₂ (fun x y : ℝ => x * y) + · apply congrArg Real.exp + dsimp [immFirstMomentLoss, immLayerVCount, immLayerUCount] + ring + · rfl + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmFirstMomentParameters.lean b/lean/OAI/Algebra/DepthFive/ImmFirstMomentParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..8005afe8aa752b9345aa7305bd9c982e22eca89d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmFirstMomentParameters.lean @@ -0,0 +1,64 @@ +import OAI.Algebra.DepthFive.ImmFirstTrace +import OAI.Algebra.DepthFive.PathMassParameters + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix + +namespace Problem335 + +open LowerParameters + +/-- The first trace of the actual finite normalized IMM matrix at the canonical +occupation parameters. The path-count and geometric scale agree with the second +moment normalization; there are no auxiliary matrix-identity hypotheses. -/ +theorem immNormalizedMatrix_first_moment_lower_parameters {n : ℕ} (hn : 16 ≤ n) + (side : Fin n → Bool) (hk : immLayerVCount side = k n) + (hm : immLayerUCount side = m n) : + (Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) * + ((n : ℝ) ^ (n - 1) * + (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) * + Real.exp (-64 / Real.sqrt (n : ℝ)) ≤ + ((immNormalizedMatrix n side (a n) (b n)).conjTranspose * + immNormalizedMatrix n side (a n) (b n)).trace.re := by + classical + have h := immNormalizedMatrix_first_trace_lower_of_average n (by omega) + side (a n) (b n) + (Real.exp (-64 / Real.sqrt (n : ℝ)) * + (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) (by + intro p + have hpath := immPath_source_mass_lower_parameters hn side hk hm + ((immPaths n (by omega)).get p) (List.get_mem _ p) + change _ ≤ (∑ d : ImmSourceIndex n side (a n) (b n), + immPathAmplitude n (by omega) (fun x => side x.1) d.1 p ^ 2) / + (Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) at hpath + exact hpath) + simpa only [mul_assoc, mul_left_comm, mul_comm] using h + +/-- A weaker square-root-exponential version is convenient for the final +rank lower bound, whose constant absorbs both trace losses. -/ +theorem immNormalizedMatrix_first_moment_lower_sqrt {n : ℕ} (hn : 16 ≤ n) + (side : Fin n → Bool) (hk : immLayerVCount side = k n) + (hm : immLayerUCount side = m n) : + (Fintype.card (ImmSourceIndex n side (a n) (b n)) : ℝ) * + ((n : ℝ) ^ (n - 1) * + (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n)) * + Real.exp (-64 * Real.sqrt (n : ℝ)) ≤ + ((immNormalizedMatrix n side (a n) (b n)).conjTranspose * + immNormalizedMatrix n side (a n) (b n)).trace.re := by + have hs := sqrt_ge_four hn + have hspos : 0 < Real.sqrt (n : ℝ) := by linarith + have hexp : Real.exp (-64 * Real.sqrt (n : ℝ)) ≤ + Real.exp (-64 / Real.sqrt (n : ℝ)) := by + apply Real.exp_le_exp.mpr + apply (le_div_iff₀ hspos).mpr + nlinarith [sq_nonneg (Real.sqrt (n : ℝ) - 1)] + exact (mul_le_mul_of_nonneg_left hexp (by positivity)).trans + (immNormalizedMatrix_first_moment_lower_parameters hn side hk hm) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmFirstTrace.lean b/lean/OAI/Algebra/DepthFive/ImmFirstTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..0622ae6a171b8fcddd8950cd0a96f5d425636c4a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmFirstTrace.lean @@ -0,0 +1,129 @@ +import OAI.Algebra.DepthFive.ImmFiniteMatrix +import OAI.Algebra.DepthFive.FirstTraceNonnegative + +namespace OAI + +noncomputable section +open scoped BigOperators Matrix + +namespace Problem335 + +/-- The real, nonnegative matrix underlying the actual normalized IMM map. -/ +def immRealNormalizedMatrix (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : + Matrix (ImmTargetIndex n side a b) (ImmSourceIndex n side a b) ℝ := by + classical + exact fun e d => ∑ p : Fin (immPaths n hn).length, + if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 + then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0 + +theorem immNormalizedMatrix_eq_map_real (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) : + immNormalizedMatrix n side a b = + (immRealNormalizedMatrix n hn side a b).map Complex.ofReal := by + classical + ext e d + rw [immNormalizedMatrix_apply n hn] + simp only [Matrix.map_apply, immRealNormalizedMatrix, Complex.ofReal_sum] + apply Finset.sum_congr rfl + intro p hp + split_ifs <;> simp + +/-- Every nonzero path amplitude occurs in exactly one genuine target row. +Zero-amplitude paths need no artificial target-row choice. -/ +theorem immPathAmplitude_sq_sum_target (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) (d : ImmSourceIndex n side a b) + (p : Fin (immPaths n hn).length) : + (∑ e : ImmTargetIndex n side a b, + (if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 + then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2) = + immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := by + classical + by_cases hw : immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 + · simp [hw] + let e : ImmTargetIndex n side a b := + ⟨immPathOccupation n hn (fun x => side x.1) d.1 p, + immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hw⟩ + rw [Finset.sum_eq_single e] + · simp [e] + · intro e' he' hne + have hocc : immPathOccupation n hn (fun x => side x.1) d.1 p ≠ e'.1 := by + intro heq + apply hne + exact Subtype.ext heq.symm + simp [hocc] + · simp + +/-- Actual normalized IMM first trace dominates the total occupation mass. +Nonnegative coefficients make path-collision analysis unnecessary for this +lower bound. All sources and targets are the genuine finite bidegree spaces. -/ +theorem immNormalizedMatrix_first_trace_lower (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) : + (∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length, + immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) ≤ + ((immNormalizedMatrix n side a b).conjTranspose * + immNormalizedMatrix n side a b).trace.re := by + classical + rw [immNormalizedMatrix_eq_map_real n hn, complexify_first_trace, + trace_transpose_mul_self] + apply Finset.sum_le_sum + intro d hd + calc + _ = ∑ p : Fin (immPaths n hn).length, ∑ e : ImmTargetIndex n side a b, + (if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 + then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2 := by + apply Finset.sum_congr rfl + intro p hp + exact (immPathAmplitude_sq_sum_target n hn side a b d p).symm + _ = ∑ e : ImmTargetIndex n side a b, ∑ p : Fin (immPaths n hn).length, + (if immPathOccupation n hn (fun x => side x.1) d.1 p = e.1 + then immPathAmplitude n hn (fun x => side x.1) d.1 p else 0) ^ 2 := + Finset.sum_comm + _ ≤ _ := by + apply Finset.sum_le_sum + intro e he + apply Finset.sum_sq_le_sq_sum_of_nonneg + intro p hp + split_ifs + · exact immPathAmplitude_nonneg n hn _ d.1 p + · exact le_rfl + +/-- Uniform actual-source occupation averages lift to the normalized IMM +first trace with exactly `n^(n-1)` endpoint paths. -/ +theorem immNormalizedMatrix_first_trace_lower_of_average + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) (L : ℝ) + (hmean : ∀ p : Fin (immPaths n hn).length, + L ≤ (∑ d : ImmSourceIndex n side a b, + immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2) / + (Fintype.card (ImmSourceIndex n side a b) : ℝ)) : + (Fintype.card (ImmSourceIndex n side a b) : ℝ) * (n : ℝ) ^ (n - 1) * L ≤ + ((immNormalizedMatrix n side a b).conjTranspose * + immNormalizedMatrix n side a b).trace.re := by + classical + have hsum (p : Fin (immPaths n hn).length) : + (Fintype.card (ImmSourceIndex n side a b) : ℝ) * L ≤ + ∑ d : ImmSourceIndex n side a b, + immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := by + by_cases hz : Fintype.card (ImmSourceIndex n side a b) = 0 + · simp only [hz, Nat.cast_zero, zero_mul] + exact Finset.sum_nonneg (fun d _ => sq_nonneg _) + · have hpos : (0 : ℝ) < Fintype.card (ImmSourceIndex n side a b) := by + exact_mod_cast Nat.pos_of_ne_zero hz + simpa only [mul_comm] using (le_div_iff₀ hpos).mp (hmean p) + calc + _ = ∑ p : Fin (immPaths n hn).length, + (Fintype.card (ImmSourceIndex n side a b) : ℝ) * L := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, + immPaths_length, nsmul_eq_mul, Nat.cast_pow] + ring + _ ≤ ∑ p : Fin (immPaths n hn).length, ∑ d : ImmSourceIndex n side a b, + immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := + Finset.sum_le_sum (fun p _ => hsum p) + _ = ∑ d : ImmSourceIndex n side a b, ∑ p : Fin (immPaths n hn).length, + immPathAmplitude n hn (fun x => side x.1) d.1 p ^ 2 := Finset.sum_comm + _ ≤ _ := immNormalizedMatrix_first_trace_lower n hn side a b + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmFockMatrix.lean b/lean/OAI/Algebra/DepthFive/ImmFockMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..9566d66217d42c90c50f80dd70b0507dca85f4ba --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmFockMatrix.lean @@ -0,0 +1,161 @@ +import OAI.Algebra.DepthFive.ImmOperatorPaths +import OAI.Algebra.DepthFive.FockPaths +import OAI.Algebra.DepthFive.ImmBidegree +import OAI.Algebra.DepthFive.FiniteOperator + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- The normalized coefficient contributed by one endpoint path of IMM. -/ +def immPathAmplitude (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : ℝ := + (((immPaths n hn).get p).map (occupationAmplitude isV d)).prod + +/-- The final occupation vector of one path operator. -/ +def immPathOccupation (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : + (Fin n × Fin n × Fin n) →₀ ℕ := + pathOccupation isV ((immPaths n hn).get p) d + +theorem immPathAmplitude_nonneg (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : + 0 ≤ immPathAmplitude n hn isV d p := by + apply List.prod_nonneg + intro x hx + obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hx + exact occupationAmplitude_nonneg isV d i + +/-- The actual IMM operator on a normalized monomial is the sum of its sparse path actions. -/ +theorem mixedOperator_imm_complexFockMonomial (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) : + mixedOperator isV (imm ℂ n) (complexFockMonomial d) = + ∑ p : Fin (immPaths n hn).length, + (immPathAmplitude n hn isV d p : ℂ) • + complexFockMonomial (immPathOccupation n hn isV d p) := by + rw [mixedOperator_imm_apply_eq_sum_paths n hn isV] + apply Finset.sum_congr rfl + intro p hp + have h := mixedOperator_path_complexFockMonomial isV ((immPaths n hn).get p) + (immPaths_nodup n hn _ (List.get_mem _ p)) d + simpa only [map_list_prod, List.map_map, Function.comp_def, mixedOperator_X, + immPathAmplitude, immPathOccupation] using h + +/-- Normalized matrix entries of the actual IMM operator are weighted path-shift counts. -/ +theorem complexFockBasis_repr_mixedOperator_imm (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (d e : (Fin n × Fin n × Fin n) →₀ ℕ) : + complexFockBasis.repr (mixedOperator isV (imm ℂ n) (complexFockMonomial d)) e = + ∑ p : Fin (immPaths n hn).length, + if immPathOccupation n hn isV d p = e then (immPathAmplitude n hn isV d p : ℂ) + else 0 := by + classical + rw [mixedOperator_imm_complexFockMonomial n hn isV] + simp only [map_sum, map_smul, Finsupp.finsetSum_apply, Finsupp.smul_apply] + apply Finset.sum_congr rfl + intro p hp + rw [← complexFockBasis_apply, Module.Basis.repr_self] + simp [Finsupp.single_apply] + +/-- A product of variables has the sum of their assigned weighted degrees. -/ +theorem variable_list_product_isWeightedHomogeneous {K σ M : Type*} + [CommSemiring K] [AddCommMonoid M] (w : σ → M) (l : List σ) : + ((l.map (MvPolynomial.X : σ → MvPolynomial σ K)).prod).IsWeightedHomogeneous + w (l.map w).sum := by + induction l with + | nil => simpa using MvPolynomial.isWeightedHomogeneous_one K w + | cons x l ih => + simpa only [List.map_cons, List.prod_cons, List.sum_cons] using + (MvPolynomial.isWeightedHomogeneous_X K w x).mul ih + +/-- The path monomials all have the same layerwise bidegree as IMM. -/ +theorem immPath_product_mem_bidegreeSubmodule (K : Type*) [CommSemiring K] + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) + (p : Fin (immPaths n hn).length) : + ((((immPaths n hn).get p).map (MvPolynomial.X (R := K))).prod) ∈ + bidegreeSubmodule (fun x => side x.1) + (Finset.univ.filter (fun t => side t = true)).card + (Finset.univ.filter (fun t => side t = false)).card := by + have h := variable_list_product_isWeightedHomogeneous (K := K) + (fun x : Fin n × Fin n × Fin n => bidegreeWeight side x.1) ((immPaths n hn).get p) + have hl := immPaths_labels n hn _ (List.get_mem _ p) + have hs := congrArg (fun l : List (Fin n) => (l.map (bidegreeWeight side)).sum) hl + simp only [List.map_map, Function.comp_def, ← List.ofFn_eq_map, List.sum_ofFn] at hs + rw [hs] at h + have he : (∑ t, bidegreeWeight side t) = + ((Finset.univ.filter (fun t => side t = true)).card, + (Finset.univ.filter (fun t => side t = false)).card) := by + apply Prod.ext + · simp only [Prod.fst_sum, Finset.card_filter] + apply Finset.sum_congr rfl + intro t ht + cases ht' : side t <;> simp [bidegreeWeight, ht'] + · simp only [Prod.snd_sum, Finset.card_filter] + apply Finset.sum_congr rfl + intro t ht + cases ht' : side t <;> simp [bidegreeWeight, ht'] + rw [he] at h + exact h + +/-- A nonzero scalar multiple of a normalized monomial determines its weighted degree. -/ +theorem weight_eq_of_complexFockMonomial_smul_mem {σ M : Type*} + [Fintype σ] [DecidableEq σ] [AddCommMonoid M] + (w : σ → M) (d : σ →₀ ℕ) (a : M) (c : ℂ) (hc : c ≠ 0) + (h : (c • complexFockMonomial d).IsWeightedHomogeneous w a) : + Finsupp.weight w d = a := by + apply h (d := d) + rw [MvPolynomial.coeff_smul, complexFockMonomial_eq, MvPolynomial.coeff_monomial] + simp only [smul_eq_mul] + apply mul_ne_zero hc + exact inv_ne_zero (by exact_mod_cast (sqrt_multiFactorial_pos d).ne') + +/-- A nonzero path amplitude guarantees that its occupation lies in the genuine target bidegree. -/ +theorem immPathOccupation_bidegree_of_amplitude_ne_zero (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) + (hd : Finsupp.weight (bidegreeWeight (fun x => side x.1)) d = (a, b)) + (p : Fin (immPaths n hn).length) + (hp : immPathAmplitude n hn (fun x => side x.1) d p ≠ 0) : + Finsupp.weight (bidegreeWeight (fun x => side x.1)) + (immPathOccupation n hn (fun x => side x.1) d p) = + (a - (Finset.univ.filter (fun t => side t = true)).card, + b + (Finset.univ.filter (fun t => side t = false)).card) := by + have hinput : complexFockMonomial d ∈ + bidegreeSubmodule (fun x => side x.1) a b := by + rw [complexFockMonomial_eq] + exact MvPolynomial.isWeightedHomogeneous_monomial _ _ _ hd + have hpoly := immPath_product_mem_bidegreeSubmodule ℂ n hn side p + have hout := mixedOperator_mem_bidegreeSubmodule_all (K := ℂ) + (σ := Fin n × Fin n × Fin n) + (q := (((immPaths n hn).get p).map (MvPolynomial.X (R := ℂ))).prod) + (p := complexFockMonomial d) + (k := (Finset.univ.filter (fun t => side t = true)).card) + (m := (Finset.univ.filter (fun t => side t = false)).card) + (a := a) (b := b) (fun x => side x.1) hpoly hinput + have hact := mixedOperator_path_complexFockMonomial (fun x => side x.1) + ((immPaths n hn).get p) (immPaths_nodup n hn _ (List.get_mem _ p)) d + rw [hact] at hout + exact weight_eq_of_complexFockMonomial_smul_mem _ _ _ _ + (by exact_mod_cast hp) hout + +/-- Squared path amplitudes are the occupation monomials occurring in the moment calculation. -/ +theorem immPathAmplitude_sq (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) : + (immPathAmplitude n hn isV d p) ^ 2 = + (((immPaths n hn).get p).map + (fun i => if isV i then (d i : ℝ) else (d i : ℝ) + 1)).prod := + pathAmplitude_sq isV _ d + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmMap.lean b/lean/OAI/Algebra/DepthFive/ImmMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..b869b5496d3e4a1deff0c3dbcd2addad8d59fe9d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmMap.lean @@ -0,0 +1,34 @@ +import OAI.Algebra.DepthFive.Basic + +namespace OAI + +noncomputable section +universe u v + +namespace Problem335 + +/-- Iterated matrix multiplication commutes with change of coefficient semiring. -/ +@[simp] theorem map_imm {K : Type u} {L : Type v} [CommSemiring K] [CommSemiring L] + (f : K →+* L) (n : ℕ) : MvPolynomial.map f (imm K n) = imm L n := by + classical + by_cases hn : 0 < n + · simp only [imm, dite_eq_left hn] + let F := (MvPolynomial.map (σ := Fin n × Fin n × Fin n) f).mapMatrix (m := Fin n) + have h := F.map_list_prod (List.ofFn (fun t : Fin n => immLayer K n t)) + have hm : (List.ofFn (fun t : Fin n => immLayer K n t)).map F = + List.ofFn (fun t : Fin n => immLayer L n t) := by + simp only [List.map_ofFn] + congr 1 + funext t i j + simp [F, immLayer] + change F (List.ofFn (fun t : Fin n => immLayer K n t)).prod = + ((List.ofFn (fun t : Fin n => immLayer K n t)).map F).prod at h + rw [hm] at h + exact congrArg (fun M => M ⟨0, hn⟩ ⟨0, hn⟩) h + · simp [imm, hn] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmOperatorPaths.lean b/lean/OAI/Algebra/DepthFive/ImmOperatorPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..267d084307266b14cec0bf3c1a4a6a9ece194517 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmOperatorPaths.lean @@ -0,0 +1,190 @@ +import OAI.Algebra.DepthFive.Basic +import OAI.Algebra.DepthFive.MatrixPaths +import OAI.Algebra.DepthFive.MixedOperator + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +open MvPolynomial + +/-- Enumerating labelled matrix paths never repeats an edge list. -/ +private theorem immOperatorPaths_enumeration_nodup {σ ι : Type*} [Fintype ι] [DecidableEq ι] + (labels : List σ) (i j : ι) : (matrixEntryPaths labels i j).Nodup := by + induction labels generalizing i with + | nil => by_cases hij : i = j <;> simp [matrixEntryPaths, hij] + | cons t ts ih => + cases ts with + | nil => simp [matrixEntryPaths] + | cons u us => + rw [matrixEntryPaths, List.nodup_flatMap] + constructor + · intro k hk + exact List.Nodup.map (fun p q h => (List.cons.inj h).2) (ih k) + · apply (Finset.nodup_toList _).pairwise_of_forall_ne + intro a ha b hb hab p hp hq + obtain ⟨q, hq', rfl⟩ := List.mem_map.mp hp + obtain ⟨r, hr, heq⟩ := List.mem_map.mp hq + simp only [List.cons.injEq, Prod.mk.injEq] at heq + exact hab heq.1.2.2.symm + +/-- The canonical labelled paths contributing to the endpoint IMM entry. -/ +def immPaths (n : ℕ) (hn : 0 < n) : List (List (Fin n × Fin n × Fin n)) := + matrixEntryPaths (List.finRange n) ⟨0, hn⟩ ⟨0, hn⟩ + +/-- Every IMM path uses exactly one coordinate in each layer, in layer order. -/ +theorem immPaths_labels (n : ℕ) (hn : 0 < n) + (p : List (Fin n × Fin n × Fin n)) (hp : p ∈ immPaths n hn) : + p.map Prod.fst = List.finRange n := + matrixEntryPaths_labels _ _ _ _ hp + +/-- Distinct path indices select distinct edge lists. -/ +theorem immPaths_get_injective (n : ℕ) (hn : 0 < n) : + Function.Injective (immPaths n hn).get := by + apply List.nodup_iff_injective_get.mp + exact immOperatorPaths_enumeration_nodup _ _ _ + +/-- The number of endpoint paths is `n^(n-1)`. -/ +theorem immPaths_length (n : ℕ) (hn : 0 < n) : + (immPaths n hn).length = n ^ (n - 1) := by + unfold immPaths + rw [matrixEntryPaths_length _ (by simpa using (Nat.ne_of_gt hn))] + simp + +variable {K : Type*} [CommSemiring K] + +/-- The endpoint IMM polynomial is the sum of its labelled path monomials. -/ +theorem imm_eq_sum_path_products (n : ℕ) (hn : 0 < n) : + imm K n = ((immPaths n hn).map fun p => (p.map (X (R := K))).prod).sum := by + have h := matrixEntryPaths_sum_prod (immLayer K n) (List.finRange n) + (⟨0, hn⟩ : Fin n) (⟨0, hn⟩ : Fin n) + simp only [imm, dite_eq_left hn, List.ofFn_eq_map] + exact h.symm + +/-- The full IMM polynomial operator is a sum of products of its edge operators. -/ +theorem mixedOperator_imm_eq_sum_paths (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) : + mixedOperator (K := K) isV (imm K n) = + ((immPaths n hn).map fun p => + (p.map (variableOperator (K := K) isV)).prod).sum := by + rw [imm_eq_sum_path_products n hn, map_list_sum] + simp only [List.map_map, Function.comp_def, map_list_prod, mixedOperator_X] + +/-- Each individual IMM path contains no repeated variable. -/ +theorem immPaths_nodup (n : ℕ) (hn : 0 < n) + (p : List (Fin n × Fin n × Fin n)) (hp : p ∈ immPaths n hn) : p.Nodup := by + apply List.Nodup.of_map Prod.fst + rw [immPaths_labels n hn p hp] + exact List.nodup_finRange n + +/-- The operator expansion indexed by the finite type of paths. -/ +theorem mixedOperator_imm_eq_sum_paths_fin (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) : + mixedOperator (K := K) isV (imm K n) = + ∑ p : Fin (immPaths n hn).length, + (((immPaths n hn).get p).map (variableOperator (K := K) isV)).prod := by + rw [mixedOperator_imm_eq_sum_paths n hn isV] + symm + simpa only [List.get_eq_getElem] using + (Fin.sum_univ_fun_getElem (immPaths n hn) + (fun p => (p.map (variableOperator (K := K) isV)).prod)) + +/-- Applying the IMM operator is the sum of its individual path actions. -/ +theorem mixedOperator_imm_apply_eq_sum_paths (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (f : MvPolynomial (Fin n × Fin n × Fin n) K) : + mixedOperator isV (imm K n) f = + ∑ p : Fin (immPaths n hn).length, + ((((immPaths n hn).get p).map (variableOperator isV)).prod) f := by + rw [mixedOperator_imm_eq_sum_paths_fin n hn isV, LinearMap.sum_apply] + +/-- Coefficients of the IMM operator are finite sums of path coefficients. -/ +theorem coeff_mixedOperator_imm_eq_sum_paths (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (f : MvPolynomial (Fin n × Fin n × Fin n) K) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) : + (mixedOperator isV (imm K n) f).coeff d = + ∑ p : Fin (immPaths n hn).length, + (((((immPaths n hn).get p).map (variableOperator isV)).prod) f).coeff d := by + rw [mixedOperator_imm_apply_eq_sum_paths n hn isV f, coeff_sum] + +/-- Extend internal vertex choices by the two fixed endpoint vertices. -/ +def immInternalPathVertices (d : ℕ) (p : Fin d → Fin (d + 1)) : + Fin (d + 2) → Fin (d + 1) := + Fin.cons (α := fun _ => Fin (d + 1)) 0 (Fin.snoc p 0) + +/-- The edge list associated to the tuple of internal vertices. -/ +def immInternalPathEdges (d : ℕ) (p : Fin d → Fin (d + 1)) : + List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) := + List.ofFn fun t : Fin (d + 1) => + (t, Fin.cons (α := fun _ => Fin (d + 1)) 0 p t, + Fin.snoc (α := fun _ => Fin (d + 1)) p 0 t) + +@[simp] theorem immInternalPathVertices_start (d : ℕ) (p : Fin d → Fin (d + 1)) : + immInternalPathVertices d p 0 = 0 := by + simp [immInternalPathVertices] + +@[simp] theorem immInternalPathVertices_end (d : ℕ) (p : Fin d → Fin (d + 1)) : + immInternalPathVertices d p (Fin.last (d + 1)) = 0 := by + simp [immInternalPathVertices] + +@[simp] theorem immInternalPathVertices_castSucc (d : ℕ) + (p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : + immInternalPathVertices d p t.castSucc = + Fin.cons (α := fun _ => Fin (d + 1)) 0 p t := by + simp [immInternalPathVertices, Fin.cons_snoc_eq_snoc_cons] + +@[simp] theorem immInternalPathVertices_succ (d : ℕ) + (p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : + immInternalPathVertices d p t.succ = + Fin.snoc (α := fun _ => Fin (d + 1)) p 0 t := by + simp [immInternalPathVertices] + +/-- Extending by endpoints does not identify different internal paths. -/ +theorem immInternalPathVertices_injective (d : ℕ) : + Function.Injective (immInternalPathVertices d) := by + intro p q h + funext t + have hh := congrFun h t.castSucc.succ + simpa [immInternalPathVertices] using hh + +/-- The edge list has every layer as its first coordinate, exactly once. -/ +theorem immInternalPathEdges_labels (d : ℕ) (p : Fin d → Fin (d + 1)) : + (immInternalPathEdges d p).map Prod.fst = List.finRange (d + 1) := by + rw [immInternalPathEdges, List.map_ofFn] + exact List.ofFn_id _ + +/-- Internal-vertex edge lists have no repeated variable. -/ +theorem immInternalPathEdges_nodup (d : ℕ) (p : Fin d → Fin (d + 1)) : + (immInternalPathEdges d p).Nodup := by + apply List.Nodup.of_map Prod.fst + rw [immInternalPathEdges_labels] + exact List.nodup_finRange _ + +/-- The IMM expansion using the canonical tuple of internal vertices. -/ +theorem imm_succ_eq_sum_internal_paths (d : ℕ) : + imm K (d + 1) = ∑ p : Fin d → Fin (d + 1), + ((immInternalPathEdges d p).map (X (R := K))).prod := by + simp only [imm, Nat.succ_pos, dite_eq_left] + rw [matrix_ofFn_prod_eq_sum_paths] + simp [immInternalPathEdges, List.map_ofFn, Function.comp_def, immLayer] + +/-- The actual IMM operator as a sum over internal vertex tuples. -/ +theorem mixedOperator_imm_succ_eq_sum_internal_paths (d : ℕ) + (isV : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → Bool) : + mixedOperator (K := K) isV (imm K (d + 1)) = + ∑ p : Fin d → Fin (d + 1), + ((immInternalPathEdges d p).map (variableOperator (K := K) isV)).prod := by + rw [imm_succ_eq_sum_internal_paths d, map_sum] + apply Finset.sum_congr rfl + intro p hp + simp only [map_list_prod, List.map_map, Function.comp_def, mixedOperator_X] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmPairingCompatibility.lean b/lean/OAI/Algebra/DepthFive/ImmPairingCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8394c2355c69ab6767280661ce859009893e2ea --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmPairingCompatibility.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.DepthFive.ImmPathCompatibility +import OAI.Algebra.DepthFive.SecondMomentPairing + +namespace OAI + +noncomputable section + +namespace Problem335 + +/-- Closing the four internal IMM paths gives the canonical endpoint-fixed labels. -/ +theorem closePaths_immInternalPathVertices (d : ℕ) + (p q r s : Fin d → Fin (d + 1)) (t : Fin (d + 2)) : + Pairings.closePaths 0 (fun i => ⟨p i, q i, r i, s i⟩) t = + (⟨immInternalPathVertices d p t, immInternalPathVertices d q t, + immInternalPathVertices d r t, immInternalPathVertices d s t⟩ : + Pairings.Labels (Fin (d + 1))) := by + refine Fin.cases ?_ (fun i => ?_) t + · rfl + · refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [Fin.succ_last, Pairings.closePaths_last, immInternalPathVertices_end] + rfl + · simp [Pairings.closePaths, immInternalPathVertices] + +/-- Layer labels used in the relaxed pairing sum are the actual four IMM coordinates. -/ +theorem layerLabels_immInternalCoordinate (d : ℕ) + (p q r s : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : + MomentPairing.layerLabels 0 (fun i => ⟨p i, q i, r i, s i⟩) t = + (⟨immInternalCoordinate d p t, immInternalCoordinate d q t, + immInternalCoordinate d r t, immInternalCoordinate d s t⟩ : + Pairings.Labels (Fin (d + 1) × Fin (d + 1))) := by + simp only [MomentPairing.layerLabels, closePaths_immInternalPathVertices] + rfl + +/-- The actual four-path shift constraint is exactly the compatibility predicate +used by the weighted exact-to-relaxed pairing inequality. -/ +theorem immInternalPath_shift_sub_eq_iff_compatible (d : ℕ) + (side : Fin (d + 1) → Bool) (p q r s : Fin d → Fin (d + 1)) : + occupationShift (fun e => side e.1) (immInternalPathEdges d p) - + occupationShift (fun e => side e.1) (immInternalPathEdges d q) = + occupationShift (fun e => side e.1) (immInternalPathEdges d r) - + occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔ + MomentPairing.Compatible 0 (fun i => ⟨p i, q i, r i, s i⟩) := by + rw [immInternalPath_shift_sub_eq_iff] + simp only [MomentPairing.Compatible, layerLabels_immInternalCoordinate] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmPairingReindex.lean b/lean/OAI/Algebra/DepthFive/ImmPairingReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..62c82f784da47315754a2e3349e487c0e4af2773 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmPairingReindex.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.DepthFive.MatrixPathPairings +import OAI.Algebra.DepthFive.ImmPairingCompatibility + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Problem335 + +/-- Filtered four-path IMM sums are exactly the compatible internal-label sums. -/ +theorem sum_four_immPaths_compatible_eq {A : Type*} [AddCommMonoid A] (d : ℕ) + (side : Fin (d + 1) → Bool) + (f : List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → + List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → + List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → + List (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) → A) : + let paths := immPaths (d + 1) (Nat.succ_pos d) + (∑ p : Fin paths.length, ∑ q : Fin paths.length, + ∑ r : Fin paths.length, ∑ s : Fin paths.length, + let P := paths.get p + let Q := paths.get q + let R := paths.get r + let S := paths.get s + if occupationShift (fun e => side e.1) P - occupationShift (fun e => side e.1) Q = + occupationShift (fun e => side e.1) R - occupationShift (fun e => side e.1) S + then f P Q R S else 0) = + ∑ x : {x : Fin d → Pairings.Labels (Fin (d + 1)) // MomentPairing.Compatible 0 x}, + f (immInternalPathEdges d (fun t => (x.1 t).p)) + (immInternalPathEdges d (fun t => (x.1 t).q)) + (immInternalPathEdges d (fun t => (x.1 t).r)) + (immInternalPathEdges d (fun t => (x.1 t).s)) := by + classical + dsimp only + have hp : immPaths (d + 1) (Nat.succ_pos d) = + matrixEntryPaths (List.ofFn (id : Fin (d + 1) → Fin (d + 1))) 0 0 := by + rw [List.ofFn_id] + rfl + rw [hp] + rw [Pairings.sum_four_matrixEntryPaths_eq d (id : Fin (d + 1) → Fin (d + 1)) 0 + (fun P Q R S => if occupationShift (fun e => side e.1) P - + occupationShift (fun e => side e.1) Q = + occupationShift (fun e => side e.1) R - occupationShift (fun e => side e.1) S + then f P Q R S else 0)] + change (∑ x : Fin d → Pairings.Labels (Fin (d + 1)), + if occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).p)) - + occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).q)) = + occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).r)) - + occupationShift (fun e => side e.1) (immInternalPathEdges d (fun t => (x t).s)) + then f (immInternalPathEdges d (fun t => (x t).p)) + (immInternalPathEdges d (fun t => (x t).q)) + (immInternalPathEdges d (fun t => (x t).r)) + (immInternalPathEdges d (fun t => (x t).s)) else 0) = _ + simp only [immInternalPath_shift_sub_eq_iff_compatible] + rw [← Finset.sum_filter] + exact Finset.sum_subtype _ (by simp) _ + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmPathCompatibility.lean b/lean/OAI/Algebra/DepthFive/ImmPathCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec67578b20cd78139966579957992c830b4a432a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmPathCompatibility.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.DepthFive.ImmPathShifts +import OAI.Algebra.DepthFive.Pairings + +namespace OAI + +noncomputable section + +namespace Problem335 + +/-- The coordinate in one layer of a genuine endpoint-fixed internal path. -/ +def immInternalCoordinate (d : ℕ) (p : Fin d → Fin (d + 1)) + (t : Fin (d + 1)) : Fin (d + 1) × Fin (d + 1) := + (immInternalPathVertices d p t.castSucc, immInternalPathVertices d p t.succ) + +/-- Four genuine IMM path shifts are compatible exactly when their coordinate +vectors are compatible separately in each layer. -/ +theorem immInternalPath_shift_sub_eq_iff (d : ℕ) (side : Fin (d + 1) → Bool) + (p q r s : Fin d → Fin (d + 1)) : + occupationShift (fun e => side e.1) (immInternalPathEdges d p) - + occupationShift (fun e => side e.1) (immInternalPathEdges d q) = + occupationShift (fun e => side e.1) (immInternalPathEdges d r) - + occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔ + ∀ t, Finsupp.single (immInternalCoordinate d p t) (1 : ℤ) - + Finsupp.single (immInternalCoordinate d q t) 1 = + Finsupp.single (immInternalCoordinate d r t) 1 - + Finsupp.single (immInternalCoordinate d s t) 1 := by + simp only [occupationShift_immInternalPathEdges] + exact pathShift_sub_eq_iff _ (fun t => by cases side t <;> norm_num) _ _ _ _ + +/-- The exact normal/diagonal pairing alternative for genuine IMM paths. +The all-equal case is assigned only to the normal alternative. -/ +theorem immInternalPath_shift_sub_eq_iff_pairings (d : ℕ) + (side : Fin (d + 1) → Bool) (p q r s : Fin d → Fin (d + 1)) : + occupationShift (fun e => side e.1) (immInternalPathEdges d p) - + occupationShift (fun e => side e.1) (immInternalPathEdges d q) = + occupationShift (fun e => side e.1) (immInternalPathEdges d r) - + occupationShift (fun e => side e.1) (immInternalPathEdges d s) ↔ + ∀ t, + (immInternalCoordinate d p t = immInternalCoordinate d q t ∧ + immInternalCoordinate d r t = immInternalCoordinate d s t) ∨ + (immInternalCoordinate d p t = immInternalCoordinate d r t ∧ + immInternalCoordinate d q t = immInternalCoordinate d s t ∧ + immInternalCoordinate d p t ≠ immInternalCoordinate d q t) := by + rw [immInternalPath_shift_sub_eq_iff] + exact forall_congr' fun t => Pairings.coordinate_difference_eq_iff_exclusive _ _ _ _ + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmPathShifts.lean b/lean/OAI/Algebra/DepthFive/ImmPathShifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..51810277608b8b7631205d29c7090d16a64dc899 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmPathShifts.lean @@ -0,0 +1,73 @@ +import OAI.Algebra.DepthFive.ImmOperatorPaths +import OAI.Algebra.DepthFive.FockPaths +import OAI.Algebra.DepthFive.PathShifts + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- The signed creation/annihilation shift of the actual IMM edge list is +exactly the layered vertex-path shift. -/ +theorem occupationShift_immInternalPathEdges (d : ℕ) (side : Fin (d + 1) → Bool) + (p : Fin d → Fin (d + 1)) : + occupationShift (fun e => side e.1) (immInternalPathEdges d p) = + pathShift (fun t => if side t then (-1 : ℤ) else 1) + (immInternalPathVertices d p) := by + simp only [occupationShift, immInternalPathEdges, List.map_ofFn, + List.sum_ofFn, Function.comp_def, pathShift, + immInternalPathVertices_castSucc, immInternalPathVertices_succ] + +/-- Different IMM paths have different signed occupation shifts. -/ +theorem occupationShift_immInternalPathEdges_injective (d : ℕ) + (side : Fin (d + 1) → Bool) : + Function.Injective (fun p : Fin d → Fin (d + 1) => + occupationShift (fun e => side e.1) (immInternalPathEdges d p)) := by + intro p q hpq + dsimp only at hpq + rw [occupationShift_immInternalPathEdges, occupationShift_immInternalPathEdges] at hpq + apply immInternalPathVertices_injective d + apply pathShift_injective (Nat.succ_pos d) _ (fun t => ?_) hpq + cases side t <;> norm_num + +/-- Nonzero normalized IMM path actions cannot collide at a natural occupation. -/ +theorem immInternalPath_target_injective_of_amplitudes_ne_zero (d : ℕ) + (side : Fin (d + 1) → Bool) + (M : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →₀ ℕ) + (p q : Fin d → Fin (d + 1)) + (hp : ((immInternalPathEdges d p).map + (occupationAmplitude (fun e => side e.1) M)).prod ≠ 0) + (hq : ((immInternalPathEdges d q).map + (occupationAmplitude (fun e => side e.1) M)).prod ≠ 0) + (heq : pathOccupation (fun e => side e.1) (immInternalPathEdges d p) M = + pathOccupation (fun e => side e.1) (immInternalPathEdges d q) M) : p = q := by + apply occupationShift_immInternalPathEdges_injective d side + apply add_left_cancel (a := signedOccupation M) + rw [← signedOccupation_path_of_amplitude_ne_zero _ _ + (immInternalPathEdges_nodup d p) M hp, + ← signedOccupation_path_of_amplitude_ne_zero _ _ + (immInternalPathEdges_nodup d q) M hq, heq] + +/-- The collision-zero hypothesis of the first-trace expansion for genuine IMM paths. -/ +theorem immInternalPath_collision_zero (d : ℕ) (side : Fin (d + 1) → Bool) + (M : (Fin (d + 1) × Fin (d + 1) × Fin (d + 1)) →₀ ℕ) + (p q : Fin d → Fin (d + 1)) (hpq : p ≠ q) + (heq : pathOccupation (fun e => side e.1) (immInternalPathEdges d p) M = + pathOccupation (fun e => side e.1) (immInternalPathEdges d q) M) : + ((immInternalPathEdges d p).map (occupationAmplitude (fun e => side e.1) M)).prod * + ((immInternalPathEdges d q).map (occupationAmplitude (fun e => side e.1) M)).prod = 0 := by + by_cases hp : ((immInternalPathEdges d p).map + (occupationAmplitude (fun e => side e.1) M)).prod = 0 + · simp [hp] + by_cases hq : ((immInternalPathEdges d q).map + (occupationAmplitude (fun e => side e.1) M)).prod = 0 + · simp [hq] + exact (hpq (immInternalPath_target_injective_of_amplitudes_ne_zero d side M p q hp hq heq)).elim + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmProfileCompatibility.lean b/lean/OAI/Algebra/DepthFive/ImmProfileCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..97d702be4c6adf3175fb20b319e32e37f77d51d7 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmProfileCompatibility.lean @@ -0,0 +1,38 @@ +import OAI.Algebra.DepthFive.PathInjectivity +import OAI.Algebra.DepthFive.ImmPairingCompatibility + +namespace OAI + +noncomputable section +namespace Problem335 + +/-- The list-based layer profile of an actual internal IMM path is its vertex coordinate. -/ +@[simp] theorem edgeProfile_immInternalPathEdges (d : ℕ) + (p : Fin d → Fin (d + 1)) (t : Fin (d + 1)) : + edgeProfile (immInternalPathEdges d p) (immInternalPathEdges_labels d p) t = + immInternalCoordinate d p t := by + simp only [edgeProfile, immInternalPathEdges, List.getElem_ofFn, + immInternalCoordinate, immInternalPathVertices_castSucc, immInternalPathVertices_succ] + +/-- All four list profiles agree with the layer labels defining pairing weights. -/ +theorem layerLabels_eq_immPathProfiles (d : ℕ) + (x : Fin d → Pairings.Labels (Fin (d + 1))) (t : Fin (d + 1)) : + MomentPairing.layerLabels 0 x t = + (⟨edgeProfile (immInternalPathEdges d (fun i => (x i).p)) + (immInternalPathEdges_labels d _) t, + edgeProfile (immInternalPathEdges d (fun i => (x i).q)) + (immInternalPathEdges_labels d _) t, + edgeProfile (immInternalPathEdges d (fun i => (x i).r)) + (immInternalPathEdges_labels d _) t, + edgeProfile (immInternalPathEdges d (fun i => (x i).s)) + (immInternalPathEdges_labels d _) t⟩ : + Pairings.Labels (Fin (d + 1) × Fin (d + 1))) := by + simpa only [edgeProfile_immInternalPathEdges] using + layerLabels_immInternalCoordinate d (fun i => (x i).p) (fun i => (x i).q) + (fun i => (x i).r) (fun i => (x i).s) t + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmSecondLocalBound.lean b/lean/OAI/Algebra/DepthFive/ImmSecondLocalBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..98cc1585551f5d59697fead0bcd38132be4d2100 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmSecondLocalBound.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.DepthFive.ImmSecondTrace +import OAI.Algebra.DepthFive.FockLayerProfile + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- The actual finite normalized IMM second trace is bounded by the sum +of the compatible local occupation-polynomial products. This has no +source-validity, moment, or nonempty-index assumptions. -/ +theorem immNormalizedMatrix_second_trace_le_localPolynomial_sum + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : + let A := immNormalizedMatrix n side a b + let eps := immPathSignedShift n hn (fun x => side x.1) + ((A.conjTranspose * A) ^ 2).trace.re ≤ + ∑ d : ImmSourceIndex n side a b, ∑ p, ∑ q, ∑ r, ∑ s, + if eps p - eps q = eps r - eps s then + ∏ t : Fin n, LocalMoments.localPolynomial (side t) (fun x => d.1 (t, x)) + (FockLayerProfile.immProfile n hn p t) + (FockLayerProfile.immProfile n hn q t) + (FockLayerProfile.immProfile n hn r t) + else 0 := by + classical + dsimp only + rw [immNormalizedMatrix_second_trace n hn side a b] + apply Finset.sum_le_sum + intro d hd + apply Finset.sum_le_sum + intro p hp + apply Finset.sum_le_sum + intro q hq + apply Finset.sum_le_sum + intro r hr + apply Finset.sum_le_sum + intro s hs + split_ifs with hmatch + · exact FockLayerProfile.imm_zeroExtended_amplitude_four_le_local_product + n hn side (fun d : ImmSourceIndex n side a b => d.1) + Subtype.val_injective d p q r s hmatch + · exact le_rfl + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmSecondMomentParameters.lean b/lean/OAI/Algebra/DepthFive/ImmSecondMomentParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfd39880ace9fdd94b3c499d53c204f9047cf7ac --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmSecondMomentParameters.lean @@ -0,0 +1,79 @@ +import OAI.Algebra.DepthFive.ImmCompatibleTrace +import OAI.Algebra.DepthFive.BidegreeLocalProductAverage +import OAI.Algebra.DepthFive.PairingAverageCardinality +import OAI.Algebra.DepthFive.PairingOccupationAverage + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +open Pairings MomentPairing + +private theorem source_bound + (L : ℕ) (side : Fin (L + 1) → Bool) + [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // side x.1 = true}] + [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // ¬ side x.1 = true}] + (a b : ℕ) (ha : 0 < a) : + (∑ M : ImmSourceIndex (L + 1) side a b, + ∑ x : {x : Fin L → Labels (Fin (L + 1)) // Compatible 0 x}, + ∏ t : Fin (L + 1), LocalMoments.localPolynomial (side t) + (fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x.1 t).p + (MomentPairing.layerLabels 0 x.1 t).q (MomentPairing.layerLabels 0 x.1 t).r) ≤ + (Fintype.card (ImmSourceIndex (L + 1) side a b) : ℝ) * + pathMean side (layerMeanV (Fin (L + 1)) side a) + (layerMeanU (Fin (L + 1)) side b) ^ 2 * + ∑ τ : Fin (L + 1) → Kind, + ∑ x : RelaxedPaths (Fin (L + 1)) 0 τ, + pathWeight side + (layerMeanV (Fin (L + 1)) side a / + (layerMeanV (Fin (L + 1)) side a + 1)) + (layerMeanU (Fin (L + 1)) side b / + (layerMeanU (Fin (L + 1)) side b + 1)) 0 τ x.1 := by + classical + have hA : 0 < layerMeanV (Fin (L + 1)) side a := by + unfold layerMeanV + exact div_pos (by exact_mod_cast ha) (by exact_mod_cast Fintype.card_pos) + have hB : 0 ≤ layerMeanU (Fin (L + 1)) side b := by + unfold layerMeanU + positivity + apply sum_sources_local_moments_le_of_average + (ι := ImmSourceIndex (L + 1) side a b) (γ := Fin (L + 1)) (L := L) side hA hB 0 + (fun M : ImmSourceIndex (L + 1) side a b => fun x => + ∏ t : Fin (L + 1), LocalMoments.localPolynomial (side t) + (fun y => M.1 (t, y)) (MomentPairing.layerLabels 0 x t).p + (MomentPairing.layerLabels 0 x t).q (MomentPairing.layerLabels 0 x t).r) + intro x _ + simpa only [layerMeanV, layerMeanU] using + LocalMoments.bidegree_average_layered_localProduct_le side a b Finset.univ + (fun t => (MomentPairing.layerLabels 0 x t).p) (fun t => (MomentPairing.layerLabels 0 x t).q) + (fun t => (MomentPairing.layerLabels 0 x t).r) + +/-- The actual finite IMM second trace is bounded by the relaxed pairing sum, +with precisely one source dimension and the square of the path mean. -/ +theorem immNormalizedMatrix_second_moment_le_relaxed + (L : ℕ) (side : Fin (L + 1) → Bool) + [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // side x.1 = true}] + [Nonempty {x : Fin (L + 1) × (Fin (L + 1) × Fin (L + 1)) // ¬ side x.1 = true}] + (a b : ℕ) (ha : 0 < a) : + let A := immNormalizedMatrix (L + 1) side a b + ((A.conjTranspose * A) ^ 2).trace.re ≤ + (Fintype.card (ImmSourceIndex (L + 1) side a b) : ℝ) * + pathMean side (layerMeanV (Fin (L + 1)) side a) + (layerMeanU (Fin (L + 1)) side b) ^ 2 * + ∑ τ : Fin (L + 1) → Kind, + ∑ x : RelaxedPaths (Fin (L + 1)) 0 τ, + pathWeight side + (layerMeanV (Fin (L + 1)) side a / + (layerMeanV (Fin (L + 1)) side a + 1)) + (layerMeanU (Fin (L + 1)) side b / + (layerMeanU (Fin (L + 1)) side b + 1)) 0 τ x.1 := by + exact (immNormalizedMatrix_second_trace_le_compatible L side a b).trans + (source_bound L side a b ha) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ImmSecondTrace.lean b/lean/OAI/Algebra/DepthFive/ImmSecondTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d3270c32bf5ea9c16cb3eed693abc6fa48fcf0c --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ImmSecondTrace.lean @@ -0,0 +1,184 @@ +import OAI.Algebra.DepthFive.ImmFiniteMatrix +import OAI.Algebra.DepthFive.FourPathTrace + +namespace OAI + +/-! The second trace identity for the actual IMM operator in normalized +monomial coordinates. Invalid path actions have zero amplitude, so their +chosen finite target index does not enter the trace. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- The signed exponent displacement of an actual IMM path. -/ +def immPathSignedShift (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (p : Fin (immPaths n hn).length) : (Fin n × Fin n × Fin n) →₀ ℤ := + occupationShift isV ((immPaths n hn).get p) + +/-- Every nonzero actual path action has its prescribed signed displacement. -/ +theorem signedOccupation_immPathOccupation (n : ℕ) (hn : 0 < n) + (isV : (Fin n × Fin n × Fin n) → Bool) + (d : (Fin n × Fin n × Fin n) →₀ ℕ) (p : Fin (immPaths n hn).length) + (hamp : immPathAmplitude n hn isV d p ≠ 0) : + signedOccupation (immPathOccupation n hn isV d p) = + signedOccupation d + immPathSignedShift n hn isV p := by + exact signedOccupation_path_of_amplitude_ne_zero isV ((immPaths n hn).get p) + (immPaths_nodup n hn _ (List.get_mem _ p)) d hamp + +/-- A finite submatrix of the genuine normalized IMM operator. -/ +def immCoefficientMatrix {I J : Type*} (n : ℕ) + (isV : (Fin n × Fin n × Fin n) → Bool) + (source : I → (Fin n × Fin n × Fin n) →₀ ℕ) + (target : J → (Fin n × Fin n × Fin n) →₀ ℕ) : Matrix J I ℂ := + fun j i => complexFockBasis.repr + (mixedOperator isV (imm ℂ n) (complexFockMonomial (source i))) (target j) + +/-- The finite normalized coefficient matrix is the actual weighted path matrix +whenever all nonzero path actions are represented in its target coordinates. -/ +theorem immCoefficientMatrix_eq_pathShiftMatrix {I J : Type*} + [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] + (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) + (source : I → (Fin n × Fin n × Fin n) →₀ ℕ) + (target : J → (Fin n × Fin n × Fin n) →₀ ℕ) + (htarget : Function.Injective target) + (shift : I → Fin (immPaths n hn).length → J) + (hshift : ∀ i p, immPathAmplitude n hn isV (source i) p ≠ 0 → + target (shift i p) = immPathOccupation n hn isV (source i) p) : + immCoefficientMatrix n isV source target = + pathShiftMatrix shift (fun i p => (immPathAmplitude n hn isV (source i) p : ℂ)) := by + classical + ext j i + change complexFockBasis.repr + (mixedOperator isV (imm ℂ n) (complexFockMonomial (source i))) (target j) = _ + rw [complexFockBasis_repr_mixedOperator_imm n hn isV] + unfold pathShiftMatrix + apply Finset.sum_congr rfl + intro p hp + by_cases hz : immPathAmplitude n hn isV (source i) p = 0 + · simp [hz] + · simp only [← hshift i p hz, htarget.eq_iff] + +/-- Source-eliminated second trace for the genuine finite IMM coefficient +matrix. The only coordinate hypothesis says that nonzero path actions stay +in the chosen target basis; no trace or moment formula is assumed. -/ +theorem immCoefficientMatrix_second_trace {I J : Type*} + [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] + (n : ℕ) (hn : 0 < n) (isV : (Fin n × Fin n × Fin n) → Bool) + (source : I → (Fin n × Fin n × Fin n) →₀ ℕ) + (hsource : Function.Injective source) + (target : J → (Fin n × Fin n × Fin n) →₀ ℕ) + (htarget : Function.Injective target) + (shift : I → Fin (immPaths n hn).length → J) + (hshift : ∀ i p, immPathAmplitude n hn isV (source i) p ≠ 0 → + target (shift i p) = immPathOccupation n hn isV (source i) p) : + let A := immCoefficientMatrix n isV source target + let occupation := fun i => signedOccupation (source i) + let eps := immPathSignedShift n hn isV + let weight := fun i p => immPathAmplitude n hn isV (source i) p + ((A.conjTranspose * A) ^ 2).trace.re = + ∑ i, ∑ p, ∑ q, ∑ r, ∑ s, + if eps p - eps q = eps r - eps s then + weight i p * Function.extend occupation (fun k => weight k q) (fun _ => 0) + (occupation i + eps p - eps q) * weight i r * + Function.extend occupation (fun k => weight k s) (fun _ => 0) + (occupation i + eps p - eps q) else 0 := by + classical + dsimp only + rw [immCoefficientMatrix_eq_pathShiftMatrix n hn isV source target htarget shift hshift] + apply complex_path_second_trace_eliminate_source + (fun i => signedOccupation (source i)) (signedOccupation_injective.comp hsource) + (fun j => signedOccupation (target j)) (signedOccupation_injective.comp htarget) + intro i p hp + rw [hshift i p hp] + exact signedOccupation_immPathOccupation n hn isV (source i) p hp + +/-- A finite target index for each path. The fallback is used only for a +zero-amplitude path, and is therefore invisible in the operator matrix. -/ +def immFinitePathShift (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) + (e0 : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b) + (p : Fin (immPaths n hn).length) : ImmTargetIndex n side a b := by + classical + exact if h : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0 then + ⟨immPathOccupation n hn (fun x => side x.1) d.1 p, + immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p h⟩ + else e0 + +theorem immFinitePathShift_val_of_amplitude_ne_zero + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) + (e0 : ImmTargetIndex n side a b) (d : ImmSourceIndex n side a b) + (p : Fin (immPaths n hn).length) + (hp : immPathAmplitude n hn (fun x => side x.1) d.1 p ≠ 0) : + (immFinitePathShift n hn side a b e0 d p).1 = + immPathOccupation n hn (fun x => side x.1) d.1 p := by + simp only [immFinitePathShift, dite_eq_left hp] + +/-- The finite normalized operator matrix is the indicated submatrix of its +ambient normalized monomial coefficients. -/ +theorem immNormalizedMatrix_eq_immCoefficientMatrix + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : + immNormalizedMatrix n side a b = + immCoefficientMatrix n (fun x => side x.1) + (fun d : ImmSourceIndex n side a b => d.1) + (fun e : ImmTargetIndex n side a b => e.1) := by + classical + ext e d + rw [immNormalizedMatrix_apply n hn side a b] + exact (complexFockBasis_repr_mixedOperator_imm n hn (fun x => side x.1) d.1 e.1).symm + +/-- The actual finite IMM matrix has a weighted finite-path representation. -/ +theorem immNormalizedMatrix_eq_pathShiftMatrix_of_fallback + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) + (e0 : ImmTargetIndex n side a b) : + immNormalizedMatrix n side a b = + pathShiftMatrix (immFinitePathShift n hn side a b e0) + (fun d p => (immPathAmplitude n hn (fun x => side x.1) d.1 p : ℂ)) := by + classical + rw [immNormalizedMatrix_eq_immCoefficientMatrix n hn side a b] + exact immCoefficientMatrix_eq_pathShiftMatrix n hn (fun x => side x.1) + _ _ Subtype.val_injective _ + (immFinitePathShift_val_of_amplitude_ne_zero n hn side a b e0) + +/-- Exact source-eliminated second trace of the genuine finite IMM operator. +This includes an empty target space: then every path amplitude vanishes. +There are no trace, closure, or nonempty-index assumptions in the statement. -/ +theorem immNormalizedMatrix_second_trace + (n : ℕ) (hn : 0 < n) (side : Fin n → Bool) (a b : ℕ) : + let A := immNormalizedMatrix n side a b + let occupation := fun d : ImmSourceIndex n side a b => signedOccupation d.1 + let eps := immPathSignedShift n hn (fun x => side x.1) + let weight := fun (d : ImmSourceIndex n side a b) p => + immPathAmplitude n hn (fun x => side x.1) d.1 p + ((A.conjTranspose * A) ^ 2).trace.re = + ∑ d, ∑ p, ∑ q, ∑ r, ∑ s, + if eps p - eps q = eps r - eps s then + weight d p * Function.extend occupation (fun k => weight k q) (fun _ => 0) + (occupation d + eps p - eps q) * weight d r * + Function.extend occupation (fun k => weight k s) (fun _ => 0) + (occupation d + eps p - eps q) else 0 := by + classical + rcases isEmpty_or_nonempty (ImmTargetIndex n side a b) with h | h + · let := h + have hA : immNormalizedMatrix n side a b = 0 := Subsingleton.elim _ _ + have hz (d : ImmSourceIndex n side a b) (p : Fin (immPaths n hn).length) : + immPathAmplitude n hn (fun x => side x.1) d.1 p = 0 := by + by_contra hp + exact isEmptyElim (⟨immPathOccupation n hn (fun x => side x.1) d.1 p, + immPathOccupation_bidegree_of_amplitude_ne_zero n hn side a b d.1 d.2 p hp⟩ : + ImmTargetIndex n side a b) + simp [hA, hz] + · obtain ⟨e0⟩ := h + dsimp only + rw [immNormalizedMatrix_eq_immCoefficientMatrix n hn side a b] + exact immCoefficientMatrix_second_trace n hn (fun x => side x.1) + _ Subtype.val_injective _ Subtype.val_injective + (immFinitePathShift n hn side a b e0) + (immFinitePathShift_val_of_amplitude_ne_zero n hn side a b e0) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IndependentCoordinates.lean b/lean/OAI/Algebra/DepthFive/IndependentCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..03b6f2705784481394f42399aecad887e06a7d8c --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IndependentCoordinates.lean @@ -0,0 +1,322 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +namespace IndependentCoordinates + +/-- The uniform average on a finite type, with value zero on an empty type. -/ +def average {α : Type*} [Fintype α] (f : α → ℝ) : ℝ := + (∑ x, f x) / Fintype.card α + + +/-- Uniform finite averages are unchanged by relabeling. -/ +theorem average_equiv {α β : Type*} [Fintype α] [Fintype β] + (e : α ≃ β) (f : β → ℝ) : average (fun x => f (e x)) = average f := by + simp only [average, e.sum_comp, Fintype.card_congr e] + +/-- Independent coordinates factor the average of a product. -/ +theorem average_prod {ι : Type*} [Fintype ι] [DecidableEq ι] {α : ι → Type*} + [∀ i, Fintype (α i)] (f : ∀ i, α i → ℝ) : + average (fun x : ∀ i, α i => ∏ i, f i (x i)) = ∏ i, average (f i) := by + classical + simp only [average, Fintype.card_pi, Nat.cast_prod, Finset.prod_div_distrib] + congr 1 + exact (Fintype.prod_sum f).symm + +/-- Reorganize coordinates into the fibers of a grouping function. -/ +def fiberAssignmentEquiv {σ ι α : Type*} (group : σ → ι) : + (σ → α) ≃ (∀ i, {s // group s = i} → α) := + (Equiv.piCongrLeft (fun _ : σ => α) (Equiv.sigmaFiberEquiv group)).symm.trans + (Equiv.piCurry (fun _ _ => α)) + +@[simp] theorem fiberAssignmentEquiv_apply {σ ι α : Type*} (group : σ → ι) + (x : σ → α) (i : ι) (s : {s // group s = i}) : + fiberAssignmentEquiv group x i s = x s := rfl + +/-- Factors on disjoint groups of coordinates have independent uniform averages. +An unused group can be included with its factor set equal to one. -/ +theorem average_grouped_prod {σ ι α : Type*} + [Fintype σ] [Fintype ι] [Fintype α] [DecidableEq σ] [DecidableEq ι] + (group : σ → ι) (f : ∀ i, ({s // group s = i} → α) → ℝ) : + average (fun x : σ → α => ∏ i, f i (fun s => x s)) = + ∏ i, average (f i) := by + calc + _ = average (fun x : ∀ i, ({s // group s = i} → α) => ∏ i, f i (x i)) := + average_equiv (fiberAssignmentEquiv group) _ + _ = _ := average_prod f + +/-- One independent pair of uniform labels agrees with probability `1 / card α`. -/ +theorem average_pair_eq {α : Type*} [Fintype α] [DecidableEq α] : + average (fun x : α × α => if x.1 = x.2 then (1 : ℝ) else 0) = + (Fintype.card α : ℝ)⁻¹ := by + rw [average, Fintype.sum_prod_type] + simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true, Finset.sum_const, + Finset.card_univ, nsmul_eq_mul, mul_one, Fintype.card_prod, Nat.cast_mul] + by_cases h : (Fintype.card α : ℝ) = 0 + · simp [h] + · field_simp + +theorem average_add {α : Type*} [Fintype α] (f g : α → ℝ) : + average (fun x => f x + g x) = average f + average g := by + simp [average, Finset.sum_add_distrib, add_div] + +theorem average_const {α : Type*} [Fintype α] [Nonempty α] (c : ℝ) : + average (fun _ : α => c) = c := by + simp [average, Fintype.card_ne_zero] + +theorem average_const_mul {α : Type*} [Fintype α] (c : ℝ) (f : α → ℝ) : + average (fun x => c * f x) = c * average f := by + simp [average, ← Finset.mul_sum, mul_div_assoc] + +/-- The indicator that two labels agree. -/ +def pairEq {α : Type*} [DecidableEq α] (x : α × α) : ℝ := + if x.1 = x.2 then 1 else 0 + +/-- Simultaneous agreement of `card κ` independent label pairs. -/ +def allPairsEq {κ α : Type*} [Fintype κ] [DecidableEq α] + (x : κ → α × α) : ℝ := ∏ i, pairEq (x i) + +theorem average_allPairsEq {κ α : Type*} [Fintype κ] [Fintype α] + [DecidableEq κ] [DecidableEq α] : + average (allPairsEq (κ := κ) (α := α)) = + (Fintype.card α : ℝ)⁻¹ ^ Fintype.card κ := by + rw [show allPairsEq (κ := κ) (α := α) = + (fun x : κ → α × α => ∏ i, pairEq (x i)) from rfl, average_prod] + simp only [Finset.prod_const, Finset.card_univ] + exact congrArg (fun z : ℝ => z ^ Fintype.card κ) (average_pair_eq (α := α)) + +theorem average_equality_correction {κ α : Type*} [Fintype κ] [Fintype α] + [DecidableEq κ] [DecidableEq α] [Nonempty α] (c : ℝ) : + average (fun x : κ → α × α => 1 + c * allPairsEq x) = + 1 + c * (Fintype.card α : ℝ)⁻¹ ^ Fintype.card κ := by + rw [average_add, average_const, average_const_mul, average_allPairsEq] + +/-- The precise independence identity used for nonadjacent derivative layers. +The fibers of `group` are the disjoint sets of free endpoints of those layers. -/ +theorem average_grouped_equality_corrections {σ ι α : Type*} + [Fintype σ] [Fintype ι] [Fintype α] + [DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α] + (group : σ → ι) (c : ι → ℝ) : + average (fun x : σ → α × α => + ∏ i, (1 + c i * allPairsEq (fun s : {s // group s = i} => x s))) = + ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ Fintype.card {s // group s = i}) := by + rw [average_grouped_prod group + (fun i x => 1 + c i * allPairsEq x)] + congr 1 + ext i + exact average_equality_correction (c i) + +/-- Coordinates assigned to `none` are unused and integrate out. -/ +theorem average_selected_grouped_prod {σ ι α : Type*} + [Fintype σ] [Fintype ι] [Fintype α] [Nonempty α] + [DecidableEq σ] [DecidableEq ι] + (group : σ → Option ι) + (f : ∀ i, ({s // group s = some i} → α) → ℝ) : + average (fun x : σ → α => ∏ i, f i (fun s => x s)) = + ∏ i, average (f i) := by + let F : ∀ o : Option ι, ({s // group s = o} → α) → ℝ := fun o => + match o with + | none => fun _ => 1 + | some i => f i + have h := average_grouped_prod group F + simpa only [Fintype.prod_option, F, one_mul, average_const] using h + +/-- Equality corrections for selected disjoint endpoint groups. Other vertices +may be assigned to `none`, and their choices do not affect the expectation. -/ +theorem average_selected_equality_corrections {σ ι α : Type*} + [Fintype σ] [Fintype ι] [Fintype α] + [DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α] + (group : σ → Option ι) (c : ι → ℝ) : + average (fun x : σ → α × α => + ∏ i, (1 + c i * allPairsEq (fun s : {s // group s = some i} => x s))) = + ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ + Fintype.card {s // group s = some i}) := by + rw [average_selected_grouped_prod group + (fun i x => 1 + c i * allPairsEq x)] + congr 1 + ext i + exact average_equality_correction (c i) + +/-- Extra independent coordinates that do not appear in the integrand cancel. -/ +theorem average_ignore_right {α β : Type*} [Fintype α] [Fintype β] + [Nonempty β] (f : α → ℝ) : + average (fun x : α × β => f x.1) = average f := by + rw [average, Fintype.sum_prod_type] + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, + ← Finset.mul_sum, Fintype.card_prod, Nat.cast_mul, average] + have hβ : (Fintype.card β : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + by_cases hα : (Fintype.card α : ℝ) = 0 + · simp [hα] + · field_simp + +/-- Split all assignments into their values on an embedded coordinate set and +on its complement. -/ +def restrictAssignmentEquiv {σ τ α : Type*} (j : τ → σ) + (hj : Function.Injective j) : + (σ → α) ≃ (τ → α) × ({s // s ∉ Set.range j} → α) := by + classical + let e : τ ⊕ {s // s ∉ Set.range j} ≃ σ := + ((Equiv.ofInjective j hj).sumCongr (Equiv.refl _)).trans + (Equiv.sumCompl (fun s => s ∈ Set.range j)) + exact (Equiv.piCongrLeft (fun _ : σ => α) e).symm.trans + (Equiv.sumPiEquivProdPi (fun _ => α)) + +@[simp] theorem restrictAssignmentEquiv_fst {σ τ α : Type*} (j : τ → σ) + (hj : Function.Injective j) (x : σ → α) (t : τ) : + (restrictAssignmentEquiv j hj x).1 t = x (j t) := rfl + +/-- Uniform assignments restrict uniformly to any subset of coordinates. -/ +theorem average_precomp_injective {σ τ α : Type*} + [Fintype σ] [Fintype τ] [Fintype α] [Nonempty α] + [DecidableEq σ] [DecidableEq τ] + (j : τ → σ) (hj : Function.Injective j) (f : (τ → α) → ℝ) : + average (fun x : σ → α => f (fun t => x (j t))) = average f := by + classical + calc + _ = average (fun x : (τ → α) × ({s // s ∉ Set.range j} → α) => f x.1) := + average_equiv (restrictAssignmentEquiv j hj) _ + _ = _ := average_ignore_right f + +/-- A sigma-indexed family of labels is the product of its fiber families. -/ +theorem average_sigma_prod {ι α : Type*} {κ : ι → Type*} + [Fintype ι] [Fintype α] [∀ i, Fintype (κ i)] + [DecidableEq ι] [∀ i, DecidableEq (κ i)] + (f : ∀ i, (κ i → α) → ℝ) : + average (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) = + ∏ i, average (f i) := by + let e := Equiv.piCurry (α := ι) (β := κ) (fun _ _ => α) + have h := average_equiv e (fun x : ∀ i, κ i → α => ∏ i, f i (x i)) + change average (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) = _ at h + exact h.trans (average_prod f) + +/-- Finite factors on an injectively embedded disjoint family of coordinates +factor under uniform averaging. -/ +theorem average_embedded_prod {σ ι α : Type*} {κ : ι → Type*} + [Fintype σ] [Fintype ι] [Fintype α] [∀ i, Fintype (κ i)] [Nonempty α] + [DecidableEq σ] [DecidableEq ι] [∀ i, DecidableEq (κ i)] + (j : ∀ i, κ i → σ) (hj : Function.Injective (Sigma.uncurry j)) + (f : ∀ i, (κ i → α) → ℝ) : + average (fun x : σ → α => ∏ i, f i (fun t => x (j i t))) = + ∏ i, average (f i) := by + have h := average_precomp_injective (Sigma.uncurry j) hj + (fun x : (Σ i, κ i) → α => ∏ i, f i (fun t => x ⟨i, t⟩)) + exact h.trans (average_sigma_prod f) + +/-- Pairwise disjoint subsets give an injective family of coordinate inclusions. -/ +theorem sigma_val_injective {σ ι : Type*} (s : ι → Finset σ) + (hs : Pairwise (fun i j => Disjoint (s i) (s j))) : + Function.Injective (fun x : Σ i, s i => (x.2 : σ)) := by + rintro ⟨i, x⟩ ⟨j, y⟩ hxy + change (x : σ) = (y : σ) at hxy + have hij : i = j := by + by_contra hne + exact (Finset.disjoint_left.mp (hs hne)) x.property (hxy.symm ▸ y.property) + subst j + have h : x = y := Subtype.ext hxy + subst y + rfl + +/-- Factors depending on pairwise disjoint finite coordinate sets are independent. -/ +theorem average_disjoint_finset_prod {σ ι α : Type*} + [Fintype σ] [Fintype ι] [Fintype α] [Nonempty α] + [DecidableEq σ] [DecidableEq ι] + (s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) + (f : ∀ i, (s i → α) → ℝ) : + average (fun x : σ → α => ∏ i, f i (fun t => x t)) = + ∏ i, average (f i) := by + exact average_embedded_prod (fun i (t : s i) => (t : σ)) + (sigma_val_injective s hs) f + +/-- The endpoint-coincidence average for pairwise disjoint free-endpoint sets. -/ +theorem average_disjoint_equality_corrections {σ ι α : Type*} + [Fintype σ] [Fintype ι] [Fintype α] + [DecidableEq σ] [DecidableEq ι] [DecidableEq α] [Nonempty α] + (s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) + (c : ι → ℝ) : + average (fun x : σ → α × α => + ∏ i, (1 + c i * allPairsEq (fun t : s i => x t))) = + ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ (s i).card) := by + rw [average_disjoint_finset_prod s hs + (fun i x => 1 + c i * allPairsEq x)] + apply Finset.prod_congr rfl + intro i _ + simpa only [Fintype.card_coe] using + (average_equality_correction (κ := s i) (α := α) (c i)) + +/-- Dependent-coordinate version of restriction to an embedded coordinate set. -/ +def restrictDependentAssignmentEquiv {σ τ : Type*} (β : σ → Type*) + (j : τ → σ) (hj : Function.Injective j) : + (∀ s, β s) ≃ (∀ t, β (j t)) × (∀ s : {s // s ∉ Set.range j}, β s) := by + classical + let e : τ ⊕ {s // s ∉ Set.range j} ≃ σ := + ((Equiv.ofInjective j hj).sumCongr (Equiv.refl _)).trans + (Equiv.sumCompl (fun s => s ∈ Set.range j)) + exact (Equiv.piCongrLeft β e).symm.trans + (Equiv.sumPiEquivProdPi (fun z => β (e z))) + +@[simp] theorem restrictDependentAssignmentEquiv_fst {σ τ : Type*} + (β : σ → Type*) (j : τ → σ) (hj : Function.Injective j) + (x : ∀ s, β s) (t : τ) : + (restrictDependentAssignmentEquiv β j hj x).1 t = x (j t) := rfl + +/-- Marginals of a uniform finite product are uniform, allowing different +coordinate types at different vertices. -/ +theorem average_precomp_injective_dependent {σ τ : Type*} {β : σ → Type*} + [Fintype σ] [Fintype τ] [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)] + [DecidableEq σ] [DecidableEq τ] + (j : τ → σ) (hj : Function.Injective j) (f : (∀ t, β (j t)) → ℝ) : + average (fun x : ∀ s, β s => f (fun t => x (j t))) = average f := by + classical + calc + _ = average (fun x : (∀ t, β (j t)) × + (∀ s : {s // s ∉ Set.range j}, β s) => f x.1) := + average_equiv (restrictDependentAssignmentEquiv β j hj) _ + _ = _ := average_ignore_right f + +theorem average_sigma_prod_dependent {ι : Type*} {κ : ι → Type*} + {β : (Σ i, κ i) → Type*} + [Fintype ι] [∀ i, Fintype (κ i)] [∀ s, Fintype (β s)] + [DecidableEq ι] [∀ i, DecidableEq (κ i)] + (f : ∀ i, (∀ t : κ i, β ⟨i,t⟩) → ℝ) : + average (fun x : ∀ s, β s => ∏ i, f i (fun t => x ⟨i,t⟩)) = + ∏ i, average (f i) := by + let e := Equiv.piCurry (fun i (t : κ i) => β ⟨i,t⟩) + have h := average_equiv e (fun x : ∀ i, ∀ t : κ i, β ⟨i,t⟩ => ∏ i, f i (x i)) + change average (fun x : ∀ s, β s => ∏ i, f i (fun t => x ⟨i,t⟩)) = _ at h + exact h.trans (average_prod f) + +theorem average_embedded_prod_dependent {σ ι : Type*} {κ : ι → Type*} + {β : σ → Type*} + [Fintype σ] [Fintype ι] [∀ i, Fintype (κ i)] + [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)] + [DecidableEq σ] [DecidableEq ι] [∀ i, DecidableEq (κ i)] + (j : ∀ i, κ i → σ) (hj : Function.Injective (Sigma.uncurry j)) + (f : ∀ i, (∀ t : κ i, β (j i t)) → ℝ) : + average (fun x : ∀ s, β s => ∏ i, f i (fun t => x (j i t))) = + ∏ i, average (f i) := by + have h := average_precomp_injective_dependent (β := β) (Sigma.uncurry j) hj + (fun x : ∀ s : Σ i, κ i, β (j s.1 s.2) => ∏ i, f i (fun t => x ⟨i,t⟩)) + exact h.trans (average_sigma_prod_dependent + (β := fun s : Σ i, κ i => β (j s.1 s.2)) f) + +/-- Disjoint coordinate families remain independent when vertex alphabets vary. -/ +theorem average_disjoint_finset_prod_dependent {σ ι : Type*} {β : σ → Type*} + [Fintype σ] [Fintype ι] [∀ s, Fintype (β s)] [∀ s, Nonempty (β s)] + [DecidableEq σ] [DecidableEq ι] + (s : ι → Finset σ) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) + (f : ∀ i, (∀ t : s i, β t) → ℝ) : + average (fun x : ∀ s, β s => ∏ i, f i (fun t => x t)) = + ∏ i, average (f i) := by + exact average_embedded_prod_dependent (fun i (t : s i) => (t : σ)) + (sigma_val_injective s hs) f + +end IndependentCoordinates +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IndexedCircuit.lean b/lean/OAI/Algebra/DepthFive/IndexedCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e37eb6629037f974ac5c6c1a106253fcd9b4ff8 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IndexedCircuit.lean @@ -0,0 +1,99 @@ +import OAI.Algebra.DepthFive.Basic + +namespace OAI + +noncomputable section + +namespace Problem335 + +/-- A depth-five circuit whose gates are indexed by arbitrary finite types. +This representation is convenient for products, sums, and path-indexed gates; +`toDepth5Circuit` transports it to the qualified circuit representation. -/ +structure IndexedDepth5Circuit (K : Type*) [CommSemiring K] (n : ℕ) + (L B P M U : Type*) where + leaves : L → D5Leaf K n + bottomInputs : B → List (K × L) + bottomDegree : B → ℕ + bottomHomogeneous : + ∀ i entry, entry ∈ bottomInputs i → d5LeafDegree (leaves entry.2) = bottomDegree i + bottomEmpty : + ∀ i, bottomInputs i = [] → bottomDegree i = 0 + lowerInputs : P → List B + middleInputs : M → List (K × P) + middleDegree : M → ℕ + middleHomogeneous : + ∀ i entry, entry ∈ middleInputs i → + ((lowerInputs entry.2).map bottomDegree).sum = middleDegree i + middleEmpty : + ∀ i, middleInputs i = [] → middleDegree i = 0 + upperInputs : U → List M + outputInputs : List (K × U) + outputDegree : ℕ + outputHomogeneous : + ∀ entry, entry ∈ outputInputs → + ((upperInputs entry.2).map middleDegree).sum = outputDegree + outputEmpty : outputInputs = [] → outputDegree = 0 + +namespace IndexedDepth5Circuit + +variable {K : Type*} [CommSemiring K] {n : ℕ} +variable {L B P M U : Type*} +variable [Fintype L] [Fintype B] [Fintype P] [Fintype M] [Fintype U] + +/-- Relabel each finite gate type by `Fin` without changing any wire or degree. -/ +def toDepth5Circuit (c : IndexedDepth5Circuit K n L B P M U) : Depth5Circuit K n where + leafCount := Fintype.card L + leaves i := c.leaves ((Fintype.equivFin L).symm i) + bottomCount := Fintype.card B + bottomInputs i := (c.bottomInputs ((Fintype.equivFin B).symm i)).map + (fun e => (e.1, Fintype.equivFin L e.2)) + bottomDegree i := c.bottomDegree ((Fintype.equivFin B).symm i) + bottomHomogeneous := by + intro i entry h + obtain ⟨e, he, rfl⟩ := List.mem_map.mp h + simpa using c.bottomHomogeneous ((Fintype.equivFin B).symm i) e he + bottomEmpty := by + intro i h + exact c.bottomEmpty _ (List.map_eq_nil_iff.mp h) + lowerCount := Fintype.card P + lowerInputs i := (c.lowerInputs ((Fintype.equivFin P).symm i)).map (Fintype.equivFin B) + middleCount := Fintype.card M + middleInputs i := (c.middleInputs ((Fintype.equivFin M).symm i)).map + (fun e => (e.1, Fintype.equivFin P e.2)) + middleDegree i := c.middleDegree ((Fintype.equivFin M).symm i) + middleHomogeneous := by + intro i entry h + obtain ⟨e, he, rfl⟩ := List.mem_map.mp h + simpa [List.map_map, Function.comp_def] using + c.middleHomogeneous ((Fintype.equivFin M).symm i) e he + middleEmpty := by + intro i h + exact c.middleEmpty _ (List.map_eq_nil_iff.mp h) + upperCount := Fintype.card U + upperInputs i := (c.upperInputs ((Fintype.equivFin U).symm i)).map (Fintype.equivFin M) + outputInputs := c.outputInputs.map (fun e => (e.1, Fintype.equivFin U e.2)) + outputDegree := c.outputDegree + outputHomogeneous := by + intro entry h + obtain ⟨e, he, rfl⟩ := List.mem_map.mp h + simpa [List.map_map, Function.comp_def] using c.outputHomogeneous e he + outputEmpty := by + intro h + exact c.outputEmpty (List.map_eq_nil_iff.mp h) + +@[simp] theorem circuitSize_toDepth5Circuit + (c : IndexedDepth5Circuit K n L B P M U) : + circuitSize c.toDepth5Circuit = + Fintype.card L + Fintype.card B + Fintype.card P + + Fintype.card M + Fintype.card U + 1 := rfl + +@[simp] theorem outputDegree_toDepth5Circuit + (c : IndexedDepth5Circuit K n L B P M U) : + c.toDepth5Circuit.outputDegree = c.outputDegree := rfl + +end IndexedDepth5Circuit +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IndexedCircuitValue.lean b/lean/OAI/Algebra/DepthFive/IndexedCircuitValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..25da6689a8b5f2f5d0398ceb56fe09521a60e02b --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IndexedCircuitValue.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.DepthFive.IndexedCircuit + +namespace OAI + +noncomputable section + +namespace Problem335 +namespace IndexedDepth5Circuit + +variable {K : Type*} [CommSemiring K] {n : ℕ} +variable {L B P M U : Type*} + +/-- Value of a bottom gate before relabelling the gate types. -/ +def bottomValue (c : IndexedDepth5Circuit K n L B P M U) (i : B) : + MvPolynomial (Fin n × Fin n × Fin n) K := + ((c.bottomInputs i).map (fun entry => + MvPolynomial.C entry.1 * d5LeafValue (c.leaves entry.2))).sum + +/-- Value of a lower product gate before relabelling the gate types. -/ +def lowerValue (c : IndexedDepth5Circuit K n L B P M U) (i : P) : + MvPolynomial (Fin n × Fin n × Fin n) K := + ((c.lowerInputs i).map (fun j => bottomValue c j)).prod + +/-- Value of a middle sum gate before relabelling the gate types. -/ +def middleValue (c : IndexedDepth5Circuit K n L B P M U) (i : M) : + MvPolynomial (Fin n × Fin n × Fin n) K := + ((c.middleInputs i).map (fun entry => + MvPolynomial.C entry.1 * lowerValue c entry.2)).sum + +/-- Value of an upper product gate before relabelling the gate types. -/ +def upperValue (c : IndexedDepth5Circuit K n L B P M U) (i : U) : + MvPolynomial (Fin n × Fin n × Fin n) K := + ((c.upperInputs i).map (fun j => middleValue c j)).prod + +/-- Polynomial computed by a circuit indexed by arbitrary finite types. -/ +def circuitValue (c : IndexedDepth5Circuit K n L B P M U) : + MvPolynomial (Fin n × Fin n × Fin n) K := + (c.outputInputs.map (fun entry => + MvPolynomial.C entry.1 * upperValue c entry.2)).sum + +variable [Fintype L] [Fintype B] [Fintype P] [Fintype M] [Fintype U] + +@[simp] theorem bottomValue_toDepth5Circuit + (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card B)) : + Problem335.bottomValue c.toDepth5Circuit i = + c.bottomValue ((Fintype.equivFin B).symm i) := by + simp [Problem335.bottomValue, toDepth5Circuit, bottomValue, + List.map_map, Function.comp_def] + +@[simp] theorem lowerValue_toDepth5Circuit + (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card P)) : + Problem335.lowerValue c.toDepth5Circuit i = + c.lowerValue ((Fintype.equivFin P).symm i) := by + simp [Problem335.lowerValue, lowerValue, toDepth5Circuit, + List.map_map, Function.comp_def, Problem335.bottomValue, bottomValue] + +@[simp] theorem middleValue_toDepth5Circuit + (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card M)) : + Problem335.middleValue c.toDepth5Circuit i = + c.middleValue ((Fintype.equivFin M).symm i) := by + simp [Problem335.middleValue, middleValue, toDepth5Circuit, + List.map_map, Function.comp_def, Problem335.lowerValue, lowerValue, + Problem335.bottomValue, bottomValue] + +@[simp] theorem upperValue_toDepth5Circuit + (c : IndexedDepth5Circuit K n L B P M U) (i : Fin (Fintype.card U)) : + Problem335.upperValue c.toDepth5Circuit i = + c.upperValue ((Fintype.equivFin U).symm i) := by + simp [Problem335.upperValue, upperValue, toDepth5Circuit, + List.map_map, Function.comp_def, Problem335.middleValue, middleValue, + Problem335.lowerValue, lowerValue, Problem335.bottomValue, bottomValue] + +@[simp] theorem circuitValue_toDepth5Circuit + (c : IndexedDepth5Circuit K n L B P M U) : + Problem335.circuitValue c.toDepth5Circuit = c.circuitValue := by + simp [Problem335.circuitValue, circuitValue, toDepth5Circuit, + List.map_map, Function.comp_def, Problem335.upperValue, upperValue, + Problem335.middleValue, middleValue, Problem335.lowerValue, lowerValue, + Problem335.bottomValue, bottomValue] + +end IndexedDepth5Circuit +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/Infrastructure.lean b/lean/OAI/Algebra/DepthFive/Infrastructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..321c90da1ff97b625ce01c57fb3405afbedc150f --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/Infrastructure.lean @@ -0,0 +1,13 @@ +import OAI.Algebra.DepthFive.UpperConstruction +import OAI.Algebra.DepthFive.UpperBoundArithmetic +import OAI.Algebra.DepthFive.CharacteristicZeroTransfer +import OAI.Algebra.DepthFive.LowerInfrastructure +import OAI.Algebra.DepthFive.ParameterGrowth +import OAI.Algebra.DepthFive.ParameterCutoff +import OAI.Algebra.DepthFive.BetaRefinements +import OAI.Algebra.DepthFive.LowerMoments +import OAI.Algebra.DepthFive.LowerCircuit +import OAI.Algebra.DepthFive.WordInfrastructure +import OAI.Algebra.DepthFive.MomentAssemblyInterfaces + +/-! Circuit constructions, field transfer, and rank estimates. -/ diff --git a/lean/OAI/Algebra/DepthFive/IntegerRank.lean b/lean/OAI/Algebra/DepthFive/IntegerRank.lean new file mode 100644 index 0000000000000000000000000000000000000000..af1149cff4fc48793bc0a6d04c3e50ed3ce5b7e3 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IntegerRank.lean @@ -0,0 +1,89 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem335 + +open Module Submodule + +universe u v w x + +/-- Comparing all finite column families compares matrix ranks. -/ +theorem matrix_rank_le_of_independent_imp + {m : Type u} {n : Type v} [Fintype m] [Fintype n] + {K : Type w} {L : Type x} [Field K] [Field L] + (A : Matrix m n K) (B : Matrix m n L) + (h : ∀ (r : ℕ) (f : Fin r → n), LinearIndependent K (A.col ∘ f) → + LinearIndependent L (B.col ∘ f)) : A.rank ≤ B.rank := by + classical + obtain ⟨p, hp, hspan, hli⟩ := + Submodule.exists_fun_fin_finrank_span_eq K (Set.range A.col) + choose f hf using hp + have heq : A.col ∘ f = p := funext hf + have hli' : LinearIndependent L (B.col ∘ f) := h _ f (heq.symm ▸ hli) + rw [A.rank_eq_finrank_span_cols, B.rank_eq_finrank_span_cols] + have hsub : Set.range (B.col ∘ f) ⊆ Set.range B.col := by + rintro _ ⟨i, rfl⟩ + exact ⟨f i, rfl⟩ + calc + finrank K (span K (Set.range A.col)) = + finrank L (span L (Set.range (B.col ∘ f))) := by + simp [finrank_span_eq_card hli'] + _ ≤ finrank L (span L (Set.range B.col)) := + Submodule.finrank_mono (Submodule.span_mono hsub) + +/-- Matrices with the same finite-column dependence relations have equal ranks. -/ +theorem matrix_rank_eq_of_independent_iff + {m : Type u} {n : Type v} [Fintype m] [Fintype n] + {K : Type w} {L : Type x} [Field K] [Field L] + (A : Matrix m n K) (B : Matrix m n L) + (h : ∀ (r : ℕ) (f : Fin r → n), LinearIndependent K (A.col ∘ f) ↔ + LinearIndependent L (B.col ∘ f)) : A.rank = B.rank := by + exact le_antisymm + (matrix_rank_le_of_independent_imp A B (fun r f => (h r f).mp)) + (matrix_rank_le_of_independent_imp B A (fun r f => (h r f).mpr)) + +/-- Extending an integral coefficient matrix to either of two faithful field +extensions gives the same rank. The fields need not embed into each other. -/ +theorem matrix_rank_algebraMap_eq + {m : Type u} {n : Type v} [Fintype m] [Fintype n] + {R K L : Type*} [CommRing R] [Field K] [Field L] + [Algebra R K] [Algebra R L] [FaithfulSMul R K] [FaithfulSMul R L] + (A : Matrix m n R) : + (A.map (algebraMap R K)).rank = (A.map (algebraMap R L)).rank := by + apply matrix_rank_eq_of_independent_iff + intro r f + change LinearIndependent K (fun i => algebraMap R K ∘ A.col (f i)) ↔ + LinearIndependent L (fun i => algebraMap R L ∘ A.col (f i)) + rw [linearIndependent_algebraMap_comp_iff, linearIndependent_algebraMap_comp_iff] + +/-- A field embedding preserves the rank of a finite rectangular matrix. -/ +theorem matrix_rank_map + {m : Type u} {n : Type v} [Fintype m] [Fintype n] + {F K : Type*} [Field F] [Field K] (f : F →+* K) (A : Matrix m n F) : + (A.map f).rank = A.rank := by + let : Algebra F K := f.toAlgebra + simpa only [RingHom.algebraMap_toAlgebra, Algebra.algebraMap_self, RingHom.coe_id, Matrix.map_id] using (matrix_rank_algebraMap_eq (K := K) (L := F) A) + +/-- Integer matrices have the same rank over any two characteristic-zero fields. -/ +theorem integer_matrix_rank_eq + {m : Type u} {n : Type v} [Fintype m] [Fintype n] + (K L : Type*) [Field K] [CharZero K] [Field L] [CharZero L] + (A : Matrix m n ℤ) : + (A.map (Int.castRingHom K)).rank = (A.map (Int.castRingHom L)).rank := by + exact matrix_rank_algebraMap_eq A + +/-- The characteristic-zero rank-transfer step used in the lower bound. -/ +theorem integer_matrix_rank_eq_complex + {m : Type u} {n : Type v} [Fintype m] [Fintype n] + (K : Type*) [Field K] [CharZero K] (A : Matrix m n ℤ) : + (A.map (Int.castRingHom K)).rank = (A.map (Int.castRingHom ℂ)).rank := by + exact integer_matrix_rank_eq K ℂ A + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IntermediateDimension.lean b/lean/OAI/Algebra/DepthFive/IntermediateDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..b091ee02f2831b6ebabc1715de4da8d123b448d3 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IntermediateDimension.lean @@ -0,0 +1,141 @@ +import OAI.Algebra.DepthFive.DimensionCorrection +import OAI.Algebra.DepthFive.DegreeDiscrepancy + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- Factors applied first in the intermediate-space argument. -/ +def positiveBidegreeSet {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : Finset ι := by + classical + exact s.filter (fun j => 0 < (i j : ℝ) - lam * e j) + +/-- Total differentiation degree of the first group of factors. -/ +def positiveBidegreeV {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : ℕ := + ∑ j ∈ positiveBidegreeSet s e i lam, i j + +/-- Total multiplication degree of the first group of factors. -/ +def positiveBidegreeU {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : ℕ := + ∑ j ∈ positiveBidegreeSet s e i lam, (e j - i j) + +theorem positiveBidegreeV_le {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) : + positiveBidegreeV s e i lam ≤ ∑ j ∈ s, i j := by + classical + exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun _ _ _ => Nat.zero_le _) + +theorem positiveBidegreeU_le {ι : Type*} (s : Finset ι) (e i : ι → ℕ) (lam : ℝ) + (hie : ∀ j ∈ s, i j ≤ e j) : + positiveBidegreeU s e i lam ≤ (∑ j ∈ s, e j) - ∑ j ∈ s, i j := by + classical + calc + _ ≤ ∑ j ∈ s, (e j - i j) := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun _ _ _ => Nat.zero_le _) + _ = _ := Finset.sum_tsub_distrib s hie + +/-- Natural bidegree assignments give exactly the discrepancy-weight product. -/ +theorem positiveBidegree_rpow {ι : Type*} (s : Finset ι) (e i : ι → ℕ) + (ρ lam α : ℝ) (hα : 0 < α) (hie : ∀ j ∈ s, i j ≤ e j) + (hlam : (1 + ρ) * lam = ρ) + (hbalance : lam * (∑ j ∈ s, e j : ℕ) = (∑ j ∈ s, i j : ℕ)) : + α ^ ((positiveBidegreeV s e i lam : ℝ) - ρ * positiveBidegreeU s e i lam) = + ∏ j ∈ s, (α ^ ((1 + ρ) / 2)) ^ |(i j : ℝ) - lam * e j| := by + classical + have hzero : ∑ j ∈ s, ((i j : ℝ) - lam * e j) = 0 := by + rw [Finset.sum_sub_distrib, ← Finset.mul_sum] + norm_cast at hbalance ⊢ + exact sub_eq_zero.mpr hbalance.symm + have hcast : (positiveBidegreeU s e i lam : ℝ) = + ∑ j ∈ s.filter (fun j => 0 < (i j : ℝ) - lam * e j), ((e j : ℝ) - i j) := by + unfold positiveBidegreeU positiveBidegreeSet + push_cast + apply Finset.sum_congr rfl + intro j hj + exact Nat.cast_sub (hie j (Finset.mem_filter.mp hj).1) + rw [hcast] + simp only [positiveBidegreeV, positiveBidegreeSet, Nat.cast_sum] + exact positive_bidegree_rpow s (fun j => (e j : ℝ)) (fun j => (i j : ℝ)) + ρ lam α hα hlam hzero + +/-- The intermediate space associated to an admissible natural bidegree +assignment is bounded by its product of discrepancy weights. -/ +theorem intermediate_dimension_le_weight_product {ι : Type*} (s : Finset ι) + (e i : ι → ℕ) (k n v u a b : ℕ) (ρ lam : ℝ) + (hie : ∀ j ∈ s, i j ≤ e j) + (he : ∑ j ∈ s, e j = n) (hi : ∑ j ∈ s, i j = k) + (hproportion : lam * n = k) (hlam : (1 + ρ) * lam = ρ) + (hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b) + (hka : k ≤ a) (hbudget : 2 * k ≤ a + v) + (hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ ρ ≤ + (b : ℝ) / ((b : ℝ) + u)) : + (homogeneousDim v (a - positiveBidegreeV s e i lam) : ℝ) * + homogeneousDim u (b + positiveBidegreeU s e i lam) ≤ + 2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b) * + ∏ j ∈ s, (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + ρ) / 2)) ^ + |(i j : ℝ) - lam * e j| := by + have hVk : positiveBidegreeV s e i lam ≤ k := by + simpa only [hi] using positiveBidegreeV_le s e i lam + have hVa : positiveBidegreeV s e i lam ≤ a := hVk.trans hka + have hVbudget : 2 * positiveBidegreeV s e i lam ≤ a + v := by omega + have hα : 0 < (a : ℝ) / ((a : ℝ) + v) := by positivity + have hprop : lam * (∑ j ∈ s, e j : ℕ) = (∑ j ∈ s, i j : ℕ) := by + rw [he, hi] + exact hproportion + have h := intermediate_dimension_le_balanced + (I := positiveBidegreeV s e i lam) (J := positiveBidegreeU s e i lam) + hv hu ha hb hVa hVbudget ρ hbalance + rw [positiveBidegree_rpow s e i ρ lam _ hα hie hlam hprop] at h + exact h + +/-- Summing intermediate dimensions over the admissible bidegrees gives the +numerical product bound used after rank subadditivity. -/ +theorem sum_intermediate_dimensions_le_weight_product {ι : Type*} + [Fintype ι] [DecidableEq ι] (e : ι → ℕ) (k n v u a b : ℕ) (ρ lam : ℝ) + (he : ∑ j, e j = n) (hproportion : lam * n = k) + (hlam : (1 + ρ) * lam = ρ) + (hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b) + (hka : k ≤ a) (hbudget : 2 * k ≤ a + v) + (hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ ρ ≤ + (b : ℝ) / ((b : ℝ) + u)) : + (∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter + (fun i => ∑ j, i j = k), + (homogeneousDim v (a - positiveBidegreeV Finset.univ e i lam) : ℝ) * + homogeneousDim u (b + positiveBidegreeU Finset.univ e i lam)) ≤ + 2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b) * + ∏ j, degreeWeight (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + ρ) / 2)) lam (e j) := by + classical + let α : ℝ := (a : ℝ) / ((a : ℝ) + v) + let q : ℝ := α ^ ((1 + ρ) / 2) + let D : ℝ := (homogeneousDim v a : ℝ) * homogeneousDim u b + let A := (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter + (fun i => ∑ j, i j = k) + have hα : 0 ≤ α := by dsimp [α]; positivity + change (∑ i ∈ A, _) ≤ 2 * D * ∏ j, degreeWeight q lam (e j) + calc + _ ≤ ∑ i ∈ A, 2 * D * ∏ j, q ^ |(i j : ℝ) - lam * e j| := by + apply Finset.sum_le_sum + intro i hi + have hiA := Finset.mem_filter.mp hi + have hie : ∀ j ∈ (Finset.univ : Finset ι), i j ≤ e j := by + intro j _ + have hj := Fintype.mem_piFinset.mp hiA.1 j + exact Nat.le_of_lt_succ (Finset.mem_range.mp hj) + exact intermediate_dimension_le_weight_product Finset.univ e i k n v u a b ρ lam + hie he hiA.2 hproportion hlam hv hu ha hb hka hbudget hbalance + _ = 2 * D * ∑ i ∈ A, ∏ j, q ^ |(i j : ℝ) - lam * e j| := by + rw [Finset.mul_sum] + _ ≤ 2 * D * ∏ j, degreeWeight q lam (e j) := by + apply mul_le_mul_of_nonneg_left + · exact bidegree_weight_sum_le e k q lam (Real.rpow_nonneg hα _) + · dsimp [D] + positivity + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IntermediateFactorization.lean b/lean/OAI/Algebra/DepthFive/IntermediateFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..83e31a35442d37f02f44d0f71e4b97a49e2d7f99 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IntermediateFactorization.lean @@ -0,0 +1,176 @@ +import OAI.Algebra.DepthFive.MixedOperator +import OAI.Algebra.DepthFive.OperatorRank +import OAI.Algebra.DepthFive.MixedOperatorBidegree +import OAI.Algebra.DepthFive.RankMeasure + +namespace OAI + +/-! Factorization of mixed operators through intermediate bidegree spaces. +The codomain is initially the full polynomial space. Restricting it to a +bidegree submodule leaves the range dimension unchanged, as proved below. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ K : Type*} [Field K] + +/-- The full operator restricted to a finite-bidegree source, as a linear +family in the polynomial defining the operator. -/ +def sourceMixedOperator (isV : σ → Bool) (a b : ℕ) : + MvPolynomial σ K →ₗ[K] + (bidegreeSubmodule (K := K) isV a b →ₗ[K] MvPolynomial σ K) where + toFun p := (mixedOperator isV p).comp (bidegreeSubmodule isV a b).subtype + map_add' p q := by + ext f + simp + map_smul' c p := by + ext f + simp + +@[simp] theorem sourceMixedOperator_apply (isV : σ → Bool) (a b : ℕ) + (p : MvPolynomial σ K) (f : bidegreeSubmodule (K := K) isV a b) : + sourceMixedOperator isV a b p f = mixedOperator isV p (f : MvPolynomial σ K) := rfl + +/-- The operator for `p` maps the source into the proposed intermediate space. -/ +def intermediateStart (isV : σ → Bool) (a b c d : ℕ) + (p : MvPolynomial σ K) + (h : ∀ f : bidegreeSubmodule (K := K) isV a b, + mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : + bidegreeSubmodule (K := K) isV a b →ₗ[K] bidegreeSubmodule (K := K) isV c d := + LinearMap.codRestrict _ (sourceMixedOperator isV a b p) h + +/-- Factorization is an equality of actual linear maps, not merely a rank +inequality. The rightmost polynomial factor operates first. -/ +theorem sourceMixedOperator_mul_factorization (isV : σ → Bool) (a b c d : ℕ) + (p q : MvPolynomial σ K) + (h : ∀ f : bidegreeSubmodule (K := K) isV a b, + mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : + sourceMixedOperator isV a b (q * p) = + (sourceMixedOperator isV c d q).comp + (intermediateStart isV a b c d p h) := by + apply LinearMap.ext + intro f + exact mixedOperator_mul_apply isV q p f + +/-- Any factorization through an intermediate bidegree space bounds rank by +that space's dimension. -/ +theorem sourceMixedOperator_mul_rank_le [Finite σ] + (isV : σ → Bool) (a b c d : ℕ) (p q : MvPolynomial σ K) + (h : ∀ f : bidegreeSubmodule (K := K) isV a b, + mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : + RankMeasure.mapRank (sourceMixedOperator isV a b (q * p)) ≤ + Module.finrank K (bidegreeSubmodule (K := K) isV c d) := by + rw [sourceMixedOperator_mul_factorization isV a b c d p q h] + exact RankMeasure.mapRank_factor_le _ _ + +/-- The bidegree of a selected subproduct is the sum of the selected +bidegrees, with no condition on the unselected factors. -/ +theorem selected_bidegree_product_mem {ι : Type*} (s : Finset ι) + (selected : ι → Prop) [DecidablePred selected] + (Q : ι → MvPolynomial σ K) (i j : ι → ℕ) (isV : σ → Bool) + (hQ : ∀ l ∈ s, Q l ∈ bidegreeSubmodule isV (i l) (j l)) : + (∏ l ∈ s.filter selected, Q l) ∈ + bidegreeSubmodule isV (∑ l ∈ s.filter selected, i l) + (∑ l ∈ s.filter selected, j l) := by + have hp := MvPolynomial.IsWeightedHomogeneous.prod (s.filter selected) Q + (fun l => (i l, j l)) (w := bidegreeWeight isV) + (fun l hl => hQ l (Finset.mem_filter.mp hl).1) + rw [← prod_mk_sum] at hp + exact hp + +/-- In a commutative polynomial product, any chosen group of factors can be +applied first. In the product-rank proof this group consists of the factors +with positive proportional bidegree discrepancy. -/ +theorem sourceMixedOperator_prod_rank_le [Finite σ] {ι : Type*} + (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] + (Q : ι → MvPolynomial σ K) (isV : σ → Bool) (a b c d : ℕ) + (h : ∀ f : bidegreeSubmodule (K := K) isV a b, + mixedOperator isV (∏ j ∈ s.filter selected, Q j) (f : MvPolynomial σ K) ∈ + bidegreeSubmodule isV c d) : + RankMeasure.mapRank (sourceMixedOperator isV a b (∏ j ∈ s, Q j)) ≤ + Module.finrank K (bidegreeSubmodule (K := K) isV c d) := by + classical + rw [← Finset.prod_filter_mul_prod_filter_not s selected Q, mul_comm] + exact sourceMixedOperator_mul_rank_le isV a b c d _ _ h + +/-- A selected homogeneous subproduct gives the actual intermediate dimension +bound. Only its total derivative degree needs to fit inside the source. -/ +theorem sourceMixedOperator_homogeneous_prod_rank_le [Finite σ] {ι : Type*} + (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] + (Q : ι → MvPolynomial σ K) (i j : ι → ℕ) (isV : σ → Bool) (a b : ℕ) + (hQ : ∀ l ∈ s, Q l ∈ bidegreeSubmodule isV (i l) (j l)) + (hi : (∑ l ∈ s.filter selected, i l) ≤ a) : + RankMeasure.mapRank (sourceMixedOperator isV a b (∏ l ∈ s, Q l)) ≤ + Module.finrank K (bidegreeSubmodule (K := K) isV + (a - ∑ l ∈ s.filter selected, i l) + (b + ∑ l ∈ s.filter selected, j l)) := by + apply sourceMixedOperator_prod_rank_le s selected Q isV a b + intro f + exact mixedOperator_mem_bidegreeSubmodule isV hi + (selected_bidegree_product_mem s selected Q i j isV hQ) f.property + +/-- Specialization to the component product belonging to one bidegree +assignment. This is the geometric rank estimate used before summing over +assignments in the product-rank lemma. -/ +theorem sourceMixedOperator_component_prod_rank_le [Finite σ] {ι : Type*} + (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] + (Q : ι → MvPolynomial σ K) (e i : ι → ℕ) (isV : σ → Bool) (a b : ℕ) + (hi : (∑ l ∈ s.filter selected, i l) ≤ a) : + RankMeasure.mapRank (sourceMixedOperator isV a b + (∏ l ∈ s, bidegreeComponent isV (i l) (e l - i l) (Q l))) ≤ + Module.finrank K (bidegreeSubmodule (K := K) isV + (a - ∑ l ∈ s.filter selected, i l) + (b + ∑ l ∈ s.filter selected, (e l - i l))) := by + exact sourceMixedOperator_homogeneous_prod_rank_le s selected + (fun l => bidegreeComponent isV (i l) (e l - i l) (Q l)) + i (fun l => e l - i l) isV a b + (fun l _ => bidegreeComponent_mem isV (i l) (e l - i l) (Q l)) hi + +/-- A total derivative-degree bound suffices for every selection of factors. +This version is convenient for constrained assignments whose degrees sum to `k`. -/ +theorem sourceMixedOperator_component_prod_rank_le_of_sum_le [Finite σ] + {ι : Type*} (s : Finset ι) (selected : ι → Prop) [DecidablePred selected] + (Q : ι → MvPolynomial σ K) (e i : ι → ℕ) (isV : σ → Bool) (a b : ℕ) + (hi : (∑ l ∈ s, i l) ≤ a) : + RankMeasure.mapRank (sourceMixedOperator isV a b + (∏ l ∈ s, bidegreeComponent isV (i l) (e l - i l) (Q l))) ≤ + Module.finrank K (bidegreeSubmodule (K := K) isV + (a - ∑ l ∈ s.filter selected, i l) + (b + ∑ l ∈ s.filter selected, (e l - i l))) := by + apply sourceMixedOperator_component_prod_rank_le s selected Q e i isV a b + exact (Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun _ _ _ => Nat.zero_le _)).trans hi + +/-- Passing from a fixed-bidegree codomain to the full polynomial codomain +does not alter the dimension of the range. -/ +theorem mapRank_subtype_comp {V : Type*} [AddCommGroup V] [Module K V] + (Z : Submodule K (MvPolynomial σ K)) (f : V →ₗ[K] Z) : + RankMeasure.mapRank (Z.subtype.comp f) = RankMeasure.mapRank f := by + unfold RankMeasure.mapRank + rw [LinearMap.range_comp] + exact Submodule.finrank_map_subtype_eq Z f.range + +/-- Consequently a codomain-restricted mixed operator and its source-only +restriction have exactly the same rank. -/ +theorem sourceMixedOperator_codRestrict_rank (isV : σ → Bool) (a b c d : ℕ) + (p : MvPolynomial σ K) + (h : ∀ f : bidegreeSubmodule (K := K) isV a b, + mixedOperator isV p (f : MvPolynomial σ K) ∈ bidegreeSubmodule isV c d) : + RankMeasure.mapRank (intermediateStart isV a b c d p h) = + RankMeasure.mapRank (sourceMixedOperator isV a b p) := by + have heq : (bidegreeSubmodule (K := K) isV c d).subtype.comp + (intermediateStart isV a b c d p h) = + sourceMixedOperator isV a b p := by + apply LinearMap.ext + intro f + rfl + rw [← heq] + exact (mapRank_subtype_comp _ _).symm + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/InvalidOccupation.lean b/lean/OAI/Algebra/DepthFive/InvalidOccupation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b83936d64303b8a5a725d9ece94bf71bba4cef9 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/InvalidOccupation.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.DepthFive.FourPathLocal +import OAI.Algebra.DepthFive.ShiftedOccupation + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +namespace LocalMoments + +def operatorSign (derivative : Bool) : ℤ := if derivative then -1 else 1 + +/-- An invalid shifted coordinate forces the relevant local table factor to vanish. -/ +lemma localPolynomial_zero_of_negative {σ : Type*} [DecidableEq σ] + (derivative : Bool) (M : σ → ℕ) (p q r x : σ) + (hneg : (M x : ℤ) + operatorSign derivative * + ((if x = p then 1 else 0) - (if x = q then 1 else 0)) < 0) : + localPolynomial derivative M p q r = 0 := by + by_cases hpq : p = q + · subst q + simp at hneg + omega + · cases derivative + · have hMq : M q = 0 := by + by_cases hxq : x = q + · subst x + simp [operatorSign, Ne.symm hpq] at hneg + omega + · by_cases hxp : x = p + · subst x + simp [operatorSign, hpq] at hneg + omega + · simp [operatorSign, hxp, hxq] at hneg + omega + simp [localPolynomial, hpq, hMq] + · have hMp : M p = 0 := by + by_cases hxp : x = p + · subst x + simp [operatorSign, hpq] at hneg + omega + · by_cases hxq : x = q + · subst x + simp [operatorSign, Ne.symm hpq] at hneg + omega + · simp [operatorSign, hxp, hxq] at hneg + omega + simp [localPolynomial, hpq, hMp] + +/-- An invalid source in any layer annihilates the complete four-path table product. -/ +lemma localPolynomial_product_zero_of_negative {ι σ : Type*} + [DecidableEq σ] (layers : Finset ι) (derivative : ι → Bool) + (M : ι × σ → ℕ) (p q r : ι → σ) (t : ι) (a : σ) + (ht : t ∈ layers) + (hneg : ShiftedOccupation.signedSource M (operatorSign ∘ derivative) p q (t, a) < 0) : + (∏ j ∈ layers, localPolynomial (derivative j) (fun b => M (j, b)) (p j) (q j) (r j)) = 0 := by + apply Finset.prod_eq_zero ht + apply localPolynomial_zero_of_negative (derivative t) (fun b => M (t, b)) + (p t) (q t) (r t) a + exact hneg + +/-- The global table vanishes whenever no natural shifted source exists. -/ +lemma localPolynomial_product_zero_of_no_source {ι σ : Type*} + [Fintype ι] [DecidableEq σ] (derivative : ι → Bool) + (M : ι × σ → ℕ) (p q r : ι → σ) + (hbad : ¬ ∃ N : ι × σ → ℕ, ∀ x, (N x : ℤ) = + ShiftedOccupation.signedSource M (operatorSign ∘ derivative) p q x) : + (∏ j : ι, localPolynomial (derivative j) (fun b => M (j, b)) (p j) (q j) (r j)) = 0 := by + rw [ShiftedOccupation.exists_source_iff] at hbad + push Not at hbad + obtain ⟨⟨t, a⟩, hneg⟩ := hbad + exact localPolynomial_product_zero_of_negative Finset.univ derivative M p q r t a + (Finset.mem_univ _) hneg + +end LocalMoments +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IsolatedFlip.lean b/lean/OAI/Algebra/DepthFive/IsolatedFlip.lean new file mode 100644 index 0000000000000000000000000000000000000000..280260465daea7eab0dcb08bd4b2e7434070783a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IsolatedFlip.lean @@ -0,0 +1,257 @@ +import Mathlib + +namespace OAI + +/-! +Canonical removal of isolated positions in an independent set. + +The value `true` denotes the D type from the manuscript. The set `S` +contains the positions allowed to flip (interior V layers), and `R a b` +means that `b` is a neighbor of `a`. Independence is the only property +of the path graph needed for the fiber calculation. +-/ + +noncomputable section + +open scoped BigOperators + +namespace Problem335.IsolatedFlip + +variable {α : Type*} [Fintype α] [DecidableEq α] + +def eligible (S : Finset α) (R : α → α → Prop) (w : α → Bool) : Finset α := by + classical + exact S.filter (fun a => ∀ b, R a b → w b = true) + +def flip (S : Finset α) (R : α → α → Prop) (w : α → Bool) (a : α) : Bool := by + classical + exact if a ∈ eligible S R w then true else w a + +def unset (w : α → Bool) (T : Finset α) (a : α) : Bool := + if a ∈ T then false else w a + +def removed (S : Finset α) (R : α → α → Prop) (w : α → Bool) : Finset α := by + classical + exact (eligible S R w).filter (fun a => w a = false) + +@[simp] theorem mem_eligible {α : Type u_1} [Fintype α] [DecidableEq α] + {S : Finset α} {R : α → α → Prop} + {w : α → Bool} {a : α} : + a ∈ eligible S R w ↔ a ∈ S ∧ ∀ b, R a b → w b = true := by + classical + simp [eligible] + +theorem eligible_subset (S : Finset α) (R : α → α → Prop) (w : α → Bool) : + eligible S R w ⊆ S := by + intro a ha + exact (mem_eligible.mp ha).1 + +theorem flip_eq_of_not_mem {S : Finset α} {R : α → α → Prop} + {w : α → Bool} {a : α} (ha : a ∉ S) : flip S R w a = w a := by + classical + have h : a ∉ eligible S R w := fun h => ha (eligible_subset S R w h) + simp [flip, h] + +theorem eligible_congr {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + {w z : α → Bool} (h : ∀ a, a ∉ S → w a = z a) : + eligible S R w = eligible S R z := by + ext a + simp only [mem_eligible] + constructor + · rintro ⟨ha, hw⟩ + refine ⟨ha, ?_⟩ + intro b hab + rw [← h b (hS a ha b hab)] + exact hw b hab + · rintro ⟨ha, hz⟩ + refine ⟨ha, ?_⟩ + intro b hab + rw [h b (hS a ha b hab)] + exact hz b hab + +theorem eligible_flip {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) : + eligible S R (flip S R w) = eligible S R w := by + apply eligible_congr hS + intro a ha + exact flip_eq_of_not_mem ha + +theorem flip_idempotent {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) (w : α → Bool) : + flip S R (flip S R w) = flip S R w := by + classical + funext a + simp only [flip, eligible_flip hS] + split_ifs <;> rfl + +theorem eligible_unset {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + (w : α → Bool) {T : Finset α} (hT : T ⊆ S) : + eligible S R (unset w T) = eligible S R w := by + apply eligible_congr hS + intro a ha + have hn : a ∉ T := fun ht => ha (hT ht) + simp [unset, hn] + +theorem flip_unset {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + {w : α → Bool} (hw : flip S R w = w) + {T : Finset α} (hT : T ⊆ eligible S R w) : + flip S R (unset w T) = w := by + classical + have he := eligible_unset hS w (hT.trans (eligible_subset S R w)) + funext a + have hw' := congrFun hw a + simp only [flip, he] at hw' ⊢ + by_cases ha : a ∈ eligible S R w + · simpa [ha] using hw' + · have hn : a ∉ T := fun ht => ha (hT ht) + simp [ha, unset, hn] + +theorem removed_subset {α : Type u_1} [Fintype α] [DecidableEq α] + (S : Finset α) (R : α → α → Prop) (w : α → Bool) : + removed S R w ⊆ eligible S R w := by + classical + exact Finset.filter_subset _ _ + +theorem unset_flip_removed (S : Finset α) (R : α → α → Prop) + (w : α → Bool) : unset (flip S R w) (removed S R w) = w := by + classical + funext a + by_cases ha : a ∈ eligible S R w + · cases hw : w a <;> simp [unset, removed, flip, ha, hw] + · simp [unset, removed, flip, ha] + +theorem removed_unset {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + {w : α → Bool} (hw : flip S R w = w) + {T : Finset α} (hT : T ⊆ eligible S R w) : + removed S R (unset w T) = T := by + classical + have he := eligible_unset hS w (hT.trans (eligible_subset S R w)) + ext a + simp only [removed, Finset.mem_filter, he] + constructor + · rintro ⟨ha, hz⟩ + by_contra hn + have hw' := congrFun hw a + simp [flip, ha] at hw' + simp [unset, hn, hw'] at hz + · intro ha + exact ⟨hT ha, by simp [unset, ha]⟩ + +/-! Each fiber of the canonicalization is exactly a powerset. -/ + +def fiberEquiv {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + (w : α → Bool) (hw : flip S R w = w) : + {z : α → Bool // flip S R z = w} ≃ + {T : Finset α // T ⊆ eligible S R w} where + toFun z := ⟨removed S R z, by + have he : eligible S R z = eligible S R w := by + exact (eligible_flip hS z).symm.trans (congrArg (eligible S R) z.property) + rw [← he] + exact removed_subset S R z⟩ + invFun T := ⟨unset w T, flip_unset hS hw T.property⟩ + left_inv z := by + apply Subtype.ext + change unset w (removed S R z) = z + exact (congrArg (fun q => unset q (removed S R z)) z.property.symm).trans + (unset_flip_removed S R z) + right_inv T := by + apply Subtype.ext + exact removed_unset hS hw T.property + +theorem fiber_card {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + (w : α → Bool) (hw : flip S R w = w) : + Fintype.card {z : α → Bool // flip S R z = w} = + 2 ^ (eligible S R w).card := by + classical + rw [Fintype.card_congr (fiberEquiv hS w hw)] + simpa only [Finset.mem_powerset] using + (Fintype.card_coe (eligible S R w).powerset).trans (Finset.card_powerset _) + +theorem fiber_sum_pow {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + (w : α → Bool) (hw : flip S R w = w) + {K : Type*} [CommSemiring K] (c : K) : + (∑ z : {z : α → Bool // flip S R z = w}, + c ^ (removed S R z).card) = (1 + c) ^ (eligible S R w).card := by + classical + calc + _ = ∑ T : {T : Finset α // T ⊆ eligible S R w}, c ^ T.val.card := + Fintype.sum_equiv (fiberEquiv hS w hw) _ _ (fun _ => rfl) + _ = ∑ T ∈ (eligible S R w).powerset, c ^ T.card := + (Finset.sum_subtype (p := fun T : Finset α => T ⊆ eligible S R w) + (eligible S R w).powerset (fun _ => Finset.mem_powerset) + (fun T => c ^ T.card)).symm + _ = _ := by + simpa [Finset.prod_const, add_comm] using + (Finset.prod_add_one (f := fun _ : α => c) (eligible S R w)).symm + +theorem fiber_weight_sum {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + (w : α → Bool) (hw : flip S R w = w) + {K : Type*} [CommSemiring K] (c : K) (W : (α → Bool) → K) + (hW : ∀ z, flip S R z = w → W z = W w * c ^ (removed S R z).card) : + (∑ z : {z : α → Bool // flip S R z = w}, W z) = + W w * (1 + c) ^ (eligible S R w).card := by + classical + calc + _ = ∑ z : {z : α → Bool // flip S R z = w}, + W w * c ^ (removed S R z).card := + Finset.sum_congr rfl (fun z _ => hW z z.property) + _ = W w * ∑ z : {z : α → Bool // flip S R z = w}, + c ^ (removed S R z).card := (Finset.mul_sum _ _ _).symm + _ = _ := by rw [fiber_sum_pow hS w hw] + +theorem total_weight_sum {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + {K : Type*} [CommSemiring K] (c : K) (W : (α → Bool) → K) + (hW : ∀ z, W z = W (flip S R z) * c ^ (removed S R z).card) : + (∑ z, W z) = ∑ w ∈ Finset.univ.filter (fun w => flip S R w = w), + W w * (1 + c) ^ (eligible S R w).card := by + classical + rw [Finset.sum_filter] + calc + _ = ∑ w, ∑ z : {z : α → Bool // flip S R z = w}, W z := + (Fintype.sum_fiberwise (flip S R) W).symm + _ = _ := by + apply Finset.sum_congr rfl + intro w _ + by_cases hw : flip S R w = w + · rw [ite_eq_left hw] + apply fiber_weight_sum hS w hw c W + intro z hz + simpa only [hz] using hW z + · rw [ite_eq_right hw] + have hempty : IsEmpty {z : α → Bool // flip S R z = w} := by + refine ⟨fun z => hw ?_⟩ + exact (congrArg (flip S R) z.property.symm).trans + ((flip_idempotent hS z).trans z.property) + let := hempty + simp + +theorem correction_removal {S : Finset α} {R : α → α → Prop} + (hS : ∀ a ∈ S, ∀ b, R a b → b ∉ S) + (c : ℝ) (hc : 0 ≤ c) (W : (α → Bool) → ℝ) + (hWnonneg : ∀ z, 0 ≤ W z) + (hW : ∀ z, W z = W (flip S R z) * c ^ (removed S R z).card) : + (∑ z, W z) ≤ (1 + c) ^ S.card * + ∑ w ∈ Finset.univ.filter (fun w => flip S R w = w), W w := by + classical + rw [total_weight_sum hS c W hW, Finset.mul_sum] + apply Finset.sum_le_sum + intro w _ + rw [mul_comm ((1 + c) ^ S.card)] + exact mul_le_mul_of_nonneg_left + (pow_le_pow_right₀ (by linarith : 1 ≤ 1 + c) + (Finset.card_le_card (eligible_subset S R w))) (hWnonneg w) + +end Problem335.IsolatedFlip + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IsolatedWeight.lean b/lean/OAI/Algebra/DepthFive/IsolatedWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..266a3fdcb0801f67eacaf94d997faa9fee2ab16a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IsolatedWeight.lean @@ -0,0 +1,380 @@ +import OAI.Algebra.DepthFive.IsolatedFlip +import OAI.Algebra.DepthFive.SwitchRestoration + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.IsolatedWeight + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +/-- Internal neighboring positions of the same normal (false) type. -/ +def falseNeighbors (R : ι → ι → Prop) (w : ι → Bool) (i : ι) : Finset ι := by + classical + exact Finset.univ.filter (fun j => R i j ∧ w j = false) + +/-- The coincidence correction factors at the normal V positions. -/ +def correction (V : Finset ι) (R : ι → ι → Prop) (A x : ℝ) + (w : ι → Bool) : ℝ := by + classical + exact ∏ i ∈ V.filter (fun i => w i = false), + (1 + A * x ^ (falseNeighbors R w i).card) + +/-- Restoring any subset of an independent V set does not change the +neighbors of any V position. Endpoints are allowed in V. -/ +theorem falseNeighbors_unset {V T : Finset ι} {R : ι → ι → Prop} + (hT : T ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (w : ι → Bool) {i : ι} (hi : i ∈ V) : + falseNeighbors R (IsolatedFlip.unset w T) i = falseNeighbors R w i := by + classical + ext j + by_cases hr : R i j + · have hj : j ∉ T := fun ht => hV i hi j hr (hT ht) + simp [falseNeighbors, IsolatedFlip.unset, hr, hj] + · simp [falseNeighbors, hr] + +omit [DecidableEq ι] in +theorem falseNeighbors_eq_empty {R : ι → ι → Prop} {w : ι → Bool} {i : ι} + (h : ∀ j, R i j → w j = true) : falseNeighbors R w i = ∅ := by + classical + apply Finset.eq_empty_iff_forall_notMem.mpr + intro j hj + have hh := Finset.mem_filter.mp hj + have heq := h j hh.2.1 + simp only [heq, Bool.true_eq_false] at hh + exact hh.2.2 + +omit [Fintype ι] in +/-- The normal V positions after restoration consist of the old normal +positions together with the restored subset. -/ +theorem falseVertices_unset {V T : Finset ι} (hT : T ⊆ V) + (w : ι → Bool) : + (V.filter fun i => IsolatedFlip.unset w T i = false) = + (V.filter fun i => w i = false) ∪ T := by + classical + ext i + by_cases hi : i ∈ T + · simp [IsolatedFlip.unset, hi, hT hi] + · simp [IsolatedFlip.unset, hi] + +omit [Fintype ι] [DecidableEq ι] in +theorem falseVertices_disjoint {V T : Finset ι} (w : ι → Bool) + (hw : ∀ i ∈ T, w i = true) : + Disjoint (V.filter fun i => w i = false) T := by + classical + apply Finset.disjoint_left.mpr + intro i hi ht + have hf := (Finset.mem_filter.mp hi).2 + have ht := hw i ht + simp only [ht, Bool.true_eq_false] at hf + +/-- The exact local correction-product factor in the isolated-position flip. +Every restored position has no normal neighbors, and hence contributes `1+A`. -/ +theorem correction_unset {V T : Finset ι} {R : ι → ι → Prop} + (hT : T ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (w : ι → Bool) (hw : ∀ i ∈ T, w i = true) + (hnear : ∀ i ∈ T, ∀ j, R i j → w j = true) (A x : ℝ) : + correction V R A x (IsolatedFlip.unset w T) = + correction V R A x w * (1 + A) ^ T.card := by + classical + unfold correction + rw [falseVertices_unset hT w, Finset.prod_union (falseVertices_disjoint w hw)] + congr 1 + · apply Finset.prod_congr rfl + intro i hi + rw [falseNeighbors_unset hT hV w (Finset.mem_filter.mp hi).1] + · calc + _ = ∏ _i ∈ T, (1 + A) := by + apply Finset.prod_congr rfl + intro i hi + rw [falseNeighbors_unset hT hV w (hT hi), + falseNeighbors_eq_empty (hnear i hi)] + simp + _ = (1 + A) ^ T.card := by simp + +/-- True positions in the complementary variable group are unchanged. -/ +theorem complement_trueVertices_unset {V T : Finset ι} (hT : T ⊆ V) + (w : ι → Bool) : + ((Finset.univ \ V).filter fun i => IsolatedFlip.unset w T i = true) = + ((Finset.univ \ V).filter fun i => w i = true) := by + classical + ext i + by_cases hi : i ∈ V + · simp [hi] + · have hit : i ∉ T := fun ht => hi (hT ht) + simp [IsolatedFlip.unset, hi, hit] + +/-- The actual weighted word summand, with `A = alpha⁻¹`, `B = beta`, +and `x = n⁻¹`. The relation records internal adjacency. -/ +def weight (edges : Finset (ι × ι)) (V : Finset ι) (R : ι → ι → Prop) + (A B x : ℝ) (w : ι → Bool) : ℝ := by + classical + exact x ^ SwitchRestoration.switchCount edges w * + A ^ (V.filter fun i => w i = true).card * + B ^ ((Finset.univ \ V).filter fun i => w i = true).card * + correction V R A x w + +/-- Exact isolated-flip weight identity given the switch-count increment. +The switch increment is supplied by `switchCount_restore_eq_add_twice_card`. +No bound or positivity is needed except nonvanishing of the D-layer weight. -/ +theorem weight_unset {edges : Finset (ι × ι)} {V T : Finset ι} + {R : ι → ι → Prop} (hT : T ⊆ V) + (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (w : ι → Bool) (hw : ∀ i ∈ T, w i = true) + (hnear : ∀ i ∈ T, ∀ j, R i j → w j = true) + (hswitch : SwitchRestoration.switchCount edges (IsolatedFlip.unset w T) = + SwitchRestoration.switchCount edges w + 2 * T.card) + {A : ℝ} (hA : A ≠ 0) (B x : ℝ) : + weight edges V R A B x (IsolatedFlip.unset w T) = + weight edges V R A B x w * (x ^ 2 * (1 + A) / A) ^ T.card := by + classical + have hcount := SwitchRestoration.trueVertices_restore_card_add V T w hT hw + change (V.filter fun i => IsolatedFlip.unset w T i = true).card + T.card = + (V.filter fun i => w i = true).card at hcount + unfold weight + rw [hswitch, complement_trueVertices_unset hT w, + correction_unset hT hV w hw hnear A x, ← hcount] + simp only [pow_add, pow_mul, mul_pow, div_pow] + field_simp + +/-- The isolated-flip identity for the actual word weight. Only interior +positions (of edge degree two) may flip, while V may also contain endpoints. -/ +theorem weight_flip {edges : Finset (ι × ι)} {V S : Finset ι} + {R : ι → ι → Prop} (hS : S ⊆ V) + (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + {A : ℝ} (hA : A ≠ 0) (B x : ℝ) (w : ι → Bool) : + weight edges V R A B x w = + weight edges V R A B x (IsolatedFlip.flip S R w) * + (x ^ 2 * (1 + A) / A) ^ (IsolatedFlip.removed S R w).card := by + classical + let T := IsolatedFlip.removed S R w + let y := IsolatedFlip.flip S R w + have hTe : T ⊆ IsolatedFlip.eligible S R w := IsolatedFlip.removed_subset S R w + have hTS : T ⊆ S := hTe.trans (IsolatedFlip.eligible_subset S R w) + have hTV : T ⊆ V := hTS.trans hS + have hy : ∀ i ∈ T, y i = true := by + intro i hi + simp only [y, IsolatedFlip.flip, ite_eq_left (hTe hi)] + have hnear : ∀ i ∈ T, ∀ j, R i j → y j = true := by + intro i hi j hij + have hwj := (IsolatedFlip.mem_eligible.mp (hTe hi)).2 j hij + simp [y, IsolatedFlip.flip, hwj] + have hsw : SwitchRestoration.switchCount edges (IsolatedFlip.unset y T) = + SwitchRestoration.switchCount edges y + 2 * T.card := by + apply SwitchRestoration.switchCount_restore_eq_add_twice_card + · intro e he h + rcases h with h | h + · exact ⟨hy _ h, hnear _ h _ (hR e he).1⟩ + · exact ⟨hnear _ h _ (hR e he).2, hy _ h⟩ + · intro e he h + exact hV e.1 (hTV h.1) e.2 (hR e he).1 (hTV h.2) + · intro i hi + exact hdegree i (hTS hi) + have h := weight_unset hTV hV y hy hnear hsw hA B x + simpa only [y, T, IsolatedFlip.unset_flip_removed] using h + +/-- Nonnegative parameters give a nonnegative word weight. -/ +theorem weight_nonneg (edges : Finset (ι × ι)) (V : Finset ι) + (R : ι → ι → Prop) {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) + (w : ι → Bool) : 0 ≤ weight edges V R A B x w := by + classical + unfold weight correction + positivity + +/-- Summing the exact word-weight identity over the fibers removes all +isolated positions at a multiplicative cost `(1+x²(1+A)/A)^|S|`. -/ +theorem sum_weight_le_fixed {edges : Finset (ι × ι)} {V S : Finset ι} + {R : ι → ι → Prop} (hS : S ⊆ V) + (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + {A B x : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (hx : 0 ≤ x) : + (∑ w : ι → Bool, weight edges V R A B x w) ≤ + (1 + x ^ 2 * (1 + A) / A) ^ S.card * + ∑ w ∈ Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w), + weight edges V R A B x w := by + classical + apply IsolatedFlip.correction_removal + · intro i hi j hij hj + exact hV i (hS hi) j hij (hS hj) + · positivity + · exact weight_nonneg edges V R hA.le hB hx + · exact weight_flip hS hV hR hdegree hA.ne' B x + +/-- A normal position in the flip set of a fixed word has at least one +normal neighbor: otherwise the canonical flip would change it. -/ +theorem falseNeighbors_card_pos_of_fixed {S : Finset ι} {R : ι → ι → Prop} + {w : ι → Bool} (hw : IsolatedFlip.flip S R w = w) + {i : ι} (hi : i ∈ S) (hwi : w i = false) : + 0 < (falseNeighbors R w i).card := by + classical + have hn : ¬ ∀ j, R i j → w j = true := by + intro h + have he : i ∈ IsolatedFlip.eligible S R w := IsolatedFlip.mem_eligible.mpr ⟨hi, h⟩ + have hh := congrFun hw i + simp [IsolatedFlip.flip, he, hwi] at hh + push Not at hn + obtain ⟨j, hij, hj⟩ := hn + have hwj : w j = false := by cases h : w j <;> simp_all + exact Finset.card_pos.mpr ⟨j, by simp [falseNeighbors, hij, hwj]⟩ + +/-- The coincidence correction of a word with no isolated eligible position. +The exceptional positions `V \ S` include the external endpoint. -/ +theorem correction_le_of_fixed {V S : Finset ι} {R : ι → ι → Prop} + (hS : S ⊆ V) {w : ι → Bool} (hw : IsolatedFlip.flip S R w = w) + {A x : ℝ} (hA : 0 ≤ A) (hx : 0 ≤ x) (hx1 : x ≤ 1) : + correction V R A x w ≤ + (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := by + classical + unfold correction + rw [Finset.prod_filter] + calc + _ ≤ ∏ i ∈ V, if i ∈ S then 1 + A * x else 1 + A := by + apply Finset.prod_le_prod₀ + · intro i hi + split_ifs <;> positivity + · intro i hi + by_cases his : i ∈ S <;> by_cases hwi : w i = false + · simp only [ite_eq_left his, ite_eq_left hwi] + have hc := falseNeighbors_card_pos_of_fixed hw his hwi + have hp : x ^ (falseNeighbors R w i).card ≤ x := by + simpa using pow_le_pow_of_le_one hx hx1 (show 1 ≤ (falseNeighbors R w i).card by omega) + linarith [mul_le_mul_of_nonneg_left hp hA] + · simp only [ite_eq_left his, ite_eq_right hwi] + nlinarith [mul_nonneg hA hx] + · simp only [ite_eq_right his, ite_eq_left hwi] + have hp : x ^ (falseNeighbors R w i).card ≤ 1 := pow_le_one₀ hx hx1 + nlinarith + · simp only [ite_eq_right his, ite_eq_right hwi] + linarith + _ = (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := by + rw [Finset.prod_ite] + have hmem : V.filter (fun i => i ∈ S) = S := by + ext i + simp only [Finset.mem_filter] + exact ⟨fun h => h.2, fun h => ⟨hS h, h⟩⟩ + have hnot : V.filter (fun i => ¬ i ∈ S) = V \ S := by + ext i + simp + rw [hmem, hnot] + simp + +/-- With at most one exceptional V endpoint, the fixed-word correction has +the exact uniform bound used in the manuscript. -/ +theorem correction_le_endpoint_bound {V S : Finset ι} {R : ι → ι → Prop} + (hS : S ⊆ V) (hend : (V \ S).card ≤ 1) + {w : ι → Bool} (hw : IsolatedFlip.flip S R w = w) + {A x : ℝ} (hA : 0 ≤ A) (hx : 0 ≤ x) (hx1 : x ≤ 1) : + correction V R A x w ≤ (1 + A) * (1 + A * x) ^ V.card := by + have hpow : (1 + A * x) ^ S.card ≤ (1 + A * x) ^ V.card := + pow_le_pow_right₀ (by nlinarith) (Finset.card_le_card hS) + have hendpow : (1 + A) ^ (V \ S).card ≤ 1 + A := by + simpa using pow_le_pow_right₀ (by linarith : 1 ≤ 1 + A) hend + calc + correction V R A x w ≤ (1 + A * x) ^ S.card * (1 + A) ^ (V \ S).card := + correction_le_of_fixed hS hw hA hx hx1 + _ ≤ (1 + A * x) ^ V.card * (1 + A) := + mul_le_mul hpow hendpow (by positivity) (by positivity) + _ = (1 + A) * (1 + A * x) ^ V.card := mul_comm _ _ + +/-- The word summand without coincidence corrections. -/ +def baseWeight (edges : Finset (ι × ι)) (V : Finset ι) (A B x : ℝ) + (w : ι → Bool) : ℝ := + x ^ SwitchRestoration.switchCount edges w * + A ^ (V.filter fun i => w i = true).card * + B ^ ((Finset.univ \ V).filter fun i => w i = true).card + +theorem weight_eq_baseWeight (edges : Finset (ι × ι)) (V : Finset ι) + (R : ι → ι → Prop) (A B x : ℝ) (w : ι → Bool) : + weight edges V R A B x w = baseWeight edges V A B x w * correction V R A x w := rfl + +theorem baseWeight_nonneg (edges : Finset (ι × ι)) (V : Finset ι) + {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (w : ι → Bool) : + 0 ≤ baseWeight edges V A B x w := by + unfold baseWeight + positivity + +/-- Complete isolated-position correction removal, including the exceptional +endpoint factor and enlargement of the fixed-word sum to all words. -/ +theorem sum_weight_le_uncorrected {edges : Finset (ι × ι)} {V S : Finset ι} + {R : ι → ι → Prop} (hS : S ⊆ V) + (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + (hend : (V \ S).card ≤ 1) + {A B x : ℝ} (hA : 0 < A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hx1 : x ≤ 1) : + (∑ w : ι → Bool, weight edges V R A B x w) ≤ + (1 + x ^ 2 * (1 + A) / A) ^ S.card * + (1 + A) * (1 + A * x) ^ V.card * + ∑ w : ι → Bool, baseWeight edges V A B x w := by + classical + let fixed := Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w) + let C := (1 + A) * (1 + A * x) ^ V.card + have hC : 0 ≤ C := by dsimp [C]; positivity + have hsum : (∑ w ∈ fixed, weight edges V R A B x w) ≤ + C * ∑ w : ι → Bool, baseWeight edges V A B x w := by + calc + _ ≤ ∑ w ∈ fixed, C * baseWeight edges V A B x w := by + apply Finset.sum_le_sum + intro w hw + rw [weight_eq_baseWeight, mul_comm C] + exact mul_le_mul_of_nonneg_left + (correction_le_endpoint_bound hS hend (Finset.mem_filter.mp hw).2 hA.le hx hx1) + (baseWeight_nonneg edges V hA.le hB hx w) + _ = C * ∑ w ∈ fixed, baseWeight edges V A B x w := (Finset.mul_sum _ _ _).symm + _ ≤ C * ∑ w : ι → Bool, baseWeight edges V A B x w := by + apply mul_le_mul_of_nonneg_left _ hC + apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + intro w hw hn + exact baseWeight_nonneg edges V hA.le hB hx w + calc + _ ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card * + ∑ w ∈ fixed, weight edges V R A B x w := + sum_weight_le_fixed hS hV hR hdegree hA hB hx + _ ≤ (1 + x ^ 2 * (1 + A) / A) ^ S.card * + (C * ∑ w : ι → Bool, baseWeight edges V A B x w) := + mul_le_mul_of_nonneg_left hsum (by positivity) + _ = _ := by dsimp [C]; ring + +/-- The uniform correction-removal inequality in the form used by the +word-sum estimate: `A ≥ 1` bounds the flip cost by `1+2*x²`. -/ +theorem sum_weight_le_uniform_uncorrected {edges : Finset (ι × ι)} {V S : Finset ι} + {R : ι → ι → Prop} (hS : S ⊆ V) + (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + (hend : (V \ S).card ≤ 1) + {A B x : ℝ} (hA : 1 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hx1 : x ≤ 1) : + (∑ w : ι → Bool, weight edges V R A B x w) ≤ + (1 + 2 * x ^ 2) ^ V.card * (1 + A) * (1 + A * x) ^ V.card * + ∑ w : ι → Bool, baseWeight edges V A B x w := by + classical + have hAp : 0 < A := by linarith + have hfrac : (1 + A) / A ≤ 2 := (div_le_iff₀ hAp).mpr (by linarith) + have hc : x ^ 2 * (1 + A) / A ≤ 2 * x ^ 2 := by + rw [mul_div_assoc] + simpa only [mul_comm (x ^ 2) 2] using mul_le_mul_of_nonneg_left hfrac (sq_nonneg x) + have hF : (1 + x ^ 2 * (1 + A) / A) ^ S.card ≤ + (1 + 2 * x ^ 2) ^ V.card := by + calc + _ ≤ (1 + 2 * x ^ 2) ^ S.card := + pow_le_pow_left₀ (by positivity) (by linarith) S.card + _ ≤ (1 + 2 * x ^ 2) ^ V.card := + pow_le_pow_right₀ (by nlinarith [sq_nonneg x]) (Finset.card_le_card hS) + have hZ : 0 ≤ ∑ w : ι → Bool, baseWeight edges V A B x w := + Finset.sum_nonneg (fun w _ => baseWeight_nonneg edges V hAp.le hB hx w) + refine (sum_weight_le_uncorrected hS hV hR hdegree hend hAp hB hx hx1).trans ?_ + have h := mul_le_mul_of_nonneg_right hF + (show 0 ≤ (1 + A) * (1 + A * x) ^ V.card * + ∑ w : ι → Bool, baseWeight edges V A B x w by positivity) + simpa only [mul_assoc] using h + +end Problem335.IsolatedWeight + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/IteratedDerivative.lean b/lean/OAI/Algebra/DepthFive/IteratedDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6dcbf2141ece4045a7c78c1919b86c80b24cd4e --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/IteratedDerivative.lean @@ -0,0 +1,56 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem335 + +open MvPolynomial + +variable {K σ : Type*} [CommSemiring K] + +/-- Repeated partial differentiation acts by a falling factorial on each monomial. -/ +theorem iterate_pderiv_monomial (i : σ) (r : ℕ) (d : σ →₀ ℕ) (a : K) : + (pderiv i)^[r] (monomial d a) = + monomial (d - Finsupp.single i r) (a * (d i).descFactorial r) := by + classical + induction r with + | zero => simp + | succ r ih => + rw [Function.iterate_succ_apply', ih, pderiv_monomial, + Nat.descFactorial_succ] + simp only [Finsupp.tsub_apply, Finsupp.single_eq_same, Nat.cast_mul] + rw [show d - Finsupp.single i r - Finsupp.single i 1 = + d - Finsupp.single i (r + 1) by rw [tsub_tsub, Finsupp.single_add]] + congr 1 + ring + +/-- Derivatives beyond a monomial's exponent vanish, in any characteristic. -/ +theorem iterate_pderiv_monomial_eq_zero (i : σ) (r : ℕ) (d : σ →₀ ℕ) + (a : K) (h : d i < r) : + (pderiv i)^[r] (monomial d a) = 0 := by + rw [iterate_pderiv_monomial, Nat.descFactorial_eq_zero_iff_lt.mpr h] + simp + +/-- Coefficients of a repeated derivative are shifted coefficients times a rising factorial. -/ +theorem coeff_iterate_pderiv (i : σ) (r : ℕ) (p : MvPolynomial σ K) + (m : σ →₀ ℕ) : + ((pderiv i)^[r] p).coeff m = + p.coeff (m + Finsupp.single i r) * (m i + 1).ascFactorial r := by + classical + induction r generalizing p with + | zero => simp + | succ r ih => + rw [Function.iterate_succ_apply, ih, coeff_pderiv, Nat.ascFactorial_succ] + simp only [Finsupp.add_apply, Finsupp.single_eq_same, Nat.cast_mul] + rw [show m + Finsupp.single i r + Finsupp.single i 1 = + m + Finsupp.single i (r + 1) by rw [add_assoc, ← Finsupp.single_add]] + push_cast + ring + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LayeredFourPath.lean b/lean/OAI/Algebra/DepthFive/LayeredFourPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa82c9f2670d25039a4e536c393d757485075515 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LayeredFourPath.lean @@ -0,0 +1,114 @@ +import OAI.Algebra.DepthFive.FourPathLocal + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +namespace LayeredFourPath + +/-- Signed occupations, retaining the layer coordinate explicitly. -/ +def signedOccupation {T σ : Type*} (M : T → σ → ℕ) : T → σ → ℤ := + fun t x => M t x + +/-- Every path chooses exactly one coordinate in every layer. -/ +def signedShift {T σ : Type*} [DecidableEq σ] + (side : T → Bool) (p : T → σ) : T → σ → ℤ := + fun t x => (if side t then -1 else 1) * (Finsupp.single (p t) (1 : ℤ)) x + +/-- The Fock coefficient of a layered path. -/ +def amplitude {T σ : Type*} [Fintype T] + (side : T → Bool) (M : T → σ → ℕ) (p : T → σ) : ℝ := + ∏ t, LocalMoments.coefficient (side t) (M t (p t)) + +/-- Compatibility of global signed shifts gives the local pairing identity at every layer. -/ +theorem coordinate_matching_of_signedShift {T σ : Type*} [DecidableEq σ] + (side : T → Bool) (p q r s : T → σ) + (h : signedShift side p - signedShift side q = + signedShift side r - signedShift side s) (t : T) : + Finsupp.single (p t) (1 : ℤ) - Finsupp.single (q t) 1 = + Finsupp.single (r t) 1 - Finsupp.single (s t) 1 := by + ext x + have hx := congrArg (fun f : T → σ → ℤ => f t x) h + change (Finsupp.single (p t) (1 : ℤ)) x - (Finsupp.single (q t) 1) x = + (Finsupp.single (r t) 1) x - (Finsupp.single (s t) 1) x + cases ht : side t <;> simp [signedShift, ht] at hx <;> omega + +/-- An actual shifted source automatically satisfies the local occupation relation. -/ +theorem local_shift_of_signedOccupation {T σ : Type*} [DecidableEq σ] + (side : T → Bool) (M M' : T → σ → ℕ) (p q : T → σ) + (h : signedOccupation M' = + signedOccupation M + signedShift side p - signedShift side q) (t : T) : + LocalMoments.ShiftRelation (side t) (M t) (M' t) (p t) (q t) := by + intro x + have hx := congrArg (fun f : T → σ → ℤ => f t x) h + change (M' t x : ℤ) = (M t x : ℤ) + + (if side t then -1 else 1) * (Finsupp.single (p t) (1 : ℤ)) x - + (if side t then -1 else 1) * (Finsupp.single (q t) (1 : ℤ)) x at hx + rw [Finsupp.sub_apply] + rw [hx] + ring + +/-- The entire valid four-path coefficient is the product of the local occupation table. -/ +theorem amplitude_four_eq_local_product {T σ : Type*} [Fintype T] [DecidableEq σ] + (side : T → Bool) (M M' : T → σ → ℕ) (p q r s : T → σ) + (hmatch : signedShift side p - signedShift side q = + signedShift side r - signedShift side s) + (hshift : signedOccupation M' = + signedOccupation M + signedShift side p - signedShift side q) : + amplitude side M p * amplitude side M' q * amplitude side M r * amplitude side M' s = + ∏ t, LocalMoments.localPolynomial (side t) (M t) (p t) (q t) (r t) := by + exact LocalMoments.four_path_products_eq_localPolynomial_product Finset.univ + side M M' p q r s + (fun t _ => coordinate_matching_of_signedShift side p q r s hmatch t) + (fun t _ => local_shift_of_signedOccupation side M M' p q hshift t) + +/-- Lift the valid-source identity to a zero extension. Missing shifted source occupations +contribute zero, so an upper estimate needs no source-validity-closure hypothesis. -/ +theorem zeroExtended_amplitude_four_le_local_product + {I T σ : Type*} [Fintype T] [DecidableEq σ] + (side : T → Bool) (M : I → T → σ → ℕ) + (hinj : Function.Injective (fun i => signedOccupation (M i))) + (i : I) (p q r s : T → σ) + (hmatch : signedShift side p - signedShift side q = + signedShift side r - signedShift side s) : + amplitude side (M i) p * + Function.extend (fun k => signedOccupation (M k)) + (fun k => amplitude side (M k) q) (fun _ => 0) + (signedOccupation (M i) + signedShift side p - signedShift side q) * + amplitude side (M i) r * + Function.extend (fun k => signedOccupation (M k)) + (fun k => amplitude side (M k) s) (fun _ => 0) + (signedOccupation (M i) + signedShift side p - signedShift side q) ≤ + ∏ t, LocalMoments.localPolynomial (side t) (M i t) (p t) (q t) (r t) := by + classical + let x := signedOccupation (M i) + signedShift side p - signedShift side q + by_cases hx : ∃ k, signedOccupation (M k) = x + · obtain ⟨k, hk⟩ := hx + change amplitude side (M i) p * + Function.extend (fun k => signedOccupation (M k)) + (fun k => amplitude side (M k) q) (fun _ => 0) x * + amplitude side (M i) r * + Function.extend (fun k => signedOccupation (M k)) + (fun k => amplitude side (M k) s) (fun _ => 0) x ≤ _ + rw [← hk, hinj.extend_apply, hinj.extend_apply] + exact (amplitude_four_eq_local_product side (M i) (M k) p q r s hmatch hk).le + · have hz := Function.extend_apply' (f := fun k => signedOccupation (M k)) + (fun k => amplitude side (M k) q) (fun _ => (0 : ℝ)) x hx + change amplitude side (M i) p * + Function.extend (fun k => signedOccupation (M k)) + (fun k => amplitude side (M k) q) (fun _ => 0) x * + amplitude side (M i) r * + Function.extend (fun k => signedOccupation (M k)) + (fun k => amplitude side (M k) s) (fun _ => 0) x ≤ _ + rw [hz] + simp only [mul_zero, zero_mul] + exact Finset.prod_nonneg (fun t _ => LocalMoments.localPolynomial_nonneg _ _ _ _ _) + +end LayeredFourPath +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LocalFactorialExpansion.lean b/lean/OAI/Algebra/DepthFive/LocalFactorialExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..44244cfa37402804cb9c38e22cb5310c377cad0a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LocalFactorialExpansion.lean @@ -0,0 +1,124 @@ +import OAI.Algebra.DepthFive.FactorialPositive +import OAI.Algebra.DepthFive.FourPathLocal + +namespace OAI + +/-! The actual local four-path table has bounded nonnegative factorial expansions. -/ +namespace Problem335 + +open scoped BigOperators + +namespace FactorialExpansion + +variable {σ : Type*} [Fintype σ] + +/-- Enlarge the permitted support and total-order bound. -/ +def weaken {f : (σ → ℕ) → ℕ} {S T : Finset σ} {D E : ℕ} + (F : FactorialExpansion f S D) (hS : S ⊆ T) (hD : D ≤ E) : + FactorialExpansion f T E where + Index := F.Index + indexFintype := F.indexFintype + coeff := F.coeff + degree := F.degree + order_le := fun j => (F.order_le j).trans hD + supported := fun j i hi => F.supported j i (fun h => hi (hS h)) + eval_eq := F.eval_eq + +end FactorialExpansion + +namespace LocalMoments + +variable {σ : Type*} [DecidableEq σ] + +/-- Natural-valued version of the exact local table. -/ +def localPolynomialNat (derivative : Bool) (M : σ → ℕ) (p q r : σ) : ℕ := + if p = q then + if derivative then M p * M r else (M p + 1) * (M r + 1) + else if derivative then M p * (M q + 1) else (M p + 1) * M q + +@[simp] theorem localPolynomialNat_cast (derivative : Bool) (M : σ → ℕ) (p q r : σ) : + (localPolynomialNat derivative M p q r : ℝ) = localPolynomial derivative M p q r := by + cases derivative <;> by_cases h : p = q <;> simp [localPolynomialNat, localPolynomial, mass, h] + +/-- All branches of the local four-path table have total factorial order at most two. +The normal branch includes coincident coordinates and their first-order corrections. -/ +def localPolynomialExpansion [Fintype σ] (derivative : Bool) (p q r : σ) : + FactorialExpansion (fun M => localPolynomialNat derivative M p q r) {p, q, r} 2 := by + have hpr : ({p, r} : Finset σ) ⊆ {p, q, r} := by + intro i hi + simp only [Finset.mem_insert, Finset.mem_singleton] at * + tauto + have hpq : ({p, q} : Finset σ) ⊆ {p, q, r} := by + intro i hi + simp only [Finset.mem_insert, Finset.mem_singleton] at * + tauto + cases derivative + · by_cases h : p = q + · exact (FactorialExpansion.normalMultiplication p r).reframe + (by intro M; simp [localPolynomialNat, h]) hpr (le_refl 2) + · exact (FactorialExpansion.distinctMultiplication p q h).reframe + (by intro M; simp [localPolynomialNat, h]) hpq (le_refl 2) + · by_cases h : p = q + · exact (FactorialExpansion.normalDerivative p r).reframe + (by intro M; simp [localPolynomialNat, h]) hpr (le_refl 2) + · exact (FactorialExpansion.distinctDerivative p q h).reframe + (by intro M; simp [localPolynomialNat, h]) hpq (le_refl 2) + +/-- The natural polynomial for a finite set of layers. -/ +def localProductNat {ι : Type*} (layers : Finset ι) (derivative : ι → Bool) + (p q r : ι → σ) (M : σ → ℕ) : ℕ := + ∏ t ∈ layers, localPolynomialNat (derivative t) M (p t) (q t) (r t) + +@[simp] theorem localProductNat_cast {ι : Type*} (layers : Finset ι) + (derivative : ι → Bool) (p q r : ι → σ) (M : σ → ℕ) : + (localProductNat layers derivative p q r M : ℝ) = + ∏ t ∈ layers, localPolynomial (derivative t) M (p t) (q t) (r t) := by + simp [localProductNat] + +/-- This finite product is the exact nonnegative factorial expansion required +by the occupation-moment comparison, rather than an assumed positivity property. -/ +theorem localProduct_expansion {ι : Type*} [Fintype σ] (layers : Finset ι) + (derivative : ι → Bool) (p q r : ι → σ) + (hdis : (layers : Set ι).Pairwise fun i j => + Disjoint ({p i, q i, r i} : Finset σ) {p j, q j, r j}) : + Nonempty (FactorialExpansion (localProductNat layers derivative p q r) + (layers.biUnion fun i => {p i, q i, r i}) (2 * layers.card)) := by + have h := FactorialExpansion.nonempty_prod layers + (fun i M => localPolynomialNat (derivative i) M (p i) (q i) (r i)) + (fun i => {p i, q i, r i}) (fun _ => 2) + (fun i => localPolynomialExpansion (derivative i) (p i) (q i) (r i)) hdis + convert h using 1 + simp [Nat.mul_comm] + congr 1 + +/-- Layer-labelled coordinates automatically have disjoint local supports. -/ +theorem layered_support_disjoint {ι κ : Type*} [DecidableEq ι] [DecidableEq κ] + (layers : Finset ι) (p q r : ι → κ) : + (layers : Set ι).Pairwise fun i j => + Disjoint ({(i, p i), (i, q i), (i, r i)} : Finset (ι × κ)) + {(j, p j), (j, q j), (j, r j)} := by + intro i hi j hj hij + apply Finset.disjoint_left.mpr + intro x hx hy + have hx' : x.1 = i := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with h | h | h <;> simp [h] + have hy' : x.1 = j := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hy + rcases hy with h | h | h <;> simp [h] + exact hij (hx'.symm.trans hy') + +/-- Specialization to the actual matrix-layer coordinate shape. -/ +theorem layered_localProduct_expansion {ι κ : Type*} + [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → κ) : + Nonempty (FactorialExpansion + (localProductNat layers derivative (fun i => (i, p i)) + (fun i => (i, q i)) (fun i => (i, r i))) + (layers.biUnion fun i => {(i, p i), (i, q i), (i, r i)}) (2 * layers.card)) := + localProduct_expansion layers derivative _ _ _ (layered_support_disjoint layers p q r) + +end LocalMoments +end Problem335 + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LocalMomentPairing.lean b/lean/OAI/Algebra/DepthFive/LocalMomentPairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..687768d8bce56991b3a4d6ae181ce3f5e5d30ab4 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LocalMomentPairing.lean @@ -0,0 +1,75 @@ +import OAI.Algebra.DepthFive.SecondMomentNormalization +import OAI.Algebra.DepthFive.FactorialGeometricValue + +namespace OAI + +/-! The actual geometric local table agrees with the canonical pairing +normalization, including coincident coordinates in the normal class. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335.MomentPairing + +open Pairings + +theorem localGeometricMass_eq_moment {γ : Type*} [DecidableEq γ] + (side : Bool) (A B : ℝ) (x : Labels γ) : + LocalMoments.localGeometricMass side (if side then A else B) x.p x.q x.r = + LocalMomentWeights.moment side (isDiagonal (classifyLayer x)) + (coincides x) A B := by + classical + cases side <;> by_cases hpq : x.p = x.q <;> + simp [LocalMoments.localGeometricMass, LocalMoments.normalGeometricMass, + LocalMoments.diagonalGeometricMass, LocalMomentWeights.moment, + classifyLayer, isDiagonal, coincides, hpq] + +/-- No compatibility assumption is needed for this algebraic identity: the +canonical class always chooses the normal branch precisely when `p=q`. -/ +theorem prod_localGeometricMass_eq {γ : Type*} [DecidableEq γ] {L : ℕ} + (side : Fin (L + 1) → Bool) (A B : ℝ) + (endpoint : γ) (x : Fin L → Labels γ) : + (∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) = + pathGeometricMoment side A B endpoint (classifyWord endpoint x) x := by + unfold pathGeometricMoment classifyWord + apply Finset.prod_congr rfl + intro t _ + exact localGeometricMass_eq_moment _ _ _ _ + +theorem prod_localGeometricMass_eq_normalized {γ : Type*} [DecidableEq γ] {L : ℕ} + (side : Fin (L + 1) → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) + (endpoint : γ) (x : Fin L → Labels γ) : + (∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) = + pathMean side A B ^ 2 * pathWeight side (A / (A + 1)) (B / (B + 1)) + endpoint (classifyWord endpoint x) x := by + rw [prod_localGeometricMass_eq, pathGeometricMoment_eq side hA hB] + +/-- Concrete input interface for occupation averaging: the geometric RHS is +the actual local polynomial table, rather than an assumed pairing weight. -/ +theorem sum_sources_local_moments_le {ι γ : Type*} [Fintype ι] + [Fintype γ] [DecidableEq γ] {L : ℕ} + (side : Fin (L + 1) → Bool) {A B D : ℝ} + (hA : 0 < A) (hB : 0 ≤ B) (hD : 0 ≤ D) (endpoint : γ) + (C : ι → (Fin L → Labels γ) → ℝ) + (hexpect : ∀ x, Compatible endpoint x → + (∑ i, C i x) ≤ D * + ∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) : + (∑ i, ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, C i x.1) ≤ + D * pathMean side A B ^ 2 * + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight side (A / (A + 1)) (B / (B + 1)) endpoint τ x.1 := by + apply sum_sources_compatible_le side hA hB hD endpoint C + intro x hx + simpa only [prod_localGeometricMass_eq] using hexpect x hx + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LocalMomentPolynomials.lean b/lean/OAI/Algebra/DepthFive/LocalMomentPolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..9508b91661533d67d3caaff1f25986814ed1622d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LocalMomentPolynomials.lean @@ -0,0 +1,174 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +namespace LocalMoments + +/-- Squared local Fock coefficient, with `true` denoting differentiation. -/ +def mass (derivative : Bool) (z : ℕ) : ℝ := + if derivative then z else z + 1 + +def coefficient (derivative : Bool) (z : ℕ) : ℝ := + Real.sqrt (mass derivative z) + +lemma mass_nonneg (derivative : Bool) (z : ℕ) : 0 ≤ mass derivative z := by + cases derivative <;> dsimp [mass] + all_goals positivity + +@[simp] lemma coefficient_sq (derivative : Bool) (z : ℕ) : + coefficient derivative z ^ 2 = mass derivative z := + Real.sq_sqrt (mass_nonneg derivative z) + +/-- One layer's four factors in the second trace. -/ +def fourCoefficient (derivative : Bool) (a b c d : ℕ) : ℝ := + coefficient derivative a * coefficient derivative b * + coefficient derivative c * coefficient derivative d + +/-- The normal pairing has zero occupation shift. -/ +lemma normal_fourCoefficient (derivative : Bool) (a b : ℕ) : + fourCoefficient derivative a a b b = mass derivative a * mass derivative b := by + calc + _ = coefficient derivative a ^ 2 * coefficient derivative b ^ 2 := by + unfold fourCoefficient + ring + _ = _ := by rw [coefficient_sq, coefficient_sq] + +/-- Differentiating diagonal pairing: the second path receives one occupation. -/ +lemma derivative_diagonal_fourCoefficient (a b : ℕ) : + fourCoefficient true a (b + 1) a (b + 1) = (a : ℝ) * ((b : ℝ) + 1) := by + calc + _ = coefficient true a ^ 2 * coefficient true (b + 1) ^ 2 := by + unfold fourCoefficient + ring + _ = _ := by simp [mass] + +/-- Multiplying diagonal pairing, expressed without natural subtraction. -/ +lemma multiplication_diagonal_fourCoefficient (a b : ℕ) : + fourCoefficient false a b a b = ((a : ℝ) + 1) * ((b : ℝ) + 1) := by + calc + _ = coefficient false a ^ 2 * coefficient false b ^ 2 := by + unfold fourCoefficient + ring + _ = _ := by simp [mass] + +lemma multiplication_diagonal_fourCoefficient_pred (a b : ℕ) (hb : 0 < b) : + fourCoefficient false a (b - 1) a (b - 1) = ((a : ℝ) + 1) * (b : ℝ) := by + rw [multiplication_diagonal_fourCoefficient] + have h : (b - 1 : ℕ) + 1 = b := by omega + have hr := congrArg (fun n : ℕ => (n : ℝ)) h + push_cast at hr + rw [hr] + +/-- The unavailable differentiation contribution vanishes identically. -/ +@[simp] lemma derivative_invalid (b : ℕ) : + (0 : ℝ) * ((b : ℝ) + 1) = 0 := zero_mul _ + +/-- If the multiplication shift would create a negative source occupation, +its table contribution is zero. -/ +@[simp] lemma multiplication_invalid (a : ℕ) : + ((a : ℝ) + 1) * (0 : ℝ) = 0 := mul_zero _ + +/-- Move the four path products into a product of local four-factor entries. -/ +lemma four_products_eq_product {ι : Type*} (s : Finset ι) + (derivative : ι → Bool) (a b c d : ι → ℕ) : + (∏ i ∈ s, coefficient (derivative i) (a i)) * + (∏ i ∈ s, coefficient (derivative i) (b i)) * + (∏ i ∈ s, coefficient (derivative i) (c i)) * + (∏ i ∈ s, coefficient (derivative i) (d i)) = + ∏ i ∈ s, fourCoefficient (derivative i) (a i) (b i) (c i) (d i) := by + simp only [fourCoefficient, Finset.prod_mul_distrib] + +/-- Version of the normal pairing usable with occupation functions. -/ +lemma normal_layer {σ : Type*} (derivative : Bool) (M M' : σ → ℕ) (i j : σ) + (hi : M' i = M i) (hj : M' j = M j) : + fourCoefficient derivative (M i) (M' i) (M j) (M' j) = + mass derivative (M i) * mass derivative (M j) := by + rw [hi, hj, normal_fourCoefficient] + +lemma derivative_diagonal_layer {σ : Type*} (M M' : σ → ℕ) (i j : σ) + (hj : M' j = M j + 1) : + fourCoefficient true (M i) (M' j) (M i) (M' j) = + (M i : ℝ) * ((M j : ℝ) + 1) := by + rw [hj, derivative_diagonal_fourCoefficient] + +lemma multiplication_diagonal_layer {σ : Type*} (M M' : σ → ℕ) (i j : σ) + (hj : M' j + 1 = M j) : + fourCoefficient false (M i) (M' j) (M i) (M' j) = + ((M i : ℝ) + 1) * (M j : ℝ) := by + rw [multiplication_diagonal_fourCoefficient] + have hr := congrArg (fun n : ℕ => (n : ℝ)) hj + push_cast at hr + rw [hr] + +/-- The multiplying diagonal term, extended by zero when its backward shift is invalid. -/ +def multiplicationDiagonalTerm (a b : ℕ) : ℝ := + if b = 0 then 0 else fourCoefficient false a (b - 1) a (b - 1) + +lemma multiplicationDiagonalTerm_eq (a b : ℕ) : + multiplicationDiagonalTerm a b = ((a : ℝ) + 1) * (b : ℝ) := by + by_cases hb : b = 0 + · simp [multiplicationDiagonalTerm, hb] + · simp only [multiplicationDiagonalTerm, hb, ↓reduceIte] + exact multiplication_diagonal_fourCoefficient_pred a b (Nat.pos_of_ne_zero hb) + +lemma square_fallingFactorial (z : ℕ) : + (z : ℝ)^2 = (z.descFactorial 2 : ℝ) + (z : ℝ) := by + cases z with + | zero => norm_num + | succ z => simp [Nat.descFactorial_succ]; ring + +lemma successor_square_fallingFactorial (z : ℕ) : + ((z : ℝ) + 1)^2 = (z.descFactorial 2 : ℝ) + 3 * (z : ℝ) + 1 := by + rw [show ((z : ℝ) + 1)^2 = (z : ℝ)^2 + 2 * z + 1 by ring, + square_fallingFactorial] + ring + +/-- Geometric first/second-moment input, before normalization, for normal pairings. -/ +def normalGeometricMass (derivative : Bool) (G : ℝ) (collision : Bool) : ℝ := + if derivative then + if collision then 2 * G^2 + G else G^2 + else + if collision then 2 * G^2 + 3 * G + 1 else (G + 1)^2 + +def diagonalGeometricMass (G : ℝ) : ℝ := G * (G + 1) + +lemma derivative_normal_weight (G : ℝ) (hG : 0 < G) (collision : Bool) : + normalGeometricMass true G collision / G^2 = + 1 + (G / (G + 1))⁻¹ * (if collision then 1 else 0) := by + have h0 : G ≠ 0 := ne_of_gt hG + have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) + cases collision <;> simp [normalGeometricMass, h0] + all_goals field_simp + all_goals ring + +lemma multiplication_normal_weight (G : ℝ) (hG : 0 ≤ G) (collision : Bool) : + normalGeometricMass false G collision / (G + 1)^2 = + 1 + (G / (G + 1)) * (if collision then 1 else 0) := by + have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) + cases collision <;> simp [normalGeometricMass, h1] + all_goals field_simp + all_goals ring + +lemma derivative_diagonal_weight (G : ℝ) (hG : 0 < G) : + diagonalGeometricMass G / G^2 = (G / (G + 1))⁻¹ := by + have h0 : G ≠ 0 := ne_of_gt hG + have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) + unfold diagonalGeometricMass + field_simp + +lemma multiplication_diagonal_weight (G : ℝ) (hG : 0 ≤ G) : + diagonalGeometricMass G / (G + 1)^2 = G / (G + 1) := by + have h1 : G + 1 ≠ 0 := ne_of_gt (by linarith) + unfold diagonalGeometricMass + field_simp + +end LocalMoments +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LocalMomentWeights.lean b/lean/OAI/Algebra/DepthFive/LocalMomentWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..708b8d50b801fa1e280fc4d0a0aa7b33177b0de1 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LocalMomentWeights.lean @@ -0,0 +1,107 @@ +import Mathlib + +namespace OAI + +/-! Normalization of the local geometric occupation moments in the four-path +trace expansion. Missing derivative occupations are handled by local-polynomial +identities, preserving the repeated-coordinate second moment rather than +treating it as a product of independent moments. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335.LocalMomentWeights + +/-- `isD` denotes the nonzero-difference pairing. `same` is relevant only in +its complementary pairing, where the two selected coordinates may coincide. -/ +def moment (isV isD same : Bool) (A B : ℝ) : ℝ := + if isV then + if isD then A * (A + 1) else if same then 2 * A ^ 2 + A else A ^ 2 + else + if isD then B * (B + 1) else if same then 2 * B ^ 2 + 3 * B + 1 + else (B + 1) ^ 2 + +/-- The square of the first-moment factor at a layer. -/ +def scale (isV : Bool) (A B : ℝ) : ℝ := + if isV then A ^ 2 else (B + 1) ^ 2 + +/-- The exact local weights after division by the first-moment square. -/ +def weight (isV isD same : Bool) (alpha beta : ℝ) : ℝ := + if isV then + if isD then alpha⁻¹ else 1 + if same then alpha⁻¹ else 0 + else + if isD then beta else 1 + if same then beta else 0 + +lemma scale_pos (isV : Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : + 0 < scale isV A B := by + cases isV <;> simp only [scale, Bool.false_eq_true, ↓reduceIte] <;> positivity + +lemma weight_nonneg (isV isD same : Bool) {alpha beta : ℝ} + (ha : 0 < alpha) (hb : 0 ≤ beta) : 0 ≤ weight isV isD same alpha beta := by + cases isV <;> cases isD <;> cases same <;> simp [weight] <;> positivity + +/-- Repeated-coordinate geometric second moments give the additional term +`alpha⁻¹` or `beta` exactly. -/ +theorem moment_eq_scale_mul_weight (isV isD same : Bool) {A B : ℝ} + (hA : 0 < A) (hB : 0 ≤ B) : + moment isV isD same A B = + scale isV A B * weight isV isD same (A / (A + 1)) (B / (B + 1)) := by + have hA0 : A ≠ 0 := ne_of_gt hA + have hAp : A + 1 ≠ 0 := by linarith + have hBp : B + 1 ≠ 0 := by linarith + cases isV <;> cases isD <;> cases same <;> + simp [moment, scale, weight] <;> field_simp <;> ring + +lemma moment_div_scale (isV isD same : Bool) {A B : ℝ} + (hA : 0 < A) (hB : 0 ≤ B) : + moment isV isD same A B / scale isV A B = + weight isV isD same (A / (A + 1)) (B / (B + 1)) := by + rw [moment_eq_scale_mul_weight _ _ _ hA hB] + exact mul_div_cancel_left₀ _ (scale_pos isV hA hB).ne' + +/-- The normalized means agree with the original degree/cardinality ratios. -/ +lemma mean_ratio {a v : ℝ} (hv : 0 < v) (ha : 0 ≤ a) : + (a / v) / (a / v + 1) = a / (a + v) := by + have hv0 : v ≠ 0 := ne_of_gt hv + have hap : a + v ≠ 0 := by linarith + field_simp + +/-- A pointwise normalization can be factored out of the entire layer product. -/ +theorem prod_moment_eq {ι : Type*} (s : Finset ι) + (isV isD same : ι → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : + (∏ i ∈ s, moment (isV i) (isD i) (same i) A B) = + (∏ i ∈ s, scale (isV i) A B) * + ∏ i ∈ s, weight (isV i) (isD i) (same i) (A / (A + 1)) (B / (B + 1)) := by + simp_rw [moment_eq_scale_mul_weight _ _ _ hA hB] + exact Finset.prod_mul_distrib + +/-- The product of the local normalization factors is exactly `mu^2`. -/ +theorem prod_scale_eq {ι : Type*} (s : Finset ι) (isV : ι → Bool) (A B : ℝ) : + (∏ i ∈ s, scale (isV i) A B) = + (A ^ (s.filter (fun i => isV i = true)).card * + (B + 1) ^ (s.filter (fun i => isV i = false)).card) ^ 2 := by + classical + simp only [scale] + rw [Finset.prod_ite] + simp only [Finset.prod_const] + have hfilter : s.filter (fun i => ¬isV i = true) = + s.filter (fun i => isV i = false) := by + ext i + cases isV i <;> simp + rw [hfilter, mul_pow] + congr 1 <;> rw [← pow_mul, ← pow_mul] <;> congr 1 <;> omega + +/-- Full local-weight normalization for a fixed four-path pairing pattern. -/ +theorem prod_moment_eq_mu_sq_mul {ι : Type*} (s : Finset ι) + (isV isD same : ι → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) : + (∏ i ∈ s, moment (isV i) (isD i) (same i) A B) = + (A ^ (s.filter (fun i => isV i = true)).card * + (B + 1) ^ (s.filter (fun i => isV i = false)).card) ^ 2 * + ∏ i ∈ s, weight (isV i) (isD i) (same i) (A / (A + 1)) (B / (B + 1)) := by + rw [prod_moment_eq s isV isD same hA hB, prod_scale_eq] + +end Problem335.LocalMomentWeights + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LocalOccupationAverage.lean b/lean/OAI/Algebra/DepthFive/LocalOccupationAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f59ed2a3a7e2580d7d0f27ff6be929251492b5a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LocalOccupationAverage.lean @@ -0,0 +1,122 @@ +import OAI.Algebra.DepthFive.FactorialPositive +import OAI.Algebra.DepthFive.OccupationExpansion + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ : Type*} [Fintype σ] + +/-- Reassemble two occupation vectors on the complementary variable classes. -/ +def joinOccupation (side : σ → Bool) + (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) : σ → ℕ := + fun i => if h : side i = true then M ⟨i, h⟩ else N ⟨i, h⟩ + +omit [Fintype σ] in +@[simp] theorem joinOccupation_true (side : σ → Bool) + (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) + (i : {i // side i = true}) : joinOccupation side M N i = M i := by + simp [joinOccupation, i.property] + +omit [Fintype σ] in +@[simp] theorem joinOccupation_false (side : σ → Bool) + (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) + (i : {i // ¬ side i = true}) : joinOccupation side M N i = N i := by + simp [joinOccupation, i.property] + +theorem factorialMonomial_joinOccupation (side : σ → Bool) (d : σ → ℕ) + (M : {i // side i = true} → ℕ) (N : {i // ¬ side i = true} → ℕ) : + factorialMonomial d (joinOccupation side M N) = + (∏ i, (M i).descFactorial (d i)) * (∏ i, (N i).descFactorial (d i)) := by + classical + unfold factorialMonomial + rw [← Fintype.prod_subtype_mul_prod_subtype (fun i => side i = true)] + simp + +variable [DecidableEq σ] + +/-- The actual finite uniform average, not an assumed moment functional. -/ +def partitionCompositionMean (side : σ → Bool) (f : (σ → ℕ) → ℝ) (a b : ℕ) : ℝ := by + classical + exact (∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset {i // side i = true}) a, + (∑ N ∈ Finset.finsuppAntidiag (Finset.univ : Finset {i // ¬ side i = true}) b, + f (joinOccupation side M N)) / + (Finset.finsuppAntidiag (Finset.univ : Finset {i // ¬ side i = true}) b).card) / + (Finset.finsuppAntidiag (Finset.univ : Finset {i // side i = true}) a).card + +namespace FactorialExpansion +variable {f : (σ → ℕ) → ℕ} {S : Finset σ} {D : ℕ} + +theorem partitionCompositionMean_eq (F : FactorialExpansion f S D) + (side : σ → Bool) (a b : ℕ) : + Problem335.partitionCompositionMean side (fun M => (f M : ℝ)) a b = + twoGroupCompositionExpansionMean Finset.univ (fun j => (F.coeff j : ℝ)) + (fun j (i : {i // side i = true}) => F.degree j i) + (fun j (i : {i // ¬ side i = true}) => F.degree j i) a b := by + classical + unfold Problem335.partitionCompositionMean twoGroupCompositionExpansionMean + compositionExpansionMean factorialExpansionValue + apply congrArg (fun x : ℝ => x / _) + apply Finset.sum_congr rfl + intro M hM + apply congrArg (fun x : ℝ => x / _) + apply Finset.sum_congr rfl + intro N hN + dsimp only + rw [F.eval_real] + apply Finset.sum_congr rfl + intro j hj + rw [factorialMonomial_joinOccupation] + push_cast + ring + +omit [DecidableEq σ] in +/-- The two means give one coordinate-wise geometric factorial monomial. -/ +theorem partition_geometric_monomial (side : σ → Bool) (d : σ → ℕ) (A B : ℝ) : + (∏ i, (d i).factorial * (if side i = true then A else B) ^ d i : ℝ) = + (∏ i : {i // side i = true}, ((d i).factorial : ℝ)) * + (∏ i : {i // ¬ side i = true}, ((d i).factorial : ℝ)) * + (A ^ (∑ i : {i // side i = true}, d i) * + B ^ (∑ i : {i // ¬ side i = true}, d i)) := by + classical + rw [← Fintype.prod_subtype_mul_prod_subtype (fun i => side i = true)] + have hV (i : {i // side i = true}) : (if side i = true then A else B) = A := + ite_eq_left i.property + have hU (i : {i // ¬ side i = true}) : (if side i = true then A else B) = B := + ite_eq_right i.property + simp_rw [hV, hU] + simp only [Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum] + ring + +/-- Upper occupation comparison for every concrete nonnegative factorial expansion. +No total-order restriction is necessary for this upper bound. -/ +theorem partitionCompositionMean_le (F : FactorialExpansion f S D) + (side : σ → Bool) [Nonempty {i // side i = true}] [Nonempty {i // ¬ side i = true}] + (a b : ℕ) : + Problem335.partitionCompositionMean side (fun M => (f M : ℝ)) a b ≤ + ∑ j, (F.coeff j : ℝ) * ∏ i, ((F.degree j i).factorial : ℝ) * + (if side i = true then (a : ℝ) / Fintype.card {i // side i = true} + else (b : ℝ) / Fintype.card {i // ¬ side i = true}) ^ F.degree j i := by + classical + rw [F.partitionCompositionMean_eq] + have h := twoGroupCompositionExpansionMean_le_geometric Finset.univ + (fun j => (F.coeff j : ℝ)) + (fun j (i : {i // side i = true}) => F.degree j i) + (fun j (i : {i // ¬ side i = true}) => F.degree j i) a b + (by intro j hj; positivity) + refine h.trans_eq ?_ + unfold twoGroupGeometricExpansionValue + apply Finset.sum_congr rfl + intro j hj + rw [partition_geometric_monomial] + ring + +end FactorialExpansion +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LocalProductAverage.lean b/lean/OAI/Algebra/DepthFive/LocalProductAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..30b5b7d78dcaebced0c3d11fdadc5c5185d80705 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LocalProductAverage.lean @@ -0,0 +1,104 @@ +import OAI.Algebra.DepthFive.LocalOccupationAverage +import OAI.Algebra.DepthFive.FactorialGeometricValue + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +namespace LocalMoments + +variable {σ ι : Type*} [Fintype σ] [DecidableEq σ] + +/-- The actual occupation average of the full local four-path table is bounded +by the product of its independent geometric local moments. -/ +theorem partitionCompositionMean_localProduct_le + (side : σ → Bool) [Nonempty {i // side i = true}] [Nonempty {i // ¬ side i = true}] + (a b : ℕ) (layers : Finset ι) (derivative : ι → Bool) (p q r : ι → σ) + (hp : ∀ t ∈ layers, side (p t) = derivative t) + (hq : ∀ t ∈ layers, side (q t) = derivative t) + (hr : ∀ t ∈ layers, side (r t) = derivative t) + (hdis : (layers : Set ι).Pairwise fun i j => + Disjoint ({p i, q i, r i} : Finset σ) {p j, q j, r j}) : + partitionCompositionMean side + (fun M => ∏ t ∈ layers, localPolynomial (derivative t) M (p t) (q t) (r t)) a b ≤ + ∏ t ∈ layers, localGeometricMass (derivative t) + (if derivative t = true then (a : ℝ) / Fintype.card {i // side i = true} + else (b : ℝ) / Fintype.card {i // ¬ side i = true}) (p t) (q t) (r t) := by + classical + let G : σ → ℝ := fun i => + if side i = true then (a : ℝ) / Fintype.card {i // side i = true} + else (b : ℝ) / Fintype.card {i // ¬ side i = true} + let g : ι → ℝ := fun t => + if derivative t = true then (a : ℝ) / Fintype.card {i // side i = true} + else (b : ℝ) / Fintype.card {i // ¬ side i = true} + obtain ⟨F, hF⟩ := exists_localProduct_geometricValue_of_eq layers derivative p q r G g + (by intro t ht; simp only [G, g, hp t ht]) + (by intro t ht; simp only [G, g, hq t ht]) + (by intro t ht; simp only [G, g, hr t ht]) hdis + have hmean := F.partitionCompositionMean_le side a b + change partitionCompositionMean side + (fun M => (localProductNat layers derivative p q r M : ℝ)) a b ≤ F.geometricValue G at hmean + rw [hF] at hmean + simpa only [localProductNat_cast] using hmean + +/-- Specialization to the matrix-layer coordinate shape: disjoint supports and +the common local mean are automatic, not additional analytic assumptions. -/ +theorem partitionCompositionMean_layered_localProduct_le + {κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + (derivative : ι → Bool) + [Nonempty {x : ι × κ // derivative x.1 = true}] + [Nonempty {x : ι × κ // ¬ derivative x.1 = true}] + (a b : ℕ) (layers : Finset ι) (p q r : ι → κ) : + partitionCompositionMean (fun x : ι × κ => derivative x.1) + (fun M => ∏ t ∈ layers, localPolynomial (derivative t) M + (t, p t) (t, q t) (t, r t)) a b ≤ + ∏ t ∈ layers, localGeometricMass (derivative t) + (if derivative t = true then + (a : ℝ) / Fintype.card {x : ι × κ // derivative x.1 = true} + else (b : ℝ) / Fintype.card {x : ι × κ // ¬ derivative x.1 = true}) + (t, p t) (t, q t) (t, r t) := by + apply partitionCompositionMean_localProduct_le (fun x : ι × κ => derivative x.1) + a b layers derivative (fun t => (t, p t)) (fun t => (t, q t)) (fun t => (t, r t)) + · intros; rfl + · intros; rfl + · intros; rfl + · exact layered_support_disjoint layers p q r + +/-- Coordinate-form conversion to the local table used in the four-path identity. -/ +@[simp] theorem localPolynomial_layered {κ : Type*} [DecidableEq ι] [DecidableEq κ] + (d : Bool) (M : ι × κ → ℕ) (t : ι) (p q r : κ) : + localPolynomial d M (t, p) (t, q) (t, r) = + localPolynomial d (fun x => M (t, x)) p q r := by + simp [localPolynomial] + +@[simp] theorem localGeometricMass_layered {κ : Type*} [DecidableEq ι] [DecidableEq κ] + (d : Bool) (G : ℝ) (t : ι) (p q r : κ) : + localGeometricMass d G (t, p) (t, q) (t, r) = localGeometricMass d G p q r := by + simp [localGeometricMass] + +/-- Row-restriction presentation matching the actual four-path local table directly. -/ +theorem partitionCompositionMean_layered_restrict_le + {κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + (derivative : ι → Bool) + [Nonempty {x : ι × κ // derivative x.1 = true}] + [Nonempty {x : ι × κ // ¬ derivative x.1 = true}] + (a b : ℕ) (layers : Finset ι) (p q r : ι → κ) : + partitionCompositionMean (fun x : ι × κ => derivative x.1) + (fun M => ∏ t ∈ layers, localPolynomial (derivative t) (fun x => M (t, x)) + (p t) (q t) (r t)) a b ≤ + ∏ t ∈ layers, localGeometricMass (derivative t) + (if derivative t = true then + (a : ℝ) / Fintype.card {x : ι × κ // derivative x.1 = true} + else (b : ℝ) / Fintype.card {x : ι × κ // ¬ derivative x.1 = true}) + (p t) (q t) (r t) := by + simpa only [localPolynomial_layered, localGeometricMass_layered] using + partitionCompositionMean_layered_localProduct_le derivative a b layers p q r + +end LocalMoments +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LowDegreeWeights.lean b/lean/OAI/Algebra/DepthFive/LowDegreeWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b004a01bd2ad461306e3fa37a1718e9970d6883 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowDegreeWeights.lean @@ -0,0 +1,123 @@ +import OAI.Algebra.DepthFive.DegreeWeight +import OAI.Algebra.DepthFive.DegreeProductBounds +import OAI.Algebra.DepthFive.SmallDegreeCorrections + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Problem335 + +lemma degreeWeight_nonneg {q : ℝ} (hq : 0 ≤ q) (lam : ℝ) (e : ℕ) : + 0 ≤ degreeWeight q lam e := + Finset.sum_nonneg (fun _ _ => Real.rpow_nonneg hq _) + +lemma degreeWeight_le_five_mul_distance {q : ℝ} (hq : 0 < q) (hqhalf : q ≤ 1 / 2) + (lam : ℝ) (e : ℕ) : + degreeWeight q lam e ≤ 5 * q ^ nearestIntegerDistance (lam * e) := by + have hq1 : q ≤ 1 := by linarith + have hd := nearestIntegerDistance_le_half (lam * e) + have htail := Real.rpow_le_one hq.le hq1 + (show 0 ≤ 1 - 2 * nearestIntegerDistance (lam * e) by linarith) + calc + degreeWeight q lam e ≤ q ^ nearestIntegerDistance (lam * e) * + (1 + 4 * q ^ (1 - 2 * nearestIntegerDistance (lam * e))) := + degreeWeight_le_nearest hq hqhalf lam e + _ ≤ q ^ nearestIntegerDistance (lam * e) * 5 := + mul_le_mul_of_nonneg_left (by linarith) (Real.rpow_nonneg hq.le _) + _ = _ := mul_comm _ _ + +lemma low_odd_degreeWeight_le {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) + (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) + {e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) (hodd : Odd e) : + degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ (degreeDistance n s e / 2) := by + have hq1 : q ≤ 1 := by linarith + have hd := degreeDistance_odd_ge hn hs he helow hodd + have hp : q ^ (degreeDistance n s e / 2) ≤ q ^ ((3 : ℝ) / 16) := + Real.rpow_le_rpow_of_exponent_ge hq hq1 (by linarith) + have hp5 : 5 * q ^ (degreeDistance n s e / 2) ≤ 1 := + (mul_le_mul_of_nonneg_left hp (by norm_num)).trans hqsmall + have hbound := degreeWeight_le_five_mul_distance hq hqhalf (1 / 2 - s / (2 * n)) e + change degreeWeight q (1 / 2 - s / (2 * n)) e ≤ 5 * q ^ degreeDistance n s e at hbound + calc + degreeWeight q (1 / 2 - s / (2 * n)) e ≤ 5 * q ^ degreeDistance n s e := hbound + _ = (5 * q ^ (degreeDistance n s e / 2)) * q ^ (degreeDistance n s e / 2) := by + rw [mul_assoc, ← Real.rpow_add hq] + congr 2 + ring + _ ≤ 1 * q ^ (degreeDistance n s e / 2) := + mul_le_mul_of_nonneg_right hp5 (Real.rpow_nonneg hq.le _) + _ = _ := one_mul _ + +lemma low_even_degreeWeight_le {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) + (hq : 0 < q) (hqhalf : q ≤ 1 / 2) + {e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) (heven : Even e) : + degreeWeight q (1 / 2 - s / (2 * n)) e ≤ + q ^ degreeDistance n s e * Real.exp (4 * q ^ (1 - s * e / n)) := by + have hbound := degreeWeight_le_nearest hq hqhalf (1 / 2 - s / (2 * n)) e + change degreeWeight q (1 / 2 - s / (2 * n)) e ≤ q ^ degreeDistance n s e * + (1 + 4 * q ^ (1 - 2 * degreeDistance n s e)) at hbound + have hexponent : 1 - 2 * degreeDistance n s e = 1 - s * e / n := by + rw [degreeDistance_even hn hs he helow heven] + ring + rw [hexponent] at hbound + exact hbound.trans (mul_le_mul_of_nonneg_left + (by linarith [Real.add_one_le_exp (4 * q ^ (1 - s * e / n))]) + (Real.rpow_nonneg hq.le _)) + +lemma low_degreeWeight_le_with_correction {n s q : ℝ} (hn : 0 < n) (hs : 0 < s) + (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) + {e : ℕ} (he : 0 < e) (helow : (e : ℝ) < n / (4 * s)) : + degreeWeight q (1 / 2 - s / (2 * n)) e ≤ + q ^ (degreeDistance n s e / 2) * Real.exp (4 * q ^ (1 - s * e / n)) := by + have hq1 : q ≤ 1 := by linarith + rcases Nat.even_or_odd e with heven | hodd + · refine (low_even_degreeWeight_le hn hs hq hqhalf he helow heven).trans ?_ + apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le + apply Real.rpow_le_rpow_of_exponent_ge hq hq1 + have hd : 0 ≤ degreeDistance n s e := nearestIntegerDistance_nonneg _ + linarith + · refine (low_odd_degreeWeight_le hn hs hq hqhalf hqsmall he helow hodd).trans ?_ + have hexp : 1 ≤ Real.exp (4 * q ^ (1 - s * e / n)) := + Real.one_le_exp_iff.mpr (by positivity) + simpa only [mul_one] using mul_le_mul_of_nonneg_left hexp + (Real.rpow_nonneg hq.le (degreeDistance n s e / 2)) + +/-- The actual factor weights, rather than hypothetical costs, give the +all-low product saving in the circuit argument. -/ +theorem low_degreeWeight_product_bound {ι : Type*} (I : Finset ι) (e : ι → ℕ) + {n s q : ℝ} (hn : 1 ≤ n) (hs : 0 < s) + (hslo : Real.sqrt n / 2 ≤ s) (hshi : s ≤ Real.sqrt n) + (hq : 0 < q) (hqhalf : q ≤ 1 / 2) (hqsqrt : q ≤ 2 / Real.sqrt n) + (hqpow : q ≤ n ^ (-(2 / 5 : ℝ))) (hqsmall : 5 * q ^ ((3 : ℝ) / 16) ≤ 1) + (he : ∀ i ∈ I, 0 < e i) (helow : ∀ i ∈ I, (e i : ℝ) < n / (4 * s)) + (hsum : ∑ i ∈ I, (e i : ℝ) = n) : + (∏ i ∈ I, degreeWeight q (1 / 2 - s / (2 * n)) (e i)) ≤ + Real.exp (24 * Real.sqrt n) * n ^ (-Real.sqrt n / 20) := by + have hn0 : 0 < n := by linarith + have hq1 : q ≤ 1 := by linarith + have hcorr : (∑ i ∈ I, q ^ (1 - s * e i / n)) ≤ 6 * Real.sqrt n := by + apply sum_small_degree_corrections_le I n s q (fun i => (e i : ℝ)) + hn0 hs.le hshi hq hq1 hqsqrt + · intro i hi + exact_mod_cast he i hi + · intro i hi + obtain ⟨_, h⟩ := low_degree_offset hn0 hs (he i hi) (helow i hi) + have hid : s * e i / n = 2 * (s * e i / (2 * n)) := by ring + rw [hid] + linarith + · exact hsum.le + apply all_low_degree_product_bound I e + (fun i => degreeWeight q (1 / 2 - s / (2 * n)) (e i)) + (fun i => 4 * q ^ (1 - s * e i / n)) hn hs hslo hq hq1 hqpow he helow hsum + · exact fun i _ => degreeWeight_nonneg hq.le _ _ + · exact fun i hi => low_degreeWeight_le_with_correction hn0 hs hq hqhalf hqsmall + (he i hi) (helow i hi) + · rw [← Finset.mul_sum] + linarith + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LowerAsymptotics.lean b/lean/OAI/Algebra/DepthFive/LowerAsymptotics.lean new file mode 100644 index 0000000000000000000000000000000000000000..fdf220b341a711270a02a799b447f6ed3754dd7b --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerAsymptotics.lean @@ -0,0 +1,80 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem335 + +open Filter + +/-- The numerical comparison in the lower-bound argument, with an explicit +sufficient logarithmic threshold. No algebraic complexity hypotheses enter here. -/ +theorem size_lower_bound_of_rank_bounds + (x S D R C₁ C₂ : ℝ) + (hx : 1 ≤ x) (hS : 0 ≤ S) (hD : 0 < D) + (hlog : 400 * (|C₁| + |C₂| + 1) ≤ Real.log x) + (hlower : D * Real.exp (-C₁ * Real.sqrt x) ≤ R) + (hupper : R ≤ 2 * S ^ 2 * D * Real.exp (C₂ * Real.sqrt x) * + x ^ (-Real.sqrt x / 100)) : + x ^ (Real.sqrt x / 400) ≤ S := by + have hxpos : 0 < x := lt_of_lt_of_le zero_lt_one hx + have hbounds := hlower.trans hupper + have hleftpos : 0 < D * Real.exp (-C₁ * Real.sqrt x) := + mul_pos hD (Real.exp_pos _) + have hSpos : 0 < S := by + by_contra h + have hzero : S = 0 := le_antisymm (le_of_not_gt h) hS + simp only [hzero, zero_pow (by decide : 2 ≠ 0), mul_zero, zero_mul] at hbounds + exact (not_le_of_gt hleftpos) hbounds + have hlogs := Real.log_le_log hleftpos hbounds + have hDne : D ≠ 0 := ne_of_gt hD + have hSne : S ≠ 0 := ne_of_gt hSpos + simp [Real.log_mul, Real.log_pow, Real.log_rpow hxpos, + hDne, hSne, ne_of_gt (Real.rpow_pos_of_pos hxpos (-Real.sqrt x / 100))] at hlogs + have hsqrt : 1 ≤ Real.sqrt x := Real.one_le_sqrt.mpr hx + have hlogtwo : Real.log 2 ≤ 1 := by + have := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2) + norm_num at this ⊢ + exact this + have habs₁ := le_abs_self C₁ + have habs₂ := le_abs_self C₂ + have hnonneg₁ := abs_nonneg C₁ + have hnonneg₂ := abs_nonneg C₂ + have hslack : C₁ + C₂ + 1 ≤ Real.log x / 400 := by linarith + have hslackmul := mul_le_mul_of_nonneg_right hslack (Real.sqrt_nonneg x) + have hlognonneg : 0 ≤ Real.log x := Real.log_nonneg hx + have htarget : Real.sqrt x / 400 * Real.log x ≤ Real.log S := by + nlinarith + apply (Real.log_le_log_iff (Real.rpow_pos_of_pos hxpos _) hSpos).mp + rw [Real.log_rpow hxpos] + exact htarget + +/-- Fixed exponential losses can be absorbed uniformly into the power saving. +The threshold is independent of `S`, `D`, and the rank value `R`. -/ +theorem eventual_size_lower_bound_of_rank_bounds (C₁ C₂ : ℝ) : + ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → ∀ S D R : ℝ, + 0 ≤ S → 0 < D → + D * Real.exp (-C₁ * Real.sqrt (n : ℝ)) ≤ R → + R ≤ 2 * S ^ 2 * D * Real.exp (C₂ * Real.sqrt (n : ℝ)) * + (n : ℝ) ^ (-Real.sqrt (n : ℝ) / 100) → + (n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ S := by + have hcast : Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop + have hlog := Real.tendsto_log_atTop.comp hcast + have hone : ∀ᶠ n : ℕ in atTop, (1 : ℝ) ≤ n := + hcast.eventually (eventually_ge_atTop 1) + have hlarge : ∀ᶠ n : ℕ in atTop, + 400 * (|C₁| + |C₂| + 1) ≤ Real.log (n : ℝ) := + hlog.eventually (eventually_ge_atTop _) + obtain ⟨n₀, hn₀⟩ := eventually_atTop.mp (hone.and hlarge) + refine ⟨n₀, ?_⟩ + intro n hn S D R hS hD hlower hupper + exact size_lower_bound_of_rank_bounds (n : ℝ) S D R C₁ C₂ + (hn₀ n hn).1 hS hD (hn₀ n hn).2 hlower hupper + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LowerBoundAssembly.lean b/lean/OAI/Algebra/DepthFive/LowerBoundAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..821069319be909e84e8d05e7a4fa1efd4a56052a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerBoundAssembly.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.DepthFive.ActualCircuitRank +import OAI.Algebra.DepthFive.ActualImmRank +import OAI.Algebra.DepthFive.LowerAsymptotics + +namespace OAI + +/-! Circuit-size lower bounds from eventual rank and second-trace estimates +for the normalized IMM matrix. -/ + +noncomputable section + +namespace Problem335 + +open LowerParameters + +/-- An eventual lower bound for the configured IMM rank, together with the +proved circuit upper bound, gives the exact complex circuit-size conclusion. -/ +theorem complex_depth_five_lower_bound_of_eventual_rank_lower (C : ℝ) + (hlower : ∀ᶠ n : ℕ in Filter.atTop, + rankDimension n * Real.exp (-C * Real.sqrt (n : ℝ)) ≤ + rankData n (imm ℂ n)) : + ∃ n0 : ℕ, ∀ n : ℕ, n0 ≤ n → ∀ c : Depth5Circuit ℂ n, + circuitValue c = imm ℂ n → + (n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ (circuitSize c : ℝ) := by + obtain ⟨Nlower, hNlower⟩ := Filter.eventually_atTop.mp hlower + obtain ⟨Nupper, hNupper⟩ := exists_rankData_circuit_upper_cutoff + obtain ⟨Nnumeric, hNnumeric⟩ := + eventual_size_lower_bound_of_rank_bounds C (24 + 4 * Real.log 5) + refine ⟨max 4 (max Nlower (max Nupper Nnumeric)), ?_⟩ + intro n hn c hc + have hn4 : 4 ≤ n := (le_max_left _ _).trans hn + have hnlo : Nlower ≤ n := + (le_max_left _ _).trans ((le_max_right _ _).trans hn) + have hnup : Nupper ≤ n := + (le_max_left _ _).trans + ((le_max_right _ _).trans ((le_max_right _ _).trans hn)) + have hnnum : Nnumeric ≤ n := + (le_max_right _ _).trans + ((le_max_right _ _).trans ((le_max_right _ _).trans hn)) + apply hNnumeric n hnnum (circuitSize c) (rankDimension n) + (rankData n (imm ℂ n)) (Nat.cast_nonneg _) (rankDimension_pos hn4) + (hNlower n hnlo) + simpa only [hc] using hNupper n hnup c hc + +/-- The second-trace bound, together with the first-trace and circuit +estimates, implies the complex circuit-size lower bound. -/ +theorem complex_depth_five_lower_bound_of_eventual_second_trace (C : ℝ) + (hsecond : ∀ᶠ n : ℕ in Filter.atTop, ∀ hn : 16 ≤ n, + (((immNormalizedMatrix n + (balancedLayer (Nat.le_trans (by decide : 4 ≤ 16) hn)) (a n) (b n)).conjTranspose * + immNormalizedMatrix n + (balancedLayer (Nat.le_trans (by decide : 4 ≤ 16) hn)) (a n) (b n)) ^ 2).trace.re ≤ + rankDimension n * rankMomentScale n ^ 2 * + Real.exp (C * Real.sqrt (n : ℝ))) : + ∃ n0 : ℕ, ∀ n : ℕ, n0 ≤ n → ∀ c : Depth5Circuit ℂ n, + circuitValue c = imm ℂ n → + (n : ℝ) ^ (Real.sqrt (n : ℝ) / 400) ≤ (circuitSize c : ℝ) := by + apply complex_depth_five_lower_bound_of_eventual_rank_lower (128 + C) + filter_upwards [hsecond, Filter.eventually_ge_atTop 16] with n hn hlarge + simpa only [neg_mul] using + rankData_imm_lower_of_second_trace_bound hlarge C (hn hlarge) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LowerCircuit.lean b/lean/OAI/Algebra/DepthFive/LowerCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..e93a97874dfa9e1bfec0cdaa6d167368f1180bbe --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerCircuit.lean @@ -0,0 +1,8 @@ +import OAI.Algebra.DepthFive.ActualProductRank +import OAI.Algebra.DepthFive.CircuitOutputDegree +import OAI.Algebra.DepthFive.ActualWeightParameters +import OAI.Algebra.DepthFive.ActualCircuitRank + +/-! The actual mixed-product rank estimate and its depth-five circuit +reduction, with rounded parameter specialization and uniform eventual +admissibility. -/ diff --git a/lean/OAI/Algebra/DepthFive/LowerInfrastructure.lean b/lean/OAI/Algebra/DepthFive/LowerInfrastructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..1762351a1316bc52566d44a6856363c66d55ead2 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerInfrastructure.lean @@ -0,0 +1,16 @@ +import OAI.Algebra.DepthFive.IntegerRank +import OAI.Algebra.DepthFive.TraceRank +import OAI.Algebra.DepthFive.MixedOperator +import OAI.Algebra.DepthFive.IteratedDerivative +import OAI.Algebra.DepthFive.OperatorRank +import OAI.Algebra.DepthFive.Bidegree +import OAI.Algebra.DepthFive.RankMeasure +import OAI.Algebra.DepthFive.CircuitDegreeBounds +import OAI.Algebra.DepthFive.CircuitStructure +import OAI.Algebra.DepthFive.GateSums +import OAI.Algebra.DepthFive.CircuitOutputDegree +import OAI.Algebra.DepthFive.LowerNumerics +import OAI.Algebra.DepthFive.LowerOperators +import OAI.Algebra.DepthFive.LowerCircuit + +/-! Rank estimates for homogeneous depth-five circuits and iterated matrix multiplication. -/ diff --git a/lean/OAI/Algebra/DepthFive/LowerMoments.lean b/lean/OAI/Algebra/DepthFive/LowerMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..9daa32b831713fcf8ecb44fa81d19dfc7f4250b4 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerMoments.lean @@ -0,0 +1,18 @@ +import OAI.Algebra.DepthFive.ImmFirstMomentBound +import OAI.Algebra.DepthFive.LocalProductAverage +import OAI.Algebra.DepthFive.LocalMomentPairing +import OAI.Algebra.DepthFive.QuadPathReindex +import OAI.Algebra.DepthFive.ImmPairingCompatibility +import OAI.Algebra.DepthFive.ImmSecondLocalBound +import OAI.Algebra.DepthFive.ImmFiniteMatrix +import OAI.Algebra.DepthFive.FourPathTrace +import OAI.Algebra.DepthFive.FirstTraceBound +import OAI.Algebra.DepthFive.PathOccupationAverage +import OAI.Algebra.DepthFive.BidegreeOccupationSum +import OAI.Algebra.DepthFive.PairingPartition +import OAI.Algebra.DepthFive.PairingWeights +import OAI.Algebra.DepthFive.ExtendedLocalMoment +import OAI.Algebra.DepthFive.FactorialOccupation +import OAI.Algebra.DepthFive.FactorialGeometricValue + +/-! Finite trace-moment estimates for iterated matrix multiplication. -/ diff --git a/lean/OAI/Algebra/DepthFive/LowerNumerics.lean b/lean/OAI/Algebra/DepthFive/LowerNumerics.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba776f6f8296de9b9c5e99323a1c9935668f9ee6 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerNumerics.lean @@ -0,0 +1,10 @@ +import OAI.Algebra.DepthFive.DegreeDiscrepancy +import OAI.Algebra.DepthFive.DegreeProductBounds +import OAI.Algebra.DepthFive.DegreeWeight +import OAI.Algebra.DepthFive.EvenCorrection +import OAI.Algebra.DepthFive.DimensionCorrection +import OAI.Algebra.DepthFive.LowerAsymptotics +import OAI.Algebra.DepthFive.AnalyticParameters +import OAI.Algebra.DepthFive.ProductCost + +/-! Canonical numerical lemmas supporting the lower-bound rank argument. -/ diff --git a/lean/OAI/Algebra/DepthFive/LowerOperators.lean b/lean/OAI/Algebra/DepthFive/LowerOperators.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbf1f424b1c4ccdb0bfe3e93242a902ca01d2a09 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerOperators.lean @@ -0,0 +1,16 @@ +import OAI.Algebra.DepthFive.OperatorMonomials +import OAI.Algebra.DepthFive.OperatorNaturality +import OAI.Algebra.DepthFive.BidegreeDimension +import OAI.Algebra.DepthFive.IntermediateDimension +import OAI.Algebra.DepthFive.FockPaths +import OAI.Algebra.DepthFive.ImmOperatorPaths +import OAI.Algebra.DepthFive.PathShifts +import OAI.Algebra.DepthFive.PairingShifts +import OAI.Algebra.DepthFive.RelaxedPaths +import OAI.Algebra.DepthFive.OperatorTraceBridge +import OAI.Algebra.DepthFive.FiniteOperator +import OAI.Algebra.DepthFive.OperatorExponentBidegree +import OAI.Algebra.DepthFive.FockBidegreeBasis +import OAI.Algebra.DepthFive.BidegreeNonempty + +/-! Finite-dimensional, monomial, and path-action descriptions of normalized IMM operators. -/ diff --git a/lean/OAI/Algebra/DepthFive/LowerParameters.lean b/lean/OAI/Algebra/DepthFive/LowerParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..f13fa65e3996c0e6a1398ee807c2eb9c2c59565e --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerParameters.lean @@ -0,0 +1,244 @@ +import Mathlib + +namespace OAI + +/-! Integer parameters for the lower-bound rank measure. -/ +namespace Problem335.LowerParameters + +noncomputable section + +def s (n : ℕ) : ℕ := + if Nat.sqrt n % 2 = n % 2 then Nat.sqrt n else Nat.sqrt n - 1 + +def k (n : ℕ) : ℕ := (n - s n) / 2 + +def m (n : ℕ) : ℕ := (n + s n) / 2 + +def rho (n : ℕ) : ℝ := (k n : ℝ) / (m n : ℝ) + +def lambda (n : ℕ) : ℝ := (k n : ℝ) / (n : ℝ) + +def v (n : ℕ) : ℕ := k n * n ^ 2 + +def u (n : ℕ) : ℕ := m n * n ^ 2 + +theorem s_le_nat_sqrt (n : ℕ) : s n ≤ Nat.sqrt n := by + unfold s + split <;> omega + +theorem nat_sqrt_le_s_add_one (n : ℕ) : Nat.sqrt n ≤ s n + 1 := by + unfold s + split <;> omega + +theorem s_le_n (n : ℕ) : s n ≤ n := + (s_le_nat_sqrt n).trans (Nat.sqrt_le_self n) + +theorem s_mod_two (n : ℕ) : s n % 2 = n % 2 := by + by_cases hn : n = 0 + · subst n + norm_num [s] + have hs : 0 < Nat.sqrt n := Nat.sqrt_pos.mpr (Nat.pos_of_ne_zero hn) + unfold s + split <;> omega + +theorem two_mul_k (n : ℕ) : 2 * k n = n - s n := by + have hs := s_le_n n + have hp := s_mod_two n + unfold k + omega + +theorem two_mul_m (n : ℕ) : 2 * m n = n + s n := by + have hp := s_mod_two n + unfold m + omega + +theorem k_add_m (n : ℕ) : k n + m n = n := by + have hs := s_le_n n + have hk := two_mul_k n + have hm := two_mul_m n + omega + +theorem m_eq_k_add_s (n : ℕ) : m n = k n + s n := by + have hs := s_le_n n + have hk := two_mul_k n + have hm := two_mul_m n + omega + +theorem s_le_sqrt (n : ℕ) : (s n : ℝ) ≤ Real.sqrt (n : ℝ) := by + have h : (s n : ℝ) ≤ (Nat.sqrt n : ℝ) := by exact_mod_cast s_le_nat_sqrt n + exact h.trans Real.nat_sqrt_le_real_sqrt + +theorem sqrt_sub_two_lt_s (n : ℕ) : Real.sqrt (n : ℝ) - 2 < (s n : ℝ) := by + have h₁ := Real.real_sqrt_lt_nat_sqrt_succ (a := n) + have h₂ : (Nat.sqrt n : ℝ) ≤ (s n : ℝ) + 1 := by + exact_mod_cast nat_sqrt_le_s_add_one n + linarith + +theorem sqrt_half_le_s {n : ℕ} (hn : 16 ≤ n) : + Real.sqrt (n : ℝ) / 2 ≤ (s n : ℝ) := by + have h₁ := sqrt_sub_two_lt_s n + have h₂ : 4 ≤ Real.sqrt (n : ℝ) := by + apply (Real.le_sqrt (by norm_num) (by positivity)).mpr + exact_mod_cast hn + linarith + +theorem s_pos {n : ℕ} (hn : 4 ≤ n) : 0 < s n := by + have h₁ : 2 ≤ Nat.sqrt n := Nat.le_sqrt'.mpr hn + have h₂ := nat_sqrt_le_s_add_one n + omega + +theorem k_pos {n : ℕ} (hn : 4 ≤ n) : 0 < k n := by + have h₁ : Nat.sqrt n < n := Nat.sqrt_lt_self (by omega) + have h₂ := s_le_nat_sqrt n + have h₃ := two_mul_k n + omega + +theorem k_lt_m {n : ℕ} (hn : 4 ≤ n) : k n < m n := by + have h₁ := m_eq_k_add_s n + have h₂ := s_pos hn + omega + +theorem m_pos {n : ℕ} (hn : 4 ≤ n) : 0 < m n := by + have := k_lt_m hn + omega + +theorem two_mul_k_add_s (n : ℕ) : 2 * k n + s n = n := by + have h₁ := k_add_m n + have h₂ := m_eq_k_add_s n + omega + +theorem s_le_quarter {n : ℕ} (hn : 16 ≤ n) : (s n : ℝ) ≤ (n : ℝ) / 4 := by + have hs := s_le_sqrt n + have hroot : 4 ≤ Real.sqrt (n : ℝ) := by + apply (Real.le_sqrt (by norm_num) (by positivity)).mpr + exact_mod_cast hn + have hsq := Real.sq_sqrt (show (0 : ℝ) ≤ n by positivity) + nlinarith + +theorem three_mul_n_le_eight_mul_k {n : ℕ} (hn : 16 ≤ n) : + 3 * n ≤ 8 * k n := by + have hs := s_le_quarter hn + have hk : 2 * (k n : ℝ) + (s n : ℝ) = (n : ℝ) := by + exact_mod_cast two_mul_k_add_s n + have h : 3 * (n : ℝ) ≤ 8 * (k n : ℝ) := by linarith + exact_mod_cast h + +theorem lambda_ge_three_eighths {n : ℕ} (hn : 16 ≤ n) : + (3 : ℝ) / 8 ≤ lambda n := by + have hpos : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) + rw [lambda, le_div_iff₀ hpos] + have h : 3 * (n : ℝ) ≤ 8 * (k n : ℝ) := by + exact_mod_cast three_mul_n_le_eight_mul_k hn + linarith + +theorem rho_pos {n : ℕ} (hn : 4 ≤ n) : 0 < rho n := by + unfold rho + apply div_pos <;> exact_mod_cast (by first | exact k_pos hn | exact m_pos hn) + +theorem rho_lt_one {n : ℕ} (hn : 4 ≤ n) : rho n < 1 := by + have hm : (0 : ℝ) < m n := by exact_mod_cast m_pos hn + rw [rho, div_lt_one hm] + exact_mod_cast k_lt_m hn + +theorem lambda_eq_half_sub {n : ℕ} (hn : 0 < n) : + lambda n = 1 / 2 - (s n : ℝ) / (2 * (n : ℝ)) := by + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) + have hk : 2 * (k n : ℝ) + (s n : ℝ) = (n : ℝ) := by + exact_mod_cast two_mul_k_add_s n + unfold lambda + field_simp + linarith + +theorem lambda_eq_rho_div {n : ℕ} (hn : 4 ≤ n) : + lambda n = rho n / (1 + rho n) := by + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (show n ≠ 0 by omega) + have hm : (m n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (m_pos hn)) + have hsum : (k n : ℝ) + (m n : ℝ) = (n : ℝ) := by + exact_mod_cast k_add_m n + unfold lambda rho + field_simp + nlinarith + +theorem lambda_mul_n (n : ℕ) : lambda n * (n : ℝ) = (k n : ℝ) := by + by_cases hn : n = 0 + · subst n + norm_num [lambda, k, s] + · exact div_mul_cancel₀ _ (by exact_mod_cast hn) + +theorem k_le_n (n : ℕ) : k n ≤ n := by + have := k_add_m n + omega + +theorem m_le_n (n : ℕ) : m n ≤ n := by + have := k_add_m n + omega + +theorem n_le_two_mul_m (n : ℕ) : n ≤ 2 * m n := by + have := two_mul_m n + omega + +theorem s_is_greatest (n j : ℕ) (hj : j ≤ Nat.sqrt n) + (hp : j % 2 = n % 2) : j ≤ s n := by + unfold s + split <;> omega + +theorem four_mul_s_le_n {n : ℕ} (hn : 16 ≤ n) : 4 * s n ≤ n := by + have hs := s_le_quarter hn + have : 4 * (s n : ℝ) ≤ (n : ℝ) := by linarith + exact_mod_cast this + +theorem s_lt_k {n : ℕ} (hn : 16 ≤ n) : s n < k n := by + have h₁ := four_mul_s_le_n hn + have h₂ := two_mul_k_add_s n + have h₃ := s_pos (show 4 ≤ n by omega) + omega + +theorem lambda_lt_half {n : ℕ} (hn : 4 ≤ n) : lambda n < 1 / 2 := by + rw [lambda_eq_half_sub (show 0 < n by omega)] + have hs : (0 : ℝ) < s n := by exact_mod_cast s_pos hn + have hn' : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) + have : 0 < (s n : ℝ) / (2 * (n : ℝ)) := by positivity + linarith + +theorem one_sub_rho {n : ℕ} (hn : 4 ≤ n) : + 1 - rho n = (s n : ℝ) / (m n : ℝ) := by + have hm : (m n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (m_pos hn)) + have h : (m n : ℝ) = (k n : ℝ) + (s n : ℝ) := by + exact_mod_cast m_eq_k_add_s n + unfold rho + field_simp + linarith + +theorem v_pos {n : ℕ} (hn : 4 ≤ n) : 0 < v n := by + unfold v + exact Nat.mul_pos (k_pos hn) (Nat.pow_pos (by omega)) + +theorem u_pos {n : ℕ} (hn : 4 ≤ n) : 0 < u n := by + unfold u + exact Nat.mul_pos (m_pos hn) (Nat.pow_pos (by omega)) + +theorem v_le_cube (n : ℕ) : v n ≤ n ^ 3 := by + unfold v + calc k n * n ^ 2 ≤ n * n ^ 2 := Nat.mul_le_mul_right _ (k_le_n n) + _ = n ^ 3 := by ring + +theorem u_le_cube (n : ℕ) : u n ≤ n ^ 3 := by + unfold u + calc m n * n ^ 2 ≤ n * n ^ 2 := Nat.mul_le_mul_right _ (m_le_n n) + _ = n ^ 3 := by ring + +theorem three_mul_cube_le_eight_mul_v {n : ℕ} (hn : 16 ≤ n) : + 3 * n ^ 3 ≤ 8 * v n := by + have h := Nat.mul_le_mul_right (n ^ 2) (three_mul_n_le_eight_mul_k hn) + dsimp [v] + nlinarith [h] + +theorem cube_le_two_mul_u (n : ℕ) : n ^ 3 ≤ 2 * u n := by + have h := Nat.mul_le_mul_right (n ^ 2) (n_le_two_mul_m n) + dsimp [u] + nlinarith [h] + +end +end Problem335.LowerParameters + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/LowerSchedule.lean b/lean/OAI/Algebra/DepthFive/LowerSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..6376e39ffebd7cafdf374afa572e2919537fbe73 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/LowerSchedule.lean @@ -0,0 +1,131 @@ +import OAI.Algebra.DepthFive.LowerParameters +import OAI.Algebra.DepthFive.ScheduleIntervals +import OAI.Algebra.DepthFive.ScheduleInterior + +namespace OAI + +noncomputable section + +namespace Problem335.LowerParameters + +/-- The actual balanced schedule for the rank-measure parameters of degree `n`. -/ +def balancedWord (n : ℕ) : List Bool := BalancedSchedule.word (k n) (s n) + +lemma balancedWord_length {n : ℕ} (hn : 4 ≤ n) : (balancedWord n).length = n := by + rw [balancedWord, BalancedSchedule.word_length (k_pos hn), two_mul_k_add_s] + +/-- `true` selects derivative layers and `false` selects multiplication layers. -/ +def balancedLayer {n : ℕ} (hn : 4 ≤ n) : Fin n → Bool := fun i => + (balancedWord n).get ⟨i.val, by simp [balancedWord_length hn]⟩ + +lemma balancedLayer_ofFn {n : ℕ} (hn : 4 ≤ n) : + List.ofFn (balancedLayer hn) = balancedWord n := by + apply List.ext_getElem + · simp [balancedWord_length hn] + · intro i h₁ h₂ + simp [balancedLayer] + +lemma balancedLayer_card_true {n : ℕ} (hn : 4 ≤ n) : + (Finset.univ.filter (fun i => balancedLayer hn i = true)).card = k n := by + let vec : List.Vector Bool n := ⟨balancedWord n, balancedWord_length hn⟩ + have h := Fin.card_filter_univ_eq_vector_get_eq_count true vec + change (Finset.univ.filter (fun i => balancedLayer hn i = true)).card = + (balancedWord n).count true at h + simpa [balancedWord] using h + +lemma balancedLayer_card_false {n : ℕ} (hn : 4 ≤ n) : + (Finset.univ.filter (fun i => balancedLayer hn i = false)).card = m n := by + let vec : List.Vector Bool n := ⟨balancedWord n, balancedWord_length hn⟩ + have h := Fin.card_filter_univ_eq_vector_get_eq_count false vec + change (Finset.univ.filter (fun i => balancedLayer hn i = false)).card = + (balancedWord n).count false at h + simpa [balancedWord, BalancedSchedule.word_count_false (k_pos hn), m_eq_k_add_s] using h + +lemma balancedSchedule_rho (n : ℕ) : BalancedSchedule.rho (k n) (s n) = rho n := by + simp only [BalancedSchedule.rho, rho, m_eq_k_add_s, Nat.cast_add] + +lemma balancedLayer_infix_discrepancy {n : ℕ} (hn : 4 ≤ n) (b : List (Fin n)) + (hb : b <:+: List.ofFn id) : + (b.countP (balancedLayer hn) : ℝ) - rho n * + (b.countP (fun i => !balancedLayer hn i) : ℝ) < 1 + rho n := by + have hmap := hb.map (balancedLayer hn) + have heq : (List.ofFn (id : Fin n → Fin n)).map (balancedLayer hn) = balancedWord n := by + rw [List.map_ofFn] + exact balancedLayer_ofFn hn + rw [heq] at hmap + have h := BalancedSchedule.infix_discrepancy_lt (k_pos hn) (s n) (k n) hmap + simpa [BalancedSchedule.discrepancy, List.count_eq_countP, List.countP_map, + Function.comp_def, balancedSchedule_rho] using h + +lemma balancedLayer_no_adjacent {n : ℕ} (hn : 4 ≤ n) (i j : Fin n) + (hij : i.val + 1 = j.val) : + balancedLayer hn i = false ∨ balancedLayer hn j = false := by + have hlt : i.val + 1 < (balancedWord n).length := by + rw [balancedWord_length hn, hij] + exact j.isLt + have h := List.isChain_iff_getElem.mp (BalancedSchedule.word_no_adjacent_V (k n) (s n)) + i.val hlt + simpa only [balancedLayer, balancedWord, List.get_eq_getElem, hij] using h + +lemma balancedLayer_independent {n : ℕ} (hn : 4 ≤ n) {i j : Fin n} + (hi : balancedLayer hn i = true) (hj : balancedLayer hn j = true) : + ¬ BalancedSchedule.adjacent i j := by + rintro (hij | hji) + · have h := balancedLayer_no_adjacent hn i j hij + simp [hi, hj] at h + · have h := balancedLayer_no_adjacent hn j i hji + simp [hi, hj] at h + +lemma balancedLayer_first {n : ℕ} (hn : 4 ≤ n) : + balancedLayer hn ⟨0, by omega⟩ = true := by + have h := BalancedSchedule.wordPrefix_head (r := k n) (k_pos hn) (k n) (s n) + change (balancedWord n).head? = some true at h + have hlen : 0 < (balancedWord n).length := by rw [balancedWord_length hn]; omega + rw [List.head?_eq_getElem?, List.getElem?_eq_getElem hlen] at h + simpa only [balancedLayer, List.get_eq_getElem] using Option.some.inj h + +lemma balancedLayer_final {n : ℕ} (hn : 4 ≤ n) : + balancedLayer hn ⟨n - 1, by omega⟩ = false := by + have h := BalancedSchedule.wordPrefix_last (r := k n) (k_pos hn) (k n) (s n) + change (balancedWord n).getLast? = some false at h + have hlen : (balancedWord n).length - 1 < (balancedWord n).length := by + rw [balancedWord_length hn]; omega + rw [List.getLast?_eq_getElem?, List.getElem?_eq_getElem hlen] at h + simpa only [balancedLayer, List.get_eq_getElem, balancedWord_length hn] using Option.some.inj h + +/-- The actual V-layer coincidence events use pairwise disjoint vertex coordinates. -/ +lemma balancedLayer_internalEnds_disjoint {n : ℕ} (hn : 4 ≤ n) {i j : Fin n} + (hi : balancedLayer hn i = true) (hj : balancedLayer hn j = true) (hne : i ≠ j) : + Disjoint (BalancedSchedule.internalEnds i) (BalancedSchedule.internalEnds j) := + BalancedSchedule.internalEnds_disjoint_of_not_adjacent hne (balancedLayer_independent hn hi hj) + +/-- Layer-restricted IMM variables are a product of selected layers and matrix entries. -/ +def layerVariableEquiv {n : ℕ} (p : Fin n → Bool) (b : Bool) : + {x : Fin n × Fin n × Fin n // p x.1 = b} ≃ + {i : Fin n // p i = b} × Fin n × Fin n where + toFun x := (⟨x.1.1, x.2⟩, x.1.2.1, x.1.2.2) + invFun x := ⟨(x.1.1, x.2.1, x.2.2), x.1.2⟩ + left_inv := by rintro ⟨⟨i, j, l⟩, h⟩; rfl + right_inv := by rintro ⟨⟨i, h⟩, j, l⟩; rfl + +lemma balancedVariable_card_true {n : ℕ} (hn : 4 ≤ n) : + Fintype.card {x : Fin n × Fin n × Fin n // balancedLayer hn x.1 = true} = v n := by + classical + rw [Fintype.card_congr (layerVariableEquiv (balancedLayer hn) true)] + simp only [Fintype.card_prod, Fintype.card_fin, Fintype.card_subtype] + rw [balancedLayer_card_true] + simp [v, pow_two] + +lemma balancedVariable_card_false {n : ℕ} (hn : 4 ≤ n) : + Fintype.card {x : Fin n × Fin n × Fin n // balancedLayer hn x.1 = false} = u n := by + classical + rw [Fintype.card_congr (layerVariableEquiv (balancedLayer hn) false)] + simp only [Fintype.card_prod, Fintype.card_fin, Fintype.card_subtype] + rw [balancedLayer_card_false] + simp [u, pow_two] + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/Main.lean b/lean/OAI/Algebra/DepthFive/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c5985f00072df442fd7dc8a3f1feba4922b67de --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/Main.lean @@ -0,0 +1,198 @@ +import OAI.Algebra.DepthFive.Bounds +import OAI.Algebra.DepthFive.ActualBalancedWordSum +import OAI.Algebra.DepthFive.ActualCircuitRank +import OAI.Algebra.DepthFive.ActualImmRank +import OAI.Algebra.DepthFive.ActualProductRank +import OAI.Algebra.DepthFive.ActualRelaxedWeightBound +import OAI.Algebra.DepthFive.ActualSecondMomentParameters +import OAI.Algebra.DepthFive.ActualWeightParameters +import OAI.Algebra.DepthFive.AlphaParameters +import OAI.Algebra.DepthFive.AnalyticParameters +import OAI.Algebra.DepthFive.BalancedSchedule +import OAI.Algebra.DepthFive.BalancedWordSum +import OAI.Algebra.DepthFive.Basic +import OAI.Algebra.DepthFive.BetaRefinements +import OAI.Algebra.DepthFive.Bidegree +import OAI.Algebra.DepthFive.BidegreeAverages +import OAI.Algebra.DepthFive.BidegreeBasis +import OAI.Algebra.DepthFive.BidegreeBridge +import OAI.Algebra.DepthFive.BidegreeCompositionReindex +import OAI.Algebra.DepthFive.BidegreeDimension +import OAI.Algebra.DepthFive.BidegreeLocalProductAverage +import OAI.Algebra.DepthFive.BidegreeNonempty +import OAI.Algebra.DepthFive.BidegreeOccupationSum +import OAI.Algebra.DepthFive.BidegreeShiftedOccupation +import OAI.Algebra.DepthFive.BinomialRatios +import OAI.Algebra.DepthFive.BlockCircuit +import OAI.Algebra.DepthFive.BlockCircuitValue +import OAI.Algebra.DepthFive.BlockMiddleSemantics +import OAI.Algebra.DepthFive.BlockPartition +import OAI.Algebra.DepthFive.CeilArithmetic +import OAI.Algebra.DepthFive.CharacteristicZeroTransfer +import OAI.Algebra.DepthFive.CircuitDegreeBounds +import OAI.Algebra.DepthFive.CircuitFactorForms +import OAI.Algebra.DepthFive.CircuitOutputDegree +import OAI.Algebra.DepthFive.CircuitProductBound +import OAI.Algebra.DepthFive.CircuitRankAssembly +import OAI.Algebra.DepthFive.CircuitStructure +import OAI.Algebra.DepthFive.CircuitWeightBound +import OAI.Algebra.DepthFive.CoefficientDescent +import OAI.Algebra.DepthFive.CoefficientMap +import OAI.Algebra.DepthFive.CoefficientSupport +import OAI.Algebra.DepthFive.ComplexEmbedding +import OAI.Algebra.DepthFive.CompositionAntidiag +import OAI.Algebra.DepthFive.ConfiguredImmSecondMoment +import OAI.Algebra.DepthFive.ConfiguredRankData +import OAI.Algebra.DepthFive.DegreeDiscrepancy +import OAI.Algebra.DepthFive.DegreeDistances +import OAI.Algebra.DepthFive.DegreeProductBounds +import OAI.Algebra.DepthFive.DegreeWeight +import OAI.Algebra.DepthFive.DimensionCorrection +import OAI.Algebra.DepthFive.EvenCorrection +import OAI.Algebra.DepthFive.ExponentCardinality +import OAI.Algebra.DepthFive.ExtendedLocalMoment +import OAI.Algebra.DepthFive.FactorialGeometricValue +import OAI.Algebra.DepthFive.FactorialOccupation +import OAI.Algebra.DepthFive.FactorialPositive +import OAI.Algebra.DepthFive.FiniteOperator +import OAI.Algebra.DepthFive.FirstOccupationMoment +import OAI.Algebra.DepthFive.FirstTraceBound +import OAI.Algebra.DepthFive.FirstTraceNonnegative +import OAI.Algebra.DepthFive.FockBidegreeBasis +import OAI.Algebra.DepthFive.FockLayerProfile +import OAI.Algebra.DepthFive.FockMonomials +import OAI.Algebra.DepthFive.FockPaths +import OAI.Algebra.DepthFive.FourPathLocal +import OAI.Algebra.DepthFive.FourPathTrace +import OAI.Algebra.DepthFive.FractionRounding +import OAI.Algebra.DepthFive.GateCardinality +import OAI.Algebra.DepthFive.GateSums +import OAI.Algebra.DepthFive.HighDegreeWeights +import OAI.Algebra.DepthFive.Homogeneity +import OAI.Algebra.DepthFive.HomogeneousSpaceDimension +import OAI.Algebra.DepthFive.ImmBidegree +import OAI.Algebra.DepthFive.ImmBlocks +import OAI.Algebra.DepthFive.ImmCompatibleTrace +import OAI.Algebra.DepthFive.ImmDegree +import OAI.Algebra.DepthFive.ImmFiniteMatrix +import OAI.Algebra.DepthFive.ImmFirstMomentBound +import OAI.Algebra.DepthFive.ImmFirstMomentParameters +import OAI.Algebra.DepthFive.ImmFirstTrace +import OAI.Algebra.DepthFive.ImmFockMatrix +import OAI.Algebra.DepthFive.ImmMap +import OAI.Algebra.DepthFive.ImmOperatorPaths +import OAI.Algebra.DepthFive.ImmPairingCompatibility +import OAI.Algebra.DepthFive.ImmPairingReindex +import OAI.Algebra.DepthFive.ImmPathCompatibility +import OAI.Algebra.DepthFive.ImmPathShifts +import OAI.Algebra.DepthFive.ImmProfileCompatibility +import OAI.Algebra.DepthFive.ImmSecondLocalBound +import OAI.Algebra.DepthFive.ImmSecondMomentParameters +import OAI.Algebra.DepthFive.ImmSecondTrace +import OAI.Algebra.DepthFive.IndependentCoordinates +import OAI.Algebra.DepthFive.IndexedCircuit +import OAI.Algebra.DepthFive.IndexedCircuitValue +import OAI.Algebra.DepthFive.IntegerRank +import OAI.Algebra.DepthFive.IntermediateDimension +import OAI.Algebra.DepthFive.IntermediateFactorization +import OAI.Algebra.DepthFive.InvalidOccupation +import OAI.Algebra.DepthFive.IsolatedFlip +import OAI.Algebra.DepthFive.IsolatedWeight +import OAI.Algebra.DepthFive.IteratedDerivative +import OAI.Algebra.DepthFive.LayeredFourPath +import OAI.Algebra.DepthFive.LocalFactorialExpansion +import OAI.Algebra.DepthFive.LocalMomentPairing +import OAI.Algebra.DepthFive.LocalMomentPolynomials +import OAI.Algebra.DepthFive.LocalMomentWeights +import OAI.Algebra.DepthFive.LocalOccupationAverage +import OAI.Algebra.DepthFive.LocalProductAverage +import OAI.Algebra.DepthFive.LowDegreeWeights +import OAI.Algebra.DepthFive.LowerAsymptotics +import OAI.Algebra.DepthFive.LowerBoundAssembly +import OAI.Algebra.DepthFive.LowerCircuit +import OAI.Algebra.DepthFive.LowerInfrastructure +import OAI.Algebra.DepthFive.LowerMoments +import OAI.Algebra.DepthFive.LowerNumerics +import OAI.Algebra.DepthFive.LowerOperators +import OAI.Algebra.DepthFive.LowerParameters +import OAI.Algebra.DepthFive.LowerSchedule +import OAI.Algebra.DepthFive.MatrixNormalization +import OAI.Algebra.DepthFive.MatrixPathPairings +import OAI.Algebra.DepthFive.MatrixPathSemantics +import OAI.Algebra.DepthFive.MatrixPathVertices +import OAI.Algebra.DepthFive.MatrixPaths +import OAI.Algebra.DepthFive.MixedOperator +import OAI.Algebra.DepthFive.MixedOperatorBidegree +import OAI.Algebra.DepthFive.MomentAssemblyInterfaces +import OAI.Algebra.DepthFive.MomentLossParameters +import OAI.Algebra.DepthFive.OccupationComparison +import OAI.Algebra.DepthFive.OccupationExpansion +import OAI.Algebra.DepthFive.OccupationParameterBounds +import OAI.Algebra.DepthFive.OccupationRatio +import OAI.Algebra.DepthFive.OccupationRatioAlgebra +import OAI.Algebra.DepthFive.OccupationSum +import OAI.Algebra.DepthFive.OddDegreeThreshold +import OAI.Algebra.DepthFive.OperatorExponentBidegree +import OAI.Algebra.DepthFive.OperatorHomogeneity +import OAI.Algebra.DepthFive.OperatorMonomials +import OAI.Algebra.DepthFive.OperatorNaturality +import OAI.Algebra.DepthFive.OperatorRank +import OAI.Algebra.DepthFive.OperatorRankBridge +import OAI.Algebra.DepthFive.OperatorTraceBridge +import OAI.Algebra.DepthFive.PairingAverageCardinality +import OAI.Algebra.DepthFive.PairingNeighborCount +import OAI.Algebra.DepthFive.PairingOccupationAverage +import OAI.Algebra.DepthFive.PairingPartition +import OAI.Algebra.DepthFive.PairingShifts +import OAI.Algebra.DepthFive.PairingSourceAverage +import OAI.Algebra.DepthFive.PairingWeights +import OAI.Algebra.DepthFive.Pairings +import OAI.Algebra.DepthFive.ParameterBounds +import OAI.Algebra.DepthFive.ParameterCutoff +import OAI.Algebra.DepthFive.ParameterGrowth +import OAI.Algebra.DepthFive.PathInjectivity +import OAI.Algebra.DepthFive.PathIsolatedWeight +import OAI.Algebra.DepthFive.PathMassLowerBound +import OAI.Algebra.DepthFive.PathMassParameters +import OAI.Algebra.DepthFive.PathOccupationAverage +import OAI.Algebra.DepthFive.PathOccupationGroups +import OAI.Algebra.DepthFive.PathShifts +import OAI.Algebra.DepthFive.PowerPerturbation +import OAI.Algebra.DepthFive.ProductCost +import OAI.Algebra.DepthFive.ProductNormalization +import OAI.Algebra.DepthFive.ProductRank +import OAI.Algebra.DepthFive.ProductRankAssembly +import OAI.Algebra.DepthFive.ProductRankCanonical +import OAI.Algebra.DepthFive.QuadPathReindex +import OAI.Algebra.DepthFive.RankMeasure +import OAI.Algebra.DepthFive.RelaxedPaths +import OAI.Algebra.DepthFive.RelaxedWeightBound +import OAI.Algebra.DepthFive.RelaxedWordBridge +import OAI.Algebra.DepthFive.RunBlocks +import OAI.Algebra.DepthFive.RunLayerWeights +import OAI.Algebra.DepthFive.RunSum +import OAI.Algebra.DepthFive.RunWeights +import OAI.Algebra.DepthFive.ScheduleEnds +import OAI.Algebra.DepthFive.ScheduleInterior +import OAI.Algebra.DepthFive.ScheduleIntervals +import OAI.Algebra.DepthFive.ScheduleWeightBridge +import OAI.Algebra.DepthFive.SecondMomentNormalization +import OAI.Algebra.DepthFive.SecondMomentPairing +import OAI.Algebra.DepthFive.ShiftedOccupation +import OAI.Algebra.DepthFive.SmallDegreeCorrections +import OAI.Algebra.DepthFive.SwitchRestoration +import OAI.Algebra.DepthFive.TraceComplexification +import OAI.Algebra.DepthFive.TraceExpansion +import OAI.Algebra.DepthFive.TraceRank +import OAI.Algebra.DepthFive.UpperBlockData +import OAI.Algebra.DepthFive.UpperBoundArithmetic +import OAI.Algebra.DepthFive.UpperConstruction +import OAI.Algebra.DepthFive.UpperGateCounting +import OAI.Algebra.DepthFive.WordInfrastructure +import OAI.Algebra.DepthFive.WordLocalProduct +import OAI.Algebra.DepthFive.WordRuns +import OAI.Algebra.DepthFive.WordSum +import OAI.Algebra.DepthFive.WordSwitches +import OAI.Algebra.DepthFive.WordWeightBound +import OAI.Algebra.DepthFive.WordWeightParameters +import OAI.Algebra.DepthFive.Infrastructure diff --git a/lean/OAI/Algebra/DepthFive/MatrixNormalization.lean b/lean/OAI/Algebra/DepthFive/MatrixNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..487fd8ba948f46fe611d121260bf9cc7dc43287f --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MatrixNormalization.lean @@ -0,0 +1,123 @@ +import OAI.Algebra.DepthFive.TraceRank + +namespace OAI + +noncomputable section + +open scoped BigOperators Matrix ComplexOrder + +namespace Problem335 + +section DiagonalScaling + +variable {ι κ K : Type*} [Fintype ι] [Fintype κ] + [DecidableEq ι] [DecidableEq κ] [Field K] + +/-- Nonzero row and column rescalings preserve the rank of a rectangular matrix. -/ +theorem rank_diagonal_mul_mul_diagonal (A : Matrix κ ι K) + (r : κ → K) (c : ι → K) (hr : ∀ i, r i ≠ 0) (hc : ∀ j, c j ≠ 0) : + (Matrix.diagonal r * A * Matrix.diagonal c).rank = A.rank := by + have hr' : IsUnit (Matrix.diagonal r).det := by + simp only [Matrix.det_diagonal, isUnit_iff_ne_zero] + exact Finset.prod_ne_zero_iff.mpr (fun i _ => hr i) + have hc' : IsUnit (Matrix.diagonal c).det := by + simp only [Matrix.det_diagonal, isUnit_iff_ne_zero] + exact Finset.prod_ne_zero_iff.mpr (fun i _ => hc i) + rw [Matrix.rank_mul_eq_left_of_isUnit_det _ _ hc', + Matrix.rank_mul_eq_right_of_isUnit_det _ _ hr'] + +/-- Entrywise nonzero row/column normalization does not change rank. -/ +theorem rank_entrywise_scaling (A : Matrix κ ι K) + (r : κ → K) (c : ι → K) (hr : ∀ i, r i ≠ 0) (hc : ∀ j, c j ≠ 0) : + Matrix.rank (fun i j => r i * A i j * c j : Matrix κ ι K) = A.rank := by + have heq : (fun i j => r i * A i j * c j : Matrix κ ι K) = + Matrix.diagonal r * A * Matrix.diagonal c := by + ext i j + simp + rw [heq] + exact rank_diagonal_mul_mul_diagonal A r c hr hc + +end DiagonalScaling + +section BasisNormalization + +variable {ι κ K M N : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] + [CommSemiring K] [AddCommMonoid M] [AddCommMonoid N] + [Module K M] [Module K N] + +/-- Rescaling source and target basis vectors rescales matrix columns and rows, +with inverse target weights. This identifies normalized-monomial matrices. -/ +theorem toMatrix_unitsSMul_apply (f : M →ₗ[K] N) + (b : Module.Basis ι K M) (c : Module.Basis κ K N) + (u : ι → Kˣ) (v : κ → Kˣ) (i : κ) (j : ι) : + LinearMap.toMatrix (b.unitsSMul u) (c.unitsSMul v) f i j = + (↑((v i)⁻¹) : K) * LinearMap.toMatrix b c f i j * (u j : K) := by + simp [LinearMap.toMatrix_apply, Module.Basis.unitsSMul_apply, + Module.Basis.repr_unitsSMul, Units.smul_def, mul_comm] + +end BasisNormalization + +/-- The square-root rescaling used by factorial-normalized monomial bases +preserves rank whenever all normalization weights are positive. -/ +theorem rank_sqrt_normalization {ι κ : Type*} [Fintype ι] [Fintype κ] + [DecidableEq ι] [DecidableEq κ] (A : Matrix κ ι ℂ) + (r : κ → ℝ) (c : ι → ℝ) (hr : ∀ i, 0 < r i) (hc : ∀ j, 0 < c j) : + Matrix.rank (fun i j => (Real.sqrt (r i) : ℂ) * A i j / + (Real.sqrt (c j) : ℂ)) = A.rank := by + apply rank_entrywise_scaling A (fun i => (Real.sqrt (r i) : ℂ)) + (fun j => (Real.sqrt (c j) : ℂ)⁻¹) + · intro i + exact_mod_cast (Real.sqrt_pos.2 (hr i)).ne' + · intro j + exact inv_ne_zero (by exact_mod_cast (Real.sqrt_pos.2 (hc j)).ne') + +section MomentComparison + +variable {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] + +/-- Comparing the first two normalized trace moments gives the rank bound used +in the IMM argument. Here `w` contains the path count and local moment factor. -/ +theorem rank_lower_bound_of_trace_moment_bounds (A : Matrix κ ι ℂ) + {D w δ ε : ℝ} (hD : 0 < D) (hw : 0 < w) + (hfirst : D * w * Real.exp (-δ) ≤ (Aᴴ * A).trace.re) + (hsecond : (((Aᴴ * A) ^ 2).trace.re) ≤ D * w ^ 2 * Real.exp ε) : + D * Real.exp (-(2 * δ + ε)) ≤ (A.rank : ℝ) := by + let T := (Aᴴ * A).trace.re + let T₂ := (((Aᴴ * A) ^ 2).trace.re) + let L := D * w * Real.exp (-δ) + let U := D * w ^ 2 * Real.exp ε + have hL : 0 < L := by dsimp [L]; positivity + have hT : 0 < T := lt_of_lt_of_le hL hfirst + have hHne : Aᴴ * A ≠ 0 := by + intro hz + simp [T, hz] at hT + have hT₂ : 0 < T₂ := + hermitian_trace_sq_pos (Matrix.isHermitian_conjTranspose_mul_self A) hHne + have hU : 0 < U := lt_of_lt_of_le hT₂ hsecond + have hsq : L ^ 2 ≤ T ^ 2 := by nlinarith [hfirst] + have hratio : L ^ 2 / U ≤ (A.rank : ℝ) := calc + L ^ 2 / U ≤ T ^ 2 / U := div_le_div_of_nonneg_right hsq hU.le + _ ≤ T ^ 2 / T₂ := div_le_div_of_nonneg_left (sq_nonneg T) hT₂ hsecond + _ ≤ (A.rank : ℝ) := gram_rank_ge_trace_ratio A hT₂ + have hexp : Real.exp (-(2 * δ + ε)) * Real.exp ε = Real.exp (-δ) ^ 2 := by + rw [pow_two, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + have heq : D * Real.exp (-(2 * δ + ε)) = L ^ 2 / U := by + apply (eq_div_iff (ne_of_gt hU)).2 + dsimp [L, U] + calc + D * Real.exp (-(2 * δ + ε)) * (D * w ^ 2 * Real.exp ε) = + D ^ 2 * w ^ 2 * (Real.exp (-(2 * δ + ε)) * Real.exp ε) := by ring + _ = D ^ 2 * w ^ 2 * Real.exp (-δ) ^ 2 := by rw [hexp] + _ = (D * w * Real.exp (-δ)) ^ 2 := by ring + rw [heq] + exact hratio + +end MomentComparison + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/MatrixPathPairings.lean b/lean/OAI/Algebra/DepthFive/MatrixPathPairings.lean new file mode 100644 index 0000000000000000000000000000000000000000..3aa83dade6e837a0c18ed6c14e047eef24a49daf --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MatrixPathPairings.lean @@ -0,0 +1,138 @@ +import OAI.Algebra.DepthFive.MatrixPathVertices +import OAI.Algebra.DepthFive.RelaxedPaths + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.Pairings + +variable {α β σ : Type*} + +/-- Apply a representation equivalence independently to the four paths. -/ +def matrixPathLabelsEquiv (e : α ≃ β) : Labels α ≃ Labels β where + toFun x := ⟨e x.p, e x.q, e x.r, e x.s⟩ + invFun x := ⟨e.symm x.p, e.symm x.q, e.symm x.r, e.symm x.s⟩ + left_inv x := by cases x; simp + right_inv x := by cases x; simp + +/-- Transpose four vertex functions into four labels at each vertex. -/ +def matrixPathFunctionEquiv (d : ℕ) : Labels (Fin d → α) ≃ (Fin d → Labels α) where + toFun x t := ⟨x.p t, x.q t, x.r t, x.s t⟩ + invFun x := ⟨fun t => (x t).p, fun t => (x t).q, fun t => (x t).r, fun t => (x t).s⟩ + left_inv x := by cases x; rfl + right_inv x := by funext t; apply Labels.ext <;> rfl + +/-- Quadruples of exact enumerated matrix paths have the internal-label representation +used by `RelaxedPaths` and `CompatiblePaths`. -/ +def quadruplePathIndexEquiv [Fintype α] [DecidableEq α] (d : ℕ) + (labels : Fin (d + 1) → σ) (a : α) : + (Fin d → Labels α) ≃ Labels (Fin (matrixEntryPaths (List.ofFn labels) a a).length) := + (matrixPathFunctionEquiv d).symm.trans + (matrixPathLabelsEquiv (internalPathEquiv d labels a a)) + +@[simp] theorem quadruplePathIndexEquiv_get_p [Fintype α] [DecidableEq α] (d : ℕ) + (labels : Fin (d + 1) → σ) (a : α) (x : Fin d → Labels α) : + (matrixEntryPaths (List.ofFn labels) a a).get (quadruplePathIndexEquiv d labels a x).p = + internalPathEdges labels a a (fun t => (x t).p) := + get_internalPathEquiv d labels a a _ + +@[simp] theorem quadruplePathIndexEquiv_get_q [Fintype α] [DecidableEq α] (d : ℕ) + (labels : Fin (d + 1) → σ) (a : α) (x : Fin d → Labels α) : + (matrixEntryPaths (List.ofFn labels) a a).get (quadruplePathIndexEquiv d labels a x).q = + internalPathEdges labels a a (fun t => (x t).q) := + get_internalPathEquiv d labels a a _ + +@[simp] theorem quadruplePathIndexEquiv_get_r [Fintype α] [DecidableEq α] (d : ℕ) + (labels : Fin (d + 1) → σ) (a : α) (x : Fin d → Labels α) : + (matrixEntryPaths (List.ofFn labels) a a).get (quadruplePathIndexEquiv d labels a x).r = + internalPathEdges labels a a (fun t => (x t).r) := + get_internalPathEquiv d labels a a _ + +@[simp] theorem quadruplePathIndexEquiv_get_s [Fintype α] [DecidableEq α] (d : ℕ) + (labels : Fin (d + 1) → σ) (a : α) (x : Fin d → Labels α) : + (matrixEntryPaths (List.ofFn labels) a a).get (quadruplePathIndexEquiv d labels a x).s = + internalPathEdges labels a a (fun t => (x t).s) := + get_internalPathEquiv d labels a a _ + +/-- Coordinate projections commute with adjoining the fixed external vertices. -/ +theorem project_closePaths (d : ℕ) (a : α) (x : Fin d → Labels α) + (proj : Labels α → α) (hp : ∀ a, proj (constantLabels a) = a) : + (fun t => proj (closePaths a x t)) = + Fin.cons a (Fin.snoc (fun t => proj (x t)) a) := by + funext t + refine Fin.cases ?_ (fun k => ?_) t + · simp [closePaths, hp] + · refine Fin.lastCases ?_ (fun k => ?_) k + · simp [closePaths, -Fin.succ_last, hp] + · simp [closePaths] + +/-- Exact ordered edges after projecting any of the four closed coordinate paths. -/ +theorem internalPathEdges_project_closePaths (d : ℕ) + (labels : Fin (d + 1) → σ) (a : α) (x : Fin d → Labels α) + (proj : Labels α → α) (hp : ∀ a, proj (constantLabels a) = a) : + internalPathEdges labels a a (fun t => proj (x t)) = + List.ofFn (fun t : Fin (d + 1) => + (labels t, proj (closePaths a x t.castSucc), proj (closePaths a x t.succ))) := by + have h := project_closePaths d a x proj hp + unfold internalPathEdges + apply congrArg List.ofFn + funext t + have hleft := congrFun h t.castSucc + have hright := congrFun h t.succ + rw [Fin.cons_succ] at hright + rw [Fin.cons_snoc_eq_snoc_cons, Fin.snoc_castSucc] at hleft + rw [hleft, hright] + +/-- The four-field record is a nested Cartesian product. -/ +def matrixPathLabelsProdEquiv : Labels α ≃ α × α × α × α where + toFun x := (x.p, x.q, x.r, x.s) + invFun x := ⟨x.1, x.2.1, x.2.2.1, x.2.2.2⟩ + left_inv x := by cases x; rfl + right_inv x := by rcases x with ⟨p,q,r,s⟩; rfl + +/-- A sum over four-field records is precisely the iterated fourfold sum. -/ +theorem sum_matrixPathLabels [Fintype α] {R : Type*} [AddCommMonoid R] + (f : Labels α → R) : + (∑ x : Labels α, f x) = ∑ p : α, ∑ q : α, ∑ r : α, ∑ s : α, f ⟨p,q,r,s⟩ := by + simpa only [Fintype.sum_prod_type, matrixPathLabelsProdEquiv, Equiv.coe_fn_symm_mk] using + (Equiv.sum_comp (matrixPathLabelsProdEquiv (α := α)).symm f).symm + +/-- Reindex the complete four-path sum into the exact internal-label space used by +pairing classification. No positivity or compatibility premise is required. -/ +theorem sum_four_matrixEntryPaths_eq [Fintype α] [DecidableEq α] + {R : Type*} [AddCommMonoid R] (d : ℕ) + (labels : Fin (d + 1) → σ) (a : α) + (f : List (σ × α × α) → List (σ × α × α) → + List (σ × α × α) → List (σ × α × α) → R) : + (∑ p : Fin (matrixEntryPaths (List.ofFn labels) a a).length, + ∑ q : Fin (matrixEntryPaths (List.ofFn labels) a a).length, + ∑ r : Fin (matrixEntryPaths (List.ofFn labels) a a).length, + ∑ s : Fin (matrixEntryPaths (List.ofFn labels) a a).length, + f ((matrixEntryPaths (List.ofFn labels) a a).get p) + ((matrixEntryPaths (List.ofFn labels) a a).get q) + ((matrixEntryPaths (List.ofFn labels) a a).get r) + ((matrixEntryPaths (List.ofFn labels) a a).get s)) = + ∑ x : Fin d → Labels α, + f (internalPathEdges labels a a (fun t => (x t).p)) + (internalPathEdges labels a a (fun t => (x t).q)) + (internalPathEdges labels a a (fun t => (x t).r)) + (internalPathEdges labels a a (fun t => (x t).s)) := by + let g : Labels (Fin (matrixEntryPaths (List.ofFn labels) a a).length) → R := + fun x => f ((matrixEntryPaths (List.ofFn labels) a a).get x.p) + ((matrixEntryPaths (List.ofFn labels) a a).get x.q) + ((matrixEntryPaths (List.ofFn labels) a a).get x.r) + ((matrixEntryPaths (List.ofFn labels) a a).get x.s) + calc + _ = ∑ x, g x := (sum_matrixPathLabels g).symm + _ = _ := by + simpa only [g, quadruplePathIndexEquiv_get_p, quadruplePathIndexEquiv_get_q, + quadruplePathIndexEquiv_get_r, quadruplePathIndexEquiv_get_s] using + (Equiv.sum_comp (quadruplePathIndexEquiv d labels a) g).symm + +end Problem335.Pairings + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/MatrixPathSemantics.lean b/lean/OAI/Algebra/DepthFive/MatrixPathSemantics.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa0a443ede4149be100f31cb02a175dcb6247ebf --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MatrixPathSemantics.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.DepthFive.Basic +import OAI.Algebra.DepthFive.MatrixPaths + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ ι R : Type*} + +/-- Replace a list by its enumeration through finite indices, under an arbitrary map. -/ +theorem map_finRange_get_eq {α β : Type*} (xs : List α) (f : α → β) : + ((List.finRange xs.length).map (fun k => f (xs.get k))) = xs.map f := by + simpa only [List.map_map, Function.comp_def] using + congrArg (List.map f) (List.map_get_finRange xs) + +/-- Matrix-path expansion in the finite-index form used by circuit input lists. -/ +theorem matrixEntryPaths_get_sum_prod [Fintype ι] [DecidableEq ι] [Semiring R] + (A : σ → Matrix ι ι R) (labels : List σ) (i j : ι) : + ((List.finRange (matrixEntryPaths labels i j).length).map + (fun k => (((matrixEntryPaths labels i j).get k).map + (fun e => A e.1 e.2.1 e.2.2)).prod)).sum = + ((labels.map A).prod) i j := by + rw [map_finRange_get_eq (matrixEntryPaths labels i j) + (fun p : List (σ × ι × ι) => (p.map (fun e => A e.1 e.2.1 e.2.2)).prod)] + exact matrixEntryPaths_sum_prod A labels i j + +/-- The same expansion as a finite sum, convenient for finite-type gate constructors. -/ +theorem matrixEntryPaths_fin_sum_prod [Fintype ι] [DecidableEq ι] [Semiring R] + (A : σ → Matrix ι ι R) (labels : List σ) (i j : ι) : + (∑ k : Fin (matrixEntryPaths labels i j).length, + (((matrixEntryPaths labels i j).get k).map + (fun e => A e.1 e.2.1 e.2.2)).prod) = + ((labels.map A).prod) i j := by + rw [← List.sum_ofFn] + have h := congrArg + (List.map (fun p : List (σ × ι × ι) => (p.map (fun e => A e.1 e.2.1 e.2.2)).prod)) + (List.ofFn_get (matrixEntryPaths labels i j)) + simp only [List.map_ofFn, Function.comp_def] at h + rw [h] + exact matrixEntryPaths_sum_prod A labels i j + +/-- Every finite-indexed path contributes its label's declared degree exactly once. -/ +theorem matrixEntryPaths_get_weight_sum [Fintype ι] [DecidableEq ι] + (labels : List σ) (i j : ι) (w : σ → ℕ) + (k : Fin (matrixEntryPaths labels i j).length) : + ((((matrixEntryPaths labels i j).get k).map (fun e => w e.1)).sum) = + (labels.map w).sum := by + have h := matrixEntryPaths_labels labels i j _ (List.get_mem _ k) + have hm := congrArg (List.map w) h + simpa only [List.map_map, Function.comp_def] using congrArg List.sum hm + +/-- Each block-entry middle gate sums precisely the variable monomials of its matrix product. -/ +theorem matrixEntryPaths_get_sum_monomial (K : Type*) [CommSemiring K] (n : ℕ) + (labels : List (Fin n)) (i j : Fin n) : + ((List.finRange (matrixEntryPaths labels i j).length).map + (fun k => (((matrixEntryPaths labels i j).get k).map + (fun e => (MvPolynomial.X e : MvPolynomial (Fin n × Fin n × Fin n) K))).prod)).sum = + ((labels.map (immLayer K n)).prod) i j := by + exact matrixEntryPaths_get_sum_prod (immLayer K n) labels i j + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/MatrixPathVertices.lean b/lean/OAI/Algebra/DepthFive/MatrixPathVertices.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a2d6e8d4464b586893fc539984fef4fb816ab71 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MatrixPathVertices.lean @@ -0,0 +1,180 @@ +import OAI.Algebra.DepthFive.MatrixPaths + +namespace OAI + +noncomputable section + +namespace Problem335 + +variable {σ ι : Type*} + +/-- Record the edges of a path from its internal vertices and fixed endpoints. -/ +def internalPathEdges {d : ℕ} (labels : Fin (d + 1) → σ) (i j : ι) + (p : Fin d → ι) : List (σ × ι × ι) := + List.ofFn fun t : Fin (d + 1) => + (labels t, Fin.cons (α := fun _ => ι) i p t, Fin.snoc (α := fun _ => ι) p j t) + +theorem internalPathEdges_mem [Fintype ι] [DecidableEq ι] + (d : ℕ) (labels : Fin (d + 1) → σ) (i j : ι) (p : Fin d → ι) : + internalPathEdges labels i j p ∈ matrixEntryPaths (List.ofFn labels) i j := by + induction d generalizing i with + | zero => simp [internalPathEdges, List.ofFn_succ, matrixEntryPaths, Fin.snoc_zero] + | succ d ih => + rw [← Fin.cons_self_tail p] + unfold internalPathEdges + rw [List.ofFn_succ, List.ofFn_succ] + conv_rhs => rw [List.ofFn_succ] + rw [matrixEntryPaths] + apply List.mem_flatMap.mpr + refine ⟨p 0, by simp, ?_⟩ + apply List.mem_map.mpr + refine ⟨internalPathEdges (Fin.tail labels) (p 0) j (Fin.tail p), ?_, ?_⟩ + · simpa only [List.ofFn_succ, Fin.tail] using + ih (Fin.tail labels) (p 0) (Fin.tail p) + · simp only [internalPathEdges, ← Fin.cons_snoc_eq_snoc_cons, + Fin.cons_zero, Fin.cons_succ, Fin.tail] + +theorem internalPathEdges_injective {d : ℕ} + (labels : Fin (d + 1) → σ) (i j : ι) : + Function.Injective (internalPathEdges labels i j) := by + intro p q h + have hf := List.ofFn_injective h + funext t + have ht := congrArg (fun f => (f t.castSucc).2.2) hf + simpa only [Fin.snoc_castSucc] using ht + +/-- Locate the explicitly described path in the exact list enumeration. -/ +def internalPathIndex [Fintype ι] [DecidableEq ι] {d : ℕ} + (labels : Fin (d + 1) → σ) (i j : ι) (p : Fin d → ι) : + Fin (matrixEntryPaths (List.ofFn labels) i j).length := + Classical.choose (List.mem_iff_get.mp (internalPathEdges_mem d labels i j p)) + +@[simp] theorem get_internalPathIndex [Fintype ι] [DecidableEq ι] {d : ℕ} + (labels : Fin (d + 1) → σ) (i j : ι) (p : Fin d → ι) : + (matrixEntryPaths (List.ofFn labels) i j).get (internalPathIndex labels i j p) = + internalPathEdges labels i j p := + Classical.choose_spec (List.mem_iff_get.mp (internalPathEdges_mem d labels i j p)) + +theorem internalPathIndex_injective [Fintype ι] [DecidableEq ι] {d : ℕ} + (labels : Fin (d + 1) → σ) (i j : ι) : + Function.Injective (internalPathIndex labels i j) := by + intro p q h + apply internalPathEdges_injective labels i j + rw [← get_internalPathIndex labels i j p, ← get_internalPathIndex labels i j q, h] + +/-- The canonical matrix-path list and the tuple of internal vertices enumerate +exactly the same paths. The edge list is preserved, not merely its cardinality. -/ +def internalPathEquiv [Fintype ι] [DecidableEq ι] (d : ℕ) + (labels : Fin (d + 1) → σ) (i j : ι) : + (Fin d → ι) ≃ Fin (matrixEntryPaths (List.ofFn labels) i j).length := + Equiv.ofBijective (internalPathIndex labels i j) + ((Fintype.bijective_iff_injective_and_card _).mpr ⟨internalPathIndex_injective labels i j, by + simp only [Fintype.card_fun, Fintype.card_fin] + rw [matrixEntryPaths_length _ (by simp) i j] + simp⟩) + +@[simp] theorem get_internalPathEquiv [Fintype ι] [DecidableEq ι] (d : ℕ) + (labels : Fin (d + 1) → σ) (i j : ι) (p : Fin d → ι) : + (matrixEntryPaths (List.ofFn labels) i j).get (internalPathEquiv d labels i j p) = + internalPathEdges labels i j p := get_internalPathIndex labels i j p + +/-- Vertex paths with both external endpoints fixed. -/ +def EndpointPath (d : ℕ) (i j : ι) := + {v : Fin (d + 2) → ι // v 0 = i ∧ v (Fin.last (d + 1)) = j} + +/-- Adjoining the two endpoints identifies arbitrary internal-vertex tuples with +endpoint-fixed vertex paths. -/ +def endpointPathEquiv (d : ℕ) (i j : ι) : (Fin d → ι) ≃ EndpointPath d i j where + toFun p := ⟨Fin.cons i (Fin.snoc p j), by simp⟩ + invFun v := Fin.init (Fin.tail v.1) + left_inv p := by simp + right_inv := by + rintro ⟨v, hi, hj⟩ + apply Subtype.ext + change Fin.cons i (Fin.snoc (Fin.init (Fin.tail v)) j) = v + have hj' : (Fin.tail v) (Fin.last d) = j := by simpa [Fin.tail] using hj + rw [← hj', Fin.snoc_init_self, ← hi, Fin.cons_self_tail] + +/-- Representation bridge from endpoint-fixed vertices to canonical list-based paths. -/ +def endpointPathIndexEquiv [Fintype ι] [DecidableEq ι] (d : ℕ) + (labels : Fin (d + 1) → σ) (i j : ι) : + EndpointPath d i j ≃ Fin (matrixEntryPaths (List.ofFn labels) i j).length := + (endpointPathEquiv d i j).symm.trans (internalPathEquiv d labels i j) + +/-- The representation equivalence preserves the exact ordered edge list. -/ +@[simp] theorem get_endpointPathIndexEquiv [Fintype ι] [DecidableEq ι] (d : ℕ) + (labels : Fin (d + 1) → σ) (i j : ι) (v : EndpointPath d i j) : + (matrixEntryPaths (List.ofFn labels) i j).get + (endpointPathIndexEquiv d labels i j v) = + List.ofFn (fun t : Fin (d + 1) => (labels t, v.1 t.castSucc, v.1 t.succ)) := by + obtain ⟨p, rfl⟩ := (endpointPathEquiv d i j).surjective v + simp only [endpointPathIndexEquiv, Equiv.trans_apply, Equiv.symm_apply_apply, + get_internalPathEquiv] + unfold internalPathEdges + apply congrArg List.ofFn + funext t + change (labels t, Fin.cons (α := fun _ => ι) i p t, + Fin.snoc (α := fun _ => ι) p j t) = + (labels t, Fin.cons (α := fun _ => ι) i (Fin.snoc (α := fun _ => ι) p j) t.castSucc, + Fin.cons (α := fun _ => ι) i (Fin.snoc (α := fun _ => ι) p j) t.succ) + rw [Fin.cons_succ, Fin.cons_snoc_eq_snoc_cons, Fin.snoc_castSucc] + +instance endpointPathFintype [Fintype ι] (d : ℕ) (i j : ι) : + Fintype (EndpointPath d i j) := + Fintype.ofEquiv (Fin d → ι) (endpointPathEquiv d i j) + +@[simp] theorem card_endpointPath [Fintype ι] (d : ℕ) (i j : ι) : + Fintype.card (EndpointPath d i j) = Fintype.card ι ^ d := by + simpa using Fintype.card_congr (endpointPathEquiv d i j).symm + +open scoped BigOperators + +/-- Reindex any path statistic from enumerated paths to internal vertices. -/ +theorem sum_matrixEntryPaths_eq_sum_internal [Fintype ι] [DecidableEq ι] + {R : Type*} [AddCommMonoid R] (d : ℕ) + (labels : Fin (d + 1) → σ) (i j : ι) (f : List (σ × ι × ι) → R) : + (∑ p : Fin (matrixEntryPaths (List.ofFn labels) i j).length, + f ((matrixEntryPaths (List.ofFn labels) i j).get p)) = + ∑ p : Fin d → ι, f (internalPathEdges labels i j p) := by + simpa only [get_internalPathEquiv] using + (Equiv.sum_comp (internalPathEquiv d labels i j) + (fun p => f ((matrixEntryPaths (List.ofFn labels) i j).get p))).symm + +/-- Reindex any path statistic to the endpoint-fixed vertex representation. +This can be applied once per path in the four-path trace expansion. -/ +theorem sum_matrixEntryPaths_eq_sum_vertices [Fintype ι] [DecidableEq ι] + {R : Type*} [AddCommMonoid R] (d : ℕ) + (labels : Fin (d + 1) → σ) (i j : ι) (f : List (σ × ι × ι) → R) : + (∑ p : Fin (matrixEntryPaths (List.ofFn labels) i j).length, + f ((matrixEntryPaths (List.ofFn labels) i j).get p)) = + ∑ v : EndpointPath d i j, + f (List.ofFn (fun t : Fin (d + 1) => (labels t, v.1 t.castSucc, v.1 t.succ))) := by + simpa only [get_endpointPathIndexEquiv] using + (Equiv.sum_comp (endpointPathIndexEquiv d labels i j) + (fun p => f ((matrixEntryPaths (List.ofFn labels) i j).get p))).symm + +/-- Additive edge statistics, including signed exponent shifts, are preserved. -/ +theorem sum_get_endpointPathIndexEquiv [Fintype ι] [DecidableEq ι] + {A : Type*} [AddCommMonoid A] (d : ℕ) (labels : Fin (d + 1) → σ) + (i j : ι) (v : EndpointPath d i j) (f : σ × ι × ι → A) : + (((matrixEntryPaths (List.ofFn labels) i j).get + (endpointPathIndexEquiv d labels i j v)).map f).sum = + ∑ t : Fin (d + 1), f (labels t, v.1 t.castSucc, v.1 t.succ) := by + rw [get_endpointPathIndexEquiv] + simp only [List.map_ofFn, List.sum_ofFn, Function.comp_def] + +/-- Multiplicative edge statistics, including path amplitudes, are preserved. -/ +theorem prod_get_endpointPathIndexEquiv [Fintype ι] [DecidableEq ι] + {A : Type*} [CommMonoid A] (d : ℕ) (labels : Fin (d + 1) → σ) + (i j : ι) (v : EndpointPath d i j) (f : σ × ι × ι → A) : + (((matrixEntryPaths (List.ofFn labels) i j).get + (endpointPathIndexEquiv d labels i j v)).map f).prod = + ∏ t : Fin (d + 1), f (labels t, v.1 t.castSucc, v.1 t.succ) := by + rw [get_endpointPathIndexEquiv] + simp only [List.map_ofFn, List.prod_ofFn, Function.comp_def] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/MatrixPaths.lean b/lean/OAI/Algebra/DepthFive/MatrixPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..183b35b210a8901e422269cddb6e1816ba2b335d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MatrixPaths.lean @@ -0,0 +1,171 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ ι R : Type*} + +/-- All labelled paths through a nonempty sequence of matrix layers. +The empty sequence uses the usual identity-matrix path convention. -/ +def matrixEntryPaths [Fintype ι] [DecidableEq ι] : + List σ → ι → ι → List (List (σ × ι × ι)) + | [], i, j => if i = j then [[]] else [] + | [t], i, j => [[(t, i, j)]] + | t :: u :: ts, i, j => + (Finset.univ.toList).flatMap fun k => + (matrixEntryPaths (u :: ts) k j).map fun p => (t, i, k) :: p + +theorem list_sum_map_flatMap [AddMonoid R] {α β : Type*} + (xs : List α) (f : α → List β) (g : β → R) : + ((xs.flatMap f).map g).sum = (xs.map fun a => ((f a).map g).sum).sum := by + induction xs with + | nil => simp + | cons x xs ih => simp [ih] + +/-- A path through `labels` chooses exactly one entry in each layer. -/ +theorem matrixEntryPaths_labels [Fintype ι] [DecidableEq ι] + (labels : List σ) (i j : ι) (p : List (σ × ι × ι)) + (hp : p ∈ matrixEntryPaths labels i j) : p.map Prod.fst = labels := by + induction labels generalizing i p with + | nil => + by_cases hij : i = j <;> simp_all [matrixEntryPaths] + | cons t ts ih => + cases ts with + | nil => simp_all [matrixEntryPaths] + | cons u us => + simp only [matrixEntryPaths, List.mem_flatMap, List.mem_map] at hp + obtain ⟨k, _, q, hq, rfl⟩ := hp + simp [ih k q hq] + +/-- Every enumerated path has one edge per layer. -/ +theorem matrixEntryPaths_path_length [Fintype ι] [DecidableEq ι] + (labels : List σ) (i j : ι) (p : List (σ × ι × ι)) + (hp : p ∈ matrixEntryPaths labels i j) : p.length = labels.length := by + have h := congrArg List.length (matrixEntryPaths_labels labels i j p hp) + simpa using h + +/-- The number of internal-index paths through a nonempty list of layers. -/ +theorem matrixEntryPaths_length [Fintype ι] [DecidableEq ι] + (labels : List σ) (hne : labels ≠ []) (i j : ι) : + (matrixEntryPaths labels i j).length = Fintype.card ι ^ (labels.length - 1) := by + induction labels generalizing i with + | nil => exact (hne rfl).elim + | cons t ts ih => + cases ts with + | nil => simp [matrixEntryPaths] + | cons u us => + simp only [matrixEntryPaths, List.length_flatMap, List.length_map] + simp_rw [ih (by simp)] + simp [pow_succ, Nat.mul_comm] + +/-- Matrix multiplication is the sum of the products along its labelled paths. -/ +theorem matrixEntryPaths_sum_prod [Fintype ι] [DecidableEq ι] [Semiring R] + (A : σ → Matrix ι ι R) (labels : List σ) (i j : ι) : + ((matrixEntryPaths labels i j).map + (fun p => (p.map (fun e => A e.1 e.2.1 e.2.2)).prod)).sum = + ((labels.map A).prod) i j := by + induction labels generalizing i with + | nil => by_cases hij : i = j <;> simp [matrixEntryPaths, hij] + | cons t ts ih => + cases ts with + | nil => simp [matrixEntryPaths] + | cons u us => + rw [matrixEntryPaths, list_sum_map_flatMap] + simp only [List.map_map, Function.comp_def, List.map_cons, List.prod_cons] + simp_rw [List.sum_map_mul_left, ih] + simp [Finset.sum_map_toList, Matrix.mul_apply] + +/-- Split a finite tuple into its first coordinate and its tail in a finite sum. -/ +theorem sum_fin_succ_functions [Fintype ι] [AddCommMonoid R] {d : ℕ} + (f : (Fin (d + 1) → ι) → R) : + (∑ p, f p) = ∑ k : ι, ∑ p : Fin d → ι, f (Fin.cons k p) := by + calc + (∑ p, f p) = ∑ kp : ι × (Fin d → ι), f (Fin.cons kp.1 kp.2) := + (Equiv.sum_comp (Fin.consEquiv fun _ : Fin (d + 1) => ι) f).symm + _ = _ := Fintype.sum_prod_type _ + +/-- A matrix-product entry expanded over the finite tuple of internal vertices. -/ +theorem matrix_ofFn_prod_eq_sum_paths [Fintype ι] [DecidableEq ι] [Semiring R] + (d : ℕ) (A : Fin (d + 1) → Matrix ι ι R) (i j : ι) : + (List.ofFn A).prod i j = + ∑ p : Fin d → ι, + (List.ofFn fun t : Fin (d + 1) => + A t (Fin.cons (α := fun _ => ι) i p t) (Fin.snoc (α := fun _ => ι) p j t)).prod := by + induction d generalizing i with + | zero => simp [List.ofFn_succ, Fin.snoc_zero] + | succ d ih => + rw [sum_fin_succ_functions] + conv_lhs => rw [List.ofFn_succ, List.prod_cons, Matrix.mul_apply] + apply Finset.sum_congr rfl + intro k hk + rw [ih, Finset.mul_sum] + apply Finset.sum_congr rfl + intro p hp + conv_rhs => rw [List.ofFn_succ, List.prod_cons] + simp only [← Fin.cons_snoc_eq_snoc_cons, Fin.cons_zero, Fin.cons_succ] + +/-- The labels of a path selected by its finite-list index. -/ +theorem matrixEntryPaths_get_labels [Fintype ι] [DecidableEq ι] + (labels : List σ) (i j : ι) (p : Fin (matrixEntryPaths labels i j).length) : + ((matrixEntryPaths labels i j).get p).map Prod.fst = labels := + matrixEntryPaths_labels labels i j _ (List.get_mem _ p) + +/-- Each list-indexed path has exactly as many edges as the list has layers. -/ +theorem matrixEntryPaths_get_length [Fintype ι] [DecidableEq ι] + (labels : List σ) (i j : ι) (p : Fin (matrixEntryPaths labels i j).length) : + ((matrixEntryPaths labels i j).get p).length = labels.length := + matrixEntryPaths_path_length labels i j _ (List.get_mem _ p) + +/-- The entry expansion in the finite-list-index form used by circuit gates. -/ +theorem matrixEntryPaths_sum_get [Fintype ι] [DecidableEq ι] [Semiring R] + (A : σ → Matrix ι ι R) (labels : List σ) (i j : ι) : + (∑ p : Fin (matrixEntryPaths labels i j).length, + (((matrixEntryPaths labels i j).get p).map + (fun e => A e.1 e.2.1 e.2.2)).prod) = ((labels.map A).prod) i j := by + calc + _ = ((matrixEntryPaths labels i j).map + (fun p => (p.map (fun e => A e.1 e.2.1 e.2.2)).prod)).sum := by + simpa only [List.get_eq_getElem] using + (Fin.sum_univ_fun_getElem (matrixEntryPaths labels i j) + (fun p : List (σ × ι × ι) => + (p.map (fun e => A e.1 e.2.1 e.2.2)).prod)) + _ = _ := matrixEntryPaths_sum_prod A labels i j + +/-- Consecutive blocks may be multiplied before multiplying the whole sequence. -/ +theorem matrix_block_prod [Fintype ι] [DecidableEq ι] [Semiring R] + (A : σ → Matrix ι ι R) (blocks : List (List σ)) : + (blocks.map (fun block => (block.map A).prod)).prod = + (blocks.flatten.map A).prod := by + simp only [List.map_flatten, List.prod_flatten, List.map_map, Function.comp_def] + +/-- Enumerating the block-index list and selecting blocks recovers the block list. -/ +theorem map_block_get_finRange {β : Type*} (blocks : List (List σ)) + (f : List σ → β) : + (List.finRange blocks.length).map (fun b => f (blocks.get b)) = blocks.map f := by + conv_rhs => rw [← List.map_get_finRange blocks] + rw [List.map_map] + rfl + +/-- Apply the path expansion to the matrix products of the consecutive blocks. -/ +theorem matrix_blocks_sum_get [Fintype ι] [DecidableEq ι] [Semiring R] + (A : σ → Matrix ι ι R) (blocks : List (List σ)) (i j : ι) : + (∑ p : Fin (matrixEntryPaths (List.finRange blocks.length) i j).length, + (((matrixEntryPaths (List.finRange blocks.length) i j).get p).map + (fun e => (((blocks.get e.1).map A).prod) e.2.1 e.2.2)).prod) = + ((blocks.flatten.map A).prod) i j := by + have h := matrixEntryPaths_sum_get + (fun b : Fin blocks.length => ((blocks.get b).map A).prod) + (List.finRange blocks.length) i j + have he := map_block_get_finRange blocks (fun block => (block.map A).prod) + rw [he, matrix_block_prod A blocks] at h + exact h + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/MixedOperator.lean b/lean/OAI/Algebra/DepthFive/MixedOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..45e0457fa2f659241df8d23a72d82b5965d66057 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MixedOperator.lean @@ -0,0 +1,103 @@ +import Mathlib + +namespace OAI + +/-! The full differentiation/multiplication substitution used by the rank measure. +The variables selected by `isV` act by partial differentiation; all others +act by multiplication. Since these two sets are disjoint, the operators +commute, and polynomial substitution is an algebra homomorphism. -/ + +noncomputable section + +namespace Problem335 + +open MvPolynomial + +universe u v +variable {K : Type u} [CommSemiring K] {σ : Type v} + +/-- Formal partial derivatives commute, over an arbitrary commutative semiring. -/ +theorem pderiv_pderiv_comm (i j : σ) (p : MvPolynomial σ K) : + pderiv i (pderiv j p) = pderiv j (pderiv i p) := by + classical + by_cases h : i = j + · subst j; rfl + ext m + simp only [coeff_pderiv, Finsupp.add_apply, Finsupp.single_apply, + ite_eq_right h, ite_eq_right (Ne.symm h), add_zero] + rw [add_right_comm m (Finsupp.single i 1) (Finsupp.single j 1)] + ring + +/-- The endomorphism assigned to an individual variable. -/ +def variableOperator (isV : σ → Bool) (i : σ) : + Module.End K (MvPolynomial σ K) := + if isV i then (pderiv i).toLinearMap else LinearMap.mulLeft K (X i) + +@[simp] theorem variableOperator_of_true (isV : σ → Bool) (i : σ) + (h : isV i = true) (p : MvPolynomial σ K) : + variableOperator isV i p = pderiv i p := by + simp [variableOperator, h] + +@[simp] theorem variableOperator_of_false (isV : σ → Bool) (i : σ) + (h : isV i = false) (p : MvPolynomial σ K) : + variableOperator isV i p = X i * p := by + simp [variableOperator, h] + +/-- Operators assigned to any two variables commute. -/ +theorem variableOperator_comm (isV : σ → Bool) (i j : σ) : + Commute (variableOperator (K := K) isV i) (variableOperator isV j) := by + classical + change variableOperator isV i * variableOperator isV j = + variableOperator isV j * variableOperator isV i + apply LinearMap.ext + intro p + change variableOperator isV i (variableOperator isV j p) = + variableOperator isV j (variableOperator isV i p) + cases hi : isV i <;> cases hj : isV j + · simp [variableOperator, hi, hj, mul_left_comm] + · have hij : i ≠ j := by intro h; subst j; simp_all + simp [variableOperator, hi, hj, pderiv_X_of_ne hij] + · have hji : j ≠ i := by intro h; subst j; simp_all + simp [variableOperator, hi, hj, pderiv_X_of_ne hji] + · simpa [variableOperator, hi, hj] using pderiv_pderiv_comm i j p + +open scoped IsMulCommutative in +/-- Substitution of derivatives on `V` and multiplication on its complement. +This is the full operator, before taking a bidegree component or restricting +to finite-dimensional homogeneous source and target spaces. -/ +def mixedOperator (isV : σ → Bool) : + MvPolynomial σ K →ₐ[K] Module.End K (MvPolynomial σ K) := by + let A := Algebra.adjoin K (Set.range (variableOperator (K := K) isV)) + let : IsMulCommutative A := Algebra.isMulCommutative_adjoin K (by + rintro x ⟨i, rfl⟩ y ⟨j, rfl⟩ _ + exact variableOperator_comm (K := K) isV i j) + exact A.val.comp (MvPolynomial.aeval fun i => + (⟨variableOperator isV i, Algebra.subset_adjoin ⟨i, rfl⟩⟩ : A)) + +@[simp] theorem mixedOperator_X (isV : σ → Bool) (i : σ) : + mixedOperator (K := K) isV (X i) = variableOperator isV i := by + simp [mixedOperator] + +@[simp] theorem mixedOperator_C (isV : σ → Bool) (a : K) : + mixedOperator isV (C a) = a • (1 : Module.End K (MvPolynomial σ K)) := by + simp [mixedOperator, Algebra.algebraMap_eq_smul_one] + +@[simp] theorem mixedOperator_add (isV : σ → Bool) (p q : MvPolynomial σ K) : + mixedOperator isV (p + q) = mixedOperator isV p + mixedOperator isV q := + map_add _ _ _ + +/-- The full operator respects products (unlike the projected finite rank map). -/ +@[simp] theorem mixedOperator_mul (isV : σ → Bool) (p q : MvPolynomial σ K) : + mixedOperator isV (p * q) = mixedOperator isV p * mixedOperator isV q := + map_mul _ _ _ + +theorem mixedOperator_mul_apply (isV : σ → Bool) (p q f : MvPolynomial σ K) : + mixedOperator isV (p * q) f = mixedOperator isV p (mixedOperator isV q f) := by + rw [mixedOperator_mul] + rfl + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/MixedOperatorBidegree.lean b/lean/OAI/Algebra/DepthFive/MixedOperatorBidegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..5878b285eda0c7a38072958d8df56374f1528d12 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MixedOperatorBidegree.lean @@ -0,0 +1,97 @@ +import OAI.Algebra.DepthFive.OperatorHomogeneity +import OAI.Algebra.DepthFive.OperatorRank + +namespace OAI + +/-! The mixed operator restricts to the finite bidegree spaces used by the rank measure. -/ + +noncomputable section + +namespace Problem335 + +open MvPolynomial + +variable {K σ : Type*} [CommSemiring K] + +private theorem weight_map_hom {A B : Type*} [AddCommMonoid A] [AddCommMonoid B] + (f : A →+ B) (w : σ → A) (e : σ →₀ ℕ) : + Finsupp.weight (f ∘ w) e = f (Finsupp.weight w e) := by + simp only [Finsupp.weight_apply, map_finsuppSum, map_nsmul, Function.comp_apply] + +private theorem weighted_homogeneous_map {A B : Type*} [AddCommMonoid A] [AddCommMonoid B] + (f : A →+ B) {w : σ → A} {p : MvPolynomial σ K} {d : A} + (hp : p.IsWeightedHomogeneous w d) : + p.IsWeightedHomogeneous (f ∘ w) (f d) := by + intro e he + rw [weight_map_hom, hp he] + +private def bidegreeCast : ℕ × ℕ →+ ℤ × ℤ := + (Nat.castAddMonoidHom ℤ).prodMap (Nat.castAddMonoidHom ℤ) + +private def bidegreeSign : ℕ × ℕ →+ ℤ × ℤ := + (-Nat.castAddMonoidHom ℤ).prodMap (Nat.castAddMonoidHom ℤ) + +private theorem bidegreeCast_injective : Function.Injective bidegreeCast := by + rintro ⟨a,b⟩ ⟨c,d⟩ h + simpa [bidegreeCast] using h + +private theorem operatorWeight_bidegree (isV : σ → Bool) : + operatorWeight isV (bidegreeCast ∘ bidegreeWeight isV) = + bidegreeSign ∘ bidegreeWeight isV := by + funext i + cases hi : isV i <;> + simp [operatorWeight, bidegreeWeight, bidegreeCast, bidegreeSign, hi] + +/-- Differentiation by a polynomial of bidegree `(k,m)` lowers derivative degree +by `k` and raises multiplication degree by `m`. -/ +theorem mixedOperator_mem_bidegreeSubmodule (isV : σ → Bool) + {q p : MvPolynomial σ K} {k m a b : ℕ} (hka : k ≤ a) + (hq : q ∈ bidegreeSubmodule isV k m) + (hp : p ∈ bidegreeSubmodule isV a b) : + mixedOperator isV q p ∈ bidegreeSubmodule isV (a - k) (b + m) := by + have hq' := weighted_homogeneous_map bidegreeSign hq + have hp' := weighted_homogeneous_map bidegreeCast hp + rw [← operatorWeight_bidegree isV] at hq' + have h := mixedOperator_isWeightedHomogeneous isV + (bidegreeCast ∘ bidegreeWeight isV) hq' hp' + intro e he + apply bidegreeCast_injective + rw [← weight_map_hom, h he] + simp [bidegreeCast, bidegreeSign, Nat.cast_sub hka, sub_eq_add_neg] + +/-- More differentiation than the available derivative degree annihilates the input. -/ +theorem mixedOperator_eq_zero_of_bidegree_lt (isV : σ → Bool) + {q p : MvPolynomial σ K} {k m a b : ℕ} (hka : a < k) + (hq : q ∈ bidegreeSubmodule isV k m) + (hp : p ∈ bidegreeSubmodule isV a b) : mixedOperator isV q p = 0 := by + have hq' := weighted_homogeneous_map bidegreeSign hq + have hp' := weighted_homogeneous_map bidegreeCast hp + rw [← operatorWeight_bidegree isV] at hq' + have h := mixedOperator_isWeightedHomogeneous isV + (bidegreeCast ∘ bidegreeWeight isV) hq' hp' + apply MvPolynomial.eq_zero_iff.mpr + intro e + by_contra he + have he' := h he + rw [weight_map_hom] at he' + have hfst := congrArg Prod.fst he' + simp [bidegreeCast, bidegreeSign] at hfst + omega + +/-- The degree-shift membership also holds without a degree inequality: when +`k > a`, the output is zero and belongs to every homogeneous submodule. -/ +theorem mixedOperator_mem_bidegreeSubmodule_all (isV : σ → Bool) + {q p : MvPolynomial σ K} {k m a b : ℕ} + (hq : q ∈ bidegreeSubmodule isV k m) + (hp : p ∈ bidegreeSubmodule isV a b) : + mixedOperator isV q p ∈ bidegreeSubmodule isV (a - k) (b + m) := by + by_cases hka : k ≤ a + · exact mixedOperator_mem_bidegreeSubmodule isV hka hq hp + · rw [mixedOperator_eq_zero_of_bidegree_lt isV (Nat.lt_of_not_ge hka) hq hp] + exact Submodule.zero_mem _ + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/MomentAssemblyInterfaces.lean b/lean/OAI/Algebra/DepthFive/MomentAssemblyInterfaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..840aadc5ef6b09bada490fb8c0e5b08b2cfbe594 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MomentAssemblyInterfaces.lean @@ -0,0 +1,13 @@ +import OAI.Algebra.DepthFive.ActualImmRank +import OAI.Algebra.DepthFive.ImmCompatibleTrace +import OAI.Algebra.DepthFive.ActualRelaxedWeightBound +import OAI.Algebra.DepthFive.PairingOccupationAverage +import OAI.Algebra.DepthFive.PairingAverageCardinality +import OAI.Algebra.DepthFive.BidegreeLocalProductAverage +import OAI.Algebra.DepthFive.ActualSecondMomentParameters +import OAI.Algebra.DepthFive.LowerBoundAssembly +import OAI.Algebra.DepthFive.PairingSourceAverage +import OAI.Algebra.DepthFive.ImmSecondMomentParameters +import OAI.Algebra.DepthFive.ConfiguredImmSecondMoment + +/-! Concrete identities for the second moment of iterated matrix multiplication. -/ diff --git a/lean/OAI/Algebra/DepthFive/MomentLossParameters.lean b/lean/OAI/Algebra/DepthFive/MomentLossParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..9179d57fdb01d06f8c9ae82c5ec0cba544a0de90 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/MomentLossParameters.lean @@ -0,0 +1,65 @@ +import OAI.Algebra.DepthFive.OccupationParameterBounds +import OAI.Algebra.DepthFive.ParameterBounds + +namespace OAI + +noncomputable section +namespace Problem335.LowerParameters + +/-- The first-moment loss can be expressed at the common square-root scale. -/ +theorem first_moment_loss_exp_lower {n : ℕ} (hn : 16 ≤ n) : + Real.exp (-64 * Real.sqrt (n : ℝ)) ≤ + Real.exp (-64 / Real.sqrt (n : ℝ)) := by + have hs := sqrt_ge_four hn + have hspos : 0 < Real.sqrt (n : ℝ) := by linarith + apply Real.exp_le_exp.mpr + apply (le_div_iff₀ hspos).mpr + nlinarith + +/-- The actual U-layer correction has square-root exponential cost. -/ +theorem u_layer_correction_le_exp {n : ℕ} (hn : 16 ≤ n) + (hbeta : beta n ≤ 2 / Real.sqrt (n : ℝ)) : + (1 + beta n) ^ m n ≤ Real.exp (2 * Real.sqrt (n : ℝ)) := by + have hb : 0 ≤ beta n := (beta_pos (by omega : 4 ≤ n)).le + have hm : (m n : ℝ) ≤ n := by exact_mod_cast m_le_n n + have hs := sqrt_ge_four hn + have hspos : 0 < Real.sqrt (n : ℝ) := by linarith + have hsq := Real.sq_sqrt (show (0 : ℝ) ≤ n by positivity) + have hmul : (m n : ℝ) * beta n ≤ (n : ℝ) * (2 / Real.sqrt (n : ℝ)) := by + gcongr + have heq : (n : ℝ) * (2 / Real.sqrt (n : ℝ)) = 2 * Real.sqrt (n : ℝ) := by + rw [← mul_div_assoc] + apply (div_eq_iff hspos.ne').mpr + nlinarith + calc + (1 + beta n) ^ m n ≤ (Real.exp (beta n)) ^ m n := by + gcongr + linarith [Real.add_one_le_exp (beta n)] + _ = Real.exp ((m n : ℝ) * beta n) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (hmul.trans_eq heq) + +/-- Consolidation of occupation, U-layer, and balanced-word losses. -/ +theorem second_moment_loss_exp_upper {n : ℕ} (hn : 16 ≤ n) + (hbeta : beta n ≤ 2 / Real.sqrt (n : ℝ)) : + Real.exp (64 / Real.sqrt (n : ℝ)) * (1 + beta n) ^ m n * + Real.exp (8 * Real.sqrt (n : ℝ)) ≤ + Real.exp (74 * Real.sqrt (n : ℝ)) := by + have hs := sqrt_ge_four hn + have hspos : 0 < Real.sqrt (n : ℝ) := by linarith + have hloss : 64 / Real.sqrt (n : ℝ) ≤ 64 * Real.sqrt (n : ℝ) := by + apply (div_le_iff₀ hspos).mpr + nlinarith + calc + _ ≤ Real.exp (64 / Real.sqrt (n : ℝ)) * + Real.exp (2 * Real.sqrt (n : ℝ)) * Real.exp (8 * Real.sqrt (n : ℝ)) := by + gcongr + exact u_layer_correction_le_exp hn hbeta + _ = Real.exp (64 / Real.sqrt (n : ℝ) + 2 * Real.sqrt (n : ℝ) + + 8 * Real.sqrt (n : ℝ)) := by rw [← Real.exp_add, ← Real.exp_add] + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OccupationComparison.lean b/lean/OAI/Algebra/DepthFive/OccupationComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed18c6354dcc1aca1b343d8157fe51849d24f38a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OccupationComparison.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.DepthFive.OccupationRatioAlgebra + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- A common loss bound can be used for all orders bounded by `H₀`. -/ +theorem occupation_factorial_ratio_lower_of_le {t r H H₀ : ℕ} + (ht : 0 < t) (hr : 0 < r) (hH : H ≤ H₀) (hH₀ : 2 * H₀ ≤ t) : + Real.exp (-(H₀ : ℝ) ^ 2 / t - (H₀ : ℝ) ^ 2 / (2 * r)) * + ((t : ℝ) / r) ^ H ≤ (t.descFactorial H : ℝ) / (r.ascFactorial H : ℝ) := by + apply le_trans _ (exp_mul_mean_pow_le_descFactorial_div_ascFactorial ht hr + (show 2 * H ≤ t by omega)) + apply mul_le_mul_of_nonneg_right _ (by positivity) + apply Real.exp_le_exp.mpr + have hsq : (H : ℝ) ^ 2 ≤ (H₀ : ℝ) ^ 2 := by + have hh : (H : ℝ) ≤ H₀ := by exact_mod_cast hH + nlinarith [show 0 ≤ (H : ℝ) by positivity] + have h₁ := div_le_div_of_nonneg_right hsq (show 0 ≤ (t : ℝ) by positivity) + have h₂ := div_le_div_of_nonneg_right hsq (show 0 ≤ 2 * (r : ℝ) by positivity) + simp only [neg_div] + linarith + +/-- Termwise occupation comparison for every nonnegative factorial-basis expansion. -/ +theorem weighted_factorialMoment_sum_le {ι : Type*} (s : Finset ι) + (c : ι → ℝ) (H : ι → ℕ) {t r : ℕ} (hr : 0 < r) + (hc : ∀ i ∈ s, 0 ≤ c i) : + (∑ i ∈ s, c i * ((t.descFactorial (H i) : ℝ) / (r.ascFactorial (H i) : ℝ))) ≤ + ∑ i ∈ s, c i * ((t : ℝ) / r) ^ H i := by + apply Finset.sum_le_sum + intro i hi + exact mul_le_mul_of_nonneg_left (descFactorial_div_ascFactorial_le_mean_pow_of_pos hr) + (hc i hi) + +/-- Uniform lower occupation comparison for a nonnegative finite expansion. -/ +theorem exp_mul_weighted_mean_sum_le {ι : Type*} (s : Finset ι) + (c : ι → ℝ) (H : ι → ℕ) {t r H₀ : ℕ} (ht : 0 < t) (hr : 0 < r) + (hH₀ : 2 * H₀ ≤ t) (hc : ∀ i ∈ s, 0 ≤ c i) (hH : ∀ i ∈ s, H i ≤ H₀) : + Real.exp (-(H₀ : ℝ) ^ 2 / t - (H₀ : ℝ) ^ 2 / (2 * r)) * + (∑ i ∈ s, c i * ((t : ℝ) / r) ^ H i) ≤ + ∑ i ∈ s, c i * ((t.descFactorial (H i) : ℝ) / (r.ascFactorial (H i) : ℝ)) := by + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i hi + calc + _ = c i * (Real.exp (-(H₀ : ℝ) ^ 2 / t - (H₀ : ℝ) ^ 2 / (2 * r)) * + ((t : ℝ) / r) ^ H i) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left + (occupation_factorial_ratio_lower_of_le ht hr (hH i hi) hH₀) + (hc i hi) + +/-- Independent variable groups multiply their moment comparisons and add losses. -/ +theorem two_group_factorial_ratio_lower_of_le {a v b u h k H J : ℕ} + (ha : 0 < a) (hv : 0 < v) (hb : 0 < b) (hu : 0 < u) + (hh : h ≤ H) (hk : k ≤ J) (hH : 2 * H ≤ a) (hJ : 2 * J ≤ b) : + Real.exp ((-(H : ℝ) ^ 2 / a - (H : ℝ) ^ 2 / (2 * v)) + + (-(J : ℝ) ^ 2 / b - (J : ℝ) ^ 2 / (2 * u))) * + (((a : ℝ) / v) ^ h * ((b : ℝ) / u) ^ k) ≤ + ((a.descFactorial h : ℝ) / (v.ascFactorial h : ℝ)) * + ((b.descFactorial k : ℝ) / (u.ascFactorial k : ℝ)) := by + have h₁ := occupation_factorial_ratio_lower_of_le ha hv hh hH + have h₂ := occupation_factorial_ratio_lower_of_le hb hu hk hJ + have hprod := mul_le_mul h₁ h₂ (by positivity) (by positivity) + rw [Real.exp_add] + simpa only [mul_assoc, mul_left_comm, mul_comm] using hprod + +/-- Upper comparison for nonnegative expansions in two independent groups. -/ +theorem weighted_two_group_factorialMoment_sum_le {ι : Type*} (s : Finset ι) + (c : ι → ℝ) (h k : ι → ℕ) {a v b u : ℕ} (hv : 0 < v) (hu : 0 < u) + (hc : ∀ i ∈ s, 0 ≤ c i) : + (∑ i ∈ s, c i * + (((a.descFactorial (h i) : ℝ) / (v.ascFactorial (h i) : ℝ)) * + ((b.descFactorial (k i) : ℝ) / (u.ascFactorial (k i) : ℝ)))) ≤ + ∑ i ∈ s, c i * (((a : ℝ) / v) ^ h i * ((b : ℝ) / u) ^ k i) := by + apply Finset.sum_le_sum + intro i hi + apply mul_le_mul_of_nonneg_left _ (hc i hi) + exact mul_le_mul (descFactorial_div_ascFactorial_le_mean_pow_of_pos hv) + (descFactorial_div_ascFactorial_le_mean_pow_of_pos hu) (by positivity) (by positivity) + +/-- Uniform lower comparison for the two-group factorial expansions in both traces. -/ +theorem exp_mul_weighted_two_group_mean_sum_le {ι : Type*} (s : Finset ι) + (c : ι → ℝ) (h k : ι → ℕ) {a v b u H J : ℕ} + (ha : 0 < a) (hv : 0 < v) (hb : 0 < b) (hu : 0 < u) + (hH : 2 * H ≤ a) (hJ : 2 * J ≤ b) (hc : ∀ i ∈ s, 0 ≤ c i) + (hh : ∀ i ∈ s, h i ≤ H) (hk : ∀ i ∈ s, k i ≤ J) : + Real.exp ((-(H : ℝ) ^ 2 / a - (H : ℝ) ^ 2 / (2 * v)) + + (-(J : ℝ) ^ 2 / b - (J : ℝ) ^ 2 / (2 * u))) * + (∑ i ∈ s, c i * (((a : ℝ) / v) ^ h i * ((b : ℝ) / u) ^ k i)) ≤ + ∑ i ∈ s, c i * + (((a.descFactorial (h i) : ℝ) / (v.ascFactorial (h i) : ℝ)) * + ((b.descFactorial (k i) : ℝ) / (u.ascFactorial (k i) : ℝ))) := by + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i hi + calc + _ = c i * (Real.exp ((-(H : ℝ) ^ 2 / a - (H : ℝ) ^ 2 / (2 * v)) + + (-(J : ℝ) ^ 2 / b - (J : ℝ) ^ 2 / (2 * u))) * + (((a : ℝ) / v) ^ h i * ((b : ℝ) / u) ^ k i)) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left + (two_group_factorial_ratio_lower_of_le ha hv hb hu (hh i hi) (hk i hi) hH hJ) + (hc i hi) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OccupationExpansion.lean b/lean/OAI/Algebra/DepthFive/OccupationExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..17031a5b268521e2a90bb6aa5238fa343905fedd --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OccupationExpansion.lean @@ -0,0 +1,152 @@ +import OAI.Algebra.DepthFive.OccupationSum +import OAI.Algebra.DepthFive.OccupationComparison + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- A finite expansion in the multivariate falling-factorial basis. -/ +def factorialExpansionValue {ι J : Type*} [Fintype ι] + (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (M : ι →₀ ℕ) : ℝ := + ∑ j ∈ s, c j * ∏ i, ((M i).descFactorial (d j i) : ℝ) + +/-- The corresponding product-geometric factorial-moment expression. -/ +def geometricExpansionValue {ι J : Type*} [Fintype ι] + (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (G : ℝ) : ℝ := + ∑ j ∈ s, (c j * ∏ i, (d j i).factorial : ℝ) * G ^ (∑ i, d j i) + +/-- Average over the finite uniform weak-composition space. -/ +def compositionExpansionMean {ι J : Type*} [Fintype ι] [DecidableEq ι] + (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (t : ℕ) : ℝ := + (∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset ι) t, + factorialExpansionValue s c d M) / + (Finset.finsuppAntidiag (Finset.univ : Finset ι) t).card + +/-- Linearity and the exact occupation factorial-moment identity. -/ +theorem compositionExpansionMean_eq {ι J : Type*} [Fintype ι] [DecidableEq ι] + [Nonempty ι] (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (t : ℕ) : + compositionExpansionMean s c d t = + ∑ j ∈ s, (c j * ∏ i, (d j i).factorial : ℝ) * + ((t.descFactorial (∑ i, d j i) : ℝ) / + ((Fintype.card ι).ascFactorial (∑ i, d j i) : ℝ)) := by + unfold compositionExpansionMean factorialExpansionValue + rw [Finset.sum_comm, Finset.sum_div] + apply Finset.sum_congr rfl + intro j hj + rw [← Finset.mul_sum, mul_div_assoc, occupation_factorial_moment] + push_cast + ring + +/-- Upper geometric comparison, including zero total occupation and arbitrary orders. -/ +theorem compositionExpansionMean_le_geometric {ι J : Type*} [Fintype ι] + [DecidableEq ι] [Nonempty ι] (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) + (t : ℕ) (hc : ∀ j ∈ s, 0 ≤ c j) : + compositionExpansionMean s c d t ≤ + geometricExpansionValue s c d ((t : ℝ) / Fintype.card ι) := by + rw [compositionExpansionMean_eq] + apply weighted_factorialMoment_sum_le s _ _ Fintype.card_pos + intro j hj + exact mul_nonneg (hc j hj) (by positivity) + +/-- The lower geometric comparison depends only on a uniform total-order bound. -/ +theorem exp_mul_geometric_le_compositionExpansionMean {ι J : Type*} [Fintype ι] + [DecidableEq ι] [Nonempty ι] (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) + {t H : ℕ} (ht : 0 < t) (hH : 2 * H ≤ t) (hc : ∀ j ∈ s, 0 ≤ c j) + (hd : ∀ j ∈ s, ∑ i, d j i ≤ H) : + Real.exp (-(H : ℝ) ^ 2 / t - (H : ℝ) ^ 2 / (2 * Fintype.card ι)) * + geometricExpansionValue s c d ((t : ℝ) / Fintype.card ι) ≤ + compositionExpansionMean s c d t := by + rw [compositionExpansionMean_eq] + apply exp_mul_weighted_mean_sum_le s _ _ ht Fintype.card_pos hH _ hd + intro j hj + exact mul_nonneg (hc j hj) (by positivity) + +/-- Uniform averages in two independent weak-composition groups, with a shared term index. -/ +def twoGroupCompositionExpansionMean {ι κ J : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] (s : Finset J) (c : J → ℝ) + (d : J → ι → ℕ) (e : J → κ → ℕ) (a b : ℕ) : ℝ := + (∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset ι) a, + compositionExpansionMean s + (fun j => c j * ∏ i, ((M i).descFactorial (d j i) : ℝ)) e b) / + (Finset.finsuppAntidiag (Finset.univ : Finset ι) a).card + +/-- The product-geometric expression for a two-group factorial expansion. -/ +def twoGroupGeometricExpansionValue {ι κ J : Type*} [Fintype ι] [Fintype κ] + (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (e : J → κ → ℕ) + (A B : ℝ) : ℝ := + ∑ j ∈ s, (c j * (∏ i, (d j i).factorial : ℝ) * (∏ i, (e j i).factorial : ℝ)) * + (A ^ (∑ i, d j i) * B ^ (∑ i, e j i)) + +theorem twoGroupCompositionExpansionMean_eq {ι κ J : Type*} + [Fintype ι] [DecidableEq ι] [Nonempty ι] + [Fintype κ] [DecidableEq κ] [Nonempty κ] + (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (e : J → κ → ℕ) (a b : ℕ) : + twoGroupCompositionExpansionMean s c d e a b = + ∑ j ∈ s, (c j * (∏ i, (d j i).factorial : ℝ) * (∏ i, (e j i).factorial : ℝ)) * + (((a.descFactorial (∑ i, d j i) : ℝ) / + ((Fintype.card ι).ascFactorial (∑ i, d j i) : ℝ)) * + ((b.descFactorial (∑ i, e j i) : ℝ) / + ((Fintype.card κ).ascFactorial (∑ i, e j i) : ℝ))) := by + unfold twoGroupCompositionExpansionMean + simp_rw [compositionExpansionMean_eq] + rw [Finset.sum_comm, Finset.sum_div] + apply Finset.sum_congr rfl + intro j hj + calc + _ = (c j * (∏ i, (e j i).factorial : ℝ) * + ((b.descFactorial (∑ i, e j i) : ℝ) / + ((Fintype.card κ).ascFactorial (∑ i, e j i) : ℝ))) * + ((∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset ι) a, + ∏ i, ((M i).descFactorial (d j i) : ℝ)) / + (Finset.finsuppAntidiag (Finset.univ : Finset ι) a).card) := by + simp only [Finset.sum_div, Finset.mul_sum] + apply Finset.sum_congr rfl + intro M hM + push_cast + ring + _ = _ := by + rw [occupation_factorial_moment] + ring + +/-- Actual upper occupation comparison for nonnegative two-group expansions. -/ +theorem twoGroupCompositionExpansionMean_le_geometric {ι κ J : Type*} + [Fintype ι] [DecidableEq ι] [Nonempty ι] + [Fintype κ] [DecidableEq κ] [Nonempty κ] + (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (e : J → κ → ℕ) (a b : ℕ) + (hc : ∀ j ∈ s, 0 ≤ c j) : + twoGroupCompositionExpansionMean s c d e a b ≤ + twoGroupGeometricExpansionValue s c d e + ((a : ℝ) / Fintype.card ι) ((b : ℝ) / Fintype.card κ) := by + rw [twoGroupCompositionExpansionMean_eq] + apply weighted_two_group_factorialMoment_sum_le s _ _ _ + Fintype.card_pos Fintype.card_pos + intro j hj + exact mul_nonneg (mul_nonneg (hc j hj) (by positivity)) (by positivity) + +/-- Actual uniform lower occupation comparison for nonnegative two-group expansions. -/ +theorem exp_mul_geometric_le_twoGroupCompositionExpansionMean {ι κ J : Type*} + [Fintype ι] [DecidableEq ι] [Nonempty ι] + [Fintype κ] [DecidableEq κ] [Nonempty κ] + (s : Finset J) (c : J → ℝ) (d : J → ι → ℕ) (e : J → κ → ℕ) + {a b H J₀ : ℕ} (ha : 0 < a) (hb : 0 < b) (hH : 2 * H ≤ a) (hJ : 2 * J₀ ≤ b) + (hc : ∀ j ∈ s, 0 ≤ c j) (hd : ∀ j ∈ s, ∑ i, d j i ≤ H) + (he : ∀ j ∈ s, ∑ i, e j i ≤ J₀) : + Real.exp ((-(H : ℝ) ^ 2 / a - (H : ℝ) ^ 2 / (2 * Fintype.card ι)) + + (-(J₀ : ℝ) ^ 2 / b - (J₀ : ℝ) ^ 2 / (2 * Fintype.card κ))) * + twoGroupGeometricExpansionValue s c d e + ((a : ℝ) / Fintype.card ι) ((b : ℝ) / Fintype.card κ) ≤ + twoGroupCompositionExpansionMean s c d e a b := by + rw [twoGroupCompositionExpansionMean_eq] + apply exp_mul_weighted_two_group_mean_sum_le s _ _ _ + ha Fintype.card_pos hb Fintype.card_pos hH hJ _ hd he + intro j hj + exact mul_nonneg (mul_nonneg (hc j hj) (by positivity)) (by positivity) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OccupationParameterBounds.lean b/lean/OAI/Algebra/DepthFive/OccupationParameterBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d083c7a67fa635387f547de918aa714c7ad668d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OccupationParameterBounds.lean @@ -0,0 +1,140 @@ +import OAI.Algebra.DepthFive.AlphaParameters + +namespace OAI + +noncomputable section +namespace Problem335.LowerParameters + +theorem b_scale_lower {n : ℕ} (hn : 16 ≤ n) : + (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) / 4 ≤ (b n : ℝ) := by + apply (a_scale_lower hn).trans + exact_mod_cast a_le_b (by omega : 4 ≤ n) + +/-- The eventual beta bound supplies the matching upper growth estimate for `b`. -/ +theorem b_scale_upper_of_beta_bound {n : ℕ} (hn : 16 ≤ n) + (hbeta : beta n ≤ 2 / Real.sqrt (n : ℝ)) : + (b n : ℝ) ≤ 4 * (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) := by + have hs := sqrt_ge_four hn + have hspos : 0 < Real.sqrt (n : ℝ) := by linarith + have hb : (0 : ℝ) < b n := by exact_mod_cast b_pos (by omega : 4 ≤ n) + have hu : (0 : ℝ) < u n := by exact_mod_cast u_pos (by omega : 4 ≤ n) + have huupper : (u n : ℝ) ≤ (n : ℝ) ^ 3 := by exact_mod_cast u_le_cube n + have hmul : (b n : ℝ) * Real.sqrt (n : ℝ) ≤ 2 * ((b n : ℝ) + (u n : ℝ)) := + (div_le_div_iff₀ (add_pos hb hu) hspos).mp hbeta + have hhalf : (b n : ℝ) * Real.sqrt (n : ℝ) ≤ 4 * (u n : ℝ) := by + nlinarith [mul_nonneg hb.le (show 0 ≤ Real.sqrt (n : ℝ) - 4 by linarith)] + have heq : (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) * Real.sqrt (n : ℝ) = (n : ℝ) ^ 3 := by + calc + _ = (n : ℝ) ^ 2 * (Real.sqrt (n : ℝ)) ^ 2 := by ring + _ = (n : ℝ) ^ 3 := by rw [Real.sq_sqrt (by positivity)]; ring + have hfinal : (b n : ℝ) * Real.sqrt (n : ℝ) ≤ + (4 * (n : ℝ) ^ 2 * Real.sqrt (n : ℝ)) * Real.sqrt (n : ℝ) := by nlinarith + exact le_of_mul_le_mul_right hfinal hspos + +theorem sq_div_b_le {n : ℕ} (hn : 16 ≤ n) : + (n : ℝ) ^ 2 / (b n : ℝ) ≤ 4 / Real.sqrt (n : ℝ) := by + have ha : (0 : ℝ) < a n := by exact_mod_cast a_pos (by omega : 4 ≤ n) + have hab : (a n : ℝ) ≤ b n := by exact_mod_cast a_le_b (by omega : 4 ≤ n) + exact (div_le_div_of_nonneg_left (sq_nonneg _) ha hab).trans (sq_div_a_le hn) + +theorem sq_div_u_le {n : ℕ} (hn : 16 ≤ n) : + (n : ℝ) ^ 2 / (u n : ℝ) ≤ 2 / (n : ℝ) := by + have hu : (0 : ℝ) < u n := by exact_mod_cast u_pos (by omega : 4 ≤ n) + have hnR : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) + apply (div_le_div_iff₀ hu hnR).mpr + have h : (n : ℝ) ^ 3 ≤ 2 * (u n : ℝ) := by exact_mod_cast cube_le_two_mul_u n + nlinarith + +/-- A concrete bound for the combined occupation-comparison error in both groups. -/ +theorem occupation_parameter_loss_le {n : ℕ} (hn : 16 ≤ n) : + (n : ℝ) ^ 2 / (a n : ℝ) + (n : ℝ) ^ 2 / (v n : ℝ) + + (n : ℝ) ^ 2 / (b n : ℝ) + (n : ℝ) ^ 2 / (u n : ℝ) ≤ + 16 / Real.sqrt (n : ℝ) := by + have hs := sqrt_ge_four hn + have hspos : 0 < Real.sqrt (n : ℝ) := by linarith + have hnR : (16 : ℝ) ≤ n := by exact_mod_cast hn + have hnpos : (0 : ℝ) < n := by linarith + have hroot : Real.sqrt (n : ℝ) ≤ (n : ℝ) := by + apply Real.sqrt_le_iff.mpr + constructor + · positivity + · nlinarith + have hvbound : 8 / (3 * (n : ℝ)) ≤ 3 / Real.sqrt (n : ℝ) := by + apply (div_le_div_iff₀ (by positivity) hspos).mpr + linarith + have hubound : 2 / (n : ℝ) ≤ 2 / Real.sqrt (n : ℝ) := + div_le_div_of_nonneg_left (by norm_num) hspos hroot + have ha := sq_div_a_le hn + have hv := (sq_div_v_le hn).trans hvbound + have hb := sq_div_b_le hn + have hu := (sq_div_u_le hn).trans hubound + have hpos : 0 < 1 / Real.sqrt (n : ℝ) := one_div_pos.mpr hspos + simp only [div_eq_mul_inv] at ha hv hb hu hpos ⊢ + linarith + +/-- Both finite occupation laws have uniformly small logarithmic comparison loss. -/ +theorem occupation_order_loss_le {n : ℕ} (hn : 16 ≤ n) {H : ℝ} + (hH : 0 ≤ H) (hHn : H ≤ 2 * (n : ℝ)) : + H ^ 2 / (a n : ℝ) + H ^ 2 / (2 * (v n : ℝ)) + + H ^ 2 / (b n : ℝ) + H ^ 2 / (2 * (u n : ℝ)) ≤ + 64 / Real.sqrt (n : ℝ) := by + have hsq : H ^ 2 ≤ 4 * (n : ℝ) ^ 2 := by nlinarith + have ha : (0 : ℝ) < a n := by exact_mod_cast a_pos (by omega : 4 ≤ n) + have hv : (0 : ℝ) < v n := by exact_mod_cast v_pos (by omega : 4 ≤ n) + have hb : (0 : ℝ) < b n := by exact_mod_cast b_pos (by omega : 4 ≤ n) + have hu : (0 : ℝ) < u n := by exact_mod_cast u_pos (by omega : 4 ≤ n) + have h1 := div_le_div_of_nonneg_right hsq ha.le + have h2 := div_le_div_of_nonneg_right hsq hv.le + have h3 := div_le_div_of_nonneg_right hsq hb.le + have h4 := div_le_div_of_nonneg_right hsq hu.le + have h2' : H ^ 2 / (2 * (v n : ℝ)) ≤ H ^ 2 / (v n : ℝ) := + div_le_div_of_nonneg_left (sq_nonneg _) hv (by linarith) + have h4' : H ^ 2 / (2 * (u n : ℝ)) ≤ H ^ 2 / (u n : ℝ) := + div_le_div_of_nonneg_left (sq_nonneg _) hu (by linarith) + have hloss := occupation_parameter_loss_le hn + simp only [mul_div_assoc] at h1 h2 h3 h4 + simp only [div_eq_mul_inv] at h1 h2 h3 h4 h2' h4' hloss ⊢ + linarith + +/-- Separate derivative and multiplication expansion orders obey the same loss bound. -/ +theorem occupation_two_orders_loss_le {n : ℕ} (hn : 16 ≤ n) {H₁ H₂ : ℝ} + (hH₁ : 0 ≤ H₁) (hH₁n : H₁ ≤ 2 * (n : ℝ)) + (hH₂ : 0 ≤ H₂) (hH₂n : H₂ ≤ 2 * (n : ℝ)) : + H₁ ^ 2 / (a n : ℝ) + H₁ ^ 2 / (2 * (v n : ℝ)) + + H₂ ^ 2 / (b n : ℝ) + H₂ ^ 2 / (2 * (u n : ℝ)) ≤ + 64 / Real.sqrt (n : ℝ) := by + calc + _ ≤ (2 * (n : ℝ)) ^ 2 / (a n : ℝ) + + (2 * (n : ℝ)) ^ 2 / (2 * (v n : ℝ)) + + (2 * (n : ℝ)) ^ 2 / (b n : ℝ) + + (2 * (n : ℝ)) ^ 2 / (2 * (u n : ℝ)) := by + gcongr + _ ≤ _ := occupation_order_loss_le hn (by positivity) le_rfl + +/-- The multiplication order has matching growth once the eventual beta estimate is known. -/ +theorem b_isTheta_of_eventually_beta_bound + (hbeta : ∀ᶠ n : ℕ in Filter.atTop, beta n ≤ 2 / Real.sqrt (n : ℝ)) : + Asymptotics.IsTheta Filter.atTop (fun n : ℕ => (b n : ℝ)) + (fun n : ℕ => (n : ℝ) ^ 2 * Real.sqrt (n : ℝ)) := by + constructor + · apply Asymptotics.isBigO_iff.mpr + refine ⟨4, ?_⟩ + filter_upwards [Filter.eventually_ge_atTop 16, hbeta] with n hn hbeta_n + have hnonneg : 0 ≤ (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) := by positivity + simpa only [Real.norm_eq_abs, + abs_of_nonneg (show (0 : ℝ) ≤ (b n : ℝ) by positivity), + abs_of_nonneg hnonneg, mul_assoc] using b_scale_upper_of_beta_bound hn hbeta_n + · apply Asymptotics.isBigO_iff.mpr + refine ⟨4, ?_⟩ + filter_upwards [Filter.eventually_ge_atTop 16] with n hn + have hnonneg : 0 ≤ (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) := by positivity + simp only [Real.norm_eq_abs, + abs_of_nonneg (show (0 : ℝ) ≤ (b n : ℝ) by positivity), abs_of_nonneg hnonneg] + have h := b_scale_lower hn + linarith + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OccupationRatio.lean b/lean/OAI/Algebra/DepthFive/OccupationRatio.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d5439a6471cfde47635b8130c2ddd7cf2be9297 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OccupationRatio.lean @@ -0,0 +1,113 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- The elementary logarithmic lower bound used for factorial moment ratios. -/ +theorem log_one_sub_ge_neg_two_mul {x : ℝ} (hx : 0 ≤ x) (hxhalf : x ≤ 1 / 2) : + -2 * x ≤ Real.log (1 - x) := by + have hpos : 0 < 1 - x := by linarith + have hinv : (1 - x)⁻¹ ≤ 1 + 2 * x := by + rw [inv_eq_one_div, div_le_iff₀ hpos] + nlinarith [mul_nonneg hx (show 0 ≤ 1 - 2 * x by linarith)] + have hlog := Real.one_sub_inv_le_log_of_pos hpos + linarith + +/-- A single factor of the occupation ratio has an exponential lower bound. -/ +theorem exp_le_occupation_factor {x y : ℝ} + (hx : 0 ≤ x) (hxhalf : x ≤ 1 / 2) (hy : 0 ≤ y) : + Real.exp (-2 * x - y) ≤ (1 - x) / (1 + y) := by + have hxpos : 0 < 1 - x := by linarith + have hypos : 0 < 1 + y := by linarith + have hlower := log_one_sub_ge_neg_two_mul hx hxhalf + have hupper := Real.log_le_sub_one_of_pos hypos + have hlog : -2 * x - y ≤ Real.log ((1 - x) / (1 + y)) := by + rw [Real.log_div (ne_of_gt hxpos) (ne_of_gt hypos)] + linarith + exact (Real.le_log_iff_exp_le (div_pos hxpos hypos)).mp hlog + +/-- The finite product appearing when a composition factorial moment is normalized +by the independent geometric factorial moment. -/ +def occupationRatio (t r : ℝ) (H : ℕ) : ℝ := + ∏ j ∈ Finset.range H, (1 - (j : ℝ) / t) / (1 + (j : ℝ) / r) + +private theorem sum_range_cast_le_half_sq (H : ℕ) : + (∑ j ∈ Finset.range H, (j : ℝ)) ≤ (H : ℝ) ^ 2 / 2 := by + induction H with + | zero => simp + | succ H ih => + rw [Finset.sum_range_succ] + push_cast + nlinarith + +/-- Uniform upper bound for the occupation ratio. -/ +theorem occupationRatio_le_one {t r : ℝ} {H : ℕ} + (ht : 0 < t) (hr : 0 < r) (hH : (H : ℝ) ≤ t) : + occupationRatio t r H ≤ 1 := by + apply Finset.prod_le_one₀ + · intro j hj + have hjH : (j : ℝ) ≤ H := by exact_mod_cast (Finset.mem_range.mp hj).le + have hjt : (j : ℝ) / t ≤ 1 := (div_le_one ht).2 (hjH.trans hH) + apply div_nonneg (by linarith) + positivity + · intro j hj + have htj : 0 ≤ (j : ℝ) / t := by positivity + have hrj : 0 ≤ (j : ℝ) / r := by positivity + apply (div_le_one (by positivity : 0 < 1 + (j : ℝ) / r)).2 + linarith + +/-- The exponential lower bound for the occupation ratio from the manuscript. -/ +theorem exp_le_occupationRatio {t r : ℝ} {H : ℕ} + (ht : 0 < t) (hr : 0 < r) (hH : (H : ℝ) ≤ t / 2) : + Real.exp (-(H : ℝ) ^ 2 / t - (H : ℝ) ^ 2 / (2 * r)) ≤ + occupationRatio t r H := by + have hfactor : ∀ j ∈ Finset.range H, + Real.exp (-2 * ((j : ℝ) / t) - (j : ℝ) / r) ≤ + (1 - (j : ℝ) / t) / (1 + (j : ℝ) / r) := by + intro j hj + apply exp_le_occupation_factor (by positivity) _ (by positivity) + apply (div_le_iff₀ ht).2 + have hjH : (j : ℝ) ≤ H := by exact_mod_cast (Finset.mem_range.mp hj).le + linarith + have hprod := Finset.prod_le_prod₀ + (fun j (_ : j ∈ Finset.range H) => + (Real.exp_pos (-2 * ((j : ℝ) / t) - (j : ℝ) / r)).le) hfactor + rw [← Real.exp_sum] at hprod + apply le_trans _ hprod + apply Real.exp_le_exp.mpr + rw [Finset.sum_sub_distrib, ← Finset.mul_sum, ← Finset.sum_div, ← Finset.sum_div] + have hsum := sum_range_cast_le_half_sq H + have hdivt := div_le_div_of_nonneg_right hsum ht.le + have hdivr := div_le_div_of_nonneg_right hsum hr.le + ring_nf at hdivt hdivr ⊢ + linarith + +/-- A common loss bound applies uniformly to all factorial orders at most `H₀`. -/ +theorem exp_le_occupationRatio_of_le {t r : ℝ} {H H₀ : ℕ} + (ht : 0 < t) (hr : 0 < r) (hHH : H ≤ H₀) (hH₀ : (H₀ : ℝ) ≤ t / 2) : + Real.exp (-(H₀ : ℝ) ^ 2 / t - (H₀ : ℝ) ^ 2 / (2 * r)) ≤ + occupationRatio t r H := by + have hcast : (H : ℝ) ≤ H₀ := by exact_mod_cast hHH + have hsq : (H : ℝ) ^ 2 ≤ (H₀ : ℝ) ^ 2 := by nlinarith [Nat.cast_nonneg (α := ℝ) H] + apply le_trans _ (exp_le_occupationRatio ht hr (hcast.trans hH₀)) + apply Real.exp_le_exp.mpr + have h₁ := div_le_div_of_nonneg_right hsq ht.le + have h₂ := div_le_div_of_nonneg_right hsq (show 0 ≤ 2 * r by positivity) + ring_nf at h₁ h₂ ⊢ + linarith + +/-- In the lower-bound range the ratio is strictly positive. -/ +theorem occupationRatio_pos {t r : ℝ} {H : ℕ} + (ht : 0 < t) (hr : 0 < r) (hH : (H : ℝ) ≤ t / 2) : + 0 < occupationRatio t r H := + (Real.exp_pos _).trans_le (exp_le_occupationRatio ht hr hH) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OccupationRatioAlgebra.lean b/lean/OAI/Algebra/DepthFive/OccupationRatioAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb4712382860b6574596b8b6dc5f698abc7ed981 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OccupationRatioAlgebra.lean @@ -0,0 +1,99 @@ +import OAI.Algebra.DepthFive.OccupationRatio + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- Algebraic removal of the geometric normalization from the occupation ratio. -/ +theorem occupationRatio_mul_mean_pow {t r : ℝ} (ht : 0 < t) (hr : 0 < r) (H : ℕ) : + occupationRatio t r H * (t / r) ^ H = + (∏ j ∈ Finset.range H, (t - (j : ℝ))) / + (∏ j ∈ Finset.range H, (r + (j : ℝ))) := by + have hconst : (t / r) ^ H = ∏ _j ∈ Finset.range H, t / r := by simp [div_pow] + rw [occupationRatio, hconst, ← Finset.prod_mul_distrib, ← Finset.prod_div_distrib] + apply Finset.prod_congr rfl + intro j hj + have hsum : r + (j : ℝ) ≠ 0 := ne_of_gt (by positivity) + have hden : 1 + (j : ℝ) / r ≠ 0 := ne_of_gt (by positivity) + field_simp + +/-- The exact factorial-moment ratio over weak compositions. -/ +theorem descFactorial_div_ascFactorial_eq_ratio {t r H : ℕ} + (ht : 0 < t) (hr : 0 < r) (hH : H ≤ t) : + (t.descFactorial H : ℝ) / (r.ascFactorial H : ℝ) = + occupationRatio t r H * ((t : ℝ) / r) ^ H := by + rw [occupationRatio_mul_mean_pow (by exact_mod_cast ht) (by exact_mod_cast hr)] + congr 1 + · rw [Nat.descFactorial_eq_prod_range, Nat.cast_prod] + apply Finset.prod_congr rfl + intro j hj + exact Nat.cast_sub (le_trans (Finset.mem_range.mp hj).le hH) + · rw [Nat.ascFactorial_eq_prod_range, Nat.cast_prod] + apply Finset.prod_congr rfl + intro j hj + exact Nat.cast_add r j + +/-- Every factorial order admits the independent geometric upper comparison. -/ +theorem descFactorial_div_ascFactorial_le_mean_pow {t r H : ℕ} + (ht : 0 < t) (hr : 0 < r) : + (t.descFactorial H : ℝ) / (r.ascFactorial H : ℝ) ≤ ((t : ℝ) / r) ^ H := by + by_cases hH : H ≤ t + · rw [descFactorial_div_ascFactorial_eq_ratio ht hr hH] + have hratio := occupationRatio_le_one (t := (t : ℝ)) (r := (r : ℝ)) (H := H) (by exact_mod_cast ht) + (by exact_mod_cast hr) (by exact_mod_cast hH) + calc + occupationRatio t r H * ((t : ℝ) / r) ^ H ≤ 1 * ((t : ℝ) / r) ^ H := + mul_le_mul_of_nonneg_right hratio (by positivity) + _ = _ := one_mul _ + · rw [Nat.descFactorial_eq_zero_iff_lt.mpr (Nat.lt_of_not_ge hH)] + simp only [Nat.cast_zero, zero_div] + positivity + +/-- The lower comparison is uniform over all factorial orders up to half the total. -/ +theorem exp_mul_mean_pow_le_descFactorial_div_ascFactorial {t r H : ℕ} + (ht : 0 < t) (hr : 0 < r) (hH : 2 * H ≤ t) : + Real.exp (-(H : ℝ) ^ 2 / t - (H : ℝ) ^ 2 / (2 * r)) * + ((t : ℝ) / r) ^ H ≤ (t.descFactorial H : ℝ) / (r.ascFactorial H : ℝ) := by + have hHt : H ≤ t := by omega + rw [descFactorial_div_ascFactorial_eq_ratio ht hr hHt] + apply mul_le_mul_of_nonneg_right _ (by positivity) + apply exp_le_occupationRatio (by exact_mod_cast ht) (by exact_mod_cast hr) + have hcast : 2 * (H : ℝ) ≤ t := by exact_mod_cast hH + linarith + +/-- A common loss bound can be used for all orders bounded by `H₀`. -/ +theorem exp_mul_mean_pow_le_descFactorial_div_ascFactorial_of_le {t r H H₀ : ℕ} + (ht : 0 < t) (hr : 0 < r) (hH : H ≤ H₀) (hH₀ : 2 * H₀ ≤ t) : + Real.exp (-(H₀ : ℝ) ^ 2 / t - (H₀ : ℝ) ^ 2 / (2 * r)) * + ((t : ℝ) / r) ^ H ≤ (t.descFactorial H : ℝ) / (r.ascFactorial H : ℝ) := by + apply le_trans _ (exp_mul_mean_pow_le_descFactorial_div_ascFactorial ht hr + (show 2 * H ≤ t by omega)) + apply mul_le_mul_of_nonneg_right _ (by positivity) + apply Real.exp_le_exp.mpr + have hsq : (H : ℝ) ^ 2 ≤ (H₀ : ℝ) ^ 2 := by + have hh : (H : ℝ) ≤ H₀ := by exact_mod_cast hH + nlinarith [show 0 ≤ (H : ℝ) by positivity] + have h₁ := div_le_div_of_nonneg_right hsq (show 0 ≤ (t : ℝ) by positivity) + have h₂ := div_le_div_of_nonneg_right hsq (show 0 ≤ 2 * (r : ℝ) by positivity) + simp only [neg_div] + linarith + +/-- Zero total occupation is also allowed in the geometric upper comparison. -/ +theorem descFactorial_div_ascFactorial_le_mean_pow_of_pos {t r H : ℕ} (hr : 0 < r) : + (t.descFactorial H : ℝ) / (r.ascFactorial H : ℝ) ≤ ((t : ℝ) / r) ^ H := by + by_cases ht : 0 < t + · exact descFactorial_div_ascFactorial_le_mean_pow ht hr + · have ht0 : t = 0 := by omega + subst t + cases H with + | zero => simp + | succ H => simp [Nat.descFactorial_succ] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OccupationSum.lean b/lean/OAI/Algebra/DepthFive/OccupationSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cb3e12b37f5a542081b0df5cf26bab28069b030 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OccupationSum.lean @@ -0,0 +1,123 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +private def fallingFactorialSeries (d : ℕ) : PowerSeries ℝ := + PowerSeries.mk fun j => (j.descFactorial d : ℝ) + +private lemma fallingFactorialSeries_eq (d : ℕ) : + fallingFactorialSeries d = PowerSeries.C (d.factorial : ℝ) * + (PowerSeries.X ^ d * (PowerSeries.mk 1 : PowerSeries ℝ) ^ (d + 1)) := by + ext j + rw [fallingFactorialSeries, PowerSeries.coeff_mk, PowerSeries.coeff_C_mul, + PowerSeries.coeff_X_pow_mul', PowerSeries.mk_one_pow_eq_mk_choose_add] + by_cases h : d ≤ j + · rw [ite_eq_left h, PowerSeries.coeff_mk, Nat.add_sub_of_le h, + Nat.descFactorial_eq_factorial_mul_choose, Nat.cast_mul] + · rw [ite_eq_right h, mul_zero, Nat.descFactorial_eq_zero_iff_lt.mpr (by omega)] + simp + +private lemma fallingFactorialSeries_prod {ι : Type*} [Fintype ι] (d : ι → ℕ) : + (∏ i, fallingFactorialSeries (d i)) = + PowerSeries.C (∏ i, (d i).factorial : ℝ) * + (PowerSeries.X ^ (∑ i, d i) * + (PowerSeries.mk 1 : PowerSeries ℝ) ^ ((∑ i, d i) + Fintype.card ι)) := by + simp only [fallingFactorialSeries_eq, Finset.prod_mul_distrib, + ← map_prod, Finset.prod_pow_eq_pow_sum, Finset.sum_add_distrib, + Finset.sum_const, Finset.card_univ, smul_eq_mul, mul_one] + +/-- Exact weighted weak-composition sum, with the impossible-degree case +explicitly zero. This is the coefficient-extraction form of the occupation +factorial moment identity. -/ +theorem occupation_factorial_sum {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + (d : ι → ℕ) (t : ℕ) : + (∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset ι) t, + ∏ i, ((M i).descFactorial (d i) : ℝ)) = + (∏ i, (d i).factorial : ℝ) * + if (∑ i, d i) ≤ t then + ((t + Fintype.card ι - 1).choose (t - ∑ i, d i) : ℝ) else 0 := by + classical + have hr : 0 < Fintype.card ι := Fintype.card_pos + let H := ∑ i, d i + have heq : H + Fintype.card ι = (H + Fintype.card ι - 1) + 1 := by omega + have hcoeff := PowerSeries.coeff_prod (fun i => fallingFactorialSeries (d i)) t Finset.univ + simp only [fallingFactorialSeries, PowerSeries.coeff_mk] at hcoeff + rw [← hcoeff] + change PowerSeries.coeff t (∏ i, fallingFactorialSeries (d i)) = _ + rw [fallingFactorialSeries_prod] + change PowerSeries.coeff t (PowerSeries.C (∏ i, (d i).factorial : ℝ) * + (PowerSeries.X ^ H * (PowerSeries.mk 1 : PowerSeries ℝ) ^ + (H + Fintype.card ι))) = _ + rw [heq, PowerSeries.mk_one_pow_eq_mk_choose_add, PowerSeries.coeff_C_mul, + PowerSeries.coeff_X_pow_mul'] + by_cases hH : H ≤ t + · rw [ite_eq_left hH, PowerSeries.coeff_mk, ite_eq_left hH] + have harr : H + Fintype.card ι - 1 + (t - H) = t + Fintype.card ι - 1 := by + omega + rw [harr] + congr 2 + apply Nat.choose_symm_of_eq_add + dsimp [H] at * + omega + · rw [ite_eq_right hH, ite_eq_right hH] + +/-- Stars-and-bars count for the same finite weak-composition index set. -/ +theorem occupation_composition_card {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] (t : ℕ) : + (Finset.finsuppAntidiag (Finset.univ : Finset ι) t).card = + (t + Fintype.card ι - 1).choose t := by + classical + have h := occupation_factorial_sum (ι := ι) (fun _ => 0) t + simp at h + exact_mod_cast h + +lemma occupation_choose_ratio (t r H : ℕ) (hr : 0 < r) (hH : H ≤ t) : + ((t + r - 1).choose (t - H) : ℝ) / ((t + r - 1).choose t : ℝ) = + (t.descFactorial H : ℝ) / (r.ascFactorial H : ℝ) := by + have hfac (n : ℕ) : (n.factorial : ℝ) ≠ 0 := by positivity + have hdesc : (t.descFactorial H : ℝ) = + (t.factorial : ℝ) / ((t - H).factorial : ℝ) := by + apply (eq_div_iff (hfac _)).2 + exact_mod_cast (by simpa only [Nat.mul_comm] using + Nat.factorial_mul_descFactorial hH) + have hasc : (r.ascFactorial H : ℝ) = + ((r + H - 1).factorial : ℝ) / ((r - 1).factorial : ℝ) := by + apply (eq_div_iff (hfac _)).2 + exact_mod_cast (by simpa only [Nat.mul_comm] using + Nat.factorial_mul_ascFactorial' r H hr) + rw [Nat.cast_choose ℝ (by omega : t - H ≤ t + r - 1), + Nat.cast_choose ℝ (by omega : t ≤ t + r - 1), hdesc, hasc] + rw [show t + r - 1 - (t - H) = r + H - 1 by omega, + show t + r - 1 - t = r - 1 by omega] + field_simp + +/-- The normalized factorial moment of the uniform distribution on weak +compositions. The result includes total orders above `t`, where both sides +vanish. -/ +theorem occupation_factorial_moment {ι : Type*} [Fintype ι] [DecidableEq ι] + [Nonempty ι] (d : ι → ℕ) (t : ℕ) : + (∑ M ∈ Finset.finsuppAntidiag (Finset.univ : Finset ι) t, + ∏ i, ((M i).descFactorial (d i) : ℝ)) / + (Finset.finsuppAntidiag (Finset.univ : Finset ι) t).card = + (t.descFactorial (∑ i, d i) : ℝ) / + ((Fintype.card ι).ascFactorial (∑ i, d i) : ℝ) * + (∏ i, (d i).factorial : ℝ) := by + rw [occupation_factorial_sum, occupation_composition_card] + by_cases hH : (∑ i, d i) ≤ t + · rw [ite_eq_left hH] + rw [mul_div_assoc, occupation_choose_ratio t (Fintype.card ι) _ + Fintype.card_pos hH] + ring + · rw [ite_eq_right hH, mul_zero, zero_div, + Nat.descFactorial_eq_zero_iff_lt.mpr (by omega), Nat.cast_zero, + zero_div, zero_mul] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OddDegreeThreshold.lean b/lean/OAI/Algebra/DepthFive/OddDegreeThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcf00b8cf2fe66e01caff25f8b44e4cff69c11b0 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OddDegreeThreshold.lean @@ -0,0 +1,49 @@ +import Mathlib + +namespace OAI + +/-! Uniform eventual smallness used to absorb the constant loss in the odd +low-degree estimate. The threshold is independent of the factor degree and +of the particular parameter `q` below its stated envelope. -/ + +open Filter + +namespace Problem335 + +/-- A polynomially decaying envelope absorbs every fixed positive power +and fixed nonnegative multiplicative constant, uniformly below the envelope. -/ +theorem eventually_small_power_of_envelope (a b C : ℝ) + (ha : 0 < a) (hb : 0 < b) (hC : 0 ≤ C) : + ∃ N : ℕ, ∀ n : ℕ, N ≤ n → ∀ q : ℝ, 0 ≤ q → + q ≤ (n : ℝ) ^ (-a) → C * q ^ b ≤ 1 := by + have hlim : Tendsto (fun n : ℕ => C * (n : ℝ) ^ (-(a * b))) + atTop (nhds 0) := by + simpa using tendsto_const_nhds.mul + ((tendsto_rpow_neg_atTop (mul_pos ha hb)).comp + tendsto_natCast_atTop_atTop) + have hevent : ∀ᶠ n : ℕ in atTop, + C * (n : ℝ) ^ (-(a * b)) < 1 := + hlim.eventually (gt_mem_nhds (by norm_num : (0 : ℝ) < 1)) + obtain ⟨N, hN⟩ := Filter.eventually_atTop.1 hevent + refine ⟨N, ?_⟩ + intro n hn q hq henv + calc + C * q ^ b ≤ C * ((n : ℝ) ^ (-a)) ^ b := + mul_le_mul_of_nonneg_left (Real.rpow_le_rpow hq henv hb.le) hC + _ = C * (n : ℝ) ^ (-(a * b)) := by + rw [← Real.rpow_mul (Nat.cast_nonneg n)] + congr 2 + ring + _ ≤ 1 := (hN n hn).le + +/-- The exact eventual smallness hypothesis used for all low odd degrees. -/ +theorem eventually_odd_degree_smallness : + ∃ N : ℕ, ∀ n : ℕ, N ≤ n → ∀ q : ℝ, 0 ≤ q → + q ≤ (n : ℝ) ^ (-(2 / 5 : ℝ)) → + 5 * q ^ (3 / 16 : ℝ) ≤ 1 := by + exact eventually_small_power_of_envelope (2 / 5) (3 / 16) 5 + (by norm_num) (by norm_num) (by norm_num) + +end Problem335 + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OperatorExponentBidegree.lean b/lean/OAI/Algebra/DepthFive/OperatorExponentBidegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9ca04de958814349556830c43d7aedfe6f32c68 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OperatorExponentBidegree.lean @@ -0,0 +1,82 @@ +import OAI.Algebra.DepthFive.OperatorMonomials +import OAI.Algebra.DepthFive.OperatorRank + +namespace OAI + +/-! Degree and validity of the natural exponent produced by a mixed monomial operator. -/ + +noncomputable section + +namespace Problem335 + +variable {σ : Type*} + +/-- Filtering to derivative variables retains precisely the first bidegree. -/ +theorem bidegreeWeight_derivExponent (isV : σ → Bool) (d : σ →₀ ℕ) : + Finsupp.weight (bidegreeWeight isV) (derivExponent isV d) = + ((Finsupp.weight (bidegreeWeight isV) d).1, 0) := by + classical + induction d using Finsupp.induction_linear with + | zero => simp [derivExponent, Finsupp.filter_zero]; rfl + | add d e hd he => + simp only [derivExponent, Finsupp.filter_add, map_add] at * + rw [hd, he] + rfl + | single i r => + cases hi : isV i with + | false => + simp [derivExponent, Finsupp.weight_single, bidegreeWeight, hi] + rfl + | true => simp [derivExponent, Finsupp.weight_single, bidegreeWeight, hi] + +/-- Filtering to multiplication variables retains precisely the second bidegree. -/ +theorem bidegreeWeight_mulExponent (isV : σ → Bool) (d : σ →₀ ℕ) : + Finsupp.weight (bidegreeWeight isV) (mulExponent isV d) = + (0, (Finsupp.weight (bidegreeWeight isV) d).2) := by + classical + induction d using Finsupp.induction_linear with + | zero => simp [mulExponent, Finsupp.filter_zero]; rfl + | add d e hd he => + simp only [mulExponent, Finsupp.filter_add, map_add] at * + rw [hd, he] + rfl + | single i r => + cases hi : isV i with + | false => simp [mulExponent, Finsupp.weight_single, bidegreeWeight, hi] + | true => + simp [mulExponent, Finsupp.weight_single, bidegreeWeight, hi] + rfl + +/-- Availability of every derivative implies availability of the total derivative degree. -/ +theorem bidegree_le_of_derivExponent_le (isV : σ → Bool) (d e : σ →₀ ℕ) + {k m a b : ℕ} (hd : Finsupp.weight (bidegreeWeight isV) d = (k,m)) + (he : Finsupp.weight (bidegreeWeight isV) e = (a,b)) + (hle : derivExponent isV d ≤ e) : k ≤ a := by + have hsplit := congrArg (Finsupp.weight (bidegreeWeight isV)) + (tsub_add_cancel_of_le hle) + rw [map_add, bidegreeWeight_derivExponent, hd, he] at hsplit + have hfst := congrArg Prod.fst hsplit + dsimp at hfst + omega + +/-- A valid monomial action has a natural output exponent in exactly the required +finite bidegree fiber, without any coefficient-field assumptions. -/ +theorem bidegreeWeight_operator_target (isV : σ → Bool) (d e : σ →₀ ℕ) + {k m a b : ℕ} (hd : Finsupp.weight (bidegreeWeight isV) d = (k,m)) + (he : Finsupp.weight (bidegreeWeight isV) e = (a,b)) + (hle : derivExponent isV d ≤ e) : + Finsupp.weight (bidegreeWeight isV) + (e - derivExponent isV d + mulExponent isV d) = (a-k,b+m) := by + have hsplit := congrArg (Finsupp.weight (bidegreeWeight isV)) + (tsub_add_cancel_of_le hle) + rw [map_add, bidegreeWeight_derivExponent, hd, he] at hsplit + have hf := congrArg Prod.fst hsplit + have hs := congrArg Prod.snd hsplit + rw [map_add, bidegreeWeight_mulExponent, hd] + apply Prod.ext <;> dsimp at * <;> omega + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OperatorHomogeneity.lean b/lean/OAI/Algebra/DepthFive/OperatorHomogeneity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2677c4db2388e463f8a96ea718d3ef968102cea --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OperatorHomogeneity.lean @@ -0,0 +1,97 @@ +import OAI.Algebra.DepthFive.MixedOperator + +namespace OAI + +/-! Weighted-degree preservation for differential/multiplication substitution. -/ + +noncomputable section + +namespace Problem335 + +open MvPolynomial + +variable {K σ M : Type*} [CommSemiring K] [AddCommGroup M] + +/-- A partial derivative subtracts the weight of its variable. The use of a +weight group avoids artificial truncation at degree zero. -/ +theorem pderiv_isWeightedHomogeneous {w : σ → M} {p : MvPolynomial σ K} + {a : M} (hp : p.IsWeightedHomogeneous w a) (i : σ) : + (pderiv i p).IsWeightedHomogeneous w (a - w i) := by + intro d hd + have hc : p.coeff (d + Finsupp.single i 1) ≠ 0 := by + intro h + apply hd + rw [coeff_pderiv, h, zero_mul] + have hw := hp hc + rw [map_add, Finsupp.weight_single, one_nsmul] at hw + exact eq_sub_iff_add_eq.mpr hw + +/-- The weighted-degree shift assigned to an operator variable: differentiation +has negative weight, while multiplication has positive weight. -/ +def operatorWeight (isV : σ → Bool) (w : σ → M) (i : σ) : M := + if isV i then -w i else w i + +theorem variableOperator_isWeightedHomogeneous (isV : σ → Bool) {w : σ → M} + {p : MvPolynomial σ K} {a : M} (hp : p.IsWeightedHomogeneous w a) (i : σ) : + (variableOperator isV i p).IsWeightedHomogeneous w (a + operatorWeight isV w i) := by + cases hi : isV i + · simpa [variableOperator, operatorWeight, hi, add_comm] using + (isWeightedHomogeneous_X (R := K) w i).mul hp + · simpa [variableOperator, operatorWeight, hi, sub_eq_add_neg] using + pderiv_isWeightedHomogeneous hp i + +/-- A power of a variable shifts degree by the corresponding multiple. -/ +theorem mixedOperator_X_pow_isWeightedHomogeneous (isV : σ → Bool) (w : σ → M) + (i : σ) (r : ℕ) {p : MvPolynomial σ K} {a : M} + (hp : p.IsWeightedHomogeneous w a) : + (mixedOperator isV (X i ^ r) p).IsWeightedHomogeneous w + (a + r • operatorWeight isV w i) := by + induction r with + | zero => simpa using hp + | succ r ih => + rw [pow_succ', mixedOperator_mul_apply, mixedOperator_X] + simpa [succ_nsmul, add_assoc, add_comm, add_left_comm] using + variableOperator_isWeightedHomogeneous isV ih i + +/-- Monomial operators shift weighted degree by the sum of their variable shifts. -/ +theorem mixedOperator_monomial_one_isWeightedHomogeneous (isV : σ → Bool) (w : σ → M) + (d : σ →₀ ℕ) {p : MvPolynomial σ K} {a : M} + (hp : p.IsWeightedHomogeneous w a) : + (mixedOperator isV (monomial d 1) p).IsWeightedHomogeneous w + (a + Finsupp.weight (operatorWeight isV w) d) := by + induction d using Finsupp.induction_linear generalizing p a with + | zero => simpa using hp + | add d e hd he => + rw [show monomial (d + e) (1 : K) = monomial d 1 * monomial e 1 by + rw [monomial_mul_monomial, one_mul]] + rw [mixedOperator_mul_apply] + simpa [map_add, add_assoc, add_comm, add_left_comm] using hd (he hp) + | single i r => + rw [← X_pow_eq_monomial] + simpa [Finsupp.weight_single] using + mixedOperator_X_pow_isWeightedHomogeneous isV w i r hp + +/-- The full mixed operator sends homogeneous inputs to the degree obtained by +adding the (signed) homogeneous degree of its defining polynomial. -/ +theorem mixedOperator_isWeightedHomogeneous (isV : σ → Bool) (w : σ → M) + {q p : MvPolynomial σ K} {d a : M} + (hq : q.IsWeightedHomogeneous (operatorWeight isV w) d) + (hp : p.IsWeightedHomogeneous w a) : + (mixedOperator isV q p).IsWeightedHomogeneous w (a + d) := by + induction hq using IsWeightedHomogeneous.induction_on with + | zero => simp only [map_zero, LinearMap.zero_apply]; exact isWeightedHomogeneous_zero _ _ _ + | add q r hq hr iq ir => + simpa only [map_add, LinearMap.add_apply] using iq.add ir + | monomial e c he => + have hm := mixedOperator_monomial_one_isWeightedHomogeneous isV w e hp + rw [he] at hm + have heq : monomial e c = C c * monomial e (1 : K) := by rw [C_mul_monomial, mul_one] + rw [heq, mixedOperator_mul_apply, mixedOperator_C] + change (c • mixedOperator isV (monomial e 1) p).IsWeightedHomogeneous w (a + d) + simpa only [C_mul'] using hm.C_mul c + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OperatorMonomials.lean b/lean/OAI/Algebra/DepthFive/OperatorMonomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..c17184447643c16100f182f952e5f593c7fddd5e --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OperatorMonomials.lean @@ -0,0 +1,205 @@ +import OAI.Algebra.DepthFive.MixedOperator +import OAI.Algebra.DepthFive.IteratedDerivative + +namespace OAI + +noncomputable section + +namespace Problem335 + +open MvPolynomial +open scoped BigOperators + +variable {K σ : Type*} [CommSemiring K] + +/-- Exponents of the variables acting by differentiation. -/ +def derivExponent (isV : σ → Bool) (d : σ →₀ ℕ) : σ →₀ ℕ := + d.filter fun i => isV i = true + +/-- Exponents of the variables acting by multiplication. -/ +def mulExponent (isV : σ → Bool) (d : σ →₀ ℕ) : σ →₀ ℕ := + d.filter fun i => isV i = false + +/-- Integral coefficient supplied by a mixed derivative on a monomial. -/ +def operatorFactorial (isV : σ → Bool) (d e : σ →₀ ℕ) : ℕ := + d.prod fun i k => if isV i then (e i).descFactorial k else 1 + +theorem variableOperator_pow_true_monomial (isV : σ → Bool) (i : σ) + (hi : isV i = true) (k : ℕ) (e : σ →₀ ℕ) (b : K) : + (variableOperator isV i ^ k) (monomial e b) = + monomial (e - Finsupp.single i k) (b * (e i).descFactorial k) := by + simpa [variableOperator, hi, Module.End.coe_pow] using + iterate_pderiv_monomial i k e b + +theorem variableOperator_pow_false_monomial (isV : σ → Bool) (i : σ) + (hi : isV i = false) (k : ℕ) (e : σ →₀ ℕ) (b : K) : + (variableOperator isV i ^ k) (monomial e b) = + monomial (Finsupp.single i k + e) b := by + simp [variableOperator, hi, LinearMap.pow_mulLeft, X_pow_eq_monomial] + +theorem operatorFactorial_single_add (isV : σ → Bool) (i : σ) (k : ℕ) + (d e : σ →₀ ℕ) (hi : i ∉ d.support) : + operatorFactorial isV (Finsupp.single i k + d) e = + (if isV i then (e i).descFactorial k else 1) * operatorFactorial isV d e := by + classical + unfold operatorFactorial + rw [Finsupp.prod_add_index_of_disjoint] + · rw [Finsupp.prod_single_index] + cases isV i <;> simp + · exact Finset.disjoint_left.mpr fun j hj hd => hi <| by + have hji : j = i := Finset.mem_singleton.mp (Finsupp.support_single_subset hj) + simpa [hji] using hd + +/-- The complete mixed operator sends a monomial to a single monomial. -/ +theorem mixedOperator_monomial_one_apply (isV : σ → Bool) (d e : σ →₀ ℕ) (b : K) : + mixedOperator isV (monomial d 1) (monomial e b) = + monomial (e - derivExponent isV d + mulExponent isV d) + (b * operatorFactorial isV d e) := by + classical + induction d using Finsupp.induction with + | zero => simp [derivExponent, mulExponent, operatorFactorial, Finsupp.filter_zero] + | single_add i k d hi hk ih => + have hdi : d i = 0 := Finsupp.notMem_support_iff.mp hi + have hei : (e - derivExponent isV d + mulExponent isV d) i = e i := by + simp [derivExponent, mulExponent, Finsupp.filter_apply, hdi] + have hsplit : (monomial (Finsupp.single i k + d) (1 : K)) = + X i ^ k * monomial d 1 := by + rw [add_comm, monomial_add_single, mul_comm] + rw [hsplit, mixedOperator_mul_apply, ih, map_pow, mixedOperator_X, + operatorFactorial_single_add isV i k d e hi] + cases hvi : isV i + · rw [variableOperator_pow_false_monomial isV i hvi] + simp only [Bool.false_eq_true, ↓reduceIte, one_mul] + have hdv : derivExponent isV (Finsupp.single i k + d) = derivExponent isV d := by + simp [derivExponent, Finsupp.filter_add, Finsupp.filter_single_of_neg, hvi] + have hdu : mulExponent isV (Finsupp.single i k + d) = + Finsupp.single i k + mulExponent isV d := by + simp [mulExponent, Finsupp.filter_add, Finsupp.filter_single_of_pos, hvi] + rw [hdv, hdu] + congr 1 + ac_rfl + · rw [variableOperator_pow_true_monomial isV i hvi, hei] + simp only [↓reduceIte, Nat.cast_mul] + have hdv : derivExponent isV (Finsupp.single i k + d) = + Finsupp.single i k + derivExponent isV d := by + simp [derivExponent, Finsupp.filter_add, Finsupp.filter_single_of_pos, hvi] + have hdu : mulExponent isV (Finsupp.single i k + d) = mulExponent isV d := by + simp [mulExponent, Finsupp.filter_add, Finsupp.filter_single_of_neg, hvi] + rw [hdv, hdu] + have hexp : (e - derivExponent isV d + mulExponent isV d) - Finsupp.single i k = + e - (Finsupp.single i k + derivExponent isV d) + mulExponent isV d := by + ext j + by_cases hji : j = i + · subst j + simp [derivExponent, mulExponent, hvi, hdi] + · simp [hji] + rw [hexp] + congr 1 + ring + +/-- Exact arbitrary-coefficient monomial action, over every commutative semiring. -/ +theorem mixedOperator_monomial_apply (isV : σ → Bool) (d e : σ →₀ ℕ) (a b : K) : + mixedOperator isV (monomial d a) (monomial e b) = + monomial (e - derivExponent isV d + mulExponent isV d) + (a * b * operatorFactorial isV d e) := by + have h : monomial d a = C a * monomial d 1 := by rw [C_mul_monomial, mul_one] + rw [h, mixedOperator_mul_apply, mixedOperator_monomial_one_apply, mixedOperator_C] + simp [smul_monomial, smul_eq_mul, mul_assoc] + +/-- All matrix coefficients of a monomial mixed operator are explicit integral multiples. -/ +theorem coeff_mixedOperator_monomial [DecidableEq σ] (isV : σ → Bool) (d e f : σ →₀ ℕ) (a b : K) : + (mixedOperator isV (monomial d a) (monomial e b)).coeff f = + if e - derivExponent isV d + mulExponent isV d = f + then a * b * operatorFactorial isV d e else 0 := by + classical + rw [mixedOperator_monomial_apply, coeff_monomial] + +/-- A mixed monomial has nonzero integral multiplier exactly when differentiation is possible. -/ +theorem operatorFactorial_ne_zero_iff (isV : σ → Bool) (d e : σ →₀ ℕ) : + operatorFactorial isV d e ≠ 0 ↔ derivExponent isV d ≤ e := by + classical + unfold operatorFactorial + rw [Finsupp.prod_ne_zero_iff] + constructor + · intro h i + cases hvi : isV i + · simp [derivExponent, hvi] + · have hle : d i ≤ e i := by + by_cases hdi : d i = 0 + · simp [hdi] + · have hn := h i (Finsupp.mem_support_iff.mpr hdi) + simpa [hvi, Nat.descFactorial_eq_zero_iff_lt, not_lt] using hn + simpa [derivExponent, Finsupp.filter_apply, hvi] using hle + · intro h i hi + cases hvi : isV i + · simp + · have hle := h i + simpa [derivExponent, Finsupp.filter_apply, hvi, + Nat.descFactorial_eq_zero_iff_lt, not_lt] using hle + +/-- Over characteristic zero without zero divisors, the only possible vanishing is +an excessive differentiation exponent or a zero input coefficient. -/ +theorem mixedOperator_monomial_ne_zero_iff [NoZeroDivisors K] [CharZero K] + (isV : σ → Bool) (d e : σ →₀ ℕ) (a b : K) : + mixedOperator isV (monomial d a) (monomial e b) ≠ 0 ↔ + a ≠ 0 ∧ b ≠ 0 ∧ derivExponent isV d ≤ e := by + rw [mixedOperator_monomial_apply] + simp [operatorFactorial_ne_zero_iff, and_assoc] + +/-- The action of an arbitrary polynomial on a monomial is an explicit finite sum. -/ +theorem mixedOperator_apply_monomial (isV : σ → Bool) (p : MvPolynomial σ K) + (e : σ →₀ ℕ) (b : K) : + mixedOperator isV p (monomial e b) = + ∑ d ∈ p.support, monomial (e - derivExponent isV d + mulExponent isV d) + (p.coeff d * b * operatorFactorial isV d e) := by + classical + conv_lhs => rw [p.as_sum] + rw [map_sum, LinearMap.sum_apply] + simp only [mixedOperator_monomial_apply] + +/-- Distinct non-annihilated operator monomials have distinct output exponents +on each fixed source monomial. This is the orthogonality behind the first trace. -/ +theorem operator_target_injective (isV : σ → Bool) (e d₁ d₂ : σ →₀ ℕ) + (h₁ : derivExponent isV d₁ ≤ e) (h₂ : derivExponent isV d₂ ≤ e) + (h : e - derivExponent isV d₁ + mulExponent isV d₁ = + e - derivExponent isV d₂ + mulExponent isV d₂) : d₁ = d₂ := by + classical + ext i + have heq := DFunLike.congr_fun h i + have hle₁ := h₁ i + have hle₂ := h₂ i + cases hi : isV i <;> + simp [derivExponent, mulExponent, hi] at heq hle₁ hle₂ + · omega + · omega + +/-- At a surviving monomial's own target, no other operator monomial contributes. -/ +theorem coeff_mixedOperator_at_target (isV : σ → Bool) (p : MvPolynomial σ K) + (d e : σ →₀ ℕ) (b : K) (hd : derivExponent isV d ≤ e) : + (mixedOperator isV p (monomial e b)).coeff + (e - derivExponent isV d + mulExponent isV d) = + p.coeff d * b * operatorFactorial isV d e := by + classical + rw [mixedOperator_apply_monomial, coeff_sum] + rw [Finset.sum_eq_single d] + · simp + · intro f hf hfd + by_cases hfe : derivExponent isV f ≤ e + · have hne : e - derivExponent isV f + mulExponent isV f ≠ + e - derivExponent isV d + mulExponent isV d := by + intro heq + exact hfd (operator_target_injective isV e f d hfe hd heq) + simp [coeff_monomial, hne] + · have hz : operatorFactorial isV f e = 0 := by + by_contra h + exact hfe ((operatorFactorial_ne_zero_iff isV f e).mp h) + simp [hz] + · intro hnot + have hc : p.coeff d = 0 := notMem_support_iff.mp hnot + simp [hc] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OperatorNaturality.lean b/lean/OAI/Algebra/DepthFive/OperatorNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..54a9d13534fb17af97c53d18e73daaa908975e54 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OperatorNaturality.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.DepthFive.MixedOperator +import OAI.Algebra.DepthFive.IntegerRank + +namespace OAI + +noncomputable section + +namespace Problem335 + +open MvPolynomial + +variable {K L σ : Type*} [CommSemiring K] [CommSemiring L] + +/-- Coefficient extension commutes with each differential or multiplication step. -/ +theorem map_variableOperator (f : K →+* L) (isV : σ → Bool) (i : σ) + (p : MvPolynomial σ K) : + map f (variableOperator isV i p) = variableOperator isV i (map f p) := by + cases hi : isV i <;> simp [variableOperator, hi, pderiv_map] + +/-- The full mixed operator is natural under every homomorphism of coefficient +semirings. In particular its unnormalized integer matrix extends to any field. -/ +theorem map_mixedOperator (f : K →+* L) (isV : σ → Bool) + (p q : MvPolynomial σ K) : + map f (mixedOperator isV p q) = mixedOperator isV (map f p) (map f q) := by + induction p using MvPolynomial.induction_on generalizing q with + | C a => + simp [smul_eq_C_mul] + | add p r hp hr => + simp [hp, hr] + | mul_X p i hp => + rw [mixedOperator_mul_apply, map_mul, mixedOperator_mul_apply, + hp, map_X, mixedOperator_X, mixedOperator_X, map_variableOperator] + +/-- The coefficient matrix in arbitrary selected source and target monomials. +When the selections enumerate bidegree fibers, this is the restricted operator +matrix in the unnormalized monomial bases. -/ +def mixedMonomialMatrix {I J : Type*} (isV : σ → Bool) + (p : MvPolynomial σ K) (source : I → σ →₀ ℕ) (target : J → σ →₀ ℕ) : + Matrix J I K := + fun j i => (mixedOperator isV p (monomial (source i) 1)).coeff (target j) + +theorem mixedMonomialMatrix_map {I J : Type*} (f : K →+* L) + (isV : σ → Bool) (p : MvPolynomial σ K) + (source : I → σ →₀ ℕ) (target : J → σ →₀ ℕ) : + mixedMonomialMatrix isV (map f p) source target = + (mixedMonomialMatrix isV p source target).map f := by + ext j i + have h := congrArg (fun polynomial => polynomial.coeff (target j)) + (map_mixedOperator f isV p (monomial (source i) 1)) + simpa [mixedMonomialMatrix, coeff_map] using h.symm + +/-- Integral mixed operators have field-independent monomial-matrix rank in +characteristic zero, with no embedding between the two fields required. -/ +theorem integer_mixedMonomialMatrix_rank_eq + {I J : Type*} [Fintype I] [Fintype J] + (K L : Type*) [Field K] [CharZero K] [Field L] [CharZero L] + (isV : σ → Bool) (p : MvPolynomial σ ℤ) + (source : I → σ →₀ ℕ) (target : J → σ →₀ ℕ) : + (mixedMonomialMatrix isV (map (Int.castRingHom K) p) source target).rank = + (mixedMonomialMatrix isV (map (Int.castRingHom L) p) source target).rank := by + rw [mixedMonomialMatrix_map, mixedMonomialMatrix_map] + exact integer_matrix_rank_eq K L _ + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OperatorRank.lean b/lean/OAI/Algebra/DepthFive/OperatorRank.lean new file mode 100644 index 0000000000000000000000000000000000000000..f16b23b090f682ca8edd31ba880f219ceacbf0d4 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OperatorRank.lean @@ -0,0 +1,230 @@ +import Mathlib + +namespace OAI + +/-! +Bigraded polynomial spaces used by the differentiation--multiplication rank measure. +The Boolean partition assigns derivative variables to `true` and multiplication +variables to `false`. +-/ + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ K : Type*} + +/-- Degree in derivative variables and in multiplication variables, respectively. -/ +def bidegreeWeight (isV : σ → Bool) (i : σ) : ℕ × ℕ := + if isV i then (1, 0) else (0, 1) + +@[simp] theorem bidegreeWeight_true (isV : σ → Bool) {i : σ} (hi : isV i = true) : + bidegreeWeight isV i = (1, 0) := by simp [bidegreeWeight, hi] + +@[simp] theorem bidegreeWeight_false (isV : σ → Bool) {i : σ} (hi : isV i = false) : + bidegreeWeight isV i = (0, 1) := by simp [bidegreeWeight, hi] + +/-- The sum of the two partial degrees is total degree. -/ +theorem bidegreeWeight_total (isV : σ → Bool) (d : σ →₀ ℕ) : + (Finsupp.weight (bidegreeWeight isV) d).1 + + (Finsupp.weight (bidegreeWeight isV) d).2 = d.degree := by + classical + simp only [Finsupp.weight_apply, Finsupp.sum, Finsupp.degree_apply, + Prod.fst_sum, Prod.snd_sum, Prod.smul_fst, Prod.smul_snd, smul_eq_mul, + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i hi + cases h : isV i <;> simp [bidegreeWeight, h] + +variable [CommSemiring K] + +/-- The polynomial subspace of fixed bidegree. -/ +def bidegreeSubmodule (isV : σ → Bool) (a b : ℕ) : Submodule K (MvPolynomial σ K) := + MvPolynomial.weightedHomogeneousSubmodule K (bidegreeWeight isV) (a, b) + +/-- Linear projection to a fixed bidegree. -/ +def bidegreeComponent (isV : σ → Bool) (a b : ℕ) : + MvPolynomial σ K →ₗ[K] MvPolynomial σ K := + MvPolynomial.weightedHomogeneousComponent (bidegreeWeight isV) (a, b) + +@[simp] theorem mem_bidegreeSubmodule (isV : σ → Bool) (a b : ℕ) + (p : MvPolynomial σ K) : + p ∈ bidegreeSubmodule isV a b ↔ + p.IsWeightedHomogeneous (bidegreeWeight isV) (a, b) := Iff.rfl + +@[simp] theorem coeff_bidegreeComponent (isV : σ → Bool) (a b : ℕ) + (p : MvPolynomial σ K) (d : σ →₀ ℕ) : + (bidegreeComponent isV a b p).coeff d = + if Finsupp.weight (bidegreeWeight isV) d = (a, b) + then p.coeff d else 0 := + MvPolynomial.coeff_weightedHomogeneousComponent _ _ _ + + theorem bidegreeComponent_mem (isV : σ → Bool) (a b : ℕ) + (p : MvPolynomial σ K) : + bidegreeComponent isV a b p ∈ bidegreeSubmodule isV a b := + MvPolynomial.weightedHomogeneousComponent_mem _ _ _ + + theorem bidegreeComponent_eq_self {isV : σ → Bool} {a b : ℕ} + {p : MvPolynomial σ K} (hp : p ∈ bidegreeSubmodule isV a b) : + bidegreeComponent isV a b p = p := + MvPolynomial.weightedHomogeneousComponent_eq_self hp + + theorem bidegreeSubmodule_isHomogeneous {isV : σ → Bool} {a b : ℕ} + {p : MvPolynomial σ K} (hp : p ∈ bidegreeSubmodule isV a b) : + p.IsHomogeneous (a + b) := by + intro d hd + have h := bidegreeWeight_total isV d + rw [hp hd] at h + simpa only [Finsupp.degree_eq_weight_one, Pi.one_def] using h.symm + + theorem finite_bidegreeMonomials [Finite σ] (isV : σ → Bool) (a b : ℕ) : + {d : σ →₀ ℕ | Finsupp.weight (bidegreeWeight isV) d = (a, b)}.Finite := by + apply (Finsupp.finite_of_degree_le (σ := σ) (a + b)).subset + intro d hd + have h := bidegreeWeight_total isV d + rw [hd] at h + exact le_of_eq h.symm + +instance bidegreeSubmodule_finite [Finite σ] (isV : σ → Bool) (a b : ℕ) : + Module.Finite K (bidegreeSubmodule (K := K) isV a b) := by + unfold bidegreeSubmodule + rw [MvPolynomial.weightedHomogeneousSubmodule_eq_finsupp_supported] + have := (finite_bidegreeMonomials isV a b).to_subtype + exact Module.Finite.of_basis + (MvPolynomial.basisRestrictSupport K + {d | Finsupp.weight (bidegreeWeight isV) d = (a, b)}) + + theorem bidegreeSubmodule_mul {isV : σ → Bool} {a b c d : ℕ} + {p q : MvPolynomial σ K} (hp : p ∈ bidegreeSubmodule isV a b) + (hq : q ∈ bidegreeSubmodule isV c d) : + p * q ∈ bidegreeSubmodule isV (a + c) (b + d) := + hp.mul hq + + theorem bidegreeSubmodule_pderiv_true {isV : σ → Bool} {a b : ℕ} {i : σ} + (hi : isV i = true) {p : MvPolynomial σ K} + (hp : p ∈ bidegreeSubmodule isV a b) : + MvPolynomial.pderiv i p ∈ bidegreeSubmodule isV (a - 1) b := by + classical + intro d hd + rw [MvPolynomial.coeff_pderiv] at hd + have h := hp (left_ne_zero_of_mul hd) + simp only [map_add, Finsupp.weight_single, one_smul, bidegreeWeight_true isV hi] at h + have h1 := congrArg Prod.fst h + have h2 := congrArg Prod.snd h + apply Prod.ext <;> dsimp at * <;> omega + + theorem bidegreeSubmodule_pderiv_false {isV : σ → Bool} {a b : ℕ} {i : σ} + (hi : isV i = false) {p : MvPolynomial σ K} + (hp : p ∈ bidegreeSubmodule isV a b) : + MvPolynomial.pderiv i p ∈ bidegreeSubmodule isV a (b - 1) := by + classical + intro d hd + rw [MvPolynomial.coeff_pderiv] at hd + have h := hp (left_ne_zero_of_mul hd) + simp only [map_add, Finsupp.weight_single, one_smul, bidegreeWeight_false isV hi] at h + have h1 := congrArg Prod.fst h + have h2 := congrArg Prod.snd h + apply Prod.ext <;> dsimp at * <;> omega + + theorem bidegreeSubmodule_X_mul_true {isV : σ → Bool} {a b : ℕ} {i : σ} + (hi : isV i = true) {p : MvPolynomial σ K} + (hp : p ∈ bidegreeSubmodule isV a b) : + MvPolynomial.X i * p ∈ bidegreeSubmodule isV (a + 1) b := by + have hx := MvPolynomial.isWeightedHomogeneous_X (R := K) (bidegreeWeight isV) i + rw [bidegreeWeight_true isV hi] at hx + simpa only [mem_bidegreeSubmodule, Prod.mk_add_mk, Nat.add_comm 1, zero_add] using hx.mul hp + + theorem bidegreeSubmodule_X_mul_false {isV : σ → Bool} {a b : ℕ} {i : σ} + (hi : isV i = false) {p : MvPolynomial σ K} + (hp : p ∈ bidegreeSubmodule isV a b) : + MvPolynomial.X i * p ∈ bidegreeSubmodule isV a (b + 1) := by + have hx := MvPolynomial.isWeightedHomogeneous_X (R := K) (bidegreeWeight isV) i + rw [bidegreeWeight_false isV hi] at hx + simpa only [mem_bidegreeSubmodule, Prod.mk_add_mk, Nat.add_comm 1, zero_add] using hx.mul hp + +/-- A homogeneous polynomial splits into its finitely many possible bidegrees. -/ +theorem bidegree_decomposition (isV : σ → Bool) {n : ℕ} + {p : MvPolynomial σ K} (hp : p.IsHomogeneous n) : + p = ∑ i : Fin (n + 1), bidegreeComponent isV i (n - i) p := by + classical + ext d + rw [MvPolynomial.coeff_sum] + by_cases hd : p.coeff d = 0 + · simp [coeff_bidegreeComponent, hd] + have hn : d.degree = n := by + simpa only [Finsupp.degree_eq_weight_one, Pi.one_def] using hp hd + have ht := bidegreeWeight_total isV d + rw [hn] at ht + let i : Fin (n + 1) := ⟨(Finsupp.weight (bidegreeWeight isV) d).1, by omega⟩ + symm + rw [Finset.sum_eq_single i] + · rw [coeff_bidegreeComponent, ite_eq_left] + apply Prod.ext + · rfl + · dsimp [i] + omega + · intro j hj hji + rw [coeff_bidegreeComponent, ite_eq_right] + intro heq + apply hji + apply Fin.ext + exact (congrArg Prod.fst heq).symm + · simp + +/-- Projection acts diagonally on a polynomial already of a fixed bidegree. -/ +theorem bidegreeComponent_of_mem {isV : σ → Bool} {a b k m : ℕ} + {p : MvPolynomial σ K} (hp : p ∈ bidegreeSubmodule isV a b) : + bidegreeComponent isV k m p = if k = a ∧ m = b then p else 0 := by + simpa only [bidegreeComponent, Prod.mk.injEq] using + MvPolynomial.weightedHomogeneousComponent_of_mem (w := bidegreeWeight isV) + (m := (k, m)) hp + +/-- Finite products add both partial degrees. -/ +theorem bidegreeSubmodule_prod {ι : Type*} (s : Finset ι) + {isV : σ → Bool} {a b : ι → ℕ} {p : ι → MvPolynomial σ K} + (hp : ∀ j ∈ s, p j ∈ bidegreeSubmodule isV (a j) (b j)) : + (∏ j ∈ s, p j) ∈ bidegreeSubmodule isV (∑ j ∈ s, a j) (∑ j ∈ s, b j) := by + have hs : (∑ j ∈ s, (a j, b j)) = (∑ j ∈ s, a j, ∑ j ∈ s, b j) := by + ext <;> simp only [Prod.fst_sum, Prod.snd_sum] + rw [mem_bidegreeSubmodule, ← hs] + exact MvPolynomial.IsWeightedHomogeneous.prod s p (fun j => (a j, b j)) hp + +/-- Expansion of a product into all choices of factor bidegrees. -/ +theorem product_bidegree_decomposition {ι : Type*} [Fintype ι] [DecidableEq ι] + (isV : σ → Bool) (e : ι → ℕ) (p : ι → MvPolynomial σ K) + (hp : ∀ j, (p j).IsHomogeneous (e j)) : + (∏ j, p j) = ∑ a : (∀ j : ι, Fin (e j + 1)), + ∏ j, bidegreeComponent isV (a j) (e j - a j) (p j) := by + classical + calc + (∏ j, p j) = ∏ j, ∑ a : Fin (e j + 1), + bidegreeComponent isV a (e j - a) (p j) := by + apply Finset.prod_congr rfl + intro j hj + exact bidegree_decomposition isV (hp j) + _ = _ := Fintype.prod_sum _ + +/-- The fixed-bidegree component of a product is the constrained assignment sum. -/ +theorem bidegreeComponent_product {ι : Type*} [Fintype ι] [DecidableEq ι] + (isV : σ → Bool) (e : ι → ℕ) (p : ι → MvPolynomial σ K) + (hp : ∀ j, (p j).IsHomogeneous (e j)) (k m : ℕ) : + bidegreeComponent isV k m (∏ j, p j) = + ∑ a : (∀ j : ι, Fin (e j + 1)), + if (∑ j : ι, (a j : ℕ)) = k ∧ (∑ j : ι, (e j - (a j : ℕ))) = m then + ∏ j, bidegreeComponent isV (a j) (e j - a j) (p j) + else 0 := by + classical + rw [product_bidegree_decomposition isV e p hp, map_sum] + apply Finset.sum_congr rfl + intro a ha + have h := bidegreeSubmodule_prod (Finset.univ : Finset ι) + (fun j _ => bidegreeComponent_mem isV (a j) (e j - a j) (p j)) + rw [bidegreeComponent_of_mem h] + simp only [eq_comm] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OperatorRankBridge.lean b/lean/OAI/Algebra/DepthFive/OperatorRankBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb7c670fc3f6192bbe8ca81d0162211bd323c2e0 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OperatorRankBridge.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.DepthFive.BidegreeBridge +import OAI.Algebra.DepthFive.FiniteOperator +import OAI.Algebra.DepthFive.IntermediateFactorization + +namespace OAI + +/-! Equality of the finite-source APIs used by the product bound and the trace bound. -/ +noncomputable section + +namespace Problem335 + +variable {σ K : Type*} [Field K] + +/-- The independently useful source-only constructions define the same linear family. -/ +theorem sourceMixedOperator_eq_rawOperatorFamily (side : σ → Bool) (a b : ℕ) : + sourceMixedOperator (K := K) side a b = rawOperatorFamily side a b := by + ext q p + rfl + +/-- The canonical rank is the source-only rank of the paired projection. -/ +theorem bidegreeRank_eq_source_measure (side : σ → Bool) (a b k m : ℕ) + (q : MvPolynomial σ K) : + bidegreeRank side a b k m q = + RankMeasure.measure (sourceMixedOperator side a b) (bidegreeComponent side k m q) := by + rw [sourceMixedOperator_eq_rawOperatorFamily] + rfl + +/-- For a homogeneous defining polynomial, the indicator projection suffices. -/ +theorem bidegreeRank_eq_source_component (side : σ → Bool) (a b k m : ℕ) + {q : MvPolynomial σ K} (hq : q.IsHomogeneous (k + m)) : + bidegreeRank side a b k m q = + RankMeasure.measure (sourceMixedOperator side a b) (Bidegree.component side k q) := by + rw [bidegreeRank_eq_source_measure, bidegreeComponent_eq_component side k m hq] + +/-- The rank used in finite-matrix moment estimates equals the source-only rank. -/ +theorem finiteMixedOperator_rank_eq_source_measure (side : σ → Bool) (a b k m : ℕ) + (q : MvPolynomial σ K) : + RankMeasure.mapRank (finiteMixedOperator side a b k m q) = + RankMeasure.measure (sourceMixedOperator side a b) (bidegreeComponent side k m q) := by + rw [finiteMixedOperator_rank, bidegreeRank_eq_source_measure] + +/-- When projection is redundant, no conversion of defining polynomials is needed. -/ +theorem finiteMixedOperator_rank_eq_source_of_mem (side : σ → Bool) (a b k m : ℕ) + {q : MvPolynomial σ K} (hq : q ∈ bidegreeSubmodule side k m) : + RankMeasure.mapRank (finiteMixedOperator side a b k m q) = + RankMeasure.mapRank (sourceMixedOperator side a b q) := by + rw [finiteMixedOperator_rank_eq_source_measure, bidegreeComponent_eq_self hq] + rfl + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/OperatorTraceBridge.lean b/lean/OAI/Algebra/DepthFive/OperatorTraceBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0d2d18ff350356393abce25aef3fe4a13db255d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/OperatorTraceBridge.lean @@ -0,0 +1,113 @@ +import OAI.Algebra.DepthFive.TraceExpansion + +namespace OAI + +/-! Bridge from finite-basis operator actions to the path trace formulas. -/ + +noncomputable section +open scoped BigOperators Matrix +open Module + +namespace Problem335 + +section General +variable {I J P K V W : Type*} + [Fintype I] [Fintype J] [Fintype P] [DecidableEq I] [DecidableEq J] + [CommSemiring K] [AddCommMonoid V] [Module K V] [AddCommMonoid W] [Module K W] + +/-- An operator action described by weighted basis shifts has exactly the +corresponding path-shift matrix. No orthonormal structure is required here. -/ +theorem toMatrix_eq_pathShiftMatrix + (b : Basis I K V) (c : Basis J K W) (F : V →ₗ[K] W) + (shift : I → P → J) (weight : I → P → K) + (haction : ∀ i, F (b i) = ∑ p, weight i p • c (shift i p)) : + LinearMap.toMatrix b c F = pathShiftMatrix shift weight := by + classical + ext j i + rw [LinearMap.toMatrix_apply, haction] + simp [pathShiftMatrix, map_sum, map_smul, Finsupp.single_apply] + +end General + +variable {I J P V W : Type*} + [Fintype I] [Fintype J] [Fintype P] [DecidableEq I] [DecidableEq J] + [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + +/-- First trace for a finite-basis operator with collision-free path action. -/ +theorem operator_first_trace_of_path_action + (b : Basis I ℝ V) (c : Basis J ℝ W) (F : V →ₗ[ℝ] W) + (shift : I → P → J) (weight : I → P → ℝ) + (haction : ∀ i, F (b i) = ∑ p, weight i p • c (shift i p)) + (hdisjoint : ∀ i p q, p ≠ q → shift i p = shift i q → + weight i p * weight i q = 0) : + let A := LinearMap.toMatrix b c F + Matrix.trace (A.transpose * A) = ∑ i, ∑ p, weight i p ^ 2 := by + dsimp + rw [toMatrix_eq_pathShiftMatrix b c F shift weight haction] + exact pathShiftMatrix_first_trace shift weight hdisjoint + +/-- First trace for the square-root occupation coefficients of the Fock basis. -/ +theorem operator_first_trace_of_sqrt_path_action + (b : Basis I ℝ V) (c : Basis J ℝ W) (F : V →ₗ[ℝ] W) + (shift : I → P → J) (mass : I → P → ℝ) + (haction : ∀ i, F (b i) = ∑ p, Real.sqrt (mass i p) • c (shift i p)) + (hnonneg : ∀ i p, 0 ≤ mass i p) + (hdisjoint : ∀ i p q, p ≠ q → shift i p = shift i q → + mass i p = 0 ∨ mass i q = 0) : + let A := LinearMap.toMatrix b c F + Matrix.trace (A.transpose * A) = ∑ i, ∑ p, mass i p := by + dsimp + rw [toMatrix_eq_pathShiftMatrix b c F shift (fun i p => Real.sqrt (mass i p)) haction] + exact pathShiftMatrix_first_trace_sqrt shift mass hnonneg hdisjoint + +/-- Exact second trace for an operator described on a finite basis by paths. -/ +theorem operator_second_trace_of_path_action + (b : Basis I ℝ V) (c : Basis J ℝ W) (F : V →ₗ[ℝ] W) + (shift : I → P → J) (weight : I → P → ℝ) + (haction : ∀ i, F (b i) = ∑ p, weight i p • c (shift i p)) : + let A := LinearMap.toMatrix b c F + Matrix.trace ((A.transpose * A) ^ 2) = + ∑ i, ∑ k, ∑ p, ∑ q, ∑ r, ∑ s, + if shift i p = shift k q ∧ shift i r = shift k s then + weight i p * weight k q * weight i r * weight k s else 0 := by + dsimp + rw [toMatrix_eq_pathShiftMatrix b c F shift weight haction] + exact pathShiftMatrix_second_trace_four_paths shift weight + +/-- Coordinates after separate unit rescalings of the source and target bases. -/ +theorem path_toMatrix_unitsSMul_apply {I : Type u_1} {J : Type u_2} + {V : Type u_4} {W : Type u_5} + [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] + [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + (b : Basis I ℝ V) (c : Basis J ℝ W) (F : V →ₗ[ℝ] W) + (sourceScale : I → ℝˣ) (targetScale : J → ℝˣ) (j : J) (i : I) : + LinearMap.toMatrix (b.unitsSMul sourceScale) (c.unitsSMul targetScale) F j i = + (targetScale j : ℝ)⁻¹ * (sourceScale i : ℝ) * LinearMap.toMatrix b c F j i := by + simp [LinearMap.toMatrix_apply, Basis.unitsSMul_apply, Basis.repr_unitsSMul, + Units.smul_def, map_smul, Finsupp.smul_apply, mul_assoc, mul_left_comm] + +/-- The path coefficient changes by the source/target normalization ratio. +This applies in particular to factorial-normalized monomial bases. -/ +theorem toMatrix_normalized_path_action + (b : Basis I ℝ V) (c : Basis J ℝ W) (F : V →ₗ[ℝ] W) + (shift : I → P → J) (weight : I → P → ℝ) + (haction : ∀ i, F (b i) = ∑ p, weight i p • c (shift i p)) + (sourceScale : I → ℝˣ) (targetScale : J → ℝˣ) : + LinearMap.toMatrix (b.unitsSMul sourceScale) (c.unitsSMul targetScale) F = + pathShiftMatrix shift (fun i p => + (targetScale (shift i p) : ℝ)⁻¹ * (sourceScale i : ℝ) * weight i p) := by + classical + ext j i + rw [path_toMatrix_unitsSMul_apply, toMatrix_eq_pathShiftMatrix b c F shift weight haction] + simp only [pathShiftMatrix, Finset.mul_sum] + apply Finset.sum_congr rfl + intro p hp + by_cases h : shift i p = j + · simp [h] + · simp [h] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PairingAverageCardinality.lean b/lean/OAI/Algebra/DepthFive/PairingAverageCardinality.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ce31272ddb5df67dbb27d925e1180ce00a21a95 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PairingAverageCardinality.lean @@ -0,0 +1,41 @@ +import OAI.Algebra.DepthFive.LocalMomentPairing + +namespace OAI + +/-! Multiplying a genuine normalized source average introduces exactly one +source-cardinality factor, including when the source is empty. -/ +noncomputable section +open scoped BigOperators + +namespace Problem335.MomentPairing +open Pairings + +theorem sum_sources_local_moments_le_of_average {ι γ : Type*} [Fintype ι] + [Fintype γ] [DecidableEq γ] {L : ℕ} + (side : Fin (L + 1) → Bool) {A B : ℝ} + (hA : 0 < A) (hB : 0 ≤ B) (endpoint : γ) + (C : ι → (Fin L → Labels γ) → ℝ) + (haverage : ∀ x, Compatible endpoint x → + (∑ i, C i x) / (Fintype.card ι : ℝ) ≤ + ∏ t, LocalMoments.localGeometricMass (side t) (if side t then A else B) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) : + (∑ i, ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, C i x.1) ≤ + (Fintype.card ι : ℝ) * pathMean side A B ^ 2 * + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight side (A / (A + 1)) (B / (B + 1)) endpoint τ x.1 := by + classical + apply sum_sources_local_moments_le side hA hB (by positivity) endpoint C + intro x hx + by_cases hcard : Fintype.card ι = 0 + · let : IsEmpty ι := Fintype.card_eq_zero_iff.mp hcard + simp + · have hpos : (0 : ℝ) < Fintype.card ι := by + exact_mod_cast Nat.pos_of_ne_zero hcard + simpa only [mul_comm] using (div_le_iff₀ hpos).mp (haverage x hx) + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PairingNeighborCount.lean b/lean/OAI/Algebra/DepthFive/PairingNeighborCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c0731f96f9c832060ee83afc82011e96b53e8b9 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PairingNeighborCount.lean @@ -0,0 +1,57 @@ +import OAI.Algebra.DepthFive.PairingWeights +import OAI.Algebra.DepthFive.ScheduleWeightBridge + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.Pairings + +/-- The actual path endpoints coincide with the schedule's internal ends. -/ +theorem internalEndpointSet_eq_internalEnds {L : ℕ} (t : Fin (L + 1)) : + internalEndpointSet t = BalancedSchedule.internalEnds t := by + ext v + simp [internalEndpointSet, BalancedSchedule.internalEnds, Fin.ext_iff] + +/-- Boolean word form of the normal-endpoint exponent in the weighted +relaxed-path count, using the canonical schedule coincidence set. -/ +theorem normalEndpointCount_eq_nnInternalEnds_card {L : ℕ} + (w : Fin (L + 1) → Bool) (t : Fin (L + 1)) : + normalEndpointCount (fun i => boolKindEquiv (w i)) (internalEndpointSet t) = + (BalancedSchedule.nnInternalEnds w t).card := by + have hbool (b : Bool) : boolKindEquiv b = .normal ↔ b = false := by + cases b <;> simp + unfold normalEndpointCount BalancedSchedule.nnInternalEnds + rw [internalEndpointSet_eq_internalEnds] + congr 1 + apply Finset.filter_congr + intro v hv + simp only [hbool] + rfl + +/-- At a normal layer the relaxed-path exponent is precisely the canonical +graph-word false-neighbor count. -/ +theorem normalEndpointCount_eq_falseNeighbors_card {L : ℕ} + (w : Fin (L + 1) → Bool) (t : Fin (L + 1)) (ht : w t = false) : + normalEndpointCount (fun i => boolKindEquiv (w i)) (internalEndpointSet t) = + (IsolatedWeight.falseNeighbors BalancedSchedule.adjacent w t).card := by + rw [normalEndpointCount_eq_nnInternalEnds_card] + exact (BalancedSchedule.falseNeighbors_card_eq_nnInternalEnds_card w t ht).symm + +/-- The complete word correction expressed in the exponents supplied by the +actual relaxed-path averaging theorem. -/ +theorem correction_eq_normalEndpointCount_product {L : ℕ} + (V : Finset (Fin (L + 1))) (w : Fin (L + 1) → Bool) (A x : ℝ) : + IsolatedWeight.correction V BalancedSchedule.adjacent A x w = + ∏ t ∈ V.filter (fun t => w t = false), + (1 + A * x ^ normalEndpointCount (fun i => boolKindEquiv (w i)) + (internalEndpointSet t)) := by + rw [BalancedSchedule.correction_eq_nnInternalEnds_product] + simp_rw [normalEndpointCount_eq_nnInternalEnds_card] + +end Problem335.Pairings + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PairingOccupationAverage.lean b/lean/OAI/Algebra/DepthFive/PairingOccupationAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..62d6bf6b1c237e8b786c35af36771a3b18ec89db --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PairingOccupationAverage.lean @@ -0,0 +1,77 @@ +import OAI.Algebra.DepthFive.LocalMomentPairing +import OAI.Algebra.DepthFive.LocalProductAverage + +namespace OAI + +/-! Actual finite occupation averages feed the normalized pairing sum. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335.MomentPairing +open Pairings + +def layerMeanV (γ : Type*) [Fintype γ] {L : ℕ} + (side : Fin (L + 1) → Bool) (a : ℕ) : ℝ := + (a : ℝ) / Fintype.card {v : Fin (L + 1) × (γ × γ) // side v.1 = true} + +def layerMeanU (γ : Type*) [Fintype γ] {L : ℕ} + (side : Fin (L + 1) → Bool) (b : ℕ) : ℝ := + (b : ℝ) / Fintype.card {v : Fin (L + 1) × (γ × γ) // ¬ side v.1 = true} + +def occupationPathMean {γ : Type*} [Fintype γ] [DecidableEq γ] {L : ℕ} + (side : Fin (L + 1) → Bool) (a b : ℕ) + (endpoint : γ) (x : Fin L → Labels γ) : ℝ := + partitionCompositionMean (fun v : Fin (L + 1) × (γ × γ) => side v.1) + (fun M => ∏ t, LocalMoments.localPolynomial (side t) (fun y => M (t, y)) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) a b + +/-- The true two-group uniform average is bounded by the geometric local +table. Both variable groups are nonempty; no moment hypothesis is assumed. -/ +theorem occupationPathMean_le_geometric {γ : Type*} [Fintype γ] [DecidableEq γ] + {L : ℕ} (side : Fin (L + 1) → Bool) + [Nonempty {v : Fin (L + 1) × (γ × γ) // side v.1 = true}] + [Nonempty {v : Fin (L + 1) × (γ × γ) // ¬ side v.1 = true}] + (a b : ℕ) (endpoint : γ) (x : Fin L → Labels γ) : + occupationPathMean side a b endpoint x ≤ + pathGeometricMoment side (layerMeanV γ side a) (layerMeanU γ side b) + endpoint (classifyWord endpoint x) x := by + have h := LocalMoments.partitionCompositionMean_layered_restrict_le side a b + Finset.univ (fun t => (layerLabels endpoint x t).p) + (fun t => (layerLabels endpoint x t).q) (fun t => (layerLabels endpoint x t).r) + rw [← prod_localGeometricMass_eq] + simpa [occupationPathMean, layerMeanV, layerMeanU] using h + +/-- Actual occupation averaging, normalizing, and relaxing the four-path +classes combine without a residual analytic comparison hypothesis. -/ +theorem sum_occupationPathMean_le {γ : Type*} [Fintype γ] [DecidableEq γ] + {L : ℕ} (side : Fin (L + 1) → Bool) + [Nonempty {v : Fin (L + 1) × (γ × γ) // side v.1 = true}] + [Nonempty {v : Fin (L + 1) × (γ × γ) // ¬ side v.1 = true}] + (a b : ℕ) (ha : 0 < a) (endpoint : γ) : + (∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + occupationPathMean side a b endpoint x.1) ≤ + pathMean side (layerMeanV γ side a) (layerMeanU γ side b) ^ 2 * + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight side + (layerMeanV γ side a / (layerMeanV γ side a + 1)) + (layerMeanU γ side b / (layerMeanU γ side b + 1)) endpoint τ x.1 := by + have hA : 0 < layerMeanV γ side a := by + unfold layerMeanV + exact div_pos (by exact_mod_cast ha) (by exact_mod_cast Fintype.card_pos) + have hB : 0 ≤ layerMeanU γ side b := by unfold layerMeanU; positivity + calc + _ ≤ ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + pathGeometricMoment side (layerMeanV γ side a) (layerMeanU γ side b) + endpoint (classifyWord endpoint x.1) x.1 := by + apply Finset.sum_le_sum + intro x _ + exact occupationPathMean_le_geometric side a b endpoint x.1 + _ ≤ _ := sum_compatible_geometricMoment_le side hA hB endpoint + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PairingPartition.lean b/lean/OAI/Algebra/DepthFive/PairingPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..30b76ec10035e2993093cbaeb552be0e03d98d28 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PairingPartition.lean @@ -0,0 +1,136 @@ +import OAI.Algebra.DepthFive.RelaxedPaths + +namespace OAI + +namespace Problem335.Pairings + +open scoped BigOperators + +instance {α : Type*} [DecidableEq α] (τ : Kind) (x : Labels α) : + Decidable (ExactRespects τ x) := by + cases τ <;> unfold ExactRespects <;> infer_instance + +/-- Assign the all-equal case to normal pairing, as required for disjoint classes. -/ +def classify {α : Type*} [DecidableEq α] (x : Labels α) : Kind := + if x.p = x.q then .normal else .diagonal + +theorem exactRespects_classify_iff {α : Type*} [DecidableEq α] (x : Labels α) : + ExactRespects (classify x) x ↔ + Finsupp.single x.p (1 : ℤ) - Finsupp.single x.q 1 = + Finsupp.single x.r 1 - Finsupp.single x.s 1 := by + rw [coordinate_difference_eq_iff_exclusive] + by_cases h : x.p = x.q <;> simp [classify, ExactRespects, h] + +theorem classify_eq_of_exact {α : Type*} [DecidableEq α] {τ : Kind} {x : Labels α} + (h : ExactRespects τ x) : classify x = τ := by + cases τ + · simp [classify, h.1] + · simp [classify, h.2.2] + +/-- The four layer coordinates of endpoint-fixed paths. -/ +def layerLabels {α : Type*} {L : ℕ} (a : α) (x : Fin L → Labels α) + (t : Fin (L + 1)) : Labels (α × α) := + zipLabels (closePaths a x t.castSucc) (closePaths a x t.succ) + +abbrev ExactPaths (α : Type*) {L : ℕ} (a : α) (τ : Fin (L + 1) → Kind) := + {x : Fin L → Labels α // ∀ t, ExactRespects (τ t) (layerLabels a x t)} + +abbrev CompatiblePaths (α : Type*) {L : ℕ} (a : α) := + {x : Fin L → Labels α // ∀ t : Fin (L + 1), + Finsupp.single (layerLabels a x t).p (1 : ℤ) - + Finsupp.single (layerLabels a x t).q 1 = + Finsupp.single (layerLabels a x t).r 1 - + Finsupp.single (layerLabels a x t).s 1} + +/-- The compatible quadruples partition uniquely according to their exact pairing word. -/ +def compatiblePathsEquivSigma (α : Type*) [DecidableEq α] {L : ℕ} (a : α) : + CompatiblePaths α (L := L) a ≃ + Σ τ : Fin (L + 1) → Kind, ExactPaths α a τ where + toFun x := ⟨fun t => classify (layerLabels a x.1 t), + ⟨x.1, fun t => (exactRespects_classify_iff _).mpr (x.2 t)⟩⟩ + invFun x := ⟨x.2.1, fun t => + (coordinate_difference_eq_iff_existsUnique _).mpr + ⟨x.1 t, x.2.2 t, fun _ hk => exactRespects_unique hk (x.2.2 t)⟩⟩ + left_inv _ := rfl + right_inv x := by + rcases x with ⟨τ, x⟩ + have hτ : (fun t => classify (layerLabels a x.1 t)) = τ := + funext (fun t => classify_eq_of_exact (x.2 t)) + apply Sigma.ext hτ + have hp : ∀ y : Fin L → Labels α, + (∀ t, ExactRespects (classify (layerLabels a x.1 t)) (layerLabels a y t)) ↔ + ∀ t, ExactRespects (τ t) (layerLabels a y t) := by + intro y + simp only [fun t => classify_eq_of_exact (x.2 t)] + exact (Subtype.heq_iff_coe_eq hp).mpr rfl + +/-- Regroup any finite weighted compatible-path sum by its unique pairing word. -/ +theorem sum_compatiblePaths_eq_sum_exactPaths {α R : Type*} + [Fintype α] [DecidableEq α] [AddCommMonoid R] {L : ℕ} + (a : α) (w : (Fin L → Labels α) → R) : + (∑ x : CompatiblePaths α (L := L) a, w x.1) = + ∑ τ : Fin (L + 1) → Kind, ∑ x : ExactPaths α a τ, w x.1 := by + classical + simpa only [Fintype.sum_sigma] using + (Fintype.sum_equiv (compatiblePathsEquivSigma α a) + (fun x : CompatiblePaths α (L := L) a => w x.1) + (fun x : Σ τ : Fin (L + 1) → Kind, ExactPaths α a τ => w x.2.1) + (fun _ => rfl)) + +/-- Regroup sums whose weight remembers the canonical pairing word. -/ +theorem sum_compatiblePaths_pairingWeight {α R : Type*} + [Fintype α] [DecidableEq α] [AddCommMonoid R] {L : ℕ} + (a : α) (w : (Fin (L + 1) → Kind) → (Fin L → Labels α) → R) : + (∑ x : CompatiblePaths α (L := L) a, + w (fun t => classify (layerLabels a x.1 t)) x.1) = + ∑ τ : Fin (L + 1) → Kind, ∑ x : ExactPaths α a τ, w τ x.1 := by + classical + simpa only [Fintype.sum_sigma] using + (Fintype.sum_equiv (compatiblePathsEquivSigma α a) + (fun x : CompatiblePaths α (L := L) a => + w (fun t => classify (layerLabels a x.1 t)) x.1) + (fun x : Σ τ : Fin (L + 1) → Kind, ExactPaths α a τ => w x.1 x.2.1) + (fun _ => rfl)) + +/-- Enlarging a finite summation domain preserves inequalities for nonnegative weights. -/ +theorem sum_subtype_le_of_imp {ι : Type*} [Fintype ι] + (P Q : ι → Prop) [DecidablePred P] [DecidablePred Q] + (hPQ : ∀ x, P x → Q x) (w : ι → ℝ) (hw : ∀ x, 0 ≤ w x) : + (∑ x : {x // P x}, w x.1) ≤ ∑ x : {x // Q x}, w x.1 := by + classical + calc + _ = ∑ x ∈ Finset.univ.filter P, w x := + (Finset.sum_subtype _ (by intro x; simp) w).symm + _ ≤ ∑ x ∈ Finset.univ.filter Q, w x := by + apply Finset.sum_le_sum_of_subset_of_nonneg + · intro x hx + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hx ⊢ + exact hPQ x hx + · intro x _ _ + exact hw x + _ = _ := Finset.sum_subtype _ (by intro x; simp) w + +/-- Dropping the diagonal inequalities introduces only nonnegative summands. -/ +theorem sum_exactPaths_le_sum_relaxedPaths {α : Type*} + [Fintype α] [DecidableEq α] {L : ℕ} (a : α) + (τ : Fin (L + 1) → Kind) (w : (Fin L → Labels α) → ℝ) + (hw : ∀ x, 0 ≤ w x) : + (∑ x : ExactPaths α a τ, w x.1) ≤ ∑ x : RelaxedPaths α a τ, w x.1 := by + apply sum_subtype_le_of_imp _ _ ?_ w hw + intro x hx t + exact (hx t).respects + +/-- Exact grouping followed by relaxation: the combinatorial second-trace upper bound. -/ +theorem sum_compatiblePaths_le_sum_relaxedPaths {α : Type*} + [Fintype α] [DecidableEq α] {L : ℕ} (a : α) + (w : (Fin (L + 1) → Kind) → (Fin L → Labels α) → ℝ) + (hw : ∀ τ x, 0 ≤ w τ x) : + (∑ x : CompatiblePaths α (L := L) a, + w (fun t => classify (layerLabels a x.1 t)) x.1) ≤ + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths α a τ, w τ x.1 := by + rw [sum_compatiblePaths_pairingWeight] + exact Finset.sum_le_sum (fun τ _ => sum_exactPaths_le_sum_relaxedPaths a τ (w τ) (hw τ)) + +end Problem335.Pairings + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PairingShifts.lean b/lean/OAI/Algebra/DepthFive/PairingShifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a7b6c2241fa8fe397e65987364f5cbdfea950f4 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PairingShifts.lean @@ -0,0 +1,103 @@ +import OAI.Algebra.DepthFive.Pairings + +namespace OAI + +namespace Problem335.Pairings + +open scoped BigOperators + +noncomputable section + +/-- A signed coordinate in every layer, as used by the mixed IMM operator. -/ +def layerShift {ι α : Type*} [Fintype ι] + (sign : ι → ℤ) (coordinate : ι → α) : (ι × α) →₀ ℤ := + ∑ i, Finsupp.single (i, coordinate i) (sign i) + +@[simp] +theorem layerShift_apply {ι α : Type*} [Fintype ι] [DecidableEq α] + (sign : ι → ℤ) (coordinate : ι → α) (i : ι) (a : α) : + layerShift sign coordinate (i, a) = if coordinate i = a then sign i else 0 := by + classical + simp [layerShift, Finsupp.single_apply, Prod.mk.injEq, ite_and] + +/-- Nonzero signed layer coordinates determine the entire coordinate sequence. -/ +theorem layerShift_injective {ι α : Type*} [Fintype ι] + (sign : ι → ℤ) (hsign : ∀ i, sign i ≠ 0) : + Function.Injective (layerShift (α := α) sign) := by + classical + intro x y h + funext i + by_contra hxy + have hi := congrArg (fun z : (ι × α) →₀ ℤ => z (i, x i)) h + simp [layerShift_apply, Ne.symm hxy, hsign i] at hi + +/-- A common nonzero signed coefficient does not change the pairing classification. -/ +theorem weighted_coordinate_difference_eq_iff {α : Type*} + (z : ℤ) (hz : z ≠ 0) (p q r s : α) : + (Finsupp.single p z - Finsupp.single q z = + Finsupp.single r z - Finsupp.single s z) ↔ + (p = q ∧ r = s) ∨ (p = r ∧ q = s) := by + have hs (a : α) : Finsupp.single a z = z • Finsupp.single a (1 : ℤ) := by + simp + rw [hs p, hs q, hs r, hs s, ← smul_sub, ← smul_sub, + smul_right_inj hz, coordinate_difference_eq_iff] + +/-- Restrict a finitely supported coordinate vector to one matrix layer. -/ +def layerProjection {ι α : Type*} (i : ι) : ((ι × α) →₀ ℤ) →+ (α →₀ ℤ) := + Finsupp.comapDomain.addMonoidHom (f := fun a : α => (i, a)) + (fun _ _ h => congrArg Prod.snd h) + +@[simp] +theorem layerProjection_layerShift {ι α : Type*} [Fintype ι] + (sign : ι → ℤ) (coordinate : ι → α) (i : ι) : + layerProjection i (layerShift sign coordinate) = + Finsupp.single (coordinate i) (sign i) := by + classical + ext a + simp [layerProjection, Finsupp.comapDomain.addMonoidHom, + Finsupp.comapDomain_apply, Finsupp.single_apply] + +/-- The four-shift compatibility condition holds independently in every layer. -/ +theorem layerShift_difference_eq_iff {ι α : Type*} [Fintype ι] + (sign : ι → ℤ) (hsign : ∀ i, sign i ≠ 0) (p q r s : ι → α) : + (layerShift sign p - layerShift sign q = layerShift sign r - layerShift sign s) ↔ + ∀ i, (p i = q i ∧ r i = s i) ∨ (p i = r i ∧ q i = s i) := by + classical + constructor + · intro h i + apply (weighted_coordinate_difference_eq_iff (sign i) (hsign i) _ _ _ _).mp + have hi := congrArg (layerProjection (α := α) i) h + simpa only [map_sub, layerProjection_layerShift] using hi + · intro h + ext ⟨i, a⟩ + rcases h i with ⟨hpq, hrs⟩ | ⟨hpr, hqs⟩ + · simp [layerShift_apply, hpq, hrs] + · simp [layerShift_apply, hpr, hqs] + +/-- Edges of a path with at least one edge. -/ +def edgeCoordinates {α : Type*} {L : ℕ} (P : Fin (L + 2) → α) + (i : Fin (L + 1)) : α × α := + (P i.castSucc, P i.succ) + +/-- The coordinates in all layers determine all vertices of the path. -/ +theorem edgeCoordinates_injective {α : Type*} {L : ℕ} : + Function.Injective (edgeCoordinates (α := α) (L := L)) := by + intro P Q h + funext i + refine Fin.cases ?_ (fun j => ?_) i + · have hzero := congrArg (fun f : Fin (L + 1) → α × α => (f 0).1) h + simpa [edgeCoordinates] using hzero + · have hj := congrArg (fun f : Fin (L + 1) → α × α => (f j).2) h + simpa [edgeCoordinates] using hj + +/-- Distinct paths produce distinct signed shifts, regardless of the V/U schedule. -/ +theorem pathShift_injective {α : Type*} {L : ℕ} + (sign : Fin (L + 1) → ℤ) (hsign : ∀ i, sign i ≠ 0) : + Function.Injective (fun P : Fin (L + 2) → α => + layerShift sign (edgeCoordinates P)) := + (layerShift_injective sign hsign).comp edgeCoordinates_injective + +end +end Problem335.Pairings + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PairingSourceAverage.lean b/lean/OAI/Algebra/DepthFive/PairingSourceAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbb8ce3f61144563eb6ad8871aa0516bdda74d1d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PairingSourceAverage.lean @@ -0,0 +1,83 @@ +import OAI.Algebra.DepthFive.BidegreeLocalProductAverage +import OAI.Algebra.DepthFive.PairingOccupationAverage +import OAI.Algebra.DepthFive.PairingAverageCardinality + +namespace OAI + +/-! The canonical finite source sum enters the normalized relaxed pairing bound +with exactly one source dimension and no assumed occupation estimate. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335.MomentPairing +open Pairings + +variable {γ : Type*} [Fintype γ] [DecidableEq γ] {L : ℕ} + +theorem bidegree_source_average_eq_occupationPathMean + (side : Fin (L + 1) → Bool) (a b : ℕ) + [Fintype {d : (Fin (L + 1) × (γ × γ)) →₀ ℕ // + Finsupp.weight (bidegreeWeight (fun v => side v.1)) d = (a, b)}] + (endpoint : γ) (x : Fin L → Labels γ) : + (∑ d : {d : (Fin (L + 1) × (γ × γ)) →₀ ℕ // + Finsupp.weight (bidegreeWeight (fun v => side v.1)) d = (a, b)}, + ∏ t, LocalMoments.localPolynomial (side t) (fun y => d.val (t, y)) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) / + (Fintype.card {d : (Fin (L + 1) × (γ × γ)) →₀ ℕ // + Finsupp.weight (bidegreeWeight (fun v => side v.1)) d = (a, b)} : ℝ) = + occupationPathMean side a b endpoint x := by + exact bidegree_average_eq_partitionCompositionMean + (fun v : Fin (L + 1) × (γ × γ) => side v.1) a b + (fun M => ∏ t, LocalMoments.localPolynomial (side t) (fun y => M (t, y)) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) + +/-- Concrete source reindexing, finite occupation comparison, normalization, +and relaxation. In particular, the source cardinality occurs only once. -/ +theorem sum_bidegree_source_local_moments_le + (side : Fin (L + 1) → Bool) + [Nonempty {v : Fin (L + 1) × (γ × γ) // side v.1 = true}] + [Nonempty {v : Fin (L + 1) × (γ × γ) // ¬ side v.1 = true}] + (a b : ℕ) (ha : 0 < a) + [Fintype {d : (Fin (L + 1) × (γ × γ)) →₀ ℕ // + Finsupp.weight (bidegreeWeight (fun v => side v.1)) d = (a, b)}] + (endpoint : γ) : + (∑ d : {d : (Fin (L + 1) × (γ × γ)) →₀ ℕ // + Finsupp.weight (bidegreeWeight (fun v => side v.1)) d = (a, b)}, + ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + ∏ t, LocalMoments.localPolynomial (side t) (fun y => d.val (t, y)) + (layerLabels endpoint x.1 t).p (layerLabels endpoint x.1 t).q + (layerLabels endpoint x.1 t).r) ≤ + (Fintype.card {d : (Fin (L + 1) × (γ × γ)) →₀ ℕ // + Finsupp.weight (bidegreeWeight (fun v => side v.1)) d = (a, b)} : ℝ) * + pathMean side (layerMeanV γ side a) (layerMeanU γ side b) ^ 2 * + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight side + (layerMeanV γ side a / (layerMeanV γ side a + 1)) + (layerMeanU γ side b / (layerMeanU γ side b + 1)) endpoint τ x.1 := by + have hA : 0 < layerMeanV γ side a := by + unfold layerMeanV + exact div_pos (by exact_mod_cast ha) (by exact_mod_cast Fintype.card_pos) + have hB : 0 ≤ layerMeanU γ side b := by + unfold layerMeanU + positivity + apply sum_sources_local_moments_le_of_average + (ι := {d : (Fin (L + 1) × (γ × γ)) →₀ ℕ // + Finsupp.weight (bidegreeWeight (fun v => side v.1)) d = (a, b)}) + side hA hB endpoint + (fun d x => ∏ t, LocalMoments.localPolynomial (side t) (fun y => d.val (t, y)) + (layerLabels endpoint x t).p (layerLabels endpoint x t).q + (layerLabels endpoint x t).r) + intro x hx + have h := LocalMoments.bidegree_average_layered_localProduct_le side a b + Finset.univ (fun t => (layerLabels endpoint x t).p) + (fun t => (layerLabels endpoint x t).q) (fun t => (layerLabels endpoint x t).r) + simpa [layerMeanV, layerMeanU] using h + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PairingWeights.lean b/lean/OAI/Algebra/DepthFive/PairingWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b1364530c1a84af68fe883fec2fdd461b1a6a1d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PairingWeights.lean @@ -0,0 +1,225 @@ +import OAI.Algebra.DepthFive.RelaxedPaths +import OAI.Algebra.DepthFive.IndependentCoordinates + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.Pairings +open IndependentCoordinates + +instance vertexNonempty (α : Type*) [Nonempty α] (τ σ : Kind) : + Nonempty (Vertex α τ σ) := by + obtain ⟨a⟩ := ‹Nonempty α› + refine ⟨⟨⟨a,a,a,a⟩, ?_⟩⟩ + cases τ <;> cases σ <;> simp [Respects] + +/-- Agreement between the two labels of a normal pairing at a vertex. -/ +def vertexPairEq {α : Type*} [DecidableEq α] {τ σ : Kind} + (x : Vertex α τ σ) : ℝ := if x.1.p = x.1.r then 1 else 0 + +theorem average_vertexPairEq (α : Type*) [Fintype α] [DecidableEq α] [Nonempty α] + (τ σ : Kind) : + average (vertexPairEq (α := α) (τ := τ) (σ := σ)) = + if τ = .normal ∧ σ = .normal then (Fintype.card α : ℝ)⁻¹ else 1 := by + cases τ <;> cases σ + · change average (fun x : Vertex α .normal .normal => + pairEq (normalVertexEquiv α x)) = (Fintype.card α : ℝ)⁻¹ + exact (average_equiv (normalVertexEquiv α) pairEq).trans (average_pair_eq (α := α)) + · have h : vertexPairEq (α := α) (τ := .normal) (σ := .diagonal) = fun _ => (1 : ℝ) := by + funext x + simp [vertexPairEq, x.property.2.1] + simp [h, average_const] + · have h : vertexPairEq (α := α) (τ := .diagonal) (σ := .normal) = fun _ => (1 : ℝ) := by + funext x + simp [vertexPairEq, x.property.1.1] + simp [h, average_const] + · have h : vertexPairEq (α := α) (τ := .diagonal) (σ := .diagonal) = fun _ => (1 : ℝ) := by + funext x + simp [vertexPairEq, x.property.1.1] + simp [h, average_const] + +/-- Number of endpoints at which both adjacent pairing types are normal. -/ +def normalEndpointCount {L : ℕ} (τ : Fin (L + 1) → Kind) + (s : Finset (Fin L)) : ℕ := + (s.filter (fun v => τ v.castSucc = .normal ∧ τ v.succ = .normal)).card + +/-- Equality of both normal coordinates at all indicated internal endpoints. -/ +def endpointCoincidence {α : Type*} [DecidableEq α] {L : ℕ} + {τ : Fin (L + 1) → Kind} (s : Finset (Fin L)) (x : Assignments α τ) : ℝ := + ∏ v : s, vertexPairEq (x v) + +theorem average_endpoint_group (α : Type*) [Fintype α] [DecidableEq α] [Nonempty α] + {L : ℕ} (τ : Fin (L + 1) → Kind) (s : Finset (Fin L)) : + average (fun x : ∀ v : s, Vertex α (τ v.val.castSucc) (τ v.val.succ) => + ∏ v, vertexPairEq (x v)) = + (Fintype.card α : ℝ)⁻¹ ^ normalEndpointCount τ s := by + rw [average_prod] + simp_rw [average_vertexPairEq] + rw [Finset.prod_coe_sort s (fun v : Fin L => + if τ v.castSucc = .normal ∧ τ v.succ = .normal then + (Fintype.card α : ℝ)⁻¹ else 1), ← Finset.prod_filter] + simp [normalEndpointCount] + +theorem average_endpoint_correction (α : Type*) [Fintype α] [DecidableEq α] + [Nonempty α] {L : ℕ} (τ : Fin (L + 1) → Kind) (s : Finset (Fin L)) (c : ℝ) : + average (fun x : ∀ v : s, Vertex α (τ v.val.castSucc) (τ v.val.succ) => + 1 + c * ∏ v, vertexPairEq (x v)) = + 1 + c * (Fintype.card α : ℝ)⁻¹ ^ normalEndpointCount τ s := by + rw [average_add, average_const, average_const_mul, average_endpoint_group] + +/-- Exact average of normal-layer corrections for disjoint endpoint sets in +actual relaxed vertex assignments, including forced-equality interfaces. -/ +theorem average_assignment_corrections (α : Type*) [Fintype α] [DecidableEq α] + [Nonempty α] {L : ℕ} (τ : Fin (L + 1) → Kind) + {ι : Type*} [Fintype ι] [DecidableEq ι] + (s : ι → Finset (Fin L)) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) + (c : ι → ℝ) : + average (fun x : Assignments α τ => ∏ i, (1 + c i * endpointCoincidence (s i) x)) = + ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ normalEndpointCount τ (s i)) := by + change average (fun x : Assignments α τ => + ∏ i, (1 + c i * ∏ v : s i, vertexPairEq (x v))) = _ + have h := average_disjoint_finset_prod_dependent + (β := fun v : Fin L => Vertex α (τ v.castSucc) (τ v.succ)) s hs + (fun i (x : ∀ v : s i, Vertex α (τ v.val.castSucc) (τ v.val.succ)) => + 1 + c i * ∏ v, vertexPairEq (x v)) + apply h.trans + apply Finset.prod_congr rfl + intro i _ + exact average_endpoint_correction α τ (s i) (c i) + +/-- The weighted relaxed-assignment count: its unweighted count times the +product of the independent normal-layer correction averages. -/ +theorem sum_assignment_corrections (α : Type*) [Fintype α] [DecidableEq α] + [Nonempty α] {L : ℕ} (τ : Fin (L + 1) → Kind) + {ι : Type*} [Fintype ι] [DecidableEq ι] + (s : ι → Finset (Fin L)) (hs : Pairwise (fun i j => Disjoint (s i) (s j))) + (c : ι → ℝ) : + (∑ x : Assignments α τ, ∏ i, (1 + c i * endpointCoincidence (s i) x)) = + (Fintype.card α : ℝ) ^ (2 * L - adjacentSwitches τ) * + ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ normalEndpointCount τ (s i)) := by + have h := average_assignment_corrections α τ s hs c + rw [average] at h + have hc : (Fintype.card (Assignments α τ) : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + have hsum := (div_eq_iff hc).mp h + rw [card_assignments, Nat.cast_pow] at hsum + simpa only [mul_comm] using hsum + +/-- The internal vertices adjacent to a specified layer. -/ +def internalEndpointSet {L : ℕ} (t : Fin (L + 1)) : Finset (Fin L) := + Finset.univ.filter (fun v => v.castSucc = t ∨ v.succ = t) + +/-- Distinct nonadjacent layers use disjoint internal vertex coordinates. -/ +theorem internalEndpointSet_disjoint {L : ℕ} {i j : Fin (L + 1)} + (hij : i ≠ j) (hforward : i.val + 1 ≠ j.val) + (hbackward : j.val + 1 ≠ i.val) : + Disjoint (internalEndpointSet i) (internalEndpointSet j) := by + apply Finset.disjoint_left.mpr + intro v hv hw + simp only [internalEndpointSet, Finset.mem_filter, Finset.mem_univ, + true_and] at hv hw + rcases hv with hv | hv <;> rcases hw with hw | hw + all_goals + have hv' := congrArg Fin.val hv + have hw' := congrArg Fin.val hw + simp only [Fin.val_castSucc, Fin.val_succ] at hv' hw' + omega + +/-- An injective family of pairwise nonadjacent layers meets the exact +independence hypothesis of `sum_relaxedPaths_layer_corrections`. -/ +theorem pairwise_internalEndpointSet_disjoint {L : ℕ} {ι : Type*} + (t : ι → Fin (L + 1)) (ht : Function.Injective t) + (hseparated : ∀ i j, i ≠ j → (t i).val + 1 ≠ (t j).val) : + Pairwise (fun i j => Disjoint (internalEndpointSet (t i)) + (internalEndpointSet (t j))) := by + intro i j hij + exact internalEndpointSet_disjoint (fun h => hij (ht h)) + (hseparated i j hij) (hseparated j i hij.symm) + +theorem layer_coordinate_eq_iff {α : Type*} {L : ℕ} + (a : α) (x : Fin L → Labels α) (t : Fin (L + 1)) : + (zipLabels (closePaths a x t.castSucc) (closePaths a x t.succ)).p = + (zipLabels (closePaths a x t.castSucc) (closePaths a x t.succ)).r ↔ + ∀ v ∈ internalEndpointSet t, (x v).p = (x v).r := by + simp only [zipLabels, Prod.mk.injEq] + constructor + · intro h v hv + rcases (Finset.mem_filter.mp hv).2 with hv | hv + · subst t + simpa only [closePaths_internal] using h.2 + · subst t + simpa only [Fin.castSucc_succ, closePaths_internal] using h.1 + · intro h + constructor + · have hleft : ∀ t : Fin (L + 1), + (∀ v ∈ internalEndpointSet t, (x v).p = (x v).r) → + (closePaths a x t.castSucc).p = (closePaths a x t.castSucc).r := by + intro t + refine Fin.cases ?_ (fun i => ?_) t + · intro _ + rfl + · intro hi + simpa only [Fin.castSucc_succ, closePaths_internal] using + hi i (by simp [internalEndpointSet]) + exact hleft t h + · have hright : ∀ t : Fin (L + 1), + (∀ v ∈ internalEndpointSet t, (x v).p = (x v).r) → + (closePaths a x t.succ).p = (closePaths a x t.succ).r := by + intro t + refine Fin.lastCases ?_ (fun i => ?_) t + · intro _ + simp [Fin.succ_last, closePaths_last, constantLabels] + · intro hi + simpa only [closePaths_internal] using + hi i (by simp [internalEndpointSet]) + exact hright t h + +/-- The product of endpoint indicators is exactly the full layer-coordinate +coincidence indicator, including either fixed external endpoint. -/ +theorem endpointCoincidence_eq_layer_indicator {α : Type*} [DecidableEq α] + {L : ℕ} (a : α) (τ : Fin (L + 1) → Kind) (x : Assignments α τ) + (t : Fin (L + 1)) : + endpointCoincidence (internalEndpointSet t) x = + if (zipLabels (closePaths a (fun v => (x v).val) t.castSucc) + (closePaths a (fun v => (x v).val) t.succ)).p = + (zipLabels (closePaths a (fun v => (x v).val) t.castSucc) + (closePaths a (fun v => (x v).val) t.succ)).r then 1 else 0 := by + simp only [endpointCoincidence, vertexPairEq, Fintype.prod_boole, + layer_coordinate_eq_iff, Subtype.forall] + +/-- Exact weighted count in terms of the actual layer coordinates of relaxed +endpoint-fixed path quadruples. The sole combinatorial hypothesis is that the +selected layers have disjoint internal endpoint sets. -/ +theorem sum_relaxedPaths_layer_corrections (α : Type*) [Fintype α] + [DecidableEq α] [Nonempty α] {L : ℕ} (a : α) (τ : Fin (L + 1) → Kind) + {ι : Type*} [Fintype ι] [DecidableEq ι] + (t : ι → Fin (L + 1)) + (ht : Pairwise (fun i j => Disjoint (internalEndpointSet (t i)) + (internalEndpointSet (t j)))) (c : ι → ℝ) : + (∑ x : RelaxedPaths α a τ, ∏ i, + (1 + c i * if + (zipLabels (closePaths a x.val (t i).castSucc) + (closePaths a x.val (t i).succ)).p = + (zipLabels (closePaths a x.val (t i).castSucc) + (closePaths a x.val (t i).succ)).r then 1 else 0)) = + (Fintype.card α : ℝ) ^ (2 * L - adjacentSwitches τ) * + ∏ i, (1 + c i * (Fintype.card α : ℝ)⁻¹ ^ + normalEndpointCount τ (internalEndpointSet (t i))) := by + calc + _ = ∑ x : Assignments α τ, ∏ i, + (1 + c i * endpointCoincidence (internalEndpointSet (t i)) x) := by + apply Fintype.sum_equiv (relaxedPathsEquivAssignments α a τ) + intro x + apply Finset.prod_congr rfl + intro i _ + rw [endpointCoincidence_eq_layer_indicator a τ] + rfl + _ = _ := sum_assignment_corrections α τ (fun i => internalEndpointSet (t i)) ht c + +end Problem335.Pairings + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/Pairings.lean b/lean/OAI/Algebra/DepthFive/Pairings.lean new file mode 100644 index 0000000000000000000000000000000000000000..74f1f7885142d400faef9ddb800cf248e9dfe420 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/Pairings.lean @@ -0,0 +1,231 @@ +import Mathlib + +namespace OAI + +/-! Four-path pairing identities for the mixed-operator moment argument. -/ + +namespace Problem335 +namespace Pairings + +open scoped BigOperators + +/-- Equality of differences of coordinate vectors has only the two pairing patterns. -/ +theorem coordinate_difference_eq_iff {α : Type*} (p q r s : α) : + (Finsupp.single p (1 : ℤ) - Finsupp.single q 1 = + Finsupp.single r 1 - Finsupp.single s 1) ↔ + (p = q ∧ r = s) ∨ (p = r ∧ q = s) := by + classical + constructor + · intro h + by_cases hpq : p = q + · left + refine ⟨hpq, ?_⟩ + by_contra hrs + have hr := congrArg (fun f : α →₀ ℤ => f r) h + simp [hpq, hrs] at hr + · right + have hpr : p = r := by + by_contra hpr + have hp := congrArg (fun f : α →₀ ℤ => f p) h + simp only [Finsupp.sub_apply, Finsupp.single_apply] at hp + split_ifs at hp <;> simp_all + refine ⟨hpr, ?_⟩ + by_contra hqs + have hq := congrArg (fun f : α →₀ ℤ => f q) h + simp only [Finsupp.sub_apply, Finsupp.single_apply] at hq + split_ifs at hq <;> simp_all + · rintro (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) <;> simp + +/-- The two cases become disjoint when the all-equal case is assigned to normal pairing. -/ +theorem coordinate_difference_eq_iff_exclusive {α : Type*} (p q r s : α) : + (Finsupp.single p (1 : ℤ) - Finsupp.single q 1 = + Finsupp.single r 1 - Finsupp.single s 1) ↔ + (p = q ∧ r = s) ∨ (p = r ∧ q = s ∧ p ≠ q) := by + rw [coordinate_difference_eq_iff] + constructor + · rintro (h | ⟨hpr, hqs⟩) + · exact Or.inl h + · by_cases hpq : p = q + · exact Or.inl ⟨hpq, by simpa [← hpr, ← hqs] using hpq⟩ + · exact Or.inr ⟨hpr, hqs, hpq⟩ + · rintro (h | ⟨hpr, hqs, _⟩) + · exact Or.inl h + · exact Or.inr ⟨hpr, hqs⟩ + +/-- Pairing patterns at a layer, with the inequality omitted in the diagonal case. -/ +inductive Kind where + | normal + | diagonal + deriving DecidableEq + +protected abbrev Kind.enumList : List Kind := [.normal, .diagonal] + +protected theorem Kind.enumList_getElem?_ctorIdx_eq (kind : Kind) : + Kind.enumList[kind.ctorIdx]? = some kind := by + cases kind <;> rfl + +protected theorem Kind.enumList_nodup : Kind.enumList.Nodup := by decide + +instance : Fintype Kind where + elems := ⟨Kind.enumList, Multiset.coe_nodup.mpr Kind.enumList_nodup⟩ + complete kind := List.mem_iff_getElem?.mpr + ⟨kind.ctorIdx, Kind.enumList_getElem?_ctorIdx_eq kind⟩ + +/-- Boolean words use false for the normal pairing and true for the diagonal pairing. -/ +def boolKindEquiv : Bool ≃ Kind where + toFun b := if b then .diagonal else .normal + invFun + | .normal => false + | .diagonal => true + left_inv b := by cases b <;> rfl + right_inv k := by cases k <;> rfl + +@[simp] theorem boolKindEquiv_false : boolKindEquiv false = Kind.normal := rfl +@[simp] theorem boolKindEquiv_true : boolKindEquiv true = Kind.diagonal := rfl + +/-- The four labels contributed by the four paths at a single vertex. -/ +@[ext] +structure Labels (α : Type*) where + p : α + q : α + r : α + s : α + deriving Fintype + +def Respects {α : Type*} : Kind → Labels α → Prop + | .normal, x => x.p = x.q ∧ x.r = x.s + | .diagonal, x => x.p = x.r ∧ x.q = x.s + +instance {α : Type*} [DecidableEq α] (τ : Kind) (x : Labels α) : + Decidable (Respects τ x) := by + cases τ <;> unfold Respects <;> infer_instance + +/-- The exact (disjoint) pairing classes before relaxing the diagonal inequality. -/ +def ExactRespects {α : Type*} : Kind → Labels α → Prop + | .normal, x => x.p = x.q ∧ x.r = x.s + | .diagonal, x => x.p = x.r ∧ x.q = x.s ∧ x.p ≠ x.q + +theorem ExactRespects.respects {α : Type*} {τ : Kind} {x : Labels α} + (h : ExactRespects τ x) : Respects τ x := by + cases τ + · exact h + · exact ⟨h.1, h.2.1⟩ + +/-- No compatible coordinate quadruple belongs to both exact pairing classes. -/ +theorem exactRespects_unique {α : Type*} {τ σ : Kind} {x : Labels α} + (hτ : ExactRespects τ x) (hσ : ExactRespects σ x) : τ = σ := by + cases τ <;> cases σ <;> simp_all [ExactRespects] + +/-- Every compatible coordinate quadruple has a unique exact pairing type. -/ +theorem coordinate_difference_eq_iff_existsUnique {α : Type*} (x : Labels α) : + (Finsupp.single x.p (1 : ℤ) - Finsupp.single x.q 1 = + Finsupp.single x.r 1 - Finsupp.single x.s 1) ↔ + ∃! τ : Kind, ExactRespects τ x := by + rw [coordinate_difference_eq_iff_exclusive] + constructor + · rintro (h | h) + · exact ⟨.normal, h, fun _ hk => exactRespects_unique hk h⟩ + · exact ⟨.diagonal, h, fun _ hk => exactRespects_unique hk h⟩ + · rintro ⟨τ, h, _⟩ + cases τ + · exact Or.inl h + · exact Or.inr h + +/-- Labels allowed by both adjacent layers. -/ +abbrev Vertex (α : Type*) (τ σ : Kind) := + {x : Labels α // Respects τ x ∧ Respects σ x} + +def normalVertexEquiv (α : Type*) : Vertex α .normal .normal ≃ α × α where + toFun x := (x.1.p, x.1.r) + invFun x := ⟨⟨x.1, x.1, x.2, x.2⟩, ⟨⟨rfl, rfl⟩, ⟨rfl, rfl⟩⟩⟩ + left_inv x := by + have hp := x.2 + apply Subtype.ext + apply Labels.ext <;> simp_all [Respects] + right_inv x := by cases x; rfl + +def diagonalVertexEquiv (α : Type*) : Vertex α .diagonal .diagonal ≃ α × α where + toFun x := (x.1.p, x.1.q) + invFun x := ⟨⟨x.1, x.2, x.1, x.2⟩, ⟨⟨rfl, rfl⟩, ⟨rfl, rfl⟩⟩⟩ + left_inv x := by + have hp := x.2 + apply Subtype.ext + apply Labels.ext <;> simp_all [Respects] + right_inv x := by cases x; rfl + +def mixedVertexEquiv (α : Type*) : Vertex α .normal .diagonal ≃ α where + toFun x := x.1.p + invFun x := ⟨⟨x, x, x, x⟩, ⟨⟨rfl, rfl⟩, ⟨rfl, rfl⟩⟩⟩ + left_inv x := by + have hp := x.2 + apply Subtype.ext + apply Labels.ext <;> simp_all [Respects] + right_inv x := rfl + +def swapVertexEquiv (α : Type*) (τ σ : Kind) : Vertex α τ σ ≃ Vertex α σ τ where + toFun x := ⟨x.1, x.2.symm⟩ + invFun x := ⟨x.1, x.2.symm⟩ + left_inv _ := rfl + right_inv _ := rfl + +/-- Equal pairings give two independent labels; different pairings give one. -/ +theorem card_vertex (α : Type*) [Fintype α] [DecidableEq α] (τ σ : Kind) : + Fintype.card (Vertex α τ σ) = + Fintype.card α ^ (if τ = σ then 2 else 1) := by + cases τ <;> cases σ + · simpa [pow_two] using Fintype.card_congr (normalVertexEquiv α) + · simpa using Fintype.card_congr (mixedVertexEquiv α) + · simpa using Fintype.card_congr + ((swapVertexEquiv α .diagonal .normal).trans (mixedVertexEquiv α)) + · simpa [pow_two] using Fintype.card_congr (diagonalVertexEquiv α) + +/-- Number of interfaces at which a word changes its letter. -/ +def adjacentSwitches {β : Type*} [DecidableEq β] {L : ℕ} + (τ : Fin (L + 1) → β) : ℕ := + (Finset.univ.filter (fun i : Fin L => τ i.castSucc ≠ τ i.succ)).card + +/-- Relabeling letters injectively preserves the number of switches. -/ +theorem adjacentSwitches_comp_injective {β γ : Type*} [DecidableEq β] [DecidableEq γ] + {L : ℕ} (τ : Fin (L + 1) → β) (f : β → γ) (hf : Function.Injective f) : + adjacentSwitches (fun i => f (τ i)) = adjacentSwitches τ := by + unfold adjacentSwitches + congr 1 + apply Finset.filter_congr + intro i _ + exact not_congr hf.eq_iff + +/-- Each unchanged interface has two free labels, and each changed interface has one. -/ +theorem free_label_exponent {β : Type*} [DecidableEq β] {L : ℕ} + (τ : Fin (L + 1) → β) : + (∑ i : Fin L, if τ i.castSucc = τ i.succ then 2 else 1) = + 2 * L - adjacentSwitches τ := by + have h : (∑ i : Fin L, if τ i.castSucc = τ i.succ then 2 else 1) + + adjacentSwitches τ = 2 * L := by + rw [adjacentSwitches, Finset.card_eq_sum_ones, Finset.sum_filter, + ← Finset.sum_add_distrib] + calc + _ = ∑ _i : Fin L, 2 := by + apply Finset.sum_congr rfl + intro i _ + split_ifs <;> simp_all + _ = 2 * L := by simp [Nat.mul_comm] + omega + +/-- The relaxed four-path assignments factor as a product over internal vertices. -/ +abbrev Assignments (α : Type*) {L : ℕ} (τ : Fin (L + 1) → Kind) := + (i : Fin L) → Vertex α (τ i.castSucc) (τ i.succ) + +/-- Exact unweighted count of relaxed assignments for a fixed pairing word. -/ +theorem card_assignments (α : Type*) [Fintype α] [DecidableEq α] + {L : ℕ} (τ : Fin (L + 1) → Kind) : + Fintype.card (Assignments α τ) = + Fintype.card α ^ (2 * L - adjacentSwitches τ) := by + unfold Assignments + rw [Fintype.card_pi] + simp_rw [card_vertex] + rw [Finset.prod_pow_eq_pow_sum, free_label_exponent] + +end Pairings +end Problem335 + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ParameterBounds.lean b/lean/OAI/Algebra/DepthFive/ParameterBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fbde9f32244741ff2b947547e7a393d2ab2d370 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ParameterBounds.lean @@ -0,0 +1,123 @@ +import OAI.Algebra.DepthFive.AnalyticParameters +import OAI.Algebra.DepthFive.FractionRounding +import OAI.Algebra.DepthFive.PowerPerturbation + +namespace OAI + +/-! Assembly of the numerical inequalities for the actual rank parameters. -/ +noncomputable section +namespace Problem335.LowerParameters + +theorem n_le_a0 {n : ℕ} (hn : 4 ≤ n) : (n : ℝ) ≤ a0 n := by + have hk : (1 : ℝ) ≤ k n := by exact_mod_cast k_pos hn + calc + (n : ℝ) ≤ (k n : ℝ) * (n : ℝ) := by nlinarith + _ ≤ a0 n := k_mul_n_le_a0 hn + +theorem n_le_b0 {n : ℕ} (hn : 4 ≤ n) : (n : ℝ) ≤ b0 n := + ((n_le_a0 hn).trans (a0_le_a n)).trans (a_le_b0 hn) + +theorem alpha_le_inv_sqrt_mul_exp {n : ℕ} (hn : 4 ≤ n) : + alpha n ≤ (Real.sqrt (n : ℝ))⁻¹ * Real.exp (1 / (n : ℝ)) := by + have hs := sqrt_ge_two hn + have hv : (0 : ℝ) < v n := by exact_mod_cast v_pos hn + have hn' : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) + have hraw : alpha n ≤ (Real.sqrt (n : ℝ))⁻¹ * + Real.exp ((Real.sqrt (n : ℝ) - 1) / (v n : ℝ)) := by + simpa [alpha, a, a0, one_div] using + (fraction_natCeil_inverse_bounds (by linarith : 1 < Real.sqrt (n : ℝ)) hv).2 + have herr : (Real.sqrt (n : ℝ) - 1) / (v n : ℝ) ≤ 1 / (n : ℝ) := by + have h := one_div_le_one_div_of_le hn' (n_le_a0 hn) + simpa [a0, one_div_div] using h + exact hraw.trans (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr herr) + (by positivity)) + +theorem alpha_le_rpow_mul_exp {n : ℕ} (hn : 4 ≤ n) : + alpha n ≤ (n : ℝ) ^ (-(1 / 2 : ℝ)) * Real.exp (1 / (n : ℝ)) := by + rw [Real.rpow_neg (by positivity), ← Real.sqrt_eq_rpow] + exact alpha_le_inv_sqrt_mul_exp hn + +theorem beta_le_rpow_mul_exp {n : ℕ} (hn : 4 ≤ n) : + beta n ≤ (alpha n) ^ (rho n) * Real.exp (1 / (n : ℝ)) := by + have hu : (0 : ℝ) < u n := by exact_mod_cast u_pos hn + have hn' : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) + have hraw : beta n ≤ (alpha n) ^ (rho n) * + Real.exp ((1 - (alpha n) ^ (rho n)) / ((u n : ℝ) * (alpha n) ^ (rho n))) := by + simpa [beta, b, b0] using (fraction_natCeil_target_bounds + (alpha_rpow_rho_pos hn) (alpha_rpow_rho_lt_one hn) hu).2 + have herr : (1 - (alpha n) ^ (rho n)) / ((u n : ℝ) * (alpha n) ^ (rho n)) ≤ + 1 / (n : ℝ) := by + have h := one_div_le_one_div_of_le hn' (n_le_b0 hn) + simpa [b0, one_div_div] using h + exact hraw.trans (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr herr) + (alpha_rpow_rho_pos hn).le) + +theorem one_sub_rho_le_two_div_sqrt {n : ℕ} (hn : 4 ≤ n) : + 1 - rho n ≤ 2 / Real.sqrt (n : ℝ) := by + have hm : (0 : ℝ) < m n := by exact_mod_cast m_pos hn + have hs := sqrt_ge_two hn + have hsn := s_le_sqrt n + have hsq := Real.sq_sqrt (show (0 : ℝ) ≤ n by positivity) + have hnm : (n : ℝ) ≤ 2 * (m n : ℝ) := by exact_mod_cast n_le_two_mul_m n + rw [one_sub_rho hn] + apply (div_le_div_iff₀ hm (by linarith)).mpr + nlinarith [mul_le_mul_of_nonneg_right hsn (Real.sqrt_nonneg (n : ℝ))] + +theorem one_sub_rho_le_four_div_sqrt {n : ℕ} (hn : 4 ≤ n) : + 1 - rho n ≤ 4 / Real.sqrt (n : ℝ) := by + exact (one_sub_rho_le_two_div_sqrt hn).trans + (div_le_div_of_nonneg_right (by norm_num) (Real.sqrt_nonneg _)) + +theorem eventually_q_beta_le_two_div_sqrt : + ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → + q n ≤ 2 / Real.sqrt (n : ℝ) ∧ beta n ≤ 2 / Real.sqrt (n : ℝ) := by + obtain ⟨n₀, h⟩ := PowerPerturbation.eventually_q_beta_bounds + refine ⟨max n₀ 4, fun n hn => ?_⟩ + have hn4 : 4 ≤ n := (le_max_right _ _).trans hn + exact h n ((le_max_left _ _).trans hn) (alpha n) (rho n) (beta n) + (alpha_pos hn4) (alpha_le_rpow_mul_exp hn4) + (rho_pos hn4).le (rho_lt_one hn4).le + (one_sub_rho_le_four_div_sqrt hn4) (beta_le_rpow_mul_exp hn4) + +/-- The explicit inequalities from the parameter lemma that are consumed by +both circuit-rank and moment estimates. All are asserted for the same `n`. -/ +structure Admissible (n : ℕ) : Prop where + n_ge_sixteen : 16 ≤ n + s_lower : Real.sqrt (n : ℝ) / 2 ≤ (s n : ℝ) + s_upper : (s n : ℝ) ≤ Real.sqrt (n : ℝ) + lambda_lower : (3 : ℝ) / 8 ≤ lambda n + rho_positive : 0 < rho n + rho_lt_one : rho n < 1 + a_ge_k : k n ≤ a n + a_ge_four_n : 4 * n ≤ a n + b_ge_four_n : 4 * n ≤ b n + alpha_positive : 0 < alpha n + alpha_lt_one : alpha n < 1 + alpha_lower : (Real.sqrt (n : ℝ))⁻¹ ≤ alpha n + alpha_inverse_upper : (alpha n)⁻¹ ≤ Real.sqrt (n : ℝ) + beta_lower : (alpha n) ^ (rho n) ≤ beta n + beta_upper : beta n ≤ 2 / Real.sqrt (n : ℝ) + q_lower : (Real.sqrt (n : ℝ))⁻¹ ≤ q n + q_upper : q n ≤ 2 / Real.sqrt (n : ℝ) + sqrt_upper_power : 2 / Real.sqrt (n : ℝ) ≤ (n : ℝ) ^ (-(2 / 5 : ℝ)) + sqrt_upper_half : 2 / Real.sqrt (n : ℝ) ≤ 1 / 2 + +theorem eventually_admissible : ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → Admissible n := by + obtain ⟨n₁, h₁⟩ := eventually_q_beta_le_two_div_sqrt + obtain ⟨n₂, h₂⟩ := PowerPerturbation.eventually_inverse_sqrt_bounds + refine ⟨max (max n₁ n₂) 16, fun n hn => ?_⟩ + have hn16 : 16 ≤ n := (le_max_right _ _).trans hn + have hn4 : 4 ≤ n := by omega + have hn1 : n₁ ≤ n := (le_max_left n₁ n₂).trans ((le_max_left _ _).trans hn) + have hn2 : n₂ ≤ n := (le_max_right n₁ n₂).trans ((le_max_left _ _).trans hn) + exact ⟨hn16, sqrt_half_le_s hn16, s_le_sqrt n, lambda_ge_three_eighths hn16, + rho_pos hn4, rho_lt_one hn4, k_le_a hn4, four_mul_n_le_a hn16, + four_mul_n_le_b hn16, alpha_pos hn4, alpha_lt_one hn4, inv_sqrt_le_alpha hn4, + inv_alpha_le_sqrt hn4, alpha_rpow_rho_le_beta hn4, (h₁ n hn1).2, + inv_sqrt_le_q hn4, (h₁ n hn1).1, (h₂ n hn2).1, (h₂ n hn2).2⟩ + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ParameterCutoff.lean b/lean/OAI/Algebra/DepthFive/ParameterCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd716478c2b148fb0f6de0fb38d1b2484ee4cc02 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ParameterCutoff.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.DepthFive.ParameterBounds + +namespace OAI + +/-! The real cutoff separating the two circuit-factor cases. -/ +noncomputable section +namespace Problem335.LowerParameters + +def cutoff (n : ℕ) : ℝ := (n : ℝ) / (4 * (s n : ℝ)) + +theorem cutoff_pos {n : ℕ} (hn : 4 ≤ n) : 0 < cutoff n := by + have hs : (0 : ℝ) < s n := by exact_mod_cast s_pos hn + have hn' : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) + unfold cutoff + positivity + +theorem sqrt_quarter_le_cutoff {n : ℕ} (hn : 4 ≤ n) : + Real.sqrt (n : ℝ) / 4 ≤ cutoff n := by + have hs : (0 : ℝ) < s n := by exact_mod_cast s_pos hn + have hsn := s_le_sqrt n + have hsq := Real.sq_sqrt (show (0 : ℝ) ≤ n by positivity) + unfold cutoff + apply (le_div_iff₀ (by positivity)).mpr + nlinarith [mul_le_mul_of_nonneg_left hsn (Real.sqrt_nonneg (n : ℝ))] + +theorem cutoff_le_sqrt_half {n : ℕ} (hn : 16 ≤ n) : + cutoff n ≤ Real.sqrt (n : ℝ) / 2 := by + have hs : (0 : ℝ) < s n := by exact_mod_cast s_pos (show 4 ≤ n by omega) + have hsn := sqrt_half_le_s hn + have hsq := Real.sq_sqrt (show (0 : ℝ) ≤ n by positivity) + unfold cutoff + apply (div_le_iff₀ (by positivity)).mpr + nlinarith [mul_le_mul_of_nonneg_left hsn (Real.sqrt_nonneg (n : ℝ))] + +theorem cutoff_mul_four_s {n : ℕ} (hn : 4 ≤ n) : + cutoff n * (4 * (s n : ℝ)) = (n : ℝ) := by + have hs : (0 : ℝ) < s n := by exact_mod_cast s_pos hn + exact div_mul_cancel₀ _ (by positivity) + +theorem n_div_cutoff {n : ℕ} (hn : 4 ≤ n) : + (n : ℝ) / cutoff n = 4 * (s n : ℝ) := by + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (show n ≠ 0 by omega) + unfold cutoff + field_simp + +theorem two_lt_cutoff {n : ℕ} (hn : 256 ≤ n) : 2 < cutoff n := by + have hs : 16 ≤ Real.sqrt (n : ℝ) := by + apply (Real.le_sqrt (by norm_num) (by positivity)).mpr + exact_mod_cast hn + have h := sqrt_quarter_le_cutoff (show 4 ≤ n by omega) + linarith + +theorem low_degree_scaled_lt_quarter {n : ℕ} (hn : 4 ≤ n) {e : ℝ} + (he : e < cutoff n) : (s n : ℝ) * e / (n : ℝ) < 1 / 4 := by + have hs : (0 : ℝ) < s n := by exact_mod_cast s_pos hn + have hn' : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) + have h := (lt_div_iff₀ (show 0 < 4 * (s n : ℝ) by positivity)).mp he + apply (div_lt_iff₀ hn').mpr + nlinarith + +theorem Admissible.q_le_power {n : ℕ} (h : Admissible n) : + q n ≤ (n : ℝ) ^ (-(2 / 5 : ℝ)) := h.q_upper.trans h.sqrt_upper_power + +theorem Admissible.q_le_half {n : ℕ} (h : Admissible n) : q n ≤ 1 / 2 := + h.q_upper.trans h.sqrt_upper_half + +theorem Admissible.beta_le_half {n : ℕ} (h : Admissible n) : beta n ≤ 1 / 2 := + h.beta_upper.trans h.sqrt_upper_half + +theorem eventually_admissible_cutoff : + ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → Admissible n ∧ 2 < cutoff n := by + obtain ⟨n₀, h⟩ := eventually_admissible + refine ⟨max n₀ 256, fun n hn => ?_⟩ + exact ⟨h n ((le_max_left _ _).trans hn), two_lt_cutoff ((le_max_right _ _).trans hn)⟩ + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ParameterGrowth.lean b/lean/OAI/Algebra/DepthFive/ParameterGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..972f823958a7a5c019973de20039e400af3c4611 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ParameterGrowth.lean @@ -0,0 +1,37 @@ +import OAI.Algebra.DepthFive.OccupationParameterBounds +import OAI.Algebra.DepthFive.ParameterBounds + +namespace OAI + +noncomputable section +namespace Problem335.LowerParameters + +/-- The actual multiplication order, without an extra conditional parameter hypothesis, +has the growth asserted in the rank-method parameter lemma. -/ +theorem b_isTheta : + Asymptotics.IsTheta Filter.atTop (fun n : ℕ => (b n : ℝ)) + (fun n : ℕ => (n : ℝ) ^ 2 * Real.sqrt (n : ℝ)) := by + apply b_isTheta_of_eventually_beta_bound + obtain ⟨N, hN⟩ := eventually_q_beta_le_two_div_sqrt + filter_upwards [Filter.eventually_ge_atTop N] with n hn + exact (hN n hn).2 + +/-- Simultaneous explicit growth bounds for the two rounded orders. -/ +theorem eventually_order_growth_bounds : + ∃ N : ℕ, ∀ n : ℕ, N ≤ n → + (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) / 4 ≤ (a n : ℝ) ∧ + (a n : ℝ) ≤ 3 * (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) ∧ + (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) / 4 ≤ (b n : ℝ) ∧ + (b n : ℝ) ≤ 4 * (n : ℝ) ^ 2 * Real.sqrt (n : ℝ) := by + obtain ⟨N, hN⟩ := eventually_q_beta_le_two_div_sqrt + refine ⟨max N 16, fun n hn => ?_⟩ + have hn16 : 16 ≤ n := (le_max_right _ _).trans hn + have hnN : N ≤ n := (le_max_left _ _).trans hn + exact ⟨a_scale_lower hn16, a_scale_upper hn16, b_scale_lower hn16, + b_scale_upper_of_beta_bound hn16 (hN n hnN).2⟩ + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PathInjectivity.lean b/lean/OAI/Algebra/DepthFive/PathInjectivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..114175726d164ac21e4d98ac3f285bc742aa8e7d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PathInjectivity.lean @@ -0,0 +1,298 @@ +import OAI.Algebra.DepthFive.MatrixPaths + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ ι : Type*} + +/-- The recursive path enumeration never repeats a path. -/ +private theorem matrixEntryPaths_nodup_local [Fintype ι] [DecidableEq ι] + (labels : List σ) (i j : ι) : (matrixEntryPaths labels i j).Nodup := by + induction labels generalizing i with + | nil => by_cases hij : i = j <;> simp [matrixEntryPaths, hij] + | cons t ts ih => + cases ts with + | nil => simp [matrixEntryPaths] + | cons u us => + rw [matrixEntryPaths, List.nodup_flatMap] + constructor + · intro k hk + apply List.Nodup.map + · intro p q hpq + exact List.cons.inj hpq |>.2 + · exact ih k + · apply List.Pairwise.imp _ (Finset.nodup_toList (Finset.univ : Finset ι)) + intro k l hkl + apply List.disjoint_iff_ne.mpr + intro p hp q hq hpq + obtain ⟨rp, _, rfl⟩ := List.mem_map.mp hp + obtain ⟨rq, _, rfl⟩ := List.mem_map.mp hq + exact hkl (congrArg (fun e : σ × ι × ι => e.2.2) (List.cons.inj hpq).1) + +/-- Differentiated coordinates have sign -1, multiplied coordinates sign +1. -/ +def edgeListShift (side : σ → Bool) : List (σ × ι × ι) → ((σ × ι × ι) →₀ ℤ) + | [] => 0 + | e :: p => Finsupp.single e (if side e.1 then -1 else 1) + edgeListShift side p + +@[simp] theorem edgeListShift_nil (side : σ → Bool) : + edgeListShift (ι := ι) side [] = 0 := rfl + +@[simp] theorem edgeListShift_cons (side : σ → Bool) (e : σ × ι × ι) + (p : List (σ × ι × ι)) : + edgeListShift side (e :: p) = + Finsupp.single e (if side e.1 then -1 else 1) + edgeListShift side p := rfl + +/-- A layer absent from a path has no coordinate shift. -/ +theorem edgeListShift_apply_eq_zero (side : σ → Bool) (p : List (σ × ι × ι)) + (e : σ × ι × ι) (he : e.1 ∉ p.map Prod.fst) : edgeListShift side p e = 0 := by + classical + induction p with + | nil => simp + | cons a p ih => + simp only [List.map_cons, List.mem_cons, not_or] at he + have hae : a ≠ e := by + intro h + apply he.1 + exact congrArg Prod.fst h.symm + simp [edgeListShift, hae, ih he.2] + +/-- A coordinate absent from the edge list receives no shift. -/ +theorem edgeListShift_apply_of_not_mem (side : σ → Bool) (p : List (σ × ι × ι)) + (e : σ × ι × ι) (he : e ∉ p) : edgeListShift side p e = 0 := by + classical + induction p with + | nil => simp + | cons a p ih => + simp only [List.mem_cons, not_or] at he + simp [edgeListShift, Ne.symm he.1, ih he.2] + +/-- With a fixed nonrepeating layer list, the signed shift determines the whole path. -/ +theorem edgeListShift_injective_of_labels (side : σ → Bool) + (labels : List σ) (hlabels : labels.Nodup) + (p q : List (σ × ι × ι)) (hp : p.map Prod.fst = labels) + (hq : q.map Prod.fst = labels) (hshift : edgeListShift side p = edgeListShift side q) : + p = q := by + classical + induction labels generalizing p q with + | nil => + have hp0 : p = [] := List.map_eq_nil_iff.mp hp + have hq0 : q = [] := List.map_eq_nil_iff.mp hq + simp [hp0, hq0] + | cons t ts ih => + cases p with + | nil => simp at hp + | cons a p => + cases q with + | nil => simp at hq + | cons b q => + simp only [List.map_cons, List.cons.injEq] at hp hq + have ha : a.1 ∉ ts := by simpa [hp.1] using (List.nodup_cons.mp hlabels).1 + have hpa := edgeListShift_apply_eq_zero side p a (by simpa [hp.2] using ha) + have hqa := edgeListShift_apply_eq_zero side q a (by simpa [hq.2] using ha) + have heval := congrArg (fun f : (σ × ι × ι) →₀ ℤ => f a) hshift + have hba : b = a := by + by_contra hba + simp only [edgeListShift_cons, Finsupp.add_apply, Finsupp.single_apply, + ite_eq_right hba, hpa, hqa, add_zero] at heval + cases hside : side a.1 <;> simp [hside] at heval + subst b + have htail : edgeListShift side p = edgeListShift side q := add_left_cancel hshift + exact congrArg (List.cons a) (ih hlabels.of_cons p q hp.2 hq.2 htail) + +/-- A selected coordinate occurs with its single creation/annihilation sign. -/ +theorem edgeListShift_apply_of_mem (side : σ → Bool) (p : List (σ × ι × ι)) + (hlabels : (p.map Prod.fst).Nodup) (e : σ × ι × ι) (he : e ∈ p) : + edgeListShift side p e = if side e.1 then -1 else 1 := by + classical + induction p with + | nil => simp at he + | cons a p ih => + have hnd := List.nodup_cons.mp hlabels + rcases List.mem_cons.mp he with hae | hep + · subst e + have hz := edgeListShift_apply_eq_zero side p a hnd.1 + simp [edgeListShift, hz] + · have hae : a ≠ e := by + intro h + subst a + exact hnd.1 (List.mem_map.mpr ⟨e, hep, rfl⟩) + simp [edgeListShift, hae, ih hnd.2 hep] + +/-- With one edge per layer, coordinate shifts are precisely signed membership. -/ +theorem edgeListShift_apply [DecidableEq σ] [DecidableEq ι] (side : σ → Bool) (p : List (σ × ι × ι)) + (hlabels : (p.map Prod.fst).Nodup) (e : σ × ι × ι) : + edgeListShift side p e = if e ∈ p then (if side e.1 then -1 else 1) else 0 := by + classical + by_cases he : e ∈ p + · rw [ite_eq_left he] + exact edgeListShift_apply_of_mem side p hlabels e he + · rw [ite_eq_right he] + exact edgeListShift_apply_of_not_mem side p e he + +/-- Finite path indices are distinguished by their signed exponent shifts. -/ +theorem matrixEntryPaths_shift_injective [Fintype ι] [DecidableEq ι] + (side : σ → Bool) (labels : List σ) (hlabels : labels.Nodup) (i j : ι) : + Function.Injective (fun p : Fin (matrixEntryPaths labels i j).length => + edgeListShift side ((matrixEntryPaths labels i j).get p)) := by + intro p q hpq + apply (matrixEntryPaths_nodup_local labels i j).get_inj_iff.mp + exact edgeListShift_injective_of_labels side labels hlabels _ _ + (matrixEntryPaths_get_labels labels i j p) + (matrixEntryPaths_get_labels labels i j q) hpq + +/-- From any fixed input exponent, two distinct paths reach distinct output exponents. -/ +theorem matrixEntryPaths_translated_shift_injective [Fintype ι] [DecidableEq ι] + (side : σ → Bool) (labels : List σ) (hlabels : labels.Nodup) (i j : ι) + (input : (σ × ι × ι) →₀ ℤ) : + Function.Injective (fun p : Fin (matrixEntryPaths labels i j).length => + input + edgeListShift side ((matrixEntryPaths labels i j).get p)) := by + intro p q hpq + exact matrixEntryPaths_shift_injective side labels hlabels i j + (add_left_cancel hpq) + +/-- The signed list shift is the sum of the individual signed coordinates. -/ +theorem edgeListShift_eq_sum (side : σ → Bool) (p : List (σ × ι × ι)) : + edgeListShift side p = + (p.map (fun e => Finsupp.single e (if side e.1 then (-1 : ℤ) else 1))).sum := by + induction p with + | nil => rfl + | cons e p ih => simp [edgeListShift, ih] + +/-- A list containing all layer labels in order has the expected length. -/ +theorem edgeList_length {n : ℕ} (p : List (Fin n × ι × ι)) + (hp : p.map Prod.fst = List.finRange n) : p.length = n := by + simpa using congrArg List.length hp + +/-- Convert an edge list ordered by layer into its finite coordinate profile. -/ +def edgeProfile {n : ℕ} (p : List (Fin n × ι × ι)) + (hp : p.map Prod.fst = List.finRange n) (t : Fin n) : ι × ι := + (p[t.val]'(by rw [edgeList_length p hp]; exact t.isLt)).2 + +/-- In an ordered edge list, the edge in position `t` is labelled by `t`. -/ +theorem edgeProfile_label {n : ℕ} (p : List (Fin n × ι × ι)) + (hp : p.map Prod.fst = List.finRange n) (t : Fin n) : + (p[t.val]'(by rw [edgeList_length p hp]; exact t.isLt)).1 = t := by + have hidx : t.val < (p.map Prod.fst).length := by + simp only [List.length_map, edgeList_length p hp] + exact t.isLt + have h : (p.map Prod.fst)[t.val]'hidx = t := by simp [hp] + simpa only [List.getElem_map] using h + +/-- Rebuilding the ordered edge list from its profile changes nothing. -/ +theorem edgeList_eq_ofFn_profile {n : ℕ} (p : List (Fin n × ι × ι)) + (hp : p.map Prod.fst = List.finRange n) : + p = List.ofFn (fun t : Fin n => (t, edgeProfile p hp t)) := by + apply List.ext_getElem (by simp [edgeList_length p hp]) + intro k hk hk' + have hkn : k < n := by simpa using hk' + simp only [List.getElem_ofFn] + exact Prod.ext (edgeProfile_label p hp ⟨k, hkn⟩) rfl + +/-- The list shift agrees with the layerwise finite sum used by profile operators. -/ +theorem edgeListShift_eq_sum_profile {n : ℕ} (side : Fin n → Bool) + (p : List (Fin n × ι × ι)) (hp : p.map Prod.fst = List.finRange n) : + edgeListShift side p = ∑ t : Fin n, + Finsupp.single (t, edgeProfile p hp t) (if side t then (-1 : ℤ) else 1) := by + rw [edgeListShift_eq_sum] + conv_lhs => rw [edgeList_eq_ofFn_profile p hp, List.map_ofFn, Fin.sum_ofFn] + rfl + +/-- Ordered edge-list indices have distinct layer profiles. -/ +theorem matrixEntryPaths_profile_injective [Fintype ι] [DecidableEq ι] + (n : ℕ) (i j : ι) : + Function.Injective (fun p : Fin (matrixEntryPaths (List.finRange n) i j).length => + edgeProfile ((matrixEntryPaths (List.finRange n) i j).get p) + (matrixEntryPaths_get_labels (List.finRange n) i j p)) := by + intro p q hpq + dsimp only at hpq + apply (matrixEntryPaths_nodup_local (List.finRange n) i j).get_inj_iff.mp + rw [edgeList_eq_ofFn_profile _ (matrixEntryPaths_get_labels (List.finRange n) i j p), + edgeList_eq_ofFn_profile _ (matrixEntryPaths_get_labels (List.finRange n) i j q)] + rw [hpq] + +/-- The signed output is nonnegative exactly when every requested derivative is available. -/ +theorem edgeListShift_nonnegative_iff [DecidableEq σ] [DecidableEq ι] + (side : σ → Bool) (p : List (σ × ι × ι)) + (hlabels : (p.map Prod.fst).Nodup) (input : (σ × ι × ι) → ℕ) : + (∀ e, 0 ≤ (input e : ℤ) + edgeListShift side p e) ↔ + ∀ e ∈ p, side e.1 = true → 1 ≤ input e := by + constructor + · intro h e he hs + have hnonneg := h e + rw [edgeListShift_apply side p hlabels e, ite_eq_left he] at hnonneg + simp only [hs, ite_true] at hnonneg + omega + · intro h e + rw [edgeListShift_apply side p hlabels e] + by_cases he : e ∈ p + · rw [ite_eq_left he] + cases hs : side e.1 with + | false => simp only [Bool.false_eq_true, ite_false]; omega + | true => + have hi := h e he hs + simp only [ite_true] + omega + · simp [he] + +/-- Read a signed edge-list shift using its unique coordinate profile in one layer. -/ +theorem edgeListShift_apply_profile [DecidableEq ι] {n : ℕ} + (side : Fin n → Bool) (p : List (Fin n × ι × ι)) + (hp : p.map Prod.fst = List.finRange n) (t : Fin n) (a b : ι) : + edgeListShift side p (t, a, b) = + if edgeProfile p hp t = (a, b) then (if side t then -1 else 1) else 0 := by + classical + rw [edgeListShift_eq_sum_profile side p hp, Finsupp.finsetSum_apply, + Finset.sum_eq_single t] + · simp [Finsupp.single_apply] + · intro j hj hjt + simp [hjt] + · simp + +/-- Four ordered edge lists have compatible global shifts exactly when their +coordinate differences agree separately in every layer. -/ +theorem edgeListShift_sub_eq_iff {n : ℕ} (side : Fin n → Bool) + (p q r s : List (Fin n × ι × ι)) + (hp : p.map Prod.fst = List.finRange n) + (hq : q.map Prod.fst = List.finRange n) + (hr : r.map Prod.fst = List.finRange n) + (hs : s.map Prod.fst = List.finRange n) : + edgeListShift side p - edgeListShift side q = + edgeListShift side r - edgeListShift side s ↔ + ∀ t : Fin n, + Finsupp.single (edgeProfile p hp t) (1 : ℤ) - + Finsupp.single (edgeProfile q hq t) 1 = + Finsupp.single (edgeProfile r hr t) 1 - + Finsupp.single (edgeProfile s hs t) 1 := by + classical + have hsign (t : Fin n) : (if side t then (-1 : ℤ) else 1) ≠ 0 := by + cases h : side t <;> simp + constructor + · intro heq t + ext ab + rcases ab with ⟨a, b⟩ + have h := congrArg (fun f : (Fin n × ι × ι) →₀ ℤ => f (t, a, b)) heq + simp only [Finsupp.sub_apply, edgeListShift_apply_profile side p hp, + edgeListShift_apply_profile side q hq, edgeListShift_apply_profile side r hr, + edgeListShift_apply_profile side s hs] at h + apply mul_left_cancel₀ (hsign t) + simpa only [Finsupp.sub_apply, Finsupp.single_apply, mul_sub, mul_ite, + mul_one, mul_zero] using h + · intro heq + ext tab + rcases tab with ⟨t, a, b⟩ + have h := congrArg (fun f : (ι × ι) →₀ ℤ => + (if side t then (-1 : ℤ) else 1) * f (a, b)) (heq t) + simpa only [Finsupp.sub_apply, edgeListShift_apply_profile side p hp, + edgeListShift_apply_profile side q hq, edgeListShift_apply_profile side r hr, + edgeListShift_apply_profile side s hs, Finsupp.single_apply, + mul_sub, mul_ite, mul_one, mul_zero] using h + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PathIsolatedWeight.lean b/lean/OAI/Algebra/DepthFive/PathIsolatedWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f747d1c0b228be5a918c1052a34f4ec6712eb4e --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PathIsolatedWeight.lean @@ -0,0 +1,93 @@ +import OAI.Algebra.DepthFive.IsolatedWeight +import OAI.Algebra.DepthFive.WordSwitches + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.PathIsolatedWeight + +/-- Adjacent positions of the path, in either orientation. -/ +def adjacent {n : ℕ} (i j : Fin (n + 1)) : Prop := + i.val + 1 = j.val ∨ j.val + 1 = i.val + +/-- Interior selected positions are exactly those eligible for the two-switch flip. -/ +def interior {n : ℕ} (V : Finset (Fin (n + 1))) : Finset (Fin (n + 1)) := + V.filter fun i => 0 < i.val ∧ i.val < n + +theorem interior_subset {n : ℕ} (V : Finset (Fin (n + 1))) : interior V ⊆ V := + Finset.filter_subset _ _ + +theorem pathEdges_adjacent (n : ℕ) : + ∀ e ∈ SwitchRestoration.pathEdges n, adjacent e.1 e.2 ∧ adjacent e.2 e.1 := by + intro e he + obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp he + constructor + · exact Or.inl rfl + · exact Or.inr rfl + +theorem independent_of_no_adjacent {n : ℕ} (V : Finset (Fin (n + 1))) + (hV : ∀ i : Fin n, ¬ (i.castSucc ∈ V ∧ i.succ ∈ V)) : + ∀ i ∈ V, ∀ j, adjacent i j → j ∉ V := by + intro i hi j hij hj + rcases hij with hij | hji + · let t : Fin n := ⟨i.val, by have := j.isLt; omega⟩ + have ht : t.castSucc = i := by apply Fin.ext; rfl + have ht' : t.succ = j := by apply Fin.ext; exact hij + exact hV t ⟨ht.symm ▸ hi, ht'.symm ▸ hj⟩ + · let t : Fin n := ⟨j.val, by have := i.isLt; omega⟩ + have ht : t.castSucc = j := by apply Fin.ext; rfl + have ht' : t.succ = i := by apply Fin.ext; exact hji + exact hV t ⟨ht.symm ▸ hj, ht'.symm ▸ hi⟩ + +theorem endpointDegree_interior {n : ℕ} (V : Finset (Fin (n + 1))) : + ∀ i ∈ interior V, SwitchRestoration.endpointDegree (SwitchRestoration.pathEdges n) i = 2 := by + intro i hi + exact SwitchRestoration.endpointDegree_pathEdges_interior i + (Finset.mem_filter.mp hi).2.1 (Finset.mem_filter.mp hi).2.2 + +theorem exceptional_subset_first {n : ℕ} (V : Finset (Fin (n + 1))) + (hlast : Fin.last n ∉ V) : V \ interior V ⊆ {0} := by + intro i hi + obtain ⟨hiV, hiS⟩ := Finset.mem_sdiff.mp hi + have hn : i.val ≠ n := by + intro h + have he : i = Fin.last n := Fin.ext h + exact hlast (he ▸ hiV) + have hz : i.val = 0 := by + by_contra h + apply hiS + exact Finset.mem_filter.mpr ⟨hiV, by have := i.isLt; omega⟩ + simp only [Finset.mem_singleton] + exact Fin.ext hz + +theorem exceptional_card_le_one {n : ℕ} (V : Finset (Fin (n + 1))) + (hlast : Fin.last n ∉ V) : (V \ interior V).card ≤ 1 := by + simpa using Finset.card_le_card (exceptional_subset_first V hlast) + +theorem switchCount_eq_wordSwitches {n : ℕ} (w : Fin (n + 1) → Bool) : + SwitchRestoration.switchCount (SwitchRestoration.pathEdges n) w = + (WordSwitches.switches w).card := by + rw [SwitchRestoration.switchCount_pathEdges] + simp only [WordSwitches.switches, Finset.card_filter] + +/-- Correction removal for the concrete path: all graph hypotheses are discharged. -/ +theorem sum_weight_le_uniform {n : ℕ} (V : Finset (Fin (n + 1))) + (hV : ∀ i : Fin n, ¬ (i.castSucc ∈ V ∧ i.succ ∈ V)) + (hlast : Fin.last n ∉ V) + {A B x : ℝ} (hA : 1 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (hx1 : x ≤ 1) : + (∑ w : Fin (n + 1) → Bool, + IsolatedWeight.weight (SwitchRestoration.pathEdges n) V adjacent A B x w) ≤ + (1 + 2 * x ^ 2) ^ V.card * (1 + A) * (1 + A * x) ^ V.card * + ∑ w : Fin (n + 1) → Bool, + IsolatedWeight.baseWeight (SwitchRestoration.pathEdges n) V A B x w := by + exact IsolatedWeight.sum_weight_le_uniform_uncorrected + (interior_subset V) (independent_of_no_adjacent V hV) (pathEdges_adjacent n) + (endpointDegree_interior V) (exceptional_card_le_one V hlast) hA hB hx hx1 + +end Problem335.PathIsolatedWeight + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PathMassLowerBound.lean b/lean/OAI/Algebra/DepthFive/PathMassLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0f893b564115f7c58b79f8b320477914779bf04 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PathMassLowerBound.lean @@ -0,0 +1,104 @@ +import OAI.Algebra.DepthFive.CompositionAntidiag +import OAI.Algebra.DepthFive.PathOccupationGroups + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +open BidegreeAverages + +/-- Boolean-fiber form of the occupation lower estimate. -/ +theorem bidegree_first_moment_lower_bool {σ : Type*} [Fintype σ] [DecidableEq σ] + (side : σ → Bool) (a b : ℕ) [Fintype (Index side a b)] + [Nonempty {x // side x = true}] [Nonempty {x // side x = false}] + (s : Finset {x // side x = true}) (z : Finset {x // side x = false}) + (ha : 0 < a) (hb : 0 < b) (hs : 2 * s.card ≤ a) (hz : 2 * z.card ≤ b) : + Real.exp ((-(s.card : ℝ) ^ 2 / a - + (s.card : ℝ) ^ 2 / (2 * Fintype.card {x // side x = true})) + + (-(z.card : ℝ) ^ 2 / b - + (z.card : ℝ) ^ 2 / (2 * Fintype.card {x // side x = false}))) * + (((a : ℝ) / Fintype.card {x // side x = true}) ^ s.card * + (1 + (b : ℝ) / Fintype.card {x // side x = false}) ^ z.card) ≤ + (∑ d : Index side a b, + (∏ i ∈ s, (d.val i : ℝ)) * (∏ i ∈ z, ((d.val i : ℝ) + 1))) / + (Fintype.card (Index side a b) : ℝ) := by + let : Nonempty {x // ¬ side x = true} := by + simpa only [Bool.not_eq_true] using + (inferInstance : Nonempty {x // side x = false}) + let e : {x // ¬ side x = true} ≃ {x // side x = false} := + Equiv.subtypeEquivRight (fun x => by simp) + have hcard : Fintype.card {x // ¬ side x = true} = + Fintype.card {x // side x = false} := Fintype.card_congr e + have h := BidegreeAverages.bidegree_first_moment_lower side a b + s (z.map e.symm.toEmbedding) ha hb hs (by simpa using hz) + simpa only [Finset.card_map, hcard, Finset.prod_map, + Equiv.coe_toEmbedding, Equiv.subtypeEquivRight_symm_apply, e] using h + +/-- Each squarefree Fock path has large average squared amplitude over the +actual bidegree source. No independence of coordinates within a group is assumed. -/ +theorem path_source_mass_lower {σ : Type*} [Fintype σ] [DecidableEq σ] + (side : σ → Bool) (a b : ℕ) [Fintype (Index side a b)] + [Nonempty {x // side x = true}] [Nonempty {x // side x = false}] + (p : List σ) (hp : p.Nodup) (ha : 0 < a) (hb : 0 < b) + (hs : 2 * (selectedPathCoordinates side p true).card ≤ a) + (hz : 2 * (selectedPathCoordinates side p false).card ≤ b) : + Real.exp ((-((selectedPathCoordinates side p true).card : ℝ) ^ 2 / a - + ((selectedPathCoordinates side p true).card : ℝ) ^ 2 / + (2 * Fintype.card {x // side x = true})) + + (-((selectedPathCoordinates side p false).card : ℝ) ^ 2 / b - + ((selectedPathCoordinates side p false).card : ℝ) ^ 2 / + (2 * Fintype.card {x // side x = false}))) * + (((a : ℝ) / Fintype.card {x // side x = true}) ^ + (selectedPathCoordinates side p true).card * + (1 + (b : ℝ) / Fintype.card {x // side x = false}) ^ + (selectedPathCoordinates side p false).card) ≤ + (∑ d : Index side a b, + ((p.map (occupationAmplitude side d.val)).prod) ^ 2) / + (Fintype.card (Index side a b) : ℝ) := by + simpa only [pathAmplitude_sq_split side p hp] using + bidegree_first_moment_lower_bool side a b + (selectedPathCoordinates side p true) (selectedPathCoordinates side p false) + ha hb hs hz + +/-- Concrete IMM per-path first moment. The loss and geometric benchmark depend +only on the selected layer counts, not on the chosen path. -/ +theorem immPath_source_mass_lower (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (a b : ℕ) + [Fintype (Index (fun x : Fin n × Fin n × Fin n => side x.1) a b)] + [Nonempty {x : Fin n × Fin n × Fin n // side x.1 = true}] + [Nonempty {x : Fin n × Fin n × Fin n // side x.1 = false}] + (p : List (Fin n × Fin n × Fin n)) (hp : p ∈ immPaths n hn) + (ha : 0 < a) (hb : 0 < b) + (hs : 2 * (Finset.univ.filter (fun t : Fin n => side t = true)).card ≤ a) + (hz : 2 * (Finset.univ.filter (fun t : Fin n => side t = false)).card ≤ b) : + Real.exp ((-((Finset.univ.filter (fun t : Fin n => side t = true)).card : ℝ) ^ 2 / a - + ((Finset.univ.filter (fun t : Fin n => side t = true)).card : ℝ) ^ 2 / + (2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true})) + + (-((Finset.univ.filter (fun t : Fin n => side t = false)).card : ℝ) ^ 2 / b - + ((Finset.univ.filter (fun t : Fin n => side t = false)).card : ℝ) ^ 2 / + (2 * Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false}))) * + (((a : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true}) ^ + (Finset.univ.filter (fun t : Fin n => side t = true)).card * + (1 + (b : ℝ) / Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false}) ^ + (Finset.univ.filter (fun t : Fin n => side t = false)).card) ≤ + (∑ d : Index (fun x : Fin n × Fin n × Fin n => side x.1) a b, + ((p.map (occupationAmplitude (fun x => side x.1) d.val)).prod) ^ 2) / + (Fintype.card (Index (fun x : Fin n × Fin n × Fin n => side x.1) a b) : ℝ) := by + have hs' : 2 * (selectedPathCoordinates (fun x : Fin n × Fin n × Fin n => side x.1) + p true).card ≤ a := by + rwa [immPath_selectedCoordinates_card n hn side p hp true] + have hz' : 2 * (selectedPathCoordinates (fun x : Fin n × Fin n × Fin n => side x.1) + p false).card ≤ b := by + rwa [immPath_selectedCoordinates_card n hn side p hp false] + simpa only [immPath_selectedCoordinates_card n hn side p hp] using + path_source_mass_lower (fun x : Fin n × Fin n × Fin n => side x.1) a b p + (immPaths_nodup n hn p hp) ha hb hs' hz' + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PathMassParameters.lean b/lean/OAI/Algebra/DepthFive/PathMassParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..ffc6b3d8a48b7b6d05d9b94b65550baa8802a445 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PathMassParameters.lean @@ -0,0 +1,103 @@ +import OAI.Algebra.DepthFive.PathMassLowerBound +import OAI.Algebra.DepthFive.OccupationParameterBounds + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +open BidegreeAverages LowerParameters + +/-- A Boolean layer choice includes all square-matrix coordinates in that layer. -/ +theorem card_bool_layer_variables {n : ℕ} (side : Fin n → Bool) (ε : Bool) : + Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = ε} = + (Finset.univ.filter (fun t : Fin n => side t = ε)).card * n ^ 2 := by + simpa only [Finset.mem_filter, Finset.mem_univ, true_and] using + card_layer_variables (Finset.univ.filter (fun t : Fin n => side t = ε)) + +/-- Uniform per-path first-moment estimate at the canonical lower-bound +parameters. Its only partition hypotheses are the two selected layer counts. -/ +theorem immPath_source_mass_lower_parameters {n : ℕ} (hn : 16 ≤ n) + (side : Fin n → Bool) + (hk : (Finset.univ.filter (fun t : Fin n => side t = true)).card = k n) + (hm : (Finset.univ.filter (fun t : Fin n => side t = false)).card = m n) + [Fintype (Index (fun x : Fin n × Fin n × Fin n => side x.1) (a n) (b n))] + (p : List (Fin n × Fin n × Fin n)) + (hp : p ∈ immPaths n (by omega)) : + Real.exp (-64 / Real.sqrt (n : ℝ)) * + (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n) ≤ + (∑ d : Index (fun x : Fin n × Fin n × Fin n => side x.1) (a n) (b n), + ((p.map (occupationAmplitude (fun x => side x.1) d.val)).prod) ^ 2) / + (Fintype.card (Index (fun x : Fin n × Fin n × Fin n => side x.1) + (a n) (b n)) : ℝ) := by + have hn4 : 4 ≤ n := by omega + have hv : Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = true} = v n := by + rw [card_bool_layer_variables, hk] + rfl + have hu : Fintype.card {x : Fin n × Fin n × Fin n // side x.1 = false} = u n := by + rw [card_bool_layer_variables, hm] + rfl + let : Nonempty {x : Fin n × Fin n × Fin n // side x.1 = true} := + Fintype.card_pos_iff.mp (by rw [hv]; exact v_pos hn4) + let : Nonempty {x : Fin n × Fin n × Fin n // side x.1 = false} := + Fintype.card_pos_iff.mp (by rw [hu]; exact u_pos hn4) + have hs : 2 * (Finset.univ.filter (fun t : Fin n => side t = true)).card ≤ a n := by + rw [hk] + have := four_mul_n_le_a hn + have := k_le_n n + omega + have hz : 2 * (Finset.univ.filter (fun t : Fin n => side t = false)).card ≤ b n := by + rw [hm] + have := four_mul_n_le_b hn + have := m_le_n n + omega + have hpath := immPath_source_mass_lower n (by omega) side (a n) (b n) p hp + (a_pos hn4) (b_pos hn4) hs hz + simp only [hk, hm, hv, hu] at hpath + have hkn : (k n : ℝ) ≤ 2 * (n : ℝ) := by + have h : (k n : ℝ) ≤ n := by exact_mod_cast k_le_n n + linarith [Nat.cast_nonneg (α := ℝ) n] + have hmn : (m n : ℝ) ≤ 2 * (n : ℝ) := by + have h : (m n : ℝ) ≤ n := by exact_mod_cast m_le_n n + linarith [Nat.cast_nonneg (α := ℝ) n] + have hloss := occupation_two_orders_loss_le hn + (Nat.cast_nonneg (α := ℝ) (k n)) hkn (Nat.cast_nonneg (α := ℝ) (m n)) hmn + have hexp : Real.exp (-64 / Real.sqrt (n : ℝ)) ≤ + Real.exp ((-(k n : ℝ) ^ 2 / a n - (k n : ℝ) ^ 2 / (2 * (v n : ℝ))) + + (-(m n : ℝ) ^ 2 / b n - (m n : ℝ) ^ 2 / (2 * (u n : ℝ)))) := by + apply Real.exp_le_exp.mpr + simp only [neg_div] at hloss ⊢ + linarith + exact (mul_le_mul_of_nonneg_right hexp (by positivity)).trans hpath + +/-- Unnormalized actual source sum. This form is directly summable over paths +in the first-trace identity, and requires no additional source-nonemptiness premise. -/ +theorem immPath_source_sum_lower_parameters {n : ℕ} (hn : 16 ≤ n) + (side : Fin n → Bool) + (hk : (Finset.univ.filter (fun t : Fin n => side t = true)).card = k n) + (hm : (Finset.univ.filter (fun t : Fin n => side t = false)).card = m n) + [Fintype (Index (fun x : Fin n × Fin n × Fin n => side x.1) (a n) (b n))] + (p : List (Fin n × Fin n × Fin n)) + (hp : p ∈ immPaths n (by omega)) : + (Fintype.card (Index (fun x : Fin n × Fin n × Fin n => side x.1) + (a n) (b n)) : ℝ) * Real.exp (-64 / Real.sqrt (n : ℝ)) * + (((a n : ℝ) / v n) ^ k n * (1 + (b n : ℝ) / u n) ^ m n) ≤ + ∑ d : Index (fun x : Fin n × Fin n × Fin n => side x.1) (a n) (b n), + ((p.map (occupationAmplitude (fun x => side x.1) d.val)).prod) ^ 2 := by + have h := immPath_source_mass_lower_parameters hn side hk hm p hp + by_cases hzero : Fintype.card (Index (fun x : Fin n × Fin n × Fin n => side x.1) + (a n) (b n)) = 0 + · rw [hzero, Nat.cast_zero, zero_mul, zero_mul] + exact Finset.sum_nonneg fun d _ => sq_nonneg _ + · have hpos : (0 : ℝ) < Fintype.card + (Index (fun x : Fin n × Fin n × Fin n => side x.1) (a n) (b n)) := by + exact_mod_cast Nat.pos_of_ne_zero hzero + simpa only [mul_assoc, mul_left_comm, mul_comm] using (le_div_iff₀ hpos).mp h + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PathOccupationAverage.lean b/lean/OAI/Algebra/DepthFive/PathOccupationAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..571363aac3d9583db932f3862b00ab7831b62db7 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PathOccupationAverage.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.DepthFive.PathOccupationGroups +import OAI.Algebra.DepthFive.BidegreeOccupationSum + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Problem335 + +variable {σ : Type*} [Fintype σ] [DecidableEq σ] +variable (side : σ → Bool) (a b : ℕ) +variable + [Fintype {d : σ →₀ ℕ // Finsupp.weight (bidegreeWeight side) d = (a, b)}] + [Fintype {d : {i // side i = true} → ℕ // ∑ i, d i = a}] + [Fintype {d : {i // ¬side i = true} → ℕ // ∑ i, d i = b}] + +/-- Exact source-index sum for a squarefree Fock path, expressed over the +independent derivative and multiplication occupation spaces. -/ +theorem sum_pathAmplitude_sq_split (p : List σ) (hp : p.Nodup) : + (∑ d : {d : σ →₀ ℕ // Finsupp.weight (bidegreeWeight side) d = (a, b)}, + ((p.map (occupationAmplitude side d.val)).prod) ^ 2) = + (∑ d : {d : {i // side i = true} → ℕ // ∑ i, d i = a}, + ∏ i ∈ selectedPathCoordinates side p true, (d.val i : ℝ)) * + (∑ d : {d : {i // ¬side i = true} → ℕ // ∑ i, d i = b}, + ∏ i ∈ complementaryPathCoordinates side p, ((d.val i : ℝ) + 1)) := by + simp_rw [pathAmplitude_sq_split_complement side p hp] + exact sum_bidegree_occupation_products side a b _ _ + +/-- The normalized squared amplitude is the product of the two uniform +squarefree occupation means, including every inactive ambient coordinate. -/ +theorem mean_pathAmplitude_sq_split (p : List σ) (hp : p.Nodup) : + (∑ d : {d : σ →₀ ℕ // Finsupp.weight (bidegreeWeight side) d = (a, b)}, + ((p.map (occupationAmplitude side d.val)).prod) ^ 2) / + Fintype.card {d : σ →₀ ℕ // Finsupp.weight (bidegreeWeight side) d = (a, b)} = + ((∑ d : {d : {i // side i = true} → ℕ // ∑ i, d i = a}, + ∏ i ∈ selectedPathCoordinates side p true, (d.val i : ℝ)) / + Fintype.card {d : {i // side i = true} → ℕ // ∑ i, d i = a}) * + ((∑ d : {d : {i // ¬side i = true} → ℕ // ∑ i, d i = b}, + ∏ i ∈ complementaryPathCoordinates side p, ((d.val i : ℝ) + 1)) / + Fintype.card {d : {i // ¬side i = true} → ℕ // ∑ i, d i = b}) := by + simp_rw [pathAmplitude_sq_split_complement side p hp] + exact mean_bidegree_occupation_products side a b _ _ + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PathOccupationGroups.lean b/lean/OAI/Algebra/DepthFive/PathOccupationGroups.lean new file mode 100644 index 0000000000000000000000000000000000000000..143db2373d7239ccc4405517df0325fcde9b0e45 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PathOccupationGroups.lean @@ -0,0 +1,155 @@ +import OAI.Algebra.DepthFive.FockPaths +import OAI.Algebra.DepthFive.ImmOperatorPaths + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Problem335 + +variable {σ : Type*} [DecidableEq σ] + +/-- Coordinates of one path belonging to a fixed Boolean variable group, +viewed in that group's own coordinate type. -/ +def selectedPathCoordinates (side : σ → Bool) (p : List σ) (b : Bool) : + Finset {x // side x = b} := + p.toFinset.subtype (fun x => side x = b) + +@[simp] theorem mem_selectedPathCoordinates (side : σ → Bool) (p : List σ) + (b : Bool) (x : {x // side x = b}) : + x ∈ selectedPathCoordinates side p b ↔ x.val ∈ p := by + simp [selectedPathCoordinates] + +theorem card_selectedPathCoordinates (side : σ → Bool) (p : List σ) + (hp : p.Nodup) (b : Bool) : + (selectedPathCoordinates side p b).card = + (p.filter (fun x => side x == b)).length := by + rw [selectedPathCoordinates, Finset.card_subtype] + have hf : p.toFinset.filter (fun x => side x = b) = + (p.filter (fun x => side x == b)).toFinset := by + ext x + simp + rw [hf] + exact List.toFinset_card_of_nodup (hp.filter _) + +/-- Partitioning a squarefree path product into its two coordinate groups. -/ +theorem path_product_split {R : Type*} [CommMonoid R] + (side : σ → Bool) (p : List σ) (hp : p.Nodup) (f g : σ → R) : + (p.map (fun x => if side x then f x else g x)).prod = + (∏ x ∈ selectedPathCoordinates side p true, f x.val) * + ∏ x ∈ selectedPathCoordinates side p false, g x.val := by + rw [← List.prod_toFinset _ hp] + simp only [selectedPathCoordinates, Finset.prod_subtype_eq_prod_filter] + rw [← Finset.prod_filter_mul_prod_filter_not p.toFinset + (fun x => side x = true) (fun x => if side x then f x else g x)] + congr 1 + · apply Finset.prod_congr rfl + intro x hx + simp [(Finset.mem_filter.mp hx).2] + · have hf : p.toFinset.filter (fun x => ¬side x = true) = + p.toFinset.filter (fun x => side x = false) := by + ext x + simp + rw [hf] + apply Finset.prod_congr rfl + intro x hx + simp [(Finset.mem_filter.mp hx).2] + +/-- The squared Fock amplitude is exactly the product of the derivative +occupations and successor multiplication occupations, on disjoint group types. -/ +theorem pathAmplitude_sq_split [Fintype σ] (side : σ → Bool) + (p : List σ) (hp : p.Nodup) (d : σ →₀ ℕ) : + ((p.map (occupationAmplitude side d)).prod) ^ 2 = + (∏ x ∈ selectedPathCoordinates side p true, (d x.val : ℝ)) * + ∏ x ∈ selectedPathCoordinates side p false, ((d x.val : ℝ) + 1) := by + rw [pathAmplitude_sq] + exact path_product_split side p hp _ _ + +/-- Selecting coordinates from a path selects exactly the same number as +selecting its layer labels. -/ +theorem card_selectedPathCoordinates_of_labels {ι : Type*} [DecidableEq ι] + (side : σ → Bool) (labels : List σ) (p : List (σ × ι × ι)) + (hlabels : p.map Prod.fst = labels) (hnodup : labels.Nodup) (b : Bool) : + (selectedPathCoordinates (fun x : σ × ι × ι => side x.1) p b).card = + (labels.filter (fun x => side x == b)).length := by + have hp : p.Nodup := List.Nodup.of_map Prod.fst (hlabels ▸ hnodup) + rw [card_selectedPathCoordinates _ _ hp] + rw [← hlabels, List.filter_map, List.length_map] + rfl + +/-- Every actual IMM path selects one coordinate in each selected layer, +including when the ambient layer has inactive endpoint coordinates. -/ +theorem immPath_selectedCoordinates_card (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (p : List (Fin n × Fin n × Fin n)) + (hp : p ∈ immPaths n hn) (b : Bool) : + (selectedPathCoordinates (fun x : Fin n × Fin n × Fin n => side x.1) p b).card = + (Finset.univ.filter (fun t : Fin n => side t = b)).card := by + rw [card_selectedPathCoordinates_of_labels side (List.finRange n) p + (immPaths_labels n hn p hp) (List.nodup_finRange n)] + rw [← List.toFinset_card_of_nodup ((List.nodup_finRange n).filter + (fun x => side x == b))] + congr 1 + ext x + simp + +/-- Concrete IMM first-trace path mass in the two independent occupation groups. -/ +theorem immPathAmplitude_sq_split (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (p : List (Fin n × Fin n × Fin n)) + (hp : p ∈ immPaths n hn) (d : (Fin n × Fin n × Fin n) →₀ ℕ) : + ((p.map (occupationAmplitude (fun x => side x.1) d)).prod) ^ 2 = + (∏ x ∈ selectedPathCoordinates (fun x : Fin n × Fin n × Fin n => side x.1) + p true, (d x.val : ℝ)) * + ∏ x ∈ selectedPathCoordinates (fun x : Fin n × Fin n × Fin n => side x.1) + p false, ((d x.val : ℝ) + 1) := + pathAmplitude_sq_split _ p (immPaths_nodup n hn p hp) d + +/-- Complement-fiber version, aligned with `bidegreeExponentsEquiv`. -/ +def complementaryPathCoordinates (side : σ → Bool) (p : List σ) : + Finset {x // ¬side x = true} := + p.toFinset.subtype (fun x => ¬side x = true) + +@[simp] theorem mem_complementaryPathCoordinates (side : σ → Bool) (p : List σ) + (x : {x // ¬side x = true}) : + x ∈ complementaryPathCoordinates side p ↔ x.val ∈ p := by + simp [complementaryPathCoordinates] + +theorem path_product_split_complement {R : Type*} [CommMonoid R] + (side : σ → Bool) (p : List σ) (hp : p.Nodup) (f g : σ → R) : + (p.map (fun x => if side x then f x else g x)).prod = + (∏ x ∈ selectedPathCoordinates side p true, f x.val) * + ∏ x ∈ complementaryPathCoordinates side p, g x.val := by + rw [← List.prod_toFinset _ hp] + simp only [selectedPathCoordinates, complementaryPathCoordinates, + Finset.prod_subtype_eq_prod_filter] + rw [← Finset.prod_filter_mul_prod_filter_not p.toFinset + (fun x => side x = true) (fun x => if side x then f x else g x)] + congr 1 + · apply Finset.prod_congr rfl + intro x hx + simp [(Finset.mem_filter.mp hx).2] + · apply Finset.prod_congr rfl + intro x hx + simp [(Finset.mem_filter.mp hx).2] + +theorem pathAmplitude_sq_split_complement [Fintype σ] (side : σ → Bool) + (p : List σ) (hp : p.Nodup) (d : σ →₀ ℕ) : + ((p.map (occupationAmplitude side d)).prod) ^ 2 = + (∏ x ∈ selectedPathCoordinates side p true, (d x.val : ℝ)) * + ∏ x ∈ complementaryPathCoordinates side p, ((d x.val : ℝ) + 1) := by + rw [pathAmplitude_sq] + exact path_product_split_complement side p hp _ _ + +theorem immPath_complementaryCoordinates_card (n : ℕ) (hn : 0 < n) + (side : Fin n → Bool) (p : List (Fin n × Fin n × Fin n)) + (hp : p ∈ immPaths n hn) : + (complementaryPathCoordinates (fun x : Fin n × Fin n × Fin n => side x.1) p).card = + (Finset.univ.filter (fun t : Fin n => ¬side t = true)).card := by + simpa only [complementaryPathCoordinates, selectedPathCoordinates, Finset.card_subtype, + Bool.not_eq_true] + using immPath_selectedCoordinates_card n hn side p hp false + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PathShifts.lean b/lean/OAI/Algebra/DepthFive/PathShifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..294929ad89c2048cc5421d845450b8115c6a7a26 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PathShifts.lean @@ -0,0 +1,101 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +/-- The signed occupation shift of a layered path. -/ +def pathShift {α : Type*} {n : ℕ} (sgn : Fin n → ℤ) + (p : Fin (n + 1) → α) : (Fin n × α × α) →₀ ℤ := + ∑ t, Finsupp.single (t, p t.castSucc, p t.succ) (sgn t) + +/-- A coordinate in one layer can only come from that layer. -/ +theorem pathShift_apply {α : Type*} [DecidableEq α] {n : ℕ} (sgn : Fin n → ℤ) + (p : Fin (n + 1) → α) (t : Fin n) (a b : α) : + pathShift sgn p (t, a, b) = + if (p t.castSucc, p t.succ) = (a, b) then sgn t else 0 := by + classical + unfold pathShift + rw [Finsupp.finsetSum_apply, Finset.sum_eq_single t] + · simp [Finsupp.single_apply] + · intro j hj hjt + simp [hjt] + · simp + +/-- Nonzero signed shifts remember every edge of their path. -/ +theorem pathShift_eq_imp_edges_eq {α : Type*} {n : ℕ} + (sgn : Fin n → ℤ) (hs : ∀ t, sgn t ≠ 0) + {p q : Fin (n + 1) → α} (heq : pathShift sgn p = pathShift sgn q) + (t : Fin n) : + (p t.castSucc, p t.succ) = (q t.castSucc, q t.succ) := by + classical + have h := congrArg (fun f => f (t, p t.castSucc, p t.succ)) heq + rw [pathShift_apply, pathShift_apply] at h + simp only [ite_true] at h + split_ifs at h with he + · exact he.symm + · exact False.elim (hs t h) + +/-- Even a zero-length path is determined by its starting vertex and shift. -/ +theorem pathShift_eq_imp_eq_of_start_eq {α : Type*} {n : ℕ} + (sgn : Fin n → ℤ) (hs : ∀ t, sgn t ≠ 0) + {p q : Fin (n + 1) → α} (hstart : p 0 = q 0) + (heq : pathShift sgn p = pathShift sgn q) : p = q := by + funext i + refine Fin.cases hstart (fun j => ?_) i + exact congrArg Prod.snd (pathShift_eq_imp_edges_eq sgn hs heq j) + +/-- For positive length, no endpoint assumption is needed. -/ +theorem pathShift_injective {α : Type*} {n : ℕ} (hn : 0 < n) + (sgn : Fin n → ℤ) (hs : ∀ t, sgn t ≠ 0) : + Function.Injective (pathShift (α := α) sgn) := by + intro p q heq + apply pathShift_eq_imp_eq_of_start_eq sgn hs _ heq + have h := congrArg Prod.fst (pathShift_eq_imp_edges_eq sgn hs heq ⟨0, hn⟩) + simpa using h + +/-- Translating the path shifts by one input occupation does not merge paths. -/ +theorem translated_pathShift_injective {α : Type*} {n : ℕ} (hn : 0 < n) + (sgn : Fin n → ℤ) (hs : ∀ t, sgn t ≠ 0) + (input : (Fin n × α × α) →₀ ℤ) : + Function.Injective (fun p : Fin (n + 1) → α => input + pathShift sgn p) := by + intro p q heq + exact pathShift_injective hn sgn hs (add_left_cancel heq) + +/-- Global compatibility of four path shifts is exactly compatibility in + each layer separately. The nonzero signs cancel, so the local condition + is independent of whether that layer differentiates or multiplies. -/ +theorem pathShift_sub_eq_iff {α : Type*} {n : ℕ} + (sgn : Fin n → ℤ) (hs : ∀ t, sgn t ≠ 0) + (p q r s : Fin (n + 1) → α) : + pathShift sgn p - pathShift sgn q = pathShift sgn r - pathShift sgn s ↔ + ∀ t : Fin n, + Finsupp.single (p t.castSucc, p t.succ) (1 : ℤ) - + Finsupp.single (q t.castSucc, q t.succ) 1 = + Finsupp.single (r t.castSucc, r t.succ) 1 - + Finsupp.single (s t.castSucc, s t.succ) 1 := by + classical + constructor + · intro heq t + ext ab + rcases ab with ⟨a, b⟩ + have h := congrArg (fun f => f (t, a, b)) heq + simp only [Finsupp.sub_apply, pathShift_apply] at h + apply mul_left_cancel₀ (hs t) + simpa only [Finsupp.sub_apply, Finsupp.single_apply, mul_sub, mul_ite, + mul_one, mul_zero] using h + · intro heq + ext tab + rcases tab with ⟨t, a, b⟩ + have h := congrArg (fun f => sgn t * f (a, b)) (heq t) + simpa only [Finsupp.sub_apply, pathShift_apply, Finsupp.single_apply, + mul_sub, mul_ite, mul_one, mul_zero] using h + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/PowerPerturbation.lean b/lean/OAI/Algebra/DepthFive/PowerPerturbation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef28dd57acbbbf40c9d45129ce779c69c7a2a709 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/PowerPerturbation.lean @@ -0,0 +1,159 @@ +import Mathlib + +namespace OAI + +/-! The small change in exponent from one to `rho` does not destroy the +inverse-square-root scale of the rounded operator parameters. -/ + +noncomputable section +open Filter Topology + +namespace Problem335.PowerPerturbation + +/-- An explicit error that tends to zero. -/ +def error (n : ℝ) : ℝ := 2 * Real.log n / Real.sqrt n + 2 / n + +lemma tendsto_error : Tendsto error atTop (𝓝 0) := by + have hlog : Tendsto (fun x : ℝ => Real.log x / Real.sqrt x) atTop (𝓝 0) := by + simpa only [Real.sqrt_eq_rpow] using + (isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2)).tendsto_div_nhds_zero + have hinv : Tendsto (fun x : ℝ => 1 / x) atTop (𝓝 0) := by + simpa only [one_div] using (tendsto_inv_atTop_zero : + Tendsto (fun x : ℝ => x⁻¹) atTop (𝓝 0)) + convert (hlog.const_mul 2).add (hinv.const_mul 2) using 1 + · funext x + simp [error, div_eq_mul_inv, mul_assoc] + · norm_num + +lemma eventually_error_le_log_two : + ∀ᶠ n : ℝ in atTop, error n ≤ Real.log 2 := by + exact tendsto_error.eventually_le_const (Real.log_pos (by norm_num)) + +/-- Deterministic perturbation estimate, with all rounding and exponent +hypotheses explicit. The extra `exp (1/n)` allows a second ceiling error. -/ +lemma rpow_mul_exp_le {n a e : ℝ} (hn : 1 ≤ n) (ha : 0 < a) + (haUpper : a ≤ n ^ (-(1 / 2 : ℝ)) * Real.exp (1 / n)) + (he0 : 0 ≤ e) (he1 : e ≤ 1) (hgap : 1 - e ≤ 4 / Real.sqrt n) : + a ^ e * Real.exp (1 / n) ≤ + n ^ (-(1 / 2 : ℝ)) * Real.exp (error n) := by + have hn0 : 0 < n := lt_of_lt_of_le zero_lt_one hn + have hs0 : 0 < Real.sqrt n := Real.sqrt_pos.2 hn0 + have hl0 : 0 ≤ Real.log n := Real.log_nonneg hn + have hi0 : 0 ≤ 1 / n := by positivity + have hlog : Real.log a ≤ -(Real.log n / 2) + 1 / n := by + have h := Real.log_le_log ha haUpper + rw [Real.log_mul (Real.rpow_pos_of_pos hn0 _).ne' (Real.exp_ne_zero _), + Real.log_rpow hn0, Real.log_exp] at h + convert h using 1; ring + have h1 := mul_le_mul_of_nonneg_right hlog he0 + have h2 := mul_le_mul_of_nonneg_right hgap hl0 + have h3 := mul_le_mul_of_nonneg_right he1 hi0 + have hexp : Real.log a * e + 1 / n ≤ + Real.log n * (-(1 / 2 : ℝ)) + error n := by + unfold error + simp only [div_eq_mul_inv] at h1 h2 h3 ⊢ + nlinarith + rw [Real.rpow_def_of_pos ha, ← Real.exp_add, + Real.rpow_def_of_pos hn0, ← Real.exp_add] + exact Real.exp_le_exp.mpr hexp + +lemma rpow_mul_exp_le_two {n a e : ℝ} (hn : 1 ≤ n) (ha : 0 < a) + (haUpper : a ≤ n ^ (-(1 / 2 : ℝ)) * Real.exp (1 / n)) + (he0 : 0 ≤ e) (he1 : e ≤ 1) (hgap : 1 - e ≤ 4 / Real.sqrt n) + (herr : error n ≤ Real.log 2) : + a ^ e * Real.exp (1 / n) ≤ 2 / Real.sqrt n := by + calc + a ^ e * Real.exp (1 / n) ≤ n ^ (-(1 / 2 : ℝ)) * Real.exp (error n) := + rpow_mul_exp_le hn ha haUpper he0 he1 hgap + _ ≤ n ^ (-(1 / 2 : ℝ)) * 2 := by + gcongr + exact (Real.exp_le_exp.mpr herr).trans_eq (Real.exp_log (by norm_num)) + _ = 2 / Real.sqrt n := by + rw [Real.rpow_neg (by linarith), ← Real.sqrt_eq_rpow] + ring + +/-- Uniform in both the rounded parameter and the varying exponent. -/ +theorem eventually_rpow_mul_exp_le_two : + ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → ∀ a e : ℝ, + 0 < a → a ≤ (n : ℝ) ^ (-(1 / 2 : ℝ)) * Real.exp (1 / (n : ℝ)) → + 0 ≤ e → e ≤ 1 → 1 - e ≤ 4 / Real.sqrt (n : ℝ) → + a ^ e * Real.exp (1 / (n : ℝ)) ≤ 2 / Real.sqrt (n : ℝ) := by + have he := (tendsto_natCast_atTop_atTop : + Tendsto (fun n : ℕ => (n : ℝ)) atTop atTop).eventually eventually_error_le_log_two + obtain ⟨n₀, hn₀⟩ := Filter.eventually_atTop.1 he + refine ⟨max n₀ 1, fun n hn a e ha haUpper he0 he1 hgap => ?_⟩ + apply rpow_mul_exp_le_two (by exact_mod_cast (le_trans (le_max_right _ _) hn)) + ha haUpper he0 he1 hgap + exact hn₀ n (le_trans (le_max_left _ _) hn) + +/-- The exponent used for `q` is also covered by the uniform estimate. -/ +theorem eventually_q_beta_bounds : + ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → ∀ a rho beta : ℝ, + 0 < a → a ≤ (n : ℝ) ^ (-(1 / 2 : ℝ)) * Real.exp (1 / (n : ℝ)) → + 0 ≤ rho → rho ≤ 1 → 1 - rho ≤ 4 / Real.sqrt (n : ℝ) → + beta ≤ a ^ rho * Real.exp (1 / (n : ℝ)) → + a ^ ((1 + rho) / 2) ≤ 2 / Real.sqrt (n : ℝ) ∧ + beta ≤ 2 / Real.sqrt (n : ℝ) := by + obtain ⟨n₀, h⟩ := eventually_rpow_mul_exp_le_two + refine ⟨n₀, fun n hn a rho beta ha haUpper hr0 hr1 hgap hbeta => ?_⟩ + constructor + · have he0 : 0 ≤ (1 + rho) / 2 := by linarith + have he1 : (1 + rho) / 2 ≤ 1 := by linarith + have hegap : 1 - (1 + rho) / 2 ≤ 4 / Real.sqrt (n : ℝ) := by linarith + calc + a ^ ((1 + rho) / 2) = a ^ ((1 + rho) / 2) * 1 := (mul_one _).symm + _ ≤ a ^ ((1 + rho) / 2) * Real.exp (1 / (n : ℝ)) := by + apply mul_le_mul_of_nonneg_left _ (Real.rpow_nonneg ha.le _) + exact Real.one_le_exp_iff.mpr (by positivity) + _ ≤ 2 / Real.sqrt (n : ℝ) := h n hn a _ ha haUpper he0 he1 hegap + · exact hbeta.trans (h n hn a rho ha haUpper hr0 hr1 hgap) + +lemma inverse_sqrt_le_rpow {n a e : ℝ} (hn : 1 ≤ n) + (ha : n ^ (-(1 / 2 : ℝ)) ≤ a) (he0 : 0 ≤ e) (he1 : e ≤ 1) : + n ^ (-(1 / 2 : ℝ)) ≤ a ^ e := by + have hn0 : 0 < n := lt_of_lt_of_le zero_lt_one hn + have hb0 : 0 < n ^ (-(1 / 2 : ℝ)) := Real.rpow_pos_of_pos hn0 _ + have hb1 : n ^ (-(1 / 2 : ℝ)) ≤ 1 := by + simpa using Real.rpow_le_rpow_of_exponent_le hn (by norm_num : -(1 / 2 : ℝ) ≤ 0) + calc + n ^ (-(1 / 2 : ℝ)) ≤ (n ^ (-(1 / 2 : ℝ))) ^ e := by + simpa using Real.rpow_le_rpow_of_exponent_ge hb0 hb1 he1 + _ ≤ a ^ e := Real.rpow_le_rpow hb0.le ha he0 + +/-- The inverse-square-root estimate implies both weaker bounds used in the +circuit rank analysis after increasing the absolute threshold. -/ +theorem eventually_inverse_sqrt_bounds : + ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → + 2 / Real.sqrt (n : ℝ) ≤ (n : ℝ) ^ (-(2 / 5 : ℝ)) ∧ + 2 / Real.sqrt (n : ℝ) ≤ 1 / 2 := by + have ht : Tendsto (fun n : ℕ => (n : ℝ) ^ (1 / 10 : ℝ)) atTop atTop := + (tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 10)).comp + tendsto_natCast_atTop_atTop + obtain ⟨n₀, hn₀⟩ := Filter.eventually_atTop.1 (ht.eventually_ge_atTop 2) + refine ⟨max n₀ 16, fun n hn => ?_⟩ + have hn16 : (16 : ℝ) ≤ n := by exact_mod_cast (le_trans (le_max_right _ _) hn) + have hn0 : 0 < (n : ℝ) := by linarith + have hs0 : 0 < Real.sqrt (n : ℝ) := Real.sqrt_pos.2 hn0 + have hs4 : 4 ≤ Real.sqrt (n : ℝ) := by + apply (Real.le_sqrt (by norm_num) hn0.le).2 + norm_num + exact_mod_cast hn16 + constructor + · calc + 2 / Real.sqrt (n : ℝ) = 2 * (n : ℝ) ^ (-(1 / 2 : ℝ)) := by + rw [Real.rpow_neg hn0.le, ← Real.sqrt_eq_rpow] + rfl + _ ≤ (n : ℝ) ^ (1 / 10 : ℝ) * (n : ℝ) ^ (-(1 / 2 : ℝ)) := by + apply mul_le_mul_of_nonneg_right (hn₀ n (le_trans (le_max_left _ _) hn)) + positivity + _ = (n : ℝ) ^ (-(2 / 5 : ℝ)) := by + rw [← Real.rpow_add hn0] + norm_num + · apply (div_le_iff₀ hs0).2 + linarith + +end Problem335.PowerPerturbation + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ProductCost.lean b/lean/OAI/Algebra/DepthFive/ProductCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4d3f0d6f9a46accf405edeec04581378bc3206f --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ProductCost.lean @@ -0,0 +1,248 @@ +import Mathlib + +namespace OAI + +/-! +# Numerical assembly of the product-rank estimates + +These lemmas isolate the finite-product and real-power calculations in the +all-low and one-high cases of the circuit rank estimate. All hypotheses on +individual factor costs and parameters remain explicit. +-/ + +open scoped BigOperators + +namespace Problem335 + +/-- Assemble individual exponential errors and favorable powers of a base at +most one. This applies regardless of the source of the factor estimates. -/ +theorem prod_cost_le_exp_mul_rpow {ι : Type*} (s : Finset ι) + (H err d : ι → ℝ) (q E D : ℝ) (hq : 0 < q) (hq1 : q ≤ 1) + (hH : ∀ j ∈ s, 0 ≤ H j) + (hcost : ∀ j ∈ s, H j ≤ Real.exp (err j) * q ^ d j) + (herr : (∑ j ∈ s, err j) ≤ E) (hd : D ≤ ∑ j ∈ s, d j) : + (∏ j ∈ s, H j) ≤ Real.exp E * q ^ D := by + calc + (∏ j ∈ s, H j) ≤ ∏ j ∈ s, Real.exp (err j) * q ^ d j := + Finset.prod_le_prod₀ hH hcost + _ = Real.exp (∑ j ∈ s, err j) * q ^ (∑ j ∈ s, d j) := by + rw [Finset.prod_mul_distrib, ← Real.exp_sum, ← Real.rpow_sum_of_pos hq] + _ ≤ Real.exp E * q ^ D := + mul_le_mul (Real.exp_le_exp.mpr herr) + (Real.rpow_le_rpow_of_exponent_ge hq hq1 hd) + (Real.rpow_nonneg (le_of_lt hq) _) (le_of_lt (Real.exp_pos E)) + +/-- The favorable power in the all-low case saves the exact manuscript +exponent `sqrt(n)/20`. -/ +theorem all_low_power_saving (n q s : ℝ) (hn : 1 ≤ n) (hq : 0 ≤ q) + (hqbound : q ≤ n ^ (-(2 : ℝ) / 5)) (hs : Real.sqrt n / 2 ≤ s) : + q ^ (s / 4) ≤ n ^ (-Real.sqrt n / 20) := by + have hs0 : 0 ≤ s := le_trans (by positivity) hs + calc + q ^ (s / 4) ≤ (n ^ (-(2 : ℝ) / 5)) ^ (s / 4) := + Real.rpow_le_rpow hq hqbound (by positivity) + _ = n ^ (-s / 10) := by + rw [← Real.rpow_mul (by linarith : 0 ≤ n)] + congr 1 + ring + _ ≤ n ^ (-Real.sqrt n / 20) := + Real.rpow_le_rpow_of_exponent_le hn (by linarith) + +/-- The favorable power from expanding one high-degree factor saves the exact +manuscript exponent `3*sqrt(n)/160`. -/ +theorem one_high_power_saving (n q lam t : ℝ) (hn : 1 ≤ n) (hq : 0 ≤ q) + (hqbound : q ≤ n ^ (-(2 : ℝ) / 5)) (hlam : (3 : ℝ) / 8 ≤ lam) + (ht : Real.sqrt n / 4 ≤ t) : + q ^ (lam * t / 2) ≤ n ^ (-(3 * Real.sqrt n) / 160) := by + have hlam0 : 0 ≤ lam := by linarith + have ht0 : 0 ≤ t := le_trans (by positivity) ht + have hlt : (3 / 8 : ℝ) * (Real.sqrt n / 4) ≤ lam * t := + mul_le_mul hlam ht (by positivity) hlam0 + calc + q ^ (lam * t / 2) ≤ (n ^ (-(2 : ℝ) / 5)) ^ (lam * t / 2) := + Real.rpow_le_rpow hq hqbound (by positivity) + _ = n ^ (-(lam * t) / 5) := by + rw [← Real.rpow_mul (by linarith : 0 ≤ n)] + congr 1 + ring + _ ≤ n ^ (-(3 * Real.sqrt n) / 160) := + Real.rpow_le_rpow_of_exponent_le hn (by nlinarith) + +/-- The bounded loss per remaining large factor is exponential in `sqrt n`. -/ +theorem high_factor_exponential_bound (n s : ℝ) (hs : s ≤ Real.sqrt n) : + (5 : ℝ) ^ (4 * s) ≤ Real.exp (4 * Real.log 5 * Real.sqrt n) := by + rw [Real.rpow_def_of_pos (by norm_num)] + apply Real.exp_le_exp.mpr + have hlog : 0 ≤ Real.log 5 := Real.log_nonneg (by norm_num) + nlinarith + +/-- The number of large positive-degree factor occurrences is charged to their +total degree, rather than to the number of distinct circuit gates. -/ +theorem large_degree_count_mul_le_sum {ι : Type*} (s : Finset ι) + (e : ι → ℝ) (t : ℝ) (he : ∀ j ∈ s, 0 ≤ e j) : + ((s.filter (fun j => t ≤ e j)).card : ℝ) * t ≤ ∑ j ∈ s, e j := by + classical + calc + ((s.filter (fun j => t ≤ e j)).card : ℝ) * t = + ∑ j ∈ s.filter (fun j => t ≤ e j), t := by simp + _ ≤ ∑ j ∈ s.filter (fun j => t ≤ e j), e j := by + apply Finset.sum_le_sum + intro j hj + exact (Finset.mem_filter.mp hj).2 + _ ≤ ∑ j ∈ s, e j := + Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) + (fun j hj _ => he j hj) + +/-- Division form of the large-degree occurrence count. -/ +theorem large_degree_count_le {ι : Type*} (s : Finset ι) + (e : ι → ℝ) (t : ℝ) (ht : 0 < t) (he : ∀ j ∈ s, 0 ≤ e j) : + ((s.filter (fun j => t ≤ e j)).card : ℝ) ≤ (∑ j ∈ s, e j) / t := by + exact (le_div_iff₀ ht).mpr (large_degree_count_mul_le_sum s e t he) + +/-- The all-low branch fits the common circuit-rank envelope. No sign +assumption on the error constant `C` is required. -/ +theorem all_low_common_rank_bound (n S D C : ℝ) (hn : 1 ≤ n) + (hS : 1 ≤ S) (hD : 0 ≤ D) : + 2 * D * Real.exp (4 * C * Real.sqrt n) * n ^ (-Real.sqrt n / 20) ≤ + 2 * S * D * Real.exp ((4 * C + 4 * Real.log 5) * Real.sqrt n) * + n ^ (-Real.sqrt n / 100) := by + have hc : 2 * D ≤ 2 * S * D := by nlinarith + have he : Real.exp (4 * C * Real.sqrt n) ≤ + Real.exp ((4 * C + 4 * Real.log 5) * Real.sqrt n) := by + apply Real.exp_le_exp.mpr + have hh : 0 ≤ Real.log 5 * Real.sqrt n := + mul_nonneg (Real.log_nonneg (by norm_num)) (Real.sqrt_nonneg _) + nlinarith + have hp : n ^ (-Real.sqrt n / 20) ≤ n ^ (-Real.sqrt n / 100) := + Real.rpow_le_rpow_of_exponent_le hn (by nlinarith [Real.sqrt_nonneg n]) + exact mul_le_mul + (mul_le_mul hc he (le_of_lt (Real.exp_pos _)) (by positivity)) hp + (Real.rpow_nonneg (by linarith) _) (by positivity) + +/-- The one-high branch fits the same envelope, absorbing the bounded cost of +all remaining high-degree factors. -/ +theorem one_high_common_rank_bound (n s S D C : ℝ) (hn : 1 ≤ n) + (hs : s ≤ Real.sqrt n) (hS : 0 ≤ S) (hD : 0 ≤ D) : + 2 * S * D * (5 : ℝ) ^ (4 * s) * Real.exp (4 * C * Real.sqrt n) * + n ^ (-(3 * Real.sqrt n) / 160) ≤ + 2 * S * D * Real.exp ((4 * C + 4 * Real.log 5) * Real.sqrt n) * + n ^ (-Real.sqrt n / 100) := by + have he : (5 : ℝ) ^ (4 * s) * Real.exp (4 * C * Real.sqrt n) ≤ + Real.exp ((4 * C + 4 * Real.log 5) * Real.sqrt n) := by + calc + _ ≤ Real.exp (4 * Real.log 5 * Real.sqrt n) * + Real.exp (4 * C * Real.sqrt n) := + mul_le_mul_of_nonneg_right (high_factor_exponential_bound n s hs) + (le_of_lt (Real.exp_pos _)) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hp : n ^ (-(3 * Real.sqrt n) / 160) ≤ n ^ (-Real.sqrt n / 100) := + Real.rpow_le_rpow_of_exponent_le hn (by nlinarith [Real.sqrt_nonneg n]) + calc + _ = (2 * S * D) * ((5 : ℝ) ^ (4 * s) * Real.exp (4 * C * Real.sqrt n)) * + n ^ (-(3 * Real.sqrt n) / 160) := by ring + _ ≤ _ := mul_le_mul (mul_le_mul_of_nonneg_left he (by positivity)) hp + (Real.rpow_nonneg (by linarith) _) (by positivity) + +/-- Summing at most `S` upper-product contributions gives the quadratic gate +factor in the circuit-rank proposition. -/ +theorem sum_branch_rank_bound {ι : Type*} (s : Finset ι) (R : ι → ℝ) + (n S D C : ℝ) (hn : 0 ≤ n) (hS : 0 ≤ S) (hD : 0 ≤ D) + (hcard : (s.card : ℝ) ≤ S) + (hR : ∀ j ∈ s, R j ≤ + 2 * S * D * Real.exp (C * Real.sqrt n) * n ^ (-Real.sqrt n / 100)) : + (∑ j ∈ s, R j) ≤ + 2 * S ^ 2 * D * Real.exp (C * Real.sqrt n) * n ^ (-Real.sqrt n / 100) := by + calc + _ ≤ ∑ _j ∈ s, + 2 * S * D * Real.exp (C * Real.sqrt n) * n ^ (-Real.sqrt n / 100) := + Finset.sum_le_sum hR + _ = (s.card : ℝ) * + (2 * S * D * Real.exp (C * Real.sqrt n) * n ^ (-Real.sqrt n / 100)) := by + simp + _ ≤ S * (2 * S * D * Real.exp (C * Real.sqrt n) * n ^ (-Real.sqrt n / 100)) := + mul_le_mul_of_nonneg_right hcard (by positivity) + _ = _ := by ring + +/-- Splitting large and small degrees multiplies their two distinct types of +cost, with the large-factor multiplicity retained exactly. -/ +theorem prod_high_low_cost_le {ι : Type*} (s : Finset ι) + (H err e : ι → ℝ) (t B E : ℝ) + (hH : ∀ j ∈ s, 0 ≤ H j) (hB : 0 ≤ B) + (hhigh : ∀ j ∈ s, t ≤ e j → H j ≤ B) + (hlow : ∀ j ∈ s, e j < t → H j ≤ Real.exp (err j)) + (herr : (∑ j ∈ s with e j < t, err j) ≤ E) : + (∏ j ∈ s, H j) ≤ + B ^ (s.filter (fun j => t ≤ e j)).card * Real.exp E := by + classical + calc + _ ≤ ∏ j ∈ s, if t ≤ e j then B else Real.exp (err j) := by + apply Finset.prod_le_prod₀ hH + intro j hj + split_ifs with h + · exact hhigh j hj h + · exact hlow j hj (lt_of_not_ge h) + _ = B ^ (s.filter (fun j => t ≤ e j)).card * + Real.exp (∑ j ∈ s with e j < t, err j) := by + rw [Finset.prod_ite] + simp only [Finset.prod_const, not_le, ← Real.exp_sum] + _ ≤ _ := mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr herr) + (pow_nonneg hB _) + +/-- A degree budget replaces the number of high factors by `N/t`. -/ +theorem prod_high_low_cost_le_rpow {ι : Type*} (s : Finset ι) + (H err e : ι → ℝ) (t B E N : ℝ) (ht : 0 < t) + (hH : ∀ j ∈ s, 0 ≤ H j) (hB : 1 ≤ B) + (he : ∀ j ∈ s, 0 ≤ e j) (hbudget : (∑ j ∈ s, e j) ≤ N) + (hhigh : ∀ j ∈ s, t ≤ e j → H j ≤ B) + (hlow : ∀ j ∈ s, e j < t → H j ≤ Real.exp (err j)) + (herr : (∑ j ∈ s with e j < t, err j) ≤ E) : + (∏ j ∈ s, H j) ≤ B ^ (N / t) * Real.exp E := by + have hcount : ((s.filter (fun j => t ≤ e j)).card : ℝ) ≤ N / t := + (large_degree_count_le s e t ht he).trans + ((div_le_div_iff_of_pos_right ht).mpr hbudget) + calc + _ ≤ B ^ (s.filter (fun j => t ≤ e j)).card * Real.exp E := + prod_high_low_cost_le s H err e t B E hH (by linarith) hhigh hlow herr + _ = B ^ ((s.filter (fun j => t ≤ e j)).card : ℝ) * Real.exp E := by + rw [Real.rpow_natCast] + _ ≤ _ := mul_le_mul_of_nonneg_right + (Real.rpow_le_rpow_of_exponent_le hB hcount) (le_of_lt (Real.exp_pos _)) + +/-- Expanding one factor of degree at least `t` supplies enough linear-factor +cost to obtain the favorable power `q^(lam*t/2)`. -/ +theorem linear_factor_cost_power_le (H q lam t : ℝ) (e : ℕ) + (hH : 0 ≤ H) (hq : 0 < q) (hq1 : q ≤ 1) (hlam : 0 ≤ lam) + (hcost : H ≤ q ^ (lam / 2)) (he : t ≤ (e : ℝ)) : + H ^ e ≤ q ^ (lam * t / 2) := by + calc + H ^ e ≤ (q ^ (lam / 2)) ^ e := pow_le_pow_left₀ hH hcost e + _ = q ^ (lam * (e : ℝ) / 2) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul (le_of_lt hq)] + congr 1 + ring + _ ≤ _ := Real.rpow_le_rpow_of_exponent_ge hq hq1 + (by nlinarith [mul_le_mul_of_nonneg_left he hlam]) + +/-- The abstract one-high expansion estimate, before inserting the analytic +parameter bounds. The finite family represents the unexpanded occurrences. -/ +theorem expanded_high_product_cost_le {ι : Type*} (s : Finset ι) + (H err e : ι → ℝ) (Hlin q lam t B E N : ℝ) (d : ℕ) + (ht : 0 < t) (hH : ∀ j ∈ s, 0 ≤ H j) (hB : 1 ≤ B) + (he : ∀ j ∈ s, 0 ≤ e j) (hbudget : (∑ j ∈ s, e j) ≤ N) + (hhigh : ∀ j ∈ s, t ≤ e j → H j ≤ B) + (hlow : ∀ j ∈ s, e j < t → H j ≤ Real.exp (err j)) + (herr : (∑ j ∈ s with e j < t, err j) ≤ E) + (hHlin : 0 ≤ Hlin) (hq : 0 < q) (hq1 : q ≤ 1) (hlam : 0 ≤ lam) + (hlinear : Hlin ≤ q ^ (lam / 2)) (hd : t ≤ (d : ℝ)) : + Hlin ^ d * (∏ j ∈ s, H j) ≤ + B ^ (N / t) * Real.exp E * q ^ (lam * t / 2) := by + calc + _ ≤ q ^ (lam * t / 2) * (B ^ (N / t) * Real.exp E) := + mul_le_mul (linear_factor_cost_power_le Hlin q lam t d hHlin hq hq1 hlam hlinear hd) + (prod_high_low_cost_le_rpow s H err e t B E N ht hH hB he hbudget hhigh hlow herr) + (Finset.prod_nonneg hH) (Real.rpow_nonneg (le_of_lt hq) _) + _ = _ := by ring + +end Problem335 + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ProductNormalization.lean b/lean/OAI/Algebra/DepthFive/ProductNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6b0271387eedbbe679605ad4f6ad40d868363ca --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ProductNormalization.lean @@ -0,0 +1,99 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem335 + +open MvPolynomial + +universe u v + +variable {K : Type u} [CommSemiring K] {σ : Type v} + +/-- A homogeneous polynomial of formal degree zero is a scalar, including +the zero polynomial. -/ +theorem homogeneous_zero_eq_C {p : MvPolynomial σ K} + (hp : p.IsHomogeneous 0) : p = C (constantCoeff p) := by + apply MvPolynomial.totalDegree_eq_zero_iff_eq_C.mp + exact (MvPolynomial.totalDegree_zero_iff_isHomogeneous σ).mpr hp + +/-- Remove formal-degree-zero factors from a homogeneous product and absorb +them into a single scalar. Positive-degree occurrences, including repeated +occurrences and zero polynomials, are retained. -/ +theorem homogeneous_product_positive_factors + (l : List (MvPolynomial σ K × ℕ)) + (hl : ∀ q ∈ l, q.1.IsHomogeneous q.2) : + ∃ a : K, ∃ factors : List (MvPolynomial σ K × ℕ), + (∀ q ∈ factors, 0 < q.2 ∧ q.1.IsHomogeneous q.2) ∧ + (factors.map Prod.snd).sum = (l.map Prod.snd).sum ∧ + (l.map Prod.fst).prod = C a * (factors.map Prod.fst).prod ∧ + factors.Sublist l ∧ + factors.length ≤ (l.map Prod.snd).sum := by + induction l with + | nil => + exact ⟨1, [], by simp⟩ + | cons q l ih => + have hq := hl q (by simp) + have ht : ∀ r ∈ l, r.1.IsHomogeneous r.2 := by + intro r hr + exact hl r (by simp [hr]) + obtain ⟨a, factors, hf, hd, hv, hs, hn⟩ := ih ht + by_cases hzero : q.2 = 0 + · have hscalar : q.1 = C (constantCoeff q.1) := + homogeneous_zero_eq_C (hzero ▸ hq) + refine ⟨constantCoeff q.1 * a, factors, hf, ?_, ?_, hs.cons q, ?_⟩ + · simpa [hzero] using hd + · simp only [List.map_cons, List.prod_cons, hv, map_mul] + conv_lhs => lhs; rw [hscalar] + simp only [mul_assoc] + · simpa [hzero] using hn + · have hpos : 0 < q.2 := Nat.pos_of_ne_zero hzero + refine ⟨a, q :: factors, ?_, ?_, ?_, hs.cons_cons q, ?_⟩ + · intro r hr + rcases List.mem_cons.mp hr with hr | hr + · subst r + exact ⟨hpos, hq⟩ + · exact hf r hr + · simpa using congrArg (q.2 + ·) hd + · simp only [List.map_cons, List.prod_cons, hv] + ac_rfl + · simp only [List.length_cons, List.map_cons, List.sum_cons] + omega + +/-- When the original formal degrees are at most one, removing the scalar +factors leaves exactly the total formal degree many homogeneous linear +forms. No assumption on variable support is required. -/ +theorem homogeneous_product_linear_factors + (l : List (MvPolynomial σ K × ℕ)) + (hl : ∀ q ∈ l, q.1.IsHomogeneous q.2) + (hle : ∀ q ∈ l, q.2 ≤ 1) : + ∃ a : K, ∃ factors : List (MvPolynomial σ K), + factors.length = (l.map Prod.snd).sum ∧ + (∀ p ∈ factors, p.IsHomogeneous 1) ∧ + (l.map Prod.fst).prod = C a * factors.prod := by + obtain ⟨a, factors, hf, hd, hv, hs, _⟩ := + homogeneous_product_positive_factors l hl + have hone : ∀ q ∈ factors, q.2 = 1 := by + intro q hq + have hpos := (hf q hq).1 + have hbound := hle q (hs.subset hq) + omega + have hsum : (factors.map Prod.snd).sum = factors.length := by + have heq : factors.map Prod.snd = factors.map (fun _ => 1) := by + apply List.map_eq_map_iff.mpr + exact hone + rw [heq] + simp + refine ⟨a, factors.map Prod.fst, ?_, ?_, hv⟩ + · simpa only [List.length_map] using hsum.symm.trans hd + · intro p hp + obtain ⟨q, hq, rfl⟩ := List.mem_map.mp hp + simpa only [hone q hq] using (hf q hq).2 + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ProductRank.lean b/lean/OAI/Algebra/DepthFive/ProductRank.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e6e661e1cd39038e2e306ddfec8cbffa1e0b528 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ProductRank.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.DepthFive.ProductRankAssembly +import OAI.Algebra.DepthFive.IntermediateFactorization +import OAI.Algebra.DepthFive.IntermediateDimension +import OAI.Algebra.DepthFive.BidegreeDimension +import OAI.Algebra.DepthFive.BidegreeBridge + +namespace OAI + +/-! The mixed-operator product-rank estimate. Unlike the abstract assembly +lemma, the intermediate-space rank bounds here are proved from the actual +operator, and its dimension is computed from the two variable groups. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ K ι : Type*} [Fintype σ] [Field K] [Fintype ι] [DecidableEq ι] + +/-- The product-rank lemma for a homogeneous product, under the elementary +numerical hypotheses on the source degrees and balancing ratios. +There is no circuit or polynomial rank hypothesis in this statement. -/ +theorem mixed_product_rank_le + (side : σ → Bool) (Q : ι → MvPolynomial σ K) (e : ι → ℕ) + (hQ : ∀ j, (Q j).IsHomogeneous (e j)) + (k n v u a b : ℕ) (rho lam : ℝ) + (hvcard : Fintype.card {x : σ // side x = true} = v) + (hucard : Fintype.card {x : σ // side x = false} = u) + (he : ∑ j, e j = n) (hproportion : lam * n = k) + (hslope : (1 + rho) * lam = rho) + (hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b) + (hka : k ≤ a) (hbudget : 2 * k ≤ a + v) + (hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ rho ≤ + (b : ℝ) / ((b : ℝ) + u)) : + (RankMeasure.mapRank (sourceMixedOperator side a b + (bidegreeComponent side k (n - k) (∏ j, Q j))) : ℝ) ≤ + 2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b) * + ∏ j, degreeWeight (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + rho) / 2)) lam (e j) := by + classical + have htotal : (∏ j, Q j).IsHomogeneous n := by + rw [← he] + exact MvPolynomial.IsHomogeneous.prod _ _ _ (fun j _ => hQ j) + rw [bidegreeComponent_sub_eq_component side k htotal] + change (RankMeasure.measure (sourceMixedOperator side a b) + (Bidegree.component side k (∏ j, Q j)) : ℝ) ≤ _ + refine ProductRankAssembly.measure_component_product_le_degreeWeight + (fun p => (RankMeasure.measure (sourceMixedOperator side a b) p : ℝ)) + (by simp) ?_ side Q e hQ k + (2 * ((homogeneousDim v a : ℝ) * homogeneousDim u b)) + (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + rho) / 2)) lam + (by positivity) (by positivity) ?_ + · intro p q + exact_mod_cast RankMeasure.measure_add_le (sourceMixedOperator side a b) p q + · intro i hie hi + have hIa : positiveBidegreeV Finset.univ e i lam ≤ a := by + calc + _ ≤ ∑ j, i j := positiveBidegreeV_le Finset.univ e i lam + _ = k := hi + _ ≤ a := hka + have hrank := sourceMixedOperator_homogeneous_prod_rank_le Finset.univ + (fun j => 0 < (i j : ℝ) - lam * e j) + (fun j => Bidegree.component side (i j) (Q j)) + i (fun j => e j - i j) side a b + (fun j _ => component_mem_bidegreeSubmodule side (i j) (hQ j)) hIa + rw [bidegreeSubmodule_finrank_choose K side, hvcard, hucard] at hrank + have hrankR : + (RankMeasure.measure (sourceMixedOperator side a b) + (∏ j, Bidegree.component side (i j) (Q j)) : ℝ) ≤ + (homogeneousDim v (a - positiveBidegreeV Finset.univ e i lam) : ℝ) * + homogeneousDim u (b + positiveBidegreeU Finset.univ e i lam) := by + exact_mod_cast hrank + exact hrankR.trans (intermediate_dimension_le_weight_product Finset.univ + e i k n v u a b rho lam (fun j _ => hie j) he hi + hproportion hslope hv hu ha hb hka hbudget hbalance) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ProductRankAssembly.lean b/lean/OAI/Algebra/DepthFive/ProductRankAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ea50502089b99e261c65c937ab92f85851a48cd --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ProductRankAssembly.lean @@ -0,0 +1,142 @@ +import OAI.Algebra.DepthFive.Bidegree +import OAI.Algebra.DepthFive.DegreeDiscrepancy +import OAI.Algebra.DepthFive.RankMeasure + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +namespace ProductRankAssembly + +variable {σ K ι : Type*} [CommSemiring K] [Fintype ι] [DecidableEq ι] + +/-- The rank subadditivity step, stated for a real-valued polynomial measure. -/ +theorem measure_sum_le (R : MvPolynomial σ K → ℝ) + (hzero : R 0 = 0) (hadd : ∀ p q, R (p + q) ≤ R p + R q) + {α : Type*} (s : Finset α) (f : α → MvPolynomial σ K) : + R (∑ a ∈ s, f a) ≤ ∑ a ∈ s, R (f a) := by + classical + induction s using Finset.induction_on with + | empty => simp [hzero] + | @insert a s ha ih => + simp only [Finset.sum_insert ha] + exact (hadd _ _).trans (add_le_add le_rfl ih) + +/-- A product's fixed bidegree has rank at most the sum over exactly those +assignments with matching total degree. -/ +theorem measure_component_product_le_sum + (R : MvPolynomial σ K → ℝ) + (hzero : R 0 = 0) (hadd : ∀ p q, R (p + q) ≤ R p + R q) + (side : σ → Bool) (p : ι → MvPolynomial σ K) (e : ι → ℕ) + (hp : ∀ j, (p j).IsHomogeneous (e j)) (k : ℕ) : + R (Bidegree.component side k (∏ j, p j)) ≤ + ∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter + (fun i => ∑ j, i j = k), R (∏ j, Bidegree.component side (i j) (p j)) := by + classical + have hdecomp : Bidegree.component side k (∏ j, p j) = + ∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter + (fun i => ∑ j, i j = k), ∏ j, Bidegree.component side (i j) (p j) := by + rw [Bidegree.component_prod side p e hp k, Finset.sum_filter] + rw [hdecomp] + exact measure_sum_le R hzero hadd _ _ + +/-- The constrained bidegree decomposition and the nonnegative assignment sum +turn per-assignment weight bounds into the product-rank estimate. -/ +theorem measure_component_product_le_degreeWeight + (R : MvPolynomial σ K → ℝ) + (hzero : R 0 = 0) (hadd : ∀ p q, R (p + q) ≤ R p + R q) + (side : σ → Bool) (p : ι → MvPolynomial σ K) (e : ι → ℕ) + (hp : ∀ j, (p j).IsHomogeneous (e j)) (k : ℕ) + (C q lam : ℝ) (hC : 0 ≤ C) (hq : 0 ≤ q) + (hterm : ∀ i : ι → ℕ, (∀ j, i j ≤ e j) → (∑ j, i j) = k → + R (∏ j, Bidegree.component side (i j) (p j)) ≤ + C * ∏ j, q ^ |(i j : ℝ) - lam * e j|) : + R (Bidegree.component side k (∏ j, p j)) ≤ + C * ∏ j, degreeWeight q lam (e j) := by + classical + calc + _ ≤ ∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter + (fun i => ∑ j, i j = k), R (∏ j, Bidegree.component side (i j) (p j)) := + measure_component_product_le_sum R hzero hadd side p e hp k + _ ≤ ∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter + (fun i => ∑ j, i j = k), C * ∏ j, q ^ |(i j : ℝ) - lam * e j| := by + apply Finset.sum_le_sum + intro i hi + obtain ⟨hi, hsum⟩ := Finset.mem_filter.mp hi + apply hterm i _ hsum + intro j + have hj := (Fintype.mem_piFinset.mp hi) j + simpa only [Finset.mem_range, Nat.lt_succ_iff] using hj + _ = C * (∑ i ∈ (Fintype.piFinset (fun j => Finset.range (e j + 1))).filter + (fun i => ∑ j, i j = k), ∏ j, q ^ |(i j : ℝ) - lam * e j|) := + (Finset.mul_sum _ _ _).symm + _ ≤ C * ∏ j, degreeWeight q lam (e j) := + mul_le_mul_of_nonneg_left (bidegree_weight_sum_le e k q lam hq) hC + +/-- The full algebraic product-rank assembly: the remaining input is +the geometric bound through the selected intermediate homogeneous space. -/ +theorem measure_component_product_le_of_intermediate_bounds + (R : MvPolynomial σ K → ℝ) + (hzero : R 0 = 0) (hadd : ∀ p q, R (p + q) ≤ R p + R q) + (side : σ → Bool) (p : ι → MvPolynomial σ K) (e : ι → ℕ) + (hp : ∀ j, (p j).IsHomogeneous (e j)) (k : ℕ) + (D alpha rho lam : ℝ) (hD : 0 ≤ D) (halpha : 0 < alpha) + (hslope : (1 + rho) * lam = rho) + (hbalance : lam * (∑ j, (e j : ℝ)) = k) + (hterm : ∀ i : ι → ℕ, (∀ j, i j ≤ e j) → (∑ j, i j) = k → + R (∏ j, Bidegree.component side (i j) (p j)) ≤ + 2 * D * alpha ^ ((∑ j ∈ Finset.univ.filter + (fun j => 0 < (i j : ℝ) - lam * e j), (i j : ℝ)) - + rho * (∑ j ∈ Finset.univ.filter + (fun j => 0 < (i j : ℝ) - lam * e j), ((e j : ℝ) - i j)))) : + R (Bidegree.component side k (∏ j, p j)) ≤ + 2 * D * ∏ j, degreeWeight (alpha ^ ((1 + rho) / 2)) lam (e j) := by + apply measure_component_product_le_degreeWeight R hzero hadd side p e hp k + (2 * D) (alpha ^ ((1 + rho) / 2)) lam (by positivity) (by positivity) + intro i hi hsum + have hsumR : (∑ j, (i j : ℝ)) = k := by exact_mod_cast hsum + have hdelta : (∑ j, ((i j : ℝ) - lam * e j)) = 0 := by + rw [Finset.sum_sub_distrib, ← Finset.mul_sum, hsumR, hbalance, sub_self] + have hpow := positive_bidegree_rpow Finset.univ + (fun j => (e j : ℝ)) (fun j => (i j : ℝ)) rho lam alpha halpha hslope hdelta + simpa only [hpow] using hterm i hi hsum + +section LinearFamilies + +variable {F V W : Type*} [Field F] + [AddCommGroup V] [Module F V] [FiniteDimensional F V] + [AddCommGroup W] [Module F W] + +/-- Specialization to the actual finite-dimensional rank measure of a linear +operator family, without any extra subadditivity hypotheses. -/ +theorem rank_component_product_le_of_intermediate_bounds + (A : MvPolynomial σ F →ₗ[F] (V →ₗ[F] W)) + (side : σ → Bool) (p : ι → MvPolynomial σ F) (e : ι → ℕ) + (hp : ∀ j, (p j).IsHomogeneous (e j)) (k : ℕ) + (D alpha rho lam : ℝ) (hD : 0 ≤ D) (halpha : 0 < alpha) + (hslope : (1 + rho) * lam = rho) + (hbalance : lam * (∑ j, (e j : ℝ)) = k) + (hterm : ∀ i : ι → ℕ, (∀ j, i j ≤ e j) → (∑ j, i j) = k → + (RankMeasure.measure A (∏ j, Bidegree.component side (i j) (p j)) : ℝ) ≤ + 2 * D * alpha ^ ((∑ j ∈ Finset.univ.filter + (fun j => 0 < (i j : ℝ) - lam * e j), (i j : ℝ)) - + rho * (∑ j ∈ Finset.univ.filter + (fun j => 0 < (i j : ℝ) - lam * e j), ((e j : ℝ) - i j)))) : + (RankMeasure.measure A (Bidegree.component side k (∏ j, p j)) : ℝ) ≤ + 2 * D * ∏ j, degreeWeight (alpha ^ ((1 + rho) / 2)) lam (e j) := by + apply measure_component_product_le_of_intermediate_bounds + (fun p => (RankMeasure.measure A p : ℝ)) (by simp) _ + side p e hp k D alpha rho lam hD halpha hslope hbalance hterm + intro p q + exact_mod_cast RankMeasure.measure_add_le A p q + +end LinearFamilies + +end ProductRankAssembly +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ProductRankCanonical.lean b/lean/OAI/Algebra/DepthFive/ProductRankCanonical.lean new file mode 100644 index 0000000000000000000000000000000000000000..329bedbc44033b49e5d01c230ac0cb1b30bb3835 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ProductRankCanonical.lean @@ -0,0 +1,40 @@ +import OAI.Algebra.DepthFive.ProductRank +import OAI.Algebra.DepthFive.OperatorRankBridge + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 + +variable {σ K ι : Type*} [Fintype σ] [Field K] [Fintype ι] [DecidableEq ι] + +/-- The product-rank estimate in the common rank API used by both circuit +and moment bounds. Its dimension factor is the actual source dimension. -/ +theorem bidegreeRank_product_le_degreeWeight + (side : σ → Bool) (Q : ι → MvPolynomial σ K) (e : ι → ℕ) + (hQ : ∀ j, (Q j).IsHomogeneous (e j)) + (k m v u a b : ℕ) (rho lam : ℝ) + (hvcard : Fintype.card {x : σ // side x = true} = v) + (hucard : Fintype.card {x : σ // side x = false} = u) + (he : ∑ j, e j = k + m) (hproportion : lam * (k + m) = k) + (hslope : (1 + rho) * lam = rho) + (hv : 1 ≤ v) (hu : 1 ≤ u) (ha : 0 < a) (hb : 0 < b) + (hka : k ≤ a) (hbudget : 2 * k ≤ a + v) + (hbalance : ((a : ℝ) / ((a : ℝ) + v)) ^ rho ≤ + (b : ℝ) / ((b : ℝ) + u)) : + (bidegreeRank side a b k m (∏ j, Q j) : ℝ) ≤ + 2 * (Module.finrank K (bidegreeSubmodule (K := K) side a b) : ℝ) * + ∏ j, degreeWeight (((a : ℝ) / ((a : ℝ) + v)) ^ ((1 + rho) / 2)) lam (e j) := by + have h := mixed_product_rank_le side Q e hQ k (k + m) v u a b rho lam + hvcard hucard he (by simpa only [Nat.cast_add] using hproportion) hslope hv hu ha hb hka hbudget hbalance + rw [bidegreeRank_eq_source_measure] + rw [bidegreeSubmodule_finrank_choose K side, hvcard, hucard, Nat.cast_mul] + simpa only [Nat.add_sub_cancel_left, RankMeasure.measure, homogeneousDim] using h + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/QuadPathReindex.lean b/lean/OAI/Algebra/DepthFive/QuadPathReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f4bb03cd951680b4573e027747be7fdbd47423e --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/QuadPathReindex.lean @@ -0,0 +1,100 @@ +import OAI.Algebra.DepthFive.PairingPartition +import OAI.Algebra.DepthFive.PairingShifts + +namespace OAI + +namespace Problem335.Pairings + +open scoped BigOperators + +/-- Zip four independently indexed paths into one path of quadruple labels. -/ +def gatherPaths {ι α : Type*} (p q r s : ι → α) : ι → Labels α := + fun i => ⟨p i, q i, r i, s i⟩ + +/-- Four paths and a single quadruple-labelled path contain exactly the same data. -/ +def quadPathsEquiv (ι α : Type*) : + ((ι → α) × (ι → α) × (ι → α) × (ι → α)) ≃ (ι → Labels α) where + toFun x := gatherPaths x.1 x.2.1 x.2.2.1 x.2.2.2 + invFun x := (fun i => (x i).p, fun i => (x i).q, + fun i => (x i).r, fun i => (x i).s) + left_inv _ := rfl + right_inv _ := rfl + +/-- Reindex the four finite path loops without changing any weight. -/ +theorem sum_quadPaths {ι α R : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] + [AddCommMonoid R] (F : (ι → Labels α) → R) : + (∑ p : ι → α, ∑ q : ι → α, ∑ r : ι → α, ∑ s : ι → α, + F (gatherPaths p q r s)) = ∑ x : ι → Labels α, F x := by + classical + simpa only [Fintype.sum_prod_type, quadPathsEquiv] using + (Fintype.sum_equiv (quadPathsEquiv ι α) + (fun x => F (gatherPaths x.1 x.2.1 x.2.2.1 x.2.2.2)) F + (fun _ => rfl)) + +/-- Reindex a restricted four-path sum as a sum over the corresponding subtype. -/ +theorem sum_quadPaths_subtype {ι α R : Type*} [Fintype ι] [DecidableEq ι] + [Fintype α] [AddCommMonoid R] (P : (ι → Labels α) → Prop) + [DecidablePred P] (F : (ι → Labels α) → R) : + (∑ p : ι → α, ∑ q : ι → α, ∑ r : ι → α, ∑ s : ι → α, + if P (gatherPaths p q r s) then F (gatherPaths p q r s) else 0) = + ∑ x : {x : ι → Labels α // P x}, F x.1 := by + classical + rw [sum_quadPaths (fun x => if P x then F x else 0), ← Finset.sum_filter] + exact Finset.sum_subtype _ (by intro x; simp) F + +/-- A single path with its two external vertices fixed at `a`. -/ +def closePath {α : Type*} {L : ℕ} (a : α) (p : Fin L → α) : + Fin (L + 2) → α := + Fin.cases a (Fin.lastCases a p) + +@[simp] theorem closePath_zero {α : Type*} {L : ℕ} (a : α) (p : Fin L → α) : + closePath a p 0 = a := rfl + +@[simp] theorem closePath_last {α : Type*} {L : ℕ} (a : α) (p : Fin L → α) : + closePath a p (Fin.last (L + 1)) = a := by + simp [closePath, ← Fin.succ_last] + +@[simp] theorem closePath_internal {α : Type*} {L : ℕ} + (a : α) (p : Fin L → α) (i : Fin L) : + closePath a p i.castSucc.succ = p i := by + simp [closePath] + +@[simp] theorem closePaths_gather_p {α : Type*} {L : ℕ} + (a : α) (p q r s : Fin L → α) (i : Fin (L + 2)) : + (closePaths a (gatherPaths p q r s) i).p = closePath a p i := by + refine Fin.cases rfl (fun j => ?_) i + refine Fin.lastCases ?_ (fun k => ?_) j <;> + simp [closePaths, closePath, gatherPaths, constantLabels, -Fin.succ_last] + +@[simp] theorem closePaths_gather_q {α : Type*} {L : ℕ} + (a : α) (p q r s : Fin L → α) (i : Fin (L + 2)) : + (closePaths a (gatherPaths p q r s) i).q = closePath a q i := by + refine Fin.cases rfl (fun j => ?_) i + refine Fin.lastCases ?_ (fun k => ?_) j <;> + simp [closePaths, closePath, gatherPaths, constantLabels, -Fin.succ_last] + +@[simp] theorem closePaths_gather_r {α : Type*} {L : ℕ} + (a : α) (p q r s : Fin L → α) (i : Fin (L + 2)) : + (closePaths a (gatherPaths p q r s) i).r = closePath a r i := by + refine Fin.cases rfl (fun j => ?_) i + refine Fin.lastCases ?_ (fun k => ?_) j <;> + simp [closePaths, closePath, gatherPaths, constantLabels, -Fin.succ_last] + +@[simp] theorem closePaths_gather_s {α : Type*} {L : ℕ} + (a : α) (p q r s : Fin L → α) (i : Fin (L + 2)) : + (closePaths a (gatherPaths p q r s) i).s = closePath a s i := by + refine Fin.cases rfl (fun j => ?_) i + refine Fin.lastCases ?_ (fun k => ?_) j <;> + simp [closePaths, closePath, gatherPaths, constantLabels, -Fin.succ_last] + +/-- The canonical layer labels are exactly the coordinates of the four closed paths. -/ +theorem layerLabels_gatherPaths {α : Type*} {L : ℕ} + (a : α) (p q r s : Fin L → α) (t : Fin (L + 1)) : + layerLabels a (gatherPaths p q r s) t = + ⟨edgeCoordinates (closePath a p) t, edgeCoordinates (closePath a q) t, + edgeCoordinates (closePath a r) t, edgeCoordinates (closePath a s) t⟩ := by + apply Labels.ext <;> simp [layerLabels, zipLabels, edgeCoordinates] + +end Problem335.Pairings + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RankMeasure.lean b/lean/OAI/Algebra/DepthFive/RankMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0d7c7b5b3a3a2dca619bc40c381ee567ff59e6a --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RankMeasure.lean @@ -0,0 +1,194 @@ +import Mathlib + +namespace OAI + +/-! +# Finite-dimensional rank bookkeeping + +The differentiation--multiplication measure is obtained by applying a linear +family of linear maps to a polynomial. Its rank can be studied independently +of the construction of that family and the choice of homogeneous spaces. +-/ + +noncomputable section + +open scoped BigOperators + +namespace Problem335 +namespace RankMeasure + +universe u v w x y + +variable {K : Type u} [Field K] +variable {P : Type v} [AddCommGroup P] [Module K P] +variable {V : Type w} [AddCommGroup V] [Module K V] +variable {W : Type x} [AddCommGroup W] [Module K W] +variable {Z : Type y} [AddCommGroup Z] [Module K Z] + +/-- The natural-number rank of a linear map. Its use below always has a +finite-dimensional source, or an explicit finite-dimensional factorization. -/ +def mapRank (f : V →ₗ[K] W) : ℕ := Module.finrank K (LinearMap.range f) + +@[simp] theorem mapRank_zero : mapRank (0 : V →ₗ[K] W) = 0 := by + rw [mapRank, LinearMap.range_zero, finrank_bot] + +theorem mapRank_smul (f : V →ₗ[K] W) (a : K) (ha : a ≠ 0) : + mapRank (a • f) = mapRank f := by + unfold mapRank + rw [LinearMap.range_smul f a ha] + +theorem mapRank_smul_le [FiniteDimensional K V] (f : V →ₗ[K] W) (a : K) : + mapRank (a • f) ≤ mapRank f := by + exact Submodule.finrank_mono (LinearMap.range_smul_le_range f a) + +theorem mapRank_add_le [FiniteDimensional K V] (f g : V →ₗ[K] W) : + mapRank (f + g) ≤ mapRank f + mapRank g := by + have h := LinearMap.rank_add_le f g + rw [LinearMap.rank, LinearMap.rank, LinearMap.rank, + ← Module.finrank_eq_rank, ← Module.finrank_eq_rank, + ← Module.finrank_eq_rank] at h + exact_mod_cast h + +theorem mapRank_sum_le [FiniteDimensional K V] {ι : Type*} + (s : Finset ι) (f : ι → V →ₗ[K] W) : + mapRank (∑ i ∈ s, f i) ≤ ∑ i ∈ s, mapRank (f i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + simp only [Finset.sum_insert hi] + exact (mapRank_add_le _ _).trans (Nat.add_le_add_left ih _) + +theorem mapRank_comp_le_left [FiniteDimensional K Z] + (f : V →ₗ[K] Z) (g : Z →ₗ[K] W) : + mapRank (g.comp f) ≤ mapRank g := by + apply Submodule.finrank_mono + rw [LinearMap.range_comp] + exact LinearMap.map_le_range + +theorem mapRank_comp_le_right [FiniteDimensional K V] + (f : V →ₗ[K] Z) (g : Z →ₗ[K] W) : + mapRank (g.comp f) ≤ mapRank f := by + unfold mapRank + rw [LinearMap.range_comp] + exact Submodule.finrank_map_le g (LinearMap.range f) + +/-- Factorization through a finite-dimensional intermediate space bounds rank. -/ +theorem mapRank_factor_le [FiniteDimensional K Z] + (f : V →ₗ[K] Z) (g : Z →ₗ[K] W) : + mapRank (g.comp f) ≤ Module.finrank K Z := + (mapRank_comp_le_left f g).trans g.finrank_range_le + +/-- Changing to finite bases identifies our rank convention with matrix rank. -/ +theorem mapRank_eq_matrixRank {ι κ : Type*} [Fintype ι] [Fintype κ] + [DecidableEq ι] [DecidableEq κ] + (bV : Module.Basis ι K V) (bW : Module.Basis κ K W) (f : V →ₗ[K] W) : + mapRank f = (LinearMap.toMatrix bV bW f).rank := by + classical + rw [Matrix.rank_eq_finrank_range_toLin _ bW bV] + rw [Matrix.toLin_toMatrix] + rfl + +/-- The rank of a restricted map does not depend on whether its codomain is +viewed as a subspace or as the ambient space. -/ +theorem mapRank_subtype_comp (S : Submodule K W) (f : V →ₗ[K] S) : + mapRank (S.subtype.comp f) = mapRank f := by + unfold mapRank + rw [LinearMap.range_comp] + exact (Submodule.equivMapOfInjective S.subtype S.injective_subtype f.range).finrank_eq.symm + +/-- Restrict the source of a linear operator family to a chosen homogeneous +subspace, leaving the codomain ambient. This avoids unnecessary transports +between equivalent descriptions of the target homogeneous space. -/ +def restrictFamily (F : P →ₗ[K] (V →ₗ[K] W)) (S : Submodule K V) : + P →ₗ[K] (S →ₗ[K] W) where + toFun p := (F p).comp S.subtype + map_add' p q := by ext x; simp + map_smul' a p := by ext x; simp + +@[simp] theorem restrictFamily_apply (F : P →ₗ[K] (V →ₗ[K] W)) + (S : Submodule K V) (p : P) (x : S) : + restrictFamily F S p x = F p x := rfl + +/-- In a product of operators, it suffices to show that the first part sends +the source subspace into a finite-dimensional intermediate subspace. -/ +theorem mapRank_restrict_factor_le (S : Submodule K V) (I : Submodule K Z) + [FiniteDimensional K I] (f : V →ₗ[K] Z) (g : Z →ₗ[K] W) + (hf : ∀ x : S, f x ∈ I) : + mapRank ((g.comp f).comp S.subtype) ≤ Module.finrank K I := by + let f' : S →ₗ[K] I := (f.comp S.subtype).codRestrict I hf + have h : (g.comp f).comp S.subtype = (g.comp I.subtype).comp f' := by + ext x + rfl + rw [h] + exact mapRank_factor_le f' (g.comp I.subtype) + +/-- A rank measure associated with a linear family of linear maps. -/ +def measure (F : P →ₗ[K] (V →ₗ[K] W)) (p : P) : ℕ := mapRank (F p) + +@[simp] theorem measure_zero (F : P →ₗ[K] (V →ₗ[K] W)) : + measure F 0 = 0 := by + simp [measure] + +theorem measure_smul (F : P →ₗ[K] (V →ₗ[K] W)) (a : K) (ha : a ≠ 0) (p : P) : + measure F (a • p) = measure F p := by + simpa only [measure, map_smul] using mapRank_smul (F p) a ha + +theorem measure_smul_le [FiniteDimensional K V] + (F : P →ₗ[K] (V →ₗ[K] W)) (a : K) (p : P) : + measure F (a • p) ≤ measure F p := by + simpa only [measure, map_smul] using mapRank_smul_le (F p) a + +theorem measure_add_le [FiniteDimensional K V] + (F : P →ₗ[K] (V →ₗ[K] W)) (p q : P) : + measure F (p + q) ≤ measure F p + measure F q := by + simpa only [measure, map_add] using mapRank_add_le (F p) (F q) + +theorem measure_sum_le [FiniteDimensional K V] {ι : Type*} + (F : P →ₗ[K] (V →ₗ[K] W)) (s : Finset ι) (p : ι → P) : + measure F (∑ i ∈ s, p i) ≤ ∑ i ∈ s, measure F (p i) := by + simpa only [measure, map_sum] using mapRank_sum_le s (fun i => F (p i)) + +/-- Scalar coefficients introduce no extra rank cost, including zero coefficients. -/ +theorem measure_sum_smul_le [FiniteDimensional K V] {ι : Type*} + (F : P →ₗ[K] (V →ₗ[K] W)) (s : Finset ι) (a : ι → K) (p : ι → P) : + measure F (∑ i ∈ s, a i • p i) ≤ ∑ i ∈ s, measure F (p i) := by + refine (measure_sum_le F s _).trans ?_ + exact Finset.sum_le_sum fun i _ => measure_smul_le F (a i) (p i) + +/-- A sum of at most `s.card` contributions of rank at most `B` has rank at +most `s.card * B`. This is the gate-counting step for additive layers. -/ +theorem measure_sum_smul_le_card_mul [FiniteDimensional K V] {ι : Type*} + (F : P →ₗ[K] (V →ₗ[K] W)) (s : Finset ι) (a : ι → K) (p : ι → P) + (B : ℕ) (hB : ∀ i ∈ s, measure F (p i) ≤ B) : + measure F (∑ i ∈ s, a i • p i) ≤ s.card * B := by + refine (measure_sum_smul_le F s a p).trans ?_ + simpa using Finset.sum_le_sum hB + +/-- Each summand may factor through its own finite-dimensional intermediate +space, as occurs when bidegrees of the factors are fixed separately. -/ +theorem mapRank_sum_factor_le [FiniteDimensional K V] {ι : Type*} + {Z' : ι → Type y} [∀ i, AddCommGroup (Z' i)] [∀ i, Module K (Z' i)] + [∀ i, FiniteDimensional K (Z' i)] (s : Finset ι) + (f : ∀ i, V →ₗ[K] Z' i) (g : ∀ i, Z' i →ₗ[K] W) : + mapRank (∑ i ∈ s, (g i).comp (f i)) ≤ + ∑ i ∈ s, Module.finrank K (Z' i) := by + refine (mapRank_sum_le s _).trans ?_ + exact Finset.sum_le_sum fun i _ => mapRank_factor_le (f i) (g i) + +theorem measure_le_sum_of_factorizations [FiniteDimensional K V] {ι : Type*} + {Z' : ι → Type y} [∀ i, AddCommGroup (Z' i)] [∀ i, Module K (Z' i)] + [∀ i, FiniteDimensional K (Z' i)] + (F : P →ₗ[K] (V →ₗ[K] W)) (p : P) (s : Finset ι) + (f : ∀ i, V →ₗ[K] Z' i) (g : ∀ i, Z' i →ₗ[K] W) + (hF : F p = ∑ i ∈ s, (g i).comp (f i)) : + measure F p ≤ ∑ i ∈ s, Module.finrank K (Z' i) := by + rw [measure, hF] + exact mapRank_sum_factor_le s f g + +end RankMeasure +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RelaxedPaths.lean b/lean/OAI/Algebra/DepthFive/RelaxedPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..df16b4dd5a21612fc8644740febc9e6f63b5b534 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RelaxedPaths.lean @@ -0,0 +1,97 @@ +import OAI.Algebra.DepthFive.Pairings + +namespace OAI + +namespace Problem335.Pairings + +/-- The fixed labels at either external vertex. -/ +def constantLabels {α : Type*} (a : α) : Labels α := ⟨a, a, a, a⟩ + +@[simp] +theorem respects_constantLabels {α : Type*} (τ : Kind) (a : α) : + Respects τ (constantLabels a) := by + cases τ <;> simp [Respects, constantLabels] + +/-- Coordinates of the four paths in one layer are pairs of adjacent vertex labels. -/ +def zipLabels {α β : Type*} (x : Labels α) (y : Labels β) : Labels (α × β) := + ⟨(x.p, y.p), (x.q, y.q), (x.r, y.r), (x.s, y.s)⟩ + +@[simp] +theorem respects_zipLabels {α β : Type*} (τ : Kind) (x : Labels α) (y : Labels β) : + Respects τ (zipLabels x y) ↔ Respects τ x ∧ Respects τ y := by + cases τ <;> simp only [Respects, zipLabels, Prod.mk.injEq] <;> tauto + +/-- Add the two fixed external vertices to four paths specified by their internal labels. -/ +def closePaths {α : Type*} {L : ℕ} (a : α) (x : Fin L → Labels α) : + Fin (L + 2) → Labels α := + Fin.cases (constantLabels a) (Fin.lastCases (constantLabels a) x) + +@[simp] +theorem closePaths_zero {α : Type*} {L : ℕ} (a : α) (x : Fin L → Labels α) : + closePaths a x 0 = constantLabels a := rfl + +@[simp] +theorem closePaths_last {α : Type*} {L : ℕ} (a : α) (x : Fin L → Labels α) : + closePaths a x (Fin.last (L + 1)) = constantLabels a := by + simp [closePaths, ← Fin.succ_last] + +@[simp] +theorem closePaths_internal {α : Type*} {L : ℕ} (a : α) + (x : Fin L → Labels α) (i : Fin L) : + closePaths a x i.castSucc.succ = x i := by + simp [closePaths] + +/-- Layer constraints are exactly the independent constraints at internal vertices. -/ +theorem closePaths_compatible_iff {α : Type*} {L : ℕ} + (a : α) (τ : Fin (L + 1) → Kind) (x : Fin L → Labels α) : + (∀ t : Fin (L + 1), Respects (τ t) + (zipLabels (closePaths a x t.castSucc) (closePaths a x t.succ))) ↔ + ∀ i : Fin L, Respects (τ i.castSucc) (x i) ∧ Respects (τ i.succ) (x i) := by + simp only [respects_zipLabels] + constructor + · intro h i + constructor + · simpa using (h i.castSucc).2 + · simpa only [Fin.castSucc_succ, closePaths_internal] using (h i.succ).1 + · intro h t + constructor + · refine Fin.cases ?_ (fun i => ?_) t + · simp + · simpa only [Fin.castSucc_succ, closePaths_internal] using (h i).2 + · refine Fin.lastCases ?_ (fun i => ?_) t + · simp + · simpa using (h i).1 + +/-- Four endpoint-fixed paths respecting a prescribed relaxed pairing in every layer. -/ +abbrev RelaxedPaths (α : Type*) {L : ℕ} (a : α) (τ : Fin (L + 1) → Kind) := + {x : Fin L → Labels α // ∀ t : Fin (L + 1), Respects (τ t) + (zipLabels (closePaths a x t.castSucc) (closePaths a x t.succ))} + +/-- The explicit product decomposition used in the second trace count. -/ +def relaxedPathsEquivAssignments (α : Type*) {L : ℕ} + (a : α) (τ : Fin (L + 1) → Kind) : + RelaxedPaths α a τ ≃ Assignments α τ where + toFun x i := ⟨x.1 i, (closePaths_compatible_iff a τ x.1).mp x.2 i⟩ + invFun x := ⟨fun i => (x i).1, + (closePaths_compatible_iff a τ _).mpr (fun i => (x i).2)⟩ + left_inv _ := rfl + right_inv _ := rfl + +/-- Exact count of relaxed quadruples with fixed endpoints. -/ +theorem card_relaxedPaths (α : Type*) [Fintype α] [DecidableEq α] + {L : ℕ} (a : α) (τ : Fin (L + 1) → Kind) : + Fintype.card (RelaxedPaths α a τ) = + Fintype.card α ^ (2 * L - adjacentSwitches τ) := + (Fintype.card_congr (relaxedPathsEquivAssignments α a τ)).trans (card_assignments α τ) + +/-- Boolean-word form of the count, with false = normal and true = diagonal. -/ +theorem card_relaxedPaths_bool (α : Type*) [Fintype α] [DecidableEq α] + {L : ℕ} (a : α) (τ : Fin (L + 1) → Bool) : + Fintype.card (RelaxedPaths α a (fun i => boolKindEquiv (τ i))) = + Fintype.card α ^ (2 * L - adjacentSwitches τ) := by + rw [card_relaxedPaths, adjacentSwitches_comp_injective τ boolKindEquiv + boolKindEquiv.injective] + +end Problem335.Pairings + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RelaxedWeightBound.lean b/lean/OAI/Algebra/DepthFive/RelaxedWeightBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcc414e0adea5eb163429c4e34e1beace307e36c --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RelaxedWeightBound.lean @@ -0,0 +1,185 @@ +import OAI.Algebra.DepthFive.SecondMomentPairing +import OAI.Algebra.DepthFive.PairingWeights + +namespace OAI + +noncomputable section + +namespace Problem335.MomentPairing + +open scoped BigOperators +open Pairings + +/-- Normal pairing layers belonging to the derivative-variable group. -/ +def normalVLayers {L : ℕ} (isV : Fin (L + 1) → Bool) + (τ : Fin (L + 1) → Kind) : Finset (Fin (L + 1)) := + Finset.univ.filter (fun t => isV t = true ∧ τ t = .normal) + +def diagonalVCount {L : ℕ} (isV : Fin (L + 1) → Bool) + (τ : Fin (L + 1) → Kind) : ℕ := + (Finset.univ.filter (fun t => isV t = true ∧ τ t = .diagonal)).card + +def diagonalUCount {L : ℕ} (isV : Fin (L + 1) → Bool) + (τ : Fin (L + 1) → Kind) : ℕ := + (Finset.univ.filter (fun t => isV t = false ∧ τ t = .diagonal)).card + +def uLayerCount {L : ℕ} (isV : Fin (L + 1) → Bool) : ℕ := + (Finset.univ.filter (fun t => isV t = false)).card + +/-- The V correction before averaging the path labels. -/ +def normalVCorrection {γ : Type*} [DecidableEq γ] {L : ℕ} (isV : Fin (L + 1) → Bool) + (α : ℝ) (endpoint : γ) (τ : Fin (L + 1) → Kind) + (x : Fin L → Labels γ) : ℝ := + ∏ t : normalVLayers isV τ, + (1 + α⁻¹ * if (layerLabels endpoint x t).p = (layerLabels endpoint x t).r then 1 else 0) + +/-- Extract all diagonal weights and bound each U coincidence factor by `1+β`. -/ +theorem pathWeight_le_extracted {γ : Type*} [DecidableEq γ] {L : ℕ} + (isV : Fin (L + 1) → Bool) {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) + (endpoint : γ) (τ : Fin (L + 1) → Kind) (x : Fin L → Labels γ) : + pathWeight isV α β endpoint τ x ≤ + α⁻¹ ^ diagonalVCount isV τ * β ^ diagonalUCount isV τ * + (1 + β) ^ uLayerCount isV * normalVCorrection isV α endpoint τ x := by + classical + let vd (t : Fin (L + 1)) : ℝ := + if isV t = true ∧ τ t = .diagonal then α⁻¹ else 1 + let ud (t : Fin (L + 1)) : ℝ := + if isV t = false ∧ τ t = .diagonal then β else 1 + let ub (t : Fin (L + 1)) : ℝ := if isV t = false then 1 + β else 1 + let nv (t : Fin (L + 1)) : ℝ := + if isV t = true ∧ τ t = .normal then + 1 + α⁻¹ * if (layerLabels endpoint x t).p = (layerLabels endpoint x t).r then 1 else 0 + else 1 + have hlocal (t : Fin (L + 1)) : + layerWeight (if isV t then α⁻¹ else β) (τ t) (layerLabels endpoint x t) ≤ + vd t * ud t * ub t * nv t := by + cases hv : isV t <;> cases ht : τ t <;> + by_cases he : (layerLabels endpoint x t).p = (layerLabels endpoint x t).r <;> + simp [layerWeight, vd, ud, ub, nv, hv, ht, he] <;> nlinarith [sq_nonneg β] + have hprod : pathWeight isV α β endpoint τ x ≤ + (∏ t, vd t) * (∏ t, ud t) * (∏ t, ub t) * (∏ t, nv t) := by + unfold pathWeight + rw [← Finset.prod_mul_distrib, ← Finset.prod_mul_distrib, ← Finset.prod_mul_distrib] + apply Finset.prod_le_prod₀ + · intro t _ + apply layerWeight_nonneg + split <;> positivity + · intro t _ + exact hlocal t + have hvd : (∏ t, vd t) = α⁻¹ ^ diagonalVCount isV τ := by + simp only [vd, ← Finset.prod_filter, Finset.prod_const, diagonalVCount] + have hud : (∏ t, ud t) = β ^ diagonalUCount isV τ := by + simp only [ud, ← Finset.prod_filter, Finset.prod_const, diagonalUCount] + have hub : (∏ t, ub t) = (1 + β) ^ uLayerCount isV := by + simp only [ub, ← Finset.prod_filter, Finset.prod_const, uLayerCount] + have hnv : (∏ t, nv t) = normalVCorrection isV α endpoint τ x := by + simpa [nv, normalVCorrection, normalVLayers, Finset.prod_filter] using + (Finset.prod_coe_sort (normalVLayers isV τ) (fun t : Fin (L + 1) => + 1 + α⁻¹ * if (layerLabels endpoint x t).p = (layerLabels endpoint x t).r + then 1 else 0)).symm + simpa only [hvd, hud, hub, hnv] using hprod + +/-- The full weighted relaxed-quadruple bound used in the second trace. -/ +theorem sum_relaxed_pathWeight_le {γ : Type*} [Fintype γ] [DecidableEq γ] + [Nonempty γ] {L : ℕ} (isV : Fin (L + 1) → Bool) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) (endpoint : γ) + (τ : Fin (L + 1) → Kind) + (hs : Pairwise (fun t u : normalVLayers isV τ => + Disjoint (internalEndpointSet t.1) (internalEndpointSet u.1))) : + (∑ x : RelaxedPaths γ endpoint τ, pathWeight isV α β endpoint τ x.1) ≤ + α⁻¹ ^ diagonalVCount isV τ * β ^ diagonalUCount isV τ * + (1 + β) ^ uLayerCount isV * + ((Fintype.card γ : ℝ) ^ (2 * L - adjacentSwitches τ) * + ∏ t : normalVLayers isV τ, + (1 + α⁻¹ * (Fintype.card γ : ℝ)⁻¹ ^ + normalEndpointCount τ (internalEndpointSet t.1))) := by + classical + calc + _ ≤ ∑ x : RelaxedPaths γ endpoint τ, + (α⁻¹ ^ diagonalVCount isV τ * β ^ diagonalUCount isV τ * + (1 + β) ^ uLayerCount isV) * normalVCorrection isV α endpoint τ x.1 := by + apply Finset.sum_le_sum + intro x _ + exact pathWeight_le_extracted isV hα hβ endpoint τ x.1 + _ = _ := by + rw [← Finset.mul_sum] + congr 1 + exact sum_relaxedPaths_layer_corrections γ endpoint τ + (fun t : normalVLayers isV τ => t.1) hs (fun _ => α⁻¹) + +/-- The normalized pairing-word summand in the second-moment reduction. -/ +def relaxedWordWeight {L : ℕ} (isV : Fin (L + 1) → Bool) + (N α β : ℝ) (τ : Fin (L + 1) → Kind) : ℝ := + N⁻¹ ^ adjacentSwitches τ * α⁻¹ ^ diagonalVCount isV τ * β ^ diagonalUCount isV τ * + ∏ t : normalVLayers isV τ, + (1 + α⁻¹ * N⁻¹ ^ normalEndpointCount τ (internalEndpointSet t.1)) + +/-- Separate the free two-path count from the switch penalty. -/ +theorem assignmentPower_eq_normalized {L : ℕ} (τ : Fin (L + 1) → Kind) + {N : ℝ} (hN : N ≠ 0) : + N ^ (2 * L - adjacentSwitches τ) = N ^ (2 * L) * N⁻¹ ^ adjacentSwitches τ := by + have hsw : adjacentSwitches τ ≤ L := by + unfold adjacentSwitches + simpa using Finset.card_filter_le (Finset.univ : Finset (Fin L)) + (fun i => τ i.castSucc ≠ τ i.succ) + have hle : adjacentSwitches τ ≤ 2 * L := by omega + have heq : N ^ (2 * L) = N ^ (2 * L - adjacentSwitches τ) * + N ^ adjacentSwitches τ := by + rw [← pow_add, Nat.sub_add_cancel hle] + rw [heq, inv_pow, mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ hN), mul_one] + +/-- Full combinatorial moment reduction, summed over all pairing words. -/ +theorem sum_relaxed_pathWeight_le_wordSum {γ : Type*} [Fintype γ] [DecidableEq γ] + [Nonempty γ] {L : ℕ} (isV : Fin (L + 1) → Bool) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) (endpoint : γ) + (hs : ∀ τ : Fin (L + 1) → Kind, + Pairwise (fun t u : normalVLayers isV τ => + Disjoint (internalEndpointSet t.1) (internalEndpointSet u.1))) : + (∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight isV α β endpoint τ x.1) ≤ + (1 + β) ^ uLayerCount isV * (Fintype.card γ : ℝ) ^ (2 * L) * + ∑ τ : Fin (L + 1) → Kind, relaxedWordWeight isV (Fintype.card γ) α β τ := by + have hN : (Fintype.card γ : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + calc + _ ≤ ∑ τ : Fin (L + 1) → Kind, + (1 + β) ^ uLayerCount isV * (Fintype.card γ : ℝ) ^ (2 * L) * + relaxedWordWeight isV (Fintype.card γ) α β τ := by + apply Finset.sum_le_sum + intro τ _ + have h := sum_relaxed_pathWeight_le isV hα hβ endpoint τ (hs τ) + rw [assignmentPower_eq_normalized τ hN] at h + apply h.trans_eq + unfold relaxedWordWeight + ring + _ = _ := (Finset.mul_sum _ _ _).symm + +/-- Reindex all pairing words using the canonical false-normal, true-diagonal encoding. -/ +theorem sum_relaxedWordWeight_eq_bool {L : ℕ} (isV : Fin (L + 1) → Bool) + (N α β : ℝ) : + (∑ τ : Fin (L + 1) → Kind, relaxedWordWeight isV N α β τ) = + ∑ w : Fin (L + 1) → Bool, + relaxedWordWeight isV N α β (fun t => boolKindEquiv (w t)) := by + exact (Equiv.sum_comp (Equiv.piCongrRight (fun _ : Fin (L + 1) => boolKindEquiv)) + (relaxedWordWeight isV N α β)).symm + +/-- Consume a Boolean-word estimate after the full relaxed-path averaging. -/ +theorem sum_relaxed_pathWeight_le_of_boolWordSum {γ : Type*} [Fintype γ] + [DecidableEq γ] [Nonempty γ] {L : ℕ} (isV : Fin (L + 1) → Bool) + {α β B : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) (endpoint : γ) + (hs : ∀ τ : Fin (L + 1) → Kind, + Pairwise (fun t u : normalVLayers isV τ => + Disjoint (internalEndpointSet t.1) (internalEndpointSet u.1))) + (hword : (∑ w : Fin (L + 1) → Bool, + relaxedWordWeight isV (Fintype.card γ) α β (fun t => boolKindEquiv (w t))) ≤ B) : + (∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight isV α β endpoint τ x.1) ≤ + (1 + β) ^ uLayerCount isV * (Fintype.card γ : ℝ) ^ (2 * L) * B := by + apply (sum_relaxed_pathWeight_le_wordSum isV hα hβ endpoint hs).trans + rw [sum_relaxedWordWeight_eq_bool] + exact mul_le_mul_of_nonneg_left hword (by positivity) + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RelaxedWordBridge.lean b/lean/OAI/Algebra/DepthFive/RelaxedWordBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e3472affbed3c3219cb0f95fa1bbe9a427d5b81 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RelaxedWordBridge.lean @@ -0,0 +1,75 @@ +import OAI.Algebra.DepthFive.RelaxedWeightBound +import OAI.Algebra.DepthFive.PairingNeighborCount + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.MomentPairing +open Pairings + +/-- The averaged pairing summand is exactly the canonical Boolean-word weight. -/ +theorem relaxedWordWeight_eq_isolatedWeight {L : ℕ} + (isV w : Fin (L + 1) → Bool) (N α β : ℝ) : + relaxedWordWeight isV N α β (fun i => boolKindEquiv (w i)) = + IsolatedWeight.weight (BalancedSchedule.internalEdges (L + 1)) + (Finset.univ.filter (fun i => isV i = true)) + BalancedSchedule.adjacent α⁻¹ β N⁻¹ w := by + classical + have hn (b : Bool) : boolKindEquiv b = Kind.normal ↔ b = false := by + cases b <;> simp + have hd (b : Bool) : boolKindEquiv b = Kind.diagonal ↔ b = true := by + cases b <;> simp + have hs : adjacentSwitches (fun i => boolKindEquiv (w i)) = + SwitchRestoration.switchCount (BalancedSchedule.internalEdges (L + 1)) w := by + rw [BalancedSchedule.internalEdges_eq_pathEdges, SwitchRestoration.switchCount_pathEdges] + simp only [adjacentSwitches, Finset.card_filter] + apply Finset.sum_congr rfl + intro i _ + simp only [show (boolKindEquiv (w i.castSucc) ≠ boolKindEquiv (w i.succ)) ↔ + w i.castSucc ≠ w i.succ from not_congr boolKindEquiv.injective.eq_iff] + have hv : diagonalVCount isV (fun i => boolKindEquiv (w i)) = + ((Finset.univ.filter (fun i => isV i = true)).filter (fun i => w i = true)).card := by + simp only [diagonalVCount, hd, Finset.filter_filter] + have hu : diagonalUCount isV (fun i => boolKindEquiv (w i)) = + ((Finset.univ \ Finset.univ.filter (fun i => isV i = true)).filter + (fun i => w i = true)).card := by + unfold diagonalUCount + congr 1 + ext i + simp only [ Finset.mem_filter, Finset.mem_sdiff, Finset.mem_univ, + true_and, hd] + cases isV i <;> simp + have hnV : normalVLayers isV (fun i => boolKindEquiv (w i)) = + (Finset.univ.filter (fun i => isV i = true)).filter (fun i => w i = false) := by + ext i + simp [normalVLayers, hn] + unfold relaxedWordWeight IsolatedWeight.weight + rw [hs, hv, hu, correction_eq_normalEndpointCount_product] + congr 1 + simpa only [hnV] using + (Finset.prod_coe_sort (normalVLayers isV (fun i => boolKindEquiv (w i))) + (fun t : Fin (L + 1) => 1 + α⁻¹ * N⁻¹ ^ + normalEndpointCount (fun i => boolKindEquiv (w i)) (internalEndpointSet t))) + +/-- Reindexing all pairing words through the canonical Boolean equivalence. -/ +theorem sum_relaxedWordWeight_eq_isolatedWeight {L : ℕ} + (isV : Fin (L + 1) → Bool) (N α β : ℝ) : + (∑ τ : Fin (L + 1) → Kind, relaxedWordWeight isV N α β τ) = + ∑ w : Fin (L + 1) → Bool, + IsolatedWeight.weight (BalancedSchedule.internalEdges (L + 1)) + (Finset.univ.filter (fun i => isV i = true)) + BalancedSchedule.adjacent α⁻¹ β N⁻¹ w := by + let e : (Fin (L + 1) → Bool) ≃ (Fin (L + 1) → Kind) := + Equiv.piCongrRight (fun _ => boolKindEquiv) + symm + apply Fintype.sum_equiv e + intro w + exact (relaxedWordWeight_eq_isolatedWeight isV w N α β).symm + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RunBlocks.lean b/lean/OAI/Algebra/DepthFive/RunBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..f42ba71c4ce026c2f73f183612f8e8c6be018c62 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RunBlocks.lean @@ -0,0 +1,208 @@ +import OAI.Algebra.DepthFive.WordRuns + +namespace OAI + +/-! Contiguous true blocks, with an exact block-count and product factorization. -/ + +open scoped BigOperators + +namespace Problem335.WordRuns + +variable {α : Type*} + +/-- Split a list at false positions, retaining a possibly empty initial block. -/ +def splitTrueAux (p : α → Bool) : List α → List α × List (List α) + | [] => ([], []) + | a :: l => + let q := splitTrueAux p l + if p a then (a :: q.1, q.2) else ([], q.1 :: q.2) + +/-- The nonempty maximal contiguous blocks of positions satisfying `p`. -/ +def trueBlocks (p : α → Bool) (l : List α) : List (List α) := + let q := splitTrueAux p l + (q.1 :: q.2).filter (fun b => !b.isEmpty) + +@[simp] theorem splitTrueAux_fst_nil_cons (p : α → Bool) (a : α) (l : List α) : + (splitTrueAux p (a :: l)).1 = [] ↔ p a = false := by + cases hp : p a <;> simp [splitTrueAux, hp] + +/-- The initial block is genuinely a prefix, including when empty. -/ +theorem splitTrueAux_fst_prefix (p : α → Bool) (l : List α) : + (splitTrueAux p l).1 <+: l := by + induction l with + | nil => simp [splitTrueAux] + | cons a l ih => + cases hp : p a <;> simp [splitTrueAux, hp, ih] + +/-- Splitting does not lose or duplicate any selected position. -/ +theorem splitTrueAux_flatten (p : α → Bool) (l : List α) : + (splitTrueAux p l).1 ++ (splitTrueAux p l).2.flatten = l.filter p := by + induction l with + | nil => simp [splitTrueAux] + | cons a l ih => + cases hp : p a <;> simp [splitTrueAux, hp, ih] + +@[simp] theorem trueBlocks_flatten (p : α → Bool) (l : List α) : + (trueBlocks p l).flatten = l.filter p := by + simpa [trueBlocks, List.flatten_filter_not_isEmpty] using splitTrueAux_flatten p l + +/-- Every retained block is nonempty. -/ +theorem trueBlocks_ne_nil (p : α → Bool) (l : List α) {b : List α} + (hb : b ∈ trueBlocks p l) : b ≠ [] := by + have h := (List.mem_filter.mp hb).2 + simpa using h + +private theorem splitTrueAux_infix (p : α → Bool) (l : List α) : + ∀ b ∈ (splitTrueAux p l).1 :: (splitTrueAux p l).2, b <:+: l := by + induction l with + | nil => simp [splitTrueAux] + | cons a l ih => + intro b hb + cases hp : p a with + | false => + simp only [splitTrueAux, hp, Bool.false_eq_true, ↓reduceIte, List.mem_cons] at hb + rcases hb with rfl | hb + · exact List.nil_infix + · exact List.infix_cons (ih _ (List.mem_cons.mpr hb)) + | true => + simp only [splitTrueAux, hp, ↓reduceIte, List.mem_cons] at hb + rcases hb with rfl | hb + · exact (show a :: (splitTrueAux p l).1 <+: a :: l from + List.cons_prefix_cons.mpr ⟨rfl, splitTrueAux_fst_prefix p l⟩).isInfix + · exact List.infix_cons (ih _ (List.mem_cons_of_mem _ hb)) + +/-- Every true block is a contiguous interval of the original ordered list. -/ +theorem trueBlocks_infix (p : α → Bool) (l : List α) {b : List α} + (hb : b ∈ trueBlocks p l) : b <:+: l := + splitTrueAux_infix p l b (List.mem_filter.mp hb).1 + +/-- Every member of a true block satisfies the selection predicate. -/ +theorem trueBlocks_all_true (p : α → Bool) (l : List α) {b : List α} + (hb : b ∈ trueBlocks p l) {a : α} (ha : a ∈ b) : p a = true := by + have hmem : a ∈ (trueBlocks p l).flatten := List.mem_flatten.mpr ⟨b, hb, ha⟩ + rw [trueBlocks_flatten] at hmem + exact (List.mem_filter.mp hmem).2 + +/-- Adding one letter either extends the first block or creates one new block. -/ +theorem trueBlocks_length_cons (p : α → Bool) (a : α) (l : List α) : + (trueBlocks p (a :: l)).length = (trueBlocks p l).length + + if p a = true ∧ (splitTrueAux p l).1 = [] then 1 else 0 := by + unfold trueBlocks + cases hq : splitTrueAux p l with + | mk r rs => + cases hp : p a <;> cases r <;> simp [splitTrueAux, hp, hq] + +/-- For a nonempty list of word positions, block count is the true run count. -/ +theorem trueBlocks_ofFn_length {n : ℕ} (w : Fin (n + 1) → Bool) : + (trueBlocks w (List.ofFn id)).length = runCount w := by + have hgen : ∀ (α : Type) (m : ℕ) (f : Fin (m + 1) → α) (p : α → Bool), + (trueBlocks p (List.ofFn f)).length = runCount (p ∘ f) := by + intro α m + induction m with + | zero => + intro f p + simp [List.ofFn_succ, List.ofFn_zero, trueBlocks, splitTrueAux, runCount, riseCount] + cases p (f 0) <;> rfl + | succ m ih => + intro f p + rw [List.ofFn_succ, trueBlocks_length_cons] + change (trueBlocks p (List.ofFn (Fin.tail f))).length + + (if p (f 0) = true ∧ (splitTrueAux p (List.ofFn (Fin.tail f))).1 = [] + then 1 else 0) = runCount (p ∘ f) + have htail := ih (Fin.tail f) p + rw [htail] + have hempty : (splitTrueAux p (List.ofFn (Fin.tail f))).1 = [] ↔ + p (f 1) = false := by + rw [List.ofFn_succ, splitTrueAux_fst_nil_cons] + rfl + simp only [hempty] + have hb := rise_first_eq_fall_last (p ∘ f) + have hbt := rise_first_eq_fall_last (p ∘ Fin.tail f) + have hfall : fallCount (p ∘ f) = + (if p (f 0) = true ∧ p (f 1) = false then 1 else 0) + + fallCount (p ∘ Fin.tail f) := by + have heq : p ∘ f = Fin.cons (p (f 0)) (p ∘ Fin.tail f) := by + funext i + cases i using Fin.cases <;> rfl + rw [heq, fallCount_cons] + rfl + have hlast : (p ∘ Fin.tail f) (Fin.last m) = (p ∘ f) (Fin.last (m + 1)) := rfl + unfold runCount + rw [hlast] at hbt + omega + simpa using hgen (Fin (n + 1)) n (id : Fin (n + 1) → Fin (n + 1)) w + +/-- Products over selected positions factor exactly into products over true blocks. -/ +theorem trueBlocks_prod {R : Type*} [Monoid R] (p : α → Bool) (l : List α) (f : α → R) : + ((l.filter p).map f).prod = + ((trueBlocks p l).map (fun b => (b.map f).prod)).prod := by + rw [← trueBlocks_flatten p l, List.map_flatten, List.prod_flatten, List.map_map] + rfl + +/-- A uniform bound on each interval multiplies once per true run. -/ +theorem selected_prod_le_pow_runCount {n : ℕ} (w : Fin (n + 1) → Bool) + (f : Fin (n + 1) → ℝ) (B : ℝ) (hf : ∀ i, 0 ≤ f i) + (hB : ∀ b ∈ trueBlocks w (List.ofFn id), (b.map f).prod ≤ B) : + (((List.ofFn id).filter w).map f).prod ≤ B ^ runCount w := by + rw [trueBlocks_prod, ← trueBlocks_ofFn_length] + have hnonneg : ∀ b ∈ trueBlocks w (List.ofFn id), 0 ≤ (b.map f).prod := by + intro b hb + apply List.prod_nonneg + intro x hx + obtain ⟨i, _, rfl⟩ := List.mem_map.mp hx + exact hf i + have h := List.prod_map_le_prod_map₀ (fun b : List (Fin (n + 1)) => (b.map f).prod) + (fun _ => B) hnonneg hB + simpa [List.map_const, List.prod_replicate] using h + +/-- Additive statistics are also exactly preserved by the block partition. -/ +theorem trueBlocks_sum {R : Type*} [AddMonoid R] + (p : α → Bool) (l : List α) (g : α → R) : + ((l.filter p).map g).sum = + ((trueBlocks p l).map (fun b => (b.map g).sum)).sum := by + rw [← trueBlocks_flatten p l, List.map_flatten, List.sum_flatten, List.map_map] + rfl + +/-- Counts in any second layer partition add across the true blocks. -/ +theorem trueBlocks_countP (p q : α → Bool) (l : List α) : + ((trueBlocks p l).map (List.countP q)).sum = (l.filter p).countP q := by + rw [← List.countP_flatten, trueBlocks_flatten] + +/-- Total lengths of the runs count exactly the selected positions. -/ +theorem trueBlocks_sum_length (p : α → Bool) (l : List α) : + ((trueBlocks p l).map List.length).sum = (l.filter p).length := by + rw [← List.length_flatten, trueBlocks_flatten] + +private theorem prod_run_majorants (B : ℝ) (g : α → ℝ) (bs : List (List α)) : + (bs.map (fun b => B * Real.exp ((b.map g).sum))).prod = + B ^ bs.length * Real.exp (((bs.flatten).map g).sum) := by + induction bs with + | nil => simp + | cons b bs ih => + simp only [List.map_cons, List.prod_cons, List.length_cons, List.flatten_cons, + List.map_append, List.sum_append, ih, Real.exp_add, pow_succ] + ring + +/-- Interval majorants with local exponential losses multiply once per run, +while the exponential losses add only once per selected position. -/ +theorem selected_prod_le_pow_runCount_mul_exp {n : ℕ} + (w : Fin (n + 1) → Bool) (f g : Fin (n + 1) → ℝ) (B : ℝ) + (hf : ∀ i, 0 ≤ f i) + (hB : ∀ b ∈ trueBlocks w (List.ofFn id), + (b.map f).prod ≤ B * Real.exp ((b.map g).sum)) : + (((List.ofFn id).filter w).map f).prod ≤ + B ^ runCount w * Real.exp ((((List.ofFn id).filter w).map g).sum) := by + rw [trueBlocks_prod] + have hnonneg : ∀ b ∈ trueBlocks w (List.ofFn id), 0 ≤ (b.map f).prod := by + intro b hb + apply List.prod_nonneg + intro x hx + obtain ⟨i, _, rfl⟩ := List.mem_map.mp hx + exact hf i + have h := List.prod_map_le_prod_map₀ (fun b : List (Fin (n + 1)) => (b.map f).prod) + (fun b => B * Real.exp ((b.map g).sum)) hnonneg hB + rwa [prod_run_majorants, trueBlocks_ofFn_length, trueBlocks_flatten] at h + +end Problem335.WordRuns + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RunLayerWeights.lean b/lean/OAI/Algebra/DepthFive/RunLayerWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f3dde3197e775eb817abfea0b6afadc107029a8 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RunLayerWeights.lean @@ -0,0 +1,145 @@ +import OAI.Algebra.DepthFive.RunBlocks +import OAI.Algebra.DepthFive.RunWeights + +namespace OAI + +/-! Concrete layer weights combined with contiguous true-run decomposition. -/ + +open scoped BigOperators + +namespace Problem335.RunLayerWeights + +variable {ι : Type*} + +/-- A product of two possible layer weights depends only on the two layer counts. -/ +theorem prod_ite_eq_powers {R : Type*} [CommMonoid R] + (p : ι → Bool) (l : List ι) (a b : R) : + (l.map (fun i => if p i then a else b)).prod = + a ^ l.countP p * b ^ l.countP (fun i => !p i) := by + induction l with + | nil => simp + | cons i l ih => + cases hp : p i <;> simp [hp, ih, pow_succ, mul_assoc, mul_left_comm, mul_comm] + +/-- The derivative/multiplication layer product in the notation of the manuscript. -/ +theorem layer_product_eq (p : ι → Bool) (l : List ι) (α β : ℝ) (hα : 0 < α) : + (l.map (fun i => if p i then α⁻¹ else β)).prod = + α ^ (-(l.countP p : ℝ)) * β ^ l.countP (fun i => !p i) := by + rw [prod_ite_eq_powers] + congr 1 + rw [Real.rpow_neg hα.le, Real.rpow_natCast, inv_pow] + +/-- The rounding loss counts only multiplication layers. -/ +theorem layer_loss_sum_eq (p : ι → Bool) (l : List ι) (ε : ℝ) : + (l.map (fun i => if p i then 0 else ε)).sum = + ε * (l.countP (fun i => !p i) : ℝ) := by + induction l with + | nil => simp + | cons i l ih => + cases hp : p i <;> simp [hp, ih, Nat.cast_add, mul_add, add_comm] + +/-- An interval discrepancy bound gives the required majorant on each true block. -/ +theorem selected_layer_product_le {n : ℕ} + (isV w : Fin (n + 1) → Bool) {α β ρ ε N : ℝ} + (hα : 0 < α) (hα1 : α ≤ 1) (hβ : 0 ≤ β) + (hβupper : β ≤ α ^ ρ * Real.exp ε) (hscale : α ^ (-(1 + ρ)) ≤ N) + (hdiscrepancy : ∀ b : List (Fin (n + 1)), b <:+: List.ofFn id → + (b.countP isV : ℝ) - ρ * b.countP (fun i => !isV i) ≤ 1 + ρ) : + ((((List.ofFn id).filter w).map (fun i => if isV i then α⁻¹ else β))).prod ≤ + N ^ WordRuns.runCount w * + Real.exp (ε * (((List.ofFn id).filter w).countP (fun i => !isV i) : ℝ)) := by + have h := WordRuns.selected_prod_le_pow_runCount_mul_exp w + (fun i => if isV i then α⁻¹ else β) (fun i => if isV i then 0 else ε) N + (by intro i; split <;> positivity) ?_ + · simpa only [layer_loss_sum_eq] using h + · intro b hb + rw [layer_product_eq isV b α β hα, layer_loss_sum_eq] + exact RunWeights.interval_weight_le hα hα1 hβ hβupper hscale _ _ + (hdiscrepancy b (WordRuns.trueBlocks_infix w (List.ofFn id) hb)) + +/-- The total rounding cost is bounded by the length of the entire word. -/ +theorem selected_layer_product_le_length {n : ℕ} + (isV w : Fin (n + 1) → Bool) {α β ρ ε N : ℝ} + (hα : 0 < α) (hα1 : α ≤ 1) (hβ : 0 ≤ β) (hε : 0 ≤ ε) + (hβupper : β ≤ α ^ ρ * Real.exp ε) (hscale : α ^ (-(1 + ρ)) ≤ N) + (hdiscrepancy : ∀ b : List (Fin (n + 1)), b <:+: List.ofFn id → + (b.countP isV : ℝ) - ρ * b.countP (fun i => !isV i) ≤ 1 + ρ) : + ((((List.ofFn id).filter w).map (fun i => if isV i then α⁻¹ else β))).prod ≤ + N ^ WordRuns.runCount w * Real.exp (ε * (n + 1 : ℕ)) := by + have hN : 0 ≤ N := (Real.rpow_nonneg hα.le _).trans hscale + apply (selected_layer_product_le isV w hα hα1 hβ hβupper hscale hdiscrepancy).trans + apply mul_le_mul_of_nonneg_left _ (pow_nonneg hN _) + apply Real.exp_le_exp.mpr + apply mul_le_mul_of_nonneg_left _ hε + exact_mod_cast (List.countP_le_length.trans (List.length_filter_le _ _)).trans + (by simp : (List.ofFn (id : Fin (n + 1) → Fin (n + 1))).length ≤ n + 1) + +/-- Transfer discrepancy bounds from a Boolean layer schedule to lists of its positions. -/ +theorem indexed_discrepancy_of_word_discrepancy {n : ℕ} + (isV : Fin n → Bool) (ρ : ℝ) + (h : ∀ l : List Bool, l <:+: List.ofFn isV → + (l.count true : ℝ) - ρ * l.count false ≤ 1 + ρ) : + ∀ b : List (Fin n), b <:+: List.ofFn id → + (b.countP isV : ℝ) - ρ * b.countP (fun i => !isV i) ≤ 1 + ρ := by + intro b hb + have hm : b.map isV <:+: List.ofFn isV := by + simpa using hb.map isV + have hh := h (b.map isV) hm + have ht : (b.map isV).count true = b.countP isV := by + clear hb hm hh h + induction b with + | nil => simp + | cons i b ih => cases hi : isV i <;> simp [hi, ih] + have hf : (b.map isV).count false = b.countP (fun i => !isV i) := by + clear hb hm hh ht h + induction b with + | nil => simp + | cons i b ih => cases hi : isV i <;> simp [hi, ih] + simpa only [ht, hf] using hh + +/-- List counts on the selected positions coincide with the finite-set cardinality. -/ +theorem selected_countP_eq_card {n : ℕ} (w : Fin n → Bool) (V : Finset (Fin n)) : + ((List.ofFn id).filter w).countP (fun i => decide (i ∈ V)) = + (V.filter (fun i => w i = true)).card := by + rw [List.countP_eq_length_filter] + have hn : (((List.ofFn (id : Fin n → Fin n)).filter w).filter + (fun i => decide (i ∈ V))).Nodup := + ((List.nodup_ofFn.mpr Function.injective_id).filter _).filter _ + rw [← List.toFinset_card_of_nodup hn] + congr 1 + ext i + simp [and_comm] + +/-- The local layer product is exactly the count-based weight used by isolated flipping. -/ +theorem selected_layer_product_eq_powers {n : ℕ} (w : Fin n → Bool) + (V : Finset (Fin n)) (A B : ℝ) : + ((((List.ofFn id).filter w).map (fun i => if i ∈ V then A else B))).prod = + A ^ (V.filter (fun i => w i = true)).card * + B ^ ((Finset.univ \ V).filter (fun i => w i = true)).card := by + have hp := prod_ite_eq_powers (fun i : Fin n => decide (i ∈ V)) + ((List.ofFn id).filter w) A B + have hV := selected_countP_eq_card w V + have hU := selected_countP_eq_card w (Finset.univ \ V) + simp only [Finset.mem_sdiff, Finset.mem_univ, true_and, decide_not] at hU + simpa only [decide_eq_true_eq, hV, hU] using hp + +/-- Exact count-based per-word estimate consumed by the corrected word-sum proof. -/ +theorem count_weight_le_exp_mul_runCount {n : ℕ} (w : Fin (n + 1) → Bool) + (V : Finset (Fin (n + 1))) {α β ρ ε N : ℝ} + (hα : 0 < α) (hα1 : α ≤ 1) (hβ : 0 ≤ β) (hε : 0 ≤ ε) + (hβupper : β ≤ α ^ ρ * Real.exp ε) (hscale : α ^ (-(1 + ρ)) ≤ N) + (hdiscrepancy : ∀ b : List (Fin (n + 1)), b <:+: List.ofFn id → + (b.countP (fun i => decide (i ∈ V)) : ℝ) - + ρ * b.countP (fun i => !decide (i ∈ V)) ≤ 1 + ρ) : + (α⁻¹) ^ (V.filter (fun i => w i = true)).card * + β ^ ((Finset.univ \ V).filter (fun i => w i = true)).card ≤ + Real.exp (ε * (n + 1 : ℕ)) * N ^ WordRuns.runCount w := by + have h := selected_layer_product_le_length (fun i => decide (i ∈ V)) w + hα hα1 hβ hε hβupper hscale hdiscrepancy + simp only [decide_eq_true_eq] at h + rw [selected_layer_product_eq_powers] at h + simpa only [mul_comm] using h + +end Problem335.RunLayerWeights + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RunSum.lean b/lean/OAI/Algebra/DepthFive/RunSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7f89be8a6817056d769a28d6b3d49576559f05b --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RunSum.lean @@ -0,0 +1,201 @@ +import OAI.Algebra.DepthFive.WordRuns + +namespace OAI + +/-! Quantitative run-weight sums for the path-type estimate. -/ + +open scoped BigOperators + +namespace Problem335.RunSum + +/-- The inequality form also includes the constant all-true word. -/ +theorem switches_card_le_two_interior_add_two {n : ℕ} (w : Fin (n + 1) → Bool) : + (WordSwitches.switches w).card ≤ 2 * WordRuns.interiorRunCount w + 2 := by + rw [WordRuns.switches_card_eq_rises_add_falls] + have h := WordRuns.rise_first_eq_fall_last w + unfold WordRuns.interiorRunCount WordRuns.runCount WordRuns.endpointRunCount + cases hfirst : w 0 <;> cases hlast : w (Fin.last n) <;> simp_all <;> omega + +/-- A pointwise switch-weight bound gives an exponential bound after summing all words. -/ +theorem sum_le_exp_of_switch_bound (n : ℕ) (q A : ℝ) (hq : 0 ≤ q) (hA : 0 ≤ A) + (F : (Fin (n + 1) → Bool) → ℝ) + (hF : ∀ w, F w ≤ A * q ^ (WordSwitches.switches w).card) : + (∑ w, F w) ≤ 2 * A * Real.exp ((n : ℝ) * q) := by + calc + (∑ w, F w) ≤ ∑ w, A * q ^ (WordSwitches.switches w).card := + Finset.sum_le_sum (fun w _ => hF w) + _ = A * ∑ w, q ^ (WordSwitches.switches w).card := (Finset.mul_sum _ _ _).symm + _ ≤ A * (2 * Real.exp ((n : ℝ) * q)) := + mul_le_mul_of_nonneg_left (WordSwitches.sum_pow_switches_le_exp n q hq) hA + _ = 2 * A * Real.exp ((n : ℝ) * q) := by ring + +/-- The sum of the interior-run weights is controlled by the switch generating function. -/ +theorem sum_pow_two_interiorRuns_le (n : ℕ) (q : ℝ) (hq : 0 < q) (hq1 : q ≤ 1) : + (∑ w : Fin (n + 1) → Bool, q ^ (2 * WordRuns.interiorRunCount w)) ≤ + 2 * (q ^ 2)⁻¹ * Real.exp ((n : ℝ) * q) := by + apply sum_le_exp_of_switch_bound n q ((q ^ 2)⁻¹) hq.le (by positivity) + intro w + calc + q ^ (2 * WordRuns.interiorRunCount w) = + (q ^ 2)⁻¹ * q ^ (2 * WordRuns.interiorRunCount w + 2) := by + rw [pow_add] + field_simp + _ ≤ (q ^ 2)⁻¹ * q ^ (WordSwitches.switches w).card := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + exact pow_le_pow_of_le_one hq.le hq1 (switches_card_le_two_interior_add_two w) + +/-- A convenient quantitative form of the run-count estimate in the path-word argument. -/ +theorem sum_inv_pow_interiorRuns_le (n : ℕ) : + (∑ w : Fin (n + 1) → Bool, (((n + 1 : ℕ) : ℝ)⁻¹) ^ WordRuns.interiorRunCount w) ≤ + 2 * ((n + 1 : ℕ) : ℝ) * Real.exp (Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + let N : ℝ := ((n + 1 : ℕ) : ℝ) + have hN : 0 < N := by dsimp [N]; positivity + have hN1 : 1 ≤ N := by dsimp [N]; exact_mod_cast Nat.succ_le_succ (Nat.zero_le n) + have hs : 0 < Real.sqrt N := Real.sqrt_pos.mpr hN + have hs1 : 1 ≤ Real.sqrt N := by + exact (Real.le_sqrt (by norm_num) hN.le).mpr (by simpa using hN1) + have hq : 0 < (Real.sqrt N)⁻¹ := inv_pos.mpr hs + have hq1 : (Real.sqrt N)⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hs1 + have hq2 : ((Real.sqrt N)⁻¹) ^ 2 = N⁻¹ := by + rw [inv_pow, Real.sq_sqrt hN.le] + have hpow (w : Fin (n + 1) → Bool) : + ((Real.sqrt N)⁻¹) ^ (2 * WordRuns.interiorRunCount w) = N⁻¹ ^ WordRuns.interiorRunCount w := by + rw [pow_mul, hq2] + have h := sum_pow_two_interiorRuns_le n ((Real.sqrt N)⁻¹) hq hq1 + simp_rw [hpow, hq2, inv_inv] at h + have hexponent : (n : ℝ) * (Real.sqrt N)⁻¹ ≤ Real.sqrt N := by + rw [← div_eq_mul_inv] + apply (div_le_iff₀ hs).mpr + have hsq := Real.sq_sqrt hN.le + have hnN : (n : ℝ) + 1 = N := by simp [N] + nlinarith + exact h.trans (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hexponent) (by positivity)) + +/-- Absorb the polynomial factor in the elementary run estimate into a square-root exponential. -/ +theorem two_mul_self_mul_exp_sqrt_le {x : ℝ} (hx : 1 ≤ x) : + 2 * x * Real.exp (Real.sqrt x) ≤ Real.exp (4 * Real.sqrt x) := by + have hx0 : 0 ≤ x := le_trans (by norm_num) hx + have hs1 : 1 ≤ Real.sqrt x := (Real.le_sqrt (by norm_num) hx0).mpr (by simpa using hx) + have hs0 := Real.sqrt_nonneg x + have h2 : 2 ≤ Real.exp (Real.sqrt x) := by linarith [Real.add_one_le_exp (Real.sqrt x)] + have hs : Real.sqrt x ≤ Real.exp (Real.sqrt x) := by linarith [Real.add_one_le_exp (Real.sqrt x)] + have hxx : x ≤ Real.exp (2 * Real.sqrt x) := by + calc + x = Real.sqrt x ^ 2 := (Real.sq_sqrt hx0).symm + _ ≤ Real.exp (Real.sqrt x) ^ 2 := pow_le_pow_left₀ hs0 hs 2 + _ = Real.exp (2 * Real.sqrt x) := by simpa using (Real.exp_nat_mul (Real.sqrt x) 2).symm + calc + 2 * x * Real.exp (Real.sqrt x) ≤ + Real.exp (Real.sqrt x) * Real.exp (2 * Real.sqrt x) * Real.exp (Real.sqrt x) := by + exact mul_le_mul_of_nonneg_right (mul_le_mul h2 hxx hx0 (Real.exp_nonneg _)) (Real.exp_nonneg _) + _ = Real.exp (4 * Real.sqrt x) := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + +/-- The full run-weight sum is at most `exp (4 sqrt(length))`, with an explicit absolute constant. -/ +theorem sum_inv_pow_interiorRuns_le_exp (n : ℕ) : + (∑ w : Fin (n + 1) → Bool, (((n + 1 : ℕ) : ℝ)⁻¹) ^ WordRuns.interiorRunCount w) ≤ + Real.exp (4 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + exact (sum_inv_pow_interiorRuns_le n).trans + (two_mul_self_mul_exp_sqrt_le (by exact_mod_cast Nat.succ_le_succ (Nat.zero_le n))) + +/-- Application form: any pointwise run-weight estimate can be summed with the same absolute loss. -/ +theorem sum_le_exp_of_interiorRun_bound (n : ℕ) (C : ℝ) + (F : (Fin (n + 1) → Bool) → ℝ) + (hF : ∀ w, F w ≤ Real.exp C * (((n + 1 : ℕ) : ℝ)⁻¹) ^ WordRuns.interiorRunCount w) : + (∑ w, F w) ≤ Real.exp (C + 4 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + calc + (∑ w, F w) ≤ ∑ w, Real.exp C * (((n + 1 : ℕ) : ℝ)⁻¹) ^ WordRuns.interiorRunCount w := + Finset.sum_le_sum (fun w _ => hF w) + _ = Real.exp C * ∑ w, (((n + 1 : ℕ) : ℝ)⁻¹) ^ WordRuns.interiorRunCount w := + (Finset.mul_sum _ _ _).symm + _ ≤ Real.exp C * Real.exp (4 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := + mul_le_mul_of_nonneg_left (sum_inv_pow_interiorRuns_le_exp n) (Real.exp_nonneg C) + _ = Real.exp (C + 4 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := (Real.exp_add _ _).symm + + +/-- Counting both endpoint bits (including twice for a constant true run) gives an exact balance. -/ +theorem switches_card_add_endpoint_eq_two_runs {n : ℕ} (w : Fin (n + 1) → Bool) : + (WordSwitches.switches w).card + WordRuns.endpointRunCount w = + 2 * WordRuns.runCount w := by + rw [WordRuns.switches_card_eq_rises_add_falls] + have h := WordRuns.rise_first_eq_fall_last w + unfold WordRuns.runCount WordRuns.endpointRunCount + omega + +/-- Switch penalties pay for all but at most one square scale of the run weights. +The constant words are included, so no exceptional-case partition is needed. -/ +theorem switch_penalty_mul_run_weight_le {n : ℕ} (w : Fin (n + 1) → Bool) + {N : ℝ} (hN : 1 ≤ N) : + N⁻¹ ^ (WordSwitches.switches w).card * N ^ WordRuns.runCount w ≤ + N * (Real.sqrt N)⁻¹ ^ (WordSwitches.switches w).card := by + have hN0 : 0 < N := lt_of_lt_of_le (by norm_num) hN + have hs0 : 0 < Real.sqrt N := Real.sqrt_pos.mpr hN0 + have hs1 : 1 ≤ Real.sqrt N := (Real.le_sqrt (by norm_num) hN0.le).mpr (by simpa using hN) + have he := switches_card_add_endpoint_eq_two_runs w + have he2 := WordRuns.endpointRunCount_le_two w + have hr : 2 * WordRuns.runCount w ≤ (WordSwitches.switches w).card + 2 := by omega + have hpow : N ^ WordRuns.runCount w ≤ + Real.sqrt N ^ ((WordSwitches.switches w).card + 2) := by + calc + N ^ WordRuns.runCount w = Real.sqrt N ^ (2 * WordRuns.runCount w) := by + rw [pow_mul, Real.sq_sqrt hN0.le] + _ ≤ _ := pow_le_pow_right₀ hs1 hr + calc + N⁻¹ ^ (WordSwitches.switches w).card * N ^ WordRuns.runCount w ≤ + N⁻¹ ^ (WordSwitches.switches w).card * + Real.sqrt N ^ ((WordSwitches.switches w).card + 2) := + mul_le_mul_of_nonneg_left hpow (by positivity) + _ = N * (Real.sqrt N)⁻¹ ^ (WordSwitches.switches w).card := by + rw [pow_add, Real.sq_sqrt hN0.le] + have hNinv : N⁻¹ = (Real.sqrt N)⁻¹ ^ 2 := by rw [inv_pow, Real.sq_sqrt hN0.le] + rw [hNinv, ← pow_mul, Nat.mul_comm 2 _, pow_mul] + simp only [inv_pow] + field_simp + +/-- Direct application to products of interval weights: a factor `N` per true run, +with `N⁻¹` per switch, yields the required square-root exponential sum. -/ +theorem sum_switch_penalty_mul_run_weight_le_exp (n : ℕ) : + (∑ w : Fin (n + 1) → Bool, + (((n + 1 : ℕ) : ℝ)⁻¹) ^ (WordSwitches.switches w).card * + ((n + 1 : ℕ) : ℝ) ^ WordRuns.runCount w) ≤ + Real.exp (4 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + let N : ℝ := ((n + 1 : ℕ) : ℝ) + have hN : 1 ≤ N := by dsimp [N]; exact_mod_cast Nat.succ_le_succ (Nat.zero_le n) + have hN0 : 0 < N := lt_of_lt_of_le (by norm_num) hN + have hs0 : 0 < Real.sqrt N := Real.sqrt_pos.mpr hN0 + have hsum := sum_le_exp_of_switch_bound n ((Real.sqrt N)⁻¹) N (by positivity) hN0.le + (fun w => N⁻¹ ^ (WordSwitches.switches w).card * N ^ WordRuns.runCount w) + (fun w => switch_penalty_mul_run_weight_le w hN) + have hexponent : (n : ℝ) * (Real.sqrt N)⁻¹ ≤ Real.sqrt N := by + rw [← div_eq_mul_inv] + apply (div_le_iff₀ hs0).mpr + have hsq := Real.sq_sqrt hN0.le + have hnN : (n : ℝ) + 1 = N := by simp [N] + nlinarith + exact hsum.trans ((mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hexponent) + (by positivity)).trans (two_mul_self_mul_exp_sqrt_le hN)) + +/-- Summation interface requiring only a pointwise product-of-runs bound. -/ +theorem sum_weighted_switch_penalty_le_exp (n : ℕ) (C : ℝ) + (F : (Fin (n + 1) → Bool) → ℝ) + (hF : ∀ w, F w ≤ Real.exp C * ((n + 1 : ℕ) : ℝ) ^ WordRuns.runCount w) : + (∑ w, (((n + 1 : ℕ) : ℝ)⁻¹) ^ (WordSwitches.switches w).card * F w) ≤ + Real.exp (C + 4 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + calc + _ ≤ ∑ w, Real.exp C * ((((n + 1 : ℕ) : ℝ)⁻¹) ^ (WordSwitches.switches w).card * + ((n + 1 : ℕ) : ℝ) ^ WordRuns.runCount w) := by + apply Finset.sum_le_sum + intro w _ + calc + _ ≤ (((n + 1 : ℕ) : ℝ)⁻¹) ^ (WordSwitches.switches w).card * + (Real.exp C * ((n + 1 : ℕ) : ℝ) ^ WordRuns.runCount w) := + mul_le_mul_of_nonneg_left (hF w) (by positivity) + _ = _ := by ring + _ = Real.exp C * ∑ w, ((((n + 1 : ℕ) : ℝ)⁻¹) ^ (WordSwitches.switches w).card * + ((n + 1 : ℕ) : ℝ) ^ WordRuns.runCount w) := (Finset.mul_sum _ _ _).symm + _ ≤ Real.exp C * Real.exp (4 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := + mul_le_mul_of_nonneg_left (sum_switch_penalty_mul_run_weight_le_exp n) (Real.exp_nonneg C) + _ = _ := (Real.exp_add _ _).symm + +end Problem335.RunSum + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/RunWeights.lean b/lean/OAI/Algebra/DepthFive/RunWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1596fa6c6c6130f0e9e798e01f8018fd9a3a434 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/RunWeights.lean @@ -0,0 +1,174 @@ +import Mathlib + +namespace OAI + +/-! Analytic weight estimates for the D-runs in the path-type sum. -/ + +open scoped BigOperators +noncomputable section +namespace Problem335 +namespace RunWeights + +/-- The interval discrepancy estimate converts directly into a bound on its weight. -/ +lemma interval_weight_le {α β ρ ε N : ℝ} (hα : 0 < α) (hα1 : α ≤ 1) + (hβ : 0 ≤ β) (hβupper : β ≤ α ^ ρ * Real.exp ε) + (hscale : α ^ (-(1 + ρ)) ≤ N) (v u : ℕ) + (hdiscrepancy : (v : ℝ) - ρ * u ≤ 1 + ρ) : + α ^ (-(v : ℝ)) * β ^ u ≤ N * Real.exp (ε * u) := by + have hp : β ^ u ≤ (α ^ ρ * Real.exp ε) ^ u := by gcongr + calc + α ^ (-(v : ℝ)) * β ^ u ≤ + α ^ (-(v : ℝ)) * (α ^ ρ * Real.exp ε) ^ u := by + exact mul_le_mul_of_nonneg_left hp (Real.rpow_nonneg hα.le _) + _ = α ^ (-(v : ℝ) + ρ * u) * Real.exp (ε * u) := by + rw [mul_pow, ← Real.rpow_natCast (α ^ ρ) u, + ← Real.rpow_mul hα.le, ← Real.exp_nat_mul] + rw [mul_comm (u : ℝ) ε, ← mul_assoc, ← Real.rpow_add hα] + _ ≤ α ^ (-(1 + ρ)) * Real.exp (ε * u) := by + apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le + exact Real.rpow_le_rpow_of_exponent_ge hα hα1 (by linarith) + _ ≤ N * Real.exp (ε * u) := by + exact mul_le_mul_of_nonneg_right hscale (Real.exp_pos _).le + +/-- The parameter bound on alpha controls the common cost of every run. -/ +lemma scale_le_of_inv_le_sqrt {α ρ N : ℝ} (hα : 0 < α) (hα1 : α ≤ 1) + (hρ : ρ ≤ 1) (hN : 0 ≤ N) (hinv : α⁻¹ ≤ Real.sqrt N) : + α ^ (-(1 + ρ)) ≤ N := by + calc + α ^ (-(1 + ρ)) ≤ α ^ (-2 : ℝ) := + Real.rpow_le_rpow_of_exponent_ge hα hα1 (by linarith) + _ = (α⁻¹) ^ 2 := by + rw [show (-2 : ℝ) = (-1) * 2 by norm_num, Real.rpow_mul hα.le, + Real.rpow_two, Real.rpow_neg_one] + _ ≤ (Real.sqrt N) ^ 2 := by gcongr + _ = N := Real.sq_sqrt hN + +lemma interval_weight_le_of_inv_le_sqrt {α β ρ ε N : ℝ} + (hα : 0 < α) (hα1 : α ≤ 1) (hβ : 0 ≤ β) + (hβupper : β ≤ α ^ ρ * Real.exp ε) (hρ : ρ ≤ 1) + (hN : 0 ≤ N) (hinv : α⁻¹ ≤ Real.sqrt N) (v u : ℕ) + (hdiscrepancy : (v : ℝ) - ρ * u ≤ 1 + ρ) : + α ^ (-(v : ℝ)) * β ^ u ≤ N * Real.exp (ε * u) := + interval_weight_le hα hα1 hβ hβupper + (scale_le_of_inv_le_sqrt hα hα1 hρ hN hinv) v u hdiscrepancy + +/-- Multiplying the run estimates accumulates only their total number of U layers. -/ +lemma prod_interval_weight_le {ι : Type*} (S : Finset ι) {α β ρ ε N : ℝ} + (hα : 0 < α) (hα1 : α ≤ 1) (hβ : 0 ≤ β) + (hβupper : β ≤ α ^ ρ * Real.exp ε) (hscale : α ^ (-(1 + ρ)) ≤ N) + (v u : ι → ℕ) (hdiscrepancy : ∀ i ∈ S, (v i : ℝ) - ρ * u i ≤ 1 + ρ) : + (∏ i ∈ S, α ^ (-(v i : ℝ)) * β ^ u i) ≤ + N ^ S.card * Real.exp (ε * ∑ i ∈ S, (u i : ℝ)) := by + calc + (∏ i ∈ S, α ^ (-(v i : ℝ)) * β ^ u i) ≤ + ∏ i ∈ S, N * Real.exp (ε * u i) := by + apply Finset.prod_le_prod₀ + · intro i hi + positivity + · intro i hi + exact interval_weight_le hα hα1 hβ hβupper hscale (v i) (u i) + (hdiscrepancy i hi) + _ = N ^ S.card * Real.exp (ε * ∑ i ∈ S, (u i : ℝ)) := by + rw [Finset.prod_mul_distrib, Finset.prod_const, ← Real.exp_sum, Finset.mul_sum] + +lemma one_add_pow_le_exp (x : ℝ) (hx : 0 ≤ x) (k : ℕ) : + (1 + x) ^ k ≤ Real.exp ((k : ℝ) * x) := by + rw [Real.exp_nat_mul] + gcongr + linarith [Real.add_one_le_exp x] + +/-- The isolated-position correction prefactor costs at most exp(3 sqrt N). -/ +lemma correction_prefactor_le_exp {N a : ℝ} (hN : 1 ≤ N) + (ha : 0 ≤ a) (haN : a ≤ Real.sqrt N) (k : ℕ) (hk : 2 * (k : ℝ) ≤ N) : + (1 + 2 / N ^ 2) ^ k * (1 + a) * (1 + a / N) ^ k ≤ + Real.exp (3 * Real.sqrt N) := by + have hNpos : 0 < N := by linarith + have hsqrt : 1 ≤ Real.sqrt N := by + simpa using Real.sqrt_le_sqrt hN + have hk0 : (0 : ℝ) ≤ k := Nat.cast_nonneg k + have hkN : (k : ℝ) ≤ N := by linarith + have hfirst : (k : ℝ) * (2 / N ^ 2) ≤ 1 := by + rw [← mul_div_assoc] + apply (div_le_iff₀ (sq_pos_of_pos hNpos)).2 + nlinarith + have hthird : (k : ℝ) * (a / N) ≤ a := by + rw [← mul_div_assoc] + apply (div_le_iff₀ hNpos).2 + nlinarith + calc + (1 + 2 / N ^ 2) ^ k * (1 + a) * (1 + a / N) ^ k ≤ + Real.exp ((k : ℝ) * (2 / N ^ 2)) * Real.exp a * + Real.exp ((k : ℝ) * (a / N)) := by + gcongr + · exact one_add_pow_le_exp _ (by positivity) k + · linarith [Real.add_one_le_exp a] + · exact one_add_pow_le_exp _ (by positivity) k + _ = Real.exp ((k : ℝ) * (2 / N ^ 2) + a + (k : ℝ) * (a / N)) := by + rw [← Real.exp_add, ← Real.exp_add] + _ ≤ Real.exp (3 * Real.sqrt N) := Real.exp_le_exp.mpr (by linarith) + +/-- Pointwise U-layer corrections cost at most exp(2 sqrt N). -/ +lemma u_correction_le_exp {N β : ℝ} (hN : 0 < N) (hβ : 0 ≤ β) + (hβN : β ≤ 2 / Real.sqrt N) (m : ℕ) (hm : (m : ℝ) ≤ N) : + (1 + β) ^ m ≤ Real.exp (2 * Real.sqrt N) := by + have hsqrt : 0 < Real.sqrt N := Real.sqrt_pos.2 hN + have hsquare := Real.sq_sqrt hN.le + have hmul : (m : ℝ) * β ≤ N * (2 / Real.sqrt N) := by gcongr + have heq : N * (2 / Real.sqrt N) = 2 * Real.sqrt N := by + rw [← mul_div_assoc] + apply (div_eq_iff hsqrt.ne').2 + nlinarith + exact (one_add_pow_le_exp β hβ m).trans + (Real.exp_le_exp.mpr (heq ▸ hmul)) + +/-- Surviving N-layers have a small correction, except possibly at one endpoint. -/ +lemma correction_product_le {ι : Type*} [DecidableEq ι] (T : Finset ι) + (e : ι) (h : ι → ℕ) {N a : ℝ} (hN : 1 ≤ N) (ha : 0 ≤ a) + (k : ℕ) (hcard : T.card ≤ k) + (hinterior : ∀ i ∈ T, i ≠ e → 1 ≤ h i) : + (∏ i ∈ T, (1 + a * (N⁻¹) ^ h i)) ≤ (1 + a) * (1 + a / N) ^ k := by + have hNpos : 0 < N := by linarith + have hinv0 : 0 ≤ N⁻¹ := inv_nonneg.mpr hNpos.le + have hinv1 : N⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hN + have hbase : 1 ≤ 1 + a / N := le_add_of_nonneg_right (by positivity) + have hall (i : ι) : 1 + a * N⁻¹ ^ h i ≤ 1 + a := by + have hp : N⁻¹ ^ h i ≤ 1 := pow_le_one₀ hinv0 hinv1 + nlinarith + have hsmall (i : ι) (hi : i ∈ T) (hie : i ≠ e) : + 1 + a * N⁻¹ ^ h i ≤ 1 + a / N := by + have hp := pow_le_pow_of_le_one hinv0 hinv1 (hinterior i hi hie) + simp only [pow_one] at hp + rw [div_eq_mul_inv] + nlinarith + by_cases he : e ∈ T + · rw [← Finset.mul_prod_erase T (fun i => 1 + a * N⁻¹ ^ h i) he] + have hp : (∏ i ∈ T.erase e, (1 + a * N⁻¹ ^ h i)) ≤ (1 + a / N) ^ k := by + calc + (∏ i ∈ T.erase e, (1 + a * N⁻¹ ^ h i)) ≤ ∏ _i ∈ T.erase e, (1 + a / N) := by + apply Finset.prod_le_prod₀ + · intro i hi; positivity + · intro i hi + exact hsmall i (Finset.mem_erase.mp hi).2 (Finset.mem_erase.mp hi).1 + _ = (1 + a / N) ^ (T.erase e).card := by rw [Finset.prod_const] + _ ≤ (1 + a / N) ^ k := + pow_le_pow_right₀ hbase (Finset.card_erase_le.trans hcard) + exact mul_le_mul (hall e) hp (by positivity) (by positivity) + · have hp : (∏ i ∈ T, (1 + a * N⁻¹ ^ h i)) ≤ (1 + a / N) ^ k := by + calc + (∏ i ∈ T, (1 + a * N⁻¹ ^ h i)) ≤ ∏ _i ∈ T, (1 + a / N) := by + apply Finset.prod_le_prod₀ + · intro i hi; positivity + · intro i hi + apply hsmall i hi + intro hie + exact he (hie ▸ hi) + _ = (1 + a / N) ^ T.card := by rw [Finset.prod_const] + _ ≤ (1 + a / N) ^ k := pow_le_pow_right₀ hbase hcard + exact hp.trans (by nlinarith [show (0 : ℝ) ≤ (1 + a / N) ^ k by positivity]) + +end RunWeights +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ScheduleEnds.lean b/lean/OAI/Algebra/DepthFive/ScheduleEnds.lean new file mode 100644 index 0000000000000000000000000000000000000000..84eb04f66bf354f6f6985333787efe15edf6e131 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ScheduleEnds.lean @@ -0,0 +1,130 @@ +import OAI.Algebra.DepthFive.BalancedSchedule + +namespace OAI + +noncomputable section + +namespace Problem335.BalancedSchedule + +/-- The layer immediately left of an internal vertex. -/ +def leftLayer {n : ℕ} (v : Fin (n - 1)) : Fin n := ⟨v.val, by omega⟩ + +/-- The layer immediately right of an internal vertex. -/ +def rightLayer {n : ℕ} (v : Fin (n - 1)) : Fin n := ⟨v.val + 1, by omega⟩ + +lemma adjacent_left_right {n : ℕ} (v : Fin (n - 1)) : + adjacent (leftLayer v) (rightLayer v) := Or.inl rfl + +lemma internalEnds_cases {n : ℕ} {i : Fin n} {v : Fin (n - 1)} + (hv : v ∈ internalEnds i) : leftLayer v = i ∨ rightLayer v = i := by + rcases (Finset.mem_filter.mp hv).2 with h | h + · exact Or.inl (Fin.ext h) + · exact Or.inr (Fin.ext h) + +/-- Internal ends at which both incident layers have type N (`false`). -/ +def nnInternalEnds {n : ℕ} (τ : Fin n → Bool) (i : Fin n) : Finset (Fin (n - 1)) := + (internalEnds i).filter (fun v => τ (leftLayer v) = false ∧ τ (rightLayer v) = false) + +lemma nnInternalEnds_subset {n : ℕ} (τ : Fin n → Bool) (i : Fin n) : + nnInternalEnds τ i ⊆ internalEnds i := Finset.filter_subset _ _ + +lemma nnInternalEnds_card_le_two {n : ℕ} (τ : Fin n → Bool) (i : Fin n) : + (nnInternalEnds τ i).card ≤ 2 := + (Finset.card_le_card (nnInternalEnds_subset τ i)).trans (card_internalEnds_le_two i) + +lemma nnInternalEnds_nonempty_iff {n : ℕ} (τ : Fin n → Bool) (i : Fin n) + (hi : τ i = false) : + (nnInternalEnds τ i).Nonempty ↔ ∃ j, adjacent i j ∧ τ j = false := by + constructor + · rintro ⟨v, hv⟩ + have he := (Finset.mem_filter.mp hv).1 + have ht := (Finset.mem_filter.mp hv).2 + rcases internalEnds_cases he with hleft | hright + · refine ⟨rightLayer v, ?_, ht.2⟩ + rw [← hleft] + exact adjacent_left_right v + · refine ⟨leftLayer v, ?_, ht.1⟩ + rw [← hright] + exact Or.inr rfl + · rintro ⟨j, hij | hji, hj⟩ + · let v : Fin (n - 1) := ⟨i.val, by omega⟩ + have hleft : leftLayer v = i := Fin.ext rfl + have hright : rightLayer v = j := Fin.ext hij + refine ⟨v, Finset.mem_filter.mpr ⟨?_, ?_⟩⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Or.inl rfl⟩ + · simpa [hleft, hright] using And.intro hi hj + · let v : Fin (n - 1) := ⟨j.val, by omega⟩ + have hleft : leftLayer v = j := Fin.ext rfl + have hright : rightLayer v = i := Fin.ext hji + refine ⟨v, Finset.mem_filter.mpr ⟨?_, ?_⟩⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Or.inr hji⟩ + · simpa [hleft, hright] using And.intro hj hi + +/-- A nonisolated N layer has at least one NN internal end. -/ +lemma one_le_nnInternalEnds_card {n : ℕ} (τ : Fin n → Bool) (i : Fin n) + (hi : τ i = false) (hnot : ¬ ∀ j, adjacent i j → τ j = true) : + 1 ≤ (nnInternalEnds τ i).card := by + apply Finset.card_pos.mpr + apply (nnInternalEnds_nonempty_iff τ i hi).mpr + push Not at hnot + rcases hnot with ⟨j, hadj, hj⟩ + exact ⟨j, hadj, by cases h : τ j <;> simp_all⟩ + +lemma nnInternalEnds_eq_empty_of_all_neighbors_D {n : ℕ} (τ : Fin n → Bool) + (i : Fin n) (hi : τ i = false) (hall : ∀ j, adjacent i j → τ j = true) : + nnInternalEnds τ i = ∅ := by + apply Finset.not_nonempty_iff_eq_empty.mp + rw [nnInternalEnds_nonempty_iff τ i hi] + rintro ⟨j, hadj, hj⟩ + have h := hall j hadj + simp [hj] at h + +lemma nnInternalEnds_disjoint {k : ℕ} (hk : 0 < k) (s : ℕ) + (τ : Fin (2 * k + s) → Bool) {i j : Fin (2 * k + s)} + (hi : i ∈ vLayers hk s) (hj : j ∈ vLayers hk s) (hne : i ≠ j) : + Disjoint (nnInternalEnds τ i) (nnInternalEnds τ j) := + (vLayers_internalEnds_disjoint hk s hi hj hne).mono + (nnInternalEnds_subset τ i) (nnInternalEnds_subset τ j) + +lemma adjacent_symm {n : ℕ} {i j : Fin n} (h : adjacent i j) : adjacent j i := h.symm + +/-- The coincidence set depends only on the layer and its immediate neighbors. -/ +lemma nnInternalEnds_congr {n : ℕ} {τ υ : Fin n → Bool} (i : Fin n) + (hsame : τ i = υ i) (hadj : ∀ j, adjacent i j → τ j = υ j) : + nnInternalEnds τ i = nnInternalEnds υ i := by + apply Finset.ext + intro v + simp only [nnInternalEnds, Finset.mem_filter] + by_cases hv : v ∈ internalEnds i + · have hl : τ (leftLayer v) = υ (leftLayer v) := by + rcases internalEnds_cases hv with hleft | hright + · simpa [hleft] using hsame + · apply hadj + rw [← hright] + exact Or.inr rfl + have hr : τ (rightLayer v) = υ (rightLayer v) := by + rcases internalEnds_cases hv with hleft | hright + · apply hadj + rw [← hleft] + exact adjacent_left_right v + · simpa [hright] using hsame + rw [hl, hr] + · simp [hv] + +/-- Flipping other V positions cannot change an unflipped V layer's NN ends. -/ +lemma nnInternalEnds_flip_subset {k : ℕ} (hk : 0 < k) (s : ℕ) + (τ : Fin (2 * k + s) → Bool) (S : Finset (Fin (2 * k + s))) + (hS : S ⊆ vLayers hk s) {i : Fin (2 * k + s)} + (hi : i ∈ vLayers hk s) (hiS : i ∉ S) : + nnInternalEnds (fun j => if j ∈ S then true else τ j) i = nnInternalEnds τ i := by + apply nnInternalEnds_congr + · simp [hiS] + · intro j hij + have hj : j ∉ S := fun hjS => vLayers_independent hk s hi hij (hS hjS) + simp [hj] + +end Problem335.BalancedSchedule + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ScheduleInterior.lean b/lean/OAI/Algebra/DepthFive/ScheduleInterior.lean new file mode 100644 index 0000000000000000000000000000000000000000..00082408d321cf8a479c5c58f44ee1d26681b404 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ScheduleInterior.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.DepthFive.ScheduleEnds + +namespace OAI + +noncomputable section + +namespace Problem335.BalancedSchedule + +def firstLayer {k : ℕ} (hk : 0 < k) (s : ℕ) : Fin (2 * k + s) := ⟨0, by omega⟩ + +def finalLayer {k : ℕ} (hk : 0 < k) (s : ℕ) : Fin (2 * k + s) := + ⟨2 * k + s - 1, by omega⟩ + +@[simp] lemma indexedWord_first {k : ℕ} (hk : 0 < k) (s : ℕ) : + indexedWord hk s (firstLayer hk s) = true := by + have h := wordPrefix_head (r := k) hk k s + change (word k s).head? = some true at h + have hlen : 0 < (word k s).length := by rw [word_length hk]; omega + rw [List.head?_eq_getElem?, List.getElem?_eq_getElem hlen] at h + simpa only [indexedWord, firstLayer, List.get_eq_getElem] using Option.some.inj h + +@[simp] lemma indexedWord_final {k : ℕ} (hk : 0 < k) (s : ℕ) : + indexedWord hk s (finalLayer hk s) = false := by + have h := wordPrefix_last (r := k) hk k s + change (word k s).getLast? = some false at h + have hlen : (word k s).length - 1 < (word k s).length := by rw [word_length hk]; omega + rw [List.getLast?_eq_getElem?, List.getElem?_eq_getElem hlen] at h + simpa only [indexedWord, finalLayer, List.get_eq_getElem, word_length hk] using Option.some.inj h + +@[simp] lemma firstLayer_mem_vLayers {k : ℕ} (hk : 0 < k) (s : ℕ) : + firstLayer hk s ∈ vLayers hk s := by simp [vLayers] + +lemma vLayers_nonfinal {k : ℕ} (hk : 0 < k) (s : ℕ) {i : Fin (2 * k + s)} + (hi : i ∈ vLayers hk s) : i.val + 1 < 2 * k + s := by + have hi' := (Finset.mem_filter.mp hi).2 + by_contra h + have heq : i = finalLayer hk s := by + apply Fin.ext + dsimp [finalLayer] + omega + rw [heq, indexedWord_final] at hi' + cases hi' + +/-- The V positions eligible for isolated-position flips. -/ +def interiorVLayers {k : ℕ} (hk : 0 < k) (s : ℕ) : Finset (Fin (2 * k + s)) := + (vLayers hk s).erase (firstLayer hk s) + +lemma interiorVLayers_subset {k : ℕ} (hk : 0 < k) (s : ℕ) : + interiorVLayers hk s ⊆ vLayers hk s := Finset.erase_subset _ _ + +lemma mem_interiorVLayers_iff {k : ℕ} (hk : 0 < k) (s : ℕ) {i : Fin (2 * k + s)} : + i ∈ interiorVLayers hk s ↔ i ∈ vLayers hk s ∧ 0 < i.val ∧ i.val + 1 < 2 * k + s := by + simp only [interiorVLayers, Finset.mem_erase] + constructor + · rintro ⟨hfirst, hi⟩ + refine ⟨hi, ?_, vLayers_nonfinal hk s hi⟩ + have hn : i.val ≠ 0 := by + intro h + exact hfirst (Fin.ext h) + omega + · rintro ⟨hi, hpos, hlast⟩ + refine ⟨?_, hi⟩ + intro h + have hv := congrArg Fin.val h + dsimp [firstLayer] at hv + omega + +lemma card_interiorVLayers {k : ℕ} (hk : 0 < k) (s : ℕ) : + (interiorVLayers hk s).card = k - 1 := by + rw [interiorVLayers, Finset.card_erase_of_mem (firstLayer_mem_vLayers hk s), card_vLayers] + +lemma vLayers_sdiff_interiorVLayers {k : ℕ} (hk : 0 < k) (s : ℕ) : + vLayers hk s \ interiorVLayers hk s = {firstLayer hk s} := by + simp [interiorVLayers, Finset.sdiff_erase (firstLayer_mem_vLayers hk s)] + +lemma card_internalEnds_eq_two {n : ℕ} (i : Fin n) (hfirst : 0 < i.val) + (hlast : i.val + 1 < n) : (internalEnds i).card = 2 := by + let l : Fin (n - 1) := ⟨i.val - 1, by omega⟩ + let r : Fin (n - 1) := ⟨i.val, by omega⟩ + apply Finset.card_eq_two.mpr + refine ⟨l, r, ?_, ?_⟩ + · intro h + have hv := congrArg Fin.val h + dsimp [l, r] at hv + omega + · ext v + simp only [internalEnds, Finset.mem_filter, Finset.mem_univ, true_and, + Finset.mem_insert, Finset.mem_singleton] + constructor + · rintro (h | h) + · exact Or.inr (Fin.ext h) + · left + apply Fin.ext + dsimp [l] + omega + · rintro (rfl | rfl) + · dsimp [l] + omega + · exact Or.inl rfl + +lemma interiorVLayers_degree_two {k : ℕ} (hk : 0 < k) (s : ℕ) + {i : Fin (2 * k + s)} (hi : i ∈ interiorVLayers hk s) : + (internalEnds i).card = 2 := by + obtain ⟨_, hfirst, hlast⟩ := (mem_interiorVLayers_iff hk s).mp hi + exact card_internalEnds_eq_two i hfirst hlast + +end Problem335.BalancedSchedule + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ScheduleIntervals.lean b/lean/OAI/Algebra/DepthFive/ScheduleIntervals.lean new file mode 100644 index 0000000000000000000000000000000000000000..75bdad471258a75d81856161479b1413baba861c --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ScheduleIntervals.lean @@ -0,0 +1,113 @@ +import OAI.Algebra.DepthFive.BalancedSchedule + +namespace OAI + +noncomputable section + +namespace Problem335.BalancedSchedule + +lemma card_get_eq_count (w : List Bool) (b : Bool) : + (Finset.univ.filter (fun i : Fin w.length => w.get i = b)).card = w.count b := by + exact Fin.card_filter_univ_eq_vector_get_eq_count b (⟨w, rfl⟩ : List.Vector Bool w.length) + +/-- Counting a contiguous list interval equals counting its finite-indexed layers. -/ +lemma count_slice_eq_card (w : List Bool) (a len : ℕ) (b : Bool) : + ((w.drop a).take len).count b = + (Finset.univ.filter (fun i : Fin w.length => + a ≤ i.val ∧ i.val < a + len ∧ w.get i = b)).card := by + let z := (w.drop a).take len + have hz : z.length = min len (w.length - a) := by simp [z] + let shift : Fin z.length → Fin w.length := fun i => ⟨a + i.val, by + have h := i.isLt + omega⟩ + have hget (i : Fin z.length) : z.get i = w.get (shift i) := by + simp only [z, List.get_eq_getElem, List.getElem_take, List.getElem_drop, shift] + rw [← card_get_eq_count z b] + apply Finset.card_nbij shift + · intro i hi + have hib := (Finset.mem_filter.mp hi).2 + have hlt := i.isLt + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, ?_, ?_⟩ + · dsimp [shift]; omega + · dsimp [shift]; omega + · rwa [← hget] + · intro i hi j hj hij + apply Fin.ext + have h := congrArg Fin.val hij + dsimp [shift] at h + omega + · intro j hj + have hj' := (Finset.mem_filter.mp hj).2 + let i : Fin z.length := ⟨j.val - a, by + rw [hz] + have h := j.isLt + omega⟩ + have heq : shift i = j := by + apply Fin.ext + dsimp [shift, i] + omega + refine ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩, heq⟩ + rw [hget, heq] + exact hj'.2.2 + +/-- Pulling the finite-indexed partition back to a list gives the constructed schedule. -/ +lemma ofFn_indexedWord {k : ℕ} (hk : 0 < k) (s : ℕ) : + List.ofFn (indexedWord hk s) = word k s := by + apply List.ext_getElem + · simp [word_length hk] + · intro i h₁ h₂ + simp [indexedWord] + +/-- A finite interval of the schedule, with a specified layer type. -/ +def intervalLayers {k : ℕ} (hk : 0 < k) (s a len : ℕ) (b : Bool) : + Finset (Fin (2 * k + s)) := + Finset.univ.filter (fun i => a ≤ i.val ∧ i.val < a + len ∧ indexedWord hk s i = b) + +lemma card_intervalLayers {k : ℕ} (hk : 0 < k) (s a len : ℕ) (b : Bool) : + (intervalLayers hk s a len b).card = (((word k s).drop a).take len).count b := by + have h := count_slice_eq_card (List.ofFn (indexedWord hk s)) a len b + rw [ofFn_indexedWord] at h + rw [h] + let castIndex : Fin (2 * k + s) → Fin (word k s).length := + fun i => ⟨i.val, by simp [word_length hk]⟩ + apply Finset.card_nbij castIndex + · intro i hi + have hi' := (Finset.mem_filter.mp hi).2 + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, hi'⟩ + · intro i hi j hj hij + have hv := congrArg (fun t : Fin (word k s).length => t.val) hij + exact Fin.ext hv + · intro j hj + let i : Fin (2 * k + s) := ⟨j.val, by simpa [word_length hk] using j.isLt⟩ + refine ⟨i, ?_, Fin.ext rfl⟩ + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, (Finset.mem_filter.mp hj).2⟩ + +/-- The balanced interval discrepancy in the finite-set form used for run bounds. -/ +lemma intervalLayers_discrepancy_lt {k : ℕ} (hk : 0 < k) (s a len : ℕ) : + ((intervalLayers hk s a len true).card : ℝ) - rho k s * + ((intervalLayers hk s a len false).card : ℝ) < 1 + rho k s := by + rw [card_intervalLayers, card_intervalLayers] + exact interval_discrepancy_lt hk s k a len + +/-- RunLayerWeights' precise countP interface for a contiguous finite-index interval. -/ +lemma indexed_infix_discrepancy_lt {k : ℕ} (hk : 0 < k) (s : ℕ) + (b : List (Fin (2 * k + s))) (hb : b <:+: List.ofFn id) : + (b.countP (indexedWord hk s) : ℝ) - rho k s * + (b.countP (fun i => !indexedWord hk s i) : ℝ) < 1 + rho k s := by + have hmap := hb.map (indexedWord hk s) + have heq : (List.ofFn (id : Fin (2 * k + s) → Fin (2 * k + s))).map + (indexedWord hk s) = word k s := by + rw [List.map_ofFn] + exact ofFn_indexedWord hk s + rw [heq] at hmap + have h := infix_discrepancy_lt hk s k hmap + simpa [discrepancy, List.count_eq_countP, List.countP_map, Function.comp_def] using h + +end Problem335.BalancedSchedule + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ScheduleWeightBridge.lean b/lean/OAI/Algebra/DepthFive/ScheduleWeightBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd293c0de8092aec245ee287b645059a44813554 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ScheduleWeightBridge.lean @@ -0,0 +1,149 @@ +import OAI.Algebra.DepthFive.IsolatedWeight +import OAI.Algebra.DepthFive.ScheduleEnds + +namespace OAI + +noncomputable section + +open scoped BigOperators + +namespace Problem335.BalancedSchedule + +/-- The graph edges joining consecutive layers, indexed by internal vertices. -/ +def internalEdges (n : ℕ) : Finset (Fin n × Fin n) := + Finset.univ.image (fun v : Fin (n - 1) => (leftLayer v, rightLayer v)) + +/-- On a successor number of layers this is the canonical path graph. -/ +theorem internalEdges_eq_pathEdges (n : ℕ) : + internalEdges (n + 1) = SwitchRestoration.pathEdges n := rfl + +/-- Each graph edge joins adjacent layers in either direction. -/ +theorem internalEdges_adjacent {n : ℕ} {e : Fin n × Fin n} + (he : e ∈ internalEdges n) : adjacent e.1 e.2 ∧ adjacent e.2 e.1 := by + obtain ⟨v, hv, rfl⟩ := Finset.mem_image.mp he + exact ⟨adjacent_left_right v, (adjacent_left_right v).symm⟩ + +/-- Graph incidence degree and internal-end cardinality agree exactly. -/ +theorem endpointDegree_internalEdges {n : ℕ} (i : Fin n) : + SwitchRestoration.endpointDegree (internalEdges n) i = (internalEnds i).card := by + classical + unfold SwitchRestoration.endpointDegree internalEdges + rw [Finset.sum_image] + · rw [internalEnds, Finset.card_filter] + apply Finset.sum_congr rfl + intro v hv + have hl : leftLayer v = i ↔ v.val = i.val := by + constructor + · exact fun h => congrArg Fin.val h + · exact fun h => Fin.ext h + have hr : rightLayer v = i ↔ v.val + 1 = i.val := by + constructor + · exact fun h => congrArg Fin.val h + · exact fun h => Fin.ext h + change (if leftLayer v = i then 1 else 0) + + (if rightLayer v = i then 1 else 0) = + if v.val = i.val ∨ v.val + 1 = i.val then 1 else 0 + simp only [hl, hr] + by_cases hleft : v.val = i.val + · simp [hleft] + · by_cases hright : v.val + 1 = i.val <;> simp [hleft, hright] + · intro v hv w hw h + apply Fin.ext + exact congrArg (fun e : Fin n × Fin n => e.1.val) h + +/-- Normal neighbors of a normal layer are in bijection with its internal +vertices having two normal incident layers. This identifies the correction +exponents in the graph-word and path-pairing formulations. -/ +theorem falseNeighbors_card_eq_nnInternalEnds_card {n : ℕ} + (τ : Fin n → Bool) (i : Fin n) (hi : τ i = false) : + (IsolatedWeight.falseNeighbors adjacent τ i).card = + (nnInternalEnds τ i).card := by + classical + apply Finset.card_bij (fun j hj => + (⟨min i.val j.val, by + have hadj := (Finset.mem_filter.mp hj).2.1 + unfold adjacent at hadj + have hin := i.isLt + have hjn := j.isLt + rcases hadj with h | h <;> omega⟩ : Fin (n - 1))) + · intro j hj + have hadj := (Finset.mem_filter.mp hj).2.1 + have hjfalse := (Finset.mem_filter.mp hj).2.2 + apply Finset.mem_filter.mpr + constructor + · apply Finset.mem_filter.mpr + constructor + · exact Finset.mem_univ _ + · unfold adjacent at hadj + dsimp + rcases hadj with h | h + · exact Or.inl (by omega) + · exact Or.inr (by omega) + · unfold adjacent at hadj + rcases hadj with h | h + · have hl : leftLayer ⟨min i.val j.val, by omega⟩ = i := by + apply Fin.ext + dsimp [leftLayer] + omega + have hr : rightLayer ⟨min i.val j.val, by omega⟩ = j := by + apply Fin.ext + dsimp [rightLayer] + omega + simpa only [hl, hr] using And.intro hi hjfalse + · have hl : leftLayer ⟨min i.val j.val, by omega⟩ = j := by + apply Fin.ext + dsimp [leftLayer] + omega + have hr : rightLayer ⟨min i.val j.val, by omega⟩ = i := by + apply Fin.ext + dsimp [rightLayer] + omega + simpa only [hl, hr] using And.intro hjfalse hi + · intro a ha b hb hab + have hadj := (Finset.mem_filter.mp ha).2.1 + have hbadj := (Finset.mem_filter.mp hb).2.1 + have habv := congrArg Fin.val hab + apply Fin.ext + unfold adjacent at hadj hbadj + dsimp at habv + omega + · intro v hv + have hends := (Finset.mem_filter.mp hv).1 + have hfalse := (Finset.mem_filter.mp hv).2 + rcases internalEnds_cases hends with hl | hr + · refine ⟨rightLayer v, ?_, ?_⟩ + · apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, hfalse.2⟩ + rw [← hl] + exact adjacent_left_right v + · apply Fin.ext + have hiv := congrArg Fin.val hl + dsimp [leftLayer, rightLayer] at hiv ⊢ + omega + · refine ⟨leftLayer v, ?_, ?_⟩ + · apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, hfalse.1⟩ + rw [← hr] + exact (adjacent_left_right v).symm + · apply Fin.ext + have hiv := congrArg Fin.val hr + dsimp [leftLayer, rightLayer] at hiv ⊢ + omega + +/-- The complete coincidence correction in the internal-vertex formulation. -/ +theorem correction_eq_nnInternalEnds_product {n : ℕ} + (V : Finset (Fin n)) (τ : Fin n → Bool) (A x : ℝ) : + IsolatedWeight.correction V adjacent A x τ = + ∏ i ∈ V.filter (fun i => τ i = false), + (1 + A * x ^ (nnInternalEnds τ i).card) := by + classical + unfold IsolatedWeight.correction + apply Finset.prod_congr rfl + intro i hi + rw [falseNeighbors_card_eq_nnInternalEnds_card τ i (Finset.mem_filter.mp hi).2] + +end Problem335.BalancedSchedule + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/SecondMomentNormalization.lean b/lean/OAI/Algebra/DepthFive/SecondMomentNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..9db294f567503890b1389e12b6583074a4a455d5 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/SecondMomentNormalization.lean @@ -0,0 +1,114 @@ +import OAI.Algebra.DepthFive.SecondMomentPairing +import OAI.Algebra.DepthFive.LocalMomentWeights + +namespace OAI + +/-! Concrete normalization and reindexing of the geometric upper bound for +four-path occupation moments. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335.MomentPairing + +open Pairings + +/-- The diagonal flag used by the local geometric moment table. -/ +def isDiagonal : Kind → Bool + | .normal => false + | .diagonal => true + +/-- Coordinate coincidence in the normal pairing. -/ +def coincides {γ : Type*} (x : Labels γ) : Bool := by + classical + exact decide (x.p = x.r) + +lemma localWeight_eq_layerWeight {γ : Type*} (isV : Bool) + (α β : ℝ) (τ : Kind) (x : Labels γ) : + LocalMomentWeights.weight isV (isDiagonal τ) (coincides x) α β = + layerWeight (if isV then α⁻¹ else β) τ x := by + classical + cases τ <;> cases isV <;> by_cases h : x.p = x.r <;> + simp [LocalMomentWeights.weight, layerWeight, isDiagonal, coincides, h] + +/-- The first-moment normalization for a fixed V/U layer partition. -/ +def pathMean {L : ℕ} (isV : Fin (L + 1) → Bool) (A B : ℝ) : ℝ := + A ^ (Finset.univ.filter (fun t => isV t = true)).card * + (B + 1) ^ (Finset.univ.filter (fun t => isV t = false)).card + +lemma pathMean_pos {L : ℕ} (isV : Fin (L + 1) → Bool) {A B : ℝ} + (hA : 0 < A) (hB : 0 ≤ B) : 0 < pathMean isV A B := by + unfold pathMean + positivity + +/-- The product of independent geometric local moments for a fixed pairing. -/ +def pathGeometricMoment {γ : Type*} {L : ℕ} (isV : Fin (L + 1) → Bool) + (A B : ℝ) (endpoint : γ) (τ : Fin (L + 1) → Kind) + (x : Fin L → Labels γ) : ℝ := + ∏ t, LocalMomentWeights.moment (isV t) (isDiagonal (τ t)) + (coincides (layerLabels endpoint x t)) A B + +/-- Local normalizations multiply to precisely the square of the first moment. -/ +theorem pathGeometricMoment_eq {γ : Type*} {L : ℕ} + (isV : Fin (L + 1) → Bool) {A B : ℝ} (hA : 0 < A) (hB : 0 ≤ B) + (endpoint : γ) (τ : Fin (L + 1) → Kind) (x : Fin L → Labels γ) : + pathGeometricMoment isV A B endpoint τ x = + pathMean isV A B ^ 2 * + pathWeight isV (A / (A + 1)) (B / (B + 1)) endpoint τ x := by + unfold pathGeometricMoment pathMean pathWeight + rw [LocalMomentWeights.prod_moment_eq_mu_sq_mul _ _ _ _ hA hB] + congr 1 + apply Finset.prod_congr rfl + intro t _ + exact localWeight_eq_layerWeight _ _ _ _ _ + +/-- Summing the geometric local moments over the exact compatible quadruples +is bounded by the relaxed pairing sum with its common `mu^2` normalization. -/ +theorem sum_compatible_geometricMoment_le {γ : Type*} [Fintype γ] [DecidableEq γ] + {L : ℕ} (isV : Fin (L + 1) → Bool) {A B : ℝ} + (hA : 0 < A) (hB : 0 ≤ B) (endpoint : γ) : + (∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + pathGeometricMoment isV A B endpoint (classifyWord endpoint x.1) x.1) ≤ + pathMean isV A B ^ 2 * + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight isV (A / (A + 1)) (B / (B + 1)) endpoint τ x.1 := by + simp_rw [pathGeometricMoment_eq isV hA hB] + rw [← Finset.mul_sum] + apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) + exact sum_compatible_pathWeight_le isV (by positivity) (by positivity) endpoint + +/-- After the actual occupation comparison has bounded each compatible +quadruple, all source and path sums combine with only one source-size factor. -/ +theorem sum_sources_compatible_le {ι γ : Type*} [Fintype ι] + [Fintype γ] [DecidableEq γ] {L : ℕ} + (isV : Fin (L + 1) → Bool) {A B D : ℝ} + (hA : 0 < A) (hB : 0 ≤ B) (hD : 0 ≤ D) (endpoint : γ) + (C : ι → (Fin L → Labels γ) → ℝ) + (hexpect : ∀ x, Compatible endpoint x → + (∑ i, C i x) ≤ D * + pathGeometricMoment isV A B endpoint (classifyWord endpoint x) x) : + (∑ i, ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, C i x.1) ≤ + D * pathMean isV A B ^ 2 * + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight isV (A / (A + 1)) (B / (B + 1)) endpoint τ x.1 := by + rw [Finset.sum_comm] + calc + _ ≤ ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + D * pathGeometricMoment isV A B endpoint (classifyWord endpoint x.1) x.1 := by + apply Finset.sum_le_sum + intro x _ + exact hexpect x.1 x.2 + _ = D * ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + pathGeometricMoment isV A B endpoint (classifyWord endpoint x.1) x.1 := + (Finset.mul_sum _ _ _).symm + _ ≤ D * (pathMean isV A B ^ 2 * + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight isV (A / (A + 1)) (B / (B + 1)) endpoint τ x.1) := + mul_le_mul_of_nonneg_left (sum_compatible_geometricMoment_le isV hA hB endpoint) hD + _ = _ := by ring + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/SecondMomentPairing.lean b/lean/OAI/Algebra/DepthFive/SecondMomentPairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3e30182a5eef1a8822a800d5798514eb4382e85 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/SecondMomentPairing.lean @@ -0,0 +1,182 @@ +import OAI.Algebra.DepthFive.PairingPartition + +namespace OAI + +/-! The exact four-path pairing classes are disjoint. Dropping the diagonal +inequalities enlarges each class, and therefore increases every nonnegative +weighted second-moment sum. -/ + +noncomputable section +open scoped BigOperators + +namespace Problem335.MomentPairing + +open Pairings + +/-- The four edge coordinates in a layer of endpoint-fixed paths. -/ +def layerLabels {γ : Type*} {L : ℕ} (endpoint : γ) + (x : Fin L → Labels γ) (t : Fin (L + 1)) : Labels (γ × γ) := + zipLabels (closePaths endpoint x t.castSucc) (closePaths endpoint x t.succ) + +/-- Compatibility of the four signed shifts, expressed independently in each layer. -/ +def Compatible {γ : Type*} {L : ℕ} (endpoint : γ) (x : Fin L → Labels γ) : Prop := + ∀ t : Fin (L + 1), + Finsupp.single (layerLabels endpoint x t).p (1 : ℤ) - + Finsupp.single (layerLabels endpoint x t).q 1 = + Finsupp.single (layerLabels endpoint x t).r 1 - + Finsupp.single (layerLabels endpoint x t).s 1 + +instance compatibleDecidable {γ : Type*} [DecidableEq γ] {L : ℕ} + (endpoint : γ) (x : Fin L → Labels γ) : Decidable (Compatible endpoint x) := by + unfold Compatible + infer_instance + +/-- Assign the zero difference to the normal class; all other compatible +coordinate differences belong to the diagonal class. -/ +def classifyLayer {γ : Type*} (x : Labels γ) : Kind := by + classical + exact if x.p = x.q then .normal else .diagonal + +lemma classifyLayer_exact {γ : Type*} (x : Labels γ) + (h : Finsupp.single x.p (1 : ℤ) - Finsupp.single x.q 1 = + Finsupp.single x.r 1 - Finsupp.single x.s 1) : + ExactRespects (classifyLayer x) x := by + classical + rcases (coordinate_difference_eq_iff_exclusive x.p x.q x.r x.s).mp h with hN | hD + · simpa [classifyLayer, hN.1, ExactRespects] using hN + · simpa [classifyLayer, hD.2.2, ExactRespects] using hD + +lemma classifyLayer_eq_of_exact {γ : Type*} (x : Labels γ) (τ : Kind) + (h : ExactRespects τ x) : classifyLayer x = τ := by + classical + cases τ + · simp [classifyLayer, h.1] + · simp [classifyLayer, h.2.2] + +/-- The unique exact pairing word of a compatible quadruple. -/ +def classifyWord {γ : Type*} {L : ℕ} (endpoint : γ) + (x : Fin L → Labels γ) : Fin (L + 1) → Kind := + fun t => classifyLayer (layerLabels endpoint x t) + +lemma classifyWord_exact {γ : Type*} {L : ℕ} (endpoint : γ) + (x : Fin L → Labels γ) (hx : Compatible endpoint x) : + ∀ t, ExactRespects (classifyWord endpoint x t) (layerLabels endpoint x t) := + fun t => classifyLayer_exact _ (hx t) + +/-- Forgetting the noncoincidence requirement at diagonal layers embeds each +compatible quadruple into its relaxed class. -/ +def toRelaxed {γ : Type*} {L : ℕ} (endpoint : γ) + (x : {x : Fin L → Labels γ // Compatible endpoint x}) : + RelaxedPaths γ endpoint (classifyWord endpoint x.1) := + ⟨x.1, fun t => (classifyWord_exact endpoint x.1 x.2 t).respects⟩ + +/-- This encoding preserves all four paths, not just their pairing word. -/ +def relaxedEncoding {γ : Type*} {L : ℕ} (endpoint : γ) : + {x : Fin L → Labels γ // Compatible endpoint x} → + Σ τ : Fin (L + 1) → Kind, RelaxedPaths γ endpoint τ := + fun x => ⟨classifyWord endpoint x.1, toRelaxed endpoint x⟩ + +lemma relaxedEncoding_injective {γ : Type*} {L : ℕ} (endpoint : γ) : + Function.Injective (relaxedEncoding (L := L) endpoint) := by + intro x y h + apply Subtype.ext + exact congrArg (fun z : Σ τ : Fin (L + 1) → Kind, + RelaxedPaths γ endpoint τ => z.2.1) h + +/-- Summing over the exact classes is bounded by summing over all relaxed +classes whenever the assigned relaxed weights are nonnegative. -/ +theorem sum_exact_le_sum_relaxed {γ : Type*} [Fintype γ] [DecidableEq γ] {L : ℕ} (endpoint : γ) + (W : (τ : Fin (L + 1) → Kind) → RelaxedPaths γ endpoint τ → ℝ) + (hW : ∀ τ x, 0 ≤ W τ x) : + (∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + W (classifyWord endpoint x.1) (toRelaxed endpoint x)) ≤ + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, W τ x := by + classical + let f := relaxedEncoding (L := L) endpoint + let weight : (Σ τ : Fin (L + 1) → Kind, RelaxedPaths γ endpoint τ) → ℝ := + fun y => W y.1 y.2 + calc + _ = ∑ y ∈ Finset.univ.image f, weight y := by + rw [Finset.sum_image] + · rfl + · intro x _ y _ h + exact relaxedEncoding_injective endpoint h + _ ≤ ∑ y, weight y := by + apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) + intro y _ _ + exact hW y.1 y.2 + _ = _ := Fintype.sum_sigma _ + +/-- Normal pairings retain their coordinate-coincidence factor. Diagonal +pairings retain the assigned constant even after their inequality is dropped. -/ +def layerWeight {γ : Type*} (c : ℝ) (τ : Kind) (x : Labels γ) : ℝ := by + classical + exact match τ with + | .normal => 1 + c * (if x.p = x.r then 1 else 0) + | .diagonal => c + +lemma layerWeight_nonneg {γ : Type*} {c : ℝ} (hc : 0 ≤ c) + (τ : Kind) (x : Labels γ) : 0 ≤ layerWeight c τ x := by + classical + cases τ <;> simp only [layerWeight] + · positivity + · exact hc + +/-- Product of the manuscript's normalized local geometric weights. -/ +def pathWeight {γ : Type*} {L : ℕ} (isV : Fin (L + 1) → Bool) + (α β : ℝ) (endpoint : γ) (τ : Fin (L + 1) → Kind) + (x : Fin L → Labels γ) : ℝ := + ∏ t, layerWeight (if isV t then α⁻¹ else β) (τ t) (layerLabels endpoint x t) + +lemma pathWeight_nonneg {γ : Type*} {L : ℕ} (isV : Fin (L + 1) → Bool) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) (endpoint : γ) + (τ : Fin (L + 1) → Kind) (x : Fin L → Labels γ) : + 0 ≤ pathWeight isV α β endpoint τ x := by + apply Finset.prod_nonneg + intro t _ + apply layerWeight_nonneg + split <;> positivity + +/-- The exact weighted relaxation step in the four-path second-moment proof. -/ +theorem sum_compatible_pathWeight_le {γ : Type*} [Fintype γ] [DecidableEq γ] {L : ℕ} + (isV : Fin (L + 1) → Bool) {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) + (endpoint : γ) : + (∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + pathWeight isV α β endpoint (classifyWord endpoint x.1) x.1) ≤ + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight isV α β endpoint τ x.1 := by + have hc (x : Fin L → Labels γ) : classifyWord endpoint x = + (fun t => Pairings.classify (Pairings.layerLabels endpoint x t)) := by + classical + funext t + unfold classifyWord classifyLayer Pairings.classify layerLabels Pairings.layerLabels + split_ifs <;> rfl + simp_rw [hc] + exact Pairings.sum_compatiblePaths_le_sum_relaxedPaths endpoint + (fun τ x => pathWeight isV α β endpoint τ x) + (fun τ x => pathWeight_nonneg isV hα hβ endpoint τ x) + + +/-- A termwise occupation-moment bound can be summed before the pairing +inequalities are relaxed; no independence of occupations is assumed here. -/ +theorem sum_occupation_bound_le_relaxed {γ : Type*} [Fintype γ] [DecidableEq γ] {L : ℕ} + (isV : Fin (L + 1) → Bool) {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 ≤ β) + (endpoint : γ) (W : (Fin L → Labels γ) → ℝ) + (hlocal : ∀ x, Compatible endpoint x → + W x ≤ pathWeight isV α β endpoint (classifyWord endpoint x) x) : + (∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, W x.1) ≤ + ∑ τ : Fin (L + 1) → Kind, ∑ x : RelaxedPaths γ endpoint τ, + pathWeight isV α β endpoint τ x.1 := by + calc + _ ≤ ∑ x : {x : Fin L → Labels γ // Compatible endpoint x}, + pathWeight isV α β endpoint (classifyWord endpoint x.1) x.1 := by + apply Finset.sum_le_sum + intro x _ + exact hlocal x.1 x.2 + _ ≤ _ := sum_compatible_pathWeight_le isV hα hβ endpoint + +end Problem335.MomentPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/ShiftedOccupation.lean b/lean/OAI/Algebra/DepthFive/ShiftedOccupation.lean new file mode 100644 index 0000000000000000000000000000000000000000..380f7b30c90fa2a50bd60ebff7b976930ad4e8ce --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/ShiftedOccupation.lean @@ -0,0 +1,81 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335 +namespace ShiftedOccupation + +/-- The integer occupation after subtracting one path shift from another. -/ +def signedSource {ι σ : Type*} [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) (x : ι × σ) : ℤ := + (M x : ℤ) + sign x.1 * ((if x.2 = p x.1 then 1 else 0) - + (if x.2 = q x.1 then 1 else 0)) + +/-- Conversion to natural occupations; exact whenever all signed entries are nonnegative. -/ +def source {ι σ : Type*} [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) : ι × σ → ℕ := + fun x => (signedSource M sign p q x).toNat + +lemma source_cast {ι σ : Type*} [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) + (h : ∀ x, 0 ≤ signedSource M sign p q x) (x : ι × σ) : + (source M sign p q x : ℤ) = signedSource M sign p q x := + Int.toNat_of_nonneg (h x) + +lemma source_unique {ι σ : Type*} [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) + (N : ι × σ → ℕ) + (hN : ∀ x, (N x : ℤ) = signedSource M sign p q x) : + N = source M sign p q := by + funext x + rw [source, ← hN x] + simp + +/-- Validity of the integer shift is exactly the existence of a natural source occupation. -/ +lemma exists_source_iff {ι σ : Type*} [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) : + (∃ N : ι × σ → ℕ, ∀ x, (N x : ℤ) = signedSource M sign p q x) ↔ + ∀ x, 0 ≤ signedSource M sign p q x := by + constructor + · rintro ⟨N, hN⟩ x + rw [← hN x] + positivity + · intro h + exact ⟨source M sign p q, source_cast M sign p q h⟩ + +/-- The two path contributions cancel in each layer, even before imposing validity. -/ +lemma signedSource_layer_sum {ι σ : Type*} [Fintype σ] [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) (t : ι) : + (∑ a : σ, signedSource M sign p q (t, a)) = ∑ a : σ, (M (t, a) : ℤ) := by + simp [signedSource, Finset.sum_add_distrib, ← Finset.mul_sum, Finset.sum_sub_distrib] + +/-- Every layer total of a valid shifted natural occupation is unchanged. -/ +lemma source_layer_sum {ι σ : Type*} [Fintype σ] [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) + (h : ∀ x, 0 ≤ signedSource M sign p q x) (t : ι) : + (∑ a : σ, source M sign p q (t, a)) = ∑ a : σ, M (t, a) := by + have he : (∑ a : σ, (source M sign p q (t, a) : ℤ)) = + ∑ a : σ, (M (t, a) : ℤ) := by + simp_rw [source_cast M sign p q h] + exact signedSource_layer_sum M sign p q t + exact_mod_cast he + +/-- In particular, both bidegrees are preserved for any partition into whole layers. -/ +lemma source_layers_sum {ι σ : Type*} [Fintype σ] [DecidableEq σ] + (M : ι × σ → ℕ) (sign : ι → ℤ) (p q : ι → σ) + (h : ∀ x, 0 ≤ signedSource M sign p q x) (layers : Finset ι) : + (∑ t ∈ layers, ∑ a : σ, source M sign p q (t, a)) = + ∑ t ∈ layers, ∑ a : σ, M (t, a) := by + apply Finset.sum_congr rfl + intro t ht + exact source_layer_sum M sign p q h t + +end ShiftedOccupation +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/SmallDegreeCorrections.lean b/lean/OAI/Algebra/DepthFive/SmallDegreeCorrections.lean new file mode 100644 index 0000000000000000000000000000000000000000..28fb4f26c185c9c32ae3b5ebb58a2a17ab7c5306 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/SmallDegreeCorrections.lean @@ -0,0 +1,92 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators + +namespace Problem335 + +/-- A convex chord controls the small-degree correction, without differentiating +its logarithm. -/ +theorem rpow_one_sub_le_chord (q z : ℝ) (hq : 0 < q) + (hz : 0 ≤ z) (hz' : z ≤ 1 / 4) : + q ^ (1 - z) ≤ q + 4 * z * q ^ ((3 : ℝ) / 4) := by + have hconv : q ^ ((1 - 4 * z) * 1 + 4 * z * (3 / 4)) ≤ + (1 - 4 * z) * q ^ (1 : ℝ) + 4 * z * q ^ ((3 : ℝ) / 4) := + (convexOn_rpow_left hq).2 + (Set.mem_univ (1 : ℝ)) (Set.mem_univ ((3 : ℝ) / 4)) + (by linarith) (by positivity) (by ring) + simp only [Real.rpow_one] at hconv + have heq : (1 - 4 * z) * 1 + 4 * z * (3 / 4) = 1 - z := by ring + rw [heq] at hconv + have hnonneg : 0 ≤ 4 * z * q := by positivity + nlinarith + +/-- Sum version of the chord estimate. -/ +theorem sum_rpow_one_sub_le_chord {ι : Type*} (I : Finset ι) + (q : ℝ) (z : ι → ℝ) (hq : 0 < q) + (hz : ∀ i ∈ I, 0 ≤ z i) (hz' : ∀ i ∈ I, z i ≤ 1 / 4) : + ∑ i ∈ I, q ^ (1 - z i) ≤ + (I.card : ℝ) * q + 4 * (∑ i ∈ I, z i) * q ^ ((3 : ℝ) / 4) := by + calc + _ ≤ ∑ i ∈ I, (q + 4 * z i * q ^ ((3 : ℝ) / 4)) := + Finset.sum_le_sum (fun i hi => rpow_one_sub_le_chord q (z i) hq (hz i hi) (hz' i hi)) + _ = _ := by + simp only [Finset.sum_add_distrib, Finset.sum_const, nsmul_eq_mul, + ← Finset.sum_mul, ← Finset.mul_sum] + +/-- The total low-degree correction is `O(sqrt n)`, uniformly in the number +and sizes of factors. The degree variables may be real; natural degrees are a +special case. -/ +theorem sum_small_degree_corrections_le {ι : Type*} (I : Finset ι) + (n s q : ℝ) (e : ι → ℝ) + (hn : 0 < n) (hs : 0 ≤ s) (hs' : s ≤ Real.sqrt n) + (hq : 0 < q) (hqone : q ≤ 1) (hqsmall : q ≤ 2 / Real.sqrt n) + (he : ∀ i ∈ I, 1 ≤ e i) + (helow : ∀ i ∈ I, s * e i / n ≤ 1 / 4) + (hesum : ∑ i ∈ I, e i ≤ n) : + ∑ i ∈ I, q ^ (1 - s * e i / n) ≤ 6 * Real.sqrt n := by + have hpos : ∀ i ∈ I, 0 ≤ s * e i / n := by + intro i hi + exact div_nonneg (mul_nonneg hs (le_trans zero_le_one (he i hi))) hn.le + have hchord := sum_rpow_one_sub_le_chord I q + (fun i => s * e i / n) hq hpos helow + have hcard : (I.card : ℝ) ≤ n := by + calc + (I.card : ℝ) = ∑ i ∈ I, (1 : ℝ) := by simp + _ ≤ ∑ i ∈ I, e i := Finset.sum_le_sum he + _ ≤ n := hesum + have hsum : (∑ i ∈ I, s * e i / n) ≤ s := by + calc + (∑ i ∈ I, s * e i / n) = s / n * ∑ i ∈ I, e i := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + ring + _ ≤ s / n * n := mul_le_mul_of_nonneg_left hesum (div_nonneg hs hn.le) + _ = s := div_mul_cancel₀ s hn.ne' + have hsumpos : 0 ≤ ∑ i ∈ I, s * e i / n := Finset.sum_nonneg hpos + have hqpow : q ^ ((3 : ℝ) / 4) ≤ 1 := Real.rpow_le_one hq.le hqone (by norm_num) + have hproduct : (∑ i ∈ I, s * e i / n) * q ^ ((3 : ℝ) / 4) ≤ s := by + calc + _ ≤ (∑ i ∈ I, s * e i / n) * 1 := + mul_le_mul_of_nonneg_left hqpow hsumpos + _ ≤ s := by simpa using hsum + have hcardq := mul_le_mul_of_nonneg_right hcard hq.le + have hsqrtpos := Real.sqrt_pos.mpr hn + have hqsqrt : q * Real.sqrt n ≤ 2 := (le_div_iff₀ hsqrtpos).mp hqsmall + have hnq : n * q ≤ 2 * Real.sqrt n := by + calc + n * q = Real.sqrt n * (q * Real.sqrt n) := by + nlinarith [Real.sq_sqrt hn.le] + _ ≤ Real.sqrt n * 2 := mul_le_mul_of_nonneg_left hqsqrt hsqrtpos.le + _ = 2 * Real.sqrt n := mul_comm _ _ + nlinarith + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/SwitchRestoration.lean b/lean/OAI/Algebra/DepthFive/SwitchRestoration.lean new file mode 100644 index 0000000000000000000000000000000000000000..aea2cfb14dfc7cd1b515cbf82a0a8b61d820e816 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/SwitchRestoration.lean @@ -0,0 +1,169 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators + +namespace Problem335.SwitchRestoration + +variable {ι : Type*} [DecidableEq ι] + +/-- Switches in a Boolean labeling along a finite collection of oriented edges. -/ +def switchCount (edges : Finset (ι × ι)) (w : ι → Bool) : ℕ := + ∑ e ∈ edges, if w e.1 ≠ w e.2 then 1 else 0 + +/-- The number of edge endpoints at a vertex, counting both ends of a loop. -/ +def endpointDegree (edges : Finset (ι × ι)) (i : ι) : ℕ := + ∑ e ∈ edges, ((if e.1 = i then 1 else 0) + (if e.2 = i then 1 else 0)) + +private theorem edge_switch_restore (S : Finset ι) (y : ι → Bool) (a b : ι) + (hnear : a ∈ S ∨ b ∈ S → y a = true ∧ y b = true) + (hind : ¬ (a ∈ S ∧ b ∈ S)) : + (if (if a ∈ S then false else y a) ≠ (if b ∈ S then false else y b) then 1 else 0) = + (if y a ≠ y b then 1 else 0) + + (if a ∈ S then 1 else 0) + (if b ∈ S then 1 else 0) := by + by_cases ha : a ∈ S <;> by_cases hb : b ∈ S + · exact False.elim (hind ⟨ha, hb⟩) + · obtain ⟨hya, hyb⟩ := hnear (Or.inl ha) + simp [ha, hb, hya, hyb] + · obtain ⟨hya, hyb⟩ := hnear (Or.inr hb) + simp [ha, hb, hya, hyb] + · simp [ha, hb] + +/-- Restoring an independent subset of all-true neighborhoods creates one switch per incident edge. -/ +theorem switchCount_restore_eq (edges : Finset (ι × ι)) (S : Finset ι) (y : ι → Bool) + (hnear : ∀ e ∈ edges, e.1 ∈ S ∨ e.2 ∈ S → y e.1 = true ∧ y e.2 = true) + (hind : ∀ e ∈ edges, ¬ (e.1 ∈ S ∧ e.2 ∈ S)) : + switchCount edges (fun i => if i ∈ S then false else y i) = + switchCount edges y + ∑ i ∈ S, endpointDegree edges i := by + unfold switchCount endpointDegree + rw [Finset.sum_comm (s := S) (t := edges)] + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro e he + rw [Finset.sum_add_distrib] + have ha : (∑ i ∈ S, if e.1 = i then 1 else 0) = if e.1 ∈ S then 1 else 0 := by + simp [eq_comm] + have hb : (∑ i ∈ S, if e.2 = i then 1 else 0) = if e.2 ∈ S then 1 else 0 := by + simp [eq_comm] + rw [ha, hb] + simpa [Nat.add_assoc] using edge_switch_restore S y e.1 e.2 (hnear e he) (hind e he) + +/-- Every restored interior vertex of a path creates exactly two switches. -/ +theorem switchCount_restore_eq_add_twice_card + (edges : Finset (ι × ι)) (S : Finset ι) (y : ι → Bool) + (hnear : ∀ e ∈ edges, e.1 ∈ S ∨ e.2 ∈ S → y e.1 = true ∧ y e.2 = true) + (hind : ∀ e ∈ edges, ¬ (e.1 ∈ S ∧ e.2 ∈ S)) + (hdegree : ∀ i ∈ S, endpointDegree edges i = 2) : + switchCount edges (fun i => if i ∈ S then false else y i) = + switchCount edges y + 2 * S.card := by + rw [switchCount_restore_eq edges S y hnear hind] + congr 1 + calc + ∑ i ∈ S, endpointDegree edges i = ∑ _i ∈ S, 2 := + Finset.sum_congr rfl hdegree + _ = 2 * S.card := by simp [Nat.mul_comm] + + +/-- Edges of the path with `n+1` vertices. -/ +def pathEdges (n : ℕ) : Finset (Fin (n + 1) × Fin (n + 1)) := + Finset.univ.image fun i : Fin n => (i.castSucc, i.succ) + +theorem path_edge_injective (n : ℕ) : + Function.Injective (fun i : Fin n => (i.castSucc, i.succ)) := by + intro i j h + apply Fin.ext + exact congrArg (fun e : Fin (n + 1) × Fin (n + 1) => e.1.val) h + +/-- This switch count agrees with the usual adjacent-position sum. -/ +theorem switchCount_pathEdges (n : ℕ) (w : Fin (n + 1) → Bool) : + switchCount (pathEdges n) w = + ∑ i : Fin n, if w i.castSucc ≠ w i.succ then 1 else 0 := by + unfold switchCount pathEdges + rw [Finset.sum_image] + exact fun i hi j hj h => path_edge_injective n h + +theorem endpointDegree_pathEdges_interior {n : ℕ} (i : Fin (n + 1)) + (hleft : 0 < i.val) (hright : i.val < n) : + endpointDegree (pathEdges n) i = 2 := by + unfold endpointDegree pathEdges + rw [Finset.sum_image] + · rw [Finset.sum_add_distrib] + have hr : (∑ j : Fin n, if j.castSucc = i then 1 else 0) = 1 := by + let r : Fin n := ⟨i.val, hright⟩ + have hri : r.castSucc = i := by apply Fin.ext; rfl + rw [Finset.sum_eq_single r] + · simp [hri] + · intro j hj hne + have hji : j.castSucc ≠ i := by + intro h + apply hne + apply Fin.ext + simpa [r] using congrArg (fun x : Fin (n + 1) => x.val) h + simp [hji] + · simp + have hl : (∑ j : Fin n, if j.succ = i then 1 else 0) = 1 := by + let l : Fin n := ⟨i.val - 1, by omega⟩ + have hli : l.succ = i := by apply Fin.ext; simp only [Fin.val_succ]; dsimp [l]; omega + rw [Finset.sum_eq_single l] + · simp [hli] + · intro j hj hne + have hji : j.succ ≠ i := by + intro h + apply hne + apply Fin.ext + have := congrArg Fin.val h + dsimp [l] + simp only [Fin.val_succ] at this + omega + simp [hji] + · simp + change (∑ j : Fin n, if j.castSucc = i then 1 else 0) + + (∑ j : Fin n, if j.succ = i then 1 else 0) = 2 + rw [hr, hl] + · exact fun a ha b hb h => path_edge_injective n h + + +/-- The path specialization states all hypotheses directly on neighboring indices. -/ +theorem path_switchCount_restore_eq {n : ℕ} (S : Finset (Fin (n + 1))) + (y : Fin (n + 1) → Bool) + (hinterior : ∀ i ∈ S, 0 < i.val ∧ i.val < n) + (hnear : ∀ j : Fin n, j.castSucc ∈ S ∨ j.succ ∈ S → + y j.castSucc = true ∧ y j.succ = true) + (hind : ∀ j : Fin n, ¬ (j.castSucc ∈ S ∧ j.succ ∈ S)) : + switchCount (pathEdges n) (fun i => if i ∈ S then false else y i) = + switchCount (pathEdges n) y + 2 * S.card := by + apply switchCount_restore_eq_add_twice_card + · intro e he + obtain ⟨j, hj, rfl⟩ := Finset.mem_image.mp he + exact hnear j + · intro e he + obtain ⟨j, hj, rfl⟩ := Finset.mem_image.mp he + exact hind j + · intro i hi + exact endpointDegree_pathEdges_interior i (hinterior i hi).1 (hinterior i hi).2 + +/-- Restoring false symbols removes exactly the chosen true symbols. -/ +theorem trueVertices_restore_eq_sdiff (V S : Finset ι) (y : ι → Bool) : + (V.filter fun i => (if i ∈ S then false else y i) = true) = + (V.filter fun i => y i = true) \ S := by + ext i + by_cases hi : i ∈ S <;> simp [hi, and_comm] + +/-- Cardinal form without truncated subtraction, suitable for exponent arithmetic. -/ +theorem trueVertices_restore_card_add (V S : Finset ι) (y : ι → Bool) + (hS : S ⊆ V) (hy : ∀ i ∈ S, y i = true) : + (V.filter fun i => (if i ∈ S then false else y i) = true).card + S.card = + (V.filter fun i => y i = true).card := by + rw [trueVertices_restore_eq_sdiff] + apply Finset.card_sdiff_add_card_eq_card + intro i hi + exact Finset.mem_filter.mpr ⟨hS hi, hy i hi⟩ + +end Problem335.SwitchRestoration + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/TraceComplexification.lean b/lean/OAI/Algebra/DepthFive/TraceComplexification.lean new file mode 100644 index 0000000000000000000000000000000000000000..a75b40e25191ed1292752f2b6747aec4b9deb698 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/TraceComplexification.lean @@ -0,0 +1,87 @@ +import OAI.Algebra.DepthFive.TraceExpansion + +namespace OAI + +/-! The real nonnegative path matrix can be read over the complex numbers +without changing either of its two trace moments. -/ + +noncomputable section +open scoped BigOperators Matrix + +namespace Problem335 + +variable {I J P : Type*} [Fintype I] [Fintype J] [Fintype P] + [DecidableEq I] [DecidableEq J] + +/-- Real entrywise complexification sends the real Gram matrix to the complex Gram matrix. -/ +theorem complexify_gram {I : Type u_1} {J : Type u_2} + [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] (A : Matrix J I ℝ) : + (A.map Complex.ofReal).conjTranspose * A.map Complex.ofReal = + (A.transpose * A).map Complex.ofReal := by + ext i k + simp [Matrix.mul_apply, Matrix.conjTranspose_apply, Matrix.map_apply, + Complex.ofReal_sum, Complex.ofReal_mul] + +/-- Entrywise complexification preserves the real part of the trace. -/ +theorem trace_complexify_re {I : Type u_1} [Fintype I] [DecidableEq I] + (A : Matrix I I ℝ) : + (A.map Complex.ofReal).trace.re = A.trace := by + simp [Matrix.trace, Matrix.map_apply] + +/-- First moment agrees over the real and complex coefficient fields. -/ +theorem complexify_first_trace (A : Matrix J I ℝ) : + ((A.map Complex.ofReal).conjTranspose * A.map Complex.ofReal).trace.re = + (A.transpose * A).trace := by + rw [complexify_gram, trace_complexify_re] + +/-- Second moment agrees over the real and complex coefficient fields. -/ +theorem complexify_second_trace (A : Matrix J I ℝ) : + (((A.map Complex.ofReal).conjTranspose * A.map Complex.ofReal) ^ 2).trace.re = + ((A.transpose * A) ^ 2).trace := by + rw [complexify_gram] + have h : ((A.transpose * A).map Complex.ofReal) ^ 2 = + ((A.transpose * A) ^ 2).map Complex.ofReal := by + exact (Matrix.map_pow (A.transpose * A) Complex.ofRealHom 2).symm + rw [h, trace_complexify_re] + +/-- Complexifying a path matrix complexifies just its weights. -/ +theorem pathShiftMatrix_complexify {I : Type u_1} {J : Type u_2} {P : Type u_3} + [Fintype I] [Fintype J] [Fintype P] [DecidableEq I] [DecidableEq J] + (shift : I → P → J) (weight : I → P → ℝ) : + (pathShiftMatrix shift weight).map Complex.ofReal = + pathShiftMatrix shift (fun i p => (weight i p : ℂ)) := by + ext j i + simp only [pathShiftMatrix, Matrix.map_apply, Complex.ofReal_sum] + apply Finset.sum_congr rfl + intro p hp + split_ifs <;> simp + +/-- First complex trace of the square-root mass path matrix. -/ +theorem complex_path_first_trace_sqrt + (shift : I → P → J) (mass : I → P → ℝ) + (hnonneg : ∀ i p, 0 ≤ mass i p) + (hdisjoint : ∀ i p q, p ≠ q → shift i p = shift i q → + mass i p = 0 ∨ mass i q = 0) : + let A := pathShiftMatrix shift (fun i p => (Real.sqrt (mass i p) : ℂ)) + (A.conjTranspose * A).trace.re = ∑ i, ∑ p, mass i p := by + dsimp + rw [← pathShiftMatrix_complexify, complexify_first_trace] + exact pathShiftMatrix_first_trace_sqrt shift mass hnonneg hdisjoint + +/-- Four-path expression of the second complex trace for real path weights. -/ +theorem complex_path_second_trace_four_paths + (shift : I → P → J) (weight : I → P → ℝ) : + let A := pathShiftMatrix shift (fun i p => (weight i p : ℂ)) + ((A.conjTranspose * A) ^ 2).trace.re = + ∑ i, ∑ k, ∑ p, ∑ q, ∑ r, ∑ s, + if shift i p = shift k q ∧ shift i r = shift k s then + weight i p * weight k q * weight i r * weight k s else 0 := by + dsimp + rw [← pathShiftMatrix_complexify, complexify_second_trace] + exact pathShiftMatrix_second_trace_four_paths shift weight + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/TraceExpansion.lean b/lean/OAI/Algebra/DepthFive/TraceExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6782003498afecea80ebbf9afc80034a83dd337 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/TraceExpansion.lean @@ -0,0 +1,167 @@ +import Mathlib + +namespace OAI + +/-! Finite matrix expansions for the two trace moments in the IMM argument. +These identities contain no analytic or asymptotic assumptions. -/ + +noncomputable section +open scoped BigOperators Matrix + +namespace Problem335 + +variable {I J P R : Type*} [Fintype I] [Fintype J] [Fintype P] + [DecidableEq I] [DecidableEq J] + +/-- A matrix whose column is a weighted sum of path shifts. -/ +def pathShiftMatrix [AddCommMonoid R] (shift : I → P → J) (weight : I → P → R) : + Matrix J I R := by + classical + exact fun j i => ∑ p, if shift i p = j then weight i p else 0 + +/-- Expanding a real Gram matrix gives the sum of squared entries. -/ +theorem trace_transpose_mul_self {I : Type u_1} {J : Type u_2} + [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] (A : Matrix J I ℝ) : + Matrix.trace (A.transpose * A) = ∑ i, ∑ j, (A j i) ^ 2 := by + simp [Matrix.trace, Matrix.mul_apply, pow_two] + +/-- The second moment is the sum of squares of all Gram entries. -/ +theorem trace_gram_sq {I : Type u_1} {J : Type u_2} + [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] (A : Matrix J I ℝ) : + Matrix.trace ((A.transpose * A) ^ 2) = + ∑ i, ∑ k, (∑ j, A j i * A j k) ^ 2 := by + simp only [pow_two, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.transpose_apply] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro k hk + congr 1 + apply Finset.sum_congr rfl + intro j hj + ring + +/-- The Gram entry is a weighted count of pairs of paths with equal shifts. -/ +theorem pathShiftMatrix_gram_apply + {I : Type u_1} {J : Type u_2} {P : Type u_3} {R : Type u_4} + [Fintype I] [Fintype J] [Fintype P] [DecidableEq I] [DecidableEq J] [CommSemiring R] + (shift : I → P → J) (weight : I → P → R) (i k : I) : + ((pathShiftMatrix shift weight).transpose * pathShiftMatrix shift weight) i k = + ∑ p, ∑ q, if shift i p = shift k q then weight i p * weight k q else 0 := by + classical + simp only [Matrix.mul_apply, Matrix.transpose_apply, pathShiftMatrix] + simp_rw [Finset.sum_mul] + simp_rw [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro p hp + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro q hq + simp only [ite_mul, zero_mul, mul_ite, mul_zero] + simp [eq_comm] + +/-- It is enough that distinct paths reaching the same row have zero weight product. +This permits invalid path shifts to be given arbitrary target indices when their +weight is zero. -/ +theorem pathShiftMatrix_first_trace [CommSemiring R] + (shift : I → P → J) (weight : I → P → R) + (hdisjoint : ∀ i p q, p ≠ q → shift i p = shift i q → + weight i p * weight i q = 0) : + Matrix.trace ((pathShiftMatrix shift weight).transpose * pathShiftMatrix shift weight) = + ∑ i, ∑ p, weight i p ^ 2 := by + classical + simp only [Matrix.trace, Matrix.diag_apply, pathShiftMatrix_gram_apply] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro p hp + rw [Finset.sum_eq_single p] + · simp [pow_two] + · intro q hq hqp + by_cases hs : shift i p = shift i q + · simp [hs, hdisjoint i p q (Ne.symm hqp) hs] + · simp [hs] + · simp + +/-- Columnwise injectivity of the path shifts implies the first trace identity. -/ +theorem pathShiftMatrix_first_trace_of_injective [CommSemiring R] + (shift : I → P → J) (weight : I → P → R) + (hinj : ∀ i, Function.Injective (shift i)) : + Matrix.trace ((pathShiftMatrix shift weight).transpose * pathShiftMatrix shift weight) = + ∑ i, ∑ p, weight i p ^ 2 := by + apply pathShiftMatrix_first_trace + intro i p q hpq hshift + exact (hpq (hinj i hshift)).elim + +/-- The second trace is the squared-overlap sum of the weighted path shifts. -/ +theorem pathShiftMatrix_second_trace + (shift : I → P → J) (weight : I → P → ℝ) : + Matrix.trace (((pathShiftMatrix shift weight).transpose * + pathShiftMatrix shift weight) ^ 2) = + ∑ i, ∑ k, (∑ p, ∑ q, + if shift i p = shift k q then weight i p * weight k q else 0) ^ 2 := by + rw [trace_gram_sq] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro k hk + congr 1 + exact pathShiftMatrix_gram_apply shift weight i k + +/-- Frobenius expansion over the complex numbers, with the genuine adjoint. -/ +theorem trace_conjTranspose_mul_self_complex {I : Type u_1} {J : Type u_2} + [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] (A : Matrix J I ℂ) : + Matrix.trace (A.conjTranspose * A) = + ∑ i, ∑ j, (Complex.normSq (A j i) : ℂ) := by + simp only [Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.conjTranspose_apply, Complex.normSq_eq_conj_mul_self] + rfl + +/-- The complete four-path expansion of the second trace moment. -/ +theorem pathShiftMatrix_second_trace_four_paths + (shift : I → P → J) (weight : I → P → ℝ) : + Matrix.trace (((pathShiftMatrix shift weight).transpose * + pathShiftMatrix shift weight) ^ 2) = + ∑ i, ∑ k, ∑ p, ∑ q, ∑ r, ∑ s, + if shift i p = shift k q ∧ shift i r = shift k s then + weight i p * weight k q * weight i r * weight k s else 0 := by + rw [pathShiftMatrix_second_trace] + simp only [pow_two] + simp_rw [Finset.sum_mul] + simp_rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro k hk + apply Finset.sum_congr rfl + intro p hp + apply Finset.sum_congr rfl + intro q hq + apply Finset.sum_congr rfl + intro r hr + apply Finset.sum_congr rfl + intro s hs + by_cases h₁ : shift i p = shift k q <;> + by_cases h₂ : shift i r = shift k s <;> simp [h₁, h₂, mul_assoc] + +/-- Square-root path weights yield the sum of the underlying occupation masses. +Zero-mass invalid paths need not have distinct shifts. -/ +theorem pathShiftMatrix_first_trace_sqrt + (shift : I → P → J) (mass : I → P → ℝ) + (hnonneg : ∀ i p, 0 ≤ mass i p) + (hdisjoint : ∀ i p q, p ≠ q → shift i p = shift i q → + mass i p = 0 ∨ mass i q = 0) : + Matrix.trace ((pathShiftMatrix shift (fun i p => Real.sqrt (mass i p))).transpose * + pathShiftMatrix shift (fun i p => Real.sqrt (mass i p))) = + ∑ i, ∑ p, mass i p := by + rw [pathShiftMatrix_first_trace] + · simp [Real.sq_sqrt, hnonneg] + · intro i p q hpq hshift + rcases hdisjoint i p q hpq hshift with h | h <;> simp [h] + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/TraceRank.lean b/lean/OAI/Algebra/DepthFive/TraceRank.lean new file mode 100644 index 0000000000000000000000000000000000000000..9acc1d0a2fa6026855b9a9685762e7d63f14d8eb --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/TraceRank.lean @@ -0,0 +1,78 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexOrder + +namespace Problem335 + +/-- Cauchy--Schwarz with only the nonzero summands counted. -/ +theorem sq_sum_le_support_card_mul_sum_sq {ι : Type*} [Fintype ι] + (f : ι → ℝ) : + (∑ i, f i) ^ 2 ≤ (Fintype.card {i // f i ≠ 0} : ℝ) * ∑ i, f i ^ 2 := by + classical + let s := Finset.univ.filter (fun i => f i ≠ 0) + have hsum : ∑ i ∈ s, f i = ∑ i, f i := by + exact Finset.sum_filter_ne_zero _ + have hsq : ∑ i ∈ s, f i ^ 2 = ∑ i, f i ^ 2 := by + apply Finset.sum_subset (Finset.filter_subset _ _) + intro i hi his + have hf : f i = 0 := by simpa [s] using his + simp [hf] + have h := sq_sum_le_card_mul_sum_sq (s := s) (f := f) + simpa only [hsum, hsq, Fintype.card_subtype] using h + +/-- The second spectral moment of a Hermitian matrix. -/ +theorem hermitian_trace_sq_eq_sum_eigenvalues_sq {ι : Type*} [Fintype ι] + [DecidableEq ι] {A : Matrix ι ι ℂ} (hA : A.IsHermitian) : + (A ^ 2).trace = ∑ i, ((hA.eigenvalues i : ℂ) ^ 2) := by + conv_lhs => + rw [hA.spectral_theorem, ← map_pow, Unitary.conjStarAlgAut_apply, + Matrix.trace_mul_cycle, Unitary.coe_star_mul_self, one_mul] + simp [Matrix.diagonal_pow, Function.comp_def] + +/-- The trace-rank bound used in the moment method. Positivity is not needed +for this squared formulation: Hermitian symmetry suffices. -/ +theorem hermitian_trace_sq_le_rank_mul_trace_sq {ι : Type*} [Fintype ι] + [DecidableEq ι] {A : Matrix ι ι ℂ} (hA : A.IsHermitian) : + A.trace.re ^ 2 ≤ (A.rank : ℝ) * (A ^ 2).trace.re := by + rw [hA.trace_eq_sum_eigenvalues, hermitian_trace_sq_eq_sum_eigenvalues_sq hA, + hA.rank_eq_card_non_zero_eigs] + simpa [← Complex.ofReal_pow] using + sq_sum_le_support_card_mul_sum_sq hA.eigenvalues + +/-- A nonzero Hermitian matrix has strictly positive second moment. -/ +theorem hermitian_trace_sq_pos {ι : Type*} [Fintype ι] + [DecidableEq ι] {A : Matrix ι ι ℂ} (hA : A.IsHermitian) (hne : A ≠ 0) : + 0 < (A ^ 2).trace.re := by + have he : hA.eigenvalues ≠ 0 := by + intro hz + exact hne (hA.eigenvalues_eq_zero_iff.mp hz) + obtain ⟨i, hi⟩ := Function.ne_iff.mp he + rw [hermitian_trace_sq_eq_sum_eigenvalues_sq hA] + simp only [← Complex.ofReal_pow, Complex.re_sum, Complex.ofReal_re] + exact Finset.sum_pos' (fun j _ => sq_nonneg _) ⟨i, Finset.mem_univ _, sq_pos_of_ne_zero hi⟩ + +/-- The ratio form of the trace-rank bound. -/ +theorem hermitian_rank_ge_trace_ratio {ι : Type*} [Fintype ι] + [DecidableEq ι] {A : Matrix ι ι ℂ} (hA : A.IsHermitian) + (hsecond : 0 < (A ^ 2).trace.re) : + A.trace.re ^ 2 / (A ^ 2).trace.re ≤ (A.rank : ℝ) := by + apply (div_le_iff₀ hsecond).2 + exact hermitian_trace_sq_le_rank_mul_trace_sq hA + +/-- Applied to the Gram matrix, the moment method bounds the rank of the +original rectangular matrix. -/ +theorem gram_rank_ge_trace_ratio {ι κ : Type*} [Fintype ι] [Fintype κ] + [DecidableEq κ] (A : Matrix ι κ ℂ) + (hsecond : 0 < ((A.conjTranspose * A) ^ 2).trace.re) : + (A.conjTranspose * A).trace.re ^ 2 / ((A.conjTranspose * A) ^ 2).trace.re ≤ (A.rank : ℝ) := by + have h := hermitian_rank_ge_trace_ratio (Matrix.isHermitian_conjTranspose_mul_self A) hsecond + simpa only [Matrix.rank_conjTranspose_mul_self] using h + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/UpperBlockData.lean b/lean/OAI/Algebra/DepthFive/UpperBlockData.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ad3eadbcdb5609f9f6efe487954e59d7c3d3e70 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/UpperBlockData.lean @@ -0,0 +1,146 @@ +import OAI.Algebra.DepthFive.MatrixPaths +import OAI.Algebra.DepthFive.UpperGateCounting + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.BlockData + +variable {n : ℕ} + +/-- Block-entry gates: block number and two matrix indices. -/ +abbrev Middle (blocks : List (List (Fin n))) := + Fin blocks.length × Fin n × Fin n + +def paths (blocks : List (List (Fin n))) (m : Middle blocks) := + matrixEntryPaths (blocks.get m.1) m.2.1 m.2.2 + +/-- Each lower gate is an enumerated path for one block entry. -/ +abbrev Lower (blocks : List (List (Fin n))) := + Σ m : Middle blocks, Fin (paths blocks m).length + +def lowerInputs (blocks : List (List (Fin n))) (p : Lower blocks) : + List (Fin n × Fin n × Fin n) := + (paths blocks p.1).get p.2 + +def middleInputs (K : Type*) [One K] (blocks : List (List (Fin n))) + (m : Middle blocks) : List (K × Lower blocks) := + List.ofFn fun p : Fin (paths blocks m).length => (1, ⟨m, p⟩) + +def middleDegree (blocks : List (List (Fin n))) (m : Middle blocks) : ℕ := + (blocks.get m.1).length + +def upperPaths (blocks : List (List (Fin n))) (z : Fin n) : + List (List (Middle blocks)) := + matrixEntryPaths (List.finRange blocks.length) z z + +abbrev Upper (blocks : List (List (Fin n))) (z : Fin n) := + Fin (upperPaths blocks z).length + +def upperInputs (blocks : List (List (Fin n))) (z : Fin n) + (p : Upper blocks z) : List (Middle blocks) := + (upperPaths blocks z).get p + +def outputInputs (K : Type*) [One K] (blocks : List (List (Fin n))) + (z : Fin n) : List (K × Upper blocks z) := + List.ofFn fun p : Upper blocks z => (1, p) + +theorem lowerInputs_labels (blocks : List (List (Fin n))) (p : Lower blocks) : + (lowerInputs blocks p).map Prod.fst = blocks.get p.1.1 := by + exact matrixEntryPaths_labels _ _ _ _ (List.get_mem _ _) + +theorem lowerInputs_length (blocks : List (List (Fin n))) (p : Lower blocks) : + (lowerInputs blocks p).length = middleDegree blocks p.1 := by + exact matrixEntryPaths_path_length _ _ _ _ (List.get_mem _ _) + +theorem middleInputs_homogeneous (K : Type*) [One K] + (blocks : List (List (Fin n))) (m : Middle blocks) + (entry : K × Lower blocks) (h : entry ∈ middleInputs K blocks m) : + (lowerInputs blocks entry.2).length = middleDegree blocks m := by + obtain ⟨p, rfl⟩ := List.mem_ofFn.mp h + exact lowerInputs_length blocks ⟨m, p⟩ + +theorem upperInputs_labels (blocks : List (List (Fin n))) (z : Fin n) + (p : Upper blocks z) : + (upperInputs blocks z p).map Prod.fst = List.finRange blocks.length := by + exact matrixEntryPaths_labels _ _ _ _ (List.get_mem _ _) + +theorem upperInputs_degree (blocks : List (List (Fin n))) (z : Fin n) + (p : Upper blocks z) : + ((upperInputs blocks z p).map (middleDegree blocks)).sum = + (blocks.map List.length).sum := by + change ((upperInputs blocks z p).map (fun m => (blocks.get m.1).length)).sum = _ + have h := congrArg (fun l : List (Fin blocks.length) => + (l.map (fun b => (blocks.get b).length)).sum) (upperInputs_labels blocks z p) + have hg := congrArg (List.map List.length) (List.map_get_finRange blocks) + simp only [List.map_map, Function.comp_def] at hg + simpa only [List.map_map, Function.comp_def, middleDegree, hg] using h + +theorem paths_length (blocks : List (List (Fin n))) + (hne : ∀ b : Fin blocks.length, blocks.get b ≠ []) (m : Middle blocks) : + (paths blocks m).length = n ^ ((blocks.get m.1).length - 1) := by + simpa [paths] using matrixEntryPaths_length (blocks.get m.1) (hne m.1) m.2.1 m.2.2 + +theorem middleInputs_ne_nil (K : Type*) [One K] + (blocks : List (List (Fin n))) (hn : 0 < n) + (hne : ∀ b : Fin blocks.length, blocks.get b ≠ []) (m : Middle blocks) : + middleInputs K blocks m ≠ [] := by + apply List.ne_nil_of_length_pos + simpa [middleInputs, paths_length blocks hne] using + (Nat.pow_pos hn : 0 < n ^ ((blocks.get m.1).length - 1)) + +theorem upperPaths_length (blocks : List (List (Fin n))) (hb : blocks ≠ []) (z : Fin n) : + (upperPaths blocks z).length = n ^ (blocks.length - 1) := by + have h : List.finRange blocks.length ≠ [] := by + simpa using hb + simpa [upperPaths] using matrixEntryPaths_length (List.finRange blocks.length) h z z + +theorem outputInputs_ne_nil (K : Type*) [One K] + (blocks : List (List (Fin n))) (hb : blocks ≠ []) (z : Fin n) : + outputInputs K blocks z ≠ [] := by + apply List.ne_nil_of_length_pos + have hn : 0 < n := Nat.zero_lt_of_lt z.isLt + simpa [outputInputs, upperPaths_length blocks hb z] using + (Nat.pow_pos hn : 0 < n ^ (blocks.length - 1)) + +@[simp] theorem card_middle (blocks : List (List (Fin n))) : + Fintype.card (Middle blocks) = blocks.length * n ^ 2 := by + simp [Middle, pow_two] + +theorem card_upper (blocks : List (List (Fin n))) (hb : blocks ≠ []) (z : Fin n) : + Fintype.card (Upper blocks z) = n ^ (blocks.length - 1) := by + simpa only [Fintype.card_fin] using upperPaths_length blocks hb z + +theorem card_lower (blocks : List (List (Fin n))) + (hne : ∀ b : Fin blocks.length, blocks.get b ≠ []) : + Fintype.card (Lower blocks) = + ∑ b : Fin blocks.length, n ^ ((blocks.get b).length + 1) := by + simp only [Lower, Fintype.card_sigma, Fintype.card_fin] + simp_rw [paths_length blocks hne] + rw [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro b _ + have hd : 1 ≤ (blocks.get b).length := List.length_pos_iff.mpr (hne b) + have hcount := block_entry_monomial_count n (blocks.get b).length hd + simpa only [Fintype.card_prod, Fintype.card_fin, Fintype.card_fun, + Finset.sum_const, Finset.card_univ, Fintype.card_prod, nsmul_eq_mul, Nat.cast_id, Nat.mul_assoc] using hcount + +theorem card_lower_le (blocks : List (List (Fin n))) (t : ℕ) + (hn : 1 ≤ n) (hne : ∀ b : Fin blocks.length, blocks.get b ≠ []) + (hlen : ∀ b : Fin blocks.length, (blocks.get b).length ≤ t) : + Fintype.card (Lower blocks) ≤ blocks.length * n ^ (t + 1) := by + rw [card_lower blocks hne] + calc + ∑ b : Fin blocks.length, n ^ ((blocks.get b).length + 1) ≤ + ∑ _b : Fin blocks.length, n ^ (t + 1) := by + exact Finset.sum_le_sum (fun b _ => + pow_le_pow_right₀ hn (Nat.add_le_add_right (hlen b) 1)) + _ = blocks.length * n ^ (t + 1) := by simp + +end Problem335.BlockData + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/UpperBoundArithmetic.lean b/lean/OAI/Algebra/DepthFive/UpperBoundArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..826f463c26c7f5f8001ceabb25dd63bd8ee168b8 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/UpperBoundArithmetic.lean @@ -0,0 +1,84 @@ +import OAI.Algebra.DepthFive.CeilArithmetic + +namespace OAI + +noncomputable section +namespace Problem335 + +/-- The elementary gate-count estimate, before specializing the block parameters. -/ +theorem gateCount_le_pow (n t r : ℕ) (hn : 3 ≤ n) + (ht : 2 ≤ t) (hr : r ≤ t) (htn : t ≤ n) : + 2 * n ^ 3 + r * n ^ 2 + r * n ^ (t + 1) + n ^ (r - 1) + 1 ≤ + n ^ (t + 3) := by + have hn0 : 0 < n := by omega + have hrn : r ≤ n := hr.trans htn + have hfirst : 2 * n ^ 3 + r * n ^ 2 ≤ 3 * n ^ 3 := by + have h := Nat.mul_le_mul_right (n ^ 2) hrn + nlinarith [pow_succ n 2] + have hsecond : r * n ^ (t + 1) ≤ n ^ (t + 2) := by + calc + r * n ^ (t + 1) ≤ n * n ^ (t + 1) := + Nat.mul_le_mul_right _ hrn + _ = n ^ (t + 2) := by simp [pow_add]; ring + have hthird : n ^ (r - 1) ≤ n ^ (t - 1) := + Nat.pow_le_pow_right hn0 (Nat.sub_le_sub_right hr 1) + have hsmall : 3 * n ^ 3 ≤ n ^ (t + 2) := by + calc + 3 * n ^ 3 ≤ n * n ^ 3 := Nat.mul_le_mul_right _ hn + _ = n ^ 4 := by ring + _ ≤ n ^ (t + 2) := Nat.pow_le_pow_right hn0 (by omega) + have htail : n ^ (t - 1) + 1 ≤ n ^ (t + 2) := by + have h := Nat.pow_lt_pow_right (by omega : 1 < n) (show t - 1 < t + 2 by omega) + omega + have htotal : + 2 * n ^ 3 + r * n ^ 2 + r * n ^ (t + 1) + n ^ (r - 1) + 1 ≤ + 3 * n ^ (t + 2) := by omega + calc + _ ≤ 3 * n ^ (t + 2) := htotal + _ ≤ n * n ^ (t + 2) := Nat.mul_le_mul_right _ hn + _ = n ^ (t + 3) := by simp [pow_add]; ring + +/-- Conversion of the integer block gate count into the advertised real-power bound. -/ +theorem gateCount_le_rpow (n t r : ℕ) (hn : 3 ≤ n) + (ht : 2 ≤ t) (hr : r ≤ t) (htn : t ≤ n) + (htsqrt : (t : ℝ) ≤ Real.sqrt (n : ℝ) + 1) : + ((2 * n ^ 3 + r * n ^ 2 + r * n ^ (t + 1) + n ^ (r - 1) + 1 : ℕ) : ℝ) ≤ + (n : ℝ) ^ (Real.sqrt (n : ℝ) + 4) := by + calc + _ ≤ ((n ^ (t + 3) : ℕ) : ℝ) := by + exact_mod_cast gateCount_le_pow n t r hn ht hr htn + _ = (n : ℝ) ^ ((t + 3 : ℕ) : ℝ) := by rw [Real.rpow_natCast]; norm_cast + _ ≤ (n : ℝ) ^ (Real.sqrt (n : ℝ) + 4) := by + apply Real.rpow_le_rpow_of_exponent_le + · exact_mod_cast (show 1 ≤ n by omega) + · push_cast + linarith + +/-- The exceptional smallest size in the upper-bound estimate. -/ +theorem upperGateBound_two_le_rpow : + (upperGateBound 2 : ℝ) ≤ (2 : ℝ) ^ (Real.sqrt 2 + 4) := by + have hcount : upperGateBound 2 = 30 := by + norm_num [upperGateBound, ceilSqrt, ceilDiv, Nat.sqrt_two] + rw [hcount] + calc + (30 : ℝ) ≤ (2 : ℝ) ^ (5 : ℕ) := by norm_num + _ = (2 : ℝ) ^ (5 : ℝ) := (Real.rpow_natCast 2 5).symm + _ ≤ (2 : ℝ) ^ (Real.sqrt 2 + 4) := by + apply Real.rpow_le_rpow_of_exponent_le (by norm_num) + have h : (1 : ℝ) ≤ Real.sqrt 2 := Real.one_le_sqrt.mpr (by norm_num) + linarith + +/-- The explicit gate bound is at most `n^(sqrt n + 4)`. -/ +theorem upperGateBound_le_rpow (n : ℕ) (hn : 2 ≤ n) : + (upperGateBound n : ℝ) ≤ (n : ℝ) ^ (Real.sqrt (n : ℝ) + 4) := by + rcases eq_or_lt_of_le hn with rfl | hn + · exact upperGateBound_two_le_rpow + · exact gateCount_le_rpow n (ceilSqrt n) (ceilDiv n (ceilSqrt n)) + (by omega) (two_le_ceilSqrt (by omega)) (ceilDiv_ceilSqrt_le n) + (ceilSqrt_le_self n) (ceilSqrt_cast_le_real_sqrt_add_one n) + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/UpperConstruction.lean b/lean/OAI/Algebra/DepthFive/UpperConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..a960ef3960b9c645eb4231e95646b717d65fd330 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/UpperConstruction.lean @@ -0,0 +1,64 @@ +import OAI.Algebra.DepthFive.BlockCircuitValue +import OAI.Algebra.DepthFive.BlockPartition +import OAI.Algebra.DepthFive.CeilArithmetic + +namespace OAI + +noncomputable section + +namespace Problem335 + +/-- The canonical block circuit at block width `ceilSqrt n`. -/ +def immUpperCircuit (K : Type*) [CommSemiring K] (n : ℕ) (hn : 0 < n) : + Depth5Circuit K n := + BlockData.circuit K (layerBlocks n (ceilSqrt n)) ⟨0, hn⟩ + +@[simp] theorem immUpperCircuit_outputDegree (K : Type*) [CommSemiring K] + (n : ℕ) (hn : 0 < n) : (immUpperCircuit K n hn).outputDegree = n := by + simp [immUpperCircuit] + +theorem immUpperCircuit_size (K : Type*) [CommSemiring K] + (n : ℕ) (hn : 0 < n) : circuitSize (immUpperCircuit K n hn) ≤ upperGateBound n := by + have ht : 0 < ceilSqrt n := ceilSqrt_pos hn + have hb : layerBlocks n (ceilSqrt n) ≠ [] := by + intro h + have hlen := layerBlocks_length (n := n) ht + rw [h, List.length_nil] at hlen + have hp := ceilDiv_pos hn ht + omega + have hne : ∀ b : Fin (layerBlocks n (ceilSqrt n)).length, + (layerBlocks n (ceilSqrt n)).get b ≠ [] := by + intro b + exact layerBlocks_nonempty ht (List.get_mem ..) + have hlower := BlockData.card_lower_le (layerBlocks n (ceilSqrt n)) + (ceilSqrt n) hn hne (layerBlocks_get_length_le ht) + have hlen := layerBlocks_length (n := n) ht + rw [immUpperCircuit, BlockData.circuit_size, BlockData.card_middle, + BlockData.card_upper _ hb] + calc + _ ≤ 2 * n ^ 3 + (layerBlocks n (ceilSqrt n)).length * n ^ (ceilSqrt n + 1) + + (layerBlocks n (ceilSqrt n)).length * n ^ 2 + + n ^ ((layerBlocks n (ceilSqrt n)).length - 1) + 1 := by omega + _ = upperGateBound n := by + rw [hlen] + simp only [upperGateBound] + omega + +@[simp] theorem immUpperCircuit_value (K : Type*) [CommSemiring K] + (n : ℕ) (hn : 0 < n) : circuitValue (immUpperCircuit K n hn) = imm K n := by + exact BlockData.circuit_value_eq_imm K hn (layerBlocks n (ceilSqrt n)) + (layerBlocks_flatten n (ceilSqrt n)) + +/-- A homogeneous depth-five circuit attaining the explicit block-expansion gate budget. -/ +theorem exists_imm_circuit_le_upperGateBound (K : Type*) [CommSemiring K] + (n : ℕ) (hn : 2 ≤ n) : + ∃ c : Depth5Circuit K n, circuitValue c = imm K n ∧ circuitSize c ≤ upperGateBound n := by + have hn0 : 0 < n := by omega + exact ⟨immUpperCircuit K n hn0, immUpperCircuit_value K n hn0, + immUpperCircuit_size K n hn0⟩ + +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/UpperGateCounting.lean b/lean/OAI/Algebra/DepthFive/UpperGateCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..47f354f5a2ce9a4a002a5dd9087e9e02a87e8099 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/UpperGateCounting.lean @@ -0,0 +1,64 @@ +import Mathlib + +namespace OAI + +/-! Finite index counts for the consecutive-block depth-five construction. -/ + +open scoped BigOperators + +namespace Problem335 + +/-- A lower product gate chooses a block, its two endpoints, and all internal indices. -/ +abbrev BlockLowerIndex (n r : ℕ) (d : Fin r → ℕ) := + Σ b : Fin r, Fin n × Fin n × (Fin (d b - 1) → Fin n) + +/-- A middle sum gate computes one entry of one block product. -/ +abbrev BlockMiddleIndex (n r : ℕ) := Fin r × Fin n × Fin n + +/-- An upper product gate chooses the indices at the boundaries between blocks. -/ +abbrev BlockUpperIndex (n r : ℕ) := Fin (r - 1) → Fin n + +@[simp] theorem card_blockMiddleIndex (n r : ℕ) : + Fintype.card (BlockMiddleIndex n r) = r * n ^ 2 := by + simp [BlockMiddleIndex, pow_two] + +@[simp] theorem card_blockUpperIndex (n r : ℕ) : + Fintype.card (BlockUpperIndex n r) = n ^ (r - 1) := by + simp [BlockUpperIndex] + +/-- Count the monomials used for every entry of a nonempty block. -/ +theorem block_entry_monomial_count (n d : ℕ) (hd : 1 ≤ d) : + Fintype.card (Fin n × Fin n × (Fin (d - 1) → Fin n)) = n ^ (d + 1) := by + have h : 2 + (d - 1) = d + 1 := by omega + simp only [Fintype.card_prod, Fintype.card_fin, Fintype.card_fun] + rw [← mul_assoc, ← pow_two, ← pow_add, h] + +theorem card_blockLowerIndex (n r : ℕ) (d : Fin r → ℕ) + (hd : ∀ b, 1 ≤ d b) : + Fintype.card (BlockLowerIndex n r d) = ∑ b, n ^ (d b + 1) := by + rw [Fintype.card_sigma] + exact Finset.sum_congr rfl (fun b _ => block_entry_monomial_count n (d b) (hd b)) + +/-- Uniform block-length bounds control the total number of lower gates. -/ +theorem card_blockLowerIndex_le (n r t : ℕ) (d : Fin r → ℕ) + (hn : 1 ≤ n) (hd : ∀ b, 1 ≤ d b) (hdt : ∀ b, d b ≤ t) : + Fintype.card (BlockLowerIndex n r d) ≤ r * n ^ (t + 1) := by + rw [card_blockLowerIndex n r d hd] + calc + ∑ b : Fin r, n ^ (d b + 1) ≤ ∑ _b : Fin r, n ^ (t + 1) := by + exact Finset.sum_le_sum (fun b _ => pow_le_pow_right₀ hn (Nat.add_le_add_right (hdt b) 1)) + _ = r * n ^ (t + 1) := by simp + +/-- The exact finite index counts give the advertised combinatorial gate bound. -/ +theorem block_gate_count_le (n r t : ℕ) (d : Fin r → ℕ) + (hn : 1 ≤ n) (hd : ∀ b, 1 ≤ d b) (hdt : ∀ b, d b ≤ t) : + 2 * n ^ 3 + Fintype.card (BlockLowerIndex n r d) + + Fintype.card (BlockMiddleIndex n r) + Fintype.card (BlockUpperIndex n r) + 1 ≤ + 2 * n ^ 3 + r * n ^ 2 + r * n ^ (t + 1) + n ^ (r - 1) + 1 := by + rw [card_blockMiddleIndex, card_blockUpperIndex] + have h := card_blockLowerIndex_le n r t d hn hd hdt + omega + +end Problem335 + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/WordInfrastructure.lean b/lean/OAI/Algebra/DepthFive/WordInfrastructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..95bc5cc53498423d792f4c11893283123e132a35 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/WordInfrastructure.lean @@ -0,0 +1,13 @@ +import OAI.Algebra.DepthFive.WordSum +import OAI.Algebra.DepthFive.RunLayerWeights +import OAI.Algebra.DepthFive.WordLocalProduct +import OAI.Algebra.DepthFive.PathIsolatedWeight +import OAI.Algebra.DepthFive.ScheduleWeightBridge +import OAI.Algebra.DepthFive.LowerSchedule +import OAI.Algebra.DepthFive.WordWeightParameters +import OAI.Algebra.DepthFive.WordWeightBound +import OAI.Algebra.DepthFive.BalancedWordSum +import OAI.Algebra.DepthFive.ActualBalancedWordSum + +/-! Canonical Boolean-word, isolated-position, and balanced-schedule interfaces +for the second-moment estimate. -/ diff --git a/lean/OAI/Algebra/DepthFive/WordLocalProduct.lean b/lean/OAI/Algebra/DepthFive/WordLocalProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ad8c8f2060ba4902b153b5a65e766e4a9db8d9d --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/WordLocalProduct.lean @@ -0,0 +1,133 @@ +import OAI.Algebra.DepthFive.IsolatedWeight + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.WordLocalProduct + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +/-- A per-layer factor in the normalized four-path moment bound. +True is the diagonal type; `A = alpha⁻¹`, `B = beta`, `x = n⁻¹`. -/ +def localFactor (V : Finset ι) (R : ι → ι → Prop) (A B x : ℝ) + (w : ι → Bool) (i : ι) : ℝ := + if i ∈ V then + if w i = true then A else 1 + A * x ^ (IsolatedWeight.falseNeighbors R w i).card + else if w i = true then B else 1 + +lemma localFactor_eq_parts (V : Finset ι) (R : ι → ι → Prop) (A B x : ℝ) + (w : ι → Bool) (i : ι) : + localFactor V R A B x w i = + (if i ∈ V.filter (fun j => w j = true) then A else 1) * + (if i ∈ (Finset.univ \ V).filter (fun j => w j = true) then B else 1) * + (if i ∈ V.filter (fun j => w j = false) + then 1 + A * x ^ (IsolatedWeight.falseNeighbors R w i).card else 1) := by + classical + by_cases hi : i ∈ V <;> cases hw : w i <;> simp [localFactor, hi, hw] + +/-- The count-based word summand is exactly the product of the normalized +local factors, including the normal-V coincidences. -/ +theorem weight_eq_local_product (edges : Finset (ι × ι)) (V : Finset ι) + (R : ι → ι → Prop) (A B x : ℝ) (w : ι → Bool) : + IsolatedWeight.weight edges V R A B x w = + x ^ SwitchRestoration.switchCount edges w * ∏ i, localFactor V R A B x w i := by + classical + simp_rw [localFactor_eq_parts] + simp only [Finset.prod_mul_distrib, Finset.prod_ite_mem_eq, Finset.prod_const] + simp only [IsolatedWeight.weight, IsolatedWeight.correction] + ring + +/-- An inverse-natural-power form matching the manuscript's original parameters. -/ +theorem weight_eq_inverse_local_product (edges : Finset (ι × ι)) (V : Finset ι) + (R : ι → ι → Prop) (a b d : ℝ) (w : ι → Bool) : + IsolatedWeight.weight edges V R a⁻¹ b d⁻¹ w = + (d ^ SwitchRestoration.switchCount edges w)⁻¹ * + ∏ i, if i ∈ V then + if w i = true then a⁻¹ else + 1 + a⁻¹ * (d ^ (IsolatedWeight.falseNeighbors R w i).card)⁻¹ + else if w i = true then b else 1 := by + rw [weight_eq_local_product] + simp only [localFactor, inv_pow] + +lemma localFactor_nonneg (V : Finset ι) (R : ι → ι → Prop) + {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) + (w : ι → Bool) (i : ι) : 0 ≤ localFactor V R A B x w i := by + unfold localFactor + split_ifs <;> positivity + +/-- Before discarding U-coincidence factors, a normal U layer may have +weight `1+B`. The Boolean `coincides` records the relevant equality event. -/ +def momentLocalFactor (V : Finset ι) (R : ι → ι → Prop) (A B x : ℝ) + (w coincides : ι → Bool) (i : ι) : ℝ := + if i ∈ V then localFactor V R A B x w i + else if w i = true then B else if coincides i = true then 1 + B else 1 + +lemma momentLocalFactor_nonneg (V : Finset ι) (R : ι → ι → Prop) + {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) + (w coincides : ι → Bool) (i : ι) : + 0 ≤ momentLocalFactor V R A B x w coincides i := by + unfold momentLocalFactor + split_ifs + · exact localFactor_nonneg V R hA hB hx w i + all_goals positivity + +lemma momentLocalFactor_le (V : Finset ι) (R : ι → ι → Prop) + {A B x : ℝ} (hB : 0 ≤ B) (w coincides : ι → Bool) (i : ι) : + momentLocalFactor V R A B x w coincides i ≤ + localFactor V R A B x w i * (if i ∈ Finset.univ \ V then 1 + B else 1) := by + classical + by_cases hi : i ∈ V + · simp [momentLocalFactor, hi] + · cases hw : w i <;> cases hc : coincides i <;> + simp [momentLocalFactor, localFactor, hi, hw, hc] <;> nlinarith + +/-- The global U-coincidence cost is at most `(1+B)^|U|`, without any +independence assumption on U layers. -/ +theorem prod_momentLocalFactor_le (V : Finset ι) (R : ι → ι → Prop) + {A B x : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) + (w coincides : ι → Bool) : + (∏ i, momentLocalFactor V R A B x w coincides i) ≤ + (∏ i, localFactor V R A B x w i) * (1 + B) ^ (Finset.univ \ V).card := by + classical + have h := Finset.prod_le_prod₀ + (fun i (_ : i ∈ Finset.univ) => momentLocalFactor_nonneg V R hA hB hx w coincides i) + (fun i (_ : i ∈ Finset.univ) => momentLocalFactor_le V R hB w coincides i) + simpa only [Finset.prod_mul_distrib, Finset.prod_ite_mem_eq, Finset.prod_const] using h + + +/-- A switch-weighted local moment product is controlled by the canonical +word weight and the single global U-coincidence factor. -/ +theorem switchWeighted_momentLocalFactor_le (edges : Finset (ι × ι)) + (V : Finset ι) (R : ι → ι → Prop) {A B x : ℝ} + (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) (w coincides : ι → Bool) : + x ^ SwitchRestoration.switchCount edges w * + (∏ i, momentLocalFactor V R A B x w coincides i) ≤ + (1 + B) ^ (Finset.univ \ V).card * IsolatedWeight.weight edges V R A B x w := by + have h := mul_le_mul_of_nonneg_left + (prod_momentLocalFactor_le V R hA hB hx w coincides) + (pow_nonneg hx (SwitchRestoration.switchCount edges w)) + rw [weight_eq_local_product] + simpa only [mul_assoc, mul_left_comm, mul_comm] using h + +/-- The global moment reduction may discard all U-coincidence events, +even when they depend jointly on the entire word. -/ +theorem sum_switchWeighted_momentLocalFactor_le (edges : Finset (ι × ι)) + (V : Finset ι) (R : ι → ι → Prop) {A B x : ℝ} + (hA : 0 ≤ A) (hB : 0 ≤ B) (hx : 0 ≤ x) + (coincides : (ι → Bool) → ι → Bool) : + (∑ w : ι → Bool, x ^ SwitchRestoration.switchCount edges w * + (∏ i, momentLocalFactor V R A B x w (coincides w) i)) ≤ + (1 + B) ^ (Finset.univ \ V).card * + ∑ w : ι → Bool, IsolatedWeight.weight edges V R A B x w := by + classical + rw [Finset.mul_sum] + exact Finset.sum_le_sum (fun w _ => + switchWeighted_momentLocalFactor_le edges V R hA hB hx w (coincides w)) + +end Problem335.WordLocalProduct + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/WordRuns.lean b/lean/OAI/Algebra/DepthFive/WordRuns.lean new file mode 100644 index 0000000000000000000000000000000000000000..9350ae05b2e2f29b8c91e6ea81e64bf8c1395486 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/WordRuns.lean @@ -0,0 +1,138 @@ +import OAI.Algebra.DepthFive.WordSwitches + +namespace OAI + +/-! Counts of true runs, and their relation to adjacent switches. -/ + +open scoped BigOperators + +namespace Problem335.WordRuns + +/-- Number of transitions from false to true. -/ +def riseCount {n : ℕ} (w : Fin (n + 1) → Bool) : ℕ := + ∑ i : Fin n, if w i.castSucc = false ∧ w i.succ = true then 1 else 0 + +/-- Number of transitions from true to false. -/ +def fallCount {n : ℕ} (w : Fin (n + 1) → Bool) : ℕ := + ∑ i : Fin n, if w i.castSucc = true ∧ w i.succ = false then 1 else 0 + +/-- True runs are counted by their first letters. -/ +def runCount {n : ℕ} (w : Fin (n + 1) → Bool) : ℕ := + riseCount w + (w 0).toNat + +/-- In a mixed word, the number of true runs touching an endpoint. -/ +def endpointRunCount {n : ℕ} (w : Fin (n + 1) → Bool) : ℕ := + (w 0).toNat + (w (Fin.last n)).toNat + +/-- Number of true runs not touching an endpoint. -/ +def interiorRunCount {n : ℕ} (w : Fin (n + 1) → Bool) : ℕ := + runCount w - endpointRunCount w + +@[simp] theorem riseCount_cons {n : ℕ} (b : Bool) (w : Fin (n + 1) → Bool) : + riseCount (Fin.cons b w) = + (if b = false ∧ w 0 = true then 1 else 0) + riseCount w := by + unfold riseCount + rw [Fin.sum_univ_succ] + simp only [Fin.castSucc_zero, Fin.cons_zero, Fin.cons_succ, Fin.castSucc_succ] + +@[simp] theorem fallCount_cons {n : ℕ} (b : Bool) (w : Fin (n + 1) → Bool) : + fallCount (Fin.cons b w) = + (if b = true ∧ w 0 = false then 1 else 0) + fallCount w := by + unfold fallCount + rw [Fin.sum_univ_succ] + simp only [Fin.castSucc_zero, Fin.cons_zero, Fin.cons_succ, Fin.castSucc_succ] + +/-- Every switch is exactly a rise or a fall. -/ +theorem switches_card_eq_rises_add_falls {n : ℕ} (w : Fin (n + 1) → Bool) : + (WordSwitches.switches w).card = riseCount w + fallCount w := by + rw [WordSwitches.switches, Finset.card_filter] + unfold riseCount fallCount + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + cases w i.castSucc <;> cases w i.succ <;> decide + +/-- Incoming and outgoing changes balance, up to the endpoint bits. -/ +theorem rise_first_eq_fall_last {n : ℕ} (w : Fin (n + 1) → Bool) : + riseCount w + (w 0).toNat = fallCount w + (w (Fin.last n)).toNat := by + induction n with + | zero => simp [riseCount, fallCount, Fin.last_zero] + | succ n ih => + obtain ⟨⟨b, v⟩, rfl⟩ := (Fin.consEquiv (fun _ : Fin (n + 2) => Bool)).surjective w + have hv := ih v + have hb : (if b = false ∧ v 0 = true then 1 else 0) + b.toNat = + (if b = true ∧ v 0 = false then 1 else 0) + (v 0).toNat := by + cases b <;> cases v 0 <;> decide + change riseCount (Fin.cons b v) + b.toNat = + fallCount (Fin.cons b v) + (v (Fin.last n)).toNat + rw [riseCount_cons, fallCount_cons] + omega + +/-- With no rises, a true last letter forces the entire word to be true. -/ +theorem all_true_of_no_rises {n : ℕ} (w : Fin (n + 1) → Bool) + (h : riseCount w = 0) (hlast : w (Fin.last n) = true) : + ∀ i, w i = true := by + induction n with + | zero => + intro i + have hi : i = Fin.last 0 := Fin.eq_zero i + simpa [hi] using hlast + | succ n ih => + obtain ⟨⟨b, v⟩, rfl⟩ := (Fin.consEquiv (fun _ : Fin (n + 2) => Bool)).surjective w + change riseCount (Fin.cons b v) = 0 at h + rw [riseCount_cons] at h + change v (Fin.last n) = true at hlast + have hv0 : riseCount v = 0 := by omega + have hv := ih v hv0 hlast + have hb : b = true := by + have hvhead := hv 0 + cases b <;> simp_all + intro i + cases i using Fin.cases <;> simp [Fin.consEquiv_apply, hb, hv] + +/-- If there is a false letter, each true endpoint belongs to a distinct run. -/ +theorem endpointRunCount_le_runCount {n : ℕ} (w : Fin (n + 1) → Bool) + (hfalse : ∃ i, w i = false) : endpointRunCount w ≤ runCount w := by + unfold endpointRunCount runCount + have hlast : (w (Fin.last n)).toNat ≤ riseCount w := by + cases hl : w (Fin.last n) with + | false => simp + | true => + simp only [Bool.toNat_true] + by_contra hnot + have hz : riseCount w = 0 := by omega + obtain ⟨i, hi⟩ := hfalse + have ht := all_true_of_no_rises w hz hl i + simp [hi] at ht + omega + +theorem endpointRunCount_le_two {n : ℕ} (w : Fin (n + 1) → Bool) : + endpointRunCount w ≤ 2 := by + unfold endpointRunCount + cases w 0 <;> cases w (Fin.last n) <;> decide + +/-- For a mixed word, switches equal twice the interior true runs plus endpoint runs. +In fact only the existence of a false letter is needed. -/ +theorem switches_card_eq_two_interior_add_endpoint {n : ℕ} + (w : Fin (n + 1) → Bool) (hfalse : ∃ i, w i = false) : + (WordSwitches.switches w).card = + 2 * interiorRunCount w + endpointRunCount w := by + have he := endpointRunCount_le_runCount w hfalse + have hb := rise_first_eq_fall_last w + rw [switches_card_eq_rises_add_falls] + unfold interiorRunCount runCount endpointRunCount at * + omega + +/-- A version valid even for the all-true word: each run has two boundary ends, +except that endpoints do not contribute switches. -/ +theorem two_runCount_eq_switches_add_endpoint {n : ℕ} + (w : Fin (n + 1) → Bool) : + 2 * runCount w = (WordSwitches.switches w).card + endpointRunCount w := by + have hb := rise_first_eq_fall_last w + rw [switches_card_eq_rises_add_falls] + unfold runCount endpointRunCount + omega + +end Problem335.WordRuns + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/WordSum.lean b/lean/OAI/Algebra/DepthFive/WordSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f6f1350ba7a2fd9c20022230579870d0d2908e0 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/WordSum.lean @@ -0,0 +1,197 @@ +import OAI.Algebra.DepthFive.RunWeights +import OAI.Algebra.DepthFive.RunSum +import OAI.Algebra.DepthFive.RunLayerWeights +import OAI.Algebra.DepthFive.IsolatedFlip +import OAI.Algebra.DepthFive.IsolatedWeight + +namespace OAI + +/-! Assembly of the numeric and finite-word estimates in the path-type sum. +The remaining application-specific hypotheses describe the actual path weights. -/ + +open scoped BigOperators +noncomputable section + +namespace Problem335 +namespace WordSum + +/-- Combine exact smoothing fibers, surviving local corrections, and interior-run counting. -/ +lemma corrected_sum_le_exp_of_sum (n k : ℕ) (a c : ℝ) + (S : Finset (Fin (n + 1))) (R : Fin (n + 1) → Fin (n + 1) → Prop) + (hS : ∀ i ∈ S, ∀ j, R i j → j ∉ S) + (hcard : S.card ≤ k) + (hk : 2 * (k : ℝ) ≤ ((n + 1 : ℕ) : ℝ)) + (ha : 0 ≤ a) (haN : a ≤ Real.sqrt ((n + 1 : ℕ) : ℝ)) + (hc : 0 ≤ c) (hcN : c ≤ 2 / (((n + 1 : ℕ) : ℝ) ^ 2)) + (W Z : (Fin (n + 1) → Bool) → ℝ) + (hWnonneg : ∀ w, 0 ≤ W w) (hZnonneg : ∀ w, 0 ≤ Z w) + (hratio : ∀ w, W w = W (IsolatedFlip.flip S R w) * + c ^ (IsolatedFlip.removed S R w).card) + (hfixed : ∀ w, IsolatedFlip.flip S R w = w → + W w ≤ (1 + a) * (1 + a / ((n + 1 : ℕ) : ℝ)) ^ k * Z w) + (hZbound : (∑ w, Z w) ≤ Real.exp (5 * Real.sqrt ((n + 1 : ℕ) : ℝ))) : + (∑ w, W w) ≤ Real.exp (8 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + classical + let N : ℝ := ((n + 1 : ℕ) : ℝ) + let Q : ℝ := (1 + a) * (1 + a / N) ^ k + have hN : 1 ≤ N := by dsimp [N]; exact_mod_cast Nat.succ_le_succ (Nat.zero_le n) + have hNpos : 0 < N := by linarith + have hQ : 0 ≤ Q := by dsimp [Q]; positivity + have hZsum : 0 ≤ ∑ w, Z w := Finset.sum_nonneg (fun w _ => hZnonneg w) + have hfixedsum : + (∑ w ∈ Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w), W w) ≤ + Q * ∑ w, Z w := by + rw [Finset.mul_sum, Finset.sum_filter] + apply Finset.sum_le_sum + intro w _ + by_cases hw : IsolatedFlip.flip S R w = w + · rw [ite_eq_left hw] + exact hfixed w hw + · rw [ite_eq_right hw] + exact mul_nonneg hQ (hZnonneg w) + have hcpow : (1 + c) ^ S.card ≤ (1 + 2 / N ^ 2) ^ k := by + calc + (1 + c) ^ S.card ≤ (1 + 2 / N ^ 2) ^ S.card := by gcongr + _ ≤ (1 + 2 / N ^ 2) ^ k := by + exact pow_le_pow_right₀ (le_add_of_nonneg_right (by positivity)) hcard + have hpref : (1 + 2 / N ^ 2) ^ k * Q ≤ Real.exp (3 * Real.sqrt N) := by + dsimp [Q] + rw [← mul_assoc] + exact RunWeights.correction_prefactor_le_exp hN ha haN k hk + change (∑ w, W w) ≤ Real.exp (8 * Real.sqrt N) + calc + (∑ w, W w) ≤ (1 + c) ^ S.card * + ∑ w ∈ Finset.univ.filter (fun w => IsolatedFlip.flip S R w = w), W w := + IsolatedFlip.correction_removal hS c hc W hWnonneg hratio + _ ≤ (1 + c) ^ S.card * (Q * ∑ w, Z w) := by gcongr + _ ≤ (1 + 2 / N ^ 2) ^ k * (Q * ∑ w, Z w) := by gcongr + _ = ((1 + 2 / N ^ 2) ^ k * Q) * ∑ w, Z w := by ring + _ ≤ Real.exp (3 * Real.sqrt N) * Real.exp (5 * Real.sqrt N) := by gcongr + _ = Real.exp (8 * Real.sqrt N) := by rw [← Real.exp_add]; congr 1; ring + +/-- The actual word weights satisfy the square-root exponential bound once +run intervals and the surviving coincidence corrections have been estimated. -/ +lemma sum_actual_weight_le_exp (n : ℕ) (A B E : ℝ) + (edges : Finset (Fin (n + 1) × Fin (n + 1))) + (V S : Finset (Fin (n + 1))) (R : Fin (n + 1) → Fin (n + 1) → Prop) + (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + (hswitch : ∀ w, SwitchRestoration.switchCount edges w = (WordSwitches.switches w).card) + (hcard : 2 * (V.card : ℝ) ≤ ((n + 1 : ℕ) : ℝ)) + (hA : 1 ≤ A) (hAN : A ≤ Real.sqrt ((n + 1 : ℕ) : ℝ)) (hB : 0 ≤ B) + (hE : E ≤ Real.sqrt ((n + 1 : ℕ) : ℝ)) + (hprod : ∀ w : Fin (n + 1) → Bool, + A ^ (V.filter fun i => w i = true).card * + B ^ ((Finset.univ \ V).filter fun i => w i = true).card ≤ + Real.exp E * ((n + 1 : ℕ) : ℝ) ^ WordRuns.runCount w) + (hcorr : ∀ w, IsolatedFlip.flip S R w = w → + IsolatedWeight.correction V R A (((n + 1 : ℕ) : ℝ)⁻¹) w ≤ + (1 + A) * (1 + A / ((n + 1 : ℕ) : ℝ)) ^ V.card) : + (∑ w, IsolatedWeight.weight edges V R A B (((n + 1 : ℕ) : ℝ)⁻¹) w) ≤ + Real.exp (8 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + classical + let N : ℝ := ((n + 1 : ℕ) : ℝ) + let F : (Fin (n + 1) → Bool) → ℝ := fun w => + A ^ (V.filter fun i => w i = true).card * + B ^ ((Finset.univ \ V).filter fun i => w i = true).card + let Z : (Fin (n + 1) → Bool) → ℝ := fun w => + N⁻¹ ^ (WordSwitches.switches w).card * F w + let W := IsolatedWeight.weight edges V R A B N⁻¹ + let c : ℝ := N⁻¹ ^ 2 * (1 + A) / A + have hN : 0 < N := by dsimp [N]; positivity + have hApos : 0 < A := by linarith + have hc : 0 ≤ c := by dsimp [c]; positivity + have hcN : c ≤ 2 / N ^ 2 := by + have hr : (1 + A) / A ≤ 2 := (div_le_iff₀ hApos).2 (by linarith) + calc + c = N⁻¹ ^ 2 * ((1 + A) / A) := by dsimp [c]; ring + _ ≤ N⁻¹ ^ 2 * 2 := mul_le_mul_of_nonneg_left hr (by positivity) + _ = 2 / N ^ 2 := by rw [inv_pow]; ring + have hW : ∀ w, 0 ≤ W w := + IsolatedWeight.weight_nonneg edges V R hApos.le hB (by positivity) + have hZ : ∀ w, 0 ≤ Z w := by intro w; dsimp [Z, F]; positivity + have hZsum : (∑ w, Z w) ≤ Real.exp (5 * Real.sqrt N) := by + have hh := RunSum.sum_weighted_switch_penalty_le_exp n E F hprod + exact hh.trans (Real.exp_le_exp.mpr (by change E + 4 * Real.sqrt N ≤ _; linarith)) + apply corrected_sum_le_exp_of_sum n V.card A c S R + · intro i hi j hij hj + exact hV i (hS hi) j hij (hS hj) + · exact Finset.card_le_card hS + · exact hcard + · exact hApos.le + · exact hAN + · exact hc + · exact hcN + · exact hW + · exact hZ + · intro w + exact IsolatedWeight.weight_flip hS hV hR hdegree hApos.ne' B N⁻¹ w + · intro w hw + have hh := mul_le_mul_of_nonneg_left (hcorr w hw) (hZ w) + dsimp [W, IsolatedWeight.weight, Z, F] at hh ⊢ + rw [hswitch] + nlinarith [hh] + · exact hZsum + +/-- Full corrected-word bound with the actual fixed-word correction estimate discharged. +Only the graph structure and the per-word product-of-runs estimate remain as inputs. -/ +lemma sum_actual_weight_le_exp_of_endpoints (n : ℕ) (A B E : ℝ) + (edges : Finset (Fin (n + 1) × Fin (n + 1))) + (V S : Finset (Fin (n + 1))) (R : Fin (n + 1) → Fin (n + 1) → Prop) + (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + (hswitch : ∀ w, SwitchRestoration.switchCount edges w = (WordSwitches.switches w).card) + (hend : (V \ S).card ≤ 1) + (hcard : 2 * (V.card : ℝ) ≤ ((n + 1 : ℕ) : ℝ)) + (hA : 1 ≤ A) (hAN : A ≤ Real.sqrt ((n + 1 : ℕ) : ℝ)) (hB : 0 ≤ B) + (hE : E ≤ Real.sqrt ((n + 1 : ℕ) : ℝ)) + (hprod : ∀ w : Fin (n + 1) → Bool, + A ^ (V.filter fun i => w i = true).card * + B ^ ((Finset.univ \ V).filter fun i => w i = true).card ≤ + Real.exp E * ((n + 1 : ℕ) : ℝ) ^ WordRuns.runCount w) : + (∑ w, IsolatedWeight.weight edges V R A B (((n + 1 : ℕ) : ℝ)⁻¹) w) ≤ + Real.exp (8 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + apply sum_actual_weight_le_exp n A B E edges V S R hS hV hR hdegree hswitch + hcard hA hAN hB hE hprod + intro w hw + have hN : (1 : ℝ) ≤ ((n + 1 : ℕ) : ℝ) := by + exact_mod_cast Nat.succ_le_succ (Nat.zero_le n) + simpa only [div_eq_mul_inv] using IsolatedWeight.correction_le_endpoint_bound + hS hend hw (show 0 ≤ A by linarith) (by positivity) + (inv_le_one_of_one_le₀ hN) + +/-- An interval-balanced independent layer partition gives the full word-sum estimate. +This version has no assumed rank, trace, weight, or run-product inequalities. -/ +lemma sum_weight_le_exp_of_discrepancy (n : ℕ) (α β ρ ε : ℝ) + (edges : Finset (Fin (n + 1) × Fin (n + 1))) + (V S : Finset (Fin (n + 1))) (R : Fin (n + 1) → Fin (n + 1) → Prop) + (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + (hswitch : ∀ w, SwitchRestoration.switchCount edges w = (WordSwitches.switches w).card) + (hend : (V \ S).card ≤ 1) + (hcard : 2 * (V.card : ℝ) ≤ ((n + 1 : ℕ) : ℝ)) + (hα : 0 < α) (hα1 : α ≤ 1) (hβ : 0 ≤ β) (hρ : ρ ≤ 1) (hε : 0 ≤ ε) + (hαN : α⁻¹ ≤ Real.sqrt ((n + 1 : ℕ) : ℝ)) + (hβupper : β ≤ α ^ ρ * Real.exp ε) + (hεN : ε * ((n + 1 : ℕ) : ℝ) ≤ Real.sqrt ((n + 1 : ℕ) : ℝ)) + (hdiscrepancy : ∀ b : List (Fin (n + 1)), b <:+: List.ofFn id → + (b.countP (fun i => decide (i ∈ V)) : ℝ) - + ρ * b.countP (fun i => !decide (i ∈ V)) ≤ 1 + ρ) : + (∑ w, IsolatedWeight.weight edges V R α⁻¹ β (((n + 1 : ℕ) : ℝ)⁻¹) w) ≤ + Real.exp (8 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + have hA : 1 ≤ α⁻¹ := (one_le_inv₀ hα).2 hα1 + apply sum_actual_weight_le_exp_of_endpoints n α⁻¹ β (ε * ((n + 1 : ℕ) : ℝ)) + edges V S R hS hV hR hdegree hswitch hend hcard hA hαN hβ hεN + intro w + exact RunLayerWeights.count_weight_le_exp_mul_runCount w V hα hα1 hβ hε hβupper + (RunWeights.scale_le_of_inv_le_sqrt hα hα1 hρ (by positivity) hαN) hdiscrepancy + +end WordSum +end Problem335 + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/WordSwitches.lean b/lean/OAI/Algebra/DepthFive/WordSwitches.lean new file mode 100644 index 0000000000000000000000000000000000000000..d30ecf8988419550e83c075c1fe4c6022f7efff8 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/WordSwitches.lean @@ -0,0 +1,103 @@ +import Mathlib + +namespace OAI + +/-! Boolean words are uniquely specified by their initial bit and their switches. +This gives the exact binomial count used in the path-type sum. -/ + +open scoped BigOperators + +namespace Problem335 +namespace WordSwitches + +/-- Internal positions where adjacent bits differ. A word has `n + 1` letters. -/ +def switches {n : ℕ} (w : Fin (n + 1) → Bool) : Finset (Fin n) := + Finset.univ.filter fun i => w i.castSucc ≠ w i.succ + +@[simp] theorem mem_switches {n : ℕ} (w : Fin (n + 1) → Bool) (i : Fin n) : + i ∈ switches w ↔ w i.castSucc ≠ w i.succ := by + simp [switches] + +/-- The initial letter and switch set encode a nonempty word. -/ +def encode {n : ℕ} (w : Fin (n + 1) → Bool) : Bool × Finset (Fin n) := + (w 0, switches w) + +private theorem bool_eq_of_ne_iff (a b c : Bool) + (h : a ≠ b ↔ a ≠ c) : b = c := by + cases a <;> cases b <;> cases c <;> simp_all + +theorem encode_injective (n : ℕ) : + Function.Injective (@encode n) := by + intro w v h + have hzero : w 0 = v 0 := congrArg Prod.fst h + have hs : switches w = switches v := congrArg Prod.snd h + funext i + induction i using Fin.induction with + | zero => exact hzero + | succ i ih => + have hi : w i.castSucc ≠ w i.succ ↔ v i.castSucc ≠ v i.succ := by + rw [← mem_switches, ← mem_switches, hs] + rw [ih] at hi + exact bool_eq_of_ne_iff _ _ _ hi + +/-- Every initial letter and set of switch positions specifies exactly one word. -/ +theorem encode_bijective (n : ℕ) : Function.Bijective (@encode n) := by + apply (Fintype.bijective_iff_injective_and_card _).2 + refine ⟨encode_injective n, ?_⟩ + simp [pow_succ, Nat.mul_comm] + +noncomputable def wordEquiv (n : ℕ) : + (Fin (n + 1) → Bool) ≃ Bool × Finset (Fin n) := + Equiv.ofBijective encode (encode_bijective n) + +@[simp] theorem wordEquiv_apply (n : ℕ) (w : Fin (n + 1) → Bool) : + wordEquiv n w = (w 0, switches w) := rfl + +/-- The switch-count restriction of the word encoding. -/ +noncomputable def countEquiv (n j : ℕ) : + {w : Fin (n + 1) → Bool // (switches w).card = j} ≃ + Bool × {s : Finset (Fin n) // s.card = j} := + ((wordEquiv n).subtypeEquiv (p := fun w => (switches w).card = j) + (q := fun p => p.2.card = j) (fun _ => Iff.rfl)).trans + { toFun := fun p => (p.val.1, ⟨p.val.2, p.property⟩) + invFun := fun p => ⟨(p.1, p.2.val), p.2.property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl } + +/-- Exactly `2 * choose n j` words of length `n + 1` have `j` switches. -/ +theorem card_words_with_switches (n j : ℕ) : + Fintype.card {w : Fin (n + 1) → Bool // (switches w).card = j} = + 2 * n.choose j := by + rw [Fintype.card_congr (countEquiv n j), Fintype.card_prod, + Fintype.card_bool, Fintype.card_finset_len, Fintype.card_fin] + +/-- The switch-count generating function. -/ +theorem sum_pow_switches {R : Type*} [CommSemiring R] (n : ℕ) (x : R) : + (∑ w : Fin (n + 1) → Bool, x ^ (switches w).card) = + 2 * (1 + x) ^ n := by + calc + _ = ∑ p : Bool × Finset (Fin n), x ^ p.2.card := + Fintype.sum_equiv (wordEquiv n) _ _ (fun _ => rfl) + _ = 2 * ∑ s : Finset (Fin n), x ^ s.card := by + rw [Fintype.sum_prod_type] + simp [two_mul] + _ = 2 * (1 + x) ^ n := by + congr 1 + simpa using (Finset.prod_one_add (f := fun _ : Fin n => x) Finset.univ).symm + +/-- An exponential upper bound for a switch-penalized word sum. -/ +theorem sum_pow_switches_le_exp (n : ℕ) (x : ℝ) (hx : 0 ≤ x) : + (∑ w : Fin (n + 1) → Bool, x ^ (switches w).card) ≤ + 2 * Real.exp ((n : ℝ) * x) := by + rw [sum_pow_switches] + have h : (1 + x) ^ n ≤ (Real.exp x) ^ n := by + gcongr + simpa [add_comm] using Real.add_one_le_exp x + calc + 2 * (1 + x) ^ n ≤ 2 * (Real.exp x) ^ n := by gcongr + _ = 2 * Real.exp ((n : ℝ) * x) := by rw [Real.exp_nat_mul] + +end WordSwitches +end Problem335 + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/WordWeightBound.lean b/lean/OAI/Algebra/DepthFive/WordWeightBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ac900494be2496c4cd3657cc4cc467a63ed4bf8 --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/WordWeightBound.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.DepthFive.WordWeightParameters +import OAI.Algebra.DepthFive.WordSum +import OAI.Algebra.DepthFive.RunLayerWeights + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace Problem335.LowerParameters + +/-- The actual rounded parameters discharge every numerical and run-product +premise of the corrected word sum. Only the chosen schedule remains an input. -/ +theorem sum_actual_weight_le_exp_of_parameters {n : ℕ} (hn : 16 ≤ n + 1) + (edges : Finset (Fin (n + 1) × Fin (n + 1))) + (V S : Finset (Fin (n + 1))) (R : Fin (n + 1) → Fin (n + 1) → Prop) + (hS : S ⊆ V) (hV : ∀ i ∈ V, ∀ j, R i j → j ∉ V) + (hR : ∀ e ∈ edges, R e.1 e.2 ∧ R e.2 e.1) + (hdegree : ∀ i ∈ S, SwitchRestoration.endpointDegree edges i = 2) + (hswitch : ∀ w, SwitchRestoration.switchCount edges w = (WordSwitches.switches w).card) + (hend : (V \ S).card ≤ 1) + (hcard : 2 * (V.card : ℝ) ≤ ((n + 1 : ℕ) : ℝ)) + (hdiscrepancy : ∀ l : List (Fin (n + 1)), l <:+: List.ofFn id → + (l.countP (fun i => decide (i ∈ V)) : ℝ) - + rho (n + 1) * l.countP (fun i => !decide (i ∈ V)) ≤ 1 + rho (n + 1)) : + (∑ w, IsolatedWeight.weight edges V R + (alpha (n + 1))⁻¹ (beta (n + 1)) (((n + 1 : ℕ) : ℝ)⁻¹) w) ≤ + Real.exp (8 * Real.sqrt ((n + 1 : ℕ) : ℝ)) := by + have hn4 : 4 ≤ n + 1 := by omega + apply WordSum.sum_actual_weight_le_exp_of_endpoints n + (alpha (n + 1))⁻¹ (beta (n + 1)) + ((2 / (b (n + 1) : ℝ)) * ((n + 1 : ℕ) : ℝ)) + edges V S R hS hV hR hdegree hswitch hend hcard + (one_le_inv_alpha hn4) (inv_alpha_le_sqrt hn4) (beta_pos hn4).le + (word_error_mul_n_le_sqrt hn) + intro w + exact RunLayerWeights.count_weight_le_exp_mul_runCount w V + (alpha_pos hn4) (alpha_lt_one hn4).le (beta_pos hn4).le + (by positivity) (beta_le_rpow_mul_exp_two_div hn) + (alpha_run_scale_le hn4) hdiscrepancy + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/DepthFive/WordWeightParameters.lean b/lean/OAI/Algebra/DepthFive/WordWeightParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..79882c87e20248ba6b9c3b33ec8c6afdcd8184fd --- /dev/null +++ b/lean/OAI/Algebra/DepthFive/WordWeightParameters.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.DepthFive.BetaRefinements +import OAI.Algebra.DepthFive.RunWeights + +namespace OAI + +/-! Concrete numerical hypotheses for the balanced path-word sum. -/ +noncomputable section + +namespace Problem335.LowerParameters + +theorem one_le_inv_alpha {n : ℕ} (hn : 4 ≤ n) : + 1 ≤ (alpha n)⁻¹ := + (one_le_inv₀ (alpha_pos hn)).mpr (alpha_lt_one hn).le + +/-- Every true run costs at most one factor of the matrix dimension. -/ +theorem alpha_run_scale_le {n : ℕ} (hn : 4 ≤ n) : + (alpha n) ^ (-(1 + rho n)) ≤ (n : ℝ) := + RunWeights.scale_le_of_inv_le_sqrt (alpha_pos hn) (alpha_lt_one hn).le + (rho_lt_one hn).le (Nat.cast_nonneg n) (inv_alpha_le_sqrt hn) + +/-- The accumulated beta rounding error is already bounded by one half. -/ +theorem word_error_mul_n_le_half {n : ℕ} (hn : 16 ≤ n) : + (2 / (b n : ℝ)) * (n : ℝ) ≤ 1 / 2 := by + have hb : (0 : ℝ) < b n := by exact_mod_cast b_pos (by omega : 4 ≤ n) + have hbn : 4 * (n : ℝ) ≤ (b n : ℝ) := by + exact_mod_cast four_mul_n_le_b hn + calc + (2 / (b n : ℝ)) * (n : ℝ) = (2 * (n : ℝ)) / (b n : ℝ) := by ring + _ ≤ 1 / 2 := (div_le_iff₀ hb).mpr (by linarith) + +theorem word_error_mul_n_le_sqrt {n : ℕ} (hn : 16 ≤ n) : + (2 / (b n : ℝ)) * (n : ℝ) ≤ Real.sqrt (n : ℝ) := by + have hs := sqrt_ge_two (show 4 ≤ n by omega) + exact (word_error_mul_n_le_half hn).trans (by linarith) + +/-- All scalar premises of the corrected-word estimate, at the actual rounded +parameters. No word-product or graph hypothesis is part of this statement. -/ +theorem word_weight_numeric_bounds {n : ℕ} (hn : 16 ≤ n) : + 0 < alpha n ∧ alpha n ≤ 1 ∧ + 1 ≤ (alpha n)⁻¹ ∧ (alpha n)⁻¹ ≤ Real.sqrt (n : ℝ) ∧ + 0 ≤ beta n ∧ + beta n ≤ (alpha n) ^ (rho n) * Real.exp (2 / (b n : ℝ)) ∧ + (alpha n) ^ (-(1 + rho n)) ≤ (n : ℝ) ∧ + 0 ≤ 2 / (b n : ℝ) ∧ + (2 / (b n : ℝ)) * (n : ℝ) ≤ Real.sqrt (n : ℝ) := by + have hn4 : 4 ≤ n := by omega + exact ⟨alpha_pos hn4, (alpha_lt_one hn4).le, one_le_inv_alpha hn4, + inv_alpha_le_sqrt hn4, (beta_pos hn4).le, beta_le_rpow_mul_exp_two_div hn, + alpha_run_scale_le hn4, by positivity, word_error_mul_n_le_sqrt hn⟩ + +end Problem335.LowerParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AdjugateNormalForm.lean b/lean/OAI/Algebra/Determinantal/AdjugateNormalForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..14df50601731e5e88d716dfe42ce8678197fd48c --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AdjugateNormalForm.lean @@ -0,0 +1,968 @@ +import OAI.Algebra.Determinantal.ConductorLocalization + +namespace OAI + +namespace PermanentBorder.AdjugateAlgebra +open Matrix Polynomial + +section Commutator +variable {K ι : Type*} [CommRing K] [Fintype ι] [DecidableEq ι] + +theorem trace_commutator_adjugate (M Y : Matrix ι ι K) : + ((M * Y - Y * M) * M.adjugate).trace = 0 := by + rw [sub_mul, Matrix.trace_sub, Matrix.trace_mul_cycle M Y M.adjugate, + Matrix.adjugate_mul, Matrix.mul_assoc Y M M.adjugate, Matrix.mul_adjugate] + simp + +theorem trace_commutator_adjugate_scalar (A Y : Matrix ι ι K) (s : K) : + ((A * Y - Y * A) * (s • (1 : Matrix ι ι K) + A).adjugate).trace = 0 := by + have he : (s • (1 : Matrix ι ι K) + A) * Y - Y * (s • 1 + A) = + A * Y - Y * A := by + simp only [add_mul, mul_add, Matrix.smul_mul, Matrix.mul_smul, one_mul, mul_one] + abel + rw [← he] + exact trace_commutator_adjugate _ _ + +end Commutator + +section DiagonalCommutator +variable {K ι : Type*} [Field K] [Fintype ι] [DecidableEq ι] + +theorem exists_diagonal_commutator (θ : ι → K) (hθ : Function.Injective θ) + (Y : Matrix ι ι K) (hY : ∀ i, Y i i = 0) : + ∃ Z : Matrix ι ι K, Matrix.diagonal θ * Z - Z * Matrix.diagonal θ = Y := by + let Z : Matrix ι ι K := fun i j => Y i j / (θ i - θ j) + refine ⟨Z, ?_⟩ + ext i j + simp only [Matrix.sub_apply] + rw [Matrix.diagonal_mul θ Z i j, Matrix.mul_diagonal θ Z i j] + dsimp only [Z] + by_cases hij : i = j + · subst j + simp [hY] + · have hne : θ i - θ j ≠ 0 := sub_ne_zero.mpr (fun h => hij (hθ h)) + field_simp +end DiagonalCommutator + +section PolynomialAdjugate +variable {R : Type*} [CommRing R] {k : ℕ} + +theorem natDegree_adjugate_linear_le + (A B : Matrix (Fin (k+1)) (Fin (k+1)) R) (i j : Fin (k+1)) : + (((X : R[X]) • A.map C + B.map C).adjugate i j).natDegree ≤ k := by + rw [Matrix.adjugate_fin_succ_eq_det_submatrix] + have hsub : ((X : R[X]) • A.map C + B.map C).submatrix j.succAbove i.succAbove = + (X : R[X]) • (A.submatrix j.succAbove i.succAbove).map C + + (B.submatrix j.succAbove i.succAbove).map C := by ext; rfl + rw [hsub] + calc + _ ≤ ((-1 : R[X]) ^ (↑j + ↑i)).natDegree + + ((X : R[X]) • (A.submatrix j.succAbove i.succAbove).map C + + (B.submatrix j.succAbove i.succAbove).map C).det.natDegree := natDegree_mul_le + _ ≤ 0 + k := by + gcongr + · rw [show (-1 : R[X]) ^ (↑j + ↑i) = C ((-1 : R) ^ (↑j + ↑i)) by simp] + simp only [natDegree_C, le_refl] + · simpa using natDegree_det_X_add_C_le + (A.submatrix j.succAbove i.succAbove) (B.submatrix j.succAbove i.succAbove) + _ = k := zero_add _ + +theorem coeff_adjugate_linear + (A B : Matrix (Fin (k+1)) (Fin (k+1)) R) (i j : Fin (k+1)) : + (((X : R[X]) • A.map C + B.map C).adjugate i j).coeff k = A.adjugate i j := by + rw [Matrix.adjugate_fin_succ_eq_det_submatrix, + Matrix.adjugate_fin_succ_eq_det_submatrix] + have hsub : ((X : R[X]) • A.map C + B.map C).submatrix j.succAbove i.succAbove = + (X : R[X]) • (A.submatrix j.succAbove i.succAbove).map C + + (B.submatrix j.succAbove i.succAbove).map C := by ext; rfl + rw [hsub, show (-1 : R[X]) ^ (↑j + ↑i) = C ((-1 : R) ^ (↑j + ↑i)) by simp] + rw [coeff_C_mul] + congr 1 + simpa using coeff_det_X_add_C_card + (A.submatrix j.succAbove i.succAbove) (B.submatrix j.succAbove i.succAbove) + +end PolynomialAdjugate + +section Slope +variable {K ι : Type*} [Field K] [Fintype ι] [DecidableEq ι] + +noncomputable def spectralSlope (θ : ι → K) : Matrix ι ι K[X] := + Matrix.diagonal (fun i => X + C (θ i)) + +theorem diagonal_zero_of_trace_slope (θ : ι → K) (hθ : Function.Injective θ) + (Y : Matrix ι ι K) + (h : (Y.map C * (spectralSlope θ).adjugate).trace = 0) : ∀ i, Y i i = 0 := by + intro i + have he := congrArg (Polynomial.eval (-θ i)) h + simp only [spectralSlope, Matrix.adjugate_diagonal, Matrix.trace, + Matrix.diag_apply, Matrix.mul_diagonal, Matrix.map_apply, + eval_finsetSum, eval_mul, eval_C, eval_prod, eval_add, eval_X, eval_zero] at he + have heq : (∑ j : ι, Y j j * ∏ l ∈ Finset.univ.erase j, (-θ i + θ l)) = + Y i i * ∏ l ∈ Finset.univ.erase i, (-θ i + θ l) := by + apply Finset.sum_eq_single i + · intro j _ hji + have hf : (∏ l ∈ Finset.univ.erase j, (-θ i + θ l)) = 0 := by + apply Finset.prod_eq_zero (Finset.mem_erase.mpr ⟨Ne.symm hji, Finset.mem_univ i⟩) + simp + simp [hf] + · simp + rw [heq] at he + have hp : (∏ l ∈ Finset.univ.erase i, (-θ i + θ l)) ≠ 0 := by + apply Finset.prod_ne_zero_iff.mpr + intro j hj + have hji := Finset.ne_of_mem_erase hj + intro hz + apply hji + apply hθ + exact eq_of_sub_eq_zero (by simpa [sub_eq_add_neg, add_comm] using hz) + exact (mul_eq_zero.mp he).resolve_right hp + +end Slope + +section Scaling +variable {K : Type*} [Field K] {k : ℕ} + +noncomputable def pencilBase (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) : + Matrix (Fin (k+1)) (Fin (k+1)) K[X] := + (X : K[X]) • (Matrix.diagonal θ).map C + A.map C + +noncomputable def scaledPencil (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) : + Matrix (Fin (k+1)) (Fin (k+1)) K[X][X] := + (X : K[X][X]) • (spectralSlope θ).map C + (A.map C).map C + +noncomputable def liftCoefficients : K[X] →+* K[X][X] := Polynomial.mapRingHom C + +noncomputable def scaledTrace (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Y : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) : K[X][X] := + (Y.map liftCoefficients * (scaledPencil θ A).adjugate).trace + + theorem scaledPencil_eq (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) : + scaledPencil θ A = (C (X : K[X]) * (X : K[X][X])) • (1 : Matrix (Fin (k+1)) (Fin (k+1)) K[X][X]) + + (pencilBase θ A).map liftCoefficients := by + apply Matrix.ext + intro i j + simp only [scaledPencil, pencilBase, spectralSlope, Matrix.add_apply, + Matrix.smul_apply, Matrix.map_apply, Matrix.diagonal_apply, Matrix.one_apply, + liftCoefficients, map_add] + (split_ifs <;> simp [Polynomial.mapRingHom]); ring + +theorem scaledTrace_commutator (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Z : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) : + scaledTrace θ A (pencilBase θ A * Z - Z * pencilBase θ A) = 0 := by + unfold scaledTrace + rw [scaledPencil_eq] + have hm : (pencilBase θ A * Z - Z * pencilBase θ A).map liftCoefficients = + (pencilBase θ A).map liftCoefficients * Z.map liftCoefficients - + Z.map liftCoefficients * (pencilBase θ A).map liftCoefficients := by + change (liftCoefficients (K := K)).mapMatrix _ = _ + rw [map_sub, map_mul, map_mul] + rfl + rw [hm] + exact trace_commutator_adjugate_scalar _ _ _ + +theorem coeff_scaledTrace_top (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Y : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) (d : ℕ) + (hY : ∀ i j, (Y i j).natDegree ≤ d) : + (scaledTrace θ A Y).coeff (d+k) = + (Y.map (fun p => C (p.coeff d)) * (spectralSlope θ).adjugate).trace := by + simp only [scaledTrace, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.map_apply, finsetSum_coeff] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + change (Polynomial.map C (Y i j) * + ((X : K[X][X]) • (spectralSlope θ).map C + (A.map C).map C).adjugate j i).coeff (d+k) = _ + rw [coeff_mul_add_eq_of_natDegree_le + ((natDegree_map_le).trans (hY i j)) + (natDegree_adjugate_linear_le (spectralSlope θ) (A.map C) j i)] + simp only [coeff_map] + rw [coeff_adjugate_linear] + +theorem diagonal_top_zero (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Y : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) (d : ℕ) (hd : 0 p.coeff d)) hh + +theorem scaledTrace_sub (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Y Z : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) : + scaledTrace θ A (Y-Z) = scaledTrace θ A Y - scaledTrace θ A Z := by + unfold scaledTrace + have hm : (Y-Z).map liftCoefficients = Y.map liftCoefficients - Z.map liftCoefficients := + (liftCoefficients (K := K)).mapMatrix.map_sub Y Z + rw [hm, sub_mul, Matrix.trace_sub] + +theorem pencil_commutator_expand (θ : Fin (k+1) → K) + (A Z : Matrix (Fin (k+1)) (Fin (k+1)) K) (d : ℕ) : + pencilBase θ A * ((X : K[X])^d • Z.map C) - + ((X : K[X])^d • Z.map C) * pencilBase θ A = + (X : K[X])^(d+1) • (Matrix.diagonal θ * Z - Z * Matrix.diagonal θ).map C + + (X : K[X])^d • (A * Z - Z * A).map C := by + simp only [pencilBase, add_mul, mul_add, Matrix.smul_mul, Matrix.mul_smul, + smul_smul, Matrix.map_sub C (map_sub C), Matrix.map_mul, smul_sub, pow_succ] + rw [mul_comm X (X^d)] + module + +theorem exists_lower_multiplier (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Y : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) (d : ℕ) + (hY : ∀ i j, (Y i j).natDegree ≤ d+1) + (hT : (scaledTrace θ A Y).natDegree ≤ k) : + ∃ Y' : Matrix (Fin (k+1)) (Fin (k+1)) K[X], + (∀ i j, (Y' i j).natDegree ≤ d) ∧ scaledTrace θ A Y' = scaledTrace θ A Y := by + let Ytop : Matrix (Fin (k+1)) (Fin (k+1)) K := Y.map (fun p => p.coeff (d+1)) + have hz : ∀ i, Ytop i i = 0 := diagonal_top_zero θ hθ A Y (d+1) (by omega) hY hT + obtain ⟨Z, hZ⟩ := exists_diagonal_commutator θ hθ Ytop hz + let W := pencilBase θ A * ((X : K[X])^d • Z.map C) - + ((X : K[X])^d • Z.map C) * pencilBase θ A + refine ⟨Y-W, ?_, ?_⟩ + · intro i j + apply natDegree_le_iff_coeff_eq_zero.mpr + intro n hn + have hW : W = (X : K[X])^(d+1) • Ytop.map C + + (X : K[X])^d • (A * Z - Z * A).map C := by + dsimp [W] + rw [pencil_commutator_expand, hZ] + rw [Matrix.sub_apply, coeff_sub, hW] + simp only [Matrix.add_apply, Matrix.smul_apply, Matrix.map_apply, smul_eq_mul, + coeff_add, mul_comm (_^_) (C _), coeff_C_mul, coeff_X_pow] + by_cases hnd : n = d+1 + · subst n + simp [Ytop] + · have hlt : d+1 < n := by omega + rw [coeff_eq_zero_of_natDegree_lt ((hY i j).trans_lt hlt)] + simp [hnd, show n≠d by omega] + · rw [scaledTrace_sub] + have hzero : scaledTrace θ A W = 0 := scaledTrace_commutator θ A _ + rw [hzero, sub_zero] + +theorem exists_constant_multiplier_of_bounded_scaledTrace + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Y : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) (d : ℕ) + (hY : ∀ i j, (Y i j).natDegree ≤ d) + (hT : (scaledTrace θ A Y).natDegree ≤ k) : + ∃ Y₀ : Matrix (Fin (k+1)) (Fin (k+1)) K, + scaledTrace θ A (Y₀.map C) = scaledTrace θ A Y := by + induction d generalizing Y with + | zero => + refine ⟨Y.map (fun p => p.coeff 0), ?_⟩ + have he : (Y.map (fun p => p.coeff 0)).map C = Y := by + apply Matrix.ext + intro i j + exact (eq_C_of_natDegree_eq_zero (Nat.eq_zero_of_le_zero (hY i j))).symm + rw [he] + | succ d ih => + obtain ⟨Y', hY', he⟩ := exists_lower_multiplier θ hθ A Y d hY hT + have hT' : (scaledTrace θ A Y').natDegree ≤ k := by rw [he]; exact hT + obtain ⟨Y₀, hY₀⟩ := ih Y' hY' hT' + exact ⟨Y₀, hY₀.trans he⟩ + +end Scaling + +section OuterVariableReduction +variable {R ι : Type*} [CommRing R] [Fintype ι] [DecidableEq ι] + +noncomputable def pencilMatrix (A : Matrix ι ι R) : Matrix ι ι R[X] := + (X : R[X]) • (1 : Matrix ι ι R[X]) + A.map C + +noncomputable def adjTrace (A Y : Matrix ι ι R) : R[X] := + (Y.map C * (pencilMatrix A).adjugate).trace + +@[simp] theorem adjTrace_zero (A : Matrix ι ι R) : adjTrace A 0 = 0 := by + simp [adjTrace] + +theorem adjTrace_add (A Y Z : Matrix ι ι R) : + adjTrace A (Y+Z) = adjTrace A Y + adjTrace A Z := by + have hm : (Y+Z).map C = Y.map C + Z.map C := C.mapMatrix.map_add Y Z + simp only [adjTrace, hm, add_mul, Matrix.trace_add] + +theorem adjTrace_neg (A Y : Matrix ι ι R) : adjTrace A (-Y) = -adjTrace A Y := by + have hm : (-Y).map C = -Y.map C := C.mapMatrix.map_neg Y + simp only [adjTrace, hm, neg_mul, Matrix.trace_neg] + +theorem adjTrace_smul (A Y : Matrix ι ι R) (a : R) : + adjTrace A (a • Y) = C a * adjTrace A Y := by + have hm : (a • Y).map C = C a • Y.map C := by + apply Matrix.ext + intro i j + simp only [Matrix.map_apply, Matrix.smul_apply, smul_eq_mul, map_mul] + simp only [adjTrace, hm, Matrix.smul_mul, Matrix.trace_smul, smul_eq_mul] + +theorem X_mul_adjTrace (A Y : Matrix ι ι R) : + X * adjTrace A Y = adjTrace A (-(Y*A)) + C Y.trace * (pencilMatrix A).det := by + have hM : (X : R[X]) • (pencilMatrix A).adjugate = + (pencilMatrix A).det • (1 : Matrix ι ι R[X]) - + A.map C * (pencilMatrix A).adjugate := by + have he := Matrix.mul_adjugate (pencilMatrix A) + conv_lhs at he => rw [pencilMatrix, add_mul, Matrix.smul_mul, one_mul] + exact eq_sub_of_add_eq he + calc + _ = (Y.map C * ((X : R[X]) • (pencilMatrix A).adjugate)).trace := by + rw [Matrix.mul_smul, Matrix.trace_smul, smul_eq_mul] + rfl + _ = (Y.map C * ((pencilMatrix A).det • 1 - + A.map C * (pencilMatrix A).adjugate)).trace := by rw [hM] + _ = _ := by + rw [Matrix.mul_sub, Matrix.trace_sub, Matrix.mul_smul, mul_one, + Matrix.trace_smul, smul_eq_mul, ← Matrix.mul_assoc, + ← Matrix.map_mul, adjTrace_neg] + have ht : (Y.map C).trace = C Y.trace := (AddMonoidHom.map_trace (C : R →+* R[X]) Y).symm + rw [ht] + dsimp only [adjTrace] + ring + +def HasAdjugateNormalForm (A : Matrix ι ι R) (P : R[X]) : Prop := + ∃ (Y : Matrix ι ι R) (H : R[X]), P = adjTrace A Y + H * (pencilMatrix A).det + +namespace HasAdjugateNormalForm +variable {A : Matrix ι ι R} {P Q : R[X]} + +theorem zero : HasAdjugateNormalForm A 0 := by + exact ⟨0, 0, by simp⟩ + +theorem add (hP : HasAdjugateNormalForm A P) (hQ : HasAdjugateNormalForm A Q) : + HasAdjugateNormalForm A (P+Q) := by + obtain ⟨Y,H,rfl⟩ := hP + obtain ⟨Z,J,rfl⟩ := hQ + refine ⟨Y+Z,H+J,?_⟩ + rw [adjTrace_add] + ring + +theorem C_mul (hP : HasAdjugateNormalForm A P) (a : R) : + HasAdjugateNormalForm A (C a * P) := by + obtain ⟨Y,H,rfl⟩ := hP + refine ⟨a • Y, C a * H, ?_⟩ + rw [adjTrace_smul] + ring + +theorem X_mul (hP : HasAdjugateNormalForm A P) : + HasAdjugateNormalForm A (X*P) := by + obtain ⟨Y,H,rfl⟩ := hP + refine ⟨-(Y*A), C Y.trace + X*H, ?_⟩ + rw [mul_add, X_mul_adjTrace] + ring + +theorem mul (hP : HasAdjugateNormalForm A P) (f : R[X]) : + HasAdjugateNormalForm A (f*P) := by + induction f using Polynomial.induction_on' with + | add f g hf hg => simpa only [add_mul] using hf.add hg + | monomial n a => + rw [← C_mul_X_pow_eq_monomial, mul_assoc] + apply HasAdjugateNormalForm.C_mul + induction n with + | zero => simpa using hP + | succ n ih => simpa only [pow_succ', mul_assoc] using ih.X_mul + +end HasAdjugateNormalForm + +noncomputable def cofactorIdeal (A : Matrix ι ι R) : Ideal R[X] := + Ideal.span (Set.range fun ij : ι × ι => (pencilMatrix A).adjugate ij.1 ij.2) + +theorem normalForm_of_mem_cofactorIdeal (A : Matrix ι ι R) (P : R[X]) + (hP : P ∈ cofactorIdeal A) : HasAdjugateNormalForm A P := by + let J : Ideal R[X] := + { carrier := {P | HasAdjugateNormalForm A P} + zero_mem' := HasAdjugateNormalForm.zero + add_mem' := fun h h' => h.add h' + smul_mem' := fun f _ h => h.mul f } + have hle : cofactorIdeal A ≤ J := by + apply Ideal.span_le.mpr + rintro _ ⟨⟨i,j⟩, rfl⟩ + change HasAdjugateNormalForm A ((pencilMatrix A).adjugate i j) + refine ⟨Matrix.single j i 1, 0, ?_⟩ + simp [adjTrace, Matrix.map_single, Matrix.trace_single_mul] + exact hle hP + +end OuterVariableReduction + +section DegreeNormalForm +variable {R : Type*} [CommRing R] [IsDomain R] {k : ℕ} + +omit [IsDomain R] in + +theorem natDegree_adjTrace_le + (A Y : Matrix (Fin (k+1)) (Fin (k+1)) R) : + (adjTrace A Y).natDegree ≤ k := by + unfold adjTrace + change (∑ i, (Y.map C * (pencilMatrix A).adjugate) i i).natDegree ≤ k + apply natDegree_sum_le_of_forall_le + intro i hi + rw [Matrix.mul_apply] + apply natDegree_sum_le_of_forall_le + intro j hj + apply le_trans (natDegree_C_mul_le _ _) + have hm : (1 : Matrix (Fin (k+1)) (Fin (k+1)) R).map C = 1 := by + exact C.mapMatrix.map_one + simpa only [pencilMatrix, hm] using natDegree_adjugate_linear_le (1 : Matrix (Fin (k+1)) (Fin (k+1)) R) A j i + +theorem natDegree_det_pencilMatrix + (A : Matrix (Fin (k+1)) (Fin (k+1)) R) : + (pencilMatrix A).det.natDegree = k+1 := by + have hm : (1 : Matrix (Fin (k+1)) (Fin (k+1)) R).map C = 1 := C.mapMatrix.map_one + have hc : (pencilMatrix A).det.coeff (k+1) = 1 := by + simpa only [pencilMatrix, hm, Fintype.card_fin, Matrix.det_one] using + coeff_det_X_add_C_card (1 : Matrix (Fin (k+1)) (Fin (k+1)) R) A + apply le_antisymm + · simpa only [pencilMatrix, hm, Fintype.card_fin] using + natDegree_det_X_add_C_le (1 : Matrix (Fin (k+1)) (Fin (k+1)) R) A + · exact le_natDegree_of_ne_zero (hc ▸ one_ne_zero) + +theorem exists_multiplier_of_mem_cofactorIdeal + (A : Matrix (Fin (k+1)) (Fin (k+1)) R) (P : R[X]) + (hP : P ∈ cofactorIdeal A) (hdeg : P.natDegree ≤ k) : + ∃ Y : Matrix (Fin (k+1)) (Fin (k+1)) R, P = adjTrace A Y := by + obtain ⟨Y,H,h⟩ := normalForm_of_mem_cofactorIdeal A P hP + have hH : H = 0 := by + by_contra hn + have hF : (pencilMatrix A).det ≠ 0 := by + intro hzero + have := natDegree_det_pencilMatrix A + simp only [hzero, natDegree_zero] at this + omega + have hd : (H*(pencilMatrix A).det).natDegree ≤ k := by + have he : H*(pencilMatrix A).det = P - adjTrace A Y := by rw [h]; ring + rw [he] + exact le_trans (natDegree_sub_le _ _) (max_le hdeg (natDegree_adjTrace_le A Y)) + rw [natDegree_mul hn hF, natDegree_det_pencilMatrix] at hd + omega + refine ⟨Y, ?_⟩ + simpa only [hH, zero_mul, add_zero] using h +end DegreeNormalForm + +section BivariateScaling +variable {K : Type*} [Field K] {k : ℕ} + +noncomputable def scaleHom : K[X][X] →+* K[X][X] := + Bivariate.swap.toRingHom.comp (compRingHom (C X * X)) + +@[simp] theorem scaleHom_C (p : K[X]) : scaleHom (C p) = liftCoefficients p := by + simp [scaleHom, Bivariate.swap_C, liftCoefficients] + +@[simp] theorem scaleHom_X : scaleHom (X : K[X][X]) = C X * X := by + change Bivariate.swap ((X : K[X][X]).comp (C X * X)) = _ + rw [X_comp, map_mul, Bivariate.swap_X, Bivariate.swap_Y, mul_comm] + +theorem scaleHom_injective : Function.Injective (scaleHom (K := K)) := by + apply (injective_iff_map_eq_zero _).2 + intro p hp + have hc : p.comp (C X * X) = 0 := by + apply Bivariate.swap.injective + change Bivariate.swap (p.comp (C X * X)) = 0 at hp + simpa only [map_zero] using hp + rcases comp_eq_zero_iff.mp hc with h | ⟨_, h⟩ + · exact h + · have hn := congrArg natDegree h + rw [natDegree_C_mul_X X X_ne_zero, natDegree_C] at hn + omega + +theorem scaleHom_pencil (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) : + (pencilMatrix (pencilBase θ A)).map scaleHom = scaledPencil θ A := by + rw [scaledPencil_eq] + apply Matrix.ext + intro i j + simp only [pencilMatrix, Matrix.map_apply, Matrix.add_apply, + Matrix.smul_apply, smul_eq_mul, Matrix.one_apply, map_add, map_mul] + split_ifs <;> simp + +theorem scaleHom_adjTrace (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (Y : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) : + scaleHom (adjTrace (pencilBase θ A) Y) = scaledTrace θ A Y := by + unfold adjTrace scaledTrace + have ha : (pencilMatrix (pencilBase θ A)).adjugate.map scaleHom = + ((pencilMatrix (pencilBase θ A)).map scaleHom).adjugate := + RingHom.map_adjugate scaleHom _ + rw [AddMonoidHom.map_trace, Matrix.map_mul, ha, scaleHom_pencil] + congr 2 + apply Matrix.ext + intro i j + exact scaleHom_C _ + +theorem exists_constant_multiplier_of_mem_cofactorIdeal + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (P : K[X][X]) + (hP : P ∈ cofactorIdeal (pencilBase θ A)) + (houter : P.natDegree ≤ k) (htotal : (scaleHom P).natDegree ≤ k) : + ∃ Y : Matrix (Fin (k+1)) (Fin (k+1)) K, + P = adjTrace (pencilBase θ A) (Y.map C) := by + obtain ⟨Y, hY⟩ := exists_multiplier_of_mem_cofactorIdeal _ _ hP houter + have hs : (scaledTrace θ A Y).natDegree ≤ k := by + simpa only [hY, scaleHom_adjTrace] using htotal + obtain ⟨d, hd⟩ := (Set.finite_range (fun ij : Fin (k+1) × Fin (k+1) => + (Y ij.1 ij.2).natDegree)).bddAbove + obtain ⟨Z, hZ⟩ := exists_constant_multiplier_of_bounded_scaledTrace θ hθ A Y d + (fun i j => hd ⟨(i,j), rfl⟩) hs + refine ⟨Z, scaleHom_injective ?_⟩ + rw [hY, scaleHom_adjTrace, scaleHom_adjTrace] + exact hZ.symm + +theorem scaleHom_monomial_monomial (a b : ℕ) (c : K) : + scaleHom (monomial a (monomial b c)) = monomial (a+b) (monomial a c) := by + simp only [← C_mul_X_pow_eq_monomial, map_mul, map_pow, scaleHom_C, + scaleHom_X, liftCoefficients, coe_mapRingHom, Polynomial.map_C, Polynomial.map_X] + simp only [mul_pow, pow_add] + ring + +theorem coeff_scaleHom (P : K[X][X]) (d i : ℕ) : + ((scaleHom P).coeff d).coeff i = + if i ≤ d then (P.coeff i).coeff (d-i) else 0 := by + induction P using Polynomial.induction_on' with + | add P Q hP hQ => + simp only [map_add, coeff_add, hP, hQ] + split_ifs <;> simp + | monomial a p => + induction p using Polynomial.induction_on' with + | add p q hp hq => + simp only [map_add, coeff_add, hp, hq] + split_ifs <;> simp + | monomial b c => + rw [scaleHom_monomial_monomial] + by_cases hai : a = i + · subst a + by_cases hib : i+b = d + · have hi : i ≤ d := by omega + have hb : b = d-i := by omega + simp [hi, hb] + · by_cases hi : i ≤ d + · have hb : b ≠ d-i := by omega + simp [coeff_monomial, hi, hib, hb] + · simp [coeff_monomial, hi, hib] + · by_cases hab : a+b = d <;> simp [coeff_monomial, hai, hab] + +def TotalDegreeLE (P : K[X][X]) (d : ℕ) : Prop := + ∀ i j : ℕ, d < i+j → (P.coeff i).coeff j = 0 + +theorem TotalDegreeLE.outer {P : K[X][X]} {d : ℕ} (hP : TotalDegreeLE P d) : + P.natDegree ≤ d := by + apply natDegree_le_iff_coeff_eq_zero.mpr + intro i hi + ext j + simpa only [coeff_zero] using hP i j (by omega) + +theorem TotalDegreeLE.scaled {P : K[X][X]} {d : ℕ} (hP : TotalDegreeLE P d) : + (scaleHom P).natDegree ≤ d := by + apply natDegree_le_iff_coeff_eq_zero.mpr + intro n hn + ext i + rw [coeff_scaleHom] + split_ifs with hi + · simpa only [coeff_zero] using hP i (n-i) (by omega) + · simp + +theorem adjugate_generation + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (P : K[X][X]) + (hP : P ∈ cofactorIdeal (pencilBase θ A)) (hdeg : TotalDegreeLE P k) : + ∃ Y : Matrix (Fin (k+1)) (Fin (k+1)) K, + P = adjTrace (pencilBase θ A) (Y.map C) := + exists_constant_multiplier_of_mem_cofactorIdeal θ hθ A P hP hdeg.outer hdeg.scaled +theorem totalDegreeLE_iff_scaled_natDegree (P : K[X][X]) (d : ℕ) : + TotalDegreeLE P d ↔ (scaleHom P).natDegree ≤ d := by + refine ⟨TotalDegreeLE.scaled, ?_⟩ + intro hd i j hij + have hc := coeff_eq_zero_of_natDegree_lt (hd.trans_lt hij) + have hh := congrArg (fun p : K[X] => p.coeff i) hc + simpa only [coeff_scaleHom, Nat.le_add_right, ↓reduceIte, Nat.add_sub_cancel_left, + coeff_zero] using hh + +theorem TotalDegreeLE.mul {P Q : K[X][X]} {d e : ℕ} + (hP : TotalDegreeLE P d) (hQ : TotalDegreeLE Q e) : + TotalDegreeLE (P*Q) (d+e) := by + rw [totalDegreeLE_iff_scaled_natDegree, map_mul] + exact natDegree_mul_le.trans (Nat.add_le_add hP.scaled hQ.scaled) + +theorem TotalDegreeLE.mono {P : K[X][X]} {d e : ℕ} + (hP : TotalDegreeLE P d) (hde : d ≤ e) : TotalDegreeLE P e := + fun i j hij => hP i j (hde.trans_lt hij) + +theorem totalDegreeLE_monomial (a b : ℕ) (c : K) : + TotalDegreeLE (monomial a (monomial b c)) (a+b) := by + rw [totalDegreeLE_iff_scaled_natDegree, scaleHom_monomial_monomial] + exact natDegree_monomial_le _ + +theorem coeff_adjTrace_eq_zero + (θ : Fin (k+1) → K) (A Y : Matrix (Fin (k+1)) (Fin (k+1)) K) (q : ℕ) + (hcrit : ∀ i j, (((pencilMatrix (pencilBase θ A)).adjugate i j).coeff q).coeff q = 0) : + ((adjTrace (pencilBase θ A) (Y.map C)).coeff q).coeff q = 0 := by + simp only [adjTrace, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.map_apply, finsetSum_coeff, coeff_C_mul, hcrit, mul_zero, + Finset.sum_const_zero] + +theorem critical_ideal_eq_zero + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (q : ℕ) (hq : 3*q ≤ k) + (hcrit : ∀ i j, (((pencilMatrix (pencilBase θ A)).adjugate i j).coeff q).coeff q = 0) + {P : K[X][X]} (hP : P ∈ cofactorIdeal (pencilBase θ A)) + (hdeg : TotalDegreeLE P q) : P = 0 := by + ext a b + simp only [coeff_zero] + by_cases hab : a+b ≤ q + · have ha : a ≤ q := by omega + have hb : b ≤ q := by omega + let W : K[X][X] := monomial (q-a) (monomial (q-b) 1) + have hW : TotalDegreeLE (W*P) k := + ((totalDegreeLE_monomial (q-a) (q-b) (1 : K)).mul hdeg).mono (by omega) + have hWP : W*P ∈ cofactorIdeal (pencilBase θ A) := + Ideal.mul_mem_left _ W hP + obtain ⟨Y, hY⟩ := adjugate_generation θ hθ A (W*P) hWP hW + have hz : (((W*P).coeff q).coeff q) = 0 := by + rw [hY] + exact coeff_adjTrace_eq_zero θ A Y q hcrit + have hca := coeff_monomial_mul P (q-a) a (monomial (q-b) (1 : K)) + have hcb := coeff_monomial_mul (P.coeff a) (q-b) b (1 : K) + rw [Nat.add_sub_of_le ha] at hca + rw [Nat.add_sub_of_le hb, one_mul] at hcb + change (((monomial (q-a) (monomial (q-b) 1) * P).coeff q).coeff q) = 0 at hz + rw [hca, hcb] at hz + exact hz + · exact hdeg a b (by omega) + +abbrev PlaneIndex (q : ℕ) := {p : Fin (q+2) × Fin (q+2) // p.1 < p.2} + +theorem card_planeIndex (q : ℕ) : Fintype.card (PlaneIndex q) = (q+2).choose 2 := by + rw [Fintype.card_subtype] + simpa only [Fintype.card_fin] using (Fintype.card_product_filter_lt (α := Fin (q+2))) + +noncomputable def planeMap (q : ℕ) : (PlaneIndex q → K) →ₗ[K] K[X][X] where + toFun f := ∑ i, monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) (f i)) + map_add' f g := by simp [Finset.sum_add_distrib] + map_smul' c f := by simp [Finset.smul_sum, smul_monomial] + +theorem coeff_planeMap (q : ℕ) (f : PlaneIndex q → K) (i : PlaneIndex q) : + (((planeMap q f).coeff i.val.1.val).coeff (i.val.2.val-i.val.1.val-1)) = f i := by + classical + simp only [planeMap, LinearMap.coe_mk, AddHom.coe_mk, finsetSum_coeff] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji + by_cases ha : j.val.1.val = i.val.1.val + · have hb : j.val.2.val-j.val.1.val-1 ≠ i.val.2.val-i.val.1.val-1 := by + intro h + apply hji + apply Subtype.ext + apply Prod.ext + · exact Fin.ext ha + · apply Fin.ext + have hi := i.property + have hj := j.property + change i.val.1.val < i.val.2.val at hi + change j.val.1.val < j.val.2.val at hj + omega + simp only [ha] at hb + simp [coeff_monomial, ha, hb] + · simp [coeff_monomial, ha] + · simp + +theorem totalDegreeLE_planeMap (q : ℕ) (f : PlaneIndex q → K) : + TotalDegreeLE (planeMap q f) q := by + classical + intro a b hab + simp only [planeMap, LinearMap.coe_mk, AddHom.coe_mk, finsetSum_coeff] + apply Finset.sum_eq_zero + intro i _ + have hi := i.property + change i.val.1.val < i.val.2.val at hi + have hbnd := i.val.2.isLt + by_cases ha : i.val.1.val = a + · have hb : i.val.2.val-i.val.1.val-1 ≠ b := by omega + simp only [ha] at hb + simp [coeff_monomial, ha, hb] + · simp [coeff_monomial, ha] + +theorem critical_cofactor_length + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (q : ℕ) (hq : 3*q ≤ k) + (hcrit : ∀ i j, (((pencilMatrix (pencilBase θ A)).adjugate i j).coeff q).coeff q = 0) : + ((q+2).choose 2 : ℕ∞) ≤ Module.length K (K[X][X] ⧸ cofactorIdeal (pencilBase θ A)) := by + classical + let I := cofactorIdeal (pencilBase θ A) + let f : (PlaneIndex q → K) →ₗ[K] (K[X][X] ⧸ I) := + (Ideal.Quotient.mkₐ K I).toLinearMap.comp (planeMap q) + have hf : Function.Injective f := by + apply LinearMap.ker_eq_bot.mp + apply LinearMap.ker_eq_bot'.mpr + intro P hP + have hmem : planeMap q P ∈ cofactorIdeal (pencilBase θ A) := + Ideal.Quotient.eq_zero_iff_mem.mp hP + have hz := critical_ideal_eq_zero θ hθ A q hq hcrit hmem (totalDegreeLE_planeMap q P) + funext i + have hc := congrArg (fun p : K[X][X] => (p.coeff i.val.1.val).coeff + (i.val.2.val-i.val.1.val-1)) hz + simpa only [coeff_planeMap, coeff_zero, Pi.zero_apply] using hc + have h := Module.length_le_of_injective (R := K) f hf + rw [Module.length_eq_finrank, Module.finrank_fintype_fun_eq_card, card_planeIndex] at h + exact h + +theorem totalDegreeLE_cofactor (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (i j : Fin (k+1)) : + TotalDegreeLE ((pencilMatrix (pencilBase θ A)).adjugate i j) k := by + rw [totalDegreeLE_iff_scaled_natDegree] + have ha : (pencilMatrix (pencilBase θ A)).adjugate.map scaleHom = + ((pencilMatrix (pencilBase θ A)).map scaleHom).adjugate := + RingHom.map_adjugate scaleHom _ + have hh := congrArg (fun M => M i j) ha + change scaleHom ((pencilMatrix (pencilBase θ A)).adjugate i j) = _ at hh + rw [hh, scaleHom_pencil] + exact natDegree_adjugate_linear_le (spectralSlope θ) (A.map C) i j + +theorem TotalDegreeLE.add {P Q : K[X][X]} {d : ℕ} + (hP : TotalDegreeLE P d) (hQ : TotalDegreeLE Q d) : TotalDegreeLE (P+Q) d := by + intro i j hij + simp only [coeff_add, hP i j hij, hQ i j hij, add_zero] + +theorem TotalDegreeLE.sub {P Q : K[X][X]} {d : ℕ} + (hP : TotalDegreeLE P d) (hQ : TotalDegreeLE Q d) : TotalDegreeLE (P-Q) d := by + intro i j hij + simp only [coeff_sub, hP i j hij, hQ i j hij, sub_zero] + +theorem TotalDegreeLE.sum {ι : Type*} (s : Finset ι) (f : ι → K[X][X]) {d : ℕ} + (h : ∀ i ∈ s, TotalDegreeLE (f i) d) : TotalDegreeLE (∑ i ∈ s, f i) d := by + intro a b hab + simp only [finsetSum_coeff] + exact Finset.sum_eq_zero fun i hi => h i hi a b hab + +noncomputable def diagonalContraction (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (y : Fin (k+1) → K) : K[X][X] := + adjTrace (pencilBase θ A) ((Matrix.diagonal y).map C) + +theorem diagonalContraction_eq_sum (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (y : Fin (k+1) → K) : + diagonalContraction θ A y = ∑ i, C (C (y i)) * + (pencilMatrix (pencilBase θ A)).adjugate i i := by + simp [diagonalContraction, adjTrace, Matrix.trace, Matrix.diag_apply, + Matrix.mul_apply, Matrix.diagonal_apply] + +theorem diagonalContraction_mem (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (y : Fin (k+1) → K) : + diagonalContraction θ A y ∈ cofactorIdeal (pencilBase θ A) := by + rw [diagonalContraction_eq_sum] + apply Ideal.sum_mem + intro i _ + apply Ideal.mul_mem_left + exact Ideal.subset_span ⟨(i,i), rfl⟩ + +theorem totalDegreeLE_diagonalContraction (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (y : Fin (k+1) → K) : + TotalDegreeLE (diagonalContraction θ A y) k := by + rw [diagonalContraction_eq_sum] + apply TotalDegreeLE.sum + intro i _ + simpa only [zero_add, monomial_zero_left] using + (totalDegreeLE_monomial 0 0 (y i)).mul (totalDegreeLE_cofactor θ A i i) + +noncomputable def slopeTrace (θ : Fin (k+1) → K) (y : Fin (k+1) → K) : K[X] := + ((Matrix.diagonal y).map C * (spectralSlope θ).adjugate).trace + +theorem natDegree_adjugate_slope_le (θ : Fin (k+1) → K) (i j : Fin (k+1)) : + ((spectralSlope θ).adjugate i j).natDegree ≤ k := by + have hs : spectralSlope θ = (X : K[X]) • + (1 : Matrix (Fin (k+1)) (Fin (k+1)) K).map C + + (Matrix.diagonal θ).map C := by + ext i j + simp only [spectralSlope, Matrix.diagonal_apply, Matrix.add_apply, Matrix.smul_apply, + Matrix.map_apply, Matrix.one_apply, smul_eq_mul] + split_ifs <;> simp + rw [hs] + exact natDegree_adjugate_linear_le 1 (Matrix.diagonal θ) i j + +theorem natDegree_slopeTrace_le (θ : Fin (k+1) → K) (y : Fin (k+1) → K) : + (slopeTrace θ y).natDegree ≤ k := by + simp only [slopeTrace, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.map_apply] + apply natDegree_sum_le_of_forall_le + intro i _ + apply natDegree_sum_le_of_forall_le + intro j _ + exact (natDegree_C_mul_le _ _).trans (natDegree_adjugate_slope_le θ j i) + +noncomputable def slopeCoefficientMap (θ : Fin (k+1) → K) : + (Fin (k+1) → K) →ₗ[K] (Fin (k+1) → K) where + toFun y i := (slopeTrace θ y).coeff i + map_add' y z := by + ext i + simp [slopeTrace, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.diagonal_apply, finsetSum_coeff, coeff_C_mul, Finset.sum_add_distrib, add_mul] + map_smul' c y := by + ext i + simp [slopeTrace, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.diagonal_apply, finsetSum_coeff, coeff_C_mul, Finset.mul_sum, mul_assoc] + +theorem slopeCoefficientMap_injective (θ : Fin (k+1) → K) (hθ : Function.Injective θ) : + Function.Injective (slopeCoefficientMap θ) := by + apply LinearMap.ker_eq_bot.mp + apply LinearMap.ker_eq_bot'.mpr + intro y hy + have hz : slopeTrace θ y = 0 := by + ext n + simp only [coeff_zero] + by_cases hn : n < k+1 + · exact congrFun hy ⟨n,hn⟩ + · exact coeff_eq_zero_of_natDegree_lt ((natDegree_slopeTrace_le θ y).trans_lt (by omega)) + have h := diagonal_zero_of_trace_slope θ hθ (Matrix.diagonal y) hz + funext i + simpa only [Matrix.diagonal_apply_eq, Pi.zero_apply] using h i + +theorem exists_diagonalContraction_top (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (a : ℕ) (ha : a ≤ k) : + ∃ y : Fin (k+1) → K, + (scaleHom (diagonalContraction θ A y)).coeff k = monomial a 1 := by + obtain ⟨y, hy⟩ := LinearMap.surjective_of_injective (slopeCoefficientMap_injective θ hθ) + (fun i => (monomial a (1 : K)).coeff i) + have hs : slopeTrace θ y = monomial a 1 := by + ext n + by_cases hn : n < k+1 + · exact congrFun hy ⟨n,hn⟩ + · rw [coeff_eq_zero_of_natDegree_lt ((natDegree_slopeTrace_le θ y).trans_lt (by omega)), + coeff_eq_zero_of_natDegree_lt ((natDegree_monomial_le (1 : K) : (monomial a (1 : K)).natDegree ≤ a).trans_lt (by omega))] + refine ⟨y, ?_⟩ + have ht := coeff_scaledTrace_top θ A ((Matrix.diagonal y).map C) 0 (by simp) + simp only [zero_add] at ht + rw [diagonalContraction, scaleHom_adjTrace, ht] + convert hs using 1 + simp [slopeTrace] + +theorem TotalDegreeLE.pred_of_top_zero {P : K[X][X]} {d : ℕ} + (hd : 0 < d) (hP : TotalDegreeLE P d) (hz : (scaleHom P).coeff d = 0) : + TotalDegreeLE P (d-1) := by + intro a b hab + by_cases hlt : d < a+b + · exact hP a b hlt + · have he : a+b = d := by omega + have hc := congrArg (fun p : K[X] => p.coeff a) hz + rw [coeff_scaleHom] at hc + simpa only [show a ≤ d by omega, ↓reduceIte, show d-a = b by omega, + coeff_zero] using hc + +theorem exists_lower_monomial_representative + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) + (a b : ℕ) (hab : a+b = k) : + ∃ R : K[X][X], TotalDegreeLE R (k-1) ∧ + monomial a (monomial b 1) - R ∈ cofactorIdeal (pencilBase θ A) := by + obtain ⟨y, hy⟩ := exists_diagonalContraction_top θ hθ A a (by omega) + let R := monomial a (monomial b (1 : K)) - diagonalContraction θ A y + refine ⟨R, ?_, ?_⟩ + · apply TotalDegreeLE.pred_of_top_zero hk + · exact ((totalDegreeLE_monomial a b (1 : K)).mono hab.le).sub + (totalDegreeLE_diagonalContraction θ A y) + · simp only [R, map_sub, coeff_sub, scaleHom_monomial_monomial, hab, + coeff_monomial_same, hy, sub_self] + · simpa only [R, sub_sub_cancel] using diagonalContraction_mem θ A y + +theorem eq_sum_bivariate (P : K[X][X]) : + P = ∑ a ∈ P.support, ∑ b ∈ (P.coeff a).support, + monomial a (monomial b ((P.coeff a).coeff b)) := by + calc + P = ∑ a ∈ P.support, monomial a (P.coeff a) := (sum_monomial_eq P).symm + _ = _ := by + apply Finset.sum_congr rfl + intro a _ + rw [← map_sum] + exact congrArg (monomial a) (sum_monomial_eq (P.coeff a)).symm + +theorem map_mem_of_monomials {V : Type*} [AddCommGroup V] [Module K V] + (f : K[X][X] →ₗ[K] V) (W : Submodule K V) (P : K[X][X]) + (h : ∀ a b, (P.coeff a).coeff b ≠ 0 → + f (monomial a (monomial b ((P.coeff a).coeff b))) ∈ W) : f P ∈ W := by + rw [eq_sum_bivariate P, map_sum] + apply Submodule.sum_mem + intro a ha + rw [map_sum] + apply Submodule.sum_mem + intro b hb + apply h + exact mem_support_iff.mp hb + +theorem cofactor_quotient_spanned + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + Submodule.span K (Set.range (fun i : PlaneIndex (k-1) => + (Ideal.Quotient.mkₐ K (cofactorIdeal (pencilBase θ A))) + (monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1)))) = ⊤ := by + classical + let I := cofactorIdeal (pencilBase θ A) + let f := (Ideal.Quotient.mkₐ K I).toLinearMap + let W := Submodule.span K (Set.range (fun i : PlaneIndex (k-1) => + f (monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1)))) + have hmon : ∀ d a b : ℕ, a+b = d → ∀ c : K, f (monomial a (monomial b c)) ∈ W := by + intro d + induction d using Nat.strong_induction_on with + | h d ih => + intro a b hab c + have hscalar : monomial a (monomial b c) = c • monomial a (monomial b (1 : K)) := by + simp only [smul_monomial, smul_eq_mul, mul_one] + rw [hscalar, map_smul] + apply W.smul_mem + by_cases hd : d < k + · let i : PlaneIndex (k-1) := ⟨(⟨a, by omega⟩, ⟨a+b+1, by omega⟩), by + change a < a+b+1 + omega⟩ + apply Submodule.subset_span + refine ⟨i, ?_⟩ + change f (monomial a (monomial (a+b+1-a-1) (1 : K))) = _ + rw [show a+b+1-a-1 = b by omega] + · let α := min a k + let β := k-α + have hα : α ≤ a := Nat.min_le_left _ _ + have hβ : β ≤ b := by dsimp [β, α]; omega + have hsum : α+β = k := by dsimp [β, α]; omega + obtain ⟨R, hR, hmem⟩ := exists_lower_monomial_representative θ hθ A hk α β hsum + let Q : K[X][X] := monomial (a-α) (monomial (b-β) 1) + have heq : f (monomial a (monomial b 1)) = f (Q*R) := by + apply sub_eq_zero.mp + rw [← map_sub] + apply Ideal.Quotient.eq_zero_iff_mem.mpr + have hh := I.mul_mem_left Q hmem + convert hh using 1 + rw [mul_sub] + congr 1 + simp only [Q, monomial_mul_monomial, one_mul] + rw [Nat.sub_add_cancel hα, Nat.sub_add_cancel hβ] + rw [heq] + apply map_mem_of_monomials f W (Q*R) + intro u v huv + have hde : TotalDegreeLE (Q*R) ((a-α)+(b-β)+(k-1)) := + (totalDegreeLE_monomial (a-α) (b-β) (1 : K)).mul hR + have hle : u+v ≤ (a-α)+(b-β)+(k-1) := by + by_contra hn + exact huv (hde u v (by omega)) + exact ih (u+v) (by omega) u v rfl _ + apply top_unique + intro x _ + obtain ⟨P, rfl⟩ := Ideal.Quotient.mk_surjective x + apply map_mem_of_monomials f W P + intro a b _ + exact hmon (a+b) a b rfl _ + +theorem finite_cofactor_quotient + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + Module.Finite K (K[X][X] ⧸ cofactorIdeal (pencilBase θ A)) := by + classical + let g := fun i : PlaneIndex (k-1) => + (Ideal.Quotient.mkₐ K (cofactorIdeal (pencilBase θ A))) + (monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1)) + have hg := cofactor_quotient_spanned θ hθ A hk + change Submodule.span K (Set.range g) = ⊤ at hg + exact Module.Finite.of_fg_top (Submodule.fg_def.mpr ⟨Set.range g, Set.finite_range g, hg⟩) + +end BivariateScaling + +end PermanentBorder.AdjugateAlgebra + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AffineSelectors.lean b/lean/OAI/Algebra/Determinantal/AffineSelectors.lean new file mode 100644 index 0000000000000000000000000000000000000000..03163e53ef118d02acc4ec76822b285520342f23 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AffineSelectors.lean @@ -0,0 +1,417 @@ +import OAI.Algebra.Determinantal.GateCoefficients + +namespace OAI + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommRing R] +abbrev SelectorOuter (I : Type*) (h : ℕ) := I ⊕ (Fin 2 × (I ⊕ Fin h)) +abbrev SelectorLabels (I : Type*) (h : ℕ) := (I × I) ⊕ + (Fin 2 × ((I × Fin h) ⊕ (Fin h × I))) +abbrev SelectorGateVars (I : Type*) (h : ℕ) := Fin 2 × ((I ⊕ Fin h) ⊕ (I ⊕ Fin h)) + +noncomputable def selectorSrc (h : ℕ) : SelectorLabels I h → SelectorOuter I h + | .inl (i,_) => .inl i + | .inr (c,.inl (i,_)) => .inr (c,.inl i) + | .inr (c,.inr (j,_)) => .inr (c,.inr j) +noncomputable def selectorDst (h : ℕ) : SelectorLabels I h → SelectorOuter I h + | .inl (_,i) => .inl i + | .inr (c,.inl (_,j)) => .inr (c,.inr j) + | .inr (c,.inr (_,i)) => .inr (c,.inl i) +noncomputable def selectorBaseWeight (M : Matrix I I R) (h : ℕ) : SelectorLabels I h → R + | .inl (i,j) => M i j + | .inr _ => 1 +noncomputable def selectorWeight (θ : I → R) (g : Fin 2 × I) : R := + if g.1=0 then 1 else θ g.2 +noncomputable def selectorMain (h : ℕ) (g : Fin 2 × I) : SelectorOuter I h := .inl g.2 +noncomputable def selectorGate (h : ℕ) (g : Fin 2 × I) : SelectorOuter I h := .inr (g.1,.inl g.2) + +noncomputable def selectorMatrix (M : Matrix I I R) (θ : I → R) (h : ℕ) := + expandedMatrix (selectorSrc h) (selectorDst h) (selectorBaseWeight M h) + (selectorWeight θ) (selectorMain h) (selectorGate h) (selectorMain h) (selectorGate h) + +noncomputable def selectorBoundary (M : Matrix I I R) (θ : I → R) (h : ℕ) : + MvPolynomial (SelectorOuter I h ⊕ SelectorOuter I h) R := + baseEdges (selectorSrc h) (selectorDst h) (selectorBaseWeight M h) * + ∏ g : Fin 2 × I, (1 + C (selectorWeight θ g) * + X (.inl (selectorMain h g))*X (.inl (selectorGate h g))* + X (.inr (selectorMain h g))*X (.inr (selectorGate h g))) + +def selectorSplitEquiv (h : ℕ) : (SelectorOuter I h ⊕ SelectorOuter I h) ≃ + (SelectorGateVars I h ⊕ (I ⊕ I)) where + toFun + | .inl (.inl i) => .inr (.inl i) + | .inr (.inl i) => .inr (.inr i) + | .inl (.inr (c,v)) => .inl (c,.inl v) + | .inr (.inr (c,v)) => .inl (c,.inr v) + invFun + | .inr (.inl i) => .inl (.inl i) + | .inr (.inr i) => .inr (.inl i) + | .inl (c,.inl v) => .inl (.inr (c,v)) + | .inl (c,.inr v) => .inr (.inr (c,v)) + left_inv x := by rcases x with (i|⟨c,v⟩)|(i|⟨c,v⟩) <;> rfl + right_inv x := by rcases x with ⟨c,v|v⟩|(i|i) <;> rfl + +noncomputable def selectorSplit (h : ℕ) : MvPolynomial (SelectorOuter I h ⊕ SelectorOuter I h) R →+* + MvPolynomial (SelectorGateVars I h) (MvPolynomial (I ⊕ I) R) := + (sumRingEquiv R _ _).toRingHom.comp ((rename (selectorSplitEquiv h)).toRingHom) +omit [Fintype I] [DecidableEq I] in +@[simp] theorem selectorSplit_C (h : ℕ) (r : R) : selectorSplit (I := I) h (C r) = C (C r) := by + simp [selectorSplit] +omit [Fintype I] [DecidableEq I] in +@[simp] theorem selectorSplit_main_left (h : ℕ) (i : I) : + selectorSplit h (X (.inl (.inl i)) : MvPolynomial _ R) = C (X (.inl i)) := by + simp [selectorSplit, selectorSplitEquiv] +omit [Fintype I] [DecidableEq I] in +@[simp] theorem selectorSplit_main_right (h : ℕ) (i : I) : + selectorSplit h (X (.inr (.inl i)) : MvPolynomial _ R) = C (X (.inr i)) := by + simp [selectorSplit, selectorSplitEquiv] +omit [Fintype I] [DecidableEq I] in +@[simp] theorem selectorSplit_gate_left (h : ℕ) (c : Fin 2) (v : I ⊕ Fin h) : + selectorSplit h (X (.inl (.inr (c,v))) : MvPolynomial _ R) = X (c,.inl v) := by + simp [selectorSplit, selectorSplitEquiv] +omit [Fintype I] [DecidableEq I] in +@[simp] theorem selectorSplit_gate_right (h : ℕ) (c : Fin 2) (v : I ⊕ Fin h) : + selectorSplit h (X (.inr (.inr (c,v))) : MvPolynomial _ R) = X (c,.inr v) := by + simp [selectorSplit, selectorSplitEquiv] + +omit [DecidableEq I] in + theorem selectorSplit_coeff (h : ℕ) (p : MvPolynomial (SelectorOuter I h ⊕ SelectorOuter I h) R) : + p.coeff (allOnes _) = ((selectorSplit h p).coeff (allOnes (SelectorGateVars I h))).coeff (allOnes (I ⊕ I)) := by + have hr := coeff_rename_mapDomain (selectorSplitEquiv h) (selectorSplitEquiv h).injective p (allOnes _) + rw [allOnes_map_equiv] at hr + rw [← hr] + have ho : allOnes (SelectorGateVars I h ⊕ (I ⊕ I)) = + (allOnes (SelectorGateVars I h)).sumElim (allOnes (I ⊕ I)) := by ext v; cases v <;> rfl + rw [ho, coeff_nested] + rfl + +noncomputable def selectorBoundaryWeight (θ : I → R) (c : Fin 2) (i : I) : MvPolynomial (I ⊕ I) R := + C (selectorWeight θ (c,i))*X (.inl i)*X (.inr i) + +omit [DecidableEq I] in + theorem selectorSplit_base (M : Matrix I I R) (h : ℕ) : + selectorSplit h (baseEdges (selectorSrc h) (selectorDst h) (selectorBaseWeight M h)) = + C (edgeProduct M) * ∏ c : Fin 2, + ((∏ i : I, ∏ j : Fin h, (1 + X (c,.inl (.inl i))*X (c,.inr (.inr j)))) * + (∏ j : Fin h, ∏ i : I, (1 + X (c,.inl (.inr j))*X (c,.inr (.inl i))))) := by + classical + have hm (i j : SelectorOuter I h) (r : R) : monomial (edgeExponent (i,j)) r = + C r * X (.inl i) * X (.inr j) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + simp only [edgeExponent, mul_one] + simp only [baseEdges, hm, map_prod, map_add, map_one, map_mul, Fintype.prod_sum_type, + Fintype.prod_prod_type, selectorSrc, selectorDst, selectorBaseWeight, + selectorSplit_C, selectorSplit_main_left, selectorSplit_main_right, + selectorSplit_gate_left, selectorSplit_gate_right, one_mul] + apply congrArg₂ (·*·) + · simp only [edgeProduct, Fintype.prod_prod_type, map_prod, map_add, map_one] + apply Finset.prod_congr rfl + intro i _ + apply Finset.prod_congr rfl + intro j _ + have hx : monomial (edgeExponent (i,j)) (M i j) = C (M i j)*X (.inl i)*X (.inr j) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + simp only [edgeExponent, mul_one] + rw [hx, map_mul, map_mul] + · simp only + +omit [DecidableEq I] in + theorem selectorSplit_choices (θ : I → R) (h : ℕ) : + selectorSplit h (∏ g : Fin 2 × I, (1 + C (selectorWeight θ g) * + X (.inl (selectorMain h g))*X (.inl (selectorGate h g))* + X (.inr (selectorMain h g))*X (.inr (selectorGate h g)))) = + ∏ c : Fin 2, ∏ i : I, (1 + C (selectorBoundaryWeight θ c i)* + X (c,.inl (.inl i))*X (c,.inr (.inl i))) := by + simp only [map_prod, map_add, map_one, map_mul, Fintype.prod_prod_type, + selectorMain, selectorGate, selectorSplit_C, selectorSplit_main_left, + selectorSplit_main_right, selectorSplit_gate_left, selectorSplit_gate_right, + selectorBoundaryWeight] + apply Finset.prod_congr rfl + intro c _ + apply Finset.prod_congr rfl + intro i _ + ring + +omit [DecidableEq I] in + theorem selectorSplit_boundary (M : Matrix I I R) (θ : I → R) (h : ℕ) : + selectorSplit h (selectorBoundary M θ h) = + C (edgeProduct M) * ∏ c : Fin 2, rename (fun v => (c,v)) + (Gates.fullGateEdges (selectorBoundaryWeight θ c) h) := by + rw [selectorBoundary, map_mul, selectorSplit_base, selectorSplit_choices, mul_assoc, + ← Finset.prod_mul_distrib] + apply congrArg (C (edgeProduct M)*·) + apply Finset.prod_congr rfl + intro c _ + simp only [Gates.fullGateEdges, map_mul, map_prod, map_add, map_one, rename_X, rename_C] +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommRing R] + theorem allOnes_block {A B : Type*} [Fintype A] [Fintype B] [DecidableEq A] : + allOnes (A × B) = blockExponent (fun _ : A => allOnes B) := by + ext ⟨a,b⟩ + simp + + theorem two_gates_count (a : Fin 2 → I → R) (q : ℕ) (hq : q ≤ Fintype.card I) : + (∏ c : Fin 2, rename (fun v => (c,v)) + (Gates.fullGateEdges (a c) (Fintype.card I-q))).coeff (allOnes _) = + (((Fintype.card I-q).factorial : R)^4) * + (elementaryBoundary (a 0) q * elementaryBoundary (a 1) q) := by + rw [allOnes_block, coeff_independent_blocks] + have hc (c : Fin 2) : (Gates.fullGateEdges (a c) (Fintype.card I-q)).coeff (allOnes _) = + (((Fintype.card I-q).factorial : R)^2) * elementaryBoundary (a c) q := + Gates.full_gate_count (a c) q hq + simp_rw [hc] + simp only [Fin.prod_univ_succ, Fin.prod_univ_zero, mul_one, Fin.succ_zero_eq_one] + ring + + theorem selector_boundary_coeff (M : Matrix I I R) (θ : I → R) (q : ℕ) + (hq : q ≤ Fintype.card I) : + (selectorBoundary M θ (Fintype.card I-q)).coeff (allOnes _) = + (((Fintype.card I-q).factorial : R)^4) * diagonalCoefficient M θ q := by + rw [selectorSplit_coeff, selectorSplit_boundary, coeff_C_mul, two_gates_count _ q hq] + have h0 : selectorBoundaryWeight θ 0 = fun i => X (.inl i)*X (.inr i) := by + funext i; simp [selectorBoundaryWeight, selectorWeight] + have h1 : selectorBoundaryWeight θ 1 = fun i => C (θ i)*X (.inl i)*X (.inr i) := by + funext i; simp [selectorBoundaryWeight, selectorWeight] + rw [h0,h1] + have hc : (((Fintype.card I-q).factorial : MvPolynomial (I ⊕ I) R)^4) = + C (((Fintype.card I-q).factorial : R)^4) := by simp only [map_pow, map_natCast] + rw [hc] + have hp (p a b : MvPolynomial (I ⊕ I) R) (c : R) : p * (C c * (a*b)) = C c * (p*a*b) := by ring + rw [hp, coeff_C_mul, ← diagonalCoefficient_boundary] + + theorem selector_matrix_permanent (M : Matrix I I R) (θ : I → R) (q : ℕ) + (hq : q ≤ Fintype.card I) : + (selectorMatrix M θ (Fintype.card I-q)).permanent = + ((-2:R)^(2 * Fintype.card I) * ((Fintype.card I-q).factorial : R)^4) * + diagonalCoefficient M θ q := by + rw [selectorMatrix, expanded_permanent] + change (-2:R)^Fintype.card (Fin 2 × I) * + (selectorBoundary M θ (Fintype.card I-q)).coeff (allOnes _) = _ + rw [selector_boundary_coeff M θ q hq] + simp only [Fintype.card_prod, Fintype.card_fin, mul_assoc] + +omit [DecidableEq I] in + theorem selector_matrix_card (q : ℕ) (hq : q ≤ Fintype.card I) : + Fintype.card (ExpandedVertex (SelectorOuter I (Fintype.card I-q)) (Fin 2 × I)) = + 11 * Fintype.card I - 2*q := by + simp only [ExpandedVertex, SelectorOuter, Fintype.card_sum, Fintype.card_prod, Fintype.card_fin] + omega +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {A B R : Type*} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B] [CommSemiring R] +omit [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B] in + theorem rename_inner (p : MvPolynomial A R) : + sumRingEquiv R A B (rename Sum.inl p) = map C p := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp [hp,hq] + | mul_X p i hp => simp [hp] +omit [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B] in + theorem rename_outer (p : MvPolynomial B R) : + sumRingEquiv R A B (rename Sum.inr p) = C p := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp [hp,hq] + | mul_X p i hp => simp [hp] + + theorem permanent_block_diagonal (P : Matrix A A R) (Q : Matrix B B R) : + (Matrix.fromBlocks P 0 0 Q).permanent = P.permanent * Q.permanent := by + rw [← row_product_permanent] + have hp : (∏ i, ∑ j, C (Matrix.fromBlocks P 0 0 Q i j) * X j) = + rename Sum.inl (∏ i, ∑ j, C (P i j)*X j) * + rename Sum.inr (∏ i, ∑ j, C (Q i j)*X j) := by + simp [Fintype.prod_sum_type, Fintype.sum_sum_type, Matrix.fromBlocks] + rw [hp] + have hones : allOnes (A ⊕ B) = (allOnes A).sumElim (allOnes B) := by + ext i; cases i <;> rfl + rw [hones, coeff_nested, map_mul, rename_inner, rename_outer, mul_comm, coeff_C_mul, + coeff_map, mul_comm, coeff_C_mul, row_product_permanent, row_product_permanent] + + theorem permanent_reindex_equiv (P : Matrix A A R) (e : B ≃ A) : + (P.submatrix e e).permanent = P.permanent := by + classical + unfold Matrix.permanent + refine Fintype.sum_equiv (Equiv.permCongr e) _ _ ?_ + intro σ + simpa only [Matrix.submatrix_apply, Equiv.permCongr_apply, Equiv.trans_apply, + Equiv.symm_apply_apply] using + (e.prod_comp (fun i => P ((Equiv.permCongr e σ) i) i)) +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommRing R] +abbrev SelectorVertex (I : Type*) (h : ℕ) := ExpandedVertex (SelectorOuter I h) (Fin 2 × I) +noncomputable def selectorLinearEntries (M : Matrix I I R) (h : ℕ) : + Matrix (SelectorVertex I h) (SelectorVertex I h) R + | .inl (.inl i), .inl (.inl j) => M i j + | _, _ => 0 + + theorem selectorMatrix_affine (M : Matrix I I R) (θ : I → R) (h : ℕ) + (r c : SelectorVertex I h) : + selectorMatrix M θ h r c = selectorMatrix 0 θ h r c + selectorLinearEntries M h r c := by + classical + simp only [selectorMatrix, expandedMatrix, graphMatrix, Fintype.sum_sum_type, + Fintype.sum_prod_type, expandedWeight, selectorBaseWeight, expandedSrc, expandedDst, + selectorSrc, selectorDst] + rcases r with (a|a)|a <;> rcases c with (b|b)|b <;> + simp [selectorLinearEntries, ite_and] +end PermanentBorder.Selector +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R S : Type*} [Fintype I] [DecidableEq I] [CommRing R] [CommRing S] + + theorem gadgetH_map (f : R →+* S) (r c : Fin 3) : + f (gadgetH (R := R) r c) = gadgetH r c := by + fin_cases r <;> fin_cases c <;> simp [gadgetH] + + theorem selectorMatrix_map (f : R →+* S) (M : Matrix I I R) (θ : I → R) (h : ℕ) + (r c : SelectorVertex I h) : + selectorMatrix (M.map f) (fun i => f (θ i)) h r c = f (selectorMatrix M θ h r c) := by + classical + simp only [selectorMatrix, expandedMatrix, graphMatrix, map_sum] + apply Finset.sum_congr rfl + intro e _ + rw [apply_ite f, map_zero] + split_ifs + · rcases e with (⟨i,j⟩|⟨c,⟨i,j⟩|⟨j,i⟩⟩)|⟨g,b|r|⟨r,c⟩⟩ <;> + simp only [expandedWeight, selectorBaseWeight, Matrix.map_apply, selectorWeight] <;> + (try split_ifs) <;> simp_all [gadgetH_map, map_ofNat] + · rfl + +noncomputable def selectorCoefficientMatrix (h : ℕ) (ij : I × I) : + Matrix (SelectorVertex I h) (SelectorVertex I h) R := + fun r c => if r = .inl (.inl ij.1) ∧ c = .inl (.inl ij.2) then 1 else 0 + + theorem selectorLinearEntries_sum (M : Matrix I I R) (h : ℕ) + (r c : SelectorVertex I h) : + selectorLinearEntries M h r c = ∑ ij, selectorCoefficientMatrix h ij r c * M ij.1 ij.2 := by + classical + rcases r with (a|a)|a <;> rcases c with (b|b)|b <;> + simp [selectorLinearEntries, selectorCoefficientMatrix, Fintype.sum_prod_type, ite_and] + + theorem selector_polynomial_affine (θ : I → R) (h : ℕ) (r c : SelectorVertex I h) : + selectorMatrix (Matrix.of fun i j => X (i,j)) (fun i => C (θ i)) h r c = + C (selectorMatrix 0 θ h r c) + + ∑ ij : I × I, C (selectorCoefficientMatrix h ij r c) * X ij := by + rw [selectorMatrix_affine] + have hm : (0 : Matrix I I R).map (C : R →+* MvPolynomial (I × I) R) = 0 := by ext; simp + rw [← hm, selectorMatrix_map] + congr 1 + rw [selectorLinearEntries_sum] + apply Finset.sum_congr rfl + intro ij _ + unfold selectorCoefficientMatrix + split_ifs <;> simp_all +end PermanentBorder.Selector + +namespace PermanentBorder +open MvPolynomial +variable {σ V T : Type*} [Fintype σ] [Fintype V] [DecidableEq V] + + theorem affineSubstitution_permanent (m : ℕ) (b : Variables m → ℂ) + (B : Variables m → σ → ℂ) : + affineSubstitution b B (permanentPolynomial m) = + (Matrix.of fun i j => C (b (i,j)) + ∑ w, C (B (i,j) w)*X w).permanent := by + classical + unfold permanentPolynomial affineSubstitution + simp only [map_sum, map_prod, aeval_X] + exact Matrix.permanent_transpose + (Matrix.of fun i j => C (b (i,j)) + ∑ w, C (B (i,j) w)*X w) + +omit [Fintype V] [DecidableEq V] in + theorem polynomial_fromBlocks_affine [Fintype T] [DecidableEq T] + (P : Matrix V V (Poly σ)) (A₀ : Matrix V V ℂ) (A : σ → Matrix V V ℂ) + (hP : ∀ i j, P i j = C (A₀ i j) + ∑ w, C (A w i j)*X w) + (i j : V ⊕ T) : + Matrix.fromBlocks P 0 0 1 i j = + C (Matrix.fromBlocks A₀ 0 0 (1 : Matrix T T ℂ) i j) + + ∑ w, C (Matrix.fromBlocks (A w) 0 0 (0 : Matrix T T ℂ) i j)*X w := by + classical + rcases i with i|i <;> rcases j with j|j + · exact hP i j + · simp [Matrix.fromBlocks] + · simp [Matrix.fromBlocks] + · simp [Matrix.fromBlocks, Matrix.one_apply] + + theorem exists_affine_permanent_padding (m : ℕ) (hm : Fintype.card V ≤ m) + (P : Matrix V V (Poly σ)) (A₀ : Matrix V V ℂ) (A : σ → Matrix V V ℂ) + (hP : ∀ i j, P i j = C (A₀ i j) + ∑ w, C (A w i j)*X w) : + ∃ (b : Variables m → ℂ) (B : Variables m → σ → ℂ), + affineSubstitution b B (permanentPolynomial m) = P.permanent := by + classical + let T := V ⊕ Fin (m-Fintype.card V) + let e : Fin m ≃ T := Fintype.equivOfCardEq (by + simp only [T, Fintype.card_fin, Fintype.card_sum] + omega) + let C₀ : Matrix T T ℂ := Matrix.fromBlocks A₀ 0 0 1 + let A' : σ → Matrix T T ℂ := fun w => Matrix.fromBlocks (A w) 0 0 0 + let P' : Matrix T T (Poly σ) := Matrix.fromBlocks P 0 0 1 + let b : Variables m → ℂ := fun ij => C₀ (e ij.1) (e ij.2) + let B : Variables m → σ → ℂ := fun ij w => A' w (e ij.1) (e ij.2) + refine ⟨b,B,?_⟩ + rw [affineSubstitution_permanent] + have he : (Matrix.of fun i j => C (b (i,j)) + ∑ w, C (B (i,j) w)*X w) = + P'.submatrix e e := by + funext i j + exact (polynomial_fromBlocks_affine P A₀ A hP (e i) (e j)).symm + rw [he, Selector.permanent_reindex_equiv, Selector.permanent_block_diagonal, + Matrix.permanent_one, mul_one] +end PermanentBorder + +namespace PermanentBorder +open MvPolynomial + +noncomputable def coefficientPolynomial (k q : ℕ) (θ : Fin k → ℂ) : Poly (Variables k) := + Selector.diagonalCoefficient (Matrix.of fun i j => X (i,j)) (fun i => C (θ i)) q + +noncomputable def selectorScalar (k q : ℕ) : ℂ := + (-2)^(2*k) * ((k-q).factorial : ℂ)^4 + + theorem selectorScalar_ne_zero (k q : ℕ) : selectorScalar k q ≠ 0 := by + unfold selectorScalar + apply mul_ne_zero (pow_ne_zero _ (by norm_num)) + exact pow_ne_zero _ (Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero _)) + + theorem exists_selector_affine_projection (k q m : ℕ) (hq : q ≤ k) + (hm : 11*k-2*q ≤ m) (θ : Fin k → ℂ) : + ∃ (b : Variables m → ℂ) (B : Variables m → Variables k → ℂ), + affineSubstitution b B (permanentPolynomial m) = + selectorScalar k q • coefficientPolynomial k q θ := by + classical + let V := Selector.SelectorVertex (Fin k) (Fintype.card (Fin k)-q) + let P : Matrix V V (Poly (Variables k)) := + Selector.selectorMatrix (Matrix.of fun i j => X (i,j)) (fun i => C (θ i)) (Fintype.card (Fin k)-q) + have hcard : Fintype.card V = 11*k-2*q := by + simpa only [V, Selector.SelectorVertex, Fintype.card_fin] using + (Selector.selector_matrix_card (I := Fin k) q (by simpa using hq)) + obtain ⟨b,B,h⟩ := exists_affine_permanent_padding m (by omega : Fintype.card V ≤ m) P + (Selector.selectorMatrix 0 θ (Fintype.card (Fin k)-q)) (Selector.selectorCoefficientMatrix (Fintype.card (Fin k)-q)) + (Selector.selector_polynomial_affine θ (Fintype.card (Fin k)-q)) + refine ⟨b,B,h.trans ?_⟩ + have he := Selector.selector_matrix_permanent + (Matrix.of fun i j : Fin k => (X (i,j) : Poly (Variables k))) + (fun i => C (θ i)) q (by simpa using hq) + simp only [Fintype.card_fin] at he + change P.permanent = _ at he + rw [he, smul_eq_C_mul] + simp only [selectorScalar, coefficientPolynomial, map_mul, map_pow, map_neg, + map_ofNat, map_natCast] + + theorem HasBorderDeterminant.coefficientPolynomial {k q m n : ℕ} + (h : HasBorderDeterminant n (permanentPolynomial m)) (hq : q ≤ k) + (hm : 11*k-2*q ≤ m) (θ : Fin k → ℂ) : + HasBorderDeterminant n (coefficientPolynomial k q θ) := by + obtain ⟨b,B,hproj⟩ := exists_selector_affine_projection k q m hq hm θ + have hg := (h.affineSubstitution b B).smul (selectorScalar k q)⁻¹ + rw [hproj, smul_smul, inv_mul_cancel₀ (selectorScalar_ne_zero k q), one_smul] at hg + exact hg +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AmbientCoefficient.lean b/lean/OAI/Algebra/Determinantal/AmbientCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..433a472f336ed283b019af5919eb08fcb4b104e8 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AmbientCoefficient.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Determinantal.BilinearCounts + +namespace OAI + +open MvPolynomial +open PermanentBorder.KernelBilinear +namespace PermanentBorder.AmbientPolar + +/-- H,U,V are respectively none, some false, some true. -/ +def groupIndex : Option Bool → Fin 3 + | none => 0 + | some false => 1 + | some true => 2 + +lemma groupIndex_injective : Function.Injective groupIndex := by + decide + +lemma dimensions_explicit (K n : ℕ) : + dimensions (Fin K) n = + Finsupp.single none (K+1) + Finsupp.single (some false) n + + Finsupp.single (some true) n := by + classical + ext j + cases j with + | none => simp + | some b => cases b <;> simp + +/-- The three-variable coefficient equals the mixed coefficient +for matrices of size `n + 1`. -/ +lemma literal_coefficient_eq (K n : ℕ) : + ((X (0 : Fin 3) + X 1)^(n+1) * (X 0 + X 2)^n * + (X 1 + X 2)^K : MvPolynomial (Fin 3) ℕ).coeff + (Finsupp.single 0 (K+1) + Finsupp.single 1 n + Finsupp.single 2 n) = + (Multigraded.mixedPolynomial + (firstGroup (κ := Fin K) (n := n)) secondGroup).coeff + (dimensions (Fin K) n) := by + classical + have h := MvPolynomial.coeff_rename_mapDomain groupIndex groupIndex_injective + (Multigraded.mixedPolynomial (firstGroup (κ := Fin K) (n := n)) secondGroup) + (dimensions (Fin K) n) + have hdegree : (dimensions (Fin K) n).mapDomain groupIndex = + Finsupp.single 0 (K+1) + Finsupp.single 1 n + Finsupp.single 2 n := by + rw [dimensions_explicit] + simp only [Finsupp.mapDomain_add, Finsupp.mapDomain_single, groupIndex] + rw [hdegree] at h + simpa [mixedPolynomial_eq, groupIndex] using h + +/-- A bound by the mixed coefficient is also a bound by the three-variable coefficient. -/ +lemma count_le_literal_coefficient (K n D : ℕ) + (h : D ≤ (Multigraded.mixedPolynomial + (firstGroup (κ := Fin K) (n := n)) secondGroup).coeff + (dimensions (Fin K) n)) : + D ≤ ((X (0 : Fin 3) + X 1)^(n+1) * (X 0 + X 2)^n * + (X 1 + X 2)^K : MvPolynomial (Fin 3) ℕ).coeff + (Finsupp.single 0 (K+1) + Finsupp.single 1 n + Finsupp.single 2 n) := by + rw [literal_coefficient_eq] + exact h + +end PermanentBorder.AmbientPolar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AmbientMain.lean b/lean/OAI/Algebra/Determinantal/AmbientMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e43f10aa673171ba06e0f93502aaf9f45fe51af --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AmbientMain.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.Determinantal.AmbientPersistence +import OAI.Algebra.Determinantal.AmbientCoefficient +import OAI.Algebra.Determinantal.AmbientNumerical + +namespace OAI + +open MvPolynomial +open PermanentBorder.PolarAnalysis PermanentBorder.KernelBilinear +namespace PermanentBorder + +/-- Selected distinct simple ambient polar zeros of an affine determinant limit are +bounded by its mixed coefficient, the corresponding binomial count, and a numerical +matrix-size bound. The affine map and the ambient directions are arbitrary. -/ +theorem ambient_polar_bound + (N n K D : ℕ) (_hN : 0 < N) (_hD : 0 < D) + (P : Poly (Fin N)) (hb : HasBorderDeterminant n P) + (b : Fin N → ℂ) + (L : (Option (Fin K) → ℂ) →L[ℂ] (Fin N → ℂ)) + (h : Fin K → Fin N → ℂ) + (x : Fin D → ℂ × (Fin K → ℂ)) (hx : Function.Injective x) + (hz : ∀ j, polarPair (fun y => eval y P) + (fun z => b + L (optionProduct.symm z)) h (x j) = 0) + (hs : ∀ j, (fderiv ℂ (polarPair (fun y => eval y P) + (fun z => b + L (optionProduct.symm z)) h) (x j)).IsInvertible) : + D ≤ ((X (0 : Fin 3) + X 1)^n * (X 0 + X 2)^(n-1) * + (X 1 + X 2)^K : MvPolynomial (Fin 3) ℕ).coeff + (Finsupp.single 0 (K+1) + Finsupp.single 1 (n-1) + Finsupp.single 2 (n-1)) ∧ + ((X (0 : Fin 3) + X 1)^n * (X 0 + X 2)^(n-1) * + (X 1 + X 2)^K : MvPolynomial (Fin 3) ℕ).coeff + (Finsupp.single 0 (K+1) + Finsupp.single 1 (n-1) + Finsupp.single 2 (n-1)) ≤ 2^K * (2*n-1).choose (K+1) ∧ + ((K+1 : ℕ) : ℝ) / (4 * Real.exp 1) * + Real.rpow (D : ℝ) (1 / ((K+1 : ℕ) : ℝ)) ≤ (n : ℝ) := by + classical + cases n with + | zero => exact False.elim (Nat.not_lt_zero _ hb.1) + | succ n => + have hrename := AmbientPolar.literal_coefficient_eq K n + have hfirst := AmbientPolar.border_polar_mixed_count hb b L h x hx hz hs + have hsecond := KernelBilinear.mixed_coefficient_bound (κ := Fin K) (n := n) + have hcount : D ≤ 2^K * (2*(n+1)-1).choose (K+1) := by + have hc := hfirst.trans hsecond + simpa only [Fintype.card_fin, show 2*(n+1)-1 = 2*n+1 by omega] using hc + refine ⟨?_, ?_, Polar.ambient_count_numerical_bound (n+1) K D hcount⟩ + · simpa only [Nat.add_sub_cancel, Fintype.card_fin, ← hrename] using hfirst + · simpa only [Nat.add_sub_cancel, Fintype.card_fin, ← hrename, + show 2*(n+1)-1 = 2*n+1 by omega] using hsecond + +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AmbientMixedCount.lean b/lean/OAI/Algebra/Determinantal/AmbientMixedCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..b83d40ae2f02c89375f1038f434b43971b9cb3c7 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AmbientMixedCount.lean @@ -0,0 +1,109 @@ +import OAI.Algebra.Determinantal.BilinearCounts + +namespace OAI + +namespace PermanentBorder.KernelBilinear +open MvPolynomial Matrix PolarAnalysis PolarAnalysis.Schur +open scoped Classical +variable {κ J : Type} [Fintype κ] [Fintype J] {n : ℕ} +variable {T : Type*} [NormedAddCommGroup T] [NormedSpace ℂ T] + +theorem selected_kernel_mixed_count + (F : T → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (ψ : (ℂ × (κ → ℂ)) → T) (h : κ → T) + (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (B : κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (hlocal : ∀ z i j, A₀ i j + ∑ k, A k i j * optionProduct.symm z k = F (ψ z) i j) + (hdir : ∀ y k i j, fderiv ℂ (fun y => F y i j) y (h k) = B k i j) + (i : Fin (n+1)) (r : J → Fin (n+1)) (x : J → ChartSpace κ n) + (hx : Function.Injective (fun j => (x j).1)) + (hz : ∀ j, matrixKernelSystem + (fun y => (F y).submatrix (pivotEquiv (r j)) (pivotEquiv i)) ψ h (x j) = 0) + (hs : ∀ j, (fderiv ℂ (matrixKernelSystem + (fun y => (F y).submatrix (pivotEquiv (r j)) (pivotEquiv i)) ψ h) (x j)).IsInvertible) : + Fintype.card J ≤ + (Multigraded.mixedPolynomial (firstGroup (κ := κ) (n := n)) secondGroup).coeff + (dimensions κ n) := by + classical + have he (j : J) : + (fun z => output (r j) (fun a => eval (chart i (r j) z) (system A₀ A B i a))) = + matrixKernelSystem (fun y => (F y).submatrix (pivotEquiv (r j)) (pivotEquiv i)) ψ h := by + funext z + exact system_eq_matrixKernelSystem F ψ h A₀ A B hlocal hdir i (r j) z + have hz' (j : J) (a : Equations κ n) : eval (chart i (r j) (x j)) (system A₀ A B i a) = 0 := by + have hh : output (r j) (fun a => eval (chart i (r j) (x j)) (system A₀ A B i a)) = + output (r j) 0 := by + rw [map_zero, congrFun (he j) (x j)] + exact hz j + exact congrFun ((output (r j)).injective hh) a + have hc := Multigraded.bilinear_simple_point_count_reindex (dimensions κ n) + Sigma.fst variablesEquiv variablesEquiv_group firstGroup secondGroup card_equations + (system A₀ A B i) (system_homogeneous A₀ A B i) + (fun j => base i (r j)) (fun j => base_group i (r j)) + (fun j => output (r j)) (fun j => chart i (r j)) (fun j => contDiff_chart i (r j)) + (fun j z => chart_base i (r j) z) x + (fun j k hjk => chart_separated (fun hh => hjk (hx hh))) hz' + (fun j => by rw [he]; exact hs j) + exact hc + +variable {σ : Type} [Fintype σ] + +theorem affine_polar_mixed_count + (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : σ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (b : σ → ℂ) (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (h : κ → σ → ℂ) + (x : J → ℂ × (κ → ℂ)) (hx : Function.Injective x) + (hz : ∀ j, polarPair (fun y => (affine A₀ A y).det) + (fun z => b + L (optionProduct.symm z)) h (x j) = 0) + (hs : ∀ j, (fderiv ℂ (polarPair (fun y => (affine A₀ A y).det) + (fun z => b + L (optionProduct.symm z)) h) (x j)).IsInvertible) : + Fintype.card J ≤ + (Multigraded.mixedPolynomial (firstGroup (κ := κ) (n := n)) secondGroup).coeff + (dimensions κ n) := by + classical + let ψ := fun z : ℂ × (κ → ℂ) => b + L (optionProduct.symm z) + obtain ⟨S,hS,hr⟩ := finite_simple_polar_kernel_lifts (0 : Fin (n+1)) + (affine A₀ A) (affine_contDiff A₀ A) ψ h x + (fun _ => ((differentiable_const b).add (L.differentiable.comp optionProduct.symm.differentiable)).differentiableAt) + hz hs + choose r hr using hr + let A₀' := A₀*S + let A' := fun v => A v*S + let B₀ := affine A₀' A' b + let B := fun k => ∑ v, L (Pi.single k 1) v • A' v + let D := fun k => ∑ v, h k v • A' v + have hlocal (z : ℂ × (κ → ℂ)) (i j : Fin (n+1)) : + B₀ i j + ∑ k, B k i j * optionProduct.symm z k = affine A₀' A' (ψ z) i j := by + have hexp : optionProduct.symm z = ∑ k, optionProduct.symm z k • Pi.single k 1 := by + ext k + simp [Pi.single_apply] + have hLe (v : σ) : L (optionProduct.symm z) v = + ∑ k, optionProduct.symm z k * L (Pi.single k 1) v := by + conv_lhs => rw [hexp, map_sum] + simp + simp only [B₀, B, affine, ψ, Matrix.add_apply, Matrix.sum_apply, Matrix.smul_apply, + smul_eq_mul, Pi.add_apply, hLe, add_mul, Finset.sum_add_distrib, Finset.sum_mul] + rw [Finset.sum_comm, ← add_assoc] + congr 1 + apply Finset.sum_congr rfl + intro v _ + apply Finset.sum_congr rfl + intro k _ + ring + have hd (y : σ → ℂ) (k : κ) (i j : Fin (n+1)) : + fderiv ℂ (fun y => affine A₀' A' y i j) y (h k) = D k i j := by + rw [affine_derivative] + simp [D,Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] + let X := fun j => matrixKernelPoint + (fun y => (affine A₀' A' y).submatrix (pivotEquiv (r j)) (pivotEquiv (0 : Fin (n+1)))) ψ (x j) + apply selected_kernel_mixed_count (affine A₀' A') ψ h B₀ B D hlocal hd 0 r X + · exact hx + · intro j + simpa only [X, A₀', A', affine_right_mul] using (hr j).1 + · intro j + simpa only [X, A₀', A', affine_right_mul] using (hr j).2 + +end PermanentBorder.KernelBilinear + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AmbientNumerical.lean b/lean/OAI/Algebra/Determinantal/AmbientNumerical.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2b8e52da1ee52101fbf48881f61937467731dcc --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AmbientNumerical.lean @@ -0,0 +1,64 @@ +import OAI.Algebra.Determinantal.BorderPolars + +namespace OAI + +namespace PermanentBorder.Polar + +/-- The binomial count implies a numerical lower bound for the matrix size. +No positivity assumption on `D` or `n` is needed. -/ +theorem ambient_count_numerical_bound (n K D : ℕ) + (hcount : D ≤ 2 ^ K * (2 * n - 1).choose (K + 1)) : + ((K + 1 : ℕ) : ℝ) / (4 * Real.exp 1) * + Real.rpow (D : ℝ) (1 / ((K + 1 : ℕ) : ℝ)) ≤ (n : ℝ) := by + have hK : (0 : ℝ) < K + 1 := by positivity + have hcountR : (D : ℝ) ≤ 2 ^ K * ((2 * n - 1).choose (K + 1) : ℝ) := by + exact_mod_cast hcount + have hchoose := choose_exp_bound (2 * n - 1) (K + 1) (by omega) + have htwo : ((2 * n - 1 : ℕ) : ℝ) ≤ 2 * n := by + exact_mod_cast (Nat.sub_le (2 * n) 1) + have hbase : Real.exp 1 * ((2 * n - 1 : ℕ) : ℝ) / ((K + 1 : ℕ) : ℝ) ≤ + (2 * Real.exp 1 * n) / (K + 1) := by + simp only [Nat.cast_add, Nat.cast_one] + apply div_le_div_of_nonneg_right _ (by positivity) + nlinarith [Real.exp_pos (1 : ℝ)] + have hpow : (D : ℝ) ≤ (4 * Real.exp 1 * n / (K + 1)) ^ (K + 1) := by + calc + (D : ℝ) ≤ 2 ^ K * ((2 * n - 1).choose (K + 1) : ℝ) := hcountR + _ ≤ 2 ^ K * (Real.exp 1 * ((2 * n - 1 : ℕ) : ℝ) / + ((K + 1 : ℕ) : ℝ)) ^ (K + 1) := + mul_le_mul_of_nonneg_left hchoose (by positivity) + _ ≤ 2 ^ (K + 1) * ((2 * Real.exp 1 * n) / (K + 1)) ^ (K + 1) := by + apply mul_le_mul + · have htwoPow : (2 : ℝ) ^ K ≤ 2 ^ (K + 1) := by + rw [pow_succ] + nlinarith [pow_pos (by norm_num : (0 : ℝ) < 2) K] + exact htwoPow + · exact pow_le_pow_left₀ (by positivity) hbase _ + · positivity + · positivity + _ = (4 * Real.exp 1 * n / (K + 1)) ^ (K + 1) := by + rw [← mul_pow] + congr 1 + ring + have hrootpow : + (Real.rpow (D : ℝ) (1 / ((K + 1 : ℕ) : ℝ))) ^ (K + 1) = (D : ℝ) := by + simpa only [one_div, Real.rpow_eq_pow] using + (Real.rpow_inv_natCast_pow (Nat.cast_nonneg D) (by omega : K + 1 ≠ 0)) + have hroot_nonneg : 0 ≤ Real.rpow (D : ℝ) (1 / ((K + 1 : ℕ) : ℝ)) := by + rw [Real.rpow_eq_pow] + exact Real.rpow_nonneg (Nat.cast_nonneg D) _ + have hle : Real.rpow (D : ℝ) (1 / ((K + 1 : ℕ) : ℝ)) ≤ + 4 * Real.exp 1 * n / (K + 1) := by + apply (pow_le_pow_iff_left₀ hroot_nonneg (by positivity) + (by omega : K + 1 ≠ 0)).mp + rw [hrootpow] + exact hpow + rw [div_mul_eq_mul_div] + apply (div_le_iff₀ (by positivity : (0 : ℝ) < 4 * Real.exp 1)).mpr + have h := (le_div_iff₀ hK).mp hle + simp only [Nat.cast_add, Nat.cast_one] at h ⊢ + nlinarith + +end PermanentBorder.Polar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AmbientOperators.lean b/lean/OAI/Algebra/Determinantal/AmbientOperators.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c3de2c400cf7ab11eca30ceeade3726e7178223 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AmbientOperators.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Determinantal.BorderPolars + +namespace OAI + +namespace PermanentBorder.AmbientPolar +open MvPolynomial Matrix PolarAnalysis KernelBilinear +open scoped Classical +variable {σ κ : Type} [Fintype σ] [Fintype κ] + +noncomputable def substitution (b : σ → ℂ) + (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) : Poly σ →ₐ[ℂ] Poly (Option κ) := + affineSubstitution b (fun j i => L (Pi.single i 1) j) + +omit [Fintype σ] in +lemma eval_substitution (b : σ → ℂ) + (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (P : Poly σ) (z : Option κ → ℂ) : + eval z (substitution b L P) = eval (b + L z) P := by + classical + change (aeval z : Poly (Option κ) →ₐ[ℂ] ℂ) (aeval _ P) = _ + rw [comp_aeval_apply] + apply congrArg (fun g : σ → ℂ => aeval g P) + funext j + simp only [map_add, map_sum, map_mul, aeval_C, aeval_X, Algebra.algebraMap_self_apply] + have hz : z = ∑ i, z i • Pi.single i 1 := by + ext i + simp [Pi.single_apply] + have hL : L z j = ∑ i, L (Pi.single i 1) j * z i := by + conv_lhs => rw [hz, map_sum] + simp [mul_comm] + simpa only [Pi.add_apply] using congrArg (fun v : ℂ => b j + v) hL.symm + +noncomputable def directional (h : κ → σ → ℂ) (i : κ) : Poly σ →ₗ[ℂ] Poly σ := + ∑ j, h i j • (pderiv j).toLinearMap + +noncomputable def operators (b : σ → ℂ) + (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (h : κ → σ → ℂ) : + Option κ → Poly σ →ₗ[ℂ] Poly (Option κ) := + Option.elim' (substitution b L).toLinearMap + (fun i => (substitution b L).toLinearMap.comp (directional h i)) + +omit [Fintype κ] in +lemma derivative_directional (h : κ → σ → ℂ) (P : Poly σ) (y : σ → ℂ) (i : κ) : + fderiv ℂ (fun y => eval y P) y (h i) = eval y (directional h i P) := by + rw [(CI.hasFDerivAt_eval P y).fderiv, CI.polynomialDerivative_apply] + simp [directional, mul_comm] + +lemma polarPair_operators (b : σ → ℂ) + (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (h : κ → σ → ℂ) (P : Poly σ) : + polarPair (fun y => eval y P) (fun z => b + L (optionProduct.symm z)) h = + fun z => optionProduct (polynomialSystem (operators b L h) P (optionProduct.symm z)) := by + funext z + apply Prod.ext + · exact (eval_substitution b L P _).symm + · funext i + change fderiv ℂ (fun y => eval y P) (b + L (optionProduct.symm z)) (h i) = + eval (optionProduct.symm z) (substitution b L (directional h i P)) + rw [eval_substitution, derivative_directional] + +end PermanentBorder.AmbientPolar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/AmbientPersistence.lean b/lean/OAI/Algebra/Determinantal/AmbientPersistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..623ea65ba2876738d621bbcf5ba3c4640a087ff3 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/AmbientPersistence.lean @@ -0,0 +1,99 @@ +import OAI.Algebra.Determinantal.AmbientOperators +import OAI.Algebra.Determinantal.AmbientMixedCount + +namespace OAI + +namespace PermanentBorder.AmbientPolar +open MvPolynomial Matrix PolarAnalysis KernelBilinear +open scoped Classical +variable {σ κ ι : Type} [Fintype σ] [Fintype κ] [Fintype ι] + +lemma polynomialSystem_differentiable (b : σ → ℂ) + (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (h : κ → σ → ℂ) + (P : Poly σ) (z : Option κ → ℂ) : + DifferentiableAt ℂ (polynomialSystem (operators b L h) P) z := by + apply differentiableAt_pi.mpr + intro i + exact ((contDiff_mvPolynomial_eval ((operators b L h i) P)).differentiable + (by decide)).differentiableAt + +/-- A selected finite family of simple polar zeros persists in one determinant approximant. -/ +theorem exists_affine_polar_approximant {n : ℕ} {P : Poly σ} + (hb : HasBorderDeterminant n P) (b : σ → ℂ) + (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (h : κ → σ → ℂ) + (x : ι → ℂ × (κ → ℂ)) (hx : Function.Injective x) + (hz : ∀ j, polarPair (fun y => eval y P) + (fun z => b + L (optionProduct.symm z)) h (x j) = 0) + (hs : ∀ j, (fderiv ℂ (polarPair (fun y => eval y P) + (fun z => b + L (optionProduct.symm z)) h) (x j)).IsInvertible) : + ∃ (A₀ : Matrix (Fin n) (Fin n) ℂ) (A : σ → Matrix (Fin n) (Fin n) ℂ) + (y : ι → Option κ → ℂ), Function.Injective y ∧ + ∀ i, SimplePolynomialZero (operators b L h) + (affineMatrixPolynomial n A₀ A) (y i) := by + classical + let Q := polynomialSystem (operators b L h) P + let F := polarPair (fun y => eval y P) + (fun z => b + L (optionProduct.symm z)) h + have hrel : F = fun z => optionProduct (Q (optionProduct.symm z)) := + polarPair_operators b L h P + have hF (z) : DifferentiableAt ℂ F z := by + rw [hrel] + exact optionProduct.differentiableAt.comp z + ((polynomialSystem_differentiable b L h P _).comp z + optionProduct.symm.differentiableAt) + have hconj : (fun z => optionProduct.symm (F (optionProduct z))) = Q := by + funext z + rw [hrel] + simp only [ContinuousLinearEquiv.symm_apply_apply] + apply PolarAnalysis.HasBorderDeterminant.exists_simple_approximant hb + (operators b L h) (fun j => optionProduct.symm (x j)) + (optionProduct.symm.injective.comp hx) + intro j + constructor + · have hzj : optionProduct (Q (optionProduct.symm (x j))) = 0 := by + exact (congrFun hrel (x j)).symm.trans (hz j) + exact optionProduct.injective (hzj.trans (map_zero optionProduct).symm) + · have hh := Polar.simple_conjugate optionProduct.symm (hF (x j)) (hs j) + simp only [ContinuousLinearEquiv.symm_symm] at hh + rw [hconj] at hh + exact hh + +/-- The number of selected simple polar zeros is bounded by the mixed coefficient. -/ +theorem border_polar_mixed_count {n : ℕ} {P : Poly σ} + (hb : HasBorderDeterminant (n+1) P) (b : σ → ℂ) + (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (h : κ → σ → ℂ) + (x : ι → ℂ × (κ → ℂ)) (hx : Function.Injective x) + (hz : ∀ j, polarPair (fun y => eval y P) + (fun z => b + L (optionProduct.symm z)) h (x j) = 0) + (hs : ∀ j, (fderiv ℂ (polarPair (fun y => eval y P) + (fun z => b + L (optionProduct.symm z)) h) (x j)).IsInvertible) : + Fintype.card ι ≤ + (Multigraded.mixedPolynomial (firstGroup (κ := κ) (n := n)) secondGroup).coeff + (dimensions κ n) := by + classical + obtain ⟨A₀,A,y,hy,hys⟩ := exists_affine_polar_approximant hb b L h x hx hz hs + let P' := affineMatrixPolynomial (n+1) A₀ A + let Q := polynomialSystem (operators b L h) P' + have hrel : polarPair (fun y => (affine A₀ A y).det) + (fun z => b + L (optionProduct.symm z)) h = + fun z => optionProduct (Q (optionProduct.symm z)) := by + have heval : (fun y => (affine A₀ A y).det) = (fun y => eval y P') := by + funext z + exact (Polar.eval_matrix A₀ A z).symm + rw [heval] + exact polarPair_operators b L h P' + apply affine_polar_mixed_count A₀ A b L h (fun j => optionProduct (y j)) + (optionProduct.injective.comp hy) + · intro j + rw [hrel] + simp only [ContinuousLinearEquiv.symm_apply_apply] + have hzj : Q (y j) = 0 := (hys j).1 + rw [hzj, map_zero] + · intro j + rw [hrel] + exact Polar.simple_conjugate optionProduct + (polynomialSystem_differentiable b L h P' (y j)) (hys j).2 + +end PermanentBorder.AmbientPolar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/BilinearCounts.lean b/lean/OAI/Algebra/Determinantal/BilinearCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..9089b8410c8d2f050aa7b80201f571bb7b0bb504 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/BilinearCounts.lean @@ -0,0 +1,387 @@ +import OAI.Algebra.Determinantal.SchurLifts + +namespace OAI + +namespace PermanentBorder.PolarAnalysis +open Matrix Schur Filter +open scoped Topology +variable {κ J T : Type*} [Fintype κ] [Finite J] + [NormedAddCommGroup T] [NormedSpace ℂ T] + + theorem finite_simple_polar_kernel_lifts {n : ℕ} + (i₀ : Fin (n+1)) (F : T → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (hF : ∀ i j, ContDiff ℂ 2 (fun y => F y i j)) + (ψ : (ℂ × (κ → ℂ)) → T) (h : κ → T) (x : J → (ℂ × (κ → ℂ))) + (hψ : ∀ j, DifferentiableAt ℂ ψ (x j)) + (hz : ∀ j, polarPair (fun y => (F y).det) ψ h (x j) = 0) + (hsimple : ∀ j, (fderiv ℂ (polarPair (fun y => (F y).det) ψ h) (x j)).IsInvertible) : + ∃ S : Matrix (Fin (n+1)) (Fin (n+1)) ℂ, S.det ≠ 0 ∧ ∀ j, ∃ r : Fin (n+1), + let F' := fun y => (F y * S).submatrix (pivotEquiv r) (pivotEquiv i₀) + matrixKernelSystem F' ψ h (matrixKernelPoint F' ψ (x j)) = 0 ∧ + (fderiv ℂ (matrixKernelSystem F' ψ h) (matrixKernelPoint F' ψ (x j))).IsInvertible := by + have hFd : ∀ y, DifferentiableAt ℂ (fun y i j => F y i j) y := by + intro y + apply differentiableAt_pi.mpr + intro i + apply differentiableAt_pi.mpr + intro j + exact (hF i j).differentiable (by norm_num) y + obtain ⟨S,hS,hs⟩ := selected_simple_common_kernel_chart i₀ (fun y i j => F y i j) + ψ (polarPair (fun y => (F y).det) ψ h) x (fun j => hFd _) hψ + (fun j => differentiableAt_polarPair (contDiff_det hF).contDiffAt (hψ j)) + (fun _ => rfl) hsimple + refine ⟨S,hS,?_⟩ + intro j + obtain ⟨r,hr⟩ := hs j + refine ⟨r,?_⟩ + let F' := fun y => (F y * S).submatrix (pivotEquiv r) (pivotEquiv i₀) + change matrixKernelSystem F' ψ h (matrixKernelPoint F' ψ (x j)) = 0 ∧ _ + have hF' : ∀ a b, ContDiff ℂ 2 (fun y => F' y a b) := by + intro a b + change ContDiff ℂ 2 (fun y => ∑ k, F y (pivotEquiv r a) k * S k (pivotEquiv i₀ b)) + apply ContDiff.sum + intro k _ + exact (hF _ _).mul contDiff_const + obtain ⟨c,hc,hcF⟩ := determinant_pivot_scalar i₀ r + have hcs : c*S.det ≠ 0 := mul_ne_zero hc hS + have hdet (y : T) : (F' y).det = (c*S.det)*(F y).det := by + rw [hcF, Matrix.det_mul] + ring + have hrel : (fun y => (F y).det) =ᶠ[𝓝 (ψ (x j))] + (fun y => (c*S.det)⁻¹ * (F' y).det) := by + apply Filter.Eventually.of_forall + intro y + dsimp only + rw [hdet, ← mul_assoc, inv_mul_cancel₀ hcs, one_mul] + obtain ⟨hzero,hsimp⟩ := simple_polarPair_unit contDiffAt_const + (contDiff_det hF').contDiffAt (hψ j) hrel (inv_ne_zero hcs) (hz j) (hsimple j) + apply simple_matrix_kernel_lift F' hF' (hψ j) + (pivot_minor_ne_zero (F (ψ (x j)) * S) i₀ r hr) hzero hsimp +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.KernelBilinear +open MvPolynomial PolarAnalysis PolarAnalysis.Schur +open scoped Classical +variable {κ : Type} [Fintype κ] {n : ℕ} +abbrev ChartSpace (κ : Type) (n : ℕ) := (ℂ × (κ → ℂ)) × ((Fin n → ℂ) × (Fin n → ℂ)) +noncomputable def optionProduct : (Option κ → ℂ) ≃L[ℂ] (ℂ × (κ → ℂ)) := + (LinearEquiv.piOptionEquivProd ℂ).toContinuousLinearEquiv +@[simp] lemma optionProduct_apply (z : Option κ → ℂ) : optionProduct z = (z none,fun i => z (some i)) := rfl +@[simp] lemma optionProduct_symm_apply (z : ℂ × (κ → ℂ)) (i : Option κ) : + optionProduct.symm z i = i.elim z.1 z.2 := by cases i <;> rfl + +@[simp] lemma pivot_symm (i : Fin (n+1)) : (pivotEquiv i).symm i = .inl () := + (pivotEquiv i).symm_apply_apply (.inl ()) +@[simp] lemma pivot_symm_succAbove (i : Fin (n+1)) (j : Fin n) : + (pivotEquiv i).symm (i.succAbove j) = .inr j := + (pivotEquiv i).symm_apply_apply (.inr j) + +noncomputable def norm (i : Fin (n+1)) (z : Fin n → ℂ) : Fin (n+1) → ℂ := + normalized z ∘ (pivotEquiv i).symm +@[simp] lemma norm_pivot (i : Fin (n+1)) (z : Fin n → ℂ) : norm i z i = 1 := by + change normalized z ((pivotEquiv i).symm (pivotEquiv i (.inl ()))) = 1 + simp [normalized] +@[simp] lemma norm_succAbove (i : Fin (n+1)) (z : Fin n → ℂ) (j : Fin n) : + norm i z (i.succAbove j) = z j := by + change normalized z ((pivotEquiv i).symm (pivotEquiv i (.inr j))) = z j + simp [normalized] + +noncomputable def chart (i r : Fin (n+1)) (z : ChartSpace κ n) : Variables κ n → ℂ := + coordinates (optionProduct.symm z.1) (norm i z.2.1) (norm r z.2.2) +noncomputable def base (i r : Fin (n+1)) : Groups → Variables κ n + | none => ⟨none,none⟩ + | some false => ⟨some false,i⟩ + | some true => ⟨some true,r⟩ +omit [Fintype κ] in +lemma base_group (i r : Fin (n+1)) (j : Groups) : (base (κ := κ) i r j).1 = j := by + rcases j with _ | (_ | _) <;> rfl +lemma chart_base (i r : Fin (n+1)) (z : ChartSpace κ n) (j : Groups) : + chart i r z (base i r j) = 1 := by + rcases j with _ | (_ | _) <;> simp [chart, coordinates, base] +lemma contDiff_chart (i r : Fin (n+1)) : ContDiff ℂ 1 (chart (κ := κ) i r) := by + apply contDiff_pi.mpr + rintro ⟨j,t⟩ + rcases j with _ | (_ | _) + · rcases t with _ | (_ | t) <;> simp [chart, coordinates] <;> fun_prop + · change ContDiff ℂ 1 (fun z : ChartSpace κ n => normalized z.2.1 ((pivotEquiv i).symm t)) + cases (pivotEquiv i).symm t <;> simp [normalized] <;> fun_prop + · change ContDiff ℂ 1 (fun z : ChartSpace κ n => normalized z.2.2 ((pivotEquiv r).symm t)) + cases (pivotEquiv r).symm t <;> simp [normalized] <;> fun_prop + +noncomputable def outputLinear (r : Fin (n+1)) : (Equations κ n → ℂ) ≃ₗ[ℂ] ChartSpace κ n where + toFun y := ((y (.inl r), fun k => y (.inr (.inr k))), + (fun j => y (.inl (r.succAbove j)), fun j => y (.inr (.inl j)))) + invFun z := Sum.elim + (fun i => ((pivotEquiv r).symm i).elim (fun _ => z.1.1) z.2.1) + (Sum.elim z.2.2 z.1.2) + left_inv y := by + funext i + rcases i with i | j | k + · obtain ⟨a,rfl⟩ := (pivotEquiv r).surjective i + rcases a with u | a + · cases u; simp + · simp + · rfl + · rfl + right_inv z := by + apply Prod.ext + · apply Prod.ext + · change ((pivotEquiv r).symm (pivotEquiv r (.inl ()))).elim _ _ = _ + simp + · rfl + · apply Prod.ext + · funext j + change ((pivotEquiv r).symm (pivotEquiv r (.inr j))).elim _ _ = _ + simp + · rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl +noncomputable def output (r : Fin (n+1)) : (Equations κ n → ℂ) ≃L[ℂ] ChartSpace κ n := + (outputLinear r).toContinuousLinearEquiv + +lemma chart_separated {i r s : Fin (n+1)} {x y : ChartSpace κ n} (h : x.1 ≠ y.1) : + Multigraded.BlockSeparated Sigma.fst (chart i r x) (chart i s y) := by + have he : optionProduct.symm x.1 ≠ optionProduct.symm y.1 := + fun e => h (optionProduct.symm.injective e) + obtain ⟨j,hj⟩ := Function.ne_iff.mp he + refine ⟨⟨none,none⟩,⟨none,some j⟩,rfl,?_⟩ + simpa [chart, coordinates] using hj.symm +end PermanentBorder.KernelBilinear + +namespace PermanentBorder.KernelBilinear +open MvPolynomial Matrix PolarAnalysis PolarAnalysis.Schur +open scoped Classical +variable {κ : Type} [Fintype κ] {n : ℕ} + +lemma sum_norm (i : Fin (n+1)) (f : Fin (n+1) → ℂ) (z : Fin n → ℂ) : + ∑ j, f j * norm i z j = f i + ∑ j, f (i.succAbove j) * z j := by + rw [Fin.sum_univ_succAbove _ i] + simp + +lemma polar_norm (i r : Fin (n+1)) (B : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (u v : Fin n → ℂ) : + (∑ a, ∑ b, B a b * norm i u b * norm r v a) = + normalized v ⬝ᵥ ((B.submatrix (pivotEquiv r) (pivotEquiv i)) *ᵥ normalized u) := by + simp only [mulVec, dotProduct] + symm + apply Fintype.sum_equiv (pivotEquiv r) + intro a + rw [Finset.mul_sum] + exact Fintype.sum_equiv (pivotEquiv i) _ _ (fun b => by + simp [norm, Matrix.submatrix_apply, mul_comm, mul_left_comm]) + +section Bridge +variable {T : Type*} [NormedAddCommGroup T] [NormedSpace ℂ T] + +lemma system_eq_matrixKernelSystem + (F : T → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (ψ : (ℂ × (κ → ℂ)) → T) (h : κ → T) + (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (B : κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (hlocal : ∀ z i j, A₀ i j + ∑ k, A k i j * optionProduct.symm z k = F (ψ z) i j) + (hdir : ∀ y k i j, fderiv ℂ (fun y => F y i j) y (h k) = B k i j) + (i r : Fin (n+1)) (z : ChartSpace κ n) : + output r (fun j => eval (chart i r z) (system A₀ A B i j)) = + matrixKernelSystem (fun y => (F y).submatrix (pivotEquiv r) (pivotEquiv i)) ψ h z := by + have hright (a : Fin (n+1)) : + eval (chart i r z) (rightEquation A₀ A a) = + F (ψ z.1) a i + ∑ j, F (ψ z.1) a (i.succAbove j) * z.2.1 j := by + change eval (coordinates _ _ _) _ = _ + rw [eval_right] + simp only [hlocal] + exact sum_norm i _ _ + have hleft (b : Fin (n+1)) : + eval (chart i r z) (leftEquation A₀ A b) = + F (ψ z.1) r b + ∑ a, z.2.2 a * F (ψ z.1) (r.succAbove a) b := by + change eval (coordinates _ _ _) _ = _ + rw [eval_left] + simp only [hlocal] + rw [sum_norm] + congr 1 + apply Finset.sum_congr rfl + intro a _ + exact mul_comm _ _ + have hpolar (k : κ) : + eval (chart i r z) (polarEquation (B k)) = + normalized z.2.2 ⬝ᵥ ((B k).submatrix (pivotEquiv r) (pivotEquiv i) *ᵥ normalized z.2.1) := by + change eval (coordinates _ _ _) _ = _ + rw [eval_polar, polar_norm] + have hdir' (k : κ) : + dirMatrix (fun y => (F y).submatrix (pivotEquiv r) (pivotEquiv i)) + (ψ z.1) (h k) = (B k).submatrix (pivotEquiv r) (pivotEquiv i) := by + ext a b + exact hdir _ _ _ _ + apply Prod.ext + · apply Prod.ext + · change eval (chart i r z) (rightEquation A₀ A r) = _ + rw [hright] + rfl + · funext k + change eval (chart i r z) (polarEquation (B k)) = _ + rw [hpolar] + change _ = normalized z.2.2 ⬝ᵥ (dirMatrix + (fun y => block ((F y).submatrix (pivotEquiv r) (pivotEquiv i) (.inl ()) (.inl ())) + (fun j => (F y).submatrix (pivotEquiv r) (pivotEquiv i) (.inl ()) (.inr j)) + (fun j => (F y).submatrix (pivotEquiv r) (pivotEquiv i) (.inr j) (.inl ())) + (((F y).submatrix (pivotEquiv r) (pivotEquiv i)).submatrix Sum.inr Sum.inr)) + (ψ z.1) (h k) *ᵥ normalized z.2.1) + have hb : (fun y => block ((F y).submatrix (pivotEquiv r) (pivotEquiv i) (.inl ()) (.inl ())) + (fun j => (F y).submatrix (pivotEquiv r) (pivotEquiv i) (.inl ()) (.inr j)) + (fun j => (F y).submatrix (pivotEquiv r) (pivotEquiv i) (.inr j) (.inl ())) + (((F y).submatrix (pivotEquiv r) (pivotEquiv i)).submatrix Sum.inr Sum.inr)) = + (fun y => (F y).submatrix (pivotEquiv r) (pivotEquiv i)) := by + funext y a b + cases a with + | inl u => cases u; cases b with + | inl v => cases v; rfl + | inr b => rfl + | inr a => cases b with + | inl v => cases v; rfl + | inr b => rfl + rw [hb, hdir'] + · apply Prod.ext + · funext j + change eval (chart i r z) (rightEquation A₀ A (r.succAbove j)) = _ + rw [hright] + rfl + · funext j + change eval (chart i r z) (leftEquation A₀ A (i.succAbove j)) = _ + rw [hleft] + rfl +end Bridge +end PermanentBorder.KernelBilinear + +namespace PermanentBorder.KernelBilinear +open MvPolynomial Matrix PolarAnalysis PolarAnalysis.Schur +open scoped Classical +variable {κ J : Type} [Fintype κ] [Fintype J] {n : ℕ} +variable {T : Type*} [NormedAddCommGroup T] [NormedSpace ℂ T] + +theorem selected_kernel_count + (F : T → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (ψ : (ℂ × (κ → ℂ)) → T) (h : κ → T) + (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (B : κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (hlocal : ∀ z i j, A₀ i j + ∑ k, A k i j * optionProduct.symm z k = F (ψ z) i j) + (hdir : ∀ y k i j, fderiv ℂ (fun y => F y i j) y (h k) = B k i j) + (i : Fin (n+1)) (r : J → Fin (n+1)) (x : J → ChartSpace κ n) + (hx : Function.Injective (fun j => (x j).1)) + (hz : ∀ j, matrixKernelSystem + (fun y => (F y).submatrix (pivotEquiv (r j)) (pivotEquiv i)) ψ h (x j) = 0) + (hs : ∀ j, (fderiv ℂ (matrixKernelSystem + (fun y => (F y).submatrix (pivotEquiv (r j)) (pivotEquiv i)) ψ h) (x j)).IsInvertible) : + Fintype.card J ≤ 2^Fintype.card κ * (2*n+1).choose (Fintype.card κ+1) := by + classical + have he (j : J) : + (fun z => output (r j) (fun a => eval (chart i (r j) z) (system A₀ A B i a))) = + matrixKernelSystem (fun y => (F y).submatrix (pivotEquiv (r j)) (pivotEquiv i)) ψ h := by + funext z + exact system_eq_matrixKernelSystem F ψ h A₀ A B hlocal hdir i (r j) z + have hz' (j : J) (a : Equations κ n) : eval (chart i (r j) (x j)) (system A₀ A B i a) = 0 := by + have hh : output (r j) (fun a => eval (chart i (r j) (x j)) (system A₀ A B i a)) = + output (r j) 0 := by + rw [map_zero, congrFun (he j) (x j)] + exact hz j + exact congrFun ((output (r j)).injective hh) a + have hc := Multigraded.bilinear_simple_point_count_reindex (dimensions κ n) + Sigma.fst variablesEquiv variablesEquiv_group firstGroup secondGroup card_equations + (system A₀ A B i) (system_homogeneous A₀ A B i) + (fun j => base i (r j)) (fun j => base_group i (r j)) + (fun j => output (r j)) (fun j => chart i (r j)) (fun j => contDiff_chart i (r j)) + (fun j z => chart_base i (r j) z) x + (fun j k hjk => chart_separated (fun hh => hjk (hx hh))) hz' + (fun j => by rw [he]; exact hs j) + exact hc.trans mixed_coefficient_bound +end PermanentBorder.KernelBilinear + +namespace PermanentBorder.KernelBilinear +open MvPolynomial Matrix PolarAnalysis PolarAnalysis.Schur +open scoped Classical +variable {σ κ J : Type} [Fintype σ] [Fintype κ] [Fintype J] {n : ℕ} + +noncomputable def affine (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : σ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (y : σ → ℂ) := + A₀ + ∑ v, y v • A v + +lemma affine_contDiff (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : σ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (i j : Fin (n+1)) : + ContDiff ℂ 2 (fun y => affine A₀ A y i j) := by + unfold affine + simp only [Matrix.add_apply, Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul] + fun_prop + +lemma affine_derivative (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : σ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (y h : σ → ℂ) (i j : Fin (n+1)) : + fderiv ℂ (fun y => affine A₀ A y i j) y h = ∑ v, h v * A v i j := by + let L : (σ → ℂ) →L[ℂ] ℂ := ∑ v, A v i j • ContinuousLinearMap.proj v + have he : (fun y => affine A₀ A y i j) = (fun y => A₀ i j + L y) := by + funext y + simp [affine,L,Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul,mul_comm] + have hd : HasFDerivAt (fun y => A₀ i j + L y) L y := by + exact HasFDerivAt.const_add (A₀ i j) L.hasFDerivAt + rw [he, hd.fderiv] + simp [L,mul_comm] + +lemma affine_right_mul (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : σ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (S : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (y : σ → ℂ) : + affine (A₀*S) (fun v => A v*S) y = affine A₀ A y * S := by + simp [affine, add_mul, Finset.sum_mul] + +theorem affine_polar_count + (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : σ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (b : σ → ℂ) (L : (Option κ → ℂ) →L[ℂ] (σ → ℂ)) (h : κ → σ → ℂ) + (x : J → ℂ × (κ → ℂ)) (hx : Function.Injective x) + (hz : ∀ j, polarPair (fun y => (affine A₀ A y).det) + (fun z => b + L (optionProduct.symm z)) h (x j) = 0) + (hs : ∀ j, (fderiv ℂ (polarPair (fun y => (affine A₀ A y).det) + (fun z => b + L (optionProduct.symm z)) h) (x j)).IsInvertible) : + Fintype.card J ≤ 2^Fintype.card κ * (2*n+1).choose (Fintype.card κ+1) := by + classical + let ψ := fun z : ℂ × (κ → ℂ) => b + L (optionProduct.symm z) + obtain ⟨S,hS,hr⟩ := finite_simple_polar_kernel_lifts (0 : Fin (n+1)) + (affine A₀ A) (affine_contDiff A₀ A) ψ h x + (fun _ => ((differentiable_const b).add (L.differentiable.comp optionProduct.symm.differentiable)).differentiableAt) + hz hs + choose r hr using hr + let A₀' := A₀*S + let A' := fun v => A v*S + let B₀ := affine A₀' A' b + let B := fun k => ∑ v, L (Pi.single k 1) v • A' v + let D := fun k => ∑ v, h k v • A' v + have hlocal (z : ℂ × (κ → ℂ)) (i j : Fin (n+1)) : + B₀ i j + ∑ k, B k i j * optionProduct.symm z k = affine A₀' A' (ψ z) i j := by + have hexp : optionProduct.symm z = ∑ k, optionProduct.symm z k • Pi.single k 1 := by + ext k + simp [Pi.single_apply] + have hLe (v : σ) : L (optionProduct.symm z) v = + ∑ k, optionProduct.symm z k * L (Pi.single k 1) v := by + conv_lhs => rw [hexp, map_sum] + simp + simp only [B₀, B, affine, ψ, Matrix.add_apply, Matrix.sum_apply, Matrix.smul_apply, + smul_eq_mul, Pi.add_apply, hLe, add_mul, Finset.sum_add_distrib, Finset.sum_mul] + rw [Finset.sum_comm, ← add_assoc] + congr 1 + apply Finset.sum_congr rfl + intro v _ + apply Finset.sum_congr rfl + intro k _ + ring + have hd (y : σ → ℂ) (k : κ) (i j : Fin (n+1)) : + fderiv ℂ (fun y => affine A₀' A' y i j) y (h k) = D k i j := by + rw [affine_derivative] + simp [D,Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] + let X := fun j => matrixKernelPoint + (fun y => (affine A₀' A' y).submatrix (pivotEquiv (r j)) (pivotEquiv (0 : Fin (n+1)))) ψ (x j) + apply selected_kernel_count (affine A₀' A') ψ h B₀ B D hlocal hd 0 r X + · exact hx + · intro j + simpa only [X, A₀', A', affine_right_mul] using (hr j).1 + · intro j + simpa only [X, A₀', A', affine_right_mul] using (hr j).2 +end PermanentBorder.KernelBilinear + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/BorderClosure.lean b/lean/OAI/Algebra/Determinantal/BorderClosure.lean new file mode 100644 index 0000000000000000000000000000000000000000..9785bf11a2a3390aa7a5e15cc2df762a619859bc --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/BorderClosure.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Determinantal.Model +import Mathlib.Data.Finsupp.Encodable + +namespace OAI + +namespace PermanentBorder + +open Filter +open scoped Topology + +/-- Fixed-size border representations are closed under sequential coefficientwise +limits. The approximating matrices remain arbitrary complex affine matrices of +exactly the original size; no uniform rate or coefficient bound is assumed. -/ +theorem HasBorderDeterminant.coefficientwise_limit + {σ : Type*} [Fintype σ] {n : ℕ} {P : ℕ → Poly σ} {p : Poly σ} + (hP : ∀ j, HasBorderDeterminant n (P j)) + (hp : ∀ d : σ →₀ ℕ, + Tendsto (fun j => (P j).coeff d) atTop (𝓝 (p.coeff d))) : + HasBorderDeterminant n p := by + classical + let Coeff := (σ →₀ ℕ) → ℂ + let MatData := Matrix (Fin n) (Fin n) ℂ × + (σ → Matrix (Fin n) (Fin n) ℂ) + let coefficients : MatData → Coeff := fun B d => + (affineMatrixPolynomial n B.1 B.2).coeff d + let S : Set Coeff := Set.range coefficients + have hmem : ∀ j, (fun d => (P j).coeff d) ∈ closure S := by + intro j + obtain ⟨_, A₀, A, hA⟩ := hP j + apply mem_closure_iff_seq_limit.mpr + refine ⟨fun k => coefficients (A₀ k, A k), ?_, ?_⟩ + · intro k + exact ⟨(A₀ k, A k), rfl⟩ + · exact tendsto_pi_nhds.mpr hA + have hclosed : (fun d => p.coeff d) ∈ closure S := + isClosed_closure.mem_of_tendsto (tendsto_pi_nhds.mpr hp) + (Filter.Eventually.of_forall hmem) + obtain ⟨Q, hQ, hlim⟩ := mem_closure_iff_seq_limit.mp hclosed + have hchoose : ∀ j, ∃ B : MatData, coefficients B = Q j := hQ + choose B hB using hchoose + refine ⟨(hP 0).1, (fun j => (B j).1), (fun j => (B j).2), ?_⟩ + intro d + have he : + (fun j => (affineMatrixPolynomial n (B j).1 (B j).2).coeff d) = + (fun j => Q j d) := by + funext j + exact congrFun (hB j) d + rw [he] + exact tendsto_pi_nhds.mp hlim d + +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/BorderPolars.lean b/lean/OAI/Algebra/Determinantal/BorderPolars.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3603901d645162413b2123cd26aebe5d5f8ac82 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/BorderPolars.lean @@ -0,0 +1,418 @@ +import OAI.Algebra.Determinantal.Model + +namespace OAI + +namespace PermanentBorder.PolarAnalysis +open MvPolynomial Filter +open scoped Topology + +section PolynomialSystem +variable {σ τ : Type*} [Fintype σ] [Fintype τ] + +noncomputable def polynomialSystem (L : τ → Poly σ →ₗ[ℂ] Poly τ) + (P : Poly σ) (x : τ → ℂ) : τ → ℂ := fun i => MvPolynomial.eval x (L i P) + +noncomputable def coefficientSystem (n : ℕ) (L : τ → Poly σ →ₗ[ℂ] Poly τ) + (u : ((exponentCube (σ := σ) n) → ℂ) × (τ → ℂ)) : τ → ℂ := + fun i => ∑ d : exponentCube (σ := σ) n, + u.1 d * MvPolynomial.eval u.2 (L i (monomial d.val 1)) + +theorem contDiff_coefficientSystem (n : ℕ) (L : τ → Poly σ →ₗ[ℂ] Poly τ) : + ContDiff ℂ 1 (coefficientSystem n L) := by + classical + apply contDiff_pi.mpr + intro i + apply ContDiff.sum + intro d _ + exact ((contDiff_apply ℂ ℂ d).comp contDiff_fst).mul + ((contDiff_mvPolynomial_eval _).comp contDiff_snd) + +omit [Fintype τ] in +theorem coefficientSystem_eq {n : ℕ} (L : τ → Poly σ →ₗ[ℂ] Poly τ) + {P : Poly σ} (hP : P.support ⊆ exponentCube n) (x : τ → ℂ) : + coefficientSystem n L ((fun d => P.coeff d.val),x) = polynomialSystem L P x := by + classical + ext i + change (∑ d : exponentCube n, P.coeff d.val * eval x (L i (monomial d.val 1))) = _ + change _ = eval x (L i P) + conv_rhs => rw [sum_over_exponentCube hP] + simp only [map_sum] + conv_rhs => rw [← Finset.sum_coe_sort] + apply Finset.sum_congr rfl + intro d _ + rw [show monomial d.val (P.coeff d.val) = P.coeff d.val • monomial d.val (1 : ℂ) by + simp [smul_monomial], map_smul] + simp + +def SimplePolynomialZero (L : τ → Poly σ →ₗ[ℂ] Poly τ) (P : Poly σ) (x : τ → ℂ) := + polynomialSystem L P x = 0 ∧ (fderiv ℂ (polynomialSystem L P) x).IsInvertible + +theorem coefficient_limit_simple_zeros {ι : Type*} [Fintype ι] + (L : τ → Poly σ →ₗ[ℂ] Poly τ) {P : ℕ → Poly σ} {p : Poly σ} {n : ℕ} + (hP : ∀ j, (P j).support ⊆ exponentCube n) + (hp : ∀ d, Tendsto (fun j => (P j).coeff d) atTop (𝓝 (p.coeff d))) + (x : ι → τ → ℂ) (hx : Function.Injective x) + (hs : ∀ i, SimplePolynomialZero L p (x i)) : + ∀ᶠ j in atTop, ∃ y : ι → τ → ℂ, Function.Injective y ∧ + ∀ i, SimplePolynomialZero L (P j) (y i) := by + classical + let c : exponentCube (σ := σ) n → ℂ := fun d => p.coeff d.val + let cs : ℕ → exponentCube (σ := σ) n → ℂ := fun j d => (P j).coeff d.val + have hc : Tendsto cs atTop (𝓝 c) := tendsto_pi_nhds.mpr fun d => hp d.val + let F := coefficientSystem n L + have hF : ContDiff ℂ 1 F := contDiff_coefficientSystem n L + have hp' := support_subset_cube_of_limit hP hp + have he : (fun x => F (c,x)) = polynomialSystem L p := by + funext x + exact coefficientSystem_eq L hp' x + have hz : ∀ i, F (c,x i) = 0 := by + intro i + rw [congrFun he] + exact (hs i).1 + have hs' : ∀ i, SimpleAt F c (x i) := by + intro i + unfold SimpleAt + rw [← fderiv_slice hF, he] + exact (hs i).2 + have ht := finite_simple_zeros_persist hF x hx hz hs' + filter_upwards [hc.eventually ht] with j hj + obtain ⟨y,hy,hys⟩ := hj + refine ⟨y,hy,?_⟩ + intro i + have he' : (fun x => F (cs j,x)) = polynomialSystem L (P j) := by + funext x + exact coefficientSystem_eq L (hP j) x + constructor + · rw [← congrFun he'] + exact (hys i).1 + · rw [← he', fderiv_slice hF] + exact (hys i).2 + +theorem HasBorderDeterminant.exists_simple_approximant {ι : Type*} [Fintype ι] + {p : Poly σ} {n : ℕ} (h : HasBorderDeterminant n p) + (L : τ → Poly σ →ₗ[ℂ] Poly τ) (x : ι → τ → ℂ) + (hx : Function.Injective x) (hs : ∀ i, SimplePolynomialZero L p (x i)) : + ∃ (A₀ : Matrix (Fin n) (Fin n) ℂ) (A : σ → Matrix (Fin n) (Fin n) ℂ) + (y : ι → τ → ℂ), Function.Injective y ∧ + ∀ i, SimplePolynomialZero L (affineMatrixPolynomial n A₀ A) (y i) := by + obtain ⟨hn,A₀,A,hlim⟩ := h + obtain ⟨j,y,hy,hys⟩ := (coefficient_limit_simple_zeros L + (fun j => support_subset_exponentCube (degree_affineMatrixPolynomial n (A₀ j) (A j))) + hlim x hx hs).exists + exact ⟨A₀ j,A j,y,hy,hys⟩ +end PolynomialSystem +end PermanentBorder.PolarAnalysis +namespace PermanentBorder.Polar +open MvPolynomial +open scoped Classical +variable {τ : Type*} [Fintype τ] + +noncomputable def affineChartSubstitution + (e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ)) : + Poly (PolarVars τ) →ₐ[ℂ] Poly (Option τ) := + affineSubstitution (fun j => e.symm (Pi.single none 1) j) + (fun j i => e.symm (Pi.single (some i) 1) j) + +lemma eval_affineChartSubstitution + (e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ)) + (f : Poly (PolarVars τ)) (z : Option τ → ℂ) : + eval z (affineChartSubstitution e f) = eval (affineNormChart e z) f := by + change (aeval z : Poly (Option τ) →ₐ[ℂ] ℂ) (aeval _ f) = _ + rw [comp_aeval_apply] + apply congrArg (fun g : PolarVars τ → ℂ => aeval g f) + funext j + simp only [map_add, map_sum, map_mul, aeval_C, aeval_X, Algebra.algebraMap_self_apply] + convert (affineNormChart_eq e z j).symm using 1 + congr 1 + apply Finset.sum_congr rfl + intro i _ + congr 2 + apply congrArg (fun v : PolarVars τ → ℂ => e.symm v j) + funext v + simp [Pi.single_apply] + +noncomputable def polarOperator (w : τ → PolarVars τ → ℂ) (i : τ) : + Poly (PolarVars τ) →ₗ[ℂ] Poly (PolarVars τ) := + ∑ j, w i j • (pderiv j).toLinearMap + +lemma polarOperator_eq (w : τ → PolarVars τ → ℂ) (i : τ) (f : Poly (PolarVars τ)) : + polarOperator w i f = polarPolynomial w f i := by + simp [polarOperator, polarPolynomial, smul_eq_C_mul] + +noncomputable def affinePolarOperators (w : τ → PolarVars τ → ℂ) + (e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ)) : + Option τ → Poly (PolarVars τ) →ₗ[ℂ] Poly (Option τ) := + Option.elim' (affineChartSubstitution e).toLinearMap + (fun i => (affineChartSubstitution e).toLinearMap.comp (polarOperator w i)) + +lemma polynomialSystem_affinePolarOperators (w : τ → PolarVars τ → ℂ) + (e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ)) (f : Poly (PolarVars τ)) : + PolarAnalysis.polynomialSystem (affinePolarOperators w e) f = + fun z j => eval (affineNormChart e z) (hypersurfacePolars w f j) := by + funext z j + cases j with + | none => exact eval_affineChartSubstitution e f z + | some i => + change eval z (affineChartSubstitution e (polarOperator w i f)) = _ + rw [eval_affineChartSubstitution, polarOperator_eq] + rfl + +theorem HasBorderDeterminant.simple_polar_approximant {n r : ℕ} + {f : Poly (PolarVars τ)} (hb : HasBorderDeterminant n f) + (hr : 2 ≤ r) (hh : f.IsHomogeneous r) + (hs : ∀ y : PolarVars τ → ℂ, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) : + ∃ w : τ → PolarVars τ → ℂ, + ∃ e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ), + ∃ (A₀ : Matrix (Fin n) (Fin n) ℂ) (A : PolarVars τ → Matrix (Fin n) (Fin n) ℂ), + ∃ x : Fin (r * (r-1)^Fintype.card τ) → Option τ → ℂ, + Function.Injective x ∧ ∀ i, + PolarAnalysis.SimplePolynomialZero (affinePolarOperators w e) + (affineMatrixPolynomial n A₀ A) (x i) := by + obtain ⟨w,e,x,hx,hsx⟩ := smooth_polar_affine_certificate f hr hh hs + have hp (i) : PolarAnalysis.SimplePolynomialZero (affinePolarOperators w e) f (x i) := by + unfold PolarAnalysis.SimplePolynomialZero + rw [polynomialSystem_affinePolarOperators] + exact hsx i + obtain ⟨A₀,A,y,hy,hys⟩ := PolarAnalysis.HasBorderDeterminant.exists_simple_approximant + hb (affinePolarOperators w e) x hx hp + exact ⟨w,e,A₀,A,y,hy,hys⟩ +end PermanentBorder.Polar + +namespace PermanentBorder.Polar +open MvPolynomial Matrix PolarAnalysis KernelBilinear +open scoped Classical +variable {τ : Type} [Fintype τ] + +lemma derivative_polar (w : τ → PolarVars τ → ℂ) (f : Poly (PolarVars τ)) + (y : PolarVars τ → ℂ) (i : τ) : + fderiv ℂ (fun y => eval y f) y (w i) = eval y (polarPolynomial w f i) := by + rw [(CI.hasFDerivAt_eval f y).fderiv, CI.polynomialDerivative_apply] + simp [polarPolynomial,mul_comm] + +lemma polarPair_polynomialSystem (w : τ → PolarVars τ → ℂ) + (e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ)) (f : Poly (PolarVars τ)) : + polarPair (fun y => eval y f) (fun z => affineNormChart e (optionProduct.symm z)) w = + fun z => optionProduct (polynomialSystem (affinePolarOperators w e) f (optionProduct.symm z)) := by + funext z + rw [polynomialSystem_affinePolarOperators] + apply Prod.ext + · rfl + · funext i + exact derivative_polar w f _ i + +omit [Fintype τ] in +lemma affineNormChart_add (e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ)) + (z : Option τ → ℂ) : + affineNormChart e z = e.symm (Pi.single none 1) + + (e.symm.toContinuousLinearMap.comp optionInsert) z := by + change e.symm (Option.elim' 1 z) = e.symm (Pi.single none 1) + e.symm (optionInsert z) + rw [← map_add] + apply congrArg e.symm + funext j + cases j <;> simp + +lemma eval_matrix {σ : Type} [Fintype σ] {n : ℕ} + (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : σ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (y : σ → ℂ) : + eval y (affineMatrixPolynomial (n+1) A₀ A) = (affine A₀ A y).det := by + classical + let M : Matrix (Fin (n+1)) (Fin (n+1)) (Poly σ) := + fun i j => C (A₀ i j) + ∑ v, C (A v i j) * X v + change eval y M.det = _ + calc + eval y M.det = ((eval y).mapMatrix M).det := RingHom.map_det (eval y) M + _ = (affine A₀ A y).det := by + apply congrArg Matrix.det + ext i j + change eval y (M i j) = (affine A₀ A y) i j + simp [M,affine,Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul,mul_comm] + +lemma simple_conjugate {V W : Type*} + [NormedAddCommGroup V] [NormedSpace ℂ V] + [NormedAddCommGroup W] [NormedSpace ℂ W] + (e : V ≃L[ℂ] W) {F : V → V} {x : V} (hF : DifferentiableAt ℂ F x) + (hs : (fderiv ℂ F x).IsInvertible) : + (fderiv ℂ (fun y => e (F (e.symm y))) (e x)).IsInvertible := by + have hF' : HasFDerivAt F (fderiv ℂ F x) (e.symm (e x)) := by simpa using hF.hasFDerivAt + have hd := e.hasFDerivAt.comp (e x) + (hF'.comp (e x) e.symm.hasFDerivAt) + change (fderiv ℂ (e ∘ F ∘ e.symm) (e x)).IsInvertible + rw [hd.fderiv] + exact (show e.toContinuousLinearMap.IsInvertible from ⟨e,rfl⟩).comp + (hs.comp (show e.symm.toContinuousLinearMap.IsInvertible from ⟨e.symm,rfl⟩)) + +theorem HasBorderDeterminant.polar_count {n r : ℕ} + {f : Poly (PolarVars τ)} (hb : HasBorderDeterminant n f) + (hr : 2 ≤ r) (hh : f.IsHomogeneous r) + (hs : ∀ y : PolarVars τ → ℂ, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) : + r * (r-1)^Fintype.card τ ≤ + 2^Fintype.card τ * (2*n-1).choose (Fintype.card τ+1) := by + classical + cases n with + | zero => exact False.elim (Nat.not_lt_zero _ hb.1) + | succ n => + obtain ⟨w,e,A₀,A,x,hx,hxs⟩ := HasBorderDeterminant.simple_polar_approximant hb hr hh hs + let P := affineMatrixPolynomial (n+1) A₀ A + let Q := polynomialSystem (affinePolarOperators w e) P + let b := e.symm (Pi.single none 1) + let L := e.symm.toContinuousLinearMap.comp optionInsert + have hrel : polarPair (fun y => (affine A₀ A y).det) + (fun z => b + L (optionProduct.symm z)) w = + fun z => optionProduct (Q (optionProduct.symm z)) := by + have heval : (fun y => (affine A₀ A y).det) = (fun y => eval y P) := by + funext y + exact (eval_matrix A₀ A y).symm + have hψ : (fun z => b + L (optionProduct.symm z)) = + (fun z => affineNormChart e (optionProduct.symm z)) := by + funext z + exact (affineNormChart_add e _).symm + rw [heval,hψ] + exact polarPair_polynomialSystem w e P + have hQ (z : Option τ → ℂ) : DifferentiableAt ℂ Q z := by + apply differentiableAt_pi.mpr + intro j + exact ((contDiff_mvPolynomial_eval ((affinePolarOperators w e j) P)).differentiable (by decide)).differentiableAt + have hcount := affine_polar_count A₀ A b L w (fun j => optionProduct (x j)) + (optionProduct.injective.comp hx) + (fun j => by + rw [hrel] + change optionProduct (Q (optionProduct.symm (optionProduct (x j)))) = 0 + rw [optionProduct.symm_apply_apply] + have hz : Q (x j) = 0 := (hxs j).1 + rw [hz, map_zero]) + (fun j => by + rw [hrel] + exact simple_conjugate optionProduct (hQ (x j)) (hxs j).2) + have hn : 2*(n+1)-1 = 2*n+1 := by omega + simpa [hn] using hcount +end PermanentBorder.Polar + +namespace PermanentBorder.Polar + + theorem factorial_exp_lower (b : ℕ) : ((b : ℝ) / Real.exp 1)^b ≤ b.factorial := by + rcases b with _ | b + · simp + have hb : (1:ℝ) ≤ b+1 := by linarith [Nat.cast_nonneg (α := ℝ) b] + have hπ : (1:ℝ) ≤ Real.pi := le_trans (by norm_num) Real.two_le_pi + have hs : 1 ≤ Real.sqrt (2 * Real.pi * (b+1)) := by + rw [Real.le_sqrt (by positivity) (by positivity)] + nlinarith + have hn := Stirling.le_factorial_stirling (b+1) + simp only [Nat.cast_add, Nat.cast_one] at hn ⊢ + exact le_trans (le_mul_of_one_le_left (by positivity) hs) hn + + theorem choose_exp_bound (a b : ℕ) (hb : 0 < b) : + (a.choose b : ℝ) ≤ (Real.exp 1 * a / b)^b := by + have hbR : (0:ℝ) < b := by exact_mod_cast hb + have hfact := factorial_exp_lower b + have hx : (0:ℝ) < ((b:ℝ)/Real.exp 1)^b := by positivity + calc + (a.choose b : ℝ) ≤ (a:ℝ)^b / b.factorial := Nat.choose_le_pow_div b a + _ ≤ (a:ℝ)^b / ((b:ℝ)/Real.exp 1)^b := + div_le_div_of_nonneg_left (by positivity) hx hfact + _ = (Real.exp 1 * a / b)^b := by rw [← div_pow]; congr 1; field_simp + + theorem smooth_count_numerical_bound (n K r : ℕ) (hn : 0 < n) (hr : 2 ≤ r) + (hcount : (r:ℝ) * ((r-1:ℕ):ℝ)^K ≤ + 2^K * ((2*n-1).choose (K+1) : ℝ)) : + ((r-1:ℕ):ℝ) * (K+1) / (4 * Real.exp 1) ≤ n := by + have hr0 : (0:ℝ) < (r-1:ℕ) := by exact_mod_cast (show 0 < r-1 by omega) + have hrle : ((r-1:ℕ):ℝ) ≤ r := by exact_mod_cast Nat.sub_le r 1 + have hn0 : (0:ℝ) < n := by exact_mod_cast hn + have hK : (0:ℝ) < K+1 := by positivity + have hchoose := choose_exp_bound (2*n-1) (K+1) (by omega) + have htwo : ((2*n-1:ℕ):ℝ) ≤ 2*n := by + exact_mod_cast (Nat.sub_le (2*n) 1) + have hbase : Real.exp 1 * ((2*n-1:ℕ):ℝ) / ((K+1:ℕ):ℝ) ≤ + (2 * Real.exp 1 * n) / (K+1) := by + simp only [Nat.cast_add, Nat.cast_one] + apply div_le_div_of_nonneg_right _ (by positivity) + nlinarith [Real.exp_pos (1:ℝ)] + have hpow : (((r-1:ℕ):ℝ))^(K+1) ≤ (4 * Real.exp 1 * n / (K+1))^(K+1) := by + calc + (((r-1:ℕ):ℝ))^(K+1) ≤ (r:ℝ) * ((r-1:ℕ):ℝ)^K := by + rw [pow_succ, mul_comm] + exact mul_le_mul_of_nonneg_right hrle (by positivity) + _ ≤ 2^K * ((2*n-1).choose (K+1) : ℝ) := hcount + _ ≤ 2^K * (Real.exp 1 * ((2*n-1:ℕ):ℝ) / ((K+1:ℕ):ℝ))^(K+1) := + mul_le_mul_of_nonneg_left hchoose (by positivity) + _ ≤ 2^(K+1) * ((2 * Real.exp 1 * n) / (K+1))^(K+1) := by + apply mul_le_mul + · have : (2:ℝ)^K ≤ 2^(K+1) := by rw [pow_succ]; nlinarith [pow_pos (by norm_num : (0:ℝ)<2) K] + exact this + · exact pow_le_pow_left₀ (by positivity) hbase _ + · positivity + · positivity + _ = (4 * Real.exp 1 * n / (K+1))^(K+1) := by + rw [← mul_pow]; congr 1; ring + have hle : ((r-1:ℕ):ℝ) ≤ 4 * Real.exp 1 * n / (K+1) := + (pow_le_pow_iff_left₀ (by positivity) (by positivity) (by omega : K+1 ≠ 0)).mp hpow + apply (div_le_iff₀ (by positivity)).mpr + have := (le_div_iff₀ hK).mp hle + nlinarith + +end PermanentBorder.Polar + +namespace PermanentBorder +open MvPolynomial +open scoped Classical + +theorem HasBorderDeterminant.rename {σ τ : Type*} [Fintype σ] [Fintype τ] + {n : ℕ} {f : Poly σ} (h : HasBorderDeterminant n f) (e : σ → τ) : + HasBorderDeterminant n (MvPolynomial.rename e f) := by + classical + let B : σ → τ → ℂ := fun i j => if e i = j then 1 else 0 + have he : PermanentBorder.affineSubstitution (fun _ : σ => 0) B = (MvPolynomial.rename e : Poly σ →ₐ[ℂ] Poly τ) := by + apply MvPolynomial.algHom_ext + intro i + simp [PermanentBorder.affineSubstitution,B,eq_comm] + simpa only [he] using h.affineSubstitution (fun _ => 0) B + +namespace Polar + +lemma smooth_rename {σ τ : Type} [Fintype σ] [Fintype τ] + (e : σ ≃ τ) (f : Poly σ) + (hs : ∀ y : σ → ℂ, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) : + ∀ y : τ → ℂ, eval y (rename e f) = 0 → + (∀ j, eval y (pderiv j (rename e f)) = 0) → y = 0 := by + intro y hy hg + rw [eval_rename] at hy + have hgrad (i : σ) : eval (y ∘ e) (pderiv i f) = 0 := by + have h := hg (e i) + rw [pderiv_rename e.injective,eval_rename] at h + exact h + have hz := hs _ hy hgrad + funext i + simpa only [Function.comp_apply,e.apply_symm_apply,Pi.zero_apply] using congrFun hz (e.symm i) + +theorem HasBorderDeterminant.smooth_lower_bound {σ : Type} [Fintype σ] + {n r : ℕ} {f : Poly σ} (hb : HasBorderDeterminant n f) + (hσ : 2 ≤ Fintype.card σ) (hr : 2 ≤ r) (hh : f.IsHomogeneous r) + (hs : ∀ y : σ → ℂ, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) : + ((r-1 : ℕ) : ℝ) * ((Fintype.card σ-1 : ℕ) : ℝ) / (4*Real.exp 1) ≤ n := by + classical + let K := Fintype.card σ - 2 + have hc : Fintype.card σ = Fintype.card (PolarVars (Fin K)) := by + simp only [PolarVars,Fintype.card_option,Fintype.card_fin] + dsimp [K] + omega + let e := Fintype.equivOfCardEq hc + have hb' := hb.rename e + have hp := HasBorderDeterminant.polar_count hb' hr (hh.rename_isHomogeneous) + (smooth_rename e f hs) + have hcount : (r : ℝ) * ((r-1 : ℕ) : ℝ)^K ≤ + 2^K * ((2*n-1).choose (K+1) : ℝ) := by + simp only [Fintype.card_fin] at hp + exact_mod_cast hp + have h := smooth_count_numerical_bound n K r hb.1 hr hcount + have hk : K+1 = Fintype.card σ-1 := by dsimp [K]; omega + have hkR : (K : ℝ)+1 = ((Fintype.card σ-1 : ℕ) : ℝ) := by exact_mod_cast hk + simpa only [hkR] using h +end Polar +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/BranchConductor.lean b/lean/OAI/Algebra/Determinantal/BranchConductor.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7c1f02b8a9607fed75a10ef41dc8e12a7b6c956 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/BranchConductor.lean @@ -0,0 +1,472 @@ +import OAI.Algebra.Determinantal.LocalDerivations + +namespace OAI +namespace PermanentBorder.ReducedBranchConductor +open Polynomial + +section Ideal +variable {S : Type*} [CommRing S] +noncomputable def gradientIdeal (f b c d : S[X]) (x : S) : Ideal S[X] := + Ideal.span {f, b^2+X*d^2,c^2+C x*d^2} +noncomputable def enlargedGradientIdeal (f b c d : S[X]) (x : S) : Ideal S[X] := + gradientIdeal f b c d x ⊔ Ideal.span {d^2} * (gradientIdeal f b c d x).radical + +variable {B : Type*} [CommRing B] [Algebra S B] +lemma map_enlarged_le (f b c d : S[X]) (x : S) (y : B) (J : Ideal B) + (hf : aeval y f = 0) + (hb : aeval y (b^2+X*d^2) ∈ J) + (hc : aeval y (c^2+C x*d^2) ∈ J) + (hr : ∀ z ∈ (Ideal.span {aeval y (b^2+X*d^2),aeval y (c^2+C x*d^2)}).radical, + (aeval y d)^2*z ∈ J) : + enlargedGradientIdeal f b c d x ≤ Ideal.comap (aeval y) J := by + let H : Ideal B := Ideal.span {aeval y (b^2+X*d^2),aeval y (c^2+C x*d^2)} + have hi : gradientIdeal f b c d x ≤ Ideal.comap (aeval y) H := by + apply Ideal.span_le.mpr + intro z hz + simp only [Set.mem_insert_iff,Set.mem_singleton_iff] at hz + rcases hz with hz|hz|hz + · rw [hz] + change aeval y f ∈ H + rw [hf]; exact H.zero_mem + · rw [hz]; exact Ideal.subset_span (by simp) + · rw [hz]; exact Ideal.subset_span (by simp) + have hir : (gradientIdeal f b c d x).radical ≤ Ideal.comap (aeval y) H.radical := by + rw [Ideal.comap_radical] + exact Ideal.radical_mono hi + apply sup_le + · apply Ideal.span_le.mpr + intro z hz + simp only [Set.mem_insert_iff,Set.mem_singleton_iff] at hz + rcases hz with hz|hz|hz + · rw [hz] + change aeval y f ∈ J + rw [hf]; exact J.zero_mem + · rw [hz]; exact hb + · rw [hz]; exact hc + · rw [Ideal.span_singleton_mul_le_iff] + intro z hz + change aeval y (d^2*z) ∈ J + rw [map_mul,map_pow] + exact hr _ (hir hz) +end Ideal + +section Field +variable {Q : Type*} [Field Q] +lemma root_generates (p : Q[X]) : Algebra.adjoin Q {AdjoinRoot.root p} = ⊤ := by + rw [Algebra.adjoin_singleton_eq_range_aeval,AlgHom.range_eq_top] + intro z + obtain ⟨q,hq⟩ := AdjoinRoot.mk_surjective z + exact ⟨q,by rw [AdjoinRoot.aeval_eq]; exact hq⟩ + +lemma root_separable (p : Q[X]) [Fact (Irreducible p)] (hsep : p.Separable) : + Algebra.IsSeparable Q (AdjoinRoot p) := by + have hp0 : p ≠ 0 := (Fact.out : Irreducible p).ne_zero + have hr : IsSeparable Q (AdjoinRoot.root p) := hsep.of_dvd + (minpoly.dvd Q _ (AdjoinRoot.eval₂_root p)) + have hl : Algebra.adjoin Q {AdjoinRoot.root p} ≤ (separableClosure Q (AdjoinRoot p)).toSubalgebra := + Algebra.adjoin_le (by intro z hz; obtain rfl := Set.mem_singleton_iff.mp hz; exact hr) + rw [root_generates] at hl + exact ⟨fun z => hl (show z ∈ (⊤ : Subalgebra Q (AdjoinRoot p)) from trivial)⟩ +end Field + +section Realization +variable {K S Q : Type*} [CommRing K] [CommRing S] [IsDomain S] + [IsPrincipalIdealRing S] [IsLocalRing S] [IsAlgClosed (IsLocalRing.ResidueField S)] + [Algebra K S] [CharP S 2] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + +include K in + +theorem irreducible_realization (δ : Derivation K S S) (x : S) (hx : δ x=1) + (f p w a b c d : S[X]) (hp : p.Monic) + (hir : Irreducible (p.map (algebraMap S Q))) + (hfactor : f=p*w) (hsep : (f.map (algebraMap S Q)).Separable) + (hsq : f=a^2+C x*b^2+X*c^2+C x*X*d^2) + (hder : f.derivative=c^2+C x*d^2) + (z : S[X]) (hz : z ∈ enlargedGradientIdeal f b c d x) + (t : AdjoinRoot (p.map (algebraMap S Q))) (ht : IsIntegral S t) : + ∃ q : S[X], AdjoinRoot.mk (p.map (algebraMap S Q)) ((w*q).map (algebraMap S Q)) = + AdjoinRoot.mk (p.map (algebraMap S Q)) (z.map (algebraMap S Q))*t := by + let pg := p.map (algebraMap S Q) + let : Fact (Irreducible pg) := ⟨hir⟩ + let L := AdjoinRoot pg + let B := integralClosure S L + let : Algebra K B := Algebra.compHom B (algebraMap K S) + let : IsScalarTower K S B := IsScalarTower.of_algebraMap_eq' rfl + have hps : pg.Separable := hsep.of_dvd (Polynomial.map_dvd _ (hfactor ▸ dvd_mul_right p w)) + let : Algebra.IsSeparable Q L := root_separable pg hps + let : FiniteDimensional Q L := (AdjoinRoot.powerBasis hir.ne_zero).finite + let : IsDedekindDomain B := integralClosure.isDedekindDomain S Q L + let : Module.Finite S B := IsIntegralClosure.finite S Q L B + let : IsPrincipalIdealRing B := Conductor.integralClosure_isPrincipalIdealRing (S := S) (Q := Q) (L := L) + have hsL : Function.Injective (algebraMap S L) := by + rw [IsScalarTower.algebraMap_eq S Q L] + exact (algebraMap Q L).injective.comp (IsFractionRing.injective S Q) + have hsB : Function.Injective (algebraMap S B) := by + intro a b h + apply hsL + simpa only [IsScalarTower.algebraMap_apply S B L] using congrArg (algebraMap B L) h + let : CharP B 2 := charP_of_injective_algebraMap hsB 2 + let : Module.IsTorsionFree S B := (Module.isTorsionFree_iff_algebraMap_injective).mpr hsB + have hyi : IsIntegral S (AdjoinRoot.root pg) := ⟨p,hp,by + change aeval (AdjoinRoot.root pg) p = 0 + rw [AdjoinRoot.aeval_eq_of_algebra] + exact AdjoinRoot.mk_self⟩ + let y : B := IsIntegralClosure.mk' B (AdjoinRoot.root pg) hyi + have hy : algebraMap B L y = AdjoinRoot.root pg := IsIntegralClosure.algebraMap_mk' B _ hyi + have hyint : IsIntegral S y := IsIntegralClosure.isIntegral S L y + have hmin : minpoly S y = p := by + apply Polynomial.map_injective _ (IsFractionRing.injective S Q) + rw [← minpoly.isIntegrallyClosed_eq_field_fractions Q L hyint,hy, + AdjoinRoot.minpoly_root hir.ne_zero,(hp.map _).leadingCoeff,inv_one,C_1,mul_one] + have hygen : Algebra.adjoin Q {algebraMap B L y} = ⊤ := by rw [hy]; exact root_generates pg + have hfy : aeval y f = 0 := by rw [hfactor,← hmin,map_mul,minpoly.aeval,zero_mul] + have hsq' : (aeval y a)^2+algebraMap S B x*(aeval y b)^2+y*(aeval y c)^2+ + algebraMap S B x*y*(aeval y d)^2=0 := by + simpa only [hsq,map_add,map_mul,map_pow,aeval_C,aeval_X] using hfy + obtain ⟨hb,hc,hr⟩ := branch_conductor (Q := Q) (L := L) δ x hx y + (aeval y a) (aeval y b) (aeval y c) (aeval y d) f w hygen + (by rw [hmin]; exact hfactor) hsep (by simp only [hder,map_add,map_mul,map_pow,aeval_C]) hsq' + have hm : aeval y z ∈ conductor S y * Ideal.span {aeval y w} := by + change z ∈ Ideal.comap (aeval y) (conductor S y * Ideal.span {aeval y w}) + apply map_enlarged_le f b c d x y _ hfy ?_ ?_ ?_ hz + · simpa only [map_add,map_mul,map_pow,aeval_X] using hb + · simpa only [map_add,map_mul,map_pow,aeval_C] using hc + · simpa only [map_add,map_mul,map_pow,aeval_X,aeval_C] using hr + obtain ⟨u,hu,he⟩ := Ideal.mem_mul_span_singleton.mp hm + let t' : B := IsIntegralClosure.mk' B t ht + have hur := mem_conductor_iff.mp hu t' + rw [Algebra.adjoin_singleton_eq_range_aeval] at hur + obtain ⟨q,hq⟩ := hur + change aeval y q = u*t' at hq + refine ⟨q,?_⟩ + have hzb : aeval y (w*q) = aeval y z*t' := by + rw [map_mul,hq,← he] + ring + have hh := congrArg (algebraMap B L) hzb + have hev (v : S[X]) : algebraMap B L (aeval y v) = + AdjoinRoot.mk pg (v.map (algebraMap S Q)) := by + change (IsScalarTower.toAlgHom S B L) (aeval y v) = _ + rw [← aeval_algHom_apply] + change aeval (algebraMap B L y) v = _ + rw [hy,AdjoinRoot.aeval_eq_of_algebra] + rw [map_mul (algebraMap B L),hev,hev,IsIntegralClosure.algebraMap_mk'] at hh + exact hh +end Realization +end PermanentBorder.ReducedBranchConductor +namespace PermanentBorder.FactorNormalization +open Polynomial UniqueFactorizationMonoid +variable {S Q : Type*} [CommRing S] [IsDomain S] [IsIntegrallyClosed S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + +omit [IsDomain S] in + +lemma lift_monic_factor {f : S[X]} (hf : f.Monic) {p : Q[X]} + (hp : p.Monic) (hd : p ∣ (f).map (algebraMap S Q)) : + ∃ q : S[X], q.Monic ∧ q.map (algebraMap S Q) = p := by + obtain ⟨q,hq⟩ := IsIntegrallyClosed.eq_map_mul_C_of_dvd Q hf hd + rw [hp.leadingCoeff,C_1,mul_one] at hq + exact ⟨q,Polynomial.monic_of_injective (IsFractionRing.injective S Q) + (hq ▸ hp),hq⟩ + +omit [IsDomain S] in + +theorem exists_factors {f : S[X]} (hf : f.Monic) + (hsep : ((f).map (algebraMap S Q)).Separable) : + ∃ (s : Finset Q[X]) (p : s → S[X]), + (∀ i, (p i).Monic ∧ (p i).map (algebraMap S Q) = i.val ∧ Irreducible i.val) ∧ + (∏ i, p i) = f := by + classical + let g := (f).map (algebraMap S Q) + have hg : g.Monic := hf.map _ + let s : Finset Q[X] := ⟨normalizedFactors g, + (squarefree_iff_nodup_normalizedFactors hg.ne_zero).mp hsep.squarefree⟩ + have hi (i : s) : Irreducible i.val ∧ i.val.Monic ∧ i.val ∣ g := + (Polynomial.mem_normalizedFactors_iff hg.ne_zero).mp i.property + choose p hpm hpe using fun i : s => lift_monic_factor hf (hi i).2.1 (hi i).2.2 + refine ⟨s,p,fun i => ⟨hpm i,hpe i,(hi i).1⟩,?_⟩ + apply Polynomial.map_injective _ (IsFractionRing.injective S Q) + rw [Polynomial.map_prod] + simp_rw [hpe] + have hp := leadingCoeff_mul_prod_normalizedFactors g + rw [hg.leadingCoeff,C_1,one_mul] at hp + change (∏ i : s, id (i : Q[X])) = g + rw [Finset.prod_coe_sort] + change ((normalizedFactors g).map id).prod = g + simpa using hp + +section Cofactors +variable {ι : Type*} [Fintype ι] [DecidableEq ι] +variable (p : ι → S[X]) +noncomputable def cofactor (i : ι) : S[X] := ∏ j ∈ Finset.univ.erase i, p j + +omit [IsDomain S] [IsIntegrallyClosed S] in +lemma factor_mul_cofactor (i : ι) : p i * cofactor p i = ∏ j, p j := by + classical + exact Finset.mul_prod_erase Finset.univ p (Finset.mem_univ i) + +omit [IsDomain S] [IsIntegrallyClosed S] in +lemma cofactor_dvd_of_ne {i j : ι} (h : i ≠ j) : p j ∣ cofactor p i := by + classical + apply Finset.dvd_prod_of_mem + simp only [Finset.mem_erase,Finset.mem_univ,and_true] + exact h.symm + +end Cofactors +end PermanentBorder.FactorNormalization + +namespace PermanentBorder.FactorNormalization +open Polynomial +section Reconstruct +variable {S Q ι : Type*} [CommRing S] [Field Q] [Algebra S Q] + [Fintype ι] [DecidableEq ι] +variable (p : ι → S[X]) +local notation "f" => ∏ i, p i +local notation "pQ" => fun i => Polynomial.map (algebraMap S Q) (p i) + +noncomputable def component (i : ι) : + AdjoinRoot ((f).map (algebraMap S Q)) →ₐ[Q] AdjoinRoot (pQ i) := + AdjoinRoot.algHomOfDvd Q _ _ (map_dvd (algebraMap S Q) + (Finset.dvd_prod_of_mem p (Finset.mem_univ i))) + +omit [DecidableEq ι] in +@[simp] lemma component_mk (i : ι) (q : Q[X]) : + component p i (AdjoinRoot.mk ((f).map (algebraMap S Q)) q) = + AdjoinRoot.mk (pQ i) q := by + change (AdjoinRoot.algHomOfDvd Q _ _ _) _ = _ + rw [← AdjoinRoot.aeval_eq,← aeval_algHom_apply,AdjoinRoot.algHomOfDvd_root,AdjoinRoot.aeval_eq] + +omit [DecidableEq ι] in +lemma components_injective + (hcop : Pairwise (fun i j => IsCoprime (pQ i) (pQ j))) : + Function.Injective (fun z => fun i => component (Q := Q) p i z) := by + intro z w h + have hz : ∀ i, component p i (z-w) = 0 := by + intro i + rw [map_sub,sub_eq_zero] + exact congrFun h i + suffices z-w=0 from sub_eq_zero.mp this + obtain ⟨q,hq⟩ := AdjoinRoot.mk_surjective (z-w) + rw [← hq,AdjoinRoot.mk_eq_zero] + rw [Polynomial.map_prod] + apply Finset.prod_dvd_of_coprime + · intro i _ j _ hij + exact hcop hij + · intro i _ + apply AdjoinRoot.mk_eq_zero.mp + simpa only [← hq,component_mk] using hz i + +theorem reconstruct (hcop : Pairwise (fun i j => IsCoprime (pQ i) (pQ j))) + (z : AdjoinRoot ((f).map (algebraMap S Q))) (q : ι → S[X]) + (hz : ∀ i, component p i z = + AdjoinRoot.mk (pQ i) ((cofactor p i * q i).map (algebraMap S Q))) : + AdjoinRoot.mk ((f).map (algebraMap S Q)) + ((∑ i, cofactor p i*q i).map (algebraMap S Q)) = z := by + apply components_injective p hcop + funext i + dsimp only + rw [component_mk,Polynomial.map_sum,map_sum] + rw [Finset.sum_eq_single i] + · exact (hz i).symm + · intro j _ hji + apply AdjoinRoot.mk_eq_zero.mpr + exact Polynomial.map_dvd (algebraMap S Q) + (dvd_mul_of_dvd_left (cofactor_dvd_of_ne p hji) (q j)) + · intro hi + exact (hi (Finset.mem_univ i)).elim +end Reconstruct +end PermanentBorder.FactorNormalization +namespace PermanentBorder.ReducedBranchConductor +open Polynomial FactorNormalization +section +variable {K S Q : Type*} [CommRing K] [CommRing S] [IsDomain S] + [IsPrincipalIdealRing S] [IsLocalRing S] [IsAlgClosed (IsLocalRing.ResidueField S)] + [Algebra K S] [CharP S 2] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + +include K in + +theorem reduced_local_realization (δ : Derivation K S S) (x : S) (hx : δ x=1) + (f a b c d : S[X]) (hf : f.Monic) + (hsep : (f.map (algebraMap S Q)).Separable) + (hsq : f=a^2+C x*b^2+X*c^2+C x*X*d^2) + (hder : f.derivative=c^2+C x*d^2) + (z : S[X]) (hz : z ∈ enlargedGradientIdeal f b c d x) + (t : AdjoinRoot (f.map (algebraMap S Q))) (ht : IsIntegral S t) : + ∃ q : S[X], AdjoinRoot.mk (f.map (algebraMap S Q)) (q.map (algebraMap S Q)) = + AdjoinRoot.mk (f.map (algebraMap S Q)) (z.map (algebraMap S Q))*t := by + classical + obtain ⟨s,p,hp,hprod⟩ := exists_factors hf hsep + subst hprod + have hfac (i : s) : (∏ j, p j) = p i * cofactor p i := (factor_mul_cofactor p i).symm + have hcop : Pairwise (fun i j => IsCoprime + ((p i).map (algebraMap S Q)) ((p j).map (algebraMap S Q))) := by + intro i j hij + have hh := hsep + rw [hfac i,Polynomial.map_mul] at hh + exact hh.isCoprime.of_isCoprime_of_dvd_right (Polynomial.map_dvd _ (cofactor_dvd_of_ne p hij)) + have ht' (i : s) : IsIntegral S (component (Q := Q) p i t) := + ht.map ((component (Q := Q) p i).restrictScalars S) + have hr (i : s) := irreducible_realization δ x hx (∏j,p j) (p i) (cofactor p i) + a b c d (hp i).1 (by rw [(hp i).2.1]; exact (hp i).2.2) + (hfac i) hsep hsq hder z hz (component (Q := Q) p i t) (ht' i) + choose q hq using hr + refine ⟨∑ i, cofactor p i*q i,?_⟩ + apply reconstruct p hcop + intro i + rw [map_mul,component_mk] + exact (hq i).symm +end +end PermanentBorder.ReducedBranchConductor +namespace PermanentBorder.ReducedBranchConductor +open Polynomial + +section BaseChange +variable {S U : Type*} [CommRing S] [CommRing U] (ρ : S →+* U) + +lemma gradient_map (f b c d : S[X]) (x : S) : + Ideal.map (Polynomial.mapRingHom ρ) (gradientIdeal f b c d x) = + gradientIdeal (f.map ρ) (b.map ρ) (c.map ρ) (d.map ρ) (ρ x) := by + simp only [gradientIdeal,Ideal.map_span,Set.image_insert_eq,Set.image_singleton, + coe_mapRingHom,Polynomial.map_add,Polynomial.map_pow,Polynomial.map_mul,Polynomial.map_X,Polynomial.map_C] + +lemma enlarged_map_le (f b c d : S[X]) (x : S) : + Ideal.map (Polynomial.mapRingHom ρ) (enlargedGradientIdeal f b c d x) ≤ + enlargedGradientIdeal (f.map ρ) (b.map ρ) (c.map ρ) (d.map ρ) (ρ x) := by + rw [enlargedGradientIdeal,Ideal.map_sup,Ideal.map_mul,gradient_map] + apply sup_le_sup le_rfl + apply Ideal.mul_mono + · simp only [Ideal.map_span,Set.image_singleton,coe_mapRingHom,Polynomial.map_pow] + exact le_rfl + · exact (Ideal.map_radical_le (Polynomial.mapRingHom ρ)).trans_eq (congrArg Ideal.radical (gradient_map ρ f b c d x)) + +end BaseChange + +section LocalGlobal +variable {S Q : Type*} [CommRing S] [Field Q] [Algebra S Q] + +lemma map_tower (U : Type*) [CommRing U] [Algebra S U] [Algebra U Q] + [IsScalarTower S U Q] (f : S[X]) : + f.map (algebraMap S Q) = (f.map (algebraMap S U)).map (algebraMap U Q) := by + rw [map_map,← IsScalarTower.algebraMap_eq] + +noncomputable def genericChange (U : Type*) [CommRing U] [Algebra S U] [Algebra U Q] + [IsScalarTower S U Q] (f : S[X]) : + AdjoinRoot (f.map (algebraMap S Q)) ≃ₐ[Q] + AdjoinRoot ((f.map (algebraMap S U)).map (algebraMap U Q)) := + AdjoinRoot.algEquivOfEq Q _ _ (map_tower U f) + +lemma genericChange_mk (U : Type*) [CommRing U] [Algebra S U] [Algebra U Q] + [IsScalarTower S U Q] (f p : S[X]) : + genericChange U f (AdjoinRoot.mk _ (p.map (algebraMap S Q))) = + AdjoinRoot.mk _ ((p.map (algebraMap S U)).map (algebraMap U Q)) := by + have he : (genericChange (Q := Q) U f).toAlgHom.comp + (AdjoinRoot.mkₐ (f.map (algebraMap S Q))) = + AdjoinRoot.mkₐ ((f.map (algebraMap S U)).map (algebraMap U Q)) := by + ext + exact AdjoinRoot.algEquivOfEq_root _ _ (map_tower U f) + rw [← map_tower U p] + exact AlgHom.congr_fun he _ + +end LocalGlobal + +section Lattice +variable {S : Type*} [CommRing S] [IsDomain S] +local notation "Q" => FractionRing S + +lemma polynomial_lattice_local_global (f : S[X]) + (t : AdjoinRoot (f.map (algebraMap S Q))) + (hlocal : ∀ (P : Ideal S) [P.IsMaximal], + ∃ q : (Localization.AtPrime P)[X], + AdjoinRoot.mk _ (q.map (algebraMap (Localization.AtPrime P) Q)) = + genericChange (Localization.AtPrime P) f t) : + ∃ q : S[X], AdjoinRoot.mk _ (q.map (algebraMap S Q)) = t := by + let E := AdjoinRoot (f.map (algebraMap S Q)) + let j : S[X] →ₐ[S] E := (AdjoinRoot.mkₐ _).restrictScalars S |>.comp + (Polynomial.mapAlgHom (Algebra.ofId S Q)) + let N : Submodule S E := LinearMap.range j.toLinearMap + let D : Ideal S := Submodule.comap (LinearMap.toSpanSingleton S E t) N + have hD : D = ⊤ := by + by_contra hn + obtain ⟨P,hP,hDP⟩ := Ideal.exists_le_maximal D hn + let := hP + let U := Localization.AtPrime P + obtain ⟨q,hq⟩ := hlocal P + obtain ⟨s,hs,hsp⟩ := IsLocalization.integerNormalization_spec P.primeCompl q + have hst : (s : S) • t ∈ N := by + refine ⟨IsLocalization.integerNormalization P.primeCompl q,?_⟩ + change j _ = s • t + apply (genericChange U f).injective + change genericChange U f (AdjoinRoot.mk _ ((IsLocalization.integerNormalization P.primeCompl q).map (algebraMap S Q))) = _ + rw [genericChange_mk,hsp] + change ((AdjoinRoot.mkₐ _).restrictScalars S) + (((Polynomial.mapAlgHom (Algebra.ofId U Q)).restrictScalars S) (s • q)) = + ((genericChange U f).restrictScalars S) (s • t) + rw [map_smul,map_smul,map_smul] + exact congrArg (fun u => s • u) hq + + have hsD : s ∈ D := hst + exact hs (hDP hsD) + have ht : t ∈ N := by + have hh : (1:S) ∈ D := by rw [hD]; trivial + simpa only [D,Submodule.mem_comap,LinearMap.toSpanSingleton_apply,one_smul] using hh + exact ht +end Lattice + +section Residue +variable {K : Type*} [Field K] [IsAlgClosed K] +lemma polynomial_residue_algClosed (P : Ideal K[X]) [P.IsMaximal] : + IsAlgClosed P.ResidueField := by + let : Algebra.FiniteType K P.ResidueField := Algebra.FiniteType.of_surjective + (IsScalarTower.toAlgHom K K[X] P.ResidueField) P.algebraMap_residueField_surjective + let : Module.Finite K P.ResidueField := finite_of_finite_type_of_isJacobsonRing K P.ResidueField + exact IsAlgClosed.of_ringEquiv K _ (RingEquiv.ofBijective (algebraMap K P.ResidueField) + IsAlgClosed.algebraMap_bijective_of_isIntegral) +end Residue +section Global +variable {K S : Type*} [CommRing K] [CommRing S] [IsDomain S] + [IsPrincipalIdealRing S] [Algebra K S] [CharP S 2] +local notation "Q" => FractionRing S + +theorem reduced_global_realization (δ : Derivation K S S) (x : S) (hx : δ x = 1) + (hres : ∀ (P : Ideal S) [P.IsMaximal], IsAlgClosed P.ResidueField) + (f a b c d : S[X]) (hf : f.Monic) + (hsep : (f.map (algebraMap S Q)).Separable) + (hsq : f=a^2+C x*b^2+X*c^2+C x*X*d^2) + (hder : f.derivative=c^2+C x*d^2) + (z : S[X]) (hz : z ∈ enlargedGradientIdeal f b c d x) + (t : AdjoinRoot (f.map (algebraMap S Q))) (ht : IsIntegral S t) : + ∃ q : S[X], AdjoinRoot.mk _ (q.map (algebraMap S Q)) = + AdjoinRoot.mk _ (z.map (algebraMap S Q))*t := by + apply polynomial_lattice_local_global + intro P hP + let U := Localization.AtPrime P + let : IsAlgClosed (IsLocalRing.ResidueField U) := hres P + let : CharP U 2 := charP_of_injective_algebraMap + (IsLocalization.injective U P.primeCompl_le_nonZeroDivisors) 2 + let ρ := algebraMap S U + let δ' := NormalizationDerivation.extendEtale (T := U) δ + have hx' : δ' (ρ x) = 1 := by + rw [NormalizationDerivation.extendEtale_algebraMap,hx,map_one] + have ht' : IsIntegral U (genericChange U f t) := + (ht.map ((genericChange U f).restrictScalars S).toAlgHom).tower_top + have hs' : (f.map ρ)= (a.map ρ)^2+C (ρ x)*(b.map ρ)^2+ + X*(c.map ρ)^2+C (ρ x)*X*(d.map ρ)^2 := by + rw [hsq] + simp only [Polynomial.map_add,Polynomial.map_pow,Polynomial.map_mul, + Polynomial.map_C,Polynomial.map_X] + have hd' : (f.map ρ).derivative = (c.map ρ)^2+C (ρ x)*(d.map ρ)^2 := by + rw [Polynomial.derivative_map,hder] + simp only [Polynomial.map_add,Polynomial.map_pow,Polynomial.map_mul,Polynomial.map_C] + have hz' : z.map ρ ∈ enlargedGradientIdeal (f.map ρ) (b.map ρ) (c.map ρ) (d.map ρ) (ρ x) := + enlarged_map_le ρ f b c d x (Ideal.mem_map_of_mem (Polynomial.mapRingHom ρ) hz) + obtain ⟨q,hq⟩ := reduced_local_realization δ' (ρ x) hx' (f.map ρ) (a.map ρ) + (b.map ρ) (c.map ρ) (d.map ρ) (hf.map ρ) (by rw [← map_tower U f]; exact hsep) + hs' hd' (z.map ρ) hz' (genericChange U f t) ht' + refine ⟨q,?_⟩ + rw [map_mul,genericChange_mk] + exact hq +end Global +end PermanentBorder.ReducedBranchConductor + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Centralizers.lean b/lean/OAI/Algebra/Determinantal/Centralizers.lean new file mode 100644 index 0000000000000000000000000000000000000000..882b86554edb70db9b05873f59a67c238420dec2 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Centralizers.lean @@ -0,0 +1,424 @@ +import OAI.Algebra.Determinantal.Gradients + +namespace OAI + +namespace PermanentBorder.Selector +open MvPolynomial Polynomial Matrix +open GradientAlgebra AdjugateAlgebra Conductor + +lemma fixedAffinePencil_eq_pencil {K : Type*} [Field K] {k : ℕ} + (θ : Fin (k+1) → K) (A : Matrix (Fin (k+1)) (Fin (k+1)) K) : + fixedAffinePencil θ A = pencilMatrix (pencilBase θ A) := by + ext i j + simp only [fixedAffinePencil, pencilMatrix, pencilBase, Matrix.add_apply, + Matrix.smul_apply, Matrix.map_apply, Matrix.one_apply, Matrix.diagonal_apply, + smul_eq_mul, map_add, map_mul] + split_ifs <;> simp + ring + +theorem gradient_forces_normalization_defect {K : Type*} + [Field K] [Infinite K] [CharP K 2] {k q : ℕ} (hq : 3*q ≤ k) + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) + (hcrit : ∀ ij : Fin (k+1) × Fin (k+1), MvPolynomial.eval + (fun ab : Fin (k+1) × Fin (k+1) => A ab.1 ab.2) + (pderiv ij (diagonalCoefficient + (Matrix.of fun a b => (MvPolynomial.X (a,b) : + MvPolynomial (Fin (k+1) × Fin (k+1)) K)) (fun i => MvPolynomial.C (θ i)) q)) = 0) : + let T := -(pencilBase θ A) + let Q := FractionRing K[X] + let R := integralClosure K[X] (AdjoinRoot (T.charpoly.map (algebraMap K[X] Q))) + ((q+2).choose 2 : ℕ∞) ≤ Module.length K (R ⧸ LinearMap.range + (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toLinearMap) := by + apply critical_normalization_defect θ hθ A q hq + intro i j + have h := hcrit (j,i) + rw [diagonalCoefficient_eq_affineSelector, gradient_affineSelector, + fixedAffinePencil_eq_pencil] at h + exact h + +end PermanentBorder.Selector + +namespace PermanentBorder.CentralizerDimension + +open Matrix MvPolynomial + +variable {K ι : Type*} [Field K] [Fintype ι] [DecidableEq ι] + +def centralizer (A : Matrix ι ι K) : Submodule K (Matrix ι ι K) where + carrier := {B | A * B = B * A} + zero_mem' := by simp + add_mem' := by + intro B C hB hC + dsimp at hB hC ⊢ + simp only [mul_add, add_mul, hB, hC] + smul_mem' := by + intro c B hB + dsimp at hB ⊢ + simp only [Matrix.mul_smul, Matrix.smul_mul, hB] + +@[simp] theorem mem_centralizer (A B : Matrix ι ι K) : + B ∈ centralizer A ↔ A * B = B * A := Iff.rfl + +def centralizerOne (A : Matrix ι ι K) : centralizer A := + ⟨1, by simp⟩ + +noncomputable def centralizerBasis (A : Matrix ι ι K) : + Module.Basis (Fin (Module.finrank K (centralizer A))) K (centralizer A) := + Module.finBasis K (centralizer A) + +noncomputable def coordinateMatrix (A : Matrix ι ι K) : + Matrix ι ι (MvPolynomial (Fin (Module.finrank K (centralizer A))) K) := + fun i j => ∑ b, C ((centralizerBasis A b).val i j) * X b + +noncomputable def determinantPolynomial (A : Matrix ι ι K) : + MvPolynomial (Fin (Module.finrank K (centralizer A))) K := + (coordinateMatrix A).det + +noncomputable def singularIdeal (A : Matrix ι ι K) : + Ideal (MvPolynomial (Fin (Module.finrank K (centralizer A))) K) := + Ideal.span {determinantPolynomial A} + +theorem eval_coordinateMatrix (A : Matrix ι ι K) (B : centralizer A) : + (coordinateMatrix A).map (eval (fun b => (centralizerBasis A).repr B b)) = B.val := by + classical + ext i j + have h := congrArg (fun W : centralizer A => W.val i j) + ((centralizerBasis A).sum_repr B) + simp only [coordinateMatrix, Matrix.map_apply, map_sum, map_mul, eval_C, eval_X] + simpa only [Submodule.coe_sum, Submodule.coe_smul, Matrix.sum_apply, + Matrix.smul_apply, smul_eq_mul, mul_comm] using h + +theorem eval_determinantPolynomial (A : Matrix ι ι K) (B : centralizer A) : + eval (fun b => (centralizerBasis A).repr B b) (determinantPolynomial A) = + B.val.det := by + rw [determinantPolynomial, RingHom.map_det] + change ((coordinateMatrix A).map (eval (fun b => (centralizerBasis A).repr B b))).det = _ + rw [eval_coordinateMatrix] + +theorem determinantPolynomial_ne_zero (A : Matrix ι ι K) : + determinantPolynomial A ≠ 0 := by + intro h + have he := eval_determinantPolynomial A (centralizerOne A) + simp [h, centralizerOne] at he + +theorem singular_centralizer_dimension (A : Matrix ι ι K) : + ringKrullDim (MvPolynomial (Fin (Module.finrank K (centralizer A))) K ⧸ + singularIdeal A) + 1 ≤ (Module.finrank K (centralizer A) : WithBot ℕ∞) := by + calc + _ ≤ ringKrullDim (MvPolynomial (Fin (Module.finrank K (centralizer A))) K) := + ringKrullDim_quotient_succ_le_of_nonZeroDivisor + (mem_nonZeroDivisors_iff_ne_zero.mpr (determinantPolynomial_ne_zero A)) + _ = _ := by + rw [MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field] + simp + +theorem nilpotent_centralizer_vanish [Nonempty ι] (A : Matrix ι ι K) + (B : centralizer A) (hB : IsNilpotent B.val) : + eval (fun b => (centralizerBasis A).repr B b) (determinantPolynomial A) = 0 := by + rw [eval_determinantPolynomial] + obtain ⟨e, he⟩ := hB + have hd := congrArg Matrix.det he + rw [Matrix.det_pow, Matrix.det_zero] at hd + exact (show IsNilpotent B.val.det from ⟨e, hd⟩).eq_zero + +noncomputable def nilpotencyEquation (A : Matrix ι ι K) (d : ℕ) : + MvPolynomial (Fin (Module.finrank K (centralizer A))) K := + ((coordinateMatrix A).charpoly - Polynomial.X ^ Fintype.card ι).coeff d + +noncomputable def nilpotentIdeal (A : Matrix ι ι K) : + Ideal (MvPolynomial (Fin (Module.finrank K (centralizer A))) K) := + Ideal.span (Set.range (nilpotencyEquation A)) + +theorem eval_nilpotencyEquation (A : Matrix ι ι K) (B : centralizer A) (d : ℕ) : + eval (fun b => (centralizerBasis A).repr B b) (nilpotencyEquation A d) = + (B.val.charpoly - Polynomial.X ^ Fintype.card ι).coeff d := by + rw [nilpotencyEquation, ← Polynomial.coeff_map] + congr 1 + rw [Polynomial.map_sub, Polynomial.map_pow, Polynomial.map_X, + ← Matrix.charpoly_map, eval_coordinateMatrix] + +theorem nilpotentIdeal_vanishing_iff (A : Matrix ι ι K) (B : centralizer A) : + (∀ p ∈ nilpotentIdeal A, + eval (fun b => (centralizerBasis A).repr B b) p = 0) ↔ IsNilpotent B.val := by + constructor + · intro h + have heq : B.val.charpoly = Polynomial.X ^ Fintype.card ι := by + apply sub_eq_zero.mp + ext d + have hd := h _ (Ideal.subset_span (Set.mem_range_self d)) + simpa only [eval_nilpotencyEquation, Polynomial.coeff_zero] using hd + refine ⟨Fintype.card ι, ?_⟩ + have hc := Matrix.aeval_self_charpoly B.val + rwa [heq, Polynomial.aeval_X_pow] at hc + · intro h + have heq : B.val.charpoly = Polynomial.X ^ Fintype.card ι := + sub_eq_zero.mp (Matrix.isNilpotent_charpoly_sub_pow_of_isNilpotent h).eq_zero + have hi : nilpotentIdeal A ≤ RingHom.ker + (eval (fun b => (centralizerBasis A).repr B b)) := by + rw [nilpotentIdeal, Ideal.span_le] + rintro _ ⟨d, rfl⟩ + change eval (fun b => (centralizerBasis A).repr B b) (nilpotencyEquation A d) = 0 + rw [eval_nilpotencyEquation, heq, sub_self, Polynomial.coeff_zero] + exact fun p hp => hi hp + +theorem singularIdeal_le_nilpotentIdeal [Nonempty ι] (A : Matrix ι ι K) : + singularIdeal A ≤ nilpotentIdeal A := by + rw [singularIdeal, Ideal.span_singleton_le_iff_mem] + have h0 : (coordinateMatrix A).charpoly.coeff 0 ∈ nilpotentIdeal A := by + have heq : nilpotencyEquation A 0 = (coordinateMatrix A).charpoly.coeff 0 := by + simp [nilpotencyEquation, Polynomial.coeff_sub, Polynomial.coeff_X_pow, + Ne.symm (Fintype.card_ne_zero : Fintype.card ι ≠ 0)] + rw [← heq] + exact Ideal.subset_span (Set.mem_range_self 0) + rw [determinantPolynomial, Matrix.det_eq_sign_charpoly_coeff] + exact (nilpotentIdeal A).mul_mem_left _ h0 + +theorem nilpotent_centralizer_dimension [Nonempty ι] (A : Matrix ι ι K) : + ringKrullDim (MvPolynomial (Fin (Module.finrank K (centralizer A))) K ⧸ + nilpotentIdeal A) + 1 ≤ (Module.finrank K (centralizer A) : WithBot ℕ∞) := by + calc + _ ≤ ringKrullDim (MvPolynomial (Fin (Module.finrank K (centralizer A))) K ⧸ + singularIdeal A) + 1 := by + exact add_le_add (ringKrullDim_le_of_surjective + (Ideal.Quotient.factor (singularIdeal_le_nilpotentIdeal A)) + (Ideal.Quotient.factor_surjective (singularIdeal_le_nilpotentIdeal A))) le_rfl + _ ≤ _ := singular_centralizer_dimension A + +end PermanentBorder.CentralizerDimension + +namespace PermanentBorder.MatrixFieldExtension +open Matrix +variable {K L ι : Type*} [Field K] [Field L] [Fintype ι] [DecidableEq ι] + +theorem rank_map (φ : K →+* L) (M : Matrix ι ι K) : + (M.map φ).rank = M.rank := by + classical + obtain ⟨U, V, d, h⟩ := Matrix.Pivot.exists_list_transvec_mul_mul_list_transvec_eq_diagonal M + let P := (U.map Matrix.TransvectionStruct.toMatrix).prod + let Q := (V.map Matrix.TransvectionStruct.toMatrix).prod + have hP : P.det = 1 := Matrix.TransvectionStruct.det_toMatrix_prod U + have hQ : Q.det = 1 := Matrix.TransvectionStruct.det_toMatrix_prod V + have hP' : (P.map φ).det = 1 := by + change (φ.mapMatrix P).det = 1 + rw [← φ.map_det, hP, map_one] + have hQ' : (Q.map φ).det = 1 := by + change (φ.mapMatrix Q).det = 1 + rw [← φ.map_det, hQ, map_one] + have h' : P.map φ * M.map φ * Q.map φ = diagonal (φ ∘ d) := by + simpa only [Matrix.map_mul, Matrix.diagonal_map (map_zero φ), Function.comp_def] using + congrArg (fun X : Matrix ι ι K => X.map φ) h + calc + (M.map φ).rank = (P.map φ * M.map φ * Q.map φ).rank := by + rw [Matrix.rank_mul_eq_left_of_isUnit_det _ _ (hQ' ▸ isUnit_one), + Matrix.rank_mul_eq_right_of_isUnit_det _ _ (hP' ▸ isUnit_one)] + _ = (diagonal (φ ∘ d)).rank := congrArg Matrix.rank h' + _ = (diagonal d).rank := by + simp only [Matrix.rank_diagonal, Function.comp_apply, map_ne_zero] + _ = (P * M * Q).rank := congrArg Matrix.rank h.symm + _ = M.rank := by + rw [Matrix.rank_mul_eq_left_of_isUnit_det _ _ (hQ ▸ isUnit_one), + Matrix.rank_mul_eq_right_of_isUnit_det _ _ (hP ▸ isUnit_one)] + +theorem finrank_ker_map (φ : K →+* L) (M : Matrix ι ι K) : + Module.finrank L (LinearMap.ker (M.map φ).mulVecLin) = + Module.finrank K (LinearMap.ker M.mulVecLin) := by + have h := M.mulVecLin.finrank_range_add_finrank_ker + have h' := (M.map φ).mulVecLin.finrank_range_add_finrank_ker + change M.rank + _ = _ at h + change (M.map φ).rank + _ = _ at h' + rw [rank_map] at h' + simp only [Module.finrank_fintype_fun_eq_card] at h h' + omega + +variable [Algebra K L] + +def mapKernel (M : Matrix ι ι K) (v : LinearMap.ker M.mulVecLin) : + LinearMap.ker (M.map (algebraMap K L)).mulVecLin := + ⟨algebraMap K L ∘ v.val, by + change (M.map (algebraMap K L)) *ᵥ (algebraMap K L ∘ v.val) = 0 + ext i + rw [← RingHom.map_mulVec] + have hv : M *ᵥ v.val = 0 := v.property + simp only [hv, Pi.zero_apply, map_zero]⟩ + +omit [DecidableEq ι] in +theorem mapKernel_linearIndependent {κ : Type*} (M : Matrix ι ι K) + (b : Module.Basis κ K (LinearMap.ker M.mulVecLin)) : + LinearIndependent L (fun i => mapKernel (L := L) M (b i)) := by + have hb : LinearIndependent K (fun i => (b i).val) := + b.linearIndependent.map' (LinearMap.ker M.mulVecLin).subtype (Submodule.ker_subtype _) + have hm : LinearIndependent L (fun i => algebraMap K L ∘ (b i).val) := + (linearIndependent_algebraMap_comp_iff (R := K) (S := L)).mpr hb + exact hm.of_comp (LinearMap.ker (M.map (algebraMap K L)).mulVecLin).subtype + +noncomputable def kernelBasisMap {κ : Type*} [Fintype κ] (M : Matrix ι ι K) + (b : Module.Basis κ K (LinearMap.ker M.mulVecLin)) : + Module.Basis κ L (LinearMap.ker (M.map (algebraMap K L)).mulVecLin) := + basisOfLinearIndependentOfCardEqFinrank' (fun i => mapKernel (L := L) M (b i)) + (mapKernel_linearIndependent M b) + (by rw [finrank_ker_map, Module.finrank_eq_card_basis b]) + +@[simp] theorem kernelBasisMap_apply {κ : Type*} [Fintype κ] (M : Matrix ι ι K) + (b : Module.Basis κ K (LinearMap.ker M.mulVecLin)) (i : κ) : + kernelBasisMap (L := L) M b i = mapKernel M (b i) := by + simp only [kernelBasisMap, coe_basisOfLinearIndependentOfCardEqFinrank'] + +end PermanentBorder.MatrixFieldExtension + +namespace PermanentBorder.CentralizerBaseChange +open Matrix CentralizerDimension MatrixFieldExtension +variable {K L ι : Type*} [Field K] [Field L] + [Fintype ι] [DecidableEq ι] + +def equationMatrix (A : Matrix ι ι K) : Matrix (ι × ι) (ι × ι) K := + fun i j => (if i.2 = j.2 then A i.1 j.1 else 0) - + (if i.1 = j.1 then A j.2 i.2 else 0) + +theorem equationMatrix_mulVec (A B : Matrix ι ι K) : + equationMatrix A *ᵥ Function.uncurry B = Function.uncurry (A * B - B * A) := by + funext ij + rcases ij with ⟨i,j⟩ + change (∑ a : ι × ι, ((if j = a.2 then A i a.1 else 0) - + (if i = a.1 then A a.2 j else 0)) * B a.1 a.2) = + (∑ a, A i a * B a j) - ∑ a, B i a * A a j + simp only [Fintype.sum_prod_type, sub_mul, Finset.sum_sub_distrib, ite_mul, zero_mul, + Finset.sum_ite_eq, Finset.mem_univ, ite_true] + rw [Finset.sum_comm] + simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true, mul_comm] + +omit [Fintype ι] in +@[simp] theorem equationMatrix_map (A : Matrix ι ι K) (φ : K →+* L) : + equationMatrix (A.map φ) = (equationMatrix A).map φ := by + ext i j + simp only [equationMatrix, Matrix.map_apply, map_sub, apply_ite φ, map_zero] + +def centralizerKernelEquiv (A : Matrix ι ι K) : + centralizer A ≃ₗ[K] LinearMap.ker (equationMatrix A).mulVecLin where + toFun B := ⟨Function.uncurry B.val, by + change equationMatrix A *ᵥ Function.uncurry B.val = 0 + rw [equationMatrix_mulVec, sub_eq_zero.mpr B.property] + rfl⟩ + invFun v := ⟨(fun i j => v.val (i,j)), by + apply sub_eq_zero.mp + have h := equationMatrix_mulVec A (show Matrix ι ι K from fun i j => v.val (i,j)) + ext i j + exact (congrFun h (i,j)).symm.trans (congrFun v.property (i,j))⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +variable [Algebra K L] + +theorem finrank_centralizer_map (A : Matrix ι ι K) : + Module.finrank L (centralizer (A.map (algebraMap K L))) = + Module.finrank K (centralizer A) := by + calc + _ = Module.finrank L (LinearMap.ker (equationMatrix (A.map (algebraMap K L))).mulVecLin) := + (centralizerKernelEquiv _).finrank_eq + _ = Module.finrank L (LinearMap.ker ((equationMatrix A).map (algebraMap K L)).mulVecLin) := by + rw [equationMatrix_map] + _ = Module.finrank K (LinearMap.ker (equationMatrix A).mulVecLin) := + finrank_ker_map _ _ + _ = _ := (centralizerKernelEquiv _).finrank_eq.symm + +def flatten (F : Type*) [Field F] (ι : Type*) : + Matrix ι ι F ≃ₗ[F] (ι × ι → F) where + toFun := Function.uncurry + invFun := Function.curry + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def mapCentralizer (A : Matrix ι ι K) (B : centralizer A) : + centralizer (A.map (algebraMap K L)) := + ⟨B.val.map (algebraMap K L), by + change A.map _ * B.val.map _ = B.val.map _ * A.map _ + rw [← Matrix.map_mul, ← Matrix.map_mul, B.property]⟩ + +theorem mapCentralizer_linearIndependent {κ : Type*} + (A : Matrix ι ι K) (b : Module.Basis κ K (centralizer A)) : + LinearIndependent L (fun i => mapCentralizer (L := L) A (b i)) := by + have hb : LinearIndependent K (fun i => Function.uncurry (b i).val) := + (b.linearIndependent.map' (centralizer A).subtype (Submodule.ker_subtype _)).map' + (flatten K ι).toLinearMap (LinearEquiv.ker _) + have hm : LinearIndependent L (fun i => algebraMap K L ∘ Function.uncurry (b i).val) := + (linearIndependent_algebraMap_comp_iff (R := K) (S := L)).mpr hb + exact hm.of_comp ((flatten L ι).toLinearMap.comp (centralizer (A.map (algebraMap K L))).subtype) + +noncomputable def centralizerBasisMap {κ : Type*} [Fintype κ] + (A : Matrix ι ι K) (b : Module.Basis κ K (centralizer A)) : + Module.Basis κ L (centralizer (A.map (algebraMap K L))) := + basisOfLinearIndependentOfCardEqFinrank' (fun i => mapCentralizer (L := L) A (b i)) + (mapCentralizer_linearIndependent A b) + (by rw [finrank_centralizer_map, Module.finrank_eq_card_basis b]) + +@[simp] theorem centralizerBasisMap_apply {κ : Type*} [Fintype κ] + (A : Matrix ι ι K) (b : Module.Basis κ K (centralizer A)) (i : κ) : + centralizerBasisMap (L := L) A b i = mapCentralizer A (b i) := by + simp only [centralizerBasisMap, coe_basisOfLinearIndependentOfCardEqFinrank'] + +end PermanentBorder.CentralizerBaseChange + +namespace PermanentBorder.CoordinateGauge +open Module Submodule +variable {K ι : Type*} [Field K] [Fintype ι] + +theorem exists_coordinate_gauge (S : Submodule K (ι → K)) : + ∃ a : Fin (Module.finrank K S) → ι, Function.Injective a ∧ + Function.Bijective (fun x : S => fun j => x.val (a j)) := by + classical + let q (i : ι) : Module.Dual K S := (LinearMap.proj i).comp S.subtype + obtain ⟨κ, a, ha, hspan, hli⟩ := exists_linearIndependent' K q + let : Finite κ := Finite.of_injective a ha + let : Fintype κ := Fintype.ofFinite κ + let r : S →ₗ[K] (κ → K) := LinearMap.pi fun j => q (a j) + have hri : Function.Injective r := by + apply LinearMap.ker_eq_bot.mp + apply eq_bot_iff.mpr + intro x hx + have hz : ∀ j, q (a j) x = 0 := congrFun (show r x = 0 from hx) + have hs : ∀ g ∈ Submodule.span K (Set.range (q ∘ a)), g x = 0 := by + intro g hg + induction hg using Submodule.span_induction with + | mem z hz' => obtain ⟨j, rfl⟩ := hz'; exact hz j + | zero => rfl + | add y z _ _ hy hz => simp only [LinearMap.add_apply, hy, hz, add_zero] + | smul c y _ hy => simp only [LinearMap.smul_apply, hy, smul_zero] + have hcoord (i : ι) : q i x = 0 := by + apply hs + rw [hspan] + exact Submodule.subset_span (Set.mem_range_self i) + change x = 0 + apply Subtype.ext + funext i + exact hcoord i + have hc : Fintype.card κ = Module.finrank K S := by + apply Nat.le_antisymm + · simpa only [Subspace.dual_finrank_eq] using hli.fintype_card_le_finrank + · simpa only [Module.finrank_fintype_fun_eq_card] using + (LinearMap.finrank_le_finrank_of_injective hri) + have hrs : Function.Surjective r := + (LinearMap.injective_iff_surjective_of_finrank_eq_finrank + (by simpa only [Module.finrank_fintype_fun_eq_card] using hc.symm)).mp hri + let e := Fintype.equivFinOfCardEq hc + refine ⟨a ∘ e.symm, ha.comp e.symm.injective, ?_, ?_⟩ + · intro x y h + apply hri + funext j + have he := congrFun h (e j) + change x.val (a j) = y.val (a j) + simpa only [Function.comp_apply, e.symm_apply_apply] using he + · intro v + obtain ⟨x, hx⟩ := hrs (v ∘ e) + refine ⟨x, ?_⟩ + funext j + have he := congrFun hx (e.symm j) + simpa only [r, LinearMap.pi_apply, q, LinearMap.comp_apply, Submodule.subtype_apply, + LinearMap.proj_apply, Function.comp_apply, e.apply_symm_apply] using he + +end PermanentBorder.CoordinateGauge + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/ConditionalBound.lean b/lean/OAI/Algebra/Determinantal/ConditionalBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa71d190ff83696b26c9174e7cfb86447b1cf6b2 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/ConditionalBound.lean @@ -0,0 +1,438 @@ +import OAI.Algebra.Determinantal.Transcendence + +namespace OAI + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +lemma singularSystem_map {K L β : Type*} [CommRing K] [CommRing L] + (φ : K →+* L) (f : MvPolynomial β K) (j : Option β) : + map φ (singularSystem f j) = singularSystem (map φ f) j := by + cases j with + | none => rfl + | some i => exact pderiv_map.symm + +noncomputable def universalSection {σ α β : Type*} [Fintype β] + (F : MvPolynomial α (MvPolynomial σ ℤ)) : + MvPolynomial β (MvPolynomial (σ ⊕ (α × β)) ℤ) := + linearSection (fun i => X (Sum.inr i)) (map (rename (R := ℤ) (fun i : σ => (Sum.inl i : σ ⊕ (α × β)))).toRingHom F) + +lemma universalSection_specialize {K σ α β : Type*} [CommRing K] [Fintype β] + (F : MvPolynomial α (MvPolynomial σ ℤ)) (θ : σ → K) (H : α × β → K) : + map (eval₂Hom (Int.castRingHom K) (Sum.elim θ H)) (universalSection F) = + linearSection H (map (eval₂Hom (Int.castRingHom K) θ) F) := by + rw [universalSection, linearSection_map, map_map] + have he : (eval₂Hom (Int.castRingHom K) (Sum.elim θ H)).comp (rename (R := ℤ) (fun i : σ => (Sum.inl i : σ ⊕ (α × β)))).toRingHom = + eval₂Hom (Int.castRingHom K) θ := by + ext i <;> simp + rw [he] + have hH : (fun i : α × β => + eval₂Hom (Int.castRingHom K) (Sum.elim θ H) (X (Sum.inr i))) = H := by + funext i + exact eval₂_X _ _ _ + rw [hH] + +lemma universalSection_macaulay_map {M σ α β : Type*} [Field M] [Fintype β] + (F : MvPolynomial α (MvPolynomial σ ℤ)) (r D : ℕ) + (t : σ → M) (A : α × β → M) : + (macaulayMatrix (singularDegrees r) + (singularSystem (universalSection (β := β) F)) D).map + (eval₂Hom (Int.castRingHom M) (Sum.elim t A)) = + macaulayMatrix (singularDegrees r) + (singularSystem (linearSection A (map (eval₂Hom (Int.castRingHom M) t) F))) D := by + rw [← macaulayMatrix_map] + apply congrArg (fun Q => macaulayMatrix (singularDegrees r) Q D) + funext j + rw [singularSystem_map, universalSection_specialize] + +theorem transfer_section_certificate {K L σ α β : Type*} + [Field K] [Field L] [CharZero L] [Infinite L] [Fintype β] + (F : MvPolynomial α (MvPolynomial σ ℤ)) (r D : ℕ) + (θ : σ → K) (H : α × β → K) + (h : Function.Surjective + (macaulayMatrix (singularDegrees r) + (singularSystem (linearSection H + (map (eval₂Hom (Int.castRingHom K) θ) F))) D).mulVec) : + ∃ θ' : σ → L, ∃ H' : α × β → L, + Function.Surjective + (macaulayMatrix (singularDegrees r) + (singularSystem (linearSection H' + (map (eval₂Hom (Int.castRingHom L) θ') F))) D).mulVec := by + classical + let P := macaulayMatrix (singularDegrees r) (singularSystem (universalSection (β := β) F)) D + have hp : Function.Surjective + (P.map (eval₂Hom (Int.castRingHom K) (Sum.elim θ H))).mulVec := by + dsimp only [P] + rwa [universalSection_macaulay_map] + obtain ⟨w,hw⟩ := integer_polynomial_rank_transfer (L := L) P (Sum.elim θ H) hp + refine ⟨fun i => w (Sum.inl i), fun i => w (Sum.inr i), ?_⟩ + have hw' : Sum.elim (fun i => w (Sum.inl i)) (fun i => w (Sum.inr i)) = w := by + funext i + cases i <;> rfl + dsimp only [P] at hw + rw [← universalSection_macaulay_map, hw'] + exact hw + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +lemma macaulay_no_nonzero_zero {K σ ι : Type*} [Field K] [Fintype σ] [Fintype ι] + (e : ι → ℤ) (F : ι → MvPolynomial σ K) + (hF : ∀ i, (F i).IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) (e i)) (D : ℕ) + (h : Function.Surjective (macaulayMatrix e F D).mulVec) + (y : σ → K) (hy : ∀ i, eval y (F i) = 0) : y = 0 := by + classical + have hz : y ∈ zeroLocus K (Ideal.span (Set.range F)) := by + rw [zeroLocus_span] + rintro _ ⟨i,rfl⟩ + exact hy i + have hD := (macaulay_surjective_iff e F hF D).mp h + ext j + have hx : (X j : MvPolynomial σ K)^D ∈ Ideal.span (Set.range F) := + hD _ (homogeneous_intWeight (by simpa only [one_mul] using (isHomogeneous_X K j).pow D)) + have hv : y j ^ D = 0 := by simpa using hz _ hx + by_contra hj + exact pow_ne_zero D hj hv + +theorem certificate_smooth_equations {K β : Type*} [Field K] [Fintype β] + (g : MvPolynomial β K) (r D : ℕ) (hg : g.IsHomogeneous r) + (h : Function.Surjective + (macaulayMatrix (singularDegrees r) (singularSystem g) D).mulVec) : + ∀ y : β → K, eval y g = 0 → (∀ j, eval y (pderiv j g) = 0) → y = 0 := by + intro y hy hd + apply macaulay_no_nonzero_zero _ _ (singularSystem_homogeneous hg) D h y + intro j + cases j with + | none => exact hy + | some j => exact hd j + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial +universe u v +variable (K : Type u) [Field K] (ι : Type v) + +abbrev GenericClosed := AlgebraicClosure (FractionRing (MvPolynomial ι K)) + +noncomputable def independentParameters : ι → GenericClosed K ι := fun i => + algebraMap (FractionRing (MvPolynomial ι K)) (GenericClosed K ι) + (algebraMap (MvPolynomial ι K) (FractionRing (MvPolynomial ι K)) (X i)) + +lemma independentParameters_independent : AlgebraicIndependent K (independentParameters K ι) := by + let R := MvPolynomial ι K + let Q := FractionRing R + have hQ : AlgebraicIndependent K (fun i : ι => algebraMap R Q (X i)) := + (MvPolynomial.algebraicIndependent_X ι K).map' + (f := IsScalarTower.toAlgHom K R Q) (IsFractionRing.injective R Q) + exact hQ.map' (f := IsScalarTower.toAlgHom K Q (GenericClosed K ι)) + (RingHom.injective (algebraMap Q (GenericClosed K ι))) + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial +universe u v + +lemma specialize_tower {K L σ α : Type*} [CommRing K] [CommRing L] + (φ : K →+* L) (F : MvPolynomial α (MvPolynomial σ ℤ)) (θ : σ → K) : + map φ (map (eval₂Hom (Int.castRingHom K) θ) F) = + map (eval₂Hom (Int.castRingHom L) (fun i => φ (θ i))) F := by + rw [map_map] + apply congrArg (fun ψ : MvPolynomial σ ℤ →+* L => map ψ F) + ext i <;> simp + +theorem exists_complex_smooth_section {K : Type u} [Field K] {σ : Type v} + {v d n r : ℕ} (F : MvPolynomial (Fin (v+1)) (MvPolynomial σ ℤ)) + (hF : F.IsHomogeneous r) (θ : σ → K) + (hf : map (eval₂Hom (Int.castRingHom K) θ) F ≠ 0) + (hdim : ringKrullDim (MvPolynomial (Fin (v+1)) K ⧸ + Ideal.span (Set.range (fun i => pderiv i + (map (eval₂Hom (Int.castRingHom K) θ) F)))) ≤ n) + (hn : n+d < v+1) : + ∃ θ' : σ → ℂ, ∃ H' : Fin (v+1) × Fin (d+1) → ℂ, + let g := linearSection H' (map (eval₂Hom (Int.castRingHom ℂ) θ') F) + g ≠ 0 ∧ g.IsHomogeneous r ∧ + (∀ y : Fin (d+1) → ℂ, eval y g = 0 → + (∀ j, eval y (pderiv j g) = 0) → y = 0) := by + classical + let M := GenericClosed K (Fin (v+1) × Fin (d+1)) + let H := independentParameters K (Fin (v+1) × Fin (d+1)) + obtain ⟨D,hD⟩ := generic_slice_certificate + (L := M) _ hf (hF.map _) hdim hn H (independentParameters_independent K _) + rw [specialize_tower] at hD + obtain ⟨t,A,hA⟩ := transfer_section_certificate (L := ℂ) F r D + (fun i => algebraMap K M (θ i)) H hD + refine ⟨t,A, ?_⟩ + let g := linearSection A (map (eval₂Hom (Int.castRingHom ℂ) t) F) + have hg : g.IsHomogeneous r := linearSection_homogeneous A (hF.map _) + have hs := certificate_smooth_equations g r D hg hA + refine ⟨?_,hg,hs⟩ + intro h + change g = 0 at h + have hzero := hs (fun _ => 1) (by rw [h, map_zero]) (by + intro j + rw [h, map_zero, map_zero]) + exact one_ne_zero (congrFun hzero (0 : Fin (d+1))) + +end PermanentBorder.SliceParameters +namespace PermanentBorder.SliceParameters +open MvPolynomial + +lemma gradientIdeal_rename {K α β : Type*} [CommRing K] + (e : α ≃ β) (f : MvPolynomial α K) : + Ideal.span (Set.range (fun j => pderiv j (rename e f))) = + (Ideal.span (Set.range (fun i => pderiv i f))).map + (renameEquiv K e).toRingEquiv.toRingHom := by + rw [Ideal.map_span] + congr 1 + ext p + constructor + · rintro ⟨j,rfl⟩ + refine ⟨pderiv (e.symm j) f,⟨e.symm j,rfl⟩,?_⟩ + change rename e (pderiv (e.symm j) f) = pderiv j (rename e f) + rw [← pderiv_rename e.injective,e.apply_symm_apply] + · rintro ⟨_,⟨i,rfl⟩,rfl⟩ + exact ⟨e i,pderiv_rename e.injective i f⟩ + +lemma gradientDimension_rename {K α β : Type*} [CommRing K] + (e : α ≃ β) (f : MvPolynomial α K) : + ringKrullDim (MvPolynomial β K ⧸ Ideal.span (Set.range (fun j => pderiv j (rename e f)))) = + ringKrullDim (MvPolynomial α K ⧸ Ideal.span (Set.range (fun i => pderiv i f))) := by + exact ringKrullDim_eq_of_ringEquiv + (Ideal.quotientEquiv _ _ (renameEquiv K e).toRingEquiv (gradientIdeal_rename e f)).symm + +lemma nonzero_of_gradientDimension {K α : Type*} [Field K] [Fintype α] + (f : MvPolynomial α K) (n : ℕ) + (hdim : ringKrullDim (MvPolynomial α K ⧸ + Ideal.span (Set.range (fun i => pderiv i f))) ≤ n) + (hn : n < Fintype.card α) : f ≠ 0 := by + intro h + rw [h] at hdim + have hz : Ideal.span (Set.range (fun i : α => pderiv i (0 : MvPolynomial α K))) = ⊥ := by + apply le_antisymm _ bot_le + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + simp + rw [hz,ringKrullDim_eq_of_ringEquiv (RingEquiv.quotientBot _), + MvPolynomial.ringKrullDim_of_isNoetherianRing] at hdim + have hdim' : ((Fintype.card α : ℕ) : WithBot ℕ∞) ≤ n := by simpa using hdim + have hi : Fintype.card α ≤ n := by exact_mod_cast hdim' + omega + +theorem exists_complex_smooth_section_finite {K α σ : Type} [Field K] [Fintype α] + {v d n r : ℕ} (hv : Fintype.card α = v+1) + (F : MvPolynomial α (MvPolynomial σ ℤ)) (hF : F.IsHomogeneous r) (θ : σ → K) + (hf : map (eval₂Hom (Int.castRingHom K) θ) F ≠ 0) + (hdim : ringKrullDim (MvPolynomial α K ⧸ + Ideal.span (Set.range (fun i => pderiv i + (map (eval₂Hom (Int.castRingHom K) θ) F)))) ≤ n) + (hn : n+d < v+1) : + ∃ θ' : σ → ℂ, ∃ H' : α × Fin (d+1) → ℂ, + let g := linearSection H' (map (eval₂Hom (Int.castRingHom ℂ) θ') F) + g ≠ 0 ∧ g.IsHomogeneous r ∧ + (∀ y : Fin (d+1) → ℂ, eval y g = 0 → + (∀ j, eval y (pderiv j g) = 0) → y = 0) := by + classical + let e : α ≃ Fin (v+1) := Fintype.equivFinOfCardEq hv + let F' := rename e F + have he (L : Type) [CommRing L] (t : σ → L) : + map (eval₂Hom (Int.castRingHom L) t) F' = + rename e (map (eval₂Hom (Int.castRingHom L) t) F) := by + exact map_rename _ _ _ + have hf' : map (eval₂Hom (Int.castRingHom K) θ) F' ≠ 0 := by + rw [he] + exact fun h => hf ((rename_injective _ e.injective).eq_iff.mp (h.trans (map_zero _).symm)) + have hd' : ringKrullDim (MvPolynomial (Fin (v+1)) K ⧸ + Ideal.span (Set.range (fun i => pderiv i + (map (eval₂Hom (Int.castRingHom K) θ) F')))) ≤ n := by + rw [he,gradientDimension_rename] + exact hdim + obtain ⟨t,H,hh⟩ := exists_complex_smooth_section F' hF.rename_isHomogeneous θ hf' hd' hn + refine ⟨t,(fun ij => H (e ij.1,ij.2)),?_⟩ + have hl (f : MvPolynomial α ℂ) : + linearSection H (rename e f) = linearSection (fun ij => H (e ij.1,ij.2)) f := by + have hhom : (linearSection H).comp (rename e) = + linearSection (fun ij => H (e ij.1,ij.2)) := by + apply MvPolynomial.algHom_ext + intro i + simp only [AlgHom.comp_apply,rename_X,linearSection_X] + rfl + exact DFunLike.congr_fun hhom f + rw [he,hl] at hh + exact hh +end PermanentBorder.SliceParameters + +namespace PermanentBorder.Parameters + +abbrev auxiliarySize (m : ℕ) := m / 11 +abbrev selectorIndex (k : ℕ) := (k-1) / 3 +abbrev selectorDegree (k : ℕ) := k - 2 * selectorIndex k +abbrev defectThreshold (k : ℕ) := (selectorIndex k + 2).choose 2 +abbrev codimension (k : ℕ) := defectThreshold k - 2*k +abbrev sectionDimension (k : ℕ) := k^2 / 100 + +theorem size_bound {m : ℕ} (hm : 1408 ≤ m) : + 128 ≤ auxiliarySize m ∧ (m : ℝ) / 12 ≤ auxiliarySize m ∧ + 11 * auxiliarySize m ≤ m := by + dsimp [auxiliarySize] + have h : m ≤ 12 * (m / 11) := by omega + refine ⟨by omega, ?_, by omega⟩ + have hr : (m : ℝ) ≤ 12 * (m / 11 : ℕ) := by exact_mod_cast h + linarith + +theorem index_bounds {k : ℕ} (hk : 128 ≤ k) : + (k : ℝ) / 4 ≤ selectorIndex k ∧ selectorIndex k ≤ k / 2 ∧ + (k : ℝ) / 4 ≤ (selectorDegree k - 1 : ℕ) ∧ + 2 ≤ selectorDegree k := by + have hq : k ≤ 4 * selectorIndex k := by dsimp [selectorIndex]; omega + have hr : k ≤ 4 * (selectorDegree k - 1) := by + dsimp [selectorDegree, selectorIndex]; omega + refine ⟨?_, by dsimp [selectorIndex]; omega, ?_, ?_⟩ + · have hc : (k : ℝ) ≤ 4 * selectorIndex k := by exact_mod_cast hq + linarith + · have hc : (k : ℝ) ≤ 4 * (selectorDegree k - 1 : ℕ) := by exact_mod_cast hr + linarith + · dsimp [selectorDegree, selectorIndex]; omega + +theorem defect_formula (k : ℕ) : + (defectThreshold k : ℝ) = + ((selectorIndex k : ℝ)+2) * ((selectorIndex k : ℝ)+1) / 2 := by + simp only [defectThreshold, Nat.cast_choose_two, Nat.cast_add, Nat.cast_ofNat] + ring + +theorem codimension_bounds {k : ℕ} (hk : 128 ≤ k) : + (k : ℝ)^2 / 64 ≤ codimension k ∧ 1 ≤ codimension k ∧ + codimension k ≤ k^2 := by + have hkR : (128 : ℝ) ≤ k := by exact_mod_cast hk + have hq := (index_bounds hk).1 + have hq0 : (0 : ℝ) ≤ selectorIndex k := Nat.cast_nonneg _ + have hqU : (selectorIndex k : ℝ) ≤ (k : ℝ)/3 := by + have : 3 * selectorIndex k ≤ k := by dsimp [selectorIndex]; omega + have hc : (3:ℝ)*selectorIndex k ≤ k := by exact_mod_cast this + linarith + have hT := defect_formula k + have hlow : (k : ℝ)^2 / 32 ≤ defectThreshold k := by + nlinarith [sq_nonneg ((selectorIndex k : ℝ) - (k : ℝ)/4)] + have hdelta : (k : ℝ)^2/64 ≤ (defectThreshold k : ℝ) - 2*k := by + nlinarith [mul_nonneg (show 0 ≤ (k : ℝ) from by positivity) (sub_nonneg.mpr hkR)] + have hsub : 2*k ≤ defectThreshold k := by + have : (2*k : ℝ) ≤ defectThreshold k := by nlinarith [sq_nonneg (k : ℝ)] + exact_mod_cast this + have hd : (codimension k : ℝ) = (defectThreshold k : ℝ) - 2*k := by + rw [codimension, Nat.cast_sub hsub, Nat.cast_mul, Nat.cast_ofNat] + have hupper : (defectThreshold k : ℝ) < (k : ℝ)^2 := by + nlinarith [mul_nonpos_of_nonpos_of_nonneg (show (selectorIndex k : ℝ) - k/3 ≤ 0 by linarith) + (show (0:ℝ) ≤ (selectorIndex k : ℝ) + k/3 + 3 by positivity)] + refine ⟨by simpa only [hd] using hdelta, ?_, ?_⟩ + · have : (1 : ℝ) ≤ codimension k := by rw [hd]; nlinarith [sq_nonneg ((k : ℝ)-128)] + exact_mod_cast this + · have : (codimension k : ℝ) ≤ (k : ℝ)^2 := by rw [hd]; nlinarith + exact_mod_cast this + +theorem section_bounds {k : ℕ} (hk : 128 ≤ k) : + 2 ≤ sectionDimension k ∧ sectionDimension k < k^2 ∧ + sectionDimension k - 1 < codimension k ∧ + (k : ℝ)^2 / 200 ≤ (sectionDimension k - 1 : ℕ) := by + have hk2 : 16384 ≤ k^2 := by nlinarith + have hd2 : 2 ≤ sectionDimension k := by dsimp [sectionDimension]; omega + have hcast : (k : ℝ)^2 < 100*((sectionDimension k : ℝ)+1) := by + have : k^2 < 100*(sectionDimension k+1) := by dsimp [sectionDimension]; omega + exact_mod_cast this + have hcast2 : 100*(sectionDimension k : ℝ) ≤ (k : ℝ)^2 := by + have : 100*sectionDimension k ≤ k^2 := by dsimp [sectionDimension]; omega + exact_mod_cast this + have hkR : (128 : ℝ) ≤ k := by exact_mod_cast hk + have hm : ((sectionDimension k - 1 : ℕ) : ℝ) = sectionDimension k - 1 := by + rw [Nat.cast_sub (by omega), Nat.cast_one] + refine ⟨hd2, by dsimp [sectionDimension]; omega, ?_, ?_⟩ + · have hδ := (codimension_bounds hk).1 + have : ((sectionDimension k - 1 : ℕ) : ℝ) < codimension k := by + rw [hm] + nlinarith [sq_nonneg (k : ℝ)] + exact_mod_cast this + · rw [hm] + nlinarith [sq_nonneg ((k : ℝ)-128)] + +theorem explicit_constant {m : ℕ} (hm : 1408 ≤ m) : + (m : ℝ)^3 / (5529600 * Real.exp 1) ≤ + (((selectorDegree (auxiliarySize m) - 1 : ℕ) : ℝ) * + ((sectionDimension (auxiliarySize m) - 1 : ℕ) : ℝ)) / (4 * Real.exp 1) := by + let k := auxiliarySize m + have hk : 128 ≤ k := (size_bound hm).1 + have hmk : (m : ℝ)/12 ≤ k := (size_bound hm).2.1 + have hr := (index_bounds hk).2.2.1 + have hd := (section_bounds hk).2.2.2 + have hprod : (k : ℝ)^3 / 800 ≤ + ((selectorDegree k - 1 : ℕ) : ℝ) * ((sectionDimension k - 1 : ℕ) : ℝ) := by + have hmul := mul_le_mul hr hd (by positivity : (0:ℝ) ≤ (k : ℝ)^2 / 200) + (by positivity : (0:ℝ) ≤ ((selectorDegree k - 1 : ℕ) : ℝ)) + nlinarith + have hcubes : (m : ℝ)^3 ≤ 1728 * (k : ℝ)^3 := by + have := pow_le_pow_left₀ (by positivity : (0:ℝ) ≤ (m:ℝ)) + (show (m : ℝ) ≤ 12 * k by linarith) 3 + nlinarith + have he := Real.exp_pos (1 : ℝ) + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + dsimp [k] at hprod hcubes ⊢ + nlinarith + +end PermanentBorder.Parameters + +namespace PermanentBorder +open MvPolynomial +lemma SliceParameters.linearSection_eq_affineSubstitution {α β : Type*} + [Fintype β] (H : α × β → ℂ) : + SliceParameters.linearSection H = affineSubstitution (fun _ => 0) (fun i j => H (i,j)) := by + apply MvPolynomial.algHom_ext + intro i + simp [SliceParameters.linearSection,SliceParameters.sectionForm,affineSubstitution] + +theorem HasBorderDeterminant.selector_lower_of_critical_dimension + {K : Type} [Field K] {m n k q d B : ℕ} + (h : HasBorderDeterminant n (permanentPolynomial m)) + (hk : 0 < k) (hq : q ≤ k) (hr : 2 ≤ k-2*q) (hd : 2 ≤ d) + (hm : 11*k-2*q ≤ m) (θ : Fin k → K) + (hdim : ringKrullDim (MvPolynomial (Variables k) K ⧸ + Ideal.span (Set.range (fun i => pderiv i + (Selector.diagonalCoefficient + (Matrix.of fun a b => (X (a,b) : MvPolynomial (Variables k) K)) + (fun i => C (θ i)) q)))) ≤ B) + (hB : B+(d-1) < k^2) : + (((k-2*q-1 : ℕ) : ℝ) * ((d-1 : ℕ) : ℝ)) / (4*Real.exp 1) ≤ n := by + classical + have hk2 : 0 < k^2 := pow_pos hk _ + have hc : Fintype.card (Variables k) = k^2 := by simp [Variables,pow_two] + have hv : Fintype.card (Variables k) = (k^2-1)+1 := by omega + let F : MvPolynomial (Variables k) (MvPolynomial (Fin k) ℤ) := + Selector.integralCoefficientFamily k q + have hd' : ringKrullDim (MvPolynomial (Variables k) K ⧸ + Ideal.span (Set.range (fun i => pderiv i + (map (eval₂Hom (Int.castRingHom K) θ) F)))) ≤ B := by + rw [show map (eval₂Hom (Int.castRingHom K) θ) F = + Selector.diagonalCoefficient + (Matrix.of fun a b => (X (a,b) : MvPolynomial (Variables k) K)) + (fun i => C (θ i)) q from Selector.integralCoefficientFamily_specialize k q θ] + exact hdim + have hFne := SliceParameters.nonzero_of_gradientDimension + (map (eval₂Hom (Int.castRingHom K) θ) F) B hd' (by omega : B < Fintype.card (Variables k)) + obtain ⟨t,H,hs⟩ := SliceParameters.exists_complex_smooth_section_finite hv F + (Selector.integralCoefficientFamily_homogeneous k q) θ hFne hd' + (by omega : B+(d-1) < (k^2-1)+1) + have hb := (h.coefficientPolynomial hq hm t).affineSubstitution + (fun _ => 0) (fun i j => H (i,j)) + rw [← SliceParameters.linearSection_eq_affineSubstitution, + ← Selector.integralCoefficientFamily_complex] at hb + have he := Polar.HasBorderDeterminant.smooth_lower_bound hb + (by simpa only [Fintype.card_fin] using (show 2 ≤ d-1+1 by omega)) hr hs.2.1 hs.2.2 + simpa only [Fintype.card_fin,Nat.add_sub_cancel] using he +end PermanentBorder + +namespace PermanentBorder +open MvPolynomial Parameters + +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/ConductorBounds.lean b/lean/OAI/Algebra/Determinantal/ConductorBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7ab271f4d6701508bafc5085d1d75f4a794e2da --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/ConductorBounds.lean @@ -0,0 +1,451 @@ +import OAI.Algebra.Determinantal.Normalization + +namespace OAI + +namespace PermanentBorder.Conductor +section Coordinate +variable {O L ι : Type*} [CommRing O] [IsDomain O] [IsPrincipalIdealRing O] + [Field L] [Algebra O L] [IsFractionRing O L] [Finite ι] + +theorem principal_coordinate (w : ι → L) (hw : ∃ i, w i ≠ 0) : + ∃ g : L, g ≠ 0 ∧ ∃ c : ι → O, + (∀ i, w i = algebraMap O L (c i) * g) ∧ Ideal.span (Set.range c) = ⊤ := by + classical + let M := Submodule.span O (Set.range w) + have hfg : M.FG := Submodule.fg_span (Set.finite_range w) + let I : FractionalIdeal (nonZeroDivisors O) L := + ⟨M, FractionalIdeal.isFractional_of_fg hfg⟩ + have : M.IsPrincipal := FractionalIdeal.isPrincipal I + let g := Submodule.IsPrincipal.generator M + have hg : g ≠ 0 := by + intro hz + have hm : M = ⊥ := (Submodule.IsPrincipal.eq_bot_iff_generator_eq_zero M).mpr hz + obtain ⟨i, hi⟩ := hw + apply hi + have hwi : w i ∈ M := Submodule.subset_span (Set.mem_range_self i) + simpa [hm] using hwi + have hc (i : ι) : ∃ c : O, w i = c • g := + (Submodule.IsPrincipal.mem_iff_eq_smul_generator M).mp + (Submodule.subset_span (Set.mem_range_self i)) + choose c hc using hc + refine ⟨g, hg, c, (fun i => by simpa [Algebra.smul_def] using hc i), ?_⟩ + let J := Ideal.span (Set.range c) + have hrep (x : L) (hx : x ∈ M) : ∃ a : O, a ∈ J ∧ x = a • g := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨i, rfl⟩ := hx + exact ⟨c i, Ideal.subset_span (Set.mem_range_self i), hc i⟩ + | zero => exact ⟨0, J.zero_mem, by simp⟩ + | add x y _ _ hx hy => + obtain ⟨a, ha, rfl⟩ := hx + obtain ⟨b, hb, rfl⟩ := hy + exact ⟨a + b, J.add_mem ha hb, (add_smul _ _ _).symm⟩ + | smul a x _ hx => + obtain ⟨b, hb, rfl⟩ := hx + exact ⟨a * b, J.mul_mem_left a hb, (mul_smul _ _ _).symm⟩ + obtain ⟨a, ha, he⟩ := hrep g (Submodule.IsPrincipal.generator_mem M) + have he' : algebraMap O L a = 1 := by + apply (mul_right_inj' hg).mp + simpa [Algebra.smul_def, mul_comm] using he.symm + have ha1 : a = 1 := (IsFractionRing.injective O L) (by simpa using he') + exact Ideal.eq_top_of_isUnit_mem J (ha1 ▸ ha) isUnit_one +end Coordinate + +open scoped BigOperators +section GenericCombination +variable {K O ι γ : Type*} [Field K] [Infinite K] [CommRing O] [Algebra K O] + [Fintype ι] [Finite γ] [Finite (MaximalSpectrum O)] + +theorem simultaneous_unit_combination (v : γ → ι → O) + (hv : ∀ j, Ideal.span (Set.range (v j)) = ⊤) : + ∃ a : ι → K, ∀ j, IsUnit (∑ i, algebraMap K O (a i) * v j i) := by + classical + let ℓ (j : γ) : (ι → K) →ₗ[K] O := + { toFun := fun a => ∑ i, a i • v j i + map_add' := by intro a b; simp [add_smul, Finset.sum_add_distrib] + map_smul' := by intro c a; simp [smul_smul, Finset.smul_sum] } + let p (j : γ × MaximalSpectrum O) : Submodule K (ι → K) := + (j.2.asIdeal.restrictScalars K).comap (ℓ j.1) + have hp (j : γ × MaximalSpectrum O) : p j ≠ ⊤ := by + intro h + have hm : Ideal.span (Set.range (v j.1)) ≤ j.2.asIdeal := by + apply Ideal.span_le.mpr + rintro _ ⟨i, rfl⟩ + have ht : Pi.single i (1 : K) ∈ p j := by rw [h]; trivial + change (∑ t, (Pi.single i (1 : K) : ι → K) t • v j.1 t) ∈ j.2.asIdeal at ht + simpa using ht + rw [hv] at hm + exact j.2.isMaximal.ne_top (top_le_iff.mp hm) + obtain ⟨a, ha⟩ := Submodule.exists_forall_notMem_of_forall_ne_top p hp + refine ⟨a, fun j => ?_⟩ + by_contra hu + obtain ⟨M, hM, hvM⟩ := exists_max_ideal_of_mem_nonunits hu + exact ha (j, ⟨M, hM⟩) (by simpa only [p, Submodule.mem_comap, + Submodule.restrictScalars_mem, LinearMap.coe_mk, AddHom.coe_mk, ℓ, + Algebra.smul_def] using hvM) +end GenericCombination + +section Ratios +variable {K O L ι γ : Type*} [Field K] [Infinite K] + [CommRing O] [IsDomain O] [IsPrincipalIdealRing O] [Algebra K O] + [Field L] [Algebra O L] [IsFractionRing O L] [Algebra K L] [IsScalarTower K O L] + [Fintype ι] [Finite γ] [Finite (MaximalSpectrum O)] + +theorem simultaneous_coordinate_generator (w : ι → γ → L) + (hw : ∀ j, ∃ i, w i j ≠ 0) : + ∃ a : ι → K, + (∀ j, (∑ i, algebraMap K L (a i) * w i j) ≠ 0) ∧ + ∀ i j, ∃ c : O, w i j = algebraMap O L c * + (∑ t, algebraMap K L (a t) * w t j) := by + classical + choose g hg c hc hspan using fun j => principal_coordinate (O := O) (fun i => w i j) (hw j) + obtain ⟨a, ha⟩ := simultaneous_unit_combination (K := K) c hspan + let u (j : γ) : Oˣ := (ha j).unit + have hu (j : γ) : (u j : O) = ∑ i, algebraMap K O (a i) * c j i := (ha j).unit_spec + have hh (j : γ) : (∑ i, algebraMap K L (a i) * w i j) = + algebraMap O L (u j) * g j := by + rw [hu, map_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + rw [map_mul, ← IsScalarTower.algebraMap_apply K O L, hc] + ring + refine ⟨a, fun j => ?_, fun i j => ?_⟩ + · rw [hh] + exact mul_ne_zero ((u j).isUnit.map (algebraMap O L)).ne_zero (hg j) + · refine ⟨c j i * ↑(u j)⁻¹, ?_⟩ + rw [hh, hc, map_mul] + have hi : algebraMap O L (↑(u j)⁻¹ : O) * algebraMap O L (u j) = 1 := by + rw [← map_mul, Units.inv_mul, map_one] + calc + algebraMap O L (c j i) * g j = + algebraMap O L (c j i) * (1 * g j) := by rw [one_mul] + _ = _ := by rw [← hi]; ring +end Ratios +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +section Coordinates +variable {S A L γ : Type*} [CommRing S] [CommRing A] [Field L] + [Algebra S A] [Algebra S L] [Finite γ] + [Module.Finite S (integralClosure S L)] + +theorem isIntegral_of_coordinates (f : A →ₐ[S] (γ → L)) + (hf : Function.Injective f) {x : A} (hx : ∀ j, IsIntegral S (f x j)) : + IsIntegral S x := by + let z : γ → integralClosure S L := fun j => ⟨f x j, hx j⟩ + let ρ : (γ → integralClosure S L) →ₐ[S] (γ → L) := + AlgHom.pi fun j => (integralClosure S L).val.comp + (Pi.evalAlgHom S (fun _ : γ => integralClosure S L) j) + have hz : IsIntegral S z := Algebra.IsIntegral.isIntegral z + have hr : ρ z = f x := rfl + exact (isIntegral_algHom_iff f hf).mp (hr ▸ hz.map ρ) +end Coordinates + +section UnitCoordinates +variable {Q A L γ : Type*} [Field Q] [CommRing A] [Field L] + [Algebra Q A] [Algebra Q L] [Module.Finite Q A] + +theorem isUnit_of_coordinates (f : A →ₐ[Q] (γ → L)) + (hf : Function.Injective f) {x : A} (hx : ∀ j, f x j ≠ 0) : IsUnit x := by + have : IsArtinianRing A := IsArtinianRing.of_finite Q A + apply IsArtinianRing.isUnit_of_mem_nonZeroDivisors + rw [mem_nonZeroDivisors_iff_right] + intro z hz + apply hf + ext j + have h := congrFun (congrArg f hz) j + simpa only [map_mul, map_zero, Pi.mul_apply, Pi.zero_apply, + mul_eq_zero, hx j, or_false] using h +end UnitCoordinates +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open scoped BigOperators +section NormalizedLattice +variable {K S Q A L ι γ : Type*} [Field K] [Infinite K] + [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] [IsLocalRing S] [Algebra K S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + [CommRing A] [Algebra Q A] [Algebra S A] [IsScalarTower S Q A] + [Field L] [Algebra Q L] [Algebra S L] [IsScalarTower S Q L] + [Algebra K L] [IsScalarTower K S L] + [Module.Finite Q A] [FiniteDimensional Q L] [Algebra.IsSeparable Q L] + [Fintype ι] [Finite γ] + +include K in + +theorem exists_normalizing_lattice_element (f : A →ₐ[Q] (γ → L)) + (hf : Function.Injective f) (l : ι → A) + (hl : ∀ j, ∃ i, f (l i) j ≠ 0) : + ∃ u : Aˣ, (u : A) ∈ Submodule.span S (Set.range l) ∧ + ∀ x ∈ Submodule.span S (Set.range l), IsIntegral S ((↑u⁻¹ : A) * x) := by + classical + let O := integralClosure S L + have : Module.Finite S O := IsIntegralClosure.finite S Q L O + have : IsPrincipalIdealRing O := integralClosure_isPrincipalIdealRing (Q := Q) + have : Finite (MaximalSpectrum O) := finite_maximalSpectrum_of_finite_local (S := S) + have : IsFractionRing O L := IsIntegralClosure.isFractionRing_of_finite_extension S Q L O + let : Algebra K O := ((integralClosure S L).restrictScalars K).algebra + have : IsScalarTower K O L := IsScalarTower.of_algebraMap_eq fun x => rfl + obtain ⟨a, ha, hrat⟩ := simultaneous_coordinate_generator (K := K) (O := O) + (fun i j => f (l i) j) hl + let h : A := ∑ i, algebraMap K S (a i) • l i + have hh (j : γ) : f h j = ∑ i, algebraMap K L (a i) * f (l i) j := by + change (f.restrictScalars S) h j = _ + simp [h, Algebra.smul_def, ← IsScalarTower.algebraMap_apply K S L] + have hu : IsUnit h := isUnit_of_coordinates f hf (fun j => hh j ▸ ha j) + let u := hu.unit + have huval : (u : A) = h := hu.unit_spec + have hmem : h ∈ Submodule.span S (Set.range l) := by + apply Submodule.sum_mem + intro i _ + exact Submodule.smul_mem _ _ (Submodule.subset_span (Set.mem_range_self i)) + refine ⟨u, huval.symm ▸ hmem, ?_⟩ + have hli (i : ι) : IsIntegral S ((↑u⁻¹ : A) * l i) := by + apply isIntegral_of_coordinates (f.restrictScalars S) hf + intro j + obtain ⟨c, hc⟩ := hrat i j + have he : f ((↑u⁻¹ : A) * l i) j = algebraMap O L c := by + rw [map_mul, Pi.mul_apply, hc, ← hh j, ← huval] + have hinv : f (↑u⁻¹ : A) j * f (u : A) j = 1 := by + have hi := congrFun (congrArg f (Units.inv_mul u)) j + simpa only [map_mul, map_one, Pi.mul_apply, Pi.one_apply] using hi + calc + f (↑u⁻¹ : A) j * (algebraMap O L c * f (u : A) j) = + algebraMap O L c * (f (↑u⁻¹ : A) j * f (u : A) j) := by ring + _ = algebraMap O L c := by rw [hinv, mul_one] + change IsIntegral S (f ((↑u⁻¹ : A) * l i) j) + rw [he] + exact c.property + intro x hx + induction hx using Submodule.span_induction with + | mem x hx => obtain ⟨i, rfl⟩ := hx; exact hli i + | zero => simpa using (isIntegral_zero : IsIntegral S (0 : A)) + | add x y _ _ hx hy => simpa only [mul_add] using hx.add hy + | smul s x _ hx => + simpa only [mul_smul_comm] using hx.smul s +end NormalizedLattice +end PermanentBorder.Conductor +namespace PermanentBorder.Conductor +open Polynomial Matrix Module +section MatrixGenerators +variable {K S Q ι : Type*} [Field K] [Infinite K] + [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] [IsLocalRing S] [Algebra K S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + [Fintype ι] [DecidableEq ι] + +include K in + +theorem exists_normalizing_matrix_generators (T : Matrix ι ι S) + (hsep : (T.charpoly.map (algebraMap S Q)).Separable) : + ∃ (l : ι → AdjoinRoot (T.charpoly.map (algebraMap S Q))) + (u : (AdjoinRoot (T.charpoly.map (algebraMap S Q)))ˣ), + (∀ j, genericBaseChange (Q := Q) T.charpoly (AdjoinRoot.root T.charpoly) * l j = + ∑ i, algebraMap S (AdjoinRoot (T.charpoly.map (algebraMap S Q))) (T i j) * l i) ∧ + (u : AdjoinRoot (T.charpoly.map (algebraMap S Q))) ∈ + Submodule.span S (Set.range l) ∧ + ∀ x ∈ Submodule.span S (Set.range l), IsIntegral S ((↑u⁻¹) * x) := by + classical + let : Algebra K Q := ((algebraMap S Q).comp (algebraMap K S)).toAlgebra + let : IsScalarTower K S Q := IsScalarTower.of_algebraMap_eq fun x => rfl + have : Infinite Q := Infinite.of_injective (algebraMap K Q) (algebraMap K Q).injective + let f := T.charpoly.map (algebraMap S Q) + let A := AdjoinRoot f + let L := f.SplittingField + have : IsScalarTower K S L := IsScalarTower.of_algebraMap_eq fun x => by + rw [IsScalarTower.algebraMap_apply K Q L, IsScalarTower.algebraMap_apply S Q L, + IsScalarTower.algebraMap_apply K S Q] + have : Module.Finite Q A := (T.charpoly_monic.map _).finite_adjoinRoot + have : Algebra.IsSeparable Q L := Algebra.isSeparable_of_separable_splitting_field Q L hsep + obtain ⟨e, he⟩ : ∃ e : (ι → Q) ≃ₗ[Q] A, + ∀ x, e ((T.map (algebraMap S Q)) *ᵥ x) = AdjoinRoot.root f * e x := by + have hs : (T.map (algebraMap S Q)).charpoly.Separable := by + simpa only [charpoly_map] using hsep + obtain ⟨e₀, he₀⟩ := exists_generic_matrix_equiv (T.map (algebraMap S Q)) hs + let a := AdjoinRoot.algEquivOfEq Q (T.map (algebraMap S Q)).charpoly f + (charpoly_map T (algebraMap S Q)) + refine ⟨e₀.trans a.toLinearEquiv, fun x => ?_⟩ + change a (e₀ _) = AdjoinRoot.root f * a (e₀ x) + rw [he₀, map_mul, show a (AdjoinRoot.root (T.map (algebraMap S Q)).charpoly) = + AdjoinRoot.root f from AdjoinRoot.algEquivOfEq_root (R := Q) _ _ _] + let l : ι → A := fun i => e (Pi.single i 1) + have hsum (x : ι → Q) : e x = ∑ i, x i • l i := by + have hx : x = ∑ i, x i • Pi.single i (1 : Q) := by + ext j; simp [Pi.single_apply] + conv_lhs => rw [hx] + simp only [map_sum, map_smul, l] + have hl (j : f.rootSet L) : ∃ i, rootEvaluation (f := f) (L := L) (l i) j ≠ 0 := by + by_contra hn + push Not at hn + have h := congrFun (congrArg (rootEvaluation (f := f) (L := L)) (hsum (e.symm 1))) j + rw [e.apply_symm_apply] at h + simp [hn] at h + obtain ⟨u, hu, hnorm⟩ := exists_normalizing_lattice_element (K := K) (S := S) + (rootEvaluation (f := f) (L := L)) + (rootEvaluation_injective (T.charpoly_monic.map _) hsep (SplittingField.splits f)) l hl + refine ⟨l, u, ?_, hu, hnorm⟩ + intro j + have hg : genericBaseChange (Q := Q) T.charpoly (AdjoinRoot.root T.charpoly) = + AdjoinRoot.root f := by + simpa only [AdjoinRoot.root, Polynomial.map_X] using + genericBaseChange_mk (Q := Q) T.charpoly X + rw [hg, ← he, hsum] + apply Finset.sum_congr rfl + intro i hi + simp only [Matrix.mulVec_single, MulOpposite.op_one, one_smul, Matrix.col_apply, + Matrix.map_apply, Algebra.smul_def, ← IsScalarTower.algebraMap_apply S Q A] + rfl +end MatrixGenerators +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Matrix Polynomial + +section MatrixFactorization +variable {R ι : Type*} [CommRing R] [IsDomain R] + [Fintype ι] [DecidableEq ι] + +abbrev DetQuotient (M : Matrix ι ι R) := R ⧸ Ideal.span {M.det} + +theorem kernel_eq_adjugate_image (M : Matrix ι ι R) (hM : M.det ≠ 0) + (v : ι → DetQuotient M) : + (M.map (Ideal.Quotient.mk (Ideal.span {M.det}))) *ᵥ v = 0 ↔ + ∃ w : ι → DetQuotient M, + (M.adjugate.map (Ideal.Quotient.mk (Ideal.span {M.det}))) *ᵥ w = v := by + classical + let π : R →+* DetQuotient M := Ideal.Quotient.mk _ + constructor + · intro hv + change (M.map π) *ᵥ v = 0 at hv + obtain ⟨b, hb⟩ : ∃ b : ι → R, ∀ i, π (b i) = v i := by + choose b hb using (fun i => Ideal.Quotient.mk_surjective (v i)) + exact ⟨b, hb⟩ + have hdiv (i : ι) : M.det ∣ (M *ᵥ b) i := by + apply Ideal.mem_span_singleton.mp + apply Ideal.Quotient.eq_zero_iff_mem.mp + have hm := π.map_mulVec M b i + rw [show (π ∘ b) = v by funext j; exact hb j] at hm + simpa only [hv, Pi.zero_apply, Function.comp_apply] using hm + choose c hc using hdiv + have hMc : M *ᵥ b = M.det • c := by funext i; exact hc i + have hid : M.det • b = M.det • (M.adjugate *ᵥ c) := by + calc + M.det • b = M.adjugate *ᵥ (M *ᵥ b) := by + rw [mulVec_mulVec, adjugate_mul, smul_mulVec, one_mulVec] + _ = M.det • (M.adjugate *ᵥ c) := by rw [hMc, mulVec_smul] + have hb' : M.adjugate *ᵥ c = b := by + funext i + exact (mul_left_cancel₀ hM (congrFun hid i)).symm + refine ⟨π ∘ c, ?_⟩ + funext i + change (M.adjugate.map π *ᵥ (π ∘ c)) i = v i + rw [← π.map_mulVec, hb'] + exact hb i + · rintro ⟨w, rfl⟩ + change (M.map π) *ᵥ ((M.adjugate.map π) *ᵥ w) = 0 + rw [mulVec_mulVec, ← Matrix.map_mul, mul_adjugate] + have hd : π M.det = 0 := Ideal.Quotient.eq_zero_iff_mem.mpr + (Ideal.subset_span (Set.mem_singleton M.det)) + have hz : (M.det • (1 : Matrix ι ι R)).map π = 0 := by + ext i j + simp only [Matrix.map_apply, Matrix.smul_apply, smul_eq_mul, map_mul, hd, zero_mul, + Matrix.zero_apply] + rw [hz, zero_mulVec] + +theorem row_kernel_eq_adjugate_image (M : Matrix ι ι R) (hM : M.det ≠ 0) + (v : ι → DetQuotient M) : + v ᵥ* (M.map (Ideal.Quotient.mk (Ideal.span {M.det}))) = 0 ↔ + ∃ w : ι → DetQuotient M, + w ᵥ* (M.adjugate.map (Ideal.Quotient.mk (Ideal.span {M.det}))) = v := by + have ht := kernel_eq_adjugate_image Mᵀ (by simpa using hM) + dsimp only [DetQuotient] at ht + rw [det_transpose] at ht + simp only [← adjugate_transpose, Matrix.transpose_map, mulVec_transpose] at ht + exact ht v + +end MatrixFactorization + +end PermanentBorder.Conductor +namespace PermanentBorder.Conductor +open Matrix Polynomial +section +variable {S ι A : Type*} [CommRing S] [IsDomain S] + [Fintype ι] [DecidableEq ι] [CommRing A] [Algebra S A] + +def matrixEntryIdeal {B : Type*} [CommRing B] (N : Matrix ι ι B) : Ideal B := + Ideal.span (Set.range (fun ij : ι × ι => N ij.1 ij.2)) + +omit [Fintype ι] [DecidableEq ι] in +theorem entry_mem_matrixEntryIdeal {B : Type*} [CommRing B] + (N : Matrix ι ι B) (i j : ι) : N i j ∈ matrixEntryIdeal N := + Ideal.subset_span ⟨(i,j), rfl⟩ + +omit [IsDomain S] in +theorem mapped_charmatrix (T : Matrix ι ι S) : + T.charmatrix.map (AdjoinRoot.mk T.charpoly) = + Matrix.scalar ι (AdjoinRoot.root T.charpoly) - + T.map (algebraMap S (AdjoinRoot T.charpoly)) := by + ext i j + simp only [charmatrix, Matrix.map_apply, Matrix.sub_apply, map_sub, + Matrix.scalar_apply, Matrix.diagonal_apply, AdjoinRoot.root] + split_ifs <;> rfl + +theorem conductor_mem_adjugate_of_lattice (T : Matrix ι ι S) + (g : AdjoinRoot T.charpoly →ₐ[S] A) (hg : Function.Injective g) + (l : ι → A) + (hl : ∀ j, g (AdjoinRoot.root T.charpoly) * l j = + ∑ i, algebraMap S A (T i j) * l i) + (u : Aˣ) (hu : (u : A) ∈ Submodule.span S (Set.range l)) + (hnorm : ∀ x ∈ Submodule.span S (Set.range l), IsIntegral S ((↑u⁻¹ : A) * x)) + (a : AdjoinRoot T.charpoly) + (ha : ∀ x : A, IsIntegral S x → ∃ b : AdjoinRoot T.charpoly, + g b = g a * x) : + a ∈ matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)) := by + classical + have hex (i : ι) : ∃ r : AdjoinRoot T.charpoly, + g r = g a * ((↑u⁻¹ : A) * l i) := + ha _ (hnorm _ (Submodule.subset_span ⟨i, rfl⟩)) + choose r hr using hex + have hrow : r ᵥ* T.charmatrix.map (AdjoinRoot.mk T.charpoly) = 0 := by + rw [mapped_charmatrix, vecMul_sub] + apply sub_eq_zero.mpr + ext j + simp only [scalar_apply] + rw [vecMul_diagonal] + simp only [vecMul, dotProduct] + apply hg + simp only [map_mul, map_sum, hr, AlgHom.commutes, Matrix.map_apply] + calc + (g a * ((↑u⁻¹ : A) * l j)) * g (AdjoinRoot.root T.charpoly) = + (g a * (↑u⁻¹ : A)) * (g (AdjoinRoot.root T.charpoly) * l j) := by ring + _ = (g a * (↑u⁻¹ : A)) * ∑ i, algebraMap S A (T i j) * l i := by rw [hl] + _ = ∑ i, (g a * ((↑u⁻¹ : A) * l i)) * algebraMap S A (T i j) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + ring + obtain ⟨w, hw⟩ := (row_kernel_eq_adjugate_image T.charmatrix T.charpoly_monic.ne_zero r).mp hrow + have hrmem (j : ι) : r j ∈ + matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)) := by + rw [← hw] + exact Ideal.sum_mem _ (fun i _ => + Ideal.mul_mem_left _ (w i) (entry_mem_matrixEntryIdeal _ i j)) + obtain ⟨c, hc⟩ := (Submodule.mem_span_range_iff_exists_fun S).mp hu + have hae : a = ∑ i, algebraMap S (AdjoinRoot T.charpoly) (c i) * r i := by + apply hg + simp only [map_sum, map_mul, AlgHom.commutes, hr] + have hc' : ∑ i, algebraMap S A (c i) * l i = (u : A) := by + simpa only [Algebra.smul_def] using hc + calc + g a = (g a * (↑u⁻¹ : A)) * (u : A) := by simp [mul_assoc] + _ = (g a * (↑u⁻¹ : A)) * ∑ i, algebraMap S A (c i) * l i := by rw [hc'] + _ = ∑ i, algebraMap S A (c i) * (g a * ((↑u⁻¹ : A) * l i)) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + ring + rw [hae] + exact Ideal.sum_mem _ (fun i _ => Ideal.mul_mem_left _ _ (hrmem i)) +end +end PermanentBorder.Conductor + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/ConductorDimension.lean b/lean/OAI/Algebra/Determinantal/ConductorDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f16c205eaca69ee4816172f60e2d0562208c9c1 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/ConductorDimension.lean @@ -0,0 +1,474 @@ +import OAI.Algebra.Determinantal.WildParameters + +namespace OAI +namespace PermanentBorder.CurveFamily +open MvPolynomial Module FrobeniusPlane +open scoped Classical +variable {K : Type*} [Field K] [CharP K 2] + +noncomputable def singularIdeal (f : Plane K) : Ideal (Plane K) := + Ideal.span {f,pderiv 0 f,pderiv 1 f} + +omit [CharP K 2] in +lemma singular_zero_iff (f : Plane K) (x : Fin 2 → K) : + x ∈ zeroLocus K (singularIdeal f) ↔ + eval x f=0 ∧ eval x (pderiv 0 f)=0 ∧ eval x (pderiv 1 f)=0 := by + change singularIdeal f ≤ RingHom.ker (aeval x) ↔ _ + rw [singularIdeal,Ideal.span_le] + simp only [Set.insert_subset_iff,Set.singleton_subset_iff] + rfl + +lemma singular_add_square_eq (a b c d : Plane K) : + singularIdeal (squareForm a b c d) ⊔ Ideal.span {d^2} = Ideal.span {a^2,b^2,c^2,d^2} := by + rw [← wild_ideal_eq, squareForm_mixed,singularIdeal,← Ideal.span_union] + congr 1 + ext p + simp only [Set.mem_union,Set.mem_insert_iff,Set.mem_singleton_iff] + tauto + +lemma singular_wild_card_le (a b c d : Plane K) + [Fintype (zeroLocus K (singularIdeal (squareForm a b c d)))] + [Module.Finite K (Plane K ⧸ halfIdeal a b c d)] : + Fintype.card {x : zeroLocus K (singularIdeal (squareForm a b c d)) // eval x.val d=0} ≤ + finrank K (Plane K ⧸ halfIdeal a b c d) := by + classical + let := finite_zeroLocus (halfIdeal a b c d) + let := Fintype.ofFinite (zeroLocus K (halfIdeal a b c d)) + let v : {x : zeroLocus K (singularIdeal (squareForm a b c d)) // eval x.val d=0} → + zeroLocus K (halfIdeal a b c d) := fun x => ⟨x.val.val,by + have h := (singular_zero_iff _ _).mp x.val.property + have h' := (wild_zero_iff a b c d x.val.val).mp + ⟨h.1,h.2.1,h.2.2,by rw [squareForm_mixed,map_pow,x.property]; simp⟩ + change halfIdeal a b c d ≤ RingHom.ker (aeval x.val.val) + rw [halfIdeal,Ideal.span_le] + simp only [Set.insert_subset_iff,Set.singleton_subset_iff] + exact h'⟩ + have hv : Function.Injective v := by + intro x y hxy + apply Subtype.ext + apply Subtype.ext + exact congrArg (fun z : zeroLocus K (halfIdeal a b c d) => z.val) hxy + exact (Fintype.card_le_of_injective v hv).trans (zero_card_le_finrank _) + +lemma singular_point_card_le (a b c d : Plane K) + [Fintype (zeroLocus K (singularIdeal (squareForm a b c d)))] + [Module.Finite K (Plane K ⧸ halfIdeal a b c d)] : + Fintype.card (zeroLocus K (singularIdeal (squareForm a b c d))) ≤ + finrank K (Plane K ⧸ halfIdeal a b c d) + + Fintype.card {x : zeroLocus K (singularIdeal (squareForm a b c d)) // eval x.val d≠0} := by + classical + have h := singular_wild_card_le a b c d + have he := Fintype.card_congr (Equiv.sumCompl + (fun x : zeroLocus K (singularIdeal (squareForm a b c d)) => eval x.val d=0)) + rw [Fintype.card_sum] at he + simp only [ne_eq] at * + omega + +theorem singular_enlarged_length [IsAlgClosed K] [PerfectRing K 2] + (a b c d : Plane K) + [Fintype (zeroLocus K (singularIdeal (squareForm a b c d)))] + [Module.Finite K (Plane K ⧸ halfIdeal a b c d)] : + let I := singularIdeal (squareForm a b c d) + Module.length K (Plane K ⧸ (I ⊔ Ideal.span {d^2}*I.radical)) ≤ + (5*finrank K (Plane K ⧸ halfIdeal a b c d) + + Fintype.card {x : zeroLocus K I // eval x.val d≠0} : ℕ) := by + intro I + have hF := frobenius_quotient_bound (halfIdeal a b c d) (I ⊔ Ideal.span {d^2}) (by + intro p hp + rw [singular_add_square_eq] + simpa only [Set.image_insert_eq,Set.image_singleton] using + square_mem_of_mem_span {a,b,c,d} hp) + obtain ⟨hfinite,hbound⟩ := hF + let := hfinite + have hrad := radical_length_eq_zero_card I + have hpoint := singular_point_card_le a b c d + calc + _ ≤ Module.length K (Plane K ⧸ (I ⊔ Ideal.span {d^2})) + + Module.length K (Plane K ⧸ I.radical) := + IdealColength.quotient_product_length I I.radical (d^2) + _ = (finrank K (Plane K ⧸ (I ⊔ Ideal.span {d^2})) + + Fintype.card (zeroLocus K I) : ℕ) := by rw [Module.length_eq_finrank,hrad]; simp + _ ≤ _ := by exact_mod_cast (show finrank K (Plane K ⧸ (I ⊔ Ideal.span {d^2})) + + Fintype.card (zeroLocus K I) ≤ _ by + dsimp [I] at * + omega) + +end PermanentBorder.CurveFamily + +namespace PermanentBorder.PlaneBivariate +open Polynomial MvPolynomial +variable (K : Type*) [Field K] + +noncomputable def toBivariate : MvPolynomial (Fin 2) K →ₐ[K] K[X][X] := + aeval ![Polynomial.C Polynomial.X,Polynomial.X] + +noncomputable def fromBivariate : K[X][X] →ₐ[K] MvPolynomial (Fin 2) K := + Polynomial.eval₂AlgHom (Polynomial.aeval (X 0)) (X 1) (fun _ => Commute.all _ _) + +@[simp] lemma to_zero : toBivariate K (X 0)=Polynomial.C Polynomial.X := by simp [toBivariate] +@[simp] lemma to_one : toBivariate K (X 1)=Polynomial.X := by simp [toBivariate] +@[simp] lemma to_C (c : K) : toBivariate K (C c)=Polynomial.C (Polynomial.C c) := by + simp [toBivariate] +@[simp] lemma from_X : fromBivariate K Polynomial.X=X 1 := by simp [fromBivariate] +@[simp] lemma from_C_X : fromBivariate K (Polynomial.C Polynomial.X)=X 0 := by simp [fromBivariate] +@[simp] lemma from_C_C (c : K) : fromBivariate K (Polynomial.C (Polynomial.C c))=MvPolynomial.C c := by + simp [fromBivariate] + +lemma from_to : (fromBivariate K).comp (toBivariate K) = AlgHom.id K _ := by + ext i + fin_cases i <;> simp + +lemma to_from : (toBivariate K).comp (fromBivariate K) = AlgHom.id K _ := by + apply Polynomial.algHom_ext' + · apply Polynomial.algHom_ext + simp + · simp + +noncomputable def equiv : MvPolynomial (Fin 2) K ≃ₐ[K] K[X][X] := + AlgEquiv.ofAlgHom (toBivariate K) (fromBivariate K) (to_from K) (from_to K) + +@[simp] lemma equiv_apply (p : MvPolynomial (Fin 2) K) : equiv K p=toBivariate K p := rfl +@[simp] lemma equiv_symm_apply (p : K[X][X]) : (equiv K).symm p=fromBivariate K p := rfl + +lemma derivative_to (p : MvPolynomial (Fin 2) K) : + Polynomial.derivative (toBivariate K p) = toBivariate K (pderiv 1 p) := by + induction p using MvPolynomial.induction_on with + | C c => simp + | add p q hp hq => simp only [map_add,hp,hq] + | mul_X p i hp => + rw [map_mul,Polynomial.derivative_mul,pderiv_mul,map_add,map_mul] + fin_cases i <;> simp [hp] + +lemma map_to {L : Type*} [Field L] [Algebra K L] (p : MvPolynomial (Fin 2) K) : + toBivariate L (p.map (algebraMap K L)) = + (toBivariate K p).map (Polynomial.mapRingHom (algebraMap K L)) := by + induction p using MvPolynomial.induction_on with + | C c => simp + | add p q hp hq => simp only [map_add,Polynomial.map_add,hp,hq] + | mul_X p i hp => + simp only [map_mul,Polynomial.map_mul,MvPolynomial.map_X,hp] + fin_cases i <;> simp + +end PermanentBorder.PlaneBivariate + +namespace PermanentBorder.PlaneScaling +open Polynomial MvPolynomial +variable {K σ : Type*} [Field K] + +noncomputable def scale : MvPolynomial σ K →ₐ[K] (MvPolynomial σ K)[X] := + MvPolynomial.aeval (fun i => Polynomial.C (MvPolynomial.X i)*Polynomial.X) + +lemma scale_monomial (s : σ →₀ ℕ) (c : K) : + scale (MvPolynomial.monomial s c) = + Polynomial.monomial s.degree (MvPolynomial.monomial s c) := by + classical + simp only [scale,MvPolynomial.aeval_def,MvPolynomial.eval₂_monomial, + mul_pow,Finsupp.prod,Finset.prod_mul_distrib,← map_pow,← map_prod, + Finset.prod_pow_eq_pow_sum,← Polynomial.C_mul_X_pow_eq_monomial] + change Polynomial.C (MvPolynomial.C c) * (Polynomial.C _ * Polynomial.X ^ s.degree) = _ + rw [← mul_assoc,← map_mul] + simp only [MvPolynomial.monomial_eq,Finsupp.prod] + +lemma coeff_scale (p : MvPolynomial σ K) (n : ℕ) : + (scale p).coeff n = homogeneousComponent n p := by + classical + induction p using MvPolynomial.induction_on' with + | monomial s c => + rw [scale_monomial,Polynomial.coeff_monomial] + ext t + simp only [coeff_homogeneousComponent,apply_ite,MvPolynomial.coeff_monomial, + AddMonoidAlgebra.coeff_zero] + split_ifs <;> simp_all + rintro rfl + contradiction + | add p q hp hq => simp only [map_add,Polynomial.coeff_add,hp,hq] + +lemma degree_le_of_scale (p : MvPolynomial σ K) (n : ℕ) + (h : (scale p).natDegree ≤ n) : p.totalDegree ≤ n := by + classical + apply Finset.sup_le + intro s hs + change s.degree ≤ n + by_contra hn + have hz : homogeneousComponent s.degree p=0 := by + rw [← coeff_scale] + exact Polynomial.coeff_eq_zero_of_natDegree_lt (by omega) + have he := congrArg (fun polynomial : MvPolynomial σ K => polynomial.coeff s) hz + simp only [coeff_homogeneousComponent,ite_true,AddMonoidAlgebra.coeff_zero, + Finsupp.zero_apply] at he + exact (MvPolynomial.mem_support_iff.mp hs) he + +end PermanentBorder.PlaneScaling + +namespace PermanentBorder.Conductor +open Polynomial Module +variable {K S : Type*} [Field K] [CommRing S] [IsDomain S] + [IsPrincipalIdealRing S] [Algebra K S] + +theorem normalization_length_le_ideal (f : S[X]) (hf : f.Monic) + (hsep : (f.map (algebraMap S (FractionRing S))).Separable) (J : Ideal S[X]) + (hJ : ∀ z ∈ J, ∀ t : AdjoinRoot (f.map (algebraMap S (FractionRing S))), IsIntegral S t → + ∃ q : S[X], AdjoinRoot.mk _ (q.map (algebraMap S (FractionRing S))) = + AdjoinRoot.mk _ (z.map (algebraMap S (FractionRing S)))*t) : + let R := integralClosure S (AdjoinRoot (f.map (algebraMap S (FractionRing S)))) + Module.length K (R ⧸ LinearMap.range + (normalizationInclusion (Q := FractionRing S) f hf).toLinearMap) ≤ Module.length K (S[X] ⧸ J) := by + let R := integralClosure S (AdjoinRoot (f.map (algebraMap S (FractionRing S)))) + let := (normalizationInclusion (Q := FractionRing S) f hf).toRingHom.toAlgebra + let c := (algebraConductor (AdjoinRoot f) R).restrictScalars S + let g : S[X] →ₗ[K] (AdjoinRoot f ⧸ c) := + (c.mkQ.restrictScalars K).comp ((AdjoinRoot.mkₐ f).toLinearMap.restrictScalars K) + have hg : Function.Surjective g := c.mkQ_surjective.comp AdjoinRoot.mk_surjective + have hker : J.restrictScalars K ≤ g.ker := by + intro z hz + apply (Submodule.Quotient.mk_eq_zero _).mpr + change AdjoinRoot.mk f z ∈ algebraConductor (AdjoinRoot f) R + intro t + obtain ⟨q,hq⟩ := hJ z hz t.val t.property + refine ⟨AdjoinRoot.mk f q,?_⟩ + apply Subtype.ext + change genericBaseChange (Q := FractionRing S) f (AdjoinRoot.mk f q) = + genericBaseChange (Q := FractionRing S) f (AdjoinRoot.mk f z)*t.val + simpa only [genericBaseChange_mk] using hq + let v := (J.restrictScalars K).liftQ g hker + have hv : Function.Surjective v := by + intro y + obtain ⟨z,hz⟩ := hg y + exact ⟨Ideal.Quotient.mk J z,hz⟩ + obtain ⟨e⟩ := exists_normalization_conductor_cokernel_equiv hf hsep + calc + _ = Module.length K (AdjoinRoot f ⧸ c) := (e.restrictScalars K).length_eq.symm + _ ≤ Module.length K (S[X] ⧸ J) := Module.length_le_of_surjective v hv + +theorem normalization_length_le_enlarged [CharP S 2] + (δ : Derivation K S S) (x : S) (hx : δ x = 1) + (hres : ∀ (P : Ideal S) [P.IsMaximal], IsAlgClosed P.ResidueField) + (f a b c d : S[X]) (hf : f.Monic) + (hsep : (f.map (algebraMap S (FractionRing S))).Separable) + (hsq : f=a^2+C x*b^2+X*c^2+C x*X*d^2) + (hder : f.derivative=c^2+C x*d^2) : + let R := integralClosure S (AdjoinRoot (f.map (algebraMap S (FractionRing S)))) + Module.length K (R ⧸ LinearMap.range + (normalizationInclusion (Q := FractionRing S) f hf).toLinearMap) ≤ + Module.length K (S[X] ⧸ ReducedBranchConductor.enlargedGradientIdeal f b c d x) := by + apply normalization_length_le_ideal f hf hsep + intro z hz t ht + exact ReducedBranchConductor.reduced_global_realization δ x hx hres f a b c d hf hsep + hsq hder z hz t ht + +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial MvPolynomial Module +open FrobeniusPlane CurveFamily PlaneBivariate +open scoped Classical +variable {K : Type*} [Field K] [CharP K 2] + +omit [CharP K 2] in +lemma equiv_ring_apply (p : Plane K) : (equiv K).toRingHom p = toBivariate K p := rfl + +lemma map_singularIdeal (a b c d : Plane K) : + (singularIdeal (squareForm a b c d)).map (equiv K).toRingHom = + ReducedBranchConductor.gradientIdeal (toBivariate K (squareForm a b c d)) + (toBivariate K b) (toBivariate K c) (toBivariate K d) Polynomial.X := by + rw [singularIdeal,Ideal.map_span] + simp only [squareForm_partial_zero,squareForm_partial_one, + Set.image_insert_eq,Set.image_singleton,equiv_ring_apply,map_add,map_mul,map_pow,to_zero,to_one, + ReducedBranchConductor.gradientIdeal] + +lemma map_enlargedIdeal (a b c d : Plane K) : + (singularIdeal (squareForm a b c d) ⊔ Ideal.span {d^2}* + (singularIdeal (squareForm a b c d)).radical).map (equiv K).toRingHom = + ReducedBranchConductor.enlargedGradientIdeal (toBivariate K (squareForm a b c d)) + (toBivariate K b) (toBivariate K c) (toBivariate K d) Polynomial.X := by + rw [Ideal.map_sup,Ideal.map_mul,Ideal.map_radical_of_surjective + (show Function.Surjective (equiv K).toRingHom from (equiv K).surjective) + (by rw [(RingHom.injective_iff_ker_eq_bot (equiv K).toRingHom).mp (equiv K).injective]; exact bot_le), + map_singularIdeal,ReducedBranchConductor.enlargedGradientIdeal,Ideal.map_span] + simp only [Set.image_singleton,map_pow,equiv_ring_apply] + +theorem normalization_length_le_half [IsAlgClosed K] [PerfectRing K 2] + (a b c d : Plane K) + (hf : (toBivariate K (squareForm a b c d)).Monic) + (hsep : ((toBivariate K (squareForm a b c d)).map + (algebraMap K[X] (FractionRing K[X]))).Separable) + [Fintype (zeroLocus K (singularIdeal (squareForm a b c d)))] + [Module.Finite K (Plane K ⧸ halfIdeal a b c d)] : + let f := toBivariate K (squareForm a b c d) + let R := integralClosure K[X] (AdjoinRoot (f.map (algebraMap K[X] (FractionRing K[X])))) + Module.length K (R ⧸ LinearMap.range + (normalizationInclusion (Q := FractionRing K[X]) f hf).toLinearMap) ≤ + (5*finrank K (Plane K ⧸ halfIdeal a b c d) + + Fintype.card {x : zeroLocus K (singularIdeal (squareForm a b c d)) // eval x.val d≠0} : ℕ) := by + let f := toBivariate K (squareForm a b c d) + let I := singularIdeal (squareForm a b c d) + let J := I ⊔ Ideal.span {d^2}*I.radical + let e := Ideal.quotientEquivAlg (R₁ := K) J + (ReducedBranchConductor.enlargedGradientIdeal f (toBivariate K b) (toBivariate K c) + (toBivariate K d) Polynomial.X) (equiv K) (map_enlargedIdeal a b c d).symm + have hu := normalization_length_le_enlarged (Polynomial.derivative' : Derivation K K[X] K[X]) Polynomial.X + (by simp) (ReducedBranchConductor.polynomial_residue_algClosed (K := K)) + f (toBivariate K a) (toBivariate K b) (toBivariate K c) (toBivariate K d) hf hsep + (by simp [f,squareForm]) (by + rw [derivative_to,squareForm_partial_one] + simp) + exact hu.trans (e.toLinearEquiv.length_eq.symm.le.trans (singular_enlarged_length a b c d)) + +end PermanentBorder.Conductor + +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert FrobeniusPlane +open scoped Classical +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +lemma inField_squareForm (E : IntermediateField K L) {a b c d : Plane L} + (ha : InField E a) (hb : InField E b) (hc : InField E c) (hd : InField E d) : + InField E (squareForm a b c d) := by + obtain ⟨a₀,rfl⟩ := inField_lift E ha + obtain ⟨b₀,rfl⟩ := inField_lift E hb + obtain ⟨c₀,rfl⟩ := inField_lift E hc + obtain ⟨d₀,rfl⟩ := inField_lift E hd + intro s + have he : squareForm (MvPolynomial.map E.val.toRingHom a₀) (MvPolynomial.map E.val.toRingHom b₀) + (MvPolynomial.map E.val.toRingHom c₀) (MvPolynomial.map E.val.toRingHom d₀) = + (squareForm a₀ b₀ c₀ d₀).map E.val.toRingHom := by simp [squareForm] + rw [he,coeff_map] + exact ((squareForm a₀ b₀ c₀ d₀).coeff s).property + +lemma singular_finite (f : Plane L) {k : ℕ} (hk : 1 ≤ k) + (hf : f.totalDegree ≤ k) (hlead : homogeneousComponent k f ≠ 0) + (hpartial : pderiv 1 (homogeneousComponent k f) ≠ 0) + (hcop : IsRelPrime (homogeneousComponent k f) (pderiv 1 (homogeneousComponent k f))) : + Module.Finite L (Plane L ⧸ singularIdeal f) := by + let q := Ideal.Quotient.mkₐ L (singularIdeal f) + have he : homogeneousComponent (k-1) (pderiv 1 f)=pderiv 1 (homogeneousComponent k f) := by + simpa only [Nat.sub_add_cancel hk] using partial_leading f (k-1) 1 + have hfq : q f = 0 := Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span (by simp)) + have hdq : q (pderiv 1 f) = 0 := Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span (by simp)) + have hdeg : (pderiv 1 f).totalDegree ≤ k-1 := + partial_degree (by rwa [Nat.sub_add_cancel hk]) 1 + exact (finite_of_leading_pair q Ideal.Quotient.mk_surjective hf hdeg hfq hdq hlead + (by rwa [he]) (by rwa [he]) (B := k-1) (by omega) (by omega) (by omega)).1 + +variable [CharP L 2] + +theorem ordinary_parameter_bound {a b c d : Plane L} {k R : ℕ} + (hk : 1 ≤ k) (hR : k-1 ≤ 2*R) + (hf : (squareForm a b c d).totalDegree ≤ k) + (hlead : homogeneousComponent k (squareForm a b c d) ≠ 0) + (hpartial : pderiv 1 (homogeneousComponent k (squareForm a b c d)) ≠ 0) + (hcop : IsRelPrime (homogeneousComponent k (squareForm a b c d)) + (pderiv 1 (homogeneousComponent k (squareForm a b c d)))) + (B : Fin 3 → ℕ) (t : Fin 4 → Plane K) + (h₀ : ∀ s, R ≤ s.degree → a.coeff s=algebraMap K L ((t 0).coeff s)) + (h : ∀ i s, B i ≤ s.degree → (![b,c,d] i).coeff s=algebraMap K L ((t i.succ).coeff s)) + [Fintype (zeroLocus L (singularIdeal (squareForm a b c d)))] : + ∃ (E : IntermediateField K L) (n : ℕ), InField E (squareForm a b c d) ∧ + Algebra.trdeg K E ≤ (n : Cardinal) ∧ + 8*n+Fintype.card {x : zeroLocus L (singularIdeal (squareForm a b c d)) // eval x.val d≠0} ≤ + 8*(Fintype.card (Index R)+∑ i, Fintype.card (Index (B i))) := by + let ι := {x : zeroLocus L (singularIdeal (squareForm a b c d)) // eval x.val d≠0} + let x : ι → Fin 2 → L := fun z => z.val.val + have hx : Function.Injective x := by + intro z w hzw + exact Subtype.ext (Subtype.ext hzw) + have hsing (i : ι) := (singular_zero_iff _ _).mp i.val.property + obtain ⟨E,n,ha,hb,hc,hd,hE,hn⟩ := node_parameter_bound x a b c d R B (t 0) + (fun i => t i.succ) h₀ h (fun i => i.property) + (fun i => by simpa only [squareForm_partial_zero,map_add,map_mul,map_pow,eval_X] using (hsing i).2.1) + (fun i => by simpa only [squareForm_partial_one,map_add,map_mul,map_pow,eval_X] using (hsing i).2.2) + (fun i => by simpa only [squareForm,map_add,map_mul,map_pow,eval_X] using (hsing i).1) + have hcount := distinct_critical_point_count x hx (squareForm a b c d) k R hk hR hf hlead + hpartial hcop (fun i => (hsing i).1) (fun i => (hsing i).2.2) + refine ⟨E,n,inField_squareForm E ha hb hc hd,hE,?_⟩ + have hecard : Fintype.card {z : zeroLocus L (singularIdeal (squareForm a b c d)) // eval z.val d≠0} = + Fintype.card ι := Fintype.card_congr (Equiv.refl _) + rw [hecard] + calc + _ ≤ 8*n+8*finrank L (filtered (pointEvaluation x) R) := Nat.add_le_add_left hcount _ + _ = 8*(n+finrank L (filtered (pointEvaluation x) R)) := by omega + _ ≤ _ := Nat.mul_le_mul_left 8 hn + +end PermanentBorder.CurveFamily + +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert FrobeniusPlane +open scoped Classical +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [CharP L 2] + +lemma halfIdeal_finite {a b c d : Plane L} {k : ℕ} (hk : 4 ≤ k) + (hf : (squareForm a b c d).totalDegree ≤ k) + (hs : Squarefree (homogeneousComponent k (squareForm a b c d))) : + Module.Finite L (Plane L ⧸ halfIdeal a b c d) := by + have hrep : ∃ r, k=2*r ∨ k=2*r+1 := ⟨k/2,by omega⟩ + obtain ⟨r,h|h⟩ := hrep + · subst k + exact (halfIdeal_even_finite (by omega) hf hs).1 + · subst k + exact (halfIdeal_odd_finite (by omega) hf hs).1 + +lemma ordinary_even_count (r : ℕ) : + 2*(Fintype.card (Index r)+∑ i : Fin 3, Fintype.card (Index (![r,r,r-1] i))) = + (2*r)*(2*r+1) := by + have h := even_count r + simp only [LowPlane.card_index,Fin.sum_univ_succ,Fin.sum_univ_zero,Fin.isValue, + Matrix.cons_val_zero,Matrix.cons_val_succ,add_zero] at h ⊢ + omega + +lemma ordinary_odd_count (r : ℕ) : + 2*(Fintype.card (Index (r+1))+∑ _i : Fin 3, Fintype.card (Index (r))) = + (2*r+1)*(2*r+2) := by + have h := odd_count r + simp only [LowPlane.card_index,Fin.sum_univ_succ,Fin.sum_univ_zero,Fin.isValue, + Matrix.cons_val_zero,Matrix.cons_val_succ,add_zero] at h ⊢ + omega + +variable [CharP K 2] [PerfectRing K 2] [Infinite K] [IsAlgClosed L] + +theorem half_curve_parameter_bound {a b c d : Plane L} {k : ℕ} + (hk : 4 ≤ k) (hf : (squareForm a b c d).totalDegree ≤ k) + (hs : Squarefree (homogeneousComponent k (squareForm a b c d))) + (hlead : homogeneousComponent k (squareForm a b c d) ≠ 0) + (hpartial : pderiv 1 (homogeneousComponent k (squareForm a b c d)) ≠ 0) + (hcop : IsRelPrime (homogeneousComponent k (squareForm a b c d)) + (pderiv 1 (homogeneousComponent k (squareForm a b c d)))) + (H : Plane K) (hH : H.IsHomogeneous k) + (he : homogeneousComponent k (squareForm a b c d)=H.map (algebraMap K L)) + [Fintype (zeroLocus L (singularIdeal (squareForm a b c d)))] : + ∃ (E : IntermediateField K L) (n : ℕ), InField E (squareForm a b c d) ∧ + Algebra.trdeg K E ≤ (n : Cardinal) ∧ + 18*n+5*finrank L (Plane L ⧸ halfIdeal a b c d) + + Fintype.card {x : zeroLocus L (singularIdeal (squareForm a b c d)) // eval x.val d≠0} ≤ + 9*(k*(k+1)) := by + have hrep : ∃ r, k=2*r ∨ k=2*r+1 := ⟨k/2,by omega⟩ + obtain ⟨r,h|h⟩ := hrep + · subst k + obtain ⟨t,ht⟩ := fixed_half_forms_even (by omega) hf H hH he + obtain ⟨E,nw,ha,hb,hc,hd,hE,hw⟩ := wild_parameter_bound_even (by omega) hf hs t ht + obtain ⟨F,nn,hfF,hF,hn⟩ := ordinary_parameter_bound (R := r) (by omega) (by omega) hf hlead hpartial hcop + ![r,r,r-1] t (ht 0) (by intro _i; fin_cases _i; exact ht 1; exact ht 2; exact ht 3) + have hcount := ordinary_even_count r + by_cases hmin : nw≤nn + · exact ⟨E,nw,inField_squareForm E ha hb hc hd,hE,by omega⟩ + · exact ⟨F,nn,hfF,hF,by omega⟩ + · subst k + obtain ⟨t,ht⟩ := fixed_half_forms_odd (by omega) hf H hH he + obtain ⟨E,nw,ha,hb,hc,hd,hE,hw⟩ := wild_parameter_bound_odd (by omega) hf hs t ht + obtain ⟨F,nn,hfF,hF,hn⟩ := ordinary_parameter_bound (R := r+1) (by omega) (by omega) hf hlead hpartial hcop + (fun _ : Fin 3 => r) t (ht 0) (by intro _i; fin_cases _i; exact ht 1; exact ht 2; exact ht 3) + have hcount := ordinary_odd_count r + by_cases hmin : nw≤nn + · exact ⟨E,nw,inField_squareForm E ha hb hc hd,hE,by + have hsimp : 2*r+1+1=2*r+2 := by omega + rw [hsimp] + omega⟩ + · exact ⟨F,nn,hfF,hF,by + have hsimp : 2*r+1+1=2*r+2 := by omega + rw [hsimp] + omega⟩ + +end PermanentBorder.CurveFamily + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/ConductorDuality.lean b/lean/OAI/Algebra/Determinantal/ConductorDuality.lean new file mode 100644 index 0000000000000000000000000000000000000000..c53ba6b94ec66610066055a82030be92f4e0e033 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/ConductorDuality.lean @@ -0,0 +1,402 @@ +import OAI.Algebra.Determinantal.ConditionalBound + +namespace OAI + +namespace PermanentBorder.Conductor +open Module + +section Conductor +variable (B A : Type*) [CommRing B] [CommRing A] [Algebra B A] + +def algebraConductor : Ideal B where + carrier := {a | ∀ x : A, ∃ b : B, algebraMap B A b = algebraMap B A a * x} + zero_mem' := by intro x; exact ⟨0, by simp⟩ + add_mem' := by + intro a b ha hb x + obtain ⟨c, hc⟩ := ha x + obtain ⟨d, hd⟩ := hb x + exact ⟨c+d, by simp only [map_add, hc, hd, add_mul]⟩ + smul_mem' := by + intro a b hb x + obtain ⟨c, hc⟩ := hb x + exact ⟨a*c, by simp only [smul_eq_mul, map_mul, hc, mul_assoc]⟩ + +@[simp] theorem mem_algebraConductor (a : B) : + a ∈ algebraConductor B A ↔ + ∀ x : A, ∃ b : B, algebraMap B A b = algebraMap B A a * x := Iff.rfl +end Conductor + +section Multiplication +variable {S B A : Type*} [CommRing S] [CommRing B] [CommRing A] + [Algebra S B] [Algebra S A] [Algebra B A] [IsScalarTower S B A] +variable (hi : Function.Injective (algebraMap B A)) + +noncomputable def conductorMultiplication (a : B) (ha : a ∈ algebraConductor B A) : + A →ₗ[S] B where + toFun x := Classical.choose (ha x) + map_add' x y := by + apply hi + rw [Classical.choose_spec (ha (x+y)), map_add, + Classical.choose_spec (ha x), Classical.choose_spec (ha y), mul_add] + map_smul' s x := by + apply hi + rw [Classical.choose_spec (ha (s • x))] + change algebraMap B A a * (s • x) = + (IsScalarTower.toAlgHom S B A) (s • Classical.choose (ha x)) + rw [map_smul] + change algebraMap B A a * (s • x) = s • algebraMap B A (Classical.choose (ha x)) + rw [Classical.choose_spec (ha x), mul_smul_comm] + +@[simp] theorem conductorMultiplication_spec (a : B) (ha : a ∈ algebraConductor B A) (x : A) : + algebraMap B A (conductorMultiplication (S := S) hi a ha x) = algebraMap B A a * x := + Classical.choose_spec (ha x) + +@[simp] theorem conductorMultiplication_algebraMap (a : B) + (ha : a ∈ algebraConductor B A) (b : B) : + conductorMultiplication (S := S) hi a ha (algebraMap B A b) = a*b := by + apply hi + simp +end Multiplication + +section DualImage +variable {S B A : Type*} [CommRing S] [IsDomain S] [CommRing B] [CommRing A] + [Algebra S B] [Algebra S A] [Algebra B A] [IsScalarTower S B A] + [NoZeroSMulDivisors S A] +variable (hi : Function.Injective (algebraMap B A)) + (hden : ∀ x : A, ∃ s : S, s ≠ 0 ∧ ∃ b : B, s • x = algebraMap B A b) + (lam : B →ₗ[S] S) (e : B ≃ₗ[S] Module.Dual S B) + (he : ∀ a b : B, e a b = lam (a*b)) + +include hi hden e he + +theorem in_dual_restriction_image_iff (a : B) : + (∃ ℓ : A →ₗ[S] S, ∀ b : B, ℓ (algebraMap B A b) = lam (a*b)) ↔ + a ∈ algebraConductor B A := by + constructor + · rintro ⟨ℓ, hℓ⟩ x + let ψ : B →ₗ[S] S := + { toFun := fun b => ℓ (algebraMap B A b * x) + map_add' := by intro b c; simp [add_mul] + map_smul' := by + intro s b + change ℓ ((IsScalarTower.toAlgHom S B A) (s • b) * x) = _ + rw [map_smul, smul_mul_assoc, map_smul] + rfl } + let c : B := e.symm ψ + have hc (b : B) : e c b = ℓ (algebraMap B A b*x) := by + change e (e.symm ψ) b = ψ b + rw [e.apply_symm_apply] + obtain ⟨s, hs, z, hz⟩ := hden x + have hsc : s • c = a*z := by + apply e.injective + ext b + calc + e (s • c) b = s • (e c b) := by simp + _ = s • ℓ (algebraMap B A b*x) := by rw [hc] + _ = ℓ (algebraMap B A b * (s • x)) := by + rw [mul_smul_comm, map_smul] + _ = lam (a*(b*z)) := by rw [hz, ← map_mul, hℓ] + _ = e (a*z) b := by rw [he]; congr 1; ring + refine ⟨c, ?_⟩ + apply smul_right_injective A hs + calc + s • algebraMap B A c = (IsScalarTower.toAlgHom S B A) (s • c) := by rw [map_smul]; rfl + _ = algebraMap B A (a*z) := by rw [hsc]; rfl + _ = algebraMap B A a * (s • x) := by rw [map_mul, hz] + _ = s • (algebraMap B A a * x) := mul_smul_comm _ _ _ + · intro ha + refine ⟨lam.comp (conductorMultiplication hi a ha), ?_⟩ + intro b + simp +end DualImage +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Module + +section SmithDual +variable {S V W ι : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] + [AddCommGroup V] [Module S V] [AddCommGroup W] [Module S W] + [Fintype ι] + +theorem exists_dual_cokernel_equiv (b : Basis ι S W) (i : V →ₗ[S] W) + (hi : Function.Injective i) (hrank : Module.finrank S V = Module.finrank S W) : + Nonempty ((W ⧸ LinearMap.range i) ≃ₗ[S] + ((Module.Dual S V) ⧸ LinearMap.range i.dualMap)) := by + classical + let j := LinearEquiv.ofInjective i hi + have hrank' : Module.finrank S (LinearMap.range i) = Module.finrank S W := by + rw [← j.finrank_eq, hrank] + obtain ⟨bw, a, bn, hh⟩ := (LinearMap.range i).exists_smith_normal_form_of_rank_eq b hrank' + let bv : Basis ι S V := bn.map j.symm + have hib (k : ι) : i (bv k) = a k • bw k := by + change i (j.symm (bn k)) = a k • bw k + rw [← hh] + exact congrArg Subtype.val (j.apply_symm_apply (bn k)) + let α : W ≃ₗ[S] Module.Dual S V := bw.equiv bv.dualBasis (Equiv.refl ι) + let β : V ≃ₗ[S] Module.Dual S W := bv.equiv bw.dualBasis (Equiv.refl ι) + have hid : α.toLinearMap.comp i = i.dualMap.comp β.toLinearMap := by + apply bv.ext + intro k + apply bv.ext + intro l + simp only [LinearMap.comp_apply, LinearEquiv.coe_coe, LinearMap.dualMap_apply] + rw [hib, map_smul, show α (bw k) = bv.dualBasis k by simp [α], + show β (bv k) = bw.dualBasis k by simp [β], hib] + simp only [LinearMap.smul_apply, LinearMap.map_smul, Basis.dualBasis_apply] + by_cases h : k = l + · simp [h] + · simp [h] + have hr : Submodule.map α.toLinearMap (LinearMap.range i) = LinearMap.range i.dualMap := by + rw [← LinearMap.range_comp, hid, LinearMap.range_comp] + rw [β.range, Submodule.map_top] + exact ⟨Submodule.Quotient.equiv _ _ α hr⟩ + +theorem dual_restriction_colength (b : Basis ι S W) (i : V →ₗ[S] W) + (hi : Function.Injective i) (hrank : Module.finrank S V = Module.finrank S W) : + Module.length S (W ⧸ LinearMap.range i) = + Module.length S ((Module.Dual S V) ⧸ LinearMap.range i.dualMap) := by + obtain ⟨e⟩ := exists_dual_cokernel_equiv b i hi hrank + exact e.length_eq +end SmithDual +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Module Matrix + +section MonicPairing +variable {R : Type*} [CommRing R] [Nontrivial R] +variable {f : R[X]} (hf : f.Monic) + +noncomputable def topRemainderCoefficient : AdjoinRoot f →ₗ[R] R := + (Polynomial.lcoeff R (f.natDegree-1)).comp (AdjoinRoot.modByMonicHom hf) + +noncomputable def coefficientPairing : AdjoinRoot f →ₗ[R] Module.Dual R (AdjoinRoot f) := + (Algebra.lmul R (AdjoinRoot f)).toLinearMap.compr₂ (topRemainderCoefficient hf) + +omit [Nontrivial R] in +@[simp] theorem coefficientPairing_apply (a b : AdjoinRoot f) : + coefficientPairing hf a b = topRemainderCoefficient hf (a*b) := rfl + +theorem topRemainderCoefficient_pow {l : ℕ} (hl : l < f.natDegree) : + topRemainderCoefficient hf (AdjoinRoot.root f ^ l) = + if f.natDegree-1 = l then 1 else 0 := by + change (AdjoinRoot.modByMonicHom hf (AdjoinRoot.root f ^ l)).coeff _ = _ + rw [show AdjoinRoot.root f ^ l = AdjoinRoot.mk f (X ^ l) by simp] + rw [AdjoinRoot.modByMonicHom_mk, (modByMonic_eq_self_iff hf).mpr] + · simp [coeff_X_pow] + · simpa only [degree_X_pow, degree_eq_natDegree hf.ne_zero, Nat.cast_lt] using hl + +noncomputable def pairingMatrix : Matrix (Fin f.natDegree) (Fin f.natDegree) R := + LinearMap.toMatrix (AdjoinRoot.powerBasisAux' hf) + (AdjoinRoot.powerBasisAux' hf).dualBasis (coefficientPairing hf) + +omit [Nontrivial R] in +theorem pairingMatrix_apply (i j : Fin f.natDegree) : + pairingMatrix hf i j = + topRemainderCoefficient hf (AdjoinRoot.root f ^ ((i : ℕ) + j)) := by + rw [pairingMatrix, LinearMap.toMatrix_apply, Basis.dualBasis_repr, + coefficientPairing_apply] + have hb (l : Fin f.natDegree) : + AdjoinRoot.powerBasisAux' hf l = AdjoinRoot.root f ^ (l : ℕ) := + (AdjoinRoot.powerBasis' hf).basis_eq_pow l + rw [hb, hb, ← pow_add, add_comm] + +theorem pairingMatrix_reverse_det : + ((pairingMatrix hf).submatrix id Fin.revPerm).det = 1 := by + let A := (pairingMatrix hf).submatrix id Fin.revPerm + have ha (i j : Fin f.natDegree) : + A i j = topRemainderCoefficient hf + (AdjoinRoot.root f ^ ((i : ℕ) + (f.natDegree-1-j))) := by + simp only [A, submatrix_apply, id_eq, pairingMatrix_apply, Fin.revPerm_apply, Fin.val_rev] + congr 2; omega + have htri : A.IsLowerTriangular := by + intro i j hij + change i < j at hij + rw [ha, topRemainderCoefficient_pow hf (by omega)] + rw [ite_eq_right (by omega)] + rw [Matrix.det_of_isLowerTriangular A htri] + have hdiag (i : Fin f.natDegree) : A i i = 1 := by + rw [ha, topRemainderCoefficient_pow hf (by omega)] + rw [ite_eq_left (by omega)] + simp only [hdiag, Finset.prod_const_one] + +theorem pairingMatrix_det_isUnit : IsUnit (pairingMatrix hf).det := by + have h : IsUnit (((pairingMatrix hf).submatrix id Fin.revPerm).det) := by + rw [pairingMatrix_reverse_det hf] + exact isUnit_one + rw [Matrix.det_permute'] at h + exact isUnit_of_mul_isUnit_right h + +noncomputable def coefficientPairingEquiv : + AdjoinRoot f ≃ₗ[R] Module.Dual R (AdjoinRoot f) := + Matrix.toLinOfInv (AdjoinRoot.powerBasisAux' hf) + (AdjoinRoot.powerBasisAux' hf).dualBasis + (Matrix.mul_nonsing_inv _ (pairingMatrix_det_isUnit hf)) + (Matrix.nonsing_inv_mul _ (pairingMatrix_det_isUnit hf)) + +@[simp] theorem coefficientPairingEquiv_apply (a b : AdjoinRoot f) : + coefficientPairingEquiv hf a b = topRemainderCoefficient hf (a*b) := by + change (Matrix.toLin (AdjoinRoot.powerBasisAux' hf) + (AdjoinRoot.powerBasisAux' hf).dualBasis (pairingMatrix hf)) a b = _ + rw [pairingMatrix, Matrix.toLin_toMatrix] + rfl +end MonicPairing +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Module +section Colength +variable {S B A : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] + [CommRing B] [CommRing A] [Algebra S B] [Algebra S A] [Algebra B A] + [IsScalarTower S B A] [NoZeroSMulDivisors S A] [Module.Finite S A] + +omit [IsPrincipalIdealRing S] [NoZeroSMulDivisors S A] in + +theorem finrank_eq_of_denominators + (hi : Function.Injective (algebraMap B A)) + (hden : ∀ x : A, ∃ s : S, s ≠ 0 ∧ ∃ b : B, s • x = algebraMap B A b) : + Module.finrank S B = Module.finrank S A := by + let i : B →ₗ[S] A := (IsScalarTower.toAlgHom S B A).toLinearMap + have ht : Module.IsTorsion S (A ⧸ LinearMap.range i) := by + intro x + induction x using Submodule.Quotient.induction_on with + | H x => + obtain ⟨s, hs, b, hb⟩ := hden x + refine ⟨⟨s, mem_nonZeroDivisors_iff_ne_zero.mpr hs⟩, ?_⟩ + change s • (Submodule.Quotient.mk x : A ⧸ LinearMap.range i) = 0 + rw [← Submodule.Quotient.mk_smul] + exact (Submodule.Quotient.mk_eq_zero _).mpr ⟨b, hb.symm⟩ + have hr := (LinearMap.range i).finrank_quotient_add_finrank + rw [ht.finrank_eq_zero, zero_add] at hr + exact (LinearEquiv.ofInjective i hi).finrank_eq.trans hr + +theorem conductor_colength + (hi : Function.Injective (algebraMap B A)) + (hden : ∀ x : A, ∃ s : S, s ≠ 0 ∧ ∃ b : B, s • x = algebraMap B A b) + (lam : B →ₗ[S] S) (e : B ≃ₗ[S] Module.Dual S B) + (he : ∀ a b : B, e a b = lam (a*b)) : + Module.length S (B ⧸ (algebraConductor B A).restrictScalars S) = + Module.length S (A ⧸ LinearMap.range + (IsScalarTower.toAlgHom S B A).toLinearMap) := by + classical + let i : B →ₗ[S] A := (IsScalarTower.toAlgHom S B A).toLinearMap + have hr : Submodule.map e.toLinearMap ((algebraConductor B A).restrictScalars S) = + LinearMap.range i.dualMap := by + ext ℓ + constructor + · rintro ⟨a, ha, rfl⟩ + obtain ⟨L, hL⟩ := (in_dual_restriction_image_iff hi hden lam e he a).mpr ha + refine ⟨L, ?_⟩ + ext b + exact (hL b).trans (he a b).symm + · rintro ⟨L, rfl⟩ + refine ⟨e.symm (i.dualMap L), ?_, by simp⟩ + apply (in_dual_restriction_image_iff hi hden lam e he _).mp + refine ⟨L, ?_⟩ + intro b + rw [← he, e.apply_symm_apply] + rfl + let eqv := Submodule.Quotient.equiv _ _ e hr + exact eqv.length_eq.trans + (dual_restriction_colength (Module.Free.chooseBasis S A) i hi + (finrank_eq_of_denominators hi hden)).symm +end Colength +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Module Polynomial + +theorem monic_conductor_colength + {S : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] + {f : S[X]} (hf : f.Monic) + {A : Type*} [CommRing A] [Algebra S A] [Algebra (AdjoinRoot f) A] + [IsScalarTower S (AdjoinRoot f) A] [NoZeroSMulDivisors S A] [Module.Finite S A] + (hi : Function.Injective (algebraMap (AdjoinRoot f) A)) + (hden : ∀ x : A, ∃ s : S, s ≠ 0 ∧ ∃ b : AdjoinRoot f, + s • x = algebraMap (AdjoinRoot f) A b) : + Module.length S (AdjoinRoot f ⧸ + (algebraConductor (AdjoinRoot f) A).restrictScalars S) = + Module.length S (A ⧸ LinearMap.range + (IsScalarTower.toAlgHom S (AdjoinRoot f) A).toLinearMap) := + conductor_colength hi hden (topRemainderCoefficient hf) (coefficientPairingEquiv hf) + (coefficientPairingEquiv_apply hf) +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Module + +section RootEmbedding +variable {Q L : Type*} [Field Q] [Field L] [Algebra Q L] +variable {f : Q[X]} (hf : f.Monic) + +noncomputable def rootEvaluation : AdjoinRoot f →ₐ[Q] ((f.rootSet L) → L) := + AlgHom.pi fun x => AdjoinRoot.liftAlgHom f (Algebra.ofId Q L) x.val (aeval_eq_zero_of_mem_rootSet x.property) + +@[simp] theorem rootEvaluation_mk (p : Q[X]) (x : f.rootSet L) : + rootEvaluation (f := f) (AdjoinRoot.mk f p) x = aeval x.val p := by + rfl + +include hf in + +theorem rootEvaluation_injective (hsep : f.Separable) + (hsplit : (f.map (algebraMap Q L)).Splits) : + Function.Injective (rootEvaluation (f := f) (L := L)) := by + classical + rw [injective_iff_map_eq_zero] + intro z hz + let p := AdjoinRoot.modByMonicHom hf z + have hpz : AdjoinRoot.mk f p = z := AdjoinRoot.mk_leftInverse hf z + have hpd : p.degree < f.degree := by + obtain ⟨g, rfl⟩ := AdjoinRoot.mk_surjective z + exact degree_modByMonic_lt g hf + have hp : p = 0 := by + by_contra hp + have hpmap : p.map (algebraMap Q L) ≠ 0 := mt + (fun h => Polynomial.map_injective _ (algebraMap Q L).injective (h.trans (Polynomial.map_zero _).symm)) hp + have hc : Fintype.card (f.rootSet L) = f.natDegree := by + exact card_rootSet_eq_natDegree hsep hsplit + have hd : (p.map (algebraMap Q L)).natDegree < Fintype.card (f.rootSet L) := by + rw [natDegree_map, hc] + exact natDegree_lt_natDegree hp hpd + apply hpmap + refine eq_zero_of_natDegree_lt_card_of_eval_eq_zero + (p.map (algebraMap Q L)) (f := fun x : f.rootSet L => x.val) Subtype.val_injective ?_ hd + intro x + have := congrFun hz x + rw [← hpz, rootEvaluation_mk] at this + simpa only [eval_map, aeval_def, Pi.zero_apply] using this + rw [← hpz, hp, map_zero] +end RootEmbedding + +section Normalization +variable {S Q : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] +variable {f : Q[X]} (hf : f.Monic) (hsep : f.Separable) + +include hf hsep in + +theorem finite_integralClosure_adjoinRoot : + Module.Finite S (integralClosure S (AdjoinRoot f)) := by + let L := f.SplittingField + let : Algebra.IsSeparable Q L := + Algebra.isSeparable_of_separable_splitting_field Q L hsep + let : Module.Finite S (integralClosure S L) := + IsIntegralClosure.finite S Q L (integralClosure S L) + let ev (x : f.rootSet L) : AdjoinRoot f →ₐ[S] L := + (AdjoinRoot.liftAlgHom f (Algebra.ofId Q L) x.val + (aeval_eq_zero_of_mem_rootSet x.property)).restrictScalars S + let ι : integralClosure S (AdjoinRoot f) →ₗ[S] (f.rootSet L → integralClosure S L) := + { toFun := fun z x => ⟨ev x z.val, IsIntegral.map (ev x) z.property⟩ + map_add' := by intro z w; ext x; simp + map_smul' := by intro s z; ext x; simp } + apply Module.Finite.of_injective ι + intro z w h + apply Subtype.ext + apply rootEvaluation_injective hf hsep (SplittingField.splits f) + funext x + exact congrArg Subtype.val (congrFun h x) +end Normalization +end PermanentBorder.Conductor + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/ConductorLocalization.lean b/lean/OAI/Algebra/Determinantal/ConductorLocalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0f4c7547816b97352f0e7d0e8f48f94eb2e772c --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/ConductorLocalization.lean @@ -0,0 +1,438 @@ +import OAI.Algebra.Determinantal.ConductorBounds + +namespace OAI + +namespace PermanentBorder.Conductor +open Polynomial Matrix Module +section LocalComparison +variable {K S Q ι : Type*} [Field K] [Infinite K] + [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] [IsLocalRing S] [Algebra K S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + [Fintype ι] [DecidableEq ι] + +include K in + +theorem normalization_conductor_le_adjugate (T : Matrix ι ι S) + (hsep : (T.charpoly.map (algebraMap S Q)).Separable) : + letI := (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + algebraConductor (AdjoinRoot T.charpoly) + (integralClosure S (AdjoinRoot (T.charpoly.map (algebraMap S Q)))) ≤ + matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)) := by + let := (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + obtain ⟨l, u, hl, hu, hnorm⟩ := exists_normalizing_matrix_generators (K := K) T hsep + intro a ha + apply conductor_mem_adjugate_of_lattice T (genericBaseChange (Q := Q) T.charpoly) + (genericBaseChange_injective (Q := Q) T.charpoly T.charpoly_monic) l hl u hu hnorm a + intro x hx + obtain ⟨b, hb⟩ := ha (⟨x, hx⟩ : integralClosure S + (AdjoinRoot (T.charpoly.map (algebraMap S Q)))) + exact ⟨b, congrArg Subtype.val hb⟩ + +include K in + +theorem normalization_adjugate_length (T : Matrix ι ι S) + (hsep : (T.charpoly.map (algebraMap S Q)).Separable) : + let R := integralClosure S (AdjoinRoot (T.charpoly.map (algebraMap S Q))) + letI := (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + Module.length S (AdjoinRoot T.charpoly ⧸ + (matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly))).restrictScalars S) ≤ + Module.length S (AdjoinRoot T.charpoly ⧸ + (algebraConductor (AdjoinRoot T.charpoly) R).restrictScalars S) ∧ + Module.length S (AdjoinRoot T.charpoly ⧸ + (algebraConductor (AdjoinRoot T.charpoly) R).restrictScalars S) = + Module.length S (R ⧸ LinearMap.range + (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toLinearMap) := by + let R := integralClosure S (AdjoinRoot (T.charpoly.map (algebraMap S Q))) + let := (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + refine ⟨?_, normalization_conductor_colength T.charpoly_monic hsep⟩ + let c := (algebraConductor (AdjoinRoot T.charpoly) R).restrictScalars S + let J := (matrixEntryIdeal + (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly))).restrictScalars S + have h : c ≤ J := normalization_conductor_le_adjugate (K := K) T hsep + exact Module.length_le_of_surjective (Submodule.factor h) + (Submodule.factor_surjective h) +end LocalComparison +end PermanentBorder.Conductor + +namespace PermanentBorder.RootLocalization +open Polynomial + +section BaseChange +variable {S U : Type*} [CommRing S] [CommRing U] [Algebra S U] +variable (f : S[X]) (g : U[X]) (hfg : f.map (algebraMap S U) = g) + +noncomputable def changeRoot : AdjoinRoot f →ₐ[S] AdjoinRoot g := + AdjoinRoot.mapAlgHom (Algebra.ofId S U) f g hfg.symm.dvd + +@[simp] theorem changeRoot_mk (p : S[X]) : + changeRoot f g hfg (AdjoinRoot.mk f p) = + AdjoinRoot.mk g (p.map (algebraMap S U)) := by + change aeval (AdjoinRoot.root g) p = _ + exact AdjoinRoot.aeval_eq_of_algebra (R := S) (S := U) _ p + +@[simp] theorem changeRoot_root : + changeRoot f g hfg (AdjoinRoot.root f) = AdjoinRoot.root g := by + simpa only [AdjoinRoot.root, Polynomial.map_X] using changeRoot_mk f g hfg X + +theorem changeRoot_injective (hf : f.Monic) + (hSU : Function.Injective (algebraMap S U)) : + Function.Injective (changeRoot f g hfg) := by + subst g + rw [injective_iff_map_eq_zero] + intro z hz + obtain ⟨p, rfl⟩ := AdjoinRoot.mk_surjective z + rw [changeRoot_mk, AdjoinRoot.mk_eq_zero] at hz + rw [AdjoinRoot.mk_eq_zero, ← modByMonic_eq_zero_iff_dvd hf] + apply Polynomial.map_injective (algebraMap S U) hSU + rw [Polynomial.map_zero, map_modByMonic _ hf, + (modByMonic_eq_zero_iff_dvd (hf.map _)).mpr hz] + +variable (M : Submonoid S) [IsLocalization M U] + +theorem changeRoot_denominators (x : AdjoinRoot g) : + ∃ s : M, ∃ b : AdjoinRoot f, s • x = changeRoot f g hfg b := by + obtain ⟨p, rfl⟩ := AdjoinRoot.mk_surjective x + obtain ⟨s, hs, hp⟩ := IsLocalization.integerNormalization_spec M p + refine ⟨⟨s, hs⟩, AdjoinRoot.mk f (IsLocalization.integerNormalization M p), ?_⟩ + rw [changeRoot_mk, hp] + exact (map_smul (((AdjoinRoot.mkₐ g).restrictScalars S).toLinearMap) s p).symm + +theorem changeRoot_isLocalizedModule (hf : f.Monic) (hM : M ≤ nonZeroDivisors S) : + IsLocalizedModule M (changeRoot f g hfg).toLinearMap where + map_units s := by + have h := (IsLocalization.map_units U s).map (Algebra.lsmul S S (AdjoinRoot g)).toRingHom + convert h using 1 + ext z + change (s : S) • z = (algebraMap S U (s : S)) • z + exact (algebraMap_smul U (s : S) z).symm + surj x := by + obtain ⟨s, b, hb⟩ := changeRoot_denominators f g hfg M x + exact ⟨⟨b,s⟩, hb⟩ + exists_of_eq h := by + refine ⟨1, ?_⟩ + simpa only [one_smul] using + changeRoot_injective f g hfg hf (IsLocalization.injective U hM) h + +end BaseChange +end PermanentBorder.RootLocalization + +namespace PermanentBorder.ConductorLocalization +section +variable {S U B C E : Type*} [CommRing S] [CommRing U] [CommRing B] + [CommRing C] [CommRing E] [Algebra S U] [Algebra S B] [Algebra S C] + [Algebra U C] [IsScalarTower S U C] [Algebra S E] [Algebra U E] + [IsScalarTower S U E] +variable (M : Submonoid S) [IsLocalization M U] + +include M in + +theorem integral_conductor_localizes (j : B →ₐ[S] C) (g : B →ₐ[S] E) + (q : C →ₐ[U] E) (hcomp : (q.restrictScalars S).comp j = g) + (b : B) (hb : ∀ x : E, IsIntegral S x → ∃ a : B, g a = g b * x) : + ∀ x : E, IsIntegral U x → ∃ a : C, q a = q (j b) * x := by + intro x hx + obtain ⟨s, hs⟩ := IsIntegral.exists_multiple_integral_of_isLocalization (M := M) x hx + obtain ⟨a, ha⟩ := hb ((s : S) • x) hs + obtain ⟨u, hu⟩ := IsLocalization.map_units U s + have hu' : (u : U) = algebraMap S U (s : S) := hu + refine ⟨(↑u⁻¹ : U) • j a, ?_⟩ + have hj (a : B) : q (j a) = g a := AlgHom.congr_fun hcomp a + rw [map_smul, hj, ha, mul_smul_comm, ← hj b] + rw [← algebraMap_smul U (s : S), ← hu', smul_smul] + simp +end +end PermanentBorder.ConductorLocalization + +namespace PermanentBorder.IdealLocalization +section +variable {S B C : Type*} [CommRing S] [CommRing B] [CommRing C] + [Algebra S B] [Algebra S C] +variable (M : Submonoid S) (j : B →ₐ[S] C) [IsLocalizedModule M j.toLinearMap] + +noncomputable def localizedIdeal (I : Ideal B) : Ideal C where + __ := (I.restrictScalars S).localized₀ M j.toLinearMap + smul_mem' c _ hx := by + obtain ⟨x,hx,s,rfl⟩ := hx + obtain ⟨⟨y,t⟩,hy⟩ := IsLocalizedModule.surj M j.toLinearMap c + have hy' : IsLocalizedModule.mk' j.toLinearMap y t = c := + IsLocalizedModule.mk'_eq_iff.mpr hy.symm + rw [← hy', smul_eq_mul, IsLocalizedModule.mk'_mul_mk'] + exact ⟨y*x,I.mul_mem_left y hx,t*s,rfl⟩ + +theorem map_le_localizedIdeal (I : Ideal B) : + I.map j.toRingHom ≤ localizedIdeal M j I := by + rw [Ideal.map_le_iff_le_comap] + intro x hx + exact ⟨x,hx,1, by simp⟩ + +theorem map_mem_localized (I : Ideal B) (x : C) + (hx : x ∈ I.map j.toRingHom) : + x ∈ (I.restrictScalars S).localized₀ M j.toLinearMap := + map_le_localizedIdeal M j I hx +end +end PermanentBorder.IdealLocalization + +namespace PermanentBorder.Conductor +open Polynomial Matrix RootLocalization +section +variable {S U ι : Type*} [CommRing S] [CommRing U] [Algebra S U] + [Fintype ι] [DecidableEq ι] + +noncomputable def matrixRootChange (T : Matrix ι ι S) : + AdjoinRoot T.charpoly →ₐ[S] AdjoinRoot (T.map (algebraMap S U)).charpoly := + changeRoot T.charpoly (T.map (algebraMap S U)).charpoly (T.charpoly_map _).symm + +@[simp] theorem matrixRootChange_root (T : Matrix ι ι S) : + matrixRootChange (U := U) T (AdjoinRoot.root T.charpoly) = + AdjoinRoot.root (T.map (algebraMap S U)).charpoly := changeRoot_root .. + +theorem matrixRootChange_adjugate (T : Matrix ι ι S) : + (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)).map + (matrixRootChange (U := U) T) = + (T.map (algebraMap S U)).charmatrix.adjugate.map + (AdjoinRoot.mk (T.map (algebraMap S U)).charpoly) := by + have h1 : T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly) = + (T.charmatrix.map (AdjoinRoot.mk T.charpoly)).adjugate := + (AdjoinRoot.mk T.charpoly).map_adjugate T.charmatrix + have h2 : (T.charmatrix.map (AdjoinRoot.mk T.charpoly)).adjugate.map + (matrixRootChange (U := U) T) = + ((T.charmatrix.map (AdjoinRoot.mk T.charpoly)).map + (matrixRootChange (U := U) T)).adjugate := + (matrixRootChange (U := U) T).map_adjugate _ + have h3 : (T.map (algebraMap S U)).charmatrix.adjugate.map + (AdjoinRoot.mk (T.map (algebraMap S U)).charpoly) = + ((T.map (algebraMap S U)).charmatrix.map + (AdjoinRoot.mk (T.map (algebraMap S U)).charpoly)).adjugate := + (AdjoinRoot.mk (T.map (algebraMap S U)).charpoly).map_adjugate _ + rw [h1,h2,h3] + congr 1 + have hc (x : S) : matrixRootChange (U := U) T (AdjoinRoot.of T.charpoly x) = + AdjoinRoot.of (T.map (algebraMap S U)).charpoly (algebraMap S U x) := + (matrixRootChange (U := U) T).commutes x + ext i j + simp only [Matrix.map_apply,charmatrix,Matrix.sub_apply,map_sub, + Matrix.scalar_apply,Matrix.diagonal_apply] + split_ifs <;> simp only [RingHom.mapMatrix_apply, Matrix.map_apply, map_zero, AdjoinRoot.mk_X, matrixRootChange_root, + AdjoinRoot.mk_C, hc] + +omit [Fintype ι] [DecidableEq ι] in +theorem matrixEntryIdeal_map {B C : Type*} [CommRing B] [CommRing C] + (f : B →+* C) (N : Matrix ι ι B) : + (matrixEntryIdeal N).map f = matrixEntryIdeal (N.map f) := by + rw [matrixEntryIdeal,Ideal.map_span,matrixEntryIdeal] + congr 1 + ext x + simp only [Set.mem_image,Set.mem_range,exists_exists_eq_and,Matrix.map_apply] + +theorem adjugateIdeal_baseChange (T : Matrix ι ι S) : + (matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly))).map + (matrixRootChange (U := U) T).toRingHom = + matrixEntryIdeal ((T.map (algebraMap S U)).charmatrix.adjugate.map + (AdjoinRoot.mk (T.map (algebraMap S U)).charpoly)) := by + rw [matrixEntryIdeal_map] + congr 1 + exact matrixRootChange_adjugate T +end +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Matrix Module RootLocalization + +@[simp] theorem genericBaseChange_root {V Q : Type*} [CommRing V] [Field Q] + [Algebra V Q] (f : V[X]) : + genericBaseChange (Q := Q) f (AdjoinRoot.root f) = + AdjoinRoot.root (f.map (algebraMap V Q)) := by + simpa only [AdjoinRoot.root, Polynomial.map_X] using genericBaseChange_mk (Q := Q) f X + +section GenericTransport +variable {S U Q ι : Type*} [CommRing S] [CommRing U] [Field Q] + [Algebra S U] [Algebra S Q] [Algebra U Q] [IsScalarTower S U Q] + [Fintype ι] [DecidableEq ι] + +theorem charpoly_map_tower (T : Matrix ι ι S) : + T.charpoly.map (algebraMap S Q) = + (T.map (algebraMap S U)).charpoly.map (algebraMap U Q) := by + rw [charpoly_map, Polynomial.map_map, ← IsScalarTower.algebraMap_eq] + +noncomputable def genericMatrixChange (T : Matrix ι ι S) : + AdjoinRoot (T.charpoly.map (algebraMap S Q)) ≃ₐ[Q] + AdjoinRoot ((T.map (algebraMap S U)).charpoly.map (algebraMap U Q)) := + AdjoinRoot.algEquivOfEq Q _ _ (charpoly_map_tower T) + +theorem genericMatrixChange_comp (T : Matrix ι ι S) : + ((genericBaseChange (Q := Q) (T.map (algebraMap S U)).charpoly).restrictScalars S).comp + (matrixRootChange (U := U) T) = + ((genericMatrixChange (U := U) (Q := Q) T).restrictScalars S).toAlgHom.comp + (genericBaseChange (Q := Q) T.charpoly) := by + apply AdjoinRoot.algHom_ext + change genericBaseChange (Q := Q) (T.map (algebraMap S U)).charpoly + (matrixRootChange (U := U) T (AdjoinRoot.root T.charpoly)) = + genericMatrixChange (U := U) (Q := Q) T + (genericBaseChange (Q := Q) T.charpoly (AdjoinRoot.root T.charpoly)) + rw [matrixRootChange_root,genericBaseChange_root,genericBaseChange_root] + exact (AdjoinRoot.algEquivOfEq_root _ _ _).symm +end GenericTransport + +section LocalCondition +variable {K S Q ι : Type*} [Field K] [Infinite K] + [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] [IsLocalRing S] [Algebra K S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] [Fintype ι] [DecidableEq ι] + +include K in +theorem integral_conductor_le_adjugate_local (T : Matrix ι ι S) + (hsep : (T.charpoly.map (algebraMap S Q)).Separable) + (b : AdjoinRoot T.charpoly) + (hb : ∀ x : AdjoinRoot (T.charpoly.map (algebraMap S Q)), IsIntegral S x → + ∃ a : AdjoinRoot T.charpoly, + genericBaseChange (Q := Q) T.charpoly a = + genericBaseChange (Q := Q) T.charpoly b * x) : + b ∈ matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)) := by + let := (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + apply normalization_conductor_le_adjugate (K := K) T hsep + intro x + obtain ⟨a,ha⟩ := hb x.val x.property + exact ⟨a,Subtype.ext ha⟩ +end LocalCondition + +section GlobalComparison +variable {K S ι : Type*} [Field K] [Infinite K] + [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] [Algebra K S] + [Fintype ι] [DecidableEq ι] + +include K in + +theorem normalization_conductor_le_adjugate_global (T : Matrix ι ι S) + (hsep : (T.charpoly.map (algebraMap S (FractionRing S))).Separable) : + letI := (normalizationInclusion (Q := FractionRing S) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + algebraConductor (AdjoinRoot T.charpoly) + (integralClosure S (AdjoinRoot (T.charpoly.map (algebraMap S (FractionRing S))))) ≤ + matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)) := by + let Q := FractionRing S + let := (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + let J := matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)) + intro b hb + let U (P : Ideal S) [P.IsMaximal] := Localization.AtPrime P + let C (P : Ideal S) [P.IsMaximal] := AdjoinRoot (T.map (algebraMap S (U P))).charpoly + let j (P : Ideal S) [P.IsMaximal] : AdjoinRoot T.charpoly →ₐ[S] C P := + matrixRootChange (U := U P) T + have hj (P : Ideal S) [P.IsMaximal] : IsLocalizedModule P.primeCompl (j P).toLinearMap := + changeRoot_isLocalizedModule _ _ _ _ T.charpoly_monic P.primeCompl_le_nonZeroDivisors + apply @Submodule.mem_of_localization_maximal S (AdjoinRoot T.charpoly) _ _ _ + C _ _ (fun P _ => (j P).toLinearMap) hj b (J.restrictScalars S) + intro P hP + let := hj P + let T' := T.map (algebraMap S (U P)) + let e := (genericMatrixChange (U := U P) (Q := Q) T).restrictScalars S + let g := e.toAlgHom.comp (genericBaseChange (Q := Q) T.charpoly) + have hbg : ∀ x : AdjoinRoot (T'.charpoly.map (algebraMap (U P) Q)), + IsIntegral S x → ∃ a : AdjoinRoot T.charpoly, g a = g b * x := by + intro x hx + obtain ⟨a,ha⟩ := hb (⟨e.symm x, IsIntegral.map e.symm.toAlgHom hx⟩ : + integralClosure S (AdjoinRoot (T.charpoly.map (algebraMap S Q)))) + have ha0 : genericBaseChange (Q := Q) T.charpoly a = + genericBaseChange (Q := Q) T.charpoly b * e.symm x := congrArg Subtype.val ha + have ha' := congrArg e ha0 + refine ⟨a, ?_⟩ + simpa only [g,AlgHom.comp_apply,AlgEquiv.coe_toAlgHom,map_mul,AlgEquiv.apply_symm_apply] using ha' + have hbP := ConductorLocalization.integral_conductor_localizes P.primeCompl (j P) g + (genericBaseChange (Q := Q) T'.charpoly) (genericMatrixChange_comp T) b hbg + have hsep' : (T'.charpoly.map (algebraMap (U P) Q)).Separable := by + rw [← charpoly_map_tower T] + exact hsep + have hbJ := integral_conductor_le_adjugate_local (K := K) T' hsep' (j P b) hbP + apply IdealLocalization.map_mem_localized P.primeCompl (j P) J + rw [show j P = matrixRootChange (U := U P) T from rfl,adjugateIdeal_baseChange] + exact hbJ +end GlobalComparison +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Module Polynomial +section CokernelEquiv +variable {S B A : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] + [CommRing B] [CommRing A] [Algebra S B] [Algebra S A] [Algebra B A] + [IsScalarTower S B A] [NoZeroSMulDivisors S A] [Module.Finite S A] + +theorem exists_conductor_cokernel_equiv + (hi : Function.Injective (algebraMap B A)) + (hden : ∀ x : A, ∃ s : S, s ≠ 0 ∧ ∃ b : B, s • x = algebraMap B A b) + (lam : B →ₗ[S] S) (e : B ≃ₗ[S] Module.Dual S B) + (he : ∀ a b : B, e a b = lam (a*b)) : + Nonempty ((B ⧸ (algebraConductor B A).restrictScalars S) ≃ₗ[S] + (A ⧸ LinearMap.range (IsScalarTower.toAlgHom S B A).toLinearMap)) := by + classical + let i : B →ₗ[S] A := (IsScalarTower.toAlgHom S B A).toLinearMap + have hr : Submodule.map e.toLinearMap ((algebraConductor B A).restrictScalars S) = + LinearMap.range i.dualMap := by + ext ℓ + constructor + · rintro ⟨a, ha, rfl⟩ + obtain ⟨L, hL⟩ := (in_dual_restriction_image_iff hi hden lam e he a).mpr ha + refine ⟨L, ?_⟩ + ext b + exact (hL b).trans (he a b).symm + · rintro ⟨L, rfl⟩ + refine ⟨e.symm (i.dualMap L), ?_, by simp⟩ + apply (in_dual_restriction_image_iff hi hden lam e he _).mp + refine ⟨L, ?_⟩ + intro b + rw [← he, e.apply_symm_apply] + rfl + let eqv := Submodule.Quotient.equiv _ _ e hr + obtain ⟨d⟩ := exists_dual_cokernel_equiv (Module.Free.chooseBasis S A) i hi + (finrank_eq_of_denominators hi hden) + exact ⟨eqv.trans d.symm⟩ +end CokernelEquiv + +section NormalizationCokernel +variable {S Q : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] +variable {f : S[X]} (hf : f.Monic) +local notation "R" => integralClosure S (AdjoinRoot (f.map (algebraMap S Q))) + +theorem exists_normalization_conductor_cokernel_equiv + (hsep : (f.map (algebraMap S Q)).Separable) : + letI := (normalizationInclusion (Q := Q) f hf).toRingHom.toAlgebra + Nonempty ((AdjoinRoot f ⧸ (algebraConductor (AdjoinRoot f) R).restrictScalars S) ≃ₗ[S] + (R ⧸ LinearMap.range (normalizationInclusion (Q := Q) f hf).toLinearMap)) := by + let := (normalizationInclusion (Q := Q) f hf).toRingHom.toAlgebra + have : Module.Finite S R := finite_integralClosure_adjoinRoot (hf.map _) hsep + have : NoZeroSMulDivisors S R := normalization_torsionFree (f := f) + exact exists_conductor_cokernel_equiv + (normalizationInclusion_injective (Q := Q) f hf) + (normalizationInclusion_denominators (Q := Q) f hf) + (topRemainderCoefficient hf) (coefficientPairingEquiv hf) (coefficientPairingEquiv_apply hf) +end NormalizationCokernel +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Module Matrix +section ScalarLength +variable {K S ι : Type*} [Field K] [Infinite K] + [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] [Algebra K S] + [Fintype ι] [DecidableEq ι] + +theorem normalization_adjugate_length_global (T : Matrix ι ι S) + (hsep : (T.charpoly.map (algebraMap S (FractionRing S))).Separable) : + let R := integralClosure S (AdjoinRoot (T.charpoly.map (algebraMap S (FractionRing S)))) + Module.length K (AdjoinRoot T.charpoly ⧸ + (matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly))).restrictScalars S) ≤ + Module.length K (R ⧸ LinearMap.range + (normalizationInclusion (Q := FractionRing S) T.charpoly T.charpoly_monic).toLinearMap) := by + let Q := FractionRing S + let R := integralClosure S (AdjoinRoot (T.charpoly.map (algebraMap S Q))) + let := (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toRingHom.toAlgebra + let c := (algebraConductor (AdjoinRoot T.charpoly) R).restrictScalars S + let J := (matrixEntryIdeal + (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly))).restrictScalars S + have h : c ≤ J := normalization_conductor_le_adjugate_global (K := K) T hsep + obtain ⟨e⟩ := exists_normalization_conductor_cokernel_equiv T.charpoly_monic hsep + calc + _ ≤ Module.length K (AdjoinRoot T.charpoly ⧸ c) := + Module.length_le_of_surjective ((Submodule.factor h).restrictScalars K) + (Submodule.factor_surjective h) + _ = _ := (e.restrictScalars K).length_eq +end ScalarLength +end PermanentBorder.Conductor + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/CoordinateFields.lean b/lean/OAI/Algebra/Determinantal/CoordinateFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8a41e9025f8edb4afe186ffecc839682bcc20f3 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/CoordinateFields.lean @@ -0,0 +1,340 @@ +import OAI.Algebra.Determinantal.Centralizers + +namespace OAI + +namespace PermanentBorder.CoordinateNormalization +open Matrix MvPolynomial CoordinateGauge +variable {K L ι : Type*} [Field K] [Field L] [Algebra K L] [Infinite K] + [Fintype ι] [DecidableEq ι] + +theorem exists_base_eval_ne_zero {κ : Type*} (p : MvPolynomial κ L) (hp : p ≠ 0) : + ∃ x : κ → K, MvPolynomial.eval (algebraMap K L ∘ x) p ≠ 0 := by + classical + by_contra! h + apply hp + apply MvPolynomial.funext_set (fun _ => Set.range (algebraMap K L)) + (fun _ => Set.infinite_range_of_injective (algebraMap K L).injective) + intro x hx + choose y hy using fun i => hx i (Set.mem_univ i) + have he : algebraMap K L ∘ y = x := funext hy + simp only [← he, h, map_zero] + +noncomputable def basisDeterminant {κ : Type*} [Fintype κ] + (S : Submodule L ((ι × ι) → L)) (b : Module.Basis κ L S) : MvPolynomial κ L := + Matrix.det (of fun i j => ∑ a, C ((b a).val (i,j)) * X a) + +theorem eval_basisDeterminant {κ : Type*} [Fintype κ] + (S : Submodule L ((ι × ι) → L)) (b : Module.Basis κ L S) (v : S) : + MvPolynomial.eval (fun a => b.repr v a) (basisDeterminant S b) = + Matrix.det (Function.curry v.val) := by + classical + unfold basisDeterminant + rw [RingHom.map_det] + congr 1 + ext i j + change MvPolynomial.eval (fun a => b.repr v a) + (∑ a, C ((b a).val (i,j)) * X a) = v.val (i,j) + simp only [map_sum, map_mul, eval_C, eval_X] + have h := congrArg (fun z : S => z.val (i,j)) (b.sum_repr v) + simpa only [Submodule.coe_sum, Submodule.coe_smul, Finset.sum_apply, Pi.smul_apply, + smul_eq_mul, mul_comm] using h + +theorem exists_invertible_coordinate_gauge + (S : Submodule L ((ι × ι) → L)) + (hS : ∃ v : S, Matrix.det (Function.curry v.val) ≠ 0) : + ∃ (a : Fin (Module.finrank L S) → ι × ι) (v : S), + Function.Injective a ∧ Matrix.det (Function.curry v.val) ≠ 0 ∧ + ∀ j, ∃ c : K, v.val (a j) = algebraMap K L c := by + classical + obtain ⟨a, hai, hab⟩ := exists_coordinate_gauge S + let r : S →ₗ[L] (Fin (Module.finrank L S) → L) := + LinearMap.pi fun j => (LinearMap.proj (a j)).comp S.subtype + let e : S ≃ₗ[L] (Fin (Module.finrank L S) → L) := LinearEquiv.ofBijective r hab + let b := Module.Basis.ofEquivFun e + have hp : basisDeterminant S b ≠ 0 := by + obtain ⟨v, hv⟩ := hS + intro h + apply hv + rw [← eval_basisDeterminant S b v, h, map_zero] + obtain ⟨x, hx⟩ := exists_base_eval_ne_zero (K := K) (basisDeterminant S b) hp + let v := e.symm (algebraMap K L ∘ x) + have hre : (fun j => b.repr v j) = algebraMap K L ∘ x := by + funext j + simp only [b, Module.Basis.ofEquivFun_repr_apply, v, LinearEquiv.apply_symm_apply] + refine ⟨a, v, hai, ?_, ?_⟩ + · rwa [← hre, eval_basisDeterminant] at hx + · intro j + refine ⟨x j, ?_⟩ + have h := congrFun (e.apply_symm_apply (algebraMap K L ∘ x)) j + exact h + +end PermanentBorder.CoordinateNormalization + +namespace PermanentBorder.OrbitNormalization +open Matrix CentralizerDimension CentralizerBaseChange CoordinateNormalization +variable {L ι : Type*} [Field L] [Fintype ι] [DecidableEq ι] + +def intertwinerSpace (A C : Matrix ι ι L) : Submodule L (ι × ι → L) where + carrier := {v | A * Matrix.of (Function.curry v) = Matrix.of (Function.curry v) * C} + zero_mem' := by change A * 0 = 0 * C; simp + add_mem' := by + intro v w hv hw + change A * (Matrix.of (Function.curry v) + Matrix.of (Function.curry w)) = + (Matrix.of (Function.curry v) + Matrix.of (Function.curry w)) * C + rw [mul_add, add_mul, hv, hw] + smul_mem' := by + intro c v hv + change A * (c • Matrix.of (Function.curry v)) = + (c • Matrix.of (Function.curry v)) * C + rw [Matrix.mul_smul, hv, Matrix.smul_mul] + +def intertwinerEquivCentralizer (A C : Matrix ι ι L) + (P : (Matrix ι ι L)ˣ) (hP : A * (P : Matrix ι ι L) = (P : Matrix ι ι L) * C) : + centralizer C ≃ₗ[L] intertwinerSpace A C := by + have hCP : C * (↑P⁻¹ : Matrix ι ι L) = (↑P⁻¹ : Matrix ι ι L) * A := by + have h := congrArg (fun M : Matrix ι ι L => (↑P⁻¹ : Matrix ι ι L) * M * (↑P⁻¹ : Matrix ι ι L)) hP + simp only [← mul_assoc, Units.inv_mul, one_mul] at h + simpa only [mul_assoc, Units.mul_inv, mul_one] using h.symm + refine + { toFun := fun B => ⟨Function.uncurry ((P : Matrix ι ι L) * B.val), by + change A * ((P : Matrix ι ι L) * B.val) = ((P : Matrix ι ι L) * B.val) * C + rw [← mul_assoc, hP, mul_assoc, B.property, ← mul_assoc]⟩ + invFun := fun v => ⟨(↑P⁻¹ : Matrix ι ι L) * Matrix.of (Function.curry v.val), by + change C * ((↑P⁻¹ : Matrix ι ι L) * Matrix.of (Function.curry v.val)) = + ((↑P⁻¹ : Matrix ι ι L) * Matrix.of (Function.curry v.val)) * C + rw [← mul_assoc, hCP, mul_assoc, v.property, ← mul_assoc]⟩ + left_inv := fun B => by + apply Subtype.ext + change (↑P⁻¹ : Matrix ι ι L) * ((P : Matrix ι ι L) * B.val) = B.val + rw [← mul_assoc, Units.inv_mul, one_mul] + right_inv := fun v => by + apply Subtype.ext + change Function.uncurry ((P : Matrix ι ι L) * + ((↑P⁻¹ : Matrix ι ι L) * Matrix.of (Function.curry v.val))) = v.val + rw [← mul_assoc, Units.mul_inv, one_mul] + rfl + map_add' := fun B D => by + apply Subtype.ext + change Function.uncurry ((P : Matrix ι ι L) * (B.val + D.val)) = _ + rw [mul_add] + rfl + map_smul' := fun c B => by + apply Subtype.ext + change Function.uncurry ((P : Matrix ι ι L) * (c • B.val)) = _ + rw [Matrix.mul_smul] + rfl } + +variable {K : Type*} [Field K] [Algebra K L] [Infinite K] + +theorem exists_normalized_intertwiner (A : Matrix ι ι L) (C : Matrix ι ι K) + (P : (Matrix ι ι L)ˣ) + (hP : A * (P : Matrix ι ι L) = (P : Matrix ι ι L) * C.map (algebraMap K L)) : + ∃ (a : Fin (Module.finrank K (centralizer C)) → ι × ι) + (Q : (Matrix ι ι L)ˣ), + Function.Injective a ∧ + A * (Q : Matrix ι ι L) = (Q : Matrix ι ι L) * C.map (algebraMap K L) ∧ + ∀ j, ∃ c : K, (Q : Matrix ι ι L) (a j).1 (a j).2 = algebraMap K L c := by + classical + let S := intertwinerSpace A (C.map (algebraMap K L)) + have hd : Module.finrank L S = Module.finrank K (centralizer C) := + (intertwinerEquivCentralizer A _ P hP).finrank_eq.symm.trans + (finrank_centralizer_map C) + have hS : ∃ v : S, Matrix.det (Function.curry v.val) ≠ 0 := by + refine ⟨⟨Function.uncurry (P : Matrix ι ι L), hP⟩, ?_⟩ + exact (Matrix.isUnits_det_units P).ne_zero + obtain ⟨a, v, hai, hv, hvK⟩ := exists_invertible_coordinate_gauge (K := K) S hS + obtain ⟨Q, hQ⟩ := (Matrix.isUnit_iff_isUnit_det _).mpr (isUnit_iff_ne_zero.mpr hv) + let e := finCongr hd + refine ⟨a ∘ e.symm, Q, hai.comp e.symm.injective, ?_, ?_⟩ + · rw [hQ] + exact v.property + · intro j + obtain ⟨c, hc⟩ := hvK (e.symm j) + exact ⟨c, by simpa only [hQ, Function.comp_apply, Function.curry] using hc⟩ + +end PermanentBorder.OrbitNormalization + +namespace PermanentBorder.CentralizerParameters +open Matrix MvPolynomial CentralizerDimension CentralizerBaseChange +variable {K L ι : Type*} [Field K] [Field L] [Algebra K L] + [Fintype ι] [DecidableEq ι] + +noncomputable def coefficients (C : Matrix ι ι K) + (B : centralizer (C.map (algebraMap K L))) : + Fin (Module.finrank K (centralizer C)) → L := + (centralizerBasisMap C (centralizerBasis C)).repr B + +theorem entry_expansion (C : Matrix ι ι K) + (B : centralizer (C.map (algebraMap K L))) (i j : ι) : + B.val i j = ∑ a, coefficients C B a * algebraMap K L ((centralizerBasis C a).val i j) := by + have h := congrArg (fun D : centralizer (C.map (algebraMap K L)) => D.val i j) + ((centralizerBasisMap C (centralizerBasis C)).sum_repr B) + simpa only [coefficients, Submodule.coe_sum, Submodule.coe_smul, Matrix.sum_apply, + Matrix.smul_apply, smul_eq_mul, centralizerBasisMap_apply, + mapCentralizer, Matrix.map_apply] using h.symm + +theorem eval_determinant (C : Matrix ι ι K) + (B : centralizer (C.map (algebraMap K L))) : + MvPolynomial.aeval (coefficients C B) (determinantPolynomial C) = B.val.det := by + rw [determinantPolynomial, AlgHom.map_det] + congr 1 + ext i j + change MvPolynomial.aeval (coefficients C B) + (∑ a, MvPolynomial.C ((centralizerBasis C a).val i j) * X a) = B.val i j + simp only [map_sum, map_mul, aeval_C, aeval_X] + rw [entry_expansion C B i j] + apply Finset.sum_congr rfl + intro a _ + exact mul_comm _ _ + +theorem determinant_relation (C : Matrix ι ι K) + (B : centralizer (C.map (algebraMap K L))) (hB : B.val.det = 0) : + determinantPolynomial C ≠ 0 ∧ + MvPolynomial.aeval (coefficients C B) (determinantPolynomial C) = 0 := + ⟨determinantPolynomial_ne_zero C, (eval_determinant C B).trans hB⟩ + +end PermanentBorder.CentralizerParameters + +namespace PermanentBorder.MatrixSubfield +open Matrix +variable {K L ι : Type*} [Field K] [Field L] [Algebra K L] + [Fintype ι] [DecidableEq ι] + +omit [DecidableEq ι] in +theorem mul_mem (F : IntermediateField K L) (A B : Matrix ι ι L) + (hA : ∀ i j, A i j ∈ F) (hB : ∀ i j, B i j ∈ F) : + ∀ i j, (A * B) i j ∈ F := by + intro i j + exact F.sum_mem fun k _ => F.mul_mem (hA i k) (hB k j) + +theorem unit_inv_mem (F : IntermediateField K L) (P : (Matrix ι ι L)ˣ) + (hP : ∀ i j, (P : Matrix ι ι L) i j ∈ F) : + ∀ i j, (↑P⁻¹ : Matrix ι ι L) i j ∈ F := by + let A : Matrix ι ι F := fun i j => ⟨(P : Matrix ι ι L) i j, hP i j⟩ + have hA : A.map (algebraMap F L) = (P : Matrix ι ι L) := rfl + have hd : A.det ≠ 0 := by + intro h + have he : algebraMap F L A.det = (P : Matrix ι ι L).det := + (algebraMap F L).map_det A + rw [h, map_zero] at he + exact (Matrix.isUnits_det_units P).ne_zero he.symm + have hi := congrArg (fun M : Matrix ι ι F => M.map (algebraMap F L)) + (Matrix.nonsing_inv_mul A (isUnit_iff_ne_zero.mpr hd)) + simp only [Matrix.map_mul, hA, Matrix.map_one _ (map_zero _) (map_one _)] at hi + have he : A⁻¹.map (algebraMap F L) = (↑P⁻¹ : Matrix ι ι L) := by + calc + _ = (A⁻¹.map (algebraMap F L) * (P : Matrix ι ι L)) * (↑P⁻¹ : Matrix ι ι L) := by + rw [mul_assoc, Units.mul_inv, mul_one] + _ = _ := by rw [hi, one_mul] + intro i j + rw [← he] + exact ((A⁻¹) i j).property + +end PermanentBorder.MatrixSubfield + +namespace PermanentBorder.ParameterBounds +open Algebra MvPolynomial +universe u +variable {K A : Type u} [Field K] [CommRing A] [IsDomain A] [Algebra K A] + +open scoped IntermediateField.algebraAdjoinAdjoin in + +theorem field_adjoin_trdeg_lt_of_relation_fintype {L : Type u} [Field L] [Algebra K L] + {κ : Type*} [Fintype κ] (x : κ → L) (p : MvPolynomial κ K) (hp : p ≠ 0) + (hx : aeval x p = 0) : + Algebra.trdeg K (IntermediateField.adjoin K (Set.range x)) < (Fintype.card κ : Cardinal) := by + classical + let e := Fintype.equivFin κ + let y := x ∘ e.symm + have hy : Set.range y = Set.range x := e.symm.surjective.range_comp x + rw [← hy] + apply field_adjoin_trdeg_lt_of_relation y (MvPolynomial.rename e p) + · exact fun h => hp ((MvPolynomial.rename_injective e e.injective) (by simpa using h)) + · simpa only [MvPolynomial.aeval_rename, y, Function.comp_assoc, + Equiv.symm_comp_self, Function.comp_id] using hx + +end PermanentBorder.ParameterBounds + +namespace PermanentBorder.CommutingPairs +open Matrix CentralizerDimension CentralizerParameters OrbitNormalization +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [Infinite K] + +theorem normalized_pair_field_bound {n : ℕ} + (A B : Matrix (Fin n) (Fin n) L) (C : Matrix (Fin n) (Fin n) K) + (P : (Matrix (Fin n) (Fin n) L)ˣ) + (hP : A * (P : Matrix (Fin n) (Fin n) L) = + (P : Matrix (Fin n) (Fin n) L) * C.map (algebraMap K L)) + (hAB : A * B = B * A) (hB : B.det = 0) : + ∃ F : IntermediateField K L, + Algebra.trdeg K F < (n * n : ℕ) ∧ + (∀ i j, A i j ∈ F) ∧ (∀ i j, B i j ∈ F) := by + classical + obtain ⟨a, Q, hai, hQ, hQa⟩ := exists_normalized_intertwiner A C P hP + let j := Module.finrank K (centralizer C) + let C' := C.map (algebraMap K L) + have hC' : C' = (↑Q⁻¹ : Matrix (Fin n) (Fin n) L) * A * (Q : Matrix (Fin n) (Fin n) L) := by + calc + _ = (↑Q⁻¹ : Matrix (Fin n) (Fin n) L) * ((Q : Matrix (Fin n) (Fin n) L) * C') := by + rw [← mul_assoc, Units.inv_mul, one_mul] + _ = _ := by rw [← hQ, mul_assoc] + let B' : centralizer C' := ⟨(↑Q⁻¹ : Matrix (Fin n) (Fin n) L) * B * (Q : Matrix (Fin n) (Fin n) L), by + change C' * _ = _ * C' + rw [hC'] + simp only [mul_assoc] + simp only [← mul_assoc (Q : Matrix (Fin n) (Fin n) L), Units.mul_inv, one_mul] + simp only [← mul_assoc] + rw [mul_assoc (↑Q⁻¹ : Matrix (Fin n) (Fin n) L) A B, hAB, ← mul_assoc]⟩ + let κ := {p : Fin n × Fin n // p ∉ Set.range a} ⊕ Fin j + let x : κ → L := Sum.elim + (fun p => (Q : Matrix (Fin n) (Fin n) L) p.val.1 p.val.2) + (coefficients C B') + let F := IntermediateField.adjoin K (Set.range x) + have hx (i : κ) : x i ∈ F := IntermediateField.subset_adjoin K _ (Set.mem_range_self i) + have ha_card : Fintype.card {p : Fin n × Fin n // p ∈ Set.range a} = j := by + simpa only [Fintype.card_fin] using (Fintype.card_congr (Equiv.ofInjective a hai)).symm + have hj : j ≤ n * n := by + simpa only [Fintype.card_fin, Fintype.card_prod] using Fintype.card_le_of_injective a hai + have hκ : Fintype.card κ = n * n := by + simp only [κ, Fintype.card_sum, Fintype.card_subtype_compl, ha_card, + Fintype.card_prod, Fintype.card_fin] + exact Nat.sub_add_cancel hj + have hB' : B'.val.det = 0 := (Matrix.det_units_conj' Q B).trans hB + obtain ⟨hp, hxp⟩ := determinant_relation C B' hB' + have hFp : Algebra.trdeg K F < (Fintype.card κ : Cardinal) := by + apply ParameterBounds.field_adjoin_trdeg_lt_of_relation_fintype x + (MvPolynomial.rename (Sum.inr : Fin j → κ) (determinantPolynomial C)) + · exact fun h => hp ((MvPolynomial.rename_injective _ Sum.inr_injective) (by simpa using h)) + · simpa only [MvPolynomial.aeval_rename, Function.comp_def, x, Sum.elim_inr] using hxp + have hQF : ∀ i j, (Q : Matrix (Fin n) (Fin n) L) i j ∈ F := by + intro i j + by_cases h : (i,j) ∈ Set.range a + · obtain ⟨b, hb⟩ := h + obtain ⟨c, hc⟩ := hQa b + rw [hb] at hc + rw [hc] + exact F.algebraMap_mem c + · exact hx (Sum.inl ⟨(i,j), h⟩) + have hQiF := MatrixSubfield.unit_inv_mem F Q hQF + have hCF : ∀ i j, C' i j ∈ F := fun i j => F.algebraMap_mem (C i j) + have hBF : ∀ i j, B'.val i j ∈ F := by + intro i j + rw [entry_expansion C B' i j] + exact F.sum_mem fun b _ => F.mul_mem (hx (Sum.inr b)) (F.algebraMap_mem _) + have hAeq : A = (Q : Matrix (Fin n) (Fin n) L) * C' * (↑Q⁻¹ : Matrix (Fin n) (Fin n) L) := by + rw [← hQ, mul_assoc, Units.mul_inv, mul_one] + have hBeq : B = (Q : Matrix (Fin n) (Fin n) L) * B'.val * (↑Q⁻¹ : Matrix (Fin n) (Fin n) L) := by + change B = (Q : Matrix (Fin n) (Fin n) L) * + ((↑Q⁻¹ : Matrix (Fin n) (Fin n) L) * B * (Q : Matrix (Fin n) (Fin n) L)) * + (↑Q⁻¹ : Matrix (Fin n) (Fin n) L) + rw [← mul_assoc, ← mul_assoc, Units.mul_inv, one_mul, mul_assoc, Units.mul_inv, mul_one] + refine ⟨F, ?_, ?_, ?_⟩ + · simpa only [hκ] using hFp + · rw [hAeq] + exact MatrixSubfield.mul_mem F _ _ (MatrixSubfield.mul_mem F _ _ hQF hCF) hQiF + · rw [hBeq] + exact MatrixSubfield.mul_mem F _ _ (MatrixSubfield.mul_mem F _ _ hQF hBF) hQiF + +end PermanentBorder.CommutingPairs + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/CurveParameters.lean b/lean/OAI/Algebra/Determinantal/CurveParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..498233265264ca5c1797b875e451b34915db8df4 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/CurveParameters.lean @@ -0,0 +1,450 @@ +import OAI.Algebra.Determinantal.PunctualCharts + +namespace OAI +namespace PermanentBorder.CurveParameters +open Matrix Algebra MvPolynomial CyclicFrames +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [Infinite K] + +omit [Infinite K] in + +theorem support_field_bound (p : MvPolynomial (Fin 2) K) (hp : p ≠ 0) + (x : Fin 2 → L) (hx : aeval x p = 0) : + Algebra.trdeg K (IntermediateField.adjoin K (Set.range x)) ≤ (1 : Cardinal) := by + have h := ParameterBounds.field_adjoin_trdeg_lt_of_relation x p hp hx + apply Cardinal.lt_natCast_add_one_iff.mp + convert h using 1 + norm_num + +theorem extend_by_chart {p₀ n : ℕ} (F : IntermediateField K L) + (hF : Algebra.trdeg K F ≤ (p₀ : Cardinal)) + (p : MvPolynomial (Fin 2) K) (hp : p ≠ 0) + (x : Fin 2 → L) (hx : aeval x p = 0) (hn : 0 < n) + (r s : Fin n → ℕ) (A B : Matrix (Fin n) (Fin n) L) (v : Fin n → L) + (hA : IsNilpotent A) (hB : IsNilpotent B) (hAB : A * B = B * A) + (hb : MonomialBasis r s A B v) : + ∃ E : IntermediateField K L, + F ≤ E ∧ Algebra.trdeg K E ≤ (p₀+n : ℕ) ∧ + (∀ i, x i ∈ E) ∧ (∀ i j, A i j ∈ E) ∧ + (∀ i j, B i j ∈ E) ∧ (∀ i, v i ∈ E) := by + have : Infinite F := Infinite.of_injective (algebraMap K F) (algebraMap K F).injective + let pF := MvPolynomial.map (algebraMap K F) p + have hpF : pF ≠ 0 := by + exact fun h => hp ((MvPolynomial.map_injective _ (algebraMap K F).injective) + (by simpa only [map_zero] using h)) + have hxF : aeval (R := F) x pF = 0 := by + change eval₂ (algebraMap F L) x (MvPolynomial.map (algebraMap K F) p) = 0 + rw [MvPolynomial.eval₂_map, ← IsScalarTower.algebraMap_eq K F L] + exact hx + let T := IntermediateField.adjoin F (Set.range x) + have : IsScalarTower K T L := IsScalarTower.of_algebraMap_eq' (by ext z; rfl) + have : Infinite T := Infinite.of_injective (algebraMap K T) (algebraMap K T).injective + have hT : Algebra.trdeg F T ≤ (1 : Cardinal) := support_field_bound pF hpF x hxF + obtain ⟨U,hU,hAU,hBU,hvU⟩ := PunctualCharts.chart_field_bound (K := T) + hn r s A B v hA hB hAB hb + have : FaithfulSMul T U := (faithfulSMul_iff_algebraMap_injective T U).mpr + (algebraMap T U).injective + let E := U.restrictScalars K + have : FaithfulSMul K F := (faithfulSMul_iff_algebraMap_injective K F).mpr + (algebraMap K F).injective + have : FaithfulSMul F T := (faithfulSMul_iff_algebraMap_injective F T).mpr + (algebraMap F T).injective + have : FaithfulSMul K T := (faithfulSMul_iff_algebraMap_injective K T).mpr + (algebraMap K T).injective + have hFE : F ≤ E := by + intro z hz + exact U.algebraMap_mem (algebraMap F T ⟨z,hz⟩) + have hxE : ∀ i, x i ∈ E := fun i => + U.algebraMap_mem ⟨x i, IntermediateField.subset_adjoin F _ (Set.mem_range_self i)⟩ + refine ⟨E,hFE,?_,hxE,hAU,hBU,hvU⟩ + calc + Algebra.trdeg K E = Algebra.trdeg K T + Algebra.trdeg T U := + (trdeg_add_eq K T (A := U)).symm + _ = (Algebra.trdeg K F + Algebra.trdeg F T) + Algebra.trdeg T U := by + rw [trdeg_add_eq K F (A := T)] + _ ≤ ((p₀ : Cardinal) + 1) + (n-1 : ℕ) := add_le_add (add_le_add hF hT) hU + _ = (p₀+n : ℕ) := by + rw [add_assoc, ← Nat.cast_one, ← Nat.cast_add, Nat.add_sub_of_le hn, ← Nat.cast_add] + +end PermanentBorder.CurveParameters +namespace PermanentBorder.CurveParameters +open Matrix Algebra MvPolynomial CyclicFrames +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +structure LocalChart (p : MvPolynomial (Fin 2) K) where + length : ℕ + positive : 0 < length + support : Fin 2 → L + on_curve : aeval support p = 0 + r : Fin length → ℕ + s : Fin length → ℕ + A : Matrix (Fin length) (Fin length) L + B : Matrix (Fin length) (Fin length) L + v : Fin length → L + nilA : IsNilpotent A + nilB : IsNilpotent B + commutes : A * B = B * A + basis_eq : MonomialBasis r s A B v + +namespace LocalChart +variable {p : MvPolynomial (Fin 2) K} + +def InField (D : LocalChart (L := L) p) (F : IntermediateField K L) : Prop := + (∀ i, D.support i ∈ F) ∧ (∀ i j, D.A i j ∈ F) ∧ + (∀ i j, D.B i j ∈ F) ∧ (∀ i, D.v i ∈ F) + +theorem InField.mono {D : LocalChart (L := L) p} {F E : IntermediateField K L} + (h : D.InField F) (hFE : F ≤ E) : D.InField E := + ⟨fun i => hFE (h.1 i),fun i j => hFE (h.2.1 i j), + fun i j => hFE (h.2.2.1 i j),fun i => hFE (h.2.2.2 i)⟩ + +theorem extend [Infinite K] (D : LocalChart (L := L) p) (hp : p ≠ 0) + {b : ℕ} (F : IntermediateField K L) (hF : Algebra.trdeg K F ≤ (b : Cardinal)) : + ∃ E : IntermediateField K L, + F ≤ E ∧ Algebra.trdeg K E ≤ (b + D.length : ℕ) ∧ D.InField E := + extend_by_chart F hF p hp D.support D.on_curve D.positive D.r D.s D.A D.B D.v + D.nilA D.nilB D.commutes D.basis_eq + +end LocalChart + +theorem extend_by_finite_family [Infinite K] {κ : Type*} + {p : MvPolynomial (Fin 2) K} (hp : p ≠ 0) + (D : κ → LocalChart (L := L) p) (t : Finset κ) + {b : ℕ} (F : IntermediateField K L) (hF : Algebra.trdeg K F ≤ (b : Cardinal)) : + ∃ E : IntermediateField K L, + F ≤ E ∧ Algebra.trdeg K E ≤ (b + ∑ i ∈ t, (D i).length : ℕ) ∧ + ∀ i ∈ t, (D i).InField E := by + classical + induction t using Finset.induction_on generalizing b F with + | empty => + exact ⟨F,le_rfl,by simpa using hF,by simp⟩ + | @insert i t hi ih => + obtain ⟨T,hFT,hT,hDT⟩ := (D i).extend hp F hF + obtain ⟨E,hTE,hE,hDE⟩ := ih T hT + refine ⟨E,hFT.trans hTE,?_,?_⟩ + · simpa only [Finset.sum_insert hi, Nat.add_assoc] using hE + · intro j hj + rcases Finset.mem_insert.mp hj with hji | hjt + · subst j + exact hDT.mono hTE + · exact hDE j hjt + +end PermanentBorder.CurveParameters + +namespace PermanentBorder.FiniteAlgebras +open Module +variable (L R : Type*) [Field L] [CommRing R] [Algebra L R] [Module.Finite L R] + +include L in + +theorem artinian : IsArtinianRing R := isArtinian_of_tower L inferInstance + +theorem exists_local_power_decomposition : + ∃ e : ℕ, 0 < e ∧ + Nonempty (R ≃ₐ[L] ∀ m : MaximalSpectrum R, R ⧸ m.asIdeal ^ e) := by + have : IsArtinianRing R := artinian L R + obtain ⟨e,he⟩ := IsArtinianRing.isNilpotent_nilradical (R := R) + have he' : nilradical R ^ (e+1) = ⊥ := by rw [pow_succ, he]; simp + refine ⟨e+1, Nat.zero_lt_succ e, ⟨?_⟩⟩ + exact ((AlgEquiv.quotientBot R R).symm.trans + ((Ideal.quotientEquivAlgOfEq R he'.symm).trans + (IsArtinianRing.quotNilradicalPowEquivPi R (e+1)))).restrictScalars L + +theorem maximal_power_ne_top (m : MaximalSpectrum R) {e : ℕ} (he : 0 < e) : + m.asIdeal ^ e ≠ ⊤ := by + intro h + exact m.isMaximal.ne_top (top_le_iff.mp (h ▸ Ideal.pow_le_self he.ne')) + +theorem scalar_residue [IsAlgClosed L] (m : MaximalSpectrum R) (x : R) : + ∃ a : L, x - algebraMap L R a ∈ m.asIdeal := by + have : m.asIdeal.IsMaximal := m.isMaximal + let _ : Field (R ⧸ m.asIdeal) := Ideal.Quotient.field m.asIdeal + obtain ⟨a,ha⟩ := (IsAlgClosed.algebraMap_bijective_of_isIntegral + (k := L) (K := R ⧸ m.asIdeal)).2 (Ideal.Quotient.mk m.asIdeal x) + refine ⟨a, Ideal.Quotient.eq_zero_iff_mem.mp ?_⟩ + rw [map_sub, ← ha] + exact sub_self _ + +theorem translated_coordinate_nilpotent [IsAlgClosed L] + (m : MaximalSpectrum R) (e : ℕ) (x : R) : + ∃ a : L, IsNilpotent + (Ideal.Quotient.mk (m.asIdeal ^ e) x - algebraMap L (R ⧸ m.asIdeal ^ e) a) := by + obtain ⟨a,ha⟩ := scalar_residue L R m x + refine ⟨a,e,?_⟩ + change (Ideal.Quotient.mk (m.asIdeal ^ e) (x - algebraMap L R a)) ^ e = 0 + rw [← map_pow, Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.pow_mem_pow ha e + +theorem finrank_sum_of_equiv {e : ℕ} + (E : R ≃ₐ[L] ∀ m : MaximalSpectrum R, R ⧸ m.asIdeal ^ e) : + ∃ _ : Fintype (MaximalSpectrum R), + finrank L R = ∑ m : MaximalSpectrum R, finrank L (R ⧸ m.asIdeal ^ e) := by + have : IsArtinianRing R := artinian L R + let _ : Fintype (MaximalSpectrum R) := Fintype.ofFinite _ + refine ⟨inferInstance, ?_⟩ + rw [E.toLinearEquiv.finrank_eq, Module.finrank_pi_fintype] + +end PermanentBorder.FiniteAlgebras +namespace PermanentBorder.FiniteAlgebras +open Module MvPolynomial +variable (L R : Type*) [Field L] [CommRing R] [Algebra L R] + [Module.Finite L R] [IsAlgClosed L] + +noncomputable def residueEquiv (m : MaximalSpectrum R) : + L ≃ₐ[L] R ⧸ m.asIdeal := by + have : m.asIdeal.IsMaximal := m.isMaximal + let _ : Field (R ⧸ m.asIdeal) := Ideal.Quotient.field m.asIdeal + exact AlgEquiv.ofBijective (Algebra.ofId L (R ⧸ m.asIdeal)) + IsAlgClosed.algebraMap_bijective_of_isIntegral + +noncomputable def residue (m : MaximalSpectrum R) : R →ₐ[L] L := + (residueEquiv L R m).symm.toAlgHom.comp (Ideal.Quotient.mkₐ L m.asIdeal) + +theorem sub_residue_mem (m : MaximalSpectrum R) (x : R) : + x - algebraMap L R (residue L R m x) ∈ m.asIdeal := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_sub] + change Ideal.Quotient.mk m.asIdeal x - residueEquiv L R m + ((residueEquiv L R m).symm (Ideal.Quotient.mk m.asIdeal x)) = 0 + rw [AlgEquiv.apply_symm_apply, sub_self] + +theorem residue_nilpotent (m : MaximalSpectrum R) (e : ℕ) (x : R) : + IsNilpotent (Ideal.Quotient.mk (m.asIdeal ^ e) x - + algebraMap L (R ⧸ m.asIdeal ^ e) (residue L R m x)) := by + refine ⟨e,?_⟩ + change (Ideal.Quotient.mk (m.asIdeal ^ e) + (x - algebraMap L R (residue L R m x))) ^ e = 0 + rw [← map_pow, Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.pow_mem_pow (sub_residue_mem L R m x) e + +noncomputable def supportPoint (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (m : MaximalSpectrum R) : Fin 2 → L := fun i => residue L R m (q (X i)) + +theorem supportPoint_on_curve (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (m : MaximalSpectrum R) (p : MvPolynomial (Fin 2) L) (hp : q p = 0) : + aeval (supportPoint L R q m) p = 0 := by + have h : (residue L R m).comp q = aeval (supportPoint L R q m) := by + ext i + simp only [AlgHom.comp_apply, aeval_X, supportPoint] + rw [← h, AlgHom.comp_apply, hp, map_zero] + +end PermanentBorder.FiniteAlgebras + +namespace PermanentBorder.PlaneTranslations +open MvPolynomial +variable {L : Type*} [CommRing L] + +noncomputable def translate (a : Fin 2 → L) : + MvPolynomial (Fin 2) L →ₐ[L] MvPolynomial (Fin 2) L := + aeval fun i => X i + C (a i) + +@[simp] theorem translate_X (a : Fin 2 → L) (i : Fin 2) : + translate a (X i) = X i + C (a i) := aeval_X _ _ + +@[simp] theorem translate_C (a : Fin 2 → L) (c : L) : + translate a (C c) = C c := by exact (translate a).commutes c + +theorem translate_comp (a b : Fin 2 → L) : + (translate a).comp (translate b) = translate (a+b) := by + ext i + simp only [AlgHom.comp_apply, translate_X, map_add, translate_C, Pi.add_apply, map_add] + simp only [add_assoc] + +noncomputable def equivalence (a : Fin 2 → L) : + MvPolynomial (Fin 2) L ≃ₐ[L] MvPolynomial (Fin 2) L := + AlgEquiv.ofAlgHom (translate a) (translate (-a)) + (by rw [translate_comp]; ext i; simp) + (by rw [translate_comp]; ext i; simp) + +@[simp] theorem equivalence_X (a : Fin 2 → L) (i : Fin 2) : + equivalence a (X i) = X i + C (a i) := by + exact translate_X a i + +end PermanentBorder.PlaneTranslations + +namespace PermanentBorder.FinitePlaneFrames +open MvPolynomial Module Matrix +variable {L S : Type*} [Field L] [CommRing S] [Algebra L S] + +noncomputable def representation {n : ℕ} (b : Basis (Fin n) L S) : + S →ₐ[L] Matrix (Fin n) (Fin n) L := + (LinearMap.toMatrixAlgEquiv b).toAlgHom.comp (Algebra.lmul L S) + +noncomputable def unitVector {n : ℕ} (b : Basis (Fin n) L S) : Fin n → L := b.equivFun 1 + +theorem action_on_unit {n : ℕ} (b : Basis (Fin n) L S) (x : S) : + (representation b x).mulVec (unitVector b) = b.equivFun x := by + change ((LinearMap.toMatrix b b) (Algebra.lmul L S x)).mulVec + (fun i => b.repr 1 i) = _ + rw [LinearMap.toMatrix_mulVec_repr] + simp only [Module.Basis.equivFun_apply] + change (fun i => b.repr (x * 1) i) = _ + rw [mul_one] + +theorem exists_monomial_basis [Module.Finite L S] + (q : MvPolynomial (Fin 2) L →ₐ[L] S) (hq : Function.Surjective q) : + ∃ (b : Basis (Fin (finrank L S)) L S) (r s : Fin (finrank L S) → ℕ), + ∀ i, b i = q (X 0 ^ r i * X 1 ^ s i) := by + classical + let μ := q.toLinearMap ∘ (MvPolynomial.basisMonomials (Fin 2) L) + have hsp : Submodule.span L (Set.range μ) = ⊤ := by + rw [show Set.range μ = q.toLinearMap '' Set.range (MvPolynomial.basisMonomials (Fin 2) L) from + Set.range_comp _ _] + rw [← Submodule.map_span, (MvPolynomial.basisMonomials (Fin 2) L).span_eq, + Submodule.map_top] + exact LinearMap.range_eq_top.mpr hq + have hdim : finrank L (Submodule.span L (Set.range μ)) = finrank L S := by + rw [hsp, finrank_top] + obtain ⟨f,hmem,hspan,hind⟩ : ∃ f : Fin (finrank L S) → S, + (∀ i, f i ∈ Set.range μ) ∧ Submodule.span L (Set.range f) = ⊤ ∧ + LinearIndependent L f := by + have he := Submodule.exists_fun_fin_finrank_span_eq L (Set.range μ) + rw [hdim] at he + simpa only [hsp] using he + choose e he using hmem + let b := Basis.mk hind (le_of_eq hspan.symm) + refine ⟨b,fun i => e i 0,fun i => e i 1,?_⟩ + intro i + rw [show b i = f i from Basis.mk_apply hind (le_of_eq hspan.symm) i, ← he i] + change q (monomial (e i) 1) = _ + congr 1 + rw [MvPolynomial.monomial_eq, map_one, one_mul, Finsupp.prod_fintype] + · simp only [Fin.prod_univ_two] + · simp + +end PermanentBorder.FinitePlaneFrames +namespace PermanentBorder.FiniteAlgebras +open Module MvPolynomial Matrix FinitePlaneFrames +variable (L R : Type*) [Field L] [CommRing R] [Algebra L R] + [Module.Finite L R] [IsAlgClosed L] + +noncomputable def localHom (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (m : MaximalSpectrum R) (e : ℕ) : + MvPolynomial (Fin 2) L →ₐ[L] R ⧸ m.asIdeal ^ e := + (Ideal.Quotient.mkₐ L (m.asIdeal ^ e)).comp q + +noncomputable def shiftedLocalHom (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (m : MaximalSpectrum R) (e : ℕ) : + MvPolynomial (Fin 2) L →ₐ[L] R ⧸ m.asIdeal ^ e := + (localHom L R q m e).comp (PlaneTranslations.translate (-supportPoint L R q m)) + +theorem shiftedLocalHom_X (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (m : MaximalSpectrum R) (e : ℕ) (i : Fin 2) : + shiftedLocalHom L R q m e (X i) = localHom L R q m e (X i) - + algebraMap L (R ⧸ m.asIdeal ^ e) (supportPoint L R q m i) := by + simp only [shiftedLocalHom, AlgHom.comp_apply, PlaneTranslations.translate_X, + map_add, Pi.neg_apply, map_neg] + rw [show (localHom L R q m e) (C (supportPoint L R q m i)) = + algebraMap L (R ⧸ m.asIdeal ^ e) (supportPoint L R q m i) from + (localHom L R q m e).commutes _] + exact (sub_eq_add_neg _ _).symm + +theorem shiftedLocalHom_surjective (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (hq : Function.Surjective q) (m : MaximalSpectrum R) (e : ℕ) : + Function.Surjective (shiftedLocalHom L R q m e) := + Ideal.Quotient.mk_surjective.comp (hq.comp + (PlaneTranslations.equivalence (-supportPoint L R q m)).surjective) + +theorem shiftedLocalHom_X_nilpotent (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (m : MaximalSpectrum R) (e : ℕ) (i : Fin 2) : + IsNilpotent (shiftedLocalHom L R q m e (X i)) := by + rw [shiftedLocalHom_X] + exact residue_nilpotent L R m e (q (X i)) + +omit [IsAlgClosed L] in + +theorem local_length_pos (m : MaximalSpectrum R) {e : ℕ} (he : 0 < e) : + 0 < finrank L (R ⧸ m.asIdeal ^ e) := by + have : Nontrivial (R ⧸ m.asIdeal ^ e) := + Ideal.Quotient.nontrivial_iff.mpr (maximal_power_ne_top R m he) + exact finrank_pos + +theorem local_monomial_chart (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (hq : Function.Surjective q) (m : MaximalSpectrum R) (e : ℕ) : + ∃ (b : Basis (Fin (finrank L (R ⧸ m.asIdeal ^ e))) L (R ⧸ m.asIdeal ^ e)) + (r s : Fin (finrank L (R ⧸ m.asIdeal ^ e)) → ℕ), + CyclicFrames.MonomialBasis r s + (representation b (shiftedLocalHom L R q m e (X 0))) + (representation b (shiftedLocalHom L R q m e (X 1))) (unitVector b) := by + obtain ⟨b,r,s,hb⟩ := FinitePlaneFrames.exists_monomial_basis + (shiftedLocalHom L R q m e) (shiftedLocalHom_surjective L R q hq m e) + refine ⟨b,r,s,?_⟩ + intro i + have h : (representation b (shiftedLocalHom L R q m e (X 0))) ^ r i * + (representation b (shiftedLocalHom L R q m e (X 1))) ^ s i = + representation b (shiftedLocalHom L R q m e (X 0 ^ r i * X 1 ^ s i)) := by + simp only [map_mul, map_pow] + rw [h, action_on_unit, ← hb i] + ext j + simpa only [Pi.single_apply, eq_comm] using b.equivFun_self i j + +end PermanentBorder.FiniteAlgebras +namespace PermanentBorder.FiniteAlgebras +open Module +variable (L R : Type*) [Field L] [CommRing R] [Algebra L R] [Module.Finite L R] + +theorem exists_canonical_local_power_decomposition : + ∃ e : ℕ, 0 < e ∧ ∃ E : R ≃ₐ[L] ∀ m : MaximalSpectrum R, R ⧸ m.asIdeal ^ e, + ∀ x m, E x m = Ideal.Quotient.mk (m.asIdeal ^ e) x := by + have : IsArtinianRing R := artinian L R + obtain ⟨e,he⟩ := IsArtinianRing.isNilpotent_nilradical (R := R) + have he' : nilradical R ^ (e+1) = ⊥ := by rw [pow_succ, he]; simp + let E := ((AlgEquiv.quotientBot R R).symm.trans + ((Ideal.quotientEquivAlgOfEq R he'.symm).trans + (IsArtinianRing.quotNilradicalPowEquivPi R (e+1)))).restrictScalars L + exact ⟨e+1, Nat.zero_lt_succ e, E, fun _ _ => rfl⟩ + +end PermanentBorder.FiniteAlgebras +namespace PermanentBorder.BasisFieldRecovery +open Module Matrix +variable {K L S ι κ : Type*} [Field K] [Field L] [Algebra K L] + [AddCommGroup S] [Module L S] [Fintype ι] [Fintype κ] + +omit [Fintype ι] in + +theorem repr_mem (F : IntermediateField K L) (b : Basis ι L S) (c : Basis κ L S) + (hbc : ∀ i j, c.repr (b j) i ∈ F) (x : S) (hx : ∀ i, c.repr x i ∈ F) : + ∀ j, b.repr x j ∈ F := by + classical + let e := b.indexEquiv c + let b' := b.reindex e + let P : (Matrix κ κ L)ˣ := + ⟨c.toMatrix b', b'.toMatrix c, + c.toMatrix_mul_toMatrix_flip b', b'.toMatrix_mul_toMatrix_flip c⟩ + have hP : ∀ i j, (P : Matrix κ κ L) i j ∈ F := by + intro i j + simpa only [P, Units.val_mk, b', Basis.toMatrix_apply, Basis.reindex_apply] using hbc i (e.symm j) + have hI := MatrixSubfield.unit_inv_mem F P hP + have hb'x : ∀ j, b'.repr x j ∈ F := by + intro j + rw [← c.toMatrix_mulVec_repr b' x] + exact F.sum_mem fun i _ => F.mul_mem (hI j i) (hx i) + intro j + have h := hb'x (e j) + simpa only [b', Basis.repr_reindex, Finsupp.equivMapDomain_apply, + Equiv.symm_apply_apply] using h + +end PermanentBorder.BasisFieldRecovery + +namespace PermanentBorder.MatrixSubfield +open Matrix +variable {K L ι : Type*} [Field K] [Field L] [Algebra K L] + [Fintype ι] [DecidableEq ι] + +theorem pow_mem (F : IntermediateField K L) (A : Matrix ι ι L) + (hA : ∀ i j, A i j ∈ F) (r : ℕ) : ∀ i j, (A ^ r) i j ∈ F := by + induction r with + | zero => intro i j; simp only [pow_zero, one_apply]; split <;> simp + | succ r ih => simpa only [pow_succ] using mul_mem F (A^r) A ih hA + +omit [DecidableEq ι] in +theorem mulVec_mem (F : IntermediateField K L) (A : Matrix ι ι L) (v : ι → L) + (hA : ∀ i j, A i j ∈ F) (hv : ∀ i, v i ∈ F) : + ∀ i, (A.mulVec v) i ∈ F := by + intro i + exact F.sum_mem fun j _ => F.mul_mem (hA i j) (hv j) + +end PermanentBorder.MatrixSubfield + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/DegreeBounds.lean b/lean/OAI/Algebra/Determinantal/DegreeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d48abb48fc9a894f2bca9de26b5117428d2df2d9 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/DegreeBounds.lean @@ -0,0 +1,390 @@ +import OAI.Algebra.Determinantal.SingularValues + +namespace OAI + +namespace PermanentBorder.FrobeniusPlane +open MvPolynomial +variable {K : Type*} [Field K] [CharP K 2] + +omit [CharP K 2] in +lemma partial_degree {f : Plane K} {n : ℕ} (hf : f.totalDegree ≤ n+1) (i : Fin 2) : + (pderiv i f).totalDegree ≤ n := by + classical + apply Finset.sup_le + intro m hm + have hc := mem_support_iff.mp hm + rw [coeff_pderiv] at hc + have hp : f.coeff (m+Finsupp.single i 1) ≠ 0 := (mul_ne_zero_iff.mp hc).1 + have hd := le_totalDegree (mem_support_iff.mpr hp) + change (m+Finsupp.single i 1).degree ≤ f.totalDegree at hd + simp only [map_add,Finsupp.degree_single] at hd + change m.degree ≤ n + omega + +omit [CharP K 2] in +lemma square_degree (p : Plane K) : (p^2).totalDegree = 2*p.totalDegree := by + by_cases hp : p=0 + · simp [hp] + · rw [pow_two,totalDegree_mul_of_isDomain hp hp] + omega + +lemma squareForm_degree_bounds {a b c d : Plane K} {n : ℕ} + (h : (squareForm a b c d).totalDegree ≤ n+2) : + 2*a.totalDegree ≤ n+2 ∧ 2*b.totalDegree ≤ n+1 ∧ + 2*c.totalDegree ≤ n+1 ∧ 2*d.totalDegree ≤ n := by + have hx := partial_degree h 0 + have hy := partial_degree h 1 + rw [squareForm_partial_zero] at hx + rw [squareForm_partial_one] at hy + have hd := partial_degree (partial_degree h 0) 1 + rw [squareForm_mixed,square_degree] at hd + have hxd : (X (0 : Fin 2)*d^2).totalDegree ≤ n+1 := by + exact (totalDegree_mul _ _).trans (by rw [totalDegree_X,square_degree]; omega) + have hyd : (X (1 : Fin 2)*d^2).totalDegree ≤ n+1 := by + exact (totalDegree_mul _ _).trans (by rw [totalDegree_X,square_degree]; omega) + have hb : 2*b.totalDegree ≤ n+1 := by + rw [← square_degree] + have he : b^2=(b^2+X 1*d^2)-X 1*d^2 := by ring + rw [he] + exact (totalDegree_sub _ _).trans (max_le hx hyd) + have hc : 2*c.totalDegree ≤ n+1 := by + rw [← square_degree] + have he : c^2=(c^2+X 0*d^2)-X 0*d^2 := by ring + rw [he] + exact (totalDegree_sub _ _).trans (max_le hy hxd) + have ha : 2*a.totalDegree ≤ n+2 := by + rw [← square_degree] + have he : a^2=squareForm a b c d-X 0*b^2-X 1*c^2-X 0*X 1*d^2 := by + unfold squareForm; ring + rw [he] + apply (totalDegree_sub _ _).trans + apply max_le + · apply (totalDegree_sub _ _).trans + apply max_le + · apply (totalDegree_sub _ _).trans + exact max_le h ((totalDegree_mul _ _).trans (by rw [totalDegree_X,square_degree]; omega)) + · exact (totalDegree_mul _ _).trans (by rw [totalDegree_X,square_degree]; omega) + · have he' : X (0 : Fin 2)*X 1*d^2=X 0*(X 1*d^2) := mul_assoc .. + rw [he'] + exact (totalDegree_mul _ _).trans (by rw [totalDegree_X]; omega) + exact ⟨ha,hb,hc,hd⟩ + +omit [CharP K 2] in +lemma squareForm_degree_le {a b c d : Plane K} {n : ℕ} + (ha : 2*a.totalDegree ≤ n) (hb : 1+2*b.totalDegree ≤ n) + (hc : 1+2*c.totalDegree ≤ n) (hd : 2+2*d.totalDegree ≤ n) : + (squareForm a b c d).totalDegree ≤ n := by + unfold squareForm + apply (totalDegree_add _ _).trans + apply max_le + · apply (totalDegree_add _ _).trans + apply max_le + · apply (totalDegree_add _ _).trans + exact max_le (by simpa only [square_degree] using ha) + ((totalDegree_mul _ _).trans (by simpa only [totalDegree_X,square_degree] using hb)) + · exact (totalDegree_mul _ _).trans (by simpa only [totalDegree_X,square_degree] using hc) + · have h := (totalDegree_mul (X (0 : Fin 2) : Plane K) (X 1)) + exact (totalDegree_mul _ _).trans (by simp only [totalDegree_X,square_degree] at *; omega) + +omit [CharP K 2] in +lemma subtract_top_degree {p : Plane K} {n : ℕ} (hp : p.totalDegree ≤ n+1) : + (p-homogeneousComponent (n+1) p).totalDegree ≤ n := by + classical + apply Finset.sup_le + intro m hm + have hc := mem_support_iff.mp hm + rw [coeff_sub,coeff_homogeneousComponent] at hc + change m.degree ≤ n + by_contra! hn + by_cases he : m.degree=n+1 + · exact hc (by simp [he]) + · have hz : p.coeff m=0 := coeff_eq_zero_of_totalDegree_lt (by change p.totalDegree < m.degree; omega) + exact hc (by simp [he,hz]) + +lemma squareForm_top_even {a b c d : Plane K} {r : ℕ} (hr : 2 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r) : + homogeneousComponent (2*r) (squareForm a b c d) = + squareForm (homogeneousComponent r a) 0 0 (homogeneousComponent (r-1) d) := by + let A := homogeneousComponent r a + let D := homogeneousComponent (r-1) d + have hdeg := squareForm_degree_bounds (n := 2*r-2) (by omega : + (squareForm a b c d).totalDegree ≤ (2*r-2)+2) + have ha : 2*(a-A).totalDegree ≤ 2*r-1 := by + have hh : (a-homogeneousComponent ((r-1)+1) a).totalDegree ≤ r-1 := + subtract_top_degree (by omega) + have he : r-1+1=r := by omega + rw [he] at hh + change (a-A).totalDegree ≤ r-1 at hh + omega + have hd : 2+2*(d-D).totalDegree ≤ 2*r-1 := by + have hh : (d-homogeneousComponent ((r-2)+1) d).totalDegree ≤ r-2 := + subtract_top_degree (by omega) + have he : r-2+1=r-1 := by omega + rw [he] at hh + change (d-D).totalDegree ≤ r-2 at hh + omega + have hlow := squareForm_degree_le ha (by omega : 1+2*b.totalDegree ≤ 2*r-1) + (by omega : 1+2*c.totalDegree ≤ 2*r-1) hd + have hz : homogeneousComponent (2*r) (squareForm (a-A) b c (d-D))=0 := + homogeneousComponent_eq_zero _ _ (by omega) + have htop : (squareForm A 0 0 D).IsHomogeneous (2*r) := by + simp only [squareForm,zero_pow (by omega : 2 ≠ 0),mul_zero,add_zero] + apply IsHomogeneous.add + · convert (homogeneousComponent_isHomogeneous r a).pow 2 using 1; omega + · convert ((isHomogeneous_X K (0 : Fin 2)).mul (isHomogeneous_X K 1)).mul + ((homogeneousComponent_isHomogeneous (r-1) d).pow 2) using 1; omega + have he : squareForm a b c d = squareForm A 0 0 D + squareForm (a-A) b c (d-D) := by + rw [← squareForm_add] + simp only [add_sub_cancel,zero_add] + rw [he,map_add,homogeneousComponent_eq_self htop,hz,add_zero] + +lemma squareForm_top_odd {a b c d : Plane K} {r : ℕ} (hr : 1 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r+1) : + homogeneousComponent (2*r+1) (squareForm a b c d) = + squareForm 0 (homogeneousComponent r b) (homogeneousComponent r c) 0 := by + let B := homogeneousComponent r b + let C' := homogeneousComponent r c + have hdeg := squareForm_degree_bounds (n := 2*r-1) (by omega : + (squareForm a b c d).totalDegree ≤ (2*r-1)+2) + have hb : 1+2*(b-B).totalDegree ≤ 2*r := by + have hh : (b-homogeneousComponent ((r-1)+1) b).totalDegree ≤ r-1 := + subtract_top_degree (by omega) + have he : r-1+1=r := by omega + rw [he] at hh + change (b-B).totalDegree ≤ r-1 at hh + omega + have hc : 1+2*(c-C').totalDegree ≤ 2*r := by + have hh : (c-homogeneousComponent ((r-1)+1) c).totalDegree ≤ r-1 := + subtract_top_degree (by omega) + have he : r-1+1=r := by omega + rw [he] at hh + change (c-C').totalDegree ≤ r-1 at hh + omega + have hlow := squareForm_degree_le (by omega : 2*a.totalDegree ≤ 2*r) hb hc + (by omega : 2+2*d.totalDegree ≤ 2*r) + have hz : homogeneousComponent (2*r+1) (squareForm a (b-B) (c-C') d)=0 := + homogeneousComponent_eq_zero _ _ (by omega) + have htop : (squareForm 0 B C' 0).IsHomogeneous (2*r+1) := by + simp only [squareForm,zero_pow (by omega : 2 ≠ 0),mul_zero,add_zero,zero_add] + apply IsHomogeneous.add + · convert (isHomogeneous_X K (0 : Fin 2)).mul + ((homogeneousComponent_isHomogeneous r b).pow 2) using 1; omega + · convert (isHomogeneous_X K (1 : Fin 2)).mul + ((homogeneousComponent_isHomogeneous r c).pow 2) using 1; omega + have he : squareForm a b c d = squareForm 0 B C' 0 + squareForm a (b-B) (c-C') d := by + rw [← squareForm_add] + simp only [add_sub_cancel,zero_add] + rw [he,map_add,homogeneousComponent_eq_self htop,hz,add_zero] + +end PermanentBorder.FrobeniusPlane +namespace PermanentBorder.FrobeniusPlane +open MvPolynomial +variable {K : Type*} [Field K] [CharP K 2] + +omit [CharP K 2] in +lemma homogeneous_not_unit {p : Plane K} {n : ℕ} (hp : p.IsHomogeneous n) + (hn : 0 < n) : ¬ IsUnit p := by + intro hu + have hz := (isUnit_iff_totalDegree_of_isReduced.mp hu).2 + have he := hp.totalDegree hu.ne_zero + omega + +omit [CharP K 2] in +lemma squarefree_even_pair {a d : Plane K} + (h : Squarefree (squareForm a 0 0 d)) : IsRelPrime a d := by + intro g hga hgd + apply h g + simp only [squareForm,zero_pow (by omega : 2 ≠ 0),mul_zero,add_zero] + apply dvd_add + · simpa only [pow_two] using mul_dvd_mul hga hga + · exact dvd_mul_of_dvd_right (by simpa only [pow_two] using mul_dvd_mul hgd hgd) _ + +omit [CharP K 2] in +lemma squarefree_odd_pair {b c : Plane K} + (h : Squarefree (squareForm 0 b c 0)) : IsRelPrime b c := by + intro g hgb hgc + apply h g + simp only [squareForm,zero_pow (by omega : 2 ≠ 0),mul_zero,add_zero,zero_add] + exact dvd_add (dvd_mul_of_dvd_right (by simpa only [pow_two] using mul_dvd_mul hgb hgb) _) + (dvd_mul_of_dvd_right (by simpa only [pow_two] using mul_dvd_mul hgc hgc) _) + +lemma squarefree_even_leading {a b c d : Plane K} {r : ℕ} (hr : 2 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r) + (hs : Squarefree (homogeneousComponent (2*r) (squareForm a b c d))) : + homogeneousComponent r a ≠ 0 ∧ homogeneousComponent (r-1) d ≠ 0 ∧ + IsRelPrime (homogeneousComponent r a) (homogeneousComponent (r-1) d) := by + rw [squareForm_top_even hr hf] at hs + have hp := squarefree_even_pair hs + have ha := homogeneous_not_unit (homogeneousComponent_isHomogeneous r a) (by omega : 0 < r) + have hd := homogeneous_not_unit (homogeneousComponent_isHomogeneous (r-1) d) (by omega : 0 < r-1) + refine ⟨?_,?_,hp⟩ + · intro hz + apply hd + exact hp (by rw [hz]; exact dvd_zero _) dvd_rfl + · intro hz + apply ha + exact hp dvd_rfl (by rw [hz]; exact dvd_zero _) + +lemma squarefree_odd_leading {a b c d : Plane K} {r : ℕ} (hr : 1 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r+1) + (hs : Squarefree (homogeneousComponent (2*r+1) (squareForm a b c d))) : + homogeneousComponent r b ≠ 0 ∧ homogeneousComponent r c ≠ 0 ∧ + IsRelPrime (homogeneousComponent r b) (homogeneousComponent r c) := by + rw [squareForm_top_odd hr hf] at hs + have hp := squarefree_odd_pair hs + have hb := homogeneous_not_unit (homogeneousComponent_isHomogeneous r b) (by omega : 0 < r) + have hc := homogeneous_not_unit (homogeneousComponent_isHomogeneous r c) (by omega : 0 < r) + refine ⟨?_,?_,hp⟩ + · intro hz + exact hc (hp (by rw [hz]; exact dvd_zero _) dvd_rfl) + · intro hz + exact hb (hp dvd_rfl (by rw [hz]; exact dvd_zero _)) + +end PermanentBorder.FrobeniusPlane + +namespace PermanentBorder.BinaryLeading +open MvPolynomial +variable {K : Type*} [Field K] + +noncomputable def linear (t : K) : MvPolynomial (Fin 2) K := X 1+C t*X 0 + +lemma linear_irreducible (t : K) : Irreducible (linear t) := by + have h := irreducible_mul_X_add (1 : MvPolynomial (Fin 2) K) (C t*X 0) 1 + one_ne_zero (by simp) (by + intro hh + have := vars_mul (C t : MvPolynomial (Fin 2) K) (X 0) hh + simp at this) (isRelPrime_one_left) + simpa only [one_mul,linear] using h + +lemma linear_eval (a t : K) : eval ![1,-a] (linear t) = t-a := by + simp [linear,sub_eq_add_neg,add_comm] + +lemma linear_pair {a b : K} (hab : a ≠ b) : IsRelPrime (linear a) (linear b) := by + apply (linear_irreducible a).isRelPrime_iff_not_dvd.mpr + intro h + have hh := map_dvd (eval ![1,-a]) h + rw [linear_eval,linear_eval,sub_self,zero_dvd_iff,sub_eq_zero] at hh + exact hab hh.symm + +variable {ι : Type*} [Fintype ι] + +lemma squarefree_product (t : ι → K) (ht : Function.Injective t) : + Squarefree (∏ i, linear (t i)) := by + classical + apply Finset.squarefree_prod_of_pairwise_isCoprime + · intro i _ j _ hij + exact linear_pair (fun h => hij (ht h)) + · intro i _ + exact (linear_irreducible (t i)).squarefree + +lemma product_partial_coprime (t : ι → K) (ht : Function.Injective t) : + IsRelPrime (∏ i, linear (t i)) (pderiv 1 (∏ i, linear (t i))) := by + classical + apply IsRelPrime.prod_left + intro i hi + apply (linear_irreducible (t i)).isRelPrime_iff_not_dvd.mpr + intro hd + let E := eval ![1,-t i] + have hprod : (∏ j, linear (t j)) = linear (t i)*∏ j ∈ Finset.univ.erase i,linear (t j) := + (Finset.mul_prod_erase Finset.univ (fun j => linear (t j)) hi).symm + have he : E (pderiv 1 (∏ j, linear (t j))) = ∏ j ∈ Finset.univ.erase i, (t j-t i) := by + rw [hprod,pderiv_mul] + have hdlin : pderiv 1 (linear (t i)) = 1 := by simp [linear] + rw [hdlin,one_mul,map_add,map_mul] + simp only [E,linear_eval,sub_self,zero_mul,add_zero,map_prod] + have hh := map_dvd E hd + rw [show E (linear (t i))=0 by simp [E,linear_eval],zero_dvd_iff,he] at hh + obtain ⟨j,hj,hj0⟩ := Finset.prod_eq_zero_iff.mp hh + have hji := (Finset.mem_erase.mp hj).1 + exact hji (ht (sub_eq_zero.mp hj0)) + +lemma product_nonzero (t : ι → K) : (∏ i, linear (t i)) ≠ 0 := by + classical + apply Finset.prod_ne_zero_iff.mpr + intro i _ + exact (linear_irreducible _).ne_zero + +lemma product_partial_nonzero [Nonempty ι] (t : ι → K) (ht : Function.Injective t) : + pderiv 1 (∏ i, linear (t i)) ≠ 0 := by + intro hz + have hunit := product_partial_coprime t ht dvd_rfl (by rw [hz]; exact dvd_zero _) + obtain ⟨i⟩ := ‹Nonempty ι› + have hi : linear (t i) ∣ ∏ j, linear (t j) := Finset.dvd_prod_of_mem _ (Finset.mem_univ i) + exact (linear_irreducible (t i)).not_isUnit (isUnit_of_dvd_unit hi hunit) + +end PermanentBorder.BinaryLeading +namespace PermanentBorder.PlaneHilbert +open MvPolynomial +variable {K R : Type*} [Field K] [CommRing R] [Algebra K R] + +lemma leading_vanishing_mem (q : Plane (K := K) →ₐ[K] R) {p : Plane (K := K)} {e : ℕ} + (hp : p.totalDegree ≤ e) (hq : q p=0) : q (homogeneousComponent e p) ∈ filtered q e := by + have hh := sub_topComponent_mem_filtered q hp + change q p-q (homogeneousComponent e p) ∈ filtered q e at hh + rw [hq,zero_sub] at hh + exact (Submodule.neg_mem_iff _).mp hh + +theorem finite_of_leading_pair (q : Plane (K := K) →ₐ[K] R) (hq : Function.Surjective q) + {p t : Plane (K := K)} {e f B : ℕ} (hp : p.totalDegree ≤ e) (ht : t.totalDegree ≤ f) + (hqp : q p=0) (hqt : q t=0) (hp0 : homogeneousComponent e p ≠ 0) + (ht0 : homogeneousComponent f t ≠ 0) + (hcop : IsRelPrime (homogeneousComponent e p) (homogeneousComponent f t)) + (he : e ≤ B+1) (hf : f ≤ B+1) (hef : e+f ≤ 2*B+1) : + Module.Finite K R ∧ Module.finrank K R ≤ 2*Module.finrank K (filtered q B) := by + have hh := finite_interpolation_half q hq + (SliceParameters.homogeneous_intWeight (homogeneousComponent_isHomogeneous e p)) + (SliceParameters.homogeneous_intWeight (homogeneousComponent_isHomogeneous f t)) + hp0 ht0 hcop (leading_vanishing_mem q hp hqp) (leading_vanishing_mem q ht hqt) he hf hef + refine ⟨?_,hh.2⟩ + apply Module.Finite.of_surjective (filtered q (2*B)).subtype + intro z + exact ⟨⟨z,by rw [hh.1]; trivial⟩,rfl⟩ + +end PermanentBorder.PlaneHilbert + +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert FrobeniusPlane +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [CharP L 2] + +noncomputable def halfIdeal (a b c d : Plane L) : Ideal (Plane L) := Ideal.span {a,b,c,d} + +omit [CharP L 2] in +lemma halfIdeal_mem (a b c d : Plane L) : + a ∈ halfIdeal a b c d ∧ b ∈ halfIdeal a b c d ∧ c ∈ halfIdeal a b c d ∧ d ∈ halfIdeal a b c d := by + exact ⟨Ideal.subset_span (by simp),Ideal.subset_span (by simp), + Ideal.subset_span (by simp),Ideal.subset_span (by simp)⟩ + +lemma halfIdeal_even_finite {a b c d : Plane L} {r : ℕ} (hr : 2 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r) + (hs : Squarefree (homogeneousComponent (2*r) (squareForm a b c d))) : + let q := Ideal.Quotient.mkₐ L (halfIdeal a b c d) + Module.Finite L (Plane L ⧸ halfIdeal a b c d) ∧ + finrank L (Plane L ⧸ halfIdeal a b c d) ≤ 2*finrank L (filtered q r) := by + let q := Ideal.Quotient.mkₐ L (halfIdeal a b c d) + have hm := halfIdeal_mem a b c d + have hdeg := squareForm_degree_bounds (n := 2*r-2) (by simpa [show 2*r-2+2=2*r by omega] using hf) + obtain ⟨ha0,hd0,hcop⟩ := squarefree_even_leading hr hf hs + exact finite_of_leading_pair q Ideal.Quotient.mk_surjective + (show a.totalDegree ≤ r by omega) (show d.totalDegree ≤ r-1 by omega) + (Ideal.Quotient.eq_zero_iff_mem.mpr hm.1) (Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.2.2) + ha0 hd0 hcop (by omega) (by omega) (by omega) + +lemma halfIdeal_odd_finite {a b c d : Plane L} {r : ℕ} (hr : 1 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r+1) + (hs : Squarefree (homogeneousComponent (2*r+1) (squareForm a b c d))) : + let q := Ideal.Quotient.mkₐ L (halfIdeal a b c d) + Module.Finite L (Plane L ⧸ halfIdeal a b c d) ∧ + finrank L (Plane L ⧸ halfIdeal a b c d) ≤ 2*finrank L (filtered q r) := by + let q := Ideal.Quotient.mkₐ L (halfIdeal a b c d) + have hm := halfIdeal_mem a b c d + have hdeg := squareForm_degree_bounds (n := 2*r-1) (by simpa [show 2*r-1+2=2*r+1 by omega] using hf) + obtain ⟨hb0,hc0,hcop⟩ := squarefree_odd_leading hr hf hs + exact finite_of_leading_pair q Ideal.Quotient.mk_surjective + (show b.totalDegree ≤ r by omega) (show c.totalDegree ≤ r by omega) + (Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.1) (Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.2.1) + hb0 hc0 hcop (by omega) (by omega) (by omega) + +end PermanentBorder.CurveFamily + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/DeterminantFields.lean b/lean/OAI/Algebra/Determinantal/DeterminantFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..ddb7fae076681ffd190ff70c199462a99d1f5c21 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/DeterminantFields.lean @@ -0,0 +1,314 @@ +import OAI.Algebra.Determinantal.QuotientFields + +namespace OAI + +namespace PermanentBorder.AdjugateAlgebra +open Polynomial Matrix Module +variable {K L : Type*} [Field K] [Field L] [Algebra K L] {k : ℕ} + +theorem low_coefficients_mem (F : IntermediateField K L) + (θ : Fin (k+1) → L) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) (hk : 0 < k) + (P : L[X][X]) (hP : TotalDegreeLE P (k-1)) + (hcoord : ∀ i, (rowBasis θ hθ A hk).repr + ((Ideal.Quotient.mkₐ L (rowIdeal (pencilBase θ A))) P) i ∈ F) : + Bivariate.InField F P := by + intro a b + by_cases hab : a+b ≤ k-1 + · let i : PlaneIndex (k-1) := ⟨(⟨a,by omega⟩,⟨a+b+1,by omega⟩),by + change a < a+b+1 + omega⟩ + have h := hcoord i + rw [rowBasis_repr θ hθ A hk P hP] at h + change (P.coeff a).coeff (a+b+1-a-1) ∈ F at h + rwa [show a+b+1-a-1=b by omega] at h + · rw [hP a b (by omega)] + exact F.zero_mem + +theorem rowEntry_inField (F : IntermediateField K L) + (θ : Fin (k+1) → L) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) (hk : 0 < k) + (hθF : ∀ i, θ i ∈ F) + (hmon : ∀ a d i, (rowBasis θ hθ A hk).repr + ((Ideal.Quotient.mkₐ L (rowIdeal (pencilBase θ A))) + (monomial a (monomial d 1))) i ∈ F) (j : Fin (k+1)) : + Bivariate.InField F (rowEntry (pencilBase θ A) j) := by + let q := Ideal.Quotient.mkₐ L (rowIdeal (pencilBase θ A)) + let P := rowEntry (pencilBase θ A) j + let P₀ := rowEntry (pencilBase θ 0) j + have hP₀ : Bivariate.InField F P₀ := by + apply (Bivariate.inField_iff_lifts F _).mpr + refine ⟨rowEntry (pencilBase (fun i => (⟨θ i,hθF i⟩ : F)) 0) j,?_⟩ + rw [map_rowEntry] + rfl + have hdeg : TotalDegreeLE (P-P₀) (k-1) := by + apply TotalDegreeLE.pred_of_top_zero hk + · exact (totalDegreeLE_rowEntry θ A j).sub (totalDegreeLE_rowEntry θ 0 j) + · simp only [P,P₀,map_sub,coeff_sub,rowEntry_top,sub_self] + have hzero : q P = 0 := Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span ⟨j,rfl⟩) + have hlow : Bivariate.InField F (P-P₀) := by + apply low_coefficients_mem F θ hθ A hk _ hdeg + intro i + change (rowBasis θ hθ A hk).repr (q (P-P₀)) i ∈ F + rw [map_sub,hzero,zero_sub,map_neg,Finsupp.neg_apply] + exact F.neg_mem (coordinates_mem F q.toLinearMap (rowBasis θ hθ A hk) hmon P₀ hP₀ i) + simpa only [sub_add_cancel] using hlow.add hP₀ + +theorem column_contraction (θ : Fin (k+1) → L) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) (j : Fin (k+1)) : + rowContraction θ A (fun i => A i j) = (pencilMatrix (pencilBase θ A)).det - + (X + C (X * C (θ j))) * rowEntry (pencilBase θ A) j := by + classical + let v : Fin (k+1) → L[X] := Pi.single j 1 + have hv : rowPair (pencilBase θ A) v = rowEntry (pencilBase θ A) j := by + simp [v,rowPair_eq_sum,Pi.single_apply,apply_ite] + have hc : (pencilBase θ A).mulVec v = + (X * C (θ j)) • v + fun i => C (A i j) := by + funext i + by_cases hij : i=j + · subst i + simp [pencilBase,v,Matrix.mulVec_single] + · simp [pencilBase,v,Matrix.mulVec_single,hij] + have hh := X_mul_rowPair (pencilBase θ A) v + rw [rowPair_neg,hc,rowPair_add,rowPair_smul,hv] at hh + have hs : (∑ i, v i) = 1 := by simp [v,Pi.single_apply] + rw [hs,map_one,one_mul] at hh + change X * rowEntry (pencilBase θ A) j = + -(C (X*C (θ j)) * rowEntry (pencilBase θ A) j + + rowContraction θ A (fun i => A i j)) + _ at hh + linear_combination hh + +theorem determinant_mem_rowIdeal (θ : Fin (k+1) → L) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) : + (pencilMatrix (pencilBase θ A)).det ∈ rowIdeal (pencilBase θ A) := by + have h := column_contraction θ A 0 + have he : (pencilMatrix (pencilBase θ A)).det = + rowContraction θ A (fun i => A i 0) + + (X+C (X*C (θ 0))) * rowEntry (pencilBase θ A) 0 := by + linear_combination -h + rw [he] + exact Ideal.add_mem _ (rowContraction_mem θ A _) (Ideal.mul_mem_left _ _ (Ideal.subset_span ⟨0,rfl⟩)) + +end PermanentBorder.AdjugateAlgebra + +namespace PermanentBorder.AdjugateAlgebra +open Polynomial Matrix Module +variable {K L : Type*} [Field K] [Field L] [Algebra K L] {k : ℕ} + +theorem slopeTrace_eval (θ v : Fin (k+1) → L) (i : Fin (k+1)) : + (slopeTrace θ v).eval (-θ i) = + v i * ∏ l ∈ Finset.univ.erase i, (-θ i + θ l) := by + classical + simp only [slopeTrace,spectralSlope,Matrix.adjugate_diagonal, + Matrix.trace,Matrix.diag_apply,Matrix.mul_diagonal,Matrix.map_apply,Matrix.diagonal_apply_eq, + eval_finsetSum,eval_mul,eval_C,eval_prod,eval_add,eval_X] + apply Finset.sum_eq_single i + · intro j _ hji + have hp : ∏ l ∈ Finset.univ.erase j, (-θ i + θ l) = 0 := by + apply Finset.prod_eq_zero (Finset.mem_erase.mpr ⟨Ne.symm hji,Finset.mem_univ i⟩) + simp + simp [hp] + · simp + +theorem matrix_inField_of_rows (F : IntermediateField K L) + (θ : Fin (k+1) → L) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) + (hθF : ∀ i, θ i ∈ F) + (hdet : Bivariate.InField F (pencilMatrix (pencilBase θ A)).det) + (hrow : ∀ j, Bivariate.InField F (rowEntry (pencilBase θ A) j)) : + ∀ i j, A i j ∈ F := by + classical + intro i j + have hlin : Bivariate.InField F (X + C (X * C (θ j))) := by + rw [map_mul] + exact (Bivariate.inField_X F).add + ((Bivariate.inField_C_X F).mul (Bivariate.inField_C_C F _ (hθF j))) + have hc : Bivariate.InField F (rowContraction θ A (fun l => A l j)) := by + rw [column_contraction] + exact hdet.sub (hlin.mul (hrow j)) + have hs : ∀ a, (slopeTrace θ (fun l => A l j)).coeff a ∈ F := by + intro a + rw [← rowContraction_top θ A] + exact scaled_coeff_mem F _ hc k a + have he := Bivariate.eval_mem F _ hs (-θ i) (F.neg_mem (hθF i)) + rw [slopeTrace_eval] at he + have hp : (∏ l ∈ Finset.univ.erase i, (-θ i + θ l)) ∈ F := by + exact F.prod_mem fun l _ => F.add_mem (F.neg_mem (hθF i)) (hθF l) + have hn : (∏ l ∈ Finset.univ.erase i, (-θ i + θ l)) ≠ 0 := by + apply Finset.prod_ne_zero_iff.mpr + intro l hl hz + have hei : θ l = θ i := by linear_combination hz + exact (Finset.mem_erase.mp hl).1 (hθ hei) + simpa only [mul_div_cancel_right₀ _ hn] using F.div_mem he hp + +end PermanentBorder.AdjugateAlgebra + +namespace PermanentBorder.Bivariate +open Module Polynomial +universe u +variable {K L R : Type u} [Field K] [Field L] [Algebra K L] + [Infinite K] [IsAlgClosed L] [CommRing R] [Algebra L R] [Module.Finite L R] + +theorem quotient_field_bound (p : K[X][X]) (hp : p ≠ 0) + (q : L[X][X] →ₐ[L] R) (hq : Function.Surjective q) + (hpq : q (map (algebraMap K L) p) = 0) + {n : ℕ} (b : Basis (Fin n) L R) (r s : Fin n → ℕ) + (hb : ∀ i, b i = q (monomial (r i) (monomial (s i) 1))) : + ∃ F : IntermediateField K L, + Algebra.trdeg K F ≤ (finrank L R : Cardinal) ∧ + ∀ a d i, b.repr (q (monomial a (monomial d 1))) i ∈ F := by + let q' := q.comp (equivalence L).toAlgHom + let p' := (equivalence K).symm p + have hp' : p' ≠ 0 := fun h => hp ((equivalence K).symm.injective (h.trans (map_zero _).symm)) + have hq' : Function.Surjective q' := hq.comp (equivalence L).surjective + have hpq' : q' (MvPolynomial.map (algebraMap K L) p') = 0 := by + change q (equivalence L (MvPolynomial.map (algebraMap K L) p')) = 0 + rw [equivalence_map, AlgEquiv.apply_symm_apply] + exact hpq + have hb' : ∀ i, b i = q' (MvPolynomial.X 0 ^ r i * MvPolynomial.X 1 ^ s i) := by + intro i + change b i = q (equivalence L _) + rw [equivalence_monomial, hb] + obtain ⟨F,hF,hA,hB,hv⟩ := CurveQuotientParameters.chart_field_bound p' hp' q' hq' hpq' b r s hb' + refine ⟨F,hF,?_⟩ + intro a d i + have h := FinitePlaneFrames.monomial_coordinates_mem F q' b hA hB hv a d i + simpa only [q', AlgHom.comp_apply, AlgEquiv.coe_toAlgHom, equivalence_monomial] using h + +end PermanentBorder.Bivariate + +namespace PermanentBorder.DeterminantFibers +open Polynomial Module AdjugateAlgebra +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + [Infinite K] [IsAlgClosed L] {k : ℕ} + +theorem matrix_field_bound (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) (hk : 0 < k) + (p : K[X][X]) (hp : p ≠ 0) + (hdet : (pencilMatrix (pencilBase (fun i => algebraMap K L (θ i)) A)).det = + Bivariate.map (algebraMap K L) p) : + ∃ F : IntermediateField K L, + Algebra.trdeg K F ≤ ((k+1).choose 2 : Cardinal) ∧ ∀ i j, A i j ∈ F := by + classical + let θ' : Fin (k+1) → L := fun i => algebraMap K L (θ i) + have hθ' : Function.Injective θ' := (FaithfulSMul.algebraMap_injective K L).comp hθ + let I := rowIdeal (pencilBase θ' A) + let q := Ideal.Quotient.mkₐ L I + have : Module.Finite L (L[X][X] ⧸ I) := finite_row_quotient θ' hθ' A hk + let b := rowBasis θ' hθ' A hk + let e := Fintype.equivFin (PlaneIndex (k-1)) + let b' := b.reindex e + let r : Fin (Fintype.card (PlaneIndex (k-1))) → ℕ := fun i => (e.symm i).val.1.val + let s : Fin (Fintype.card (PlaneIndex (k-1))) → ℕ := + fun i => (e.symm i).val.2.val-(e.symm i).val.1.val-1 + have hb' : ∀ i, b' i = q (monomial (r i) (monomial (s i) 1)) := by + intro i + exact (b.reindex_apply e i).trans (rowBasis_apply θ' hθ' A hk (e.symm i)) + have hpq : q (Bivariate.map (algebraMap K L) p) = 0 := by + rw [← hdet] + exact Ideal.Quotient.eq_zero_iff_mem.mpr (determinant_mem_rowIdeal θ' A) + obtain ⟨F,hF,hmon⟩ := Bivariate.quotient_field_bound p hp q + (Ideal.Quotient.mkₐ_surjective L I) hpq b' r s hb' + have hmon' : ∀ a d i, b.repr (q (monomial a (monomial d 1))) i ∈ F := by + intro a d i + have h := hmon a d (e i) + simpa only [b',Basis.repr_reindex_apply,Equiv.symm_apply_apply] using h + refine ⟨F,?_,?_⟩ + · rw [row_quotient_finrank θ' hθ' A hk] at hF + exact hF + · apply matrix_inField_of_rows F θ' hθ' A + · intro i + exact F.algebraMap_mem (θ i) + · rw [hdet] + exact Bivariate.inField_map F p + · exact rowEntry_inField F θ' hθ' A hk (fun i => F.algebraMap_mem (θ i)) hmon' + +end PermanentBorder.DeterminantFibers + +namespace PermanentBorder.AlgebraicDimension + +open Order + +variable {R S : Type*} [CommRing R] [CommRing S] + +theorem krullDim_le_of_integral (f : R →+* S) (hf : f.IsIntegral) : + ringKrullDim S ≤ ringKrullDim R := by + let : Algebra R S := f.toAlgebra + let : Algebra.IsIntegral R S := ⟨hf⟩ + apply krullDim_le_of_strictMono (PrimeSpectrum.comap f) + intro I J hIJ + exact Ideal.IsIntegral.under_lt_under hIJ + +universe u + +variable {K A : Type u} [Field K] [CommRing A] [Algebra K A] + +theorem krullDim_le_of_trdeg_le [Algebra.FiniteType K A] (n : ℕ) + (h : Algebra.trdeg K A ≤ (n : Cardinal)) : + ringKrullDim A ≤ n := by + nontriviality A + obtain ⟨s, g, hg, hint⟩ := exists_integral_inj_algHom_of_fg K A + have hs : s ≤ n := by + have hsn := (trdeg_le_of_injective g hg).trans h + simpa using hsn + calc + ringKrullDim A ≤ ringKrullDim (MvPolynomial (Fin s) K) := + krullDim_le_of_integral g.toRingHom hint + _ = s := by simp + _ ≤ n := by exact_mod_cast hs + +theorem image_dimension_le {F : Type u} [CommRing F] [Algebra K F] + {N n : ℕ} (f : MvPolynomial (Fin N) K →ₐ[K] F) + (hF : Algebra.trdeg K F ≤ (n : Cardinal)) : + ringKrullDim (MvPolynomial (Fin N) K ⧸ RingHom.ker f) ≤ n := by + apply krullDim_le_of_trdeg_le (K := K) n + exact (trdeg_le_of_injective + (Ideal.Quotient.liftₐ (RingHom.ker f) f (fun _ h => h)) + (RingHom.lift_injective_of_ker_le_ideal _ _ le_rfl)).trans hF + +end PermanentBorder.AlgebraicDimension + +namespace PermanentBorder.AlgebraicDimension +universe u +variable {K A : Type u} [Field K] [CommRing A] [Algebra K A] + +theorem krullDim_le_of_field_images [Algebra.FiniteType K A] (n : ℕ) + (h : ∀ (L : Type u) [Field L] [Algebra K L] (f : A →ₐ[K] L), + Algebra.trdeg K f.range ≤ (n : Cardinal)) : + ringKrullDim A ≤ n := by + nontriviality A + obtain ⟨s, g, hg, hint⟩ := exists_integral_inj_algHom_of_fg K A + let R := MvPolynomial (Fin s) K + let : Algebra R A := g.toRingHom.toAlgebra + let : Algebra.IsIntegral R A := ⟨hint⟩ + have hg' : (⊥ : Ideal A).comap (algebraMap R A) ≤ (⊥ : Ideal R) := by + rw [← RingHom.ker_eq_comap_bot] + exact le_of_eq ((RingHom.injective_iff_ker_eq_bot _).mp hg) + obtain ⟨q, _, hq, hq0⟩ := Ideal.exists_ideal_over_prime_of_isIntegral + (⊥ : Ideal R) (⊥ : Ideal A) hg' + let : q.IsPrime := hq + let L := FractionRing (A ⧸ q) + let f : A →ₐ[K] L := (IsScalarTower.toAlgHom K (A ⧸ q) L).comp (Ideal.Quotient.mkₐ K q) + have hqgi : Function.Injective ((Ideal.Quotient.mk q).comp g.toRingHom) := by + rw [RingHom.injective_iff_ker_eq_bot] + change (⊥ : Ideal (A ⧸ q)).comap ((Ideal.Quotient.mk q).comp g.toRingHom) = ⊥ + rw [← Ideal.comap_comap, ← RingHom.ker_eq_comap_bot, Ideal.mk_ker] + exact hq0 + have hfg : Function.Injective (f.comp g) := + (IsFractionRing.injective (A ⧸ q) L).comp hqgi + have hrg : Function.Injective (f.rangeRestrict.comp g) := by + intro x y he + exact hfg (congrArg Subtype.val he) + have hs : s ≤ n := by + have hc := (trdeg_le_of_injective (f.rangeRestrict.comp g) hrg).trans (h L f) + simpa only [MvPolynomial.trdeg_of_isDomain, Cardinal.mk_fin, Cardinal.lift_natCast, + Nat.cast_le] using hc + calc + ringKrullDim A ≤ ringKrullDim R := krullDim_le_of_integral g.toRingHom hint + _ = s := by simp [R] + _ ≤ n := by exact_mod_cast hs + +end PermanentBorder.AlgebraicDimension + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/FiberDimension.lean b/lean/OAI/Algebra/Determinantal/FiberDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..629f8999299db79b16418f54ccd9893cf0cfc4a0 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/FiberDimension.lean @@ -0,0 +1,256 @@ +import OAI.Algebra.Determinantal.DeterminantFields + +namespace OAI + +namespace PermanentBorder.DeterminantFiberScheme +open Polynomial +universe u +variable {R S : Type*} [CommRing R] [CommRing S] {n : ℕ} + +noncomputable def pencil (θ : Fin n → R) (A : Matrix (Fin n) (Fin n) R) : + Matrix (Fin n) (Fin n) R[X][X] := + (X : R[X][X]) • 1 + + (((X : R[X]) • (Matrix.diagonal θ).map C + A.map C).map C) + +theorem map_pencil (f : R →+* S) (θ : Fin n → R) + (A : Matrix (Fin n) (Fin n) R) : + (pencil θ A).map (Bivariate.map f) = pencil (f ∘ θ) (A.map f) := by + classical + ext i j + dsimp [pencil, Bivariate.map, Matrix.map, Matrix.smul_apply, Matrix.add_apply] + by_cases h : i = j + · subst j + simp [Polynomial.coe_mapRingHom] + · simp [h, Polynomial.coe_mapRingHom] + +theorem map_determinant (f : R →+* S) (θ : Fin n → R) + (A : Matrix (Fin n) (Fin n) R) : + Bivariate.map f (pencil θ A).det = (pencil (f ∘ θ) (A.map f)).det := by + rw [RingHom.map_det] + change ((pencil θ A).map (Bivariate.map f)).det = _ + rw [map_pencil] + +theorem determinant_ne_zero [Nontrivial R] (θ : Fin n → R) + (A : Matrix (Fin n) (Fin n) R) : (pencil θ A).det ≠ 0 := by + have hc : (pencil θ A).det.coeff n = 1 := by + have hm : (1 : Matrix (Fin n) (Fin n) R[X]).map C = 1 := C.mapMatrix.map_one + simpa only [pencil, hm, Fintype.card_fin, Matrix.det_one] using + coeff_det_X_add_C_card (1 : Matrix (Fin n) (Fin n) R[X]) + ((X : R[X]) • (Matrix.diagonal θ).map C + A.map C) + intro hz + rw [hz, coeff_zero] at hc + exact zero_ne_one hc + +variable (K : Type u) [Field K] +abbrev PolynomialRing (n : ℕ) := MvPolynomial (Fin n × Fin n) K +noncomputable def universalMatrix (n : ℕ) : Matrix (Fin n) (Fin n) (PolynomialRing K n) := + fun i j => MvPolynomial.X (i,j) + +noncomputable def fiberIdeal {n : ℕ} (θ : Fin n → K) (p : K[X][X]) : + Ideal (PolynomialRing K n) := + Ideal.span (Set.range (fun ab : ℕ × ℕ => + (((pencil (MvPolynomial.C ∘ θ) (universalMatrix K n)).det - + Bivariate.map MvPolynomial.C p).coeff ab.1).coeff ab.2)) + +abbrev CoordinateRing {n : ℕ} (θ : Fin n → K) (p : K[X][X]) := + PolynomialRing K n ⧸ fiberIdeal K θ p + +variable {K} + +theorem field_point_equation {n : ℕ} (θ : Fin n → K) (p : K[X][X]) + {L : Type u} [Field L] [Algebra K L] + (f : CoordinateRing K θ p →ₐ[K] L) : + let g := f.comp (Ideal.Quotient.mkₐ K (fiberIdeal K θ p)) + (pencil (algebraMap K L ∘ θ) ((universalMatrix K n).map g)).det = + Bivariate.map (algebraMap K L) p := by + classical + intro g + have hz (a b : ℕ) : g + ((((pencil (MvPolynomial.C ∘ θ) (universalMatrix K n)).det - + Bivariate.map MvPolynomial.C p).coeff a).coeff b) = 0 := by + change f (Ideal.Quotient.mk _ _) = 0 + have hm : ((((pencil (MvPolynomial.C ∘ θ) (universalMatrix K n)).det - + Bivariate.map MvPolynomial.C p).coeff a).coeff b) ∈ fiberIdeal K θ p := + Ideal.subset_span (Set.mem_range_self (a,b)) + rw [Ideal.Quotient.eq_zero_iff_mem.mpr hm, _root_.map_zero] + have hmap : Bivariate.map g.toRingHom + ((pencil (MvPolynomial.C ∘ θ) (universalMatrix K n)).det - + Bivariate.map MvPolynomial.C p) = 0 := by + ext a b + simp only [Bivariate.map, Polynomial.coe_mapRingHom, + Polynomial.coeff_map, Polynomial.coeff_zero] + exact hz a b + have heq := sub_eq_zero.mp ((RingHom.map_sub (Bivariate.map g.toRingHom) + (pencil (MvPolynomial.C ∘ θ) (universalMatrix K n)).det + (Bivariate.map MvPolynomial.C p)).symm.trans hmap) + have hθ : g.toRingHom ∘ (MvPolynomial.C ∘ θ) = algebraMap K L ∘ θ := by + ext i + exact g.commutes (θ i) + have hp : Bivariate.map g.toRingHom (Bivariate.map MvPolynomial.C p) = + Bivariate.map (algebraMap K L) p := by + ext a b + simp only [Bivariate.map, Polynomial.coe_mapRingHom, Polynomial.coeff_map] + exact g.commutes _ + rw [map_determinant,hθ,hp] at heq + exact heq + +theorem range_le_of_variables_mem {σ : Type*} {L : Type u} [Field L] [Algebra K L] + (f : MvPolynomial σ K →ₐ[K] L) (F : IntermediateField K L) + (h : ∀ i, f (MvPolynomial.X i) ∈ F) : f.range ≤ F.toSubalgebra := by + rintro y ⟨p, rfl⟩ + change f p ∈ F + induction p using MvPolynomial.induction_on with + | C c => simpa only [MvPolynomial.algHom_C] using F.algebraMap_mem c + | add p q hp hq => simpa only [map_add] using F.add_mem hp hq + | mul_X p i hp => simpa only [map_mul] using F.mul_mem hp (h i) + +theorem field_image_trdeg_le [Infinite K] {k : ℕ} (hk : 0 < k) + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) (p : K[X][X]) + (L : Type u) [Field L] [Algebra K L] + (f : CoordinateRing K θ p →ₐ[K] L) : + Algebra.trdeg K f.range ≤ ((k+1).choose 2 : Cardinal) := by + classical + let Ω := AlgebraicClosure L + let ι : L →ₐ[K] Ω := IsScalarTower.toAlgHom K L Ω + let f' := ι.comp f + let g := f'.comp (Ideal.Quotient.mkₐ K (fiberIdeal K θ p)) + let A := (universalMatrix K (k+1)).map g + have he : (pencil (algebraMap K Ω ∘ θ) A).det = + Bivariate.map (algebraMap K Ω) p := field_point_equation θ p f' + have hp : p ≠ 0 := by + intro hp + rw [hp, _root_.map_zero] at he + exact determinant_ne_zero _ _ he + obtain ⟨F,hF,hAF⟩ := DeterminantFibers.matrix_field_bound θ hθ A hk p hp he + have hg : g.range ≤ F.toSubalgebra := by + apply range_le_of_variables_mem + rintro ⟨i,j⟩ + exact hAF i j + let h : f.range →ₐ[K] Ω := ι.comp f.range.val + have hmem : ∀ z, h z ∈ F.toSubalgebra := by + rintro ⟨z,x,hx⟩ + obtain ⟨q,rfl⟩ := Ideal.Quotient.mk_surjective x + apply hg + exact ⟨q, by exact congrArg ι hx⟩ + let hFmap := h.codRestrict F.toSubalgebra hmem + have hinj : Function.Injective hFmap := by + intro x y heq + apply Subtype.ext + exact (FaithfulSMul.algebraMap_injective L Ω) (congrArg Subtype.val heq) + exact (trdeg_le_of_injective hFmap hinj).trans hF + +theorem coordinate_ring_dimension_le [Infinite K] {k : ℕ} (hk : 0 < k) + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) (p : K[X][X]) : + ringKrullDim (CoordinateRing K θ p) ≤ (k+1).choose 2 := by + apply AlgebraicDimension.krullDim_le_of_field_images (K := K) ((k+1).choose 2) + intro L _ _ f + exact field_image_trdeg_le hk θ hθ p L f + +end PermanentBorder.DeterminantFiberScheme + +namespace PermanentBorder.DeterminantFibers +open Polynomial AdjugateAlgebra +universe u +variable {K L : Type u} [Field K] [Infinite K] [Field L] [Algebra K L] + [IsAlgClosed L] {k : ℕ} + +noncomputable def curveCoefficientField (P : L[X][X]) : IntermediateField K L := + IntermediateField.adjoin K (Set.range (fun ab : ℕ × ℕ => (P.coeff ab.1).coeff ab.2)) + +omit [Infinite K] [IsAlgClosed L] in +lemma coefficient_mem_curveCoefficientField (P : L[X][X]) (a b : ℕ) : + (P.coeff a).coeff b ∈ curveCoefficientField (K := K) P := + IntermediateField.subset_adjoin K _ (Set.mem_range_self (a,b)) + +theorem matrix_field_bound_over_curve (θ : Fin (k+1) → K) + (hθ : Function.Injective θ) (A : Matrix (Fin (k+1)) (Fin (k+1)) L) + (hk : 0 < k) (B : ℕ) + (hB : Algebra.trdeg K (curveCoefficientField (K := K) + (pencilMatrix (pencilBase (fun i => algebraMap K L (θ i)) A)).det) ≤ (B : Cardinal)) : + ∃ F : IntermediateField K L, + Algebra.trdeg K F ≤ (B + (k+1).choose 2 : ℕ) ∧ ∀ i j, A i j ∈ F := by + classical + let P := (pencilMatrix (pencilBase (fun i => algebraMap K L (θ i)) A)).det + let E := curveCoefficientField (K := K) P + let : Infinite E := Infinite.of_injective (algebraMap K E) (algebraMap K E).injective + obtain ⟨p,hp⟩ := (Bivariate.inField_iff_lifts E P).mp + (coefficient_mem_curveCoefficientField P) + have hp0 : p ≠ 0 := by + intro hz + rw [hz, map_zero] at hp + exact DeterminantFiberScheme.determinant_ne_zero _ _ hp.symm + let θE : Fin (k+1) → E := fun i => algebraMap K E (θ i) + have hθE : Function.Injective θE := (algebraMap K E).injective.comp hθ + have hdet : (pencilMatrix (pencilBase (fun i => algebraMap E L (θE i)) A)).det = + Bivariate.map (algebraMap E L) p := by + exact hp.symm + obtain ⟨F,hF,hAF⟩ := matrix_field_bound θE hθE A hk p hp0 hdet + let : IsScalarTower K E F := IsScalarTower.of_algebraMap_eq fun _ => rfl + let : FaithfulSMul E F := (faithfulSMul_iff_algebraMap_injective E F).mpr + (algebraMap E F).injective + refine ⟨F.restrictScalars K, ?_, hAF⟩ + change Algebra.trdeg K F ≤ _ + rw [← trdeg_add_eq K E] + exact (add_le_add hB hF).trans_eq (by simp) + +end PermanentBorder.DeterminantFibers + +namespace PermanentBorder.SpectralDimension +open MvPolynomial Polynomial Matrix +open Conductor AdjugateAlgebra DeterminantFibers +universe u + +noncomputable def normalizationDefect {L : Type u} [Field L] {k : ℕ} + (θ : Fin (k+1) → L) (A : Matrix (Fin (k+1)) (Fin (k+1)) L) : ℕ∞ := + let T := -(pencilBase θ A) + let Q := FractionRing L[X] + let R := integralClosure L[X] (AdjoinRoot (T.charpoly.map (algebraMap L[X] Q))) + Module.length L (R ⧸ LinearMap.range + (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toLinearMap) + +variable (K : Type u) [Field K] + +noncomputable def gradientIdeal {k : ℕ} (θ : Fin (k+1) → K) (q : ℕ) : + Ideal (MvPolynomial (Fin (k+1) × Fin (k+1)) K) := + Ideal.span (Set.range (fun ij => pderiv ij (Selector.diagonalCoefficient + (Matrix.of fun a b => (MvPolynomial.X (a,b) : + MvPolynomial (Fin (k+1) × Fin (k+1)) K)) (fun i => MvPolynomial.C (θ i)) q))) + +variable {K} + +theorem field_point_critical {L : Type u} [Field L] [Algebra K L] {k q : ℕ} + (θ : Fin (k+1) → K) + (f : (MvPolynomial (Fin (k+1) × Fin (k+1)) K ⧸ gradientIdeal K θ q) →ₐ[K] L) : + let g := f.comp (Ideal.Quotient.mkₐ K (gradientIdeal K θ q)) + ∀ ij, MvPolynomial.eval (fun ab => g (MvPolynomial.X (ab.1,ab.2))) + (pderiv ij (Selector.diagonalCoefficient + (Matrix.of fun a b => (MvPolynomial.X (a,b) : + MvPolynomial (Fin (k+1) × Fin (k+1)) L)) + (fun i => MvPolynomial.C (algebraMap K L (θ i))) q)) = 0 := by + classical + intro g ij + let P := Selector.diagonalCoefficient + (Matrix.of fun a b => (MvPolynomial.X (a,b) : + MvPolynomial (Fin (k+1) × Fin (k+1)) K)) (fun i => MvPolynomial.C (θ i)) q + have hP : MvPolynomial.map (algebraMap K L) P = Selector.diagonalCoefficient + (Matrix.of fun a b => (MvPolynomial.X (a,b) : + MvPolynomial (Fin (k+1) × Fin (k+1)) L)) + (fun i => MvPolynomial.C (algebraMap K L (θ i))) q := by + dsimp [P] + rw [Selector.diagonalCoefficient_map] + simp only [Matrix.of_apply, MvPolynomial.map_X, MvPolynomial.map_C] + rfl + rw [← hP, MvPolynomial.pderiv_map, MvPolynomial.eval_map] + have hg : MvPolynomial.aeval (fun ab => g (MvPolynomial.X (ab.1,ab.2))) = g := by + ext ab + simp only [MvPolynomial.aeval_X, Prod.mk.eta] + change MvPolynomial.aeval _ (pderiv ij P) = 0 + rw [hg] + change f (Ideal.Quotient.mk _ (pderiv ij P)) = 0 + have hm : pderiv ij P ∈ gradientIdeal K θ q := + Ideal.subset_span (Set.mem_range_self ij) + rw [Ideal.Quotient.eq_zero_iff_mem.mpr hm, map_zero] + +end PermanentBorder.SpectralDimension + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/FilteredPlane.lean b/lean/OAI/Algebra/Determinantal/FilteredPlane.lean new file mode 100644 index 0000000000000000000000000000000000000000..b289dbbff82dc8cd3f9f0a15d89fc3a54bccb17d --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/FilteredPlane.lean @@ -0,0 +1,478 @@ +import OAI.Algebra.Determinantal.PlaneHilbert + +namespace OAI + +namespace PermanentBorder.PlaneHilbert +open MvPolynomial SliceParameters Multigraded +variable {K R : Type*} [Field K] [CommRing R] [Algebra K R] + +noncomputable def filtered (q : Plane (K := K) →ₐ[K] R) : ℕ → Submodule K R + | 0 => ⊥ + | n+1 => (restrictTotalDegree (Fin 2) K n).map q.toLinearMap + +instance filtered_finite (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : + Module.Finite K (filtered q n) := by + cases n with + | zero => exact inferInstanceAs (Module.Finite K (⊥ : Submodule K R)) + | succ n => exact Module.Finite.map _ _ + +lemma mem_filtered_succ (q : Plane (K := K) →ₐ[K] R) (n : ℕ) (z : R) : + z ∈ filtered q (n+1) ↔ ∃ p : Plane (K := K), p.totalDegree ≤ n ∧ q p = z := by + simp only [filtered,Submodule.mem_map,mem_restrictTotalDegree,AlgHom.toLinearMap_apply] + +lemma filtered_mono (q : Plane (K := K) →ₐ[K] R) : Monotone (filtered q) := by + apply monotone_nat_of_le_succ + intro n + cases n with + | zero => exact bot_le + | succ n => + intro z hz + obtain ⟨p,hp,rfl⟩ := (mem_filtered_succ q n z).mp hz + exact (mem_filtered_succ q (n+1) _).mpr ⟨p,by omega,rfl⟩ + +lemma homogeneous_mem_filtered (q : Plane (K := K) →ₐ[K] R) {n : ℕ} + (p : H (K := K) (n : ℤ)) : q p.val ∈ filtered q (n+1) := by + exact (mem_filtered_succ q n _).mpr + ⟨p.val,(intWeight_homogeneous p.property).totalDegree_le,rfl⟩ + +lemma mul_X_filtered (q : Plane (K := K) →ₐ[K] R) (i : Fin 2) {n : ℕ} + {z : R} (hz : z ∈ filtered q n) : q (X i) * z ∈ filtered q (n+1) := by + cases n with + | zero => + have hz0 : z = 0 := hz + simp [hz0] + | succ n => + obtain ⟨p,hp,rfl⟩ := (mem_filtered_succ q n z).mp hz + apply (mem_filtered_succ q (n+1) _).mpr + refine ⟨X i*p,?_,map_mul _ _ _⟩ + have hx : (X i : Plane (K := K)).totalDegree = 1 := totalDegree_X i + exact (totalDegree_mul _ _).trans (by rw [hx]; omega) + +noncomputable def topComponent (n : ℕ) : Plane (K := K) →ₗ[K] H (K := K) (n : ℤ) := + (homogeneousComponent n).codRestrict _ (fun p => + homogeneous_intWeight (homogeneousComponent_isHomogeneous n p)) + +lemma sub_topComponent_degree {p : Plane (K := K)} {n : ℕ} + (hp : p.totalDegree ≤ n+1) : (p-(topComponent (n+1) p).val).totalDegree ≤ n := by + classical + apply Finset.sup_le + intro s hs + have hc : (p-(topComponent (n+1) p).val).coeff s ≠ 0 := mem_support_iff.mp hs + change s.degree ≤ n + by_contra! hn + apply hc + change (p-homogeneousComponent (n+1) p).coeff s = 0 + rw [coeff_sub,coeff_homogeneousComponent] + by_cases he : s.degree = n+1 + · simp [he] + · have hlt : p.totalDegree < s.degree := by omega + simp [he,coeff_eq_zero_of_totalDegree_lt hlt] + +lemma sub_topComponent_mem_filtered (q : Plane (K := K) →ₐ[K] R) + {p : Plane (K := K)} {n : ℕ} (hp : p.totalDegree ≤ n) : + q p - q (topComponent n p).val ∈ filtered q n := by + cases n with + | zero => + have he : p = (topComponent 0 p).val := by + change p = homogeneousComponent 0 p + rw [homogeneousComponent_zero] + exact (totalDegree_eq_zero_iff_eq_C).mp (Nat.eq_zero_of_le_zero hp) + rw [← he, sub_self] + exact (filtered q 0).zero_mem + | succ n => + exact (mem_filtered_succ q n _).mpr + ⟨p-(topComponent (n+1) p).val,sub_topComponent_degree hp,map_sub _ _ _⟩ + +noncomputable def leadingMap (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : + H (K := K) (n : ℤ) →ₗ[K] R ⧸ filtered q n := + (filtered q n).mkQ.comp (q.toLinearMap.comp (H (K := K) (n : ℤ)).subtype) + +noncomputable abbrev leadingRelations (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : + Submodule K (H (K := K) (n : ℤ)) := LinearMap.ker (leadingMap q n) + +lemma mem_leadingRelations (q : Plane (K := K) →ₐ[K] R) (n : ℕ) + (p : H (K := K) (n : ℤ)) : p ∈ leadingRelations q n ↔ q p.val ∈ filtered q n := by + simp only [leadingRelations,LinearMap.mem_ker,leadingMap,LinearMap.comp_apply, + Submodule.subtype_apply,AlgHom.toLinearMap_apply,Submodule.mkQ_apply, + Submodule.Quotient.mk_eq_zero] + +lemma varMul_leadingRelations (q : Plane (K := K) →ₐ[K] R) (i : Fin 2) (n : ℕ) : + (leadingRelations q n).map (varMul i n) ≤ leadingRelations q (n+1) := by + rintro _ ⟨p,hp,rfl⟩ + change p ∈ leadingRelations q n at hp + rw [mem_leadingRelations] at hp ⊢ + change q (X i*p.val) ∈ _ + rw [map_mul] + exact mul_X_filtered q i hp + +lemma leadingMap_range (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : + LinearMap.range (leadingMap q n) = (filtered q (n+1)).map (filtered q n).mkQ := by + ext z + constructor + · rintro ⟨p,rfl⟩ + exact ⟨q p.val,homogeneous_mem_filtered q p,rfl⟩ + · rintro ⟨r,hr,rfl⟩ + obtain ⟨p,hp,rfl⟩ := (mem_filtered_succ q n r).mp hr + refine ⟨topComponent n p,?_⟩ + change Submodule.Quotient.mk (q (topComponent n p).val) = Submodule.Quotient.mk (q p) + apply (Submodule.Quotient.eq _).mpr + simpa only [neg_sub] using (filtered q n).neg_mem (sub_topComponent_mem_filtered q hp) + +noncomputable def filteredH (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : ℕ := + Module.finrank K (H (K := K) (n : ℤ) ⧸ leadingRelations q n) + +lemma filteredH_add_rank (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : + filteredH q n + Module.finrank K (filtered q n) = Module.finrank K (filtered q (n+1)) := by + let f := (filtered q n).mkQ.domRestrict (filtered q (n+1)) + have hr : LinearMap.range f = LinearMap.range (leadingMap q n) := by + rw [leadingMap_range,LinearMap.range_domRestrict] + have hk : LinearMap.ker f = (filtered q n).comap (filtered q (n+1)).subtype := by + simp only [f,LinearMap.domRestrict,LinearMap.ker_comp,Submodule.ker_mkQ] + have hh := f.finrank_range_add_finrank_ker + rw [hr,hk,(Submodule.comapSubtypeEquivOfLe (filtered_mono q (Nat.le_succ n))).finrank_eq] at hh + unfold filteredH + rw [(leadingMap q n).quotKerEquivRange.finrank_eq] + exact hh + +end PermanentBorder.PlaneHilbert +namespace PermanentBorder.PlaneHilbert +open MvPolynomial SliceParameters Multigraded +variable {K : Type*} [Field K] +variable (W : (n : ℕ) → Submodule K (H (K := K) (n : ℤ))) + +noncomputable def quotientH (n : ℕ) : ℕ := Module.finrank K (H (K := K) (n : ℤ) ⧸ W n) +lemma quotientH_add_rank (n : ℕ) : quotientH W n + Module.finrank K (W n) = n+1 := by + rw [quotientH, Submodule.finrank_quotient_add_finrank, finrank_piece] + omega +lemma quotientH_le (n : ℕ) : quotientH W n ≤ n+1 := by + have := quotientH_add_rank W n + omega +variable (hW : ∀ (i : Fin 2) (n : ℕ), (W n).map (varMul i n) ≤ W (n+1)) +include hW in +lemma quotientH_succ_le_of_deficit {n : ℕ} + (hn : quotientH W n < n+1) : quotientH W (n+1) ≤ quotientH W n := by + have h0 : W n ≠ ⊥ := by + intro h + have hh := quotientH_add_rank W n + rw [h, finrank_bot] at hh + omega + have hh := finrank_varMul_sup (W n) h0 + have hl : Module.finrank K ↥((W n).map (varMul 0 n) ⊔ (W n).map (varMul 1 n)) ≤ + Module.finrank K (W (n+1)) := Submodule.finrank_mono (sup_le (hW 0 n) (hW 1 n)) + have h1 := quotientH_add_rank W n + have h2 := quotientH_add_rank W (n+1) + omega +include hW in +lemma quotientH_le_of_deficit {n m : ℕ} + (hn : quotientH W n < n+1) (hnm : n ≤ m) : quotientH W m ≤ quotientH W n := by + induction m, hnm using Nat.le_induction with + | base => exact le_rfl + | succ m hnm ih => + exact (quotientH_succ_le_of_deficit W hW (by omega : quotientH W m < m+1)).trans ih + +include hW in +lemma quotientH_normalized {n m : ℕ} (hnm : n ≤ m) : + (n+1) * quotientH W m ≤ (m+1) * quotientH W n := by + rcases (quotientH_le W n).eq_or_lt with he|hl + · rw [he] + have := quotientH_le W m + nlinarith + · have hh := quotientH_le_of_deficit W hW hl hnm + nlinarith + +theorem quotientH_coprime_bound + {a b : Plane (K := K)} {e f : ℤ} + (ha : a.IsWeightedHomogeneous weight e) (hb : b.IsWeightedHomogeneous weight f) + (ha0 : a ≠ 0) (hb0 : b ≠ 0) (hab : IsRelPrime a b) (n : ℕ) + (haW : multiplicationRange ha (n : ℤ) ≤ W n) + (hbW : multiplicationRange hb (n : ℤ) ≤ W n) : + quotientH W n + ((n : ℤ)-e+1).toNat + ((n : ℤ)-f+1).toNat ≤ + n+1 + ((n : ℤ)-(e+f)+1).toNat := by + have hh := Submodule.finrank_sup_add_finrank_inf_eq + (multiplicationRange ha (n : ℤ)) (multiplicationRange hb (n : ℤ)) + rw [multiplicationRange_inf ha hb hb0 hab, + finrank_multiplicationRange ha ha0, finrank_multiplicationRange hb hb0, + finrank_multiplicationRange (ha.mul hb) (mul_ne_zero ha0 hb0)] at hh + have hl : Module.finrank K ↥(multiplicationRange ha (n : ℤ) ⊔ + multiplicationRange hb (n : ℤ)) ≤ Module.finrank K (W n) := + Submodule.finrank_mono (sup_le haW hbW) + have heq := quotientH_add_rank W n + omega + +end PermanentBorder.PlaneHilbert +namespace PermanentBorder.PlaneHilbert +open Finset +variable (h : ℕ → ℕ) +noncomputable def hSum (n : ℕ) : ℕ := ∑ i ∈ range n, h i +lemma hSum_mono : Monotone (hSum h) := by + intro a b hab + exact sum_le_sum_of_subset_of_nonneg (range_mono hab) (by intros; omega) +lemma hSum_succ (n : ℕ) : hSum h (n+1) = hSum h n + h n := sum_range_succ _ _ + +lemma hSum_double_le + (hnorm : ∀ n m, n ≤ m → (n+1)*h m ≤ (m+1)*h n) (n : ℕ) : + hSum h (2*n) ≤ 4*hSum h n := by + induction n with + | zero => simp [hSum] + | succ n ih => + have h1 := hnorm n (2*n) (by omega) + have h2 := hnorm n (2*n+1) (by omega) + have hh : h (2*n) + h (2*n+1) ≤ 4*h n := by nlinarith + rw [show 2*(n+1) = (2*n+1)+1 by omega, hSum_succ, hSum_succ, hSum_succ] + omega + +lemma hSum_half_length (B : ℕ) + (hle : ∀ n, h n ≤ n+1) + (hdec : ∀ n m, h n < n+1 → n ≤ m → h m ≤ h n) + (htail : ∀ n, B ≤ n → h n ≤ 2*B-n) : + hSum h (2*B) ≤ 2*hSum h B := by + have hp : ∀ i ∈ range B, h (B+i) ≤ h (B-1-i) := by + intro i hi + have hiB := mem_range.mp hi + rcases (hle (B-1-i)).eq_or_lt with he|hl + · rw [he] + have ht := htail (B+i) (by omega) + omega + · exact hdec (B-1-i) (B+i) hl (by omega) + have hs := sum_le_sum hp + rw [sum_range_reflect] at hs + have he : hSum h (2*B) = hSum h B + ∑ i ∈ range B, h (B+i) := by + rw [show 2*B = B+B by omega, hSum, sum_range_add] + rfl + rw [he] + dsimp only [hSum] at * + omega + +end PermanentBorder.PlaneHilbert +namespace PermanentBorder.PlaneHilbert +open MvPolynomial SliceParameters Multigraded +variable {K R : Type*} [Field K] [CommRing R] [Algebra K R] + +lemma mul_filtered_by_homogeneous (q : Plane (K := K) →ₐ[K] R) {n m : ℕ} + {z : R} (hz : z ∈ filtered q n) (p : H (K := K) (m : ℤ)) : + z * q p.val ∈ filtered q (n+m) := by + cases n with + | zero => + have hz0 : z = 0 := hz + simp [hz0] + | succ n => + obtain ⟨a,ha,rfl⟩ := (mem_filtered_succ q n z).mp hz + rw [show n+1+m = (n+m)+1 by omega] + apply (mem_filtered_succ q (n+m) _).mpr + refine ⟨a*p.val,?_,map_mul _ _ _⟩ + exact (totalDegree_mul _ _).trans + (Nat.add_le_add ha (intWeight_homogeneous p.property).totalDegree_le) + +lemma multiplicationRange_le_leading (q : Plane (K := K) →ₐ[K] R) + {a : Plane (K := K)} {e : ℕ} (ha : a.IsWeightedHomogeneous weight (e : ℤ)) + (hqa : q a ∈ filtered q e) (n : ℕ) : + multiplicationRange ha (n : ℤ) ≤ leadingRelations q n := by + rintro _ ⟨p,rfl⟩ + rw [mem_leadingRelations] + change q (a*p.val) ∈ _ + rw [map_mul] + by_cases hen : e ≤ n + · let p' : H (K := K) ((n-e : ℕ) : ℤ) := ⟨p.val, by + have hh : (n : ℤ)-e = ((n-e : ℕ) : ℤ) := by omega + exact hh ▸ p.property⟩ + have hh := mul_filtered_by_homogeneous q hqa p' + simpa only [Nat.add_sub_of_le hen] using hh + · have hr : Module.finrank K (H (K := K) ((n : ℤ)-e)) = 0 := by + rw [finrank_piece]; omega + obtain ⟨c,hc,hcp⟩ := Module.finrank_eq_zero_iff.mp hr p + have hp0 : p = 0 := (smul_eq_zero.mp hcp).resolve_left hc + rw [hp0] + simp + +lemma filtered_rank_eq_hSum (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : + Module.finrank K (filtered q n) = hSum (filteredH q) n := by + induction n with + | zero => + change Module.finrank K (⊥ : Submodule K R) = 0 + exact finrank_bot K R + | succ n ih => + rw [hSum_succ,← ih] + have := filteredH_add_rank q n + omega + +lemma filtered_eq_top_of_tail (q : Plane (K := K) →ₐ[K] R) + (hq : Function.Surjective q) (N : ℕ) + (hz : ∀ n, N ≤ n → filteredH q n = 0) : filtered q N = ⊤ := by + have he : ∀ n, N ≤ n → filtered q n = filtered q N := by + intro n hn + induction n, hn using Nat.le_induction with + | base => rfl + | succ n hn ih => + have hh := filteredH_add_rank q n + rw [hz n hn,zero_add] at hh + exact (Submodule.eq_of_le_of_finrank_eq (filtered_mono q (Nat.le_succ n)) hh).symm.trans ih + apply top_unique + intro z _ + obtain ⟨p,rfl⟩ := hq z + have hm : q p ∈ filtered q (max N (p.totalDegree+1)) := + filtered_mono q (le_max_right ..) + ((mem_filtered_succ q p.totalDegree (q p)).mpr ⟨p,le_rfl,rfl⟩) + rwa [he _ (le_max_left ..)] at hm + +theorem finite_interpolation_half (q : Plane (K := K) →ₐ[K] R) + (hq : Function.Surjective q) {a b : Plane (K := K)} {e f B : ℕ} + (ha : a.IsWeightedHomogeneous weight (e : ℤ)) + (hb : b.IsWeightedHomogeneous weight (f : ℤ)) + (ha0 : a ≠ 0) (hb0 : b ≠ 0) (hab : IsRelPrime a b) + (hqa : q a ∈ filtered q e) (hqb : q b ∈ filtered q f) + (he : e ≤ B+1) (hf : f ≤ B+1) (hef : e+f ≤ 2*B+1) : + filtered q (2*B) = ⊤ ∧ Module.finrank K R ≤ 2*Module.finrank K (filtered q B) := by + have ht : ∀ n, B ≤ n → filteredH q n ≤ 2*B-n := by + intro n hn + have hh := quotientH_coprime_bound (leadingRelations q) ha hb ha0 hb0 hab n + (multiplicationRange_le_leading q ha hqa n) + (multiplicationRange_le_leading q hb hqb n) + change filteredH q n + _ + _ ≤ _ at hh + omega + have htop := filtered_eq_top_of_tail q hq (2*B) (by + intro n hn + have hh := ht n (by omega) + omega) + refine ⟨htop,?_⟩ + have hh := hSum_half_length (filteredH q) B + (quotientH_le (leadingRelations q)) + (fun n m hn hnm => quotientH_le_of_deficit (leadingRelations q) + (varMul_leadingRelations q) hn hnm) ht + rw [← filtered_rank_eq_hSum, ← filtered_rank_eq_hSum, htop,finrank_top] at hh + exact hh + +lemma filtered_rank_double_le (q : Plane (K := K) →ₐ[K] R) (n : ℕ) : + Module.finrank K (filtered q (2*n)) ≤ 4*Module.finrank K (filtered q n) := by + rw [filtered_rank_eq_hSum, filtered_rank_eq_hSum] + exact hSum_double_le (filteredH q) + (fun n m hnm => quotientH_normalized (leadingRelations q) + (varMul_leadingRelations q) hnm) n + +end PermanentBorder.PlaneHilbert + +namespace PermanentBorder.LowPlane +open MvPolynomial +variable {K : Type*} [Field K] + +abbrev Index (B : ℕ) := {s : Fin 2 →₀ ℕ // s.degree < B} + +instance index_finite (B : ℕ) : Finite (Index B) := by + apply Set.Finite.to_subtype + exact (Finsupp.finite_of_degree_le B).subset (fun _ h => Nat.le_of_lt h) + +noncomputable instance index_fintype (B : ℕ) : Fintype (Index B) := Fintype.ofFinite _ + +lemma plane_degree (s : Fin 2 →₀ ℕ) : s.degree = s 0+s 1 := by + change s.sum (fun _ a => a) = _ + rw [Finsupp.sum_fintype _ _ (by simp)] + simp only [Fin.sum_univ_two] + +noncomputable def indexEquiv (B : ℕ) : Index B ≃ {p : Fin (B+1) × Fin (B+1) // p.1 < p.2} where + toFun s := ⟨(⟨s.val 0,by have h:=s.property; rw [plane_degree] at h; omega⟩, + ⟨s.val 0+s.val 1+1,by have h:=s.property; rw [plane_degree] at h; omega⟩),by simp⟩ + invFun p := ⟨Finsupp.single 0 p.val.1.val+Finsupp.single 1 (p.val.2.val-p.val.1.val-1),by + rw [plane_degree] + simp only [Finsupp.add_apply,Finsupp.single_eq_same,Finsupp.single_eq_of_ne (show (0 : Fin 2) ≠ 1 from by decide), + Finsupp.single_eq_of_ne (show (1 : Fin 2) ≠ 0 from by decide),add_zero,zero_add] + have h:=p.property; have h':=p.val.2.isLt + change p.val.1.val < p.val.2.val at h + omega⟩ + left_inv s := by + apply Subtype.ext + ext i + fin_cases i + · simp + · simp; omega + right_inv p := by + apply Subtype.ext + apply Prod.ext <;> apply Fin.ext + · simp + · simp only [Finsupp.add_apply,Finsupp.single_eq_same, + Finsupp.single_eq_of_ne (show (0 : Fin 2) ≠ 1 from by decide), + Finsupp.single_eq_of_ne (show (1 : Fin 2) ≠ 0 from by decide),add_zero,zero_add] + have h:=p.property + change p.val.1.val < p.val.2.val at h + omega + +lemma card_index (B : ℕ) : Fintype.card (Index B) = (B+1).choose 2 := by + rw [Fintype.card_congr (indexEquiv B),Fintype.card_subtype] + simpa only [Fintype.card_fin] using Fintype.card_product_filter_lt (α := Fin (B+1)) + +lemma expansion {B : ℕ} (p : MvPolynomial (Fin 2) K) + (hp : ∀ s ∈ p.support, s.degree < B) : + p = ∑ s : Index B, p.coeff s.val • monomial s.val (1 : K) := by + classical + ext t + rw [coeff_sum] + by_cases ht : t.degree < B + · rw [Finset.sum_eq_single (⟨t,ht⟩ : Index B)] + · simp + · intro s _ hs + have he : s.val ≠ t := fun h => hs (Subtype.ext h) + simp [coeff_monomial,he] + · simp + · have hz : p.coeff t=0 := by + by_contra hn + exact ht (hp t (mem_support_iff.mpr hn)) + rw [hz] + symm + apply Finset.sum_eq_zero + intro s _ + have he : s.val ≠ t := fun he => ht (he ▸ s.property) + simp [coeff_monomial,he] + +lemma remainder_expansion {B : ℕ} (p t : MvPolynomial (Fin 2) K) + (hp : ∀ s, B ≤ s.degree → p.coeff s = t.coeff s) : + p = t + ∑ s : Index B, (p-t).coeff s.val • monomial s.val (1 : K) := by + have h := expansion (p-t) (by + intro s hs + have hc := mem_support_iff.mp hs + rw [coeff_sub,sub_ne_zero] at hc + exact lt_of_not_ge (fun hh => hc (hp s hh))) + rw [← h] + abel + +end PermanentBorder.LowPlane + +namespace PermanentBorder.LinearParameters +open Module +variable {K L S ι κ : Type*} [Field K] [Field L] [Algebra K L] + [AddCommGroup S] [Module L S] [Fintype ι] [Fintype κ] + +lemma independent_coefficients_mem (F : IntermediateField K L) (c : Basis κ L S) + (v : ι → S) (hv : LinearIndependent L v) (x : ι → L) + (hvc : ∀ i j, c.repr (v i) j ∈ F) + (hx : ∀ j, c.repr (∑ i, x i • v i) j ∈ F) : ∀ i, x i ∈ F := by + classical + have ht : (⊤ : Submodule L S) ≤ Submodule.span L (Set.range v ∪ Set.range c) := by + rw [← c.span_eq] + exact Submodule.span_mono Set.subset_union_right + let hs : Set.range v ⊆ Set.range v ∪ Set.range c := Set.subset_union_left + let b := Basis.extendLe hv.linearIndepOn_id hs ht + let j : ι → hv.linearIndepOn_id.extend hs := + fun i => ⟨v i,hv.linearIndepOn_id.subset_extend hs ⟨i,rfl⟩⟩ + have hj : Function.Injective j := by + intro i i' he + exact hv.injective (congrArg Subtype.val he) + have hb : ∀ i, b (j i) = v i := fun i => Basis.extendLe_apply_self .. + have hbc : ∀ i t, c.repr (b t) i ∈ F := by + intro i t + have hh := Basis.extendLe_subset hv.linearIndepOn_id hs ht + (Set.mem_range_self t) + rcases hh with ⟨a,ha⟩|⟨a,ha⟩ + · rw [← ha]; exact hvc a i + · rw [← ha,c.repr_self] + by_cases h : a=i <;> simp [h] + have hh := BasisFieldRecovery.repr_mem F b c hbc _ hx + intro i + have he : b.repr (∑ a, x a • v a) (j i) = x i := by + simp only [← hb,map_sum,map_smul,Basis.repr_self,Finsupp.finsetSum_apply, + Finsupp.smul_apply,smul_eq_mul,Finsupp.single_apply] + simp only [hj.eq_iff] + simp + rw [← he] + exact hh (j i) + +end PermanentBorder.LinearParameters + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/GateCoefficients.lean b/lean/OAI/Algebra/Determinantal/GateCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e8711d62acab4fca9a584e1f2e43892bedbcc5b --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/GateCoefficients.lean @@ -0,0 +1,340 @@ +import OAI.Algebra.Determinantal.Gates + +namespace OAI +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {A B R : Type*} [CommSemiring R] + theorem sumRingEquiv_rename_inl (p : MvPolynomial A R) : + sumRingEquiv R A B (rename Sum.inl p) = map C p := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp [hp,hq] + | mul_X p i hp => simp [hp] + theorem sumRingEquiv_rename_inr (p : MvPolynomial B R) : + sumRingEquiv R A B (rename Sum.inr p) = C p := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp [hp,hq] + | mul_X p i hp => simp [hp] + theorem coeff_sum_product (p : MvPolynomial A R) (q : MvPolynomial B R) + (d : A →₀ ℕ) (e : B →₀ ℕ) : + (rename Sum.inl p * rename Sum.inr q).coeff (d.sumElim e) = p.coeff d * q.coeff e := by + rw [coeff_nested, map_mul, sumRingEquiv_rename_inl, sumRingEquiv_rename_inr, + mul_comm, coeff_C_mul, coeff_map, mul_comm, coeff_C_mul] +end PermanentBorder.Selector.Gates +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {I J R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] + + theorem coeff_separate_univariate (p : I → Polynomial R) (d : I →₀ ℕ) : + (∏ i, Polynomial.eval₂ C (X i) (p i) : MvPolynomial I R).coeff d = + ∏ i, (p i).coeff (d i) := by + classical + have hexp (i : I) : Polynomial.eval₂ C (X i) (p i) = + ∑ k ∈ (p i).support, C ((p i).coeff k) * X i ^ k := by + conv_lhs => rw [Polynomial.as_sum_support (p i)] + simp only [Polynomial.eval₂_finsetSum, Polynomial.eval₂_monomial] + simp_rw [hexp] + rw [Finset.prod_univ_sum, coeff_sum] + simp_rw [Finset.prod_mul_distrib, ← map_prod, coeff_C_mul, coeff_prod_X_pow] + have heq (k : I → ℕ) : d = Finsupp.indicator Finset.univ (fun i _ => k i) ↔ k = d := by + simp only [Finsupp.ext_iff, Finsupp.indicator_of_mem (Finset.mem_univ _), + _root_.funext_iff, eq_comm] + simp_rw [heq] + rw [Finset.sum_eq_single (fun i => d i)] + · simp + · intro k _ hk + simp [hk] + · intro hd + have hnot : ¬ ∀ i, d i ∈ (p i).support := by + simpa only [Fintype.mem_piFinset] using hd + obtain ⟨i, hi⟩ := not_forall.mp hnot + simp only [Polynomial.mem_support_iff, not_not] at hi + simp only [ite_true, mul_one] + apply Finset.prod_eq_zero (Finset.mem_univ i) + exact hi + + theorem coeff_one_edge_factors (s : Finset J) (a : J → R) : + (∏ j ∈ s, (1 + Polynomial.C (a j) * Polynomial.X)).coeff 1 = ∑ j ∈ s, a j := by + classical + have hzero (t : Finset J) : + (∏ j ∈ t, (1 + Polynomial.C (a j) * Polynomial.X)).coeff 0 = 1 := by + rw [Polynomial.coeff_zero_prod] + simp [Polynomial.coeff_add, Polynomial.mul_coeff_zero, Polynomial.coeff_one, Polynomial.coeff_X] + induction s using Finset.induction_on with + | empty => norm_num [Polynomial.coeff_one] + | @insert j s hj ih => + rw [Finset.prod_insert hj, Finset.sum_insert hj, add_mul, one_mul, + Polynomial.coeff_add, mul_assoc, mul_comm Polynomial.X, + ← mul_assoc, Polynomial.coeff_mul_X, Polynomial.coeff_C_mul, hzero, ih, mul_one] + exact add_comm _ _ + + theorem coeff_row_edge_product [Fintype J] (a : I → J → R) : + (∏ i, ∏ j, (1 + C (a i j) * X i) : MvPolynomial I R).coeff + (Finsupp.equivFunOnFinite.symm (fun _ => 1)) = + ∏ i, ∑ j, a i j := by + classical + let p : I → Polynomial R := fun i => ∏ j, (1 + Polynomial.C (a i j) * Polynomial.X) + have hp (i : I) : Polynomial.eval₂ C (X i) (p i) = ∏ j, (1 + C (a i j) * X i) := by + simp only [p, Polynomial.eval₂_finsetProd, Polynomial.eval₂_add, Polynomial.eval₂_one, + Polynomial.eval₂_mul, Polynomial.eval₂_C, Polynomial.eval₂_X] + rw [← show (∏ i, Polynomial.eval₂ C (X i) (p i)) = + (∏ i, ∏ j, (1 + C (a i j) * X i)) from Finset.prod_congr rfl (fun i _ => hp i), + coeff_separate_univariate] + apply Finset.prod_congr rfl + intro i _ + exact coeff_one_edge_factors Finset.univ (a i) +end PermanentBorder.Selector.Gates + +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] +noncomputable def gateOuter (h : ℕ) : MvPolynomial (I ⊕ I) R := + rename Sum.inl ((∑ i, X i)^h) * rename Sum.inr ((∑ i, X i)^h) + + theorem coeff_gateOuter (s : Finset I) (h : ℕ) : + (gateOuter (R := R) h).coeff ((subsetExponent s).sumElim (subsetExponent s)) = + if s.card = h then (h.factorial : R)^2 else 0 := by + rw [gateOuter, coeff_sum_product, coeff_gate_half] + split_ifs <;> simp [pow_two] + +noncomputable def gateCrossEntries (h : ℕ) : + (Fin h ⊕ Fin h) → I → MvPolynomial (I ⊕ I) R := + fun v i => match v with + | .inl _ => X (.inr i) + | .inr _ => X (.inl i) + +noncomputable def gateCrossEdges (h : ℕ) : + MvPolynomial (Fin h ⊕ Fin h) (MvPolynomial (I ⊕ I) R) := + ∏ v, ∏ i, (1 + C (gateCrossEntries h v i) * X v) + +omit [DecidableEq I] in + theorem gateCrossEdges_coefficient (h : ℕ) : + (gateCrossEdges (I := I) (R := R) h).coeff + (Finsupp.equivFunOnFinite.symm (fun _ => 1)) = gateOuter h := by + rw [gateCrossEdges, coeff_row_edge_product] + simp [Fintype.prod_sum_type, gateCrossEntries, gateOuter, map_pow, map_sum, mul_comm] + + theorem subsetExponent_add_compl (s : Finset I) : + subsetExponent sᶜ + subsetExponent s = subsetExponent Finset.univ := by + ext i + by_cases hi : i ∈ s <;> simp [hi] + + theorem coeff_gate_prescribed_distinguished (s : Finset I) (h : ℕ) : + ((gateOuter (R := R) h) * + monomial ((subsetExponent s).sumElim (subsetExponent s)) 1).coeff + ((subsetExponent Finset.univ).sumElim (subsetExponent Finset.univ)) = + if Fintype.card I - s.card = h then (h.factorial : R)^2 else 0 := by + have heq : (subsetExponent Finset.univ).sumElim (subsetExponent Finset.univ) = + ((subsetExponent sᶜ).sumElim (subsetExponent sᶜ)) + + ((subsetExponent s).sumElim (subsetExponent s)) := by + rw [← subsetExponent_add_compl s] + ext i; cases i <;> rfl + rw [heq, coeff_mul_monomial, mul_one, coeff_gateOuter, Finset.card_compl] +end PermanentBorder.Selector.Gates +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] +noncomputable def pairedExponent (i : I) : I ⊕ I →₀ ℕ := + (Finsupp.single i 1).sumElim (Finsupp.single i 1) +omit [Fintype I] in + theorem sum_pairedExponent (s : Finset I) : + (∑ i ∈ s, pairedExponent i) = (subsetExponent s).sumElim (subsetExponent s) := by + classical + ext v + cases v with + | inl i => simp [pairedExponent, Finsupp.finsetSum_apply, Finsupp.sumElim_inl, + Finsupp.single_apply, eq_comm] + | inr i => simp [pairedExponent, Finsupp.finsetSum_apply, Finsupp.sumElim_inr, + Finsupp.single_apply, eq_comm] + + theorem independent_boundary_expansion (a : I → R) : + (∏ i, (1 + monomial (pairedExponent i) (a i))) = + ∑ s : Finset I, monomial ((subsetExponent s).sumElim (subsetExponent s)) (∏ i ∈ s, a i) := by + classical + simp only [add_comm (1 : MvPolynomial (I ⊕ I) R)] + rw [Finset.prod_add_one] + simp only [← monomial_sum_prod, sum_pairedExponent, Finset.powerset_univ] + +omit [DecidableEq I] in + theorem univariate_boundary_coefficient (a : I → R) (q : ℕ) : + (∏ i, (1 + Polynomial.C (a i) * Polynomial.X)).coeff q = + ∑ s : Finset I, if s.card = q then ∏ i ∈ s, a i else 0 := by + classical + simp only [add_comm (1 : Polynomial R)] + rw [Finset.prod_add_one] + simp only [Finset.prod_mul_distrib, ← map_prod, Finset.prod_const, Polynomial.finsetSum_coeff, + eq_comm, Polynomial.coeff_C_mul, Polynomial.coeff_X_pow, mul_ite, mul_one, mul_zero, + Finset.powerset_univ] + + theorem gate_filters_prescribed_count (a : I → R) (q : ℕ) (hq : q ≤ Fintype.card I) : + (gateOuter (Fintype.card I-q) * ∏ i, (1 + monomial (pairedExponent i) (a i))).coeff + ((subsetExponent Finset.univ).sumElim (subsetExponent Finset.univ)) = + ((Fintype.card I-q).factorial : R)^2 * + (∏ i, (1 + Polynomial.C (a i) * Polynomial.X)).coeff q := by + classical + rw [independent_boundary_expansion, Finset.mul_sum, coeff_sum, + univariate_boundary_coefficient, Finset.mul_sum] + apply Finset.sum_congr rfl + intro s _ + have hm (e : I ⊕ I →₀ ℕ) (a : R) : monomial e a = C a * monomial e 1 := by simp only [C_mul_monomial, mul_one] + rw [hm, ← mul_assoc, mul_comm (gateOuter _), mul_assoc, coeff_C_mul, + coeff_gate_prescribed_distinguished] + have hcard : s.card ≤ Fintype.card I := Finset.card_le_univ s + have heq : Fintype.card I - s.card = Fintype.card I - q ↔ s.card = q := by omega + simp only [heq] + split_ifs <;> simp [mul_comm] +end PermanentBorder.Selector.Gates + +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {I J R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] + +noncomputable def blockExponent (d : I → J →₀ ℕ) : I × J →₀ ℕ := + ∑ i, (d i).mapDomain (fun j => (i,j)) + +omit [Fintype I] in + theorem mapDomain_block_apply (d : J →₀ ℕ) (i k : I) (j : J) : + d.mapDomain (fun j => (i,j)) (k,j) = if i = k then d j else 0 := by + classical + by_cases h : i = k + · subst k + simpa using Finsupp.mapDomain_apply_of_injective (fun a b h => congrArg Prod.snd h) d j + · rw [ite_eq_right h] + apply Finsupp.mapDomain_of_notMem_range + rintro ⟨a, ha⟩ + exact h (congrArg Prod.fst ha) + + @[simp] theorem blockExponent_apply (d : I → J →₀ ℕ) (i : I) (j : J) : + blockExponent d (i,j) = d i j := by + classical + simp only [blockExponent, Finsupp.finsetSum_apply, mapDomain_block_apply] + simp + + theorem blockExponent_injective : Function.Injective (blockExponent (I := I) (J := J)) := by + intro d e h + funext i + ext j + simpa using congrArg (fun a : I × J →₀ ℕ => a (i,j)) h + + theorem coeff_independent_blocks (p : I → MvPolynomial J R) (d : I → J →₀ ℕ) : + (∏ i, rename (fun j => (i,j)) (p i)).coeff (blockExponent d) = + ∏ i, (p i).coeff (d i) := by + classical + have hexp (i : I) : rename (fun j => (i,j)) (p i) = + ∑ k ∈ (p i).support, monomial (k.mapDomain (fun j => (i,j))) ((p i).coeff k) := by + conv_lhs => rw [MvPolynomial.as_sum (p i)] + simp only [map_sum, rename_monomial] + simp_rw [hexp] + rw [Finset.prod_univ_sum, coeff_sum] + simp_rw [← monomial_sum_prod, coeff_monomial] + change (∑ k ∈ Fintype.piFinset (fun i => (p i).support), + if blockExponent k = blockExponent d then ∏ i, (p i).coeff (k i) else 0) = _ + simp only [blockExponent_injective.eq_iff] + rw [Finset.sum_eq_single d] + · simp + · intro k _ h; simp [h] + · intro hd + have hnot : ¬ ∀ i, d i ∈ (p i).support := by + simpa only [Fintype.mem_piFinset] using hd + obtain ⟨i, hi⟩ := not_forall.mp hnot + simp only [mem_support_iff, not_not] at hi + simp only [ite_true] + exact Finset.prod_eq_zero (Finset.mem_univ i) hi +end PermanentBorder.Selector.Gates + +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {I C R : Type*} [Fintype I] [Fintype C] [DecidableEq I] [DecidableEq C] [CommSemiring R] + theorem gate_network_filters (a : C → I → R) (q : ℕ) (hq : q ≤ Fintype.card I) : + (∏ c, rename (fun v => (c,v)) + (gateOuter (Fintype.card I-q) * ∏ i, (1 + monomial (pairedExponent i) (a c i)))).coeff + (blockExponent (fun (_ : C) => (subsetExponent Finset.univ).sumElim + (subsetExponent (Finset.univ : Finset I)))) = + (((Fintype.card I-q).factorial : R)^2)^Fintype.card C * + ∏ c, (∏ i, (1 + Polynomial.C (a c i)*Polynomial.X)).coeff q := by + rw [coeff_independent_blocks] + simp_rw [gate_filters_prescribed_count _ q hq] + rw [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ] +end PermanentBorder.Selector.Gates + +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {A B I R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] +noncomputable def allOnes (A : Type*) [Fintype A] : A →₀ ℕ := + Finsupp.equivFunOnFinite.symm (fun _ => 1) + theorem allOnes_map_equiv [Fintype A] [Fintype B] (e : A ≃ B) : + (allOnes A).mapDomain e = allOnes B := by + classical + ext b + obtain ⟨a,rfl⟩ := e.surjective b + rw [Finsupp.mapDomain_apply_of_injective e.injective] + rfl + theorem allOnes_sum [Fintype A] [Fintype B] : + allOnes (A ⊕ B) = (allOnes A).sumElim (allOnes B) := by + ext v; cases v <;> rfl + theorem subset_univ_ones : subsetExponent (Finset.univ : Finset I) = allOnes I := by + ext i + simp [allOnes] + +def sumSquareSplit : ((A ⊕ B) ⊕ (A ⊕ B)) ≃ ((B ⊕ B) ⊕ (A ⊕ A)) where + toFun + | .inl (.inl i) => .inr (.inl i) + | .inr (.inl i) => .inr (.inr i) + | .inl (.inr j) => .inl (.inl j) + | .inr (.inr j) => .inl (.inr j) + invFun + | .inr (.inl i) => .inl (.inl i) + | .inr (.inr i) => .inr (.inl i) + | .inl (.inl j) => .inl (.inr j) + | .inl (.inr j) => .inr (.inr j) + left_inv x := by rcases x with (i|j)|(i|j) <;> rfl + right_inv x := by rcases x with (i|j)|(i|j) <;> rfl + +noncomputable def fullGateEdges (a : I → R) (h : ℕ) : + MvPolynomial ((I ⊕ Fin h) ⊕ (I ⊕ Fin h)) R := + (∏ i, ∏ j, (1 + X (.inl (.inl i))*X (.inr (.inr j)))) * + (∏ j, ∏ i, (1 + X (.inl (.inr j))*X (.inr (.inl i)))) * + ∏ i, (1 + C (a i)*X (.inl (.inl i))*X (.inr (.inl i))) + + theorem full_gate_split (a : I → R) (h : ℕ) : + sumRingEquiv R (Fin h ⊕ Fin h) (I ⊕ I) + (rename sumSquareSplit (fullGateEdges a h)) = + gateCrossEdges h * C (∏ i, (1 + monomial (pairedExponent i) (a i))) := by + classical + simp only [fullGateEdges, map_mul, map_prod, map_add, map_one, rename_X, rename_C] + simp only [sumSquareSplit, Equiv.coe_fn_mk, sumRingEquiv_X_inl, sumRingEquiv_X_inr, sumRingEquiv_C] + apply congrArg₂ (·*·) + · simp only [gateCrossEdges, Fintype.prod_sum_type, gateCrossEntries] + rw [mul_comm] + apply congrArg₂ (·*·) + · apply Finset.prod_congr rfl + intro j _ + apply Finset.prod_congr rfl + intro i _ + rw [mul_comm] + · exact Finset.prod_comm + · apply Finset.prod_congr rfl + intro i _ + have hm : monomial (pairedExponent i) (a i) = C (a i)*X (.inl i)*X (.inr i) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + congr 1 + · ext v; cases v; simp [pairedExponent] + · simp + rw [hm, map_mul, map_mul] + + theorem full_gate_count (a : I → R) (q : ℕ) (hq : q ≤ Fintype.card I) : + (fullGateEdges a (Fintype.card I-q)).coeff (allOnes _) = + (((Fintype.card I-q).factorial : R)^2) * + (∏ i, (1 + Polynomial.C (a i)*Polynomial.X)).coeff q := by + have hr := coeff_rename_mapDomain sumSquareSplit sumSquareSplit.injective + (fullGateEdges a (Fintype.card I-q)) (allOnes _) + rw [allOnes_map_equiv] at hr + have hc : (gateCrossEdges (I := I) (R := R) (Fintype.card I-q)).coeff + (allOnes _) = gateOuter (Fintype.card I-q) := gateCrossEdges_coefficient _ + rw [← hr, allOnes_sum, coeff_nested, full_gate_split, mul_comm, coeff_C_mul, hc, mul_comm] + rw [allOnes_sum, ← subset_univ_ones] + exact gate_filters_prescribed_count a q hq +end PermanentBorder.Selector.Gates + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Gates.lean b/lean/OAI/Algebra/Determinantal/Gates.lean new file mode 100644 index 0000000000000000000000000000000000000000..2780e567d819c9a4922d994d6fd565bac5be2182 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Gates.lean @@ -0,0 +1,464 @@ +import OAI.Algebra.Determinantal.Selector + +namespace OAI + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I J R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] + +noncomputable def blockExponent (d : I → J →₀ ℕ) : I × J →₀ ℕ := + ∑ i, (d i).mapDomain (fun j => (i,j)) + +omit [Fintype I] in + theorem mapDomain_block_apply (d : J →₀ ℕ) (i k : I) (j : J) : + d.mapDomain (fun j => (i,j)) (k,j) = if i = k then d j else 0 := by + classical + by_cases h : i = k + · subst k + simpa using Finsupp.mapDomain_apply_of_injective (fun a b h => congrArg Prod.snd h) d j + · rw [ite_eq_right h] + apply Finsupp.mapDomain_of_notMem_range + rintro ⟨a, ha⟩ + exact h (congrArg Prod.fst ha) + + @[simp] theorem blockExponent_apply (d : I → J →₀ ℕ) (i : I) (j : J) : + blockExponent d (i,j) = d i j := by + classical + simp only [blockExponent, Finsupp.finsetSum_apply, mapDomain_block_apply] + simp + + theorem blockExponent_injective : Function.Injective (blockExponent (I := I) (J := J)) := by + intro d e h + funext i + ext j + simpa using congrArg (fun a : I × J →₀ ℕ => a (i,j)) h + + theorem coeff_independent_blocks (p : I → MvPolynomial J R) (d : I → J →₀ ℕ) : + (∏ i, rename (fun j => (i,j)) (p i)).coeff (blockExponent d) = + ∏ i, (p i).coeff (d i) := by + classical + have hexp (i : I) : rename (fun j => (i,j)) (p i) = + ∑ k ∈ (p i).support, monomial (k.mapDomain (fun j => (i,j))) ((p i).coeff k) := by + conv_lhs => rw [MvPolynomial.as_sum (p i)] + simp only [map_sum, rename_monomial] + simp_rw [hexp] + rw [Finset.prod_univ_sum, coeff_sum] + simp_rw [← monomial_sum_prod, coeff_monomial] + change (∑ k ∈ Fintype.piFinset (fun i => (p i).support), + if blockExponent k = blockExponent d then ∏ i, (p i).coeff (k i) else 0) = _ + simp only [blockExponent_injective.eq_iff] + rw [Finset.sum_eq_single d] + · simp + · intro k _ h; simp [h] + · intro hd + have hnot : ¬ ∀ i, d i ∈ (p i).support := by + simpa only [Fintype.mem_piFinset] using hd + obtain ⟨i, hi⟩ := not_forall.mp hnot + simp only [mem_support_iff, not_not] at hi + simp only [ite_true] + exact Finset.prod_eq_zero (Finset.mem_univ i) hi +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommRing R] + + theorem eliminate_gadget_network (outside : R) (w a b c d : I → R) : + (C outside * ∏ i, rename (fun j => (i,j)) + (gadgetEdges (-2*w i*a i) (b i) (c i) (d i))).coeff + (blockExponent (fun (_ : I) => threeOnes.sumElim threeOnes)) = + outside * (-2 : R) ^ Fintype.card I * ∏ i, (1 + w i*a i*b i*c i*d i) := by + rw [coeff_C_mul, coeff_independent_blocks] + simp_rw [gadgetEdges_coefficient] + have h (i : I) : (-2 + (-2*w i*a i)*b i*c i*d i) = + (-2:R) * (1 + w i*a i*b i*c i*d i) := by ring + simp_rw [h] + rw [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ, mul_assoc] +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I G E R : Type*} [Fintype E] [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] [CommRing R] + +abbrev ExpandedVertex (I G : Type*) := I ⊕ (G × Fin 3) +abbrev InternalVertex (G : Type*) := G × (Fin 3 ⊕ Fin 3) +abbrev GadgetLabels := Fin 2 ⊕ (Fin 3 ⊕ (Fin 3 × Fin 3)) +abbrev ExpandedLabels (E G : Type*) := E ⊕ (G × GadgetLabels) + +noncomputable def baseEdges (src dst : E → I) (ω : E → R) : MvPolynomial (I ⊕ I) R := + ∏ e, (1 + monomial (edgeExponent (src e,dst e)) (ω e)) + +def vertexSplit : (ExpandedVertex I G ⊕ ExpandedVertex I G) ≃ + (InternalVertex G ⊕ (I ⊕ I)) where + toFun + | .inl (.inl i) => .inr (.inl i) + | .inr (.inl i) => .inr (.inr i) + | .inl (.inr (g,r)) => .inl (g,.inl r) + | .inr (.inr (g,c)) => .inl (g,.inr c) + invFun + | .inr (.inl i) => .inl (.inl i) + | .inr (.inr i) => .inr (.inl i) + | .inl (g,.inl r) => .inl (.inr (g,r)) + | .inl (g,.inr c) => .inr (.inr (g,c)) + left_inv x := by rcases x with (i|⟨g,r⟩)|(i|⟨g,c⟩) <;> rfl + right_inv x := by rcases x with ⟨g,r|c⟩|(i|j) <;> rfl + + theorem allOnes_map_equiv {A B : Type*} [Fintype A] [Fintype B] (e : A ≃ B) : + (allOnes A).mapDomain e = allOnes B := by + classical + ext b + obtain ⟨a,rfl⟩ := e.surjective b + rw [Finsupp.mapDomain_apply_of_injective e.injective] + rfl + +noncomputable def expandedSrc (src : E → I) (u₁ u₂ : G → I) : ExpandedLabels E G → ExpandedVertex I G + | .inl e => .inl (src e) + | .inr (g,.inl b) => .inl (if b=0 then u₁ g else u₂ g) + | .inr (g,.inr (.inl r)) => .inr (g,r) + | .inr (g,.inr (.inr (r,_))) => .inr (g,r) +noncomputable def expandedDst (dst : E → I) (v₁ v₂ : G → I) : ExpandedLabels E G → ExpandedVertex I G + | .inl e => .inl (dst e) + | .inr (g,.inl b) => .inr (g,b.castLE (by decide)) + | .inr (g,.inr (.inl r)) => .inl (if r=0 then v₁ g else v₂ g) + | .inr (g,.inr (.inr (_,c))) => .inr (g,c) +noncomputable def expandedWeight (ω : E → R) (w : G → R) : ExpandedLabels E G → R + | .inl e => ω e + | .inr (g,.inl b) => if b=0 then -2*w g else 1 + | .inr (_,.inr (.inl r)) => if r=2 then 0 else 1 + | .inr (_,.inr (.inr (r,c))) => gadgetH r c + +noncomputable def expandedMatrix (src dst : E → I) (ω : E → R) (w : G → R) + (u₁ u₂ v₁ v₂ : G → I) : Matrix (ExpandedVertex I G) (ExpandedVertex I G) R := + graphMatrix (expandedSrc src u₁ u₂) (expandedDst dst v₁ v₂) (expandedWeight ω w) + +noncomputable def splitPolynomial : MvPolynomial (ExpandedVertex I G ⊕ ExpandedVertex I G) R →+* + MvPolynomial (InternalVertex G) (MvPolynomial (I ⊕ I) R) := + (sumRingEquiv R _ _).toRingHom.comp ((rename vertexSplit).toRingHom) + +omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in + @[simp] theorem splitPolynomial_C (a : R) : + splitPolynomial (I := I) (G := G) (C a) = C (C a) := by + simp [splitPolynomial] +omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in + @[simp] theorem splitPolynomial_outer_left (i : I) : + splitPolynomial (G := G) (X (.inl (.inl i)) : MvPolynomial _ R) = C (X (.inl i)) := by + simp [splitPolynomial, vertexSplit] +omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in + @[simp] theorem splitPolynomial_outer_right (i : I) : + splitPolynomial (G := G) (X (.inr (.inl i)) : MvPolynomial _ R) = C (X (.inr i)) := by + simp [splitPolynomial, vertexSplit] +omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in + @[simp] theorem splitPolynomial_inner_left (g : G) (r : Fin 3) : + splitPolynomial (I := I) (X (.inl (.inr (g,r))) : MvPolynomial _ R) = X (g,.inl r) := by + simp [splitPolynomial, vertexSplit] +omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in + @[simp] theorem splitPolynomial_inner_right (g : G) (c : Fin 3) : + splitPolynomial (I := I) (X (.inr (.inr (g,c))) : MvPolynomial _ R) = X (g,.inr c) := by + simp [splitPolynomial, vertexSplit] + +omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in + theorem split_edge (i j : ExpandedVertex I G) (a : R) : + splitPolynomial (1 + monomial (edgeExponent (i,j)) a) = + 1 + splitPolynomial (C a) * splitPolynomial (X (.inl i)) * splitPolynomial (X (.inr j)) := by + have hm : monomial (edgeExponent (i,j)) a = C a * X (.inl i) * X (.inr j) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + simp only [edgeExponent,mul_one] + rw [hm, map_add, map_one, map_mul, map_mul] + +omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in + theorem gadget_factors (g : G) (w : R) (a b c d : I) : + (∏ x : Fin 2, + (1 + C (C (if x = 0 then -2 * w else 1)) * C (X (Sum.inl (if x = 0 then a else b))) * + X (g, Sum.inr (x.castLE (by decide))))) * + ((∏ x : Fin 3, (1 + C (C (if x = 2 then 0 else 1)) * X (g, Sum.inl x) * + C (X (Sum.inr (if x = 0 then c else d))))) * + ∏ x : Fin 3, ∏ y : Fin 3, (1 + C (C (gadgetH x y : R)) * X (g, Sum.inl x) * X (g, Sum.inr y))) = + rename (fun z => (g,z)) + (gadgetEdges (-2*C w*X (.inl a)) (X (.inl b)) (X (.inr c)) (X (.inr d))) := by + classical + simp only [gadgetEdges, map_mul, map_prod, map_add, map_one, rename_C, rename_X] + rw [Finset.prod_mul_distrib] + apply congrArg₂ (·*·) + · simp [Fin.prod_univ_succ, map_mul, mul_assoc, map_ofNat, neg_mul] + ring + · apply congrArg₂ (·*·) + · apply Finset.prod_congr rfl + intro i _ + fin_cases i <;> simp [mul_comm] + · apply Finset.prod_congr rfl + intro i _ + apply Finset.prod_congr rfl + intro j _ + have hc : C (gadgetH i j : R) = (gadgetH i j : MvPolynomial (I ⊕ I) R) := by + fin_cases i <;> fin_cases j <;> simp [gadgetH] + rw [hc] + ac_rfl + +omit [Fintype I] [DecidableEq I] [DecidableEq G] in + theorem split_expanded_edges (src dst : E → I) (ω : E → R) (w : G → R) (u₁ u₂ v₁ v₂ : G → I) : + splitPolynomial (∏ e, (1 + monomial + (edgeExponent (expandedSrc src u₁ u₂ e, expandedDst dst v₁ v₂ e)) (expandedWeight ω w e))) = + C (baseEdges src dst ω) * ∏ g, rename (fun z => (g,z)) + (gadgetEdges (-2*C (w g)*X (.inl (u₁ g))) (X (.inl (u₂ g))) + (X (.inr (v₁ g))) (X (.inr (v₂ g)))) := by + classical + simp only [map_prod, map_mul, Fintype.prod_sum_type, Fintype.prod_prod_type, + split_edge, expandedSrc, expandedDst, expandedWeight, splitPolynomial_C, + splitPolynomial_outer_left, splitPolynomial_outer_right, + splitPolynomial_inner_left, splitPolynomial_inner_right] + congr 1 + · simp only [baseEdges, map_prod, map_add, map_one] + apply Finset.prod_congr rfl + intro e _ + have hm : monomial (edgeExponent (src e,dst e)) (ω e) = + C (ω e)*X (.inl (src e))*X (.inr (dst e)) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + simp only [edgeExponent, mul_one] + rw [hm, map_mul, map_mul] + · apply Finset.prod_congr rfl + intro g _ + exact gadget_factors g (w g) (u₁ g) (u₂ g) (v₁ g) (v₂ g) + + theorem block_three_ones : blockExponent (fun (_ : G) => threeOnes.sumElim threeOnes) = + allOnes (InternalVertex G) := by + classical + ext ⟨g,i⟩ + simp only [blockExponent, Finsupp.finsetSum_apply, mapDomain_block_apply] + rw [Finset.sum_eq_single g] + · simp only + cases i with + | inl i => fin_cases i <;> simp [threeOnes, allOnes] + | inr i => fin_cases i <;> simp [threeOnes, allOnes] + · intro b _ hb; simp [hb] + · simp + +omit [DecidableEq I] [DecidableEq G] in + theorem splitPolynomial_top_coefficient + (p : MvPolynomial (ExpandedVertex I G ⊕ ExpandedVertex I G) R) : + p.coeff (allOnes _) = ((splitPolynomial p).coeff (allOnes (InternalVertex G))).coeff + (allOnes (I ⊕ I)) := by + have h := coeff_rename_mapDomain vertexSplit vertexSplit.injective p (allOnes _) + rw [allOnes_map_equiv] at h + rw [← h] + have ho : allOnes (InternalVertex G ⊕ (I ⊕ I)) = + (allOnes (InternalVertex G)).sumElim (allOnes (I ⊕ I)) := by + ext x; cases x <;> rfl + rw [ho, coeff_nested] + rfl + + theorem expanded_permanent (src dst : E → I) (ω : E → R) (w : G → R) (u₁ u₂ v₁ v₂ : G → I) : + (expandedMatrix src dst ω w u₁ u₂ v₁ v₂).permanent = + (-2:R)^Fintype.card G * (baseEdges src dst ω * ∏ g, + (1 + C (w g)*X (.inl (u₁ g))*X (.inl (u₂ g))* + X (.inr (v₁ g))*X (.inr (v₂ g)))).coeff (allOnes (I ⊕ I)) := by + rw [expandedMatrix, ← coeff_graph_edges, splitPolynomial_top_coefficient, + split_expanded_edges, ← block_three_ones] + rw [eliminate_gadget_network] + have hc : (-2 : MvPolynomial (I ⊕ I) R)^Fintype.card G = C ((-2:R)^Fintype.card G) := by simp only [map_pow, map_neg, map_ofNat] + rw [hc, mul_comm (baseEdges src dst ω), mul_assoc, coeff_C_mul] +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] + + theorem colored_diagonal_edges (M : Matrix I I R) (s t : I → R) : + (edgeProduct M * (∏ i, (1 + C (s i)*X (.inl i)*X (.inr i))) * + (∏ i, (1 + C (t i)*X (.inl i)*X (.inr i)))).coeff (allOnes (I ⊕ I)) = + (M + Matrix.diagonal (fun i => s i+t i)).permanent := by + classical + let src : (I × I) ⊕ (I ⊕ I) → I + | .inl (i,_) => i + | .inr (.inl i) => i + | .inr (.inr i) => i + let dst : (I × I) ⊕ (I ⊕ I) → I + | .inl (_,j) => j + | .inr (.inl i) => i + | .inr (.inr i) => i + let w : (I × I) ⊕ (I ⊕ I) → R + | .inl (i,j) => M i j + | .inr (.inl i) => s i + | .inr (.inr i) => t i + have hm (i : I) (r : R) : monomial (edgeExponent (i,i)) r = + C r*X (.inl i)*X (.inr i) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + simp only [edgeExponent,mul_one] + have hpoly : (∏ e, (1 + monomial (edgeExponent (src e,dst e)) (w e))) = + edgeProduct M * (∏ i, (1 + C (s i)*X (.inl i)*X (.inr i))) * + (∏ i, (1 + C (t i)*X (.inl i)*X (.inr i))) := by + simp only [Fintype.prod_sum_type, src,dst,w,hm,edgeProduct,mul_assoc] + rw [← hpoly, coeff_graph_edges] + congr 1 + ext i j + simp only [graphMatrix, Fintype.sum_sum_type, Fintype.sum_prod_type, src,dst,w, + Matrix.add_apply, Matrix.diagonal_apply] + by_cases hij : i=j + · subst j + simp [and_self, ite_and] + · simp [hij, ite_and] +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {A B R : Type*} [CommSemiring R] + theorem coeff_commAlgEquiv (p : MvPolynomial A (MvPolynomial B R)) + (d : A →₀ ℕ) (e : B →₀ ℕ) : + ((commAlgEquiv R A B p).coeff e).coeff d = (p.coeff d).coeff e := by + classical + induction p using MvPolynomial.induction_on' with + | add p q hp hq => simp only [map_add, AddMonoidAlgebra.coeff_add, Finsupp.add_apply, hp,hq] + | monomial f r => + induction r using MvPolynomial.induction_on' with + | add r s hr hs => simp only [map_add, AddMonoidAlgebra.coeff_add, Finsupp.add_apply, hr,hs] + | monomial g x => + have h : commAlgEquiv R A B (monomial f (monomial g x)) = + monomial g (monomial f x) := by + exact AddMonoidAlgebra.commAlgEquiv_single_single .. + rw [h] + by_cases hf : f=d <;> by_cases hg : g=e <;> simp [coeff_monomial, hf,hg] +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {A B R S : Type*} [CommSemiring R] [CommSemiring S] + theorem commAlgEquiv_map_C (p : MvPolynomial A R) : + commAlgEquiv R A B (map C p) = C p := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp only [map_add, hp,hq] + | mul_X p i hp => simp [hp] + + theorem edgeProduct_map {I : Type*} [Fintype I] (M : Matrix I I R) (f : R →+* S) : + edgeProduct (Matrix.of fun i j => f (M i j)) = map f (edgeProduct M) := by + simp [edgeProduct, map_prod, Matrix.of_apply] +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] +noncomputable def countIndex (q : ℕ) : Fin 2 →₀ ℕ := + Finsupp.equivFunOnFinite.symm (fun _ => q) +noncomputable def elementaryBoundary (a : I → R) (q : ℕ) : R := + (∏ i, (1 + Polynomial.C (a i)*Polynomial.X)).coeff q +noncomputable def diagonalCoefficient (M : Matrix I I R) (θ : I → R) (q : ℕ) : R := + ((Matrix.of fun i j => C (M i j) : Matrix I I (MvPolynomial (Fin 2) R)) + + (Matrix.diagonal (fun i => X (0 : Fin 2) + C (θ i)*X 1) : Matrix I I (MvPolynomial (Fin 2) R))).permanent.coeff + (countIndex q) + +omit [DecidableEq I] in + theorem swap_colored_edge_product (M : Matrix I I R) (θ : I → R) : + commAlgEquiv R (I ⊕ I) (Fin 2) + (edgeProduct (Matrix.of fun i j => C (M i j)) * + (∏ i, (1 + C (X 0)*X (.inl i)*X (.inr i))) * + (∏ i, (1 + C (C (θ i)*X 1)*X (.inl i)*X (.inr i)))) = + C (edgeProduct M) * (∏ i, (1 + C (X (.inl i)*X (.inr i))*X 0)) * + (∏ i, (1 + C (C (θ i)*X (.inl i)*X (.inr i))*X 1)) := by + rw [edgeProduct_map, map_mul, map_mul, commAlgEquiv_map_C] + simp only [map_prod] + apply congrArg₂ (·*·) + · apply congrArg (C (edgeProduct M) * ·) + apply Finset.prod_congr rfl + intro i _ + simp only [map_add, map_one, map_mul, commAlgEquiv_C_X, commAlgEquiv_X] + ring + · apply Finset.prod_congr rfl + intro i _ + simp only [map_add, map_one, map_mul, commAlgEquiv_C, map_mul, map_C, + map_X, commAlgEquiv_X] + ring + +omit [DecidableEq I] in + theorem two_color_coefficient (e : R) (a b : I → R) (q : ℕ) : + (C e * (∏ i, (1 + C (a i)*X 0)) * (∏ i, (1 + C (b i)*X 1)) : + MvPolynomial (Fin 2) R).coeff (countIndex q) = + e * elementaryBoundary a q * elementaryBoundary b q := by + let p : Fin 2 → Polynomial R := + ![∏ i, (1 + Polynomial.C (a i)*Polynomial.X), + ∏ i, (1 + Polynomial.C (b i)*Polynomial.X)] + have h : (∏ x, Polynomial.eval₂ C (X x) (p x)) = + (∏ i, (1 + C (a i)*X (0:Fin 2))) * (∏ i, (1 + C (b i)*X 1)) := by + simp [p, Fin.prod_univ_succ, Polynomial.eval₂_finsetProd] + rw [mul_assoc, ← h, coeff_C_mul, coeff_separate_univariate] + simp [p, Fin.prod_univ_succ, elementaryBoundary, countIndex, mul_assoc] + + theorem diagonalCoefficient_boundary (M : Matrix I I R) (θ : I → R) (q : ℕ) : + diagonalCoefficient M θ q = + (edgeProduct M * elementaryBoundary (fun i => X (.inl i)*X (.inr i)) q * + elementaryBoundary (fun i => C (θ i)*X (.inl i)*X (.inr i)) q).coeff (allOnes (I ⊕ I)) := by + have h := colored_diagonal_edges (Matrix.of fun i j => C (M i j) : Matrix I I (MvPolynomial (Fin 2) R)) + (fun _ => X 0) (fun i => C (θ i)*X 1) + apply_fun (fun p : MvPolynomial (Fin 2) R => p.coeff (countIndex q)) at h + rw [← coeff_commAlgEquiv, swap_colored_edge_product, two_color_coefficient] at h + simpa only [diagonalCoefficient] using h.symm +end PermanentBorder.Selector + +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] + +noncomputable def subsetExponent (s : Finset I) : I →₀ ℕ := + Finsupp.indicator s (fun _ _ => 1) + +omit [Fintype I] in +@[simp] theorem subsetExponent_apply (s : Finset I) (i : I) : + subsetExponent s i = if i ∈ s then 1 else 0 := by + classical + by_cases h : i ∈ s <;> simp [subsetExponent, h] + +omit [Fintype I] in +@[simp] theorem subsetExponent_support (s : Finset I) : (subsetExponent s).support = s := by + ext i; simp [Finsupp.mem_support_iff] + +omit [Fintype I] in +@[simp] theorem subsetExponent_degree (s : Finset I) : + (subsetExponent s).sum (fun _ m => m) = s.card := by + simp [Finsupp.sum, subsetExponent_apply] + +omit [Fintype I] in +@[simp] theorem subsetExponent_multinomial (s : Finset I) : + (subsetExponent s).multinomial = s.card.factorial := by + simp only [Finsupp.multinomial, Finsupp.sum, Finsupp.prod, subsetExponent_support, + subsetExponent_apply] + have hsum : (∑ x ∈ s, (if x ∈ s then 1 else 0)) = s.card := by simp + have hprod : (∏ x ∈ s, (if x ∈ s then 1 else 0).factorial) = 1 := by + apply Finset.prod_eq_one + intro x hx + rw [ite_eq_left hx]; rfl + simp only [id_eq, hsum, hprod, Nat.div_one] + + theorem coeff_gate_half (s : Finset I) (h : ℕ) : + ((∑ i, X i : MvPolynomial I R)^h).coeff (subsetExponent s) = + if s.card = h then (h.factorial : R) else 0 := by + rw [coeff_sum_X_pow_of_fintype, subsetExponent_degree, subsetExponent_multinomial] + split_ifs with hs + · rw [hs] + · simp +end PermanentBorder.Selector.Gates +namespace PermanentBorder.Selector.Gates +open MvPolynomial +variable {A B R : Type*} [CommSemiring R] + theorem sumRingEquiv_monomial (d : A →₀ ℕ) (e : B →₀ ℕ) (r : R) : + sumRingEquiv R A B (monomial (d.sumElim e) r) = monomial d (monomial e r) := by + simp [sumRingEquiv, monomial] + theorem coeff_nested (p : MvPolynomial (A ⊕ B) R) (d : A →₀ ℕ) (e : B →₀ ℕ) : + p.coeff (d.sumElim e) = ((sumRingEquiv R A B p).coeff d).coeff e := by + classical + induction p using MvPolynomial.induction_on' with + | add p q hp hq => simp only [AddMonoidAlgebra.coeff_add, Finsupp.add_apply, map_add, hp, hq] + | monomial f r => + obtain ⟨⟨a, b⟩, rfl⟩ := Finsupp.sumFinsuppAddEquivProdFinsupp.symm.surjective f + have hab : Finsupp.sumFinsuppAddEquivProdFinsupp.symm (a, b) = a.sumElim b := by + ext x; cases x <;> rfl + rw [hab, sumRingEquiv_monomial] + simp only [coeff_monomial] + have habde : a.sumElim b = d.sumElim e ↔ a = d ∧ b = e := by + constructor + · intro h; constructor + · ext x; exact congrArg (fun f => f (Sum.inl x)) h + · ext x; exact congrArg (fun f => f (Sum.inr x)) h + · rintro ⟨rfl, rfl⟩; rfl + simp only [habde] + by_cases ha : a = d <;> by_cases hb : b = e <;> simp [ha, hb] +end PermanentBorder.Selector.Gates + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/GenericPolars.lean b/lean/OAI/Algebra/Determinantal/GenericPolars.lean new file mode 100644 index 0000000000000000000000000000000000000000..34944e082b0a15f19c5e46c2e614162384b72ddf --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/GenericPolars.lean @@ -0,0 +1,434 @@ +import OAI.Algebra.Determinantal.SliceCertificates + +namespace OAI +namespace PermanentBorder.Polar +open MvPolynomial + +section Parametric +variable {K L σ τ : Type*} [Field K] [Field L] [Algebra K L] + [Fintype σ] [Fintype τ] + +noncomputable def polarValue (w : τ → σ → L) (f : MvPolynomial σ K) + (y : σ → L) (i : τ) : L := ∑ j, w i j * aeval y (pderiv j f) + +noncomputable def polarGradient (w : τ → σ → L) (f : MvPolynomial σ K) + (y : σ → L) (i : τ) (j : σ) : L := + ∑ k, w i k * aeval y (pderiv j (pderiv k f)) + +omit [Fintype τ] in +lemma derivation_polarValue (D : Derivation K L L) (w : τ → σ → L) + (f : MvPolynomial σ K) (y : σ → L) (i : τ) : + D (polarValue w f y i) = (∑ j, D (w i j) * aeval y (pderiv j f)) + + ∑ j, polarGradient w f y i j * D (y j) := by + simp only [polarValue, map_sum, Derivation.leibniz, smul_eq_mul, derivation_aeval, + Finset.sum_add_distrib] + rw [add_comm] + congr 1 + · apply Finset.sum_congr rfl + intro j _ + exact mul_comm _ _ + · simp only [polarGradient, Finset.mul_sum, Finset.sum_mul, mul_assoc] + rw [Finset.sum_comm] + +lemma polar_rows_independent_of_derivations [DecidableEq τ] [DecidableEq σ] + (w : τ → σ → L) (f : MvPolynomial σ K) (y : σ → L) + (D : τ × σ → Derivation K L L) + (hw : ∀ a b i j, D (a,b) (w i j) = if (a,b) = (i,j) then 1 else 0) + (hf : aeval y f = 0) (hp : ∀ i, polarValue w f y i = 0) + (hg : ∃ j, aeval y (pderiv j f) ≠ 0) + (c : L) (cfs : τ → L) + (hdep : ∀ j, c * aeval y (pderiv j f) + + ∑ i, cfs i * polarGradient w f y i j = 0) : + c = 0 ∧ cfs = 0 := by + obtain ⟨b,hb⟩ := hg + have hf' (a : τ) : ∑ j, aeval y (pderiv j f) * D (a,b) (y j) = 0 := by + rw [← derivation_aeval, hf, map_zero] + have hp' (a i : τ) : (if a = i then aeval y (pderiv b f) else 0) + + ∑ j, polarGradient w f y i j * D (a,b) (y j) = 0 := by + have hd := congrArg (D (a,b)) (hp i) + rw [derivation_polarValue, map_zero] at hd + convert hd using 1 + by_cases ha : a = i + · simp [hw, ha] + · simp [hw, ha] + have hcfs : ∀ a, cfs a = 0 := by + intro a + have hs : ∑ i, cfs i * (∑ j, polarGradient w f y i j * D (a,b) (y j)) = 0 := by + have hh : c * (∑ j, aeval y (pderiv j f) * D (a,b) (y j)) + + ∑ i, cfs i * (∑ j, polarGradient w f y i j * D (a,b) (y j)) = 0 := by + calc + _ = ∑ j, (c * aeval y (pderiv j f) + + ∑ i, cfs i * polarGradient w f y i j) * D (a,b) (y j) := by + simp only [Finset.mul_sum, Finset.sum_mul, Finset.sum_add_distrib, + add_mul, mul_assoc] + rw [Finset.sum_comm] + _ = 0 := by simp [hdep] + simpa only [hf', mul_zero, zero_add] using hh + have hh : ∑ i, cfs i * ((if a = i then aeval y (pderiv b f) else 0) + + ∑ j, polarGradient w f y i j * D (a,b) (y j)) = 0 := by + simp only [hp', mul_zero, Finset.sum_const_zero] + have : cfs a * aeval y (pderiv b f) = 0 := by + simpa [mul_add, Finset.sum_add_distrib, hs] using hh + exact (mul_eq_zero.mp this).resolve_right hb + have hc : c = 0 := by + have hh := hdep b + simp only [hcfs, zero_mul, Finset.sum_const_zero, add_zero] at hh + exact (mul_eq_zero.mp hh).resolve_right hb + exact ⟨hc,funext hcfs⟩ + +lemma rows_independent_of_derivations [DecidableEq τ] [DecidableEq σ] + (w : τ → σ → L) (l : σ → L) (f : MvPolynomial σ K) (y : σ → L) + (D : Option τ × σ → Derivation K L L) + (hw : ∀ a b i j, D (a,b) (w i j) = if (a,b) = (some i,j) then 1 else 0) + (hl : ∀ a b j, D (a,b) (l j) = if (a,b) = (none,j) then 1 else 0) + (hf : aeval y f = 0) (hp : ∀ i, polarValue w f y i = 0) + (hn : ∑ j, l j * y j = 0 ∨ ∑ j, l j * y j = 1) + (hy : ∃ j, y j ≠ 0) (hg : ∃ j, aeval y (pderiv j f) ≠ 0) + (c z : L) (cfs : τ → L) + (hdep : ∀ j, c * aeval y (pderiv j f) + + ∑ i, cfs i * polarGradient w f y i j + z * l j = 0) : + c = 0 ∧ z = 0 ∧ cfs = 0 := by + have hf' (a : Option τ) (b : σ) : + ∑ j, aeval y (pderiv j f) * D (a,b) (y j) = 0 := by + rw [← derivation_aeval, hf, map_zero] + have hp' (a : Option τ) (b : σ) (i : τ) : + (if a = some i then aeval y (pderiv b f) else 0) + + ∑ j, polarGradient w f y i j * D (a,b) (y j) = 0 := by + have hd := congrArg (D (a,b)) (hp i) + rw [derivation_polarValue, map_zero] at hd + convert hd using 1 + by_cases ha : a = some i + · simp [hw, ha] + · simp [hw, ha] + have hl' (a : Option τ) (b : σ) : + (if a = none then y b else 0) + ∑ j, l j * D (a,b) (y j) = 0 := by + have hd : D (a,b) (∑ j, l j * y j) = 0 := by + rcases hn with h | h <;> simp [h] + simp only [map_sum, Derivation.leibniz, smul_eq_mul, hl, + Finset.sum_add_distrib] at hd + by_cases ha : a = none + · simpa [ha, add_comm] using hd + · simpa [ha] using hd + have combine (a : Option τ) (b : σ) : + c * (∑ j, aeval y (pderiv j f) * D (a,b) (y j)) + + ∑ i, cfs i * (∑ j, polarGradient w f y i j * D (a,b) (y j)) + + z * (∑ j, l j * D (a,b) (y j)) = 0 := by + calc + _ = ∑ j, (c * aeval y (pderiv j f) + + ∑ i, cfs i * polarGradient w f y i j + z * l j) * D (a,b) (y j) := by + simp only [Finset.mul_sum, Finset.sum_mul, Finset.sum_add_distrib, add_mul, mul_assoc] + rw [Finset.sum_comm] + _ = 0 := by simp [hdep] + obtain ⟨b,hyb⟩ := hy + have hz : z = 0 := by + have hc := combine none b + have hpp (i : τ) : ∑ j, polarGradient w f y i j * D (none,b) (y j) = 0 := by + simpa using hp' none b i + simp only [hf', hpp, mul_zero, Finset.sum_const_zero, add_zero, zero_add] at hc + have hll := hl' none b + simp only [ite_true] at hll + have : z * y b = 0 := by linear_combination z * hll - hc + exact (mul_eq_zero.mp this).resolve_right hyb + obtain ⟨b,hgb⟩ := hg + have hcfs : ∀ i, cfs i = 0 := by + intro i + have hc := combine (some i) b + simp only [hf', mul_zero, zero_add, hz, zero_mul, add_zero] at hc + have hs : ∑ a, cfs a * ((if some i = some a then aeval y (pderiv b f) else 0) + + ∑ j, polarGradient w f y a j * D (some i,b) (y j)) = 0 := by + simp only [hp', mul_zero, Finset.sum_const_zero] + have : cfs i * aeval y (pderiv b f) = 0 := by + simpa [mul_add, Finset.sum_add_distrib, hc] using hs + exact (mul_eq_zero.mp this).resolve_right hgb + have hc : c = 0 := by + have hd := hdep b + simp only [hz, zero_mul, hcfs, Finset.sum_const_zero, add_zero] at hd + exact (mul_eq_zero.mp hd).resolve_right hgb + exact ⟨hc,hz,funext hcfs⟩ + +end Parametric +end PermanentBorder.Polar +namespace PermanentBorder.Polar +open MvPolynomial Matrix + +section Square +variable {K L τ : Type*} [Field K] [Field L] [Algebra K L] [Fintype τ] +abbrev PolarVars (τ : Type*) := Option (Option τ) + +noncomputable def squareJacobian (w : τ → PolarVars τ → L) (l : PolarVars τ → L) + (f : MvPolynomial (PolarVars τ) K) (y : PolarVars τ → L) : + Matrix (PolarVars τ) (PolarVars τ) L := fun i j => match i with + | none => aeval y (pderiv j f) + | some none => l j + | some (some i) => polarGradient w f y i j + +lemma square_isUnit_of_independent [DecidableEq τ] + (w : τ → PolarVars τ → L) (l : PolarVars τ → L) + (f : MvPolynomial (PolarVars τ) K) (y : PolarVars τ → L) + (h : ∀ (c z : L) (cfs : τ → L), (∀ j, c * aeval y (pderiv j f) + + ∑ i, cfs i * polarGradient w f y i j + z * l j = 0) → + c = 0 ∧ z = 0 ∧ cfs = 0) : IsUnit (squareJacobian w l f y) := by + apply Matrix.vecMul_injective_iff_isUnit.mp + apply (squareJacobian w l f y).vecMulLinear.ker_eq_bot.mp + rw [LinearMap.ker_eq_bot'] + intro v hv + obtain ⟨hc,hz,hs⟩ := h (v none) (v (some none)) (fun i => v (some (some i))) (by + intro j + have hh := congrFun hv j + simpa [Matrix.vecMul, dotProduct, squareJacobian, Fintype.sum_option, add_assoc, + add_comm, add_left_comm] using hh) + funext i + rcases i with _ | (_ | i) + · exact hc + · exact hz + · exact congrFun hs i + +lemma euler_aeval {σ : Type*} [Fintype σ] {f : MvPolynomial σ K} {r : ℕ} + (hf : f.IsHomogeneous r) (y : σ → L) : + ∑ j, aeval y (pderiv j f) * y j = (r : L) * aeval y f := by + classical + have h := congrArg (aeval y) hf.sum_X_mul_pderiv + simpa [map_sum, mul_comm] using h + +lemma polar_euler_aeval (w : τ → PolarVars τ → L) + {f : MvPolynomial (PolarVars τ) K} {r : ℕ} (hf : f.IsHomogeneous r) + (y : PolarVars τ → L) (i : τ) : + ∑ j, polarGradient w f y i j * y j = ((r-1 : ℕ) : L) * polarValue w f y i := by + classical + simp only [polarGradient, Finset.sum_mul, mul_assoc] + rw [Finset.sum_comm] + simp only [← Finset.mul_sum, euler_aeval hf.pderiv] + simp only [polarValue, Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + +lemma square_mulVec_zero (w : τ → PolarVars τ → L) (l : PolarVars τ → L) + {f : MvPolynomial (PolarVars τ) K} {r : ℕ} (hhom : f.IsHomogeneous r) + (y : PolarVars τ → L) (hf : aeval y f = 0) (hp : ∀ i, polarValue w f y i = 0) + (hl : ∑ j, l j * y j = 0) : (squareJacobian w l f y).mulVec y = 0 := by + classical + funext i + rcases i with _ | (_ | i) + · simpa [Matrix.mulVec, dotProduct, squareJacobian, hf] using euler_aeval hhom y + · exact hl + · simpa [Matrix.mulVec, dotProduct, squareJacobian, hp] using polar_euler_aeval w hhom y i + +end Square + +section GenericSquare +variable {K τ : Type*} [Field K] [CharZero K] [Fintype τ] [DecidableEq τ] +local notation "P" => (Option τ × PolarVars τ) +local notation "E" => GenericField K P + +noncomputable def genericDirections : τ → PolarVars τ → E := + fun i j => genericParameter K P (some i,j) +noncomputable def genericLinear : PolarVars τ → E := + fun j => genericParameter K P (none,j) + +lemma generic_no_infinity (f : MvPolynomial (PolarVars τ) K) {r : ℕ} + (hhom : f.IsHomogeneous r) (y : PolarVars τ → E) + (hf : aeval y f = 0) (hp : ∀ i, polarValue genericDirections f y i = 0) + (hg : ∃ j, aeval y (pderiv j f) ≠ 0) + (hn : ∑ j, genericLinear j * y j = 0) : y = 0 := by + classical + by_contra hy + have hyy : ∃ j, y j ≠ 0 := by simpa only [funext_iff, Pi.zero_apply, not_forall] using hy + have hu : IsUnit (squareJacobian genericDirections genericLinear f y) := + square_isUnit_of_independent _ _ _ _ (fun c z cfs hdep => + rows_independent_of_derivations _ _ _ _ (parameterDerivation K P) + (by intros; exact parameterDerivation_parameter K P _ _) + (by intros; exact parameterDerivation_parameter K P _ _) + hf hp (Or.inl hn) hyy hg c z cfs hdep) + have hh := square_mulVec_zero genericDirections genericLinear hhom y hf hp hn + apply hy + exact Matrix.mulVec_injective_iff_isUnit.mpr hu (by simpa using hh) + +lemma generic_square_isUnit (f : MvPolynomial (PolarVars τ) K) {r : ℕ} + (hhom : f.IsHomogeneous r) (y : PolarVars τ → E) + (hf : aeval y f = 0) (hp : ∀ i, polarValue genericDirections f y i = 0) + (hy : y ≠ 0) (hg : ∃ j, aeval y (pderiv j f) ≠ 0) : + IsUnit (squareJacobian genericDirections genericLinear f y) := by + classical + have hn : ∑ j, genericLinear j * y j ≠ 0 := fun h => + hy (generic_no_infinity f hhom y hf hp hg h) + apply square_isUnit_of_independent + intro c z cfs hdep + have hz : z = 0 := by + have hs : ∑ j, (c * aeval y (pderiv j f) + + ∑ i, cfs i * polarGradient genericDirections f y i j + z * genericLinear j) * y j = 0 := by + simp [hdep] + have he : c * (∑ j, aeval y (pderiv j f) * y j) + + ∑ i, cfs i * (∑ j, polarGradient genericDirections f y i j * y j) + + z * (∑ j, genericLinear j * y j) = 0 := by + convert hs using 1 + simp only [Finset.mul_sum, Finset.sum_mul, Finset.sum_add_distrib, + add_mul, mul_assoc] + rw [Finset.sum_comm] + simp only [euler_aeval hhom, polar_euler_aeval _ hhom, hf, hp, + mul_zero, Finset.sum_const_zero, zero_add] at he + exact (mul_eq_zero.mp he).resolve_right hn + obtain ⟨hc,hcfs⟩ := polar_rows_independent_of_derivations genericDirections f y + (fun (a,b) => parameterDerivation K P (some a,b)) + (by intros; simp only [genericDirections, parameterDerivation_parameter, + Prod.mk.injEq, Option.some.injEq]) hf hp hg c cfs (by simpa [hz] using hdep) + exact ⟨hc,hz,hcfs⟩ + +end GenericSquare +end PermanentBorder.Polar +namespace PermanentBorder.Polar +open MvPolynomial Matrix + +section Polynomials +variable {R σ τ : Type*} [CommRing R] [Fintype σ] [Fintype τ] + +noncomputable def polarPolynomial (w : τ → σ → R) (f : MvPolynomial σ R) (i : τ) : + MvPolynomial σ R := ∑ j, C (w i j) * pderiv j f + +noncomputable def linearPolynomial (l : σ → R) : MvPolynomial σ R := + ∑ j, C (l j) * X j + +omit [Fintype τ] in +lemma polarPolynomial_homogeneous (w : τ → σ → R) {f : MvPolynomial σ R} {r : ℕ} + (hf : f.IsHomogeneous r) (i : τ) : (polarPolynomial w f i).IsHomogeneous (r-1) := by + apply IsHomogeneous.sum + intro j _ + simpa using (isHomogeneous_C σ (w i j)).mul hf.pderiv + +omit [Fintype τ] in +lemma linearPolynomial_homogeneous (l : σ → R) : (linearPolynomial l).IsHomogeneous 1 := by + apply IsHomogeneous.sum + intro j _ + simpa using (isHomogeneous_C σ (l j)).mul (isHomogeneous_X R j) + +omit [Fintype σ] in +lemma det_row_homogeneous {n : Type*} [Fintype n] [DecidableEq n] + (A : Matrix n n (MvPolynomial σ R)) (e : n → ℕ) + (hA : ∀ i j, (A i j).IsHomogeneous (e i)) : A.det.IsHomogeneous (∑ i, e i) := by + classical + rw [Matrix.det_apply] + apply IsHomogeneous.sum + intro p _ + have hp : (∏ i, A (p i) i).IsHomogeneous (∑ i, e (p i)) := + IsHomogeneous.prod _ _ _ (fun i _ => hA _ _) + rw [Equiv.sum_comp] at hp + change (p.sign : ℤ) • (∏ i, A (p i) i) ∈ + (homogeneousSubmodule σ R (∑ i, e i)).restrictScalars ℤ + exact Submodule.smul_mem _ _ hp + +noncomputable def squarePolynomial (w : τ → PolarVars τ → R) (l : PolarVars τ → R) + (f : MvPolynomial (PolarVars τ) R) : + Matrix (PolarVars τ) (PolarVars τ) (MvPolynomial (PolarVars τ) R) := + fun i j => match i with + | none => pderiv j f + | some none => C (l j) + | some (some i) => pderiv j (polarPolynomial w f i) + +def squareDegrees (τ : Type*) (r : ℕ) : PolarVars τ → ℕ := fun i => match i with + | none => r-1 + | some none => 0 + | some (some _) => r-1-1 + +lemma squarePolynomial_homogeneous [DecidableEq τ] (w : τ → PolarVars τ → R) (l : PolarVars τ → R) + {f : MvPolynomial (PolarVars τ) R} {r : ℕ} (hf : f.IsHomogeneous r) : + (squarePolynomial w l f).det.IsHomogeneous (∑ i, squareDegrees τ r i) := by + classical + apply det_row_homogeneous + intro i j + rcases i with _ | (_ | i) + · exact hf.pderiv + · exact isHomogeneous_C _ _ + · exact (polarPolynomial_homogeneous w hf i).pderiv + +noncomputable def badPolarSystem (w : τ → PolarVars τ → R) (l : PolarVars τ → R) + (f : MvPolynomial (PolarVars τ) R) : PolarVars τ → MvPolynomial (PolarVars τ) R := by + classical + exact fun i => match i with + | none => f + | some none => linearPolynomial l * (squarePolynomial w l f).det + | some (some i) => polarPolynomial w f i + +def badPolarDegrees (τ : Type*) [Fintype τ] (r : ℕ) : PolarVars τ → ℕ := + fun i => match i with + | none => r + | some none => 1 + ∑ i, squareDegrees τ r i + | some (some _) => r-1 + +lemma badPolarSystem_homogeneous (w : τ → PolarVars τ → R) (l : PolarVars τ → R) + {f : MvPolynomial (PolarVars τ) R} {r : ℕ} (hf : f.IsHomogeneous r) (i : PolarVars τ) : + (badPolarSystem w l f i).IsHomogeneous (badPolarDegrees τ r i) := by + classical + rcases i with _ | (_ | i) + · exact hf + · exact (linearPolynomial_homogeneous l).mul (squarePolynomial_homogeneous w l hf) + · exact polarPolynomial_homogeneous w hf i + +end Polynomials + +section Evaluation +variable {K L σ τ : Type*} [Field K] [Field L] [Algebra K L] [Fintype σ] [Fintype τ] + +omit [Fintype τ] in +lemma eval_polarPolynomial (w : τ → σ → L) (f : MvPolynomial σ K) + (y : σ → L) (i : τ) : + eval y (polarPolynomial w (map (algebraMap K L) f) i) = polarValue w f y i := by + simp [polarPolynomial, polarValue, pderiv_map, eval_map, aeval_def] + +lemma eval_linearPolynomial (l : σ → L) (y : σ → L) : + eval y (linearPolynomial l) = ∑ j, l j * y j := by + simp [linearPolynomial] + +lemma eval_squarePolynomial (w : τ → PolarVars τ → L) (l : PolarVars τ → L) + (f : MvPolynomial (PolarVars τ) K) (y : PolarVars τ → L) : + (squarePolynomial w l (map (algebraMap K L) f)).map (eval y) = squareJacobian w l f y := by + classical + ext i j + rcases i with _ | (_ | i) + · simp [squarePolynomial, squareJacobian, pderiv_map, eval_map, aeval_def] + · simp [squarePolynomial, squareJacobian] + · simp [squarePolynomial, squareJacobian, polarPolynomial, polarGradient, pderiv_map, + eval_map, aeval_def] + +end Evaluation +end PermanentBorder.Polar +namespace PermanentBorder.Polar +open MvPolynomial Matrix + +section Map +variable {R S σ τ : Type*} [CommRing R] [CommRing S] [Fintype σ] [Fintype τ] + +omit [Fintype τ] in +lemma map_polarPolynomial (φ : R →+* S) (w : τ → σ → R) (f : MvPolynomial σ R) (i : τ) : + map φ (polarPolynomial w f i) = polarPolynomial (fun i j => φ (w i j)) (map φ f) i := by + simp [polarPolynomial, pderiv_map] + +lemma map_linearPolynomial (φ : R →+* S) (l : σ → R) : + map φ (linearPolynomial l) = linearPolynomial (fun j => φ (l j)) := by + simp [linearPolynomial] + +lemma map_squarePolynomial (φ : R →+* S) (w : τ → PolarVars τ → R) + (l : PolarVars τ → R) (f : MvPolynomial (PolarVars τ) R) : + (squarePolynomial w l f).map (map φ) = + squarePolynomial (fun i j => φ (w i j)) (fun j => φ (l j)) (map φ f) := by + classical + funext i j + rcases i with _ | (_ | i) + · simp [squarePolynomial, pderiv_map] + · simp [squarePolynomial] + · simp only [Matrix.map_apply, squarePolynomial, ← pderiv_map, map_polarPolynomial] + +lemma map_badPolarSystem (φ : R →+* S) (w : τ → PolarVars τ → R) + (l : PolarVars τ → R) (f : MvPolynomial (PolarVars τ) R) (i : PolarVars τ) : + map φ (badPolarSystem w l f i) = + badPolarSystem (fun i j => φ (w i j)) (fun j => φ (l j)) (map φ f) i := by + classical + rcases i with _ | (_ | i) + · rfl + · simp only [badPolarSystem, map_mul, map_linearPolynomial, RingHom.map_det, + RingHom.mapMatrix_apply, map_squarePolynomial] + · exact map_polarPolynomial φ w f i + +end Map +end PermanentBorder.Polar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Gradients.lean b/lean/OAI/Algebra/Determinantal/Gradients.lean new file mode 100644 index 0000000000000000000000000000000000000000..3be796fd80a6112815f0eecd4e7a596a6eb908c8 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Gradients.lean @@ -0,0 +1,417 @@ +import OAI.Algebra.Determinantal.PencilSeparability + +namespace OAI + +namespace PermanentBorder.GradientAlgebra + +open Finset + +section CharacteristicTwo +variable {ι R : Type*} [Fintype ι] [DecidableEq ι] [CommRing R] [CharP R 2] + +theorem permanent_eq_det (M : Matrix ι ι R) : M.permanent = M.det := by + rw [Matrix.permanent, Matrix.det_apply] + apply Finset.sum_congr rfl + intro σ _ + rcases Int.units_eq_one_or (Equiv.Perm.sign σ) with h | h + · simp [h] + · simp [h, CharTwo.neg_eq] +end CharacteristicTwo + +section Derivative +variable {R A ι : Type*} [CommRing R] [CommRing A] [Algebra R A] +variable [DecidableEq ι] + +theorem derivation_prod (D : Derivation R A A) (s : Finset ι) (f : ι → A) : + D (∏ i ∈ s, f i) = ∑ i ∈ s, (∏ j ∈ s.erase i, f j) * D (f i) := by + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => + rw [Finset.prod_insert ha, D.leibniz, ih] + simp only [smul_eq_mul, Finset.sum_insert ha, Finset.erase_insert ha, + Finset.mul_sum] + rw [add_comm] + congr 1 + apply Finset.sum_congr rfl + intro i hi + have hai : a ≠ i := by + intro h + exact ha (h ▸ hi) + rw [Finset.erase_insert_of_ne hai, Finset.prod_insert] + · ring + · exact Finset.notMem_mono (Finset.erase_subset _ _) ha + +variable [Fintype ι] + +theorem derivation_det_updateCol (D : Derivation R A A) (M : Matrix ι ι A) : + D M.det = ∑ j, (M.updateCol j (fun i => D (M i j))).det := by + rw [Matrix.det_apply, map_sum] + simp only [Units.smul_def, map_zsmul, derivation_prod] + simp only [Finset.smul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + rw [Matrix.det_apply] + apply Finset.sum_congr rfl + intro σ _ + rw [Units.smul_def] + congr 1 + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ j)] + rw [Matrix.updateCol_self] + rw [mul_comm] + congr 1 + apply Finset.prod_congr rfl + intro i hi + exact (Matrix.updateCol_ne (Finset.ne_of_mem_erase hi)).symm + +theorem derivation_det (D : Derivation R A A) (M : Matrix ι ι A) : + D M.det = ∑ j, ∑ i, M.adjugate j i * D (M i j) := by + rw [derivation_det_updateCol] + apply Finset.sum_congr rfl + intro j _ + rw [← Matrix.cramer_apply, Matrix.cramer_eq_adjugate_mulVec] + rfl +end Derivative + +section Pencil +open MvPolynomial +variable {R ι σ τ : Type*} [CommRing R] + +noncomputable def coefficientPart (e : τ →₀ ℕ) : + MvPolynomial σ (MvPolynomial τ R) →+ MvPolynomial σ R where + toFun := AddMonoidAlgebra.map (coeffAddMonoidHom e) + map_zero' := by ext; simp + map_add' := AddMonoidAlgebra.map_add _ + +@[simp] theorem coeff_coefficientPart (e : τ →₀ ℕ) + (P : MvPolynomial σ (MvPolynomial τ R)) (d : σ →₀ ℕ) : + (coefficientPart e P).coeff d = (P.coeff d).coeff e := rfl + +theorem coefficientPart_pderiv (e : τ →₀ ℕ) + (P : MvPolynomial σ (MvPolynomial τ R)) (i : σ) : + coefficientPart e (pderiv i P) = pderiv i (coefficientPart e P) := by + ext d + simp only [coeff_coefficientPart, coeff_pderiv] + rw [show (d i + 1 : MvPolynomial τ R) = C (d i + 1 : R) by simp] + rw [mul_comm, coeff_C_mul, mul_comm] + +variable [Fintype ι] [DecidableEq ι] + +noncomputable def genericPencil (θ : ι → R) : + Matrix ι ι (MvPolynomial (ι × ι) (MvPolynomial (Fin 3) R)) := + fun i j => + C (if i = j then X 0 + C (θ i) * X 1 else 0) + C (X 2) * X (i,j) + +omit [Fintype ι] in +@[simp] theorem pderiv_genericPencil (θ : ι → R) (i j a b : ι) : + pderiv (a,b) (genericPencil θ i j) = + if (a,b) = (i,j) then C (X (2 : Fin 3)) else 0 := by + classical + simp [genericPencil, pderiv_X, Pi.single_apply, eq_comm] + +theorem pderiv_det_genericPencil (θ : ι → R) (a b : ι) : + pderiv (a,b) (genericPencil θ).det = + C (X (2 : Fin 3)) * (genericPencil θ).adjugate b a := by + rw [derivation_det] + simp only [pderiv_genericPencil, Prod.mk.injEq] + rw [Finset.sum_eq_single b] + · simp [mul_comm] + · intro j _ hj + apply Finset.sum_eq_zero + intro i _ + simp [Ne.symm hj] + · simp +end Pencil + +section CoefficientCalculus +open MvPolynomial +variable {R σ τ : Type*} [CommRing R] + +theorem coefficientPart_C_X_mul (e : τ →₀ ℕ) (i : τ) + (P : MvPolynomial σ (MvPolynomial τ R)) : + coefficientPart (Finsupp.single i 1 + e) (C (X i) * P) = + coefficientPart e P := by + ext d + simp only [coeff_coefficientPart, coeff_C_mul, coeff_X_mul] + +@[simp] theorem coefficientPart_monomial (e : τ →₀ ℕ) (d : σ →₀ ℕ) + (a : MvPolynomial τ R) : + coefficientPart e (monomial d a) = monomial d (a.coeff e) := by + classical + ext d' + simp only [coeff_coefficientPart, coeff_monomial] + split_ifs <;> simp_all + +theorem eval_coefficientPart (e : τ →₀ ℕ) (x : σ → R) + (P : MvPolynomial σ (MvPolynomial τ R)) : + eval x (coefficientPart e P) = + (eval (fun i => C (x i)) P).coeff e := by + classical + induction P using MvPolynomial.induction_on' with + | add P Q hp hq => simp [hp, hq] + | monomial d a => + simp only [coefficientPart_monomial, eval_monomial] + have hp : d.prod (fun i n => (C (x i) : MvPolynomial τ R) ^ n) = + C (d.prod (fun i n => x i ^ n)) := by + simp only [Finsupp.prod, map_prod, map_pow] + rw [hp, mul_comm a, coeff_C_mul, mul_comm] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +noncomputable def fixedPencil (θ : ι → R) (x : Matrix ι ι R) : + Matrix ι ι (MvPolynomial (Fin 3) R) := fun i j => + (if i = j then X 0 + C (θ i) * X 1 else 0) + X 2 * C (x i j) + +theorem eval_genericPencil (θ : ι → R) (x : Matrix ι ι R) : + (eval (fun ij : ι × ι => C (x ij.1 ij.2))).mapMatrix (genericPencil θ) = + fixedPencil θ x := by + ext i j + simp [genericPencil, fixedPencil] + +theorem gradient_coefficient_identity (θ : ι → R) (x : Matrix ι ι R) + (e : Fin 3 →₀ ℕ) (a b : ι) : + eval (fun ij : ι × ι => x ij.1 ij.2) + (pderiv (a,b) (coefficientPart (Finsupp.single 2 1 + e) + (genericPencil θ).det)) = + ((fixedPencil θ x).adjugate b a).coeff e := by + rw [← coefficientPart_pderiv, pderiv_det_genericPencil, coefficientPart_C_X_mul, + eval_coefficientPart] + have h := congrArg (fun M : Matrix ι ι (MvPolynomial (Fin 3) R) => M b a) + ((eval (fun ij : ι × ι => C (x ij.1 ij.2))).map_adjugate (genericPencil θ)) + change eval (fun ij : ι × ι => C (x ij.1 ij.2)) + ((genericPencil θ).adjugate b a) = _ at h + rw [h, eval_genericPencil] + +theorem gradient_zero_iff_adjugate_coefficient (θ : ι → R) (x : Matrix ι ι R) + (e : Fin 3 →₀ ℕ) : + (∀ a b, eval (fun ij : ι × ι => x ij.1 ij.2) + (pderiv (a,b) (coefficientPart (Finsupp.single 2 1 + e) + (genericPencil θ).det)) = 0) ↔ + ∀ i j, ((fixedPencil θ x).adjugate i j).coeff e = 0 := by + simp_rw [gradient_coefficient_identity] + exact ⟨fun h i j => h j i, fun h i j => h j i⟩ +end CoefficientCalculus + +section AffinePencil +open MvPolynomial +variable {R σ : Type*} [CommRing R] + +noncomputable def biCoefficientPart (a b : ℕ) : + MvPolynomial σ (Polynomial (Polynomial R)) →+ MvPolynomial σ R where + toFun := AddMonoidAlgebra.map + ((Polynomial.lcoeff R b).toAddMonoidHom.comp + (Polynomial.lcoeff (Polynomial R) a).toAddMonoidHom) + map_zero' := by ext; simp + map_add' := AddMonoidAlgebra.map_add _ + +@[simp] theorem coeff_biCoefficientPart (a b : ℕ) + (P : MvPolynomial σ (Polynomial (Polynomial R))) (d : σ →₀ ℕ) : + (biCoefficientPart a b P).coeff d = ((P.coeff d).coeff a).coeff b := rfl + +theorem biCoefficientPart_pderiv (a b : ℕ) + (P : MvPolynomial σ (Polynomial (Polynomial R))) (i : σ) : + biCoefficientPart a b (pderiv i P) = pderiv i (biCoefficientPart a b P) := by + ext d + simp only [coeff_biCoefficientPart, coeff_pderiv] + simp only [← Nat.cast_add_one, Polynomial.coeff_mul_natCast] + +@[simp] theorem biCoefficientPart_monomial (a b : ℕ) (d : σ →₀ ℕ) + (c : Polynomial (Polynomial R)) : + biCoefficientPart a b (monomial d c) = monomial d ((c.coeff a).coeff b) := by + classical + ext d' + simp only [coeff_biCoefficientPart, coeff_monomial] + split_ifs <;> simp_all + +theorem eval_biCoefficientPart (a b : ℕ) (x : σ → R) + (P : MvPolynomial σ (Polynomial (Polynomial R))) : + eval x (biCoefficientPart a b P) = + ((eval (fun i => Polynomial.C (Polynomial.C (x i))) P).coeff a).coeff b := by + classical + induction P using MvPolynomial.induction_on' with + | add P Q hp hq => simp [hp, hq] + | monomial d c => + simp only [biCoefficientPart_monomial, eval_monomial] + have hp : d.prod (fun i n => (Polynomial.C (Polynomial.C (x i))) ^ n) = + Polynomial.C (Polynomial.C (d.prod (fun i n => x i ^ n))) := by + simp only [Finsupp.prod, map_prod, map_pow] + rw [hp, mul_comm c, Polynomial.coeff_C_mul, Polynomial.coeff_C_mul, mul_comm] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] +noncomputable def genericAffinePencil (θ : ι → R) : + Matrix ι ι (MvPolynomial (ι × ι) (Polynomial (Polynomial R))) := + fun i j => C (if i = j then Polynomial.X + Polynomial.C + (Polynomial.X * Polynomial.C (θ i)) else 0) + X (i,j) + +noncomputable def fixedAffinePencil (θ : ι → R) (x : Matrix ι ι R) : + Matrix ι ι (Polynomial (Polynomial R)) := fun i j => + (if i = j then Polynomial.X + Polynomial.C + (Polynomial.X * Polynomial.C (θ i)) else 0) + Polynomial.C (Polynomial.C (x i j)) + +omit [Fintype ι] in +@[simp] theorem pderiv_genericAffinePencil (θ : ι → R) (i j a b : ι) : + pderiv (a,b) (genericAffinePencil θ i j) = if (a,b) = (i,j) then 1 else 0 := by + classical + simp [genericAffinePencil, pderiv_X, Pi.single_apply, eq_comm] + +theorem pderiv_det_genericAffinePencil (θ : ι → R) (a b : ι) : + pderiv (a,b) (genericAffinePencil θ).det = (genericAffinePencil θ).adjugate b a := by + classical + have hd := derivation_det (pderiv (a,b)) (genericAffinePencil θ) + rw [hd] + simp only [pderiv_genericAffinePencil, Prod.mk.injEq] + rw [Finset.sum_eq_single b] + · simp + · intro j _ hj + apply Finset.sum_eq_zero + intro i _ + simp [Ne.symm hj] + · simp + +theorem eval_genericAffinePencil (θ : ι → R) (x : Matrix ι ι R) : + (eval (fun ij : ι × ι => Polynomial.C (Polynomial.C (x ij.1 ij.2)))).mapMatrix + (genericAffinePencil θ) = fixedAffinePencil θ x := by + ext i j + simp [genericAffinePencil, fixedAffinePencil] + +noncomputable def affineSelector (θ : ι → R) (q : ℕ) : MvPolynomial (ι × ι) R := + biCoefficientPart q q (genericAffinePencil θ).permanent + +theorem gradient_affineSelector [CharP R 2] (θ : ι → R) + (x : Matrix ι ι R) (q : ℕ) (a b : ι) : + eval (fun ij : ι × ι => x ij.1 ij.2) (pderiv (a,b) (affineSelector θ q)) = + (((fixedAffinePencil θ x).adjugate b a).coeff q).coeff q := by + classical + have hp := permanent_eq_det (genericAffinePencil θ) + rw [affineSelector, hp, ← biCoefficientPart_pderiv, + pderiv_det_genericAffinePencil, eval_biCoefficientPart] + have h := congrArg (fun M : Matrix ι ι (Polynomial (Polynomial R)) => M b a) + ((eval (fun ij : ι × ι => Polynomial.C (Polynomial.C (x ij.1 ij.2)))).map_adjugate + (genericAffinePencil θ)) + change eval (fun ij : ι × ι => Polynomial.C (Polynomial.C (x ij.1 ij.2))) + ((genericAffinePencil θ).adjugate b a) = _ at h + rw [h, eval_genericAffinePencil] +end AffinePencil + +end PermanentBorder.GradientAlgebra + +namespace PermanentBorder.Selector +open MvPolynomial +section +variable {R σ : Type*} [CommRing R] + +noncomputable def bivariateToNested : MvPolynomial (Fin 2) R →+* Polynomial (Polynomial R) := + (Polynomial.mapRingHom (uniqueAlgEquiv R (Fin 1)).toRingHom).comp + (finSuccEquiv R 1).toRingHom + +lemma bivariateToNested_coeff (P : MvPolynomial (Fin 2) R) (q : ℕ) : + ((bivariateToNested P).coeff q).coeff q = P.coeff (countIndex q) := by + change ((Polynomial.map (uniqueAlgEquiv R (Fin 1)).toRingHom + (finSuccEquiv R 1 P)).coeff q).coeff q = _ + rw [Polynomial.coeff_map] + change ((uniqueAlgEquiv R (Fin 1)) ((finSuccEquiv R 1 P).coeff q)).coeff q = _ + rw [coeff_uniqueAlgEquiv, finSuccEquiv_coeff_coeff] + congr 1 + ext i + fin_cases i + · simp [countIndex] + · change (Finsupp.cons q (Finsupp.single (0 : Fin 1) q)) + (Fin.succ (0 : Fin 1)) = q + change (Finsupp.single (0 : Fin 1) q) 0 = q + simp + +@[simp] lemma bivariateToNested_C (r : R) : + bivariateToNested (C r) = Polynomial.C (Polynomial.C r) := by + simp [bivariateToNested, finSuccEquiv_apply] + +@[simp] lemma bivariateToNested_X_zero : + bivariateToNested (X (0 : Fin 2) : MvPolynomial (Fin 2) R) = Polynomial.X := by + change Polynomial.map (uniqueAlgEquiv R (Fin 1)).toRingHom + (finSuccEquiv R 1 (X 0)) = _ + rw [finSuccEquiv_X_zero, Polynomial.map_X] + +@[simp] lemma bivariateToNested_X_one : + bivariateToNested (X (1 : Fin 2) : MvPolynomial (Fin 2) R) = + Polynomial.C Polynomial.X := by + change Polynomial.map (uniqueAlgEquiv R (Fin 1)).toRingHom + (finSuccEquiv R 1 (X (Fin.succ (0 : Fin 1)))) = _ + rw [finSuccEquiv_X_succ, Polynomial.map_C] + congr 1 + simp + +lemma commAlgEquiv_coeff_coeff (P : MvPolynomial (Fin 2) (MvPolynomial σ R)) + (a : Fin 2 →₀ ℕ) (b : σ →₀ ℕ) : + ((commAlgEquiv R (Fin 2) σ P).coeff b).coeff a = (P.coeff a).coeff b := by + classical + induction P using MvPolynomial.induction_on' with + | add P Q hP hQ => simp [hP,hQ] + | monomial d c => + induction c using MvPolynomial.induction_on' with + | add c e hc he => simp [map_add, hc,he] + | monomial e c => + change ((AddMonoidAlgebra.commAlgEquiv R + (AddMonoidAlgebra.single d (AddMonoidAlgebra.single e c))).coeff b).coeff a = _ + rw [AddMonoidAlgebra.commAlgEquiv_single_single] + change ((monomial e (monomial d c)).coeff b).coeff a = _ + simp only [coeff_monomial] + split_ifs <;> simp_all + +noncomputable def interchangeBivariate : + MvPolynomial (Fin 2) (MvPolynomial σ R) →+* + MvPolynomial σ (Polynomial (Polynomial R)) := + (map bivariateToNested).comp (commAlgEquiv R (Fin 2) σ).toRingHom + +lemma biCoefficientPart_interchange (P : MvPolynomial (Fin 2) (MvPolynomial σ R)) (q : ℕ) : + GradientAlgebra.biCoefficientPart q q (interchangeBivariate P) = P.coeff (countIndex q) := by + ext d + rw [GradientAlgebra.coeff_biCoefficientPart] + change (((map bivariateToNested (commAlgEquiv R (Fin 2) σ P)).coeff d).coeff q).coeff q = _ + rw [coeff_map,bivariateToNested_coeff,commAlgEquiv_coeff_coeff] + +@[simp] lemma interchangeBivariate_C_X (i : σ) : + interchangeBivariate (C (X i) : MvPolynomial (Fin 2) (MvPolynomial σ R)) = X i := by + simp [interchangeBivariate] + +@[simp] lemma interchangeBivariate_C_C (r : R) : + interchangeBivariate (C (C r) : MvPolynomial (Fin 2) (MvPolynomial σ R)) = + C (Polynomial.C (Polynomial.C r)) := by + simp [interchangeBivariate] + +@[simp] lemma interchangeBivariate_X_zero : + interchangeBivariate (X (0 : Fin 2) : MvPolynomial (Fin 2) (MvPolynomial σ R)) = + C Polynomial.X := by + simp [interchangeBivariate] + +@[simp] lemma interchangeBivariate_X_one : + interchangeBivariate (X (1 : Fin 2) : MvPolynomial (Fin 2) (MvPolynomial σ R)) = + C (Polynomial.C (Polynomial.X : Polynomial R)) := by + simp [interchangeBivariate] +end + +lemma diagonalCoefficient_eq_affineSelector {R I : Type*} [CommRing R] + [Fintype I] [DecidableEq I] (θ : I → R) (q : ℕ) : + diagonalCoefficient (Matrix.of fun i j => (X (i,j) : MvPolynomial (I×I) R)) + (fun i => C (θ i)) q = GradientAlgebra.affineSelector θ q := by + classical + unfold diagonalCoefficient GradientAlgebra.affineSelector + rw [← biCoefficientPart_interchange] + congr 1 + unfold Matrix.permanent + simp only [map_sum,map_prod] + apply Finset.sum_congr rfl + intro π _ + apply Finset.prod_congr rfl + intro i _ + simp only [Matrix.add_apply,Matrix.of_apply,Matrix.diagonal_apply, + GradientAlgebra.genericAffinePencil] + split_ifs + · simp only [map_add,map_mul,interchangeBivariate_C_X,interchangeBivariate_X_zero, + interchangeBivariate_C_C,interchangeBivariate_X_one] + simp only [← map_mul,← map_add] + rw [add_comm] + congr 2 + rw [mul_comm] + · simp +end PermanentBorder.Selector + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/HalfPolynomials.lean b/lean/OAI/Algebra/Determinantal/HalfPolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..fcfed0412f30d83422c2702bda24a136dc92292a --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/HalfPolynomials.lean @@ -0,0 +1,391 @@ +import OAI.Algebra.Determinantal.FilteredPlane + +namespace OAI + +namespace PermanentBorder.LinearParameters +open Module +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + {S ι κ : Type*} [AddCommGroup S] [Module L S] [Fintype ι] [Fintype κ] + +theorem add_constrained_parameters (F : IntermediateField K L) (n : ℕ) + (hF : Algebra.trdeg K F ≤ (n : Cardinal)) (c : Basis κ L S) + (v : ι → S) (x : ι → L) (hvc : ∀ i j, c.repr (v i) j ∈ F) + (hx : ∀ j, c.repr (∑ i, x i • v i) j ∈ F) : + ∃ E : IntermediateField K L, F ≤ E ∧ (∀ i, x i ∈ E) ∧ + Algebra.trdeg K E ≤ + (n + (Fintype.card ι - finrank L (Submodule.span L (Set.range v))) : ℕ) := by + classical + let : Module.Finite L S := Module.Finite.of_basis c + let r := finrank L (Submodule.span L (Set.range v)) + obtain ⟨w,hw,_,hwi⟩ := Submodule.exists_fun_fin_finrank_span_eq L (Set.range v) + choose j hj using hw + have hji : Function.Injective j := by + intro a b h + apply hwi.injective + rw [← hj a,← hj b,h] + let e := Equiv.ofInjective j hji + let t := (Set.range j)ᶜ + have ht : Fintype.card t = Fintype.card ι - r := by + rw [Fintype.card_compl_set,← Fintype.card_congr e] + simp only [Fintype.card_fin,r] + obtain ⟨E,hFE,hxE,hE⟩ := SliceParameters.add_parameters F n hF (fun i : t => x i) + have hsum : (∑ a, x (j a) • v (j a)) = + (∑ i, x i • v i) - ∑ i : t, x i • v i := by + have he := Equiv.sum_comp e (fun a : Set.range j => x a • v a) + change (∑ a, x (j a) • v (j a)) = _ at he + rw [he] + apply eq_sub_of_add_eq + convert Fintype.sum_subtype_add_sum_subtype (fun i => i ∈ Set.range j) + (fun i => x i • v i) using 1 + congr 3 + exact Subsingleton.elim _ _ + have hpi : LinearIndependent L (fun a => v (j a)) := by + simpa only [hj] using hwi + have hpE : ∀ a, x (j a) ∈ E := independent_coefficients_mem E c + (fun a => v (j a)) hpi (fun a => x (j a)) + (fun a k => hFE (hvc (j a) k)) (by + intro k + rw [hsum,map_sub] + apply E.sub_mem (hFE (hx k)) + simp only [map_sum,Finsupp.finsetSum_apply,map_smul,Finsupp.smul_apply,smul_eq_mul] + exact E.sum_mem (fun i _ => E.mul_mem (hxE i) (hFE (hvc i k)))) + refine ⟨E,hFE,?_,?_⟩ + · intro i + by_cases hi : i ∈ Set.range j + · obtain ⟨a,rfl⟩ := hi + exact hpE a + · exact hxE ⟨i,hi⟩ + · simpa only [ht] using hE + +end PermanentBorder.LinearParameters +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert +universe u +variable {K L R : Type u} [Field K] [Field L] [Algebra K L] + [CommRing R] [Algebra L R] + +def InField (F : IntermediateField K L) (p : MvPolynomial (Fin 2) L) : Prop := + ∀ s, p.coeff s ∈ F + +lemma inField_lift (F : IntermediateField K L) {p : MvPolynomial (Fin 2) L} + (hp : InField F p) : ∃ p₀ : MvPolynomial (Fin 2) F, p₀.map F.val.toRingHom = p := by + apply mem_range_map_iff_coeffs_subset.mpr + intro c hc + obtain ⟨s,_,rfl⟩ := mem_coeffs_iff.mp hc + exact ⟨⟨_,hp s⟩,rfl⟩ + +lemma inField_of_high {F : IntermediateField K L} {p : MvPolynomial (Fin 2) L} + {B : ℕ} (hp : ∀ s, B ≤ s.degree → p.coeff s ∈ F) + (hlow : ∀ s : Index B, p.coeff s.val ∈ F) : InField F p := by + intro s + by_cases hs : s.degree < B + · exact hlow ⟨s,hs⟩ + · exact hp s (by omega) + +lemma span_low (q : MvPolynomial (Fin 2) L →ₐ[L] R) (B : ℕ) : + Submodule.span L (Set.range (fun s : Index B => q (monomial s.val (1 : L)))) = filtered q B := by + classical + apply le_antisymm + · apply Submodule.span_le.mpr + rintro _ ⟨s,rfl⟩ + cases B with + | zero => exact False.elim (Nat.not_lt_zero _ s.property) + | succ B => + apply (mem_filtered_succ q B _).mpr + refine ⟨_,(totalDegree_monomial_le _ _).trans ?_,rfl⟩ + change s.val.degree ≤ B + have h:=s.property + omega + · cases B with + | zero => exact bot_le + | succ B => + intro z hz + obtain ⟨p,hp,rfl⟩ := (mem_filtered_succ q B z).mp hz + rw [LowPlane.expansion (B := B+1) p (by + intro s hs + have hc : s.degree ≤ p.totalDegree := le_totalDegree hs + omega),map_sum] + apply Submodule.sum_mem + intro s _ + rw [map_smul] + exact Submodule.smul_mem _ _ (Submodule.subset_span (Set.mem_range_self s)) + +lemma repr_polynomial_mem {ι : Type*} [Fintype ι] (F : IntermediateField K L) + (q : MvPolynomial (Fin 2) L →ₐ[L] R) (c : Basis ι L R) + (hmon : ∀ s i, c.repr (q (monomial s (1 : L))) i ∈ F) + (p : MvPolynomial (Fin 2) L) (hp : InField F p) : + ∀ i, c.repr (q p) i ∈ F := by + classical + intro i + rw [p.as_sum] + simp only [map_sum,Finsupp.finsetSum_apply] + apply F.sum_mem + intro s _ + have he : monomial s (p.coeff s) = p.coeff s • monomial s (1 : L) := by rw [smul_monomial,smul_eq_mul,mul_one] + rw [he,map_smul,map_smul,Finsupp.smul_apply,smul_eq_mul] + exact F.mul_mem (hp s) (hmon s i) + +theorem add_vanishing_polynomial {ι : Type*} [Fintype ι] + (F : IntermediateField K L) (n B : ℕ) (hF : Algebra.trdeg K F ≤ (n : Cardinal)) + (q : MvPolynomial (Fin 2) L →ₐ[L] R) (c : Basis ι L R) + (hmon : ∀ s i, c.repr (q (monomial s (1 : L))) i ∈ F) + (p t : MvPolynomial (Fin 2) L) (ht : InField F t) + (hhigh : ∀ s, B ≤ s.degree → p.coeff s = t.coeff s) (hpq : q p = 0) : + ∃ E : IntermediateField K L, F ≤ E ∧ InField E p ∧ + Algebra.trdeg K E ≤ (n + (Fintype.card (Index B) - finrank L (filtered q B)) : ℕ) := by + classical + have he := remainder_expansion p t hhigh + have hsum : ∑ s : Index B, (p-t).coeff s.val • q (monomial s.val 1) = -q t := by + have hh := congrArg q he + rw [hpq,map_add,map_sum] at hh + simp only [map_smul] at hh + exact eq_neg_of_add_eq_zero_left (by simpa only [add_comm] using hh.symm) + obtain ⟨E,hFE,hxE,hE⟩ := LinearParameters.add_constrained_parameters F n hF c + (fun s : Index B => q (monomial s.val 1)) (fun s => (p-t).coeff s.val) + (fun s i => hmon s.val i) (by + intro i + rw [hsum,map_neg] + exact F.neg_mem (repr_polynomial_mem F q c hmon t ht i)) + refine ⟨E,hFE,?_,?_⟩ + · intro s + by_cases hs : s.degree < B + · have hh := hxE ⟨s,hs⟩ + rw [coeff_sub] at hh + have ht' := hFE (ht s) + simpa only [sub_add_cancel] using E.add_mem hh ht' + · rw [hhigh s (by omega)] + exact hFE (ht s) + · rwa [span_low] at hE + +end PermanentBorder.CurveFamily + +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert +universe u +variable {K L R : Type u} [Field K] [Field L] [Algebra K L] + [CommRing R] [Algebra L R] + +lemma adjoin_polynomial (F : IntermediateField K L) (n B : ℕ) + (hF : Algebra.trdeg K F ≤ (n : Cardinal)) (p : MvPolynomial (Fin 2) L) + (hhigh : ∀ s, B ≤ s.degree → p.coeff s ∈ F) : + ∃ E : IntermediateField K L, F ≤ E ∧ InField E p ∧ + Algebra.trdeg K E ≤ (n + Fintype.card (Index B) : ℕ) := by + obtain ⟨E,hFE,hc,hE⟩ := SliceParameters.add_parameters F n hF + (fun s : Index B => p.coeff s.val) + exact ⟨E,hFE,inField_of_high (fun s hs => hFE (hhigh s hs)) hc,hE⟩ + +lemma monomial_plane (s : Fin 2 →₀ ℕ) : + (monomial s 1 : MvPolynomial (Fin 2) L) = X 0 ^ s 0 * X 1 ^ s 1 := by + rw [monomial_eq,C_1,one_mul,Finsupp.prod_fintype _ _ (by simp)] + simp only [Fin.prod_univ_two] + +theorem extend_by_quotient [Infinite K] [IsAlgClosed L] [Module.Finite L R] + (F : IntermediateField K L) (n : ℕ) (hF : Algebra.trdeg K F ≤ (n : Cardinal)) + (p : MvPolynomial (Fin 2) L) (hp : p ≠ 0) (hpF : InField F p) + (q : MvPolynomial (Fin 2) L →ₐ[L] R) (hq : Function.Surjective q) (hpq : q p = 0) + (c : Basis (Fin (finrank L R)) L R) (a b : Fin (finrank L R) → ℕ) + (hc : ∀ i, c i=q (X 0 ^ a i * X 1 ^ b i)) : + ∃ E : IntermediateField K L, F ≤ E ∧ + (∀ s i, c.repr (q (monomial s (1 : L))) i ∈ E) ∧ + Algebra.trdeg K E ≤ (n + finrank L R : ℕ) := by + obtain ⟨p₀,hp₀⟩ := inField_lift F hpF + have hp0 : p₀ ≠ 0 := by intro hz; apply hp; rw [← hp₀,hz,map_zero] + let : Infinite F := Infinite.of_injective (algebraMap K F) (algebraMap K F).injective + obtain ⟨E,hE,hA,hB,hv⟩ := CurveQuotientParameters.chart_field_bound p₀ hp0 q hq + (by change q (p₀.map F.val.toRingHom)=0; rw [hp₀,hpq]) c a b hc + let : FaithfulSMul F E := (faithfulSMul_iff_algebraMap_injective F E).mpr + (algebraMap F E).injective + let : IsScalarTower K F E := IsScalarTower.of_algebraMap_eq fun _ => rfl + refine ⟨E.restrictScalars K,?_,?_,?_⟩ + · intro x hx + exact E.algebraMap_mem ⟨x,hx⟩ + · intro s i + rw [monomial_plane] + exact FinitePlaneFrames.monomial_coordinates_mem E q c hA hB hv (s 0) (s 1) i + · change Algebra.trdeg K E ≤ _ + rw [← trdeg_add_eq K F] + exact (add_le_add hF hE).trans_eq (by simp) + +end PermanentBorder.CurveFamily + +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert +universe u +variable {K L R : Type u} [Field K] [Field L] [Algebra K L] + [CommRing R] [Algebra L R] + +lemma filtered_rank_le (q : MvPolynomial (Fin 2) L →ₐ[L] R) (B : ℕ) : + finrank L (filtered q B) ≤ Fintype.card (Index B) := by + rw [← span_low] + exact finrank_range_le_card _ + +lemma inField_map (F : IntermediateField K L) (p : MvPolynomial (Fin 2) K) : + InField F (p.map (algebraMap K L)) := by + intro s + rw [coeff_map] + exact F.algebraMap_mem _ + +lemma inField_mono {F E : IntermediateField K L} (hFE : F ≤ E) + {p : MvPolynomial (Fin 2) L} (hp : InField F p) : InField E p := fun s => hFE (hp s) + +theorem add_vanishing_family {ι κ : Type*} [Fintype ι] [Fintype κ] + (F : IntermediateField K L) (n : ℕ) (hF : Algebra.trdeg K F ≤ (n : Cardinal)) + (q : MvPolynomial (Fin 2) L →ₐ[L] R) (c : Basis ι L R) + (hmon : ∀ s i, c.repr (q (monomial s (1 : L))) i ∈ F) + (B : κ → ℕ) (p : κ → MvPolynomial (Fin 2) L) (t : κ → MvPolynomial (Fin 2) K) + (hhigh : ∀ i s, B i ≤ s.degree → (p i).coeff s = algebraMap K L ((t i).coeff s)) + (hpq : ∀ i, q (p i) = 0) (U : Finset κ) : + ∃ E : IntermediateField K L, F ≤ E ∧ (∀ i ∈ U, InField E (p i)) ∧ + Algebra.trdeg K E ≤ (n + ∑ i ∈ U, (Fintype.card (Index (B i)) - finrank L (filtered q (B i))) : ℕ) := by + classical + induction U using Finset.induction_on with + | empty => exact ⟨F,le_rfl,by simp,by simpa using hF⟩ + | @insert i U hi ih => + obtain ⟨E,hFE,hpE,hE⟩ := ih + obtain ⟨D,hED,hpD,hD⟩ := add_vanishing_polynomial E _ (B i) hE q c + (fun s j => hFE (hmon s j)) (p i) ((t i).map (algebraMap K L)) (inField_map E _) + (by intro s hs; rw [coeff_map]; exact hhigh i s hs) (hpq i) + refine ⟨D,hFE.trans hED,?_,?_⟩ + · intro j hj + rcases Finset.mem_insert.mp hj with rfl|hj + · exact hpD + · exact inField_mono hED (hpE j hj) + · simpa only [Finset.sum_insert hi,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using hD + +theorem four_polynomial_bound [Infinite K] [IsAlgClosed L] [Module.Finite L R] + (q : MvPolynomial (Fin 2) L →ₐ[L] R) (hq : Function.Surjective q) + (B₀ : ℕ) (B : Fin 3 → ℕ) + (p₀ : MvPolynomial (Fin 2) L) (p : Fin 3 → MvPolynomial (Fin 2) L) + (t₀ : MvPolynomial (Fin 2) K) (t : Fin 3 → MvPolynomial (Fin 2) K) + (hp₀ : p₀ ≠ 0) (h₀ : ∀ s, B₀ ≤ s.degree → p₀.coeff s=algebraMap K L (t₀.coeff s)) + (h : ∀ i s, B i ≤ s.degree → (p i).coeff s=algebraMap K L ((t i).coeff s)) + (hq₀ : q p₀=0) (hqp : ∀ i, q (p i)=0) + (hrank : ∀ i, finrank L R ≤ 2*finrank L (filtered q (B i))) : + ∃ (E : IntermediateField K L) (n : ℕ), InField E p₀ ∧ (∀ i, InField E (p i)) ∧ + Algebra.trdeg K E ≤ (n : Cardinal) ∧ + 2*n + finrank L R ≤ 2*(Fintype.card (Index B₀) + ∑ i, Fintype.card (Index (B i))) := by + classical + have hbot : Algebra.trdeg K (⊥ : IntermediateField K L) ≤ (0 : Cardinal) := by rw [trdeg_eq_zero] + obtain ⟨F,_,hpF,hF⟩ := adjoin_polynomial (⊥ : IntermediateField K L) 0 B₀ hbot p₀ + (by intro s hs; rw [h₀ s hs]; exact IntermediateField.algebraMap_mem _ _) + obtain ⟨c,a,b,hc⟩ := FinitePlaneFrames.exists_monomial_basis q hq + obtain ⟨D,hFD,hmon,hD⟩ := extend_by_quotient F _ hF p₀ hp₀ hpF q hq hq₀ c a b hc + obtain ⟨E,hDE,hpE,hE⟩ := add_vanishing_family D _ hD q c hmon B p t h hqp Finset.univ + refine ⟨E,_,inField_mono (hFD.trans hDE) hpF,(fun i => hpE i (Finset.mem_univ i)),hE,?_⟩ + let N := fun i => Fintype.card (Index (B i)) + let r := fun i => finrank L (filtered q (B i)) + have hle (i) : r i ≤ N i := filtered_rank_le q (B i) + have he : ∑ i, (N i-r i) + ∑ i, r i = ∑ i, N i := by + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + exact Nat.sub_add_cancel (hle i) + have hh : 3*finrank L R ≤ 2*∑ i, r i := by + have hs := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hrank i) + simpa only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,smul_eq_mul,← Finset.mul_sum] using hs + change 2*(0+Fintype.card (Index B₀)+finrank L R+∑ i, (N i-r i))+finrank L R ≤ 2*(Fintype.card (Index B₀)+∑ i, N i) + omega + +end PermanentBorder.CurveFamily + +namespace PermanentBorder.FrobeniusPlane +variable {K L : Type*} [Field K] [Field L] [Algebra K L] [CharP L 2] + +lemma derivation_square {M : Type*} [AddCommGroup M] [Module K M] + [Module L M] [IsScalarTower K L M] (D : Derivation K L M) (a : L) : + D (a^2) = 0 := by + rw [D.leibniz_pow,← Nat.cast_smul_eq_nsmul L] + simp only [CharP.cast_eq_zero L 2,zero_smul] + +omit [CharP L 2] in +lemma derivation_zero_of_field_generators {M : Type*} [AddCommGroup M] [Module K M] + [Module L M] [IsScalarTower K L M] (D : Derivation K L M) + (s : Set L) (hs : IntermediateField.adjoin K s = ⊤) (hD : ∀ x ∈ s, D x = 0) : D = 0 := by + let F : IntermediateField K L := + { carrier := {x | D x = 0} + zero_mem' := map_zero D + one_mem' := D.map_one_eq_zero + add_mem' := by + intro x y hx hy + change D x = 0 at hx + change D y = 0 at hy + change D (x+y) = 0 + rw [map_add,hx,hy,add_zero] + mul_mem' := by + intro x y hx hy + change D x = 0 at hx + change D y = 0 at hy + change D (x*y) = 0 + rw [D.leibniz,hx,hy,smul_zero,smul_zero,add_zero] + inv_mem' := by + intro x hx + change D x = 0 at hx + change D x⁻¹ = 0 + rw [D.leibniz_inv,hx,smul_zero] + algebraMap_mem' := fun r => D.map_algebraMap r } + have hF : IntermediateField.adjoin K s ≤ F := IntermediateField.adjoin_le_iff.mpr hD + rw [hs] at hF + ext x + exact hF (show x ∈ (⊤ : IntermediateField K L) from trivial) + +theorem finite_of_square_coordinate_equations (x : Fin 2 → L) + (hgen : IntermediateField.adjoin K (Set.range x) = ⊤) + (b c d : L) (hd : d ≠ 0) + (hb : b^2+x 1*d^2=0) (hc : c^2+x 0*d^2=0) : Module.Finite K L := by + classical + let D := KaehlerDifferential.D K L + have hx (i : Fin 2) : D (x i) = 0 := by + have h (v a : L) (he : a^2+v*d^2=0) : D v = 0 := by + have hh := congrArg D he + simp only [map_add,D.leibniz,derivation_square,smul_zero,zero_add,map_zero] at hh + exact (smul_eq_zero.mp hh).resolve_left (pow_ne_zero 2 hd) + fin_cases i + · exact h _ _ hc + · exact h _ _ hb + have hD : D = 0 := derivation_zero_of_field_generators D _ hgen (by + rintro _ ⟨i,rfl⟩; exact hx i) + have hbot : (⊤ : Submodule L (KaehlerDifferential K L)) ≤ ⊥ := by + rw [← KaehlerDifferential.span_range_derivation,Submodule.span_le] + rintro _ ⟨a,rfl⟩ + change D a = 0 + rw [hD]; rfl + let : Algebra.FormallyUnramified K L := ⟨(subsingleton_iff_forall_eq 0).mpr (fun a => hbot trivial)⟩ + let : Algebra.EssFiniteType K L := IntermediateField.fg_top_iff.mp + ⟨Finset.univ.image x,by simpa using hgen⟩ + exact Algebra.FormallyUnramified.finite_of_free K L +end PermanentBorder.FrobeniusPlane +namespace PermanentBorder.FrobeniusPlane +open MvPolynomial +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [CharP L 2] + +theorem node_coordinates_algebraic (x : Fin 2 → L) + (b c d : MvPolynomial (Fin 2) K) (hd : aeval x d ≠ 0) + (hb : (aeval x b)^2+x 1*(aeval x d)^2=0) + (hc : (aeval x c)^2+x 0*(aeval x d)^2=0) : ∀ i, IsAlgebraic K (x i) := by + let E := IntermediateField.adjoin K (Set.range x) + let y : Fin 2 → E := fun i => ⟨x i,IntermediateField.subset_adjoin K _ (Set.mem_range_self i)⟩ + have hgen : IntermediateField.adjoin K (Set.range y) = ⊤ := by + apply IntermediateField.map_injective E.val + rw [IntermediateField.adjoin_map,← Set.range_comp,← AlgHom.fieldRange_eq_map, + IntermediateField.fieldRange_val] + rfl + let : CharP E 2 := (algebraMap E L).charP (algebraMap E L).injective 2 + have he (p : MvPolynomial (Fin 2) K) : E.val.toRingHom (aeval y p) = aeval x p := by + change E.val (aeval y p) = _ + rw [← AlgHom.comp_apply] + congr 1 + ext i + simp [y] + have hy (i) : E.val.toRingHom (y i) = x i := rfl + let : Module.Finite K E := finite_of_square_coordinate_equations y hgen + (aeval y b) (aeval y c) (aeval y d) (by intro hz; apply hd; rw [← he d,hz,map_zero]) + (by apply E.val.injective; simpa only [map_add,map_mul,map_pow,AlgHom.coe_toRingHom,he,hy,map_zero] using hb) + (by apply E.val.injective; simpa only [map_add,map_mul,map_pow,AlgHom.coe_toRingHom,he,hy,map_zero] using hc) + intro i + exact (IsAlgebraic.of_finite K (y i)).algHom E.val + +end PermanentBorder.FrobeniusPlane + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/HomogeneousPadding.lean b/lean/OAI/Algebra/Determinantal/HomogeneousPadding.lean new file mode 100644 index 0000000000000000000000000000000000000000..f49f7f8b6ed0a497862b0fe5048ec1118560f04c --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/HomogeneousPadding.lean @@ -0,0 +1,401 @@ +import OAI.Algebra.Determinantal.AffineSelectors + +namespace OAI + +namespace PermanentBorder.Selector +open MvPolynomial +variable {A B R : Type*} [Fintype A] [Fintype B] [CommSemiring R] + theorem weight_one_sumElim (d : A →₀ ℕ) (e : B →₀ ℕ) : + Finsupp.weight (1 : A ⊕ B → ℕ) (d.sumElim e) = + Finsupp.weight (1 : A → ℕ) d + Finsupp.weight (1 : B → ℕ) e := by + simp only [Finsupp.weight_eq_sum, Pi.one_apply, smul_eq_mul, mul_one, + Fintype.sum_sum_type, Finsupp.sumElim_inl, Finsupp.sumElim_inr] + + theorem homogeneous_coefficient {p : MvPolynomial (A ⊕ B) R} {r : ℕ} + (hp : p.IsHomogeneous r) (d : A →₀ ℕ) : + ((sumRingEquiv R A B p).coeff d).IsHomogeneous + (r - Finsupp.weight (1 : A → ℕ) d) := by + intro e he + rw [← coeff_nested] at he + have hh := hp he + rw [weight_one_sumElim] at hh + omega + +variable {I : Type*} [Fintype I] [DecidableEq I] +noncomputable def universalHomogeneousPencil (θ : I → R) : + Matrix I I (MvPolynomial (Fin 2 ⊕ (I × I)) R) := + Matrix.of fun i j => X (.inr (i,j)) + + if i=j then X (.inl 0) + C (θ i)*X (.inl 1) else 0 + + theorem universalHomogeneousPencil_permanent (θ : I → R) : + (universalHomogeneousPencil θ).permanent.IsHomogeneous (Fintype.card I) := by + classical + unfold Matrix.permanent + apply IsHomogeneous.sum + intro σ _ + convert IsHomogeneous.prod Finset.univ + (fun i => universalHomogeneousPencil θ (σ i) i) (fun _ => 1) ?_ using 1 <;> try simp + intro i _ + apply IsHomogeneous.add (isHomogeneous_X _ _) + split_ifs + · exact (isHomogeneous_X _ _).add (isHomogeneous_C_mul_X _ _) + · exact isHomogeneous_zero _ _ _ + + theorem coefficientPolynomial_homogeneous (θ : I → R) (q : ℕ) : + (diagonalCoefficient (Matrix.of fun i j => (X (i,j) : MvPolynomial (I × I) R)) + (fun i => C (θ i)) q).IsHomogeneous (Fintype.card I - 2*q) := by + classical + have hm : sumRingEquiv R (Fin 2) (I × I) (universalHomogeneousPencil θ).permanent = + ((Matrix.of fun i j => C (X (i,j))) + + Matrix.diagonal (fun i => X (0 : Fin 2) + C (C (θ i))*X 1)).permanent := by + unfold Matrix.permanent + simp only [map_sum, map_prod] + apply Finset.sum_congr rfl + intro σ _ + apply Finset.prod_congr rfl + intro i _ + by_cases hi : σ i = i + · simp [universalHomogeneousPencil, hi] + · simp [universalHomogeneousPencil, hi] + have hw : Finsupp.weight (1 : Fin 2 → ℕ) (countIndex q) = 2*q := by + simp [Finsupp.weight_apply, Finsupp.sum_fintype, countIndex] + have h := homogeneous_coefficient (universalHomogeneousPencil_permanent θ) (countIndex q) + rw [hm, hw] at h + exact h +end PermanentBorder.Selector + +namespace PermanentBorder.HomogeneousPadding +open MvPolynomial +variable {σ τ R : Type*} [Fintype σ] [CommRing R] + +noncomputable def dehomogenize : MvPolynomial (Option σ) R →+* MvPolynomial σ R := + (Polynomial.evalRingHom 1).comp (optionEquivLeft R σ).toRingHom + + theorem weight_optionElim (d : σ →₀ ℕ) (i : ℕ) : + Finsupp.weight (1 : Option σ → ℕ) (d.optionElim i) = + i + Finsupp.weight (1 : σ → ℕ) d := by + simp only [Finsupp.weight_eq_sum, Pi.one_apply, smul_eq_mul, mul_one, + Fintype.sum_option, Finsupp.optionElim_apply_none, Finsupp.optionElim_apply_some] + + theorem weight_some (d : Option σ →₀ ℕ) : + Finsupp.weight (1 : Option σ → ℕ) d = + d none + Finsupp.weight (1 : σ → ℕ) d.some := by + convert weight_optionElim d.some (d none) using 1; simp + + theorem dehomogenize_coeff_of_homogeneous {p : MvPolynomial (Option σ) R} {m : ℕ} + (hp : p.IsHomogeneous m) (d : Option σ →₀ ℕ) + (hd : Finsupp.weight (1 : Option σ → ℕ) d = m) : + (dehomogenize p).coeff d.some = p.coeff d := by + classical + change (((optionEquivLeft R σ p).eval 1)).coeff d.some = _ + simp only [Polynomial.eval_eq_sum, Polynomial.sum, one_pow, mul_one, coeff_sum] + rw [← optionEquivLeft_coeff_some_coeff_none R σ d p] + apply Finset.sum_eq_single (d none) + · intro i hi hne + rw [optionEquivLeft_coeff_coeff] + apply IsWeightedHomogeneous.coeff_eq_zero hp + rw [weight_optionElim] + rw [weight_some] at hd + omega + · intro hn + have hh := Polynomial.notMem_support_iff.mp hn + rw [hh, AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply] + + theorem homogeneous_eq_of_dehomogenize_eq {p q : MvPolynomial (Option σ) R} {m : ℕ} + (hp : p.IsHomogeneous m) (hq : q.IsHomogeneous m) + (h : dehomogenize p = dehomogenize q) : p=q := by + apply sub_eq_zero.mp + have hsub := hp.sub hq + have hzero : dehomogenize (p-q) = 0 := by rw [map_sub,h,sub_self] + ext d + by_cases hd : Finsupp.weight (1 : Option σ → ℕ) d = m + · have hc := dehomogenize_coeff_of_homogeneous hsub d hd + rw [hzero, AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply] at hc + exact hc.symm + · exact IsWeightedHomogeneous.coeff_eq_zero hsub d hd + +omit [Fintype σ] in +@[simp] theorem dehomogenize_C (r : R) : dehomogenize (C r : MvPolynomial (Option σ) R) = C r := by + simp [dehomogenize] +omit [Fintype σ] in +@[simp] theorem dehomogenize_none : dehomogenize (X (none : Option σ) : MvPolynomial (Option σ) R) = 1 := by + simp [dehomogenize] +omit [Fintype σ] in +@[simp] theorem dehomogenize_some (i : σ) : dehomogenize (X (some i) : MvPolynomial (Option σ) R) = X i := by + simp [dehomogenize] +omit [Fintype σ] in +@[simp] theorem dehomogenize_rename (p : MvPolynomial σ R) : + dehomogenize (rename some p) = p := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp [hp,hq] + | mul_X p i hp => simp [hp] + +variable [Fintype τ] +noncomputable def affineSubstitution (b : σ → R) (B : σ → τ → R) : + MvPolynomial σ R →+* MvPolynomial τ R := + eval₂Hom C (fun i => C (b i) + ∑ j, C (B i j)*X j) +noncomputable def homogeneousSubstitution (b : σ → R) (B : σ → τ → R) : + MvPolynomial σ R →+* MvPolynomial (Option τ) R := + eval₂Hom C (fun i => C (b i)*X none + ∑ j, C (B i j)*X (some j)) + +omit [Fintype σ] in + theorem dehomogenize_homogeneousSubstitution (b : σ → R) (B : σ → τ → R) + (p : MvPolynomial σ R) : + dehomogenize (homogeneousSubstitution b B p) = affineSubstitution b B p := by + have he : (dehomogenize (σ := τ) (R := R)).comp (homogeneousSubstitution b B) = + affineSubstitution b B := by + apply MvPolynomial.ringHom_ext + · intro r + simp only [RingHom.comp_apply, homogeneousSubstitution, affineSubstitution, + eval₂Hom_C, dehomogenize_C] + · intro i + simp only [RingHom.comp_apply, homogeneousSubstitution, affineSubstitution, + eval₂Hom_X', map_add, map_mul, map_sum, dehomogenize_C, + dehomogenize_none, dehomogenize_some, mul_one] + exact RingHom.congr_fun he p + +omit [Fintype σ] in + + theorem independent_padding {p : MvPolynomial σ R} {g : MvPolynomial τ R} + {m r : ℕ} (hp : p.IsHomogeneous m) (hg : g.IsHomogeneous r) (hrm : r ≤ m) + (b : σ → R) (B : σ → τ → R) (h : affineSubstitution b B p = g) : + homogeneousSubstitution b B p = (X none)^(m-r) * rename some g := by + apply homogeneous_eq_of_dehomogenize_eq (m := m) + · change (eval₂ C _ p).IsHomogeneous m + convert hp.eval₂ C _ (fun a => isHomogeneous_C _ a) (fun i => + (isHomogeneous_C_mul_X (b i) none).add + (IsHomogeneous.sum Finset.univ _ 1 (fun j _ => isHomogeneous_C_mul_X (B i j) (some j)))) using 1; simp + · have hg' := (isHomogeneous_X_pow (none : Option τ) (m-r)).mul (hg.rename_isHomogeneous (f := some)) + simpa only [Nat.sub_add_cancel hrm] using hg' + · simp [dehomogenize_homogeneousSubstitution,h] +end PermanentBorder.HomogeneousPadding + +namespace PermanentBorder +open MvPolynomial + + theorem permanentPolynomial_homogeneous (m : ℕ) : + (permanentPolynomial m).IsHomogeneous m := by + classical + unfold permanentPolynomial + apply IsHomogeneous.sum + intro τ _ + convert IsHomogeneous.prod Finset.univ + (fun i : Fin m => (X (i,τ i) : Poly (Variables m))) (fun _ => 1) + (fun i _ => isHomogeneous_X _ _) using 1; simp + + theorem coefficientPolynomial_homogeneous (k q : ℕ) (θ : Fin k → ℂ) : + (coefficientPolynomial k q θ).IsHomogeneous (k-2*q) := by + simpa only [coefficientPolynomial,Fintype.card_fin] using + Selector.coefficientPolynomial_homogeneous θ q + + theorem exists_selector_projection_homogeneous (k q m : ℕ) + (hk : 1 ≤ k) (hq : q ≤ k/2) (hm : 11*k-2*q ≤ m) (θ : Fin k → ℂ) : + ∃ (b : Variables m → ℂ) (B : Variables m → Variables k → ℂ), + affineSubstitution b B (permanentPolynomial m) = + selectorScalar k q • coefficientPolynomial k q θ ∧ + HomogeneousPadding.homogeneousSubstitution b B (permanentPolynomial m) = + selectorScalar k q • ((X (none : Option (Variables k)))^(m-(k-2*q)) * + rename some (coefficientPolynomial k q θ)) := by + have hqk : q ≤ k := hq.trans (Nat.div_le_self ..) + obtain ⟨b,B,h⟩ := exists_selector_affine_projection k q m hqk hm θ + refine ⟨b,B,h,?_⟩ + have hg : (selectorScalar k q • coefficientPolynomial k q θ).IsHomogeneous (k-2*q) := by + rw [smul_eq_C_mul] + simpa only [zero_add] using + (isHomogeneous_C (Variables k) (selectorScalar k q)).mul + (coefficientPolynomial_homogeneous k q θ) + have h' : HomogeneousPadding.affineSubstitution b B (permanentPolynomial m) = + selectorScalar k q • coefficientPolynomial k q θ := h + have hh := HomogeneousPadding.independent_padding (permanentPolynomial_homogeneous m) + hg (by omega : k-2*q ≤ m) b B h' + rw [hh,smul_eq_C_mul,map_mul,rename_C] + simp only [smul_eq_C_mul] + ring +end PermanentBorder +namespace PermanentBorder.Selector +open MvPolynomial + +lemma diagonalCoefficient_map {I R S : Type*} [Fintype I] [DecidableEq I] + [CommSemiring R] [CommSemiring S] (φ : R →+* S) + (M : Matrix I I R) (θ : I → R) (q : ℕ) : + φ (diagonalCoefficient M θ q) = + diagonalCoefficient (fun i j => φ (M i j)) (fun i => φ (θ i)) q := by + classical + unfold diagonalCoefficient + rw [← coeff_map] + apply congrArg (fun polynomial : MvPolynomial (Fin 2) S => polynomial.coeff (countIndex q)) + unfold Matrix.permanent + simp only [map_sum,map_prod] + apply Finset.sum_congr rfl + intro π _ + apply Finset.prod_congr rfl + intro i _ + simp only [Matrix.add_apply, Matrix.of_apply,Matrix.diagonal_apply,map_add,map_C] + split_ifs <;> simp + +noncomputable def integralCoefficientFamily (k q : ℕ) : + MvPolynomial (Variables k) (MvPolynomial (Fin k) ℤ) := + diagonalCoefficient (Matrix.of fun i j => X (i,j)) (fun i => C (X i)) q + +lemma integralCoefficientFamily_homogeneous (k q : ℕ) : + (integralCoefficientFamily k q).IsHomogeneous (k-2*q) := by + simpa only [integralCoefficientFamily,Fintype.card_fin] using + coefficientPolynomial_homogeneous (fun i : Fin k => (X i : MvPolynomial (Fin k) ℤ)) q + +lemma integralCoefficientFamily_specialize {K : Type*} [CommRing K] + (k q : ℕ) (θ : Fin k → K) : + map (eval₂Hom (Int.castRingHom K) θ) (integralCoefficientFamily k q) = + diagonalCoefficient (Matrix.of fun i j => (X (i,j) : MvPolynomial (Variables k) K)) + (fun i => C (θ i)) q := by + unfold integralCoefficientFamily + rw [diagonalCoefficient_map] + simp only [Matrix.of_apply,map_X,map_C,eval₂Hom_X'] + rfl + +lemma integralCoefficientFamily_complex (k q : ℕ) (θ : Fin k → ℂ) : + map (eval₂Hom (Int.castRingHom ℂ) θ) (integralCoefficientFamily k q) = + coefficientPolynomial k q θ := by + exact integralCoefficientFamily_specialize k q θ +end PermanentBorder.Selector + +namespace PermanentBorder.AlgebraicDimension + +open Order + +theorem krullDim_le_of_injective_integral {R S : Type*} [CommRing R] [CommRing S] + (f : R →+* S) (hf : Function.Injective f) (hi : f.IsIntegral) : + ringKrullDim R ≤ ringKrullDim S := by + let : Algebra R S := f.toAlgebra + let : Algebra.IsIntegral R S := ⟨hi⟩ + change (⨆ l : LTSeries (PrimeSpectrum R), (l.length : WithBot ℕ∞)) ≤ _ + apply iSup_le + intro l + have h0 : (⊥ : Ideal S).comap (algebraMap R S) ≤ l.head.asIdeal := by + rw [← RingHom.ker_eq_comap_bot] + change RingHom.ker f ≤ _ + rw [(RingHom.injective_iff_ker_eq_bot f).mp hf] + exact bot_le + obtain ⟨P, _, hP, hPc⟩ := Ideal.exists_ideal_over_prime_of_isIntegral + l.head.asIdeal (⊥ : Ideal S) h0 + let : P.IsPrime := hP + let : P.LiesOver l.head.asIdeal := ⟨hPc.symm⟩ + obtain ⟨L, hlen, _, _⟩ := Ideal.exists_ltSeries_of_hasGoingUp l P + exact le_krullDim_iff.mpr ⟨L, hlen⟩ + +universe u + +theorem trdeg_le_of_krullDim_le {K A : Type u} [Field K] [CommRing A] [IsDomain A] + [Algebra K A] [Algebra.FiniteType K A] (n : ℕ) (h : ringKrullDim A ≤ n) : + Algebra.trdeg K A ≤ (n : Cardinal) := by + obtain ⟨s, g, hg, hint⟩ := exists_integral_inj_algHom_of_fg K A + let R := MvPolynomial (Fin s) K + let : Algebra R A := g.toRingHom.toAlgebra + let : IsScalarTower K R A := IsScalarTower.of_algebraMap_eq fun k => (g.commutes k).symm + let : Algebra.IsIntegral R A := ⟨hint⟩ + have hs : s ≤ n := by + have hd := (krullDim_le_of_injective_integral g.toRingHom hg hint).trans h + simpa using hd + let : FaithfulSMul R A := (faithfulSMul_iff_algebraMap_injective R A).mpr hg + have ht : Algebra.trdeg K A = s := by + rw [← trdeg_add_eq K R (A := A), trdeg_eq_zero (R := R), add_zero] + simp [R] + rw [ht] + exact_mod_cast hs + +theorem field_image_trdeg_le {K A L : Type u} [Field K] [CommRing A] + [Field L] [Algebra K A] [Algebra K L] [Algebra.FiniteType K A] + (n : ℕ) (h : ringKrullDim A ≤ n) (f : A →ₐ[K] L) : + Algebra.trdeg K f.range ≤ (n : Cardinal) := by + let : Algebra.FiniteType K f.range := Algebra.FiniteType.of_surjective + f.rangeRestrict f.rangeRestrict_surjective + have hd : ringKrullDim f.range ≤ ringKrullDim A := + ringKrullDim_le_of_surjective f.rangeRestrict.toRingHom f.rangeRestrict_surjective + exact trdeg_le_of_krullDim_le n (hd.trans h) + +open scoped IntermediateField.algebraAdjoinAdjoin in + +theorem point_field_trdeg_le {K L : Type u} [Field K] [Field L] [Algebra K L] + {v : ℕ} (I : Ideal (MvPolynomial (Fin v) K)) (n : ℕ) + (h : ringKrullDim (MvPolynomial (Fin v) K ⧸ I) ≤ n) + (x : Fin v → L) (hx : ∀ p ∈ I, MvPolynomial.aeval x p = 0) : + Algebra.trdeg K (IntermediateField.adjoin K (Set.range x)) ≤ (n : Cardinal) := by + let f := Ideal.Quotient.liftₐ I (MvPolynomial.aeval x) hx + have hr : f.range = Algebra.adjoin K (Set.range x) := by + rw [← MvPolynomial.aeval_range] + ext y + constructor + · rintro ⟨z, rfl⟩ + obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective z + exact ⟨p, rfl⟩ + · rintro ⟨p, rfl⟩ + exact ⟨Ideal.Quotient.mk I p, rfl⟩ + have ht := field_image_trdeg_le n h f + rw [hr] at ht + rw [← trdeg_add_eq K (Algebra.adjoin K (Set.range x)), + trdeg_eq_zero (R := Algebra.adjoin K (Set.range x)), add_zero] + exact ht + +end PermanentBorder.AlgebraicDimension + +namespace PermanentBorder.SliceParameters + +universe u +open MvPolynomial + +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +open scoped IntermediateField.algebraAdjoinAdjoin in +lemma field_adjoin_trdeg_le {κ : Type*} [Fintype κ] (x : κ → L) : + Algebra.trdeg K (IntermediateField.adjoin K (Set.range x)) ≤ + (Fintype.card κ : Cardinal) := by + let A := Algebra.adjoin K (Set.range x) + let y : κ → A := fun i => ⟨x i, Algebra.subset_adjoin (Set.mem_range_self i)⟩ + have htop : Algebra.adjoin K (Set.range y) = ⊤ := by + apply Subalgebra.map_injective (show Function.Injective A.val from Subtype.val_injective) + rw [AlgHom.map_adjoin, Algebra.map_top, A.range_val, ← Set.range_comp] + rfl + let : Algebra.IsAlgebraic (Algebra.adjoin K (Set.range y)) A := by + constructor + intro a + have ha : a ∈ Algebra.adjoin K (Set.range y) := by rw [htop]; trivial + exact isAlgebraic_algebraMap (R := Algebra.adjoin K (Set.range y)) ⟨a, ha⟩ + have hA : Algebra.trdeg K A ≤ (Fintype.card κ : Cardinal) := by + calc + Algebra.trdeg K A ≤ Cardinal.mk (Set.range y) := + Algebra.IsAlgebraic.trdeg_le_cardinalMk K (Set.range y) + _ ≤ Fintype.card κ := by + simpa using (Cardinal.mk_range_le_lift (f := y)) + rw [← trdeg_add_eq K A, trdeg_eq_zero (R := A), add_zero] + exact hA + +lemma add_parameters {κ : Type*} [Fintype κ] (F : IntermediateField K L) + (n : ℕ) (hF : Algebra.trdeg K F ≤ (n : Cardinal)) (z : κ → L) : + ∃ E : IntermediateField K L, + F ≤ E ∧ (∀ i, z i ∈ E) ∧ + Algebra.trdeg K E ≤ (n + Fintype.card κ : ℕ) := by + let E := IntermediateField.adjoin F (Set.range z) + let : FaithfulSMul F E := (faithfulSMul_iff_algebraMap_injective F E).mpr + (algebraMap F E).injective + let : IsScalarTower K F E := IsScalarTower.of_algebraMap_eq fun _ => rfl + refine ⟨E.restrictScalars K, ?_, ?_, ?_⟩ + · intro x hx + exact E.algebraMap_mem ⟨x, hx⟩ + · intro i + exact IntermediateField.subset_adjoin F _ (Set.mem_range_self i) + · change Algebra.trdeg K E ≤ _ + rw [← trdeg_add_eq K F] + exact (add_le_add hF (field_adjoin_trdeg_le (K := F) z)).trans_eq (by simp) + +lemma independent_card_le {κ : Type*} [Fintype κ] (H : κ → L) + (hH : AlgebraicIndependent K H) (F : IntermediateField K L) + (hF : ∀ i, H i ∈ F) (n : ℕ) (ht : Algebra.trdeg K F ≤ (n : Cardinal)) : + Fintype.card κ ≤ n := by + let x : κ → F := fun i => ⟨H i, hF i⟩ + have hx : AlgebraicIndependent K x := hH.of_comp F.val + have hc := hx.lift_cardinalMk_le_trdeg.trans (Cardinal.lift_le.mpr ht) + simpa using hc + +end PermanentBorder.SliceParameters + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/InitialForm.lean b/lean/OAI/Algebra/Determinantal/InitialForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..a17d2687a4fc11ea1a470e2c2a390e2977642f48 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/InitialForm.lean @@ -0,0 +1,159 @@ +import OAI.Algebra.Determinantal.BorderClosure +import OAI.Algebra.Determinantal.BorderPolars + +namespace OAI + +namespace PermanentBorder +open MvPolynomial Filter +open scoped Topology + +namespace InitialHomogeneous +variable {σ : Type*} [Fintype σ] + +noncomputable def dilation (t : ℂ) : Poly σ →ₐ[ℂ] Poly σ := by + classical + exact affineSubstitution (fun _ => 0) (fun i j => if i = j then t else 0) + +lemma dilation_eq_aeval (t : ℂ) : + dilation (σ := σ) t = aeval (fun i => C t * X i) := by + classical + unfold dilation affineSubstitution + congr 1 + funext i + simp [apply_ite] + +lemma dilation_monomial (t : ℂ) (e : σ →₀ ℕ) (c : ℂ) : + dilation t (monomial e c) = t ^ e.degree • monomial e c := by + rw [dilation_eq_aeval] + have h := SliceParameters.homogeneous_aeval_scale + (isHomogeneous_monomial c (n := e.degree) rfl) (C t) (fun i : σ => X i) + simpa only [aeval_X_left_apply, ← map_pow, smul_eq_C_mul] using h + +lemma coeff_dilation (t : ℂ) (q : Poly σ) (e : σ →₀ ℕ) : + (dilation t q).coeff e = t ^ e.degree * q.coeff e := by + classical + induction q using MvPolynomial.induction_on' with + | monomial s c => + rw [dilation_monomial, coeff_smul] + by_cases h : s = e + · subst s; rfl + · simp [coeff_monomial, h] + | add p q hp hq => + simp only [map_add, AddMonoidAlgebra.coeff_add, Finsupp.add_apply, hp, hq, mul_add] + +noncomputable def normalizedDilation (r : ℕ) (q : Poly σ) (t : ℂ) : Poly σ := + (t ^ r)⁻¹ • dilation t q + +omit [Fintype σ] in +lemma coeff_eq_zero_of_lower_components {q : Poly σ} {r : ℕ} + (hlow : ∀ j < r, homogeneousComponent j q = 0) + (e : σ →₀ ℕ) (he : e.degree < r) : q.coeff e = 0 := by + have h := congrArg (fun p : Poly σ => p.coeff e) (hlow e.degree he) + simpa [coeff_homogeneousComponent] using h + +lemma coeff_normalizedDilation {q : Poly σ} {r : ℕ} + (hlow : ∀ j < r, homogeneousComponent j q = 0) + {t : ℂ} (ht : t ≠ 0) (e : σ →₀ ℕ) : + (normalizedDilation r q t).coeff e = + if e.degree < r then 0 else t ^ (e.degree - r) * q.coeff e := by + simp only [normalizedDilation, coeff_smul, smul_eq_mul, coeff_dilation] + by_cases he : e.degree < r + · simp [he, coeff_eq_zero_of_lower_components hlow e he] + · rw [ite_eq_right he] + obtain ⟨k, hk⟩ := Nat.exists_eq_add_of_le (Nat.le_of_not_gt he) + rw [hk, Nat.add_sub_cancel_left, pow_add] + rw [← mul_assoc, ← mul_assoc, inv_mul_cancel₀ (pow_ne_zero r ht), one_mul] + +/-- Cancellation of the pole gives coefficientwise convergence along any filter +approaching zero through nonzero complex values. -/ +theorem normalizedDilation_tendsto {α : Type*} {l : Filter α} + {q : Poly σ} {r : ℕ} + (hlow : ∀ j < r, homogeneousComponent j q = 0) + {t : α → ℂ} (ht : Tendsto t l (𝓝 0)) + (hne : ∀ᶠ j in l, t j ≠ 0) (e : σ →₀ ℕ) : + Tendsto (fun j => (normalizedDilation r q (t j)).coeff e) + l (𝓝 ((homogeneousComponent r q).coeff e)) := by + have heq : (fun j => (normalizedDilation r q (t j)).coeff e) =ᶠ[l] + (fun j => if e.degree < r then 0 else t j ^ (e.degree-r) * q.coeff e) := + hne.mono fun j hj => coeff_normalizedDilation hlow hj e + apply Tendsto.congr' heq.symm + rw [coeff_homogeneousComponent] + by_cases hlo : e.degree < r + · simp only [hlo, ite_true, ite_eq_right (Nat.ne_of_lt hlo)] + exact tendsto_const_nhds + · simp only [hlo, ite_false] + by_cases he : e.degree = r + · simp only [he, Nat.sub_self, pow_zero, one_mul, ite_true] + exact tendsto_const_nhds + · have hk : e.degree-r ≠ 0 := by omega + simpa only [ite_eq_right he, zero_pow hk, zero_mul] using + (ht.pow (e.degree-r)).mul_const (q.coeff e) + +/-- Normalized dilation converges coefficientwise as the positive real scale tends to zero. -/ +theorem normalizedDilation_tendsto_positive {q : Poly σ} {r : ℕ} + (hlow : ∀ j < r, homogeneousComponent j q = 0) (e : σ →₀ ℕ) : + Tendsto (fun t : ℝ => (normalizedDilation r q (t : ℂ)).coeff e) + (𝓝[Set.Ioi 0] 0) (𝓝 ((homogeneousComponent r q).coeff e)) := by + apply normalizedDilation_tendsto hlow + · exact (Complex.continuous_ofReal.tendsto 0).mono_left nhdsWithin_le_nhds + · filter_upwards [self_mem_nhdsWithin] with t ht + exact_mod_cast (ne_of_gt ht : t ≠ (0 : ℝ)) + +end InitialHomogeneous + +/-- The lowest homogeneous component inherits the fixed border determinant size +by degeneration along a geometric sequence of nonzero scales. -/ +theorem HasBorderDeterminant.lowest_homogeneousComponent + {σ : Type*} [Fintype σ] {n r : ℕ} {q : Poly σ} + (hb : HasBorderDeterminant n q) + (hlow : ∀ j < r, homogeneousComponent j q = 0) : + HasBorderDeterminant n (homogeneousComponent r q) := by + classical + let t : ℕ → ℂ := fun j => (1 / 2 : ℂ) ^ j + have ht : Tendsto t atTop (𝓝 0) := by + apply tendsto_pow_atTop_nhds_zero_of_norm_lt_one + norm_num + have hne : ∀ j, t j ≠ 0 := fun j => pow_ne_zero j (by norm_num) + apply HasBorderDeterminant.coefficientwise_limit + (P := fun j => InitialHomogeneous.normalizedDilation r q (t j)) + · intro j + exact hb.affineSubstitution_smul (fun _ => 0) + (fun i k => if i = k then t j else 0) ((t j ^ r)⁻¹) + · exact InitialHomogeneous.normalizedDilation_tendsto hlow ht + (Filter.Eventually.of_forall hne) + +/-- A smooth lowest homogeneous term after translation bounds both border and exact +determinant sizes by the product of its degree minus one and dimension minus one, +divided by `4 * Real.exp 1`. -/ +theorem smooth_initial_form_lower_bound (d r : ℕ) (g : Poly (Fin d)) + (a : Fin d → ℂ) (hd : 2 ≤ d) (hr : 2 ≤ r) + (_hG : homogeneousComponent r + (affineSubstitution a (fun i j : Fin d => if i = j then 1 else 0) g) ≠ 0) + (hlow : ∀ j < r, homogeneousComponent j + (affineSubstitution a (fun i j : Fin d => if i = j then 1 else 0) g) = 0) + (hs : ∀ y : Fin d → ℂ, + eval y (homogeneousComponent r + (affineSubstitution a (fun i j : Fin d => if i = j then 1 else 0) g)) = 0 → + (∀ i, eval y (pderiv i (homogeneousComponent r + (affineSubstitution a (fun i j : Fin d => if i = j then 1 else 0) g))) = 0) → + y = 0) : + ∀ n : ℕ, + (HasBorderDeterminant n g → + ((r-1 : ℕ) : ℝ) * ((d-1 : ℕ) : ℝ) / (4*Real.exp 1) ≤ (n : ℝ)) ∧ + (HasExactDeterminant n g → + ((r-1 : ℕ) : ℝ) * ((d-1 : ℕ) : ℝ) / (4*Real.exp 1) ≤ (n : ℝ)) := by + intro n + have hb : HasBorderDeterminant n g → + ((r-1 : ℕ) : ℝ) * ((d-1 : ℕ) : ℝ) / (4*Real.exp 1) ≤ (n : ℝ) := by + intro h + have hq := h.affineSubstitution a + (fun i j : Fin d => if i = j then (1 : ℂ) else 0) + have hinit := hq.lowest_homogeneousComponent hlow + simpa only [Fintype.card_fin] using Polar.HasBorderDeterminant.smooth_lower_bound hinit + (by simpa only [Fintype.card_fin] using hd) hr + (homogeneousComponent_isHomogeneous r _) hs + exact ⟨hb, fun h => hb h.hasBorderDeterminant⟩ + +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/KernelCharts.lean b/lean/OAI/Algebra/Determinantal/KernelCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..c81acca0104fb2465148a59af5f2f254a064eaf9 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/KernelCharts.lean @@ -0,0 +1,471 @@ +import OAI.Algebra.Determinantal.ProjectiveCounts + +namespace OAI + +namespace PermanentBorder.Multigraded +open MvPolynomial +open scoped Classical + +lemma weight_mapDomain_eq {σ τ G : Type*} [AddCommMonoid G] + (w : σ → G) (w' : τ → G) (f : σ → τ) (hf : ∀ x, w' (f x) = w x) + (d : σ →₀ ℕ) : Finsupp.weight w' (d.mapDomain f) = Finsupp.weight w d := by + induction d using Finsupp.induction_linear with + | zero => simp + | add d e hd he => simp [Finsupp.mapDomain_add, hd, he] + | single x n => simp [Finsupp.weight_single, hf] + +lemma homogeneous_rename {σ τ G R : Type*} [AddCommMonoid G] [CommSemiring R] + (w : σ → G) (w' : τ → G) (f : σ → τ) (hf : ∀ x, w' (f x) = w x) + {p : MvPolynomial σ R} {d : G} (hp : p.IsWeightedHomogeneous w d) : + (rename f p).IsWeightedHomogeneous w' d := by + conv_lhs => rw [as_sum p] + rw [map_sum] + apply IsWeightedHomogeneous.sum + intro m hm + rw [rename_monomial] + exact isWeightedHomogeneous_monomial _ _ _ ((weight_mapDomain_eq w w' f hf m).trans + (hp (mem_support_iff.mp hm))) + +section Reindex +variable {ι σ E L V : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] + [Fintype E] [Fintype L] [DecidableEq L] + [NormedAddCommGroup V] [NormedSpace ℂ V] [CompleteSpace V] + +theorem bilinear_simple_point_count_reindex (a : ι →₀ ℕ) + (group : σ → ι) (ve : σ ≃ BlockVariables a) + (hv : ∀ s, (ve s).1 = group s) + (u v : E → ι) (hM : Fintype.card E = ∑ j, a j) + (F : E → MvPolynomial σ ℂ) + (hF : ∀ i, (F i).IsWeightedHomogeneous (blockWeight group) + (Pi.single (u i) 1 + Pi.single (v i) 1)) + (base : L → ι → σ) (hbase : ∀ i j, group (base i j) = j) + (e : L → (E → ℂ) ≃L[ℂ] V) + (chart : L → V → σ → ℂ) (hc : ∀ i, ContDiff ℂ 1 (chart i)) + (hcn : ∀ i z j, chart i z (base i j) = 1) + (x : L → V) + (hx : ∀ i j, i ≠ j → BlockSeparated group (chart i (x i)) (chart j (x j))) + (hz : ∀ i j, eval (chart i (x i)) (F j) = 0) + (hs : ∀ i, (fderiv ℂ (fun z => e i (fun j => eval (chart i z) (F j))) + (x i)).IsInvertible) : + Fintype.card L ≤ (mixedPolynomial u v).coeff a := by + classical + let ee := (Fintype.equivFin E).symm + let ec : (Fin (Fintype.card E) → ℂ) ≃L[ℂ] (E → ℂ) := + ContinuousLinearEquiv.piCongrLeft ℂ (fun _ : E => ℂ) ee + let F' (i : Fin (Fintype.card E)) := rename ve (F (ee i)) + let chart' (i : L) (z : V) : BlockVariables a → ℂ := chart i z ∘ ve.symm + have hc' (i : L) : ContDiff ℂ 1 (chart' i) := by + apply contDiff_pi.mpr + intro j + exact (contDiff_apply ℂ ℂ (ve.symm j)).comp (hc i) + have heval (i : L) (z : V) (j : Fin (Fintype.card E)) : + eval (chart' i z) (F' j) = eval (chart i z) (F (ee j)) := by + dsimp only [F'] + rw [eval_rename] + apply congrArg (fun v : σ → ℂ => eval v (F (ee j))) + funext s + simp [chart'] + have hs' (i : L) : (fun z => (ec.trans (e i)) (fun j => eval (chart' i z) (F' j))) = + fun z => e i (fun j => eval (chart i z) (F j)) := by + funext z + simp only [ContinuousLinearEquiv.trans_apply] + apply congrArg (e i) + funext j + change (Homeomorph.piCongrLeft (Y := fun _ : E => ℂ) ee) + (fun j => eval (chart' i z) (F' j)) j = _ + conv_lhs => rw [← ee.apply_symm_apply j] + rw [Homeomorph.piCongrLeft_apply_apply, heval, ee.apply_symm_apply] + have hh := bilinear_simple_point_count_multichart a (u ∘ ee) (v ∘ ee) hM F' + (fun i => homogeneous_rename _ _ ve (fun s => by simp [blockWeight, hv]) (hF (ee i))) + (fun i j => ve (base i j)) (fun i j => (hv _).trans (hbase i j)) + (fun i => ec.trans (e i)) chart' hc' + (fun i z j => by simpa [chart'] using hcn i z j) x + (fun i j hij => by + obtain ⟨s,t,hst,hne⟩ := hx i j hij + refine ⟨ve s,ve t,?_,?_⟩ + · simpa [hv] using hst + · simpa [chart'] using hne) + (fun i j => (heval i (x i) j).trans (hz i (ee j))) + (fun i => by rw [hs']; exact hs i) + have hm : mixedPolynomial (u ∘ ee) (v ∘ ee) = mixedPolynomial u v := by + exact Fintype.prod_equiv ee _ _ (fun _ => rfl) + rwa [hm] at hh +end Reindex +end PermanentBorder.Multigraded + +namespace PermanentBorder.KernelBilinear +open MvPolynomial +open scoped Classical + +abbrev Groups := Option Bool +abbrev Var (κ : Type) (n : ℕ) : Groups → Type _ := + Option.elim' (Option (Option κ)) (fun _ => Fin (n+1)) +instance varFintype (κ : Type) [Fintype κ] (n : ℕ) : (j : Groups) → Fintype (Var κ n j) + | none => inferInstanceAs (Fintype (Option (Option κ))) + | some _ => inferInstanceAs (Fintype (Fin (n+1))) +abbrev Variables (κ : Type) (n : ℕ) := Σ j : Groups, Var κ n j +abbrev Equations (κ : Type) (n : ℕ) := Fin (n+1) ⊕ (Fin n ⊕ κ) + +variable {κ : Type} [Fintype κ] {n : ℕ} + +noncomputable def dimensions (κ : Type) [Fintype κ] (n : ℕ) : Groups →₀ ℕ := + Finsupp.equivFunOnFinite.symm (Option.elim' (Fintype.card κ+1) (fun _ => n)) + +@[simp] lemma dimensions_none : dimensions κ n none = Fintype.card κ+1 := rfl +@[simp] lemma dimensions_some (b : Bool) : dimensions κ n (some b) = n := rfl + +lemma var_card (j : Groups) : Fintype.card (Var κ n j) = dimensions κ n j + 1 := by + cases j with + | none => + change Fintype.card (Option (Option κ)) = Fintype.card κ + 1 + 1 + exact Fintype.card_option.trans (congrArg (fun k => k+1) Fintype.card_option) + | some b => + change Fintype.card (Fin (n+1)) = n+1 + exact Fintype.card_fin _ + +noncomputable def variablesEquiv : Variables κ n ≃ + Multigraded.BlockVariables (dimensions κ n) := + Equiv.sigmaCongrRight (fun j => (Fintype.equivFin (Var κ n j)).trans + (finCongr (var_card j))) + +@[simp] lemma variablesEquiv_group (s : Variables κ n) : + (variablesEquiv s).1 = s.1 := rfl + +noncomputable def linearMatrix (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (i j : Fin (n+1)) : MvPolynomial (Variables κ n) ℂ := + C (A₀ i j) * X ⟨none,none⟩ + ∑ k, C (A k i j) * X ⟨none,some k⟩ + +noncomputable def rightEquation (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (i : Fin (n+1)) : MvPolynomial (Variables κ n) ℂ := + ∑ j, linearMatrix A₀ A i j * X ⟨some false,j⟩ + +noncomputable def leftEquation (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (j : Fin (n+1)) : MvPolynomial (Variables κ n) ℂ := + ∑ i, linearMatrix A₀ A i j * X ⟨some true,i⟩ + +noncomputable def polarEquation (B : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) : + MvPolynomial (Variables κ n) ℂ := + ∑ i, ∑ j, C (B i j) * X ⟨some false,j⟩ * X ⟨some true,i⟩ + +noncomputable def system (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (B : κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (pivot : Fin (n+1)) : + Equations κ n → MvPolynomial (Variables κ n) ℂ := + Sum.elim (rightEquation A₀ A) + (Sum.elim (fun j => leftEquation A₀ A (pivot.succAbove j)) (fun k => polarEquation (B k))) + +def firstGroup : Equations κ n → Groups := + Sum.elim (fun _ => none) (Sum.elim (fun _ => none) (fun _ => some false)) +def secondGroup : Equations κ n → Groups := + Sum.elim (fun _ => some false) (Sum.elim (fun _ => some true) (fun _ => some true)) + +lemma linearMatrix_homogeneous (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (i j : Fin (n+1)) : + (linearMatrix A₀ A i j).IsWeightedHomogeneous (Multigraded.blockWeight Sigma.fst) + (Pi.single none 1) := by + apply IsWeightedHomogeneous.add + · exact (isWeightedHomogeneous_X ℂ _ _).C_mul _ + · exact IsWeightedHomogeneous.sum _ _ _ (fun k _ => (isWeightedHomogeneous_X ℂ _ _).C_mul _) + +lemma right_homogeneous (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (i : Fin (n+1)) : + (rightEquation A₀ A i).IsWeightedHomogeneous (Multigraded.blockWeight Sigma.fst) + (Pi.single (none : Groups) 1 + Pi.single (some false) 1) := by + unfold rightEquation + apply IsWeightedHomogeneous.sum + intro j _ + exact (linearMatrix_homogeneous A₀ A i j).mul + (isWeightedHomogeneous_X ℂ _ (⟨some false,j⟩ : Variables κ n)) + +lemma left_homogeneous (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (j : Fin (n+1)) : + (leftEquation A₀ A j).IsWeightedHomogeneous (Multigraded.blockWeight Sigma.fst) + (Pi.single (none : Groups) 1 + Pi.single (some true) 1) := by + unfold leftEquation + apply IsWeightedHomogeneous.sum + intro i _ + exact (linearMatrix_homogeneous A₀ A i j).mul + (isWeightedHomogeneous_X ℂ _ (⟨some true,i⟩ : Variables κ n)) + +omit [Fintype κ] in +lemma polar_homogeneous (B : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) : + (polarEquation (κ := κ) B).IsWeightedHomogeneous (Multigraded.blockWeight Sigma.fst) + (Pi.single (some false : Groups) 1 + Pi.single (some true) 1) := by + unfold polarEquation + apply IsWeightedHomogeneous.sum + intro i _ + apply IsWeightedHomogeneous.sum + intro j _ + exact ((isWeightedHomogeneous_X ℂ _ (⟨some false,j⟩ : Variables κ n)).C_mul (B i j)).mul + (isWeightedHomogeneous_X ℂ _ (⟨some true,i⟩ : Variables κ n)) + +lemma system_homogeneous (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (B : κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) (pivot : Fin (n+1)) + (i : Equations κ n) : + (system A₀ A B pivot i).IsWeightedHomogeneous (Multigraded.blockWeight Sigma.fst) + (Pi.single (firstGroup i) 1 + Pi.single (secondGroup i) 1) := by + rcases i with i | j | k + · exact right_homogeneous A₀ A i + · exact left_homogeneous A₀ A (pivot.succAbove j) + · exact polar_homogeneous (B k) + +lemma card_equations : Fintype.card (Equations κ n) = ∑ j, dimensions κ n j := by + simp [Equations, Fintype.sum_option] + omega + +noncomputable def coordinates (z : Option κ → ℂ) + (u v : Fin (n+1) → ℂ) : Variables κ n → ℂ := + fun s => match s with + | ⟨none,t⟩ => t.elim 1 z + | ⟨some false,i⟩ => u i + | ⟨some true,i⟩ => v i + +@[simp] lemma eval_linearMatrix (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (z : Option κ → ℂ) (u v : Fin (n+1) → ℂ) (i j : Fin (n+1)) : + eval (coordinates z u v) (linearMatrix A₀ A i j) = A₀ i j + ∑ k, A k i j * z k := by + simp [linearMatrix, coordinates] + +@[simp] lemma eval_right (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (z : Option κ → ℂ) (u v : Fin (n+1) → ℂ) (i : Fin (n+1)) : + eval (coordinates z u v) (rightEquation A₀ A i) = + ∑ j, (A₀ i j + ∑ k, A k i j * z k) * u j := by + simp [rightEquation, coordinates] + +@[simp] lemma eval_left (A₀ : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (A : Option κ → Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (z : Option κ → ℂ) (u v : Fin (n+1) → ℂ) (j : Fin (n+1)) : + eval (coordinates z u v) (leftEquation A₀ A j) = + ∑ i, (A₀ i j + ∑ k, A k i j * z k) * v i := by + simp [leftEquation, coordinates] + +omit [Fintype κ] in +@[simp] lemma eval_polar (B : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (z : Option κ → ℂ) (u v : Fin (n+1) → ℂ) : + eval (coordinates z u v) (polarEquation B) = ∑ i, ∑ j, B i j * u j * v i := by + simp [polarEquation, coordinates] + +lemma mixedPolynomial_eq : + Multigraded.mixedPolynomial (firstGroup (κ := κ) (n := n)) secondGroup = + (X none + X (some false))^(n+1) * (X none + X (some true))^n * + (X (some false) + X (some true))^Fintype.card κ := by + simp [Multigraded.mixedPolynomial, firstGroup, secondGroup, Fintype.prod_sum_type, + mul_assoc] + +end PermanentBorder.KernelBilinear + +namespace PermanentBorder.Multigraded +open MvPolynomial +open scoped Classical +variable {σ : Type*} [DecidableEq σ] +noncomputable def collapse (i : σ) : MvPolynomial σ ℕ →+* Polynomial ℕ := + eval₂Hom Polynomial.C (fun j => if j = i then Polynomial.X else 1) + +lemma collapse_monomial (i : σ) (d : σ →₀ ℕ) (a : ℕ) : + collapse i (monomial d a) = Polynomial.C a * Polynomial.X^(d i) := by + rw [collapse, eval₂Hom_monomial] + congr 1 + have h := Finsupp.prod_ite_eq d i (fun _ n => (Polynomial.X : Polynomial ℕ)^n) + by_cases hi : i ∈ d.support + · simpa only [ite_eq_left hi, eq_comm, ite_pow, one_pow] using h + · simpa only [ite_eq_right hi, Finsupp.notMem_support_iff.mp hi, pow_zero, + eq_comm, ite_pow, one_pow] using h + +lemma coeff_le_collapse (i : σ) (p : MvPolynomial σ ℕ) (d : σ →₀ ℕ) : + p.coeff d ≤ (collapse i p).coeff (d i) := by + by_cases hd : d ∈ p.support + · have he : (collapse i p).coeff (d i) = + ∑ k ∈ p.support, (collapse i (monomial k (p.coeff k))).coeff (d i) := by + conv_lhs => rw [as_sum p] + simp only [map_sum, Polynomial.finsetSum_coeff] + rw [he] + have h := Finset.single_le_sum (fun k (_ : k ∈ p.support) => + Nat.zero_le ((collapse i (monomial k (p.coeff k))).coeff (d i))) hd + simpa [collapse_monomial, Polynomial.coeff_C_mul] using h + · rw [notMem_support_iff.mp hd] + exact Nat.zero_le _ +end PermanentBorder.Multigraded + +namespace PermanentBorder.KernelBilinear +open MvPolynomial +open scoped Classical +variable {κ : Type} [Fintype κ] {n : ℕ} +lemma mixed_coefficient_bound : + (Multigraded.mixedPolynomial (firstGroup (κ := κ) (n := n)) secondGroup).coeff + (dimensions κ n) ≤ 2^Fintype.card κ * (2*n+1).choose (Fintype.card κ+1) := by + have h := Multigraded.coeff_le_collapse none + (Multigraded.mixedPolynomial (firstGroup (κ := κ) (n := n)) secondGroup) + (dimensions κ n) + have hp : Multigraded.collapse none + (Multigraded.mixedPolynomial (firstGroup (κ := κ) (n := n)) secondGroup) = + (Polynomial.X + 1)^(2*n+1) * Polynomial.C (2^Fintype.card κ) := by + rw [mixedPolynomial_eq] + simp only [map_mul, map_pow, map_add, Multigraded.collapse, eval₂Hom_X'] + simp only [↓reduceIte, Option.some_ne_none, one_add_one_eq_two] + rw [← pow_add, show n+1+n = 2*n+1 by omega] + simp + rw [hp, dimensions_none, Polynomial.coeff_mul_C, Polynomial.coeff_X_add_one_pow, + mul_comm] at h + exact h +end PermanentBorder.KernelBilinear + +namespace PermanentBorder.PolarAnalysis +open Filter +open scoped Topology + +section Elimination +variable {V W : Type*} + [NormedAddCommGroup V] [NormedSpace ℂ V] [FiniteDimensional ℂ V] + [NormedAddCommGroup W] [NormedSpace ℂ W] [FiniteDimensional ℂ W] + + theorem isInvertible_of_injective (T : V →L[ℂ] V) (hT : Function.Injective T) : + T.IsInvertible := by + have hs : Function.Surjective T := LinearMap.injective_iff_surjective.mp hT + obtain ⟨u, hu⟩ := ContinuousLinearMap.isUnit_iff_bijective.mpr ⟨hT,hs⟩ + exact ⟨ContinuousLinearEquiv.ofUnit u,hu⟩ + +theorem invertible_elimination (R : (V × W) →L[ℂ] V) (E : (V × W) →L[ℂ] W) + (g : V →L[ℂ] W) + (hE : (E ∘L ContinuousLinearMap.inr ℂ V W).IsInvertible) + (he : E ∘L ((ContinuousLinearMap.id ℂ V).prod g) = 0) + (hR : (R ∘L ((ContinuousLinearMap.id ℂ V).prod g)).IsInvertible) : + (R.prod E).IsInvertible := by + apply isInvertible_of_injective + apply (LinearMap.ker_eq_bot).mp + rw [LinearMap.ker_eq_bot'] + intro z hz + have hrz : R z = 0 := congrArg Prod.fst hz + have hez : E z = 0 := congrArg Prod.snd hz + have heg : E (z.1,g z.1) = 0 := by + have h := congrArg (fun T : (V →L[ℂ] W) => T z.1) he + simpa using h + have hsub : E (0,z.2-g z.1) = 0 := by + have hh : (0,z.2-g z.1) = z - (z.1,g z.1) := by ext <;> simp + rw [hh, map_sub,hez,heg,sub_self] + have hdw : z.2 = g z.1 := by + have hm : (E ∘L ContinuousLinearMap.inr ℂ V W) (z.2-g z.1) = + (E ∘L ContinuousLinearMap.inr ℂ V W) 0 := by + rw [map_zero] + exact hsub + exact sub_eq_zero.mp (hE.bijective.injective hm) + have hdx : z.1 = 0 := by + apply hR.bijective.injective + rw [map_zero] + change R (z.1,g z.1) = 0 + simpa only [← hdw,Prod.eta] using hrz + exact Prod.ext hdx (by simpa [hdx] using hdw) + +theorem simple_after_elimination {R : V × W → V} {E : V × W → W} + {g : V → W} {x : V} + (hR : DifferentiableAt ℂ R (x,g x)) (hE : DifferentiableAt ℂ E (x,g x)) + (hg : DifferentiableAt ℂ g x) + (he : (fun y => E (y,g y)) =ᶠ[𝓝 x] 0) + (haux : (fderiv ℂ E (x,g x) ∘L ContinuousLinearMap.inr ℂ V W).IsInvertible) + (hs : (fderiv ℂ (fun y => R (y,g y)) x).IsInvertible) : + (fderiv ℂ (fun z => (R z,E z)) (x,g x)).IsInvertible := by + let graph := (ContinuousLinearMap.id ℂ V).prod (fderiv ℂ g x) + have hgraph : HasFDerivAt (fun y => (y,g y)) graph x := + (hasFDerivAt_id x).prodMk hg.hasFDerivAt + have he' : fderiv ℂ E (x,g x) ∘L graph = 0 := by + have hd := hE.hasFDerivAt.comp x hgraph + have hz := (hasFDerivAt_const (𝕜 := ℂ) (0 : W) x).congr_of_eventuallyEq he + exact hd.unique hz + have hr' : (fderiv ℂ R (x,g x) ∘L graph).IsInvertible := by + have hd := hR.hasFDerivAt.comp x hgraph + rwa [← hd.fderiv] + rw [(hR.hasFDerivAt.prodMk hE.hasFDerivAt).fderiv] + exact invertible_elimination _ _ _ haux he' hr' +end Elimination +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis.Schur +open Matrix +open scoped Matrix + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +noncomputable def block (a : ℂ) (β γ : ι → ℂ) (E : Matrix ι ι ℂ) : + Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ := + fromBlocks (Matrix.of fun _ _ => a) (Matrix.of fun _ j => β j) (Matrix.of fun i _ => γ i) E +noncomputable def right (γ : ι → ℂ) (E : Matrix ι ι ℂ) : ι → ℂ := -(E⁻¹ *ᵥ γ) +noncomputable def left (β : ι → ℂ) (E : Matrix ι ι ℂ) : ι → ℂ := -(β ᵥ* E⁻¹) +noncomputable def scalar (a : ℂ) (β γ : ι → ℂ) (E : Matrix ι ι ℂ) : ℂ := + a - β ⬝ᵥ (E⁻¹ *ᵥ γ) +noncomputable def normalized (u : ι → ℂ) : Unit ⊕ ι → ℂ := Sum.elim (fun _ => 1) u + + theorem solved_right (a : ℂ) (β γ : ι → ℂ) (E : Matrix ι ι ℂ) (hE : E.det ≠ 0) : + block a β γ E *ᵥ normalized (right γ E) = + Sum.elim (fun _ => scalar a β γ E) (fun _ => 0) := by + have hu : IsUnit E.det := isUnit_iff_ne_zero.mpr hE + simp only [block, normalized, fromBlocks_mulVec, right, Sum.elim_comp_inl, Sum.elim_comp_inr] + have hh : E *ᵥ -(E⁻¹ *ᵥ γ) = -γ := by + rw [mulVec_neg, mulVec_mulVec, mul_nonsing_inv E hu, one_mulVec] + rw [hh] + ext j + cases j <;> simp [scalar, mulVec, dotProduct, Finset.mul_sum, sub_eq_add_neg] + + theorem solved_left (a : ℂ) (β γ : ι → ℂ) (E : Matrix ι ι ℂ) (hE : E.det ≠ 0) : + normalized (left β E) ᵥ* block a β γ E = + Sum.elim (fun _ => scalar a β γ E) (fun _ => 0) := by + have hu : IsUnit E.det := isUnit_iff_ne_zero.mpr hE + simp only [block, normalized, vecMul_fromBlocks, left, Sum.elim_comp_inl, Sum.elim_comp_inr] + have hh : -(β ᵥ* E⁻¹) ᵥ* E = -β := by + rw [neg_vecMul, vecMul_vecMul, nonsing_inv_mul E hu, vecMul_one] + rw [hh] + ext j + cases j with + | inl u => + simp only [Sum.elim_inl, Pi.add_apply, vecMul, dotProduct, Matrix.of_apply, + Fintype.sum_unique, one_mul, Pi.neg_apply, neg_mul, Finset.sum_neg_distrib, + scalar, mulVec, Finset.sum_mul, Finset.mul_sum, mul_assoc, sub_eq_add_neg] + rw [Finset.sum_comm] + | inr j => simp [vecMul, dotProduct] + + theorem det_block (a : ℂ) (β γ : ι → ℂ) (E : Matrix ι ι ℂ) (hE : E.det ≠ 0) : + (block a β γ E).det = E.det * scalar a β γ E := by + let := E.invertibleOfIsUnitDet (isUnit_iff_ne_zero.mpr hE) + rw [block, det_fromBlocks₂₂] + congr 1 + rw [Matrix.det_eq_elem_of_subsingleton _ ()] + simp only [Matrix.sub_apply, Matrix.mul_apply, scalar] + simp only [invOf_eq_nonsing_inv, Matrix.of_apply, dotProduct, mulVec, + Finset.mul_sum, Finset.sum_mul, mul_assoc] + rw [Finset.sum_comm] + +section Calculus +variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℂ V] + + theorem differentiableAt_det {E : V → Matrix ι ι ℂ} {x : V} + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) : + DifferentiableAt ℂ (fun y => (E y).det) x := by + classical + simp only [Matrix.det_apply] + fun_prop + + theorem differentiableAt_adjugate {E : V → Matrix ι ι ℂ} {x : V} + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) (i j : ι) : + DifferentiableAt ℂ (fun y => (E y).adjugate i j) x := by + simp only [Matrix.adjugate_apply] + apply differentiableAt_det + intro u v + by_cases hu : u = j + · subst u + simp only [Matrix.updateRow_self] + exact differentiableAt_const _ + · simpa only [Matrix.updateRow_ne hu] using hE u v + + theorem differentiableAt_inverse {E : V → Matrix ι ι ℂ} {x : V} + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) (i j : ι) : + DifferentiableAt ℂ (fun y => (E y)⁻¹ i j) x := by + simp only [Matrix.inv_def, Ring.inverse_eq_inv, Matrix.smul_apply, smul_eq_mul] + exact ((differentiableAt_det hE).inv hx).mul (differentiableAt_adjugate hE i j) +end Calculus +end PermanentBorder.PolarAnalysis.Schur + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/LinearForms.lean b/lean/OAI/Algebra/Determinantal/LinearForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8dcb32b60fae015000a791db46628a83bec6104 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/LinearForms.lean @@ -0,0 +1,467 @@ +import OAI.Algebra.Determinantal.Multigraded + +namespace OAI +namespace PermanentBorder.Multigraded +open MvPolynomial +section LinearCoefficients +variable {K σ τ : Type*} [Field K] [Fintype τ] + +noncomputable def linearFormMap (v : τ → σ) : (τ → K) →ₗ[K] MvPolynomial σ K := + ∑ t, (LinearMap.proj t).smulRight (X (v t)) + +lemma linearFormMap_apply (v : τ → σ) (c : τ → K) : + linearFormMap v c = ∑ t, C (c t) * X (v t) := by + simp [linearFormMap, smul_eq_C_mul] + +lemma linearFormMap_single [DecidableEq τ] (v : τ → σ) (t : τ) : + linearFormMap v (Pi.single t (1 : K)) = X (v t) := by + classical + simp [linearFormMap_apply, Pi.single_apply] + +noncomputable def linearCoefficientSubspace (v : τ → σ) (I : Ideal (MvPolynomial σ K)) : + Submodule K (τ → K) := (I.restrictScalars K).comap (linearFormMap v) + +theorem linear_relations_of_codimension_le_one (v : τ → σ) (I : Ideal (MvPolynomial σ K)) + (h : Module.finrank K ((τ → K) ⧸ linearCoefficientSubspace v I) ≤ 1) : + ∃ z : MvPolynomial σ K, ∃ c : τ → K, ∀ t, X (v t) - C (c t) * z ∈ I := by + classical + obtain ⟨a,ha⟩ := finrank_le_one_iff.mp h + obtain ⟨b,rfl⟩ := Submodule.Quotient.mk_surjective (linearCoefficientSubspace v I) a + choose c hc using fun t => ha (Submodule.Quotient.mk (Pi.single t (1 : K))) + refine ⟨linearFormMap v b,c,fun t => ?_⟩ + have hmem : Pi.single t (1 : K) - c t • b ∈ linearCoefficientSubspace v I := by + apply (Submodule.Quotient.eq (linearCoefficientSubspace v I)).mp + simpa only [Submodule.Quotient.mk_smul] using (hc t).symm + change linearFormMap v (Pi.single t 1 - c t • b) ∈ I at hmem + simpa only [map_sub, map_smul, linearFormMap_single, smul_eq_C_mul] using hmem + +theorem variables_mem_of_codimension_zero (v : τ → σ) (I : Ideal (MvPolynomial σ K)) + (h : Module.finrank K ((τ → K) ⧸ linearCoefficientSubspace v I) = 0) : + ∀ t, X (v t) ∈ I := by + classical + intro t + have hz : Submodule.Quotient.mk (Pi.single t (1 : K)) = + (0 : (τ → K) ⧸ linearCoefficientSubspace v I) := by + obtain ⟨c,hc,hq⟩ := Module.finrank_eq_zero_iff.mp h + (Submodule.Quotient.mk (Pi.single t (1 : K))) + exact (smul_eq_zero.mp hq).resolve_left hc + have hm := (Submodule.Quotient.mk_eq_zero (linearCoefficientSubspace v I)).mp hz + change linearFormMap v (Pi.single t (1 : K)) ∈ I at hm + simpa only [linearFormMap_single] using hm + +end LinearCoefficients + +section Vandermonde +variable {K : Type*} [Field K] + +lemma linearIndependent_rect_vandermonde {n N : ℕ} (hn : n ≤ N) + (t : Fin n → K) (ht : Function.Injective t) : + LinearIndependent K (fun i : Fin n => fun j : Fin N => t i ^ j.val) := by + let f : (Fin N → K) →ₗ[K] Fin n → K := + LinearMap.funLeft K K (Fin.castLE hn) + apply LinearIndependent.of_comp f + exact Matrix.linearIndependent_rows_of_det_ne_zero + (Matrix.det_vandermonde_ne_zero_iff.mpr ht) + +lemma linear_block_codimension_le {σ : Type*} {n N : ℕ} (hn : n ≤ N) + (v : Fin N → σ) (I : Ideal (MvPolynomial σ K)) + (t : Fin n → K) (ht : Function.Injective t) + (hforms : ∀ i, linearFormMap v (fun j => t i ^ j.val) ∈ I) : + Module.finrank K ((Fin N → K) ⧸ linearCoefficientSubspace v I) + n ≤ N := by + have hi := linearIndependent_rect_vandermonde hn t ht + have hspan : Submodule.span K (Set.range (fun i : Fin n => fun j : Fin N => t i ^ j.val)) ≤ + linearCoefficientSubspace v I := by + apply Submodule.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact hforms i + have hr := Submodule.finrank_mono hspan + rw [finrank_span_eq_card hi, Fintype.card_fin] at hr + have he := Submodule.finrank_quotient_add_finrank (linearCoefficientSubspace v I) + rw [Module.finrank_fintype_fun_eq_card, Fintype.card_fin] at he + omega + +end Vandermonde +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section VandermondeLeaves +variable {K ι L : Type*} [Field K] [Fintype ι] [DecidableEq ι] [Fintype L] + +abbrev BlockVariables (a : ι → ℕ) := (j : ι) × Fin (a j + 1) + +def blockVar (a : ι → ℕ) (j : ι) (h : Fin (a j+1)) : BlockVariables a := ⟨j,h⟩ + +noncomputable def blockLinearForm (a : ι → ℕ) (j : ι) (t : K) : + MvPolynomial (BlockVariables a) K := + linearFormMap (blockVar a j) (fun h : Fin (a j+1) => t ^ h.val) + +omit [Fintype ι] in +lemma blockLinearForm_homogeneous (a : ι → ℕ) (j : ι) (t : K) : + (blockLinearForm a j t).IsWeightedHomogeneous (blockWeight (fun v : BlockVariables a => v.1)) + (Pi.single j 1) := by + classical + rw [blockLinearForm,linearFormMap_apply] + apply IsWeightedHomogeneous.sum + intro h _ + exact (isWeightedHomogeneous_X K (blockWeight (fun v : BlockVariables a => v.1)) (blockVar a j h)).C_mul _ + +omit [Fintype ι] in +lemma labeled_codimension (a : ι → ℕ) (g : L → ι) (t : L → K) + (ht : Function.Injective t) (I : Ideal (MvPolynomial (BlockVariables a) K)) + (hforms : ∀ l, blockLinearForm a (g l) (t l) ∈ I) + (j : ι) (n : ℕ) (hn : n ≤ a j+1) (hj : n ≤ Fintype.card {l // g l = j}) : + Module.finrank K ((Fin (a j+1) → K) ⧸ linearCoefficientSubspace (blockVar a j) I) + n ≤ a j+1 := by + classical + obtain ⟨e⟩ := Function.Embedding.nonempty_of_card_le (α := Fin n) + (β := {l // g l = j}) (by simpa using hj) + apply linear_block_codimension_le hn (blockVar a j) I (fun i => t (e i).val) + (ht.comp (Subtype.val_injective.comp e.injective)) + intro i + have h := hforms (e i).val + have hij : g (e i).val = j := (e i).property + rw [hij] at h + exact h + +theorem labeled_leaf_bound (a : ι → ℕ) (g : L → ι) (t : L → K) + (ht : Function.Injective t) (hcard : Fintype.card L = ∑ j, a j) + (I : Ideal (MvPolynomial (BlockVariables a) K)) + (hforms : ∀ l, blockLinearForm a (g l) (t l) ∈ I) + (d : ι → ℤ) (hd : ∀ j, 0 < d j) : + Module.finrank K (componentQuotient (blockWeight (fun v : BlockVariables a => v.1)) I d) ≤ + if ∀ j, Fintype.card {l // g l = j} = a j then 1 else 0 := by + classical + split_ifs with hbalanced + · have hj (j : ι) : + Module.finrank K ((Fin (a j+1) → K) ⧸ linearCoefficientSubspace (blockVar a j) I) ≤ 1 := by + have h := labeled_codimension a g t ht I hforms j (a j) (by omega) (by rw [hbalanced]) + omega + choose z c hc using fun j => linear_relations_of_codimension_le_one (blockVar a j) I (hj j) + exact component_finrank_le_one_of_linear_relations (fun v : BlockVariables a => v.1) I z + (fun v => c v.1 v.2) (fun v => hc v.1 v.2) d + · have hs : (∑ j, Fintype.card {l // g l = j}) = ∑ j, a j := by + rw [← Fintype.card_sigma, Fintype.card_congr (Equiv.sigmaFiberEquiv g), hcard] + have hex : ∃ j, a j < Fintype.card {l // g l = j} := by + by_contra! hn + apply hbalanced + exact fun j => (Finset.sum_eq_sum_iff_of_le (fun j _ => hn j)).mp hs j (Finset.mem_univ j) + obtain ⟨j,hj⟩ := hex + have hdim := labeled_codimension a g t ht I hforms j (a j+1) le_rfl hj + have hz := variables_mem_of_codimension_zero (blockVar a j) I (by omega) + have hb : ∀ v : BlockVariables a, v.1 = j → X v ∈ I := by + rintro ⟨i,v⟩ hv + change i = j at hv + subst i + exact hz v + exact (component_finrank_zero_of_block_killed (fun v : BlockVariables a => v.1) I j hb d (hd j)).le + +end VandermondeLeaves +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section BinaryChoices +variable {K σ G : Type*} [Field K] [AddCommGroup G] +variable (w : σ → G) + +noncomputable def pieceDim (I : Ideal (MvPolynomial σ K)) (d : G) : ℕ := + Module.finrank K (componentQuotient w I d) + +noncomputable def choiceIdeal : (qs : List (FactorPair (K := K) w)) → + (Fin qs.length → Bool) → Ideal (MvPolynomial σ K) + | [], _ => ⊥ + | q::qs, c => Ideal.span {if c 0 then q.right else q.left} ⊔ + choiceIdeal qs (fun i => c i.succ) + +noncomputable def choiceShift : (qs : List (FactorPair (K := K) w)) → + (Fin qs.length → Bool) → G + | [], _ => 0 + | q::qs, c => (if c 0 then q.leftDegree else 0) + choiceShift qs (fun i => c i.succ) + +lemma splitBound_eq_choiceSum (qs : List (FactorPair (K := K) w)) + (I : Ideal (MvPolynomial σ K)) (d : G) : + splitBound w I d qs = ∑ c : Fin qs.length → Bool, + pieceDim w (I ⊔ choiceIdeal w qs c) (d-choiceShift w qs c) := by + classical + induction qs generalizing I d with + | nil => + change pieceDim w I d = ∑ c : Fin 0 → Bool, + pieceDim w (I ⊔ choiceIdeal w [] c) (d-choiceShift w [] c) + simp only [choiceIdeal, choiceShift, sup_bot_eq, sub_zero] + simp + | cons q qs ih => + rw [splitBound, ih, ih] + let f : (Fin (qs.length+1) → Bool) → ℕ := fun c => + pieceDim w (I ⊔ choiceIdeal w (q::qs) c) (d-choiceShift w (q::qs) c) + have hs := (Fin.consEquiv (fun _ : Fin (qs.length+1) => Bool)).sum_comp f + apply Eq.trans (b := ∑ p : Bool × (Fin qs.length → Bool), f (Fin.cons p.1 p.2)) _ hs + simp only [f, Fintype.sum_prod_type, Fintype.sum_bool, + choiceIdeal, choiceShift, Fin.cons_zero, Fin.cons_succ, Bool.false_eq_true, + ite_false, ite_true, zero_add, ← sup_assoc] + simp_rw [sub_add_eq_sub_sub] + exact add_comm _ _ + +lemma choice_mem_choiceIdeal (qs : List (FactorPair (K := K) w)) + (c : Fin qs.length → Bool) (i : Fin qs.length) : + (if c i then (qs.get i).right else (qs.get i).left) ∈ choiceIdeal w qs c := by + induction qs with + | nil => exact Fin.elim0 i + | cons q qs ih => + refine Fin.cases ?_ (fun i => ?_) i + · exact Submodule.mem_sup_left (Ideal.subset_span (Set.mem_singleton _)) + · exact Submodule.mem_sup_right (ih (fun j => c j.succ) i) + +end BinaryChoices +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section MixedCoefficient +variable {ι E : Type*} [Fintype E] [DecidableEq ι] + +noncomputable def choiceCount (g : E → ι) : ι →₀ ℕ := ∑ e, Finsupp.single (g e) 1 + +lemma choiceCount_apply (g : E → ι) (j : ι) : + choiceCount g j = Fintype.card {e // g e = j} := by + classical + rw [Fintype.card_subtype, Finset.card_filter] + simp only [choiceCount, Finsupp.finsetSum_apply, Finsupp.single_apply] + +noncomputable def mixedPolynomial (u v : E → ι) : MvPolynomial ι ℕ := + ∏ e, (X (u e) + X (v e)) + +omit [DecidableEq ι] in +lemma mixedPolynomial_eq_choices [DecidableEq E] (u v : E → ι) : + mixedPolynomial u v = ∑ c : E → Bool, + monomial (choiceCount (fun e => if c e then v e else u e)) (1 : ℕ) := by + classical + have h := Fintype.prod_sum (fun e (b : Bool) => + if b then X (v e) else X (u e) : E → Bool → MvPolynomial ι ℕ) + simp only [Fintype.sum_bool, ite_true, Bool.false_eq_true, ite_false] at h + rw [mixedPolynomial] + simp_rw [add_comm] at h + rw [h] + apply Finset.sum_congr rfl + intro c _ + rw [choiceCount, monomial_sum_one] + apply Finset.prod_congr rfl + intro e _ + cases c e <;> rfl + +lemma mixed_coefficient_eq_count [Fintype ι] [DecidableEq E] (u v : E → ι) (a : ι →₀ ℕ) : + (mixedPolynomial u v).coeff a = + ∑ c : E → Bool, if ∀ j, + Fintype.card {e // (if c e then v e else u e) = j} = a j then 1 else 0 := by + classical + rw [mixedPolynomial_eq_choices, coeff_sum] + apply Finset.sum_congr rfl + intro c _ + rw [coeff_monomial] + congr 1 + rw [Finsupp.ext_iff] + simp only [choiceCount_apply] + +end MixedCoefficient +end PermanentBorder.Multigraded + +namespace PermanentBorder.Multigraded +open MvPolynomial +section ComparisonPieceBound +variable {K ι σ : Type*} [Field K] [DecidableEq ι] + +omit [DecidableEq ι] in +lemma choiceShift_le_length (w : σ → (ι → ℤ)) + (qs : List (FactorPair (K := K) w)) (c : Fin qs.length → Bool) + (hdeg : ∀ q ∈ qs, ∀ j, q.leftDegree j ≤ 1) (j : ι) : + choiceShift w qs c j ≤ (qs.length : ℤ) := by + induction qs with + | nil => simp [choiceShift] + | cons q qs ih => + have hq := hdeg q (List.mem_cons_self) j + have hs := ih (fun i => c i.succ) (fun q h => hdeg q (List.mem_cons_of_mem _ h)) + by_cases hc : c 0 = true + · simpa [choiceShift, hc, add_comm] using add_le_add hq hs + · simpa [choiceShift, hc] using hs.trans (show (qs.length : ℤ) ≤ qs.length + 1 by omega) + +variable [Fintype ι] + +theorem comparison_piece_bound (a : ι →₀ ℕ) + (qs : List (FactorPair (K := K) (blockWeight (fun v : BlockVariables a => v.1)))) + (u v : Fin qs.length → ι) (t : (Fin qs.length × Bool) → K) + (ht : Function.Injective t) + (hleft : ∀ i, (qs.get i).left = blockLinearForm a (u i) (t (i,false))) + (hright : ∀ i, (qs.get i).right = blockLinearForm a (v i) (t (i,true))) + (hdeg : ∀ q ∈ qs, ∀ j, q.leftDegree j ≤ 1) + (hlen : qs.length = ∑ j, a j) (d : ι → ℤ) (hd : ∀ j, (qs.length : ℤ) < d j) : + pieceDim (blockWeight (fun v : BlockVariables a => v.1)) + (productIdeal (blockWeight (fun v : BlockVariables a => v.1)) qs) d ≤ + (mixedPolynomial u v).coeff a := by + classical + let w := blockWeight (fun v : BlockVariables a => v.1) + have hf := finrank_le_splitBound w qs ⊥ (componentClosed_bot w) d + change pieceDim w (⊥ ⊔ productIdeal w qs) d ≤ splitBound w ⊥ d qs at hf + rw [bot_sup_eq] at hf + apply hf.trans + rw [splitBound_eq_choiceSum, mixed_coefficient_eq_count] + apply Finset.sum_le_sum + intro c _ + simp only [bot_sup_eq] + let g : Fin qs.length → ι := fun i => if c i then v i else u i + let t' : Fin qs.length → K := fun i => t (i,c i) + have ht' : Function.Injective t' := by + intro i j hij + exact congrArg Prod.fst (ht hij) + have hforms (i : Fin qs.length) : + blockLinearForm a (g i) (t' i) ∈ choiceIdeal w qs c := by + have h := choice_mem_choiceIdeal w qs c i + dsimp only [g,t'] + cases hc : c i + · simpa only [hc, Bool.false_eq_true, ite_false, hleft i] using h + · simpa only [hc, ite_true, hright i] using h + have hp (j : ι) : 0 < (d-choiceShift w qs c) j := by + have hb := choiceShift_le_length w qs c hdeg j + have hh := hd j + simp only [Pi.sub_apply] + omega + exact labeled_leaf_bound a g t' ht' (by simpa using hlen) + (choiceIdeal w qs c) hforms (d-choiceShift w qs c) hp + +end ComparisonPieceBound +end PermanentBorder.Multigraded + +namespace PermanentBorder.Multigraded +open MvPolynomial +section HomogeneousIdealMap +variable {K σ G E : Type*} [Field K] [AddCommGroup G] [Fintype E] +variable (w : σ → G) (e : E → G) (F : E → MvPolynomial σ K) + (hF : ∀ i, (F i).IsWeightedHomogeneous w (e i)) + +noncomputable def homogeneousIdealMap (d : G) : + (∀ i : E, Piece (K := K) w (d-e i)) →ₗ[K] Piece (K := K) w d := + ∑ i, (mulPiece w (hF i) d).comp (LinearMap.proj i) + +lemma homogeneousIdealMap_val (d : G) (p : ∀ i : E, Piece (K := K) w (d-e i)) : + (homogeneousIdealMap w e F hF d p).val = ∑ i, F i * (p i).val := by + simp [homogeneousIdealMap] + +lemma homogeneousIdealMap_range (d : G) : + LinearMap.range (homogeneousIdealMap w e F hF d) = + ((Ideal.span (Set.range F)).restrictScalars K).comap (Piece (K := K) w d).subtype := by + classical + ext p + constructor + · rintro ⟨g,rfl⟩ + change (homogeneousIdealMap w e F hF d g).val ∈ Ideal.span (Set.range F) + rw [homogeneousIdealMap_val] + exact Ideal.sum_mem _ fun i _ => Ideal.mul_mem_right _ _ (Ideal.mem_span_range_self) + · intro hp + change p.val ∈ Ideal.span (Set.range F) at hp + obtain ⟨g,hg⟩ := Ideal.mem_span_range_iff_exists_fun.mp hp + let g' : ∀ i : E, Piece (K := K) w (d-e i) := fun i => + ⟨weightedHomogeneousComponent w (d-e i) (g i), + weightedHomogeneousComponent_mem w (g i) (d-e i)⟩ + refine ⟨g', Subtype.ext ?_⟩ + rw [homogeneousIdealMap_val] + change ∑ i, F i * weightedHomogeneousComponent w (d-e i) (g i) = p.val + simp_rw [← project_mul w (hF _)] + rw [← map_sum] + simp_rw [mul_comm (F _) _] + rw [hg, weightedHomogeneousComponent_eq_self p.property] + +lemma isWeightedHomogeneous_smul {p : MvPolynomial σ K} {a : G} + (hp : p.IsWeightedHomogeneous w a) (c : K) : + (c • p).IsWeightedHomogeneous w a := by + simpa only [Algebra.smul_def, MvPolynomial.algebraMap_eq] using hp.C_mul c + +lemma homogeneousIdealMap_affine (Q : E → MvPolynomial σ K) + (hQ : ∀ i, (Q i).IsWeightedHomogeneous w (e i)) (d : G) (t : K) : + homogeneousIdealMap w e (fun i => (1-t) • Q i + t • F i) + (fun i => (isWeightedHomogeneous_smul w (hQ i) (1-t)).add + (isWeightedHomogeneous_smul w (hF i) t)) d = + (1-t) • homogeneousIdealMap w e Q hQ d + t • homogeneousIdealMap w e F hF d := by + classical + apply LinearMap.ext + intro p + apply Subtype.ext + simp only [LinearMap.add_apply, LinearMap.smul_apply, Submodule.coe_add, + Submodule.coe_smul] + rw [homogeneousIdealMap_val, homogeneousIdealMap_val, homogeneousIdealMap_val] + simp only [add_mul, smul_mul_assoc, Finset.sum_add_distrib, ← Finset.smul_sum] + +end HomogeneousIdealMap + +lemma pairProduct_mem_productIdeal {K σ G : Type*} [Field K] [AddCommGroup G] + (w : σ → G) (qs : List (FactorPair (K := K) w)) (i : Fin qs.length) : + (qs.get i).left * (qs.get i).right ∈ productIdeal w qs := by + induction qs with + | nil => exact Fin.elim0 i + | cons q qs ih => + refine Fin.cases ?_ (fun i => ?_) i + · exact Submodule.mem_sup_left (Ideal.subset_span (Set.mem_singleton _)) + · exact Submodule.mem_sup_right (ih i) + +lemma productIdeal_le {K σ G : Type*} [Field K] [AddCommGroup G] + (w : σ → G) (qs : List (FactorPair (K := K) w)) (I : Ideal (MvPolynomial σ K)) + (h : ∀ i : Fin qs.length, (qs.get i).left * (qs.get i).right ∈ I) : + productIdeal w qs ≤ I := by + induction qs with + | nil => exact bot_le + | cons q qs ih => + exact sup_le (Ideal.span_le.mpr (Set.singleton_subset_iff.mpr (h 0))) + (ih (fun i => h i.succ)) + +lemma productIdeal_eq_span {K σ G : Type*} [Field K] [AddCommGroup G] + (w : σ → G) (qs : List (FactorPair (K := K) w)) : + productIdeal w qs = Ideal.span (Set.range (fun i : Fin qs.length => + (qs.get i).left * (qs.get i).right)) := by + apply le_antisymm + · exact productIdeal_le w qs _ (fun _ => Ideal.mem_span_range_self) + · apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact pairProduct_mem_productIdeal w qs i + +end PermanentBorder.Multigraded + +namespace PermanentBorder.Multigraded +section AffineIndependent +variable {K E V : Type*} [Field K] [Fintype E] + [AddCommGroup V] [Module K V] + +theorem affine_independent_polynomial (v w : E → V) (hv : LinearIndependent K v) : + ∃ p : Polynomial K, p.eval 0 = 1 ∧ ∀ t : K, p.eval t ≠ 0 → + LinearIndependent K (fun i => (1-t) • v i + t • w i) := by + classical + let f := Fintype.linearCombination K v + obtain ⟨g,hg⟩ := f.exists_leftInverse_of_injective + (LinearMap.ker_eq_bot.mpr hv.fintypeLinearCombination_injective) + have hgv (i : E) : g (v i) = Pi.single i 1 := by + have h := LinearMap.congr_fun hg (Pi.single i 1) + simpa [f, Fintype.linearCombination_apply] using h + let M : Matrix E E (Polynomial K) := fun j i => + (1-Polynomial.X) * Polynomial.C (g (v i) j) + Polynomial.X * Polynomial.C (g (w i) j) + have hM (t : K) : M.map (Polynomial.evalRingHom t) = + (fun j i => g ((1-t) • v i + t • w i) j) := by + ext j i + change (Polynomial.evalRingHom t) (M j i) = _ + simp [M] + ring + have hzero : M.map (Polynomial.evalRingHom 0) = 1 := by + rw [hM] + ext j i + by_cases h : j = i + · subst j; simp [hgv] + · simp [hgv, h] + refine ⟨M.det, ?_, ?_⟩ + · change Polynomial.evalRingHom 0 M.det = 1 + rw [RingHom.map_det, RingHom.mapMatrix_apply, hzero, Matrix.det_one] + · intro t ht + have hu : IsUnit ((M.map (Polynomial.evalRingHom t)).det) := by + rw [← RingHom.mapMatrix_apply, ← RingHom.map_det] + exact isUnit_iff_ne_zero.mpr ht + have hi := (Matrix.linearIndependent_cols_iff_isUnit).mpr + ((Matrix.isUnit_iff_isUnit_det _).mpr hu) + apply LinearIndependent.of_comp g + rw [hM] at hi + exact hi + +end AffineIndependent +end PermanentBorder.Multigraded + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/LocalDerivations.lean b/lean/OAI/Algebra/Determinantal/LocalDerivations.lean new file mode 100644 index 0000000000000000000000000000000000000000..337b0c3436457930f1bf334dbd8f723374cae08d --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/LocalDerivations.lean @@ -0,0 +1,427 @@ +import OAI.Algebra.Determinantal.Monogenic + +namespace OAI + +namespace PermanentBorder.FrobeniusDVR +open IsDiscreteValuationRing +variable {K B : Type*} [CommRing K] [CommRing B] [IsDomain B] + [IsDiscreteValuationRing B] [Algebra K B] +local notation "v" => addVal B + +lemma valuation_le_derivation_add_one (D : Derivation K B B) (z : B) : + v z ≤ v (D z) + 1 := by + obtain ⟨π,hπ⟩ := exists_irreducible B + by_cases hz : z = 0 + · simp [hz, map_zero] + obtain ⟨n,hn⟩ := associated_pow_irreducible hz hπ + obtain ⟨u,hu⟩ := hn.symm + rw [← hu] + cases n with + | zero => simp [pow_zero, addVal_eq_zero_of_unit] + | succ n => + have hdiv : π^(n+1) ∣ π * D (π^(n+1) * ↑u) := by + rw [Derivation.leibniz, Derivation.leibniz_pow] + simp only [Nat.add_sub_cancel, smul_eq_mul, nsmul_eq_mul] + refine ⟨(n+1 : B) * D π * ↑u + π * D ↑u, ?_⟩ + rw [pow_succ] + push_cast + ring + have hv := (addVal_le_iff_dvd (R := B)).mpr hdiv + rw [hπ.addVal_pow, addVal_mul, addVal_uniformizer hπ] at hv + simpa only [addVal_mul, hπ.addVal_pow, addVal_eq_zero_of_unit, add_zero, + add_comm (1 : ℕ∞)] using hv + +variable [CharP B 2] + +omit [IsDomain B] [IsDiscreteValuationRing B] in +lemma derivation_square (D : Derivation K B B) (a : B) : D (a^2) = 0 := by + have htwo : (2 : B) = 0 := CharP.cast_eq_zero _ 2 + simp [Derivation.leibniz_pow, smul_eq_mul, nsmul_eq_mul, htwo] + +omit [IsDomain B] [IsDiscreteValuationRing B] in +lemma derivation_square_plus (D : Derivation K B B) (x c d : B) : + D (c^2+x*d^2) = D x * d^2 := by + rw [map_add, derivation_square, Derivation.leibniz, derivation_square] + simp only [smul_eq_mul, mul_zero, zero_add] + exact mul_comm _ _ + +lemma valuation_square_plus_le (D : Derivation K B B) (x c d : B) : + v (c^2+x*d^2) ≤ v (D x) + 2*v d + 1 := by + have h := valuation_le_derivation_add_one D (c^2+x*d^2) + simpa only [derivation_square_plus, addVal_mul, addVal_pow, + nsmul_eq_mul, Nat.cast_ofNat] using h + +omit [CharP B 2] in +lemma valuation_square_plus_of_lower (x c d : B) (m : ℕ) + (hx : 1 ≤ v x) (hc : v c = m) (hd : (m : ℕ∞) ≤ v d) : + v (c^2+x*d^2) = 2*m := by + have hs : v (c^2) < v (x*d^2) := by + rw [addVal_pow, addVal_mul, addVal_pow, nsmul_eq_mul, nsmul_eq_mul, hc, + Nat.cast_ofNat] + have hh : (2 : ℕ∞)*m+1 ≤ v x+2*v d := by + calc + (2 : ℕ∞)*m+1 = 1+2*m := by ac_rfl + _ ≤ v x+2*v d := add_le_add hx (mul_le_mul_of_nonneg_left hd zero_le) + have ht : (2 : ℕ∞)*m < 2*m+1 := by norm_cast; omega + exact ht.trans_le hh + rw [(addVal B).map_add_eq_of_lt_left hs, addVal_pow, nsmul_eq_mul, hc, Nat.cast_ofNat] + +omit [IsDomain B] [IsDiscreteValuationRing B] in +lemma branch_chain (D : Derivation K B B) (x y a b c d : B) + (h : a^2+x*b^2+y*c^2+x*y*d^2 = 0) : + (b^2+y*d^2) * D x + (c^2+x*d^2)*D y = 0 := by + have hh := congrArg D h + simp only [map_add, Derivation.leibniz, derivation_square, map_zero, zero_add] at hh + convert hh using 1 + simp only [smul_eq_mul] + ring + +lemma valuation_square_plus_le_square (D : Derivation K B B) (x c d : B) + (hx : 1 ≤ (v x)) : + (v (c^2+x*d^2)) ≤ (v (D x)) + (v (c^2)) := by + by_cases hc : c = 0 + · simp [hc] + have hcfin : (v c) ≠ ⊤ := (addVal_eq_top_iff (R := B)).not.mpr hc + have hcEq : (v c) = (v c).toNat := (ENat.natCast_toNat hcfin).symm + by_cases hcd : (v c) ≤ (v d) + · rw [valuation_square_plus_of_lower x c d _ hx hcEq (hcEq ▸ hcd)] + rw [addVal_pow, nsmul_eq_mul, Nat.cast_ofNat, hcEq] + exact le_add_of_nonneg_left zero_le + · have hdc : (v d) < (v c) := lt_of_not_ge hcd + have hdfin : (v d) ≠ ⊤ := ne_top_of_lt hdc + have hn : (v d).toNat < (v c).toNat := by + exact_mod_cast (by simpa only [ENat.natCast_toNat hcfin, ENat.natCast_toNat hdfin] using hdc : + ((v d).toNat : ℕ∞) < (v c).toNat) + have ht : (2 : ℕ∞)*(v d)+1 ≤ (v (c^2)) := by + rw [addVal_pow, nsmul_eq_mul, Nat.cast_ofNat, + ← ENat.natCast_toNat hcfin, ← ENat.natCast_toNat hdfin] + exact_mod_cast (by omega : 2*(v d).toNat+1 ≤ 2*(v c).toNat) + calc + (v (c^2+x*d^2)) ≤ (v (D x))+2*(v d)+1 := + valuation_square_plus_le D x c d + _ = (v (D x))+(2*(v d)+1) := by ac_rfl + _ ≤ (v (D x))+(v (c^2)) := add_le_add_right ht _ + +lemma valuation_square_plus_le_coordinate (D : Derivation K B B) (x y c d : B) + (hy : 1 ≤ (v y)) : + (v (c^2+x*d^2)) ≤ (v (D x)) + (v (y*d^2)) := by + have ht : (2 : ℕ∞)*(v d)+1 ≤ (v (y*d^2)) := by + rw [addVal_mul, addVal_pow, nsmul_eq_mul, Nat.cast_ofNat] + simpa only [add_comm] using add_le_add_left hy (2*(v d)) + calc + (v (c^2+x*d^2)) ≤ (v (D x))+2*(v d)+1 := + valuation_square_plus_le D x c d + _ = (v (D x))+(2*(v d)+1) := by ac_rfl + _ ≤ (v (D x))+(v (y*d^2)) := add_le_add_right ht _ + +theorem conductor_generators_valuation (D : Derivation K B B) (x y a b c d : B) + (hx : 1 ≤ (v x)) (hy : 1 ≤ (v y)) + (h : a^2+x*b^2+y*c^2+x*y*d^2 = 0) : + (v (c^2+x*d^2)) ≤ (v (D x)) + (v (a^2)) ∧ + (v (c^2+x*d^2)) ≤ (v (D x)) + (v (b^2)) ∧ + (v (c^2+x*d^2)) ≤ (v (D x)) + (v (c^2)) ∧ + (v (c^2+x*d^2)) ≤ (v (D x)) + (v (x*d^2)) ∧ + (v (c^2+x*d^2)) ≤ (v (D x)) + (v (y*d^2)) := by + have hc := valuation_square_plus_le_square D x c d hx + have hxd := valuation_square_plus_le_coordinate D x x c d hx + have hyd := valuation_square_plus_le_coordinate D x y c d hy + have hb : (v (c^2+x*d^2)) ≤ (v (D x))+(v (b^2)) := by + by_cases hdy : D y = 0 + · by_cases hdx : D x = 0 + · simp [hdx] + have he := branch_chain D x y a b c d h + rw [hdy, mul_zero, add_zero] at he + have hf := (mul_eq_zero.mp he).resolve_right hdx + have hby : b^2 = y*d^2 := CharTwo.add_eq_zero.mp hf + rw [hby] + exact hyd + have hb' := valuation_square_plus_le_square D y b d hy + have hh := branch_chain D x y a b c d h + have he := congrArg (addVal B) (CharTwo.add_eq_zero.mp hh) + rw [addVal_mul, addVal_mul] at he + have hdyle : (v (D y)) ≠ ⊤ := (addVal_eq_top_iff (R := B)).not.mpr hdy + apply ENat.add_le_add_iff_right hdyle |>.mp + calc + (v (c^2+x*d^2))+(v (D y)) = + (v (b^2+y*d^2))+(v (D x)) := he.symm + _ ≤ ((v (D y))+(v (b^2)))+(v (D x)) := + add_le_add_left hb' _ + _ = ((v (D x))+(v (b^2)))+(v (D y)) := by ac_rfl + refine ⟨?_,hb,hc,hxd,hyd⟩ + have ha : a^2 = x*b^2+y*c^2+x*y*d^2 := by + apply CharTwo.add_eq_zero.mp + convert h using 1 + ring + rw [ha] + have hxb : (v (c^2+x*d^2)) ≤ (v (D x))+(v (x*b^2)) := by + rw [addVal_mul] + exact hb.trans (add_le_add_right (le_add_of_nonneg_left zero_le) _) + have hyc : (v (c^2+x*d^2)) ≤ (v (D x))+(v (y*c^2)) := by + rw [addVal_mul] + exact hc.trans (add_le_add_right (le_add_of_nonneg_left zero_le) _) + have hxyd : (v (c^2+x*d^2)) ≤ (v (D x))+(v (x*y*d^2)) := by + rw [show x*y*d^2 = y*(x*d^2) by ring, addVal_mul] + exact hxd.trans (add_le_add_right (le_add_of_nonneg_left zero_le) _) + have hs : (v (c^2+x*d^2)) ≤ (v (D x))+ (v (x*b^2+y*c^2)) := by + have hh := le_min hxb hyc + rw [← add_min] at hh + exact hh.trans (add_le_add_right ((addVal B).map_add _ _) _) + have hh := le_min hs hxyd + rw [← add_min] at hh + exact hh.trans (add_le_add_right ((addVal B).map_add _ _) _) + +end PermanentBorder.FrobeniusDVR + +namespace PermanentBorder.FrobeniusDVR +open IsDiscreteValuationRing +variable {B : Type*} [CommRing B] [IsDomain B] [IsDiscreteValuationRing B] + +lemma mem_ideal_of_valuation_product {I : Ideal B} {g f z : B} + (hg : g ≠ 0) (h : I * Ideal.span {g} = Ideal.span {f}) + (hv : addVal B f ≤ addVal B g + addVal B z) : z ∈ I := by + have hm : z*g ∈ I * Ideal.span {g} := by + rw [h, Ideal.mem_span_singleton] + apply (addVal_le_iff_dvd (R := B)).mp + simpa only [addVal_mul, add_comm (addVal B z)] using hv + obtain ⟨v,hv,he⟩ := Ideal.mem_mul_span_singleton.mp hm + have he' : v = z := mul_right_cancel₀ hg he + rwa [he'] at hv + +end PermanentBorder.FrobeniusDVR + +namespace PermanentBorder.PlaneConductorDVR +open Polynomial IsDiscreteValuationRing +variable {K S Q L B : Type*} [CommRing K] [CommRing S] [IsDomain S] + [IsIntegrallyClosed S] [Field Q] [Algebra S Q] [IsFractionRing S Q] + [Field L] [Algebra Q L] [Algebra S L] [IsScalarTower S Q L] + [FiniteDimensional Q L] [Algebra.IsSeparable Q L] + [CommRing B] [IsDomain B] [IsDiscreteValuationRing B] + [Algebra S B] [Module.Finite S B] [Algebra B L] [IsScalarTower S B L] + [IsIntegralClosure B S L] [Module.IsTorsionFree S B] + [Algebra K B] [CharP B 2] + +include Q L in +omit [Module.Finite S B] in + +theorem four_form_conductor_membership (x y a b c d g : B) + (hygen : Algebra.adjoin Q {algebraMap B L y} = ⊤) + (hF : aeval y (minpoly S y).derivative = c^2+x*d^2) + (D : Derivation K B B) (hxD : D x = g) (hg : g ≠ 0) + (hdiff : differentIdeal S B = Ideal.span {g}) + (hx : 1 ≤ addVal B x) (hy : 1 ≤ addVal B y) + (h : a^2+x*b^2+y*c^2+x*y*d^2 = 0) : + a^2 ∈ conductor S y ∧ b^2 ∈ conductor S y ∧ c^2 ∈ conductor S y ∧ + x*d^2 ∈ conductor S y ∧ y*d^2 ∈ conductor S y := by + have hid := conductor_mul_differentIdeal S Q L y hygen + rw [hdiff, hF] at hid + have hv := FrobeniusDVR.conductor_generators_valuation D x y a b c d hx hy h + rw [hxD] at hv + exact ⟨FrobeniusDVR.mem_ideal_of_valuation_product hg hid hv.1, + FrobeniusDVR.mem_ideal_of_valuation_product hg hid hv.2.1, + FrobeniusDVR.mem_ideal_of_valuation_product hg hid hv.2.2.1, + FrobeniusDVR.mem_ideal_of_valuation_product hg hid hv.2.2.2.1, + FrobeniusDVR.mem_ideal_of_valuation_product hg hid hv.2.2.2.2⟩ + +end PermanentBorder.PlaneConductorDVR + +namespace PermanentBorder.FrobeniusDVR +open IsDiscreteValuationRing +variable {K B : Type*} [CommRing K] [CommRing B] [IsDomain B] + [IsDiscreteValuationRing B] [Algebra K B] [CharP B 2] +local notation "v" => addVal B + +lemma gradient_valuation (D : Derivation K B B) (x y a b c d : B) + (h : a^2+x*b^2+y*c^2+x*y*d^2 = 0) : + v (c^2+x*d^2) ≤ v (D x) + v (b^2+y*d^2) := by + by_cases hdy : D y = 0 + · have hh := branch_chain D x y a b c d h + rw [hdy,mul_zero,add_zero] at hh + rcases mul_eq_zero.mp hh with hf|hx + · simp [hf] + · simp [hx] + · have he := congrArg v (CharTwo.add_eq_zero.mp (branch_chain D x y a b c d h)) + rw [addVal_mul,addVal_mul] at he + calc + v (c^2+x*d^2) ≤ v (c^2+x*d^2) + v (D y) := le_add_of_nonneg_right zero_le + _ = v (D x)+v (b^2+y*d^2) := by rw [← he,add_comm] + +lemma radical_gradient_valuation (D : Derivation K B B) (x y a b c d z : B) + (h : a^2+x*b^2+y*c^2+x*y*d^2 = 0) + (hz : z ∈ (Ideal.span {b^2+y*d^2,c^2+x*d^2}).radical) : + v (c^2+x*d^2) ≤ v (D x) + v (d^2*z) := by + by_cases hz1 : 1 ≤ v z + · have hh := valuation_square_plus_le D x c d + rw [addVal_mul,addVal_pow,nsmul_eq_mul] + calc + v (c^2+x*d^2) ≤ v (D x)+2*v d+1 := hh + _ ≤ v (D x)+2*v d+v z := add_le_add le_rfl hz1 + _ = v (D x)+(2*v d+v z) := by ac_rfl + · have hz0 : v z = 0 := by + have hh := lt_of_not_ge hz1 + exact le_antisymm (Order.le_of_lt_add_one hh) zero_le + have hzu : IsUnit z := (addVal_eq_zero_iff (R := B)).mp hz0 + have hI : Ideal.span {b^2+y*d^2,c^2+x*d^2} = ⊤ := by + obtain ⟨n,hn⟩ := Ideal.mem_radical_iff.mp hz + exact (Ideal.span {b^2+y*d^2,c^2+x*d^2}).eq_top_of_isUnit_mem hn (hzu.pow n) + have hu : IsUnit (b^2+y*d^2) ∨ IsUnit (c^2+x*d^2) := by + by_contra! hh + have hm : Ideal.span {b^2+y*d^2,c^2+x*d^2} ≤ IsLocalRing.maximalIdeal B := by + apply Ideal.span_le.mpr + intro w hw + simp only [Set.mem_insert_iff,Set.mem_singleton_iff] at hw + rcases hw with rfl|rfl + · exact hh.1 + · exact hh.2 + rw [hI] at hm + exact (IsLocalRing.maximalIdeal.isMaximal B).ne_top (top_le_iff.mp hm) + rcases hu with hfx|hfy + · have hh := gradient_valuation D x y a b c d h + rw [(addVal_eq_zero_iff (R := B)).mpr hfx,add_zero] at hh + exact hh.trans (le_add_of_nonneg_right zero_le) + · rw [(addVal_eq_zero_iff (R := B)).mpr hfy] + exact zero_le + +theorem radical_gradient_conductor (D : Derivation K B B) + (x y a b c d g : B) (C : Ideal B) + (hx : D x = g) (hg : g ≠ 0) + (hC : C * Ideal.span {g} = Ideal.span {c^2+x*d^2}) + (h : a^2+x*b^2+y*c^2+x*y*d^2 = 0) : + b^2+y*d^2 ∈ C ∧ c^2+x*d^2 ∈ C ∧ + ∀ z ∈ (Ideal.span {b^2+y*d^2,c^2+x*d^2}).radical, d^2*z ∈ C := by + refine ⟨?_,?_,?_⟩ + · apply mem_ideal_of_valuation_product hg hC + simpa only [hx] using gradient_valuation D x y a b c d h + · apply mem_ideal_of_valuation_product hg hC + exact le_add_of_nonneg_left zero_le + · intro z hz + apply mem_ideal_of_valuation_product hg hC + simpa only [hx] using radical_gradient_valuation D x y a b c d z h hz + +end PermanentBorder.FrobeniusDVR +namespace PermanentBorder.FrobeniusDVR +open IsDiscreteValuationRing +variable {K B : Type*} [CommRing K] [CommRing B] [IsDedekindDomain B] + [Algebra K B] [CharP B 2] + +theorem radical_gradient_conductor_dedekind (D : Derivation K B B) + (x y a b c d g : B) (C : Ideal B) + (hx : D x = g) (hg : g ≠ 0) (hC0 : C ≠ ⊥) + (hC : C * Ideal.span {g} = Ideal.span {c^2+x*d^2}) + (h : a^2+x*b^2+y*c^2+x*y*d^2 = 0) : + b^2+y*d^2 ∈ C ∧ c^2+x*d^2 ∈ C ∧ + ∀ z ∈ (Ideal.span {b^2+y*d^2,c^2+x*d^2}).radical, d^2*z ∈ C := by + have hloc (P : Ideal B) [P.IsMaximal] (hP : P ≠ ⊥) : + let φ := algebraMap B (Localization.AtPrime P) + φ (b^2+y*d^2) ∈ C.map φ ∧ φ (c^2+x*d^2) ∈ C.map φ ∧ + ∀ z ∈ (Ideal.span {b^2+y*d^2,c^2+x*d^2}).radical, + φ (d^2*z) ∈ C.map φ := by + let T := Localization.AtPrime P + let φ := algebraMap B T + have : IsDiscreteValuationRing T := + IsLocalization.AtPrime.isDiscreteValuationRing_of_dedekind_domain B hP T + have hinj : Function.Injective φ := IsLocalization.injective T P.primeCompl_le_nonZeroDivisors + have : CharP T 2 := charP_of_injective_algebraMap hinj 2 + let D' := NormalizationDerivation.extendEtale (T := T) D + have hx' : D' (φ x) = φ g := by + simp only [D',φ,NormalizationDerivation.extendEtale_algebraMap,hx] + have hC' : C.map φ * Ideal.span {φ g} = Ideal.span {(φ c)^2+φ x*(φ d)^2} := by + have hh := congrArg (Ideal.map φ) hC + rw [Ideal.map_mul φ C (Ideal.span {g})] at hh + simpa only [Ideal.map_span,Set.image_singleton,map_add,map_mul,map_pow] using hh + have h' : (φ a)^2+φ x*(φ b)^2+φ y*(φ c)^2+φ x*φ y*(φ d)^2 = 0 := by + simpa only [map_add,map_mul,map_pow,map_zero] using congrArg φ h + obtain ⟨hfx,hfy,hz⟩ := radical_gradient_conductor D' (φ x) (φ y) + (φ a) (φ b) (φ c) (φ d) (φ g) (C.map φ) hx' (by simpa only [map_zero] using hinj.ne hg) hC' h' + refine ⟨by simpa only [map_add,map_mul,map_pow] using hfx, + by simpa only [map_add,map_mul,map_pow] using hfy,?_⟩ + intro z hzm + have hz' : φ z ∈ (Ideal.span {(φ b)^2+φ y*(φ d)^2, + (φ c)^2+φ x*(φ d)^2}).radical := by + have hh := Ideal.map_radical_le φ (Ideal.mem_map_of_mem φ hzm) + simpa only [Ideal.map_span,Set.image_insert_eq,Set.image_singleton, + map_add,map_mul,map_pow] using hh + simpa only [map_mul,map_pow] using hz (φ z) hz' + have hmem (z : B) + (hz : ∀ (P : Ideal B) [P.IsMaximal], P ≠ ⊥ → + algebraMap B (Localization.AtPrime P) z ∈ + C.map (algebraMap B (Localization.AtPrime P))) : z ∈ C := by + apply Ideal.mem_of_localization_maximal + intro P hP + by_cases hP0 : P = ⊥ + · have hCt : C = ⊤ := by + by_contra hCt + exact hC0 ((hP.eq_of_le hCt (hP0 ▸ bot_le)).symm.trans hP0) + exact Ideal.mem_map_of_mem _ (hCt ▸ Submodule.mem_top) + · exact hz P hP0 + refine ⟨hmem _ (fun P _ hP => (hloc P hP).1), + hmem _ (fun P _ hP => (hloc P hP).2.1),?_⟩ + intro z hz + exact hmem _ (fun P _ hP => (hloc P hP).2.2 z hz) + +end PermanentBorder.FrobeniusDVR +namespace PermanentBorder.ReducedBranchConductor +open Polynomial +section Branch +variable {K S Q L B : Type*} [CommRing K] [CommRing S] [IsDomain S] + [IsIntegrallyClosed S] [IsLocalRing S] [IsAlgClosed (IsLocalRing.ResidueField S)] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + [Field L] [Algebra Q L] [Algebra S L] [IsScalarTower S Q L] + [FiniteDimensional Q L] [Algebra.IsSeparable Q L] + [CommRing B] [IsDedekindDomain B] [IsPrincipalIdealRing B] + [Algebra S B] [Module.Finite S B] [Algebra B L] [IsScalarTower S B L] + [IsIntegralClosure B S L] [Module.IsTorsionFree S B] + [Algebra K S] [Algebra K B] [IsScalarTower K S B] [CharP B 2] + +include Q L in + +theorem branch_conductor (δ : Derivation K S S) (x : S) (hx : δ x = 1) + (y a b c d : B) (f w : S[X]) + (hygen : Algebra.adjoin Q {algebraMap B L y} = ⊤) + (hfactor : f = minpoly S y * w) + (hsep : (f.map (algebraMap S Q)).Separable) + (hfy : aeval y f.derivative = c^2+algebraMap S B x*d^2) + (h : a^2+algebraMap S B x*b^2+y*c^2+algebraMap S B x*y*d^2=0) : + let J := conductor S y * Ideal.span {aeval y w} + b^2+y*d^2 ∈ J ∧ c^2+algebraMap S B x*d^2 ∈ J ∧ + ∀ z ∈ (Ideal.span {b^2+y*d^2,c^2+algebraMap S B x*d^2}).radical, + d^2*z ∈ J := by + have hyf : aeval y f = 0 := by + rw [hfactor,map_mul,minpoly.aeval,zero_mul] + have hder0 : aeval y f.derivative ≠ 0 := by + have hz : aeval (algebraMap B L y) (f.map (algebraMap S Q)) = 0 := by + rw [aeval_map_algebraMap] + change aeval ((IsScalarTower.toAlgHom S B L) y) f = 0 + rw [aeval_algHom_apply,hyf,map_zero] + have hh := hsep.aeval_derivative_ne_zero hz + intro he + apply hh + rw [derivative_map,aeval_map_algebraMap] + change aeval ((IsScalarTower.toAlgHom S B L) y) f.derivative = 0 + rw [aeval_algHom_apply,he,map_zero] + obtain ⟨g,D,hgD,hD⟩ := + NormalizationDerivation.exists_scaled_normalization_derivation (Q := Q) (L := L) (B := B) δ + have hd : conductor S y * Ideal.span {g} = Ideal.span {aeval y (minpoly S y).derivative} := by + rw [← hgD] + exact conductor_mul_differentIdeal S Q L y hygen + have hJ : (conductor S y * Ideal.span {aeval y w}) * Ideal.span {g} = + Ideal.span {c^2+algebraMap S B x*d^2} := by + rw [mul_right_comm,hd,Ideal.span_singleton_mul_span_singleton,← map_mul] + rw [← hfy] + congr 1 + simp only [hfactor,derivative_mul,map_add,map_mul,minpoly.aeval,zero_mul,add_zero] + have hg : g ≠ 0 := by + intro hg + rw [hg,Ideal.span_singleton_zero,Ideal.mul_bot] at hJ + have hz : c^2+algebraMap S B x*d^2=0 := Ideal.span_singleton_eq_bot.mp hJ.symm + exact hder0 (hfy.trans hz) + have hJ0 : conductor S y * Ideal.span {aeval y w} ≠ ⊥ := by + intro hJ0 + rw [hJ0,Ideal.bot_mul] at hJ + exact hder0 (hfy.trans (Ideal.span_singleton_eq_bot.mp hJ.symm)) + apply FrobeniusDVR.radical_gradient_conductor_dedekind D + (algebraMap S B x) y a b c d g _ _ hg hJ0 hJ h + rw [hD,hx,map_one,mul_one] +end Branch +end PermanentBorder.ReducedBranchConductor + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Main.lean b/lean/OAI/Algebra/Determinantal/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..13b95d6252d035a0dd1b58530ea49324a8da2edd --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Main.lean @@ -0,0 +1,393 @@ +import OAI.Algebra.Determinantal.ConductorDimension +import OAI.Algebra.Determinantal.InitialForm + +namespace OAI + +namespace PermanentBorder.SpectralPlane +open Polynomial MvPolynomial Matrix +variable {K ι : Type*} [Field K] [Fintype ι] [DecidableEq ι] + +noncomputable def slope (θ : ι → K) : Matrix ι ι (MvPolynomial (Fin 2) K) := + Matrix.diagonal (fun i => BinaryLeading.linear (θ i)) +noncomputable def matrix (θ : ι → K) (A : Matrix ι ι K) : Matrix ι ι (MvPolynomial (Fin 2) K) := + slope θ + A.map MvPolynomial.C +noncomputable def equation (θ : ι → K) (A : Matrix ι ι K) : MvPolynomial (Fin 2) K := + (matrix θ A).det + +lemma scale_C (c : K) : PlaneScaling.scale (MvPolynomial.C c : MvPolynomial (Fin 2) K) = + Polynomial.C (MvPolynomial.C c) := by + simp only [PlaneScaling.scale,MvPolynomial.aeval_C] + rfl + +lemma scale_linear (t : K) : PlaneScaling.scale (BinaryLeading.linear t) = + Polynomial.C (BinaryLeading.linear t)*Polynomial.X := by + simp [PlaneScaling.scale,BinaryLeading.linear] + ring + +omit [Fintype ι] in +lemma scale_matrix (θ : ι → K) (A : Matrix ι ι K) : + (matrix θ A).map PlaneScaling.scale = + (Polynomial.X : (MvPolynomial (Fin 2) K)[X]) • (slope θ).map Polynomial.C + + (A.map MvPolynomial.C).map Polynomial.C := by + apply Matrix.ext + intro i j + by_cases h : i=j + · subst j + simp only [Matrix.map_apply,matrix,slope,Matrix.add_apply, + Matrix.diagonal_apply_eq,Matrix.smul_apply,smul_eq_mul,map_add,scale_linear,scale_C] + change Polynomial.C (BinaryLeading.linear (θ i))*Polynomial.X + + Polynomial.C (MvPolynomial.C (A i i)) = + Polynomial.X*Polynomial.C (BinaryLeading.linear (θ i)) + + Polynomial.C (MvPolynomial.C (A i i)) + rw [mul_comm (Polynomial.C _) Polynomial.X] + · simp only [Matrix.map_apply,matrix,slope,Matrix.add_apply, + Matrix.diagonal_apply_ne _ h,Matrix.smul_apply,smul_eq_mul,map_zero,zero_add,mul_zero] + exact scale_C _ + +lemma totalDegree_equation (θ : ι → K) (A : Matrix ι ι K) : + (equation θ A).totalDegree ≤ Fintype.card ι := by + apply PlaneScaling.degree_le_of_scale + have hmap := RingHom.map_det PlaneScaling.scale.toRingHom (matrix θ A) + change PlaneScaling.scale (equation θ A) = ((matrix θ A).map PlaneScaling.scale).det at hmap + rw [hmap,scale_matrix] + exact Polynomial.natDegree_det_X_add_C_le _ _ + +lemma leading_equation (θ : ι → K) (A : Matrix ι ι K) : + homogeneousComponent (Fintype.card ι) (equation θ A) = ∏ i, BinaryLeading.linear (θ i) := by + have hmap := RingHom.map_det PlaneScaling.scale.toRingHom (matrix θ A) + change PlaneScaling.scale (equation θ A) = ((matrix θ A).map PlaneScaling.scale).det at hmap + rw [← PlaneScaling.coeff_scale,hmap,scale_matrix,Polynomial.coeff_det_X_add_C_card] + exact Matrix.det_diagonal + +lemma to_charpoly (θ : ι → K) (A : Matrix ι ι K) : + PlaneBivariate.toBivariate K (equation θ A) = + (-((Polynomial.X : K[X]) • (Matrix.diagonal θ).map Polynomial.C + + A.map Polynomial.C)).charpoly := by + have hmap := RingHom.map_det (PlaneBivariate.toBivariate K).toRingHom (matrix θ A) + change PlaneBivariate.toBivariate K (equation θ A) = + ((matrix θ A).map (PlaneBivariate.toBivariate K)).det at hmap + rw [hmap,Matrix.charpoly] + congr 1 + apply Matrix.ext + intro i j + by_cases h : i=j + · subst j + simp [matrix,slope,BinaryLeading.linear,Matrix.charmatrix] + ring + · simp [matrix,slope,BinaryLeading.linear,Matrix.charmatrix,h] + +omit [DecidableEq ι] in +lemma homogeneous_leading (θ : ι → K) : + (∏ i, BinaryLeading.linear (θ i)).IsHomogeneous (Fintype.card ι) := by + classical + simpa only [Finset.sum_const,Finset.card_univ,smul_eq_mul,mul_one] using + MvPolynomial.IsHomogeneous.prod Finset.univ (fun i => BinaryLeading.linear (θ i)) + (fun _ : ι => 1) (fun i _ => (isHomogeneous_X K 1).add + ((isHomogeneous_X K 0).C_mul (θ i))) + +omit [DecidableEq ι] in +lemma map_leading {L : Type*} [Field L] [Algebra K L] (θ : ι → K) : + (∏ i, BinaryLeading.linear (θ i)).map (algebraMap K L) = + ∏ i, BinaryLeading.linear (algebraMap K L (θ i)) := by + simp [BinaryLeading.linear] + +end PermanentBorder.SpectralPlane + +namespace PermanentBorder.SpectralDimension +open MvPolynomial Polynomial Matrix +open Conductor AdjugateAlgebra DeterminantFibers SpectralPlane FrobeniusPlane CurveFamily +open scoped Classical +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +lemma curveField_le_of_inField (E : IntermediateField K L) (f : Plane L) + (hf : CurveFamily.InField E f) : + curveCoefficientField (K := K) (PlaneBivariate.toBivariate L f) ≤ E := by + obtain ⟨f₀,hf₀⟩ := CurveFamily.inField_lift E hf + have hb : Bivariate.InField E (PlaneBivariate.toBivariate L f) := by + apply (Bivariate.inField_iff_lifts E _).mpr + refine ⟨PlaneBivariate.toBivariate E f₀,?_⟩ + rw [← hf₀] + change (PlaneBivariate.toBivariate E f₀).map (Polynomial.mapRingHom (algebraMap E L)) = + PlaneBivariate.toBivariate L (MvPolynomial.map (algebraMap E L) f₀) + exact (PlaneBivariate.map_to E f₀).symm + apply IntermediateField.adjoin_le_iff.mpr + rintro c ⟨⟨i,j⟩,rfl⟩ + exact hb i j + +lemma to_pencil_det {k : ℕ} (θ : Fin (k+1) → L) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) : + PlaneBivariate.toBivariate L (SpectralPlane.equation θ A) = + (pencilMatrix (pencilBase θ A)).det := by + rw [SpectralPlane.to_charpoly,Matrix.charpoly] + congr 1 + apply Matrix.ext + intro i j + by_cases hij : i=j <;> simp [Matrix.charmatrix,pencilMatrix,pencilBase,Matrix.scalar_apply,hij] + ring + +variable [CharP K 2] [CharP L 2] [PerfectRing K 2] [Infinite K] [IsAlgClosed L] + +theorem spectral_effective_bound {k : ℕ} (hk : 4 ≤ k+1) + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) L) (T : ℕ) + (hT : (T : ℕ∞) ≤ normalizationDefect (fun i => algebraMap K L (θ i)) A) : + ∃ n : ℕ, Algebra.trdeg K (curveCoefficientField (K := K) + (pencilMatrix (pencilBase (fun i => algebraMap K L (θ i)) A)).det) ≤ (n : Cardinal) ∧ + 18*n+T ≤ 9*((k+1)*(k+2)) := by + let θL : Fin (k+1) → L := fun i => algebraMap K L (θ i) + have hθL : Function.Injective θL := (algebraMap K L).injective.comp hθ + let f := SpectralPlane.equation θL A + obtain ⟨a,b,c,d,he⟩ := exists_squareForm f + have hdeg : (squareForm a b c d).totalDegree ≤ k+1 := by + rw [← he] + simpa only [f,Fintype.card_fin] using SpectralPlane.totalDegree_equation θL A + have hlead : homogeneousComponent (k+1) (squareForm a b c d) = + ∏ i, BinaryLeading.linear (θL i) := by + rw [← he] + simpa only [f,Fintype.card_fin] using SpectralPlane.leading_equation θL A + have hsf := BinaryLeading.squarefree_product θL hθL + have hnz := BinaryLeading.product_nonzero θL + have hpz := BinaryLeading.product_partial_nonzero θL hθL + have hcop := BinaryLeading.product_partial_coprime θL hθL + have hs' : Squarefree (homogeneousComponent (k+1) (squareForm a b c d)) := hlead.symm ▸ hsf + have hn' : homogeneousComponent (k+1) (squareForm a b c d) ≠ 0 := hlead.symm ▸ hnz + have hp' : pderiv 1 (homogeneousComponent (k+1) (squareForm a b c d)) ≠ 0 := hlead.symm ▸ hpz + have hc' : IsRelPrime (homogeneousComponent (k+1) (squareForm a b c d)) + (pderiv 1 (homogeneousComponent (k+1) (squareForm a b c d))) := hlead.symm ▸ hcop + let := CurveFamily.singular_finite (squareForm a b c d) (by omega) hdeg hn' hp' hc' + let := CurveFamily.finite_zeroLocus (singularIdeal (squareForm a b c d)) + let := Fintype.ofFinite (zeroLocus L (singularIdeal (squareForm a b c d))) + let := CurveFamily.halfIdeal_finite hk hdeg hs' + obtain ⟨E,n,hE,htr,hnum⟩ := CurveFamily.half_curve_parameter_bound hk hdeg hs' hn' hp' hc' + (∏ i, BinaryLeading.linear (θ i)) (by simpa only [Fintype.card_fin] using SpectralPlane.homogeneous_leading θ) + (hlead.trans (SpectralPlane.map_leading θ).symm) + have hmon : (PlaneBivariate.toBivariate L (squareForm a b c d)).Monic := by + rw [← he,SpectralPlane.to_charpoly] + exact Matrix.charpoly_monic _ + have hsep : ((PlaneBivariate.toBivariate L (squareForm a b c d)).map + (algebraMap L[X] (FractionRing L[X]))).Separable := by + rw [← he,SpectralPlane.to_charpoly] + exact PencilSeparability.distinct_slope_pencil_separable θL hθL A + have hnorm := Conductor.normalization_length_le_half a b c d hmon hsep + have hnorm' : normalizationDefect θL A ≤ + (5*Module.finrank L (Plane L ⧸ halfIdeal a b c d) + + Fintype.card {x : zeroLocus L (singularIdeal (squareForm a b c d)) // eval x.val d≠0} : ℕ) := by + let D (p : L[X][X]) (hp : p.Monic) : ℕ∞ := + let R := integralClosure L[X] (AdjoinRoot (p.map (algebraMap L[X] (FractionRing L[X])))) + Module.length L (R ⧸ LinearMap.range + (normalizationInclusion (Q := FractionRing L[X]) p hp).toLinearMap) + have hD (p q : L[X][X]) (hp : p.Monic) (hq : q.Monic) (heq : p=q) : + D p hp = D q hq := by subst q; rfl + have hp : PlaneBivariate.toBivariate L (squareForm a b c d) = + (-pencilBase θL A).charpoly := by rw [← he,SpectralPlane.to_charpoly]; rfl + change D _ hmon ≤ _ at hnorm + change D _ (Matrix.charpoly_monic _) ≤ _ + rw [← hD _ _ hmon (Matrix.charpoly_monic _) hp] + exact hnorm + have hTN : T ≤ 5*Module.finrank L (Plane L ⧸ halfIdeal a b c d) + + Fintype.card {x : zeroLocus L (singularIdeal (squareForm a b c d)) // eval x.val d≠0} := by + exact_mod_cast hT.trans hnorm' + simp only [Nat.add_assoc,Nat.reduceAdd] at hnum + refine ⟨n,?_,by omega⟩ + have hfE : CurveFamily.InField E f := he.symm ▸ hE + have hle := curveField_le_of_inField E f hfE + rw [to_pencil_det] at hle + exact (trdeg_le_of_injective (IntermediateField.inclusion hle) (IntermediateField.inclusion_injective hle)).trans htr + +end PermanentBorder.SpectralDimension + +namespace PermanentBorder.SpectralDimension +open MvPolynomial Polynomial Matrix +open Conductor AdjugateAlgebra DeterminantFibers +universe u + +lemma effective_matrix_budget {k n T : ℕ} (h : 18*n+T ≤ 9*((k+1)*(k+2))) : + n+(k+1).choose 2 ≤ (k+1)^2-T/18 := by + have hc : 2*((k+1).choose 2)=(k+1)*k := by + have heven : 2 ∣ (k+1)*k := by simpa [mul_comm] using (Nat.even_mul_succ_self k).two_dvd + rw [Nat.choose_two_right,Nat.add_sub_cancel,Nat.mul_div_cancel' heven] + have hdiv := Nat.div_mul_le_self T 18 + have hsum : n+(k+1).choose 2+T/18 ≤ (k+1)^2 := by nlinarith + omega + +theorem critical_dimension_effective {K : Type u} [Field K] [Infinite K] + [CharP K 2] [PerfectRing K 2] {k q : ℕ} (hk : 4 ≤ k+1) (hq : 3*q ≤ k) + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) : + ringKrullDim (MvPolynomial (Fin (k+1) × Fin (k+1)) K ⧸ gradientIdeal K θ q) ≤ + (((k+1)^2-(q+2).choose 2/18 : ℕ) : WithBot ℕ∞) := by + classical + apply AlgebraicDimension.krullDim_le_of_field_images (K := K) + intro L _ _ f + let Ω := AlgebraicClosure L + let : CharP Ω 2 := charP_of_injective_algebraMap (algebraMap K Ω).injective 2 + let ι : L →ₐ[K] Ω := IsScalarTower.toAlgHom K L Ω + let f' := ι.comp f + let g := f'.comp (Ideal.Quotient.mkₐ K (gradientIdeal K θ q)) + let A : Matrix (Fin (k+1)) (Fin (k+1)) Ω := fun a b => g (MvPolynomial.X (a,b)) + have hc := field_point_critical θ f' + have hθΩ : Function.Injective (fun i => algebraMap K Ω (θ i)) := + (algebraMap K Ω).injective.comp hθ + have hd : ((q+2).choose 2 : ℕ∞) ≤ + normalizationDefect (fun i => algebraMap K Ω (θ i)) A := + Selector.gradient_forces_normalization_defect hq _ hθΩ A hc + obtain ⟨n,hn,hnum⟩ := spectral_effective_bound hk θ hθ A ((q+2).choose 2) hd + obtain ⟨F,hF,hAF⟩ := matrix_field_bound_over_curve θ hθ A (by omega) n hn + have hg : g.range ≤ F.toSubalgebra := by + apply DeterminantFiberScheme.range_le_of_variables_mem + rintro ⟨i,j⟩ + exact hAF i j + let h : f.range →ₐ[K] Ω := ι.comp f.range.val + have hmem : ∀ z, h z ∈ F.toSubalgebra := by + rintro ⟨z,x,hx⟩ + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective x + apply hg + exact ⟨p, congrArg ι hx⟩ + let hFmap := h.codRestrict F.toSubalgebra hmem + have hinj : Function.Injective hFmap := by + intro x y heq + apply Subtype.ext + exact (FaithfulSMul.algebraMap_injective L Ω) (congrArg Subtype.val heq) + refine ((trdeg_le_of_injective hFmap hinj).trans hF).trans ?_ + exact_mod_cast effective_matrix_budget hnum + +end PermanentBorder.SpectralDimension + +namespace PermanentBorder.EffectiveParameters +open PermanentBorder.Parameters + +def sectionSize (k : ℕ) : ℕ := (selectorIndex k+2).choose 2 / 18 + +lemma sectionSize_bounds {k : ℕ} (hk : 128 ≤ k) : + 2 ≤ sectionSize k ∧ sectionSize k ≤ k^2 ∧ + (k : ℝ)^2 / 330 ≤ ((sectionSize k-1 : ℕ) : ℝ) := by + let q := selectorIndex k + let T := (q+2).choose 2 + let d := sectionSize k + have hq : 3*q ≤ k-1 ∧ k ≤ 3*(q+1) := by + dsimp [q,selectorIndex] + omega + have hq40 : 40 ≤ q := by omega + have hT : 2*T=(q+2)*(q+1) := by + dsimp [T] + have heven : 2 ∣ (q+2)*(q+1) := by + simpa [Nat.add_assoc,mul_comm] using (Nat.even_mul_succ_self (q+1)).two_dvd + rw [Nat.choose_two_right,show q+2-1=q+1 by omega,Nat.mul_div_cancel' heven] + have hTlarge : 36 ≤ T := by nlinarith + have hd2 : 2 ≤ d := by dsimp [d,sectionSize]; change 2 ≤ T/18; omega + have hTd : T < 18*(d+1) := by dsimp [T,d,sectionSize,q]; omega + have hdT : d ≤ T := by dsimp [T,d,sectionSize,q]; omega + have hTk : T ≤ k^2 := by + have hh := Nat.mul_le_mul (show q+2≤k by omega) (show q+1≤k by omega) + nlinarith + have hdR : ((d-1 : ℕ) : ℝ) = (d : ℝ)-1 := by rw [Nat.cast_sub (by omega),Nat.cast_one] + have hTkR : (k : ℝ) ≤ 3*((q : ℝ)+1) := by exact_mod_cast hq.2 + have hTdR : (T : ℝ) ≤ 18*((d : ℝ)+1) := by exact_mod_cast Nat.le_of_lt hTd + have hTR : 2*(T : ℝ)=((q : ℝ)+2)*((q : ℝ)+1) := by exact_mod_cast hT + have hkR : (128 : ℝ) ≤ k := by exact_mod_cast hk + have hTlower : (k : ℝ)*((k : ℝ)+3) ≤ 18*T := by + have hm := mul_le_mul hTkR (by linarith : (k : ℝ)+3 ≤ 3*((q : ℝ)+2)) + (by positivity : (0:ℝ) ≤ (k : ℝ)+3) (by positivity : (0:ℝ) ≤ 3*((q : ℝ)+1)) + nlinarith + refine ⟨hd2,hdT.trans hTk,?_⟩ + change (k : ℝ)^2/330 ≤ ((d-1 : ℕ) : ℝ) + rw [hdR] + have hk2 : (16384 : ℝ) ≤ (k : ℝ)^2 := by nlinarith + nlinarith + +lemma degree_effective_bound {k : ℕ} (hk : 128 ≤ k) : + (33 : ℝ)*(k : ℝ)/100 ≤ ((k-2*selectorIndex k-1 : ℕ) : ℝ) := by + have hq : 3*selectorIndex k ≤ k-1 := by dsimp [selectorIndex]; omega + have hqk : 2*selectorIndex k+1 ≤ k := by omega + have he : ((k-2*selectorIndex k-1 : ℕ) : ℝ) = (k : ℝ)-2*(selectorIndex k : ℝ)-1 := by + rw [Nat.cast_sub (by omega),Nat.cast_sub (by omega)] + norm_cast + have hqR : 3*(selectorIndex k : ℝ) ≤ (k : ℝ)-1 := by + have : 3*selectorIndex k+1 ≤ k := by omega + have hh : 3*(selectorIndex k : ℝ)+1 ≤ (k : ℝ) := by exact_mod_cast this + linarith + have hkR : (128 : ℝ) ≤ k := by exact_mod_cast hk + rw [he] + linarith + +theorem explicit_constant {m : ℕ} (hm : 1408 ≤ m) : + (m : ℝ)^3 / (5529600 * Real.exp 1) ≤ + (((auxiliarySize m-2*selectorIndex (auxiliarySize m)-1 : ℕ) : ℝ)* + ((sectionSize (auxiliarySize m)-1 : ℕ) : ℝ)) / (4*Real.exp 1) := by + let k := auxiliarySize m + have hk : 128 ≤ k := (Parameters.size_bound hm).1 + have hr := degree_effective_bound hk + have hd := (sectionSize_bounds hk).2.2 + have hprod : (k : ℝ)^3/1000 ≤ + ((k-2*selectorIndex k-1 : ℕ) : ℝ)*((sectionSize k-1 : ℕ) : ℝ) := by + have hmul := mul_le_mul hr hd (by positivity : (0:ℝ) ≤ (k : ℝ)^2/330) + (by positivity : (0:ℝ) ≤ ((k-2*selectorIndex k-1 : ℕ) : ℝ)) + nlinarith + have hmkN : m ≤ 11*k+10 := by dsimp [k,auxiliarySize]; omega + have hkR : (128 : ℝ) ≤ k := by exact_mod_cast hk + have hmk : (m : ℝ) ≤ 111*(k : ℝ)/10 := by + have : (m : ℝ) ≤ 11*(k : ℝ)+10 := by exact_mod_cast hmkN + linarith + have hcubes : (m : ℝ)^3 ≤ (111*(k : ℝ)/10)^3 := + pow_le_pow_left₀ (by positivity) hmk 3 + have he := Real.exp_pos (1 : ℝ) + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + change (m : ℝ)^3*(4*Real.exp 1) ≤ _ + dsimp [k] at hprod hcubes ⊢ + nlinarith [show (0:ℝ) ≤ (auxiliarySize m : ℝ)^3 by positivity] + +end PermanentBorder.EffectiveParameters + +namespace PermanentBorder +open Parameters EffectiveParameters SpectralDimension MvPolynomial + +theorem exists_effective_critical_bound {K : Type} [Field K] [Infinite K] + [CharP K 2] [PerfectRing K 2] {d : ℕ} (hd : 128 ≤ d) : + ∃ θ : Fin d → K, + ringKrullDim (MvPolynomial (Variables d) K ⧸ + Ideal.span (Set.range (fun i => pderiv i + (Selector.diagonalCoefficient + (Matrix.of fun a b => (X (a,b) : MvPolynomial (Variables d) K)) + (fun i => C (θ i)) (selectorIndex d))))) ≤ + ((d^2-sectionSize d : ℕ) : WithBot ℕ∞) := by + classical + cases d with + | zero => omega + | succ k => + let θ : Fin (k+1) → K := fun i => Infinite.natEmbedding K i.val + have hθ : Function.Injective θ := by + intro i j hij + exact Fin.ext ((Infinite.natEmbedding K).injective hij) + have hq : 3*selectorIndex (k+1) ≤ k := by dsimp [selectorIndex]; omega + exact ⟨θ,critical_dimension_effective (by omega) hq θ hθ⟩ + +theorem permanent_border_cubic_lower_bound (m n : ℕ) (hm : 1408 ≤ m) + (h : HasBorderDeterminant n (permanentPolynomial m)) : + (m : ℝ)^3 / (5529600 * Real.exp 1) ≤ (n : ℝ) := by + let k := auxiliarySize m + have hk : 128 ≤ k := (Parameters.size_bound hm).1 + obtain ⟨θ,hdim⟩ := exists_effective_critical_bound (K := AlgebraicClosure (ZMod 2)) hk + have hs := EffectiveParameters.sectionSize_bounds hk + have hi := Parameters.index_bounds hk + have hB : k^2-sectionSize k+(sectionSize k-1) < k^2 := by omega + apply (EffectiveParameters.explicit_constant hm).trans + exact h.selector_lower_of_critical_dimension + (by omega : 0 < k) (by have := Nat.div_le_self k 2; omega : selectorIndex k ≤ k) + hi.2.2.2 hs.1 (by have := (Parameters.size_bound hm).2.2; omega) + θ hdim hB + +theorem permanent_exact_cubic_lower_bound (m n : ℕ) (hm : 1408 ≤ m) + (h : HasExactDeterminant n (permanentPolynomial m)) : + (m : ℝ)^3 / (5529600 * Real.exp 1) ≤ (n : ℝ) := + permanent_border_cubic_lower_bound m n hm h.hasBorderDeterminant + +theorem permanent_cubic_lower_bounds : + (∀ (m n : ℕ), 1408 ≤ m → HasBorderDeterminant n (permanentPolynomial m) → + (m : ℝ)^3 / (5529600 * Real.exp 1) ≤ (n : ℝ)) ∧ + (∀ (m n : ℕ), 1408 ≤ m → HasExactDeterminant n (permanentPolynomial m) → + (m : ℝ)^3 / (5529600 * Real.exp 1) ≤ (n : ℝ)) := + ⟨permanent_border_cubic_lower_bound, permanent_exact_cubic_lower_bound⟩ + +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Model.lean b/lean/OAI/Algebra/Determinantal/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..1999cbba754ed154e6521e73091c3cea575c1ace --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Model.lean @@ -0,0 +1,363 @@ +import OAI.Algebra.Determinantal.RankTransfer + +namespace OAI + +namespace PermanentBorder.Polar +open scoped Classical +variable {ι : Type*} [Fintype ι] + +lemma isInvertible_of_injective (D : (ι → ℂ) →L[ℂ] (ι → ℂ)) + (hD : Function.Injective D) : D.IsInvertible := by + have hs : Function.Surjective D := (LinearMap.injective_iff_surjective).mp hD + let e := LinearEquiv.ofBijective D.toLinearMap ⟨hD,hs⟩ + exact ⟨e.toContinuousLinearEquiv, rfl⟩ + +lemma normalizer_simple_restrict + (e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ)) + (F : (Option ι → ℂ) → (Option ι → ℂ)) + (hfirst : ∀ y, F y none = e y none - 1) (z : ι → ℂ) + (hF : DifferentiableAt ℂ F (affineNormChart e z)) + (hs : (fderiv ℂ F (affineNormChart e z)).IsInvertible) : + (fderiv ℂ (fun z i => F (affineNormChart e z) (some i)) z).IsInvertible := by + let D := (fderiv ℂ F (affineNormChart e z)).comp + (e.symm.toContinuousLinearMap.comp optionInsert) + have hfull : HasFDerivAt (fun z => F (affineNormChart e z)) D z := + hF.hasFDerivAt.comp z (affineNormChart_hasFDerivAt e z) + let E : (ι → ℂ) →L[ℂ] (ι → ℂ) := + ContinuousLinearMap.pi (fun i => (ContinuousLinearMap.proj (some i)).comp D) + have hred : HasFDerivAt (fun z i => F (affineNormChart e z) (some i)) E z := + hasFDerivAt_pi.mpr (fun i => (ContinuousLinearMap.proj (some i) : (Option ι → ℂ) →L[ℂ] ℂ).hasFDerivAt.comp z hfull) + have hzero : (fun z => F (affineNormChart e z) none) = fun _ => (0 : ℂ) := by + funext z + rw [hfirst, affineNormChart, e.apply_symm_apply] + simp + have hnone : (ContinuousLinearMap.proj none).comp D = 0 := by + have hd := (ContinuousLinearMap.proj none : (Option ι → ℂ) →L[ℂ] ℂ).hasFDerivAt.comp z hfull + change HasFDerivAt (fun z => F (affineNormChart e z) none) _ z at hd + rw [hzero] at hd + exact hd.unique (hasFDerivAt_const _ _) + rw [hred.fderiv] + apply isInvertible_of_injective + apply LinearMap.ker_eq_bot.mp + apply LinearMap.ker_eq_bot'.mpr + intro v hv + have hd : D v = 0 := by + funext i + cases i with + | none => exact congrArg (fun T : (ι → ℂ) →L[ℂ] ℂ => T v) hnone + | some i => exact congrFun hv i + have he : e.symm (optionInsert v) = 0 := hs.injective (hd.trans (map_zero _).symm) + have hi : optionInsert v = 0 := e.symm.injective (he.trans (map_zero _).symm) + exact funext (fun i => congrFun hi (some i)) + +end PermanentBorder.Polar +namespace PermanentBorder.Polar +open MvPolynomial +open scoped Classical +variable {τ : Type*} [Fintype τ] + +theorem smooth_polar_affine_certificate (f : MvPolynomial (PolarVars τ) ℂ) + {r : ℕ} (hr : 2 ≤ r) (hh : f.IsHomogeneous r) + (hs : ∀ y : PolarVars τ → ℂ, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) : + ∃ w : τ → PolarVars τ → ℂ, + ∃ e : (PolarVars τ → ℂ) ≃L[ℂ] (PolarVars τ → ℂ), + ∃ x : Fin (r * (r-1)^Fintype.card τ) → Option τ → ℂ, + Function.Injective x ∧ + ∀ i, (fun j => eval (affineNormChart e (x i)) (hypersurfacePolars w f j)) = 0 ∧ + (fderiv ℂ (fun z j => eval (affineNormChart e z) + (hypersurfacePolars w f j)) (x i)).IsInvertible := by + classical + obtain ⟨w,l,hg,hcard⟩ := smooth_polar_count f hr hh hs + let R := CI.Roots (hypersurfacePolars w f) l + have hpos : 0 < Nat.card R := by + rw [show Nat.card R = _ from hcard] + exact Nat.mul_pos (by omega) (Nat.pow_pos (by omega)) + have : Finite R := (Nat.card_pos_iff.mp hpos).2 + let : Fintype R := Fintype.ofFinite R + have hcard' : Fintype.card R = r * (r-1)^Fintype.card τ := by + simpa only [Nat.card_eq_fintype_card] using hcard + let q : Fin (r * (r-1)^Fintype.card τ) ≃ R := (Fintype.equivFinOfCardEq hcard').symm + have hl : l ≠ 0 := by + intro hz + obtain ⟨y⟩ := (Nat.card_pos_iff.mp hpos).1 + have hy := y.property.2 + simp [CI.eval_linear, hz] at hy + obtain ⟨e,he⟩ := exists_normalizer_equiv l hl + have hy (i : Fin (r * (r-1)^Fintype.card τ)) : e (q i).val none = 1 := by + rw [he, ← CI.eval_linear] + exact (q i).property.2 + choose x hx using fun i => exists_chart_preimage e (hy i) + refine ⟨w,e,x,?_,?_⟩ + · intro i j hij + apply q.injective + apply Subtype.ext + rw [← hx i, ← hx j, hij] + · intro i + have hz : (fun j => eval (q i).val (CI.normalized (hypersurfacePolars w f) l j)) = 0 := + (CI.normalized_eval_zero_iff _ _ _).mpr (q i).property + constructor + · rw [hx i] + exact funext (q i).property.1 + · have hfirst (y : PolarVars τ → ℂ) : + eval y (CI.normalized (hypersurfacePolars w f) l none) = e y none - 1 := by + change eval y (CI.linear l - 1) = _ + rw [map_sub, map_one, CI.eval_linear, he] + apply normalizer_simple_restrict e + (fun y j => eval y (CI.normalized (hypersurfacePolars w f) l j)) hfirst (x i) + · exact ((contDiff_pi.mpr (fun j => CI.contDiff_eval + (CI.normalized (hypersurfacePolars w f) l j))).differentiable (by decide)) _ + · rw [hx i] + exact CI.good_derivative_invertible _ _ _ hg hz + +end PermanentBorder.Polar + +namespace PermanentBorder + +open Filter +open scoped Topology + +abbrev Variables (m : ℕ) := Fin m × Fin m +abbrev Poly (σ : Type*) := MvPolynomial σ ℂ + +noncomputable def permanentPolynomial (m : ℕ) : Poly (Variables m) := + ∑ τ : Equiv.Perm (Fin m), ∏ i : Fin m, MvPolynomial.X (i, τ i) + +noncomputable def affineMatrixPolynomial {σ : Type*} [Fintype σ] (n : ℕ) + (A₀ : Matrix (Fin n) (Fin n) ℂ) + (A : σ → Matrix (Fin n) (Fin n) ℂ) : Poly σ := + Matrix.det (fun i j => MvPolynomial.C (A₀ i j) + + ∑ v : σ, MvPolynomial.C (A v i j) * MvPolynomial.X v) + +def HasBorderDeterminant {σ : Type*} [Fintype σ] (n : ℕ) (p : Poly σ) : Prop := + 0 < n ∧ ∃ (A₀ : ℕ → Matrix (Fin n) (Fin n) ℂ) + (A : ℕ → σ → Matrix (Fin n) (Fin n) ℂ), + ∀ d : σ →₀ ℕ, Tendsto + (fun j => (affineMatrixPolynomial n (A₀ j) (A j)).coeff d) + atTop (𝓝 (p.coeff d)) + +def HasExactDeterminant {σ : Type*} [Fintype σ] (n : ℕ) (p : Poly σ) : Prop := + 0 < n ∧ ∃ (A₀ : Matrix (Fin n) (Fin n) ℂ) + (A : σ → Matrix (Fin n) (Fin n) ℂ), affineMatrixPolynomial n A₀ A = p + +theorem HasExactDeterminant.hasBorderDeterminant {σ : Type*} [Fintype σ] + {n : ℕ} {p : Poly σ} (h : HasExactDeterminant n p) : + HasBorderDeterminant n p := by + rcases h with ⟨hn, A₀, A, hp⟩ + refine ⟨hn, (fun _ => A₀), (fun _ => A), ?_⟩ + intro d + simpa only [hp] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ => p.coeff d) atTop (𝓝 (p.coeff d))) + +end PermanentBorder + +namespace PermanentBorder +open MvPolynomial Filter +open scoped Topology + +section FixedCoefficientSpace +variable {σ τ : Type*} [Fintype σ] + +noncomputable def exponentCube (n : ℕ) : Finset (σ →₀ ℕ) := + by + classical + exact Finset.Iic (Finsupp.equivFunOnFinite.symm (fun _ : σ => n)) + +@[simp] theorem mem_exponentCube (n : ℕ) (d : σ →₀ ℕ) : + d ∈ exponentCube (σ := σ) n ↔ ∀ i, d i ≤ n := by + classical + simp only [exponentCube, Finset.mem_Iic, Finsupp.le_def] + rfl + +theorem support_subset_exponentCube {P : Poly σ} {n : ℕ} (hP : P.totalDegree ≤ n) : + P.support ⊆ exponentCube n := by + intro d hd + rw [mem_exponentCube] + intro i + exact (monomial_le_degreeOf i hd).trans ((degreeOf_le_totalDegree P i).trans hP) + +theorem sum_over_exponentCube {P : Poly σ} {n : ℕ} + (hP : P.support ⊆ exponentCube n) : + P = ∑ d ∈ exponentCube n, monomial d (P.coeff d) := by + calc + P = ∑ d ∈ P.support, monomial d (P.coeff d) := MvPolynomial.as_sum P + _ = _ := ?_ + apply Finset.sum_subset hP + intro d _ hd + simp only [notMem_support_iff.mp hd, map_zero] + +theorem coeff_linear_map_cube (F : Poly σ →ₗ[ℂ] Poly τ) {P : Poly σ} {n : ℕ} + (hP : P.support ⊆ exponentCube n) (e : τ →₀ ℕ) : + (F P).coeff e = ∑ d ∈ exponentCube n, + P.coeff d * (F (monomial d 1)).coeff e := by + conv_lhs => rw [sum_over_exponentCube hP] + simp only [map_sum, coeff_sum] + apply Finset.sum_congr rfl + intro d _ + rw [show monomial d (P.coeff d) = P.coeff d • monomial d (1 : ℂ) by simp [smul_monomial], + map_smul, coeff_smul, smul_eq_mul] + +theorem support_subset_cube_of_limit {P : ℕ → Poly σ} {p : Poly σ} {n : ℕ} + (hP : ∀ j, (P j).support ⊆ exponentCube n) + (hp : ∀ d, Tendsto (fun j => (P j).coeff d) atTop (𝓝 (p.coeff d))) : + p.support ⊆ exponentCube n := by + classical + intro d hd + by_contra hn + have hz : ∀ j, (P j).coeff d = 0 := by + intro j + apply notMem_support_iff.mp + exact fun hj => hn (hP j hj) + have ht : Tendsto (fun _ : ℕ => (0 : ℂ)) atTop (𝓝 (p.coeff d)) := by + simpa only [hz] using hp d + have he : p.coeff d = 0 := (tendsto_nhds_unique tendsto_const_nhds ht).symm + exact mem_support_iff.mp hd he + +theorem coefficientwise_linear_map_limit (F : Poly σ →ₗ[ℂ] Poly τ) + {P : ℕ → Poly σ} {p : Poly σ} {n : ℕ} + (hP : ∀ j, (P j).support ⊆ exponentCube n) + (hp : ∀ d, Tendsto (fun j => (P j).coeff d) atTop (𝓝 (p.coeff d))) : + ∀ e, Tendsto (fun j => (F (P j)).coeff e) atTop (𝓝 ((F p).coeff e)) := by + intro e + have hc := support_subset_cube_of_limit hP hp + have ht := tendsto_finsetSum (exponentCube (σ := σ) n) + (fun d _ => (hp d).mul (tendsto_const_nhds (x := (F (monomial d 1)).coeff e))) + convert ht using 1 + · funext j + exact coeff_linear_map_cube F (hP j) e + · congr 1 + exact coeff_linear_map_cube F hc e +end FixedCoefficientSpace + +section DeterminantDegree +variable {σ : Type*} [Fintype σ] + +theorem degree_affine_form (b : ℂ) (a : σ → ℂ) : + (C b + ∑ v : σ, C (a v) * X v : Poly σ).totalDegree ≤ 1 := by + apply (totalDegree_add _ _).trans + apply max_le + · simp + · apply totalDegree_finsetSum_le + intro v _ + exact (totalDegree_mul _ _).trans (by simp) + +theorem degree_affineMatrixPolynomial (n : ℕ) + (A₀ : Matrix (Fin n) (Fin n) ℂ) (A : σ → Matrix (Fin n) (Fin n) ℂ) : + (affineMatrixPolynomial n A₀ A).totalDegree ≤ n := by + classical + unfold affineMatrixPolynomial + have he := Matrix.det_apply (show Matrix (Fin n) (Fin n) (Poly σ) from + fun i j => C (A₀ i j) + ∑ v, C (A v i j) * X v) + rw [he] + apply totalDegree_finsetSum_le + intro s _ + apply (totalDegree_smul_le _ _).trans + apply (totalDegree_finsetProd _ _).trans + calc + _ ≤ ∑ _ : Fin n, 1 := Finset.sum_le_sum fun i _ => degree_affine_form _ _ + _ = n := by simp +end DeterminantDegree + +section AffineSubstitution +variable {σ τ : Type*} [Fintype σ] [Fintype τ] + +noncomputable def affineSubstitution (b : σ → ℂ) (B : σ → τ → ℂ) : + Poly σ →ₐ[ℂ] Poly τ := + MvPolynomial.aeval (fun v => C (b v) + ∑ w : τ, C (B v w) * X w) + +theorem affineSubstitution_matrix (b : σ → ℂ) (B : σ → τ → ℂ) + (n : ℕ) (A₀ : Matrix (Fin n) (Fin n) ℂ) (A : σ → Matrix (Fin n) (Fin n) ℂ) : + affineSubstitution b B (affineMatrixPolynomial n A₀ A) = + affineMatrixPolynomial n + (fun i j => A₀ i j + ∑ v : σ, A v i j * b v) + (fun w i j => ∑ v : σ, A v i j * B v w) := by + classical + unfold affineMatrixPolynomial + have he := RingHom.map_det (affineSubstitution b B).toRingHom + (show Matrix (Fin n) (Fin n) (Poly σ) from + fun i j => C (A₀ i j) + ∑ v, C (A v i j) * X v) + refine he.trans ?_ + apply congrArg Matrix.det + funext i j + change (affineSubstitution b B) (C (A₀ i j) + ∑ v, C (A v i j) * X v) = + C (A₀ i j + ∑ v, A v i j * b v) + ∑ w, C (∑ v, A v i j * B v w) * X w + simp only [affineSubstitution, map_add, map_sum, map_mul, + aeval_C, aeval_X, algebraMap_eq] + simp only [mul_add, Finset.mul_sum, Finset.sum_add_distrib, ← map_mul] + rw [← add_assoc] + congr 1 + rw [Finset.sum_comm] + simp only [Finset.sum_mul, map_mul, mul_assoc] + +theorem HasBorderDeterminant.affineSubstitution {n : ℕ} {p : Poly σ} + (h : HasBorderDeterminant n p) (b : σ → ℂ) (B : σ → τ → ℂ) : + HasBorderDeterminant n (affineSubstitution b B p) := by + classical + obtain ⟨hn, A₀, A, hlim⟩ := h + refine ⟨hn, + (fun l i j => A₀ l i j + ∑ v : σ, A l v i j * b v), + (fun l w i j => ∑ v : σ, A l v i j * B v w), ?_⟩ + have hf := coefficientwise_linear_map_limit (PermanentBorder.affineSubstitution b B).toLinearMap + (fun l => support_subset_exponentCube (degree_affineMatrixPolynomial n (A₀ l) (A l))) hlim + intro e + simpa only [AlgHom.toLinearMap_apply, affineSubstitution_matrix] using hf e +end AffineSubstitution +end PermanentBorder + +namespace PermanentBorder +open MvPolynomial Filter +open scoped Topology + +section ScalarNormalization +variable {σ : Type*} [Fintype σ] + +theorem affineMatrixPolynomial_scaleRow (n : ℕ) (i₀ : Fin n) (a : ℂ) + (A₀ : Matrix (Fin n) (Fin n) ℂ) (A : σ → Matrix (Fin n) (Fin n) ℂ) : + affineMatrixPolynomial n (A₀.updateRow i₀ (a • A₀ i₀)) + (fun v => (A v).updateRow i₀ (a • A v i₀)) = + a • affineMatrixPolynomial n A₀ A := by + classical + let M : Matrix (Fin n) (Fin n) (Poly σ) := + fun i j => C (A₀ i j) + ∑ v, C (A v i j) * X v + let M' : Matrix (Fin n) (Fin n) (Poly σ) := fun i j => + C ((A₀.updateRow i₀ (a • A₀ i₀)) i j) + + ∑ v, C (((A v).updateRow i₀ (a • A v i₀)) i j) * X v + have hM : M' = M.updateRow i₀ ((C a : Poly σ) • M i₀) := by + funext i j + change C ((A₀.updateRow i₀ (a • A₀ i₀)) i j) + (∑ v, + C (((A v).updateRow i₀ (a • A v i₀)) i j) * X v) = _ + by_cases hi : i = i₀ + · subst i + rw [Matrix.updateRow_self, Matrix.updateRow_self] + simp only [Matrix.updateRow_self, Pi.smul_apply, smul_eq_mul, map_mul] + change _ = C a * (C (A₀ i₀ j) + ∑ v, C (A v i₀ j) * X v) + simp only [mul_add, Finset.mul_sum, mul_assoc] + · rw [Matrix.updateRow_ne hi, Matrix.updateRow_ne hi] + simp only [Matrix.updateRow_ne hi] + rfl + change M'.det = a • M.det + rw [hM] + rw [Matrix.det_updateRow_smul] + rw [Matrix.updateRow_eq_self] + exact (MvPolynomial.smul_eq_C_mul M.det a).symm + +theorem HasBorderDeterminant.smul {n : ℕ} {p : Poly σ} + (h : HasBorderDeterminant n p) (a : ℂ) : HasBorderDeterminant n (a • p) := by + classical + obtain ⟨hn, A₀, A, hlim⟩ := h + let i₀ : Fin n := ⟨0, hn⟩ + refine ⟨hn, (fun l => (A₀ l).updateRow i₀ (a • A₀ l i₀)), + (fun l v => (A l v).updateRow i₀ (a • A l v i₀)), ?_⟩ + intro e + simp only [affineMatrixPolynomial_scaleRow, coeff_smul, smul_eq_mul] + exact tendsto_const_nhds.mul (hlim e) + +theorem HasBorderDeterminant.affineSubstitution_smul + {τ : Type*} [Fintype τ] {n : ℕ} {p : Poly σ} + (h : HasBorderDeterminant n p) (b : σ → ℂ) (B : σ → τ → ℂ) (a : ℂ) : + HasBorderDeterminant n (a • PermanentBorder.affineSubstitution b B p) := + (h.affineSubstitution b B).smul a +end ScalarNormalization +end PermanentBorder + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Monogenic.lean b/lean/OAI/Algebra/Determinantal/Monogenic.lean new file mode 100644 index 0000000000000000000000000000000000000000..94fb21f1fdb3ba80981dfde807883546d87d4471 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Monogenic.lean @@ -0,0 +1,421 @@ +import OAI.Algebra.Determinantal.FiberDimension + +namespace OAI + +namespace PermanentBorder.NormalizationMonogenic +open Polynomial + +section Nilpotent +variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] + +lemma adjoin_eq_top_of_nilpotent_reduction (u : A) (p : R[X]) + (hp : IsNilpotent (aeval u p)) + (h : ∀ z : A, ∃ q : R[X], ∃ w : A, z = aeval u q + aeval u p * w) : + Algebra.adjoin R {u} = ⊤ := by + have hd (n : ℕ) (z : A) : + ∃ q : R[X], ∃ w : A, z = aeval u q + (aeval u p)^n*w := by + induction n with + | zero => exact ⟨0,z,by simp⟩ + | succ n ih => + obtain ⟨q,w,hw⟩ := ih + obtain ⟨r,v,hv⟩ := h w + refine ⟨q+p^n*r,v,?_⟩ + rw [hw,hv] + simp only [map_add,map_mul,map_pow,pow_succ] + ring + rcases hp with ⟨n,hn⟩ + rw [Algebra.adjoin_singleton_eq_range_aeval, AlgHom.range_eq_top] + intro z + obtain ⟨q,w,hw⟩ := hd n z + exact ⟨q,by simpa [hn] using hw.symm⟩ + +end Nilpotent + +section Local +variable {K A : Type*} [Field K] [IsAlgClosed K] [CommRing A] + [Algebra K A] [Module.Finite K A] [IsLocalRing A] + +lemma adjoin_uniformizer_eq_top (u : A) + (hu : IsLocalRing.maximalIdeal A = Ideal.span {u}) : + Algebra.adjoin K {u} = ⊤ := by + have : IsArtinianRing A := IsArtinianRing.of_finite K A + have hj : IsNilpotent (IsLocalRing.maximalIdeal A) := by + rw [← IsLocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal A) bot_ne_top] + exact IsArtinianRing.isNilpotent_jacobson_bot + have hnil : IsNilpotent u := by + obtain ⟨n,hn⟩ := hj + refine ⟨n,?_⟩ + have hh : u^n ∈ (IsLocalRing.maximalIdeal A)^n := + Ideal.pow_mem_pow (by rw [hu]; exact Ideal.subset_span (by simp)) n + simpa [hn] using hh + apply adjoin_eq_top_of_nilpotent_reduction u X (by simpa using hnil) + intro z + have : Module.Finite K (IsLocalRing.ResidueField A) := inferInstance + obtain ⟨c,hc⟩ := (IsAlgClosed.algebraMap_bijective_of_isIntegral + (k := K) (K := IsLocalRing.ResidueField A)).2 (IsLocalRing.residue A z) + have hm : z - algebraMap K A c ∈ IsLocalRing.maximalIdeal A := by + rw [← IsLocalRing.residue_eq_zero_iff] + rw [map_sub, sub_eq_zero] + rw [IsScalarTower.algebraMap_apply K A (IsLocalRing.ResidueField A)] at hc + exact hc.symm + rw [hu,Ideal.mem_span_singleton] at hm + obtain ⟨w,hw⟩ := hm + refine ⟨C c,w,?_⟩ + simpa only [aeval_C,aeval_X] using (sub_eq_iff_eq_add.mp hw).trans (add_comm _ _) + +end Local + +section Nakayama +variable {A : Type*} [CommRing A] [IsNoetherianRing A] + +lemma nilradical_eq_span_of_mod_square + (ρ v a : A) (hρ : Ideal.span {ρ} = nilradical A) + (ha : a ∈ nilradical A) (hr : ρ - v*a ∈ (nilradical A)^2) : + nilradical A = Ideal.span {a} := by + apply le_antisymm + · apply Submodule.le_of_le_smul_of_le_jacobson_bot + (IsNoetherian.noetherian (nilradical A)) Ideal.radical_le_jacobson + nth_rw 1 [← hρ] + rw [Ideal.span_le] + intro z hz + have heq : z = ρ := Set.mem_singleton_iff.mp hz + subst z + change ρ ∈ Ideal.span {a} ⊔ nilradical A • nilradical A + have hr' : ρ - v*a ∈ Ideal.span {a} ⊔ nilradical A • nilradical A := by + apply Submodule.mem_sup_right + simpa only [Ideal.smul_eq_mul, pow_two] using hr + have hvp : v*a ∈ Ideal.span {a} ⊔ nilradical A • nilradical A := + Submodule.mem_sup_left (Ideal.mul_mem_left _ _ (Ideal.subset_span (by simp))) + simpa using (Ideal.span {a} ⊔ nilradical A • nilradical A).add_mem hr' hvp + · exact Ideal.span_le.mpr (by simpa using ha) + +end Nakayama + +section Global +variable {K A : Type*} [Field K] [IsAlgClosed K] [CommRing A] + [Algebra K A] [Module.Finite K A] [IsPrincipalIdealRing A] + +lemma exists_adjoin_eq_top : ∃ u : A, Algebra.adjoin K {u} = ⊤ := by + classical + have : IsArtinianRing A := IsArtinianRing.of_finite K A + have : IsNoetherianRing A := IsNoetherianRing.of_finite K A + let J := nilradical A + let ρ := Submodule.IsPrincipal.generator J + have hJρ : Ideal.span {ρ} = J := Submodule.IsPrincipal.span_singleton_generator J + have hρ : ρ ∈ J := by rw [← hJρ]; exact Ideal.subset_span (by simp) + let ι := MaximalSpectrum A + let : Fintype ι := Fintype.ofFinite _ + let θ : ι → K := fun i => Infinite.natEmbedding K ((Fintype.equivFin ι) i).val + have hθ : Function.Injective θ := (Infinite.natEmbedding K).injective.comp + (Fin.val_injective.comp (Fintype.equivFin ι).injective) + have hcop : Pairwise (fun i j : ι => IsCoprime (i.asIdeal ^ 2) (j.asIdeal ^ 2)) := + fun i j hij => (i.isCoprime_of_ne hij).pow + obtain ⟨u,hu⟩ := Ideal.pi_quotient_surjective hcop + (fun i => Ideal.Quotient.mk (i.asIdeal ^ 2) (algebraMap K A (θ i) + ρ)) + let p : K[X] := ∏ i : ι, (X - C (θ i)) + have hp0 (i : ι) : p.eval (θ i) = 0 := by + simp only [p, eval_prod, eval_sub, eval_X, eval_C] + exact Finset.prod_eq_zero (Finset.mem_univ i) (sub_self _) + have hp' (i : ι) : p.derivative.eval (θ i) ≠ 0 := by + simpa only [eval₂_id] using + (separable_prod_X_sub_C_iff.mpr hθ).eval₂_derivative_ne_zero + (RingHom.id K) (by simpa only [eval₂_id] using hp0 i) + have hρi (i : ι) : ρ ∈ i.asIdeal := by + exact nilradical_le_prime i.asIdeal hρ + have hut (i : ι) : Ideal.Quotient.mk i.asIdeal u = + algebraMap K (A ⧸ i.asIdeal) (θ i) := by + have h := congrArg (Ideal.Quotient.factor (Ideal.pow_le_self (by decide : 2 ≠ 0))) (hu i) + change Ideal.Quotient.mk i.asIdeal u = Ideal.Quotient.mk i.asIdeal + (algebraMap K A (θ i) + ρ) at h + simpa [map_add, Ideal.Quotient.eq_zero_iff_mem.mpr (hρi i)] using h + have hpu (i : ι) : Ideal.Quotient.mk (i.asIdeal ^ 2) (aeval u p) = + algebraMap K (A ⧸ i.asIdeal ^ 2) (p.derivative.eval (θ i)) * + Ideal.Quotient.mk (i.asIdeal ^ 2) ρ := by + have hn : (Ideal.Quotient.mk (i.asIdeal ^ 2) ρ)^2 = 0 := by + rw [← map_pow, Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.pow_mem_pow (hρi i) 2 + change (Ideal.Quotient.mkₐ K (i.asIdeal ^ 2)) (aeval u p) = _ + rw [← aeval_algHom_apply, Ideal.Quotient.mkₐ_eq_mk, hu i, map_add] + change aeval (algebraMap K _ (θ i) + Ideal.Quotient.mk (i.asIdeal^2) ρ) p = _ + rw [aeval_add_of_sq_eq_zero _ _ _ hn] + simp only [aeval_algebraMap_apply_eq_algebraMap_eval, hp0, map_zero, zero_add] + obtain ⟨v,hv⟩ := Ideal.pi_quotient_surjective hcop + (fun i => algebraMap K (A ⧸ i.asIdeal^2) ((p.derivative.eval (θ i))⁻¹)) + have hr : ρ - v * aeval u p ∈ J^2 := by + rw [show J^2 = ⨅ i : ι, i.asIdeal^2 from IsArtinianRing.nilradical_pow_eq_iInf A 2] + simp only [Ideal.mem_iInf] + intro i + rw [← Ideal.Quotient.eq_zero_iff_mem, map_sub, map_mul, hv i, hpu, + ← mul_assoc, ← map_mul, inv_mul_cancel₀ (hp' i), map_one, one_mul, sub_self] + have hpJ : aeval u p ∈ J := by + rw [show J = ⨅ i : ι, i.asIdeal from IsArtinianRing.nilradical_eq_iInf A] + simp only [Ideal.mem_iInf] + intro i + rw [← Ideal.Quotient.eq_zero_iff_mem] + change (Ideal.Quotient.mkₐ K i.asIdeal) (aeval u p) = 0 + rw [← aeval_algHom_apply, Ideal.Quotient.mkₐ_eq_mk, hut, + aeval_algebraMap_apply_eq_algebraMap_eval, hp0, map_zero] + have hJp : J = Ideal.span {aeval u p} := + nilradical_eq_span_of_mod_square ρ v (aeval u p) hJρ hpJ hr + refine ⟨u, adjoin_eq_top_of_nilpotent_reduction u p ?_ ?_⟩ + · exact mem_nilradical.mp hpJ + · intro z + let (i : ι) : Field (A ⧸ i.asIdeal) := Ideal.Quotient.field _ + choose c hc using fun i : ι => + (IsAlgClosed.algebraMap_bijective_of_isIntegral + (k := K) (K := A ⧸ i.asIdeal)).2 (Ideal.Quotient.mk i.asIdeal z) + let q := Lagrange.interpolate Finset.univ θ c + have hq (i : ι) : q.eval (θ i) = c i := + Lagrange.eval_interpolate_at_node _ hθ.injOn (Finset.mem_univ i) + have hz : z - aeval u q ∈ J := by + rw [show J = ⨅ i : ι, i.asIdeal from IsArtinianRing.nilradical_eq_iInf A] + simp only [Ideal.mem_iInf] + intro i + rw [← Ideal.Quotient.eq_zero_iff_mem, map_sub, sub_eq_zero] + change _ = (Ideal.Quotient.mkₐ K i.asIdeal) (aeval u q) + rw [← aeval_algHom_apply, Ideal.Quotient.mkₐ_eq_mk, hut, + aeval_algebraMap_apply_eq_algebraMap_eval, hq, hc] + rw [hJp,Ideal.mem_span_singleton] at hz + obtain ⟨w,hw⟩ := hz + exact ⟨q,w,by linear_combination hw⟩ + +end Global +end PermanentBorder.NormalizationMonogenic + +namespace PermanentBorder.NormalizationMonogenic +open Polynomial +section LocalLift +variable {S B : Type*} [CommRing S] [IsLocalRing S] [CommRing B] + [Algebra S B] [Module.Finite S B] + +lemma adjoin_eq_top_of_residue_surjective (u : B) + (hu : Function.Surjective fun p : S[X] => + Ideal.Quotient.mk ((IsLocalRing.maximalIdeal S).map (algebraMap S B)) (aeval u p)) : + Algebra.adjoin S {u} = ⊤ := by + let A := Algebra.adjoin S {u} + have him : (Ideal.Quotient.mk ((IsLocalRing.maximalIdeal S).map (algebraMap S B))) '' + (A : Set B) = Set.univ := by + apply Set.eq_univ_of_forall + intro z + obtain ⟨p,hp⟩ := hu z + refine ⟨aeval u p, ?_, hp⟩ + change aeval u p ∈ Algebra.adjoin S {u} + rw [Algebra.adjoin_singleton_eq_range_aeval] + exact ⟨p,rfl⟩ + have hspan := (IsLocalRing.quotient_span_eq_top_iff_span_eq_top (S := B) (A : Set B)).mp + (by rw [him]; exact Submodule.span_univ) + apply Subalgebra.toSubmodule_injective + change A.toSubmodule = ⊤ + change Submodule.span S (A.toSubmodule : Set B) = ⊤ at hspan + simpa only [Submodule.span_eq] using hspan + +lemma exists_adjoin_eq_top_of_residue_principal + [IsAlgClosed (IsLocalRing.ResidueField S)] + [IsPrincipalIdealRing (B ⧸ (IsLocalRing.maximalIdeal S).map (algebraMap S B))] : + ∃ u : B, Algebra.adjoin S {u} = ⊤ := by + let J := (IsLocalRing.maximalIdeal S).map (algebraMap S B) + let Q := B ⧸ J + let K := IsLocalRing.ResidueField S + let : Algebra K Q := Ideal.Quotient.algebraQuotientOfLEComap (Ideal.le_comap_map) + have : IsScalarTower S K Q := IsScalarTower.of_algebraMap_eq fun x => rfl + have : Module.Finite K Q := Module.Finite.of_restrictScalars_finite S K Q + obtain ⟨v,hv⟩ := exists_adjoin_eq_top (K := K) (A := Q) + obtain ⟨u,hu⟩ := Ideal.Quotient.mk_surjective v + refine ⟨u, adjoin_eq_top_of_residue_surjective u ?_⟩ + intro z + rw [Algebra.adjoin_singleton_eq_range_aeval, AlgHom.range_eq_top] at hv + obtain ⟨p,hp⟩ := hv z + obtain ⟨p',hp'⟩ := Polynomial.map_surjective (IsLocalRing.residue S) + Ideal.Quotient.mk_surjective p + refine ⟨p', ?_⟩ + change (Ideal.Quotient.mkₐ S J) (aeval u p') = z + rw [← aeval_algHom_apply, Ideal.Quotient.mkₐ_eq_mk, hu] + rw [← hp, ← hp'] + exact (aeval_map_algebraMap K v p').symm + +lemma exists_adjoin_eq_top_of_principal [IsPrincipalIdealRing B] + [IsAlgClosed (IsLocalRing.ResidueField S)] : + ∃ u : B, Algebra.adjoin S {u} = ⊤ := by + have : IsPrincipalIdealRing (B ⧸ (IsLocalRing.maximalIdeal S).map (algebraMap S B)) := + IsPrincipalIdealRing.of_surjective (Ideal.Quotient.mk _) Ideal.Quotient.mk_surjective + exact exists_adjoin_eq_top_of_residue_principal +end LocalLift +end PermanentBorder.NormalizationMonogenic + +namespace PermanentBorder.NormalizationDerivation +open Polynomial TensorProduct + +section Localization +variable {R S T : Type*} [CommRing R] [CommRing S] [CommRing T] + [Algebra R S] [Algebra R T] [Algebra S T] [IsScalarTower R S T] + [Algebra.FormallyEtale S T] + +noncomputable def extendEtale (d : Derivation R S S) : Derivation R T T := + ((TensorProduct.AlgebraTensorModule.rid S T T).toLinearMap.comp + ((d.liftKaehlerDifferential.baseChange T).comp + (KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale R S T).symm.toLinearMap)).compDer + (KaehlerDifferential.D R T) + +@[simp] lemma extendEtale_algebraMap (d : Derivation R S S) (s : S) : + extendEtale (T := T) d (algebraMap S T s) = algebraMap S T (d s) := by + simp only [extendEtale, Derivation.coe_comp, LinearMap.comp_apply, + LinearMap.restrictScalars_apply, Derivation.coeFn_coe, + LinearEquiv.coe_coe, KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale_symm_D_algebraMap, + LinearMap.baseChange_tmul, Derivation.liftKaehlerDifferential_comp_D, + TensorProduct.AlgebraTensorModule.rid_tmul, Algebra.smul_def, mul_one] + +end Localization + +section Polynomial +variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S] + +noncomputable def coeffDeriv (d : Derivation R S S) : Derivation R S[X] S[X] := + PolynomialModule.equivPolynomialSelf.compDer d.mapCoeffs + +@[simp] lemma coeffDeriv_coeff (d : Derivation R S S) (p : S[X]) (i : ℕ) : + (coeffDeriv d p).coeff i = d (p.coeff i) := rfl + +@[simp] lemma coeffDeriv_C (d : Derivation R S S) (s : S) : + coeffDeriv d (C s) = C (d s) := by + ext i + simp only [coeffDeriv_coeff, coeff_C] + split_ifs <;> simp + +@[simp] lemma coeffDeriv_X (d : Derivation R S S) : + coeffDeriv d (X : S[X]) = 0 := by + ext i + simp only [coeffDeriv_coeff, coeff_X, coeff_zero] + split_ifs <;> simp + +noncomputable def hamiltonian (d : Derivation R S S) (p : S[X]) : + Derivation R S[X] S[X] := + p.derivative • coeffDeriv d - (coeffDeriv d p) • (derivative'.restrictScalars R) + +lemma hamiltonian_self (d : Derivation R S S) (p : S[X]) : hamiltonian d p p = 0 := by + simp only [hamiltonian, Derivation.sub_apply, Derivation.smul_apply, + Derivation.restrictScalars_apply, derivative'_apply, smul_eq_mul] + ring + +@[simp] lemma hamiltonian_C (d : Derivation R S S) (p : S[X]) (s : S) : + hamiltonian d p (C s) = p.derivative * C (d s) := by + simp [hamiltonian] + +@[simp] lemma hamiltonian_X (d : Derivation R S S) (p : S[X]) : + hamiltonian d p X = -(coeffDeriv d p) := by + simp [hamiltonian] + +lemma hamiltonian_preserves_equation (d : Derivation R S S) (p q : S[X]) + (hq : p ∣ q) : p ∣ hamiltonian d p q := by + obtain ⟨q,rfl⟩ := hq + rw [Derivation.leibniz, hamiltonian_self] + simp only [smul_eq_mul, mul_zero, add_zero] + exact dvd_mul_right _ _ + +end Polynomial + +section Monogenic +variable {R S B : Type*} [CommRing R] [CommRing S] [CommRing B] + [Algebra R S] [Algebra R B] [Algebra S B] [IsScalarTower R S B] + +noncomputable def scaledExtension (d : Derivation R S S) (u : B) (p : S[X]) + (hu : Algebra.adjoin S {u} = ⊤) + (hp : ∀ q : S[X], aeval u q = 0 ↔ p ∣ q) : Derivation R B B := + Derivation.liftOfSurjective + (f := (aeval u).restrictScalars R) + (by change Function.Surjective (aeval u : S[X] →ₐ[S] B) + rwa [← AlgHom.range_eq_top, ← Algebra.adjoin_singleton_eq_range_aeval]) + (d := hamiltonian d p) + (fun q hq => (hp _).mpr (hamiltonian_preserves_equation d p q ((hp q).mp hq))) + +lemma scaledExtension_aeval (d : Derivation R S S) (u : B) (p q : S[X]) + (hu : Algebra.adjoin S {u} = ⊤) + (hp : ∀ q : S[X], aeval u q = 0 ↔ p ∣ q) : + scaledExtension d u p hu hp (aeval u q) = aeval u (hamiltonian d p q) := + by + unfold scaledExtension + apply Derivation.liftOfSurjective_apply + +@[simp] lemma scaledExtension_algebraMap (d : Derivation R S S) (u : B) (p : S[X]) + (hu : Algebra.adjoin S {u} = ⊤) + (hp : ∀ q : S[X], aeval u q = 0 ↔ p ∣ q) (s : S) : + scaledExtension d u p hu hp (algebraMap S B s) = + aeval u p.derivative * algebraMap S B (d s) := by + rw [← aeval_C u s, scaledExtension_aeval, hamiltonian_C, map_mul, aeval_C] + +@[simp] lemma scaledExtension_generator (d : Derivation R S S) (u : B) (p : S[X]) + (hu : Algebra.adjoin S {u} = ⊤) + (hp : ∀ q : S[X], aeval u q = 0 ↔ p ∣ q) : + scaledExtension d u p hu hp u = -aeval u (coeffDeriv d p) := by + simpa only [aeval_X, hamiltonian_X, map_neg] using + scaledExtension_aeval d u p X hu hp + +end Monogenic +end PermanentBorder.NormalizationDerivation + +namespace PermanentBorder.NormalizationDerivation +open Polynomial +section FractionGenerator +variable {S Q L B : Type*} [CommRing S] [IsDomain S] [Field Q] [Field L] [CommRing B] + [Algebra S Q] [IsFractionRing S Q] [Algebra Q L] [Algebra S L] [IsScalarTower S Q L] + [Algebra S B] [Algebra B L] [IsScalarTower S B L] [IsIntegralClosure B S L] + [Algebra.IsAlgebraic Q L] + +lemma adjoin_fraction_generator {u : B} (hu : Algebra.adjoin S {u} = ⊤) : + Algebra.adjoin Q {algebraMap B L u} = ⊤ := by + have := IsIntegralClosure.isLocalization S Q L B + let A := Algebra.adjoin Q {algebraMap B L u} + have hb (b : B) : algebraMap B L b ∈ A := by + rw [Algebra.adjoin_singleton_eq_range_aeval, AlgHom.range_eq_top] at hu + obtain ⟨p,rfl⟩ := hu b + change (IsScalarTower.toAlgHom S B L) (aeval u p) ∈ A + rw [← aeval_algHom_apply] + rw [← aeval_map_algebraMap Q] + change aeval (algebraMap B L u) _ ∈ Algebra.adjoin Q {algebraMap B L u} + rw [Algebra.adjoin_singleton_eq_range_aeval] + exact ⟨_,rfl⟩ + apply eq_top_iff.mpr + intro z _ + obtain ⟨⟨b,a⟩,he⟩ := IsLocalization.surj (Algebra.algebraMapSubmonoid B (nonZeroDivisors S)) z + obtain ⟨s,hs,ha⟩ := a.property + have hs0 : s ≠ 0 := mem_nonZeroDivisors_iff_ne_zero.mp hs + have he' : z * algebraMap S L s = algebraMap B L b := by + rw [IsScalarTower.algebraMap_apply S B L, ha] + exact he + have hq0 : algebraMap S Q s ≠ 0 := by simpa only [map_zero] using (IsFractionRing.injective S Q).ne hs0 + have hz : z = algebraMap Q L ((algebraMap S Q s)⁻¹) * algebraMap B L b := by + rw [← he', IsScalarTower.algebraMap_apply S Q L] + rw [mul_comm z, ← mul_assoc, ← map_mul, inv_mul_cancel₀ hq0, map_one, one_mul] + rw [hz] + exact A.mul_mem (A.algebraMap_mem _) (hb b) +end FractionGenerator + +section Normalization +variable {R S Q L B : Type*} [CommRing R] [CommRing S] [IsDomain S] + [IsIntegrallyClosed S] [IsLocalRing S] [IsAlgClosed (IsLocalRing.ResidueField S)] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + [Field L] [Algebra Q L] [Algebra S L] [IsScalarTower S Q L] + [FiniteDimensional Q L] [Algebra.IsSeparable Q L] + [CommRing B] [IsDedekindDomain B] [IsPrincipalIdealRing B] + [Algebra S B] [Module.Finite S B] [Algebra B L] [IsScalarTower S B L] + [IsIntegralClosure B S L] [Module.IsTorsionFree S B] + [Algebra R S] [Algebra R B] [IsScalarTower R S B] + +include Q L in + +lemma exists_scaled_normalization_derivation (d : Derivation R S S) : + ∃ (g : B) (D : Derivation R B B), + differentIdeal S B = Ideal.span {g} ∧ + ∀ s : S, D (algebraMap S B s) = g * algebraMap S B (d s) := by + obtain ⟨u,hu⟩ := NormalizationMonogenic.exists_adjoin_eq_top_of_principal (S := S) (B := B) + have hi : IsIntegral S u := IsIntegralClosure.isIntegral S L u + let p := minpoly S u + have hp (q : S[X]) : aeval u q = 0 ↔ p ∣ q := minpoly.isIntegrallyClosed_dvd_iff hi q + refine ⟨aeval u p.derivative, scaledExtension d u p hu hp, ?_, ?_⟩ + · have h := conductor_mul_differentIdeal S Q L u (adjoin_fraction_generator (Q := Q) hu) + rw [conductor_eq_top_of_adjoin_eq_top hu, Ideal.top_mul] at h + exact h + · exact scaledExtension_algebraMap d u p hu hp +end Normalization +end PermanentBorder.NormalizationDerivation + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Multigraded.lean b/lean/OAI/Algebra/Determinantal/Multigraded.lean new file mode 100644 index 0000000000000000000000000000000000000000..e930375a270bf5aaa66d4fca08719e206423fe0d --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Multigraded.lean @@ -0,0 +1,394 @@ +import Mathlib + +namespace OAI + +namespace PermanentBorder.Multigraded +open MvPolynomial + +variable {K σ G : Type*} [Field K] [AddCommGroup G] +variable (w : σ → G) + +abbrev Piece (d : G) := weightedHomogeneousSubmodule K w d + +abbrev componentQuotient (I : Ideal (MvPolynomial σ K)) (d : G) := + Piece (K := K) w d ⧸ + (I.restrictScalars K).comap (Piece (K := K) w d).subtype + +def ComponentClosed (I : Ideal (MvPolynomial σ K)) : Prop := + ∀ p ∈ I, ∀ d, weightedHomogeneousComponent w d p ∈ I + +lemma project_mul {a : MvPolynomial σ K} {e : G} + (ha : a.IsWeightedHomogeneous w e) (g : MvPolynomial σ K) (d : G) : + weightedHomogeneousComponent w d (a * g) = + a * weightedHomogeneousComponent w (d-e) g := by + classical + ext z + simp only [coeff_weightedHomogeneousComponent, coeff_mul] + have hi : (if Finsupp.weight w z = d then + ∑ xy ∈ Finset.HasAntidiagonal.antidiagonal z, a.coeff xy.1 * g.coeff xy.2 else 0) = + ∑ xy ∈ Finset.HasAntidiagonal.antidiagonal z, + if Finsupp.weight w z = d then a.coeff xy.1 * g.coeff xy.2 else 0 := by + rw [Finset.sum_ite_irrel] + simp + rw [hi] + apply Finset.sum_congr rfl + rintro ⟨x,y⟩ hxy + have hsum : x+y=z := Finset.HasAntidiagonal.mem_antidiagonal.mp hxy + by_cases hx : a.coeff x = 0 + · simp [hx] + · have hwe : Finsupp.weight w x = e := ha hx + have hcond : Finsupp.weight w z = d ↔ Finsupp.weight w y = d-e := by + rw [← hsum, map_add, hwe] + rw [eq_sub_iff_add_eq, add_comm] + simp only [hcond] + split_ifs <;> simp + +lemma componentClosed_sup {I J : Ideal (MvPolynomial σ K)} + (hI : ComponentClosed w I) (hJ : ComponentClosed w J) : + ComponentClosed w (I ⊔ J) := by + intro p hp d + obtain ⟨i,hi,j,hj,rfl⟩ := Submodule.mem_sup.mp hp + rw [map_add] + exact Ideal.add_mem _ (Submodule.mem_sup_left (hI i hi d)) + (Submodule.mem_sup_right (hJ j hj d)) + +lemma componentClosed_span_single {a : MvPolynomial σ K} {e : G} + (ha : a.IsWeightedHomogeneous w e) : + ComponentClosed w (Ideal.span {a}) := by + intro p hp d + obtain ⟨g,rfl⟩ := Ideal.mem_span_singleton.mp hp + rw [project_mul w ha] + exact Ideal.mul_mem_right _ _ (Ideal.subset_span (Set.mem_singleton a)) + +lemma componentClosed_bot : ComponentClosed (K := K) w ⊥ := by + intro p hp d + have hp0 : p = 0 := hp + simp [hp0] + +noncomputable def componentMap {I J : Ideal (MvPolynomial σ K)} (h : I ≤ J) (d : G) : + componentQuotient w I d →ₗ[K] componentQuotient w J d := + Submodule.mapQ _ _ LinearMap.id (fun _ hx => h hx) + +@[simp] lemma componentMap_mk {I J : Ideal (MvPolynomial σ K)} (h : I ≤ J) + (d : G) (p : Piece (K := K) w d) : + componentMap w h d (Submodule.Quotient.mk p) = Submodule.Quotient.mk p := rfl + +noncomputable def mulPiece {a : MvPolynomial σ K} {e : G} + (ha : a.IsWeightedHomogeneous w e) (d : G) : + Piece (K := K) w (d-e) →ₗ[K] Piece (K := K) w d := + ((LinearMap.mulLeft K a).comp (Piece (K := K) w (d-e)).subtype).codRestrict _ + (fun p => by + change IsWeightedHomogeneous w (a * p.val) d + simpa only [add_sub_cancel] using ha.mul p.property) + +@[simp] lemma mulPiece_val {a : MvPolynomial σ K} {e : G} + (ha : a.IsWeightedHomogeneous w e) (d : G) (p : Piece (K := K) w (d-e)) : + (mulPiece w ha d p).val = a*p.val := rfl + +noncomputable def componentMul {a : MvPolynomial σ K} {e : G} + (ha : a.IsWeightedHomogeneous w e) (I J : Ideal (MvPolynomial σ K)) + (h : ∀ p ∈ I, a*p ∈ J) (d : G) : + componentQuotient w I (d-e) →ₗ[K] componentQuotient w J d := + Submodule.mapQ _ _ (mulPiece w ha d) (fun p hp => h p.val hp) + +@[simp] lemma componentMul_mk {a : MvPolynomial σ K} {e : G} + (ha : a.IsWeightedHomogeneous w e) (I J : Ideal (MvPolynomial σ K)) + (h : ∀ p ∈ I, a*p ∈ J) (d : G) (p : Piece (K := K) w (d-e)) : + componentMul w ha I J h d (Submodule.Quotient.mk p) = + Submodule.Quotient.mk (mulPiece w ha d p) := rfl + +theorem finrank_product_split (I : Ideal (MvPolynomial σ K)) + (hI : ComponentClosed w I) {a b : MvPolynomial σ K} {e : G} + (ha : a.IsWeightedHomogeneous w e) (d : G) + [Module.Finite K (Piece (K := K) w d)] + [Module.Finite K (Piece (K := K) w (d-e))] : + Module.finrank K (componentQuotient w (I ⊔ Ideal.span {a*b}) d) ≤ + Module.finrank K (componentQuotient w (I ⊔ Ideal.span {a}) d) + + Module.finrank K (componentQuotient w (I ⊔ Ideal.span {b}) (d-e)) := by + let B := I ⊔ Ideal.span {a*b} + let A := I ⊔ Ideal.span {a} + let C := I ⊔ Ideal.span {b} + have hBA : B ≤ A := by + apply sup_le le_sup_left + apply Ideal.span_le.mpr + rintro _ rfl + exact Submodule.mem_sup_right (Ideal.mul_mem_right _ _ (Ideal.subset_span rfl)) + have hm : ∀ p ∈ C, a*p ∈ B := by + intro p hp + obtain ⟨i,hi,z,hz,rfl⟩ := Submodule.mem_sup.mp hp + obtain ⟨g,rfl⟩ := Ideal.mem_span_singleton.mp hz + rw [mul_add, ← mul_assoc] + exact Ideal.add_mem _ (Submodule.mem_sup_left (I.mul_mem_left a hi)) + (Submodule.mem_sup_right (Ideal.mul_mem_right _ _ (Ideal.subset_span rfl))) + let f := componentMap w hBA d + let g := componentMul w ha C B hm d + have hker : LinearMap.ker f ≤ LinearMap.range g := by + intro x hx + obtain ⟨p,rfl⟩ := Submodule.mkQ_surjective _ x + change (Submodule.Quotient.mk p : componentQuotient w A d) = 0 at hx + have hp : p.val ∈ A := (Submodule.Quotient.mk_eq_zero + ((A.restrictScalars K).comap (Piece (K := K) w d).subtype)).mp hx + obtain ⟨i,hi,z,hz,hp⟩ := Submodule.mem_sup.mp hp + obtain ⟨u,rfl⟩ := Ideal.mem_span_singleton.mp hz + let v : Piece (K := K) w (d-e) := + ⟨weightedHomogeneousComponent w (d-e) u, weightedHomogeneousComponent_mem w u (d-e)⟩ + refine ⟨Submodule.Quotient.mk v, ?_⟩ + change Submodule.Quotient.mk (mulPiece w ha d v) = Submodule.Quotient.mk p + rw [Submodule.Quotient.eq] + change a * weightedHomogeneousComponent w (d-e) u - p.val ∈ B + have he : weightedHomogeneousComponent w d i + + a * weightedHomogeneousComponent w (d-e) u = p.val := by + have hh := congrArg (weightedHomogeneousComponent w d) hp + simpa only [map_add, project_mul w ha, + weightedHomogeneousComponent_eq_self p.property] using hh + have hi' := hI i hi d + have he' : a * weightedHomogeneousComponent w (d-e) u - p.val = + -(weightedHomogeneousComponent w d i) := by rw [← he]; abel + rw [he'] + exact Submodule.mem_sup_left (I.neg_mem hi') + have hk := (Submodule.finrank_mono hker).trans (LinearMap.finrank_range_le g) + have hf := Submodule.finrank_le (LinearMap.range f) + have hr := LinearMap.finrank_range_add_finrank_ker f + dsimp only [B,A,C] at hk hf hr + omega + +structure FactorPair where + left : MvPolynomial σ K + right : MvPolynomial σ K + leftDegree : G + rightDegree : G + left_homogeneous : left.IsWeightedHomogeneous w leftDegree + right_homogeneous : right.IsWeightedHomogeneous w rightDegree + +noncomputable def productIdeal : List (FactorPair (K := K) w) → Ideal (MvPolynomial σ K) + | [] => ⊥ + | q :: qs => Ideal.span {q.left*q.right} ⊔ productIdeal qs + +noncomputable def splitBound (I : Ideal (MvPolynomial σ K)) (d : G) : + List (FactorPair (K := K) w) → ℕ + | [] => Module.finrank K (componentQuotient w I d) + | q :: qs => splitBound (I ⊔ Ideal.span {q.left}) d qs + + splitBound (I ⊔ Ideal.span {q.right}) (d-q.leftDegree) qs + +lemma productIdeal_closed (qs : List (FactorPair (K := K) w)) : + ComponentClosed w (productIdeal w qs) := by + induction qs with + | nil => exact componentClosed_bot w + | cons q qs ih => + exact componentClosed_sup w + (componentClosed_span_single w (q.left_homogeneous.mul q.right_homogeneous)) ih + +theorem finrank_le_splitBound [∀ d, Module.Finite K (Piece (K := K) w d)] + (qs : List (FactorPair (K := K) w)) (I : Ideal (MvPolynomial σ K)) + (hI : ComponentClosed w I) (d : G) : + Module.finrank K (componentQuotient w (I ⊔ productIdeal w qs) d) ≤ + splitBound w I d qs := by + induction qs generalizing I d with + | nil => rw [productIdeal, sup_bot_eq, splitBound] + | cons q qs ih => + have hs := finrank_product_split w (b := q.right) (I ⊔ productIdeal w qs) + (componentClosed_sup w hI (productIdeal_closed w qs)) q.left_homogeneous d + have h₁ := ih (I ⊔ Ideal.span {q.left}) + (componentClosed_sup w hI (componentClosed_span_single w q.left_homogeneous)) d + have h₂ := ih (I ⊔ Ideal.span {q.right}) + (componentClosed_sup w hI (componentClosed_span_single w q.right_homogeneous)) + (d-q.leftDegree) + calc + _ ≤ Module.finrank K (componentQuotient w + ((I ⊔ Ideal.span {q.left}) ⊔ productIdeal w qs) d) + + Module.finrank K (componentQuotient w + ((I ⊔ Ideal.span {q.right}) ⊔ productIdeal w qs) (d-q.leftDegree)) := by + have h₀ : I ⊔ productIdeal w (q::qs) = + (I ⊔ productIdeal w qs) ⊔ Ideal.span {q.left*q.right} := by + dsimp only [productIdeal] + rw [sup_comm (Ideal.span {q.left*q.right}) (productIdeal w qs), ← sup_assoc] + have hₐ : (I ⊔ productIdeal w qs) ⊔ Ideal.span {q.left} = + (I ⊔ Ideal.span {q.left}) ⊔ productIdeal w qs := sup_right_comm _ _ _ + have hᵦ : (I ⊔ productIdeal w qs) ⊔ Ideal.span {q.right} = + (I ⊔ Ideal.span {q.right}) ⊔ productIdeal w qs := sup_right_comm _ _ _ + rw [hₐ,hᵦ] at hs + rw [h₀] + exact hs + _ ≤ _ := Nat.add_le_add h₁ h₂ + +end PermanentBorder.Multigraded + +namespace PermanentBorder.Multigraded +open MvPolynomial +section Blocks +variable {K σ ι : Type*} [Field K] [Fintype σ] [Fintype ι] [DecidableEq ι] + +noncomputable def blockWeight (group : σ → ι) (v : σ) : ι → ℤ := + Pi.single (group v) 1 + +lemma sum_blockWeight (group : σ → ι) (m : σ →₀ ℕ) : + ∑ j, Finsupp.weight (blockWeight group) m j = (m.degree : ℤ) := by + classical + rw [Finsupp.weight_eq_sum] + simp only [Finset.sum_apply, Pi.smul_apply] + rw [Finset.sum_comm] + simp only [blockWeight, nsmul_eq_mul, ← Finset.mul_sum] + rw [Finsupp.degree_eq_weight_one, Finsupp.weight_eq_sum] + simp + +lemma finite_block_degree (group : σ → ι) (d : ι → ℤ) : + Set.Finite {m : σ →₀ ℕ | Finsupp.weight (blockWeight group) m = d} := by + apply (Finsupp.finite_of_degree_le (∑ j, d j).toNat).subset + intro m hm + have hs := sum_blockWeight group m + rw [hm] at hs + change m.degree ≤ (∑ j, d j).toNat + rw [hs] + simp + +instance blockPiece_finite (group : σ → ι) (d : ι → ℤ) : + Module.Finite K (Piece (K := K) (blockWeight group) d) := by + rw [Piece, weightedHomogeneousSubmodule_eq_finsupp_supported] + have := (finite_block_degree group d).to_subtype + exact Module.Finite.of_basis (basisRestrictSupport K + {m | Finsupp.weight (blockWeight group) m = d}) + +end Blocks +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section LinearLeaves +variable {K σ ι : Type*} [Field K] [Fintype σ] [Fintype ι] [DecidableEq ι] + +noncomputable def blockExponent (group : σ → ι) (m : σ →₀ ℕ) (j : ι) : ℕ := + ∑ v ∈ Finset.univ.filter (group · = j), m v + +omit [Fintype ι] in +lemma weight_blockExponent (group : σ → ι) (m : σ →₀ ℕ) (j : ι) : + Finsupp.weight (blockWeight group) m j = (blockExponent group m j : ℤ) := by + classical + rw [Finsupp.weight_apply, Finsupp.sum_fintype _ _ (by simp)] + simp only [Finset.sum_apply, blockWeight, nsmul_eq_mul] + simp [blockExponent, Pi.single_apply, Finset.sum_filter, eq_comm] + +lemma prod_blockExponent {S : Type*} [CommMonoid S] (group : σ → ι) + (m : σ →₀ ℕ) (z : ι → S) : + ∏ v, z (group v) ^ m v = ∏ j, z j ^ blockExponent group m j := by + classical + rw [← Finset.prod_fiberwise Finset.univ group] + apply Finset.prod_congr rfl + intro j _ + rw [blockExponent, ← Finset.prod_pow_eq_pow_sum] + apply Finset.prod_congr rfl + intro v hv + rw [(Finset.mem_filter.mp hv).2] + +noncomputable def componentEmbed (group : σ → ι) (I : Ideal (MvPolynomial σ K)) + (d : ι → ℤ) : componentQuotient (blockWeight group) I d →ₗ[K] + (MvPolynomial σ K ⧸ I) := + Submodule.liftQ _ ((Ideal.Quotient.mkₐ K I).toLinearMap.comp + (Piece (K := K) (blockWeight group) d).subtype) (by + intro p hp + exact Ideal.Quotient.eq_zero_iff_mem.mpr hp) + +omit [Fintype σ] [Fintype ι] in +lemma componentEmbed_injective (group : σ → ι) (I : Ideal (MvPolynomial σ K)) + (d : ι → ℤ) : Function.Injective (componentEmbed group I d) := by + apply (LinearMap.ker_eq_bot).mp + apply le_antisymm _ bot_le + intro x hx + obtain ⟨p,rfl⟩ := Submodule.Quotient.mk_surjective + ((I.restrictScalars K).comap (Piece (K := K) (blockWeight group) d).subtype) x + change Submodule.Quotient.mk p = 0 + apply (Submodule.Quotient.mk_eq_zero _).mpr + exact Ideal.Quotient.eq_zero_iff_mem.mp hx + +theorem component_finrank_le_one_of_linear_relations (group : σ → ι) + (I : Ideal (MvPolynomial σ K)) (z : ι → MvPolynomial σ K) (c : σ → K) + (hrel : ∀ v, X v - C (c v) * z (group v) ∈ I) (d : ι → ℤ) : + Module.finrank K (componentQuotient (blockWeight group) I d) ≤ 1 := by + classical + let q := Ideal.Quotient.mkₐ K I + let Z := ∏ j, q (z j) ^ (d j).toNat + have hX (v : σ) : q (X v) = algebraMap K _ (c v) * q (z (group v)) := by + have h := Ideal.Quotient.eq.mpr (hrel v) + change q (X v) = q (C (c v) * z (group v)) at h + rw [map_mul] at h + exact h.trans (congrArg (· * q (z (group v))) (q.commutes (c v))) + have hmon (m : σ →₀ ℕ) (r : K) (hm : Finsupp.weight (blockWeight group) m = d) : + q (monomial m r) ∈ Submodule.span K {Z} := by + apply Submodule.mem_span_singleton.mpr + refine ⟨r * ∏ v, c v ^ m v, ?_⟩ + have hexp : ∀ j, blockExponent group m j = (d j).toNat := by + intro j + have h := congrFun hm j + rw [weight_blockExponent] at h + rw [← h, Int.toNat_natCast] + rw [monomial_eq, Finsupp.prod_pow, map_mul, map_prod] + simp only [map_pow, hX, mul_pow, Finset.prod_mul_distrib] + rw [prod_blockExponent group m (fun j => q (z j))] + simp only [hexp] + change (r * ∏ v, c v ^ m v) • Z = + algebraMap K _ r * ((∏ v, (algebraMap K _ (c v)) ^ m v) * Z) + have he : (r * ∏ v, c v ^ m v) • Z = + algebraMap K (MvPolynomial σ K ⧸ I) (r * ∏ v, c v ^ m v) * Z := + Algebra.smul_def (R := K) (A := MvPolynomial σ K ⧸ I) (r * ∏ v, c v ^ m v) Z + rw [he, map_mul, map_prod] + simp only [map_pow] + ring + have hpiece (p : Piece (K := K) (blockWeight group) d) : + q p.val ∈ Submodule.span K {Z} := by + rcases p with ⟨p,hp⟩ + induction hp using IsWeightedHomogeneous.induction_on with + | zero => simp + | add p₁ p₂ _ _ h₁ h₂ => simpa only [map_add] using Submodule.add_mem _ h₁ h₂ + | monomial m r hm => exact hmon m r hm + let f := (componentEmbed group I d).codRestrict (Submodule.span K {Z}) (by + intro x + obtain ⟨p,rfl⟩ := Submodule.Quotient.mk_surjective + ((I.restrictScalars K).comap (Piece (K := K) (blockWeight group) d).subtype) x + exact hpiece p) + have hf : Function.Injective f := fun a b h => + componentEmbed_injective group I d (congrArg Subtype.val h) + exact (LinearMap.finrank_le_finrank_of_injective hf).trans + (by + apply finrank_le_one_iff.mpr + refine ⟨⟨Z, Submodule.subset_span (Set.mem_singleton Z)⟩, ?_⟩ + intro x + obtain ⟨c,hc⟩ := Submodule.mem_span_singleton.mp x.property + exact ⟨c, Subtype.ext hc⟩) + +theorem component_finrank_zero_of_block_killed (group : σ → ι) + (I : Ideal (MvPolynomial σ K)) (j : ι) + (hkill : ∀ v, group v = j → X v ∈ I) (d : ι → ℤ) (hd : 0 < d j) : + Module.finrank K (componentQuotient (blockWeight group) I d) = 0 := by + classical + let q := Ideal.Quotient.mkₐ K I + have hmon (m : σ →₀ ℕ) (r : K) (hm : Finsupp.weight (blockWeight group) m = d) : + q (monomial m r) = 0 := by + have hexp : 0 < blockExponent group m j := by + have h := congrFun hm j + rw [weight_blockExponent] at h + omega + obtain ⟨v,hv,hmv⟩ := Finset.sum_pos_iff.mp hexp + have hqv : q (X v) = 0 := Ideal.Quotient.eq_zero_iff_mem.mpr + (hkill v (Finset.mem_filter.mp hv).2) + rw [monomial_eq, Finsupp.prod_pow, map_mul, map_prod] + have hz : ∏ v, q (X v ^ m v) = 0 := Finset.prod_eq_zero (Finset.mem_univ v) (by + rw [map_pow, hqv, zero_pow (Nat.ne_of_gt hmv)]) + rw [hz, mul_zero] + have hpiece (p : Piece (K := K) (blockWeight group) d) : q p.val = 0 := by + rcases p with ⟨p,hp⟩ + induction hp using IsWeightedHomogeneous.induction_on with + | zero => exact map_zero q + | add p₁ p₂ _ _ h₁ h₂ => rw [map_add, h₁,h₂,add_zero] + | monomial m r hm => exact hmon m r hm + apply Module.finrank_eq_zero_iff.mpr + intro x + refine ⟨1,one_ne_zero,?_⟩ + rw [one_smul] + apply componentEmbed_injective group I d + obtain ⟨p,rfl⟩ := Submodule.Quotient.mk_surjective + ((I.restrictScalars K).comap (Piece (K := K) (blockWeight group) d).subtype) x + rw [map_zero] + exact hpiece p + +end LinearLeaves +end PermanentBorder.Multigraded + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Nilpotents.lean b/lean/OAI/Algebra/Determinantal/Nilpotents.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5df37e5bf0788a7025484cca850eced09c82299 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Nilpotents.lean @@ -0,0 +1,433 @@ +/- +Portions of this file have been adapted from an external source. +The source copyright header and license information are preserved below. +-/ + +import OAI.Algebra.Determinantal.CoordinateFields + +namespace OAI + +namespace PermanentBorder.NilpotentOrbits +open scoped DirectSum +open Submodule Module Polynomial Ideal Submodule.IsPrincipal Submodule.Quotient + +section Decomposition +variable {R M : Type*} [CommRing R] [IsPrincipalIdealRing R] [IsDomain R] + [AddCommGroup M] [Module R M] + +/- +Copyright (c) 2022 Pierre-Alexandre Bazin. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Pierre-Alexandre Bazin + +The following decomposition theorem is adapted from Mathlib.Algebra.Module.PID. +Source: https://github.com/leanprover-community/mathlib4/blob/d13f23b723b8a846827a245b89c10fc7d3f11612/Mathlib/Algebra/Module/PID.lean + +This code has been modified. +-/ + +theorem decomposition_of_generators {p : R} (hp : Irreducible p) + (hM : Module.IsTorsion' M (Submonoid.powers p)) + (d : ℕ) (s : Fin d → M) (hs : Submodule.span R (Set.range s) = ⊤) : + ∃ k : Fin d → ℕ, Nonempty (M ≃ₗ[R] ⨁ i : Fin d, R ⧸ R ∙ p ^ k i) := by + classical + induction d generalizing M with + | zero => + use finZeroElim + rw [Set.range_eq_empty, Submodule.span_empty] at hs + have : Unique M := + ⟨⟨0⟩, fun x => by dsimp; rw [← Submodule.mem_bot R, hs]; exact Submodule.mem_top⟩ + exact ⟨0⟩ + | succ d IH => + have : ∀ x : M, Decidable (x = 0) := fun _ => by classical infer_instance + obtain ⟨j, hj⟩ := exists_isTorsionBy hM d.succ d.succ_ne_zero s hs + let s' : Fin d → M ⧸ R ∙ s j := Submodule.Quotient.mk ∘ s ∘ j.succAbove + + have := IH ?_ s' ?_ + · obtain ⟨k, ⟨f⟩⟩ := this + clear IH + have : ∀ i : Fin d, + ∃ x : M, p ^ k i • x = 0 ∧ f (Submodule.Quotient.mk x) = DirectSum.lof R _ _ i 1 := by + intro i + let fi := f.symm.toLinearMap.comp (DirectSum.lof _ _ _ i) + obtain ⟨x, h0, h1⟩ := exists_smul_eq_zero_and_mk_eq hp hM hj fi; refine ⟨x, h0, ?_⟩; rw [h1] + simp only [fi, LinearMap.coe_comp, f.symm.coe_toLinearMap, f.apply_symm_apply, + Function.comp_apply] + refine ⟨?_, ⟨?_⟩⟩ + · exact fun a => (fun i => (Option.rec (pOrder hM (s j)) k i : ℕ)) (finSuccEquiv d a) + · refine + (lequivProdOfRightSplitExact + (g := f.toLinearMap.comp <| mkQ _) + (f := (DirectSum.toModule _ _ _ fun i => (liftQSpanSingleton (p ^ k i) + (LinearMap.toSpanSingleton _ _ _) + (show (LinearMap.toSpanSingleton R M (this i).choose) (p ^ k i) = 0 from + (this i).choose_spec.left) : R ⧸ _ →ₗ[R] _))) + (R ∙ s j).injective_subtype ?_ ?_).symm ≪≫ₗ + (((quotTorsionOfEquivSpanSingleton R M (s j)).symm ≪≫ₗ + (quotEquivOfEq (torsionOf R M (s j)) _ + (Ideal.torsionOf_eq_span_pow_pOrder hp hM (s j)))).prodCongr (.refl _ _)) ≪≫ₗ + (@DirectSum.lequivProdDirectSum R _ _ + (fun i => R ⧸ R ∙ p ^ @Option.rec _ (fun _ => ℕ) (pOrder hM <| s j) k i) _ _).symm ≪≫ₗ + (DirectSum.lequivCongrLeft R (finSuccEquiv d).symm) + · rw [range_subtype, LinearEquiv.ker_comp, ker_mkQ] + · rw [LinearMap.comp_assoc] + ext i : 3 + simp only [LinearMap.coe_comp, Function.comp_apply, mkQ_apply] + rw [LinearEquiv.coe_toLinearMap, LinearMap.id_apply, DirectSum.toModule_lof, + liftQSpanSingleton_apply, LinearMap.toSpanSingleton_apply_one, Ideal.Quotient.mk_eq_mk, + map_one (Ideal.Quotient.mk _), (this i).choose_spec.right] + · exact (mk_surjective _).forall.mpr fun x => + ⟨(@hM x).choose, by rw [← Quotient.mk_smul, (@hM x).choose_spec, Quotient.mk_zero]⟩ + · have hs' := congr_arg (Submodule.map <| mkQ <| R ∙ s j) hs + rw [Submodule.map_span, Submodule.map_top, range_mkQ] at hs' + simp only [s']; rw [← Function.comp_assoc, Set.range_comp (_ ∘ s), Fin.range_succAbove] + rw [← Set.range_comp, ← Set.insert_image_compl_eq_range _ j, Function.comp_apply, + mkQ_apply, (Quotient.mk_eq_zero _).mpr (Submodule.mem_span_singleton_self _), + Submodule.span_insert_zero] at hs' + exact hs' + +end Decomposition + +section Nilpotent +variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] + +abbrev Block (e : ℕ) := K[X] ⧸ Ideal.span {(X : K[X]) ^ e} + +theorem torsion_of_nilpotent (f : Module.End K V) (hf : IsNilpotent f) : + Module.IsTorsion' (Module.AEval' f) (Submonoid.powers (X : K[X])) := by + obtain ⟨e, he⟩ := hf + intro x + refine ⟨⟨X ^ e, ⟨e, rfl⟩⟩, ?_⟩ + change (X ^ e : K[X]) • x = 0 + obtain ⟨v, rfl⟩ := (Module.AEval'.of f).surjective x + rw [Module.AEval'.X_pow_smul_of, he, zero_smul, map_zero] + +theorem nilpotent_decomposition {n : ℕ} (b : Module.Basis (Fin n) K V) + (f : Module.End K V) (hf : IsNilpotent f) : + ∃ e : Fin n → ℕ, + Nonempty (Module.AEval' f ≃ₗ[K[X]] ⨁ i : Fin n, Block (K := K) (e i)) := by + let b' := b.map (Module.AEval'.of f) + exact decomposition_of_generators Polynomial.irreducible_X + (torsion_of_nilpotent f hf) n b' + (Submodule.span_eq_top_of_span_eq_top K K[X] _ b'.span_eq) + +theorem nilpotent_pow_dim {n : ℕ} (b : Module.Basis (Fin n) K V) + (f : Module.End K V) (hf : IsNilpotent f) : f ^ n = 0 := by + let := Module.Finite.of_basis b + have hd : Module.finrank K V = n := by + rw [Module.finrank_eq_card_basis b, Fintype.card_fin] + simpa only [hf.charpoly_eq_X_pow_finrank, hd, map_pow, aeval_X] using + f.aeval_self_charpoly + +theorem exponents_le_dim {n : ℕ} (b : Module.Basis (Fin n) K V) + (f : Module.End K V) (hf : IsNilpotent f) (e : Fin n → ℕ) + (E : Module.AEval' f ≃ₗ[K[X]] ⨁ i : Fin n, Block (K := K) (e i)) : + ∀ i, e i ≤ n := by + classical + have hpow := nilpotent_pow_dim b f hf + have hsmul (x : Module.AEval' f) : (X ^ n : K[X]) • x = 0 := by + obtain ⟨v, rfl⟩ := (Module.AEval'.of f).surjective x + rw [Module.AEval'.X_pow_smul_of, hpow, zero_smul, map_zero] + have hsum (y : ⨁ i : Fin n, Block (K := K) (e i)) : (X ^ n : K[X]) • y = 0 := by + obtain ⟨x, rfl⟩ := E.surjective y + rw [← E.map_smul, hsmul, map_zero] + intro i + have hi := congrArg (DirectSum.component K[X] (Fin n) (fun i => Block (K := K) (e i)) i) + (hsum (DirectSum.lof K[X] (Fin n) (fun i => Block (K := K) (e i)) i 1)) + simp only [map_smul, DirectSum.component.of, dite_true, map_zero] at hi + have hmem : (X ^ n : K[X]) ∈ Ideal.span {(X : K[X]) ^ e i} := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + change (Ideal.Quotient.mk (Ideal.span {(X : K[X]) ^ e i})) ((X ^ n : K[X]) * 1) = 0 at hi + simpa only [mul_one] using hi + have hdvd : (X : K[X]) ^ e i ∣ X ^ n := Ideal.mem_span_singleton.mp hmem + simpa only [natDegree_X_pow] using + Polynomial.natDegree_le_of_dvd hdvd (pow_ne_zero n Polynomial.X_ne_zero) + +theorem bounded_nilpotent_decomposition {n : ℕ} (b : Module.Basis (Fin n) K V) + (f : Module.End K V) (hf : IsNilpotent f) : + ∃ e : Fin n → Fin (n + 1), + Nonempty (Module.AEval' f ≃ₗ[K[X]] ⨁ i : Fin n, Block (K := K) (e i).val) := by + obtain ⟨e, ⟨E⟩⟩ := nilpotent_decomposition b f hf + let e' : Fin n → Fin (n + 1) := fun i => ⟨e i, Nat.lt_succ_of_le (exponents_le_dim b f hf e E i)⟩ + exact ⟨e', ⟨E⟩⟩ + +theorem intertwiner_of_module_equiv (f g : Module.End K V) + (E : Module.AEval' f ≃ₗ[K[X]] Module.AEval' g) : + ∃ L : V ≃ₗ[K] V, ∀ v, L (f v) = g (L v) := by + refine ⟨(Module.AEval'.of f).trans ((E.restrictScalars K).trans (Module.AEval'.of g).symm), ?_⟩ + intro v + change (Module.AEval'.of g).symm (E (Module.AEval'.of f (f v))) = + g ((Module.AEval'.of g).symm (E (Module.AEval'.of f v))) + rw [← Module.AEval'.X_smul_of, E.map_smul, Module.AEval'.of_symm_X_smul] + +theorem finite_nilpotent_similarity_types {n : ℕ} (b : Module.Basis (Fin n) K V) : + ∃ S : Set (Module.End K V), S.Finite ∧ + (∀ g ∈ S, IsNilpotent g) ∧ + ∀ f : Module.End K V, IsNilpotent f → + ∃ g ∈ S, ∃ L : V ≃ₗ[K] V, ∀ v, L (f v) = g (L v) := by + classical + let Realized (e : Fin n → Fin (n + 1)) : Prop := + ∃ f : Module.End K V, IsNilpotent f ∧ + Nonempty (Module.AEval' f ≃ₗ[K[X]] ⨁ i : Fin n, Block (K := K) (e i).val) + let T := {e : Fin n → Fin (n + 1) // Realized e} + let repr : T → Module.End K V := fun t => t.property.choose + have hr (t : T) : IsNilpotent (repr t) ∧ + Nonempty (Module.AEval' (repr t) ≃ₗ[K[X]] ⨁ i : Fin n, Block (K := K) (t.val i).val) := + t.property.choose_spec + refine ⟨Set.range repr, Set.finite_range repr, ?_, ?_⟩ + · rintro g ⟨t, rfl⟩ + exact (hr t).1 + · intro f hf + obtain ⟨e, ⟨E⟩⟩ := bounded_nilpotent_decomposition b f hf + let t : T := ⟨e, f, hf, ⟨E⟩⟩ + obtain ⟨F⟩ := (hr t).2 + exact ⟨repr t, ⟨t, rfl⟩, intertwiner_of_module_equiv f (repr t) (E.trans F.symm)⟩ + +theorem unit_conjugacy_of_intertwiner (f g : Module.End K V) + (L : V ≃ₗ[K] V) (hL : ∀ v, L (f v) = g (L v)) : + ∃ U : (Module.End K V)ˣ, g = (U : Module.End K V) * f * (↑U⁻¹ : Module.End K V) := by + let U := (LinearMap.GeneralLinearGroup.generalLinearEquiv K V).symm L + have hu : (U : Module.End K V) = L.toLinearMap := rfl + have h : (U : Module.End K V) * f = g * (U : Module.End K V) := by + ext v + exact hL v + refine ⟨U, ?_⟩ + rw [h, mul_assoc, Units.mul_inv, mul_one] + +end Nilpotent + +section Matrices +variable {K : Type*} [Field K] + +theorem finite_nilpotent_matrix_orbits (n : ℕ) : + ∃ S : Set (Matrix (Fin n) (Fin n) K), S.Finite ∧ + (∀ B ∈ S, IsNilpotent B) ∧ + ∀ A : Matrix (Fin n) (Fin n) K, IsNilpotent A → + ∃ B ∈ S, ∃ U : (Matrix (Fin n) (Fin n) K)ˣ, + B = (U : Matrix (Fin n) (Fin n) K) * A * (↑U⁻¹ : Matrix (Fin n) (Fin n) K) := by + classical + let E : Matrix (Fin n) (Fin n) K ≃ₐ[K] Module.End K (Fin n → K) := Matrix.toLinAlgEquiv' + obtain ⟨S, hS, hn, hc⟩ := finite_nilpotent_similarity_types (Pi.basisFun K (Fin n)) + refine ⟨E.symm '' S, hS.image E.symm, ?_, ?_⟩ + · rintro B ⟨g, hg, rfl⟩ + exact (hn g hg).map E.symm + · intro A hA + obtain ⟨g, hg, L, hL⟩ := hc (E A) (hA.map E) + obtain ⟨U, hU⟩ := unit_conjugacy_of_intertwiner (E A) g L hL + let W := Units.map E.symm.toRingHom.toMonoidHom U + refine ⟨E.symm g, ⟨g, hg, rfl⟩, W, ?_⟩ + change E.symm g = E.symm (U : Module.End K (Fin n → K)) * A * + E.symm (↑U⁻¹ : Module.End K (Fin n → K)) + rw [hU, map_mul, map_mul, E.symm_apply_apply] + +end Matrices +end PermanentBorder.NilpotentOrbits + +namespace PermanentBorder.NilpotentBlocks +open Polynomial Module +open scoped DirectSum +variable {K : Type*} [Field K] + +abbrev Block (e : ℕ) := K[X] ⧸ Ideal.span {(X : K[X]) ^ e} + +noncomputable def blockBasis (e : ℕ) : Basis (Fin e) K (Block (K := K) e) := + (AdjoinRoot.powerBasis' (monic_X_pow e)).basis.reindex (finCongr (natDegree_X_pow e)) + +@[simp] theorem blockBasis_apply (e : ℕ) (i : Fin e) : + blockBasis (K := K) e i = Ideal.Quotient.mk _ ((X : K[X]) ^ i.val) := by + change ((AdjoinRoot.powerBasis' (monic_X_pow e)).basis.reindex + (finCongr (natDegree_X_pow e))) i = AdjoinRoot.mk _ (X ^ i.val) + rw [Basis.reindex_apply, PowerBasis.basis_eq_pow] + simp only [AdjoinRoot.powerBasis'_gen] + exact (map_pow (AdjoinRoot.mk _) X i.val).symm + +theorem X_smul_blockBasis (e : ℕ) (i : Fin e) : + (X : K[X]) • blockBasis (K := K) e i = + if h : i.val + 1 < e then blockBasis e ⟨i.val + 1, h⟩ else 0 := by + rw [blockBasis_apply] + change Ideal.Quotient.mk _ ((X : K[X]) * X ^ i.val) = _ + rw [← pow_succ'] + split_ifs with h + · exact (blockBasis_apply e ⟨i.val + 1, h⟩).symm + · have he : i.val + 1 = e := by omega + rw [he] + apply Ideal.Quotient.eq_zero_iff_mem.mpr + exact Ideal.subset_span (Set.mem_singleton _) + +noncomputable def sumBasis {n : ℕ} (e : Fin n → ℕ) : + Basis (Σ i : Fin n, Fin (e i)) K (⨁ i : Fin n, Block (K := K) (e i)) := + DFinsupp.basis (fun i => blockBasis (e i)) + +@[simp] theorem sumBasis_apply {n : ℕ} (e : Fin n → ℕ) + (i : Fin n) (j : Fin (e i)) : + sumBasis (K := K) e ⟨i,j⟩ = + DirectSum.lof K (Fin n) (fun i => Block (K := K) (e i)) i (blockBasis (e i) j) := by + classical + simp [sumBasis, DFinsupp.basis, Basis.coe_ofRepr] + rfl + +noncomputable def action {n : ℕ} (e : Fin n → ℕ) : + Module.End K (⨁ i : Fin n, Block (K := K) (e i)) where + toFun x := (X : K[X]) • x + map_add' := smul_add _ + map_smul' := by intro a x; exact smul_comm _ _ _ + +@[simp] theorem action_sumBasis {n : ℕ} (e : Fin n → ℕ) + (i : Fin n) (j : Fin (e i)) : + action (K := K) e (sumBasis e ⟨i,j⟩) = + if h : j.val + 1 < e i then sumBasis e ⟨i,⟨j.val + 1,h⟩⟩ else 0 := by + classical + rw [sumBasis_apply] + change (X : K[X]) • DirectSum.lof K (Fin n) (fun i => Block (K := K) (e i)) i (blockBasis (e i) j) = _ + have hmap := (DirectSum.lof K[X] (Fin n) (fun i => Block (K := K) (e i)) i).map_smul + (X : K[X]) (blockBasis (e i) j) + change DirectSum.lof K (Fin n) (fun i => Block (K := K) (e i)) i ((X : K[X]) • blockBasis (e i) j) = + (X : K[X]) • DirectSum.lof K (Fin n) (fun i => Block (K := K) (e i)) i + (blockBasis (e i) j) at hmap + rw [← hmap, X_smul_blockBasis] + split_ifs with h + · exact (sumBasis_apply e i ⟨j.val + 1,h⟩).symm + · exact map_zero _ + +def shiftMatrix {n : ℕ} (e : Fin n → ℕ) : + Matrix (Σ i : Fin n, Fin (e i)) (Σ i : Fin n, Fin (e i)) K := + fun a b => if a.1 = b.1 ∧ a.2.val = b.2.val + 1 then 1 else 0 + +@[simp] theorem shiftMatrix_map {L : Type*} [Field L] (φ : K →+* L) + {n : ℕ} (e : Fin n → ℕ) : + (shiftMatrix (K := K) e).map φ = shiftMatrix (K := L) e := by + ext a b + simp [shiftMatrix] + +theorem toMatrix_action {n : ℕ} (e : Fin n → ℕ) : + LinearMap.toMatrix (sumBasis (K := K) e) (sumBasis e) (action e) = shiftMatrix e := by + classical + ext ⟨a,i⟩ ⟨b,j⟩ + simp only [LinearMap.toMatrix_apply, action_sumBasis] + split_ifs with h + · simp only [Basis.repr_self, Finsupp.single_apply] + by_cases hab : a = b + · subst b + simp [shiftMatrix, Fin.ext_iff, eq_comm] + · have hba : b ≠ a := Ne.symm hab + simp [shiftMatrix, hab, hba] + · simp only [map_zero, Finsupp.coe_zero, Pi.zero_apply] + simp only [shiftMatrix] + split_ifs with hab + · obtain ⟨rfl, hij⟩ := hab + omega + · rfl + +end PermanentBorder.NilpotentBlocks + +namespace PermanentBorder.NilpotentBlocks +open Polynomial Module +open scoped DirectSum +variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] + +theorem toMatrix_of_intertwiner {W ι : Type*} [AddCommGroup W] [Module K W] + [Fintype ι] [DecidableEq ι] (b : Basis ι K W) (f : Module.End K V) + (g : Module.End K W) (L : V ≃ₗ[K] W) (hL : ∀ v, L (f v) = g (L v)) : + LinearMap.toMatrix (b.map L.symm) (b.map L.symm) f = LinearMap.toMatrix b b g := by + rw [LinearMap.toMatrix_map_left, LinearMap.toMatrix_map_right] + congr 1 + apply LinearMap.ext + intro x + change L (f (L.symm x)) = g x + rw [hL, L.apply_symm_apply] + +theorem shift_basis_of_equiv {n : ℕ} (e : Fin n → ℕ) (f : Module.End K V) + (L : V ≃ₗ[K] ⨁ i : Fin n, Block (K := K) (e i)) + (hL : ∀ v, L (f v) = action e (L v)) : + ∃ b : Basis (Σ i : Fin n, Fin (e i)) K V, + LinearMap.toMatrix b b f = shiftMatrix e := by + classical + refine ⟨(sumBasis e).map L.symm, ?_⟩ + have ht := toMatrix_of_intertwiner (K := K) (V := V) + (W := ⨁ i : Fin n, Block (K := K) (e i)) (ι := Σ i : Fin n, Fin (e i)) + (sumBasis (K := K) e) f (action (K := K) e) L hL + exact ht.trans (toMatrix_action (K := K) e) + +theorem exists_shift_basis {n : ℕ} (b₀ : Basis (Fin n) K V) + (f : Module.End K V) (hf : IsNilpotent f) : + ∃ e : Fin n → ℕ, (∑ i, e i) = n ∧ + ∃ b : Basis (Σ i : Fin n, Fin (e i)) K V, + LinearMap.toMatrix b b f = shiftMatrix e := by + classical + obtain ⟨e, ⟨E⟩⟩ := NilpotentOrbits.nilpotent_decomposition b₀ f hf + let L : V ≃ₗ[K] ⨁ i : Fin n, Block (K := K) (e i) := + (Module.AEval'.of f).trans (E.restrictScalars K) + have hL (v : V) : L (f v) = action e (L v) := by + change E (Module.AEval'.of f (f v)) = (X : K[X]) • E (Module.AEval'.of f v) + rw [← Module.AEval'.X_smul_of, E.map_smul] + obtain ⟨b, hb⟩ := shift_basis_of_equiv e f L hL + refine ⟨e, ?_, b, hb⟩ + have hc := (Module.finrank_eq_card_basis b).symm.trans + (Module.finrank_eq_card_basis b₀) + simpa only [Fintype.card_sigma, Fintype.card_fin] using hc + +end PermanentBorder.NilpotentBlocks + +namespace PermanentBorder.NilpotentBlocks +open Module +variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] + +noncomputable def indexEquiv {n : ℕ} (e : Fin n → ℕ) (he : (∑ i, e i) = n) : + (Σ i : Fin n, Fin (e i)) ≃ Fin n := + Fintype.equivFinOfCardEq (by simpa only [Fintype.card_sigma, Fintype.card_fin] using he) + +noncomputable def shapeMatrix {n : ℕ} (e : Fin n → ℕ) (he : (∑ i, e i) = n) : + Matrix (Fin n) (Fin n) K := + (shiftMatrix (K := K) e).reindex (indexEquiv e he) (indexEquiv e he) + +@[simp] theorem shapeMatrix_map {L : Type*} [Field L] (φ : K →+* L) + {n : ℕ} (e : Fin n → ℕ) (he : (∑ i, e i) = n) : + (shapeMatrix (K := K) e he).map φ = shapeMatrix (K := L) e he := by + ext i j + simp [shapeMatrix, Matrix.reindex_apply, shiftMatrix] + +theorem exists_shape_basis {n : ℕ} (b₀ : Basis (Fin n) K V) + (f : Module.End K V) (hf : IsNilpotent f) : + ∃ e : Fin n → ℕ, ∃ he : (∑ i, e i) = n, + ∃ b : Basis (Fin n) K V, LinearMap.toMatrix b b f = shapeMatrix e he := by + classical + obtain ⟨e, he, b, hb⟩ := exists_shift_basis b₀ f hf + refine ⟨e, he, b.reindex (indexEquiv e he), ?_⟩ + ext i j + simpa only [LinearMap.toMatrix_apply, Basis.reindex_apply, Basis.repr_reindex_apply, + shapeMatrix, Matrix.reindex_apply, Matrix.submatrix_apply] using + congrArg (fun M => M ((indexEquiv e he).symm i) ((indexEquiv e he).symm j)) hb + +theorem matrix_conjugacy_of_basis {n : ℕ} (A : Matrix (Fin n) (Fin n) K) + (b : Basis (Fin n) K (Fin n → K)) : + ∃ U : (Matrix (Fin n) (Fin n) K)ˣ, + LinearMap.toMatrix b b (Matrix.toLinAlgEquiv' A) = + (U : Matrix (Fin n) (Fin n) K) * A * (↑U⁻¹ : Matrix (Fin n) (Fin n) K) := by + classical + let E : Matrix (Fin n) (Fin n) K ≃ₐ[K] Module.End K (Fin n → K) := Matrix.toLinAlgEquiv' + let B := LinearMap.toMatrix b b (E A) + have hL (v : Fin n → K) : b.equivFun (E A v) = E B (b.equivFun v) := by + change b.repr (E A v) = B.mulVec (b.repr v) + exact (LinearMap.toMatrix_mulVec_repr b b (E A) v).symm + obtain ⟨U, hU⟩ := NilpotentOrbits.unit_conjugacy_of_intertwiner (E A) (E B) b.equivFun hL + let W := Units.map E.symm.toRingHom.toMonoidHom U + refine ⟨W, ?_⟩ + change B = E.symm (U : Module.End K (Fin n → K)) * A * + E.symm (↑U⁻¹ : Module.End K (Fin n → K)) + have h := congrArg E.symm hU + simpa only [map_mul, E.symm_apply_apply] using h + +theorem canonical_nilpotent_form (K : Type*) [Field K] {L : Type*} [Field L] + (φ : K →+* L) {n : ℕ} (A : Matrix (Fin n) (Fin n) L) (hA : IsNilpotent A) : + ∃ e : Fin n → ℕ, ∃ he : (∑ i, e i) = n, + ∃ U : (Matrix (Fin n) (Fin n) L)ˣ, + (shapeMatrix (K := K) e he).map φ = + (U : Matrix (Fin n) (Fin n) L) * A * (↑U⁻¹ : Matrix (Fin n) (Fin n) L) := by + obtain ⟨e, he, b, hb⟩ := exists_shape_basis (Pi.basisFun L (Fin n)) + (Matrix.toLinAlgEquiv' A) (hA.map Matrix.toLinAlgEquiv') + obtain ⟨U, hU⟩ := matrix_conjugacy_of_basis A b + exact ⟨e, he, U, by rw [shapeMatrix_map, ← hb]; exact hU⟩ + +end PermanentBorder.NilpotentBlocks + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Normalization.lean b/lean/OAI/Algebra/Determinantal/Normalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..063cf2a0bc8dadea48f6c87bd9e4a571e046b3c4 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Normalization.lean @@ -0,0 +1,395 @@ +import OAI.Algebra.Determinantal.ConductorDuality + +namespace OAI + +namespace PermanentBorder.Conductor +open Polynomial Module +section GenericLattice +variable {S Q : Type*} [CommRing S] [IsDomain S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] +variable (f : S[X]) + +noncomputable def genericBaseChange : + AdjoinRoot f →ₐ[S] AdjoinRoot (f.map (algebraMap S Q)) := + AdjoinRoot.mapAlgHom (Algebra.ofId S Q) f (f.map (algebraMap S Q)) (dvd_refl _) + +omit [IsDomain S] [IsFractionRing S Q] in +@[simp] theorem genericBaseChange_mk (g : S[X]) : + genericBaseChange (Q := Q) f (AdjoinRoot.mk f g) = + AdjoinRoot.mk (f.map (algebraMap S Q)) (g.map (algebraMap S Q)) := by + change aeval (AdjoinRoot.root (f.map (algebraMap S Q))) g = _ + exact AdjoinRoot.aeval_eq_of_algebra (R := S) (S := Q) _ g + +omit [IsDomain S] in + +theorem genericBaseChange_injective (hf : f.Monic) : + Function.Injective (genericBaseChange (Q := Q) f) := by + rw [injective_iff_map_eq_zero] + intro z hz + obtain ⟨g, rfl⟩ := AdjoinRoot.mk_surjective z + rw [genericBaseChange_mk, AdjoinRoot.mk_eq_zero] at hz + rw [AdjoinRoot.mk_eq_zero, ← modByMonic_eq_zero_iff_dvd hf] + apply Polynomial.map_injective (algebraMap S Q) (IsFractionRing.injective S Q) + rw [Polynomial.map_zero, map_modByMonic _ hf, + (modByMonic_eq_zero_iff_dvd (hf.map _)).mpr hz] + +theorem genericBaseChange_denominators + (x : AdjoinRoot (f.map (algebraMap S Q))) : + ∃ s : S, s ≠ 0 ∧ ∃ b : AdjoinRoot f, + s • x = genericBaseChange (Q := Q) f b := by + obtain ⟨p, rfl⟩ := AdjoinRoot.mk_surjective x + obtain ⟨s, hs, hp⟩ := IsLocalization.integerNormalization_spec (nonZeroDivisors S) p + refine ⟨s, mem_nonZeroDivisors_iff_ne_zero.mp hs, + AdjoinRoot.mk f (IsLocalization.integerNormalization (nonZeroDivisors S) p), ?_⟩ + rw [genericBaseChange_mk, hp] + exact (map_smul (((AdjoinRoot.mkₐ (f.map (algebraMap S Q))).restrictScalars S).toLinearMap) s p).symm + +variable (hf : f.Monic) + +noncomputable def normalizationInclusion : + AdjoinRoot f →ₐ[S] integralClosure S (AdjoinRoot (f.map (algebraMap S Q))) := by + haveI : Module.Finite S (AdjoinRoot f) := hf.finite_adjoinRoot + exact (genericBaseChange (Q := Q) f).codRestrict _ + (fun z => IsIntegral.map (genericBaseChange (Q := Q) f) (Algebra.IsIntegral.isIntegral z)) + +omit [IsDomain S] [IsFractionRing S Q] in +@[simp] theorem normalizationInclusion_val (z : AdjoinRoot f) : + (normalizationInclusion (Q := Q) f hf z).val = genericBaseChange (Q := Q) f z := rfl + +omit [IsDomain S] in +theorem normalizationInclusion_injective : + Function.Injective (normalizationInclusion (Q := Q) f hf) := by + intro z w h + apply genericBaseChange_injective (Q := Q) f hf + exact congrArg Subtype.val h + +theorem normalizationInclusion_denominators + (x : integralClosure S (AdjoinRoot (f.map (algebraMap S Q)))) : + ∃ s : S, s ≠ 0 ∧ ∃ b : AdjoinRoot f, + s • x = normalizationInclusion (Q := Q) f hf b := by + obtain ⟨s, hs, b, hb⟩ := genericBaseChange_denominators f x.val + exact ⟨s, hs, b, Subtype.ext hb⟩ +end GenericLattice +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Module +section ActualNormalization +variable {S Q : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] +variable {f : S[X]} (hf : f.Monic) +local notation "R" => integralClosure S (AdjoinRoot (f.map (algebraMap S Q))) + +omit [IsDomain S] [IsPrincipalIdealRing S] in + +theorem normalization_torsionFree : NoZeroSMulDivisors S R := by + let ι : R →ₗ[S] AdjoinRoot (f.map (algebraMap S Q)) := + (integralClosure S (AdjoinRoot (f.map (algebraMap S Q)))).val.toLinearMap + have : NoZeroSMulDivisors S (AdjoinRoot (f.map (algebraMap S Q))) := by + constructor + intro s x h + rw [← IsScalarTower.algebraMap_smul Q s x] at h + rcases eq_zero_or_eq_zero_of_smul_eq_zero h with hs | hx + · exact Or.inl ((IsFractionRing.injective S Q) (hs.trans (map_zero _).symm)) + · exact Or.inr hx + exact Function.Injective.noZeroSMulDivisors ι Subtype.val_injective + (map_zero ι) (map_smul ι) + +theorem normalization_conductor_colength + (hsep : (f.map (algebraMap S Q)).Separable) : + letI := (normalizationInclusion (Q := Q) f hf).toRingHom.toAlgebra + Module.length S (AdjoinRoot f ⧸ + (algebraConductor (AdjoinRoot f) R).restrictScalars S) = + Module.length S (R ⧸ LinearMap.range + (normalizationInclusion (Q := Q) f hf).toLinearMap) := by + let := (normalizationInclusion (Q := Q) f hf).toRingHom.toAlgebra + have : Module.Finite S R := + finite_integralClosure_adjoinRoot (hf.map _) hsep + have : NoZeroSMulDivisors S R := normalization_torsionFree (f := f) + exact monic_conductor_colength hf + (normalizationInclusion_injective (Q := Q) f hf) + (normalizationInclusion_denominators (Q := Q) f hf) +end ActualNormalization +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Matrix Module +section Eigenbasis +variable {Q L ι : Type*} [Field Q] [Field L] [Algebra Q L] + [Fintype ι] [DecidableEq ι] + +theorem exists_splitting_eigenbasis (T : Matrix ι ι Q) + (hsep : T.charpoly.Separable) + (hsplit : (T.charpoly.map (algebraMap Q L)).Splits) : + ∃ b : Basis (T.charpoly.rootSet L) L (ι → L), + ∀ μ, (T.map (algebraMap Q L)) *ᵥ b μ = μ.val • b μ := by + classical + let U := T.map (algebraMap Q L) + have he (μ : T.charpoly.rootSet L) : Module.End.HasEigenvalue U.mulVecLin μ.val := by + rw [Module.End.hasEigenvalue_iff_isRoot_charpoly, Matrix.charpoly_mulVecLin] + change (T.map (algebraMap Q L)).charpoly.IsRoot _ + rw [charpoly_map] + simpa only [IsRoot, eval_map, aeval_def] using (mem_rootSet.mp μ.property).2 + choose v hv using fun μ => (he μ).exists_hasEigenvector + have hvi : LinearIndependent L v := + Module.End.eigenvectors_linearIndependent' U.mulVecLin _ Subtype.val_injective v hv + have hc : Fintype.card (T.charpoly.rootSet L) = Module.finrank L (ι → L) := by + rw [card_rootSet_eq_natDegree hsep hsplit, T.charpoly_natDegree_eq_dim, + Module.finrank_fintype_fun_eq_card] + let b := basisOfLinearIndependentOfCardEqFinrank' v hvi hc + refine ⟨b, fun μ => ?_⟩ + simpa only [b, coe_basisOfLinearIndependentOfCardEqFinrank', U, Matrix.mulVecLin_apply] using (hv μ).apply_eq_smul +end Eigenbasis + +section NonzeroCoordinates +variable {Q L ι γ : Type*} [Field Q] [Infinite Q] [Field L] [Algebra Q L] + [Fintype ι] [DecidableEq ι] [Finite γ] + +theorem exists_ground_vector_all_coords_ne_zero (b : Basis γ L (ι → L)) : + ∃ v : ι → Q, ∀ j, b.repr (algebraMap Q L ∘ v) j ≠ 0 := by + classical + let c : (ι → Q) →ₗ[Q] (ι → L) := + { toFun := fun v => (algebraMap Q L) ∘ v + map_add' := by intro x y; ext; simp + map_smul' := by intro a x; ext; simp [Algebra.smul_def] } + let p (j : γ) := LinearMap.ker ((b.coord j).restrictScalars Q |>.comp c) + have hp (j : γ) : p j ≠ ⊤ := by + intro h + have hz (i : ι) : b.repr (Pi.single i 1) j = 0 := by + have he : Pi.single i 1 ∈ p j := h ▸ Submodule.mem_top + change b.repr (algebraMap Q L ∘ Pi.single i 1) j = 0 at he + have hc : algebraMap Q L ∘ Pi.single i (1 : Q) = Pi.single i (1 : L) := by + ext x; simp [Pi.single_apply, apply_ite] + simpa only [hc] using he + have hh : b.repr (b j) j = 0 := by + have hb : b j = ∑ i, (b j i) • Pi.single i (1 : L) := by + ext i; simp [Pi.single_apply] + rw [hb, map_sum, Finsupp.finsetSum_apply] + simp [hz] + simp at hh + obtain ⟨v, hv⟩ := Submodule.exists_forall_notMem_of_forall_ne_top p hp + exact ⟨v, hv⟩ +end NonzeroCoordinates +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Matrix Module +section Coordinates +variable {L V γ : Type*} [Field L] [AddCommGroup V] [Module L V] +variable (b : Basis γ L V) (φ : V →ₗ[L] V) (μ : γ → L) +variable (hφ : ∀ i, φ (b i) = μ i • b i) + +include hφ in +theorem eigenbasis_coord_apply (j : γ) (x : V) : + b.coord j (φ x) = μ j * b.coord j x := by + classical + have he : (b.coord j).comp φ = μ j • b.coord j := by + apply b.ext + intro i + simp only [LinearMap.comp_apply, hφ, map_smul, LinearMap.smul_apply, + Basis.coord_apply, Basis.repr_self, Finsupp.single_apply, smul_eq_mul] + split_ifs with h + · subst i; rfl + · simp + exact congrArg (fun f : V →ₗ[L] L => f x) he + +include hφ in +theorem eigenbasis_coord_pow (j : γ) (x : V) (n : ℕ) : + b.coord j ((φ ^ n) x) = μ j ^ n * b.coord j x := by + induction n with + | zero => simp + | succ n hn => + rw [pow_succ', Module.End.mul_apply, eigenbasis_coord_apply b φ μ hφ, + hn, pow_succ', mul_assoc] + +include hφ in +theorem eigenbasis_coord_aeval (j : γ) (x : V) (p : L[X]) : + b.coord j ((aeval φ p) x) = p.eval (μ j) * b.coord j x := by + induction p using Polynomial.induction_on' with + | add p q hp hq => simp [map_add, hp, hq, add_mul] + | monomial n c => + simp only [aeval_monomial, Module.End.mul_apply, Module.algebraMap_end_apply, + map_smul, eigenbasis_coord_pow b φ μ hφ, eval_monomial, smul_eq_mul, + mul_assoc] +end Coordinates +section Extension +variable {Q L ι : Type*} [Field Q] [Field L] [Algebra Q L] + [Fintype ι] [DecidableEq ι] + +theorem matrix_aeval_mulVec (T : Matrix ι ι Q) (p : Q[X]) (v : ι → Q) : + (aeval T.mulVecLin p) v = (aeval T p) *ᵥ v := by + have h := Polynomial.aeval_algHom_apply + (Matrix.toLinAlgEquiv' (R := Q) (n := ι)) T p + exact congrArg (fun f : (ι → Q) →ₗ[Q] (ι → Q) => f v) h + +theorem matrix_aeval_map_mulVec (T : Matrix ι ι Q) (p : Q[X]) (v : ι → Q) : + algebraMap Q L ∘ ((aeval T.mulVecLin p) v) = + (aeval (T.map (algebraMap Q L)).mulVecLin (p.map (algebraMap Q L))) + (algebraMap Q L ∘ v) := by + rw [matrix_aeval_mulVec, matrix_aeval_mulVec] + have hm : (aeval T p).map (algebraMap Q L) = + aeval (T.map (algebraMap Q L)) (p.map (algebraMap Q L)) := by + apply Polynomial.map_aeval_eq_aeval_map (R := Q) (S := Matrix ι ι Q) + (T := L) (U := Matrix ι ι L) (φ := algebraMap Q L) + (ψ := (algebraMap Q L).mapMatrix) + ext c i j + simp only [RingHom.comp_apply, Matrix.algebraMap_matrix_apply, + Algebra.algebraMap_self, Matrix.map_apply, RingHom.mapMatrix_apply] + split_ifs <;> simp_all + rw [← hm] + funext i + exact (algebraMap Q L).map_mulVec (aeval T p) v i +end Extension +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Matrix Module +section +variable {Q ι : Type*} [Field Q] [Fintype ι] [DecidableEq ι] + +noncomputable def cyclicMap (T : Matrix ι ι Q) (v : ι → Q) : + AdjoinRoot T.charpoly →ₗ[Q] (ι → Q) := by + let ev : Q[X] →ₗ[Q] (ι → Q) := + (LinearMap.applyₗ v).comp (aeval T.mulVecLin).toLinearMap + let I := (Ideal.span ({T.charpoly} : Set Q[X])).restrictScalars Q + exact I.liftQ ev (by + intro p hp + obtain ⟨g, rfl⟩ := Ideal.mem_span_singleton.mp hp + change (aeval T.mulVecLin (T.charpoly * g)) v = 0 + rw [map_mul] + have hc : aeval T.mulVecLin T.charpoly = 0 := by + simpa only [Matrix.charpoly_mulVecLin] using T.mulVecLin.aeval_self_charpoly + rw [hc, zero_mul, LinearMap.zero_apply]) + +@[simp] theorem cyclicMap_mk (T : Matrix ι ι Q) (v : ι → Q) (p : Q[X]) : + cyclicMap T v (AdjoinRoot.mk T.charpoly p) = (aeval T.mulVecLin p) v := rfl + +theorem cyclicMap_root_mul (T : Matrix ι ι Q) (v : ι → Q) + (x : AdjoinRoot T.charpoly) : + cyclicMap T v (AdjoinRoot.root T.charpoly * x) = T *ᵥ cyclicMap T v x := by + obtain ⟨p, rfl⟩ := AdjoinRoot.mk_surjective x + change cyclicMap T v (AdjoinRoot.mk T.charpoly X * AdjoinRoot.mk T.charpoly p) = _ + rw [← map_mul, cyclicMap_mk, map_mul, aeval_X, Module.End.mul_apply, cyclicMap_mk] + rfl +end +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +open Polynomial Matrix Module +section +variable {Q ι : Type*} [Field Q] [Infinite Q] [Fintype ι] [DecidableEq ι] + +theorem exists_cyclicMap_bijective (T : Matrix ι ι Q) + (hsep : T.charpoly.Separable) : + ∃ v : ι → Q, Function.Bijective (cyclicMap T v) := by + let L := T.charpoly.SplittingField + obtain ⟨b, hb⟩ := exists_splitting_eigenbasis (L := L) T hsep + (SplittingField.splits T.charpoly) + obtain ⟨v, hv⟩ := exists_ground_vector_all_coords_ne_zero (Q := Q) b + have hi : Function.Injective (cyclicMap T v) := by + rw [injective_iff_map_eq_zero] + intro z hz + apply rootEvaluation_injective T.charpoly_monic hsep (SplittingField.splits T.charpoly) + obtain ⟨p, rfl⟩ := AdjoinRoot.mk_surjective z + rw [cyclicMap_mk] at hz + funext μ + rw [rootEvaluation_mk, map_zero, Pi.zero_apply] + have hve : (aeval (T.map (algebraMap Q L)).mulVecLin (p.map (algebraMap Q L))) + (algebraMap Q L ∘ v) = 0 := by + rw [← matrix_aeval_map_mulVec, hz] + ext i; simp + have he := eigenbasis_coord_aeval b (T.map (algebraMap Q L)).mulVecLin + (fun μ => μ.val) (fun μ => by simpa using hb μ) μ + (algebraMap Q L ∘ v) (p.map (algebraMap Q L)) + rw [hve, map_zero] at he + have hp : aeval μ.val p * (b.repr (algebraMap Q L ∘ v)) μ = 0 := by + simpa only [eval_map, aeval_def, Basis.coord_apply] using he.symm + exact (mul_eq_zero.mp hp).resolve_right (hv μ) + let : Module.Finite Q (AdjoinRoot T.charpoly) := T.charpoly_monic.finite_adjoinRoot + have hd : Module.finrank Q (AdjoinRoot T.charpoly) = Module.finrank Q (ι → Q) := by + rw [show Module.finrank Q (AdjoinRoot T.charpoly) = T.charpoly.natDegree from + finrank_quotient_span_eq_natDegree, T.charpoly_natDegree_eq_dim, + Module.finrank_fintype_fun_eq_card] + exact ⟨v, hi, (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hd).mp hi⟩ + +theorem exists_generic_matrix_equiv (T : Matrix ι ι Q) + (hsep : T.charpoly.Separable) : + ∃ e : (ι → Q) ≃ₗ[Q] AdjoinRoot T.charpoly, + ∀ x, e (T *ᵥ x) = AdjoinRoot.root T.charpoly * e x := by + obtain ⟨v, hv⟩ := exists_cyclicMap_bijective T hsep + let e := LinearEquiv.ofBijective (cyclicMap T v) hv + refine ⟨e.symm, fun x => ?_⟩ + apply e.injective + rw [e.apply_symm_apply] + change T *ᵥ x = cyclicMap T v (AdjoinRoot.root T.charpoly * e.symm x) + rw [cyclicMap_root_mul] + exact congrArg T.mulVec (e.apply_symm_apply x).symm +end +end PermanentBorder.Conductor + +namespace PermanentBorder.Conductor +section Semilocal +variable {S A : Type*} [CommRing S] [IsLocalRing S] + [CommRing A] [Algebra S A] [Module.Finite S A] + +include S in + +theorem finite_maximalSpectrum_of_finite_local : Finite (MaximalSpectrum A) := by + classical + let m := IsLocalRing.maximalIdeal S + let J := m.map (algebraMap S A) + have hle (M : MaximalSpectrum A) : J ≤ M.asIdeal := by + change m.map (algebraMap S A) ≤ M.asIdeal + rw [Ideal.map_le_iff_le_comap] + have hm : (M.asIdeal.comap (algebraMap S A)).IsMaximal := + Ideal.isMaximal_under_of_isIntegral_of_isMaximal M.asIdeal + exact (IsLocalRing.eq_maximalIdeal hm).symm.le + let : Algebra (S ⧸ m) (A ⧸ J) := + Ideal.Quotient.algebraQuotientOfLEComap (Ideal.le_comap_map) + have : IsScalarTower S (S ⧸ m) (A ⧸ J) := + IsScalarTower.of_algebraMap_eq fun x => rfl + have : Module.Finite (S ⧸ m) (A ⧸ J) := + Module.Finite.of_restrictScalars_finite S _ _ + let : Field (S ⧸ m) := Ideal.Quotient.field m + have : IsArtinianRing (A ⧸ J) := IsArtinianRing.of_finite (S ⧸ m) _ + have hker : RingHom.ker (Ideal.Quotient.mk J) = J := by + ext x + exact Ideal.Quotient.eq_zero_iff_mem + let ι : MaximalSpectrum A → MaximalSpectrum (A ⧸ J) := fun M => + ⟨M.asIdeal.map (Ideal.Quotient.mk J), + Ideal.IsMaximal.map_of_surjective_of_ker_le (Ideal.Quotient.mk_surjective) + (by rw [hker]; exact hle M)⟩ + apply Finite.of_injective ι + intro M N h + apply MaximalSpectrum.ext + have he := congrArg MaximalSpectrum.asIdeal h + have hi (P : MaximalSpectrum A) : + (P.asIdeal.map (Ideal.Quotient.mk J)).comap (Ideal.Quotient.mk J) = P.asIdeal := by + rw [Ideal.comap_map_of_surjective _ (Ideal.Quotient.mk_surjective)] + rw [← RingHom.ker_eq_comap_bot, hker, sup_of_le_left (hle P)] + exact (hi M).symm.trans ((congrArg (Ideal.comap (Ideal.Quotient.mk J)) he).trans (hi N)) +end Semilocal + +section FieldNormalization +variable {S Q L : Type*} [CommRing S] [IsDomain S] [IsPrincipalIdealRing S] [IsLocalRing S] + [Field Q] [Algebra S Q] [IsFractionRing S Q] + [Field L] [Algebra Q L] [Algebra S L] [IsScalarTower S Q L] + [FiniteDimensional Q L] [Algebra.IsSeparable Q L] + +include Q in + +theorem integralClosure_isPrincipalIdealRing : + IsPrincipalIdealRing (integralClosure S L) := by + have : Module.Finite S (integralClosure S L) := + IsIntegralClosure.finite S Q L (integralClosure S L) + have : Finite (MaximalSpectrum (integralClosure S L)) := + finite_maximalSpectrum_of_finite_local (S := S) + have : IsDedekindDomain (integralClosure S L) := + integralClosure.isDedekindDomain S Q L + apply IsPrincipalIdealRing.of_finite_maximals + rw [← MaximalSpectrum.range_asIdeal] + exact Set.finite_range _ +end FieldNormalization +end PermanentBorder.Conductor + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/PencilSeparability.lean b/lean/OAI/Algebra/Determinantal/PencilSeparability.lean new file mode 100644 index 0000000000000000000000000000000000000000..bea07cf155d4d6a198a43214dec06cdfcc6ec03d --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/PencilSeparability.lean @@ -0,0 +1,203 @@ +import OAI.Algebra.Determinantal.RowIdeals + +namespace OAI + +namespace PermanentBorder.Conductor +open Matrix Polynomial +section +variable {K S ι : Type*} [Field K] [CommRing S] [Algebra K S] + [Fintype ι] [DecidableEq ι] [Nonempty ι] + +theorem charpoly_mem_adjugate_ideal (T : Matrix ι ι S) : + T.charpoly ∈ matrixEntryIdeal T.charmatrix.adjugate := by + classical + rw [Matrix.charpoly, det_eq_sum_mul_adjugate_row _ (Classical.arbitrary ι)] + exact Ideal.sum_mem _ fun j _ => + Ideal.mul_mem_left _ _ (entry_mem_matrixEntryIdeal _ j _) + +noncomputable def polynomialCofactorQuotientEquiv (T : Matrix ι ι S) : + (AdjoinRoot T.charpoly ⧸ + (matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly))).restrictScalars S) + ≃ₗ[K] S[X] ⧸ matrixEntryIdeal T.charmatrix.adjugate := by + let J := matrixEntryIdeal T.charmatrix.adjugate + have h : Ideal.span {T.charpoly} ≤ J := + Ideal.span_le.mpr fun _ hx => Set.mem_singleton_iff.mp hx ▸ charpoly_mem_adjugate_ideal T + let e := (DoubleQuot.quotQuotEquivQuotOfLEₐ K h).toLinearEquiv + have hm : J.map (Ideal.Quotient.mkₐ K (Ideal.span {T.charpoly})) = + matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly)) := + matrixEntryIdeal_map (AdjoinRoot.mk T.charpoly) T.charmatrix.adjugate + rw [hm] at e + letI : IsScalarTower K (AdjoinRoot T.charpoly) (AdjoinRoot T.charpoly) := + AdjoinRoot.isScalarTower_right T.charpoly + let e₀ := Submodule.Quotient.restrictScalarsEquiv K + (matrixEntryIdeal (T.charmatrix.adjugate.map (AdjoinRoot.mk T.charpoly))) + exact e₀.trans e + +end +end PermanentBorder.Conductor + +namespace PermanentBorder.PencilSeparability +open Polynomial Matrix +section Specialization +variable {R K L : Type*} [CommRing R] [Field K] [Field L] + +theorem monic_generic_separable (f : R[X]) (hf : f.Monic) + (σ : R →+* K) (φ : R →+* L) (hφ : Function.Injective φ) + (hs : (f.map σ).Separable) : (f.map φ).Separable := by + let g := f.derivative + have hσd : (f.map σ).natDegree = f.natDegree := hf.natDegree_map σ + have hφd : (f.map φ).natDegree = f.natDegree := hf.natDegree_map φ + have hd : (g.map σ).natDegree ≤ g.natDegree := natDegree_map_le + have hσ : σ (resultant f g) ≠ 0 := by + rw [← resultant_map_map f g f.natDegree g.natDegree, ← hσd] + conv_lhs => rw [show g.natDegree = (g.map σ).natDegree + + (g.natDegree - (g.map σ).natDegree) by omega] + rw [resultant_add_right_deg _ _ _ _ _ le_rfl] + have hc : (f.map σ).coeff (f.map σ).natDegree = 1 := (hf.map σ).coeff_natDegree + rw [hc, one_pow, one_mul] + exact resultant_ne_zero _ _ (by simpa only [Separable, g, derivative_map] using hs) + have hres : resultant f g ≠ 0 := fun h => hσ (h ▸ σ.map_zero) + have hφg : (g.map φ).natDegree = g.natDegree := natDegree_map_eq_of_injective hφ g + apply (isUnit_resultant_iff_isCoprime (hf.map φ)).mp + apply isUnit_iff_ne_zero.mpr + rw [derivative_map, hφd, hφg, resultant_map_map] + exact fun h => hres (hφ (h.trans φ.map_zero.symm)) + +end Specialization +section Scaling +variable {K : Type*} [Field K] + +theorem separable_comp_linear (f : K[X]) (hf : f.Separable) (a : K) (ha : a ≠ 0) : + (f.comp (C a * X)).Separable := by + obtain ⟨u,v,h⟩ := hf + let p : K[X] := C a * X + refine ⟨u.comp p, C a⁻¹ * v.comp p, ?_⟩ + have hc := congrArg (fun z : K[X] => z.comp p) h + simp only [add_comp, mul_comp, one_comp] at hc + have hd : derivative p = C a := by + simp only [p, derivative_mul, derivative_C, zero_mul, derivative_X, mul_one, zero_add] + change u.comp p * f.comp p + (C a⁻¹ * v.comp p) * derivative (f.comp p) = 1 + rw [derivative_comp, hd] + have haC : C a⁻¹ * C a = (1 : K[X]) := by + rw [← C_mul, inv_mul_cancel₀ ha, C_1] + calc + _ = u.comp p * f.comp p + (C a⁻¹ * C a) * + (v.comp p * f.derivative.comp p) := by ring + _ = 1 := by rw [haC, one_mul]; exact hc + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem charpoly_smul_eq_comp (A : Matrix ι ι K) (a : K) (ha : a ≠ 0) : + (a • A).charpoly = C (a ^ Fintype.card ι) * A.charpoly.comp (C a⁻¹ * X) := by + let φ : K[X] →+* K[X] := eval₂RingHom C (C a⁻¹ * X) + have hm : (a • A).charmatrix = C a • A.charmatrix.map φ := by + apply Matrix.ext + intro i j + by_cases h : i = j + · subst j + simp only [charmatrix_apply, diagonal_apply_eq, Matrix.smul_apply, smul_eq_mul, + Matrix.map_apply, φ, coe_eval₂RingHom, eval₂_sub, eval₂_X, eval₂_C, map_mul] + have hx : C a * C a⁻¹ = (1 : K[X]) := by + rw [← C_mul, mul_inv_cancel₀ ha, C_1] + rw [mul_sub, ← mul_assoc, hx, one_mul] + · simp only [charmatrix_apply, diagonal_apply_ne _ h, Matrix.smul_apply, smul_eq_mul, + Matrix.map_apply, zero_sub, φ, coe_eval₂RingHom, eval₂_neg, + eval₂_C, map_mul, mul_neg] + rw [Matrix.charpoly, hm, Matrix.det_smul] + have hd : (A.charmatrix.map φ).det = φ A.charpoly := (φ.map_det _).symm + rw [hd] + simp only [map_pow, φ, coe_eval₂RingHom, Polynomial.comp] + +theorem separable_charpoly_smul (A : Matrix ι ι K) (hA : A.charpoly.Separable) + (a : K) (ha : a ≠ 0) : (a • A).charpoly.Separable := by + rw [charpoly_smul_eq_comp A a ha] + exact (separable_comp_linear A.charpoly hA a⁻¹ (inv_ne_zero ha)).unit_mul + (isUnit_C.mpr (isUnit_iff_ne_zero.mpr (pow_ne_zero _ ha))) +end Scaling + +section Pencil +variable {K ι : Type*} [Field K] [Fintype ι] [DecidableEq ι] + +theorem distinct_slope_pencil_separable (θ : ι → K) (hθ : Function.Injective θ) + (A : Matrix ι ι K) : + ((-((X : K[X]) • (Matrix.diagonal θ).map C + A.map C)).charpoly.map + (algebraMap K[X] (FractionRing K[X]))).Separable := by + let Q := FractionRing K[X] + let t : Q := algebraMap K[X] Q X + have ht : Transcendental K t := + (transcendental_algebraMap_iff (IsFractionRing.injective K[X] Q)).mpr + (transcendental_X K) + have hti : Transcendental K t⁻¹ := by + simpa only [Transcendental, IsAlgebraic.inv_iff] using ht + let φ : K[X] →+* Q := (aeval t⁻¹).toRingHom + have hφ : Function.Injective φ := transcendental_iff_injective.mp hti + let B : Matrix ι ι K[X] := -((Matrix.diagonal θ).map C + (X : K[X]) • A.map C) + have hB : (B.charpoly.map (evalRingHom (0 : K))).Separable := by + rw [← charpoly_map] + have he : B.map (evalRingHom (0 : K)) = Matrix.diagonal (fun i => -θ i) := by + apply Matrix.ext + intro i j + by_cases h : i = j <;> simp [B, h] + rw [he, charpoly_diagonal, separable_prod_X_sub_C_iff] + exact fun i j hij => hθ (neg_injective hij) + have hs := monic_generic_separable B.charpoly B.charpoly_monic + (evalRingHom (0 : K)) φ hφ hB + rw [← charpoly_map] at hs + have ht0 : t ≠ 0 := fun h => ht (h ▸ isAlgebraic_zero) + have hm : (-((X : K[X]) • (Matrix.diagonal θ).map C + A.map C)).map + (algebraMap K[X] Q) = t • B.map φ := by + apply Matrix.ext + intro i j + simp only [Matrix.map_apply, Matrix.neg_apply, Matrix.add_apply, + Matrix.smul_apply, smul_eq_mul, map_neg, map_add, map_mul, B] + have hc (x : K) : algebraMap K[X] Q (C x) = algebraMap K Q x := + (IsScalarTower.algebraMap_apply K K[X] Q x).symm + simp only [φ, AlgHom.toRingHom_eq_coe, AlgHom.coe_toRingHom, aeval_C, aeval_X, hc] + change -(t * algebraMap K Q ((Matrix.diagonal θ) i j) + algebraMap K Q (A i j)) = + t * -(algebraMap K Q ((Matrix.diagonal θ) i j) + t⁻¹ * algebraMap K Q (A i j)) + rw [mul_neg, mul_add, ← mul_assoc, mul_inv_cancel₀ ht0, one_mul] + rw [← charpoly_map, hm] + exact separable_charpoly_smul (B.map φ) hs t ht0 +end Pencil +end PermanentBorder.PencilSeparability + +namespace PermanentBorder.AdjugateAlgebra +open Polynomial Matrix Conductor +section +variable {K : Type*} [Field K] [Infinite K] {k : ℕ} + +theorem charmatrix_neg_eq_pencil {R ι : Type*} [CommRing R] [Fintype ι] [DecidableEq ι] + (B : Matrix ι ι R) : (-B).charmatrix = pencilMatrix B := by + apply Matrix.ext + intro i j + by_cases h : i = j <;> + simp [pencilMatrix, h] + +theorem cofactorIdeal_eq_matrixEntryIdeal {R ι : Type*} [CommRing R] + [Fintype ι] [DecidableEq ι] (B : Matrix ι ι R) : + cofactorIdeal B = matrixEntryIdeal (-B).charmatrix.adjugate := by + rw [charmatrix_neg_eq_pencil] + rfl + +theorem critical_normalization_defect + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (q : ℕ) (hq : 3*q ≤ k) + (hcrit : ∀ i j, (((pencilMatrix (pencilBase θ A)).adjugate i j).coeff q).coeff q = 0) : + let T := -(pencilBase θ A) + let Q := FractionRing K[X] + let R := integralClosure K[X] (AdjoinRoot (T.charpoly.map (algebraMap K[X] Q))) + ((q+2).choose 2 : ℕ∞) ≤ Module.length K (R ⧸ LinearMap.range + (normalizationInclusion (Q := Q) T.charpoly T.charpoly_monic).toLinearMap) := by + let T := -(pencilBase θ A) + have hs : (T.charpoly.map (algebraMap K[X] (FractionRing K[X]))).Separable := + PencilSeparability.distinct_slope_pencil_separable θ hθ A + have h := critical_cofactor_length θ hθ A q hq hcrit + rw [cofactorIdeal_eq_matrixEntryIdeal] at h + have he := (polynomialCofactorQuotientEquiv (K := K) T).length_eq + rw [← he] at h + exact h.trans (normalization_adjugate_length_global (K := K) T hs) + +end +end PermanentBorder.AdjugateAlgebra + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/PlaneHilbert.lean b/lean/OAI/Algebra/Determinantal/PlaneHilbert.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd1772d976dbf8c112a89b0cc7941ae230a9348c --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/PlaneHilbert.lean @@ -0,0 +1,289 @@ +import OAI.Algebra.Determinantal.BranchConductor + +namespace OAI + +namespace PermanentBorder.PlaneHilbert +open MvPolynomial SliceParameters Multigraded +variable {K : Type*} [Field K] + +abbrev Plane := MvPolynomial (Fin 2) K +abbrev weight : Fin 2 → ℤ := fun _ => 1 +abbrev H (d : ℤ) := Piece (K := K) weight d + +noncomputable def pieceCoordinates (d : ℤ) : H (K := K) d ≃ₗ[K] (DegreeIndex (Fin 2) d → K) where + toFun p s := p.val.coeff s.val + invFun b := ⟨∑ s : DegreeIndex (Fin 2) d, monomial s.val (b s), sum_degree_homogeneous d b⟩ + left_inv p := Subtype.ext (homogeneous_sum_degree p.property).symm + right_inv b := funext (coeff_sum_degree d b) + map_add' p q := by ext s; rfl + map_smul' c p := by ext s; exact coeff_smul s.val c p.val + +instance piece_finite (d : ℤ) : Module.Finite K (H (K := K) d) := + Module.Finite.of_injective (pieceCoordinates d).toLinearMap (pieceCoordinates d).injective + +lemma degree_fin_two (s : Fin 2 →₀ ℕ) : s.degree = s 0+s 1 := by + rw [Finsupp.degree_eq_sum] + exact Fin.sum_univ_two s + +noncomputable def degreeIndexEquiv (n : ℕ) : DegreeIndex (Fin 2) (n : ℤ) ≃ Fin (n+1) where + toFun s := ⟨s.val 0, by + have hs : s.val 0+s.val 1 = n := by exact_mod_cast degree_fin_two s.val ▸ s.property + omega⟩ + invFun i := ⟨Finsupp.equivFunOnFinite.symm (fun j => if j=0 then i.val else n-i.val), by + rw [degree_fin_two] + simp only [Finsupp.coe_equivFunOnFinite_symm, ↓reduceIte, Fin.isValue] + have hh : (1 : Fin 2) ≠ 0 := by decide + simp only [hh, ↓reduceIte] + omega⟩ + left_inv s := by + apply Subtype.ext + ext i + have hs : s.val 0+s.val 1 = n := by exact_mod_cast degree_fin_two s.val ▸ s.property + fin_cases i + · simp + · simp only [Finsupp.coe_equivFunOnFinite_symm] + change (if (1 : Fin 2) = 0 then s.val 0 else n - s.val 0) = s.val 1 + simp only [show (1 : Fin 2) ≠ 0 by decide, ↓reduceIte] + omega + right_inv i := by + apply Fin.ext + simp + +lemma finrank_piece (d : ℤ) : Module.finrank K (H (K := K) d) = (d+1).toNat := by + rw [(pieceCoordinates d).finrank_eq, Module.finrank_pi] + by_cases hd : 0 ≤ d + · obtain ⟨n,rfl⟩ := Int.eq_ofNat_of_zero_le hd + rw [Fintype.card_congr (degreeIndexEquiv n), Fintype.card_fin] + omega + · have : IsEmpty (DegreeIndex (Fin 2) d) := ⟨fun s => by + have hs : (0 : ℤ) ≤ s.val.degree := by positivity + exact hd (s.property ▸ hs)⟩ + have hc : Fintype.card (DegreeIndex (Fin 2) d) = 0 := Fintype.card_eq_zero + rw [hc] + omega + +end PermanentBorder.PlaneHilbert + +namespace PermanentBorder.PlaneHilbert +open MvPolynomial SliceParameters Multigraded +variable {K : Type*} [Field K] + +noncomputable def varMul (i : Fin 2) (n : ℕ) : + H (K := K) (n : ℤ) →ₗ[K] H (K := K) ((n+1 : ℕ) : ℤ) where + toFun p := ⟨X i * p.val, by + have hh := (homogeneous_intWeight (isHomogeneous_X K i)).mul p.property + change (X i * p.val).IsWeightedHomogeneous weight ((n+1 : ℕ) : ℤ) + simpa only [Nat.cast_add, Nat.cast_one, add_comm] using hh⟩ + map_add' p q := Subtype.ext (mul_add _ _ _) + map_smul' c p := Subtype.ext (mul_smul_comm _ _ _) + +lemma varMul_injective (i : Fin 2) (n : ℕ) : + Function.Injective (varMul (K := K) i n) := by + intro p q h + apply Subtype.ext + exact mul_left_cancel₀ (X_ne_zero i) (congrArg Subtype.val h) + +lemma piece_degreeOf_le {n : ℕ} (p : H (K := K) (n : ℤ)) (i : Fin 2) : + p.val.degreeOf i ≤ n := + (degreeOf_le_totalDegree _ _).trans (intWeight_homogeneous p.property).totalDegree_le + +theorem exists_varMul_outside {n : ℕ} (W : Submodule K (H (K := K) (n : ℤ))) + (hW : W ≠ ⊥) : + ∃ p ∈ W, varMul 0 n p ∉ W.map (varMul 1 n) := by + classical + obtain ⟨p,hp,hp0⟩ := W.ne_bot_iff.mp hW + have hpv : p.val ≠ 0 := fun h => hp0 (Subtype.ext h) + let P : ℕ → Prop := fun j => ∃ v ∈ W, v.val ≠ 0 ∧ v.val.degreeOf 0 = j + have he : P (p.val.degreeOf 0) := ⟨p,hp,hpv,rfl⟩ + have hb := piece_degreeOf_le p 0 + obtain ⟨q,hq,hq0,hqm⟩ := Nat.findGreatest_spec hb he + refine ⟨q,hq,?_⟩ + rintro ⟨z,hz,heq⟩ + have hz0 : z.val ≠ 0 := by + intro h + have hh := congrArg Subtype.val heq + change X 1 * z.val = X 0 * q.val at hh + rw [h,mul_zero] at hh + exact (mul_ne_zero (X_ne_zero 0) hq0) hh.symm + have hzm : z.val.degreeOf 0 ≤ Nat.findGreatest P n := + Nat.le_findGreatest (piece_degreeOf_le z 0) ⟨z,hz,hz0,rfl⟩ + have hh := congrArg (fun v : H (K := K) ((n+1 : ℕ) : ℤ) => v.val.degreeOf 0) heq + change (X 1 * z.val).degreeOf 0 = (X 0 * q.val).degreeOf 0 at hh + rw [mul_comm (X 1), degreeOf_mul_X_of_ne _ (by decide : (0 : Fin 2) ≠ 1), + mul_comm (X 0), (degreeOf_mul_X_eq_degreeOf_add_one_iff 0 q.val).mpr hq0] at hh + omega + +lemma finrank_varMul_sup {n : ℕ} (W : Submodule K (H (K := K) (n : ℤ))) + (hW : W ≠ ⊥) : + Module.finrank K W + 1 ≤ + Module.finrank K ↥(W.map (varMul 0 n) ⊔ W.map (varMul 1 n)) := by + obtain ⟨p,hp,hnot⟩ := exists_varMul_outside W hW + have hlt : W.map (varMul 1 n) < W.map (varMul 0 n) ⊔ W.map (varMul 1 n) := by + refine lt_of_le_of_ne le_sup_right ?_ + intro heq + apply hnot + rw [heq] + exact Submodule.mem_sup_left (Submodule.mem_map_of_mem hp) + have hf := Submodule.finrank_strictMono hlt + dsimp only at hf + rw [← (Submodule.equivMapOfInjective (varMul 1 n) (varMul_injective 1 n) W).finrank_eq] at hf + omega + +noncomputable abbrev idealComponent (I : Ideal (Plane (K := K))) (n : ℕ) : + Submodule K (H (K := K) (n : ℤ)) := + (I.restrictScalars K).comap (H (K := K) (n : ℤ)).subtype + +noncomputable def hVector (I : Ideal (Plane (K := K))) (n : ℕ) : ℕ := + Module.finrank K (H (K := K) (n : ℤ) ⧸ idealComponent I n) + +lemma hVector_add_component (I : Ideal (Plane (K := K))) (n : ℕ) : + hVector I n + Module.finrank K (idealComponent I n) = n+1 := by + rw [hVector, Submodule.finrank_quotient_add_finrank, finrank_piece] + omega + +lemma hVector_le (I : Ideal (Plane (K := K))) (n : ℕ) : hVector I n ≤ n+1 := by + have := hVector_add_component I n + omega + +lemma varMul_component_le (I : Ideal (Plane (K := K))) (i : Fin 2) (n : ℕ) : + (idealComponent I n).map (varMul i n) ≤ idealComponent I (n+1) := by + rintro _ ⟨p,hp,rfl⟩ + exact I.mul_mem_left _ hp + +lemma hVector_succ_le (I : Ideal (Plane (K := K))) (n : ℕ) : + hVector I (n+1) ≤ hVector I n + 1 := by + have hmono := Submodule.finrank_mono (varMul_component_le I 0 n) + rw [← (Submodule.equivMapOfInjective (varMul 0 n) (varMul_injective 0 n) + (idealComponent I n)).finrank_eq] at hmono + have h1 := hVector_add_component I n + have h2 := hVector_add_component I (n+1) + omega + +lemma hVector_succ_le_of_deficit (I : Ideal (Plane (K := K))) {n : ℕ} + (hn : hVector I n < n+1) : hVector I (n+1) ≤ hVector I n := by + have hW : idealComponent I n ≠ ⊥ := by + intro h + have hh := hVector_add_component I n + rw [h, finrank_bot] at hh + omega + have hh := finrank_varMul_sup (idealComponent I n) hW + have hl := Submodule.finrank_mono + (sup_le (varMul_component_le I 0 n) (varMul_component_le I 1 n)) + have h1 := hVector_add_component I n + have h2 := hVector_add_component I (n+1) + omega + +lemma hVector_le_of_deficit (I : Ideal (Plane (K := K))) {n m : ℕ} + (hn : hVector I n < n+1) (hnm : n ≤ m) : hVector I m ≤ hVector I n := by + induction m, hnm using Nat.le_induction with + | base => exact le_rfl + | succ m hnm ih => + exact (hVector_succ_le_of_deficit I (by omega : hVector I m < m+1)).trans ih + +lemma hVector_normalized_succ (I : Ideal (Plane (K := K))) (n : ℕ) : + (n+1) * hVector I (n+1) ≤ (n+2) * hVector I n := by + have hb := hVector_le I n + rcases hb.eq_or_lt with he|hl + · rw [he] + have hh := hVector_le I (n+1) + nlinarith + · have hh := hVector_succ_le_of_deficit I hl + nlinarith + +end PermanentBorder.PlaneHilbert +namespace PermanentBorder.PlaneHilbert +open MvPolynomial SliceParameters Multigraded +variable {K : Type*} [Field K] + +lemma homogeneous_factor_right {a b : Plane (K := K)} {e t : ℤ} + (ha : a.IsWeightedHomogeneous weight e) (h0 : a ≠ 0) + (hab : (a*b).IsWeightedHomogeneous weight t) : + b.IsWeightedHomogeneous weight (t-e) := by + have hh := weightedHomogeneousComponent_eq_self hab + rw [project_mul weight ha] at hh + have hb : weightedHomogeneousComponent weight (t-e) b = b := mul_left_cancel₀ h0 hh + rw [← hb] + exact weightedHomogeneousComponent_mem weight b (t-e) + +lemma mulPiece_injective {a : Plane (K := K)} {e : ℤ} + (ha : a.IsWeightedHomogeneous weight e) (ha0 : a ≠ 0) (t : ℤ) : + Function.Injective (mulPiece weight ha t) := by + intro p q h + apply Subtype.ext + exact mul_left_cancel₀ ha0 (congrArg Subtype.val h) + +noncomputable abbrev multiplicationRange {a : Plane (K := K)} {e : ℤ} + (ha : a.IsWeightedHomogeneous weight e) (t : ℤ) := + LinearMap.range (mulPiece weight ha t) + +lemma finrank_multiplicationRange {a : Plane (K := K)} {e : ℤ} + (ha : a.IsWeightedHomogeneous weight e) (ha0 : a ≠ 0) (t : ℤ) : + Module.finrank K (multiplicationRange ha t) = (t-e+1).toNat := by + rw [LinearMap.finrank_range_of_inj (mulPiece_injective ha ha0 t), finrank_piece] + +lemma multiplicationRange_inf {a b : Plane (K := K)} {e f : ℤ} + (ha : a.IsWeightedHomogeneous weight e) (hb : b.IsWeightedHomogeneous weight f) + (hb0 : b ≠ 0) (hab : IsRelPrime a b) (t : ℤ) : + multiplicationRange ha t ⊓ multiplicationRange hb t = + multiplicationRange (ha.mul hb) t := by + ext p + constructor + · rintro ⟨⟨u,hu⟩,⟨v,hv⟩⟩ + have huv : a*u.val = b*v.val := congrArg Subtype.val (hu.trans hv.symm) + have hd : b ∣ u.val := hab.symm.dvd_of_dvd_mul_left ⟨v,huv⟩ + obtain ⟨w,hw⟩ := hd + have hbw : (b*w).IsWeightedHomogeneous weight (t-e) := hw ▸ u.property + have hwh := homogeneous_factor_right hb hb0 hbw + have hh : (t-e)-f = t-(e+f) := by ring + rw [hh] at hwh + refine ⟨⟨w,hwh⟩,?_⟩ + apply Subtype.ext + change (a*b)*w = p.val + rw [mul_assoc, ← hw] + exact congrArg Subtype.val hu + · rintro ⟨w,hw⟩ + have hbw : (b*w.val).IsWeightedHomogeneous weight (t-e) := by + convert hb.mul w.property using 1; ring + have haw : (a*w.val).IsWeightedHomogeneous weight (t-f) := by + convert ha.mul w.property using 1; ring + constructor + · refine ⟨⟨b*w.val,hbw⟩,?_⟩ + apply Subtype.ext + change a*(b*w.val) = p.val + rw [← mul_assoc] + exact congrArg Subtype.val hw + · refine ⟨⟨a*w.val,haw⟩,?_⟩ + apply Subtype.ext + change b*(a*w.val) = p.val + rw [← mul_assoc, mul_comm b a] + exact congrArg Subtype.val hw + +lemma multiplicationRange_le_component (I : Ideal (Plane (K := K))) + {a : Plane (K := K)} {e : ℤ} (ha : a.IsWeightedHomogeneous weight e) + (haI : a ∈ I) (n : ℕ) : multiplicationRange ha (n : ℤ) ≤ idealComponent I n := by + rintro _ ⟨p,rfl⟩ + exact I.mul_mem_right _ haI + +theorem hVector_coprime_bound (I : Ideal (Plane (K := K))) + {a b : Plane (K := K)} {e f : ℤ} + (ha : a.IsWeightedHomogeneous weight e) (hb : b.IsWeightedHomogeneous weight f) + (ha0 : a ≠ 0) (hb0 : b ≠ 0) (hab : IsRelPrime a b) + (haI : a ∈ I) (hbI : b ∈ I) (n : ℕ) : + hVector I n + ((n : ℤ)-e+1).toNat + ((n : ℤ)-f+1).toNat ≤ + n+1 + ((n : ℤ)-(e+f)+1).toNat := by + have hh := Submodule.finrank_sup_add_finrank_inf_eq + (multiplicationRange ha (n : ℤ)) (multiplicationRange hb (n : ℤ)) + rw [multiplicationRange_inf ha hb hb0 hab, + finrank_multiplicationRange ha ha0, finrank_multiplicationRange hb hb0, + finrank_multiplicationRange (ha.mul hb) (mul_ne_zero ha0 hb0)] at hh + have hl : Module.finrank K ↥(multiplicationRange ha (n : ℤ) ⊔ + multiplicationRange hb (n : ℤ)) ≤ Module.finrank K (idealComponent I n) := + Submodule.finrank_mono (sup_le + (multiplicationRange_le_component I ha haI n) + (multiplicationRange_le_component I hb hbI n)) + have heq := hVector_add_component I n + omega + +end PermanentBorder.PlaneHilbert + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/PointBounds.lean b/lean/OAI/Algebra/Determinantal/PointBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3a0df33fcc3312451c564e52f5d47a218846dbb --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/PointBounds.lean @@ -0,0 +1,419 @@ +import OAI.Algebra.Determinantal.LinearForms + +namespace OAI + +namespace PermanentBorder.Multigraded +section AffineCokernel +variable {K V W : Type*} [Field K] + [AddCommGroup V] [Module K V] [AddCommGroup W] [Module K W] [Module.Finite K W] + +theorem affine_cokernel_polynomial (f g : V →ₗ[K] W) : + ∃ p : Polynomial K, p.eval 0 = 1 ∧ ∀ t : K, p.eval t ≠ 0 → + Module.finrank K (W ⧸ LinearMap.range ((1-t) • f + t • g)) ≤ + Module.finrank K (W ⧸ LinearMap.range f) := by + classical + let b := Module.finBasis K (LinearMap.range f) + choose z hz using fun i => (b i).property + have hli : LinearIndependent K (fun i => f (z i)) := by + have h := b.linearIndependent.map' (LinearMap.range f).subtype (Submodule.ker_subtype _) + simpa only [hz, Function.comp_def, Submodule.subtype_apply] using h + obtain ⟨p,hp,hi⟩ := affine_independent_polynomial (fun i => f (z i)) + (fun i => g (z i)) hli + refine ⟨p,hp,?_⟩ + intro t ht + let ft : V →ₗ[K] W := (1-t) • f + t • g + let bt : Fin (Module.finrank K (LinearMap.range f)) → LinearMap.range ft := + fun i => ⟨ft (z i), LinearMap.mem_range_self _ _⟩ + have htli : LinearIndependent K bt := by + apply LinearIndependent.of_comp (LinearMap.range ft).subtype + exact hi t ht + have hb := htli.fintype_card_le_finrank + simp only [Fintype.card_fin] at hb + have hf := (LinearMap.range f).finrank_quotient_add_finrank + have hg := (LinearMap.range ft).finrank_quotient_add_finrank + dsimp only [ft] at hg hb + omega + +end AffineCokernel +end PermanentBorder.Multigraded + +namespace PermanentBorder.Multigraded +open MvPolynomial +section GenericPieceBound +variable {K σ G E : Type*} [Field K] [AddCommGroup G] [Fintype E] + +theorem generic_homogeneous_quotient_bound (w : σ → G) (e : E → G) + (F Q : E → MvPolynomial σ K) + (hF : ∀ i, (F i).IsWeightedHomogeneous w (e i)) + (hQ : ∀ i, (Q i).IsWeightedHomogeneous w (e i)) + (d : G) [Module.Finite K (Piece (K := K) w d)] : + ∃ p : Polynomial K, p.eval 0 = 1 ∧ ∀ t : K, p.eval t ≠ 0 → + Module.finrank K (componentQuotient w + (Ideal.span (Set.range (fun i => (1-t) • Q i + t • F i))) d) ≤ + Module.finrank K (componentQuotient w (Ideal.span (Set.range Q)) d) := by + obtain ⟨p,hp,h⟩ := affine_cokernel_polynomial + (homogeneousIdealMap w e Q hQ d) (homogeneousIdealMap w e F hF d) + refine ⟨p,hp,?_⟩ + intro t ht + have h' := h t ht + rw [← homogeneousIdealMap_affine w e F hF Q hQ d t] at h' + rw [homogeneousIdealMap_range w e Q hQ d] at h' + rw [homogeneousIdealMap_range] at h' + exact h' + +end GenericPieceBound + +section ProductComparison +variable {K ι : Type*} [Field K] [Fintype ι] [DecidableEq ι] + +theorem generic_product_piece_bound (a : ι →₀ ℕ) + (qs : List (FactorPair (K := K) (blockWeight (fun v : BlockVariables a => v.1)))) + (u v : Fin qs.length → ι) (t : (Fin qs.length × Bool) → K) + (ht : Function.Injective t) + (hleft : ∀ i, (qs.get i).left = blockLinearForm a (u i) (t (i,false))) + (hright : ∀ i, (qs.get i).right = blockLinearForm a (v i) (t (i,true))) + (hdeg : ∀ q ∈ qs, ∀ j, q.leftDegree j ≤ 1) + (hlen : qs.length = ∑ j, a j) + (F : Fin qs.length → MvPolynomial (BlockVariables a) K) + (hF : ∀ i, (F i).IsWeightedHomogeneous + (blockWeight (fun v : BlockVariables a => v.1)) + ((qs.get i).leftDegree + (qs.get i).rightDegree)) + (d : ι → ℤ) (hd : ∀ j, (qs.length : ℤ) < d j) : + ∃ p : Polynomial K, p.eval 0 = 1 ∧ ∀ c : K, p.eval c ≠ 0 → + pieceDim (blockWeight (fun v : BlockVariables a => v.1)) + (Ideal.span (Set.range (fun i => + (1-c) • ((qs.get i).left * (qs.get i).right) + c • F i))) d ≤ + (mixedPolynomial u v).coeff a := by + let w := blockWeight (fun v : BlockVariables a => v.1) + obtain ⟨p,hp,h⟩ := generic_homogeneous_quotient_bound w + (fun i => (qs.get i).leftDegree + (qs.get i).rightDegree) F + (fun i => (qs.get i).left * (qs.get i).right) hF + (fun i => (qs.get i).left_homogeneous.mul (qs.get i).right_homogeneous) d + refine ⟨p,hp,?_⟩ + intro c hc + apply (h c hc).trans + rw [← productIdeal_eq_span] + exact comparison_piece_bound a qs u v t ht hleft hright hdeg hlen d hd + +end ProductComparison +end PermanentBorder.Multigraded + +namespace PermanentBorder.Multigraded +open MvPolynomial +section BlockInterpolation +variable {K σ ι L : Type*} [Field K] [Fintype ι] [DecidableEq ι] +variable (group : σ → ι) (base : ι → σ) (hbase : ∀ j, group (base j) = j) + +include hbase in +omit [Fintype ι] in +lemma normalized_pair_separator (x y : σ → K) (hxy : x ≠ y) + (hx : ∀ j, x (base j) = 1) (hy : ∀ j, y (base j) = 1) : + ∃ (p : MvPolynomial σ K) (e : ι → ℤ), + p.IsWeightedHomogeneous (blockWeight group) e ∧ + (∀ j, 0 ≤ e j ∧ e j ≤ 1) ∧ eval x p = 1 ∧ eval y p = 0 := by + classical + obtain ⟨v,hv⟩ := Function.ne_iff.mp hxy + let p : MvPolynomial σ K := C ((x v-y v)⁻¹) * (X v - C (y v) * X (base (group v))) + refine ⟨p, Pi.single (group v) 1, ?_, ?_, ?_, ?_⟩ + · apply IsWeightedHomogeneous.C_mul + apply IsWeightedHomogeneous.sub + · exact isWeightedHomogeneous_X _ _ _ + · simpa only [blockWeight, hbase] using + (isWeightedHomogeneous_X K (blockWeight group) (base (group v))).C_mul (y v) + · intro j; by_cases h : j = group v <;> simp [h] + · simp [p, hx, sub_ne_zero.mpr hv] + · simp [p, hy] + +include hbase in +lemma normalized_padding_homogeneous (b : ι → ℕ) : + (∏ j, (X (base j) : MvPolynomial σ K) ^ b j).IsWeightedHomogeneous + (blockWeight group) (fun j => (b j : ℤ)) := by + classical + have h := IsWeightedHomogeneous.prod Finset.univ + (fun j => (X (base j) : MvPolynomial σ K) ^ b j) + (fun j => b j • Pi.single j (1 : ℤ)) (fun j _ => by + convert (isWeightedHomogeneous_X K (blockWeight group) (base j)).pow (b j) using 1 + simp only [blockWeight, hbase]) + convert h using 1 + ext j + simp [Pi.single_apply] + +omit [DecidableEq ι] in +lemma normalized_padding_eval (b : ι → ℕ) (x : σ → K) (hx : ∀ j, x (base j) = 1) : + eval x (∏ j, (X (base j) : MvPolynomial σ K) ^ b j) = 1 := by + simp [hx] + +variable [Fintype L] [DecidableEq L] + +include hbase in + +theorem normalized_interpolation (d : ι → ℤ) (hd : ∀ j, (Fintype.card L : ℤ) ≤ d j) + (x : L → σ → K) (hx : Function.Injective x) (hb : ∀ i j, x i (base j) = 1) : + ∃ p : L → Piece (K := K) (blockWeight group) d, + ∀ i j, eval (x j) (p i).val = if j = i then 1 else 0 := by + classical + have hs (i j : L) : ∃ (p : MvPolynomial σ K) (e : ι → ℤ), + p.IsWeightedHomogeneous (blockWeight group) e ∧ + (∀ l, 0 ≤ e l ∧ e l ≤ 1) ∧ eval (x i) p = 1 ∧ (i ≠ j → eval (x j) p = 0) := by + by_cases hij : i = j + · refine ⟨1,0,isWeightedHomogeneous_one _ _,?_,by simp,?_⟩ + · intro l; simp + · exact fun h => (h hij).elim + · obtain ⟨p,e,hp,he,hi,hj⟩ := normalized_pair_separator group base hbase + (x i) (x j) (fun h => hij (hx h)) (hb i) (hb j) + exact ⟨p,e,hp,he,hi,fun _ => hj⟩ + choose p e hp he hi hj using hs + let E : L → ι → ℤ := fun i => ∑ j, e i j + have hE (i : L) (l : ι) : E i l ≤ Fintype.card L := by + dsimp [E] + simpa using Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => (he i j l).2) + let b : L → ι → ℕ := fun i l => (d l - E i l).toNat + have hbdeg (i : L) : (fun l => (b i l : ℤ)) = d-E i := by + funext l + exact Int.toNat_of_nonneg (sub_nonneg.mpr ((hE i l).trans (hd l))) + let P : L → MvPolynomial σ K := fun i => + (∏ j, p i j) * ∏ l, X (base l) ^ b i l + have hPhom (i : L) : (P i).IsWeightedHomogeneous (blockWeight group) d := by + have hp' := IsWeightedHomogeneous.prod Finset.univ (p i) (e i) (fun j _ => hp i j) + have hb' := normalized_padding_homogeneous (K := K) group base hbase (b i) + rw [hbdeg] at hb' + have h := hp'.mul hb' + have hdeg : (∑ j, e i j) + (d - E i) = d := by + dsimp [E]; abel + rw [hdeg] at h + exact h + refine ⟨fun i => ⟨P i,hPhom i⟩,?_⟩ + intro i j + change eval (x j) (P i) = _ + simp only [P, map_mul, map_prod, normalized_padding_eval base (b i) (x j) (hb j), mul_one] + by_cases hij : j = i + · subst j + simp [hi] + · rw [ite_eq_right hij] + exact Finset.prod_eq_zero (Finset.mem_univ j) (hj i j (Ne.symm hij)) + +end BlockInterpolation +end PermanentBorder.Multigraded + +namespace PermanentBorder.Multigraded +open MvPolynomial +section NormalizedPointBound +variable {K σ ι L : Type*} [Field K] [Fintype σ] [Fintype ι] [DecidableEq ι] + [Fintype L] [DecidableEq L] + +theorem normalized_points_le_pieceDim (group : σ → ι) (base : ι → σ) + (hbase : ∀ j, group (base j) = j) (I : Ideal (MvPolynomial σ K)) + (d : ι → ℤ) (hd : ∀ j, (Fintype.card L : ℤ) ≤ d j) + (x : L → σ → K) (hx : Function.Injective x) (hb : ∀ i j, x i (base j) = 1) + (hz : ∀ i, ∀ p ∈ I, eval (x i) p = 0) : + Fintype.card L ≤ Module.finrank K (componentQuotient (blockWeight group) I d) := by + classical + let P := Piece (K := K) (blockWeight group) d + let S : Submodule K P := (I.restrictScalars K).comap P.subtype + let ev : P →ₗ[K] (L → K) := LinearMap.pi fun i => + (aeval (x i)).toLinearMap.comp P.subtype + have heval (p : P) (i : L) : ev p i = eval (x i) p.val := by + simp [ev] + have hker : S ≤ LinearMap.ker ev := by + intro p hp + apply LinearMap.mem_ker.mpr + funext i + rw [heval] + exact hz i p.val hp + let qev := S.liftQ ev hker + obtain ⟨p,hp⟩ := normalized_interpolation group base hbase d hd x hx hb + have hs : Function.Surjective qev := by + intro y + refine ⟨S.mkQ (∑ i, y i • p i), ?_⟩ + change ev (∑ i, y i • p i) = y + apply _root_.funext + intro j + have hei (i : L) : ev (p i) j = if j = i then 1 else 0 := + (heval (p i) j).trans (hp i j) + calc + ev (∑ i, y i • p i) j = ∑ i, y i * ev (p i) j := by simp + _ = y j := by simp [hei] + have h := LinearMap.finrank_le_finrank_of_surjective hs + simpa only [Module.finrank_pi, Module.finrank_self, Finset.sum_const, Finset.card_univ, + smul_eq_mul, mul_one] using h + +end NormalizedPointBound +end PermanentBorder.Multigraded + +namespace PermanentBorder.PolarAnalysis +open Filter +open scoped Topology + +section Persistence +variable {C V : Type*} + [NormedAddCommGroup C] [NormedSpace ℂ C] [CompleteSpace C] + [NormedAddCommGroup V] [NormedSpace ℂ V] [CompleteSpace V] + +def SimpleAt (F : C × V → V) (c : C) (x : V) : Prop := + (fderiv ℂ F (c,x) ∘L ContinuousLinearMap.inr ℂ C V).IsInvertible + +theorem isInvertible_iff_isUnit (T : V →L[ℂ] V) : T.IsInvertible ↔ IsUnit T := by + constructor + · intro h + exact ContinuousLinearMap.isUnit_iff_bijective.mpr h.bijective + · intro h + obtain ⟨U,hU⟩ := h + exact ⟨ContinuousLinearEquiv.ofUnit U, hU⟩ + +omit [CompleteSpace C] in + +theorem isOpen_simple {F : C × V → V} (hF : ContDiff ℂ 1 F) : + IsOpen {u : C × V | SimpleAt F u.1 u.2} := by + have hc : Continuous (fun u : C × V => + fderiv ℂ F u ∘L ContinuousLinearMap.inr ℂ C V) := by + exact (hF.continuous_fderiv (by decide)).clm_comp continuous_const + simpa only [SimpleAt, Prod.mk.eta, isInvertible_iff_isUnit, Set.preimage_ofPred_eq] using + Units.isOpen.preimage hc + +theorem simple_branch {F : C × V → V} (hF : ContDiff ℂ 1 F) + {c : C} {x : V} (hz : F (c,x) = 0) (hs : SimpleAt F c x) : + ∃ ψ : C → V, Tendsto ψ (𝓝 c) (𝓝 x) ∧ + ∀ᶠ c' in 𝓝 c, F (c', ψ c') = 0 ∧ SimpleAt F c' (ψ c') := by + let hf := hF.contDiffAt (x := (c,x)) + let ψ := hf.implicitFunction (by decide) hs + have ht : Tendsto ψ (𝓝 c) (𝓝 x) := + hf.hasStrictFDerivAt (by decide) |>.tendsto_implicitFunctionOfProdDomain hs + refine ⟨ψ,ht,?_⟩ + have hz' := hf.eventually_apply_implicitFunction (by decide) hs + have hne := (tendsto_id.prodMk_nhds ht).eventually ((isOpen_simple hF).mem_nhds hs) + filter_upwards [hz', hne] with c' hc' hs' + exact ⟨hc'.trans hz, hs'⟩ + +theorem finite_simple_zeros_persist {ι : Type*} [Fintype ι] + {F : C × V → V} (hF : ContDiff ℂ 1 F) {c : C} + (x : ι → V) (hx : Function.Injective x) + (hz : ∀ i, F (c,x i) = 0) (hs : ∀ i, SimpleAt F c (x i)) : + ∀ᶠ c' in 𝓝 c, ∃ y : ι → V, Function.Injective y ∧ + ∀ i, F (c',y i) = 0 ∧ SimpleAt F c' (y i) := by + classical + choose ψ ht hψ using fun i => simple_branch hF (hz i) (hs i) + have hall : ∀ᶠ c' in 𝓝 c, ∀ i, F (c',ψ i c') = 0 ∧ SimpleAt F c' (ψ i c') := + Filter.eventually_all.mpr hψ + have hsep : ∀ᶠ c' in 𝓝 c, Function.Injective (fun i => ψ i c') := by + have hp : ∀ i j : ι, ∀ᶠ c' in 𝓝 c, i ≠ j → ψ i c' ≠ ψ j c' := by + intro i j + by_cases hij : i = j + · exact Filter.Eventually.of_forall (by simp [hij]) + · have hh : (x i, x j) ∈ {p : V × V | p.1 ≠ p.2} := by + exact fun h => hij (hx h) + have ho : IsOpen {p : V × V | p.1 ≠ p.2} := isOpen_compl_iff.mpr (isClosed_eq continuous_fst continuous_snd) + have he := ((ht i).prodMk_nhds (ht j)).eventually (ho.mem_nhds hh) + exact he.mono fun _ h _ => h + filter_upwards [Filter.eventually_all.mpr (fun i => Filter.eventually_all.mpr (hp i))] with c' hc' + intro i j he + by_contra hij + exact hc' i j hij he + filter_upwards [hall,hsep] with c' hc' hi + exact ⟨fun i => ψ i c',hi,hc'⟩ +end Persistence +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis +theorem fderiv_slice {C V : Type*} [NormedAddCommGroup C] [NormedSpace ℂ C] + [NormedAddCommGroup V] [NormedSpace ℂ V] + {F : C × V → V} (hF : ContDiff ℂ 1 F) (c : C) (x : V) : + fderiv ℂ (fun x => F (c,x)) x = + fderiv ℂ F (c,x) ∘L ContinuousLinearMap.inr ℂ C V := by + have hi : HasFDerivAt (fun x : V => (c,x)) (ContinuousLinearMap.inr ℂ C V) x := by + simpa [ContinuousLinearMap.inr] using + (hasFDerivAt_const (𝕜 := ℂ) c x).prodMk (hasFDerivAt_id (𝕜 := ℂ) x) + exact ((hF.differentiable (by decide) (c,x)).hasFDerivAt.comp x hi).fderiv + +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis +open MvPolynomial +variable {τ : Type*} [Fintype τ] +theorem contDiff_mvPolynomial_eval (p : MvPolynomial τ ℂ) : + ContDiff ℂ 1 (fun x : τ → ℂ => MvPolynomial.eval x p) := by + induction p using MvPolynomial.induction_on with + | C a => simpa using (contDiff_const : ContDiff ℂ 1 (fun _ : τ → ℂ => a)) + | add p q hp hq => simpa only [map_add] using hp.add hq + | mul_X p i hp => + simpa only [map_mul, eval_X] using hp.mul (contDiff_apply ℂ ℂ i) + +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.Multigraded +open MvPolynomial Filter +open scoped Topology +section ProductSimplePointBound +variable {ι L : Type*} [Fintype ι] [DecidableEq ι] [Fintype L] [DecidableEq L] + +theorem product_simple_point_bound_chart (a : ι →₀ ℕ) + (qs : List (FactorPair (K := ℂ) (blockWeight (fun v : BlockVariables a => v.1)))) + (u v : Fin qs.length → ι) (t : (Fin qs.length × Bool) → ℂ) + (ht : Function.Injective t) + (hleft : ∀ i, (qs.get i).left = blockLinearForm a (u i) (t (i,false))) + (hright : ∀ i, (qs.get i).right = blockLinearForm a (v i) (t (i,true))) + (hdeg : ∀ q ∈ qs, ∀ j, q.leftDegree j ≤ 1) + (hlen : qs.length = ∑ j, a j) + (F : Fin qs.length → MvPolynomial (BlockVariables a) ℂ) + (hF : ∀ i, (F i).IsWeightedHomogeneous + (blockWeight (fun v : BlockVariables a => v.1)) + ((qs.get i).leftDegree + (qs.get i).rightDegree)) + (base : ι → BlockVariables a) (hbase : ∀ j, (base j).1 = j) + (chart : (Fin qs.length → ℂ) → BlockVariables a → ℂ) + (hc : ContDiff ℂ 1 chart) (hci : Function.Injective chart) + (hcn : ∀ z j, chart z (base j) = 1) + (x : L → Fin qs.length → ℂ) (hx : Function.Injective x) + (hz : ∀ i j, eval (chart (x i)) (F j) = 0) + (hs : ∀ i, (fderiv ℂ (fun z j => eval (chart z) (F j)) (x i)).IsInvertible) : + Fintype.card L ≤ (mixedPolynomial u v).coeff a := by + classical + let Q : Fin qs.length → MvPolynomial (BlockVariables a) ℂ := + fun i => (qs.get i).left * (qs.get i).right + let family : ℂ × (Fin qs.length → ℂ) → Fin qs.length → ℂ := + fun z i => (1-z.1) * eval (chart z.2) (Q i) + z.1 * eval (chart z.2) (F i) + have hcont : ContDiff ℂ 1 family := by + apply contDiff_pi.mpr + intro i + exact ((contDiff_const.sub contDiff_fst).mul + ((PolarAnalysis.contDiff_mvPolynomial_eval (Q i)).comp (hc.comp contDiff_snd))).add + (contDiff_fst.mul + ((PolarAnalysis.contDiff_mvPolynomial_eval (F i)).comp (hc.comp contDiff_snd))) + have hone : (fun z => family (1,z)) = (fun z j => eval (chart z) (F j)) := by + funext z j + simp [family] + have hzero (i : L) : family (1,x i) = 0 := by + rw [congrFun hone] + funext j + exact hz i j + have hsimple (i : L) : PolarAnalysis.SimpleAt family 1 (x i) := by + unfold PolarAnalysis.SimpleAt + rw [← PolarAnalysis.fderiv_slice hcont, hone] + exact hs i + have hpersist := PolarAnalysis.finite_simple_zeros_persist hcont x hx hzero hsimple + let d : ι → ℤ := fun _ => qs.length + Fintype.card L + 1 + obtain ⟨p,hp,hbound⟩ := generic_product_piece_bound a qs u v t ht hleft hright hdeg + hlen F hF d (by intro j; dsimp [d]; omega) + have hpne : p ≠ 0 := by + intro h + rw [h, Polynomial.eval_zero] at hp + exact zero_ne_one hp + have hdense : Dense {c : ℂ | p.eval c ≠ 0} := by + exact (Polynomial.finite_setOfPred_isRoot hpne).countable.dense_compl ℂ + obtain ⟨c,hpc,y,hy,hyz⟩ := hdense.inter_nhds_nonempty hpersist + let I := Ideal.span (Set.range (fun i => (1-c) • Q i + c • F i)) + have hyideal (i : L) : ∀ p ∈ I, eval (chart (y i)) p = 0 := by + have hI : I ≤ RingHom.ker (eval (chart (y i))) := by + apply Ideal.span_le.mpr + rintro p ⟨j,rfl⟩ + change eval (chart (y i)) ((1-c) • Q j + c • F j) = 0 + have h := congrFun (hyz i).1 j + simpa only [family, map_add, smul_eval, Pi.zero_apply] using h + exact fun p hp => hI hp + have hpoints := normalized_points_le_pieceDim (fun v : BlockVariables a => v.1) + base hbase I d (by intro j; dsimp [d]; omega) (fun i => chart (y i)) (hci.comp hy) + (fun i j => hcn (y i) j) hyideal + exact hpoints.trans (hbound c hpc) + +end ProductSimplePointBound +end PermanentBorder.Multigraded + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/ProjectiveCounts.lean b/lean/OAI/Algebra/Determinantal/ProjectiveCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..2503d8368bac82b71c8c74877b2017540d7c6154 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/ProjectiveCounts.lean @@ -0,0 +1,416 @@ +import OAI.Algebra.Determinantal.PointBounds + +namespace OAI +namespace PermanentBorder.Multigraded +open MvPolynomial +section BilinearPointCount +variable {ι L : Type*} [Fintype ι] [DecidableEq ι] [Fintype L] [DecidableEq L] + +noncomputable def vandermondePairs (a : ι →₀ ℕ) {M : ℕ} + (u v : Fin M → ι) (t : (Fin M × Bool) → ℂ) : + Fin M → FactorPair (K := ℂ) (blockWeight (fun v : BlockVariables a => v.1)) := + fun i => { left := blockLinearForm a (u i) (t (i,false)) + right := blockLinearForm a (v i) (t (i,true)) + leftDegree := Pi.single (u i) 1 + rightDegree := Pi.single (v i) 1 + left_homogeneous := blockLinearForm_homogeneous a (u i) (t (i,false)) + right_homogeneous := blockLinearForm_homogeneous a (v i) (t (i,true)) } + +theorem bilinear_simple_point_count_chart (a : ι →₀ ℕ) {M : ℕ} + (u v : Fin M → ι) (hM : M = ∑ j, a j) + (F : Fin M → MvPolynomial (BlockVariables a) ℂ) + (hF : ∀ i, (F i).IsWeightedHomogeneous + (blockWeight (fun v : BlockVariables a => v.1)) + (Pi.single (u i) 1 + Pi.single (v i) 1)) + (base : ι → BlockVariables a) (hbase : ∀ j, (base j).1 = j) + (chart : (Fin M → ℂ) → BlockVariables a → ℂ) + (hc : ContDiff ℂ 1 chart) (hci : Function.Injective chart) + (hcn : ∀ z j, chart z (base j) = 1) + (x : L → Fin M → ℂ) (hx : Function.Injective x) + (hz : ∀ i j, eval (chart (x i)) (F j) = 0) + (hs : ∀ i, (fderiv ℂ (fun z j => eval (chart z) (F j)) (x i)).IsInvertible) : + Fintype.card L ≤ (mixedPolynomial u v).coeff a := by + classical + let t : (Fin M × Bool) → ℂ := fun i => + Infinite.natEmbedding ℂ ((Fintype.equivFin (Fin M × Bool) i).val) + have ht : Function.Injective t := + (Infinite.natEmbedding ℂ).injective.comp + (Fin.val_injective.comp (Fintype.equivFin (Fin M × Bool)).injective) + generalize hqs : List.ofFn (vandermondePairs a u v t) = qs + have hlen : qs.length = M := by rw [← hqs, List.length_ofFn] + cases hlen + have hget (i : Fin qs.length) : qs.get i = vandermondePairs a u v t i := by + have h := congrArg (fun l => l[i.val]?) hqs + simpa only [List.getElem?_ofFn, dite_eq_left i.isLt, List.getElem?_eq_getElem i.isLt, + Option.some.injEq, List.get_eq_getElem] using h.symm + apply product_simple_point_bound_chart a qs u v t ht + (fun i => by rw [hget]; rfl) (fun i => by rw [hget]; rfl) ?_ hM F + (by intro i; simpa only [hget, vandermondePairs] using hF i) + base hbase chart hc hci hcn x hx hz hs + intro q hq j + rw [← hqs] at hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + by_cases hj : j = u i <;> simp [vandermondePairs, hj] + +end BilinearPointCount +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section ProductAffineChart +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +abbrev BlockAffineVariables (a : ι → ℕ) := (j : ι) × Fin (a j) + +noncomputable def productAffineChart (a : ι → ℕ) {M : ℕ} + (e : BlockAffineVariables a ≃ Fin M) (z : Fin M → ℂ) : BlockVariables a → ℂ := + fun v => Fin.cases 1 (fun q => z (e ⟨v.1,q⟩)) v.2 + +omit [Fintype ι] [DecidableEq ι] in +lemma productAffineChart_zero (a : ι → ℕ) {M : ℕ} + (e : BlockAffineVariables a ≃ Fin M) (z : Fin M → ℂ) (j : ι) : + productAffineChart a e z ⟨j,0⟩ = 1 := by + simp [productAffineChart] + +omit [Fintype ι] [DecidableEq ι] in +lemma productAffineChart_succ (a : ι → ℕ) {M : ℕ} + (e : BlockAffineVariables a ≃ Fin M) (z : Fin M → ℂ) (j : ι) (q : Fin (a j)) : + productAffineChart a e z ⟨j,q.succ⟩ = z (e ⟨j,q⟩) := by + simp [productAffineChart] + +omit [Fintype ι] [DecidableEq ι] in +lemma productAffineChart_injective (a : ι → ℕ) {M : ℕ} + (e : BlockAffineVariables a ≃ Fin M) : Function.Injective (productAffineChart a e) := by + intro z z' h + funext i + obtain ⟨⟨j,q⟩,rfl⟩ := e.surjective i + have h := congrFun h ⟨j,q.succ⟩ + simpa only [productAffineChart_succ] using h + +omit [DecidableEq ι] in +lemma productAffineChart_contDiff (a : ι → ℕ) {M : ℕ} + (e : BlockAffineVariables a ≃ Fin M) : ContDiff ℂ 1 (productAffineChart a e) := by + apply contDiff_pi.mpr + rintro ⟨j,q⟩ + refine Fin.cases ?_ (fun q => ?_) q + · simpa only [productAffineChart_zero] using + (contDiff_const : ContDiff ℂ 1 (fun _ : Fin M → ℂ => (1 : ℂ))) + · simpa only [productAffineChart_succ] using contDiff_apply ℂ ℂ (e ⟨j,q⟩) + +variable {L : Type*} [Fintype L] [DecidableEq L] + +theorem bilinear_simple_point_count (a : ι →₀ ℕ) {M : ℕ} + (e : BlockAffineVariables a ≃ Fin M) (u v : Fin M → ι) + (F : Fin M → MvPolynomial (BlockVariables a) ℂ) + (hF : ∀ i, (F i).IsWeightedHomogeneous + (blockWeight (fun v : BlockVariables a => v.1)) + (Pi.single (u i) 1 + Pi.single (v i) 1)) + (x : L → Fin M → ℂ) (hx : Function.Injective x) + (hz : ∀ i j, eval (productAffineChart a e (x i)) (F j) = 0) + (hs : ∀ i, (fderiv ℂ (fun z j => eval (productAffineChart a e z) (F j)) + (x i)).IsInvertible) : + Fintype.card L ≤ (mixedPolynomial u v).coeff a := by + have hM : M = ∑ j, a j := by + have h := Fintype.card_congr e + simpa only [BlockAffineVariables, Fintype.card_sigma, Fintype.card_fin] using h.symm + exact bilinear_simple_point_count_chart a u v hM F hF (fun j => ⟨j,0⟩) (fun _ => rfl) + (productAffineChart a e) (productAffineChart_contDiff a e) + (productAffineChart_injective a e) (productAffineChart_zero a e) x hx hz hs + +end ProductAffineChart +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section ProjectiveInterpolation +variable {K σ ι L : Type*} [Field K] [Fintype ι] [DecidableEq ι] + +def BlockSeparated (group : σ → ι) (x y : σ → K) : Prop := + ∃ v w, group v = group w ∧ x v * y w ≠ x w * y v + +omit [Fintype ι] in +lemma projective_pair_separator (group : σ → ι) (x y : σ → K) + (hxy : BlockSeparated group x y) : + ∃ (p : MvPolynomial σ K) (e : ι → ℤ), + p.IsWeightedHomogeneous (blockWeight group) e ∧ + (∀ j, 0 ≤ e j ∧ e j ≤ 1) ∧ eval x p = 1 ∧ eval y p = 0 := by + classical + obtain ⟨v,w,hvw,hxy⟩ := hxy + let p : MvPolynomial σ K := C ((x v * y w - x w * y v)⁻¹) * + (C (y w) * X v - C (y v) * X w) + refine ⟨p, Pi.single (group v) 1, ?_, ?_, ?_, ?_⟩ + · apply IsWeightedHomogeneous.C_mul + apply IsWeightedHomogeneous.sub + · exact (isWeightedHomogeneous_X K (blockWeight group) v).C_mul _ + · simpa only [blockWeight, hvw] using + (isWeightedHomogeneous_X K (blockWeight group) w).C_mul (y v) + · intro j; by_cases h : j = group v <;> simp [h] + · simp only [p, map_mul, eval_C, map_sub, eval_X] + rw [mul_comm (y w), mul_comm (y v), inv_mul_cancel₀ (sub_ne_zero.mpr hxy)] + · simp [p, mul_comm] + +variable [Fintype L] [DecidableEq L] + +theorem projective_interpolation (group : σ → ι) (d : ι → ℤ) + (hd : ∀ j, (Fintype.card L : ℤ) ≤ d j) + (x : L → σ → K) (hx : ∀ i j, i ≠ j → BlockSeparated group (x i) (x j)) + (base : L → ι → σ) (hbase : ∀ i j, group (base i j) = j) + (hb : ∀ i j, x i (base i j) ≠ 0) : + ∃ p : L → Piece (K := K) (blockWeight group) d, + ∀ i j, eval (x j) (p i).val = if j = i then 1 else 0 := by + classical + have hs (i j : L) : ∃ (p : MvPolynomial σ K) (e : ι → ℤ), + p.IsWeightedHomogeneous (blockWeight group) e ∧ + (∀ l, 0 ≤ e l ∧ e l ≤ 1) ∧ eval (x i) p = 1 ∧ (i ≠ j → eval (x j) p = 0) := by + by_cases hij : i = j + · refine ⟨1,0,isWeightedHomogeneous_one _ _,?_,by simp,?_⟩ + · intro l; simp + · exact fun h => (h hij).elim + · obtain ⟨p,e,hp,he,hi,hj⟩ := projective_pair_separator group (x i) (x j) (hx i j hij) + exact ⟨p,e,hp,he,hi,fun _ => hj⟩ + choose p e hp he hi hj using hs + let E : L → ι → ℤ := fun i => ∑ j, e i j + have hE (i : L) (l : ι) : E i l ≤ Fintype.card L := by + dsimp [E] + simpa using Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => (he i j l).2) + let b : L → ι → ℕ := fun i l => (d l - E i l).toNat + have hbdeg (i : L) : (fun l => (b i l : ℤ)) = d-E i := by + funext l + exact Int.toNat_of_nonneg (sub_nonneg.mpr ((hE i l).trans (hd l))) + let pad : L → MvPolynomial σ K := fun i => + ∏ l, (C ((x i (base i l))⁻¹) * X (base i l)) ^ b i l + have hpadhom (i : L) : (pad i).IsWeightedHomogeneous (blockWeight group) (d - E i) := by + rw [← hbdeg] + have h := IsWeightedHomogeneous.prod Finset.univ + (fun l => (C ((x i (base i l))⁻¹) * X (base i l) : MvPolynomial σ K)^b i l) + (fun l => b i l • Pi.single l (1 : ℤ)) (fun l _ => by + convert ((isWeightedHomogeneous_X K (blockWeight group) (base i l)).C_mul + ((x i (base i l))⁻¹)).pow (b i l) using 1 + simp only [blockWeight, hbase]) + convert h using 1 + ext l + simp [Pi.single_apply] + have hpadeval (i : L) : eval (x i) (pad i) = 1 := by + simp [pad, inv_mul_cancel₀ (hb i _)] + let P : L → MvPolynomial σ K := fun i => (∏ j, p i j) * pad i + have hPhom (i : L) : (P i).IsWeightedHomogeneous (blockWeight group) d := by + have hp' := IsWeightedHomogeneous.prod Finset.univ (p i) (e i) (fun j _ => hp i j) + have h := hp'.mul (hpadhom i) + have hdeg : (∑ j, e i j) + (d - E i) = d := by dsimp [E]; abel + rw [hdeg] at h + exact h + refine ⟨fun i => ⟨P i,hPhom i⟩,?_⟩ + intro i j + change eval (x j) (P i) = _ + simp only [P, map_mul, map_prod] + by_cases hij : j = i + · subst j + simp [hi, hpadeval] + · rw [ite_eq_right hij, Finset.prod_eq_zero (Finset.mem_univ j) (hj i j (Ne.symm hij)), zero_mul] + +end ProjectiveInterpolation +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section ProjectivePointBound +variable {K σ ι L : Type*} [Field K] [Fintype σ] [Fintype ι] [DecidableEq ι] + [Fintype L] [DecidableEq L] + +theorem projective_points_le_pieceDim (group : σ → ι) (base : L → ι → σ) + (hbase : ∀ i j, group (base i j) = j) (I : Ideal (MvPolynomial σ K)) + (d : ι → ℤ) (hd : ∀ j, (Fintype.card L : ℤ) ≤ d j) + (x : L → σ → K) (hx : ∀ i j, i ≠ j → BlockSeparated group (x i) (x j)) + (hb : ∀ i j, x i (base i j) ≠ 0) + (hz : ∀ i, ∀ p ∈ I, eval (x i) p = 0) : + Fintype.card L ≤ Module.finrank K (componentQuotient (blockWeight group) I d) := by + classical + let P := Piece (K := K) (blockWeight group) d + let S : Submodule K P := (I.restrictScalars K).comap P.subtype + let ev : P →ₗ[K] (L → K) := LinearMap.pi fun i => + (aeval (x i)).toLinearMap.comp P.subtype + have heval (p : P) (i : L) : ev p i = eval (x i) p.val := by + simp [ev] + have hker : S ≤ LinearMap.ker ev := by + intro p hp + apply LinearMap.mem_ker.mpr + funext i + rw [heval] + exact hz i p.val hp + let qev := S.liftQ ev hker + obtain ⟨p,hp⟩ := projective_interpolation group d hd x hx base hbase hb + have hs : Function.Surjective qev := by + intro y + refine ⟨S.mkQ (∑ i, y i • p i), ?_⟩ + change ev (∑ i, y i • p i) = y + apply _root_.funext + intro j + have hei (i : L) : ev (p i) j = if j = i then 1 else 0 := + (heval (p i) j).trans (hp i j) + calc + ev (∑ i, y i • p i) j = ∑ i, y i * ev (p i) j := by simp + _ = y j := by simp [hei] + have h := LinearMap.finrank_le_finrank_of_surjective hs + simpa only [Module.finrank_pi, Module.finrank_self, Finset.sum_const, Finset.card_univ, + smul_eq_mul, mul_one] using h + +end ProjectivePointBound +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial Filter +open scoped Topology +section MultiChartProductCount +variable {ι L V : Type*} [Fintype ι] [DecidableEq ι] [Fintype L] [DecidableEq L] + [NormedAddCommGroup V] [NormedSpace ℂ V] [CompleteSpace V] + +omit [Fintype ι] [DecidableEq ι] in + +lemma eventually_blockSeparated {σ : Type*} (group : σ → ι) + (x : L → σ → ℂ) (hx : ∀ i j, i ≠ j → BlockSeparated group (x i) (x j)) + {y : L → ℂ → σ → ℂ} {c : ℂ} + (hy : ∀ i, Tendsto (y i) (𝓝 c) (𝓝 (x i))) : + ∀ᶠ c' in 𝓝 c, ∀ i j, i ≠ j → BlockSeparated group (y i c') (y j c') := by + classical + apply Filter.eventually_all.mpr + intro i + apply Filter.eventually_all.mpr + intro j + by_cases hij : i = j + · exact Filter.Eventually.of_forall (fun _ h => (h hij).elim) + obtain ⟨v,w,hvw,hn⟩ := hx i j hij + have hv₁ := (continuous_apply v).tendsto (x i) |>.comp (hy i) + have hw₁ := (continuous_apply w).tendsto (x i) |>.comp (hy i) + have hv₂ := (continuous_apply v).tendsto (x j) |>.comp (hy j) + have hw₂ := (continuous_apply w).tendsto (x j) |>.comp (hy j) + have he := ((hv₁.mul hw₂).sub (hw₁.mul hv₂)).eventually_ne (sub_ne_zero.mpr hn) + exact he.mono (fun c' hc' _ => ⟨v,w,hvw,sub_ne_zero.mp hc'⟩) + +theorem product_simple_point_bound_multichart (a : ι →₀ ℕ) + (qs : List (FactorPair (K := ℂ) (blockWeight (fun v : BlockVariables a => v.1)))) + (u v : Fin qs.length → ι) (t : (Fin qs.length × Bool) → ℂ) + (ht : Function.Injective t) + (hleft : ∀ i, (qs.get i).left = blockLinearForm a (u i) (t (i,false))) + (hright : ∀ i, (qs.get i).right = blockLinearForm a (v i) (t (i,true))) + (hdeg : ∀ q ∈ qs, ∀ j, q.leftDegree j ≤ 1) + (hlen : qs.length = ∑ j, a j) + (F : Fin qs.length → MvPolynomial (BlockVariables a) ℂ) + (hF : ∀ i, (F i).IsWeightedHomogeneous + (blockWeight (fun v : BlockVariables a => v.1)) + ((qs.get i).leftDegree + (qs.get i).rightDegree)) + (base : L → ι → BlockVariables a) (hbase : ∀ i j, (base i j).1 = j) + (e : L → (Fin qs.length → ℂ) ≃L[ℂ] V) + (chart : L → V → BlockVariables a → ℂ) (hc : ∀ i, ContDiff ℂ 1 (chart i)) + (hcn : ∀ i z j, chart i z (base i j) = 1) + (x : L → V) + (hx : ∀ i j, i ≠ j → BlockSeparated (fun v : BlockVariables a => v.1) + (chart i (x i)) (chart j (x j))) + (hz : ∀ i j, eval (chart i (x i)) (F j) = 0) + (hs : ∀ i, (fderiv ℂ (fun z => e i (fun j => eval (chart i z) (F j))) + (x i)).IsInvertible) : + Fintype.card L ≤ (mixedPolynomial u v).coeff a := by + classical + let Q : Fin qs.length → MvPolynomial (BlockVariables a) ℂ := + fun j => (qs.get j).left * (qs.get j).right + let family : L → ℂ × V → V := fun i z => e i + (fun j => (1-z.1) * eval (chart i z.2) (Q j) + z.1 * eval (chart i z.2) (F j)) + have hcont (i : L) : ContDiff ℂ 1 (family i) := by + apply (e i).contDiff.comp + apply contDiff_pi.mpr + intro j + exact ((contDiff_const.sub contDiff_fst).mul + ((PolarAnalysis.contDiff_mvPolynomial_eval (Q j)).comp ((hc i).comp contDiff_snd))).add + (contDiff_fst.mul + ((PolarAnalysis.contDiff_mvPolynomial_eval (F j)).comp ((hc i).comp contDiff_snd))) + have hone (i : L) : (fun z => family i (1,z)) = + (fun z => e i (fun j => eval (chart i z) (F j))) := by + funext z + simp [family] + have hzero (i : L) : family i (1,x i) = 0 := by + rw [congrFun (hone i)] + rw [show (fun j => eval (chart i (x i)) (F j)) = 0 from funext (hz i), map_zero] + have hsimple (i : L) : PolarAnalysis.SimpleAt (family i) 1 (x i) := by + unfold PolarAnalysis.SimpleAt + rw [← PolarAnalysis.fderiv_slice (hcont i), hone] + exact hs i + choose ψ hψ hzψ using fun i => PolarAnalysis.simple_branch (hcont i) (hzero i) (hsimple i) + have hsep := eventually_blockSeparated (fun v : BlockVariables a => v.1) + (fun i => chart i (x i)) hx (fun i => (hc i).continuous.continuousAt.tendsto.comp (hψ i)) + have hpersist : ∀ᶠ c in 𝓝 (1 : ℂ), + (∀ i, family i (c,ψ i c) = 0) ∧ + ∀ i j, i ≠ j → BlockSeparated (fun v : BlockVariables a => v.1) + (chart i (ψ i c)) (chart j (ψ j c)) := by + filter_upwards [Filter.eventually_all.mpr hzψ, hsep] with c hz hc + exact ⟨fun i => (hz i).1,hc⟩ + let d : ι → ℤ := fun _ => qs.length + Fintype.card L + 1 + obtain ⟨p,hp,hbound⟩ := generic_product_piece_bound a qs u v t ht hleft hright hdeg + hlen F hF d (by intro j; dsimp [d]; omega) + have hpne : p ≠ 0 := by + intro h + rw [h, Polynomial.eval_zero] at hp + exact zero_ne_one hp + have hdense : Dense {c : ℂ | p.eval c ≠ 0} := + (Polynomial.finite_setOfPred_isRoot hpne).countable.dense_compl ℂ + obtain ⟨c,hpc,hyz,hy⟩ := hdense.inter_nhds_nonempty hpersist + let I := Ideal.span (Set.range (fun j => (1-c) • Q j + c • F j)) + have hyideal (i : L) : ∀ p ∈ I, eval (chart i (ψ i c)) p = 0 := by + have hI : I ≤ RingHom.ker (eval (chart i (ψ i c))) := by + apply Ideal.span_le.mpr + rintro p ⟨j,rfl⟩ + change eval (chart i (ψ i c)) ((1-c) • Q j + c • F j) = 0 + have h := (e i).injective ((hyz i).trans (map_zero (e i)).symm) + have h := congrFun h j + simpa only [map_add, smul_eval, Pi.zero_apply] using h + exact fun p hp => hI hp + have hpoints := projective_points_le_pieceDim (fun v : BlockVariables a => v.1) + base hbase I d (by intro j; dsimp [d]; omega) (fun i => chart i (ψ i c)) hy + (fun i j => by rw [hcn]; exact one_ne_zero) hyideal + exact hpoints.trans (hbound c hpc) + +end MultiChartProductCount +end PermanentBorder.Multigraded +namespace PermanentBorder.Multigraded +open MvPolynomial +section BilinearMultiChartCount +variable {ι L V : Type*} [Fintype ι] [DecidableEq ι] [Fintype L] [DecidableEq L] + [NormedAddCommGroup V] [NormedSpace ℂ V] [CompleteSpace V] + +theorem bilinear_simple_point_count_multichart (a : ι →₀ ℕ) {M : ℕ} + (u v : Fin M → ι) (hM : M = ∑ j, a j) + (F : Fin M → MvPolynomial (BlockVariables a) ℂ) + (hF : ∀ i, (F i).IsWeightedHomogeneous + (blockWeight (fun v : BlockVariables a => v.1)) + (Pi.single (u i) 1 + Pi.single (v i) 1)) + (base : L → ι → BlockVariables a) (hbase : ∀ i j, (base i j).1 = j) + (e : L → (Fin M → ℂ) ≃L[ℂ] V) + (chart : L → V → BlockVariables a → ℂ) (hc : ∀ i, ContDiff ℂ 1 (chart i)) + (hcn : ∀ i z j, chart i z (base i j) = 1) + (x : L → V) + (hx : ∀ i j, i ≠ j → BlockSeparated (fun v : BlockVariables a => v.1) + (chart i (x i)) (chart j (x j))) + (hz : ∀ i j, eval (chart i (x i)) (F j) = 0) + (hs : ∀ i, (fderiv ℂ (fun z => e i (fun j => eval (chart i z) (F j))) + (x i)).IsInvertible) : + Fintype.card L ≤ (mixedPolynomial u v).coeff a := by + classical + let t : (Fin M × Bool) → ℂ := fun i => + Infinite.natEmbedding ℂ ((Fintype.equivFin (Fin M × Bool) i).val) + have ht : Function.Injective t := + (Infinite.natEmbedding ℂ).injective.comp + (Fin.val_injective.comp (Fintype.equivFin (Fin M × Bool)).injective) + generalize hqs : List.ofFn (vandermondePairs a u v t) = qs + have hlen : qs.length = M := by rw [← hqs, List.length_ofFn] + cases hlen + have hget (i : Fin qs.length) : qs.get i = vandermondePairs a u v t i := by + have h := congrArg (fun l => l[i.val]?) hqs + simpa only [List.getElem?_ofFn, dite_eq_left i.isLt, List.getElem?_eq_getElem i.isLt, + Option.some.injEq, List.get_eq_getElem] using h.symm + apply product_simple_point_bound_multichart a qs u v t ht + (fun i => by rw [hget]; rfl) (fun i => by rw [hget]; rfl) ?_ hM F + (by intro i; simpa only [hget, vandermondePairs] using hF i) + base hbase e chart hc hcn x hx hz hs + intro q hq j + rw [← hqs] at hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + by_cases hj : j = u i <;> simp [vandermondePairs, hj] + +end BilinearMultiChartCount +end PermanentBorder.Multigraded + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/PunctualCharts.lean b/lean/OAI/Algebra/Determinantal/PunctualCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..835804c92fbd5afb94b5fec29e87fe9d1c4eba17 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/PunctualCharts.lean @@ -0,0 +1,410 @@ +import OAI.Algebra.Determinantal.Nilpotents + +namespace OAI + +namespace PermanentBorder.CommutingPairs +open Matrix CentralizerDimension CentralizerParameters OrbitNormalization +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [Infinite K] + +theorem nilpotent_pair_field_bound {n : ℕ} (hn : 0 < n) + (A B : Matrix (Fin n) (Fin n) L) (hA : IsNilpotent A) (hB : IsNilpotent B) + (hAB : A * B = B * A) : + ∃ F : IntermediateField K L, + Algebra.trdeg K F ≤ (n * n - 1 : ℕ) ∧ + (∀ i j, A i j ∈ F) ∧ (∀ i j, B i j ∈ F) := by + classical + have : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩ + have hBd : B.det = 0 := by + obtain ⟨r, hr⟩ := hB + have hd : B.det ^ r = 0 := by rw [← Matrix.det_pow, hr, Matrix.det_zero] + by_contra h + exact pow_ne_zero r h hd + obtain ⟨e, he, U, hU⟩ := NilpotentBlocks.canonical_nilpotent_form K (algebraMap K L) A hA + have hP : A * (↑U⁻¹ : Matrix (Fin n) (Fin n) L) = + (↑U⁻¹ : Matrix (Fin n) (Fin n) L) * + (NilpotentBlocks.shapeMatrix (K := K) e he).map (algebraMap K L) := by + rw [hU, ← mul_assoc, ← mul_assoc, Units.inv_mul, one_mul] + obtain ⟨F, hF, hAF, hBF⟩ := normalized_pair_field_bound A B + (NilpotentBlocks.shapeMatrix e he) U⁻¹ hP hAB hBd + refine ⟨F, ?_, hAF, hBF⟩ + have hpos : 0 < n * n := Nat.mul_pos hn hn + have hc : n * n = (n * n - 1) + 1 := by omega + rw [hc, Nat.cast_add, Nat.cast_one] at hF + exact Cardinal.lt_natCast_add_one_iff.mp hF + +end PermanentBorder.CommutingPairs + +namespace PermanentBorder.FieldParameters +open Algebra MvPolynomial +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +theorem adjoin_trdeg_le {n : ℕ} (x : Fin n → L) : + Algebra.trdeg K (Algebra.adjoin K (Set.range x)) ≤ (n : Cardinal) := by + rw [Algebra.adjoin_range_eq_range_aeval] + have h := trdeg_le_of_surjective (MvPolynomial.aeval (R := K) x).rangeRestrict + (AlgHom.rangeRestrict_surjective (MvPolynomial.aeval (R := K) x)) + simpa only [MvPolynomial.trdeg_of_isDomain, Cardinal.mk_fin, Cardinal.lift_natCast] using h + +open scoped IntermediateField.algebraAdjoinAdjoin in + +theorem field_adjoin_trdeg_le {n : ℕ} (x : Fin n → L) : + Algebra.trdeg K (IntermediateField.adjoin K (Set.range x)) ≤ (n : Cardinal) := by + rw [← trdeg_add_eq K (Algebra.adjoin K (Set.range x)), + trdeg_eq_zero (R := Algebra.adjoin K (Set.range x)), add_zero] + exact adjoin_trdeg_le x + +theorem extend_field {p n : ℕ} (F : IntermediateField K L) + (hF : Algebra.trdeg K F ≤ (p : Cardinal)) (x : Fin n → L) : + ∃ E : IntermediateField K L, + F ≤ E ∧ Algebra.trdeg K E ≤ (p + n : ℕ) ∧ (∀ i, x i ∈ E) := by + let T := IntermediateField.adjoin F (Set.range x) + let E := T.restrictScalars K + have : FaithfulSMul F T := (faithfulSMul_iff_algebraMap_injective F T).mpr + (algebraMap F T).injective + have : FaithfulSMul K F := (faithfulSMul_iff_algebraMap_injective K F).mpr + (algebraMap K F).injective + have hFE : F ≤ E := by + intro y hy + exact T.algebraMap_mem ⟨y, hy⟩ + have hx : ∀ i, x i ∈ E := fun i => IntermediateField.subset_adjoin F _ (Set.mem_range_self i) + refine ⟨E, hFE, ?_, hx⟩ + calc + Algebra.trdeg K E = Algebra.trdeg K F + Algebra.trdeg F T := (trdeg_add_eq K F (A := T)).symm + _ ≤ (p : Cardinal) + n := add_le_add hF (field_adjoin_trdeg_le (K := F) x) + _ = (p + n : ℕ) := by simp only [Nat.cast_add] + +end PermanentBorder.FieldParameters + +namespace PermanentBorder.GenericMatrix +open Matrix MvPolynomial +universe u +variable (L : Type u) [Field L] (n : ℕ) + +abbrev CoordinateRing := MvPolynomial (Fin n × Fin n) L +abbrev FunctionField := FractionRing (CoordinateRing L n) +noncomputable def coordinateMatrix : Matrix (Fin n) (Fin n) (CoordinateRing L n) := + fun i j => X (i,j) +noncomputable def genericMatrix : Matrix (Fin n) (Fin n) (FunctionField L n) := + (coordinateMatrix L n).map (algebraMap (CoordinateRing L n) (FunctionField L n)) + +theorem coordinate_det_ne_zero : (coordinateMatrix L n).det ≠ 0 := by + intro h + let f : CoordinateRing L n →ₐ[L] L := aeval (fun ij => (1 : Matrix (Fin n) (Fin n) L) ij.1 ij.2) + have he : (coordinateMatrix L n).map f = (1 : Matrix (Fin n) (Fin n) L) := by + ext i j + exact aeval_X _ _ + have hh := congrArg f h + rw [AlgHom.map_det, AlgHom.mapMatrix_apply, he, Matrix.det_one, map_zero] at hh + exact one_ne_zero hh + +theorem generic_det_ne_zero : (genericMatrix L n).det ≠ 0 := by + change ((algebraMap (CoordinateRing L n) (FunctionField L n)).mapMatrix + (coordinateMatrix L n)).det ≠ 0 + rw [← RingHom.map_det] + exact fun h => coordinate_det_ne_zero L n + ((IsFractionRing.injective (CoordinateRing L n) (FunctionField L n)) (by simpa using h)) + +noncomputable def genericUnit : (Matrix (Fin n) (Fin n) (FunctionField L n))ˣ := + ((Matrix.isUnit_iff_isUnit_det _).mpr (isUnit_iff_ne_zero.mpr (generic_det_ne_zero L n))).unit + +@[simp] theorem genericUnit_val : (genericUnit L n : Matrix (Fin n) (Fin n) (FunctionField L n)) = + genericMatrix L n := IsUnit.unit_spec _ + +theorem relative_trdeg : Algebra.trdeg L (FunctionField L n) = (n * n : ℕ) := by + have : Algebra.IsAlgebraic (CoordinateRing L n) (FunctionField L n) := + IsLocalization.isAlgebraic _ (nonZeroDivisors (CoordinateRing L n)) + have : FaithfulSMul (CoordinateRing L n) (FunctionField L n) := + (faithfulSMul_iff_algebraMap_injective _ _).mpr + (IsFractionRing.injective (CoordinateRing L n) (FunctionField L n)) + rw [← trdeg_add_eq L (CoordinateRing L n), trdeg_eq_zero (R := CoordinateRing L n), add_zero] + simp only [CoordinateRing, MvPolynomial.trdeg_of_isDomain, Cardinal.mk_prod, + Cardinal.mk_fin, Cardinal.lift_mul, Cardinal.lift_natCast, Nat.cast_mul] + +theorem field_eq_top_of_mem (K : Type u) [Field K] [Algebra K L] + (E : IntermediateField K (FunctionField L n)) + (hc : ∀ x : L, algebraMap L (FunctionField L n) x ∈ E) + (hx : ∀ i j, genericMatrix L n i j ∈ E) : E = ⊤ := by + have hp : ∀ p : CoordinateRing L n, + algebraMap (CoordinateRing L n) (FunctionField L n) p ∈ E := by + intro p + induction p using MvPolynomial.induction_on with + | C x => + change algebraMap (CoordinateRing L n) (FunctionField L n) + (algebraMap L (CoordinateRing L n) x) ∈ E + rw [← IsScalarTower.algebraMap_apply] + exact hc x + | add p q hp hq => + rw [map_add] + exact E.add_mem hp hq + | mul_X p ij hp => + rw [map_mul] + exact E.mul_mem hp (hx ij.1 ij.2) + apply eq_top_iff.mpr + intro z _ + obtain ⟨p, q, _, hz⟩ := IsFractionRing.div_surjective (CoordinateRing L n) z + rw [← hz] + exact E.div_mem (hp p) (hp q) + +end PermanentBorder.GenericMatrix + +namespace PermanentBorder.CyclicFrames +open Matrix +variable {K L ι : Type*} [Field K] [Field L] [Algebra K L] + [Fintype ι] [DecidableEq ι] + +def MonomialBasis (r s : ι → ℕ) (A B : Matrix ι ι L) (v : ι → L) : Prop := + ∀ i, (A ^ r i * B ^ s i).mulVec v = Pi.single i 1 + +theorem recover_frame (r s : ι → ℕ) (A B A' B' Q : Matrix ι ι L) + (v v' : ι → L) (hb : MonomialBasis r s A B v) + (hA : A' * Q = Q * A) (hB : B' * Q = Q * B) (hv : v' = Q.mulVec v) : + ∀ i j, Q i j = ((A' ^ r j * B' ^ s j).mulVec v') i := by + intro i j + have hpa : Q * A ^ r j = A' ^ r j * Q := (SemiconjBy.pow_right hA.symm _) + have hpb : Q * B ^ s j = B' ^ s j * Q := (SemiconjBy.pow_right hB.symm _) + have hm : (A' ^ r j * B' ^ s j) * Q = Q * (A ^ r j * B ^ s j) := by + rw [mul_assoc, ← hpb, ← mul_assoc, ← hpa, mul_assoc] + rw [hv, Matrix.mulVec_mulVec, hm, ← Matrix.mulVec_mulVec, hb j, + Matrix.mulVec_single] + simp + +theorem pow_mem (F : IntermediateField K L) (A : Matrix ι ι L) + (hA : ∀ i j, A i j ∈ F) (r : ℕ) : ∀ i j, (A ^ r) i j ∈ F := by + induction r with + | zero => + intro i j + simp only [pow_zero, Matrix.one_apply] + split <;> simp + | succ r hr => + rw [pow_succ] + exact MatrixSubfield.mul_mem F _ _ hr hA + +omit [DecidableEq ι] in +theorem mulVec_mem (F : IntermediateField K L) (A : Matrix ι ι L) (v : ι → L) + (hA : ∀ i j, A i j ∈ F) (hv : ∀ i, v i ∈ F) : ∀ i, A.mulVec v i ∈ F := by + intro i + exact F.sum_mem fun j _ => F.mul_mem (hA i j) (hv j) + +theorem frame_mem (F : IntermediateField K L) (r s : ι → ℕ) + (A B A' B' Q : Matrix ι ι L) (v v' : ι → L) + (hb : MonomialBasis r s A B v) + (hA : A' * Q = Q * A) (hB : B' * Q = Q * B) (hv : v' = Q.mulVec v) + (hAF : ∀ i j, A' i j ∈ F) (hBF : ∀ i j, B' i j ∈ F) (hvF : ∀ i, v' i ∈ F) : + ∀ i j, Q i j ∈ F := by + intro i j + rw [recover_frame r s A B A' B' Q v v' hb hA hB hv i j] + exact mulVec_mem F _ _ (MatrixSubfield.mul_mem F _ _ + (pow_mem F A' hAF (r j)) (pow_mem F B' hBF (s j))) hvF i + +theorem original_mem (F : IntermediateField K L) + (A B A' B' : Matrix ι ι L) (Q : (Matrix ι ι L)ˣ) (v v' : ι → L) + (hA : A' * (Q : Matrix ι ι L) = (Q : Matrix ι ι L) * A) + (hB : B' * (Q : Matrix ι ι L) = (Q : Matrix ι ι L) * B) + (hv : v' = (Q : Matrix ι ι L).mulVec v) + (hQF : ∀ i j, (Q : Matrix ι ι L) i j ∈ F) + (hAF : ∀ i j, A' i j ∈ F) (hBF : ∀ i j, B' i j ∈ F) (hvF : ∀ i, v' i ∈ F) : + (∀ i j, A i j ∈ F) ∧ (∀ i j, B i j ∈ F) ∧ (∀ i, v i ∈ F) := by + have hQiF := MatrixSubfield.unit_inv_mem F Q hQF + have he (M M' : Matrix ι ι L) (hM : M' * (Q : Matrix ι ι L) = (Q : Matrix ι ι L) * M) : + M = (↑Q⁻¹ : Matrix ι ι L) * (M' * (Q : Matrix ι ι L)) := by + rw [hM, ← mul_assoc, Units.inv_mul, one_mul] + refine ⟨?_, ?_, ?_⟩ + · rw [he A A' hA] + exact MatrixSubfield.mul_mem F _ _ hQiF (MatrixSubfield.mul_mem F _ _ hAF hQF) + · rw [he B B' hB] + exact MatrixSubfield.mul_mem F _ _ hQiF (MatrixSubfield.mul_mem F _ _ hBF hQF) + · have hev : v = (↑Q⁻¹ : Matrix ι ι L).mulVec v' := by + rw [hv, Matrix.mulVec_mulVec, Units.inv_mul, Matrix.one_mulVec] + rw [hev] + exact mulVec_mem F _ _ hQiF hvF + +end PermanentBorder.CyclicFrames + +namespace PermanentBorder.CyclicFrames +open Matrix +variable {K L ι : Type*} [Field K] [Field L] [Fintype ι] [DecidableEq ι] + +theorem MonomialBasis.map (f : K →+* L) {r s : ι → ℕ} + {A B : Matrix ι ι K} {v : ι → K} (h : MonomialBasis r s A B v) : + MonomialBasis r s (A.map f) (B.map f) (f ∘ v) := by + intro i + have hh := congrArg (fun w : ι → K => f ∘ w) (h i) + ext j + have hj := congrFun hh j + change f (((A ^ r i * B ^ s i).mulVec v) j) = f ((Pi.single i (1 : K) : ι → K) j) at hj + rw [RingHom.map_mulVec, Matrix.map_mul] at hj + have hpa : (A ^ r i).map f = (A.map f) ^ r i := (f.mapMatrix.map_pow A _) + have hpb : (B ^ s i).map f = (B.map f) ^ s i := (f.mapMatrix.map_pow B _) + rw [hpa, hpb] at hj + rw [hj] + by_cases hij : j = i + · subst j + simp + · simp [hij] + +def conjugation (Q : (Matrix ι ι L)ˣ) : Matrix ι ι L →+* Matrix ι ι L where + toFun A := (Q : Matrix ι ι L) * A * (↑Q⁻¹ : Matrix ι ι L) + map_zero' := by simp + map_one' := by simp + map_add' A B := by simp only [mul_add, add_mul] + map_mul' A B := by + simp only [mul_assoc] + rw [← mul_assoc (↑Q⁻¹ : Matrix ι ι L) (↑Q : Matrix ι ι L), + Units.inv_mul, one_mul] + +theorem conjugation_intertwines (Q : (Matrix ι ι L)ˣ) (A : Matrix ι ι L) : + conjugation Q A * (Q : Matrix ι ι L) = (Q : Matrix ι ι L) * A := by + change ((Q : Matrix ι ι L) * A * (↑Q⁻¹ : Matrix ι ι L)) * + (Q : Matrix ι ι L) = (Q : Matrix ι ι L) * A + rw [mul_assoc, Units.inv_mul, mul_one] + +end PermanentBorder.CyclicFrames +namespace PermanentBorder.PunctualCharts +open Matrix Algebra CyclicFrames +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [Infinite K] + +def tripleEntries {n : ℕ} (A B : Matrix (Fin n) (Fin n) L) (v : Fin n → L) : Set L := + (Set.range fun ij : Fin n × Fin n => A ij.1 ij.2) ∪ + (Set.range fun ij : Fin n × Fin n => B ij.1 ij.2) ∪ Set.range v + +theorem generated_chart_field_bound {n : ℕ} (hn : 0 < n) + (r s : Fin n → ℕ) (A B : Matrix (Fin n) (Fin n) L) (v : Fin n → L) + (hA : IsNilpotent A) (hB : IsNilpotent B) (hAB : A * B = B * A) + (hb : MonomialBasis r s A B v) + (hgen : IntermediateField.adjoin K (tripleEntries A B v) = ⊤) : + Algebra.trdeg K L ≤ (n - 1 : ℕ) := by + classical + let T := GenericMatrix.FunctionField L n + let f := algebraMap L T + let Q := GenericMatrix.genericUnit L n + let A₀ : Matrix (Fin n) (Fin n) T := A.map f + let B₀ : Matrix (Fin n) (Fin n) T := B.map f + let v₀ : Fin n → T := f ∘ v + let A' := conjugation Q A₀ + let B' := conjugation Q B₀ + let v' := (Q : Matrix (Fin n) (Fin n) T).mulVec v₀ + have hA' : IsNilpotent A' := (hA.map f.mapMatrix).map (conjugation Q) + have hB' : IsNilpotent B' := (hB.map f.mapMatrix).map (conjugation Q) + have hAB' : A' * B' = B' * A' := by + exact ((Commute.map (show Commute A B from hAB) f.mapMatrix).map (conjugation Q)).eq + obtain ⟨F, hF, hAF, hBF⟩ := CommutingPairs.nilpotent_pair_field_bound (K := K) hn A' B' + hA' hB' hAB' + obtain ⟨E, hFE, hE, hvE⟩ := FieldParameters.extend_field F hF v' + have hAE : ∀ i j, A' i j ∈ E := fun i j => hFE (hAF i j) + have hBE : ∀ i j, B' i j ∈ E := fun i j => hFE (hBF i j) + have hb₀ : MonomialBasis r s A₀ B₀ v₀ := hb.map f + have hAQ := conjugation_intertwines Q A₀ + have hBQ := conjugation_intertwines Q B₀ + have hQE : ∀ i j, (Q : Matrix (Fin n) (Fin n) T) i j ∈ E := + frame_mem E r s A₀ B₀ A' B' Q v₀ v' hb₀ hAQ hBQ rfl hAE hBE hvE + obtain ⟨hA₀E, hB₀E, hv₀E⟩ := original_mem E A₀ B₀ A' B' Q v₀ v' hAQ hBQ + rfl hQE hAE hBE hvE + have hc : ∀ x : L, algebraMap L T x ∈ E := by + have hle : IntermediateField.adjoin K (tripleEntries A B v) ≤ + IntermediateField.comap (IsScalarTower.toAlgHom K L T) E := by + apply IntermediateField.adjoin_le_iff.mpr + rintro x ((⟨⟨i,j⟩, rfl⟩ | ⟨⟨i,j⟩, rfl⟩) | ⟨i, rfl⟩) + · exact hA₀E i j + · exact hB₀E i j + · exact hv₀E i + rw [hgen] at hle + exact fun x => hle (IntermediateField.mem_top) + have htop : E = ⊤ := GenericMatrix.field_eq_top_of_mem L n K E hc (by + simpa only [Q, GenericMatrix.genericUnit_val] using hQE) + have hT : Algebra.trdeg K T ≤ (n * n - 1 + n : ℕ) := by + rw [htop, (IntermediateField.topEquiv (F := K) (E := T)).trdeg_eq] at hE + exact hE + have : FaithfulSMul K L := (faithfulSMul_iff_algebraMap_injective K L).mpr + (algebraMap K L).injective + have : FaithfulSMul L T := (faithfulSMul_iff_algebraMap_injective L T).mpr + (algebraMap L T).injective + rw [← trdeg_add_eq K L, GenericMatrix.relative_trdeg] at hT + have heq : n * n - 1 + n = (n - 1) + n * n := by + have hp : 0 < n * n := Nat.mul_pos hn hn + omega + rw [heq, Nat.cast_add] at hT + exact (Cardinal.add_le_add_iff_of_lt_aleph0 (Cardinal.natCast_lt_aleph0)).mp hT + +end PermanentBorder.PunctualCharts + +namespace PermanentBorder.PunctualCharts +open Matrix Algebra CyclicFrames +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [Infinite K] + +theorem chart_field_bound {n : ℕ} (hn : 0 < n) + (r s : Fin n → ℕ) (A B : Matrix (Fin n) (Fin n) L) (v : Fin n → L) + (hA : IsNilpotent A) (hB : IsNilpotent B) (hAB : A * B = B * A) + (hb : MonomialBasis r s A B v) : + ∃ F : IntermediateField K L, + Algebra.trdeg K F ≤ (n - 1 : ℕ) ∧ + (∀ i j, A i j ∈ F) ∧ (∀ i j, B i j ∈ F) ∧ (∀ i, v i ∈ F) := by + classical + let F := IntermediateField.adjoin K (tripleEntries A B v) + have hAF : ∀ i j, A i j ∈ F := fun i j => IntermediateField.subset_adjoin K _ + (Or.inl (Or.inl (Set.mem_range_self (i,j)))) + have hBF : ∀ i j, B i j ∈ F := fun i j => IntermediateField.subset_adjoin K _ + (Or.inl (Or.inr (Set.mem_range_self (i,j)))) + have hvF : ∀ i, v i ∈ F := fun i => IntermediateField.subset_adjoin K _ + (Or.inr (Set.mem_range_self i)) + let A₀ : Matrix (Fin n) (Fin n) F := fun i j => ⟨A i j, hAF i j⟩ + let B₀ : Matrix (Fin n) (Fin n) F := fun i j => ⟨B i j, hBF i j⟩ + let v₀ : Fin n → F := fun i => ⟨v i, hvF i⟩ + let f := (algebraMap F L).mapMatrix (m := Fin n) + have hf : Function.Injective f := by + intro P Q h + ext i j + exact congrFun (congrFun h i) j + have hfA : f A₀ = A := rfl + have hfB : f B₀ = B := rfl + have hA₀ : IsNilpotent A₀ := by + obtain ⟨d, hd⟩ := hA + refine ⟨d, hf ?_⟩ + rw [map_pow, hfA, map_zero, hd] + have hB₀ : IsNilpotent B₀ := by + obtain ⟨d, hd⟩ := hB + refine ⟨d, hf ?_⟩ + rw [map_pow, hfB, map_zero, hd] + have hAB₀ : A₀ * B₀ = B₀ * A₀ := by + apply hf + rw [map_mul, map_mul, hfA, hfB, hAB] + have hb₀ : MonomialBasis r s A₀ B₀ v₀ := by + intro i + ext j + have he := congrFun (hb i) j + have hh := (algebraMap F L).map_mulVec (A₀ ^ r i * B₀ ^ s i) v₀ j + have hp : (A₀ ^ r i * B₀ ^ s i).map (algebraMap F L) = A ^ r i * B ^ s i := by + change f (A₀ ^ r i * B₀ ^ s i) = _ + rw [map_mul, map_pow, map_pow, hfA, hfB] + rw [hp] at hh + change algebraMap F L ((A₀ ^ r i * B₀ ^ s i).mulVec v₀ j) = _ + rw [hh] + change ((A ^ r i * B ^ s i).mulVec v) j = _ + rw [he] + by_cases hij : j = i + · subst j + simp + · simp [hij] + have hgen : IntermediateField.adjoin K (tripleEntries A₀ B₀ v₀) = ⊤ := by + apply IntermediateField.map_injective F.val + rw [IntermediateField.adjoin_map] + have him : F.val '' tripleEntries A₀ B₀ v₀ = tripleEntries A B v := by + simp only [tripleEntries, Set.image_union, ← Set.range_comp] + rfl + rw [him] + change F = (⊤ : IntermediateField K F).map F.val + ext x + constructor + · intro hx + exact ⟨⟨x,hx⟩, IntermediateField.mem_top, rfl⟩ + · rintro ⟨x, _, rfl⟩ + exact x.property + exact ⟨F, generated_chart_field_bound hn r s A₀ B₀ v₀ hA₀ hB₀ hAB₀ hb₀ hgen, + hAF, hBF, hvF⟩ + +end PermanentBorder.PunctualCharts + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/QuotientFields.lean b/lean/OAI/Algebra/Determinantal/QuotientFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fcf262e76f5a751e311e4ae014190aa2e580bc3 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/QuotientFields.lean @@ -0,0 +1,421 @@ +import OAI.Algebra.Determinantal.CurveParameters + +namespace OAI +namespace PermanentBorder.FinitePlaneFrames +open Module Matrix MvPolynomial +variable {K L S : Type*} [Field K] [Field L] [Algebra K L] + [CommRing S] [Algebra L S] + +theorem monomial_coordinates_mem {n : ℕ} (F : IntermediateField K L) + (q : MvPolynomial (Fin 2) L →ₐ[L] S) (b : Basis (Fin n) L S) + (hA : ∀ i j, representation b (q (X 0)) i j ∈ F) + (hB : ∀ i j, representation b (q (X 1)) i j ∈ F) + (hv : ∀ i, unitVector b i ∈ F) (r s : ℕ) : + ∀ i, b.repr (q (X 0 ^ r * X 1 ^ s)) i ∈ F := by + have h := MatrixSubfield.mulVec_mem F + ((representation b (q (X 0))) ^ r * (representation b (q (X 1))) ^ s) + (unitVector b) + (MatrixSubfield.mul_mem F _ _ (MatrixSubfield.pow_mem F _ hA r) + (MatrixSubfield.pow_mem F _ hB s)) hv + have he : (representation b (q (X 0))) ^ r * (representation b (q (X 1))) ^ s = + representation b (q (X 0 ^ r * X 1 ^ s)) := by simp only [map_mul,map_pow] + simpa only [he, action_on_unit, Basis.equivFun_apply] using h + +theorem unshifted_representation_mem {n : ℕ} (F : IntermediateField K L) + (b : Basis (Fin n) L S) (x : S) (a : L) (ha : a ∈ F) + (h : ∀ i j, representation b (x - algebraMap L S a) i j ∈ F) : + ∀ i j, representation b x i j ∈ F := by + have he : representation b x = representation b (x - algebraMap L S a) + + algebraMap L (Matrix (Fin n) (Fin n) L) a := by + rw [map_sub, AlgHom.commutes, sub_add_cancel] + intro i j + rw [he, Matrix.add_apply] + refine F.add_mem (h i j) ?_ + change (Matrix.scalar (Fin n) a) i j ∈ F + by_cases hij : i = j + · subst j; simpa using ha + · simp [Matrix.scalar, Matrix.diagonal, hij] + +end PermanentBorder.FinitePlaneFrames +namespace PermanentBorder.FiniteAlgebras +open Module MvPolynomial Matrix FinitePlaneFrames CurveParameters +universe u +variable {K L : Type u} {R : Type u} [Field K] [Field L] [Algebra K L] + [CommRing R] [Algebra L R] [Module.Finite L R] [IsAlgClosed L] + +noncomputable def localChart (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (p : MvPolynomial (Fin 2) K) (hpq : q (p.map (algebraMap K L)) = 0) + (m : MaximalSpectrum R) (e : ℕ) (he : 0 < e) + (b : Basis (Fin (finrank L (R ⧸ m.asIdeal ^ e))) L (R ⧸ m.asIdeal ^ e)) + (r s : Fin (finrank L (R ⧸ m.asIdeal ^ e)) → ℕ) + (hb : CyclicFrames.MonomialBasis r s + (representation b (shiftedLocalHom L R q m e (X 0))) + (representation b (shiftedLocalHom L R q m e (X 1))) (unitVector b)) : + LocalChart (L := L) p where + length := finrank L (R ⧸ m.asIdeal ^ e) + positive := local_length_pos L R m he + support := supportPoint L R q m + on_curve := by + have h := supportPoint_on_curve L R q m (p.map (algebraMap K L)) hpq + simpa only [aeval_def, eval₂_map, Algebra.algebraMap_self, RingHom.id_comp] using h + r := r + s := s + A := representation b (shiftedLocalHom L R q m e (X 0)) + B := representation b (shiftedLocalHom L R q m e (X 1)) + v := unitVector b + nilA := (shiftedLocalHom_X_nilpotent L R q m e 0).map (representation b) + nilB := (shiftedLocalHom_X_nilpotent L R q m e 1).map (representation b) + commutes := by + have h := congrArg (representation b) (mul_comm + (shiftedLocalHom L R q m e (X 0)) (shiftedLocalHom L R q m e (X 1))) + simpa only [map_mul] using h + basis_eq := hb + +theorem local_monomial_coordinates_mem (F : IntermediateField K L) + (q : MvPolynomial (Fin 2) L →ₐ[L] R) + (p : MvPolynomial (Fin 2) K) (hpq : q (p.map (algebraMap K L)) = 0) + (m : MaximalSpectrum R) (e : ℕ) (he : 0 < e) + (b : Basis (Fin (finrank L (R ⧸ m.asIdeal ^ e))) L (R ⧸ m.asIdeal ^ e)) + (r s : Fin (finrank L (R ⧸ m.asIdeal ^ e)) → ℕ) + (hb : CyclicFrames.MonomialBasis r s + (representation b (shiftedLocalHom L R q m e (X 0))) + (representation b (shiftedLocalHom L R q m e (X 1))) (unitVector b)) + (hF : (localChart q p hpq m e he b r s hb).InField F) (r' s' : ℕ) : + ∀ i, b.repr (localHom L R q m e (X 0 ^ r' * X 1 ^ s')) i ∈ F := by + apply monomial_coordinates_mem F (localHom L R q m e) b _ _ hF.2.2.2 r' s' + · apply unshifted_representation_mem F b _ (supportPoint L R q m 0) (hF.1 0) + have h : ∀ i j, representation b (shiftedLocalHom L R q m e (X 0)) i j ∈ F := hF.2.1 + simpa only [shiftedLocalHom_X] using h + · apply unshifted_representation_mem F b _ (supportPoint L R q m 1) (hF.1 1) + have h : ∀ i j, representation b (shiftedLocalHom L R q m e (X 1)) i j ∈ F := hF.2.2.1 + simpa only [shiftedLocalHom_X] using h + +end PermanentBorder.FiniteAlgebras +namespace PermanentBorder.CurveQuotientParameters +open Module Matrix MvPolynomial FiniteAlgebras FinitePlaneFrames CurveParameters +universe u +variable {K L R : Type u} [Field K] [Field L] [Algebra K L] + [Infinite K] [IsAlgClosed L] [CommRing R] [Algebra L R] [Module.Finite L R] + +theorem chart_field_bound (p : MvPolynomial (Fin 2) K) (hp : p ≠ 0) + (q : MvPolynomial (Fin 2) L →ₐ[L] R) (hq : Function.Surjective q) + (hpq : q (p.map (algebraMap K L)) = 0) + {n : ℕ} (b₀ : Basis (Fin n) L R) (r₀ s₀ : Fin n → ℕ) + (hb₀ : ∀ i, b₀ i = q (X 0 ^ r₀ i * X 1 ^ s₀ i)) : + ∃ F : IntermediateField K L, + Algebra.trdeg K F ≤ (finrank L R : Cardinal) ∧ + (∀ i j, representation b₀ (q (X 0)) i j ∈ F) ∧ + (∀ i j, representation b₀ (q (X 1)) i j ∈ F) ∧ + (∀ i, unitVector b₀ i ∈ F) := by + classical + have : IsArtinianRing R := artinian L R + let _ : Fintype (MaximalSpectrum R) := Fintype.ofFinite _ + obtain ⟨e, he, E, hE⟩ := exists_canonical_local_power_decomposition L R + choose b r s hb using fun m => local_monomial_chart L R q hq m e + let D : MaximalSpectrum R → LocalChart (L := L) p := fun m => + localChart q p hpq m e he (b m) (r m) (s m) (hb m) + have hbot : Algebra.trdeg K (⊥ : IntermediateField K L) ≤ (0 : Cardinal) := by + rw [trdeg_eq_zero] + obtain ⟨F, _, hF, hDF⟩ := extend_by_finite_family hp D Finset.univ + (⊥ : IntermediateField K L) hbot + have hdF : ∀ m, (D m).InField F := fun m => hDF m (Finset.mem_univ m) + have hlen : finrank L R = ∑ m : MaximalSpectrum R, finrank L (R ⧸ m.asIdeal ^ e) := by + rw [E.toLinearEquiv.finrank_eq, Module.finrank_pi_fintype] + have hdeg : Algebra.trdeg K F ≤ (finrank L R : Cardinal) := by + rw [hlen] + simpa only [D, localChart, Nat.zero_add] using hF + let w : R ≃ₗ[L] ((m : MaximalSpectrum R) × Fin (finrank L (R ⧸ m.asIdeal ^ e))) → L := + E.toLinearEquiv.trans ((LinearEquiv.piCongrRight fun m => (b m).equivFun).trans + (LinearEquiv.piCurry L (fun (m : MaximalSpectrum R) (_ : Fin (finrank L (R ⧸ m.asIdeal ^ e))) => L)).symm) + let c := Basis.ofEquivFun w + have hmon (a d : ℕ) : ∀ i, c.repr (q (X 0 ^ a * X 1 ^ d)) i ∈ F := by + intro i + change (b i.1).repr (E (q (X 0 ^ a * X 1 ^ d)) i.1) i.2 ∈ F + rw [hE] + exact local_monomial_coordinates_mem F q p hpq i.1 e he + (b i.1) (r i.1) (s i.1) (hb i.1) (hdF i.1) a d i.2 + have hbc : ∀ i j, c.repr (b₀ j) i ∈ F := by + intro i j + rw [hb₀] + exact hmon (r₀ j) (s₀ j) i + have hmon₀ (a d : ℕ) : ∀ i, b₀.repr (q (X 0 ^ a * X 1 ^ d)) i ∈ F := + BasisFieldRecovery.repr_mem F b₀ c hbc _ (hmon a d) + refine ⟨F,hdeg,?_,?_,?_⟩ + · intro i j + rw [show representation b₀ (q (X 0)) i j = b₀.repr (q (X 0) * b₀ j) i from + LinearMap.toMatrixAlgEquiv_apply b₀ (Algebra.lmul L R (q (X 0))) i j] + have h : q (X 0) * b₀ j = q (X 0 ^ (r₀ j + 1) * X 1 ^ s₀ j) := by + rw [hb₀, ← map_mul] + congr 1 + ring + rw [h] + exact hmon₀ (r₀ j+1) (s₀ j) i + · intro i j + rw [show representation b₀ (q (X 1)) i j = b₀.repr (q (X 1) * b₀ j) i from + LinearMap.toMatrixAlgEquiv_apply b₀ (Algebra.lmul L R (q (X 1))) i j] + have h : q (X 1) * b₀ j = q (X 0 ^ r₀ j * X 1 ^ (s₀ j+1)) := by + rw [hb₀, ← map_mul] + congr 1 + ring + rw [h] + exact hmon₀ (r₀ j) (s₀ j+1) i + · intro i + simpa only [pow_zero, one_mul, map_one, unitVector, Basis.equivFun_apply] using hmon₀ 0 0 i + +end PermanentBorder.CurveQuotientParameters + +namespace PermanentBorder.AdjugateAlgebra +open Polynomial Matrix Module +variable {K : Type*} [Field K] {k : ℕ} + +@[simp] theorem planeMap_single (d : ℕ) (i : PlaneIndex d) : + planeMap d (Pi.single i (1 : K)) = + monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1) := by + classical + simp only [planeMap, LinearMap.coe_mk, AddHom.coe_mk, Pi.single_apply] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji + simp [hji] + · simp + +noncomputable def rowCoordinateMap (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) : + (PlaneIndex (k-1) → K) →ₗ[K] (K[X][X] ⧸ rowIdeal (pencilBase θ A)) := + (Ideal.Quotient.mkₐ K (rowIdeal (pencilBase θ A))).toLinearMap.comp (planeMap (k-1)) + +theorem rowCoordinateMap_bijective (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + Function.Bijective (rowCoordinateMap θ A) := by + classical + have hinj : Function.Injective (rowCoordinateMap θ A) := by + apply LinearMap.ker_eq_bot.mp + apply LinearMap.ker_eq_bot'.mpr + intro v hv + have hmem : planeMap (k-1) v ∈ rowIdeal (pencilBase θ A) := + Ideal.Quotient.eq_zero_iff_mem.mp hv + have hz := rowIdeal_low_degree_zero θ hθ A hk hmem (totalDegreeLE_planeMap (k-1) v) + funext i + have hc := congrArg (fun p : K[X][X] => (p.coeff i.val.1.val).coeff + (i.val.2.val-i.val.1.val-1)) hz + simpa only [coeff_planeMap, coeff_zero, Pi.zero_apply] using hc + refine ⟨hinj, LinearMap.range_eq_top.mp ?_⟩ + apply top_unique + rw [← row_quotient_spanned θ hθ A hk] + apply Submodule.span_le.mpr + rintro _ ⟨i,rfl⟩ + refine ⟨Pi.single i 1, ?_⟩ + simp [rowCoordinateMap] + +noncomputable def rowCoordinates (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + (PlaneIndex (k-1) → K) ≃ₗ[K] (K[X][X] ⧸ rowIdeal (pencilBase θ A)) := + LinearEquiv.ofBijective (rowCoordinateMap θ A) (rowCoordinateMap_bijective θ hθ A hk) + +noncomputable def rowBasis (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + Basis (PlaneIndex (k-1)) K (K[X][X] ⧸ rowIdeal (pencilBase θ A)) := + Basis.ofEquivFun (rowCoordinates θ hθ A hk).symm + +@[simp] theorem rowBasis_apply (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) (i : PlaneIndex (k-1)) : + rowBasis θ hθ A hk i = (Ideal.Quotient.mkₐ K (rowIdeal (pencilBase θ A))) + (monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1)) := by + classical + rw [rowBasis, Basis.coe_ofEquivFun] + change rowCoordinateMap θ A (Pi.single i 1) = _ + simp [rowCoordinateMap] + +theorem rowBasis_repr (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) + (P : K[X][X]) (hP : TotalDegreeLE P (k-1)) (i : PlaneIndex (k-1)) : + (rowBasis θ hθ A hk).repr ((Ideal.Quotient.mkₐ K (rowIdeal (pencilBase θ A))) P) i = + (P.coeff i.val.1.val).coeff (i.val.2.val-i.val.1.val-1) := by + let E := rowCoordinates θ hθ A hk + let q := Ideal.Quotient.mkₐ K (rowIdeal (pencilBase θ A)) + let v := E.symm (q P) + have he : q (planeMap (k-1) v) = q P := E.apply_symm_apply (q P) + have hm : planeMap (k-1) v - P ∈ rowIdeal (pencilBase θ A) := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + change q (planeMap (k-1) v - P) = 0 + rw [map_sub, he, sub_self] + have hz := rowIdeal_low_degree_zero θ hθ A hk hm + ((totalDegreeLE_planeMap (k-1) v).sub hP) + have hh := congrArg (fun p : K[X][X] => (p.coeff i.val.1.val).coeff + (i.val.2.val-i.val.1.val-1)) (sub_eq_zero.mp hz) + change v i = _ + simpa only [coeff_planeMap] using hh + +end PermanentBorder.AdjugateAlgebra + +namespace PermanentBorder.Bivariate +open Polynomial +variable (K : Type*) [CommSemiring K] + +noncomputable def equivalence : MvPolynomial (Fin 2) K ≃ₐ[K] K[X][X] := + (MvPolynomial.finSuccEquiv K 1).trans + (Polynomial.mapAlgEquiv (MvPolynomial.uniqueAlgEquiv K (Fin 1))) + +@[simp] theorem equivalence_X_zero : + equivalence K (MvPolynomial.X 0) = (X : K[X][X]) := by + simp [equivalence, MvPolynomial.finSuccEquiv_X_zero] + +@[simp] theorem equivalence_X_one : + equivalence K (MvPolynomial.X 1) = C (X : K[X]) := by + change Polynomial.map (MvPolynomial.uniqueAlgEquiv K (Fin 1)).toRingHom + (MvPolynomial.finSuccEquiv K 1 (MvPolynomial.X (Fin.succ 0))) = _ + rw [MvPolynomial.finSuccEquiv_X_succ, Polynomial.map_C] + simp [MvPolynomial.uniqueAlgEquiv] + +@[simp] theorem equivalence_C (c : K) : + equivalence K (MvPolynomial.C c) = C (C c) := (equivalence K).commutes c + +variable {K} {L : Type*} [CommSemiring L] + +noncomputable def map (f : K →+* L) : K[X][X] →+* L[X][X] := + Polynomial.mapRingHom (Polynomial.mapRingHom f) + +theorem equivalence_map (f : K →+* L) (p : MvPolynomial (Fin 2) K) : + equivalence L (MvPolynomial.map f p) = map f (equivalence K p) := by + have h : (equivalence L).toRingHom.comp (MvPolynomial.map f) = + (map f).comp (equivalence K).toRingHom := by + apply MvPolynomial.ringHom_ext + · intro c + simp [map] + · intro i + fin_cases i <;> simp [map] + exact RingHom.congr_fun h p + +@[simp] theorem equivalence_monomial (a b : ℕ) : + equivalence K (MvPolynomial.X 0 ^ a * MvPolynomial.X 1 ^ b) = + monomial a (monomial b (1 : K)) := by + simp only [map_mul, map_pow, equivalence_X_zero, equivalence_X_one] + rw [← Polynomial.C_pow] + simp only [← Polynomial.C_mul_X_pow_eq_monomial, map_one, one_mul] + exact mul_comm _ _ + +end PermanentBorder.Bivariate + +namespace PermanentBorder.Bivariate +open Polynomial +variable {K L : Type*} [Field K] [Field L] [Algebra K L] + +def InField (F : IntermediateField K L) (P : L[X][X]) : Prop := + ∀ a b, (P.coeff a).coeff b ∈ F + +theorem inField_iff_lifts (F : IntermediateField K L) (P : L[X][X]) : + InField F P ↔ ∃ Q : F[X][X], map F.val.toRingHom Q = P := by + change (∀ a b, (P.coeff a).coeff b ∈ F) ↔ + ∃ Q : F[X][X], Polynomial.map (Polynomial.mapRingHom F.val.toRingHom) Q = P + rw [← Polynomial.mem_lifts, Polynomial.lifts_iff_coeff_lifts] + constructor + · intro h a + have hp : P.coeff a ∈ Polynomial.lifts F.val.toRingHom := by + rw [Polynomial.lifts_iff_coeff_lifts] + intro b + exact ⟨⟨_,h a b⟩,rfl⟩ + exact (Polynomial.mem_lifts _).mp hp + · intro h a b + obtain ⟨Q,hQ⟩ := h a + rw [← hQ] + change (Polynomial.map F.val.toRingHom Q).coeff b ∈ F + rw [Polynomial.coeff_map] + exact (Q.coeff b).property + +theorem InField.add {F : IntermediateField K L} {P Q : L[X][X]} + (hP : InField F P) (hQ : InField F Q) : InField F (P+Q) := by + intro a b + simp only [coeff_add] + exact F.add_mem (hP a b) (hQ a b) + +theorem InField.sub {F : IntermediateField K L} {P Q : L[X][X]} + (hP : InField F P) (hQ : InField F Q) : InField F (P-Q) := by + intro a b + simp only [coeff_sub] + exact F.sub_mem (hP a b) (hQ a b) + +theorem InField.mul {F : IntermediateField K L} {P Q : L[X][X]} + (hP : InField F P) (hQ : InField F Q) : InField F (P*Q) := by + obtain ⟨P',rfl⟩ := (inField_iff_lifts F P).mp hP + obtain ⟨Q',rfl⟩ := (inField_iff_lifts F Q).mp hQ + exact (inField_iff_lifts F _).mpr ⟨P'*Q', map_mul _ _ _⟩ + +theorem inField_map (F : IntermediateField K L) (P : K[X][X]) : + InField F (map (algebraMap K L) P) := by + intro a b + simp only [map, Polynomial.coe_mapRingHom, Polynomial.coeff_map] + exact F.algebraMap_mem _ + +theorem inField_C_C (F : IntermediateField K L) (a : L) (ha : a ∈ F) : + InField F (C (C a)) := by + apply (inField_iff_lifts F _).mpr + exact ⟨C (C ⟨a,ha⟩), by simp [map]⟩ + +theorem inField_X (F : IntermediateField K L) : InField F (X : L[X][X]) := by + exact (inField_iff_lifts F _).mpr ⟨X, by simp [map]⟩ + +theorem inField_C_X (F : IntermediateField K L) : InField F (C (X : L[X])) := by + exact (inField_iff_lifts F _).mpr ⟨C X, by simp [map]⟩ + +theorem eval_mem (F : IntermediateField K L) (P : L[X]) + (hP : ∀ a, P.coeff a ∈ F) (t : L) (ht : t ∈ F) : P.eval t ∈ F := by + rw [Polynomial.eval_eq_sum_range] + exact F.sum_mem fun a _ => F.mul_mem (hP a) (pow_mem ht a) + +end PermanentBorder.Bivariate + +namespace PermanentBorder.AdjugateAlgebra +open Polynomial Module +variable {K L : Type*} [Field K] [Field L] [Algebra K L] + +theorem coordinates_mem {R ι : Type*} [AddCommGroup R] [Module L R] + (F : IntermediateField K L) (f : L[X][X] →ₗ[L] R) (b : Basis ι L R) + (hmon : ∀ a d i, b.repr (f (monomial a (monomial d 1))) i ∈ F) + (P : L[X][X]) (hP : Bivariate.InField F P) (i : ι) : + b.repr (f P) i ∈ F := by + rw [eq_sum_bivariate P, map_sum, map_sum, Finsupp.finsetSum_apply] + apply F.sum_mem + intro a _ + rw [map_sum, map_sum, Finsupp.finsetSum_apply] + apply F.sum_mem + intro d _ + have he : monomial a (monomial d ((P.coeff a).coeff d)) = + ((P.coeff a).coeff d) • monomial a (monomial d (1 : L)) := by + simp only [smul_monomial, smul_eq_mul, mul_one] + rw [he, map_smul, map_smul, Finsupp.smul_apply, smul_eq_mul] + exact F.mul_mem (hP a d) (hmon a d i) + +variable {k : ℕ} + +theorem scaled_coeff_mem (F : IntermediateField K L) (P : L[X][X]) + (hP : Bivariate.InField F P) (a d : ℕ) : + ((scaleHom P).coeff a).coeff d ∈ F := by + rw [coeff_scaleHom] + split_ifs + · exact hP _ _ + · exact F.zero_mem + +omit [Algebra K L] in + +theorem map_rowEntry (f : K →+* L) (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (i : Fin (k+1)) : + Bivariate.map f (rowEntry (pencilBase θ A) i) = + rowEntry (pencilBase (fun j => f (θ j)) (A.map f)) i := by + have hp : (pencilMatrix (pencilBase θ A)).map (Bivariate.map f) = + pencilMatrix (pencilBase (fun j => f (θ j)) (A.map f)) := by + apply Matrix.ext + intro j l + by_cases hjl : j=l <;> simp [pencilMatrix, pencilBase, Bivariate.map, + hjl] + have ha := (Bivariate.map f).map_adjugate (pencilMatrix (pencilBase θ A)) + change (pencilMatrix (pencilBase θ A)).adjugate.map (Bivariate.map f) = + ((pencilMatrix (pencilBase θ A)).map (Bivariate.map f)).adjugate at ha + rw [hp] at ha + simp only [rowEntry, map_sum] + apply Finset.sum_congr rfl + intro j _ + exact congrFun (congrFun ha j) i + +end PermanentBorder.AdjugateAlgebra + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/RankTransfer.lean b/lean/OAI/Algebra/Determinantal/RankTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..98779a41c91c100044f522c77efbed4e79449b97 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/RankTransfer.lean @@ -0,0 +1,465 @@ +import OAI.Algebra.Determinantal.GenericPolars + +namespace OAI + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +lemma exists_matrix_right_inverse {K α β : Type*} [Field K] [Fintype α] [Fintype β] [DecidableEq α] + (A : Matrix α β K) (hA : Function.Surjective A.mulVec) : + ∃ B : Matrix β α K, A * B = 1 := by + classical + choose b hb using fun i : α => hA (Pi.single i 1) + refine ⟨fun j i => b i j, ?_⟩ + ext i j + change (A.mulVec (b j)) i = (1 : Matrix α α K) i j + rw [hb] + simp [Matrix.one_apply, Pi.single_apply] + +theorem integer_polynomial_rank_transfer {K L σ α β : Type*} + [Field K] [Field L] [CharZero L] [Infinite L] [Fintype α] [Fintype β] + (P : Matrix α β (MvPolynomial σ ℤ)) (x : σ → K) + (hP : Function.Surjective (P.map (eval₂Hom (Int.castRingHom K) x)).mulVec) : + ∃ y : σ → L, + Function.Surjective (P.map (eval₂Hom (Int.castRingHom L) y)).mulVec := by + classical + let τ := σ ⊕ (β × α) + let A : Matrix α β (MvPolynomial τ ℤ) := P.map (rename Sum.inl) + let B : Matrix β α (MvPolynomial τ ℤ) := fun i j => X (Sum.inr (i,j)) + let p : MvPolynomial τ ℤ := (A*B).det + obtain ⟨b,hb⟩ := exists_matrix_right_inverse _ hP + let z : τ → K := Sum.elim x (fun ij => b ij.1 ij.2) + let φ : MvPolynomial τ ℤ →+* K := eval₂Hom (Int.castRingHom K) z + have hA : A.map φ = P.map (eval₂Hom (Int.castRingHom K) x) := by + ext i j + simp [A, φ, z, Matrix.map_apply, eval₂_rename, Function.comp_def] + have hB : B.map φ = b := by + ext i j + change φ (X (Sum.inr (i,j))) = b i j + exact eval₂_X _ _ _ + have hp : φ p = 1 := by + rw [show φ p = (φ.mapMatrix (A*B)).det from RingHom.map_det φ (A*B)] + rw [RingHom.mapMatrix_apply, Matrix.map_mul, hA, hB, hb] + exact Matrix.det_one + have hpn : p ≠ 0 := by + intro h + have : (0 : K) = 1 := by simpa only [h, map_zero] using hp + exact zero_ne_one this + let pL : MvPolynomial τ L := map (Int.castRingHom L) p + have hpLn : pL ≠ 0 := by + simpa only [map_zero] using + (MvPolynomial.map_injective (Int.castRingHom L) Int.cast_injective).ne hpn + obtain ⟨w,hw⟩ : ∃ w : τ → L, eval w pL ≠ 0 := by + by_contra h + apply hpLn + apply MvPolynomial.funext + intro w + simp only [map_zero] + exact not_not.mp (not_exists.mp h w) + let ψ : MvPolynomial τ ℤ →+* L := eval₂Hom (Int.castRingHom L) w + have hψ : ψ p ≠ 0 := by + simpa only [pL, eval_map, ψ, coe_eval₂Hom] using hw + have hu : IsUnit ((A*B).map ψ) := by + apply (Matrix.isUnit_iff_isUnit_det _).2 + rw [← RingHom.mapMatrix_apply, ← RingHom.map_det] + exact isUnit_iff_ne_zero.mpr hψ + have hs := Matrix.mulVec_surjective_iff_isUnit.mpr hu + refine ⟨fun i => w (Sum.inl i), ?_⟩ + have hAL : A.map ψ = P.map (eval₂Hom (Int.castRingHom L) (fun i => w (Sum.inl i))) := by + ext i j + simp [A, ψ, Matrix.map_apply, eval₂_rename, Function.comp_def] + intro v + obtain ⟨t,ht⟩ := hs v + refine ⟨(B.map ψ).mulVec t, ?_⟩ + rw [← hAL, Matrix.mulVec_mulVec] + simpa only [Matrix.map_mul] using ht + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +theorem polynomial_rank_specialize {K L σ α β : Type*} + [Field K] [Field L] [Algebra K L] [Infinite K] [Fintype α] [Fintype β] + (P : Matrix α β (MvPolynomial σ K)) (x : σ → L) + (hP : Function.Surjective (P.map (eval₂Hom (algebraMap K L) x)).mulVec) : + ∃ y : σ → K, + Function.Surjective (P.map (eval₂Hom (RingHom.id K) y)).mulVec := by + classical + let τ := σ ⊕ (β × α) + let A : Matrix α β (MvPolynomial τ K) := P.map (rename Sum.inl) + let B : Matrix β α (MvPolynomial τ K) := fun i j => X (Sum.inr (i,j)) + let p : MvPolynomial τ K := (A*B).det + obtain ⟨b,hb⟩ := exists_matrix_right_inverse _ hP + let z : τ → L := Sum.elim x (fun ij => b ij.1 ij.2) + let φ : MvPolynomial τ K →+* L := eval₂Hom (algebraMap K L) z + have hA : A.map φ = P.map (eval₂Hom (algebraMap K L) x) := by + ext i j + simp [A, φ, z, Matrix.map_apply, eval₂_rename, Function.comp_def] + have hB : B.map φ = b := by + ext i j + change φ (X (Sum.inr (i,j))) = b i j + exact eval₂_X _ _ _ + have hp : φ p = 1 := by + rw [show φ p = (φ.mapMatrix (A*B)).det from RingHom.map_det φ (A*B)] + rw [RingHom.mapMatrix_apply, Matrix.map_mul, hA, hB, hb] + exact Matrix.det_one + have hpn : p ≠ 0 := by + intro h + have : (0 : L) = 1 := by simpa only [h, map_zero] using hp + exact zero_ne_one this + obtain ⟨w,hw⟩ : ∃ w : τ → K, eval w p ≠ 0 := by + by_contra h + apply hpn + apply MvPolynomial.funext + intro w + simp only [map_zero] + exact not_not.mp (not_exists.mp h w) + let ψ : MvPolynomial τ K →+* K := eval₂Hom (RingHom.id K) w + have hψ : ψ p ≠ 0 := by + exact hw + have hu : IsUnit ((A*B).map ψ) := by + apply (Matrix.isUnit_iff_isUnit_det _).2 + rw [← RingHom.mapMatrix_apply, ← RingHom.map_det] + exact isUnit_iff_ne_zero.mpr hψ + have hs := Matrix.mulVec_surjective_iff_isUnit.mpr hu + refine ⟨fun i => w (Sum.inl i), ?_⟩ + have hAL : A.map ψ = P.map (eval₂Hom (RingHom.id K) (fun i => w (Sum.inl i))) := by + ext i j + simp [A, ψ, Matrix.map_apply, eval₂_rename, Function.comp_def] + intro v + obtain ⟨t,ht⟩ := hs v + refine ⟨(B.map ψ).mulVec t, ?_⟩ + rw [← hAL, Matrix.mulVec_mulVec] + simpa only [Matrix.map_mul] using ht + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.Polar +open MvPolynomial Matrix PermanentBorder.SliceParameters + +lemma smooth_extension {K L σ : Type*} [Field K] [IsAlgClosed K] [Field L] [Algebra K L] + [Fintype σ] (f : MvPolynomial σ K) + (hs : ∀ y : σ → K, eval y f = 0 → (∀ j, eval y (pderiv j f) = 0) → y = 0) + (y : σ → L) (hf : aeval y f = 0) (hd : ∀ j, aeval y (pderiv j f) = 0) : y = 0 := by + classical + let F : Option σ → MvPolynomial σ K := fun i => match i with + | none => f + | some j => pderiv j f + let I := Ideal.span (Set.range F) + have hz : ∀ x ∈ zeroLocus K I, x = 0 := by + intro x hx + apply hs x + · exact hx _ (Ideal.subset_span ⟨none,rfl⟩) + · intro j + exact hx _ (Ideal.subset_span ⟨some j,rfl⟩) + have hy : y ∈ zeroLocus L I := by + rw [zeroLocus_span] + rintro _ ⟨i,rfl⟩ + cases i with + | none => exact hf + | some j => exact hd j + ext j + obtain ⟨n,hn⟩ := variable_power_certificate I hz j + have hpow : y j ^ n = 0 := by simpa using hy _ hn + by_contra h + exact pow_ne_zero n h hpow + +section Generic +variable {K τ : Type*} [Field K] [CharZero K] [IsAlgClosed K] [Fintype τ] +local notation "P" => (Option τ × PolarVars τ) +local notation "E" => GenericField K P + +lemma generic_bad_zero (f : MvPolynomial (PolarVars τ) K) {r : ℕ} + (hh : f.IsHomogeneous r) + (hs : ∀ y : PolarVars τ → K, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) + (y : PolarVars τ → E) + (hy : ∀ i, eval y (badPolarSystem genericDirections genericLinear (map (algebraMap K E) f) i) = 0) : + y = 0 := by + classical + by_contra hyn + have hf : aeval y f = 0 := by simpa [badPolarSystem, eval_map, aeval_def] using hy none + have hp : ∀ i, polarValue genericDirections f y i = 0 := by + intro i + simpa only [badPolarSystem, eval_polarPolynomial] using hy (some (some i)) + have hg : ∃ j, aeval y (pderiv j f) ≠ 0 := by + by_contra h + exact hyn (smooth_extension f hs y hf (by simpa only [not_exists, not_not] using h)) + have hn : ∑ j, genericLinear j * y j ≠ 0 := fun h => + hyn (generic_no_infinity f hh y hf hp hg h) + have hu := generic_square_isUnit f hh y hf hp hyn hg + have hj : (squareJacobian genericDirections genericLinear f y).det ≠ 0 := + isUnit_iff_ne_zero.mp ((Matrix.isUnit_iff_isUnit_det _).mp hu) + have hb := hy (some none) + simp only [badPolarSystem, map_mul, eval_linearPolynomial, RingHom.map_det, + RingHom.mapMatrix_apply, eval_squarePolynomial] at hb + exact (mul_ne_zero hn hj) hb + +noncomputable def universalBadPolar (f : MvPolynomial (PolarVars τ) K) : + PolarVars τ → MvPolynomial (PolarVars τ) (MvPolynomial P K) := + badPolarSystem (fun i j => X (some i,j)) (fun j => X (none,j)) (map C f) + +omit [CharZero K] [IsAlgClosed K] in +lemma universalBadPolar_specialize {L : Type*} [Field L] [Algebra K L] + (f : MvPolynomial (PolarVars τ) K) (w : P → L) (i : PolarVars τ) : + map (eval₂Hom (algebraMap K L) w) (universalBadPolar f i) = + badPolarSystem (fun i j => w (some i,j)) (fun j => w (none,j)) + (map (algebraMap K L) f) i := by + rw [universalBadPolar, map_badPolarSystem, MvPolynomial.map_map] + have hc : (eval₂Hom (algebraMap K L) w).comp C = algebraMap K L := by ext; simp + rw [hc] + simp only [MvPolynomial.eval₂Hom_X'] + +theorem exists_good_polar_certificate (f : MvPolynomial (PolarVars τ) K) {r : ℕ} + (hh : f.IsHomogeneous r) + (hs : ∀ y : PolarVars τ → K, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) : + ∃ w : τ → PolarVars τ → K, ∃ l : PolarVars τ → K, ∃ D : ℕ, + Function.Surjective (macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) + (badPolarSystem w l f) D).mulVec := by + classical + let F := badPolarSystem (genericDirections (K := K) (τ := τ)) genericLinear + (map (algebraMap K E) f) + have hhom (i : PolarVars τ) : (F i).IsHomogeneous (badPolarDegrees τ r i) := + badPolarSystem_homogeneous _ _ (hh.map _) i + have hz : ∀ y ∈ zeroLocus E (Ideal.span (Set.range F)), y = 0 := by + intro y hy + apply generic_bad_zero f hh hs y + intro i + exact hy _ Ideal.mem_span_range_self + obtain ⟨D,hD⟩ := homogeneous_piece_certificate (Ideal.span (Set.range F)) hz + have hM : Function.Surjective + (macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) F D).mulVec := by + apply (macaulay_surjective_iff _ _ (fun i => homogeneous_intWeight (hhom i)) D).mpr + intro p hp + exact hD p (intWeight_homogeneous hp) + let M := macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) (universalBadPolar f) D + have hMa : Function.Surjective (M.map (eval₂Hom (algebraMap K E) (genericParameter K P))).mulVec := by + have he : M.map (eval₂Hom (algebraMap K E) (genericParameter K P)) = + macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) F D := by + rw [← macaulayMatrix_map] + apply congrArg (fun Q => macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) Q D) + funext i + exact universalBadPolar_specialize f (genericParameter K P) i + rwa [he] + obtain ⟨a,ha⟩ := polynomial_rank_specialize M (genericParameter K P) hMa + refine ⟨fun i j => a (some i,j), fun j => a (none,j), D, ?_⟩ + have he : M.map (eval₂Hom (RingHom.id K) a) = + macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) + (badPolarSystem (fun i j => a (some i,j)) (fun j => a (none,j)) f) D := by + rw [← macaulayMatrix_map] + apply congrArg (fun Q => macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) Q D) + funext i + simpa only [Algebra.algebraMap_self, MvPolynomial.map_id] using universalBadPolar_specialize f a i + rwa [he] at ha + +end Generic +end PermanentBorder.Polar + +namespace PermanentBorder.Polar +open MvPolynomial Matrix PermanentBorder.SliceParameters +open scoped Classical +variable {τ : Type*} [Fintype τ] + +noncomputable def hypersurfacePolars (w : τ → PolarVars τ → ℂ) + (f : MvPolynomial (PolarVars τ) ℂ) : Option τ → MvPolynomial (PolarVars τ) ℂ := + Option.elim' f (polarPolynomial w f) + +def hypersurfaceDegrees (r : ℕ) : Option τ → ℕ := Option.elim' r (fun _ => r-1) + +lemma hypersurfacePolars_homogeneous (w : τ → PolarVars τ → ℂ) + {f : MvPolynomial (PolarVars τ) ℂ} {r : ℕ} (hh : f.IsHomogeneous r) (i : Option τ) : + (hypersurfacePolars w f i).IsHomogeneous (hypersurfaceDegrees r i) := by + cases i with + | none => exact hh + | some i => exact polarPolynomial_homogeneous w hh i + +def swapFirstRows : Equiv.Perm (PolarVars τ) where + toFun := Option.elim' (some none) (Option.elim' none (fun i => some (some i))) + invFun := Option.elim' (some none) (Option.elim' none (fun i => some (some i))) + left_inv := by rintro (_ | (_ | i)) <;> rfl + right_inv := by rintro (_ | (_ | i)) <;> rfl + +lemma hypersurfacePolars_square (w : τ → PolarVars τ → ℂ) (l : PolarVars τ → ℂ) + (f : MvPolynomial (PolarVars τ) ℂ) : + CI.square (hypersurfacePolars w f) l = + (squarePolynomial w l f).submatrix swapFirstRows id := by + ext i j + rcases i with _ | (_ | i) <;> + simp [CI.square, hypersurfacePolars, squarePolynomial, Matrix.submatrix, swapFirstRows] + +lemma determinant_permutation_ne_zero {n : Type*} [Fintype n] + (d₁ d₂ : DecidableEq n) (A B : Matrix n n ℂ) (e : Equiv.Perm n) + (he : B = A.submatrix e id) (ha : @Matrix.det n d₁ _ ℂ _ A ≠ 0) : + @Matrix.det n d₂ _ ℂ _ B ≠ 0 := by + subst B + cases Subsingleton.elim d₁ d₂ + rw [Matrix.det_permute] + exact mul_ne_zero (by exact_mod_cast (Equiv.Perm.sign e).ne_zero) ha + +lemma polar_certificate_good (w : τ → PolarVars τ → ℂ) (l : PolarVars τ → ℂ) + (f : MvPolynomial (PolarVars τ) ℂ) {r : ℕ} (hh : f.IsHomogeneous r) (D : ℕ) + (hM : Function.Surjective (macaulayMatrix (fun i => (badPolarDegrees τ r i : ℤ)) + (badPolarSystem w l f) D).mulVec) : CI.Good (hypersurfacePolars w f) l := by + classical + have hz := macaulay_surjective_zero (badPolarSystem w l f) (badPolarDegrees τ r) + (badPolarSystem_homogeneous w l hh) D hM + intro y hn hy + have hp : eval y (linearPolynomial l) * ((squarePolynomial w l f).map (eval y)).det ≠ 0 := by + intro he + apply hn (hz y ?_) + rintro (_ | (_ | i)) + · exact hy none + · simpa only [badPolarSystem, map_mul, RingHom.map_det, RingHom.mapMatrix_apply] using he + · exact hy (some i) + refine ⟨(mul_ne_zero_iff.mp hp).1, ?_⟩ + have he : (CI.square (hypersurfacePolars w f) l).map (eval y) = + ((squarePolynomial w l f).map (eval y)).submatrix swapFirstRows id := by + rw [hypersurfacePolars_square] + rfl + exact determinant_permutation_ne_zero _ _ _ _ swapFirstRows he (mul_ne_zero_iff.mp hp).2 + +theorem smooth_polar_count (f : MvPolynomial (PolarVars τ) ℂ) {r : ℕ} (hr : 2 ≤ r) + (hh : f.IsHomogeneous r) + (hs : ∀ y : PolarVars τ → ℂ, eval y f = 0 → + (∀ j, eval y (pderiv j f) = 0) → y = 0) : + ∃ w : τ → PolarVars τ → ℂ, ∃ l : PolarVars τ → ℂ, + CI.Good (hypersurfacePolars w f) l ∧ + Nat.card (CI.Roots (hypersurfacePolars w f) l) = r * (r-1) ^ Fintype.card τ := by + obtain ⟨w,l,D,hD⟩ := exists_good_polar_certificate f hh hs + have hg := polar_certificate_good w l f hh D hD + refine ⟨w,l,hg,?_⟩ + have hc := CI.good_card (hypersurfacePolars w f) l (hypersurfaceDegrees r) + (by rintro (_ | i) <;> simp only [hypersurfaceDegrees,Option.elim'_none,Option.elim'_some] <;> omega) + (hypersurfacePolars_homogeneous w hh) hg + simpa [hypersurfaceDegrees] using hc + +end PermanentBorder.Polar + +namespace PermanentBorder.Polar +open scoped Classical +variable {ι : Type*} [Fintype ι] + +noncomputable def coordinateSplit (l : Option ι → ℂ) (h : l none ≠ 0) : + (Option ι → ℂ) ≃ₗ[ℂ] (Option ι → ℂ) where + toFun y := Option.elim' (∑ j, l j * y j) (fun i => y (some i)) + invFun z := Option.elim' ((z none - ∑ i, l (some i) * z (some i)) / l none) + (fun i => z (some i)) + left_inv y := by + funext i + cases i with + | none => simp only [Option.elim'_none, Option.elim'_some, Fintype.sum_option] + field_simp + ring + | some i => rfl + right_inv z := by + funext i + cases i with + | none => simp only [Option.elim'_none, Option.elim'_some, Fintype.sum_option] + field_simp + ring + | some i => rfl + map_add' y z := by + funext i + cases i <;> simp [mul_add, Finset.sum_add_distrib] + map_smul' c y := by + funext i + cases i with + | none => + change (∑ j, l j * (c * y j)) = c * ∑ j, l j * y j + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + | some i => rfl + +lemma coordinateSplit_none (l : Option ι → ℂ) (h : l none ≠ 0) (y : Option ι → ℂ) : + coordinateSplit l h y none = ∑ j, l j * y j := rfl + +lemma exists_normalizer_equiv (l : Option ι → ℂ) (hl : l ≠ 0) : + ∃ e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ), + ∀ y, e y none = ∑ j, l j * y j := by + classical + obtain ⟨i,hi⟩ : ∃ i, l i ≠ 0 := by + by_contra! h + exact hl (funext h) + let p := Equiv.swap none i + let c : (Option ι → ℂ) ≃ₗ[ℂ] (Option ι → ℂ) := + LinearEquiv.funCongrLeft ℂ ℂ p.symm + have hc (y : Option ι → ℂ) (j : Option ι) : c y j = y (p j) := rfl + let l' := fun j => l (p j) + have hl' : l' none ≠ 0 := by simpa [l',p] using hi + let e := c.trans (coordinateSplit l' hl') + refine ⟨e.toContinuousLinearEquiv, ?_⟩ + intro y + change (coordinateSplit l' hl' (c y)) none = _ + rw [coordinateSplit_none] + change (∑ j, l (p j) * y (p j)) = _ + exact Equiv.sum_comp p (fun j => l j * y j) + +noncomputable def optionInsert : (ι → ℂ) →L[ℂ] (Option ι → ℂ) := + ContinuousLinearMap.pi (fun i => match i with + | none => 0 + | some j => ContinuousLinearMap.proj j) + +omit [Fintype ι] in +@[simp] lemma optionInsert_none (v : ι → ℂ) : optionInsert v none = 0 := rfl +omit [Fintype ι] in +@[simp] lemma optionInsert_some (v : ι → ℂ) (i : ι) : optionInsert v (some i) = v i := rfl + +noncomputable def affineNormChart + (e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ)) (z : ι → ℂ) : Option ι → ℂ := + e.symm (Option.elim' 1 z) + +lemma affineNormChart_hasFDerivAt + (e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ)) (z : ι → ℂ) : + HasFDerivAt (affineNormChart e) + (e.symm.toContinuousLinearMap.comp optionInsert) z := by + have h : HasFDerivAt (fun z : ι → ℂ => Option.elim' 1 z) optionInsert z := by + apply hasFDerivAt_pi.mpr + rintro (_ | i) + · exact hasFDerivAt_const _ _ + · exact (ContinuousLinearMap.proj i : (ι → ℂ) →L[ℂ] ℂ).hasFDerivAt + exact e.symm.hasFDerivAt.comp z h + +lemma affineNormChart_contDiff + (e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ)) (n : ℕ∞) : + ContDiff ℂ n (affineNormChart e) := by + apply e.symm.contDiff.comp + apply contDiff_pi.mpr + rintro (_ | i) + · exact contDiff_const + · exact contDiff_apply ℂ ℂ i + +omit [Fintype ι] in +lemma affineNormChart_injective + (e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ)) : Function.Injective (affineNormChart e) := by + intro x y h + have hxy := e.symm.injective h + exact funext (fun i => congrFun hxy (some i)) + +omit [Fintype ι] in +lemma exists_chart_preimage + (e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ)) {y : Option ι → ℂ} + (hy : e y none = 1) : ∃ z, affineNormChart e z = y := by + refine ⟨fun i => e y (some i), ?_⟩ + apply e.injective + rw [affineNormChart, e.apply_symm_apply] + funext i + cases i <;> simp [hy] + +lemma affineNormChart_eq + (e : (Option ι → ℂ) ≃L[ℂ] (Option ι → ℂ)) (z : ι → ℂ) (j : Option ι) : + affineNormChart e z j = e.symm (Pi.single none 1) j + + ∑ i, e.symm (Pi.single (some i) 1) j * z i := by + classical + have hd : Option.elim' 1 z = Pi.single none 1 + ∑ i, z i • Pi.single (some i) 1 := by + funext j + cases j <;> simp [Pi.single_apply] + rw [affineNormChart, hd, map_add, map_sum] + simp [Finset.sum_apply, mul_comm] + +end PermanentBorder.Polar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/RegularSections.lean b/lean/OAI/Algebra/Determinantal/RegularSections.lean new file mode 100644 index 0000000000000000000000000000000000000000..08001268894746baaf079e38c909f64a79fb7ff8 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/RegularSections.lean @@ -0,0 +1,470 @@ +import OAI.Algebra.Determinantal.BilinearCounts + +namespace OAI + +namespace PermanentBorder.CI +open MvPolynomial Matrix +open scoped Classical +section Algebra +variable {R ι : Type*} [CommRing R] [Fintype ι] + +noncomputable def linear (l : Option ι → R) : MvPolynomial (Option ι) R := + ∑ j, C (l j) * X j + +noncomputable def normalized (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) : + Option ι → MvPolynomial (Option ι) R := Option.elim' (linear l - 1) H + +noncomputable def square (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) : + Matrix (Option ι) (Option ι) (MvPolynomial (Option ι) R) := + fun i j => match i with | none => C (l j) | some k => pderiv j (H k) + +noncomputable def bad (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) : + Option ι → MvPolynomial (Option ι) R := Option.elim' (linear l * (square H l).det) H + +def degrees (e : ι → ℕ) : Option ι → ℕ := Option.elim' (1 + ∑ i, (e i - 1)) e + +lemma linear_homogeneous (l : Option ι → R) : (linear l).IsHomogeneous 1 := by + apply IsHomogeneous.sum + intro j _ + simpa using (isHomogeneous_C (Option ι) (l j)).mul (isHomogeneous_X R j) + +lemma pderiv_linear (l : Option ι → R) (j : Option ι) : pderiv j (linear l) = C (l j) := by + classical + cases j <;> simp [linear, pderiv_X, Pi.single_apply] + +lemma pderiv_normalized (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) + (i j : Option ι) : pderiv j (normalized H l i) = square H l i j := by + cases i <;> simp [normalized, square, pderiv_linear] + +lemma eval_linear (l y : Option ι → R) : eval y (linear l) = ∑ j, l j * y j := by + simp [linear] + +lemma det_homogeneous {σ n : Type*} [Fintype n] [DecidableEq n] + (A : Matrix n n (MvPolynomial σ R)) (e : n → ℕ) + (hA : ∀ i j, (A i j).IsHomogeneous (e i)) : A.det.IsHomogeneous (∑ i, e i) := by + classical + rw [Matrix.det_apply] + apply IsHomogeneous.sum + intro p _ + have hp : (∏ i, A (p i) i).IsHomogeneous (∑ i, e (p i)) := + IsHomogeneous.prod _ _ _ (fun i _ => hA _ _) + rw [Equiv.sum_comp] at hp + change (p.sign : ℤ) • (∏ i, A (p i) i) ∈ + (homogeneousSubmodule σ R (∑ i, e i)).restrictScalars ℤ + exact Submodule.smul_mem _ _ hp + +lemma square_det_homogeneous (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) + (e : ι → ℕ) (hH : ∀ i, (H i).IsHomogeneous (e i)) : + (square H l).det.IsHomogeneous (∑ i, (e i - 1)) := by + classical + have h := det_homogeneous (square H l) (Option.elim' 0 (fun i => e i - 1)) (by + intro i j + cases i with + | none => exact isHomogeneous_C _ _ + | some i => exact (hH i).pderiv) + simpa using h + +lemma bad_homogeneous (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) + (e : ι → ℕ) (hH : ∀ i, (H i).IsHomogeneous (e i)) (i : Option ι) : + (bad H l i).IsHomogeneous (degrees e i) := by + cases i with + | none => exact (linear_homogeneous l).mul (square_det_homogeneous H l e hH) + | some i => exact hH i + +end Algebra +section Good +variable {K ι : Type*} [Field K] [Fintype ι] + +def Good (H : ι → MvPolynomial (Option ι) K) (l : Option ι → K) : Prop := + ∀ y : Option ι → K, y ≠ 0 → (∀ i, eval y (H i) = 0) → + eval y (linear l) ≠ 0 ∧ (square H l |>.map (eval y)).det ≠ 0 + +lemma good_iff_bad (H : ι → MvPolynomial (Option ι) K) (l : Option ι → K) : + Good H l ↔ ∀ y : Option ι → K, (∀ i, eval y (bad H l i) = 0) → y = 0 := by + classical + constructor + · intro hg y hy + by_contra hn + obtain ⟨hl,hj⟩ := hg y hn (fun i => hy (some i)) + have h := hy none + change eval y (linear l * (square H l).det) = 0 at h + rw [map_mul, RingHom.map_det] at h + exact (mul_ne_zero hl hj) h + · intro hz y hn hH + have h : eval y (linear l * (square H l).det) ≠ 0 := by + intro h + exact hn (hz y (by intro i; cases i; exact h; exact hH _)) + rw [map_mul, RingHom.map_det] at h + exact mul_ne_zero_iff.mp h + +end Good +end PermanentBorder.CI + +namespace PermanentBorder.CI +open MvPolynomial Matrix +open scoped Classical +variable {ι : Type*} [Fintype ι] + +noncomputable def powers (e : ι → ℕ) : ι → MvPolynomial (Option ι) ℂ := + fun i => X (some i) ^ e i - X none ^ e i +noncomputable def coordinate : Option ι → ℂ := Pi.single none 1 + +omit [Fintype ι] in +lemma powers_homogeneous (e : ι → ℕ) (i : ι) : (powers e i).IsHomogeneous (e i) := by + simpa [powers] using ((isHomogeneous_X ℂ (some i)).pow (e i)).sub + ((isHomogeneous_X ℂ (none : Option ι)).pow (e i)) + +lemma eval_coordinate (y : Option ι → ℂ) : eval y (linear (coordinate (ι := ι))) = y none := by + simp [linear, coordinate, Pi.single_apply] + +lemma powers_good (e : ι → ℕ) (he : ∀ i, 0 < e i) : Good (powers e) coordinate := by + intro y hy hH + have hp (i : ι) : y (some i) ^ e i = y none ^ e i := by + simpa [powers, sub_eq_zero] using hH i + have hn : y none ≠ 0 := by + intro hn + apply hy + funext i + cases i with + | none => exact hn + | some i => + have hh : y (some i) ^ e i = 0 := by rw [hp i, hn, zero_pow (ne_of_gt (he i))] + exact eq_zero_of_pow_eq_zero hh + have hs (i : ι) : y (some i) ≠ 0 := by + intro hz + have hh := hp i + rw [hz, zero_pow (ne_of_gt (he i))] at hh + exact (pow_ne_zero _ hn) hh.symm + refine ⟨by simpa only [eval_coordinate] using hn, ?_⟩ + let A := (square (powers e) (coordinate (ι := ι))).map (eval y) + have h0 (v : Option ι → ℂ) : A.mulVec v none = v none := by + simp [A, square, coordinate, Matrix.mulVec, dotProduct, Pi.single_apply] + have hd (i : ι) (j : Option ι) : eval y (pderiv j (powers e i)) = + (if some i = j then (e i : ℂ) * y (some i) ^ (e i - 1) else 0) - + (if none = j then (e i : ℂ) * y none ^ (e i - 1) else 0) := by + by_cases ha : some i = j <;> by_cases hb : none = j <;> + simp [powers, pderiv_X, ha, hb] + have h1 (v : Option ι → ℂ) (i : ι) : + A.mulVec v (some i) = (e i : ℂ) * y (some i) ^ (e i - 1) * v (some i) - + (e i : ℂ) * y none ^ (e i - 1) * v none := by + change (∑ j, eval y (pderiv j (powers e i)) * v j) = _ + simp only [hd, sub_mul, Finset.sum_sub_distrib, ite_mul, zero_mul, + Finset.sum_ite_eq, Finset.mem_univ, ite_true] + have hi : Function.Injective A.mulVec := by + change Function.Injective A.mulVecLin + apply (LinearMap.ker_eq_bot).mp + apply LinearMap.ker_eq_bot'.mpr + intro v hv + change A.mulVec v = 0 at hv + have hv0 : v none = 0 := by simpa only [h0, Pi.zero_apply] using congrFun hv none + funext j + cases j with + | none => exact hv0 + | some i => + have hh := congrFun hv (some i) + rw [h1, hv0, mul_zero, sub_zero] at hh + exact (mul_eq_zero.mp hh).resolve_left + (mul_ne_zero (Nat.cast_ne_zero.mpr (ne_of_gt (he i))) (pow_ne_zero _ (hs i))) + exact isUnit_iff_ne_zero.mp ((Matrix.isUnit_iff_isUnit_det A).mp + (Matrix.mulVec_injective_iff_isUnit.mp hi)) + +def Roots (H : ι → MvPolynomial (Option ι) ℂ) (l : Option ι → ℂ) := + {y : Option ι → ℂ // (∀ i, eval y (H i) = 0) ∧ eval y (linear l) = 1} + +noncomputable def powersRootsEquiv (e : ι → ℕ) : + Roots (powers e) coordinate ≃ (∀ i, {z : ℂ // z ^ e i = 1}) where + toFun y i := ⟨y.val (some i), by + have h0 : y.val none = 1 := by simpa only [eval_coordinate] using y.property.2 + simpa [powers, h0, sub_eq_zero] using y.property.1 i⟩ + invFun z := ⟨Option.elim' 1 (fun i => (z i).val), by + constructor + · intro i + simp [powers, (z i).property] + · simp only [eval_coordinate, Option.elim'_none]⟩ + left_inv y := by + apply Subtype.ext + funext j + cases j with + | none => + have h0 : y.val none = 1 := by simpa only [eval_coordinate] using y.property.2 + exact h0.symm + | some i => rfl + right_inv z := by funext i; rfl + +lemma card_power_roots (n : ℕ) (hn : 0 < n) : Nat.card {z : ℂ // z^n=1} = n := by + let : NeZero n := ⟨ne_of_gt hn⟩ + let e := (rootsOfUnityEquivNthRoots ℂ n).trans + (Equiv.subtypeEquivRight (fun _ => Polynomial.mem_nthRoots hn)) + rw [← Nat.card_congr e] + exact Complex.card_rootsOfUnity n + +lemma powers_card (e : ι → ℕ) (he : ∀ i, 0 < e i) : + Nat.card (Roots (powers e) coordinate) = ∏ i, e i := by + rw [Nat.card_congr (powersRootsEquiv e), Nat.card_pi] + exact Finset.prod_congr rfl (fun i _ => card_power_roots (e i) (he i)) + +end PermanentBorder.CI + +namespace PermanentBorder.CI +open MvPolynomial +section +variable {σ : Type*} [Fintype σ] + +noncomputable def polynomialDerivative (p : MvPolynomial σ ℂ) (x : σ → ℂ) : + (σ → ℂ) →L[ℂ] ℂ := + ∑ i, MvPolynomial.eval x (pderiv i p) • ContinuousLinearMap.proj i + +@[simp] lemma polynomialDerivative_apply (p : MvPolynomial σ ℂ) (x v : σ → ℂ) : + polynomialDerivative p x v = ∑ i, MvPolynomial.eval x (pderiv i p) * v i := by + classical + simp [polynomialDerivative] + +lemma hasFDerivAt_eval (p : MvPolynomial σ ℂ) (x : σ → ℂ) : + HasFDerivAt (fun y => MvPolynomial.eval y p) (polynomialDerivative p x) x := by + classical + induction p using MvPolynomial.induction_on with + | C a => + have he : polynomialDerivative (C a) x = 0 := by ext v; simp + rw [he] + simpa only [eval_C] using (hasFDerivAt_const (𝕜 := ℂ) a x) + | add p q hp hq => + have he : polynomialDerivative (p+q) x = polynomialDerivative p x + polynomialDerivative q x := by + ext v + simp [add_mul, Finset.sum_add_distrib] + have hd := (hp.add hq).congr_fderiv he.symm + convert! hd using 1 + ext y + simp + | mul_X p i hp => + have he : polynomialDerivative (p*X i) x = + (eval x p) • ContinuousLinearMap.proj i + (x i) • polynomialDerivative p x := by + ext v + simp [polynomialDerivative, pderiv_X, Pi.single_apply, + mul_add, Finset.sum_add_distrib, Finset.mul_sum, + mul_comm, mul_left_comm, apply_ite] + have hd := hp.mul ((ContinuousLinearMap.proj i : (σ → ℂ) →L[ℂ] ℂ).hasFDerivAt (x := x)) + have hd' := hd.congr_fderiv he.symm + convert! hd' using 1 + ext y + simp + +lemma contDiff_eval (p : MvPolynomial σ ℂ) : + ContDiff ℂ 1 (fun x : σ → ℂ => MvPolynomial.eval x p) := by + induction p using MvPolynomial.induction_on with + | C a => simpa using (contDiff_const : ContDiff ℂ 1 (fun _ : σ → ℂ => a)) + | add p q hp hq => simpa only [map_add] using hp.add hq + | mul_X p i hp => simpa only [map_mul, eval_X] using hp.mul (contDiff_apply ℂ ℂ i) + +noncomputable def jacobian (P : σ → MvPolynomial σ ℂ) (x : σ → ℂ) : Matrix σ σ ℂ := + fun i j => eval x (pderiv j (P i)) + +lemma system_fderiv (P : σ → MvPolynomial σ ℂ) (x : σ → ℂ) : + fderiv ℂ (fun y i => eval y (P i)) x = + ContinuousLinearMap.pi (fun i => polynomialDerivative (P i) x) := + (hasFDerivAt_pi.mpr (fun i => hasFDerivAt_eval (P i) x)).fderiv + +lemma system_fderiv_apply (P : σ → MvPolynomial σ ℂ) (x v : σ → ℂ) : + fderiv ℂ (fun y i => eval y (P i)) x v = (jacobian P x).mulVec v := by + rw [system_fderiv] + ext i + simp [jacobian, Matrix.mulVec, dotProduct] + +lemma system_fderiv_invertible [DecidableEq σ] (P : σ → MvPolynomial σ ℂ) (x : σ → ℂ) + (h : (jacobian P x).det ≠ 0) : + (fderiv ℂ (fun y i => eval y (P i)) x).IsInvertible := by + have hu : IsUnit (jacobian P x) := + (Matrix.isUnit_iff_isUnit_det _).mpr (isUnit_iff_ne_zero.mpr h) + have he : ⇑(fderiv ℂ (fun y i => eval y (P i)) x) = (jacobian P x).mulVec := + funext (system_fderiv_apply P x) + have hb : Function.Bijective (fderiv ℂ (fun y i => eval y (P i)) x) := by + rw [he] + exact ⟨Matrix.mulVec_injective_iff_isUnit.mpr hu, Matrix.mulVec_surjective_iff_isUnit.mpr hu⟩ + obtain ⟨u,hu⟩ := ContinuousLinearMap.isUnit_iff_bijective.mpr hb + exact ⟨ContinuousLinearEquiv.ofUnit u, hu⟩ +end +end PermanentBorder.CI + +namespace PermanentBorder.Polar +open Topology Filter +open scoped Topology + +theorem localHomeomorph_restrictPreimage {X Y : Type*} [TopologicalSpace X] + [TopologicalSpace Y] {f : X → Y} (h : IsLocalHomeomorph f) (s : Set Y) : + IsLocalHomeomorph (s.restrictPreimage f) := by + apply isLocalHomeomorph_iff_isOpenEmbedding_restrict.mpr + intro x + obtain ⟨U,hU,hE⟩ := isLocalHomeomorph_iff_isOpenEmbedding_restrict.mp h x.val + let V : Set (f ⁻¹' s) := Subtype.val ⁻¹' U + let e : V ≃ₜ ((U.domRestrict f) ⁻¹' s) := + { toFun := fun z => ⟨⟨z.val.val,z.property⟩,z.val.property⟩ + invFun := fun z => ⟨⟨z.val.val,z.property⟩,z.val.property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + refine ⟨V, continuous_subtype_val.continuousAt.preimage_mem_nhds hU, ?_⟩ + exact (hE.restrictPreimage s).comp e.isOpenEmbedding + +theorem zero_projection_chart {X F P : Type*} [TopologicalSpace X] + [TopologicalSpace F] [TopologicalSpace P] [Zero F] + (f : X → F) (p : X → P) (x : {x : X // f x = 0}) + (e : OpenPartialHomeomorph X (F × P)) (hx : x.val ∈ e.source) + (he : ∀ z, e z = (f z,p z)) : + ∃ U ∈ 𝓝 x, IsOpenEmbedding (U.domRestrict (fun z : {x : X // f x = 0} => p z)) := by + let U : Set {x : X // f x = 0} := Subtype.val ⁻¹' e.source + let A : Set (F × P) := {v | v.1 = 0} + let h : U ≃ₜ ((e.source.domRestrict e) ⁻¹' A) := + { toFun := fun z => ⟨⟨z.val.val,z.property⟩,by simpa [A, he] using z.val.property⟩ + invFun := fun z => ⟨⟨z.val.val,by simpa [A, he] using z.property⟩,z.val.property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + let g : A ≃ₜ P := + { toFun := fun v => v.val.2 + invFun := fun b => ⟨(0,b),rfl⟩ + left_inv := fun v => by apply Subtype.ext; exact Prod.ext v.property.symm rfl + right_inv := fun _ => rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + refine ⟨U, (e.open_source.preimage continuous_subtype_val).mem_nhds hx, ?_⟩ + have H := g.isOpenEmbedding.comp ((e.isOpenEmbedding_restrict.restrictPreimage A).comp + h.isOpenEmbedding) + convert H using 1 + funext z + exact (congrArg Prod.snd (he z.val.val)).symm + +theorem implicit_zero_projection {𝕜 P V : Type*} [NontriviallyNormedField 𝕜] + [NormedAddCommGroup P] [NormedSpace 𝕜 P] [CompleteSpace P] + [NormedAddCommGroup V] [NormedSpace 𝕜 V] [CompleteSpace V] + (f : P × V → V) + (h : ∀ x : {x : P × V // f x = 0}, ∃ D : P × V →L[𝕜] V, + HasStrictFDerivAt f D x.val ∧ (D ∘L ContinuousLinearMap.inr 𝕜 P V).IsInvertible) : + IsLocalHomeomorph (fun x : {x : P × V // f x = 0} => x.val.1) := by + apply isLocalHomeomorph_iff_isOpenEmbedding_restrict.mpr + intro x + obtain ⟨D,hd,hi⟩ := h x + let φ := hd.implicitFunctionDataOfProdDomain hi + exact zero_projection_chart f Prod.fst x φ.toOpenPartialHomeomorph + φ.pt_mem_toOpenPartialHomeomorph_source φ.toOpenPartialHomeomorph_apply + +theorem covering_card_locallyConstant {X Y : Type*} [TopologicalSpace X] + [TopologicalSpace Y] {f : X → Y} (h : IsCoveringMap f) : + IsLocallyConstant (fun y => Nat.card (f ⁻¹' {y})) := by + apply (IsLocallyConstant.iff_eventually_eq _).mpr + intro y + obtain ⟨hd,U,hy,hU,hf,H,hH⟩ := h y + filter_upwards [hU.mem_nhds hy] with z hz + have he : IsEvenlyCovered f z (f ⁻¹' {y}) := ⟨hd,U,hz,hU,hf,H,hH⟩ + exact Nat.card_congr he.fiberHomeomorph.toEquiv.symm + +theorem proper_localHomeomorph_card {X Y : Type*} [TopologicalSpace X] + [TopologicalSpace Y] [T2Space X] [PreconnectedSpace Y] {f : X → Y} + (hp : IsProperMap f) (hl : IsLocalHomeomorph f) (y z : Y) : + Nat.card (f ⁻¹' {y}) = Nat.card (f ⁻¹' {z}) := by + have hfin (a : Y) : (f ⁻¹' {a}).Finite := by + let : CompactSpace (f ⁻¹' {a}) := isCompact_iff_compactSpace.mp + (hp.isCompact_preimage isCompact_singleton) + let : DiscreteTopology (f ⁻¹' {a}) := + (localHomeomorph_restrictPreimage hl {a}).comap_discreteTopology + exact Set.finite_coe_iff.mp finite_of_compact_of_discrete + have hcov : IsCoveringMap f := by + apply isCoveringMap_iff_isCoveringMapOn_univ.mpr + exact hp.isClosedMap.isCoveringMapOn_of_isLocalHomeomorphOn + (fun a _ => hfin a) hl.isLocalHomeomorphOn + exact (covering_card_locallyConstant hcov).apply_eq_of_preconnectedSpace y z + +end PermanentBorder.Polar +namespace PermanentBorder.Polar +open Topology Filter +open scoped Topology + +theorem localHomeomorphOn_restrictPreimage {X Y : Type*} [TopologicalSpace X] + [TopologicalSpace Y] {f : X → Y} (s : Set Y) + (h : IsLocalHomeomorphOn f (f ⁻¹' s)) : + IsLocalHomeomorph (s.restrictPreimage f) := by + apply isLocalHomeomorph_iff_isOpenEmbedding_restrict.mpr + intro x + obtain ⟨U,hU,hE⟩ := (isLocalHomeomorphOn_iff_isOpenEmbedding_restrict _).mp h x.val x.property + let V : Set (f ⁻¹' s) := Subtype.val ⁻¹' U + let e : V ≃ₜ ((U.domRestrict f) ⁻¹' s) := + { toFun := fun z => ⟨⟨z.val.val,z.property⟩,z.val.property⟩ + invFun := fun z => ⟨⟨z.val.val,z.property⟩,z.val.property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + refine ⟨V, continuous_subtype_val.continuousAt.preimage_mem_nhds hU, ?_⟩ + exact (hE.restrictPreimage s).comp e.isOpenEmbedding + +theorem implicit_zero_projection_on {𝕜 P V : Type*} [NontriviallyNormedField 𝕜] + [NormedAddCommGroup P] [NormedSpace 𝕜 P] [CompleteSpace P] + [NormedAddCommGroup V] [NormedSpace 𝕜 V] [CompleteSpace V] + (f : P × V → V) (s : Set P) + (h : ∀ x : {x : P × V // f x = 0}, x.val.1 ∈ s → ∃ D : P × V →L[𝕜] V, + HasStrictFDerivAt f D x.val ∧ (D ∘L ContinuousLinearMap.inr 𝕜 P V).IsInvertible) : + IsLocalHomeomorph (s.restrictPreimage + (fun x : {x : P × V // f x = 0} => x.val.1)) := by + apply localHomeomorphOn_restrictPreimage + apply (isLocalHomeomorphOn_iff_isOpenEmbedding_restrict _).mpr + intro x hx + obtain ⟨D,hd,hi⟩ := h x hx + let φ := hd.implicitFunctionDataOfProdDomain hi + exact zero_projection_chart f Prod.fst x φ.toOpenPartialHomeomorph + φ.pt_mem_toOpenPartialHomeomorph_source φ.toOpenPartialHomeomorph_apply + +end PermanentBorder.Polar + +namespace PermanentBorder.Polar +open Topology Set + +theorem homogeneous_normalized_proper {T V : Type*} [TopologicalSpace T] + [NormedAddCommGroup V] [NormedSpace ℂ V] [ProperSpace V] + (H : T → V → Prop) (hH : IsClosed {z : T × V | H z.1 z.2}) + (hsmul : ∀ t y (c : ℂ), H t y → H t (c • y)) + (L : T → V →ₗ[ℂ] ℂ) (hL : Continuous (fun z : T × V => L z.1 z.2)) + (hno : ∀ t y, H t y → L t y = 0 → y = 0) : + IsProperMap (fun z : {z : T × V // H z.1 z.2 ∧ L z.1 z.2 = 1} => z.val.1) := by + let S := Metric.sphere (0 : V) 1 + let : CompactSpace S := isCompact_iff_compactSpace.mp (isCompact_sphere (0 : V) 1) + let Q := {z : T × S // H z.1 z.2.val} + let Z := {z : T × V // H z.1 z.2 ∧ L z.1 z.2 = 1} + have hn (z : Q) : L z.val.1 z.val.2.val ≠ 0 := by + intro h + have he := hno _ _ z.property h + have hh := z.val.2.property + simp [S, he] at hh + let q : Q → Z := fun z => ⟨(z.val.1,(L z.val.1 z.val.2.val)⁻¹ • z.val.2.val), + hsmul _ _ _ z.property, by simp [map_smul, hn z]⟩ + have hq : Continuous q := by + have hval : Continuous (fun z : Q => (z.val.1,z.val.2.val) : Q → T × V) := by fun_prop + apply Continuous.subtype_mk + exact (continuous_fst.comp continuous_subtype_val).prodMk + (((hL.comp hval).inv₀ hn).smul (continuous_subtype_val.comp + (continuous_snd.comp continuous_subtype_val))) + have hsurj : Function.Surjective q := by + intro z + have hz : z.val.2 ≠ 0 := by + intro he + have hh := z.property.2 + simp [he] at hh + have hc : (‖z.val.2‖ : ℂ) ≠ 0 := by simpa using (norm_ne_zero_iff.mpr hz) + let y : S := ⟨(‖z.val.2‖ : ℂ)⁻¹ • z.val.2, by + simp only [S, Metric.mem_sphere, dist_zero_right, norm_smul, norm_inv, + Complex.norm_real, Real.norm_eq_abs, abs_norm] + exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr hz)⟩ + refine ⟨⟨(z.val.1,y), hsmul _ _ _ z.property.1⟩, ?_⟩ + apply Subtype.ext + refine Prod.ext rfl ?_ + change (L z.val.1 ((‖z.val.2‖ : ℂ)⁻¹ • z.val.2))⁻¹ • + ((‖z.val.2‖ : ℂ)⁻¹ • z.val.2) = z.val.2 + simp [map_smul, z.property.2, smul_smul, hc] + have hclosed : IsClosed {z : T × S | H z.1 z.2.val} := + hH.preimage (show Continuous (fun z : T × S => (z.1,z.2.val)) by fun_prop) + have hp : IsProperMap (fun z : Q => z.val.1) := + isProperMap_fst_of_compactSpace.comp hclosed.isProperMap_subtypeVal + exact isProperMap_of_comp_of_surj hq (by fun_prop) hp hsurj + +end PermanentBorder.Polar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/RowIdeals.lean b/lean/OAI/Algebra/Determinantal/RowIdeals.lean new file mode 100644 index 0000000000000000000000000000000000000000..c849d538d53430080658ec1810f8cf4bc61e51e1 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/RowIdeals.lean @@ -0,0 +1,441 @@ +import OAI.Algebra.Determinantal.AdjugateNormalForm + +namespace OAI + +namespace PermanentBorder.AdjugateAlgebra +open Matrix Polynomial +section RowNormalForm +variable {R ι : Type*} [CommRing R] [Fintype ι] [DecidableEq ι] + +def rowMultiplier (v : ι → R) : Matrix ι ι R := fun i _ => v i + +noncomputable def rowPair (A : Matrix ι ι R) (v : ι → R) : R[X] := + adjTrace A (rowMultiplier v) + +noncomputable def rowEntry (A : Matrix ι ι R) (i : ι) : R[X] := + ∑ j, (pencilMatrix A).adjugate j i + +noncomputable def rowIdeal (A : Matrix ι ι R) : Ideal R[X] := + Ideal.span (Set.range (rowEntry A)) + +theorem rowPair_eq_sum (A : Matrix ι ι R) (v : ι → R) : + rowPair A v = ∑ i, C (v i) * rowEntry A i := by + simp only [rowPair, adjTrace, Matrix.trace, Matrix.diag_apply, Matrix.mul_apply, + Matrix.map_apply, rowMultiplier, rowEntry, Finset.mul_sum] + +theorem rowPair_add (A : Matrix ι ι R) (v w : ι → R) : + rowPair A (v+w) = rowPair A v + rowPair A w := by + exact adjTrace_add _ _ _ + +theorem rowPair_smul (A : Matrix ι ι R) (a : R) (v : ι → R) : + rowPair A (a • v) = C a * rowPair A v := by + exact adjTrace_smul _ _ _ + +theorem rowPair_zero (A : Matrix ι ι R) : rowPair A 0 = 0 := adjTrace_zero _ + +theorem adjTrace_mul_comm (A Y : Matrix ι ι R) : + adjTrace A (Y*A) = adjTrace A (A*Y) := by + have h := trace_commutator_adjugate_scalar (A.map C) (Y.map C) (X : R[X]) + simp only [sub_mul, Matrix.trace_sub, ← Matrix.map_mul] at h + exact (sub_eq_zero.mp h).symm + +theorem X_mul_rowPair (A : Matrix ι ι R) (v : ι → R) : + X * rowPair A v = rowPair A (-(A.mulVec v)) + + C (∑ i, v i) * (pencilMatrix A).det := by + rw [rowPair, X_mul_adjTrace, adjTrace_neg, adjTrace_mul_comm] + have h : A * rowMultiplier v = rowMultiplier (A.mulVec v) := by + ext i j + rfl + rw [h] + change -adjTrace A (rowMultiplier (A.mulVec v)) + _ = _ + rw [← adjTrace_neg] + rfl + +def HasRowNormalForm (A : Matrix ι ι R) (P : R[X]) : Prop := + ∃ v : ι → R, ∃ H : R[X], P = rowPair A v + H * (pencilMatrix A).det + +namespace HasRowNormalForm +variable {A : Matrix ι ι R} {P Q : R[X]} +theorem zero : HasRowNormalForm A 0 := ⟨0, 0, by simp [rowPair_zero]⟩ +theorem add (hP : HasRowNormalForm A P) (hQ : HasRowNormalForm A Q) : + HasRowNormalForm A (P+Q) := by + obtain ⟨v,H,rfl⟩ := hP + obtain ⟨w,J,rfl⟩ := hQ + exact ⟨v+w,H+J, by rw [rowPair_add]; ring⟩ +theorem C_mul (hP : HasRowNormalForm A P) (a : R) : + HasRowNormalForm A (C a * P) := by + obtain ⟨v,H,rfl⟩ := hP + exact ⟨a • v,C a * H, by rw [rowPair_smul]; ring⟩ +theorem X_mul (hP : HasRowNormalForm A P) : HasRowNormalForm A (X*P) := by + obtain ⟨v,H,rfl⟩ := hP + refine ⟨-(A.mulVec v),C (∑ i, v i) + X*H, ?_⟩ + rw [mul_add, X_mul_rowPair] + ring +theorem mul (hP : HasRowNormalForm A P) (f : R[X]) : HasRowNormalForm A (f*P) := by + induction f using Polynomial.induction_on' with + | add f g hf hg => simpa only [add_mul] using hf.add hg + | monomial n a => + rw [← C_mul_X_pow_eq_monomial, mul_assoc] + apply HasRowNormalForm.C_mul + induction n with + | zero => simpa using hP + | succ n ih => simpa only [pow_succ', mul_assoc] using ih.X_mul +end HasRowNormalForm + +theorem normalForm_of_mem_rowIdeal (A : Matrix ι ι R) (P : R[X]) + (hP : P ∈ rowIdeal A) : HasRowNormalForm A P := by + let J : Ideal R[X] := + { carrier := {P | HasRowNormalForm A P} + zero_mem' := HasRowNormalForm.zero + add_mem' := fun h h' => h.add h' + smul_mem' := fun f _ h => h.mul f } + have hle : rowIdeal A ≤ J := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change HasRowNormalForm A (rowEntry A i) + refine ⟨Pi.single i 1,0, ?_⟩ + simp [rowPair_eq_sum, Pi.single_apply] + exact hle hP +end RowNormalForm + +section RowDegree +variable {K : Type*} [Field K] {k : ℕ} + +theorem rowPair_degree_le (A : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) + (v : Fin (k+1) → K[X]) : (rowPair A v).natDegree ≤ k := + natDegree_adjTrace_le _ _ + +theorem exists_row_multiplier (A : Matrix (Fin (k+1)) (Fin (k+1)) K[X]) + (P : K[X][X]) (hP : P ∈ rowIdeal A) (hdeg : P.natDegree ≤ k) : + ∃ v : Fin (k+1) → K[X], P = rowPair A v := by + obtain ⟨v,H,h⟩ := normalForm_of_mem_rowIdeal A P hP + have hH : H = 0 := by + by_contra hn + have hF : (pencilMatrix A).det ≠ 0 := by + intro hz + have := natDegree_det_pencilMatrix A + simp only [hz, natDegree_zero] at this + omega + have hd : (H*(pencilMatrix A).det).natDegree ≤ k := by + have he : H*(pencilMatrix A).det = P - rowPair A v := by rw [h]; ring + rw [he] + exact (natDegree_sub_le _ _).trans (max_le hdeg (rowPair_degree_le A v)) + rw [natDegree_mul hn hF, natDegree_det_pencilMatrix] at hd + omega + exact ⟨v, by simpa only [hH,zero_mul,add_zero] using h⟩ + +theorem row_multiplier_is_constant (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (v : Fin (k+1) → K[X]) (d : ℕ) + (hv : ∀ i, (v i).natDegree ≤ d) + (hdeg : (scaleHom (rowPair (pencilBase θ A) v)).natDegree ≤ k) : + ∀ i, v i = C ((v i).coeff 0) := by + have hs : (scaledTrace θ A (rowMultiplier v)).natDegree ≤ k := by + simpa only [rowPair, scaleHom_adjTrace] using hdeg + induction d with + | zero => + intro i + have he := eq_C_of_natDegree_eq_zero (Nat.eq_zero_of_le_zero (hv i)) + simpa using he + | succ d ih => + apply ih + intro i + apply natDegree_le_iff_coeff_eq_zero.mpr + intro n hn + by_cases he : n = d+1 + · subst n + exact diagonal_top_zero θ hθ A (rowMultiplier v) (d+1) (by omega) + (fun i _ => hv i) hs i + · exact coeff_eq_zero_of_natDegree_lt ((hv i).trans_lt (by omega)) + +theorem exists_constant_row_multiplier (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (P : K[X][X]) + (hP : P ∈ rowIdeal (pencilBase θ A)) (ho : P.natDegree ≤ k) + (ht : (scaleHom P).natDegree ≤ k) : + ∃ v : Fin (k+1) → K, P = rowPair (pencilBase θ A) (fun i => C (v i)) := by + obtain ⟨v,hv⟩ := exists_row_multiplier _ P hP ho + obtain ⟨d,hd⟩ := (Set.finite_range (fun i => (v i).natDegree)).bddAbove + have hc := row_multiplier_is_constant θ hθ A v d (fun i => hd ⟨i,rfl⟩) (hv ▸ ht) + exact ⟨fun i => (v i).coeff 0, hv.trans (by congr 1; funext i; exact hc i)⟩ +end RowDegree +end PermanentBorder.AdjugateAlgebra + +namespace PermanentBorder.AdjugateAlgebra +open Matrix Polynomial +section RowLength +variable {K : Type*} [Field K] {k : ℕ} +noncomputable def rowContraction (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (v : Fin (k+1) → K) : K[X][X] := + rowPair (pencilBase θ A) (fun i => C (v i)) + +theorem rowContraction_mem (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (v : Fin (k+1) → K) : + rowContraction θ A v ∈ rowIdeal (pencilBase θ A) := by + rw [rowContraction, rowPair_eq_sum] + apply Ideal.sum_mem + intro i _ + exact Ideal.mul_mem_left _ _ (Ideal.subset_span ⟨i,rfl⟩) + +theorem totalDegreeLE_rowEntry (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (i : Fin (k+1)) : + TotalDegreeLE (rowEntry (pencilBase θ A) i) k := by + exact TotalDegreeLE.sum _ _ (fun j _ => totalDegreeLE_cofactor θ A j i) + +theorem totalDegreeLE_rowContraction (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (v : Fin (k+1) → K) : + TotalDegreeLE (rowContraction θ A v) k := by + rw [rowContraction, rowPair_eq_sum] + apply TotalDegreeLE.sum + intro i _ + simpa only [zero_add, monomial_zero_left] using + (totalDegreeLE_monomial 0 0 (v i)).mul (totalDegreeLE_rowEntry θ A i) + +theorem rowContraction_top (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (v : Fin (k+1) → K) : + (scaleHom (rowContraction θ A v)).coeff k = slopeTrace θ v := by + have ht := coeff_scaledTrace_top θ A (rowMultiplier (fun i => C (v i))) 0 + (fun _ _ => by simp [rowMultiplier]) + simp only [zero_add] at ht + rw [rowContraction, rowPair, scaleHom_adjTrace, ht] + simp [slopeTrace, spectralSlope, Matrix.adjugate_diagonal, Matrix.trace, + Matrix.diag_apply, Matrix.mul_diagonal, Matrix.map_apply, rowMultiplier] + +theorem exists_rowContraction_top (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (a : ℕ) (ha : a ≤ k) : + ∃ v : Fin (k+1) → K, + (scaleHom (rowContraction θ A v)).coeff k = monomial a 1 := by + obtain ⟨v,hv⟩ := exists_diagonalContraction_top θ hθ A a ha + refine ⟨v, ?_⟩ + rw [rowContraction_top] + have ht := coeff_scaledTrace_top θ A ((Matrix.diagonal v).map C) 0 (by simp) + simp only [zero_add] at ht + rw [diagonalContraction, scaleHom_adjTrace, ht] at hv + convert hv using 1 + simp [slopeTrace] + +theorem exists_lower_row_representative + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) + (a b : ℕ) (hab : a+b = k) : + ∃ R : K[X][X], TotalDegreeLE R (k-1) ∧ + monomial a (monomial b 1) - R ∈ rowIdeal (pencilBase θ A) := by + obtain ⟨v,hv⟩ := exists_rowContraction_top θ hθ A a (by omega) + let R := monomial a (monomial b (1 : K)) - rowContraction θ A v + refine ⟨R, ?_, ?_⟩ + · apply TotalDegreeLE.pred_of_top_zero hk + · exact ((totalDegreeLE_monomial a b (1 : K)).mono hab.le).sub + (totalDegreeLE_rowContraction θ A v) + · simp only [R, map_sub, coeff_sub, scaleHom_monomial_monomial, hab, + coeff_monomial_same, hv, sub_self] + · simpa only [R, sub_sub_cancel] using rowContraction_mem θ A v + +theorem rowIdeal_low_degree_zero (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) + {P : K[X][X]} (hP : P ∈ rowIdeal (pencilBase θ A)) + (hd : TotalDegreeLE P (k-1)) : P = 0 := by + obtain ⟨v,hv⟩ := exists_constant_row_multiplier θ hθ A P hP + (hd.outer.trans (by omega)) + (hd.scaled.trans (by omega)) + change P = rowContraction θ A v at hv + have ht : slopeTrace θ v = 0 := by + rw [← rowContraction_top θ A v, ← hv] + exact coeff_eq_zero_of_natDegree_lt + (hd.scaled.trans_lt (by omega)) + have hv0 := diagonal_zero_of_trace_slope θ hθ (Matrix.diagonal v) ht + have he : v = 0 := funext fun i => by simpa using hv0 i + rw [hv, he] + change rowPair (pencilBase θ A) (fun i => C ((0 : Fin (k+1) → K) i)) = 0 + convert rowPair_zero (pencilBase θ A) using 1 + congr 1 + funext i + exact map_zero C + +theorem row_quotient_spanned + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + Submodule.span K (Set.range (fun i : PlaneIndex (k-1) => + (Ideal.Quotient.mkₐ K (rowIdeal (pencilBase θ A))) + (monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1)))) = ⊤ := by + classical + let I := rowIdeal (pencilBase θ A) + let f := (Ideal.Quotient.mkₐ K I).toLinearMap + let W := Submodule.span K (Set.range (fun i : PlaneIndex (k-1) => + f (monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1)))) + have hmon : ∀ d a b : ℕ, a+b = d → ∀ c : K, f (monomial a (monomial b c)) ∈ W := by + intro d + induction d using Nat.strong_induction_on with + | h d ih => + intro a b hab c + have hscalar : monomial a (monomial b c) = c • monomial a (monomial b (1 : K)) := by + simp only [smul_monomial, smul_eq_mul, mul_one] + rw [hscalar, map_smul] + apply W.smul_mem + by_cases hd : d < k + · let i : PlaneIndex (k-1) := ⟨(⟨a, by omega⟩, ⟨a+b+1, by omega⟩), by + change a < a+b+1 + omega⟩ + apply Submodule.subset_span + refine ⟨i, ?_⟩ + change f (monomial a (monomial (a+b+1-a-1) (1 : K))) = _ + rw [show a+b+1-a-1 = b by omega] + · let α := min a k + let β := k-α + have hα : α ≤ a := Nat.min_le_left _ _ + have hβ : β ≤ b := by dsimp [β, α]; omega + have hsum : α+β = k := by dsimp [β, α]; omega + obtain ⟨R, hR, hmem⟩ := exists_lower_row_representative θ hθ A hk α β hsum + let Q : K[X][X] := monomial (a-α) (monomial (b-β) 1) + have heq : f (monomial a (monomial b 1)) = f (Q*R) := by + apply sub_eq_zero.mp + rw [← map_sub] + apply Ideal.Quotient.eq_zero_iff_mem.mpr + have hh := I.mul_mem_left Q hmem + convert hh using 1 + rw [mul_sub] + congr 1 + simp only [Q, monomial_mul_monomial, one_mul] + rw [Nat.sub_add_cancel hα, Nat.sub_add_cancel hβ] + rw [heq] + apply map_mem_of_monomials f W (Q*R) + intro u v huv + have hde : TotalDegreeLE (Q*R) ((a-α)+(b-β)+(k-1)) := + (totalDegreeLE_monomial (a-α) (b-β) (1 : K)).mul hR + have hle : u+v ≤ (a-α)+(b-β)+(k-1) := by + by_contra hn + exact huv (hde u v (by omega)) + exact ih (u+v) (by omega) u v rfl _ + apply top_unique + intro x _ + obtain ⟨P, rfl⟩ := Ideal.Quotient.mk_surjective x + apply map_mem_of_monomials f W P + intro a b _ + exact hmon (a+b) a b rfl _ + +theorem finite_row_quotient + (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + Module.Finite K (K[X][X] ⧸ rowIdeal (pencilBase θ A)) := by + classical + let g := fun i : PlaneIndex (k-1) => + (Ideal.Quotient.mkₐ K (rowIdeal (pencilBase θ A))) + (monomial i.val.1.val (monomial (i.val.2.val-i.val.1.val-1) 1)) + have hg := row_quotient_spanned θ hθ A hk + change Submodule.span K (Set.range g) = ⊤ at hg + exact Module.Finite.of_fg_top (Submodule.fg_def.mpr ⟨Set.range g, Set.finite_range g, hg⟩) + +theorem row_quotient_finrank (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) : + Module.finrank K (K[X][X] ⧸ rowIdeal (pencilBase θ A)) = (k+1).choose 2 := by + classical + let I := rowIdeal (pencilBase θ A) + let f : (PlaneIndex (k-1) → K) →ₗ[K] (K[X][X] ⧸ I) := + (Ideal.Quotient.mkₐ K I).toLinearMap.comp (planeMap (k-1)) + have hf : Function.Injective f := by + apply LinearMap.ker_eq_bot.mp + apply LinearMap.ker_eq_bot'.mpr + intro v hv + have hmem : planeMap (k-1) v ∈ I := Ideal.Quotient.eq_zero_iff_mem.mp hv + have hz := rowIdeal_low_degree_zero θ hθ A hk hmem (totalDegreeLE_planeMap (k-1) v) + funext i + have hc := congrArg (fun p : K[X][X] => (p.coeff i.val.1.val).coeff + (i.val.2.val-i.val.1.val-1)) hz + simpa only [coeff_planeMap, coeff_zero, Pi.zero_apply] using hc + have := finite_row_quotient θ hθ A hk + apply le_antisymm + · have h := finrank_le_of_span_eq_top (row_quotient_spanned θ hθ A hk) + simpa only [card_planeIndex, show k-1+2 = k+1 by omega] using h + · have h := LinearMap.finrank_le_finrank_of_injective hf + rw [Module.finrank_fintype_fun_eq_card, card_planeIndex] at h + simpa only [show k-1+2 = k+1 by omega] using h +end RowLength +end PermanentBorder.AdjugateAlgebra + +namespace PermanentBorder.AdjugateAlgebra +open Matrix Polynomial +section RowRecovery +variable {K : Type*} [Field K] {k : ℕ} + +theorem rowContraction_single (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (i : Fin (k+1)) : + rowContraction θ A (Pi.single i 1) = rowEntry (pencilBase θ A) i := by + classical + simp [rowContraction, rowPair_eq_sum, Pi.single_apply] + +theorem rowEntry_top (θ : Fin (k+1) → K) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (i : Fin (k+1)) : + (scaleHom (rowEntry (pencilBase θ A) i)).coeff k = + slopeTrace θ (Pi.single i 1) := by + rw [← rowContraction_single, rowContraction_top] + +theorem rowEntry_eq_of_rowIdeal_eq (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A B : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) + (hI : rowIdeal (pencilBase θ A) = rowIdeal (pencilBase θ B)) : + rowEntry (pencilBase θ A) = rowEntry (pencilBase θ B) := by + funext i + apply sub_eq_zero.mp + apply rowIdeal_low_degree_zero θ hθ A hk + · apply Ideal.sub_mem + · exact Ideal.subset_span ⟨i,rfl⟩ + · rw [hI] + exact Ideal.subset_span ⟨i,rfl⟩ + · apply TotalDegreeLE.pred_of_top_zero hk + · exact (totalDegreeLE_rowEntry θ A i).sub (totalDegreeLE_rowEntry θ B i) + · rw [map_sub, coeff_sub, rowEntry_top, rowEntry_top, sub_self] + +theorem rowContraction_eq_zero_iff (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A : Matrix (Fin (k+1)) (Fin (k+1)) K) (v : Fin (k+1) → K) : + rowContraction θ A v = 0 ↔ v = 0 := by + constructor + · intro h + have ht : slopeTrace θ v = 0 := by rw [← rowContraction_top θ A v, h, map_zero, coeff_zero] + have hv := diagonal_zero_of_trace_slope θ hθ (Matrix.diagonal v) ht + funext i + simpa using hv i + · rintro rfl + unfold rowContraction + have h : (fun i => C ((0 : Fin (k+1) → K) i)) = (0 : Fin (k+1) → K[X]) := by + funext i + exact map_zero C + rw [h, rowPair_zero] + +theorem rowPair_sub {R ι : Type*} [CommRing R] [Fintype ι] [DecidableEq ι] + (A : Matrix ι ι R) (v w : ι → R) : + rowPair A (v-w) = rowPair A v - rowPair A w := by + simp only [rowPair_eq_sum, Pi.sub_apply, map_sub, sub_mul, Finset.sum_sub_distrib] + +theorem rowPair_neg {R ι : Type*} [CommRing R] [Fintype ι] [DecidableEq ι] + (A : Matrix ι ι R) (v : ι → R) : rowPair A (-v) = -rowPair A v := by + simp only [rowPair_eq_sum, Pi.neg_apply, map_neg, neg_mul, Finset.sum_neg_distrib] + +theorem matrix_eq_of_rowIdeal_eq (θ : Fin (k+1) → K) (hθ : Function.Injective θ) + (A B : Matrix (Fin (k+1)) (Fin (k+1)) K) (hk : 0 < k) + (hI : rowIdeal (pencilBase θ A) = rowIdeal (pencilBase θ B)) + (hF : (pencilMatrix (pencilBase θ A)).det = (pencilMatrix (pencilBase θ B)).det) : + A = B := by + classical + have hE := rowEntry_eq_of_rowIdeal_eq θ hθ A B hk hI + have hpair (v : Fin (k+1) → K[X]) : + rowPair (pencilBase θ A) v = rowPair (pencilBase θ B) v := by + simp only [rowPair_eq_sum, hE] + have hz (j : Fin (k+1)) : rowContraction θ A (fun i => A i j - B i j) = 0 := by + let v : Fin (k+1) → K[X] := Pi.single j 1 + have ha := X_mul_rowPair (pencilBase θ A) v + have hb := X_mul_rowPair (pencilBase θ B) v + rw [hpair v, hF, hb, rowPair_neg, rowPair_neg, ← hpair] at ha + have hr : rowPair (pencilBase θ A) ((pencilBase θ A).mulVec v) = + rowPair (pencilBase θ A) ((pencilBase θ B).mulVec v) := by + linear_combination ha + have hh := sub_eq_zero.mpr hr + rw [← rowPair_sub] at hh + convert hh using 1 + unfold rowContraction + congr 1 + funext i + simp [v, pencilBase, + Matrix.add_apply, Matrix.smul_apply, Matrix.map_apply, sub_eq_add_neg] + ring + ext i j + exact sub_eq_zero.mp (congrFun ((rowContraction_eq_zero_iff θ hθ A _).mp (hz j)) i) +end RowRecovery +end PermanentBorder.AdjugateAlgebra + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/SchurDifferentials.lean b/lean/OAI/Algebra/Determinantal/SchurDifferentials.lean new file mode 100644 index 0000000000000000000000000000000000000000..89cdbf7bf4de0ddfff536c317d313af817a1bd39 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/SchurDifferentials.lean @@ -0,0 +1,412 @@ +import OAI.Algebra.Determinantal.KernelCharts + +namespace OAI + +namespace PermanentBorder.PolarAnalysis.Schur +open Matrix Filter +open scoped Matrix Topology +variable {ι : Type*} [Fintype ι] [DecidableEq ι] +variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℂ V] + + theorem differentiableAt_right {γ : V → ι → ℂ} {E : V → Matrix ι ι ℂ} {x : V} + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) (i : ι) : + DifferentiableAt ℂ (fun y => right (γ y) (E y) i) x := by + simp only [right, Pi.neg_apply, mulVec, dotProduct] + exact (DifferentiableAt.fun_sum (fun j _ => + (differentiableAt_inverse hE hx i j).mul (hγ j))).neg + + theorem differentiableAt_left {β : V → ι → ℂ} {E : V → Matrix ι ι ℂ} {x : V} + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) (i : ι) : + DifferentiableAt ℂ (fun y => left (β y) (E y) i) x := by + simp only [left, Pi.neg_apply, vecMul, dotProduct] + exact (DifferentiableAt.fun_sum (fun j _ => + (hβ j).mul (differentiableAt_inverse hE hx j i))).neg + + theorem differentiableAt_scalar {a : V → ℂ} {β γ : V → ι → ℂ} + {E : V → Matrix ι ι ℂ} {x : V} + (ha : DifferentiableAt ℂ a x) + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) : + DifferentiableAt ℂ (fun y => scalar (a y) (β y) (γ y) (E y)) x := by + simp only [scalar, mulVec, dotProduct] + exact ha.sub (DifferentiableAt.fun_sum (fun j _ => (hβ j).mul + (DifferentiableAt.fun_sum (fun l _ => (differentiableAt_inverse hE hx j l).mul (hγ l))))) + +omit [Fintype ι] [DecidableEq ι] in + theorem differential_mulVec {κ : Type*} [Fintype κ] + {A : V → Matrix ι κ ℂ} {p : V → κ → ℂ} {x : V} + (hA : ∀ i j, DifferentiableAt ℂ (fun y => A y i j) x) + (hp : ∀ i, DifferentiableAt ℂ (fun y => p y i) x) (h : V) (i : ι) : + fderiv ℂ (fun y => (A y *ᵥ p y) i) x h = + ((Matrix.of fun i j => fderiv ℂ (fun y => A y i j) x h) *ᵥ p x) i + + (A x *ᵥ (fun j => fderiv ℂ (fun y => p y j) x h)) i := by + have hd := HasFDerivAt.fun_sum (u := Finset.univ) (fun j _ => + (hA i j).hasFDerivAt.mul (hp j).hasFDerivAt) + have heq : fderiv ℂ (fun y => (A y *ᵥ p y) i) x = + ∑ j, ((A x i j) • fderiv ℂ (fun y => p y j) x + + (p x j) • fderiv ℂ (fun y => A y i j) x) := by + convert! hd.fderiv using 1 + rw [heq] + simp only [_root_.sum_apply, _root_.add_apply, + _root_.smul_apply, smul_eq_mul, mulVec, dotProduct, + Finset.sum_add_distrib, Matrix.of_apply] + rw [add_comm] + congr 1 + apply Finset.sum_congr rfl + intro j _ + ring + + theorem differential_scalar {a : V → ℂ} {β γ : V → ι → ℂ} + {E : V → Matrix ι ι ℂ} {x : V} + (ha : DifferentiableAt ℂ a x) + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) (h : V) : + fderiv ℂ (fun y => scalar (a y) (β y) (γ y) (E y)) x h = + normalized (left (β x) (E x)) ⬝ᵥ + ((Matrix.of fun i j => fderiv ℂ (fun y => block (a y) (β y) (γ y) (E y) i j) x h) + *ᵥ normalized (right (γ x) (E x))) := by + let A := fun y => block (a y) (β y) (γ y) (E y) + let p := fun y => normalized (right (γ y) (E y)) + let b := normalized (left (β x) (E x)) + let S := fun y => scalar (a y) (β y) (γ y) (E y) + have hA : ∀ i j, DifferentiableAt ℂ (fun y => A y i j) x := by + intro i j + cases i <;> cases j <;> simp only [A, block, fromBlocks_apply₁₁, fromBlocks_apply₁₂, + fromBlocks_apply₂₁, fromBlocks_apply₂₂, Matrix.of_apply] + · exact ha + · exact hβ _ + · exact hγ _ + · exact hE _ _ + have hp : ∀ i, DifferentiableAt ℂ (fun y => p y i) x := by + intro i + cases i with + | inl u => exact differentiableAt_const _ + | inr i => exact differentiableAt_right hγ hE hx i + have hevent : ∀ᶠ y in 𝓝 x, (E y).det ≠ 0 := + (differentiableAt_det hE).continuousAt.eventually_ne hx + have heq (i : Unit ⊕ ι) : + (fun y => (A y *ᵥ p y) i) =ᶠ[𝓝 x] (fun y => Sum.elim (fun _ => S y) (fun _ => 0) i) := by + filter_upwards [hevent] with y hy + exact congr_fun (solved_right (a y) (β y) (γ y) (E y) hy) i + let dA : Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ := + Matrix.of fun i j => fderiv ℂ (fun y => A y i j) x h + let dp : Unit ⊕ ι → ℂ := fun j => fderiv ℂ (fun y => p y j) x h + have hd : dA *ᵥ p x + A x *ᵥ dp = + Sum.elim (fun _ => fderiv ℂ S x h) (fun _ => 0) := by + ext i + change (dA *ᵥ p x) i + (A x *ᵥ dp) i = _ + rw [← differential_mulVec hA hp h i] + rw [(heq i).fderiv_eq] + cases i <;> simp + have hb : b ᵥ* A x = Sum.elim (fun _ => S x) (fun _ => 0) := + solved_left (a x) (β x) (γ x) (E x) hx + have hz : b ⬝ᵥ (A x *ᵥ dp) = 0 := by + rw [dotProduct_mulVec, hb] + simp [dotProduct, dp, p, normalized, Fintype.sum_sum_type] + have hd' := congrArg (fun z => b ⬝ᵥ z) hd + rw [dotProduct_add, hz, add_zero] at hd' + change fderiv ℂ S x h = b ⬝ᵥ (dA *ᵥ p x) + simpa [dotProduct, b, normalized, Fintype.sum_sum_type] using hd'.symm +end PermanentBorder.PolarAnalysis.Schur + +namespace PermanentBorder.PolarAnalysis.Schur +open Matrix Filter +open scoped Matrix Topology +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +noncomputable def auxiliaryLinear (E : Matrix ι ι ℂ) : + ((ι → ℂ) × (ι → ℂ)) →L[ℂ] ((ι → ℂ) × (ι → ℂ)) := + ((E.mulVecLin.toContinuousLinearMap).comp (ContinuousLinearMap.fst ℂ _ _)).prod + ((E.vecMulLinear.toContinuousLinearMap).comp (ContinuousLinearMap.snd ℂ _ _)) + +omit [DecidableEq ι] in +@[simp] theorem auxiliaryLinear_apply (E : Matrix ι ι ℂ) (w : (ι → ℂ) × (ι → ℂ)) : + auxiliaryLinear E w = (E *ᵥ w.1, w.2 ᵥ* E) := rfl + + theorem auxiliaryLinear_invertible (E : Matrix ι ι ℂ) (hE : E.det ≠ 0) : + (auxiliaryLinear E).IsInvertible := by + have hu := isUnit_iff_ne_zero.mpr hE + apply ContinuousLinearMap.IsInvertible.of_inverse (g := auxiliaryLinear E⁻¹) + · apply ContinuousLinearMap.ext + intro w + apply Prod.ext <;> simp [mulVec_mulVec, vecMul_vecMul, mul_nonsing_inv E hu, + nonsing_inv_mul E hu] + · apply ContinuousLinearMap.ext + intro w + apply Prod.ext <;> simp [mulVec_mulVec, vecMul_vecMul, mul_nonsing_inv E hu, + nonsing_inv_mul E hu] + +variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℂ V] + +noncomputable def auxiliary (β γ : V → ι → ℂ) (E : V → Matrix ι ι ℂ) + (z : V × ((ι → ℂ) × (ι → ℂ))) : ((ι → ℂ) × (ι → ℂ)) := + (γ z.1 + E z.1 *ᵥ z.2.1, β z.1 + z.2.2 ᵥ* E z.1) + +noncomputable def graphKernels (β γ : V → ι → ℂ) (E : V → Matrix ι ι ℂ) + (x : V) : ((ι → ℂ) × (ι → ℂ)) := + (right (γ x) (E x), left (β x) (E x)) + +omit [NormedAddCommGroup V] [NormedSpace ℂ V] in + theorem auxiliary_solved (β γ : V → ι → ℂ) (E : V → Matrix ι ι ℂ) + (x : V) (hx : (E x).det ≠ 0) : + auxiliary β γ E (x,graphKernels β γ E x) = 0 := by + have hu := isUnit_iff_ne_zero.mpr hx + apply Prod.ext <;> simp [auxiliary, graphKernels, right, left, mulVec_neg, neg_vecMul, + mulVec_mulVec, vecMul_vecMul, mul_nonsing_inv (E x) hu, nonsing_inv_mul (E x) hu] + + theorem differentiableAt_graphKernels {β γ : V → ι → ℂ} {E : V → Matrix ι ι ℂ} {x : V} + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) : DifferentiableAt ℂ (graphKernels β γ E) x := by + apply DifferentiableAt.prodMk + · exact differentiableAt_pi.mpr (differentiableAt_right hγ hE hx) + · exact differentiableAt_pi.mpr (differentiableAt_left hβ hE hx) + +omit [DecidableEq ι] in + theorem differentiableAt_auxiliary {β γ : V → ι → ℂ} {E : V → Matrix ι ι ℂ} + {x : V} {w : (ι → ℂ) × (ι → ℂ)} + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) : + DifferentiableAt ℂ (auxiliary β γ E) (x,w) := by + apply DifferentiableAt.prodMk + · apply differentiableAt_pi.mpr + intro i + change DifferentiableAt ℂ (fun z => γ z.1 i + ∑ j, E z.1 i j * z.2.1 j) (x,w) + apply DifferentiableAt.add ((hγ i).comp (x,w) (ContinuousLinearMap.fst ℂ V ((ι → ℂ) × (ι → ℂ))).differentiableAt) + apply DifferentiableAt.fun_sum + intro j _ + apply DifferentiableAt.mul ((hE i j).comp (x,w) (ContinuousLinearMap.fst ℂ V ((ι → ℂ) × (ι → ℂ))).differentiableAt) + fun_prop + · apply differentiableAt_pi.mpr + intro j + change DifferentiableAt ℂ (fun z => β z.1 j + ∑ i, z.2.2 i * E z.1 i j) (x,w) + apply DifferentiableAt.add ((hβ j).comp (x,w) (ContinuousLinearMap.fst ℂ V ((ι → ℂ) × (ι → ℂ))).differentiableAt) + apply DifferentiableAt.fun_sum + intro i _ + apply DifferentiableAt.mul _ ((hE i j).comp (x,w) (ContinuousLinearMap.fst ℂ V ((ι → ℂ) × (ι → ℂ))).differentiableAt) + fun_prop + +omit [DecidableEq ι] in + theorem fderiv_auxiliary_inr {β γ : V → ι → ℂ} {E : V → Matrix ι ι ℂ} + {x : V} {w : (ι → ℂ) × (ι → ℂ)} + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) : + fderiv ℂ (auxiliary β γ E) (x,w) ∘L ContinuousLinearMap.inr ℂ V _ = + auxiliaryLinear (E x) := by + have hd := (differentiableAt_auxiliary (w := w) hβ hγ hE).hasFDerivAt.comp w + ((hasFDerivAt_const x w).prodMk (hasFDerivAt_id w)) + have hf : HasFDerivAt (fun v => auxiliary β γ E (x,v)) (auxiliaryLinear (E x)) w := by + convert! (auxiliaryLinear (E x)).hasFDerivAt.const_add (γ x,β x) using 1 + convert! hd.unique hf using 1 + + theorem simple_kernel_elimination [FiniteDimensional ℂ V] + {β γ : V → ι → ℂ} {E : V → Matrix ι ι ℂ} {x : V} + {R : V × ((ι → ℂ) × (ι → ℂ)) → V} + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) + (hR : DifferentiableAt ℂ R (x,graphKernels β γ E x)) + (hs : (fderiv ℂ (fun y => R (y,graphKernels β γ E y)) x).IsInvertible) : + (fderiv ℂ (fun z => (R z,auxiliary β γ E z)) + (x,graphKernels β γ E x)).IsInvertible := by + apply PermanentBorder.PolarAnalysis.simple_after_elimination hR + (differentiableAt_auxiliary hβ hγ hE) (differentiableAt_graphKernels hβ hγ hE hx) + · have he := (differentiableAt_det hE).continuousAt.eventually_ne hx + filter_upwards [he] with y hy + exact auxiliary_solved β γ E y hy + · rw [fderiv_auxiliary_inr hβ hγ hE] + exact auxiliaryLinear_invertible _ hx + · exact hs +end PermanentBorder.PolarAnalysis.Schur + +namespace PermanentBorder.PolarAnalysis.Schur +open Matrix Filter +open scoped Matrix Topology +variable {ι : Type*} [Fintype ι] [DecidableEq ι] +variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℂ V] + + theorem differential_det_block {a : V → ℂ} {β γ : V → ι → ℂ} + {E : V → Matrix ι ι ℂ} {x : V} + (ha : DifferentiableAt ℂ a x) + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) x) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) x) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) x) + (hx : (E x).det ≠ 0) (h : V) : + fderiv ℂ (fun y => (block (a y) (β y) (γ y) (E y)).det) x h = + (E x).det * + (normalized (left (β x) (E x)) ⬝ᵥ + ((Matrix.of fun i j => fderiv ℂ (fun y => block (a y) (β y) (γ y) (E y) i j) x h) + *ᵥ normalized (right (γ x) (E x)))) + + fderiv ℂ (fun y => (E y).det) x h * scalar (a x) (β x) (γ x) (E x) := by + have hevent : ∀ᶠ y in 𝓝 x, (E y).det ≠ 0 := + (differentiableAt_det hE).continuousAt.eventually_ne hx + have heq : (fun y => (block (a y) (β y) (γ y) (E y)).det) =ᶠ[𝓝 x] + (fun y => (E y).det * scalar (a y) (β y) (γ y) (E y)) := by + filter_upwards [hevent] with y hy + exact det_block _ _ _ _ hy + rw [heq.fderiv_eq, fderiv_fun_mul (differentiableAt_det hE) + (differentiableAt_scalar ha hβ hγ hE hx)] + simp only [_root_.add_apply, _root_.smul_apply, smul_eq_mul] + rw [differential_scalar ha hβ hγ hE hx h] + ring + + theorem contDiff_det {E : V → Matrix ι ι ℂ} {n : WithTop ℕ∞} + (hE : ∀ i j, ContDiff ℂ n (fun y => E y i j)) : + ContDiff ℂ n (fun y => (E y).det) := by + classical + simp only [Matrix.det_apply] + fun_prop + + theorem contDiff_adjugate {E : V → Matrix ι ι ℂ} {n : WithTop ℕ∞} + (hE : ∀ i j, ContDiff ℂ n (fun y => E y i j)) (i j : ι) : + ContDiff ℂ n (fun y => (E y).adjugate i j) := by + simp only [Matrix.adjugate_apply] + apply contDiff_det + intro u v + by_cases hu : u = j + · subst u + simp only [Matrix.updateRow_self] + exact contDiff_const + · simpa only [Matrix.updateRow_ne hu] using hE u v + + theorem contDiffAt_inverse {E : V → Matrix ι ι ℂ} {n : WithTop ℕ∞} {x : V} + (hE : ∀ i j, ContDiff ℂ n (fun y => E y i j)) + (hx : (E x).det ≠ 0) (i j : ι) : + ContDiffAt ℂ n (fun y => (E y)⁻¹ i j) x := by + simp only [Matrix.inv_def, Ring.inverse_eq_inv, Matrix.smul_apply, smul_eq_mul] + exact ((contDiff_det hE).contDiffAt.inv hx).mul (contDiff_adjugate hE i j).contDiffAt + + theorem contDiffAt_scalar {a : V → ℂ} {β γ : V → ι → ℂ} + {E : V → Matrix ι ι ℂ} {n : WithTop ℕ∞} {x : V} + (ha : ContDiff ℂ n a) + (hβ : ∀ i, ContDiff ℂ n (fun y => β y i)) + (hγ : ∀ i, ContDiff ℂ n (fun y => γ y i)) + (hE : ∀ i j, ContDiff ℂ n (fun y => E y i j)) + (hx : (E x).det ≠ 0) : + ContDiffAt ℂ n (fun y => scalar (a y) (β y) (γ y) (E y)) x := by + simp only [scalar, mulVec, dotProduct] + exact ha.contDiffAt.sub (ContDiffAt.sum (fun j _ => (hβ j).contDiffAt.mul + (ContDiffAt.sum (fun l _ => (contDiffAt_inverse hE hx j l).mul (hγ l).contDiffAt)))) +end PermanentBorder.PolarAnalysis.Schur + +namespace PermanentBorder.PolarAnalysis +section Multiplier +variable {E F : Type*} + [NormedAddCommGroup E] [NormedSpace ℂ E] + [NormedAddCommGroup F] [NormedSpace ℂ F] + +theorem simple_unit_multiplier_iff {T : E → (F →L[ℂ] F)} {g : E → F} {x : E} + (hT : DifferentiableAt ℂ T x) (hg : DifferentiableAt ℂ g x) + (hz : g x = 0) (hu : (T x).IsInvertible) : + (fderiv ℂ (fun y => T y (g y)) x).IsInvertible ↔ (fderiv ℂ g x).IsInvertible := by + rw [fderiv_clm_apply hT hg, hz, map_zero, add_zero] + obtain ⟨e,he⟩ := hu + rw [← he] + exact ContinuousLinearMap.isInvertible_equiv_comp + +noncomputable def triangularMultiplier (c : ℂ) (d : F) : (ℂ × F) →L[ℂ] (ℂ × F) := + c • ContinuousLinearMap.id ℂ (ℂ × F) + + (ContinuousLinearMap.inr ℂ ℂ F).comp ((ContinuousLinearMap.fst ℂ ℂ F).smulRight d) + +@[simp] theorem triangularMultiplier_apply (c : ℂ) (d : F) (z : ℂ × F) : + triangularMultiplier c d z = (c * z.1, c • z.2 + z.1 • d) := by + apply Prod.ext <;> simp [triangularMultiplier] + + theorem triangularMultiplier_invertible (c : ℂ) (d : F) (hc : c ≠ 0) : + (triangularMultiplier c d).IsInvertible := by + apply ContinuousLinearMap.IsInvertible.of_inverse + (g := triangularMultiplier c⁻¹ (-((c⁻¹*c⁻¹) • d))) + · ext z <;> simp [smul_smul, hc] + · ext z <;> simp [smul_smul, hc] + + theorem differentiableAt_triangularMultiplier {c : E → ℂ} {d : E → F} {x : E} + (hc : DifferentiableAt ℂ c x) (hd : DifferentiableAt ℂ d x) : + DifferentiableAt ℂ (fun y => triangularMultiplier (c y) (d y)) x := by + apply DifferentiableAt.add (hc.smul_const _) ?_ + apply (differentiableAt_const (c := ContinuousLinearMap.inr ℂ ℂ F)).clm_comp + exact ((ContinuousLinearMap.smulRightL ℂ (ℂ × F) F + (ContinuousLinearMap.fst ℂ ℂ F)).differentiableAt.comp x hd) + +theorem simple_triangular_system_iff {c : E → ℂ} {d : E → F} + {s : E → ℂ} {g : E → F} {x : E} + (hc : DifferentiableAt ℂ c x) (hd : DifferentiableAt ℂ d x) + (hs : DifferentiableAt ℂ s x) (hg : DifferentiableAt ℂ g x) + (hcx : c x ≠ 0) (hsx : s x = 0) (hgx : g x = 0) : + (fderiv ℂ (fun y => (c y * s y, c y • g y + s y • d y)) x).IsInvertible ↔ + (fderiv ℂ (fun y => (s y,g y)) x).IsInvertible := by + simpa only [triangularMultiplier_apply] using + simple_unit_multiplier_iff (differentiableAt_triangularMultiplier hc hd) + (hs.prodMk hg) (by simp [hsx,hgx]) (triangularMultiplier_invertible _ _ hcx) +end Multiplier +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis +open Filter +open scoped Topology +variable {T V : Type*} [NormedAddCommGroup T] [NormedSpace ℂ T] + [NormedAddCommGroup V] [NormedSpace ℂ V] +variable {κ : Type*} [Fintype κ] + +noncomputable def polarPair (F : T → ℂ) (ψ : V → T) (h : κ → T) (x : V) : ℂ × (κ → ℂ) := + (F (ψ x), fun i => fderiv ℂ F (ψ x) (h i)) + + theorem differentiableAt_polarPair {F : T → ℂ} {ψ : V → T} {h : κ → T} {x : V} + (hF : ContDiffAt ℂ 2 F (ψ x)) (hψ : DifferentiableAt ℂ ψ x) : + DifferentiableAt ℂ (polarPair F ψ h) x := by + apply DifferentiableAt.prodMk + · exact (hF.differentiableAt (by norm_num)).comp x hψ + · apply differentiableAt_pi.mpr + intro i + have hd : DifferentiableAt ℂ (fderiv ℂ F) (ψ x) := + (hF.fderiv_right (m := 1) (by norm_num)).differentiableAt_one + exact (hd.clm_apply (differentiableAt_const (h i))).comp x hψ + + theorem simple_polarPair_unit {F c S : T → ℂ} {ψ : V → T} {h : κ → T} {x : V} + (hc : ContDiffAt ℂ 2 c (ψ x)) (hS : ContDiffAt ℂ 2 S (ψ x)) + (hψ : DifferentiableAt ℂ ψ x) + (hFS : F =ᶠ[𝓝 (ψ x)] (fun y => c y * S y)) (hcx : c (ψ x) ≠ 0) + (hz : polarPair F ψ h x = 0) + (hsimple : (fderiv ℂ (polarPair F ψ h) x).IsInvertible) : + polarPair S ψ h x = 0 ∧ (fderiv ℂ (polarPair S ψ h) x).IsInvertible := by + let U : V → ((ℂ × (κ → ℂ)) →L[ℂ] (ℂ × (κ → ℂ))) := + fun y => triangularMultiplier (c (ψ y)) (fun i => fderiv ℂ c (ψ y) (h i)) + have hg := differentiableAt_polarPair (h := h) hS hψ + have hU : DifferentiableAt ℂ U x := by + apply differentiableAt_triangularMultiplier + · exact (hc.differentiableAt (by norm_num)).comp x hψ + · exact (differentiableAt_polarPair (h := h) hc hψ).snd + have hu : (U x).IsInvertible := triangularMultiplier_invertible _ _ hcx + have he : polarPair F ψ h =ᶠ[𝓝 x] (fun y => U y (polarPair S ψ h y)) := by + have hlocal : ∀ᶠ z in 𝓝 (ψ x), + (F z,fun i => fderiv ℂ F z (h i)) = + triangularMultiplier (c z) (fun i => fderiv ℂ c z (h i)) + (S z,fun i => fderiv ℂ S z (h i)) := by + filter_upwards [hFS, hFS.fderiv (𝕜 := ℂ), hc.eventually (by norm_num), hS.eventually (by norm_num)] + with z h0 h1 hc' hS' + rw [h1, fderiv_fun_mul (hc'.differentiableAt (by norm_num)) + (hS'.differentiableAt (by norm_num)), triangularMultiplier_apply] + apply Prod.ext h0 + ext i + simp + exact hψ.continuousAt.eventually hlocal + have hsz : polarPair S ψ h x = 0 := by + apply hu.bijective.injective + rw [map_zero, ← he.eq_of_nhds, hz] + refine ⟨hsz, ?_⟩ + apply (simple_unit_multiplier_iff hU hg hsz hu).mp + rwa [← he.fderiv_eq] +end PermanentBorder.PolarAnalysis + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/SchurLifts.lean b/lean/OAI/Algebra/Determinantal/SchurLifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb4723adb9c7ab29b0e1cb2dd3f67f9d8f2aec9b --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/SchurLifts.lean @@ -0,0 +1,446 @@ +import OAI.Algebra.Determinantal.SchurDifferentials + +namespace OAI + +namespace PermanentBorder.PolarAnalysis.Schur +open Matrix Filter +open scoped Matrix Topology +variable {ι κ T : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] + [NormedAddCommGroup T] [NormedSpace ℂ T] + +noncomputable def dirMatrix (A : T → Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) (x h : T) : + Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ := + Matrix.of fun i j => fderiv ℂ (fun y => A y i j) x h + +noncomputable def kernelRemaining + (a : T → ℂ) (β γ : T → ι → ℂ) (E : T → Matrix ι ι ℂ) + (ψ : (ℂ × (κ → ℂ)) → T) (h : κ → T) + (z : (ℂ × (κ → ℂ)) × ((ι → ℂ) × (ι → ℂ))) : ℂ × (κ → ℂ) := + (a (ψ z.1) + β (ψ z.1) ⬝ᵥ z.2.1, + fun i => normalized z.2.2 ⬝ᵥ + (dirMatrix (fun y => block (a y) (β y) (γ y) (E y)) (ψ z.1) (h i) + *ᵥ normalized z.2.1)) + +omit [Fintype κ] in + theorem kernelRemaining_solved + {a : T → ℂ} {β γ : T → ι → ℂ} {E : T → Matrix ι ι ℂ} + {ψ : (ℂ × (κ → ℂ)) → T} {h : κ → T} {x : ℂ × (κ → ℂ)} + (ha : DifferentiableAt ℂ a (ψ x)) + (hβ : ∀ i, DifferentiableAt ℂ (fun y => β y i) (ψ x)) + (hγ : ∀ i, DifferentiableAt ℂ (fun y => γ y i) (ψ x)) + (hE : ∀ i j, DifferentiableAt ℂ (fun y => E y i j) (ψ x)) + (hx : (E (ψ x)).det ≠ 0) : + kernelRemaining a β γ E ψ h + (x, graphKernels (β ∘ ψ) (γ ∘ ψ) (E ∘ ψ) x) = + polarPair (fun y => scalar (a y) (β y) (γ y) (E y)) ψ h x := by + apply Prod.ext + · simp [kernelRemaining, graphKernels, polarPair, scalar, right, + dotProduct_neg, sub_eq_add_neg] + · ext i + exact (differential_scalar ha hβ hγ hE hx (h i)).symm + +omit [Fintype ι] [DecidableEq ι] in + theorem contDiff_block {a : T → ℂ} {β γ : T → ι → ℂ} + {E : T → Matrix ι ι ℂ} {n : WithTop ℕ∞} + (ha : ContDiff ℂ n a) + (hβ : ∀ i, ContDiff ℂ n (fun y => β y i)) + (hγ : ∀ i, ContDiff ℂ n (fun y => γ y i)) + (hE : ∀ i j, ContDiff ℂ n (fun y => E y i j)) (i j : Unit ⊕ ι) : + ContDiff ℂ n (fun y => block (a y) (β y) (γ y) (E y) i j) := by + cases i <;> cases j <;> simp only [block, fromBlocks_apply₁₁, fromBlocks_apply₁₂, + fromBlocks_apply₂₁, fromBlocks_apply₂₂, Matrix.of_apply] + · exact ha + · exact hβ _ + · exact hγ _ + · exact hE _ _ + +omit [DecidableEq ι] in + theorem differentiableAt_kernelRemaining + {a : T → ℂ} {β γ : T → ι → ℂ} {E : T → Matrix ι ι ℂ} + {ψ : (ℂ × (κ → ℂ)) → T} {h : κ → T} {x : ℂ × (κ → ℂ)} + {w : (ι → ℂ) × (ι → ℂ)} + (ha : ContDiff ℂ 2 a) + (hβ : ∀ i, ContDiff ℂ 2 (fun y => β y i)) + (hγ : ∀ i, ContDiff ℂ 2 (fun y => γ y i)) + (hE : ∀ i j, ContDiff ℂ 2 (fun y => E y i j)) + (hψ : DifferentiableAt ℂ ψ x) : + DifferentiableAt ℂ (kernelRemaining a β γ E ψ h) (x,w) := by + have hψ' : DifferentiableAt ℂ (fun z : ((ℂ × (κ → ℂ)) × ((ι → ℂ) × (ι → ℂ))) => ψ z.1) (x,w) := + hψ.comp (x,w) (ContinuousLinearMap.fst ℂ (ℂ × (κ → ℂ)) ((ι → ℂ) × (ι → ℂ))).differentiableAt + have hnorm (j : Unit ⊕ ι) (b : Bool) : + DifferentiableAt ℂ (fun z : ((ℂ × (κ → ℂ)) × ((ι → ℂ) × (ι → ℂ))) => normalized (if b then z.2.1 else z.2.2) j) (x,w) := by + cases j <;> cases b <;> simp only [Bool.false_eq_true, ↓reduceIte, normalized, Sum.elim_inl, + Sum.elim_inr] <;> fun_prop + have hdir (i j : Unit ⊕ ι) (l : κ) : + DifferentiableAt ℂ (fun z : ((ℂ × (κ → ℂ)) × ((ι → ℂ) × (ι → ℂ))) => + dirMatrix (fun y => block (a y) (β y) (γ y) (E y)) (ψ z.1) (h l) i j) (x,w) := by + have hc := (contDiff_block ha hβ hγ hE i j).contDiffAt (x := ψ x) + have hd := (hc.fderiv_right (m := 1) (by norm_num)).differentiableAt_one + exact (hd.clm_apply (differentiableAt_const (h l))).comp (x,w) hψ' + apply DifferentiableAt.prodMk + · change DifferentiableAt ℂ (fun z : ((ℂ × (κ → ℂ)) × ((ι → ℂ) × (ι → ℂ))) => a (ψ z.1) + ∑ j, β (ψ z.1) j * z.2.1 j) (x,w) + apply DifferentiableAt.add ((ha.differentiable (by norm_num) _).comp (x,w) hψ') + apply DifferentiableAt.fun_sum + intro j _ + apply DifferentiableAt.mul (((hβ j).differentiable (by norm_num) _).comp (x,w) hψ') + fun_prop + · apply differentiableAt_pi.mpr + intro l + change DifferentiableAt ℂ (fun z : ((ℂ × (κ → ℂ)) × ((ι → ℂ) × (ι → ℂ))) => ∑ i, normalized z.2.2 i * + ∑ j, dirMatrix (fun y => block (a y) (β y) (γ y) (E y)) (ψ z.1) (h l) i j * + normalized z.2.1 j) (x,w) + apply DifferentiableAt.fun_sum + intro i _ + apply DifferentiableAt.mul (hnorm i false) + apply DifferentiableAt.fun_sum + intro j _ + exact (hdir i j l).mul (hnorm j true) + + theorem simple_kernel_lift + {a : T → ℂ} {β γ : T → ι → ℂ} {E : T → Matrix ι ι ℂ} + {ψ : (ℂ × (κ → ℂ)) → T} {h : κ → T} {x : ℂ × (κ → ℂ)} + (ha : ContDiff ℂ 2 a) + (hβ : ∀ i, ContDiff ℂ 2 (fun y => β y i)) + (hγ : ∀ i, ContDiff ℂ 2 (fun y => γ y i)) + (hE : ∀ i j, ContDiff ℂ 2 (fun y => E y i j)) + (hψ : DifferentiableAt ℂ ψ x) (hx : (E (ψ x)).det ≠ 0) + (hz : polarPair (fun y => (block (a y) (β y) (γ y) (E y)).det) ψ h x = 0) + (hsimple : (fderiv ℂ (polarPair + (fun y => (block (a y) (β y) (γ y) (E y)).det) ψ h) x).IsInvertible) : + let g := graphKernels (β ∘ ψ) (γ ∘ ψ) (E ∘ ψ) + let R := kernelRemaining a β γ E ψ h + let J := auxiliary (β ∘ ψ) (γ ∘ ψ) (E ∘ ψ) + (R (x,g x),J (x,g x)) = 0 ∧ + (fderiv ℂ (fun z => (R z,J z)) (x,g x)).IsInvertible := by + let S := fun y => scalar (a y) (β y) (γ y) (E y) + let g := graphKernels (β ∘ ψ) (γ ∘ ψ) (E ∘ ψ) + let R := kernelRemaining a β γ E ψ h + let J := auxiliary (β ∘ ψ) (γ ∘ ψ) (E ∘ ψ) + have hdE : ∀ i j y, DifferentiableAt ℂ (fun z => E z i j) y := + fun i j => (hE i j).differentiable (by norm_num) + have hdb : ∀ i y, DifferentiableAt ℂ (fun z => β z i) y := + fun i => (hβ i).differentiable (by norm_num) + have hdg : ∀ i y, DifferentiableAt ℂ (fun z => γ z i) y := + fun i => (hγ i).differentiable (by norm_num) + have hda := ha.differentiable (by norm_num) + have hevent : ∀ᶠ y in 𝓝 (ψ x), (E y).det ≠ 0 := + (differentiableAt_det (fun i j => hdE i j (ψ x))).continuousAt.eventually_ne hx + have hFS : (fun y => (block (a y) (β y) (γ y) (E y)).det) =ᶠ[𝓝 (ψ x)] + (fun y => (E y).det * S y) := by + filter_upwards [hevent] with y hy + exact det_block _ _ _ _ hy + obtain ⟨hSz,hSs⟩ := simple_polarPair_unit (contDiff_det hE).contDiffAt + (contDiffAt_scalar ha hβ hγ hE hx) hψ hFS hx hz hsimple + have hRG : (fun y => R (y,g y)) =ᶠ[𝓝 x] polarPair S ψ h := by + filter_upwards [hψ.continuousAt.eventually hevent] with y hy + exact kernelRemaining_solved (hda _) (fun i => hdb i _) (fun i => hdg i _) + (fun i j => hdE i j _) hy + change (R (x,g x),J (x,g x)) = 0 ∧ _ + constructor + · apply Prod.ext + · exact hRG.eq_of_nhds.trans hSz + · exact auxiliary_solved _ _ _ _ hx + · apply simple_kernel_elimination (β := β ∘ ψ) (γ := γ ∘ ψ) (E := E ∘ ψ) + (fun i => (hdb i _).comp x hψ) (fun i => (hdg i _).comp x hψ) + (fun i j => (hdE i j _).comp x hψ) hx + (differentiableAt_kernelRemaining ha hβ hγ hE hψ) + rwa [hRG.fderiv_eq] +end PermanentBorder.PolarAnalysis.Schur + +namespace PermanentBorder.PolarAnalysis.Schur +open Matrix +open scoped Matrix +variable {ι κ σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [Fintype σ] + +noncomputable def affineValue + (A₀ : Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + (A : σ → Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) (y : σ → ℂ) : + Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ := + Matrix.of fun i j => A₀ i j + ∑ v, A v i j * y v + +omit [Fintype ι] [DecidableEq ι] in + theorem affineValue_contDiff + (A₀ : Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + (A : σ → Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + (i j : Unit ⊕ ι) : ContDiff ℂ 2 (fun y => affineValue A₀ A y i j) := by + unfold affineValue + simp only [Matrix.of_apply] + fun_prop + +omit [Fintype ι] [DecidableEq ι] in + theorem block_entries (M : Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) : + block (M (.inl ()) (.inl ())) (fun j => M (.inl ()) (.inr j)) + (fun i => M (.inr i) (.inl ())) (fun i j => M (.inr i) (.inr j)) = M := by + ext i j + cases i <;> cases j <;> rfl + + theorem simple_affine_kernel_lift + (A₀ : Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + (A : σ → Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + {ψ : (ℂ × (κ → ℂ)) → (σ → ℂ)} {h : κ → (σ → ℂ)} + {x : ℂ × (κ → ℂ)} (hψ : DifferentiableAt ℂ ψ x) + (hx : ((affineValue A₀ A (ψ x)).submatrix Sum.inr Sum.inr).det ≠ 0) + (hz : polarPair (fun y => (affineValue A₀ A y).det) ψ h x = 0) + (hsimple : (fderiv ℂ (polarPair + (fun y => (affineValue A₀ A y).det) ψ h) x).IsInvertible) : + let F := affineValue A₀ A + let a := fun y => F y (.inl ()) (.inl ()) + let β := fun y j => F y (.inl ()) (.inr j) + let γ := fun y i => F y (.inr i) (.inl ()) + let E := fun y => (F y).submatrix Sum.inr Sum.inr + let g := graphKernels (β ∘ ψ) (γ ∘ ψ) (E ∘ ψ) + let R := kernelRemaining a β γ E ψ h + let J := auxiliary (β ∘ ψ) (γ ∘ ψ) (E ∘ ψ) + (R (x,g x),J (x,g x)) = 0 ∧ + (fderiv ℂ (fun z => (R z,J z)) (x,g x)).IsInvertible := by + dsimp only + apply simple_kernel_lift + (affineValue_contDiff A₀ A _ _) + (fun j => affineValue_contDiff A₀ A _ _) + (fun i => affineValue_contDiff A₀ A _ _) + (fun i j => affineValue_contDiff A₀ A _ _) hψ hx + · simpa only [block_entries] using hz + · simpa only [block_entries] using hsimple +end PermanentBorder.PolarAnalysis.Schur + +namespace PermanentBorder.PolarAnalysis +open Matrix +variable {I J : Type*} [Fintype I] [DecidableEq I] [Finite J] + +noncomputable def dotLinear (v : I → ℂ) : (I → ℂ) →ₗ[ℂ] ℂ where + toFun f := f ⬝ᵥ v + map_add' := by intros; apply add_dotProduct + map_smul' := by intros; simp [smul_dotProduct] + + theorem exists_common_functional (v : J → I → ℂ) (hv : ∀ j, v j ≠ 0) : + ∃ f : I → ℂ, ∀ j, f ⬝ᵥ v j ≠ 0 := by + classical + let p (j : J) := LinearMap.ker (dotLinear (v j)) + have hp (j : J) : p j ≠ ⊤ := by + intro h + apply hv j + funext i + have hi : Pi.single i 1 ∈ p j := h ▸ Submodule.mem_top + change (Pi.single i 1 : I → ℂ) ⬝ᵥ v j = 0 at hi + simpa only [single_dotProduct, one_mul, Pi.zero_apply] using hi + obtain ⟨f,hf⟩ := Submodule.exists_forall_notMem_of_forall_ne_top p hp + exact ⟨f,hf⟩ + + theorem det_updateRow_one (i : I) (f : I → ℂ) : + ((1 : Matrix I I ℂ).updateRow i f).det = f i := by + have hsum : (∑ k, f k • (1 : Matrix I I ℂ) k) = f := by + ext j + simp [Matrix.one_apply, Finset.sum_apply, Pi.smul_apply] + simpa only [hsum, Matrix.det_one, smul_eq_mul, mul_one] using + (Matrix.det_updateRow_sum (1 : Matrix I I ℂ) i f) + + theorem exists_common_kernel_chart (i₀ : I) (A : J → Matrix I I ℂ) + (hA : ∀ j, (A j).adjugate ≠ 0) : + ∃ S : Matrix I I ℂ, S.det ≠ 0 ∧ + ∀ j, ∃ r, (A j * S).adjugate i₀ r ≠ 0 := by + classical + have hv : ∀ j, ∃ r, (fun i => (A j).adjugate i r) ≠ 0 := by + intro j + by_contra! hz + exact hA j (by funext i r; exact congrFun (hz r) i) + choose r hr using hv + let v : Option J → I → ℂ + | none => Pi.single i₀ 1 + | some j => fun i => (A j).adjugate i (r j) + have hv' : ∀ j, v j ≠ 0 := by + rintro (_|j) + · intro h + have := congrFun h i₀ + simp [v] at this + · exact hr j + obtain ⟨f,hf⟩ := exists_common_functional v hv' + have hf₀ : f i₀ ≠ 0 := by + simpa only [v, dotProduct_single, mul_one] using hf none + let T : Matrix I I ℂ := (1 : Matrix I I ℂ).updateRow i₀ f + have hT : T.det ≠ 0 := by simpa only [T, det_updateRow_one] using hf₀ + let S : Matrix I I ℂ := T⁻¹ + have hST : S * T = 1 := Matrix.nonsing_inv_mul _ (isUnit_iff_ne_zero.mpr hT) + have hS : S.det ≠ 0 := by + have he := congrArg Matrix.det hST + rw [Matrix.det_mul, Matrix.det_one] at he + exact left_ne_zero_of_mul_eq_one he + have hadj : S.adjugate = S.det • T := by + calc + S.adjugate = S.adjugate * (S*T) := by rw [hST, Matrix.mul_one] + _ = (S.adjugate*S)*T := (Matrix.mul_assoc _ _ _).symm + _ = S.det • T := by rw [Matrix.adjugate_mul, Matrix.smul_mul, Matrix.one_mul] + refine ⟨S,hS,?_⟩ + intro j + refine ⟨r j,?_⟩ + rw [Matrix.adjugate_mul_distrib, hadj, Matrix.smul_mul] + change S.det * (T * (A j).adjugate) i₀ (r j) ≠ 0 + apply mul_ne_zero hS + simpa only [Matrix.mul_apply, T, Matrix.updateRow_self, v, dotProduct] using hf (some j) +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis +open Matrix +variable {I : Type*} [Fintype I] [DecidableEq I] + +noncomputable def determinantMultilinear : + ContinuousMultilinearMap ℂ (fun _ : I => I → ℂ) ℂ := + { Matrix.detRowAlternating.toMultilinearMap with + cont := continuous_id.matrix_det } + + theorem determinantDifferential (M H : I → I → ℂ) : + fderiv ℂ (fun M : I → I → ℂ => (Matrix.of M).det) M H = + ∑ i, ∑ j, (Matrix.of M).adjugate j i * H i j := by + have hd := (determinantMultilinear (I := I)).hasFDerivAt M + have he : fderiv ℂ (fun M : I → I → ℂ => (Matrix.of M).det) M = + (determinantMultilinear (I := I)).linearDeriv M := hd.fderiv + rw [he, ContinuousMultilinearMap.linearDeriv_apply] + apply Finset.sum_congr rfl + intro i _ + change ((Matrix.of M).updateRow i (H i)).det = _ + rw [← Matrix.det_transpose, ← Matrix.updateCol_transpose] + change (Matrix.of M).transpose.cramer (H i) i = _ + rw [Matrix.cramer_eq_adjugate_mulVec, ← Matrix.adjugate_transpose] + rfl + + theorem differentiableAt_determinant (M : I → I → ℂ) : + DifferentiableAt ℂ (fun M : I → I → ℂ => (Matrix.of M).det) M := + ((determinantMultilinear (I := I)).hasFDerivAt M).differentiableAt + + theorem adjugate_ne_zero_of_differential + {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] + {A : E → I → I → ℂ} {x : E} (hA : DifferentiableAt ℂ A x) + (hd : fderiv ℂ (fun y => (Matrix.of (A y)).det) x ≠ 0) : + (Matrix.of (A x)).adjugate ≠ 0 := by + intro hz + apply hd + change fderiv ℂ ((fun M : I → I → ℂ => (Matrix.of M).det) ∘ A) x = 0 + rw [fderiv_comp x (differentiableAt_determinant (A x)) hA] + ext v + simp only [ContinuousLinearMap.comp_apply, _root_.zero_apply] + rw [determinantDifferential, hz] + simp +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis +open Matrix +open scoped Topology +variable {V E W : Type*} + [NormedAddCommGroup V] [NormedSpace ℂ V] + [NormedAddCommGroup W] [NormedSpace ℂ W] + [NormedAddCommGroup E] [NormedSpace ℂ E] + + theorem first_derivative_ne_zero_of_invertible + {P : (ℂ × W) → (ℂ × W)} {x : ℂ × W} + (hP : DifferentiableAt ℂ P x) (hs : (fderiv ℂ P x).IsInvertible) : + fderiv ℂ (fun y => (P y).1) x ≠ 0 := by + intro hz + obtain ⟨v,hv⟩ := hs.bijective.surjective (1,0) + have hh := congrArg (fun L : (ℂ × W) →L[ℂ] ℂ => L v) hz + rw [(hP.hasFDerivAt.fst).fderiv] at hh + change (fderiv ℂ P x v).1 = 0 at hh + rw [hv] at hh + exact one_ne_zero hh + +variable {I J : Type*} [Fintype I] [DecidableEq I] [Finite J] + + theorem selected_simple_common_kernel_chart + (i₀ : I) (A : E → I → I → ℂ) (ψ : (ℂ × W) → E) + (P : (ℂ × W) → (ℂ × W)) (x : J → (ℂ × W)) + (hA : ∀ j, DifferentiableAt ℂ A (ψ (x j))) + (hψ : ∀ j, DifferentiableAt ℂ ψ (x j)) + (hP : ∀ j, DifferentiableAt ℂ P (x j)) + (hfirst : ∀ y, (P y).1 = (Matrix.of (A (ψ y))).det) + (hsimple : ∀ j, (fderiv ℂ P (x j)).IsInvertible) : + ∃ S : Matrix I I ℂ, S.det ≠ 0 ∧ + ∀ j, ∃ r, (Matrix.of (A (ψ (x j))) * S).adjugate i₀ r ≠ 0 := by + apply exists_common_kernel_chart + intro j + apply adjugate_ne_zero_of_differential ((hA j).comp (x j) (hψ j)) + have hn := first_derivative_ne_zero_of_invertible (hP j) (hsimple j) + simpa only [Function.comp_apply, hfirst] using hn +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis +open Matrix + + def unitSumOptionEquiv (α : Type*) : Unit ⊕ α ≃ Option α where + toFun := Sum.elim (fun _ => none) some + invFun := fun o => o.elim (Sum.inl ()) Sum.inr + left_inv := by + rintro (u|a) + · cases u; rfl + · rfl + right_inv := by rintro (_|a) <;> rfl + +noncomputable def pivotEquiv {n : ℕ} (i : Fin (n+1)) : Unit ⊕ Fin n ≃ Fin (n+1) := + (unitSumOptionEquiv (Fin n)).trans (finSuccEquiv' i).symm + +@[simp] theorem pivotEquiv_inl {n : ℕ} (i : Fin (n+1)) : + pivotEquiv i (Sum.inl ()) = i := rfl +@[simp] theorem pivotEquiv_inr {n : ℕ} (i : Fin (n+1)) (j : Fin n) : + pivotEquiv i (Sum.inr j) = i.succAbove j := rfl + + theorem det_submatrix_two_equiv {I J R : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] [CommRing R] + (er ec : I ≃ J) (M : Matrix J J R) : + (M.submatrix er ec).det = (Equiv.Perm.sign (ec.symm.trans er) : ℤ) * M.det := by + exact Matrix.det_reindex er.symm ec.symm M + + theorem determinant_pivot_scalar {n : ℕ} (i r : Fin (n+1)) : + ∃ c : ℂ, c ≠ 0 ∧ ∀ M : Matrix (Fin (n+1)) (Fin (n+1)) ℂ, + (M.submatrix (pivotEquiv r) (pivotEquiv i)).det = c*M.det := by + let c : ℂ := (Equiv.Perm.sign ((pivotEquiv i).symm.trans (pivotEquiv r)) : ℤ) + refine ⟨c, ?_, fun M => det_submatrix_two_equiv _ _ _⟩ + exact Int.cast_ne_zero.mpr (Units.ne_zero _) + + theorem pivot_minor_ne_zero {n : ℕ} (M : Matrix (Fin (n+1)) (Fin (n+1)) ℂ) + (i r : Fin (n+1)) (h : M.adjugate i r ≠ 0) : + ((M.submatrix (pivotEquiv r) (pivotEquiv i)).submatrix Sum.inr Sum.inr).det ≠ 0 := by + rw [Matrix.adjugate_fin_succ_eq_det_submatrix] at h + have he : (M.submatrix (pivotEquiv r) (pivotEquiv i)).submatrix Sum.inr Sum.inr = + M.submatrix r.succAbove i.succAbove := by ext a b; rfl + rw [he] + exact (mul_ne_zero_iff.mp h).2 +end PermanentBorder.PolarAnalysis + +namespace PermanentBorder.PolarAnalysis.Schur +open Matrix +open scoped Matrix +variable {ι κ T : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] + [NormedAddCommGroup T] [NormedSpace ℂ T] + +noncomputable def matrixKernelSystem + (F : T → Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + (ψ : (ℂ × (κ → ℂ)) → T) (h : κ → T) + (z : (ℂ × (κ → ℂ)) × ((ι → ℂ) × (ι → ℂ))) := + (kernelRemaining (fun y => F y (.inl ()) (.inl ())) + (fun y j => F y (.inl ()) (.inr j)) (fun y i => F y (.inr i) (.inl ())) + (fun y => (F y).submatrix Sum.inr Sum.inr) ψ h z, + auxiliary (fun y j => F (ψ y) (.inl ()) (.inr j)) + (fun y i => F (ψ y) (.inr i) (.inl ())) + (fun y => (F (ψ y)).submatrix Sum.inr Sum.inr) z) + +noncomputable def matrixKernelPoint + (F : T → Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + (ψ : (ℂ × (κ → ℂ)) → T) (x : ℂ × (κ → ℂ)) := + (x, graphKernels (fun y j => F (ψ y) (.inl ()) (.inr j)) + (fun y i => F (ψ y) (.inr i) (.inl ())) + (fun y => (F (ψ y)).submatrix Sum.inr Sum.inr) x) + + theorem simple_matrix_kernel_lift + (F : T → Matrix (Unit ⊕ ι) (Unit ⊕ ι) ℂ) + (hF : ∀ i j, ContDiff ℂ 2 (fun y => F y i j)) + {ψ : (ℂ × (κ → ℂ)) → T} {h : κ → T} {x : ℂ × (κ → ℂ)} + (hψ : DifferentiableAt ℂ ψ x) + (hx : ((F (ψ x)).submatrix Sum.inr Sum.inr).det ≠ 0) + (hz : polarPair (fun y => (F y).det) ψ h x = 0) + (hsimple : (fderiv ℂ (polarPair (fun y => (F y).det) ψ h) x).IsInvertible) : + matrixKernelSystem F ψ h (matrixKernelPoint F ψ x) = 0 ∧ + (fderiv ℂ (matrixKernelSystem F ψ h) (matrixKernelPoint F ψ x)).IsInvertible := by + apply simple_kernel_lift (hF _ _) (fun j => hF _ _) (fun i => hF _ _) + (fun i j => hF _ _) hψ hx + · simpa only [block_entries] using hz + · simpa only [block_entries] using hsimple +end PermanentBorder.PolarAnalysis.Schur + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Selector.lean b/lean/OAI/Algebra/Determinantal/Selector.lean new file mode 100644 index 0000000000000000000000000000000000000000..127c338b2be319ba211b078e2b778ea686f2841e --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Selector.lean @@ -0,0 +1,433 @@ +import OAI.Algebra.Determinantal.BorderPolars + +namespace OAI + +namespace PermanentBorder.Selector +open MvPolynomial +variable {n R : Type*} [Fintype n] [DecidableEq n] [CommSemiring R] + +noncomputable def allOnes (V : Type*) [Fintype V] : V →₀ ℕ := + Finsupp.equivFunOnFinite.symm (fun _ => 1) + +@[simp] theorem allOnes_apply {V : Type*} [Fintype V] (i : V) : allOnes V i = 1 := rfl + +noncomputable def edgeExponent (e : n × n) : (n ⊕ n) →₀ ℕ := + Finsupp.single (.inl e.1) 1 + Finsupp.single (.inr e.2) 1 + +noncomputable def occupancy (S : Finset (n × n)) : (n ⊕ n) →₀ ℕ := + ∑ e ∈ S, edgeExponent e + +omit [Fintype n] in + theorem occupancy_left (S : Finset (n × n)) (i : n) : + occupancy S (.inl i) = (S.filter (fun e => e.1 = i)).card := by + classical + rw [Finset.card_filter] + simp only [occupancy, Finsupp.finsetSum_apply, edgeExponent, Finsupp.add_apply, + Finsupp.single_apply, Sum.inl.injEq, Sum.inr_ne_inl, + ite_false, add_zero] + +omit [Fintype n] in + theorem occupancy_right (S : Finset (n × n)) (j : n) : + occupancy S (.inr j) = (S.filter (fun e => e.2 = j)).card := by + classical + rw [Finset.card_filter] + simp only [occupancy, Finsupp.finsetSum_apply, edgeExponent, Finsupp.add_apply, + Finsupp.single_apply, Sum.inr.injEq, Sum.inl_ne_inr, + ite_false, zero_add] + +noncomputable def permGraph (σ : Equiv.Perm n) : Finset (n × n) := + Finset.univ.image (fun j => (σ j,j)) + +@[simp] theorem mem_permGraph (σ : Equiv.Perm n) (i j : n) : + (i,j) ∈ permGraph σ ↔ σ j = i := by + simp [permGraph, eq_comm] + + theorem permGraph_injective : Function.Injective (permGraph (n := n)) := by + intro σ τ h + ext j + have hmem : (σ j,j) ∈ permGraph σ := by simp + rw [h] at hmem + exact (mem_permGraph τ _ _).mp hmem |>.symm + + theorem occupancy_permGraph (σ : Equiv.Perm n) : + occupancy (permGraph σ) = allOnes (n ⊕ n) := by + classical + ext v + cases v with + | inl i => + rw [occupancy_left, allOnes_apply] + apply Finset.card_eq_one.mpr + refine ⟨(i,σ.symm i), ?_⟩ + ext ⟨r,c⟩ + simp only [Finset.mem_filter, mem_permGraph, Finset.mem_singleton, Prod.mk.injEq] + constructor + · rintro ⟨h₁,h₂⟩ + exact ⟨h₂, σ.injective ((h₁.trans h₂).trans (σ.apply_symm_apply i).symm)⟩ + · rintro ⟨rfl,rfl⟩ + simp + | inr j => + rw [occupancy_right, allOnes_apply] + apply Finset.card_eq_one.mpr + refine ⟨(σ j,j), ?_⟩ + ext ⟨r,c⟩ + simp only [Finset.mem_filter, mem_permGraph, Finset.mem_singleton, Prod.mk.injEq] + constructor + · rintro ⟨h₁,rfl⟩ + exact ⟨h₁.symm,rfl⟩ + · rintro ⟨rfl,rfl⟩ + exact ⟨rfl,rfl⟩ + + theorem unique_column {S : Finset (n × n)} + (h : occupancy S = allOnes (n ⊕ n)) (j : n) : + ∃! i, (i,j) ∈ S := by + have hc : (S.filter (fun e => e.2 = j)).card = 1 := by + rw [← occupancy_right, h, allOnes_apply] + obtain ⟨⟨r,c⟩, hset⟩ := Finset.card_eq_one.mp hc + have hm : (r,c) ∈ S.filter (fun e => e.2 = j) := by simp [hset] + obtain ⟨hr, rfl⟩ := Finset.mem_filter.mp hm + refine ⟨r, hr, ?_⟩ + intro i hi + have hmem : (i,c) ∈ S.filter (fun e => e.2 = c) := by simp [hi] + rw [hset] at hmem + exact congrArg Prod.fst (Finset.mem_singleton.mp hmem) + + theorem unique_row {S : Finset (n × n)} + (h : occupancy S = allOnes (n ⊕ n)) (i : n) : + ∃! j, (i,j) ∈ S := by + have hc : (S.filter (fun e => e.1 = i)).card = 1 := by + rw [← occupancy_left, h, allOnes_apply] + obtain ⟨⟨r,c⟩, hset⟩ := Finset.card_eq_one.mp hc + have hm : (r,c) ∈ S.filter (fun e => e.1 = i) := by simp [hset] + obtain ⟨hmem0, rfl⟩ := Finset.mem_filter.mp hm + refine ⟨c, hmem0, ?_⟩ + intro j hj + have hmem : (r,j) ∈ S.filter (fun e => e.1 = r) := by simp [hj] + rw [hset] at hmem + exact congrArg Prod.snd (Finset.mem_singleton.mp hmem) + + theorem occupancy_eq_iff {S : Finset (n × n)} : + occupancy S = allOnes (n ⊕ n) ↔ ∃ σ : Equiv.Perm n, S = permGraph σ := by + classical + constructor + · intro h + choose f hf hfu using unique_column h + have hinj : Function.Injective f := by + intro i j hij + obtain ⟨c,hc,hcu⟩ := unique_row h (f i) + exact (hcu i (hf i)).trans (hcu j (hij ▸ hf j)).symm + have hsurj : Function.Surjective f := Finite.surjective_of_injective hinj + let σ : Equiv.Perm n := Equiv.ofBijective f ⟨hinj,hsurj⟩ + refine ⟨σ, ?_⟩ + ext ⟨r,c⟩ + rw [mem_permGraph] + change (r,c) ∈ S ↔ f c = r + constructor + · intro hr + exact (hfu c r hr).symm + · rintro rfl + exact hf c + · rintro ⟨σ,rfl⟩ + exact occupancy_permGraph σ + +noncomputable def edgeProduct (M : Matrix n n R) : MvPolynomial (n ⊕ n) R := + ∏ e : n × n, (1 + monomial (edgeExponent e) (M e.1 e.2)) + +omit [DecidableEq n] in + theorem edgeProduct_expansion (M : Matrix n n R) : + edgeProduct M = ∑ S : Finset (n × n), + monomial (occupancy S) (∏ e ∈ S, M e.1 e.2) := by + classical + simp only [edgeProduct, add_comm (1 : MvPolynomial (n ⊕ n) R)] + rw [Finset.prod_add_one] + simp only [← monomial_sum_prod, occupancy, Finset.powerset_univ] + + theorem edgeProduct_permanent (M : Matrix n n R) : + (edgeProduct M).coeff (allOnes (n ⊕ n)) = M.permanent := by + classical + rw [edgeProduct_expansion, coeff_sum] + simp only [coeff_monomial] + let good := Finset.univ.filter (fun S : Finset (n × n) => occupancy S = allOnes (n ⊕ n)) + have hgood : good = Finset.univ.image (permGraph (n := n)) := by + ext S + simp only [good, Finset.mem_filter, Finset.mem_univ, true_and, + Finset.mem_image, occupancy_eq_iff] + exact ⟨fun ⟨σ,h⟩ => ⟨σ,h.symm⟩, fun ⟨σ,h⟩ => ⟨σ,h.symm⟩⟩ + calc + (∑ S : Finset (n × n), if occupancy S = allOnes (n ⊕ n) then ∏ e ∈ S, M e.1 e.2 else 0) = + ∑ S ∈ good, ∏ e ∈ S, M e.1 e.2 := by rw [Finset.sum_filter] + _ = ∑ σ : Equiv.Perm n, ∏ e ∈ permGraph σ, M e.1 e.2 := by + rw [hgood, Finset.sum_image] + exact fun σ _ τ _ h => permGraph_injective h + _ = M.permanent := by + unfold Matrix.permanent + apply Finset.sum_congr rfl + intro σ _ + unfold permGraph + rw [Finset.prod_image] + intro i _ j _ hij + exact congrArg Prod.snd hij +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I J R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] + + theorem coeff_separate_univariate (p : I → Polynomial R) (d : I →₀ ℕ) : + (∏ i, Polynomial.eval₂ C (X i) (p i) : MvPolynomial I R).coeff d = + ∏ i, (p i).coeff (d i) := by + classical + have hexp (i : I) : Polynomial.eval₂ C (X i) (p i) = + ∑ k ∈ (p i).support, C ((p i).coeff k) * X i ^ k := by + conv_lhs => rw [Polynomial.as_sum_support (p i)] + simp only [Polynomial.eval₂_finsetSum, Polynomial.eval₂_monomial] + simp_rw [hexp] + rw [Finset.prod_univ_sum, coeff_sum] + simp_rw [Finset.prod_mul_distrib, ← map_prod, coeff_C_mul, coeff_prod_X_pow] + have heq (k : I → ℕ) : d = Finsupp.indicator Finset.univ (fun i _ => k i) ↔ k = d := by + simp only [Finsupp.ext_iff, Finsupp.indicator_of_mem (Finset.mem_univ _), + _root_.funext_iff, eq_comm] + simp_rw [heq] + rw [Finset.sum_eq_single (fun i => d i)] + · simp + · intro k _ hk + simp [hk] + · intro hd + have hnot : ¬ ∀ i, d i ∈ (p i).support := by + simpa only [Fintype.mem_piFinset] using hd + obtain ⟨i, hi⟩ := not_forall.mp hnot + simp only [Polynomial.mem_support_iff, not_not] at hi + simp only [ite_true, mul_one] + apply Finset.prod_eq_zero (Finset.mem_univ i) + exact hi + + theorem coeff_one_edge_factors (s : Finset J) (a : J → R) : + (∏ j ∈ s, (1 + Polynomial.C (a j) * Polynomial.X)).coeff 1 = ∑ j ∈ s, a j := by + classical + have hzero (t : Finset J) : + (∏ j ∈ t, (1 + Polynomial.C (a j) * Polynomial.X)).coeff 0 = 1 := by + rw [Polynomial.coeff_zero_prod] + simp [Polynomial.coeff_add, Polynomial.mul_coeff_zero, Polynomial.coeff_one, Polynomial.coeff_X] + induction s using Finset.induction_on with + | empty => norm_num [Polynomial.coeff_one] + | @insert j s hj ih => + rw [Finset.prod_insert hj, Finset.sum_insert hj, add_mul, one_mul, + Polynomial.coeff_add, mul_assoc, mul_comm Polynomial.X, + ← mul_assoc, Polynomial.coeff_mul_X, Polynomial.coeff_C_mul, hzero, ih, mul_one] + exact add_comm _ _ + + theorem coeff_row_edge_product [Fintype J] (a : I → J → R) : + (∏ i, ∏ j, (1 + C (a i j) * X i) : MvPolynomial I R).coeff + (Finsupp.equivFunOnFinite.symm (fun _ => 1)) = + ∏ i, ∑ j, a i j := by + classical + let p : I → Polynomial R := fun i => ∏ j, (1 + Polynomial.C (a i j) * Polynomial.X) + have hp (i : I) : Polynomial.eval₂ C (X i) (p i) = ∏ j, (1 + C (a i j) * X i) := by + simp only [p, Polynomial.eval₂_finsetProd, Polynomial.eval₂_add, Polynomial.eval₂_one, + Polynomial.eval₂_mul, Polynomial.eval₂_C, Polynomial.eval₂_X] + rw [← show (∏ i, Polynomial.eval₂ C (X i) (p i)) = + (∏ i, ∏ j, (1 + C (a i j) * X i)) from Finset.prod_congr rfl (fun i _ => hp i), + coeff_separate_univariate] + apply Finset.prod_congr rfl + intro i _ + exact coeff_one_edge_factors Finset.univ (a i) +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {A B R : Type*} [CommSemiring R] + theorem sumRingEquiv_monomial (d : A →₀ ℕ) (e : B →₀ ℕ) (r : R) : + sumRingEquiv R A B (monomial (d.sumElim e) r) = monomial d (monomial e r) := by + simp [sumRingEquiv, monomial] + theorem coeff_nested (p : MvPolynomial (A ⊕ B) R) (d : A →₀ ℕ) (e : B →₀ ℕ) : + p.coeff (d.sumElim e) = ((sumRingEquiv R A B p).coeff d).coeff e := by + classical + induction p using MvPolynomial.induction_on' with + | add p q hp hq => + simp only [AddMonoidAlgebra.coeff_add, Finsupp.add_apply, map_add, hp, hq] + | monomial f r => + obtain ⟨⟨a, b⟩, rfl⟩ := Finsupp.sumFinsuppAddEquivProdFinsupp.symm.surjective f + have hab : Finsupp.sumFinsuppAddEquivProdFinsupp.symm (a, b) = a.sumElim b := by + ext x; cases x <;> rfl + rw [hab, sumRingEquiv_monomial] + simp only [coeff_monomial] + have habde : a.sumElim b = d.sumElim e ↔ a = d ∧ b = e := by + constructor + · intro h; constructor + · ext x; exact congrArg (fun f => f (Sum.inl x)) h + · ext x; exact congrArg (fun f => f (Sum.inr x)) h + · rintro ⟨rfl, rfl⟩; rfl + simp only [habde] + by_cases ha : a = d <;> by_cases hb : b = e <;> simp [ha, hb] +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I R : Type*} [Fintype I] [DecidableEq I] [CommSemiring R] +omit [DecidableEq I] in + theorem edgeProduct_nested (M : Matrix I I R) : + sumRingEquiv R I I (edgeProduct M) = + ∏ i, ∏ j, (1 + C (C (M i j)*X j)*X i) := by + classical + have hm (i j : I) : monomial (edgeExponent (i,j)) (M i j) = + C (M i j)*X (.inl i)*X (.inr j) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + simp only [mul_one, edgeExponent] + simp only [edgeProduct, map_prod, map_add, map_one] + rw [Fintype.prod_prod_type] + apply Finset.prod_congr rfl + intro i _ + apply Finset.prod_congr rfl + intro j _ + rw [hm] + simp [mul_comm, mul_left_comm] + + theorem row_product_permanent (M : Matrix I I R) : + (∏ i, ∑ j, C (M i j)*X j).coeff (allOnes I) = M.permanent := by + rw [← edgeProduct_permanent] + have hones : allOnes (I ⊕ I) = (allOnes I).sumElim (allOnes I) := by + ext i; cases i <;> rfl + rw [hones, coeff_nested, edgeProduct_nested] + exact congrArg (fun (p : MvPolynomial I R) => p.coeff (allOnes I)) + (coeff_row_edge_product (fun i j => C (M i j)*X j)).symm + + theorem row_product_diagonal (M : Matrix I I R) (w : I → R) : + (∏ i, ((∑ j, C (M i j)*X j) + C (w i)*X i)).coeff (allOnes I) = + (M + Matrix.diagonal w).permanent := by + rw [← row_product_permanent] + apply congrArg (fun polynomial : MvPolynomial I R => polynomial.coeff (allOnes I)) + apply Finset.prod_congr rfl + intro i _ + simp only [Matrix.add_apply, map_add, add_mul, Finset.sum_add_distrib] + congr 1 + simp only [Matrix.diagonal_apply, apply_ite, map_zero, ite_mul, zero_mul] + simp + +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {I E R : Type*} [Fintype I] [Fintype E] [DecidableEq I] [CommSemiring R] +noncomputable def graphMatrix (src dst : E → I) (w : E → R) : Matrix I I R := + fun i j => ∑ e, if src e = i ∧ dst e = j then w e else 0 + + theorem graph_row_sum (src dst : E → I) (w : E → R) (i : I) : + (∑ e, if src e = i then C (w e)*X (dst e) else 0 : MvPolynomial I R) = + ∑ j, C (graphMatrix src dst w i j)*X j := by + classical + simp only [graphMatrix, map_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro e _ + by_cases h : src e = i + · simp only [h, true_and, apply_ite, map_zero, ite_mul, zero_mul] + simp + · simp [h] + + theorem coeff_graph_edges (src dst : E → I) (w : E → R) : + (∏ e, (1 + monomial (edgeExponent (src e,dst e)) (w e))).coeff + (allOnes (I ⊕ I)) = (graphMatrix src dst w).permanent := by + classical + have hm (e : E) : monomial (edgeExponent (src e,dst e)) (w e) = + C (w e)*X (.inl (src e))*X (.inr (dst e)) := by + rw [C_mul_X_eq_monomial, X, monomial_mul_monomial] + simp only [mul_one, edgeExponent] + have hones : allOnes (I ⊕ I) = (allOnes I).sumElim (allOnes I) := by + ext x; cases x <;> rfl + rw [hones, coeff_nested] + simp only [map_prod, map_add, map_one, hm, map_mul, + sumRingEquiv_C, sumRingEquiv_X_inl, sumRingEquiv_X_inr] + have hf (e : E) : (1 + C (C (w e))*X (src e)*C (X (dst e)) : + MvPolynomial I (MvPolynomial I R)) = + ∏ i, (1 + C (if src e = i then C (w e)*X (dst e) else 0)*X i) := by + rw [Finset.prod_eq_single (src e)] + · simp [map_mul, mul_comm, mul_left_comm] + · intro i hi hie + simp [Ne.symm hie] + · simp + simp_rw [hf] + rw [Finset.prod_comm] + change (((_ : MvPolynomial I (MvPolynomial I R)).coeff + (Finsupp.equivFunOnFinite.symm (fun _ => 1))).coeff (allOnes I)) = _ + rw [coeff_row_edge_product] + simp_rw [graph_row_sum] + exact row_product_permanent _ +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {R : Type*} [CommRing R] + +noncomputable def threeOnes : Fin 3 →₀ ℕ := + Finsupp.single 0 1 + Finsupp.single 1 1 + Finsupp.single 2 1 +noncomputable def gadgetAfterRows (a b c d : R) : MvPolynomial (Fin 3) R := + (1 + C a * X 0) * (1 + C b * X 1) * + (-X 0 - X 1 + X 2 + C c) * (-X 0 - X 1 + X 2 + C d) * + (X 0 + X 1 + X 2) + + theorem coeff_gadgetAfterRows (a b c d : R) : + (gadgetAfterRows a b c d).coeff threeOnes = -2 + a*b*c*d := by + classical + unfold gadgetAfterRows + ring_nf + have h2 : (2 : MvPolynomial (Fin 3) R) = C (2 : R) := (map_ofNat C 2).symm + have h3 : (3 : MvPolynomial (Fin 3) R) = C (3 : R) := (map_ofNat C 3).symm + simp only [h2, h3, AddMonoidAlgebra.coeff_add, Finsupp.add_apply, coeff_sub, + X, C_apply, monomial_pow, monomial_mul_monomial, coeff_monomial] + have heq (x y : Fin 3 →₀ ℕ) : x = y ↔ x 0 = y 0 ∧ x 1 = y 1 ∧ x 2 = y 2 := by + rw [Finsupp.ext_iff] + simp [Fin.forall_fin_succ] + simp only [threeOnes, heq, Finsupp.add_apply, Finsupp.zero_apply, + Finsupp.smul_apply, smul_eq_mul, Finsupp.single_apply] + have h01 : (0 : Fin 3) ≠ 1 := by decide + have h02 : (0 : Fin 3) ≠ 2 := by decide + have h12 : (1 : Fin 3) ≠ 2 := by decide + norm_num [h01, h01.symm, h02, h02.symm, h12, h12.symm] + ring +end PermanentBorder.Selector + +namespace PermanentBorder.Selector +open MvPolynomial +variable {R : Type*} [CommRing R] + +noncomputable def gadgetH : Matrix (Fin 3) (Fin 3) R := !![-1,-1,1; -1,-1,1; 1,1,1] + +noncomputable def gadgetRowEntries (c d : R) : Fin 3 → Option (Fin 3) → MvPolynomial (Fin 3) R := + fun i j => match j with + | none => C (![c,d,0] i) + | some j => C (gadgetH i j) * X j + +noncomputable def gadgetNested (a b c d : R) : MvPolynomial (Fin 3) (MvPolynomial (Fin 3) R) := + C ((1 + C a * X 0)*(1 + C b * X 1)) * + ∏ i, ∏ j, (1 + C (gadgetRowEntries c d i j) * X i) + + theorem gadgetNested_rows (a b c d : R) : + (gadgetNested a b c d).coeff (Finsupp.equivFunOnFinite.symm (fun _ => 1)) = + gadgetAfterRows a b c d := by + classical + rw [gadgetNested, coeff_C_mul, coeff_row_edge_product] + simp only [Fin.prod_univ_succ, Fintype.prod_empty, mul_one, Fintype.sum_option, + gadgetRowEntries, Fin.sum_univ_succ, Fintype.sum_empty, add_zero] + simp [gadgetH, gadgetAfterRows] + ring + +noncomputable def gadgetEdges (a b c d : R) : MvPolynomial (Fin 3 ⊕ Fin 3) R := + (1 + C a * X (.inr 0)) * (1 + C b * X (.inr 1)) * + ∏ i, ((1 + C (![c,d,0] i) * X (.inl i)) * + ∏ j, (1 + C (gadgetH i j) * X (.inr j) * X (.inl i))) + + theorem gadgetEdges_nested (a b c d : R) : + sumRingEquiv R (Fin 3) (Fin 3) (gadgetEdges a b c d) = gadgetNested a b c d := by + classical + simp [gadgetEdges, gadgetNested, map_prod, Fintype.prod_option, gadgetRowEntries, + map_mul, mul_assoc] + + theorem gadgetEdges_coefficient (a b c d : R) : + (gadgetEdges a b c d).coeff (threeOnes.sumElim threeOnes) = -2 + a*b*c*d := by + rw [coeff_nested, gadgetEdges_nested] + have hones : threeOnes = Finsupp.equivFunOnFinite.symm (fun _ => 1) := by + ext i; fin_cases i <;> simp [threeOnes] + rw [hones, gadgetNested_rows, ← hones, coeff_gadgetAfterRows] + +end PermanentBorder.Selector + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/SingularValues.lean b/lean/OAI/Algebra/Determinantal/SingularValues.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f357936992ff83edeebe09fa8360074b7a9596b --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/SingularValues.lean @@ -0,0 +1,358 @@ +import OAI.Algebra.Determinantal.HalfPolynomials + +namespace OAI +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert +universe u +variable {K L R : Type u} [Field K] [Field L] [Algebra K L] + [CommRing R] [Algebra L R] + +theorem add_evaluated_polynomial {ι : Type*} [Fintype ι] + (F : IntermediateField K L) (n B : ℕ) (hF : Algebra.trdeg K F ≤ (n : Cardinal)) + (q : MvPolynomial (Fin 2) L →ₐ[L] R) (c : Basis ι L R) + (hmon : ∀ s i, c.repr (q (monomial s (1 : L))) i ∈ F) + (p t : MvPolynomial (Fin 2) L) (ht : InField F t) + (hhigh : ∀ s, B ≤ s.degree → p.coeff s = t.coeff s) + (hpq : ∀ i, c.repr (q p) i ∈ F) : + ∃ E : IntermediateField K L, F ≤ E ∧ InField E p ∧ + Algebra.trdeg K E ≤ (n + (Fintype.card (Index B) - finrank L (filtered q B)) : ℕ) := by + classical + have he := remainder_expansion p t hhigh + have hsum : ∑ s : Index B, (p-t).coeff s.val • q (monomial s.val 1) = q p-q t := by + have hh := congrArg q he + rw [map_add,map_sum] at hh + simp only [map_smul] at hh + exact eq_sub_of_add_eq (by simpa only [add_comm] using hh.symm) + obtain ⟨E,hFE,hxE,hE⟩ := LinearParameters.add_constrained_parameters F n hF c + (fun s : Index B => q (monomial s.val 1)) (fun s => (p-t).coeff s.val) + (fun s i => hmon s.val i) (by + intro i + rw [hsum,map_sub] + exact F.sub_mem (hpq i) (repr_polynomial_mem F q c hmon t ht i)) + refine ⟨E,hFE,?_,?_⟩ + · intro s + by_cases hs : s.degree < B + · have hh := hxE ⟨s,hs⟩ + rw [coeff_sub] at hh + simpa only [sub_add_cancel] using E.add_mem hh (hFE (ht s)) + · rw [hhigh s (by omega)] + exact hFE (ht s) + · rwa [span_low] at hE + +lemma evaluated_mem (F : IntermediateField K L) {p : MvPolynomial (Fin 2) L} + (hp : InField F p) {x : Fin 2 → L} (hx : ∀ i, x i ∈ F) : eval x p ∈ F := + eval_mem (fun s _ => hp s) hx + +lemma add_algebraic_closure (F : IntermediateField K L) (n : ℕ) + (hF : Algebra.trdeg K F ≤ (n : Cardinal)) : + let E := (algebraicClosure F L).restrictScalars K + F ≤ E ∧ Algebra.trdeg K E ≤ (n : Cardinal) := by + let E := algebraicClosure F L + let : FaithfulSMul F E := (faithfulSMul_iff_algebraMap_injective F E).mpr + (algebraMap F E).injective + let : IsScalarTower K F E := IsScalarTower.of_algebraMap_eq fun _ => rfl + refine ⟨fun x hx => E.algebraMap_mem ⟨x,hx⟩,?_⟩ + change Algebra.trdeg K E ≤ _ + rw [← trdeg_add_eq K F,trdeg_eq_zero (R := F),add_zero] + exact hF + +lemma node_values_mem [CharP L 2] (F : IntermediateField K L) + (a b c d : MvPolynomial (Fin 2) L) (hbF : InField F b) (hcF : InField F c) + (hdF : InField F d) (x : Fin 2 → L) (hd : eval x d ≠ 0) + (hb : (eval x b)^2+x 1*(eval x d)^2=0) + (hc : (eval x c)^2+x 0*(eval x d)^2=0) + (ha : (eval x a)^2+x 0*(eval x b)^2+x 1*(eval x c)^2+x 0*x 1*(eval x d)^2=0) : + (∀ i, x i ∈ algebraicClosure F L) ∧ eval x a ∈ algebraicClosure F L := by + obtain ⟨b₀,hb₀⟩ := inField_lift F hbF + obtain ⟨c₀,hc₀⟩ := inField_lift F hcF + obtain ⟨d₀,hd₀⟩ := inField_lift F hdF + have he (p : MvPolynomial (Fin 2) F) : aeval x p = eval x (p.map F.val.toRingHom) := by + rw [eval_map] + rfl + have hx := FrobeniusPlane.node_coordinates_algebraic x b₀ c₀ d₀ + (by simpa only [he,hd₀] using hd) (by simpa only [he,hb₀,hd₀] using hb) + (by simpa only [he,hc₀,hd₀] using hc) + have hx' : ∀ i, x i ∈ algebraicClosure F L := fun i => mem_algebraicClosure_iff.mpr (hx i) + refine ⟨hx',mem_algebraicClosure_iff.mpr ?_⟩ + apply IsAlgebraic.of_pow (n := 2) (by omega) + apply mem_algebraicClosure_iff.mp + have hFE : F ≤ (algebraicClosure F L).restrictScalars K := fun z hz => + (algebraicClosure F L).algebraMap_mem ⟨z,hz⟩ + have hb' := evaluated_mem ((algebraicClosure F L).restrictScalars K) (inField_mono hFE hbF) hx' + have hc' := evaluated_mem ((algebraicClosure F L).restrictScalars K) (inField_mono hFE hcF) hx' + have hd' := evaluated_mem ((algebraicClosure F L).restrictScalars K) (inField_mono hFE hdF) hx' + have heq : (eval x a)^2 = -(x 0*(eval x b)^2+x 1*(eval x c)^2+x 0*x 1*(eval x d)^2) := by + linear_combination ha + rw [heq] + exact neg_mem (add_mem (add_mem (mul_mem (hx' 0) (pow_mem hb' 2)) + (mul_mem (hx' 1) (pow_mem hc' 2))) (mul_mem (mul_mem (hx' 0) (hx' 1)) (pow_mem hd' 2))) + +end PermanentBorder.CurveFamily + +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +theorem adjoin_polynomial_family {κ : Type*} [Fintype κ] + (F : IntermediateField K L) (n : ℕ) (hF : Algebra.trdeg K F ≤ (n : Cardinal)) + (B : κ → ℕ) (p : κ → MvPolynomial (Fin 2) L) (t : κ → MvPolynomial (Fin 2) K) + (hhigh : ∀ i s, B i ≤ s.degree → (p i).coeff s=algebraMap K L ((t i).coeff s)) + (U : Finset κ) : + ∃ E : IntermediateField K L, F ≤ E ∧ (∀ i ∈ U, InField E (p i)) ∧ + Algebra.trdeg K E ≤ (n+∑ i ∈ U, Fintype.card (Index (B i)) : ℕ) := by + classical + induction U using Finset.induction_on with + | empty => exact ⟨F,le_rfl,by simp,by simpa using hF⟩ + | @insert i U hi ih => + obtain ⟨D,hFD,hpD,hD⟩ := ih + obtain ⟨E,hDE,hpE,hE⟩ := adjoin_polynomial D _ (B i) hD (p i) (by + intro s hs; rw [hhigh i s hs]; exact D.algebraMap_mem ((t i).coeff s)) + refine ⟨E,hFD.trans hDE,?_,?_⟩ + · intro j hj + rcases Finset.mem_insert.mp hj with rfl|hj + · exact hpE + · exact inField_mono hDE (hpD j hj) + · simpa only [Finset.sum_insert hi,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using hE + +noncomputable def pointEvaluation {ι : Type*} (x : ι → Fin 2 → L) : + MvPolynomial (Fin 2) L →ₐ[L] (ι → L) := AlgHom.pi (fun i => aeval (x i)) + +lemma pointEvaluation_apply {ι : Type*} (x : ι → Fin 2 → L) + (p : MvPolynomial (Fin 2) L) (i : ι) : pointEvaluation x p i = eval (x i) p := by + simp [pointEvaluation,aeval_def] + +theorem node_parameter_bound [CharP L 2] {ι : Type u} [Fintype ι] + (x : ι → Fin 2 → L) (a b c d : MvPolynomial (Fin 2) L) + (B₀ : ℕ) (B : Fin 3 → ℕ) (t₀ : MvPolynomial (Fin 2) K) + (t : Fin 3 → MvPolynomial (Fin 2) K) + (h₀ : ∀ s, B₀ ≤ s.degree → a.coeff s=algebraMap K L (t₀.coeff s)) + (h : ∀ i s, B i ≤ s.degree → (![b,c,d] i).coeff s=algebraMap K L ((t i).coeff s)) + (hd : ∀ i, eval (x i) d ≠ 0) + (hb : ∀ i, (eval (x i) b)^2+x i 1*(eval (x i) d)^2=0) + (hc : ∀ i, (eval (x i) c)^2+x i 0*(eval (x i) d)^2=0) + (ha : ∀ i, (eval (x i) a)^2+x i 0*(eval (x i) b)^2+ + x i 1*(eval (x i) c)^2+x i 0*x i 1*(eval (x i) d)^2=0) : + ∃ (E : IntermediateField K L) (n : ℕ), InField E a ∧ InField E b ∧ InField E c ∧ + InField E d ∧ Algebra.trdeg K E ≤ (n : Cardinal) ∧ + n+finrank L (filtered (pointEvaluation x) B₀) ≤ + Fintype.card (Index B₀)+∑ i, Fintype.card (Index (B i)) := by + classical + have hbot : Algebra.trdeg K (⊥ : IntermediateField K L) ≤ (0 : Cardinal) := by rw [trdeg_eq_zero] + obtain ⟨F,_,hpF,hF⟩ := adjoin_polynomial_family (⊥ : IntermediateField K L) 0 hbot + B ![b,c,d] t h Finset.univ + simp only [Finset.mem_univ,forall_const,zero_add] at hpF hF + let D := (algebraicClosure F L).restrictScalars K + obtain ⟨hFD,hD⟩ := add_algebraic_closure F _ hF + have hn := fun i => node_values_mem F a b c d (hpF 0) (hpF 1) (hpF 2) + (x i) (hd i) (hb i) (hc i) (ha i) + obtain ⟨E,hDE,hpE,hE⟩ := add_evaluated_polynomial D _ B₀ hD (pointEvaluation x) + (Pi.basisFun L ι) (by + intro s i + rw [Pi.basisFun_repr,pointEvaluation_apply] + apply evaluated_mem D _ (hn i).1 + intro j + rw [coeff_monomial] + split_ifs <;> simp) + a (t₀.map (algebraMap K L)) (inField_map D _) (by + intro s hs; rw [coeff_map]; exact h₀ s hs) + (by intro i; rw [Pi.basisFun_repr,pointEvaluation_apply]; exact (hn i).2) + refine ⟨E,_,hpE,inField_mono (hFD.trans hDE) (hpF 0), + inField_mono (hFD.trans hDE) (hpF 1),inField_mono (hFD.trans hDE) (hpF 2),hE,?_⟩ + have hr := filtered_rank_le (pointEvaluation x) B₀ + omega + +end PermanentBorder.CurveFamily + +namespace PermanentBorder.FrobeniusPlane +open MvPolynomial +variable {K : Type*} [Field K] [CharP K 2] + +abbrev Plane (K : Type*) [CommSemiring K] := MvPolynomial (Fin 2) K + +noncomputable def squareForm (a b c d : Plane K) : Plane K := + a^2 + X 0*b^2 + X 1*c^2 + X 0*X 1*d^2 + +lemma squareForm_add (a b c d a' b' c' d' : Plane K) : + squareForm (a+a') (b+b') (c+c') (d+d') = + squareForm a b c d + squareForm a' b' c' d' := by + have htwo : (2 : Plane K) = 0 := CharP.cast_eq_zero _ 2 + simp only [squareForm, add_sq, htwo, zero_mul, add_zero] + ring + +omit [CharP K 2] in +lemma squareForm_mul_zero (a b c d : Plane K) : + squareForm a b c d * X 0 = squareForm (X 0*b) a (X 0*d) c := by + unfold squareForm + ring + +omit [CharP K 2] in +lemma squareForm_mul_one (a b c d : Plane K) : + squareForm a b c d * X 1 = squareForm (X 1*c) (X 1*d) a b := by + unfold squareForm + ring + +theorem exists_squareForm [PerfectRing K 2] (f : Plane K) : + ∃ a b c d : Plane K, f = squareForm a b c d := by + induction f using MvPolynomial.induction_on with + | C a => + refine ⟨C ((frobeniusEquiv K 2).symm a),0,0,0,?_⟩ + simp only [squareForm, zero_pow (by omega : 2 ≠ 0), mul_zero, add_zero] + rw [← map_pow, frobeniusEquiv_symm_pow_p] + | add f g hf hg => + obtain ⟨a,b,c,d,rfl⟩ := hf + obtain ⟨a',b',c',d',rfl⟩ := hg + exact ⟨a+a',b+b',c+c',d+d',(squareForm_add ..).symm⟩ + | mul_X f i hf => + obtain ⟨a,b,c,d,rfl⟩ := hf + fin_cases i + · exact ⟨X 0*b,a,X 0*d,c,squareForm_mul_zero ..⟩ + · exact ⟨X 1*c,X 1*d,a,b,squareForm_mul_one ..⟩ + +lemma pderiv_square (i : Fin 2) (a : Plane K) : pderiv i (a^2) = 0 := by + have htwo : (2 : Plane K) = 0 := CharP.cast_eq_zero _ 2 + simp [htwo] + +lemma squareForm_partial_zero (a b c d : Plane K) : + pderiv 0 (squareForm a b c d) = b^2 + X 1*d^2 := by + have htwo : (2 : Plane K) = 0 := CharP.cast_eq_zero _ 2 + simp [squareForm, htwo, mul_comm] + +lemma squareForm_partial_one (a b c d : Plane K) : + pderiv 1 (squareForm a b c d) = c^2 + X 0*d^2 := by + have htwo : (2 : Plane K) = 0 := CharP.cast_eq_zero _ 2 + simp [squareForm, htwo, mul_comm] + +lemma squareForm_mixed (a b c d : Plane K) : + pderiv 1 (pderiv 0 (squareForm a b c d)) = d^2 := by + rw [squareForm_partial_zero] + have htwo : (2 : Plane K) = 0 := CharP.cast_eq_zero _ 2 + simp [htwo] + +theorem wild_zero_iff (a b c d : Plane K) (p : Fin 2 → K) : + (eval p (squareForm a b c d) = 0 ∧ + eval p (pderiv 0 (squareForm a b c d)) = 0 ∧ + eval p (pderiv 1 (squareForm a b c d)) = 0 ∧ + eval p (pderiv 1 (pderiv 0 (squareForm a b c d))) = 0) ↔ + eval p a = 0 ∧ eval p b = 0 ∧ eval p c = 0 ∧ eval p d = 0 := by + rw [squareForm_mixed, squareForm_partial_zero, squareForm_partial_one] + simp only [map_add, map_mul, map_pow, eval_X] + constructor + · rintro ⟨hf,hb,hc,hd⟩ + have hd' : eval p d = 0 := (pow_eq_zero_iff (by omega : 2 ≠ 0)).mp hd + simp only [hd', zero_pow (by omega : 2 ≠ 0), mul_zero, add_zero] at hb hc + have hb' : eval p b = 0 := (pow_eq_zero_iff (by omega : 2 ≠ 0)).mp hb + have hc' : eval p c = 0 := (pow_eq_zero_iff (by omega : 2 ≠ 0)).mp hc + have ha' : eval p a = 0 := by + apply (pow_eq_zero_iff (by omega : 2 ≠ 0)).mp + simpa [squareForm,hb',hc',hd'] using hf + exact ⟨ha',hb',hc',hd'⟩ + · rintro ⟨ha,hb,hc,hd⟩ + simp [squareForm,ha,hb,hc,hd] + +end PermanentBorder.FrobeniusPlane + +namespace PermanentBorder.FrobeniusPlane +open MvPolynomial +variable {K : Type*} [Field K] [CharP K 2] + +lemma squareForm_eq_zero_iff (a b c d : Plane K) : + squareForm a b c d = 0 ↔ a = 0 ∧ b = 0 ∧ c = 0 ∧ d = 0 := by + constructor + · intro hf + have hd : d = 0 := by + have hh := congrArg (fun f : Plane K => pderiv 1 (pderiv 0 f)) hf + rw [squareForm_mixed] at hh + simpa using hh + have hb : b = 0 := by + have hh := congrArg (pderiv (0 : Fin 2)) hf + rw [squareForm_partial_zero, hd] at hh + simpa using hh + have hc : c = 0 := by + have hh := congrArg (pderiv (1 : Fin 2)) hf + rw [squareForm_partial_one, hd] at hh + simpa using hh + have ha : a = 0 := by simpa [squareForm, hb, hc, hd] using hf + exact ⟨ha,hb,hc,hd⟩ + · rintro ⟨rfl,rfl,rfl,rfl⟩ + simp [squareForm] + +lemma squareForm_injective {a b c d a' b' c' d' : Plane K} + (h : squareForm a b c d = squareForm a' b' c' d') : + a = a' ∧ b = b' ∧ c = c' ∧ d = d' := by + have hz : squareForm (a+a') (b+b') (c+c') (d+d') = 0 := by + rw [squareForm_add,h] + simpa using (CharTwo.add_self_eq_zero (squareForm a' b' c' d')) + rcases (squareForm_eq_zero_iff ..).mp hz with ⟨ha,hb,hc,hd⟩ + exact ⟨CharTwo.add_eq_zero.mp ha, CharTwo.add_eq_zero.mp hb, + CharTwo.add_eq_zero.mp hc, CharTwo.add_eq_zero.mp hd⟩ + +lemma wild_ideal_eq (a b c d : Plane K) : + Ideal.span {squareForm a b c d, + pderiv 0 (squareForm a b c d), + pderiv 1 (squareForm a b c d), + pderiv 1 (pderiv 0 (squareForm a b c d))} = + Ideal.span {a^2,b^2,c^2,d^2} := by + rw [squareForm_mixed, squareForm_partial_zero, squareForm_partial_one] + let J : Ideal (Plane K) := Ideal.span {a^2,b^2,c^2,d^2} + let W : Ideal (Plane K) := Ideal.span + {squareForm a b c d,b^2+X 1*d^2,c^2+X 0*d^2,d^2} + change W = J + have ha : a^2 ∈ J := Ideal.subset_span (by simp) + have hb : b^2 ∈ J := Ideal.subset_span (by simp) + have hc : c^2 ∈ J := Ideal.subset_span (by simp) + have hd : d^2 ∈ J := Ideal.subset_span (by simp) + have hwd : d^2 ∈ W := Ideal.subset_span (by simp) + have hwb : b^2 ∈ W := by + have hh : b^2+X 1*d^2 ∈ W := Ideal.subset_span (by simp) + exact (W.add_mem_iff_left (W.mul_mem_left _ hwd)).mp hh + have hwc : c^2 ∈ W := by + have hh : c^2+X 0*d^2 ∈ W := Ideal.subset_span (by simp) + exact (W.add_mem_iff_left (W.mul_mem_left _ hwd)).mp hh + have hwa : a^2 ∈ W := by + have hh : squareForm a b c d ∈ W := Ideal.subset_span (by simp) + dsimp only [squareForm] at hh + exact (W.add_mem_iff_left (W.mul_mem_left _ hwb)).mp + ((W.add_mem_iff_left (W.mul_mem_left _ hwc)).mp + ((W.add_mem_iff_left (W.mul_mem_left _ hwd)).mp hh)) + apply le_antisymm + · apply Ideal.span_le.mpr + intro f hf + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hf + rcases hf with rfl|rfl|rfl|rfl + · exact J.add_mem (J.add_mem (J.add_mem ha (J.mul_mem_left _ hb)) + (J.mul_mem_left _ hc)) (J.mul_mem_left _ hd) + · exact J.add_mem hb (J.mul_mem_left _ hd) + · exact J.add_mem hc (J.mul_mem_left _ hd) + · exact hd + · apply Ideal.span_le.mpr + intro f hf + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hf + rcases hf with rfl|rfl|rfl|rfl + · exact hwa + · exact hwb + · exact hwc + · exact hwd + +omit [CharP K 2] in +lemma squareForm_mul (r a b c d : Plane K) : + squareForm (r*a) (r*b) (r*c) (r*d) = r^2 * squareForm a b c d := by + unfold squareForm + ring + +theorem existsUnique_squareForm [PerfectRing K 2] (f : Plane K) : + ∃! v : Fin 4 → Plane K, f = squareForm (v 0) (v 1) (v 2) (v 3) := by + obtain ⟨a,b,c,d,h⟩ := exists_squareForm f + refine ⟨![a,b,c,d],h,?_⟩ + intro v hv + have hh := squareForm_injective (hv.symm.trans h) + funext i + fin_cases i + · exact hh.1 + · exact hh.2.1 + · exact hh.2.2.1 + · exact hh.2.2.2 + +end PermanentBorder.FrobeniusPlane + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/SliceCertificates.lean b/lean/OAI/Algebra/Determinantal/SliceCertificates.lean new file mode 100644 index 0000000000000000000000000000000000000000..6549a08b19ce29b78bc56c7021128d36d30ede6b --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/SliceCertificates.lean @@ -0,0 +1,347 @@ +import OAI.Algebra.Determinantal.SmoothSlices + +namespace OAI + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +lemma homogeneous_piece_certificate_all {K L σ : Type*} [Field K] [Field L] [Algebra K L] + [IsAlgClosed L] [Fintype σ] (I : Ideal (MvPolynomial σ K)) + (hz : ∀ y ∈ zeroLocus L I, y = 0) : + ∃ N : ℕ, ∀ D ≥ N, ∀ f : MvPolynomial σ K, f.IsHomogeneous D → f ∈ I := by + classical + choose M hM using variable_power_certificate I hz + refine ⟨(∑ j, M j)+1, ?_⟩ + intro D hD f hf + rw [← f.support_sum_monomial_coeff] + apply I.sum_mem + intro s hs + apply monomial_mem_of_variable_powers I M hM + have hd : s.degree = D := by + rw [Finsupp.degree_eq_weight_one] + exact hf (mem_support_iff.mp hs) + omega + +lemma macaulay_surjective_zero {K σ ι : Type*} [Field K] [Fintype σ] [Fintype ι] + (F : ι → MvPolynomial σ K) (e : ι → ℕ) (hh : ∀ i, (F i).IsHomogeneous (e i)) + (D : ℕ) (hM : Function.Surjective (macaulayMatrix (fun i => (e i : ℤ)) F D).mulVec) + (y : σ → K) (hy : ∀ i, eval y (F i) = 0) : y = 0 := by + have hI : Ideal.span (Set.range F) ≤ RingHom.ker (eval y) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact hy i + have h := (macaulay_surjective_iff _ _ (fun i => homogeneous_intWeight (hh i)) D).mp hM + funext j + have hm : (X j : MvPolynomial σ K)^D ∈ Ideal.span (Set.range F) := by + apply h + apply homogeneous_intWeight + simpa using (isHomogeneous_X K j).pow D + have he := hI hm + change eval y ((X j)^D) = 0 at he + rw [map_pow, eval_X] at he + exact eq_zero_of_pow_eq_zero he + +end PermanentBorder.SliceParameters +namespace PermanentBorder.CI +open MvPolynomial PermanentBorder.SliceParameters +open scoped Classical +variable {ι : Type*} [Fintype ι] + +lemma good_certificate_all (H : ι → MvPolynomial (Option ι) ℂ) (l : Option ι → ℂ) + (e : ι → ℕ) (hh : ∀ i, (H i).IsHomogeneous (e i)) (hg : Good H l) : + ∃ N : ℕ, ∀ D ≥ N, Function.Surjective + (macaulayMatrix (fun i => (degrees e i : ℤ)) (bad H l) D).mulVec := by + have hz : ∀ y ∈ zeroLocus ℂ (Ideal.span (Set.range (bad H l))), y = 0 := by + intro y hy + apply (good_iff_bad H l).mp hg y + intro i + exact hy _ Ideal.mem_span_range_self + obtain ⟨N,hN⟩ := homogeneous_piece_certificate_all (Ideal.span (Set.range (bad H l))) hz + refine ⟨N, fun D hD => ?_⟩ + apply (macaulay_surjective_iff _ _ + (fun i => homogeneous_intWeight (bad_homogeneous H l e hh i)) D).mpr + intro f hf + exact hN D hD f (intWeight_homogeneous hf) + +lemma good_of_certificate (H : ι → MvPolynomial (Option ι) ℂ) (l : Option ι → ℂ) + (e : ι → ℕ) (hh : ∀ i, (H i).IsHomogeneous (e i)) (D : ℕ) + (hM : Function.Surjective (macaulayMatrix (fun i => (degrees e i : ℤ)) (bad H l) D).mulVec) : + Good H l := by + apply (good_iff_bad H l).mpr + exact macaulay_surjective_zero (bad H l) (degrees e) (bad_homogeneous H l e hh) D hM + +end PermanentBorder.CI + +namespace PermanentBorder.CI +open Polynomial Matrix +open scoped Classical + +lemma matrix_right_inverse {K α β : Type*} [Field K] [Fintype α] [Fintype β] + (A : Matrix α β K) (hA : Function.Surjective A.mulVec) : + ∃ B : Matrix β α K, A * B = 1 := by + choose b hb using fun i : α => hA (Pi.single i 1) + refine ⟨fun j i => b i j, ?_⟩ + ext i j + change (A.mulVec (b j)) i = (1 : Matrix α α K) i j + rw [hb] + simp [Matrix.one_apply, Pi.single_apply] + +lemma rank_curve {K α β : Type*} [Field K] [Fintype α] [Fintype β] + (A : Matrix α β K[X]) + (h0 : Function.Surjective (A.map (evalRingHom (0 : K))).mulVec) + (h1 : Function.Surjective (A.map (evalRingHom (1 : K))).mulVec) : + ∃ q : K[X], q.eval 0 = 1 ∧ q.eval 1 = 1 ∧ + ∀ t : K, q.eval t ≠ 0 → Function.Surjective (A.map (evalRingHom t)).mulVec := by + obtain ⟨b0,hb0⟩ := matrix_right_inverse _ h0 + obtain ⟨b1,hb1⟩ := matrix_right_inverse _ h1 + let B : Matrix β α K[X] := fun i j => C (b0 i j) + X * (C (b1 i j) - C (b0 i j)) + have hB0 : B.map (evalRingHom (0 : K)) = b0 := by + ext i j + change (C (b0 i j) + X * (C (b1 i j) - C (b0 i j))).eval _ = _ + simp + have hB1 : B.map (evalRingHom (1 : K)) = b1 := by + ext i j + change (C (b0 i j) + X * (C (b1 i j) - C (b0 i j))).eval _ = _ + simp + refine ⟨(A*B).det, ?_, ?_, ?_⟩ + · rw [show ((A*B).det).eval 0 = ((A*B).map (evalRingHom (0 : K))).det from + (evalRingHom (0 : K)).map_det (A*B)] + rw [Matrix.map_mul, hB0, hb0, Matrix.det_one] + · rw [show ((A*B).det).eval 1 = ((A*B).map (evalRingHom (1 : K))).det from + (evalRingHom (1 : K)).map_det (A*B)] + rw [Matrix.map_mul, hB1, hb1, Matrix.det_one] + · intro t ht + have hu : IsUnit ((A*B).map (evalRingHom t)) := by + apply (Matrix.isUnit_iff_isUnit_det _).mpr + apply isUnit_iff_ne_zero.mpr + rw [← RingHom.mapMatrix_apply, ← RingHom.map_det] + exact ht + have hs := Matrix.mulVec_surjective_iff_isUnit.mpr hu + intro v + obtain ⟨x,hx⟩ := hs v + refine ⟨(B.map (evalRingHom t)).mulVec x, ?_⟩ + rw [Matrix.mulVec_mulVec] + simpa only [Matrix.map_mul] using hx + +lemma polynomial_nonzero_preconnected (q : ℂ[X]) (hq : q ≠ 0) : + IsPreconnected {t : ℂ | q.eval t ≠ 0} := by + have hs : {t : ℂ | q.eval t = 0}.Finite := q.finite_setOfPred_isRoot hq + have hdim : 1 < Module.rank ℝ ℂ := by rw [Complex.rank_real_complex]; norm_num + exact (hs.countable.isPathConnected_compl_of_one_lt_rank hdim).isConnected.isPreconnected + +end PermanentBorder.CI + +namespace PermanentBorder.CI +open MvPolynomial PermanentBorder.SliceParameters +open scoped Classical +variable {ι : Type*} [Fintype ι] + +lemma map_linear {R S : Type*} [CommRing R] [CommRing S] (φ : R →+* S) + (l : Option ι → R) : map φ (linear l) = linear (fun j => φ (l j)) := by + simp [linear] + +omit [Fintype ι] in +lemma map_square {R S : Type*} [CommRing R] [CommRing S] (φ : R →+* S) + (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) : + (square H l).map (map φ) = square (fun i => map φ (H i)) (fun j => φ (l j)) := by + ext i j + cases i <;> simp [square, pderiv_map] + +lemma map_bad {R S : Type*} [CommRing R] [CommRing S] (φ : R →+* S) + (H : ι → MvPolynomial (Option ι) R) (l : Option ι → R) (i : Option ι) : + map φ (bad H l i) = bad (fun i => map φ (H i)) (fun j => φ (l j)) i := by + cases i with + | none => simp only [bad, Option.elim'_none, map_mul, RingHom.map_det, RingHom.mapMatrix_apply, map_linear, map_square] + | some i => rfl + +noncomputable def Hline (H0 H1 : ι → MvPolynomial (Option ι) ℂ) : + ι → MvPolynomial (Option ι) (Polynomial ℂ) := fun i => + map Polynomial.C (H0 i) + C Polynomial.X * (map Polynomial.C (H1 i) - map Polynomial.C (H0 i)) +noncomputable def lline (l0 l1 : Option ι → ℂ) : Option ι → Polynomial ℂ := fun j => + Polynomial.C (l0 j) + Polynomial.X * (Polynomial.C (l1 j) - Polynomial.C (l0 j)) +noncomputable def Htime (H0 H1 : ι → MvPolynomial (Option ι) ℂ) (t : ℂ) : + ι → MvPolynomial (Option ι) ℂ := fun i => H0 i + C t * (H1 i - H0 i) +noncomputable def ltime (l0 l1 : Option ι → ℂ) (t : ℂ) : Option ι → ℂ := fun j => + l0 j + t * (l1 j - l0 j) + +omit [Fintype ι] in +@[simp] lemma Htime_zero (H0 H1 : ι → MvPolynomial (Option ι) ℂ) : Htime H0 H1 0 = H0 := by + funext i; simp [Htime] +omit [Fintype ι] in +@[simp] lemma Htime_one (H0 H1 : ι → MvPolynomial (Option ι) ℂ) : Htime H0 H1 1 = H1 := by + funext i; simp [Htime] +omit [Fintype ι] in +@[simp] lemma ltime_zero (l0 l1 : Option ι → ℂ) : ltime l0 l1 0 = l0 := by + funext i; simp [ltime] +omit [Fintype ι] in +@[simp] lemma ltime_one (l0 l1 : Option ι → ℂ) : ltime l0 l1 1 = l1 := by + funext i; simp [ltime] + +omit [Fintype ι] in +lemma Hline_map (H0 H1 : ι → MvPolynomial (Option ι) ℂ) (t : ℂ) (i : ι) : + map (Polynomial.evalRingHom t) (Hline H0 H1 i) = Htime H0 H1 t i := by + have hh : (Polynomial.evalRingHom t).comp Polynomial.C = RingHom.id ℂ := by + ext x; simp + simp [Hline, Htime, map_map, hh, MvPolynomial.map_id] +omit [Fintype ι] in +lemma lline_eval (l0 l1 : Option ι → ℂ) (t : ℂ) (j : Option ι) : + (lline l0 l1 j).eval t = ltime l0 l1 t j := by simp [lline, ltime] + +omit [Fintype ι] in +lemma Htime_homogeneous (H0 H1 : ι → MvPolynomial (Option ι) ℂ) (e : ι → ℕ) + (h0 : ∀ i, (H0 i).IsHomogeneous (e i)) (h1 : ∀ i, (H1 i).IsHomogeneous (e i)) + (t : ℂ) (i : ι) : (Htime H0 H1 t i).IsHomogeneous (e i) := by + apply (h0 i).add + simpa using (isHomogeneous_C (Option ι) t).mul ((h1 i).sub (h0 i)) + +lemma good_curve (H0 H1 : ι → MvPolynomial (Option ι) ℂ) (l0 l1 : Option ι → ℂ) + (e : ι → ℕ) (h0 : ∀ i, (H0 i).IsHomogeneous (e i)) + (h1 : ∀ i, (H1 i).IsHomogeneous (e i)) (hg0 : Good H0 l0) (hg1 : Good H1 l1) : + ∃ q : Polynomial ℂ, q.eval 0 = 1 ∧ q.eval 1 = 1 ∧ + ∀ t, q.eval t ≠ 0 → Good (Htime H0 H1 t) (ltime l0 l1 t) := by + obtain ⟨N0,hN0⟩ := good_certificate_all H0 l0 e h0 hg0 + obtain ⟨N1,hN1⟩ := good_certificate_all H1 l1 e h1 hg1 + let D := max N0 N1 + let A := macaulayMatrix (fun i => (degrees e i : ℤ)) (bad (Hline H0 H1) (lline l0 l1)) D + have hA (t : ℂ) : A.map (Polynomial.evalRingHom t) = + macaulayMatrix (fun i => (degrees e i : ℤ)) (bad (Htime H0 H1 t) (ltime l0 l1 t)) D := by + rw [← macaulayMatrix_map] + congr 1 + funext i + rw [map_bad] + congr 2 + · exact funext (Hline_map H0 H1 t) + · exact funext (lline_eval l0 l1 t) + have ha0 : Function.Surjective (A.map (Polynomial.evalRingHom (0 : ℂ))).mulVec := by + rw [hA]; simp only [Htime_zero, ltime_zero] + exact hN0 D (le_max_left _ _) + have ha1 : Function.Surjective (A.map (Polynomial.evalRingHom (1 : ℂ))).mulVec := by + rw [hA]; simp only [Htime_one, ltime_one] + exact hN1 D (le_max_right _ _) + obtain ⟨q,hq0,hq1,hq⟩ := rank_curve A ha0 ha1 + refine ⟨q,hq0,hq1,fun t ht => ?_⟩ + apply good_of_certificate _ _ e (Htime_homogeneous H0 H1 e h0 h1 t) D + rw [← hA] + exact hq t ht + +end PermanentBorder.CI + +namespace PermanentBorder.CI +open MvPolynomial +open scoped Classical +variable {ι : Type*} [Fintype ι] + +lemma linear_ltime (l0 l1 : Option ι → ℂ) (t : ℂ) : + linear (ltime l0 l1 t) = linear l0 + C t * (linear l1 - linear l0) := by + simp only [linear, ltime, map_add, map_mul, map_sub, add_mul, mul_sub, sub_mul, + Finset.sum_add_distrib, Finset.sum_sub_distrib, Finset.mul_sum] + simp only [mul_assoc] + +lemma normalized_time (H0 H1 : ι → MvPolynomial (Option ι) ℂ) + (l0 l1 : Option ι → ℂ) (t : ℂ) (i : Option ι) : + normalized (Htime H0 H1 t) (ltime l0 l1 t) i = + normalized H0 l0 i + C t * (normalized H1 l1 i - normalized H0 l0 i) := by + cases i with + | none => simp only [normalized, Option.elim'_none, linear_ltime]; ring + | some i => rfl + +lemma contDiff_normalized_time (H0 H1 : ι → MvPolynomial (Option ι) ℂ) + (l0 l1 : Option ι → ℂ) : + ContDiff ℂ 1 (fun z : ℂ × (Option ι → ℂ) => + fun i => eval z.2 (normalized (Htime H0 H1 z.1) (ltime l0 l1 z.1) i)) := by + apply contDiff_pi.mpr + intro i + simp only [normalized_time, map_add, map_mul, map_sub, eval_C] + exact ((contDiff_eval (normalized H0 l0 i)).comp contDiff_snd).add + (contDiff_fst.mul (((contDiff_eval (normalized H1 l1 i)).comp contDiff_snd).sub + ((contDiff_eval (normalized H0 l0 i)).comp contDiff_snd))) + +theorem good_card (H : ι → MvPolynomial (Option ι) ℂ) (l : Option ι → ℂ) + (e : ι → ℕ) (he : ∀ i, 0 < e i) (hh : ∀ i, (H i).IsHomogeneous (e i)) + (hg : Good H l) : Nat.card (Roots H l) = ∏ i, e i := by + obtain ⟨q,hq0,hq1,hq⟩ := good_curve H (powers e) l coordinate e hh + (powers_homogeneous e) hg (powers_good e he) + have hqn : q ≠ 0 := by intro hz; simp [hz] at hq0 + let s : Set ℂ := {t | q.eval t ≠ 0} + let : PreconnectedSpace s := isPreconnected_iff_preconnectedSpace.mp + (polynomial_nonzero_preconnected q hqn) + let a : s := ⟨0,by simp [s,hq0]⟩ + let b : s := ⟨1,by simp [s,hq1]⟩ + have hc := normalized_count_constant (Htime H (powers e)) (ltime l coordinate) e + (Htime_homogeneous H (powers e) e hh (powers_homogeneous e)) + (contDiff_normalized_time H (powers e) l coordinate) s hq a b + simpa only [a,b,Htime_zero,Htime_one,ltime_zero,ltime_one,powers_card e he] using hc + +end PermanentBorder.CI + +namespace PermanentBorder.Polar +open MvPolynomial +open scoped TensorProduct + +variable {K R L : Type*} [CommRing K] [CommRing R] [CommRing L] + [Algebra K R] [Algebra K L] [Algebra R L] [IsScalarTower K R L] + +noncomputable def extendDerivation [Algebra.FormallyEtale R L] + (D : Derivation K R L) : Derivation K L L := + ((D.liftKaehlerDifferential.liftBaseChange L).comp + (KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale K R L).symm.toLinearMap).compDer + (KaehlerDifferential.D K L) + +lemma extendDerivation_algebraMap [Algebra.FormallyEtale R L] + (D : Derivation K R L) (x : R) : + extendDerivation D (algebraMap R L x) = D x := by + simp [extendDerivation, LinearMap.compDer, + KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale_symm_D_algebraMap] + +section Generic +universe u v +variable (K : Type u) [Field K] [CharZero K] (ι : Type v) + +abbrev GenericField := AlgebraicClosure (FractionRing (MvPolynomial ι K)) + +noncomputable def genericParameter (i : ι) : GenericField K ι := + algebraMap (MvPolynomial ι K) (GenericField K ι) (X i) + +lemma generic_formallyEtale : + Algebra.FormallyEtale (MvPolynomial ι K) (GenericField K ι) := by + let R := MvPolynomial ι K + let Q := FractionRing R + have : Algebra.FormallyEtale R Q := + Algebra.FormallyEtale.of_isLocalization (nonZeroDivisors R) + have : Algebra.FormallyEtale Q (GenericField K ι) := + Algebra.FormallyEtale.of_isSeparable Q (GenericField K ι) + exact Algebra.FormallyEtale.comp R Q (GenericField K ι) + +noncomputable def parameterDerivation (i : ι) : + Derivation K (GenericField K ι) (GenericField K ι) := by + classical + letI := generic_formallyEtale K ι + exact extendDerivation (MvPolynomial.mkDerivation K (Pi.single i 1)) + +lemma parameterDerivation_parameter [DecidableEq ι] (i j : ι) : + parameterDerivation K ι i (genericParameter K ι j) = if i = j then 1 else 0 := by + classical + simp [parameterDerivation, genericParameter, extendDerivation_algebraMap, Pi.single_apply, + eq_comm] + +end Generic + +section ChainRule +variable {K L σ : Type*} [CommRing K] [CommRing L] [Algebra K L] [Fintype σ] + +lemma derivation_aeval (D : Derivation K L L) (x : σ → L) (f : MvPolynomial σ K) : + D (aeval x f) = ∑ j, aeval x (pderiv j f) * D (x j) := by + classical + induction f using MvPolynomial.induction_on with + | C a => simp + | add f g hf hg => simp [hf, hg, add_mul, Finset.sum_add_distrib] + | mul_X f i hf => + simp only [map_mul, aeval_X, Derivation.leibniz, smul_eq_mul, hf, + map_add, pderiv_X] + simp only [add_mul, Finset.sum_add_distrib, mul_assoc, ← Finset.mul_sum] + simp [Pi.single_apply, mul_comm] + +end ChainRule +end PermanentBorder.Polar + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/SmoothSlices.lean b/lean/OAI/Algebra/Determinantal/SmoothSlices.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c7fdf8887fb80c9cd926badc9257611fdc40256 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/SmoothSlices.lean @@ -0,0 +1,430 @@ +import OAI.Algebra.Determinantal.RegularSections + +namespace OAI + +namespace PermanentBorder.SliceParameters + +open MvPolynomial + +lemma homogeneous_aeval_scale {K L σ : Type*} [CommSemiring K] [CommSemiring L] + [Algebra K L] {f : MvPolynomial σ K} {r : ℕ} (hf : f.IsHomogeneous r) + (a : L) (x : σ → L) : + aeval (fun i => a * x i) f = a^r * aeval x f := by + classical + conv_lhs => rw [← f.support_sum_monomial_coeff] + conv_rhs => rw [← f.support_sum_monomial_coeff] + simp only [map_sum, aeval_monomial, Finset.mul_sum] + apply Finset.sum_congr rfl + intro s hs + rw [hf.degree_eq_sum_deg_support hs] + simp only [Finsupp.prod, mul_pow, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum] + ring + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.CI +open MvPolynomial Topology +open scoped Topology Classical +variable {ι : Type*} [Fintype ι] + +lemma normalized_eval_zero_iff (H : ι → MvPolynomial (Option ι) ℂ) (l y : Option ι → ℂ) : + (fun i => eval y (normalized H l i)) = 0 ↔ + (∀ i, eval y (H i) = 0) ∧ eval y (linear l) = 1 := by + constructor + · intro h + constructor + · intro i; exact congrFun h (some i) + · have hh := congrFun h none + simpa [normalized, sub_eq_zero] using hh + · rintro ⟨hH,hl⟩ + funext i + cases i <;> simp [normalized, hH, hl] + +lemma good_derivative_invertible (H : ι → MvPolynomial (Option ι) ℂ) + (l y : Option ι → ℂ) (h : Good H l) + (hy : (fun i => eval y (normalized H l i)) = 0) : + (fderiv ℂ (fun y i => eval y (normalized H l i)) y).IsInvertible := by + have hh := (normalized_eval_zero_iff H l y).mp hy + have hn : y ≠ 0 := by + intro hz + have := hh.2 + rw [eval_linear] at this + simp [hz] at this + have hd := (h y hn hh.1).2 + have hj : jacobian (normalized H l) y = (square H l).map (eval y) := by + ext i j + exact congrArg (eval y) (pderiv_normalized H l i j) + apply system_fderiv_invertible + rwa [hj] + +lemma fderiv_parameter_slice {V : Type*} [NormedAddCommGroup V] [NormedSpace ℂ V] + {F : ℂ × V → V} (hF : ContDiff ℂ 1 F) (t : ℂ) (x : V) : + fderiv ℂ (fun x => F (t,x)) x = + fderiv ℂ F (t,x) ∘L ContinuousLinearMap.inr ℂ ℂ V := by + have hi : HasFDerivAt (fun x : V => (t,x)) (ContinuousLinearMap.inr ℂ ℂ V) x := by + simpa [ContinuousLinearMap.inr] using + (hasFDerivAt_const (𝕜 := ℂ) t x).prodMk (hasFDerivAt_id (𝕜 := ℂ) x) + exact ((hF.differentiable (by decide) (t,x)).hasFDerivAt.comp x hi).fderiv + +noncomputable def linearEval (l : Option ι → ℂ) : (Option ι → ℂ) →ₗ[ℂ] ℂ := + { toFun := fun y => eval y (linear l) + map_add' := by intro x y; simp [eval_linear, mul_add, Finset.sum_add_distrib] + map_smul' := by intro c y; simp [eval_linear, Finset.mul_sum, mul_left_comm, mul_add] } + +@[simp] lemma linearEval_apply (l y : Option ι → ℂ) : + linearEval l y = eval y (linear l) := by + rfl + +abbrev FamilyRoots (H : ℂ → ι → MvPolynomial (Option ι) ℂ) + (l : ℂ → Option ι → ℂ) (s : Set ℂ) := + {z : s × (Option ι → ℂ) // (∀ i, eval z.2 (H z.1.val i) = 0) ∧ + eval z.2 (linear (l z.1.val)) = 1} + +def familyProjection (H : ℂ → ι → MvPolynomial (Option ι) ℂ) + (l : ℂ → Option ι → ℂ) (s : Set ℂ) : FamilyRoots H l s → s := fun z => z.val.1 + +lemma normalized_family_proper (H : ℂ → ι → MvPolynomial (Option ι) ℂ) + (l : ℂ → Option ι → ℂ) (e : ι → ℕ) + (hh : ∀ t i, (H t i).IsHomogeneous (e i)) + (hcH : ∀ i, Continuous (fun z : ℂ × (Option ι → ℂ) => eval z.2 (H z.1 i))) + (hcL : Continuous (fun z : ℂ × (Option ι → ℂ) => eval z.2 (linear (l z.1)))) + (s : Set ℂ) (hg : ∀ t ∈ s, Good (H t) (l t)) : + IsProperMap (familyProjection H l s) := by + let V := Option ι → ℂ + have hval : Continuous (fun z : s × V => (z.1.val,z.2) : s × V → ℂ × V) := by fun_prop + have hc (i : ι) : Continuous (fun z : s × V => eval z.2 (H z.1.val i)) := + Continuous.comp (f := fun z : s × V => (z.1.val,z.2)) (hcH i) hval + have hci (i : ι) : IsClosed {z : s × V | eval z.2 (H z.1.val i) = 0} := + isClosed_eq (hc i) continuous_const + have hclosed : IsClosed {z : s × V | ∀ i, eval z.2 (H z.1.val i) = 0} := by + simpa only [Set.ofPred_forall] using isClosed_iInter hci + have hL : Continuous (fun z : s × V => linearEval (l z.1.val) z.2) := by + simp only [linearEval_apply] + exact Continuous.comp (f := fun z : s × V => (z.1.val,z.2)) hcL hval + apply PermanentBorder.Polar.homogeneous_normalized_proper + (T := s) (V := V) (fun t y => ∀ i, eval y (H t.val i) = 0) hclosed + (L := fun t => linearEval (l t.val)) (hL := hL) + · intro t y c hy i + have hs := PermanentBorder.SliceParameters.homogeneous_aeval_scale (hh t.val i) c y + have he : eval (c • y) (H t.val i) = c ^ e i * eval y (H t.val i) := by + change eval (fun j => c * y j) (H t.val i) = _ + simpa [aeval_def] using hs + rw [he, hy i, mul_zero] + · intro t y hy hz + by_contra hn + exact (hg t.val t.property y hn hy).1 hz + +lemma normalized_family_local (H : ℂ → ι → MvPolynomial (Option ι) ℂ) + (l : ℂ → Option ι → ℂ) + (hc : ContDiff ℂ 1 (fun z : ℂ × (Option ι → ℂ) => + fun i => eval z.2 (normalized (H z.1) (l z.1) i))) + (s : Set ℂ) (hg : ∀ t ∈ s, Good (H t) (l t)) : + IsLocalHomeomorph (familyProjection H l s) := by + let V := Option ι → ℂ + let S : ℂ × V → V := fun z i => eval z.2 (normalized (H z.1) (l z.1) i) + let q : {z : ℂ × V // S z = 0} → ℂ := fun z => z.val.1 + let W := q ⁻¹' s + let E : FamilyRoots H l s ≃ₜ W := + { toFun := fun z => ⟨⟨(z.val.1.val,z.val.2), + (normalized_eval_zero_iff _ _ _).mpr z.property⟩,z.val.1.property⟩ + invFun := fun z => ⟨(⟨z.val.val.1,z.property⟩,z.val.val.2), + (normalized_eval_zero_iff _ _ _).mp z.val.property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + have hq : IsLocalHomeomorph (s.restrictPreimage q) := by + apply PermanentBorder.Polar.implicit_zero_projection_on (𝕜 := ℂ) S s + intro z hz + refine ⟨fderiv ℂ S z.val, hc.hasStrictFDerivAt (by decide), ?_⟩ + rw [← fderiv_parameter_slice hc z.val.1 z.val.2] + exact good_derivative_invertible (H z.val.1) (l z.val.1) z.val.2 + (hg z.val.1 hz) z.property + exact hq.comp E.isLocalHomeomorph + +noncomputable def familyFiberEquiv (H : ℂ → ι → MvPolynomial (Option ι) ℂ) + (l : ℂ → Option ι → ℂ) (s : Set ℂ) (t : s) : + (familyProjection H l s ⁻¹' {t}) ≃ Roots (H t.val) (l t.val) where + toFun z := ⟨z.val.val.2, by + have ht : z.val.val.1 = t := z.property + simpa only [← ht] using z.val.property⟩ + invFun y := ⟨⟨(t,y.val),y.property⟩,rfl⟩ + left_inv z := by + apply Subtype.ext + apply Subtype.ext + exact Prod.ext z.property.symm rfl + right_inv _ := rfl + +theorem normalized_count_constant (H : ℂ → ι → MvPolynomial (Option ι) ℂ) + (l : ℂ → Option ι → ℂ) (e : ι → ℕ) + (hh : ∀ t i, (H t i).IsHomogeneous (e i)) + (hc : ContDiff ℂ 1 (fun z : ℂ × (Option ι → ℂ) => + fun i => eval z.2 (normalized (H z.1) (l z.1) i))) + (s : Set ℂ) [PreconnectedSpace s] (hg : ∀ t ∈ s, Good (H t) (l t)) + (a b : s) : + Nat.card (Roots (H a.val) (l a.val)) = Nat.card (Roots (H b.val) (l b.val)) := by + have hcH (i : ι) : Continuous (fun z : ℂ × (Option ι → ℂ) => eval z.2 (H z.1 i)) := + (continuous_apply (some i)).comp hc.continuous + have hcL : Continuous (fun z : ℂ × (Option ι → ℂ) => eval z.2 (linear (l z.1))) := by + have hcont : Continuous (fun z : ℂ × (Option ι → ℂ) => + eval z.2 (normalized (H z.1) (l z.1) none) + (1 : ℂ)) := + ((continuous_apply none).comp hc.continuous).add continuous_const + convert! hcont using 1 + funext z + simp [normalized] + rw [← Nat.card_congr (familyFiberEquiv H l s a), ← Nat.card_congr (familyFiberEquiv H l s b)] + exact PermanentBorder.Polar.proper_localHomeomorph_card + (normalized_family_proper H l e hh hcH hcL s hg) (normalized_family_local H l hc s hg) a b + +end PermanentBorder.CI + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +lemma variable_power_certificate {K L σ : Type*} [Field K] [Field L] [Algebra K L] + [IsAlgClosed L] [Finite σ] (I : Ideal (MvPolynomial σ K)) + (hz : ∀ y ∈ zeroLocus L I, y = 0) (j : σ) : + ∃ n : ℕ, (X j : MvPolynomial σ K)^n ∈ I := by + have hx : (X j : MvPolynomial σ K) ∈ vanishingIdeal K (zeroLocus L I) := by + intro y hy + rw [hz y hy] + simp + rw [vanishingIdeal_zeroLocus_eq_radical] at hx + exact hx + +lemma monomial_mem_of_variable_powers {K σ : Type*} [CommSemiring K] [Fintype σ] + (I : Ideal (MvPolynomial σ K)) (N : σ → ℕ) + (hN : ∀ j, (X j : MvPolynomial σ K)^(N j) ∈ I) + (s : σ →₀ ℕ) (c : K) (hs : (∑ j, N j) < s.degree) : monomial s c ∈ I := by + classical + obtain ⟨j,hj⟩ : ∃ j, N j ≤ s j := by + by_contra h + have hle (j : σ) : s j ≤ N j := le_of_lt (not_le.mp (not_exists.mp h j)) + have hh := Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => hle j) + have hd : s.degree = ∑ j, s j := by + exact Finsupp.sum_fintype s (fun _ n => n) (fun _ => rfl) + rw [hd] at hs + exact (not_le_of_gt hs) hh + have he : Finsupp.single j (N j) + (s - Finsupp.single j (N j)) = s := + add_tsub_cancel_of_le (Finsupp.single_le_iff.mpr hj) + rw [← he, monomial_single_add] + exact I.mul_mem_right _ (hN j) + +theorem homogeneous_piece_certificate {K L σ : Type*} [Field K] [Field L] [Algebra K L] + [IsAlgClosed L] [Fintype σ] (I : Ideal (MvPolynomial σ K)) + (hz : ∀ y ∈ zeroLocus L I, y = 0) : + ∃ D : ℕ, ∀ f : MvPolynomial σ K, f.IsHomogeneous D → f ∈ I := by + classical + choose N hN using variable_power_certificate I hz + refine ⟨(∑ j, N j)+1, ?_⟩ + intro f hf + rw [← f.support_sum_monomial_coeff] + apply I.sum_mem + intro s hs + apply monomial_mem_of_variable_powers I N hN + have hd : s.degree = (∑ j, N j)+1 := by + rw [Finsupp.degree_eq_weight_one] + exact hf (mem_support_iff.mp hs) + omega + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +abbrev DegreeIndex (σ : Type*) (d : ℤ) := {s : σ →₀ ℕ // (s.degree : ℤ) = d} + +instance degreeIndex_finite {σ : Type*} [Finite σ] (d : ℤ) : Finite (DegreeIndex σ d) := by + apply Set.Finite.to_subtype + apply (Finsupp.finite_of_degree_le d.toNat).subset + intro s hs + change s.degree ≤ d.toNat + rw [← hs] + simp + +noncomputable instance degreeIndex_fintype {σ : Type*} [Finite σ] (d : ℤ) : + Fintype (DegreeIndex σ d) := Fintype.ofFinite _ + +lemma intWeight_degree {σ : Type*} (s : σ →₀ ℕ) : + Finsupp.weight (fun _ : σ => (1 : ℤ)) s = (s.degree : ℤ) := by + simp [Finsupp.weight_apply, Finsupp.degree_apply, Finsupp.sum] + +lemma homogeneous_intWeight {K σ : Type*} [CommSemiring K] + {f : MvPolynomial σ K} {d : ℕ} (hf : f.IsHomogeneous d) : + f.IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) d := by + intro s hs + rw [intWeight_degree] + have h : s.degree = d := by + rw [Finsupp.degree_eq_weight_one] + exact hf hs + rw [h] + +lemma intWeight_homogeneous {K σ : Type*} [CommSemiring K] + {f : MvPolynomial σ K} {d : ℕ} + (hf : f.IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) d) : + f.IsHomogeneous d := by + intro s hs + change Finsupp.weight (fun _ : σ => (1 : ℕ)) s = d + rw [← Finsupp.degree_eq_weight_one] + exact_mod_cast (intWeight_degree s ▸ hf hs) + +lemma homogeneous_sum_degree {K σ : Type*} [CommSemiring K] [Finite σ] + {f : MvPolynomial σ K} {d : ℤ} + (hf : f.IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) d) : + f = ∑ s : DegreeIndex σ d, monomial s.val (f.coeff s.val) := by + classical + ext t + rw [coeff_sum] + by_cases ht : (t.degree : ℤ) = d + · rw [Finset.sum_eq_single (⟨t,ht⟩ : DegreeIndex σ d)] + · simp + · intro s _ hs + have he : s.val ≠ t := fun h => hs (Subtype.ext h) + simp [coeff_monomial, he] + · simp + · have hz : f.coeff t = 0 := by + by_contra hn + exact ht (intWeight_degree t ▸ hf hn) + rw [hz] + symm + apply Finset.sum_eq_zero + intro s _ + have he : s.val ≠ t := fun h => ht (h ▸ s.property) + simp [coeff_monomial, he] + +lemma coeff_sum_degree {K σ : Type*} [CommSemiring K] [Finite σ] + (d : ℤ) (b : DegreeIndex σ d → K) (s : DegreeIndex σ d) : + (∑ t : DegreeIndex σ d, monomial t.val (b t)).coeff s.val = b s := by + classical + rw [coeff_sum, Finset.sum_eq_single s] + · simp + · intro t _ ht + have he : t.val ≠ s.val := fun h => ht (Subtype.ext h) + simp [coeff_monomial, he] + · simp + +lemma sum_degree_homogeneous {K σ : Type*} [CommSemiring K] [Finite σ] + (d : ℤ) (b : DegreeIndex σ d → K) : + (∑ t : DegreeIndex σ d, monomial t.val (b t)).IsWeightedHomogeneous + (fun _ : σ => (1 : ℤ)) d := by + apply IsWeightedHomogeneous.sum + intro t _ + exact isWeightedHomogeneous_monomial _ _ _ ((intWeight_degree t.val).trans t.property) + +lemma homogeneous_ext_degree {K σ : Type*} [CommSemiring K] [Finite σ] + {f g : MvPolynomial σ K} {d : ℤ} + (hf : f.IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) d) + (hg : g.IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) d) + (h : ∀ s : DegreeIndex σ d, f.coeff s.val = g.coeff s.val) : f = g := by + rw [homogeneous_sum_degree hf, homogeneous_sum_degree hg] + exact Finset.sum_congr rfl (fun s _ => congrArg (monomial s.val) (h s)) + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +section Matrix +variable {K σ ι : Type*} [CommRing K] [Finite σ] [Fintype ι] + +noncomputable def macaulayMatrix (e : ι → ℤ) (F : ι → MvPolynomial σ K) (D : ℤ) : + Matrix (DegreeIndex σ D) (Σ i : ι, DegreeIndex σ (D-e i)) K := + fun s t => (F t.1 * monomial t.2.val 1).coeff s.val + +noncomputable def macaulayCombination (e : ι → ℤ) (F : ι → MvPolynomial σ K) (D : ℤ) + (b : (Σ i : ι, DegreeIndex σ (D-e i)) → K) : MvPolynomial σ K := + ∑ t, b t • (F t.1 * monomial t.2.val 1) + +lemma coeff_macaulayCombination (e : ι → ℤ) (F : ι → MvPolynomial σ K) (D : ℤ) + (b : (Σ i : ι, DegreeIndex σ (D-e i)) → K) (s : DegreeIndex σ D) : + (macaulayCombination e F D b).coeff s.val = (macaulayMatrix e F D).mulVec b s := by + classical + simp only [macaulayCombination, coeff_sum, coeff_smul, smul_eq_mul, + macaulayMatrix, Matrix.mulVec, dotProduct, mul_comm] + +lemma macaulayCombination_mem (e : ι → ℤ) (F : ι → MvPolynomial σ K) (D : ℤ) + (b : (Σ i : ι, DegreeIndex σ (D-e i)) → K) : + macaulayCombination e F D b ∈ Ideal.span (Set.range F) := by + apply Ideal.sum_mem + intro t _ + exact Submodule.smul_mem ((Ideal.span (Set.range F)).restrictScalars K) _ + (Ideal.mul_mem_right _ _ Ideal.mem_span_range_self) + +lemma macaulayCombination_homogeneous (e : ι → ℤ) (F : ι → MvPolynomial σ K) + (hF : ∀ i, (F i).IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) (e i)) (D : ℤ) + (b : (Σ i : ι, DegreeIndex σ (D-e i)) → K) : + (macaulayCombination e F D b).IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) D := by + apply IsWeightedHomogeneous.sum + intro t _ + apply (weightedHomogeneousSubmodule K (fun _ : σ => (1 : ℤ)) D).smul_mem + have hm : (monomial t.2.val (1 : K)).IsWeightedHomogeneous + (fun _ : σ => (1 : ℤ)) (D-e t.1) := + isWeightedHomogeneous_monomial _ _ _ ((intWeight_degree t.2.val).trans t.2.property) + rw [mem_weightedHomogeneousSubmodule] + simpa only [add_sub_cancel] using (hF t.1).mul hm + +omit [Finite σ] [Fintype ι] in +lemma macaulayMatrix_map {L : Type*} [CommRing L] (φ : K →+* L) + (e : ι → ℤ) (F : ι → MvPolynomial σ K) (D : ℤ) : + macaulayMatrix e (fun i => map φ (F i)) D = (macaulayMatrix e F D).map φ := by + classical + ext s t + change (map φ (F t.1) * monomial t.2.val 1).coeff s.val = + φ ((F t.1 * monomial t.2.val 1).coeff s.val) + rw [← coeff_map, map_mul, map_monomial, φ.map_one] + +end Matrix + +section Surjectivity +variable {K σ ι : Type*} [Field K] [Finite σ] [Fintype ι] + +theorem macaulay_surjective_iff (e : ι → ℤ) (F : ι → MvPolynomial σ K) + (hF : ∀ i, (F i).IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) (e i)) (D : ℤ) : + Function.Surjective (macaulayMatrix e F D).mulVec ↔ + ∀ f : MvPolynomial σ K, + f.IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) D → + f ∈ Ideal.span (Set.range F) := by + classical + constructor + · intro hs f hf + obtain ⟨b,hb⟩ := hs (fun s => f.coeff s.val) + have he : macaulayCombination e F D b = f := by + apply homogeneous_ext_degree (macaulayCombination_homogeneous e F hF D b) hf + intro s + rw [coeff_macaulayCombination, hb] + rw [← he] + exact macaulayCombination_mem e F D b + · intro hs b + let f := ∑ t : DegreeIndex σ D, monomial t.val (b t) + have hf : f.IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) D := + sum_degree_homogeneous D b + obtain ⟨g,hg⟩ := Ideal.mem_span_range_iff_exists_fun.mp (hs f hf) + let g' := fun i => weightedHomogeneousComponent (fun _ : σ => (1 : ℤ)) (D-e i) (g i) + have hg'h (i : ι) : (g' i).IsWeightedHomogeneous (fun _ : σ => (1 : ℤ)) (D-e i) := + weightedHomogeneousComponent_mem _ _ _ + have he : ∑ i, F i * g' i = f := by + simp_rw [g', ← PermanentBorder.Multigraded.project_mul _ (hF _)] + rw [← map_sum] + simp_rw [mul_comm (F _) _] + rw [hg, weightedHomogeneousComponent_eq_self hf] + let c : (Σ i : ι, DegreeIndex σ (D-e i)) → K := fun t => (g' t.1).coeff t.2.val + have hc : macaulayCombination e F D c = f := by + rw [macaulayCombination, Fintype.sum_sigma] + rw [← he] + apply Finset.sum_congr rfl + intro i _ + rw [homogeneous_sum_degree (hg'h i), Finset.mul_sum] + apply Finset.sum_congr rfl + intro s _ + change (g' i).coeff s.val • (F i * monomial s.val 1) = + F i * monomial s.val ((g' i).coeff s.val) + rw [← mul_smul_comm, smul_monomial, smul_eq_mul, mul_one] + refine ⟨c, ?_⟩ + ext s + rw [← coeff_macaulayCombination, hc] + exact coeff_sum_degree D b s + +end Surjectivity +end PermanentBorder.SliceParameters + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/Transcendence.lean b/lean/OAI/Algebra/Determinantal/Transcendence.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c487ec8673f72e6f75082a621374fc63bfe20d3 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/Transcendence.lean @@ -0,0 +1,400 @@ +import OAI.Algebra.Determinantal.HomogeneousPadding + +namespace OAI + +namespace PermanentBorder.SliceParameters + +universe u +open MvPolynomial +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +lemma aeval_mem_field {v : ℕ} (F : IntermediateField K L) + (x : Fin v → L) (hx : ∀ i, x i ∈ F) (p : MvPolynomial (Fin v) K) : + aeval x p ∈ F := by + have h : (aeval (R := K) x).range ≤ F.toSubalgebra := by + rw [aeval_range, Algebra.adjoin_le_iff] + rintro _ ⟨i, rfl⟩ + exact hx i + exact h ⟨p, rfl⟩ + +lemma pivot_mem {ι : Type*} [Fintype ι] (F : IntermediateField K L) + (a b : ι → L) (j : ι) (ha : ∀ i, a i ∈ F) (hj : a j ≠ 0) + (hb : ∀ i, i ≠ j → b i ∈ F) (hs : (∑ i, a i * b i) ∈ F) : + b j ∈ F := by + classical + have he : (∑ i ∈ Finset.univ.erase j, a i * b i) ∈ F := by + apply F.sum_mem + intro i hi + exact F.mul_mem (ha i) (hb i (Finset.mem_erase.mp hi).1) + have hp : a j * b j ∈ F := by + have hh := F.sub_mem hs he + convert hh using 1 + symm + exact sub_eq_of_eq_add (by + simpa only [add_comm] using (Finset.sum_erase_add Finset.univ + (fun i => a i * b i) (Finset.mem_univ j)).symm) + simpa [mul_div_cancel_left₀, hj] using F.div_mem hp (ha j) + +theorem normalized_avoidance {v d n : ℕ} + (I : Ideal (MvPolynomial (Fin v) K)) + (hdim : ringKrullDim (MvPolynomial (Fin v) K ⧸ I) ≤ n) + (hn : n + d < v) + (H : Fin v × Fin (d+1) → L) (hH : AlgebraicIndependent K H) + (x : Fin v → L) (y : Fin (d+1) → L) (j : Fin (d+1)) (hyj : y j = 1) + (hxy : ∀ i, ∑ c, y c * H (i,c) = x i) + (hx : ∀ p ∈ I, aeval x p = 0) : False := by + classical + let C := {c : Fin (d+1) // c ≠ j} + let κ := C ⊕ (Fin v × C) + let z : κ → L := Sum.elim (fun c => y c.val) (fun ic => H (ic.1,ic.2.val)) + let F := IntermediateField.adjoin K (Set.range x) + have hF : Algebra.trdeg K F ≤ (n : Cardinal) := + AlgebraicDimension.point_field_trdeg_le I n hdim x hx + obtain ⟨E, hFE, hz, ht⟩ := add_parameters F n hF z + have hxE (i : Fin v) : x i ∈ E := + hFE (IntermediateField.subset_adjoin K _ (Set.mem_range_self i)) + have hyE (c : Fin (d+1)) : y c ∈ E := by + by_cases hc : c = j + · rw [hc, hyj] + exact E.one_mem + · exact hz (Sum.inl ⟨c,hc⟩) + have hHE (ic : Fin v × Fin (d+1)) : H ic ∈ E := by + obtain ⟨i,c⟩ := ic + by_cases hc : c = j + · subst c + apply pivot_mem E y (fun c => H (i,c)) j hyE + · simp [hyj] + · intro a ha + exact hz (Sum.inr (i,⟨a,ha⟩)) + · rw [hxy] + exact hxE i + · exact hz (Sum.inr (i,⟨c,hc⟩)) + have hC : Fintype.card C = d := by + simp [C, Fintype.card_subtype_compl] + have hκ : Fintype.card κ = d + v*d := by + simp [κ, hC] + have hc := independent_card_le H hH E hHE _ ht + simp only [Fintype.card_prod, Fintype.card_fin, hκ] at hc + nlinarith + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.ParameterBounds +open Algebra MvPolynomial +universe u +variable {K A : Type u} [Field K] [CommRing A] [IsDomain A] [Algebra K A] + +theorem trdeg_lt_of_relation {n : ℕ} (x : Fin n → A) + [Algebra.IsAlgebraic (Algebra.adjoin K (Set.range x)) A] + (p : MvPolynomial (Fin n) K) (hp : p ≠ 0) (hx : aeval x p = 0) : + Algebra.trdeg K A < (n : Cardinal) := by + by_contra! ht + have ht' : Cardinal.lift.{u} (Cardinal.mk (Fin n)) ≤ + Cardinal.lift.{0} (Algebra.trdeg K A) := by simpa using ht + have hi := (Algebra.IsAlgebraic.isTranscendenceBasis_of_lift_le_trdeg_of_finite K x ht').1 + apply hp + exact hi (by simpa using hx) + +theorem trdeg_le_of_generators {n : ℕ} (x : Fin n → A) + [Algebra.IsAlgebraic (Algebra.adjoin K (Set.range x)) A] : + Algebra.trdeg K A ≤ (n : Cardinal) := by + calc + Algebra.trdeg K A ≤ Cardinal.mk (Set.range x) := + Algebra.IsAlgebraic.trdeg_le_cardinalMk K (Set.range x) + _ ≤ Cardinal.lift.{u} (Cardinal.mk (Fin n)) := by + simpa using (Cardinal.mk_range_le_lift (f := x)) + _ = n := by simp + +theorem adjoin_trdeg_lt_of_relation {n : ℕ} (x : Fin n → A) + (p : MvPolynomial (Fin n) K) (hp : p ≠ 0) (hx : aeval x p = 0) : + Algebra.trdeg K (Algebra.adjoin K (Set.range x)) < (n : Cardinal) := by + let B := Algebra.adjoin K (Set.range x) + let y : Fin n → B := fun i => ⟨x i, Algebra.subset_adjoin (Set.mem_range_self i)⟩ + have htop : Algebra.adjoin K (Set.range y) = ⊤ := by + apply Subalgebra.map_injective (show Function.Injective B.val from Subtype.val_injective) + rw [AlgHom.map_adjoin, Algebra.map_top, B.range_val, ← Set.range_comp] + rfl + let : Algebra.IsAlgebraic (Algebra.adjoin K (Set.range y)) B := by + constructor + intro b + have hb : b ∈ Algebra.adjoin K (Set.range y) := by rw [htop]; trivial + exact isAlgebraic_algebraMap (R := Algebra.adjoin K (Set.range y)) ⟨b, hb⟩ + apply trdeg_lt_of_relation y p hp + apply (show Function.Injective B.val from Subtype.val_injective) + rw [map_zero, MvPolynomial.comp_aeval_apply] + exact hx + +open scoped IntermediateField.algebraAdjoinAdjoin in + +theorem field_adjoin_trdeg_lt_of_relation {L : Type u} [Field L] [Algebra K L] + {n : ℕ} (x : Fin n → L) (p : MvPolynomial (Fin n) K) (hp : p ≠ 0) + (hx : aeval x p = 0) : + Algebra.trdeg K (IntermediateField.adjoin K (Set.range x)) < (n : Cardinal) := by + rw [← trdeg_add_eq K (Algebra.adjoin K (Set.range x)), + trdeg_eq_zero (R := Algebra.adjoin K (Set.range x)), add_zero] + exact adjoin_trdeg_lt_of_relation x p hp hx + +end PermanentBorder.ParameterBounds + +namespace PermanentBorder.SliceParameters + +universe u +open MvPolynomial +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +theorem normalized_tangency_impossible {v d : ℕ} + (f : MvPolynomial (Fin (v+1)) K) (hf : f ≠ 0) + (H : Fin (v+1) × Fin (d+1) → L) (hH : AlgebraicIndependent K H) + (x : Fin (v+1) → L) (y : Fin (d+1) → L) (j : Fin (d+1)) (hyj : y j = 1) + (hxy : ∀ i, ∑ c, y c * H (i,c) = x i) + (hfx : aeval x f = 0) + (i₀ : Fin (v+1)) (hp : aeval x (pderiv i₀ f) ≠ 0) + (horth : ∀ c, ∑ i, aeval x (pderiv i f) * H (i,c) = 0) : False := by + classical + let C := {c : Fin (d+1) // c ≠ j} + let R := {i : Fin (v+1) // i ≠ i₀} + let κ := C ⊕ (R × C) + let z : κ → L := Sum.elim (fun c => y c.val) (fun ic => H (ic.1.val,ic.2.val)) + let F := IntermediateField.adjoin K (Set.range x) + have hF : Algebra.trdeg K F ≤ (v : Cardinal) := by + apply Cardinal.lt_natCast_add_one_iff.mp + simpa only [Nat.cast_add, Nat.cast_one] using + ParameterBounds.field_adjoin_trdeg_lt_of_relation x f hf hfx + obtain ⟨E, hFE, hz, ht⟩ := add_parameters F v hF z + have hxE (i : Fin (v+1)) : x i ∈ E := + hFE (IntermediateField.subset_adjoin K _ (Set.mem_range_self i)) + have hyE (c : Fin (d+1)) : y c ∈ E := by + by_cases hc : c = j + · rw [hc, hyj] + exact E.one_mem + · exact hz (Sum.inl ⟨c,hc⟩) + have hpE (i : Fin (v+1)) : aeval x (pderiv i f) ∈ E := + aeval_mem_field E x hxE _ + have hHother (i : Fin (v+1)) (c : Fin (d+1)) (hc : c ≠ j) : H (i,c) ∈ E := by + by_cases hi : i = i₀ + · subst i + apply pivot_mem E (fun i => aeval x (pderiv i f)) (fun i => H (i,c)) i₀ hpE hp + · intro a ha + exact hz (Sum.inr (⟨a,ha⟩,⟨c,hc⟩)) + · rw [horth] + exact E.zero_mem + · exact hz (Sum.inr (⟨i,hi⟩,⟨c,hc⟩)) + have hHE (ic : Fin (v+1) × Fin (d+1)) : H ic ∈ E := by + obtain ⟨i,c⟩ := ic + by_cases hc : c = j + · subst c + apply pivot_mem E y (fun c => H (i,c)) j hyE + · simp [hyj] + · exact hHother i + · rw [hxy] + exact hxE i + · exact hHother i c hc + have hC : Fintype.card C = d := by + simp [C, Fintype.card_subtype_compl] + have hR : Fintype.card R = v := by + simp [R, Fintype.card_subtype_compl] + have hκ : Fintype.card κ = d + v*d := by + simp [κ, hC, hR] + have hc := independent_card_le H hH E hHE _ ht + simp only [Fintype.card_prod, Fintype.card_fin, hκ] at hc + nlinarith + +theorem generic_normalized_slice {v d n : ℕ} + (f : MvPolynomial (Fin (v+1)) K) (hf : f ≠ 0) + (hdim : ringKrullDim (MvPolynomial (Fin (v+1)) K ⧸ + Ideal.span (Set.range (fun i => pderiv i f))) ≤ n) + (hn : n + d < v+1) + (H : Fin (v+1) × Fin (d+1) → L) (hH : AlgebraicIndependent K H) + (y : Fin (d+1) → L) (j : Fin (d+1)) (hyj : y j = 1) : + let x := fun i => ∑ c, y c * H (i,c) + aeval x f = 0 → ¬ ∀ c, ∑ i, aeval x (pderiv i f) * H (i,c) = 0 := by + intro x hf0 ho + by_cases hp : ∀ i, aeval x (pderiv i f) = 0 + · apply normalized_avoidance (Ideal.span (Set.range (fun i => pderiv i f))) + hdim hn H hH x y j hyj (fun _ => rfl) + have hker : Ideal.span (Set.range (fun i => pderiv i f)) ≤ + RingHom.ker (aeval x) := by + rw [Ideal.span_le, Set.range_subset_iff] + exact hp + exact fun p h => hker h + · obtain ⟨i₀, hi₀⟩ := not_forall.mp hp + exact normalized_tangency_impossible f hf H hH x y j hyj (fun _ => rfl) hf0 i₀ hi₀ ho + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters + +universe u +open MvPolynomial +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +theorem generic_homogeneous_slice {v d n r : ℕ} + (f : MvPolynomial (Fin (v+1)) K) (hf : f ≠ 0) (hhom : f.IsHomogeneous r) + (hdim : ringKrullDim (MvPolynomial (Fin (v+1)) K ⧸ + Ideal.span (Set.range (fun i => pderiv i f))) ≤ n) + (hn : n + d < v+1) + (H : Fin (v+1) × Fin (d+1) → L) (hH : AlgebraicIndependent K H) + (y : Fin (d+1) → L) + (hzero : aeval (fun i => ∑ c, y c * H (i,c)) f = 0) + (htangent : ∀ c, ∑ i, + aeval (fun i => ∑ c, y c * H (i,c)) (pderiv i f) * H (i,c) = 0) : y = 0 := by + classical + by_contra hy + obtain ⟨j,hj⟩ : ∃ j, y j ≠ 0 := by + by_contra h + apply hy + ext j + exact not_not.mp (not_exists.mp h j) + let a := (y j)⁻¹ + let y' := fun c => a * y c + have hj' : y' j = 1 := inv_mul_cancel₀ hj + have hscale : (fun i => ∑ c, y' c * H (i,c)) = + (fun i => a * (∑ c, y c * H (i,c))) := by + ext i + simp [y', Finset.mul_sum, mul_assoc] + apply generic_normalized_slice f hf hdim hn H hH y' j hj' + · rw [hscale, homogeneous_aeval_scale hhom, hzero, mul_zero] + · intro c + rw [hscale] + simp_rw [homogeneous_aeval_scale hhom.pderiv, mul_assoc, ← Finset.mul_sum] + rw [htangent c, mul_zero] + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial +variable {K α β : Type*} [CommRing K] [Fintype β] + +noncomputable def sectionForm (H : α × β → K) (i : α) : MvPolynomial β K := + ∑ c, C (H (i,c)) * X c + +noncomputable def linearSection (H : α × β → K) : + MvPolynomial α K →ₐ[K] MvPolynomial β K := aeval (sectionForm H) + +lemma sectionForm_homogeneous (H : α × β → K) (i : α) : + (sectionForm H i).IsHomogeneous 1 := by + apply IsHomogeneous.sum + intro c _ + exact isHomogeneous_C_mul_X _ _ + +lemma linearSection_homogeneous (H : α × β → K) {f : MvPolynomial α K} {r : ℕ} + (hf : f.IsHomogeneous r) : (linearSection H f).IsHomogeneous r := by + simpa only [one_mul, linearSection] using hf.aeval (sectionForm H) (sectionForm_homogeneous H) + +@[simp] lemma eval_sectionForm (H : α × β → K) (y : β → K) (i : α) : + eval y (sectionForm H i) = ∑ c, y c * H (i,c) := by + simp [sectionForm, mul_comm] + +@[simp] lemma eval_linearSection (H : α × β → K) (y : β → K) (f : MvPolynomial α K) : + eval y (linearSection H f) = eval (fun i => ∑ c, y c * H (i,c)) f := by + have h : (eval y).comp (linearSection H).toRingHom = + eval (fun i => ∑ c, y c * H (i,c)) := by + apply MvPolynomial.ringHom_ext + · intro a + simp [linearSection] + · intro i + simp [linearSection] + exact DFunLike.congr_fun h f + +@[simp] lemma pderiv_sectionForm (H : α × β → K) (i : α) (c : β) : + pderiv c (sectionForm H i) = C (H (i,c)) := by + classical + simp [sectionForm, pderiv_X, Pi.single_apply] + +@[simp] lemma linearSection_X (H : α × β → K) (i : α) : + linearSection H (X i) = sectionForm H i := aeval_X _ _ + +@[simp] lemma linearSection_C (H : α × β → K) (a : K) : + linearSection H (C a) = C a := aeval_C _ _ + +variable [Fintype α] + +lemma pderiv_linearSection (H : α × β → K) (f : MvPolynomial α K) (c : β) : + pderiv c (linearSection H f) = + ∑ i, C (H (i,c)) * linearSection H (pderiv i f) := by + classical + induction f using MvPolynomial.induction_on with + | C a => simp [linearSection] + | add p q hp hq => simp [map_add, hp, hq, mul_add, Finset.sum_add_distrib] + | mul_X p j hp => + simp [map_mul, hp, pderiv_X, Pi.single_apply, apply_ite, mul_add, + Finset.sum_add_distrib, Finset.mul_sum, mul_comm, add_comm] + apply Finset.sum_congr rfl + intro i _ + ring + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] + +noncomputable def singularSystem {R β : Type*} [CommRing R] (f : MvPolynomial β R) : + Option β → MvPolynomial β R := fun j => match j with + | none => f + | some i => pderiv i f + +def singularDegrees {β : Type*} (r : ℕ) : Option β → ℤ := + fun j => match j with + | none => r + | some _ => (r-1 : ℕ) + +lemma singularSystem_homogeneous {R β : Type*} [CommRing R] {f : MvPolynomial β R} {r : ℕ} + (hf : f.IsHomogeneous r) (j : Option β) : + (singularSystem f j).IsWeightedHomogeneous (fun _ : β => (1 : ℤ)) + (singularDegrees r j) := by + cases j with + | none => exact homogeneous_intWeight hf + | some i => exact homogeneous_intWeight hf.pderiv + +theorem generic_slice_certificate {v d n r : ℕ} + (f : MvPolynomial (Fin (v+1)) K) (hf : f ≠ 0) (hhom : f.IsHomogeneous r) + (hdim : ringKrullDim (MvPolynomial (Fin (v+1)) K ⧸ + Ideal.span (Set.range (fun i => pderiv i f))) ≤ n) + (hn : n+d < v+1) [IsAlgClosed L] + (H : Fin (v+1) × Fin (d+1) → L) (hH : AlgebraicIndependent K H) : + ∃ D : ℕ, Function.Surjective + (macaulayMatrix (singularDegrees r) + (singularSystem (linearSection H (map (algebraMap K L) f))) D).mulVec := by + classical + let g := linearSection H (map (algebraMap K L) f) + have hg : g.IsHomogeneous r := linearSection_homogeneous H (hhom.map _) + have hz : ∀ y ∈ zeroLocus L (Ideal.span (Set.range (singularSystem g))), y = 0 := by + intro y hy + have hh (j : Option (Fin (d+1))) : eval y (singularSystem g j) = 0 := by + exact hy _ Ideal.mem_span_range_self + apply generic_homogeneous_slice f hf hhom hdim hn H hH y + · have h := hh none + simpa only [singularSystem, g, eval_linearSection, eval_map, aeval_def] using h + · intro c + have h := hh (some c) + simp only [singularSystem, g, pderiv_linearSection, map_sum, map_mul, eval_C, + eval_linearSection, pderiv_map, eval_map] at h + simpa only [mul_comm, aeval_def] using h + obtain ⟨D,hD⟩ := homogeneous_piece_certificate + (Ideal.span (Set.range (singularSystem g))) hz + refine ⟨D, (macaulay_surjective_iff _ _ (singularSystem_homogeneous hg) D).mpr ?_⟩ + intro p hp + exact hD p (intWeight_homogeneous hp) + +end PermanentBorder.SliceParameters + +namespace PermanentBorder.SliceParameters +open MvPolynomial + +lemma linearSection_map {K L α β : Type*} [CommRing K] [CommRing L] [Fintype β] + (φ : K →+* L) (H : α × β → K) (f : MvPolynomial α K) : + map φ (linearSection H f) = linearSection (fun i => φ (H i)) (map φ f) := by + apply MvPolynomial.induction_on f + · intro a + simp + · intro p q hp hq + simp only [map_add, hp, hq] + · intro p i hp + simp only [map_mul, linearSection_X, hp, map_X, + sectionForm, map_sum, map_C] + +end PermanentBorder.SliceParameters + +end OAI diff --git a/lean/OAI/Algebra/Determinantal/WildParameters.lean b/lean/OAI/Algebra/Determinantal/WildParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5120d73a5d1aca717a32def5d16474f97970cf2 --- /dev/null +++ b/lean/OAI/Algebra/Determinantal/WildParameters.lean @@ -0,0 +1,439 @@ +import OAI.Algebra.Determinantal.DegreeBounds + +namespace OAI + +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert FrobeniusPlane +universe u +variable {K L : Type u} [Field K] [Field L] [Algebra K L] [CharP L 2] + +lemma twice_choose_two (n : ℕ) : 2*((n+1).choose 2)=n*(n+1) := by + induction n with + | zero => norm_num + | succ n ih => + rw [Nat.choose_succ_succ] + simp only [Nat.choose_one_right] + nlinarith + +lemma even_count (r : ℕ) : + 2*(Fintype.card (Index (r-1)) + ∑ _ : Fin 3, Fintype.card (Index r)) = (2*r)*(2*r+1) := by + simp only [LowPlane.card_index,Finset.sum_const,Finset.card_univ,Fintype.card_fin,smul_eq_mul] + cases r with + | zero => norm_num + | succ s => + simp only [Nat.add_sub_cancel] + have h1 := twice_choose_two s + have h2 := twice_choose_two (s+1) + nlinarith + +lemma odd_count (r : ℕ) : + 2*(Fintype.card (Index r) + ∑ i : Fin 3, Fintype.card (Index (![r+1,r,r] i))) = + (2*r+1)*(2*r+2) := by + simp only [Fin.sum_univ_succ,Fin.sum_univ_zero,Fin.isValue, + Matrix.cons_val_zero,Matrix.cons_val_succ,add_zero,LowPlane.card_index] + have h1 := twice_choose_two r + have h2 := twice_choose_two (r+1) + nlinarith + +theorem wild_parameter_bound_even [Infinite K] [IsAlgClosed L] + {a b c d : Plane L} {r : ℕ} (hr : 2 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r) + (hs : Squarefree (homogeneousComponent (2*r) (squareForm a b c d))) + (t : Fin 4 → Plane K) + (h : ∀ i s, (![r,r,r,r-1] i) ≤ s.degree → + (![a,b,c,d] i).coeff s=algebraMap K L ((t i).coeff s)) : + ∃ (E : IntermediateField K L) (n : ℕ), InField E a ∧ InField E b ∧ InField E c ∧ + InField E d ∧ Algebra.trdeg K E ≤ (n : Cardinal) ∧ + 2*n+finrank L (Plane L ⧸ halfIdeal a b c d) ≤ (2*r)*(2*r+1) := by + classical + let q := Ideal.Quotient.mkₐ L (halfIdeal a b c d) + obtain ⟨hfinite,hrank⟩ := halfIdeal_even_finite hr hf hs + let := hfinite + have hm := halfIdeal_mem a b c d + have hd0 : d ≠ 0 := by + intro hz + have hh := (squarefree_even_leading hr hf hs).2.1 + exact hh (by rw [hz,map_zero]) + obtain ⟨E,n,hdE,hpE,hE,hn⟩ := four_polynomial_bound q Ideal.Quotient.mk_surjective + (r-1) (fun _ => r) d ![a,b,c] (t 3) ![t 0,t 1,t 2] hd0 + (h 3) (by + intro i + fin_cases i + · exact h 0 + · exact h 1 + · exact h 2) + (Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.2.2) + (by intro i; fin_cases i + exact Ideal.Quotient.eq_zero_iff_mem.mpr hm.1 + exact Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.1 + exact Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.2.1) + (fun _ => hrank) + exact ⟨E,n,hpE 0,hpE 1,hpE 2,hdE,hE,(hn.trans_eq (even_count r))⟩ + +theorem wild_parameter_bound_odd [Infinite K] [IsAlgClosed L] + {a b c d : Plane L} {r : ℕ} (hr : 1 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r+1) + (hs : Squarefree (homogeneousComponent (2*r+1) (squareForm a b c d))) + (t : Fin 4 → Plane K) + (h : ∀ i s, (![r+1,r,r,r] i) ≤ s.degree → + (![a,b,c,d] i).coeff s=algebraMap K L ((t i).coeff s)) : + ∃ (E : IntermediateField K L) (n : ℕ), InField E a ∧ InField E b ∧ InField E c ∧ + InField E d ∧ Algebra.trdeg K E ≤ (n : Cardinal) ∧ + 2*n+finrank L (Plane L ⧸ halfIdeal a b c d) ≤ (2*r+1)*(2*r+2) := by + classical + let q := Ideal.Quotient.mkₐ L (halfIdeal a b c d) + obtain ⟨hfinite,hrank⟩ := halfIdeal_odd_finite hr hf hs + let := hfinite + have hm := halfIdeal_mem a b c d + have hb0 : b ≠ 0 := by + intro hz + have hh := (squarefree_odd_leading hr hf hs).1 + exact hh (by rw [hz,map_zero]) + obtain ⟨E,n,hbE,hpE,hE,hn⟩ := four_polynomial_bound q Ideal.Quotient.mk_surjective + r ![r+1,r,r] b ![a,c,d] (t 1) ![t 0,t 2,t 3] hb0 (h 1) + (by intro i; fin_cases i + exact h 0 + exact h 2 + exact h 3) + (Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.1) + (by intro i; fin_cases i + exact Ideal.Quotient.eq_zero_iff_mem.mpr hm.1 + exact Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.2.1 + exact Ideal.Quotient.eq_zero_iff_mem.mpr hm.2.2.2) + (by intro i + apply hrank.trans + apply Nat.mul_le_mul_left 2 + apply Submodule.finrank_mono + apply filtered_mono + fin_cases i <;> simp) + exact ⟨E,n,hpE 0,hbE,hpE 1,hpE 2,hE,(hn.trans_eq (odd_count r))⟩ + +end PermanentBorder.CurveFamily +namespace PermanentBorder.CurveFamily +open MvPolynomial Module LowPlane PlaneHilbert +variable {L : Type*} [Field L] + +lemma pointEvaluation_surjective {ι : Type*} [Fintype ι] + (x : ι → Fin 2 → L) (hx : Function.Injective x) : + Function.Surjective (pointEvaluation x) := by + classical + have hp : ∀ i j : ι, i ≠ j → ∃ p : MvPolynomial (Fin 2) L, + eval (x i) p = 1 ∧ eval (x j) p = 0 := by + intro i j hij + have hne : ∃ k, x i k ≠ x j k := by + by_contra! h + exact hij (hx (funext h)) + obtain ⟨k,hk⟩ := hne + refine ⟨C (x i k-x j k)⁻¹*(X k-C (x j k)),?_,?_⟩ + · simp only [map_mul,map_sub,eval_C,eval_X] + exact inv_mul_cancel₀ (sub_ne_zero.mpr hk) + · simp + choose p hp using hp + let P (i : ι) := ∏ j : {j // j ≠ i}, p i j.val (Ne.symm j.property) + have he (i j : ι) : eval (x j) (P i) = if i=j then 1 else 0 := by + dsimp [P] + rw [map_prod] + split_ifs with hij + · subst j + exact Finset.prod_eq_one fun z _ => (hp i z.val (Ne.symm z.property)).1 + · exact Finset.prod_eq_zero (Finset.mem_univ ⟨j,Ne.symm hij⟩) + (hp i j hij).2 + intro y + refine ⟨∑ i, C (y i)*P i,?_⟩ + ext j + simp only [pointEvaluation_apply,map_sum,map_mul,eval_C,he] + simp + +lemma partial_leading (p : MvPolynomial (Fin 2) L) (n : ℕ) (i : Fin 2) : + homogeneousComponent n (pderiv i p) = pderiv i (homogeneousComponent (n+1) p) := by + ext s + simp only [coeff_homogeneousComponent,coeff_pderiv] + have he : (s+Finsupp.single i 1).degree = s.degree+1 := by + simp only [map_add,Finsupp.degree_single] + rw [he] + split_ifs <;> simp_all + +theorem distinct_critical_point_count {ι : Type*} [Fintype ι] + (x : ι → Fin 2 → L) (hx : Function.Injective x) + (f : MvPolynomial (Fin 2) L) (k R : ℕ) (hk : 1 ≤ k) (hR : k-1 ≤ 2*R) + (hf : f.totalDegree ≤ k) + (hlead : homogeneousComponent k f ≠ 0) + (hpartial : pderiv 1 (homogeneousComponent k f) ≠ 0) + (hcop : IsRelPrime (homogeneousComponent k f) (pderiv 1 (homogeneousComponent k f))) + (hzero : ∀ i, eval (x i) f=0) (hderiv : ∀ i, eval (x i) (pderiv 1 f)=0) : + Fintype.card ι ≤ 8*finrank L (filtered (pointEvaluation x) R) := by + let q := pointEvaluation x + have he : homogeneousComponent (k-1) (pderiv 1 f)=pderiv 1 (homogeneousComponent k f) := by + simpa only [Nat.sub_add_cancel hk] using partial_leading f (k-1) 1 + have hdeg : (pderiv 1 f).totalDegree ≤ k-1 := + FrobeniusPlane.partial_degree (by rwa [Nat.sub_add_cancel hk]) 1 + have hh := finite_of_leading_pair q (pointEvaluation_surjective x hx) hf hdeg + (by ext i; exact hzero i) (by ext i; exact hderiv i) hlead + (by rwa [he]) (by rwa [he]) (B := k-1) (by omega) (by omega) (by omega) + have hrank : finrank L (filtered q (k-1)) ≤ finrank L (filtered q (2*R)) := + Submodule.finrank_mono (filtered_mono q hR) + have hd := filtered_rank_double_le q R + change Fintype.card ι ≤ 8*finrank L (filtered q R) + simpa only [Module.finrank_pi,finrank_self,Finset.sum_const,Finset.card_univ, + smul_eq_mul,mul_one] using (hh.2.trans (by omega)) + +end PermanentBorder.CurveFamily +namespace PermanentBorder.FrobeniusPlane +open MvPolynomial +variable {K L : Type*} [Field K] [Field L] [CharP K 2] [CharP L 2] [Algebra K L] + +omit [CharP K 2] [CharP L 2] in +lemma squareForm_map (a b c d : Plane K) : + (squareForm a b c d).map (algebraMap K L) = + squareForm (a.map (algebraMap K L)) (b.map (algebraMap K L)) + (c.map (algebraMap K L)) (d.map (algebraMap K L)) := by + simp [squareForm] + +omit [CharP K 2] [CharP L 2] in +lemma high_coeff_of_top {p : Plane L} {t : Plane K} {n : ℕ} + (hp : p.totalDegree ≤ n) (ht : t.IsHomogeneous n) + (he : homogeneousComponent n p = t.map (algebraMap K L)) : + ∀ s, n ≤ s.degree → p.coeff s=algebraMap K L (t.coeff s) := by + intro s hs + by_cases hsn : s.degree=n + · have hh := congrArg (fun polynomial : Plane L => polynomial.coeff s) he + simpa only [coeff_homogeneousComponent,hsn,ite_true,coeff_map] using hh + · have hz : p.coeff s=0 := coeff_eq_zero_of_totalDegree_lt (by change _ < s.degree; omega) + rw [hz,ht.coeff_eq_zero (by exact fun h => hsn h),map_zero] + +omit [CharP K 2] [CharP L 2] in +lemma high_coeff_zero {p : Plane L} {n : ℕ} (h : p.totalDegree < n) : + ∀ s, n ≤ s.degree → p.coeff s=algebraMap K L ((0 : Plane K).coeff s) := by + intro s hs + rw [AddMonoidAlgebra.coeff_zero,Finsupp.zero_apply,map_zero] + exact coeff_eq_zero_of_totalDegree_lt (by change _ < s.degree; omega) + +theorem fixed_half_forms_even [PerfectRing K 2] + {a b c d : Plane L} {r : ℕ} (hr : 2 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r) + (H : Plane K) (hH : H.IsHomogeneous (2*r)) + (he : homogeneousComponent (2*r) (squareForm a b c d)=H.map (algebraMap K L)) : + ∃ t : Fin 4 → Plane K, ∀ i s, (![r,r,r,r-1] i) ≤ s.degree → + (![a,b,c,d] i).coeff s=algebraMap K L ((t i).coeff s) := by + obtain ⟨A,B,C,D,hrep⟩ := exists_squareForm H + have hHdeg : (squareForm A B C D).totalDegree ≤ 2*r := by + rw [← hrep] + exact hH.totalDegree_le + have htop := squareForm_top_even hr hHdeg + rw [← hrep,homogeneousComponent_of_mem hH,ite_eq_left rfl] at htop + rw [squareForm_top_even hr hf,htop,squareForm_map] at he + simp only [map_zero] at he + obtain ⟨ha,_,_,hd⟩ := squareForm_injective he + have hdeg := squareForm_degree_bounds (n := 2*r-2) + (by simpa only [show 2*r-2+2=2*r by omega] using hf) + refine ⟨![homogeneousComponent r A,0,0,homogeneousComponent (r-1) D],?_⟩ + intro i + fin_cases i <;> dsimp + · exact high_coeff_of_top (by omega) (homogeneousComponent_isHomogeneous r A) ha + · exact high_coeff_zero (by omega) + · exact high_coeff_zero (by omega) + · exact high_coeff_of_top (by omega) (homogeneousComponent_isHomogeneous (r-1) D) hd + +theorem fixed_half_forms_odd [PerfectRing K 2] + {a b c d : Plane L} {r : ℕ} (hr : 1 ≤ r) + (hf : (squareForm a b c d).totalDegree ≤ 2*r+1) + (H : Plane K) (hH : H.IsHomogeneous (2*r+1)) + (he : homogeneousComponent (2*r+1) (squareForm a b c d)=H.map (algebraMap K L)) : + ∃ t : Fin 4 → Plane K, ∀ i s, (![r+1,r,r,r] i) ≤ s.degree → + (![a,b,c,d] i).coeff s=algebraMap K L ((t i).coeff s) := by + obtain ⟨A,B,C,D,hrep⟩ := exists_squareForm H + have hHdeg : (squareForm A B C D).totalDegree ≤ 2*r+1 := by + rw [← hrep] + exact hH.totalDegree_le + have htop := squareForm_top_odd hr hHdeg + rw [← hrep,homogeneousComponent_of_mem hH,ite_eq_left rfl] at htop + rw [squareForm_top_odd hr hf,htop,squareForm_map] at he + simp only [map_zero] at he + obtain ⟨_,hb,hc,_⟩ := squareForm_injective he + have hdeg := squareForm_degree_bounds (n := 2*r-1) + (by simpa only [show 2*r-1+2=2*r+1 by omega] using hf) + refine ⟨![0,homogeneousComponent r B,homogeneousComponent r C,0],?_⟩ + intro i + fin_cases i <;> dsimp + · exact high_coeff_zero (by omega) + · exact high_coeff_of_top (by omega) (homogeneousComponent_isHomogeneous r B) hb + · exact high_coeff_of_top (by omega) (homogeneousComponent_isHomogeneous r C) hc + · exact high_coeff_zero (by omega) + +end PermanentBorder.FrobeniusPlane + +namespace PermanentBorder.IdealColength +open Module +variable {K R : Type*} [Field K] [CommRing R] [Algebra K R] + +theorem quotient_product_length (I B : Ideal R) (z : R) : + Module.length K (R ⧸ (I ⊔ Ideal.span {z}*B)) ≤ + Module.length K (R ⧸ (I ⊔ Ideal.span {z})) + Module.length K (R ⧸ B) := by + let J := I ⊔ Ideal.span {z}*B + let H := I ⊔ Ideal.span {z} + have hJH : J ≤ H := sup_le_sup_left (Ideal.mul_le_left) I + let g : (R ⧸ J) →ₗ[K] (R ⧸ H) := (Ideal.Quotient.factorₐ K hJH).toLinearMap + have hg : Function.Surjective g := Ideal.Quotient.factor_surjective hJH + let μ : R →ₗ[K] (R ⧸ J) := (Ideal.Quotient.mkₐ K J).toLinearMap.comp (LinearMap.mulLeft K z) + have hμ : B.restrictScalars K ≤ LinearMap.ker μ := by + intro r hr + change Ideal.Quotient.mk J (z*r) = 0 + apply Ideal.Quotient.eq_zero_iff_mem.mpr + exact (show Ideal.span {z} * B ≤ J from le_sup_right) (Ideal.mul_mem_mul (Ideal.subset_span (by simp)) hr) + let v : (R ⧸ B) →ₗ[K] (R ⧸ J) := (B.restrictScalars K).liftQ μ hμ + have hv : LinearMap.range v = LinearMap.ker g := by + apply le_antisymm + · rintro _ ⟨a,rfl⟩ + obtain ⟨r,rfl⟩ := Ideal.Quotient.mk_surjective a + change Ideal.Quotient.mk H (z*r) = 0 + exact Ideal.Quotient.eq_zero_iff_mem.mpr ((show Ideal.span {z} ≤ H from le_sup_right) (Ideal.mul_mem_right _ _ (Ideal.subset_span (by simp)))) + · intro a ha + obtain ⟨r,rfl⟩ := Ideal.Quotient.mk_surjective a + have hr : r ∈ H := Ideal.Quotient.eq_zero_iff_mem.mp ha + obtain ⟨i,hi,j,hj,he⟩ := Submodule.mem_sup.mp hr + obtain ⟨s,hs⟩ := Ideal.mem_span_singleton'.mp hj + refine ⟨Ideal.Quotient.mk B s,?_⟩ + change Ideal.Quotient.mk J (z*s) = Ideal.Quotient.mk J r + rw [← he,← hs,map_add,Ideal.Quotient.eq_zero_iff_mem.mpr ((show I ≤ J from le_sup_left) hi),zero_add] + congr 1 + ring + have hlen := Module.length_eq_add_of_exact (LinearMap.ker g).subtype g + (Submodule.subtype_injective _) hg (LinearMap.exact_subtype_ker_map g) + have hb : Module.length K (LinearMap.ker g) ≤ Module.length K (R ⧸ B) := by + rw [← hv] + exact Module.length_le_of_surjective v.rangeRestrict (by + rintro ⟨x,y,rfl⟩ + exact ⟨y,rfl⟩) + calc + _ = Module.length K (LinearMap.ker g) + Module.length K (R ⧸ H) := hlen + _ ≤ Module.length K (R ⧸ B) + Module.length K (R ⧸ H) := add_le_add hb le_rfl + _ = _ := add_comm _ _ +end PermanentBorder.IdealColength +namespace PermanentBorder.FrobeniusPlane +open MvPolynomial +variable {K : Type*} [Field K] [CharP K 2] + +lemma square_mem_of_mem_span (s : Set (Plane K)) {p : Plane K} + (hp : p ∈ Ideal.span s) : p^2 ∈ Ideal.span ((fun q : Plane K => q^2) '' s) := by + have hs : Ideal.span s ≤ Ideal.comap (frobenius (Plane K) 2) + (Ideal.span ((fun q : Plane K => q^2) '' s)) := by + apply Ideal.span_le.mpr + intro x hx + exact Ideal.subset_span ⟨x,hx,rfl⟩ + exact hs hp + +theorem frobenius_quotient_bound [PerfectRing K 2] (J H : Ideal (Plane K)) + [Module.Finite K (Plane K ⧸ J)] + (hJ : ∀ p ∈ J, p^2 ∈ H) : + ∃ (_ : Module.Finite K (Plane K ⧸ H)), + Module.finrank K (Plane K ⧸ H) ≤ 4*Module.finrank K (Plane K ⧸ J) := by + classical + let b := Module.finBasis K (Plane K ⧸ J) + let q := Ideal.Quotient.mkₐ K J + let v := Ideal.Quotient.mkₐ K H + let r : Fin (Module.finrank K (Plane K ⧸ J)) → Plane K := + fun i => Classical.choose (Ideal.Quotient.mk_surjective (b i)) + have hr : ∀ i, q (r i) = b i := fun i => Classical.choose_spec (Ideal.Quotient.mk_surjective (b i)) + let e : Fin 4 → Plane K := ![1,X 0,X 1,X 0*X 1] + let u : Fin 4 × Fin (Module.finrank K (Plane K ⧸ J)) → (Plane K ⧸ H) := + fun i => v (e i.1 * (r i.2)^2) + let W := Submodule.span K (Set.range u) + have hsquare (p : Plane K) (j : Fin 4) : v (e j*p^2) ∈ W := by + let c := b.repr (q p) + let t : Plane K := ∑ i, c i • r i + have ht : q t = q p := by + simp only [t,map_sum,map_smul,hr] + exact b.sum_repr (q p) + have hz : p-t ∈ J := Ideal.Quotient.eq_zero_iff_mem.mp (by + change q (p-t) = 0 + rw [map_sub,ht,sub_self]) + have hpow : v (p^2) = v (t^2) := by + have hh := Ideal.Quotient.eq_zero_iff_mem.mpr (hJ _ hz) + change v ((p-t)^2) = 0 at hh + rw [sub_pow_char,map_sub] at hh + exact sub_eq_zero.mp hh + have hsum : v (e j*p^2) = ∑ i, (c i)^2 • u (j,i) := by + rw [map_mul,hpow,← map_mul] + simp only [t,sum_pow_char,Finset.mul_sum,map_sum,smul_pow,mul_smul_comm,map_smul,u] + rw [hsum] + exact W.sum_mem (fun i _ => W.smul_mem _ (Submodule.subset_span ⟨(j,i),rfl⟩)) + have htop : W = ⊤ := by + apply top_unique + intro z _ + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective z + obtain ⟨a,b,c,d,rfl⟩ := exists_squareForm p + change v (squareForm a b c d) ∈ W + simp only [squareForm,map_add] + exact W.add_mem (W.add_mem (W.add_mem (by simpa [e] using hsquare a 0) + (by simpa [e] using hsquare b 1)) (by simpa [e] using hsquare c 2)) + (by simpa [e] using hsquare d 3) + have hfg : (⊤ : Submodule K (Plane K ⧸ H)).FG := by + rw [← htop] + exact Submodule.fg_span (Set.finite_range u) + let hfinite : Module.Finite K (Plane K ⧸ H) := Module.Finite.of_fg_top hfg + refine ⟨hfinite,?_⟩ + simpa using finrank_le_of_span_eq_top htop +end PermanentBorder.FrobeniusPlane +namespace PermanentBorder.CurveFamily +open MvPolynomial Module +variable {K : Type*} [Field K] + +noncomputable def zeroEvaluation (I : Ideal (MvPolynomial (Fin 2) K)) : + (MvPolynomial (Fin 2) K ⧸ I) →ₐ[K] (zeroLocus K I → K) := + Ideal.Quotient.liftₐ I (pointEvaluation (fun x : zeroLocus K I => x.val)) (by + intro p hp + ext x + exact (mem_zeroLocus_iff.mp x.property) p hp) + +lemma zeroEvaluation_surjective (I : Ideal (MvPolynomial (Fin 2) K)) + [Fintype (zeroLocus K I)] : Function.Surjective (zeroEvaluation I) := by + intro z + obtain ⟨p,hp⟩ := pointEvaluation_surjective (fun x : zeroLocus K I => x.val) + Subtype.val_injective z + exact ⟨Ideal.Quotient.mk I p,hp⟩ + +lemma finite_zeroLocus (I : Ideal (MvPolynomial (Fin 2) K)) + [Module.Finite K (MvPolynomial (Fin 2) K ⧸ I)] : Finite (zeroLocus K I) := by + let v : zeroLocus K I → ((MvPolynomial (Fin 2) K ⧸ I) →ₐ[K] K) := fun x => + Ideal.Quotient.liftₐ I (aeval x.val) (mem_zeroLocus_iff.mp x.property) + apply Finite.of_injective v + intro x y hxy + apply Subtype.ext + funext i + have h := congrArg (fun g : (MvPolynomial (Fin 2) K ⧸ I) →ₐ[K] K => + g (Ideal.Quotient.mk I (X i))) hxy + simpa [v] using h + +lemma zero_card_le_finrank (I : Ideal (MvPolynomial (Fin 2) K)) + [Module.Finite K (MvPolynomial (Fin 2) K ⧸ I)] [Fintype (zeroLocus K I)] : + Fintype.card (zeroLocus K I) ≤ finrank K (MvPolynomial (Fin 2) K ⧸ I) := by + simpa only [Module.finrank_pi, finrank_self, Finset.sum_const, Finset.card_univ, + smul_eq_mul,mul_one] using + LinearMap.finrank_le_finrank_of_surjective (f := (zeroEvaluation I).toLinearMap) + (zeroEvaluation_surjective I) + +lemma radical_length_eq_zero_card [IsAlgClosed K] (I : Ideal (MvPolynomial (Fin 2) K)) + [Fintype (zeroLocus K I)] : + Module.length K (MvPolynomial (Fin 2) K ⧸ I.radical) = Fintype.card (zeroLocus K I) := by + let g : MvPolynomial (Fin 2) K →ₐ[K] (zeroLocus K I → K) := + pointEvaluation (fun x : zeroLocus K I => x.val) + have hg : Function.Surjective g := pointEvaluation_surjective _ Subtype.val_injective + have hker : RingHom.ker g = I.radical := by + rw [← vanishingIdeal_zeroLocus_eq_radical (K := K) I] + ext p + simp only [RingHom.mem_ker] + constructor + · intro hp x hx + have hh := congrFun hp ⟨x,hx⟩ + exact hh + · intro hp + ext x + exact hp x.val x.property + let e := Ideal.quotientEquivAlgOfEq K hker.symm + let e' := Ideal.quotientKerAlgEquivOfSurjective hg + rw [(e.trans e').toLinearEquiv.length_eq] + simp [Module.length_eq_finrank] + +end PermanentBorder.CurveFamily + +end OAI diff --git a/lean/OAI/Algebra/Divisor/Normalization.lean b/lean/OAI/Algebra/Divisor/Normalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..184c0efac9dc6d0fcea818462f98935b4b11b528 --- /dev/null +++ b/lean/OAI/Algebra/Divisor/Normalization.lean @@ -0,0 +1,85 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace ControlledBoundary.FormalDivisor + +variable {Prime : Type*} + +def positivePart (D : Prime →₀ ℚ) : Prime →₀ ℚ := + D.mapRange (fun x => max x 0) (by simp) + +def negativePart (D : Prime →₀ ℚ) : Prime →₀ ℚ := + D.mapRange (fun x => max (-x) 0) (by simp) + +lemma positivePart_nonneg (D : Prime →₀ ℚ) : 0 ≤ positivePart D := + fun _ => le_max_right _ _ + +lemma negativePart_nonneg (D : Prime →₀ ℚ) : 0 ≤ negativePart D := + fun _ => le_max_right _ _ + +lemma signed_decomposition (D : Prime →₀ ℚ) : + positivePart D - negativePart D = D := by + ext p + change max (D p) 0 - max (-D p) 0 = D p + rcases le_total 0 (D p) with h | h + · rw [max_eq_left h, max_eq_right (neg_nonpos.mpr h), sub_zero] + · rw [max_eq_right h, max_eq_left (neg_nonneg.mpr h)] + ring + +lemma positivePart_coeff_lt_one (D : Prime →₀ ℚ) (h : ∀ p, D p < 1) : + ∀ p, positivePart D p < 1 := by + intro p + exact max_lt (h p) zero_lt_one + + + +lemma negativePart_support_subset (D : Prime →₀ ℚ) (S : Finset Prime) + (h : ∀ p, p ∉ S → 0 ≤ D p) : (negativePart D).support ⊆ S := by + intro p hp + by_contra hn + have hz : negativePart D p = 0 := max_eq_right (neg_nonpos.mpr (h p hn)) + exact (Finsupp.mem_support_iff.mp hp) hz + + + +lemma negativePart_signed_support [DecidableEq Prime] (G J K : Prime →₀ ℚ) + (s : ℚ) (hs : 0 ≤ s) (hG : 0 ≤ G) : + (negativePart (s • G - J - K)).support ⊆ J.support ∪ K.support := by + classical + apply negativePart_support_subset + intro p hp + have hJ : J p = 0 := Finsupp.notMem_support_iff.mp (fun h => + hp (Finset.mem_union_left _ h)) + have hK : K p = 0 := Finsupp.notMem_support_iff.mp (fun h => + hp (Finset.mem_union_right _ h)) + simpa only [Finsupp.sub_apply, Finsupp.smul_apply, smul_eq_mul, hJ, hK, sub_zero] + using mul_nonneg hs (hG p) + + + +theorem normalize_correction {n : ℕ} + (M F E C : Prime →₀ ℚ) (P : Fin n → Prime →₀ ℚ) (a : Fin n → ℚ) + (t : ℚ) (ht : 0 < t) (hF : 0 ≤ F) (hE : 0 ≤ E) + (hSupp : F.support ⊆ C.support) + (hrep : E = t • M + F + ∑ j, a j • P j) : + ∃ C₀ E₀ : Prime →₀ ℚ, + 0 ≤ C₀ ∧ C₀.support ⊆ C.support ∧ 0 ≤ E₀ ∧ + E₀ = M + C₀ + ∑ j, (t⁻¹ * a j) • P j := by + refine ⟨t⁻¹ • F, t⁻¹ • E, ?_, ?_, ?_, ?_⟩ + · intro p + exact mul_nonneg (inv_nonneg.mpr ht.le) (hF p) + · exact (Finsupp.support_smul).trans hSupp + · intro p + exact mul_nonneg (inv_nonneg.mpr ht.le) (hE p) + · rw [hrep, smul_add, smul_add, smul_smul, inv_mul_cancel₀ (ne_of_gt ht), + one_smul, Finset.smul_sum] + simp only [smul_smul] + +end ControlledBoundary.FormalDivisor + +end + +end OAI diff --git a/lean/OAI/Algebra/Divisor/RationalRecovery.lean b/lean/OAI/Algebra/Divisor/RationalRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..52f132277e52c9ce6260596297acfd31d8f8fc42 --- /dev/null +++ b/lean/OAI/Algebra/Divisor/RationalRecovery.lean @@ -0,0 +1,220 @@ +import Mathlib + +namespace OAI + + + + + +noncomputable section +open scoped BigOperators + +namespace ControlledBoundary +namespace RationalRecovery + + +structure Form (n : ℕ) where + constant : ℚ + coeff : Fin n → ℚ + +namespace Form + +variable {n : ℕ} {K : Type*} [Field K] [CharZero K] + + +def eval (f : Form n) (x : Fin n → K) : K := + (f.constant : K) + ∑ j, (f.coeff j : K) * x j + + +def tail (f : Form (n + 1)) : Form n := + ⟨f.constant, fun j => f.coeff j.succ⟩ + + +def combine (a b : ℚ) (f g : Form n) : Form n := + ⟨a * f.constant + b * g.constant, fun j => a * f.coeff j + b * g.coeff j⟩ + +lemma eval_combine (a b : ℚ) (f g : Form n) (x : Fin n → K) : + (combine a b f g).eval x = (a : K) * f.eval x + (b : K) * g.eval x := by + simp only [eval, combine, Rat.cast_add, Rat.cast_mul, add_mul, + Finset.sum_add_distrib, mul_assoc, ← Finset.mul_sum] + ring + +omit [CharZero K] in +lemma eval_succ (f : Form (n + 1)) (x : Fin (n + 1) → K) : + f.eval x = (f.coeff 0 : K) * x 0 + f.tail.eval (fun j => x j.succ) := by + simp only [eval, tail, Fin.sum_univ_succ] + ring + +lemma cast_eval (f : Form n) (q : Fin n → ℚ) : + ((f.eval q : ℚ) : ℝ) = f.eval (fun j => (q j : ℝ)) := by + simp [eval] + +end Form + + + +lemma finite_interval (L U : Finset ℚ) + (h : ∀ l ∈ L, ∀ u ∈ U, l ≤ u) : + ∃ t : ℚ, (∀ l ∈ L, l ≤ t) ∧ (∀ u ∈ U, t ≤ u) := by + classical + by_cases hL : L.Nonempty + · exact ⟨L.max' hL, fun l hl => L.le_max' l hl, + fun u hu => L.max'_le hL u (fun l hl => h l hl u hu)⟩ + · have hL' : L = ∅ := Finset.not_nonempty_iff_eq_empty.mp hL + by_cases hU : U.Nonempty + · exact ⟨U.min' hU, by simp [hL'], fun u hu => U.min'_le u hu⟩ + · have hU' : U = ∅ := Finset.not_nonempty_iff_eq_empty.mp hU + exact ⟨0, by simp [hL'], by simp [hU']⟩ + +lemma finite_interval_indexed {I J : Type*} [Fintype I] [Fintype J] + (l : I → ℚ) (u : J → ℚ) (h : ∀ i j, l i ≤ u j) : + ∃ t : ℚ, (∀ i, l i ≤ t) ∧ (∀ j, t ≤ u j) := by + classical + obtain ⟨t, htL, htU⟩ := finite_interval + (Finset.univ.image l) (Finset.univ.image u) (by + intro a ha b hb + obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp ha + obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hb + exact h i j) + exact ⟨t, fun i => htL _ (Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩), + fun j => htU _ (Finset.mem_image.mpr ⟨j, Finset.mem_univ _, rfl⟩)⟩ + + + +theorem exists_rat_solution (n : ℕ) {I : Type*} [Fintype I] + (f : I → Form n) (h : ∃ x : Fin n → ℝ, ∀ i, 0 ≤ (f i).eval x) : + ∃ q : Fin n → ℚ, ∀ i, 0 ≤ (f i).eval q := by + classical + induction n generalizing I with + | zero => + obtain ⟨x, hx⟩ := h + refine ⟨fun j => Fin.elim0 j, fun i => ?_⟩ + have hi := hx i + simpa only [Form.eval, Fin.sum_univ_zero, add_zero, Rat.cast_id] using + (show 0 ≤ (f i).constant from by + exact_mod_cast (show (0 : ℝ) ≤ ((f i).constant : ℝ) from by + simpa [Form.eval] using hi)) + | succ n ih => + obtain ⟨x, hx⟩ := h + let Z := {i : I // (f i).coeff 0 = 0} + let P := {i : I // 0 < (f i).coeff 0} + let N := {i : I // (f i).coeff 0 < 0} + let red : Z ⊕ (P × N) → Form n + | Sum.inl i => (f i.val).tail + | Sum.inr (p, m) => + Form.combine ((f p.val).coeff 0)⁻¹ (-((f m.val).coeff 0)⁻¹) + (f p.val).tail (f m.val).tail + let y : Fin n → ℝ := fun j => x j.succ + have hred : ∀ i, 0 ≤ (red i).eval y := by + intro i + rcases i with i | ⟨p, m⟩ + · have hi := hx i.val + rw [Form.eval_succ, i.property, Rat.cast_zero, zero_mul, zero_add] at hi + exact hi + · have hp : (0 : ℝ) < ((f p.val).coeff 0 : ℝ) := by exact_mod_cast p.property + have hm : ((f m.val).coeff 0 : ℝ) < 0 := by exact_mod_cast m.property + have hpx := hx p.val + have hmx := hx m.val + rw [Form.eval_succ] at hpx hmx + have hl : -x 0 ≤ (f p.val).tail.eval y / ((f p.val).coeff 0 : ℝ) := by + apply (le_div_iff₀ hp).mpr + dsimp only [y] + nlinarith only [hpx] + have hu : (f m.val).tail.eval y / ((f m.val).coeff 0 : ℝ) ≤ -x 0 := by + apply (div_le_iff_of_neg hm).mpr + dsimp only [y] + nlinarith only [hmx] + have he : (red (Sum.inr (p, m))).eval y = + (f p.val).tail.eval y / ((f p.val).coeff 0 : ℝ) - + (f m.val).tail.eval y / ((f m.val).coeff 0 : ℝ) := by + simp only [red, Form.eval_combine, Rat.cast_inv, Rat.cast_neg, div_eq_mul_inv] + ring + rw [he] + linarith only [hl, hu] + obtain ⟨q, hq⟩ := ih red ⟨y, hred⟩ + let lower (p : P) : ℚ := -(f p.val).tail.eval q / (f p.val).coeff 0 + let upper (m : N) : ℚ := -(f m.val).tail.eval q / (f m.val).coeff 0 + have hcross : ∀ p m, lower p ≤ upper m := by + intro p m + have hr := hq (Sum.inr (p, m)) + have he : (red (Sum.inr (p, m))).eval q = upper m - lower p := by + simp only [red, Form.eval_combine, Rat.cast_id, lower, upper, div_eq_mul_inv] + ring + rw [he] at hr + exact sub_nonneg.mp hr + obtain ⟨t, htL, htU⟩ := finite_interval_indexed lower upper hcross + refine ⟨Fin.cons t q, fun i => ?_⟩ + rw [Form.eval_succ] + simp only [Rat.cast_id, Fin.cons_zero, Fin.cons_succ] + rcases lt_trichotomy ((f i).coeff 0) 0 with hn | hz | hp + · have ht := htU ⟨i, hn⟩ + change t ≤ -(f i).tail.eval q / (f i).coeff 0 at ht + have hb := (le_div_iff_of_neg hn).mp ht + nlinarith only [hb] + · have hi := hq (Sum.inl ⟨i, hz⟩) + change 0 ≤ (f i).tail.eval q at hi + simpa only [hz, zero_mul, zero_add] using hi + · have ht := htL ⟨i, hp⟩ + change -(f i).tail.eval q / (f i).coeff 0 ≤ t at ht + have hb := (div_le_iff₀ hp).mp ht + nlinarith only [hb] + + +def realify {Prime : Type*} (D : Prime →₀ ℚ) : Prime →₀ ℝ := + D.mapRange (fun a : ℚ => (a : ℝ)) (by simp) + +@[simp] lemma realify_apply {Prime : Type*} (D : Prime →₀ ℚ) (p : Prime) : + realify D p = (D p : ℝ) := rfl + + + +theorem recover_coefficients {Prime : Type*} {n : ℕ} + (D : Prime →₀ ℚ) (P : Fin n → Prime →₀ ℚ) (a : Fin n → ℝ) + (ha : 0 ≤ realify D + ∑ j, a j • realify (P j)) : + ∃ b : Fin n → ℚ, 0 ≤ D + ∑ j, b j • P j := by + classical + let S : Finset Prime := D.support ∪ Finset.univ.biUnion (fun j => (P j).support) + let forms : S → Form n := fun p => ⟨D p.val, fun j => P j p.val⟩ + have hforms : ∀ p : S, 0 ≤ (forms p).eval a := by + intro p + have h := ha p.val + simpa only [Finsupp.zero_apply, Finsupp.add_apply, realify_apply, + Finsupp.finsetSum_apply, Finsupp.smul_apply, smul_eq_mul, + forms, Form.eval, mul_comm] using h + obtain ⟨b, hb⟩ := exists_rat_solution n forms ⟨a, hforms⟩ + refine ⟨b, fun p => ?_⟩ + by_cases hp : p ∈ S + · have h := hb ⟨p, hp⟩ + simpa only [forms, Form.eval, Rat.cast_id, Finsupp.zero_apply, Finsupp.add_apply, + Finsupp.finsetSum_apply, Finsupp.smul_apply, smul_eq_mul, mul_comm] using h + · have hD : D p = 0 := Finsupp.notMem_support_iff.mp (by + intro h + exact hp (Finset.mem_union_left _ h)) + have hP : ∀ j, P j p = 0 := by + intro j + apply Finsupp.notMem_support_iff.mp + intro h + apply hp + exact Finset.mem_union_right _ (Finset.mem_biUnion.mpr ⟨j, Finset.mem_univ _, h⟩) + simp [hD, hP] + + + +theorem rational_recovery {Prime Functions : Type*} + (principal : Functions → Prime →₀ ℚ) (D : Prime →₀ ℚ) + (h : ∃ E : Prime →₀ ℝ, 0 ≤ E ∧ + ∃ (n : ℕ) (f : Fin n → Functions) (a : Fin n → ℝ), + E = realify D + ∑ j, a j • realify (principal (f j))) : + ∃ E : Prime →₀ ℚ, 0 ≤ E ∧ + ∃ (n : ℕ) (f : Fin n → Functions) (b : Fin n → ℚ), + E = D + ∑ j, b j • principal (f j) := by + obtain ⟨E, hE, n, f, a, rfl⟩ := h + obtain ⟨b, hb⟩ := recover_coefficients D (fun j => principal (f j)) a hE + exact ⟨D + ∑ j, b j • principal (f j), hb, n, f, b, rfl⟩ + +end RationalRecovery +end ControlledBoundary + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Boundary.lean b/lean/OAI/Algebra/Drinfeld/Boundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7deeca865116646f532fe8e79fafc04e97f3cad --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Boundary.lean @@ -0,0 +1,841 @@ +import OAI.Algebra.Drinfeld.BraidExp + +namespace OAI + +noncomputable section + +section +namespace RealDeligneDrinfeld.BraidInsertionSum +open DeligneDrinfeld.CategoryExp +attribute [local instance] LieRing.ofAssociativeRing +variable {I : Type*} (N : ℕ) (s : Finset I) (q : I → L) (n : I → ℕ) + (hqn : ∀ i,q i∈Ln (n i)) + theorem loop_x : (free N s q n hqn).D 0 0 (FreeCutoffCategory.j N x)=0 := by + rw [free,DeligneDrinfeld.CategoryExp.sum_apply] + apply Finset.sum_eq_zero + intro i _hi + rw [FreeCutoffCategory.loop_j] + rw [DeligneDrinfeld.CategoryGauge.loop_apply] + change FreeCutoffCategory.j N (derivation (q i) x+⁅(0:L),x⁆)=0 + rw [derivation_apply,D_x,zero_lie,add_zero,map_zero] + theorem loop_y : (free N s q n hqn).D 0 0 (FreeCutoffCategory.j N y)= + FreeCutoffCategory.j N y*FreeCutoffCategory.j N (∑ i∈s,q i)- + FreeCutoffCategory.j N (∑ i∈s,q i)*FreeCutoffCategory.j N y := by + rw [free,DeligneDrinfeld.CategoryExp.sum_apply,map_sum,Finset.mul_sum,Finset.sum_mul,←Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro i _hi + rw [FreeCutoffCategory.loop_j] + rw [DeligneDrinfeld.CategoryGauge.loop_apply] + change FreeCutoffCategory.j N (derivation (q i) y+⁅(0:L),y⁆)=_ + rw [derivation_apply,D_y,zero_lie,add_zero,LieHom.map_lie,Ring.lie_def] +end RealDeligneDrinfeld.BraidInsertionSum + +namespace RealDeligneDrinfeld.KZLogDifference +open DeligneDrinfeld DeligneDrinfeld.KZRealLog DeligneDrinfeld.KZComparison +open BraidInsertionSum +variable {I : Type*} (N : ℕ) (s : Finset I) (q : I → L) (n : I → ℕ) + (hqn : ∀ i,q i∈Ln (n i)) (hn : ∀ i,2 (KZRealLog.data N).comp false false false b a) (fun a b => (free N s q n hqn).comp 0 0 0 b a) + ((KZRealLog.data N).one false) ((free N s q n hqn).one 0) + · exact KZRealLog.loop_x N + · simpa only [x,FreeCutoffCategory.j_of] using BraidInsertionSum.loop_x N s q n hqn + · exact KZRealLog.loop_false_y N + · simpa only [y,FreeCutoffCategory.j_of] using BraidInsertionSum.loop_y N s q n hqn + · exact hq + · exact ha + include hn in + theorem exponential (k : ℕ) + (hq : KZComparison.value N-FreeCutoffCategory.j N (∑ i∈s,q i)∈FreeCutoffCategory.F N k) : + (negative N:FreeCutoffCategory.Q N)-CategoryExp.act (free N s q n hqn) 0 1 (positive N)- + (KZComparison.value N-FreeCutoffCategory.j N (∑ i∈s,q i))∈FreeCutoffCategory.F N (k+1) := by + have hh := CategoryExp.exp_difference_unit (CutoffCategory.filtration ∅ N) + (KZRealLog.D N false true) ((free N s q n hqn).D 0 1) k + (KZRealLog.raises N false true) (free_raises N s q n hqn hn 0 1) + (difference N s q n hqn k hq) (positive_weight N) + rw [KZRealLog.exp_comparison,KZRealLog.value,BraidInsertionSum.unit] at hh + exact hh +end RealDeligneDrinfeld.KZLogDifference + +end + +namespace DeligneDrinfeld.PoleEstimate + +section +open MeasureTheory Set intervalIntegral + +lemma continuousOn_inv {a b : ℝ} (ha : 0 t⁻¹) (Icc a b) := + continuousOn_id.inv₀ (fun _ ht => ne_of_gt (ha.trans_le ht.1)) + +lemma integral_inv_sq {a b : ℝ} (ha : 0 (t⁻¹)^2) volume a b := + ((continuousOn_inv ha).pow 2).intervalIntegrable_of_Icc hab + have hd (t : ℝ) (ht : t∈uIcc a b) : HasDerivAt (fun t : ℝ => -t⁻¹) ((t⁻¹)^2) t := by + rw [uIcc_of_le hab] at ht + have h := ((hasDerivAt_id t).inv (ne_of_gt (ha.trans_le ht.1))).neg + convert! h using 1 + simp [div_eq_mul_inv,inv_pow] + have h := integral_eq_sub_of_hasDerivAt hd hi + linarith + +lemma integral_inv_sq_le {a b : ℝ} (ha : 0 |(t+δ)⁻¹-t⁻¹|) (Icc a b) := + (((continuousOn_id.add continuousOn_const).inv₀ + (fun t ht => ne_of_gt (show 0 δ*(t⁻¹)^2) volume a b := + (continuousOn_const.mul ((continuousOn_inv ha).pow 2)).intervalIntegrable_of_Icc hab + calc + _ ≤ ∫ t in a..b,δ*(t⁻¹)^2 := integral_mono_on hab (hc.intervalIntegrable_of_Icc hab) hi + (fun t ht => abs_inv_add_sub_inv_le (ha.trans_le ht.1) hδ) + _ = δ*(∫ t in a..b,(t⁻¹)^2) := integral_const_mul _ _ + _ ≤ δ*a⁻¹ := mul_le_mul_of_nonneg_left (integral_inv_sq_le ha hab) hδ + +lemma integral_abs_inv_sub_sub_inv_le {a b δ : ℝ} (ha : 0 |(t-δ)⁻¹-t⁻¹|) (Icc a b) := + (((continuousOn_id.sub continuousOn_const).inv₀ + (fun t ht => ne_of_gt (show 0 2*δ*(t⁻¹)^2) volume a b := + (continuousOn_const.mul ((continuousOn_inv ha).pow 2)).intervalIntegrable_of_Icc hab + calc + _ ≤ ∫ t in a..b,2*δ*(t⁻¹)^2 := integral_mono_on hab (hc.intervalIntegrable_of_Icc hab) hi + (fun t ht => abs_inv_sub_sub_inv_le (ha.trans_le ht.1) hδ (hd.trans ht.1)) + _ = 2*δ*(∫ t in a..b,(t⁻¹)^2) := integral_const_mul _ _ + _ ≤ 2*δ*a⁻¹ := mul_le_mul_of_nonneg_left (integral_inv_sq_le ha hab) (by positivity) + +end + +open MeasureTheory Set intervalIntegral FinitePicard KZCollar +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +omit [NormedAlgebra ℝ A] in +theorem integralNorm_add_le {f g : ℝ → A} {a b : ℝ} (hab : a ≤ b) + (hf : IntervalIntegrable f volume a b) (hg : IntervalIntegrable g volume a b) : + integralNorm (fun t => f t+g t) a b ≤ integralNorm f a b+integralNorm g a b := by + calc + _ ≤ ∫ t in a..b,‖f t‖+‖g t‖ := integral_mono_on hab (hf.add hg).norm (hf.norm.add hg.norm) + (fun _ _ => norm_add_le _ _) + _ = _ := intervalIntegral.integral_add hf.norm hg.norm + +lemma scalar_right_inv_continuous {a b : ℝ} (hb : b<1) : + ContinuousOn (fun t : ℝ => (t-1)⁻¹) (Icc a b) := + (continuousOn_id.sub continuousOn_const).inv₀ + (fun t ht => ne_of_lt (show t-1<0 by linarith [ht.2])) + +lemma integral_right_inv_abs {a b : ℝ} (ha : 0 |(t-1)⁻¹|)=fun t => |(1-t)⁻¹| := by + funext t + rw [show t-1=-(1-t) by ring,inv_neg,abs_neg] + rw [he,integral_comp_sub_left (fun t : ℝ => |t⁻¹|) 1] + have hba : 1-b ≤ 1-a := by linarith + have he' : (∫ t in (1-b)..(1-a),|t⁻¹|)=∫ t in (1-b)..(1-a),t⁻¹ := by + apply integral_congr + intro t ht + rw [uIcc_of_le hba] at ht + exact abs_of_nonneg (inv_nonneg.mpr (by linarith [ht.1])) + rw [he'] + exact integral_inv_le (by linarith) hba (by linarith) + +theorem bulkForm_mass {X Y : A} {a b : ℝ} (ha : 0 t⁻¹ • X) volume a b := (hc0.smul (continuousOn_const (c:=X))).intervalIntegrable_of_Icc hab + have hi1 : IntervalIntegrable (fun t : ℝ => (t-1)⁻¹ • Y) volume a b := (hc1.smul (continuousOn_const (c:=Y))).intervalIntegrable_of_Icc hab + have h0 : integralNorm (fun t : ℝ => t⁻¹ • X) a b ≤ ‖X‖*(-Real.log a) := by + unfold integralNorm + simp only [norm_smul,Real.norm_eq_abs] + rw [intervalIntegral.integral_mul_const] + have he : (∫ t in a..b,|t⁻¹|)=∫ t in a..b,t⁻¹ := by + apply integral_congr + intro t ht + rw [uIcc_of_le hab] at ht + exact abs_of_nonneg (inv_nonneg.mpr (ha.le.trans ht.1)) + rw [he,mul_comm] + exact mul_le_mul_of_nonneg_left (integral_inv_le ha hab hb.le) (norm_nonneg _) + have h1 : integralNorm (fun t : ℝ => (t-1)⁻¹ • Y) a b ≤ ‖Y‖*(-Real.log (1-b)) := by + unfold integralNorm + simp only [norm_smul,Real.norm_eq_abs] + rw [intervalIntegral.integral_mul_const,mul_comm] + exact mul_le_mul_of_nonneg_left (integral_right_inv_abs ha hab hb) (norm_nonneg _) + exact (integralNorm_add_le hab hi0 hi1).trans (add_le_add h0 h1) + +def shiftedBulk (X Y U V : A) (δ t : ℝ) : A := + bulkForm X Y t+((t+δ)⁻¹-t⁻¹) • U+((t+δ-1)⁻¹-(t-1)⁻¹) • V + +lemma right_shift_abs (δ t : ℝ) : + |(t+δ-1)⁻¹-(t-1)⁻¹|=|((1-t)-δ)⁻¹-(1-t)⁻¹| := by + rw [show t+δ-1=-((1-t)-δ) by ring,show t-1=-(1-t) by ring,inv_neg,inv_neg,neg_sub_neg,abs_sub_comm] + +lemma integral_right_shift {a b δ : ℝ} (hab : a ≤ b) (hb : b<1) (hδ : 0 ≤ δ) (hd : 2*δ ≤ 1-b) : + (∫ t in a..b,|(t+δ-1)⁻¹-(t-1)⁻¹|) ≤ 2*δ*(1-b)⁻¹ := by + simp_rw [right_shift_abs] + rw [integral_comp_sub_left (fun t => |(t-δ)⁻¹-t⁻¹|) 1] + exact integral_abs_inv_sub_sub_inv_le (by linarith) (by linarith) hδ hd + +lemma shiftedBulk_continuous (X Y U V : A) {a b δ : ℝ} + (ha : 0 (t+δ)⁻¹) (Icc a b) := + (continuousOn_id.add continuousOn_const).inv₀ + (fun t ht => ne_of_gt (show 0 (t+δ-1)⁻¹) (Icc a b) := + ((continuousOn_id.add continuousOn_const).sub continuousOn_const).inv₀ + (fun t ht => ne_of_lt (show t+δ-1<0 by linarith [ht.2])) + exact (((h0.smul continuousOn_const).add (h1.smul continuousOn_const)).add + ((h2.sub h0).smul continuousOn_const)).add ((h3.sub h1).smul continuousOn_const) + +lemma shiftedBulk_error_mass {X Y U V : A} {a b δ : ℝ} + (ha : 0 shiftedBulk X Y U V δ t-bulkForm X Y t) a b ≤ + ‖U‖*(δ*a⁻¹)+‖V‖*(2*δ*(1-b)⁻¹) := by + have h0 := continuousOn_inv (b:=b) ha + have h1 := scalar_right_inv_continuous (a:=a) hb + have h2 : ContinuousOn (fun t : ℝ => (t+δ)⁻¹) (Icc a b) := + (continuousOn_id.add continuousOn_const).inv₀ + (fun t ht => ne_of_gt (show 0 (t+δ-1)⁻¹) (Icc a b) := + ((continuousOn_id.add continuousOn_const).sub continuousOn_const).inv₀ + (fun t ht => ne_of_lt (show t+δ-1<0 by linarith [ht.2])) + have he : (fun t => shiftedBulk X Y U V δ t-bulkForm X Y t)= + (fun t => ((t+δ)⁻¹-t⁻¹) • U+((t+δ-1)⁻¹-(t-1)⁻¹) • V) := by + funext t + unfold shiftedBulk + abel + rw [he] + calc + _ ≤ integralNorm (fun t => ((t+δ)⁻¹-t⁻¹) • U) a b+ + integralNorm (fun t => ((t+δ-1)⁻¹-(t-1)⁻¹) • V) a b := + integralNorm_add_le hab (((h2.sub h0).smul continuousOn_const).intervalIntegrable_of_Icc hab) + (((h3.sub h1).smul continuousOn_const).intervalIntegrable_of_Icc hab) + _ = ‖U‖*(∫ t in a..b,|(t+δ)⁻¹-t⁻¹|)+‖V‖*(∫ t in a..b,|(t+δ-1)⁻¹-(t-1)⁻¹|) := by + simp only [integralNorm,norm_smul,Real.norm_eq_abs,intervalIntegral.integral_mul_const] + ring + _ ≤ _ := add_le_add + (mul_le_mul_of_nonneg_left (integral_abs_inv_add_sub_inv_le ha hab hδ) (norm_nonneg _)) + (mul_le_mul_of_nonneg_left (integral_right_shift hab hb hδ hd) (norm_nonneg _)) + +end DeligneDrinfeld.PoleEstimate + +namespace DeligneDrinfeld.FourCollar +open MeasureTheory Set Filter FinitePicard KZCollar RegularSingular +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def form (a b d e f : A) (x y vx vy : ℝ) : A := + (vx/x) • a+(vy/y) • b+((vy-vx)/(y-x)) • d+ + (vx/(x-1)) • e+(vy/(y-1)) • f + +def cx : Fin 5 → ℝ → ℝ := ![(fun s => s^2),(fun s => s), + (fun s => 1-s-s^2),(fun s => s^2),(fun s => 1-s)] +def cy : Fin 5 → ℝ → ℝ := ![(fun s => s),(fun s => s+s^2), + (fun s => 1-s),(fun s => 1-s^2),(fun s => 1-s^2)] +def vx : Fin 5 → ℝ → ℝ := ![(fun s => 2*s),(fun _ => 1), + (fun s => -1-2*s),(fun s => 2*s),(fun _ => -1)] +def vy : Fin 5 → ℝ → ℝ := ![(fun _ => 1),(fun s => 1+2*s), + (fun _ => -1),(fun s => -2*s),(fun s => -2*s)] + +def residue (a b d e f : A) : Fin 5 → A := + ![2 • a+b+d,a+b+2 • d,f+e+2 • d,2 • a+2 • f,2 • f+e+d] + +def remainder (a b d e f : A) : Fin 5 → ℝ → A := + ![(fun s => -((1-s)⁻¹) • (d+f)-(2*s/(1-s^2)) • e), + (fun s => (1+s)⁻¹ • b-(1-s)⁻¹ • e-((1+2*s)/(1-s-s^2)) • f), + (fun s => (1+s)⁻¹ • e-(1-s)⁻¹ • b-((1+2*s)/(1-s-s^2)) • a), + (fun s => -(2*s/(1-s^2)) • (b+e)-(4*s/(1-2*s^2)) • d), + (fun s => -((1-s)⁻¹) • (d+a)-(2*s/(1-s^2)) • b)] + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem coordinates_derivative (i : Fin 5) (s : ℝ) : + HasDerivAt (cx i) (vx i s) s ∧ HasDerivAt (cy i) (vy i s) s := by + have hd : HasDerivAt (fun t : ℝ => t) 1 s := hasDerivAt_id s + have hc (c : ℝ) : HasDerivAt (fun _ : ℝ => c) 0 s := hasDerivAt_const s c + have hp : HasDerivAt (fun s : ℝ => s^2) (2*s) s := by + convert! hd.pow 2 using 1; norm_num + fin_cases i + · change HasDerivAt (fun s : ℝ => s^2) (2*s) s ∧ HasDerivAt id 1 s + exact ⟨hp,hd⟩ + · change HasDerivAt id 1 s ∧ HasDerivAt (fun s : ℝ => s+s^2) (1+2*s) s + exact ⟨hd,hd.add hp⟩ + · change HasDerivAt (fun s : ℝ => 1-s-s^2) (-1-2*s) s ∧ HasDerivAt (fun s : ℝ => 1-s) (-1) s + exact ⟨by simpa using! ((hc 1).sub hd).sub hp,by simpa using! (hc 1).sub hd⟩ + · change HasDerivAt (fun s : ℝ => s^2) (2*s) s ∧ HasDerivAt (fun s : ℝ => 1-s^2) (-2*s) s + exact ⟨hp,by simpa using! (hc 1).sub hp⟩ + · change HasDerivAt (fun s : ℝ => 1-s) (-1) s ∧ HasDerivAt (fun s : ℝ => 1-s^2) (-2*s) s + exact ⟨by simpa using! (hc 1).sub hd,by simpa using! (hc 1).sub hp⟩ + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem scalar_nonzero {s : ℝ} (hs : s∈Icc 0 (1/4)) : + 1-s≠0 ∧ 1+s≠0 ∧ 1-s^2≠0 ∧ 1-s-s^2≠0 ∧ 1-2*s^2≠0 := by + have hsq : s^2≤1/16 := by nlinarith [hs.1,hs.2,sq_nonneg (s-1/4)] + exact ⟨by linarith [hs.2],by linarith [hs.1],by linarith, + by linarith [hs.2],by linarith⟩ + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem chamber (i : Fin 5) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + 0 field_simp [h0,h1,hp,h2,h3,h4,hss,hsp,hm,hs2,hn3,hnsp,hn4] <;> ring + · change form a b d e f s (s+s^2) 1 (1+2*s)= + s⁻¹ • (a+b+2 • d)+((1+s)⁻¹ • b-(1-s)⁻¹ • e-((1+2*s)/(1-s-s^2)) • f) + unfold form + match_scalars <;> field_simp [h0,h1,hp,h2,h3,h4,hss,hsp,hm,hs2,hn3,hnsp,hn4] <;> first | ring1 | (ring_nf; field_simp [h0,hn3,hnsp,hn4,hnp]; ring) + · change form a b d e f (1-s-s^2) (1-s) (-1-2*s) (-1)= + s⁻¹ • (f+e+2 • d)+((1+s)⁻¹ • e-(1-s)⁻¹ • b-((1+2*s)/(1-s-s^2)) • a) + unfold form + match_scalars <;> field_simp [h0,h1,hp,h2,h3,h4,hss,hsp,hm,hs2,hn3,hnsp,hn4] <;> first | ring1 | (ring_nf; field_simp [h0,hn3,hnsp,hn4,hnp]; ring) + · change form a b d e f (s^2) (1-s^2) (2*s) (-2*s)= + s⁻¹ • (2 • a+2 • f)+(-(2*s/(1-s^2)) • (b+e)-(4*s/(1-2*s^2)) • d) + unfold form + match_scalars <;> field_simp [h0,h1,hp,h2,h3,h4,hss,hsp,hm,hs2,hn3,hnsp,hn4] <;> first | ring1 | (ring_nf; field_simp [h0,hn3,hnsp,hn4,hnp]; ring) + · change form a b d e f (1-s) (1-s^2) (-1) (-2*s)= + s⁻¹ • (2 • f+e+d)+(-((1-s)⁻¹) • (d+a)-(2*s/(1-s^2)) • b) + unfold form + match_scalars <;> field_simp [h0,h1,hp,h2,h3,h4,hss,hsp,hm,hs2,hn3,hnsp,hn4] <;> ring + + theorem remainder_continuous (a b d e f : A) (i : Fin 5) : + ContinuousOn (remainder a b d e f i) (Icc 0 (1/4)) := by + have h1 : ContinuousOn (fun s : ℝ => (1-s)⁻¹) (Icc 0 (1/4)) := + (continuousOn_const.sub continuousOn_id).inv₀ (fun s hs => (scalar_nonzero hs).1) + have hp : ContinuousOn (fun s : ℝ => (1+s)⁻¹) (Icc 0 (1/4)) := + (continuousOn_const.add continuousOn_id).inv₀ (fun s hs => (scalar_nonzero hs).2.1) + have h2 : ContinuousOn (fun s : ℝ => 2*s/(1-s^2)) (Icc 0 (1/4)) := + (continuousOn_const.mul continuousOn_id).div (continuousOn_const.sub (continuousOn_id.pow 2)) + (fun s hs => (scalar_nonzero hs).2.2.1) + have h3 : ContinuousOn (fun s : ℝ => (1+2*s)/(1-s-s^2)) (Icc 0 (1/4)) := + (continuousOn_const.add (continuousOn_const.mul continuousOn_id)).div + ((continuousOn_const.sub continuousOn_id).sub (continuousOn_id.pow 2)) + (fun s hs => (scalar_nonzero hs).2.2.2.1) + have h4 : ContinuousOn (fun s : ℝ => 4*s/(1-2*s^2)) (Icc 0 (1/4)) := + (continuousOn_const.mul continuousOn_id).div + (continuousOn_const.sub (continuousOn_const.mul (continuousOn_id.pow 2))) + (fun s hs => (scalar_nonzero hs).2.2.2.2) + fin_cases i + all_goals norm_num only [remainder,Fin.reduceFinMk,Matrix.cons_val_zero,Matrix.cons_val_succ] + · exact ((h1.neg).smul continuousOn_const).sub (h2.smul continuousOn_const) + · exact ((hp.smul continuousOn_const).sub (h1.smul continuousOn_const)).sub (h3.smul continuousOn_const) + · exact ((hp.smul continuousOn_const).sub (h1.smul continuousOn_const)).sub (h3.smul continuousOn_const) + · exact ((h2.neg).smul continuousOn_const).sub (h4.smul continuousOn_const) + · exact ((h1.neg).smul continuousOn_const).sub (h2.smul continuousOn_const) + +variable (F : NilpotentFiltration A) {a b d e f : A} + (ha : a∈F.space 1) (hb : b∈F.space 1) (hd : d∈F.space 1) + (he : e∈F.space 1) (hf : f∈F.space 1) + +include ha hb hd he hf + +theorem residue_mem (i : Fin 5) : residue a b d e f i∈F.space 1 := by + fin_cases i + · exact (F.space 1).add_mem ((F.space 1).add_mem ((F.space 1).nsmul_mem ha _) hb) hd + · exact (F.space 1).add_mem ((F.space 1).add_mem ha hb) ((F.space 1).nsmul_mem hd _) + · exact (F.space 1).add_mem ((F.space 1).add_mem hf he) ((F.space 1).nsmul_mem hd _) + · exact (F.space 1).add_mem ((F.space 1).nsmul_mem ha _) ((F.space 1).nsmul_mem hf _) + · exact (F.space 1).add_mem ((F.space 1).add_mem ((F.space 1).nsmul_mem hf _) he) hd + +theorem remainder_mem (i : Fin 5) (s : ℝ) : remainder a b d e f i s∈F.space 1 := by + fin_cases i + · exact (F.space 1).sub_mem ((F.space 1).smul_mem _ ((F.space 1).add_mem hd hf)) + ((F.space 1).smul_mem _ he) + · exact (F.space 1).sub_mem ((F.space 1).sub_mem ((F.space 1).smul_mem _ hb) + ((F.space 1).smul_mem _ he)) ((F.space 1).smul_mem _ hf) + · exact (F.space 1).sub_mem ((F.space 1).sub_mem ((F.space 1).smul_mem _ he) + ((F.space 1).smul_mem _ hb)) ((F.space 1).smul_mem _ ha) + · exact (F.space 1).sub_mem ((F.space 1).smul_mem _ ((F.space 1).add_mem hb he)) + ((F.space 1).smul_mem _ hd) + · exact (F.space 1).sub_mem ((F.space 1).smul_mem _ ((F.space 1).add_mem hd ha)) + ((F.space 1).smul_mem _ hb) + +def normalized (i : Fin 5) : ℝ → A := + RegularSingular.solution F (residue a b d e f i) (remainder a b d e f i) + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem normalized_derivative (i : Fin 5) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + HasDerivAt (normalized F (a:=a) (b:=b) (d:=d) (e:=e) (f:=f) i) + (form a b d e f (cx i s) (cy i s) (vx i s) (vy i s)*normalized F (a:=a) (b:=b) (d:=d) (e:=e) (f:=f) i s) s := by + rw [form_collar a b d e f i ⟨hs.1,hs.2.le⟩] + exact solution_derivative F (residue_mem F ha hb hd he hf i) + (remainder_mem F ha hb hd he hf i) (remainder_continuous a b d e f i) hs + +omit [FiniteDimensional ℝ A] in +theorem normalized_limit (i : Fin 5) : + Tendsto (fun s => gauge (-residue a b d e f i) s*normalized F (a:=a) (b:=b) (d:=d) (e:=e) (f:=f) i s) + (𝓝[>] 0) (𝓝 (1:A)) := + solution_limit F (residue_mem F ha hb hd he hf i) (by norm_num : (0:ℝ)<1/4) + (remainder_continuous a b d e f i) + +theorem normalized_isUnit (i : Fin 5) (s : ℝ) : + IsUnit (normalized F (a:=a) (b:=b) (d:=d) (e:=e) (f:=f) i s) := + solution_isUnit F (residue_mem F ha hb hd he hf i) (remainder_mem F ha hb hd he hf i) s + +end DeligneDrinfeld.FourCollar + +namespace DeligneDrinfeld.BCBoundary + +section +open MeasureTheory Set Filter Asymptotics FinitePicard KZCollar PowerAsymptotic PoleEstimate +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def endpoint (s : ℝ) : ℝ := 1-s-s^2 + +theorem interval_bounds {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + s ≤ endpoint s ∧ endpoint s<1 ∧ 2*s^2 ≤ 1-endpoint s := by + have hsq : s^2 ≤ 1/16 := by nlinarith [hs.1,hs.2,sq_nonneg (s-1/4)] + simp only [endpoint] + exact ⟨by nlinarith [hs.1,hs.2],by nlinarith [hs.1],by nlinarith [hs.1,hs.2]⟩ + +theorem form_eq (a b d e f : A) (s t : ℝ) : + FourCollar.form a b d e f t (t+s^2) 1 1=shiftedBulk (a+b) (e+f) b f (s^2) t := by + simp only [FourCollar.form,shiftedBulk,bulkForm,one_div,sub_self,zero_div,zero_smul,add_zero, + smul_add,sub_smul] + abel + +theorem error_bound (X Y U V : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + integralNorm (fun t => shiftedBulk X Y U V (s^2) t-bulkForm X Y t) s (endpoint s) ≤ + (‖U‖+2*‖V‖)*s := by + obtain ⟨hab,hb,hd⟩ := interval_bounds hs + have h := shiftedBulk_error_mass (X:=X) (Y:=Y) (U:=U) (V:=V) hs.1 hab hb (sq_nonneg s) hd + have he : s^2*s⁻¹=s := by field_simp + have hgap : s ≤ 1-endpoint s := by dsimp [endpoint]; nlinarith [sq_nonneg s] + have hr : (1-endpoint s)⁻¹ ≤ s⁻¹ := inv_anti₀ hs.1 hgap + have he2 : 2*s^2*(1-endpoint s)⁻¹ ≤ 2*s := by + calc + _ ≤ 2*s^2*s⁻¹ := mul_le_mul_of_nonneg_left hr (by positivity) + _ = 2*s := by rw [mul_assoc,he] + calc + _ ≤ ‖U‖*(s^2*s⁻¹)+‖V‖*(2*s^2*(1-endpoint s)⁻¹) := h + _ ≤ ‖U‖*s+‖V‖*(2*s) := by rw [he]; exact add_le_add le_rfl (mul_le_mul_of_nonneg_left he2 (norm_nonneg V)) + _ = _ := by ring + +theorem bulk_bound (X Y : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + integralNorm (bulkForm X Y) s (endpoint s) ≤ (‖X‖+‖Y‖)*(-Real.log s) := by + obtain ⟨hab,hb,hd⟩ := interval_bounds hs + have hh : -Real.log (1-endpoint s) ≤ -Real.log s := by + apply neg_le_neg + exact Real.log_le_log hs.1 (by dsimp [endpoint]; nlinarith [sq_nonneg s]) + calc + _ ≤ ‖X‖*(-Real.log s)+‖Y‖*(-Real.log (1-endpoint s)) := bulkForm_mass hs.1 hab hb + _ ≤ ‖X‖*(-Real.log s)+‖Y‖*(-Real.log s) := add_le_add le_rfl (mul_le_mul_of_nonneg_left hh (norm_nonneg Y)) + _ = _ := by ring + +def mass (X Y U V : A) (s : ℝ) : ℝ := + (‖X‖+‖Y‖)*(-Real.log s)+(‖U‖+2*‖V‖)*s + +omit [NormedAlgebra ℝ A] in +theorem mass_subpower (X Y U V : A) : Subpower (mass X Y U V) := by + have hl : Subpower (fun s : ℝ => -Real.log s) := by + simpa only [pow_one,neg_one_mul] using (const_subpower (-1:ℝ)).mul (log_pow_subpower 1) + exact ((const_subpower _).mul hl).add (continuousAt_subpower (continuousAt_const.mul continuousAt_id)) + +theorem perturbation (X Y U V : A) (N : ℕ) : + PowerSmall (fun s => transport (shiftedBulk X Y U V (s^2)) s N (endpoint s)- + transport (bulkForm X Y) s N (endpoint s)) := by + apply transport_perturbation_powerSmall (L:=mass X Y U V) + (E:=fun s => (‖U‖+2*‖V‖)*s) _ (mass_subpower X Y U V) (linear_powerSmall _) N + filter_upwards [Ioc_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + obtain ⟨hab,hb,hd⟩ := interval_bounds hs + have hcΩ := shiftedBulk_continuous X Y U V hs.1 hb (sq_nonneg s) hd + have hcΘ := (bulkForm_continuous X Y).mono (show Icc s (endpoint s)⊆Ioo 0 1 from + fun t ht => ⟨hs.1.trans_le ht.1,ht.2.trans_lt hb⟩) + have hiΩ : IntervalIntegrable (shiftedBulk X Y U V (s^2)) volume s (endpoint s) := hcΩ.intervalIntegrable_of_Icc hab + have hiΘ : IntervalIntegrable (bulkForm X Y) volume s (endpoint s) := hcΘ.intervalIntegrable_of_Icc hab + have hE : 0 ≤ (‖U‖+2*‖V‖)*s := mul_nonneg (by positivity) hs.1.le + have hlog : 0 ≤ -Real.log s := neg_nonneg.mpr (Real.log_nonpos hs.1.le (by linarith [hs.2])) + have hbase : 0 ≤ (‖X‖+‖Y‖)*(-Real.log s) := mul_nonneg (by positivity) hlog + have he := error_bound X Y U V hs + have hΘ := bulk_bound X Y hs + have hΩ : integralNorm (shiftedBulk X Y U V (s^2)) s (endpoint s) ≤ mass X Y U V s := by + have h := integralNorm_add_le hab hiΘ (hiΩ.sub hiΘ) + have hf : (fun t => bulkForm X Y t+(shiftedBulk X Y U V (s^2) t-bulkForm X Y t))= + shiftedBulk X Y U V (s^2) := by funext t; abel + rw [hf] at h + exact h.trans (add_le_add hΘ he) + exact ⟨hab,hiΩ,hiΘ,add_nonneg hbase hE,hE,hΩ,hΘ.trans (le_add_of_nonneg_right hE),he⟩ + +end + +open Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem shared_residue_cancel {X Y Z : A} {N : ℕ} (hZ : Z^(N+1)=0) + (hZX : Commute Z X) (hZY : Commute Z Y) (a b s : ℝ) : + gauge (-(Y+Z)) s*transport (bulkForm X Y) a N b*gauge (X+Z) s = + gauge (-Y) s*transport (bulkForm X Y) a N b*gauge X s := by + have ht := transport_commute Z (fun t : ℝ => (hZX.smul_right (t⁻¹)).add_right (hZY.smul_right ((t-1)⁻¹))) a N b + have hg := gauge_commute hZ ht.symm s + change Commute (transport (bulkForm X Y) a N b) (gauge Z s) at hg + have hy : gauge (-(Y+Z)) s=gauge (-Y) s*gauge (-Z) s := by + rw [neg_add,gauge_add_of_commute]; exact hZY.symm.neg_left.neg_right + have hx : gauge (X+Z) s=gauge Z s*gauge X s := by + rw [add_comm,gauge_add_of_commute hZX] + rw [hy,hx] + calc + _ = gauge (-Y) s*(gauge (-Z) s*(transport (bulkForm X Y) a N b*gauge Z s))*gauge X s := by simp only [mul_assoc] + _ = gauge (-Y) s*(gauge (-Z) s*(gauge Z s*transport (bulkForm X Y) a N b))*gauge X s := by rw [hg.eq] + _ = _ := by rw [←mul_assoc (gauge (-Z) s),gauge_neg_mul,one_mul] + +omit [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem gap_tendsto : Tendsto (fun s : ℝ => s+s^2) (𝓝[>] 0) (𝓝[>] 0) := by + apply tendsto_nhdsWithin_iff.mpr + constructor + · have h : Tendsto (fun s : ℝ => s) (𝓝[>] 0) (𝓝 0) := tendsto_id.mono_left nhdsWithin_le_nhds + simpa only [zero_pow (by omega : 2≠0),zero_add] using h.add (h.pow 2) + · filter_upwards [self_mem_nhdsWithin] with s hs + exact add_pos_of_pos_of_nonneg hs (sq_nonneg s) + +theorem bulk_limit (F : NilpotentFiltration A) {X Y : A} + (hX : X∈F.space 1) (hY : Y∈F.space 1) : + Tendsto (fun s => gauge (-Y) s*transport (bulkForm X Y) s F.cutoff (endpoint s)*gauge X s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have h := (gauge_ratio_limit Y).mul (regularizedBulk_two_limit F hX hY tendsto_id gap_tendsto) + simp only [one_mul] at h + apply h.congr' + filter_upwards [self_mem_nhdsWithin] with s hs + change 0 gauge (-(Y+Z)) s* + transport (shiftedBulk X Y U V (s^2)) s F.cutoff (endpoint s)*gauge (X+Z) s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have hl := normalized_perturbation_limit (perturbation X Y U V F.cutoff) + (gauge_subpower (pow_cutoff_eq_zero F ((F.space 1).neg_mem ((F.space 1).add_mem hY hZ)))) + (gauge_subpower (pow_cutoff_eq_zero F ((F.space 1).add_mem hX hZ))) + have hb := bulk_limit F hX hY + have he (s : ℝ) := shared_residue_cancel (pow_cutoff_eq_zero F hZ) hZX hZY s (endpoint s) s + have hb' : Tendsto (fun s => gauge (-(Y+Z)) s*transport (bulkForm X Y) s F.cutoff (endpoint s)*gauge (X+Z) s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := hb.congr (fun s => (he s).symm) + simpa only [zero_add,sub_add_cancel] using! hl.add hb' + +end DeligneDrinfeld.BCBoundary + +namespace DeligneDrinfeld.KZRectangle +open MeasureTheory Set Filter FinitePicard LogRectangle +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {K A : Type*} [NontriviallyNormedField K] [NormedAlgebra ℝ K] + [NormedRing A] [NormedAlgebra K A] [NormedAlgebra ℝ A] [IsScalarTower ℝ K A] + +def edges : Fin 6 → Fin 4×Fin 4 := ![(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)] +def dif (z : Fin 4 → K) (i : Fin 6) : K := z (edges i).1-z (edges i).2 + +def chords (j : GenericBraid.T K (Fin 4) →ₗ⁅K⁆ A) (i : Fin 6) : A := + j (GenericBraid.t (edges i).1 (edges i).2) + +omit [NormedAlgebra ℝ K] [NormedAlgebra ℝ A] [IsScalarTower ℝ K A] in +theorem form_eq (j : GenericBraid.T K (Fin 4) →ₗ⁅K⁆ A) (z v : Fin 4 → K) : + form (chords j) (dif z) (dif v)=j (KZFlat.connection z v) := by + simp only [form,Fin.sum_univ_succ,KZFlat.connection,KZFlat.combine,KZFlat.coefficients, + KZFlat.dlog,dif,chords,edges,map_add,map_smul] + norm_num only [Fin.reduceFinMk,Matrix.cons_val_zero,Matrix.cons_val_succ,Fin.isValue, + Fin.succ_zero_eq_one,Fin.succ_one_eq_two,Fin.zero_eta,Fin.mk_one] + simp only [Fin.sum_univ_zero,add_zero] + abel + +omit [NormedAlgebra ℝ K] [NormedAlgebra ℝ A] [IsScalarTower ℝ K A] in +theorem form_commute (j : GenericBraid.T K (Fin 4) →ₗ⁅K⁆ A) + (z v w : Fin 4 → K) (hz : Function.Injective z) : + Commute (form (chords j) (dif z) (dif v)) (form (chords j) (dif z) (dif w)) := by + rw [form_eq,form_eq] + have h := congrArg j (KZFlat.flat z v w hz) + rw [j.map_lie,map_zero] at h + exact sub_eq_zero.mp h + +omit [NormedRing A] [NormedAlgebra K A] [NormedAlgebra ℝ K] [NormedAlgebra ℝ A] + [IsScalarTower ℝ K A] in +theorem dif_ne_zero (z : Fin 4 → K) (hz : Function.Injective z) (i : Fin 6) : dif z i≠0 := by + apply sub_ne_zero.mpr (hz.ne _) + fin_cases i <;> decide + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem transport_derivative (F : NilpotentFiltration A) + (j : GenericBraid.T K (Fin 4) →ₗ⁅K⁆ A) + {z zs zt zst : ℝ → ℝ → Fin 4 → K} {a b u v s : ℝ} + (hab : a≤b) (huv : u≤v) + (hc : ∀ i (r : K),r • chords j i∈F.space 1) + (hz : ∀ i,ContinuousOn (fun w : ℝ×ℝ => z w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hs : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zs w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (ht : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zt w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hst : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zst w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hn : ∀ s∈Icc u v,∀ t∈Icc a b,Function.Injective (z s t)) + (hDsz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => z s t i) (zs s t i) s) + (hDszt : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => zt s t i) (zst s t i) s) + (hDtz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => z s t i) (zt s t i) t) + (hDtzs : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => zs s t i) (zst s t i) t) + (hss : s∈Ioo u v) : + HasDerivAt (fun s => transport (fun t => j (KZFlat.connection (z s t) (zt s t))) a F.cutoff b) + (j (KZFlat.connection (z s b) (zs s b))*transport (fun t => j (KZFlat.connection (z s t) (zt s t))) a F.cutoff b- + transport (fun t => j (KZFlat.connection (z s t) (zt s t))) a F.cutoff b*j (KZFlat.connection (z s a) (zs s a))) s := by + simp only [←form_eq] + apply LogRectangle.transport_derivative F (chords j) (z:=fun s t => dif (z s t)) + (zt:=fun s t => dif (zt s t)) (zs:=fun s t => dif (zs s t)) + (zst:=fun s t => dif (zst s t)) hab huv hc + · intro i + exact (hz _).sub (hz _) + · intro i + exact (hs _).sub (hs _) + · intro i + exact (ht _).sub (ht _) + · intro i + exact (hst _).sub (hst _) + · intro s hs t ht i + exact dif_ne_zero _ (hn s hs t ht) i + · intro s hs t ht i + exact (hDsz s hs t ht _).sub (hDsz s hs t ht _) + · intro s hs t ht i + exact (hDszt s hs t ht _).sub (hDszt s hs t ht _) + · intro s hs t ht i + exact (hDtz s hs t ht _).sub (hDtz s hs t ht _) + · intro s hs t ht i + exact (hDtzs s hs t ht _).sub (hDtzs s hs t ht _) + · intro t ht + exact form_commute j _ _ _ (hn s ⟨hss.1.le,hss.2.le⟩ t ht) + · exact hss + +theorem transport_homotopy (F : NilpotentFiltration A) + (j : GenericBraid.T K (Fin 4) →ₗ⁅K⁆ A) + {z zs zt zst : ℝ → ℝ → Fin 4 → K} {a b u v p q : ℝ} + (hab : a≤b) (huv : u z w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hs : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zs w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (ht : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zt w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hst : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zst w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hn : ∀ s∈Icc u v,∀ t∈Icc a b,Function.Injective (z s t)) + (hDsz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => z s t i) (zs s t i) s) + (hDszt : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => zt s t i) (zst s t i) s) + (hDtz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => z s t i) (zt s t i) t) + (hDtzs : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => zs s t i) (zst s t i) t) + (ha : ∀ s∈Ioo u v,zs s a=0) (hb : ∀ s∈Ioo u v,zs s b=0) + (hp : p∈Icc u v) (hq : q∈Icc u v) : + transport (fun t => j (KZFlat.connection (z p t) (zt p t))) a F.cutoff b= + transport (fun t => j (KZFlat.connection (z q t) (zt q t))) a F.cutoff b := by + simp only [←form_eq] + apply LogRectangle.transport_constant F (chords j) (p:=p) (q:=q) (z:=fun s t => dif (z s t)) + (zt:=fun s t => dif (zt s t)) (zs:=fun s t => dif (zs s t)) + (zst:=fun s t => dif (zst s t)) hab huv hc + · intro i + exact (hz _).sub (hz _) + · intro i + exact (hs _).sub (hs _) + · intro i + exact (ht _).sub (ht _) + · intro i + exact (hst _).sub (hst _) + · intro s hs t ht i + exact dif_ne_zero _ (hn s hs t ht) i + · intro s hs t ht i + exact (hDsz s hs t ht _).sub (hDsz s hs t ht _) + · intro s hs t ht i + exact (hDszt s hs t ht _).sub (hDszt s hs t ht _) + · intro s hs t ht i + exact (hDtz s hs t ht _).sub (hDtz s hs t ht _) + · intro s hs t ht i + exact (hDtzs s hs t ht _).sub (hDtzs s hs t ht _) + · intro s hs t ht + exact form_commute j _ _ _ (hn s ⟨hs.1.le,hs.2.le⟩ t ht) + · intro s hs + ext i + simp [dif,ha s hs] + · intro s hs + ext i + simp [dif,hb s hs] + · exact hp + · exact hq + +end DeligneDrinfeld.KZRectangle + +namespace DeligneDrinfeld.StraightKZ +open MeasureTheory Set Filter FinitePicard KZRectangle LogRectangle +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def segment (p q : Fin 4 → ℝ) (t : ℝ) (i : Fin 4) : ℝ := (1-t)*p i+t*q i + +def velocity (p q : Fin 4 → ℝ) (i : Fin 4) : ℝ := q i-p i + +@[simp] theorem segment_zero (p q : Fin 4 → ℝ) : segment p q 0=p := by + ext i; simp [segment] +@[simp] theorem segment_one (p q : Fin 4 → ℝ) : segment p q 1=q := by + ext i; simp [segment] + +theorem segment_strictMono {p q : Fin 4 → ℝ} (hp : StrictMono p) (hq : StrictMono q) + {t : ℝ} (ht : t∈Icc 0 1) : StrictMono (segment p q t) := by + intro i k hik + dsimp [segment] + have h0 := hp hik + have h1 := hq hik + have h := mul_nonneg (sub_nonneg.mpr ht.2) (sub_nonneg.mpr h0.le) + have hh := mul_nonneg ht.1 (sub_nonneg.mpr h1.le) + by_cases htp : 0 segment p q t i) (velocity p q i) t := by + have h : HasDerivAt (fun t : ℝ => t) 1 t := hasDerivAt_id t + convert! (((hasDerivAt_const t (1:ℝ)).sub h).mul_const (p i)).add (h.mul_const (q i)) using 1 + dsimp [velocity] + ring + +def connection (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (p q : Fin 4 → ℝ) (t : ℝ) : A := + j (KZFlat.connection (segment p q t) (velocity p q)) + +def fundamental (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (p q : Fin 4 → ℝ) : A := transport (connection j p q) 0 F.cutoff 1 + +lemma connection_mem (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) (z v : Fin 4 → ℝ) : j (KZFlat.connection z v)∈F.space 1 := by + rw [←form_eq] + exact (F.space 1).sum_mem (fun i hi => (F.space 1).smul_mem _ (hc i)) + +lemma zero_connection (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (p : Fin 4 → ℝ) : + j (KZFlat.connection p 0)=0 := by + rw [←form_eq] + simp [form,dif] + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +omit [CompleteSpace A] in +theorem fundamental_isUnit (F : NilpotentFiltration A) + (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (hc : ∀ i,chords j i∈F.space 1) (p q : Fin 4 → ℝ) : + IsUnit (fundamental F j p q) := + transport_isUnit F (fun _ => connection_mem F j hc _ _) _ _ _ + +theorem fundamental_derivative (F : NilpotentFiltration A) + (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (hc : ∀ i,chords j i∈F.space 1) + {p : Fin 4 → ℝ} {q q' : ℝ → Fin 4 → ℝ} {a b s : ℝ} + (hp : StrictMono p) (hq : ∀ s∈Icc a b,StrictMono (q s)) + (hqc : ∀ i,ContinuousOn (fun s => q s i) (Icc a b)) + (hqc' : ∀ i,ContinuousOn (fun s => q' s i) (Icc a b)) + (hqd : ∀ s∈Ioo a b,∀ i,HasDerivAt (fun s => q s i) (q' s i) s) + (hs : s∈Ioo a b) : + HasDerivAt (fun s => fundamental F j p (q s)) + (j (KZFlat.connection (q s) (q' s))*fundamental F j p (q s)) s := by + have hab : a≤b := le_trans hs.1.le hs.2.le + have hq2 (i : Fin 4) : ContinuousOn (fun w : ℝ×ℝ => q w.1 i) (Icc a b ×ˢ Icc 0 1) := + (hqc i).comp continuous_fst.continuousOn (fun w hw => hw.1) + have hq2' (i : Fin 4) : ContinuousOn (fun w : ℝ×ℝ => q' w.1 i) (Icc a b ×ˢ Icc 0 1) := + (hqc' i).comp continuous_fst.continuousOn (fun w hw => hw.1) + have h := KZRectangle.transport_derivative F j (z:=fun s t => segment p (q s) t) + (zt:=fun s _ => velocity p (q s)) (zs:=fun s t i => t*q' s i) + (zst:=fun s _ => q' s) (by norm_num : (0:ℝ)≤1) hab + (fun i r => (F.space 1).smul_mem r (hc i)) + (fun i => ((continuousOn_const.sub continuous_snd.continuousOn).mul continuousOn_const).add + (continuous_snd.continuousOn.mul (hq2 i))) + (fun i => continuous_snd.continuousOn.mul (hq2' i)) + (fun i => (hq2 i).sub continuousOn_const) (fun i => hq2' i) + (fun v hv t ht => (segment_strictMono hp (hq v hv) ht).injective) + (fun v hv t ht i => by + simpa only [segment,Pi.add_apply,zero_add] using! (hasDerivAt_const v ((1-t)*p i)).add ((hqd v hv i).const_mul t)) + (fun v hv t ht i => by + simpa [velocity] using! (hqd v hv i).sub_const (p i)) + (fun v hv t ht i => segment_derivative p (q v) t i) + (fun v hv t ht i => by + simpa using! (hasDerivAt_id t).mul_const (q' v i)) hs + have hzero : (fun i => (0:ℝ)*q' s i)=(0:Fin 4 → ℝ) := by ext; simp + have hone : (fun i => (1:ℝ)*q' s i)=q' s := by ext; simp + simpa only [segment_zero,segment_one,hzero,hone,zero_connection,mul_zero,sub_zero, + fundamental,StraightKZ.connection] using! h + +end DeligneDrinfeld.StraightKZ + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/BraidExp.lean b/lean/OAI/Algebra/Drinfeld/BraidExp.lean new file mode 100644 index 0000000000000000000000000000000000000000..20f4286b35cfcf3debd94c29d54048ef124ca6f8 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/BraidExp.lean @@ -0,0 +1,559 @@ +import OAI.Algebra.Drinfeld.RealBraid + +namespace OAI + +noncomputable section + +namespace RealDeligneDrinfeld.FreeCutoffCategory +open DeligneDrinfeld.AssociativeElimination DeligneDrinfeld.WordGrading +open DeligneDrinfeld.TruncatedWords +attribute [local instance] LieRing.ofAssociativeRing +abbrev P : Set (DeligneDrinfeld.AssociativeElimination.A ℝ Bool) := ∅ +abbrev Q (N : ℕ) := DeligneDrinfeld.TruncatedWords.Q P N +abbrev F (N n : ℕ) := filtration P N n + + def j (N : ℕ) : L →ₗ⁅ℝ⁆ Q N := (quotient P N).toLieHom.comp embed + @[simp] theorem j_of (N : ℕ) (a : Bool) : j N (FreeLieAlgebra.of ℝ a)=DeligneDrinfeld.TruncatedDerivation.gen P N a := by + change quotient P N (embed (FreeLieAlgebra.of ℝ a))=_ + rw [embed_of]; rfl + theorem j_mem {N n : ℕ} {q : L} (hq : q∈Ln n) : j N q∈F N n := by + refine ⟨embed q,?_,rfl⟩ + exact space_mono (by intro w hw; exact le_of_eq hw.symm) (WeightBridge.embed_homogeneous hq) + theorem lie_mem {N r s : ℕ} {a b : Q N} (ha : a∈F N r) (hb : b∈F N s) : ⁅a,b⁆∈F N (r+s) := + (F N (r+s)).sub_mem (filtration_mul P N r s ha hb) + (by simpa only [Nat.add_comm s r] using filtration_mul P N s r hb ha) + + def velocity (N : ℕ) (q : L) (a : Bool) : Q N := j N (RealDeligneDrinfeld.derivation q (FreeLieAlgebra.of ℝ a)) + theorem velocity_mem {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (a : Bool) : velocity N q a∈F N (n+1) := by + cases a + · change j N (RealDeligneDrinfeld.derivation q x)∈_ + simp only [derivation_apply,D_x,map_zero,Submodule.zero_mem] + · change j N (RealDeligneDrinfeld.derivation q y)∈_ + rw [derivation_apply,D_y,LieHom.map_lie] + simpa only [Nat.add_comm 1 n] using lie_mem (j_mem (N:=N) WeightBridge.y_mem) (j_mem (N:=N) hq) + + def d {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) : Module.End ℝ (Q N) := + DeligneDrinfeld.TruncatedDerivation.derivation P N n (velocity N q) (velocity_mem N hq) (by intros p hp; exact False.elim hp) + + theorem d_one {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) : d N hq 1=0 := + DeligneDrinfeld.TruncatedDerivation.derivation_one P N n _ _ _ + theorem d_mul {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (a b : Q N) : + d N hq (a*b)=d N hq a*b+a*d N hq b := + DeligneDrinfeld.TruncatedDerivation.derivation_mul P N n _ _ _ a b + theorem d_mem {n m : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) {a : Q N} (ha : a∈F N m) : + d N hq a∈F N (m+n) := DeligneDrinfeld.TruncatedDerivation.derivation_mem P N n _ _ _ ha + theorem d_j {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (p : L) : + d N hq (j N p)=j N (RealDeligneDrinfeld.derivation q p) := + DeligneDrinfeld.PresentedCutoff.derivation_embed P N n _ _ _ (RealDeligneDrinfeld.derivation q) + (LieHom.id) (j N) (j_of N) (fun _ => rfl) p + + def h (N : ℕ) (q : L) (p : Fin 3) : Q N := j N ((ThreeSolutionCategory.data q).h p) + theorem h_mem {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (p : Fin 3) : h N q p∈F N n := by + have hr : CategoricalValues.rotateLie q∈Ln n := + WeightBridge.eval_mem hq WeightBridge.y_mem ((Ln 1).sub_mem ((Ln 1).neg_mem WeightBridge.x_mem) WeightBridge.y_mem) + unfold h ThreeSolutionCategory.data + fin_cases p + · change j N 0∈F N n; rw [map_zero]; exact Submodule.zero_mem _ + · exact j_mem hq + · exact j_mem ((Ln n).add_mem hq hr) + + def data {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) : DeligneDrinfeld.CategoryExp.Data ℝ (Q N) (Fin 3) := + DeligneDrinfeld.CategoryExp.gauge (d N hq) (d_mul N hq) (d_one N hq) (h N q) + + theorem loop_j {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (p : Fin 3) (a : L) : + (data N hq).D p p (j N a)=j N (DeligneDrinfeld.CategoryGauge.loop (ThreeSolutionCategory.data q) p a) := by + change d N hq (j N a)+h N q p*j N a-j N a*h N q p=_ + rw [d_j,DeligneDrinfeld.CategoryGauge.loop_apply,map_add,LieHom.map_lie,Ring.lie_def] + change _=j N (RealDeligneDrinfeld.derivation q a)+(h N q p*j N a-j N a*h N q p) + abel + theorem unit_all {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (p s : Fin 3) : + (data N hq).D p s 1=j N (DeligneDrinfeld.CategoryGauge.unit (ThreeSolutionCategory.data q) p s) := by + change d N hq 1+h N q s*1-1*h N q p=_ + rw [d_one,zero_add,mul_one,one_mul,DeligneDrinfeld.CategoryGauge.unit,map_sub] + rfl + + theorem raises {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (p s : Fin 3) + (m : ℕ) (a : Q N) (ha : a∈F N m) : (data N hq).D p s a∈F N (m+n) := + DeligneDrinfeld.CutoffCategory.raises P N (d N hq) (d_mul N hq) (d_one N hq) (h N q) n + (fun _ _ ha => d_mem N hq ha) (h_mem N hq) p s m a ha + + theorem nilpotent {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (hn : 0 d_mem N hq ha) (h_mem N hq) p s + + theorem unit {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) : (data N hq).D 0 1 1=j N q := by + change (d N hq 1+h N q 1*1)-1*h N q 0=_ + rw [d_one] + simp [h,ThreeSolutionCategory.data] + + theorem leading {n : ℕ} (N : ℕ) {q : L} (hq : q∈Ln n) (hn : 0 + induction b using Submodule.Quotient.induction_on with | _ b => + exact (freeMap N).map_lie a b } + +def projection : BraidFree →ₗ⁅ℝ⁆ T4 where + toLinearMap := braidIdeal.toSubmodule.mkQ + map_lie' := rfl + +@[simp] theorem lieMap_projection (N : ℕ) (p : BraidFree) : lieMap N (projection p)=freeMap N p := rfl +@[simp] theorem projection_of (a : Edge) : projection (FreeLieAlgebra.of ℝ a)=t a.val.1 a.val.2 := by + simp only [t,chord,dite_eq_left a.property]; rfl + theorem lieMap_of (N : ℕ) (a : Edge) : lieMap N (projection (FreeLieAlgebra.of ℝ a))= + DeligneDrinfeld.TruncatedDerivation.gen presentation N a := by + rw [lieMap_projection] + change quotient presentation N (DeligneDrinfeld.AssociativeElimination.embed (FreeLieAlgebra.of ℝ a))=_ + rw [DeligneDrinfeld.AssociativeElimination.embed_of]; rfl + + theorem projection_relation {p : BraidFree} (hp : p∈braidRelations) : projection p=0 := + (Submodule.Quotient.mk_eq_zero _).mpr (LieSubmodule.subset_lieSpan hp) + + theorem lie_mem {N r s : ℕ} {a b : Q N} (ha : a∈F N r) (hb : b∈F N s) : ⁅a,b⁆∈F N (r+s) := by + exact (F N (r+s)).sub_mem (filtration_mul presentation N r s ha hb) + (by simpa only [Nat.add_comm s r] using filtration_mul presentation N s r hb ha) + theorem t_mem (N : ℕ) (i j : Fin 4) : lieMap N (t i j)∈F N 1 := by + unfold t chord + split_ifs with hij hji + · change lieMap N (projection (FreeLieAlgebra.of ℝ ⟨(i,j),hij⟩))∈_ + rw [lieMap_of] + exact DeligneDrinfeld.TruncatedDerivation.gen_mem presentation N _ + · change lieMap N (projection (FreeLieAlgebra.of ℝ ⟨(j,i),hji⟩))∈_ + rw [lieMap_of] + exact DeligneDrinfeld.TruncatedDerivation.gen_mem presentation N _ + · change lieMap N 0∈_; rw [map_zero]; exact Submodule.zero_mem _ + + theorem weight_mem {α : Type*} (N : ℕ) (e : FreeLieAlgebra ℝ α →ₗ⁅ℝ⁆ Q N) + (he : ∀ a,e (FreeLieAlgebra.of ℝ a)∈F N 1) {n : ℕ} {q : FreeLieAlgebra ℝ α} + (hq : q∈weightPiece (fun _ : α => 1) n) : e q∈F N n := by + have hw : ∀ n p,WeightedWord (fun _ : α => 1) n p → e p∈F N n := by + intro n p hp + induction hp with + | generator a => exact he a + | bracket hp hr ihp ihr => rw [LieHom.map_lie]; exact lie_mem ihp ihr + apply Submodule.span_induction (p:=fun q _ => e q∈F N n) ?_ ?_ ?_ ?_ hq + · intro p hp + exact hw n p hp + · rw [map_zero]; exact Submodule.zero_mem _ + · intro p r _ _ hp hr; rw [map_add]; exact Submodule.add_mem _ hp hr + · intro s p _ hp; rw [map_smul]; exact Submodule.smul_mem _ s hp + + theorem eval_mem {N n : ℕ} {q : L} (hq : q∈Ln n) {a b : T4} + (ha : lieMap N a∈F N 1) (hb : lieMap N b∈F N 1) : lieMap N (eval a b q)∈F N n := by + apply weight_mem N ((lieMap N).comp (eval a b)) (fun i => ?_) hq + cases i <;> simpa [eval] using (by assumption : lieMap N _∈F N 1) + +open T4Basic T4SolutionData +variable {n : ℕ} {q : L} + theorem A_mem (N : ℕ) (hq : q∈Ln n) : lieMap N (A q)∈F N n := + eval_mem hq (t_mem N 0 1) (t_mem N 1 2) + theorem D_mem (N : ℕ) (hq : q∈Ln n) : lieMap N (T4SolutionData.D q)∈F N n := + eval_mem hq (by rw [map_add]; exact Submodule.add_mem _ (t_mem N 0 2) (t_mem N 1 2)) (t_mem N 2 3) + theorem E_mem (N : ℕ) (hq : q∈Ln n) : lieMap N (E q)∈F N n := + eval_mem hq (t_mem N 0 1) (by rw [map_add]; exact Submodule.add_mem _ (t_mem N 1 2) (t_mem N 1 3)) + + def velocity (N : ℕ) (hq : q∈W) (hqn : q∈Ln n) (hn : 2 fin_cases j + all_goals first | simpa only [t_self,map_zero] using (Submodule.zero_mem (F N (n+1))) | exact ha | exact hb' | exact hc' | exact hd' | exact he' | exact hf' + unfold velocity + rw [projection_of] + exact hall _ _ + + theorem relations_killed (N : ℕ) (hq : q∈W) (hqn : q∈Ln n) (hn : 2 + exact DeligneDrinfeld.PresentedCutoff.derivation_embed presentation N n _ _ _ _ projection + (lieMap N) (lieMap_of N) (fun _ => rfl) p + +end RealDeligneDrinfeld.BraidCutoff + +namespace RealDeligneDrinfeld.BraidCategoryExp +open DeligneDrinfeld.AssociativeElimination DeligneDrinfeld.WordGrading +open DeligneDrinfeld.TruncatedWords BraidCutoff T4Basic T4SolutionData +attribute [local instance] LieRing.ofAssociativeRing +variable {n : ℕ} {q : L} + theorem B_mem (N : ℕ) (hq : q∈Ln n) : lieMap N (B q)∈BraidCutoff.F N n := + eval_mem hq (by rw [map_add]; exact Submodule.add_mem _ (t_mem N 0 1) (t_mem N 0 2)) + (by rw [map_add]; exact Submodule.add_mem _ (t_mem N 1 3) (t_mem N 2 3)) + + def h (N : ℕ) (hq : q∈W) (hqn : q∈Ln n) (hn : 2 d_mem N hq hqn hn ha) (h_mem N hq hqn hn) p s m a ha + + theorem nilpotent (N : ℕ) (hq : q∈W) (hqn : q∈Ln n) (hn : 2 d_mem N hq hqn hn ha) (h_mem N hq hqn hn) p s + + theorem loop_lieMap (N : ℕ) (hq : q∈W) (hqn : q∈Ln n) (hn : 2 assumption + def insert : FreeCutoffCategory.Q N →ₐ[ℝ] BraidCutoff.Q N := + DeligneDrinfeld.PresentedSubstitution.subst BraidCutoff.presentation N (family N X Y) (family_mem N X Y hX hY) + theorem insert_gen (a : Bool) : insert N X Y hX hY (DeligneDrinfeld.TruncatedDerivation.gen ∅ N a)=family N X Y a := + DeligneDrinfeld.PresentedSubstitution.subst_gen _ _ _ _ a + theorem insert_j (p : L) : insert N X Y hX hY (FreeCutoffCategory.j N p)=BraidCutoff.lieMap N (eval X Y p) := by + have he : (insert N X Y hX hY).toLieHom.comp (FreeCutoffCategory.j N)= + (BraidCutoff.lieMap N).comp (eval X Y) := by + apply FreeLieAlgebra.hom_ext + intro a + change insert N X Y hX hY (FreeCutoffCategory.j N (FreeLieAlgebra.of ℝ a))=_ + rw [FreeCutoffCategory.j_of,insert_gen] + cases a <;> simp [family,eval] + exact LieHom.congr_fun he p + + variable {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 hg i hi p q m a ha) + theorem sum_nilpotent {N : ℕ} (F : FilteredComparison.Filtration R A N) + (s : Finset I) (g : I → Data R A O) + (hg : ∀ i∈s,∀ p q m a,a∈F.step m → (g i).D p q a∈F.step (m+1)) + (p q : O) : IsNilpotent ((sum s g).D p q) := + nilpotent F _ (sum_raises F s g hg p q) + theorem sum_natural (s : Finset I) (g : I → Data R A O) (k : I → Data R B P) + (f : A →ₗ[R] B) (p q : O) (r t : P) + (hf : ∀ i∈s,∀ a,(k i).D r t (f a)=f ((g i).D p q a)) (a : A) : + (sum s k).D r t (f a)=f ((sum s g).D p q a) := by + rw [sum_apply,sum_apply,map_sum] + exact Finset.sum_congr rfl (fun i hi => hf i hi a) + theorem exp_sum_natural [Module ℚ A] [Module ℚ B] + (s : Finset I) (g : I → Data R A O) (k : I → Data R B P) + (f : A →ₗ[R] B) (p q : O) (r t : P) + (hg : IsNilpotent ((sum s g).D p q)) (hk : IsNilpotent ((sum s k).D r t)) + (hf : ∀ i∈s,∀ a,(k i).D r t (f a)=f ((g i).D p q a)) (a : A) : + act (sum s k) r t (f a)=f (act (sum s g) p q a) := + OperatorExp.natural _ _ hg hk f (sum_natural s g k f p q r t hf) a +end DeligneDrinfeld.CategoryExp + +section +namespace RealDeligneDrinfeld.BraidInsertionExp +open DeligneDrinfeld.AssociativeElimination DeligneDrinfeld.WordGrading +open DeligneDrinfeld.TruncatedWords DeligneDrinfeld.CategoryGauge +variable (N : ℕ) (X Y : T4) + (hX : BraidCutoff.lieMap N X∈BraidCutoff.F N 1) (hY : BraidCutoff.lieMap N Y∈BraidCutoff.F N 1) + {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 FreeCutoffCategory.data N (hqn i)) + def braid : Data ℝ (BraidCutoff.Q N) (Fin 5) := sum s (fun i => BraidCategoryExp.data N (hq i) (hqn i) (hn i)) + include hn in + theorem free_raises (p r : Fin 3) (m : ℕ) (a : FreeCutoffCategory.Q N) (ha : a∈FreeCutoffCategory.F N m) : + (free N s q n hqn).D p r a∈FreeCutoffCategory.F N (m+1) := by + apply sum_raises (DeligneDrinfeld.CutoffCategory.filtration ∅ N) s _ _ p r m a ha + intro i _hi p r m a ha + exact DeligneDrinfeld.TruncatedWords.filtration_antitone ∅ N (by have := hn i; omega) + (FreeCutoffCategory.raises N (hqn i) p r m a ha) + theorem braid_raises (p r : Fin 5) (m : ℕ) (a : BraidCutoff.Q N) (ha : a∈BraidCutoff.F N m) : + (braid N s q n hq hqn hn).D p r a∈BraidCutoff.F N (m+1) := by + apply sum_raises (DeligneDrinfeld.CutoffCategory.filtration BraidCutoff.presentation N) s _ _ p r m a ha + intro i _hi p r m a ha + exact DeligneDrinfeld.TruncatedWords.filtration_antitone _ N (by have := hn i; omega) + (BraidCategoryExp.raises N (hq i) (hqn i) (hn i) p r m a ha) + include hn in + theorem free_nilpotent (p r : Fin 3) : IsNilpotent ((free N s q n hqn).D p r) := + nilpotent (DeligneDrinfeld.CutoffCategory.filtration ∅ N) _ (free_raises N s q n hqn hn p r) + theorem braid_nilpotent (p r : Fin 5) : IsNilpotent ((braid N s q n hq hqn hn).D p r) := + nilpotent (DeligneDrinfeld.CutoffCategory.filtration BraidCutoff.presentation N) _ (braid_raises N s q n hq hqn hn p r) + theorem edge (X Y : T4) + (hX : BraidCutoff.lieMap N X∈BraidCutoff.F N 1) (hY : BraidCutoff.lieMap N Y∈BraidCutoff.F N 1) + (p r : Fin 5) + (he : ∀ i,DeligneDrinfeld.CategoryGauge.EdgeCompatible (eval X Y) 0 1 p r + (ThreeSolutionCategory.data (q i)) (FourSolutionCategory.data (hq i) (hqn i) (hn i))) + (a : FreeCutoffCategory.Q N) : + act (braid N s q n hq hqn hn) p r (insert N X Y hX hY a)= + insert N X Y hX hY (act (free N s q n hqn) 0 1 a) := by + exact exp_sum_natural s _ _ (insert N X Y hX hY).toLinearMap 0 1 p r + (free_nilpotent N s q n hqn hn 0 1) (braid_nilpotent N s q n hq hqn hn p r) + (fun i _hi a => edge_derivative N X Y hX hY (hq i) (hqn i) (hn i) p r (he i) a) a + include hq hn in + theorem pentagon (a : FreeCutoffCategory.Q N) + (ha : IDE N a*IAD N a=ICE N a*IBC N a*IAB N a) : + let a' := act (free N s q n hqn) 0 1 a + IDE N a'*IAD N a'=ICE N a'*IBC N a'*IAB N a' := by + let F := act (braid N s q n hq hqn hn) + let a' := act (free N s q n hqn) 0 1 a + have hh := congrArg (F 0 4) ha + have hn' := braid_nilpotent N s q n hq hqn hn + rw [composition _ hn' 0 3 4,composition _ hn' 0 1 4,composition _ hn' 1 2 4] at hh + have hDE : F 3 4 (IDE N a)=IDE N a' := edge N s q n hq hqn hn _ _ _ _ 3 4 (fun i => FourSolutionCategory.DE (hq i) (hqn i) (hn i)) a + have hAD : F 0 3 (IAD N a)=IAD N a' := edge N s q n hq hqn hn _ _ _ _ 0 3 (fun i => FourSolutionCategory.AD (hq i) (hqn i) (hn i)) a + have hCE : F 2 4 (ICE N a)=ICE N a' := edge N s q n hq hqn hn _ _ _ _ 2 4 (fun i => FourSolutionCategory.CE (hq i) (hqn i) (hn i)) a + have hBC : F 1 2 (IBC N a)=IBC N a' := edge N s q n hq hqn hn _ _ _ _ 1 2 (fun i => FourSolutionCategory.BC (hq i) (hqn i) (hn i)) a + have hAB : F 0 1 (IAB N a)=IAB N a' := edge N s q n hq hqn hn _ _ _ _ 0 1 (fun i => FourSolutionCategory.AB (hq i) (hqn i) (hn i)) a + rw [hDE,hAD,hCE,hBC,hAB] at hh + exact hh + theorem unit : (free N s q n hqn).D 0 1 1=FreeCutoffCategory.j N (∑ i∈s,q i) := by + rw [free,DeligneDrinfeld.CategoryExp.sum_apply,map_sum] + exact Finset.sum_congr rfl (fun i _hi => FreeCutoffCategory.unit N (hqn i)) + theorem edge_formula (a : FreeCutoffCategory.Q N) : + (free N s q n hqn).D 0 1 a=(free N s q n hqn).D 0 0 a+FreeCutoffCategory.j N (∑ i∈s,q i)*a := by + have hh := (free N s q n hqn).comp 0 0 1 a 1 + rw [one_mul,one_mul,unit] at hh + rw [hh,add_comm] +end RealDeligneDrinfeld.BraidInsertionSum + +end + +namespace DeligneDrinfeld.CategoryExp +open IsNilpotent +variable {R V : Type*} [CommRing R] [Algebra ℚ R] [AddCommGroup V] + [Module R V] [Module ℚ V] [IsScalarTower ℚ R V] +variable {N : ℕ} (F : FilteredComparison.Filtration R V N) + (A B : Module.End R V) (k : ℕ) + (hA : ∀ m a,a∈F.step m → A a∈F.step (m+1)) + (hB : ∀ m a,a∈F.step m → B a∈F.step (m+1)) + (hD : ∀ m a,a∈F.step m → A a-B a∈F.step (m+k)) +include hA hB hD + omit [Algebra ℚ R] [Module ℚ V] [IsScalarTower ℚ R V] in + theorem pow_difference (i m : ℕ) {a : V} (ha : a∈F.step m) : + (A^(i+1)) a-(B^(i+1)) a∈F.step (m+k+i) := by + induction i with + | zero => simpa only [zero_add,pow_one,Nat.add_zero] using hD m a ha + | succ i ih => + have h₁ := hA (m+k+i) _ ih + rw [map_sub] at h₁ + have hp := pow_mem_shift F B 1 hB (i+1) m ha + simp only [Nat.mul_one] at hp + have h₂ := hD (m+(i+1)) _ hp + have hh := (F.step (m+k+i+1)).add_mem h₁ (by convert h₂ using 1; congr 1; omega) + rw [pow_succ' A (i+1),pow_succ' B (i+1),Module.End.mul_apply,Module.End.mul_apply] + convert hh using 1; abel + + theorem exp_difference (m : ℕ) {a : V} (ha : a∈F.step m) : + exp A a-exp B a-(A a-B a)∈F.step (m+k+1) := by + have hnil (d : Module.End R V) (hd : ∀ m a,a∈F.step m → d a∈F.step (m+1)) : d^(N+1)=0 := by + apply LinearMap.ext + intro x + have hh := pow_mem_shift F d 1 hd (N+1) 0 (a:=x) (by rw [F.initial]; trivial) + simpa only [Nat.mul_one,Nat.zero_add,F.terminal,Submodule.mem_bot,LinearMap.zero_apply] using hh + let r := N+1 + let s := N+1 + have hr : A^r=0 := hnil A hA + have hs : B^s=0 := hnil B hB + have hr' : A^(2+(r+s))=0 := pow_eq_zero_of_le (by omega) hr + have hs' : B^(2+(r+s))=0 := pow_eq_zero_of_le (by omega) hs + rw [exp_eq_sum hr',exp_eq_sum hs',LinearMap.sum_apply,LinearMap.sum_apply, + ←Finset.sum_sub_distrib,Finset.sum_range_add] + have ht : (∑ i∈Finset.range 2,(((↑i.factorial:ℚ)⁻¹ • A^i) a-((↑i.factorial:ℚ)⁻¹ • B^i) a))=A a-B a := by + simp [Finset.sum_range_succ] + rw [ht,add_sub_cancel_left] + apply Submodule.sum_mem + intro i hi + simp only [LinearMap.smul_apply,←smul_sub] + apply ((F.step (m+k+1)).restrictScalars ℚ).smul_mem + have hh := pow_difference F A B k hA hB hD (i+1) m ha + have he : 2+i=i+1+1 := by omega + rw [he] + exact F.decreasing (by omega) hh + + theorem exp_difference_unit {a u : V} (ha : a-u∈F.step 1) : + exp A a-exp B a-(A u-B u)∈F.step (k+1) := by + have h₁ := exp_difference F A B k hA hB hD 0 (a:=a) (by rw [F.initial]; trivial) + have h₂ := hD 1 (a-u) ha + rw [map_sub,map_sub] at h₂ + have h₁' : exp A a-exp B a-(A a-B a)∈F.step (k+1) := by simpa only [Nat.zero_add] using h₁ + have h₂' : A a-A u-(B a-B u)∈F.step (k+1) := by simpa only [Nat.add_comm 1 k] using h₂ + convert (F.step (k+1)).add_mem h₁' h₂' using 1; abel +end DeligneDrinfeld.CategoryExp + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Categories.lean b/lean/OAI/Algebra/Drinfeld/Categories.lean new file mode 100644 index 0000000000000000000000000000000000000000..291bb81c26fe42f52b64522910e5dea01b6286e3 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Categories.lean @@ -0,0 +1,679 @@ +import OAI.Algebra.Drinfeld.Lattice + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +namespace CategoricalValues +open CategoryGauge + +def swapObjects : Fin 3 → Fin 3 := ![1,0,2] +def rotateObjects : Fin 3 → Fin 3 := ![1,2,0] +def swapLie : L →ₗ⁅ℚ⁆ L := eval y x +def rotateLie : L →ₗ⁅ℚ⁆ L := eval y (-x-y) + +structure Witness where + three : CategoryGauge.Data ℚ L (Fin 3) + four : CategoryGauge.Data ℚ T4 (Fin 5) + swap : Compatible swapLie swapObjects three three + rotate : Compatible rotateLie rotateObjects three three + kill_x : loop three 0 x=0 + kill_y : loop three 1 y=0 + AD : EdgeCompatible (eval (t 0 2+t 1 2) (t 2 3)) 0 1 0 3 three four + DE : EdgeCompatible (eval (t 0 1) (t 1 2+t 1 3)) 0 1 3 4 three four + AB : EdgeCompatible (eval (t 0 1) (t 1 2)) 0 1 0 1 three four + BC : EdgeCompatible (eval (t 0 1+t 0 2) (t 1 3+t 2 3)) 0 1 1 2 three four + CE : EdgeCompatible (eval (t 1 2) (t 2 3)) 0 1 2 4 three four + +def value (w : Witness) : L := unit w.three 0 1 + +theorem value_anti (w : Witness) : value w+eval y x (value w)=0 := by + have h := w.swap.1 0 1 + change unit w.three 1 0=eval y x (value w) at h + rw [←h] + simp only [value,unit] + abel + +theorem rotate_squared : rotateLie.comp rotateLie=eval (-x-y) x := by + apply FreeLieAlgebra.hom_ext + intro i + cases i + · simp [rotateLie,eval,x,y] + · simp [rotateLie,eval,x,y] + abel + +theorem value_cyclic (w : Witness) : + value w+eval y (-x-y) (value w)+eval (-x-y) x (value w)=0 := by + have h₁ := w.rotate.1 0 1 + have h₂ := w.rotate.1 1 2 + change unit w.three 1 2=rotateLie (value w) at h₁ + change unit w.three 2 0=rotateLie (unit w.three 1 2) at h₂ + rw [h₁] at h₂ + have hsq : rotateLie (rotateLie (value w))=eval (-x-y) x (value w) := + LieHom.congr_fun rotate_squared (value w) + rw [hsq] at h₂ + change value w+rotateLie (value w)+eval (-x-y) x (value w)=0 + rw [←h₁,←h₂] + simp only [value,unit] + abel + +theorem value_pentagon (w : Witness) : + eval (t 0 1) (t 1 2+t 1 3) (value w)+eval (t 0 2+t 1 2) (t 2 3) (value w)= + eval (t 1 2) (t 2 3) (value w)+eval (t 0 1+t 0 2) (t 1 3+t 2 3) (value w)+ + eval (t 0 1) (t 1 2) (value w) := by + unfold value + rw [←w.AD.1,←w.DE.1,←w.AB.1,←w.BC.1,←w.CE.1] + simp only [unit] + abel + +theorem value_mem (w : Witness) : value w∈W := + ⟨value_anti w,value_cyclic w,value_pentagon w⟩ + +theorem source_derivation (w : Witness) : loop w.three 0=derivation (value w) := by + apply derivation_ext + · simpa only [derivation_apply,D_x] using w.kill_x + · have h := loop_change w.three 0 1 y + rw [w.kill_y] at h + change 0=loop w.three 0 y+⁅value w,y⁆ at h + simp only [derivation_apply,D_y] + rw [←lie_skew y (value w)] + exact eq_neg_of_add_eq_zero_left h.symm + +def zero : Witness where + three := CategoryGauge.zero + four := CategoryGauge.zero + swap := compatible_zero _ _ + rotate := compatible_zero _ _ + kill_x := zero_loop _ _ + kill_y := zero_loop _ _ + AD := edge_zero _ _ _ _ _ + DE := edge_zero _ _ _ _ _ + AB := edge_zero _ _ _ _ _ + BC := edge_zero _ _ _ _ _ + CE := edge_zero _ _ _ _ _ + +def add (w v : Witness) : Witness where + three := CategoryGauge.add w.three v.three + four := CategoryGauge.add w.four v.four + swap := compatible_add _ _ w.swap v.swap + rotate := compatible_add _ _ w.rotate v.rotate + kill_x := by rw [add_loop,w.kill_x,v.kill_x,add_zero] + kill_y := by rw [add_loop,w.kill_y,v.kill_y,add_zero] + AD := edge_add _ w.AD v.AD + DE := edge_add _ w.DE v.DE + AB := edge_add _ w.AB v.AB + BC := edge_add _ w.BC v.BC + CE := edge_add _ w.CE v.CE + +def smul (c : ℚ) (w : Witness) : Witness where + three := CategoryGauge.smul c w.three + four := CategoryGauge.smul c w.four + swap := compatible_smul _ _ w.swap c + rotate := compatible_smul _ _ w.rotate c + kill_x := by rw [smul_loop,w.kill_x,smul_zero] + kill_y := by rw [smul_loop,w.kill_y,smul_zero] + AD := edge_smul _ w.AD c + DE := edge_smul _ w.DE c + AB := edge_smul _ w.AB c + BC := edge_smul _ w.BC c + CE := edge_smul _ w.CE c + +def bracket (w v : Witness) : Witness where + three := commutator w.three v.three + four := commutator w.four v.four + swap := compatible_commutator _ _ w.swap v.swap + rotate := compatible_commutator _ _ w.rotate v.rotate + kill_x := commutator_kills w.kill_x v.kill_x + kill_y := commutator_kills w.kill_y v.kill_y + AD := edge_commutator _ w.AD v.AD + DE := edge_commutator _ w.DE v.DE + AB := edge_commutator _ w.AB v.AB + BC := edge_commutator _ w.BC v.BC + CE := edge_commutator _ w.CE v.CE + +theorem value_bracket (w v : Witness) : value (bracket w v)=ihara (value w) (value v) := by + change unit (commutator w.three v.three) 0 1=_ + rw [unit_commutator,source_derivation,source_derivation] + rfl + +def values : IntegralFamily.Values where + space := + { carrier := {p | ∃ w : Witness,value w=p} + zero_mem' := ⟨zero,zero_unit _ _⟩ + add_mem' := by rintro p q ⟨w,rfl⟩ ⟨v,rfl⟩; exact ⟨add w v,add_unit _ _ _ _⟩ + smul_mem' := by rintro c p ⟨w,rfl⟩; exact ⟨smul c w,smul_unit _ _ _ _⟩ } + le_W := by rintro p ⟨w,rfl⟩; exact value_mem w + bracket := by rintro p q ⟨w,rfl⟩ ⟨v,rfl⟩; exact ⟨bracket w v,value_bracket w v⟩ + +end CategoricalValues + +namespace GaugeCompatibility +open CategoryGauge + + theorem intertwine {M : Type*} [LieRing M] [LieAlgebra ℚ M] + (D : LieDerivation ℚ M M) (q : L) (a b : M) + (hx : D a=0) (hy : D b=⁅b,eval a b q⁆) (p : L) : + D (eval a b p)=eval a b (derivation q p) := by + induction p using freeLie_induction with + | h0 => simp only [map_zero] + | hg i => + cases i + · change D (eval a b x)=eval a b (derivation q x) + simp only [eval_x,derivation_apply,D_x,map_zero,hx] + · change D (eval a b y)=eval a b (derivation q y) + simp only [eval_y,derivation_apply,D_y,LieHom.map_lie,hy] + | ha p r hp hr => simp only [map_add,hp,hr] + | hs s p hp => simp only [map_smul,hp] + | hl p r hp hr => simp only [LieHom.map_lie,LieDerivation.apply_lie_eq_add,map_add,hp,hr] + + theorem compatible {M N O P : Type*} [LieRing M] [LieAlgebra ℚ M] + [LieRing N] [LieAlgebra ℚ N] (g : Data ℚ M O) (k : Data ℚ N P) + (F : M →ₗ⁅ℚ⁆ N) (f : O → P) (K : N) + (hh : ∀ p,k.h (f p)=F (g.h p)+K) + (hd : ∀ z,k.d (F z)+⁅K,F z⁆=F (g.d z)) : Compatible F f g k := by + constructor + · intro p q + simp only [unit,hh,map_sub] + abel + · intro p z + simp only [loop_apply,hh,add_lie,map_add,LieHom.map_lie] + rw [←hd z] + abel + +end GaugeCompatibility + +namespace ThreeSolutionCategory +open CategoricalValues CategoryGauge + +def data (q : L) : Data ℚ L (Fin 3) := + ⟨derivation q,![0,q,q+rotateLie q]⟩ + +@[simp] theorem loop_zero (q : L) : loop (data q) 0=derivation q := by + ext p + simp [loop_apply,data] +@[simp] theorem value (q : L) : unit (data q) 0 1=q := by simp [unit,data] + + theorem anti {q : L} (hq : q∈W) : swapLie q= -q := by + exact eq_neg_of_add_eq_zero_right hq.1 + + theorem rotating_anti {q : L} (hq : q∈W) : swapLie (rotateLie q)=q+rotateLie q := by + change eval y x (eval y (-x-y) q)=q+eval y (-x-y) q + rw [map_eval,eval_y,map_sub,map_neg,eval_x,eval_y] + have h := solution_three hq x y + rw [eval_self,LieHom.id_apply,solution_swap hq (-x-y) x] at h + have hs : -y-x= -x-y := by abel + rw [hs] + exact (eq_of_sub_eq_zero (by simpa only [sub_eq_add_neg] using h)).symm + + theorem rotating_twice {q : L} (hq : q∈W) : rotateLie (q+rotateLie q)= -q := by + rw [map_add] + have hsq := LieHom.congr_fun rotate_squared q + change rotateLie (rotateLie q)=eval (-x-y) x q at hsq + rw [hsq] + exact eq_neg_of_add_eq_zero_right (by simpa only [rotateLie,add_assoc] using hq.2.1) + + theorem swap {q : L} (hq : q∈W) : Compatible swapLie swapObjects (data q) (data q) := by + apply GaugeCompatibility.compatible (data q) (data q) swapLie swapObjects q + · intro i + fin_cases i + · simp [data,swapObjects] + · change 0=swapLie q+q + rw [anti hq,neg_add_cancel] + · change q+rotateLie q=swapLie (q+rotateLie q)+q + rw [map_add,anti hq,rotating_anti hq] + abel + · intro p + have hh := GaugeCompatibility.intertwine (loop (data q) 1) q y x + (by simp only [loop_apply,data,D_y,derivation_apply,Matrix.cons_val_one,Matrix.cons_val_zero]; rw [←lie_skew y q]; abel) + (by + simp only [loop_apply,data,derivation_apply,D_x,zero_add,Matrix.cons_val_one,Matrix.cons_val_zero] + change ⁅q,x⁆=⁅x,swapLie q⁆ + rw [anti hq,lie_neg,←lie_skew x q,neg_neg]) p + simpa only [loop_apply,data,Matrix.cons_val_one,Matrix.cons_val_zero,swapLie,rotateLie] using hh + + theorem rotate {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 1) n 0=⊥ := by + rw [←biTreeSpan_eq] + apply le_antisymm ?_ bot_le + apply Submodule.span_le.mpr + rintro p ⟨t,_,ht,rfl⟩ + have h := treeDegree_pos (wt:=fun _ : ℕ => 1) (by intro; decide) t + omega + +theorem length_one_piece_le (k : ℕ) : + biPiece (R:=K) oddWeight (fun _ => 1) (oddWeight k) 1≤ + Submodule.span K {FreeLieAlgebra.of K k} := by + rw [←biTreeSpan_eq] + apply Submodule.span_le.mpr + rintro p ⟨t,ht,hr,rfl⟩ + cases t with + | leaf j => + have hj : j=k := by + simp only [treeDegree_leaf,oddWeight] at ht + omega + subst j + exact Submodule.subset_span rfl + | node t u => + have h₁ := treeDegree_pos (wt:=fun _ : ℕ => 1) (by intro; decide) t + have h₂ := treeDegree_pos (wt:=fun _ : ℕ => 1) (by intro; decide) u + simp only [treeDegree_node] at hr + omega + +theorem finrank_length_one_le (k : ℕ) : + Module.finrank K (biPiece (R:=K) oddWeight (fun _ => 1) (oddWeight k) 1)≤1 := by + have h := Submodule.finrank_mono (length_one_piece_le k) + have h' := finrank_span_le_card (R:=K) ({FreeLieAlgebra.of K k} : Set (FreeLieAlgebra K ℕ)) + exact h.trans (by simpa using h') + +abbrev OldDomain (n : ℕ) := (r : Fin (n+1)) → oldPiece n r.val + +theorem finrank_odd_le (k : ℕ) : + Module.finrank K (homogeneousLie (R:=K) oddWeight (oddWeight k))≤ + Module.finrank K (OldDomain (oddWeight k))+1 := by + classical + let n := oddWeight k + rw [finrank_decomposition K oddWeight (fun _ => 1) n n (ReducedDimension.odd_length_bound n),Module.finrank_pi_fintype] + have hterm (r : ℕ) : + Module.finrank K (biPiece (R:=K) oddWeight (fun _ => 1) n r)≤ + Module.finrank K (oldPiece n r)+(if r=1 then 1 else 0) := by + by_cases hr : 1 1) n r := ite_eq_left hr + rw [he] + split_ifs <;> omega + · have he : oldPiece n r=⊥ := ite_eq_right hr + rw [he,finrank_bot,Nat.zero_add] + by_cases hr1 : r=1 + · subst r + rw [ite_eq_left rfl] + exact finrank_length_one_le k + · have hr0 : r=0 := by omega + subst r + rw [length_zero_piece,finrank_bot] + split_ifs <;> omega + have hs := Finset.sum_le_sum (fun (r : Fin (n+1)) (_ : r∈Finset.univ) => hterm r.val) + rw [Finset.sum_add_distrib] at hs + have hin : (1 : ℕ) 1) t) : + embed (GenericIhara.evalIhara (cast f ℚ) t.eval)∈above GenericIhara.depth 2 := by + have h := GenericIhara.evalIhara_depth (cast f ℚ) (cast_depth f) (LieGrading.eval_homogeneous (fun _ => 1) t) + exact WordGrading.space_mono (by intro w hw; change treeDegree (fun _ => 1) t≤degree GenericIhara.depth w at hw; omega) h + +theorem tree_reduced_depth_mem {n : ℕ} (t : UniversalEmbedding.Tree ℕ) + (ht : treeDegree oddWeight t=n) (hr : 1 1) t) : + reducedValue f n ⟨t.eval,ht ▸ LieGrading.eval_homogeneous oddWeight t⟩∈ + SaturatedSolutions.reduction n (depthPiece V n) := by + let q : homogeneousLie (R:=ℤ) RationalBound.wt n := + ⟨GenericIhara.evalIhara f.value t.eval,integral_eval_homogeneous f (ht ▸ LieGrading.eval_homogeneous oddWeight t)⟩ + have he : (LieDimension.castHom (R:=ℚ) q).val=GenericIhara.evalIhara (cast f ℚ) t.eval := by + exact (GenericIhara.cast_evalIhara f.value t.eval).trans (congrArg _ (LieDimension.cast_eval t)) + have hW : (LieDimension.castHom (R:=ℚ) q).val∈Wn n := by + constructor + · rw [he]; exact V.le_W (rational_mem f t.eval) + · change _∈weightPiece RationalBound.wt n + rw [weightPiece_eq]; exact (LieDimension.castHom (R:=ℚ) q).property + apply integral_reduction_mem (depthPiece V n) q hW ?_ _ ?_ + · constructor + · change (LieDimension.castHom (R:=ℚ) q).val∈V.space + rw [he]; exact rational_mem f t.eval + · change embed (LieDimension.castHom (R:=ℚ) q).val∈above GenericIhara.depth 2 + rw [he]; exact tree_depth_two f t hr + · change IntegralBaseChange.lie (S:=K) (GenericIhara.evalIhara f.value t.eval)=_ + rw [GenericIhara.cast_evalIhara,LieDimension.cast_eval] + rfl + +theorem bi_reduced_depth_mem {n r : ℕ} (hr : 1 1) n r) : + reducedValue f n ⟨p.val,p.property.1⟩∈SaturatedSolutions.reduction n (depthPiece V n) := by + let E := SaturatedSolutions.reduction n (depthPiece V n) + let T := E.map (ReducedDimension.solutions n).subtype + have hp : p.val∈biTreeSpan (R:=K) oddWeight (fun _ => 1) n r := + (biTreeSpan_eq (R:=K) oddWeight (fun _ => 1) n r).symm ▸ p.property + have hh : ∀ v,v∈biTreeSpan (R:=K) oddWeight (fun _ => 1) n r → + GenericIhara.evalIhara (cast f K) v∈T := by + intro v hv + induction hv using Submodule.span_induction with + | mem q hq => + obtain ⟨t,ht,hl,rfl⟩ := hq + refine ⟨reducedValue f n ⟨t.eval,ht ▸ LieGrading.eval_homogeneous oddWeight t⟩, + tree_reduced_depth_mem f t ht (by omega),rfl⟩ + | zero => rw [map_zero]; exact T.zero_mem + | add p q _ _ hp hq => rw [map_add]; exact T.add_mem hp hq + | smul c p _ hp => rw [map_smul]; exact T.smul_mem c hp + obtain ⟨q,hq,he⟩ := hh p.val hp + have he' : q=reducedValue f n ⟨p.val,p.property.1⟩ := Subtype.ext he + rwa [←he'] + +theorem old_reduced_depth_mem {n r : ℕ} (p : NormalizedFamily.oldPiece n r) : + reducedValue f n ⟨p.val,NormalizedFamily.oldPiece_le n r p.property⟩∈ + SaturatedSolutions.reduction n (depthPiece V n) := by + by_cases hr : 1 1) n r := by + have he : NormalizedFamily.oldPiece n r=biPiece (R:=K) oddWeight (fun _ => 1) n r := ite_eq_left hr + rw [←he]; exact p.property + exact bi_reduced_depth_mem f hr ⟨p.val,hp⟩ + · have hp := NormalizedFamily.oldMap_low hr p + subst p + change reducedValue f n 0∈_ + rw [map_zero] + exact Submodule.zero_mem _ + +end + +section +open LieGrading AssociativeElimination UniversalEmbedding WordGrading +open ImageBound RowKernel QuadraticLeading RowTwo +attribute [local instance] LieRing.ofAssociativeRing + +variable (V : Values) + +structure Generator (k : ℕ) where + value : FreeLieAlgebra ℤ Bool + homogeneous : value∈homogeneousLie (fun _ => 1) (oddWeight k) + member : IntegralBaseChange.lie (S:=ℚ) value∈V.space + rep : FreeLieAlgebra K Slot + under_rep : under rep=embed (IntegralBaseChange.lie (S:=K) value) + above_rep : embed rep∈above bCount 1 + leading_rep : embed (leading 1 rep)=positiveInput (atom k) + +variable {V} + +def partialFamily (k : ℕ) (g : ∀ j,j GenericIhara.evalIhara v p.val) hg) + rw [he] + exact old_reduced_depth_mem f p + +def oldToDepth (n : ℕ) : NormalizedFamily.OldDomain n →ₗ[K] + SaturatedSolutions.reduction n (depthPiece V n) := + (Triangular.assemble (fun r : Fin (n+1) => NormalizedFamily.oldMap g n r.val)).codRestrict _ (by + intro p + rw [Triangular.assemble_apply] + exact Submodule.sum_mem _ (fun r _ => oldMap_mem f g hg (p r))) + +include f hg in +theorem old_rank_le (n : ℕ) (hn : 2 1) (.leaf k)⟩ + obtain ⟨p,hp⟩ := SaturatedSolutions.graded_surjective (oddWeight k) (piece V (oddWeight k)) hn he 1 (by omega) e + obtain ⟨q,hq,hW,hV⟩ := SaturatedSolutions.reduction_lift (oddWeight k) (piece V (oddWeight k)) hn p.val + refine ⟨⟨q.val,q.property,hV,ReducedDimension.representation (oddWeight k) (by omega) p.val.val,?_,?_,?_⟩⟩ + · rw [ReducedDimension.representation_under,←hq] + rfl + · exact p.property + · have hs := ReducedDimension.gradedMap_spec (oddWeight k) hn 1 + (SaturatedSolutions.inclusionFiltration (oddWeight k) (piece V (oddWeight k)) (by omega) 1 p) + have he' := congrArg (ReducedDimension.inclusion (oddWeight k) 1) hp + change ReducedDimension.inclusion (oddWeight k) 1 (SaturatedSolutions.gradedMap (oddWeight k) (piece V (oddWeight k)) hn 1 p)=positiveInput (embed (FreeLieAlgebra.of K k)) at he' + rw [AssociativeElimination.embed_of] at he' + exact hs.symm.trans he' + +def OddValues : Prop := ∀ k,∃ p : Wn (oddWeight k),p∈piece V (oddWeight k) ∧ + (embed p.val).coeff (GenericIhara.depthOneWord (oddWeight k-1))≠0 + +theorem generators_exist (hv : OddValues V) : ∀ k,Nonempty (Generator V k) := by + intro k + induction k using Nat.strong_induction_on with + | h k hi => + classical + let g : ∀ j,j Classical.choice (hi j hj) + obtain ⟨p,hp,hc⟩ := hv k + apply generator_of_sharp V k + apply dimension_sharp (partialFamily k g) (partialData k g) rfl k ?_ p hp hc + intro j hj + change j 1) k := by + obtain ⟨p,hp,rfl⟩ := hu + change normalVal N (quotient ∅ N p)∈_ + rw [normalVal_quotient] + exact project_preserves hp + theorem normal_below (N : ℕ) (u : CutoffDepth.Q ℝ N) : normalVal N u∈below (fun _ => 1) N := + (TruncatedFree.normal N u).property + theorem quotient_normal (N : ℕ) (u : CutoffDepth.Q ℝ N) : quotient ∅ N (normalVal N u)=u := by + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective ℝ (relations (∅:Set (A ℝ Bool)) N) u + change quotient ∅ N (normalVal N (quotient ∅ N p))=quotient ∅ N p + rw [normalVal_quotient] + have hh := quotient_above (∅:Set (A ℝ Bool)) N (TruncatedFree.sub_trunc_above N p) + rw [map_sub] at hh + exact (sub_eq_zero.mp hh).symm + theorem value_above (N : ℕ) : V N∈above (fun _ => 1) 1 := by + apply normal_mem + rw [←KZRealLog.value] + exact KZRealLog.raises N false true 0 1 (filtration_one ∅ N) + theorem q_embed_zero : embed (q 0)=TensorProjection.piece 0 (V 0) := by + change (0:A ℝ Bool)=TensorProjection.piece 0 (V 0) + symm + exact project_eq_zero (value_above 0) (by intro w hw hh; change 1≤degree (fun _ => 1) w at hw; omega) + theorem piece_drop (M N n : ℕ) (hNM : N≤M) (hn : n≤N) (u : CutoffDepth.Q ℝ M) : + TensorProjection.piece n (normalVal M u)= + TensorProjection.piece n (normalVal N (CutoffDiagonal.drop M N hNM u)) := by + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective ℝ (relations (∅:Set (A ℝ Bool)) M) u + change TensorProjection.piece n (normalVal M (quotient ∅ M p))= + TensorProjection.piece n (normalVal N (CutoffDiagonal.drop M N hNM (quotient ∅ M p))) + rw [drop_quotient,normalVal_quotient,normalVal_quotient,piece_trunc _ _ (hn.trans hNM),piece_trunc _ _ hn] + theorem q_embed_any (N n : ℕ) (hn : n≤N) : embed (q n)=TensorProjection.piece n (V N) := by + have hh := piece_drop N n n hn le_rfl (KZComparison.value N) + rw [KZCutoffComparison.value_drop] at hh + rw [hh] + by_cases h : 0 1) n := by + induction n with + | zero => simpa only [Finset.range_zero,Finset.sum_empty,sub_zero] using TruncatedFree.all_ge_zero (V N) + | succ n ih => + have hh := subtract_piece_above (ih (by omega)) + have he : TensorProjection.piece n (V N-∑ i∈Finset.range n,embed (q i))=embed (q n) := by + rw [map_sub,map_sum,←q_embed_any N n (by omega)] + have hz : ∑ i∈Finset.range n,TensorProjection.piece n (embed (q i))=0 := by + apply Finset.sum_eq_zero + intro i hi + rw [piece_homogeneous (WeightBridge.embed_homogeneous (q_homogeneous i)),ite_eq_right (by have hi' := Finset.mem_range.mp hi; omega)] + rw [hz,sub_zero] + rw [he] at hh + rw [Finset.sum_range_succ] + simpa only [sub_add_eq_sub_sub] using hh + +end RealDeligneDrinfeld.KZHomogeneous + +namespace DeligneDrinfeld +namespace CategoryGauge +variable {R M N O P : Type*} [CommRing R] [LieRing M] [LieAlgebra R M] + [LieRing N] [LieAlgebra R N] + +structure Data (R M O : Type*) [CommRing R] [LieRing M] [LieAlgebra R M] where + d : LieDerivation R M M + h : O → M + +def unit (g : Data R M O) (p q : O) : M := g.h q-g.h p + +def loop (g : Data R M O) (p : O) : LieDerivation R M M := + g.d-LieDerivation.inner R M M (g.h p) + +@[simp] theorem loop_apply (g : Data R M O) (p : O) (x : M) : + loop g p x=g.d x+⁅g.h p,x⁆ := by + change g.d x-⁅x,g.h p⁆=g.d x+⁅g.h p,x⁆ + rw [←lie_skew (g.h p) x] + abel + +theorem unit_cocycle (g : Data R M O) (p q r : O) : unit g p r=unit g p q+unit g q r := by + unfold unit + abel + +theorem loop_change (g : Data R M O) (p q : O) (x : M) : + loop g q x=loop g p x+⁅unit g p q,x⁆ := by + simp only [loop_apply,unit,sub_lie] + abel + +def commutator (g k : Data R M O) : Data R M O where + d := ⁅g.d,k.d⁆ + h p := g.d (k.h p)-k.d (g.h p)+⁅g.h p,k.h p⁆ + +theorem loop_commutator (g k : Data R M O) (p : O) : + loop (commutator g k) p=⁅loop g p,loop k p⁆ := by + ext x + simp only [loop_apply,commutator,LieDerivation.lie_apply,map_add, + LieDerivation.apply_lie_eq_add,add_lie,sub_lie,lie_add] + rw [lie_lie (g.h p) (k.h p) x] + rw [lie_lie (k.h p) (g.h p) x] + abel + +theorem unit_commutator (g k : Data R M O) (p q : O) : + unit (commutator g k) p q= + loop g p (unit k p q)-loop k p (unit g p q)+⁅unit g p q,unit k p q⁆ := by + simp only [unit,commutator,loop_apply,map_sub,lie_sub,sub_lie] + rw [←lie_skew (k.h p) (g.h p),←lie_skew (k.h p) (g.h q)] + abel + +def Compatible (F : M →ₗ⁅R⁆ N) (f : O → P) (g : Data R M O) (k : Data R N P) : Prop := + (∀ p q,unit k (f p) (f q)=F (unit g p q)) ∧ + (∀ p x,loop k (f p) (F x)=F (loop g p x)) + +theorem compatible_commutator (F : M →ₗ⁅R⁆ N) (f : O → P) + {g₁ g₂ : Data R M O} {k₁ k₂ : Data R N P} + (h₁ : Compatible F f g₁ k₁) (h₂ : Compatible F f g₂ k₂) : + Compatible F f (commutator g₁ g₂) (commutator k₁ k₂) := by + constructor + · intro p q + rw [unit_commutator,unit_commutator,h₁.1,h₂.1,h₁.2,h₂.2,map_add,map_sub,LieHom.map_lie] + · intro p x + rw [loop_commutator,loop_commutator,LieDerivation.lie_apply,LieDerivation.lie_apply, + h₁.2,h₂.2,h₁.2,h₂.2,map_sub] + +def zero : Data R M O := ⟨0,fun _ => 0⟩ +def add (g k : Data R M O) : Data R M O := ⟨g.d+k.d,fun p => g.h p+k.h p⟩ +def smul (c : R) (g : Data R M O) : Data R M O := ⟨c • g.d,fun p => c • g.h p⟩ + +@[simp] theorem zero_unit (p q : O) : unit (zero (R:=R) (M:=M)) p q=0 := by simp [unit,zero] +@[simp] theorem zero_loop (p : O) (x : M) : loop (zero (R:=R)) p x=0 := by simp [loop_apply,zero] +@[simp] theorem add_unit (g k : Data R M O) (p q : O) : + unit (add g k) p q=unit g p q+unit k p q := by simp only [unit,add]; abel +@[simp] theorem add_loop (g k : Data R M O) (p : O) (x : M) : + loop (add g k) p x=loop g p x+loop k p x := by simp only [loop_apply,add,LieDerivation.add_apply,add_lie]; abel +@[simp] theorem smul_unit (c : R) (g : Data R M O) (p q : O) : + unit (smul c g) p q=c • unit g p q := by simp [unit,smul,smul_sub] +@[simp] theorem smul_loop (c : R) (g : Data R M O) (p : O) (x : M) : + loop (smul c g) p x=c • loop g p x := by simp [loop_apply,smul,smul_add] + +theorem compatible_zero (F : M →ₗ⁅R⁆ N) (f : O → P) : Compatible F f zero zero := by + constructor <;> intros <;> simp [zero,unit,loop_apply] + +theorem compatible_add (F : M →ₗ⁅R⁆ N) (f : O → P) + {g₁ g₂ : Data R M O} {k₁ k₂ : Data R N P} + (h₁ : Compatible F f g₁ k₁) (h₂ : Compatible F f g₂ k₂) : + Compatible F f (add g₁ g₂) (add k₁ k₂) := by + constructor + · intro p q; simp only [add_unit,h₁.1,h₂.1,map_add] + · intro p x; simp only [add_loop,h₁.2,h₂.2,map_add] + +theorem compatible_smul (F : M →ₗ⁅R⁆ N) (f : O → P) + {g : Data R M O} {k : Data R N P} (h : Compatible F f g k) (c : R) : + Compatible F f (smul c g) (smul c k) := by + constructor + · intro p q; simp only [smul_unit,h.1,map_smul] + · intro p x; simp only [smul_loop,h.2,map_smul] + +theorem commutator_zero_unit {g k : Data R M O} {p q : O} + (hg : unit g p q=0) (hk : unit k p q=0) : unit (commutator g k) p q=0 := by + rw [unit_commutator,hg,hk,map_zero,map_zero,sub_zero,lie_zero,add_zero] + +theorem commutator_zero_loop {g k : Data R M O} {p : O} + (hg : loop g p=0) (hk : loop k p=0) : loop (commutator g k) p=0 := by + rw [loop_commutator,hg,hk,lie_zero] + +end CategoryGauge +end DeligneDrinfeld + +namespace DeligneDrinfeld.CategoryGauge +variable {R M N O P : Type*} [CommRing R] [LieRing M] [LieAlgebra R M] + [LieRing N] [LieAlgebra R N] + +def EdgeCompatible (F : M →ₗ⁅R⁆ N) (p q : O) (s t : P) + (g : Data R M O) (k : Data R N P) : Prop := + unit k s t=F (unit g p q) ∧ ∀ x,loop k s (F x)=F (loop g p x) + +theorem edge_target (F : M →ₗ⁅R⁆ N) {p q : O} {s t : P} + {g : Data R M O} {k : Data R N P} (h : EdgeCompatible F p q s t g k) (x : M) : + loop k t (F x)=F (loop g q x) := by + rw [loop_change k s t,loop_change g p q,h.1,h.2,map_add,LieHom.map_lie] + +theorem edge_commutator (F : M →ₗ⁅R⁆ N) {p q : O} {s t : P} + {g₁ g₂ : Data R M O} {k₁ k₂ : Data R N P} + (h₁ : EdgeCompatible F p q s t g₁ k₁) (h₂ : EdgeCompatible F p q s t g₂ k₂) : + EdgeCompatible F p q s t (commutator g₁ g₂) (commutator k₁ k₂) := by + constructor + · rw [unit_commutator,unit_commutator,h₁.1,h₂.1,h₁.2,h₂.2,map_add,map_sub,LieHom.map_lie] + · intro x + rw [loop_commutator,loop_commutator,LieDerivation.lie_apply,LieDerivation.lie_apply, + h₁.2,h₂.2,h₁.2,h₂.2,map_sub] + +theorem edge_zero (F : M →ₗ⁅R⁆ N) (p q : O) (s t : P) : + EdgeCompatible F p q s t zero zero := by + constructor <;> intros <;> simp [zero,unit,loop_apply] + +theorem edge_add (F : M →ₗ⁅R⁆ N) {p q : O} {s t : P} + {g₁ g₂ : Data R M O} {k₁ k₂ : Data R N P} + (h₁ : EdgeCompatible F p q s t g₁ k₁) (h₂ : EdgeCompatible F p q s t g₂ k₂) : + EdgeCompatible F p q s t (add g₁ g₂) (add k₁ k₂) := by + constructor + · rw [add_unit,add_unit,h₁.1,h₂.1,map_add] + · intro x; rw [add_loop,add_loop,h₁.2,h₂.2,map_add] + +theorem edge_smul (F : M →ₗ⁅R⁆ N) {p q : O} {s t : P} + {g : Data R M O} {k : Data R N P} (h : EdgeCompatible F p q s t g k) (c : R) : + EdgeCompatible F p q s t (smul c g) (smul c k) := by + constructor + · rw [smul_unit,smul_unit,h.1,map_smul] + · intro x; rw [smul_loop,smul_loop,h.2,map_smul] + +theorem commutator_kills {g k : Data R M O} {p : O} {x : M} + (hg : loop g p x=0) (hk : loop k p x=0) : loop (commutator g k) p x=0 := by + rw [loop_commutator,LieDerivation.lie_apply,hg,hk,map_zero,map_zero,sub_zero] + +end DeligneDrinfeld.CategoryGauge + +namespace RealDeligneDrinfeld.CategoricalValues +open DeligneDrinfeld.CategoryGauge + +def swapObjects : Fin 3 → Fin 3 := ![1,0,2] +def rotateObjects : Fin 3 → Fin 3 := ![1,2,0] +def swapLie : L →ₗ⁅ℝ⁆ L := eval y x +def rotateLie : L →ₗ⁅ℝ⁆ L := eval y (-x-y) + +structure Witness where + three : DeligneDrinfeld.CategoryGauge.Data ℝ L (Fin 3) + four : DeligneDrinfeld.CategoryGauge.Data ℝ T4 (Fin 5) + swap : Compatible swapLie swapObjects three three + rotate : Compatible rotateLie rotateObjects three three + kill_x : loop three 0 x=0 + kill_y : loop three 1 y=0 + AD : EdgeCompatible (eval (t 0 2+t 1 2) (t 2 3)) 0 1 0 3 three four + DE : EdgeCompatible (eval (t 0 1) (t 1 2+t 1 3)) 0 1 3 4 three four + AB : EdgeCompatible (eval (t 0 1) (t 1 2)) 0 1 0 1 three four + BC : EdgeCompatible (eval (t 0 1+t 0 2) (t 1 3+t 2 3)) 0 1 1 2 three four + CE : EdgeCompatible (eval (t 1 2) (t 2 3)) 0 1 2 4 three four + +def value (w : Witness) : L := unit w.three 0 1 + +theorem value_anti (w : Witness) : value w+eval y x (value w)=0 := by + have h := w.swap.1 0 1 + change unit w.three 1 0=eval y x (value w) at h + rw [←h] + simp only [value,unit] + abel + +theorem rotate_squared : rotateLie.comp rotateLie=eval (-x-y) x := by + apply FreeLieAlgebra.hom_ext + intro i + cases i + · simp [rotateLie,eval,x,y] + · simp [rotateLie,eval,x,y] + abel + +theorem value_cyclic (w : Witness) : + value w+eval y (-x-y) (value w)+eval (-x-y) x (value w)=0 := by + have h₁ := w.rotate.1 0 1 + have h₂ := w.rotate.1 1 2 + change unit w.three 1 2=rotateLie (value w) at h₁ + change unit w.three 2 0=rotateLie (unit w.three 1 2) at h₂ + rw [h₁] at h₂ + have hsq : rotateLie (rotateLie (value w))=eval (-x-y) x (value w) := + LieHom.congr_fun rotate_squared (value w) + rw [hsq] at h₂ + change value w+rotateLie (value w)+eval (-x-y) x (value w)=0 + rw [←h₁,←h₂] + simp only [value,unit] + abel + +theorem value_pentagon (w : Witness) : + eval (t 0 1) (t 1 2+t 1 3) (value w)+eval (t 0 2+t 1 2) (t 2 3) (value w)= + eval (t 1 2) (t 2 3) (value w)+eval (t 0 1+t 0 2) (t 1 3+t 2 3) (value w)+ + eval (t 0 1) (t 1 2) (value w) := by + unfold value + rw [←w.AD.1,←w.DE.1,←w.AB.1,←w.BC.1,←w.CE.1] + simp only [unit] + abel + +theorem value_mem (w : Witness) : value w∈W := + ⟨value_anti w,value_cyclic w,value_pentagon w⟩ + +theorem source_derivation (w : Witness) : loop w.three 0=derivation (value w) := by + apply derivation_ext + · simpa only [derivation_apply,D_x] using w.kill_x + · have h := loop_change w.three 0 1 y + rw [w.kill_y] at h + change 0=loop w.three 0 y+⁅value w,y⁆ at h + simp only [derivation_apply,D_y] + rw [←lie_skew y (value w)] + exact eq_neg_of_add_eq_zero_left h.symm + +end RealDeligneDrinfeld.CategoricalValues + +namespace RealDeligneDrinfeld.KZHomogeneous + +section +open DeligneDrinfeld DeligneDrinfeld.AssociativeElimination DeligneDrinfeld.WordGrading +open DeligneDrinfeld.CutoffPrimitiveExtract DeligneDrinfeld.TruncatedWords +attribute [local instance] LieRing.ofAssociativeRing + def assoc (a b : L) : A ℝ Bool →ₐ[ℝ] A ℝ Bool := lift (fun i => if i then embed b else embed a) + @[simp] theorem assoc_atom (a b : L) (i : Bool) : assoc a b (atom i)=if i then embed b else embed a := lift_atom _ _ + theorem assoc_embed (a b p : L) : assoc a b (embed p)=embed (eval a b p) := by + have hh : (assoc a b).toLieHom.comp embed=embed.comp (eval a b) := by + apply FreeLieAlgebra.hom_ext + intro i + change assoc a b (embed (FreeLieAlgebra.of ℝ i))=embed (eval a b (FreeLieAlgebra.of ℝ i)) + rw [embed_of,assoc_atom] + cases i <;> simp [eval] + exact LieHom.congr_fun hh p + theorem assoc_homogeneous (a b : L) (ha : a∈Ln 1) (hb : b∈Ln 1) (i : Bool) : + assoc a b (atom i)∈homogeneous (fun _ => 1) 1 := by + rw [assoc_atom] + cases i + · exact WeightBridge.embed_homogeneous ha + · exact WeightBridge.embed_homogeneous hb + theorem piece_natural (N n : ℕ) (hn : n≤N) (f : A ℝ Bool →ₐ[ℝ] A ℝ Bool) + (g : CutoffDepth.Q ℝ N →ₐ[ℝ] CutoffDepth.Q ℝ N) + (hf : ∀ i,f (atom i)∈homogeneous (fun _ => 1) 1) + (hg : ∀ i,g (CutoffDepth.gen N i)=quotient ∅ N (f (atom i))) (u : CutoffDepth.Q ℝ N) : + TensorProjection.piece n (normalVal N (g u))=f (TensorProjection.piece n (normalVal N u)) := by + have he : g.comp (quotient ∅ N)=(quotient ∅ N).comp f := by + apply AssociativeElimination.hom_ext + exact hg + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective ℝ (relations (∅:Set (A ℝ Bool)) N) u + change TensorProjection.piece n (normalVal N (g (quotient ∅ N p)))= + f (TensorProjection.piece n (normalVal N (quotient ∅ N p))) + rw [show g (quotient ∅ N p)=quotient ∅ N (f p) from AlgHom.congr_fun he p, + normalVal_quotient,normalVal_quotient,piece_trunc _ _ hn,piece_trunc _ _ hn] + exact (algHom_piece f (fun _ => 1) (fun _ => 1) hf n p).symm + theorem swap_piece (N n : ℕ) (hn : n≤N) (u : CutoffDepth.Q ℝ N) : + TensorProjection.piece n (normalVal N (KZSwap.swap N u))= + assoc y x (TensorProjection.piece n (normalVal N u)) := by + apply piece_natural N n hn _ _ (assoc_homogeneous y x WeightBridge.y_mem WeightBridge.x_mem) + intro i + rw [KZSwap.swap_gen,assoc_atom] + cases i <;> simp only [x,y,embed_of] + all_goals rfl + theorem rotate_piece (N n : ℕ) (hn : n≤N) (u : CutoffDepth.Q ℝ N) : + TensorProjection.piece n (normalVal N (ComplexComparison.realRotate N u))= + assoc y (-x-y) (TensorProjection.piece n (normalVal N u)) := by + apply piece_natural N n hn _ _ (assoc_homogeneous y (-x-y) WeightBridge.y_mem + ((Ln 1).sub_mem ((Ln 1).neg_mem WeightBridge.x_mem) WeightBridge.y_mem)) + intro i + rw [ComplexComparison.realRotate_gen,assoc_atom] + cases i + · simp only [y,embed_of]; rfl + · change -CutoffDepth.gen N false-CutoffDepth.gen N true=quotient ∅ N (embed (-x-y)) + simp only [map_sub,map_neg,x,y,embed_of]; rfl + theorem anti (n : ℕ) : q n+eval y x (q n)=0 := by + apply UniversalEmbedding.injective + rw [map_add,map_zero,←assoc_embed, q_embed_any n n le_rfl] + have hh := congrArg (fun u => TensorProjection.piece n (normalVal n u)) (KZSwap.value_swap n) + rw [swap_piece n n le_rfl,map_neg,map_neg] at hh + change TensorProjection.piece n (V n)+assoc y x (TensorProjection.piece n (V n))=0 + rw [hh,add_neg_cancel] + theorem cyclic (n : ℕ) : q n+eval y (-x-y) (q n)+eval (-x-y) x (q n)=0 := by + have hrot (p : L) : eval y (-x-y) (eval y (-x-y) p)=eval (-x-y) x p := + LieHom.congr_fun CategoricalValues.rotate_squared p + apply UniversalEmbedding.injective + rw [map_add,map_add,map_zero,←hrot,←assoc_embed,←assoc_embed,←assoc_embed,q_embed_any n n le_rfl] + have hh := congrArg (fun u => TensorProjection.piece n (normalVal n u)) (ComplexComparison.real_value_cyclic n) + simpa only [map_add,map_zero,rotate_piece n n le_rfl] using hh +end + +open DeligneDrinfeld DeligneDrinfeld.AssociativeElimination DeligneDrinfeld.WordGrading +open DeligneDrinfeld.CutoffPrimitiveExtract DeligneDrinfeld.TruncatedWords +open DeligneDrinfeld.LieGrading DeligneDrinfeld.UniversalEmbedding + theorem value_depth (N : ℕ) : KZComparison.value N∈CutoffDepth.depthSpace N 1 := by + have hh := (CutoffDepth.depthSpace N 1).add_mem + (CutoffDepth.depth_antitone N (by omega : 1≤2) (KZComparison.arrow_log_congruence N)) + (KZComparison.arrow_depth N) + simpa only [sub_add_cancel] using hh + theorem normal_depth (N : ℕ) : V N∈above GenericIhara.depth 1 := by + obtain ⟨p,hp,h⟩ := value_depth N + change CutoffDepth.quotient N p=KZComparison.value N at h + rw [V,←h,normalVal_quotient] + exact project_preserves hp + theorem q_depth (n : ℕ) : embed (q n)∈above GenericIhara.depth 1 := by + rw [q_embed_any n n le_rfl] + exact project_preserves (normal_depth n) + theorem weight_one_form {p : L} (hp : p∈Ln 1) : ∃ a b : ℝ,p=a • x+b • y := by + rw [Ln,WeightBridge.piece_eq] at hp + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,hu,rfl⟩ := hp + obtain ⟨a,rfl⟩ := LowWeight.tree_degree_one u hu + cases a + · exact ⟨1,0,by simp [Tree.eval,x]⟩ + · exact ⟨0,1,by simp [Tree.eval,y]⟩ + | zero => exact ⟨0,0,by simp⟩ + | add p q _ _ hp hq => + obtain ⟨a,b,rfl⟩ := hp + obtain ⟨c,d,rfl⟩ := hq + exact ⟨a+c,b+d,by simp only [add_smul]; abel⟩ + | smul c p _ hp => + obtain ⟨a,b,rfl⟩ := hp + exact ⟨c*a,c*b,by simp only [smul_add,mul_smul]⟩ + theorem q_one : q 1=0 := by + classical + obtain ⟨a,b,h⟩ := weight_one_form (q_homogeneous 1) + have hd := q_depth 1 + have ha := coeff_support hd (FreeMonoid.of false) (by simp [GenericIhara.depth]) + rw [h,map_add,map_smul,map_smul] at ha + simp only [MonoidAlgebra.coeff_add,MonoidAlgebra.coeff_smul,x,y,embed_of,atom,MonoidAlgebra.coeff_single] at ha + norm_num at ha + change a+Finsupp.single (FreeMonoid.of true) b (FreeMonoid.of false)=0 at ha + rw [Finsupp.single_eq_of_ne (by intro he; have hh := congrArg FreeMonoid.toList he; simp at hh),add_zero] at ha + have hs := anti 1 + rw [h,ha,zero_smul,zero_add] at hs + have hh := congrArg (fun p => MonoidAlgebra.coeff (embed p) (FreeMonoid.of false)) hs + simp only [map_add,map_smul,map_zero,eval,y,x,FreeLieAlgebra.lift_of_apply,↓reduceIte,embed_of,atom,MonoidAlgebra.coeff_add,MonoidAlgebra.coeff_smul,MonoidAlgebra.coeff_single,MonoidAlgebra.coeff_zero] at hh + norm_num at hh + change Finsupp.single (FreeMonoid.of true) b (FreeMonoid.of false)+b=0 at hh + rw [Finsupp.single_eq_of_ne (by intro he; have hh := congrArg FreeMonoid.toList he; simp at hh),zero_add] at hh + simp only [h,ha,hh,zero_smul,zero_add] + def cyc : L →ₗ[ℝ] L := LinearMap.id+(eval y (-x-y)).toLinearMap+(eval (-x-y) x).toLinearMap + theorem cyclic_weight_two {p : L} (hp : p∈Ln 2) : cyc p=(3 : ℝ) • p := by + rw [Ln,WeightBridge.piece_eq] at hp + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,hu,rfl⟩ := hp + cases u with + | leaf a => simp at hu + | node u v => + have h1 := LowWeight.treeDegree_pos (fun _ : Bool => Nat.zero_lt_one) u + have h2 := LowWeight.treeDegree_pos (fun _ : Bool => Nat.zero_lt_one) v + simp only [treeDegree_node] at hu + obtain ⟨a,rfl⟩ := LowWeight.tree_degree_one u (by omega) + obtain ⟨b,rfl⟩ := LowWeight.tree_degree_one v (by omega) + cases a <;> cases b <;> + simp [Tree.eval,cyc,eval,x,y,lie_sub,sub_lie,lie_skew,show (3 : ℝ)=(1+1+1) by norm_num,add_smul] + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq,smul_add] + | smul c p _ hp => simp only [map_smul,hp,smul_smul,mul_comm] + theorem q_two : q 2=0 := by + have hc : cyc (q 2)=0 := cyclic 2 + rw [cyclic_weight_two (q_homogeneous 2)] at hc + exact (smul_eq_zero.mp hc).resolve_left (by norm_num) + theorem q_low {n : ℕ} (hn : n≤2) : q n=0 := by + interval_cases n + · simp [q] + · exact q_one + · exact q_two +end RealDeligneDrinfeld.KZHomogeneous + +namespace DeligneDrinfeld.TangentialCutoff + +section +open AssociativeElimination WordGrading TruncatedWords +variable {R α : Type*} [CommRing R] +variable (P : Set (A R α)) (N : ℕ) + variable (d : Module.End R (TruncatedWords.Q P N)) (hd : ∀ a b,d (a*b)=d a*b+a*d b) (h1 : d 1=0) + include hd h1 + theorem word_mem (k : ℕ) (hv : ∀ a,d (TruncatedDerivation.gen P N a)∈(filtration P N) (k+1)) (w : FreeMonoid α) : + d (quotient P N (word w))∈(filtration P N) (degree wt w+k) := by + induction w using FreeMonoid.inductionOn' with + | one => simp only [word_one,map_one,h1]; exact Submodule.zero_mem _ + | of_mul a w ih => + rw [word_mul,map_mul,hd,degree_mul,degree_of] + change _∈(filtration P N) (1+degree wt w+k) + apply Submodule.add_mem + · have hw : quotient P N (word w)∈(filtration P N) (degree wt w) := ⟨word w,WordGrading.word_mem w le_rfl,rfl⟩ + simpa only [TruncatedDerivation.gen,word_of,show k+1+degree wt w=1+degree wt w+k by omega] using filtration_mul P N (k+1) _ (hv a) hw + · simpa only [Nat.add_assoc,wt,TruncatedDerivation.gen,word_of] using + filtration_mul P N 1 _ (TruncatedDerivation.gen_mem P N a) ih + theorem mem (k : ℕ) (hv : ∀ a,d (TruncatedDerivation.gen P N a)∈(filtration P N) (k+1)) + (m : ℕ) (a : (TruncatedWords.Q P N)) (ha : a∈(filtration P N) m) : d a∈(filtration P N) (m+k) := by + obtain ⟨p,hp,rfl⟩ := ha + exact map_space (d.comp (quotient P N).toLinearMap) _ + (fun w hw => filtration_antitone P N (Nat.add_le_add_right hw k) (word_mem P N d hd h1 k hv w)) hp + +end + +open AssociativeElimination TruncatedWords +variable {R : Type*} [CommRing R] (N : ℕ) + theorem difference_mem (d e : Module.End R (TruncatedWords.Q (∅ : Set (A R Bool)) N)) (q r : (TruncatedWords.Q (∅ : Set (A R Bool)) N)) + (hd : ∀ a b,d (a*b)=d a*b+a*d b) (he : ∀ a b,e (a*b)=e a*b+a*e b) + (hd1 : d 1=0) (he1 : e 1=0) (hdx : d (TruncatedDerivation.gen (∅ : Set (A R Bool)) N false)=0) (hex : e (TruncatedDerivation.gen (∅ : Set (A R Bool)) N false)=0) + (hdy : d (TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)=(TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)*q-q*(TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)) (hey : e (TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)=(TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)*r-r*(TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)) + (k : ℕ) (hq : q-r∈(filtration (∅ : Set (A R Bool)) N) k) (m : ℕ) (a : (TruncatedWords.Q (∅ : Set (A R Bool)) N)) (ha : a∈(filtration (∅ : Set (A R Bool)) N) m) : + d a+q*a-(e a+r*a)∈(filtration (∅ : Set (A R Bool)) N) (m+k) := by + have hm : (d-e) a∈(filtration (∅ : Set (A R Bool)) N) (m+k) := by + apply mem ∅ N (d-e) (fun a b => ?_) (by simp only [LinearMap.sub_apply,hd1,he1,sub_self]) + k (fun b => ?_) m a ha + · simp only [LinearMap.sub_apply,hd,he,sub_mul,mul_sub] + abel + · cases b + · simp only [LinearMap.sub_apply,hdx,hex,sub_self,Submodule.zero_mem] + · change d (TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)-e (TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)∈_ + rw [hdy,hey] + have hy := TruncatedDerivation.gen_mem (∅:Set (A R Bool)) N true + have hm1 := filtration_mul ∅ N 1 k hy hq + have hm2 := filtration_mul ∅ N k 1 hq hy + have hh : (TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)*(q-r)-(q-r)*(TruncatedDerivation.gen (∅ : Set (A R Bool)) N true)∈(filtration (∅ : Set (A R Bool)) N) (k+1) := + ((filtration (∅ : Set (A R Bool)) N) (k+1)).sub_mem (by simpa only [Nat.add_comm 1 k] using hm1) hm2 + convert hh using 1; simp only [mul_sub,sub_mul]; abel + have hq' : (q-r)*a∈(filtration (∅ : Set (A R Bool)) N) (m+k) := by + simpa only [Nat.add_comm k m] using filtration_mul ∅ N k m hq ha + convert ((filtration (∅ : Set (A R Bool)) N) (m+k)).add_mem hm hq' using 1 + simp only [LinearMap.sub_apply,sub_mul] + abel +end DeligneDrinfeld.TangentialCutoff + +namespace DeligneDrinfeld.CutoffCategory +open AssociativeElimination WordGrading TruncatedWords +variable {R α B O O' : Type*} [CommRing R] [Ring B] [Algebra R B] +variable (P : Set (A R α)) (N : ℕ) +variable (g : CategoryExp.Data R (TruncatedWords.Q P N) O) (k : CategoryExp.Data R B O') + (f : TruncatedWords.Q P N →ₐ[R] B) (p : O) (s : O') + + theorem loop_natural (hgen : ∀ a,k.D s s (f (TruncatedDerivation.gen P N a))= + f (g.D p p (TruncatedDerivation.gen P N a))) (u : TruncatedWords.Q P N) : + k.D s s (f u)=f (g.D p p u) := by + have hword (w : FreeMonoid α) : + k.D s s (f (quotient P N (word w)))=f (g.D p p (quotient P N (word w))) := by + induction w using FreeMonoid.inductionOn' with + | one => rw [word_one,map_one,map_one,g.one,k.one,map_zero] + | of_mul a w ih => + rw [word_mul,word_of,map_mul,map_mul,k.comp,g.comp,map_add,map_mul,map_mul,ih] + rw [show quotient P N (atom a)=TruncatedDerivation.gen P N a from rfl,hgen] + obtain ⟨u,rfl⟩ := RingQuot.mkAlgHom_surjective R (relations P N) u + induction u using MonoidAlgebra.induction_on with + | of w => exact hword w + | add u v hu hv => simp only [map_add,hu,hv] + | smul r u hu => simp only [map_smul,hu] + + theorem edge_natural (q : O) (t : O') + (hunit : k.D s t 1=f (g.D p q 1)) + (hgen : ∀ a,k.D s s (f (TruncatedDerivation.gen P N a))= + f (g.D p p (TruncatedDerivation.gen P N a))) (u : TruncatedWords.Q P N) : + k.D s t (f u)=f (g.D p q u) := by + have hg := g.comp p p q u 1 + have hk := k.comp s s t (f u) 1 + simp only [one_mul] at hg hk + rw [hg,hk,map_add,map_mul,hunit,loop_natural P N g k f p s hgen] + + theorem exp_edge [Module ℚ (TruncatedWords.Q P N)] [Module ℚ B] + (hg : ∀ p q,IsNilpotent (g.D p q)) (hk : ∀ p q,IsNilpotent (k.D p q)) + (q : O) (t : O') + (hunit : k.D s t 1=f (g.D p q 1)) + (hgen : ∀ a,k.D s s (f (TruncatedDerivation.gen P N a))= + f (g.D p p (TruncatedDerivation.gen P N a))) (u : TruncatedWords.Q P N) : + CategoryExp.act k s t (f u)=f (CategoryExp.act g p q u) := + OperatorExp.natural _ _ (hg p q) (hk s t) f.toLinearMap + (edge_natural P N g k f p s q t hunit hgen) u + +end DeligneDrinfeld.CutoffCategory + +namespace DeligneDrinfeld.PresentedSubstitution +open AssociativeElimination WordGrading TruncatedWords +variable {R α β : Type*} [CommRing R] (P : Set (A R β)) (N : ℕ) +variable (f : α → TruncatedWords.Q P N) (hf : ∀ a,f a∈filtration P N 1) +include hf + theorem lift_word_mem (w : FreeMonoid α) : + lift (R:=R) f (word w)∈filtration P N (degree (fun _ => 1) w) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa only [word_one,map_one,degree_one] using filtration_one P N + | of_mul a w ih => + rw [word_mul,word_of,map_mul,lift_atom,degree_mul,degree_of] + exact filtration_mul P N 1 _ (hf a) ih + theorem lift_mem {n : ℕ} {a : A R α} (ha : a∈above (fun _ => 1) n) : + lift (R:=R) f a∈filtration P N n := + map_space (lift (R:=R) f).toLinearMap _ + (fun w hw => filtration_antitone P N hw (lift_word_mem P N f hf w)) ha + def subst : TruncatedWords.Q (∅:Set (A R α)) N →ₐ[R] TruncatedWords.Q P N := + RingQuot.liftAlgHom R ⟨lift (R:=R) f,by + rintro p q ⟨rfl,hp⟩ + rcases hp with hp|hp + · exact False.elim hp + · simpa only [filtration_terminal,Submodule.mem_bot,map_zero] using lift_mem P N f hf hp⟩ + @[simp] theorem subst_quotient (a : A R α) : + subst P N f hf (quotient ∅ N a)=lift (R:=R) f a := by + simp only [subst,quotient,RingQuot.liftAlgHom_mkAlgHom_apply] + @[simp] theorem subst_gen (a : α) : + subst P N f hf (TruncatedDerivation.gen ∅ N a)=f a := by + rw [TruncatedDerivation.gen,subst_quotient,lift_atom] + theorem subst_mem {n : ℕ} {a : TruncatedWords.Q (∅:Set (A R α)) N} + (ha : a∈filtration ∅ N n) : subst P N f hf a∈filtration P N n := by + obtain ⟨a,ha,rfl⟩ := ha + change subst P N f hf (quotient ∅ N a)∈_ + rw [subst_quotient] + exact lift_mem P N f hf ha +end DeligneDrinfeld.PresentedSubstitution + +namespace DeligneDrinfeld.PresentedCutoff +open AssociativeElimination WordGrading TruncatedWords +variable {R α M : Type*} [CommRing R] [LieRing M] [LieAlgebra R M] +attribute [local instance] LieRing.ofAssociativeRing +variable (P : Set (A R α)) (N : ℕ) +local notation "Q" => TruncatedWords.Q P N + + theorem raw_embed (d : LieDerivation R M M) (e : FreeLieAlgebra R α →ₗ⁅R⁆ M) + (j : M →ₗ⁅R⁆ Q) (hj : ∀ a,j (e (FreeLieAlgebra.of R a))=TruncatedDerivation.gen P N a) + (p : FreeLieAlgebra R α) : + TruncatedDerivation.raw P N (fun a => j (d (e (FreeLieAlgebra.of R a)))) (embed p)=j (d (e p)) := by + have he : (quotient P N).toLieHom.comp embed=j.comp e := by + apply FreeLieAlgebra.hom_ext + intro a + change quotient P N (embed (FreeLieAlgebra.of R a))=j (e (FreeLieAlgebra.of R a)) + rw [embed_of,hj]; rfl + have he' (p : FreeLieAlgebra R α) : quotient P N (embed p)=j (e p) := LieHom.congr_fun he p + induction p using freeLie_induction with + | h0 => simp + | hg a => rw [embed_of,TruncatedDerivation.raw_atom] + | ha a b ha hb => simp only [map_add,ha,hb] + | hs r a ha => simp only [map_smul,ha] + | hl a b ha hb => + simp only [LieHom.map_lie,LieDerivation.apply_lie_eq_add,map_add] + change TruncatedDerivation.raw P N _ (embed a*embed b-embed b*embed a)=_ + rw [map_sub,TruncatedDerivation.raw_mul,TruncatedDerivation.raw_mul,ha,hb,he',he'] + simp only [Ring.lie_def] + noncomm_ring + + theorem derivation_embed (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈filtration P N (k+1)) + (hP : ∀ p∈P,TruncatedDerivation.raw P N v p=0) + (d : LieDerivation R M M) (e : FreeLieAlgebra R α →ₗ⁅R⁆ M) + (j : M →ₗ⁅R⁆ Q) (hj : ∀ a,j (e (FreeLieAlgebra.of R a))=TruncatedDerivation.gen P N a) + (hv' : ∀ a,v a=j (d (e (FreeLieAlgebra.of R a)))) (p : FreeLieAlgebra R α) : + TruncatedDerivation.derivation P N k v hv hP (quotient P N (embed p))=j (d (e p)) := by + rw [TruncatedDerivation.derivation_quotient] + have he : v=(fun a => j (d (e (FreeLieAlgebra.of R a)))) := funext hv' + rw [he] + exact raw_embed P N d e j hj p + +end DeligneDrinfeld.PresentedCutoff + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Completion.lean b/lean/OAI/Algebra/Drinfeld/Completion.lean new file mode 100644 index 0000000000000000000000000000000000000000..98a996a90f4f57a205a3e3e8673a8528e8e3dbbf --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Completion.lean @@ -0,0 +1,565 @@ +import OAI.Algebra.Drinfeld.Categories + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +section +namespace LieGrading +open AssociativeElimination UniversalEmbedding WordGrading +variable {R α : Type*} [CommRing R] + +def weightSupport (wt : α → ℕ) (p : FreeLieAlgebra R α) : Finset ℕ := + (embed p).coeff.support.image (degree wt) + +theorem piece_eq_zero_of_not_mem {wt : α → ℕ} {p : FreeLieAlgebra R α} {n : ℕ} + (hn : n∉weightSupport wt p) : piece wt n p=0 := by + classical + apply UniversalEmbedding.injective + rw [embed_piece,map_zero] + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + rw [WordGrading.piece,project_coeff] + by_cases hw : degree wt w=n + · rw [ite_eq_left hw] + change (embed p).coeff w=0 + by_contra hc + apply hn + exact Finset.mem_image.mpr ⟨w,by simpa only [Finsupp.mem_support_iff] using hc,hw⟩ + · rw [ite_eq_right hw] + rfl + +theorem sum_pieces (wt : α → ℕ) (p : FreeLieAlgebra R α) : + ∑ n∈weightSupport wt p,piece wt n p=p := by + classical + apply UniversalEmbedding.injective + rw [map_sum] + simp_rw [embed_piece] + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + simp only [MonoidAlgebra.coeff_sum,Finsupp.finsetSum_apply,WordGrading.piece,project_coeff] + by_cases hw : degree wt w∈weightSupport wt p + · simp only [Finset.sum_ite_eq,hw,ite_true] + · have hz : (embed p).coeff w=0 := by + by_contra hc + apply hw + exact Finset.mem_image.mpr ⟨w,by simpa only [Finsupp.mem_support_iff] using hc,rfl⟩ + simp [hz] + +theorem ext_pieces (wt : α → ℕ) {p q : FreeLieAlgebra R α} + (h : ∀ n,piece wt n p=piece wt n q) : p=q := by + have hz : ∀ n,piece wt n (p-q)=0 := by + intro n + change projection wt n (p-q)=0 + rw [map_sub] + change piece wt n p-piece wt n q=0 + rw [h n,sub_self] + apply sub_eq_zero.mp + rw [←sum_pieces wt (p-q)] + simp only [hz,Finset.sum_const_zero] + +end LieGrading +namespace PolynomialModuleCoefficients +open Polynomial +variable {M : Type*} [AddCommGroup M] [Module ℚ M] + +theorem eq_zero (s : Finset ℕ) (v : ℕ → M) + (h : ∀ c : ℚ,∑ n∈s,c^n • v n=0) {n : ℕ} (hn : n∈s) : v n=0 := by + classical + apply (Module.forall_dual_apply_eq_zero_iff ℚ (v n)).mp + intro l + let P : ℚ[X] := ∑ k∈s,Polynomial.monomial k (l (v k)) + have hp : P=0 := by + apply Polynomial.funext + intro c + have he := congrArg l (h c) + simpa only [P,Polynomial.eval_finsetSum,Polynomial.eval_monomial,map_sum,map_smul, + map_zero,smul_eq_mul,mul_comm,Polynomial.eval_zero] using he + have hc := congrArg (fun p : ℚ[X] => p.coeff n) hp + simpa only [P,Polynomial.finsetSum_coeff,Polynomial.coeff_monomial,Polynomial.coeff_zero, + Finset.sum_ite_eq',hn,ite_true] using hc + +theorem mem (E : Submodule ℚ M) (s : Finset ℕ) (v : ℕ → M) + (h : ∀ c : ℚ,∑ n∈s,c^n • v n∈E) {n : ℕ} (hn : n∈s) : v n∈E := by + apply (Submodule.Quotient.mk_eq_zero E).mp + exact eq_zero s (fun n => (Submodule.mkQ E) (v n)) (fun c => by + have he : E.mkQ (∑ n∈s,c^n • v n)=0 := (Submodule.Quotient.mk_eq_zero E).mpr (h c) + simpa only [map_sum,map_smul] using he) hn + +end PolynomialModuleCoefficients +end + +namespace LieGrading +variable {R α β : Type*} [CommRing R] +variable (wa : α → ℕ) (wb : β → ℕ) +variable (f : FreeLieAlgebra R α →ₗ[R] FreeLieAlgebra R β) +variable (hf : ∀ n {p},p∈homogeneousLie wa n → f p∈homogeneousLie wb n) +include hf + +theorem map_piece (n : ℕ) (p : FreeLieAlgebra R α) : f (piece wa n p)=piece wb n (f p) := by + classical + have he : f p=∑ k∈weightSupport wa p,f (piece wa k p) := by + rw [←map_sum,sum_pieces] + rw [he] + change _=projection wb n (∑ k∈weightSupport wa p,f (piece wa k p)) + rw [map_sum] + simp only [projection,LinearMap.coe_mk,AddHom.coe_mk] + simp_rw [piece_homogeneous (hf _ (piece_spec wa _ p).1)] + by_cases hn : n∈weightSupport wa p + · simp [hn] + · rw [piece_eq_zero_of_not_mem hn,map_zero] + simp [hn] + +theorem injective_of_homogeneous + (hi : ∀ n {p q},p∈homogeneousLie wa n → q∈homogeneousLie wa n → f p=f q → p=q) : + Function.Injective f := by + intro p q hpq + apply ext_pieces wa + intro n + apply hi n (piece_spec wa n p).1 (piece_spec wa n q).1 + rw [map_piece wa wb f hf,map_piece wa wb f hf,hpq] + +theorem reflects_homogeneous (hi : Function.Injective f) {n : ℕ} {p : FreeLieAlgebra R α} + (hp : f p∈homogeneousLie wb n) : p∈homogeneousLie wa n := by + have he : piece wa n p=p := by + apply hi + rw [map_piece wa wb f hf,piece_homogeneous hp,ite_eq_left rfl] + rw [←he] + exact (piece_spec wa n p).1 + +end LieGrading + +section +namespace SolutionGrading +open LieGrading AssociativeElimination UniversalEmbedding + +def dilation (c : ℚ) : L →ₗ⁅ℚ⁆ L := eval (c • x) (c • y) +@[simp] theorem dilation_x (c : ℚ) : dilation c x=c • x := eval_x _ _ +@[simp] theorem dilation_y (c : ℚ) : dilation c y=c • y := eval_y _ _ + +theorem eval_dilation {M : Type*} [LieRing M] [LieAlgebra ℚ M] + (c : ℚ) (a b : M) (p : L) : eval a b (dilation c p)=eval (c • a) (c • b) p := by + simp only [dilation,map_eval,map_smul,eval_x,eval_y] + +def braidDilation (c : ℚ) : T4 →ₗ⁅ℚ⁆ T4 := + T4Universal.lift (fun i j => c • t i j) + (by intros; rw [t_comm]) (by intros; rw [t_self,smul_zero]) + (by intros; rw [smul_lie,lie_smul,t_disjoint _ _ _ _ ‹_› ‹_› ‹_› ‹_› ‹_› ‹_›,smul_zero,smul_zero]) + (by intros; rw [←smul_add,smul_lie,lie_smul,t_three _ _ _ ‹_› ‹_› ‹_›,smul_zero,smul_zero]) + +@[simp] theorem braidDilation_t (c : ℚ) (i j : Fin 4) : braidDilation c (t i j)=c • t i j := + T4Universal.lift_t _ _ _ _ _ _ _ + +theorem dilation_W (c : ℚ) {p : L} (hp : p∈W) : dilation c p∈W := by + change IsSolution (dilation c p) + constructor + · have h := congrArg (dilation c) hp.1 + simp only [map_add,map_zero,map_eval,dilation_x,dilation_y] at h + simpa only [eval_dilation] using h + constructor + · have h := congrArg (dilation c) hp.2.1 + simp only [map_add,map_zero,map_eval,map_sub,map_neg,dilation_x,dilation_y,←smul_neg,←smul_sub] at h + simpa only [eval_dilation] using h + · have h := congrArg (braidDilation c) hp.2.2 + simp only [map_add,map_eval,braidDilation_t,←smul_add] at h + simpa only [eval_dilation] using h + +theorem dilation_homogeneous (c : ℚ) {n : ℕ} {p : L} + (hp : p∈homogeneousLie (fun _ => 1) n) : dilation c p=c^n • p := by + have ht : ∀ t : UniversalEmbedding.Tree Bool,dilation c t.eval=c^(treeDegree (fun _ => 1) t) • t.eval := by + intro t + induction t with + | leaf a => cases a <;> simp [Tree.eval,dilation,x,y,treeDegree_leaf,eval] + | node t u ht hu => + simp only [Tree.eval,LieHom.map_lie,treeDegree_node,ht,hu,smul_lie,lie_smul,smul_smul,←pow_add,Nat.add_comm] + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨t,hn,rfl⟩ := hp; simpa only [hn] using ht t + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq,smul_add] + | smul a p _ hp => simp only [map_smul,hp,smul_smul,mul_comm] + +theorem dilation_sum (c : ℚ) (p : L) : + dilation c p=∑ n∈weightSupport (fun _ => 1) p,c^n • piece (fun _ => 1) n p := by + conv_lhs => rw [←sum_pieces (fun _ => 1) p] + rw [map_sum] + apply Finset.sum_congr rfl + intro n _ + exact dilation_homogeneous c (piece_spec (fun _ => 1) n p).1 + +theorem piece_W {p : L} (hp : p∈W) (n : ℕ) : piece (fun _ => 1) n p∈W := by + classical + by_cases hn : n∈weightSupport (fun _ => 1) p + · apply PolynomialModuleCoefficients.mem W (weightSupport (fun _ => 1) p) + (fun n => piece (fun _ => 1) n p) ?_ hn + intro c + rw [←dilation_sum] + exact dilation_W c hp + · rw [piece_eq_zero_of_not_mem hn] + exact W.zero_mem + +theorem piece_Wn {p : L} (hp : p∈W) (n : ℕ) : piece (fun _ => 1) n p∈Wn n := by + exact ⟨piece_W hp n,by change _∈weightPiece (fun _ => 1) n; rw [LieGrading.weightPiece_eq]; exact (piece_spec (fun _ => 1) n p).1⟩ + +end SolutionGrading + +theorem completed_leftInverse (e : OddFree ≃ₗ[ℚ] W) (h : Graded e) : + Function.LeftInverse (completedInv e h) (completed e h) := by + intro a + funext n + apply Subtype.ext + change e.symm (e (a n))=(a n : OddFree) + exact e.symm_apply_apply _ + +theorem completed_rightInverse (e : OddFree ≃ₗ[ℚ] W) (h : Graded e) : + Function.RightInverse (completedInv e h) (completed e h) := by + intro a + funext n + apply Subtype.ext + change (e (e.symm ⟨a n,(a n).property.1⟩) : L)=(a n : L) + rw [e.apply_symm_apply] + +theorem completed_continuous (e : OddFree ≃ₗ[ℚ] W) (h : Graded e) : + Continuous (completed e h) := by + let : DiscreteTopology OddFree := ⟨rfl⟩ + apply continuous_pi + intro n + let f : Fn n → Wn n := fun p => ⟨e p,(e p).property,(h n p).2 p.property⟩ + exact (continuous_of_discreteTopology (f:=f)).comp (continuous_apply n) + +theorem completedInv_continuous (e : OddFree ≃ₗ[ℚ] W) (h : Graded e) : + Continuous (completedInv e h) := by + let : DiscreteTopology L := ⟨rfl⟩ + apply continuous_pi + intro n + let f : Wn n → Fn n := fun p => ⟨e.symm ⟨p,p.property.1⟩, + (h n _).1 (by rw [e.apply_symm_apply]; exact p.property.2)⟩ + exact (continuous_of_discreteTopology (f:=f)).comp (continuous_apply n) + +theorem completed_bracket (e : OddFree ≃ₗ[ℚ] W) (h : Graded e) + (he : ∀ a b,(e ⁅a,b⁆ : L)=ihara (e a) (e b)) + (a b : OddCompletion) (n : ℕ) : + (e (∑ i ∈ Finset.range (n+1),⁅(a i : OddFree),(b (n-i) : OddFree)⁆) : L)= + ∑ i ∈ Finset.range (n+1),ihara (completed e h a i) (completed e h b (n-i)) := by + simp only [map_sum,Submodule.coe_sum,he] + rfl + +namespace GradedGeneration +open LieGrading + +instance finite_Fn (n : ℕ) : Module.Finite ℚ (Fn n) := by + change Module.Finite ℚ (weightPiece oddWeight n) + rw [weightPiece_eq] + infer_instance + +theorem Fn_eq_bot {n : ℕ} (hn : n≤2) : Fn n=⊥ := by + change weightPiece oddWeight n=⊥ + rw [weightPiece_eq] + apply le_antisymm ?_ bot_le + apply Submodule.span_le.mpr + rintro p ⟨t,ht,rfl⟩ + have h := treeDegree_lower (m:=3) (wt:=oddWeight) (by intro k; simp [oddWeight]) t + omega + +variable (v : ℕ → L) (hv : ∀ k,v k∈Ln (oddWeight k)) +include hv + + theorem homogeneous {n : ℕ} {p : OddFree} (hp : p∈Fn n) : + GenericIhara.evalIhara v p∈Ln n := by + change _∈weightPiece (fun _ => 1) n + rw [weightPiece_eq] + apply homogeneous_iff.mpr + apply GenericIhara.evalIhara_homogeneous oddWeight v (fun k => ?_) (by + change p∈weightPiece oddWeight n at hp + rwa [weightPiece_eq] at hp) + apply homogeneousLie_embed + have h := hv k + change v k∈weightPiece (fun _ => 1) (oddWeight k) at h + rwa [weightPiece_eq] at h + +variable (hW : ∀ p,GenericIhara.evalIhara v p∈W) + +def valuePiece (n : ℕ) : Fn n →ₗ[ℚ] Wn n := + ((GenericIhara.evalIhara v).comp (Fn n).subtype).codRestrict _ + (fun p => ⟨hW p,homogeneous v hv p.property⟩) + +variable (hi : ∀ n,2 1) _ ?_ ?_ + · intro n p hp + rw [←weightPiece_eq] at hp ⊢ + exact homogeneous v hv hp + · intro n p q hp hq he + rw [←weightPiece_eq] at hp hq + exact congrArg Subtype.val (valuePiece_injective v hv hW hi n + (Subtype.ext he : valuePiece v hv hW n ⟨p,hp⟩=valuePiece v hv hW n ⟨q,hq⟩)) + +theorem valuePiece_surjective (n : ℕ) : Function.Surjective (valuePiece v hv hW n) := by + by_cases hn : 2 1) n q.val, + SolutionGrading.piece_Wn q.property n⟩ := by + intro n + exact valuePiece_surjective v hv hW hi n _ + choose p hp using hs + refine ⟨∑ n∈weightSupport (fun _ => 1) q.val,(p n).val,?_⟩ + apply Subtype.ext + change GenericIhara.evalIhara v (∑ n∈weightSupport (fun _ => 1) q.val,(p n).val)=q.val + rw [map_sum] + calc + _ = ∑ n∈weightSupport (fun _ => 1) q.val,piece (fun _ => 1) n q.val := by + apply Finset.sum_congr rfl + intro n _ + exact congrArg Subtype.val (hp n) + _ = q.val := sum_pieces _ _ + +def equivalence : OddFree ≃ₗ[ℚ] W := LinearEquiv.ofBijective (valueMap v hW) (valueMap_bijective v hv hW hi) + +theorem equivalence_graded : Graded (equivalence v hv hW hi) := by + intro n p + change GenericIhara.evalIhara v p∈Ln n ↔ p∈Fn n + constructor + · intro hp + change _∈weightPiece oddWeight n + rw [weightPiece_eq] + have hhom : ∀ m {q},q∈homogeneousLie oddWeight m → + GenericIhara.evalIhara v q∈homogeneousLie (fun _ => 1) m := by + intro m q hq + rw [←weightPiece_eq] at hq ⊢ + exact homogeneous v hv hq + have hpx : GenericIhara.evalIhara v p∈homogeneousLie (fun _ => 1) n := by + change _∈weightPiece (fun _ => 1) n at hp + rwa [weightPiece_eq] at hp + exact reflects_homogeneous oddWeight (fun _ => 1) (GenericIhara.evalIhara v) + (hf := hhom) (values_injective v hv hW hi) hpx + · exact homogeneous v hv + +theorem main_of_values : MainStatement := by + let e := equivalence v hv hW hi + have hg : Graded e := equivalence_graded v hv hW hi + have hb : ∀ a b,(e ⁅a,b⁆ : L)=ihara (e a) (e b) := by + intro a b + change GenericIhara.evalIhara v ⁅a,b⁆=ihara (GenericIhara.evalIhara v a) (GenericIhara.evalIhara v b) + rw [GenericIhara.evalIhara_lie,GenericIhara.rational_ihara] + exact ⟨e,hg,hb,completed_leftInverse e hg,completed_rightInverse e hg, + completed_continuous e hg,completedInv_continuous e hg,completed_bracket e hg hb⟩ + +end GradedGeneration +end + +namespace IntegralFamily +open LieGrading +variable {V : Values} (f : Family V) + +def rangeValues : Values where + space := (GenericIhara.evalIhara (cast f ℚ)).range + le_W := by rintro p ⟨q,rfl⟩; exact V.le_W (rational_mem f q) + bracket := by + rintro p q ⟨a,rfl⟩ ⟨b,rfl⟩ + exact ⟨⁅a,b⁆,by rw [GenericIhara.evalIhara_lie,GenericIhara.rational_ihara]⟩ + +def rangeFamily : Family (rangeValues f) where + value := f.value + homogeneous := f.homogeneous + member k := ⟨FreeLieAlgebra.of ℚ k,GenericIhara.evalIhara_of _ _⟩ + +def rangePiece (n : ℕ) : homogeneousLie (R:=ℚ) oddWeight n →ₗ[ℚ] piece (rangeValues f) n := + { toFun p := ⟨⟨GenericIhara.evalIhara (cast f ℚ) p.val, + V.le_W (rational_mem f p.val),by + change _∈weightPiece (fun _ => 1) n + rw [weightPiece_eq] + exact eval_homogeneous f ℚ p.property⟩,⟨p.val,rfl⟩⟩ + map_add' p q := by apply Subtype.ext; apply Subtype.ext; exact map_add _ _ _ + map_smul' c p := by apply Subtype.ext; apply Subtype.ext; exact map_smul _ _ _ } + +theorem rangePiece_surjective (n : ℕ) : Function.Surjective (rangePiece f n) := by + intro p + obtain ⟨q,hq⟩ := p.property + refine ⟨⟨LieGrading.piece oddWeight n q,(piece_spec oddWeight n q).1⟩,?_⟩ + apply Subtype.ext + apply Subtype.ext + change GenericIhara.evalIhara (cast f ℚ) (LieGrading.piece oddWeight n q)=p.val.val + rw [map_piece oddWeight (fun _ => 1) _ (fun _ _ hp => eval_homogeneous f ℚ hp),hq] + have hp : p.val.val∈homogeneousLie (fun _ => 1) n := by + have hp := p.val.property.2 + change _∈weightPiece (fun _ => 1) n at hp + rwa [weightPiece_eq] at hp + change LieGrading.piece (fun _ => 1) n p.val.val=p.val.val + rw [piece_homogeneous hp,ite_eq_left rfl] + +variable (g : NormalizedFamily.Data) (hg : g.value=cast f K) (ha : ∀ k,g.active k) +include hg ha + +theorem range_dimension_lower (n : ℕ) (hn : 2 z.val.val) hpq + have he : Module.finrank ℚ (homogeneousLie (R:=ℚ) oddWeight n)= + Module.finrank K (homogeneousLie (R:=K) oddWeight n) := + (LieDimension.finrank_homogeneous K oddWeight n).symm + rw [he,←SaturatedSolutions.finrank_reduction n (piece (rangeValues f) n) hn] + exact LinearMap.finrank_le_finrank_of_injective hi + +theorem rangePiece_injective (n : ℕ) (hn : 2 1) (oddWeight k) + rw [weightPiece_eq] + exact cast_homogeneous f ℚ k + have hW : ∀ p,GenericIhara.evalIhara (cast f ℚ) p∈W := fun p => V.le_W (rational_mem f p) + apply GradedGeneration.main_of_values (cast f ℚ) hv hW + intro n hn p q hpq + apply Subtype.ext + have hp : p.val∈homogeneousLie oddWeight n := by + have hp := p.property + change _∈weightPiece oddWeight n at hp + rwa [weightPiece_eq] at hp + have hq : q.val∈homogeneousLie oddWeight n := by + have hq := q.property + change _∈weightPiece oddWeight n at hq + rwa [weightPiece_eq] at hq + exact congrArg (fun z : homogeneousLie (R:=ℚ) oddWeight n => z.val) (rangePiece_injective f g hg ha n hn + (show rangePiece f n ⟨p.val,hp⟩=rangePiece f n ⟨q.val,hq⟩ from + Subtype.ext (Subtype.ext (congrArg Subtype.val hpq)))) + +omit hg ha in + +theorem main_of_oddValues (V : Values) (h : OddValues V) : MainStatement := + main_of_normalized (normalizedFamily V h) (normalizedData V h) rfl (fun _ => True.intro) + +end IntegralFamily + +namespace CategoricalValues + +def OddWitnesses : Prop := ∀ k,∃ w : Witness, + value w∈Ln (oddWeight k) ∧ + (AssociativeElimination.embed (value w)).coeff (GenericIhara.depthOneWord (oddWeight k-1))≠0 + +theorem main_of_oddWitnesses (h : OddWitnesses) : MainStatement := by + apply IntegralFamily.main_of_oddValues values + intro k + obtain ⟨w,hw,hc⟩ := h k + exact ⟨⟨value w,value_mem w,hw⟩,⟨w,rfl⟩,hc⟩ + +open CategoryGauge + +def ofSolution {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 1) q] + apply Submodule.sum_mem + intro n hn + exact Wn_le_values n (SolutionGrading.piece_Wn hq n) + +theorem W_ihara_closed {p q : L} (hp : p∈W) (hq : q∈W) : ihara p q∈W := by + rw [←values_eq_W] at hp hq ⊢ + exact values.bracket hp hq + +theorem main_of_oddSolutions + (h : ∀ k,∃ q : L,q∈Wn (oddWeight k) ∧ + (AssociativeElimination.embed q).coeff (GenericIhara.depthOneWord (oddWeight k-1))≠0) : + MainStatement := by + apply main_of_oddWitnesses + intro k + obtain ⟨q,hq,hc⟩ := h k + exact ⟨ofSolution hq.1 hq.2 (by unfold oddWeight; omega),by simpa using hq.2,by simpa using hc⟩ + +end CategoricalValues + +open AssociativeElimination WordGrading + theorem real_odd_nonzero (k : ℕ) : + (embed (RealDeligneDrinfeld.KZHomogeneous.q (2*k+3))).coeff (GenericIhara.depthOneWord (2*k+2))≠0 := by + rw [RealDeligneDrinfeld.KZHomogeneous.q_embed_any (2*k+3) (2*k+3) le_rfl] + change (piece (fun _ => 1) (2*k+3) _).coeff _≠0 + rw [piece,project_coeff,ite_eq_left (by rw [CutoffDepth.length_depthOne])] + exact KZComparison.odd_value_nonzero k + theorem odd_solution (k : ℕ) : ∃ q : L,q∈Wn (oddWeight k) ∧ + (embed q).coeff (GenericIhara.depthOneWord (oddWeight k-1))≠0 := by + have hh := RationalScalar.descend (RealDeligneDrinfeld.KZHomogeneous.coefficient_solution (2*k+3)) + (RealDeligneDrinfeld.KZHomogeneous.q_homogeneous (2*k+3)) + (GenericIhara.depthOneWord (2*k+2)) (real_odd_nonzero k) + simpa only [oddWeight,show 2*k+3-1=2*k+2 by omega] using hh + theorem main : MainStatement := CategoricalValues.main_of_oddSolutions odd_solution + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Descent.lean b/lean/OAI/Algebra/Drinfeld/Descent.lean new file mode 100644 index 0000000000000000000000000000000000000000..31466f05a4edb08fec2183109af634c402afce3c --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Descent.lean @@ -0,0 +1,902 @@ +import OAI.Algebra.Drinfeld.Pentagon + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +namespace RationalDescent +open scoped TensorProduct +variable {K V E : Type*} [Field K] [AddCommGroup V] [Module K V] + [AddCommGroup E] [Module K E] + +theorem factor_of_kernel (f : V →ₗ[K] E) (l : V →ₗ[K] K) (h : f.ker≤l.ker) : + ∃ g : E →ₗ[K] K,g.comp f=l := by + let r : f.range →ₗ[K] K := ((f.ker).liftQ l h).comp f.quotKerEquivRange.symm.toLinearMap + obtain ⟨g,hg⟩ := r.exists_extend + refine ⟨g,?_⟩ + ext v + have hh := LinearMap.congr_fun hg (f.rangeRestrict v) + change g (f v)=r (f.rangeRestrict v) at hh + change g (f v)=l v + rw [hh] + simp only [r,LinearMap.comp_apply,LinearEquiv.coe_coe] + exact congrArg (f.ker.liftQ l h) (f.quotKerEquivRange.symm_apply_apply (f.ker.mkQ v)) + +theorem nonvanishing {S : Type*} [AddCommGroup S] [Module K S] + (f : V →ₗ[K] E) (l : V →ₗ[K] K) + (u : S ⊗[K] V) (hu : f.lTensor S u=0) (hl : l.lTensor S u≠0) : + ∃ v : V,f v=0 ∧ l v≠0 := by + by_contra hn + have hk : f.ker≤l.ker := by + intro v hv + by_contra hv' + exact hn ⟨v,hv,hv'⟩ + obtain ⟨g,hg⟩ := factor_of_kernel f l hk + apply hl + rw [←hg,LinearMap.lTensor_comp,LinearMap.comp_apply,hu,map_zero] + +end RationalDescent + +namespace RationalScalar + +section +open scoped TensorProduct +open AssociativeElimination UniversalEmbedding +attribute [local instance] LieRing.ofAssociativeRing +variable {M N : Type*} [LieRing M] [LieAlgebra ℚ M] [LieRing N] [LieAlgebra ℚ N] +abbrev T (M : Type*) [AddCommGroup M] [Module ℚ M] := ℝ ⊗[ℚ] M + def one : M →ₗ⁅ℚ⁆ T M where + toLinearMap := TensorProduct.mk ℚ ℝ M 1 + map_lie' := by + intro a b + change 1 ⊗ₜ[ℚ] ⁅a,b⁆=⁅(1:ℝ) ⊗ₜ[ℚ] a,(1:ℝ) ⊗ₜ[ℚ] b⁆ + rw [LieAlgebra.ExtendScalars.bracket_tmul,one_mul] + def base (f : M →ₗ⁅ℚ⁆ N) : T M →ₗ⁅ℝ⁆ T N where + toLinearMap := f.toLinearMap.baseChange ℝ + map_lie' := by + intro a b + change (f.toLinearMap.baseChange ℝ) ⁅a,b⁆=⁅(f.toLinearMap.baseChange ℝ) a,(f.toLinearMap.baseChange ℝ) b⁆ + induction a using TensorProduct.inductionOn with + + | tmul s a => + induction b using TensorProduct.inductionOn with + + | tmul t b => + simp only [LieAlgebra.ExtendScalars.bracket_tmul,LinearMap.baseChange_tmul] + change (s*t) ⊗ₜ[ℚ] f ⁅a,b⁆=(s*t) ⊗ₜ[ℚ] ⁅f a,f b⁆ + rw [LieHom.map_lie] + | add a b ha hb => simp only [lie_add,map_add,ha,hb] + | add a b ha hb => simp only [add_lie,map_add,ha,hb] + @[simp] theorem base_tmul (f : M →ₗ⁅ℚ⁆ N) (s : ℝ) (p : M) : base f (s ⊗ₜ[ℚ] p)=s ⊗ₜ[ℚ] f p := rfl +variable {α : Type*} + def free : FreeLieAlgebra ℝ α →ₗ⁅ℝ⁆ T (FreeLieAlgebra ℚ α) := + FreeLieAlgebra.lift ℝ (fun a => 1 ⊗ₜ[ℚ] FreeLieAlgebra.of ℚ a) + @[simp] theorem free_of (a : α) : free (FreeLieAlgebra.of ℝ a)=1 ⊗ₜ[ℚ] FreeLieAlgebra.of ℚ a := FreeLieAlgebra.lift_of_apply _ _ + theorem free_tree (t : UniversalEmbedding.Tree α) : free (t.eval : FreeLieAlgebra ℝ α)=1 ⊗ₜ[ℚ] (t.eval : FreeLieAlgebra ℚ α) := by + induction t with + | leaf a => exact free_of a + | node t u ht hu => simp only [Tree.eval,LieHom.map_lie,ht,hu,LieAlgebra.ExtendScalars.bracket_tmul,one_mul] + theorem cast_tree {S : Type*} [CommRing S] (t : UniversalEmbedding.Tree α) : + IntegralBaseChange.lie (t.eval : FreeLieAlgebra ℤ α)=(t.eval : FreeLieAlgebra S α) := by + induction t with + | leaf a => exact IntegralBaseChange.lie_of a + | node t u ht hu => simp only [Tree.eval,LieHom.map_lie,ht,hu] + theorem tree_coefficient (t : UniversalEmbedding.Tree α) (w : FreeMonoid α) : + ((embed (t.eval : FreeLieAlgebra ℚ α)).coeff w:ℝ)=(embed (t.eval : FreeLieAlgebra ℝ α)).coeff w := by + rw [←cast_tree (S:=ℚ) t,←cast_tree (S:=ℝ) t,IntegralBaseChange.embed_lie,IntegralBaseChange.embed_lie, + IntegralBaseChange.words_coeff,IntegralBaseChange.words_coeff] + simp + def coefficient (w : FreeMonoid α) : FreeLieAlgebra ℚ α →ₗ[ℚ] ℚ := + (Finsupp.lapply w).comp ((MonoidAlgebra.coeffLinearEquiv ℚ).toLinearMap.comp embed.toLinearMap) + def realCoefficient (w : FreeMonoid α) : T (FreeLieAlgebra ℚ α) →ₗ[ℝ] ℝ := + TensorProduct.AlgebraTensorModule.lift (LinearMap.smulRight (LinearMap.id : ℝ →ₗ[ℝ] ℝ) + ((Algebra.linearMap ℚ ℝ).comp (coefficient w))) + @[simp] theorem realCoefficient_tmul (w : FreeMonoid α) (s : ℝ) (p : FreeLieAlgebra ℚ α) : + realCoefficient w (s ⊗ₜ[ℚ] p)=s*(coefficient w p:ℝ) := rfl + theorem coefficient_free {wt : α → ℕ} {n : ℕ} {p : FreeLieAlgebra ℝ α} + (hp : p∈RealDeligneDrinfeld.weightPiece wt n) (w : FreeMonoid α) : + realCoefficient w (free p)=(embed p).coeff w := by + rw [RealDeligneDrinfeld.WeightBridge.piece_eq] at hp + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨t,_ht,rfl⟩ := hp + rw [free_tree,realCoefficient_tmul,one_mul] + exact tree_coefficient t w + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq,MonoidAlgebra.coeff_add,Finsupp.add_apply] + | smul s p _ hp => simp only [map_smul,hp,MonoidAlgebra.coeff_smul,Finsupp.smul_apply] + theorem realCoefficient_tensor (w : FreeMonoid α) (u : T (FreeLieAlgebra ℚ α)) : + realCoefficient w u=TensorProduct.rid ℚ ℝ ((coefficient w).lTensor ℝ u) := by + induction u using TensorProduct.inductionOn with + + | tmul s p => + simp only [realCoefficient_tmul,LinearMap.lTensor_tmul,TensorProduct.rid_tmul] + change s*(coefficient w p:ℝ)=(coefficient w p:ℝ)*s + exact mul_comm _ _ + | add a b ha hb => simp only [map_add,ha,hb] +end + +open scoped TensorProduct + def realT4 : RealDeligneDrinfeld.T4 →ₗ⁅ℝ⁆ T T4 := + RealDeligneDrinfeld.T4Universal.lift (fun i j => one (t i j)) + (fun i j => congrArg one (t_comm i j)) (fun i => by rw [t_self,map_zero]) + (fun i j k l hij hik hil hjk hjl hkl => by rw [←LieHom.map_lie,t_disjoint i j k l hij hik hil hjk hjl hkl,map_zero]) + (fun i j k hij hik hjk => by rw [←map_add,←LieHom.map_lie,t_three i j k hij hik hjk,map_zero]) + @[simp] theorem realT4_t (i j : Fin 4) : realT4 (RealDeligneDrinfeld.t i j)=one (t i j) := + RealDeligneDrinfeld.T4Universal.lift_t _ _ _ _ _ _ _ + theorem eval_natural {M : Type*} [LieRing M] [LieAlgebra ℚ M] + {P : Type*} [LieRing P] [LieAlgebra ℝ P] (g : P →ₗ⁅ℝ⁆ T M) + (a b : M) (a' b' : P) (ha : g a'=one a) (hb : g b'=one b) (p : RealDeligneDrinfeld.L) : + base (eval a b) (free p)=g (RealDeligneDrinfeld.eval a' b' p) := by + have hh : (base (eval a b)).comp free=g.comp (RealDeligneDrinfeld.eval a' b') := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp only [LieHom.comp_apply,free_of,base_tmul,eval,RealDeligneDrinfeld.eval,FreeLieAlgebra.lift_of_apply,Bool.false_eq_true,ite_false,ite_true] <;> first | exact ha.symm | exact hb.symm + exact DFunLike.congr_fun hh p + def antiMap : L →ₗ[ℚ] L := LinearMap.id+(eval y x).toLinearMap + def cyclicMap : L →ₗ[ℚ] L := LinearMap.id+(eval y (-x-y)).toLinearMap+(eval (-x-y) x).toLinearMap + def pentagonMap : L →ₗ[ℚ] T4 := + (eval (t 0 1) (t 1 2+t 1 3)).toLinearMap+(eval (t 0 2+t 1 2) (t 2 3)).toLinearMap- + ((eval (t 1 2) (t 2 3)).toLinearMap+(eval (t 0 1+t 0 2) (t 1 3+t 2 3)).toLinearMap+(eval (t 0 1) (t 1 2)).toLinearMap) + theorem tensor_add {A B : Type*} [AddCommGroup A] [Module ℚ A] [AddCommGroup B] [Module ℚ B] + (f g : A →ₗ[ℚ] B) (u : T A) : (f+g).lTensor ℝ u=f.lTensor ℝ u+g.lTensor ℝ u := by + induction u using TensorProduct.inductionOn with + + | tmul s p => simp + | add a b ha hb => simp only [map_add,ha,hb]; abel + theorem tensor_sub {A B : Type*} [AddCommGroup A] [Module ℚ A] [AddCommGroup B] [Module ℚ B] + (f g : A →ₗ[ℚ] B) (u : T A) : (f-g).lTensor ℝ u=f.lTensor ℝ u-g.lTensor ℝ u := by + induction u using TensorProduct.inductionOn with + + | tmul s p => simp + | add a b ha hb => simp only [map_add,ha,hb]; abel + theorem tensor_id (u : T L) : (LinearMap.id : L →ₗ[ℚ] L).lTensor ℝ u=u := by simp + theorem eval_tensor {M : Type*} [LieRing M] [LieAlgebra ℚ M] (a b : M) (u : T L) : + (eval a b).toLinearMap.lTensor ℝ u=base (eval a b) u := rfl + @[simp] theorem free_x : free RealDeligneDrinfeld.x=one x := free_of false + @[simp] theorem free_y : free RealDeligneDrinfeld.y=one y := free_of true + theorem equations {p : RealDeligneDrinfeld.L} (hp : p∈RealDeligneDrinfeld.W) : + antiMap.lTensor ℝ (free p)=0 ∧ cyclicMap.lTensor ℝ (free p)=0 ∧ pentagonMap.lTensor ℝ (free p)=0 := by + rcases hp with ⟨h1,h2,h3⟩ + constructor + · rw [antiMap,tensor_add,tensor_id,eval_tensor,eval_natural free y x _ _ free_y free_x,←map_add,h1,map_zero] + constructor + · have hz : free (-RealDeligneDrinfeld.x-RealDeligneDrinfeld.y)=one (-x-y) := by simp + rw [cyclicMap,tensor_add,tensor_add,tensor_id,eval_tensor,eval_tensor, + eval_natural free y (-x-y) _ _ free_y hz,eval_natural free (-x-y) x _ _ hz free_x,←map_add,←map_add,h2,map_zero] + · rw [pentagonMap,tensor_sub,tensor_add,tensor_add,tensor_add] + simp only [eval_tensor] + have hsum (i j k l : Fin 4) : realT4 (RealDeligneDrinfeld.t i j+RealDeligneDrinfeld.t k l)=one (t i j+t k l) := by simp only [map_add,realT4_t] + rw [eval_natural realT4 _ _ _ _ (realT4_t 0 1) (hsum 1 2 1 3), + eval_natural realT4 _ _ _ _ (hsum 0 2 1 2) (realT4_t 2 3), + eval_natural realT4 _ _ _ _ (realT4_t 1 2) (realT4_t 2 3), + eval_natural realT4 _ _ _ _ (hsum 0 1 0 2) (hsum 1 3 2 3), + eval_natural realT4 _ _ _ _ (realT4_t 0 1) (realT4_t 1 2)] + rw [←map_add,←map_add,←map_add,h3,sub_self] + + theorem homogeneous_tensor {n : ℕ} {p : RealDeligneDrinfeld.L} (hp : p∈RealDeligneDrinfeld.Ln n) : + (Ln n).mkQ.lTensor ℝ (free p)=0 := by + change p∈RealDeligneDrinfeld.weightPiece (fun _ => 1) n at hp + rw [RealDeligneDrinfeld.WeightBridge.piece_eq] at hp + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨t,ht,rfl⟩ := hp + have hm : (t.eval : L)∈Ln n := by + change t.eval∈weightPiece (fun _ => 1) n + rw [LieGrading.weightPiece_eq] + exact Submodule.subset_span ⟨t,ht,rfl⟩ + rw [free_tree,LinearMap.lTensor_tmul] + have hz : (Ln n).mkQ (t.eval : L)=0 := (Submodule.Quotient.mk_eq_zero _).mpr hm + rw [hz,TensorProduct.tmul_zero] + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq,add_zero] + | smul s p _ hp => + rw [map_smul] + change ((Ln n).mkQ.baseChange ℝ) (s • free p)=0 + rw [map_smul] + change s • ((Ln n).mkQ.lTensor ℝ (free p))=0 + rw [hp,smul_zero] + theorem tensor_prod {A B C : Type*} [AddCommGroup A] [Module ℚ A] [AddCommGroup B] [Module ℚ B] + [AddCommGroup C] [Module ℚ C] (f : A →ₗ[ℚ] B) (g : A →ₗ[ℚ] C) (u : T A) + (hf : f.lTensor ℝ u=0) (hg : g.lTensor ℝ u=0) : (f.prod g).lTensor ℝ u=0 := by + have hh : TensorProduct.prodRight ℚ ℝ ℝ B C ((f.prod g).lTensor ℝ u)=(f.lTensor ℝ u,g.lTensor ℝ u) := by + clear hf hg + induction u using TensorProduct.inductionOn with + + | tmul s a => simp + | add a b ha hb => simp only [map_add,ha,hb,Prod.mk_add_mk] + apply (TensorProduct.prodRight ℚ ℝ ℝ B C).injective + rw [hh,hf,hg,map_zero]; rfl + def system (n : ℕ) : L →ₗ[ℚ] (L ⧸ Ln n) × L × L × T4 := + (Ln n).mkQ.prod (antiMap.prod (cyclicMap.prod pentagonMap)) + theorem descend {n : ℕ} {p : RealDeligneDrinfeld.L} (hp : p∈RealDeligneDrinfeld.W) + (hpn : p∈RealDeligneDrinfeld.Ln n) (w : FreeMonoid Bool) + (hc : (AssociativeElimination.embed p).coeff w≠0) : + ∃ q : L,q∈Wn n ∧ (AssociativeElimination.embed q).coeff w≠0 := by + have hs : (system n).lTensor ℝ (free p)=0 := by + obtain ⟨h1,h2,h3⟩ := equations hp + exact tensor_prod _ _ _ (homogeneous_tensor hpn) (tensor_prod _ _ _ h1 (tensor_prod _ _ _ h2 h3)) + have hn : (coefficient w).lTensor ℝ (free p)≠0 := by + intro he + apply hc + rw [←coefficient_free hpn w,realCoefficient_tensor,he,map_zero] + obtain ⟨q,hq,hc⟩ := RationalDescent.nonvanishing (system n) (coefficient w) (free p) hs hn + have hh : (Ln n).mkQ q=0 ∧ antiMap q=0 ∧ cyclicMap q=0 ∧ pentagonMap q=0 := by + change ((Ln n).mkQ q,antiMap q,cyclicMap q,pentagonMap q)=(0,0,0,0) at hq + simpa only [Prod.mk.injEq] using hq + refine ⟨q,⟨⟨hh.2.1,hh.2.2.1,?_⟩,(Submodule.Quotient.mk_eq_zero _).mp hh.1⟩,hc⟩ + exact sub_eq_zero.mp hh.2.2.2 +end RationalScalar + +namespace BraidSix +variable {M : Type*} [LieRing M] + +def total (a b c d e f : M) : M := a+b+c+d+e+f + +def matrix (a b c d e f : M) : Fin 4 → Fin 4 → M := + ![![0,a,d,f],![a,0,b,e],![d,b,0,c],![f,e,c,0]] + +structure Relations (a b c d e f : M) : Prop where + central : ∀ u∈({a,b,c,d,e,f}:Set M),⁅u,total a b c d e f⁆=0 + ac : ⁅a,c⁆=0 + de : ⁅d,e⁆=0 + aK : ⁅a,a+b+d⁆=0 + bK : ⁅b,a+b+d⁆=0 + bL : ⁅b,b+c+e⁆=0 + cL : ⁅c,b+c+e⁆=0 + +variable {a b c d e f : M} + +theorem bf (h : Relations a b c d e f) : ⁅b,f⁆=0 := by + calc + _=⁅b,total a b c d e f⁆-⁅b,a+b+d⁆-⁅b,b+c+e⁆ := by + simp only [total,lie_add,lie_self] + abel + _=0 := by rw [h.central b (by simp),h.bK,h.bL]; abel + +theorem dK (h : Relations a b c d e f) : ⁅d,a+b+d⁆=0 := by + have hh := lie_self (a+b+d) + rw [add_lie,add_lie,h.aK,h.bK] at hh + simpa only [zero_add] using hh + +theorem eL (h : Relations a b c d e f) : ⁅e,b+c+e⁆=0 := by + have hh := lie_self (b+c+e) + rw [add_lie,add_lie,h.bL,h.cL] at hh + simpa only [zero_add] using hh + +theorem aM (h : Relations a b c d e f) : ⁅a,a+e+f⁆=0 := by + calc + _=⁅a,total a b c d e f⁆-⁅a,a+b+d⁆-⁅a,c⁆ := by + simp only [total,lie_add,lie_self]; abel + _=0 := by rw [h.central a (by simp),h.aK,h.ac]; abel + +theorem eM (h : Relations a b c d e f) : ⁅e,a+e+f⁆=0 := by + calc + _=⁅e,total a b c d e f⁆-⁅e,b+c+e⁆+⁅d,e⁆ := by + simp only [total,lie_add,lie_self] + rw [←lie_skew d e] + abel + _=0 := by rw [h.central e (by simp),eL h,h.de]; abel + +theorem fM (h : Relations a b c d e f) : ⁅f,a+e+f⁆=0 := by + have hh := lie_self (a+e+f) + rw [add_lie,add_lie,aM h,eM h] at hh + simpa only [zero_add] using hh + +theorem dP (h : Relations a b c d e f) : ⁅d,d+c+f⁆=0 := by + calc + _=⁅d,total a b c d e f⁆-⁅d,a+b+d⁆-⁅d,e⁆ := by + simp only [total,lie_add,lie_self]; abel + _=0 := by rw [h.central d (by simp),dK h,h.de]; abel + +theorem cP (h : Relations a b c d e f) : ⁅c,d+c+f⁆=0 := by + calc + _=⁅c,total a b c d e f⁆-⁅c,b+c+e⁆+⁅a,c⁆ := by + simp only [total,lie_add,lie_self] + rw [←lie_skew a c] + abel + _=0 := by rw [h.central c (by simp),h.cL,h.ac]; abel + +theorem fP (h : Relations a b c d e f) : ⁅f,d+c+f⁆=0 := by + have hh := lie_self (d+c+f) + rw [add_lie,add_lie,dP h,cP h] at hh + simpa only [zero_add] using hh + +theorem matrix_self (i : Fin 4) : matrix a b c d e f i i=0 := by + fin_cases i <;> rfl + +theorem matrix_symm (i j : Fin 4) : matrix a b c d e f i j=matrix a b c d e f j i := by + fin_cases i <;> fin_cases j <;> rfl + +theorem matrix_disjoint_0 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (0:Fin 4)≠k) (hil : (0:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 0 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint_1 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (1:Fin 4)≠k) (hil : (1:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 1 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint_2 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (2:Fin 4)≠k) (hil : (2:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 2 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint_3 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (3:Fin 4)≠k) (hil : (3:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 3 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint (h : Relations a b c d e f) (i j k l : Fin 4) + (hik : i≠k) (hil : i≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f i j,matrix a b c d e f k l⁆=0 := by + fin_cases i + · exact matrix_disjoint_0 h j k l hik hil hjk hjl + · exact matrix_disjoint_1 h j k l hik hil hjk hjl + · exact matrix_disjoint_2 h j k l hik hil hjk hjl + · exact matrix_disjoint_3 h j k l hik hil hjk hjl + +theorem matrix_three_0 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (0:Fin 4)≠j) (hik : (0:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 0 j,matrix a b c d e f 0 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three_1 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (1:Fin 4)≠j) (hik : (1:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 1 j,matrix a b c d e f 1 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three_2 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (2:Fin 4)≠j) (hik : (2:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 2 j,matrix a b c d e f 2 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three_3 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (3:Fin 4)≠j) (hik : (3:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 3 j,matrix a b c d e f 3 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three (h : Relations a b c d e f) (i j k : Fin 4) + (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + ⁅matrix a b c d e f i j,matrix a b c d e f i k+matrix a b c d e f j k⁆=0 := by + fin_cases i + · exact matrix_three_0 h j k hij hik hjk + · exact matrix_three_1 h j k hij hik hjk + · exact matrix_three_2 h j k hij hik hjk + · exact matrix_three_3 h j k hij hik hjk + +end BraidSix + +namespace T4Basic +open BraidSix + +def a : T4 := t 0 1 +def b : T4 := t 1 2 +def c : T4 := t 2 3 +def d : T4 := t 0 2 +def e : T4 := t 1 3 +def f : T4 := t 0 3 + + theorem induction {P : T4 → Prop} (hz : P 0) (ht : ∀ i j,P (t i j)) + (ha : ∀ p q,P p → P q → P (p+q)) (hs : ∀ (r : ℚ) p,P p → P (r • p)) + (hl : ∀ p q,P p → P q → P ⁅p,q⁆) (p : T4) : P p := by + induction p using Submodule.Quotient.induction_on with | _ p => + induction p using freeLie_induction with + | h0 => exact hz + | hg ij => + have hh : (FreeLieAlgebra.of ℚ ij : BraidFree)=chord ij.val.1 ij.val.2 := by + simp only [chord,dite_eq_left ij.property] + rw [hh] + exact ht _ _ + | ha p q hp hq => exact ha _ _ hp hq + | hs r p hp => exact hs r _ hp + | hl p q hp hq => exact hl _ _ hp hq + + theorem hom_ext {M : Type*} [LieRing M] [LieAlgebra ℚ M] {F G : T4 →ₗ⁅ℚ⁆ M} + (h : ∀ i j,F (t i j)=G (t i j)) : F=G := by + apply LieHom.ext + intro p + induction p using induction with + | hz => simp + | ht i j => exact h i j + | ha p q hp hq => simp only [map_add,hp,hq] + | hs r p hp => simp only [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] + + theorem matrix_t (i j : Fin 4) : matrix a b c d e f i j=t i j := by + fin_cases i <;> fin_cases j <;> rfl + + theorem central_a : ⁅a,total a b c d e f⁆=0 := by + have h₁ := t_three 0 1 2 (by decide) (by decide) (by decide) + have h₂ := t_three 0 1 3 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 0 1 2 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 0 1,t 0 2+t 1 2⁆+⁅t 0 1,t 0 3+t 1 3⁆+⁅t 0 1,t 2 3⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_b : ⁅b,total a b c d e f⁆=0 := by + have h₁ := t_three 1 2 0 (by decide) (by decide) (by decide) + have h₂ := t_three 1 2 3 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 1 2 0 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 1 2,t 1 0+t 2 0⁆+⁅t 1 2,t 1 3+t 2 3⁆+⁅t 1 2,t 0 3⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 1 0,t_comm 2 0] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_c : ⁅c,total a b c d e f⁆=0 := by + have h₁ := t_three 2 3 0 (by decide) (by decide) (by decide) + have h₂ := t_three 2 3 1 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 2 3 0 1 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 2 3,t 2 0+t 3 0⁆+⁅t 2 3,t 2 1+t 3 1⁆+⁅t 2 3,t 0 1⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 2 0,t_comm 2 1,t_comm 3 0,t_comm 3 1] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_d : ⁅d,total a b c d e f⁆=0 := by + have h₁ := t_three 0 2 1 (by decide) (by decide) (by decide) + have h₂ := t_three 0 2 3 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 0 2 1 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 0 2,t 0 1+t 2 1⁆+⁅t 0 2,t 0 3+t 2 3⁆+⁅t 0 2,t 1 3⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 2 1] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_e : ⁅e,total a b c d e f⁆=0 := by + have h₁ := t_three 1 3 0 (by decide) (by decide) (by decide) + have h₂ := t_three 1 3 2 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 1 3 0 2 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 1 3,t 1 0+t 3 0⁆+⁅t 1 3,t 1 2+t 3 2⁆+⁅t 1 3,t 0 2⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 1 0,t_comm 3 0,t_comm 3 2] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_f : ⁅f,total a b c d e f⁆=0 := by + have h₁ := t_three 0 3 1 (by decide) (by decide) (by decide) + have h₂ := t_three 0 3 2 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 0 3 1 2 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 0 3,t 0 1+t 3 1⁆+⁅t 0 3,t 0 2+t 3 2⁆+⁅t 0 3,t 1 2⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 3 1,t_comm 3 2] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central (p : T4) : ⁅total a b c d e f,p⁆=0 := by + induction p using induction with + | hz => exact lie_zero _ + | ht i j => + rw [←matrix_t i j] + have ha := commute_symm central_a + have hb := commute_symm central_b + have hc := commute_symm central_c + have hd := commute_symm central_d + have he := commute_symm central_e + have hf := commute_symm central_f + fin_cases i <;> fin_cases j <;> simp_all [matrix] + | ha p q hp hq => rw [lie_add,hp,hq,add_zero] + | hs r p hp => rw [lie_smul,hp,smul_zero] + | hl p q hp hq => rw [leibniz_lie,hp,hq,zero_lie,lie_zero,add_zero] + + theorem relations : Relations a b c d e f := by + constructor + · intro u _; exact commute_symm (central u) + · exact t_disjoint 0 1 2 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + · exact t_disjoint 0 2 1 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + · have h := t_three 0 1 2 (by decide) (by decide) (by decide) + change ⁅t 0 1,t 0 1+t 1 2+t 0 2⁆=0 + simp only [lie_add,lie_self] at h ⊢ + rw [add_comm] at h + simpa only [zero_add] using h + · have h := t_three 1 2 0 (by decide) (by decide) (by decide) + simpa only [a,b,d,lie_add,lie_self,add_zero,t_comm 1 0,t_comm 2 0] using h + · have h := t_three 1 2 3 (by decide) (by decide) (by decide) + change ⁅t 1 2,t 1 2+t 2 3+t 1 3⁆=0 + simp only [lie_add,lie_self] at h ⊢ + rw [add_comm] at h + simpa only [zero_add] using h + · have h := t_three 2 3 1 (by decide) (by decide) (by decide) + simpa only [b,c,e,lie_add,lie_self,add_zero,t_comm 2 1,t_comm 3 1] using h + +end T4Basic + +namespace TangentBraid +open FreeDerivations BraidSix +variable {R M : Type*} [CommRing R] [LieRing M] [LieAlgebra R M] + +structure Data (a b c d e f A B C D E H I J P Q : M) : Prop where + base : BraidSix.Relations a b c d e f + central : ∀ u : M,⁅total a b c d e f,u⁆=0 + aD : ⁅a,D⁆=0 + bB : ⁅b,B⁆=0 + cE : ⁅c,E⁆=0 + KA : ⁅a+b+d,A⁆=0 + LC : ⁅b+c+e,C⁆=0 + special_d : ⁅b,A⁆+⁅d,A+H⁆=0 + special_e : ⁅c,C⁆+⁅e,C+I⁆=0 + cyclic : C+I=J + pentagon : D+E=A+B+C + permuted : P+Q= -H+B+J + dP : ⁅d,P⁆=0 + eQ : ⁅e,Q⁆=0 + +variable {a b c d e f A B C D E H I J P Q : M} + + theorem crossing {a b h k p q : M} (hab : ⁅a,b⁆=0) + (hk : k-h=p+q) (hap : ⁅a,p⁆=0) (hbq : ⁅b,q⁆=0) : + ⁅⁅a,h⁆,b⁆+⁅a,⁅b,k⁆⁆=0 := by + calc + _=⁅a,⁅b,k-h⁆⁆ := by + rw [lie_sub,lie_sub,leibniz_lie a b h,hab,zero_lie,zero_add,←lie_skew b ⁅a,h⁆] + abel + _=0 := by + rw [hk,lie_add,lie_add,hbq,lie_zero,add_zero,leibniz_lie,hab,hap,zero_lie,lie_zero,add_zero] + + theorem inner_pair {a b h : M} (hab : ⁅a,b⁆=0) : + ⁅⁅a,h⁆,b⁆+⁅a,⁅b,h⁆⁆=0 := by + rw [leibniz_lie a b h,hab,zero_lie,zero_add,←lie_skew b ⁅a,h⁆] + abel + + theorem commute_lie {a b h : M} (ha : ⁅a,h⁆=0) (hb : ⁅b,h⁆=0) : ⁅⁅a,b⁆,h⁆=0 := by + rw [lie_lie,ha,hb,lie_zero,lie_zero,sub_self] + + def va : M := 0 + def vb (b A : M) : M := ⁅b,A⁆ + def vc (c D : M) : M := ⁅c,D⁆ + def vd (b A : M) : M := -⁅b,A⁆ + def ve (b e A D E : M) : M := ⁅b+e,D+E⁆-⁅b,A⁆ + def vf (b c e A D E : M) : M := -vc c D-ve b e A D E + + theorem vd_tangent (h : Data a b c d e f A B C D E H I J P Q) : vd b A=⁅d,A+H⁆ := by + exact neg_eq_of_add_eq_zero_right h.special_d + + theorem bC (h : Data a b c d e f A B C D E H I J P Q) : ⁅b,C⁆=⁅e,I⁆ := by + apply sub_eq_zero.mp + calc + _=⁅b+c+e,C⁆-(⁅c,C⁆+⁅e,C+I⁆) := by simp only [add_lie,lie_add]; abel + _=0 := by rw [h.LC,h.special_e,sub_self] + + theorem ve_tangent (h : Data a b c d e f A B C D E H I J P Q) : + ve b e A D E=⁅e,A+B+C+I⁆ := by + rw [ve,h.pentagon] + simp only [add_lie,lie_add] + rw [h.bB,bC h] + abel + + theorem gauge_difference (h : Data a b c d e f A B C D E H I J P Q) : + (A+B+C+I)-(A+H)=P+Q := by + rw [h.permuted,←h.cyclic] + abel + + theorem crossing_de (h : Data a b c d e f A B C D E H I J P Q) : + ⁅vd b A,e⁆+⁅d,ve b e A D E⁆=0 := by + rw [vd_tangent h,ve_tangent h] + exact crossing h.base.de (gauge_difference h) h.dP h.eQ + + theorem velocity_K : (0:M)+vb b A+vd b A=0 := by simp only [vb,vd,zero_add,add_neg_cancel] + theorem velocity_L (h : Data a b c d e f A B C D E H I J P Q) : + vb b A+vc c D+ve b e A D E=⁅b+c+e,A+B⁆ := by + calc + _=⁅b+c+e,D+E⁆ := by simp only [vb,vc,ve,add_lie,lie_add,h.cE]; abel + _=⁅b+c+e,A+B⁆ := by rw [h.pentagon,lie_add,h.LC,add_zero] + + theorem velocity_b (h : Data a b c d e f A B C D E H I J P Q) : + vb b A=⁅b,A+B⁆ := by simp only [vb,lie_add,h.bB,add_zero] + theorem velocity_c (h : Data a b c d e f A B C D E H I J P Q) : + vc c D=⁅c,A+B⁆+⁅c,C⁆ := by + have hh := congrArg (fun u => ⁅c,u⁆) h.pentagon + simpa only [vc,lie_add,h.cE,add_zero] using hh + + theorem velocity_total : + total (0:M) (vb b A) (vc c D) (vd b A) (ve b e A D E) (vf b c e A D E)=0 := by + simp only [total,vb,vc,vd,vf] + abel + + def ja (a : M) : Jet R M := ⟨a,0⟩ + def jb (b A : M) : Jet R M := ⟨b,vb b A⟩ + def jc (c D : M) : Jet R M := ⟨c,vc c D⟩ + def jd (d b A : M) : Jet R M := ⟨d,vd b A⟩ + def je (e b A D E : M) : Jet R M := ⟨e,ve b e A D E⟩ + def jf (f b c e A D E : M) : Jet R M := ⟨f,vf b c e A D E⟩ + + theorem relations (h : Data a b c d e f A B C D E H I J P Q) : + BraidSix.Relations (ja (R:=R) a) (jb b A) (jc c D) (jd d b A) + (je e b A D E) (jf f b c e A D E) := by + constructor + · intro u _ + apply Jet.ext + · change ⁅u.base,total a b c d e f⁆=0 + exact commute_symm (h.central u.base) + · change ⁅u.velocity,total a b c d e f⁆+⁅u.base, + total 0 (vb b A) (vc c D) (vd b A) (ve b e A D E) (vf b c e A D E)⁆=0 + rw [velocity_total,lie_zero,add_zero] + exact commute_symm (h.central u.velocity) + · apply Jet.ext + · exact h.base.ac + · change ⁅(0:M),c⁆+⁅a,⁅c,D⁆⁆=0 + rw [zero_lie,zero_add,leibniz_lie,h.base.ac,h.aD,zero_lie,lie_zero,add_zero] + · apply Jet.ext + · exact h.base.de + · exact crossing_de h + · apply Jet.ext + · exact h.base.aK + · change ⁅(0:M),a+b+d⁆+⁅a,(0:M)+vb b A+vd b A⁆=0 + rw [velocity_K,zero_lie,lie_zero,add_zero] + · apply Jet.ext + · exact h.base.bK + · change ⁅⁅b,A⁆,a+b+d⁆+⁅b,(0:M)+vb b A+vd b A⁆=0 + rw [velocity_K,lie_zero,add_zero] + exact commute_lie h.base.bK (commute_symm h.KA) + · apply Jet.ext + · exact h.base.bL + · change ⁅vb b A,b+c+e⁆+⁅b,vb b A+vc c D+ve b e A D E⁆=0 + rw [velocity_L h,velocity_b h] + exact inner_pair h.base.bL + · apply Jet.ext + · exact h.base.cL + · change ⁅vc c D,b+c+e⁆+⁅c,vb b A+vc c D+ve b e A D E⁆=0 + rw [velocity_L h,velocity_c h,add_lie] + have hz := commute_lie h.base.cL (commute_symm h.LC) + rw [hz,add_zero] + exact inner_pair h.base.cL + +end TangentBraid + +namespace TriangleSolutions +variable {M : Type} [LieRing M] [LieAlgebra ℚ M] +variable {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 rw [hsum] + exact eval_central_shift u (-u-v) (u+v+w) hu hneg hqn (by omega) + +include hqn hn hu hv in +theorem shift_v : eval v w q=eval v (-u-v) q := by + have hsum : w=(-u-v)+(u+v+w) := by abel + have hneg : ⁅-u-v,u+v+w⁆=0 := by rw [sub_lie,neg_lie,hu,hv,neg_zero,sub_zero] + conv_lhs => rw [hsum] + exact eval_central_shift v (-u-v) (u+v+w) hv hneg hqn (by omega) + +include hq hqn hn hu hv in +theorem cyclic : eval u v q+eval v w q=eval u w q := by + have h := solution_three hq u v + rw [solution_swap hq (-u-v) u,←shift_u hqn hn u v w hu hv, + ←shift_v hqn hn u v w hu hv] at h + exact eq_of_sub_eq_zero (by simpa only [sub_eq_add_neg] using h) + +include hq hqn hn hu hv in +theorem special : ⁅v,eval u v q⁆+⁅w,eval u v q+eval v w q⁆=0 := by + have h := Differentiation.special_identity hq hqn hn v u + have hc : -v-u= -u-v := by abel + rw [hc,←shift_u hqn hn u v w hu hv] at h + have hk : ⁅u+v+w,eval u w q⁆=0 := + eval_commutes u w (u+v+w) (commute_symm hu) (commute_symm (third u v w hu hv)) q + have he : ⁅-u-v,eval u w q⁆=⁅w,eval u w q⁆ := by + have hh : -u-v=w-(u+v+w) := by abel + rw [hh,sub_lie,hk,sub_zero] + rw [he] at h + rw [cyclic hq hqn hn u v w hu hv] + exact h + +end TriangleSolutions + +namespace T4SolutionData +open T4Basic + +def A (q : L) : T4 := eval a b q +def B (q : L) : T4 := eval (a+d) (e+c) q +def C (q : L) : T4 := eval b c q +def D (q : L) : T4 := eval (d+b) c q +def E (q : L) : T4 := eval a (b+e) q +def H (q : L) : T4 := eval b d q +def I (q : L) : T4 := eval c e q +def J (q : L) : T4 := eval b e q +def P (q : L) : T4 := eval (a+b) e q +def Q (q : L) : T4 := eval d (b+c) q + + theorem pentagon {q : L} (hq : q∈W) : D q+E q=A q+B q+C q := by + calc + _=E q+D q := add_comm _ _ + _=C q+B q+A q := hq.2.2 + _=_ := by abel + + theorem permuted {q : L} (hq : q∈W) : P q+Q q= -H q+B q+J q := by + have hh := congrArg (t4Rename (Equiv.swap (1:Fin 4) 2)) hq.2.2 + simp only [map_add,map_eval,t4Rename_t] at hh + change eval d (b+c) q+eval (a+b) e q=eval b e q+eval (d+a) (c+e) q+eval d b q at hh + rw [add_comm d a,add_comm c e,solution_swap hq d b] at hh + calc + _=Q q+P q := add_comm _ _ + _=J q+B q+(-H q) := hh + _=_ := by abel + + theorem data {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 fin_cases j <;> rfl + +def lift (hq : q∈W) (hqn : q∈Ln n) (hn : 2 + BraidSix.matrix_disjoint (TangentBraid.relations (data hq hqn hn)) i j k l hik hil hjk hjl) + (BraidSix.matrix_three (TangentBraid.relations (data hq hqn hn))) + +@[simp] theorem lift_t (hq : q∈W) (hqn : q∈Ln n) (hn : 2 simpa only [DeligneDrinfeld.UniversalEmbedding.Tree.eval,treeDegree_leaf] using WeightedWord.generator (wt:=wt) a + | node a b ha hb => simpa only [DeligneDrinfeld.UniversalEmbedding.Tree.eval,treeDegree_node] using WeightedWord.bracket ha hb + + theorem word_tree {wt : α → ℕ} {n : ℕ} {p : FreeLieAlgebra ℝ α} (hp : WeightedWord wt n p) : + ∃ t : DeligneDrinfeld.UniversalEmbedding.Tree α,treeDegree wt t=n ∧ t.eval=p := by + induction hp with + | generator a => exact ⟨.leaf a,by simp [DeligneDrinfeld.UniversalEmbedding.Tree.eval]⟩ + | bracket hp hq ihp ihq => + obtain ⟨t,ht,rfl⟩ := ihp + obtain ⟨u,hu,rfl⟩ := ihq + exact ⟨.node t u,by simp [ht,hu,DeligneDrinfeld.UniversalEmbedding.Tree.eval]⟩ + + theorem piece_eq (wt : α → ℕ) (n : ℕ) : weightPiece wt n=homogeneousLie (R:=ℝ) wt n := by + apply le_antisymm + · apply Submodule.span_le.mpr + intro p hp + exact Submodule.subset_span (word_tree hp) + · apply Submodule.span_le.mpr + rintro p ⟨t,ht,rfl⟩ + apply Submodule.subset_span + exact ht ▸ tree_word wt t + + theorem embed_homogeneous {wt : α → ℕ} {n : ℕ} {p : FreeLieAlgebra ℝ α} + (hp : p∈weightPiece wt n) : DeligneDrinfeld.AssociativeElimination.embed p∈ + DeligneDrinfeld.WordGrading.homogeneous wt n := by + rw [piece_eq] at hp + exact homogeneousLie_embed hp + + theorem bracket_mem {wt : α → ℕ} {n m : ℕ} {a b : FreeLieAlgebra ℝ α} + (ha : a∈weightPiece wt n) (hb : b∈weightPiece wt m) : ⁅a,b⁆∈weightPiece wt (n+m) := by + apply Submodule.span_induction (p:=fun a _ => ⁅a,b⁆∈weightPiece wt (n+m)) ?_ ?_ ?_ ?_ ha + · intro a ha + apply Submodule.span_induction (p:=fun b _ => ⁅a,b⁆∈weightPiece wt (n+m)) ?_ ?_ ?_ ?_ hb + · intro b hb; exact Submodule.subset_span (WeightedWord.bracket ha hb) + · rw [lie_zero]; exact Submodule.zero_mem _ + · intro a b _ _ ha hb; rw [lie_add]; exact Submodule.add_mem _ ha hb + · intro s b _ hb; rw [lie_smul]; exact Submodule.smul_mem _ s hb + · rw [zero_lie]; exact Submodule.zero_mem _ + · intro a b _ _ ha hb; rw [add_lie]; exact Submodule.add_mem _ ha hb + · intro s a _ ha; rw [smul_lie]; exact Submodule.smul_mem _ s ha + + theorem map_mem {β : Type*} (f : FreeLieAlgebra ℝ α →ₗ⁅ℝ⁆ FreeLieAlgebra ℝ β) + (wa : α → ℕ) (wb : β → ℕ) (hf : ∀ a,f (FreeLieAlgebra.of ℝ a)∈weightPiece wb (wa a)) + {n : ℕ} {p : FreeLieAlgebra ℝ α} (hp : p∈weightPiece wa n) : f p∈weightPiece wb n := by + have hw : ∀ n p,WeightedWord wa n p → f p∈weightPiece wb n := by + intro n p hp + induction hp with + | generator a => exact hf a + | bracket hp hq ihp ihq => rw [LieHom.map_lie]; exact bracket_mem ihp ihq + apply Submodule.span_induction (p:=fun p _ => f p∈weightPiece wb n) ?_ ?_ ?_ ?_ hp + · intro p hp; exact hw n p hp + · rw [map_zero]; exact Submodule.zero_mem _ + · intro p q _ _ hp hq; rw [map_add]; exact Submodule.add_mem _ hp hq + · intro s p _ hp; rw [map_smul]; exact Submodule.smul_mem _ s hp + + theorem eval_mem {n : ℕ} {p : L} (hp : p∈Ln n) {a b : L} (ha : a∈Ln 1) (hb : b∈Ln 1) : + eval a b p∈Ln n := by + apply map_mem (eval a b) (fun _ => 1) (fun _ => 1) (fun i => ?_) hp + cases i <;> simpa [eval] using (by assumption : _∈Ln 1) + + theorem x_mem : x∈Ln 1 := Submodule.subset_span (WeightedWord.generator _) + theorem y_mem : y∈Ln 1 := Submodule.subset_span (WeightedWord.generator _) + +end RealDeligneDrinfeld.WeightBridge + +namespace DeligneDrinfeld.UnitConjugation +variable {R A : Type*} [CommRing R] [Ring A] [Algebra R A] + +def hom (u : Aˣ) : A →ₐ[R] A where + toFun a := (u:A)*a*((u⁻¹:Aˣ):A) + map_zero' := by simp only [mul_zero,zero_mul] + map_one' := by simp only [mul_one,Units.mul_inv] + map_add' a b := by rw [mul_add,add_mul] + map_mul' a b := by + simp only [mul_assoc] + rw [←mul_assoc (((u⁻¹:Aˣ):A)) (u:A),Units.inv_mul,one_mul] + commutes' r := by + rw [←Algebra.commutes,mul_assoc,Units.mul_inv,mul_one] + +@[simp] theorem hom_apply (u : Aˣ) (a : A) : hom (R:=R) u a=(u:A)*a*((u⁻¹:Aˣ):A) := rfl + +@[simp] theorem inverse (u : Aˣ) (a : A) : hom (R:=R) u⁻¹ (hom (R:=R) u a)=a := by + simp only [hom_apply,inv_inv,mul_assoc] + rw [Units.inv_mul_cancel_left,Units.inv_mul,mul_one] + +@[simp] theorem mul_apply (u v : Aˣ) (a : A) : hom (R:=R) (u*v) a=hom (R:=R) u (hom (R:=R) v a) := by + simp only [hom_apply,Units.val_mul,mul_inv_rev,mul_assoc] + +theorem natural {B : Type*} [Ring B] [Algebra R B] (f : A →ₐ[R] B) (u : Aˣ) (a : A) : + f (hom (R:=R) u a)=hom (R:=R) (Units.map f.toMonoidHom u) (f a) := by + simp only [hom_apply,map_mul] + rfl + +end DeligneDrinfeld.UnitConjugation + +namespace DeligneDrinfeld.KZCollar +open FinitePicard +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem associator_swap (F : NilpotentFiltration A) {X Y : A} + (hX : X∈F.space 1) (hY : Y∈F.space 1) : + associator F Y X=Ring.inverse (associator F X Y) := by + unfold associator rightSolution + norm_num only [show (1:ℝ)-1/2=1/2 by norm_num] + rw [Ring.inverse_mul (Or.inr (normalizedSolution_isUnit F hX hY (1/2))), + Ring.inverse_inverse (normalizedSolution_isUnit F hY hX (1/2))] + +end DeligneDrinfeld.KZCollar + +namespace DeligneDrinfeld.KZSwap + +section +open CutoffDepth CutoffKZ KZComparison + +def swap (N : ℕ) : Q ℝ N →ₐ[ℝ] Q ℝ N := + NilpotentFreeLift.eval (weight N) (fun b => gen N (!b)) (fun b => gen_weight N (!b)) +@[simp] theorem swap_gen (N : ℕ) (b : Bool) : swap N (gen N b)=gen N (!b) := + NilpotentFreeLift.eval_gen _ _ _ b + +theorem swap_twice (N : ℕ) (u : Q ℝ N) : swap N (swap N u)=u := by + have hh : (swap N).comp (swap N)=AlgHom.id ℝ (Q ℝ N) := by + apply TruncatedSubstitution.hom_ext N + intro b + change swap N (swap N (gen N b))=gen N b + rw [swap_gen,swap_gen,Bool.not_not] + exact AlgHom.congr_fun hh u + +theorem positive_swap (N : ℕ) : Units.map (swap N).toMonoidHom (positive N)=(positive N)⁻¹ := by + apply Units.ext + change swap N (positive N:Q ℝ N)=((positive N)⁻¹:(Q ℝ N)ˣ) + rw [positive_val,KZCollar.map_associator (swap N) (weight N) (weight N) rfl + (gen_weight N false) (gen_weight N true),swap_gen,swap_gen] + simp only [Bool.not_false, Bool.not_true] + rw [KZCollar.associator_swap (weight N) (gen_weight N false) (gen_weight N true), + ←positive_val,Ring.inverse_unit] + +theorem negative_swap (N : ℕ) : Units.map (swap N).toMonoidHom (negative N)=(negative N)⁻¹ := by + apply Units.ext + change swap N (negative N:Q ℝ N)=((negative N)⁻¹:(Q ℝ N)ˣ) + rw [negative_val,KZCollar.map_associator (swap N) (weight N) (weight N) rfl + ((weight N).space 1|>.neg_mem (gen_weight N false)) + ((weight N).space 1|>.neg_mem (gen_weight N true)),map_neg,map_neg,swap_gen,swap_gen] + simp only [Bool.not_false, Bool.not_true] + rw [KZCollar.associator_swap (weight N) + ((weight N).space 1|>.neg_mem (gen_weight N false)) + ((weight N).space 1|>.neg_mem (gen_weight N true)),←negative_val,Ring.inverse_unit] + +open ConjugateComparison + theorem transport_swap (N : ℕ) (P : (Q ℝ N)ˣ) + (hP : (P:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hdual : Units.map (swap N).toMonoidHom P=P⁻¹) (u : Q ℝ N) : + swap N (transport N P hP u)=UnitConjugation.hom (R := ℝ) P (transport N P hP (swap N u)) := by + have hd : swap N (P:Q ℝ N)=((P⁻¹:(Q ℝ N)ˣ):Q ℝ N) := congrArg Units.val hdual + have hi : swap N ((P⁻¹:(Q ℝ N)ˣ):Q ℝ N)=(P:Q ℝ N) := by + have hh := congrArg (fun v => ((v⁻¹:(Q ℝ N)ˣ):Q ℝ N)) hdual + rw [←map_inv] at hh + change swap N (((P⁻¹:(Q ℝ N)ˣ):Q ℝ N))=(((P⁻¹)⁻¹:(Q ℝ N)ˣ):Q ℝ N) at hh + simpa only [inv_inv] using hh + have he : (swap N).comp (transport N P hP).toAlgHom= + (UnitConjugation.hom (R := ℝ) P).comp ((transport N P hP).toAlgHom.comp (swap N)) := by + apply TruncatedSubstitution.hom_ext N + intro b + change swap N (transport N P hP (gen N b))= + UnitConjugation.hom (R := ℝ) P (transport N P hP (swap N (gen N b))) + rw [ConjugateCoalgebra.transport_cutoff_gen,swap_gen,ConjugateCoalgebra.transport_cutoff_gen] + cases b + · change swap N (gen N false)=(P:Q ℝ N)* + (((P⁻¹:(Q ℝ N)ˣ):Q ℝ N)*gen N true*(P:Q ℝ N))*((P⁻¹:(Q ℝ N)ˣ):Q ℝ N) + rw [swap_gen] + simp only [mul_assoc,Units.mul_inv_cancel_left,Units.mul_inv,mul_one,Bool.not_false] + · change swap N (((P⁻¹:(Q ℝ N)ˣ):Q ℝ N)*gen N true*(P:Q ℝ N))=_ + rw [map_mul,map_mul,hi,hd,swap_gen] + rfl + exact AlgHom.congr_fun he u + + theorem theta_swap (N : ℕ) (P V : (Q ℝ N)ˣ) + (hP : (P:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hV : (V:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hdP : Units.map (swap N).toMonoidHom P=P⁻¹) + (hdV : Units.map (swap N).toMonoidHom V=V⁻¹) (u : Q ℝ N) : + swap N (ConjugateComparison.theta N P V hP hV u)= + UnitConjugation.hom (R := ℝ) (unitArrow N P V hP hV) + (ConjugateComparison.theta N P V hP hV (swap N u)) := by + obtain ⟨v,rfl⟩ := (transport N P hP).surjective u + rw [theta_transport,transport_swap N V hV hdV,transport_swap N P hP hdP] + rw [show ConjugateComparison.theta N P V hP hV + (UnitConjugation.hom (R:=ℝ) P (transport N P hP (swap N v))) = + UnitConjugation.hom (R:=ℝ) (Units.map (ConjugateComparison.theta N P V hP hV).toMonoidHom P) + (ConjugateComparison.theta N P V hP hV (transport N P hP (swap N v))) from + UnitConjugation.natural (ConjugateComparison.theta N P V hP hV).toAlgHom P _] + rw [theta_transport,←UnitConjugation.mul_apply] + have he : unitArrow N P V hP hV*Units.map (ConjugateComparison.theta N P V hP hV).toMonoidHom P=V := by + unfold unitArrow + group + rw [he] + + theorem arrow_swap (N : ℕ) : Units.map (swap N).toMonoidHom (arrow N)=(arrow N)⁻¹ := by + let P := positive N + let V := negative N + let U := arrow N + let θ := KZComparison.theta N + have hθ : Units.map (swap N).toMonoidHom (Units.map θ.toMonoidHom P)= + U*Units.map θ.toMonoidHom (Units.map (swap N).toMonoidHom P)*U⁻¹ := by + apply Units.ext + exact theta_swap N P V (positive_weight N) (negative_weight N) + (positive_swap N) (negative_swap N) (P:Q ℝ N) + have he : Units.map (swap N).toMonoidHom U= + V⁻¹*(U*(Units.map θ.toMonoidHom P)⁻¹*U⁻¹)⁻¹ := by + change Units.map (swap N).toMonoidHom + (V*(Units.map θ.toMonoidHom P)⁻¹)=_ + rw [map_mul,map_inv,negative_swap,hθ,positive_swap,map_inv] + rw [he] + change V⁻¹*((V*(Units.map θ.toMonoidHom P)⁻¹)*(Units.map θ.toMonoidHom P)⁻¹* + (V*(Units.map θ.toMonoidHom P)⁻¹)⁻¹)⁻¹=(V*(Units.map θ.toMonoidHom P)⁻¹)⁻¹ + group + +end + +open CutoffDepth CutoffKZ KZComparison + + theorem category_swap (N : ℕ) (p q : Bool) (u : Q ℝ N) : + swap N ((category N).S p q u)=(category N).S (!p) (!q) (swap N u) := by + have hθ := theta_swap N (positive N) (negative N) (positive_weight N) (negative_weight N) + (positive_swap N) (negative_swap N) u + change swap N (theta N u)=(arrow N:Q ℝ N)*theta N (swap N u)*((arrow N)⁻¹:(Q ℝ N)ˣ) at hθ + have hU : swap N (arrow N:Q ℝ N)=((arrow N)⁻¹:(Q ℝ N)ˣ) := congrArg Units.val (arrow_swap N) + have hI : swap N (((arrow N)⁻¹:(Q ℝ N)ˣ):Q ℝ N)=(arrow N:Q ℝ N) := by + have h := congrArg (fun v => ((v⁻¹:(Q ℝ N)ˣ):Q ℝ N)) (arrow_swap N) + rw [←map_inv] at h + change swap N (((arrow N)⁻¹:(Q ℝ N)ˣ):Q ℝ N)=_ at h + simpa only [inv_inv] using h + cases p <;> cases q <;> + simp only [category,GaugeAutomorphism.data,GaugeAutomorphism.map_apply,AlgEquiv.restrictScalars_apply,frames, + Bool.not_false,Bool.not_true,Units.val_one,inv_one,mul_one,one_mul,map_mul, + hθ,hU,hI,mul_assoc,Units.inv_mul_cancel_left,Units.inv_mul,mul_one] + + theorem value_swap (N : ℕ) : swap N (value N)= -value N := by + have h := OperatorLog.logarithm_natural (category N).N + ((category N).S false true-1) ((category N).S true false-1) + ((swap N).toLinearMap.restrictScalars ℚ) (by + intro u + change swap N ((category N).S false true u-u)=(category N).S true false (swap N u)-swap N u + rw [map_sub,category_swap] + rfl) (1:Q ℝ N) + change swap N (value N)=LogCategory.delta (category N) true false (swap N 1) at h + rw [map_one] at h + have hh := LogCategory.unit_cocycle (category N) false true false + rw [LogCategory.delta_one_loop] at hh + exact h.trans (eq_neg_of_add_eq_zero_left hh.symm) + +end DeligneDrinfeld.KZSwap + +namespace DeligneDrinfeld +namespace FinitePicard + +section +open MeasureTheory Set Filter +open scoped Topology +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +theorem parameter_integral_derivative {f f' : ℝ → ℝ → E} (hf : Continuous f.uncurry) + (hf' : Continuous f'.uncurry) {c d x a b : ℝ} (hx : x ∈ Ioo c d) + (hd : ∀ s ∈ Ioo c d, ∀ t ∈ uIcc a b, HasDerivAt (fun s => f s t) (f' s t) s) : + HasDerivAt (fun s => ∫ t in a..b, f s t) (∫ t in a..b, f' x t) x := by + obtain ⟨C,hC⟩ := (isCompact_Icc.prod (isCompact_uIcc (a:=a) (b:=b))).exists_bound_of_continuousOn + (hf'.continuousOn : ContinuousOn f'.uncurry (Icc c d ×ˢ uIcc a b)) + apply (intervalIntegral.hasDerivAt_integral_of_dominated_loc_of_deriv_le + (s:=Ioo c d) (bound:=fun _ => C) (Ioo_mem_nhds hx.1 hx.2) _ _ _ _ + (intervalIntegrable_const) _).2 + · exact Eventually.of_forall (fun s => (hf.uncurry_left s).aestronglyMeasurable) + · exact (hf.uncurry_left x).intervalIntegrable a b + · exact (hf'.uncurry_left x).aestronglyMeasurable + · exact ae_of_all _ (fun t ht s hs => hC (s,t) ⟨⟨hs.1.le,hs.2.le⟩,uIoc_subset_uIcc ht⟩) + · exact ae_of_all _ (fun t ht s hs => hd s hs t (uIoc_subset_uIcc ht)) + +end + +section +open MeasureTheory Set +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def dterm (Ω Ωs : ℝ → ℝ → A) (a : ℝ) : ℕ → ℝ → ℝ → A + | 0 => fun _ _ => 0 + | n+1 => fun s t => ∫ u in a..t, Ωs s u * term (Ω s) a n u + Ω s u * dterm Ω Ωs a n s u + +@[simp] theorem dterm_zero (Ω Ωs : ℝ → ℝ → A) (a s t : ℝ) : dterm Ω Ωs a 0 s t=0 := rfl +@[simp] theorem dterm_base (Ω Ωs : ℝ → ℝ → A) (a s : ℝ) (n : ℕ) : dterm Ω Ωs a n s a=0 := by + cases n <;> simp [dterm] + +theorem continuous_term_parameter {Ω : ℝ → ℝ → A} (hΩ : Continuous Ω.uncurry) (a : ℝ) (n : ℕ) : + Continuous (fun p : ℝ × ℝ => term (Ω p.1) a n p.2) := by + induction n with + | zero => exact continuous_const + | succ n ih => + exact intervalIntegral.continuous_parametric_primitive_of_continuous + (f:=fun s t => Ω s t * term (Ω s) a n t) (hΩ.mul ih) + +theorem continuous_dterm {Ω Ωs : ℝ → ℝ → A} (hΩ : Continuous Ω.uncurry) + (hΩs : Continuous Ωs.uncurry) (a : ℝ) (n : ℕ) : + Continuous (fun p : ℝ × ℝ => dterm Ω Ωs a n p.1 p.2) := by + induction n with + | zero => exact continuous_const + | succ n ih => + exact intervalIntegral.continuous_parametric_primitive_of_continuous + (f:=fun s t => Ωs s t * term (Ω s) a n t + Ω s t * dterm Ω Ωs a n s t) + ((hΩs.mul (continuous_term_parameter hΩ a n)).add (hΩ.mul ih)) + +theorem derivative_term_parameter {Ω Ωs : ℝ → ℝ → A} (hΩ : Continuous Ω.uncurry) + (hΩs : Continuous Ωs.uncurry) {a b c d : ℝ} + (hd : ∀ s ∈ Ioo c d, ∀ t ∈ uIcc a b, HasDerivAt (fun s => Ω s t) (Ωs s t) s) + (n : ℕ) : ∀ s ∈ Ioo c d, ∀ t ∈ uIcc a b, + HasDerivAt (fun s => term (Ω s) a n t) (dterm Ω Ωs a n s t) s := by + induction n with + | zero => exact fun s _ t _ => hasDerivAt_const s 1 + | succ n ih => + intro s hs t ht + apply parameter_integral_derivative + (f:=fun s u => Ω s u *term (Ω s) a n u) + (f':=fun s u => Ωs s u *term (Ω s) a n u + Ω s u * dterm Ω Ωs a n s u) + (hΩ.mul (continuous_term_parameter hΩ a n)) + ((hΩs.mul (continuous_term_parameter hΩ a n)).add (hΩ.mul (continuous_dterm hΩ hΩs a n))) hs + intro v hv u hu + have hu' := uIcc_subset_uIcc_left ht hu + exact (hd v hv u hu').mul (ih v hv u hu') + +end + +open MeasureTheory Set +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] + +theorem dterm_flat_formula {Ω Ωs B : ℝ → ℝ → A} + (hΩ : Continuous Ω.uncurry) (hΩs : Continuous Ωs.uncurry) + {a b s : ℝ} + (hB : ∀ t ∈ uIcc a b, HasDerivAt (B s) (Ωs s t) t) + (hcomm : ∀ t ∈ uIcc a b, Commute (Ω s t) (B s t)) + (n : ℕ) : ∀ t ∈ uIcc a b, + dterm Ω Ωs a (n+1) s t = + B s t * term (Ω s) a n t - term (Ω s) a n t * B s a := by + induction n with + | zero => + intro t ht + simp only [dterm,term_zero,mul_one,mul_zero,add_zero,one_mul] + exact intervalIntegral.integral_eq_sub_of_hasDerivAt + (fun u hu => hB u (uIcc_subset_uIcc_left ht hu)) + ((hΩs.uncurry_left s).intervalIntegrable a t) + | succ n ih => + intro t ht + have hd : ∀ u ∈ uIcc a t, + HasDerivAt (fun u => B s u*term (Ω s) a (n+1) u - term (Ω s) a (n+1) u*B s a) + (Ωs s u * term (Ω s) a (n+1) u + Ω s u * dterm Ω Ωs a (n+1) s u) u := by + intro u hu + have hu' := uIcc_subset_uIcc_left ht hu + have hp := derivative_succ (hΩ.uncurry_left s) a u n + apply ((hB u hu').mul hp |>.sub (hp.mul_const (B s a))).congr_deriv + rw [ih u hu'] + rw [←mul_assoc (B s u) (Ω s u),←(hcomm u hu').eq] + noncomm_ring + have hi := (((hΩs.uncurry_left s).mul (continuous_term (hΩ.uncurry_left s) a (n+1))).add + ((hΩ.uncurry_left s).mul ((continuous_dterm hΩ hΩs a (n+1)).comp + ((continuous_const : Continuous (fun _ : ℝ => s)).prodMk continuous_id)))).intervalIntegrable (μ:=volume) a t + have hh := intervalIntegral.integral_eq_sub_of_hasDerivAt hd hi + simpa only [dterm,term_base,mul_zero,zero_mul,sub_self,sub_zero] using hh + +variable [FiniteDimensional ℝ A] + +theorem derivative_transport_flat (F : NilpotentFiltration A) {Ω Ωs B : ℝ → ℝ → A} + (hΩ : Continuous Ω.uncurry) (hΩs : Continuous Ωs.uncurry) + (hΩm : ∀ s t, Ω s t ∈ F.space 1) + {a b c d s : ℝ} (hs : s ∈ Ioo c d) + (hDs : ∀ v ∈ Ioo c d, ∀ t ∈ uIcc a b, HasDerivAt (fun v => Ω v t) (Ωs v t) v) + (hDt : ∀ t ∈ uIcc a b, HasDerivAt (B s) (Ωs s t) t) + (hcomm : ∀ t ∈ uIcc a b, Commute (Ω s t) (B s t)) : + HasDerivAt (fun s => transport (Ω s) a F.cutoff b) + (B s b * transport (Ω s) a F.cutoff b - transport (Ω s) a F.cutoff b * B s a) s := by + have hp (t : ℝ) : transport (Ω t) a (F.cutoff+1) b=transport (Ω t) a F.cutoff b := by + simp only [transport,Finset.sum_range_succ,last_term_zero F (hΩm t),add_zero] + have hd := HasDerivAt.fun_sum (u:=Finset.range (F.cutoff+2)) + (fun n _ => derivative_term_parameter hΩ hΩs hDs n s hs b right_mem_uIcc) + have hf : (fun v => ∑ n∈Finset.range (F.cutoff+2),term (Ω v) a n b)= + (fun v => transport (Ω v) a F.cutoff b) := by + funext v + exact hp v + rw [hf] at hd + apply hd.congr_deriv + rw [Finset.sum_range_succ'] + simp only [dterm_zero,add_zero] + simp_rw [dterm_flat_formula hΩ hΩs hDt hcomm _ b right_mem_uIcc] + simp only [Finset.sum_sub_distrib,←Finset.mul_sum,←Finset.sum_mul,transport] + +theorem transport_flat_constant (F : NilpotentFiltration A) {Ω Ωs B : ℝ → ℝ → A} + (hΩ : Continuous Ω.uncurry) (hΩs : Continuous Ωs.uncurry) + (hΩm : ∀ s t, Ω s t ∈ F.space 1) + {a b c d u v : ℝ} + (hDs : ∀ s ∈ Ioo c d, ∀ t ∈ uIcc a b, HasDerivAt (fun s => Ω s t) (Ωs s t) s) + (hDt : ∀ s ∈ Ioo c d, ∀ t ∈ uIcc a b, HasDerivAt (B s) (Ωs s t) t) + (hcomm : ∀ s ∈ Ioo c d, ∀ t ∈ uIcc a b, Commute (Ω s t) (B s t)) + (hBa : ∀ s ∈ Ioo c d, B s a=0) (hBb : ∀ s ∈ Ioo c d, B s b=0) + (hu : u ∈ Ioo c d) (hv : v ∈ Ioo c d) : + transport (Ω u) a F.cutoff b=transport (Ω v) a F.cutoff b := by + have hd : ∀ s ∈ Ioo c d, HasDerivAt (fun s => transport (Ω s) a F.cutoff b) 0 s := by + intro s hs + simpa only [hBa s hs,hBb s hs,zero_mul,mul_zero,sub_self] using + derivative_transport_flat F hΩ hΩs hΩm hs hDs (hDt s hs) (hcomm s hs) + exact isOpen_Ioo.is_const_of_deriv_eq_zero isPreconnected_Ioo + (fun s hs => (hd s hs).differentiableAt.differentiableWithinAt) + (fun s hs => (hd s hs).deriv) hu hv + +end FinitePicard +end DeligneDrinfeld + +namespace DeligneDrinfeld.FinitePicard + +section +open MeasureTheory Set Filter +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +theorem term_congr {Ω Θ : ℝ → A} {a b : ℝ} (h : EqOn Ω Θ (uIcc a b)) + (n : ℕ) : ∀ t∈uIcc a b,term Ω a n t=term Θ a n t := by + induction n with + | zero => intros; rfl + | succ n ih => + intro t ht + simp only [term_succ] + apply intervalIntegral.integral_congr + intro u hu + have hu' := uIcc_subset_uIcc_left ht hu + change Ω u*term Ω a n u=Θ u*term Θ a n u + rw [h hu',ih u hu'] + +theorem transport_congr {Ω Θ : ℝ → A} {a b : ℝ} (h : EqOn Ω Θ (uIcc a b)) + (n : ℕ) : transport Ω a n b=transport Θ a n b := by + apply Finset.sum_congr rfl + intro i hi + exact term_congr h i b right_mem_uIcc + +def rectExtend {a b c d : ℝ} (hab : a≤b) (hcd : c≤d) (Ω : ℝ → ℝ → A) (s t : ℝ) : A := + Ω (projIcc c d hcd s) (projIcc a b hab t) + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem rectExtend_eq {a b c d : ℝ} (hab : a≤b) (hcd : c≤d) (Ω : ℝ → ℝ → A) + {s t : ℝ} (hs : s∈Icc c d) (ht : t∈Icc a b) : rectExtend hab hcd Ω s t=Ω s t := by + simp only [rectExtend,projIcc_of_mem hcd hs,projIcc_of_mem hab ht] + +omit [NormedAlgebra ℝ A] in +theorem continuous_rectExtend {a b c d : ℝ} (hab : a≤b) (hcd : c≤d) {Ω : ℝ → ℝ → A} + (hΩ : ContinuousOn Ω.uncurry (Icc c d ×ˢ Icc a b)) : Continuous (rectExtend hab hcd Ω).uncurry := by + apply hΩ.comp_continuous + (((continuous_subtype_val.comp (continuous_projIcc (h:=hcd))).comp continuous_fst).prodMk + ((continuous_subtype_val.comp (continuous_projIcc (h:=hab))).comp continuous_snd)) + intro p + exact ⟨(projIcc c d hcd p.1).property,(projIcc a b hab p.2).property⟩ + +theorem rectExtend_derivative {a b c d s t : ℝ} (hab : a≤b) (hcd : c≤d) + {Ω Ωs : ℝ → ℝ → A} (hs : s∈Ioo c d) (ht : t∈Icc a b) + (hd : HasDerivAt (fun v => Ω v t) (Ωs s t) s) : + HasDerivAt (fun v => rectExtend hab hcd Ω v t) (rectExtend hab hcd Ωs s t) s := by + rw [rectExtend_eq hab hcd Ωs ⟨hs.1.le,hs.2.le⟩ ht] + apply hd.congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds hs.1 hs.2] with v hv + exact rectExtend_eq hab hcd Ω ⟨hv.1.le,hv.2.le⟩ ht + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem derivative_transport_flat_local (F : NilpotentFiltration A) {Ω Ωs B : ℝ → ℝ → A} + {a b c d s : ℝ} (hab : a≤b) (hcd : c≤d) + (hΩ : ContinuousOn Ω.uncurry (Icc c d ×ˢ Icc a b)) + (hΩs : ContinuousOn Ωs.uncurry (Icc c d ×ˢ Icc a b)) + (hΩm : ∀ v∈Icc c d,∀ t∈Icc a b,Ω v t∈F.space 1) + (hs : s∈Ioo c d) + (hDs : ∀ v∈Ioo c d,∀ t∈Icc a b,HasDerivAt (fun v => Ω v t) (Ωs v t) v) + (hDt : ∀ t∈Icc a b,HasDerivAt (B s) (Ωs s t) t) + (hcomm : ∀ t∈Icc a b,Commute (Ω s t) (B s t)) : + HasDerivAt (fun s => transport (Ω s) a F.cutoff b) + (B s b*transport (Ω s) a F.cutoff b-transport (Ω s) a F.cutoff b*B s a) s := by + have he (v : ℝ) (hv : v∈Icc c d) : + transport (rectExtend hab hcd Ω v) a F.cutoff b=transport (Ω v) a F.cutoff b := by + apply transport_congr + intro t ht + exact rectExtend_eq hab hcd Ω hv (by simpa only [uIcc_of_le hab] using ht) + have hh := derivative_transport_flat F (a:=a) (b:=b) (B:=B) (continuous_rectExtend hab hcd hΩ) + (continuous_rectExtend hab hcd hΩs) + (fun v t => hΩm _ (projIcc c d hcd v).property _ (projIcc a b hab t).property) hs + (fun v hv t ht => rectExtend_derivative hab hcd hv + (by simpa only [uIcc_of_le hab] using ht) (hDs v hv t (by simpa only [uIcc_of_le hab] using ht))) + (fun t ht => by + rw [rectExtend_eq hab hcd Ωs ⟨hs.1.le,hs.2.le⟩ (by simpa only [uIcc_of_le hab] using ht)] + exact hDt t (by simpa only [uIcc_of_le hab] using ht)) + (fun t ht => by + rw [rectExtend_eq hab hcd Ω ⟨hs.1.le,hs.2.le⟩ (by simpa only [uIcc_of_le hab] using ht)] + exact hcomm t (by simpa only [uIcc_of_le hab] using ht)) + rw [he s ⟨hs.1.le,hs.2.le⟩] at hh + apply hh.congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds hs.1 hs.2] with v hv + exact (he v ⟨hv.1.le,hv.2.le⟩).symm + +end + +open MeasureTheory Set Filter +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] + +omit [CompleteSpace A] in +theorem continuousOn_transport_parameter {Ω : ℝ → ℝ → A} {a b c d : ℝ} + (hab : a≤b) (hcd : c≤d) + (hΩ : ContinuousOn Ω.uncurry (Icc c d ×ˢ Icc a b)) (N : ℕ) : + ContinuousOn (fun s => transport (Ω s) a N b) (Icc c d) := by + have hh : Continuous (fun s => transport (rectExtend hab hcd Ω s) a N b) := by + unfold transport + apply continuous_finsetSum + intro n hn + exact (continuous_term_parameter (continuous_rectExtend hab hcd hΩ) a n).comp + (continuous_id.prodMk continuous_const) + apply hh.continuousOn.congr + intro s hs + apply transport_congr + intro t ht + exact (rectExtend_eq hab hcd Ω hs (by simpa only [uIcc_of_le hab] using ht)).symm + +variable [FiniteDimensional ℝ A] + +theorem transport_flat_constant_local (F : NilpotentFiltration A) {Ω Ωs B : ℝ → ℝ → A} + {a b c d u v : ℝ} (hab : a≤b) (hcd : c Ω s t) (Ωs s t) s) + (hDt : ∀ s∈Ioo c d,∀ t∈Icc a b,HasDerivAt (B s) (Ωs s t) t) + (hcomm : ∀ s∈Ioo c d,∀ t∈Icc a b,Commute (Ω s t) (B s t)) + (hBa : ∀ s∈Ioo c d,B s a=0) (hBb : ∀ s∈Ioo c d,B s b=0) + (hu : u∈Icc c d) (hv : v∈Icc c d) : + transport (Ω u) a F.cutoff b=transport (Ω v) a F.cutoff b := by + have hd : ∀ s∈Ioo c d,HasDerivAt (fun s => transport (Ω s) a F.cutoff b) 0 s := by + intro s hs + simpa only [hBa s hs,hBb s hs,zero_mul,mul_zero,sub_self] using + derivative_transport_flat_local F hab hcd.le hΩ hΩs hΩm hs hDs (hDt s hs) (hcomm s hs) + let w := (c+d)/2 + have hw : w∈Ioo c d := ⟨by dsimp [w]; linarith,by dsimp [w]; linarith⟩ + have he : EqOn (fun s => transport (Ω s) a F.cutoff b) + (fun _ => transport (Ω w) a F.cutoff b) (Ioo c d) := by + intro s hs + exact isOpen_Ioo.is_const_of_deriv_eq_zero isPreconnected_Ioo + (fun s hs => (hd s hs).differentiableAt.differentiableWithinAt) + (fun s hs => (hd s hs).deriv) hs hw + have he' := he.of_subset_closure (continuousOn_transport_parameter hab hcd.le hΩ F.cutoff) + continuousOn_const Ioo_subset_Icc_self (by rw [closure_Ioo hcd.ne]) + exact (he' hu).trans (he' hv).symm + +end DeligneDrinfeld.FinitePicard + +namespace DeligneDrinfeld +namespace KZFlat +variable {K : Type*} [Field K] + +def wedge (u v : Fin 6 → K) (i j : Fin 6) : K :=u i*v j-u j*v i + +theorem arnold (u v du dv eu ev : K) (hu : u≠0) (hv : v≠0) (huv : u+v≠0) : + du/u*((eu+ev)/(u+v))-(du+dv)/(u+v)*(eu/u)- + (du/u*(ev/v)-dv/v*(eu/u))+ + ((du+dv)/(u+v)*(ev/v)-dv/v*((eu+ev)/(u+v)))=0 := by + field_simp + ring + +variable {M : Type*} [LieRing M] [LieAlgebra K M] + +def combine (a b c d e f : M) (u : Fin 6 → K) : M := + u 0 • a+u 1 • b+u 2 • c+u 3 • d+u 4 • e+u 5 • f + +theorem expand (a b c d e f : M) + (had : ⁅a,d⁆ = -⁅a,b⁆) (hae : ⁅a,e⁆ = -⁅a,c⁆) (haf : ⁅a,f⁆=0) + (hbd : ⁅b,d⁆ = ⁅a,b⁆) (hbe : ⁅b,e⁆=0) (hbf : ⁅b,f⁆ = -⁅b,c⁆) + (hcd : ⁅c,d⁆=0) (hce : ⁅c,e⁆ = ⁅a,c⁆) (hcf : ⁅c,f⁆ = ⁅b,c⁆) + (hdf : ⁅d,f⁆ = -⁅d,e⁆) (hef : ⁅e,f⁆ = ⁅d,e⁆) + (u v : Fin 6 → K) : + ⁅combine a b c d e f u,combine a b c d e f v⁆ = + (wedge u v 0 1-wedge u v 0 3+wedge u v 1 3) • ⁅a,b⁆+ + (wedge u v 0 2-wedge u v 0 4+wedge u v 2 4) • ⁅a,c⁆+ + (wedge u v 1 2-wedge u v 1 5+wedge u v 2 5) • ⁅b,c⁆+ + (wedge u v 3 4-wedge u v 3 5+wedge u v 4 5) • ⁅d,e⁆ := by + have hba : ⁅b,a⁆ = -⁅a,b⁆ := (lie_skew b a).symm + have hca : ⁅c,a⁆ = -⁅a,c⁆ := (lie_skew c a).symm + have hcb : ⁅c,b⁆ = -⁅b,c⁆ := (lie_skew c b).symm + have hda : ⁅d,a⁆ = ⁅a,b⁆ := by rw [←lie_skew d a,had,neg_neg] + have hdb : ⁅d,b⁆ = -⁅a,b⁆ := by rw [←lie_skew d b,hbd] + have hdc : ⁅d,c⁆=0 := by rw [←lie_skew d c,hcd,neg_zero] + have hea : ⁅e,a⁆ = ⁅a,c⁆ := by rw [←lie_skew e a,hae,neg_neg] + have heb : ⁅e,b⁆=0 := by rw [←lie_skew e b,hbe,neg_zero] + have hec : ⁅e,c⁆ = -⁅a,c⁆ := by rw [←lie_skew e c,hce] + have hed : ⁅e,d⁆ = -⁅d,e⁆ := (lie_skew e d).symm + have hfa : ⁅f,a⁆=0 := by rw [←lie_skew f a,haf,neg_zero] + have hfb : ⁅f,b⁆ = ⁅b,c⁆ := by rw [←lie_skew f b,hbf,neg_neg] + have hfc : ⁅f,c⁆ = -⁅b,c⁆ := by rw [←lie_skew f c,hcf] + have hfd : ⁅f,d⁆ = ⁅d,e⁆ := by rw [←lie_skew f d,hdf,neg_neg] + have hfe : ⁅f,e⁆ = -⁅d,e⁆ := by rw [←lie_skew f e,hef] + simp only [combine,lie_add,add_lie,lie_smul,smul_lie,lie_self,had,hae,haf,hbd,hbe, + hbf,hcd,hce,hcf,hdf,hef,hba,hca,hcb,hda,hdb,hdc,hea,heb,hec,hed,hfa,hfb,hfc,hfd,hfe] + unfold wedge + module + +open GenericBraid + +theorem adjacent {α : Type*} (i j k : α) (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + ⁅GenericBraid.t (R:=K) i j,GenericBraid.t (R:=K) j k⁆ = -⁅GenericBraid.t (R:=K) i j,GenericBraid.t (R:=K) i k⁆ := by + have h := GenericBraid.t_three (R:=K) i j k hij hik hjk + rw [lie_add] at h + exact eq_neg_iff_add_eq_zero.mpr (by rw [add_comm]; exact h) + +theorem outer {α : Type*} (i j k : α) (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + ⁅GenericBraid.t (R:=K) i k,GenericBraid.t (R:=K) j k⁆ = ⁅GenericBraid.t (R:=K) i j,GenericBraid.t (R:=K) i k⁆ := by + have h := GenericBraid.t_three (R:=K) i k j hik hij hjk.symm + rw [GenericBraid.t_comm k j,lie_add,←lie_skew (GenericBraid.t (R:=K) i k) (GenericBraid.t (R:=K) i j)] at h + exact (neg_add_eq_zero.mp h).symm + +def dlog (z v : Fin 4 → K) (i j : Fin 4) : K :=(v i-v j)/(z i-z j) + +def coefficients (z v : Fin 4 → K) : Fin 6 → K := + ![dlog z v 0 1,dlog z v 0 2,dlog z v 0 3,dlog z v 1 2,dlog z v 1 3,dlog z v 2 3] + +def connection (z v : Fin 4 → K) : T K (Fin 4) := + combine (GenericBraid.t 0 1) (GenericBraid.t 0 2) (GenericBraid.t 0 3) (GenericBraid.t 1 2) (GenericBraid.t 1 3) (GenericBraid.t 2 3) (coefficients z v) + +theorem arnold_dlog (z v w : Fin 4 → K) (hz : Function.Injective z) + (i j k : Fin 4) (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + dlog z v i j*dlog z w i k-dlog z v i k*dlog z w i j- + (dlog z v i j*dlog z w j k-dlog z v j k*dlog z w i j)+ + (dlog z v i k*dlog z w j k-dlog z v j k*dlog z w i k)=0 := by + have hu : z i-z j≠0 := sub_ne_zero.mpr (hz.ne hij) + have hv : z j-z k≠0 := sub_ne_zero.mpr (hz.ne hjk) + have huv : z i-z j+(z j-z k)≠0 := by simpa using sub_ne_zero.mpr (hz.ne hik) + simpa only [dlog,sub_add_sub_cancel] using + arnold (z i-z j) (z j-z k) (v i-v j) (v j-v k) (w i-w j) (w j-w k) hu hv huv + +theorem flat (z v w : Fin 4 → K) (hz : Function.Injective z) : + ⁅connection z v,connection z w⁆=0 := by + rw [connection,connection,expand _ _ _ _ _ _ + (adjacent 0 1 2 (by decide) (by decide) (by decide)) + (adjacent 0 1 3 (by decide) (by decide) (by decide)) + (GenericBraid.t_disjoint 0 1 2 3 (by decide) (by decide) (by decide) (by decide)) + (outer 0 1 2 (by decide) (by decide) (by decide)) + (GenericBraid.t_disjoint 0 2 1 3 (by decide) (by decide) (by decide) (by decide)) + (adjacent 0 2 3 (by decide) (by decide) (by decide)) + (GenericBraid.t_disjoint 0 3 1 2 (by decide) (by decide) (by decide) (by decide)) + (outer 0 1 3 (by decide) (by decide) (by decide)) + (outer 0 2 3 (by decide) (by decide) (by decide)) + (adjacent 1 2 3 (by decide) (by decide) (by decide)) + (outer 1 2 3 (by decide) (by decide) (by decide))] + dsimp [wedge,coefficients] + rw [arnold_dlog z v w hz 0 1 2 (by decide) (by decide) (by decide), + arnold_dlog z v w hz 0 1 3 (by decide) (by decide) (by decide), + arnold_dlog z v w hz 0 2 3 (by decide) (by decide) (by decide), + arnold_dlog z v w hz 1 2 3 (by decide) (by decide) (by decide)] + simp + +end KZFlat +end DeligneDrinfeld + +namespace DeligneDrinfeld.LogRectangle +open MeasureTheory Set Filter FinitePicard +open scoped Topology +variable {K A E : Type*} [NontriviallyNormedField K] [NormedAlgebra ℝ K] + [NormedRing A] [NormedAlgebra K A] [NormedAlgebra ℝ A] [IsScalarTower ℝ K A] + [Fintype E] + +def form (c : E → A) (z v : E → K) : A := ∑ i,(v i/z i) • c i + +def mixed (c : E → A) (z zs zt zst : E → K) : A := + ∑ i,((zst i*z i-zt i*zs i)/(z i)^2) • c i + +theorem derivative_s (c : E → A) {z zt : ℝ → E → K} {zs zst : E → K} {s : ℝ} + (hz : ∀ i,HasDerivAt (fun s => z s i) (zs i) s) + (hv : ∀ i,HasDerivAt (fun s => zt s i) (zst i) s) + (hn : ∀ i,z s i≠0) : + HasDerivAt (fun s => form c (z s) (zt s)) (mixed c (z s) zs (zt s) zst) s := by + apply HasDerivAt.fun_sum + intro i hi + exact ((hv i).div (hz i) (hn i)).smul_const (c i) + +theorem derivative_t (c : E → A) {z zs : ℝ → E → K} {zt zst : E → K} {t : ℝ} + (hz : ∀ i,HasDerivAt (fun t => z t i) (zt i) t) + (hv : ∀ i,HasDerivAt (fun t => zs t i) (zst i) t) + (hn : ∀ i,z t i≠0) : + HasDerivAt (fun t => form c (z t) (zs t)) (mixed c (z t) (zs t) zt zst) t := by + convert derivative_s c hz hv hn using 1 + simp only [mixed,mul_comm (zt _)] + +omit [NormedAlgebra ℝ K] [NormedAlgebra ℝ A] [IsScalarTower ℝ K A] in +theorem continuousOn_form (c : E → A) {X : Type*} [TopologicalSpace X] + {z v : X → E → K} {S : Set X} + (hz : ∀ i,ContinuousOn (fun x => z x i) S) + (hv : ∀ i,ContinuousOn (fun x => v x i) S) + (hn : ∀ x∈S,∀ i,z x i≠0) : + ContinuousOn (fun x => form c (z x) (v x)) S := by + apply continuousOn_finsetSum + intro i hi + exact ((hv i).div (hz i) (fun x hx => hn x hx i)).smul continuousOn_const + +omit [NormedAlgebra ℝ K] [NormedAlgebra ℝ A] [IsScalarTower ℝ K A] in +theorem continuousOn_mixed (c : E → A) {X : Type*} [TopologicalSpace X] + {z zs zt zst : X → E → K} {S : Set X} + (hz : ∀ i,ContinuousOn (fun x => z x i) S) + (hs : ∀ i,ContinuousOn (fun x => zs x i) S) + (ht : ∀ i,ContinuousOn (fun x => zt x i) S) + (hst : ∀ i,ContinuousOn (fun x => zst x i) S) + (hn : ∀ x∈S,∀ i,z x i≠0) : + ContinuousOn (fun x => mixed c (z x) (zs x) (zt x) (zst x)) S := by + apply continuousOn_finsetSum + intro i hi + exact ((((hst i).mul (hz i)).sub ((ht i).mul (hs i))).div + ((hz i).pow 2) (fun x hx => pow_ne_zero _ (hn x hx i))).smul continuousOn_const + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem transport_derivative (F : NilpotentFiltration A) (c : E → A) + {z zs zt zst : ℝ → ℝ → E → K} {a b u v s : ℝ} + (hab : a≤b) (huv : u≤v) + (hc : ∀ i (r : K),r • c i∈F.space 1) + (hz : ∀ i,ContinuousOn (fun w : ℝ×ℝ => z w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hs : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zs w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (ht : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zt w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hst : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zst w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hn : ∀ s∈Icc u v,∀ t∈Icc a b,∀ i,z s t i≠0) + (hDsz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => z s t i) (zs s t i) s) + (hDszt : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => zt s t i) (zst s t i) s) + (hDtz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => z s t i) (zt s t i) t) + (hDtzs : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => zs s t i) (zst s t i) t) + (hflat : ∀ t∈Icc a b, + Commute (form c (z s t) (zt s t)) (form c (z s t) (zs s t))) + (hss : s∈Ioo u v) : + HasDerivAt (fun s => transport (fun t => form c (z s t) (zt s t)) a F.cutoff b) + (form c (z s b) (zs s b)*transport (fun t => form c (z s t) (zt s t)) a F.cutoff b- + transport (fun t => form c (z s t) (zt s t)) a F.cutoff b*form c (z s a) (zs s a)) s := by + apply derivative_transport_flat_local F (Ω:=fun s t => form c (z s t) (zt s t)) (B:=fun s t => form c (z s t) (zs s t)) + (Ωs:=fun s t => mixed c (z s t) (zs s t) (zt s t) (zst s t)) hab huv + (continuousOn_form c hz ht (fun w hw => hn w.1 hw.1 w.2 hw.2)) + (continuousOn_mixed c hz hs ht hst (fun w hw => hn w.1 hw.1 w.2 hw.2)) + _ hss _ _ hflat + · intro s hs t ht + exact (F.space 1).sum_mem (fun i hi => hc i _) + · intro s hs t ht + exact derivative_s c (hDsz s hs t ht) (hDszt s hs t ht) (hn s ⟨hs.1.le,hs.2.le⟩ t ht) + · intro t ht + exact derivative_t c (hDtz s hss t ht) (hDtzs s hss t ht) (hn s ⟨hss.1.le,hss.2.le⟩ t ht) + +theorem transport_constant (F : NilpotentFiltration A) (c : E → A) + {z zs zt zst : ℝ → ℝ → E → K} {a b u v p q : ℝ} + (hab : a≤b) (huv : u z w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hs : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zs w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (ht : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zt w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hst : ∀ i,ContinuousOn (fun w : ℝ×ℝ => zst w.1 w.2 i) (Icc u v ×ˢ Icc a b)) + (hn : ∀ s∈Icc u v,∀ t∈Icc a b,∀ i,z s t i≠0) + (hDsz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => z s t i) (zs s t i) s) + (hDszt : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun s => zt s t i) (zst s t i) s) + (hDtz : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => z s t i) (zt s t i) t) + (hDtzs : ∀ s∈Ioo u v,∀ t∈Icc a b,∀ i,HasDerivAt (fun t => zs s t i) (zst s t i) t) + (hflat : ∀ s∈Ioo u v,∀ t∈Icc a b, + Commute (form c (z s t) (zt s t)) (form c (z s t) (zs s t))) + (ha : ∀ s∈Ioo u v,zs s a=0) (hb : ∀ s∈Ioo u v,zs s b=0) + (hp : p∈Icc u v) (hq : q∈Icc u v) : + transport (fun t => form c (z p t) (zt p t)) a F.cutoff b= + transport (fun t => form c (z q t) (zt q t)) a F.cutoff b := by + apply transport_flat_constant_local F (Ω:=fun s t => form c (z s t) (zt s t)) (B:=fun s t => form c (z s t) (zs s t)) + (Ωs:=fun s t => mixed c (z s t) (zs s t) (zt s t) (zst s t)) hab huv + (continuousOn_form c hz ht (fun w hw => hn w.1 hw.1 w.2 hw.2)) + (continuousOn_mixed c hz hs ht hst (fun w hw => hn w.1 hw.1 w.2 hw.2)) + _ _ _ hflat _ _ hp hq + · intro s hs t ht + exact (F.space 1).sum_mem (fun i hi => hc i _) + · intro s hs t ht + exact derivative_s c (hDsz s hs t ht) (hDszt s hs t ht) (hn s ⟨hs.1.le,hs.2.le⟩ t ht) + · intro s hs t ht + exact derivative_t c (hDtz s hs t ht) (hDtzs s hs t ht) (hn s ⟨hs.1.le,hs.2.le⟩ t ht) + · intro s hs + simp [ha s hs,form] + · intro s hs + simp [hb s hs,form] + +end DeligneDrinfeld.LogRectangle + +namespace DeligneDrinfeld.ComplexLogChamber +open MeasureTheory Set Filter FinitePicard +open scoped Topology +variable {A E : Type*} [NormedRing A] [NormedAlgebra ℂ A] [Fintype E] + +def field (p : E → ℂ) (c : E → A) (z : ℂ) : A := ∑ i,(z-p i)⁻¹ • c i + +def connection (p : E → ℂ) (c : E → A) (z v : ℂ) : A := v • field p c z + +theorem form_eq (p : E → ℂ) (c : E → A) (z v : ℂ) : + LogRectangle.form c (fun i => z-p i) (fun _ => v)=connection p c z v := by + simp only [LogRectangle.form,connection,field,Finset.smul_sum,smul_smul,div_eq_mul_inv] + +theorem connection_commute (p : E → ℂ) (c : E → A) (z v w : ℂ) : + Commute (connection p c z v) (connection p c z w) := by + change (v • field p c z)*(w • field p c z)=(w • field p c z)*(v • field p c z) + simp only [smul_mul_assoc,mul_smul_comm,smul_smul,mul_comm v w] + +theorem connection_mem (F : NilpotentFiltration A) (p : E → ℂ) (c : E → A) + (hc : ∀ i (r : ℂ),r • c i∈F.space 1) (z v : ℂ) : connection p c z v∈F.space 1 := by + rw [←form_eq] + exact (F.space 1).sum_mem (fun i hi => hc i _) + +@[simp] theorem connection_zero (p : E → ℂ) (c : E → A) (z : ℂ) : connection p c z 0=0 := + zero_smul ℂ _ + +theorem connection_continuousOn (p : E → ℂ) (c : E → A) + {X : Type*} [TopologicalSpace X] {z v : X → ℂ} {S : Set X} + (hz : ContinuousOn z S) (hv : ContinuousOn v S) + (hn : ∀ x∈S,∀ i,z x≠p i) : ContinuousOn (fun x => connection p c (z x) (v x)) S := by + simp only [←form_eq] + exact LogRectangle.continuousOn_form c (fun i => hz.sub continuousOn_const) + (fun _ => hv) (fun x hx i => sub_ne_zero.mpr (hn x hx i)) + +def segment (u v : ℂ) (t : ℝ) : ℂ := (1-t) • u+t • v + +@[simp] theorem segment_zero (u v : ℂ) : segment u v 0=u := by simp [segment] +@[simp] theorem segment_one (u v : ℂ) : segment u v 1=v := by simp [segment] + +theorem segment_mem {C : Set ℂ} (hC : Convex ℝ C) {u v : ℂ} (hu : u∈C) (hv : v∈C) + {t : ℝ} (ht : t∈Icc 0 1) : segment u v t∈C := + hC hu hv (sub_nonneg.mpr ht.2) ht.1 (by ring) + +theorem segment_derivative (u v : ℂ) (t : ℝ) : HasDerivAt (segment u v) (v-u) t := by + convert! (((hasDerivAt_const t (1:ℝ)).sub (hasDerivAt_id t)).smul_const u).add + ((hasDerivAt_id t).smul_const v) using 1 + simp [sub_eq_add_neg,add_comm] + +def fundamental (F : NilpotentFiltration A) (p : E → ℂ) (c : E → A) (u v : ℂ) : A := + transport (fun t => connection p c (segment u v t) (v-u)) 0 F.cutoff 1 + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +omit [CompleteSpace A] in +theorem fundamental_isUnit (F : NilpotentFiltration A) (p : E → ℂ) (c : E → A) + (hc : ∀ i (r : ℂ),r • c i∈F.space 1) (u v : ℂ) : IsUnit (fundamental F p c u v) := + transport_isUnit F (fun _ => connection_mem F p c hc _ _) _ _ _ + +theorem fundamental_derivative (F : NilpotentFiltration A) (p : E → ℂ) (c : E → A) + (hc : ∀ i (r : ℂ),r • c i∈F.space 1) {C : Set ℂ} {u : ℂ} + (hp : ∀ z∈C,∀ t∈Icc (0:ℝ) 1,∀ i,segment u z t≠p i) + {q q' : ℝ → ℂ} {a b s : ℝ} (hq : ∀ s∈Icc a b,q s∈C) + (hqc : ContinuousOn q (Icc a b)) (hqc' : ContinuousOn q' (Icc a b)) + (hqd : ∀ s∈Ioo a b,HasDerivAt q (q' s) s) (hs : s∈Ioo a b) : + HasDerivAt (fun s => fundamental F p c u (q s)) + (connection p c (q s) (q' s)*fundamental F p c u (q s)) s := by + have hab : a≤b := le_trans hs.1.le hs.2.le + have hq2 : ContinuousOn (fun w : ℝ×ℝ => q w.1) (Icc a b ×ˢ Icc 0 1) := + hqc.comp continuous_fst.continuousOn (fun w hw => hw.1) + have hq2' : ContinuousOn (fun w : ℝ×ℝ => q' w.1) (Icc a b ×ˢ Icc 0 1) := + hqc'.comp continuous_fst.continuousOn (fun w hw => hw.1) + have hh := LogRectangle.transport_derivative F c + (z:=fun s t i => segment u (q s) t-p i) + (zt:=fun s _ _ => q s-u) (zs:=fun s t _ => t • q' s) (zst:=fun s _ _ => q' s) + (by norm_num : (0:ℝ)≤1) hab hc + (fun i => (((continuousOn_const.sub continuous_snd.continuousOn).smul continuousOn_const).add + (continuous_snd.continuousOn.smul hq2)).sub continuousOn_const) + (fun _ => continuous_snd.continuousOn.smul hq2') + (fun _ => hq2.sub continuousOn_const) (fun _ => hq2') + (fun v hv t ht i => sub_ne_zero.mpr (hp _ (hq v hv) t ht i)) + (fun v hv t ht i => by + simpa only [segment,Pi.add_apply,zero_add] using! + ((hasDerivAt_const v ((1-t) • u)).add ((hqd v hv).const_smul t)).sub_const (p i)) + (fun v hv t ht i => (hqd v hv).sub_const u) + (fun v hv t ht i => (segment_derivative u (q v) t).sub_const (p i)) + (fun v hv t ht i => by simpa only [one_smul] using! (hasDerivAt_id t).smul_const (q' v)) + (fun t ht => by rw [form_eq,form_eq]; exact connection_commute p c _ _ _) hs + simpa only [segment_zero,segment_one,zero_smul,one_smul,form_eq,connection_zero, + mul_zero,sub_zero,fundamental] using! hh + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem fundamental_continuousOn (F : NilpotentFiltration A) (p : E → ℂ) (c : E → A) + {C : Set ℂ} {u : ℂ} + (hp : ∀ z∈C,∀ t∈Icc (0:ℝ) 1,∀ i,segment u z t≠p i) + {q : ℝ → ℂ} {a b : ℝ} (hab : a≤b) (hq : ∀ s∈Icc a b,q s∈C) + (hqc : ContinuousOn q (Icc a b)) : + ContinuousOn (fun s => fundamental F p c u (q s)) (Icc a b) := by + apply continuousOn_transport_parameter (a:=0) (b:=1) (by norm_num) hab _ F.cutoff + have hq2 : ContinuousOn (fun w : ℝ×ℝ => q w.1) (Icc a b ×ˢ Icc 0 1) := + hqc.comp continuous_fst.continuousOn (fun w hw => hw.1) + exact connection_continuousOn p c + (((continuousOn_const.sub continuous_snd.continuousOn).smul continuousOn_const).add + (continuous_snd.continuousOn.smul hq2)) (hq2.sub continuousOn_const) + (fun w hw i => hp _ (hq w.1 hw.1) w.2 hw.2 i) + +theorem transport_eq_ratio (F : NilpotentFiltration A) (p : E → ℂ) (c : E → A) + (hc : ∀ i (r : ℂ),r • c i∈F.space 1) {C : Set ℂ} {u : ℂ} + (hp : ∀ z∈C,∀ t∈Icc (0:ℝ) 1,∀ i,segment u z t≠p i) + {q q' : ℝ → ℂ} {a b : ℝ} (hab : a connection p c (q s) (q' s)) a F.cutoff b= + fundamental F p c u (q b)*Ring.inverse (fundamental F p c u (q a)) := by + have hcon := connection_continuousOn p c hqc hqc' (fun s hs => by simpa using hp _ (hq s hs) 1 ⟨by norm_num,le_rfl⟩) + apply transport_eq_fundamental F (fun _ => connection_mem F p c hc _ _) hab + (hcon.intervalIntegrable_of_Icc hab.le) (hcon.mono Ioo_subset_Icc_self) + (fun s hs => fundamental_derivative F p c hc hp hq hqc hqc' hqd hs) + (fundamental_continuousOn F p c hp hab.le hq hqc) + (fun s hs => fundamental_isUnit F p c hc _ _) + +end DeligneDrinfeld.ComplexLogChamber + +namespace DeligneDrinfeld.KZCollar +open Set Filter FinitePicard +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem regularizedBulk_two_eq (F : NilpotentFiltration A) {X Y : A} + (hX : X∈F.space 1) (hY : Y∈F.space 1) {r s : ℝ} + (hr : 0] 0) (𝓝[>] 0)) (hs : Tendsto s (𝓝[>] 0) (𝓝[>] 0)) : + Tendsto (fun t => gauge (-Y) (s t)*transport (bulkForm X Y) (r t) F.cutoff (1-s t)*gauge X (r t)) + (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have h0 := (regularTransport_limit (Y:=Y) F hX).comp hr + have h1 := (regularTransport_limit (Y:=X) F hY).comp hs + have hi : Tendsto (fun t => Ring.inverse (transport (regularForm X Y) 0 F.cutoff (r t))) + (𝓝[>] 0) (𝓝 (1:A)) := by + simpa only [Units.val_one,Ring.inverse_one] using! (NormedRing.inverse_continuousAt (1:Aˣ)).tendsto.comp h0 + have hlim := (h1.mul (tendsto_const_nhds (x:=associator F X Y))).mul hi + simp only [one_mul,mul_one] at hlim + have hrs : ∀ᶠ t in 𝓝[>] 0,r t+s t<1 := by + have h := (hr.mono_right nhdsWithin_le_nhds).add (hs.mono_right nhdsWithin_le_nhds) + simpa only [zero_add] using h.eventually (eventually_lt_nhds (by norm_num)) + apply hlim.congr' + filter_upwards [hr.eventually self_mem_nhdsWithin,hs.eventually self_mem_nhdsWithin,hrs] with t hrt hst hrst + exact (regularizedBulk_two_eq F hX hY hrt hst hrst).symm + +end DeligneDrinfeld.KZCollar + +namespace DeligneDrinfeld.ComplexKZ +open Set Filter FinitePicard ComplexLogChamber +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] + +def form (X Y : A) (z v : ℂ) : A := (v/z) • X+(v/(z-1)) • Y + +def poles : Bool → ℂ := fun b => if b then 1 else 0 + +def residues (X Y : A) : Bool → A := fun b => if b then Y else X + +theorem form_eq (X Y : A) (z v : ℂ) : + form X Y z v=connection poles (residues X Y) z v := by + rw [←ComplexLogChamber.form_eq] + simp [form,LogRectangle.form,poles,residues,add_comm] + +def domain : Set ℂ := {z | 0≤z.im ∧ z≠0 ∧ z≠1} + +theorem real_mem {s : ℝ} (h0 : s≠0) (h1 : s≠1) : (s:ℂ)∈domain := by + simp [domain,h0,h1] + +theorem star_avoids {z : ℂ} (hz : z∈domain) {t : ℝ} (ht : t∈Icc 0 1) (b : Bool) : + segment Complex.I z t≠poles b := by + intro he + have hp : (poles b).im=0 := by cases b <;> simp [poles] + have him := congrArg Complex.im he + simp only [ComplexLogChamber.segment,Complex.add_im,Complex.smul_im,smul_eq_mul,Complex.I_im] at him + rw [hp] at him + have ht1 : t=1 := by + have hprod : 0≤t*z.im := mul_nonneg ht.1 hz.1 + nlinarith [ht.2] + rw [ht1,segment_one] at he + cases b + · exact hz.2.1 (by simpa [poles] using he) + · exact hz.2.2 (by simpa [poles] using he) + +def turn (z : ℂ) : ℂ := (1-z)⁻¹ + +def turnDeriv (z : ℂ) : ℂ := (1-z)⁻¹^2 + +theorem turn_nonzero {z : ℂ} (hz : z≠1) : turn z≠0 := by + exact inv_ne_zero (sub_ne_zero.mpr (Ne.symm hz)) + +theorem turn_sub_one {z : ℂ} (hz : z≠1) : turn z-1=z/(1-z) := by + unfold turn + field_simp [sub_ne_zero.mpr (Ne.symm hz)] + ring + +theorem turn_ne_one {z : ℂ} (h0 : z≠0) (h1 : z≠1) : turn z≠1 := by + intro h + have hh := turn_sub_one h1 + rw [h,sub_self] at hh + exact (div_ne_zero h0 (sub_ne_zero.mpr (Ne.symm h1))) hh.symm + +theorem turn_mem {z : ℂ} (hz : z∈domain) : turn z∈domain := by + refine ⟨?_,turn_nonzero hz.2.2,turn_ne_one hz.2.1 hz.2.2⟩ + simp only [turn,Complex.inv_im,Complex.sub_im,Complex.one_im,zero_sub,neg_neg] + exact div_nonneg hz.1 (Complex.normSq_nonneg _) + +theorem turn_twice {z : ℂ} (h0 : z≠0) (h1 : z≠1) : turn (turn z)=(z-1)/z := by + unfold turn + field_simp [h0,sub_ne_zero.mpr (Ne.symm h1)] + ring + +theorem turn_thrice {z : ℂ} (h0 : z≠0) (h1 : z≠1) : turn (turn (turn z))=z := by + rw [turn_twice h0 h1] + unfold turn + field_simp [h0] + ring + +theorem form_turn (X Y : A) {z : ℂ} (h0 : z≠0) (h1 : z≠1) (v : ℂ) : + form X Y (turn z) (turnDeriv z*v)=form Y (-X-Y) z v := by + rw [form,form,turn_sub_one h1] + have hX : turnDeriv z*v/turn z=-(v/(z-1)) := by + unfold turnDeriv turn + field_simp [h0,sub_ne_zero.mpr (Ne.symm h1),sub_ne_zero.mpr h1] + ring + have hY : turnDeriv z*v/(z/(1-z))=v/z-v/(z-1) := by + unfold turnDeriv + field_simp [h0,sub_ne_zero.mpr (Ne.symm h1),sub_ne_zero.mpr h1] + ring + rw [hX,hY] + simp only [sub_smul,smul_sub,smul_neg,neg_smul] + abel + +theorem turn_derivative {q : ℝ → ℂ} {q' : ℂ} {s : ℝ} + (hq : HasDerivAt q q' s) (h1 : q s≠1) : + HasDerivAt (fun s => turn (q s)) (turnDeriv (q s)*q') s := by + have hd := ((hasDerivAt_const s (1:ℂ)).sub hq).inv (sub_ne_zero.mpr (Ne.symm h1)) + convert! hd using 1 + simp only [zero_sub,neg_neg,turnDeriv,Pi.sub_apply,div_eq_mul_inv,inv_pow] + ring + +theorem turn_continuousOn {q : ℝ → ℂ} {S : Set ℝ} (hq : ContinuousOn q S) + (h1 : ∀ s∈S,q s≠1) : ContinuousOn (fun s => turn (q s)) S := + (continuousOn_const.sub hq).inv₀ (fun s hs => sub_ne_zero.mpr (Ne.symm (h1 s hs))) + +theorem turnDeriv_continuousOn {q : ℝ → ℂ} {S : Set ℝ} (hq : ContinuousOn q S) + (h1 : ∀ s∈S,q s≠1) : ContinuousOn (fun s => turnDeriv (q s)) S := + (turn_continuousOn hq h1).pow 2 + +theorem form_real (X Y : A) (s : ℝ) : form X Y s 1=KZCollar.bulkForm X Y s := by + simp only [form,KZCollar.bulkForm,one_div] + congr 1 + · rw [←Complex.ofReal_inv,Complex.coe_smul] + · rw [←Complex.ofReal_one,←Complex.ofReal_sub,←Complex.ofReal_inv,Complex.coe_smul] + +end DeligneDrinfeld.ComplexKZ + +namespace DeligneDrinfeld.PowerAsymptotic +open MeasureTheory Set Filter Asymptotics FinitePicard +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +omit [NormedAlgebra ℝ A] in +theorem powerSmall_of_real_bound {f : ℝ → A} {g : ℝ → ℝ} (hg : PowerSmall g) + (h : ∀ᶠ s in 𝓝[>] 0, ‖f s‖ ≤ g s) : PowerSmall f := by + obtain ⟨p,hp,hg⟩ := hg + exact ⟨p,hp,(IsBigO.of_norm_eventuallyLE h).trans hg⟩ + +omit [NormedAlgebra ℝ A] in +theorem subpower_of_real_bound {f : ℝ → A} {g : ℝ → ℝ} (hg : Subpower g) + (h : ∀ᶠ s in 𝓝[>] 0, ‖f s‖ ≤ g s) : Subpower f := + fun p hp => (IsBigO.of_norm_eventuallyLE h).trans (hg p hp) + +theorem transportPoly_subpower {L : ℝ → ℝ} (hL : Subpower L) (N : ℕ) : + Subpower (fun s => transportPoly N (L s)) := by + apply Subpower.sum + intro n hn + exact hL.pow n + +theorem transport_subpower {Ω : ℝ → ℝ → A} {a b L : ℝ → ℝ} + (h : ∀ᶠ s in 𝓝[>] 0,a s ≤ b s ∧ IntervalIntegrable (Ω s) volume (a s) (b s) ∧ + 0 ≤ L s ∧ integralNorm (Ω s) (a s) (b s) ≤ L s) + (hL : Subpower L) (N : ℕ) : + Subpower (fun s => transport (Ω s) (a s) N (b s)) := by + apply subpower_of_real_bound ((const_subpower ‖(1:A)‖).mul (transportPoly_subpower hL N)) + filter_upwards [h] with s hs + exact norm_transport_le hs.1 hs.2.1 hs.2.2.1 hs.2.2.2 N + +theorem transport_perturbation_powerSmall {Ω Θ : ℝ → ℝ → A} {a b L E : ℝ → ℝ} + (h : ∀ᶠ s in 𝓝[>] 0,a s ≤ b s ∧ + IntervalIntegrable (Ω s) volume (a s) (b s) ∧ + IntervalIntegrable (Θ s) volume (a s) (b s) ∧ + 0 ≤ L s ∧ 0 ≤ E s ∧ + integralNorm (Ω s) (a s) (b s) ≤ L s ∧ + integralNorm (Θ s) (a s) (b s) ≤ L s ∧ + integralNorm (fun t => Ω s t-Θ s t) (a s) (b s) ≤ E s) + (hL : Subpower L) (hE : PowerSmall E) (N : ℕ) : + PowerSmall (fun s => transport (Ω s) (a s) N (b s)-transport (Θ s) (a s) N (b s)) := by + apply powerSmall_of_real_bound + (((const_subpower ‖(1:A)‖).mul_powerSmall hE).mul_subpower (errorPoly_subpower hL N)) + filter_upwards [h] with s hs + exact norm_transport_sub_le hs.1 hs.2.1 hs.2.2.1 hs.2.2.2.1 hs.2.2.2.2.1 + hs.2.2.2.2.2.1 hs.2.2.2.2.2.2.1 hs.2.2.2.2.2.2.2 N + +omit [NormedAlgebra ℝ A] in + +theorem normalized_perturbation_limit {f g l r : ℝ → A} + (h : PowerSmall (fun s => f s-g s)) (hl : Subpower l) (hr : Subpower r) : + Tendsto (fun s => l s*f s*r s-l s*g s*r s) (𝓝[>] 0) (𝓝 0) := by + have h' := ((hl.mul_powerSmall h).mul_subpower hr).tendsto_zero + simpa only [mul_sub,sub_mul] using h' + +end DeligneDrinfeld.PowerAsymptotic + +namespace DeligneDrinfeld.ComplexKZ + +section +open Set Filter MeasureTheory FinitePicard KZCollar PowerAsymptotic +open scoped Topology + +def arc (r t : ℝ) : ℂ := (r:ℂ)*Complex.exp ((((1-t)*Real.pi:ℝ):ℂ)*Complex.I) + +def angular : ℂ := -((Real.pi:ℂ)*Complex.I) + +@[simp] theorem arc_zero (r : ℝ) : arc r 0=-(r:ℂ) := by + simp [arc,Complex.exp_pi_mul_I] + +@[simp] theorem arc_one (r : ℝ) : arc r 1=(r:ℂ) := by simp [arc] + +theorem norm_arc {r : ℝ} (hr : 0≤r) (t : ℝ) : ‖arc r t‖=r := by + simp [arc,Complex.norm_exp,hr,Real.norm_eq_abs,abs_of_nonneg] + +theorem arc_mem {r t : ℝ} (hr : 0 (arc_derivative r t).continuousAt) + +@[simp] theorem norm_angular : ‖angular‖=Real.pi := by + simp [angular,Real.pi_pos.le,abs_of_nonneg] + +variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] + +def arcForm (X Y : A) (r t : ℝ) : A := form X Y (arc r t) (angular*arc r t) + +theorem arcForm_eq (X Y : A) {r : ℝ} (hr : 0 arcForm X Y r t) _ + simp only [arcForm,form_eq] + apply ComplexLogChamber.connection_continuousOn _ _ (arc_continuous r).continuousOn + (continuous_const.mul (arc_continuous r)).continuousOn + intro t ht b + cases b + · exact (arc_mem hr hr1 ht).2.1 + · exact (arc_mem hr hr1 ht).2.2 + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem constant_transport (F : NilpotentFiltration A) {X : A} (hX : X∈F.space 1) : + transport (fun _ => X) 0 F.cutoff 1=NormedSpace.exp X := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + have h := transport_eq_fundamental F (fun _ => hX) (by norm_num : (0:ℝ)<1) + intervalIntegrable_const continuousOn_const + (f:=fun t : ℝ => NormedSpace.exp (t • X)) + (fun t ht => hasDerivAt_exp_smul_const' X t) + (by fun_prop) (fun t ht => NormedSpace.isUnit_exp _) + simpa using h + +end + +section +open Set Filter FinitePicard ComplexLogChamber +open scoped Topology + +structure Path (a b : ℝ) where + pos : a turn (P.q t) + v := fun t => turnDeriv (P.q t)*P.v t + mem := fun t ht => turn_mem (P.mem t ht) + continuous_q := turn_continuousOn P.continuous_q (fun t ht => (P.mem t ht).2.2) + continuous_v := (turnDeriv_continuousOn P.continuous_q (fun t ht => (P.mem t ht).2.2)).mul P.continuous_v + derivative := fun t ht => turn_derivative (P.derivative t ht) (P.mem t (Ioo_subset_Icc_self ht)).2.2 + +def interval (ha : 0 form X Y (P.q s) (P.v s)) a F.cutoff b + +theorem rotate_holonomy (F : NilpotentFiltration A) (X Y : A) (P : Path a b) : + holonomy F X Y P.rotate=holonomy F Y (-X-Y) P := by + apply transport_congr + intro s hs + rw [uIcc_of_le P.pos.le] at hs + exact form_turn X Y (P.mem s hs).2.1 (P.mem s hs).2.2 _ + +theorem rotate_twice_holonomy (F : NilpotentFiltration A) (X Y : A) (P : Path a b) : + holonomy F X Y P.rotate.rotate=holonomy F (-X-Y) X P := by + rw [rotate_holonomy,rotate_holonomy] + congr 1 + abel + +theorem interval_holonomy (F : NilpotentFiltration A) (X Y : A) + (ha : 0 form X Y (t:ℂ) 1) a F.cutoff b=_ + congr 1 + funext t + exact form_real X Y t + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +def frame (F : NilpotentFiltration A) (X Y : A) (z : ℂ) : A := + fundamental F poles (residues X Y) Complex.I z + +omit [CompleteSpace A] in +theorem frame_isUnit (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) (hY : ∀ c : ℂ,c • Y∈F.space 1) (z : ℂ) : + IsUnit (frame F X Y z) := by + apply fundamental_isUnit + intro b c + cases b + · exact hX c + · exact hY c + +theorem holonomy_ratio (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) (hY : ∀ c : ℂ,c • Y∈F.space 1) (P : Path a b) : + holonomy F X Y P=frame F X Y (P.q b)*Ring.inverse (frame F X Y (P.q a)) := by + unfold holonomy frame + simp only [form_eq] + exact transport_eq_ratio F poles (residues X Y) + (fun b c => by cases b; exact hX c; exact hY c) + (fun z hz t ht b => star_avoids hz ht b) P.pos P.mem P.continuous_q P.continuous_v P.derivative + +end Path +end + +open Set Filter FinitePicard +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem cycle_identity (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) (hY : ∀ c : ℂ,c • Y∈F.space 1) + {a b c d : ℝ} (P : Path a b) (Q : Path c d) + (hstart : P.q a=Q.q d) (hend : P.q b=turn (Q.q c)) : + Path.holonomy F X Y Q*Path.holonomy F X Y P.rotate.rotate* + Path.holonomy F X Y Q.rotate.rotate*Path.holonomy F X Y P.rotate* + Path.holonomy F X Y Q.rotate*Path.holonomy F X Y P=1 := by + rw [Path.holonomy_ratio F hX hY Q,Path.holonomy_ratio F hX hY P.rotate.rotate, + Path.holonomy_ratio F hX hY Q.rotate.rotate,Path.holonomy_ratio F hX hY P.rotate, + Path.holonomy_ratio F hX hY Q.rotate,Path.holonomy_ratio F hX hY P] + simp only [Path.rotate] + rw [hstart,hend,turn_thrice (Q.mem c (left_mem_Icc.mpr Q.pos.le)).2.1 + (Q.mem c (left_mem_Icc.mpr Q.pos.le)).2.2] + have hu := Path.frame_isUnit F hX hY + have cancel (u : ℂ) (v : A) : Ring.inverse (Path.frame F X Y u)*(Path.frame F X Y u*v)=v := + Ring.inverse_mul_cancel_left _ _ (hu u) + simp only [mul_assoc,cancel,Ring.mul_inverse_cancel _ (hu _)] + +def bulkEndpoint (r : ℝ) : ℝ := (1+r)⁻¹ + +theorem bulkEndpoint_bounds {r : ℝ} (hr : 0 ha _ _ ha' hb' + smul_mem' := fun r a h => hs r a h + lie_mem' := fun ha' hb' => hl _ _ ha' hb' } + let f : FreeLieAlgebra R α →ₗ⁅R⁆ K := + FreeLieAlgebra.lift R (fun a => ⟨FreeLieAlgebra.of R a, hg a⟩) + have hf : K.incl.comp f = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro a + simp [f] + have h := (f q).property + change P ((K.incl.comp f) q) at h + simpa only [hf, LieHom.id_apply] using h + +abbrev L := FreeLieAlgebra ℚ Bool +def x : L := FreeLieAlgebra.of ℚ false +def y : L := FreeLieAlgebra.of ℚ true + +def eval {M : Type*} [LieRing M] [LieAlgebra ℚ M] (a b : M) : L →ₗ⁅ℚ⁆ M := + FreeLieAlgebra.lift ℚ (fun i => if i then b else a) + +abbrev Edge := {p : Fin 4 × Fin 4 // p.1 < p.2} +abbrev BraidFree := FreeLieAlgebra ℚ Edge + +def chord (i j : Fin 4) : BraidFree := + if h : i < j then FreeLieAlgebra.of ℚ ⟨(i, j), h⟩ + else if h : j < i then FreeLieAlgebra.of ℚ ⟨(j, i), h⟩ else 0 + +def braidRelations : Set BraidFree := + {z | (∃ i j k l : Fin 4, + i ≠ j ∧ i ≠ k ∧ i ≠ l ∧ j ≠ k ∧ j ≠ l ∧ k ≠ l ∧ + z = ⁅chord i j, chord k l⁆) ∨ + (∃ i j k : Fin 4, i ≠ j ∧ i ≠ k ∧ j ≠ k ∧ + z = ⁅chord i j, chord i k + chord j k⁆)} + +def braidIdeal : LieIdeal ℚ BraidFree := + LieSubmodule.lieSpan ℚ BraidFree braidRelations + +abbrev T4 := BraidFree ⧸ braidIdeal +def t (i j : Fin 4) : T4 := LieSubmodule.Quotient.mk (chord i j) + +def IsSolution (p : L) : Prop := + p + eval y x p = 0 ∧ + p + eval y (-x-y) p + eval (-x-y) x p = 0 ∧ + eval (t 0 1) (t 1 2 + t 1 3) p + eval (t 0 2 + t 1 2) (t 2 3) p = + eval (t 1 2) (t 2 3) p + eval (t 0 1 + t 0 2) (t 1 3 + t 2 3) p + + eval (t 0 1) (t 1 2) p + +def W : Submodule ℚ L where + carrier := {p | IsSolution p} + zero_mem' := by simp [IsSolution] + add_mem' := by + intro p q hp hq + rcases hp with ⟨hp1, hp2, hp3⟩ + rcases hq with ⟨hq1, hq2, hq3⟩ + refine ⟨?_, ?_, ?_⟩ + · simp only [map_add] + calc + _ = (p + eval y x p) + (q + eval y x q) := by abel + _ = 0 := by rw [hp1, hq1, add_zero] + · simp only [map_add] + calc + _ = (p + eval y (-x-y) p + eval (-x-y) x p) + + (q + eval y (-x-y) q + eval (-x-y) x q) := by abel + _ = 0 := by rw [hp2, hq2, add_zero] + · simp only [map_add] + calc + _ = (eval (t 0 1) (t 1 2 + t 1 3) p + eval (t 0 2 + t 1 2) (t 2 3) p) + + (eval (t 0 1) (t 1 2 + t 1 3) q + eval (t 0 2 + t 1 2) (t 2 3) q) := by abel + _ = _ := by rw [hp3, hq3]; abel + smul_mem' := by + intro a p hp + rcases hp with ⟨hp1, hp2, hp3⟩ + change IsSolution (a • p) + simp only [IsSolution, map_smul] + constructor + · simpa only [smul_add, smul_zero] using congrArg (a • ·) hp1 + constructor + · simpa only [smul_add, smul_zero] using congrArg (a • ·) hp2 + · simpa only [smul_add] using congrArg (a • ·) hp3 + +structure Tangent where + base : L + velocity : L + +def Tangent.equiv : Tangent ≃ L × L where + toFun z := (z.base, z.velocity) + invFun z := ⟨z.1, z.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +instance : AddCommGroup Tangent := Tangent.equiv.addCommGroup +instance : Module ℚ Tangent := Tangent.equiv.addEquiv.module ℚ +instance : Bracket Tangent Tangent := + ⟨fun a b => ⟨⁅a.base, b.base⁆, + ⁅a.velocity, b.base⁆ + ⁅a.base, b.velocity⁆⟩⟩ + +@[ext] theorem Tangent.ext {a b : Tangent} (h : a.base = b.base) + (k : a.velocity = b.velocity) : a = b := by cases a; cases b; simp_all + +@[simp] theorem Tangent.base_zero : (0 : Tangent).base = 0 := rfl +@[simp] theorem Tangent.velocity_zero : (0 : Tangent).velocity = 0 := rfl +@[simp] theorem Tangent.base_add (a b : Tangent) : (a+b).base = a.base+b.base := rfl +@[simp] theorem Tangent.velocity_add (a b : Tangent) : + (a+b).velocity = a.velocity+b.velocity := rfl +@[simp] theorem Tangent.base_smul (q : ℚ) (a : Tangent) : (q • a).base = q • a.base := rfl +@[simp] theorem Tangent.velocity_smul (q : ℚ) (a : Tangent) : + (q • a).velocity = q • a.velocity := rfl +@[simp] theorem Tangent.base_lie (a b : Tangent) : ⁅a,b⁆.base = ⁅a.base,b.base⁆ := rfl +@[simp] theorem Tangent.velocity_lie (a b : Tangent) : + ⁅a,b⁆.velocity = ⁅a.velocity,b.base⁆ + ⁅a.base,b.velocity⁆ := rfl + +instance : LieRing Tangent where + add_lie a b c := by + apply Tangent.equiv.injective + apply Prod.ext + · exact add_lie a.base b.base c.base + · change ⁅a.velocity + b.velocity, c.base⁆ + ⁅a.base + b.base, c.velocity⁆ = + (⁅a.velocity, c.base⁆ + ⁅a.base, c.velocity⁆) + + (⁅b.velocity, c.base⁆ + ⁅b.base, c.velocity⁆) + simp only [add_lie] + abel + lie_add a b c := by + apply Tangent.equiv.injective + apply Prod.ext + · exact lie_add a.base b.base c.base + · change ⁅a.velocity, b.base + c.base⁆ + ⁅a.base, b.velocity + c.velocity⁆ = + (⁅a.velocity, b.base⁆ + ⁅a.base, b.velocity⁆) + + (⁅a.velocity, c.base⁆ + ⁅a.base, c.velocity⁆) + simp only [lie_add] + abel + lie_self a := by + apply Tangent.equiv.injective + apply Prod.ext + · exact lie_self a.base + · change ⁅a.velocity, a.base⁆ + ⁅a.base, a.velocity⁆ = 0 + rw [← lie_skew a.velocity a.base] + exact neg_add_cancel _ + leibniz_lie a b c := by + apply Tangent.equiv.injective + apply Prod.ext + · exact leibniz_lie a.base b.base c.base + · change ⁅a.velocity, ⁅b.base, c.base⁆⁆ + + ⁅a.base, ⁅b.velocity, c.base⁆ + ⁅b.base, c.velocity⁆⁆ = + (⁅⁅a.velocity, b.base⁆ + ⁅a.base, b.velocity⁆, c.base⁆ + + ⁅⁅a.base, b.base⁆, c.velocity⁆) + + (⁅b.velocity, ⁅a.base, c.base⁆⁆ + + ⁅b.base, ⁅a.velocity, c.base⁆ + ⁅a.base, c.velocity⁆⁆) + simp only [lie_add, add_lie, lie_lie] + abel + +instance : LieAlgebra ℚ Tangent where + lie_smul scalar left right := by + apply Tangent.equiv.injective + apply Prod.ext + · exact lie_smul scalar left.base right.base + · change ⁅left.velocity, scalar • right.base⁆ + ⁅left.base, scalar • right.velocity⁆ = + scalar • (⁅left.velocity, right.base⁆ + ⁅left.base, right.velocity⁆) + simp only [lie_smul, smul_add] + +def tangentLift (p : L) : L →ₗ⁅ℚ⁆ Tangent := + FreeLieAlgebra.lift ℚ (fun i => if i then ⟨y, ⁅y,p⁆⟩ else ⟨x, 0⟩) + +def D (p q : L) : L := (tangentLift p q).velocity + +def ihara (p q : L) : L := D p q - D q p + ⁅p,q⁆ + +@[simp] theorem eval_x {M : Type*} [LieRing M] [LieAlgebra ℚ M] (a b : M) : + eval a b x = a := by simp [eval, x] +@[simp] theorem eval_y {M : Type*} [LieRing M] [LieAlgebra ℚ M] (a b : M) : + eval a b y = b := by simp [eval, y] + +def Tangent.baseHom : Tangent →ₗ⁅ℚ⁆ L where + toFun := Tangent.base + map_add' _ _ := rfl + map_smul' _ _ := rfl + map_lie' := rfl + +@[simp] theorem tangentLift_base (p q : L) : (tangentLift p q).base = q := by + have h : Tangent.baseHom.comp (tangentLift p) = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [tangentLift, Tangent.baseHom, x, y] <;> rfl + exact LieHom.congr_fun h q + +@[simp] theorem D_x (p : L) : D p x = 0 := by simp [D, tangentLift, x] +@[simp] theorem D_y (p : L) : D p y = ⁅y,p⁆ := by simp [D, tangentLift, y] +@[simp] theorem D_zero (p : L) : D p 0 = 0 := by simp [D] +@[simp] theorem D_add (p q r : L) : D p (q+r) = D p q + D p r := by simp [D] +@[simp] theorem D_smul (p q : L) (a : ℚ) : D p (a • q) = a • D p q := by simp [D] +theorem D_lie (p q r : L) : D p ⁅q,r⁆ = ⁅D p q,r⁆ + ⁅q,D p r⁆ := by + simp [D, LieHom.map_lie] + +def derivation (p : L) : LieDerivation ℚ L L where + toFun := D p + map_add' := D_add p + map_smul' a q := D_smul p q a + leibniz' a b := by + change D p ⁅a,b⁆ = ⁅a,D p b⁆ - ⁅b,D p a⁆ + rw [D_lie, sub_eq_add_neg, lie_skew, add_comm] + +@[simp] theorem derivation_apply (p q : L) : derivation p q = D p q := rfl + +theorem derivation_ext {d₁ d₂ : LieDerivation ℚ L L} + (hx : d₁ x = d₂ x) (hy : d₁ y = d₂ y) : d₁ = d₂ := by + ext q + induction q using freeLie_induction with + | h0 => simp + | hg i => cases i; exact hx; exact hy + | ha a b ha hb => simp [ha, hb] + | hs r a ha => simp [ha] + | hl a b ha hb => simp [ha, hb] + +@[simp] theorem D_zero_left (q : L) : D 0 q = 0 := by + have h : derivation 0 = 0 := by + apply derivation_ext <;> simp + exact LieDerivation.congr_fun h q + +@[simp] theorem D_add_left (p q r : L) : D (p+q) r = D p r + D q r := by + have h : derivation (p+q) = derivation p + derivation q := by + apply derivation_ext <;> simp [lie_add] + exact LieDerivation.congr_fun h r + +@[simp] theorem D_smul_left (p q : L) (a : ℚ) : D (a • p) q = a • D p q := by + have h : derivation (a • p) = a • derivation p := by + apply derivation_ext <;> simp + exact LieDerivation.congr_fun h q + +inductive WeightedWord {α : Type*} (wt : α → ℕ) : ℕ → FreeLieAlgebra ℚ α → Prop + | generator (a : α) : WeightedWord wt (wt a) (FreeLieAlgebra.of ℚ a) + | bracket {n m a b} : WeightedWord wt n a → WeightedWord wt m b → + WeightedWord wt (n+m) ⁅a,b⁆ + +def weightPiece {α : Type*} (wt : α → ℕ) (n : ℕ) : Submodule ℚ (FreeLieAlgebra ℚ α) := + Submodule.span ℚ {p | WeightedWord wt n p} + +abbrev OddFree := FreeLieAlgebra ℚ ℕ +def oddWeight (k : ℕ) : ℕ := 2*k+3 +abbrev Fn (n : ℕ) := weightPiece oddWeight n +abbrev Ln (n : ℕ) := weightPiece (fun _ : Bool => 1) n +abbrev Wn (n : ℕ) : Submodule ℚ L := W ⊓ Ln n + +def Graded (e : OddFree ≃ₗ[ℚ] W) : Prop := + ∀ n a, (e a : L) ∈ Ln n ↔ a ∈ Fn n + +abbrev OddCompletion := (n : ℕ) → Fn n +abbrev WCompletion := (n : ℕ) → Wn n + +instance : TopologicalSpace L := ⊥ +instance : TopologicalSpace OddFree := ⊥ + +def completed (e : OddFree ≃ₗ[ℚ] W) (h : Graded e) : OddCompletion → WCompletion := + fun a n => ⟨e (a n), (e (a n)).property, (h n (a n)).2 (a n).property⟩ + +def completedInv (e : OddFree ≃ₗ[ℚ] W) (h : Graded e) : WCompletion → OddCompletion := + fun a n => ⟨e.symm ⟨a n, (a n).property.1⟩, + (h n (e.symm ⟨a n, (a n).property.1⟩)).1 (by + rw [LinearEquiv.apply_symm_apply] + exact (a n).property.2)⟩ + +def MainStatement : Prop := + ∃ (e : OddFree ≃ₗ[ℚ] W) (h : Graded e), + (∀ a b, (e ⁅a,b⁆ : L) = ihara (e a) (e b)) ∧ + Function.LeftInverse (completedInv e h) (completed e h) ∧ + Function.RightInverse (completedInv e h) (completed e h) ∧ + Continuous (completed e h) ∧ Continuous (completedInv e h) ∧ + (∀ (a b : OddCompletion) n, + (e (∑ i ∈ Finset.range (n+1), ⁅(a i : OddFree), (b (n-i) : OddFree)⁆) : L) = + ∑ i ∈ Finset.range (n+1), + ihara (completed e h a i) (completed e h b (n-i))) + +namespace AssociativeModel + +variable {α : Type*} +abbrev FL (α : Type*) := FreeLieAlgebra ℚ α +abbrev A (α : Type*) := MonoidAlgebra ℚ (FreeMonoid α) +attribute [local instance] LieRing.ofAssociativeRing + +def atom (a : α) : A α := MonoidAlgebra.single (FreeMonoid.of a) 1 + +def embed : FL α →ₗ⁅ℚ⁆ A α := FreeLieAlgebra.lift ℚ atom + +@[simp] theorem embed_of (a : α) : embed (FreeLieAlgebra.of ℚ a) = atom a := by + simp [embed] + +def dynkinWord : List α → FL α + | [] => 0 + | [a] => FreeLieAlgebra.of ℚ a + | a :: b :: w => ⁅FreeLieAlgebra.of ℚ a, dynkinWord (b :: w)⁆ + +theorem dynkinWord_cons (a : α) (w : List α) (hw : w ≠ []) : + dynkinWord (a::w) = ⁅FreeLieAlgebra.of ℚ a, dynkinWord w⁆ := by + cases w with + | nil => contradiction + | cons b w => rfl + +def wordLinear {M : Type*} [AddCommGroup M] [Module ℚ M] + (f : FreeMonoid α → M) : A α →ₗ[ℚ] M := + (Finsupp.linearCombination ℚ f).comp (MonoidAlgebra.coeffLinearEquiv ℚ).toLinearMap + +@[simp] theorem wordLinear_single {M : Type*} [AddCommGroup M] [Module ℚ M] + (f : FreeMonoid α → M) (w : FreeMonoid α) (c : ℚ) : + wordLinear f (MonoidAlgebra.single w c) = c • f w := by + change Finsupp.linearCombination ℚ f (Finsupp.single w c) = _; simp + +def dynkin : A α →ₗ[ℚ] FL α := wordLinear (fun w => dynkinWord w.toList) + +def wordAct : FreeMonoid α →* Module.End ℚ (FL α) := + FreeMonoid.lift (fun a => LieAlgebra.ad ℚ (FL α) (FreeLieAlgebra.of ℚ a)) + +def act : A α →ₐ[ℚ] Module.End ℚ (FL α) := + MonoidAlgebra.lift ℚ (Module.End ℚ (FL α)) (FreeMonoid α) wordAct + +@[simp] theorem act_single (w : FreeMonoid α) (c : ℚ) : + act (MonoidAlgebra.single w c) = c • wordAct w := by simp [act] + +@[simp] theorem wordAct_of_apply (a : α) (q : FL α) : + wordAct (FreeMonoid.of a) q = ⁅FreeLieAlgebra.of ℚ a,q⁆ := by + simp [wordAct, LieAlgebra.ad_apply] + +@[simp] theorem act_embed (p q : FL α) : act (embed p) q = ⁅p,q⁆ := by + have h : act.toLieHom.comp embed = LieAlgebra.ad ℚ (FL α) := by + apply FreeLieAlgebra.hom_ext + intro a + simp [atom, wordAct] + exact LinearMap.congr_fun (LieHom.congr_fun h p) q + +theorem dynkinWord_append (u v : List α) (hv : v ≠ []) : + dynkinWord (u++v) = wordAct (FreeMonoid.ofList u) (dynkinWord v) := by + induction u with + | nil => simp + | cons a u ih => + rw [List.cons_append, dynkinWord_cons _ _ (List.append_ne_nil_of_right_ne_nil u hv), + ih, FreeMonoid.ofList_cons, map_mul, Module.End.mul_apply, wordAct_of_apply] + +def homogeneous (n : ℕ) : Submodule ℚ (A α) := + Submodule.span ℚ {p | ∃ w : FreeMonoid α, + w.toList.length = n ∧ p = MonoidAlgebra.single w 1} + +theorem single_mem_homogeneous (w : FreeMonoid α) (n : ℕ) + (hn : w.toList.length = n) : MonoidAlgebra.single w 1 ∈ homogeneous (α := α) n := + Submodule.subset_span ⟨w, hn, rfl⟩ + +theorem mul_homogeneous {n m : ℕ} {a b : A α} + (ha : a ∈ homogeneous n) (hb : b ∈ homogeneous m) : a*b ∈ homogeneous (n+m) := by + induction ha using Submodule.span_induction with + | mem a ha => + rcases ha with ⟨v,hv,rfl⟩ + induction hb using Submodule.span_induction with + | mem b hb => + rcases hb with ⟨w,hw,rfl⟩ + simpa only [MonoidAlgebra.single_mul_single, one_mul] using + single_mem_homogeneous (v*w) (n+m) (by simp [hv,hw]) + | zero => simp + | add b c _ _ hb hc => simpa only [mul_add] using (homogeneous (n+m)).add_mem hb hc + | smul r b _ hb => simpa only [mul_smul_comm] using (homogeneous (n+m)).smul_mem r hb + | zero => simp + | add a c _ _ ha hc => simpa only [add_mul] using (homogeneous (n+m)).add_mem ha hc + | smul r a _ ha => simpa only [smul_mul_assoc] using (homogeneous (n+m)).smul_mem r ha + +theorem dynkin_mul {n : ℕ} (hn : n > 0) (a : A α) {b : A α} + (hb : b ∈ homogeneous n) : dynkin (a*b) = act a (dynkin b) := by + induction a using MonoidAlgebra.induction_linear with + | zero => simp + | add a c ha hc => simp [add_mul, ha, hc] + | single v r => + induction hb using Submodule.span_induction with + | mem b hb => + rcases hb with ⟨w,hw,rfl⟩ + have hw' : w.toList ≠ [] := by intro h; simp [h] at hw; omega + simp [dynkin, dynkinWord_append _ _ hw'] + | zero => simp + | add b c _ _ hb hc => simp [mul_add, hb, hc] + | smul r b _ hb => simp [hb] + +theorem dynkin_embed_word {n : ℕ} {p : FL α} + (hp : WeightedWord (fun _ : α => 1) n p) : + 0 < n ∧ embed p ∈ homogeneous n ∧ dynkin (embed p) = (n : ℚ) • p := by + induction hp with + | generator a => + refine ⟨by omega, ?_, ?_⟩ + · simpa [atom] using single_mem_homogeneous (FreeMonoid.of a) 1 rfl + · simp [dynkin, atom, dynkinWord] + | @bracket n m p q hp hq ihp ihq => + rcases ihp with ⟨hn,hn',hpn⟩ + rcases ihq with ⟨hm,hm',hqm⟩ + refine ⟨by omega, ?_, ?_⟩ + · rw [LieHom.map_lie] + change embed p * embed q - embed q * embed p ∈ homogeneous (n+m) + exact (homogeneous (n+m)).sub_mem (mul_homogeneous hn' hm') + (by simpa [Nat.add_comm] using mul_homogeneous hm' hn') + · rw [LieHom.map_lie] + change dynkin (embed p * embed q - embed q * embed p) = _ + rw [map_sub, dynkin_mul hm _ hm', dynkin_mul hn _ hn', hqm, hpn] + simp only [map_smul, act_embed] + rw [← lie_skew q p] + simp only [smul_neg, sub_neg_eq_add, Nat.cast_add, add_smul] + exact add_comm _ _ + +def normalizedDynkin : A α →ₗ[ℚ] FL α := + wordLinear (fun w => (w.toList.length : ℚ)⁻¹ • dynkinWord w.toList) + +theorem normalizedDynkin_homogeneous {n : ℕ} {a : A α} + (ha : a ∈ homogeneous n) : normalizedDynkin a = (n : ℚ)⁻¹ • dynkin a := by + induction ha using Submodule.span_induction with + | mem a ha => + rcases ha with ⟨w,hw,rfl⟩ + simp [normalizedDynkin, dynkin, hw] + | zero => simp + | add a b _ _ ha hb => simp [ha, hb, smul_add] + | smul r a _ ha => + rw [map_smul, map_smul, ha, smul_comm] + +theorem normalizedDynkin_embed_word {n : ℕ} {p : FL α} + (hp : WeightedWord (fun _ : α => 1) n p) : normalizedDynkin (embed p) = p := by + obtain ⟨hn,hn',hp'⟩ := dynkin_embed_word hp + rw [normalizedDynkin_homogeneous hn', hp', smul_smul, inv_mul_cancel₀, one_smul] + exact_mod_cast (Nat.ne_of_gt hn) + +theorem mem_word_span (wt : α → ℕ) (p : FL α) : + p ∈ Submodule.span ℚ {q | ∃ n, WeightedWord wt n q} := by + let S : Submodule ℚ (FL α) := Submodule.span ℚ {q | ∃ n, WeightedWord wt n q} + change p ∈ S + induction p using freeLie_induction with + | h0 => exact S.zero_mem + | hg a => exact Submodule.subset_span ⟨wt a, WeightedWord.generator a⟩ + | ha a b ha hb => exact S.add_mem ha hb + | hs r a ha => exact S.smul_mem r ha + | hl a b ha hb => + induction ha using Submodule.span_induction with + | mem a ha => + rcases ha with ⟨n, hn⟩ + induction hb using Submodule.span_induction with + | mem b hb => + rcases hb with ⟨m, hm⟩ + exact Submodule.subset_span ⟨n+m, WeightedWord.bracket hn hm⟩ + | zero => simp + | add b c _ _ hb hc => simpa only [lie_add] using S.add_mem hb hc + | smul r b _ hb => simpa only [lie_smul] using S.smul_mem r hb + | zero => simp + | add a c _ _ ha hc => simpa only [add_lie] using S.add_mem ha hc + | smul r a _ ha => simpa only [smul_lie] using S.smul_mem r ha + +theorem normalizedDynkin_embed (p : FL α) : normalizedDynkin (embed p) = p := by + have hp := mem_word_span (fun _ : α => 1) p + induction hp using Submodule.span_induction with + | mem a ha => + obtain ⟨n,hn⟩ := ha + exact normalizedDynkin_embed_word hn + | zero => simp + | add a b _ _ ha hb => simp [ha, hb] + | smul r a _ ha => simp [ha] + +theorem embed_injective : Function.Injective (embed (α := α)) := + Function.LeftInverse.injective normalizedDynkin_embed + +end AssociativeModel + +namespace FreeDerivations + +variable {R : Type*} [CommRing R] +variable {M : Type*} [LieRing M] [LieAlgebra R M] + +structure Jet (R M : Type*) [CommRing R] [LieRing M] [LieAlgebra R M] where + base : M + velocity : M + +def Jet.equiv : Jet R M ≃ M × M where + toFun z := (z.base, z.velocity) + invFun z := ⟨z.1, z.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +instance : AddCommGroup (Jet R M) := Jet.equiv.addCommGroup +instance : Module R (Jet R M) := Jet.equiv.addEquiv.module R +instance : Bracket (Jet R M) (Jet R M) := + ⟨fun a b => ⟨⁅a.base, b.base⁆, + ⁅a.velocity, b.base⁆ + ⁅a.base, b.velocity⁆⟩⟩ + +@[ext] theorem Jet.ext {a b : Jet R M} (h : a.base = b.base) + (k : a.velocity = b.velocity) : a = b := by cases a; cases b; simp_all + +@[simp] theorem Jet.base_zero : (0 : Jet R M).base = 0 := rfl +@[simp] theorem Jet.velocity_zero : (0 : Jet R M).velocity = 0 := rfl +@[simp] theorem Jet.base_add (a b : Jet R M) : (a+b).base = a.base+b.base := rfl +@[simp] theorem Jet.velocity_add (a b : Jet R M) : + (a+b).velocity = a.velocity+b.velocity := rfl +@[simp] theorem Jet.base_smul (q : R) (a : Jet R M) : (q • a).base = q • a.base := rfl +@[simp] theorem Jet.velocity_smul (q : R) (a : Jet R M) : + (q • a).velocity = q • a.velocity := rfl +@[simp] theorem Jet.base_lie (a b : Jet R M) : ⁅a,b⁆.base = ⁅a.base,b.base⁆ := rfl +@[simp] theorem Jet.velocity_lie (a b : Jet R M) : + ⁅a,b⁆.velocity = ⁅a.velocity,b.base⁆ + ⁅a.base,b.velocity⁆ := rfl + +instance : LieRing (Jet R M) where + add_lie a b c := by (ext <;> simp [add_lie]); abel + lie_add a b c := by (ext <;> simp [lie_add]); abel + lie_self a := by + ext + · simp + · change ⁅a.velocity, a.base⁆ + ⁅a.base, a.velocity⁆ = 0 + rw [← lie_skew a.velocity a.base] + exact neg_add_cancel _ + leibniz_lie a b c := by (ext <;> simp [lie_add, add_lie, lie_lie]); abel +instance : LieAlgebra R (Jet R M) where + lie_smul q a b := by ext <;> simp [lie_smul, smul_add] + +def Jet.baseHom : Jet R M →ₗ⁅R⁆ M where + toFun := Jet.base + map_add' _ _ := rfl + map_smul' _ _ := rfl + map_lie' {_ _} := rfl + +variable {α : Type*} +local notation "F" => FreeLieAlgebra R α + +def jetLift (f : α → F) : F →ₗ⁅R⁆ Jet R F := + FreeLieAlgebra.lift R (fun a => ⟨FreeLieAlgebra.of R a, f a⟩) + +@[simp] theorem jetLift_base (f : α → F) (p : F) : + (jetLift f p).base = p := by + have h : Jet.baseHom.comp (jetLift f) = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro a + simp [jetLift, Jet.baseHom] + rfl + exact LieHom.congr_fun h p + +def extend (f : α → F) : LieDerivation R F F where + toFun q := (jetLift f q).velocity + map_add' a b := by + change (jetLift f (a+b)).velocity = _ + rw [map_add] + rfl + map_smul' r a := by + change (jetLift f (r • a)).velocity = _ + rw [map_smul] + rfl + leibniz' a b := by + change (jetLift f ⁅a,b⁆).velocity = ⁅a,(jetLift f b).velocity⁆ - ⁅b,(jetLift f a).velocity⁆ + rw [LieHom.map_lie, Jet.velocity_lie, jetLift_base, jetLift_base] + rw [sub_eq_add_neg, lie_skew, add_comm] + +@[simp] theorem extend_of (f : α → F) (a : α) : + extend f (FreeLieAlgebra.of R a) = f a := by + change (jetLift f (FreeLieAlgebra.of R a)).velocity = _ + simp [jetLift] + +@[ext] theorem ext {d₁ d₂ : LieDerivation R F F} + (h : ∀ a, d₁ (FreeLieAlgebra.of R a) = d₂ (FreeLieAlgebra.of R a)) : d₁ = d₂ := by + ext q + induction q using freeLie_induction with + | h0 => simp + | hg a => exact h a + | ha a b ha hb => simp [ha, hb] + | hs r a ha => simp [ha] + | hl a b ha hb => simp [ha, hb] + +theorem extend_unique (f : α → F) (d : LieDerivation R F F) + (h : ∀ a, d (FreeLieAlgebra.of R a) = f a) : d = extend f := by + apply ext + intro a + simpa using h a + +variable [DecidableEq α] +def pair (i j : α) : LieDerivation R F F := + extend (fun k => if k = i then ⁅FreeLieAlgebra.of R i, FreeLieAlgebra.of R j⁆ + else if k = j then ⁅FreeLieAlgebra.of R j, FreeLieAlgebra.of R i⁆ else 0) + +@[simp] theorem pair_of_left (i j : α) : + pair (R := R) i j (FreeLieAlgebra.of R i) = ⁅FreeLieAlgebra.of R i,FreeLieAlgebra.of R j⁆ := by + simp [pair] + +@[simp] theorem pair_of_right (i j : α) : + pair (R := R) i j (FreeLieAlgebra.of R j) = ⁅FreeLieAlgebra.of R j,FreeLieAlgebra.of R i⁆ := by + by_cases h : j = i + · subst j; simp + · simp [pair, h] + +@[simp] theorem pair_of_other (i j k : α) (hi : k ≠ i) (hj : k ≠ j) : + pair (R := R) i j (FreeLieAlgebra.of R k) = 0 := by + simp [pair, hi, hj] + +theorem pair_comm (i j : α) : pair (R := R) i j = pair j i := by + apply ext + intro a + by_cases hi : a=i + · subst a; simp + by_cases hj : a=j + · subst a; simp + simp [hi,hj] + +theorem pair_self (i : α) : pair (R := R) i i = 0 := by + apply ext + intro a + by_cases hi : a=i + · subst a; simp + simp [hi] + +theorem pair_disjoint (i j k l : α) + (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) : + ⁅pair (R := R) i j,pair (R := R) k l⁆ = 0 := by + apply ext + intro a + by_cases hai : a=i + · subst a; simp [hik,hil,hjk,hjl] + by_cases haj : a=j + · subst a; simp [hik,hil,hjk,hjl] + by_cases hak : a=k + · subst a; simp [hik.symm,hjk.symm,hil.symm,hjl.symm] + by_cases hal : a=l + · subst a; simp [hik.symm,hjk.symm,hil.symm,hjl.symm] + simp [hai,haj,hak,hal] + +theorem pair_three (i j k : α) (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅pair (R := R) i j, pair (R := R) i k + pair (R := R) j k⁆ = 0 := by + apply ext + intro a + by_cases hai : a=i + · subst a + simp [hik,hij,hjk,hij.symm,hik.symm,hjk.symm] + grind [lie_skew, lie_lie] + by_cases haj : a=j + · subst a + simp [hik,hij,hjk,hij.symm,hik.symm,hjk.symm] + grind [lie_skew, lie_lie] + by_cases hak : a=k + · subst a + simp [hik.symm,hjk.symm] + grind [lie_skew, lie_lie] + simp [hai,haj,hak] + +end FreeDerivations + +namespace BraidRepresentation +open FreeDerivations LieAlgebra +variable {R α : Type*} [CommRing R] [DecidableEq α] +local notation "F" => FreeLieAlgebra R α +local notation "Der" => LieDerivation R F F +local notation "SD" => SemiDirectSum F Der (LieHom.id : Der →ₗ⁅R⁆ Der) + +def fiber (i : α) : SD := SemiDirectSum.inl LieHom.id (FreeLieAlgebra.of R i) +def base (i j : α) : SD := SemiDirectSum.inr LieHom.id (pair i j) + +def chord : Option α → Option α → SD + | none, none => 0 + | none, some j => fiber j + | some i, none => fiber i + | some i, some j => base i j + +@[simp] theorem chord_none_none : chord (R := R) (α := α) none none = 0 := rfl +@[simp] theorem chord_none_some (j : α) : chord (R := R) none (some j) = fiber j := rfl +@[simp] theorem chord_some_none (i : α) : chord (R := R) (some i) none = fiber i := rfl +@[simp] theorem chord_some_some (i j : α) : chord (R := R) (some i) (some j) = base i j := rfl + +theorem chord_comm (i j : Option α) : chord (R := R) i j = chord j i := by + cases i <;> cases j <;> simp [base, pair_comm] + +@[simp] theorem chord_self (i : Option α) : chord (R := R) i i = 0 := by + cases i <;> simp [base, pair_self] + +theorem base_fiber (i j k : α) : + ⁅base (R := R) i j, fiber k⁆ = SemiDirectSum.inl LieHom.id + (pair (R := R) i j (FreeLieAlgebra.of R k)) := by + simp [base, fiber] + +theorem fiber_base (i j k : α) : + ⁅fiber (R := R) k, base i j⁆ = - SemiDirectSum.inl LieHom.id + (pair (R := R) i j (FreeLieAlgebra.of R k)) := by + rw [← lie_skew, base_fiber] + +theorem chord_disjoint (i j k l : Option α) + (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) : + ⁅chord (R := R) i j, chord (R := R) k l⁆ = 0 := by + cases i <;> cases j <;> cases k <;> cases l <;> + simp_all [base, fiber, pair_disjoint] + all_goals apply pair_of_other <;> intro h <;> subst_vars <;> contradiction + +theorem chord_three (i j k : Option α) + (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅chord (R := R) i j, chord (R := R) i k + chord (R := R) j k⁆ = 0 := by + cases i with + | none => + cases j with + | none => exact (hij rfl).elim + | some j => + cases k with + | none => exact (hik rfl).elim + | some k => + rw [chord_none_some, chord_none_some, chord_some_some, lie_add, fiber_base] + simp [fiber] + grind [lie_skew] + | some i => + cases j with + | none => + cases k with + | none => exact (hjk rfl).elim + | some k => + rw [chord_some_none, chord_some_some, chord_none_some, lie_add, fiber_base] + simp [fiber] + grind [lie_skew] + | some j => + cases k with + | none => + rw [chord_some_some, chord_some_none, chord_some_none, lie_add, + base_fiber, base_fiber] + simp only [pair_of_left, pair_of_right, ← map_add] + grind [lie_skew] + | some k => + simp only [chord_some_some, base, ← map_add, ← LieHom.map_lie] + rw [pair_three _ _ _ (fun h => hij (congrArg some h)) + (fun h => hik (congrArg some h)) (fun h => hjk (congrArg some h)), map_zero] + +end BraidRepresentation + +namespace BraidModel +open LieAlgebra +abbrev Fiber := FreeLieAlgebra ℚ (Fin 3) +abbrev Der := LieDerivation ℚ Fiber Fiber +abbrev Model := SemiDirectSum Fiber Der (LieHom.id : Der →ₗ⁅ℚ⁆ Der) +def chord (i j : Fin 4) : Model := + BraidRepresentation.chord (finSuccEquiv' (1 : Fin 4) i) (finSuccEquiv' (1 : Fin 4) j) + +theorem chord_comm (i j : Fin 4) : chord i j = chord j i := + BraidRepresentation.chord_comm _ _ + +@[simp] theorem chord_self (i : Fin 4) : chord i i = 0 := + BraidRepresentation.chord_self _ + +def preMap : BraidFree →ₗ⁅ℚ⁆ Model := FreeLieAlgebra.lift ℚ (fun e => chord e.val.1 e.val.2) + +@[simp] theorem preMap_chord (i j : Fin 4) : preMap (DeligneDrinfeld.chord i j) = chord i j := by + unfold DeligneDrinfeld.chord + split_ifs with hij hji + · simp [preMap] + · simp [preMap, chord_comm j i] + · have h : i = j := le_antisymm (le_of_not_gt hji) (le_of_not_gt hij) + subst j + simp + +theorem ideal_le_ker : braidIdeal ≤ preMap.ker := by + rw [braidIdeal, LieSubmodule.lieSpan_le] + intro z hz + change preMap z = 0 + rcases hz with ⟨i,j,k,l,hij,hik,hil,hjk,hjl,hkl,rfl⟩ | ⟨i,j,k,hij,hik,hjk,rfl⟩ + · rw [LieHom.map_lie, preMap_chord, preMap_chord] + exact BraidRepresentation.chord_disjoint _ _ _ _ + ((finSuccEquiv' (1 : Fin 4)).injective.ne hik) ((finSuccEquiv' (1 : Fin 4)).injective.ne hil) + ((finSuccEquiv' (1 : Fin 4)).injective.ne hjk) ((finSuccEquiv' (1 : Fin 4)).injective.ne hjl) + · rw [LieHom.map_lie, map_add, preMap_chord, preMap_chord, preMap_chord] + exact BraidRepresentation.chord_three _ _ _ + ((finSuccEquiv' (1 : Fin 4)).injective.ne hij) ((finSuccEquiv' (1 : Fin 4)).injective.ne hik) + ((finSuccEquiv' (1 : Fin 4)).injective.ne hjk) + +def map : T4 →ₗ⁅ℚ⁆ Model := + { braidIdeal.toSubmodule.liftQ preMap.toLinearMap ideal_le_ker with + map_lie' := by + intro a b + induction a using Submodule.Quotient.induction_on with | _ a => + induction b using Submodule.Quotient.induction_on with | _ b => + exact preMap.map_lie a b } + +@[simp] theorem map_t (i j : Fin 4) : map (t i j) = chord i j := preMap_chord i j + +end BraidModel + +namespace AssociativeModel +attribute [local instance] LieRing.ofAssociativeRing +variable {α : Type*} + +theorem coeff_rotate {P : A α} {b : α} (h : atom b * P = P * atom b) (w : List α) : + P.coeff (FreeMonoid.ofList (b :: w)) = P.coeff (FreeMonoid.ofList (w ++ [b])) := by + calc + P.coeff (FreeMonoid.ofList (b :: w)) = + (P * atom b).coeff ((FreeMonoid.of b * FreeMonoid.ofList w) * FreeMonoid.of b) := by + simp [atom, FreeMonoid.ofList_cons] + _ = (atom b * P).coeff (FreeMonoid.of b * (FreeMonoid.ofList w * FreeMonoid.of b)) := by + rw [h, mul_assoc] + _ = P.coeff (FreeMonoid.ofList (w ++ [b])) := by + simp [atom, FreeMonoid.ofList_append] + +theorem coeff_starts_ne {P : A α} {b a : α} (h : atom b * P = P * atom b) + (hab : a ≠ b) (v : List α) : P.coeff (FreeMonoid.ofList (a :: v)) = 0 := by + have hz : (atom b * P).coeff (FreeMonoid.ofList (a::v) * FreeMonoid.of b) = 0 := by + apply MonoidAlgebra.coeff_single_mul_of_forall_mul_ne + intro d hd + have hh := congrArg (fun w : FreeMonoid α => w.toList.head?) hd + exact hab (by simpa using hh.symm) + rw [h] at hz + simpa [atom] using hz + +theorem coeff_contains_ne {P : A α} {b a : α} (h : atom b * P = P * atom b) + (hab : a ≠ b) (u v : List α) : P.coeff (FreeMonoid.ofList (u ++ a :: v)) = 0 := by + induction u generalizing v with + | nil => exact coeff_starts_ne h hab v + | cons c u ih => + by_cases hc : c = b + · subst c + rw [List.cons_append, coeff_rotate h] + simpa [List.append_assoc] using ih (v ++ [b]) + · exact coeff_starts_ne h hc (u ++ a :: v) + +theorem coeff_eq_zero_of_letter_ne {P : A α} {b a : α} + (h : atom b * P = P * atom b) {w : List α} (ha : a ∈ w) (hab : a ≠ b) : + P.coeff (FreeMonoid.ofList w) = 0 := by + obtain ⟨u,v,rfl⟩ := List.append_of_mem ha + exact coeff_contains_ne h hab u v + +theorem dynkinWord_all_eq (b : α) (w : List α) (hw : ∀ a ∈ w, a = b) : + dynkinWord w ∈ Submodule.span ℚ {FreeLieAlgebra.of ℚ b} := by + induction w with + | nil => simp [dynkinWord] + | cons a w ih => + have ha : a = b := hw a (by simp) + subst a + cases w with + | nil => exact Submodule.subset_span (by simp [dynkinWord]) + | cons c w => + rw [dynkinWord] + have hmem := ih (fun a ha => hw a (by simp [ha])) + obtain ⟨r,hr⟩ := Submodule.mem_span_singleton.mp hmem + rw [← hr, lie_smul, lie_self, smul_zero] + exact Submodule.zero_mem _ + +theorem centralizer_generator {p : FL α} (b : α) (h : ⁅FreeLieAlgebra.of ℚ b,p⁆ = 0) : + p ∈ Submodule.span ℚ {FreeLieAlgebra.of ℚ b} := by + classical + have hc : atom b * embed p = embed p * atom b := by + have ht := congrArg embed h + rw [LieHom.map_lie, embed_of, map_zero] at ht + exact sub_eq_zero.mp ht + rw [← normalizedDynkin_embed p, ← MonoidAlgebra.sum_coeff_single (embed p)] + unfold Finsupp.sum + rw [map_sum] + apply Submodule.sum_mem + intro w hw + rw [normalizedDynkin, wordLinear_single] + apply Submodule.smul_mem + apply Submodule.smul_mem + apply dynkinWord_all_eq + intro a ha + by_contra hab + have hz := coeff_eq_zero_of_letter_ne hc ha hab + have hn := Finsupp.mem_support_iff.mp hw + exact hn (by simpa using hz) + +end AssociativeModel + +theorem map_eval {M N : Type*} [LieRing M] [LieAlgebra ℚ M] + [LieRing N] [LieAlgebra ℚ N] (f : M →ₗ⁅ℚ⁆ N) (a b : M) (p : L) : + f (eval a b p) = eval (f a) (f b) p := by + have h : f.comp (eval a b) = eval (f a) (f b) := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [eval] + exact LieHom.congr_fun h p + +theorem eval_self : eval x y = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [eval, x, y] + +theorem eval_commutes {M : Type*} [LieRing M] [LieAlgebra ℚ M] + (a b z : M) (ha : ⁅z,a⁆ = 0) (hb : ⁅z,b⁆ = 0) (p : L) : + ⁅z,eval a b p⁆ = 0 := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [eval, ha, hb] + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => simp [LieHom.map_lie, leibniz_lie, hp, hq] + +@[simp] theorem chord_comm (i j : Fin 4) : chord i j = chord j i := by + unfold chord + split_ifs <;> first | rfl | omega + +@[simp] theorem t_comm (i j : Fin 4) : t i j = t j i := by + unfold t + rw [chord_comm] + +theorem t_disjoint (i j k l : Fin 4) + (hij : i ≠ j) (hik : i ≠ k) (hil : i ≠ l) + (hjk : j ≠ k) (hjl : j ≠ l) (hkl : k ≠ l) : + ⁅t i j,t k l⁆ = 0 := by + rw [t, t, ← LieSubmodule.Quotient.mk_bracket, LieSubmodule.Quotient.mk_eq_zero'] + exact LieSubmodule.subset_lieSpan (Or.inl ⟨i,j,k,l,hij,hik,hil,hjk,hjl,hkl,rfl⟩) + +theorem t_three (i j k : Fin 4) (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅t i j,t i k + t j k⁆ = 0 := by + change LieSubmodule.Quotient.mk (⁅chord i j, chord i k + chord j k⁆) = (0 : T4) + rw [LieSubmodule.Quotient.mk_eq_zero'] + exact LieSubmodule.subset_lieSpan (Or.inr ⟨i,j,k,hij,hik,hjk,rfl⟩) + +namespace BraidModel + +def inclusion : Fiber →ₗ⁅ℚ⁆ T4 := FreeLieAlgebra.lift ℚ + (fun i => t 1 ((finSuccEquiv' (1 : Fin 4)).symm (some i))) + +theorem map_inclusion : map.comp inclusion = LieAlgebra.SemiDirectSum.inl LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro i + simp [inclusion, chord, BraidRepresentation.fiber] + +theorem inclusion_injective : Function.Injective inclusion := by + intro a b hab + have h := congrArg map hab + have hm (c : Fiber) : map (inclusion c) = LieAlgebra.SemiDirectSum.inl LieHom.id c := + LieHom.congr_fun map_inclusion c + rw [hm,hm] at h + exact LieAlgebra.SemiDirectSum.inl_injective _ h + +end BraidModel + +theorem commute_symm {M : Type*} [LieRing M] {a b : M} (h : ⁅a,b⁆ = 0) : ⁅b,a⁆ = 0 := by + rw [← lie_skew, h, neg_zero] + +theorem evals_commute {M : Type*} [LieRing M] [LieAlgebra ℚ M] + (a b c d : M) (hac : ⁅a,c⁆ = 0) (had : ⁅a,d⁆ = 0) + (hbc : ⁅b,c⁆ = 0) (hbd : ⁅b,d⁆ = 0) (p q : L) : + ⁅eval a b p,eval c d q⁆ = 0 := by + apply eval_commutes + · exact commute_symm (eval_commutes a b c (commute_symm hac) (commute_symm hbc) p) + · exact commute_symm (eval_commutes a b d (commute_symm had) (commute_symm hbd) p) + +theorem eval_add_of_commuting {M : Type*} [LieRing M] [LieAlgebra ℚ M] + (a b c d : M) (hac : ⁅a,c⁆ = 0) (had : ⁅a,d⁆ = 0) + (hbc : ⁅b,c⁆ = 0) (hbd : ⁅b,d⁆ = 0) (p : L) : + eval (a+c) (b+d) p = eval a b p + eval c d p := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [eval] + | ha p q hp hq => simp [hp,hq]; abel + | hs r p hp => simp [hp,smul_add] + | hl p q hp hq => + simp only [LieHom.map_lie, hp, hq, add_lie, lie_add] + rw [evals_commute a b c d hac had hbc hbd p q, + commute_symm (evals_commute a b c d hac had hbc hbd q p)] + simp + +theorem eval_vanish_of_commuting {M : Type*} [LieRing M] [LieAlgebra ℚ M] + (a b : M) (hab : ⁅a,b⁆ = 0) {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 < n) : + eval a b p = 0 := by + induction hp using Submodule.span_induction with + | mem p hp => + cases hp with + | generator i => omega + | @bracket n m p q hp hq => + rw [LieHom.map_lie] + exact evals_commute a b a b (lie_self a) hab (commute_symm hab) (lie_self b) p q + | zero => simp + | add p q _ _ hp hq => simp [hp,hq] + | smul r p _ hp => simp [hp] + +theorem eval_central_shift {M : Type*} [LieRing M] [LieAlgebra ℚ M] + (a b c : M) (hac : ⁅a,c⁆ = 0) (hbc : ⁅b,c⁆ = 0) + {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 < n) : + eval a (b+c) p = eval a b p := by + have h := eval_add_of_commuting a b 0 c (lie_zero a) hac (lie_zero b) hbc p + simpa [eval_vanish_of_commuting 0 c (zero_lie c) hp hn] using h + +namespace T4Universal +variable {M : Type*} [LieRing M] [LieAlgebra ℚ M] + +def pre (f : Fin 4 → Fin 4 → M) : BraidFree →ₗ⁅ℚ⁆ M := + FreeLieAlgebra.lift ℚ (fun e => f e.val.1 e.val.2) + +theorem pre_chord (f : Fin 4 → Fin 4 → M) + (hs : ∀ i j, f i j = f j i) (hz : ∀ i, f i i = 0) (i j : Fin 4) : + pre f (chord i j) = f i j := by + unfold chord + split_ifs with hij hji + · simp [pre] + · simp [pre, hs j i] + · have h : i = j := le_antisymm (le_of_not_gt hji) (le_of_not_gt hij) + subst j + simp [hz] + +def lift (f : Fin 4 → Fin 4 → M) + (hs : ∀ i j, f i j = f j i) (hz : ∀ i, f i i = 0) + (hd : ∀ i j k l, i ≠ j → i ≠ k → i ≠ l → j ≠ k → j ≠ l → k ≠ l → + ⁅f i j,f k l⁆ = 0) + (ht : ∀ i j k, i ≠ j → i ≠ k → j ≠ k → ⁅f i j,f i k+f j k⁆ = 0) : T4 →ₗ⁅ℚ⁆ M := by + have hker : braidIdeal ≤ (pre f).ker := by + rw [braidIdeal, LieSubmodule.lieSpan_le] + intro z hz' + change pre f z = 0 + rcases hz' with ⟨i,j,k,l,hij,hik,hil,hjk,hjl,hkl,rfl⟩ | ⟨i,j,k,hij,hik,hjk,rfl⟩ + · simpa only [LieHom.map_lie, pre_chord f hs hz] using hd i j k l hij hik hil hjk hjl hkl + · simpa only [LieHom.map_lie, map_add, pre_chord f hs hz] using ht i j k hij hik hjk + exact { braidIdeal.toSubmodule.liftQ (pre f).toLinearMap hker with + map_lie' := by + intro a b + induction a using Submodule.Quotient.induction_on with | _ a => + induction b using Submodule.Quotient.induction_on with | _ b => + exact (pre f).map_lie a b } + +@[simp] theorem lift_t (f : Fin 4 → Fin 4 → M) (hs hz hd ht) (i j : Fin 4) : + lift f hs hz hd ht (t i j) = f i j := pre_chord f hs hz i j + +end T4Universal + +@[simp] theorem t_self (i : Fin 4) : t i i = 0 := by simp [t, chord] + +def t4Rename (e : Equiv.Perm (Fin 4)) : T4 →ₗ⁅ℚ⁆ T4 := + T4Universal.lift (fun i j => t (e i) (e j)) + (fun _ _ => t_comm _ _) (fun _ => t_self _) + (fun _ _ _ _ hij hik hil hjk hjl hkl => t_disjoint _ _ _ _ + (e.injective.ne hij) (e.injective.ne hik) (e.injective.ne hil) + (e.injective.ne hjk) (e.injective.ne hjl) (e.injective.ne hkl)) + (fun _ _ _ hij hik hjk => t_three _ _ _ + (e.injective.ne hij) (e.injective.ne hik) (e.injective.ne hjk)) + +@[simp] theorem t4Rename_t (e : Equiv.Perm (Fin 4)) (i j : Fin 4) : + t4Rename e (t i j) = t (e i) (e j) := T4Universal.lift_t _ _ _ _ _ _ _ + +theorem solution_swap {p : L} (hp : p ∈ W) + {M : Type*} [LieRing M] [LieAlgebra ℚ M] (a b : M) : + eval a b p = - eval b a p := by + have h := congrArg (eval a b) hp.1 + simp only [map_add, map_zero, map_eval, eval_x, eval_y] at h + exact eq_neg_of_add_eq_zero_left h + +theorem solution_three {p : L} (hp : p ∈ W) + {M : Type*} [LieRing M] [LieAlgebra ℚ M] (a b : M) : + eval a b p + eval b (-a-b) p + eval (-a-b) a p = 0 := by + have h := congrArg (eval a b) hp.2.1 + simpa only [map_add, map_zero, map_eval, map_sub, map_neg, eval_x, eval_y] using h + +theorem free_action_inner {R α β Z : Type*} [CommRing R] + [LieRing Z] [LieAlgebra R Z] + (f : FreeLieAlgebra R α →ₗ⁅R⁆ Z) (g : FreeLieAlgebra R β →ₗ⁅R⁆ Z) + (h : FreeLieAlgebra R β →ₗ⁅R⁆ LieDerivation R (FreeLieAlgebra R α) (FreeLieAlgebra R α)) + (hg : ∀ b a, f (h (FreeLieAlgebra.of R b) (FreeLieAlgebra.of R a)) = + ⁅g (FreeLieAlgebra.of R b),f (FreeLieAlgebra.of R a)⁆) + (q : FreeLieAlgebra R β) (p : FreeLieAlgebra R α) : + f (h q p) = ⁅g q,f p⁆ := by + have H : ∀ q : FreeLieAlgebra R β, ∀ p : FreeLieAlgebra R α, + f (h q p) = ⁅g q,f p⁆ := by + intro q + induction q using freeLie_induction with + | h0 => intro p; simp + | hg b => + intro p + induction p using freeLie_induction with + | h0 => simp + | hg a => exact hg b a + | ha p r hp hr => simp [hp,hr] + | hs c p hp => simp [hp] + | hl p r hp hr => + simp [hp,hr,LieHom.map_lie] + grind [lie_lie,lie_skew] + | ha q r hq hr => intro p; simp [hq,hr] + | hs c q hq => intro p; simp [hq] + | hl q r hq hr => intro p; simp [LieHom.map_lie,hq,hr,lie_lie] + exact H q p + +namespace InnerSemiDirect +open LieAlgebra +variable {R K B Z : Type*} [CommRing R] + [LieRing K] [LieAlgebra R K] [LieRing B] [LieAlgebra R B] + [LieRing Z] [LieAlgebra R Z] +variable (action : B →ₗ⁅R⁆ LieDerivation R K K) + (f : K →ₗ⁅R⁆ Z) (g : B →ₗ⁅R⁆ Z) + (h : ∀ q p, f (action q p) = ⁅g q,f p⁆) + +def lift : SemiDirectSum K B action →ₗ⁅R⁆ Z where + toFun z := f z.left + g z.right + map_add' z t := by simp; abel + map_smul' c z := by simp [smul_add] + map_lie' {z t} := by + simp only [SemiDirectSum.lie_eq_mk, map_sub, map_add, LieHom.map_lie, h, + add_lie, lie_add] + rw [sub_eq_add_neg, lie_skew] + abel + +@[simp] theorem lift_inl (p : K) : lift action f g h (SemiDirectSum.inl action p) = f p := by + simp [lift] +@[simp] theorem lift_inr (p : B) : lift action f g h (SemiDirectSum.inr action p) = g p := by + simp [lift] +end InnerSemiDirect + +namespace SpecialFiber +open LieAlgebra FreeDerivations +abbrev F := FreeLieAlgebra ℚ (Fin 3) +def fa : F := FreeLieAlgebra.of ℚ 0 +def fb : F := FreeLieAlgebra.of ℚ 1 +def fc : F := FreeLieAlgebra.of ℚ 2 + +def action : L →ₗ⁅ℚ⁆ LieDerivation ℚ F F := eval (pair 0 1) (pair 1 2) +abbrev M := SemiDirectSum F L action + +def a : M := SemiDirectSum.inl action fa +def b : M := SemiDirectSum.inl action fb +def c : M := SemiDirectSum.inl action fc +def u : M := SemiDirectSum.inr action x +def v : M := SemiDirectSum.inr action y +def w : M := -a-b-c-u-v + +theorem au : ⁅a,u⁆ = -⁅a,b⁆ := by + simp only [a,u,b, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk, SemiDirectSum.neg_eq_mk] + ext <;> simp [action,fa,fb] +theorem bu : ⁅b,u⁆ = ⁅a,b⁆ := by + simp only [a,u,b, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fa,fb] +theorem cu : ⁅c,u⁆ = 0 := by + simp only [c,u, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fc] +theorem av : ⁅a,v⁆ = 0 := by + simp only [a,v, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fa] +theorem bv : ⁅b,v⁆ = -⁅b,c⁆ := by + simp only [b,v,c, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk, SemiDirectSum.neg_eq_mk] + ext <;> simp [action,fb,fc] +theorem cv : ⁅c,v⁆ = ⁅b,c⁆ := by + simp only [b,v,c, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fb,fc] + +def chord (i j : Fin 4) : M := + match i.val, j.val with + | 0,1 | 1,0 => a + | 0,2 | 2,0 => u + | 0,3 | 3,0 => w + | 1,2 | 2,1 => b + | 1,3 | 3,1 => c + | 2,3 | 3,2 => v + | _,_ => 0 + +private theorem chord_symm (i j : Fin 4) : chord i j = chord j i := by + fin_cases i <;> fin_cases j <;> rfl + +private theorem chord_zero (i : Fin 4) : chord i i = 0 := by fin_cases i <;> rfl + +private theorem chord_disjoint (i j k l : Fin 4) + (hij : i ≠ j) (hik : i ≠ k) (hil : i ≠ l) + (hjk : j ≠ k) (hjl : j ≠ l) (hkl : k ≠ l) : ⁅chord i j,chord k l⁆ = 0 := by + fin_cases i <;> fin_cases j <;> simp_all only [ne_eq, not_true_eq_false] + all_goals fin_cases k <;> simp_all only [not_true_eq_false] + all_goals fin_cases l <;> simp_all only [not_true_eq_false] + all_goals dsimp only [chord] + all_goals simp only [w, lie_sub, sub_lie, lie_neg, neg_lie, + bu,cu,av,bv,lie_self] + all_goals grind [lie_skew, au,bu,cu,av,bv,cv] + +private theorem chord_three (i j k : Fin 4) + (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅chord i j,chord i k+chord j k⁆ = 0 := by + fin_cases i <;> fin_cases j <;> simp_all only [ne_eq, not_true_eq_false] + all_goals fin_cases k <;> simp_all only [not_true_eq_false] + all_goals dsimp only [chord] + all_goals simp only [w, lie_sub, sub_lie, lie_neg, neg_lie, lie_add, + au,bu,cu,av,bv,cv,lie_self] + all_goals grind [lie_skew, au,bu,cu,av,bv,cv] + +def representation : T4 →ₗ⁅ℚ⁆ M := + T4Universal.lift chord chord_symm chord_zero chord_disjoint chord_three + +@[simp] theorem representation_t (i j : Fin 4) : representation (t i j) = chord i j := + T4Universal.lift_t _ _ _ _ _ _ _ + +def fiberSpec : F →ₗ⁅ℚ⁆ L := FreeLieAlgebra.lift ℚ + (fun i => if i = 0 then x else if i = 1 then y else -x-y) +def baseSpec : L →ₗ⁅ℚ⁆ L := eval (-x-y) x + +@[simp] theorem fiberSpec_fa : fiberSpec fa = x := by simp [fiberSpec,fa] +@[simp] theorem fiberSpec_fb : fiberSpec fb = y := by simp [fiberSpec,fb] +@[simp] theorem fiberSpec_fc : fiberSpec fc = -x-y := by simp [fiberSpec,fc] +@[simp] theorem baseSpec_x : baseSpec x = -x-y := eval_x _ _ +@[simp] theorem baseSpec_y : baseSpec y = x := eval_y _ _ + +theorem spec_equivariant (q : L) (p : F) : + fiberSpec (action q p) = ⁅baseSpec q,fiberSpec p⁆ := by + apply free_action_inner + intro i j + cases i <;> fin_cases j <;> + simp [action, eval, baseSpec, fiberSpec, FreeDerivations.pair, + x,y,sub_lie,neg_lie,lie_sub,lie_neg] + +def specialize : M →ₗ⁅ℚ⁆ L := InnerSemiDirect.lift action fiberSpec baseSpec spec_equivariant + +@[simp] theorem specialize_a : specialize a = x := by simp [specialize,a, InnerSemiDirect.lift] +@[simp] theorem specialize_b : specialize b = y := by simp [specialize,b, InnerSemiDirect.lift] +@[simp] theorem specialize_c : specialize c = -x-y := by simp [specialize,c, InnerSemiDirect.lift] +@[simp] theorem specialize_u : specialize u = -x-y := by simp [specialize,u, InnerSemiDirect.lift] +@[simp] theorem specialize_v : specialize v = x := by simp [specialize,v, InnerSemiDirect.lift] + +@[simp] theorem eval_right (d e : M) (p : L) : + (eval d e p).right = eval d.right e.right p := + map_eval (SemiDirectSum.projr action) d e p + +def Fa (p : L) : F := (eval (u+b) v p - eval u v p).left +def Fb (p : L) : F := (eval (u+a) (v+c) p - eval u v p).left +def Fc (p : L) : F := (eval u (v+b) p - eval u v p).left + + theorem Fa_inl (p : L) : SemiDirectSum.inl action (Fa p) = eval (u+b) v p - eval u v p := by + ext + · rfl + · simp [eval_right, u,b,v] + theorem Fb_inl (p : L) : SemiDirectSum.inl action (Fb p) = eval (u+a) (v+c) p - eval u v p := by + ext + · rfl + · simp [eval_right, u,a,v,c] + theorem Fc_inl (p : L) : SemiDirectSum.inl action (Fc p) = eval u (v+b) p - eval u v p := by + ext + · rfl + · simp [eval_right, u,b,v] + +theorem eval_comm_a (p : L) : ⁅a,eval (u+b) v p⁆ = 0 := by + apply eval_commutes + · rw [lie_add,au]; exact neg_add_cancel _ + · exact av +theorem eval_comm_b (p : L) : ⁅b,eval (u+a) (v+c) p⁆ = 0 := by + apply eval_commutes + · rw [lie_add,bu]; grind [lie_skew] + · rw [lie_add,bv]; exact neg_add_cancel _ +theorem eval_comm_c (p : L) : ⁅c,eval u (v+b) p⁆ = 0 := by + apply eval_commutes + · exact cu + · rw [lie_add,cv]; grind [lie_skew] +theorem eval_comm_sum (p : L) : ⁅a+b+c,eval u v p⁆ = 0 := by + apply eval_commutes + · rw [add_lie,add_lie,au,bu,cu]; abel + · rw [add_lie,add_lie,av,bv,cv]; abel + +theorem fiber_identity (p : L) : + ⁅fa+fb+fc,Fb p⁆ = ⁅fa,Fb p-Fa p⁆ + ⁅fc,Fb p-Fc p⁆ := by + apply SemiDirectSum.inl_injective action + simp only [LieHom.map_lie, map_add, map_sub, Fa_inl,Fb_inl,Fc_inl] + change ⁅a+b+c,eval (u+a) (v+c) p - eval u v p⁆ = + ⁅a,(eval (u+a) (v+c) p - eval u v p) - (eval (u+b) v p - eval u v p)⁆ + + ⁅c,(eval (u+a) (v+c) p - eval u v p) - (eval u (v+b) p - eval u v p)⁆ + rw [lie_sub,eval_comm_sum] + simp only [lie_sub,add_lie,eval_comm_a,eval_comm_b,eval_comm_c] + abel + +theorem Fb_specialize {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 t + | n+1, t => ⁅a,adPower a n t⁆ + +omit [LieAlgebra ℚ M] in +@[simp] theorem adPower_zero (a t : M) : adPower a 0 t = t := rfl +omit [LieAlgebra ℚ M] in +@[simp] theorem adPower_succ (a t : M) (n : ℕ) : adPower a (n+1) t = ⁅a,adPower a n t⁆ := rfl +@[simp] theorem adPower_smul (a t : M) (n : ℕ) (r : ℚ) : + adPower a n (r • t) = r • adPower a n t := by + induction n <;> simp_all +omit [LieAlgebra ℚ M] in +@[simp] theorem adPower_zero_right (a : M) (n : ℕ) : adPower a n 0 = 0 := by + induction n <;> simp_all +omit [LieAlgebra ℚ M] in +@[simp] theorem adPower_self (a : M) {n : ℕ} (hn : 0 omega + | succ n => + induction n with + | zero => simp + | succ n ih => simp_all +omit [LieAlgebra ℚ M] in +@[simp] theorem adPower_zero_left (t : M) {n : ℕ} (hn : 0 simp_all + +def slope (p : L) (a b da db : M) : M := + (eval (Jet.mk a da : Jet ℚ M) (Jet.mk b db) p).velocity + +@[simp] theorem slope_x (a b da db : M) : slope x a b da db = da := by simp [slope] +@[simp] theorem slope_y (a b da db : M) : slope y a b da db = db := by simp [slope] +@[simp] theorem slope_zero (a b da db : M) : slope 0 a b da db = 0 := by simp [slope] +@[simp] theorem slope_add (p q : L) (a b da db : M) : + slope (p+q) a b da db = slope p a b da db + slope q a b da db := by simp [slope] +@[simp] theorem slope_smul (r : ℚ) (p : L) (a b da db : M) : + slope (r • p) a b da db = r • slope p a b da db := by simp [slope] +@[simp] theorem slope_lie (p q : L) (a b da db : M) : + slope ⁅p,q⁆ a b da db = ⁅slope p a b da db,eval a b q⁆ + + ⁅eval a b p,slope q a b da db⁆ := by simp [slope,LieHom.map_lie] + +@[simp] theorem slope_zero_direction (p : L) (a b : M) : slope p a b 0 0 = 0 := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => simp [hp,hq] + +theorem slope_add_direction (p : L) (a b da db ea eb : M) : + slope p a b (da+ea) (db+eb) = slope p a b da db + slope p a b ea eb := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq]; abel + | hs r p hp => simp [hp,smul_add] + | hl p q hp hq => simp [hp,hq,add_lie,lie_add]; abel + +theorem slope_smul_direction (p : L) (a b da db : M) (r : ℚ) : + slope p a b (r • da) (r • db) = r • slope p a b da db := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq,smul_add] + | hs s p hp => simp [hp,smul_comm s r] + | hl p q hp hq => simp [hp,hq,smul_add] + +theorem word_pos {n : ℕ} {p : L} (hp : WeightedWord (fun _:Bool => 1) n p) : 0 omega + | bracket hp hq ihp ihq => omega + +def DiagonalData (n : ℕ) (p : L) (s k : ℚ) : Prop := + (n ≠ 1 → s = 0) ∧ ∀ (M : Type) [LieRing M] [LieAlgebra ℚ M] (a t : M), + eval (Jet.mk a 0 : Jet ℚ M) (Jet.mk (-a) t) p = + Jet.mk (s • a) (k • adPower a (n-1) t) + +theorem diagonal_bracket {n m : ℕ} {p q : L} {s k t l : ℚ} + (hn : 0 < n) (hm : 0 < m) (hp : DiagonalData n p s k) (hq : DiagonalData m q t l) : + ∃ r : ℚ, DiagonalData (n+m) ⁅p,q⁆ 0 r := by + rcases hp with ⟨hs,hp⟩ + rcases hq with ⟨ht,hq⟩ + by_cases hn1 : n=1 <;> by_cases hm1 : m=1 + · subst n; subst m + refine ⟨s*l-t*k, fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext + · simp + · change ⁅k • b,t • a⁆ + ⁅s • a,l • b⁆ = (s*l-t*k) • ⁅a,b⁆ + rw [smul_lie,lie_smul,←lie_skew b a,smul_neg,smul_lie,lie_smul] + simp only [sub_smul,mul_smul] + module + · subst n + have ht0 := ht hm1 + subst t + refine ⟨s*l, fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext + · simp + · have he : 1+m-1 = (m-1)+1 := by omega + simp [he,mul_smul,smul_comm l s] + · subst m + have hs0 := hs hn1 + subst s + refine ⟨-(t*k), fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext + · simp + · have he : n+1-1 = (n-1)+1 := by omega + simp only [Jet.velocity_lie,zero_smul,zero_lie,he,adPower_succ, + smul_lie,lie_smul,neg_smul,mul_smul] + rw [←lie_skew (adPower a (n-1) b) a,smul_neg,smul_neg] + rw [smul_comm] + simp + · have hs0 := hs hn1 + have ht0 := ht hm1 + subst s; subst t + refine ⟨0, fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext <;> simp + +theorem diagonal_word {n : ℕ} {p : L} (hp : WeightedWord (fun _:Bool => 1) n p) : + ∃ s k : ℚ, DiagonalData n p s k := by + induction hp with + | generator i => + cases i + · refine ⟨1,0, ?_⟩ + constructor + · simp + · intro M _ _ a b; simp [eval] + · refine ⟨-1,1, ?_⟩ + constructor + · simp + · intro M _ _ a b; simp [eval] + | bracket hp hq ihp ihq => + rcases ihp with ⟨s,k,hp'⟩ + rcases ihq with ⟨t,l,hq'⟩ + obtain ⟨r,hr⟩ := diagonal_bracket (word_pos hp) (word_pos hq) hp' hq' + exact ⟨0,r,hr⟩ + +theorem diagonal_homogeneous {n : ℕ} {p : L} (hp : p ∈ Ln n) : + ∃ s k : ℚ, DiagonalData n p s k := by + induction hp using Submodule.span_induction with + | mem p hp => exact diagonal_word hp + | zero => + refine ⟨0,0,fun _ => rfl,?_⟩ + intro M _ _ a b + ext <;> simp + | add p q _ _ hp hq => + rcases hp with ⟨s,k,hs,hp⟩ + rcases hq with ⟨t,l,ht,hq⟩ + refine ⟨s+t,k+l,fun hn => by simp [hs hn,ht hn],?_⟩ + intro M _ _ a b + rw [map_add,hp,hq] + ext <;> simp [add_smul] + | smul r p _ hp => + rcases hp with ⟨s,k,hs,hp⟩ + refine ⟨r*s,r*k,fun hn => by simp [hs hn],?_⟩ + intro M _ _ a b + rw [map_smul,hp] + ext <;> simp [mul_smul] + + theorem slope_neg_direction (p : L) (a b da db : M) : + slope p a b (-da) (-db) = -slope p a b da db := by + simpa using slope_smul_direction p a b da db (-1) + + theorem slope_inner (p : L) (a b t : M) : + slope p a b ⁅t,a⁆ ⁅t,b⁆ = ⁅t,eval a b p⁆ := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq,lie_add] + | hs r p hp => simp [hp] + | hl p q hp hq => simp [hp,hq,LieHom.map_lie,lie_lie] + + theorem slope_swap {p : L} (hp : p ∈ W) (a b da db : M) : + slope p a b da db = -slope p b a db da := by + exact congrArg Jet.velocity (solution_swap hp (Jet.mk a da : Jet ℚ M) (Jet.mk b db)) + + theorem diagonal_slope {n : ℕ} {p : L} {s k : ℚ} + (hp : DiagonalData n p s k) (a t : M) : + slope p a (-a) 0 t = k • adPower a (n-1) t := + congrArg Jet.velocity (hp.2 M a t) + + theorem diagonal_first {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 if i=0 then a else if i=1 then b else c) +@[simp] theorem fiberEval_fa (a b c : M) : fiberEval a b c SpecialFiber.fa = a := by + simp [fiberEval,SpecialFiber.fa] +@[simp] theorem fiberEval_fb (a b c : M) : fiberEval a b c SpecialFiber.fb = b := by + simp [fiberEval,SpecialFiber.fb] +@[simp] theorem fiberEval_fc (a b c : M) : fiberEval a b c SpecialFiber.fc = c := by + simp [fiberEval,SpecialFiber.fc] + + theorem fiberEval_spec (a b : M) (z : SpecialFiber.F) : + fiberEval a b (-a-b) z = eval a b (SpecialFiber.fiberSpec z) := by + have h : fiberEval a b (-a-b) = (eval a b).comp SpecialFiber.fiberSpec := by + apply FreeLieAlgebra.hom_ext + intro i + fin_cases i <;> simp [fiberEval,SpecialFiber.fiberSpec] + exact LieHom.congr_fun h z + +@[simp] theorem fiberEval_base (a b c : Jet ℚ M) (z : SpecialFiber.F) : + (fiberEval a b c z).base = fiberEval a.base b.base c.base z := by + have h : Jet.baseHom.comp (fiberEval a b c) = fiberEval a.base b.base c.base := by + apply FreeLieAlgebra.hom_ext + intro i + fin_cases i <;> simp [fiberEval,Jet.baseHom] <;> rfl + exact LieHom.congr_fun h z + + theorem fiberEval_Fb {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 simp + rw [hc] at H + simp only [Jet.mk_add,Jet.mk_neg,Jet.mk_sub,zero_add,add_zero,neg_zero,sub_zero,zero_sub] at H + have Hv := congrArg Jet.velocity H + simp only [Jet.velocity_lie,Jet.velocity_sub,Jet.velocity_add,Jet.velocity_neg, + Jet.base_add,Jet.base_sub,Jet.base_neg,eval_base,fiberEval_base] at Hv + have hdiagNeg : -(-a-b) = a+b := by abel + have hba : b+(-a-b) = -a := by abel + have hab : -b-(-a-b) = a := by abel + have hc0 : eval (-a-b) (a+b) p = 0 := by + have h := eval_vanish_of_commuting (-a-b) (-(-a-b)) (by simp only [lie_neg,lie_self,neg_zero]) hpn hn + simpa only [hdiagNeg] using h + have hdelc : -eval (-a-b) (a+b) p + eval (-a-b) b p + eval b (-b-a) p = 0 := by + rw [hc0,neg_zero,zero_add,solution_swap hp (-a-b) b] + have he : -b-a = -a-b := by abel + rw [he,neg_add_cancel] + have hdp : slope p (-a-b) (a+b) t 0 = k • adPower (-a-b) (n-1) t := by + rw [← hdiagNeg,diagonal_first hpn hn,diagonal_slope hdiag] + have hdm : slope p b a 0 (-t) = -slope p b a 0 t := by + simpa only [neg_zero] using slope_neg_direction p b a 0 t + have hswap := slope_swap hp (-a-b) b t 0 + have hnp : n=(n-1)+1 := by omega + change ⁅t,fiberEval a b (-a-b) (SpecialFiber.Fb p)⁆ + ⁅(0:M),_⁆ = + (⁅(0:M),_⁆ + ⁅a,slope p a (b+(-a-b)) 0 t - slope p a b 0 0 - + slope p b (-b-(-a-b)) 0 (-t)⁆) + + (⁅t,-eval (-a-b) (a+b) p + eval (-a-b) b p + eval b (-b-a) p⁆ + + ⁅-a-b,-slope p (-a-b) (a+b) t 0 + slope p (-a-b) b t 0 + + slope p b (-b-a) 0 0⁆) at Hv + rw [fiberEval_Fb hpn hn,hdelc,hba,hab,slope_zero_direction,slope_zero_direction, + diagonal_slope hdiag,hdp,hdm,hswap] at Hv + simp only [zero_lie,lie_zero,add_zero,zero_add,sub_zero,lie_neg,lie_sub,lie_add,lie_smul] at Hv + rw [show ⁅a,adPower a (n-1) t⁆ = adPower a n t by rw [hnp]; rfl, + show ⁅-a-b,adPower (-a-b) (n-1) t⁆ = adPower (-a-b) n t by rw [hnp]; rfl] at Hv + rw [smul_sub] + grind only + + theorem slope_G_formula {n : ℕ} {p : L} {k : ℚ} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 1 apply Jet.ext <;> rfl + map_smul' r a := by apply Jet.ext <;> apply Jet.ext <;> rfl + map_lie' {a b} := by + apply Jet.ext <;> apply Jet.ext + all_goals simp only [Jet.base_lie,Jet.velocity_lie,Jet.base_add,Jet.velocity_add] + all_goals first | rfl | abel + +theorem mixed_slope (p : L) (a b u v : M) : + (slope p (Jet.mk a u : Jet ℚ M) (Jet.mk b 0) (Jet.mk v 0) 0).velocity = + (slope p (Jet.mk a v : Jet ℚ M) (Jet.mk b 0) (Jet.mk u 0) 0).velocity := by + have h := map_eval (swapJet : Jet ℚ (Jet ℚ M) →ₗ⁅ℚ⁆ Jet ℚ (Jet ℚ M)) + (Jet.mk (Jet.mk a u) (Jet.mk v 0)) (Jet.mk (Jet.mk b 0) 0) p + exact congrArg (fun z => z.velocity.velocity) h + +@[simp] theorem adPower_base (a t : Jet ℚ M) (n : ℕ) : + (adPower a n t).base = adPower a.base n t.base := by + induction n <;> simp_all + +theorem adPower_radial (a t : M) (n : ℕ) : + (adPower (Jet.mk a a : Jet ℚ M) n (Jet.mk t 0)).velocity = + (n : ℚ) • adPower a n t := by + induction n with + | zero => simp + | succ n ih => + simp only [adPower_succ,Jet.velocity_lie,adPower_base,ih,lie_smul, + Nat.cast_add,Nat.cast_one,add_smul,one_smul] + abel + +theorem adPower_transverse_self (a t : M) {n : ℕ} (hn : 0 omega + | succ n => + induction n with + | zero => simp [lie_skew] + | succ n ih => + rw [adPower_succ,Jet.velocity_lie,adPower_base] + change ⁅t,adPower a (n+1) a⁆ + + ⁅a,(adPower (Jet.mk a t : Jet ℚ M) (n+1) (Jet.mk a 0)).velocity⁆ = _ + rw [adPower_self a (n := n+1) (by omega),lie_zero,zero_add,ih (by omega),lie_neg] + rfl + +theorem adPower_zero_base (a t : M) {n : ℕ} (hn : 1 omega + | succ n => + simp only [adPower_succ,Jet.velocity_lie,adPower_base,zero_lie,add_zero] + rw [adPower_zero_left t (by omega),lie_zero] + + theorem mixed_scalar {n : ℕ} {p : L} {k : ℚ} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 2 simp + have hc2 : -(Jet.mk a t : Jet ℚ M) - Jet.mk (-a) 0 = Jet.mk 0 (-t) := by + ext <;> simp + rw [hc1] at H1 + rw [hc2] at H2 + simp only [Jet.velocity_smul,Jet.velocity_sub,adPower_radial, + adPower_zero_base (-a) t (n := n) (by omega),sub_zero] at H1 + simp only [Jet.velocity_smul,Jet.velocity_sub, + adPower_transverse_self a t (n := n) (by omega),adPower_zero_base (-t) a (n := n) (by omega),sub_zero] at H2 + have hm := mixed_slope (G p) a (-a) a t + rw [H1,H2] at hm + have hz : (-k) • ((n:ℚ) • adPower a n t) - (-k) • (-adPower a n t) = 0 := sub_eq_zero.mpr hm + calc + (((n : ℚ)+1)*k) • adPower a n t = + -((-k) • ((n:ℚ) • adPower a n t) - (-k) • (-adPower a n t)) := by module + _ = 0 := by rw [hz,neg_zero] + + theorem diagonal_scalar_zero {n : ℕ} {p : L} {k : ℚ} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 2 fin_cases j <;> norm_num [a,t,Ring.lie_def,Matrix.mul_apply,Fin.sum_univ_two] + have had (m : ℕ) : adPower a m t = t := by + induction m with + | zero => rfl + | succ m ih => rw [adPower_succ,ih,hbr] + have H := mixed_scalar hp hpn hn hdiag a t + rw [had] at H + have hc := congrArg (fun z => z 0 1) H + change (((n : ℚ)+1)*k) * 1 = 0 at hc + rw [mul_one] at hc + exact (mul_eq_zero.mp hc).resolve_left (by positivity) + + theorem special_linearization {n : ℕ} {p : L} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 2 E (i+1) a) +@[simp] theorem shift_E (n : ℕ) (a : α) : shift (E n a : F R α) = E (n+1) a := by + simp [shift,E] +def action : R →ₗ⁅R⁆ LieDerivation R (F R α) (F R α) where + toFun r := r • shift + map_add' r s := add_smul r s shift + map_smul' r s := mul_smul r s shift + map_lie' {r s} := by simp [Ring.lie_def,mul_comm,smul_lie,lie_smul] +abbrev M (R α : Type*) [CommRing R] := SemiDirectSum (F R α) R action + +def expand : G R α →ₗ⁅R⁆ M R α := + FreeLieAlgebra.lift R (fun a => match a with + | none => SemiDirectSum.inr action 1 + | some a => SemiDirectSum.inl action (E 0 a)) +@[simp] theorem expand_X : expand (X : G R α) = SemiDirectSum.inr action 1 := by + simp [expand,X] +@[simp] theorem expand_Y (a : α) : expand (Y a : G R α) = SemiDirectSum.inl action (E 0 a) := by + simp [expand,Y] + +def adWord (n : ℕ) (a : α) : G R α := + (LieAlgebra.ad R (G R α) X)^[n] (Y a) +@[simp] theorem adWord_zero (a : α) : adWord 0 a = (Y a : G R α) := rfl +@[simp] theorem adWord_succ (n : ℕ) (a : α) : + (adWord (n+1) a : G R α) = ⁅(X : G R α),adWord n a⁆ := by + exact Function.iterate_succ_apply' _ n _ +def collapseFiber : F R α →ₗ⁅R⁆ G R α := FreeLieAlgebra.lift R (fun (n,a) => adWord n a) +@[simp] theorem collapseFiber_E (n : ℕ) (a : α) : + collapseFiber (E n a : F R α) = adWord n a := by simp [collapseFiber,E] + +theorem collapse_shift (p : F R α) : collapseFiber (shift p) = ⁅(X : G R α),collapseFiber p⁆ := by + induction p using freeLie_induction with + | h0 => simp + | hg a => cases a; simp [shift,collapseFiber,E,adWord_succ] + | ha p q hp hq => simp [hp,hq,lie_add] + | hs r p hp => simp [hp] + | hl p q hp hq => + simp only [LieDerivation.apply_lie_eq_add,map_add,LieHom.map_lie,hp,hq] + simpa only [add_comm] using (leibniz_lie (X : G R α) (collapseFiber p) (collapseFiber q)).symm + +def scalarX : R →ₗ⁅R⁆ G R α where + toFun r := r • X + map_add' r s := add_smul r s X + map_smul' r s := mul_smul r s X + map_lie' {r s} := by simp [Ring.lie_def,mul_comm,smul_lie,lie_smul] + +def collapse : M R α →ₗ⁅R⁆ G R α := + InnerSemiDirect.lift action collapseFiber scalarX (by + intro r p + change collapseFiber (r • shift p) = ⁅r • X,collapseFiber p⁆ + rw [map_smul,collapse_shift,smul_lie]) + +@[simp] theorem collapse_inl (p : F R α) : + collapse (SemiDirectSum.inl action p) = collapseFiber p := by simp [collapse,InnerSemiDirect.lift] +@[simp] theorem collapse_inr (r : R) : + collapse (SemiDirectSum.inr action r : M R α) = r • X := by simp [collapse,InnerSemiDirect.lift,scalarX] + +theorem collapse_expand (p : G R α) : collapse (expand p) = p := by + have h : collapse.comp (expand : G R α →ₗ⁅R⁆ M R α) = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro a + cases a <;> simp [expand,collapse,InnerSemiDirect.lift,scalarX,collapseFiber,E,X,Y] + exact LieHom.congr_fun h p + +theorem expand_adWord (n : ℕ) (a : α) : + expand (adWord n a : G R α) = SemiDirectSum.inl action (E n a) := by + induction n with + | zero => simp + | succ n ih => + rw [adWord_succ,LieHom.map_lie,expand_X,ih] + simp only [SemiDirectSum.lie_eq_mk,SemiDirectSum.inl_eq_mk,SemiDirectSum.inr_eq_mk] + ext <;> simp [action] + +theorem expand_collapseFiber (p : F R α) : + expand (collapseFiber p) = SemiDirectSum.inl action p := by + have h : (expand : G R α →ₗ⁅R⁆ M R α).comp collapseFiber = SemiDirectSum.inl action := by + apply FreeLieAlgebra.hom_ext + intro a + cases a + simp [collapseFiber,expand_adWord,E] + exact LieHom.congr_fun h p + +theorem expand_collapse (p : M R α) : expand (collapse p) = p := by + change expand (collapseFiber p.left + scalarX p.right) = p + rw [map_add,expand_collapseFiber] + change _ + expand (p.right • X) = p + rw [map_smul,expand_X] + ext <;> simp + +def equivalence : G R α ≃ₗ⁅R⁆ M R α := + { expand with + invFun := collapse + left_inv := collapse_expand + right_inv := expand_collapse } + +theorem collapseFiber_injective : Function.Injective (collapseFiber : F R α → G R α) := by + intro p q h + apply_fun expand at h + rw [expand_collapseFiber,expand_collapseFiber] at h + exact congrArg SemiDirectSum.left h + +end Elimination + +namespace AssociativeElimination +open LieAlgebra +variable {R α β : Type*} [CommRing R] +attribute [local instance] LieRing.ofAssociativeRing +abbrev A (R α : Type*) [CommRing R] := MonoidAlgebra R (FreeMonoid α) +def atom (a : α) : A R α := MonoidAlgebra.single (FreeMonoid.of a) 1 + +def lift {B : Type*} [Ring B] [Algebra R B] (f : α → B) : A R α →ₐ[R] B := + MonoidAlgebra.lift R B (FreeMonoid α) (FreeMonoid.lift f) +@[simp] theorem lift_atom {B : Type*} [Ring B] [Algebra R B] (f : α → B) (a : α) : + lift (R := R) f (atom a) = f a := by simp [lift,atom] + +@[ext] theorem hom_ext {B : Type*} [Semiring B] [Algebra R B] {f g : A R α →ₐ[R] B} + (h : ∀ a, f (atom a) = g (atom a)) : f=g := by + apply (MonoidAlgebra.lift R B (FreeMonoid α)).symm.injective + apply FreeMonoid.hom_eq + intro a + exact h a + +def embed : FreeLieAlgebra R α →ₗ⁅R⁆ A R α := FreeLieAlgebra.lift R atom +@[simp] theorem embed_of (a : α) : embed (FreeLieAlgebra.of R a) = atom a := by simp [embed] + +def dualLift (f : α → A R α) : A R α →ₐ[R] DualNumber (A R α) := + lift (fun a => TrivSqZeroExt.inl (atom a) + TrivSqZeroExt.inr (f a)) +@[simp] theorem dualLift_base (f : α → A R α) (p : A R α) : + (dualLift f p).fst = p := by + have h : (TrivSqZeroExt.fstHom R (A R α) (A R α)).comp (dualLift f) = AlgHom.id R (A R α) := by + apply hom_ext + intro a + simp [dualLift] + exact AlgHom.congr_fun h p + +def deriv (f : α → A R α) : A R α →ₗ[R] A R α := + ((TrivSqZeroExt.sndHom (A R α) (A R α)).restrictScalars R).comp (dualLift f).toLinearMap +@[simp] theorem deriv_atom (f : α → A R α) (a : α) : deriv f (atom a) = f a := by + simp [deriv,dualLift] +@[simp] theorem deriv_one (f : α → A R α) : deriv f 1 = 0 := by simp [deriv] +theorem deriv_mul (f : α → A R α) (p q : A R α) : + deriv f (p*q) = deriv f p*q + p*deriv f q := by + change (dualLift f (p*q)).snd = _ + rw [map_mul,DualNumber.snd_mul,dualLift_base,dualLift_base] + exact add_comm _ _ +theorem deriv_lie (f : α → A R α) (p q : A R α) : + deriv f ⁅p,q⁆ = ⁅deriv f p,q⁆ + ⁅p,deriv f q⁆ := by + simp only [Ring.lie_def,map_sub,deriv_mul] + abel + +def shift : A R (ℕ×α) →ₗ[R] A R (ℕ×α) := deriv (fun (i,a) => atom (i+1,a)) +@[simp] theorem shift_atom (i : ℕ) (a : α) : shift (atom (i,a) : A R (ℕ×α)) = atom (i+1,a) := by + simp [shift] +@[simp] theorem shift_one : shift (1 : A R (ℕ×α)) = 0 := deriv_one _ +theorem shift_mul (p q : A R (ℕ×α)) : shift (p*q) = shift p*q + p*shift q := deriv_mul _ _ _ + +theorem embed_shift (p : Elimination.F R α) : embed (Elimination.shift p) = shift (embed p) := by + induction p using freeLie_induction with + | h0 => simp + | hg a => cases a; simp [Elimination.shift,Elimination.E] + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => + simp only [LieDerivation.apply_lie_eq_add,map_add,LieHom.map_lie,hp,hq] + simpa only [shift,add_comm] using (deriv_lie (fun (i,a) => (atom (i+1,a) : A R (ℕ×α))) (embed p) (embed q)).symm + +def leftMul : A R α →ₐ[R] Module.End R (A R α) := Algebra.lsmul R R (A R α) +@[simp] theorem leftMul_apply (p q : A R α) : leftMul p q = p*q := rfl +@[simp] theorem comm_shift_left (p : A R (ℕ×α)) : + ⁅(shift : Module.End R (A R (ℕ×α))),leftMul p⁆ = leftMul (shift p) := by + apply LinearMap.ext + intro q + change shift (p*q)-p*shift q = shift p*q + rw [shift_mul,add_sub_cancel_right] + +def scalarShift : R →ₗ⁅R⁆ Module.End R (A R (ℕ×α)) where + toFun r := r • shift + map_add' r s := add_smul r s shift + map_smul' r s := mul_smul r s shift + map_lie' {r s} := by simp [Ring.lie_def,smul_smul,mul_comm] + +def representation : Elimination.M R α →ₗ⁅R⁆ Module.End R (A R (ℕ×α)) := + InnerSemiDirect.lift Elimination.action (leftMul.toLieHom.comp embed) scalarShift (by + intro r p + change leftMul (embed (r • Elimination.shift p)) = ⁅r • (shift : Module.End R (A R (ℕ×α))),leftMul (embed p)⁆ + rw [map_smul,map_smul,embed_shift] + apply LinearMap.ext + intro q + change r • (shift (embed p)*q) = r • shift (embed p*q) - embed p*(r • shift q) + rw [shift_mul,smul_add,mul_smul_comm,add_sub_cancel_right]) + +def operator : A R (Option α) →ₐ[R] Module.End R (A R (ℕ×α)) := + lift (fun | none => shift | some a => leftMul (atom (0,a))) + +@[simp] theorem representation_inl (p : Elimination.F R α) : + representation (SemiDirectSum.inl Elimination.action p) = leftMul (embed p) := by simp [representation,InnerSemiDirect.lift] +@[simp] theorem representation_inr (r : R) : + representation (SemiDirectSum.inr Elimination.action r : Elimination.M R α) = r • shift := by + simp [representation,InnerSemiDirect.lift,scalarShift] + +theorem operator_embed (p : Elimination.G R α) : + operator (embed p) = representation (Elimination.expand p) := by + have h : operator.toLieHom.comp embed = representation.comp (Elimination.expand : Elimination.G R α →ₗ⁅R⁆ Elimination.M R α) := by + apply FreeLieAlgebra.hom_ext + intro a + cases a <;> simp [operator,Elimination.expand,Elimination.E,representation,InnerSemiDirect.lift,scalarShift] + exact LieHom.congr_fun h p + +def extract : A R (Option α) →ₗ[R] A R (ℕ×α) := + (LinearMap.applyₗ 1).comp operator.toLinearMap + +theorem extract_embed (p : Elimination.G R α) : + extract (embed p) = embed (Elimination.expand p).left := by + change operator (embed p) 1 = _ + rw [operator_embed] + change (leftMul (embed (Elimination.expand p).left) + (Elimination.expand p).right • (shift : Module.End R (A R (ℕ×α)))) 1 = _ + simp + +end AssociativeElimination + +namespace IntegralWords +open Classical +open AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +variable {α β : Type*} +abbrev AQ (α : Type*) := A ℚ α + +def word (w : List α) : AQ α := MonoidAlgebra.single (FreeMonoid.ofList w) 1 +@[simp] theorem word_nil : word ([] : List α) = 1 := rfl +@[simp] theorem word_singleton (a : α) : word [a] = atom a := rfl +theorem word_append (u v : List α) : word (u++v) = word u * word v := by + simp [word,MonoidAlgebra.single_mul_single,FreeMonoid.ofList_append] +theorem word_cons (a : α) (w : List α) : word (a::w) = atom a * word w := by + exact word_append [a] w + +def lattice : Submodule ℤ (AQ α) := Submodule.span ℤ (Set.range word) +def lieLattice : LieSubalgebra ℤ (AQ α) := LieSubalgebra.lieSpan ℤ (AQ α) (Set.range atom) +def rationalLie : LieSubalgebra ℚ (AQ α) := LieSubalgebra.lieSpan ℚ (AQ α) (Set.range atom) + +theorem word_integral (w : List α) : word w ∈ lattice := Submodule.subset_span ⟨w,rfl⟩ +theorem atom_integral (a : α) : (atom a : AQ α) ∈ lattice := word_integral [a] +theorem one_integral : (1 : AQ α) ∈ lattice := word_integral [] + +theorem integral_mul {p q : AQ α} (hp : p ∈ lattice) (hq : q ∈ lattice) : p*q ∈ lattice := by + induction hp using Submodule.span_induction with + | mem p hp => + rcases hp with ⟨u,rfl⟩ + induction hq using Submodule.span_induction with + | mem q hq => + rcases hq with ⟨v,rfl⟩ + rw [← word_append] + exact word_integral _ + | zero => simp + | add p q _ _ hp hq => simpa only [mul_add] using (lattice.add_mem hp hq) + | smul r p _ hp => simpa only [mul_smul_comm] using lattice.smul_mem r hp + | zero => simp + | add p q _ _ hp hq => simpa only [add_mul] using lattice.add_mem hp hq + | smul r p _ hp => simpa only [smul_mul_assoc] using lattice.smul_mem r hp + +theorem integral_lie {p q : AQ α} (hp : p ∈ lattice) (hq : q ∈ lattice) : ⁅p,q⁆ ∈ lattice := + lattice.sub_mem (integral_mul hp hq) (integral_mul hq hp) + +theorem integral_coeff {p : AQ α} (hp : p ∈ lattice) (w : FreeMonoid α) : + ∃ z : ℤ, p.coeff w = (z : ℚ) := by + classical + induction hp using Submodule.span_induction with + | mem p hp => + rcases hp with ⟨u,rfl⟩ + by_cases h : FreeMonoid.ofList u = w + · exact ⟨1,by simp [word,h]⟩ + · exact ⟨0,by simp [word,h]⟩ + | zero => exact ⟨0,by simp⟩ + | add p q _ _ hp hq => + obtain ⟨a,ha⟩ := hp + obtain ⟨b,hb⟩ := hq + exact ⟨a+b,by simp [ha,hb]⟩ + | smul r p _ hp => + obtain ⟨a,ha⟩ := hp + refine ⟨r*a,?_⟩ + calc + (r • p).coeff w = r • p.coeff w := MonoidAlgebra.coeff_smul_apply _ _ _ + _ = ((r*a : ℤ) : ℚ) := by rw [ha]; simp [zsmul_eq_mul] + +theorem integral_of_coeff {p : AQ α} (hp : ∀ w, ∃ z : ℤ, p.coeff w = (z : ℚ)) : p ∈ lattice := by + classical + rw [← MonoidAlgebra.sum_coeff_single p] + apply Submodule.sum_mem + intro w hw + obtain ⟨z,hz⟩ := hp w + rw [hz] + convert lattice.smul_mem z (word_integral w.toList) using 1 + simp [word] + +def words (P : List α → Prop) : Submodule ℚ (AQ α) := + Submodule.span ℚ {p | ∃ w, P w ∧ p=word w} + +theorem word_mem {P : List α → Prop} {w : List α} (hw : P w) : word w ∈ words P := + Submodule.subset_span ⟨w,hw,rfl⟩ + +theorem mem_words {P : List α → Prop} {p : AQ α} : + p ∈ words P ↔ ∀ w, p.coeff w ≠ 0 → P w.toList := by + classical + constructor + · intro hp w hw + induction hp using Submodule.span_induction with + | mem p hp => + rcases hp with ⟨u,hu,rfl⟩ + have h : FreeMonoid.ofList u = w := by + by_contra h + exact hw (by simp [word,h]) + simpa [← h] using hu + | zero => exact (hw (by simp)).elim + | add p q _ _ hp hq => + by_cases h : p.coeff w = 0 + · exact hq (by simpa [h] using hw) + · exact hp h + | smul r p _ hp => + exact hp (by intro h; apply hw; simp [h]) + · intro hp + rw [← MonoidAlgebra.sum_coeff_single p] + apply Submodule.sum_mem + intro w hw + have h : P w.toList := hp w (Finsupp.mem_support_iff.mp hw) + convert (words P).smul_mem (p.coeff w) (word_mem h) using 1 + simp [word] + +theorem words_mono {P Q : List α → Prop} (h : ∀ w, P w → Q w) : words P ≤ words Q := by + apply Submodule.span_le.mpr + rintro _ ⟨w,hw,rfl⟩ + exact word_mem (h w hw) + +theorem mul_words {P Q T : List α → Prop} {p q : AQ α} + (h : ∀ u v, P u → Q v → T (u++v)) (hp : p ∈ words P) (hq : q ∈ words Q) : p*q ∈ words T := by + induction hp using Submodule.span_induction with + | mem p hp => + rcases hp with ⟨u,hu,rfl⟩ + induction hq using Submodule.span_induction with + | mem q hq => + rcases hq with ⟨v,hv,rfl⟩ + rw [← word_append] + exact word_mem (h u v hu hv) + | zero => simp + | add p q _ _ hp hq => simpa only [mul_add] using (words T).add_mem hp hq + | smul r p _ hp => simpa only [mul_smul_comm] using (words T).smul_mem r hp + | zero => simp + | add p q _ _ hp hq => simpa only [add_mul] using (words T).add_mem hp hq + | smul r p _ hp => simpa only [smul_mul_assoc] using (words T).smul_mem r hp + +theorem lie_has_preimage {p : AQ α} (hp : p ∈ rationalLie) : ∃ q : FreeLieAlgebra ℚ α, embed q = p := by + have h : rationalLie (α := α) ≤ (embed : FreeLieAlgebra ℚ α →ₗ⁅ℚ⁆ AQ α).range := by + apply LieSubalgebra.lieSpan_le.mpr + rintro _ ⟨a,rfl⟩ + exact ⟨FreeLieAlgebra.of ℚ a,embed_of a⟩ + exact h hp + +theorem embed_mem_lie (p : FreeLieAlgebra ℚ α) : embed p ∈ rationalLie := by + induction p using freeLie_induction with + | h0 => simp + | hg a => rw [embed_of]; exact LieSubalgebra.subset_lieSpan ⟨a,rfl⟩ + | ha p q hp hq => simpa using rationalLie.add_mem hp hq + | hs r p hp => simpa using rationalLie.smul_mem r hp + | hl p q hp hq => simpa only [LieHom.map_lie] using rationalLie.lie_mem hp hq + +theorem shift_integral {p : AQ (ℕ×α)} (hp : p ∈ lattice) : shift p ∈ lattice := by + have hword : ∀ w : List (ℕ×α), shift (word w) ∈ lattice := by + intro w + induction w with + | nil => simp + | cons a w ih => + rcases a with ⟨i,a⟩ + rw [word_cons,shift_mul,shift_atom] + exact lattice.add_mem (integral_mul (atom_integral _) (word_integral _)) + (integral_mul (atom_integral _) ih) + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨w,rfl⟩ := hp; exact hword w + | zero => simp + | add p q _ _ hp hq => simpa using lattice.add_mem hp hq + | smul r p _ hp => simpa only [map_zsmul] using lattice.smul_mem r hp + +theorem extract_integral {p : AQ (Option α)} (hp : p ∈ lattice) : extract p ∈ lattice := by + have hword : ∀ w : List (Option α), ∀ q : AQ (ℕ×α), q ∈ lattice → operator (word w) q ∈ lattice := by + intro w + induction w with + | nil => intro q hq; simpa using hq + | cons a w ih => + intro q hq + rw [word_cons,map_mul,Module.End.mul_apply] + cases a with + | none => simpa [operator] using shift_integral (ih q hq) + | some a => simpa [operator] using integral_mul (atom_integral (0,a)) (ih q hq) + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨w,rfl⟩ := hp; exact hword w 1 one_integral + | zero => simp + | add p q _ _ hp hq => simpa using lattice.add_mem hp hq + | smul r p _ hp => simpa only [map_zsmul] using lattice.smul_mem r hp + +theorem extract_lie {p : AQ (Option α)} (hp : p ∈ rationalLie) : extract p ∈ rationalLie := by + obtain ⟨q,rfl⟩ := lie_has_preimage hp + rw [extract_embed] + exact embed_mem_lie _ + +def countSome : List (Option α) → ℕ + | [] => 0 + | none::w => countSome w + | some _::w => countSome w + 1 + +theorem countSome_le (w : List (Option α)) : countSome w ≤ w.length := by + induction w with + | nil => simp [countSome] + | cons a w ih => cases a <;> simp [countSome] <;> omega + +theorem countSome_lt {w : List (Option α)} (hw : none ∈ w) : countSome w < w.length := by + induction w with + | nil => simp at hw + | cons a w ih => + cases a with + | none => simpa [countSome] using Nat.lt_succ_of_le (countSome_le w) + | some a => + have h := ih (by simpa using hw) + simp [countSome] + omega + +theorem shift_length {p : AQ (ℕ×α)} {n : ℕ} (hp : p ∈ words (fun w => w.length=n)) : + shift p ∈ words (fun w => w.length=n) := by + have hword : ∀ w : List (ℕ×α), shift (word w) ∈ words (fun v => v.length=w.length) := by + intro w + induction w with + | nil => simp + | cons a w ih => + rcases a with ⟨i,a⟩ + rw [word_cons,shift_mul,shift_atom] + apply (words _).add_mem + · exact mul_words (fun u v hu hv => by simp [List.length_append,hu,hv,Nat.add_comm]) + (word_mem (P := fun v => v.length=1) (w := [(i+1,a)]) rfl) (word_mem (P := fun v => v.length=w.length) (w := w) rfl) + · exact mul_words (fun u v hu hv => by simp [List.length_append,hu,hv,Nat.add_comm]) + (word_mem (P := fun v => v.length=1) (w := [(i,a)]) rfl) ih + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨w,hw,rfl⟩ := hp; simpa [hw] using hword w + | zero => simp + | add p q _ _ hp hq => simpa using (words _).add_mem hp hq + | smul r p _ hp => simpa using (words _).smul_mem r hp + +theorem operator_length (w : List (Option α)) {q : AQ (ℕ×α)} {n : ℕ} + (hq : q ∈ words (fun v => v.length=n)) : + operator (word w) q ∈ words (fun v => v.length=n+countSome w) := by + induction w with + | nil => simpa [countSome] using hq + | cons a w ih => + rw [word_cons,map_mul,Module.End.mul_apply] + cases a with + | none => simpa [operator,countSome] using shift_length ih + | some a => + have h : atom (0,a) * operator (word w) q ∈ words (fun v => v.length=n+countSome w+1) := + mul_words (fun u v (hu : u.length=1) (hv : v.length=n+countSome w) => by + simp [List.length_append,hu,hv,Nat.add_comm]) + (word_mem (P := fun v => v.length=1) (w := [(0,a)]) rfl) ih + simpa [operator,countSome, Nat.add_assoc] using h + +theorem extract_word_length (w : List (Option α)) : + extract (word w) ∈ words (fun v => v.length=countSome w) := by + simpa [extract] using operator_length w (word_mem (w := []) rfl) + +def rename (f : α → β) : AQ α →ₐ[ℚ] AQ β := lift (fun a => atom (f a)) +@[simp] theorem rename_atom (f : α → β) (a : α) : rename f (atom a) = atom (f a) := by + simp [rename] + +theorem rename_word (f : α → β) (w : List α) : rename f (word w) = word (w.map f) := by + induction w with + | nil => simp + | cons a w ih => simp [word_cons,ih] + +theorem rename_integral (f : α → β) {p : AQ α} (hp : p ∈ lattice) : rename f p ∈ lattice := by + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨w,rfl⟩ := hp; rw [rename_word]; exact word_integral _ + | zero => simp + | add p q _ _ hp hq => simpa using lattice.add_mem hp hq + | smul r p _ hp => simpa only [map_zsmul] using lattice.smul_mem r hp + +theorem rename_lie (f : α → β) {p : AQ α} (hp : p ∈ rationalLie) : rename f p ∈ rationalLie := by + induction hp using LieSubalgebra.lieSpan_induction ℚ with + | mem p hp => obtain ⟨a,rfl⟩ := hp; rw [rename_atom]; exact LieSubalgebra.subset_lieSpan ⟨f a,rfl⟩ + | zero => simp + | add p q _ _ hp hq => simpa using rationalLie.add_mem hp hq + | smul r p _ hp => simpa using rationalLie.smul_mem r hp + | lie p q _ _ hp hq => simpa only [Ring.lie_def,map_sub,map_mul] using rationalLie.lie_mem hp hq + +theorem rename_lieIntegral (f : α → β) {p : AQ α} (hp : p ∈ lieLattice) : rename f p ∈ lieLattice := by + induction hp using LieSubalgebra.lieSpan_induction ℤ with + | mem p hp => obtain ⟨a,rfl⟩ := hp; rw [rename_atom]; exact LieSubalgebra.subset_lieSpan ⟨f a,rfl⟩ + | zero => simp + | add p q _ _ hp hq => simpa using lieLattice.add_mem hp hq + | smul r p _ hp => simpa only [map_zsmul] using lieLattice.smul_mem r hp + | lie p q _ _ hp hq => simpa only [Ring.lie_def,map_sub,map_mul] using lieLattice.lie_mem hp hq + +noncomputable def kill (a : α) : AQ α →ₐ[ℚ] AQ α := by + classical + exact lift fun b => if a=b then 0 else atom b + +theorem kill_atom (a b : α) : kill a (atom b) = if a=b then 0 else atom b := by + classical + simp [kill] + +theorem kill_word (a : α) (w : List α) : kill a (word w) = if a ∈ w then 0 else word w := by + classical + induction w with + | nil => simp + | cons b w ih => + rw [word_cons,map_mul,kill_atom,ih] + by_cases h : a=b <;> by_cases h' : a ∈ w <;> simp [h,h'] + +theorem kill_integral (a : α) {p : AQ α} (hp : p ∈ lattice) : kill a p ∈ lattice := by + classical + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,rfl⟩ := hp + rw [kill_word] + split_ifs <;> simp [word_integral] + | zero => simp + | add p q _ _ hp hq => simpa using lattice.add_mem hp hq + | smul r p _ hp => simpa only [map_zsmul] using lattice.smul_mem r hp + +theorem kill_lie (a : α) {p : AQ α} (hp : p ∈ rationalLie) : kill a p ∈ rationalLie := by + classical + induction hp using LieSubalgebra.lieSpan_induction ℚ with + | mem p hp => + obtain ⟨b,rfl⟩ := hp + rw [kill_atom] + split_ifs + · exact rationalLie.zero_mem + · exact LieSubalgebra.subset_lieSpan ⟨b,rfl⟩ + | zero => simp + | add p q _ _ hp hq => simpa using rationalLie.add_mem hp hq + | smul r p _ hp => simpa using rationalLie.smul_mem r hp + | lie p q _ _ hp hq => simpa only [Ring.lie_def,map_sub,map_mul] using rationalLie.lie_mem hp hq + +def tag (a b : α) : Option α := if a=b then none else some b + +def untag (a : α) : Option α → α + | none => a + | some b => b + +theorem rename_untag_tag (a : α) (p : AQ α) : rename (untag a) (rename (tag a) p) = p := by + have h : (rename (untag a)).comp (rename (tag a)) = AlgHom.id ℚ (AQ α) := by + apply hom_ext + intro b + simp only [AlgHom.comp_apply,rename_atom,AlgHom.id_apply] + congr 1 + dsimp [tag] + split_ifs with h + · exact h + · rfl + exact AlgHom.congr_fun h p + +theorem rename_extract_lower (a : α) {p : AQ α} {n : ℕ} + (hp : p ∈ words (fun w => w.length≤n+1 ∧ a ∈ w)) : + extract (rename (tag a) p) ∈ words (fun w => w.length≤n) := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + rw [rename_word] + have hm : none ∈ w.map (tag a) := List.mem_map.mpr ⟨a,hw.2,by simp [tag]⟩ + have hc := countSome_lt hm + apply words_mono (P := fun v => v.length=countSome (w.map (tag a))) ?_ (extract_word_length _) + intro v hv + simp only [List.length_map] at hc + omega + | zero => simp + | add p q _ _ hp hq => simpa using (words _).add_mem hp hq + | smul r p _ hp => simpa using (words _).smul_mem r hp + +theorem kill_bound (a : α) (S : Finset α) (n : ℕ) {p : AQ α} + (hp : p ∈ words (fun w => w.length≤n ∧ ∀ b ∈ w, b ∈ insert a S)) : + kill a p ∈ words (fun w => w.length≤n ∧ ∀ b ∈ w, b ∈ S) := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + rw [kill_word] + split_ifs with h + · exact (words _).zero_mem + · apply word_mem + refine ⟨hw.1,?_⟩ + intro b hb + rcases Finset.mem_insert.mp (hw.2 b hb) with h'|h' + · exact (h (h' ▸ hb)).elim + · exact h' + | zero => simp + | add p q _ _ hp hq => simpa using (words _).add_mem hp hq + | smul r p _ hp => simpa using (words _).smul_mem r hp + +theorem remainder_bound (a : α) {p : AQ α} {n : ℕ} + (hp : p ∈ words (fun w => w.length≤n)) : + p-kill a p ∈ words (fun w => w.length≤n ∧ a ∈ w) := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + rw [kill_word] + split_ifs with h + · simpa using word_mem (P := fun v => v.length≤n ∧ a ∈ v) ⟨hw,h⟩ + · simp + | zero => simp + | add p q _ _ hp hq => + rw [map_add] + convert (words _).add_mem hp hq using 1 + abel + | smul r p _ hp => simpa only [map_smul,smul_sub] using (words _).smul_mem r hp + +theorem lie_positive {p : AQ α} (hp : p ∈ rationalLie) : p ∈ words (fun w => 0 obtain ⟨a,rfl⟩ := hp; exact word_mem (w := [a]) (by simp) + | zero => simp + | add p q _ _ hp hq => exact (words _).add_mem hp hq + | smul r p _ hp => exact (words _).smul_mem r hp + | lie p q _ _ hp hq => + apply (words _).sub_mem + · exact mul_words (fun u v hu hv => by simp only [List.length_append]; omega) hp hq + · exact mul_words (fun u v hu hv => by simp only [List.length_append]; omega) hq hp + +def traceX : AQ (Option α) →ₐ[ℚ] ℚ := lift (fun | none => 1 | some _ => 0) + +theorem trace_embed (q : Elimination.G ℚ α) : traceX (embed q) = (Elimination.expand q).right := by + have h : traceX.toLieHom.comp embed = + (LieAlgebra.SemiDirectSum.projr Elimination.action).comp (Elimination.expand : Elimination.G ℚ α →ₗ⁅ℚ⁆ Elimination.M ℚ α) := by + apply FreeLieAlgebra.hom_ext + intro a + cases a <;> simp [traceX,Elimination.expand] + exact LieHom.congr_fun h q + +def collapseAssoc : AQ (ℕ×α) →ₐ[ℚ] AQ (Option α) := + lift (fun (i,a) => embed (Elimination.adWord i a)) + +theorem collapse_embed (q : Elimination.F ℚ α) : + collapseAssoc (embed q) = embed (Elimination.collapseFiber q) := by + have h : collapseAssoc.toLieHom.comp embed = + (embed : Elimination.G ℚ α →ₗ⁅ℚ⁆ AQ (Option α)).comp Elimination.collapseFiber := by + apply FreeLieAlgebra.hom_ext + intro a + rcases a with ⟨i,a⟩ + simp [collapseAssoc,Elimination.collapseFiber] + exact LieHom.congr_fun h q + +theorem decompose_lie {p : AQ (Option α)} (hp : p ∈ rationalLie) : + p = collapseAssoc (extract p) + traceX p • atom none := by + obtain ⟨q,rfl⟩ := lie_has_preimage hp + rw [extract_embed,collapse_embed,trace_embed] + conv_lhs => rw [← Elimination.collapse_expand q] + change embed (Elimination.collapseFiber (Elimination.expand q).left + + (Elimination.expand q).right • Elimination.X) = _ + simp [Elimination.X] + +theorem trace_integral {p : AQ (Option α)} (hp : p ∈ lattice) : ∃ z : ℤ, traceX p = (z : ℚ) := by + have hw : ∀ w : List (Option α), ∃ z : ℤ, traceX (word w) = (z : ℚ) := by + intro w + induction w with + | nil => exact ⟨1,by simp⟩ + | cons a w ih => + obtain ⟨z,hz⟩ := ih + rw [word_cons,map_mul,hz] + cases a with + | none => exact ⟨z,by simp [traceX]⟩ + | some a => exact ⟨0,by simp [traceX]⟩ + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨w,rfl⟩ := hp; exact hw w + | zero => exact ⟨0,by simp⟩ + | add p q _ _ hp hq => + obtain ⟨a,ha⟩ := hp + obtain ⟨b,hb⟩ := hq + exact ⟨a+b,by simp [ha,hb]⟩ + | smul r p _ hp => + obtain ⟨a,ha⟩ := hp + refine ⟨r*a,?_⟩ + rw [map_zsmul,ha] + simp [zsmul_eq_mul] + +theorem adWord_integralLie (i : ℕ) (a : α) : + embed (Elimination.adWord i a) ∈ lieLattice := by + induction i with + | zero => + simp only [Elimination.adWord,Function.iterate_zero_apply,Elimination.Y,embed_of] + exact LieSubalgebra.subset_lieSpan ⟨some a,rfl⟩ + | succ i ih => + rw [Elimination.adWord_succ,LieHom.map_lie] + apply lieLattice.lie_mem ?_ ih + simp only [Elimination.X,embed_of] + exact LieSubalgebra.subset_lieSpan ⟨none,rfl⟩ + +theorem collapse_integralLie {p : AQ (ℕ×α)} (hp : p ∈ lieLattice) : collapseAssoc p ∈ lieLattice := by + induction hp using LieSubalgebra.lieSpan_induction ℤ with + | mem p hp => + obtain ⟨⟨i,a⟩,rfl⟩ := hp + simpa [collapseAssoc] using adWord_integralLie i a + | zero => simp + | add p q _ _ hp hq => simpa using lieLattice.add_mem hp hq + | smul r p _ hp => simpa only [map_zsmul] using lieLattice.smul_mem r hp + | lie p q _ _ hp hq => simpa only [Ring.lie_def,map_sub,map_mul] using lieLattice.lie_mem hp hq + +theorem words_and {P Q : List α → Prop} {p : AQ α} (hp : p ∈ words P) (hq : p ∈ words Q) : + p ∈ words (fun w => P w ∧ Q w) := by + apply mem_words.mpr + intro w hw + exact ⟨mem_words.mp hp w hw,mem_words.mp hq w hw⟩ + +theorem exists_support (p : AQ α) : ∃ S : Finset α, p ∈ words (fun w => ∀ b ∈ w, b ∈ S) := by + let S := p.coeff.support.biUnion (fun w => w.toList.toFinset) + refine ⟨S,mem_words.mpr ?_⟩ + intro w hw b hb + exact Finset.mem_biUnion.mpr ⟨w,Finsupp.mem_support_iff.mpr hw,by simpa using hb⟩ + +theorem exists_bound (p : AQ α) : ∃ n : ℕ, p ∈ words (fun w => w.length≤n) := by + refine ⟨p.coeff.support.sup (fun w => w.toList.length),mem_words.mpr ?_⟩ + intro w hw + exact Finset.le_sup (f := fun w => w.toList.length) (Finsupp.mem_support_iff.mpr hw) + +theorem bound_zero_of_lie {p : AQ α} (hl : p ∈ rationalLie) + (hp : p ∈ words (fun w => w.length≤0)) : p=0 := by + ext w + change p.coeff w = 0 + by_contra h + have h₁ := mem_words.mp (lie_positive hl) w h + have h₂ := mem_words.mp hp w h + omega + +theorem support_empty_of_lie {p : AQ α} (hl : p ∈ rationalLie) + (hp : p ∈ words (fun w => ∀ b ∈ w, b ∈ (∅ : Finset α))) : p=0 := by + ext w + change p.coeff w = 0 + by_contra h + have h₁ := mem_words.mp (lie_positive hl) w h + have h₂ := mem_words.mp hp w h + cases ht : w.toList with + | nil => simp [ht] at h₁ + | cons b v => + have hb := h₂ b (by simp [ht]) + simp at hb + +universe u + +theorem saturation_bounded (n : ℕ) : ∀ (α : Type u) (p : AQ α), + p ∈ rationalLie → p ∈ lattice → p ∈ words (fun w => w.length≤n) → p ∈ lieLattice := by + induction n with + | zero => + intro α p hl _ hw + rw [bound_zero_of_lie hl hw] + exact lieLattice.zero_mem + | succ n ih => + intro α p hl hi hw + have hs : ∀ S : Finset α, ∀ p : AQ α, + p ∈ rationalLie → p ∈ lattice → + p ∈ words (fun w => w.length≤n+1 ∧ ∀ b ∈ w, b ∈ S) → p ∈ lieLattice := by + intro S + induction S using Finset.induction_on with + | empty => + intro p hl _ hw + have hz : p=0 := support_empty_of_lie hl (words_mono (fun _ h => h.2) hw) + rw [hz] + exact lieLattice.zero_mem + | @insert a S ha ihS => + intro p hl hi hw + have hl0 := kill_lie a hl + have hi0 := kill_integral a hi + have hp0 := ihS (kill a p) hl0 hi0 (kill_bound a S (n+1) hw) + have hrl : p-kill a p ∈ rationalLie := rationalLie.sub_mem hl hl0 + have hri : p-kill a p ∈ lattice := lattice.sub_mem hi hi0 + have hrw := remainder_bound a (words_mono (fun _ h => h.1) hw) + have htl := rename_lie (tag a) hrl + have hti := rename_integral (tag a) hri + have he := ih (ℕ×α) (extract (rename (tag a) (p-kill a p))) + (extract_lie htl) (extract_integral hti) (rename_extract_lower a hrw) + have ht : rename (tag a) (p-kill a p) ∈ lieLattice := by + rw [decompose_lie htl] + apply lieLattice.add_mem (collapse_integralLie he) + obtain ⟨z,hz⟩ := trace_integral hti + rw [hz,Int.cast_smul_eq_zsmul] + exact lieLattice.smul_mem z (LieSubalgebra.subset_lieSpan ⟨none,rfl⟩) + have hr := rename_lieIntegral (untag a) ht + rw [rename_untag_tag] at hr + convert lieLattice.add_mem hr hp0 using 1 + abel + obtain ⟨S,hS⟩ := exists_support p + exact hs S p hl hi (words_and hw hS) + +theorem saturation {p : AQ α} (hl : p ∈ rationalLie) (hi : p ∈ lattice) : p ∈ lieLattice := by + obtain ⟨n,hn⟩ := exists_bound p + exact saturation_bounded n α p hl hi hn + +end IntegralWords + +namespace UniversalEmbedding +open Classical LieAlgebra AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +variable {R α β : Type*} [CommRing R] +abbrev FL (R α : Type*) [CommRing R] := FreeLieAlgebra R α + +inductive Tree (α : Type*) + | leaf : α → Tree α + | node : Tree α → Tree α → Tree α + +def Tree.leaves : Tree α → List α + | .leaf a => [a] + | .node t u => t.leaves ++ u.leaves + +def Tree.eval : Tree α → FL R α + | .leaf a => FreeLieAlgebra.of R a + | .node t u => ⁅t.eval,u.eval⁆ + +def Tree.map (f : α → β) : Tree α → Tree β + | .leaf a => .leaf (f a) + | .node t u => .node (t.map f) (u.map f) + +@[simp] theorem Tree.leaves_map (f : α → β) (t : Tree α) : + (t.map f).leaves = t.leaves.map f := by + induction t <;> simp_all [Tree.map,Tree.leaves] + +theorem Tree.positive (t : Tree α) : 0 simp_all [Tree.leaves] + +def bounded (n : ℕ) (S : Finset α) : Submodule R (FL R α) := + Submodule.span R {p | ∃ t : Tree α, t.leaves.length≤n ∧ (∀ a ∈ t.leaves, a∈S) ∧ t.eval=p} +def small (n : ℕ) : Submodule R (FL R α) := + Submodule.span R {p | ∃ t : Tree α, t.leaves.length≤n ∧ t.eval=p} + +theorem eval_bounded (t : Tree α) {n : ℕ} {S : Finset α} + (hn : t.leaves.length≤n) (hS : ∀ a ∈ t.leaves, a∈S) : + (t.eval : FL R α) ∈ bounded n S := Submodule.subset_span ⟨t,hn,hS,rfl⟩ +theorem eval_small (t : Tree α) {n : ℕ} (hn : t.leaves.length≤n) : + (t.eval : FL R α) ∈ small n := Submodule.subset_span ⟨t,hn,rfl⟩ + +theorem bounded_mono {n m : ℕ} {S T : Finset α} (hn : n ≤ m) (hS : S ⊆ T) : + (bounded n S : Submodule R (FL R α)) ≤ bounded m T := by + apply Submodule.span_le.mpr + rintro p ⟨t,ht,hs,rfl⟩ + exact eval_bounded t (ht.trans hn) (fun a ha => hS (hs a ha)) +theorem bounded_small (n : ℕ) (S : Finset α) : + (bounded n S : Submodule R (FL R α)) ≤ small n := by + apply Submodule.span_le.mpr + rintro p ⟨t,ht,_,rfl⟩ + exact eval_small t ht + +theorem small_mono {n m : ℕ} (h : n ≤ m) : + (small n : Submodule R (FL R α)) ≤ small m := by + apply Submodule.span_le.mpr + rintro p ⟨t,ht,rfl⟩ + exact eval_small t (ht.trans h) + +theorem bracket_small {n m : ℕ} {p q : FL R α} (hp : p∈small n) (hq : q∈small m) : + ⁅p,q⁆ ∈ small (n+m) := by + induction hp using Submodule.span_induction with + | mem p hp => + rcases hp with ⟨t,ht,rfl⟩ + induction hq using Submodule.span_induction with + | mem q hq => + rcases hq with ⟨u,hu,rfl⟩ + exact eval_small (.node t u) (by simpa [Tree.leaves] using Nat.add_le_add ht hu) + | zero => simp + | add p q _ _ hp hq => simpa only [lie_add] using (small _).add_mem hp hq + | smul r p _ hp => simpa only [lie_smul] using (small _).smul_mem r hp + | zero => simp + | add p q _ _ hp hq => simpa only [add_lie] using (small _).add_mem hp hq + | smul r p _ hp => simpa only [smul_lie] using (small _).smul_mem r hp + +theorem small_exists_support {p : FL R α} {n : ℕ} (hp : p∈small n) : + ∃ S : Finset α, p∈bounded n S := by + induction hp using Submodule.span_induction with + | mem p hp => + rcases hp with ⟨t,ht,rfl⟩ + exact ⟨t.leaves.toFinset,eval_bounded t ht (by simp)⟩ + | zero => exact ⟨∅,Submodule.zero_mem _⟩ + | add p q _ _ hp hq => + rcases hp with ⟨S,hS⟩ + rcases hq with ⟨T,hT⟩ + exact ⟨S∪T,(bounded _ _).add_mem + (bounded_mono le_rfl Finset.subset_union_left hS) + (bounded_mono le_rfl Finset.subset_union_right hT)⟩ + | smul r p _ hp => + obtain ⟨S,hS⟩ := hp + exact ⟨S,(bounded _ _).smul_mem r hS⟩ + +theorem small_exists (p : FL R α) : ∃ n, p∈small n := by + induction p using freeLie_induction with + | h0 => exact ⟨0,Submodule.zero_mem _⟩ + | hg a => exact ⟨1,eval_small (.leaf a) le_rfl⟩ + | ha p q hp hq => + obtain ⟨n,hn⟩ := hp + obtain ⟨m,hm⟩ := hq + exact ⟨n+m,(small _).add_mem (small_mono (Nat.le_add_right _ _) hn) + (small_mono (Nat.le_add_left _ _) hm)⟩ + | hs r p hp => obtain ⟨n,hn⟩ := hp; exact ⟨n,(small _).smul_mem r hn⟩ + | hl p q hp hq => + obtain ⟨n,hn⟩ := hp + obtain ⟨m,hm⟩ := hq + exact ⟨n+m,bracket_small hn hm⟩ + +theorem small_zero {p : FL R α} (hp : p∈small 0) : p=0 := by + have h : (small 0 : Submodule R (FL R α)) ≤ ⊥ := by + apply Submodule.span_le.mpr + rintro p ⟨t,ht,_⟩ + have := t.positive + omega + exact h hp + +theorem bounded_empty {p : FL R α} {n : ℕ} (hp : p∈bounded n ∅) : p=0 := by + have h : (bounded n ∅ : Submodule R (FL R α)) ≤ ⊥ := by + apply Submodule.span_le.mpr + rintro p ⟨t,_,ht,_⟩ + obtain ⟨a,ha⟩ := List.exists_mem_of_length_pos t.positive + exact (Finset.notMem_empty a (ht a ha)).elim + exact h hp + +def rename (f : α → β) : FL R α →ₗ⁅R⁆ FL R β := + FreeLieAlgebra.lift R (fun a => FreeLieAlgebra.of R (f a)) +def renameAssoc (f : α → β) : A R α →ₐ[R] A R β := lift (fun a => atom (f a)) +@[simp] theorem rename_of (f : α → β) (a : α) : + rename f (FreeLieAlgebra.of R a) = FreeLieAlgebra.of R (f a) := by simp [rename] +@[simp] theorem rename_eval (f : α → β) (t : Tree α) : + rename f (t.eval : FL R α) = (t.map f).eval := by + induction t <;> simp_all [Tree.eval,Tree.map,LieHom.map_lie] + +theorem rename_embed (f : α → β) (p : FL R α) : + embed (rename f p) = renameAssoc f (embed p) := by + have h : (embed : FL R β →ₗ⁅R⁆ A R β).comp (rename f) = + (renameAssoc f).toLieHom.comp embed := by + apply FreeLieAlgebra.hom_ext + intro a + simp [renameAssoc] + exact LieHom.congr_fun h p + +def kill (a : α) : FL R α →ₗ⁅R⁆ FL R α := + FreeLieAlgebra.lift R (fun b => if b=a then 0 else FreeLieAlgebra.of R b) +def killAssoc (a : α) : A R α →ₐ[R] A R α := + lift (fun b => if b=a then 0 else atom b) +@[simp] theorem kill_of (a b : α) : kill a (FreeLieAlgebra.of R b) = + if b=a then 0 else FreeLieAlgebra.of R b := by simp [kill] + +theorem kill_embed (a : α) (p : FL R α) : embed (kill a p) = killAssoc a (embed p) := by + have h : (embed : FL R α →ₗ⁅R⁆ A R α).comp (kill a) = (killAssoc a).toLieHom.comp embed := by + apply FreeLieAlgebra.hom_ext + intro b + simp only [LieHom.comp_apply,kill_of,embed_of,killAssoc,lift_atom,AlgHom.toLieHom_apply] + split_ifs <;> simp + exact LieHom.congr_fun h p + +theorem kill_eval (a : α) (t : Tree α) : + kill a (t.eval : FL R α) = if a∈t.leaves then 0 else t.eval := by + induction t with + | leaf b => simp [Tree.eval,Tree.leaves,eq_comm] + | node t u ht hu => + simp only [Tree.eval,LieHom.map_lie,ht,hu,Tree.leaves,List.mem_append] + split_ifs <;> simp_all + +theorem kill_bounded (a : α) (S : Finset α) {n : ℕ} {p : FL R α} + (hp : p∈bounded n (insert a S)) : kill a p∈bounded n S := by + induction hp using Submodule.span_induction with + | mem p hp => + rcases hp with ⟨t,ht,hs,rfl⟩ + rw [kill_eval] + split_ifs with ha + · exact (bounded _ _).zero_mem + · exact eval_bounded t ht (fun b hb => (Finset.mem_insert.mp (hs b hb)).resolve_left + (fun h => ha (h ▸ hb))) + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using (bounded _ _).add_mem hp hq + | smul r p _ hp => simpa only [map_smul] using (bounded _ _).smul_mem r hp + +def fiber : Elimination.G R α →ₗ[R] Elimination.F R α := + { toFun := fun p => (Elimination.expand p).left + map_add' := by intro p q; simp + map_smul' := by intro r p; simp } + +@[simp] theorem fiber_X : fiber (Elimination.X : Elimination.G R α) = 0 := by + simp [fiber] +@[simp] theorem fiber_Y (a : α) : fiber (Elimination.Y a : Elimination.G R α) = Elimination.E 0 a := by + simp [fiber] +theorem fiber_lie (p q : Elimination.G R α) : + fiber ⁅p,q⁆ = ⁅fiber p,fiber q⁆ + (Elimination.expand p).right • Elimination.shift (fiber q) - + (Elimination.expand q).right • Elimination.shift (fiber p) := by + simp [fiber,LieHom.map_lie,Elimination.action] + +theorem shift_small {p : Elimination.F R α} {n : ℕ} (hp : p∈small n) : + Elimination.shift p∈small n := by + have ht : ∀ t : Tree (ℕ×α), Elimination.shift (t.eval : Elimination.F R α)∈small t.leaves.length := by + intro t + induction t with + | leaf a => + rcases a with ⟨i,a⟩ + simpa [Tree.eval,Tree.leaves,Elimination.shift,Elimination.E] using + eval_small (R := R) (.leaf (i+1,a)) le_rfl + | node t u ht hu => + simp only [Tree.eval,Tree.leaves,List.length_append,LieDerivation.apply_lie_eq_add] + exact (small _).add_mem (bracket_small (eval_small t le_rfl) hu) + (bracket_small ht (eval_small u le_rfl)) + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨t,hn,rfl⟩ := hp; exact small_mono hn (ht t) + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using (small _).add_mem hp hq + | smul r p _ hp => simpa only [map_smul] using (small _).smul_mem r hp + +theorem countSome_append (u v : List (Option α)) : + IntegralWords.countSome (u++v) = IntegralWords.countSome u+IntegralWords.countSome v := by + induction u with + | nil => simp [IntegralWords.countSome] + | cons a u ih => + cases a <;> simp only [List.cons_append,IntegralWords.countSome,ih] + omega + +theorem fiber_eval (t : Tree (Option α)) : + fiber (t.eval : Elimination.G R α)∈small (IntegralWords.countSome t.leaves) := by + induction t with + | leaf a => + cases a with + | none => + change fiber (Elimination.X : Elimination.G R α)∈small 0 + simp + | some a => + change fiber (Elimination.Y a : Elimination.G R α)∈small 1 + rw [fiber_Y] + exact eval_small (.leaf (0,a)) le_rfl + | node t u ht hu => + rw [Tree.eval,fiber_lie,Tree.leaves,countSome_append] + exact (small _).sub_mem + ((small _).add_mem (bracket_small ht hu) + ((small _).smul_mem _ (small_mono (Nat.le_add_left _ _) (shift_small hu)))) + ((small _).smul_mem _ (small_mono (Nat.le_add_right _ _) (shift_small ht))) + +theorem fiber_remainder (a : α) {p : FL R α} {n : ℕ} (hp : p∈small (n+1)) : + fiber (rename (IntegralWords.tag a) (p-kill a p))∈small n := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨t,ht,rfl⟩ := hp + rw [kill_eval] + split_ifs with ha + · rw [sub_zero,rename_eval] + apply small_mono _ (fiber_eval (R := R) (t.map (IntegralWords.tag a))) + have hnone : none∈(t.map (IntegralWords.tag a)).leaves := by + rw [Tree.leaves_map] + exact List.mem_map.mpr ⟨a,ha,by simp [IntegralWords.tag]⟩ + have hlt := IntegralWords.countSome_lt hnone + simp only [Tree.leaves_map,List.length_map] at hlt ⊢ + omega + · simp + | zero => simp + | add p q _ _ hp hq => + have h : p+q-kill a (p+q) = (p-kill a p)+(q-kill a q) := by rw [map_add]; abel + rw [h,map_add,map_add] + exact (small _).add_mem hp hq + | smul r p _ hp => + simpa only [map_smul,← smul_sub] using (small _).smul_mem r hp + +def traceAssoc : A R (Option α) →ₐ[R] R := lift (fun | none => 1 | some _ => 0) +theorem trace_embed (p : Elimination.G R α) : + traceAssoc (embed p) = (Elimination.expand p).right := by + have h : (traceAssoc : A R (Option α) →ₐ[R] R).toLieHom.comp embed = + (SemiDirectSum.projr Elimination.action).comp Elimination.expand := by + apply FreeLieAlgebra.hom_ext + intro a + cases a <;> simp [traceAssoc,Elimination.expand] + exact LieHom.congr_fun h p + +theorem untag_tag (a : α) (p : FL R α) : + rename (IntegralWords.untag a) (rename (IntegralWords.tag a) p) = p := by + have h : (rename (IntegralWords.untag a) : FL R (Option α) →ₗ⁅R⁆ FL R α).comp + (rename (IntegralWords.tag a)) = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro b + simp [IntegralWords.tag,IntegralWords.untag] + split_ifs <;> simp_all + exact LieHom.congr_fun h p + +universe u v + +theorem kernel_bounded (R : Type v) [CommRing R] (n : ℕ) : + ∀ (α : Type u) (p : FL R α), p∈small n → embed p=0 → p=0 := by + induction n with + | zero => intro α p hp _; exact small_zero hp + | succ n ih => + intro α p hp hzero + have hs : ∀ S : Finset α, ∀ p : FL R α, p∈bounded (n+1) S → embed p=0 → p=0 := by + intro S + induction S using Finset.induction_on with + | empty => intro p hp _; exact bounded_empty hp + | @insert a S ha ihS => + intro p hp hz + have hk : kill a p=0 := ihS (kill a p) (kill_bounded a S hp) (by rw [kill_embed,hz,map_zero]) + have ht : embed (rename (IntegralWords.tag a) p)=0 := by rw [rename_embed,hz,map_zero] + have hf : fiber (rename (IntegralWords.tag a) p)=0 := by + apply ih (ℕ×α) _ + · simpa only [hk,sub_zero] using fiber_remainder a (bounded_small _ _ hp) + · change embed (Elimination.expand (rename (IntegralWords.tag a) p)).left=0 + rw [← extract_embed,ht,map_zero] + have hr : (Elimination.expand (rename (IntegralWords.tag a) p)).right=0 := by + rw [← trace_embed,ht,map_zero] + have he : Elimination.expand (rename (IntegralWords.tag a) p)=0 := by + apply SemiDirectSum.ext + · exact hf + · exact hr + have hz' : rename (IntegralWords.tag a) p=0 := by + rw [← Elimination.collapse_expand (rename (IntegralWords.tag a) p),he,map_zero] + rw [← untag_tag a p,hz',map_zero] + obtain ⟨S,hS⟩ := small_exists_support hp + exact hs S p hS hzero + +theorem injective : Function.Injective (embed : FL R α →ₗ⁅R⁆ A R α) := by + intro p q h + obtain ⟨n,hn⟩ := small_exists (p-q) + have h0 : embed (p-q)=0 := by rw [map_sub,h,sub_self] + exact sub_eq_zero.mp (kernel_bounded R n α (p-q) hn h0) + +end UniversalEmbedding + +namespace QuadraticAlphabet +open AssociativeElimination LieAlgebra +attribute [local instance] LieRing.ofAssociativeRing +abbrev F := ZMod 2 +inductive Letter | a | c | b deriving DecidableEq +instance (α : Type*) : CharP (A F α) 2 := + charP_of_injective_ringHom (algebraMap F (A F α)).injective 2 +abbrev S := A F Letter +abbrev T := A F (Option Unit) +def a : S := atom Letter.a +def c : S := atom Letter.c +def b : S := atom Letter.b +def x : T := atom none +def y : T := atom (some ()) + +def delta : S →ₗ[F] S := deriv (fun | .a => 0 | .c => ⁅a,b⁆ | .b => c) +@[simp] theorem delta_a : delta a=0 := by simp [delta,a] +@[simp] theorem delta_b : delta b=c := by simp [delta,b] +@[simp] theorem delta_c : delta c=⁅a,b⁆ := by simp [delta,c] +@[simp] theorem delta_one : delta 1=0 := deriv_one _ +theorem delta_mul (p q : S) : delta (p*q)=delta p*q+p*delta q := deriv_mul _ _ _ +theorem delta_lie (p q : S) : delta ⁅p,q⁆=⁅delta p,q⁆+⁅p,delta q⁆ := deriv_lie _ _ _ + +theorem algebra_induction {R α : Type*} [CommRing R] {P : A R α → Prop} + (p : A R α) (h1 : P 1) (ha : ∀ a, P (atom a)) + (hadd : ∀ p q, P p → P q → P (p+q)) + (hs : ∀ (r : R) p, P p → P (r • p)) + (hm : ∀ p q, P p → P q → P (p*q)) : P p := by + apply MonoidAlgebra.induction_on p ?_ hadd hs + intro w + change P (MonoidAlgebra.single w 1) + have hh : ∀ v : List α, P (MonoidAlgebra.single (FreeMonoid.ofList v) 1) := by + intro v + induction v with + | nil => exact h1 + | cons a v ih => + convert hm (atom a) (MonoidAlgebra.single (FreeMonoid.ofList v) 1) (ha a) ih using 1 + simp only [atom,MonoidAlgebra.single_mul_single,one_mul,FreeMonoid.ofList_cons] + simpa using hh w.toList + +theorem delta_square_mul (p q : S) : + delta (delta (p*q))=delta (delta p)*q+p*delta (delta q) := by + rw [delta_mul,map_add,delta_mul,delta_mul] + calc + _ = delta (delta p)*q+p*delta (delta q)+(delta p*delta q+delta p*delta q) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] + +theorem delta_square (p : S) : delta (delta p)=⁅a,p⁆ := by + induction p using algebra_induction with + | h1 => simp [Ring.lie_def] + | ha l => + cases l with + | a => change delta (delta a)=⁅a,a⁆; simp + | c => change delta (delta c)=⁅a,c⁆; simp [delta_lie] + | b => change delta (delta b)=⁅a,b⁆; simp + | hadd p q hp hq => simp [hp,hq,lie_add] + | hs r p hp => simp [hp] + | hm p q hp hq => rw [delta_square_mul,hp,hq]; simp [Ring.lie_def]; noncomm_ring + +def left : S →ₐ[F] Module.End F (S×S) where + toFun p := + { toFun := fun z => (p*z.1,p*z.2) + map_add' := by intro z w; ext <;> simp [mul_add] + map_smul' := by intro r z; ext <;> simp } + map_one' := by ext z <;> simp + map_mul' := by intro p q; ext z <;> simp [mul_assoc] + map_zero' := by ext z <;> simp + map_add' := by intro p q; ext z <;> simp [add_mul] + commutes' := by intro r; ext z <;> simp [Algebra.algebraMap_eq_smul_one] + +@[simp] theorem left_apply (p : S) (z : S×S) : left p z=(p*z.1,p*z.2) := rfl + +def root : Module.End F (S×S) where + toFun z := (delta z.1+z.2*a,z.1+delta z.2) + map_add' := by intro z w; apply Prod.ext <;> simp only [Prod.fst_add,Prod.snd_add,map_add,add_mul] <;> abel + map_smul' := by intro r z; ext <;> simp [smul_add] +@[simp] theorem root_apply (z : S×S) : root z=(delta z.1+z.2*a,z.1+delta z.2) := rfl + +theorem root_comm (p : S) : ⁅root,left p⁆=left (delta p) := by + apply LinearMap.ext + intro z + apply Prod.ext <;> simp [Ring.lie_def,delta_mul,Module.End.mul_apply,mul_add,mul_assoc] + +theorem root_square : root*root=left a := by + apply LinearMap.ext + intro z + apply Prod.ext <;> simp only [Module.End.mul_apply,root_apply,left_apply, + map_add,delta_mul,delta_square,delta_a,mul_zero,add_zero,Ring.lie_def,add_mul] + · calc + _ = a*z.1+(delta z.2*a+delta z.2*a) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] + · calc + _ = a*z.2+(delta z.1+delta z.1) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] + +def substitution : S →ₐ[F] T := lift (fun | .a => x*x | .c => ⁅x,y⁆ | .b => y) +@[simp] theorem substitution_a : substitution a=x*x := by simp [substitution,a] +@[simp] theorem substitution_c : substitution c=⁅x,y⁆ := by simp [substitution,c] +@[simp] theorem substitution_b : substitution b=y := by simp [substitution,b] + +def representation : T →ₐ[F] Module.End F (S×S) := + lift (fun | none => root | some _ => left b) +@[simp] theorem representation_x : representation x=root := by simp [representation,x] +@[simp] theorem representation_y : representation y=left b := by simp [representation,y] + +theorem representation_substitution : representation.comp substitution=left := by + apply hom_ext + intro l + cases l with + | a => change representation (substitution a)=left a; simp [root_square] + | c => + change representation (substitution c)=left c + rw [substitution_c] + change representation (x*y-y*x)=left c + rw [map_sub,map_mul,map_mul,representation_x,representation_y] + change ⁅root,left b⁆=left c + rw [root_comm,delta_b] + | b => change representation (substitution b)=left b; simp + +theorem left_injective : Function.Injective left := by + intro p q h + have hh := congrArg (fun f : Module.End F (S×S) => (f (1,0)).1) h + simpa using hh + +theorem substitution_injective : Function.Injective substitution := by + intro p q h + apply left_injective + rw [← representation_substitution] + exact congrArg representation h + +theorem ad_square (u v : T) : ⁅u,⁅u,v⁆⁆=⁅u*u,v⁆ := by + simp only [Ring.lie_def,sub_eq_add_neg,CharTwo.neg_eq,mul_add,add_mul,mul_assoc] + calc + _ = u*(u*v)+v*(u*u)+(u*(v*u)+u*(v*u)) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] + +abbrev LABC := FreeLieAlgebra F Letter +def la : LABC := FreeLieAlgebra.of F Letter.a +def lc : LABC := FreeLieAlgebra.of F Letter.c +def lb : LABC := FreeLieAlgebra.of F Letter.b +def under : LABC →ₗ⁅F⁆ T := substitution.toLieHom.comp embed +@[simp] theorem under_a : under la=x*x := by simp [under,la,substitution] +@[simp] theorem under_c : under lc=⁅x,y⁆ := by simp [under,lc,substitution] +@[simp] theorem under_b : under lb=y := by simp [under,lb,substitution] + +def lieDelta : LieDerivation F LABC LABC := + FreeDerivations.extend (fun | .a => 0 | .c => ⁅la,lb⁆ | .b => lc) +@[simp] theorem lieDelta_a : lieDelta la=0 := by simp [lieDelta,la] +@[simp] theorem lieDelta_c : lieDelta lc=⁅la,lb⁆ := by simp [lieDelta,lc] +@[simp] theorem lieDelta_b : lieDelta lb=lc := by simp [lieDelta,lb] + +theorem under_delta (p : LABC) : under (lieDelta p)=⁅x,under p⁆ := by + induction p using freeLie_induction with + | h0 => simp + | hg l => + cases l with + | a => change under (lieDelta la)=⁅x,under la⁆; simp [Ring.lie_def,mul_assoc] + | c => change under (lieDelta lc)=⁅x,under lc⁆; simp [LieHom.map_lie,ad_square] + | b => change under (lieDelta lb)=⁅x,under lb⁆; simp + | ha p q hp hq => simp [hp,hq,lie_add] + | hs r p hp => simp [hp] + | hl p q hp hq => + simp only [LieDerivation.apply_lie_eq_add,map_add,LieHom.map_lie,hp,hq] + simpa only [add_comm] using (leibniz_lie x (under p) (under q)).symm + +def iter (i : ℕ) : LABC := lieDelta^[i] lb +@[simp] theorem iter_zero : iter 0=lb := rfl +@[simp] theorem iter_succ (i : ℕ) : iter (i+1)=lieDelta (iter i) := + Function.iterate_succ_apply' _ _ _ + +theorem under_iter (i : ℕ) : under (iter i)=embed (Elimination.adWord i () : Elimination.G F Unit) := by + induction i with + | zero => simp [Elimination.Y,y] + | succ i ih => + rw [iter_succ,under_delta,ih,Elimination.adWord_succ,LieHom.map_lie] + simp [Elimination.X,x] + +def fiberLift : Elimination.F F Unit →ₗ⁅F⁆ LABC := + FreeLieAlgebra.lift F (fun (i,_) => iter i) +theorem under_fiberLift (p : Elimination.F F Unit) : + under (fiberLift p)=embed (Elimination.collapseFiber p) := by + have h : under.comp fiberLift = (embed : Elimination.G F Unit →ₗ⁅F⁆ T).comp Elimination.collapseFiber := by + apply FreeLieAlgebra.hom_ext + rintro ⟨i,u⟩ + cases u + simp [fiberLift,Elimination.collapseFiber,under_iter] + exact LieHom.congr_fun h p + +def polynomial (p : Elimination.G F Unit) : LABC := fiberLift (Elimination.expand p).left + +theorem decompose (p : Elimination.G F Unit) : + embed p=under (polynomial p)+(Elimination.expand p).right • x := by + rw [polynomial,under_fiberLift] + have hx : embed (Elimination.X : Elimination.G F Unit)=x := by simp [Elimination.X,x] + rw [← hx,← map_smul,← map_add] + conv_lhs => rw [← Elimination.collapse_expand p] + rfl + +theorem under_injective : Function.Injective under := by + intro p q h + exact UniversalEmbedding.injective (substitution_injective h) + +theorem represent_unique (p : Elimination.G F Unit) + (hp : (Elimination.expand p).right=0) : ∃! q : LABC, under q=embed p := by + refine ⟨polynomial p,?_,?_⟩ + · simpa only [hp,zero_smul,add_zero] using (decompose p).symm + · intro q hq + apply under_injective + rw [hq,decompose,hp,zero_smul,add_zero] + +def homogeneous (n : ℕ) : Submodule F (Elimination.G F Unit) := + Submodule.span F {p | ∃ t : UniversalEmbedding.Tree (Option Unit), t.leaves.length=n ∧ t.eval=p} + +theorem homogeneous_trace_zero {p : Elimination.G F Unit} {n : ℕ} + (hn : 1 simp [UniversalEmbedding.Tree.leaves] at ht + | node t u => + simp [UniversalEmbedding.Tree.eval,LieHom.map_lie,Ring.lie_def,mul_comm] + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨t,ht,rfl⟩ := hp; exact hm t (ht ▸ hn) + | zero => simp + | add p q _ _ hp hq => simp [hp,hq] + | smul r p _ hp => simp [hp] + +theorem homogeneous_representation {p : Elimination.G F Unit} {n : ℕ} + (hn : 1 FreeLieAlgebra R α + +def extend (d : LieDerivation R FL FL) : Module.End R (A R α) := + deriv (fun a => embed (d (FreeLieAlgebra.of R a))) +@[simp] theorem extend_atom (d : LieDerivation R FL FL) (a : α) : + extend d (atom a) = embed (d (FreeLieAlgebra.of R a)) := by simp [extend] +@[simp] theorem extend_one (d : LieDerivation R FL FL) : + extend d 1=0 := deriv_one _ +theorem extend_mul (d : LieDerivation R FL FL) (p q : A R α) : + extend d (p*q)=extend d p*q+p*extend d q := deriv_mul _ p q + +theorem extend_embed (d : LieDerivation R FL FL) (p : FL) : + extend d (embed p)=embed (d p) := by + induction p using freeLie_induction with + | h0 => simp + | hg a => simp + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => + simp only [LieHom.map_lie,extend,deriv_lie] at * + rw [hp,hq,LieDerivation.apply_lie_eq_add,map_add,LieHom.map_lie,LieHom.map_lie] + exact add_comm _ _ + +theorem linear_ext {f g : Module.End R (A R α)} + (h1 : f 1=g 1) (ha : ∀ a, f (atom a)=g (atom a)) + (hf : ∀ p q, f (p*q)=f p*q+p*f q) + (hg : ∀ p q, g (p*q)=g p*q+p*g q) : f=g := by + apply LinearMap.ext + intro p + induction p using QuadraticAlphabet.algebra_induction with + | h1 => exact h1 + | ha a => exact ha a + | hadd p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hm p q hp hq => rw [hf,hg,hp,hq] + +theorem comm_mul (f g : Module.End R (A R α)) + (hf : ∀ p q, f (p*q)=f p*q+p*f q) + (hg : ∀ p q, g (p*q)=g p*q+p*g q) (p q : A R α) : + ⁅f,g⁆ (p*q)=⁅f,g⁆ p*q+p*⁅f,g⁆ q := by + change f (g (p*q))-g (f (p*q))=(f (g p)-g (f p))*q+p*(f (g q)-g (f q)) + rw [hf,hg,map_add,map_add,hf,hf,hg,hg] + noncomm_ring + +def hom : LieDerivation R FL FL →ₗ⁅R⁆ Module.End R (A R α) where + toFun := extend + map_add' d e := by + apply linear_ext + · simp + · intro a; simp [LieDerivation.add_apply] + · exact extend_mul _ + · intro p q; simp only [LinearMap.add_apply,extend_mul]; noncomm_ring + map_smul' r d := by + apply linear_ext + · simp + · intro a; simp + · exact extend_mul _ + · intro p q; simp [extend_mul,smul_add] + map_lie' {d e} := by + apply linear_ext + · change extend ⁅d,e⁆ 1=extend d (extend e 1)-extend e (extend d 1) + simp + · intro a + change extend ⁅d,e⁆ (atom a)=extend d (extend e (atom a))-extend e (extend d (atom a)) + simp [extend_embed] + · exact extend_mul _ + · exact comm_mul _ _ (extend_mul d) (extend_mul e) + +@[simp] theorem hom_apply (d : LieDerivation R FL FL) (p : A R α) : + hom d p=extend d p := rfl + +theorem comm_left (d : LieDerivation R FL FL) (p : A R α) : + ⁅hom d,leftMul p⁆=leftMul (extend d p) := by + apply LinearMap.ext + intro q + change extend d (p*q)-p*extend d q=extend d p*q + rw [extend_mul,add_sub_cancel_right] +end AssociativeDerivations + +namespace EnvelopingTools +open LieAlgebra +attribute [local instance] LieRing.ofAssociativeRing +variable {R L : Type*} [CommRing R] [LieRing L] [LieAlgebra R L] + +theorem induction (q : UniversalEnvelopingAlgebra R L) + {P : UniversalEnvelopingAlgebra R L → Prop} + (hs : ∀ r, P (algebraMap R _ r)) + (hi : ∀ l, P (UniversalEnvelopingAlgebra.ι R l)) + (ha : ∀ a b, P a → P b → P (a+b)) + (hm : ∀ a b, P a → P b → P (a*b)) : P q := by + let K : Subalgebra R (UniversalEnvelopingAlgebra R L) := + { carrier := {a | P a} + algebraMap_mem' := hs + add_mem' := fun ha' hb' => ha _ _ ha' hb' + mul_mem' := fun ha' hb' => hm _ _ ha' hb' } + let i : L →ₗ⁅R⁆ K := + { (UniversalEnvelopingAlgebra.ι R).toLinearMap.codRestrict K.toSubmodule hi with + map_lie' := by intro a b; apply Subtype.ext; exact LieHom.map_lie _ a b } + let f := UniversalEnvelopingAlgebra.lift R i + have h : K.val.comp f=AlgHom.id R (UniversalEnvelopingAlgebra R L) := by + apply UniversalEnvelopingAlgebra.hom_ext + apply LieHom.ext + intro l + change (f (UniversalEnvelopingAlgebra.ι R l) : UniversalEnvelopingAlgebra R L)= + UniversalEnvelopingAlgebra.ι R l + rw [UniversalEnvelopingAlgebra.lift_ι_apply] + rfl + have hq := (f q).property + change P ((K.val.comp f) q) at hq + simpa only [h,AlgHom.id_apply] using hq +end EnvelopingTools + +namespace FiberPBW +open AssociativeElimination LieAlgebra +open scoped TensorProduct +attribute [local instance] LieRing.ofAssociativeRing +variable {R α G : Type*} [CommRing R] [LieRing G] [LieAlgebra R G] +local notation "F" => FreeLieAlgebra R α +local notation "B" => UniversalEnvelopingAlgebra R G +variable (act : G →ₗ⁅R⁆ LieDerivation R (FreeLieAlgebra R α) (FreeLieAlgebra R α)) +abbrev M := SemiDirectSum (R:=R) F G act +local notation "V" => A R α ⊗[R] B + +def onLeft (f : Module.End R (A R α)) : Module.End R V := + f.rTensor B + +def onRight (f : Module.End R B) : Module.End R V := + f.lTensor (A R α) + +@[simp] theorem onLeft_tmul (f : Module.End R (A R α)) (p : A R α) (b : B) : + onLeft f (p⊗ₜ b)=f p⊗ₜ b := rfl +@[simp] theorem onRight_tmul (f : Module.End R B) (p : A R α) (b : B) : + onRight f (p⊗ₜ b)=p⊗ₜ f b := rfl + +theorem commute_tensor (f : Module.End R (A R α)) (g : Module.End R B) : + ⁅onLeft (G:=G) f,onRight (α:=α) g⁆=0 := by + apply TensorProduct.ext' + intro p b + simp + +def fiber : F →ₗ⁅R⁆ Module.End R V := + (Module.End.rTensorAlgHom R (A R α) B).toLieHom.comp (leftMul.toLieHom.comp embed) + +def action : G →ₗ⁅R⁆ Module.End R V := + (Module.End.rTensorAlgHom R (A R α) B).toLieHom.comp (AssociativeDerivations.hom.comp act) + +def baseLeft : B →ₐ[R] Module.End R B := Algebra.lsmul R R B + +def constant : G →ₗ⁅R⁆ Module.End R V := + (Module.End.lTensorAlgHom R B (A R α)).toLieHom.comp + (baseLeft.toLieHom.comp (UniversalEnvelopingAlgebra.ι R)) + +def base : G →ₗ⁅R⁆ Module.End R V where + toFun g := action act g+constant g + map_add' g h := by simp only [map_add]; abel + map_smul' r g := by simp only [map_smul,smul_add,RingHom.id_apply] + map_lie' {g h} := by + have h1 : ⁅action act g,constant h⁆=0 := commute_tensor _ _ + have h2 : ⁅action act h,constant g⁆=0 := commute_tensor _ _ + change action act ⁅g,h⁆+constant ⁅g,h⁆= _ + rw [LieHom.map_lie,LieHom.map_lie] + change (action act g*action act h-action act h*action act g)+ + (constant g*constant h-constant h*constant g)= + (action act g+constant g)*(action act h+constant h)- + (action act h+constant h)*(action act g+constant g) + change action act g*constant h-constant h*action act g=0 at h1 + change action act h*constant g-constant g*action act h=0 at h2 + have h1' : action act g*constant h=constant h*action act g := by + exact (sub_eq_zero (a:=action act g*constant h) (b:=constant h*action act g)).mp h1 + have h2' : action act h*constant g=constant g*action act h := by + exact (sub_eq_zero (a:=action act h*constant g) (b:=constant g*action act h)).mp h2 + simp only [add_mul,mul_add] + rw [h1',h2'] + abel + +@[simp] theorem fiber_tmul (p : F) (q : A R α) (b : B) : + fiber p (q⊗ₜ b)=(embed p*q)⊗ₜ b := rfl +@[simp] theorem base_tmul (g : G) (q : A R α) (b : B) : + base act g (q⊗ₜ b)=AssociativeDerivations.extend (act g) q⊗ₜ b+ + q⊗ₜ (UniversalEnvelopingAlgebra.ι R g*b) := rfl + +theorem compatibility (g : G) (p : F) : + fiber (G:=G) (act g p)=⁅base act g,fiber (G:=G) p⁆ := by + apply TensorProduct.ext' + intro q b + change fiber (act g p) (q⊗ₜ b)= + base act g (fiber p (q⊗ₜ b))-fiber p (base act g (q⊗ₜ b)) + simp only [base_tmul,fiber_tmul,map_add,AssociativeDerivations.extend_mul, + AssociativeDerivations.extend_embed,TensorProduct.add_tmul] + abel + +def representation : M act →ₗ⁅R⁆ Module.End R V := + InnerSemiDirect.lift act fiber (base act) (compatibility act) + +def operators : UniversalEnvelopingAlgebra R (M act) →ₐ[R] Module.End R V := + UniversalEnvelopingAlgebra.lift R (representation act) + +def fiberIn : A R α →ₐ[R] UniversalEnvelopingAlgebra R (M act) := + lift (fun a => UniversalEnvelopingAlgebra.ι R (SemiDirectSum.inl act (FreeLieAlgebra.of R a))) +def baseIn : B →ₐ[R] UniversalEnvelopingAlgebra R (M act) := + UniversalEnvelopingAlgebra.lift R ((UniversalEnvelopingAlgebra.ι R).comp (SemiDirectSum.inr act)) + +theorem operators_fiber : (operators act).comp (fiberIn act)= + (Module.End.rTensorAlgHom R (A R α) B).comp leftMul := by + apply AssociativeElimination.hom_ext (R:=R) (α:=α) + intro a + simp only [AlgHom.comp_apply,fiberIn,lift_atom,operators,UniversalEnvelopingAlgebra.lift_ι_apply, + representation,InnerSemiDirect.lift_inl,fiber,LieHom.comp_apply,embed_of] + rfl + +theorem operators_base_one (p : B) (b : B) : + operators act (baseIn act p) ((1 : A R α)⊗ₜ b)=1⊗ₜ (p*b) := by + induction p using EnvelopingTools.induction generalizing b with + | hs r => simp [Algebra.algebraMap_eq_smul_one] + | hi g => + simp only [baseIn,UniversalEnvelopingAlgebra.lift_ι_apply,LieHom.comp_apply, + operators,representation,InnerSemiDirect.lift_inr,base_tmul, + AssociativeDerivations.extend_one,TensorProduct.zero_tmul,zero_add] + | ha p q hp hq => simp [hp,hq,add_mul,TensorProduct.tmul_add] + | hm p q hp hq => + simp only [map_mul,Module.End.mul_apply] + rw [hq,hp,mul_assoc] + +def normal : V →ₗ[R] UniversalEnvelopingAlgebra R (M act) := + TensorProduct.lift + { toFun := fun p => + { toFun := fun b => fiberIn act p*baseIn act b + map_add' := by intro b c; simp [mul_add] + map_smul' := by intro r b; simp } + map_add' := by intro p q; ext b; simp [add_mul] + map_smul' := by intro r p; ext b; simp } +@[simp] theorem normal_tmul (p : A R α) (b : B) : + normal act (p⊗ₜ b)=fiberIn act p*baseIn act b := rfl + +def extract : UniversalEnvelopingAlgebra R (M act) →ₗ[R] V := + (LinearMap.applyₗ ((1 : A R α)⊗ₜ (1 : B))).comp (operators act).toLinearMap + +theorem extract_normal (z : V) : extract act (normal act z)=z := by + have h : (extract act).comp (normal act)=LinearMap.id := by + apply TensorProduct.ext' + intro p b + change operators act (fiberIn act p*baseIn act b) (1⊗ₜ (1 : B))=p⊗ₜ b + rw [map_mul,Module.End.mul_apply,operators_base_one,mul_one] + have hh := AlgHom.congr_fun (operators_fiber act) p + change operators act (fiberIn act p) (1⊗ₜ b)=p⊗ₜ b + simp only [AlgHom.comp_apply] at hh + rw [hh] + change (p*1)⊗ₜ b=p⊗ₜ b + rw [mul_one] + exact LinearMap.congr_fun h z + +theorem normal_injective : Function.Injective (normal act) := + Function.LeftInverse.injective (extract_normal act) + +end FiberPBW + +namespace GenericBraid +open LieAlgebra FreeDerivations +variable {R α : Type*} [CommRing R] +abbrev Free (R α : Type*) [CommRing R] := FreeLieAlgebra R (α×α) +def gen (i j : α) : Free R α := FreeLieAlgebra.of R (i,j) +def relations : Set (Free R α) := {q | + (∃ i, q=gen (R:=R) i i) ∨ (∃ i j, q=gen (R:=R) i j-gen (R:=R) j i) ∨ + (∃ i j k l, i≠k ∧ i≠l ∧ j≠k ∧ j≠l ∧ q=⁅gen (R:=R) i j,gen (R:=R) k l⁆) ∨ + (∃ i j k, i≠j ∧ i≠k ∧ j≠k ∧ q=⁅gen (R:=R) i j,gen (R:=R) i k+gen (R:=R) j k⁆)} +def ideal : LieIdeal R (Free R α) := LieSubmodule.lieSpan R _ relations +abbrev T (R α : Type*) [CommRing R] := Free R α ⧸ (ideal (R:=R) (α:=α)) +def t (i j : α) : T R α := (ideal (R:=R) (α:=α)).mkQ (gen i j) + +theorem relation_zero {q : Free R α} (h : q∈relations) : + (ideal (R:=R) (α:=α)).mkQ q=0 := by + exact (LieSubmodule.Quotient.mk_eq_zero _).mpr (LieSubmodule.subset_lieSpan h) +@[simp] theorem t_self (i : α) : t (R:=R) i i=0 := + relation_zero (Or.inl ⟨i,rfl⟩) +theorem t_comm (i j : α) : t (R:=R) i j=t j i := by + have h := relation_zero (R:=R) (Or.inr (Or.inl ⟨i,j,rfl⟩)) + simpa only [map_sub,sub_eq_zero,t] using h +theorem t_disjoint (i j k l : α) (hik : i≠k) (hil : i≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅t (R:=R) i j,t (R:=R) k l⁆=0 := by + change (ideal (R:=R) (α:=α)).mkQ (⁅gen i j,gen k l⁆)=0 + exact relation_zero (Or.inr (Or.inr (Or.inl ⟨i,j,k,l,hik,hil,hjk,hjl,rfl⟩))) +theorem t_three (i j k : α) (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + ⁅t (R:=R) i j,t (R:=R) i k+t (R:=R) j k⁆=0 := by + change (ideal (R:=R) (α:=α)).mkQ (⁅gen i j,gen i k+gen j k⁆)=0 + exact relation_zero (Or.inr (Or.inr (Or.inr ⟨i,j,k,hij,hik,hjk,rfl⟩))) + +variable {E : Type*} [LieRing E] [LieAlgebra R E] +def lift (f : α → α → E) (hz : ∀ i, f i i=0) (hs : ∀ i j,f i j=f j i) + (hd : ∀ i j k l,i≠k → i≠l → j≠k → j≠l → ⁅f i j,f k l⁆=0) + (ht : ∀ i j k,i≠j → i≠k → j≠k → ⁅f i j,f i k+f j k⁆=0) : T R α →ₗ⁅R⁆ E := by + let p := FreeLieAlgebra.lift R (fun ij : α×α => f ij.1 ij.2) + have hker : ideal (R:=R) (α:=α) ≤ p.ker := by + rw [ideal,LieSubmodule.lieSpan_le] + intro q hq + change p q=0 + rcases hq with ⟨i,rfl⟩ | ⟨i,j,rfl⟩ | ⟨i,j,k,l,hik,hil,hjk,hjl,rfl⟩ | ⟨i,j,k,hij,hik,hjk,rfl⟩ + · simpa only [p,gen,FreeLieAlgebra.lift_of_apply] using hz i + · simpa only [map_sub,p,gen,FreeLieAlgebra.lift_of_apply,sub_eq_zero] using hs i j + · simpa only [LieHom.map_lie,p,gen,FreeLieAlgebra.lift_of_apply] using hd i j k l hik hil hjk hjl + · simpa only [LieHom.map_lie,map_add,p,gen,FreeLieAlgebra.lift_of_apply] using ht i j k hij hik hjk + exact { (ideal (R:=R) (α:=α)).toSubmodule.liftQ p.toLinearMap hker with + map_lie' := by + intro a b + induction a using Submodule.Quotient.induction_on with | _ a => + induction b using Submodule.Quotient.induction_on with | _ b => + exact p.map_lie a b } +@[simp] theorem lift_t (f : α → α → E) (hz hs hd ht) (i j : α) : + lift f hz hs hd ht (t (R:=R) i j)=f i j := by + change FreeLieAlgebra.lift R (fun ij : α×α => f ij.1 ij.2) (FreeLieAlgebra.of R (i,j))=f i j + simp only [FreeLieAlgebra.lift_of_apply] + +variable [DecidableEq α] +def action : T R α →ₗ⁅R⁆ LieDerivation R (FreeLieAlgebra R α) (FreeLieAlgebra R α) := + lift pair pair_self pair_comm pair_disjoint pair_three +local notation "F" => FreeLieAlgebra R α +local notation "SD" => SemiDirectSum F (T R α) action +@[simp] theorem action_t (i j : α) : action (t (R:=R) i j)=pair i j := by simp [action] +def fiber (i : α) : SD := SemiDirectSum.inl action (FreeLieAlgebra.of R i) +def base (i j : α) : SD := SemiDirectSum.inr action (t i j) +def chord : Option α → Option α → SD + | none, none => 0 + | none, some j => fiber j + | some i, none => fiber i + | some i, some j => base i j +@[simp] theorem chord_nn : chord (R:=R) (α:=α) none none=0 := rfl +@[simp] theorem chord_ns (i : α) : chord (R:=R) none (some i)=fiber i := rfl +@[simp] theorem chord_sn (i : α) : chord (R:=R) (some i) none=fiber i := rfl +@[simp] theorem chord_ss (i j : α) : chord (R:=R) (some i) (some j)=base i j := rfl +@[simp] theorem chord_self (i : Option α) : chord (R:=R) i i=0 := by + cases i <;> simp [base] +theorem chord_comm (i j : Option α) : chord (R:=R) i j=chord j i := by + cases i <;> cases j <;> simp [base,t_comm] +theorem base_fiber (i j k : α) : ⁅base (R:=R) i j,fiber k⁆= + SemiDirectSum.inl action (pair (R:=R) i j (FreeLieAlgebra.of R k)) := by + simp [base,fiber] +theorem fiber_base (i j k : α) : ⁅fiber (R:=R) k,base i j⁆= + -SemiDirectSum.inl action (pair (R:=R) i j (FreeLieAlgebra.of R k)) := by + rw [← lie_skew,base_fiber] +theorem chord_disjoint (i j k l : Option α) + (hik : i≠k) (hil : i≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅chord (R:=R) i j,chord (R:=R) k l⁆=0 := by + cases i <;> cases j <;> cases k <;> cases l <;> + simp_all [base,fiber,t_disjoint] + all_goals apply pair_of_other <;> intro h <;> subst_vars <;> contradiction +theorem chord_three (i j k : Option α) (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + ⁅chord (R:=R) i j,chord (R:=R) i k+chord (R:=R) j k⁆=0 := by + cases i with + | none => + cases j with + | none => exact (hij rfl).elim + | some j => + cases k with + | none => exact (hik rfl).elim + | some k => + rw [chord_ns,chord_ns,chord_ss,lie_add,fiber_base] + simp [fiber] + grind [lie_skew] + | some i => + cases j with + | none => + cases k with + | none => exact (hjk rfl).elim + | some k => + rw [chord_sn,chord_ss,chord_ns,lie_add,fiber_base] + simp [fiber] + grind [lie_skew] + | some j => + cases k with + | none => + rw [chord_ss,chord_sn,chord_sn,lie_add,base_fiber,base_fiber] + simp only [pair_of_left,pair_of_right,← map_add] + grind [lie_skew] + | some k => + simp only [chord_ss,base,← map_add,← LieHom.map_lie] + rw [t_three _ _ _ (fun h => hij (congrArg some h)) + (fun h => hik (congrArg some h)) (fun h => hjk (congrArg some h)),map_zero] +def toSemidirect : T R (Option α) →ₗ⁅R⁆ SD := + lift chord chord_self chord_comm chord_disjoint chord_three +@[simp] theorem toSemidirect_t (i j : Option α) : toSemidirect (t (R:=R) i j)=chord i j := by + simp [toSemidirect] +end GenericBraid + +namespace RestrictedAlphabet +open AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +abbrev F := ZMod 2 +inductive Letter (α : Type*) | a | c (i : α) | b (i : α) +variable {α : Type*} +abbrev S (α : Type*) := A F (Letter α) +abbrev T (α : Type*) := A F (Option α) +def a : S α := atom .a +def b (i : α) : S α := atom (.b i) +def c (i : α) : S α := atom (.c i) +def y (i : α) : T α := atom (some i) +def x : T α := atom none +def delta : Module.End F (S α) := deriv (fun (l : Letter α) => match l with | .a => 0 | .c i => ⁅(a : S α),b i⁆ | .b i => c i) +@[simp] theorem delta_a : delta (a : S α)=0 := by simp [delta,a] +@[simp] theorem delta_b (i : α) : delta (b i)=c i := by simp [delta,b] +@[simp] theorem delta_c (i : α) : delta (c i)=⁅(a : S α),b i⁆ := by simp [delta,c] +@[simp] theorem delta_one : delta (1 : S α)=0 := deriv_one _ +theorem delta_mul (p q : S α) : delta (p*q)=delta p*q+p*delta q := deriv_mul _ _ _ +theorem delta_lie (p q : S α) : delta ⁅p,q⁆=⁅delta p,q⁆+⁅p,delta q⁆ := deriv_lie _ _ _ +theorem delta_square_mul (p q : S α) : + delta (delta (p*q))=delta (delta p)*q+p*delta (delta q) := by + rw [delta_mul,map_add,delta_mul,delta_mul] + calc + _ = delta (delta p)*q+p*delta (delta q)+(delta p*delta q+delta p*delta q) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] +theorem delta_square (p : S α) : delta (delta p)=⁅(a : S α),p⁆ := by + induction p using QuadraticAlphabet.algebra_induction with + | h1 => simp [Ring.lie_def] + | ha l => + cases l with + | a => change delta (delta a)=⁅a,a⁆; simp + | c i => change delta (delta (c i))=⁅a,c i⁆; simp [delta_lie] + | b i => change delta (delta (b i))=⁅(a : S α),b i⁆; simp + | hadd p q hp hq => simp [hp,hq,lie_add] + | hs r p hp => simp [hp] + | hm p q hp hq => rw [delta_square_mul,hp,hq]; simp [Ring.lie_def]; noncomm_ring + +def left : S α →ₐ[F] Module.End F (S α×S α) where + toFun p := + { toFun := fun z => (p*z.1,p*z.2) + map_add' := by intro z w; ext <;> simp [mul_add] + map_smul' := by intro r z; ext <;> simp } + map_one' := by ext z <;> simp + map_mul' := by intro p q; ext z <;> simp [mul_assoc] + map_zero' := by ext z <;> simp + map_add' := by intro p q; ext z <;> simp [add_mul] + commutes' := by intro r; ext z <;> simp [Algebra.algebraMap_eq_smul_one] +@[simp] theorem left_apply (p : S α) (z : S α×S α) : left p z=(p*z.1,p*z.2) := rfl + +def root : Module.End F (S α×S α) where + toFun z := (delta z.1+z.2*a,z.1+delta z.2) + map_add' := by intro z w; apply Prod.ext <;> simp only [Prod.fst_add,Prod.snd_add,map_add,add_mul] <;> abel + map_smul' := by intro r z; ext <;> simp [smul_add] +@[simp] theorem root_apply (z : S α×S α) : root z=(delta z.1+z.2*a,z.1+delta z.2) := rfl +theorem root_comm (p : S α) : ⁅(root : Module.End F (S α×S α)),left p⁆=left (delta p) := by + apply LinearMap.ext + intro z + apply Prod.ext <;> simp [Ring.lie_def,delta_mul,Module.End.mul_apply,mul_add,mul_assoc] +theorem root_square : root*root=left (a : S α) := by + apply LinearMap.ext + intro z + apply Prod.ext <;> simp only [Module.End.mul_apply,root_apply,left_apply, + map_add,delta_mul,delta_square,delta_a,mul_zero,add_zero,Ring.lie_def,add_mul] + · calc + _ = a*z.1+(delta z.2*a+delta z.2*a) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] + · calc + _ = a*z.2+(delta z.1+delta z.1) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] + +def substitution : S α →ₐ[F] T α := lift (fun | .a => x*x | .c i => ⁅(x : T α),y i⁆ | .b i => y i) +@[simp] theorem substitution_a : substitution (a : S α)=x*x := by simp [substitution,a] +@[simp] theorem substitution_c (i : α) : substitution (c i)=⁅(x : T α),y i⁆ := by simp [substitution,c] +@[simp] theorem substitution_b (i : α) : substitution (b i)=y i := by simp [substitution,b] +def representation : T α →ₐ[F] Module.End F (S α×S α) := + lift (fun | none => root | some i => left (b i)) +@[simp] theorem representation_x : representation (x : T α)=root := by simp [representation,x] +@[simp] theorem representation_y (i : α) : representation (y i)=left (b i) := by simp [representation,y] +theorem representation_substitution : representation.comp substitution=left (α:=α) := by + apply hom_ext + intro l + cases l with + | a => change representation (substitution a)=left a; simp [root_square] + | c i => + change representation (substitution (c i))=left (c i) + rw [substitution_c] + change representation (x*y i-y i*x)=left (c i) + rw [map_sub,map_mul,map_mul,representation_x,representation_y] + exact (root_comm (b i)).trans (congrArg left (delta_b i)) + | b i => change representation (substitution (b i))=left (b i); simp + +theorem injective : Function.Injective (substitution (α:=α)) := by + intro p q hpq + have h := congrArg representation hpq + have hh (v : S α) : representation (substitution v)=left v := AlgHom.congr_fun representation_substitution v + rw [hh,hh] at h + have he := congrArg (fun f : Module.End F (S α×S α) => (f (1,0)).1) h + simpa only [left_apply,mul_one] using he +end RestrictedAlphabet + +namespace GenericBraid +open LieAlgebra AssociativeElimination +open scoped TensorProduct +attribute [local instance] LieRing.ofAssociativeRing +variable {R α : Type*} [CommRing R] [DecidableEq α] +abbrev Env (R α : Type*) [CommRing R] := UniversalEnvelopingAlgebra R (T R α) + +def baseLie : T R α →ₗ⁅R⁆ T R (Option α) := + lift (fun i j => t (some i) (some j)) (fun i => t_self (some i)) + (fun i j => t_comm (some i) (some j)) (fun i j k l hik hil hjk hjl => + t_disjoint (some i) (some j) (some k) (some l) (fun h => hik (Option.some.inj h)) + (fun h => hil (Option.some.inj h)) (fun h => hjk (Option.some.inj h)) + (fun h => hjl (Option.some.inj h))) + (fun i j k hij hik hjk => t_three (some i) (some j) (some k) (fun h => hij (Option.some.inj h)) + (fun h => hik (Option.some.inj h)) (fun h => hjk (Option.some.inj h))) +omit [DecidableEq α] in +@[simp] theorem baseLie_t (i j : α) : baseLie (t (R:=R) i j)=t (some i) (some j) := by + simp [baseLie] + +omit [DecidableEq α] in +theorem hom_ext {E : Type*} [LieRing E] [LieAlgebra R E] + {f g : T R α →ₗ⁅R⁆ E} (h : ∀ i j, f (t i j)=g (t i j)) : f=g := by + let q : Free R α →ₗ⁅R⁆ T R α := + { (ideal (R:=R) (α:=α)).mkQ with map_lie' := by intros; rfl } + have hh : f.comp q=g.comp q := by + apply FreeLieAlgebra.hom_ext + rintro ⟨i,j⟩ + exact h i j + apply LieHom.ext + intro a + induction a using Submodule.Quotient.induction_on with | _ a => + exact LieHom.congr_fun hh a + +def fiberIn : A R α →ₐ[R] Env R (Option α) := + AssociativeElimination.lift (fun i => UniversalEnvelopingAlgebra.ι R (t none (some i))) +def baseIn : Env R α →ₐ[R] Env R (Option α) := + UniversalEnvelopingAlgebra.lift R ((UniversalEnvelopingAlgebra.ι R).comp baseLie) +def toSemi : Env R (Option α) →ₐ[R] UniversalEnvelopingAlgebra R + (SemiDirectSum (FreeLieAlgebra R α) (T R α) action) := + UniversalEnvelopingAlgebra.lift R ((UniversalEnvelopingAlgebra.ι R).comp toSemidirect) + +theorem toSemi_fiber : toSemi.comp fiberIn=FiberPBW.fiberIn (action (R:=R) (α:=α)) := by + apply AssociativeElimination.hom_ext + intro i + simp [toSemi,fiberIn,FiberPBW.fiberIn,fiber] + +theorem toSemi_base : toSemi.comp baseIn=FiberPBW.baseIn (action (R:=R) (α:=α)) := by + apply UniversalEnvelopingAlgebra.hom_ext + apply hom_ext + intro i j + simp [toSemi,baseIn,FiberPBW.baseIn,base] + +def normal : A R α ⊗[R] Env R α →ₗ[R] Env R (Option α) := + TensorProduct.lift + { toFun := fun p => + { toFun := fun b => fiberIn p*baseIn b + map_add' := by intro b c; simp [mul_add] + map_smul' := by intro r b; simp } + map_add' := by intro p q; ext b; simp [add_mul] + map_smul' := by intro r p; ext b; simp } +omit [DecidableEq α] in +@[simp] theorem normal_tmul (p : A R α) (b : Env R α) : + normal (p⊗ₜ b)=fiberIn p*baseIn b := rfl + +theorem toSemi_normal : toSemi.toLinearMap.comp normal= + FiberPBW.normal (action (R:=R) (α:=α)) := by + apply TensorProduct.ext' + intro p b + change toSemi (fiberIn p*baseIn b)=_ + rw [map_mul] + have hf := AlgHom.congr_fun (toSemi_fiber (R:=R) (α:=α)) p + have hb := AlgHom.congr_fun (toSemi_base (R:=R) (α:=α)) b + exact congrArg₂ (·*·) hf hb + +theorem normal_injective : Function.Injective (normal (R:=R) (α:=α)) := by + intro a b h + apply FiberPBW.normal_injective (action (R:=R) (α:=α)) + have he (z) := LinearMap.congr_fun (toSemi_normal (R:=R) (α:=α)) z + rw [← he a,← he b] + exact congrArg toSemi h +end GenericBraid + +namespace RestrictedAlphabet +open LieAlgebra AssociativeElimination +open scoped TensorProduct +variable {α : Type*} [DecidableEq α] +local notation "U" => UniversalEnvelopingAlgebra F (GenericBraid.T F (Option α)) + +def normal : S α ⊗[F] U →ₗ[F] + UniversalEnvelopingAlgebra F (GenericBraid.T F (Option (Option α))) := + GenericBraid.normal.comp (substitution.toLinearMap.rTensor U) + +theorem normal_injective : Function.Injective (normal (α:=α)) := + GenericBraid.normal_injective.comp + (Module.Flat.rTensor_preserves_injective_linearMap substitution.toLinearMap injective) +end RestrictedAlphabet + +namespace Deletion + +section +open AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +variable {R α : Type*} [CommRing R] +def word (w : List α) : A R α := MonoidAlgebra.single (FreeMonoid.ofList w) 1 +@[simp] theorem word_nil : word ([] : List α)=(1 : A R α) := rfl +theorem word_cons (a : α) (s : List α) : word (R:=R) (a::s)=atom a*word s := by + simp only [word,atom,MonoidAlgebra.single_mul_single,one_mul,FreeMonoid.ofList_cons] + +def raw (ν : α → α → R) (l r : α) : List α → A R α + | [] => 0 + | a::s => (ν a (s.headD r)-ν l a) • word s+atom a*raw ν a r s + +def op (ν : α → α → R) (l r : α) : Module.End R (A R α) := + (Finsupp.linearCombination R (fun w : FreeMonoid α => raw ν l r w.toList)).comp + (MonoidAlgebra.coeffLinearEquiv R).toLinearMap +@[simp] theorem op_word (ν : α → α → R) (l r : α) (s : List α) : + op ν l r (word s)=raw ν l r s := by + change Finsupp.linearCombination R (fun monoidWord : FreeMonoid α => raw ν l r monoidWord.toList) (Finsupp.single (FreeMonoid.ofList s) 1) = _; simp +@[simp] theorem op_one (ν : α → α → R) (l r : α) : op ν l r 1=0 := by + exact op_word ν l r [] +theorem op_cons (ν : α → α → R) (l r a : α) (s : List α) : + op ν l r (word (a::s))=(ν a (s.headD r)-ν l a) • word s+atom a*op ν a r (word s) := by + simp only [op_word,raw] +theorem op_mul_word (ν : α → α → R) (l r a : α) (s : List α) : + op ν l r (atom a*word s)=(ν a (s.headD r)-ν l a) • word s+atom a*op ν a r (word s) := by + rw [← word_cons,op_cons] + +theorem op_two (ν : α → α → R) (l r a b : α) (p : A R α) : + op ν l r (atom a*(atom b*p))=(ν a b-ν l a) • (atom b*p)+atom a*op ν a r (atom b*p) := by + induction p using MonoidAlgebra.induction_on with + | of w => + have h := op_cons ν l r a (b::w.toList) + simp only [word_cons,List.headD_cons] at h + simpa only [word,FreeMonoid.ofList_toList,MonoidAlgebra.of_apply] using h + | add p q hp hq => simp only [mul_add,map_add,smul_add,hp,hq]; abel + | smul c p hp => simp only [mul_smul_comm,map_smul,hp,smul_add,smul_smul]; rw [mul_comm c] + +def curvature (ν μ : α → α → R) (l a b c : α) : R := + (ν a b-ν l a)*(μ b c-μ l b)+(ν b c-ν a b)*(μ a c-μ l a)- + (μ a b-μ l a)*(ν b c-ν l b)-(μ b c-μ a b)*(ν a c-ν l a) + +theorem comm_cons (ν μ : α → α → R) (l r a b : α) (s : List α) : + op μ l r (op ν l r (word (a::b::s)))-op ν l r (op μ l r (word (a::b::s)))= + curvature ν μ l a b (s.headD r) • word s+ + atom a*(op μ a r (op ν a r (word (b::s)))-op ν a r (op μ a r (word (b::s)))) := by + simp only [word_cons,op_two,op_mul_word,map_add,map_smul,mul_add,mul_smul_comm, + mul_sub,smul_add,curvature] + module + +theorem commute_of_curvature (ν μ : α → α → R) + (hc : ∀ l a b c,curvature ν μ l a b c=0) (l r : α) : ⁅op μ l r,op ν l r⁆=0 := by + apply LinearMap.ext + intro p + have hs (s : List α) : op μ l r (op ν l r (word s))-op ν l r (op μ l r (word s))=0 := by + induction s generalizing l with + | nil => simp + | cons a s ih => + cases s with + | nil => simp [raw] + | cons b s => rw [comm_cons,hc,ih]; simp + induction p using MonoidAlgebra.induction_on with + | of w => + change op μ l r (op ν l r (MonoidAlgebra.single w 1))- + op ν l r (op μ l r (MonoidAlgebra.single w 1))=0 + simpa only [word,FreeMonoid.ofList_toList,MonoidAlgebra.of_apply] using hs w.toList + | add p q hp hq => + simp only [Ring.lie_def,LinearMap.sub_apply,Module.End.mul_apply,LinearMap.zero_apply] at hp hq ⊢ + simp only [map_add] + rw [add_sub_add_comm, hp, hq, add_zero] + | smul c p hp => simpa using congrArg (c • ·) hp +end + +open AssociativeElimination +variable {R α : Type*} [CommRing R] +theorem linear_ext {M : Type*} [AddCommGroup M] [Module R M] + {f g : A R α →ₗ[R] M} (h : ∀ s : List α,f (word s)=g (word s)) : f=g := by + apply LinearMap.ext + intro p + induction p using MonoidAlgebra.induction_on with + | of w => simpa only [word,FreeMonoid.ofList_toList,MonoidAlgebra.of_apply] using h w.toList + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +theorem raw_add (ν μ : α → α → R) (l r : α) (s : List α) : + raw (fun a b => ν a b+μ a b) l r s=raw ν l r s+raw μ l r s := by + induction s generalizing l with + | nil => simp [raw] + | cons a s ih => simp only [raw,ih,mul_add]; module +@[simp] theorem op_add (ν μ : α → α → R) (l r : α) : + op (fun a b => ν a b+μ a b) l r=op ν l r+op μ l r := by + apply linear_ext + intro s + simp only [LinearMap.add_apply,op_word,raw_add] +@[simp] theorem op_zero (l r : α) : op (fun _ _ => (0 : R)) l r=0 := by + apply linear_ext + intro s + simp only [LinearMap.zero_apply,op_word] + induction s generalizing l with + | nil => rfl + | cons a s ih => simp [raw,ih] + +theorem op_list_sum {ι : Type*} (ν : ι → α → α → R) (s : List ι) (l r : α) : + op (fun a b => (s.map (fun i => ν i a b)).sum) l r=(s.map (fun i => op (ν i) l r)).sum := by + induction s with + | nil => simp + | cons i s ih => simpa only [List.map_cons,List.sum_cons,op_add] using congrArg (op (ν i) l r+·) ih +end Deletion + +namespace DeletionTable +open Deletion AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +inductive Letter | o | e | p | w deriving DecidableEq +instance : Fintype Letter := ⟨{.o,.e,.p,.w}, by intro x; cases x <;> simp⟩ +inductive Hyperplane | a1 | a2 | a3 | p12 | m12 | p13 | m13 | p23 | m23 deriving DecidableEq +instance : Fintype Hyperplane := ⟨{.a1,.a2,.a3,.p12,.m12,.p13,.m13,.p23,.m23}, by intro x; cases x <;> simp⟩ +open Letter Hyperplane + +def weight : Hyperplane → Letter → Letter → ℤ + | .p23, .o, .p | .p23, .p, .o => 1 + | .m23, .o, .p | .m23, .p, .o => -1 + | .p12, .o, .w | .p12, .w, .o => 1 + | .m12, .o, .w | .m12, .w, .o => -1 + | .a3, .e, .p | .a3, .p, .e => 1 + | .m23, .e, .p | .m23, .p, .e => -1 + | .a1, .e, .w | .a1, .w, .e => 1 + | .m12, .e, .w | .m12, .w, .e => -1 + | .a2, .p, .w | .a2, .w, .p => 1 + | .p13, .p, .w | .p13, .w, .p => 1 + | .m12, .p, .w | .m12, .w, .p => -1 + | .m23, .p, .w | .m23, .w, .p => -1 + | _, _, _ => 0 + +def flat : Fin 13 → List Hyperplane := + ![[.a1,.a2,.p12,.m12], + [.a1,.a3,.p13,.m13], + [.a2,.a3,.p23,.m23], + [.p12,.p13,.p23], + [.p12,.m13,.m23], + [.m12,.p13,.m23], + [.m12,.m13,.p23], + [.a1,.p23], + [.a1,.m23], + [.a2,.p13], + [.a2,.m13], + [.a3,.p12], + [.a3,.m12]] + +def total (i : Fin 13) (a b : Letter) : ℤ := ((flat i).map (fun h => weight h a b)).sum + +theorem curvature_0 : ∀ h : Hyperplane, h∈flat 0 → + ∀ l a b c : Letter, curvature (weight h) (total 0) l a b c=0 := by decide + +theorem curvature_1 : ∀ h : Hyperplane, h∈flat 1 → + ∀ l a b c : Letter, curvature (weight h) (total 1) l a b c=0 := by decide + +theorem curvature_2 : ∀ h : Hyperplane, h∈flat 2 → + ∀ l a b c : Letter, curvature (weight h) (total 2) l a b c=0 := by decide + +theorem curvature_3 : ∀ h : Hyperplane, h∈flat 3 → + ∀ l a b c : Letter, curvature (weight h) (total 3) l a b c=0 := by decide + +theorem curvature_4 : ∀ h : Hyperplane, h∈flat 4 → + ∀ l a b c : Letter, curvature (weight h) (total 4) l a b c=0 := by decide + +theorem curvature_5 : ∀ h : Hyperplane, h∈flat 5 → + ∀ l a b c : Letter, curvature (weight h) (total 5) l a b c=0 := by decide + +theorem curvature_6 : ∀ h : Hyperplane, h∈flat 6 → + ∀ l a b c : Letter, curvature (weight h) (total 6) l a b c=0 := by decide + +theorem curvature_7 : ∀ h : Hyperplane, h∈flat 7 → + ∀ l a b c : Letter, curvature (weight h) (total 7) l a b c=0 := by decide + +theorem curvature_8 : ∀ h : Hyperplane, h∈flat 8 → + ∀ l a b c : Letter, curvature (weight h) (total 8) l a b c=0 := by decide + +theorem curvature_9 : ∀ h : Hyperplane, h∈flat 9 → + ∀ l a b c : Letter, curvature (weight h) (total 9) l a b c=0 := by decide + +theorem curvature_10 : ∀ h : Hyperplane, h∈flat 10 → + ∀ l a b c : Letter, curvature (weight h) (total 10) l a b c=0 := by decide + +theorem curvature_11 : ∀ h : Hyperplane, h∈flat 11 → + ∀ l a b c : Letter, curvature (weight h) (total 11) l a b c=0 := by decide + +theorem curvature_12 : ∀ h : Hyperplane, h∈flat 12 → + ∀ l a b c : Letter, curvature (weight h) (total 12) l a b c=0 := by decide + +theorem flat_curvature (i : Fin 13) (h : Hyperplane) (hi : h∈flat i) (l a b c : Letter) : + curvature (weight h) (total i) l a b c=0 := by + fin_cases i + · exact curvature_0 h hi l a b c + · exact curvature_1 h hi l a b c + · exact curvature_2 h hi l a b c + · exact curvature_3 h hi l a b c + · exact curvature_4 h hi l a b c + · exact curvature_5 h hi l a b c + · exact curvature_6 h hi l a b c + · exact curvature_7 h hi l a b c + · exact curvature_8 h hi l a b c + · exact curvature_9 h hi l a b c + · exact curvature_10 h hi l a b c + · exact curvature_11 h hi l a b c + · exact curvature_12 h hi l a b c + +theorem integral_flat (i : Fin 13) (h : Hyperplane) (hi : h∈flat i) (l r : Letter) : + ⁅op (weight h) l r,((flat i).map (fun g => op (weight g) l r)).sum⁆=0 := by + rw [← op_list_sum] + change ⁅op (weight h) l r,op (total i) l r⁆=0 + have hc := commute_of_curvature (weight h) (total i) (flat_curvature i h hi) l r + rw [← lie_skew,hc,neg_zero] +end DeletionTable + +namespace GenericBraid +open LieAlgebra FreeDerivations +variable {R α : Type*} [CommRing R] + +theorem induction {P : T R α → Prop} (h0 : P 0) (ht : ∀ i j,P (t i j)) + (ha : ∀ p q,P p → P q → P (p+q)) (hs : ∀ (r : R) p,P p → P (r • p)) + (hl : ∀ p q,P p → P q → P ⁅p,q⁆) (p : T R α) : P p := by + induction p using Submodule.Quotient.induction_on with | _ p => + induction p using freeLie_induction with + | h0 => exact h0 + | hg ij => exact ht ij.1 ij.2 + | ha p q hp hq => exact ha _ _ hp hq + | hs r p hp => exact hs r _ hp + | hl p q hp hq => exact hl _ _ hp hq + +variable [DecidableEq α] +def fiberLie : FreeLieAlgebra R α →ₗ⁅R⁆ T R (Option α) := + FreeLieAlgebra.lift R (fun i => t none (some i)) +omit [DecidableEq α] in +@[simp] theorem fiberLie_of (i : α) : fiberLie (FreeLieAlgebra.of R i)=t none (some i) := by + simp [fiberLie] + +theorem t_base_fiber_left (i j : α) : + ⁅t (R:=R) (some i) (some j),t (R:=R) none (some i)⁆=⁅t (R:=R) none (some i),t (R:=R) none (some j)⁆ := by + by_cases hij : i=j + · subst j; simp + have h := t_three (R:=R) (none : Option α) (some i) (some j) (by simp) (by simp) + (fun h => hij (Option.some.inj h)) + rw [lie_add] at h + grind [lie_skew] + +theorem compatibility (g : T R α) (p : FreeLieAlgebra R α) : + fiberLie (action g p)=⁅baseLie g,fiberLie p⁆ := by + induction g using induction generalizing p with + | h0 => simp + | ht i j => + rw [action_t,baseLie_t] + induction p using freeLie_induction with + | h0 => simp + | hg k => + by_cases hki : k=i + · subst k; simp only [pair_of_left,LieHom.map_lie,fiberLie_of]; exact (t_base_fiber_left i j).symm + by_cases hkj : k=j + · subst k + simp only [pair_of_right,LieHom.map_lie,fiberLie_of] + rw [t_comm (some i) (some j)] + exact (t_base_fiber_left j i).symm + simp only [pair_of_other i j k hki hkj,map_zero,fiberLie_of] + exact (t_disjoint _ _ _ _ (by simp) (fun h => hki (Option.some.inj h).symm) + (by simp) (fun h => hkj (Option.some.inj h).symm)).symm + | ha p q hp hq => simp [hp,hq,lie_add] + | hs r p hp => simp [hp] + | hl p q hp hq => + simp only [LieDerivation.apply_lie_eq_add,map_add,LieHom.map_lie,hp,hq] + simpa only [add_comm] using (leibniz_lie (t (R:=R) (some i) (some j)) (fiberLie p) (fiberLie q)).symm + | ha g h hg hh => simp [hg,hh,add_lie] + | hs r g hg => simp [hg] + | hl g h hg hh => + simp only [LieHom.map_lie,LieDerivation.lie_apply,map_sub,hg,hh] + exact (lie_lie _ _ _).symm + +def fromSemidirect : SemiDirectSum (FreeLieAlgebra R α) (T R α) action →ₗ⁅R⁆ T R (Option α) := + InnerSemiDirect.lift action fiberLie baseLie compatibility + +theorem toSemidirect_fiberLie (p : FreeLieAlgebra R α) : + toSemidirect (fiberLie p)=SemiDirectSum.inl action p := by + have h : (toSemidirect (R:=R) (α:=α)).comp fiberLie=SemiDirectSum.inl action := by + apply FreeLieAlgebra.hom_ext + intro i + simp [fiber] + exact LieHom.congr_fun h p + +theorem toSemidirect_baseLie (p : T R α) : + toSemidirect (baseLie p)=SemiDirectSum.inr action p := by + have h : (toSemidirect (R:=R) (α:=α)).comp baseLie=SemiDirectSum.inr action := by + apply hom_ext + intro i j + simp [base] + exact LieHom.congr_fun h p + +theorem to_from (p : SemiDirectSum (FreeLieAlgebra R α) (T R α) action) : + toSemidirect (fromSemidirect p)=p := by + change toSemidirect (fiberLie p.left+baseLie p.right)=p + rw [map_add,toSemidirect_fiberLie,toSemidirect_baseLie] + ext <;> simp + +theorem from_to (p : T R (Option α)) : fromSemidirect (toSemidirect p)=p := by + have h : (fromSemidirect (R:=R) (α:=α)).comp toSemidirect=LieHom.id := by + apply hom_ext + intro i j + cases i <;> cases j <;> simp [fromSemidirect,InnerSemiDirect.lift,fiber,base,t_comm] + exact LieHom.congr_fun h p + +def equivalence : T R (Option α) ≃ₗ⁅R⁆ SemiDirectSum (FreeLieAlgebra R α) (T R α) action := + { toSemidirect with + invFun := fromSemidirect + left_inv := from_to + right_inv := to_from } +end GenericBraid + +attribute [local instance 2000] FreeLieAlgebra.instLieAlgebra + +namespace IntegralBaseChange +open AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +variable {S α : Type*} [CommRing S] +def words : A ℤ α →+* A S α := MonoidAlgebra.mapRingHom _ (Int.castRingHom S) +@[simp] theorem words_atom (a : α) : words (atom a : A ℤ α)=(atom a : A S α) := by + simp [words,atom] +@[simp] theorem words_coeff (p : A ℤ α) (w : FreeMonoid α) : + (words p : A S α).coeff w=(p.coeff w : S) := by simp [words] +def lie : FreeLieAlgebra ℤ α →ₗ⁅ℤ⁆ FreeLieAlgebra S α := + FreeLieAlgebra.lift ℤ (FreeLieAlgebra.of S) +@[simp] theorem lie_of (a : α) : lie (FreeLieAlgebra.of ℤ a)=FreeLieAlgebra.of S a := by exact FreeLieAlgebra.lift_of_apply (FreeLieAlgebra.of S) a +theorem embed_lie (p : FreeLieAlgebra ℤ α) : + embed (lie p : FreeLieAlgebra S α)=words (embed p) := by + induction p using freeLie_induction with + | h0 => simp + | hg a => simp + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq,Ring.lie_def,map_sub,map_mul] +theorem words_rational_injective : Function.Injective (words (S:=ℚ) (α:=α)) := by + intro p q h + ext w + have hc := congrArg (fun z : A ℚ α => z.coeff w) h + simpa using hc + +theorem lie_rational_injective : Function.Injective (lie (S:=ℚ) (α:=α)) := by + intro p q h + apply UniversalEmbedding.injective + apply words_rational_injective + rw [← embed_lie,← embed_lie,h] + +theorem lift_integral {p : FreeLieAlgebra ℚ α} (hp : embed p∈IntegralWords.lattice) : + ∃ q : FreeLieAlgebra ℤ α,lie q=p := by + have hr : embed p∈IntegralWords.rationalLie := by + clear hp + induction p using freeLie_induction with + | h0 => simp + | hg a => exact LieSubalgebra.subset_lieSpan ⟨a,by simp⟩ + | ha p q hp hq => simpa using IntegralWords.rationalLie.add_mem hp hq + | hs r p hp => simpa using IntegralWords.rationalLie.smul_mem r hp + | hl p q hp hq => simpa only [LieHom.map_lie] using IntegralWords.rationalLie.lie_mem hp hq + have hi := IntegralWords.saturation hr hp + let f : FreeLieAlgebra ℤ α →ₗ⁅ℤ⁆ A ℚ α := FreeLieAlgebra.lift ℤ atom + have he (q : FreeLieAlgebra ℤ α) : f q=embed (lie q : FreeLieAlgebra ℚ α) := by + induction q using freeLie_induction with + | h0 => simp + | hg a => rw [lie_of,embed_of]; exact FreeLieAlgebra.lift_of_apply atom a + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [map_smul,hp] + | hl p q hp hq => simp [hp,hq] + have hspan : IntegralWords.lieLattice ≤ f.range := by + apply LieSubalgebra.lieSpan_le.mpr + rintro a ⟨a,rfl⟩ + exact ⟨FreeLieAlgebra.of ℤ a,FreeLieAlgebra.lift_of_apply atom a⟩ + obtain ⟨q,hq⟩ := hspan hi + refine ⟨q, UniversalEmbedding.injective ?_⟩ + rw [← he] + exact hq +end IntegralBaseChange + +namespace GenericBraid + +section +variable {S α β : Type*} [CommRing S] +def cast : T ℤ α →ₗ⁅ℤ⁆ T S α := + lift (t (R:=S)) t_self t_comm t_disjoint t_three +@[simp] theorem cast_t (i j : α) : cast (t (R:=ℤ) i j)=t (R:=S) i j := by simp [cast] +def rename {R : Type*} [CommRing R] (e : α ≃ β) : T R α →ₗ⁅R⁆ T R β := + lift (fun i j => t (e i) (e j)) (fun i => t_self (e i)) (fun i j => t_comm (e i) (e j)) + (fun i j k l hik hil hjk hjl => t_disjoint (e i) (e j) (e k) (e l) + (e.injective.ne hik) (e.injective.ne hil) (e.injective.ne hjk) (e.injective.ne hjl)) + (fun i j k hij hik hjk => t_three (e i) (e j) (e k) (e.injective.ne hij) (e.injective.ne hik) (e.injective.ne hjk)) +@[simp] theorem rename_t {R : Type*} [CommRing R] (e : α ≃ β) (i j : α) : + rename e (t (R:=R) i j)=t (e i) (e j) := by simp [rename] +theorem rename_symm {R : Type*} [CommRing R] (e : α ≃ β) (p : T R α) : + rename e.symm (rename e p)=p := by + induction p using induction with + | h0 => simp + | ht i j => simp + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] +theorem rename_injective {R : Type*} [CommRing R] (e : α ≃ β) : + Function.Injective (rename (R:=R) e) := Function.LeftInverse.injective (rename_symm e) +theorem cast_rename (e : α ≃ β) (p : T ℤ α) : + cast (S:=S) (rename e p)=rename e (cast p) := by + induction p using induction with + | h0 => simp + | ht i j => simp + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] +variable [DecidableEq α] +omit [DecidableEq α] in +theorem cast_fiber (p : FreeLieAlgebra ℤ α) : + cast (S:=S) (fiberLie p)=fiberLie (IntegralBaseChange.lie p) := by + induction p using freeLie_induction with + | h0 => simp + | hg a => simp + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] +omit [DecidableEq α] in +theorem cast_base (p : T ℤ α) : cast (S:=S) (baseLie p)=baseLie (cast p) := by + induction p using induction with + | h0 => simp + | ht i j => simp + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] +theorem cast_option_injective (h : Function.Injective (cast (S:=ℚ) (α:=α))) : + Function.Injective (cast (S:=ℚ) (α:=Option α)) := by + apply (injective_iff_map_eq_zero _).mpr + intro p hp + have hd : p=fiberLie (toSemidirect p).left+baseLie (toSemidirect p).right := (from_to p).symm + rw [hd,map_add,cast_fiber,cast_base] at hp + have he := congrArg (toSemidirect (R:=ℚ) (α:=α)) hp + rw [map_add,toSemidirect_fiberLie,toSemidirect_baseLie,map_zero] at he + have hl := congrArg LieAlgebra.SemiDirectSum.left he + have hr := congrArg LieAlgebra.SemiDirectSum.right he + simp only [LieAlgebra.SemiDirectSum.add_eq_mk,LieAlgebra.SemiDirectSum.inl_eq_mk, + LieAlgebra.SemiDirectSum.inr_eq_mk,add_zero,zero_add,LieAlgebra.SemiDirectSum.zero_eq_mk] at hl hr + have hl0 : (toSemidirect p).left=0 := IntegralBaseChange.lie_rational_injective (hl.trans (map_zero _).symm) + have hr0 : (toSemidirect p).right=0 := h (hr.trans (map_zero _).symm) + rw [hd,hl0,hr0,map_zero,map_zero,add_zero] +end + +variable {α : Type*} +theorem cast_fin_injective (n : ℕ) : Function.Injective (cast (S:=ℚ) (α:=Fin n)) := by + induction n with + | zero => + have hz (p : T ℤ (Fin 0)) : p=0 := by + induction p using induction with + | h0 => rfl + | ht i j => exact Fin.elim0 i + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => simp [hp,hq] + intro p q _ + rw [hz p,hz q] + | succ n ih => + intro p q h + apply rename_injective (finSuccEquiv' (0 : Fin (n+1))) + apply cast_option_injective ih + rw [cast_rename,cast_rename,h] +theorem cast_finite_injective [Fintype α] : Function.Injective (cast (S:=ℚ) (α:=α)) := by + intro p q h + apply rename_injective (Fintype.equivFin α) + apply cast_fin_injective + rw [cast_rename,cast_rename,h] + +def fromT4 : T4 →ₗ⁅ℚ⁆ T ℚ (Fin 4) := + T4Universal.lift (t (R:=ℚ)) t_comm t_self + (fun i j k l _ hik hil hjk hjl _ => t_disjoint i j k l hik hil hjk hjl) t_three +@[simp] theorem fromT4_t (i j : Fin 4) : fromT4 (DeligneDrinfeld.t i j)=t i j := by + simp [fromT4] +end GenericBraid + +namespace BaseChangeEquations +variable {R : Type*} [CommRing R] +def x : FreeLieAlgebra R Bool := FreeLieAlgebra.of R false +def y : FreeLieAlgebra R Bool := FreeLieAlgebra.of R true +def eval {M : Type*} [LieRing M] [LieAlgebra R M] (a b : M) : FreeLieAlgebra R Bool →ₗ⁅R⁆ M := + FreeLieAlgebra.lift R (fun i => if i then b else a) +@[simp] theorem eval_x {M : Type*} [LieRing M] [LieAlgebra R M] (a b : M) : eval (R:=R) a b x=a := by simp [eval,x] +@[simp] theorem eval_y {M : Type*} [LieRing M] [LieAlgebra R M] (a b : M) : eval (R:=R) a b y=b := by simp [eval,y] +def antisymmetry (q : FreeLieAlgebra R Bool) := q+eval y x q +def threeTerm (q : FreeLieAlgebra R Bool) := q+eval y (-x-y) q+eval (-x-y) x q +def pentagon (q : FreeLieAlgebra R Bool) : GenericBraid.T R (Fin 4) := + let t := GenericBraid.t (R:=R) + eval (t 0 1) (t 1 2+t 1 3) q+eval (t 0 2+t 1 2) (t 2 3) q- + eval (t 1 2) (t 2 3) q-eval (t 0 1+t 0 2) (t 1 3+t 2 3) q-eval (t 0 1) (t 1 2) q + +def Equations (q : FreeLieAlgebra R Bool) : Prop := + antisymmetry q=0 ∧ threeTerm q=0 ∧ pentagon q=0 + +theorem pentagon_rational {q : L} (hq : q∈W) : pentagon q=0 := by + have h := congrArg GenericBraid.fromT4 hq.2.2 + have he (a b : T4) : GenericBraid.fromT4 (DeligneDrinfeld.eval a b q)= + eval (GenericBraid.fromT4 a) (GenericBraid.fromT4 b) q := by + have hm : GenericBraid.fromT4.comp (DeligneDrinfeld.eval a b)= + eval (GenericBraid.fromT4 a) (GenericBraid.fromT4 b) := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [eval,DeligneDrinfeld.eval] + exact LieHom.congr_fun hm q + simp only [map_add,he,GenericBraid.fromT4_t] at h + change _ - _ - _ - _ = 0 + rw [h] + abel + +theorem rational {q : L} (hq : q∈W) : Equations q := + ⟨hq.1,hq.2.1,pentagon_rational hq⟩ + +variable {S : Type*} [CommRing S] +theorem cast_eval_lie (a b q : FreeLieAlgebra ℤ Bool) : + IntegralBaseChange.lie (S:=S) (eval a b q)= + eval (R:=S) (IntegralBaseChange.lie a) (IntegralBaseChange.lie b) (IntegralBaseChange.lie q) := by + induction q using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [eval] + | ha p q hp hq => simp [hp,hq] + | hs r p hp => + rw [map_smul,map_smul] + simp [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] +theorem cast_eval_braid (a b : GenericBraid.T ℤ (Fin 4)) (q : FreeLieAlgebra ℤ Bool) : + GenericBraid.cast (S:=S) (eval a b q)= + eval (R:=S) (GenericBraid.cast a) (GenericBraid.cast b) (IntegralBaseChange.lie q) := by + induction q using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [eval] + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] +@[simp] theorem cast_x : IntegralBaseChange.lie (x : FreeLieAlgebra ℤ Bool)=(x : FreeLieAlgebra S Bool) := by simp [x] +@[simp] theorem cast_y : IntegralBaseChange.lie (y : FreeLieAlgebra ℤ Bool)=(y : FreeLieAlgebra S Bool) := by simp [y] +theorem cast_antisymmetry (q : FreeLieAlgebra ℤ Bool) : + IntegralBaseChange.lie (S:=S) (antisymmetry q)=antisymmetry (IntegralBaseChange.lie q) := by + simp [antisymmetry,cast_eval_lie] +theorem cast_threeTerm (q : FreeLieAlgebra ℤ Bool) : + IntegralBaseChange.lie (S:=S) (threeTerm q)=threeTerm (IntegralBaseChange.lie q) := by + simp [threeTerm,cast_eval_lie] +theorem cast_pentagon (q : FreeLieAlgebra ℤ Bool) : + GenericBraid.cast (S:=S) (pentagon q)=pentagon (IntegralBaseChange.lie q) := by + simp only [pentagon,map_sub,map_add,cast_eval_braid,GenericBraid.cast_t] + +theorem integral_of_rational (q : FreeLieAlgebra ℤ Bool) + (hq : (IntegralBaseChange.lie q : L)∈W) : Equations q := by + have h := rational hq + refine ⟨IntegralBaseChange.lie_rational_injective ?_,IntegralBaseChange.lie_rational_injective ?_, + GenericBraid.cast_fin_injective 4 ?_⟩ + · rw [cast_antisymmetry,h.1,map_zero] + · rw [cast_threeTerm,h.2.1,map_zero] + · rw [cast_pentagon,h.2.2,map_zero] + +theorem reduce (q : FreeLieAlgebra ℤ Bool) + (hq : (IntegralBaseChange.lie q : L)∈W) : Equations (IntegralBaseChange.lie (S:=S) q) := by + have h := integral_of_rational q hq + refine ⟨?_,?_,?_⟩ + · rw [← cast_antisymmetry,h.1,map_zero] + · rw [← cast_threeTerm,h.2.1,map_zero] + · rw [← cast_pentagon,h.2.2,map_zero] +end BaseChangeEquations + +namespace PolynomialOrdering +open AssociativeElimination +open scoped TensorProduct +attribute [local instance] LieRing.ofAssociativeRing +variable {R α β : Type*} [CommRing R] +abbrev V := A R α ⊗[R] A R β +variable (δ : β → α → A R α) +def fiberOp (a : α) : Module.End R (V (R:=R) (α:=α) (β:=β)) := + TensorProduct.map (leftMul (atom a)) LinearMap.id +def baseOp (b : β) : Module.End R (V (R:=R) (α:=α) (β:=β)) := + TensorProduct.map (deriv (δ b)) LinearMap.id+ + TensorProduct.map LinearMap.id (leftMul (atom b)) +def op : Sum α β → Module.End R (V (R:=R) (α:=α) (β:=β)) := + Sum.elim fiberOp (baseOp δ) +@[simp] theorem fiberOp_tmul (a : α) (p : A R α) (q : A R β) : + fiberOp a (p⊗ₜ q)=(atom a*p)⊗ₜ q := rfl +@[simp] theorem baseOp_tmul (b : β) (p : A R α) (q : A R β) : + baseOp δ b (p⊗ₜ q)=deriv (δ b) p⊗ₜ q+p⊗ₜ (atom b*q) := rfl + +def operators : A R (Sum α β) →ₐ[R] Module.End R (V (R:=R) (α:=α) (β:=β)) := + lift (op δ) +def normalize : A R (Sum α β) →ₗ[R] V (R:=R) (α:=α) (β:=β) := + (LinearMap.applyₗ ((1 : A R α)⊗ₜ (1 : A R β))).comp (operators δ).toLinearMap +@[simp] theorem normalize_one : normalize δ 1=1⊗ₜ 1 := by + change operators δ 1 (1⊗ₜ 1)=_; simp +@[simp] theorem normalize_atom_mul (s : Sum α β) (p : A R (Sum α β)) : + normalize δ (atom s*p)=op δ s (normalize δ p) := by + change operators δ (atom s*p) (1⊗ₜ 1)=_ + rw [map_mul,Module.End.mul_apply] + simp only [operators,lift_atom] + rfl + +variable {U : Type*} [Ring U] [Algebra R U] +def interpret (f : A R α →ₐ[R] U) (g : A R β →ₐ[R] U) : V (R:=R) (α:=α) (β:=β) →ₗ[R] U := + TensorProduct.lift + { toFun := fun p => + { toFun := fun q => f p*g q + map_add' := by intro q r; simp [mul_add] + map_smul' := by intro c q; simp } + map_add' := by intro p r; ext q; simp [add_mul] + map_smul' := by intro c p; ext q; simp } +@[simp] theorem interpret_tmul (f : A R α →ₐ[R] U) (g : A R β →ₐ[R] U) + (p : A R α) (q : A R β) : interpret f g (p⊗ₜ q)=f p*g q := rfl + +def evaluate (f : A R α →ₐ[R] U) (g : A R β →ₐ[R] U) : A R (Sum α β) →ₐ[R] U := + lift (Sum.elim (fun a => f (atom a)) (fun b => g (atom b))) + +variable (f : A R α →ₐ[R] U) (g : A R β →ₐ[R] U) +variable (hδ : ∀ b a,g (atom b)*f (atom a)-f (atom a)*g (atom b)=f (δ b a)) +include hδ +theorem commutator (b : β) (p : A R α) : + g (atom b)*f p-f p*g (atom b)=f (deriv (δ b) p) := by + induction p using QuadraticAlphabet.algebra_induction with + | h1 => simp + | ha a => simpa using hδ b a + | hadd p q hp hq => simp only [map_add,mul_add,add_mul]; rw [← hp,← hq]; abel + | hs r p hp => simp only [map_smul,mul_smul_comm,smul_mul_assoc,← smul_sub,hp] + | hm p q hp hq => + rw [AssociativeElimination.deriv_mul,map_add,map_mul,map_mul,map_mul,← hp,← hq] + noncomm_ring + +theorem interpret_op (s : Sum α β) (z : V (R:=R) (α:=α) (β:=β)) : + interpret f g (op δ s z)=evaluate f g (atom s)*interpret f g z := by + have h : (interpret f g).comp (op δ s)= + (Algebra.lmul R U (evaluate f g (atom s))).comp (interpret f g) := by + apply TensorProduct.ext' + intro p q + cases s with + | inl a => simp [op,evaluate,mul_assoc] + | inr b => + simp only [LinearMap.comp_apply,op,Sum.elim_inr,baseOp_tmul,map_add,interpret_tmul, + evaluate,lift_atom,map_mul] + change f (deriv (δ b) p)*g q+f p*(g (atom b)*g q)=g (atom b)*(f p*g q) + rw [← commutator δ f g hδ b p] + noncomm_ring + exact LinearMap.congr_fun h z + +theorem interpret_operators (p : A R (Sum α β)) (z : V (R:=R) (α:=α) (β:=β)) : + interpret f g (operators δ p z)=evaluate f g p*interpret f g z := by + induction p using QuadraticAlphabet.algebra_induction generalizing z with + | h1 => simp + | ha s => simpa [operators] using interpret_op δ f g hδ s z + | hadd p q hp hq => simp [hp,hq,add_mul] + | hs r p hp => simp [hp] + | hm p q hp hq => simp only [map_mul,Module.End.mul_apply,hp,hq,mul_assoc] + +theorem interpret_normalize (p : A R (Sum α β)) : + interpret f g (normalize δ p)=evaluate f g p := by + change interpret f g (operators δ p (1⊗ₜ 1))=_ + rw [interpret_operators δ f g hδ,interpret_tmul,map_one,map_one,mul_one,mul_one] + +omit hδ +def fiberIn : A R α →ₐ[R] A R (Sum α β) := lift (fun a => atom (.inl a)) +def baseIn : A R β →ₐ[R] A R (Sum α β) := lift (fun b => atom (.inr b)) +theorem operators_fiber : (operators δ).comp fiberIn= + (Module.End.rTensorAlgHom R (A R α) (A R β)).comp leftMul := by + apply hom_ext + intro a + simp only [AlgHom.comp_apply,fiberIn,lift_atom,operators] + rfl + +theorem operators_base_one (q b : A R β) : + operators δ (baseIn q) ((1 : A R α)⊗ₜ b)=1⊗ₜ (q*b) := by + induction q using QuadraticAlphabet.algebra_induction generalizing b with + | h1 => simp + | ha a => + simp only [baseIn,lift_atom,operators,op,Sum.elim_inr,baseOp_tmul,AssociativeElimination.deriv_one, + TensorProduct.zero_tmul,zero_add] + | hadd p q hp hq => simp [hp,hq,add_mul,TensorProduct.tmul_add] + | hs r p hp => simp [hp,TensorProduct.tmul_smul] + | hm p q hp hq => simp only [map_mul,Module.End.mul_apply,hq,hp,mul_assoc] + +theorem normalize_product (p : A R α) (q : A R β) : + normalize δ (fiberIn p*baseIn q)=p⊗ₜ q := by + change operators δ (fiberIn p*baseIn q) (1⊗ₜ (1 : A R β))=_ + rw [map_mul,Module.End.mul_apply,operators_base_one,mul_one] + have h := AlgHom.congr_fun (operators_fiber δ) p + simp only [AlgHom.comp_apply] at h + rw [h] + change (p*1)⊗ₜ q=p⊗ₜ q + rw [mul_one] +end PolynomialOrdering + +namespace WordGrading +open AssociativeElimination +variable {R α : Type*} [CommRing R] +def word (w : FreeMonoid α) : A R α := MonoidAlgebra.single w 1 +@[simp] theorem word_one : word (1 : FreeMonoid α)=(1 : A R α) := rfl +@[simp] theorem word_of (a : α) : word (FreeMonoid.of a)=(atom a : A R α) := rfl +@[simp] theorem word_mul (u v : FreeMonoid α) : word (R:=R) (u*v)=word u*word v := by + simp [word,MonoidAlgebra.single_mul_single] +def space (P : FreeMonoid α → Prop) : Submodule R (A R α) := + Submodule.span R {p | ∃ w,P w ∧ p=word w} +theorem word_mem {P : FreeMonoid α → Prop} (w : FreeMonoid α) (hw : P w) : word (R:=R) w∈space P := + Submodule.subset_span ⟨w,hw,rfl⟩ +theorem space_mono {P Q : FreeMonoid α → Prop} (h : ∀ w,P w → Q w) : + space (R:=R) P ≤ space Q := by + apply Submodule.span_le.mpr + rintro _ ⟨w,hw,rfl⟩ + exact word_mem w (h w hw) +theorem coeff_support {P : FreeMonoid α → Prop} {p : A R α} (hp : p∈space P) + (w : FreeMonoid α) (hw : ¬P w) : p.coeff w=0 := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨v,hv,rfl⟩ := hp + have hne : v≠w := fun h => hw (h ▸ hv) + simp [word,hne] + | zero => simp + | add p q _ _ hp hq => simp [hp,hq] + | smul c p _ hp => simp [hp] +theorem mem_space {P : FreeMonoid α → Prop} {p : A R α} + (h : ∀ w,p.coeff w≠0 → P w) : p∈space P := by + classical + rw [← MonoidAlgebra.sum_coeff_single p] + apply Submodule.sum_mem + intro w hw + have hp := h w (Finsupp.mem_support_iff.mp hw) + have he : MonoidAlgebra.single w (p.coeff w)=p.coeff w • word (R:=R) w := by simp [word] + rw [he] + exact (space P).smul_mem _ (word_mem w hp) +theorem mem_space_iff {P : FreeMonoid α → Prop} {p : A R α} : + p∈space P ↔ ∀ w,p.coeff w≠0 → P w := by + constructor + · intro hp w hw + by_contra h + exact hw (coeff_support hp w h) + · exact mem_space + +theorem mul_mem {P Q T : FreeMonoid α → Prop} (h : ∀ u v,P u → Q v → T (u*v)) + {p q : A R α} (hp : p∈space P) (hq : q∈space Q) : p*q∈space T := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,hu,rfl⟩ := hp + induction hq using Submodule.span_induction with + | mem q hq => obtain ⟨v,hv,rfl⟩ := hq; rw [← word_mul]; exact word_mem _ (h u v hu hv) + | zero => simp + | add p q _ _ hp hq => simpa only [mul_add] using (space T).add_mem hp hq + | smul c p _ hp => simpa only [mul_smul_comm] using (space T).smul_mem c hp + | zero => simp + | add p q _ _ hp hq => simpa only [add_mul] using (space T).add_mem hp hq + | smul c p _ hp => simpa only [smul_mul_assoc] using (space T).smul_mem c hp + +def project (P : FreeMonoid α → Prop) [DecidablePred P] : A R α →ₗ[R] A R α := + (Finsupp.linearCombination R (fun w => if P w then word w else 0)).comp + (MonoidAlgebra.coeffLinearEquiv R).toLinearMap +@[simp] theorem project_word (P : FreeMonoid α → Prop) [DecidablePred P] (w : FreeMonoid α) : + project (R:=R) P (word w)=if P w then word w else 0 := by + change Finsupp.linearCombination R (fun monoidWord => if P monoidWord then word monoidWord else 0) (Finsupp.single w 1) = _; simp +theorem project_coeff (P : FreeMonoid α → Prop) [DecidablePred P] (p : A R α) (w : FreeMonoid α) : + (project P p).coeff w=if P w then p.coeff w else 0 := by + classical + induction p using MonoidAlgebra.induction_on with + | of v => + change (project P (word v)).coeff w=_ + rw [project_word] + by_cases hv : P v <;> by_cases hw : P w <;> simp [hv,hw,word] + · apply Finsupp.single_eq_of_ne + intro h + exact hw (h ▸ hv) + · symm + apply Finsupp.single_eq_of_ne + intro h + exact hv (h ▸ hw) + | add p q hp hq => simp only [map_add,MonoidAlgebra.coeff_add,Finsupp.add_apply,hp,hq]; split_ifs <;> simp + | smul c p hp => simp only [map_smul,MonoidAlgebra.coeff_smul,Finsupp.smul_apply,hp]; split_ifs <;> simp + +theorem project_mem (P : FreeMonoid α → Prop) [DecidablePred P] (p : A R α) : project P p∈space P := by + apply mem_space + intro w hw + by_contra hn + exact hw (by rw [project_coeff,ite_eq_right hn]) +theorem project_eq_self {P : FreeMonoid α → Prop} [DecidablePred P] {p : A R α} + (hp : p∈space P) : project P p=p := by + ext w + rw [project_coeff] + split_ifs with h + · rfl + · exact (coeff_support hp w h).symm +theorem project_eq_zero {P Q : FreeMonoid α → Prop} [DecidablePred Q] {p : A R α} + (hp : p∈space P) (h : ∀ w,P w → ¬Q w) : project Q p=0 := by + ext w + rw [project_coeff] + split_ifs with hw + · exact coeff_support hp w (fun hp => h w hp hw) + · rfl + +def degree (wt : α → ℕ) (w : FreeMonoid α) : ℕ := (w.toList.map wt).sum +@[simp] theorem degree_one (wt : α → ℕ) : degree wt 1=0 := rfl +@[simp] theorem degree_of (wt : α → ℕ) (a : α) : degree wt (FreeMonoid.of a)=wt a := by simp [degree] +@[simp] theorem degree_mul (wt : α → ℕ) (u v : FreeMonoid α) : degree wt (u*v)=degree wt u+degree wt v := by + simp [degree] +def homogeneous (wt : α → ℕ) (n : ℕ) := space (R:=R) (fun w => degree wt w=n) +def above (wt : α → ℕ) (n : ℕ) := space (R:=R) (fun w => n≤degree wt w) +def below (wt : α → ℕ) (n : ℕ) := space (R:=R) (fun w => degree wt w≤n) +def piece (wt : α → ℕ) (n : ℕ) : A R α →ₗ[R] A R α := project (fun w => degree wt w=n) +theorem homogeneous_mul {wt : α → ℕ} {n m : ℕ} {p q : A R α} + (hp : p∈homogeneous wt n) (hq : q∈homogeneous wt m) : p*q∈homogeneous wt (n+m) := + mul_mem (by intros; simp_all) hp hq +theorem above_mul {wt : α → ℕ} {n m : ℕ} {p q : A R α} + (hp : p∈above wt n) (hq : q∈above wt m) : p*q∈above wt (n+m) := + mul_mem (by intros; simp_all; omega) hp hq +theorem below_mul {wt : α → ℕ} {n m : ℕ} {p q : A R α} + (hp : p∈below wt n) (hq : q∈below wt m) : p*q∈below wt (n+m) := + mul_mem (by intros; simp_all; omega) hp hq +theorem map_space {M : Type*} [AddCommGroup M] [Module R M] + {P : FreeMonoid α → Prop} (f : A R α →ₗ[R] M) (T : Submodule R M) + (h : ∀ w,P w → f (word w)∈T) {p : A R α} (hp : p∈space P) : f p∈T := by + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨w,hw,rfl⟩ := hp; exact h w hw + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using T.add_mem hp hq + | smul c p _ hp => simpa only [map_smul] using T.smul_mem c hp + +theorem deriv_homogeneous {wt : α → ℕ} {c : ℕ} {f : α → A R α} + (hf : ∀ a,f a∈homogeneous wt (wt a+c)) {n : ℕ} {p : A R α} + (hp : p∈homogeneous wt n) : deriv f p∈homogeneous wt (n+c) := by + have hw (w : FreeMonoid α) : deriv f (word w)∈homogeneous wt (degree wt w+c) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,word_of,AssociativeElimination.deriv_mul,deriv_atom] + have h1 := homogeneous_mul (hf a) (word_mem (R:=R) w rfl : word w∈homogeneous wt (degree wt w)) + have h2 := homogeneous_mul (word_mem (R:=R) (FreeMonoid.of a) (degree_of wt a) : atom a∈homogeneous wt (wt a)) ih + simp only [degree_mul,degree_of] + apply (homogeneous wt (wt a+degree wt w+c)).add_mem + · simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · simpa only [word_of,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h2 + exact map_space (deriv f) _ (by intro w hw'; simpa only [hw'] using hw w) hp + +theorem homogeneous_above {wt : α → ℕ} {n : ℕ} {p : A R α} + (hp : p∈homogeneous wt n) : p∈above wt n := space_mono (by intros; omega) hp +theorem homogeneous_below {wt : α → ℕ} {n : ℕ} {p : A R α} + (hp : p∈homogeneous wt n) : p∈below wt n := space_mono (by intros; omega) hp + +theorem deriv_above {wt : α → ℕ} {c : ℕ} {f : α → A R α} + (hf : ∀ a,f a∈above wt (wt a+c)) {n : ℕ} {p : A R α} + (hp : p∈above wt n) : deriv f p∈above wt (n+c) := by + have hw (w : FreeMonoid α) : deriv f (word w)∈above wt (degree wt w+c) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,word_of,AssociativeElimination.deriv_mul,deriv_atom] + have h1 := above_mul (hf a) (homogeneous_above (word_mem (R:=R) w rfl : word w∈homogeneous wt (degree wt w))) + have h2 := above_mul (homogeneous_above (word_mem (R:=R) (FreeMonoid.of a) (degree_of wt a) : atom a∈homogeneous wt (wt a))) ih + simp only [degree_mul,degree_of] + apply (above wt (wt a+degree wt w+c)).add_mem + · simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · simpa only [word_of,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h2 + apply map_space (deriv f) _ ?_ hp + intro w hn + exact space_mono (by intro v hv; omega) (hw w) + +theorem deriv_below {wt : α → ℕ} {c : ℕ} {f : α → A R α} + (hf : ∀ a,f a∈below wt (wt a+c)) {n : ℕ} {p : A R α} + (hp : p∈below wt n) : deriv f p∈below wt (n+c) := by + have hw (w : FreeMonoid α) : deriv f (word w)∈below wt (degree wt w+c) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,word_of,AssociativeElimination.deriv_mul,deriv_atom] + have h1 := below_mul (hf a) (homogeneous_below (word_mem (R:=R) w rfl : word w∈homogeneous wt (degree wt w))) + have h2 := below_mul (homogeneous_below (word_mem (R:=R) (FreeMonoid.of a) (degree_of wt a) : atom a∈homogeneous wt (wt a))) ih + simp only [degree_mul,degree_of] + apply (below wt (wt a+degree wt w+c)).add_mem + · simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · simpa only [word_of,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h2 + apply map_space (deriv f) _ ?_ hp + intro w hn + exact space_mono (by intro v hv; omega) (hw w) + +theorem deriv_sub (f g : α → A R α) (p : A R α) : deriv (fun a => f a-g a) p=deriv f p-deriv g p := by + have hw (w : FreeMonoid α) : deriv (fun a => f a-g a) (word w)=deriv f (word w)-deriv g (word w) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + simp only [word_mul,word_of,AssociativeElimination.deriv_mul,deriv_atom,ih,mul_sub,sub_mul] + abel + induction p using MonoidAlgebra.induction_on with + | of w => exact hw w + | add p q hp hq => simp only [map_add,hp,hq]; abel + | smul c p hp => simp only [map_smul,hp,smul_sub] +end WordGrading + +namespace TriangularWords +open AssociativeElimination WordGrading +variable {R α V : Type*} [CommRing R] [AddCommGroup V] [Module R V] +def action (f : α → Module.End R V) : A R α →ₐ[R] Module.End R V := lift f +@[simp] theorem action_atom (f : α → Module.End R V) (a : α) : action f (atom a)=f a := lift_atom f a + +def apply (f : α → Module.End R V) (v : V) : A R α →ₗ[R] V := + (LinearMap.applyₗ v).comp (action f).toLinearMap +@[simp] theorem apply_word_one (f : α → Module.End R V) (v : V) : apply f v (word 1)=v := by simp [apply] +@[simp] theorem apply_word_cons (f : α → Module.End R V) (v : V) (a : α) (w : FreeMonoid α) : + apply f v (word (FreeMonoid.of a*w))=f a (apply f v (word w)) := by + simp [apply,Module.End.mul_apply] + +theorem comparison (wt : α → ℕ) (H E : ℕ → Submodule R V) + (f g : α → Module.End R V) (v : V) (hv : v∈H 0) + (hg : ∀ a n z,z∈H n → g a z∈H (wt a+n)) + (hf : ∀ a n z,z∈E n → f a z∈E (wt a+n)) + (hfg : ∀ a n z,z∈H n → f a z-g a z∈E (wt a+n)) + {n : ℕ} {p : A R α} (hp : p∈homogeneous wt n) : + apply g v p∈H n ∧ apply f v p-apply g v p∈E n := by + have hw (w : FreeMonoid α) : apply g v (word w)∈H (degree wt w) ∧ + apply f v (word w)-apply g v (word w)∈E (degree wt w) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa [apply] using And.intro hv ((E 0).zero_mem) + | of_mul a w ih => + simp only [degree_mul,degree_of,apply_word_cons] + refine ⟨hg a _ _ ih.1,?_⟩ + have h1 := hf a _ _ ih.2 + have h2 := hfg a _ _ ih.1 + have he : f a (apply f v (word w))-g a (apply g v (word w))= + f a (apply f v (word w)-apply g v (word w))+ + (f a (apply g v (word w))-g a (apply g v (word w))) := by rw [map_sub]; abel + rw [he] + exact (E _).add_mem h1 h2 + constructor + · exact map_space (apply g v) _ (by intro w hw'; simpa only [hw'] using (hw w).1) hp + · exact map_space (apply f v-apply g v) _ (by intro w hw'; simpa only [hw',LinearMap.sub_apply] using (hw w).2) hp +end TriangularWords +namespace WordGrading +open AssociativeElimination +variable {R α : Type*} [CommRing R] +def strictlyBelow (wt : α → ℕ) (n : ℕ) := space (R:=R) (fun w => degree wt w simp + | of_mul a w ih => + rw [word_mul,word_of,AssociativeElimination.deriv_mul,deriv_atom] + have h1 := strictlyBelow_mul_homogeneous (hf a) (word_mem (R:=R) w rfl : word w∈homogeneous wt (degree wt w)) + have h2 := homogeneous_mul_strictlyBelow (word_mem (R:=R) (FreeMonoid.of a) (degree_of wt a) : atom a∈homogeneous wt (wt a)) ih + simp only [degree_mul,degree_of] + apply (strictlyBelow wt (wt a+degree wt w+c)).add_mem + · simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · simpa only [word_of,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h2 + exact map_space (deriv f) _ (by intro w hw'; simpa only [hw'] using hw w) hp +end WordGrading +namespace TensorGrading +open AssociativeElimination WordGrading +open scoped TensorProduct +variable {R α β : Type*} [CommRing R] +abbrev V := A R α ⊗[R] A R β +def space (P : FreeMonoid α → FreeMonoid β → Prop) : Submodule R (V (R:=R) (α:=α) (β:=β)) := + Submodule.span R {z | ∃ u v,P u v ∧ z=word u⊗ₜ word v} +theorem tmul_word_mem {P : FreeMonoid α → FreeMonoid β → Prop} (u : FreeMonoid α) (v : FreeMonoid β) + (h : P u v) : word (R:=R) u⊗ₜ word (R:=R) v∈space P := + Submodule.subset_span ⟨u,v,h,rfl⟩ +theorem space_mono {P Q : FreeMonoid α → FreeMonoid β → Prop} (h : ∀ u v,P u v → Q u v) : + space (R:=R) P ≤ space Q := by + apply Submodule.span_le.mpr + rintro _ ⟨u,v,huv,rfl⟩ + exact tmul_word_mem u v (h u v huv) +theorem tmul_mem {P : FreeMonoid α → Prop} {Q : FreeMonoid β → Prop} + {T : FreeMonoid α → FreeMonoid β → Prop} (h : ∀ u v,P u → Q v → T u v) + {p : A R α} {q : A R β} (hp : p∈WordGrading.space P) (hq : q∈WordGrading.space Q) : + p⊗ₜ q∈space T := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,hu,rfl⟩ := hp + induction hq using Submodule.span_induction with + | mem q hq => obtain ⟨v,hv,rfl⟩ := hq; exact tmul_word_mem _ _ (h u v hu hv) + | zero => simp + | add p q _ _ hp hq => simpa only [TensorProduct.tmul_add] using (space T).add_mem hp hq + | smul c p _ hp => simpa only [TensorProduct.tmul_smul] using (space T).smul_mem c hp + | zero => simp + | add p q _ _ hp hq => simpa only [TensorProduct.add_tmul] using (space T).add_mem hp hq + | smul c p _ hp => simpa only [TensorProduct.smul_tmul'] using (space T).smul_mem c hp + +def homogeneous (wa : α → ℕ) (wb : β → ℕ) (n : ℕ) := + space (R:=R) (fun u v => degree wa u+degree wb v=n) +def above (wa : α → ℕ) (wb : β → ℕ) (n : ℕ) := + space (R:=R) (fun u v => n≤degree wa u+degree wb v) +def below (wa : α → ℕ) (wb : β → ℕ) (n : ℕ) := + space (R:=R) (fun u v => degree wa u+degree wb v≤n) +def strictlyBelow (wa : α → ℕ) (wb : β → ℕ) (n : ℕ) := + space (R:=R) (fun u v => degree wa u+degree wb v obtain ⟨u,v,h,rfl⟩ := hp; exact hf u v h + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using Q.add_mem hp hq + | smul c p _ hp => simpa only [map_smul] using Q.smul_mem c hp + +theorem homo_tmul {wa : α → ℕ} {wb : β → ℕ} {n m : ℕ} {p : A R α} {q : A R β} + (hp : p∈WordGrading.homogeneous wa n) (hq : q∈WordGrading.homogeneous wb m) : + p⊗ₜ q∈homogeneous wa wb (n+m) := tmul_mem (by intros; simp_all) hp hq +theorem above_tmul {wa : α → ℕ} {wb : β → ℕ} {n m : ℕ} {p : A R α} {q : A R β} + (hp : p∈WordGrading.above wa n) (hq : q∈WordGrading.above wb m) : + p⊗ₜ q∈above wa wb (n+m) := tmul_mem (by intros; omega) hp hq +theorem below_tmul {wa : α → ℕ} {wb : β → ℕ} {n m : ℕ} {p : A R α} {q : A R β} + (hp : p∈WordGrading.below wa n) (hq : q∈WordGrading.below wb m) : + p⊗ₜ q∈below wa wb (n+m) := tmul_mem (by intros; omega) hp hq +theorem strict_homo_tmul {wa : α → ℕ} {wb : β → ℕ} {n m : ℕ} {p : A R α} {q : A R β} + (hp : p∈WordGrading.strictlyBelow wa n) (hq : q∈WordGrading.homogeneous wb m) : + p⊗ₜ q∈strictlyBelow wa wb (n+m) := tmul_mem (by intros; omega) hp hq + +variable {wa : α → ℕ} {wb : β → ℕ} {δ : β → α → A R α} +theorem op_homogeneous (hδ : ∀ b a,δ b a∈WordGrading.homogeneous wa (wb b+wa a)) + (s : Sum α β) {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} (hz : z∈homogeneous wa wb n) : + PolynomialOrdering.op δ s z∈homogeneous wa wb (Sum.elim wa wb s+n) := by + apply map_space (PolynomialOrdering.op δ s) _ ?_ hz + intro u v huv + have hu : word (R:=R) u∈WordGrading.homogeneous wa (degree wa u) := word_mem u rfl + have hv : word (R:=R) v∈WordGrading.homogeneous wb (degree wb v) := word_mem v rfl + cases s with + | inl a => + have ha : atom (R:=R) a∈WordGrading.homogeneous wa (wa a) := word_mem (FreeMonoid.of a) (degree_of wa a) + have h := homo_tmul (WordGrading.homogeneous_mul ha hu) hv + simpa only [PolynomialOrdering.op,Sum.elim_inl,PolynomialOrdering.fiberOp_tmul,← huv,Nat.add_assoc] using h + | inr b => + have hd := WordGrading.deriv_homogeneous (c:=wb b) (f:=δ b) (by intro a; simpa only [Nat.add_comm] using hδ b a) hu + have hb : atom (R:=R) b∈WordGrading.homogeneous wb (wb b) := word_mem (FreeMonoid.of b) (degree_of wb b) + have h1 := homo_tmul hd hv + have h2 := homo_tmul hu (WordGrading.homogeneous_mul hb hv) + change deriv (δ b) (word u)⊗ₜ word v+word u⊗ₜ (atom b*word v)∈homogeneous wa wb (wb b+n) + apply (homogeneous wa wb (wb b+n)).add_mem + · simpa only [← huv,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · simpa only [← huv,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h2 + +theorem op_above (hδ : ∀ b a,δ b a∈WordGrading.above wa (wb b+wa a)) + (s : Sum α β) {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} (hz : z∈above wa wb n) : + PolynomialOrdering.op δ s z∈above wa wb (Sum.elim wa wb s+n) := by + apply map_space (PolynomialOrdering.op δ s) _ ?_ hz + intro u v huv + have hu : word (R:=R) u∈WordGrading.above wa (degree wa u) := word_mem u (by rfl) + have hv : word (R:=R) v∈WordGrading.above wb (degree wb v) := word_mem v (by rfl) + cases s with + | inl a => + have ha : atom (R:=R) a∈WordGrading.above wa (wa a) := word_mem (FreeMonoid.of a) (by simp) + have h := above_tmul (WordGrading.above_mul ha hu) hv + have hm : above (R:=R) wa wb (wa a+degree wa u+degree wb v) ≤ above wa wb (wa a+n) := + space_mono (by intro u' v' hh; change n ≤ degree wa u+degree wb v at huv; omega) + exact hm h + | inr b => + have hd := WordGrading.deriv_above (c:=wb b) (f:=δ b) (by intro a; simpa only [Nat.add_comm] using hδ b a) hu + have hb : atom (R:=R) b∈WordGrading.above wb (wb b) := word_mem (FreeMonoid.of b) (by simp) + have h1 := above_tmul hd hv + have h2 := above_tmul hu (WordGrading.above_mul hb hv) + have hm : above (R:=R) wa wb (degree wa u+degree wb v+wb b) ≤ above wa wb (wb b+n) := + space_mono (by intro u' v' hh; change n ≤ degree wa u+degree wb v at huv; omega) + change deriv (δ b) (word u)⊗ₜ word v+word u⊗ₜ (atom b*word v)∈above wa wb (wb b+n) + apply ( above wa wb (wb b+n)).add_mem + · apply hm; simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · apply hm; simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h2 + +theorem op_below (hδ : ∀ b a,δ b a∈WordGrading.below wa (wb b+wa a)) + (s : Sum α β) {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} (hz : z∈below wa wb n) : + PolynomialOrdering.op δ s z∈below wa wb (Sum.elim wa wb s+n) := by + apply map_space (PolynomialOrdering.op δ s) _ ?_ hz + intro u v huv + have hu : word (R:=R) u∈WordGrading.below wa (degree wa u) := word_mem u (by rfl) + have hv : word (R:=R) v∈WordGrading.below wb (degree wb v) := word_mem v (by rfl) + cases s with + | inl a => + have ha : atom (R:=R) a∈WordGrading.below wa (wa a) := word_mem (FreeMonoid.of a) (by simp) + have h := below_tmul (WordGrading.below_mul ha hu) hv + have hm : below (R:=R) wa wb (wa a+degree wa u+degree wb v) ≤ below wa wb (wa a+n) := + space_mono (by intro u' v' hh; change degree wa u+degree wb v ≤ n at huv; omega) + exact hm h + | inr b => + have hd := WordGrading.deriv_below (c:=wb b) (f:=δ b) (by intro a; simpa only [Nat.add_comm] using hδ b a) hu + have hb : atom (R:=R) b∈WordGrading.below wb (wb b) := word_mem (FreeMonoid.of b) (by simp) + have h1 := below_tmul hd hv + have h2 := below_tmul hu (WordGrading.below_mul hb hv) + have hm : below (R:=R) wa wb (degree wa u+degree wb v+wb b) ≤ below wa wb (wb b+n) := + space_mono (by intro u' v' hh; change degree wa u+degree wb v ≤ n at huv; omega) + change deriv (δ b) (word u)⊗ₜ word v+word u⊗ₜ (atom b*word v)∈below wa wb (wb b+n) + apply ( below wa wb (wb b+n)).add_mem + · apply hm; simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · apply hm; simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h2 + +theorem op_strictlyBelow (hδ : ∀ b a,δ b a∈WordGrading.below wa (wb b+wa a)) + (s : Sum α β) {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} (hz : z∈strictlyBelow wa wb n) : + PolynomialOrdering.op δ s z∈strictlyBelow wa wb (Sum.elim wa wb s+n) := by + apply map_space (PolynomialOrdering.op δ s) _ ?_ hz + intro u v huv + have hh : word (R:=R) u⊗ₜ word (R:=R) v∈below wa wb (degree wa u+degree wb v) := tmul_word_mem u v (by rfl) + have h := op_below hδ s hh + have hm : below (R:=R) wa wb (Sum.elim wa wb s+(degree wa u+degree wb v)) ≤ + strictlyBelow wa wb (Sum.elim wa wb s+n) := + space_mono (by intro u' v' hh; change degree wa u+degree wb v 0) (fun b => deriv (fun a => δ b a-δ₀ b a) (word u)⊗ₜ word v) s := by + cases s with + | inl a => simp [PolynomialOrdering.op] + | inr b => + simp only [PolynomialOrdering.op,Sum.elim_inr,LinearMap.sub_apply,PolynomialOrdering.baseOp_tmul, + WordGrading.deriv_sub,TensorProduct.sub_tmul] + abel + +theorem op_difference_above (hδ : ∀ b a,δ b a-δ₀ b a∈WordGrading.above wa (wb b+wa a+1)) + (s : Sum α β) {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} (hz : z∈homogeneous wa wb n) : + PolynomialOrdering.op δ s z-PolynomialOrdering.op δ₀ s z∈above wa wb (Sum.elim wa wb s+n+1) := by + apply map_space (PolynomialOrdering.op δ s-PolynomialOrdering.op δ₀ s) _ ?_ hz + intro u v huv + rw [op_difference] + cases s with + | inl a => exact (above wa wb _).zero_mem + | inr b => + have hu : word (R:=R) u∈WordGrading.above wa (degree wa u) := word_mem u (by rfl) + have hv : word (R:=R) v∈WordGrading.above wb (degree wb v) := word_mem v (by rfl) + have hd := WordGrading.deriv_above (c:=wb b+1) (f:=fun a => δ b a-δ₀ b a) + (by intro a; simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using hδ b a) hu + have hh := above_tmul hd hv + simpa only [Sum.elim_inr,← huv,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using hh + +theorem op_difference_below (hδ : ∀ b a,δ b a-δ₀ b a∈WordGrading.strictlyBelow wa (wb b+wa a)) + (s : Sum α β) {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} (hz : z∈homogeneous wa wb n) : + PolynomialOrdering.op δ s z-PolynomialOrdering.op δ₀ s z∈strictlyBelow wa wb (Sum.elim wa wb s+n) := by + apply map_space (PolynomialOrdering.op δ s-PolynomialOrdering.op δ₀ s) _ ?_ hz + intro u v huv + rw [op_difference] + cases s with + | inl a => exact (strictlyBelow wa wb _).zero_mem + | inr b => + have hu : word (R:=R) u∈WordGrading.homogeneous wa (degree wa u) := word_mem u rfl + have hv : word (R:=R) v∈WordGrading.homogeneous wb (degree wb v) := word_mem v rfl + have hd := WordGrading.deriv_strictlyBelow (c:=wb b) (f:=fun a => δ b a-δ₀ b a) + (by intro a; simpa only [Nat.add_comm] using hδ b a) hu + have hh := strict_homo_tmul hd hv + simpa only [Sum.elim_inr,← huv,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using hh + +theorem comparison_above (h0 : ∀ b a,δ₀ b a∈WordGrading.homogeneous wa (wb b+wa a)) + (hδ : ∀ b a,δ b a∈WordGrading.above wa (wb b+wa a)) + (hd : ∀ b a,δ b a-δ₀ b a∈WordGrading.above wa (wb b+wa a+1)) + {n : ℕ} {p : A R (Sum α β)} (hp : p∈WordGrading.homogeneous (Sum.elim wa wb) n) : + PolynomialOrdering.normalize δ₀ p∈homogeneous wa wb n ∧ + PolynomialOrdering.normalize δ p-PolynomialOrdering.normalize δ₀ p∈above wa wb (n+1) := by + apply TriangularWords.comparison (Sum.elim wa wb) (homogeneous wa wb) (fun n => above wa wb (n+1)) + (PolynomialOrdering.op δ) (PolynomialOrdering.op δ₀) (1⊗ₜ 1) ?_ ?_ ?_ ?_ hp + · exact tmul_word_mem 1 1 (by simp) + · intro a n z hz; exact op_homogeneous h0 a hz + · intro a n z hz; simpa only [Nat.add_assoc] using op_above hδ a hz + · intro a n z hz; exact op_difference_above hd a hz + +theorem comparison_below (h0 : ∀ b a,δ₀ b a∈WordGrading.homogeneous wa (wb b+wa a)) + (hδ : ∀ b a,δ b a∈WordGrading.below wa (wb b+wa a)) + (hd : ∀ b a,δ b a-δ₀ b a∈WordGrading.strictlyBelow wa (wb b+wa a)) + {n : ℕ} {p : A R (Sum α β)} (hp : p∈WordGrading.homogeneous (Sum.elim wa wb) n) : + PolynomialOrdering.normalize δ₀ p∈homogeneous wa wb n ∧ + PolynomialOrdering.normalize δ p-PolynomialOrdering.normalize δ₀ p∈strictlyBelow wa wb n := by + apply TriangularWords.comparison (Sum.elim wa wb) (homogeneous wa wb) (strictlyBelow wa wb) + (PolynomialOrdering.op δ) (PolynomialOrdering.op δ₀) (1⊗ₜ 1) ?_ ?_ ?_ ?_ hp + · exact tmul_word_mem 1 1 (by simp) + · intro a n z hz; exact op_homogeneous h0 a hz + · intro a n z hz; exact op_strictlyBelow hδ a hz + · intro a n z hz; exact op_difference_below hd a hz +end TensorGrading +namespace CountTables + +section +open AssociativeElimination +abbrev K := ZMod 2 +abbrev F := Fin 5 +abbrev B := Fin 4 + +def H : A K F := atom 0 +def U (i : Fin 2) : A K F := atom ⟨i.val+1,by omega⟩ +def V (i : Fin 2) : A K F := atom ⟨i.val+3,by omega⟩ +def bracket {R α : Type*} [CommRing R] (p q : A R α) := p*q-q*p +def R' (i : Fin 2) := bracket H (U i) +def Q (i : Fin 2) := bracket (H+V i) (U i) +def W := bracket (V 0) (U 1)+bracket (U 0) (V 1) +def common : B → F → A K F + | 0,0 => bracket H (V 0) + | 0,1 => Q 0 + | 0,3 => bracket H (V 0) + | 1,0 => bracket H (V 1) + | 1,2 => Q 1 + | 1,4 => bracket H (V 1) + | 2,1 | 2,2 => bracket (U 0) (U 1) + | 2,3 | 2,4 => W + | 3,1 => bracket (U 0) (V 1) + | 3,2 => bracket (U 1) (V 0) + | 3,3 | 3,4 => bracket (V 0) (V 1) + | _,_ => 0 +def higher : B → F → A K F + | 0,0 => bracket (R' 0) (U 0) + | 0,3 => bracket (bracket (V 0) (U 0)) (U 0) + | 0,4 => bracket (Q 0) (U 1) + | 1,0 => bracket (R' 1) (U 1) + | 1,4 => bracket (bracket (V 1) (U 1)) (U 1) + | 1,3 => bracket (Q 1) (U 0) + | 3,0 => bracket H (bracket (U 0) (U 1)) + | 3,3 => bracket W (U 0)+bracket (U 0) (R' 1) + | 3,4 => bracket W (U 1)+bracket (U 1) (R' 0) + | _,_ => 0 +def lower : B → F → A K F + | 2,3 | 2,4 => bracket (V 0) (V 1) + | _,_ => 0 +def source (b : B) (a : F) := common b a+higher b a +def target (b : B) (a : F) := common b a+lower b a + +def fiberCount : F → ℕ | 1 | 2 => 1 | _ => 0 +def baseCount : B → ℕ | 2 => 1 | _ => 0 + +open WordGrading + +theorem bracket_homo {n m : ℕ} {p q : A K F} + (hp : p∈homogeneous fiberCount n) (hq : q∈homogeneous fiberCount m) : + bracket p q∈homogeneous fiberCount (n+m) := by + apply (homogeneous fiberCount (n+m)).sub_mem (homogeneous_mul hp hq) + simpa only [Nat.add_comm] using homogeneous_mul hq hp + +theorem H_homo : H∈homogeneous fiberCount 0 := word_mem (FreeMonoid.of 0) rfl +theorem U_homo (i : Fin 2) : U i∈homogeneous fiberCount 1 := by + apply word_mem + fin_cases i <;> rfl +theorem V_homo (i : Fin 2) : V i∈homogeneous fiberCount 0 := by + apply word_mem + fin_cases i <;> rfl +theorem R_homo (i : Fin 2) : R' i∈homogeneous fiberCount 1 := by + have h := bracket_homo H_homo (U_homo i) + exact h +theorem Q_homo (i : Fin 2) : Q i∈homogeneous fiberCount 1 := + by + have h := bracket_homo ((homogeneous fiberCount 0).add_mem H_homo (V_homo i)) (U_homo i) + exact h +theorem W_homo : W∈homogeneous fiberCount 1 := + by + have h1 := bracket_homo (V_homo 0) (U_homo 1) + have h2 := bracket_homo (U_homo 0) (V_homo 1) + exact (homogeneous fiberCount 1).add_mem h1 h2 + +theorem common_homo_0 (a : F) : common 0 a∈homogeneous fiberCount (baseCount 0+fiberCount a) := by + fin_cases a + · have h := bracket_homo H_homo (V_homo 0) + exact h + · have h := Q_homo 0 + exact h + · exact (homogeneous fiberCount _).zero_mem + · have h := bracket_homo H_homo (V_homo 0) + exact h + · exact (homogeneous fiberCount _).zero_mem +theorem common_homo_1 (a : F) : common 1 a∈homogeneous fiberCount (baseCount 1+fiberCount a) := by + fin_cases a + · have h := bracket_homo H_homo (V_homo 1) + exact h + · exact (homogeneous fiberCount _).zero_mem + · have h := Q_homo 1 + exact h + · exact (homogeneous fiberCount _).zero_mem + · have h := bracket_homo H_homo (V_homo 1) + exact h +theorem common_homo_2 (a : F) : common 2 a∈homogeneous fiberCount (baseCount 2+fiberCount a) := by + fin_cases a + · exact (homogeneous fiberCount _).zero_mem + · have h := bracket_homo (U_homo 0) (U_homo 1) + exact h + · have h := bracket_homo (U_homo 0) (U_homo 1) + exact h + · have h := W_homo + exact h + · have h := W_homo + exact h +theorem common_homo_3 (a : F) : common 3 a∈homogeneous fiberCount (baseCount 3+fiberCount a) := by + fin_cases a + · exact (homogeneous fiberCount _).zero_mem + · have h := bracket_homo (U_homo 0) (V_homo 1) + exact h + · have h := bracket_homo (U_homo 1) (V_homo 0) + exact h + · have h := bracket_homo (V_homo 0) (V_homo 1) + exact h + · have h := bracket_homo (V_homo 0) (V_homo 1) + exact h +theorem common_homo (b : B) (a : F) : common b a∈homogeneous fiberCount (baseCount b+fiberCount a) := by + fin_cases b + · exact common_homo_0 a + · exact common_homo_1 a + · exact common_homo_2 a + · exact common_homo_3 a +theorem higher_homo_0 (a : F) : higher 0 a∈homogeneous fiberCount (baseCount 0+fiberCount a+2) := by + fin_cases a + · have h := bracket_homo (R_homo 0) (U_homo 0) + exact h + · exact (homogeneous fiberCount _).zero_mem + · exact (homogeneous fiberCount _).zero_mem + · have h := bracket_homo (bracket_homo (V_homo 0) (U_homo 0)) (U_homo 0) + exact h + · have h := bracket_homo (Q_homo 0) (U_homo 1) + exact h +theorem higher_homo_1 (a : F) : higher 1 a∈homogeneous fiberCount (baseCount 1+fiberCount a+2) := by + fin_cases a + · have h := bracket_homo (R_homo 1) (U_homo 1) + exact h + · exact (homogeneous fiberCount _).zero_mem + · exact (homogeneous fiberCount _).zero_mem + · have h := bracket_homo (Q_homo 1) (U_homo 0) + exact h + · have h := bracket_homo (bracket_homo (V_homo 1) (U_homo 1)) (U_homo 1) + exact h +theorem higher_homo_2 (a : F) : higher 2 a∈homogeneous fiberCount (baseCount 2+fiberCount a+2) := by + fin_cases a + · exact (homogeneous fiberCount _).zero_mem + · exact (homogeneous fiberCount _).zero_mem + · exact (homogeneous fiberCount _).zero_mem + · exact (homogeneous fiberCount _).zero_mem + · exact (homogeneous fiberCount _).zero_mem +theorem higher_homo_3 (a : F) : higher 3 a∈homogeneous fiberCount (baseCount 3+fiberCount a+2) := by + fin_cases a + · have h := bracket_homo H_homo (bracket_homo (U_homo 0) (U_homo 1)) + exact h + · exact (homogeneous fiberCount _).zero_mem + · exact (homogeneous fiberCount _).zero_mem + · have h1 := bracket_homo W_homo (U_homo 0) + have h2 := bracket_homo (U_homo 0) (R_homo 1) + exact (homogeneous fiberCount 2).add_mem h1 h2 + · have h1 := bracket_homo W_homo (U_homo 1) + have h2 := bracket_homo (U_homo 1) (R_homo 0) + exact (homogeneous fiberCount 2).add_mem h1 h2 +theorem higher_homo (b : B) (a : F) : higher b a∈homogeneous fiberCount (baseCount b+fiberCount a+2) := by + fin_cases b + · exact higher_homo_0 a + · exact higher_homo_1 a + · exact higher_homo_2 a + · exact higher_homo_3 a + +theorem lower_strict (b : B) (a : F) : lower b a∈strictlyBelow fiberCount (baseCount b+fiberCount a) := by + fin_cases b <;> fin_cases a <;> simp only [lower,baseCount,fiberCount,Nat.reduceAdd] + all_goals first + | exact (strictlyBelow fiberCount _).zero_mem + | exact (space_mono (P:=fun w => degree fiberCount w=0) (Q:=fun w => degree fiberCount w<1) + (by intros; omega)) (bracket_homo (n:=0) (m:=0) (V_homo 0) (V_homo 1)) + +theorem source_above (b : B) (a : F) : source b a∈above fiberCount (baseCount b+fiberCount a) := by + apply (above fiberCount _).add_mem + · apply space_mono (P:=fun w => degree fiberCount w=baseCount b+fiberCount a) (by intros; omega) + exact common_homo b a + · apply space_mono (P:=fun w => degree fiberCount w=baseCount b+fiberCount a+2) (by intros; omega) + exact higher_homo b a + +theorem source_difference (b : B) (a : F) : + source b a-common b a∈above fiberCount (baseCount b+fiberCount a+1) := by + rw [source,add_sub_cancel_left] + apply space_mono (P:=fun w => degree fiberCount w=baseCount b+fiberCount a+2) (by intros; omega) + exact higher_homo b a + +theorem target_below (b : B) (a : F) : target b a∈below fiberCount (baseCount b+fiberCount a) := by + apply (below fiberCount _).add_mem + · apply space_mono (P:=fun w => degree fiberCount w=baseCount b+fiberCount a) (by intros; omega) + exact common_homo b a + · apply space_mono (P:=fun w => degree fiberCount w match a with + | 0 => X*X | 1 => Y 0 | 2 => Y 1 | 3 => C 0 | _ => C 1) +def δ (i : Fin 2) : A K G →ₗ[K] A K G := deriv (fun a => if a=0 ∨ a.val=i.val+1 then C i else 0) +def ε : A K G →ₗ[K] A K G := deriv (fun a => if a=0 then 0 else bracket (Y 0) (Y 1)) +def baseDeriv : B → A K G →ₗ[K] A K G + | 0 => (δ 0).comp (δ 0) + | 1 => (δ 1).comp (δ 1) + | 2 => ε + | _ => (δ 0).comp ε-ε.comp (δ 0) + +@[simp] theorem realize_H : realize H=X*X := by simp [realize,H] +@[simp] theorem realize_U (i : Fin 2) : realize (U i)=Y i := by fin_cases i <;> simp [realize,U] +@[simp] theorem realize_V (i : Fin 2) : realize (V i)=C i := by fin_cases i <;> simp [realize,V] +@[simp] theorem realize_bracket (p q : A K F) : realize (bracket p q)=bracket (realize p) (realize q) := by simp [bracket] +@[simp] theorem deriv_bracket {R α : Type*} [CommRing R] (f : α → A R α) (p q : A R α) : + deriv f (bracket p q)=bracket (deriv f p) q+bracket p (deriv f q) := by + simp only [bracket,map_sub,AssociativeElimination.deriv_mul]; abel + +@[simp] theorem bracket_add_left (p q r : A K G) : bracket (p+q) r=bracket p r+bracket q r := by simp [bracket,add_mul,mul_add]; abel +@[simp] theorem bracket_add_right (p q r : A K G) : bracket p (q+r)=bracket p q+bracket p r := by simp [bracket,add_mul,mul_add]; abel +@[simp] theorem bracket_sub_left (p q r : A K G) : bracket (p-q) r=bracket p r-bracket q r := by simp [bracket,sub_mul,mul_sub]; abel +@[simp] theorem bracket_sub_right (p q r : A K G) : bracket p (q-r)=bracket p q-bracket p r := by simp [bracket,sub_mul,mul_sub]; abel +@[simp] theorem bracket_zero_left (r : A K G) : bracket 0 r=0 := by simp [bracket] +@[simp] theorem bracket_zero_right (r : A K G) : bracket r 0=0 := by simp [bracket] +@[simp] theorem bracket_self (r : A K G) : bracket r r=0 := by simp [bracket] +theorem bracket_swap (p q : A K G) : bracket p q=bracket q p := by simp [bracket,CharTwo.sub_eq_add,add_comm] +theorem bracket_ad_square (u v : A K G) : bracket u (bracket u v)=bracket (u*u) v := by + simp only [bracket,sub_eq_add_neg,CharTwo.neg_eq,mul_add,add_mul,mul_assoc] + calc + _ = u*(u*v)+v*(u*u)+(u*(v*u)+u*(v*u)) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] +theorem bracket_leibniz (p q r : A K G) : bracket p (bracket q r)=bracket (bracket p q) r+bracket q (bracket p r) := by + simp only [bracket]; noncomm_ring +@[simp] theorem δ_X (i : Fin 2) : δ i X=C i := by simp [δ,X] +@[simp] theorem δ_Y_self (i : Fin 2) : δ i (Y i)=C i := by simp [δ,Y] +@[simp] theorem δ_Y_other (i j : Fin 2) (h : j≠i) : δ i (Y j)=0 := by + have hv : j.val≠i.val := fun he => h (Fin.ext he) + simp [δ,Y,hv] +theorem δ_mul (i : Fin 2) (p q : A K G) : δ i (p*q)=δ i p*q+p*δ i q := deriv_mul _ _ _ +@[simp] theorem δ_bracket (i : Fin 2) (p q : A K G) : δ i (bracket p q)=bracket (δ i p) q+bracket p (δ i q) := deriv_bracket _ _ _ +@[simp] theorem δ_H (i : Fin 2) : δ i (X*X)=bracket (X*X) (Y i) := by + rw [δ_mul,δ_X,← bracket_ad_square] + change C i*X+X*C i=bracket X (C i) + simp [bracket,CharTwo.sub_eq_add,add_comm] +theorem bracket_X_Y (i : Fin 2) : bracket X (Y i)=C i := rfl +theorem bracket_X_C (i : Fin 2) : bracket X (C i)=bracket (X*X) (Y i) := bracket_ad_square _ _ +@[simp] theorem δ_C_self (i : Fin 2) : δ i (C i)=bracket (X*X+C i) (Y i) := by + change δ i (bracket X (Y i))=_ + rw [δ_bracket,δ_X,δ_Y_self,bracket_X_C,bracket_add_left] + exact add_comm _ _ +@[simp] theorem δ_C_other (i j : Fin 2) (h : j≠i) : δ i (C j)=bracket (C i) (Y j) := by + rw [C,δ_bracket,δ_X,δ_Y_other i j h,bracket_zero_right,add_zero] +@[simp] theorem ε_X : ε X=0 := by simp [ε,X] +@[simp] theorem ε_Y (i : Fin 2) : ε (Y i)=bracket (Y 0) (Y 1) := by simp [ε,Y] +@[simp] theorem ε_bracket (p q : A K G) : ε (bracket p q)=bracket (ε p) q+bracket p (ε q) := deriv_bracket _ _ _ +@[simp] theorem ε_H : ε (X*X)=0 := by simp [ε,AssociativeElimination.deriv_mul,X] +theorem ε_C (i : Fin 2) : ε (C i)=bracket (C 0) (Y 1)+bracket (Y 0) (C 1) := by + rw [C,ε_bracket,ε_X,ε_Y,bracket_zero_left,zero_add,bracket_leibniz] + rfl + +def J := baseDeriv 3 +@[simp] theorem J_X : J X=bracket (C 0) (Y 1)+bracket (Y 0) (C 1) := by + simp only [J,baseDeriv,LinearMap.sub_apply,LinearMap.comp_apply,ε_X,map_zero,δ_X,ε_C] + simp only [zero_sub,CharTwo.neg_eq] +@[simp] theorem J_Y_zero : J (Y 0)=bracket (Y 0) (C 1) := by + simp only [J,baseDeriv,LinearMap.sub_apply,LinearMap.comp_apply,ε_Y,δ_bracket,δ_Y_self, + δ_Y_other 0 1 (by decide),bracket_zero_right,add_zero,ε_C] + simp only [sub_add_eq_sub_sub,sub_self,zero_sub,CharTwo.neg_eq] +@[simp] theorem J_Y_one : J (Y 1)=bracket (Y 1) (C 0) := by + simp only [J,baseDeriv,LinearMap.sub_apply,LinearMap.comp_apply,ε_Y,δ_bracket,δ_Y_self, + δ_Y_other 0 1 (by decide),bracket_zero_right,add_zero,map_zero,sub_zero] + exact bracket_swap _ _ +@[simp] theorem J_bracket (p q : A K G) : J (bracket p q)=bracket (J p) q+bracket p (J q) := by + simp only [J,baseDeriv,LinearMap.sub_apply,LinearMap.comp_apply,ε_bracket,δ_bracket,map_add, + bracket_sub_left,bracket_sub_right] + abel +@[simp] theorem J_mul (p q : A K G) : J (p*q)=J p*q+p*J q := by + simp only [J,baseDeriv,LinearMap.sub_apply,LinearMap.comp_apply,ε,δ,AssociativeElimination.deriv_mul, + map_add,sub_mul,mul_sub] + abel +@[simp] theorem J_H : J (X*X)=bracket (X*X) (bracket (Y 0) (Y 1)) := by + rw [J_mul,J_X] + have h : bracket (C 0) (Y 1)+bracket (Y 0) (C 1)=bracket X (bracket (Y 0) (Y 1)) := + (bracket_leibniz X (Y 0) (Y 1)).symm + rw [h,← bracket_ad_square] + simp only [bracket,CharTwo.sub_eq_add] + exact add_comm _ _ +@[simp] theorem J_C_zero : J (C 0)=bracket (C 0) (C 1)+ + bracket (bracket (C 0) (Y 1)+bracket (Y 0) (C 1)) (Y 0)+bracket (Y 0) (bracket (X*X) (Y 1)) := by + change J (bracket X (Y 0))=_ + rw [J_bracket,J_X,J_Y_zero,bracket_leibniz,bracket_X_C] + rw [bracket_X_Y 0,add_left_comm,← add_assoc] +@[simp] theorem J_C_one : J (C 1)=bracket (C 0) (C 1)+ + bracket (bracket (C 0) (Y 1)+bracket (Y 0) (C 1)) (Y 1)+bracket (Y 1) (bracket (X*X) (Y 0)) := by + change J (bracket X (Y 1))=_ + rw [J_bracket,J_X,J_Y_one,bracket_leibniz,bracket_X_C] + rw [bracket_X_Y 1,bracket_swap (C 1) (C 0),add_left_comm,← add_assoc] + +@[simp] theorem δ_square_H (i : Fin 2) : δ i (δ i (X*X))= + bracket (X*X) (C i)+bracket (bracket (X*X) (Y i)) (Y i) := by + rw [δ_H,δ_bracket,δ_H,δ_Y_self] + exact add_comm _ _ +@[simp] theorem δ_H_add_C (i : Fin 2) : δ i (X*X+C i)=bracket (C i) (Y i) := by + rw [map_add,δ_H,δ_C_self,bracket_add_left,CharTwo.add_cancel_left] +@[simp] theorem δ_square_C_self (i : Fin 2) : δ i (δ i (C i))= + bracket (X*X) (C i)+bracket (bracket (C i) (Y i)) (Y i) := by + rw [δ_C_self,δ_bracket,δ_H_add_C,δ_Y_self,bracket_add_left,bracket_self,add_zero] + exact add_comm _ _ +@[simp] theorem δ_square_C_other (i j : Fin 2) (h : j≠i) : δ i (δ i (C j))= + bracket (bracket (X*X+C i) (Y i)) (Y j) := by + rw [δ_C_other i j h,δ_bracket,δ_C_self,δ_Y_other i j h,bracket_zero_right,add_zero] + +@[simp] theorem realize_atom_zero : realize (atom (0 : F))=X*X := realize_H +@[simp] theorem realize_atom_one : realize (atom (1 : F))=Y 0 := realize_U 0 +@[simp] theorem realize_atom_two : realize (atom (2 : F))=Y 1 := realize_U 1 +@[simp] theorem realize_atom_three : realize (atom (3 : F))=C 0 := realize_V 0 +@[simp] theorem realize_atom_four : realize (atom (4 : F))=C 1 := realize_V 1 + +attribute [local irreducible] X Y C H U V + theorem source_realization_a0 (a : F) : baseDeriv 0 (realize (atom a))=realize (source 0 a) := by + fin_cases a <;> simp [source,common,higher,R',Q,baseDeriv,δ_Y_other 0 1 (by decide)] + · exact add_comm _ _ + · rw [add_add_add_comm,CharTwo.add_self_eq_zero,zero_add] + theorem source_realization_a1 (a : F) : baseDeriv 1 (realize (atom a))=realize (source 1 a) := by + fin_cases a <;> simp [source,common,higher,R',Q,baseDeriv,δ_Y_other 1 0 (by decide)] + · exact add_comm _ _ + · rw [add_add_add_comm,CharTwo.add_self_eq_zero,zero_add] + theorem source_realization_u (a : F) : baseDeriv 2 (realize (atom a))=realize (source 2 a) := by + fin_cases a <;> simp [source,common,higher,W,baseDeriv,ε_C] + theorem source_realization_v (a : F) : baseDeriv 3 (realize (atom a))=realize (source 3 a) := by + change J (realize (atom a))=_ + fin_cases a <;> simp [source,common,higher,R',W,add_assoc] + have h := J_H + rw [J_mul,J_X] at h + exact h +theorem source_realization (b : B) (a : F) : baseDeriv b (realize (atom a))=realize (source b a) := by + fin_cases b + · exact source_realization_a0 a + · exact source_realization_a1 a + · exact source_realization_u a + · exact source_realization_v a +end CountTables +namespace WeightedDeletion +open AssociativeElimination WordGrading +variable {R α : Type*} [CommRing R] +def raw (κ : α → α → α → R) (l r : α) : List α → A R α + | [] => 0 + | a::s => κ l a (s.headD r) • word (FreeMonoid.ofList s)+atom a*raw κ a r s + +def op (κ : α → α → α → R) (l r : α) : Module.End R (A R α) := + (Finsupp.linearCombination R (fun w : FreeMonoid α => raw κ l r w.toList)).comp + (MonoidAlgebra.coeffLinearEquiv R).toLinearMap +@[simp] theorem op_word (κ : α → α → α → R) (l r : α) (s : List α) : + op κ l r (word (FreeMonoid.ofList s))=raw κ l r s := by change Finsupp.linearCombination R (fun monoidWord : FreeMonoid α => raw κ l r monoidWord.toList) (Finsupp.single (FreeMonoid.ofList s) 1) = _; simp + +inductive Step (κ : α → α → α → R) (r : α) : α → List α → List α → Prop + | head (l a : α) (s : List α) (h : κ l a (s.headD r)≠0) : Step κ r l (a::s) s + | tail (l a : α) (s t : List α) (h : Step κ r a s t) : Step κ r l (a::s) (a::t) + +theorem raw_mem_space (κ : α → α → α → R) (l r : α) (s : List α) + (P : FreeMonoid α → Prop) (h : ∀ t,Step κ r l s t → P (FreeMonoid.ofList t)) : + raw κ l r s∈space P := by + classical + induction s generalizing l P with + | nil => exact (space P).zero_mem + | cons a s ih => + apply (space P).add_mem + · by_cases hc : κ l a (s.headD r)=0 + · simp only [hc,zero_smul]; exact (space P).zero_mem + · exact (space P).smul_mem _ (word_mem _ (h s (.head l a s hc))) + · have ht := ih a (fun w => P (FreeMonoid.of a*w)) (by + intro t ht + simpa only [FreeMonoid.ofList_cons] using h (a::t) (.tail l a s t ht)) + exact map_space (Algebra.lmul R (A R α) (atom a)) (space P) (by + intro w hw + change atom a*word w∈space P + rw [← word_of a,← word_mul] + exact word_mem _ hw) ht + +theorem Step.length {κ : α → α → α → R} {r l : α} {s t : List α} + (h : Step κ r l s t) : t.length+1=s.length := by + induction h with + | head => simp + | tail _ _ _ _ _ ih => simp only [List.length_cons]; omega + +theorem raw_length (κ : α → α → α → R) (l r : α) (s : List α) : + raw κ l r s∈space (fun w => w.toList.length+1=s.length) := + raw_mem_space κ l r s _ (by intro t ht; simpa only [FreeMonoid.toList_ofList] using ht.length) + +def count (wt : α → ℕ) (s : List α) : ℕ := (s.map wt).sum +@[simp] theorem count_nil (wt : α → ℕ) : count wt []=0 := rfl +@[simp] theorem count_cons (wt : α → ℕ) (a : α) (s : List α) : count wt (a::s)=wt a+count wt s := rfl + +theorem Step.count_bound {κ : α → α → α → R} {r l : α} {s t : List α} + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → wt a≤c) + (h : Step κ r l s t) : count wt s≤c+count wt t := by + induction h with + | head l a s h => simpa only [count_cons] using Nat.add_le_add_right (hc l a _ h) (count wt s) + | tail l a s t h ih => simp only [count_cons]; omega + +theorem raw_count_bound (κ : α → α → α → R) (l r : α) (s : List α) + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → wt a≤c) : + raw κ l r s∈space (fun w => count wt s≤c+degree wt w) := + raw_mem_space κ l r s _ (by + intro t ht + simpa only [degree,FreeMonoid.toList_ofList,count] using ht.count_bound wt c hc) +end WeightedDeletion + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Grading.lean b/lean/OAI/Algebra/Drinfeld/Grading.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bd55dcc9fb65224aeb604674bf25bbaa17fa6b1 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Grading.lean @@ -0,0 +1,585 @@ +import OAI.Algebra.Drinfeld.Ordering + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +section +namespace WordGrading +open AssociativeElimination +variable {R α β : Type*} [CommRing R] + +theorem piece_homogeneous {wt : α → ℕ} {k : ℕ} {p : A R α} + (hp : p∈homogeneous wt k) (n : ℕ) : piece wt n p=if k=n then p else 0 := by + by_cases h : k=n + · subst k + exact (project_eq_self hp).trans (ite_eq_left rfl).symm + · rw [ite_eq_right h] + exact project_eq_zero hp (by intro w hw hn; exact h (hw.symm.trans hn)) + +theorem piece_mem (wt : α → ℕ) (n : ℕ) (p : A R α) : piece wt n p∈homogeneous wt n := + project_mem _ p + +theorem piece_eq_self_iff (wt : α → ℕ) (n : ℕ) (p : A R α) : + piece wt n p=p ↔ p∈homogeneous wt n := by + constructor + · intro h; rw [← h]; exact piece_mem wt n p + · exact project_eq_self + +theorem project_degree_homogeneous (wt : α → ℕ) (P : ℕ → Prop) [DecidablePred P] + {k : ℕ} {p : A R α} (hp : p∈homogeneous wt k) : + project (fun w => P (degree wt w)) p=if P k then p else 0 := by + by_cases h : P k + · rw [ite_eq_left h] + exact project_eq_self (space_mono (by intro w hw; exact hw ▸ h) hp) + · rw [ite_eq_right h] + exact project_eq_zero hp (by intro w hw; simpa only [hw] using h) + +theorem algHom_project (f : A R α →ₐ[R] A R β) (wa : α → ℕ) (wb : β → ℕ) + (hf : ∀ a,f (atom a)∈homogeneous wb (wa a)) (P : ℕ → Prop) [DecidablePred P] + (p : A R α) : + f (project (fun w => P (degree wa w)) p)=project (fun w => P (degree wb w)) (f p) := by + induction p using MonoidAlgebra.induction_on with + | of w => + change f (project _ (word w))=project _ (f (word w)) + rw [project_word,project_degree_homogeneous wb P + (algHom_homogeneous f wa wb hf (word_mem w rfl))] + split_ifs <;> simp + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +theorem algHom_piece (f : A R α →ₐ[R] A R β) (wa : α → ℕ) (wb : β → ℕ) + (hf : ∀ a,f (atom a)∈homogeneous wb (wa a)) (n : ℕ) (p : A R α) : + f (piece wa n p)=piece wb n (f p) := algHom_project f wa wb hf (fun k => k=n) p + +theorem homogeneous_reflect (f : A R α →ₐ[R] A R β) (wa : α → ℕ) (wb : β → ℕ) + (hf : ∀ a,f (atom a)∈homogeneous wb (wa a)) (hi : Function.Injective f) + {n : ℕ} {p : A R α} (hp : f p∈homogeneous wb n) : p∈homogeneous wa n := by + apply (piece_eq_self_iff wa n p).mp + apply hi + rw [algHom_piece f wa wb hf,piece_homogeneous hp,ite_eq_left rfl] + +theorem project_preserves {P Q : FreeMonoid α → Prop} [DecidablePred Q] + {p : A R α} (hp : p∈space P) : project Q p∈space P := by + apply mem_space + intro w hw + rw [project_coeff] at hw + split_ifs at hw with h + · exact (mem_space_iff.mp hp) w hw + · exact (hw rfl).elim + +theorem subtract_piece_above {wt : α → ℕ} {n : ℕ} {p : A R α} + (hp : p∈above wt n) : p-piece wt n p∈above wt (n+1) := by + apply mem_space + intro w hw + change (p-piece wt n p).coeff w≠0 at hw + simp only [MonoidAlgebra.coeff_sub,Finsupp.sub_apply] at hw + change p.coeff w-(project (fun w => degree wt w=n) p).coeff w≠0 at hw + rw [project_coeff] at hw + have hn : n≤degree wt w := by + by_contra h + have hz := coeff_support hp w h + simp [hz] at hw + by_cases he : degree wt w=n + · simp [he] at hw + · omega +end WordGrading + +namespace LieGrading +open AssociativeElimination UniversalEmbedding WordGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R α : Type*} [CommRing R] + +def treeDegree (wt : α → ℕ) (t : UniversalEmbedding.Tree α) : ℕ := (t.leaves.map wt).sum + +@[simp] theorem treeDegree_leaf (wt : α → ℕ) (a : α) : treeDegree wt (.leaf a)=wt a := by + simp [treeDegree,Tree.leaves] +@[simp] theorem treeDegree_node (wt : α → ℕ) (t u : UniversalEmbedding.Tree α) : + treeDegree wt (.node t u)=treeDegree wt t+treeDegree wt u := by + simp [treeDegree,Tree.leaves] + +theorem embed_eval_homogeneous (wt : α → ℕ) (t : UniversalEmbedding.Tree α) : + embed (t.eval : FreeLieAlgebra R α)∈homogeneous wt (treeDegree wt t) := by + induction t with + | leaf a => + simp only [Tree.eval,embed_of,treeDegree_leaf] + exact word_mem (FreeMonoid.of a) (degree_of wt a) + | node t u ht hu => + simp only [Tree.eval,treeDegree_node,LieHom.map_lie] + change embed t.eval*embed u.eval-embed u.eval*embed t.eval∈_ + exact (homogeneous _ _).sub_mem (homogeneous_mul ht hu) + (by simpa only [Nat.add_comm] using homogeneous_mul hu ht) + +def homogeneousLie (wt : α → ℕ) (n : ℕ) : Submodule R (FreeLieAlgebra R α) := + Submodule.span R {p | ∃ t : UniversalEmbedding.Tree α,treeDegree wt t=n ∧ t.eval=p} + +theorem piece_exists (wt : α → ℕ) (n : ℕ) (p : FreeLieAlgebra R α) : + ∃ q : FreeLieAlgebra R α,q∈homogeneousLie wt n ∧ embed q=piece wt n (embed p) := by + obtain ⟨k,hk⟩ := small_exists p + induction hk using Submodule.span_induction with + | mem p hp => + obtain ⟨t,_,rfl⟩ := hp + rw [piece_homogeneous (embed_eval_homogeneous (R:=R) wt t)] + split_ifs with h + · exact ⟨t.eval,Submodule.subset_span ⟨t,h,rfl⟩,rfl⟩ + · exact ⟨0,(homogeneousLie wt n).zero_mem,map_zero _⟩ + | zero => exact ⟨0,(homogeneousLie wt n).zero_mem,by simp⟩ + | add p q _ _ hp hq => + obtain ⟨p',hp',he⟩ := hp + obtain ⟨q',hq',hf⟩ := hq + exact ⟨p'+q',(homogeneousLie wt n).add_mem hp' hq',by simp only [map_add,he,hf]⟩ + | smul c p _ hp => + obtain ⟨p',hp',he⟩ := hp + exact ⟨c • p',(homogeneousLie wt n).smul_mem c hp',by simp only [map_smul,he]⟩ + +def piece (wt : α → ℕ) (n : ℕ) (p : FreeLieAlgebra R α) : FreeLieAlgebra R α := + (piece_exists wt n p).choose + +theorem piece_spec (wt : α → ℕ) (n : ℕ) (p : FreeLieAlgebra R α) : + piece wt n p∈homogeneousLie wt n ∧ embed (piece wt n p)=WordGrading.piece wt n (embed p) := + (piece_exists wt n p).choose_spec + +@[simp] theorem embed_piece (wt : α → ℕ) (n : ℕ) (p : FreeLieAlgebra R α) : + embed (piece wt n p)=WordGrading.piece wt n (embed p) := (piece_spec wt n p).2 + +theorem homogeneousLie_embed {wt : α → ℕ} {n : ℕ} {p : FreeLieAlgebra R α} + (hp : p∈homogeneousLie wt n) : embed p∈homogeneous wt n := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨t,ht,rfl⟩ := hp + simpa only [ht] using embed_eval_homogeneous (R:=R) wt t + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using (homogeneous _ _).add_mem hp hq + | smul c p _ hp => simpa only [map_smul] using (homogeneous _ _).smul_mem c hp + +theorem homogeneous_iff {wt : α → ℕ} {n : ℕ} {p : FreeLieAlgebra R α} : + p∈homogeneousLie wt n ↔ embed p∈homogeneous wt n := by + constructor + · exact homogeneousLie_embed + · intro hp + have h : piece wt n p=p := by + apply UniversalEmbedding.injective + rw [embed_piece] + exact WordGrading.project_eq_self hp + rw [← h] + exact (piece_spec wt n p).1 + +end LieGrading +end + +namespace TensorProjection +open AssociativeElimination WordGrading +open scoped TensorProduct +variable {R α β : Type*} [CommRing R] + +abbrev len {α : Type*} (w : FreeMonoid α) : ℕ := degree (fun _ => 1) w +abbrev piece {α : Type*} (n : ℕ) : A R α →ₗ[R] A R α := WordGrading.piece (fun _ => 1) n + +def totalPiece (n : ℕ) : A R α⊗[R]A R β →ₗ[R] A R α⊗[R]A R β := + ∑ i∈Finset.range (n+1),TensorProduct.map (piece i) (piece (n-i)) + +theorem totalPiece_word (n : ℕ) (u : FreeMonoid α) (v : FreeMonoid β) : + totalPiece (R:=R) n (word u⊗ₜ[R]word v)= + if len u+len v=n then word u⊗ₜ[R]word v else 0 := by + classical + simp only [totalPiece,LinearMap.sum_apply,TensorProduct.map_tmul,piece,WordGrading.piece,project_word] + change (∑ i∈Finset.range (n+1),(if len u=i then word u else 0)⊗ₜ[R] + (if len v=n-i then word v else 0))=_ + by_cases hu : len u≤n + · rw [Finset.sum_eq_single (len u)] + · simp only [ite_true] + by_cases h : len u+len v=n + · have hv : len v=n-len u := by omega + rw [ite_eq_left hv,ite_eq_left h] + · have hv : len v≠n-len u := by omega + rw [ite_eq_right hv,ite_eq_right h,TensorProduct.tmul_zero] + · intro b hb hbu + rw [ite_eq_right (Ne.symm hbu),TensorProduct.zero_tmul] + · intro h + exact False.elim (h (Finset.mem_range.mpr (by omega))) + · rw [ite_eq_right (by omega)] + apply Finset.sum_eq_zero + intro i hi + rw [ite_eq_right (by have hi' := Finset.mem_range.mp hi; omega),TensorProduct.zero_tmul] + +theorem totalPiece_homogeneous {k : ℕ} {p : A R α⊗[R]A R β} + (hp : p∈TensorGrading.homogeneous (fun _ => 1) (fun _ => 1) k) (n : ℕ) : + totalPiece n p=if k=n then p else 0 := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,v,huv,rfl⟩ := hp + change len u+len v=k at huv + rw [totalPiece_word,huv] + | zero => simp + | add p q _ _ hp hq => rw [map_add,hp,hq]; split_ifs <;> simp + | smul c p _ hp => rw [map_smul,hp]; split_ifs <;> simp + +theorem homogeneous_mul {n m : ℕ} {p q : A R α⊗[R]A R β} + (hp : p∈TensorGrading.homogeneous (fun _ => 1) (fun _ => 1) n) + (hq : q∈TensorGrading.homogeneous (fun _ => 1) (fun _ => 1) m) : + p*q∈TensorGrading.homogeneous (fun _ => 1) (fun _ => 1) (n+m) := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,v,huv,rfl⟩ := hp + induction hq using Submodule.span_induction with + | mem q hq => + obtain ⟨s,t,hst,rfl⟩ := hq + rw [Algebra.TensorProduct.tmul_mul_tmul,←word_mul,←word_mul] + apply TensorGrading.tmul_word_mem + change len u+len v=n at huv + change len s+len t=m at hst + change len (u*s)+len (v*t)=n+m + simp only [len,degree_mul] at * + omega + | zero => simp + | add q r _ _ hq hr => rw [mul_add]; exact Submodule.add_mem _ hq hr + | smul c q _ hq => rw [mul_smul_comm]; exact Submodule.smul_mem _ c hq + | zero => simp + | add p r _ _ hp hr => rw [add_mul]; exact Submodule.add_mem _ hp hr + | smul c p _ hp => rw [smul_mul_assoc]; exact Submodule.smul_mem _ c hp + +def coproduct : A R α →ₐ[R] A R α⊗[R]A R α := + AssociativeElimination.lift (fun a => atom a⊗ₜ[R]1+(1:A R α)⊗ₜ[R]atom a) + +@[simp] theorem coproduct_atom (a : α) : (coproduct (R:=R) (α:=α)) (atom (R:=R) a)=atom a⊗ₜ[R]1+(1:A R α)⊗ₜ[R]atom a := + AssociativeElimination.lift_atom _ _ + +theorem coproduct_word_homogeneous (u : FreeMonoid α) : + (coproduct (R:=R) (α:=α)) (word (R:=R) u)∈TensorGrading.homogeneous (fun _ => 1) (fun _ => 1) (len u) := by + induction u using FreeMonoid.inductionOn' with + | one => + rw [word_one,map_one] + exact TensorGrading.tmul_word_mem 1 1 (by simp [len]) + | of_mul a u ih => + rw [word_mul,word_of,map_mul,coproduct_atom] + apply homogeneous_mul _ ih + apply Submodule.add_mem + · exact TensorGrading.tmul_word_mem (FreeMonoid.of a) 1 (by simp) + · exact TensorGrading.tmul_word_mem 1 (FreeMonoid.of a) (by simp) + +theorem coproduct_piece (n : ℕ) (p : A R α) : + (coproduct (R:=R) (α:=α)) (piece n p)=totalPiece n ((coproduct (R:=R) (α:=α)) p) := by + induction p using MonoidAlgebra.induction_on with + | of u => + change (coproduct (R:=R) (α:=α)) (piece n (word u))=totalPiece n ((coproduct (R:=R) (α:=α)) (word u)) + rw [totalPiece_homogeneous (coproduct_word_homogeneous u)] + rw [piece,WordGrading.piece,project_word] + split_ifs <;> simp + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +theorem totalPiece_left (n : ℕ) (p : A R α) : totalPiece n (p⊗ₜ[R](1:A R β))=piece n p⊗ₜ[R]1 := by + induction p using MonoidAlgebra.induction_on with + | of u => + change totalPiece n (word u⊗ₜ[R]word 1)=piece n (word u)⊗ₜ[R]1 + rw [totalPiece_word] + have hz : len (1:FreeMonoid β)=0 := by simp [len] + rw [hz,Nat.add_zero] + rw [piece,WordGrading.piece,project_word] + by_cases h : len u=n + · rw [ite_eq_left h,ite_eq_left h,word_one] + · rw [ite_eq_right h,ite_eq_right h,TensorProduct.zero_tmul] + | add p q hp hq => simp only [TensorProduct.add_tmul,map_add,hp,hq] + | smul c p hp => simp only [←TensorProduct.smul_tmul',map_smul,hp] + +theorem totalPiece_right (n : ℕ) (p : A R β) : totalPiece n ((1:A R α)⊗ₜ[R]p)=1⊗ₜ[R]piece n p := by + induction p using MonoidAlgebra.induction_on with + | of v => + change totalPiece n (word 1⊗ₜ[R]word v)=1⊗ₜ[R]piece n (word v) + rw [totalPiece_word,piece,WordGrading.piece,project_word] + simp only [len,degree_one,Nat.zero_add,word_one] + split_ifs <;> simp + | add p q hp hq => simp only [TensorProduct.tmul_add,map_add,hp,hq] + | smul c p hp => simp only [TensorProduct.tmul_smul,map_smul,hp] +end TensorProjection + +namespace PrimitiveWords +open AssociativeElimination +variable {R α : Type*} [CommRing R] +attribute [local instance] LieRing.ofAssociativeRing Classical.propDecidable + +abbrev W (α : Type*) := FreeMonoid α +abbrev B (R α : Type*) [CommRing R] := MonoidAlgebra R (FreeMonoid α × FreeMonoid α) + +def word (w : W α) : A R α := MonoidAlgebra.single w 1 + +def pair (u v : W α) : B R α := MonoidAlgebra.single (u,v) 1 + +def linear {M : Type*} [AddCommGroup M] [Module R M] (f : W α → M) : A R α →ₗ[R] M := + (Finsupp.linearCombination R f).comp (MonoidAlgebra.coeffLinearEquiv R).toLinearMap + +def bilinear {M : Type*} [AddCommGroup M] [Module R M] (f : W α → W α → M) : B R α →ₗ[R] M := + (Finsupp.linearCombination R (fun p => f p.1 p.2)).comp + (MonoidAlgebra.coeffLinearEquiv R).toLinearMap + +@[simp] theorem linear_single {M : Type*} [AddCommGroup M] [Module R M] + (f : W α → M) (w : W α) (r : R) : linear f (MonoidAlgebra.single w r)=r • f w := by + change Finsupp.linearCombination R f (Finsupp.single w r) = _; simp +@[simp] theorem bilinear_single {M : Type*} [AddCommGroup M] [Module R M] + (f : W α → W α → M) (u v : W α) (r : R) : bilinear f (MonoidAlgebra.single (u,v) r)=r • f u v := by + change Finsupp.linearCombination R (fun pair => f pair.1 pair.2) (Finsupp.single (u,v) r) = _; simp + +@[simp] theorem word_one : word (R:=R) (1 : W α)=1 := rfl +@[simp] theorem word_mul (u v : W α) : word (R:=R) (u*v)=word u*word v := by + simp [word,MonoidAlgebra.single_mul_single] +@[simp] theorem pair_one : pair (R:=R) (1 : W α) 1=1 := rfl +@[simp] theorem pair_mul (u v s t : W α) : pair (R:=R) (u*s) (v*t)=pair u v*pair s t := by + simp [pair,MonoidAlgebra.single_mul_single] + +def coproduct : A R α →ₐ[R] B R α := + lift (fun a => pair (FreeMonoid.of a) 1+pair 1 (FreeMonoid.of a)) + +def left : A R α →ₗ[R] B R α := linear (fun w => pair w 1) +def right : A R α →ₗ[R] B R α := linear (fun w => pair 1 w) + +def Primitive (p : A R α) : Prop := coproduct p=left p+right p + +def antipodeWord (w : W α) : A R α := + (-1 : R)^w.toList.length • word (FreeMonoid.ofList w.toList.reverse) + +def counitConvolution : B R α →ₗ[R] A R α := bilinear (fun u v => word u*antipodeWord v) +def dynkinConvolution : B R α →ₗ[R] A R α := + bilinear (fun u v => (u.toList.length : R) • (word u*antipodeWord v)) + +@[simp] theorem antipodeWord_one : antipodeWord (R:=R) (1 : W α)=1 := by simp [antipodeWord] +theorem antipodeWord_cons (a : α) (w : W α) : + antipodeWord (R:=R) (FreeMonoid.of a*w) = -(antipodeWord w*atom a) := by + simp only [antipodeWord,FreeMonoid.toList_mul,FreeMonoid.toList_of,List.singleton_append, + List.length_cons,List.reverse_cons,pow_succ,FreeMonoid.ofList_append] + simp [word,atom,MonoidAlgebra.single_mul_single] + +@[simp] theorem coproduct_atom (a : α) : + coproduct (atom (R:=R) a)=pair (FreeMonoid.of a) 1+pair 1 (FreeMonoid.of a) := by + simp [coproduct] + +theorem counitConvolution_left (a : α) (b : B R α) : + counitConvolution (pair (FreeMonoid.of a) 1*b)=atom a*counitConvolution b := by + induction b using MonoidAlgebra.induction_linear with + | zero => simp + | add b c hb hc => simp [mul_add,hb,hc] + | single p r => + rcases p with ⟨u,v⟩ + simp only [counitConvolution,pair,MonoidAlgebra.single_mul_single, + Prod.mk_mul_mk,one_mul,bilinear_single,word_mul] + change r • ((atom a*word u)*antipodeWord v)=atom a*(r • (word u*antipodeWord v)) + rw [mul_assoc,mul_smul_comm] + +theorem counitConvolution_right (a : α) (b : B R α) : + counitConvolution (pair 1 (FreeMonoid.of a)*b)=-(counitConvolution b*atom a) := by + induction b using MonoidAlgebra.induction_linear with + | zero => simp + | add b c hb hc => simp only [mul_add,map_add,hb,hc,add_mul]; abel + | single p r => + rcases p with ⟨u,v⟩ + simp [counitConvolution,pair,MonoidAlgebra.single_mul_single,antipodeWord_cons,mul_assoc] + +theorem dynkinConvolution_left (a : α) (b : B R α) : + dynkinConvolution (pair (FreeMonoid.of a) 1*b)= + atom a*dynkinConvolution b+atom a*counitConvolution b := by + induction b using MonoidAlgebra.induction_linear with + | zero => simp + | add b c hb hc => simp only [mul_add,map_add,hb,hc]; abel + | single p r => + rcases p with ⟨u,v⟩ + simp only [dynkinConvolution,counitConvolution,pair,MonoidAlgebra.single_mul_single, + one_mul,Prod.mk_mul_mk,one_mul,bilinear_single,FreeMonoid.toList_mul, + FreeMonoid.toList_of,List.singleton_append,List.length_cons,Nat.cast_add,Nat.cast_one, + add_smul,one_smul,smul_add,word_mul] + change r • ((u.toList.length : R) • ((atom a*word u)*antipodeWord v))+ + r • ((atom a*word u)*antipodeWord v)=_ + simp only [mul_assoc,mul_smul_comm,smul_smul] + +theorem dynkinConvolution_right (a : α) (b : B R α) : + dynkinConvolution (pair 1 (FreeMonoid.of a)*b)=-(dynkinConvolution b*atom a) := by + induction b using MonoidAlgebra.induction_linear with + | zero => simp + | add b c hb hc => simp only [mul_add,map_add,hb,hc,add_mul]; abel + | single p r => + rcases p with ⟨u,v⟩ + simp [dynkinConvolution,pair,MonoidAlgebra.single_mul_single,antipodeWord_cons, + mul_assoc] + +@[simp] theorem counitConvolution_one : counitConvolution (1 : B R α)=1 := by + change bilinear _ (MonoidAlgebra.single (1,1) 1)=1 + simp +@[simp] theorem dynkinConvolution_one : dynkinConvolution (1 : B R α)=0 := by + change bilinear _ (MonoidAlgebra.single (1,1) 1)=0 + simp + +@[simp] theorem word_of (a : α) : word (R:=R) (FreeMonoid.of a)=atom a := rfl + +theorem counit_coproduct_word (w : W α) : + counitConvolution (coproduct (word (R:=R) w))=if w=1 then 1 else 0 := by + classical + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + have hne : FreeMonoid.of a*w≠1 := by + intro h + have h' := congrArg FreeMonoid.toList h + simp at h' + rw [word_mul,word_of,map_mul,coproduct_atom,add_mul,map_add, + counitConvolution_left,counitConvolution_right,ih,ite_eq_right hne] + split_ifs <;> simp + +def dynkinWord : List α → FreeLieAlgebra R α + | [] => 0 + | [a] => FreeLieAlgebra.of R a + | a::b::w => ⁅FreeLieAlgebra.of R a,dynkinWord (b::w)⁆ + +def dynkin : A R α →ₗ[R] FreeLieAlgebra R α := linear (fun w => dynkinWord w.toList) + +def euler : A R α →ₗ[R] A R α := linear (fun w => (w.toList.length : R) • word w) + +theorem dynkin_coproduct_word (w : W α) : + dynkinConvolution (coproduct (word (R:=R) w))=embed (dynkinWord w.toList) := by + classical + induction w using FreeMonoid.inductionOn' with + | one => simp [dynkinWord] + | of_mul a w ih => + rw [word_mul,word_of,map_mul,coproduct_atom,add_mul,map_add, + dynkinConvolution_left,dynkinConvolution_right,ih,counit_coproduct_word] + by_cases hw : w=1 + · subst w + simp [dynkinWord] + · rw [ite_eq_right hw,mul_zero,add_zero] + have hw' : w.toList≠[] := by + intro hh + exact hw (FreeMonoid.toList.injective hh) + have hc : dynkinWord (R:=R) (a::w.toList)= + ⁅FreeLieAlgebra.of R a,dynkinWord w.toList⁆ := by + cases h : w.toList with + | nil => exact (hw' h).elim + | cons b v => rfl + simp only [FreeMonoid.toList_mul,FreeMonoid.toList_of,List.singleton_append,hc, + LieHom.map_lie,embed_of,Ring.lie_def,sub_eq_add_neg] + +theorem dynkin_coproduct (p : A R α) : dynkinConvolution (coproduct p)=embed (dynkin p) := by + induction p using MonoidAlgebra.induction_on with + | of w => + change dynkinConvolution (coproduct (word w))=embed (dynkin (word w)) + simpa only [dynkin,word,linear_single,one_smul] using dynkin_coproduct_word (R:=R) w + | add p q hp hq => simp only [map_add,hp,hq] + | smul r p hp => simp only [map_smul,hp] + +theorem dynkin_left (p : A R α) : dynkinConvolution (left p)=euler p := by + induction p using MonoidAlgebra.induction_linear with + | zero => simp + | add p q hp hq => simp only [map_add,hp,hq] + | single w r => simp [left,linear_single,pair,dynkinConvolution,euler] + +theorem dynkin_right (p : A R α) : dynkinConvolution (right p)=0 := by + induction p using MonoidAlgebra.induction_linear with + | zero => simp + | add p q hp hq => simp only [map_add,hp,hq,add_zero] + | single w r => simp [right,linear_single,pair,dynkinConvolution] + +theorem dynkin_primitive {p : A R α} (hp : Primitive p) : embed (dynkin p)=euler p := by + rw [←dynkin_coproduct,hp,map_add,dynkin_left,dynkin_right,add_zero] + +theorem euler_homogeneous {p : A R α} {n : ℕ} + (hp : p∈WordGrading.homogeneous (fun _ => 1) n) : euler p=(n : R) • p := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + have hh : w.toList.length=n := by simpa [WordGrading.degree] using hw + simp [euler,WordGrading.word,hh,word] + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq,smul_add] + | smul r p _ hp => simp only [map_smul,hp,smul_comm r (n : R) p] + +theorem exists_lie_of_primitive {K : Type*} [Field K] [CharZero K] + {p : A K α} {n : ℕ} (hn : 0 1) n) (hp : Primitive p) : + ∃ q : FreeLieAlgebra K α, q∈LieGrading.homogeneousLie (fun _ => 1) n ∧ embed q=p := by + have hn' : (n : K)≠0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn) + have he : embed ((n : K)⁻¹ • dynkin p)=p := by + rw [map_smul,dynkin_primitive hp,euler_homogeneous hh,smul_smul,inv_mul_cancel₀ hn',one_smul] + exact ⟨(n : K)⁻¹ • dynkin p,LieGrading.homogeneous_iff.mpr (by rw [he]; exact hh),he⟩ + +end PrimitiveWords + +namespace WordCoordinates +open AssociativeElimination WordGrading +variable {R α : Type*} [CommRing R] + +def coordinates (P : FreeMonoid α → Prop) : space (R:=R) P →ₗ[R] ({w // P w} → R) where + toFun p w := p.val.coeff w.val + map_add' _ _ := by ext; simp + map_smul' _ _ := by ext; simp + +theorem coordinates_injective (P : FreeMonoid α → Prop) : Function.Injective (coordinates (R:=R) P) := by + intro p q h + apply Subtype.ext + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + by_cases hw : P w + · exact congrFun h ⟨w,hw⟩ + · rw [coeff_support p.property w hw,coeff_support q.property w hw] + +variable (P : FreeMonoid α → Prop) [Fintype {w // P w}] + +def assembly (c : {w // P w} → R) : space (R:=R) P := + ⟨∑ w, c w • word w.val,Submodule.sum_mem _ (fun w _ => (space P).smul_mem _ (word_mem _ w.property))⟩ + +theorem coordinates_assembly (c : {w // P w} → R) : coordinates P (assembly P c)=c := by + classical + ext w + change (∑ v : {w // P w},c v • word v.val).coeff w.val=c w + simp [word,Finsupp.single_apply,Subtype.val_inj] + +def equiv : space (R:=R) P ≃ₗ[R] ({w // P w} → R) := + LinearEquiv.ofBijective (coordinates P) ⟨coordinates_injective P,fun c => ⟨assembly P c,coordinates_assembly P c⟩⟩ + +@[simp] theorem equiv_apply (p : space (R:=R) P) (w : {w // P w}) : equiv P p w=p.val.coeff w.val := rfl + +instance finite_space [Module.Finite R R] : Module.Finite R (space (R:=R) P) := + Module.Finite.equiv (equiv P).symm + +variable {P} + +theorem length_le_degree (wt : α → ℕ) (hpos : ∀ a,0 simp [degree] + | of_mul a w ih => + rw [degree_mul,degree_of] + change w.toList.length+1≤wt a+degree wt w + have := hpos a + omega + +theorem letter_le_degree (wt : α → ℕ) (w : FreeMonoid α) {a : α} (ha : a∈w.toList) : + wt a≤degree wt w := by + induction w using FreeMonoid.inductionOn' with + | one => simp at ha + | of_mul b w ih => + rw [degree_mul,degree_of] + rcases List.mem_cons.mp ha with h | h + · subst a; omega + · have := ih h; omega + +theorem finite_degree (wt : α → ℕ) (hpos : ∀ a,0 FreeMonoid.ofList (l.map Subtype.val))) + intro w hw + let l : List {a // wt a≤n} := w.toList.attach.map (fun a => ⟨a.val,(letter_le_degree wt w a.property).trans_eq hw⟩) + refine ⟨l,?_,?_⟩ + · simpa [l] using (length_le_degree wt hpos w).trans_eq hw + · simp [l,List.map_map] + +theorem finite_degree_finite_alphabet [Finite α] (wt : α → ℕ) (hpos : ∀ a,0 r/(1+r)) (𝓝[>] 0) (𝓝[>] 0) := by + apply tendsto_nhdsWithin_iff.mpr + constructor + · have h : Tendsto (fun r : ℝ => r) (𝓝[>] 0) (𝓝 0) := tendsto_id.mono_left nhdsWithin_le_nhds + simpa only [Pi.div_apply,add_zero,zero_div] using! h.div ((tendsto_const_nhds (x:=(1:ℝ))).add h) (by norm_num : (1:ℝ)+0≠0) + · filter_upwards [self_mem_nhdsWithin] with r hr + change 0 gauge (-Y) r*transport (bulkForm X Y) r F.cutoff (bulkEndpoint r)*gauge X r) + (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have hh := regularizedBulk_two_limit F hX hY tendsto_id bulkScale_limit + have ht := (gauge_ratio_limit (-Y)).mul hh + simp only [one_mul] at ht + apply ht.congr' + filter_upwards [self_mem_nhdsWithin] with r hr + change 0 transport (arcForm X Y r) 0 N 1- + transport (fun _ => angular • X) 0 N 1) := by + let C := 2*Real.pi*‖Y‖ + let L := Real.pi*‖X‖+C + apply transport_perturbation_powerSmall (L:=fun _ => L) (E:=fun r => C*r) + ?_ (const_subpower L) (linear_powerSmall C) N + filter_upwards [self_mem_nhdsWithin,(eventually_lt_nhds (by norm_num : (0:ℝ)<1/2)).filter_mono nhdsWithin_le_nhds] with r hr hr1 + have hc := arcForm_continuousOn X Y hr (by linarith : r<1) + have hb := norm_arcForm_sub_le X Y hr hr1.le + have hC : 0≤C := by dsimp [C]; positivity + have he : C*r≤C := mul_le_of_le_one_right hC (by linarith) + have hX : ‖angular • X‖=Real.pi*‖X‖ := by rw [norm_smul,norm_angular] + refine ⟨by norm_num,hc.intervalIntegrable_of_Icc (by norm_num),intervalIntegrable_const, + by dsimp [L]; positivity,mul_nonneg hC hr.le,?_,?_,?_⟩ + · apply mass_bound hc + intro t ht + have hh := norm_le_norm_add_norm_sub (angular • X) (arcForm X Y r t) + rw [hX,norm_sub_rev] at hh + exact hh.trans (add_le_add le_rfl ((hb t).trans he)) + · apply mass_bound continuousOn_const + intro t ht + rw [hX] + exact le_add_of_nonneg_right hC + · exact mass_bound (hc.sub continuousOn_const) (fun t _ => hb t) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem gauge_exp_smul_commute (X : A) (r : ℝ) (c : ℂ) : + Commute (gauge X r) (NormedSpace.exp (c • X)) := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + exact (((Commute.refl X).smul_left (Real.log r)).smul_right c).exp_left.exp_right + +theorem arc_normalized_limit (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) : + Tendsto (fun r => gauge (-X) r*transport (arcForm X Y r) 0 F.cutoff 1*gauge X r) + (𝓝[>] 0) (𝓝 (NormedSpace.exp (angular • X))) := by + have hX' : X∈F.space 1 := by simpa using hX 1 + have hn := pow_cutoff_eq_zero F hX' + have hneg := pow_cutoff_eq_zero F ((F.space 1).neg_mem hX') + have herr := normalized_perturbation_limit (arc_transport_error X Y F.cutoff) + (gauge_subpower hneg) (gauge_subpower hn) + have hc := constant_transport F (hX angular) + have he : ∀ r,gauge (-X) r*transport (fun _ => angular • X) 0 F.cutoff 1*gauge X r= + NormedSpace.exp (angular • X) := by + intro r + have hcmt := gauge_exp_smul_commute (-X) r (-angular) + simp only [neg_smul,smul_neg,neg_neg] at hcmt + rw [hc,hcmt.eq] + rw [mul_assoc,gauge_neg_mul,mul_one] + simp only [he] at herr + have hh := herr.add_const (NormedSpace.exp (angular • X)) + simpa only [sub_add_cancel,zero_add] using hh + +end + +open Set Filter FinitePicard KZCollar +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem normalized_cycle (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) (hY : ∀ c : ℂ,c • Y∈F.space 1) + {r : ℝ} (hr : 0 gauge (-X) r*v*gauge X r) h + simpa only [mul_assoc,one_mul,gauge_neg_mul] using hh + +theorem associator_hexagon (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) (hY : ∀ c : ℂ,c • Y∈F.space 1) : + NormedSpace.exp (angular • X)*associator F (-X-Y) X* + NormedSpace.exp (angular • (-X-Y))*associator F Y (-X-Y)* + NormedSpace.exp (angular • Y)*associator F X Y=1 := by + have hX' : X∈F.space 1 := by simpa using hX 1 + have hY' : Y∈F.space 1 := by simpa using hY 1 + have hZ : ∀ c : ℂ,c • (-X-Y)∈F.space 1 := by + intro c + rw [smul_sub,smul_neg] + exact (F.space 1).sub_mem ((F.space 1).neg_mem (hX c)) (hY c) + have hZ' : -X-Y∈F.space 1 := by simpa using hZ 1 + have ht := (((((arc_normalized_limit F hX (Y:=Y)).mul + (bulk_normalized_limit F hZ' hX')).mul (arc_normalized_limit F hZ (Y:=X))).mul + (bulk_normalized_limit F hY' hZ')).mul (arc_normalized_limit F hY (Y:=-X-Y))).mul + (bulk_normalized_limit F hX' hY') + apply tendsto_nhds_unique ht + apply tendsto_const_nhds.congr' + filter_upwards [self_mem_nhdsWithin, + (eventually_lt_nhds (by norm_num : (0:ℝ)<1/2)).filter_mono nhdsWithin_le_nhds] with r hr hr1 + exact (normalized_cycle F hX hY hr hr1).symm + +end ComplexKZ + +namespace PairedHexagon +variable {G : Type*} [Group G] + + theorem meridian (a b c P Q R : G) + (hp : a*R*c*Q*b*P=1) (hm : a⁻¹*R*c⁻¹*Q*b⁻¹*P=1) : + R*c^2*R⁻¹=a⁻¹*(P⁻¹*b^2*P)⁻¹*a⁻¹ := by + have h₁ : R*c*Q=a⁻¹*P⁻¹*b⁻¹ := by + calc R*c*Q=a⁻¹*(a*R*c*Q*b*P)*P⁻¹*b⁻¹ := by group + _=a⁻¹*P⁻¹*b⁻¹ := by rw [hp]; group + have h₂ : R*c⁻¹*Q=a*P⁻¹*b := by + calc R*c⁻¹*Q=a*(a⁻¹*R*c⁻¹*Q*b⁻¹*P)*P⁻¹*b := by group + _=a*P⁻¹*b := by rw [hm]; group + calc R*c^2*R⁻¹=(R*c*Q)*(R*c⁻¹*Q)⁻¹ := by rw [pow_two]; group + _=(a⁻¹*P⁻¹*b⁻¹)*(a*P⁻¹*b)⁻¹ := by rw [h₁,h₂] + _=a⁻¹*(P⁻¹*b^2*P)⁻¹*a⁻¹ := by group + + theorem compared_meridian (θ : G →* G) (a b c P Q R V W T : G) + (hp : a*R*c*Q*b*P=1) (hm : a⁻¹*R*c⁻¹*Q*b⁻¹*P=1) + (hv : a*T*c*W*b*V=1) (hn : a⁻¹*T*c⁻¹*W*b⁻¹*V=1) + (ha : θ a=a) (hb : θ (P⁻¹*b^2*P)=V⁻¹*b^2*V) : + θ (R*c^2*R⁻¹)=T*c^2*T⁻¹ := by + rw [meridian a b c P Q R hp hm, map_mul,map_mul,map_inv,ha,map_inv,hb, + meridian a b c V W T hv hn] + + theorem compared_middle (θ : G →* G) (a b c P Q R V W T U H : G) + (hp : a*R*c*Q*b*P=1) (hv : a*T*c*W*b*V=1) + (ha : θ a=a) (hb : θ b=U⁻¹*b*U) (hc : θ c=H⁻¹*c*H) + (hP : U*θ P=V) (hR : θ R=T*H) : + H*θ Q*U⁻¹=W := by + have hh := congrArg θ hp + simp only [map_mul,map_one,ha,hb,hc,hR] at hh + have he : a*T*c*(H*θ Q*U⁻¹)*b*V=1 := by + rw [←hP] + convert hh using 1; group + have heq : a*T*c*(H*θ Q*U⁻¹)*b*V=a*T*c*W*b*V := he.trans hv.symm + exact mul_left_cancel (mul_right_cancel (mul_right_cancel heq)) +end PairedHexagon + +namespace NilpotentExp +open FinitePicard KZCollar +variable {A B : Type*} [NormedRing A] [NormedAlgebra ℝ A] + + theorem power_difference (F : NilpotentFiltration A) {a b : A} + (ha : a∈F.space 1) (hb : b∈F.space 1) {n : ℕ} (hd : a-b∈F.space n) (k : ℕ) : + a^(k+1)-b^(k+1)∈F.space (n+k) := by + induction k with + | zero => simpa only [Nat.zero_add,pow_one,Nat.add_zero] using hd + | succ k ih => + have he : a^(k+1+1)-b^(k+1+1)=(a-b)*b^(k+1)+a*(a^(k+1)-b^(k+1)) := by + simp only [pow_succ',sub_mul,mul_sub] + abel + rw [he] + apply (F.space (n+(k+1))).add_mem + · exact F.mul_mem n (k+1) hd (pow_mem F hb (k+1)) + · simpa only [show 1+(n+k)=n+(k+1) by omega] using F.mul_mem 1 (n+k) ha ih + + theorem exp_linear (F : NilpotentFiltration A) {a : A} (ha : a∈F.space 1) : + NormedSpace.exp a=1+a+∑ i∈Finset.range (F.cutoff+1), + (((i+2).factorial:ℝ)⁻¹) • a^(i+2) := by + have hz : a^(F.cutoff+2+1)=0 := pow_eq_zero_of_le (by omega) (pow_cutoff_eq_zero F ha) + have hh := exp_smul_finite a hz 1 + simp only [one_smul,one_pow,one_div] at hh + rw [Finset.sum_range_succ',Finset.sum_range_succ'] at hh + simp only [pow_zero,pow_one,Nat.factorial_zero,Nat.factorial_one,Nat.cast_one, + inv_one,one_smul,Nat.zero_add] at hh + simp only [show ∀ k : ℕ,k+1+1=k+2 from fun k => by omega] at hh + rw [hh] + abel + + theorem exp_difference (F : NilpotentFiltration A) {a b : A} + (ha : a∈F.space 1) (hb : b∈F.space 1) {n : ℕ} (hd : a-b∈F.space n) : + NormedSpace.exp a-NormedSpace.exp b-(a-b)∈F.space (n+1) := by + rw [exp_linear F ha,exp_linear F hb] + have he : 1+a+(∑ i∈Finset.range (F.cutoff+1),(((i+2).factorial:ℝ)⁻¹) • a^(i+2))- + (1+b+(∑ i∈Finset.range (F.cutoff+1),(((i+2).factorial:ℝ)⁻¹) • b^(i+2)))-(a-b)= + ∑ i∈Finset.range (F.cutoff+1),(((i+2).factorial:ℝ)⁻¹) • (a^(i+2)-b^(i+2)) := by + simp only [smul_sub,Finset.sum_sub_distrib] + abel + rw [he] + apply Submodule.sum_mem + intro i hi + apply (F.space (n+1)).smul_mem + exact F.antitone (by omega : n+1≤n+(i+1)) (power_difference F ha hb hd (i+1)) + + theorem injective (F : NilpotentFiltration A) {a b : A} + (ha : a∈F.space 1) (hb : b∈F.space 1) (he : NormedSpace.exp a=NormedSpace.exp b) : a=b := by + have hh : ∀ n,a-b∈F.space (n+1) := by + intro n + induction n with + | zero => exact (F.space 1).sub_mem ha hb + | succ n ih => + have hc := exp_difference F ha hb ih + rw [he,sub_self,zero_sub] at hc + exact (F.space (n+1+1)).neg_mem_iff.mp hc + have ht := hh F.cutoff + simpa only [F.terminal,Submodule.mem_bot,sub_eq_zero] using ht + +variable [NormedRing B] [NormedAlgebra ℝ B] + theorem map_exp (f : A →ₐ[ℝ] B) {a : A} {N : ℕ} (ha : a^(N+1)=0) : + f (NormedSpace.exp a)=NormedSpace.exp (f a) := by + have hb : (f a)^(N+1)=0 := by rw [←map_pow,ha,map_zero] + have h₁ := exp_smul_finite a ha 1 + have h₂ := exp_smul_finite (f a) hb 1 + simp only [one_smul] at h₁ h₂ + rw [h₁,h₂,map_sum] + apply Finset.sum_congr rfl + intro i hi + rw [map_smul,map_pow] +end NilpotentExp + +namespace HexagonUnits +open FinitePicard KZCollar +variable {A : Type*} [NormedRing A] [NormedAlgebra ℂ A] [CompleteSpace A] [FiniteDimensional ℝ A] + +local instance : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℂ A + +def exp (a : A) : Aˣ := (NormedSpace.isUnit_exp a).unit +omit [FiniteDimensional ℝ A] in +@[simp] theorem exp_val (a : A) : (exp a:A)=NormedSpace.exp a := (NormedSpace.isUnit_exp a).unit_spec +omit [FiniteDimensional ℝ A] in +@[simp] theorem exp_neg (a : A) : exp (-a)=(exp a)⁻¹ := by + apply Units.ext + rw [exp_val] + rw [←Ring.inverse_exp,←exp_val,Ring.inverse_unit] + +def phi (F : NilpotentFiltration A) {X Y : A} (hX : X∈F.space 1) (hY : Y∈F.space 1) : Aˣ := + (associator_isUnit F hX hY).unit +@[simp] theorem phi_val (F : NilpotentFiltration A) {X Y : A} (hX : X∈F.space 1) (hY : Y∈F.space 1) : + (phi F hX hY:A)=associator F X Y := (associator_isUnit F hX hY).unit_spec + +theorem phi_swap (F : NilpotentFiltration A) {X Y : A} (hX : X∈F.space 1) (hY : Y∈F.space 1) : + phi F hY hX=(phi F hX hY)⁻¹ := by + apply Units.ext + rw [phi_val,associator_swap F hX hY,←phi_val F hX hY,Ring.inverse_unit] + +theorem positive (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) (hY : ∀ c : ℂ,c • Y∈F.space 1) + (hX' : X∈F.space 1) (hY' : Y∈F.space 1) (hZ : -X-Y∈F.space 1) : + exp (ComplexKZ.angular • X)*phi F hZ hX'*exp (ComplexKZ.angular • (-X-Y))* + phi F hY' hZ*exp (ComplexKZ.angular • Y)*phi F hX' hY'=1 := by + apply Units.ext + simpa only [Units.val_mul,exp_val,phi_val,Units.val_one] using + ComplexKZ.associator_hexagon F hX hY + +theorem negative (F : NilpotentFiltration A) {X Y : A} + (hX : ∀ c : ℂ,c • X∈F.space 1) (hY : ∀ c : ℂ,c • Y∈F.space 1) + (hX' : X∈F.space 1) (hY' : Y∈F.space 1) (hZ : -X-Y∈F.space 1) : + (exp (ComplexKZ.angular • X))⁻¹*phi F hZ hX'*(exp (ComplexKZ.angular • (-X-Y)))⁻¹* + phi F hY' hZ*(exp (ComplexKZ.angular • Y))⁻¹*phi F hX' hY'=1 := by + have hz : -Y-X= -X-Y := by abel + have hh := positive F hY hX hY' hX' (hz.symm ▸ hZ) + simp only [hz,phi_swap F hX' hY',phi_swap F hY' hZ,phi_swap F hZ hX'] at hh + have hi := congrArg (fun u : Aˣ => (phi F hX' hY')⁻¹*u⁻¹*phi F hX' hY') hh + convert hi using 1 <;> group + + omit [FiniteDimensional ℝ A] in + theorem exp_square (a : A) : ((exp a)^2:Aˣ)=exp ((2:ℝ) • a) := by + apply Units.ext + simp only [pow_two,Units.val_mul,exp_val,show (2:ℝ) • a=a+a from by simpa using (two_smul ℝ a), + NormedSpace.exp_add_of_commute (Commute.refl a)] + + theorem exp_map (f : A →ₐ[ℝ] A) (a : A) : Units.map f.toMonoidHom (exp a)=exp (f a) := by + apply Units.ext + change f (exp a:A)=(exp (f a):A) + rw [exp_val,exp_val] + exact NormedSpace.map_exp f f.toLinearMap.toContinuousLinearMap.continuous a + + omit [FiniteDimensional ℝ A] in + theorem exp_conj (u : Aˣ) (a : A) : exp ((u:A)*a*((u⁻¹:Aˣ):A))=u*exp a*u⁻¹ := by + apply Units.ext + simp only [Units.val_mul,exp_val,NormedSpace.exp_units_conj] +end HexagonUnits + +namespace ComplexCutoff +open AssociativeElimination +variable {α : Type*} [Finite α] +variable (P : Set (A ℂ α)) (N : ℕ) + +instance normedRing : NormedRing (TruncatedWords.Q P N) := + FiniteAlgebraNorm.normedRingOver ℂ _ +instance normedAlgebraComplex : NormedAlgebra ℂ (TruncatedWords.Q P N) := + FiniteAlgebraNorm.normedAlgebraOver ℂ _ +instance normedAlgebraReal : NormedAlgebra ℝ (TruncatedWords.Q P N) := + NormedAlgebra.complexToReal +instance finiteReal : FiniteDimensional ℝ (TruncatedWords.Q P N) := + Module.Finite.trans ℂ (TruncatedWords.Q P N) + +def filtration : FinitePicard.NilpotentFiltration (TruncatedWords.Q P N) where + space n := (TruncatedWords.filtration P N n).restrictScalars ℝ + antitone := TruncatedWords.filtration_antitone P N + one_mem := TruncatedWords.filtration_one P N + mul_mem := TruncatedWords.filtration_mul P N + cutoff := N + terminal := by rw [TruncatedWords.filtration_terminal]; rfl + +end ComplexCutoff + +namespace ComplexComparison + +section +open CutoffDepth HexagonUnits +abbrev F (N : ℕ) := ComplexCutoff.filtration (∅ : Set (AssociativeElimination.A ℂ Bool)) N +abbrev X (N : ℕ) : Q ℂ N := gen N false +abbrev Y (N : ℕ) : Q ℂ N := gen N true +abbrev Z (N : ℕ) : Q ℂ N := -X N-Y N + +theorem xm (N : ℕ) : X N∈(F N).space 1 := gen_weight N false +theorem ym (N : ℕ) : Y N∈(F N).space 1 := gen_weight N true +theorem zm (N : ℕ) : Z N∈(F N).space 1 := ((F N).space 1).sub_mem (((F N).space 1).neg_mem (xm N)) (ym N) +theorem xc (N : ℕ) (c : ℂ) : c • X N∈(F N).space 1 := + (TruncatedWords.filtration ∅ N 1).smul_mem c (gen_weight (R:=ℂ) N false) +theorem yc (N : ℕ) (c : ℂ) : c • Y N∈(F N).space 1 := + (TruncatedWords.filtration ∅ N 1).smul_mem c (gen_weight (R:=ℂ) N true) + +def P (N : ℕ) : (Q ℂ N)ˣ := phi (F N) (xm N) (ym N) +def Qq (N : ℕ) : (Q ℂ N)ˣ := phi (F N) (ym N) (zm N) +def Rr (N : ℕ) : (Q ℂ N)ˣ := phi (F N) (zm N) (xm N) +def V (N : ℕ) : (Q ℂ N)ˣ := phi (F N) (((F N).space 1).neg_mem (xm N)) (((F N).space 1).neg_mem (ym N)) +def W (N : ℕ) : (Q ℂ N)ˣ := phi (F N) (((F N).space 1).neg_mem (ym N)) (((F N).space 1).neg_mem (zm N)) +def T (N : ℕ) : (Q ℂ N)ˣ := phi (F N) (((F N).space 1).neg_mem (zm N)) (((F N).space 1).neg_mem (xm N)) +abbrev a (N : ℕ) := exp (ComplexKZ.angular • X N) +abbrev b (N : ℕ) := exp (ComplexKZ.angular • Y N) +abbrev c (N : ℕ) := exp (ComplexKZ.angular • Z N) + +theorem p_hex (N : ℕ) : a N*Rr N*c N*Qq N*b N*P N=1 := + positive (F N) (xc N) (yc N) (xm N) (ym N) (zm N) +theorem p_hex_neg (N : ℕ) : (a N)⁻¹*Rr N*(c N)⁻¹*Qq N*(b N)⁻¹*P N=1 := + negative (F N) (xc N) (yc N) (xm N) (ym N) (zm N) + +theorem v_hex (N : ℕ) : a N*T N*c N*W N*b N*V N=1 := by + have hx : ∀ s : ℂ,s • (-X N)∈(F N).space 1 := fun s => by + rw [smul_neg]; exact ((F N).space 1).neg_mem (xc N s) + have hy : ∀ s : ℂ,s • (-Y N)∈(F N).space 1 := fun s => by + rw [smul_neg]; exact ((F N).space 1).neg_mem (yc N s) + have hz : -(-X N)-(-Y N)= -Z N := by dsimp [Z]; abel + have hh := negative (F N) hx hy (((F N).space 1).neg_mem (xm N)) + (((F N).space 1).neg_mem (ym N)) (hz.symm ▸ ((F N).space 1).neg_mem (zm N)) + simpa only [hz,smul_neg,exp_neg,inv_inv,a,b,c,T,W,V] using hh + +theorem v_hex_neg (N : ℕ) : (a N)⁻¹*T N*(c N)⁻¹*W N*(b N)⁻¹*V N=1 := by + have hx : ∀ s : ℂ,s • (-X N)∈(F N).space 1 := fun s => by + rw [smul_neg]; exact ((F N).space 1).neg_mem (xc N s) + have hy : ∀ s : ℂ,s • (-Y N)∈(F N).space 1 := fun s => by + rw [smul_neg]; exact ((F N).space 1).neg_mem (yc N s) + have hz : -(-X N)-(-Y N)= -Z N := by dsimp [Z]; abel + have hh := positive (F N) hx hy (((F N).space 1).neg_mem (xm N)) + (((F N).space 1).neg_mem (ym N)) (hz.symm ▸ ((F N).space 1).neg_mem (zm N)) + simpa only [hz,smul_neg,exp_neg,a,b,c,T,W,V] using hh + +theorem P_weight (N : ℕ) : (P N:Q ℂ N)-1∈TruncatedWords.filtration ∅ N 1 := by + change (phi (F N) (xm N) (ym N):Q ℂ N)-1∈(F N).space 1 + rw [phi_val] + exact KZCollar.associator_sub_one_mem (F N) + (by apply Submodule.ext; intro u; change u∈TruncatedWords.filtration ∅ N 0 ↔ True + rw [TruncatedSubstitution.filtration_initial]; simp only [Submodule.mem_top]) (xm N) (ym N) +theorem V_weight (N : ℕ) : (V N:Q ℂ N)-1∈TruncatedWords.filtration ∅ N 1 := by + change (phi (F N) _ _:Q ℂ N)-1∈(F N).space 1 + rw [phi_val] + exact KZCollar.associator_sub_one_mem (F N) + (by apply Submodule.ext; intro u; change u∈TruncatedWords.filtration ∅ N 0 ↔ True + rw [TruncatedSubstitution.filtration_initial]; simp only [Submodule.mem_top]) + (((F N).space 1).neg_mem (xm N)) (((F N).space 1).neg_mem (ym N)) + +def theta (N : ℕ) : Q ℂ N ≃ₐ[ℂ] Q ℂ N := ConjugateComparison.theta N (P N) (V N) (P_weight N) (V_weight N) +def U (N : ℕ) : (Q ℂ N)ˣ := ConjugateComparison.unitArrow N (P N) (V N) (P_weight N) (V_weight N) +def H (N : ℕ) : (Q ℂ N)ˣ := (T N)⁻¹*Units.map (theta N).toMonoidHom (Rr N) + +theorem theta_x (N : ℕ) : theta N (X N)=X N := ConjugateComparison.theta_x N _ _ _ _ +theorem theta_y (N : ℕ) : theta N (Y N)=((U N)⁻¹:(Q ℂ N)ˣ)*Y N*(U N:Q ℂ N) := + ConjugateComparison.theta_y N _ _ _ _ +theorem U_compare (N : ℕ) : U N*Units.map (theta N).toMonoidHom (P N)=V N := by + unfold U ConjugateComparison.unitArrow theta + group + +theorem H_compare (N : ℕ) : Units.map (theta N).toMonoidHom (Rr N)=T N*H N := by + unfold H + group + +def realMap (N : ℕ) : CutoffDepth.Q ℝ N →ₐ[ℝ] Q ℂ N := + NilpotentFreeLift.eval (F N) (gen N) (gen_weight N) +@[simp] theorem realMap_gen (N : ℕ) (i : Bool) : realMap N (gen N i)=gen N i := + NilpotentFreeLift.eval_gen _ _ _ i + +theorem positive_realMap (N : ℕ) : Units.map (realMap N).toMonoidHom (KZComparison.positive N)=P N := by + apply Units.ext + change realMap N (KZComparison.positive N:CutoffDepth.Q ℝ N)=(P N:Q ℂ N) + rw [KZComparison.positive_val] + change _=(phi (F N) (xm N) (ym N):Q ℂ N) + simp only [CutoffKZ.X,CutoffKZ.Y] + rw [phi_val] + have hh := KZCollar.map_associator (realMap N) (CutoffKZ.weight N) (F N) rfl + (gen_weight (R:=ℝ) N false) (gen_weight (R:=ℝ) N true) + change realMap N (KZCollar.associator (CutoffKZ.weight N) (gen N false) (gen N true))= + KZCollar.associator (F N) (realMap N (gen N false)) (realMap N (gen N true)) at hh + rw [realMap_gen,realMap_gen] at hh + exact hh + +theorem negative_realMap (N : ℕ) : Units.map (realMap N).toMonoidHom (KZComparison.negative N)=V N := by + apply Units.ext + change realMap N (KZComparison.negative N:CutoffDepth.Q ℝ N)=(V N:Q ℂ N) + rw [KZComparison.negative_val] + change _=(phi (F N) _ _:Q ℂ N) + simp only [CutoffKZ.X,CutoffKZ.Y] + rw [phi_val] + have hh := KZCollar.map_associator (realMap N) (CutoffKZ.weight N) (F N) rfl + (((CutoffKZ.weight N).space 1).neg_mem (gen_weight (R:=ℝ) N false)) + (((CutoffKZ.weight N).space 1).neg_mem (gen_weight (R:=ℝ) N true)) + change realMap N (KZCollar.associator (CutoffKZ.weight N) (-gen N false) (-gen N true))= + KZCollar.associator (F N) (realMap N (-gen N false)) (realMap N (-gen N true)) at hh + rw [map_neg,map_neg,realMap_gen,realMap_gen] at hh + exact hh + +theorem theta_exp (N : ℕ) (u : Q ℂ N) : + Units.map (theta N).toMonoidHom (exp u)=exp (theta N u) := + exp_map ((theta N).toAlgHom.restrictScalars ℝ) u + +theorem exp_smul_conj (N : ℕ) (s : ℂ) (u : (Q ℂ N)ˣ) (v : Q ℂ N) : + exp (s • ((u:Q ℂ N)*v*((u⁻¹:(Q ℂ N)ˣ):Q ℂ N)))=u*exp (s • v)*u⁻¹ := by + rw [←smul_mul_assoc,←mul_smul_comm,exp_conj] + +theorem theta_a (N : ℕ) : Units.map (theta N).toMonoidHom (a N)=a N := by + rw [a,theta_exp,map_smul,theta_x] + +theorem theta_b (N : ℕ) : Units.map (theta N).toMonoidHom (b N)=(U N)⁻¹*b N*U N := by + rw [b,theta_exp,map_smul,theta_y] + simpa only [inv_inv] using exp_smul_conj N ComplexKZ.angular (U N)⁻¹ (Y N) + +theorem theta_meridian_y (N : ℕ) : + Units.map (theta N).toMonoidHom ((P N)⁻¹*(b N)^2*P N)=(V N)⁻¹*(b N)^2*V N := by + rw [map_mul,map_mul,map_inv,map_pow,theta_b,←U_compare N] + simp only [pow_two] + group + +theorem theta_meridian_z (N : ℕ) : + Units.map (theta N).toMonoidHom ((c N)^2)=(H N)⁻¹*(c N)^2*H N := by + have hh := PairedHexagon.compared_meridian (Units.map (theta N).toMonoidHom) + (a N) (b N) (c N) (P N) (Qq N) (Rr N) (V N) (W N) (T N) + (p_hex N) (p_hex_neg N) (v_hex N) (v_hex_neg N) (theta_a N) (theta_meridian_y N) + simp only [map_mul,map_inv,H_compare] at hh + have hi := congrArg (fun u : (Q ℂ N)ˣ => (H N)⁻¹*(T N)⁻¹*u*T N*H N) hh + convert hi using 1 <;> group + +theorem conj_weight (N n : ℕ) (u : (Q ℂ N)ˣ) {v : Q ℂ N} + (hv : v∈TruncatedWords.filtration ∅ N n) : + (u:Q ℂ N)*v*((u⁻¹:(Q ℂ N)ˣ):Q ℂ N)∈TruncatedWords.filtration ∅ N n := by + simpa only [Nat.zero_add,Nat.add_zero] using TruncatedWords.filtration_mul ∅ N (0+n) 0 + (TruncatedWords.filtration_mul ∅ N 0 n (ConjugateComparison.mem_zero N (u:Q ℂ N)) hv) + (ConjugateComparison.mem_zero N ((u⁻¹:(Q ℂ N)ˣ):Q ℂ N)) + +theorem theta_z (N : ℕ) : theta N (Z N)=((H N)⁻¹:(Q ℂ N)ˣ)*Z N*(H N:Q ℂ N) := by + let s : ℂ := ComplexKZ.angular+ComplexKZ.angular + have hs : s≠0 := by + have ha : ComplexKZ.angular≠0 := by + intro h + have hn := ComplexKZ.norm_angular + rw [h,norm_zero] at hn + exact Real.pi_ne_zero hn.symm + dsimp [s] + intro h + apply ha + have h2 : (2:ℂ)*ComplexKZ.angular=0 := by linear_combination h + exact (mul_eq_zero.mp h2).resolve_left (by norm_num) + have hc : (c N)^2=exp (s • Z N) := by + rw [c,exp_square,two_smul ℝ,←add_smul] + have hh := theta_meridian_z N + rw [hc,theta_exp,map_smul] at hh + have he : exp (s • theta N (Z N))= + exp (s • (((H N)⁻¹:(Q ℂ N)ˣ)*Z N*(H N:Q ℂ N))) := by + rw [hh] + have hh := exp_smul_conj N s (H N)⁻¹ (Z N) + simpa only [inv_inv] using hh.symm + have hv := congrArg Units.val he + simp only [exp_val] at hv + have h₁ : s • theta N (Z N)∈(F N).space 1 := + (TruncatedWords.filtration ∅ N 1).smul_mem s + (ConjugateComparison.theta_preserves N (P N) (V N) (P_weight N) (V_weight N) 1 (Z N) (zm N)) + have h₂ : s • (((H N)⁻¹:(Q ℂ N)ˣ)*Z N*(H N:Q ℂ N))∈(F N).space 1 := + (TruncatedWords.filtration ∅ N 1).smul_mem s + (by simpa only [inv_inv] using conj_weight N 1 (H N)⁻¹ (zm N)) + exact smul_right_injective (Q ℂ N) hs (NilpotentExp.injective (F N) h₁ h₂ hv) + +theorem theta_c (N : ℕ) : Units.map (theta N).toMonoidHom (c N)=(H N)⁻¹*c N*H N := by + rw [c,theta_exp,map_smul,theta_z] + simpa only [inv_inv] using exp_smul_conj N ComplexKZ.angular (H N)⁻¹ (Z N) + +theorem middle_compare (N : ℕ) : H N*Units.map (theta N).toMonoidHom (Qq N)*(U N)⁻¹=W N := + PairedHexagon.compared_middle (Units.map (theta N).toMonoidHom) + (a N) (b N) (c N) (P N) (Qq N) (Rr N) (V N) (W N) (T N) (U N) (H N) + (p_hex N) (v_hex N) (theta_a N) (theta_b N) (theta_c N) (U_compare N) (H_compare N) + +def rho (N : ℕ) : Q ℂ N →ₐ[ℂ] Q ℂ N := + TruncatedSubstitution.subst N (fun i => if i then Z N else Y N) + (fun i => by cases i; exact ym N; exact zm N) +@[simp] theorem rho_x (N : ℕ) : rho N (X N)=Y N := TruncatedSubstitution.subst_gen N _ _ false +@[simp] theorem rho_y (N : ℕ) : rho N (Y N)=Z N := TruncatedSubstitution.subst_gen N _ _ true +@[simp] theorem rho_z (N : ℕ) : rho N (Z N)=X N := by + rw [Z,map_sub,map_neg,rho_x,rho_y] + dsimp [Z] + abel + +theorem rho_three (N : ℕ) (u : Q ℂ N) : rho N (rho N (rho N u))=u := by + have hh : (rho N).comp ((rho N).comp (rho N))=AlgHom.id ℂ (Q ℂ N) := by + apply TruncatedSubstitution.hom_ext N + intro i + cases i + · change rho N (rho N (rho N (X N)))=X N + rw [rho_x,rho_y,rho_z] + · change rho N (rho N (rho N (Y N)))=Y N + rw [rho_y,rho_z,rho_x] + exact AlgHom.congr_fun hh u + +theorem rho_phi (N : ℕ) {x y : Q ℂ N} + (hx : x∈(F N).space 1) (hy : y∈(F N).space 1) + (hrx : rho N x∈(F N).space 1) (hry : rho N y∈(F N).space 1) : + Units.map (rho N).toMonoidHom (phi (F N) hx hy)=phi (F N) hrx hry := by + apply Units.ext + change rho N (phi (F N) hx hy:Q ℂ N)=(phi (F N) hrx hry:Q ℂ N) + rw [phi_val,phi_val] + exact KZCollar.map_associator ((rho N).restrictScalars ℝ) (F N) (F N) rfl hx hy + +theorem rho_P (N : ℕ) : Units.map (rho N).toMonoidHom (P N)=Qq N := by + have hh := rho_phi N (xm N) (ym N) (by rw [rho_x]; exact ym N) (by rw [rho_y]; exact zm N) + simpa only [rho_x,rho_y,P,Qq,X,Y] using hh + +theorem rho_Q (N : ℕ) : Units.map (rho N).toMonoidHom (Qq N)=Rr N := by + have hh := rho_phi N (ym N) (zm N) (by rw [rho_y]; exact zm N) (by rw [rho_z]; exact xm N) + simpa only [rho_y,rho_z,Qq,Rr,X,Y] using hh + +theorem rho_R (N : ℕ) : Units.map (rho N).toMonoidHom (Rr N)=P N := by + have hh := rho_phi N (zm N) (xm N) (by rw [rho_z]; exact xm N) (by rw [rho_x]; exact ym N) + simpa only [rho_z,rho_x,Rr,P,X,Y] using hh + +theorem rho_V (N : ℕ) : Units.map (rho N).toMonoidHom (V N)=W N := by + have hh := rho_phi N (((F N).space 1).neg_mem (xm N)) (((F N).space 1).neg_mem (ym N)) + (by rw [map_neg,rho_x]; exact ((F N).space 1).neg_mem (ym N)) + (by rw [map_neg,rho_y]; exact ((F N).space 1).neg_mem (zm N)) + simpa only [map_neg,rho_x,rho_y,V,W,X,Y] using hh + +theorem rho_W (N : ℕ) : Units.map (rho N).toMonoidHom (W N)=T N := by + have hh := rho_phi N (((F N).space 1).neg_mem (ym N)) (((F N).space 1).neg_mem (zm N)) + (by rw [map_neg,rho_y]; exact ((F N).space 1).neg_mem (zm N)) + (by rw [map_neg,rho_z]; exact ((F N).space 1).neg_mem (xm N)) + simpa only [map_neg,rho_y,rho_z,W,T,X,Y] using hh + +theorem rho_T (N : ℕ) : Units.map (rho N).toMonoidHom (T N)=V N := by + have hh := rho_phi N (((F N).space 1).neg_mem (zm N)) (((F N).space 1).neg_mem (xm N)) + (by rw [map_neg,rho_z]; exact ((F N).space 1).neg_mem (xm N)) + (by rw [map_neg,rho_x]; exact ((F N).space 1).neg_mem (ym N)) + simpa only [map_neg,rho_z,rho_x,T,V,X,Y] using hh + + theorem transport_y (N : ℕ) (p : (Q ℂ N)ˣ) (hp : (p:Q ℂ N)-1∈TruncatedWords.filtration ∅ N 1) : + ConjugateComparison.transport N p hp (Y N)=UnitConjugation.hom (R:=ℂ) p⁻¹ (Y N) := by + change ConjugateComparison.transport N p hp (TruncatedSubstitution.gen N true)=_ + rw [ConjugateComparison.transport_gen,ConjugateComparison.family,UnitConjugation.hom_apply,inv_inv] + rfl + +theorem rho_theta (N : ℕ) (u : Q ℂ N) : + rho N (theta N u)=UnitConjugation.hom (R:=ℂ) (U N) (theta N (rho N u)) := by + let τ := ConjugateComparison.transport N (P N) (P_weight N) + have he : ((rho N).comp (theta N).toAlgHom).comp τ.toAlgHom= + ((UnitConjugation.hom (R:=ℂ) (U N)).comp ((theta N).toAlgHom.comp (rho N))).comp τ.toAlgHom := by + apply TruncatedSubstitution.hom_ext N + intro i + cases i + · change rho N (theta N (τ (X N)))=UnitConjugation.hom (R:=ℂ) (U N) (theta N (rho N (τ (X N)))) + have hτ : τ (X N)=X N := ConjugateComparison.transport_gen N _ _ false + rw [hτ,theta_x,rho_x,theta_y] + simp only [UnitConjugation.hom_apply,mul_assoc,Units.mul_inv_cancel_left,Units.mul_inv,mul_one] + · change rho N (theta N (τ (Y N)))=UnitConjugation.hom (R:=ℂ) (U N) (theta N (rho N (τ (Y N)))) + have h₁ : theta N (τ (Y N))=ConjugateComparison.transport N (V N) (V_weight N) (Y N) := + ConjugateComparison.theta_transport N _ _ _ _ _ + rw [h₁,transport_y,UnitConjugation.natural,map_inv,rho_V,rho_y] + change UnitConjugation.hom (R:=ℂ) (W N)⁻¹ (Z N)=_ + rw [show τ (Y N)=UnitConjugation.hom (R:=ℂ) (P N)⁻¹ (Y N) from transport_y N _ _, + UnitConjugation.natural,map_inv,rho_P,rho_y] + rw [show theta N (UnitConjugation.hom (R:=ℂ) (Qq N)⁻¹ (Z N))= + UnitConjugation.hom (R:=ℂ) (Units.map (theta N).toMonoidHom ((Qq N)⁻¹)) (theta N (Z N)) from + UnitConjugation.natural (theta N).toAlgHom (Qq N)⁻¹ (Z N),map_inv] + have hz : theta N (Z N)=UnitConjugation.hom (R:=ℂ) (H N)⁻¹ (Z N) := by + simpa only [UnitConjugation.hom_apply,inv_inv] using theta_z N + rw [hz,←UnitConjugation.mul_apply,←UnitConjugation.mul_apply] + have hm : U N*(Units.map (theta N).toMonoidHom (Qq N))⁻¹*(H N)⁻¹=(W N)⁻¹ := by + rw [←middle_compare N] + group + rw [hm] + obtain ⟨v,rfl⟩ := τ.surjective u + exact AlgHom.congr_fun he v + +theorem rho_theta_unit (N : ℕ) (u : (Q ℂ N)ˣ) : + Units.map (rho N).toMonoidHom (Units.map (theta N).toMonoidHom u)= + U N*Units.map (theta N).toMonoidHom (Units.map (rho N).toMonoidHom u)*(U N)⁻¹ := by + apply Units.ext + exact rho_theta N (u:Q ℂ N) + +theorem rho_U (N : ℕ) : Units.map (rho N).toMonoidHom (U N)=H N*(U N)⁻¹ := by + change Units.map (rho N).toMonoidHom (V N*(Units.map (theta N).toMonoidHom (P N))⁻¹)=_ + rw [map_mul,map_inv,rho_V,rho_theta_unit,rho_P,←middle_compare N] + group + +theorem rho_H (N : ℕ) : Units.map (rho N).toMonoidHom (H N)=(U N)⁻¹ := by + rw [H,map_mul,map_inv,rho_T,rho_theta_unit,rho_R,←U_compare N] + group + +end + +section +open CutoffDepth + +def cycle : Fin 3 → Fin 3 := ![1,2,0] +def frames (N : ℕ) : Fin 3 → (Q ℂ N)ˣ := ![1,U N,H N] +def rationalWeight (N n : ℕ) : Submodule ℚ (Q ℂ N) := + (TruncatedWords.filtration ∅ N n).restrictScalars ℚ + +theorem rationalWeight_initial (N : ℕ) : rationalWeight N 0=⊤ := by + apply Submodule.ext + intro u + change u∈TruncatedWords.filtration ∅ N 0 ↔ True + rw [TruncatedSubstitution.filtration_initial] + simp only [Submodule.mem_top] +theorem rationalWeight_terminal (N : ℕ) : rationalWeight N (N+2)=⊥ := by + apply eq_bot_iff.mpr + intro u hu + have hh := TruncatedWords.filtration_antitone ∅ N (show N+1≤N+2 by omega) hu + simpa only [TruncatedWords.filtration_terminal,Submodule.mem_bot] using hh + +theorem U_weight (N : ℕ) : (U N:Q ℂ N)-1∈TruncatedWords.filtration ∅ N 1 := + ConjugateComparison.unitArrow_normalized N _ _ _ _ + +theorem H_weight (N : ℕ) : (H N:Q ℂ N)-1∈TruncatedWords.filtration ∅ N 1 := by + have he : H N=Units.map (rho N).toMonoidHom (U N)*U N := by rw [rho_U]; group + rw [he] + apply ConjugateComparison.mul_normalized N _ _ _ (U_weight N) + have hh := TruncatedSubstitution.subst_preserves N + (fun i => if i then Z N else Y N) (fun i => by cases i; exact ym N; exact zm N) + 1 ((U N:Q ℂ N)-1) (U_weight N) + change rho N ((U N:Q ℂ N)-1)∈_ at hh + change rho N (U N:Q ℂ N)-1∈_ + simpa only [map_sub,map_one] using hh + +theorem frames_weight (N : ℕ) (p : Fin 3) : (frames N p:Q ℂ N)-1∈rationalWeight N 1 := by + fin_cases p + · change (1:Q ℂ N)-1∈_ + simp only [sub_self,Submodule.zero_mem] + · exact U_weight N + · exact H_weight N + +def category (N : ℕ) : LogCategory.Data (Q ℂ N) (Fin 3) := + GaugeAutomorphism.data ((theta N).restrictScalars ℚ) (frames N) (rationalWeight N) (N+1) + (TruncatedWords.filtration_antitone ∅ N) (rationalWeight_initial N) (rationalWeight_terminal N) + (TruncatedWords.filtration_mul ∅ N) + (ConjugateComparison.theta_raises N (P N) (V N) (P_weight N) (V_weight N)) (frames_weight N) + +def value (N : ℕ) : Q ℂ N := LogCategory.delta (category N) 0 1 1 + +theorem rho_frames (N : ℕ) (p : Fin 3) : + Units.map (rho N).toMonoidHom (frames N p)=frames N (cycle p)*(U N)⁻¹ := by + fin_cases p + · simp [frames,cycle] + · exact rho_U N + · change Units.map (rho N).toMonoidHom (H N)=1*(U N)⁻¹ + simpa only [one_mul] using rho_H N + +theorem category_rotate (N : ℕ) (p q : Fin 3) (u : Q ℂ N) : + rho N ((category N).S p q u)=(category N).S (cycle p) (cycle q) (rho N u) := by + have hf (p : Fin 3) : rho N (frames N p:Q ℂ N)=(frames N (cycle p)*(U N)⁻¹:(Q ℂ N)ˣ) := + congrArg Units.val (rho_frames N p) + have hi (p : Fin 3) : rho N (((frames N p)⁻¹:(Q ℂ N)ˣ):Q ℂ N)= + ((frames N (cycle p)*(U N)⁻¹)⁻¹:(Q ℂ N)ˣ) := + congrArg (fun v => ((v⁻¹:(Q ℂ N)ˣ):Q ℂ N)) (rho_frames N p) + simp only [category,GaugeAutomorphism.data,GaugeAutomorphism.map_apply, + AlgEquiv.restrictScalars_apply,map_mul,hf,hi,rho_theta,UnitConjugation.hom_apply, + Units.val_mul,mul_inv_rev,inv_inv,mul_assoc,Units.inv_mul_cancel_left] + +theorem delta_rotate (N : ℕ) (p q : Fin 3) (u : Q ℂ N) : + rho N (LogCategory.delta (category N) p q u)= + LogCategory.delta (category N) (cycle p) (cycle q) (rho N u) := by + exact OperatorLog.logarithm_natural (category N).N + ((category N).S p q-1) ((category N).S (cycle p) (cycle q)-1) + ((rho N).toLinearMap.restrictScalars ℚ) (by + intro v + change rho N ((category N).S p q v-v)=_ + rw [map_sub,category_rotate] + rfl) u + +theorem value_cyclic (N : ℕ) : value N+rho N (value N)+rho N (rho N (value N))=0 := by + have h₁ : rho N (value N)=LogCategory.delta (category N) 1 2 1 := by + simpa only [value,cycle,Matrix.cons_val_zero,Matrix.cons_val_one,map_one] using delta_rotate N 0 1 1 + have h₂ : rho N (rho N (value N))=LogCategory.delta (category N) 2 0 1 := by + rw [h₁,delta_rotate,map_one] + rfl + have ha := LogCategory.unit_cocycle (category N) 0 1 2 + have hb := LogCategory.unit_cocycle (category N) 0 2 0 + rw [LogCategory.delta_one_loop] at hb + change value N+_+_=0 + rw [h₂,h₁] + change LogCategory.delta (category N) 0 1 1+_+_=0 + rw [add_comm (LogCategory.delta (category N) 0 1 1),←ha,add_comm] + exact hb.symm +end + +open CutoffDepth ConjugateComparison WordGrading + +theorem transport_realMap (N : ℕ) (p : (Q ℝ N)ˣ) (q : (Q ℂ N)ˣ) + (hp : (p:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hq : (q:Q ℂ N)-1∈TruncatedWords.filtration ∅ N 1) + (h : Units.map (realMap N).toMonoidHom p=q) (u : Q ℝ N) : + realMap N (transport N p hp u)=transport N q hq (realMap N u) := by + have hv : realMap N (p:Q ℝ N)=(q:Q ℂ N) := congrArg Units.val h + have hi : realMap N ((p⁻¹:(Q ℝ N)ˣ):Q ℝ N)=((q⁻¹:(Q ℂ N)ˣ):Q ℂ N) := + congrArg (fun v => ((v⁻¹:(Q ℂ N)ˣ):Q ℂ N)) h + have he : (realMap N).comp (transport N p hp).toAlgHom= + ((transport N q hq).restrictScalars ℝ).toAlgHom.comp (realMap N) := by + apply TruncatedSubstitution.hom_ext N + intro b + change realMap N (transport N p hp (gen N b))=transport N q hq (realMap N (gen N b)) + rw [ConjugateCoalgebra.transport_cutoff_gen,realMap_gen] + have hqg := transport_gen N q hq b + change transport N q hq (gen N b)=_ at hqg + rw [hqg] + cases b + · exact realMap_gen N false + · change realMap N (((p⁻¹:(Q ℝ N)ˣ):Q ℝ N)*gen N true*(p:Q ℝ N))=_ + rw [map_mul,map_mul,hi,hv,realMap_gen] + rfl + exact AlgHom.congr_fun he u + +theorem theta_realMap (N : ℕ) (u : Q ℝ N) : + realMap N (KZComparison.theta N u)=theta N (realMap N u) := by + change realMap N (ConjugateComparison.theta N _ _ _ _ u)=ConjugateComparison.theta N _ _ _ _ (realMap N u) + rw [ConjugateComparison.theta,AlgEquiv.trans_apply, + transport_realMap N _ _ (KZComparison.negative_weight N) (V_weight N) (negative_realMap N)] + have hh := ConjugateCoalgebra.natural_inverse (realMap N) + (transport N (KZComparison.positive N) (KZComparison.positive_weight N)) + ((transport N (P N) (P_weight N)).restrictScalars ℝ) + (transport_realMap N _ _ (KZComparison.positive_weight N) (P_weight N) (positive_realMap N)) u + rw [hh] + rfl + +theorem arrow_realMap (N : ℕ) : Units.map (realMap N).toMonoidHom (KZComparison.arrow N)=U N := by + have ht : Units.map (realMap N).toMonoidHom + (Units.map (KZComparison.theta N).toMonoidHom (KZComparison.positive N))= + Units.map (theta N).toMonoidHom (P N) := by + apply Units.ext + change realMap N (KZComparison.theta N (KZComparison.positive N:Q ℝ N))=_ + rw [theta_realMap,show realMap N (KZComparison.positive N:Q ℝ N)=(P N:Q ℂ N) from congrArg Units.val (positive_realMap N)] + rfl + change Units.map (realMap N).toMonoidHom (KZComparison.negative N* + (Units.map (KZComparison.theta N).toMonoidHom (KZComparison.positive N))⁻¹)=_ + rw [map_mul,map_inv,negative_realMap,ht] + rfl + +theorem S_realMap (N : ℕ) (u : Q ℝ N) : + realMap N ((KZComparison.category N).S false true u)=(category N).S 0 1 (realMap N u) := by + simp only [KZComparison.category,GaugeAutomorphism.data,GaugeAutomorphism.map_apply, + KZComparison.frames,inv_one,Units.val_one,mul_one] + change realMap N ((KZComparison.arrow N:Q ℝ N)*KZComparison.theta N u)=_ + rw [map_mul,theta_realMap,show realMap N (KZComparison.arrow N:Q ℝ N)=(U N:Q ℂ N) from congrArg Units.val (arrow_realMap N)] + simp only [category,GaugeAutomorphism.data,GaugeAutomorphism.map_apply,frames, + Matrix.cons_val_zero,Matrix.cons_val_one,inv_one,Units.val_one,mul_one] + rfl + +theorem value_realMap (N : ℕ) : realMap N (KZComparison.value N)=value N := by + have hh := OperatorLog.logarithm_natural (N+1) ((KZComparison.category N).S false true-1) + ((category N).S 0 1-1) ((realMap N).toLinearMap.restrictScalars ℚ) (by + intro u + change realMap N ((KZComparison.category N).S false true u-u)=_ + rw [map_sub,S_realMap] + rfl) 1 + change realMap N (KZComparison.value N)=OperatorLog.logarithm (N+1) _ (realMap N 1) at hh + rw [map_one] at hh + exact hh + +open AssociativeElimination + +theorem realMap_word (N : ℕ) (w : FreeMonoid Bool) : + realMap N (TruncatedWords.quotient ∅ N (word (R:=ℝ) w))= + TruncatedWords.quotient ∅ N (word (R:=ℂ) w) := by + induction w using FreeMonoid.inductionOn' with + | one => simp only [word_one,map_one] + | of_mul a w ih => + rw [word_mul,word_mul,word_of,word_of,map_mul,map_mul,map_mul,ih] + change realMap N (gen N a)*_=gen N a*_ + rw [realMap_gen] + +theorem realMap_coefficient (N : ℕ) (w : FreeMonoid Bool) (u : Q ℝ N) : + TruncatedFree.coefficient N w (realMap N u)= + ((TruncatedFree.coefficient (R:=ℝ) N w u):ℂ) := by + classical + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective ℝ (TruncatedWords.relations (∅:Set (A ℝ Bool)) N) u + change TruncatedFree.coefficient N w (realMap N (TruncatedWords.quotient ∅ N p))= + ((TruncatedFree.coefficient (R:=ℝ) N w (TruncatedWords.quotient ∅ N p)):ℂ) + induction p using MonoidAlgebra.induction_on with + | of v => + change TruncatedFree.coefficient N w (realMap N (TruncatedWords.quotient ∅ N (word v)))= + ((TruncatedFree.coefficient (R:=ℝ) N w (TruncatedWords.quotient ∅ N (word v))):ℂ) + rw [realMap_word,TruncatedFree.coefficient_quotient,TruncatedFree.coefficient_quotient] + simp only [word,MonoidAlgebra.coeff_single,Finsupp.single_apply] + split_ifs <;> simp + | add p q hp hq => simp only [map_add,hp,hq,Complex.ofReal_add] + | smul c p hp => + rw [map_smul,map_smul,LinearMap.map_smul_of_tower,hp] + rw [map_smul (TruncatedFree.coefficient (R:=ℝ) N w)] + simp only [Complex.real_smul,smul_eq_mul,Complex.ofReal_mul] + +theorem realMap_injective (N : ℕ) : Function.Injective (realMap N) := by + intro u v huv + apply (TruncatedFree.equiv (R:=ℝ) (α:=Bool) N).injective + apply Subtype.ext + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + have hh := congrArg (TruncatedFree.coefficient N w) huv + rw [realMap_coefficient,realMap_coefficient] at hh + exact Complex.ofReal_injective hh + +def realRotateFamily (N : ℕ) (b : Bool) : Q ℝ N := + if b then -gen N false-gen N true else gen N true + +theorem realRotateFamily_mem (N : ℕ) (b : Bool) : + realRotateFamily N b∈(CutoffKZ.weight N).space 1 := by + cases b + · exact gen_weight (R:=ℝ) N true + · exact ((CutoffKZ.weight N).space 1).sub_mem + (((CutoffKZ.weight N).space 1).neg_mem (gen_weight (R:=ℝ) N false)) (gen_weight (R:=ℝ) N true) + +def realRotate (N : ℕ) : Q ℝ N →ₐ[ℝ] Q ℝ N := + NilpotentFreeLift.eval (CutoffKZ.weight N) (realRotateFamily N) (realRotateFamily_mem N) + +@[simp] theorem realRotate_gen (N : ℕ) (b : Bool) : realRotate N (gen N b)=realRotateFamily N b := + NilpotentFreeLift.eval_gen _ _ _ b + +theorem rotate_realMap (N : ℕ) (u : Q ℝ N) : realMap N (realRotate N u)=rho N (realMap N u) := by + have he : (realMap N).comp (realRotate N)=((rho N).restrictScalars ℝ).comp (realMap N) := by + apply TruncatedSubstitution.hom_ext N + intro b + change realMap N (realRotate N (gen N b))=rho N (realMap N (gen N b)) + rw [realMap_gen,realRotate_gen] + cases b + · change realMap N (gen N true)=_ + rw [realMap_gen] + exact (rho_x N).symm + · change realMap N (-gen N false-gen N true)=_ + rw [map_sub,map_neg,realMap_gen,realMap_gen] + exact (rho_y N).symm + exact AlgHom.congr_fun he u + +theorem real_value_cyclic (N : ℕ) : KZComparison.value N+realRotate N (KZComparison.value N)+ + realRotate N (realRotate N (KZComparison.value N))=0 := by + apply realMap_injective N + rw [map_add,map_add,map_zero,rotate_realMap,rotate_realMap,rotate_realMap,value_realMap] + exact value_cyclic N +end ComplexComparison + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Holonomy.lean b/lean/OAI/Algebra/Drinfeld/Holonomy.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ff008abfc95b16f62249a4a45f0c6b87f296665 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Holonomy.lean @@ -0,0 +1,1326 @@ +import OAI.Algebra.Drinfeld.Boundary + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +namespace StraightKZ +open MeasureTheory Set Filter FinitePicard KZRectangle LogRectangle +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +theorem connection_continuousOn (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + {X : Type*} [TopologicalSpace X] {z v : X → Fin 4 → ℝ} {S : Set X} + (hz : ∀ i,ContinuousOn (fun x => z x i) S) (hv : ∀ i,ContinuousOn (fun x => v x i) S) + (hn : ∀ x∈S,Function.Injective (z x)) : + ContinuousOn (fun x => j (KZFlat.connection (z x) (v x))) S := by + simp only [←form_eq] + apply LogRectangle.continuousOn_form (chords j) + · intro i + exact (hz _).sub (hz _) + · intro i + exact (hv _).sub (hv _) + · intro x hx i + exact dif_ne_zero _ (hn x hx) i + +theorem segment_connection_continuousOn (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + {p : Fin 4 → ℝ} {q : ℝ → Fin 4 → ℝ} {a b : ℝ} + (hp : StrictMono p) (hq : ∀ s∈Icc a b,StrictMono (q s)) + (hqc : ∀ i,ContinuousOn (fun s => q s i) (Icc a b)) : + ContinuousOn (fun w : ℝ×ℝ => connection j p (q w.1) w.2) (Icc a b ×ˢ Icc 0 1) := by + have hq2 (i : Fin 4) : ContinuousOn (fun w : ℝ×ℝ => q w.1 i) (Icc a b ×ˢ Icc 0 1) := + (hqc i).comp continuous_fst.continuousOn (fun w hw => hw.1) + apply connection_continuousOn j + · intro i + exact ((continuousOn_const.sub continuous_snd.continuousOn).mul continuousOn_const).add + (continuous_snd.continuousOn.mul (hq2 i)) + · intro i + exact (hq2 i).sub continuousOn_const + · intro w hw + exact (segment_strictMono hp (hq w.1 hw.1) hw.2).injective + +theorem fundamental_continuousOn (F : NilpotentFiltration A) + (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + {p : Fin 4 → ℝ} {q : ℝ → Fin 4 → ℝ} {a b : ℝ} (hab : a≤b) + (hp : StrictMono p) (hq : ∀ s∈Icc a b,StrictMono (q s)) + (hqc : ∀ i,ContinuousOn (fun s => q s i) (Icc a b)) : + ContinuousOn (fun s => fundamental F j p (q s)) (Icc a b) := + continuousOn_transport_parameter (Ω:=fun s t => connection j p (q s) t) (by norm_num) hab (segment_connection_continuousOn j hp hq hqc) F.cutoff + +theorem fundamental_refl (F : NilpotentFiltration A) + (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (p : Fin 4 → ℝ) : fundamental F j p p=1 := by + have hh : connection j p p=(fun _ => 0) := by + funext t + have hv : velocity p p=0 := by ext; simp [velocity] + simp only [connection,hv,zero_connection] + simp only [fundamental,hh,transport,Finset.sum_range_succ',term_succ,zero_mul, + intervalIntegral.integral_zero,Finset.sum_const_zero,term_zero,zero_add] + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem transport_eq_ratio (F : NilpotentFiltration A) + (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (hc : ∀ i,chords j i∈F.space 1) + {p : Fin 4 → ℝ} {q q' : ℝ → Fin 4 → ℝ} {a b : ℝ} (hab : a q s i) (Icc a b)) + (hqc' : ∀ i,ContinuousOn (fun s => q' s i) (Icc a b)) + (hqd : ∀ s∈Ioo a b,∀ i,HasDerivAt (fun s => q s i) (q' s i) s) : + transport (fun s => j (KZFlat.connection (q s) (q' s))) a F.cutoff b= + fundamental F j p (q b)*Ring.inverse (fundamental F j p (q a)) := by + have hcon := connection_continuousOn j hqc hqc' (fun s hs => (hq s hs).injective) + apply transport_eq_fundamental F (fun _ => connection_mem F j hc _ _) hab + (hcon.intervalIntegrable_of_Icc hab.le) (hcon.mono Ioo_subset_Icc_self) + (fun s hs => fundamental_derivative F j hc hp hq hqc hqc' hqd hs) + (fundamental_continuousOn F j hab.le hp hq hqc) + (fun s hs => fundamental_isUnit F j hc _ _) + +theorem fundamental_ratio (F : NilpotentFiltration A) + (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (hc : ∀ i,chords j i∈F.space 1) + {p q r : Fin 4 → ℝ} (hp : StrictMono p) (hq : StrictMono q) (hr : StrictMono r) : + fundamental F j q r=fundamental F j p r*Ring.inverse (fundamental F j p q) := by + have h := transport_eq_ratio F j hc (q:=segment q r) (q':=fun _ => velocity q r) + (by norm_num : (0:ℝ)<1) hp (fun s hs => segment_strictMono hq hr hs) + (fun i => ((continuousOn_const.sub continuousOn_id).mul continuousOn_const).add + (continuousOn_id.mul continuousOn_const)) + (fun i => continuousOn_const) (fun s hs i => segment_derivative q r s i) + simpa only [segment_zero,segment_one,fundamental,connection] using! h + +theorem fundamental_comp (F : NilpotentFiltration A) + (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (hc : ∀ i,chords j i∈F.space 1) + {p q r : Fin 4 → ℝ} (hp : StrictMono p) (hq : StrictMono q) (hr : StrictMono r) : + fundamental F j q r*fundamental F j p q=fundamental F j p r := by + rw [fundamental_ratio F j hc hp hq hr,mul_assoc, + Ring.inverse_mul_cancel _ (fundamental_isUnit F j hc p q),mul_one] + +end StraightKZ + +namespace FourFrames +open MeasureTheory Set Filter FinitePicard KZCollar FourCollar KZRectangle StraightKZ +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def point (x y : ℝ) : Fin 4 → ℝ := ![0,x,y,1] +def speed (vx vy : ℝ) : Fin 4 → ℝ := ![0,vx,vy,0] +def path (i : Fin 5) (s : ℝ) : Fin 4 → ℝ := point (cx i s) (cy i s) +def tangent (i : Fin 5) (s : ℝ) : Fin 4 → ℝ := speed (vx i s) (vy i s) + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem point_strictMono {x y : ℝ} (h : 0 path i s k) (tangent i s k) s := by + rcases coordinates_derivative i s with ⟨hx,hy⟩ + fin_cases k + · exact hasDerivAt_const s 0 + · exact hx + · exact hy + · exact hasDerivAt_const s 1 + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem path_continuous (i : Fin 5) (k : Fin 4) : Continuous (fun s => path i s k) := + continuous_iff_continuousAt.mpr (fun s => (path_derivative i s k).continuousAt) + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem tangent_continuous (i : Fin 5) (k : Fin 4) : Continuous (fun s => tangent i s k) := by + fin_cases k + · exact continuous_const + · change Continuous (vx i) + fin_cases i + · exact continuous_const.mul continuous_id + · exact continuous_const + · exact continuous_const.sub (continuous_const.mul continuous_id) + · exact continuous_const.mul continuous_id + · exact continuous_const + · change Continuous (vy i) + fin_cases i + · exact continuous_const + · exact continuous_const.add (continuous_const.mul continuous_id) + · exact continuous_const + · exact continuous_const.mul continuous_id + · exact continuous_const.mul continuous_id + · exact continuous_const + +theorem form_eq (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) (x y vx vy : ℝ) : + j (KZFlat.connection (point x y) (speed vx vy))= + FourCollar.form (chords j 0) (chords j 1) (chords j 3) (chords j 4) (chords j 5) x y vx vy := by + simp only [KZFlat.connection,KZFlat.combine,map_add,map_smul] + change ((0-vx) / (0-x)) • j (GenericBraid.t 0 1)+((0-vy) / (0-y)) • j (GenericBraid.t 0 2)+ + ((0-0) / (0-1:ℝ)) • j (GenericBraid.t 0 3)+((vx-vy)/(x-y)) • j (GenericBraid.t 1 2)+ + ((vx-0)/(x-1)) • j (GenericBraid.t 1 3)+((vy-0)/(y-1)) • j (GenericBraid.t 2 3)= + (vx/x) • j (GenericBraid.t 0 1)+(vy/y) • j (GenericBraid.t 0 2)+ + ((vy-vx)/(y-x)) • j (GenericBraid.t 1 2)+(vx/(x-1)) • j (GenericBraid.t 1 3)+ + (vy/(y-1)) • j (GenericBraid.t 2 3) + simp only [zero_sub,sub_zero,neg_div_neg_eq,zero_div,zero_smul,add_zero] + have h : (vx-vy)/(x-y)=(vy-vx)/(y-x) := by + rw [←neg_sub vy vx,←neg_sub y x,neg_div_neg_eq] + rw [h] + +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) [CompleteSpace A] [FiniteDimensional ℝ A] + +def radial (i : Fin 5) : ℝ → A := + normalized F (a:=chords j 0) (b:=chords j 1) (d:=chords j 3) (e:=chords j 4) (f:=chords j 5) i + +include hc in +theorem radial_derivative (i : Fin 5) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + HasDerivAt (radial F j i) + (j (KZFlat.connection (path i s) (tangent i s))*radial F j i s) s := by + rw [path,tangent,form_eq] + exact normalized_derivative F (hc 0) (hc 1) (hc 3) (hc 4) (hc 5) i hs + +include hc in +theorem radial_isUnit (i : Fin 5) (s : ℝ) : IsUnit (radial F j i s) := + normalized_isUnit F (hc 0) (hc 1) (hc 3) (hc 4) (hc 5) i s + +include hc in +theorem fundamental_path_derivative {p : Fin 4 → ℝ} (hp : StrictMono p) + (i : Fin 5) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + HasDerivAt (fun s => fundamental F j p (path i s)) + (j (KZFlat.connection (path i s) (tangent i s))*fundamental F j p (path i s)) s := by + apply fundamental_derivative F j hc (a:=s/2) (b:=(s+1/4)/2) hp + · intro t ht + apply path_strictMono i + exact ⟨by linarith [hs.1,ht.1],by linarith [hs.2,ht.2]⟩ + · intro k + exact (path_continuous i k).continuousOn + · intro k + exact (tangent_continuous i k).continuousOn + · intro t ht k + exact path_derivative i t k + · exact ⟨by linarith [hs.1],by linarith [hs.2]⟩ + +def corner (p : Fin 4 → ℝ) (i : Fin 5) : A := + Ring.inverse (fundamental F j p (path i (1/8)))*radial F j i (1/8) + +include hc in +theorem corner_eq {p : Fin 4 → ℝ} (hp : StrictMono p) (i : Fin 5) + {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + Ring.inverse (fundamental F j p (path i s))*radial F j i s=corner F j p i := by + exact transition_constant (fun t ht => fundamental_path_derivative F j hc hp i ht) + (fun t ht => radial_derivative F j hc i ht) + (fun _ _ => fundamental_isUnit F j hc _ _) hs (by norm_num : (1/8:ℝ)∈Ioo 0 (1/4)) + +include hc in +theorem corner_isUnit (p : Fin 4 → ℝ) (i : Fin 5) : IsUnit (corner F j p i) := +by + have hu := fundamental_isUnit F j hc p (path i (1/8)) + rw [corner,Ring.inverse_of_isUnit hu] + exact (hu.unit⁻¹).isUnit.mul (radial_isUnit F j hc i _) + +include hc in +theorem radial_eq {p : Fin 4 → ℝ} (hp : StrictMono p) (i : Fin 5) + {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + radial F j i s=fundamental F j p (path i s)*corner F j p i := by + rw [←corner_eq F j hc hp i hs,←mul_assoc, + Ring.mul_inverse_cancel _ (fundamental_isUnit F j hc _ _),one_mul] + +include hc in + +theorem corner_cocycle (p : Fin 4 → ℝ) (i k l : Fin 5) : + (Ring.inverse (corner F j p i)*corner F j p k)* + (Ring.inverse (corner F j p k)*corner F j p l)= + Ring.inverse (corner F j p i)*corner F j p l := by + rw [mul_assoc,←mul_assoc (corner F j p k), + Ring.mul_inverse_cancel _ (corner_isUnit F j hc p k),one_mul] + +end FourFrames + +section +namespace PowerAsymptotic +open Set Filter FinitePicard KZCollar Asymptotics +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +omit [NormedAlgebra ℝ A] in +theorem PowerSmall.add {f g : ℝ → A} (hf : PowerSmall f) (hg : PowerSmall g) : + PowerSmall (fun s => f s+g s) := by + obtain ⟨p,hp,hf⟩ := hf + obtain ⟨q,hq,hg⟩ := hg + have hd (u v : ℝ) (hvu : v ≤ u) : + (fun s : ℝ => s^u) =O[𝓝[>] 0] (fun s : ℝ => s^v) := by + apply IsBigO.of_norm_eventuallyLE + filter_upwards [Ioc_mem_nhdsGT (by norm_num : (0:ℝ)<1)] with s hs + rw [Real.norm_of_nonneg (Real.rpow_nonneg hs.1.le _)] + exact Real.rpow_le_rpow_of_exponent_ge hs.1 hs.2 hvu + exact ⟨min p q,lt_min hp hq,(hf.trans (hd p _ (min_le_left _ _))).add + (hg.trans (hd q _ (min_le_right _ _)))⟩ + +omit [NormedAlgebra ℝ A] in +theorem PowerSmall.subpower {f : ℝ → A} (hf : PowerSmall f) : Subpower f := + tendsto_subpower hf.tendsto_zero + +omit [NormedAlgebra ℝ A] in +theorem subpower_of_sub {f g : ℝ → A} (hg : Subpower g) + (hf : PowerSmall (fun s => f s-g s)) : Subpower f := by + simpa only [sub_add_cancel] using! hf.subpower.add hg + +omit [NormedAlgebra ℝ A] in +theorem frame_replacement (f l l₀ r r₀ : ℝ → A) + (hf : Subpower f) (hl₀ : Subpower l₀) (hr₀ : Subpower r₀) + (hl : PowerSmall (fun s => l s-l₀ s)) (hr : PowerSmall (fun s => r s-r₀ s)) : + PowerSmall (fun s => l s*f s*r s-l₀ s*f s*r₀ s) := by + have h := ((hl.mul_subpower hf).mul_subpower (subpower_of_sub hr₀ hr)).add + ((hl₀.mul hf).mul_powerSmall hr) + apply h.congr + intro s + simp only [sub_mul,mul_sub] + abel + +end PowerAsymptotic +namespace FourFrames +open Set Filter FinitePicard KZCollar FourCollar KZRectangle PowerAsymptotic +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) [CompleteSpace A] [FiniteDimensional ℝ A] + +def model (i : Fin 5) (s : ℝ) : A := + gauge (residue (chords j 0) (chords j 1) (chords j 3) (chords j 4) (chords j 5) i) s + +def inverseModel (i : Fin 5) (s : ℝ) : A := + gauge (-residue (chords j 0) (chords j 1) (chords j 3) (chords j 4) (chords j 5) i) s + +include hc in +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem radial_error (i : Fin 5) : PowerSmall (fun s => radial F j i s-model j i s) := + solution_sub_gauge F (residue_mem F (hc 0) (hc 1) (hc 3) (hc 4) (hc 5) i) + (by norm_num : (0:ℝ)<1/4) (remainder_continuous _ _ _ _ _ i) + +include hc in +theorem inverse_radial_error (i : Fin 5) : + PowerSmall (fun s => Ring.inverse (radial F j i s)-inverseModel j i s) := + inverse_solution_sub_gauge F (residue_mem F (hc 0) (hc 1) (hc 3) (hc 4) (hc 5) i) + (remainder_mem F (hc 0) (hc 1) (hc 3) (hc 4) (hc 5) i) + (by norm_num : (0:ℝ)<1/4) (remainder_continuous _ _ _ _ _ i) + +include hc in +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem model_subpower (i : Fin 5) : Subpower (model j i) := + gauge_subpower (pow_cutoff_eq_zero F (residue_mem F (hc 0) (hc 1) (hc 3) (hc 4) (hc 5) i)) + +include hc in +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem inverseModel_subpower (i : Fin 5) : Subpower (inverseModel j i) := + gauge_subpower (pow_cutoff_eq_zero F ((F.space 1).neg_mem (residue_mem F (hc 0) (hc 1) (hc 3) (hc 4) (hc 5) i))) + +include hc in +theorem radial_replacement (i k : Fin 5) {f : ℝ → A} (hf : Subpower f) : + PowerSmall (fun s => Ring.inverse (radial F j k s)*f s*radial F j i s- + inverseModel j k s*f s*model j i s) := + frame_replacement f _ _ _ _ hf (inverseModel_subpower F j hc k) (model_subpower F j hc i) + (inverse_radial_error F j hc k) (radial_error F j hc i) + +end FourFrames + +end + +namespace FourFrames +open Set Filter FinitePicard KZCollar KZRectangle StraightKZ PowerAsymptotic +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) + +include hc in +theorem normalized_transport_eq_corner {p : Fin 4 → ℝ} (hp : StrictMono p) + (i k : Fin 5) {s : ℝ} (hs : s∈Ioo 0 (1/4)) {T : A} + (hT : T=fundamental F j p (path k s)*Ring.inverse (fundamental F j p (path i s))) : + Ring.inverse (radial F j k s)*T*radial F j i s= + Ring.inverse (corner F j p k)*corner F j p i := by + rw [hT,radial_eq F j hc hp i hs,radial_eq F j hc hp k hs, + inverse_mul_of_units (fundamental_isUnit F j hc _ _) (corner_isUnit F j hc p k)] + simp only [mul_assoc] + rw [←mul_assoc (Ring.inverse (fundamental F j p (path i s))), + Ring.inverse_mul_cancel _ (fundamental_isUnit F j hc _ _),one_mul, + ←mul_assoc (Ring.inverse (fundamental F j p (path k s))), + Ring.inverse_mul_cancel _ (fundamental_isUnit F j hc _ _),one_mul] + +include hc in + +theorem corner_eq_of_limit {p : Fin 4 → ℝ} (hp : StrictMono p) (i k : Fin 5) + {T : ℝ → A} {v : A} (hT : Subpower T) + (hpath : ∀ᶠ s in 𝓝[>] 0,s∈Ioo 0 (1/4) ∧ + T s=fundamental F j p (path k s)*Ring.inverse (fundamental F j p (path i s))) + (hlim : Tendsto (fun s => inverseModel j k s*T s*model j i s) (𝓝[>] 0) (𝓝 v)) : + Ring.inverse (corner F j p k)*corner F j p i=v := by + have hr := (radial_replacement F j hc i k hT).tendsto_zero.add hlim + simp only [zero_add,sub_add_cancel] at hr + have he : (fun s => Ring.inverse (radial F j k s)*T s*radial F j i s) =ᶠ[𝓝[>] 0] + (fun _ => Ring.inverse (corner F j p k)*corner F j p i) := by + filter_upwards [hpath] with s hs + exact normalized_transport_eq_corner F j hc hp i k hs.1 hs.2 + exact tendsto_nhds_unique tendsto_const_nhds (hr.congr' he) + +end FourFrames + +section +namespace BCBoundary +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +theorem bulk_subpower (X Y : A) (N : ℕ) : + Subpower (fun s => transport (bulkForm X Y) s N (endpoint s)) := by + apply transport_subpower (L:=mass X Y 0 0) _ (mass_subpower X Y 0 0) N + filter_upwards [Ioc_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + obtain ⟨hab,hb,hd⟩ := interval_bounds hs + have hc := (bulkForm_continuous X Y).mono (show Icc s (endpoint s)⊆Ioo 0 1 from + fun t ht => ⟨hs.1.trans_le ht.1,ht.2.trans_lt hb⟩) + have hlog : 0 ≤ -Real.log s := neg_nonneg.mpr (Real.log_nonpos hs.1.le (by linarith [hs.2])) + refine ⟨hab,hc.intervalIntegrable_of_Icc hab,?_,?_⟩ + · simp only [mass,norm_zero,mul_zero,zero_mul,add_zero] + exact mul_nonneg (by positivity) hlog + · simpa only [mass,norm_zero,mul_zero,zero_mul,add_zero] using bulk_bound X Y hs + +theorem edge_subpower (X Y U V : A) (N : ℕ) : + Subpower (fun s => transport (shiftedBulk X Y U V (s^2)) s N (endpoint s)) := + subpower_of_sub (bulk_subpower X Y N) (perturbation X Y U V N) + +end BCBoundary +namespace FourFrames +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate + KZRectangle StraightKZ BCBoundary +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem chord_triple (i k l : Fin 4) (hik : i≠k) (hil : i≠l) (hkl : k≠l) : + Commute (j (GenericBraid.t i k)) (j (GenericBraid.t i l)+j (GenericBraid.t k l)) := by + have h := congrArg j (GenericBraid.t_three (R:=ℝ) i k l hik hil hkl) + rw [j.map_lie,map_add,map_zero] at h + exact sub_eq_zero.mp h + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem BC_commute_left : Commute (chords j 3) (chords j 0+chords j 1) := by + have h := chord_triple j 1 2 0 (by decide) (by decide) (by decide) + rw [GenericBraid.t_comm 1 0,GenericBraid.t_comm 2 0] at h + exact h + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem BC_commute_right : Commute (chords j 3) (chords j 4+chords j 5) := + chord_triple j 1 2 3 (by decide) (by decide) (by decide) + +def BCtransport (s : ℝ) : A := + transport (shiftedBulk (chords j 0+chords j 1) (chords j 4+chords j 5) + (chords j 1) (chords j 5) (s^2)) s F.cutoff (endpoint s) + +include hc in +theorem BC_model_limit : Tendsto (fun s => inverseModel j 2 s*BCtransport F j s*model j 1 s) + (𝓝[>] 0) (𝓝 (associator F (chords j 0+chords j 1) (chords j 4+chords j 5))) := by + have hl := BCBoundary.limit F (chords j 1) (chords j 5) + ((F.space 1).add_mem (hc 0) (hc 1)) ((F.space 1).add_mem (hc 4) (hc 5)) + ((F.space 1).add_mem (hc 3) (hc 3)) + ((BC_commute_left j).add_left (BC_commute_left j)) + ((BC_commute_right j).add_left (BC_commute_right j)) + convert! hl using 1 + funext s + change KZCollar.gauge (-(chords j 5+chords j 4+2 • chords j 3)) s*BCtransport F j s* + KZCollar.gauge (chords j 0+chords j 1+2 • chords j 3) s= + KZCollar.gauge (-(chords j 4+chords j 5+(chords j 3+chords j 3))) s*BCtransport F j s* + KZCollar.gauge (chords j 0+chords j 1+(chords j 3+chords j 3)) s + rw [two_smul ℕ,add_comm (chords j 5) (chords j 4)] + +include hc in +theorem BC_transport_eq {p : Fin 4 → ℝ} (hp : StrictMono p) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + BCtransport F j s=fundamental F j p (path 2 s)*Ring.inverse (fundamental F j p (path 1 s)) := by + let q : ℝ → Fin 4 → ℝ := fun t => point t (t+s^2) + let q' : ℝ → Fin 4 → ℝ := fun _ => speed 1 1 + have hsq : s^2 ≤ 1/16 := by nlinarith [hs.1,hs.2,sq_nonneg (s-1/4)] + have hab : s q t i) (Icc s (endpoint s)) := by + fin_cases i + · exact continuousOn_const + · exact continuousOn_id + · exact continuousOn_id.add continuousOn_const + · exact continuousOn_const + have hqc' (i : Fin 4) : ContinuousOn (fun t => q' t i) (Icc s (endpoint s)) := continuousOn_const + have hqd (t : ℝ) (_ : t∈Ioo s (endpoint s)) (i : Fin 4) : HasDerivAt (fun t => q t i) (q' t i) t := by + fin_cases i + · exact hasDerivAt_const _ _ + · exact hasDerivAt_id _ + · exact (hasDerivAt_id t).add_const (s^2) + · exact hasDerivAt_const _ _ + have ht := transport_eq_ratio F j hc hab hp hq hqc hqc' hqd + have hform : (fun t => j (KZFlat.connection (q t) (q' t)))= + shiftedBulk (chords j 0+chords j 1) (chords j 4+chords j 5) (chords j 1) (chords j 5) (s^2) := by + funext t + rw [show q t=point t (t+s^2) from rfl,show q' t=speed 1 1 from rfl,FourFrames.form_eq,BCBoundary.form_eq] + rw [hform] at ht + have hqb : q (endpoint s)=path 2 s := by + funext i + fin_cases i <;> simp [q,path,point,FourCollar.cx,FourCollar.cy,endpoint] + rw [hqb] at ht + exact ht + +include hc in +theorem BC_insertion {p : Fin 4 → ℝ} (hp : StrictMono p) : + Ring.inverse (corner F j p 2)*corner F j p 1= + associator F (chords j 0+chords j 1) (chords j 4+chords j 5) := by + apply corner_eq_of_limit F j hc hp 1 2 + (BCBoundary.edge_subpower _ _ _ _ F.cutoff) _ (BC_model_limit F j hc) + filter_upwards [Ioo_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + exact ⟨hs,BC_transport_eq F j hc hp hs⟩ + +end FourFrames + +end + +namespace ADBoundary +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def endpoint (s : ℝ) : ℝ := 1-s^2 + +def movedPole (X Y U : A) (δ t : ℝ) : A := bulkForm X Y t+((t-δ)⁻¹-t⁻¹) • U + +theorem bounds {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + s (t-s^2)⁻¹) (Icc s (endpoint s)) := + (continuousOn_id.sub continuousOn_const).inv₀ (fun t ht => ne_of_gt (by change 0 ⟨hs.1.trans_le ht.1,ht.2.trans_lt hb.2.1⟩) + exact hbulk.add ((hm.sub h0).smul continuousOn_const) + +theorem error_bound (X Y U : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + integralNorm (fun t => movedPole X Y U (s^2) t-bulkForm X Y t) s (endpoint s) ≤ 2*‖U‖*s := by + have hb := bounds hs + have he : (fun t => movedPole X Y U (s^2) t-bulkForm X Y t)= + (fun t => ((t-s^2)⁻¹-t⁻¹) • U) := by funext t; unfold movedPole; abel + rw [he] + calc + _ = (∫ t in s..endpoint s,|(t-s^2)⁻¹-t⁻¹|)*‖U‖ := by + simp only [integralNorm,norm_smul,Real.norm_eq_abs,intervalIntegral.integral_mul_const] + _ ≤ (2*s^2*s⁻¹)*‖U‖ := mul_le_mul_of_nonneg_right + (integral_abs_inv_sub_sub_inv_le hs.1 hb.1.le (sq_nonneg _) hb.2.2) (norm_nonneg _) + _ = _ := by field_simp + +theorem bulk_bound (X Y : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + integralNorm (bulkForm X Y) s (endpoint s) ≤ (‖X‖+2*‖Y‖)*(-Real.log s) := by + have hb := bounds hs + have h := bulkForm_mass (X:=X) (Y:=Y) hs.1 hb.1.le hb.2.1 + rw [show 1-endpoint s=s^2 by dsimp [endpoint]; ring,Real.log_pow] at h + convert! h using 1; ring + +def mass (X Y U : A) (s : ℝ) : ℝ := (‖X‖+2*‖Y‖)*(-Real.log s)+2*‖U‖*s + +omit [NormedAlgebra ℝ A] in +theorem mass_subpower (X Y U : A) : Subpower (mass X Y U) := by + have hl : Subpower (fun s : ℝ => -Real.log s) := by + simpa only [pow_one,neg_one_mul] using (const_subpower (-1:ℝ)).mul (log_pow_subpower 1) + exact ((const_subpower _).mul hl).add (continuousAt_subpower (continuousAt_const.mul continuousAt_id)) + +theorem estimates (X Y U : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + s ≤ endpoint s ∧ IntervalIntegrable (movedPole X Y U (s^2)) volume s (endpoint s) ∧ + IntervalIntegrable (bulkForm X Y) volume s (endpoint s) ∧ + 0 ≤ mass X Y U s ∧ 0 ≤ 2*‖U‖*s ∧ + integralNorm (movedPole X Y U (s^2)) s (endpoint s) ≤ mass X Y U s ∧ + integralNorm (bulkForm X Y) s (endpoint s) ≤ mass X Y U s ∧ + integralNorm (fun t => movedPole X Y U (s^2) t-bulkForm X Y t) s (endpoint s) ≤ 2*‖U‖*s := by + have hb := bounds hs + have hiΩ : IntervalIntegrable (movedPole X Y U (s^2)) volume s (endpoint s) := + (continuous X Y U hs).intervalIntegrable_of_Icc hb.1.le + have hiΘ : IntervalIntegrable (bulkForm X Y) volume s (endpoint s) := + ((bulkForm_continuous X Y).mono (show Icc s (endpoint s)⊆Ioo 0 1 from + fun t ht => ⟨hs.1.trans_le ht.1,ht.2.trans_lt hb.2.1⟩)).intervalIntegrable_of_Icc hb.1.le + have hE : 0 ≤ 2*‖U‖*s := mul_nonneg (by positivity) hs.1.le + have hB : 0 ≤ (‖X‖+2*‖Y‖)*(-Real.log s) := mul_nonneg (by positivity) + (neg_nonneg.mpr (Real.log_nonpos hs.1.le (by linarith [hs.2]))) + have hΩ : integralNorm (movedPole X Y U (s^2)) s (endpoint s) ≤ mass X Y U s := by + have h := integralNorm_add_le hb.1.le hiΘ (hiΩ.sub hiΘ) + have he : (fun t => bulkForm X Y t+(movedPole X Y U (s^2) t-bulkForm X Y t))=movedPole X Y U (s^2) := by funext t; abel + rw [he] at h + exact h.trans (add_le_add (bulk_bound X Y hs) (error_bound X Y U hs)) + exact ⟨hb.1.le,hiΩ,hiΘ,add_nonneg hB hE,hE,hΩ, + (bulk_bound X Y hs).trans (le_add_of_nonneg_right hE),error_bound X Y U hs⟩ + +theorem perturbation (X Y U : A) (N : ℕ) : + PowerSmall (fun s => transport (movedPole X Y U (s^2)) s N (endpoint s)- + transport (bulkForm X Y) s N (endpoint s)) := by + apply transport_perturbation_powerSmall (L:=mass X Y U) (E:=fun s => 2*‖U‖*s) + _ (mass_subpower X Y U) (linear_powerSmall _) N + filter_upwards [Ioc_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + exact estimates X Y U hs + +theorem transport_subpower (X Y U : A) (N : ℕ) : + Subpower (fun s => transport (movedPole X Y U (s^2)) s N (endpoint s)) := by + apply PowerAsymptotic.transport_subpower (L:=mass X Y U) _ (mass_subpower X Y U) N + filter_upwards [Ioc_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + have h := estimates X Y U hs + exact ⟨h.1,h.2.1,h.2.2.2.1,h.2.2.2.2.2.1⟩ + +theorem gauge_double (X : A) (s : ℝ) : KZCollar.gauge (X+X) s=KZCollar.gauge X (s^2) := by + unfold KZCollar.gauge + congr 1 + rw [Real.log_pow] + norm_num + module + +omit [NormedRing A] [NormedAlgebra ℝ A] in +theorem square_tendsto : Tendsto (fun s : ℝ => s^2) (𝓝[>] 0) (𝓝[>] 0) := by + apply tendsto_nhdsWithin_iff.mpr + refine ⟨?_,?_⟩ + · simpa only [id_eq,zero_pow (by decide : 2≠0)] using + ((tendsto_id.mono_left nhdsWithin_le_nhds : Tendsto (fun s : ℝ => s) (𝓝[>] 0) (𝓝 0)).pow 2) + · filter_upwards [self_mem_nhdsWithin] with s hs + exact sq_pos_of_pos (show 0 (hZX.smul_right (t⁻¹)).add_right (hZY.smul_right ((t-1)⁻¹))) s F.cutoff (endpoint s) + have hg := gauge_commute (pow_cutoff_eq_zero F hZ) ht.symm s + change Commute (transport (bulkForm X Y) s F.cutoff (endpoint s)) (KZCollar.gauge Z s) at hg + rw [show -(Z+(Y+Y))=(-Y + -Y)+ -Z by abel, + gauge_add_of_commute ((hZY.symm.neg_left.neg_right).add_left (hZY.symm.neg_left.neg_right)), + gauge_double,gauge_add_of_commute hZX] + calc + _ = KZCollar.gauge (-Y) (s^2)*(KZCollar.gauge (-Z) s* + (transport (bulkForm X Y) s F.cutoff (endpoint s)*KZCollar.gauge Z s))*KZCollar.gauge X s := by simp only [mul_assoc] + _ = KZCollar.gauge (-Y) (s^2)*(KZCollar.gauge (-Z) s* + (KZCollar.gauge Z s*transport (bulkForm X Y) s F.cutoff (endpoint s)))*KZCollar.gauge X s := by rw [hg.eq] + _ = _ := by rw [←mul_assoc (KZCollar.gauge (-Z) s),gauge_neg_mul,one_mul]; rfl + +theorem limit (F : NilpotentFiltration A) {X Y Z : A} (U : A) + (hX : X∈F.space 1) (hY : Y∈F.space 1) (hZ : Z∈F.space 1) + (hZX : Commute Z X) (hZY : Commute Z Y) : + Tendsto (fun s => KZCollar.gauge (-(Z+(Y+Y))) s* + transport (movedPole X Y U (s^2)) s F.cutoff (endpoint s)*KZCollar.gauge (Z+X) s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have hb := regularizedBulk_two_limit F hX hY tendsto_id square_tendsto + have he (s : ℝ) := model_bulk_eq F hZ hZX hZY s + have hb' : Tendsto (fun s => KZCollar.gauge (-(Z+(Y+Y))) s* + transport (bulkForm X Y) s F.cutoff (endpoint s)*KZCollar.gauge (Z+X) s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := hb.congr (fun s => (he s).symm) + have hl := normalized_perturbation_limit (perturbation X Y U F.cutoff) + (gauge_subpower (pow_cutoff_eq_zero F ((F.space 1).neg_mem ((F.space 1).add_mem hZ ((F.space 1).add_mem hY hY))))) + (gauge_subpower (pow_cutoff_eq_zero F ((F.space 1).add_mem hZ hX))) + simpa only [zero_add,sub_add_cancel] using! hl.add hb' + +end ADBoundary + +namespace FourFrames +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate + KZRectangle StraightKZ +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem AD_commute_left : Commute (chords j 0) (chords j 1+chords j 3) := + chord_triple j 0 1 2 (by decide) (by decide) (by decide) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem AD_commute_right : Commute (chords j 0) (chords j 5) := by + have h := congrArg j (GenericBraid.t_disjoint (R:=ℝ) (0:Fin 4) 1 2 3 + (by decide) (by decide) (by decide) (by decide)) + rw [j.map_lie,map_zero] at h + exact sub_eq_zero.mp h + +def ADtransport (s : ℝ) : A := + transport (ADBoundary.movedPole (chords j 1+chords j 3) (chords j 5) (chords j 3) (s^2)) + s F.cutoff (ADBoundary.endpoint s) + +include hc in +theorem AD_model_limit : Tendsto (fun s => inverseModel j 3 s*ADtransport F j s*model j 0 s) + (𝓝[>] 0) (𝓝 (associator F (chords j 1+chords j 3) (chords j 5))) := by + have hl := ADBoundary.limit F (chords j 3) + ((F.space 1).add_mem (hc 1) (hc 3)) (hc 5) + ((F.space 1).add_mem (hc 0) (hc 0)) + ((AD_commute_left j).add_left (AD_commute_left j)) + ((AD_commute_right j).add_left (AD_commute_right j)) + convert! hl using 1 + funext s + change KZCollar.gauge (-(2 • chords j 0+2 • chords j 5)) s*ADtransport F j s* + KZCollar.gauge (2 • chords j 0+chords j 1+chords j 3) s= + KZCollar.gauge (-((chords j 0+chords j 0)+(chords j 5+chords j 5))) s*ADtransport F j s* + KZCollar.gauge ((chords j 0+chords j 0)+(chords j 1+chords j 3)) s + simp only [two_smul ℕ,add_assoc] + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem AD_form (s t : ℝ) : + FourCollar.form (chords j 0) (chords j 1) (chords j 3) (chords j 4) (chords j 5) + (s^2) t 0 1=ADBoundary.movedPole (chords j 1+chords j 3) (chords j 5) (chords j 3) (s^2) t := by + simp only [FourCollar.form,ADBoundary.movedPole,bulkForm,one_div,sub_zero,zero_div,zero_smul,zero_add,add_zero, + smul_add,sub_smul] + abel + +include hc in +theorem AD_transport_eq {p : Fin 4 → ℝ} (hp : StrictMono p) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + ADtransport F j s=fundamental F j p (path 3 s)*Ring.inverse (fundamental F j p (path 0 s)) := by + let q : ℝ → Fin 4 → ℝ := fun t => point (s^2) t + let q' : ℝ → Fin 4 → ℝ := fun _ => speed 0 1 + have hb := ADBoundary.bounds ⟨hs.1,hs.2.le⟩ + have hq (t : ℝ) (ht : t∈Icc s (ADBoundary.endpoint s)) : StrictMono (q t) := by + apply point_strictMono + exact ⟨sq_pos_of_pos hs.1,by nlinarith [hb.2.2,ht.1,hs.1],ht.2.trans_lt hb.2.1⟩ + have hqc (i : Fin 4) : ContinuousOn (fun t => q t i) (Icc s (ADBoundary.endpoint s)) := by + fin_cases i + · exact continuousOn_const + · exact continuousOn_const + · exact continuousOn_id + · exact continuousOn_const + have hqc' (i : Fin 4) : ContinuousOn (fun t => q' t i) (Icc s (ADBoundary.endpoint s)) := continuousOn_const + have hqd (t : ℝ) (_ : t∈Ioo s (ADBoundary.endpoint s)) (i : Fin 4) : HasDerivAt (fun t => q t i) (q' t i) t := by + fin_cases i + · exact hasDerivAt_const _ _ + · exact hasDerivAt_const _ _ + · exact hasDerivAt_id _ + · exact hasDerivAt_const _ _ + have ht := transport_eq_ratio F j hc hb.1 hp hq hqc hqc' hqd + have hform : (fun t => j (KZFlat.connection (q t) (q' t)))= + ADBoundary.movedPole (chords j 1+chords j 3) (chords j 5) (chords j 3) (s^2) := by + funext t + rw [show q t=point (s^2) t from rfl,show q' t=speed 0 1 from rfl,FourFrames.form_eq,AD_form] + rw [hform] at ht + exact ht + +include hc in +theorem AD_insertion {p : Fin 4 → ℝ} (hp : StrictMono p) : + Ring.inverse (corner F j p 3)*corner F j p 0= + associator F (chords j 1+chords j 3) (chords j 5) := by + apply corner_eq_of_limit F j hc hp 0 3 + (ADBoundary.transport_subpower _ _ _ F.cutoff) _ (AD_model_limit F j hc) + filter_upwards [Ioo_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + exact ⟨hs,AD_transport_eq F j hc hp hs⟩ + +end FourFrames + +namespace ABBoundary + +section +open Set Filter +open scoped Topology + +def endpoint (s : ℝ) : ℝ := (1+s)⁻¹ +def slope (s : ℝ) : ℝ := s^2/(endpoint s-s) +def scale (s t : ℝ) : ℝ := s+slope s*(t-s) +def scaleV (s t : ℝ) : ℝ := scale s t+t*slope s + +theorem endpoint_bounds {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + 1/2 ≤ endpoint s-s ∧ endpoint s<1 ∧ s.const_add s + +theorem x_deriv (s t : ℝ) : HasDerivAt (fun t => t*scale s t) (scaleV s t) t := by + simpa only [scaleV,Pi.mul_apply,id_eq,one_mul] using! (hasDerivAt_id t).mul (scale_deriv s t) + +theorem scale_continuous (s : ℝ) : Continuous (scale s) := + continuous_const.add (continuous_const.mul (continuous_id.sub continuous_const)) + +theorem form_eq {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + (a b d e f : A) {s t : ℝ} (hs : s∈Ioc 0 (1/4)) (ht : t∈Icc s (endpoint s)) : + FourCollar.form a b d e f (t*scale s t) (scale s t) (scaleV s t) (slope s)= + KZCollar.bulkForm a d t+(slope s/scale s t) • (a+b+d)+ + (scaleV s t/(t*scale s t-1)) • e+(slope s/(scale s t-1)) • f := by + have hb := scale_bounds hs ht + have ht0 : t≠0 := ne_of_gt (hs.1.trans_le ht.1) + have hy : scale s t≠0 := ne_of_gt (hs.1.trans_le hb.1) + have ht1 : t-1≠0 := ne_of_lt (sub_neg.mpr (ht.2.trans_lt (endpoint_bounds hs).2.1)) + have hxy : scale s t-t*scale s t≠0 := ne_of_gt (sub_pos.mpr (chamber hs ht).2.1) + have h1t : 1-t≠0 := ne_of_gt (sub_pos.mpr (ht.2.trans_lt (endpoint_bounds hs).2.1)) + unfold FourCollar.form KZCollar.bulkForm scaleV + match_scalars <;> field_simp [ht0,hy,ht1,hxy,h1t] + ring + +end + +section +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def error (S E V : A) (s t : ℝ) : A := + (slope s/scale s t) • S+(scaleV s t/(t*scale s t-1)) • E+(slope s/(scale s t-1)) • V + +def edgeForm (X Y S E V : A) (s t : ℝ) : A := bulkForm X Y t+error S E V s t + +def errorConst (S E V : A) : ℝ := 2*‖S‖+4*‖E‖+4*‖V‖ + +omit [NormedAlgebra ℝ A] in +theorem errorConst_nonneg (S E V : A) : 0 ≤ errorConst S E V := by unfold errorConst; positivity + +theorem error_norm (S E V : A) {s t : ℝ} (hs : s∈Ioc 0 (1/4)) (ht : t∈Icc s (endpoint s)) : + ‖error S E V s t‖ ≤ errorConst S E V*s := by + have hb := coefficient_bounds hs ht + calc + _ ≤ ‖(slope s/scale s t) • S‖+‖(scaleV s t/(t*scale s t-1)) • E‖+‖(slope s/(scale s t-1)) • V‖ := norm_add₃_le + _ ≤ (2*s)*‖S‖+(4*s)*‖E‖+(4*s)*‖V‖ := by + simp only [norm_smul,Real.norm_eq_abs] + exact add_le_add (add_le_add (mul_le_mul_of_nonneg_right hb.1 (norm_nonneg _)) + (mul_le_mul_of_nonneg_right hb.2.1 (norm_nonneg _))) + (mul_le_mul_of_nonneg_right hb.2.2 (norm_nonneg _)) + _ = _ := by unfold errorConst; ring + +theorem error_continuous (S E V : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + ContinuousOn (error S E V s) (Icc s (endpoint s)) := by + have hy := (scale_continuous s).continuousOn (s:=Icc s (endpoint s)) + have hv : ContinuousOn (scaleV s) (Icc s (endpoint s)) := hy.add (continuousOn_id.mul continuousOn_const) + have hm := (continuousOn_id.mul hy).sub (continuousOn_const (c:=(1:ℝ))) + have hy0 : ∀ t∈Icc s (endpoint s),scale s t≠0 := fun t ht => ne_of_gt (hs.1.trans_le (scale_bounds hs ht).1) + have hm0 : ∀ t∈Icc s (endpoint s),t*scale s t-1≠0 := fun t ht => ne_of_lt (by + have h := chamber hs ht; linarith [h.2.1,h.2.2]) + have hy1 : ∀ t∈Icc s (endpoint s),scale s t-1≠0 := fun t ht => ne_of_lt (by linarith [(chamber hs ht).2.2]) + exact (((continuousOn_const.div hy hy0).smul continuousOn_const).add + ((hv.div hm hm0).smul continuousOn_const)).add + ((continuousOn_const.div (hy.sub continuousOn_const) hy1).smul continuousOn_const) + +theorem bulk_continuous (X Y : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + ContinuousOn (bulkForm X Y) (Icc s (endpoint s)) := + (bulkForm_continuous X Y).mono (fun _ ht => ⟨hs.1.trans_le ht.1,ht.2.trans_lt (endpoint_bounds hs).2.1⟩) + +theorem continuous (X Y S E V : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + ContinuousOn (edgeForm X Y S E V s) (Icc s (endpoint s)) := + (bulk_continuous X Y hs).add (error_continuous S E V hs) + +theorem error_bound (X Y S E V : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + integralNorm (fun t => edgeForm X Y S E V s t-bulkForm X Y t) s (endpoint s) ≤ errorConst S E V*s := by + simp only [edgeForm,add_sub_cancel_left] + have hb := endpoint_bounds hs + have hi : IntervalIntegrable (error S E V s) volume s (endpoint s) := + (error_continuous S E V hs).intervalIntegrable_of_Icc hb.2.2.le + calc + _ ≤ ∫ _ in s..endpoint s,errorConst S E V*s := + intervalIntegral.integral_mono_on hb.2.2.le hi.norm intervalIntegrable_const (fun t ht => error_norm S E V hs ht) + _ = (endpoint s-s)*(errorConst S E V*s) := by rw [intervalIntegral.integral_const,smul_eq_mul] + _ ≤ _ := mul_le_of_le_one_left (mul_nonneg (errorConst_nonneg S E V) hs.1.le) + (by linarith [hb.2.1,hs.1]) + +def mass (X Y S E V : A) (s : ℝ) : ℝ := + (‖X‖+‖Y‖)*(-Real.log s)+‖Y‖*Real.log 2+errorConst S E V*s + +theorem gap_eq {s : ℝ} (hs : 0 -Real.log s) := by + simpa only [pow_one,neg_one_mul] using (const_subpower (-1:ℝ)).mul (log_pow_subpower 1) + exact (((const_subpower _).mul hl).add (const_subpower _)).add + (continuousAt_subpower (continuousAt_const.mul continuousAt_id)) + +theorem estimates (X Y S E V : A) {s : ℝ} (hs : s∈Ioc 0 (1/4)) : + s ≤ endpoint s ∧ IntervalIntegrable (edgeForm X Y S E V s) volume s (endpoint s) ∧ + IntervalIntegrable (bulkForm X Y) volume s (endpoint s) ∧ 0 ≤ mass X Y S E V s ∧ + 0 ≤ errorConst S E V*s ∧ integralNorm (edgeForm X Y S E V s) s (endpoint s) ≤ mass X Y S E V s ∧ + integralNorm (bulkForm X Y) s (endpoint s) ≤ mass X Y S E V s ∧ + integralNorm (fun t => edgeForm X Y S E V s t-bulkForm X Y t) s (endpoint s) ≤ errorConst S E V*s := by + have hb := endpoint_bounds hs + have hiΩ : IntervalIntegrable (edgeForm X Y S E V s) volume s (endpoint s) := (continuous X Y S E V hs).intervalIntegrable_of_Icc hb.2.2.le + have hiΘ : IntervalIntegrable (bulkForm X Y) volume s (endpoint s) := (bulk_continuous X Y hs).intervalIntegrable_of_Icc hb.2.2.le + have hE : 0 ≤ errorConst S E V*s := mul_nonneg (errorConst_nonneg S E V) hs.1.le + have hl : 0 ≤ -Real.log s := neg_nonneg.mpr (Real.log_nonpos hs.1.le (by linarith [hs.2])) + have hL : 0 ≤ mass X Y S E V s := add_nonneg (add_nonneg (mul_nonneg (by positivity) hl) + (mul_nonneg (norm_nonneg _) (Real.log_nonneg (by norm_num)))) hE + have hΩ : integralNorm (edgeForm X Y S E V s) s (endpoint s) ≤ mass X Y S E V s := by + have h := integralNorm_add_le hb.2.2.le hiΘ (hiΩ.sub hiΘ) + have he : (fun t => bulkForm X Y t+(edgeForm X Y S E V s t-bulkForm X Y t))=edgeForm X Y S E V s := by funext t; abel + rw [he] at h + exact h.trans (add_le_add (bulk_bound X Y hs) (error_bound X Y S E V hs)) + exact ⟨hb.2.2.le,hiΩ,hiΘ,hL,hE,hΩ,(bulk_bound X Y hs).trans (le_add_of_nonneg_right hE),error_bound X Y S E V hs⟩ + +theorem perturbation (X Y S E V : A) (N : ℕ) : + PowerSmall (fun s => transport (edgeForm X Y S E V s) s N (endpoint s)-transport (bulkForm X Y) s N (endpoint s)) := by + apply transport_perturbation_powerSmall (L:=mass X Y S E V) (E:=fun s => errorConst S E V*s) + _ (mass_subpower X Y S E V) (linear_powerSmall _) N + filter_upwards [Ioc_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + exact estimates X Y S E V hs + +theorem transport_subpower (X Y S E V : A) (N : ℕ) : + Subpower (fun s => transport (edgeForm X Y S E V s) s N (endpoint s)) := by + apply PowerAsymptotic.transport_subpower (L:=mass X Y S E V) _ (mass_subpower X Y S E V) N + filter_upwards [Ioc_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + have h := estimates X Y S E V hs + exact ⟨h.1,h.2.1,h.2.2.2.1,h.2.2.2.2.2.1⟩ + +end + +open Set Filter FinitePicard KZCollar PowerAsymptotic +open scoped Topology + +theorem gap_tendsto : Tendsto (fun s : ℝ => s/(1+s)) (𝓝[>] 0) (𝓝[>] 0) := by + apply tendsto_nhdsWithin_iff.mpr + constructor + · have h : Tendsto (fun s : ℝ => s) (𝓝[>] 0) (𝓝 0) := tendsto_id.mono_left nhdsWithin_le_nhds + simpa only [add_zero,zero_div] using! h.div (tendsto_const_nhds.add h) (by norm_num : (1:ℝ)+0≠0) + · filter_upwards [self_mem_nhdsWithin] with s hs + change 0 gauge (-Y) s*transport (bulkForm X Y) s F.cutoff (endpoint s)*gauge X s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have h := (gauge_ratio_limit (-Y)).mul (regularizedBulk_two_limit F hX hY tendsto_id gap_tendsto) + simp only [one_mul] at h + apply h.congr' + filter_upwards [self_mem_nhdsWithin] with s hs + change 0 gauge (-(Y+Z)) s*transport (edgeForm X Y S E V s) s F.cutoff (endpoint s)*gauge (X+Z) s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have hl := normalized_perturbation_limit (perturbation X Y S E V F.cutoff) + (gauge_subpower (pow_cutoff_eq_zero F ((F.space 1).neg_mem ((F.space 1).add_mem hY hZ)))) + (gauge_subpower (pow_cutoff_eq_zero F ((F.space 1).add_mem hX hZ))) + have he (s : ℝ) := BCBoundary.shared_residue_cancel (pow_cutoff_eq_zero F hZ) hZX hZY s (endpoint s) s + have hb : Tendsto (fun s => gauge (-(Y+Z)) s*transport (bulkForm X Y) s F.cutoff (endpoint s)*gauge (X+Z) s) + (𝓝[>] 0) (𝓝 (associator F X Y)) := (bulk_limit F hX hY).congr (fun s => (he s).symm) + simpa only [zero_add,sub_add_cancel] using! hl.add hb + +end ABBoundary + +namespace FourFrames + +section +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate + KZRectangle StraightKZ +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem AB_commute_left : Commute (chords j 0+chords j 1+chords j 3) (chords j 0) := by + rw [add_assoc] + exact (Commute.refl _).add_left (AD_commute_left j).symm + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem AB_commute_right : Commute (chords j 0+chords j 1+chords j 3) (chords j 3) := + (BC_commute_left j).symm.add_left (Commute.refl _) + +def ABtransport (s : ℝ) : A := + transport (ABBoundary.edgeForm (chords j 0) (chords j 3) (chords j 0+chords j 1+chords j 3) + (chords j 4) (chords j 5) s) s F.cutoff (ABBoundary.endpoint s) + +include hc in +theorem AB_model_limit : Tendsto (fun s => inverseModel j 1 s*ABtransport F j s*model j 0 s) + (𝓝[>] 0) (𝓝 (associator F (chords j 0) (chords j 3))) := by + have hl := ABBoundary.limit F (chords j 0+chords j 1+chords j 3) (chords j 4) (chords j 5) + (hc 0) (hc 3) ((F.space 1).add_mem ((F.space 1).add_mem (hc 0) (hc 1)) (hc 3)) + (AB_commute_left j) (AB_commute_right j) + convert! hl using 1 + funext s + change KZCollar.gauge (-(chords j 0+chords j 1+2 • chords j 3)) s*ABtransport F j s* + KZCollar.gauge (2 • chords j 0+chords j 1+chords j 3) s= + KZCollar.gauge (-(chords j 3+(chords j 0+chords j 1+chords j 3))) s*ABtransport F j s* + KZCollar.gauge (chords j 0+(chords j 0+chords j 1+chords j 3)) s + rw [two_smul ℕ,two_smul ℕ,show chords j 0+chords j 1+(chords j 3+chords j 3)= + chords j 3+(chords j 0+chords j 1+chords j 3) by abel] + simp only [add_assoc] + +include hc in +theorem AB_transport_eq {p : Fin 4 → ℝ} (hp : StrictMono p) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + ABtransport F j s=fundamental F j p (path 1 s)*Ring.inverse (fundamental F j p (path 0 s)) := by + let q : ℝ → Fin 4 → ℝ := fun t => point (t*ABBoundary.scale s t) (ABBoundary.scale s t) + let q' : ℝ → Fin 4 → ℝ := fun t => speed (ABBoundary.scaleV s t) (ABBoundary.slope s) + have hb := ABBoundary.endpoint_bounds ⟨hs.1,hs.2.le⟩ + have hq (t : ℝ) (ht : t∈Icc s (ABBoundary.endpoint s)) : StrictMono (q t) := + point_strictMono (ABBoundary.chamber ⟨hs.1,hs.2.le⟩ ht) + have hqc (i : Fin 4) : ContinuousOn (fun t => q t i) (Icc s (ABBoundary.endpoint s)) := by + fin_cases i + · exact continuousOn_const + · exact (continuous_id.mul (ABBoundary.scale_continuous s)).continuousOn + · exact (ABBoundary.scale_continuous s).continuousOn + · exact continuousOn_const + have hqc' (i : Fin 4) : ContinuousOn (fun t => q' t i) (Icc s (ABBoundary.endpoint s)) := by + fin_cases i + · exact continuousOn_const + · exact ((ABBoundary.scale_continuous s).add (continuous_id.mul continuous_const)).continuousOn + · exact continuousOn_const + · exact continuousOn_const + have hqd (t : ℝ) (_ : t∈Ioo s (ABBoundary.endpoint s)) (i : Fin 4) : HasDerivAt (fun t => q t i) (q' t i) t := by + fin_cases i + · exact hasDerivAt_const _ _ + · exact ABBoundary.x_deriv s t + · exact ABBoundary.scale_deriv s t + · exact hasDerivAt_const _ _ + have ht := transport_eq_ratio F j hc hb.2.2 hp hq hqc hqc' hqd + have hform : Set.EqOn (fun t => j (KZFlat.connection (q t) (q' t))) + (ABBoundary.edgeForm (chords j 0) (chords j 3) (chords j 0+chords j 1+chords j 3) + (chords j 4) (chords j 5) s) (Icc s (ABBoundary.endpoint s)) := by + intro t hti + dsimp only + rw [show q t=point (t*ABBoundary.scale s t) (ABBoundary.scale s t) from rfl, + show q' t=speed (ABBoundary.scaleV s t) (ABBoundary.slope s) from rfl,FourFrames.form_eq, + ABBoundary.form_eq _ _ _ _ _ ⟨hs.1,hs.2.le⟩ hti] + simp only [ABBoundary.edgeForm,ABBoundary.error,add_assoc] + have he := transport_congr (a:=s) (b:=ABBoundary.endpoint s) (by simpa only [uIcc_of_le hb.2.2.le] using hform) F.cutoff + rw [he] at ht + have hqb : q (ABBoundary.endpoint s)=path 1 s := by + funext i + fin_cases i <;> simp [q,path,point,FourCollar.cx,FourCollar.cy,ABBoundary.scale_end ⟨hs.1,hs.2.le⟩] + have he := ABBoundary.endpoint_mul_scale ⟨hs.1,hs.2.le⟩ + rw [ABBoundary.scale_end ⟨hs.1,hs.2.le⟩] at he + exact he + have hqa : q s=path 0 s := by + funext i + fin_cases i <;> simp [q,path,point,FourCollar.cx,FourCollar.cy,ABBoundary.scale_start,pow_two] + rw [hqa,hqb] at ht + exact ht + +include hc in +theorem AB_insertion {p : Fin 4 → ℝ} (hp : StrictMono p) : + Ring.inverse (corner F j p 1)*corner F j p 0=associator F (chords j 0) (chords j 3) := by + apply corner_eq_of_limit F j hc hp 0 1 + (ABBoundary.transport_subpower _ _ _ _ _ F.cutoff) _ (AB_model_limit F j hc) + filter_upwards [Ioo_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + exact ⟨hs,AB_transport_eq F j hc hp hs⟩ + +end + +section +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate + KZRectangle StraightKZ +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem ED_commute_left : Commute (chords j 5) (chords j 4+chords j 3) := by + have h := chord_triple j 2 3 1 (by decide) (by decide) (by decide) + rw [GenericBraid.t_comm 2 1,GenericBraid.t_comm 3 1,add_comm] at h + exact h + +def EDtransport (s : ℝ) : A := + transport (ADBoundary.movedPole (chords j 4+chords j 3) (chords j 0) (chords j 3) (s^2)) + s F.cutoff (ADBoundary.endpoint s) + +include hc in +theorem ED_model_limit : Tendsto (fun s => inverseModel j 3 s*EDtransport F j s*model j 4 s) + (𝓝[>] 0) (𝓝 (associator F (chords j 4+chords j 3) (chords j 0))) := by + have hl := ADBoundary.limit F (chords j 3) + ((F.space 1).add_mem (hc 4) (hc 3)) (hc 0) + ((F.space 1).add_mem (hc 5) (hc 5)) + ((ED_commute_left j).add_left (ED_commute_left j)) + ((AD_commute_right j).symm.add_left (AD_commute_right j).symm) + convert! hl using 1 + funext s + change KZCollar.gauge (-(2 • chords j 0+2 • chords j 5)) s*EDtransport F j s* + KZCollar.gauge (2 • chords j 5+chords j 4+chords j 3) s= + KZCollar.gauge (-((chords j 5+chords j 5)+(chords j 0+chords j 0))) s*EDtransport F j s* + KZCollar.gauge ((chords j 5+chords j 5)+(chords j 4+chords j 3)) s + rw [add_comm (2 • chords j 0) (2 • chords j 5)] + simp only [two_smul ℕ,add_assoc] + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem ED_form (s t : ℝ) : + FourCollar.form (chords j 0) (chords j 1) (chords j 3) (chords j 4) (chords j 5) + (1-t) (1-s^2) (-1) 0= + ADBoundary.movedPole (chords j 4+chords j 3) (chords j 0) (chords j 3) (s^2) t := by + unfold FourCollar.form ADBoundary.movedPole bulkForm + rw [show 1-s^2-(1-t)=t-s^2 by ring,show 1-t-1= -t by ring, + show 1-t= -(t-1) by ring] + simp only [zero_div,zero_smul,add_zero,zero_sub,neg_neg,neg_div_neg_eq,one_div, + smul_add,sub_smul] + abel + +include hc in +theorem ED_transport_eq {p : Fin 4 → ℝ} (hp : StrictMono p) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + EDtransport F j s=fundamental F j p (path 3 s)*Ring.inverse (fundamental F j p (path 4 s)) := by + let q : ℝ → Fin 4 → ℝ := fun t => point (1-t) (1-s^2) + let q' : ℝ → Fin 4 → ℝ := fun _ => speed (-1) 0 + have hb := ADBoundary.bounds ⟨hs.1,hs.2.le⟩ + have hq (t : ℝ) (ht : t∈Icc s (ADBoundary.endpoint s)) : StrictMono (q t) := by + apply point_strictMono + exact ⟨by linarith [ht.2.trans_lt hb.2.1],by nlinarith [hb.2.2,ht.1,hs.1],by nlinarith [sq_pos_of_pos hs.1]⟩ + have hqc (i : Fin 4) : ContinuousOn (fun t => q t i) (Icc s (ADBoundary.endpoint s)) := by + fin_cases i + · exact continuousOn_const + · exact continuousOn_const.sub continuousOn_id + · exact continuousOn_const + · exact continuousOn_const + have hqc' (i : Fin 4) : ContinuousOn (fun t => q' t i) (Icc s (ADBoundary.endpoint s)) := continuousOn_const + have hqd (t : ℝ) (_ : t∈Ioo s (ADBoundary.endpoint s)) (i : Fin 4) : HasDerivAt (fun t => q t i) (q' t i) t := by + fin_cases i + · exact hasDerivAt_const _ _ + · change HasDerivAt (fun t : ℝ => 1-t) (-1) t + simpa only [Pi.sub_apply,id_eq,zero_sub] using! (hasDerivAt_const t (1:ℝ)).sub (hasDerivAt_id t) + · exact hasDerivAt_const _ _ + · exact hasDerivAt_const _ _ + have ht := transport_eq_ratio F j hc hb.1 hp hq hqc hqc' hqd + have hform : (fun t => j (KZFlat.connection (q t) (q' t)))= + ADBoundary.movedPole (chords j 4+chords j 3) (chords j 0) (chords j 3) (s^2) := by + funext t + rw [show q t=point (1-t) (1-s^2) from rfl,show q' t=speed (-1) 0 from rfl,FourFrames.form_eq,ED_form] + rw [hform] at ht + have hqb : q (ADBoundary.endpoint s)=path 3 s := by + funext i + fin_cases i <;> simp [q,path,point,FourCollar.cx,FourCollar.cy,ADBoundary.endpoint] + rw [hqb] at ht + exact ht + +include hc in +theorem ED_insertion {p : Fin 4 → ℝ} (hp : StrictMono p) : + Ring.inverse (corner F j p 3)*corner F j p 4= + associator F (chords j 4+chords j 3) (chords j 0) := by + apply corner_eq_of_limit F j hc hp 4 3 + (ADBoundary.transport_subpower _ _ _ F.cutoff) _ (ED_model_limit F j hc) + filter_upwards [Ioo_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + exact ⟨hs,ED_transport_eq F j hc hp hs⟩ + +end + +open MeasureTheory Set Filter FinitePicard KZCollar PowerAsymptotic PoleEstimate + KZRectangle StraightKZ +open scoped Topology +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem EC_commute_left : Commute (chords j 5+chords j 4+chords j 3) (chords j 5) := by + rw [add_assoc] + exact (Commute.refl _).add_left (ED_commute_left j).symm + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem EC_commute_right : Commute (chords j 5+chords j 4+chords j 3) (chords j 3) := by + rw [add_comm (chords j 5) (chords j 4)] + exact (BC_commute_right j).symm.add_left (Commute.refl _) + +def ECtransport (s : ℝ) : A := + transport (ABBoundary.edgeForm (chords j 5) (chords j 3) (chords j 5+chords j 4+chords j 3) + (chords j 1) (chords j 0) s) s F.cutoff (ABBoundary.endpoint s) + +include hc in +theorem EC_model_limit : Tendsto (fun s => inverseModel j 2 s*ECtransport F j s*model j 4 s) + (𝓝[>] 0) (𝓝 (associator F (chords j 5) (chords j 3))) := by + have hl := ABBoundary.limit F (chords j 5+chords j 4+chords j 3) (chords j 1) (chords j 0) + (hc 5) (hc 3) ((F.space 1).add_mem ((F.space 1).add_mem (hc 5) (hc 4)) (hc 3)) + (EC_commute_left j) (EC_commute_right j) + convert! hl using 1 + funext s + change KZCollar.gauge (-(chords j 5+chords j 4+2 • chords j 3)) s*ECtransport F j s* + KZCollar.gauge (2 • chords j 5+chords j 4+chords j 3) s= + KZCollar.gauge (-(chords j 3+(chords j 5+chords j 4+chords j 3))) s*ECtransport F j s* + KZCollar.gauge (chords j 5+(chords j 5+chords j 4+chords j 3)) s + rw [two_smul ℕ,two_smul ℕ,show chords j 5+chords j 4+(chords j 3+chords j 3)= + chords j 3+(chords j 5+chords j 4+chords j 3) by abel] + simp only [add_assoc] + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem form_reflection (a b d e f : A) (x y vx vy : ℝ) : + FourCollar.form a b d e f (1-y) (1-x) (-vy) (-vx)=FourCollar.form f e d b a x y vx vy := by + unfold FourCollar.form + rw [show (1-x)-(1-y)=y-x by ring,show -vx- -vy=vy-vx by ring, + show 1-y-1= -y by ring,show 1-x-1= -x by ring, + show 1-y= -(y-1) by ring,show 1-x= -(x-1) by ring] + simp only [neg_div_neg_eq] + abel + +include hc in +theorem EC_transport_eq {p : Fin 4 → ℝ} (hp : StrictMono p) {s : ℝ} (hs : s∈Ioo 0 (1/4)) : + ECtransport F j s=fundamental F j p (path 2 s)*Ring.inverse (fundamental F j p (path 4 s)) := by + let q : ℝ → Fin 4 → ℝ := fun t => point (1-ABBoundary.scale s t) (1-t*ABBoundary.scale s t) + let q' : ℝ → Fin 4 → ℝ := fun t => speed (-ABBoundary.slope s) (-ABBoundary.scaleV s t) + have hb := ABBoundary.endpoint_bounds ⟨hs.1,hs.2.le⟩ + have hq (t : ℝ) (ht : t∈Icc s (ABBoundary.endpoint s)) : StrictMono (q t) := by + apply point_strictMono + have hg := ABBoundary.chamber ⟨hs.1,hs.2.le⟩ ht + exact ⟨by linarith [hg.2.2],by linarith [hg.2.1],by linarith [hg.1]⟩ + have hqc (i : Fin 4) : ContinuousOn (fun t => q t i) (Icc s (ABBoundary.endpoint s)) := by + fin_cases i + · exact continuousOn_const + · exact (continuous_const.sub (ABBoundary.scale_continuous s)).continuousOn + · exact (continuous_const.sub (continuous_id.mul (ABBoundary.scale_continuous s))).continuousOn + · exact continuousOn_const + have hqc' (i : Fin 4) : ContinuousOn (fun t => q' t i) (Icc s (ABBoundary.endpoint s)) := by + fin_cases i + · exact continuousOn_const + · exact continuousOn_const + · exact (((ABBoundary.scale_continuous s).add (continuous_id.mul continuous_const)).neg).continuousOn + · exact continuousOn_const + have hqd (t : ℝ) (_ : t∈Ioo s (ABBoundary.endpoint s)) (i : Fin 4) : HasDerivAt (fun t => q t i) (q' t i) t := by + fin_cases i + · exact hasDerivAt_const _ _ + · change HasDerivAt (fun t => 1-ABBoundary.scale s t) (-ABBoundary.slope s) t + simpa only [Pi.sub_apply,zero_sub] using! (hasDerivAt_const t (1:ℝ)).sub (ABBoundary.scale_deriv s t) + · change HasDerivAt (fun t => 1-t*ABBoundary.scale s t) (-ABBoundary.scaleV s t) t + simpa only [Pi.sub_apply,zero_sub] using! (hasDerivAt_const t (1:ℝ)).sub (ABBoundary.x_deriv s t) + · exact hasDerivAt_const _ _ + have ht := transport_eq_ratio F j hc hb.2.2 hp hq hqc hqc' hqd + have hform : Set.EqOn (fun t => j (KZFlat.connection (q t) (q' t))) + (ABBoundary.edgeForm (chords j 5) (chords j 3) (chords j 5+chords j 4+chords j 3) + (chords j 1) (chords j 0) s) (Icc s (ABBoundary.endpoint s)) := by + intro t hti + dsimp only + rw [show q t=point (1-ABBoundary.scale s t) (1-t*ABBoundary.scale s t) from rfl, + show q' t=speed (-ABBoundary.slope s) (-ABBoundary.scaleV s t) from rfl,FourFrames.form_eq,form_reflection, + ABBoundary.form_eq _ _ _ _ _ ⟨hs.1,hs.2.le⟩ hti] + simp only [ABBoundary.edgeForm,ABBoundary.error,add_assoc] + have he := transport_congr (a:=s) (b:=ABBoundary.endpoint s) (by simpa only [uIcc_of_le hb.2.2.le] using hform) F.cutoff + rw [he] at ht + have hqb : q (ABBoundary.endpoint s)=path 2 s := by + funext i + fin_cases i <;> simp [q,path,point,FourCollar.cx,FourCollar.cy,ABBoundary.scale_end ⟨hs.1,hs.2.le⟩,sub_add_eq_sub_sub] + have he := ABBoundary.endpoint_mul_scale ⟨hs.1,hs.2.le⟩ + rw [ABBoundary.scale_end ⟨hs.1,hs.2.le⟩] at he + exact he + have hqa : q s=path 4 s := by + funext i + fin_cases i <;> simp [q,path,point,FourCollar.cx,FourCollar.cy,ABBoundary.scale_start,pow_two] + rw [hqa,hqb] at ht + exact ht + +include hc in +theorem EC_insertion {p : Fin 4 → ℝ} (hp : StrictMono p) : + Ring.inverse (corner F j p 2)*corner F j p 4=associator F (chords j 5) (chords j 3) := by + apply corner_eq_of_limit F j hc hp 4 2 + (ABBoundary.transport_subpower _ _ _ _ _ F.cutoff) _ (EC_model_limit F j hc) + filter_upwards [Ioo_mem_nhdsGT (by norm_num : (0:ℝ)<1/4)] with s hs + exact ⟨hs,EC_transport_eq F j hc hp hs⟩ + +end FourFrames + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Ihara.lean b/lean/OAI/Algebra/Drinfeld/Ihara.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d34380e757f646c3ed90ee1fc51d0d1f469d0a2 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Ihara.lean @@ -0,0 +1,1398 @@ +import OAI.Algebra.Drinfeld.Reduction + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +section +namespace WordGrading +open AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +variable {R α : Type*} [CommRing R] + +theorem homogeneous_lie {wt : α → ℕ} {r s : ℕ} {p q : A R α} + (hp : p∈homogeneous wt r) (hq : q∈homogeneous wt s) : ⁅p,q⁆∈homogeneous wt (r+s) := by + change p*q-q*p∈_ + exact (homogeneous wt _).sub_mem (homogeneous_mul hp hq) (by simpa only [Nat.add_comm] using homogeneous_mul hq hp) + +theorem above_lie {wt : α → ℕ} {r s : ℕ} {p q : A R α} + (hp : p∈above wt r) (hq : q∈above wt s) : ⁅p,q⁆∈above wt (r+s) := by + change p*q-q*p∈_ + exact (above wt _).sub_mem (above_mul hp hq) (by simpa only [Nat.add_comm] using above_mul hq hp) + +theorem piece_of_difference_high {wt : α → ℕ} {n : ℕ} {p q : A R α} + (hq : q∈homogeneous wt n) (hd : p-q∈above wt (n+1)) : piece wt n p=q := by + have h := piece_zero_of_above hd (Nat.lt_succ_self n) + rw [map_sub,piece_homogeneous hq,ite_eq_left rfl] at h + exact sub_eq_zero.mp h + +theorem leading_lie {wt : α → ℕ} {r s : ℕ} {p q : A R α} + (hp : p∈above wt r) (hq : q∈above wt s) : + piece wt (r+s) ⁅p,q⁆=⁅piece wt r p,piece wt s q⁆ := by + apply piece_of_difference_high (homogeneous_lie (piece_mem wt r p) (piece_mem wt s q)) + have h1 := above_lie (subtract_piece_above hp) hq + have h2 := above_lie (homogeneous_above (piece_mem wt r p)) (subtract_piece_above hq) + have he : ⁅p,q⁆-⁅piece wt r p,piece wt s q⁆=⁅p-piece wt r p,q⁆+⁅piece wt r p,q-piece wt s q⁆ := by + simp only [sub_lie,lie_sub]; abel + rw [he] + exact (above wt (r+s+1)).add_mem (by simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1) + (by simpa only [Nat.add_assoc] using h2) + +theorem leading_deriv {wt : α → ℕ} {c n : ℕ} {f g : α → A R α} + (hf : ∀ a,f a∈above wt (wt a+c)) (hg : ∀ a,g a∈homogeneous wt (wt a+c)) + (hd : ∀ a,f a-g a∈above wt (wt a+c+1)) {p : A R α} (hp : p∈above wt n) : + piece wt (n+c) (deriv f p)=deriv g (piece wt n p) := by + apply piece_of_difference_high (deriv_homogeneous hg (piece_mem wt n p)) + have h1 := deriv_above hf (subtract_piece_above hp) + have h2 := deriv_above (c:=c+1) (f:=fun a => f a-g a) + (by intro a; simpa only [Nat.add_assoc] using hd a) (homogeneous_above (piece_mem wt n p)) + rw [deriv_sub] at h2 + have he : deriv f p-deriv g (piece wt n p)=deriv f (p-piece wt n p)+ + (deriv f (piece wt n p)-deriv g (piece wt n p)) := by rw [map_sub]; abel + rw [he] + exact (above wt (n+c+1)).add_mem (by simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1) + (by simpa only [Nat.add_assoc] using h2) + +end WordGrading +namespace IharaLeading +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon ResidualKernel +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 +local notation "S" => A K Slot +local notation "B" => (atom Slot.B : S) +local notation "C" => (atom Slot.C : S) + +def action (p : S) : Slot → S + | .A => 0 | .B => ⁅B,p⁆ | .C => ⁅C,p⁆+⁅B,deriv delta p⁆ +def lowAction (q : S) : Slot → S + | .A => 0 | .B => ⁅B,q⁆ | .C => ⁅C,q⁆+⁅B,deriv low q⁆ + +theorem delta_above {p : S} {r : ℕ} (hp : p∈above bCount r) : deriv delta p∈above bCount (r-1) := by + rw [delta_split] + apply (above bCount (r-1)).add_mem + · exact deriv_lowers_above bCount 1 low low_degree hp + · exact space_mono (by intro w hw; omega) (deriv_above (fun a => homogeneous_above (high_degree a)) hp) + +theorem action_above {p : S} {r : ℕ} (hr : 0 exact Submodule.zero_mem _ + | «B» => exact above_lie hb hp + | «C» => + apply (above bCount (0+r)).add_mem (above_lie hc hp) + convert above_lie hb (delta_above hp) using 1 + congr 1 + omega + +theorem lowAction_homogeneous {q : S} {r : ℕ} (hr : 0 exact Submodule.zero_mem _ + | «B» => exact homogeneous_lie hb hq + | «C» => + apply (homogeneous bCount (0+r)).add_mem (homogeneous_lie hc hq) + convert homogeneous_lie hb (lower_homogeneous (deriv_lower bCount 1 low low_degree hq)) using 1 + congr 1 + omega + +theorem delta_low_difference {p q : S} {r : ℕ} (hp : p∈above bCount r) + (hd : p-q∈above bCount (r+1)) : deriv delta p-deriv low q∈above bCount r := by + have hl := deriv_lowers_above bCount 1 low low_degree hd + have hh := deriv_above (fun a => homogeneous_above (high_degree a)) hp + rw [delta_split] + have he : deriv low p+deriv high p-deriv low q=deriv low (p-q)+deriv high p := by rw [map_sub]; abel + rw [he] + exact (above bCount r).add_mem (by simpa using hl) (space_mono (by intro w hw; omega) hh) + +theorem action_difference {p q : S} {r : ℕ} (hp : p∈above bCount r) + (hd : p-q∈above bCount (r+1)) (a : Slot) : action p a-lowAction q a∈above bCount (bCount a+r+1) := by + have hb : B∈above bCount 1 := homogeneous_above (word_mem (FreeMonoid.of Slot.B) rfl) + have hc : C∈above bCount 0 := homogeneous_above (word_mem (FreeMonoid.of Slot.C) rfl) + cases a with + | A => simp only [action,lowAction,sub_self]; exact Submodule.zero_mem _ + | «B» => + change ⁅B,p⁆-⁅B,q⁆∈_ + rw [←lie_sub] + simpa only [Nat.add_assoc,bCount,ite_true] using above_lie hb hd + | «C» => + have he : action p Slot.C-lowAction q Slot.C=⁅C,p-q⁆+⁅B,deriv delta p-deriv low q⁆ := by + simp only [action,lowAction,lie_sub]; abel + rw [he] + exact (above bCount (0+r+1)).add_mem (by simpa only [Nat.add_assoc] using above_lie hc hd) + (by simpa only [Nat.add_comm,Nat.zero_add] using above_lie hb (delta_low_difference hp hd)) + +theorem leading_action {p q : S} {r s : ℕ} (hr : 0 simp + | ha a => rw [deriv_atom,h a] + | hadd p q hp hq => simp only [map_add,hp,hq] + | hs c p hp => simp only [map_smul,hp] + | hm p q hp hq => rw [deriv_mul,map_add,map_mul,map_mul,hp,hq,map_mul,deriv_mul] + +theorem deriv_inner_right (p q : A R α) : deriv (fun a => ⁅(atom a : A R α),p⁆) q=⁅q,p⁆ := by + induction q using QuadraticAlphabet.algebra_induction with + | h1 => simp [Ring.lie_def] + | ha a => exact deriv_atom _ _ + | hadd q r hq hr => simp only [map_add,add_lie,hq,hr] + | hs c q hq => simp only [map_smul,smul_lie,hq] + | hm q r hq hr => rw [deriv_mul,hq,hr]; simp only [Ring.lie_def]; noncomm_ring + +end AssociativeElimination +namespace IharaLeading +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon ResidualKernel +attribute [local instance] LieRing.ofAssociativeRing +local notation "S" => A K Slot +local notation "E" => (OreShift.eraseShift (0 : A K Bool)) + +theorem erase_low (p : S) : E (deriv low p)=OreShift.D (E p) := by + apply deriv_naturality E low (fun b => if b then OreShift.C else 0) ?_ + intro a + cases a <;> simp [low,OreShift.eraseShift,OreShift.C,OreShift.B] + +theorem erase_lowAction_inner {p : S} (hp : OreShift.D (E p)=0) (q : S) : + E (deriv (lowAction p) q)=⁅E q,E p⁆ := by + rw [←deriv_inner_right] + apply deriv_naturality E (lowAction p) (fun b => ⁅atom b,E p⁆) ?_ + intro a + cases a with + | A => simp [lowAction,OreShift.eraseShift] + | C => + change E (⁅(atom Slot.C : S),p⁆+⁅(atom Slot.B : S),deriv low p⁆)=_ + rw [map_add,EvenIndex.map_lie,EvenIndex.map_lie,erase_low,hp,lie_zero,add_zero] + simp [OreShift.eraseShift,OreShift.C] + | B => + change E ⁅(atom Slot.B : S),p⁆=_ + rw [EvenIndex.map_lie] + simp [OreShift.eraseShift,OreShift.B] + +def ihara (p q : S) : S := deriv (action p) q-deriv (action q) p+⁅p,q⁆ + +theorem ihara_above {p q : S} {r s : ℕ} (hr : 0 1) n) + (hφ : embed φ∈homogeneous (fun _ => 1) m) + (hp : under p=embed ψ) (hq : under q=embed φ) + (hψa : BaseChangeEquations.antisymmetry ψ=0) (hφa : BaseChangeEquations.antisymmetry φ=0) + (hr : 0 if b then ⁅FreeLieAlgebra.of R true,p⁆ else 0) +def ihara (p q : FreeLieAlgebra R Bool) := D p q-D q p+⁅p,q⁆ +def assocD (p : A R Bool) : A R Bool →ₗ[R] A R Bool := + deriv (fun b => if b then ⁅(atom true : A R Bool),p⁆ else 0) +def assocIhara (p q : A R Bool) := assocD p q-assocD q p+⁅p,q⁆ + +theorem embed_D (p q : FreeLieAlgebra R Bool) : embed (D p q)=assocD (embed p) (embed q) := by + rw [←AssociativeDerivations.extend_embed] + congr 1 + unfold AssociativeDerivations.extend assocD + congr 1 + funext b + cases b <;> simp [D] + +theorem embed_ihara (p q : FreeLieAlgebra R Bool) : embed (ihara p q)=assocIhara (embed p) (embed q) := by + simp only [ihara,assocIhara,map_add,map_sub,LieHom.map_lie,embed_D] + +theorem rational_D (p q : L) : D p q=DeligneDrinfeld.D p q := by + have h : D p=derivation p := by + apply derivation_ext + · change D p x=DeligneDrinfeld.D p x + rw [D_x] + simp [D,x] + · change D p y=DeligneDrinfeld.D p y + rw [D_y] + simp [D,y] + exact LieDerivation.congr_fun h q + +theorem rational_ihara (p q : L) : ihara p q=DeligneDrinfeld.ihara p q := by + simp only [ihara,DeligneDrinfeld.ihara,rational_D] + +end GenericIhara +namespace IharaLeading +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon ResidualKernel +attribute [local instance] LieRing.ofAssociativeRing +local notation "S" => A K Slot +local notation "Q" => A K Bool + +theorem quad_action (p q : S) : quad (deriv (action p) q)=GenericIhara.assocD (quad p) (quad q) := by + apply deriv_naturality quad (action p) (fun b => if b then ⁅(atom true : Q),quad p⁆ else 0) ?_ + intro a + cases a with + | A => + simp only [action,map_zero,quad,lift_atom,AssociativeElimination.deriv_mul,deriv_atom, + Bool.false_eq_true,ite_false,zero_mul,mul_zero,add_zero] + | C => + simp only [action,map_add,EvenIndex.map_lie,quad_delta] + simp only [quad,lift_atom,map_sub,AssociativeElimination.deriv_mul,deriv_atom, + ite_true,Bool.false_eq_true,ite_false,Ring.lie_def,zero_mul,mul_zero,zero_add,add_zero] + noncomm_ring + | B => simp [action,quad,EvenIndex.map_lie] + +theorem quad_ihara (p q : S) : quad (ihara p q)=GenericIhara.assocIhara (quad p) (quad q) := by + simp only [ihara,GenericIhara.assocIhara,map_add,map_sub,EvenIndex.map_lie,quad_action] + +def deltaLie : LieDerivation K (FreeLieAlgebra K Slot) (FreeLieAlgebra K Slot) := + FreeDerivations.extend (fun (a : Slot) => match a with + | .A => 0 | .B => FreeLieAlgebra.of K Slot.C + | .C => ⁅FreeLieAlgebra.of K Slot.A,FreeLieAlgebra.of K Slot.B⁆) + +theorem embed_deltaLie (p : FreeLieAlgebra K Slot) : embed (deltaLie p)=deriv delta (embed p) := by + have h : (fun a => embed (deltaLie (FreeLieAlgebra.of K a)))=delta := by + funext a + cases a <;> simp [deltaLie,delta,low,high,Ring.lie_def] + rw [←AssociativeDerivations.extend_embed] + change deriv (fun a => embed (deltaLie (FreeLieAlgebra.of K a))) (embed p)=_ + rw [h] + +def actionLie (p : FreeLieAlgebra K Slot) : LieDerivation K (FreeLieAlgebra K Slot) (FreeLieAlgebra K Slot) := + FreeDerivations.extend (fun (a : Slot) => match a with + | .A => 0 | .B => ⁅FreeLieAlgebra.of K Slot.B,p⁆ + | .C => ⁅FreeLieAlgebra.of K Slot.C,p⁆+⁅FreeLieAlgebra.of K Slot.B,deltaLie p⁆) + +theorem embed_actionLie (p q : FreeLieAlgebra K Slot) : + embed (actionLie p q)=deriv (action (embed p)) (embed q) := by + have h : (fun a => embed (actionLie p (FreeLieAlgebra.of K a)))=action (embed p) := by + funext a + cases a <;> simp [actionLie,action,embed_deltaLie] + rw [←AssociativeDerivations.extend_embed] + change deriv (fun a => embed (actionLie p (FreeLieAlgebra.of K a))) (embed q)=_ + rw [h] + +def iharaLie (p q : FreeLieAlgebra K Slot) := actionLie p q-actionLie q p+⁅p,q⁆ + +theorem embed_iharaLie (p q : FreeLieAlgebra K Slot) : embed (iharaLie p q)=ihara (embed p) (embed q) := by + simp only [iharaLie,ihara,map_add,map_sub,LieHom.map_lie,embed_actionLie] + +theorem actual_ihara_representation {ψ φ : FreeLieAlgebra K Bool} {p q : FreeLieAlgebra K Slot} + (hp : under p=embed ψ) (hq : under q=embed φ) : under (iharaLie p q)=embed (GenericIhara.ihara ψ φ) := by + change quad (embed (iharaLie p q))=_ + rw [embed_iharaLie,quad_ihara,GenericIhara.embed_ihara] + rw [show quad (embed p)=embed ψ from hp,show quad (embed q)=embed φ from hq] + +end IharaLeading + +namespace GenericIhara + +section +open AssociativeElimination UniversalEmbedding WordGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R : Type*} [CommRing R] + +def depth : Bool → ℕ := fun b => if b then 1 else 0 + +theorem assocD_above {p q : A R Bool} {r s : ℕ} (hp : p∈above depth r) (hq : q∈above depth s) : + assocD p q∈above depth (s+r) := by + apply deriv_above (c:=r) (f:=fun b => if b then ⁅(atom true : A R Bool),p⁆ else 0) ?_ hq + intro b + cases b with + | false => exact Submodule.zero_mem _ + | true => + exact above_lie (homogeneous_above (word_mem (FreeMonoid.of true) (degree_of depth true))) hp + +theorem assocIhara_above {p q : A R Bool} {r s : ℕ} (hp : p∈above depth r) (hq : q∈above depth s) : + assocIhara p q∈above depth (r+s) := by + apply (above depth (r+s)).add_mem ?_ (above_lie hp hq) + apply (above depth (r+s)).sub_mem + · simpa only [Nat.add_comm] using assocD_above hp hq + · exact assocD_above hq hp + +theorem ihara_above {p q : FreeLieAlgebra R Bool} {r s : ℕ} + (hp : embed p∈above depth r) (hq : embed q∈above depth s) : + embed (ihara p q)∈above depth (r+s) := by + rw [embed_ihara] + exact assocIhara_above hp hq + +theorem assocD_homogeneous {wt : Bool → ℕ} {p q : A R Bool} {n m : ℕ} + (hp : p∈homogeneous wt n) (hq : q∈homogeneous wt m) : + assocD p q∈homogeneous wt (m+n) := by + apply deriv_homogeneous (c:=n) (f:=fun b => if b then ⁅(atom true : A R Bool),p⁆ else 0) ?_ hq + intro b + cases b with + | false => exact Submodule.zero_mem _ + | true => exact homogeneous_lie (word_mem (FreeMonoid.of true) (degree_of wt true)) hp + +theorem ihara_homogeneous {wt : Bool → ℕ} {p q : FreeLieAlgebra R Bool} {n m : ℕ} + (hp : embed p∈homogeneous wt n) (hq : embed q∈homogeneous wt m) : + embed (ihara p q)∈homogeneous wt (n+m) := by + rw [embed_ihara] + apply (homogeneous wt (n+m)).add_mem ?_ (homogeneous_lie hp hq) + apply (homogeneous wt (n+m)).sub_mem + · simpa only [Nat.add_comm] using assocD_homogeneous hp hq + · exact assocD_homogeneous hq hp + +end + +open LieAlgebra +variable {R : Type*} [CommRing R] +local notation "FL" => FreeLieAlgebra R Bool +local notation "Der" => LieDerivation R FL FL + +@[simp] theorem D_zero : D (0 : FL)=0 := by + apply FreeDerivations.ext + intro b + cases b <;> simp [D] + +@[simp] theorem D_add (p q : FL) : D (p+q)=D p+D q := by + apply FreeDerivations.ext + intro b + cases b <;> simp [D,lie_add] + +@[simp] theorem D_smul (c : R) (p : FL) : D (c • p)=c • D p := by + apply FreeDerivations.ext + intro b + cases b <;> simp [D,lie_smul] + +def Dlinear : FL →ₗ[R] Der where + toFun := D + map_add' := D_add + map_smul' := D_smul + +@[simp] theorem D_of_false (p : FL) : D p (FreeLieAlgebra.of R false)=0 := by simp [D] +@[simp] theorem D_of_true (p : FL) : D p (FreeLieAlgebra.of R true)=⁅FreeLieAlgebra.of R true,p⁆ := by simp [D] + +theorem D_ihara (p q : FL) : D (ihara p q)=⁅D p,D q⁆ := by + apply FreeDerivations.ext + intro b + cases b with + | false => simp + | true => + simp only [D_of_true,LieDerivation.lie_apply,LieDerivation.apply_lie_eq_add] + simp only [ihara,lie_add,lie_sub] + rw [leibniz_lie,←lie_skew p ⁅FreeLieAlgebra.of R true,q⁆] + abel + +abbrev Ambient (R : Type*) [CommRing R] := + SemiDirectSum (FreeLieAlgebra R Bool) (LieDerivation R (FreeLieAlgebra R Bool) (FreeLieAlgebra R Bool)) LieHom.id + +def graph : LieSubalgebra R (Ambient R) where + carrier := {p | p.right=D p.left} + zero_mem' := D_zero.symm + add_mem' := by + intro p q hp hq + change p.right+q.right=D (p.left+q.left) + rw [D_add,hp,hq] + smul_mem' := by + intro c p hp + change c • p.right=D (c • p.left) + rw [D_smul,hp] + lie_mem' := by + intro p q hp hq + change ⁅p.right,q.right⁆=D (⁅p.left,q.left⁆+p.right q.left-q.right p.left) + rw [hp,hq,←D_ihara] + congr 1 + unfold ihara + abel + +abbrev Algebra (R : Type*) [CommRing R] := graph (R:=R) + +def erase : Algebra R ≃ₗ[R] FL where + toFun p := p.val.left + invFun p := ⟨⟨p,D p⟩,rfl⟩ + left_inv p := by + apply Subtype.ext + change (⟨p.val.left,D p.val.left⟩ : Ambient R)=p.val + apply SemiDirectSum.ext + · rfl + · exact p.property.symm + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +theorem erase_lie (p q : Algebra R) : erase ⁅p,q⁆=ihara (erase p) (erase q) := by + change ⁅p.val.left,q.val.left⁆+p.val.right q.val.left-q.val.right p.val.left=_ + rw [p.property,q.property] + change ⁅p.val.left,q.val.left⁆+D p.val.left q.val.left-D q.val.left p.val.left = + D p.val.left q.val.left-D q.val.left p.val.left+⁅p.val.left,q.val.left⁆ + abel + +variable {α : Type*} + +def lift (f : α → FL) : FreeLieAlgebra R α →ₗ⁅R⁆ Algebra R := + FreeLieAlgebra.lift R (fun a => erase.symm (f a)) + +def evalIhara (f : α → FL) : FreeLieAlgebra R α →ₗ[R] FL := erase.toLinearMap.comp (lift f).toLinearMap + +@[simp] theorem evalIhara_of (f : α → FL) (a : α) : evalIhara f (FreeLieAlgebra.of R a)=f a := by + simp [evalIhara,lift] + +theorem evalIhara_lie (f : α → FL) (p q : FreeLieAlgebra R α) : + evalIhara f ⁅p,q⁆=ihara (evalIhara f p) (evalIhara f q) := by + change erase (lift f ⁅p,q⁆)=_ + rw [LieHom.map_lie,erase_lie] + rfl + +end GenericIhara + +namespace LatticeDimension +open scoped TensorProduct +variable {ι : Type*} + +def cast : (ι → ℤ) →ₗ[ℤ] (ι → ℚ) where + toFun u i := u i + map_add' _ _ := by ext; simp + map_smul' _ _ := by ext; simp + +@[simp] theorem cast_apply (u : ι → ℤ) (i : ι) : cast u i=(u i : ℚ) := rfl + +def lattice (E : Submodule ℚ (ι → ℚ)) : Submodule ℤ (ι → ℤ) := + (E.restrictScalars ℤ).comap cast + +@[simp] theorem mem_lattice (E : Submodule ℚ (ι → ℚ)) (u : ι → ℤ) : + u∈lattice E ↔ cast u∈E := Iff.rfl + +theorem saturated (E : Submodule ℚ (ι → ℚ)) {k : ℤ} (hk : k≠0) {u : ι → ℤ} + (hu : k • u∈lattice E) : u∈lattice E := by + have h : (k : ℚ) • cast u∈E := by + change cast (k • u)∈E at hu + rw [map_smul] at hu + simpa only [Int.cast_smul_eq_zsmul] using hu + exact (E.smul_mem_iff (by exact_mod_cast hk)).mp h + +instance quotient_torsionFree (E : Submodule ℚ (ι → ℚ)) : + Module.IsTorsionFree ℤ ((ι → ℤ) ⧸ lattice E) := by + apply Module.IsTorsionFree.of_smul_eq_zero + intro k u h + by_cases hk : k=0 + · exact Or.inl hk + right + induction u using Submodule.Quotient.induction_on with + | H u => + apply (Submodule.Quotient.mk_eq_zero (lattice E)).mpr + apply saturated E hk + exact (Submodule.Quotient.mk_eq_zero (lattice E)).mp h + +variable [Fintype ι] + +theorem exists_retraction (E : Submodule ℚ (ι → ℚ)) : + ∃ p : (ι → ℤ) →ₗ[ℤ] lattice E,p.comp (lattice E).subtype=LinearMap.id := by + obtain ⟨s,hs⟩ := (lattice E).mkQ.exists_rightInverse_of_surjective + (LinearMap.range_eq_top.mpr (lattice E).mkQ_surjective) + let p : (ι → ℤ) →ₗ[ℤ] (ι → ℤ) := LinearMap.id-s.comp (lattice E).mkQ + have hp (u : ι → ℤ) : p u∈lattice E := by + apply (Submodule.Quotient.mk_eq_zero (lattice E)).mp + change (lattice E).mkQ (p u)=0 + dsimp [p] + have he := LinearMap.congr_fun hs ((lattice E).mkQ u) + simpa using sub_eq_zero.mpr he.symm + refine ⟨p.codRestrict (lattice E) hp,?_⟩ + apply LinearMap.ext + intro u + apply Subtype.ext + have hu0 : (lattice E).mkQ u.val=0 := (Submodule.Quotient.mk_eq_zero _).mpr u.property + change u.val-s ((lattice E).mkQ u.val)=u.val + rw [hu0,map_zero,sub_zero] + +variable (F : Type*) [Field F] + +def scalarMap (E : Submodule ℚ (ι → ℚ)) : F ⊗[ℤ] lattice E →ₗ[F] (ι → F) := + (TensorProduct.piScalarRightHom ℤ F F ι).comp ((lattice E).subtype.baseChange F) + +omit [Fintype ι] in +@[simp] theorem scalarMap_tmul (E : Submodule ℚ (ι → ℚ)) (r : F) (u : lattice E) : + scalarMap F E (r ⊗ₜ u)=fun i => (u.val i : F)*r := by + ext i + simp [scalarMap] + +theorem scalarMap_injective (E : Submodule ℚ (ι → ℚ)) : Function.Injective (scalarMap F E) := by + classical + obtain ⟨p,hp⟩ := exists_retraction E + have hleft : (p.baseChange F).comp ((lattice E).subtype.baseChange F)=LinearMap.id := by + rw [←LinearMap.baseChange_comp,hp,LinearMap.baseChange_id] + have hi : Function.Injective ((lattice E).subtype.baseChange F) := by + apply Function.LeftInverse.injective (f:=((lattice E).subtype.baseChange F)) (g:=p.baseChange F) + intro u + exact LinearMap.congr_fun hleft u + exact (TensorProduct.piScalarRight ℤ F F ι).injective.comp hi + +def reduction (E : Submodule ℚ (ι → ℚ)) : Submodule F (ι → F) := + (scalarMap F E).range + +theorem rational_range (E : Submodule ℚ (ι → ℚ)) : reduction ℚ E=E := by + apply le_antisymm + · rintro v ⟨u,rfl⟩ + induction u using TensorProduct.inductionOn with + + | tmul r u => + have he : scalarMap ℚ E (r ⊗ₜ u)=r • cast u.val := by ext; simp [mul_comm] + rw [he] + exact E.smul_mem r u.property + | add u v hu hv => simpa using E.add_mem hu hv + · intro v hv + obtain ⟨d,hd⟩ := IsLocalization.exist_integer_multiples_of_finite (nonZeroDivisors ℤ) v + choose u hu using hd + have hcast : cast u=(d.val : ℚ) • v := by + ext i + simpa using hu i + have huE : u∈lattice E := by + rw [mem_lattice,hcast] + exact E.smul_mem _ hv + refine ⟨(d.val : ℚ)⁻¹ ⊗ₜ (⟨u,huE⟩ : lattice E),?_⟩ + have hd0 : (d.val : ℚ)≠0 := by exact_mod_cast nonZeroDivisors.ne_zero d.property + ext i + rw [scalarMap_tmul] + have hi := congrFun hcast i + dsimp at hi ⊢ + rw [hi] + field_simp + +theorem finrank_reduction (E : Submodule ℚ (ι → ℚ)) : + Module.finrank F (reduction F E)=Module.finrank ℚ E := by + have hF := (LinearEquiv.ofInjective (scalarMap F E) (scalarMap_injective F E)).finrank_eq + have hQ := (LinearEquiv.ofInjective (scalarMap ℚ E) (scalarMap_injective ℚ E)).finrank_eq + rw [Module.finrank_baseChange] at hF hQ + change _=Module.finrank ℚ (reduction ℚ E) at hQ + rw [rational_range] at hQ + exact hF.symm.trans hQ + +end LatticeDimension + +namespace LieDimension +open AssociativeElimination UniversalEmbedding WordGrading +open scoped TensorProduct +attribute [local instance] LieRing.ofAssociativeRing +variable {α : Type*} +variable (R : Type*) [CommRing R] (wt : α → ℕ) (n : ℕ) + +abbrev Words := {w : FreeMonoid α // degree wt w=n} + +def toWords : LieGrading.homogeneousLie (R:=R) wt n →ₗ[R] homogeneous (R:=R) wt n := + ((embed (R:=R) (α:=α)).toLinearMap.comp (LieGrading.homogeneousLie wt n).subtype).codRestrict + (homogeneous wt n) (fun p => LieGrading.homogeneousLie_embed p.property) + +def coordinates : LieGrading.homogeneousLie (R:=R) wt n →ₗ[R] (Words wt n → R) := + (WordCoordinates.coordinates (fun w => degree wt w=n)).comp (toWords R wt n) + +@[simp] theorem coordinates_apply (p : LieGrading.homogeneousLie (R:=R) wt n) (w : Words wt n) : + coordinates R wt n p w=(embed p.val).coeff w.val := rfl + +theorem coordinates_injective : Function.Injective (coordinates R wt n) := by + intro p q h + have he := WordCoordinates.coordinates_injective (fun w => degree wt w=n) h + apply Subtype.ext + apply UniversalEmbedding.injective + exact congrArg Subtype.val he + +def image : Submodule R (Words wt n → R) := (coordinates R wt n).range + +variable {R wt n} + +theorem words_space {P : FreeMonoid α → Prop} {p : A ℤ α} (hp : p∈space P) : + IntegralBaseChange.words (S:=R) p∈space P := by + apply mem_space + intro w hw + rw [IntegralBaseChange.words_coeff] at hw + apply mem_space_iff.mp hp w + intro h + exact hw (by rw [h,Int.cast_zero]) + +theorem words_space_reflect {P : FreeMonoid α → Prop} {p : A ℤ α} + (hp : IntegralBaseChange.words (S:=ℚ) p∈space P) : p∈space P := by + apply mem_space + intro w hw + apply mem_space_iff.mp hp w + rw [IntegralBaseChange.words_coeff] + exact_mod_cast hw + +def castHom (p : LieGrading.homogeneousLie (R:=ℤ) wt n) : LieGrading.homogeneousLie (R:=R) wt n := + ⟨IntegralBaseChange.lie p.val,LieGrading.homogeneous_iff.mpr (by + rw [IntegralBaseChange.embed_lie] + exact words_space (LieGrading.homogeneousLie_embed p.property))⟩ + +@[simp] theorem coordinates_castHom (p : LieGrading.homogeneousLie (R:=ℤ) wt n) (w : Words wt n) : + coordinates R wt n (castHom p) w=(coordinates ℤ wt n p w : R) := by + simp [castHom,IntegralBaseChange.embed_lie] + +theorem lattice_image (wt : α → ℕ) (n : ℕ) : + LatticeDimension.lattice (image ℚ wt n)=image ℤ wt n := by + apply le_antisymm + · rintro u ⟨p,hp⟩ + have hpint : embed p.val∈IntegralWords.lattice := by + apply IntegralWords.integral_of_coeff + intro w + by_cases hw : degree wt w=n + · refine ⟨u ⟨w,hw⟩,?_⟩ + exact congrFun hp ⟨w,hw⟩ + · exact ⟨0,(coeff_support (LieGrading.homogeneousLie_embed p.property) w hw).trans (Int.cast_zero).symm⟩ + obtain ⟨q,hq⟩ := IntegralBaseChange.lift_integral hpint + have hqm : q∈LieGrading.homogeneousLie wt n := by + apply LieGrading.homogeneous_iff.mpr + apply words_space_reflect + rw [←IntegralBaseChange.embed_lie,hq] + exact LieGrading.homogeneousLie_embed p.property + refine ⟨⟨q,hqm⟩,?_⟩ + ext w + apply Int.cast_injective (α:=ℚ) + change ((embed q).coeff w.val : ℚ)=_ + rw [←IntegralBaseChange.words_coeff,←IntegralBaseChange.embed_lie,hq] + exact congrFun hp w + · rintro u ⟨p,rfl⟩ + refine ⟨castHom (R:=ℚ) p,?_⟩ + ext w + exact coordinates_castHom p w + +theorem cast_eval (t : UniversalEmbedding.Tree α) : IntegralBaseChange.lie (t.eval (R:=ℤ))=t.eval (R:=R) := by + induction t with + | leaf a => simp [Tree.eval] + | node t u ht hu => simp [Tree.eval,ht,hu] + +variable (F : Type*) [Field F] (wt : α → ℕ) (n : ℕ) [Fintype (Words wt n)] + +omit [Fintype (Words wt n)] in +theorem reduction_image : LatticeDimension.reduction F (image ℚ wt n)=image F wt n := by + apply le_antisymm + · rintro v ⟨u,rfl⟩ + induction u using TensorProduct.inductionOn with + + | tmul c u => + have hup : u.val∈image ℤ wt n := by + rw [←lattice_image] + exact u.property + obtain ⟨p,hp⟩ := hup + have he : LatticeDimension.scalarMap F (image ℚ wt n) (c ⊗ₜ u)= + c • coordinates F wt n (castHom p) := by + ext w + rw [LatticeDimension.scalarMap_tmul] + simp only [Pi.smul_apply,smul_eq_mul,coordinates_castHom] + rw [←congrFun hp w,mul_comm] + rw [he] + exact (image F wt n).smul_mem c ⟨castHom p,rfl⟩ + | add u v hu hv => simpa using (image F wt n).add_mem hu hv + · rintro v ⟨p,rfl⟩ + have hgen : ∀ q : FreeLieAlgebra F α,q∈LieGrading.homogeneousLie wt n → + ∀ hq,coordinates F wt n ⟨q,hq⟩∈LatticeDimension.reduction F (image ℚ wt n) := by + intro q hq + induction hq using Submodule.span_induction with + | mem q hq => + obtain ⟨t,ht,rfl⟩ := hq + intro hm + let pZ : LieGrading.homogeneousLie (R:=ℤ) wt n := ⟨t.eval,Submodule.subset_span ⟨t,ht,rfl⟩⟩ + have hpZ : coordinates ℤ wt n pZ∈LatticeDimension.lattice (image ℚ wt n) := by + rw [lattice_image] + exact ⟨pZ,rfl⟩ + refine ⟨(1 : F) ⊗ₜ (⟨coordinates ℤ wt n pZ,hpZ⟩ : LatticeDimension.lattice (image ℚ wt n)),?_⟩ + ext w + rw [LatticeDimension.scalarMap_tmul] + change ((embed (t.eval (R:=ℤ))).coeff w.val : F)*1=(embed (t.eval (R:=F))).coeff w.val + rw [mul_one] + rw [←IntegralBaseChange.words_coeff,←IntegralBaseChange.embed_lie,cast_eval] + | zero => intro hm; change coordinates F wt n 0∈_; simp + | add q r hq hr hi hj => + intro hm + change coordinates F wt n (⟨q,hq⟩+⟨r,hr⟩)∈_ + rw [map_add] + exact (LatticeDimension.reduction F (image ℚ wt n)).add_mem (hi hq) (hj hr) + | smul c q hq hi => + intro hm + change coordinates F wt n (c • ⟨q,hq⟩)∈_ + rw [map_smul] + exact (LatticeDimension.reduction F (image ℚ wt n)).smul_mem c (hi hq) + exact hgen p.val p.property p.property + +instance homogeneous_finite : Module.Finite F (LieGrading.homogeneousLie (R:=F) wt n) := + Module.Finite.of_injective (coordinates F wt n) (coordinates_injective F wt n) + +theorem finrank_homogeneous : + Module.finrank F (LieGrading.homogeneousLie (R:=F) wt n)= + Module.finrank ℚ (LieGrading.homogeneousLie (R:=ℚ) wt n) := by + have hF := (LinearEquiv.ofInjective (coordinates F wt n) (coordinates_injective F wt n)).finrank_eq + have hQ := (LinearEquiv.ofInjective (coordinates ℚ wt n) (coordinates_injective ℚ wt n)).finrank_eq + have h := LatticeDimension.finrank_reduction F (image ℚ wt n) + rw [reduction_image] at h + exact hF.trans (h.trans hQ.symm) + +end LieDimension + +namespace LieGrading +open AssociativeElimination UniversalEmbedding WordGrading +variable {R α : Type*} [CommRing R] + +@[simp] theorem piece_add (wt : α → ℕ) (n : ℕ) (p q : FreeLieAlgebra R α) : + piece wt n (p+q)=piece wt n p+piece wt n q := by + apply UniversalEmbedding.injective + simp only [embed_piece,map_add] + +@[simp] theorem piece_smul (wt : α → ℕ) (n : ℕ) (c : R) (p : FreeLieAlgebra R α) : + piece wt n (c • p)=c • piece wt n p := by + apply UniversalEmbedding.injective + simp only [embed_piece,map_smul] + +def projection (wt : α → ℕ) (n : ℕ) : FreeLieAlgebra R α →ₗ[R] FreeLieAlgebra R α where + toFun := piece wt n + map_add' := piece_add wt n + map_smul' := piece_smul wt n + +theorem piece_homogeneous {wt : α → ℕ} {m : ℕ} {p : FreeLieAlgebra R α} + (hp : p∈homogeneousLie wt m) (n : ℕ) : piece wt n p=if m=n then p else 0 := by + apply UniversalEmbedding.injective + rw [embed_piece,WordGrading.piece_homogeneous (homogeneousLie_embed hp)] + split_ifs <;> simp + +def biPiece (wa wb : α → ℕ) (n r : ℕ) : Submodule R (FreeLieAlgebra R α) := + homogeneousLie wa n ⊓ homogeneousLie wb r + +def components (wa wb : α → ℕ) (n m : ℕ) : + homogeneousLie (R:=R) wa n →ₗ[R] ((r : Fin (m+1)) → biPiece (R:=R) wa wb n r.val) where + toFun p r := ⟨piece wb r.val p.val,⟨homogeneous_iff.mpr (by + rw [embed_piece]; exact project_preserves (homogeneousLie_embed p.property)), + (piece_spec wb r.val p.val).1⟩⟩ + map_add' p q := by ext r; exact piece_add wb r.val p.val q.val + map_smul' c p := by ext r; exact piece_smul wb r.val c p.val + +def assemble (wa wb : α → ℕ) (n m : ℕ) : + ((r : Fin (m+1)) → biPiece (R:=R) wa wb n r.val) →ₗ[R] homogeneousLie (R:=R) wa n where + toFun q := ⟨∑ r,(q r).val,Submodule.sum_mem _ (fun r _ => (q r).property.1)⟩ + map_add' p q := by ext; simp only [Pi.add_apply,Submodule.coe_add,Finset.sum_add_distrib] + map_smul' c p := by ext; simp only [Pi.smul_apply,Submodule.coe_smul,Finset.smul_sum,RingHom.id_apply] + +theorem components_assemble (wa wb : α → ℕ) (n m : ℕ) + (q : (r : Fin (m+1)) → biPiece (R:=R) wa wb n r.val) : + components wa wb n m (assemble wa wb n m q)=q := by + classical + funext r + apply Subtype.ext + change projection wb r.val (∑ s,(q s).val)=(q r).val + rw [map_sum] + simp only [projection,LinearMap.coe_mk,AddHom.coe_mk] + simp_rw [piece_homogeneous (q _).property.2] + simp [Fin.val_inj] + +theorem assemble_components (wa wb : α → ℕ) (n m : ℕ) + (hbound : ∀ w : FreeMonoid α, degree wa w = n → degree wb w ≤ m) + (p : homogeneousLie (R:=R) wa n) : + assemble wa wb n m (components wa wb n m p)=p := by + classical + apply Subtype.ext + apply UniversalEmbedding.injective + change embed (∑ r : Fin (m+1),piece wb r.val p.val)=embed p.val + rw [map_sum] + simp_rw [embed_piece] + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + change (∑ r : Fin (m+1), WordGrading.piece wb r.val (embed p.val)).coeff w=(embed p.val).coeff w + simp only [MonoidAlgebra.coeff_sum,Finsupp.finsetSum_apply,WordGrading.piece,project_coeff] + by_cases hw : degree wa w=n + · have hb := hbound w hw + exact Finset.sum_eq_single (⟨degree wb w,by omega⟩ : Fin (m+1)) + (by intro r _ hr; rw [ite_eq_right (by intro h; apply hr; exact Fin.ext h.symm)]) + (by simp) |>.trans (ite_eq_left rfl) + · have hz := coeff_support (homogeneousLie_embed p.property) w hw + simp [hz] + +def decomposition (wa wb : α → ℕ) (n m : ℕ) + (hbound : ∀ w : FreeMonoid α, degree wa w = n → degree wb w ≤ m) : + homogeneousLie (R:=R) wa n ≃ₗ[R] ((r : Fin (m+1)) → biPiece (R:=R) wa wb n r.val) := + LinearEquiv.ofLinearMap (components wa wb n m) (assemble wa wb n m) + (LinearMap.ext (components_assemble wa wb n m)) + (LinearMap.ext (assemble_components wa wb n m hbound)) + +variable (F : Type*) [Field F] + +theorem finrank_decomposition (wa wb : α → ℕ) (n m : ℕ) + (hbound : ∀ w : FreeMonoid α, degree wa w = n → degree wb w ≤ m) + [Module.Finite F (homogeneousLie (R:=F) wa n)] : + Module.finrank F (homogeneousLie (R:=F) wa n)= + ∑ r : Fin (m+1),Module.finrank F (biPiece (R:=F) wa wb n r.val) := by + let (r : Fin (m+1)) : Module.Finite F (biPiece (R:=F) wa wb n r.val) := + Module.Finite.of_injective (Submodule.inclusion inf_le_left) (Submodule.inclusion_injective _) + rw [(decomposition (R:=F) wa wb n m hbound).finrank_eq,Module.finrank_pi_fintype] + +end LieGrading +end + +namespace FiltrationDimension +variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] [Module.Finite K V] +variable {T : ℕ → Type*} [∀ r,AddCommGroup (T r)] [∀ r,Module K (T r)] [∀ r,Module.Finite K (T r)] + +theorem step (F : ℕ → Submodule K V) (r : ℕ) (f : F r →ₗ[K] T r) + (hk : ∀ p : F r,f p=0 → p.val∈F (r+1)) : + Module.finrank K (F r)≤Module.finrank K (T r)+Module.finrank K (F (r+1)) := by + let g : f.ker →ₗ[K] F (r+1) := + { toFun := fun p => ⟨p.val.val,hk p.val p.property⟩ + map_add' := by intros; rfl + map_smul' := by intros; rfl } + have hi : Function.Injective g := by + intro p q h + apply Subtype.ext + apply Subtype.ext + exact congrArg (fun p : F (r+1) => p.val) h + have hker := LinearMap.finrank_le_finrank_of_injective hi + have hrange := Submodule.finrank_le f.range + have := f.finrank_range_add_finrank_ker + omega + +theorem telescoping (F : ℕ → Submodule K V) (f : (r : ℕ) → F r →ₗ[K] T r) + (hk : ∀ r (p : F r),f r p=0 → p.val∈F (r+1)) (N : ℕ) : + Module.finrank K (F 0)≤(∑ r∈Finset.range N,Module.finrank K (T r))+Module.finrank K (F N) := by + induction N with + | zero => simp + | succ N ih => + have hs := step F N (f N) (hk N) + rw [Finset.sum_range_succ] + omega + +theorem bound (F : ℕ → Submodule K V) (f : (r : ℕ) → F r →ₗ[K] T r) + (hk : ∀ r (p : F r),f r p=0 → p.val∈F (r+1)) (N : ℕ) + (hN : F N=⊥) : Module.finrank K (F 0)≤∑ r∈Finset.range N,Module.finrank K (T r) := by + have h := telescoping F f hk N + rw [hN,finrank_bot,add_zero] at h + exact h + +omit [∀ r,Module.Finite K (T r)] in +theorem range_step (F : ℕ → Submodule K V) (r : ℕ) (f : F r →ₗ[K] T r) + (hk : ∀ p : F r,f p=0 → p.val∈F (r+1)) : + Module.finrank K (F r)≤Module.finrank K f.range+Module.finrank K (F (r+1)) := by + let g : f.ker →ₗ[K] F (r+1) := + { toFun := fun p => ⟨p.val.val,hk p.val p.property⟩ + map_add' := by intros; rfl + map_smul' := by intros; rfl } + have hi : Function.Injective g := by + intro p q h + apply Subtype.ext + apply Subtype.ext + exact congrArg (fun p : F (r+1) => p.val) h + have hker := LinearMap.finrank_le_finrank_of_injective hi + have := f.finrank_range_add_finrank_ker + omega + +theorem surjective_of_equality (F : ℕ → Submodule K V) + (f : (r : ℕ) → F r →ₗ[K] T r) + (hk : ∀ r (p : F r),f r p=0 → p.val∈F (r+1)) (N : ℕ) + (hN : F N=⊥) + (he : Module.finrank K (F 0)=∑ r∈Finset.range N,Module.finrank K (T r)) + (r : ℕ) (hr : r (∑ j∈Finset.range i,Module.finrank K (T j))+Module.finrank K (F i) + have ha : Monotone a := by + apply monotone_nat_of_le_succ + intro i + have hi := step F i (f i) (hk i) + dsimp [a] + rw [Finset.sum_range_succ] + omega + have hends : a 0=a N := by + simp only [a,Finset.range_zero,Finset.sum_empty,zero_add] + rw [hN,finrank_bot,add_zero] + exact he + have hstep : a r=a (r+1) := by + apply le_antisymm (ha (by omega)) + exact (ha (by omega : r+1≤N)).trans (hends.symm.le.trans (ha (Nat.zero_le r))) + have hs := range_step F r (f r) (hk r) + have hle := Submodule.finrank_le (f r).range + have heq : Module.finrank K (f r).range=Module.finrank K (T r) := by + dsimp [a] at hstep + rw [Finset.sum_range_succ] at hstep + omega + exact LinearMap.range_eq_top.mp (Submodule.eq_top_of_finrank_eq heq) +end FiltrationDimension + +section +namespace BaseChangeEquations +variable {R : Type*} [CommRing R] + +def antisymmetryMap : FreeLieAlgebra R Bool →ₗ[R] FreeLieAlgebra R Bool := + LinearMap.id+(eval y x).toLinearMap + +def specialMap : FreeLieAlgebra R Bool →ₗ[R] FreeLieAlgebra R Bool := + (LieAlgebra.ad R _ x).comp (eval y x).toLinearMap+ + (LieAlgebra.ad R _ (-x-y)).comp (eval y (-x-y)).toLinearMap + +def pentagonMap : FreeLieAlgebra R Bool →ₗ[R] GenericBraid.T R (Fin 4) := + let t := GenericBraid.t (R:=R) + (eval (t 0 1) (t 1 2+t 1 3)).toLinearMap+(eval (t 0 2+t 1 2) (t 2 3)).toLinearMap- + (eval (t 1 2) (t 2 3)).toLinearMap-(eval (t 0 1+t 0 2) (t 1 3+t 2 3)).toLinearMap- + (eval (t 0 1) (t 1 2)).toLinearMap + +@[simp] theorem antisymmetryMap_apply (p : FreeLieAlgebra R Bool) : antisymmetryMap p=antisymmetry p := rfl +@[simp] theorem specialMap_apply (p : FreeLieAlgebra R Bool) : specialMap p=special p := rfl +@[simp] theorem pentagonMap_apply (p : FreeLieAlgebra R Bool) : pentagonMap p=pentagon p := rfl + +end BaseChangeEquations +namespace ReducedDimension +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon ImageBound +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 + +instance finite_boolWords (n : ℕ) : Fintype (LieDimension.Words (fun _ : Bool => 1) n) := + (WordCoordinates.finite_degree_finite_alphabet (fun _ : Bool => 1) (by simp) n).fintype + +instance finite_oddWords (n : ℕ) : Fintype (LieDimension.Words oddWeight n) := by + apply Set.Finite.fintype + apply WordCoordinates.finite_degree oddWeight (by intro a; simp [oddWeight]) n + apply (Set.finite_Iic n).subset + intro a ha + change a≤n + change oddWeight a≤n at ha + unfold oddWeight at ha + omega + +def solutions (n : ℕ) : Submodule K (FreeLieAlgebra K Bool) := + LieGrading.homogeneousLie (fun _ => 1) n ⊓ BaseChangeEquations.antisymmetryMap.ker ⊓ + BaseChangeEquations.specialMap.ker ⊓ BaseChangeEquations.pentagonMap.ker + +theorem solutions_hom {n : ℕ} (p : solutions n) : + p.val∈LieGrading.homogeneousLie (fun _ => 1) n := p.property.1.1.1 + +theorem solutions_anti {n : ℕ} (p : solutions n) : BaseChangeEquations.antisymmetry p.val=0 := p.property.1.1.2 + +theorem solutions_special {n : ℕ} (p : solutions n) : BaseChangeEquations.special p.val=0 := p.property.1.2 + +theorem solutions_pentagon {n : ℕ} (p : solutions n) : BaseChangeEquations.pentagon p.val=0 := p.property.2 + +instance finite_solutions (n : ℕ) : Module.Finite K (solutions n) := + Module.Finite.of_injective (Submodule.inclusion (inf_le_left.trans (inf_le_left.trans inf_le_left))) + (Submodule.inclusion_injective _) + +def representation (n : ℕ) (hn : 1 1) n r + +instance finite_oddPiece (n r : ℕ) : Module.Finite K (oddPiece n r) := + Module.Finite.of_injective (Submodule.inclusion inf_le_left) (Submodule.inclusion_injective _) + +def inclusion (n r : ℕ) : oddPiece n r →ₗ[K] A K Bool := + positiveInput.toLinearMap.comp (embed.toLinearMap.comp (oddPiece n r).subtype) + +theorem inclusion_injective (n r : ℕ) : Function.Injective (inclusion n r) := + positiveInput_injective.comp (UniversalEmbedding.injective.comp Subtype.val_injective) + +def leadingMap (n : ℕ) (hn : 1 if b then FreeLieAlgebra.of K Slot.B else FreeLieAlgebra.of K Slot.C) + +theorem restore_erase (p : FreeLieAlgebra K Slot) : + restore (eraseLie p)=LetterRetraction.lie (fun a => a≠Slot.A) p := by + have he : restore.comp eraseLie=LetterRetraction.lie (fun a => a≠Slot.A) := by + apply FreeLieAlgebra.hom_ext + intro a + cases a <;> simp [restore,eraseLie,LetterRetraction.lie] + exact LieHom.congr_fun he p + +theorem graded_kernel (n : ℕ) (hn : 2 a≠Slot.A) + (LieGrading.piece bCount r (representation n (by omega) p.val))=0 := by + rw [←restore_erase] + change restore (leading r (representation n (by omega) p.val))=0 + rw [he,map_zero] + have hproj := ProjectionKernel.leading_projection_kernel hn (representation_under n (by omega) p.val) + (representation_weight (LieGrading.homogeneousLie_embed (solutions_hom p.val)) + (representation_under n (by omega) p.val)) p.property + (solutions_anti p.val) (solutions_special p.val) (solutions_pentagon p.val) hret + have hs := subtract_piece_above p.property + change embed (representation n (by omega) p.val)- + WordGrading.piece bCount r (embed (representation n (by omega) p.val))∈above bCount (r+1) at hs + rw [←LieGrading.embed_piece,hproj,map_zero,sub_zero] at hs + exact hs + +theorem filtration_zero (n : ℕ) (hn : 1 1) w≤n := by + calc + _=w.toList.length := by simp [degree] + _≤degree oddWeight w := WordCoordinates.length_le_degree oddWeight (by intro a; simp [oddWeight]) w + _=n := hw + +theorem finrank_bound (n : ℕ) (hn : 2 1) n n (odd_length_bound n)] + change Module.finrank K (solutions n)≤∑ r : Fin (n+1),Module.finrank K (oddPiece n r.val) + rw [Fin.sum_univ_eq_sum_range (fun r => Module.finrank K (oddPiece n r)) (n+1)] + exact h + +theorem rational_finrank_bound (n : ℕ) (hn : 2 exact ⟨.leaf a,rfl,rfl⟩ + | bracket hp hq hi hj => + obtain ⟨t,ht,rfl⟩ := hi + obtain ⟨u,hu,rfl⟩ := hj + exact ⟨.node t u,by simp only [treeDegree_node,ht,hu],rfl⟩ + +theorem tree_weightedWord (t : UniversalEmbedding.Tree α) : WeightedWord wt (treeDegree wt t) t.eval := by + induction t with + | leaf a => exact .generator a + | node t u ht hu => simpa only [treeDegree_node,UniversalEmbedding.Tree.eval] using WeightedWord.bracket ht hu + +theorem weightPiece_eq (wt : α → ℕ) (n : ℕ) : weightPiece wt n=homogeneousLie (R:=ℚ) wt n := by + unfold weightPiece homogeneousLie + congr 1 + ext p + constructor + · exact weightedWord_tree + · rintro ⟨t,ht,rfl⟩ + rw [←ht] + exact tree_weightedWord t + +end LieGrading +namespace RationalBound +open ReducedDimension +abbrev wt : Bool → ℕ := fun _ => 1 +abbrev Words (n : ℕ) := LieDimension.Words wt n + +def toHom (n : ℕ) : Wn n →ₗ[ℚ] LieGrading.homogeneousLie (R:=ℚ) wt n := + (Wn n).subtype.codRestrict _ (fun p => by + rw [←LieGrading.weightPiece_eq] + exact p.property.2) + +def coordinates (n : ℕ) : Wn n →ₗ[ℚ] (Words n → ℚ) := + (LieDimension.coordinates ℚ wt n).comp (toHom n) + +theorem coordinates_injective (n : ℕ) : Function.Injective (coordinates n) := by + intro p q h + apply Subtype.ext + exact congrArg (fun z : LieGrading.homogeneousLie (R:=ℚ) wt n => z.val) (LieDimension.coordinates_injective ℚ wt n h) + +instance finite_Wn (n : ℕ) : Module.Finite ℚ (Wn n) := + Module.Finite.of_injective (coordinates n) (coordinates_injective n) + +def image (n : ℕ) : Submodule ℚ (Words n → ℚ) := (coordinates n).range + +def reducedCoordinates (n : ℕ) : solutions n →ₗ[K] (Words n → K) := + (LieDimension.coordinates K wt n).comp ((solutions n).subtype.codRestrict _ solutions_hom) + +theorem reducedCoordinates_injective (n : ℕ) : Function.Injective (reducedCoordinates n) := by + intro p q h + apply Subtype.ext + exact congrArg (fun z : LieGrading.homogeneousLie (R:=K) wt n => z.val) (LieDimension.coordinates_injective K wt n h) + +def reducedImage (n : ℕ) : Submodule K (Words n → K) := (reducedCoordinates n).range + +theorem lattice_lift (n : ℕ) (u : LatticeDimension.lattice (image n)) : + ∃ q : LieGrading.homogeneousLie (R:=ℤ) wt n, + LieDimension.coordinates ℤ wt n q=u.val ∧ (LieDimension.castHom (R:=ℚ) q).val∈W := by + obtain ⟨p,hp⟩ := u.property + have hfull : u.val∈LatticeDimension.lattice (LieDimension.image ℚ wt n) := by + exact ⟨toHom n p,hp⟩ + rw [LieDimension.lattice_image] at hfull + obtain ⟨q,hq⟩ := hfull + refine ⟨q,hq,?_⟩ + have he : LieDimension.castHom (R:=ℚ) q=toHom n p := by + apply LieDimension.coordinates_injective ℚ wt n + ext w + rw [LieDimension.coordinates_castHom] + change ((LieDimension.coordinates ℤ wt n q) w : ℚ)=coordinates n p w + rw [hq,congrFun hp w] + rfl + rw [he] + exact p.property.1 + +def reduceLattice (n : ℕ) (hn : 2 + obtain ⟨q,hq,hW⟩ := lattice_lift n u + have he : LatticeDimension.scalarMap K (image n) (c ⊗ₜ u)= + c • reducedCoordinates n (reduceLattice n hn q hW) := by + ext w + rw [LatticeDimension.scalarMap_tmul] + change (u.val w : K)*c=c*(embed (IntegralBaseChange.lie (S:=K) q.val)).coeff w.val + rw [IntegralBaseChange.embed_lie,IntegralBaseChange.words_coeff] + have hh := congrFun hq w + change (embed q.val).coeff w.val=u.val w at hh + rw [hh,mul_comm] + rw [he] + exact (reducedImage n).smul_mem c ⟨reduceLattice n hn q hW,rfl⟩ + | add u v hu hv => simpa using (reducedImage n).add_mem hu hv + +theorem finrank_Wn_le (n : ℕ) (hn : 2 simpa using hw a + | node u v hu hv => simp only [treeDegree_node]; omega + +theorem tree_degree_one {α : Type*} (u : UniversalEmbedding.Tree α) (hu : treeDegree (fun _ => 1) u=1) : + ∃ a,u=.leaf a := by + cases u with + | leaf a => exact ⟨a,rfl⟩ + | node u v => + have h1 := treeDegree_pos (fun _ : α => Nat.zero_lt_one) u + have h2 := treeDegree_pos (fun _ : α => Nat.zero_lt_one) v + simp only [treeDegree_node] at hu + omega + +theorem weight_zero {α : Type*} {wt : α → ℕ} (hw : ∀ a,0 + obtain ⟨u,hu,rfl⟩ := hp + obtain ⟨a,rfl⟩ := tree_degree_one u hu + cases a + · exact ⟨1,0,by simp [Tree.eval,x]⟩ + · exact ⟨0,1,by simp [Tree.eval,y]⟩ + | zero => exact ⟨0,0,by simp⟩ + | add p q _ _ hp hq => + obtain ⟨a,b,rfl⟩ := hp + obtain ⟨c,d,rfl⟩ := hq + exact ⟨a+c,b+d,by simp only [add_smul]; abel⟩ + | smul c p _ hp => + obtain ⟨a,b,rfl⟩ := hp + exact ⟨c*a,c*b,by simp only [smul_add,mul_smul]⟩ + +attribute [local instance] LieRing.ofAssociativeRing + +def edgeValue (a b i j : Fin 4) : ℚ := + if (i=a ∧ j=b) ∨ (i=b ∧ j=a) then 1 else 0 + +def detector (a b : Fin 4) (hab : a≠b) : T4 →ₗ⁅ℚ⁆ ℚ := + T4Universal.lift (edgeValue a b) + (by intros; simp only [edgeValue]; congr 1; apply propext; tauto) + (by + intro i + simp only [edgeValue] + split_ifs with h + · rcases h with h|h + · exact (hab (h.1.symm.trans h.2)).elim + · exact (hab (h.2.symm.trans h.1)).elim + · rfl) + (by intros; simp only [LieRing.of_associative_ring_bracket,mul_comm,sub_self]) + (by intros; simp only [LieRing.of_associative_ring_bracket,mul_comm,sub_self]) + +@[simp] theorem detector_t (a b : Fin 4) (hab : a≠b) (i j : Fin 4) : + detector a b hab (t i j)=edgeValue a b i j := T4Universal.lift_t _ _ _ _ _ _ _ + +theorem weight_one_zero {p : L} (hp : p∈Wn 1) : p=0 := by + obtain ⟨a,b,rfl⟩ := weight_one_form hp.2 + have h := hp.1.2.2 + simp only [eval,map_add,map_smul,FreeLieAlgebra.lift_of_apply,x,y,Bool.false_eq_true,↓reduceIte] at h + have h1 := congrArg (detector 0 1 (by decide)) h + have h2 := congrArg (detector 2 3 (by decide)) h + norm_num [map_add,map_smul,edgeValue,Fin.ext_iff] at h1 h2 + have ha : a=0 := by linarith + have hb : b=0 := by linarith + simp [ha,hb] + +def cyclic : L →ₗ[ℚ] L := LinearMap.id+(eval y (-x-y)).toLinearMap+(eval (-x-y) x).toLinearMap + +theorem cyclic_weight_two {p : L} (hp : p∈Ln 2) : cyclic p=(3 : ℚ) • p := by + simp only [Ln,weightPiece_eq] at hp + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,hu,rfl⟩ := hp + cases u with + | leaf a => simp at hu + | node u v => + have h1 := treeDegree_pos (fun _ : Bool => Nat.zero_lt_one) u + have h2 := treeDegree_pos (fun _ : Bool => Nat.zero_lt_one) v + simp only [treeDegree_node] at hu + obtain ⟨a,rfl⟩ := tree_degree_one u (by omega) + obtain ⟨b,rfl⟩ := tree_degree_one v (by omega) + cases a <;> cases b <;> + simp [Tree.eval,cyclic,eval,x,y,lie_sub,sub_lie,lie_skew,show (3 : ℚ)=(1+1+1) by norm_num,add_smul] + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq,smul_add] + | smul c p _ hp => simp only [map_smul,hp,smul_smul,mul_comm] + +theorem weight_two_zero {p : L} (hp : p∈Wn 2) : p=0 := by + have hc : cyclic p=0 := hp.1.2.1 + rw [cyclic_weight_two hp.2] at hc + exact (smul_eq_zero.mp hc).resolve_left (by norm_num) + +theorem Wn_eq_bot {n : ℕ} (hn : n≤2) : Wn n=⊥ := by + apply le_antisymm ?_ bot_le + intro p hp + change p=0 + interval_cases n + · have h : Ln 0=⊥ := weight_zero (fun _ => by decide) + have hz := hp.2 + rw [h] at hz + exact hz + · exact weight_one_zero hp + · exact weight_two_zero hp + +end LowWeight + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/KZTransport.lean b/lean/OAI/Algebra/Drinfeld/KZTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca6fa9947a4a169f03224d5b8780945194da822c --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/KZTransport.lean @@ -0,0 +1,2415 @@ +import OAI.Algebra.Drinfeld.Ihara + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +namespace GenericIhara +open AssociativeElimination UniversalEmbedding WordGrading LieGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R α : Type*} [CommRing R] + +theorem above_zero {wt : α → ℕ} (p : A R α) : p∈above wt 0 := + mem_space (fun _ _ => Nat.zero_le _) + +theorem tree_depth (u : UniversalEmbedding.Tree Bool) : + u=.leaf false ∨ embed (u.eval : FreeLieAlgebra R Bool)∈above depth 1 := by + induction u with + | leaf a => + cases a with + | false => exact Or.inl rfl + | true => + right + simp only [Tree.eval,AssociativeElimination.embed_of] + exact word_mem (R:=R) (FreeMonoid.of true) (show 1≤degree depth (FreeMonoid.of true) from le_rfl) + | node u v hu hv => + right + rcases hu with rfl|hu + · rcases hv with rfl|hv + · simp only [Tree.eval,lie_self,map_zero,Submodule.zero_mem] + · simpa only [Tree.eval,LieHom.map_lie,Nat.zero_add] using above_lie (above_zero (embed (Tree.eval (R:=R) (.leaf false)))) hv + · simpa only [Tree.eval,LieHom.map_lie,Nat.add_zero] using above_lie hu (above_zero (embed (Tree.eval (R:=R) v))) + +theorem homogeneous_depth {n : ℕ} (hn : 1 1) n) : embed p∈above depth 1 := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨u,hu,rfl⟩ := hp + rcases tree_depth (R:=R) u with rfl|h + · simp only [treeDegree_leaf] at hu + omega + · exact h + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using (above depth 1).add_mem hp hq + | smul c p _ hp => simpa only [map_smul] using (above depth 1).smul_mem c hp + +theorem evalIhara_homogeneous (wt : α → ℕ) (f : α → FreeLieAlgebra R Bool) + (hf : ∀ a,embed (f a)∈homogeneous (fun _ => 1) (wt a)) + {n : ℕ} {p : FreeLieAlgebra R α} (hp : p∈homogeneousLie wt n) : + embed (evalIhara f p)∈homogeneous (fun _ => 1) n := by + have ht : ∀ u : UniversalEmbedding.Tree α, + embed (evalIhara f u.eval)∈homogeneous (fun _ => 1) (treeDegree wt u) := by + intro u + induction u with + | leaf a => simpa only [Tree.eval,evalIhara_of,treeDegree_leaf] using hf a + | node u v hu hv => + simpa only [Tree.eval,evalIhara_lie,treeDegree_node] using ihara_homogeneous hu hv + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨u,hu,rfl⟩ := hp; simpa only [hu] using ht u + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using (homogeneous _ _).add_mem hp hq + | smul c p _ hp => simpa only [map_smul] using (homogeneous _ _).smul_mem c hp + +theorem evalIhara_depth (f : α → FreeLieAlgebra R Bool) + (hf : ∀ a,embed (f a)∈above depth 1) + {n : ℕ} {p : FreeLieAlgebra R α} (hp : p∈homogeneousLie (fun _ => 1) n) : + embed (evalIhara f p)∈above depth n := by + have ht : ∀ u : UniversalEmbedding.Tree α, + embed (evalIhara f u.eval)∈above depth (treeDegree (fun _ => 1) u) := by + intro u + induction u with + | leaf a => simpa only [Tree.eval,evalIhara_of,treeDegree_leaf] using hf a + | node u v hu hv => + simpa only [Tree.eval,evalIhara_lie,treeDegree_node] using ihara_above hu hv + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨u,hu,rfl⟩ := hp; simpa only [hu] using ht u + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using (above _ _).add_mem hp hq + | smul c p _ hp => simpa only [map_smul] using (above _ _).smul_mem c hp + +def depthOneWord (n : ℕ) : FreeMonoid Bool := FreeMonoid.of false^n*FreeMonoid.of true + +theorem degree_depthOneWord (n : ℕ) : degree depth (depthOneWord n)=1 := by + have h : ∀ n,degree depth (FreeMonoid.of false^n)=0 := by + intro n + induction n with + | zero => simp + | succ n hn => simp [pow_succ,hn,depth] + simp [depthOneWord,h,depth] + +theorem depthOne_zero {p : FreeLieAlgebra R Bool} {r : ℕ} (hr : 1 simp + | succ n ih => simp only [pow_succ,degree_mul,ih]; ring + +@[simp] theorem length_depthOne (m : ℕ) : + degree TruncatedWords.wt (GenericIhara.depthOneWord m)=m+1 := by + simp [GenericIhara.depthOneWord,TruncatedWords.wt] + +theorem depth_le_length (w : FreeMonoid Bool) : + degree GenericIhara.depth w≤degree TruncatedWords.wt w := by + induction w using FreeMonoid.inductionOn with + | one => simp + | of b => cases b <;> decide + | mul u v hu hv => simp only [degree_mul]; omega + +def depthSpace (N n : ℕ) : Submodule R (Q R N) := + (above GenericIhara.depth n).map (quotient N).toLinearMap + +theorem depth_antitone (N : ℕ) : Antitone (depthSpace (R:=R) N) := by + intro m n h + exact Submodule.map_mono (space_mono (fun _ hw => le_trans h hw)) + +theorem depth_one (N : ℕ) : (1:Q R N)∈depthSpace N 0 := by + exact ⟨1,word_mem 1 (by simp),map_one (quotient N)⟩ + +theorem depth_mul (N m n : ℕ) {p q : Q R N} (hp : p∈depthSpace N m) (hq : q∈depthSpace N n) : + p*q∈depthSpace N (m+n) := by + obtain ⟨a,ha,rfl⟩ := hp + obtain ⟨b,hb,rfl⟩ := hq + exact ⟨a*b,above_mul ha hb,map_mul (quotient N) _ _⟩ + +theorem depth_terminal (N : ℕ) : depthSpace (R:=R) N (N+1)=⊥ := by + apply eq_bot_iff.mpr + rintro q ⟨p,hp,rfl⟩ + apply TruncatedWords.quotient_above + exact space_mono (fun w hw => le_trans hw (depth_le_length w)) hp + +theorem gen_depth (N : ℕ) (b : Bool) : gen (R:=R) N b∈depthSpace N (GenericIhara.depth b) := by + refine ⟨atom b,?_,rfl⟩ + exact word_mem (FreeMonoid.of b) (by simp) + +theorem gen_weight (N : ℕ) (b : Bool) : gen (R:=R) N b∈TruncatedWords.filtration ∅ N 1 := by + refine ⟨atom b,?_,rfl⟩ + exact word_mem (FreeMonoid.of b) (by simp [TruncatedWords.wt]) + +theorem coeff_zero_of_depth (N n : ℕ) {p : Q R N} (hp : p∈depthSpace N n) + {w : FreeMonoid Bool} (hw : degree GenericIhara.depth w simp only [hz] + +theorem left_power_match (i m : ℕ) (v : FreeMonoid Bool) : + FreeMonoid.of false^i*v=GenericIhara.depthOneWord m ↔ + i ≤ m ∧ v=GenericIhara.depthOneWord (m-i) := by + induction i generalizing m v with + | zero => simp + | succ i ih => + cases m with + | zero => + have hn : FreeMonoid.of false^(i+1)*v≠GenericIhara.depthOneWord 0 := by + intro h + have hh := congrArg FreeMonoid.toList h + simp [pow_succ',mul_assoc,GenericIhara.depthOneWord] at hh + simp [hn] + | succ m => + have he : FreeMonoid.of false^(i+1)*v=GenericIhara.depthOneWord (m+1) ↔ + FreeMonoid.of false^i*v=GenericIhara.depthOneWord m := by + simp only [pow_succ',GenericIhara.depthOneWord,mul_assoc,mul_left_cancel_iff] + rw [he,ih] + simp only [Nat.succ_le_succ_iff,Nat.succ_sub_succ_eq_sub] + +theorem coeff_prefix (N i m : ℕ) (hN : m+1≤N) (p : Q R N) : + coeff N (GenericIhara.depthOneWord m) (gen N false^i*p)= + if i ≤ m then coeff N (GenericIhara.depthOneWord (m-i)) p else 0 := by + classical + obtain ⟨a,rfl⟩ := RingQuot.mkAlgHom_surjective R (TruncatedWords.relations (∅ : Set (A R Bool)) N) p + change coeff N (GenericIhara.depthOneWord m) (quotient N (atom false)^i*quotient N a)=_ + rw [←map_pow,←map_mul,TruncatedFree.coefficient_quotient,ite_eq_left (by simpa using hN)] + have he : atom (R:=R) false^i=MonoidAlgebra.single (FreeMonoid.of false^i) 1 := by + simp [atom,MonoidAlgebra.single_pow] + rw [he] + split_ifs with hi + · rw [MonoidAlgebra.coeff_single_mul_eq_mul_coeff (GenericIhara.depthOneWord (m-i)) + (fun _ _ => by rw [left_power_match]; simp only [hi,true_and]),one_mul] + change _=TruncatedFree.coefficient N (GenericIhara.depthOneWord (m-i)) (TruncatedWords.quotient ∅ N a) + rw [TruncatedFree.coefficient_quotient,ite_eq_left (by simp only [length_depthOne]; omega)] + · exact MonoidAlgebra.coeff_single_mul_of_forall_mul_ne 1 a + (fun v hv => hi ((left_power_match i m v).mp hv).1) + +theorem middle_power_match (i j m : ℕ) : + FreeMonoid.of false^i*FreeMonoid.of true*FreeMonoid.of false^j=GenericIhara.depthOneWord m ↔ + i=m ∧ j=0 := by + rw [mul_assoc,left_power_match] + constructor + · rintro ⟨hi,h⟩ + have hm : m-i=0 := by + cases he : m-i with + | zero => rfl + | succ k => + have hh := congrArg FreeMonoid.toList h + simp [GenericIhara.depthOneWord,he,pow_succ',mul_assoc] at hh + have him : i=m := by omega + subst i + simp only [Nat.sub_self,GenericIhara.depthOneWord,pow_zero,one_mul,mul_eq_left] at h + have hd := congrArg (degree TruncatedWords.wt) h + simp only [degree_pow,degree_of,TruncatedWords.wt,mul_one,degree_one] at hd + exact ⟨rfl,hd⟩ + · rintro ⟨rfl,rfl⟩ + simp [GenericIhara.depthOneWord] + +theorem coeff_monomial (N i j m : ℕ) (hN : m+1 ≤ N) : + coeff N (GenericIhara.depthOneWord m) (gen (R:=R) N false^i*gen N true*gen N false^j)= + if i=m ∧ j=0 then 1 else 0 := by + classical + change coeff N (GenericIhara.depthOneWord m) + (quotient N (atom false)^i*quotient N (atom true)*quotient N (atom false)^j)=_ + rw [←map_pow,←map_pow,←map_mul,←map_mul,TruncatedFree.coefficient_quotient, + ite_eq_left (by simpa using hN)] + simp only [atom,MonoidAlgebra.single_pow,one_pow,MonoidAlgebra.single_mul_single,one_mul] + simp only [MonoidAlgebra.coeff_single,Finsupp.single_apply,middle_power_match] + +theorem coeff_Y_prefix (N i m : ℕ) (hN : m+1 ≤ N) (hm : 0 < m) (p : Q R N) : + coeff N (GenericIhara.depthOneWord m) (gen N true^i*p)= + if i=0 then coeff N (GenericIhara.depthOneWord m) p else 0 := by + classical + cases i with + | zero => simp + | succ i => + simp only [Nat.succ_ne_zero,↓reduceIte] + obtain ⟨a,rfl⟩ := RingQuot.mkAlgHom_surjective R (TruncatedWords.relations (∅ : Set (A R Bool)) N) p + change coeff N (GenericIhara.depthOneWord m) (quotient N (atom true)^(i+1)*quotient N a)=0 + rw [←map_pow,←map_mul,TruncatedFree.coefficient_quotient,ite_eq_left (by simpa using hN)] + have he : atom (R:=R) true^(i+1)=MonoidAlgebra.single (FreeMonoid.of true^(i+1)) 1 := by + simp [atom,MonoidAlgebra.single_pow] + rw [he] + apply MonoidAlgebra.coeff_single_mul_of_forall_mul_ne + intro v hv + obtain ⟨k,rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hm) + have hh := congrArg FreeMonoid.toList hv + simp [pow_succ',GenericIhara.depthOneWord,mul_assoc] at hh + +end CutoffDepth + +section +namespace LogCollar +open MeasureTheory Set Filter +open scoped Topology + +theorem intervalIntegrable_of_at_zero {E : Type*} [NormedAddCommGroup E] + {f : ℝ → E} (h0 : IntegrableAtFilter f (𝓝[>] 0) volume) + (hc : ContinuousOn f (Ioi 0)) {b : ℝ} (hb : 0 ≤ b) : + IntervalIntegrable f volume 0 b := by + obtain rfl | hb := hb.eq_or_lt + · exact IntervalIntegrable.refl + obtain ⟨s,hs,hi⟩ := h0 + obtain ⟨c,hc0,hcs⟩ := mem_nhdsGT_iff_exists_Ioc_subset.mp hs + apply IntervalIntegrable.trans (b:=c) + · exact (intervalIntegrable_iff_integrableOn_Ioc_of_le hc0.le).mpr (hi.mono_set hcs) + · apply ContinuousOn.intervalIntegrable + exact hc.mono (by + intro x hx + have hle : min c b ≤ x := hx.1 + exact lt_of_lt_of_le (lt_min hc0 hb) hle) + +theorem log_pow_at_zero (n : ℕ) : + IntegrableAtFilter (fun x : ℝ => Real.log x ^ n) (𝓝[>] 0) volume := by + have ho : (fun x : ℝ => ‖Real.log x ^ n‖) =O[𝓝[>] 0] (fun x : ℝ => x ^ (-(1/2):ℝ)) := by + simpa only [norm_pow,Real.norm_eq_abs,Real.rpow_natCast] using + (isLittleO_abs_log_rpow_rpow_nhdsGT_zero (n:ℝ) (by norm_num : (-(1/2):ℝ)<0)).isBigO + apply ho.of_norm_left.integrableAtFilter + · exact (Real.measurable_log.pow_const n).stronglyMeasurable.stronglyMeasurableAtFilter + · refine ⟨Ioc 0 1,Ioc_mem_nhdsGT (by norm_num),?_⟩ + exact (intervalIntegrable_iff_integrableOn_Ioc_of_le (by norm_num : (0:ℝ)≤1)).mp + (intervalIntegral.intervalIntegrable_rpow' (by norm_num : (-1:ℝ)< -(1/2))) + +theorem log_pow (n : ℕ) {b : ℝ} (hb : 0 ≤ b) : + IntervalIntegrable (fun x : ℝ => Real.log x ^ n) volume 0 b := by + apply intervalIntegrable_of_at_zero (log_pow_at_zero n) _ hb + exact (Real.continuousOn_log.mono (by intro x hx; exact ne_of_gt hx)).pow n + +end LogCollar + +namespace KZCollar +open MeasureTheory Set Filter FinitePicard +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def gauge (X : A) (s : ℝ) : A := NormedSpace.exp (Real.log s • X) + +def regularForm (X Y : A) (s : ℝ) : A := + gauge (-X) s * ((s-1)⁻¹ • Y) * gauge X s + +theorem exp_smul_finite (X : A) {N : ℕ} (hX : X^(N+1)=0) (t : ℝ) : + NormedSpace.exp (t • X)=∑ i∈Finset.range (N+1), + (t^i / (i.factorial : ℝ)) • X^i := by + rw [NormedSpace.exp_eq_tsum ℝ] + simp only [smul_pow,smul_smul] + have hh : ∀ i∉Finset.range (N+1),((i.factorial : ℝ)⁻¹*t^i) • X^i=0 := by + intro i hi + have hi : N + 1 ≤ i := Nat.le_of_not_lt (by simpa using hi) + rw [pow_eq_zero_of_le hi hX,smul_zero] + rw [tsum_eq_sum hh] + apply Finset.sum_congr rfl + intro i hi + congr 1 + ring + +theorem gauge_finite (X : A) {N : ℕ} (hX : X^(N+1)=0) (s : ℝ) : + gauge X s=∑ i∈Finset.range (N+1), + (Real.log s^i / (i.factorial : ℝ)) • X^i := exp_smul_finite X hX _ + +variable [CompleteSpace A] + +theorem gauge_neg_mul (X : A) (s : ℝ) : gauge (-X) s*gauge X s=1 := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + unfold gauge + rw [smul_neg,←NormedSpace.exp_add_of_commute (Commute.refl _).neg_left,neg_add_cancel, + NormedSpace.exp_zero] + +theorem gauge_mul_neg (X : A) (s : ℝ) : gauge X s*gauge (-X) s=1 := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + unfold gauge + rw [smul_neg,←NormedSpace.exp_add_of_commute (Commute.refl _).neg_right,add_neg_cancel, + NormedSpace.exp_zero] + +theorem gauge_derivative (X : A) {s : ℝ} (hs : s≠0) : + HasDerivAt (gauge X) (s⁻¹ • (X*gauge X s)) s := by + exact (hasDerivAt_exp_smul_const' X (Real.log s)).scomp s (Real.hasDerivAt_log hs) + +omit [CompleteSpace A] in +theorem regularForm_finite (X Y : A) {N : ℕ} (hX : X^(N+1)=0) (s : ℝ) : + regularForm X Y s=∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), + ((Real.log s)^(i+j) * ((-1:ℝ)^i / ((i.factorial:ℝ)*(j.factorial:ℝ))) * (s-1)⁻¹) • (X^i*Y*X^j) := by + have hnX : (-X)^(N+1)=0 := by rw [neg_pow,hX,mul_zero] + unfold regularForm + rw [gauge_finite (-X) hnX,gauge_finite X hX] + rw [Finset.sum_mul, Finset.sum_mul] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j hj + rw [neg_pow] + simp only [smul_mul_assoc,mul_smul_comm,smul_smul] + have hp : (-1:A)^i*X^i*Y*X^j=(-1:ℝ)^i • (X^i*Y*X^j) := by + simp only [Algebra.smul_def,map_pow,map_neg,map_one] + noncomm_ring + rw [hp,smul_smul] + congr 1 + rw [pow_add] + ring + +omit [CompleteSpace A] in + +theorem regularForm_integrable (X Y : A) {N : ℕ} (hX : X^(N+1)=0) + {b : ℝ} (hb : 0 ≤ b) (hb1 : b < 1) : + IntervalIntegrable (regularForm X Y) volume 0 b := by + have hc : ContinuousOn (fun s : ℝ => (s-1)⁻¹) (uIcc 0 b) := by + apply (continuousOn_id.sub continuousOn_const).inv₀ + intro s hs + rw [uIcc_of_le hb] at hs + exact ne_of_lt (sub_neg.mpr (lt_of_le_of_lt hs.2 hb1)) + have h : regularForm X Y = fun s => ∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), + ((Real.log s)^(i+j) * ((-1:ℝ)^i / ((i.factorial:ℝ)*(j.factorial:ℝ))) * (s-1)⁻¹) • (X^i*Y*X^j) := by + funext s + exact regularForm_finite X Y hX s + rw [h] + have hh (i j : ℕ) : IntervalIntegrable (fun s => + ((Real.log s)^(i+j) * ((-1:ℝ)^i / ((i.factorial:ℝ)*(j.factorial:ℝ))) * (s-1)⁻¹) • (X^i*Y*X^j)) volume 0 b := + (((LogCollar.log_pow (i+j) hb).mul_const _).mul_continuousOn hc).smul_continuousOn + continuousOn_const + have hz := IntervalIntegrable.sum (ε:=A) (Finset.range (N+1)) + (fun i _ => IntervalIntegrable.sum (ε:=A) (Finset.range (N+1)) (fun j _ => hh i j)) + have he : (∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1),fun s => + ((Real.log s)^(i+j) * ((-1:ℝ)^i / ((i.factorial:ℝ)*(j.factorial:ℝ))) * (s-1)⁻¹) • (X^i*Y*X^j)) = + (fun s => ∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), + ((Real.log s)^(i+j) * ((-1:ℝ)^i / ((i.factorial:ℝ)*(j.factorial:ℝ))) * (s-1)⁻¹) • (X^i*Y*X^j)) := by + ext s + simp only [Finset.sum_apply] + rw [he] at hz + exact hz + +theorem regularForm_continuous (X Y : A) {b : ℝ} (hb : b ≤ 1) : + ContinuousOn (regularForm X Y) (Ioo 0 b) := by + intro s hs + have hg : ∀ Z : A, ContinuousAt (gauge Z) s := fun Z => + (gauge_derivative Z (ne_of_gt hs.1)).continuousAt + have hinv : ContinuousAt (fun s : ℝ => (s-1)⁻¹) s := by + apply (continuousAt_id.sub continuousAt_const).inv₀ + exact ne_of_lt (sub_neg.mpr (lt_of_lt_of_le hs.2 hb)) + exact (((hg (-X)).mul (hinv.smul continuousAt_const)).mul (hg X)).continuousWithinAt + +omit [CompleteSpace A] in +theorem regularForm_mem (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) (s : ℝ) : + regularForm X Y s ∈ F.space 1 := by + rw [regularForm_finite X Y (pow_cutoff_eq_zero F hX)] + apply Submodule.sum_mem + intro i hi + apply Submodule.sum_mem + intro j hj + apply Submodule.smul_mem + apply F.antitone (by omega : 1 ≤ i+1+j) + exact F.mul_mem (i+1) j (F.mul_mem i 1 (pow_mem F hX i) hY) (pow_mem F hX j) + +def normalizedSolution (F : NilpotentFiltration A) (X Y : A) (s : ℝ) : A := + gauge X s * transport (regularForm X Y) 0 F.cutoff s + +variable [FiniteDimensional ℝ A] + +theorem normalizedSolution_derivative (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) {b s : ℝ} + (hb : b < 1) (hs : s ∈ Ioo 0 b) : + HasDerivAt (normalizedSolution F X Y) + ((s⁻¹ • X + (s-1)⁻¹ • Y) * normalizedSolution F X Y s) s := by + have hreg := regularForm_integrable X Y (pow_cutoff_eq_zero F hX) + (le_trans hs.1.le hs.2.le) hb + have hsol := derivative_nilpotent_transport F (regularForm_mem F hX hY) + hreg (regularForm_continuous X Y hb.le) hs + apply ((gauge_derivative X (ne_of_gt hs.1)).mul hsol).congr_deriv + let P := transport (regularForm X Y) 0 F.cutoff s + change (s⁻¹ • (X*gauge X s))*P + + gauge X s*((gauge (-X) s*((s-1)⁻¹ • Y)*gauge X s)*P) = + (s⁻¹ • X+(s-1)⁻¹ • Y)*(gauge X s*P) + rw [←mul_assoc (gauge X s),←mul_assoc (gauge X s),←mul_assoc (gauge X s),gauge_mul_neg,one_mul] + simp only [add_mul,smul_mul_assoc,mul_assoc] + +omit [FiniteDimensional ℝ A] in +theorem normalizedSolution_limit (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) {b : ℝ} (hb : 0 < b) (hb1 : b < 1) : + Tendsto (fun s => gauge (-X) s * normalizedSolution F X Y s) + (𝓝[>] 0) (𝓝 (1:A)) := by + have hh : (fun s => gauge (-X) s * normalizedSolution F X Y s) = + transport (regularForm X Y) 0 F.cutoff := by + funext s + simp only [normalizedSolution,←mul_assoc,gauge_neg_mul,one_mul] + rw [hh] + have h := collar_limit (regularForm_integrable X Y (pow_cutoff_eq_zero F hX) hb.le hb1) F.cutoff + rw [uIcc_of_le hb.le] at h + rw [nhdsWithin_Icc_eq_nhdsGE hb] at h + exact h.mono_left (nhdsWithin_mono _ Ioi_subset_Ici_self) + +end KZCollar + +namespace FinitePicard +open MeasureTheory Set intervalIntegral +open scoped Ring +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +variable [FiniteDimensional ℝ A] + +theorem transport_sub_one_mem (F : NilpotentFiltration A) {Ω : ℝ → A} + (hΩ : ∀ t, Ω t ∈ F.space 1) (a t : ℝ) (N : ℕ) : + transport Ω a N t-1 ∈ F.space 1 := by + simp only [transport,Finset.sum_range_succ',term_zero,add_sub_cancel_right] + apply Submodule.sum_mem + intro n hn + exact F.antitone (by omega : 1 ≤ n+1) (term_mem F hΩ a (n+1) t) + +theorem transport_isUnit (F : NilpotentFiltration A) {Ω : ℝ → A} + (hΩ : ∀ t, Ω t ∈ F.space 1) (a t : ℝ) (N : ℕ) : + IsUnit (transport Ω a N t) := by + have hn : IsNilpotent (transport Ω a N t-1) := + ⟨F.cutoff+1,pow_cutoff_eq_zero F (transport_sub_one_mem F hΩ a t N)⟩ + simpa only [sub_add_cancel] using hn.isUnit_add_one + +omit [FiniteDimensional ℝ A] in +theorem inverse_derivative [CompleteSpace A] {f : ℝ → A} {f' : A} {s : ℝ} + (hf : HasDerivAt f f' s) (hu : IsUnit (f s)) : + HasDerivAt (fun s => Ring.inverse (f s)) (-(Ring.inverse (f s)*f'*Ring.inverse (f s))) s := by + have h := hasFDerivAt_ringInverse (𝕜:=ℝ) hu.unit + rw [hu.unit_spec] at h + have hh := h.comp_hasDerivAt s hf + simpa only [neg_apply,ContinuousLinearMap.mulLeftRight_apply, + ←Ring.inverse_of_isUnit hu] using! hh + +omit [FiniteDimensional ℝ A] in + +theorem transition_derivative [CompleteSpace A] {f g Ω : ℝ → A} {s : ℝ} + (hf : HasDerivAt f (Ω s*f s) s) (hg : HasDerivAt g (Ω s*g s) s) + (hu : IsUnit (f s)) : + HasDerivAt (fun s => Ring.inverse (f s)*g s) 0 s := by + apply ((inverse_derivative hf hu).mul hg).congr_deriv + simp only [mul_assoc,neg_mul] + rw [←mul_assoc (f s),Ring.mul_inverse_cancel _ hu,one_mul,neg_add_cancel] + +omit [FiniteDimensional ℝ A] in +theorem transition_constant [CompleteSpace A] {f g Ω : ℝ → A} {a b u v : ℝ} + (hf : ∀ s ∈ Ioo a b, HasDerivAt f (Ω s*f s) s) + (hg : ∀ s ∈ Ioo a b, HasDerivAt g (Ω s*g s) s) + (hu : ∀ s ∈ Ioo a b, IsUnit (f s)) (huv : u ∈ Ioo a b) (hvv : v ∈ Ioo a b) : + Ring.inverse (f u)*g u=Ring.inverse (f v)*g v := by + have hh : ∀ s ∈ Ioo a b, HasDerivAt (fun s => Ring.inverse (f s)*g s) 0 s := + fun s hs => transition_derivative (hf s hs) (hg s hs) (hu s hs) + apply isOpen_Ioo.is_const_of_deriv_eq_zero isPreconnected_Ioo + (fun s hs => (hh s hs).differentiableAt.differentiableWithinAt) _ huv hvv + intro s hs + exact (hh s hs).deriv + +end FinitePicard + +namespace KZCollar +open MeasureTheory Set Filter FinitePicard +open scoped Topology Ring +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] + +def bulkForm (X Y : A) (s : ℝ) : A := s⁻¹ • X+(s-1)⁻¹ • Y + +def gaugeUnit (X : A) (s : ℝ) : Aˣ where + val := gauge X s + inv := gauge (-X) s + val_inv := gauge_mul_neg X s + inv_val := gauge_neg_mul X s + +variable [FiniteDimensional ℝ A] + +theorem normalizedSolution_isUnit (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) (s : ℝ) : + IsUnit (normalizedSolution F X Y s) := + (gaugeUnit X s).isUnit.mul (transport_isUnit F (regularForm_mem F hX hY) 0 s F.cutoff) + +theorem normalizedSolution_derivative_on (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) {s : ℝ} (hs : s ∈ Ioo 0 1) : + HasDerivAt (normalizedSolution F X Y) + (bulkForm X Y s * normalizedSolution F X Y s) s := by + apply normalizedSolution_derivative F hX hY (b:=(s+1)/2) + · linarith [hs.2] + · exact ⟨hs.1,by linarith [hs.2]⟩ + +def rightSolution (F : NilpotentFiltration A) (X Y : A) (s : ℝ) : A := + normalizedSolution F Y X (1-s) + +theorem rightSolution_isUnit (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) (s : ℝ) : + IsUnit (rightSolution F X Y s) := normalizedSolution_isUnit F hY hX (1-s) + +theorem rightSolution_derivative (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) {s : ℝ} (hs : s ∈ Ioo 0 1) : + HasDerivAt (rightSolution F X Y) + (bulkForm X Y s*rightSolution F X Y s) s := by + have ht : 1-s ∈ Ioo (0:ℝ) 1 := ⟨by linarith [hs.2],by linarith [hs.1]⟩ + have hd := (normalizedSolution_derivative_on F hY hX ht).scomp s + ((hasDerivAt_const s (1:ℝ)).sub (hasDerivAt_id s)) + apply hd.congr_deriv + change (0-1:ℝ) • (bulkForm Y X (1-s)*rightSolution F X Y s) = _ + have h1 : 1-s= -(s-1) := by ring + have h2 : 1-s-1= -s := by ring + dsimp only [bulkForm] + rw [h2,h1] + simp only [inv_neg,zero_sub,neg_smul,one_smul,neg_add_rev,neg_neg,neg_mul,add_mul] + +def associator (F : NilpotentFiltration A) (X Y : A) : A := + Ring.inverse (rightSolution F X Y (1/2))*normalizedSolution F X Y (1/2) + +theorem associator_is_transition (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) {s : ℝ} (hs : s ∈ Ioo 0 1) : + Ring.inverse (rightSolution F X Y s)*normalizedSolution F X Y s=associator F X Y := by + exact transition_constant (fun _ ht => rightSolution_derivative F hX hY ht) + (fun _ ht => normalizedSolution_derivative_on F hX hY ht) + (fun t _ => rightSolution_isUnit F hX hY t) hs (by constructor <;> norm_num) + +theorem left_eq_right_mul_associator (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) {s : ℝ} (hs : s ∈ Ioo 0 1) : + normalizedSolution F X Y s=rightSolution F X Y s*associator F X Y := by + rw [←associator_is_transition F hX hY hs] + exact (Ring.mul_inverse_cancel_left _ _ (rightSolution_isUnit F hX hY s)).symm + +theorem associator_isUnit (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) : IsUnit (associator F X Y) := by + apply IsUnit.mul + · exact (rightSolution_isUnit F hX hY (1/2)).ringInverse + · exact normalizedSolution_isUnit F hX hY (1/2) + +end KZCollar + +namespace FinitePicard +open MeasureTheory Set intervalIntegral +variable {A B : Type*} [NormedRing A] [NormedAlgebra ℝ A] [NormedRing B] [NormedAlgebra ℝ B] +variable [FiniteDimensional ℝ A] [CompleteSpace B] + +theorem map_term (f : A →ₐ[ℝ] B) {Ω : ℝ → A} {a b : ℝ} + (hi : IntervalIntegrable Ω volume a b) (N : ℕ) {t : ℝ} (ht : t ∈ uIcc a b) : + f (term Ω a N t)=term (fun s => f (Ω s)) a N t := by + induction N generalizing t with + | zero => simp + | succ N ih => + rw [term_succ,term_succ] + let fc := f.toLinearMap.toContinuousLinearMap + have hi' : IntervalIntegrable (fun s => Ω s * term Ω a N s) volume a t := + (hi.mul_continuousOn (continuousOn_term hi N)).mono_set (uIcc_subset_uIcc_left ht) + change fc (∫ s in a..t, Ω s * term Ω a N s)=_ + rw [←fc.intervalIntegral_comp_comm hi'] + apply intervalIntegral.integral_congr + intro s hs + have hst : s ∈ uIcc a b := uIcc_subset_uIcc_left ht hs + change f (Ω s*term Ω a N s)=f (Ω s)*term (fun s => f (Ω s)) a N s + rw [map_mul,ih hst] + +theorem map_transport (f : A →ₐ[ℝ] B) {Ω : ℝ → A} {a b : ℝ} + (hi : IntervalIntegrable Ω volume a b) (N : ℕ) {t : ℝ} (ht : t ∈ uIcc a b) : + f (transport Ω a N t)=transport (fun s => f (Ω s)) a N t := by + simp only [transport,map_sum] + exact Finset.sum_congr rfl (fun n _ => map_term f hi n ht) + +end FinitePicard + +namespace KZCollar +open MeasureTheory Set Filter FinitePicard +variable {A B : Type*} [NormedRing A] [NormedAlgebra ℝ A] [NormedRing B] [NormedAlgebra ℝ B] + +theorem map_gauge (f : A →ₐ[ℝ] B) (X : A) {N : ℕ} (hX : X^(N+1)=0) (s : ℝ) : + f (gauge X s)=gauge (f X) s := by + have hY : (f X)^(N+1)=0 := by rw [←map_pow,hX,map_zero] + rw [gauge_finite X hX,gauge_finite (f X) hY] + simp only [map_sum,map_smul,map_pow] + +theorem map_regularForm (f : A →ₐ[ℝ] B) (X Y : A) {N : ℕ} (hX : X^(N+1)=0) (s : ℝ) : + f (regularForm X Y s)=regularForm (f X) (f Y) s := by + have hN : (-X)^(N+1)=0 := by rw [neg_pow,hX,mul_zero] + simp only [regularForm,map_mul,map_smul,map_gauge f X hX,map_gauge f (-X) hN,map_neg] + +variable [FiniteDimensional ℝ A] [CompleteSpace B] + +theorem map_normalizedSolution (f : A →ₐ[ℝ] B) + (F : NilpotentFiltration A) (G : NilpotentFiltration B) (hN : F.cutoff=G.cutoff) + {X : A} (hX : X ∈ F.space 1) (Y : A) {s : ℝ} (hs : 0 ≤ s) (hs1 : s < 1) : + f (normalizedSolution F X Y s)=normalizedSolution G (f X) (f Y) s := by + have hi := regularForm_integrable X Y (pow_cutoff_eq_zero F hX) hs hs1 + simp only [normalizedSolution,map_mul,map_gauge f X (pow_cutoff_eq_zero F hX)] + rw [map_transport f hi F.cutoff right_mem_uIcc,hN] + have hh : (fun s => f (regularForm X Y s))=regularForm (f X) (f Y) := by + funext s + exact map_regularForm f X Y (pow_cutoff_eq_zero F hX) s + rw [hh] + +omit [FiniteDimensional ℝ A] [CompleteSpace B] in +theorem map_unit_inverse (f : A →ₐ[ℝ] B) {x : A} (hx : IsUnit x) : + f (Ring.inverse x)=Ring.inverse (f x) := by + calc + f (Ring.inverse x)=f (Ring.inverse x)*(f x*Ring.inverse (f x)) := by + rw [Ring.mul_inverse_cancel _ (hx.map f),mul_one] + _ = (f (Ring.inverse x)*f x)*Ring.inverse (f x) := (mul_assoc _ _ _).symm + _ = Ring.inverse (f x) := by rw [←map_mul,Ring.inverse_mul_cancel _ hx,map_one,one_mul] + +variable [CompleteSpace A] + +theorem map_associator (f : A →ₐ[ℝ] B) + (F : NilpotentFiltration A) (G : NilpotentFiltration B) (hN : F.cutoff=G.cutoff) + {X Y : A} (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) : + f (associator F X Y)=associator G (f X) (f Y) := by + rw [associator,map_mul,map_unit_inverse f (rightSolution_isUnit F hX hY (1/2))] + unfold rightSolution + rw [map_normalizedSolution f F G hN hY X (by norm_num) (by norm_num), + map_normalizedSolution f F G hN hX Y (by norm_num) (by norm_num)] + rfl + +end KZCollar + +namespace FinitePicard +open MeasureTheory Set +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] + +theorem transition_constant_closed {f g Ω : ℝ → A} {a b u v : ℝ} (hab : a < b) + (hf : ∀ s ∈ Ioo a b, HasDerivAt f (Ω s*f s) s) + (hg : ∀ s ∈ Ioo a b, HasDerivAt g (Ω s*g s) s) + (hfc : ContinuousOn f (Icc a b)) (hgc : ContinuousOn g (Icc a b)) + (hu : ∀ s ∈ Icc a b, IsUnit (f s)) (huv : u ∈ Icc a b) (hvv : v ∈ Icc a b) : + Ring.inverse (f u)*g u=Ring.inverse (f v)*g v := by + let c := (a+b)/2 + have hc : c ∈ Ioo a b := ⟨by dsimp [c]; linarith,by dsimp [c]; linarith⟩ + have he : EqOn (fun s => Ring.inverse (f s)*g s) + (fun _ => Ring.inverse (f c)*g c) (Ioo a b) := by + intro s hs + exact transition_constant hf hg (fun s hs => hu s ⟨hs.1.le,hs.2.le⟩) hs hc + have hi : ContinuousOn (fun s => Ring.inverse (f s)) (Icc a b) := by + intro s hs + have hh := NormedRing.inverse_continuousAt (hu s hs).unit + rw [(hu s hs).unit_spec] at hh + exact hh.comp_continuousWithinAt (hfc s hs) + have he' := he.of_subset_closure (hi.mul hgc) continuousOn_const Ioo_subset_Icc_self + (by rw [closure_Ioo hab.ne]) + exact (he' huv).trans (he' hvv).symm + +variable [FiniteDimensional ℝ A] + +theorem transport_eq_fundamental (F : NilpotentFiltration A) {Ω f : ℝ → A} + (hΩ : ∀ s, Ω s ∈ F.space 1) {a b : ℝ} (hab : a < b) + (hi : IntervalIntegrable Ω volume a b) (hc : ContinuousOn Ω (Ioo a b)) + (hf : ∀ s ∈ Ioo a b, HasDerivAt f (Ω s*f s) s) + (hfc : ContinuousOn f (Icc a b)) (hu : ∀ s ∈ Icc a b, IsUnit (f s)) : + transport Ω a F.cutoff b=f b*Ring.inverse (f a) := by + have hcont := continuousOn_transport hi F.cutoff + rw [uIcc_of_le hab.le] at hcont + have h := transition_constant_closed hab hf + (fun s hs => derivative_nilpotent_transport F hΩ hi hc hs) + hfc hcont hu (right_mem_Icc.mpr hab.le) (left_mem_Icc.mpr hab.le) + rw [transport_base,mul_one] at h + calc + transport Ω a F.cutoff b = f b*(Ring.inverse (f b)*transport Ω a F.cutoff b) := by + rw [←mul_assoc,Ring.mul_inverse_cancel _ (hu b (right_mem_Icc.mpr hab.le)),one_mul] + _ = f b*Ring.inverse (f a) := congrArg (f b*·) h + +end FinitePicard + +namespace KZCollar +open MeasureTheory Set Filter FinitePicard +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] + [FiniteDimensional ℝ A] + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem bulkForm_mem (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) (s : ℝ) : + bulkForm X Y s ∈ F.space 1 := (F.space 1).add_mem + ((F.space 1).smul_mem _ hX) ((F.space 1).smul_mem _ hY) + +omit [CompleteSpace A] [FiniteDimensional ℝ A] in +theorem bulkForm_continuous (X Y : A) : ContinuousOn (bulkForm X Y) (Ioo 0 1) := by + apply ContinuousOn.add + · exact (continuousOn_id.inv₀ (fun s hs => ne_of_gt hs.1)).smul continuousOn_const + · exact ((continuousOn_id.sub continuousOn_const).inv₀ + (fun s hs => ne_of_lt (sub_neg.mpr hs.2))).smul continuousOn_const + +theorem bulk_transport (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) {r t : ℝ} + (hr : 0 < r) (hrt : r < t) (ht : t < 1) : + transport (bulkForm X Y) r F.cutoff t = + normalizedSolution F X Y t * Ring.inverse (normalizedSolution F X Y r) := by + have hs : Icc r t ⊆ Ioo (0:ℝ) 1 := fun s hs => + ⟨lt_of_lt_of_le hr hs.1,lt_of_le_of_lt hs.2 ht⟩ + have hc := (bulkForm_continuous X Y).mono hs + apply transport_eq_fundamental F (bulkForm_mem F hX hY) hrt + · exact hc.intervalIntegrable_of_Icc hrt.le + · exact hc.mono Ioo_subset_Icc_self + · exact fun s h => normalizedSolution_derivative_on F hX hY (hs ⟨h.1.le,h.2.le⟩) + · exact fun s h => (normalizedSolution_derivative_on F hX hY (hs h)).continuousAt.continuousWithinAt + · exact fun s _ => normalizedSolution_isUnit F hX hY s + +def regularizedBulk (F : NilpotentFiltration A) (X Y : A) (r : ℝ) : A := + gauge (-Y) r * transport (bulkForm X Y) r F.cutoff (1-r) * gauge X r + +theorem regularizedBulk_eq (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) {r : ℝ} (hr : 0 < r) (hr1 : r < 1/2) : + regularizedBulk F X Y r = + transport (regularForm Y X) 0 F.cutoff r * associator F X Y * + Ring.inverse (transport (regularForm X Y) 0 F.cutoff r) := by + have hu := transport_isUnit F (regularForm_mem F hX hY) 0 r F.cutoff + have hg : Ring.inverse (normalizedSolution F X Y r)*gauge X r = + Ring.inverse (transport (regularForm X Y) 0 F.cutoff r) := by + rw [Ring.inverse_mul_eq_iff_eq_mul _ _ _ (normalizedSolution_isUnit F hX hY r)] + simp only [normalizedSolution,mul_assoc,Ring.mul_inverse_cancel _ hu,mul_one] + have ht : 1-r ∈ Ioo (0:ℝ) 1 := ⟨by linarith,by linarith⟩ + unfold regularizedBulk + rw [bulk_transport F hX hY hr (by linarith) ht.2, + left_eq_right_mul_associator F hX hY ht] + unfold rightSolution + have her : 1-(1-r)=r := by ring + rw [her] + simp only [normalizedSolution, mul_assoc] at hg ⊢ + rw [←mul_assoc (gauge (-Y) r) (gauge Y r),gauge_neg_mul,one_mul] + rw [hg] + +omit [FiniteDimensional ℝ A] in +theorem regularTransport_limit (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) : + Tendsto (transport (regularForm X Y) 0 F.cutoff) (𝓝[>] 0) (𝓝 (1:A)) := by + have h := normalizedSolution_limit (Y:=Y) F hX (b:=1/2) (by norm_num) (by norm_num) + simpa only [normalizedSolution,←mul_assoc,gauge_neg_mul,one_mul] using h + +theorem regularizedBulk_limit (F : NilpotentFiltration A) {X Y : A} + (hX : X ∈ F.space 1) (hY : Y ∈ F.space 1) : + Tendsto (regularizedBulk F X Y) (𝓝[>] 0) (𝓝 (associator F X Y)) := by + have h0 := regularTransport_limit (Y:=Y) F hX + have h1 := regularTransport_limit (Y:=X) F hY + have hi : Tendsto (fun r => Ring.inverse (transport (regularForm X Y) 0 F.cutoff r)) + (𝓝[>] 0) (𝓝 (1:A)) := by + have h := (NormedRing.inverse_continuousAt (1:Aˣ)).tendsto.comp h0 + simpa only [Units.val_one,Ring.inverse_one,Function.comp_def] using! h + have h := (h1.mul (tendsto_const_nhds (x:=associator F X Y))).mul hi + simp only [one_mul,mul_one] at h + apply h.congr' + filter_upwards [self_mem_nhdsWithin, (eventually_lt_nhds (by norm_num : (0:ℝ)<1/2)).filter_mono nhdsWithin_le_nhds] with r hr hr1 + exact (regularizedBulk_eq F hX hY hr hr1).symm + +end KZCollar +end + +namespace DepthIntegral +open MeasureTheory Set Filter intervalIntegral +open scoped Topology + +def kernel (m : ℕ) (s : ℝ) : ℝ := (-Real.log s)^m/(1-s) + +theorem kernel_left (m : ℕ) {b : ℝ} (h0 : 0≤b) (h1 : b<1) : + IntervalIntegrable (kernel m) volume 0 b := by + have hl := (LogCollar.log_pow m h0).const_mul ((-1:ℝ)^m) + have hc : ContinuousOn (fun s : ℝ => (1-s)⁻¹) (uIcc 0 b) := by + apply (continuousOn_const.sub continuousOn_id).inv₀ + intro s hs + rw [uIcc_of_le h0] at hs + exact ne_of_gt (sub_pos.mpr (lt_of_le_of_lt hs.2 h1)) + have he : kernel m=(fun s => ((-1:ℝ)^m*Real.log s^m)*(1-s)⁻¹) := by + funext s + unfold kernel + rw [neg_pow,div_eq_mul_inv] + rw [he] + exact hl.mul_continuousOn hc + +theorem slope_continuous : ContinuousOn (dslope Real.log 1) (Ioi 0) := by + apply (continuousOn_dslope (Ioi_mem_nhds (by norm_num : (0:ℝ)<1))).mpr + exact ⟨Real.continuousOn_log.mono (fun _ hx => ne_of_gt hx), + (Real.hasDerivAt_log one_ne_zero).differentiableAt⟩ + +theorem kernel_eq (m : ℕ) {s : ℝ} (hs : s≠1) : + kernel (m+1) s=(-Real.log s)^m*dslope Real.log 1 s := by + rw [dslope_of_ne _ hs] + simp only [slope,Real.log_one,vsub_eq_sub,sub_zero,smul_eq_mul] + unfold kernel + rw [pow_succ] + field_simp + ring + +theorem kernel_integrable (m : ℕ) (hm : 0 < m) : + IntervalIntegrable (kernel m) volume 0 1 := by + obtain ⟨k,rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hm) + apply (kernel_left (k+1) (b:=1/2) (by norm_num) (by norm_num)).trans + have hc : ContinuousOn (fun s => (-Real.log s)^k*dslope Real.log 1 s) (Ioi 0) := + ((Real.continuousOn_log.mono (fun _ hx => ne_of_gt hx)).neg.pow k).mul slope_continuous + have hi : IntervalIntegrable (fun s => (-Real.log s)^k*dslope Real.log 1 s) volume (1/2) 1 := (hc.mono (show uIcc (1/2:ℝ) 1⊆Ioi 0 by + rw [uIcc_of_le (by norm_num : (1/2:ℝ)≤1)] + intro s hs + exact lt_of_lt_of_le (by norm_num : (0:ℝ)<1/2) hs.1)).intervalIntegrable + apply hi.congr_uIoo + intro s hs + rw [uIoo_of_lt (by norm_num : (1/2:ℝ)<1)] at hs + exact (kernel_eq k (ne_of_lt hs.2)).symm + +theorem kernel_pos (m : ℕ) {s : ℝ} (hs : s∈Ioo 0 1) : 0 kernel_pos m hs) (by norm_num) + +theorem coefficient_ne_zero (m : ℕ) (hm : 0 < m) : + -(1/(m.factorial:ℝ))*(∫ s in (0:ℝ)..1,kernel m s)≠0 := by + apply mul_ne_zero + · exact neg_ne_zero.mpr (one_div_ne_zero (Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero m))) + · exact ne_of_gt (integral_pos m hm) + +theorem integral_zero {s : ℝ} (h0 : 0 ≤ s) (h1 : s < 1) : + (∫ t in (0:ℝ)..s,kernel 0 t)=-Real.log (1-s) := by + have hd (t : ℝ) (ht : t∈uIcc 0 s) : + HasDerivAt (fun t : ℝ => -Real.log (1-t)) (kernel 0 t) t := by + rw [uIcc_of_le h0] at ht + have hne : 1-t≠0 := ne_of_gt (sub_pos.mpr (lt_of_le_of_lt ht.2 h1)) + have h := (((hasDerivAt_const t (1:ℝ)).sub (hasDerivAt_id t)).log hne).neg + simpa only [kernel,pow_zero,zero_sub,neg_div,one_div,neg_neg,Pi.sub_apply,Pi.neg_apply,id_eq] using! h + have h := integral_eq_sub_of_hasDerivAt hd (kernel_left 0 h0 h1) + simpa using h + +theorem integral_limit (m : ℕ) (hm : 0 < m) : + Tendsto (fun s => ∫ t in (0:ℝ)..s,kernel m t) (𝓝[<] 1) + (𝓝 (∫ t in (0:ℝ)..1,kernel m t)) := by + have hc := intervalIntegral.continuousOn_primitive_interval' + (kernel_integrable m hm) left_mem_uIcc + have hh := hc 1 right_mem_uIcc + change Tendsto _ (𝓝[uIcc 0 1] 1) _ at hh + rw [uIcc_of_le (by norm_num : (0:ℝ)≤1),nhdsWithin_Icc_eq_nhdsLE (by norm_num : (0:ℝ)<1)] at hh + exact hh.mono_left (nhdsWithin_mono _ Iio_subset_Iic_self) + +theorem one_sub_limit : Tendsto (fun s : ℝ => 1-s) (𝓝[<] 1) (𝓝[>] 0) := by + apply tendsto_nhdsWithin_iff.mpr + constructor + · have hc : Continuous (fun s : ℝ => 1-s) := continuous_const.sub continuous_id + have hh : Tendsto (fun s : ℝ => 1-s) (𝓝 (1:ℝ)) (𝓝 (1-1:ℝ)) := hc.tendsto 1 + simpa only [sub_self] using hh.mono_left (show 𝓝[<] (1:ℝ) ≤ 𝓝 1 from nhdsWithin_le_nhds) + · filter_upwards [self_mem_nhdsWithin] with s hs + change 0 < 1-s + exact sub_pos.mpr (show s < 1 from hs) + +theorem log_endpoint_product (m : ℕ) (hm : 0 < m) : + Tendsto (fun s : ℝ => Real.log s^m*Real.log (1-s)) (𝓝[<] 1) (𝓝 0) := by + obtain ⟨k,rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hm) + have h0 : Tendsto (fun s : ℝ => Real.log (1-s)*(1-s)) (𝓝[<] 1) (𝓝 0) := by + simpa only [Real.rpow_one,Function.comp_def] using + (tendsto_log_mul_rpow_nhdsGT_zero (by norm_num : (0:ℝ)<1)).comp one_sub_limit + have hl := (Real.continuousAt_log (by norm_num : (1:ℝ)≠0)).tendsto.mono_left + (show 𝓝[<] (1:ℝ)≤𝓝 1 from nhdsWithin_le_nhds) + have hd := (continuousAt_dslope_same.mpr (Real.hasDerivAt_log one_ne_zero).differentiableAt).tendsto.mono_left + (show 𝓝[<] (1:ℝ)≤𝓝 1 from nhdsWithin_le_nhds) + have hh := ((hl.pow k).neg.mul hd).mul h0 + simp only [mul_zero] at hh + apply hh.congr' + filter_upwards with s + have he : (s-1)*dslope Real.log 1 s=Real.log s := by + simpa only [smul_eq_mul,Real.log_one,sub_zero] using sub_smul_dslope Real.log 1 s + change -(Real.log s^k)*dslope Real.log 1 s*(Real.log (1-s)*(1-s))=Real.log s^(k+1)*Real.log (1-s) + rw [pow_succ] + calc + _ = Real.log s^k*((s-1)*dslope Real.log 1 s)*Real.log (1-s) := by ring + _ = _ := by rw [he] + +end DepthIntegral + +namespace CutoffKZ +open CutoffDepth FinitePicard KZCollar MeasureTheory Set Filter +open scoped Topology + +instance normedRing (N : ℕ) : NormedRing (Q ℝ N) := FiniteAlgebraNorm.normedRing _ +instance normedAlgebra (N : ℕ) : NormedAlgebra ℝ (Q ℝ N) := FiniteAlgebraNorm.normedAlgebra _ + +def weight (N : ℕ) : NilpotentFiltration (Q ℝ N) where + space := TruncatedWords.filtration ∅ N + antitone := TruncatedWords.filtration_antitone ∅ N + one_mem := TruncatedWords.filtration_one ∅ N + mul_mem := TruncatedWords.filtration_mul ∅ N + cutoff := N + terminal := TruncatedWords.filtration_terminal ∅ N + +def depth (N : ℕ) : NilpotentFiltration (Q ℝ N) where + space := depthSpace N + antitone := depth_antitone N + one_mem := depth_one N + mul_mem := depth_mul N + cutoff := N + terminal := depth_terminal N + +abbrev X (N : ℕ) : Q ℝ N := gen N false +abbrev Y (N : ℕ) : Q ℝ N := gen N true +abbrev c (N m : ℕ) : Q ℝ N →ₗ[ℝ] ℝ := coeff N (GenericIhara.depthOneWord m) + +theorem X_nilpotent (N : ℕ) : X N^(N+1)=0 := pow_cutoff_eq_zero (weight N) (gen_weight N false) + +theorem X_pow_depth (N i : ℕ) : X N^i∈depthSpace N 0 := by + induction i with + | zero => simpa using depth_one N + | succ i ih => simpa only [pow_succ,Nat.zero_add] using depth_mul N 0 0 ih (gen_depth N false) + +theorem regularForm_depth (N : ℕ) (s : ℝ) : regularForm (X N) (Y N) s∈depthSpace N 1 := by + rw [regularForm_finite _ _ (X_nilpotent N)] + apply Submodule.sum_mem + intro i hi + apply Submodule.sum_mem + intro j hj + apply Submodule.smul_mem + exact depth_mul N 1 0 (depth_mul N 0 1 (X_pow_depth N i) (gen_depth N true)) (X_pow_depth N j) + +theorem coeff_one (N m : ℕ) : c N m 1=0 := by + rw [←(quotient (R:=ℝ) N).map_one] + change TruncatedFree.coefficient N _ (TruncatedWords.quotient (∅ : Set (AssociativeElimination.A ℝ Bool)) N (1 : AssociativeElimination.A ℝ Bool))=0 + rw [TruncatedFree.coefficient_quotient] + have hn : GenericIhara.depthOneWord m≠1 := by + intro h + have hh := congrArg (WordGrading.degree TruncatedWords.wt) h + simp only [length_depthOne,WordGrading.degree_one] at hh + omega + classical + simp [MonoidAlgebra.one_def,MonoidAlgebra.coeff_single,hn] + +theorem coeff_high_term (N m k : ℕ) (hk : 2 ≤ k) (s : ℝ) : + c N m (term (regularForm (X N) (Y N)) 0 k s)=0 := by + apply coeff_zero_of_depth N k (term_mem (depth N) (regularForm_depth N) 0 k s) + simpa [GenericIhara.depthOneWord,GenericIhara.depth] using (show 1 < k by omega) + +theorem coeff_form (N m : ℕ) (hN : m+1 ≤ N) (s : ℝ) : + c N m (regularForm (X N) (Y N) s)=-(1/(m.factorial:ℝ))*DepthIntegral.kernel m s := by + rw [regularForm_finite _ _ (X_nilpotent N),map_sum] + simp only [map_sum,map_smul,smul_eq_mul,c,coeff_monomial N _ _ m hN] + rw [Finset.sum_eq_single m] + · rw [Finset.sum_eq_single 0] + · simp only [and_self,↓reduceIte,mul_one,Nat.factorial_zero,Nat.cast_one,add_zero] + unfold DepthIntegral.kernel + rw [neg_pow,show s-1= -(1-s) by ring,inv_neg,div_eq_mul_inv] + ring + · intro j hj hj0 + simp only [hj0,and_false,↓reduceIte,mul_zero] + · intro hn + exact False.elim (hn (Finset.mem_range.mpr (Nat.zero_lt_succ N))) + · intro i hi him + simp only [him,false_and,↓reduceIte,mul_zero,Finset.sum_const_zero] + · intro hn + exact False.elim (hn (Finset.mem_range.mpr (by omega))) + +theorem coeff_first_term (N m : ℕ) (hN : m+1 ≤ N) {s : ℝ} (h0 : 0 ≤ s) (h1 : s < 1) : + c N m (term (regularForm (X N) (Y N)) 0 1 s)= + -(1/(m.factorial:ℝ))*(∫ t in (0:ℝ)..s,DepthIntegral.kernel m t) := by + simp only [term_succ,term_zero,mul_one] + change (c N m).toContinuousLinearMap (∫ t in (0:ℝ)..s,regularForm (X N) (Y N) t)=_ + rw [←(c N m).toContinuousLinearMap.intervalIntegral_comp_comm + (regularForm_integrable _ _ (X_nilpotent N) h0 h1)] + change (∫ t in (0:ℝ)..s,c N m (regularForm (X N) (Y N) t))=_ + simp only [coeff_form N m hN] + exact intervalIntegral.integral_const_mul _ _ + +theorem coeff_transport (N m : ℕ) (hN : m+1 ≤ N) {s : ℝ} (h0 : 0 ≤ s) (h1 : s < 1) : + c N m (transport (regularForm (X N) (Y N)) 0 N s)= + -(1/(m.factorial:ℝ))*(∫ t in (0:ℝ)..s,DepthIntegral.kernel m t) := by + rw [transport,map_sum,Finset.sum_eq_single 1] + · exact coeff_first_term N m hN h0 h1 + · intro k hk hn + by_cases hz : k=0 + · subst k; simp only [term_zero,coeff_one] + · exact coeff_high_term N m k (by omega) s + · intro hn + exact False.elim (hn (Finset.mem_range.mpr (by omega))) + +end CutoffKZ + +namespace KZCollar +open FinitePicard +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + + theorem gauge_sub_one_mem (F : NilpotentFiltration A) {X : A} + (hX : X∈F.space 1) (s : ℝ) : gauge X s-1∈F.space 1 := by + rw [gauge_finite X (pow_cutoff_eq_zero F hX),Finset.sum_range_succ'] + simp only [pow_zero,Nat.factorial_zero,Nat.cast_one,div_one,one_smul,add_sub_cancel_right] + apply Submodule.sum_mem + intro i hi + exact (F.space 1).smul_mem _ (F.antitone (by omega : 1 ≤ i+1) (pow_mem F hX (i+1))) + + theorem product_sub_one_mem (F : NilpotentFiltration A) {u v : A} + (hu : u-1∈F.space 1) (hv : v-1∈F.space 1) : u*v-1∈F.space 1 := by + have hv0 : v∈F.space 0 := by + simpa only [sub_add_cancel] using (F.space 0).add_mem (F.antitone (by omega : 0≤1) hv) F.one_mem + have hh := (F.space 1).add_mem (F.mul_mem 1 0 hu hv0) hv + simpa only [sub_mul,one_mul,sub_add_sub_cancel] using hh + + theorem inverse_sub_one_mem (F : NilpotentFiltration A) {u : A} + (hF : F.space 0=⊤) (hu : u-1∈F.space 1) (hunit : IsUnit u) : + Ring.inverse u-1∈F.space 1 := by + have hi : Ring.inverse u∈F.space 0 := by rw [hF]; trivial + have hh := F.mul_mem 0 1 hi hu + have he : Ring.inverse u*(u-1)= -(Ring.inverse u-1) := by + rw [mul_sub,Ring.inverse_mul_cancel _ hunit,mul_one,neg_sub] + rw [he] at hh + exact (F.space 1).neg_mem_iff.mp hh + +variable [CompleteSpace A] [FiniteDimensional ℝ A] + +omit [CompleteSpace A] in +theorem normalizedSolution_sub_one_mem (F : NilpotentFiltration A) {X Y : A} + (hX : X∈F.space 1) (hY : Y∈F.space 1) (s : ℝ) : + normalizedSolution F X Y s-1∈F.space 1 := + product_sub_one_mem F (gauge_sub_one_mem F hX s) + (transport_sub_one_mem F (regularForm_mem F hX hY) 0 s F.cutoff) + + theorem associator_sub_one_mem (F : NilpotentFiltration A) {X Y : A} + (hF : F.space 0=⊤) (hX : X∈F.space 1) (hY : Y∈F.space 1) : + associator F X Y-1∈F.space 1 := + product_sub_one_mem F + (inverse_sub_one_mem F hF (normalizedSolution_sub_one_mem F hY hX _) + (rightSolution_isUnit F hX hY _)) + (normalizedSolution_sub_one_mem F hX hY _) + +end KZCollar + +section +namespace FinitePicard +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [FiniteDimensional ℝ A] + + theorem term_above_cutoff (F : NilpotentFiltration A) {Ω : ℝ → A} + (hΩ : ∀ t,Ω t∈F.space 1) {n : ℕ} (hn : F.cutoff left N (gen N b)+right N (gen N b)) + (fun b => ((tensorWeight N).space 1).add_mem (left_mem N 1 _ (gen_weight N b)) (right_mem N 1 _ (gen_weight N b))) + @[simp] theorem diagonal_gen (N : ℕ) (b : Bool) : diagonal N (gen (N+N) b)=left N (gen N b)+right N (gen N b) := + NilpotentFreeLift.eval_gen _ _ _ b + theorem diagonal_mem (N n : ℕ) (u : Q ℝ (N+N)) (hu : u∈(weight (N+N)).space n) : + diagonal N u∈(tensorWeight N).space n := NilpotentFreeLift.eval_preserves _ _ _ hu + +def drop (M N : ℕ) (h : N ≤ M) : Q ℝ M →ₐ[ℝ] Q ℝ N := + NilpotentFreeLift.eval (extend (weight N) M h) (gen N) (gen_weight N) + @[simp] theorem drop_gen (M N : ℕ) (h : N ≤ M) (b : Bool) : drop M N h (gen M b)=gen N b := + NilpotentFreeLift.eval_gen _ _ _ b + theorem drop_mem (M N : ℕ) (h : N ≤ M) (n : ℕ) (u : Q ℝ M) (hu : u∈(weight M).space n) : + drop M N h u∈(weight N).space n := + NilpotentFreeLift.eval_preserves (extend (weight N) M h) (gen N) (gen_weight N) hu + theorem drop_associator (M N : ℕ) (h : N ≤ M) : + drop M N h (KZCollar.associator (weight M) (X M) (Y M))=KZCollar.associator (weight N) (X N) (Y N) := by + rw [KZCollar.map_associator_general (drop M N h) (weight M) (weight N) + (gen_weight M false) (gen_weight M true) + (drop_mem M N h 1 _ (gen_weight M false)) (drop_mem M N h 1 _ (gen_weight M true)), + drop_gen,drop_gen] +end CutoffDiagonal + +namespace RegularSingular +open MeasureTheory Set Filter FinitePicard KZCollar +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def regular (X : A) (R : ℝ → A) (s : ℝ) : A := gauge (-X) s*R s*gauge X s + +theorem regular_finite (X : A) (R : ℝ → A) {N : ℕ} (hX : X^(N+1)=0) (s : ℝ) : + regular X R s=∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), + (Real.log s^(i+j)*((-1:ℝ)^i/((i.factorial:ℝ)*(j.factorial:ℝ)))) • (X^i*R s*X^j) := by + have hnX : (-X)^(N+1)=0 := by rw [neg_pow,hX,mul_zero] + unfold regular + rw [gauge_finite (-X) hnX,gauge_finite X hX,Finset.sum_mul,Finset.sum_mul] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j hj + rw [neg_pow] + simp only [smul_mul_assoc,mul_smul_comm,smul_smul] + have hp : (-1:A)^i*X^i*R s*X^j=(-1:ℝ)^i • (X^i*R s*X^j) := by + simp only [Algebra.smul_def,map_pow,map_neg,map_one] + noncomm_ring + rw [hp,smul_smul] + congr 1 + rw [pow_add] + ring + +theorem regular_integrable (X : A) {R : ℝ → A} {N : ℕ} (hX : X^(N+1)=0) + {b : ℝ} (hb : 0≤b) (hR : ContinuousOn R (Icc 0 b)) : + IntervalIntegrable (regular X R) volume 0 b := by + have h : regular X R=fun s => ∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), + (Real.log s^(i+j)*((-1:ℝ)^i/((i.factorial:ℝ)*(j.factorial:ℝ)))) • (X^i*R s*X^j) := + funext (regular_finite X R hX) + rw [h] + have hi (i j : ℕ) : IntervalIntegrable (fun s => + (Real.log s^(i+j)*((-1:ℝ)^i/((i.factorial:ℝ)*(j.factorial:ℝ)))) • (X^i*R s*X^j)) volume 0 b := + ((LogCollar.log_pow (i+j) hb).mul_const _).smul_continuousOn + (by rw [uIcc_of_le hb]; exact (continuousOn_const.mul hR).mul continuousOn_const) + have hh := IntervalIntegrable.sum (ε:=A) (Finset.range (N+1)) + (fun i _ => IntervalIntegrable.sum (ε:=A) (Finset.range (N+1)) (fun j _ => hi i j)) + have he : (∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), fun s => + (Real.log s^(i+j)*((-1:ℝ)^i/((i.factorial:ℝ)*(j.factorial:ℝ)))) • (X^i*R s*X^j)) = + (fun s => ∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), + (Real.log s^(i+j)*((-1:ℝ)^i/((i.factorial:ℝ)*(j.factorial:ℝ)))) • (X^i*R s*X^j)) := by + ext s + simp only [Finset.sum_apply] + rw [he] at hh + exact hh + +theorem regular_mem (F : NilpotentFiltration A) {X : A} (hX : X∈F.space 1) + {R : ℝ → A} (hR : ∀ s,R s∈F.space 1) (s : ℝ) : regular X R s∈F.space 1 := by + rw [regular_finite X R (pow_cutoff_eq_zero F hX)] + apply Submodule.sum_mem + intro i hi + apply Submodule.sum_mem + intro j hj + apply Submodule.smul_mem + exact F.antitone (by omega : 1 ≤ i+1+j) + (F.mul_mem (i+1) j (F.mul_mem i 1 (pow_mem F hX i) (hR s)) (pow_mem F hX j)) + +def solution (F : NilpotentFiltration A) (X : A) (R : ℝ → A) (s : ℝ) : A := + gauge X s*transport (regular X R) 0 F.cutoff s + +variable [CompleteSpace A] + +theorem regular_continuous {X : A} {R : ℝ → A} {b : ℝ} + (hR : ContinuousOn R (Icc 0 b)) : ContinuousOn (regular X R) (Ioo 0 b) := by + intro s hs + have hg (X : A) : ContinuousAt (gauge X) s := (gauge_derivative X (ne_of_gt hs.1)).continuousAt + exact (((hg (-X)).continuousWithinAt.mul ((hR.mono Ioo_subset_Icc_self) s hs)).mul + (hg X).continuousWithinAt) + +omit [CompleteSpace A] in +theorem solution_limit (F : NilpotentFiltration A) {X : A} (hX : X∈F.space 1) + {R : ℝ → A} {b : ℝ} (hb : 0 gauge (-X) s*solution F X R s) (𝓝[>] 0) (𝓝 (1:A)) := by + have he : (fun s => gauge (-X) s*solution F X R s)=transport (regular X R) 0 F.cutoff := by + funext s + rw [solution,←mul_assoc,gauge_neg_mul,one_mul] + rw [he] + have h := collar_limit (regular_integrable X (pow_cutoff_eq_zero F hX) hb.le hR) F.cutoff + rw [uIcc_of_le hb.le,nhdsWithin_Icc_eq_nhdsGE hb] at h + exact h.mono_left (nhdsWithin_mono _ Ioi_subset_Ici_self) + +variable [FiniteDimensional ℝ A] + +theorem solution_derivative (F : NilpotentFiltration A) {X : A} (hX : X∈F.space 1) + {R : ℝ → A} (hRm : ∀ s,R s∈F.space 1) {b s : ℝ} + (hR : ContinuousOn R (Icc 0 b)) (hs : s∈Ioo 0 b) : + HasDerivAt (solution F X R) ((s⁻¹ • X+R s)*solution F X R s) s := by + have hi := regular_integrable X (pow_cutoff_eq_zero F hX) (hs.1.le.trans hs.2.le) hR + have hh := derivative_nilpotent_transport F (regular_mem F hX hRm) hi (regular_continuous hR) hs + apply ((gauge_derivative X (ne_of_gt hs.1)).mul hh).congr_deriv + let P := transport (regular X R) 0 F.cutoff s + change (s⁻¹ • (X*gauge X s))*P+gauge X s*((gauge (-X) s*R s*gauge X s)*P)= + (s⁻¹ • X+R s)*(gauge X s*P) + rw [←mul_assoc (gauge X s),←mul_assoc (gauge X s),←mul_assoc (gauge X s),gauge_mul_neg,one_mul] + simp only [add_mul,smul_mul_assoc,mul_assoc] + +theorem solution_isUnit (F : NilpotentFiltration A) {X : A} (hX : X∈F.space 1) + {R : ℝ → A} (hR : ∀ s,R s∈F.space 1) (s : ℝ) : IsUnit (solution F X R s) := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + exact (NormedSpace.isUnit_exp _).mul (transport_isUnit F (regular_mem F hX hR) 0 s F.cutoff) + +end RegularSingular + +namespace FinitePicard +open MeasureTheory Set intervalIntegral +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def integralNorm (Ω : ℝ → A) (a b : ℝ) : ℝ := ∫ s in a..b,‖Ω s‖ + +omit [NormedAlgebra ℝ A] in +theorem integralNorm_nonneg (Ω : ℝ → A) {a b : ℝ} (hab : a≤b) : + 0 ≤ integralNorm Ω a b := integral_nonneg hab (fun _ _ => norm_nonneg _) + +theorem norm_term_le {Ω : ℝ → A} {a b L : ℝ} (hab : a≤b) + (hi : IntervalIntegrable Ω volume a b) (hL : 0≤L) + (hbound : ∀ t∈Icc a b,integralNorm Ω a t≤L) (n : ℕ) : + ∀ t∈Icc a b,‖term Ω a n t‖≤‖(1:A)‖*L^n := by + induction n with + | zero => intro t ht; simp only [term_zero,pow_zero,mul_one,le_refl] + | succ n ih => + intro t ht + have his : IntervalIntegrable Ω volume a t := hi.mono_set (by simpa only [uIcc_of_le hab,uIcc_of_le ht.1] using Icc_subset_Icc_right ht.2) + have hcont := continuousOn_term hi n + have hm : IntervalIntegrable (fun s => Ω s*term Ω a n s) volume a t := + (hi.mul_continuousOn hcont).mono_set (by simpa only [uIcc_of_le hab,uIcc_of_le ht.1] using Icc_subset_Icc_right ht.2) + calc + ‖term Ω a (n+1) t‖ ≤ ∫ s in a..t,‖Ω s*term Ω a n s‖ := norm_integral_le_integral_norm ht.1 + _ ≤ ∫ s in a..t,‖Ω s‖*(‖(1:A)‖*L^n) := by + apply integral_mono_on ht.1 hm.norm (his.norm.mul_const _) + intro s hs + exact (norm_mul_le _ _).trans (mul_le_mul_of_nonneg_left (ih s ⟨hs.1,hs.2.trans ht.2⟩) (norm_nonneg _)) + _ = integralNorm Ω a t*(‖(1:A)‖*L^n) := integral_mul_const _ _ + _ ≤ L*(‖(1:A)‖*L^n) := mul_le_mul_of_nonneg_right (hbound t ht) (mul_nonneg (norm_nonneg _) (pow_nonneg hL _)) + _ = ‖(1:A)‖*L^(n+1) := by rw [pow_succ]; ring + +omit [NormedAlgebra ℝ A] in +theorem integrable_partial {Ω : ℝ → A} {a b t : ℝ} + (hi : IntervalIntegrable Ω volume a b) (ht : t∈Icc a b) : + IntervalIntegrable Ω volume a t := + hi.mono_set (by simpa only [uIcc_of_le ht.1,uIcc_of_le (ht.1.trans ht.2)] + using Icc_subset_Icc_right ht.2) + +omit [NormedAlgebra ℝ A] in +theorem integralNorm_partial {Ω : ℝ → A} {a b t : ℝ} + (hi : IntervalIntegrable Ω volume a b) (ht : t∈Icc a b) : + integralNorm Ω a t≤ integralNorm Ω a b := + integral_mono_interval le_rfl ht.1 ht.2 (Filter.Eventually.of_forall (fun s => norm_nonneg (Ω s))) hi.norm + +theorem norm_term_bound {Ω : ℝ → A} {a b : ℝ} (hi : IntervalIntegrable Ω volume a b) + (n : ℕ) {t : ℝ} (ht : t∈Icc a b) : + ‖term Ω a n t‖≤‖(1:A)‖*(integralNorm Ω a b)^n := + norm_term_le (ht.1.trans ht.2) hi (integralNorm_nonneg Ω (ht.1.trans ht.2)) + (fun _ hs => integralNorm_partial hi hs) n t ht + +theorem norm_term_sub_le {Ω Θ : ℝ → A} {a b L E : ℝ} (hab : a≤b) + (hΩ : IntervalIntegrable Ω volume a b) (hΘ : IntervalIntegrable Θ volume a b) + (hL : 0≤L) (hE : 0≤E) + (hΩL : integralNorm Ω a b≤L) (hΘL : integralNorm Θ a b≤L) + (hEL : integralNorm (fun s => Ω s-Θ s) a b≤E) (n : ℕ) : + ∀ t∈Icc a b,‖term Ω a n t-term Θ a n t‖≤(‖(1:A)‖*E)*(n:ℝ)*(L+1)^n := by + have hM : 0≤L+1 := by positivity + have hML : L≤L+1 := by linarith + have cΩ := norm_term_le hab hΩ hM (fun t ht => (integralNorm_partial hΩ ht).trans (hΩL.trans hML)) + induction n with + | zero => intro t ht; simp + | succ n ih => + intro t ht + have hiΩ := integrable_partial (hΩ.mul_continuousOn (continuousOn_term hΩ n)) ht + have hiΘ := integrable_partial (hΘ.mul_continuousOn (continuousOn_term hΘ n)) ht + have hsΩ := integrable_partial hΩ ht + have hsΘ := integrable_partial hΘ ht + have hd := integralNorm_partial (hΩ.sub hΘ) ht + have hbΘ := (integralNorm_partial hΘ ht).trans hΘL + have hp : 0≤(L+1)^n := pow_nonneg hM n + have hC : 0≤‖(1:A)‖ := norm_nonneg _ + calc + ‖term Ω a (n+1) t-term Θ a (n+1) t‖ = + ‖∫ s in a..t,Ω s*term Ω a n s-Θ s*term Θ a n s‖ := by rw [integral_sub hiΩ hiΘ]; rfl + _ ≤ ∫ s in a..t,‖Ω s*term Ω a n s-Θ s*term Θ a n s‖ := norm_integral_le_integral_norm ht.1 + _ ≤ ∫ s in a..t,‖Ω s-Θ s‖*(‖(1:A)‖*(L+1)^n)+‖Θ s‖*((‖(1:A)‖*E)*(n:ℝ)*(L+1)^n) := by + apply integral_mono_on ht.1 (hiΩ.sub hiΘ).norm + (((hsΩ.sub hsΘ).norm.mul_const _).add (hsΘ.norm.mul_const _)) + intro s hs + have hs' : s∈Icc a b := ⟨hs.1,hs.2.trans ht.2⟩ + calc + _ = ‖(Ω s-Θ s)*term Ω a n s+Θ s*(term Ω a n s-term Θ a n s)‖ := by congr 1; noncomm_ring + _ ≤ ‖(Ω s-Θ s)*term Ω a n s‖+‖Θ s*(term Ω a n s-term Θ a n s)‖ := norm_add_le _ _ + _ ≤ ‖Ω s-Θ s‖*‖term Ω a n s‖+‖Θ s‖*‖term Ω a n s-term Θ a n s‖ := add_le_add (norm_mul_le _ _) (norm_mul_le _ _) + _ ≤ _ := add_le_add + (mul_le_mul_of_nonneg_left (cΩ n s hs') (norm_nonneg _)) + (mul_le_mul_of_nonneg_left (ih s hs') (norm_nonneg _)) + _ = integralNorm (fun s => Ω s-Θ s) a t*(‖(1:A)‖*(L+1)^n)+ + integralNorm Θ a t*((‖(1:A)‖*E)*(n:ℝ)*(L+1)^n) := by + rw [integral_add ((hsΩ.sub hsΘ).norm.mul_const _) (hsΘ.norm.mul_const _),intervalIntegral.integral_mul_const,intervalIntegral.integral_mul_const]; rfl + _ ≤ E*(‖(1:A)‖*(L+1)^n)+L*((‖(1:A)‖*E)*(n:ℝ)*(L+1)^n) := + add_le_add (mul_le_mul_of_nonneg_right (hd.trans hEL) (mul_nonneg hC hp)) + (mul_le_mul_of_nonneg_right hbΘ (by positivity)) + _ = (‖(1:A)‖*E*(L+1)^n)*(1+L*(n:ℝ)) := by ring + _ ≤ (‖(1:A)‖*E*(L+1)^n)*(((n:ℝ)+1)*(L+1)) := by + apply mul_le_mul_of_nonneg_left ?_ (by positivity) + have hn : 0≤(n:ℝ) := Nat.cast_nonneg n + nlinarith + _ = (‖(1:A)‖*E)*((n+1:ℕ):ℝ)*(L+1)^(n+1) := by rw [Nat.cast_add,Nat.cast_one,pow_succ]; ring + +def transportPoly (N : ℕ) (u : ℝ) : ℝ := ∑ n∈Finset.range (N+1),u^n + +def errorPoly (N : ℕ) (u : ℝ) : ℝ := ∑ n∈Finset.range (N+1),(n:ℝ)*u^n + +theorem norm_transport_le {Ω : ℝ → A} {a b L : ℝ} (hab : a≤b) + (hΩ : IntervalIntegrable Ω volume a b) (hL : 0≤L) + (hb : integralNorm Ω a b≤L) (N : ℕ) : + ‖transport Ω a N b‖≤‖(1:A)‖*transportPoly N L := by + calc + _ ≤ ∑ n∈Finset.range (N+1),‖term Ω a n b‖ := norm_sum_le _ _ + _ ≤ ∑ n∈Finset.range (N+1),‖(1:A)‖*L^n := + Finset.sum_le_sum (fun n _ => norm_term_le hab hΩ hL + (fun _ ht => (integralNorm_partial hΩ ht).trans hb) n b ⟨hab,le_rfl⟩) + _ = _ := (Finset.mul_sum _ _ _).symm + +theorem norm_transport_sub_le {Ω Θ : ℝ → A} {a b L E : ℝ} (hab : a≤b) + (hΩ : IntervalIntegrable Ω volume a b) (hΘ : IntervalIntegrable Θ volume a b) + (hL : 0≤L) (hE : 0≤E) + (hΩL : integralNorm Ω a b≤L) (hΘL : integralNorm Θ a b≤L) + (hEL : integralNorm (fun s => Ω s-Θ s) a b≤E) (N : ℕ) : + ‖transport Ω a N b-transport Θ a N b‖≤(‖(1:A)‖*E)*errorPoly N (L+1) := by + unfold transport + rw [←Finset.sum_sub_distrib] + calc + _ ≤ ∑ n∈Finset.range (N+1),‖term Ω a n b-term Θ a n b‖ := norm_sum_le _ _ + _ ≤ ∑ n∈Finset.range (N+1),(‖(1:A)‖*E)*(n:ℝ)*(L+1)^n := + Finset.sum_le_sum (fun n _ => norm_term_sub_le hab hΩ hΘ hL hE hΩL hΘL hEL n b ⟨hab,le_rfl⟩) + _ = _ := by simp only [errorPoly,Finset.mul_sum,mul_assoc] + +end FinitePicard + +namespace PowerAsymptotic + +section +open MeasureTheory Set Filter Asymptotics FinitePicard KZCollar RegularSingular +open scoped Topology + +def Subpower {E : Type*} [Norm E] (f : ℝ → E) : Prop := + ∀ p : ℝ,0

] 0] (fun s : ℝ => s^(-p)) + +def PowerSmall {E : Type*} [Norm E] (f : ℝ → E) : Prop := + ∃ p : ℝ,0

] 0] (fun s : ℝ => s^p) + +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +lemma rpow_mul_eventually (p q : ℝ) : + (fun s : ℝ => s^p*s^q) =ᶠ[𝓝[>] 0] (fun s : ℝ => s^(p+q)) := by + filter_upwards [self_mem_nhdsWithin] with s hs + exact (Real.rpow_add (show 0 Real.log s^n) := by + intro p hp + have h := (isLittleO_abs_log_rpow_rpow_nhdsGT_zero (n:ℝ) (neg_lt_zero.mpr hp)).isBigO + apply IsBigO.of_norm_left + simpa only [Real.rpow_natCast,Real.norm_eq_abs,norm_pow] using h + +omit [NormedAlgebra ℝ A] in +theorem Subpower.add {f g : ℝ → A} (hf : Subpower f) (hg : Subpower g) : + Subpower (fun s => f s+g s) := fun p hp => (hf p hp).add (hg p hp) + +omit [NormedAlgebra ℝ A] in +theorem Subpower.mul {f g : ℝ → A} (hf : Subpower f) (hg : Subpower g) : + Subpower (fun s => f s*g s) := by + intro p hp + have h := (hf (p/2) (by linarith)).mul (hg (p/2) (by linarith)) + apply h.congr' .rfl + filter_upwards [rpow_mul_eventually (-(p/2)) (-(p/2))] with s hs + convert! hs using 1 + congr 1 + ring + +theorem const_subpower (a : A) : Subpower (fun _ : ℝ => a) := by + intro p hp + have h := (log_pow_subpower 0 p hp) + have h' := h.smul (isBigO_const_const a (one_ne_zero : (1:ℝ)≠0) (𝓝[>] (0:ℝ))) + simpa only [pow_zero,one_smul,smul_eq_mul,mul_one] using h' + +omit [NormedAlgebra ℝ A] in +theorem continuousAt_subpower {f : ℝ → A} (hf : ContinuousAt f 0) : Subpower f := by + intro p hp + exact (isBigO_const_of_tendsto hf (one_ne_zero : (1:ℝ)≠0)).mono inf_le_left |>.trans + (by simpa only [pow_zero] using! log_pow_subpower 0 p hp) + +theorem gauge_subpower {X : A} {N : ℕ} (hX : X^(N+1)=0) : Subpower (gauge X) := by + intro p hp + have h (i : ℕ) : (fun s : ℝ => (Real.log s^i / (i.factorial:ℝ)) • X^i) + =O[𝓝[>] 0] (fun s : ℝ => s^(-p)) := by + have hr := (log_pow_subpower i p hp).smul + (isBigO_const_const (((i.factorial:ℝ)⁻¹) • X^i) (one_ne_zero : (1:ℝ)≠0) (𝓝[>] (0:ℝ))) + simpa only [smul_smul,smul_eq_mul,mul_one,div_eq_mul_inv] using hr + have hh := IsBigO.sum (s:=Finset.range (N+1)) (fun i _ => h i) + apply hh.congr_left + intro s + simp only [Finset.sum_apply] + exact (gauge_finite X hX s).symm + +omit [NormedAlgebra ℝ A] in +theorem PowerSmall.mul_subpower {f g : ℝ → A} (hf : PowerSmall f) (hg : Subpower g) : + PowerSmall (fun s => f s*g s) := by + obtain ⟨p,hp,hf⟩ := hf + refine ⟨p/2,by linarith,?_⟩ + apply (hf.mul (hg (p/2) (by linarith))).congr' .rfl + filter_upwards [rpow_mul_eventually p (-(p/2))] with s hs + convert! hs using 1 + congr 1 + ring + +omit [NormedAlgebra ℝ A] in +omit [NormedAlgebra ℝ A] in +theorem Subpower.mul_powerSmall {f g : ℝ → A} (hf : Subpower f) (hg : PowerSmall g) : + PowerSmall (fun s => f s*g s) := by + obtain ⟨p,hp,hg⟩ := hg + refine ⟨p/2,by linarith,?_⟩ + apply ((hf (p/2) (by linarith)).mul hg).congr' .rfl + filter_upwards [rpow_mul_eventually (-(p/2)) p] with s hs + convert! hs using 1 + congr 1 + ring + +omit [NormedAlgebra ℝ A] in +theorem PowerSmall.tendsto_zero {f : ℝ → A} (hf : PowerSmall f) : + Tendsto f (𝓝[>] 0) (𝓝 0) := by + obtain ⟨p,hp,hf⟩ := hf + apply hf.trans_tendsto + simpa only [Real.zero_rpow (ne_of_gt hp)] using! + (Real.continuousAt_rpow_const (x:=(0:ℝ)) p (Or.inr hp.le)).tendsto.mono_left inf_le_left + +omit [NormedAlgebra ℝ A] in + +theorem integralNorm_isBigO {Ω : ℝ → A} {b r : ℝ} (hb : 0] 0] (fun s : ℝ => s^r)) : + (fun s => integralNorm Ω 0 s) =O[𝓝[>] 0] (fun s : ℝ => s^(r+1)) := by + obtain ⟨C,hC,hbound⟩ := ho.exists_nonneg + obtain ⟨c,hc,hcb⟩ := mem_nhdsGT_iff_exists_Ioc_subset.mp hbound.bound + let d := min b c + have hd : 0 C*t^r) volume 0 s := + (intervalIntegral.intervalIntegrable_rpow' hr).const_mul C + have hbnd : integralNorm Ω 0 s ≤ C/(r+1)*s^(r+1) := by + calc + _ ≤ ∫ t in 0..s,C*t^r := by + apply intervalIntegral.integral_mono_on_of_le_Ioo hs0 his.norm hir + intro t ht + have ht0 : 0 transport Ω 0 N s-1) =O[𝓝[>] 0] (fun s => integralNorm Ω 0 s) := by + let L := integralNorm Ω 0 b + let C := ∑ n∈Finset.range N,‖(1:A)‖*L^n + apply isBigO_iff.mpr + refine ⟨C,?_⟩ + filter_upwards [Ioc_mem_nhdsGT hb] with s hs + have hs' : s∈Icc 0 b := ⟨hs.1.le,hs.2⟩ + have his := integrable_partial hi hs' + have hn (n : ℕ) : ‖term Ω 0 (n+1) s‖ ≤ integralNorm Ω 0 s*(‖(1:A)‖*L^n) := by + have hit := integrable_partial (hi.mul_continuousOn (continuousOn_term hi n)) hs' + calc + _ ≤ ∫ t in 0..s,‖Ω t*term Ω 0 n t‖ := intervalIntegral.norm_integral_le_integral_norm hs.1.le + _ ≤ ∫ t in 0..s,‖Ω t‖*(‖(1:A)‖*L^n) := by + apply intervalIntegral.integral_mono_on hs.1.le hit.norm (his.norm.mul_const _) + intro t ht + exact (norm_mul_le _ _).trans (mul_le_mul_of_nonneg_left + (norm_term_bound hi n ⟨ht.1,ht.2.trans hs.2⟩) (norm_nonneg _)) + _ = _ := intervalIntegral.integral_mul_const _ _ + have he : transport Ω 0 N s-1=∑ n∈Finset.range N,term Ω 0 (n+1) s := by + simp only [transport,Finset.sum_range_succ',term_zero,add_sub_cancel_right] + rw [he,Real.norm_of_nonneg (integralNorm_nonneg Ω hs.1.le)] + calc + _ ≤ ∑ n∈Finset.range N,‖term Ω 0 (n+1) s‖ := norm_sum_le _ _ + _ ≤ ∑ n∈Finset.range N,integralNorm Ω 0 s*(‖(1:A)‖*L^n) := + Finset.sum_le_sum (fun n _ => hn n) + _ = C*integralNorm Ω 0 s := by rw [←Finset.mul_sum]; exact mul_comm _ _ + +theorem transport_sub_one_powerSmall {Ω : ℝ → A} {b : ℝ} (hb : 0 < b) + (hi : IntervalIntegrable Ω volume 0 b) (ho : Subpower Ω) (N : ℕ) : + PowerSmall (fun s => transport Ω 0 N s-1) := by + refine ⟨1/2,by norm_num,?_⟩ + have h := (transport_sub_one_isBigO_integralNorm hb hi N).trans + (integralNorm_isBigO hb (by norm_num : -1 < -(1/2:ℝ)) hi (ho (1/2) (by norm_num))) + convert! h using 1 + norm_num + +end + +open MeasureTheory Set Filter Asymptotics FinitePicard KZCollar RegularSingular +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +omit [NormedAlgebra ℝ A] in +theorem tendsto_subpower {f : ℝ → A} {a : A} (hf : Tendsto f (𝓝[>] 0) (𝓝 a)) : Subpower f := by + intro p hp + exact (isBigO_const_of_tendsto hf (one_ne_zero : (1:ℝ)≠0)).trans + (by simpa only [pow_zero] using! log_pow_subpower 0 p hp) + +omit [NormedAlgebra ℝ A] in +theorem continuousOn_subpower {R : ℝ → A} {b : ℝ} (hb : 0 < b) + (hR : ContinuousOn R (Icc 0 b)) : Subpower R := by + have h := hR 0 (left_mem_Icc.mpr hb.le) + rw [ContinuousWithinAt,nhdsWithin_Icc_eq_nhdsGE hb] at h + exact tendsto_subpower (h.mono_left (nhdsWithin_mono _ Ioi_subset_Ici_self)) + +omit [NormedAlgebra ℝ A] in +theorem PowerSmall.of_isBigO {f g : ℝ → A} (hg : PowerSmall g) (hfg : f =O[𝓝[>] 0] g) : + PowerSmall f := by + obtain ⟨p,hp,hg⟩ := hg + exact ⟨p,hp,hfg.trans hg⟩ + +omit [NormedAlgebra ℝ A] in +theorem Subpower.of_isBigO {f g : ℝ → A} (hg : Subpower g) (hfg : f =O[𝓝[>] 0] g) : + Subpower f := fun p hp => hfg.trans (hg p hp) + +omit [NormedAlgebra ℝ A] in +theorem PowerSmall.congr {f g : ℝ → A} (hf : PowerSmall f) (hh : ∀ s,f s=g s) : + PowerSmall g := by + obtain ⟨p,hp,hf⟩ := hf + exact ⟨p,hp,hf.congr_left hh⟩ + +theorem regular_subpower {X : A} {N : ℕ} (hX : X^(N+1)=0) + {R : ℝ → A} (hR : Subpower R) : Subpower (regular X R) := + ((gauge_subpower (by rw [neg_pow,hX,mul_zero] : (-X)^(N+1)=0)).mul hR).mul (gauge_subpower hX) + +theorem solution_sub_gauge {X : A} (F : NilpotentFiltration A) (hX : X∈F.space 1) + {R : ℝ → A} {b : ℝ} (hb : 0 < b) (hR : ContinuousOn R (Icc 0 b)) : + PowerSmall (fun s => solution F X R s-gauge X s) := by + have h := transport_sub_one_powerSmall hb (regular_integrable X (pow_cutoff_eq_zero F hX) hb.le hR) + (regular_subpower (pow_cutoff_eq_zero F hX) (continuousOn_subpower hb hR)) F.cutoff + apply ((gauge_subpower (pow_cutoff_eq_zero F hX)).mul_powerSmall h).congr + intro s + simp only [solution,mul_sub,mul_one] + +theorem Subpower.pow {f : ℝ → A} (hf : Subpower f) (n : ℕ) : Subpower (fun s => f s^n) := by + induction n with + | zero => simpa only [pow_zero] using const_subpower (1:A) + | succ n ih => simpa only [pow_succ] using ih.mul hf + +omit [NormedAlgebra ℝ A] in +theorem Subpower.sum {ι : Type*} (S : Finset ι) {f : ι → ℝ → A} + (hf : ∀ i∈S,Subpower (f i)) : Subpower (fun s => ∑ i∈S,f i s) := by + intro p hp + have h := IsBigO.sum (fun i hi => hf i hi p hp) + apply h.congr_left + intro s + simp only [Finset.sum_apply] + +theorem errorPoly_subpower {L : ℝ → ℝ} (hL : Subpower L) (N : ℕ) : + Subpower (fun s => errorPoly N (L s+1)) := by + apply Subpower.sum + intro n hn + exact (const_subpower (n:ℝ)).mul ((hL.add (const_subpower 1)).pow n) + +variable [CompleteSpace A] + +omit [NormedAlgebra ℝ A] in +theorem inverse_tendsto_one {f : ℝ → A} (hf : Tendsto f (𝓝[>] 0) (𝓝 1)) : + Tendsto (fun s => Ring.inverse (f s)) (𝓝[>] 0) (𝓝 1) := by + simpa only [Units.val_one,Ring.inverse_one] using! (NormedRing.inverse_continuousAt (1:Aˣ)).tendsto.comp hf + +omit [NormedAlgebra ℝ A] in +theorem inverse_sub_one_powerSmall {f : ℝ → A} (hu : ∀ s,IsUnit (f s)) + (hf : PowerSmall (fun s => f s-1)) : PowerSmall (fun s => Ring.inverse (f s)-1) := by + have ht : Tendsto f (𝓝[>] 0) (𝓝 1) := by + simpa only [zero_add,sub_add_cancel] using! hf.tendsto_zero.add_const (1:A) + have hi := tendsto_subpower (inverse_tendsto_one ht) + have h := hi.mul_powerSmall hf + obtain ⟨p,hp,h⟩ := h + refine ⟨p,hp,?_⟩ + apply h.neg_left.congr_left + intro s + rw [mul_sub,mul_one,Ring.inverse_mul_cancel _ (hu s),neg_sub] + +omit [NormedAlgebra ℝ A] [CompleteSpace A] in +theorem inverse_mul_of_units {a b : A} (ha : IsUnit a) (hb : IsUnit b) : + Ring.inverse (a*b)=Ring.inverse b*Ring.inverse a := by + obtain ⟨u,rfl⟩ := ha + obtain ⟨v,rfl⟩ := hb + rw [←Units.val_mul,Ring.inverse_unit,Ring.inverse_unit,Ring.inverse_unit,mul_inv_rev] + rfl + +theorem inverse_gauge (X : A) (s : ℝ) : Ring.inverse (gauge X s)=gauge (-X) s := by + have hu : IsUnit (gauge X s) := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + exact NormedSpace.isUnit_exp _ + calc + _ = Ring.inverse (gauge X s)*(gauge X s*gauge (-X) s) := by rw [gauge_mul_neg,mul_one] + _ = gauge (-X) s := by rw [←mul_assoc,Ring.inverse_mul_cancel _ hu,one_mul] + +variable [FiniteDimensional ℝ A] + +theorem inverse_solution_sub_gauge {X : A} (F : NilpotentFiltration A) (hX : X∈F.space 1) + {R : ℝ → A} (hRm : ∀ s,R s∈F.space 1) {b : ℝ} (hb : 0 < b) + (hR : ContinuousOn R (Icc 0 b)) : + PowerSmall (fun s => Ring.inverse (solution F X R s)-gauge (-X) s) := by + have hnil := pow_cutoff_eq_zero F hX + have hh := transport_sub_one_powerSmall hb (regular_integrable X hnil hb.le hR) + (regular_subpower hnil (continuousOn_subpower hb hR)) F.cutoff + have hu (s : ℝ) := transport_isUnit F (regular_mem F hX hRm) 0 s F.cutoff + have hi := inverse_sub_one_powerSmall hu hh + apply (hi.mul_subpower (gauge_subpower (by rw [neg_pow,hnil,mul_zero] : (-X)^(F.cutoff+1)=0))).congr + intro s + have hg : IsUnit (gauge X s) := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + exact NormedSpace.isUnit_exp _ + rw [solution,inverse_mul_of_units hg (hu s),inverse_gauge,sub_mul,one_mul] + +end PowerAsymptotic + +namespace KZCollar +open Set Filter PowerAsymptotic Asymptotics +open scoped Topology +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +omit [NormedAlgebra ℝ A] in +theorem subpower_congrEventual {f g : ℝ → A} (hf : Subpower f) (hfg : f =ᶠ[𝓝[>] 0] g) : + Subpower g := fun p hp => (hf p hp).congr' hfg .rfl + +theorem linear_powerSmall (c : ℝ) : PowerSmall (fun s : ℝ => c*s) := by + refine ⟨1,by norm_num,IsBigO.of_bound |c| ?_⟩ + filter_upwards [] with s + simp only [Real.rpow_one,Real.norm_eq_abs,abs_mul,le_refl] + +theorem gauge_at_larger_subpower {X : A} {N : ℕ} (hX : X^(N+1)=0) {r : ℝ → ℝ} + (hr : Tendsto r (𝓝[>] 0) (𝓝[>] 0)) (hle : ∀ᶠ s in 𝓝[>] 0,s ≤ r s) : + Subpower (fun s => gauge X (r s)) := by + intro p hp + have h := (gauge_subpower hX p hp).comp_tendsto hr + apply h.trans + apply IsBigO.of_norm_eventuallyLE + filter_upwards [self_mem_nhdsWithin,hle] with s hs hsr + change ‖(r s)^(-p)‖ ≤ s^(-p) + rw [Real.norm_of_nonneg (Real.rpow_nonneg (hs.le.trans hsr) _)] + exact Real.rpow_le_rpow_of_nonpos hs hsr (by linarith) + +variable [CompleteSpace A] + +theorem gauge_mul_scale (X : A) {r s : ℝ} (hr : r≠0) (hs : s≠0) : + gauge X (r*s)=gauge X r*gauge X s := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + unfold gauge + rw [Real.log_mul hr hs,add_smul,NormedSpace.exp_add_of_commute] + exact (Commute.refl X).smul_left _ |>.smul_right _ + +theorem gauge_add_of_commute {X Y : A} (h : Commute X Y) (s : ℝ) : + gauge (X+Y) s=gauge X s*gauge Y s := by + let := NormedAlgebra.restrictScalars ℚ ℝ A + unfold gauge + rw [smul_add,NormedSpace.exp_add_of_commute ((h.smul_left _).smul_right _)] + +theorem gauge_continuousAt {X : A} {s : ℝ} (hs : s≠0) : ContinuousAt (gauge X) s := + (gauge_derivative X hs).continuousAt + +omit [CompleteSpace A] in +@[simp] theorem gauge_one (X : A) : gauge X 1=1 := by simp [gauge] + +theorem gauge_ratio_limit (X : A) : + Tendsto (fun s : ℝ => gauge X (1+s)) (𝓝[>] 0) (𝓝 (1:A)) := by + have ht : Tendsto (fun s : ℝ => 1+s) (𝓝[>] 0) (𝓝 1) := by + simpa only [add_zero] using! (tendsto_const_nhds (x:=(1:ℝ))).add + (tendsto_id.mono_left nhdsWithin_le_nhds : Tendsto (fun s : ℝ => s) (𝓝[>] 0) (𝓝 0)) + simpa only [gauge_one] using! (gauge_continuousAt (X:=X) (by norm_num : (1:ℝ)≠0)).tendsto.comp ht + +end KZCollar + +namespace FinitePicard + +section +open MeasureTheory Set KZCollar +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def centralizer (Z : A) : Submodule ℝ A where + carrier := {a | Commute Z a} + zero_mem' := Commute.zero_right Z + add_mem' := fun h h' => h.add_right h' + smul_mem' := fun r _ h => h.smul_right r + +variable [FiniteDimensional ℝ A] + +theorem term_commute (Z : A) {Ω : ℝ → A} (hΩ : ∀ t,Commute Z (Ω t)) (a : ℝ) (n : ℕ) (t : ℝ) : + Commute Z (term Ω a n t) := by + induction n generalizing t with + | zero => exact Commute.one_right Z + | succ n ih => + exact integral_mem_submodule (centralizer Z) (fun s => Ω s*term Ω a n s) a t + (fun s => (hΩ s).mul_right (ih s)) + +theorem transport_commute (Z : A) {Ω : ℝ → A} (hΩ : ∀ t,Commute Z (Ω t)) (a : ℝ) (N : ℕ) (t : ℝ) : + Commute Z (transport Ω a N t) := + Commute.sum_right (Finset.range (N+1)) _ Z (fun n _ => term_commute Z hΩ a n t) + +omit [FiniteDimensional ℝ A] in +theorem gauge_commute {X Z : A} {N : ℕ} (hX : X^(N+1)=0) (h : Commute Z X) (s : ℝ) : + Commute Z (gauge X s) := by + rw [gauge_finite X hX] + exact Commute.sum_right _ _ Z (fun n _ => (h.pow_right n).smul_right _) + +end + +open MeasureTheory Set +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] + +theorem transport_add_commute (F : NilpotentFiltration A) {Ω Ξ : ℝ → A} + (hΩ : ∀ s,Ω s∈F.space 1) (hΞ : ∀ s,Ξ s∈F.space 1) + {a b : ℝ} (hab : a Ω s+Ξ s) a F.cutoff b= + transport Ω a F.cutoff b*transport Ξ a F.cutoff b := by + let f := fun t => transport Ω a F.cutoff t*transport Ξ a F.cutoff t + have hf : ∀ s∈Ioo a b,HasDerivAt f ((Ω s+Ξ s)*f s) s := by + intro s hs + apply ((derivative_nilpotent_transport F hΩ hiΩ hcΩ hs).mul + (derivative_nilpotent_transport F hΞ hiΞ hcΞ hs)).congr_deriv + dsimp only [f] + have hh := transport_commute (Ξ s) (hcomm s) a F.cutoff s + rw [mul_assoc,←mul_assoc (transport Ω a F.cutoff s) (Ξ s),←hh.eq,mul_assoc] + rw [add_mul] + have hfc : ContinuousOn f (Icc a b) := by + have hc₁ := continuousOn_transport hiΩ F.cutoff + have hc₂ := continuousOn_transport hiΞ F.cutoff + rw [uIcc_of_le hab.le] at hc₁ hc₂ + exact hc₁.mul hc₂ + have hu : ∀ s∈Icc a b,IsUnit (f s) := fun s _ => + (transport_isUnit F hΩ a s F.cutoff).mul (transport_isUnit F hΞ a s F.cutoff) + rw [transport_eq_fundamental F (fun s => (F.space 1).add_mem (hΩ s) (hΞ s)) + hab (hiΩ.add hiΞ) (hcΩ.add hcΞ) hf hfc hu] + simp only [f,transport_base,mul_one,Ring.inverse_one] + +end FinitePicard + +namespace KZProduct +open FinitePicard KZCollar MeasureTheory Set +variable {A B C : Type*} [NormedRing A] [NormedRing B] [NormedRing C] + [NormedAlgebra ℝ A] [NormedAlgebra ℝ B] [NormedAlgebra ℝ C] + [FiniteDimensional ℝ A] [FiniteDimensional ℝ B] [FiniteDimensional ℝ C] + [CompleteSpace A] [CompleteSpace B] [CompleteSpace C] +variable (f : A →ₐ[ℝ] C) (g : B →ₐ[ℝ] C) (hc : ∀ a b,Commute (f a) (g b)) + +include hc +omit [FiniteDimensional ℝ A] [FiniteDimensional ℝ B] [FiniteDimensional ℝ C] + [CompleteSpace A] [CompleteSpace B] [CompleteSpace C] in + theorem shuffle (a c : A) (b d : B) : + (f a*g b)*(f c*g d)=f (a*c)*g (b*d) := by + rw [(hc c b).symm.mul_mul_mul_comm,map_mul,map_mul] + +omit [FiniteDimensional ℝ A] [FiniteDimensional ℝ B] [FiniteDimensional ℝ C] + [CompleteSpace A] [CompleteSpace B] in + theorem gauge_sum {X : A} {Y : B} {M N : ℕ} + (hX : X^(M+1)=0) (hY : Y^(N+1)=0) (s : ℝ) : + gauge (f X+g Y) s=f (gauge X s)*g (gauge Y s) := by + rw [gauge_add_of_commute (hc X Y),←map_gauge f X hX,←map_gauge g Y hY] + +omit [FiniteDimensional ℝ A] [FiniteDimensional ℝ B] [FiniteDimensional ℝ C] in + theorem regular_sum {X Y : A} {Z T : B} {M N : ℕ} + (hX : X^(M+1)=0) (hZ : Z^(N+1)=0) (s : ℝ) : + regularForm (f X+g Z) (f Y+g T) s=f (regularForm X Y s)+g (regularForm Z T s) := by + have hXn : (-X)^(M+1)=0 := by rw [neg_pow,hX,mul_zero] + have hZn : (-Z)^(N+1)=0 := by rw [neg_pow,hZ,mul_zero] + have hn : -(f X+g Z)=f (-X)+g (-Z) := by rw [map_neg,map_neg,neg_add] + simp only [regularForm,hn,gauge_sum f g hc hX hZ,gauge_sum f g hc hXn hZn] + have hm : (s-1)⁻¹ • (f Y+g T)=f ((s-1)⁻¹ • Y)*g 1+f 1*g ((s-1)⁻¹ • T) := by + simp only [smul_add,map_smul,map_one,mul_one,one_mul] + rw [hm,mul_add,add_mul,shuffle f g hc,shuffle f g hc, + shuffle f g hc,shuffle f g hc] + simp only [mul_one,one_mul,gauge_neg_mul,map_one] + +omit [CompleteSpace A] [CompleteSpace B] in + theorem normalized_sum (F : NilpotentFiltration A) (G : NilpotentFiltration B) + (H : NilpotentFiltration C) {X Y : A} {Z T : B} + (hX : X∈F.space 1) (hY : Y∈F.space 1) (hZ : Z∈G.space 1) (hT : T∈G.space 1) + (hfX : f X∈H.space 1) (hfY : f Y∈H.space 1) + (hgZ : g Z∈H.space 1) (hgT : g T∈H.space 1) + {s : ℝ} (hs : 0 regularForm (f X) (f Y) r+regularForm (g Z) (g T) r) from funext hreg] + rw [transport_add_commute H (regularForm_mem H hfX hfY) (regularForm_mem H hgZ hgT) hs + (regularForm_integrable (f X) (f Y) hfn hs.le hs1) + (regularForm_integrable (g Z) (g T) hgn hs.le hs1) + (regularForm_continuous _ _ hs1.le) (regularForm_continuous _ _ hs1.le) hcomm] + have ht : Commute (gauge (g Z) s) (transport (regularForm (f X) (f Y)) 0 H.cutoff s) := by + apply transport_commute + intro r + rw [←map_gauge g Z (pow_cutoff_eq_zero G hZ),←map_regularForm f X Y (pow_cutoff_eq_zero F hX)] + exact (hc _ _).symm + exact ht.mul_mul_mul_comm _ _ + + theorem associator_product (F : NilpotentFiltration A) (G : NilpotentFiltration B) + (H : NilpotentFiltration C) {X Y : A} {Z T : B} + (hX : X∈F.space 1) (hY : Y∈F.space 1) (hZ : Z∈G.space 1) (hT : T∈G.space 1) + (hfX : f X∈H.space 1) (hfY : f Y∈H.space 1) + (hgZ : g Z∈H.space 1) (hgT : g T∈H.space 1) : + associator H (f X+g Z) (f Y+g T)=f (associator F X Y)*g (associator G Z T) := by + have h₁ := normalized_sum f g hc F G H hX hY hZ hT hfX hfY hgZ hgT + (by norm_num : (0:ℝ)<1/2) (by norm_num : (1/2:ℝ)<1) + have h₂ := normalized_sum f g hc F G H hY hX hT hZ hfY hfX hgT hgZ + (by norm_num : (0:ℝ)<1/2) (by norm_num : (1/2:ℝ)<1) + simp only [KZCollar.associator,rightSolution,show (1:ℝ)-1/2=1/2 by norm_num] + rw [h₁,h₂] + have hu := (normalizedSolution_isUnit G hT hZ (1/2)).map g + rw [Ring.inverse_mul (Or.inr hu),←map_unit_inverse f (normalizedSolution_isUnit F hY hX (1/2)), + ←map_unit_inverse g (normalizedSolution_isUnit G hT hZ (1/2)), + (hc (Ring.inverse (normalizedSolution F Y X (1/2))) (Ring.inverse (normalizedSolution G T Z (1/2)))).eq.symm, + shuffle f g hc] + +end KZProduct + +namespace CutoffKZ +open CutoffDepth FinitePicard KZCollar MeasureTheory Set Filter +open scoped Topology + +theorem coeff_gauge_Y (N m : ℕ) (hN : m+1 ≤ N) (hm : 0 < m) (p : Q ℝ N) (s : ℝ) : + c N m (gauge (-Y N) s*p)=c N m p := by + have hy : (-Y N)^(N+1)=0 := by + have hh : Y N^(N+1)=0 := pow_cutoff_eq_zero (weight N) (gen_weight N true) + rw [neg_pow,hh,mul_zero] + rw [gauge_finite _ hy,Finset.sum_mul,map_sum,Finset.sum_eq_single 0] + · simp + · intro i hi hi0 + rw [smul_mul_assoc,map_smul,neg_pow] + have he : (-1:Q ℝ N)^i * Y N^i *p = (-1:ℝ)^i • (Y N^i*p) := by + simp only [Algebra.smul_def,map_pow,map_neg,map_one] + noncomm_ring + rw [he,map_smul] + change _ • (_ • (coeff N (GenericIhara.depthOneWord m) (gen N true^i*p)))=0 + rw [coeff_Y_prefix N i m hN hm,ite_eq_right hi0,smul_zero,smul_zero] + · intro hn + exact False.elim (hn (Finset.mem_range.mpr (Nat.zero_lt_succ N))) + +def prefactor (m i : ℕ) (s : ℝ) : ℝ := + (Real.log s^i/(i.factorial:ℝ)) * + if i ≤ m then -(1/((m-i).factorial:ℝ))*(∫ t in (0:ℝ)..s,DepthIntegral.kernel (m-i) t) else 0 + +theorem coeff_normalized (N m : ℕ) (hN : m+1 ≤ N) {s : ℝ} (h0 : 0 ≤ s) (h1 : s < 1) : + c N m (normalizedSolution (weight N) (X N) (Y N) s)= + ∑ i∈Finset.range (N+1),prefactor m i s := by + rw [normalizedSolution,gauge_finite _ (X_nilpotent N),Finset.sum_mul,map_sum] + apply Finset.sum_congr rfl + intro i hi + rw [smul_mul_assoc,map_smul] + change (Real.log s^i/(i.factorial:ℝ))*(coeff N (GenericIhara.depthOneWord m) + (gen N false^i*transport (regularForm (X N) (Y N)) 0 N s))=_ + rw [coeff_prefix N i m hN] + unfold prefactor + split_ifs with him + · congr 1 + exact coeff_transport N (m-i) (by omega) h0 h1 + · rfl + +theorem prefactor_limit (m i : ℕ) (hm : 0 < m) : + Tendsto (prefactor m i) (𝓝[<] 1) + (𝓝 (if i=0 then -(1/(m.factorial:ℝ))*(∫ t in (0:ℝ)..1,DepthIntegral.kernel m t) else 0)) := by + change Tendsto (fun s => prefactor m i s) _ _ + have hl : Tendsto Real.log (𝓝[<] (1:ℝ)) (𝓝 0) := by + simpa only [Real.log_one] using (Real.continuousAt_log one_ne_zero).tendsto.mono_left + (show 𝓝[<] (1:ℝ) ≤ 𝓝 1 from nhdsWithin_le_nhds) + by_cases hi : i=0 + · subst i + simpa only [prefactor,pow_zero,Nat.factorial_zero,Nat.cast_one,div_one,Nat.zero_le, + ↓reduceIte,Nat.sub_zero,one_mul] using + (tendsto_const_nhds (x:= -(1/(m.factorial:ℝ)))).mul (DepthIntegral.integral_limit m hm) + · rw [ite_eq_right hi] + by_cases him : i ≤ m + · by_cases him' : i=m + · subst i + have hh := (DepthIntegral.log_endpoint_product m hm).div_const (m.factorial:ℝ) + simp only [zero_div] at hh + apply hh.congr' + filter_upwards [self_mem_nhdsWithin, + (eventually_gt_nhds (by norm_num : (0:ℝ)<1)).filter_mono nhdsWithin_le_nhds] with s hs hs0 + unfold prefactor + rw [ite_eq_left (le_refl m),Nat.sub_self,DepthIntegral.integral_zero hs0.le hs] + simp only [Nat.factorial_zero,Nat.cast_one,div_one] + ring + · have hpos : 0 < m-i := by omega + have hpow : Tendsto (fun s : ℝ => Real.log s^i/(i.factorial:ℝ)) (𝓝[<] 1) (𝓝 0) := by + simpa only [zero_pow hi,zero_div] using (hl.pow i).div_const (i.factorial:ℝ) + have h := hpow.mul ((tendsto_const_nhds (x:= -(1/((m-i).factorial:ℝ)))).mul + (DepthIntegral.integral_limit (m-i) hpos)) + simpa only [prefactor,ite_eq_left him,zero_mul] using h + · simp only [prefactor,ite_eq_right him,mul_zero] + exact tendsto_const_nhds + +theorem coeff_normalized_limit (N m : ℕ) (hN : m+1 ≤ N) (hm : 0 < m) : + Tendsto (fun s => c N m (normalizedSolution (weight N) (X N) (Y N) s)) (𝓝[<] 1) + (𝓝 (-(1/(m.factorial:ℝ))*(∫ t in (0:ℝ)..1,DepthIntegral.kernel m t))) := by + have hh := tendsto_finsetSum (Finset.range (N+1)) (fun i _ => prefactor_limit m i hm) + simp only [Finset.sum_ite_eq',Finset.mem_range,Nat.zero_lt_succ,↓reduceIte] at hh + apply hh.congr' + filter_upwards [self_mem_nhdsWithin, + (eventually_gt_nhds (by norm_num : (0:ℝ)<1)).filter_mono nhdsWithin_le_nhds] with s hs hs0 + exact (coeff_normalized N m hN hs0.le hs).symm + +theorem left_regularized_limit (N : ℕ) : + Tendsto (fun s => gauge (-Y N) (1-s)*normalizedSolution (weight N) (X N) (Y N) s) + (𝓝[<] 1) (𝓝 (associator (weight N) (X N) (Y N))) := by + have hh := ((regularTransport_limit (Y:=X N) (weight N) (gen_weight N true)).comp + DepthIntegral.one_sub_limit).mul (tendsto_const_nhds (x:=associator (weight N) (X N) (Y N))) + simp only [one_mul] at hh + apply hh.congr' + filter_upwards [self_mem_nhdsWithin, + (eventually_gt_nhds (by norm_num : (0:ℝ)<1)).filter_mono nhdsWithin_le_nhds] with s hs hs0 + rw [left_eq_right_mul_associator (weight N) (gen_weight N false) (gen_weight N true) ⟨hs0,hs⟩] + simp only [rightSolution,normalizedSolution,←mul_assoc,gauge_neg_mul,one_mul,Function.comp_apply] + +theorem associator_coefficient (N m : ℕ) (hN : m+1 ≤ N) (hm : 0 < m) : + c N m (associator (weight N) (X N) (Y N))= + -(1/(m.factorial:ℝ))*(∫ t in (0:ℝ)..1,DepthIntegral.kernel m t) := by + have hh := (c N m).toContinuousLinearMap.continuous.tendsto + (associator (weight N) (X N) (Y N)) |>.comp (left_regularized_limit N) + have he : (fun s => c N m (gauge (-Y N) (1-s)*normalizedSolution (weight N) (X N) (Y N) s))= + (fun s => c N m (normalizedSolution (weight N) (X N) (Y N) s)) := by + funext s + exact coeff_gauge_Y N m hN hm _ _ + change Tendsto (fun s => c N m (gauge (-Y N) (1-s)*normalizedSolution (weight N) (X N) (Y N) s)) _ _ at hh + rw [he] at hh + exact tendsto_nhds_unique hh (coeff_normalized_limit N m hN hm) + +theorem associator_coefficient_ne_zero (N m : ℕ) (hN : m+1 ≤ N) (hm : 0 < m) : + c N m (associator (weight N) (X N) (Y N))≠0 := by + rw [associator_coefficient N m hN hm] + exact DepthIntegral.coefficient_ne_zero m hm + + theorem depth_initial (N : ℕ) : depthSpace (R:=ℝ) N 0=⊤ := by + apply eq_top_iff.mpr + intro u _ + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective ℝ + (TruncatedWords.relations (∅ : Set (AssociativeElimination.A ℝ Bool)) N) u + exact ⟨p,WordGrading.mem_space (by intros; exact Nat.zero_le _),rfl⟩ + + theorem gaugeX_depth_zero (N : ℕ) (s : ℝ) : KZCollar.gauge (X N) s∈depthSpace N 0 := by + rw [depth_initial]; trivial + + theorem left_regularized_depth (N : ℕ) (s : ℝ) : + KZCollar.gauge (-Y N) (1-s)*normalizedSolution (weight N) (X N) (Y N) s-KZCollar.gauge (X N) s∈depthSpace N 1 := by + have hg := gauge_sub_one_mem (depth N) ((depthSpace N 1).neg_mem (gen_depth N true)) (1-s) + have ht : transport (regularForm (X N) (Y N)) 0 N s-1∈depthSpace N 1 := + transport_sub_one_mem (depth N) (regularForm_depth N) 0 s N + have hnorm : normalizedSolution (weight N) (X N) (Y N) s∈depthSpace N 0 := by + rw [depth_initial]; trivial + have h := (depthSpace N 1).add_mem (depth_mul N 1 0 hg hnorm) + (depth_mul N 0 1 (gaugeX_depth_zero N s) ht) + have he : KZCollar.gauge (-Y N) (1-s)*normalizedSolution (weight N) (X N) (Y N) s-KZCollar.gauge (X N) s= + (KZCollar.gauge (-Y N) (1-s)-1)*normalizedSolution (weight N) (X N) (Y N) s+ + KZCollar.gauge (X N) s*(transport (regularForm (X N) (Y N)) 0 N s-1) := by + unfold normalizedSolution + change KZCollar.gauge (-Y N) (1-s)*(KZCollar.gauge (X N) s*transport (regularForm (X N) (Y N)) 0 N s)-KZCollar.gauge (X N) s=_ + change _= (KZCollar.gauge (-Y N) (1-s)-1)*(KZCollar.gauge (X N) s*transport (regularForm (X N) (Y N)) 0 N s)+_ + noncomm_ring + rwa [he] + + theorem associator_depth_one (N : ℕ) : + associator (weight N) (X N) (Y N)-1∈depthSpace N 1 := by + have hg : Tendsto (KZCollar.gauge (X N)) (𝓝[<] (1:ℝ)) (𝓝 (1:Q ℝ N)) := by + have hh := (gauge_derivative (X N) (s:=1) one_ne_zero).continuousAt.tendsto.mono_left + (show 𝓝[<] (1:ℝ)≤𝓝 (1:ℝ) from nhdsWithin_le_nhds) + simpa only [KZCollar.gauge,Real.log_one,zero_smul,NormedSpace.exp_zero] using hh + exact (depthSpace (R:=ℝ) N 1).closed_of_finiteDimensional.mem_of_tendsto + ((left_regularized_limit N).sub hg) (Eventually.of_forall (left_regularized_depth N)) + +end CutoffKZ + +namespace ConjugateComparison + +section +open AssociativeElimination TruncatedWords TruncatedSubstitution +variable {R : Type*} [CommRing R] (N : ℕ) +local notation "Q" => TruncatedWords.Q (∅ : Set (A R Bool)) N +local notation "F" => filtration (∅ : Set (A R Bool)) N + +theorem mem_zero (u : Q) : u∈F 0 := by rw [filtration_initial]; trivial + +theorem inverse_normalized (P : Qˣ) (hP : (P:Q)-1∈F 1) : ((P⁻¹:Qˣ):Q)-1∈F 1 := by + have h := filtration_mul ∅ N 0 1 (mem_zero N ((P⁻¹:Qˣ):Q)) hP + have he : ((P⁻¹:Qˣ):Q)*((P:Q)-1)=-(((P⁻¹:Qˣ):Q)-1) := by + rw [mul_sub,Units.inv_mul,mul_one,neg_sub] + rw [he] at h + exact (F 1).neg_mem_iff.mp h + +def family (P : Qˣ) : Bool → Q + | false => gen N false + | true => ((P⁻¹:Qˣ):Q)*gen N true*(P:Q) + +theorem family_mem (P : Qˣ) (b : Bool) : family N P b∈F 1 := by + cases b + · exact gen_mem N false + · exact filtration_mul ∅ N 1 0 + (filtration_mul ∅ N 0 1 (mem_zero N _) (gen_mem N true)) (mem_zero N _) + +theorem family_leading (P : Qˣ) (hP : (P:Q)-1∈F 1) (b : Bool) : + family N P b-gen N b∈F 2 := by + cases b + · simp only [family,sub_self,Submodule.zero_mem] + · have hh := (F 2).sub_mem + (filtration_mul ∅ N 1 1 (gen_mem N true) hP) + (filtration_mul ∅ N 1 1 hP (gen_mem N true)) + have hi := filtration_mul ∅ N 0 2 (mem_zero N ((P⁻¹:Qˣ):Q)) hh + have he : ((P⁻¹:Qˣ):Q)*(gen N true*((P:Q)-1)-((P:Q)-1)*gen N true)= + family N P true-gen N true := by + simp only [family,mul_sub,sub_mul,mul_one,one_mul] + rw [←mul_assoc ((P⁻¹:Qˣ):Q) (P:Q),Units.inv_mul,one_mul] + rw [mul_assoc] + abel + rwa [he] at hi + +def transport (P : Qˣ) (hP : (P:Q)-1∈F 1) : Q ≃ₐ[R] Q := + equiv N (family N P) (family_mem N P) (family_leading N P hP) + +@[simp] theorem transport_gen (P : Qˣ) (hP : (P:Q)-1∈F 1) (b : Bool) : + transport N P hP (gen N b)=family N P b := subst_gen N _ _ b + +def theta (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : Q ≃ₐ[R] Q := + (transport N P hP).symm.trans (transport N V hV) + +def unitArrow (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : Qˣ := + V*(Units.map (theta N P V hP hV).toMonoidHom P)⁻¹ + +theorem exact_comparison (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : + (unitArrow N P V hP hV:Q)*theta N P V hP hV (P:Q)=(V:Q) := by + change ((V:Q)*((Units.map (theta N P V hP hV).toMonoidHom P)⁻¹:Qˣ))* + (Units.map (theta N P V hP hV).toMonoidHom P:Q)=(V:Q) + rw [mul_assoc,Units.inv_mul,mul_one] + +theorem theta_transport (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) (u : Q) : + theta N P V hP hV (transport N P hP u)=transport N V hV u := by + exact congrArg (transport N V hV) ((transport N P hP).symm_apply_apply u) + +theorem theta_x (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : + theta N P V hP hV (gen N false)=gen N false := by + simpa only [transport_gen,family] using theta_transport N P V hP hV (gen N false) + +theorem theta_y (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : + theta N P V hP hV (gen N true)= + (((unitArrow N P V hP hV)⁻¹:Qˣ):Q)*gen N true*(unitArrow N P V hP hV:Q) := by + have hh := theta_transport N P V hP hV (gen N true) + simp only [transport_gen,family,map_mul] at hh + let M := Units.map (theta N P V hP hV).toMonoidHom P + have h : ((M⁻¹:Qˣ):Q)*theta N P V hP hV (gen N true)*(M:Q)= + ((V⁻¹:Qˣ):Q)*gen N true*(V:Q) := hh + have hh := congrArg (fun z : Q => (M:Q)*z*((M⁻¹:Qˣ):Q)) h + simp only [mul_assoc,Units.mul_inv_cancel_left] at hh + simpa only [unitArrow,mul_inv_rev,inv_inv,Units.val_mul,M,mul_assoc,Units.mul_inv,mul_one] using hh + +end + +open AssociativeElimination TruncatedWords TruncatedSubstitution +variable {R : Type*} [CommRing R] (N : ℕ) +local notation "Q" => TruncatedWords.Q (∅ : Set (A R Bool)) N +local notation "F" => filtration (∅ : Set (A R Bool)) N + +theorem transport_raises (P : Qˣ) (hP : (P:Q)-1∈F 1) (n : ℕ) (u : Q) (hu : u∈F n) : + transport N P hP u-u∈F (n+1) := + subst_raises N (family N P) (family_mem N P) (family_leading N P hP) n u hu + +theorem transport_inverse_preserves (P : Qˣ) (hP : (P:Q)-1∈F 1) + (n : ℕ) (u : Q) (hu : u∈F n) : (transport N P hP).symm u∈F n := by + have hh : ∀ k≤n,(transport N P hP).symm u∈F k := by + intro k + induction k with + | zero => intro _; exact mem_zero N _ + | succ k ih => + intro hk + have hd := transport_raises N P hP k _ (ih (by omega)) + rw [AlgEquiv.apply_symm_apply] at hd + have he := (F (k+1)).sub_mem (filtration_antitone ∅ N hk hu) hd + simpa only [sub_sub_cancel] using he + exact hh n le_rfl + +theorem theta_raises (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) + (n : ℕ) (u : Q) (hu : u∈F n) : theta N P V hP hV u-u∈F (n+1) := by + have hh := transport_inverse_preserves N P hP n u hu + have hd := (F (n+1)).sub_mem (transport_raises N V hV n _ hh) + (transport_raises N P hP n _ hh) + simpa only [sub_sub_sub_cancel_right,AlgEquiv.apply_symm_apply,theta,AlgEquiv.trans_apply] using hd + +theorem theta_preserves (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) + (n : ℕ) (u : Q) (hu : u∈F n) : theta N P V hP hV u∈F n := by + have h := (F n).add_mem (filtration_antitone ∅ N (Nat.le_succ n) + (theta_raises N P V hP hV n u hu)) hu + simpa only [sub_add_cancel] using h + +theorem mul_normalized (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : + ((P*V:Qˣ):Q)-1∈F 1 := by + have h := (F 1).add_mem + (filtration_mul ∅ N 1 0 hP (mem_zero N (V:Q))) hV + simpa only [sub_mul,one_mul,sub_add_sub_cancel,Units.val_mul] using h + +theorem unitArrow_normalized (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : + (unitArrow N P V hP hV:Q)-1∈F 1 := by + apply mul_normalized N V _ hV + apply inverse_normalized N + change theta N P V hP hV (P:Q)-1∈_ + simpa only [map_sub,map_one] using theta_preserves N P V hP hV 1 ((P:Q)-1) hP + +end ConjugateComparison + +namespace DepthSubstitution +open AssociativeElimination WordGrading TruncatedWords TruncatedSubstitution +variable {R : Type*} [CommRing R] (N : ℕ) +local notation "Q" => CutoffDepth.Q R N +local notation "F" => CutoffDepth.depthSpace (R:=R) N + + theorem initial : F 0=⊤ := by + apply eq_top_iff.mpr + intro u _ + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective R (relations (∅ : Set (A R Bool)) N) u + exact ⟨p,mem_space (by intros; exact Nat.zero_le _),rfl⟩ + + theorem all_zero (u : Q) : u∈F 0 := by rw [initial]; trivial + + theorem lift_word_mem (f : Bool → Q) (hf : ∀ a,f a∈F (GenericIhara.depth a)) (w : FreeMonoid Bool) : + lift (R:=R) f (word w)∈F (degree GenericIhara.depth w) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa only [word_one,map_one,degree_one] using CutoffDepth.depth_one (R:=R) N + | of_mul a w ih => + rw [word_mul,word_of,map_mul,lift_atom,degree_mul,degree_of] + exact CutoffDepth.depth_mul N _ _ (hf a) ih + + theorem lift_word_difference (f g : Bool → Q) + (hf : ∀ a,f a∈F (GenericIhara.depth a)) (hg : ∀ a,g a∈F (GenericIhara.depth a)) + (hd : ∀ a,f a-g a∈F (GenericIhara.depth a+1)) (w : FreeMonoid Bool) : + lift (R:=R) f (word w)-lift (R:=R) g (word w)∈F (degree GenericIhara.depth w+1) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,word_of,map_mul,map_mul,lift_atom,lift_atom,degree_mul,degree_of] + have he : f a*lift (R:=R) f (word w)-g a*lift (R:=R) g (word w)= + (f a-g a)*lift (R:=R) g (word w)+f a*(lift (R:=R) f (word w)-lift (R:=R) g (word w)) := by + rw [sub_mul,mul_sub]; abel + rw [he] + exact (F _).add_mem + (by simpa only [Nat.add_right_comm] using CutoffDepth.depth_mul N _ _ (hd a) (lift_word_mem N g hg w)) + (by simpa only [Nat.add_assoc] using CutoffDepth.depth_mul N _ _ (hf a) ih) + + theorem subst_raises (f : Bool → Q) + (hw : ∀ a,f a∈filtration ∅ N 1) + (hf : ∀ a,f a∈F (GenericIhara.depth a)) + (hd : ∀ a,f a-gen N a∈F (GenericIhara.depth a+1)) + (n : ℕ) (u : Q) (hu : u∈F n) : subst N f hw u-u∈F (n+1) := by + obtain ⟨p,hp,rfl⟩ := hu + change subst N f hw (quotient ∅ N p)-quotient ∅ N p∈_ + rw [subst_quotient] + have hh := map_space ((lift (R:=R) f).toLinearMap-(lift (R:=R) (gen N)).toLinearMap) _ + (fun w hw => CutoffDepth.depth_antitone N (Nat.add_le_add_right hw 1) + (lift_word_difference N f (gen N) hf (CutoffDepth.gen_depth N) hd w)) hp + simpa only [LinearMap.sub_apply,AlgHom.toLinearMap_apply,lift_gen] using hh + + theorem family_mem (P : Qˣ) (b : Bool) : ConjugateComparison.family N P b∈F (GenericIhara.depth b) := by + cases b + · exact CutoffDepth.gen_depth N false + · exact CutoffDepth.depth_mul N 1 0 + (CutoffDepth.depth_mul N 0 1 (all_zero N _) (CutoffDepth.gen_depth N true)) (all_zero N _) + + theorem family_leading (P : Qˣ) (hP : (P:Q)-1∈F 1) (b : Bool) : + ConjugateComparison.family N P b-gen N b∈F (GenericIhara.depth b+1) := by + cases b + · simp only [ConjugateComparison.family,sub_self,Submodule.zero_mem] + · have hh := (F 2).sub_mem + (CutoffDepth.depth_mul N 1 1 (CutoffDepth.gen_depth N true) hP) + (CutoffDepth.depth_mul N 1 1 hP (CutoffDepth.gen_depth N true)) + have hi := CutoffDepth.depth_mul N 0 2 (all_zero N ((P⁻¹:Qˣ):Q)) hh + have he : ((P⁻¹:Qˣ):Q)*(gen N true*((P:Q)-1)-((P:Q)-1)*gen N true)= + ConjugateComparison.family N P true-gen N true := by + simp only [ConjugateComparison.family,mul_sub,sub_mul,mul_one,one_mul] + rw [←mul_assoc ((P⁻¹:Qˣ):Q) (P:Q),Units.inv_mul,one_mul] + rw [mul_assoc] + abel + change ((P⁻¹:Qˣ):Q)*(gen N true*((P:Q)-1)-((P:Q)-1)*gen N true)∈F 2 at hi + rwa [he] at hi + +end DepthSubstitution + +namespace CutoffScaling +open AssociativeElimination WordGrading TruncatedWords TruncatedSubstitution +variable {R : Type*} [CommRing R] {α : Type*} (N : ℕ) +local notation "Q" => TruncatedWords.Q (∅ : Set (A R α)) N + + def map (r : R) : Q →ₐ[R] Q := subst N (fun a => r • gen N a) + (fun a => (filtration ∅ N 1).smul_mem r (gen_mem N a)) + + @[simp] theorem map_gen (r : R) (a : α) : map N r (gen N a)=r • gen N a := subst_gen N _ _ a + + theorem lift_word (r : R) (w : FreeMonoid α) : + lift (R:=R) (fun a => r • gen (R:=R) N a) (word w)=r^(degree wt w) • quotient (∅ : Set (A R α)) N (word w) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,map_mul,word_of,lift_atom,ih,degree_mul,degree_of] + change (r • gen N a)*(r^degree wt w • quotient ∅ N (word w))=r^(1+degree wt w) • quotient ∅ N (atom a*word w) + rw [pow_add,pow_one,map_mul,smul_mul_assoc,mul_smul_comm,smul_smul] + rfl + + theorem map_word (r : R) (w : FreeMonoid α) : + map N r (quotient ∅ N (word w))=r^(degree wt w) • quotient ∅ N (word w) := by + rw [map,subst_quotient,lift_word] + + theorem coefficient (r : R) (w : FreeMonoid α) (u : Q) : + TruncatedFree.coefficient N w (map N r u)=r^(degree wt w)*TruncatedFree.coefficient N w u := by + classical + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective R (relations (∅ : Set (A R α)) N) u + change TruncatedFree.coefficient N w (map N r (quotient ∅ N p))=_ + induction p using MonoidAlgebra.induction_on with + | of v => + change TruncatedFree.coefficient N w (map N r (quotient ∅ N (word v)))=r^(degree wt w)*TruncatedFree.coefficient N w (quotient ∅ N (word v)) + rw [map_word,map_smul] + simp only [TruncatedFree.coefficient_quotient,smul_eq_mul] + by_cases he : v=w + · subst v; rfl + · have hn : (word (R:=R) v).coeff w=0 := by simp [word,he] + simp only [hn,ite_self,mul_zero] + | add p q hp hq => simp only [map_add,hp,hq,mul_add] + | smul s p hp => simp only [map_smul,hp,smul_eq_mul]; ring + + theorem preserves_depth (r : R) (n : ℕ) (u : TruncatedWords.Q (∅ : Set (A R Bool)) N) + (hu : u∈CutoffDepth.depthSpace N n) : map N r u∈CutoffDepth.depthSpace N n := by + obtain ⟨p,hp,rfl⟩ := hu + change map N r (quotient ∅ N p)∈_ + rw [map,subst_quotient] + apply map_space (lift (R:=R) (fun a => r • gen N a)).toLinearMap _ (fun w hw => ?_) hp + change lift (R:=R) (fun a => r • gen N a) (word w)∈CutoffDepth.depthSpace N n + rw [lift_word] + exact (CutoffDepth.depthSpace N n).smul_mem _ ⟨word w,word_mem w hw,rfl⟩ + +end CutoffScaling + +namespace ConjugateComparison +open AssociativeElimination TruncatedWords TruncatedSubstitution +variable {R : Type*} [CommRing R] (N : ℕ) +local notation "Q" => CutoffDepth.Q R N +local notation "F" => CutoffDepth.depthSpace (R:=R) N + + theorem transport_depth_raises (P : Qˣ) (hP : (P:Q)-1∈filtration ∅ N 1) + (hPd : (P:Q)-1∈F 1) (n : ℕ) (u : Q) (hu : u∈F n) : + transport N P hP u-u∈F (n+1) := + DepthSubstitution.subst_raises N (family N P) (family_mem N P) + (DepthSubstitution.family_mem N P) (DepthSubstitution.family_leading N P hPd) n u hu + + theorem transport_inverse_depth (P : Qˣ) (hP : (P:Q)-1∈filtration ∅ N 1) + (hPd : (P:Q)-1∈F 1) (n : ℕ) (u : Q) (hu : u∈F n) : + (transport N P hP).symm u∈F n := by + have hh : ∀ k≤n,(transport N P hP).symm u∈F k := by + intro k + induction k with + | zero => intro _; exact DepthSubstitution.all_zero N _ + | succ k ih => + intro hk + have hd := transport_depth_raises N P hP hPd k _ (ih (by omega)) + rw [AlgEquiv.apply_symm_apply] at hd + have he := (F (k+1)).sub_mem (CutoffDepth.depth_antitone N hk hu) hd + simpa only [sub_sub_cancel] using he + exact hh n le_rfl + + theorem theta_depth_raises (P V : Qˣ) (hP : (P:Q)-1∈filtration ∅ N 1) + (hV : (V:Q)-1∈filtration ∅ N 1) (hPd : (P:Q)-1∈F 1) (hVd : (V:Q)-1∈F 1) + (n : ℕ) (u : Q) (hu : u∈F n) : theta N P V hP hV u-u∈F (n+1) := by + have hh := transport_inverse_depth N P hP hPd n u hu + have hd := (F (n+1)).sub_mem (transport_depth_raises N V hV hVd n _ hh) + (transport_depth_raises N P hP hPd n _ hh) + simpa only [sub_sub_sub_cancel_right,AlgEquiv.apply_symm_apply,theta,AlgEquiv.trans_apply] using hd + + theorem theta_depth_preserves (P V : Qˣ) (hP : (P:Q)-1∈filtration ∅ N 1) + (hV : (V:Q)-1∈filtration ∅ N 1) (hPd : (P:Q)-1∈F 1) (hVd : (V:Q)-1∈F 1) + (n : ℕ) (u : Q) (hu : u∈F n) : theta N P V hP hV u∈F n := by + have h := (F n).add_mem (CutoffDepth.depth_antitone N (Nat.le_succ n) + (theta_depth_raises N P V hP hV hPd hVd n u hu)) hu + simpa only [sub_add_cancel] using h + + theorem units_product_depth (P V : Qˣ) (hP : (P:Q)-1∈F 1) (hV : (V:Q)-1∈F 1) : + ((P*V:Qˣ):Q)-1∈F 1 := by + have h := (F 1).add_mem (CutoffDepth.depth_mul N 1 0 hP (DepthSubstitution.all_zero N (V:Q))) hV + simpa only [sub_mul,one_mul,sub_add_sub_cancel,Units.val_mul] using h + + theorem units_inverse_depth (P : Qˣ) (hP : (P:Q)-1∈F 1) : ((P⁻¹:Qˣ):Q)-1∈F 1 := by + have h := CutoffDepth.depth_mul N 0 1 (DepthSubstitution.all_zero N ((P⁻¹:Qˣ):Q)) hP + have he : ((P⁻¹:Qˣ):Q)*((P:Q)-1)= -(((P⁻¹:Qˣ):Q)-1) := by + rw [mul_sub,Units.inv_mul,mul_one,neg_sub] + rw [he] at h + exact (F 1).neg_mem_iff.mp h + + theorem unitArrow_depth (P V : Qˣ) (hP : (P:Q)-1∈filtration ∅ N 1) + (hV : (V:Q)-1∈filtration ∅ N 1) (hPd : (P:Q)-1∈F 1) (hVd : (V:Q)-1∈F 1) : + (unitArrow N P V hP hV:Q)-1∈F 1 := by + apply units_product_depth N V _ hVd + apply units_inverse_depth N + change theta N P V hP hV (P:Q)-1∈_ + simpa only [map_sub,map_one] using theta_depth_preserves N P V hP hV hPd hVd 1 ((P:Q)-1) hPd + +end ConjugateComparison + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Lattice.lean b/lean/OAI/Algebra/Drinfeld/Lattice.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce189bc48f143f5c459fc7bf5f33a60d3c1311ef --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Lattice.lean @@ -0,0 +1,743 @@ +import OAI.Algebra.Drinfeld.Descent + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +namespace LatticeDimension +open scoped TensorProduct +variable {ι F : Type*} [Field F] + +theorem reduction_lift (E : Submodule ℚ (ι → ℚ)) + (hs : Function.Surjective (Int.cast : ℤ → F)) {v : ι → F} + (hv : v∈reduction F E) : ∃ u : lattice E, (fun i => (u.val i : F))=v := by + obtain ⟨w,rfl⟩ := hv + induction w using TensorProduct.inductionOn with + + | tmul c u => + obtain ⟨z,rfl⟩ := hs c + refine ⟨z • u,?_⟩ + ext i + rw [scalarMap_tmul] + simp only [Submodule.coe_smul,Pi.smul_apply,zsmul_eq_mul,Int.cast_mul] + exact mul_comm _ _ + | add w w' hw hw' => + obtain ⟨u,hu⟩ := hw + obtain ⟨u',hu'⟩ := hw' + refine ⟨u+u',?_⟩ + rw [map_add,←hu,←hu'] + ext i + simp + +theorem reduction_lift_two (E : Submodule ℚ (ι → ℚ)) {v : ι → ZMod 2} + (hv : v∈reduction (ZMod 2) E) : ∃ u : lattice E,(fun i => (u.val i : ZMod 2))=v := by + apply reduction_lift E ?_ hv + intro c + exact ⟨c.val,by simp⟩ +theorem reduction_mono {E E' : Submodule ℚ (ι → ℚ)} (h : E≤E') : + reduction F E≤reduction F E' := by + rintro v ⟨w,rfl⟩ + induction w using TensorProduct.inductionOn with + + | tmul c u => + refine ⟨c ⊗ₜ (⟨u.val,h u.property⟩ : lattice E'),?_⟩ + simp only [scalarMap_tmul] + | add w w' hw hw' => simpa only [map_add] using (reduction F E').add_mem hw hw' +end LatticeDimension + +namespace SaturatedSolutions +open AssociativeElimination UniversalEmbedding WordGrading +open ReducedDimension +abbrev K := ZMod 2 +variable (n : ℕ) (E : Submodule ℚ (Wn n)) + +def image : Submodule ℚ (RationalBound.Words n → ℚ) := E.map (RationalBound.coordinates n) + +theorem image_le : image n E≤RationalBound.image n := by + rintro v ⟨p,_,rfl⟩ + exact ⟨p,rfl⟩ + +def reduction : Submodule K (solutions n) := + (LatticeDimension.reduction K (image n E)).comap (RationalBound.reducedCoordinates n) + +theorem reduction_image_le (hn : 2 p.property) + +theorem coordReduction_injective : Function.Injective (coordReduction n E) := by + intro p q h + apply Subtype.ext + apply RationalBound.reducedCoordinates_injective n + exact congrArg Subtype.val h + +theorem coordReduction_surjective (hn : 2 p.property) + +def gradedMap (hn : 2 1) n n (ReducedDimension.odd_length_bound n)] + exact Fin.sum_univ_eq_sum_range (fun r => Module.finrank K (oddPiece n r)) (n+1) + +theorem lattice_lift (u : LatticeDimension.lattice (image n E)) : + ∃ q : LieGrading.homogeneousLie (R:=ℤ) RationalBound.wt n, + LieDimension.coordinates ℤ RationalBound.wt n q=u.val ∧ + ∃ hq : (LieDimension.castHom (R:=ℚ) q).val∈Wn n, + (⟨(LieDimension.castHom (R:=ℚ) q).val,hq⟩ : Wn n)∈E := by + obtain ⟨p,hpE,hp⟩ := u.property + have hu : u.val∈LatticeDimension.lattice (LieDimension.image ℚ RationalBound.wt n) := + ⟨RationalBound.toHom n p,hp⟩ + rw [LieDimension.lattice_image] at hu + obtain ⟨q,hq⟩ := hu + have heq : LieDimension.castHom (R:=ℚ) q=RationalBound.toHom n p := by + apply LieDimension.coordinates_injective ℚ RationalBound.wt n + ext w + rw [LieDimension.coordinates_castHom] + change ((LieDimension.coordinates ℤ RationalBound.wt n q) w : ℚ)=RationalBound.coordinates n p w + rw [hq,congrFun hp w] + rfl + refine ⟨q,hq,?_,?_⟩ + · rw [heq] + exact p.property + · have hval : (LieDimension.castHom (R:=ℚ) q).val=p.val := congrArg Subtype.val heq + have hsub : (⟨(LieDimension.castHom (R:=ℚ) q).val, by rw [heq]; exact p.property⟩ : Wn n)=p := Subtype.ext hval + rw [hsub] + exact hpE + +theorem reduction_lift (hn : 2 + obtain ⟨t,ht,rfl⟩ := hp + rw [piece_tree] + split_ifs with h + · exact Submodule.subset_span ⟨t,ht,h,rfl⟩ + · exact Submodule.zero_mem _ + | zero => + have hz : piece wb r (0 : FreeLieAlgebra R α)=0 := (projection wb r).map_zero + rw [hz] + exact Submodule.zero_mem _ + | add p q _ _ hp hq => rw [piece_add]; exact Submodule.add_mem _ hp hq + | smul c p _ hp => rw [piece_smul]; exact Submodule.smul_mem _ c hp + +theorem treeDegree_pos {wt : α → ℕ} (h : ∀ a,0 simpa only [treeDegree_leaf] using h a + | node t u ht hu => rw [treeDegree_node]; omega + +theorem treeDegree_lower {wt : α → ℕ} {m : ℕ} (h : ∀ a,m≤wt a) (t : UniversalEmbedding.Tree α) : m≤treeDegree wt t := by + induction t with + | leaf a => simpa only [treeDegree_leaf] using h a + | node t u ht hu => rw [treeDegree_node]; omega + +theorem leaf_degree_le {wt : α → ℕ} {t : UniversalEmbedding.Tree α} {a : α} + (ha : a∈t.leaves) : wt a≤treeDegree wt t := by + induction t with + | leaf b => + have hab : a=b := List.mem_singleton.mp ha + simpa only [hab,treeDegree_leaf] using le_refl (wt b) + | node t u ht hu => + rw [Tree.leaves,List.mem_append] at ha + rw [treeDegree_node] + rcases ha with h|h + · exact (ht h).trans (Nat.le_add_right _ _) + · exact (hu h).trans (Nat.le_add_left _ _) + +theorem leaf_degree_lt {wt : α → ℕ} (hwt : ∀ a,0 1) t) + {a : α} (ha : a∈t.leaves) : wt a simp only [treeDegree_leaf] at ht; omega + | node t u => + rw [Tree.leaves,List.mem_append] at ha + rw [treeDegree_node] + rcases ha with h|h + · have hle := leaf_degree_le (wt:=wt) h + have hpos := treeDegree_pos hwt u + omega + · have hle := leaf_degree_le (wt:=wt) h + have hpos := treeDegree_pos hwt t + omega + +end LieGrading + +namespace NormalizedFamily +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open ImageBound LieGrading RowTwo RowKernel ExactPentagon +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 + +structure Data where + active : ℕ → Prop + value : ℕ → FreeLieAlgebra K Bool + solution : ∀ n (p : FreeLieAlgebra K ℕ),p∈homogeneousLie oddWeight n → + GenericIhara.evalIhara value p∈ReducedDimension.solutions n + rep : ℕ → FreeLieAlgebra K Slot + under_rep : ∀ k,under (rep k)=embed (value k) + above_rep : ∀ k,active k → embed (rep k)∈above bCount 1 + leading_rep : ∀ k,active k → embed (leading 1 (rep k))=positiveInput (atom k) + +variable (g : Data) + +def treeSolution (t : UniversalEmbedding.Tree ℕ) : ReducedDimension.solutions (treeDegree oddWeight t) := + ⟨GenericIhara.evalIhara g.value t.eval,g.solution _ _ (eval_homogeneous oddWeight t)⟩ + +theorem treeWeight (t : UniversalEmbedding.Tree ℕ) : 2 1) t) ∧ + embed (leading (treeDegree (fun _ => 1) t) (treeRep g t))=positiveInput (embed (t.eval : FreeLieAlgebra K ℕ)) := by + induction t with + | leaf k => + rw [treeRep_leaf] + simpa only [treeDegree_leaf,Tree.eval,AssociativeElimination.embed_of] using ⟨g.above_rep k (hactive k (by simp [Tree.leaves])),g.leading_rep k (hactive k (by simp [Tree.leaves]))⟩ + | node t u ht hu => + have ht := ht (fun k hk => hactive k (by simp only [Tree.leaves,List.mem_append]; exact Or.inl hk)) + have hu := hu (fun k hk => hactive k (by simp only [Tree.leaves,List.mem_append]; exact Or.inr hk)) + have hs := IharaLeading.actual_leading_ihara + (ψ:=GenericIhara.evalIhara g.value t.eval) (φ:=GenericIhara.evalIhara g.value u.eval) + (n:=treeDegree oddWeight t) (m:=treeDegree oddWeight u) + (by have := treeWeight t; omega) (by have := treeWeight u; omega) + (homogeneousLie_embed (ReducedDimension.solutions_hom (treeSolution g t))) + (homogeneousLie_embed (ReducedDimension.solutions_hom (treeSolution g u))) + (under_treeRep g t) (under_treeRep g u) + (ReducedDimension.solutions_anti (treeSolution g t)) + (ReducedDimension.solutions_anti (treeSolution g u)) + (treeDegree_pos (wt:=fun _ : ℕ => 1) (by intro k; omega) t) (treeDegree_pos (wt:=fun _ : ℕ => 1) (by intro k; omega) u) ht.1 hu.1 + rw [treeRep_node,treeDegree_node,IharaLeading.embed_iharaLie] + refine ⟨hs.1,?_⟩ + rw [embed_leading,IharaLeading.embed_iharaLie,hs.2,ht.2,hu.2] + simp only [Tree.eval,LieHom.map_lie,EvenIndex.map_lie] + +theorem bihomogeneous_leading {n r : ℕ} {p : FreeLieAlgebra K ℕ} + (hp : p∈biPiece oddWeight (fun _ => 1) n r) + (hactive : ∀ t : UniversalEmbedding.Tree ℕ,treeDegree oddWeight t=n → + treeDegree (fun _ => 1) t=r → ∀ k∈t.leaves,g.active k) : + ∃ q : FreeLieAlgebra K Slot, + under q=embed (GenericIhara.evalIhara g.value p) ∧ embed q∈above bCount r ∧ + embed (leading r q)=positiveInput (embed p) := by + rw [←biTreeSpan_eq] at hp + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨t,hn,hr,rfl⟩ := hp + have ht := tree_leading g t (hactive t hn hr) + exact ⟨treeRep g t,under_treeRep g t,hr ▸ ht.1,hr ▸ ht.2⟩ + | zero => exact ⟨0,by simp,Submodule.zero_mem _,by simp only [embed_leading,map_zero]⟩ + | add p q _ _ hp hq => + obtain ⟨p',hp',hpr,hpl⟩ := hp + obtain ⟨q',hq',hqr,hql⟩ := hq + refine ⟨p'+q',by simp only [map_add,hp',hq'],?_,?_⟩ + · simpa only [map_add] using (above bCount r).add_mem hpr hqr + · change embed (eraseLie (LieGrading.piece bCount r (p'+q')))=_ + rw [LieGrading.piece_add,map_add,map_add] + change embed (leading r p')+embed (leading r q')=_ + rw [hpl,hql,map_add,map_add] + | smul c p _ hp => + obtain ⟨p',hp',hpr,hpl⟩ := hp + refine ⟨c • p',by simp only [map_smul,hp'],?_,?_⟩ + · simpa only [map_smul] using (above bCount r).smul_mem c hpr + · change embed (eraseLie (LieGrading.piece bCount r (c • p')))=_ + rw [LieGrading.piece_smul,map_smul,map_smul] + change c • embed (leading r p')=_ + rw [hpl,map_smul,map_smul] + +end NormalizedFamily + +namespace Triangular +variable {R : Type*} [Semiring R] {N : ℕ} + {V : Fin N → Type*} [∀ i,AddCommGroup (V i)] [∀ i,Module R (V i)] + {W : Type*} [AddCommMonoid W] [Module R W] + {Z : Fin N → Type*} [∀ i,AddCommGroup (Z i)] [∀ i,Module R (Z i)] + +def assemble (f : ∀ i,V i →ₗ[R] W) : (∀ i,V i) →ₗ[R] W := + ∑ i,(f i).comp (LinearMap.proj i) + +theorem assemble_apply (f : ∀ i,V i →ₗ[R] W) (v : ∀ i,V i) : assemble f v=∑ i,f i (v i) := by + simp [assemble] + +theorem assemble_injective (f : ∀ i,V i →ₗ[R] W) (π : ∀ i,W →ₗ[R] Z i) + (diag : ∀ i,Function.Injective ((π i).comp (f i))) + (upper : ∀ i j,i < j → ∀ v,π i (f j v)=0) : Function.Injective (assemble f) := by + classical + intro v w hvw + have aux : ∀ n (i : Fin N),i.val=n → v i=w i := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro i hi + apply diag i + change π i (f i (v i))=π i (f i (w i)) + have h := congrArg (π i) hvw + simp only [assemble_apply,map_sum] at h + have hv : (∑ j,π i (f j (v j))) = + (∑ j∈(Finset.univ.filter (fun j => j < i)),π i (f j (v j))) + π i (f i (v i)) := by + classical + rw [←Finset.sum_filter_add_sum_filter_not (s:=Finset.univ) (p:=fun j => j < i)] + congr 1 + apply Finset.sum_eq_single i + · intro j hj hji + have hle : i ≤ j := le_of_not_gt (Finset.mem_filter.mp hj).2 + exact upper i j (lt_of_le_of_ne hle (Ne.symm hji)) (v j) + · simp + have hw : (∑ j,π i (f j (w j))) = + (∑ j∈(Finset.univ.filter (fun j => j < i)),π i (f j (w j))) + π i (f i (w i)) := by + classical + rw [←Finset.sum_filter_add_sum_filter_not (s:=Finset.univ) (p:=fun j => j < i)] + congr 1 + apply Finset.sum_eq_single i + · intro j hj hji + have hle : i ≤ j := le_of_not_gt (Finset.mem_filter.mp hj).2 + exact upper i j (lt_of_le_of_ne hle (Ne.symm hji)) (w j) + · simp + have he : (∑ j∈(Finset.univ.filter (fun j => j < i)),π i (f j (v j))) = + ∑ j∈(Finset.univ.filter (fun j => j < i)),π i (f j (w j)) := by + apply Finset.sum_congr rfl + intro j hj + rw [ih j.val (by have hj' := (Finset.mem_filter.mp hj).2; change j.val < i.val at hj'; omega) j rfl] + rw [hv,hw,he] at h + exact add_left_cancel h + funext i + exact aux i.val i rfl + +end Triangular + +namespace NormalizedFamily + +section +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open ImageBound LieGrading RowTwo RowKernel ExactPentagon +attribute [local instance] LieRing.ofAssociativeRing +variable (g : Data) + +def valueMap (n : ℕ) : homogeneousLie (R:=K) oddWeight n →ₗ[K] ReducedDimension.solutions n := + ((GenericIhara.evalIhara g.value).comp (homogeneousLie oddWeight n).subtype).codRestrict _ + (fun p => g.solution n p.val p.property) + +def repMap (n : ℕ) (hn : 1 1) n r) + (hactive : ∀ t : UniversalEmbedding.Tree ℕ,treeDegree oddWeight t=n → + treeDegree (fun _ => 1) t=r → ∀ k∈t.leaves,g.active k) : + embed (repMap g n hn ⟨p.val,p.property.1⟩)∈above bCount r ∧ + leadingLinear r (repMap g n hn ⟨p.val,p.property.1⟩)=positiveInput (embed p.val) := by + obtain ⟨q,hq,hqr,hql⟩ := bihomogeneous_leading g p.property hactive + have he : repMap g n hn ⟨p.val,p.property.1⟩=q := by + apply under_injective + exact (ReducedDimension.representation_under n hn (valueMap g n ⟨p.val,p.property.1⟩)).trans hq.symm + rw [he,leadingLinear_apply] + exact ⟨hqr,hql⟩ + +def oldPiece (n r : ℕ) : Submodule K (FreeLieAlgebra K ℕ) := + if 1 1) n r else ⊥ + +theorem oldPiece_le (n r : ℕ) : oldPiece n r≤homogeneousLie oddWeight n := by + unfold oldPiece + split_ifs + · exact inf_le_left + · exact bot_le + +instance finite_oldPiece (n r : ℕ) : Module.Finite K (oldPiece n r) := + Module.Finite.of_injective (Submodule.inclusion (oldPiece_le n r)) (Submodule.inclusion_injective _) + +def oldMap (n r : ℕ) : oldPiece n r →ₗ[K] ReducedDimension.solutions n := + (valueMap g n).comp (Submodule.inclusion (oldPiece_le n r)) + +def solutionLeading (n : ℕ) (hn : 1 1) n r := by + have h := p.property + simpa only [oldPiece,ite_eq_left hr] using h + exact repMap_bihomogeneous g hn ⟨p.val,hp⟩ (by + intro t htn htr k hk + apply ha k + have hlt := leaf_degree_lt (wt:=oddWeight) (by intro k; simp [oddWeight]) (by omega : 1 1) t) hk + simpa only [htn] using hlt) + +theorem oldMap_low {n r : ℕ} (hr : ¬1 oldMap g n r.val)) := by + apply Triangular.assemble_injective _ (fun r => solutionLeading n hn r.val) + · intro r p q hpq + by_cases hr : 1 degree bCount w=r.val) (embed _))=0 + rw [project_eq_zero hp ?_,map_zero] + intro w hw hwr + change s.val≤degree bCount w at hw + change degree bCount w=r.val at hwr + have hrs' : r.val 1) n r →ₗ[K] ReducedDimension.solutions n := + (valueMap g n).comp (Submodule.inclusion inf_le_left) + +theorem fullMap_leading {n r : ℕ} (hn : 1 1) n r) : + embed (ReducedDimension.representationMap n hn (fullMap g n r p))∈above bCount r ∧ + solutionLeading n hn r (fullMap g n r p)=positiveInput (embed p.val) := + repMap_bihomogeneous g hn p (by intros; apply ha) + +theorem full_assemble_injective (n : ℕ) (hn : 1 fullMap g n r.val)) := by + apply Triangular.assemble_injective _ (fun r => solutionLeading n hn r.val) + · intro r p q hpq + apply Subtype.ext + apply UniversalEmbedding.injective + apply positiveInput_injective + exact (fullMap_leading g hn ha p).2.symm.trans (hpq.trans (fullMap_leading g hn ha q).2) + · intro r s hrs p + have hp := (fullMap_leading g hn ha p).1 + change OreShift.eraseShift 0 (project (fun w => degree bCount w=r.val) (embed _))=0 + rw [project_eq_zero hp ?_,map_zero] + intro w hw hwr + change s.val≤degree bCount w at hw + change degree bCount w=r.val at hwr + have hrs' : r.val fullMap g n r.val) + (components oddWeight (fun _ => 1) n n v)=valueMap g n v := by + have h := assemble_components oddWeight (fun _ => 1) n n (ReducedDimension.odd_length_bound n) v + rw [Triangular.assemble_apply] + calc + _ = valueMap g n (assemble oddWeight (fun _ => 1) n n + (components oddWeight (fun _ => 1) n n v)) := by + change (∑ r : Fin (n+1),(valueMap g n) ⟨_,_⟩)=(valueMap g n) ⟨∑ r : Fin (n+1),_,_⟩ + rw [←map_sum] + congr 1 + apply Subtype.ext + simp only [Submodule.coe_sum] + rfl + _ = valueMap g n v := congrArg (valueMap g n) h + have hc := full_assemble_injective g n hn ha ((he p).trans (hpq.trans (he q).symm)) + have h := congrArg (assemble oddWeight (fun _ => 1) n n) hc + simpa only [assemble_components oddWeight (fun _ => 1) n n (ReducedDimension.odd_length_bound n)] using h + +end NormalizedFamily + +namespace GenericIhara +variable {R α : Type*} [CommRing R] + +theorem cast_D (p q : FreeLieAlgebra ℤ Bool) : + IntegralBaseChange.lie (S:=R) (D p q)=D (IntegralBaseChange.lie p) (IntegralBaseChange.lie q) := by + induction q using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [D] + | ha q r hq hr => simp only [map_add,hq,hr] + | hs c q hq => + change IntegralBaseChange.lie ((D p).toLinearMap (c • q)) = + (D (IntegralBaseChange.lie p)).toLinearMap (IntegralBaseChange.lie (c • q)) + simp only [map_zsmul] + exact congrArg (fun v => c • v) hq + | hl q r hq hr => simp only [LieDerivation.apply_lie_eq_add,LieHom.map_lie,map_add,hq,hr] + +theorem cast_ihara (p q : FreeLieAlgebra ℤ Bool) : + IntegralBaseChange.lie (S:=R) (ihara p q)=ihara (IntegralBaseChange.lie p) (IntegralBaseChange.lie q) := by + simp only [ihara,map_add,map_sub,LieHom.map_lie,cast_D] + +theorem cast_evalIhara (f : α → FreeLieAlgebra ℤ Bool) (p : FreeLieAlgebra ℤ α) : + IntegralBaseChange.lie (S:=R) (evalIhara f p)= + evalIhara (fun a => IntegralBaseChange.lie (f a)) (IntegralBaseChange.lie p) := by + induction p using freeLie_induction with + | h0 => simp + | hg a => simp + | ha p q hp hq => simp only [map_add,hp,hq] + | hs c p hp => simp [map_smul,hp] + | hl p q hp hq => simp only [evalIhara_lie,LieHom.map_lie,cast_ihara,hp,hq] + +end GenericIhara + +namespace IntegralFamily +open LieGrading AssociativeElimination UniversalEmbedding WordGrading +open scoped TensorProduct +abbrev K := ZMod 2 + +structure Values where + space : Submodule ℚ L + le_W : space≤W + bracket : ∀ {p q},p∈space → q∈space → ihara p q∈space + +variable (V : Values) + +structure Family where + value : ℕ → FreeLieAlgebra ℤ Bool + homogeneous : ∀ k,value k∈homogeneousLie (fun _ => 1) (oddWeight k) + member : ∀ k,IntegralBaseChange.lie (S:=ℚ) (value k)∈V.space + +variable {V} (f : Family V) + +def cast (R : Type*) [CommRing R] (k : ℕ) : FreeLieAlgebra R Bool := + IntegralBaseChange.lie (f.value k) + +theorem cast_homogeneous (R : Type*) [CommRing R] (k : ℕ) : + cast f R k∈homogeneousLie (fun _ => 1) (oddWeight k) := + (LieDimension.castHom (R:=R) ⟨f.value k,f.homogeneous k⟩).property + +theorem rational_mem (p : FreeLieAlgebra ℚ ℕ) : GenericIhara.evalIhara (cast f ℚ) p∈V.space := by + induction p using freeLie_induction with + | h0 => simp + | hg k => simpa only [GenericIhara.evalIhara_of,cast] using f.member k + | ha p q hp hq => rw [map_add]; exact V.space.add_mem hp hq + | hs c p hp => rw [map_smul]; exact V.space.smul_mem c hp + | hl p q hp hq => rw [GenericIhara.evalIhara_lie,GenericIhara.rational_ihara]; exact V.bracket hp hq + +theorem eval_homogeneous (R : Type*) [CommRing R] {n : ℕ} {p : FreeLieAlgebra R ℕ} + (hp : p∈homogeneousLie oddWeight n) : + GenericIhara.evalIhara (cast f R) p∈homogeneousLie (fun _ => 1) n := by + apply homogeneous_iff.mpr + exact GenericIhara.evalIhara_homogeneous oddWeight _ (fun k => homogeneousLie_embed (cast_homogeneous f R k)) hp + +theorem integral_eval_homogeneous {n : ℕ} {p : FreeLieAlgebra ℤ ℕ} + (hp : p∈homogeneousLie oddWeight n) : + GenericIhara.evalIhara f.value p∈homogeneousLie (fun _ => 1) n := by + apply homogeneous_iff.mpr + exact GenericIhara.evalIhara_homogeneous oddWeight _ (fun k => homogeneousLie_embed (f.homogeneous k)) hp + +def piece (V : Values) (n : ℕ) : Submodule ℚ (Wn n) := V.space.comap (Wn n).subtype + +theorem integral_reduction_mem {n : ℕ} (E : Submodule ℚ (Wn n)) + (q : homogeneousLie (R:=ℤ) RationalBound.wt n) + (hW : (LieDimension.castHom (R:=ℚ) q).val∈Wn n) + (hE : (⟨(LieDimension.castHom (R:=ℚ) q).val,hW⟩ : Wn n)∈E) + (p : ReducedDimension.solutions n) + (hp : (LieDimension.castHom (R:=K) q).val=p.val) : + p∈SaturatedSolutions.reduction n E := by + let u : LatticeDimension.lattice (SaturatedSolutions.image n E) := + ⟨LieDimension.coordinates ℤ RationalBound.wt n q,by + refine ⟨⟨(LieDimension.castHom (R:=ℚ) q).val,hW⟩,hE,?_⟩ + ext w + exact LieDimension.coordinates_castHom q w⟩ + refine ⟨(1 : K) ⊗ₜ[ℤ] u,?_⟩ + ext w + rw [LatticeDimension.scalarMap_tmul] + change (LieDimension.coordinates ℤ RationalBound.wt n q w : K)*1=(embed p.val).coeff w.val + rw [mul_one,←LieDimension.coordinates_castHom,LieDimension.coordinates_apply,hp] + +theorem tree_rational_W (t : UniversalEmbedding.Tree ℕ) : + IntegralBaseChange.lie (S:=ℚ) (GenericIhara.evalIhara f.value (t.eval (R:=ℤ)))∈W := by + rw [GenericIhara.cast_evalIhara,LieDimension.cast_eval] + exact V.le_W (rational_mem f t.eval) + +theorem reduced_solution {n : ℕ} {p : FreeLieAlgebra K ℕ} + (hp : p∈homogeneousLie oddWeight n) : + GenericIhara.evalIhara (cast f K) p∈ReducedDimension.solutions n := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨t,ht,rfl⟩ := hp + have hn : 2 simp + | add p q _ _ hp hq => rw [map_add]; exact Submodule.add_mem _ hp hq + | smul c p _ hp => rw [map_smul]; exact Submodule.smul_mem _ c hp + +def reducedValue (n : ℕ) : homogeneousLie (R:=K) oddWeight n →ₗ[K] ReducedDimension.solutions n := + ((GenericIhara.evalIhara (cast f K)).comp (homogeneousLie oddWeight n).subtype).codRestrict _ + (fun p => reduced_solution f p.property) + +theorem reduced_mem {n : ℕ} (p : homogeneousLie (R:=K) oddWeight n) : + reducedValue f n p∈SaturatedSolutions.reduction n (piece V n) := by + have ht : ∀ (t : UniversalEmbedding.Tree ℕ) (ht : treeDegree oddWeight t=n), + reducedValue f n ⟨t.eval,ht ▸ LieGrading.eval_homogeneous oddWeight t⟩∈SaturatedSolutions.reduction n (piece V n) := by + intro t ht + let q : homogeneousLie (R:=ℤ) RationalBound.wt n := + ⟨GenericIhara.evalIhara f.value t.eval,integral_eval_homogeneous f (ht ▸ LieGrading.eval_homogeneous oddWeight t)⟩ + have he : (LieDimension.castHom (R:=ℚ) q).val=GenericIhara.evalIhara (cast f ℚ) t.eval := by + exact (GenericIhara.cast_evalIhara f.value t.eval).trans (congrArg _ (LieDimension.cast_eval t)) + have hW : (LieDimension.castHom (R:=ℚ) q).val∈Wn n := by + constructor + · rw [he]; exact V.le_W (rational_mem f t.eval) + · change _∈weightPiece RationalBound.wt n + rw [weightPiece_eq]; exact (LieDimension.castHom (R:=ℚ) q).property + apply integral_reduction_mem (piece V n) q hW ?_ _ ?_ + · change (LieDimension.castHom (R:=ℚ) q).val∈V.space + rw [he]; exact rational_mem f t.eval + · change IntegralBaseChange.lie (S:=K) (GenericIhara.evalIhara f.value t.eval)=_ + rw [GenericIhara.cast_evalIhara,LieDimension.cast_eval] + rfl + have hp := p.property + change p.val∈homogeneousLie oddWeight n at hp + have hh : ∀ v (hv : v∈homogeneousLie (R:=K) oddWeight n), + reducedValue f n ⟨v,hv⟩∈SaturatedSolutions.reduction n (piece V n) := by + intro v hv + induction hv using Submodule.span_induction with + | mem v hv => obtain ⟨t,htree,rfl⟩ := hv; exact ht t htree + | zero => + change reducedValue f n 0∈_ + rw [map_zero] + exact Submodule.zero_mem _ + | add v w hv hw hi hj => + change reducedValue f n (⟨v,hv⟩+⟨w,hw⟩)∈_ + rw [map_add] + exact (SaturatedSolutions.reduction n (piece V n)).add_mem hi hj + | smul c v hv hi => + change reducedValue f n (c • ⟨v,hv⟩)∈_ + rw [map_smul] + exact (SaturatedSolutions.reduction n (piece V n)).smul_mem c hi + exact hh p.val hp + +end IntegralFamily + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Logarithm.lean b/lean/OAI/Algebra/Drinfeld/Logarithm.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e8034590f3eaacc91f7381bc8d6d5ae50a7ab1a --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Logarithm.lean @@ -0,0 +1,1660 @@ +import OAI.Algebra.Drinfeld.KZTransport + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +namespace OperatorLog + +section +open Polynomial + +def binom (k : ℕ) : ℚ[X] := (k.factorial : ℚ)⁻¹ • descPochhammer ℚ k + +@[simp] theorem binom_zero : binom 0=1 := by simp [binom] +@[simp] theorem binom_eval_nat (k n : ℕ) : (binom k).eval (n : ℚ)=(n.choose k : ℚ) := by + rw [Nat.cast_choose_eq_descPochhammer_div] + simp [binom,div_eq_mul_inv,mul_comm] + +@[simp] theorem binom_coeff_zero (k : ℕ) : (binom k).coeff 0=if k=0 then 1 else 0 := by + rw [Polynomial.coeff_zero_eq_eval_zero] + simp only [binom,eval_smul,smul_eq_mul,descPochhammer_eval_zero] + split_ifs with h + · simp [h] + · simp + +theorem desc_coeff_one (k : ℕ) : (descPochhammer ℚ (k+1)).coeff 1=(-1:ℚ)^k*(k.factorial : ℚ) := by + induction k with + | zero => simp + | succ k ih => + rw [descPochhammer_succ_right,mul_sub,coeff_sub,coeff_mul_X] + have h0 : (descPochhammer ℚ (k+1)).coeff 0=0 := by + rw [coeff_zero_eq_eval_zero] + simp + simp only [h0,zero_sub] + rw [←C_eq_natCast,coeff_mul_C,ih,Nat.factorial_succ,Nat.cast_mul,pow_succ] + ring + +theorem binom_coeff_one_succ (k : ℕ) : (binom (k+1)).coeff 1=(-1:ℚ)^k/(k+1) := by + rw [binom,coeff_smul,smul_eq_mul,desc_coeff_one,Nat.factorial_succ,Nat.cast_mul] + have hf : (k.factorial : ℚ)≠0 := by exact_mod_cast k.factorial_ne_zero + have hk : ((k+1 : ℕ):ℚ)≠0 := by positivity + push_cast + field_simp + +variable {V : Type*} [AddCommGroup V] [Module ℚ V] + +def interpolate (N : ℕ) (T : Module.End ℚ V) (s : ℚ) : Module.End ℚ V := + ∑ k∈Finset.range (N+1),(binom k).eval s • T^k + +def logarithm (N : ℕ) (T : Module.End ℚ V) : Module.End ℚ V := + ∑ k∈Finset.range (N+1),(binom k).coeff 1 • T^k + +theorem sum_range_extend {M : Type*} [AddCommMonoid M] (f : ℕ → M) {n m : ℕ} (h : n ≤ m) + (hz : ∀ k,n ≤ k → k < m → f k=0) : + ∑ k∈Finset.range n,f k=∑ k∈Finset.range m,f k := by + apply Finset.sum_subset (Finset.range_mono h) + intro k hkm hkn + exact hz k (Nat.le_of_not_lt (by simpa using hkn)) (Finset.mem_range.mp hkm) + +theorem interpolate_nat (N : ℕ) (T : Module.End ℚ V) (hT : T^(N+1)=0) (m : ℕ) : + interpolate N T m=(1+T)^m := by + have hpow : ∀ k,N+1 ≤ k → T^k=0 := fun k hk => by + obtain ⟨j,rfl⟩ := Nat.exists_eq_add_of_le hk + rw [pow_add,hT,zero_mul] + have hsmall : ∀ k,m+1 ≤ k → (m.choose k : ℚ) • T^k=0 := by + intro k hk + rw [Nat.choose_eq_zero_of_lt (by omega),Nat.cast_zero,zero_smul] + unfold interpolate + simp only [binom_eval_nat] + rw [sum_range_extend (fun k => (m.choose k : ℚ) • T^k) (m:=N+m+2) (by omega) + (fun k hk _ => by rw [hpow k hk,smul_zero])] + rw [←sum_range_extend (fun k => (m.choose k : ℚ) • T^k) (n:=m+1) (m:=N+m+2) (by omega) + (fun k hk _ => hsmall k hk)] + rw [add_comm (1:Module.End ℚ V) T,(Commute.one_right T).add_pow] + apply Finset.sum_congr rfl + intro k hk + simp only [one_pow,mul_one,Algebra.smul_def,map_natCast] + exact Nat.cast_comm _ _ + +theorem logarithm_eq (N : ℕ) (T : Module.End ℚ V) : + logarithm N T=∑ k∈Finset.range N,((-1:ℚ)^k/(k+1)) • T^(k+1) := by + unfold logarithm + rw [Finset.sum_range_succ'] + simp only [binom_coeff_one_succ,binom_zero,coeff_one,one_ne_zero,ite_false,zero_smul,add_zero] + +def valuePolynomial (N : ℕ) (T : Module.End ℚ V) (a : V) (l : V →ₗ[ℚ] ℚ) : ℚ[X] := + ∑ k∈Finset.range (N+1),binom k*C (l ((T^k) a)) + +theorem value_eval (N : ℕ) (T : Module.End ℚ V) (a : V) (l : V →ₗ[ℚ] ℚ) (s : ℚ) : + (valuePolynomial N T a l).eval s=l (interpolate N T s a) := by + simp [valuePolynomial,interpolate,LinearMap.sum_apply,LinearMap.smul_apply,Polynomial.eval_finsetSum] + +theorem value_one (N : ℕ) (T : Module.End ℚ V) (a : V) (l : V →ₗ[ℚ] ℚ) : + (valuePolynomial N T a l).coeff 1=l (logarithm N T a) := by + simp [valuePolynomial,logarithm,LinearMap.sum_apply,LinearMap.smul_apply] + +theorem polynomial_ext_nat {p q : ℚ[X]} (h : ∀ n : ℕ,p.eval (n:ℚ)=q.eval (n:ℚ)) : p=q := by + apply Polynomial.eq_of_infinite_eval_eq + apply (Set.infinite_range_of_injective (Nat.cast_injective (R:=ℚ))).mono + rintro _ ⟨n,rfl⟩ + exact h n + +variable {W U : Type*} [AddCommGroup W] [Module ℚ W] [AddCommGroup U] [Module ℚ U] + +def pairPolynomial (N : ℕ) (T : Module.End ℚ V) (S : Module.End ℚ W) + (B : V →ₗ[ℚ] W →ₗ[ℚ] U) (a : V) (b : W) (l : U →ₗ[ℚ] ℚ) : ℚ[X] := + ∑ i∈Finset.range (N+1),∑ j∈Finset.range (N+1), + (binom i*binom j)*C (l (B ((T^i) a) ((S^j) b))) + +theorem pair_eval (N : ℕ) (T : Module.End ℚ V) (S : Module.End ℚ W) + (B : V →ₗ[ℚ] W →ₗ[ℚ] U) (a : V) (b : W) (l : U →ₗ[ℚ] ℚ) (s : ℚ) : + (pairPolynomial N T S B a b l).eval s= + l (B (interpolate N T s a) (interpolate N S s b)) := by + simp only [pairPolynomial,Polynomial.eval_finsetSum,eval_mul,eval_C,interpolate,LinearMap.sum_apply,LinearMap.smul_apply,map_sum,map_smul,smul_eq_mul,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + ring + +theorem pair_one (N : ℕ) (T : Module.End ℚ V) (S : Module.End ℚ W) + (B : V →ₗ[ℚ] W →ₗ[ℚ] U) (a : V) (b : W) (l : U →ₗ[ℚ] ℚ) : + (pairPolynomial N T S B a b l).coeff 1= + l (B (logarithm N T a) b+B a (logarithm N S b)) := by + simp [pairPolynomial,logarithm,LinearMap.sum_apply,LinearMap.smul_apply,mul_coeff_one, + binom_coeff_zero,add_mul,Finset.sum_add_distrib,ite_mul,mul_ite,add_comm] + +theorem powers_bilinear (A : Module.End ℚ V) (C : Module.End ℚ W) (D : Module.End ℚ U) + (B : V →ₗ[ℚ] W →ₗ[ℚ] U) (h : ∀ a b,D (B a b)=B (A a) (C b)) (m : ℕ) (a : V) (b : W) : + (D^m) (B a b)=B ((A^m) a) ((C^m) b) := by + induction m with + | zero => rfl + | succ m ih => + simp only [pow_succ',Module.End.mul_apply,ih,h] + +theorem logarithm_bilinear (N : ℕ) (T : Module.End ℚ V) (S : Module.End ℚ W) + (R : Module.End ℚ U) (hT : T^(N+1)=0) (hS : S^(N+1)=0) (hR : R^(N+1)=0) + (B : V →ₗ[ℚ] W →ₗ[ℚ] U) + (h : ∀ a b,(1+R) (B a b)=B ((1+T) a) ((1+S) b)) (a : V) (b : W) : + logarithm N R (B a b)=B (logarithm N T a) b+B a (logarithm N S b) := by + apply sub_eq_zero.mp + apply (Module.forall_dual_apply_eq_zero_iff ℚ + (logarithm N R (B a b)-(B (logarithm N T a) b+B a (logarithm N S b)))).mp + intro l + have hp : valuePolynomial N R (B a b) l=pairPolynomial N T S B a b l := by + apply polynomial_ext_nat + intro m + rw [value_eval,pair_eval,interpolate_nat N R hR,interpolate_nat N T hT,interpolate_nat N S hS] + exact congrArg l (powers_bilinear _ _ _ B h m a b) + have hc := congrArg (fun p : ℚ[X] => p.coeff 1) hp + rw [value_one,pair_one] at hc + simpa only [map_sub,sub_eq_zero] using hc + +end + +variable {V W : Type*} [AddCommGroup V] [Module ℚ V] [AddCommGroup W] [Module ℚ W] + +theorem powers_natural (T : Module.End ℚ V) (S : Module.End ℚ W) (f : V →ₗ[ℚ] W) + (h : ∀ v,f (T v)=S (f v)) (n : ℕ) (v : V) : f ((T^n) v)=(S^n) (f v) := by + induction n with + | zero => rfl + | succ n ih => simp only [pow_succ',Module.End.mul_apply,h,ih] + +theorem logarithm_natural (N : ℕ) (T : Module.End ℚ V) (S : Module.End ℚ W) + (f : V →ₗ[ℚ] W) (h : ∀ v,f (T v)=S (f v)) (v : V) : + f (logarithm N T v)=logarithm N S (f v) := by + simp only [logarithm,LinearMap.sum_apply,LinearMap.smul_apply,map_sum,map_smul, + powers_natural T S f h] + +theorem logarithm_fixed (N : ℕ) (T : Module.End ℚ V) {v : V} (h : T v=0) : + logarithm N T v=0 := by + rw [logarithm_eq] + simp only [LinearMap.sum_apply,LinearMap.smul_apply] + apply Finset.sum_eq_zero + intro k hk + rw [pow_succ,Module.End.mul_apply,h,map_zero,smul_zero] + +theorem nilpotent_of_raises (T : Module.End ℚ V) (F : ℕ → Submodule ℚ V) (N : ℕ) + (hzero : F 0=⊤) (hterminal : F (N+1)=⊥) + (hraise : ∀ n v,v∈F n → T v∈F (n+1)) : T^(N+1)=0 := by + have hpow : ∀ n v,(T^n) v∈F n := by + intro n v + induction n with + | zero => simpa only [pow_zero,Module.End.one_apply,hzero] using Submodule.mem_top + | succ n ih => simpa only [pow_succ',Module.End.mul_apply] using hraise n _ ih + apply LinearMap.ext + intro v + simpa only [hterminal,Submodule.mem_bot,LinearMap.zero_apply] using hpow (N+1) v + +end OperatorLog + +namespace LogCategory +open OperatorLog +variable {A O : Type*} [Ring A] [Algebra ℚ A] + +structure Data (A O : Type*) [Ring A] [Algebra ℚ A] where + S : O → O → Module.End ℚ A + N : ℕ + nilpotent : ∀ p q,(S p q-1)^(N+1)=0 + comp : ∀ p q r (a b : A),S p r (b*a)=S q r b*S p q a + one : ∀ p,S p p 1=1 + +def delta (g : Data A O) (p q : O) : Module.End ℚ A := logarithm g.N (g.S p q-1) + +theorem delta_comp (g : Data A O) (p q r : O) (a b : A) : + delta g p r (b*a)=delta g q r b*a+b*delta g p q a := by + apply logarithm_bilinear g.N (g.S q r-1) (g.S p q-1) (g.S p r-1) + (g.nilpotent q r) (g.nilpotent p q) (g.nilpotent p r) (LinearMap.mul ℚ A) + intro b a + have he : ∀ p q,(1+(g.S p q-1))=g.S p q := by intros; abel + simpa only [he,LinearMap.mul_apply'] using g.comp p q r a b + +@[simp] theorem delta_one_loop (g : Data A O) (p : O) : delta g p p 1=0 := by + apply logarithm_fixed + simp only [LinearMap.sub_apply,Module.End.one_apply,g.one,sub_self] + +attribute [local instance] LieRing.ofAssociativeRing + +def derivation (g : Data A O) (p : O) : LieDerivation ℚ A A where + toLinearMap := delta g p p + leibniz' a b := by + change delta g p p (a*b-b*a)=(a*delta g p p b-delta g p p b*a)- + (b*delta g p p a-delta g p p a*b) + rw [map_sub,delta_comp,delta_comp] + abel + +theorem unit_cocycle (g : Data A O) (p q r : O) : + delta g p r 1=delta g q r 1+delta g p q 1 := by + simpa only [one_mul,mul_one] using delta_comp g p q r 1 1 + +theorem delta_formula (g : Data A O) (o p q : O) (u : A) : + delta g p q u=delta g o o u+delta g o q 1*u-u*delta g o p 1 := by + have h₁ := delta_comp g o p q 1 u + have h₂ := delta_comp g o o q u 1 + simp only [mul_one,one_mul] at h₁ h₂ + rw [h₂] at h₁ + exact eq_sub_of_add_eq (by simpa only [add_comm] using h₁.symm) + +end LogCategory + +namespace GaugeAutomorphism +variable {A O : Type*} [Ring A] [Algebra ℚ A] + + def map (θ : A ≃ₐ[ℚ] A) (H : O → Aˣ) (p q : O) : Module.End ℚ A := + ((LinearMap.mulLeft ℚ (H q:A)).comp (LinearMap.mulRight ℚ ((H p)⁻¹:Aˣ))).comp θ.toLinearMap + + @[simp] theorem map_apply (θ : A ≃ₐ[ℚ] A) (H : O → Aˣ) (p q : O) (a : A) : + map θ H p q a=(H q:A)*θ a*((H p)⁻¹:Aˣ) := by + simp only [map,LinearMap.comp_apply,LinearMap.mulLeft_apply,LinearMap.mulRight_apply,mul_assoc] + rfl + + theorem composition (θ : A ≃ₐ[ℚ] A) (H : O → Aˣ) (p q r : O) (a b : A) : + map θ H p r (b*a)=map θ H q r b*map θ H p q a := by + simp only [map_apply,map_mul,mul_assoc] + rw [←mul_assoc (((H q)⁻¹:Aˣ):A) (H q:A),Units.inv_mul,one_mul] + + @[simp] theorem map_one_loop (θ : A ≃ₐ[ℚ] A) (H : O → Aˣ) (p : O) : + map θ H p p 1=1 := by simp only [map_apply,map_one,mul_one,Units.mul_inv] + + theorem raises (θ : A ≃ₐ[ℚ] A) (H : O → Aˣ) (F : ℕ → Submodule ℚ A) + (hF : Antitone F) (h0 : F 0=⊤) + (hmul : ∀ i j {u v : A},u∈F i → v∈F j → u*v∈F (i+j)) + (hθ : ∀ n u,u∈F n → θ u-u∈F (n+1)) (hH : ∀ p,(H p:A)-1∈F 1) + (p q : O) (n : ℕ) (u : A) (hu : u∈F n) : map θ H p q u-u∈F (n+1) := by + have hθu : θ u∈F n := by + simpa only [sub_add_cancel] using (F n).add_mem (hF (Nat.le_succ n) (hθ n u hu)) hu + have hall : ∀ v : A,v∈F 0 := by intro v; rw [h0]; trivial + have hinv : (((H p)⁻¹:Aˣ):A)-1∈F 1 := by + have hh := hmul 0 1 (hall (((H p)⁻¹:Aˣ):A)) (hH p) + have he : (((H p)⁻¹:Aˣ):A)*((H p:A)-1)= -((((H p)⁻¹:Aˣ):A)-1) := by + rw [mul_sub,Units.inv_mul,mul_one,neg_sub] + rw [he] at hh + exact (F 1).neg_mem_iff.mp hh + have hh₁ := hmul (n+1) 0 + (show ((H q:A)-1)*θ u∈F (n+1) from by simpa only [Nat.add_comm 1 n] using hmul 1 n (hH q) hθu) + (hall (((H p)⁻¹:Aˣ):A)) + have hh₂ := hmul n 1 hθu hinv + have he : map θ H p q u-u= + ((H q:A)-1)*θ u*((H p)⁻¹:Aˣ)+θ u*((((H p)⁻¹:Aˣ):A)-1)+(θ u-u) := by + rw [map_apply] + noncomm_ring + rw [he] + exact (F (n+1)).add_mem ((F (n+1)).add_mem hh₁ hh₂) (hθ n u hu) + + def data (θ : A ≃ₐ[ℚ] A) (H : O → Aˣ) (F : ℕ → Submodule ℚ A) (N : ℕ) + (hF : Antitone F) (h0 : F 0=⊤) (ht : F (N+1)=⊥) + (hmul : ∀ i j {u v : A},u∈F i → v∈F j → u*v∈F (i+j)) + (hθ : ∀ n u,u∈F n → θ u-u∈F (n+1)) (hH : ∀ p,(H p:A)-1∈F 1) : + LogCategory.Data A O where + S := map θ H + N := N + nilpotent p q := OperatorLog.nilpotent_of_raises _ F N h0 ht (raises θ H F hF h0 hmul hθ hH p q) + comp := composition θ H + one := map_one_loop θ H + +end GaugeAutomorphism + +namespace OperatorLog +variable {A : Type*} [Ring A] [Algebra ℚ A] + +theorem logarithm_depth_one (F : ℕ → Submodule ℚ A) (hF : Antitone F) + (T : Module.End ℚ A) (hT : ∀ n u,u∈F n → T u∈F (n+1)) + (h1 : (1:A)∈F 0) (N : ℕ) : + logarithm (N+1) T 1-T 1∈F 2 := by + have hp : ∀ k,(T^k) 1∈F k := by + intro k + induction k with + | zero => exact h1 + | succ k ih => simpa only [pow_succ',Module.End.mul_apply] using hT k _ ih + rw [logarithm_eq] + rw [Finset.sum_range_succ'] + simp only [LinearMap.add_apply,LinearMap.sum_apply,LinearMap.smul_apply, + pow_zero,Nat.cast_zero,zero_add,div_one,one_smul,pow_one,add_sub_cancel_right] + apply Submodule.sum_mem + intro k hk + exact Submodule.smul_mem _ _ (hF (by omega : 2≤k+1+1) (hp _)) + +theorem comparison_depth_one (F : ℕ → Submodule ℚ A) (hF : Antitone F) + (hmul : ∀ i j {u v : A},u∈F i → v∈F j → u*v∈F (i+j)) + (θ : A →ₐ[ℚ] A) (hθ : ∀ n u,u∈F n → θ u-u∈F (n+1)) + {U Φ Ψ : A} (hU : U-1∈F 1) (hΦ : Φ-1∈F 1) (h : U*θ Φ=Ψ) : + Ψ-Φ-(U-1)∈F 2 := by + have hd : θ Φ-Φ∈F 2 := by + simpa only [map_sub,map_one,sub_sub_sub_cancel_right] using hθ 1 (Φ-1) hΦ + have hθΦ : θ Φ-1∈F 1 := by + simpa only [sub_add_sub_cancel] using (F 1).add_mem (hF (by omega : 1≤2) hd) hΦ + have hh := hmul 1 1 hU hθΦ + have he : Ψ-Φ-(U-1)=(U-1)*(θ Φ-1)+(θ Φ-Φ) := by + rw [←h] + noncomm_ring + rw [he] + exact (F 2).add_mem hh hd + +end OperatorLog + +namespace KZComparison +open CutoffDepth CutoffKZ FinitePicard KZCollar + + def positive (N : ℕ) : (Q ℝ N)ˣ := + (associator_isUnit (weight N) (gen_weight N false) (gen_weight N true)).unit + + @[simp] theorem positive_val (N : ℕ) : (positive N:Q ℝ N)=associator (weight N) (X N) (Y N) := + (associator_isUnit (weight N) (gen_weight N false) (gen_weight N true)).unit_spec + + def negative (N : ℕ) : (Q ℝ N)ˣ := Units.map (CutoffScaling.map N (-1:ℝ)).toMonoidHom (positive N) + + theorem negative_val (N : ℕ) : (negative N:Q ℝ N)=associator (weight N) (-X N) (-Y N) := by + change CutoffScaling.map N (-1:ℝ) (positive N:Q ℝ N)=_ + rw [positive_val,map_associator _ (weight N) (weight N) rfl (gen_weight N false) (gen_weight N true)] + have h (b : Bool) : CutoffScaling.map N (-1:ℝ) (gen N b)= -gen N b := by + simpa only [neg_smul,one_smul,gen,TruncatedSubstitution.gen] using CutoffScaling.map_gen N (-1:ℝ) b + rw [h false,h true] + + theorem positive_weight (N : ℕ) : (positive N:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1 := by + rw [positive_val] + exact associator_sub_one_mem (weight N) (TruncatedSubstitution.filtration_initial N) + (gen_weight N false) (gen_weight N true) + + theorem negative_weight (N : ℕ) : (negative N:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1 := by + have hh := TruncatedSubstitution.subst_preserves N (fun b => (-1:ℝ) • TruncatedSubstitution.gen N b) + (fun b => (TruncatedWords.filtration ∅ N 1).smul_mem _ (TruncatedSubstitution.gen_mem N b)) + 1 ((positive N:Q ℝ N)-1) (positive_weight N) + change CutoffScaling.map N (-1:ℝ) ((positive N:Q ℝ N)-1)∈_ at hh + change CutoffScaling.map N (-1:ℝ) (positive N:Q ℝ N)-1∈_ + simpa only [map_sub,map_one] using hh + + theorem positive_depth (N : ℕ) : (positive N:Q ℝ N)-1∈depthSpace N 1 := by + rw [positive_val]; exact associator_depth_one N + + theorem negative_depth (N : ℕ) : (negative N:Q ℝ N)-1∈depthSpace N 1 := by + have hh := CutoffScaling.preserves_depth N (-1:ℝ) 1 ((positive N:Q ℝ N)-1) (positive_depth N) + change CutoffScaling.map N (-1:ℝ) (positive N:Q ℝ N)-1∈_ + simpa only [map_sub,map_one] using hh + + def theta (N : ℕ) : Q ℝ N ≃ₐ[ℝ] Q ℝ N := + ConjugateComparison.theta N (positive N) (negative N) (positive_weight N) (negative_weight N) + + def arrow (N : ℕ) : (Q ℝ N)ˣ := + ConjugateComparison.unitArrow N (positive N) (negative N) (positive_weight N) (negative_weight N) + + theorem exact_comparison (N : ℕ) : (arrow N:Q ℝ N)*theta N (positive N:Q ℝ N)=(negative N:Q ℝ N) := + ConjugateComparison.exact_comparison N _ _ _ _ + + theorem theta_x (N : ℕ) : theta N (X N)=X N := ConjugateComparison.theta_x N _ _ _ _ + theorem theta_y (N : ℕ) : theta N (Y N)=((arrow N)⁻¹:(Q ℝ N)ˣ)*Y N*(arrow N:Q ℝ N) := + ConjugateComparison.theta_y N _ _ _ _ + + theorem theta_depth (N n : ℕ) (u : Q ℝ N) (hu : u∈depthSpace N n) : + theta N u-u∈depthSpace N (n+1) := + ConjugateComparison.theta_depth_raises N _ _ _ _ (positive_depth N) (negative_depth N) n u hu + + theorem arrow_depth (N : ℕ) : (arrow N:Q ℝ N)-1∈depthSpace N 1 := + ConjugateComparison.unitArrow_depth N _ _ _ _ (positive_depth N) (negative_depth N) + + def frames (N : ℕ) : Bool → (Q ℝ N)ˣ | false => 1 | true => arrow N + + theorem frames_depth (N : ℕ) (b : Bool) : (frames N b:Q ℝ N)-1∈depthSpace N 1 := by + cases b + · simp only [frames,Units.val_one,sub_self,Submodule.zero_mem] + · exact arrow_depth N + + def rationalDepth (N n : ℕ) : Submodule ℚ (Q ℝ N) := (depthSpace N n).restrictScalars ℚ + + theorem rationalDepth_initial (N : ℕ) : rationalDepth N 0=⊤ := by + apply Submodule.ext + intro u + change u∈depthSpace N 0 ↔ True + simp only [CutoffKZ.depth_initial,Submodule.mem_top] + + theorem rationalDepth_terminal (N : ℕ) : rationalDepth N (N+2)=⊥ := by + apply eq_bot_iff.mpr + intro u hu + have hh := depth_antitone N (show N+1≤N+2 by omega) hu + simpa only [depth_terminal,Submodule.mem_bot] using hh + + def category (N : ℕ) : LogCategory.Data (Q ℝ N) Bool := + GaugeAutomorphism.data ((theta N).restrictScalars ℚ) (frames N) (rationalDepth N) (N+1) + (depth_antitone N) (rationalDepth_initial N) (rationalDepth_terminal N) + (depth_mul N) (theta_depth N) (frames_depth N) + + def value (N : ℕ) : Q ℝ N := LogCategory.delta (category N) false true 1 + + theorem arrow_log_congruence (N : ℕ) : value N-((arrow N:Q ℝ N)-1)∈depthSpace N 2 := by + have hh := OperatorLog.logarithm_depth_one (A:=Q ℝ N) (rationalDepth N) (depth_antitone N) + ((category N).S false true-(1 : Module.End ℚ (Q ℝ N))) + (GaugeAutomorphism.raises ((theta N).restrictScalars ℚ) (frames N) (rationalDepth N) + (depth_antitone N) (rationalDepth_initial N) (depth_mul N) (theta_depth N) (frames_depth N) false true) + (depth_one N) N + simpa only [rationalDepth,Submodule.restrictScalars_mem,value,LogCategory.delta,category,GaugeAutomorphism.data,LinearMap.sub_apply, + Module.End.one_apply,GaugeAutomorphism.map_apply,frames,inv_one,Units.val_one,map_one,mul_one] using hh + + theorem comparison_congruence (N : ℕ) : + (negative N:Q ℝ N)-(positive N:Q ℝ N)-value N∈depthSpace N 2 := by + have hh := OperatorLog.comparison_depth_one (rationalDepth N) (depth_antitone N) + (depth_mul N) ((theta N).restrictScalars ℚ).toAlgHom (theta_depth N) + (arrow_depth N) (positive_depth N) (exact_comparison N) + have hd := (depthSpace N 2).sub_mem hh (arrow_log_congruence N) + simpa only [sub_sub_sub_cancel_right] using hd + + theorem value_coefficient (N m : ℕ) : + c N m (value N)=((-1:ℝ)^(m+1)-1)*c N m (positive N:Q ℝ N) := by + have hh := coeff_zero_of_depth N 2 (comparison_congruence N) + (w:=GenericIhara.depthOneWord m) (by simp [GenericIhara.depthOneWord,GenericIhara.depth]) + change c N m ((negative N:Q ℝ N)-(positive N:Q ℝ N)-value N)=0 at hh + rw [map_sub,map_sub] at hh + have hn : c N m (negative N:Q ℝ N)=(-1:ℝ)^(m+1)*c N m (positive N:Q ℝ N) := by + change TruncatedFree.coefficient N (GenericIhara.depthOneWord m) + (CutoffScaling.map N (-1:ℝ) (positive N:Q ℝ N))=_ + simpa only [length_depthOne,c] using CutoffScaling.coefficient N (-1:ℝ) + (GenericIhara.depthOneWord m) (positive N:Q ℝ N) + rw [hn] at hh + linear_combination -hh + + theorem odd_value_nonzero (k : ℕ) : c (2*k+3) (2*k+2) (value (2*k+3))≠0 := by + rw [value_coefficient] + have hp : (-1:ℝ)^(2*k+2+1)= -1 := Odd.neg_one_pow ⟨k+1,by omega⟩ + rw [hp] + apply mul_ne_zero (by norm_num) + rw [positive_val] + exact associator_coefficient_ne_zero _ _ (by omega) (by omega) + +end KZComparison + +namespace KZGroupLike +open scoped TensorProduct +open CutoffDepth CutoffKZ CutoffDiagonal KZCollar +local instance (N : ℕ) : NormedRing (Q ℝ N⊗[ℝ]Q ℝ N) := FiniteAlgebraNorm.normedRing _ +local instance (N : ℕ) : NormedAlgebra ℝ (Q ℝ N⊗[ℝ]Q ℝ N) := FiniteAlgebraNorm.normedAlgebra _ + theorem associator_diagonal (N : ℕ) : + diagonal N (associator (weight (N+N)) (X (N+N)) (Y (N+N)))= + associator (weight N) (X N) (Y N)⊗ₜ[ℝ]associator (weight N) (X N) (Y N) := by + rw [map_associator_general (diagonal N) (weight (N+N)) (tensorWeight N) + (gen_weight (N+N) false) (gen_weight (N+N) true) + (diagonal_mem N 1 _ (gen_weight (N+N) false)) (diagonal_mem N 1 _ (gen_weight (N+N) true)), + diagonal_gen,diagonal_gen] + rw [KZProduct.associator_product (left N) (right N) (commute N) (weight N) (weight N) (tensorWeight N) + (gen_weight N false) (gen_weight N true) (gen_weight N false) (gen_weight N true) + (left_mem N 1 _ (gen_weight N false)) (left_mem N 1 _ (gen_weight N true)) + (right_mem N 1 _ (gen_weight N false)) (right_mem N 1 _ (gen_weight N true))] + change (_⊗ₜ[ℝ](1:Q ℝ N))*((1:Q ℝ N)⊗ₜ[ℝ]_)=_ + rw [Algebra.TensorProduct.tmul_mul_tmul,mul_one,one_mul] + theorem positive_diagonal (N : ℕ) : + diagonal N (KZComparison.positive (N+N):Q ℝ (N+N))= + (KZComparison.positive N:Q ℝ N)⊗ₜ[ℝ](KZComparison.positive N:Q ℝ N) := by + simp only [KZComparison.positive_val,associator_diagonal] + theorem negative_diagonal (N : ℕ) : + diagonal N (KZComparison.negative (N+N):Q ℝ (N+N))= + (KZComparison.negative N:Q ℝ N)⊗ₜ[ℝ](KZComparison.negative N:Q ℝ N) := by + simp only [KZComparison.negative_val] + rw [map_associator_general (diagonal N) (weight (N+N)) (tensorWeight N) + ((weight (N+N)).space 1|>.neg_mem (gen_weight (N+N) false)) + ((weight (N+N)).space 1|>.neg_mem (gen_weight (N+N) true)) + (by rw [map_neg]; exact ((tensorWeight N).space 1).neg_mem (diagonal_mem N 1 _ (gen_weight (N+N) false))) + (by rw [map_neg]; exact ((tensorWeight N).space 1).neg_mem (diagonal_mem N 1 _ (gen_weight (N+N) true)))] + simp only [map_neg,diagonal_gen,neg_add] + rw [←map_neg (left N),←map_neg (right N),←map_neg (left N),←map_neg (right N)] + rw [KZProduct.associator_product (left N) (right N) (commute N) (weight N) (weight N) (tensorWeight N) + ((weight N).space 1|>.neg_mem (gen_weight N false)) ((weight N).space 1|>.neg_mem (gen_weight N true)) + ((weight N).space 1|>.neg_mem (gen_weight N false)) ((weight N).space 1|>.neg_mem (gen_weight N true)) + (by simpa only [map_neg] using ((tensorWeight N).space 1).neg_mem (left_mem N 1 _ (gen_weight N false))) + (by simpa only [map_neg] using ((tensorWeight N).space 1).neg_mem (left_mem N 1 _ (gen_weight N true))) + (by simpa only [map_neg] using ((tensorWeight N).space 1).neg_mem (right_mem N 1 _ (gen_weight N false))) + (by simpa only [map_neg] using ((tensorWeight N).space 1).neg_mem (right_mem N 1 _ (gen_weight N true)))] + change (_⊗ₜ[ℝ](1:Q ℝ N))*((1:Q ℝ N)⊗ₜ[ℝ]_)=_ + rw [Algebra.TensorProduct.tmul_mul_tmul,mul_one,one_mul] +end KZGroupLike + +namespace TruncatedSubstitution +open AssociativeElimination TruncatedWords +variable {R α B : Type*} [CommRing R] [Ring B] [Algebra R B] + theorem hom_ext (N : ℕ) (f g : Q (∅ : Set (A R α)) N →ₐ[R] B) + (h : ∀ a,f (gen N a)=g (gen N a)) : f=g := by + have he : f.comp (quotient ∅ N)=g.comp (quotient ∅ N) := by + apply AssociativeElimination.hom_ext + exact h + apply AlgHom.ext + intro u + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective R (relations (∅ : Set (A R α)) N) u + exact AlgHom.congr_fun he p +end TruncatedSubstitution + +namespace ConjugateCoalgebra +open scoped TensorProduct +open CutoffDepth CutoffKZ CutoffDiagonal ConjugateComparison + +def tensorUnit {A : Type*} [Ring A] [Algebra ℝ A] (P : Aˣ) : (A⊗[ℝ]A)ˣ where + val := (P:A)⊗ₜ[ℝ](P:A) + inv := ((P⁻¹:Aˣ):A)⊗ₜ[ℝ]((P⁻¹:Aˣ):A) + val_inv := by rw [Algebra.TensorProduct.tmul_mul_tmul,Units.mul_inv,Algebra.TensorProduct.one_def] + inv_val := by rw [Algebra.TensorProduct.tmul_mul_tmul,Units.inv_mul,Algebra.TensorProduct.one_def] + +theorem inverse_diagonal (N : ℕ) (P : (Q ℝ (N+N))ˣ) (p : (Q ℝ N)ˣ) + (h : diagonal N (P:Q ℝ (N+N))=(p:Q ℝ N)⊗ₜ[ℝ](p:Q ℝ N)) : + diagonal N ((P⁻¹:(Q ℝ (N+N))ˣ):Q ℝ (N+N))= + ((p⁻¹:(Q ℝ N)ˣ):Q ℝ N)⊗ₜ[ℝ]((p⁻¹:(Q ℝ N)ˣ):Q ℝ N) := by + have hu : Units.map (diagonal N).toMonoidHom P=tensorUnit p := Units.ext h + have hh := congrArg (fun u => ((u⁻¹:(Q ℝ N⊗[ℝ]Q ℝ N)ˣ):Q ℝ N⊗[ℝ]Q ℝ N)) hu + exact hh + +theorem transport_cutoff_gen (N : ℕ) (P : (Q ℝ N)ˣ) + (hP : (P:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) (b : Bool) : + transport N P hP (gen N b)=family N P b := transport_gen N P hP b + +theorem congr_tmul {A : Type*} [Ring A] [Algebra ℝ A] (e : A ≃ₐ[ℝ] A) (a b : A) : + Algebra.TensorProduct.congr e e (a⊗ₜ[ℝ]b)=e a⊗ₜ[ℝ]e b := rfl + +theorem transport_diagonal (N : ℕ) (P : (Q ℝ (N+N))ˣ) (p : (Q ℝ N)ˣ) + (hP : (P:Q ℝ (N+N))-1∈TruncatedWords.filtration ∅ (N+N) 1) + (hp : (p:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (h : diagonal N (P:Q ℝ (N+N))=(p:Q ℝ N)⊗ₜ[ℝ](p:Q ℝ N)) (u : Q ℝ (N+N)) : + diagonal N (transport (N+N) P hP u)= + Algebra.TensorProduct.congr (transport N p hp) (transport N p hp) (diagonal N u) := by + have he : (diagonal N).comp (transport (N+N) P hP).toAlgHom= + (Algebra.TensorProduct.congr (transport N p hp) (transport N p hp)).toAlgHom.comp (diagonal N) := by + apply TruncatedSubstitution.hom_ext (N+N) + intro b + change diagonal N (transport (N+N) P hP (gen (N+N) b))= + Algebra.TensorProduct.congr (transport N p hp) (transport N p hp) (diagonal N (gen (N+N) b)) + rw [transport_cutoff_gen,diagonal_gen] + cases b + · simp only [family,left,right,Algebra.TensorProduct.includeLeft_apply, + Algebra.TensorProduct.includeRight_apply,map_add,congr_tmul,map_one, + transport_cutoff_gen,ConjugateComparison.family] + exact diagonal_gen N false + · change diagonal N (((P⁻¹:(Q ℝ (N+N))ˣ):Q ℝ (N+N))*gen (N+N) true*(P:Q ℝ (N+N)))=_ + rw [map_mul,map_mul,inverse_diagonal N P p h,h,diagonal_gen] + change (_⊗ₜ[ℝ]_)*(gen N true⊗ₜ[ℝ]1+1⊗ₜ[ℝ]gen N true)*(_⊗ₜ[ℝ]_)=_ + simp only [mul_add,add_mul,Algebra.TensorProduct.tmul_mul_tmul,mul_one, + Units.inv_mul,map_add,left,right,Algebra.TensorProduct.includeLeft_apply, + Algebra.TensorProduct.includeRight_apply,congr_tmul,map_one, + transport_cutoff_gen,family] + rfl + exact AlgHom.congr_fun he u + +theorem natural_inverse {A B : Type*} [Ring A] [Ring B] [Algebra ℝ A] [Algebra ℝ B] + (f : A →ₐ[ℝ] B) (e : A ≃ₐ[ℝ] A) (d : B ≃ₐ[ℝ] B) + (he : ∀ u,f (e u)=d (f u)) (u : A) : f (e.symm u)=d.symm (f u) := by + apply d.injective + rw [d.apply_symm_apply,←he,e.apply_symm_apply] + +theorem theta_diagonal (N : ℕ) (P V : (Q ℝ (N+N))ˣ) (p v : (Q ℝ N)ˣ) + (hP : (P:Q ℝ (N+N))-1∈TruncatedWords.filtration ∅ (N+N) 1) + (hV : (V:Q ℝ (N+N))-1∈TruncatedWords.filtration ∅ (N+N) 1) + (hp : (p:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hv : (v:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hΔP : diagonal N (P:Q ℝ (N+N))=(p:Q ℝ N)⊗ₜ[ℝ](p:Q ℝ N)) + (hΔV : diagonal N (V:Q ℝ (N+N))=(v:Q ℝ N)⊗ₜ[ℝ](v:Q ℝ N)) (u : Q ℝ (N+N)) : + diagonal N (theta (N+N) P V hP hV u)= + Algebra.TensorProduct.congr (theta N p v hp hv) (theta N p v hp hv) (diagonal N u) := by + rw [theta,AlgEquiv.trans_apply,transport_diagonal N V v hV hv hΔV, + natural_inverse (diagonal N) (transport (N+N) P hP) + (Algebra.TensorProduct.congr (transport N p hp) (transport N p hp)) + (transport_diagonal N P p hP hp hΔP)] + generalize diagonal N u=z + induction z using TensorProduct.inductionOn with + + | add z w hz hw => simp only [map_add,hz,hw] + | tmul a b => rfl + +theorem arrow_diagonal (N : ℕ) (P V : (Q ℝ (N+N))ˣ) (p v : (Q ℝ N)ˣ) + (hP : (P:Q ℝ (N+N))-1∈TruncatedWords.filtration ∅ (N+N) 1) + (hV : (V:Q ℝ (N+N))-1∈TruncatedWords.filtration ∅ (N+N) 1) + (hp : (p:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hv : (v:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hΔP : diagonal N (P:Q ℝ (N+N))=(p:Q ℝ N)⊗ₜ[ℝ](p:Q ℝ N)) + (hΔV : diagonal N (V:Q ℝ (N+N))=(v:Q ℝ N)⊗ₜ[ℝ](v:Q ℝ N)) : + diagonal N (unitArrow (N+N) P V hP hV:Q ℝ (N+N))= + (unitArrow N p v hp hv:Q ℝ N)⊗ₜ[ℝ](unitArrow N p v hp hv:Q ℝ N) := by + have ht : diagonal N (Units.map (theta (N+N) P V hP hV).toMonoidHom P:Q ℝ (N+N))= + (Units.map (theta N p v hp hv).toMonoidHom p:Q ℝ N)⊗ₜ[ℝ] + (Units.map (theta N p v hp hv).toMonoidHom p:Q ℝ N) := by + change diagonal N (theta (N+N) P V hP hV (P:Q ℝ (N+N)))=_ + rw [theta_diagonal N P V p v hP hV hp hv hΔP hΔV,hΔP] + rfl + simp only [unitArrow,Units.val_mul,map_mul,hΔV,inverse_diagonal N _ _ ht, + Algebra.TensorProduct.tmul_mul_tmul] +end ConjugateCoalgebra + +namespace OperatorLog + +section +open scoped TensorProduct +variable {V : Type*} [AddCommGroup V] [Module ℚ V] + +theorem logarithm_stable (T : Module.End ℚ V) {N M : ℕ} (hT : T^(N+1)=0) (hNM : N≤M) : + logarithm N T=logarithm M T := by + unfold logarithm + apply sum_range_extend _ (by omega : N+1≤M+1) + intro k hk hkm + rw [pow_eq_zero_of_le hk hT,smul_zero] + +def tensorDifference (T : Module.End ℚ V) : Module.End ℚ (V ⊗[ℚ] V) := + TensorProduct.map (1+T) (1+T)-1 + +theorem tensorDifference_nilpotent (T : Module.End ℚ V) (N : ℕ) (hT : T^(N+1)=0) : + tensorDifference T^(2*N+1)=0 := by + let a := TensorProduct.map T (1+T) + let b := TensorProduct.map (1:Module.End ℚ V) T + have he : tensorDifference T=a+b := by + simp only [tensorDifference,TensorProduct.map_add_left,TensorProduct.map_add_right, + TensorProduct.map_one,a,b] + abel + have hc : Commute a b := by + change a*b=b*a + dsimp only [a,b] + rw [←TensorProduct.map_mul,←TensorProduct.map_mul,mul_one,one_mul] + congr 1 + noncomm_ring + have ha : a^(N+1)=0 := by simp only [a,TensorProduct.map_pow,hT,TensorProduct.map_zero_left] + have hb : b^(N+1)=0 := by simp only [b,TensorProduct.map_pow,hT,TensorProduct.map_zero_right] + rw [he] + exact hc.add_pow_eq_zero_of_add_le_succ_of_pow_eq_zero ha hb (by omega) + +theorem logarithm_tensor_tmul (T : Module.End ℚ V) (N : ℕ) (hT : T^(N+1)=0) (u v : V) : + logarithm (2*N) (tensorDifference T) (u ⊗ₜ[ℚ] v)= + logarithm N T u ⊗ₜ[ℚ] v+u ⊗ₜ[ℚ] logarithm N T v := by + have hp : T^(2*N+1)=0 := pow_eq_zero_of_le (by omega) hT + have h := logarithm_bilinear (2*N) T T (tensorDifference T) hp hp + (tensorDifference_nilpotent T N hT) (TensorProduct.mk ℚ V V) + (by + intro a b + have he : 1+tensorDifference T=TensorProduct.map (1+T) (1+T) := by + unfold tensorDifference + abel + rw [he] + rfl) u v + rw [←logarithm_stable T hT (by omega : N≤2*N)] at h + exact h + +theorem logarithm_tensor (T : Module.End ℚ V) (N : ℕ) (hT : T^(N+1)=0) (z : V ⊗[ℚ] V) : + logarithm (2*N) (tensorDifference T) z= + TensorProduct.map (logarithm N T) LinearMap.id z+ + TensorProduct.map LinearMap.id (logarithm N T) z := by + induction z using TensorProduct.inductionOn with + + | add z w hz hw => simp only [map_add,hz,hw]; abel + | tmul u v => exact logarithm_tensor_tmul T N hT u v + +theorem logarithm_coderivation (T : Module.End ℚ V) (N : ℕ) (hT : T^(N+1)=0) + (Δ : V →ₗ[ℚ] V ⊗[ℚ] V) + (hΔ : ∀ v,Δ ((1+T) v)=TensorProduct.map (1+T) (1+T) (Δ v)) (v : V) : + Δ (logarithm N T v)=TensorProduct.map (logarithm N T) LinearMap.id (Δ v)+ + TensorProduct.map LinearMap.id (logarithm N T) (Δ v) := by + have hn : ∀ v,Δ (T v)=tensorDifference T (Δ v) := by + intro v + have h := hΔ v + simp only [LinearMap.add_apply,Module.End.one_apply,map_add] at h + change Δ (T v)=TensorProduct.map (1+T) (1+T) (Δ v)-Δ v + exact eq_sub_of_add_eq' h + rw [logarithm_stable T hT (by omega : N≤2*N), + logarithm_natural (2*N) T (tensorDifference T) Δ hn,logarithm_tensor T N hT] + rw [←logarithm_stable T hT (by omega : N≤2*N)] + +end + +variable {V W Z : Type*} [AddCommGroup V] [Module ℚ V] + [AddCommGroup W] [Module ℚ W] [AddCommGroup Z] [Module ℚ Z] + +theorem logarithm_diagonal (N : ℕ) (T : Module.End ℚ V) (R : Module.End ℚ W) + (hT : T^(N+1)=0) (hR : R^(N+1)=0) + (Δ : V →ₗ[ℚ] Z) (B : W →ₗ[ℚ] W →ₗ[ℚ] Z) (a : V) (b : W) + (h : ∀ m : ℕ,Δ (((1+T)^m) a)=B (((1+R)^m) b) (((1+R)^m) b)) : + Δ (logarithm N T a)=B (logarithm N R b) b+B b (logarithm N R b) := by + apply sub_eq_zero.mp + apply (Module.forall_dual_apply_eq_zero_iff ℚ _).mp + intro l + have hp : valuePolynomial N T a (l.comp Δ)=pairPolynomial N R R B b b l := by + apply polynomial_ext_nat + intro m + rw [value_eval,pair_eval,interpolate_nat N T hT,interpolate_nat N R hR] + exact congrArg l (h m) + have hc := congrArg (fun p : Polynomial ℚ => p.coeff 1) hp + rw [value_one,pair_one] at hc + simpa only [map_sub,sub_eq_zero,LinearMap.comp_apply] using hc + +end OperatorLog + +namespace KZPrimitiveValue +open scoped TensorProduct +open CutoffDepth CutoffKZ CutoffDiagonal KZComparison + + theorem theta_diagonal (N : ℕ) (u : Q ℝ (N+N)) : + diagonal N (theta (N+N) u)= + Algebra.TensorProduct.congr (theta N) (theta N) (diagonal N u) := + ConjugateCoalgebra.theta_diagonal N _ _ _ _ _ _ _ _ + (KZGroupLike.positive_diagonal N) (KZGroupLike.negative_diagonal N) u + + theorem arrow_diagonal (N : ℕ) : diagonal N (arrow (N+N):Q ℝ (N+N))= + (arrow N:Q ℝ N)⊗ₜ[ℝ](arrow N:Q ℝ N) := + ConjugateCoalgebra.arrow_diagonal N _ _ _ _ _ _ _ _ + (KZGroupLike.positive_diagonal N) (KZGroupLike.negative_diagonal N) + + def S (N : ℕ) : Module.End ℝ (Q ℝ N) := + (LinearMap.mulLeft ℝ (arrow N:Q ℝ N)).comp (theta N).toLinearMap + @[simp] theorem S_apply (N : ℕ) (u : Q ℝ N) : S N u=(arrow N:Q ℝ N)*theta N u := rfl + + theorem category_S (N : ℕ) : (category N).S false true=(S N).restrictScalars ℚ := by + apply LinearMap.ext + intro u + simp only [category,GaugeAutomorphism.data,GaugeAutomorphism.map_apply,frames,inv_one, + Units.val_one,mul_one] + rfl + + theorem S_diagonal (N : ℕ) (u : Q ℝ (N+N)) : + diagonal N (S (N+N) u)=TensorProduct.map (S N) (S N) (diagonal N u) := by + rw [S_apply,map_mul,arrow_diagonal,theta_diagonal] + generalize diagonal N u=z + induction z using TensorProduct.inductionOn with + + | add z w hz hw => simp only [map_add,mul_add,hz,hw] + | tmul a b => + rw [ConjugateCoalgebra.congr_tmul,Algebra.TensorProduct.tmul_mul_tmul] + rfl + + def tmulQ (N : ℕ) : Q ℝ N →ₗ[ℚ] Q ℝ N →ₗ[ℚ] Q ℝ N⊗[ℝ]Q ℝ N := + LinearMap.mk₂ ℚ (fun a b => a⊗ₜ[ℝ]b) + TensorProduct.add_tmul (fun c a b => (TensorProduct.smul_tmul' c a b).symm) + TensorProduct.tmul_add TensorProduct.tmul_smul + + theorem orbit_diagonal (N m : ℕ) : + diagonal N ((((category (N+N)).S false true)^m) (1:Q ℝ (N+N)))= + ((((category N).S false true)^m) (1:Q ℝ N))⊗ₜ[ℝ] + ((((category N).S false true)^m) (1:Q ℝ N)) := by + induction m with + | zero => simp only [pow_zero,Module.End.one_apply,map_one,Algebra.TensorProduct.one_def] + | succ m ih => + simp only [pow_succ',Module.End.mul_apply] + rw [category_S] + change diagonal N (S (N+N) _)=_ + rw [category_S] at ih + rw [S_diagonal,ih,TensorProduct.map_tmul,category_S] + rfl + + theorem value_diagonal (N : ℕ) : diagonal N (value (N+N))= + value N⊗ₜ[ℝ](1:Q ℝ N)+(1:Q ℝ N)⊗ₜ[ℝ]value N := by + let T := (category (N+N)).S false true-1 + let R := (category N).S false true-1 + have hT : T^(N+N+1+1)=0 := (category (N+N)).nilpotent false true + have hR : R^(N+1+1)=0 := (category N).nilpotent false true + have hR' : R^(N+N+1+1)=0 := pow_eq_zero_of_le (by omega) hR + have hh := OperatorLog.logarithm_diagonal (N+N+1) T R hT hR' + ((diagonal N).toLinearMap.restrictScalars ℚ) (tmulQ N) 1 1 (by + intro m + have ht : 1+T=(category (N+N)).S false true := by dsimp only [T]; abel + have hr : 1+R=(category N).S false true := by dsimp only [R]; abel + rw [ht,hr] + exact orbit_diagonal N m) + rw [←OperatorLog.logarithm_stable R hR (by omega : N+1≤N+N+1)] at hh + exact hh + +end KZPrimitiveValue + +namespace KZCutoffComparison +open CutoffDepth CutoffKZ CutoffDiagonal KZComparison ConjugateComparison + + theorem transport_natural (M N : ℕ) (f : Q ℝ M →ₐ[ℝ] Q ℝ N) + (hgen : ∀ b,f (gen M b)=gen N b) (P : (Q ℝ M)ˣ) (p : (Q ℝ N)ˣ) + (hP : (P:Q ℝ M)-1∈TruncatedWords.filtration ∅ M 1) + (hp : (p:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (h : Units.map f.toMonoidHom P=p) (u : Q ℝ M) : + f (transport M P hP u)=transport N p hp (f u) := by + have hv : f (P:Q ℝ M)=(p:Q ℝ N) := congrArg Units.val h + have hi : f ((P⁻¹:(Q ℝ M)ˣ):Q ℝ M)=((p⁻¹:(Q ℝ N)ˣ):Q ℝ N) := + congrArg (fun v => ((v⁻¹:(Q ℝ N)ˣ):Q ℝ N)) h + have he : f.comp (transport M P hP).toAlgHom=(transport N p hp).toAlgHom.comp f := by + apply TruncatedSubstitution.hom_ext M + intro b + change f (transport M P hP (gen M b))=transport N p hp (f (gen M b)) + rw [ConjugateCoalgebra.transport_cutoff_gen,hgen,ConjugateCoalgebra.transport_cutoff_gen] + cases b + · exact hgen false + · change f (((P⁻¹:(Q ℝ M)ˣ):Q ℝ M)*gen M true*(P:Q ℝ M))=_ + rw [map_mul,map_mul,hi,hv,hgen] + rfl + exact AlgHom.congr_fun he u + + theorem theta_natural (M N : ℕ) (f : Q ℝ M →ₐ[ℝ] Q ℝ N) + (hgen : ∀ b,f (gen M b)=gen N b) (P V : (Q ℝ M)ˣ) (p v : (Q ℝ N)ˣ) + (hP : (P:Q ℝ M)-1∈TruncatedWords.filtration ∅ M 1) + (hV : (V:Q ℝ M)-1∈TruncatedWords.filtration ∅ M 1) + (hp : (p:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hv : (v:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (h : Units.map f.toMonoidHom P=p) (k : Units.map f.toMonoidHom V=v) (u : Q ℝ M) : + f (ConjugateComparison.theta M P V hP hV u)=ConjugateComparison.theta N p v hp hv (f u) := by + rw [ConjugateComparison.theta,AlgEquiv.trans_apply,transport_natural M N f hgen V v hV hv k, + ConjugateCoalgebra.natural_inverse f (transport M P hP) (transport N p hp) + (transport_natural M N f hgen P p hP hp h)] + rfl + + theorem arrow_natural (M N : ℕ) (f : Q ℝ M →ₐ[ℝ] Q ℝ N) + (hgen : ∀ b,f (gen M b)=gen N b) (P V : (Q ℝ M)ˣ) (p v : (Q ℝ N)ˣ) + (hP : (P:Q ℝ M)-1∈TruncatedWords.filtration ∅ M 1) + (hV : (V:Q ℝ M)-1∈TruncatedWords.filtration ∅ M 1) + (hp : (p:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (hv : (v:Q ℝ N)-1∈TruncatedWords.filtration ∅ N 1) + (h : Units.map f.toMonoidHom P=p) (k : Units.map f.toMonoidHom V=v) : + Units.map f.toMonoidHom (unitArrow M P V hP hV)=unitArrow N p v hp hv := by + have ht : Units.map f.toMonoidHom (Units.map (ConjugateComparison.theta M P V hP hV).toMonoidHom P)= + Units.map (ConjugateComparison.theta N p v hp hv).toMonoidHom p := by + apply Units.ext + change f (ConjugateComparison.theta M P V hP hV (P:Q ℝ M))=_ + rw [theta_natural M N f hgen P V p v hP hV hp hv h k,show f (P:Q ℝ M)=(p:Q ℝ N) from congrArg Units.val h] + rfl + simp only [unitArrow,map_mul,map_inv,k,ht] + + theorem positive_drop (M N : ℕ) (h : N≤M) : + Units.map (drop M N h).toMonoidHom (positive M)=positive N := by + apply Units.ext + change drop M N h (positive M:Q ℝ M)=(positive N:Q ℝ N) + rw [positive_val,positive_val,drop_associator] + theorem negative_drop (M N : ℕ) (h : N≤M) : + Units.map (drop M N h).toMonoidHom (negative M)=negative N := by + apply Units.ext + change drop M N h (negative M:Q ℝ M)=(negative N:Q ℝ N) + rw [negative_val,negative_val,KZCollar.map_associator_general (drop M N h) (weight M) (weight N) + ((weight M).space 1|>.neg_mem (gen_weight M false)) ((weight M).space 1|>.neg_mem (gen_weight M true)) + (by simpa only [map_neg,drop_gen] using ((weight N).space 1).neg_mem (gen_weight N false)) + (by simpa only [map_neg,drop_gen] using ((weight N).space 1).neg_mem (gen_weight N true)),map_neg,map_neg,drop_gen,drop_gen] + + theorem theta_drop (M N : ℕ) (h : N≤M) (u : Q ℝ M) : + drop M N h (KZComparison.theta M u)=KZComparison.theta N (drop M N h u) := + theta_natural M N (drop M N h) (drop_gen M N h) _ _ _ _ _ _ _ _ + (positive_drop M N h) (negative_drop M N h) u + theorem arrow_drop (M N : ℕ) (h : N≤M) : Units.map (drop M N h).toMonoidHom (arrow M)=arrow N := + arrow_natural M N (drop M N h) (drop_gen M N h) _ _ _ _ _ _ _ _ + (positive_drop M N h) (negative_drop M N h) + theorem S_drop (M N : ℕ) (h : N≤M) (u : Q ℝ M) : + drop M N h ((category M).S false true u)=(category N).S false true (drop M N h u) := by + simp only [category,GaugeAutomorphism.data,GaugeAutomorphism.map_apply,frames,inv_one, + Units.val_one,mul_one] + change drop M N h ((arrow M:Q ℝ M)*KZComparison.theta M u)=_ + rw [map_mul,theta_drop,show drop M N h (arrow M:Q ℝ M)=(arrow N:Q ℝ N) from congrArg Units.val (arrow_drop M N h)] + rfl + theorem value_drop (M N : ℕ) (h : N≤M) : drop M N h (value M)=value N := by + have hn : ∀ u,drop M N h (((category M).S false true-1) u)= + ((category N).S false true-1) (drop M N h u) := by + intro u + simp only [LinearMap.sub_apply,Module.End.one_apply,map_sub,S_drop] + have hh := OperatorLog.logarithm_natural (M+1) ((category M).S false true-1) + ((category N).S false true-1) ((drop M N h).toLinearMap.restrictScalars ℚ) hn 1 + rw [←OperatorLog.logarithm_stable _ ((category N).nilpotent false true) (by omega : N+1≤M+1)] at hh + change drop M N h (value M)=OperatorLog.logarithm (N+1) _ (drop M N h 1) at hh + rw [map_one] at hh + exact hh + +end KZCutoffComparison + +namespace CutoffPrimitiveExtract +open AssociativeElimination WordGrading TensorProjection +open scoped TensorProduct +variable {R α : Type*} [CommRing R] + +def truncVal (N : ℕ) : A R α →ₗ[R] A R α := + (TruncatedFree.B R α N).subtype.comp (TruncatedFree.trunc N) + +theorem piece_trunc (N n : ℕ) (hn : n≤N) (p : A R α) : piece n (truncVal N p)=piece n p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change piece n (project (fun w => len w≤N) (word w))=piece n (word w) + rw [project_word] + by_cases hw : len w≤N + · rw [ite_eq_left hw] + · rw [ite_eq_right hw,map_zero,TensorProjection.piece,WordGrading.piece,project_word,ite_eq_right (by change len w≠n; omega)] + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +theorem totalPiece_trunc (N n : ℕ) (hn : n≤N) (u : A R α⊗[R]A R α) : + totalPiece n (TensorProduct.map (truncVal N) (truncVal N) u)=totalPiece n u := by + induction u using TensorProduct.inductionOn with + + | add u v hu hv => simp only [map_add,hu,hv] + | tmul p q => + simp only [TensorProduct.map_tmul,totalPiece,LinearMap.sum_apply,TensorProduct.map_tmul] + apply Finset.sum_congr rfl + intro i hi + rw [piece_trunc N i (by have hi' := Finset.mem_range.mp hi; omega), + piece_trunc N (n-i) (by omega)] + +def leftPair : A R α →ₐ[R] PrimitiveWords.B R α := + MonoidAlgebra.mapDomainAlgHom R R ((MonoidHom.id _).prod (1:FreeMonoid α →* FreeMonoid α)) +def rightPair : A R α →ₐ[R] PrimitiveWords.B R α := + MonoidAlgebra.mapDomainAlgHom R R ((1:FreeMonoid α →* FreeMonoid α).prod (MonoidHom.id _)) +@[simp] theorem leftPair_word (w : FreeMonoid α) : leftPair (word (R:=R) w)=PrimitiveWords.pair w 1 := by + simp [leftPair,word,PrimitiveWords.pair,MonoidAlgebra.mapDomainAlgHom] +@[simp] theorem rightPair_word (w : FreeMonoid α) : rightPair (word (R:=R) w)=PrimitiveWords.pair 1 w := by + simp [rightPair,word,PrimitiveWords.pair,MonoidAlgebra.mapDomainAlgHom] + +theorem pair_commute (p q : A R α) : Commute (leftPair p) (rightPair q) := by + change leftPair p*rightPair q=rightPair q*leftPair p + induction p using MonoidAlgebra.induction_on with + | of u => + change leftPair (word u)*rightPair q=rightPair q*leftPair (word u) + induction q using MonoidAlgebra.induction_on with + | of v => + change leftPair (word u)*rightPair (word v)=rightPair (word v)*leftPair (word u) + simp only [leftPair_word,rightPair_word,←PrimitiveWords.pair_mul,mul_one,one_mul] + | add q r hq hr => simp only [map_add,mul_add,add_mul,hq,hr] + | smul c q hq => simp only [map_smul,mul_smul_comm,smul_mul_assoc,hq] + | add p r hp hr => simp only [map_add,mul_add,add_mul,hp,hr] + | smul c p hp => simp only [map_smul,mul_smul_comm,smul_mul_assoc,hp] + +def pairMap : A R α⊗[R]A R α →ₐ[R] PrimitiveWords.B R α := + Algebra.TensorProduct.lift leftPair rightPair pair_commute + +theorem pairMap_coproduct (p : A R α) : (pairMap (R:=R) (α:=α)) ((coproduct (R:=R) (α:=α)) p)=PrimitiveWords.coproduct p := by + have he : (pairMap (R:=R) (α:=α)).comp coproduct=PrimitiveWords.coproduct := by + apply AssociativeElimination.hom_ext + intro a + change (pairMap (R:=R) (α:=α)) ((coproduct (R:=R) (α:=α)) (atom a))=PrimitiveWords.coproduct (atom a) + rw [TensorProjection.coproduct_atom,PrimitiveWords.coproduct_atom,map_add] + simp only [pairMap,Algebra.TensorProduct.lift_tmul,map_one,mul_one,one_mul] + change leftPair (word (FreeMonoid.of a))+rightPair (word (FreeMonoid.of a))=_ + rw [leftPair_word,rightPair_word] + exact AlgHom.congr_fun he p + +theorem leftPair_eq (p : A R α) : leftPair p=PrimitiveWords.left p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change leftPair (word w)=PrimitiveWords.left (word w) + rw [leftPair_word] + simp [PrimitiveWords.left,word] + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] +theorem rightPair_eq (p : A R α) : rightPair p=PrimitiveWords.right p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change rightPair (word w)=PrimitiveWords.right (word w) + rw [rightPair_word] + simp [PrimitiveWords.right,word] + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +theorem primitive_of_tensor (p : A R α) (h : (coproduct (R:=R) (α:=α)) p=p⊗ₜ[R]1+(1:A R α)⊗ₜ[R]p) : + PrimitiveWords.Primitive p := by + unfold PrimitiveWords.Primitive + have hh := congrArg (pairMap (R:=R) (α:=α)) h + rw [pairMap_coproduct,map_add] at hh + simpa only [pairMap,Algebra.TensorProduct.lift_tmul,map_one,mul_one,one_mul,leftPair_eq,rightPair_eq] using hh + +open CutoffDepth CutoffKZ CutoffDiagonal + +def normalVal (N : ℕ) : Q ℝ N →ₗ[ℝ] A ℝ Bool := + (TruncatedFree.B ℝ Bool N).subtype.comp (TruncatedFree.normal N) +@[simp] theorem normalVal_quotient (N : ℕ) (p : A ℝ Bool) : + normalVal N (TruncatedWords.quotient ∅ N p)=truncVal N p := by + change (TruncatedFree.normal N (TruncatedWords.quotient ∅ N p)).val=_ + rw [TruncatedFree.normal_quotient] + rfl +@[simp] theorem normalVal_one (N : ℕ) : normalVal N 1=1 := by + have h := normalVal_quotient N (1:A ℝ Bool) + rw [map_one] at h + rw [h] + change project _ (word 1)=word 1 + rw [project_word,ite_eq_left (by simp)] + +theorem diagonal_quotient (N : ℕ) (p : A ℝ Bool) : + diagonal N (TruncatedWords.quotient ∅ (N+N) p)= + TensorProduct.map (TruncatedWords.quotient ∅ N).toLinearMap (TruncatedWords.quotient ∅ N).toLinearMap ((coproduct (R:=ℝ) (α:=Bool)) p) := by + have he : (diagonal N).comp (TruncatedWords.quotient ∅ (N+N))= + (Algebra.TensorProduct.map (TruncatedWords.quotient ∅ N) (TruncatedWords.quotient ∅ N)).comp coproduct := by + apply AssociativeElimination.hom_ext + intro a + change diagonal N (gen (N+N) a)=_ + rw [diagonal_gen] + simp only [AlgHom.comp_apply,coproduct_atom,map_add,Algebra.TensorProduct.map_tmul,map_one] + rfl + exact AlgHom.congr_fun he p + +theorem drop_quotient (M N : ℕ) (h : N≤M) (p : A ℝ Bool) : + drop M N h (TruncatedWords.quotient ∅ M p)=TruncatedWords.quotient ∅ N p := by + have he : (drop M N h).comp (TruncatedWords.quotient ∅ M)=TruncatedWords.quotient ∅ N := by + apply AssociativeElimination.hom_ext + intro a + exact drop_gen M N h a + exact AlgHom.congr_fun he p + +theorem piece_primitive (N n : ℕ) (hn : n≤N) (u : Q ℝ (N+N)) (v : Q ℝ N) + (hd : diagonal N u=v⊗ₜ[ℝ]1+(1:Q ℝ N)⊗ₜ[ℝ]v) + (hc : drop (N+N) N (by omega) u=v) : + PrimitiveWords.Primitive (piece n (normalVal N v)) := by + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective ℝ (TruncatedWords.relations (∅:Set (A ℝ Bool)) (N+N)) u + change drop (N+N) N _ (TruncatedWords.quotient ∅ (N+N) p)=v at hc + rw [drop_quotient] at hc + subst v + rw [normalVal_quotient,piece_trunc N n hn] + apply primitive_of_tensor + rw [coproduct_piece] + change diagonal N (TruncatedWords.quotient ∅ (N+N) p)=_ at hd + have hh := congrArg (fun z => totalPiece n (TensorProduct.map (normalVal N) (normalVal N) z)) hd + rw [diagonal_quotient] at hh + have hmap : (TensorProduct.map (normalVal N) (normalVal N)).comp + (TensorProduct.map (TruncatedWords.quotient ∅ N).toLinearMap (TruncatedWords.quotient ∅ N).toLinearMap)= + TensorProduct.map (truncVal N) (truncVal N) := by + apply TensorProduct.ext + apply LinearMap.ext + intro a + apply LinearMap.ext + intro b + change (TensorProduct.map (normalVal N) (normalVal N)) + ((TensorProduct.map (TruncatedWords.quotient ∅ N).toLinearMap (TruncatedWords.quotient ∅ N).toLinearMap) (a⊗ₜ[ℝ]b))=_ + change normalVal N (TruncatedWords.quotient ∅ N a)⊗ₜ[ℝ] + normalVal N (TruncatedWords.quotient ∅ N b)=truncVal N a⊗ₜ[ℝ]truncVal N b + rw [normalVal_quotient,normalVal_quotient] + change totalPiece n (((TensorProduct.map (normalVal N) (normalVal N)).comp _) ((coproduct (R:=ℝ) (α:=Bool)) p))=_ at hh + rw [hmap,totalPiece_trunc N n hn] at hh + simpa only [map_add,TensorProduct.map_tmul,normalVal_quotient,normalVal_one, + totalPiece_left,totalPiece_right,piece_trunc N n hn] using hh + +theorem KZ_value_lie (N n : ℕ) (hn : 0 1) n ∧ + embed q=piece n (normalVal N (KZComparison.value N)) := by + apply PrimitiveWords.exists_lie_of_primitive hn + · exact project_mem _ _ + · exact piece_primitive N n hnN _ _ (KZPrimitiveValue.value_diagonal N) + (KZCutoffComparison.value_drop (N+N) N (by omega)) +end CutoffPrimitiveExtract + +namespace OperatorLog +open Polynomial +variable {V : Type*} [AddCommGroup V] [Module ℚ V] +variable (N : ℕ) (T : Module.End ℚ V) (hT : T^(N+1)=0) + + include hT + theorem value_taylor (a : V) (l : V →ₗ[ℚ] ℚ) (m : ℕ) : + taylor (m:ℚ) (valuePolynomial N T a l)=valuePolynomial N T (((1+T)^m) a) l := by + apply polynomial_ext_nat + intro n + rw [taylor_eval,←Nat.cast_add,value_eval,interpolate_nat N T hT,value_eval, + interpolate_nat N T hT,pow_add,Module.End.mul_apply] + + theorem value_derivative (a : V) (l : V →ₗ[ℚ] ℚ) : + (valuePolynomial N T a l).derivative=valuePolynomial N T a (l.comp (logarithm N T)) := by + apply polynomial_ext_nat + intro m + rw [←taylor_coeff_one,value_taylor N T hT,value_one,value_eval,interpolate_nat N T hT] + rfl + + theorem value_zero (a : V) (l : V →ₗ[ℚ] ℚ) : (valuePolynomial N T a l).coeff 0=l a := by + rw [coeff_zero_eq_eval_zero,value_eval] + have h := interpolate_nat N T hT 0 + simpa only [Nat.cast_zero,pow_zero,Module.End.one_apply] using congrArg (fun f : Module.End ℚ V => l (f a)) h + + theorem value_coeff (a : V) (l : V →ₗ[ℚ] ℚ) (k : ℕ) : + (valuePolynomial N T a l).coeff k=(k.factorial:ℚ)⁻¹*l (((logarithm N T)^k) a) := by + induction k generalizing l with + | zero => simp only [value_zero N T hT,Nat.factorial_zero,Nat.cast_one,inv_one,pow_zero,Module.End.one_apply,one_mul] + | succ k ih => + have hh := congrArg (fun p : ℚ[X] => p.coeff k) (value_derivative N T hT a l) + rw [coeff_derivative,ih] at hh + have hk : (k+1:ℚ)≠0 := by positivity + rw [Nat.factorial_succ,Nat.cast_mul,Nat.cast_add,Nat.cast_one] + rw [pow_succ',Module.End.mul_apply] + change _= _*l (logarithm N T (((logarithm N T)^k) a)) + change (valuePolynomial N T a l).coeff (k+1)*(↑k+1:ℚ)= + (↑k.factorial:ℚ)⁻¹*l (logarithm N T (((logarithm N T)^k) a)) at hh + have hf : (k.factorial:ℚ)≠0 := Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero k) + field_simp at hh ⊢ + nlinarith [hh] + + theorem exp_logarithm (hL : IsNilpotent (logarithm N T)) : + IsNilpotent.exp (logarithm N T)=1+T := by + apply LinearMap.ext + intro a + apply sub_eq_zero.mp + apply (Module.forall_dual_apply_eq_zero_iff ℚ _).mp + intro l + rw [map_sub] + obtain ⟨m,hm⟩ := hL + let M := m+(valuePolynomial N T a l).natDegree+1 + have hmM : (logarithm N T)^M=0 := pow_eq_zero_of_le (by dsimp [M]; omega) hm + rw [IsNilpotent.exp_eq_sum hmM,LinearMap.sum_apply,map_sum] + have hp := (valuePolynomial N T a l).eval_eq_sum_range' (n:=M) (by dsimp [M]; omega) (1:ℚ) + simp only [one_pow,mul_one,value_coeff N T hT] at hp + have hi : interpolate N T 1=1+T := by simpa only [Nat.cast_one,pow_one] using interpolate_nat N T hT 1 + rw [value_eval,hi] at hp + simp only [LinearMap.smul_apply,map_smul,smul_eq_mul,hp,sub_self] +end OperatorLog + +namespace OperatorExp +open IsNilpotent +open scoped TensorProduct +variable {R V W U : Type*} [CommRing R] [Algebra ℚ R] + [AddCommGroup V] [Module R V] [Module ℚ V] + [AddCommGroup W] [Module R W] [Module ℚ W] + [AddCommGroup U] [Module R U] [Module ℚ U] + +omit [Algebra ℚ R] in + theorem natural (A : Module.End R V) (B : Module.End R W) + (hA : IsNilpotent A) (hB : IsNilpotent B) (f : V →ₗ[R] W) + (h : ∀ v,B (f v)=f (A v)) (v : V) : exp B (f v)=f (exp A v) := by + apply LinearMap.congr_fun (Module.End.commute_exp_left_of_commute hA hB _) v + exact LinearMap.ext h + +omit [Algebra ℚ R] in + theorem bilinear (A : Module.End R V) (B : Module.End R W) (C : Module.End R U) + (hA : IsNilpotent A) (hB : IsNilpotent B) (hC : IsNilpotent C) + (m : V →ₗ[R] W →ₗ[R] U) + (h : ∀ v w,C (m v w)=m (A v) w+m v (B w)) (v : V) (w : W) : + exp C (m v w)=m (exp A v) (exp B w) := by + let X : Module.End R (V⊗[R]W) := A.rTensor W + let Y : Module.End R (V⊗[R]W) := B.lTensor V + have hX : IsNilpotent X := hA.map (Module.End.rTensorAlgHom R V W) + have hY : IsNilpotent Y := hB.map (Module.End.lTensorAlgHom R W V) + have hc : Commute X Y := by ext; simp [X,Y] + have hXY : IsNilpotent (X+Y) := hc.isNilpotent_add hX hY + have hm : ∀ u,C (TensorProduct.lift m u)=TensorProduct.lift m ((X+Y) u) := by + intro u + induction u using TensorProduct.inductionOn with + + | add u z hu hz => simp only [map_add,hu,hz] + | tmul a b => simpa only [LinearMap.add_apply,LinearMap.rTensor_tmul, + LinearMap.lTensor_tmul,map_add,TensorProduct.lift.tmul,X,Y] using h a b + have hh := natural (X+Y) C hXY hC (TensorProduct.lift m) hm (v⊗ₜ[R]w) + rw [exp_add_of_commute hc hX hY] at hh + have hx : exp X=(exp A).rTensor W := (hA.map_exp (Module.End.rTensorAlgHom R V W)).symm + have hy : exp Y=(exp B).lTensor V := (hB.map_exp (Module.End.lTensorAlgHom R W V)).symm + simpa only [hx,hy,Module.End.mul_apply,LinearMap.rTensor_tmul,LinearMap.lTensor_tmul, + TensorProduct.lift.tmul] using hh + +omit [Algebra ℚ R] in + theorem fixed (A : Module.End R V) (hA : IsNilpotent A) {v : V} (hv : A v=0) : + exp A v=v := by + obtain ⟨n,hn⟩ := hA + have hn' : A^(n+1)=0 := pow_eq_zero_of_le (by omega) hn + rw [exp_eq_sum hn',LinearMap.sum_apply,Finset.sum_range_succ'] + have hz : ∀ i : ℕ,(A^(i+1)) v=0 := by + intro i + rw [_root_.pow_succ,Module.End.mul_apply,hv,map_zero] + simp only [LinearMap.smul_apply,hz,smul_zero,Finset.sum_const_zero,pow_zero, + Module.End.one_apply,Nat.factorial_zero,Nat.cast_one,inv_one,one_smul,zero_add] + +end OperatorExp + +namespace CategoryExp + +section +open IsNilpotent +variable {R A B O P : Type*} [CommRing R] [Ring A] [Algebra R A] [Module ℚ A] + [Ring B] [Algebra R B] [Module ℚ B] + +structure Data (R A O : Type*) [CommRing R] [Ring A] [Algebra R A] where + D : O → O → Module.End R A + comp : ∀ p q r (a b : A),D p r (b*a)=D q r b*a+b*D p q a + one : ∀ p,D p p 1=0 + + def gauge (d : Module.End R A) (hd : ∀ a b,d (a*b)=d a*b+a*d b) + (h1 : d 1=0) (h : O → A) : Data R A O where + D p q := d+LinearMap.mulLeft R (h q)-LinearMap.mulRight R (h p) + comp p q r a b := by + simp only [LinearMap.sub_apply,LinearMap.add_apply,LinearMap.mulLeft_apply, + LinearMap.mulRight_apply,hd] + noncomm_ring + one p := by + simp only [LinearMap.sub_apply,LinearMap.add_apply,LinearMap.mulLeft_apply, + LinearMap.mulRight_apply,h1,zero_add,mul_one,one_mul,sub_self] + + def act (g : Data R A O) (p q : O) : Module.End R A := exp (g.D p q) + + theorem composition (g : Data R A O) (hn : ∀ p q,IsNilpotent (g.D p q)) + (p q r : O) (a b : A) : act g p r (b*a)=act g q r b*act g p q a := + OperatorExp.bilinear _ _ _ (hn q r) (hn p q) (hn p r) (LinearMap.mul R A) + (fun b a => g.comp p q r a b) b a + + @[simp] theorem one (g : Data R A O) (hn : ∀ p q,IsNilpotent (g.D p q)) (p : O) : + act g p p 1=1 := OperatorExp.fixed _ (hn p p) (g.one p) + + theorem natural (g : Data R A O) (k : Data R B P) + (hg : ∀ p q,IsNilpotent (g.D p q)) (hk : ∀ p q,IsNilpotent (k.D p q)) + (f : A →ₗ[R] B) (o : O → P) + (hf : ∀ p q a,k.D (o p) (o q) (f a)=f (g.D p q a)) (p q : O) (a : A) : + act k (o p) (o q) (f a)=f (act g p q a) := + OperatorExp.natural _ _ (hg p q) (hk (o p) (o q)) f (hf p q) a + + theorem kills (g : Data R A O) (hg : ∀ p q,IsNilpotent (g.D p q)) + (p q : O) {a : A} (ha : g.D p q a=0) : act g p q a=a := + OperatorExp.fixed _ (hg p q) ha + + def neg (g : Data R A O) : Data R A O where + D p q := -g.D p q + comp p q r a b := by + change -(g.D p r (b*a))= -(g.D q r b)*a+b*(-(g.D p q a)) + rw [g.comp,neg_add,neg_mul,mul_neg] + one p := by simp only [LinearMap.neg_apply,g.one,neg_zero] + + theorem inverse (g : Data R A O) (hg : ∀ p q,IsNilpotent (g.D p q)) + (p q : O) (a : A) : act (neg g) p q (act g p q a)=a := by + have hh := exp_neg_mul_exp_self (hg p q) + exact LinearMap.congr_fun hh a + + def equivalence (g : Data R A O) (hg : ∀ p q,IsNilpotent (g.D p q)) + (p q : O) : A ≃ₗ[R] A := + { act g p q with + invFun := act (neg g) p q + left_inv := inverse g hg p q + right_inv := fun a => LinearMap.congr_fun (exp_mul_exp_neg_self (hg p q)) a } + + omit [Module ℚ A] in + theorem pow_mem {N : ℕ} (F : FilteredComparison.Filtration R A N) + (d : Module.End R A) (hd : ∀ n a,a∈F.step n → d a∈F.step (n+1)) + (i n : ℕ) {a : A} (ha : a∈F.step n) : (d^i) a∈F.step (n+i) := by + induction i with + | zero => simpa only [pow_zero,Module.End.one_apply,Nat.add_zero] using ha + | succ i ih => + rw [_root_.pow_succ',Module.End.mul_apply] + simpa only [Nat.add_assoc] using hd (n+i) _ ih + + omit [Module ℚ A] in + theorem nilpotent {N : ℕ} (F : FilteredComparison.Filtration R A N) + (d : Module.End R A) (hd : ∀ n a,a∈F.step n → d a∈F.step (n+1)) : IsNilpotent d := by + refine ⟨N+1,LinearMap.ext (fun a => ?_)⟩ + have hh := pow_mem F d hd (N+1) 0 (a:=a) (by rw [F.initial]; trivial) + simpa only [Nat.zero_add,F.terminal,Submodule.mem_bot,LinearMap.zero_apply] using hh + + theorem preserves [Algebra ℚ R] [IsScalarTower ℚ R A] {N : ℕ} (F : FilteredComparison.Filtration R A N) + (d : Module.End R A) (hd : ∀ n a,a∈F.step n → d a∈F.step (n+1)) + (n : ℕ) {a : A} (ha : a∈F.step n) : exp d a∈F.step n := by + obtain ⟨m,hm⟩ := nilpotent F d hd + rw [exp_eq_sum hm,LinearMap.sum_apply] + apply Submodule.sum_mem + intro i hi + change (↑i.factorial : ℚ)⁻¹ • (d^i) a∈F.step n + exact ((F.step n).restrictScalars ℚ).smul_mem _ (F.decreasing (Nat.le_add_right n i) (pow_mem F d hd i n ha)) + +end + +open IsNilpotent +variable {R V : Type*} [CommRing R] [Algebra ℚ R] [AddCommGroup V] + [Module R V] [Module ℚ V] [IsScalarTower ℚ R V] +variable {N : ℕ} (F : FilteredComparison.Filtration R V N) + (d : Module.End R V) (k : ℕ) + (hd : ∀ n a,a∈F.step n → d a∈F.step (n+k)) + +include hd +omit [Algebra ℚ R] [Module ℚ V] [IsScalarTower ℚ R V] in + theorem pow_mem_shift (i n : ℕ) {a : V} (ha : a∈F.step n) : (d^i) a∈F.step (n+i*k) := by + induction i with + | zero => simpa only [pow_zero,Module.End.one_apply,Nat.zero_mul,Nat.add_zero] using ha + | succ i ih => + rw [_root_.pow_succ',Module.End.mul_apply] + simpa only [Nat.succ_mul,Nat.add_assoc] using hd (n+i*k) _ ih + + theorem first_order (hk : 0 ?_)⟩ + have hp := pow_mem_shift F d k hd (N+1) 0 (a:=a) (by rw [F.initial]; trivial) + have hp' := F.decreasing (show N+1≤0+(N+1)*k by simpa using Nat.le_mul_of_pos_right (N+1) hk) hp + simpa only [F.terminal,Submodule.mem_bot,LinearMap.zero_apply] using hp' + obtain ⟨s,hs⟩ := hn + have hs' : d^(2+s)=0 := pow_eq_zero_of_le (by omega) hs + rw [exp_eq_sum hs',LinearMap.sum_apply,Finset.sum_range_add] + have htwo : (∑ i∈Finset.range 2,((↑i.factorial : ℚ)⁻¹ • d^i) a)=a+d a := by + simp [Finset.sum_range_succ] + rw [htwo] + have hsum : (∑ i∈Finset.range s,((↑(2+i).factorial : ℚ)⁻¹ • d^(2+i)) a)∈F.step (n+2*k) := by + apply Submodule.sum_mem + intro i hi + change (↑(2+i).factorial : ℚ)⁻¹ • (d^(2+i)) a∈_ + apply ((F.step (n+2*k)).restrictScalars ℚ).smul_mem + apply F.decreasing _ (pow_mem_shift F d k hd (2+i) n ha) + exact Nat.add_le_add_left (Nat.mul_le_mul_right k (by omega)) n + convert hsum using 1; abel + + theorem unit_leading (hk : 0 rfl + | succ k ih => simp only [pow_succ',Module.End.mul_apply,ih]; rfl + theorem restrict (N : ℕ) (T : Module.End ℝ V) : + (logarithm N T).restrictScalars ℚ=OperatorLog.logarithm N (T.restrictScalars ℚ) := by + apply LinearMap.ext + intro a + change logarithm N T a=OperatorLog.logarithm N (T.restrictScalars ℚ) a + simp only [OperatorLog.logarithm_eq,logarithm,LinearMap.sum_apply,LinearMap.smul_apply,pow_restrict] + theorem raises {M : ℕ} (F : FilteredComparison.Filtration ℝ V M) + (N : ℕ) (T : Module.End ℝ V) (hT : ∀ m a,a∈F.step m → T a∈F.step (m+1)) + (m : ℕ) (a : V) (ha : a∈F.step m) : logarithm N T a∈F.step (m+1) := by + rw [logarithm,LinearMap.sum_apply] + apply Submodule.sum_mem + intro k hk + change ((-1:ℚ)^k/(k+1)) • (T^(k+1)) a∈_ + apply ((F.step (m+1)).restrictScalars ℚ).smul_mem + have hp := CategoryExp.pow_mem_shift F T 1 hT (k+1) m ha + simp only [Nat.mul_one] at hp + exact F.decreasing (by omega) hp + theorem nilpotent {M : ℕ} (F : FilteredComparison.Filtration ℝ V M) + (N : ℕ) (T : Module.End ℝ V) (hT : ∀ m a,a∈F.step m → T a∈F.step (m+1)) : + IsNilpotent (logarithm N T) := by + refine ⟨M+1,LinearMap.ext (fun a => ?_)⟩ + have hh := CategoryExp.pow_mem_shift F (logarithm N T) 1 (raises F N T hT) (M+1) 0 + (a:=a) (by rw [F.initial]; trivial) + simpa only [Nat.mul_one,Nat.zero_add,F.terminal,Submodule.mem_bot,LinearMap.zero_apply] using hh + theorem exp_restrict (T : Module.End ℝ V) (hT : IsNilpotent T) (a : V) : + IsNilpotent.exp (T.restrictScalars ℚ) a=IsNilpotent.exp T a := by + obtain ⟨k,hk⟩ := hT + have hkr : (T.restrictScalars ℚ)^k=0 := by + apply LinearMap.ext + intro u + rw [pow_restrict,hk] + rfl + rw [IsNilpotent.exp_eq_sum hk,IsNilpotent.exp_eq_sum hkr,LinearMap.sum_apply,LinearMap.sum_apply] + simp only [LinearMap.smul_apply,pow_restrict] + theorem exp_logarithm (N : ℕ) (T : Module.End ℝ V) (hT : T^(N+1)=0) + (hL : IsNilpotent (logarithm N T)) : IsNilpotent.exp (logarithm N T)=1+T := by + have hTr : (T.restrictScalars ℚ)^(N+1)=0 := by + apply LinearMap.ext + intro a + rw [pow_restrict,hT] + rfl + have hLr : IsNilpotent (OperatorLog.logarithm N (T.restrictScalars ℚ)) := by + rw [←restrict] + obtain ⟨k,hk⟩ := hL + refine ⟨k,LinearMap.ext (fun a => ?_)⟩ + rw [pow_restrict,hk] + rfl + apply LinearMap.ext + intro a + rw [←exp_restrict _ hL,restrict,OperatorLog.exp_logarithm N _ hTr hLr] + rfl +end RealOperatorLog + +namespace TruncatedDerivation +open AssociativeElimination WordGrading TruncatedWords +variable {R α : Type*} [CommRing R] +variable (P : Set (A R α)) (N : ℕ) +local notation "Q" => TruncatedWords.Q P N +local notation "F" => filtration P N + + def gen (a : α) : Q := quotient P N (atom a) + theorem gen_mem (a : α) : gen P N a∈F 1 := + ⟨atom a,word_mem (FreeMonoid.of a) (by simp [wt]),rfl⟩ + + def jet (v : α → Q) : A R α →ₐ[R] TrivSqZeroExt Q Q := + AssociativeElimination.lift (R:=R) (fun a => (⟨gen P N a,v a⟩ : TrivSqZeroExt Q Q)) + + @[simp] theorem jet_atom (v : α → Q) (a : α) : jet P N v (atom a)=⟨gen P N a,v a⟩ := by + unfold jet + exact AssociativeElimination.lift_atom (R:=R) (B:=TrivSqZeroExt Q Q) (fun a => (⟨gen P N a,v a⟩ : TrivSqZeroExt Q Q)) a + + theorem fst_jet (v : α → Q) (p : A R α) : (jet P N v p).fst=quotient P N p := by + have he : (TrivSqZeroExt.fstHom R Q Q).comp (jet P N v)=quotient P N := by + apply hom_ext + intro a + change (jet P N v (atom a)).fst=quotient P N (atom a) + rw [jet_atom] + rfl + exact AlgHom.congr_fun he p + + def raw (v : α → Q) : A R α →ₗ[R] Q := + ((TrivSqZeroExt.sndHom Q Q).restrictScalars R).comp (jet P N v).toLinearMap + + @[simp] theorem raw_atom (v : α → Q) (a : α) : raw P N v (atom a)=v a := by + change (jet P N v (atom a)).snd=v a + rw [jet_atom] + rfl + @[simp] theorem raw_one (v : α → Q) : raw P N v 1=0 := by + change (jet P N v 1).snd=0 + rw [map_one,TrivSqZeroExt.snd_one] + theorem raw_mul (v : α → Q) (p q : A R α) : + raw P N v (p*q)=quotient P N p*raw P N v q+raw P N v p*quotient P N q := by + change (jet P N v (p*q)).snd=_ + rw [map_mul,TrivSqZeroExt.snd_mul,fst_jet,fst_jet] + rfl + + theorem raw_word_mem (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) (w : FreeMonoid α) : + raw P N v (word w)∈F (degree wt w+k) := by + induction w using FreeMonoid.inductionOn' with + | one => simp only [word_one,raw_one]; exact Submodule.zero_mem _ + | of_mul a w ih => + rw [word_mul,word_of,raw_mul,raw_atom,degree_mul,degree_of] + change _∈F (1+degree wt w+k) + apply Submodule.add_mem + · simpa only [Nat.add_assoc,wt,gen] using filtration_mul P N 1 _ (gen_mem P N a) ih + · have hm : quotient P N (word w)∈F (degree wt w) := ⟨word w,word_mem w le_rfl,rfl⟩ + simpa only [show k+1+degree wt w=1+degree wt w+k by omega] using + filtration_mul P N (k+1) _ (hv a) hm + + theorem raw_mem (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + {n : ℕ} {p : A R α} (hp : p∈above wt n) : raw P N v p∈F (n+k) := + map_space (raw P N v) _ (fun w hw => + filtration_antitone P N (Nat.add_le_add_right hw k) (raw_word_mem P N k v hv w)) hp + + def descend (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) : Q →ₐ[R] TrivSqZeroExt Q Q := + RingQuot.liftAlgHom R ⟨jet P N v,by + rintro p q ⟨rfl,hp⟩ + rw [map_zero] + apply TrivSqZeroExt.ext + · rw [fst_jet] + rcases hp with hp|hp + · exact quotient_relation P N hp + · exact quotient_above P N hp + · change raw P N v p=0 + rcases hp with hp|hp + · exact hP p hp + · have hh := filtration_antitone P N (Nat.le_add_right (N+1) k) (raw_mem P N k v hv hp) + simpa only [filtration_terminal,Submodule.mem_bot] using hh⟩ + + @[simp] theorem descend_quotient (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) (p : A R α) : + descend P N k v hv hP (quotient P N p)=jet P N v p := by + simp only [descend,quotient,RingQuot.liftAlgHom_mkAlgHom_apply] + + theorem descend_fst (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) (p : Q) : (descend P N k v hv hP p).fst=p := by + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective R (relations P N) p + rw [←quotient,descend_quotient,fst_jet] + + def derivation (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) : Module.End R Q := + ((TrivSqZeroExt.sndHom Q Q).restrictScalars R).comp (descend P N k v hv hP).toLinearMap + + @[simp] theorem derivation_quotient (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) (p : A R α) : + derivation P N k v hv hP (quotient P N p)=raw P N v p := by + change (descend P N k v hv hP (quotient P N p)).snd=_ + rw [descend_quotient] + rfl + + @[simp] theorem derivation_one (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) : derivation P N k v hv hP 1=0 := by + rw [←map_one (quotient P N),derivation_quotient,raw_one] + + theorem derivation_mul (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) (p q : Q) : + derivation P N k v hv hP (p*q)=derivation P N k v hv hP p*q+p*derivation P N k v hv hP q := by + change (descend P N k v hv hP (p*q)).snd=_ + rw [map_mul,TrivSqZeroExt.snd_mul,descend_fst,descend_fst] + exact add_comm _ _ + + theorem derivation_mem (k : ℕ) (v : α → Q) (hv : ∀ a,v a∈F (k+1)) + (hP : ∀ p∈P,raw P N v p=0) {n : ℕ} {p : Q} (hp : p∈F n) : + derivation P N k v hv hP p∈F (n+k) := by + obtain ⟨p,hp,rfl⟩ := hp + change derivation P N k v hv hP (quotient P N p)∈_ + rw [derivation_quotient] + exact raw_mem P N k v hv hp + +end TruncatedDerivation + +namespace CutoffCategory +open AssociativeElimination WordGrading TruncatedWords +variable {α O : Type*} (P : Set (A ℝ α)) (N : ℕ) + + theorem initial : (TruncatedWords.filtration P N) 0=⊤ := by + apply top_unique + intro a _ + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective ℝ (relations P N) a + exact ⟨p,TruncatedFree.all_ge_zero p,rfl⟩ + + def filtration : FilteredComparison.Filtration ℝ (TruncatedWords.Q P N) N where + step := (TruncatedWords.filtration P N) + decreasing := filtration_antitone P N + initial := initial P N + terminal := filtration_terminal P N + + variable (d : Module.End ℝ (TruncatedWords.Q P N)) (hd : ∀ a b,d (a*b)=d a*b+a*d b) (h1 : d 1=0) + (h : O → (TruncatedWords.Q P N)) + + abbrev data : CategoryExp.Data ℝ (TruncatedWords.Q P N) O := CategoryExp.gauge d hd h1 h + + theorem apply (p q : O) (a : (TruncatedWords.Q P N)) : (data P N d hd h1 h).D p q a=d a+h q*a-a*h p := rfl + + theorem one (p q : O) : (data P N d hd h1 h).D p q 1=h q-h p := by + rw [apply,h1,zero_add,mul_one,one_mul] + + theorem raises (k : ℕ) (hdF : ∀ n a,a∈(TruncatedWords.filtration P N) n → d a∈(TruncatedWords.filtration P N) (n+k)) (hhF : ∀ p,h p∈(TruncatedWords.filtration P N) k) + (p q : O) (n : ℕ) (a : (TruncatedWords.Q P N)) (ha : a∈(TruncatedWords.filtration P N) n) : (data P N d hd h1 h).D p q a∈(TruncatedWords.filtration P N) (n+k) := by + rw [apply] + apply Submodule.sub_mem + · apply Submodule.add_mem + · exact hdF n a ha + · simpa only [Nat.add_comm k n] using filtration_mul P N k n (hhF q) ha + · exact filtration_mul P N n k ha (hhF p) + + theorem nilpotent (k : ℕ) (hk : 0 (TruncatedWords.filtration ∅ N m).restrictScalars ℚ) + (TruncatedWords.filtration_antitone ∅ N) h0 (TruncatedWords.filtration_mul ∅ N) + (ConjugateComparison.theta_raises N _ _ _ _) (frames_weight N) p q m a ha + theorem raises (N : ℕ) (p q : Bool) (m : ℕ) (a : Q ℝ N) + (ha : a∈TruncatedWords.filtration ∅ N m) : D N p q a∈TruncatedWords.filtration ∅ N (m+1) := + RealOperatorLog.raises (CutoffCategory.filtration ∅ N) (N+1) (S N p q-1) (S_raises N p q) m a ha + theorem nilpotent (N : ℕ) (p q : Bool) : IsNilpotent (D N p q) := + CategoryExp.nilpotent (CutoffCategory.filtration ∅ N) (D N p q) (raises N p q) + theorem exp_eq (N : ℕ) (p q : Bool) : IsNilpotent.exp (D N p q)=S N p q := by + have hn : (S N p q-1)^(N+1+1)=0 := by + apply LinearMap.ext + intro a + have h := LinearMap.congr_fun ((category N).nilpotent p q) a + have hr : (S N p q-1).restrictScalars ℚ=(category N).S p q-1 := by + apply LinearMap.ext + intro a + change S N p q a-a=(category N).S p q a-a + rw [←S_restrict] + rfl + rw [←hr,RealOperatorLog.pow_restrict] at h + exact h + rw [D,RealOperatorLog.exp_logarithm (N+1) _ hn (nilpotent N p q)] + abel + theorem exp_comparison (N : ℕ) : + IsNilpotent.exp (D N false true) (positive N:Q ℝ N)=(negative N:Q ℝ N) := by + rw [exp_eq,S_apply] + simpa only [frames,inv_one,Units.val_one,mul_one] using exact_comparison N + theorem loop_x (N : ℕ) : D N false false (X N)=0 := by + rw [D_apply] + apply OperatorLog.logarithm_fixed + change (category N).S false false (X N)-X N=0 + rw [←S_restrict] + change S N false false (X N)-X N=0 + simp only [S_apply,frames,Units.val_one,inv_one,mul_one,one_mul,theta_x,sub_self] + theorem loop_y (N : ℕ) : D N true true (Y N)=0 := by + rw [D_apply] + apply OperatorLog.logarithm_fixed + change (category N).S true true (Y N)-Y N=0 + rw [←S_restrict] + change S N true true (Y N)-Y N=0 + simp only [S_apply,frames,theta_y,mul_assoc,Units.mul_inv_cancel_left,Units.mul_inv,mul_one,sub_self] + theorem loop_false_y (N : ℕ) : + D N false false (Y N)=Y N*KZComparison.value N-KZComparison.value N*Y N := by + have hh := LogCategory.delta_formula (category N) false true true (Y N) + rw [←D_apply,loop_y] at hh + rw [←D_apply N false false] at hh + change 0=D N false false (Y N)+KZComparison.value N*Y N-Y N*KZComparison.value N at hh + apply eq_sub_iff_add_eq.mpr + have hh' : D N false false (Y N)+KZComparison.value N*Y N=Y N*KZComparison.value N := sub_eq_zero.mp hh.symm + exact hh' + theorem edge_formula (N : ℕ) (a : Q ℝ N) : + D N false true a=D N false false a+KZComparison.value N*a := by + rw [D_apply,LogCategory.delta_formula (category N) false,LogCategory.delta_one_loop,mul_zero,sub_zero,←D_apply] + rfl +end KZRealLog + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Ordering.lean b/lean/OAI/Algebra/Drinfeld/Ordering.lean new file mode 100644 index 0000000000000000000000000000000000000000..495c2776be3acc5315b7de556e1709fce7160488 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Ordering.lean @@ -0,0 +1,3033 @@ +import OAI.Algebra.Drinfeld.Foundations + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld +namespace WordGrading +open AssociativeElimination +variable {R α β : Type*} [CommRing R] +variable (f : A R α →ₐ[R] A R β) (wa : α → ℕ) (wb : β → ℕ) + +theorem algHom_homogeneous (hf : ∀ a,f (atom a)∈homogeneous wb (wa a)) + {n : ℕ} {p : A R α} (hp : p∈homogeneous wa n) : f p∈homogeneous wb n := by + have hw (w : FreeMonoid α) : f (word w)∈homogeneous wb (degree wa w) := by + induction w using FreeMonoid.inductionOn' with + | one => + rw [word_one,map_one,degree_one] + exact word_mem (1 : FreeMonoid β) (degree_one wb) + | of_mul a w ih => + simp only [word_mul,word_of,map_mul,degree_mul,degree_of] + exact homogeneous_mul (hf a) ih + apply map_space f.toLinearMap _ ?_ hp + intro w h + change f (word w)∈homogeneous wb n + rw [← h] + exact hw w + +theorem algHom_above (hf : ∀ a,f (atom a)∈above wb (wa a)) + {n : ℕ} {p : A R α} (hp : p∈above wa n) : f p∈above wb n := by + have hw (w : FreeMonoid α) : f (word w)∈above wb (degree wa w) := by + induction w using FreeMonoid.inductionOn' with + | one => + rw [word_one,map_one,degree_one] + exact word_mem (1 : FreeMonoid β) (by simp) + | of_mul a w ih => + simp only [word_mul,word_of,map_mul,degree_mul,degree_of] + exact above_mul (hf a) ih + apply map_space f.toLinearMap _ ?_ hp + intro w hn + exact space_mono (by intro v hv; change n≤degree wa w at hn; change degree wa w≤degree wb v at hv; omega) (hw w) + +theorem algHom_below (hf : ∀ a,f (atom a)∈below wb (wa a)) + {n : ℕ} {p : A R α} (hp : p∈below wa n) : f p∈below wb n := by + have hw (w : FreeMonoid α) : f (word w)∈below wb (degree wa w) := by + induction w using FreeMonoid.inductionOn' with + | one => + rw [word_one,map_one,degree_one] + exact word_mem (1 : FreeMonoid β) (by simp) + | of_mul a w ih => + simp only [word_mul,word_of,map_mul,degree_mul,degree_of] + exact below_mul (hf a) ih + apply map_space f.toLinearMap _ ?_ hp + intro w hn + exact space_mono (by intro v hv; change degree wa w≤n at hn; change degree wb v≤degree wa w at hv; omega) (hw w) + +end WordGrading +namespace PolynomialOrdering +open AssociativeElimination WordGrading +open scoped TensorProduct +variable {R α β γ : Type*} [CommRing R] + +def merge : V (R:=R) (α:=α) (β:=β) →ₗ[R] A R (Sum α β) := + interpret fiberIn baseIn +@[simp] theorem merge_tmul (p : A R α) (q : A R β) : + merge (p⊗ₜ q)=fiberIn p*baseIn q := rfl + +def ordered (δ : β → α → A R α) : A R (Sum α β) →ₗ[R] A R (Sum α β) := + merge.comp (normalize δ) + +theorem normalize_merge (δ : β → α → A R α) (z : V (R:=R) (α:=α) (β:=β)) : + normalize δ (merge z)=z := by + have h : (normalize δ).comp merge=LinearMap.id := by + apply TensorProduct.ext' + intro p q + exact normalize_product δ p q + exact LinearMap.congr_fun h z + +theorem merge_injective : Function.Injective (merge (R:=R) (α:=α) (β:=β)) := + Function.LeftInverse.injective (normalize_merge (fun _ _ => 0)) + +variable (wa : α → ℕ) (wb : β → ℕ) +theorem fiberIn_homogeneous {n : ℕ} {p : A R α} (hp : p∈homogeneous wa n) : + fiberIn (β:=β) p∈homogeneous (Sum.elim wa wb) n := by + apply algHom_homogeneous _ wa _ ?_ hp + intro a + change fiberIn (atom a)∈homogeneous (Sum.elim wa wb) (wa a) + rw [fiberIn,lift_atom] + exact word_mem (FreeMonoid.of (.inl a : Sum α β)) (degree_of (Sum.elim wa wb) (.inl a)) + +theorem baseIn_homogeneous {n : ℕ} {p : A R β} (hp : p∈homogeneous wb n) : + baseIn (α:=α) p∈homogeneous (Sum.elim wa wb) n := by + apply algHom_homogeneous _ wb _ ?_ hp + intro a + change baseIn (atom a)∈homogeneous (Sum.elim wa wb) (wb a) + rw [baseIn,lift_atom] + exact word_mem (FreeMonoid.of (.inr a : Sum α β)) (degree_of (Sum.elim wa wb) (.inr a)) + +theorem merge_word_homogeneous (u : FreeMonoid α) (v : FreeMonoid β) : + merge (word (R:=R) u⊗ₜ word (R:=R) v)∈homogeneous (Sum.elim wa wb) (degree wa u+degree wb v) := by + exact homogeneous_mul (fiberIn_homogeneous wa wb (word_mem u rfl)) + (baseIn_homogeneous wa wb (word_mem v rfl)) + +theorem merge_homogeneous {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} + (hz : z∈TensorGrading.homogeneous wa wb n) : merge z∈homogeneous (Sum.elim wa wb) n := by + apply TensorGrading.map_space merge _ ?_ hz + intro u v h + simpa only [h] using merge_word_homogeneous (R:=R) wa wb u v + +theorem merge_above {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} + (hz : z∈TensorGrading.above wa wb n) : merge z∈above (Sum.elim wa wb) n := by + apply TensorGrading.map_space merge _ ?_ hz + intro u v h + exact space_mono (by intro w hw; change n≤degree wa u+degree wb v at h; change degree (Sum.elim wa wb) w=degree wa u+degree wb v at hw; omega) + (merge_word_homogeneous (R:=R) wa wb u v) + +theorem merge_strictlyBelow {n : ℕ} {z : V (R:=R) (α:=α) (β:=β)} + (hz : z∈TensorGrading.strictlyBelow wa wb n) : merge z∈strictlyBelow (Sum.elim wa wb) n := by + apply TensorGrading.map_space merge _ ?_ hz + intro u v h + exact space_mono (by intro w hw; change degree wa u+degree wb v + rw [word_one,normalize_one,degree_one] + exact TensorGrading.tmul_word_mem 1 1 (by simp) + | of_mul a w ih => + rw [word_mul,word_of,normalize_atom_mul,degree_mul,degree_of] + exact TensorGrading.op_homogeneous hδ a ih + apply WordGrading.map_space (normalize δ) _ ?_ hp + intro w hn + rw [← hn] + exact hw w + +theorem normalize_above (hδ : ∀ b a,δ b a∈above wa (wb b+wa a)) + {n : ℕ} {p : A R (Sum α β)} (hp : p∈above (Sum.elim wa wb) n) : + normalize δ p∈TensorGrading.above wa wb n := by + have hw (w : FreeMonoid (Sum α β)) : normalize δ (word w)∈ + TensorGrading.above wa wb (degree (Sum.elim wa wb) w) := by + induction w using FreeMonoid.inductionOn' with + | one => + rw [word_one,normalize_one,degree_one] + exact TensorGrading.tmul_word_mem 1 1 (by simp) + | of_mul a w ih => + rw [word_mul,word_of,normalize_atom_mul,degree_mul,degree_of] + exact TensorGrading.op_above hδ a ih + apply WordGrading.map_space (normalize δ) _ ?_ hp + intro w hn + exact TensorGrading.space_mono (by intro u v huv; change n≤degree (Sum.elim wa wb) w at hn; change degree (Sum.elim wa wb) w≤degree wa u+degree wb v at huv; omega) (hw w) + +theorem normalize_strictlyBelow (hδ : ∀ b a,δ b a∈below wa (wb b+wa a)) + {n : ℕ} {p : A R (Sum α β)} (hp : p∈strictlyBelow (Sum.elim wa wb) n) : + normalize δ p∈TensorGrading.strictlyBelow wa wb n := by + have hw (w : FreeMonoid (Sum α β)) : normalize δ (word w)∈ + TensorGrading.below wa wb (degree (Sum.elim wa wb) w) := by + induction w using FreeMonoid.inductionOn' with + | one => + rw [word_one,normalize_one,degree_one] + exact TensorGrading.tmul_word_mem 1 1 (by simp) + | of_mul a w ih => + rw [word_mul,word_of,normalize_atom_mul,degree_mul,degree_of] + exact TensorGrading.op_below hδ a ih + apply WordGrading.map_space (normalize δ) _ ?_ hp + intro w hn + exact TensorGrading.space_mono (by intro u v huv; change degree (Sum.elim wa wb) w atom (e a)) +@[simp] theorem map_atom (e : α → β) (a : α) : map (R:=R) e (atom a)=atom (e a) := lift_atom _ _ +theorem map_inverse (e : α ≃ β) (p : A R α) : map e.symm (map e p)=p := by + have h : (map (R:=R) e.symm).comp (map e)=AlgHom.id R (A R α) := by + apply hom_ext + intro a + simp + exact AlgHom.congr_fun h p + +theorem map_homogeneous (e : α → β) (wa : α → ℕ) (wb : β → ℕ) + (he : ∀ a,wb (e a)=wa a) {n : ℕ} {p : A R α} (hp : p∈homogeneous wa n) : + map e p∈homogeneous wb n := by + apply algHom_homogeneous _ wa wb _ hp + intro a + rw [map_atom] + exact word_mem (FreeMonoid.of (e a)) (by simp [he]) + +theorem map_above (e : α → β) (wa : α → ℕ) (wb : β → ℕ) + (he : ∀ a,wb (e a)=wa a) {n : ℕ} {p : A R α} (hp : p∈above wa n) : + map e p∈above wb n := by + apply algHom_above _ wa wb _ hp + intro a + rw [map_atom] + exact word_mem (FreeMonoid.of (e a)) (by simp [he]) + +theorem map_below (e : α → β) (wa : α → ℕ) (wb : β → ℕ) + (he : ∀ a,wb (e a)=wa a) {n : ℕ} {p : A R α} (hp : p∈below wa n) : + map e p∈below wb n := by + apply algHom_below _ wa wb _ hp + intro a + rw [map_atom] + exact word_mem (FreeMonoid.of (e a)) (by simp [he]) + +theorem map_strictlyBelow (e : α → β) (wa : α → ℕ) (wb : β → ℕ) + (he : ∀ a,wb (e a)=wa a) {n : ℕ} {p : A R α} (hp : p∈strictlyBelow wa n) : + map e p∈strictlyBelow wb n := by + apply map_space (map e).toLinearMap _ ?_ hp + intro w hw + exact space_mono (by intro v hv; change degree wb v=degree wa w at hv; change degree wa w 1 | .inl 1 => 2 | .inl 2 => 3 | .inr _ => 0 +def fromOld : Old → E | 0 => .inr () | 1 => .inl 0 | 2 => .inl 1 | 3 => .inl 2 +def equiv : E ≃ Old where + toFun := toOld + invFun := fromOld + left_inv s := by cases s with + | inl a => fin_cases a <;> rfl + | inr a => cases a; rfl + right_inv a := by fin_cases a <;> rfl + +def fc : F → ℕ | 1 => 1 | _ => 0 +def bc : B → ℕ := fun _ => 0 +def count : E → ℕ := Sum.elim fc bc + +theorem count_toOld (s : E) : CountTables.baseCount (toOld s)=count s := by + cases s with + | inl a => fin_cases a <;> rfl + | inr a => rfl + +theorem count_fromOld (a : Old) : count (fromOld a)=CountTables.baseCount a := by + fin_cases a <;> rfl + +def outward : A K E →ₐ[K] A K Old := AlphabetTransport.map toOld +def inward : A K Old →ₐ[K] A K E := AlphabetTransport.map fromOld +@[simp] theorem outward_inward (p : A K Old) : outward (inward p)=p := + AlphabetTransport.map_inverse equiv.symm p +@[simp] theorem inward_outward (p : A K E) : inward (outward p)=p := + AlphabetTransport.map_inverse equiv p + +def H : A K F := atom 0 +def U : A K F := atom 1 +def V : A K F := atom 2 +abbrev bracket := @CountTables.bracket +def common (_ : B) : F → A K F + | 0 | 2 => bracket H V + | 1 => bracket (H+V) U +def higher (_ : B) : F → A K F + | 0 => bracket (bracket H U) U + | 2 => bracket (bracket V U) U + | _ => 0 +def source (b : B) (a : F) := common b a+higher b a + +theorem H_homo : H∈homogeneous fc 0 := word_mem (FreeMonoid.of 0) rfl +theorem U_homo : U∈homogeneous fc 1 := word_mem (FreeMonoid.of 1) rfl +theorem V_homo : V∈homogeneous fc 0 := word_mem (FreeMonoid.of 2) rfl +theorem bracket_homo {n m : ℕ} {p q : A K F} + (hp : p∈homogeneous fc n) (hq : q∈homogeneous fc m) : + bracket p q∈homogeneous fc (n+m) := by + apply (homogeneous fc (n+m)).sub_mem (homogeneous_mul hp hq) + simpa only [Nat.add_comm] using homogeneous_mul hq hp + +theorem common_homo (b : B) (a : F) : common b a∈homogeneous fc (bc b+fc a) := by + fin_cases a + · exact bracket_homo H_homo V_homo + · exact bracket_homo ((homogeneous fc 0).add_mem H_homo V_homo) U_homo + · exact bracket_homo H_homo V_homo + +theorem higher_homo (b : B) (a : F) : higher b a∈homogeneous fc (bc b+fc a+2) := by + fin_cases a + · have h := bracket_homo (bracket_homo H_homo U_homo) U_homo + exact h + · exact (homogeneous fc _).zero_mem + · have h := bracket_homo (bracket_homo V_homo U_homo) U_homo + exact h + +theorem source_above (b : B) (a : F) : source b a∈above fc (bc b+fc a) := by + apply (above fc _).add_mem (homogeneous_above (common_homo b a)) + exact space_mono (by intro w hw; change degree fc w=bc b+fc a+2 at hw; omega) (higher_homo b a) +theorem source_difference (b : B) (a : F) : source b a-common b a∈above fc (bc b+fc a+1) := by + rw [source,add_sub_cancel_left] + exact space_mono (by intro w hw; change degree fc w=bc b+fc a+2 at hw; omega) (higher_homo b a) + +def order (δ : B → F → A K F) : A K Old →ₗ[K] A K Old := + outward.toLinearMap.comp ((ordered δ).comp inward.toLinearMap) + +theorem order_common_homogeneous (n : ℕ) (p : A K Old) + (hp : p∈homogeneous CountTables.baseCount n) : order common p∈homogeneous CountTables.baseCount n := by + apply AlphabetTransport.map_homogeneous toOld count _ count_toOld + apply merge_homogeneous fc bc + apply normalize_homogeneous fc bc common_homo + exact AlphabetTransport.map_homogeneous fromOld _ count count_fromOld hp + +theorem order_source_above (n : ℕ) (p : A K Old) + (hp : p∈above CountTables.baseCount n) : order source p∈above CountTables.baseCount n := by + apply AlphabetTransport.map_above toOld count _ count_toOld + apply merge_above fc bc + apply normalize_above fc bc source_above + exact AlphabetTransport.map_above fromOld _ count count_fromOld hp + +theorem order_difference (n : ℕ) (p : A K Old) + (hp : p∈homogeneous CountTables.baseCount n) : + order source p-order common p∈above CountTables.baseCount (n+1) := by + change outward (ordered source (inward p))-outward (ordered common (inward p))∈_ + rw [← map_sub] + apply AlphabetTransport.map_above toOld count _ count_toOld + exact (ordered_comparison_above fc bc common_homo source_above source_difference + (AlphabetTransport.map_homogeneous fromOld _ count count_fromOld hp)).2 + +theorem order_common_below (n : ℕ) (p : A K Old) + (hp : p∈below CountTables.baseCount n) : order common p∈below CountTables.baseCount n := by + apply map_space (order common) _ ?_ hp + intro w hw + exact space_mono (by intro v hv; change degree CountTables.baseCount v=degree CountTables.baseCount w at hv; change degree CountTables.baseCount w≤n at hw; omega) + (order_common_homogeneous _ _ (word_mem w rfl)) + +end SecondStage +namespace ExactCountOrdering +open AssociativeElimination WordGrading PolynomialOrdering +abbrev K := ZMod 2 +abbrev E := Sum CountTables.F CountTables.B +def count : E → ℕ := Sum.elim CountTables.fiberCount CountTables.baseCount +def S : A K E →ₗ[K] A K E := iterated CountTables.source (SecondStage.order SecondStage.source) +def C : A K E →ₗ[K] A K E := iterated CountTables.common (SecondStage.order SecondStage.common) +def T : A K E →ₗ[K] A K E := iterated CountTables.target (SecondStage.order SecondStage.common) + +theorem source_comparison {n : ℕ} {p : A K E} (hp : p∈homogeneous count n) : + C p∈homogeneous count n ∧ S p-C p∈above count (n+1) := + iterated_comparison_above CountTables.fiberCount CountTables.baseCount _ _ + SecondStage.order_common_homogeneous SecondStage.order_source_above SecondStage.order_difference + CountTables.common_homo CountTables.source_above CountTables.source_difference hp + +theorem target_comparison {n : ℕ} {p : A K E} (hp : p∈homogeneous count n) : + C p∈homogeneous count n ∧ T p-C p∈strictlyBelow count n := by + apply iterated_comparison_below CountTables.fiberCount CountTables.baseCount _ _ + SecondStage.order_common_homogeneous SecondStage.order_common_below _ + CountTables.common_homo CountTables.target_below CountTables.target_difference hp + intro m q _ + rw [sub_self] + exact (strictlyBelow CountTables.baseCount _).zero_mem + +theorem source_above {n : ℕ} {p : A K E} (hp : p∈above count n) : S p∈above count n := + iterated_above CountTables.fiberCount CountTables.baseCount _ SecondStage.order_source_above + CountTables.source_above hp + +theorem transfer (n : ℕ) (p e : A K E) (hp : p∈homogeneous count n) + (he : e∈above count (n+1)) (hzero : S (p+e)=0) : + C p=0 ∧ T p∈strictlyBelow count n := by + obtain ⟨hC,hS⟩ := source_comparison hp + exact count_transfer count S C T n p e hC hS (target_comparison hp).2 (source_above he) hzero +end ExactCountOrdering + +namespace PolynomialOrdering +open AssociativeElimination +open scoped TensorProduct +variable {R α β U : Type*} [CommRing R] [Ring U] [Algebra R U] +variable (f : A R α →ₐ[R] U) (g : A R β →ₐ[R] U) + +@[simp] theorem evaluate_fiber (p : A R α) : evaluate f g (fiberIn p)=f p := by + have h : (evaluate f g).comp fiberIn=f := by + apply hom_ext + intro a + simp [evaluate,fiberIn] + exact AlgHom.congr_fun h p + +@[simp] theorem evaluate_base (p : A R β) : evaluate f g (baseIn p)=g p := by + have h : (evaluate f g).comp baseIn=g := by + apply hom_ext + intro a + simp [evaluate,baseIn] + exact AlgHom.congr_fun h p + +theorem evaluate_merge (z : V (R:=R) (α:=α) (β:=β)) : + evaluate f g (merge z)=interpret f g z := by + have h : (evaluate f g).toLinearMap.comp merge=interpret f g := by + apply TensorProduct.ext' + intro p q + simp + exact LinearMap.congr_fun h z + +theorem evaluate_ordered (δ : β → α → A R α) + (hδ : ∀ b a,g (atom b)*f (atom a)-f (atom a)*g (atom b)=f (δ b a)) + (p : A R (Sum α β)) : evaluate f g (ordered δ p)=evaluate f g p := by + change evaluate f g (merge (normalize δ p))=_ + rw [evaluate_merge,interpret_normalize δ f g hδ] + +theorem evaluate_baseStage (s : A R β →ₗ[R] A R β) (hs : ∀ q,g (s q)=g q) + (z : V (R:=R) (α:=α) (β:=β)) : evaluate f g (baseStage s z)=interpret f g z := by + have h : (evaluate f g).toLinearMap.comp (baseStage s)=interpret f g := by + apply TensorProduct.ext' + intro p q + simp only [LinearMap.comp_apply,AlgHom.toLinearMap_apply,baseStage_tmul,map_mul, + evaluate_fiber,evaluate_base,hs,interpret_tmul] + exact LinearMap.congr_fun h z + +theorem evaluate_iterated (δ : β → α → A R α) + (hδ : ∀ b a,g (atom b)*f (atom a)-f (atom a)*g (atom b)=f (δ b a)) + (s : A R β →ₗ[R] A R β) (hs : ∀ q,g (s q)=g q) + (p : A R (Sum α β)) : evaluate f g (iterated δ s p)=evaluate f g p := by + change evaluate f g (baseStage s (normalize δ p))=_ + rw [evaluate_baseStage f g s hs,interpret_normalize δ f g hδ] + +end PolynomialOrdering + +namespace SourceEnveloping +open AssociativeElimination WordGrading +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 +abbrev Env (α : Type*) := GenericBraid.Env K α +open scoped TensorProduct + +def augment (α : Type*) : Env α →ₐ[K] K := UniversalEnvelopingAlgebra.lift K 0 +instance envCharP (α : Type*) : CharP (Env α) 2 := + charP_of_injective_algebraMap (R:=K) (by + intro a b h + have hh := congrArg (augment α) h + simpa only [AlgHom.commutes,Algebra.algebraMap_self,RingHom.id_apply] using hh) 2 + +theorem fiberIn_injective (α : Type*) [DecidableEq α] : + Function.Injective (GenericBraid.fiberIn (R:=K) (α:=α)) := by + intro p q h + have hh : p⊗ₜ[K] (1 : Env α)=q⊗ₜ[K] (1 : Env α) := by + apply GenericBraid.normal_injective + simpa only [GenericBraid.normal_tmul,map_one,mul_one] using h + have hh' := congrArg (fun z => TensorProduct.rid K (A K α) + (TensorProduct.map LinearMap.id (augment α).toLinearMap z)) hh + simpa only [TensorProduct.map_tmul,LinearMap.id_apply,AlgHom.toLinearMap_apply,map_one, + TensorProduct.rid_tmul,one_smul] using hh' + +@[simp] theorem fiberIn_atom {α : Type*} [DecidableEq α] (a : α) : + GenericBraid.fiberIn (atom a : A K α)= + UniversalEnvelopingAlgebra.ι K (GenericBraid.t none (some a)) := by + simp [GenericBraid.fiberIn] + +@[simp] theorem baseIn_ι {α : Type*} [DecidableEq α] (g : GenericBraid.T K α) : + GenericBraid.baseIn (UniversalEnvelopingAlgebra.ι K g)= + UniversalEnvelopingAlgebra.ι K (GenericBraid.baseLie g) := by + simp [GenericBraid.baseIn] + +def chord {α : Type*} (i j : α) : Env α := UniversalEnvelopingAlgebra.ι K (GenericBraid.t i j) +@[simp] theorem chord_self {α : Type*} (i : α) : chord i i=0 := by simp [chord] +theorem chord_comm {α : Type*} (i j : α) : chord i j=chord j i := by + rw [chord,GenericBraid.t_comm]; rfl + +@[simp] theorem base_chord {α : Type*} [DecidableEq α] (i j : α) : + GenericBraid.baseIn (chord i j)=chord (some i) (some j) := by + change GenericBraid.baseIn (UniversalEnvelopingAlgebra.ι K (GenericBraid.t i j))=_ + rw [baseIn_ι,GenericBraid.baseLie_t] + rfl + +@[simp] theorem fiber_chord {α : Type*} [DecidableEq α] (a : α) : + GenericBraid.fiberIn (atom a : A K α)=chord none (some a) := fiberIn_atom a + +theorem base_fiber_left {α : Type*} [DecidableEq α] (i j : α) : + ⁅chord (some i) (some j),chord none (some i)⁆= + ⁅chord none (some i),chord none (some j)⁆ := by + simp only [chord,← LieHom.map_lie,GenericBraid.t_base_fiber_left] + +theorem base_fiber_right {α : Type*} [DecidableEq α] (i j : α) : + ⁅chord (some i) (some j),chord none (some j)⁆= + ⁅chord none (some j),chord none (some i)⁆ := by + rw [chord_comm (some i) (some j)] + exact base_fiber_left j i + +theorem base_fiber_other {α : Type*} [DecidableEq α] (i j k : α) (hi : k≠i) (hj : k≠j) : + ⁅chord (some i) (some j),chord none (some k)⁆=0 := by + rw [chord,chord,← LieHom.map_lie] + rw [GenericBraid.t_disjoint _ _ _ _ (by simp) + (fun h => hi (Option.some.inj h).symm) (by simp) + (fun h => hj (Option.some.inj h).symm),map_zero] + +end SourceEnveloping +namespace AssociativeAction +open AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +variable {R α U : Type*} [CommRing R] [Ring U] [Algebra R U] +theorem of_atoms (f : A R α →ₐ[R] U) (u : U) (d : α → A R α) + (h : ∀ a,⁅u,f (atom a)⁆=f (d a)) (p : A R α) : + ⁅u,f p⁆=f (deriv d p) := by + induction p using QuadraticAlphabet.algebra_induction with + | h1 => simp [Ring.lie_def,AssociativeElimination.deriv_one] + | ha a => simpa only [deriv_atom] using h a + | hadd p q hp hq => simp only [map_add,lie_add,hp,hq] + | hs r p hp => + rw [map_smul,map_smul,map_smul] + simpa only [Ring.lie_def,mul_smul_comm,smul_mul_assoc,← smul_sub] using congrArg (r • ·) hp + | hm p q hp hq => + simp only [map_mul,AssociativeElimination.deriv_mul,map_add] + rw [← hp,← hq] + simp only [Ring.lie_def] + noncomm_ring + +end AssociativeAction +namespace SourceAlphabet +open AssociativeElimination AlphabetTransport +abbrev K := ZMod 2 +variable {α β : Type*} +theorem map_cancel (f : α → β) (g : β → α) (he : ∀ a,g (f a)=a) (p : A K α) : + map g (map f p)=p := by + have h : (map (R:=K) g).comp (map f)=AlgHom.id K (A K α) := by + apply hom_ext + intro a + simp [he] + exact AlgHom.congr_fun h p + +theorem map_injective (f : α → β) (g : β → α) (he : ∀ a,g (f a)=a) : + Function.Injective (map (R:=K) f) := + Function.LeftInverse.injective (map_cancel f g he) + +def letter5 : CountTables.F ≃ RestrictedAlphabet.Letter (Fin 2) where + toFun a := match a with | 0 => .a | 1 => .b 0 | 2 => .b 1 | 3 => .c 0 | 4 => .c 1 + invFun s := match s with | .a => 0 | .b i => ⟨i.val+1,by omega⟩ | .c i => ⟨i.val+3,by omega⟩ + left_inv a := by fin_cases a <;> rfl + right_inv s := by cases s with + | a => rfl + | b i => fin_cases i <;> rfl + | c i => fin_cases i <;> rfl + +def letter3 : CountTables.G ≃ Option (Fin 2) where + toFun a := match a with | 0 => none | 1 => some 0 | 2 => some 1 + invFun a := match a with | none => 0 | some i => ⟨i.val+1,by omega⟩ + left_inv a := by fin_cases a <;> rfl + right_inv s := by cases s with + | none => rfl + | some i => fin_cases i <;> rfl + +theorem realize_factor : (map (R:=K) letter3).comp CountTables.realize= + RestrictedAlphabet.substitution.comp (map letter5) := by + apply hom_ext + intro a + fin_cases a <;> simp [CountTables.realize,CountTables.X,CountTables.Y,CountTables.C, + CountTables.bracket,letter3,letter5,RestrictedAlphabet.substitution,RestrictedAlphabet.x, + RestrictedAlphabet.y, + Ring.lie_def] + +theorem realize_injective : Function.Injective CountTables.realize := by + intro p q h + apply (map_injective letter5 letter5.symm letter5.symm_apply_apply) + apply RestrictedAlphabet.injective + have he (z) := AlgHom.congr_fun realize_factor z + simp only [AlgHom.comp_apply] at he + rw [← he p,← he q] + exact congrArg (map letter3) h + +end SourceAlphabet +namespace SourceModel +open AssociativeElimination AlphabetTransport SourceEnveloping +open scoped TensorProduct +abbrev K := ZMod 2 +abbrev S1 := Option Unit +abbrev S2 := Option S1 +abbrev S3 := Option S2 + +def swap : S1 ≃ S1 where + toFun | none => some () | some _ => none + invFun | none => some () | some _ => none + left_inv s := by cases s with | none => rfl | some a => cases a; rfl + right_inv s := by cases s with | none => rfl | some a => cases a; rfl + +def smallLetters : SecondStage.F ≃ RestrictedAlphabet.Letter Unit where + toFun | 0 => .a | 1 => .b () | 2 => .c () + invFun | .a => 0 | .b _ => 1 | .c _ => 2 + left_inv a := by fin_cases a <;> rfl + right_inv s := by cases s with | a => rfl | b i => cases i; rfl | c i => cases i; rfl + +def secondRealize : A K SecondStage.F →ₐ[K] A K S1 := + (map swap).comp (RestrictedAlphabet.substitution.comp (map smallLetters)) +theorem secondRealize_injective : Function.Injective secondRealize := + (SourceAlphabet.map_injective swap swap.symm swap.symm_apply_apply).comp + (RestrictedAlphabet.injective.comp + (SourceAlphabet.map_injective smallLetters smallLetters.symm smallLetters.symm_apply_apply)) + +def square : A K Unit →ₐ[K] A K Unit := lift (fun _ => atom ()*atom ()) +theorem square_injective : Function.Injective square := by + intro p q h + apply SourceAlphabet.map_injective (fun _ : Unit => (0 : SecondStage.F)) (fun _ => ()) + (by intro a; cases a; rfl) + apply secondRealize_injective + have he : secondRealize.comp (map (fun _ : Unit => (0 : SecondStage.F)))= + (map (fun _ : Unit => (some () : S1))).comp square := by + apply hom_ext + intro a + simp [secondRealize,smallLetters,swap,RestrictedAlphabet.substitution, + RestrictedAlphabet.x,square] + have hp := AlgHom.congr_fun he p + have hq := AlgHom.congr_fun he q + simp only [AlgHom.comp_apply] at hp hq + rw [hp,hq,h] + +def tail : A K Unit →ₐ[K] Env S1 := GenericBraid.fiberIn.comp square +theorem tail_injective : Function.Injective tail := fiberIn_injective Unit|>.comp square_injective + +def secondFiber : A K SecondStage.F →ₐ[K] Env S2 := GenericBraid.fiberIn.comp secondRealize +def secondBase : A K Unit →ₐ[K] Env S2 := GenericBraid.baseIn.comp tail + +def secondNormal : (A K SecondStage.F ⊗[K] A K Unit) →ₗ[K] Env S2 := + GenericBraid.normal.comp (TensorProduct.map secondRealize.toLinearMap tail.toLinearMap) +@[simp] theorem secondNormal_tmul (p : A K SecondStage.F) (q : A K Unit) : + secondNormal (p⊗ₜ[K]q)=secondFiber p*secondBase q := rfl + +theorem secondNormal_injective : Function.Injective secondNormal := + GenericBraid.normal_injective.comp (TensorProduct.map_injective_of_flat_flat + secondRealize.toLinearMap tail.toLinearMap secondRealize_injective tail_injective) + +def topLetters : CountTables.G ≃ S2 where + toFun | 0 => some (some ()) | 1 => some none | 2 => none + invFun | none => 2 | some none => 1 | some (some _) => 0 + left_inv a := by fin_cases a <;> rfl + right_inv a := by cases a with + | none => rfl + | some a => cases a with | none => rfl | some a => cases a; rfl + +def topRealize : A K CountTables.F →ₐ[K] A K S2 := + (map topLetters).comp CountTables.realize + +def topFiber : A K CountTables.F →ₐ[K] Env S3 := GenericBraid.fiberIn.comp topRealize + +def tripleNormal : (A K CountTables.F ⊗[K] (A K SecondStage.F ⊗[K] A K Unit)) →ₗ[K] Env S3 := + GenericBraid.normal.comp (TensorProduct.map topRealize.toLinearMap secondNormal) + +theorem tripleNormal_injective : Function.Injective tripleNormal := + GenericBraid.normal_injective.comp (TensorProduct.map_injective_of_flat_flat + topRealize.toLinearMap secondNormal + ((SourceAlphabet.map_injective topLetters topLetters.symm topLetters.symm_apply_apply).comp + SourceAlphabet.realize_injective) secondNormal_injective) + +end SourceModel + +namespace CharTwoAction +attribute [local instance] LieRing.ofAssociativeRing +variable {U : Type*} [Ring U] [CharP U 2] +theorem symm (u v : U) : ⁅u,v⁆=⁅v,u⁆ := by + simp only [Ring.lie_def,CharTwo.sub_eq_add,add_comm] +theorem square (u v : U) : ⁅u*u,v⁆=⁅u,⁅u,v⁆⁆ := by + simp only [Ring.lie_def,CharTwo.sub_eq_add,mul_add,add_mul,mul_assoc] + have h : u*(u*v)+v*(u*u)+(u*(v*u)+u*(v*u))= + u*(u*v)+u*(v*u)+(u*(v*u)+v*(u*u)) := by abel + simpa only [CharTwo.add_self_eq_zero,add_zero] using h +end CharTwoAction + +namespace SourceModel + +section +open AssociativeElimination AlphabetTransport SourceEnveloping +attribute [local instance] LieRing.ofAssociativeRing + +def root : S2 := some (some ()) +def one : S2 := some none +def two : S2 := none +def oldX : Fin 2 → Env S2 | 0 => SourceEnveloping.chord root one | 1 => SourceEnveloping.chord root two +def oldU : Env S2 := SourceEnveloping.chord one two + +def rawFiber : A K CountTables.G →ₐ[K] Env S3 := + GenericBraid.fiberIn.comp (map topLetters) +def baseX (i : Fin 2) : Env S3 := GenericBraid.baseIn (oldX i) +def baseU : Env S3 := GenericBraid.baseIn oldU + +@[simp] theorem rawFiber_atom (a : CountTables.G) : + rawFiber (atom a)=SourceEnveloping.chord none (some (topLetters a)) := by + change GenericBraid.fiberIn (AlphabetTransport.map topLetters (atom a))=_ + rw [map_atom] + exact fiber_chord _ +@[simp] theorem rawFiber_X : rawFiber CountTables.X=SourceEnveloping.chord none (some root) := by + simp [CountTables.X,topLetters,root] +@[simp] theorem rawFiber_Y (i : Fin 2) : + rawFiber (CountTables.Y i)=SourceEnveloping.chord none (some (if i=0 then one else two)) := by + fin_cases i <;> simp [CountTables.Y,topLetters,one,two] +@[simp] theorem rawFiber_C (i : Fin 2) : + rawFiber (CountTables.C i)=⁅rawFiber CountTables.X,rawFiber (CountTables.Y i)⁆ := by + simp [CountTables.C,CountTables.bracket,Ring.lie_def] + +@[simp] theorem baseX_zero : baseX 0=SourceEnveloping.chord (some root) (some one) := by simp [baseX,oldX] +@[simp] theorem baseX_one : baseX 1=SourceEnveloping.chord (some root) (some two) := by simp [baseX,oldX] +@[simp] theorem baseU_eq : baseU=SourceEnveloping.chord (some one) (some two) := by simp [baseU,oldU] + +theorem raw_delta_atoms (i : Fin 2) (a : CountTables.G) : + ⁅baseX i,rawFiber (atom a)⁆=rawFiber (CountTables.δ i (atom a)) := by + fin_cases i <;> fin_cases a <;> + simp [CountTables.δ,topLetters] + · exact base_fiber_left root one + · exact (base_fiber_right root one).trans (CharTwoAction.symm _ _) + · exact base_fiber_other root one two (by decide) (by decide) + · exact base_fiber_left root two + · exact base_fiber_other root two one (by decide) (by decide) + · exact (base_fiber_right root two).trans (CharTwoAction.symm _ _) + +theorem raw_delta (i : Fin 2) (p : A K CountTables.G) : + ⁅baseX i,rawFiber p⁆=rawFiber (CountTables.δ i p) := by + exact AssociativeAction.of_atoms rawFiber (baseX i) _ + (fun a => by simpa only [CountTables.δ,deriv_atom] using raw_delta_atoms i a) p + +theorem raw_epsilon_atoms (a : CountTables.G) : + ⁅baseU,rawFiber (atom a)⁆=rawFiber (CountTables.ε (atom a)) := by + fin_cases a <;> + simp [CountTables.ε,CountTables.bracket,topLetters] + · exact base_fiber_other one two root (by decide) (by decide) + · exact base_fiber_left one two + · exact (base_fiber_right one two).trans (CharTwoAction.symm _ _) + +theorem raw_epsilon (p : A K CountTables.G) : + ⁅baseU,rawFiber p⁆=rawFiber (CountTables.ε p) := by + exact AssociativeAction.of_atoms rawFiber baseU _ + (fun a => by simpa only [CountTables.ε,deriv_atom] using raw_epsilon_atoms a) p + +def oldBase : A K CountTables.B →ₐ[K] Env S2 := lift (fun b => match b with + | 0 => oldX 0*oldX 0 + | 1 => oldX 1*oldX 1 + | 2 => oldU + | _ => ⁅oldX 0,oldU⁆) +def topBase : A K CountTables.B →ₐ[K] Env S3 := GenericBraid.baseIn.comp oldBase + +theorem baseDeriv_action (b : CountTables.B) (p : A K CountTables.G) : + ⁅topBase (atom b),rawFiber p⁆=rawFiber (CountTables.baseDeriv b p) := by + fin_cases b + · change ⁅topBase (atom 0),rawFiber p⁆=rawFiber (CountTables.δ 0 (CountTables.δ 0 p)) + have h : topBase (atom 0)=baseX 0*baseX 0 := by simp [topBase,oldBase,baseX] + rw [h,CharTwoAction.square,raw_delta,raw_delta] + · change ⁅topBase (atom 1),rawFiber p⁆=rawFiber (CountTables.δ 1 (CountTables.δ 1 p)) + have h : topBase (atom 1)=baseX 1*baseX 1 := by simp [topBase,oldBase,baseX] + rw [h,CharTwoAction.square,raw_delta,raw_delta] + · change ⁅topBase (atom 2),rawFiber p⁆=rawFiber (CountTables.ε p) + have h : topBase (atom 2)=baseU := by simp [topBase,oldBase,baseU] + rw [h,raw_epsilon] + · change ⁅topBase (atom 3),rawFiber p⁆=rawFiber (CountTables.δ 0 (CountTables.ε p)-CountTables.ε (CountTables.δ 0 p)) + have h : topBase (atom 3)=⁅baseX 0,baseU⁆ := by simp [topBase,oldBase,baseU,baseX,Ring.lie_def] + rw [h,lie_lie,raw_epsilon,raw_delta,raw_delta,raw_epsilon] + change _=rawFiber (CountTables.δ 0 (CountTables.ε p)-CountTables.ε (CountTables.δ 0 p)) + rw [map_sub] + +theorem topFiber_eq (p : A K CountTables.F) : topFiber p=rawFiber (CountTables.realize p) := rfl + +theorem top_action (b : CountTables.B) (a : CountTables.F) : + topBase (atom b)*topFiber (atom a)-topFiber (atom a)*topBase (atom b)= + topFiber (CountTables.source b a) := by + change ⁅topBase (atom b),topFiber (atom a)⁆=topFiber (CountTables.source b a) + rw [topFiber_eq,baseDeriv_action,CountTables.source_realization,← topFiber_eq] + +end + +section +open AssociativeElimination AlphabetTransport SourceEnveloping +attribute [local instance] LieRing.ofAssociativeRing + +def smallX : A K S1 := atom (some ()) +def smallY : A K S1 := atom none +def smallD : Module.End K (A K S1) := deriv (fun _ => ⁅smallX,smallY⁆) +def squash : A K CountTables.G →ₐ[K] A K S1 := lift (fun a => match a with + | 0 => smallX | 1 => smallY | _ => 0) + +theorem squash_delta (p : A K CountTables.G) : + squash (CountTables.δ 0 p)=smallD (squash p) := by + induction p using QuadraticAlphabet.algebra_induction with + | h1 => simp [CountTables.δ,smallD] + | ha a => + fin_cases a <;> + simp [CountTables.δ,CountTables.C,CountTables.X,CountTables.Y,CountTables.bracket, + squash,smallD,smallX,smallY,Ring.lie_def] + | hadd p q hp hq => simp only [map_add,hp,hq] + | hs r p hp => simp only [map_smul,hp] + | hm p q hp hq => + simp only [CountTables.δ,AssociativeElimination.deriv_mul,map_add,map_mul] at hp hq ⊢ + rw [hp,hq] + exact (AssociativeElimination.deriv_mul _ _ _).symm + +def smallIndex : SecondStage.F → CountTables.F | 0 => 0 | 1 => 1 | 2 => 3 + +theorem secondRealize_factor : secondRealize= + squash.comp (CountTables.realize.comp (map smallIndex)) := by + apply hom_ext + intro a + fin_cases a <;> + simp [secondRealize,smallLetters,swap,RestrictedAlphabet.substitution,RestrictedAlphabet.x, + RestrictedAlphabet.y,smallIndex,CountTables.realize,CountTables.X,CountTables.Y, + CountTables.C,CountTables.bracket,squash,smallX,smallY,Ring.lie_def] + +theorem small_source (a : SecondStage.F) : + map smallIndex (SecondStage.source () a)=CountTables.source 0 (smallIndex a) := by + fin_cases a <;> + simp [SecondStage.source,SecondStage.common,SecondStage.higher,SecondStage.H,SecondStage.U, + SecondStage.V,CountTables.source,CountTables.common,CountTables.higher,CountTables.R', + CountTables.H,CountTables.U,CountTables.V,CountTables.Q,CountTables.bracket,smallIndex] <;> noncomm_ring + +theorem second_realization (a : SecondStage.F) : + smallD (smallD (secondRealize (atom a)))=secondRealize (SecondStage.source () a) := by + have hf (p) := AlgHom.congr_fun secondRealize_factor p + simp only [AlgHom.comp_apply] at hf + rw [hf,hf,map_atom,← squash_delta,← squash_delta,small_source] + change squash (CountTables.baseDeriv 0 (CountTables.realize (atom (smallIndex a))))=_ + rw [CountTables.source_realization] + +def smallRaw : A K S1 →ₐ[K] Env S2 := GenericBraid.fiberIn +def smallBase : Env S2 := SourceEnveloping.chord (some none) (some (some ())) + +theorem small_action (p : A K S1) : ⁅smallBase,smallRaw p⁆=smallRaw (smallD p) := by + apply AssociativeAction.of_atoms + intro a + cases a with + | none => + change ⁅smallBase,GenericBraid.fiberIn (atom none)⁆=smallRaw ⁅smallX,smallY⁆ + simpa only [smallBase,smallRaw,smallX,smallY,Ring.lie_def,map_sub,map_mul,fiber_chord] using + (base_fiber_left (none : S1) (some ())).trans (CharTwoAction.symm _ _) + | some a => + cases a + change ⁅smallBase,GenericBraid.fiberIn (atom (some ()))⁆=smallRaw ⁅smallX,smallY⁆ + simpa only [smallBase,smallRaw,smallX,smallY,Ring.lie_def,map_sub,map_mul,fiber_chord] using + base_fiber_right (none : S1) (some ()) + +@[simp] theorem secondBase_atom : secondBase (atom ())=smallBase*smallBase := by + simp only [secondBase,tail,square,AlgHom.comp_apply,lift_atom,map_mul,fiber_chord,base_chord] + rfl + +theorem second_action (b : SecondStage.B) (a : SecondStage.F) : + secondBase (atom b)*secondFiber (atom a)-secondFiber (atom a)*secondBase (atom b)= + secondFiber (SecondStage.source b a) := by + cases b + change ⁅secondBase (atom ()),secondFiber (atom a)⁆=secondFiber (SecondStage.source () a) + rw [secondBase_atom,CharTwoAction.square] + change ⁅smallBase,⁅smallBase,smallRaw (secondRealize (atom a))⁆⁆= + smallRaw (secondRealize (SecondStage.source () a)) + rw [small_action,small_action,second_realization] + +@[simp] theorem secondFiber_H : secondFiber (atom 0)= + SourceEnveloping.chord none (some (some ()))*SourceEnveloping.chord none (some (some ())) := by + simp only [secondFiber,secondRealize,AlgHom.comp_apply,map_atom,smallLetters,Equiv.coe_fn_mk] + simp only [RestrictedAlphabet.substitution,lift_atom,RestrictedAlphabet.x,map_mul,map_atom, + swap,Equiv.coe_fn_mk,fiber_chord] +@[simp] theorem secondFiber_U : secondFiber (atom 1)=SourceEnveloping.chord none (some none) := by + simp only [secondFiber,secondRealize,AlgHom.comp_apply,map_atom,smallLetters,Equiv.coe_fn_mk] + simp only [RestrictedAlphabet.substitution,lift_atom,RestrictedAlphabet.y,map_atom, + swap,Equiv.coe_fn_mk,fiber_chord] +@[simp] theorem secondFiber_V : secondFiber (atom 2)= + ⁅SourceEnveloping.chord none (some (some ())),SourceEnveloping.chord none (some none)⁆ := by + simp only [secondFiber,secondRealize,AlgHom.comp_apply,map_atom,smallLetters,Equiv.coe_fn_mk] + simp only [RestrictedAlphabet.substitution,lift_atom,RestrictedAlphabet.x,RestrictedAlphabet.y, + Ring.lie_def,map_sub,map_mul,map_atom,swap,Equiv.coe_fn_mk,fiber_chord] + +theorem oldX_zero : oldX 0=smallBase := by + exact SourceEnveloping.chord_comm _ _ +theorem oldX_one : oldX 1=SourceEnveloping.chord none (some (some ())) := by + exact SourceEnveloping.chord_comm _ _ +theorem oldU_eq : oldU=SourceEnveloping.chord none (some none) := by + exact SourceEnveloping.chord_comm _ _ + +theorem oldBase_factor : oldBase= + (PolynomialOrdering.evaluate secondFiber secondBase).comp SecondStage.inward := by + apply hom_ext + intro b + fin_cases b <;> simp [oldBase,SecondStage.inward,SecondStage.fromOld, + PolynomialOrdering.evaluate,oldX_zero,oldX_one,oldU_eq] + exact (base_fiber_left (none : S1) (some ())).trans (CharTwoAction.symm _ _) + +end + +open AssociativeElimination PolynomialOrdering +open scoped TensorProduct + +def normal2 : A K CountTables.B →ₗ[K] (A K SecondStage.F ⊗[K] A K Unit) := + (normalize SecondStage.source).comp SecondStage.inward.toLinearMap + +theorem normal2_correct (q : A K CountTables.B) : secondNormal (normal2 q)=oldBase q := by + have h : secondNormal=interpret secondFiber secondBase := by + apply TensorProduct.ext' + intro p q + rfl + rw [h] + change interpret secondFiber secondBase (normalize SecondStage.source (SecondStage.inward q))=_ + rw [interpret_normalize _ _ _ second_action] + exact (AlgHom.congr_fun oldBase_factor q).symm + +def normal3 : A K ExactCountOrdering.E →ₗ[K] + (A K CountTables.F ⊗[K] (A K SecondStage.F ⊗[K] A K Unit)) := + (TensorProduct.map LinearMap.id normal2).comp (normalize CountTables.source) + +@[simp] theorem tripleNormal_tmul (p : A K CountTables.F) + (z : A K SecondStage.F ⊗[K] A K Unit) : + tripleNormal (p⊗ₜ[K]z)=topFiber p*GenericBraid.baseIn (secondNormal z) := rfl + +theorem normal3_correct (q : A K ExactCountOrdering.E) : + tripleNormal (normal3 q)=evaluate topFiber topBase q := by + have h : tripleNormal.comp (TensorProduct.map LinearMap.id normal2)=interpret topFiber topBase := by + apply TensorProduct.ext' + intro p q + simp only [LinearMap.comp_apply,TensorProduct.map_tmul,LinearMap.id_apply, + tripleNormal_tmul,normal2_correct,interpret_tmul] + rfl + change (tripleNormal.comp (TensorProduct.map LinearMap.id normal2)) (normalize CountTables.source q)=_ + rw [h,interpret_normalize _ _ _ top_action] + +def collect2 : (A K SecondStage.F ⊗[K] A K Unit) →ₗ[K] A K CountTables.B := + SecondStage.outward.toLinearMap.comp merge + +def collect3 : (A K CountTables.F ⊗[K] (A K SecondStage.F ⊗[K] A K Unit)) →ₗ[K] + A K ExactCountOrdering.E := merge.comp (TensorProduct.map LinearMap.id collect2) + +theorem collect2_normal2 (q : A K CountTables.B) : + collect2 (normal2 q)=SecondStage.order SecondStage.source q := rfl + +theorem collect3_normal3 (q : A K ExactCountOrdering.E) : + collect3 (normal3 q)=ExactCountOrdering.S q := by + have h : collect3.comp (TensorProduct.map LinearMap.id normal2)= + baseStage (SecondStage.order SecondStage.source) := by + apply TensorProduct.ext' + intro p q + rfl + exact LinearMap.congr_fun h (normalize CountTables.source q) + +theorem source_zero (q : A K ExactCountOrdering.E) + (hq : evaluate topFiber topBase q=0) : ExactCountOrdering.S q=0 := by + have h : normal3 q=0 := by + apply tripleNormal_injective + rw [normal3_correct,hq,map_zero] + rw [← collect3_normal3,h,map_zero] + +end SourceModel + +namespace WeightedDeletion + +section +open AssociativeElimination WordGrading +variable {R α : Type*} [CommRing R] +theorem Step.sublist {κ : α → α → α → R} {r l : α} {s t : List α} + (h : Step κ r l s t) : t.Sublist s := by + induction h with + | head l a s h => exact List.Sublist.cons _ (List.Sublist.refl _) + | tail l a s t h ih => exact List.Sublist.cons_cons _ ih + +theorem op_above (κ : α → α → α → R) (l r : α) + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → wt a≤c) + {n : ℕ} {p : A R α} (hp : p∈above wt n) : op κ l r p∈above wt (n-c) := by + apply map_space (op κ l r) _ ?_ hp + intro w hw + have hr := raw_count_bound κ l r w.toList wt c hc + have he : op κ l r (word w)=raw κ l r w.toList := by + simpa only [FreeMonoid.ofList_toList] using op_word κ l r w.toList + rw [he] + apply space_mono (P:=fun v => count wt w.toList≤c+degree wt v) ?_ hr + intro v hv + change n≤degree wt w at hw + simp only [count,degree] at hv hw ⊢ + omega + +variable {β : Type*} +def action (κ : β → α → α → α → R) (l r : α) : A R β →ₐ[R] Module.End R (A R α) := + lift (fun b => op (κ b) l r) +@[simp] theorem action_atom (κ : β → α → α → α → R) (l r : α) (b : β) : + action κ l r (atom b)=op (κ b) l r := lift_atom _ _ + +theorem action_word_above (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) (hc : ∀ b l a t,κ b l a t≠0 → wt a≤cost b) + (w : FreeMonoid β) {n : ℕ} {p : A R α} (hp : p∈above wt n) : + action κ l r (word w) p∈above wt (n-degree cost w) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa using hp + | of_mul b w ih => + rw [word_mul,word_of,map_mul,action_atom] + change op (κ b) l r (action κ l r (word w) p)∈_ + have h := op_above (κ b) l r wt (cost b) (hc b) ih + simpa only [degree_mul,degree_of,Nat.sub_sub,Nat.add_comm] using h + +theorem test_word_zero (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) (hc : ∀ b l a t,κ b l a t≠0 → wt a≤cost b) + (w : FreeMonoid β) (s : FreeMonoid α) (hs : degree cost w exact h w + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +theorem raw_sub (κ μ : α → α → α → R) (l r : α) (s : List α) : + raw (fun l a b => κ l a b-μ l a b) l r s=raw κ l r s-raw μ l r s := by + induction s generalizing l with + | nil => simp [raw] + | cons a s ih => simp only [raw,ih,sub_smul,mul_sub]; abel + +theorem op_sub (κ μ : α → α → α → R) (l r : α) : + op (fun l a b => κ l a b-μ l a b) l r=op κ l r-op μ l r := by + apply linear_ext + intro w + have h := raw_sub κ μ l r w.toList + simpa only [← op_word,FreeMonoid.ofList_toList,LinearMap.sub_apply] using h + +def cut (κ : β → α → α → α → R) (wt : α → ℕ) (cost : β → ℕ) + (b : β) (l a r : α) : R := if wt a=cost b then κ b l a r else 0 + +theorem cut_bound (κ : β → α → α → α → R) (wt : α → ℕ) (cost : β → ℕ) + (b : β) (l a r : α) (h : cut κ wt cost b l a r≠0) : wt a=cost b := by + by_contra he + exact h (ite_eq_right he) + +theorem diff_bound (κ : β → α → α → α → R) (wt : α → ℕ) (cost : β → ℕ) + (hc : ∀ b l a r,κ b l a r≠0 → wt a≤cost b) + (b : β) (l a r : α) (h : κ b l a r-cut κ wt cost b l a r≠0) : wt a rw [count_cons,hc l a _ h] + | tail l a s t h ih => simp only [count_cons]; omega + +theorem Step.count_strict {κ : α → α → α → R} {r l : α} {s t : List α} + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → wt a simp only [count_cons]; exact Nat.add_lt_add_right (hc l a _ h) _ + | tail l a s t h ih => simp only [count_cons]; omega + +theorem op_homogeneous (κ : α → α → α → R) (l r : α) + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → wt a=c) + {n : ℕ} {p : A R α} (hp : p∈homogeneous wt n) : op κ l r p∈homogeneous wt (n-c) := by + apply map_space (op κ l r) _ ?_ hp + intro w hw + have he : op κ l r (word w)=raw κ l r w.toList := by + simpa only [FreeMonoid.ofList_toList] using op_word κ l r w.toList + rw [he] + apply raw_mem_space + intro t ht + have hb := ht.count_eq wt c hc + change degree wt (FreeMonoid.ofList t)=n-c + change degree wt w=n at hw + simp only [count,degree,FreeMonoid.toList_ofList] at hb hw ⊢ + omega + +theorem op_strict (κ : α → α → α → R) (l r : α) + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → wt a simp only [word_one,map_one,Module.End.one_apply,degree_one,Nat.sub_zero,sub_self]; + exact ⟨hp,(above wt _).zero_mem⟩ + | of_mul b w ih => + have hn' : degree cost w≤n := by + rw [degree_mul,degree_of] at hn + omega + have ih' := ih hn' + have hb : cost b ≤ n-degree cost w := by simp only [degree_mul,degree_of] at hn; omega + have he : n-degree cost w-cost b=n-degree cost (FreeMonoid.of b*w) := by + simp only [degree_mul,degree_of]; omega + have he' : n-degree cost w+1-cost b=n-degree cost (FreeMonoid.of b*w)+1 := by + simp only [degree_mul,degree_of] at hn ⊢; omega + rw [word_mul,word_of,map_mul,map_mul,action_atom,action_atom] + change op (cut κ wt cost b) l r (action (cut κ wt cost) l r (word w) p)∈_ ∧ + op (κ b) l r (action κ l r (word w) p)-op (cut κ wt cost b) l r (action (cut κ wt cost) l r (word w) p)∈_ + constructor + · have h := op_homogeneous (cut κ wt cost b) l r wt (cost b) (cut_bound κ wt cost b) ih'.1 + simpa only [he] using h + · have h1 := op_above (κ b) l r wt (cost b) (hc b) ih'.2 + have h2 := op_strict (fun l a r => κ b l a r-cut κ wt cost b l a r) l r + wt (cost b) (diff_bound κ wt cost hc b) hb ih'.1 + rw [op_sub] at h2 + simp only [LinearMap.sub_apply] at h2 + have hh : op (κ b) l r (action κ l r (word w) p)-op (cut κ wt cost b) l r (action (cut κ wt cost) l r (word w) p)= + op (κ b) l r (action κ l r (word w) p-action (cut κ wt cost) l r (word w) p)+ + (op (κ b) l r (action (cut κ wt cost) l r (word w) p)-op (cut κ wt cost b) l r (action (cut κ wt cost) l r (word w) p)) := by + rw [map_sub]; abel + rw [hh] + apply (above wt _).add_mem + · simpa only [he'] using h1 + · simpa only [he] using h2 + +theorem exact_allocation_test (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) (hc : ∀ b l a t,κ b l a t≠0 → wt a≤cost b) + (w : FreeMonoid β) {p : A R α} (hp : p∈homogeneous wt (degree cost w)) : + (action κ l r (word w) p).coeff 1=(action (cut κ wt cost) l r (word w) p).coeff 1 := by + have h := (exact_allocation κ l r wt cost hc w le_rfl hp).2 + have hz := coeff_support h 1 (by simp [degree_one]) + simpa only [MonoidAlgebra.coeff_sub, Finsupp.sub_apply,sub_eq_zero] using hz +end WeightedDeletion + +namespace RowTwo +open AssociativeElimination WordGrading WeightedDeletion +abbrev K := ZMod 2 +inductive Letter | o | e | p | w deriving DecidableEq +instance : Fintype Letter := ⟨{.o,.e,.p,.w}, by intro x; cases x <;> simp⟩ +inductive Slot | A | C | B deriving DecidableEq +instance : Fintype Slot := ⟨{.A,.C,.B}, by intro x; cases x <;> simp⟩ +open Letter Slot + +def κ : Slot → Letter → Letter → Letter → K + | .A,_,a,b => if a=.e ∧ b=.w then 1 else 0 + | .C,l,a,b => if a=.p then (if l=.e ∨ l=.w then 1 else 0)+(if b=.e ∨ b=.w then 1 else 0) else 0 + | .B,l,a,b => if a=.o then (if l=.p then 1 else 0)+(if b=.p then 1 else 0) else 0 + +def Good (s : List Letter) : Prop := s.Pairwise (fun a b => a=.e → b=.e) + +theorem head_character : ∀ k l a b,κ k l a b≠0 → + (a=.e → b=.w) ∧ (l=.e → b=.e ∨ b=.w → a=.e) := by decide + +theorem head_good (k : Slot) (l a : Letter) (s : List Letter) + (hw : .w∉s) (hk : κ k l a (s.headD .w)≠0) (hg : Good (l::s)) : + Good (l::a::s) := by + have hc := head_character k l a (s.headD .w) hk + by_cases ha : a=.e + · have hs : s=[] := by + cases s with + | nil => rfl + | cons b s => + have hb : b=.w := hc.1 ha + simp only [List.mem_cons,not_or] at hw + exact False.elim (hw.1 hb.symm) + subst s + simp [Good,ha] + · have hl : l≠.e := by + intro hl + apply ha + apply hc.2 hl + cases s with + | nil => exact Or.inr rfl + | cons b s => + left + exact (List.pairwise_cons.mp hg).1 b (by simp) hl + rcases List.pairwise_cons.mp hg with ⟨_,hs⟩ + apply List.pairwise_cons.mpr + refine ⟨?_,List.pairwise_cons.mpr ⟨?_,hs⟩⟩ + · intro b hb he + exact False.elim (hl he) + · intro b hb he + exact False.elim (ha he) + +theorem step_good (k : Slot) {l : Letter} {s t : List Letter} + (h : Step (κ k) .w l s t) (hw : .w∉s) (hg : Good (l::t)) : Good (l::s) := by + induction h with + | head l a s hk => + exact head_good k l a s (fun h => hw (List.mem_cons_of_mem _ h)) hk hg + | tail l a s t hs ih => + have h1 : Good (a::t) := List.Pairwise.of_cons hg + have h2 : Good (a::s) := ih (fun h => hw (List.mem_cons_of_mem _ h)) h1 + apply List.pairwise_cons.mpr + refine ⟨?_,h2⟩ + intro b hb hl + have ha : a=.e := (List.pairwise_cons.mp hg).1 a (by simp) hl + rcases List.mem_cons.mp hb with rfl | hb + · exact ha + · exact (List.pairwise_cons.mp h2).1 b hb ha + +theorem step_bad (k : Slot) {l : Letter} {s t : List Letter} + (h : Step (κ k) .w l s t) (hw : .w∉s) (hg : ¬Good (l::s)) : ¬Good (l::t) := + fun ht => hg (step_good k h hw ht) + +def badSpace : Submodule K (A K Letter) := + space (fun w => .w∉w.toList ∧ ¬Good (.o::w.toList)) + +theorem op_bad (k : Slot) {p : A K Letter} (hp : p∈badSpace) : + op (κ k) .o .w p∈badSpace := by + apply map_space (op (κ k) .o .w) _ ?_ hp + intro w hw + have he : op (κ k) .o .w (word w)=raw (κ k) .o .w w.toList := by + simpa only [FreeMonoid.ofList_toList] using op_word (κ k) .o .w w.toList + rw [he] + apply raw_mem_space + intro t ht + simp only [FreeMonoid.toList_ofList] + exact ⟨fun h => hw.1 (ht.sublist.subset h),step_bad k ht hw.1 hw.2⟩ + +theorem word_action_bad (v : FreeMonoid Slot) {p : A K Letter} (hp : p∈badSpace) : + action κ .o .w (word v) p∈badSpace := by + induction v using FreeMonoid.inductionOn' with + | one => simpa using hp + | of_mul k v ih => + rw [word_mul,word_of,map_mul,action_atom] + exact op_bad k ih + +theorem action_bad (v : A K Slot) {p : A K Letter} (hp : p∈badSpace) : + action κ .o .w v p∈badSpace := by + induction v using MonoidAlgebra.induction_on with + | of w => exact word_action_bad w hp + | add v w hv hw => + simpa only [map_add,LinearMap.add_apply] using badSpace.add_mem hv hw + | smul c v hv => + simpa only [map_smul,LinearMap.smul_apply] using badSpace.smul_mem c hv + +theorem test_zero (v : A K Slot) (s : List Letter) (hw : .w∉s) (hb : ¬Good (.o::s)) : + (action κ .o .w v (word (FreeMonoid.ofList s))).coeff 1=0 := by + have hp : word (R:=K) (FreeMonoid.ofList s)∈badSpace := + word_mem _ (by simpa only [FreeMonoid.toList_ofList] using And.intro hw hb) + have h := action_bad v hp + apply coeff_support h + intro he + exact he.2 (by simp [Good]) +end RowTwo + +namespace WeightedDeletion +open AssociativeElimination WordGrading +variable {R α β : Type*} [CommRing R] + +theorem Step.count_lower {κ : α → α → α → R} {r l : α} {s t : List α} + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → c≤wt a) + (h : Step κ r l s t) : c+count wt t≤count wt s := by + induction h with + | head l a s h => simpa only [count_cons] using Nat.add_le_add_right (hc l a _ h) (count wt s) + | tail l a s t h ih => simp only [count_cons]; omega + +theorem op_count_lower (κ : α → α → α → R) (l r : α) + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → c≤wt a) + {n d : ℕ} {p : A R α} (hp : p∈space (fun w => d+degree wt w≤n)) : + op κ l r p∈space (fun w => d+c+degree wt w≤n) := by + apply map_space (op κ l r) _ ?_ hp + intro w hw + have he : op κ l r (word w)=raw κ l r w.toList := by + simpa only [FreeMonoid.ofList_toList] using op_word κ l r w.toList + rw [he] + apply raw_mem_space + intro t ht + have hl := ht.count_lower wt c hc + simp only [FreeMonoid.toList_ofList,degree,count] at hl hw ⊢ + omega + +theorem action_count_lower (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) (hc : ∀ b l a t,κ b l a t≠0 → cost b≤wt a) + (w : FreeMonoid β) {n : ℕ} {p : A R α} (hp : p∈below wt n) : + action κ l r (word w) p∈space (fun v => degree cost w+degree wt v≤n) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa only [word_one,map_one,Module.End.one_apply,degree_one,Nat.zero_add,below] using hp + | of_mul b w ih => + rw [word_mul,word_of,map_mul,action_atom,Module.End.mul_apply] + have h := op_count_lower (κ b) l r wt (cost b) (hc b) ih + simpa only [degree_mul,degree_of,Nat.add_comm (degree cost w) (cost b)] using h + +theorem test_excess_cost (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) (hc : ∀ b l a t,κ b l a t≠0 → cost b≤wt a) + (w : FreeMonoid β) (s : FreeMonoid α) (hs : degree wt s simp [raw,κ,eq_comm] + | cons b s ih => + have hh : (((s++[a]).map some).headD none)≠none := by + cases s <;> simp + simp only [List.cons_append,List.map_cons,raw] + rw [ih] + simp only [κ,hh,and_false,↓reduceIte,zero_smul,zero_add] + split_ifs with h + · rw [← word_of (some b),← word_mul,← FreeMonoid.ofList_cons] + · simp + +theorem scalar_word (w s : List α) : + (action (κ (R:=R)) none none (word (FreeMonoid.ofList w)) + (word (FreeMonoid.ofList (s.map some)))).coeff 1 = if w=s then 1 else 0 := by + classical + induction w using List.reverseRecOn generalizing s with + | nil => + simp only [FreeMonoid.ofList_nil,word_one,map_one,Module.End.one_apply] + simp only [word,MonoidAlgebra.coeff_single,Finsupp.single_apply] + have he : FreeMonoid.ofList (s.map some)=(1 : FreeMonoid (Option α)) ↔ s=[] := by + constructor + · intro h + have hh := congrArg FreeMonoid.toList h + simpa using hh + · intro h; subst s; rfl + simp only [he,eq_comm (a:=[]) (b:=s)] + | append_singleton w k ih => + cases s using List.reverseRecOn with + | nil => + rw [FreeMonoid.ofList_append,word_mul,map_mul,Module.End.mul_apply] + simp only [FreeMonoid.ofList_singleton,word_of,action_atom] + change ((action (κ (R:=R)) none none (word (FreeMonoid.ofList w))) + (op (κ k) none none (word (FreeMonoid.ofList [])))).coeff 1= _ + rw [op_word] + simp [raw] + | append_singleton s a => + rw [FreeMonoid.ofList_append,word_mul,map_mul,Module.End.mul_apply] + simp only [FreeMonoid.ofList_singleton,word_of,action_atom,op_word,raw_snoc] + by_cases h : k=a + · subst a + simpa only [↓reduceIte, List.append_cancel_right_eq] using ih s + · rw [ite_eq_right h,map_zero] + have he : w++[k]≠s++[a] := by + intro he + have := congrArg List.getLast? he + simp only [List.getLast?_append,List.getLast?_singleton] at this + exact h (Option.some.inj this) + simp only [MonoidAlgebra.coeff_zero,Finsupp.zero_apply,ite_eq_right he] + +theorem test (p : A R α) (s : List α) : + (action (κ (R:=R)) none none p (word (FreeMonoid.ofList (s.map some)))).coeff 1= + p.coeff (FreeMonoid.ofList s) := by + classical + induction p using MonoidAlgebra.induction_on with + | of w => + change (action (κ (R:=R)) none none (word w) + (word (FreeMonoid.ofList (s.map some)))).coeff 1 = (word (R:=R) w).coeff (FreeMonoid.ofList s) + rw [show word (R:=R) w=word (FreeMonoid.ofList w.toList) from rfl, scalar_word] + simp only [word,MonoidAlgebra.coeff_single,Finsupp.single_apply,FreeMonoid.ofList.injective.eq_iff] + | add p q hp hq => simp only [map_add,LinearMap.add_apply,MonoidAlgebra.coeff_add,Finsupp.add_apply,hp,hq] + | smul c p hp => simp only [map_smul,LinearMap.smul_apply,MonoidAlgebra.coeff_smul,Finsupp.smul_apply,hp] +end TerminalDeletion + +namespace Deletion +open AssociativeElimination +attribute [local instance] LieRing.ofAssociativeRing +variable {R α ι : Type*} [CommRing R] + +def commSum (ν : ι → α → α → R) (pairs : List (ι×ι)) (l r : α) : + Module.End R (A R α) := + (pairs.map (fun ij => ⁅op (ν ij.2) l r,op (ν ij.1) l r⁆)).sum + +theorem commSum_apply (ν : ι → α → α → R) (pairs : List (ι×ι)) (l r : α) (p : A R α) : + commSum ν pairs l r p= + (pairs.map (fun ij => op (ν ij.2) l r (op (ν ij.1) l r p)- + op (ν ij.1) l r (op (ν ij.2) l r p))).sum := by + induction pairs with + | nil => rfl + | cons ij s ih => + simp only [commSum,List.map_cons,List.sum_cons,LinearMap.add_apply, + Ring.lie_def,LinearMap.sub_apply,Module.End.mul_apply] at ih ⊢ + rw [ih] + +theorem commSum_cons (ν : ι → α → α → R) (pairs : List (ι×ι)) + (l r a b : α) (s : List α) : + commSum ν pairs l r (word (a::b::s))= + (pairs.map (fun ij => curvature (ν ij.1) (ν ij.2) l a b (s.headD r))).sum • word s+ + atom a*commSum ν pairs a r (word (b::s)) := by + induction pairs with + | nil => simp [commSum] + | cons ij pairs ih => + simp only [commSum,List.map_cons,List.sum_cons,LinearMap.add_apply, + Ring.lie_def,LinearMap.sub_apply,Module.End.mul_apply] at ih ⊢ + rw [comm_cons,ih] + simp only [add_smul,mul_add] + abel + +theorem commSum_eq_zero (ν : ι → α → α → R) (pairs : List (ι×ι)) + (hc : ∀ l a b c,(pairs.map (fun ij => curvature (ν ij.1) (ν ij.2) l a b c)).sum=0) + (l r : α) : commSum ν pairs l r=0 := by + apply linear_ext + intro s + simp only [LinearMap.zero_apply] + induction s generalizing l with + | nil => simp [commSum_apply] + | cons a s ih => + cases s with + | nil => + rw [commSum_apply] + apply List.sum_eq_zero + intro z hz + obtain ⟨ij,_,rfl⟩ := List.mem_map.mp hz + simp [raw] + | cons b s => rw [commSum_cons,hc,ih]; simp +end Deletion + +namespace TargetDeletion +open AssociativeElimination DeletionTable +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 +abbrev F := CountTables.F +abbrev B := CountTables.B +abbrev E := Sum F B + +def fiber : F → List Hyperplane + | 0 => [.a3] + | 1 => [.p13] + | 2 => [.p23] + | 3 => [.p13,.m13] + | 4 => [.p23,.m23] +def base : B → List Hyperplane + | 0 => [.a1] + | 1 => [.a2] + | 2 => [.p12] + | 3 => [.p12,.m12] +def labels : E → List Hyperplane := Sum.elim fiber base + +def ν (i : E) (a b : Letter) : K := ((labels i).map (fun h => (weight h a b : K))).sum + +def extra : B → F → List (F×F) + | 0,0 | 0,3 => [(0,3)] + | 0,1 => [(0,1),(3,1)] + | 1,0 | 1,4 => [(0,4)] + | 1,2 => [(0,2),(4,2)] + | 2,1 | 2,2 => [(1,2)] + | 2,3 | 2,4 => [(3,2),(1,4),(3,4)] + | 3,1 => [(1,4)] + | 3,2 => [(2,3)] + | 3,3 | 3,4 => [(3,4)] + | _,_ => [] + +def pairs (b : B) (a : F) : List (E×E) := + (Sum.inl a,Sum.inr b)::(extra b a).map (fun ij => (Sum.inl ij.2,Sum.inl ij.1)) + +theorem table_curvature (b : B) (a : F) : ∀ l x y z : Letter, + ((pairs b a).map (fun ij => Deletion.curvature (ν ij.1) (ν ij.2) l x y z)).sum=0 := by + revert b a + decide + +theorem target_eq (b : B) (a : F) : CountTables.target b a= + ((extra b a).map (fun ij => CountTables.bracket (atom ij.1) (atom ij.2))).sum := by + fin_cases b <;> fin_cases a <;> + simp [CountTables.target,CountTables.common,CountTables.lower,CountTables.Q, + CountTables.W,CountTables.H,CountTables.U,CountTables.V,extra, + CountTables.bracket,add_mul,mul_add] <;> abel + +variable {α : Type*} +variable (ν : E → α → α → K) + +def evalFiber (l r : α) : A K F →ₐ[K] Module.End K (A K α) := + lift (fun a => Deletion.op (ν (.inl a)) l r) +def evalBase (l r : α) : A K B →ₐ[K] Module.End K (A K α) := + lift (fun b => Deletion.op (ν (.inr b)) l r) + +@[simp] theorem evalFiber_atom (l r : α) (a : F) : + evalFiber ν l r (atom a)=Deletion.op (ν (.inl a)) l r := lift_atom _ _ +@[simp] theorem evalBase_atom (l r : α) (b : B) : + evalBase ν l r (atom b)=Deletion.op (ν (.inr b)) l r := lift_atom _ _ + +theorem sum_extra (l r : α) (b : B) (a : F) : + (((extra b a).map (fun ij : F×F => + ⁅Deletion.op (ν (.inl ij.1)) l r,Deletion.op (ν (.inl ij.2)) l r⁆)).sum)= + evalFiber ν l r (CountTables.target b a) := by + rw [target_eq,map_list_sum,List.map_map] + congr 2 + funext ij + simp only [Function.comp_apply,CountTables.bracket,map_sub,map_mul,evalFiber_atom,Ring.lie_def] + +theorem action_table + (hc : ∀ b a l x y z,((pairs b a).map + (fun ij => Deletion.curvature (ν ij.1) (ν ij.2) l x y z)).sum=0) + (l r : α) (b : B) (a : F) : + evalBase ν l r (atom b)*evalFiber ν l r (atom a)- + evalFiber ν l r (atom a)*evalBase ν l r (atom b)=evalFiber ν l r (CountTables.target b a) := by + have h := Deletion.commSum_eq_zero ν (pairs b a) (hc b a) l r + simp only [Deletion.commSum,pairs,List.map_cons,List.sum_cons,List.map_map,Function.comp_def] + at h + rw [sum_extra] at h + have he := eq_neg_of_add_eq_zero_left h + rw [← map_neg,CharTwo.neg_eq] at he + simpa only [Ring.lie_def,evalBase_atom,evalFiber_atom] using he + +end TargetDeletion + +namespace WeightedDeletion +open AssociativeElimination WordGrading +variable {R α β : Type*} [CommRing R] + +theorem op_count_exact (κ : α → α → α → R) (l r : α) + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → wt a=c) + {n d : ℕ} {p : A R α} (hp : p∈space (fun w => d+degree wt w=n)) : + op κ l r p∈space (fun w => d+c+degree wt w=n) := by + apply map_space (op κ l r) _ ?_ hp + intro w hw + have he : op κ l r (word w)=raw κ l r w.toList := by + simpa only [FreeMonoid.ofList_toList] using op_word κ l r w.toList + rw [he] + apply raw_mem_space + intro t ht + have hl := ht.count_eq wt c hc + simp only [FreeMonoid.toList_ofList,degree,count] at hl hw ⊢ + omega + +theorem op_count_lt (κ : α → α → α → R) (l r : α) + (wt : α → ℕ) (c : ℕ) (hc : ∀ l a b,κ l a b≠0 → c≤wt a) + {n d : ℕ} {p : A R α} (hp : p∈space (fun w => d+degree wt w d+c+degree wt w d+degree wt w=n)) : + op κ l r p∈space (fun w => d+c+degree wt w degree cost w+degree wt v=n) ∧ + action κ l r (word w) p-action (cut κ wt cost) l r (word w) p∈ + space (fun v => degree cost w+degree wt v + simp only [word_one,map_one,Module.End.one_apply,degree_one,Nat.zero_add,sub_self] + exact ⟨hp,(space _).zero_mem⟩ + | of_mul b w ih => + rw [word_mul,word_of,map_mul,map_mul,action_atom,action_atom] + change op (cut κ wt cost b) l r (action (cut κ wt cost) l r (word w) p)∈_ ∧ + op (κ b) l r (action κ l r (word w) p)-op (cut κ wt cost b) l r + (action (cut κ wt cost) l r (word w) p)∈_ + constructor + · have h := op_count_exact (cut κ wt cost b) l r wt (cost b) + (cut_bound κ wt cost b) ih.1 + simpa only [degree_mul,degree_of,Nat.add_comm (degree cost w) (cost b)] using h + · have h1 := op_count_lt (κ b) l r wt (cost b) (hc b) ih.2 + have h2 := op_count_lt_of_exact + (fun l a r => κ b l a r-cut κ wt cost b l a r) l r wt (cost b) + (diff_lower_bound κ wt cost hc b) ih.1 + rw [op_sub] at h2 + simp only [LinearMap.sub_apply] at h2 + have hh : op (κ b) l r (action κ l r (word w) p)-op (cut κ wt cost b) l r + (action (cut κ wt cost) l r (word w) p)= + op (κ b) l r (action κ l r (word w) p-action (cut κ wt cost) l r (word w) p)+ + (op (κ b) l r (action (cut κ wt cost) l r (word w) p)- + op (cut κ wt cost b) l r (action (cut κ wt cost) l r (word w) p)) := by + rw [map_sub]; abel + rw [hh] + apply (space _).add_mem + · simpa only [degree_mul,degree_of,Nat.add_comm (degree cost w) (cost b)] using h1 + · simpa only [degree_mul,degree_of,Nat.add_comm (degree cost w) (cost b)] using h2 + +theorem exact_allocation_lower_test (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) (hc : ∀ b l a t,κ b l a t≠0 → cost b≤wt a) + (w : FreeMonoid β) {p : A R α} (hp : p∈homogeneous wt (degree cost w)) : + (action κ l r (word w) p).coeff 1=(action (cut κ wt cost) l r (word w) p).coeff 1 := by + have h := (exact_allocation_lower κ l r wt cost hc w hp).2 + have hz := coeff_support h 1 (by simp [degree_one]) + simpa only [MonoidAlgebra.coeff_sub,Finsupp.sub_apply,sub_eq_zero] using hz + +def scalar (κ : β → α → α → α → R) (l r : α) (s : FreeMonoid α) : A R β →ₗ[R] R where + toFun p := (action κ l r p (word s)).coeff 1 + map_add' p q := by simp only [map_add,LinearMap.add_apply,MonoidAlgebra.coeff_add,Finsupp.add_apply] + map_smul' c p := by simp only [map_smul,LinearMap.smul_apply,MonoidAlgebra.coeff_smul,Finsupp.smul_apply,RingHom.id_apply] + +theorem scalar_cut_of_leading (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) + (hc : ∀ b l a t,κ b l a t≠0 → cost b≤wt a) + (s : FreeMonoid α) {p : A R β} (hp : p∈above cost (degree wt s)) : + scalar κ l r s p=scalar (cut κ wt cost) l r s p := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + change degree wt s≤degree cost w at hw + change (action κ l r (word w) (word s)).coeff 1= + (action (cut κ wt cost) l r (word w) (word s)).coeff 1 + by_cases he : degree wt s=degree cost w + · exact exact_allocation_lower_test κ l r wt cost hc w (word_mem s he) + · have hlt : degree wt s simp only [map_zero] + | add p q _ _ hp hq => simp only [map_add,hp,hq] + | smul c p _ hp => simp only [map_smul,hp] + +theorem scalar_zero_of_cost (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) + (hc : ∀ b l a t,κ b l a t≠0 → cost b≤wt a) + (s : FreeMonoid α) {h : ℕ} (hs : degree wt s + obtain ⟨w,hw,rfl⟩ := hp + exact test_excess_cost κ l r wt cost hc w s (lt_of_lt_of_le hs hw) + | zero => simp only [map_zero] + | add p q _ _ hp hq => simp only [map_add,hp,hq,add_zero] + | smul c p _ hp => simp only [map_smul,hp,smul_zero] +end WeightedDeletion + +namespace EmbeddedTerminal +open AssociativeElimination WordGrading WeightedDeletion +variable {R α β : Type*} [CommRing R] [DecidableEq α] [DecidableEq β] + +def κ (enc : α → β) (r : β) (k : α) (_ a b : β) : R := + if a=enc k ∧ b=r then 1 else 0 + +theorem raw_snoc (enc : α → β) (hi : Function.Injective enc) (r : β) + (hr : ∀ a,enc a≠r) (k a : α) (l : β) (s : List α) : + raw (κ (R:=R) enc r k) l r ((s++[a]).map enc)= + if k=a then word (FreeMonoid.ofList (s.map enc)) else 0 := by + classical + induction s generalizing l with + | nil => simp [raw,κ,hi.eq_iff,eq_comm] + | cons b s ih => + have hh : (((s++[a]).map enc).headD r)≠r := by + cases s with + | nil => simpa using hr a + | cons c s => simpa using hr c + simp only [List.cons_append,List.map_cons,raw] + rw [ih] + simp only [κ,hh,and_false,↓reduceIte,zero_smul,zero_add] + split_ifs with h + · rw [← word_of (enc b),← word_mul,← FreeMonoid.ofList_cons] + · simp + +theorem scalar_word (enc : α → β) (hi : Function.Injective enc) (l r : β) + (hr : ∀ a,enc a≠r) (w s : List α) : + scalar (κ (R:=R) enc r) l r (FreeMonoid.ofList (s.map enc)) (word (FreeMonoid.ofList w)) = + if w=s then 1 else 0 := by + classical + change (action (κ (R:=R) enc r) l r (word (FreeMonoid.ofList w)) + (word (FreeMonoid.ofList (s.map enc)))).coeff 1= _ + induction w using List.reverseRecOn generalizing s with + | nil => + simp only [FreeMonoid.ofList_nil,word_one,map_one,Module.End.one_apply] + simp only [word,MonoidAlgebra.coeff_single,Finsupp.single_apply] + have he : FreeMonoid.ofList (s.map enc)=(1 : FreeMonoid β) ↔ s=[] := by + constructor + · intro h + have hh := congrArg FreeMonoid.toList h + simpa using hh + · intro h; subst s; rfl + simp only [he,eq_comm (a:=[]) (b:=s)] + | append_singleton w k ih => + cases s using List.reverseRecOn with + | nil => + rw [FreeMonoid.ofList_append,word_mul,map_mul,Module.End.mul_apply] + simp only [FreeMonoid.ofList_singleton,word_of,action_atom] + change ((action (κ (R:=R) enc r) l r (word (FreeMonoid.ofList w))) + (op (κ enc r k) l r (word (FreeMonoid.ofList [])))).coeff 1= _ + rw [op_word] + simp [raw] + | append_singleton s a => + rw [FreeMonoid.ofList_append,word_mul,map_mul,Module.End.mul_apply] + simp only [FreeMonoid.ofList_singleton,word_of,action_atom,op_word] + rw [raw_snoc enc hi r hr] + by_cases h : k=a + · subst a + simpa only [↓reduceIte,List.append_cancel_right_eq] using ih s + · rw [ite_eq_right h,map_zero] + have he : w++[k]≠s++[a] := by + intro he + have := congrArg List.getLast? he + simp only [List.getLast?_append,List.getLast?_singleton] at this + exact h (Option.some.inj this) + simp only [MonoidAlgebra.coeff_zero,Finsupp.zero_apply,ite_eq_right he] + +theorem test (enc : α → β) (hi : Function.Injective enc) (l r : β) + (hr : ∀ a,enc a≠r) (p : A R α) (s : List α) : + scalar (κ (R:=R) enc r) l r (FreeMonoid.ofList (s.map enc)) p=p.coeff (FreeMonoid.ofList s) := by + classical + induction p using MonoidAlgebra.induction_on with + | of w => + change scalar (κ (R:=R) enc r) l r (FreeMonoid.ofList (s.map enc)) (word w)= + (word (R:=R) w).coeff (FreeMonoid.ofList s) + rw [show word (R:=R) w=word (FreeMonoid.ofList w.toList) from rfl,scalar_word enc hi l r hr] + simp only [word,MonoidAlgebra.coeff_single,Finsupp.single_apply,FreeMonoid.ofList.injective.eq_iff] + | add p q hp hq => simp only [map_add,MonoidAlgebra.coeff_add,Finsupp.add_apply,hp,hq] + | smul c p hp => simp only [map_smul,MonoidAlgebra.coeff_smul,Finsupp.smul_apply,hp] +end EmbeddedTerminal + +namespace WordReversal +open AssociativeElimination WordGrading +variable {R α : Type*} [CommRing R] +attribute [local instance] LieRing.ofAssociativeRing + +def rev : A R α →ₗ[R] A R α := + (Finsupp.linearCombination R (fun w : FreeMonoid α => word w.reverse)).comp + (MonoidAlgebra.coeffLinearEquiv R).toLinearMap + +@[simp] theorem rev_word (w : FreeMonoid α) : rev (word (R:=R) w)=word w.reverse := by + change Finsupp.linearCombination R (fun monoidWord : FreeMonoid α => word monoidWord.reverse) (Finsupp.single w 1) = _; simp + +@[simp] theorem rev_atom (a : α) : rev (atom a : A R α)=atom a := by + simpa only [word_of,FreeMonoid.reverse_of] using rev_word (R:=R) (FreeMonoid.of a) + +@[simp] theorem rev_one : rev (1 : A R α)=1 := rev_word 1 + +theorem rev_mul (p q : A R α) : rev (p*q)=rev q*rev p := by + induction p using MonoidAlgebra.induction_on with + | of u => + change rev (word u*q)=rev q*rev (word u) + induction q using MonoidAlgebra.induction_on with + | of v => + change rev (word u*word v)=rev (word v)*rev (word u) + rw [← word_mul,rev_word,FreeMonoid.reverse_mul,word_mul,rev_word,rev_word] + | add p q hp hq => simp only [mul_add,map_add,hp,hq,add_mul] + | smul c p hp => simp only [mul_smul_comm,map_smul,hp,smul_mul_assoc] + | add p r hp hr => simp only [add_mul,map_add,hp,hr,mul_add] + | smul c p hp => simp only [smul_mul_assoc,map_smul,hp,mul_smul_comm] + +theorem rev_coeff (p : A R α) (w : FreeMonoid α) : + (rev p).coeff w=p.coeff w.reverse := by + classical + induction p using MonoidAlgebra.induction_on with + | of v => + change (rev (word v)).coeff w=(word (R:=R) v).coeff w.reverse + rw [rev_word] + simp only [word,MonoidAlgebra.coeff_single,Finsupp.single_apply] + have he : v.reverse=w ↔ v=w.reverse := by + constructor + · intro h + rw [← h, FreeMonoid.reverse_reverse] + · intro h + rw [h, FreeMonoid.reverse_reverse] + rw [he] + | add p q hp hq => simp only [map_add,MonoidAlgebra.coeff_add,Finsupp.add_apply,hp,hq] + | smul c p hp => simp only [map_smul,MonoidAlgebra.coeff_smul,Finsupp.smul_apply,hp] + +theorem rev_lie_charTwo [CharP R 2] (q : FreeLieAlgebra R α) : rev (embed q)=embed q := by + induction q using freeLie_induction with + | h0 => simp + | hg a => simp + | ha p q hp hq => simp only [map_add,hp,hq] + | hs r p hp => simp only [map_smul,hp] + | hl p q hp hq => + rw [LieHom.map_lie] + change rev (embed p*embed q-embed q*embed p)=embed p*embed q-embed q*embed p + rw [map_sub, rev_mul, rev_mul, hp, hq] + have hn (z : A R α) : -z=z := by + ext w + change -z.coeff w=z.coeff w + exact CharTwo.neg_eq _ + rw [sub_eq_add_neg, sub_eq_add_neg, hn, hn] + exact add_comm _ _ + +theorem coeff_reverse_charTwo [CharP R 2] (q : FreeLieAlgebra R α) (w : FreeMonoid α) : + (embed q).coeff w.reverse=(embed q).coeff w := by + rw [← rev_coeff,rev_lie_charTwo] + +end WordReversal + +namespace RowKernel +open AssociativeElimination WordGrading WeightedDeletion RowTwo +open RowTwo.Letter RowTwo.Slot + +inductive Row | one | two | three | four deriving DecidableEq +instance : Fintype Row := ⟨{.one,.two,.three,.four},by intro i; cases i <;> simp⟩ + +def κ : Row → Slot → Letter → Letter → Letter → K + | .one, .A, _, a, b | .one, .C, _, a, b => if a=.e ∧ b=.w then 1 else 0 + | .one, .B, _, a, b => if a=.o ∧ b=.w then 1 else 0 + | .two, .A, l, a, b => RowTwo.κ .A l a b + | .two, .C, l, a, b => RowTwo.κ .C l a b + + if a=.e then (if l=.p then 1 else 0)+(if b=.p then 1 else 0) else 0 + | .two, .B, l, a, b => RowTwo.κ .B l a b + | .three, .A, _, _, _ => 0 + | .three, .C, l, a, b => + if a=.e then (if l=.p then 1 else 0)+(if b=.p then 1 else 0) else + if a=.p then (if l=.e then 1 else 0)+(if b=.e then 1 else 0) else 0 + | .three, .B, l, a, b => RowTwo.κ .B l a b + | .four, .A, _, a, b => if a=.e ∧ b=.w then 1 else 0 + | .four, .C, _, a, b => if (a=.e ∨ a=.p) ∧ b=.w then 1 else 0 + | .four, .B, _, a, b => if a=.o ∧ b=.w then 1 else 0 + +def enc : Slot → Letter | .A => .e | .C => .p | .B => .o + +theorem enc_injective : Function.Injective enc := by intro a b; cases a <;> cases b <;> decide + +theorem enc_not_w (a : Slot) : enc a≠.w := by cases a <;> decide + +@[simp] theorem enc_eq_e (a : Slot) : enc a=.e ↔ a=.A := by cases a <;> decide +@[simp] theorem enc_eq_p (a : Slot) : enc a=.p ↔ a=.C := by cases a <;> decide + +def aCount (a : Slot) : ℕ := if a=.A then 1 else 0 +def cCount (a : Slot) : ℕ := if a=.C then 1 else 0 +def eCount (a : Letter) : ℕ := if a=.e then 1 else 0 +def pCount (a : Letter) : ℕ := if a=.p then 1 else 0 + +theorem count_enc_e (s : List Slot) : + degree eCount (FreeMonoid.ofList (s.map enc))=degree aCount (FreeMonoid.ofList s) := by + simp only [degree,FreeMonoid.toList_ofList,List.map_map,eCount,enc_eq_e,Function.comp_def] + rfl + +theorem count_enc_p (s : List Slot) : + degree pCount (FreeMonoid.ofList (s.map enc))=degree cCount (FreeMonoid.ofList s) := by + simp only [degree,FreeMonoid.toList_ofList,List.map_map,pCount,enc_eq_p,Function.comp_def] + rfl + +theorem a_cost (i : Row) : ∀ k l a b,κ i k l a b≠0 → aCount k≤eCount a := by + cases i <;> decide + +theorem one_cost : ∀ k l a b,κ .one k l a b≠0 → pCount a≤0 := by decide + +theorem three_cost : ∀ k l a b,κ .three k l a b≠0 → aCount k≤0 := by decide + +theorem cut_two : cut (κ .two) eCount aCount=RowTwo.κ := by + funext k l a b + revert k l a b + decide + +theorem cut_four : cut (κ .four) eCount aCount=EmbeddedTerminal.κ enc .w := by + funext k l a b + revert k l a b + decide + +def good (s : List Slot) : Prop := s.Pairwise (fun a b => a=.A → b=.A) + +theorem good_enc (s : List Slot) : RowTwo.Good (.o::s.map enc) ↔ good s := by + simp [RowTwo.Good,good,List.pairwise_map] + +theorem enc_no_w (s : List Slot) : .w∉s.map enc := by + intro h + obtain ⟨a,_,h⟩ := List.mem_map.mp h + exact enc_not_w a h + +def test (i : Row) (s : List Slot) : A K Slot →ₗ[K] K := + scalar (κ i) .o .w (FreeMonoid.ofList (s.map enc)) + +theorem test_cut (i : Row) (s : List Slot) {p : A K Slot} + (hp : p∈above aCount (degree aCount (FreeMonoid.ofList s))) : + test i s p=scalar (cut (κ i) eCount aCount) .o .w (FreeMonoid.ofList (s.map enc)) p := by + exact scalar_cut_of_leading (κ i) .o .w eCount aCount (a_cost i) _ + (by simpa only [count_enc_e] using hp) + +theorem degree_zero {α : Type*} (w : FreeMonoid α) : degree (fun _ => 0) w=0 := by + simp [degree,List.map_const'] + +theorem test_one (s : List Slot) (hs : 0 + change (action (κ .one) .o .w (word w) + (word (FreeMonoid.ofList (s.map enc)))).coeff 1=0 + apply test_word_zero (κ .one) .o .w pCount (fun _ => 0) one_cost + simpa only [degree_zero,count_enc_p] using hs + | add p q hp hq => simp only [map_add,hp,hq,add_zero] + | smul c p hp => simp only [map_smul,hp,smul_zero] + +theorem test_two (s : List Slot) (hs : ¬good s) {p : A K Slot} + (hp : p∈above aCount (degree aCount (FreeMonoid.ofList s))) : test .two s p=0 := by + rw [test_cut .two s hp,cut_two] + exact RowTwo.test_zero p (s.map enc) (enc_no_w s) (fun h => hs ((good_enc s).mp h)) + +theorem test_three (s : List Slot) (hs : 0 0) aCount three_cost _ ?_ hp + simpa only [degree_zero] using hs + +theorem test_four (s : List Slot) {p : A K Slot} + (hp : p∈above aCount (degree aCount (FreeMonoid.ofList s))) : + test .four s p=p.coeff (FreeMonoid.ofList s) := by + rw [test_cut .four s hp,cut_four] + exact EmbeddedTerminal.test enc enc_injective .o .w enc_not_w p s + +def Equation (p : A K Slot) (s : List Slot) : Prop := + test .one s p+test .two s p+test .three s p+test .four s p=0 + +theorem coefficient_bad {p : A K Slot} (s : List Slot) (heq : Equation p s) + (ha : 0 rfl + | cons a s ih => + simp only [degree,FreeMonoid.toList_ofList,List.map_cons,List.sum_cons] at ih ⊢ + rw [ih,List.count_cons] + simp [aCount,Nat.add_comm] + +theorem cCount_eq_count (s : List Slot) : degree cCount (FreeMonoid.ofList s)=s.count .C := by + induction s with + | nil => rfl + | cons a s ih => + simp only [degree,FreeMonoid.toList_ofList,List.map_cons,List.sum_cons] at ih ⊢ + rw [ih,List.count_cons] + simp [cCount,Nat.add_comm] + +theorem all_A_of_good_both (s : List Slot) (hg : good s) (hr : good s.reverse) + (ha : .A∈s) : ∀ b∈s,b=.A := by + cases s with + | nil => simp at ha + | cons a s => + obtain ⟨hfirst,_⟩ := List.pairwise_cons.mp hg + have hback := List.pairwise_cons.mp (List.pairwise_reverse.mp hr) + have he : a=.A := by + rcases List.mem_cons.mp ha with h | h + · exact h.symm + · exact hback.1 .A h rfl + intro b hb + rcases List.mem_cons.mp hb with hb | hb + · exact hb.trans he + · exact hfirst b hb he + +theorem not_good_reverse (s : List Slot) (hg : good s) + (ha : 0 simp + | of_mul k w ih => simp only [degree_mul,degree_of,acCount,ih]; omega + +theorem kernel_support (q : FreeLieAlgebra K Slot) (m r : ℕ) + (hm : embed q∈homogeneous acCount m) (hr : embed q∈homogeneous bCount r) + (hzero : ∀ w,degree aCount w=0 → (embed q).coeff w=0) + (heq : ∀ s,degree acCount (FreeMonoid.ofList s)=m → + degree bCount (FreeMonoid.ofList s)=r → Equation (embed q) s) : + embed q∈space (fun w => degree cCount w=0) := by + classical + apply mem_space + intro w hw + by_contra hc + have hwm : degree acCount w=m := (mem_space_iff.mp hm) w hw + have ex : ∃ n,∃ v,(embed q).coeff v≠0 ∧ degree aCount v=n := ⟨_,w,hw,rfl⟩ + obtain ⟨v,hv,hva⟩ := Nat.find_spec ex + have hmin (u : FreeMonoid Slot) (hu : (embed q).coeff u≠0) : Nat.find ex≤degree aCount u := + Nat.find_min' ex ⟨u,hu,rfl⟩ + have hvpos : 0 hv (hzero v he) + omega + have hvm : degree acCount v=m := (mem_space_iff.mp hm) v hv + have hvr : degree bCount v=r := (mem_space_iff.mp hr) v hv + have hvc : 0 if P a then atom a else 0) +def lie : FreeLieAlgebra R α →ₗ⁅R⁆ FreeLieAlgebra R α := + FreeLieAlgebra.lift R (fun a => if P a then FreeLieAlgebra.of R a else 0) + +@[simp] theorem assoc_atom (a : α) : assoc (R:=R) P (atom a)=if P a then atom a else 0 := by + simp [assoc] + +@[simp] theorem lie_of (a : α) : lie (R:=R) P (FreeLieAlgebra.of R a)= + if P a then FreeLieAlgebra.of R a else 0 := by simp [lie] + +theorem embed_lie (q : FreeLieAlgebra R α) : embed (lie P q)=assoc P (embed q) := by + have h : embed.comp (lie (R:=R) P)=(assoc P).toLieHom.comp embed := by + apply FreeLieAlgebra.hom_ext + intro a + simp only [LieHom.comp_apply,lie_of,embed_of,AlgHom.toLieHom_apply,assoc_atom] + split_ifs <;> simp + exact LieHom.congr_fun h q + +theorem assoc_word (w : FreeMonoid α) : assoc (R:=R) P (word w)= + if ∀ a∈w.toList,P a then word w else 0 := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,map_mul,ih] + rw [word_of,assoc_atom] + simp only [FreeMonoid.toList_mul,FreeMonoid.toList_of,List.singleton_append,List.mem_cons, + forall_eq_or_imp] + split_ifs <;> simp_all + +theorem coeff (q : A R α) (w : FreeMonoid α) : + (assoc P q).coeff w=if ∀ a∈w.toList,P a then q.coeff w else 0 := by + have h : (assoc (R:=R) P).toLinearMap=project (fun w => ∀ a∈w.toList,P a) := by + apply LinearMap.ext + intro q + induction q using MonoidAlgebra.induction_on with + | of w => exact (assoc_word P w).trans (project_word (R:=R) (fun w => ∀ a∈w.toList,P a) w).symm + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + change ((assoc P).toLinearMap q).coeff w=_ + rw [h,project_coeff] + +theorem assoc_eq_self {q : A R α} (hq : q∈space (fun w => ∀ a∈w.toList,P a)) : assoc P q=q := by + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + rw [coeff] + split_ifs with hw + · rfl + · exact (coeff_support hq w hw).symm + +theorem lie_eq_self {q : FreeLieAlgebra R α} + (hq : embed q∈space (fun w => ∀ a∈w.toList,P a)) : lie P q=q := by + apply UniversalEmbedding.injective + rw [embed_lie,assoc_eq_self P hq] + +def sub : LieSubalgebra R (FreeLieAlgebra R α) := + LieSubalgebra.lieSpan R (FreeLieAlgebra R α) {p | ∃ a,P a ∧ p=FreeLieAlgebra.of R a} + +theorem lie_mem (q : FreeLieAlgebra R α) : lie P q∈sub P := by + induction q using freeLie_induction with + | h0 => simp + | hg a => + rw [lie_of] + split_ifs with ha + · exact LieSubalgebra.subset_lieSpan ⟨a,ha,rfl⟩ + · exact (sub P).zero_mem + | ha p q hp hq => simpa only [map_add] using (sub P).add_mem hp hq + | hs r p hp => simpa only [map_smul] using (sub P).smul_mem r hp + | hl p q hp hq => simpa only [LieHom.map_lie] using (sub P).lie_mem hp hq + +theorem mem_of_support {q : FreeLieAlgebra R α} + (hq : embed q∈space (fun w => ∀ a∈w.toList,P a)) : q∈sub P := by + rw [← lie_eq_self P hq] + exact lie_mem P q + +end LetterRetraction +namespace RowKernel +open AssociativeElimination WordGrading WeightedDeletion RowTwo + +theorem degree_indicator_zero {α : Type*} (P : α → Prop) [DecidablePred P] (s : List α) : + degree (fun a => if P a then 1 else 0) (FreeMonoid.ofList s)=0 ↔ ∀ a∈s,¬P a := by + induction s with + | nil => simp [degree] + | cons a s ih => + simp only [degree,FreeMonoid.toList_ofList,List.map_cons,List.sum_cons] at ih ⊢ + simp only [Nat.add_eq_zero_iff,List.mem_cons,forall_eq_or_imp,ih] + split_ifs <;> simp_all + +theorem no_A_coeff {q : FreeLieAlgebra K Slot} + (hq : LetterRetraction.lie (fun a => a≠Slot.A) q=0) + (w : FreeMonoid Slot) (hw : degree RowKernel.aCount w=0) : (embed q).coeff w=0 := by + have hp : ∀ a∈w.toList,a≠Slot.A := by + exact (degree_indicator_zero (fun a => a=Slot.A) w.toList).mp + (by rw [FreeMonoid.ofList_toList]; exact hw) + have h := congrArg (fun p => (embed p).coeff w) hq + rw [LetterRetraction.embed_lie,LetterRetraction.coeff,ite_eq_left hp] at h + simpa using h + +theorem kernel_no_C (q : FreeLieAlgebra K Slot) (m r : ℕ) + (hm : embed q∈homogeneous acCount m) (hr : embed q∈homogeneous bCount r) + (hzero : LetterRetraction.lie (fun a => a≠Slot.A) q=0) + (heq : ∀ s,degree acCount (FreeMonoid.ofList s)=m → + degree bCount (FreeMonoid.ofList s)=r → Equation (embed q) s) : + q∈LetterRetraction.sub (fun a => a≠Slot.C) := by + apply LetterRetraction.mem_of_support + have h := kernel_support q m r hm hr (no_A_coeff hzero) heq + apply space_mono (fun w hw => ?_) h + exact (degree_indicator_zero (fun a => a=Slot.C) w.toList).mp + (by rw [FreeMonoid.ofList_toList]; exact hw) + +end RowKernel + +namespace WeightedDeletion +open AssociativeElimination WordGrading +variable {R α β : Type*} [CommRing R] + +theorem edge_raw (ν : α → α → R) (l r : α) (s : List α) : + raw (fun l a b => ν a b-ν l a) l r s=Deletion.raw ν l r s := by + induction s generalizing l with + | nil => rfl + | cons a s ih => simp only [raw,Deletion.raw,ih]; rfl + +theorem edge_op (ν : α → α → R) (l r : α) : + op (fun l a b => ν a b-ν l a) l r=Deletion.op ν l r := by + apply linear_ext + intro w + have h := edge_raw ν l r w.toList + simpa only [← op_word,← Deletion.op_word,Deletion.word,word,FreeMonoid.ofList_toList] using h + +theorem op_support (κ : α → α → α → R) (l r : α) (P : α → Prop) + {p : A R α} (hp : p∈space (fun w => ∀ a∈w.toList,P a)) : + op κ l r p∈space (fun w => ∀ a∈w.toList,P a) := by + apply map_space (op κ l r) _ ?_ hp + intro w hw + have he : op κ l r (word w)=raw κ l r w.toList := by + simpa only [FreeMonoid.ofList_toList] using op_word κ l r w.toList + rw [he] + apply raw_mem_space + intro t ht + simp only [FreeMonoid.toList_ofList] + exact fun a ha => hw a (ht.sublist.subset ha) + +theorem action_word_support (κ : β → α → α → α → R) (l r : α) (P : α → Prop) + (w : FreeMonoid β) {p : A R α} (hp : p∈space (fun w => ∀ a∈w.toList,P a)) : + action κ l r (word w) p∈space (fun w => ∀ a∈w.toList,P a) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa using hp + | of_mul b w ih => + rw [word_mul,word_of,map_mul,action_atom] + exact op_support (κ b) l r P ih + +theorem raw_congr_on (κ μ : α → α → α → R) (P : α → Prop) + (he : ∀ l a b,P l → P a → κ l a b=μ l a b) (l r : α) (hl : P l) + (s : List α) (hs : ∀ a∈s,P a) : raw κ l r s=raw μ l r s := by + induction s generalizing l with + | nil => rfl + | cons a s ih => + rw [raw,raw,he l a _ hl (hs a (by simp)),ih a (hs a (by simp))] + exact fun b hb => hs b (by simp [hb]) + +theorem op_congr_on (κ μ : α → α → α → R) (P : α → Prop) + (he : ∀ l a b,P l → P a → κ l a b=μ l a b) (l r : α) (hl : P l) + {p : A R α} (hp : p∈space (fun w => ∀ a∈w.toList,P a)) : op κ l r p=op μ l r p := by + have hker : space (fun w => ∀ a∈w.toList,P a) ≤ (op κ l r-op μ l r).ker := by + rw [space,Submodule.span_le] + rintro _ ⟨w,hw,rfl⟩ + change op κ l r (word w)-op μ l r (word w)=0 + apply sub_eq_zero.mpr + have h := raw_congr_on κ μ P he l r hl w.toList hw + simpa only [← op_word,FreeMonoid.ofList_toList] using h + exact sub_eq_zero.mp (hker hp) + +theorem action_congr_on (κ μ : β → α → α → α → R) (P : α → Prop) + (he : ∀ k l a b,P l → P a → κ k l a b=μ k l a b) (l r : α) (hl : P l) + (q : A R β) {p : A R α} (hp : p∈space (fun w => ∀ a∈w.toList,P a)) : + action κ l r q p=action μ l r q p := by + have hw (w : FreeMonoid β) : action κ l r (word w) p=action μ l r (word w) p := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul b w ih => + rw [word_mul,word_of,map_mul,map_mul,action_atom,action_atom,Module.End.mul_apply, + Module.End.mul_apply,ih] + exact op_congr_on (κ b) (μ b) P (he b) l r hl (action_word_support μ l r P w hp) + induction q using MonoidAlgebra.induction_on with + | of w => exact hw w + | add q z hq hz => simp only [map_add,LinearMap.add_apply,hq,hz] + | smul c q hq => simp only [map_smul,LinearMap.smul_apply,hq] + +theorem scalar_cut_of_homogeneous (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) + (hc : ∀ b l a t,κ b l a t≠0 → wt a≤cost b) + (s : FreeMonoid α) {p : A R β} (hp : p∈homogeneous cost (degree wt s)) : + scalar κ l r s p=scalar (cut κ wt cost) l r s p := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + exact exact_allocation_test κ l r wt cost hc w (word_mem s hw.symm) + | zero => simp only [map_zero] + | add p q _ _ hp hq => simp only [map_add,hp,hq] + | smul c p _ hp => simp only [map_smul,hp] + +theorem scalar_zero_of_low (κ : β → α → α → α → R) (l r : α) + (wt : α → ℕ) (cost : β → ℕ) + (hc : ∀ b l a t,κ b l a t≠0 → wt a≤cost b) + (s : FreeMonoid α) {p : A R β} (hp : p∈strictlyBelow cost (degree wt s)) : + scalar κ l r s p=0 := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + exact test_word_zero κ l r wt cost hc w s hw + | zero => simp only [map_zero] + | add p q _ _ hp hq => simp only [map_add,hp,hq,add_zero] + | smul c p _ hp => simp only [map_smul,hp,smul_zero] + +end WeightedDeletion + +namespace LeadingRows +open AssociativeElimination WordGrading WeightedDeletion RowTwo +open RowKernel +abbrev E := TargetDeletion.E + +def toLetter : Letter → DeletionTable.Letter | .o => .o | .e => .e | .p => .p | .w => .w + +def edge (i : E) (a b : Letter) : K := TargetDeletion.ν i (toLetter a) (toLetter b) + +def slots : Row → Slot → List E + | .one,.A => [.inr 0] + | .one,.C => [.inr 3,.inl 3] + | .one,.B => [.inr 2,.inl 1] + | .two,.A => [.inr 1,.inr 3] + | .two,.C => [.inl 4] + | .two,.B => [.inl 2] + | .three,.A => [.inr 0,.inr 1,.inr 3] + | .three,.C => [.inl 3,.inl 4] + | .three,.B => [.inl 1,.inl 2] + | .four,.A => [.inr 0] + | .four,.C => [.inr 3] + | .four,.B => [.inr 2] + +def subst (i : Row) : A K Slot →ₐ[K] A K E := + lift (fun k => ((slots i k).map atom).sum) + +def slotEdge (i : Row) (k : Slot) (a b : Letter) : K := + ((slots i k).map (fun e => edge e a b)).sum + +def κ₀ (i : Row) (k : Slot) (l a b : Letter) : K := slotEdge i k a b-slotEdge i k l a + +def zeroCount (a : Letter) : ℕ := if a=.o then 1 else 0 + +theorem zero_cost (i : Row) : ∀ k l a b,κ₀ i k l a b≠0 → zeroCount a≤bCount k := by + cases i <;> decide + +theorem cut_table (i : Row) : ∀ k l a b,l≠.w → a≠.w → + cut (κ₀ i) zeroCount bCount k l a b=RowKernel.κ i k l a b := by + cases i <;> decide + +def operators (l r : Letter) : A K E →ₐ[K] Module.End K (A K Letter) := + lift (fun e => Deletion.op (edge e) l r) + +theorem substituted_action (i : Row) (l r : Letter) : + (operators l r).comp (subst i)=action (κ₀ i) l r := by + apply hom_ext + intro k + simp only [AlgHom.comp_apply,subst,lift_atom,map_list_sum,List.map_map,Function.comp_def,operators,lift_atom, + action_atom] + change ((slots i k).map (fun e => Deletion.op (edge e) l r)).sum=op (κ₀ i k) l r + rw [← Deletion.op_list_sum,← edge_op] + rfl + +theorem count_enc_zero (s : List Slot) : + degree zeroCount (FreeMonoid.ofList (s.map RowKernel.enc))=degree bCount (FreeMonoid.ofList s) := by + simp only [degree,FreeMonoid.toList_ofList,List.map_map,Function.comp_def] + congr 2 + funext a + cases a <;> rfl + +theorem scalar_allocated (i : Row) (s : List Slot) {q : A K Slot} + (hq : q∈homogeneous bCount (degree bCount (FreeMonoid.ofList s))) : + scalar (κ₀ i) .o .w (FreeMonoid.ofList (s.map RowKernel.enc)) q=RowKernel.test i s q := by + have h := scalar_cut_of_homogeneous (κ₀ i) .o .w zeroCount bCount (zero_cost i) + (FreeMonoid.ofList (s.map RowKernel.enc)) + (by simpa only [count_enc_zero] using hq) + rw [h] + change (action (cut (κ₀ i) zeroCount bCount) .o .w q + (word (FreeMonoid.ofList (s.map RowKernel.enc)))).coeff 1= + (action (RowKernel.κ i) .o .w q (word (FreeMonoid.ofList (s.map RowKernel.enc)))).coeff 1 + apply congrArg (fun p : A K Letter => p.coeff 1) + apply action_congr_on _ _ (fun a => a≠Letter.w) (cut_table i) _ _ (by decide) + exact word_mem _ (by + intro a ha + simp only [FreeMonoid.toList_ofList] at ha + obtain ⟨k,_,rfl⟩ := List.mem_map.mp ha + exact RowKernel.enc_not_w k) + +def namedCount : E → ℕ := Sum.elim CountTables.fiberCount CountTables.baseCount +def namedκ (i : E) (l a b : Letter) : K := edge i a b-edge i l a + +theorem named_zero_cost : ∀ i l a b,namedκ i l a b≠0 → zeroCount a≤namedCount i := by + decide + +theorem named_action (l r : Letter) : operators l r=action namedκ l r := by + apply hom_ext + intro i + simp only [operators,lift_atom,action_atom] + exact (edge_op (edge i) l r).symm + +def P (q : A K Slot) : A K E := subst .one q+subst .two q+subst .three q+subst .four q + +theorem scalar_subst (i : Row) (s : List Slot) (q : A K Slot) : + scalar namedκ .o .w (FreeMonoid.ofList (s.map RowKernel.enc)) (subst i q)= + scalar (κ₀ i) .o .w (FreeMonoid.ofList (s.map RowKernel.enc)) q := by + change (action namedκ .o .w (subst i q) (word _)).coeff 1= _ + rw [← named_action] + have h := AlgHom.congr_fun (substituted_action i .o .w) q + change operators .o .w (subst i q)=_ at h + rw [h] + rfl + +theorem equation_of_low_interpretation (q : A K Slot) (r : ℕ) + (hq : q∈homogeneous bCount r) + (z : A K E) (hz : z∈strictlyBelow namedCount r) + (he : operators .o .w (P q)=operators .o .w z) + (s : List Slot) (hs : degree bCount (FreeMonoid.ofList s)=r) : RowKernel.Equation q s := by + have hzero : scalar namedκ .o .w (FreeMonoid.ofList (s.map RowKernel.enc)) z=0 := by + apply scalar_zero_of_low namedκ .o .w zeroCount namedCount named_zero_cost + simpa only [count_enc_zero,hs] using hz + have hval : scalar namedκ .o .w (FreeMonoid.ofList (s.map RowKernel.enc)) (P q)=0 := by + change (action namedκ .o .w (P q) (word _)).coeff 1=0 + rw [← named_action,he,named_action] + exact hzero + have hqs : q∈homogeneous bCount (degree bCount (FreeMonoid.ofList s)) := by + simpa only [hs] using hq + simp only [P,map_add,scalar_subst,scalar_allocated _ s hqs] at hval + exact hval + +open PolynomialOrdering +attribute [local instance] LieRing.ofAssociativeRing + +def secondExtra : SecondStage.F → List (SecondStage.F×SecondStage.F) + | 0 | 2 => [(0,2)] + | 1 => [(0,1),(2,1)] + +def secondPairs (a : SecondStage.F) : List (SecondStage.E×SecondStage.E) := + (.inl a,.inr ())::(secondExtra a).map (fun ij => (.inl ij.2,.inl ij.1)) +def secondEdge (e : SecondStage.E) : Letter → Letter → K := edge (.inr (SecondStage.toOld e)) + +theorem second_curvature : ∀ a l x y z,((secondPairs a).map + (fun ij => Deletion.curvature (secondEdge ij.1) (secondEdge ij.2) l x y z)).sum=0 := by + decide + +theorem second_common (b : SecondStage.B) (a : SecondStage.F) : SecondStage.common b a= + ((secondExtra a).map (fun ij => CountTables.bracket (atom ij.1) (atom ij.2))).sum := by + fin_cases a <;> simp [SecondStage.common,SecondStage.H,SecondStage.U,SecondStage.V, + secondExtra,CountTables.bracket] + +def secondFiber (l r : Letter) : A K SecondStage.F →ₐ[K] Module.End K (A K Letter) := + lift (fun a => Deletion.op (secondEdge (.inl a)) l r) +def secondBase (l r : Letter) : A K SecondStage.B →ₐ[K] Module.End K (A K Letter) := + lift (fun b => Deletion.op (secondEdge (.inr b)) l r) + +theorem second_sum (l r : Letter) (a : SecondStage.F) : + ((secondExtra a).map (fun ij => ⁅Deletion.op (secondEdge (.inl ij.1)) l r, + Deletion.op (secondEdge (.inl ij.2)) l r⁆)).sum= + secondFiber l r (SecondStage.common () a) := by + rw [second_common,map_list_sum,List.map_map] + congr 2 + funext ij + simp only [Function.comp_apply,CountTables.bracket,map_sub,map_mul,secondFiber,lift_atom,Ring.lie_def] + +theorem second_action (l r : Letter) (b : SecondStage.B) (a : SecondStage.F) : + secondBase l r (atom b)*secondFiber l r (atom a)- + secondFiber l r (atom a)*secondBase l r (atom b)= + secondFiber l r (SecondStage.common b a) := by + cases b + have h := Deletion.commSum_eq_zero secondEdge (secondPairs a) (second_curvature a) l r + simp only [Deletion.commSum,secondPairs,List.map_cons,List.sum_cons,List.map_map,Function.comp_def] + at h + rw [second_sum] at h + have he := eq_neg_of_add_eq_zero_left h + rw [← map_neg,CharTwo.neg_eq] at he + simpa only [Ring.lie_def,secondBase,secondFiber,lift_atom] using he + +theorem second_evaluate (l r : Letter) : (TargetDeletion.evalBase edge l r).comp SecondStage.outward= + evaluate (secondFiber l r) (secondBase l r) := by + apply hom_ext + intro a + cases a <;> simp only [AlgHom.comp_apply,SecondStage.outward,AlphabetTransport.map_atom, + TargetDeletion.evalBase_atom,evaluate,lift_atom,Sum.elim_inl,Sum.elim_inr,secondFiber,secondBase] + all_goals rfl + +theorem second_order_correct (l r : Letter) (q : A K CountTables.B) : + TargetDeletion.evalBase edge l r (SecondStage.order SecondStage.common q)= + TargetDeletion.evalBase edge l r q := by + change TargetDeletion.evalBase edge l r (SecondStage.outward + (ordered SecondStage.common (SecondStage.inward q)))=_ + have h (p : A K SecondStage.E) := AlgHom.congr_fun (second_evaluate l r) p + change ∀ p,TargetDeletion.evalBase edge l r (SecondStage.outward p)=_ at h + rw [h,evaluate_ordered _ _ _ (second_action l r),← h,SecondStage.outward_inward] + +theorem main_action (l r : Letter) (b : CountTables.B) (a : CountTables.F) : + TargetDeletion.evalBase edge l r (atom b)*TargetDeletion.evalFiber edge l r (atom a)- + TargetDeletion.evalFiber edge l r (atom a)*TargetDeletion.evalBase edge l r (atom b)= + TargetDeletion.evalFiber edge l r (CountTables.target b a) := by + apply TargetDeletion.action_table + intro b a l x y z + exact TargetDeletion.table_curvature b a (toLetter l) (toLetter x) (toLetter y) (toLetter z) + +theorem main_evaluate (l r : Letter) : + evaluate (TargetDeletion.evalFiber edge l r) (TargetDeletion.evalBase edge l r)=operators l r := by + apply hom_ext + intro a + cases a <;> simp [evaluate,operators] + +theorem target_order_correct (l r : Letter) (p : A K E) : + operators l r (ExactCountOrdering.T p)=operators l r p := by + rw [← main_evaluate] + exact evaluate_iterated _ _ CountTables.target (main_action l r) + (SecondStage.order SecondStage.common) (second_order_correct l r) p + +theorem equation_from_source_order (q : A K Slot) (r : ℕ) + (hq : q∈homogeneous bCount r) + (hp : P q∈homogeneous namedCount r) + (e : A K E) (he : e∈above namedCount (r+1)) + (hz : ExactCountOrdering.S (P q+e)=0) + (s : List Slot) (hs : degree bCount (FreeMonoid.ofList s)=r) : RowKernel.Equation q s := by + have ht := (ExactCountOrdering.transfer r (P q) e hp he hz).2 + exact equation_of_low_interpretation q r hq (ExactCountOrdering.T (P q)) ht + (target_order_correct .o .w (P q)).symm s hs + +end LeadingRows + +namespace WordGrading +open AssociativeElimination +variable {R α β : Type*} [CommRing R] + +theorem algHom_difference_above (f g : A R α →ₐ[R] A R β) + (wa : α → ℕ) (wb : β → ℕ) + (hf : ∀ a,f (atom a)∈above wb (wa a)) + (hg : ∀ a,g (atom a)∈homogeneous wb (wa a)) + (he : ∀ a,f (atom a)-g (atom a)∈above wb (wa a+1)) + {n : ℕ} {p : A R α} (hp : p∈homogeneous wa n) : + f p-g p∈above wb (n+1) := by + have hw (w : FreeMonoid α) : f (word w)-g (word w)∈above wb (degree wa w+1) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + simp only [word_mul,word_of,map_mul,degree_mul,degree_of] + have hfw : f (word w)∈above wb (degree wa w) := + algHom_above f wa wb hf (word_mem w (le_refl _)) + have h1 := above_mul (he a) hfw + have h2 := above_mul (homogeneous_above (hg a)) ih + have eq : f (atom a)*f (word w)-g (atom a)*g (word w)= + (f (atom a)-g (atom a))*f (word w)+g (atom a)*(f (word w)-g (word w)) := by noncomm_ring + rw [eq] + apply (above wb (wa a+degree wa w+1)).add_mem + · simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · simpa only [Nat.add_assoc] using h2 + exact map_space (f.toLinearMap-g.toLinearMap) _ (by intro w h; simpa only [LinearMap.sub_apply,AlgHom.toLinearMap_apply,h] using hw w) hp + +end WordGrading +namespace ExactPentagon +open AssociativeElimination WordGrading RowTwo RowKernel LeadingRows +open PolynomialOrdering + +abbrev u12 : A K E := atom (.inr 2) +abbrev u23 : A K E := atom (.inl 2) + +def extra : Slot → A K E + | .A => u12*u12 + | .C => u12*u23-u23*u12 + | .B => 0 + +def exactTwo : A K Slot →ₐ[K] A K E := + lift (fun k => subst .two (atom k)+extra k) + +def omitted : A K Slot →ₐ[K] A K E := + lift (fun | .A => u12*u12 | .C => u12*u23-u23*u12 | .B => u23) + +def weight : Slot → ℕ | .A | .C => 2 | .B => 1 + +def full (p : A K Slot) : A K E := + subst .one p+exactTwo p+omitted p+subst .three p+subst .four p + +theorem atom_homo (a : E) : (atom a : A K E)∈homogeneous namedCount (namedCount a) := + word_mem (FreeMonoid.of a) (degree_of namedCount a) + +theorem subst_homo (i : Row) (k : Slot) : + subst i (atom k)∈homogeneous namedCount (bCount k) := by + rw [subst,lift_atom] + apply (homogeneous namedCount (bCount k)).toAddSubmonoid.list_sum_mem + intro a ha + obtain ⟨e,he,rfl⟩ := List.mem_map.mp ha + have hc : namedCount e=bCount k := by + cases i <;> cases k <;> simp [slots] at he <;> rcases he with rfl | rfl | rfl <;> rfl + rw [← hc] + exact atom_homo e + +theorem P_homogeneous {q : A K Slot} {r : ℕ} (hq : q∈homogeneous bCount r) : + P q∈homogeneous namedCount r := by + have h (i : Row) := algHom_homogeneous (subst i) bCount namedCount (subst_homo i) hq + exact (homogeneous namedCount r).add_mem + ((homogeneous namedCount r).add_mem ((homogeneous namedCount r).add_mem (h .one) (h .two)) (h .three)) (h .four) + +theorem u12_homo : u12∈homogeneous namedCount 1 := atom_homo (.inr 2) +theorem u23_homo : u23∈homogeneous namedCount 1 := atom_homo (.inl 2) + +theorem extra_homo (k : Slot) : extra k∈homogeneous namedCount 2 := by + cases k with + | A => + have h := homogeneous_mul u12_homo u12_homo + exact h + | C => + have h1 := homogeneous_mul u12_homo u23_homo + have h2 := homogeneous_mul u23_homo u12_homo + exact (homogeneous namedCount 2).sub_mem h1 h2 + | B => exact (homogeneous namedCount 2).zero_mem + +theorem exactTwo_difference (k : Slot) : + exactTwo (atom k)-subst .two (atom k)∈above namedCount (bCount k+1) := by + simp only [exactTwo,lift_atom,add_sub_cancel_left] + apply space_mono (P:=fun w => degree namedCount w=2) ?_ (extra_homo k) + intro w hw + cases k <;> simp_all [bCount] + +theorem exactTwo_above (k : Slot) : exactTwo (atom k)∈above namedCount (bCount k) := by + rw [exactTwo,lift_atom] + apply (above namedCount _).add_mem (homogeneous_above (subst_homo .two k)) + apply space_mono (P:=fun w => degree namedCount w=2) ?_ (extra_homo k) + intro w hw + cases k <;> simp_all [bCount] + +theorem omitted_weight (k : Slot) : omitted (atom k)∈homogeneous namedCount (weight k) := by + simp only [omitted,lift_atom] + cases k with + | A => + have h := homogeneous_mul u12_homo u12_homo + exact h + | C => + have h1 := homogeneous_mul u12_homo u23_homo + have h2 := homogeneous_mul u23_homo u12_homo + exact (homogeneous namedCount 2).sub_mem h1 h2 + | B => exact u23_homo + +theorem full_error {p q : A K Slot} {n r : ℕ} + (hp : p∈homogeneous weight n) (hr : r homogeneous_above (subst_homo i k)) hhigh + have htwo := algHom_above exactTwo bCount namedCount exactTwo_above hhigh + have hdiff := algHom_difference_above exactTwo (subst .two) bCount namedCount + exactTwo_above (subst_homo .two) exactTwo_difference hq + have homit : omitted p∈above namedCount (r+1) := by + exact space_mono (P:=fun w => degree namedCount w=n) (by intro w hw; omega) + (algHom_homogeneous omitted weight namedCount omitted_weight hp) + have eq : full p-P q=subst .one (p-q)+exactTwo (p-q)+(exactTwo q-subst .two q)+ + omitted p+subst .three (p-q)+subst .four (p-q) := by + simp only [full,P,map_sub] + abel + rw [eq] + exact (above namedCount _).add_mem ((above namedCount _).add_mem ((above namedCount _).add_mem + ((above namedCount _).add_mem ((above namedCount _).add_mem (hi .one) htwo) hdiff) homit) (hi .three)) (hi .four) + +theorem row_equation {p q : A K Slot} {n r : ℕ} + (hp : p∈homogeneous weight n) (hr : r simp + | hg a => simp + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => simp only [LieHom.map_lie,Ring.lie_def,map_sub,map_mul,hp,hq] + +theorem map_eval {M N : Type*} [LieRing M] [LieAlgebra R M] [LieRing N] [LieAlgebra R N] + (f : M →ₗ⁅R⁆ N) (a b : M) (q : FreeLieAlgebra R Bool) : + f (BaseChangeEquations.eval a b q)=BaseChangeEquations.eval (f a) (f b) q := by + have h : f.comp (BaseChangeEquations.eval a b)=BaseChangeEquations.eval (f a) (f b) := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [BaseChangeEquations.eval] + exact LieHom.congr_fun h q + +end AssociativeEvaluation +namespace CharTwoAction +attribute [local instance] LieRing.ofAssociativeRing +variable {U : Type*} [Ring U] [CharP U 2] +theorem square_add (x y : U) : (x+y)*(x+y)=x*x+y*y+⁅x,y⁆ := by + simp only [Ring.lie_def,CharTwo.sub_eq_add,mul_add,add_mul] + abel +end CharTwoAction +namespace ExactPentagon +open AssociativeElimination RowTwo RowKernel LeadingRows PolynomialOrdering +open SourceEnveloping SourceModel +abbrev K := ZMod 2 +attribute [local instance] LieRing.ofAssociativeRing + +abbrev U13 : Env S3 := rawFiber (CountTables.Y 0) +abbrev U23 : Env S3 := rawFiber (CountTables.Y 1) +abbrev X1 : Env S3 := baseX 0 +abbrev X2 : Env S3 := baseX 1 +abbrev U12 : Env S3 := baseU + +def algEval {U : Type*} [Ring U] [Algebra K U] (x y : U) : A K Bool →ₐ[K] U := + lift (fun i => if i then y else x) + +def quad : A K Slot →ₐ[K] A K Bool := lift (fun + | .A => atom false*atom false + | .C => atom false*atom true-atom true*atom false + | .B => atom true) + +def quadEval {U : Type*} [Ring U] [Algebra K U] (x y : U) : A K Slot →ₐ[K] U := + lift (fun | .A => x*x | .C => x*y-y*x | .B => y) + +theorem algEval_quad {U : Type*} [Ring U] [Algebra K U] (x y : U) : + (algEval x y).comp quad=quadEval x y := by + apply hom_ext + intro k + cases k <;> simp [quad,quadEval,algEval] + +def interpretation : A K E →ₐ[K] Env S3 := evaluate topFiber topBase + +theorem interpretation_base (b : CountTables.B) : interpretation (atom (.inr b))=topBase (atom b) := by + simp [interpretation,evaluate] +theorem interpretation_fiber (b : CountTables.F) : interpretation (atom (.inl b))=topFiber (atom b) := by + simp [interpretation,evaluate] + +@[simp] theorem interpretation_a1 : interpretation (atom (.inr 0))=X1*X1 := by + simp only [interpretation_base,topBase,AlgHom.comp_apply,oldBase,lift_atom,map_mul] + rfl +@[simp] theorem interpretation_a2 : interpretation (atom (.inr 1))=X2*X2 := by + simp only [interpretation_base,topBase,AlgHom.comp_apply,oldBase,lift_atom,map_mul] + rfl +@[simp] theorem interpretation_u12 : interpretation u12=U12 := by + simp only [u12,interpretation_base,topBase,AlgHom.comp_apply,oldBase,lift_atom] + rfl +@[simp] theorem interpretation_u13 : interpretation (atom (.inl 1))=U13 := by + rw [interpretation_fiber,topFiber_eq,CountTables.realize_atom_one] +@[simp] theorem interpretation_u23 : interpretation u23=U23 := by + rw [interpretation_fiber,topFiber_eq,CountTables.realize_atom_two] +@[simp] theorem interpretation_v12 : interpretation (atom (.inr 3))=⁅X1,U12⁆ := by + simp only [interpretation_base,topBase,AlgHom.comp_apply,oldBase,lift_atom,Ring.lie_def,map_sub,map_mul] + rfl +@[simp] theorem interpretation_v13 : interpretation (atom (.inl 3))=⁅X1,U13⁆ := by + rw [interpretation_fiber,topFiber_eq,CountTables.realize_atom_three,raw_delta] + simp [CountTables.δ,CountTables.Y,CountTables.C] +@[simp] theorem interpretation_v23 : interpretation (atom (.inl 4))=⁅X2,U23⁆ := by + rw [interpretation_fiber,topFiber_eq,CountTables.realize_atom_four,raw_delta] + simp [CountTables.δ,CountTables.Y,CountTables.C] + +theorem cross13 : ⁅X2,U13⁆=0 := by + rw [raw_delta] + simp [CountTables.δ,CountTables.Y] +theorem cross23 : ⁅X1,U23⁆=0 := by + rw [raw_delta] + simp [CountTables.δ,CountTables.Y] + +theorem base_triple : ⁅X1,X2⁆=⁅X1,U12⁆ := by + have h := GenericBraid.t_three (R:=K) (some root : S3) (some one) (some two) + (by decide) (by decide) (by decide) + have hh := congrArg (UniversalEnvelopingAlgebra.ι K) h + simp only [map_zero,LieHom.map_lie,map_add] at hh + change ⁅SourceEnveloping.chord (some root) (some one), + SourceEnveloping.chord (some root) (some two)+SourceEnveloping.chord (some one) (some two)⁆=0 at hh + rw [← baseX_zero,← baseX_one,← baseU_eq,lie_add] at hh + exact CharTwo.add_eq_zero.mp hh + +theorem base_triangle : ⁅X2,U12⁆=⁅X1,U12⁆ := by + have h := GenericBraid.t_three (R:=K) (some one : S3) (some two) (some root) + (by decide) (by decide) (by decide) + have hh := congrArg (UniversalEnvelopingAlgebra.ι K) h + simp only [map_zero,LieHom.map_lie,map_add] at hh + change ⁅SourceEnveloping.chord (some one) (some two), + SourceEnveloping.chord (some one) (some root)+SourceEnveloping.chord (some two) (some root)⁆=0 at hh + rw [SourceEnveloping.chord_comm (some one) (some root),SourceEnveloping.chord_comm (some two) (some root), + ← baseX_zero,← baseX_one,← baseU_eq,lie_add] at hh + rw [CharTwoAction.symm U12 X1,CharTwoAction.symm U12 X2] at hh + exact (CharTwo.add_eq_zero.mp hh).symm + +theorem interprets_one : interpretation.comp (subst .one)=quadEval X1 (U12+U13) := by + apply hom_ext + intro k + cases k <;> simp only [AlgHom.comp_apply,subst,lift_atom,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,map_add,interpretation_a1,interpretation_u12,interpretation_u13, + interpretation_v12,interpretation_v13,quadEval,lift_atom] + all_goals simp only [Ring.lie_def]; noncomm_ring + +theorem interprets_four : interpretation.comp (subst .four)=quadEval X1 U12 := by + apply hom_ext + intro k + cases k <;> simp only [AlgHom.comp_apply,subst,lift_atom,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,interpretation_a1,interpretation_u12,interpretation_v12,quadEval,lift_atom,Ring.lie_def] + +theorem interprets_omitted : interpretation.comp omitted=quadEval U12 U23 := by + apply hom_ext + intro k + cases k <;> simp only [AlgHom.comp_apply,omitted,lift_atom,map_mul,map_sub,interpretation_u12, + interpretation_u23,quadEval,lift_atom] + +theorem interprets_two : interpretation.comp exactTwo=quadEval (X2+U12) U23 := by + apply hom_ext + intro k + cases k with + | A => + simp only [AlgHom.comp_apply,exactTwo,lift_atom,subst,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,extra,map_add,map_mul,interpretation_a2,interpretation_v12,interpretation_u12, + quadEval,lift_atom,CharTwoAction.square_add,base_triangle] + abel + | C => + simp only [AlgHom.comp_apply,exactTwo,lift_atom,subst,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,extra,map_add,map_mul,map_sub,interpretation_v23,interpretation_u12, + interpretation_u23,quadEval,lift_atom,Ring.lie_def] + noncomm_ring + | B => + simp only [AlgHom.comp_apply,exactTwo,lift_atom,subst,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,extra,interpretation_u23,quadEval,lift_atom] + +theorem interprets_three : interpretation.comp (subst .three)=quadEval (X1+X2) (U13+U23) := by + apply hom_ext + intro k + cases k with + | A => + simp only [AlgHom.comp_apply,subst,lift_atom,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,map_add,interpretation_a1,interpretation_a2,interpretation_v12, + quadEval,lift_atom,CharTwoAction.square_add,base_triple] + abel + | C => + simp only [AlgHom.comp_apply,subst,lift_atom,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,map_add,interpretation_v13,interpretation_v23,quadEval,lift_atom] + change ⁅X1,U13⁆+⁅X2,U23⁆=⁅X1+X2,U13+U23⁆ + rw [add_lie,lie_add,lie_add,cross13,cross23,add_zero,zero_add] + | B => + simp only [AlgHom.comp_apply,subst,lift_atom,slots,List.map_cons,List.map_nil,List.sum_cons, + List.sum_nil,add_zero,map_add,interpretation_u13,interpretation_u23,quadEval,lift_atom] + +theorem full_interpretation (p : A K Slot) : + interpretation (full p)=quadEval X1 (U12+U13) p+quadEval (X2+U12) U23 p+ + quadEval U12 U23 p+quadEval (X1+X2) (U13+U23) p+quadEval X1 U12 p := by + simp only [full,map_add] + rw [show interpretation (subst .one p)=quadEval X1 (U12+U13) p from AlgHom.congr_fun interprets_one p, + show interpretation (exactTwo p)=quadEval (X2+U12) U23 p from AlgHom.congr_fun interprets_two p, + show interpretation (omitted p)=quadEval U12 U23 p from AlgHom.congr_fun interprets_omitted p, + show interpretation (subst .three p)=quadEval (X1+X2) (U13+U23) p from AlgHom.congr_fun interprets_three p, + show interpretation (subst .four p)=quadEval X1 U12 p from AlgHom.congr_fun interprets_four p] + +def labels : Fin 4 ≃ S3 where + toFun | 0 => some root | 1 => some one | 2 => some two | 3 => none + invFun | some (some (some _)) => 0 | some (some none) => 1 | some none => 2 | none => 3 + left_inv i := by fin_cases i <;> rfl + right_inv i := by + cases i with + | none => rfl + | some j => cases j with + | none => rfl + | some k => cases k with + | none => rfl + | some u => cases u; rfl + +def sourceHom : GenericBraid.T K (Fin 4) →ₗ⁅K⁆ Env S3 := + (UniversalEnvelopingAlgebra.ι K).comp (GenericBraid.rename labels) + +@[simp] theorem sourceHom_t (i j : Fin 4) : sourceHom (GenericBraid.t i j)= + SourceEnveloping.chord (labels i) (labels j) := by + simp [sourceHom,SourceEnveloping.chord] +@[simp] theorem sourceHom_01 : sourceHom (GenericBraid.t 0 1)=X1 := by + rw [sourceHom_t] + exact baseX_zero.symm +@[simp] theorem sourceHom_02 : sourceHom (GenericBraid.t 0 2)=X2 := by + rw [sourceHom_t] + exact baseX_one.symm +@[simp] theorem sourceHom_12 : sourceHom (GenericBraid.t 1 2)=U12 := by + rw [sourceHom_t] + exact baseU_eq.symm +@[simp] theorem sourceHom_13 : sourceHom (GenericBraid.t 1 3)=U13 := by + rw [sourceHom_t] + change SourceEnveloping.chord (some one) none=rawFiber (CountTables.Y 0) + rw [rawFiber_Y] + exact SourceEnveloping.chord_comm _ _ +@[simp] theorem sourceHom_23 : sourceHom (GenericBraid.t 2 3)=U23 := by + rw [sourceHom_t] + change SourceEnveloping.chord (some two) none=rawFiber (CountTables.Y 1) + rw [rawFiber_Y] + exact SourceEnveloping.chord_comm _ _ + +theorem eval_quadratic {ψ : FreeLieAlgebra K Bool} {p : A K Slot} + (hrep : embed ψ=quad p) (a b : Env S3) : + BaseChangeEquations.eval a b ψ=quadEval a b p := by + rw [← show algEval a b (embed ψ)=BaseChangeEquations.eval a b ψ from + AssociativeEvaluation.lift_embed _ ψ,hrep] + exact AlgHom.congr_fun (algEval_quad a b) p + +theorem full_zero {ψ : FreeLieAlgebra K Bool} {p : A K Slot} + (hrep : embed ψ=quad p) (hpent : BaseChangeEquations.pentagon ψ=0) : + interpretation (full p)=0 := by + have h := congrArg sourceHom hpent + simp only [BaseChangeEquations.pentagon,map_sub,map_add,map_zero,AssociativeEvaluation.map_eval, + sourceHom_01,sourceHom_02,sourceHom_12,sourceHom_13,sourceHom_23, + CharTwo.sub_eq_add,eval_quadratic hrep] at h + rw [full_interpretation] + exact h + +end ExactPentagon +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Pentagon.lean b/lean/OAI/Algebra/Drinfeld/Pentagon.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6086023e273db1c2bf2739488e69c30110c4408 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Pentagon.lean @@ -0,0 +1,591 @@ +import OAI.Algebra.Drinfeld.Holonomy + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld.FourFrames +open FinitePicard KZCollar KZRectangle StraightKZ +attribute [local instance] LieRing.ofAssociativeRing +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] [CompleteSpace A] [FiniteDimensional ℝ A] +variable (F : NilpotentFiltration A) (j : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ A) + (hc : ∀ i,chords j i∈F.space 1) + +include hc in +theorem corner_reverse (p : Fin 4 → ℝ) (k l : Fin 5) : + Ring.inverse (Ring.inverse (corner F j p k)*corner F j p l)= + Ring.inverse (corner F j p l)*corner F j p k := by + rw [Ring.inverse_mul (Or.inr (corner_isUnit F j hc p l)), + Ring.inverse_inverse (corner_isUnit F j hc p k)] + +include hc in +theorem DE_insertion {p : Fin 4 → ℝ} (hp : StrictMono p) : + Ring.inverse (corner F j p 4)*corner F j p 3= + associator F (chords j 0) (chords j 3+chords j 4) := by + rw [←corner_reverse F j hc p 3 4,ED_insertion F j hc hp,add_comm (chords j 4), + associator_swap F (hc 0) ((F.space 1).add_mem (hc 3) (hc 4)), + Ring.inverse_inverse (associator_isUnit F (hc 0) ((F.space 1).add_mem (hc 3) (hc 4)))] + +include hc in +theorem CE_insertion {p : Fin 4 → ℝ} (hp : StrictMono p) : + Ring.inverse (corner F j p 4)*corner F j p 2=associator F (chords j 3) (chords j 5) := by + rw [←corner_reverse F j hc p 2 4,EC_insertion F j hc hp, + associator_swap F (hc 3) (hc 5),Ring.inverse_inverse (associator_isUnit F (hc 3) (hc 5))] + +include hc in + +theorem associator_pentagon : + associator F (chords j 0) (chords j 3+chords j 4)* + associator F (chords j 1+chords j 3) (chords j 5)= + associator F (chords j 3) (chords j 5)* + associator F (chords j 0+chords j 1) (chords j 4+chords j 5)* + associator F (chords j 0) (chords j 3) := by + let p : Fin 4 → ℝ := fun i => (i:ℕ) + have hp : StrictMono p := by + intro i k hik + change ((i:ℕ):ℝ)<((k:ℕ):ℝ) + exact_mod_cast hik + rw [←DE_insertion F j hc hp,←AD_insertion F j hc hp,←CE_insertion F j hc hp, + ←BC_insertion F j hc hp,←AB_insertion F j hc hp, + corner_cocycle F j hc p 4 3 0,corner_cocycle F j hc p 4 2 1, + corner_cocycle F j hc p 4 1 0] + +end DeligneDrinfeld.FourFrames + +namespace RealDeligneDrinfeld.KZBraidPentagon +open DeligneDrinfeld DeligneDrinfeld.FinitePicard DeligneDrinfeld.KZCollar +open BraidInsertionExp T4Basic +attribute [local instance] LieRing.ofAssociativeRing +local instance (N : ℕ) : NormedRing (BraidCutoff.Q N) := FiniteAlgebraNorm.normedRing _ +local instance (N : ℕ) : NormedAlgebra ℝ (BraidCutoff.Q N) := FiniteAlgebraNorm.normedAlgebra _ +def F (N : ℕ) : NilpotentFiltration (BraidCutoff.Q N) where + space := BraidCutoff.F N + antitone := TruncatedWords.filtration_antitone _ N + one_mem := TruncatedWords.filtration_one _ N + mul_mem := TruncatedWords.filtration_mul _ N + cutoff := N + terminal := TruncatedWords.filtration_terminal _ N + +def generic (N : ℕ) (s : ℝ) : GenericBraid.T ℝ (Fin 4) →ₗ⁅ℝ⁆ BraidCutoff.Q N := + GenericBraid.lift (fun i j => s • BraidCutoff.lieMap N (t i j)) + (by intro i; rw [t_self,map_zero,smul_zero]) + (by intro i j; rw [t_comm i j]) + (by + intro i j k l hik hil hjk hjl + by_cases hij : i=j + · subst j; rw [t_self,map_zero,smul_zero,zero_lie] + by_cases hkl : k=l + · subst l; rw [t_self,map_zero,smul_zero,lie_zero] + rw [smul_lie,lie_smul,←LieHom.map_lie,t_disjoint i j k l hij hik hil hjk hjl hkl,map_zero,smul_zero,smul_zero]) + (by intro i j k hij hik hjk + rw [←smul_add,←map_add,smul_lie,lie_smul,←LieHom.map_lie,t_three i j k hij hik hjk,map_zero,smul_zero,smul_zero]) +@[simp] theorem generic_t (N : ℕ) (s : ℝ) (i j : Fin 4) : + generic N s (GenericBraid.t i j)=s • BraidCutoff.lieMap N (t i j) := GenericBraid.lift_t _ _ _ _ _ _ _ +theorem chords_mem (N : ℕ) (s : ℝ) (i : Fin 6) : KZRectangle.chords (generic N s) i∈(F N).space 1 := by + fin_cases i <;> simp only [KZRectangle.chords,generic_t] <;> + exact Submodule.smul_mem _ s (BraidCutoff.t_mem N _ _) +theorem insert_associator (N : ℕ) (s : ℝ) (X Y : T4) (hX hY) : + insert N X Y hX hY (associator (CutoffKZ.weight N) (s • CutoffKZ.X N) (s • CutoffKZ.Y N))= + associator (F N) (s • BraidCutoff.lieMap N X) (s • BraidCutoff.lieMap N Y) := by + rw [map_associator (insert N X Y hX hY) (CutoffKZ.weight N) (F N) rfl + (Submodule.smul_mem _ s (CutoffDepth.gen_weight N false)) + (Submodule.smul_mem _ s (CutoffDepth.gen_weight N true)),map_smul,map_smul] + rw [show insert N X Y hX hY (CutoffKZ.X N)=BraidCutoff.lieMap N X from insert_gen N X Y hX hY false, + show insert N X Y hX hY (CutoffKZ.Y N)=BraidCutoff.lieMap N Y from insert_gen N X Y hX hY true] +theorem pentagon (N : ℕ) (s : ℝ) : + let u := associator (CutoffKZ.weight N) (s • CutoffKZ.X N) (s • CutoffKZ.Y N) + IDE N u*IAD N u=ICE N u*IBC N u*IAB N u := by + dsimp only + let u := associator (CutoffKZ.weight N) (s • CutoffKZ.X N) (s • CutoffKZ.Y N) + have hDE : IDE N u=associator (F N) (s • BraidCutoff.lieMap N a) (s • BraidCutoff.lieMap N (b+e)) := insert_associator N s _ _ _ _ + have hAD : IAD N u=associator (F N) (s • BraidCutoff.lieMap N (d+b)) (s • BraidCutoff.lieMap N c) := insert_associator N s _ _ _ _ + have hCE : ICE N u=associator (F N) (s • BraidCutoff.lieMap N b) (s • BraidCutoff.lieMap N c) := insert_associator N s _ _ _ _ + have hBC : IBC N u=associator (F N) (s • BraidCutoff.lieMap N (a+d)) (s • BraidCutoff.lieMap N (e+c)) := insert_associator N s _ _ _ _ + have hAB : IAB N u=associator (F N) (s • BraidCutoff.lieMap N a) (s • BraidCutoff.lieMap N b) := insert_associator N s _ _ _ _ + change IDE N u*IAD N u=ICE N u*IBC N u*IAB N u + rw [hDE,hAD,hCE,hBC,hAB] + have hh := FourFrames.associator_pentagon (F N) (generic N s) (chords_mem N s) + simpa [KZRectangle.chords,KZRectangle.edges,smul_add,a,b,c,d,e] using hh + theorem positive (N : ℕ) : IDE N (KZComparison.positive N)*IAD N (KZComparison.positive N)= + ICE N (KZComparison.positive N)*IBC N (KZComparison.positive N)*IAB N (KZComparison.positive N) := by + simpa only [one_smul,KZComparison.positive_val] using pentagon N 1 + theorem negative (N : ℕ) : IDE N (KZComparison.negative N)*IAD N (KZComparison.negative N)= + ICE N (KZComparison.negative N)*IBC N (KZComparison.negative N)*IAB N (KZComparison.negative N) := by + simpa only [neg_one_smul,KZComparison.negative_val] using pentagon N (-1) +end RealDeligneDrinfeld.KZBraidPentagon + +namespace DeligneDrinfeld.EulerPBW +variable {R L : Type*} [CommRing R] [LieRing L] [LieAlgebra R L] +attribute [local instance] LieRing.ofAssociativeRing + +def affine (D : LieDerivation R L L) (a : L) : Module.End R (L × R) where + toFun v := (⁅a,v.1⁆+v.2 • D a,0) + map_add' v w := by ext <;> simp only [Prod.fst_add,Prod.snd_add,lie_add,add_smul] <;> abel + map_smul' c v := by + apply Prod.ext + · change ⁅a,c • v.1⁆+(c*v.2) • D a=c • (⁅a,v.1⁆+v.2 • D a) + rw [lie_smul,smul_add,smul_smul] + · change (0:R)=c*0 + exact (mul_zero c).symm + +@[simp] theorem affine_apply (D : LieDerivation R L L) (a v : L) (c : R) : + affine D a (v,c)=(⁅a,v⁆+c • D a,0) := rfl + +def affineHom (D : LieDerivation R L L) : L →ₗ⁅R⁆ Module.End R (L × R) where + toFun := affine D + map_add' a b := by + apply LinearMap.ext + intro v + apply Prod.ext + · change ⁅a+b,v.1⁆+v.2 • D (a+b)=(⁅a,v.1⁆+v.2 • D a)+(⁅b,v.1⁆+v.2 • D b) + rw [add_lie,map_add,smul_add] + abel + · change (0:R)=0+0 + exact (add_zero _).symm + map_smul' c a := by + apply LinearMap.ext + intro v + apply Prod.ext + · change ⁅c • a,v.1⁆+v.2 • D (c • a)=c • (⁅a,v.1⁆+v.2 • D a) + rw [smul_lie,map_smul,smul_add,smul_comm v.2 c] + · change (0:R)=c*0 + exact (mul_zero c).symm + map_lie' := by + intro a b + apply LinearMap.ext + intro v + apply Prod.ext + · change ⁅⁅a,b⁆,v.1⁆+v.2 • D ⁅a,b⁆= + (⁅a,⁅b,v.1⁆+v.2 • D b⁆+0 • D a)-(⁅b,⁅a,v.1⁆+v.2 • D a⁆+0 • D b) + simp only [zero_smul,add_zero,LieDerivation.apply_lie_eq_add,smul_add,lie_add,lie_smul] + rw [lie_lie,←lie_skew (D a) b,smul_neg] + abel + · change (0:R)=0-0 + exact (sub_self _).symm + +def dynkin (D : LieDerivation R L L) : UniversalEnvelopingAlgebra R L →ₗ[R] L := + (LinearMap.fst R L R).comp ((LinearMap.applyₗ (R:=R) (0,1)).comp + (UniversalEnvelopingAlgebra.lift R (affineHom D)).toLinearMap) + +@[simp] theorem dynkin_iota (D : LieDerivation R L L) (a : L) : + dynkin D (UniversalEnvelopingAlgebra.ι R a)=D a := by + change (UniversalEnvelopingAlgebra.lift R (affineHom D) + (UniversalEnvelopingAlgebra.ι R a) (0,1)).1=D a + rw [UniversalEnvelopingAlgebra.lift_ι_apply] + simp [affineHom,affine] + +theorem injective_iota (D : LieDerivation R L L) (hD : Function.Injective D) : + Function.Injective (UniversalEnvelopingAlgebra.ι R (L:=L)) := by + intro a b h + apply hD + simpa only [dynkin_iota] using congrArg (dynkin D) h + +end DeligneDrinfeld.EulerPBW + +namespace DeligneDrinfeld.LieCutoffFaithful +open AssociativeElimination WordGrading TruncatedWords TensorProduct +attribute [local instance] LieRing.ofAssociativeRing +variable {R α M : Type*} [CommRing R] [LieRing M] [LieAlgebra R M] +abbrev S (R : Type*) [CommRing R] (N : ℕ) := TruncatedWords.Q (∅ : Set (A R Unit)) N + +def z (N : ℕ) : S R N := quotient ∅ N (atom ()) + + theorem z_pow (N n : ℕ) : (z (R:=R) N)^n=quotient ∅ N (word ((FreeMonoid.of ())^n)) := by + induction n with + | zero => simp only [pow_zero,word_one,map_one] + | succ n ih => rw [pow_succ,pow_succ,word_mul,map_mul,←ih,word_of]; rfl + theorem z_pow_zero {N n : ℕ} (hn : N simp + | succ n ih => rw [pow_succ,degree_mul,ih,degree_of] + rw [hd] + omega + +variable {B : Type*} [Ring B] [Algebra R B] +def lift (N : ℕ) (g : α → B) : A R α →ₐ[R] (S R N ⊗[R] B) := + AssociativeElimination.lift (R:=R) (B:=S R N ⊗[R] B) (fun a => z N ⊗ₜ[R] g a) + + @[simp] theorem lift_atom (N : ℕ) (g : α → B) (a : α) : lift (R:=R) N g (atom a)=z N ⊗ₜ[R] g a := by + unfold lift + exact AssociativeElimination.lift_atom (R:=R) (B:=S R N ⊗[R] B) _ a + + theorem lift_word (N : ℕ) (g : α → B) (w : FreeMonoid α) : + lift N g (word w)=(z (R:=R) N ^ (degree wt w)) ⊗ₜ[R] AssociativeElimination.lift (R:=R) g (word w) := by + induction w using FreeMonoid.inductionOn' with + | one => simp only [word_one,map_one,degree_one,pow_zero,Algebra.TensorProduct.one_def] + | of_mul a w ih => + simp only [word_mul,word_of,map_mul,lift_atom,AssociativeElimination.lift_atom,ih,degree_mul,degree_of] + rw [Algebra.TensorProduct.tmul_mul_tmul,←pow_succ'] + simp only [wt,Nat.add_comm 1] + + theorem lift_above (N : ℕ) (g : α → B) {p : A R α} (hp : p∈above wt (N+1)) : lift N g p=0 := by + have hh : lift N g p∈(⊥ : Submodule R (_)) := map_space (lift N g).toLinearMap _ (fun w hw => by + change lift N g (word w)=0 + rw [lift_word,z_pow_zero (by omega),zero_tmul]) hp + exact hh + +variable [Algebra ℝ B] + + theorem lift_weight {wtL : α → ℕ} (hwt : ∀ a,wtL a=1) (N : ℕ) (g : α → B) + {n : ℕ} {p : FreeLieAlgebra ℝ α} + (hp : RealDeligneDrinfeld.WeightedWord wtL n p) : + lift (R:=ℝ) N g (embed p)=(z (R:=ℝ) N ^ n) ⊗ₜ[ℝ] FreeLieAlgebra.lift ℝ g p := by + induction hp with + | generator a => + rw [embed_of] + simp only [LieCutoffFaithful.lift,AssociativeElimination.lift_atom,FreeLieAlgebra.lift_of_apply,hwt,pow_one] + | @bracket n m a b ha hb ia ib => + rw [LieHom.map_lie] + change lift (R:=ℝ) N g (embed _*embed _-embed _*embed _)=_ + rw [map_sub,map_mul,map_mul,ia,ib,Algebra.TensorProduct.tmul_mul_tmul, + Algebra.TensorProduct.tmul_mul_tmul,←pow_add,←pow_add,Nat.add_comm m n] + rw [←tmul_sub,LieHom.map_lie,Ring.lie_def] + + theorem lift_piece (N : ℕ) (g : α → B) {n : ℕ} {p : FreeLieAlgebra ℝ α} + (hp : p∈RealDeligneDrinfeld.weightPiece (fun _ : α => 1) n) : + lift (R:=ℝ) N g (embed p)=(z (R:=ℝ) N ^ n) ⊗ₜ[ℝ] FreeLieAlgebra.lift ℝ g p := by + apply Submodule.span_induction (p:=fun p _ => lift (R:=ℝ) N g (embed p)= + (z (R:=ℝ) N ^ n) ⊗ₜ[ℝ] FreeLieAlgebra.lift ℝ g p) ?_ ?_ ?_ ?_ hp + · intro p hp; exact lift_weight (fun _ => rfl) N g hp + · simp only [map_zero,tmul_zero] + · intro p q _ _ hp hq; simp only [map_add,hp,hq,tmul_add] + · intro s p _ hp; simp only [map_smul,hp,tmul_smul] + + theorem coefficient_z_pow {N n : ℕ} (hn : n≤N) : + TruncatedFree.coefficient N ((FreeMonoid.of ())^n) (z (R:=ℝ) N ^ n)=1 := by + rw [z_pow,TruncatedFree.coefficient_quotient] + have hd : degree (wt : Unit → ℕ) ((FreeMonoid.of ())^n)=n := by + clear hn + induction n with + | zero => simp + | succ n ih => rw [pow_succ,degree_mul,ih,degree_of] + simp only [hd,ite_eq_left hn,word,MonoidAlgebra.coeff_single,Finsupp.single_eq_same] + + def extract (N n : ℕ) : S ℝ N ⊗[ℝ] B →ₗ[ℝ] B := + (TensorProduct.lid ℝ B).toLinearMap.comp + (TensorProduct.map (TruncatedFree.coefficient N ((FreeMonoid.of ())^n)) (LinearMap.id)) + + theorem extract_tmul {N n : ℕ} (hn : n≤N) (b : B) : + extract N n ((z (R:=ℝ) N ^ n) ⊗ₜ[ℝ] b)=b := by + change TruncatedFree.coefficient N ((FreeMonoid.of ())^n) (z (R:=ℝ) N ^ n) • b=b + rw [coefficient_z_pow hn,one_smul] + +end DeligneDrinfeld.LieCutoffFaithful + +namespace RealDeligneDrinfeld.AffineWeight +variable {M : Type*} [LieRing M] [LieAlgebra ℝ M] +attribute [local instance] LieRing.ofAssociativeRing + +def op (a b : M) : Module.End ℝ (M × ℝ) where + toFun v := (⁅a,v.1⁆+v.2 • b,0) + map_add' v w := by ext <;> simp only [Prod.fst_add,Prod.snd_add,lie_add,add_smul] <;> abel + map_smul' c v := by + apply Prod.ext + · change ⁅a,c • v.1⁆+(c*v.2) • b=c • (⁅a,v.1⁆+v.2 • b) + rw [lie_smul,smul_add,smul_smul] + · change (0:ℝ)=c*0 + exact (mul_zero c).symm + + theorem op_lie (a b c d : M) : ⁅op a b,op c d⁆=op ⁅a,c⁆ (⁅b,c⁆+⁅a,d⁆) := by + apply LinearMap.ext + intro v + apply Prod.ext + · change (⁅a,⁅c,v.1⁆+v.2 • d⁆+0 • b)-(⁅c,⁅a,v.1⁆+v.2 • b⁆+0 • d)= + ⁅⁅a,c⁆,v.1⁆+v.2 • (⁅b,c⁆+⁅a,d⁆) + simp only [zero_smul,add_zero,smul_add,lie_add,lie_smul] + rw [lie_lie,←lie_skew b c,smul_neg] + abel + · change (0:ℝ)-0=0 + exact sub_self _ + + def homogeneous (n : ℕ) : M →ₗ[ℝ] Module.End ℝ (M×ℝ) where + toFun a := op a ((n:ℝ) • a) + map_add' a b := by + apply LinearMap.ext + intro v + apply Prod.ext + · change ⁅a+b,v.1⁆+v.2 • ((n:ℝ) • (a+b))= + (⁅a,v.1⁆+v.2 • ((n:ℝ) • a))+(⁅b,v.1⁆+v.2 • ((n:ℝ) • b)) + simp only [add_lie,smul_add]; abel + · change (0:ℝ)=0+0; simp + map_smul' s a := by + apply LinearMap.ext + intro v + apply Prod.ext + · change ⁅s • a,v.1⁆+v.2 • ((n:ℝ) • (s • a))=s • (⁅a,v.1⁆+v.2 • ((n:ℝ) • a)) + rw [smul_lie,smul_add,smul_comm (n:ℝ) s,smul_comm v.2 s] + · change (0:ℝ)=s*0; simp + + theorem homogeneous_lie (n m : ℕ) (a b : M) : + homogeneous (n+m) ⁅a,b⁆=⁅homogeneous n a,homogeneous m b⁆ := by + change op ⁅a,b⁆ (((n+m:ℕ):ℝ) • ⁅a,b⁆)=⁅op a ((n:ℝ) • a),op b ((m:ℝ) • b)⁆ + rw [op_lie,smul_lie,lie_smul,Nat.cast_add,add_smul] + + variable {α : Type*} + def representation (f : α → M) : FreeLieAlgebra ℝ α →ₗ⁅ℝ⁆ Module.End ℝ (M×ℝ) := + FreeLieAlgebra.lift ℝ (fun a => homogeneous 1 (f a)) + + theorem word_rep (f : α → M) {n : ℕ} {p : FreeLieAlgebra ℝ α} + (hp : WeightedWord (fun _ : α => 1) n p) : + representation f p=homogeneous n (FreeLieAlgebra.lift ℝ f p) := by + induction hp with + | generator a => simp only [representation,FreeLieAlgebra.lift_of_apply] + | bracket ha hb ia ib => rw [LieHom.map_lie,ia,ib,LieHom.map_lie,homogeneous_lie] + + theorem weight_rep (f : α → M) {n : ℕ} {p : FreeLieAlgebra ℝ α} + (hp : p∈weightPiece (fun _ : α => 1) n) : + representation f p=homogeneous n (FreeLieAlgebra.lift ℝ f p) := by + apply Submodule.span_induction (p:=fun p _ => representation f p=homogeneous n (FreeLieAlgebra.lift ℝ f p)) ?_ ?_ ?_ ?_ hp + · intro p hp; exact word_rep f hp + · simp only [map_zero] + · intro p q _ _ hp hq; simp only [map_add,hp,hq] + · intro s p _ hp; simp only [map_smul,hp] + + theorem homogeneous_injective {n : ℕ} (hn : 0 (F (0,1)).1) h + change ⁅p,0⁆+(1:ℝ) • ((n:ℝ) • p)=⁅q,0⁆+(1:ℝ) • ((n:ℝ) • q) at hh + simp only [lie_zero,one_smul,zero_add] at hh + exact (smul_right_injective M (by exact_mod_cast (Nat.ne_of_gt hn) : (n:ℝ)≠0)) hh + +end RealDeligneDrinfeld.AffineWeight + +namespace RealDeligneDrinfeld.BraidCutoff +open DeligneDrinfeld.AssociativeElimination DeligneDrinfeld.WordGrading +open DeligneDrinfeld.TruncatedWords DeligneDrinfeld.LieCutoffFaithful +open scoped TensorProduct +attribute [local instance] LieRing.ofAssociativeRing +abbrev Piece (n : ℕ) := weightPiece (fun _ : Edge => 1) n + theorem of_mem (a : Edge) : FreeLieAlgebra.of ℝ a∈Piece 1 := + Submodule.subset_span (WeightedWord.generator _) + theorem chord_mem (i j : Fin 4) : chord i j∈Piece 1 := by + unfold chord + split_ifs + · exact of_mem _ + · exact of_mem _ + · exact Submodule.zero_mem _ + theorem piece_lie {n m : ℕ} {a b : BraidFree} (ha : a∈Piece n) (hb : b∈Piece m) : ⁅a,b⁆∈Piece (n+m) := by + apply Submodule.span_induction (p:=fun a _ => ⁅a,b⁆∈Piece (n+m)) ?_ ?_ ?_ ?_ ha + · intro a ha + apply Submodule.span_induction (p:=fun b _ => ⁅a,b⁆∈Piece (n+m)) ?_ ?_ ?_ ?_ hb + · intro b hb; exact Submodule.subset_span (WeightedWord.bracket ha hb) + · rw [lie_zero]; exact Submodule.zero_mem _ + · intro a b _ _ ha hb; rw [lie_add]; exact Submodule.add_mem _ ha hb + · intro s b _ hb; rw [lie_smul]; exact Submodule.smul_mem _ s hb + · rw [zero_lie]; exact Submodule.zero_mem _ + · intro a b _ _ ha hb; rw [add_lie]; exact Submodule.add_mem _ ha hb + · intro s a _ ha; rw [smul_lie]; exact Submodule.smul_mem _ s ha + theorem relation_piece {p : BraidFree} (hp : p∈braidRelations) : p∈Piece 2 := by + rcases hp with ⟨i,j,k,l,_,_,_,_,_,_,rfl⟩|⟨i,j,k,_,_,_,rfl⟩ + · exact piece_lie (n:=1) (m:=1) (chord_mem i j) (chord_mem k l) + · exact piece_lie (n:=1) (m:=1) (chord_mem i j) ((Piece 1).add_mem (chord_mem i k) (chord_mem j k)) + + def affineGenerators (a : Edge) : Module.End ℝ (T4×ℝ) := AffineWeight.homogeneous 1 (projection (FreeLieAlgebra.of ℝ a)) + theorem projection_eq : FreeLieAlgebra.lift ℝ (fun a : Edge => projection (FreeLieAlgebra.of ℝ a))=projection := by + apply FreeLieAlgebra.hom_ext + intro a + exact FreeLieAlgebra.lift_of_apply _ a + theorem affine_weight {n : ℕ} {p : BraidFree} (hp : p∈Piece n) : + FreeLieAlgebra.lift ℝ affineGenerators p=AffineWeight.homogeneous n (projection p) := by + have hh := AffineWeight.weight_rep (fun a : Edge => projection (FreeLieAlgebra.of ℝ a)) hp + rw [projection_eq] at hh + exact hh + + def representation (N : ℕ) : Q N →ₐ[ℝ] (DeligneDrinfeld.LieCutoffFaithful.S ℝ N ⊗[ℝ] Module.End ℝ (T4×ℝ)) := + RingQuot.liftAlgHom ℝ ⟨DeligneDrinfeld.LieCutoffFaithful.lift N affineGenerators,by + rintro p q ⟨rfl,hp⟩ + rw [map_zero] + rcases hp with ⟨p,hp,rfl⟩|hp + · rw [lift_piece N affineGenerators (relation_piece hp),affine_weight (relation_piece hp),projection_relation hp,map_zero,TensorProduct.tmul_zero] + · exact lift_above N affineGenerators hp⟩ + + theorem representation_quotient (N : ℕ) (p : DeligneDrinfeld.AssociativeElimination.A ℝ Edge) : + representation N (quotient presentation N p)=DeligneDrinfeld.LieCutoffFaithful.lift N affineGenerators p := by + simp only [representation,quotient,RingQuot.liftAlgHom_mkAlgHom_apply] + + theorem detect {N n : ℕ} (hn : 0 1) (fun _ => 1) _ hp + intro i + cases i + · simpa only [eval,FreeLieAlgebra.lift_of_apply,Bool.false_eq_true,↓reduceIte] using ha + · simpa only [eval,FreeLieAlgebra.lift_of_apply,↓reduceIte] using hb + theorem homogeneous {n : ℕ} {p : L} (hp : p∈Ln n) : value p∈Piece n := by + apply (Piece n).sub_mem + · exact (Piece n).add_mem (eval_mem hp (chord_mem _ _) ((Piece 1).add_mem (chord_mem _ _) (chord_mem _ _))) + (eval_mem hp ((Piece 1).add_mem (chord_mem _ _) (chord_mem _ _)) (chord_mem _ _)) + · exact (Piece n).add_mem ((Piece n).add_mem (eval_mem hp (chord_mem _ _) (chord_mem _ _)) + (eval_mem hp ((Piece 1).add_mem (chord_mem _ _) (chord_mem _ _)) ((Piece 1).add_mem (chord_mem _ _) (chord_mem _ _)))) + (eval_mem hp (chord_mem _ _) (chord_mem _ _)) + theorem projection_chord (i j : Fin 4) : projection (chord i j)=t i j := rfl + theorem projection_eval (a b : BraidFree) (p : L) : projection (eval a b p)=eval (projection a) (projection b) p := by + have he : projection.comp (eval a b)=eval (projection a) (projection b) := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [eval] + exact LieHom.congr_fun he p + theorem detect {n : ℕ} (hn : 0 + by_cases hN : N≤2 + · rw [q_low hN]; exact Submodule.zero_mem _ + have hN' : 2 if 2 < i.val then i.val else 3 + have hn : ∀ i,2 omega + have hqn : ∀ i : Fin N,q i.val∈Ln (ns i) := by + intro i + dsimp [ns] + split_ifs with hi + · exact q_homogeneous _ + · rw [q_low (by omega)]; exact Submodule.zero_mem _ + have hq : ∀ i : Fin N,q i.val∈W := fun i => ih i.val i.isLt + have hsum : (∑ i : Fin N,q i.val)=∑ i∈Finset.range N,q i := Fin.sum_univ_eq_sum_range q N + let g := BraidInsertionSum.free N Finset.univ (fun i : Fin N => q i.val) ns hqn + let u := CategoryExp.act g 0 1 (KZComparison.positive N) + have hd : KZComparison.value N-FreeCutoffCategory.j N (∑ i : Fin N,q i.val)=FreeCutoffCategory.j N (q N) := by + rw [hsum,residual_top] + have hj := FreeCutoffCategory.j_mem (N:=N) (q_homogeneous N) + have hex := KZLogDifference.exponential N Finset.univ (fun i : Fin N => q i.val) ns hqn hn N (by rw [hd]; exact hj) + change _ ∈filtration (∅:Set (A ℝ Bool)) N (N+1) at hex + rw [filtration_terminal,Submodule.mem_bot,hd] at hex + have hdiff : (KZComparison.negative N:FreeCutoffCategory.Q N)-u=FreeCutoffCategory.j N (q N) := sub_eq_zero.mp hex + have hp := BraidInsertionSum.pentagon N Finset.univ (fun i : Fin N => q i.val) ns hq hqn hn _ (KZBraidPentagon.positive N) + have hu : u-1∈FreeCutoffCategory.F N 1 := by + have hr := BraidInsertionSum.free_raises N Finset.univ (fun i : Fin N => q i.val) ns hqn hn 0 1 + have hh := CategoryExp.unit_leading (CutoffCategory.filtration ∅ N) (g.D 0 1) 1 hr (by omega) + (filtration_one ∅ N) (KZComparison.positive_weight N) + have hd1 := hr 0 1 (filtration_one ∅ N) + have hh' := filtration_antitone (∅:Set (A ℝ Bool)) N (by omega : 1≤1+1) hh + have hz := (FreeCutoffCategory.F N 1).add_mem ((FreeCutoffCategory.F N 1).add_mem hh' hd1) (KZComparison.positive_weight N) + convert hz using 1 + dsimp [u,CategoryExp.act] + abel + have hh := linear_pentagon_difference N u (KZComparison.negative N) hu (KZComparison.negative_weight N) + (by rw [hdiff]; exact hj) hp (KZBraidPentagon.negative N) + rw [hdiff] at hh + exact ⟨anti N,cyclic N,PentagonDetect.detect (by omega) (q_homogeneous N) hh⟩ +end RealDeligneDrinfeld.KZHomogeneous + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/RealBraid.lean b/lean/OAI/Algebra/Drinfeld/RealBraid.lean new file mode 100644 index 0000000000000000000000000000000000000000..5cf1a1181102b88df0858eca8f9c48452c9a61e4 --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/RealBraid.lean @@ -0,0 +1,902 @@ +import OAI.Algebra.Drinfeld.Coefficients + +namespace OAI + +noncomputable section + +namespace RealDeligneDrinfeld.BraidSix +variable {M : Type*} [LieRing M] + +def total (a b c d e f : M) : M := a+b+c+d+e+f + +def matrix (a b c d e f : M) : Fin 4 → Fin 4 → M := + ![![0,a,d,f],![a,0,b,e],![d,b,0,c],![f,e,c,0]] + +structure Relations (a b c d e f : M) : Prop where + central : ∀ u∈({a,b,c,d,e,f}:Set M),⁅u,total a b c d e f⁆=0 + ac : ⁅a,c⁆=0 + de : ⁅d,e⁆=0 + aK : ⁅a,a+b+d⁆=0 + bK : ⁅b,a+b+d⁆=0 + bL : ⁅b,b+c+e⁆=0 + cL : ⁅c,b+c+e⁆=0 + +variable {a b c d e f : M} + +theorem bf (h : Relations a b c d e f) : ⁅b,f⁆=0 := by + calc + _=⁅b,total a b c d e f⁆-⁅b,a+b+d⁆-⁅b,b+c+e⁆ := by + simp only [total,lie_add,lie_self] + abel + _=0 := by rw [h.central b (by simp),h.bK,h.bL]; abel + +theorem dK (h : Relations a b c d e f) : ⁅d,a+b+d⁆=0 := by + have hh := lie_self (a+b+d) + rw [add_lie,add_lie,h.aK,h.bK] at hh + simpa only [zero_add] using hh + +theorem eL (h : Relations a b c d e f) : ⁅e,b+c+e⁆=0 := by + have hh := lie_self (b+c+e) + rw [add_lie,add_lie,h.bL,h.cL] at hh + simpa only [zero_add] using hh + +theorem aM (h : Relations a b c d e f) : ⁅a,a+e+f⁆=0 := by + calc + _=⁅a,total a b c d e f⁆-⁅a,a+b+d⁆-⁅a,c⁆ := by + simp only [total,lie_add,lie_self]; abel + _=0 := by rw [h.central a (by simp),h.aK,h.ac]; abel + +theorem eM (h : Relations a b c d e f) : ⁅e,a+e+f⁆=0 := by + calc + _=⁅e,total a b c d e f⁆-⁅e,b+c+e⁆+⁅d,e⁆ := by + simp only [total,lie_add,lie_self] + rw [←lie_skew d e] + abel + _=0 := by rw [h.central e (by simp),eL h,h.de]; abel + +theorem fM (h : Relations a b c d e f) : ⁅f,a+e+f⁆=0 := by + have hh := lie_self (a+e+f) + rw [add_lie,add_lie,aM h,eM h] at hh + simpa only [zero_add] using hh + +theorem dP (h : Relations a b c d e f) : ⁅d,d+c+f⁆=0 := by + calc + _=⁅d,total a b c d e f⁆-⁅d,a+b+d⁆-⁅d,e⁆ := by + simp only [total,lie_add,lie_self]; abel + _=0 := by rw [h.central d (by simp),dK h,h.de]; abel + +theorem cP (h : Relations a b c d e f) : ⁅c,d+c+f⁆=0 := by + calc + _=⁅c,total a b c d e f⁆-⁅c,b+c+e⁆+⁅a,c⁆ := by + simp only [total,lie_add,lie_self] + rw [←lie_skew a c] + abel + _=0 := by rw [h.central c (by simp),h.cL,h.ac]; abel + +theorem fP (h : Relations a b c d e f) : ⁅f,d+c+f⁆=0 := by + have hh := lie_self (d+c+f) + rw [add_lie,add_lie,dP h,cP h] at hh + simpa only [zero_add] using hh + +theorem matrix_self (i : Fin 4) : matrix a b c d e f i i=0 := by + fin_cases i <;> rfl + +theorem matrix_symm (i j : Fin 4) : matrix a b c d e f i j=matrix a b c d e f j i := by + fin_cases i <;> fin_cases j <;> rfl + +theorem matrix_disjoint_0 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (0:Fin 4)≠k) (hil : (0:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 0 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint_1 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (1:Fin 4)≠k) (hil : (1:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 1 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint_2 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (2:Fin 4)≠k) (hil : (2:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 2 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint_3 (h : Relations a b c d e f) (j k l : Fin 4) + (hik : (3:Fin 4)≠k) (hil : (3:Fin 4)≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f 3 j,matrix a b c d e f k l⁆=0 := by + have hac := h.ac + have hde := h.de + have hbf := bf h + have hca := commute_symm h.ac + have hed := commute_symm h.de + have hfb := commute_symm (bf h) + fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp_all [matrix] + +theorem matrix_disjoint (h : Relations a b c d e f) (i j k l : Fin 4) + (hik : i≠k) (hil : i≠l) (hjk : j≠k) (hjl : j≠l) : + ⁅matrix a b c d e f i j,matrix a b c d e f k l⁆=0 := by + fin_cases i + · exact matrix_disjoint_0 h j k l hik hil hjk hjl + · exact matrix_disjoint_1 h j k l hik hil hjk hjl + · exact matrix_disjoint_2 h j k l hik hil hjk hjl + · exact matrix_disjoint_3 h j k l hik hil hjk hjl + +theorem matrix_three_0 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (0:Fin 4)≠j) (hik : (0:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 0 j,matrix a b c d e f 0 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three_1 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (1:Fin 4)≠j) (hik : (1:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 1 j,matrix a b c d e f 1 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three_2 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (2:Fin 4)≠j) (hik : (2:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 2 j,matrix a b c d e f 2 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three_3 (h : Relations a b c d e f) (j k : Fin 4) + (hij : (3:Fin 4)≠j) (hik : (3:Fin 4)≠k) (hjk : j≠k) : + ⁅matrix a b c d e f 3 j,matrix a b c d e f 3 k+matrix a b c d e f j k⁆=0 := by + have ha : ⁅a,b+d⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.aK + have hb : ⁅b,a+d⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.bK + have hd : ⁅d,a+b⁆=0 := by simpa only [lie_add,lie_self,add_zero] using dK h + have hb' : ⁅b,c+e⁆=0 := by simpa only [lie_add,lie_self,zero_add] using h.bL + have hc : ⁅c,b+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using h.cL + have he : ⁅e,b+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eL h + have ha' : ⁅a,e+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using aM h + have he' : ⁅e,a+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using eM h + have hf : ⁅f,a+e⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fM h + have hd' : ⁅d,c+f⁆=0 := by simpa only [lie_add,lie_self,zero_add] using dP h + have hc' : ⁅c,d+f⁆=0 := by simpa only [lie_add,lie_self,add_zero] using cP h + have hf' : ⁅f,d+c⁆=0 := by simpa only [lie_add,lie_self,add_zero] using fP h + fin_cases j <;> fin_cases k <;> + simp_all [matrix,add_comm] + +theorem matrix_three (h : Relations a b c d e f) (i j k : Fin 4) + (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + ⁅matrix a b c d e f i j,matrix a b c d e f i k+matrix a b c d e f j k⁆=0 := by + fin_cases i + · exact matrix_three_0 h j k hij hik hjk + · exact matrix_three_1 h j k hij hik hjk + · exact matrix_three_2 h j k hij hik hjk + · exact matrix_three_3 h j k hij hik hjk + +end RealDeligneDrinfeld.BraidSix + +namespace RealDeligneDrinfeld.T4Basic +open BraidSix + +def a : T4 := t 0 1 +def b : T4 := t 1 2 +def c : T4 := t 2 3 +def d : T4 := t 0 2 +def e : T4 := t 1 3 +def f : T4 := t 0 3 + + theorem induction {P : T4 → Prop} (hz : P 0) (ht : ∀ i j,P (t i j)) + (ha : ∀ p q,P p → P q → P (p+q)) (hs : ∀ (r : ℝ) p,P p → P (r • p)) + (hl : ∀ p q,P p → P q → P ⁅p,q⁆) (p : T4) : P p := by + induction p using Submodule.Quotient.induction_on with | _ p => + induction p using freeLie_induction with + | h0 => exact hz + | hg ij => + have hh : (FreeLieAlgebra.of ℝ ij : BraidFree)=chord ij.val.1 ij.val.2 := by + simp only [chord,dite_eq_left ij.property] + rw [hh] + exact ht _ _ + | ha p q hp hq => exact ha _ _ hp hq + | hs r p hp => exact hs r _ hp + | hl p q hp hq => exact hl _ _ hp hq + + theorem hom_ext {M : Type*} [LieRing M] [LieAlgebra ℝ M] {F G : T4 →ₗ⁅ℝ⁆ M} + (h : ∀ i j,F (t i j)=G (t i j)) : F=G := by + apply LieHom.ext + intro p + induction p using induction with + | hz => simp + | ht i j => exact h i j + | ha p q hp hq => simp only [map_add,hp,hq] + | hs r p hp => simp only [map_smul,hp] + | hl p q hp hq => simp only [LieHom.map_lie,hp,hq] + + theorem matrix_t (i j : Fin 4) : matrix a b c d e f i j=t i j := by + fin_cases i <;> fin_cases j <;> rfl + + theorem central_a : ⁅a,total a b c d e f⁆=0 := by + have h₁ := t_three 0 1 2 (by decide) (by decide) (by decide) + have h₂ := t_three 0 1 3 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 0 1 2 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 0 1,t 0 2+t 1 2⁆+⁅t 0 1,t 0 3+t 1 3⁆+⁅t 0 1,t 2 3⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_b : ⁅b,total a b c d e f⁆=0 := by + have h₁ := t_three 1 2 0 (by decide) (by decide) (by decide) + have h₂ := t_three 1 2 3 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 1 2 0 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 1 2,t 1 0+t 2 0⁆+⁅t 1 2,t 1 3+t 2 3⁆+⁅t 1 2,t 0 3⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 1 0,t_comm 2 0] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_c : ⁅c,total a b c d e f⁆=0 := by + have h₁ := t_three 2 3 0 (by decide) (by decide) (by decide) + have h₂ := t_three 2 3 1 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 2 3 0 1 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 2 3,t 2 0+t 3 0⁆+⁅t 2 3,t 2 1+t 3 1⁆+⁅t 2 3,t 0 1⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 2 0,t_comm 2 1,t_comm 3 0,t_comm 3 1] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_d : ⁅d,total a b c d e f⁆=0 := by + have h₁ := t_three 0 2 1 (by decide) (by decide) (by decide) + have h₂ := t_three 0 2 3 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 0 2 1 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 0 2,t 0 1+t 2 1⁆+⁅t 0 2,t 0 3+t 2 3⁆+⁅t 0 2,t 1 3⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 2 1] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_e : ⁅e,total a b c d e f⁆=0 := by + have h₁ := t_three 1 3 0 (by decide) (by decide) (by decide) + have h₂ := t_three 1 3 2 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 1 3 0 2 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 1 3,t 1 0+t 3 0⁆+⁅t 1 3,t 1 2+t 3 2⁆+⁅t 1 3,t 0 2⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 1 0,t_comm 3 0,t_comm 3 2] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central_f : ⁅f,total a b c d e f⁆=0 := by + have h₁ := t_three 0 3 1 (by decide) (by decide) (by decide) + have h₂ := t_three 0 3 2 (by decide) (by decide) (by decide) + have h₃ := t_disjoint 0 3 1 2 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + calc + _=⁅t 0 3,t 0 1+t 3 1⁆+⁅t 0 3,t 0 2+t 3 2⁆+⁅t 0 3,t 1 2⁆ := by + simp only [a,b,c,d,e,f,total,lie_add,lie_self,t_comm 3 1,t_comm 3 2] + abel + _=0 := by rw [h₁,h₂,h₃]; simp + + theorem central (p : T4) : ⁅total a b c d e f,p⁆=0 := by + induction p using induction with + | hz => exact lie_zero _ + | ht i j => + rw [←matrix_t i j] + have ha := commute_symm central_a + have hb := commute_symm central_b + have hc := commute_symm central_c + have hd := commute_symm central_d + have he := commute_symm central_e + have hf := commute_symm central_f + fin_cases i <;> fin_cases j <;> simp_all [matrix] + | ha p q hp hq => rw [lie_add,hp,hq,add_zero] + | hs r p hp => rw [lie_smul,hp,smul_zero] + | hl p q hp hq => rw [leibniz_lie,hp,hq,zero_lie,lie_zero,add_zero] + + theorem relations : Relations a b c d e f := by + constructor + · intro u _; exact commute_symm (central u) + · exact t_disjoint 0 1 2 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + · exact t_disjoint 0 2 1 3 (by decide) (by decide) (by decide) (by decide) (by decide) (by decide) + · have h := t_three 0 1 2 (by decide) (by decide) (by decide) + change ⁅t 0 1,t 0 1+t 1 2+t 0 2⁆=0 + simp only [lie_add,lie_self] at h ⊢ + rw [add_comm] at h + simpa only [zero_add] using h + · have h := t_three 1 2 0 (by decide) (by decide) (by decide) + simpa only [a,b,d,lie_add,lie_self,add_zero,t_comm 1 0,t_comm 2 0] using h + · have h := t_three 1 2 3 (by decide) (by decide) (by decide) + change ⁅t 1 2,t 1 2+t 2 3+t 1 3⁆=0 + simp only [lie_add,lie_self] at h ⊢ + rw [add_comm] at h + simpa only [zero_add] using h + · have h := t_three 2 3 1 (by decide) (by decide) (by decide) + simpa only [b,c,e,lie_add,lie_self,add_zero,t_comm 2 1,t_comm 3 1] using h + +end RealDeligneDrinfeld.T4Basic + +namespace RealDeligneDrinfeld.TangentBraid +open FreeDerivations BraidSix +variable {R M : Type*} [CommRing R] [LieRing M] [LieAlgebra R M] + +structure Data (a b c d e f A B C D E H I J P Q : M) : Prop where + base : BraidSix.Relations a b c d e f + central : ∀ u : M,⁅total a b c d e f,u⁆=0 + aD : ⁅a,D⁆=0 + bB : ⁅b,B⁆=0 + cE : ⁅c,E⁆=0 + KA : ⁅a+b+d,A⁆=0 + LC : ⁅b+c+e,C⁆=0 + special_d : ⁅b,A⁆+⁅d,A+H⁆=0 + special_e : ⁅c,C⁆+⁅e,C+I⁆=0 + cyclic : C+I=J + pentagon : D+E=A+B+C + permuted : P+Q= -H+B+J + dP : ⁅d,P⁆=0 + eQ : ⁅e,Q⁆=0 + +variable {a b c d e f A B C D E H I J P Q : M} + + theorem crossing {a b h k p q : M} (hab : ⁅a,b⁆=0) + (hk : k-h=p+q) (hap : ⁅a,p⁆=0) (hbq : ⁅b,q⁆=0) : + ⁅⁅a,h⁆,b⁆+⁅a,⁅b,k⁆⁆=0 := by + calc + _=⁅a,⁅b,k-h⁆⁆ := by + rw [lie_sub,lie_sub,leibniz_lie a b h,hab,zero_lie,zero_add,←lie_skew b ⁅a,h⁆] + abel + _=0 := by + rw [hk,lie_add,lie_add,hbq,lie_zero,add_zero,leibniz_lie,hab,hap,zero_lie,lie_zero,add_zero] + + theorem inner_pair {a b h : M} (hab : ⁅a,b⁆=0) : + ⁅⁅a,h⁆,b⁆+⁅a,⁅b,h⁆⁆=0 := by + rw [leibniz_lie a b h,hab,zero_lie,zero_add,←lie_skew b ⁅a,h⁆] + abel + + theorem commute_lie {a b h : M} (ha : ⁅a,h⁆=0) (hb : ⁅b,h⁆=0) : ⁅⁅a,b⁆,h⁆=0 := by + rw [lie_lie,ha,hb,lie_zero,lie_zero,sub_self] + + def va : M := 0 + def vb (b A : M) : M := ⁅b,A⁆ + def vc (c D : M) : M := ⁅c,D⁆ + def vd (b A : M) : M := -⁅b,A⁆ + def ve (b e A D E : M) : M := ⁅b+e,D+E⁆-⁅b,A⁆ + def vf (b c e A D E : M) : M := -vc c D-ve b e A D E + + theorem vd_tangent (h : Data a b c d e f A B C D E H I J P Q) : vd b A=⁅d,A+H⁆ := by + exact neg_eq_of_add_eq_zero_right h.special_d + + theorem bC (h : Data a b c d e f A B C D E H I J P Q) : ⁅b,C⁆=⁅e,I⁆ := by + apply sub_eq_zero.mp + calc + _=⁅b+c+e,C⁆-(⁅c,C⁆+⁅e,C+I⁆) := by simp only [add_lie,lie_add]; abel + _=0 := by rw [h.LC,h.special_e,sub_self] + + theorem ve_tangent (h : Data a b c d e f A B C D E H I J P Q) : + ve b e A D E=⁅e,A+B+C+I⁆ := by + rw [ve,h.pentagon] + simp only [add_lie,lie_add] + rw [h.bB,bC h] + abel + + theorem gauge_difference (h : Data a b c d e f A B C D E H I J P Q) : + (A+B+C+I)-(A+H)=P+Q := by + rw [h.permuted,←h.cyclic] + abel + + theorem crossing_de (h : Data a b c d e f A B C D E H I J P Q) : + ⁅vd b A,e⁆+⁅d,ve b e A D E⁆=0 := by + rw [vd_tangent h,ve_tangent h] + exact crossing h.base.de (gauge_difference h) h.dP h.eQ + + theorem velocity_K : (0:M)+vb b A+vd b A=0 := by simp only [vb,vd,zero_add,add_neg_cancel] + theorem velocity_L (h : Data a b c d e f A B C D E H I J P Q) : + vb b A+vc c D+ve b e A D E=⁅b+c+e,A+B⁆ := by + calc + _=⁅b+c+e,D+E⁆ := by simp only [vb,vc,ve,add_lie,lie_add,h.cE]; abel + _=⁅b+c+e,A+B⁆ := by rw [h.pentagon,lie_add,h.LC,add_zero] + + theorem velocity_b (h : Data a b c d e f A B C D E H I J P Q) : + vb b A=⁅b,A+B⁆ := by simp only [vb,lie_add,h.bB,add_zero] + theorem velocity_c (h : Data a b c d e f A B C D E H I J P Q) : + vc c D=⁅c,A+B⁆+⁅c,C⁆ := by + have hh := congrArg (fun u => ⁅c,u⁆) h.pentagon + simpa only [vc,lie_add,h.cE,add_zero] using hh + + theorem velocity_total : + total (0:M) (vb b A) (vc c D) (vd b A) (ve b e A D E) (vf b c e A D E)=0 := by + simp only [total,vb,vc,vd,vf] + abel + + def ja (a : M) : Jet R M := ⟨a,0⟩ + def jb (b A : M) : Jet R M := ⟨b,vb b A⟩ + def jc (c D : M) : Jet R M := ⟨c,vc c D⟩ + def jd (d b A : M) : Jet R M := ⟨d,vd b A⟩ + def je (e b A D E : M) : Jet R M := ⟨e,ve b e A D E⟩ + def jf (f b c e A D E : M) : Jet R M := ⟨f,vf b c e A D E⟩ + + theorem relations (h : Data a b c d e f A B C D E H I J P Q) : + BraidSix.Relations (ja (R:=R) a) (jb b A) (jc c D) (jd d b A) + (je e b A D E) (jf f b c e A D E) := by + constructor + · intro u _ + apply Jet.ext + · change ⁅u.base,total a b c d e f⁆=0 + exact commute_symm (h.central u.base) + · change ⁅u.velocity,total a b c d e f⁆+⁅u.base, + total 0 (vb b A) (vc c D) (vd b A) (ve b e A D E) (vf b c e A D E)⁆=0 + rw [velocity_total,lie_zero,add_zero] + exact commute_symm (h.central u.velocity) + · apply Jet.ext + · exact h.base.ac + · change ⁅(0:M),c⁆+⁅a,⁅c,D⁆⁆=0 + rw [zero_lie,zero_add,leibniz_lie,h.base.ac,h.aD,zero_lie,lie_zero,add_zero] + · apply Jet.ext + · exact h.base.de + · exact crossing_de h + · apply Jet.ext + · exact h.base.aK + · change ⁅(0:M),a+b+d⁆+⁅a,(0:M)+vb b A+vd b A⁆=0 + rw [velocity_K,zero_lie,lie_zero,add_zero] + · apply Jet.ext + · exact h.base.bK + · change ⁅⁅b,A⁆,a+b+d⁆+⁅b,(0:M)+vb b A+vd b A⁆=0 + rw [velocity_K,lie_zero,add_zero] + exact commute_lie h.base.bK (commute_symm h.KA) + · apply Jet.ext + · exact h.base.bL + · change ⁅vb b A,b+c+e⁆+⁅b,vb b A+vc c D+ve b e A D E⁆=0 + rw [velocity_L h,velocity_b h] + exact inner_pair h.base.bL + · apply Jet.ext + · exact h.base.cL + · change ⁅vc c D,b+c+e⁆+⁅c,vb b A+vc c D+ve b e A D E⁆=0 + rw [velocity_L h,velocity_c h,add_lie] + have hz := commute_lie h.base.cL (commute_symm h.LC) + rw [hz,add_zero] + exact inner_pair h.base.cL + +end RealDeligneDrinfeld.TangentBraid + +namespace RealDeligneDrinfeld.TriangleSolutions +variable {M : Type} [LieRing M] [LieAlgebra ℝ M] +variable {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 rw [hsum] + exact eval_central_shift u (-u-v) (u+v+w) hu hneg hqn (by omega) + +include hqn hn hu hv in +theorem shift_v : eval v w q=eval v (-u-v) q := by + have hsum : w=(-u-v)+(u+v+w) := by abel + have hneg : ⁅-u-v,u+v+w⁆=0 := by rw [sub_lie,neg_lie,hu,hv,neg_zero,sub_zero] + conv_lhs => rw [hsum] + exact eval_central_shift v (-u-v) (u+v+w) hv hneg hqn (by omega) + +include hq hqn hn hu hv in +theorem cyclic : eval u v q+eval v w q=eval u w q := by + have h := solution_three hq u v + rw [solution_swap hq (-u-v) u,←shift_u hqn hn u v w hu hv, + ←shift_v hqn hn u v w hu hv] at h + exact eq_of_sub_eq_zero (by simpa only [sub_eq_add_neg] using h) + +include hq hqn hn hu hv in +theorem special : ⁅v,eval u v q⁆+⁅w,eval u v q+eval v w q⁆=0 := by + have h := Differentiation.special_identity hq hqn hn v u + have hc : -v-u= -u-v := by abel + rw [hc,←shift_u hqn hn u v w hu hv] at h + have hk : ⁅u+v+w,eval u w q⁆=0 := + eval_commutes u w (u+v+w) (commute_symm hu) (commute_symm (third u v w hu hv)) q + have he : ⁅-u-v,eval u w q⁆=⁅w,eval u w q⁆ := by + have hh : -u-v=w-(u+v+w) := by abel + rw [hh,sub_lie,hk,sub_zero] + rw [he] at h + rw [cyclic hq hqn hn u v w hu hv] + exact h + +end RealDeligneDrinfeld.TriangleSolutions + +namespace RealDeligneDrinfeld.T4SolutionData +open T4Basic + +def A (q : L) : T4 := eval a b q +def B (q : L) : T4 := eval (a+d) (e+c) q +def C (q : L) : T4 := eval b c q +def D (q : L) : T4 := eval (d+b) c q +def E (q : L) : T4 := eval a (b+e) q +def H (q : L) : T4 := eval b d q +def I (q : L) : T4 := eval c e q +def J (q : L) : T4 := eval b e q +def P (q : L) : T4 := eval (a+b) e q +def Q (q : L) : T4 := eval d (b+c) q + + theorem pentagon {q : L} (hq : q∈W) : D q+E q=A q+B q+C q := by + calc + _=E q+D q := add_comm _ _ + _=C q+B q+A q := hq.2.2 + _=_ := by abel + + theorem permuted {q : L} (hq : q∈W) : P q+Q q= -H q+B q+J q := by + have hh := congrArg (t4Rename (Equiv.swap (1:Fin 4) 2)) hq.2.2 + simp only [map_add,map_eval,t4Rename_t] at hh + change eval d (b+c) q+eval (a+b) e q=eval b e q+eval (d+a) (c+e) q+eval d b q at hh + rw [add_comm d a,add_comm c e,solution_swap hq d b] at hh + calc + _=Q q+P q := add_comm _ _ + _=J q+B q+(-H q) := hh + _=_ := by abel + + theorem data {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 fin_cases j <;> rfl + +def lift (hq : q∈W) (hqn : q∈Ln n) (hn : 2 + BraidSix.matrix_disjoint (TangentBraid.relations (data hq hqn hn)) i j k l hik hil hjk hjl) + (BraidSix.matrix_three (TangentBraid.relations (data hq hqn hn))) + +@[simp] theorem lift_t (hq : q∈W) (hqn : q∈Ln n) (hn : 2 simp only [map_zero] + | hg i => + cases i + · change D (eval a b x)=eval a b (derivation q x) + simp only [eval_x,derivation_apply,D_x,map_zero,hx] + · change D (eval a b y)=eval a b (derivation q y) + simp only [eval_y,derivation_apply,D_y,LieHom.map_lie,hy] + | ha p r hp hr => simp only [map_add,hp,hr] + | hs s p hp => simp only [map_smul,hp] + | hl p r hp hr => simp only [LieHom.map_lie,LieDerivation.apply_lie_eq_add,map_add,hp,hr] + + theorem compatible {M N O P : Type*} [LieRing M] [LieAlgebra ℝ M] + [LieRing N] [LieAlgebra ℝ N] (g : Data ℝ M O) (k : Data ℝ N P) + (F : M →ₗ⁅ℝ⁆ N) (f : O → P) (K : N) + (hh : ∀ p,k.h (f p)=F (g.h p)+K) + (hd : ∀ z,k.d (F z)+⁅K,F z⁆=F (g.d z)) : Compatible F f g k := by + constructor + · intro p q + simp only [unit,hh,map_sub] + abel + · intro p z + simp only [loop_apply,hh,add_lie,map_add,LieHom.map_lie] + rw [←hd z] + abel + +end RealDeligneDrinfeld.GaugeCompatibility + +namespace RealDeligneDrinfeld.ThreeSolutionCategory +open CategoricalValues DeligneDrinfeld.CategoryGauge + +def data (q : L) : Data ℝ L (Fin 3) := + ⟨derivation q,![0,q,q+rotateLie q]⟩ + +@[simp] theorem loop_zero (q : L) : loop (data q) 0=derivation q := by + ext p + simp [loop_apply,data] +@[simp] theorem value (q : L) : unit (data q) 0 1=q := by simp [unit,data] + + theorem anti {q : L} (hq : q∈W) : swapLie q= -q := by + exact eq_neg_of_add_eq_zero_right hq.1 + + theorem rotating_anti {q : L} (hq : q∈W) : swapLie (rotateLie q)=q+rotateLie q := by + change eval y x (eval y (-x-y) q)=q+eval y (-x-y) q + rw [map_eval,eval_y,map_sub,map_neg,eval_x,eval_y] + have h := solution_three hq x y + rw [eval_self,LieHom.id_apply,solution_swap hq (-x-y) x] at h + have hs : -y-x= -x-y := by abel + rw [hs] + exact (eq_of_sub_eq_zero (by simpa only [sub_eq_add_neg] using h)).symm + + theorem rotating_twice {q : L} (hq : q∈W) : rotateLie (q+rotateLie q)= -q := by + rw [map_add] + have hsq := LieHom.congr_fun rotate_squared q + change rotateLie (rotateLie q)=eval (-x-y) x q at hsq + rw [hsq] + exact eq_neg_of_add_eq_zero_right (by simpa only [rotateLie,add_assoc] using hq.2.1) + + theorem swap {q : L} (hq : q∈W) : Compatible swapLie swapObjects (data q) (data q) := by + apply GaugeCompatibility.compatible (data q) (data q) swapLie swapObjects q + · intro i + fin_cases i + · simp [data,swapObjects] + · change 0=swapLie q+q + rw [anti hq,neg_add_cancel] + · change q+rotateLie q=swapLie (q+rotateLie q)+q + rw [map_add,anti hq,rotating_anti hq] + abel + · intro p + have hh := GaugeCompatibility.intertwine (loop (data q) 1) q y x + (by simp only [loop_apply,data,D_y,derivation_apply,Matrix.cons_val_one,Matrix.cons_val_zero]; rw [←lie_skew y q]; abel) + (by + simp only [loop_apply,data,derivation_apply,D_x,zero_add,Matrix.cons_val_one,Matrix.cons_val_zero] + change ⁅q,x⁆=⁅x,swapLie q⁆ + rw [anti hq,lie_neg,←lie_skew x q,neg_neg]) p + simpa only [loop_apply,data,Matrix.cons_val_one,Matrix.cons_val_zero,swapLie,rotateLie] using hh + + theorem rotate {n : ℕ} {q : L} (hq : q∈W) (hqn : q∈Ln n) (hn : 2 ha _ _ ha' hb' + smul_mem' := fun r a h => hs r a h + lie_mem' := fun ha' hb' => hl _ _ ha' hb' } + let f : FreeLieAlgebra R α →ₗ⁅R⁆ K := + FreeLieAlgebra.lift R (fun a => ⟨FreeLieAlgebra.of R a, hg a⟩) + have hf : K.incl.comp f = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro a + simp [f] + have h := (f q).property + change P ((K.incl.comp f) q) at h + simpa only [hf, LieHom.id_apply] using h + +abbrev L := FreeLieAlgebra ℝ Bool +def x : L := FreeLieAlgebra.of ℝ false +def y : L := FreeLieAlgebra.of ℝ true + +def eval {M : Type*} [LieRing M] [LieAlgebra ℝ M] (a b : M) : L →ₗ⁅ℝ⁆ M := + FreeLieAlgebra.lift ℝ (fun i => if i then b else a) + +abbrev Edge := {p : Fin 4 × Fin 4 // p.1 < p.2} +abbrev BraidFree := FreeLieAlgebra ℝ Edge + +def chord (i j : Fin 4) : BraidFree := + if h : i < j then FreeLieAlgebra.of ℝ ⟨(i, j), h⟩ + else if h : j < i then FreeLieAlgebra.of ℝ ⟨(j, i), h⟩ else 0 + +def braidRelations : Set BraidFree := + {z | (∃ i j k l : Fin 4, + i ≠ j ∧ i ≠ k ∧ i ≠ l ∧ j ≠ k ∧ j ≠ l ∧ k ≠ l ∧ + z = ⁅chord i j, chord k l⁆) ∨ + (∃ i j k : Fin 4, i ≠ j ∧ i ≠ k ∧ j ≠ k ∧ + z = ⁅chord i j, chord i k + chord j k⁆)} + +def braidIdeal : LieIdeal ℝ BraidFree := + LieSubmodule.lieSpan ℝ BraidFree braidRelations + +abbrev T4 := BraidFree ⧸ braidIdeal +def t (i j : Fin 4) : T4 := LieSubmodule.Quotient.mk (chord i j) + +def IsSolution (p : L) : Prop := + p + eval y x p = 0 ∧ + p + eval y (-x-y) p + eval (-x-y) x p = 0 ∧ + eval (t 0 1) (t 1 2 + t 1 3) p + eval (t 0 2 + t 1 2) (t 2 3) p = + eval (t 1 2) (t 2 3) p + eval (t 0 1 + t 0 2) (t 1 3 + t 2 3) p + + eval (t 0 1) (t 1 2) p + +def W : Submodule ℝ L where + carrier := {p | IsSolution p} + zero_mem' := by simp [IsSolution] + add_mem' := by + intro p q hp hq + rcases hp with ⟨hp1, hp2, hp3⟩ + rcases hq with ⟨hq1, hq2, hq3⟩ + refine ⟨?_, ?_, ?_⟩ + · simp only [map_add] + calc + _ = (p + eval y x p) + (q + eval y x q) := by abel + _ = 0 := by rw [hp1, hq1, add_zero] + · simp only [map_add] + calc + _ = (p + eval y (-x-y) p + eval (-x-y) x p) + + (q + eval y (-x-y) q + eval (-x-y) x q) := by abel + _ = 0 := by rw [hp2, hq2, add_zero] + · simp only [map_add] + calc + _ = (eval (t 0 1) (t 1 2 + t 1 3) p + eval (t 0 2 + t 1 2) (t 2 3) p) + + (eval (t 0 1) (t 1 2 + t 1 3) q + eval (t 0 2 + t 1 2) (t 2 3) q) := by abel + _ = _ := by rw [hp3, hq3]; abel + smul_mem' := by + intro a p hp + rcases hp with ⟨hp1, hp2, hp3⟩ + change IsSolution (a • p) + simp only [IsSolution, map_smul] + constructor + · simpa only [smul_add, smul_zero] using congrArg (a • ·) hp1 + constructor + · simpa only [smul_add, smul_zero] using congrArg (a • ·) hp2 + · simpa only [smul_add] using congrArg (a • ·) hp3 + +structure Tangent where + base : L + velocity : L + +def Tangent.equiv : Tangent ≃ L × L where + toFun z := (z.base, z.velocity) + invFun z := ⟨z.1, z.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +instance : AddCommGroup Tangent := Tangent.equiv.addCommGroup +instance : Module ℝ Tangent := Tangent.equiv.addEquiv.module ℝ +instance : Bracket Tangent Tangent := + ⟨fun a b => ⟨⁅a.base, b.base⁆, + ⁅a.velocity, b.base⁆ + ⁅a.base, b.velocity⁆⟩⟩ + +@[ext] theorem Tangent.ext {a b : Tangent} (h : a.base = b.base) + (k : a.velocity = b.velocity) : a = b := by cases a; cases b; simp_all + +@[simp] theorem Tangent.base_zero : (0 : Tangent).base = 0 := rfl +@[simp] theorem Tangent.velocity_zero : (0 : Tangent).velocity = 0 := rfl +@[simp] theorem Tangent.base_add (a b : Tangent) : (a+b).base = a.base+b.base := rfl +@[simp] theorem Tangent.velocity_add (a b : Tangent) : + (a+b).velocity = a.velocity+b.velocity := rfl +@[simp] theorem Tangent.base_smul (q : ℝ) (a : Tangent) : (q • a).base = q • a.base := rfl +@[simp] theorem Tangent.velocity_smul (q : ℝ) (a : Tangent) : + (q • a).velocity = q • a.velocity := rfl +@[simp] theorem Tangent.base_lie (a b : Tangent) : ⁅a,b⁆.base = ⁅a.base,b.base⁆ := rfl +@[simp] theorem Tangent.velocity_lie (a b : Tangent) : + ⁅a,b⁆.velocity = ⁅a.velocity,b.base⁆ + ⁅a.base,b.velocity⁆ := rfl + +instance : LieRing Tangent where + add_lie a b c := by + ext + · simp [add_lie] + · simp only [Tangent.velocity_lie, Tangent.velocity_add, Tangent.base_add, add_lie] + abel + lie_add a b c := by + ext + · simp [lie_add] + · simp only [Tangent.velocity_lie, Tangent.velocity_add, Tangent.base_add, lie_add] + abel + lie_self a := by + ext + · simp + · change ⁅a.velocity, a.base⁆ + ⁅a.base, a.velocity⁆ = 0 + rw [← lie_skew a.velocity a.base] + exact neg_add_cancel _ + leibniz_lie a b c := by + ext + · simp [lie_lie] + · simp only [Tangent.velocity_lie, Tangent.velocity_add, Tangent.base_lie, + lie_add, add_lie, lie_lie] + abel +instance : LieAlgebra ℝ Tangent where + lie_smul q a b := by ext <;> simp [lie_smul, smul_add] + +def tangentLift (p : L) : L →ₗ⁅ℝ⁆ Tangent := + FreeLieAlgebra.lift ℝ (fun i => if i then ⟨y, ⁅y,p⁆⟩ else ⟨x, 0⟩) + +def D (p q : L) : L := (tangentLift p q).velocity + +def ihara (p q : L) : L := D p q - D q p + ⁅p,q⁆ + +@[simp] theorem eval_x {M : Type*} [LieRing M] [LieAlgebra ℝ M] (a b : M) : + eval a b x = a := by simp [eval, x] +@[simp] theorem eval_y {M : Type*} [LieRing M] [LieAlgebra ℝ M] (a b : M) : + eval a b y = b := by simp [eval, y] + +def Tangent.baseHom : Tangent →ₗ⁅ℝ⁆ L where + toFun := Tangent.base + map_add' _ _ := rfl + map_smul' _ _ := rfl + map_lie' := rfl + +@[simp] theorem tangentLift_base (p q : L) : (tangentLift p q).base = q := by + have h : Tangent.baseHom.comp (tangentLift p) = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [tangentLift, Tangent.baseHom, x, y] <;> rfl + exact LieHom.congr_fun h q + +@[simp] theorem D_x (p : L) : D p x = 0 := by simp [D, tangentLift, x] +@[simp] theorem D_y (p : L) : D p y = ⁅y,p⁆ := by simp [D, tangentLift, y] +@[simp] theorem D_zero (p : L) : D p 0 = 0 := by simp [D] +@[simp] theorem D_add (p q r : L) : D p (q+r) = D p q + D p r := by simp [D] +@[simp] theorem D_smul (p q : L) (a : ℝ) : D p (a • q) = a • D p q := by simp [D] +theorem D_lie (p q r : L) : D p ⁅q,r⁆ = ⁅D p q,r⁆ + ⁅q,D p r⁆ := by + simp [D, LieHom.map_lie] + +def derivation (p : L) : LieDerivation ℝ L L where + toFun := D p + map_add' := D_add p + map_smul' a q := D_smul p q a + leibniz' a b := by + change D p ⁅a,b⁆ = ⁅a,D p b⁆ - ⁅b,D p a⁆ + rw [D_lie, sub_eq_add_neg, lie_skew, add_comm] + +@[simp] theorem derivation_apply (p q : L) : derivation p q = D p q := rfl + +theorem derivation_ext {d₁ d₂ : LieDerivation ℝ L L} + (hx : d₁ x = d₂ x) (hy : d₁ y = d₂ y) : d₁ = d₂ := by + apply DFunLike.ext + intro q + induction q using freeLie_induction with + | h0 => simp + | hg i => cases i; exact hx; exact hy + | ha a b ha hb => simp [ha, hb] + | hs r a ha => simp [ha] + | hl a b ha hb => simp [ha, hb] + +@[simp] theorem D_zero_left (q : L) : D 0 q = 0 := by + have h : derivation 0 = 0 := by + apply derivation_ext <;> simp + exact LieDerivation.congr_fun h q + +@[simp] theorem D_add_left (p q r : L) : D (p+q) r = D p r + D q r := by + have h : derivation (p+q) = derivation p + derivation q := by + apply derivation_ext <;> simp [lie_add] + exact LieDerivation.congr_fun h r + +@[simp] theorem D_smul_left (p q : L) (a : ℝ) : D (a • p) q = a • D p q := by + have h : derivation (a • p) = a • derivation p := by + apply derivation_ext <;> simp + exact LieDerivation.congr_fun h q + +inductive WeightedWord {α : Type*} (wt : α → ℕ) : ℕ → FreeLieAlgebra ℝ α → Prop + | generator (a : α) : WeightedWord wt (wt a) (FreeLieAlgebra.of ℝ a) + | bracket {n m a b} : WeightedWord wt n a → WeightedWord wt m b → + WeightedWord wt (n+m) ⁅a,b⁆ + +def weightPiece {α : Type*} (wt : α → ℕ) (n : ℕ) : Submodule ℝ (FreeLieAlgebra ℝ α) := + Submodule.span ℝ {p | WeightedWord wt n p} + +abbrev OddFree := FreeLieAlgebra ℝ ℕ +def oddWeight (k : ℕ) : ℕ := 2*k+3 +abbrev Fn (n : ℕ) := weightPiece oddWeight n +abbrev Ln (n : ℕ) := weightPiece (fun _ : Bool => 1) n +abbrev Wn (n : ℕ) : Submodule ℝ L := W ⊓ Ln n + +def Graded (e : OddFree ≃ₗ[ℝ] W) : Prop := + ∀ n a, (e a : L) ∈ Ln n ↔ a ∈ Fn n + +abbrev OddCompletion := (n : ℕ) → Fn n +abbrev WCompletion := (n : ℕ) → Wn n + +instance : TopologicalSpace L := ⊥ +instance : TopologicalSpace OddFree := ⊥ + +def completed (e : OddFree ≃ₗ[ℝ] W) (h : Graded e) : OddCompletion → WCompletion := + fun a n => ⟨e (a n), (e (a n)).property, (h n (a n)).2 (a n).property⟩ + +def completedInv (e : OddFree ≃ₗ[ℝ] W) (h : Graded e) : WCompletion → OddCompletion := + fun a n => ⟨e.symm ⟨a n, (a n).property.1⟩, + (h n (e.symm ⟨a n, (a n).property.1⟩)).1 (by + rw [LinearEquiv.apply_symm_apply] + exact (a n).property.2)⟩ + +def MainStatement : Prop := + ∃ (e : OddFree ≃ₗ[ℝ] W) (h : Graded e), + (∀ a b, (e ⁅a,b⁆ : L) = ihara (e a) (e b)) ∧ + Function.LeftInverse (completedInv e h) (completed e h) ∧ + Function.RightInverse (completedInv e h) (completed e h) ∧ + Continuous (completed e h) ∧ Continuous (completedInv e h) ∧ + (∀ (a b : OddCompletion) n, + (e (∑ i ∈ Finset.range (n+1), ⁅(a i : OddFree), (b (n-i) : OddFree)⁆) : L) = + ∑ i ∈ Finset.range (n+1), + ihara (completed e h a i) (completed e h b (n-i))) + +namespace AssociativeModel + +variable {α : Type*} +abbrev FL (α : Type*) := FreeLieAlgebra ℝ α +abbrev A (α : Type*) := MonoidAlgebra ℝ (FreeMonoid α) +attribute [local instance] LieRing.ofAssociativeRing + +def atom (a : α) : A α := MonoidAlgebra.single (FreeMonoid.of a) 1 + +def embed : FL α →ₗ⁅ℝ⁆ A α := FreeLieAlgebra.lift ℝ atom + +@[simp] theorem embed_of (a : α) : embed (FreeLieAlgebra.of ℝ a) = atom a := by + simp [embed] + +def dynkinWord : List α → FL α + | [] => 0 + | [a] => FreeLieAlgebra.of ℝ a + | a :: b :: w => ⁅FreeLieAlgebra.of ℝ a, dynkinWord (b :: w)⁆ + +theorem dynkinWord_cons (a : α) (w : List α) (hw : w ≠ []) : + dynkinWord (a::w) = ⁅FreeLieAlgebra.of ℝ a, dynkinWord w⁆ := by + cases w with + | nil => contradiction + | cons b w => rfl + +def wordLinear {M : Type*} [AddCommGroup M] [Module ℝ M] + (f : FreeMonoid α → M) : A α →ₗ[ℝ] M := + (Finsupp.linearCombination ℝ f).comp (MonoidAlgebra.coeffLinearEquiv ℝ).toLinearMap + +@[simp] theorem wordLinear_single {M : Type*} [AddCommGroup M] [Module ℝ M] + (f : FreeMonoid α → M) (w : FreeMonoid α) (c : ℝ) : + wordLinear f (MonoidAlgebra.single w c) = c • f w := by + change Finsupp.linearCombination ℝ f (Finsupp.single w c) = _; simp + +def dynkin : A α →ₗ[ℝ] FL α := wordLinear (fun w => dynkinWord w.toList) + +def wordAct : FreeMonoid α →* Module.End ℝ (FL α) := + FreeMonoid.lift (fun a => LieAlgebra.ad ℝ (FL α) (FreeLieAlgebra.of ℝ a)) + +def act : A α →ₐ[ℝ] Module.End ℝ (FL α) := + MonoidAlgebra.lift ℝ (Module.End ℝ (FL α)) (FreeMonoid α) wordAct + +@[simp] theorem act_single (w : FreeMonoid α) (c : ℝ) : + act (MonoidAlgebra.single w c) = c • wordAct w := by simp [act] + +@[simp] theorem wordAct_of_apply (a : α) (q : FL α) : + wordAct (FreeMonoid.of a) q = ⁅FreeLieAlgebra.of ℝ a,q⁆ := by + simp [wordAct, LieAlgebra.ad_apply] + +@[simp] theorem act_embed (p q : FL α) : act (embed p) q = ⁅p,q⁆ := by + have h : act.toLieHom.comp embed = LieAlgebra.ad ℝ (FL α) := by + apply FreeLieAlgebra.hom_ext + intro a + simp [atom, wordAct] + exact LinearMap.congr_fun (LieHom.congr_fun h p) q + +theorem dynkinWord_append (u v : List α) (hv : v ≠ []) : + dynkinWord (u++v) = wordAct (FreeMonoid.ofList u) (dynkinWord v) := by + induction u with + | nil => simp + | cons a u ih => + rw [List.cons_append, dynkinWord_cons _ _ (List.append_ne_nil_of_right_ne_nil u hv), + ih, FreeMonoid.ofList_cons, map_mul, Module.End.mul_apply, wordAct_of_apply] + +def homogeneous (n : ℕ) : Submodule ℝ (A α) := + Submodule.span ℝ {p | ∃ w : FreeMonoid α, + w.toList.length = n ∧ p = MonoidAlgebra.single w 1} + +theorem single_mem_homogeneous (w : FreeMonoid α) (n : ℕ) + (hn : w.toList.length = n) : MonoidAlgebra.single w 1 ∈ homogeneous (α := α) n := + Submodule.subset_span ⟨w, hn, rfl⟩ + +theorem mul_homogeneous {n m : ℕ} {a b : A α} + (ha : a ∈ homogeneous n) (hb : b ∈ homogeneous m) : a*b ∈ homogeneous (n+m) := by + induction ha using Submodule.span_induction with + | mem a ha => + rcases ha with ⟨v,hv,rfl⟩ + induction hb using Submodule.span_induction with + | mem b hb => + rcases hb with ⟨w,hw,rfl⟩ + simpa only [MonoidAlgebra.single_mul_single, one_mul] using + single_mem_homogeneous (v*w) (n+m) (by simp [hv,hw]) + | zero => simp + | add b c _ _ hb hc => simpa only [mul_add] using (homogeneous (n+m)).add_mem hb hc + | smul r b _ hb => simpa only [mul_smul_comm] using (homogeneous (n+m)).smul_mem r hb + | zero => simp + | add a c _ _ ha hc => simpa only [add_mul] using (homogeneous (n+m)).add_mem ha hc + | smul r a _ ha => simpa only [smul_mul_assoc] using (homogeneous (n+m)).smul_mem r ha + +theorem dynkin_mul {n : ℕ} (hn : n > 0) (a : A α) {b : A α} + (hb : b ∈ homogeneous n) : dynkin (a*b) = act a (dynkin b) := by + induction a using MonoidAlgebra.induction_linear with + | zero => simp + | add a c ha hc => simp [add_mul, ha, hc] + | single v r => + induction hb using Submodule.span_induction with + | mem b hb => + rcases hb with ⟨w,hw,rfl⟩ + have hw' : w.toList ≠ [] := by intro h; simp [h] at hw; omega + simp [dynkin, dynkinWord_append _ _ hw'] + | zero => simp + | add b c _ _ hb hc => simp [mul_add, hb, hc] + | smul r b _ hb => simp [hb] + +theorem dynkin_embed_word {n : ℕ} {p : FL α} + (hp : WeightedWord (fun _ : α => 1) n p) : + 0 < n ∧ embed p ∈ homogeneous n ∧ dynkin (embed p) = (n : ℝ) • p := by + induction hp with + | generator a => + refine ⟨by omega, ?_, ?_⟩ + · simpa [atom] using single_mem_homogeneous (FreeMonoid.of a) 1 rfl + · simp [dynkin, atom, dynkinWord] + | @bracket n m p q hp hq ihp ihq => + rcases ihp with ⟨hn,hn',hpn⟩ + rcases ihq with ⟨hm,hm',hqm⟩ + refine ⟨by omega, ?_, ?_⟩ + · rw [LieHom.map_lie] + change embed p * embed q - embed q * embed p ∈ homogeneous (n+m) + exact (homogeneous (n+m)).sub_mem (mul_homogeneous hn' hm') + (by simpa [Nat.add_comm] using mul_homogeneous hm' hn') + · rw [LieHom.map_lie] + change dynkin (embed p * embed q - embed q * embed p) = _ + rw [map_sub, dynkin_mul hm _ hm', dynkin_mul hn _ hn', hqm, hpn] + simp only [map_smul, act_embed] + rw [← lie_skew q p] + simp only [smul_neg, sub_neg_eq_add, Nat.cast_add, add_smul] + exact add_comm _ _ + +def normalizedDynkin : A α →ₗ[ℝ] FL α := + wordLinear (fun w => (w.toList.length : ℝ)⁻¹ • dynkinWord w.toList) + +theorem normalizedDynkin_homogeneous {n : ℕ} {a : A α} + (ha : a ∈ homogeneous n) : normalizedDynkin a = (n : ℝ)⁻¹ • dynkin a := by + induction ha using Submodule.span_induction with + | mem a ha => + rcases ha with ⟨w,hw,rfl⟩ + simp [normalizedDynkin, dynkin, hw] + | zero => simp + | add a b _ _ ha hb => simp [ha, hb, smul_add] + | smul r a _ ha => + rw [map_smul, map_smul, ha, smul_comm] + +theorem normalizedDynkin_embed_word {n : ℕ} {p : FL α} + (hp : WeightedWord (fun _ : α => 1) n p) : normalizedDynkin (embed p) = p := by + obtain ⟨hn,hn',hp'⟩ := dynkin_embed_word hp + rw [normalizedDynkin_homogeneous hn', hp', smul_smul, inv_mul_cancel₀, one_smul] + exact_mod_cast (Nat.ne_of_gt hn) + +theorem mem_word_span (wt : α → ℕ) (p : FL α) : + p ∈ Submodule.span ℝ {q | ∃ n, WeightedWord wt n q} := by + let S : Submodule ℝ (FL α) := Submodule.span ℝ {q | ∃ n, WeightedWord wt n q} + change p ∈ S + induction p using freeLie_induction with + | h0 => exact S.zero_mem + | hg a => exact Submodule.subset_span ⟨wt a, WeightedWord.generator a⟩ + | ha a b ha hb => exact S.add_mem ha hb + | hs r a ha => exact S.smul_mem r ha + | hl a b ha hb => + induction ha using Submodule.span_induction with + | mem a ha => + rcases ha with ⟨n, hn⟩ + induction hb using Submodule.span_induction with + | mem b hb => + rcases hb with ⟨m, hm⟩ + exact Submodule.subset_span ⟨n+m, WeightedWord.bracket hn hm⟩ + | zero => simp + | add b c _ _ hb hc => simpa only [lie_add] using S.add_mem hb hc + | smul r b _ hb => simpa only [lie_smul] using S.smul_mem r hb + | zero => simp + | add a c _ _ ha hc => simpa only [add_lie] using S.add_mem ha hc + | smul r a _ ha => simpa only [smul_lie] using S.smul_mem r ha + +theorem normalizedDynkin_embed (p : FL α) : normalizedDynkin (embed p) = p := by + have hp := mem_word_span (fun _ : α => 1) p + induction hp using Submodule.span_induction with + | mem a ha => + obtain ⟨n,hn⟩ := ha + exact normalizedDynkin_embed_word hn + | zero => simp + | add a b _ _ ha hb => simp [ha, hb] + | smul r a _ ha => simp [ha] + +theorem embed_injective : Function.Injective (embed (α := α)) := + Function.LeftInverse.injective normalizedDynkin_embed + +end AssociativeModel + +namespace FreeDerivations + +variable {R : Type*} [CommRing R] +variable {M : Type*} [LieRing M] [LieAlgebra R M] + +structure Jet (R M : Type*) [CommRing R] [LieRing M] [LieAlgebra R M] where + base : M + velocity : M + +def Jet.equiv : Jet R M ≃ M × M where + toFun z := (z.base, z.velocity) + invFun z := ⟨z.1, z.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +instance : AddCommGroup (Jet R M) := Jet.equiv.addCommGroup +instance : Module R (Jet R M) := Jet.equiv.addEquiv.module R +instance : Bracket (Jet R M) (Jet R M) := + ⟨fun a b => ⟨⁅a.base, b.base⁆, + ⁅a.velocity, b.base⁆ + ⁅a.base, b.velocity⁆⟩⟩ + +@[ext] theorem Jet.ext {a b : Jet R M} (h : a.base = b.base) + (k : a.velocity = b.velocity) : a = b := by cases a; cases b; simp_all + +@[simp] theorem Jet.base_zero : (0 : Jet R M).base = 0 := rfl +@[simp] theorem Jet.velocity_zero : (0 : Jet R M).velocity = 0 := rfl +@[simp] theorem Jet.base_add (a b : Jet R M) : (a+b).base = a.base+b.base := rfl +@[simp] theorem Jet.velocity_add (a b : Jet R M) : + (a+b).velocity = a.velocity+b.velocity := rfl +@[simp] theorem Jet.base_smul (q : R) (a : Jet R M) : (q • a).base = q • a.base := rfl +@[simp] theorem Jet.velocity_smul (q : R) (a : Jet R M) : + (q • a).velocity = q • a.velocity := rfl +@[simp] theorem Jet.base_lie (a b : Jet R M) : ⁅a,b⁆.base = ⁅a.base,b.base⁆ := rfl +@[simp] theorem Jet.velocity_lie (a b : Jet R M) : + ⁅a,b⁆.velocity = ⁅a.velocity,b.base⁆ + ⁅a.base,b.velocity⁆ := rfl + +instance : LieRing (Jet R M) where + add_lie a b c := by (ext <;> simp [add_lie]); abel + lie_add a b c := by (ext <;> simp [lie_add]); abel + lie_self a := by + ext + · simp + · change ⁅a.velocity, a.base⁆ + ⁅a.base, a.velocity⁆ = 0 + rw [← lie_skew a.velocity a.base] + exact neg_add_cancel _ + leibniz_lie a b c := by (ext <;> simp [lie_add, add_lie, lie_lie]); abel +instance : LieAlgebra R (Jet R M) where + lie_smul q a b := by ext <;> simp [lie_smul, smul_add] + +def Jet.baseHom : Jet R M →ₗ⁅R⁆ M where + toFun := Jet.base + map_add' _ _ := rfl + map_smul' _ _ := rfl + map_lie' {_ _} := rfl + +variable {α : Type*} +local notation "F" => FreeLieAlgebra R α + +def jetLift (f : α → F) : F →ₗ⁅R⁆ Jet R F := + FreeLieAlgebra.lift R (fun a => ⟨FreeLieAlgebra.of R a, f a⟩) + +@[simp] theorem jetLift_base (f : α → F) (p : F) : + (jetLift f p).base = p := by + have h : Jet.baseHom.comp (jetLift f) = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro a + simp [jetLift, Jet.baseHom] + rfl + exact LieHom.congr_fun h p + +def extend (f : α → F) : LieDerivation R F F where + toFun q := (jetLift f q).velocity + map_add' a b := by + change (jetLift f (a+b)).velocity = _ + rw [map_add] + rfl + map_smul' r a := by + change (jetLift f (r • a)).velocity = _ + rw [map_smul] + rfl + leibniz' a b := by + change (jetLift f ⁅a,b⁆).velocity = ⁅a,(jetLift f b).velocity⁆ - ⁅b,(jetLift f a).velocity⁆ + rw [LieHom.map_lie, Jet.velocity_lie, jetLift_base, jetLift_base] + rw [sub_eq_add_neg, lie_skew, add_comm] + +@[simp] theorem extend_of (f : α → F) (a : α) : + extend f (FreeLieAlgebra.of R a) = f a := by + change (jetLift f (FreeLieAlgebra.of R a)).velocity = _ + simp [jetLift] + +@[ext] theorem ext {d₁ d₂ : LieDerivation R F F} + (h : ∀ a, d₁ (FreeLieAlgebra.of R a) = d₂ (FreeLieAlgebra.of R a)) : d₁ = d₂ := by + apply DFunLike.ext + intro q + induction q using freeLie_induction with + | h0 => simp + | hg a => exact h a + | ha a b ha hb => simp [ha, hb] + | hs r a ha => simp [ha] + | hl a b ha hb => simp [ha, hb] + +theorem extend_unique (f : α → F) (d : LieDerivation R F F) + (h : ∀ a, d (FreeLieAlgebra.of R a) = f a) : d = extend f := by + apply ext + intro a + simpa using h a + +variable [DecidableEq α] +def pair (i j : α) : LieDerivation R F F := + extend (fun k => if k = i then ⁅FreeLieAlgebra.of R i, FreeLieAlgebra.of R j⁆ + else if k = j then ⁅FreeLieAlgebra.of R j, FreeLieAlgebra.of R i⁆ else 0) + +@[simp] theorem pair_of_left (i j : α) : + pair (R := R) i j (FreeLieAlgebra.of R i) = ⁅FreeLieAlgebra.of R i,FreeLieAlgebra.of R j⁆ := by + simp [pair] + +@[simp] theorem pair_of_right (i j : α) : + pair (R := R) i j (FreeLieAlgebra.of R j) = ⁅FreeLieAlgebra.of R j,FreeLieAlgebra.of R i⁆ := by + by_cases h : j = i + · subst j; simp + · simp [pair, h] + +@[simp] theorem pair_of_other (i j k : α) (hi : k ≠ i) (hj : k ≠ j) : + pair (R := R) i j (FreeLieAlgebra.of R k) = 0 := by + simp [pair, hi, hj] + +theorem pair_comm (i j : α) : pair (R := R) i j = pair j i := by + apply ext + intro a + by_cases hi : a=i + · subst a; simp + by_cases hj : a=j + · subst a; simp + simp [hi,hj] + +theorem pair_self (i : α) : pair (R := R) i i = 0 := by + apply ext + intro a + by_cases hi : a=i + · subst a; simp + simp [hi] + +theorem pair_disjoint (i j k l : α) + (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) : + ⁅pair (R := R) i j,pair (R := R) k l⁆ = 0 := by + apply ext + intro a + by_cases hai : a=i + · subst a; simp [hik,hil,hjk,hjl] + by_cases haj : a=j + · subst a; simp [hik,hil,hjk,hjl] + by_cases hak : a=k + · subst a; simp [hik.symm,hjk.symm,hil.symm,hjl.symm] + by_cases hal : a=l + · subst a; simp [hik.symm,hjk.symm,hil.symm,hjl.symm] + simp [hai,haj,hak,hal] + +theorem pair_three (i j k : α) (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅pair (R := R) i j, pair (R := R) i k + pair (R := R) j k⁆ = 0 := by + apply ext + intro a + by_cases hai : a=i + · subst a + simp [hik,hij,hjk,hij.symm,hik.symm,hjk.symm] + grind [lie_skew, lie_lie] + by_cases haj : a=j + · subst a + simp [hik,hij,hjk,hij.symm,hik.symm,hjk.symm] + grind [lie_skew, lie_lie] + by_cases hak : a=k + · subst a + simp [hik.symm,hjk.symm] + grind [lie_skew, lie_lie] + simp [hai,haj,hak] + +end FreeDerivations + +namespace BraidRepresentation +open FreeDerivations LieAlgebra +variable {R α : Type*} [CommRing R] [DecidableEq α] +local notation "F" => FreeLieAlgebra R α +local notation "Der" => LieDerivation R F F +local notation "SD" => SemiDirectSum F Der (LieHom.id : Der →ₗ⁅R⁆ Der) + +def fiber (i : α) : SD := SemiDirectSum.inl LieHom.id (FreeLieAlgebra.of R i) +def base (i j : α) : SD := SemiDirectSum.inr LieHom.id (pair i j) + +def chord : Option α → Option α → SD + | none, none => 0 + | none, some j => fiber j + | some i, none => fiber i + | some i, some j => base i j + +@[simp] theorem chord_none_none : chord (R := R) (α := α) none none = 0 := rfl +@[simp] theorem chord_none_some (j : α) : chord (R := R) none (some j) = fiber j := rfl +@[simp] theorem chord_some_none (i : α) : chord (R := R) (some i) none = fiber i := rfl +@[simp] theorem chord_some_some (i j : α) : chord (R := R) (some i) (some j) = base i j := rfl + +theorem chord_comm (i j : Option α) : chord (R := R) i j = chord j i := by + cases i <;> cases j <;> simp [base, pair_comm] + +@[simp] theorem chord_self (i : Option α) : chord (R := R) i i = 0 := by + cases i <;> simp [base, pair_self] + +theorem base_fiber (i j k : α) : + ⁅base (R := R) i j, fiber k⁆ = SemiDirectSum.inl LieHom.id + (pair (R := R) i j (FreeLieAlgebra.of R k)) := by + simp [base, fiber] + +theorem fiber_base (i j k : α) : + ⁅fiber (R := R) k, base i j⁆ = - SemiDirectSum.inl LieHom.id + (pair (R := R) i j (FreeLieAlgebra.of R k)) := by + rw [← lie_skew, base_fiber] + +theorem chord_disjoint (i j k l : Option α) + (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) : + ⁅chord (R := R) i j, chord (R := R) k l⁆ = 0 := by + cases i <;> cases j <;> cases k <;> cases l <;> + simp_all [base, fiber, pair_disjoint] + all_goals apply pair_of_other <;> intro h <;> subst_vars <;> contradiction + +theorem chord_three (i j k : Option α) + (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅chord (R := R) i j, chord (R := R) i k + chord (R := R) j k⁆ = 0 := by + cases i with + | none => + cases j with + | none => exact (hij rfl).elim + | some j => + cases k with + | none => exact (hik rfl).elim + | some k => + rw [chord_none_some, chord_none_some, chord_some_some, lie_add, fiber_base] + simp [fiber] + grind [lie_skew] + | some i => + cases j with + | none => + cases k with + | none => exact (hjk rfl).elim + | some k => + rw [chord_some_none, chord_some_some, chord_none_some, lie_add, fiber_base] + simp [fiber] + grind [lie_skew] + | some j => + cases k with + | none => + rw [chord_some_some, chord_some_none, chord_some_none, lie_add, + base_fiber, base_fiber] + simp only [pair_of_left, pair_of_right, ← map_add] + grind [lie_skew] + | some k => + simp only [chord_some_some, base, ← map_add, ← LieHom.map_lie] + rw [pair_three _ _ _ (fun h => hij (congrArg some h)) + (fun h => hik (congrArg some h)) (fun h => hjk (congrArg some h)), map_zero] + +end BraidRepresentation + +namespace BraidModel +open LieAlgebra +abbrev Fiber := FreeLieAlgebra ℝ (Fin 3) +abbrev Der := LieDerivation ℝ Fiber Fiber +abbrev Model := SemiDirectSum Fiber Der (LieHom.id : Der →ₗ⁅ℝ⁆ Der) +def chord (i j : Fin 4) : Model := + BraidRepresentation.chord (finSuccEquiv' (1 : Fin 4) i) (finSuccEquiv' (1 : Fin 4) j) + +theorem chord_comm (i j : Fin 4) : chord i j = chord j i := + BraidRepresentation.chord_comm _ _ + +@[simp] theorem chord_self (i : Fin 4) : chord i i = 0 := + BraidRepresentation.chord_self _ + +def preMap : BraidFree →ₗ⁅ℝ⁆ Model := FreeLieAlgebra.lift ℝ (fun e => chord e.val.1 e.val.2) + +@[simp] theorem preMap_chord (i j : Fin 4) : preMap (RealDeligneDrinfeld.chord i j) = chord i j := by + unfold RealDeligneDrinfeld.chord + split_ifs with hij hji + · simp [preMap] + · simp [preMap, chord_comm j i] + · have h : i = j := le_antisymm (le_of_not_gt hji) (le_of_not_gt hij) + subst j + simp + +theorem ideal_le_ker : braidIdeal ≤ preMap.ker := by + rw [braidIdeal, LieSubmodule.lieSpan_le] + intro z hz + change preMap z = 0 + rcases hz with ⟨i,j,k,l,hij,hik,hil,hjk,hjl,hkl,rfl⟩ | ⟨i,j,k,hij,hik,hjk,rfl⟩ + · rw [LieHom.map_lie, preMap_chord, preMap_chord] + exact BraidRepresentation.chord_disjoint _ _ _ _ + ((finSuccEquiv' (1 : Fin 4)).injective.ne hik) ((finSuccEquiv' (1 : Fin 4)).injective.ne hil) + ((finSuccEquiv' (1 : Fin 4)).injective.ne hjk) ((finSuccEquiv' (1 : Fin 4)).injective.ne hjl) + · rw [LieHom.map_lie, map_add, preMap_chord, preMap_chord, preMap_chord] + exact BraidRepresentation.chord_three _ _ _ + ((finSuccEquiv' (1 : Fin 4)).injective.ne hij) ((finSuccEquiv' (1 : Fin 4)).injective.ne hik) + ((finSuccEquiv' (1 : Fin 4)).injective.ne hjk) + +def map : T4 →ₗ⁅ℝ⁆ Model := + { braidIdeal.toSubmodule.liftQ preMap.toLinearMap ideal_le_ker with + map_lie' := by + intro a b + induction a using Submodule.Quotient.induction_on with | _ a => + induction b using Submodule.Quotient.induction_on with | _ b => + exact preMap.map_lie a b } + +@[simp] theorem map_t (i j : Fin 4) : map (t i j) = chord i j := preMap_chord i j + +end BraidModel + +namespace AssociativeModel +attribute [local instance] LieRing.ofAssociativeRing +variable {α : Type*} + +theorem coeff_rotate {P : A α} {b : α} (h : atom b * P = P * atom b) (w : List α) : + P.coeff (FreeMonoid.ofList (b :: w)) = P.coeff (FreeMonoid.ofList (w ++ [b])) := by + calc + P.coeff (FreeMonoid.ofList (b :: w)) = + (P * atom b).coeff ((FreeMonoid.of b * FreeMonoid.ofList w) * FreeMonoid.of b) := by + simp [atom, FreeMonoid.ofList_cons] + _ = (atom b * P).coeff (FreeMonoid.of b * (FreeMonoid.ofList w * FreeMonoid.of b)) := by + rw [h, mul_assoc] + _ = P.coeff (FreeMonoid.ofList (w ++ [b])) := by + simp [atom, FreeMonoid.ofList_append] + +theorem coeff_starts_ne {P : A α} {b a : α} (h : atom b * P = P * atom b) + (hab : a ≠ b) (v : List α) : P.coeff (FreeMonoid.ofList (a :: v)) = 0 := by + have hz : (atom b * P).coeff (FreeMonoid.ofList (a::v) * FreeMonoid.of b) = 0 := by + apply MonoidAlgebra.coeff_single_mul_of_forall_mul_ne + intro d hd + have hh := congrArg (fun w : FreeMonoid α => w.toList.head?) hd + exact hab (by simpa using hh.symm) + rw [h] at hz + simpa [atom] using hz + +theorem coeff_contains_ne {P : A α} {b a : α} (h : atom b * P = P * atom b) + (hab : a ≠ b) (u v : List α) : P.coeff (FreeMonoid.ofList (u ++ a :: v)) = 0 := by + induction u generalizing v with + | nil => exact coeff_starts_ne h hab v + | cons c u ih => + by_cases hc : c = b + · subst c + rw [List.cons_append, coeff_rotate h] + simpa [List.append_assoc] using ih (v ++ [b]) + · exact coeff_starts_ne h hc (u ++ a :: v) + +theorem coeff_eq_zero_of_letter_ne {P : A α} {b a : α} + (h : atom b * P = P * atom b) {w : List α} (ha : a ∈ w) (hab : a ≠ b) : + P.coeff (FreeMonoid.ofList w) = 0 := by + obtain ⟨u,v,rfl⟩ := List.append_of_mem ha + exact coeff_contains_ne h hab u v + +theorem dynkinWord_all_eq (b : α) (w : List α) (hw : ∀ a ∈ w, a = b) : + dynkinWord w ∈ Submodule.span ℝ {FreeLieAlgebra.of ℝ b} := by + induction w with + | nil => simp [dynkinWord] + | cons a w ih => + have ha : a = b := hw a (by simp) + subst a + cases w with + | nil => exact Submodule.subset_span (by simp [dynkinWord]) + | cons c w => + rw [dynkinWord] + have hmem := ih (fun a ha => hw a (by simp [ha])) + obtain ⟨r,hr⟩ := Submodule.mem_span_singleton.mp hmem + rw [← hr, lie_smul, lie_self, smul_zero] + exact Submodule.zero_mem _ + +theorem centralizer_generator {p : FL α} (b : α) (h : ⁅FreeLieAlgebra.of ℝ b,p⁆ = 0) : + p ∈ Submodule.span ℝ {FreeLieAlgebra.of ℝ b} := by + classical + have hc : atom b * embed p = embed p * atom b := by + have ht := congrArg embed h + rw [LieHom.map_lie, embed_of, map_zero] at ht + exact sub_eq_zero.mp ht + rw [← normalizedDynkin_embed p, ← MonoidAlgebra.sum_coeff_single (embed p)] + unfold Finsupp.sum + rw [map_sum] + apply Submodule.sum_mem + intro w hw + rw [normalizedDynkin, wordLinear_single] + apply Submodule.smul_mem + apply Submodule.smul_mem + apply dynkinWord_all_eq + intro a ha + by_contra hab + have hz := coeff_eq_zero_of_letter_ne hc ha hab + have hn := Finsupp.mem_support_iff.mp hw + exact hn (by simpa using hz) + +end AssociativeModel + +theorem map_eval {M N : Type*} [LieRing M] [LieAlgebra ℝ M] + [LieRing N] [LieAlgebra ℝ N] (f : M →ₗ⁅ℝ⁆ N) (a b : M) (p : L) : + f (eval a b p) = eval (f a) (f b) p := by + have h : f.comp (eval a b) = eval (f a) (f b) := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [eval] + exact LieHom.congr_fun h p + +theorem eval_self : eval x y = LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro i + cases i <;> simp [eval, x, y] + +theorem eval_commutes {M : Type*} [LieRing M] [LieAlgebra ℝ M] + (a b z : M) (ha : ⁅z,a⁆ = 0) (hb : ⁅z,b⁆ = 0) (p : L) : + ⁅z,eval a b p⁆ = 0 := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [eval, ha, hb] + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => simp [LieHom.map_lie, leibniz_lie, hp, hq] + +@[simp] theorem chord_comm (i j : Fin 4) : chord i j = chord j i := by + unfold chord + split_ifs <;> first | rfl | omega + +@[simp] theorem t_comm (i j : Fin 4) : t i j = t j i := by + unfold t + rw [chord_comm] + +theorem t_disjoint (i j k l : Fin 4) + (hij : i ≠ j) (hik : i ≠ k) (hil : i ≠ l) + (hjk : j ≠ k) (hjl : j ≠ l) (hkl : k ≠ l) : + ⁅t i j,t k l⁆ = 0 := by + rw [t, t, ← LieSubmodule.Quotient.mk_bracket, LieSubmodule.Quotient.mk_eq_zero'] + exact LieSubmodule.subset_lieSpan (Or.inl ⟨i,j,k,l,hij,hik,hil,hjk,hjl,hkl,rfl⟩) + +theorem t_three (i j k : Fin 4) (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅t i j,t i k + t j k⁆ = 0 := by + change LieSubmodule.Quotient.mk (⁅chord i j, chord i k + chord j k⁆) = (0 : T4) + rw [LieSubmodule.Quotient.mk_eq_zero'] + exact LieSubmodule.subset_lieSpan (Or.inr ⟨i,j,k,hij,hik,hjk,rfl⟩) + +namespace BraidModel + +def inclusion : Fiber →ₗ⁅ℝ⁆ T4 := FreeLieAlgebra.lift ℝ + (fun i => t 1 ((finSuccEquiv' (1 : Fin 4)).symm (some i))) + +theorem map_inclusion : map.comp inclusion = LieAlgebra.SemiDirectSum.inl LieHom.id := by + apply FreeLieAlgebra.hom_ext + intro i + simp [inclusion, chord, BraidRepresentation.fiber] + +theorem inclusion_injective : Function.Injective inclusion := by + intro a b hab + have h := congrArg map hab + have hm (c : Fiber) : map (inclusion c) = LieAlgebra.SemiDirectSum.inl LieHom.id c := + LieHom.congr_fun map_inclusion c + rw [hm,hm] at h + exact LieAlgebra.SemiDirectSum.inl_injective _ h + +end BraidModel + +theorem commute_symm {M : Type*} [LieRing M] {a b : M} (h : ⁅a,b⁆ = 0) : ⁅b,a⁆ = 0 := by + rw [← lie_skew, h, neg_zero] + +theorem evals_commute {M : Type*} [LieRing M] [LieAlgebra ℝ M] + (a b c d : M) (hac : ⁅a,c⁆ = 0) (had : ⁅a,d⁆ = 0) + (hbc : ⁅b,c⁆ = 0) (hbd : ⁅b,d⁆ = 0) (p q : L) : + ⁅eval a b p,eval c d q⁆ = 0 := by + apply eval_commutes + · exact commute_symm (eval_commutes a b c (commute_symm hac) (commute_symm hbc) p) + · exact commute_symm (eval_commutes a b d (commute_symm had) (commute_symm hbd) p) + +theorem eval_add_of_commuting {M : Type*} [LieRing M] [LieAlgebra ℝ M] + (a b c d : M) (hac : ⁅a,c⁆ = 0) (had : ⁅a,d⁆ = 0) + (hbc : ⁅b,c⁆ = 0) (hbd : ⁅b,d⁆ = 0) (p : L) : + eval (a+c) (b+d) p = eval a b p + eval c d p := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [eval] + | ha p q hp hq => simp [hp,hq]; abel + | hs r p hp => simp [hp,smul_add] + | hl p q hp hq => + simp only [LieHom.map_lie, hp, hq, add_lie, lie_add] + rw [evals_commute a b c d hac had hbc hbd p q, + commute_symm (evals_commute a b c d hac had hbc hbd q p)] + simp + +theorem eval_vanish_of_commuting {M : Type*} [LieRing M] [LieAlgebra ℝ M] + (a b : M) (hab : ⁅a,b⁆ = 0) {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 < n) : + eval a b p = 0 := by + induction hp using Submodule.span_induction with + | mem p hp => + cases hp with + | generator i => omega + | @bracket n m p q hp hq => + rw [LieHom.map_lie] + exact evals_commute a b a b (lie_self a) hab (commute_symm hab) (lie_self b) p q + | zero => simp + | add p q _ _ hp hq => simp [hp,hq] + | smul r p _ hp => simp [hp] + +theorem eval_central_shift {M : Type*} [LieRing M] [LieAlgebra ℝ M] + (a b c : M) (hac : ⁅a,c⁆ = 0) (hbc : ⁅b,c⁆ = 0) + {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 < n) : + eval a (b+c) p = eval a b p := by + have h := eval_add_of_commuting a b 0 c (lie_zero a) hac (lie_zero b) hbc p + simpa [eval_vanish_of_commuting 0 c (zero_lie c) hp hn] using h + +namespace T4Universal +variable {M : Type*} [LieRing M] [LieAlgebra ℝ M] + +def pre (f : Fin 4 → Fin 4 → M) : BraidFree →ₗ⁅ℝ⁆ M := + FreeLieAlgebra.lift ℝ (fun e => f e.val.1 e.val.2) + +theorem pre_chord (f : Fin 4 → Fin 4 → M) + (hs : ∀ i j, f i j = f j i) (hz : ∀ i, f i i = 0) (i j : Fin 4) : + pre f (chord i j) = f i j := by + unfold chord + split_ifs with hij hji + · simp [pre] + · simp [pre, hs j i] + · have h : i = j := le_antisymm (le_of_not_gt hji) (le_of_not_gt hij) + subst j + simp [hz] + +def lift (f : Fin 4 → Fin 4 → M) + (hs : ∀ i j, f i j = f j i) (hz : ∀ i, f i i = 0) + (hd : ∀ i j k l, i ≠ j → i ≠ k → i ≠ l → j ≠ k → j ≠ l → k ≠ l → + ⁅f i j,f k l⁆ = 0) + (ht : ∀ i j k, i ≠ j → i ≠ k → j ≠ k → ⁅f i j,f i k+f j k⁆ = 0) : T4 →ₗ⁅ℝ⁆ M := by + have hker : braidIdeal ≤ (pre f).ker := by + rw [braidIdeal, LieSubmodule.lieSpan_le] + intro z hz' + change pre f z = 0 + rcases hz' with ⟨i,j,k,l,hij,hik,hil,hjk,hjl,hkl,rfl⟩ | ⟨i,j,k,hij,hik,hjk,rfl⟩ + · simpa only [LieHom.map_lie, pre_chord f hs hz] using hd i j k l hij hik hil hjk hjl hkl + · simpa only [LieHom.map_lie, map_add, pre_chord f hs hz] using ht i j k hij hik hjk + exact { braidIdeal.toSubmodule.liftQ (pre f).toLinearMap hker with + map_lie' := by + intro a b + induction a using Submodule.Quotient.induction_on with | _ a => + induction b using Submodule.Quotient.induction_on with | _ b => + exact (pre f).map_lie a b } + +@[simp] theorem lift_t (f : Fin 4 → Fin 4 → M) (hs hz hd ht) (i j : Fin 4) : + lift f hs hz hd ht (t i j) = f i j := pre_chord f hs hz i j + +end T4Universal + +@[simp] theorem t_self (i : Fin 4) : t i i = 0 := by simp [t, chord] + +def t4Rename (e : Equiv.Perm (Fin 4)) : T4 →ₗ⁅ℝ⁆ T4 := + T4Universal.lift (fun i j => t (e i) (e j)) + (fun _ _ => t_comm _ _) (fun _ => t_self _) + (fun _ _ _ _ hij hik hil hjk hjl hkl => t_disjoint _ _ _ _ + (e.injective.ne hij) (e.injective.ne hik) (e.injective.ne hil) + (e.injective.ne hjk) (e.injective.ne hjl) (e.injective.ne hkl)) + (fun _ _ _ hij hik hjk => t_three _ _ _ + (e.injective.ne hij) (e.injective.ne hik) (e.injective.ne hjk)) + +@[simp] theorem t4Rename_t (e : Equiv.Perm (Fin 4)) (i j : Fin 4) : + t4Rename e (t i j) = t (e i) (e j) := T4Universal.lift_t _ _ _ _ _ _ _ + +theorem solution_swap {p : L} (hp : p ∈ W) + {M : Type*} [LieRing M] [LieAlgebra ℝ M] (a b : M) : + eval a b p = - eval b a p := by + have h := congrArg (eval a b) hp.1 + simp only [map_add, map_zero, map_eval, eval_x, eval_y] at h + exact eq_neg_of_add_eq_zero_left h + +theorem solution_three {p : L} (hp : p ∈ W) + {M : Type*} [LieRing M] [LieAlgebra ℝ M] (a b : M) : + eval a b p + eval b (-a-b) p + eval (-a-b) a p = 0 := by + have h := congrArg (eval a b) hp.2.1 + simpa only [map_add, map_zero, map_eval, map_sub, map_neg, eval_x, eval_y] using h + +theorem free_action_inner {R α β Z : Type*} [CommRing R] + [LieRing Z] [LieAlgebra R Z] + (f : FreeLieAlgebra R α →ₗ⁅R⁆ Z) (g : FreeLieAlgebra R β →ₗ⁅R⁆ Z) + (h : FreeLieAlgebra R β →ₗ⁅R⁆ LieDerivation R (FreeLieAlgebra R α) (FreeLieAlgebra R α)) + (hg : ∀ b a, f (h (FreeLieAlgebra.of R b) (FreeLieAlgebra.of R a)) = + ⁅g (FreeLieAlgebra.of R b),f (FreeLieAlgebra.of R a)⁆) + (q : FreeLieAlgebra R β) (p : FreeLieAlgebra R α) : + f (h q p) = ⁅g q,f p⁆ := by + have H : ∀ q : FreeLieAlgebra R β, ∀ p : FreeLieAlgebra R α, + f (h q p) = ⁅g q,f p⁆ := by + intro q + induction q using freeLie_induction with + | h0 => intro p; simp + | hg b => + intro p + induction p using freeLie_induction with + | h0 => simp + | hg a => exact hg b a + | ha p r hp hr => simp [hp,hr] + | hs c p hp => simp [hp] + | hl p r hp hr => + simp [hp,hr,LieHom.map_lie] + grind [lie_lie,lie_skew] + | ha q r hq hr => intro p; simp [hq,hr] + | hs c q hq => intro p; simp [hq] + | hl q r hq hr => intro p; simp [LieHom.map_lie,hq,hr,lie_lie] + exact H q p + +namespace InnerSemiDirect +open LieAlgebra +variable {R K B Z : Type*} [CommRing R] + [LieRing K] [LieAlgebra R K] [LieRing B] [LieAlgebra R B] + [LieRing Z] [LieAlgebra R Z] +variable (action : B →ₗ⁅R⁆ LieDerivation R K K) + (f : K →ₗ⁅R⁆ Z) (g : B →ₗ⁅R⁆ Z) + (h : ∀ q p, f (action q p) = ⁅g q,f p⁆) + +def lift : SemiDirectSum K B action →ₗ⁅R⁆ Z where + toFun z := f z.left + g z.right + map_add' z t := by simp; abel + map_smul' c z := by simp [smul_add] + map_lie' {z t} := by + simp only [SemiDirectSum.lie_eq_mk, map_sub, map_add, LieHom.map_lie, h, + add_lie, lie_add] + rw [sub_eq_add_neg, lie_skew] + abel + +@[simp] theorem lift_inl (p : K) : lift action f g h (SemiDirectSum.inl action p) = f p := by + simp [lift] +@[simp] theorem lift_inr (p : B) : lift action f g h (SemiDirectSum.inr action p) = g p := by + simp [lift] +end InnerSemiDirect + +namespace SpecialFiber +open LieAlgebra FreeDerivations +abbrev F := FreeLieAlgebra ℝ (Fin 3) +def fa : F := FreeLieAlgebra.of ℝ 0 +def fb : F := FreeLieAlgebra.of ℝ 1 +def fc : F := FreeLieAlgebra.of ℝ 2 + +def action : L →ₗ⁅ℝ⁆ LieDerivation ℝ F F := eval (pair 0 1) (pair 1 2) +abbrev M := SemiDirectSum F L action + +def a : M := SemiDirectSum.inl action fa +def b : M := SemiDirectSum.inl action fb +def c : M := SemiDirectSum.inl action fc +def u : M := SemiDirectSum.inr action x +def v : M := SemiDirectSum.inr action y +def w : M := -a-b-c-u-v + +theorem au : ⁅a,u⁆ = -⁅a,b⁆ := by + simp only [a,u,b, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk, SemiDirectSum.neg_eq_mk] + ext <;> simp [action,fa,fb] +theorem bu : ⁅b,u⁆ = ⁅a,b⁆ := by + simp only [a,u,b, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fa,fb] +theorem cu : ⁅c,u⁆ = 0 := by + simp only [c,u, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fc] +theorem av : ⁅a,v⁆ = 0 := by + simp only [a,v, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fa] +theorem bv : ⁅b,v⁆ = -⁅b,c⁆ := by + simp only [b,v,c, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk, SemiDirectSum.neg_eq_mk] + ext <;> simp [action,fb,fc] +theorem cv : ⁅c,v⁆ = ⁅b,c⁆ := by + simp only [b,v,c, SemiDirectSum.lie_eq_mk, SemiDirectSum.inl_eq_mk, SemiDirectSum.inr_eq_mk] + ext <;> simp [action,fb,fc] + +def chord (i j : Fin 4) : M := + match i.val, j.val with + | 0,1 | 1,0 => a + | 0,2 | 2,0 => u + | 0,3 | 3,0 => w + | 1,2 | 2,1 => b + | 1,3 | 3,1 => c + | 2,3 | 3,2 => v + | _,_ => 0 + +private theorem chord_symm (i j : Fin 4) : chord i j = chord j i := by + fin_cases i <;> fin_cases j <;> rfl + +private theorem chord_zero (i : Fin 4) : chord i i = 0 := by fin_cases i <;> rfl + +private theorem chord_disjoint (i j k l : Fin 4) + (hij : i ≠ j) (hik : i ≠ k) (hil : i ≠ l) + (hjk : j ≠ k) (hjl : j ≠ l) (hkl : k ≠ l) : ⁅chord i j,chord k l⁆ = 0 := by + fin_cases i <;> fin_cases j <;> simp_all only [ne_eq, not_true_eq_false] + all_goals fin_cases k <;> simp_all only [not_true_eq_false] + all_goals fin_cases l <;> simp_all only [not_true_eq_false] + all_goals dsimp only [chord] + all_goals simp only [w, lie_sub, sub_lie, lie_neg, neg_lie, + bu,cu,av,bv,lie_self] + all_goals grind [lie_skew, au,bu,cu,av,bv,cv] + +private theorem chord_three (i j k : Fin 4) + (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + ⁅chord i j,chord i k+chord j k⁆ = 0 := by + fin_cases i <;> fin_cases j <;> simp_all only [ne_eq, not_true_eq_false] + all_goals fin_cases k <;> simp_all only [not_true_eq_false] + all_goals dsimp only [chord] + all_goals simp only [w, lie_sub, sub_lie, lie_neg, neg_lie, lie_add, + au,bu,cu,av,bv,cv,lie_self] + all_goals grind [lie_skew, au,bu,cu,av,bv,cv] + +def representation : T4 →ₗ⁅ℝ⁆ M := + T4Universal.lift chord chord_symm chord_zero chord_disjoint chord_three + +@[simp] theorem representation_t (i j : Fin 4) : representation (t i j) = chord i j := + T4Universal.lift_t _ _ _ _ _ _ _ + +def fiberSpec : F →ₗ⁅ℝ⁆ L := FreeLieAlgebra.lift ℝ + (fun i => if i = 0 then x else if i = 1 then y else -x-y) +def baseSpec : L →ₗ⁅ℝ⁆ L := eval (-x-y) x + +@[simp] theorem fiberSpec_fa : fiberSpec fa = x := by simp [fiberSpec,fa] +@[simp] theorem fiberSpec_fb : fiberSpec fb = y := by simp [fiberSpec,fb] +@[simp] theorem fiberSpec_fc : fiberSpec fc = -x-y := by simp [fiberSpec,fc] +@[simp] theorem baseSpec_x : baseSpec x = -x-y := eval_x _ _ +@[simp] theorem baseSpec_y : baseSpec y = x := eval_y _ _ + +theorem spec_equivariant (q : L) (p : F) : + fiberSpec (action q p) = ⁅baseSpec q,fiberSpec p⁆ := by + apply free_action_inner + intro i j + cases i <;> fin_cases j <;> + simp [action, eval, baseSpec, fiberSpec, FreeDerivations.pair, + x,y,sub_lie,neg_lie,lie_sub,lie_neg] + +def specialize : M →ₗ⁅ℝ⁆ L := InnerSemiDirect.lift action fiberSpec baseSpec spec_equivariant + +@[simp] theorem specialize_a : specialize a = x := by simp [specialize,a, InnerSemiDirect.lift] +@[simp] theorem specialize_b : specialize b = y := by simp [specialize,b, InnerSemiDirect.lift] +@[simp] theorem specialize_c : specialize c = -x-y := by simp [specialize,c, InnerSemiDirect.lift] +@[simp] theorem specialize_u : specialize u = -x-y := by simp [specialize,u, InnerSemiDirect.lift] +@[simp] theorem specialize_v : specialize v = x := by simp [specialize,v, InnerSemiDirect.lift] + +@[simp] theorem eval_right (d e : M) (p : L) : + (eval d e p).right = eval d.right e.right p := + map_eval (SemiDirectSum.projr action) d e p + +def Fa (p : L) : F := (eval (u+b) v p - eval u v p).left +def Fb (p : L) : F := (eval (u+a) (v+c) p - eval u v p).left +def Fc (p : L) : F := (eval u (v+b) p - eval u v p).left + + theorem Fa_inl (p : L) : SemiDirectSum.inl action (Fa p) = eval (u+b) v p - eval u v p := by + ext + · rfl + · simp [eval_right, u,b,v] + theorem Fb_inl (p : L) : SemiDirectSum.inl action (Fb p) = eval (u+a) (v+c) p - eval u v p := by + ext + · rfl + · simp [eval_right, u,a,v,c] + theorem Fc_inl (p : L) : SemiDirectSum.inl action (Fc p) = eval u (v+b) p - eval u v p := by + ext + · rfl + · simp [eval_right, u,b,v] + +theorem eval_comm_a (p : L) : ⁅a,eval (u+b) v p⁆ = 0 := by + apply eval_commutes + · rw [lie_add,au]; exact neg_add_cancel _ + · exact av +theorem eval_comm_b (p : L) : ⁅b,eval (u+a) (v+c) p⁆ = 0 := by + apply eval_commutes + · rw [lie_add,bu]; grind [lie_skew] + · rw [lie_add,bv]; exact neg_add_cancel _ +theorem eval_comm_c (p : L) : ⁅c,eval u (v+b) p⁆ = 0 := by + apply eval_commutes + · exact cu + · rw [lie_add,cv]; grind [lie_skew] +theorem eval_comm_sum (p : L) : ⁅a+b+c,eval u v p⁆ = 0 := by + apply eval_commutes + · rw [add_lie,add_lie,au,bu,cu]; abel + · rw [add_lie,add_lie,av,bv,cv]; abel + +theorem fiber_identity (p : L) : + ⁅fa+fb+fc,Fb p⁆ = ⁅fa,Fb p-Fa p⁆ + ⁅fc,Fb p-Fc p⁆ := by + apply SemiDirectSum.inl_injective action + simp only [LieHom.map_lie, map_add, map_sub, Fa_inl,Fb_inl,Fc_inl] + change ⁅a+b+c,eval (u+a) (v+c) p - eval u v p⁆ = + ⁅a,(eval (u+a) (v+c) p - eval u v p) - (eval (u+b) v p - eval u v p)⁆ + + ⁅c,(eval (u+a) (v+c) p - eval u v p) - (eval u (v+b) p - eval u v p)⁆ + rw [lie_sub,eval_comm_sum] + simp only [lie_sub,add_lie,eval_comm_a,eval_comm_b,eval_comm_c] + abel + +theorem Fb_specialize {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 t + | n+1, t => ⁅a,adPower a n t⁆ + +omit [LieAlgebra ℝ M] in +@[simp] theorem adPower_zero (a t : M) : adPower a 0 t = t := rfl +omit [LieAlgebra ℝ M] in +@[simp] theorem adPower_succ (a t : M) (n : ℕ) : adPower a (n+1) t = ⁅a,adPower a n t⁆ := rfl +@[simp] theorem adPower_smul (a t : M) (n : ℕ) (r : ℝ) : + adPower a n (r • t) = r • adPower a n t := by + induction n <;> simp_all +omit [LieAlgebra ℝ M] in +@[simp] theorem adPower_zero_right (a : M) (n : ℕ) : adPower a n 0 = 0 := by + induction n <;> simp_all +omit [LieAlgebra ℝ M] in +@[simp] theorem adPower_self (a : M) {n : ℕ} (hn : 0 omega + | succ n => + induction n with + | zero => simp + | succ n ih => simp_all +omit [LieAlgebra ℝ M] in +@[simp] theorem adPower_zero_left (t : M) {n : ℕ} (hn : 0 simp_all + +def slope (p : L) (a b da db : M) : M := + (eval (Jet.mk a da : Jet ℝ M) (Jet.mk b db) p).velocity + +@[simp] theorem slope_x (a b da db : M) : slope x a b da db = da := by simp [slope] +@[simp] theorem slope_y (a b da db : M) : slope y a b da db = db := by simp [slope] +@[simp] theorem slope_zero (a b da db : M) : slope 0 a b da db = 0 := by simp [slope] +@[simp] theorem slope_add (p q : L) (a b da db : M) : + slope (p+q) a b da db = slope p a b da db + slope q a b da db := by simp [slope] +@[simp] theorem slope_smul (r : ℝ) (p : L) (a b da db : M) : + slope (r • p) a b da db = r • slope p a b da db := by simp [slope] +@[simp] theorem slope_lie (p q : L) (a b da db : M) : + slope ⁅p,q⁆ a b da db = ⁅slope p a b da db,eval a b q⁆ + + ⁅eval a b p,slope q a b da db⁆ := by simp [slope,LieHom.map_lie] + +@[simp] theorem slope_zero_direction (p : L) (a b : M) : slope p a b 0 0 = 0 := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq] + | hs r p hp => simp [hp] + | hl p q hp hq => simp [hp,hq] + +theorem slope_add_direction (p : L) (a b da db ea eb : M) : + slope p a b (da+ea) (db+eb) = slope p a b da db + slope p a b ea eb := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq]; abel + | hs r p hp => simp [hp,smul_add] + | hl p q hp hq => simp [hp,hq,add_lie,lie_add]; abel + +theorem slope_smul_direction (p : L) (a b da db : M) (r : ℝ) : + slope p a b (r • da) (r • db) = r • slope p a b da db := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq,smul_add] + | hs s p hp => simp [hp,smul_comm s r] + | hl p q hp hq => simp [hp,hq,smul_add] + +theorem word_pos {n : ℕ} {p : L} (hp : WeightedWord (fun _:Bool => 1) n p) : 0 omega + | bracket hp hq ihp ihq => omega + +def DiagonalData (n : ℕ) (p : L) (s k : ℝ) : Prop := + (n ≠ 1 → s = 0) ∧ ∀ (M : Type) [LieRing M] [LieAlgebra ℝ M] (a t : M), + eval (Jet.mk a 0 : Jet ℝ M) (Jet.mk (-a) t) p = + Jet.mk (s • a) (k • adPower a (n-1) t) + +theorem diagonal_bracket {n m : ℕ} {p q : L} {s k t l : ℝ} + (hn : 0 < n) (hm : 0 < m) (hp : DiagonalData n p s k) (hq : DiagonalData m q t l) : + ∃ r : ℝ, DiagonalData (n+m) ⁅p,q⁆ 0 r := by + rcases hp with ⟨hs,hp⟩ + rcases hq with ⟨ht,hq⟩ + by_cases hn1 : n=1 <;> by_cases hm1 : m=1 + · subst n; subst m + refine ⟨s*l-t*k, fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext + · simp + · change ⁅k • b,t • a⁆ + ⁅s • a,l • b⁆ = (s*l-t*k) • ⁅a,b⁆ + rw [smul_lie,lie_smul,←lie_skew b a,smul_neg,smul_lie,lie_smul] + simp only [sub_smul,mul_smul] + module + · subst n + have ht0 := ht hm1 + subst t + refine ⟨s*l, fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext + · simp + · have he : 1+m-1 = (m-1)+1 := by omega + simp [he,mul_smul,smul_comm l s] + · subst m + have hs0 := hs hn1 + subst s + refine ⟨-(t*k), fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext + · simp + · have he : n+1-1 = (n-1)+1 := by omega + simp only [Jet.velocity_lie,zero_smul,zero_lie,he,adPower_succ, + smul_lie,lie_smul,neg_smul,mul_smul] + rw [←lie_skew (adPower a (n-1) b) a,smul_neg,smul_neg] + rw [smul_comm] + simp + · have hs0 := hs hn1 + have ht0 := ht hm1 + subst s; subst t + refine ⟨0, fun _ => rfl, ?_⟩ + intro M _ _ a b + rw [LieHom.map_lie,hp,hq] + ext <;> simp + +theorem diagonal_word {n : ℕ} {p : L} (hp : WeightedWord (fun _:Bool => 1) n p) : + ∃ s k : ℝ, DiagonalData n p s k := by + induction hp with + | generator i => + cases i + · refine ⟨1,0, ?_⟩ + constructor + · simp + · intro M _ _ a b; simp [eval] + · refine ⟨-1,1, ?_⟩ + constructor + · simp + · intro M _ _ a b; simp [eval] + | bracket hp hq ihp ihq => + rcases ihp with ⟨s,k,hp'⟩ + rcases ihq with ⟨t,l,hq'⟩ + obtain ⟨r,hr⟩ := diagonal_bracket (word_pos hp) (word_pos hq) hp' hq' + exact ⟨0,r,hr⟩ + +theorem diagonal_homogeneous {n : ℕ} {p : L} (hp : p ∈ Ln n) : + ∃ s k : ℝ, DiagonalData n p s k := by + induction hp using Submodule.span_induction with + | mem p hp => exact diagonal_word hp + | zero => + refine ⟨0,0,fun _ => rfl,?_⟩ + intro M _ _ a b + ext <;> simp + | add p q _ _ hp hq => + rcases hp with ⟨s,k,hs,hp⟩ + rcases hq with ⟨t,l,ht,hq⟩ + refine ⟨s+t,k+l,fun hn => by simp [hs hn,ht hn],?_⟩ + intro M _ _ a b + rw [map_add,hp,hq] + ext <;> simp [add_smul] + | smul r p _ hp => + rcases hp with ⟨s,k,hs,hp⟩ + refine ⟨r*s,r*k,fun hn => by simp [hs hn],?_⟩ + intro M _ _ a b + rw [map_smul,hp] + ext <;> simp [mul_smul] + + theorem slope_neg_direction (p : L) (a b da db : M) : + slope p a b (-da) (-db) = -slope p a b da db := by + simpa using slope_smul_direction p a b da db (-1) + + theorem slope_inner (p : L) (a b t : M) : + slope p a b ⁅t,a⁆ ⁅t,b⁆ = ⁅t,eval a b p⁆ := by + induction p using freeLie_induction with + | h0 => simp + | hg i => cases i <;> simp [slope,eval] + | ha p q hp hq => simp [hp,hq,lie_add] + | hs r p hp => simp [hp] + | hl p q hp hq => simp [hp,hq,LieHom.map_lie,lie_lie] + + theorem slope_swap {p : L} (hp : p ∈ W) (a b da db : M) : + slope p a b da db = -slope p b a db da := by + exact congrArg Jet.velocity (solution_swap hp (Jet.mk a da : Jet ℝ M) (Jet.mk b db)) + + theorem diagonal_slope {n : ℕ} {p : L} {s k : ℝ} + (hp : DiagonalData n p s k) (a t : M) : + slope p a (-a) 0 t = k • adPower a (n-1) t := + congrArg Jet.velocity (hp.2 M a t) + + theorem diagonal_first {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 if i=0 then a else if i=1 then b else c) +@[simp] theorem fiberEval_fa (a b c : M) : fiberEval a b c SpecialFiber.fa = a := by + simp [fiberEval,SpecialFiber.fa] +@[simp] theorem fiberEval_fb (a b c : M) : fiberEval a b c SpecialFiber.fb = b := by + simp [fiberEval,SpecialFiber.fb] +@[simp] theorem fiberEval_fc (a b c : M) : fiberEval a b c SpecialFiber.fc = c := by + simp [fiberEval,SpecialFiber.fc] + + theorem fiberEval_spec (a b : M) (z : SpecialFiber.F) : + fiberEval a b (-a-b) z = eval a b (SpecialFiber.fiberSpec z) := by + have h : fiberEval a b (-a-b) = (eval a b).comp SpecialFiber.fiberSpec := by + apply FreeLieAlgebra.hom_ext + intro i + fin_cases i <;> simp [fiberEval,SpecialFiber.fiberSpec] + exact LieHom.congr_fun h z + +@[simp] theorem fiberEval_base (a b c : Jet ℝ M) (z : SpecialFiber.F) : + (fiberEval a b c z).base = fiberEval a.base b.base c.base z := by + have h : Jet.baseHom.comp (fiberEval a b c) = fiberEval a.base b.base c.base := by + apply FreeLieAlgebra.hom_ext + intro i + fin_cases i <;> simp [fiberEval,Jet.baseHom] <;> rfl + exact LieHom.congr_fun h z + + theorem fiberEval_Fb {n : ℕ} {p : L} (hp : p ∈ Ln n) (hn : 1 simp + rw [hc] at H + simp only [Jet.mk_add,Jet.mk_neg,Jet.mk_sub,zero_add,add_zero,neg_zero,sub_zero,zero_sub] at H + have Hv := congrArg Jet.velocity H + simp only [Jet.velocity_lie,Jet.velocity_sub,Jet.velocity_add,Jet.velocity_neg, + Jet.base_add,Jet.base_sub,Jet.base_neg,eval_base,fiberEval_base] at Hv + have hdiagNeg : -(-a-b) = a+b := by abel + have hba : b+(-a-b) = -a := by abel + have hab : -b-(-a-b) = a := by abel + have hc0 : eval (-a-b) (a+b) p = 0 := by + have h := eval_vanish_of_commuting (-a-b) (-(-a-b)) (by simp only [lie_neg,lie_self,neg_zero]) hpn hn + simpa only [hdiagNeg] using h + have hdelc : -eval (-a-b) (a+b) p + eval (-a-b) b p + eval b (-b-a) p = 0 := by + rw [hc0,neg_zero,zero_add,solution_swap hp (-a-b) b] + have he : -b-a = -a-b := by abel + rw [he,neg_add_cancel] + have hdp : slope p (-a-b) (a+b) t 0 = k • adPower (-a-b) (n-1) t := by + rw [← hdiagNeg,diagonal_first hpn hn,diagonal_slope hdiag] + have hdm : slope p b a 0 (-t) = -slope p b a 0 t := by + simpa only [neg_zero] using slope_neg_direction p b a 0 t + have hswap := slope_swap hp (-a-b) b t 0 + have hnp : n=(n-1)+1 := by omega + change ⁅t,fiberEval a b (-a-b) (SpecialFiber.Fb p)⁆ + ⁅(0:M),_⁆ = + (⁅(0:M),_⁆ + ⁅a,slope p a (b+(-a-b)) 0 t - slope p a b 0 0 - + slope p b (-b-(-a-b)) 0 (-t)⁆) + + (⁅t,-eval (-a-b) (a+b) p + eval (-a-b) b p + eval b (-b-a) p⁆ + + ⁅-a-b,-slope p (-a-b) (a+b) t 0 + slope p (-a-b) b t 0 + + slope p b (-b-a) 0 0⁆) at Hv + rw [fiberEval_Fb hpn hn,hdelc,hba,hab,slope_zero_direction,slope_zero_direction, + diagonal_slope hdiag,hdp,hdm,hswap] at Hv + simp only [zero_lie,lie_zero,add_zero,zero_add,sub_zero,lie_neg,lie_sub,lie_add,lie_smul] at Hv + rw [show ⁅a,adPower a (n-1) t⁆ = adPower a n t by rw [hnp]; rfl, + show ⁅-a-b,adPower (-a-b) (n-1) t⁆ = adPower (-a-b) n t by rw [hnp]; rfl] at Hv + rw [smul_sub] + grind only + + theorem slope_G_formula {n : ℕ} {p : L} {k : ℝ} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 1 apply Jet.ext <;> rfl + map_smul' r a := by apply Jet.ext <;> apply Jet.ext <;> rfl + map_lie' {a b} := by + apply Jet.ext <;> apply Jet.ext + all_goals simp only [Jet.base_lie,Jet.velocity_lie,Jet.base_add,Jet.velocity_add] + all_goals first | rfl | abel + +theorem mixed_slope (p : L) (a b u v : M) : + (slope p (Jet.mk a u : Jet ℝ M) (Jet.mk b 0) (Jet.mk v 0) 0).velocity = + (slope p (Jet.mk a v : Jet ℝ M) (Jet.mk b 0) (Jet.mk u 0) 0).velocity := by + have h := map_eval (swapJet : Jet ℝ (Jet ℝ M) →ₗ⁅ℝ⁆ Jet ℝ (Jet ℝ M)) + (Jet.mk (Jet.mk a u) (Jet.mk v 0)) (Jet.mk (Jet.mk b 0) 0) p + exact congrArg (fun z => z.velocity.velocity) h + +@[simp] theorem adPower_base (a t : Jet ℝ M) (n : ℕ) : + (adPower a n t).base = adPower a.base n t.base := by + induction n <;> simp_all + +theorem adPower_radial (a t : M) (n : ℕ) : + (adPower (Jet.mk a a : Jet ℝ M) n (Jet.mk t 0)).velocity = + (n : ℝ) • adPower a n t := by + induction n with + | zero => simp + | succ n ih => + simp only [adPower_succ,Jet.velocity_lie,adPower_base,ih,lie_smul, + Nat.cast_add,Nat.cast_one,add_smul,one_smul] + abel + +theorem adPower_transverse_self (a t : M) {n : ℕ} (hn : 0 omega + | succ n => + induction n with + | zero => simp [lie_skew] + | succ n ih => + rw [adPower_succ,Jet.velocity_lie,adPower_base] + change ⁅t,adPower a (n+1) a⁆ + + ⁅a,(adPower (Jet.mk a t : Jet ℝ M) (n+1) (Jet.mk a 0)).velocity⁆ = _ + rw [adPower_self a (n := n+1) (by omega),lie_zero,zero_add,ih (by omega),lie_neg] + rfl + +theorem adPower_zero_base (a t : M) {n : ℕ} (hn : 1 omega + | succ n => + simp only [adPower_succ,Jet.velocity_lie,adPower_base,zero_lie,add_zero] + rw [adPower_zero_left t (by omega),lie_zero] + + theorem mixed_scalar {n : ℕ} {p : L} {k : ℝ} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 2 simp + have hc2 : -(Jet.mk a t : Jet ℝ M) - Jet.mk (-a) 0 = Jet.mk 0 (-t) := by + ext <;> simp + rw [hc1] at H1 + rw [hc2] at H2 + simp only [Jet.velocity_smul,Jet.velocity_sub,adPower_radial, + adPower_zero_base (-a) t (n := n) (by omega),sub_zero] at H1 + simp only [Jet.velocity_smul,Jet.velocity_sub, + adPower_transverse_self a t (n := n) (by omega),adPower_zero_base (-t) a (n := n) (by omega),sub_zero] at H2 + have hm := mixed_slope (G p) a (-a) a t + rw [H1,H2] at hm + have hz : (-k) • ((n:ℝ) • adPower a n t) - (-k) • (-adPower a n t) = 0 := sub_eq_zero.mpr hm + calc + (((n : ℝ)+1)*k) • adPower a n t = + -((-k) • ((n:ℝ) • adPower a n t) - (-k) • (-adPower a n t)) := by module + _ = 0 := by rw [hz,neg_zero] + + theorem diagonal_scalar_zero {n : ℕ} {p : L} {k : ℝ} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 2 fin_cases j <;> norm_num [a,t,Ring.lie_def,Matrix.mul_apply,Fin.sum_univ_two] + have had (m : ℕ) : adPower a m t = t := by + induction m with + | zero => rfl + | succ m ih => rw [adPower_succ,ih,hbr] + have H := mixed_scalar hp hpn hn hdiag a t + rw [had] at H + have hc := congrArg (fun z => z 0 1) H + change (((n : ℝ)+1)*k) * 1 = 0 at hc + rw [mul_one] at hc + exact (mul_eq_zero.mp hc).resolve_left (by positivity) + + theorem special_linearization {n : ℕ} {p : L} (hp : p ∈ W) (hpn : p ∈ Ln n) + (hn : 2 if b then some () else none + invFun := fun o => o.isSome + left_inv b := by cases b <;> rfl + right_inv o := by cases o with | none => rfl | some u => cases u; rfl + +def letters : Slot ≃ QuadraticAlphabet.Letter where + toFun := fun | .A => .a | .C => .c | .B => .b + invFun := fun | .a => .A | .c => .C | .b => .B + left_inv s := by cases s <;> rfl + right_inv s := by cases s <;> rfl + +def under : FreeLieAlgebra K Slot →ₗ⁅K⁆ A K Bool := quad.toLieHom.comp embed + +@[simp] theorem under_apply (p : FreeLieAlgebra K Slot) : under p=quad (embed p) := rfl + +theorem quad_transport : (renameAssoc bitOption).comp quad= + QuadraticAlphabet.substitution.comp (renameAssoc letters) := by + apply hom_ext + intro k + cases k <;> simp [quad,letters,bitOption,QuadraticAlphabet.substitution, + QuadraticAlphabet.x,QuadraticAlphabet.y,Ring.lie_def] + +theorem quad_transport_inv : (renameAssoc bitOption.symm).comp QuadraticAlphabet.substitution= + quad.comp (renameAssoc letters.symm) := by + apply hom_ext + intro k + cases k <;> simp [quad,letters,bitOption,QuadraticAlphabet.substitution, + QuadraticAlphabet.x,QuadraticAlphabet.y,Ring.lie_def] + +theorem quad_injective : Function.Injective quad := by + intro p q hp + apply assoc_injective letters letters.symm letters.left_inv + apply QuadraticAlphabet.substitution_injective + have h := congrArg (renameAssoc bitOption) hp + exact (AlgHom.congr_fun quad_transport p).symm.trans (h.trans (AlgHom.congr_fun quad_transport q)) + +theorem under_injective : Function.Injective under := by + intro p q h + exact UniversalEmbedding.injective (quad_injective h) + +theorem degree_length {α : Type*} (w : FreeMonoid α) : degree (fun _ : α => 1) w=w.toList.length := by + simp [degree] + +theorem tree_degree_length {α : Type*} (t : UniversalEmbedding.Tree α) : + LieGrading.treeDegree (fun _ : α => 1) t=t.leaves.length := by + simp [LieGrading.treeDegree] + +theorem representation {ψ : FreeLieAlgebra K Bool} {n : ℕ} (hn : 1 1) n) : + ∃! p : FreeLieAlgebra K Slot,under p=embed ψ := by + have ho : embed (rename bitOption ψ)∈homogeneous (fun _ => 1) n := by + rw [rename_embed] + apply algHom_homogeneous (renameAssoc bitOption) (fun _ => 1) (fun _ => 1) ?_ hψ + intro a + rw [renameAssoc_atom] + exact word_mem (FreeMonoid.of (bitOption a)) (degree_of _ _) + have hl : rename bitOption ψ∈QuadraticAlphabet.homogeneous n := by + have h := LieGrading.homogeneous_iff.mpr ho + apply (show (LieGrading.homogeneousLie (fun _ : Option Unit => 1) n : + Submodule K (FreeLieAlgebra K (Option Unit))) ≤ QuadraticAlphabet.homogeneous n from ?_) h + apply Submodule.span_le.mpr + rintro p ⟨t,ht,rfl⟩ + exact Submodule.subset_span ⟨t,(tree_degree_length t) ▸ ht,rfl⟩ + obtain ⟨p,hp,_⟩ := QuadraticAlphabet.homogeneous_representation hn hl + refine ⟨rename letters.symm p,?_,fun q hq => under_injective (hq.trans ?_)⟩ + · change quad (embed (rename letters.symm p))=embed ψ + rw [rename_embed] + rw [← AlgHom.comp_apply,← quad_transport_inv,AlgHom.comp_apply] + change renameAssoc bitOption.symm (QuadraticAlphabet.under p)=embed ψ + rw [hp,rename_embed,assoc_retract bitOption bitOption.symm bitOption.left_inv] + · change embed ψ=quad (embed (rename letters.symm p)) + rw [rename_embed,← AlgHom.comp_apply,← quad_transport_inv,AlgHom.comp_apply] + change embed ψ=renameAssoc bitOption.symm (QuadraticAlphabet.under p) + rw [hp,rename_embed,assoc_retract bitOption bitOption.symm bitOption.left_inv] + +theorem quad_homogeneous (a : Slot) : quad (atom a)∈homogeneous (fun _ => 1) (weight a) := by + have hx : (atom false : A K Bool)∈homogeneous (fun _ => 1) 1 := word_mem _ rfl + have hy : (atom true : A K Bool)∈homogeneous (fun _ => 1) 1 := word_mem _ rfl + cases a with + | A => + rw [quad,lift_atom] + have h := homogeneous_mul hx hx + exact h + | C => + rw [quad,lift_atom] + have h1 := homogeneous_mul hx hy + have h2 := homogeneous_mul hy hx + exact (homogeneous _ 2).sub_mem h1 h2 + | B => simpa only [quad,lift_atom,weight] using hy + +theorem representation_weight {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n : ℕ} + (hψ : embed ψ∈homogeneous (fun _ => 1) n) (hp : under p=embed ψ) : + embed p∈homogeneous weight n := by + apply homogeneous_reflect quad weight (fun _ => 1) quad_homogeneous quad_injective + change under p∈_ + rw [hp] + exact hψ + +theorem weight_count (w : FreeMonoid Slot) : degree weight w=2*degree acCount w+degree bCount w := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + simp only [degree_mul,degree_of,ih] + cases a <;> simp [weight,acCount,bCount,aCount,cCount] <;> omega + +theorem leading_ac {p : A K Slot} {n r m : ℕ} (hp : p∈homogeneous weight n) + (hb : p∈homogeneous bCount r) (hn : n=2*m+r) : p∈homogeneous acCount m := by + apply mem_space + intro w hw + have h1 := mem_space_iff.mp hp w hw + have h2 := mem_space_iff.mp hb w hw + have h3 := weight_count w + omega + +theorem leading_rows {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n r : ℕ} + (hp : under p=embed ψ) (hw : embed p∈homogeneous weight n) + (hr : r a≠Slot.A) (LieGrading.piece bCount r p)=0) : + LieGrading.piece bCount r p∈LetterRetraction.sub (fun a => a≠Slot.C) := by + refine RowKernel.kernel_no_C _ m r ?_ ?_ hz ?_ + · rw [LieGrading.embed_piece] + exact leading_ac (project_preserves hw) (piece_mem bCount r (embed p)) hn + · rw [LieGrading.embed_piece] + exact piece_mem bCount r (embed p) + · intro s _ hs + exact leading_rows hp hw hr hb he s hs + +end QuadraticLeading + +namespace BaseChangeEquations +open AssociativeEvaluation +variable {R S : Type*} [CommRing R] [CommRing S] + +def special (q : FreeLieAlgebra R Bool) : FreeLieAlgebra R Bool := + ⁅(x : FreeLieAlgebra R Bool),eval y x q⁆+⁅(-x-y : FreeLieAlgebra R Bool),eval y (-x-y) q⁆ + +theorem cast_special (q : FreeLieAlgebra ℤ Bool) : + IntegralBaseChange.lie (S:=S) (special q)=special (IntegralBaseChange.lie q) := by + simp only [special,map_add,LieHom.map_lie,cast_eval_lie,map_sub,map_neg,cast_x,cast_y] + +theorem reduce_special (q : FreeLieAlgebra ℤ Bool) {n : ℕ} + (hq : (IntegralBaseChange.lie q : L)∈W) + (hw : (IntegralBaseChange.lie q : L)∈Ln n) (hn : 2 simp [eval,x,y] + exact LieHom.congr_fun h q + +theorem swapped {q : FreeLieAlgebra R Bool} (hq : antisymmetry q=0) + (a b : FreeLieAlgebra R Bool) : eval a b q+eval b a q=0 := by + have h := congrArg (eval a b) hq + simpa only [antisymmetry,map_add,eval_comp,eval_y,eval_x,map_zero] using h + +end BaseChangeEquations +namespace TwoModule +variable {M : Type*} [AddCommGroup M] [Module (ZMod 2) M] +theorem add_self (a : M) : a+a=0 := by + calc a+a=((1 : ZMod 2)+1) • a := by rw [add_smul,one_smul] + _=0 := by rw [show (1 : ZMod 2)+1=0 from by decide,zero_smul] + +theorem neg_eq (a : M) : -a=a := by + apply neg_eq_iff_add_eq_zero.mpr + exact add_self a + +theorem sub_eq_add (a b : M) : a-b=a+b := by rw [sub_eq_add_neg,neg_eq] + +theorem eq_of_add_zero {a b : M} (h : a+b=0) : a=b := by + have := eq_neg_of_add_eq_zero_left h + simpa only [neg_eq] using this +end TwoModule +namespace BaseChangeEquations +abbrev K := ZMod 2 + +theorem deletion_special {q : FreeLieAlgebra K Bool} + (ha : antisymmetry q=0) (hs : special q=0) : + ⁅(x : FreeLieAlgebra K Bool),q+eval (x+y) y q⁆+⁅(y : FreeLieAlgebra K Bool),eval (x+y) y q⁆=0 := by + have hswap : eval y x q=q := by + exact (TwoModule.eq_of_add_zero ha).symm + have hswap2 : eval y (x+y) q=eval (x+y) y q := + TwoModule.eq_of_add_zero (swapped ha y (x+y)) + simp only [special,TwoModule.neg_eq,TwoModule.sub_eq_add,hswap,hswap2,add_lie] at hs + simpa only [lie_add,add_assoc] using hs +end BaseChangeEquations + +namespace WordGrading +open AssociativeElimination +variable {R α : Type*} [CommRing R] + +def lower (wt : α → ℕ) (c n : ℕ) : Submodule R (A R α) := space (fun w => degree wt w+c=n) + +theorem lower_mul_homogeneous {wt : α → ℕ} {c n m : ℕ} {p q : A R α} + (hp : p∈lower wt c n) (hq : q∈homogeneous wt m) : p*q∈lower wt c (n+m) := + mul_mem (by intro u v hu hv; simp only [degree_mul]; omega) hp hq + +theorem homogeneous_mul_lower {wt : α → ℕ} {c n m : ℕ} {p q : A R α} + (hp : p∈homogeneous wt n) (hq : q∈lower wt c m) : p*q∈lower wt c (n+m) := + mul_mem (by intro u v hu hv; simp only [degree_mul]; omega) hp hq + +theorem deriv_lower (wt : α → ℕ) (c : ℕ) (f : α → A R α) + (hf : ∀ a,f a∈lower wt c (wt a)) {n : ℕ} {p : A R α} + (hp : p∈homogeneous wt n) : deriv f p∈lower wt c n := by + have hw (w : FreeMonoid α) : deriv f (word w)∈lower wt c (degree wt w) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,word_of,AssociativeElimination.deriv_mul,deriv_atom] + simp only [degree_mul,degree_of] + exact (lower wt c _).add_mem + (lower_mul_homogeneous (hf a) (word_mem w rfl)) + (homogeneous_mul_lower (word_mem (FreeMonoid.of a) (degree_of wt a)) ih) + exact map_space (deriv f) _ (by intro w h; simpa only [h] using hw w) hp + +theorem deriv_lowers_above (wt : α → ℕ) (c : ℕ) (f : α → A R α) + (hf : ∀ a,f a∈lower wt c (wt a)) {n : ℕ} {p : A R α} + (hp : p∈above wt n) : deriv f p∈above wt (n-c) := by + apply map_space (deriv f) _ ?_ hp + intro w hw + apply space_mono (P:=fun v => degree wt v+c=degree wt w) ?_ + (deriv_lower wt c f hf (word_mem w rfl)) + intro v hv + omega + +theorem lower_homogeneous {wt : α → ℕ} {c n : ℕ} {p : A R α} + (hp : p∈lower wt c n) : p∈homogeneous wt (n-c) := + space_mono (by intro w hw; omega) hp + +theorem piece_zero_of_above {wt : α → ℕ} {n k : ℕ} {p : A R α} + (hp : p∈above wt n) (hkn : k atom .C | _ => 0 +def high : Slot → A K Slot | .C => atom .A*atom .B-atom .B*atom .A | _ => 0 +def delta : Slot → A K Slot := fun a => low a+high a + +def tau : A K Slot →ₐ[K] A K Slot := lift (fun + | .A => atom .A+atom .C+atom .B*atom .B | .C => atom .C | .B => atom .B) +def tau0 : A K Slot →ₐ[K] A K Slot := lift (fun + | .A => atom .A+atom .C | .C => atom .C | .B => atom .B) + +theorem deriv_add (f g : Slot → A K Slot) (p : A K Slot) : + deriv (fun a => f a+g a) p=deriv f p+deriv g p := by + simpa only [TwoModule.sub_eq_add] using WordGrading.deriv_sub f g p + +theorem delta_split (p : A K Slot) : deriv delta p=deriv low p+deriv high p := deriv_add low high p + +theorem quad_delta (p : A K Slot) : + quad (deriv delta p)=atom false*quad p-quad p*atom false := by + have hg (a : Slot) : quad (delta a)=atom false*quad (atom a)-quad (atom a)*atom false := by + cases a <;> simp only [delta,low,high,quad,lift_atom,map_add,map_mul,map_zero, + zero_add,add_zero,TwoModule.sub_eq_add,mul_add,add_mul] + · simp [mul_assoc,TwoModule.add_self] + · have h : (atom false*atom true*atom false : A K Bool)+atom false*atom true*atom false=0 := TwoModule.add_self _ + simp only [mul_assoc] at h ⊢ + apply eq_of_sub_eq_zero + calc _ = -(atom false*(atom true*atom false)+atom false*(atom true*atom false)) := by abel + _ = 0 := by rw [h,neg_zero] + have hw (w : FreeMonoid Slot) : quad (deriv delta (word w))=atom false*quad (word w)-quad (word w)*atom false := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,word_of,AssociativeElimination.deriv_mul,map_add,map_mul,map_mul,deriv_atom,hg,ih,map_mul] + noncomm_ring + induction p using MonoidAlgebra.induction_on with + | of w => exact hw w + | add p q hp hq => simp only [map_add,hp,hq,mul_add,add_mul]; abel + | smul c p hp => simp only [map_smul,hp,mul_smul_comm,smul_mul_assoc,smul_sub] + +theorem quad_tau : quad.comp tau=(algEval (atom false+atom true) (atom true)).comp quad := by + apply hom_ext + intro a + cases a <;> simp only [AlgHom.comp_apply,tau,quad,algEval,lift_atom,map_add,map_mul, + Bool.false_eq_true,↓reduceIte,TwoModule.sub_eq_add,mul_add,add_mul] + · abel + · have h : (atom true*atom true : A K Bool)+atom true*atom true=0 := TwoModule.add_self _ + apply eq_of_sub_eq_zero + calc _ = -(atom true*atom true+atom true*atom true) := by abel + _ = 0 := by rw [h,neg_zero] + +theorem embed_eval (a b : FreeLieAlgebra K Bool) (ψ : FreeLieAlgebra K Bool) : + embed (BaseChangeEquations.eval a b ψ)=algEval (embed a) (embed b) (embed ψ) := by + rw [AssociativeEvaluation.map_eval,algEval,AssociativeEvaluation.lift_embed] + rfl + +theorem full_equation {ψ : FreeLieAlgebra K Bool} {p : A K Slot} + (hp : quad p=embed ψ) (ha : BaseChangeEquations.antisymmetry ψ=0) + (hs : BaseChangeEquations.special ψ=0) : + deriv delta (p+tau p)+(atom .B*tau p-tau p*atom .B)=0 := by + apply QuadraticLeading.quad_injective + rw [map_zero,map_add,quad_delta,map_add,map_sub,map_mul,map_mul] + have hτ : quad (tau p)=embed (BaseChangeEquations.eval + (BaseChangeEquations.x+BaseChangeEquations.y) BaseChangeEquations.y ψ) := by + rw [← AlgHom.comp_apply,quad_tau,AlgHom.comp_apply,hp,embed_eval] + simp only [map_add,BaseChangeEquations.x,BaseChangeEquations.y,embed_of] + rw [hp,hτ] + have h := congrArg embed (BaseChangeEquations.deletion_special ha hs) + simpa only [map_add,LieHom.map_lie,Ring.lie_def,map_zero,BaseChangeEquations.x, + BaseChangeEquations.y,embed_of,quad,lift_atom] using h + +theorem low_degree (a : Slot) : low a∈lower bCount 1 (bCount a) := by + cases a <;> simp only [low,bCount] + · exact (lower bCount 1 0).zero_mem + · exact (lower bCount 1 0).zero_mem + · exact word_mem (FreeMonoid.of Slot.C) rfl + +theorem high_degree (a : Slot) : high a∈homogeneous bCount (bCount a+1) := by + have hA : (atom Slot.A : A K Slot)∈homogeneous bCount 0 := word_mem _ rfl + have hB : (atom Slot.B : A K Slot)∈homogeneous bCount 1 := word_mem _ rfl + cases a with + | A => exact (homogeneous bCount 1).zero_mem + | C => + have h1 := homogeneous_mul hA hB + have h2 := homogeneous_mul hB hA + exact (homogeneous bCount 1).sub_mem h1 h2 + | B => exact (homogeneous bCount 2).zero_mem + +theorem tau0_degree (a : Slot) : tau0 (atom a)∈homogeneous bCount (bCount a) := by + cases a <;> simp only [tau0,lift_atom,bCount] + · exact (homogeneous bCount 0).add_mem (word_mem _ rfl) (word_mem _ rfl) + · exact word_mem _ rfl + · exact word_mem _ rfl + +theorem tau_difference (a : Slot) : tau (atom a)-tau0 (atom a)∈above bCount (bCount a+1) := by + cases a <;> simp only [tau,tau0,lift_atom,add_sub_cancel_left,sub_self,bCount] + · have hB : (atom Slot.B : A K Slot)∈homogeneous bCount 1 := word_mem _ rfl + have h := homogeneous_mul hB hB + apply space_mono (P:=fun w => degree bCount w=2) ?_ h + intro w hw + simp only [ reduceCtorEq,↓reduceIte] + omega + · exact (above bCount 1).zero_mem + · exact (above bCount 2).zero_mem + +theorem tau_degree (a : Slot) : tau (atom a)∈above bCount (bCount a) := by + have h1 := homogeneous_above (tau0_degree a) + have h2 : tau (atom a)-tau0 (atom a)∈above bCount (bCount a) := + space_mono (by intro w hw; omega) (tau_difference a) + have he : tau (atom a)=(tau (atom a)-tau0 (atom a))+tau0 (atom a) := by abel + rw [he] + exact (above bCount _).add_mem h2 h1 + +theorem leading_equation {p q : A K Slot} {r : ℕ} (hr : 0 homogeneous_above (high_degree a)) ((above bCount r).add_mem hp hpt) + have hB : (atom Slot.B : A K Slot)∈above bCount 1 := homogeneous_above (word_mem _ rfl) + have hbr : atom Slot.B*tau p-tau p*atom Slot.B∈above bCount (r+1) := by + exact (above bCount _).sub_mem (by simpa only [Nat.add_comm] using above_mul hB hpt) (above_mul hpt hB) + have hhg' : deriv high (p+tau p)∈above bCount r := space_mono (by intro w hw; omega) hhg + have hbr' : atom Slot.B*tau p-tau p*atom Slot.B∈above bCount r := space_mono (by intro w hw; omega) hbr + have hl' : deriv low ((p-q)+(tau p-tau0 q))∈above bCount r := by simpa using hl + apply homogeneous_add_high_zero hlead ((above bCount r).add_mem ((above bCount r).add_mem hl' hhg') hbr') (by omega) + rw [delta_split] at he + convert he using 1; simp only [map_add,map_sub]; abel + +end + +open AssociativeElimination WordGrading RowTwo RowKernel + +def coeff (p : A K Slot) (s : List Slot) : K := p.coeff (FreeMonoid.ofList s) +def monomial (s : List Slot) : A K Slot := word (FreeMonoid.ofList s) + +@[simp] theorem monomial_nil : monomial []=1 := rfl +@[simp] theorem monomial_cons (a : Slot) (s : List Slot) : monomial (a::s)=atom a*monomial s := by + exact word_mul (FreeMonoid.of a) (FreeMonoid.ofList s) +@[simp] theorem coeff_add (p q : A K Slot) (s : List Slot) : coeff (p+q) s=coeff p s+coeff q s := rfl +@[simp] theorem coeff_smul (c : K) (p : A K Slot) (s : List Slot) : coeff (c • p) s=c*coeff p s := rfl +@[simp] theorem coeff_zero (s : List Slot) : coeff 0 s=0 := rfl +@[simp] theorem coeff_monomial (s t : List Slot) : coeff (monomial s) t=if s=t then 1 else 0 := by + classical + change (Finsupp.single (FreeMonoid.ofList s) (1 : K)) (FreeMonoid.ofList t)=_ + rw [Finsupp.single_apply] + simp only [Equiv.apply_eq_iff_eq] +@[simp] theorem coeff_monomial_fun (s : List Slot) : coeff (monomial s)=(fun t => if s=t then 1 else 0) := by + funext t + exact coeff_monomial s t +@[simp] theorem coeff_one_nil : coeff 1 []=1 := by exact coeff_monomial [] [] +@[simp] theorem coeff_one_cons (a : Slot) (s : List Slot) : coeff 1 (a::s)=0 := by + simpa using coeff_monomial [] (a::s) + +@[simp] theorem coeff_atom_mul_nil (a : Slot) (p : A K Slot) : coeff (atom a*p) []=0 := by + apply MonoidAlgebra.coeff_single_mul_of_forall_mul_ne + intro v hv + have h := congrArg FreeMonoid.toList hv + simp at h + +@[simp] theorem coeff_atom_mul_cons (a b : Slot) (p : A K Slot) (s : List Slot) : + coeff (atom a*p) (b::s)=if a=b then coeff p s else 0 := by + by_cases h : a=b + · subst b + change (MonoidAlgebra.single (FreeMonoid.of a) 1*p).coeff (FreeMonoid.of a*FreeMonoid.ofList s)=_ + rw [MonoidAlgebra.coeff_single_mul_mul] + simp only [one_mul] + rfl + · rw [ite_eq_right h] + apply MonoidAlgebra.coeff_single_mul_of_forall_mul_ne + intro v hv + have he := congrArg FreeMonoid.toList hv + simp only [FreeMonoid.toList_mul,FreeMonoid.toList_of,FreeMonoid.toList_ofList,List.singleton_append] at he + exact h (List.cons.inj he).1 + +def collapse : Slot → Slot | .C => .A | a => a + +def fills : List Slot → List (List Slot) + | [] => [] + | a::s => (if a=.C then [Slot.B::s.map collapse] else []) ++ (fills s).map (collapse a :: ·) + +def noC (s : List Slot) : Prop := ∀ a∈s,a≠Slot.C + +@[simp] theorem noC_nil : noC [] := by simp [noC] +@[simp] theorem noC_cons (a : Slot) (s : List Slot) : noC (a::s) ↔ a≠Slot.C ∧ noC s := by simp [noC] +@[simp] theorem noC_append (s t : List Slot) : noC (s++t) ↔ noC s ∧ noC t := by simp only [noC,List.mem_append,or_imp,forall_and] + +@[simp] theorem tau0_atom (a : Slot) : tau0 (atom a)=match a with + | .A => atom .A+atom .C | .C => atom .C | .B => atom .B := lift_atom _ a + +theorem tau0_monomial_coeff (v : List Slot) (hv : noC v) (s : List Slot) : + coeff (tau0 (monomial v)) s=coeff (monomial v) (s.map collapse) := by + induction v generalizing s with + | nil => cases s <;> simp + | cons a v ih => + obtain ⟨ha,hv'⟩ := noC_cons _ _ |>.mp hv + cases a with + | C => exact (ha rfl).elim + | A => + cases s with + | nil => simp [add_mul] + | cons b s => cases b <;> simp [add_mul,ih hv' s,collapse] + | B => + cases s with + | nil => simp + | cons b s => cases b <;> simp [ih hv' s,collapse] + +theorem deriv_tau0_monomial_coeff (v : List Slot) (hv : noC v) (s : List Slot) : + coeff (deriv low (tau0 (monomial v))) s=((fills s).map (coeff (monomial v))).sum := by + induction v generalizing s with + | nil => + cases s with + | nil => simp [fills] + | cons a s => + cases a <;> simp [fills,collapse,List.map_map,Function.comp_def] + | cons a v ih => + obtain ⟨ha,hv'⟩ := noC_cons _ _ |>.mp hv + cases a with + | C => exact (ha rfl).elim + | A => + cases s with + | nil => simp [AssociativeElimination.deriv_mul,add_mul,low,fills] + | cons b s => + cases b <;> simp [AssociativeElimination.deriv_mul,add_mul,low,fills, + ih hv' s,collapse,List.map_map,Function.comp_def] + | B => + cases s with + | nil => simp [AssociativeElimination.deriv_mul,low,fills] + | cons b s => + cases b <;> simp [AssociativeElimination.deriv_mul,low,fills, + ih hv' s,collapse,List.map_map,Function.comp_def,tau0_monomial_coeff v hv' s] + +theorem deriv_tau0_coeff {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) (s : List Slot) : + coeff (deriv low (tau0 p)) s=((fills s).map (coeff p)).sum := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + exact deriv_tau0_monomial_coeff w.toList hw s + | zero => + simp only [map_zero] + change 0=(List.map (fun _ => (0 : K)) (fills s)).sum + simp + | add p q _ _ hp hq => + simp only [map_add,coeff_add,hp,hq] + exact (List.sum_map_add ..).symm + | smul c p _ hp => + simp only [map_smul,coeff_smul,hp] + exact (List.sum_map_mul_left ..).symm + +theorem collapse_eq {a : Slot} (ha : a≠Slot.C) : collapse a=a := by cases a <;> simp_all [collapse] +theorem collapse_noC {s : List Slot} (hs : noC s) : s.map collapse=s := by + induction s with + | nil => rfl + | cons a s ih => + obtain ⟨ha,hs'⟩ := (noC_cons a s).mp hs + simp [collapse_eq ha,ih hs'] + +theorem fills_noC {s : List Slot} (hs : noC s) : fills s=[] := by + induction s with + | nil => rfl + | cons a s ih => + obtain ⟨ha,hs'⟩ := (noC_cons a s).mp hs + simp [fills,ha,ih hs'] + +theorem fills_prefix (u s : List Slot) (hu : noC u) : fills (u++s)=(fills s).map (u++·) := by + induction u with + | nil => simp + | cons a u ih => + obtain ⟨ha,hu'⟩ := (noC_cons a u).mp hu + simp [fills,ha,collapse_eq ha,ih hu',List.map_map,Function.comp_def] + +theorem fills_two (u v : List Slot) (hu : noC u) (hv : noC v) : + fills (u++[Slot.C,Slot.C]++v)=[u++[Slot.B,Slot.A]++v,u++[Slot.A,Slot.B]++v] := by + rw [List.append_assoc,fills_prefix u _ hu] + simp [fills,collapse,collapse_noC hv,fills_noC hv] + +theorem fills_three (u v : List Slot) (hu : noC u) (hv : noC v) : + fills (u++[Slot.C,Slot.C,Slot.C]++v)= + [u++[Slot.B,Slot.A,Slot.A]++v,u++[Slot.A,Slot.B,Slot.A]++v,u++[Slot.A,Slot.A,Slot.B]++v] := by + rw [List.append_assoc,fills_prefix u _ hu] + simp [fills,collapse,collapse_noC hv,fills_noC hv] + +def count (a : Slot) (s : List Slot) : ℕ := degree (fun b => if b=a then 1 else 0) (FreeMonoid.ofList s) +@[simp] theorem count_nil (a : Slot) : count a []=0 := rfl +@[simp] theorem count_cons (a b : Slot) (s : List Slot) : count a (b::s)=(if b=a then 1 else 0)+count a s := rfl +@[simp] theorem count_append (a : Slot) (s t : List Slot) : count a (s++t)=count a s+count a t := by + exact degree_mul _ _ _ + +theorem noC_count {s : List Slot} (hs : noC s) : count .C s=0 := by + induction s with + | nil => rfl + | cons a s ih => + obtain ⟨ha,hs'⟩ := (noC_cons a s).mp hs + simp [ha,ih hs'] + +theorem low_c_degree (a : Slot) : low a∈homogeneous cCount (cCount a+1) := by + cases a with + | A => exact (homogeneous cCount _).zero_mem + | C => exact (homogeneous cCount _).zero_mem + | B => exact word_mem (FreeMonoid.of Slot.C) rfl + +theorem low_noC_coeff {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) + (s : List Slot) (hs : 2≤count .C s) : coeff (deriv low p) s=0 := by + have h0 : p∈homogeneous cCount 0 := by + apply space_mono ?_ hp + intro w hw + exact noC_count hw + have h1 := deriv_homogeneous low_c_degree h0 + apply coeff_support h1 + change ¬count .C s=0+1 + omega + +theorem fills_sum_zero {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) + (he : deriv low (p+tau0 p)=0) (s : List Slot) (hs : 2≤count .C s) : + ((fills s).map (coeff p)).sum=0 := by + have h := congrArg (fun q => coeff q s) he + rw [map_add,coeff_add,low_noC_coeff hp s hs,zero_add,deriv_tau0_coeff hp s,coeff_zero] at h + exact h + +theorem adjacent_exchange {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) + (he : deriv low (p+tau0 p)=0) (u v : List Slot) (hu : noC u) (hv : noC v) : + coeff p (u++[Slot.A,Slot.B]++v)=coeff p (u++[Slot.B,Slot.A]++v) := by + have hc : 2≤count .C (u++[Slot.C,Slot.C]++v) := by simp; omega + have h := fills_sum_zero hp he _ hc + rw [fills_two u v hu hv] at h + simp only [List.map_cons,List.map_nil,List.sum_cons,List.sum_nil,add_zero] at h + exact (TwoModule.eq_of_add_zero h).symm + +theorem noC_perm {s t : List Slot} (h : s.Perm t) : noC s ↔ noC t := by + simp only [noC,h.mem_iff] + +theorem coefficient_perm {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) + (he : deriv low (p+tau0 p)=0) {s t : List Slot} (h : s.Perm t) (hs : noC s) + (u : List Slot) (hu : noC u) : coeff p (u++s)=coeff p (u++t) := by + induction h generalizing u with + | nil => rfl + | @cons a s t h ih => + obtain ⟨ha,hs'⟩ := (noC_cons a s).mp hs + have huv : noC (u++[a]) := (noC_append _ _).mpr ⟨hu,by simpa using ha⟩ + simpa only [List.append_assoc,List.singleton_append] using ih hs' (u++[a]) huv + | swap a b s => + obtain ⟨ha,hbs⟩ := (noC_cons b (a::s)).mp hs + obtain ⟨hb,hss⟩ := (noC_cons a s).mp hbs + cases a <;> cases b + all_goals try first | exact (ha rfl).elim | exact (hb rfl).elim | rfl + · simpa only [List.append_assoc,List.cons_append,List.nil_append] using (adjacent_exchange hp he u s hu hss).symm + · simpa only [List.append_assoc,List.cons_append,List.nil_append] using adjacent_exchange hp he u s hu hss + | @trans s t v h₁ h₂ ih₁ ih₂ => + exact (ih₁ hs u hu).trans (ih₂ ((noC_perm h₁).mp hs) u hu) + +attribute [local instance] LieRing.ofAssociativeRing + +theorem count_list (a : Slot) (s : List Slot) : count a s=s.count a := by + induction s with + | nil => rfl + | cons b s ih => + rw [count_cons,ih,List.count_cons] + split_ifs with h <;> simp_all [Nat.add_comm] + +@[simp] theorem count_replicate (a b : Slot) (n : ℕ) : count a (List.replicate n b)=if b=a then n else 0 := by + induction n with + | zero => simp + | succ n ih => simp [List.replicate_succ,ih]; split_ifs <;> omega + +theorem perm_of_counts {s t : List Slot} (hs : noC s) (ht : noC t) + (ha : count .A s=count .A t) (hb : count .B s=count .B t) : s.Perm t := by + apply List.perm_iff_count.mpr + intro a + rw [← count_list,← count_list] + cases a with + | A => exact ha + | C => rw [noC_count hs,noC_count ht] + | B => exact hb + +theorem coefficient_eq_counts {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) + (he : deriv low (p+tau0 p)=0) {s t : List Slot} (hs : noC s) (ht : noC t) + (ha : count .A s=count .A t) (hb : count .B s=count .B t) : coeff p s=coeff p t := by + exact coefficient_perm hp he (perm_of_counts hs ht ha hb) hs [] noC_nil + +theorem triple_zero {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) + (he : deriv low (p+tau0 p)=0) (u : List Slot) (hu : noC u) : + coeff p (u++[Slot.B,Slot.A,Slot.A])=0 := by + have hc : 2≤count .C (u++[Slot.C,Slot.C,Slot.C]++[]) := by simp + have h := fills_sum_zero hp he _ hc + rw [fills_three u [] hu noC_nil] at h + simp only [List.append_nil,List.map_cons,List.map_nil,List.sum_cons,List.sum_nil,add_zero] at h + have hn1 : noC (u++[Slot.A,Slot.B,Slot.A]) := by simpa using hu + have hn2 : noC (u++[Slot.A,Slot.A,Slot.B]) := by simpa using hu + have hn3 : noC (u++[Slot.B,Slot.A,Slot.A]) := by simpa using hu + have h1 := coefficient_eq_counts hp he hn1 hn3 (by simp) (by simp) + have h2 := coefficient_eq_counts hp he hn2 hn3 (by simp) (by simp) + rw [h1,h2,TwoModule.add_self,add_zero] at h + exact h + +theorem coefficient_zero_two_As {p : A K Slot} (hp : p∈space (fun w => noC w.toList)) + (he : deriv low (p+tau0 p)=0) (s : List Slot) (hs : noC s) + (ha : 2≤count .A s) (hb : 1≤count .B s) : coeff p s=0 := by + let u := List.replicate (count .A s-2) Slot.A ++ List.replicate (count .B s-1) Slot.B + have hu : noC u := by + intro a ha + simp only [u,List.mem_append,List.mem_replicate] at ha + rcases ha with ⟨_,rfl⟩ | ⟨_,rfl⟩ <;> decide + have ht : noC (u++[Slot.B,Slot.A,Slot.A]) := by simpa using hu + have hA : count .A s=count .A (u++[Slot.B,Slot.A,Slot.A]) := by simp [u]; omega + have hB : count .B s=count .B (u++[Slot.B,Slot.A,Slot.A]) := by simp [u]; omega + rw [coefficient_eq_counts hp he hs ht hA hB] + exact triple_zero hp he u hu + +theorem residual_zero {p : A K Slot} {m r : ℕ} + (hp : p∈space (fun w => noC w.toList)) + (hm : p∈homogeneous aCount m) (hr : p∈homogeneous bCount r) + (hm2 : 2 ≤ m) (hr1 : 1 ≤ r) (he : deriv low (p+tau0 p)=0) : p=0 := by + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + by_contra hn + have hw : p.coeff w≠0 := hn + have h1 := mem_space_iff.mp hp w hw + have h2 := mem_space_iff.mp hm w hw + have h3 := mem_space_iff.mp hr w hw + exact hw (coefficient_zero_two_As hp he w.toList h1 (by unfold count; rw [FreeMonoid.ofList_toList]; change 2 ≤ degree aCount w; omega) + (by unfold count; rw [FreeMonoid.ofList_toList]; change 1 ≤ degree bCount w; omega)) + +theorem lie_palindrome_zero (q : FreeLieAlgebra K Slot) (s : List Slot) + (hs : s.reverse=s) (hlen : s.length≠1) : coeff (embed q) s=0 := by + induction q using freeLie_induction with + | h0 => simp + | hg a => + rw [embed_of] + change coeff (monomial [a]) s=0 + rw [coeff_monomial,ite_eq_right] + intro h + exact hlen (h ▸ rfl) + | ha p q hp hq => simp only [map_add,coeff_add,hp,hq,add_zero] + | hs c p hp => simp only [map_smul,coeff_smul,hp,mul_zero] + | hl p q _ _ => + rw [LieHom.map_lie] + change coeff (embed p*embed q-embed q*embed p) s=0 + have h : coeff (embed p*embed q) s=coeff (embed q*embed p) s := by + have hr := WordReversal.rev_coeff (embed p*embed q) (FreeMonoid.ofList s) + rw [WordReversal.rev_mul,WordReversal.rev_lie_charTwo,WordReversal.rev_lie_charTwo] at hr + have hs' : (FreeMonoid.ofList s).reverse=FreeMonoid.ofList s := by + exact congrArg FreeMonoid.ofList hs + rw [hs'] at hr + exact hr.symm + change coeff (embed p*embed q) s-coeff (embed q*embed p) s=0 + exact sub_eq_zero.mpr h + +end ResidualKernel + +namespace LetterRetraction +open AssociativeElimination WordGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R α : Type*} [CommRing R] +variable (P : α → Prop) [DecidablePred P] + +omit [DecidablePred P] in +theorem support_of_mem {q : FreeLieAlgebra R α} (hq : q∈sub P) : + embed q∈space (fun w => ∀ a∈w.toList,P a) := by + have hm {p q : A R α} + (hp : p∈space (fun w => ∀ a∈w.toList,P a)) + (hq : q∈space (fun w => ∀ a∈w.toList,P a)) : + p*q∈space (fun w => ∀ a∈w.toList,P a) := by + apply mul_mem ?_ hp hq + intro u v hu hv a ha + simp only [FreeMonoid.toList_mul,List.mem_append] at ha + exact ha.elim (hu a) (hv a) + induction hq using LieSubalgebra.lieSpan_induction with + | mem q hq => + obtain ⟨a,ha,rfl⟩ := hq + rw [embed_of] + exact word_mem _ (by simpa using ha) + | zero => simp + | add p q _ _ hp hq => simpa only [map_add] using (space _).add_mem hp hq + | smul c p _ hp => simpa only [map_smul] using (space _).smul_mem c hp + | lie p q _ _ hp hq => + rw [LieHom.map_lie] + exact (space _).sub_mem (hm hp hq) (hm hq hp) + +theorem single_letter (a : α) (q : FreeLieAlgebra R α) [DecidableEq α] : + ∃ c : R,lie (fun b => b=a) q=c • FreeLieAlgebra.of R a := by + induction q using freeLie_induction with + | h0 => exact ⟨0,by simp⟩ + | hg b => + by_cases h : b=a + · subst b; exact ⟨1,by simp⟩ + · exact ⟨0,by simp [h]⟩ + | ha p q hp hq => + obtain ⟨c,hc⟩ := hp + obtain ⟨d,hd⟩ := hq + exact ⟨c+d,by rw [map_add,hc,hd,add_smul]⟩ + | hs r p hp => + obtain ⟨c,hc⟩ := hp + exact ⟨r*c,by rw [map_smul,hc,mul_smul]⟩ + | hl p q hp hq => + obtain ⟨c,hc⟩ := hp + obtain ⟨d,hd⟩ := hq + exact ⟨0,by simp only [LieHom.map_lie,hc,hd,lie_smul,smul_lie,lie_self,smul_zero,zero_smul]⟩ + +theorem homogeneous_single_zero [DecidableEq α] (a : α) {q : FreeLieAlgebra R α} + {wt : α → ℕ} {n : ℕ} (hn : n≠wt a) + (hq : embed q∈space (fun w => ∀ b∈w.toList,b=a)) + (hw : embed q∈homogeneous wt n) : q=0 := by + obtain ⟨c,hc⟩ := single_letter a q + rw [lie_eq_self (fun b => b=a) hq] at hc + have hdeg : embed q∈homogeneous wt (wt a) := by + rw [hc,map_smul,embed_of] + exact (homogeneous wt (wt a)).smul_mem c (word_mem _ (degree_of wt a)) + apply UniversalEmbedding.injective + rw [map_zero] + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + by_contra h + exact hn ((mem_space_iff.mp hw w h).symm.trans (mem_space_iff.mp hdeg w h)) + +end LetterRetraction + +namespace ProjectionKernel +open AssociativeElimination WordGrading RowTwo RowKernel ExactPentagon QuadraticLeading ResidualKernel +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 + +theorem degree_congr_word {α : Type*} {f g : α → ℕ} (w : FreeMonoid α) + (h : ∀ a∈w.toList,f a=g a) : degree f w=degree g w := by + unfold degree + congr 1 + exact List.map_congr_left h + +theorem degree_scale {α : Type*} (f : α → ℕ) (c : ℕ) (w : FreeMonoid α) : + degree (fun a => c*f a) w=c*degree f w := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => simp only [degree_mul,degree_of,ih,mul_add] + +theorem ac_zero (w : FreeMonoid Slot) (hw : degree acCount w=0) : + ∀ a∈w.toList,a=Slot.B := by + have he : acCount=(fun a : Slot => if a≠Slot.B then 1 else 0) := by funext a; cases a <;> rfl + rw [he] at hw + have h := (degree_indicator_zero (fun a : Slot => a≠Slot.B) w.toList).mp + (by simpa using hw) + intro a ha + exact not_ne_iff.mp (h a ha) + +theorem b_zero (w : FreeMonoid Slot) (hw : degree bCount w=0) : + ∀ a∈w.toList,a≠Slot.B := by + exact (degree_indicator_zero (fun a : Slot => a=Slot.B) w.toList).mp + (by rw [FreeMonoid.ofList_toList]; exact hw) + +theorem a_from_ac_noC (w : FreeMonoid Slot) (hw : noC w.toList) : + degree aCount w=degree acCount w := by + apply degree_congr_word + intro a ha + have hn := hw a ha + cases a <;> simp_all [aCount,acCount,cCount] + +theorem higher_single_B {p q : FreeLieAlgebra K Slot} {n r : ℕ} + (hn : n=r+2) (hn2 : 2 ∀ a∈w.toList,a=Slot.B) := by + apply mem_space + intro w hc + have h1 := mem_space_iff.mp hw w hc + have h2 := mem_space_iff.mp hh w (by simpa using hc) + have h3 := weight_count w + exact ac_zero w (by omega) + exact sub_eq_zero.mp (LetterRetraction.homogeneous_single_zero Slot.B (by simpa only [weight] using (by omega : n≠1)) hs hw) + +def yWeight (b : Bool) : ℕ := if b then 1 else 0 +def xSlot : Slot → ℕ | .A => 2 | .C => 1 | .B => 0 +def ySlot : Slot → ℕ | .A => 0 | .C => 1 | .B => 1 + +def swap : A K Bool →ₐ[K] A K Bool := algEval (atom true) (atom false) + +@[simp] theorem swap_atom (b : Bool) : swap (atom b)=atom (!b) := by + cases b <;> simp [swap,algEval] + +theorem quad_y (a : Slot) : quad (atom a)∈homogeneous yWeight (ySlot a) := by + have hx : (atom false : A K Bool)∈homogeneous yWeight 0 := word_mem _ rfl + have hy : (atom true : A K Bool)∈homogeneous yWeight 1 := word_mem _ rfl + cases a with + | A => + rw [quad,lift_atom] + have h := homogeneous_mul hx hx + exact h + | C => + rw [quad,lift_atom] + have h1 := homogeneous_mul hx hy + have h2 := homogeneous_mul hy hx + exact (homogeneous yWeight 1).sub_mem h1 h2 + | B => simpa only [quad,lift_atom,ySlot] using hy + +theorem swap_quad_y (a : Slot) : swap (quad (atom a))∈homogeneous yWeight (xSlot a) := by + have hx : (atom false : A K Bool)∈homogeneous yWeight 0 := word_mem _ rfl + have hy : (atom true : A K Bool)∈homogeneous yWeight 1 := word_mem _ rfl + cases a with + | A => + simp only [quad,lift_atom,map_mul,swap_atom] + have h := homogeneous_mul hy hy + exact h + | C => + simp only [quad,lift_atom,map_sub,map_mul,swap_atom] + have h1 := homogeneous_mul hy hx + have h2 := homogeneous_mul hx hy + exact (homogeneous yWeight 1).sub_mem h1 h2 + | B => simpa only [quad,lift_atom,swap_atom,xSlot,Bool.not_true] using hx + +theorem symmetry_r_two {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {r : ℕ} + (hp : under p=embed ψ) (hn : p≠0) + (hs : embed p∈space (fun w => noC w.toList)) + (ha : embed p∈homogeneous acCount 1) (hb : embed p∈homogeneous bCount r) + (hanti : BaseChangeEquations.antisymmetry ψ=0) : r=2 := by + have hY : embed p∈homogeneous ySlot r := by + apply mem_space + intro w hw + rw [degree_congr_word w (g:=bCount) ?_] + · exact mem_space_iff.mp hb w hw + · intro a ha + have h := (mem_space_iff.mp hs w hw) a ha + cases a <;> simp_all [ySlot,bCount] + have hX : embed p∈homogeneous xSlot 2 := by + apply mem_space + intro w hw + rw [degree_congr_word w (g:=fun a => 2*acCount a) ?_,degree_scale] + · rw [mem_space_iff.mp ha w hw] + · intro a ha + have h := (mem_space_iff.mp hs w hw) a ha + cases a <;> simp_all [xSlot,acCount,aCount,cCount] + have h1 := algHom_homogeneous quad ySlot yWeight quad_y hY + have h2 := algHom_homogeneous (swap.comp quad) xSlot yWeight swap_quad_y hX + have he : swap (under p)=under p := by + rw [hp] + change ψ+BaseChangeEquations.eval BaseChangeEquations.y BaseChangeEquations.x ψ=0 at hanti + have h := congrArg embed ((TwoModule.eq_of_add_zero hanti).symm) + simpa only [ResidualKernel.embed_eval,BaseChangeEquations.x,BaseChangeEquations.y,embed_of,swap] using h + change swap (under p)∈_ at h2 + rw [he] at h2 + by_contra hne + apply hn + apply under_injective + rw [map_zero] + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + by_contra hw + exact hne ((mem_space_iff.mp h1 w hw).symm.trans (mem_space_iff.mp h2 w hw)) + +theorem one_A_two_B_zero {p : FreeLieAlgebra K Slot} + (hs : embed p∈space (fun w => noC w.toList)) + (ha : embed p∈homogeneous acCount 1) (hb : embed p∈homogeneous bCount 2) + (he : deriv low (embed p+tau0 (embed p))=0) : p=0 := by + apply UniversalEmbedding.injective + rw [map_zero] + apply MonoidAlgebra.ext + apply Finsupp.ext + intro w + by_contra hw + have hno := mem_space_iff.mp hs w hw + have hA : count .A w.toList=1 := by + unfold count + rw [FreeMonoid.ofList_toList] + change degree aCount w=1 + rw [a_from_ac_noC w hno] + exact mem_space_iff.mp ha w hw + have hB : count .B w.toList=2 := by + unfold count + rw [FreeMonoid.ofList_toList] + exact mem_space_iff.mp hb w hw + have hc := coefficient_eq_counts hs he hno (t:=[Slot.B,Slot.A,Slot.B]) (by simp) + (by simpa using hA) (by simpa using hB) + have hz := lie_palindrome_zero p [Slot.B,Slot.A,Slot.B] (by rfl) (by decide) + exact hw (hc.trans hz) + +theorem leading_projection_kernel {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} + {n r : ℕ} (hn : 2 a≠Slot.A) (LieGrading.piece bCount r p)=0) : + LieGrading.piece bCount r p=0 := by + let q := LieGrading.piece bCount r p + have hq : embed q=WordGrading.piece bCount r (embed p) := LieGrading.embed_piece _ _ _ + have hqw : embed q∈homogeneous weight n := by rw [hq]; exact project_preserves hw + have hqb : embed q∈homogeneous bCount r := by rw [hq]; exact piece_mem _ _ _ + have hh : embed p-embed q∈above bCount (r+1) := by rw [hq]; exact subtract_piece_above hfilter + change q=0 + by_contra hqne + have hen : embed q≠0 := by intro hz; exact hqne (UniversalEmbedding.injective (hz.trans (map_zero _).symm)) + have hex : ∃ w,(embed q).coeff w≠0 := by + by_contra h + push Not at h + exact hen (MonoidAlgebra.ext (Finsupp.ext h)) + obtain ⟨w,hwne⟩ := hex + let m := degree acCount w + have hnr : n=2*m+r := by + have h1 := mem_space_iff.mp hqw w hwne + have h2 := mem_space_iff.mp hqb w hwne + have h3 := weight_count w + omega + have hqa : embed q∈homogeneous acCount m := leading_ac hqw hqb hnr + have hm : 0 < m := by + by_contra hm + have hm0 : m=0 := by omega + have hs : embed q∈space (fun w => ∀ a∈w.toList,a=Slot.B) := by + apply space_mono ?_ hqa + intro v hv + exact ac_zero v (hv.trans hm0) + exact hqne (LetterRetraction.homogeneous_single_zero Slot.B (by change n≠1; omega) hs hqw) + have hrn : r < n := by omega + have hno : embed q∈space (fun w => noC w.toList) := + LetterRetraction.support_of_mem (fun a => a≠Slot.C) + (leading_no_C hp hw hrn hfilter hpent hnr hzero) + have hr : 0 < r := by + by_contra hr + have hr0 : r=0 := by omega + have hs : embed q∈space (fun w => ∀ a∈w.toList,a=Slot.A) := by + apply mem_space + intro v hv a hav + have hb := b_zero v ((mem_space_iff.mp hqb v hv).trans hr0) a hav + have hc := (mem_space_iff.mp hno v hv) a hav + cases a <;> simp_all + exact hqne (LetterRetraction.homogeneous_single_zero Slot.A (by change n≠2; omega) hs hqw) + have he := leading_equation hr hqb hh (full_equation hp hanti hspecial) + by_cases hm2 : 2 ≤ m + · have ha : embed q∈homogeneous aCount m := by + apply mem_space + intro v hv + rw [a_from_ac_noC v (mem_space_iff.mp hno v hv)] + exact mem_space_iff.mp hqa v hv + exact hen (residual_zero hno ha hqb hm2 hr he) + · have hm1 : m=1 := by omega + have hn2 : n=r+2 := by omega + have hpq := higher_single_B hn2 hn hw hqw hh + have hqψ : under q=embed ψ := by rw [← hpq]; exact hp + have hqa1 : embed q∈homogeneous acCount 1 := by simpa only [hm1] using hqa + have hr2 := symmetry_r_two hqψ hqne hno hqa1 hqb hanti + have hqb2 : embed q∈homogeneous bCount 2 := by simpa only [hr2] using hqb + exact hqne (one_A_two_B_zero hno hqa1 hqb2 he) + +end ProjectionKernel + +namespace WordGrading +open AssociativeElimination +variable {R α β : Type*} [CommRing R] + +theorem above_reflect (f : A R α →ₐ[R] A R β) (wa : α → ℕ) (wb : β → ℕ) + (hf : ∀ a,f (atom a)∈homogeneous wb (wa a)) (hi : Function.Injective f) + {n : ℕ} {p : A R α} (hp : f p∈above wb n) : p∈above wa n := by + have h1 := algHom_project f wa wb hf (fun k => n≤k) p + rw [project_eq_self hp] at h1 + have h2 := hi h1 + rw [← h2] + exact project_mem _ _ + +end WordGrading +namespace EliminationGraded +open AssociativeElimination UniversalEmbedding WordGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R α : Type*} [CommRing R] + +def collapse : A R (ℕ×α) →ₐ[R] A R (Option α) := + lift (fun (n,a) => embed (Elimination.adWord n a)) + +@[simp] theorem collapse_atom (n : ℕ) (a : α) : + collapse (atom (n,a) : A R (ℕ×α))=embed (Elimination.adWord n a) := by simp [collapse] + +theorem collapse_embed (p : Elimination.F R α) : + collapse (embed p)=embed (Elimination.collapseFiber p) := by + have h : collapse.toLieHom.comp embed=(embed : Elimination.G R α →ₗ⁅R⁆ A R (Option α)).comp Elimination.collapseFiber := by + apply FreeLieAlgebra.hom_ext + rintro ⟨n,a⟩ + simp [Elimination.collapseFiber] + exact LieHom.congr_fun h p + +theorem operator_collapse (p : A R (ℕ×α)) : operator (collapse p)=leftMul p := by + have h : operator.comp collapse=(leftMul : A R (ℕ×α) →ₐ[R] Module.End R (A R (ℕ×α))) := by + apply hom_ext + rintro ⟨n,a⟩ + simp only [AlgHom.comp_apply,collapse_atom,operator_embed,Elimination.expand_adWord,representation_inl] + simp [Elimination.E] + exact AlgHom.congr_fun h p + +theorem extract_collapse (p : A R (ℕ×α)) : extract (collapse p)=p := by + change operator (collapse p) 1=p + rw [operator_collapse,leftMul_apply,mul_one] + +theorem collapse_injective : Function.Injective (collapse : A R (ℕ×α) →ₐ[R] A R (Option α)) := + Function.LeftInverse.injective extract_collapse + +theorem adWord_degree (n : ℕ) (a : α) (wt : Option α → ℕ) : + embed (Elimination.adWord n a : Elimination.G R α)∈homogeneous wt (n*wt none+wt (some a)) := by + induction n with + | zero => + simp only [Elimination.adWord_zero,Elimination.Y,embed_of,zero_mul,zero_add] + exact word_mem _ rfl + | succ n ih => + rw [Elimination.adWord_succ,LieHom.map_lie] + have hx : embed (Elimination.X : Elimination.G R α)∈homogeneous wt (wt none) := by + rw [Elimination.X,embed_of] + exact word_mem _ (degree_of wt _) + have h1 := homogeneous_mul hx ih + have h2 := homogeneous_mul ih hx + change embed Elimination.X*embed (Elimination.adWord n a)-embed (Elimination.adWord n a)*embed Elimination.X∈_ + have he : wt none+(n*wt none+wt (some a))=(n+1)*wt none+wt (some a) := by + simp only [Nat.add_mul,one_mul]; omega + rw [← he] + exact (homogeneous wt _).sub_mem h1 (by simpa only [Nat.add_comm] using h2) + +theorem embed_decompose (p : Elimination.G R α) : + embed p=collapse (embed (Elimination.expand p).left)+(Elimination.expand p).right • atom none := by + rw [collapse_embed] + have hx : atom none=embed (Elimination.X : Elimination.G R α) := (embed_of none).symm + rw [hx,← map_smul,← map_add] + exact congrArg embed (Elimination.collapse_expand p).symm + +theorem trace_homogeneous_zero {p : Elimination.G R α} {wt : Option α → ℕ} {n : ℕ} + (hn : n≠wt none) (hp : embed p∈homogeneous wt n) : (Elimination.expand p).right=0 := by + have hL : p∈LieGrading.homogeneousLie wt n := LieGrading.homogeneous_iff.mpr hp + clear hp + change p∈Submodule.span R {p | ∃ t : UniversalEmbedding.Tree (Option α),LieGrading.treeDegree wt t=n ∧ t.eval=p} at hL + induction hL using Submodule.span_induction with + | mem p hp => + obtain ⟨t,ht,rfl⟩ := hp + cases t with + | leaf a => + cases a with + | none => exact (hn (ht.symm)).elim + | some a => simp [Tree.eval,Elimination.expand] + | node t u => simp [Tree.eval,LieHom.map_lie,Ring.lie_def,mul_comm] + | zero => simp + | add p q _ _ hp hq => simp [hp,hq] + | smul c p _ hp => simp [hp] + +end EliminationGraded + +namespace OreShift + +section +open AssociativeElimination WordGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R : Type*} [CommRing R] +local instance {α : Type*} [CharP R 2] : CharP (A R α) 2 := + charP_of_injective_ringHom (show Function.Injective (algebraMap R (A R α)) from by + intro r s h + have hc := congrArg (fun p : A R α => p.coeff 1) h + simpa using hc) 2 +abbrev S (R : Type*) [CommRing R] := A R Bool + +def C : S R := atom false +def B : S R := atom true +def wt (b : Bool) : ℕ := if b then 1 else 0 + +def D : S R →ₗ[R] S R := deriv (fun b => if b then C else 0) +@[simp] theorem D_C : D (C : S R)=0 := by simp [D,C] +@[simp] theorem D_B : D (B : S R)=C := by simp [D,B] +@[simp] theorem D_one : D (1 : S R)=0 := deriv_one _ +theorem D_mul (p q : S R) : D (p*q)=D p*q+p*D q := deriv_mul _ _ _ +theorem D_lie (p q : S R) : D ⁅p,q⁆=⁅D p,q⁆+⁅p,D q⁆ := deriv_lie _ _ _ + +theorem D_square [CharP R 2] (p : S R) : D (D p)=0 := by + induction p using QuadraticAlphabet.algebra_induction with + | h1 => simp + | ha b => cases b <;> simp [D,C] + | hadd p q hp hq => simp [hp,hq] + | hs c p hp => simp [hp] + | hm p q hp hq => + rw [D_mul,map_add,D_mul,D_mul,hp,hq] + simp only [zero_mul,mul_zero,zero_add,add_zero,CharTwo.add_self_eq_zero] + +theorem above_zero (p : S R) : p∈above wt 0 := by + exact mem_space (by intro w _; exact Nat.zero_le _) +theorem above_lie {a b : ℕ} {p q : S R} (hp : p∈above wt a) (hq : q∈above wt b) : + ⁅p,q⁆∈above wt (a+b) := by + change p*q-q*p∈_ + exact (above wt _).sub_mem (above_mul hp hq) (by simpa only [Nat.add_comm] using above_mul hq hp) + +def P (s : S R) : ℕ → S R + | 0 => C + | n+1 => ⁅B+s,P s n⁆ + +@[simp] theorem P_zero (s : S R) : P s 0=C := rfl +@[simp] theorem P_succ (s : S R) (n : ℕ) : P s (n+1)=⁅B+s,P s n⁆ := rfl + +variable {s : S R} + +@[simp] theorem D_F (hs : D s=0) : D (B+s)=C := by rw [map_add,D_B,hs,add_zero] + +theorem P_one (hc : ⁅(C : S R),s⁆=0) : P s 1=⁅(B : S R),C⁆ := by + rw [P_succ,P_zero,add_lie] + have hsc : ⁅s,(C : S R)⁆=0 := by rw [←lie_skew,hc,neg_zero] + rw [hsc,add_zero] + +theorem P_above (hc : ⁅(C : S R),s⁆=0) (n : ℕ) : P s (n+1)∈above wt 1 := by + induction n with + | zero => + rw [P_one hc] + have hb : (B : S R)∈above wt 1 := word_mem _ (by simp [degree_of,wt]) + have hh := above_lie hb (above_zero (C : S R)) + simpa only [Nat.add_zero] using hh + | succ n ih => + rw [P_succ] + have h := above_lie (above_zero (B+s)) ih + exact h + +theorem DP_one (hc : ⁅(C : S R),s⁆=0) : D (P s 1)=0 := by rw [P_one hc,D_lie,D_B,D_C,lie_self,lie_zero,add_zero] + +theorem DP_above (hs : D s=0) (hc : ⁅(C : S R),s⁆=0) (n : ℕ) : D (P s n)∈above wt 1 := by + induction n with + | zero => simp + | succ n ih => + cases n with + | zero => rw [DP_one hc]; exact (above wt 1).zero_mem + | succ n => + rw [P_succ,D_lie,D_F hs] + have h1 := above_lie (above_zero (C : S R)) (P_above hc n) + have h2 := above_lie (above_zero (B+s)) ih + exact (above wt 1).add_mem h1 h2 + +theorem D_lie_square [CharP R 2] (hs : D s=0) (p : S R) : D ⁅B+s,⁅B+s,p⁆⁆=⁅⁅(C : S R),B+s⁆,p⁆+⁅B+s,⁅B+s,D p⁆⁆ := by + rw [D_lie,D_lie,D_F hs,lie_add] + have he := leibniz_lie (B+s) (C : S R) p + have hsk : ⁅B+s,C⁆=⁅(C : S R),B+s⁆ := by rw [←lie_skew,CharTwo.neg_eq] + rw [hsk] at he + rw [he] + have hz : ⁅(C : S R),⁅B+s,p⁆⁆+⁅(C : S R),⁅B+s,p⁆⁆=0 := CharTwo.add_self_eq_zero _ + calc + _ = ⁅⁅(C : S R),B+s⁆,p⁆+⁅B+s,⁅B+s,D p⁆⁆+ + (⁅(C : S R),⁅B+s,p⁆⁆+⁅(C : S R),⁅B+s,p⁆⁆) := by abel + _ = _ := by rw [hz,add_zero] + +theorem DP_even [CharP R 2] (hs : D s=0) (hc : ⁅(C : S R),s⁆=0) (n : ℕ) : D (P s (2*n+1))∈above wt 2 := by + induction n with + | zero => rw [Nat.mul_zero,Nat.zero_add,DP_one hc]; exact (above wt 2).zero_mem + | succ n ih => + have hn : 2*(n+1)+1=(2*n+1)+1+1 := by omega + rw [hn,P_succ,P_succ,D_lie_square hs] + have hcb : ⁅(C : S R),B+s⁆=⁅(C : S R),B⁆ := by rw [lie_add,hc,add_zero] + rw [hcb] + have hB : (B : S R)∈above wt 1 := word_mem _ (by simp [degree_of,wt]) + have h1 := above_lie (above_lie (above_zero (C : S R)) hB) (P_above hc (2*n)) + have h2 := above_lie (above_zero (B+s)) (above_lie (above_zero (B+s)) ih) + exact (above wt 2).add_mem h1 h2 + +end + +open AssociativeElimination WordGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R : Type*} [CommRing R] + +def indexWt (a : ℕ×Unit) : ℕ := if a.1%2=0 then 1 else 0 + +def factor (s : S R) : ℕ → Module.End R (S R) + | 0 => D + | n+1 => leftMul (P s n) + +def operators (s : S R) : A R (ℕ×Unit) →ₐ[R] Module.End R (S R) := lift (fun a => factor s a.1) +def constant (s : S R) : A R (ℕ×Unit) →ₗ[R] S R := + (LinearMap.applyₗ 1).comp (operators s).toLinearMap + +@[simp] theorem constant_one (s : S R) : constant s 1=1 := by simp [constant] +@[simp] theorem constant_atom_mul (s : S R) (n : ℕ) (p : A R (ℕ×Unit)) : + constant s (atom (n,())*p)=factor s n (constant s p) := by + simp [constant,operators,Module.End.mul_apply] + +variable {s : S R} [CharP R 2] +theorem factor_bounds (hs : D s=0) (hc : ⁅(C : S R),s⁆=0) (n : ℕ) : + P s n∈above wt (indexWt (n+1,())) ∧ + D (P s n)∈above wt (indexWt (n+1,())+1) := by + by_cases he : (n+1)%2=0 + · have hn : n=n/2*2+1 := by omega + have hP := P_above hc (n/2*2) + have hD := DP_even hs hc (n/2) + have hn' : n=2*(n/2)+1 := by omega + constructor + · simpa only [←hn,indexWt,ite_eq_left he] using hP + · simpa only [←hn',indexWt,ite_eq_left he] using hD + · simp only [indexWt,ite_eq_right he,zero_add] + exact ⟨above_zero _,DP_above hs hc n⟩ + +theorem word_bound (hs : D s=0) (hc : ⁅(C : S R),s⁆=0) (w : FreeMonoid (ℕ×Unit)) : + constant s (word w)∈above wt (degree indexWt w) ∧ + D (constant s (word w))∈above wt (degree indexWt w+1) := by + induction w using FreeMonoid.inductionOn' with + | one => + simp only [word_one,constant_one,D_one,degree_one,Nat.zero_add] + exact ⟨above_zero _,(above wt 1).zero_mem⟩ + | of_mul a w ih => + obtain ⟨n,u⟩ := a + cases u + rw [word_mul,word_of,constant_atom_mul,degree_mul,degree_of] + cases n with + | zero => + change D (constant s (word w))∈above wt (1+degree indexWt w) ∧ + D (D (constant s (word w)))∈above wt (1+degree indexWt w+1) + constructor + · simpa only [Nat.add_comm] using ih.2 + · rw [D_square]; exact (above wt _).zero_mem + | succ n => + simp only [factor,leftMul_apply] + obtain ⟨hp,hd⟩ := factor_bounds hs hc n + constructor + · exact above_mul hp ih.1 + · rw [D_mul] + have h1 := above_mul hd ih.1 + have h2 := above_mul hp ih.2 + apply (above wt (indexWt (n+1,())+degree indexWt w+1)).add_mem + · simpa only [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h1 + · simpa only [Nat.add_assoc] using h2 + +theorem constant_bound (hs : D s=0) (hc : ⁅(C : S R),s⁆=0) {r : ℕ} {p : A R (ℕ×Unit)} + (hp : p∈above indexWt r) : constant s p∈above wt r := by + apply map_space (constant s) _ ?_ hp + intro w hw + exact space_mono (by intro v hv; exact hw.trans hv) (word_bound hs hc w).1 + +end OreShift + +namespace EvenIndex + +section +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon AlphabetTransport +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 + +theorem map_lie {R α β : Type*} [CommRing R] (f : A R α →ₐ[R] A R β) (p q : A R α) : + f ⁅p,q⁆=⁅f p,f q⁆ := by simp only [Ring.lie_def,map_sub,map_mul] + +def abc : Option Bool ≃ Slot where + toFun := fun | none => .A | some false => .B | some true => .C + invFun := fun | .A => none | .B => some false | .C => some true + left_inv a := by cases a with | none => rfl | some b => cases b <;> rfl + right_inv a := by cases a <;> rfl + +def idx (a : ℕ×Unit) : ℕ×Bool := (a.1/2,decide (a.1%2=1)) +def unidx (a : ℕ×Bool) : ℕ×Unit := (2*a.1+if a.2 then 1 else 0,()) + +theorem idx_left : Function.LeftInverse unidx idx := by + rintro ⟨n,u⟩ + cases u + dsimp [idx,unidx] + split_ifs <;> simp_all only [decide_eq_true_eq] <;> congr <;> omega + +def intoABC : A K (ℕ×Unit) →ₐ[K] A K Slot := + (renameAssoc abc).comp (EliminationGraded.collapse.comp (renameAssoc idx)) + +theorem intoABC_injective : Function.Injective intoABC := by + exact (assoc_injective abc abc.symm abc.left_inv).comp + (EliminationGraded.collapse_injective.comp (assoc_injective idx unidx idx_left)) + +@[simp] theorem intoABC_atom (n : ℕ) : intoABC (atom (n,()))= + renameAssoc abc (embed (Elimination.adWord (n/2) (decide (n%2=1)) : Elimination.G K Bool)) := by + simp [intoABC,idx] + +def evenWt (a : ℕ×Unit) : ℕ := if a.1%2=0 then 1 else 0 + +theorem intoABC_degree (a : ℕ×Unit) : intoABC (atom a)∈homogeneous bCount (evenWt a) := by + obtain ⟨n,u⟩ := a + cases u + rw [intoABC_atom] + have h := EliminationGraded.adWord_degree (R:=K) (n/2) (decide (n%2=1)) (bCount ∘ abc) + have hg : ∀ a : Option Bool,renameAssoc (R:=K) abc (atom a)∈homogeneous bCount ((bCount ∘ abc) a) := by + intro a + rw [renameAssoc_atom] + exact word_mem _ (degree_of _ _) + have hh := algHom_homogeneous (renameAssoc abc) (bCount ∘ abc) bCount hg h + have he : n/2*(bCount ∘ abc) none+(bCount ∘ abc) (some (decide (n%2=1)))=evenWt (n,()) := by + simp only [Function.comp_apply,abc,bCount,evenWt] + by_cases hn : n%2=1 + · simp [hn] + · have hn0 : n%2=0 := by omega + simp [hn0] + exact he ▸ hh + +def input : A K (ℕ×Unit) →ₐ[K] A K Bool := + (renameAssoc bitOption.symm).comp EliminationGraded.collapse + +@[simp] theorem input_atom (n : ℕ) : input (atom (n,()))= + renameAssoc bitOption.symm (embed (Elimination.adWord n () : Elimination.G K Unit)) := by + simp [input] + +theorem intoABC_atom_zero : intoABC (atom (0,()))=atom Slot.B := by + simp [intoABC_atom,Elimination.Y,abc] +theorem intoABC_atom_one : intoABC (atom (1,()))=atom Slot.C := by + simp [intoABC_atom,Elimination.Y,abc] +theorem intoABC_atom_two (n : ℕ) : intoABC (atom (n+2,()))=⁅(atom Slot.A : A K Slot),intoABC (atom (n,()))⁆ := by + have hd : (n+2)/2=n/2+1 := by omega + have hm : (n+2)%2=n%2 := by omega + rw [intoABC_atom,intoABC_atom,hd,hm] + rw [Elimination.adWord_succ,LieHom.map_lie] + change renameAssoc abc ⁅embed (Elimination.X : Elimination.G K Bool),_⁆=_ + rw [map_lie] + simp [Elimination.X,abc] + +theorem input_atom_zero : input (atom (0,()))=atom true := by + simp [input_atom,Elimination.Y,bitOption] +theorem input_atom_succ (n : ℕ) : input (atom (n+1,()))=⁅(atom false : A K Bool),input (atom (n,()))⁆ := by + rw [input_atom,input_atom,Elimination.adWord_succ,LieHom.map_lie] + rw [map_lie] + simp [Elimination.X,bitOption] + +theorem quad_intoABC : quad.comp intoABC=input := by + apply hom_ext + rintro ⟨n,u⟩ + cases u + induction n using Nat.twoStepInduction with + | zero => rw [AlgHom.comp_apply,intoABC_atom_zero,input_atom_zero]; simp only [quad,lift_atom] + | one => rw [AlgHom.comp_apply,intoABC_atom_one,input_atom_succ,input_atom_zero]; simp only [quad,lift_atom,Ring.lie_def] + | more n ih _ => + simp only [AlgHom.comp_apply] at ih ⊢ + rw [intoABC_atom_two,map_lie,ih,input_atom_succ,input_atom_succ] + simp only [quad,lift_atom] + change ⁅(atom false : A K Bool)*atom false,input (atom (n,()))⁆=⁅atom false,⁅atom false,_⁆⁆ + simp only [Ring.lie_def,sub_eq_add_neg,CharTwo.neg_eq,mul_add,add_mul,mul_assoc] + symm + calc + _ = atom false*(atom false*input (atom (n,())))+input (atom (n,()))*(atom false*atom false)+ + (atom false*(input (atom (n,()))*atom false)+atom false*(input (atom (n,()))*atom false)) := by abel + _ = _ := by rw [CharTwo.add_self_eq_zero,add_zero] + +def fiber (ψ : FreeLieAlgebra K Bool) : A K (ℕ×Unit) := + embed (Elimination.expand (rename bitOption ψ)).left + +theorem input_fiber {ψ : FreeLieAlgebra K Bool} {n : ℕ} (hn : 1 < n) + (hψ : embed ψ∈homogeneous (fun _ => 1) n) : input (fiber ψ)=embed ψ := by + have ho : embed (rename bitOption ψ)∈homogeneous (fun _ => 1) n := by + rw [rename_embed] + apply algHom_homogeneous (renameAssoc bitOption) (fun _ => 1) (fun _ => 1) ?_ hψ + intro b + rw [renameAssoc_atom] + exact word_mem _ (degree_of _ _) + have hz := EliminationGraded.trace_homogeneous_zero (by omega) ho + have hd := EliminationGraded.embed_decompose (rename bitOption ψ) + rw [hz,zero_smul,add_zero] at hd + have h := congrArg (renameAssoc bitOption.symm) hd + rw [rename_embed,assoc_retract bitOption bitOption.symm bitOption.left_inv] at h + exact h.symm + +theorem intoABC_fiber {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n : ℕ} + (hn : 1 < n) (hψ : embed ψ∈homogeneous (fun _ => 1) n) (hp : under p=embed ψ) : + intoABC (fiber ψ)=embed p := by + apply quad_injective + calc + quad (intoABC (fiber ψ)) = input (fiber ψ) := AlgHom.congr_fun quad_intoABC _ + _ = embed ψ := input_fiber hn hψ + _ = quad (embed p) := hp.symm + +theorem termwise_bound {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n r : ℕ} + (hn : 1 < n) (hψ : embed ψ∈homogeneous (fun _ => 1) n) (hp : under p=embed ψ) + (hr : embed p∈above bCount r) : fiber ψ∈above evenWt r := by + apply above_reflect intoABC evenWt bCount intoABC_degree intoABC_injective + rw [intoABC_fiber hn hψ hp] + exact hr + +end + +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon AlphabetTransport ProjectionKernel +attribute [local instance] LieRing.ofAssociativeRing + +def xWeight (b : Bool) : ℕ := if b then 0 else 1 +def swappedInput : A K (ℕ×Unit) →ₐ[K] A K Bool := swap.comp input + +theorem swappedInput_degree (a : ℕ×Unit) : + swappedInput (atom a)∈homogeneous xWeight 1 := by + obtain ⟨n,u⟩ := a + cases u + induction n with + | zero => + rw [swappedInput,AlgHom.comp_apply,input_atom_zero,swap_atom] + exact word_mem _ rfl + | succ n ih => + rw [swappedInput,AlgHom.comp_apply,input_atom_succ,map_lie,swap_atom] + have hy : (atom true : A K Bool)∈homogeneous xWeight 0 := word_mem _ rfl + change ⁅atom true,swappedInput (atom (n,()))⁆∈_ + change atom true*swappedInput (atom (n,()))-swappedInput (atom (n,()))*atom true∈_ + have h1 := homogeneous_mul hy ih + have h2 := homogeneous_mul ih hy + exact (homogeneous xWeight 1).sub_mem h1 h2 + +theorem quad_x (a : Slot) : quad (atom a)∈homogeneous xWeight (xSlot a) := by + have hx : (atom false : A K Bool)∈homogeneous xWeight 1 := word_mem _ rfl + have hy : (atom true : A K Bool)∈homogeneous xWeight 0 := word_mem _ rfl + cases a with + | A => + rw [quad,lift_atom] + have h := homogeneous_mul hx hx + exact h + | C => + rw [quad,lift_atom] + have h1 := homogeneous_mul hx hy + have h2 := homogeneous_mul hy hx + exact (homogeneous xWeight 1).sub_mem h1 h2 + | B => simpa only [quad,lift_atom,xSlot] using hy + +theorem swapped_solution {ψ : FreeLieAlgebra K Bool} + (hanti : BaseChangeEquations.antisymmetry ψ=0) : swap (embed ψ)=embed ψ := by + change ψ+BaseChangeEquations.eval BaseChangeEquations.y BaseChangeEquations.x ψ=0 at hanti + have h := congrArg embed ((TwoModule.eq_of_add_zero hanti).symm) + simpa only [ResidualKernel.embed_eval,BaseChangeEquations.x,BaseChangeEquations.y,embed_of,swap] using h + +theorem selected_expression {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n : ℕ} + (hn : 1 < n) (hψ : embed ψ∈homogeneous (fun _ => 1) n) (hp : under p=embed ψ) + (hanti : BaseChangeEquations.antisymmetry ψ=0) (m : ℕ) : + swappedInput (piece (fun _ => 1) m (fiber ψ))=quad (piece xSlot m (embed p)) := by + rw [algHom_piece swappedInput (fun _ => 1) xWeight swappedInput_degree] + have he : swappedInput (fiber ψ)=quad (embed p) := by + change swap (input (fiber ψ))=under p + rw [input_fiber hn hψ,swapped_solution hanti,hp] + rw [he,← algHom_piece quad xSlot xWeight quad_x] + +end EvenIndex + +namespace OreShift + +section +open AssociativeElimination WordGrading +open QuadraticLeading RowTwo RowKernel AlphabetTransport ProjectionKernel ExactPentagon +attribute [local instance] LieRing.ofAssociativeRing +variable {R : Type*} [CommRing R] +local instance {α : Type*} [CharP R 2] : CharP (A R α) 2 := + charP_of_injective_ringHom (show Function.Injective (algebraMap R (A R α)) from by + intro r s h + have hc := congrArg (fun p : A R α => p.coeff 1) h + simpa using hc) 2 + +def evaluate (s : S R) : A R Bool →ₐ[R] Module.End R (S R) := + lift (fun b => if b then leftMul (B+s) else D) + +@[simp] theorem evaluate_x (s : S R) : evaluate s (atom false)=D := by simp [evaluate] +@[simp] theorem evaluate_y (s : S R) : evaluate s (atom true)=leftMul (B+s) := by simp [evaluate] + +def eraseShift (s : S R) : A R Slot →ₐ[R] S R := + lift (fun | .A => 0 | .C => C | .B => B+s) + +theorem comm_D_left (p : S R) : ⁅(D : Module.End R (S R)),leftMul p⁆=leftMul (D p) := by + apply LinearMap.ext + intro q + change D (p*q)-p*D q=D p*q + rw [D_mul,add_sub_cancel_right] + +theorem left_comm_D [CharP R 2] {s : S R} (hs : D s=0) : + ⁅leftMul (B+s),(D : Module.End R (S R))⁆=leftMul C := by + rw [←lie_skew,comm_D_left,D_F hs,←map_neg,CharTwo.neg_eq] + +theorem evaluate_quad {s : S (ZMod 2)} (hs : D s=0) : + (evaluate s).comp quad=leftMul.comp (eraseShift s) := by + apply hom_ext + intro a + cases a with + | A => + simp only [AlgHom.comp_apply,quad,lift_atom,map_mul,eraseShift,map_zero,evaluate_x] + apply LinearMap.ext + intro q + change D (D q)=0 + exact D_square q + | C => + simp only [AlgHom.comp_apply,quad,lift_atom,map_sub,map_mul,eraseShift,evaluate_x,evaluate_y] + change ⁅(D : Module.End (ZMod 2) (S (ZMod 2))),leftMul (B+s)⁆=leftMul C + rw [comm_D_left,D_F hs] + | B => simp [quad,eraseShift,evaluate] + +theorem evaluate_lie (s : S R) (p q : A R Bool) : + evaluate s ⁅p,q⁆=⁅evaluate s p,evaluate s q⁆ := by + simp only [Ring.lie_def,map_sub,map_mul] + +theorem evaluate_swapped {s : S (ZMod 2)} (hs : D s=0) : + (evaluate s).comp EvenIndex.swappedInput=operators s := by + apply hom_ext + rintro ⟨n,u⟩ + cases u + simp only [AlgHom.comp_apply,operators,lift_atom] + induction n with + | zero => + rw [EvenIndex.swappedInput,AlgHom.comp_apply,EvenIndex.input_atom_zero,swap_atom] + simp [evaluate,factor] + | succ n ih => + rw [EvenIndex.swappedInput,AlgHom.comp_apply,EvenIndex.input_atom_succ,EvenIndex.map_lie,swap_atom] + rw [evaluate_lie] + simp only [Bool.not_false,evaluate_y] + change ⁅leftMul (B+s),evaluate s (EvenIndex.swappedInput (atom (n,())))⁆=leftMul (P s n) + rw [ih] + cases n with + | zero => exact left_comm_D hs + | succ n => + change ⁅leftMul (B+s),leftMul (P s n)⁆=leftMul ⁅B+s,P s n⁆ + simp only [Ring.lie_def,map_sub,map_mul] + +end + +open AssociativeElimination WordGrading UniversalEmbedding +open QuadraticLeading RowTwo RowKernel ExactPentagon ProjectionKernel +attribute [local instance] LieRing.ofAssociativeRing +variable {R : Type*} [CommRing R] + +theorem eraseShift_retract (s : S R) : + (eraseShift s).comp (LetterRetraction.assoc (fun a => a≠Slot.A))=eraseShift s := by + apply hom_ext + intro a + cases a <;> simp [eraseShift] + +theorem eraseShift_word (s : S R) (w : FreeMonoid Slot) (h : ¬∀ a∈w.toList,a≠Slot.A) : + eraseShift s (word w)=0 := by + rw [←AlgHom.congr_fun (eraseShift_retract s) (word w),AlgHom.comp_apply, + LetterRetraction.assoc_word,ite_eq_right h,map_zero] + +theorem erase_selector (s : S R) {n m r : ℕ} (hn : n=2*m+r) {p : A R Slot} + (hp : p∈homogeneous weight n) : + eraseShift s (piece xSlot m p)=eraseShift s (piece bCount r p) := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + by_cases hno : ∀ a∈w.toList,a≠Slot.A + · have he : degree xSlot w=degree acCount w := by + apply degree_congr_word + intro a ha + have h := hno a ha + cases a <;> simp_all [xSlot,acCount,aCount,cCount] + have hwc := weight_count w + have hi : degree xSlot w=m ↔ degree bCount w=r := by omega + simp only [piece,project_word,hi] + · simp only [piece,project_word] + split_ifs <;> simp [eraseShift_word s w hno] + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq] + | smul c p _ hp => simp only [map_smul,hp] + +def translate (s : S R) : S R →ₐ[R] S R := lift (fun b => if b then B+s else C) + +@[simp] theorem translate_C (s : S R) : translate s C=C := by simp [translate,C] +@[simp] theorem translate_B (s : S R) : translate s B=B+s := by simp [translate,B] + +theorem translate_erase (s : S R) : (translate s).comp (eraseShift 0)=eraseShift s := by + apply hom_ext + intro a + cases a <;> simp [eraseShift] + +theorem selected_constant {s : S (ZMod 2)} (hs : D s=0) + {q : A (ZMod 2) (ℕ×Unit)} {p : A (ZMod 2) Slot} + (he : EvenIndex.swappedInput q=quad p) : constant s q=eraseShift s p := by + change operators s q 1=eraseShift s p + have h := AlgHom.congr_fun (evaluate_swapped hs) q + rw [←h,AlgHom.comp_apply,he] + have h' := AlgHom.congr_fun (evaluate_quad hs) p + rw [←AlgHom.comp_apply,h',AlgHom.comp_apply,leftMul_apply,mul_one] + +theorem shifted_leading_bound {ψ : FreeLieAlgebra (ZMod 2) Bool} + {p : FreeLieAlgebra (ZMod 2) Slot} {n m r : ℕ} + (hn : 1 1) n) + (hp : under p=embed ψ) (hanti : BaseChangeEquations.antisymmetry ψ=0) + (hr : embed p∈above bCount r) {s : S (ZMod 2)} (hs : D s=0) (hc : ⁅(C : S (ZMod 2)),s⁆=0) : + eraseShift s (piece bCount r (embed p))∈above wt r := by + rw [←erase_selector s hnm (representation_weight hψ hp)] + rw [←selected_constant hs (EvenIndex.selected_expression hn hψ hp hanti m)] + apply constant_bound hs hc + exact project_preserves (EvenIndex.termwise_bound hn hψ hp hr) + +end OreShift + +namespace PositionalDeletion +open AssociativeElimination WordGrading +attribute [local instance] LieRing.ofAssociativeRing +variable {R : Type*} [CommRing R] +local notation "S" => A R Bool + +def replaceWord (u : S) : ℕ → List Bool → S + | _,[] => 0 + | i,false::w => atom false*replaceWord u i w + | 0,true::w => u*word (FreeMonoid.ofList w) + | i+1,true::w => atom true*replaceWord u i w + +def replace (u : S) (i : ℕ) : S →ₗ[R] S := + (Finsupp.linearCombination R (fun w : FreeMonoid Bool => replaceWord u i w.toList)).comp + (MonoidAlgebra.coeffLinearEquiv R).toLinearMap + +@[simp] theorem replace_word (u : S) (i : ℕ) (w : FreeMonoid Bool) : + replace u i (word w)=replaceWord u i w.toList := by + change Finsupp.linearCombination R (fun monoidWord : FreeMonoid Bool => replaceWord u i monoidWord.toList) (Finsupp.single w 1) = _; simp + +@[simp] theorem replace_one (u : S) (i : ℕ) : replace u i 1=0 := by + change replace u i (word 1)=0 + rw [replace_word] + rfl + +theorem replace_C_mul (u : S) (i : ℕ) (p : S) : + replace u i (atom false*p)=atom false*replace u i p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change replace u i (word (FreeMonoid.of false)*word w)=word (FreeMonoid.of false)*replace u i (word w) + rw [←word_mul,replace_word,replace_word] + rfl + | add p q hp hq => simp only [mul_add,map_add,hp,hq] + | smul c p hp => simp only [mul_smul_comm,map_smul,hp] + +theorem replace_B_mul_zero (u p : S) : replace u 0 (atom true*p)=u*p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change replace u 0 (word (FreeMonoid.of true)*word w)=u*word w + rw [←word_mul,replace_word] + rfl + | add p q hp hq => simp only [mul_add,map_add,hp,hq] + | smul c p hp => simp only [mul_smul_comm,map_smul,hp] + +theorem replace_B_mul_succ (u : S) (i : ℕ) (p : S) : + replace u (i+1) (atom true*p)=atom true*replace u i p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change replace u (i+1) (word (FreeMonoid.of true)*word w)=word (FreeMonoid.of true)*replace u i (word w) + rw [←word_mul,replace_word,replace_word] + rfl + | add p q hp hq => simp only [mul_add,map_add,hp,hq] + | smul c p hp => simp only [mul_smul_comm,map_smul,hp] + +def countB (w : List Bool) : ℕ := w.count true + +@[simp] theorem countB_nil : countB []=0 := rfl +@[simp] theorem countB_false (w : List Bool) : countB (false::w)=countB w := by simp [countB] +@[simp] theorem countB_true (w : List Bool) : countB (true::w)=countB w+1 := by simp [countB] + +theorem replaceWord_missing (u : S) (i : ℕ) (w : List Bool) (h : countB w ≤ i) : + replaceWord u i w=0 := by + induction w generalizing i with + | nil => rfl + | cons b w ih => + cases b with + | false => simp only [countB_false] at h; simp only [replaceWord,ih i h,mul_zero] + | true => + cases i with + | zero => simp only [countB_true] at h; omega + | succ i => + simp only [countB_true] at h + simp only [replaceWord,ih i (by omega),mul_zero] + +theorem word_cons (b : Bool) (w : List Bool) : + word (R:=R) (FreeMonoid.ofList (b::w))=atom b*word (FreeMonoid.ofList w) := + word_mul (FreeMonoid.of b) (FreeMonoid.ofList w) + +theorem replaceWord_append (u : S) (i : ℕ) (v w : List Bool) : + replaceWord u i (v++w)=if i simp + | cons b v ih => + cases b with + | false => + simp only [List.cons_append,replaceWord,countB_false,ih,word_cons] + split_ifs <;> simp only [mul_assoc] + | true => + cases i with + | zero => + simp only [List.cons_append,replaceWord,countB_true,Nat.zero_lt_succ,ite_true] + rw [show FreeMonoid.ofList (v++w)=FreeMonoid.ofList v*FreeMonoid.ofList w from rfl,word_mul,mul_assoc] + | succ i => + simp only [List.cons_append,replaceWord,countB_true,Nat.add_lt_add_iff_right, + Nat.add_sub_add_right,ih,word_cons] + split_ifs <;> simp only [mul_assoc] + +end PositionalDeletion + +namespace GapWord + +abbrev G := ℕ × List ℕ + +def prepend (a : ℕ) (g : G) : G := (a,g.1::g.2) +def bump (a : ℕ) (g : G) : G := (a+g.1,g.2) + +def encode : G → List Bool + | (a,[]) => List.replicate a false + | (a,b::v) => List.replicate a false ++ true::encode (b,v) + +def decode : List Bool → G + | [] => (0,[]) + | false::w => bump 1 (decode w) + | true::w => prepend 0 (decode w) + +theorem decode_false_prefix (a : ℕ) (w : List Bool) : + decode (List.replicate a false++w)=bump a (decode w) := by + induction a with + | zero => simp [bump] + | succ a ih => simp [List.replicate_succ,decode,ih,bump,Nat.add_assoc,Nat.add_left_comm] + +theorem decode_encode (g : G) : decode (encode g)=g := by + obtain ⟨a,v⟩ := g + induction v generalizing a with + | nil => simpa [encode,decode,bump] using decode_false_prefix a [] + | cons b v ih => simp [encode,decode_false_prefix,decode,ih,bump,prepend] + +theorem encode_bump (a : ℕ) (g : G) : + encode (bump a g)=List.replicate a false++encode g := by + obtain ⟨b,v⟩ := g + cases v <;> simp only [bump,encode,List.replicate_add,List.append_assoc] + +theorem encode_prepend (a : ℕ) (g : G) : + encode (prepend a g)=List.replicate a false++true::encode g := by + obtain ⟨b,v⟩ := g + simp [prepend,encode] + +theorem encode_decode (w : List Bool) : encode (decode w)=w := by + induction w with + | nil => simp [encode,decode] + | cons b w ih => + cases b <;> simp [decode,encode_bump,encode_prepend,ih] + +def size (g : G) : ℕ := g.1+g.2.sum + +theorem size_bump (a : ℕ) (g : G) : size (bump a g)=a+size g := by simp [size,bump,Nat.add_assoc] +theorem size_prepend (a : ℕ) (g : G) : size (prepend a g)=a+size g := by simp [size,prepend] + +theorem size_decode (w : List Bool) : size (decode w)=w.count false := by + induction w with + | nil => rfl + | cons b w ih => + cases b <;> simp [decode,size_bump,size_prepend,ih,Nat.add_comm] + +def merge (j : ℕ) : ℕ → G → Option G + | _,(_,[]) => none + | 0,(a,b::v) => some (a+j+b,v) + | i+1,(a,b::v) => (merge j i (b,v)).map (prepend a) + +def erase (j : ℕ) : ℕ → G → Option G + | 0,(a,v) => if j≤a then some (a-j,v) else none + | _+1,(_,[]) => none + | i+1,(a,b::v) => (erase j i (b,v)).map (prepend a) + +theorem erase_small (j i : ℕ) (g : G) (h : size g cases i <;> simp_all [erase,size] + | cons b v ih => + cases i with + | zero => + have ha : ¬j≤a := by simp only [size,List.sum_cons] at h; omega + simp only [erase,ite_eq_right ha] + | succ i => + have hb : size (b,v) simp [merge] + | cons b v ih => + have ha : a + cases i with + | zero => + simp only [merge,Option.bind_some,erase] + rw [ite_eq_left (by omega)] + congr 2; omega + | succ i => + simp only [merge,Option.bind_some,Nat.succ_ne_zero,ite_false] + cases v with + | nil => rfl + | cons c v => + have hv : size (c,v) + cases i with + | zero => + simp only [merge,Nat.zero_ne_add_one,ite_false] + cases hm : merge j k (b,v) with + | none => rfl + | some u => simp [Option.map,prepend,erase,show ¬j≤a by omega] + | succ i => + simp only [merge,Nat.add_right_cancel_iff] + have hi := ih i k b hb + cases hm : merge j k (b,v) with + | none => + rw [hm] at hi + split_ifs at hi ⊢ with he + · rw [← hi]; rfl + · rfl + | some u => + rw [hm,Option.bind_some] at hi + change ((erase j i u).map (prepend a))=if i=k then (merge 0 k (b,v)).map (prepend a) else none + rw [hi] + split_ifs <;> rfl + +end GapWord + +namespace GapAlgebra +open AssociativeElimination WordGrading GapWord PositionalDeletion +variable {R : Type*} [CommRing R] +local notation "S" => A R Bool +local notation "C" => (OreShift.C : S) +local notation "B" => (OreShift.B : S) + +def alg (g : G) : S := word (FreeMonoid.ofList (encode g)) +def optionAlg (g : Option G) : S := g.elim 0 alg + +@[simp] theorem optionAlg_none : optionAlg (R:=R) none=0 := rfl +@[simp] theorem optionAlg_some (g : G) : optionAlg (R:=R) (some g)=alg g := rfl + +theorem word_false_pow (a : ℕ) : word (R:=R) (FreeMonoid.ofList (List.replicate a false))=C^a := by + induction a with + | zero => rfl + | succ a ih => rw [List.replicate_succ,word_cons,ih,pow_succ']; rfl + +theorem alg_bump (a : ℕ) (g : G) : alg (R:=R) (bump a g)=C^a*alg g := by + rw [alg,encode_bump] + change word (FreeMonoid.ofList (List.replicate a false)*FreeMonoid.ofList (encode g))=_ + rw [word_mul,word_false_pow] + rfl + +theorem alg_prepend (a : ℕ) (g : G) : alg (R:=R) (prepend a g)=C^a*(B*alg g) := by + rw [alg,encode_prepend] + change word (FreeMonoid.ofList (List.replicate a false)*FreeMonoid.ofList (true::encode g))=_ + rw [word_mul,word_false_pow,word_cons] + rfl + +theorem optionAlg_prepend (a : ℕ) (g : Option G) : + optionAlg (R:=R) (g.map (prepend a))=C^a*(B*optionAlg g) := by + cases g with + | none => simp + | some g => exact alg_prepend a g + +theorem alg_nil (a : ℕ) : alg (R:=R) (a,[])=C^a := by + simp only [alg,encode,word_false_pow] + +theorem alg_cons (a b : ℕ) (g : List ℕ) : alg (R:=R) (a,b::g)=C^a*(B*alg (b,g)) := + alg_prepend a (b,g) + +theorem replace_C_pow_mul (u : S) (i a : ℕ) (p : S) : + replace u i (C^a*p)=C^a*replace u i p := by + induction a with + | zero => simp + | succ a ih => + rw [pow_succ',mul_assoc] + change replace u i (atom false*(C^a*p))=_ + rw [replace_C_mul,ih,mul_assoc] + rfl + +theorem replace_alg (j i : ℕ) (g : G) : + replace (C^j) i (alg g)=optionAlg (merge j i g) := by + obtain ⟨a,v⟩ := g + induction v generalizing i a with + | nil => + rw [alg_nil,show C^a=C^a*1 by rw [mul_one],replace_C_pow_mul,replace_one,mul_zero] + simp only [merge,optionAlg_none] + | cons b v ih => + rw [alg_cons,replace_C_pow_mul] + cases i with + | zero => + change C^a*replace (C^j) 0 (atom true*alg (b,v))=_ + rw [replace_B_mul_zero] + simp only [merge,optionAlg_some] + change C^a*(C^j*alg (b,v))=alg (bump (a+j) (b,v)) + rw [alg_bump,pow_add,mul_assoc] + | succ i => + change C^a*replace (C^j) (i+1) (atom true*alg (b,v))=_ + rw [replace_B_mul_succ,ih,merge] + exact (optionAlg_prepend a (merge j i (b,v))).symm + +def eraseLinear (j i : ℕ) : S →ₗ[R] S := + (Finsupp.linearCombination R (fun w : FreeMonoid Bool => optionAlg (erase j i (decode w.toList)))).comp + (MonoidAlgebra.coeffLinearEquiv R).toLinearMap + +@[simp] theorem eraseLinear_word (j i : ℕ) (w : FreeMonoid Bool) : + eraseLinear j i (word w : S)=optionAlg (erase j i (decode w.toList)) := by + change Finsupp.linearCombination R (fun monoidWord : FreeMonoid Bool => optionAlg (erase j i (decode monoidWord.toList))) (Finsupp.single w 1) = _; simp + +theorem eraseLinear_alg (j i : ℕ) (g : G) : + eraseLinear j i (alg g : S)=optionAlg (erase j i g) := by + simp [alg,decode_encode] + +theorem eraseLinear_optionAlg (j i : ℕ) (g : Option G) : + eraseLinear j i (optionAlg g : S)=optionAlg (g.bind (erase j i)) := by + cases g with + | none => simp + | some g => exact eraseLinear_alg j i g + +theorem eraseLinear_replace_alg (j i k : ℕ) (g : G) (h : size g degree wb w degree wb w degree wb v simp + | of_mul a w ih => + simp only [word_mul,word_of,map_mul,degree_mul,degree_of] + have hfw : f (word w)∈below wb (degree wa w) := + algHom_below f wa wb hf (word_mem w (le_refl _)) + have h1 : (f (atom a)-g (atom a))*f (word w)∈space (fun v => degree wb v degree wb v degree wb v degree wt w degree wt w + change translate s C∈below wt 0 + rw [translate_C] + exact homogeneous_below (word_mem _ rfl) + | true => + change translate s B∈below wt 1 + rw [translate_B] + exact (below wt 1).add_mem (word_mem _ (by simp [degree_of,wt])) + (space_mono (by intro w hw; omega) hs) + · intro b + exact word_mem _ (degree_of wt b) + · intro b + cases b with + | false => + change translate s C-C∈_ + rw [translate_C,sub_self] + exact Submodule.zero_mem _ + | true => + change translate s B-B∈space (fun w => degree wt w<1) + rw [translate_B,add_sub_cancel_left] + exact space_mono (by intro w hw; omega) hs + +theorem erase_degree (a : Slot) : eraseShift (0 : S R) (atom a)∈homogeneous wt (bCount a) := by + cases a <;> simp only [eraseShift,lift_atom,add_zero] + · exact Submodule.zero_mem _ + · exact word_mem _ rfl + · exact word_mem _ rfl + +theorem shift_invariant {ψ : FreeLieAlgebra (ZMod 2) Bool} + {p : FreeLieAlgebra (ZMod 2) Slot} {n m r : ℕ} + (hn : 1 1) n) + (hp : under p=embed ψ) (hanti : BaseChangeEquations.antisymmetry ψ=0) + (hr : embed p∈above bCount r) {s : S (ZMod 2)} + (hs : D s=0) (hc : ⁅(C : S (ZMod 2)),s⁆=0) (hdeg : s∈homogeneous wt 0) : + eraseShift s (piece bCount r (embed p))=eraseShift 0 (piece bCount r (embed p)) := by + have hf := algHom_homogeneous (eraseShift (0 : S (ZMod 2))) bCount wt erase_degree + (piece_mem bCount r (embed p)) + have hd := translate_difference hdeg hf + rw [←AlgHom.comp_apply,translate_erase] at hd + apply sub_eq_zero.mp + exact above_lower_zero ((above wt r).sub_mem + (shifted_leading_bound hn hnm hψ hp hanti hr hs hc) (homogeneous_above hf)) hd + +end + +open AssociativeElimination WordGrading +variable {R : Type*} [CommRing R] + +def shiftDeriv (s : S R) : S R →ₗ[R] S R := deriv (fun b => if b then s else 0) + +@[simp] theorem shiftDeriv_C (s : S R) : shiftDeriv s C=0 := by simp [shiftDeriv,C] +@[simp] theorem shiftDeriv_B (s : S R) : shiftDeriv s B=s := by simp [shiftDeriv,B] +@[simp] theorem shiftDeriv_one (s : S R) : shiftDeriv s 1=0 := deriv_one _ +theorem shiftDeriv_mul (s p q : S R) : + shiftDeriv s (p*q)=shiftDeriv s p*q+p*shiftDeriv s q := deriv_mul _ _ _ + +theorem shiftDeriv_degree {s : S R} (hs : s∈homogeneous wt 0) {r : ℕ} {p : S R} + (hp : p∈homogeneous wt r) : shiftDeriv s p∈lower wt 1 r := by + apply deriv_lower wt 1 _ ?_ hp + intro b + cases b with + | false => exact Submodule.zero_mem _ + | true => exact space_mono (by intro w hw; change degree wt w+1=1; omega) hs + +theorem taylor_remainder {s : S R} (hs : s∈homogeneous wt 0) {r : ℕ} {p : S R} + (hp : p∈homogeneous wt r) : + translate s p-p-shiftDeriv s p∈space (fun w => degree wt w+1 degree wt v+1 simp [E] + | of_mul b w ih => + have hh : word (R:=R) w∈homogeneous wt (degree wt w) := word_mem w rfl + have hd := translate_difference hs hh + cases b with + | false => + have he : E (word (FreeMonoid.of false*w))=C*E (word w) := by + simp only [E,LinearMap.sub_apply,AlgHom.toLinearMap_apply,LinearMap.id_apply, + word_mul,word_of] + change translate s (C*word w)-C*word w-shiftDeriv s (C*word w)=_ + rw [map_mul,translate_C,shiftDeriv_mul,shiftDeriv_C,zero_mul,zero_add] + noncomm_ring + rw [he] + have hc : (C : S R)∈homogeneous wt 0 := word_mem _ rfl + have h1 : C*E (word w)∈space (fun v => degree wt v+1<0+degree wt w) := + mul_mem (by intro u v hu hv; simp only [degree_mul]; omega) hc ih + exact h1 + | true => + have he : E (word (FreeMonoid.of true*w))= + B*E (word w)+s*(translate s (word w)-word w) := by + simp only [E,LinearMap.sub_apply,AlgHom.toLinearMap_apply,LinearMap.id_apply, + word_mul,word_of] + change translate s (B*word w)-B*word w-shiftDeriv s (B*word w)=_ + rw [map_mul,translate_B,shiftDeriv_mul,shiftDeriv_B] + noncomm_ring + rw [he] + have hb : (B : S R)∈homogeneous wt 1 := word_mem _ rfl + have h1 : B*E (word w)∈space (fun v => degree wt v+1<1+degree wt w) := + mul_mem (by intro u v hu hv; simp only [degree_mul]; omega) hb ih + have h2 : s*(translate s (word w)-word w)∈space (fun v => degree wt v+1<1+degree wt w) := + mul_mem (by intro u v hu hv; simp only [degree_mul]; omega) hs hd + exact (space _).add_mem h1 h2 + exact map_space E _ (by intro w hw'; simpa only [hw'] using hw w) hp + +theorem shiftDeriv_zero {s : S R} (hs : s∈homogeneous wt 0) {r : ℕ} {p : S R} + (hp : p∈homogeneous wt r) (he : translate s p=p) : shiftDeriv s p=0 := by + have hd := shiftDeriv_degree hs hp + have hl := taylor_remainder hs hp + rw [he,sub_self,zero_sub] at hl + have hl' := (space (fun w => degree wt w+1 A R Bool + +theorem degree_countB (w : FreeMonoid Bool) : degree OreShift.wt w=countB w.toList := by + induction w using FreeMonoid.inductionOn' with + | one => rfl + | of_mul b w ih => + rw [degree_mul,degree_of,ih] + cases b <;> simp [OreShift.wt,countB,FreeMonoid.toList_mul,Nat.add_comm] + +theorem replace_mul (u : S) (i : ℕ) (p q : S) {r : ℕ} (hp : p∈homogeneous OreShift.wt r) : + replace u i (p*q)=if i + obtain ⟨v,hv,rfl⟩ := hp + have hv' : countB v.toList=r := (degree_countB v).symm.trans hv + induction q using MonoidAlgebra.induction_on with + | of w => + change replace u i (word v*word w)=if i simp only [mul_add,map_add,hp,hq]; split_ifs <;> simp + | smul c p hp => simp only [mul_smul_comm,map_smul,hp]; split_ifs <;> simp + | zero => simp + | add p q _ _ hp hq => simp only [add_mul,map_add,hp,hq]; split_ifs <;> simp + | smul c p _ hp => simp only [smul_mul_assoc,map_smul,hp]; split_ifs <;> simp + +theorem shiftDeriv_word (u : S) (w : List Bool) : + OreShift.shiftDeriv u (word (FreeMonoid.ofList w))= + ∑ i∈Finset.range (countB w), replaceWord u i w := by + induction w with + | nil => simp [countB] + | cons b w ih => + rw [word_cons,OreShift.shiftDeriv_mul,ih] + cases b with + | false => + change OreShift.shiftDeriv u OreShift.C*word (FreeMonoid.ofList w)+_= _ + rw [OreShift.shiftDeriv_C,zero_mul,zero_add] + simp only [countB_false,replaceWord,Finset.mul_sum] + | true => + change OreShift.shiftDeriv u OreShift.B*word (FreeMonoid.ofList w)+_= _ + rw [OreShift.shiftDeriv_B,countB_true,Finset.sum_range_succ'] + simp only [replaceWord,Finset.mul_sum] + abel + +theorem shiftDeriv_eq_sum (u : S) (p : S) {r : ℕ} (hp : p∈homogeneous OreShift.wt r) : + OreShift.shiftDeriv u p=∑ i∈Finset.range r, replace u i p := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + have hw' : countB w.toList=r := (degree_countB w).symm.trans hw + simpa only [replace_word,FreeMonoid.ofList_toList,hw'] using shiftDeriv_word u w.toList + | zero => simp + | add p q _ _ hp hq => simp [map_add,hp,hq,Finset.sum_add_distrib] + | smul c p _ hp => simp [map_smul,hp,Finset.smul_sum] + +end PositionalDeletion + +namespace WordGrading +open AssociativeElimination +variable {R α : Type*} [CommRing R] + +theorem exists_below (wt : α → ℕ) (p : A R α) : ∃ n,p∈below wt n := by + induction p using MonoidAlgebra.induction_on with + | of w => exact ⟨degree wt w,word_mem w (le_refl _)⟩ + | add p q hp hq => + obtain ⟨n,hn⟩ := hp + obtain ⟨m,hm⟩ := hq + exact ⟨n+m,(below wt _).add_mem (space_mono (by intro w hw; omega) hn) + (space_mono (by intro w hw; omega) hm)⟩ + | smul c p hp => obtain ⟨n,hn⟩ := hp; exact ⟨n,(below wt n).smul_mem _ hn⟩ + +end WordGrading +namespace GapSelection +open AssociativeElimination WordGrading PositionalDeletion GapAlgebra +variable {R : Type*} [CommRing R] +local notation "S" => A R Bool +local notation "C" => (OreShift.C : S) + +def cwt (b : Bool) : ℕ := if b then 0 else 1 + +theorem degree_countC (w : FreeMonoid Bool) : degree cwt w=w.toList.count false := by + induction w using FreeMonoid.inductionOn' with + | one => rfl + | of_mul b w ih => + rw [degree_mul,degree_of,ih] + cases b <;> simp [cwt,FreeMonoid.toList_mul,Nat.add_comm] + +theorem eraseLinear_replace {p : S} {m j : ℕ} (hp : p∈below cwt m) (hj : m + obtain ⟨w,hw,rfl⟩ := hp + exact eraseLinear_replace_word j i k w (by rw [degree_countC] at hw; omega) + | zero => simp + | add p q _ _ hp hq => simp only [map_add,hp,hq]; split_ifs <;> simp + | smul c p _ hp => simp only [map_smul,hp]; split_ifs <;> simp + +theorem replace_missing_homogeneous {p : S} {r i : ℕ} (hp : p∈homogeneous OreShift.wt r) (hi : r ≤ i) : + replace 1 i p=0 := by + induction hp using Submodule.span_induction with + | mem p hp => + obtain ⟨w,hw,rfl⟩ := hp + rw [replace_word] + exact replaceWord_missing _ _ _ (by rw [←degree_countB,hw]; exact hi) + | zero => exact map_zero _ + | add p q _ _ hp hq => simp [hp,hq] + | smul c p _ hp => simp [hp] + +theorem Cpow_degree (j : ℕ) : C^j∈homogeneous OreShift.wt 0 := by + induction j with + | zero => + rw [pow_zero] + exact word_mem (1 : FreeMonoid Bool) (show degree OreShift.wt 1=0 from rfl) + | succ j ih => + rw [pow_succ] + have hc : C∈homogeneous OreShift.wt 0 := word_mem (FreeMonoid.of false) rfl + exact homogeneous_mul (wt:=OreShift.wt) (n:=0) (m:=0) ih hc + +theorem all_deletions_zero {p : S} {r : ℕ} (hp : p∈homogeneous OreShift.wt r) + (hinv : ∀ j,OreShift.translate (C^j) p=p) (i : ℕ) : replace 1 i p=0 := by + by_cases hi : i 0 + | 0,a::w => if a.1=0 then word (FreeMonoid.ofList w) else 0 + | i+1,a::w => atom a*removeWord i w + +def remove (i : ℕ) : Q →ₗ[K] Q := + (Finsupp.linearCombination K (fun w : FreeMonoid I => removeWord i w.toList)).comp + (MonoidAlgebra.coeffLinearEquiv K).toLinearMap + +@[simp] theorem remove_word (i : ℕ) (w : FreeMonoid I) : + remove i (word w)=removeWord i w.toList := by + change Finsupp.linearCombination K (fun monoidWord : FreeMonoid I => removeWord i monoidWord.toList) (Finsupp.single w 1) = _; simp + +def zeroAt : ℕ → List I → Bool + | _,[] => false + | 0,a::_ => decide (a.1=0) + | i+1,_::w => zeroAt i w + +def insertList : ℕ → List I → List I + | 0,w => (0,())::w + | _+1,[] => [(0,())] + | i+1,a::w => a::insertList i w + +def insert (i : ℕ) : Q →ₗ[K] Q := + (Finsupp.linearCombination K (fun w : FreeMonoid I => word (FreeMonoid.ofList (insertList i w.toList)))).comp + (MonoidAlgebra.coeffLinearEquiv K).toLinearMap + +@[simp] theorem insert_word (i : ℕ) (w : FreeMonoid I) : + insert i (word w)=word (FreeMonoid.ofList (insertList i w.toList)) := by + change Finsupp.linearCombination K (fun monoidWord : FreeMonoid I => word (FreeMonoid.ofList (insertList i monoidWord.toList))) (Finsupp.single w 1) = _; simp + +theorem insert_succ_atom_mul (i : ℕ) (a : I) (p : Q) : + insert (i+1) (atom a*p)=atom a*insert i p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change insert (i+1) (word (FreeMonoid.of a)*word w)=word (FreeMonoid.of a)*insert i (word w) + rw [←word_mul,insert_word,insert_word,←word_mul] + rfl + | add p q hp hq => simp only [mul_add,map_add,hp,hq] + | smul c p hp => simp only [mul_smul_comm,map_smul,hp] + +theorem insert_remove_word (i : ℕ) (w : List I) : + insert i (removeWord i w)=if zeroAt i w then word (FreeMonoid.ofList w) else 0 := by + induction w generalizing i with + | nil => simp [removeWord,zeroAt] + | cons a w ih => + cases i with + | zero => + simp only [removeWord,zeroAt,decide_eq_true_eq] + split_ifs with h + · rw [insert_word] + obtain ⟨n,u⟩ := a + cases u + simp only at h + subst n + rfl + · exact map_zero _ + | succ i => + rw [removeWord,insert_succ_atom_mul,ih] + rw [zeroAt] + split_ifs + · exact (word_mul (FreeMonoid.of a) (FreeMonoid.ofList w)).symm + · exact mul_zero _ + +theorem insert_remove (i : ℕ) (p : Q) : + insert i (remove i p)=project (fun w => zeroAt i w.toList=true) p := by + induction p using MonoidAlgebra.induction_on with + | of w => + change insert i (remove i (word w))=project _ (word w) + rw [remove_word,project_word,insert_remove_word,FreeMonoid.ofList_toList] + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +theorem input_injective : Function.Injective EvenIndex.input := + (assoc_injective bitOption.symm bitOption bitOption.right_inv).comp EliminationGraded.collapse_injective + +theorem input_degree (a : I) : EvenIndex.input (atom a)∈homogeneous OreShift.wt 1 := by + obtain ⟨n,u⟩ := a + cases u + rw [EvenIndex.input_atom] + have hg : ∀ a : Option Unit,renameAssoc (R:=K) bitOption.symm (atom a)∈homogeneous OreShift.wt ((OreShift.wt ∘ bitOption.symm) a) := by + intro a + rw [renameAssoc_atom] + exact word_mem _ (degree_of _ _) + have hd : embed (Elimination.adWord n () : Elimination.G K Unit)∈homogeneous (OreShift.wt ∘ bitOption.symm) 1 := by + simpa [OreShift.wt,bitOption] using EliminationGraded.adWord_degree (R:=K) n () (OreShift.wt ∘ bitOption.symm) + exact algHom_homogeneous (renameAssoc bitOption.symm) (OreShift.wt ∘ bitOption.symm) OreShift.wt hg hd + +theorem replace_input_atom_zero (n : ℕ) : + replace 1 0 (EvenIndex.input (atom (n,())))=if n=0 then 1 else 0 := by + induction n with + | zero => + rw [EvenIndex.input_atom_zero,ite_eq_left rfl] + simpa only [mul_one] using replace_B_mul_zero (R:=K) 1 1 + | succ n ih => + rw [EvenIndex.input_atom_succ] + change replace 1 0 ((atom false : A K Bool)*EvenIndex.input (atom (n,()))-EvenIndex.input (atom (n,()))*atom false)=_ + rw [map_sub,replace_C_mul,replace_mul 1 0 _ _ (input_degree (n,())),ite_eq_left (by omega),ih] + by_cases hn : n=0 <;> simp [hn] + +theorem replace_input_word (i : ℕ) (w : FreeMonoid I) : + replace 1 i (EvenIndex.input (word w))=EvenIndex.input (remove i (word w)) := by + rw [remove_word] + induction w using FreeMonoid.inductionOn' generalizing i with + | one => simp [removeWord] + | of_mul a w ih => + rw [word_mul,word_of,map_mul,replace_mul 1 i _ _ (input_degree a)] + obtain ⟨n,u⟩ := a + cases u + cases i with + | zero => + rw [ite_eq_left (by omega),replace_input_atom_zero] + change (if n=0 then 1 else 0)*EvenIndex.input (word w)=EvenIndex.input (if n=0 then word w else 0) + split_ifs <;> simp + | succ i => + rw [ite_eq_right (by omega),Nat.add_sub_cancel,ih] + change EvenIndex.input (atom (n,()))*EvenIndex.input (removeWord i w.toList)=EvenIndex.input (atom (n,())*removeWord i w.toList) + rw [map_mul] + +theorem replace_input (i : ℕ) (p : Q) : + replace 1 i (EvenIndex.input p)=EvenIndex.input (remove i p) := by + induction p using MonoidAlgebra.induction_on with + | of w => exact replace_input_word i w + | add p q hp hq => simp only [map_add,hp,hq] + | smul c p hp => simp only [map_smul,hp] + +end + +open AssociativeElimination WordGrading UniversalEmbedding +attribute [local instance] LieRing.ofAssociativeRing + +def noZero (w : List I) : Prop := ∀ a∈w,a.1≠0 + +theorem noZero_of_zeroAt_false (w : List I) (h : ∀ i,zeroAt i w=false) : noZero w := by + induction w with + | nil => simp [noZero] + | cons a w ih => + have ha : a.1≠0 := by simpa [zeroAt] using h 0 + have ht : noZero w := ih (fun i => by simpa only [zeroAt] using h (i+1)) + intro b hb + rcases List.mem_cons.mp hb with rfl | hb + · exact ha + · exact ht b hb + +theorem support_noZero {p : Q} (h : ∀ i,remove i p=0) : + p∈space (fun w => noZero w.toList) := by + apply mem_space + intro w hw + apply noZero_of_zeroAt_false + intro i + have hp : project (fun w => zeroAt i w.toList=true) p=0 := by + rw [←insert_remove,h i,map_zero] + have hc := congrArg (fun q : Q => q.coeff w) hp + rw [project_coeff] at hc + cases hi : zeroAt i w.toList with + | false => rfl + | true => + simp only [hi,MonoidAlgebra.coeff_zero,Finsupp.zero_apply] at hc + exact False.elim (hw hc) + +def retain : Q →ₐ[K] Q := lift (fun a => if a.1=0 then 0 else atom a) + +@[simp] theorem retain_atom (a : I) : retain (atom a)=if a.1=0 then 0 else atom a := by simp [retain] + +theorem retain_word (w : FreeMonoid I) (h : noZero w.toList) : retain (word w)=word w := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + have ha : a.1≠0 := h a (List.mem_cons_self) + have ht : noZero w.toList := fun b hb => h b (List.mem_cons_of_mem a hb) + rw [word_mul,word_of,map_mul,retain_atom,ite_eq_right ha,ih ht] + +theorem retain_eq_self {p : Q} (h : ∀ i,remove i p=0) : retain p=p := by + have hp := support_noZero h + clear h + induction hp using Submodule.span_induction with + | mem p hp => obtain ⟨w,hw,rfl⟩ := hp; exact retain_word w hw + | zero => exact map_zero _ + | add p q _ _ hp hq => simp only [map_add,hp,hq] + | smul c p _ hp => simp only [map_smul,hp] + +def cutLie : FreeLieAlgebra K I →ₗ⁅K⁆ FreeLieAlgebra K ℕ := + FreeLieAlgebra.lift K (fun a => match a.1 with | 0 => 0 | n+1 => FreeLieAlgebra.of K n) +def includeLie : FreeLieAlgebra K ℕ →ₗ⁅K⁆ FreeLieAlgebra K I := + FreeLieAlgebra.lift K (fun n => FreeLieAlgebra.of K (n+1,())) + +def cutAssoc : Q →ₐ[K] A K ℕ := lift (fun a => match a.1 with | 0 => 0 | n+1 => atom n) +def includeAssoc : A K ℕ →ₐ[K] Q := lift (fun n => atom (n+1,())) + +theorem cut_embed (p : FreeLieAlgebra K I) : cutAssoc (embed p)=embed (cutLie p) := by + have h : cutAssoc.toLieHom.comp embed=embed.comp cutLie := by + apply FreeLieAlgebra.hom_ext + rintro ⟨n,u⟩ + cases u + cases n <;> simp [cutAssoc,cutLie] + exact LieHom.congr_fun h p + +theorem include_embed (p : FreeLieAlgebra K ℕ) : includeAssoc (embed p)=embed (includeLie p) := by + have h : includeAssoc.toLieHom.comp embed=embed.comp includeLie := by + apply FreeLieAlgebra.hom_ext + intro n + simp [includeAssoc,includeLie] + exact LieHom.congr_fun h p + +theorem include_cut : includeAssoc.comp cutAssoc=retain := by + apply hom_ext + rintro ⟨n,u⟩ + cases u + cases n <;> simp [includeAssoc,cutAssoc,retain] + +theorem positive_generation {p : FreeLieAlgebra K I} + (h : ∀ i,PositionalDeletion.replace 1 i (EvenIndex.input (embed p))=0) : + ∃ q : FreeLieAlgebra K ℕ,EvenIndex.input (embed p)=EvenIndex.input (embed (includeLie q)) := by + have hr (i : ℕ) : remove i (embed p)=0 := by + apply input_injective + rw [←replace_input,h i,map_zero] + refine ⟨cutLie p,?_⟩ + rw [←include_embed,←cut_embed] + have he : includeAssoc (cutAssoc (embed p))=embed p := + (AlgHom.congr_fun include_cut _).trans (retain_eq_self hr) + rw [he] + +end GeneratorDeletion + +namespace ImageBound + +section +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon AlphabetTransport +attribute [local instance] LieRing.ofAssociativeRing +abbrev K := ZMod 2 + +theorem input_fiber_of_bcount {p : FreeLieAlgebra K Bool} {r : ℕ} (hr : r≠0) + (hp : embed p∈homogeneous OreShift.wt r) : EvenIndex.input (EvenIndex.fiber p)=embed p := by + have ho : embed (rename bitOption p)∈homogeneous (OreShift.wt ∘ bitOption.symm) r := by + rw [rename_embed] + apply algHom_homogeneous (renameAssoc bitOption) OreShift.wt (OreShift.wt ∘ bitOption.symm) ?_ hp + intro b + rw [renameAssoc_atom] + apply word_mem + simp [degree_of] + have hz := EliminationGraded.trace_homogeneous_zero (wt:=OreShift.wt ∘ bitOption.symm) (by simpa [bitOption,OreShift.wt] using hr) ho + have hd := EliminationGraded.embed_decompose (rename bitOption p) + rw [hz,zero_smul,add_zero] at hd + have h := congrArg (renameAssoc bitOption.symm) hd + rw [rename_embed,assoc_retract bitOption bitOption.symm bitOption.left_inv] at h + exact h.symm + +def positiveInput : A K ℕ →ₐ[K] A K Bool := EvenIndex.input.comp GeneratorDeletion.includeAssoc + +theorem positiveInput_injective : Function.Injective positiveInput := by + apply GeneratorDeletion.input_injective.comp + have hc : GeneratorDeletion.cutAssoc.comp GeneratorDeletion.includeAssoc=AlgHom.id K (A K ℕ) := by + apply hom_ext + intro n + simp [GeneratorDeletion.cutAssoc,GeneratorDeletion.includeAssoc] + exact Function.LeftInverse.injective (f:=GeneratorDeletion.includeAssoc) (g:=GeneratorDeletion.cutAssoc) (fun p => AlgHom.congr_fun hc p) + +@[simp] theorem positiveInput_atom (n : ℕ) : positiveInput (atom n)=EvenIndex.input (atom (n+1,())) := by + simp [positiveInput,GeneratorDeletion.includeAssoc] + +theorem shift_invariant_generation {p : FreeLieAlgebra K Bool} {r : ℕ} + (hr : r≠0) (hp : embed p∈homogeneous OreShift.wt r) + (hinv : ∀ j,OreShift.translate ((OreShift.C : A K Bool)^j) (embed p)=embed p) : + ∃ q : FreeLieAlgebra K ℕ,positiveInput (embed q)=embed p := by + have hi := input_fiber_of_bcount hr hp + have hd := GapSelection.all_deletions_zero hp hinv + obtain ⟨q,hq⟩ := GeneratorDeletion.positive_generation (p:=(Elimination.expand (rename bitOption p)).left) + (by intro i; change PositionalDeletion.replace 1 i (EvenIndex.input (EvenIndex.fiber p))=0; rw [hi]; exact hd i) + refine ⟨q,?_⟩ + change EvenIndex.input (EvenIndex.fiber p)=_ at hq + rw [hi] at hq + rw [←GeneratorDeletion.include_embed] at hq + exact hq.symm + +def eraseLie : FreeLieAlgebra K Slot →ₗ⁅K⁆ FreeLieAlgebra K Bool := + FreeLieAlgebra.lift K (fun a => match a with + | .A => 0 | .B => FreeLieAlgebra.of K true | .C => FreeLieAlgebra.of K false) + +theorem erase_embed (p : FreeLieAlgebra K Slot) : embed (eraseLie p)=OreShift.eraseShift 0 (embed p) := by + have h : embed.comp eraseLie=(OreShift.eraseShift (0 : A K Bool)).toLieHom.comp embed := by + apply FreeLieAlgebra.hom_ext + intro a + cases a <;> simp [eraseLie,OreShift.eraseShift,OreShift.B,OreShift.C] + exact LieHom.congr_fun h p + +def leading (r : ℕ) (p : FreeLieAlgebra K Slot) : FreeLieAlgebra K Bool := + eraseLie (LieGrading.piece bCount r p) + +@[simp] theorem embed_leading (r : ℕ) (p : FreeLieAlgebra K Slot) : + embed (leading r p)=OreShift.eraseShift 0 (WordGrading.piece bCount r (embed p)) := by + rw [leading,erase_embed,LieGrading.embed_piece] + +theorem leading_bcount (r : ℕ) (p : FreeLieAlgebra K Slot) : + embed (leading r p)∈homogeneous OreShift.wt r := by + rw [embed_leading] + exact algHom_homogeneous _ bCount OreShift.wt OreShift.erase_degree (piece_mem bCount r (embed p)) + +def cbWeight (b : Bool) : ℕ := if b then 1 else 2 + +theorem erase_weight_degree (a : Slot) : + OreShift.eraseShift (0 : A K Bool) (atom a)∈homogeneous cbWeight (weight a) := by + cases a <;> simp only [OreShift.eraseShift,lift_atom,add_zero] + · exact Submodule.zero_mem _ + · exact word_mem (FreeMonoid.of false) rfl + · exact word_mem (FreeMonoid.of true) rfl + +theorem leading_weight {p : FreeLieAlgebra K Slot} {n : ℕ} + (hp : embed p∈homogeneous weight n) (r : ℕ) : embed (leading r p)∈homogeneous cbWeight n := by + rw [embed_leading] + exact algHom_homogeneous _ weight cbWeight erase_weight_degree (project_preserves hp) + +theorem weight_count (w : FreeMonoid Bool) : degree cbWeight w=2*degree GapSelection.cwt w+degree OreShift.wt w := by + induction w using FreeMonoid.inductionOn' with + | one => rfl + | of_mul b w ih => + simp only [degree_mul,degree_of] + cases b <;> simp only [cbWeight,GapSelection.cwt,OreShift.wt,Bool.false_eq_true,ite_false,ite_true] <;> omega + +theorem weight_split {p : A K Bool} {n r : ℕ} (hp : p≠0) + (hn : p∈homogeneous cbWeight n) (hr : p∈homogeneous OreShift.wt r) : ∃ m,n=2*m+r := by + obtain ⟨w,hw⟩ : ∃ w,p.coeff w≠0 := by + by_contra h + apply hp + ext w + have := not_exists.mp h w + simpa using this + have h1 := mem_space_iff.mp hn w hw + have h2 := mem_space_iff.mp hr w hw + exact ⟨degree GapSelection.cwt w,by rw [←h1,weight_count,h2]⟩ + +theorem D_Cpow (j : ℕ) : OreShift.D ((OreShift.C : A K Bool)^j)=0 := by + induction j with + | zero => simp + | succ j ih => rw [pow_succ,OreShift.D_mul,ih,OreShift.D_C,zero_mul,mul_zero,add_zero] + +theorem C_lie_Cpow (j : ℕ) : ⁅(OreShift.C : A K Bool),(OreShift.C : A K Bool)^j⁆=0 := by + change (OreShift.C : A K Bool)*OreShift.C^j-OreShift.C^j*OreShift.C=0 + rw [←pow_succ',←pow_succ,sub_self] + +theorem leading_shift_invariant {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n r : ℕ} + (hn : 1 1) n) + (hp : under p=embed ψ) (hanti : BaseChangeEquations.antisymmetry ψ=0) + (hr : embed p∈above bCount r) (j : ℕ) : + OreShift.translate ((OreShift.C : A K Bool)^j) (embed (leading r p))=embed (leading r p) := by + by_cases hz : embed (leading r p)=0 + · rw [hz,map_zero] + obtain ⟨m,hm⟩ := weight_split hz (leading_weight (representation_weight hψ hp) r) (leading_bcount r p) + rw [embed_leading,←AlgHom.comp_apply,OreShift.translate_erase] + exact OreShift.shift_invariant hn hm hψ hp hanti hr (D_Cpow j) (C_lie_Cpow j) (GapSelection.Cpow_degree j) + +theorem actual_image_positive {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n r : ℕ} + (hn : 1 1) n) + (hp : under p=embed ψ) (hanti : BaseChangeEquations.antisymmetry ψ=0) + (hr : embed p∈above bCount r) (hr0 : r≠0) : + ∃ q : FreeLieAlgebra K ℕ,positiveInput (embed q)=embed (leading r p) := + shift_invariant_generation hr0 (leading_bcount r p) (leading_shift_invariant hn hψ hp hanti hr) + +end + +open AssociativeElimination UniversalEmbedding WordGrading QuadraticLeading +open RowTwo RowKernel ExactPentagon AlphabetTransport +attribute [local instance] LieRing.ofAssociativeRing + +theorem degree_bcount_zero (w : FreeMonoid Bool) (hw : degree OreShift.wt w=0) : + ∀ b∈w.toList,b=false := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul b w ih => + rw [degree_mul,degree_of] at hw + have hb : b=false := by cases b <;> simp_all [OreShift.wt] + have ht : degree OreShift.wt w=0 := by omega + intro c hc + rcases List.mem_cons.mp hc with h | h + · exact h.trans hb + · exact ih ht c h + +theorem leading_zero_count {p : FreeLieAlgebra K Slot} {n : ℕ} (hn : n≠2) + (hp : embed p∈homogeneous weight n) : leading 0 p=0 := by + apply LetterRetraction.homogeneous_single_zero false (wt:=cbWeight) hn ?_ (leading_weight hp 0) + exact space_mono (fun w hw => degree_bcount_zero w hw) (leading_bcount 0 p) + +theorem positiveInput_degree (wt : Bool → ℕ) (n : ℕ) : + positiveInput (atom n)∈homogeneous wt ((n+1)*wt false+wt true) := by + rw [positiveInput_atom,EvenIndex.input_atom] + have h := EliminationGraded.adWord_degree (R:=K) (n+1) () (wt ∘ bitOption.symm) + apply algHom_homogeneous (renameAssoc bitOption.symm) (wt ∘ bitOption.symm) wt ?_ h + intro b + rw [renameAssoc_atom] + exact word_mem _ (degree_of wt _) + +theorem positiveInput_bcount (n : ℕ) : positiveInput (atom n)∈homogeneous OreShift.wt 1 := by + simpa only [OreShift.wt,Bool.false_eq_true,ite_false,ite_true,mul_zero,zero_add] using positiveInput_degree OreShift.wt n + +def oddWeight (n : ℕ) : ℕ := 2*(n+1)+1 + +theorem positiveInput_weight (n : ℕ) : positiveInput (atom n)∈homogeneous cbWeight (oddWeight n) := by + simpa only [oddWeight,cbWeight,Bool.false_eq_true,ite_false,ite_true,Nat.mul_comm] using positiveInput_degree cbWeight n + +theorem image_graded {p : FreeLieAlgebra K Bool} {n r : ℕ} + (hw : embed p∈homogeneous cbWeight n) (hr : embed p∈homogeneous OreShift.wt r) + {q : FreeLieAlgebra K ℕ} (hq : positiveInput (embed q)=embed p) : + embed q∈homogeneous oddWeight n ∧ embed q∈homogeneous (fun _ => 1) r := by + constructor + · apply homogeneous_reflect positiveInput oddWeight cbWeight positiveInput_weight positiveInput_injective + rw [hq]; exact hw + · apply homogeneous_reflect positiveInput (fun _ => 1) OreShift.wt positiveInput_bcount positiveInput_injective + rw [hq]; exact hr + +theorem actual_image {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n r : ℕ} + (hn : 2 1) n) + (hp : under p=embed ψ) (hanti : BaseChangeEquations.antisymmetry ψ=0) + (hr : embed p∈above bCount r) : + ∃ q : FreeLieAlgebra K ℕ,positiveInput (embed q)=embed (leading r p) ∧ + embed q∈homogeneous oddWeight n ∧ embed q∈homogeneous (fun _ => 1) r := by + by_cases hr0 : r=0 + · subst r + refine ⟨0,?_,by simp,by simp⟩ + rw [leading_zero_count (by omega) (representation_weight hψ hp)] + simp + · obtain ⟨q,hq⟩ := actual_image_positive (by omega) hψ hp hanti hr hr0 + exact ⟨q,hq,image_graded (leading_weight (representation_weight hψ hp) r) (leading_bcount r p) hq⟩ + +theorem leading_D_zero {ψ : FreeLieAlgebra K Bool} {p : FreeLieAlgebra K Slot} {n r : ℕ} + (hn : 1 1) n) + (hp : under p=embed ψ) (hanti : BaseChangeEquations.antisymmetry ψ=0) + (hr : embed p∈above bCount r) : OreShift.D (embed (leading r p))=0 := by + have h := OreShift.shiftDeriv_zero (GapSelection.Cpow_degree (R:=K) 1) (leading_bcount r p) + (leading_shift_invariant hn hψ hp hanti hr 1) + have he : OreShift.shiftDeriv ((OreShift.C : A K Bool)^1)=OreShift.D := by + simp only [pow_one,OreShift.shiftDeriv,OreShift.D] + rw [he] at h + exact h + +end ImageBound +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/Drinfeld/Transport.lean b/lean/OAI/Algebra/Drinfeld/Transport.lean new file mode 100644 index 0000000000000000000000000000000000000000..d6326e0e0977878826562a2ff944aee7958f0d3b --- /dev/null +++ b/lean/OAI/Algebra/Drinfeld/Transport.lean @@ -0,0 +1,748 @@ +import OAI.Algebra.Drinfeld.Grading + +namespace OAI + +noncomputable section + +namespace DeligneDrinfeld + +section +namespace FiniteAlgebraNorm +open scoped Matrix.Norms.Operator +variable (A : Type*) [Ring A] [Algebra ℝ A] [FiniteDimensional ℝ A] + +abbrev normedRing : NormedRing A := + NormedRing.induced A (Matrix (Fin (Module.finrank ℝ A)) (Fin (Module.finrank ℝ A)) ℝ) + (Algebra.leftMulMatrix (Module.finBasis ℝ A)) + (Algebra.leftMulMatrix_injective (Module.finBasis ℝ A)) + +abbrev normedAlgebra : @NormedAlgebra ℝ A _ (normedRing A).toSeminormedRing := + NormedAlgebra.induced ℝ A (Matrix (Fin (Module.finrank ℝ A)) (Fin (Module.finrank ℝ A)) ℝ) + (Algebra.leftMulMatrix (Module.finBasis ℝ A)) + +variable (K A : Type*) [RCLike K] [Ring A] [Algebra K A] [FiniteDimensional K A] + +abbrev normedRingOver : NormedRing A := + NormedRing.induced A (Matrix (Fin (Module.finrank K A)) (Fin (Module.finrank K A)) K) + (Algebra.leftMulMatrix (Module.finBasis K A)) + (Algebra.leftMulMatrix_injective (Module.finBasis K A)) + +abbrev normedAlgebraOver : @NormedAlgebra K A _ (normedRingOver K A).toSeminormedRing := + NormedAlgebra.induced K A (Matrix (Fin (Module.finrank K A)) (Fin (Module.finrank K A)) K) + (Algebra.leftMulMatrix (Module.finBasis K A)) + +end FiniteAlgebraNorm + +namespace FinitePicard + +section +open MeasureTheory Set intervalIntegral +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +def term (Ω : ℝ → A) (a : ℝ) : ℕ → ℝ → A + | 0 => fun _ => 1 + | n+1 => fun t => ∫ s in a..t, Ω s * term Ω a n s + +@[simp] theorem term_zero (Ω : ℝ → A) (a t : ℝ) : term Ω a 0 t=1 := rfl +@[simp] theorem term_succ (Ω : ℝ → A) (a t : ℝ) (n : ℕ) : + term Ω a (n+1) t=∫ s in a..t, Ω s * term Ω a n s := rfl + +@[simp] theorem term_base (Ω : ℝ → A) (a : ℝ) (n : ℕ) : term Ω a (n+1) a=0 := by + simp + +variable [CompleteSpace A] + +theorem continuous_term {Ω : ℝ → A} (hΩ : Continuous Ω) (a : ℝ) (n : ℕ) : + Continuous (term Ω a n) := by + induction n with + | zero => exact continuous_const + | succ n ih => + exact (intervalIntegral.differentiable_integral_of_continuous (hΩ.mul ih)).continuous + +theorem derivative_succ {Ω : ℝ → A} (hΩ : Continuous Ω) (a t : ℝ) (n : ℕ) : + HasDerivAt (term Ω a (n+1)) (Ω t * term Ω a n t) t := by + apply intervalIntegral.integral_hasDerivAt_right + · exact (hΩ.mul (continuous_term hΩ a n)).intervalIntegrable a t + · exact (hΩ.mul (continuous_term hΩ a n)).stronglyMeasurableAtFilter volume _ + · exact (hΩ.mul (continuous_term hΩ a n)).continuousAt + +def transport (Ω : ℝ → A) (a : ℝ) (N : ℕ) (t : ℝ) : A := + ∑ n∈Finset.range (N+1),term Ω a n t + +omit [CompleteSpace A] in +@[simp] theorem transport_base (Ω : ℝ → A) (a : ℝ) (N : ℕ) : + transport Ω a N a=1 := by + unfold transport + rw [Finset.sum_range_succ'] + simp + +theorem derivative_transport {Ω : ℝ → A} (hΩ : Continuous Ω) (a t : ℝ) (N : ℕ) : + HasDerivAt (transport Ω a (N+1)) (Ω t * transport Ω a N t) t := by + have hf : transport Ω a (N+1) = fun t => 1 + ∑ n∈Finset.range (N+1),term Ω a (n+1) t := by + funext t + simp only [transport,Finset.sum_range_succ',term_zero] + exact add_comm _ _ + have hh := HasDerivAt.fun_sum (u:=Finset.range (N+1)) (fun n _ => derivative_succ hΩ a t n) + have he := (hasDerivAt_const t (1:A)).add hh + have hfun : ((fun _ : ℝ => (1:A)) + fun s => ∑ n∈Finset.range (N+1),term Ω a (n+1) s) = transport Ω a (N+1) := hf.symm + rw [hfun] at he + exact he.congr_deriv (by simp only [zero_add,transport,Finset.mul_sum]) + +omit [CompleteSpace A] in + +theorem continuousOn_term {Ω : ℝ → A} {a b : ℝ} + (hΩ : IntervalIntegrable Ω volume a b) (n : ℕ) : + ContinuousOn (term Ω a n) (uIcc a b) := by + induction n with + | zero => exact continuousOn_const + | succ n ih => + exact intervalIntegral.continuousOn_primitive_interval' (hΩ.mul_continuousOn ih) left_mem_uIcc + +omit [CompleteSpace A] in +theorem continuousOn_transport {Ω : ℝ → A} {a b : ℝ} + (hΩ : IntervalIntegrable Ω volume a b) (N : ℕ) : + ContinuousOn (transport Ω a N) (uIcc a b) := + continuousOn_finsetSum _ (fun n _ => continuousOn_term hΩ n) + +omit [CompleteSpace A] in +theorem collar_limit {Ω : ℝ → A} {a b : ℝ} + (hΩ : IntervalIntegrable Ω volume a b) (N : ℕ) : + Filter.Tendsto (transport Ω a N) (nhdsWithin a (uIcc a b)) (nhds (1:A)) := by + have h := continuousOn_transport hΩ N a left_mem_uIcc + change Filter.Tendsto _ _ (nhds (transport Ω a N a)) at h + simpa only [transport_base] using h + +end + +open MeasureTheory Set intervalIntegral +variable {A : Type*} [NormedRing A] [NormedAlgebra ℝ A] + +theorem integral_mem_submodule [FiniteDimensional ℝ A] (S : Submodule ℝ A) + (f : ℝ → A) (a b : ℝ) (hf : ∀ t, f t ∈ S) : + (∫ t in a..b, f t) ∈ S := by + by_cases hi : IntervalIntegrable f volume a b + · apply (Subspace.forall_mem_dualAnnihilator_apply_eq_zero_iff S _).mp + intro l hl + have hz : ∀ t, l (f t)=0 := fun t => (S.mem_dualAnnihilator l).mp hl _ (hf t) + change l.toContinuousLinearMap (∫ t in a..b, f t)=0 + rw [← l.toContinuousLinearMap.intervalIntegral_comp_comm hi] + change (∫ t in a..b, l (f t))=0 + simp only [hz, intervalIntegral.integral_zero] + · rw [integral_undef hi] + exact S.zero_mem + +structure NilpotentFiltration (A : Type*) [NormedRing A] [NormedAlgebra ℝ A] where + space : ℕ → Submodule ℝ A + antitone : Antitone space + one_mem : (1 : A) ∈ space 0 + mul_mem : ∀ m n {x y : A}, x ∈ space m → y ∈ space n → x*y ∈ space (m+n) + cutoff : ℕ + terminal : space (cutoff+1)=⊥ + +variable [FiniteDimensional ℝ A] + +omit [FiniteDimensional ℝ A] in +theorem pow_mem (F : NilpotentFiltration A) {X : A} (hX : X ∈ F.space 1) (n : ℕ) : + X^n ∈ F.space n := by + induction n with + | zero => simpa using F.one_mem + | succ n ih => simpa only [pow_succ] using F.mul_mem n 1 ih hX + +omit [FiniteDimensional ℝ A] in +theorem pow_cutoff_eq_zero (F : NilpotentFiltration A) {X : A} + (hX : X ∈ F.space 1) : X^(F.cutoff+1)=0 := by + simpa only [F.terminal,Submodule.mem_bot] using pow_mem F hX (F.cutoff+1) + +theorem term_mem (F : NilpotentFiltration A) {Ω : ℝ → A} + (hΩ : ∀ t, Ω t ∈ F.space 1) (a : ℝ) (n : ℕ) (t : ℝ) : + term Ω a n t ∈ F.space n := by + induction n generalizing t with + | zero => exact F.one_mem + | succ n ih => + apply integral_mem_submodule + intro s + simpa only [Nat.add_comm 1 n] using F.mul_mem 1 n (hΩ s) (ih s) + +theorem last_term_zero (F : NilpotentFiltration A) {Ω : ℝ → A} + (hΩ : ∀ t, Ω t ∈ F.space 1) (a t : ℝ) : + term Ω a (F.cutoff+1) t=0 := by + have h := term_mem F hΩ a (F.cutoff+1) t + simpa only [F.terminal,Submodule.mem_bot] using h + +theorem last_product_zero (F : NilpotentFiltration A) {Ω : ℝ → A} + (hΩ : ∀ t, Ω t ∈ F.space 1) (a t : ℝ) : + Ω t * term Ω a F.cutoff t=0 := by + have h := F.mul_mem 1 F.cutoff (hΩ t) (term_mem F hΩ a F.cutoff t) + simpa only [Nat.add_comm 1 F.cutoff,F.terminal,Submodule.mem_bot] using h + +theorem derivative_succ_of_integrable {Ω : ℝ → A} {a b t : ℝ} + (hi : IntervalIntegrable Ω volume a b) (hc : ContinuousOn Ω (Ioo a b)) + (ht : t ∈ Ioo a b) (n : ℕ) : + HasDerivAt (term Ω a (n+1)) (Ω t * term Ω a n t) t := by + have hc' : ∀ x ∈ Ioo a b, ContinuousAt (fun s => Ω s * term Ω a n s) x := by + intro x hx + apply (hc.continuousAt (isOpen_Ioo.mem_nhds hx)).mul + apply (continuousOn_term hi n).continuousAt + rw [uIcc_of_le (le_trans hx.1.le hx.2.le)] + exact Icc_mem_nhds hx.1 hx.2 + apply intervalIntegral.integral_hasDerivAt_right + · exact (hi.mul_continuousOn (continuousOn_term hi n)).mono_set + (uIcc_subset_uIcc_left (by rw [uIcc_of_le (le_trans ht.1.le ht.2.le)]; exact ⟨ht.1.le,ht.2.le⟩)) + · exact ContinuousAt.stronglyMeasurableAtFilter isOpen_Ioo hc' t ht + · exact hc' t ht + +theorem derivative_transport_of_integrable {Ω : ℝ → A} {a b t : ℝ} + (hi : IntervalIntegrable Ω volume a b) (hc : ContinuousOn Ω (Ioo a b)) + (ht : t ∈ Ioo a b) (N : ℕ) : + HasDerivAt (transport Ω a (N+1)) (Ω t * transport Ω a N t) t := by + have hf : transport Ω a (N+1) = fun t => 1 + ∑ n∈Finset.range (N+1),term Ω a (n+1) t := by + funext t + simp only [transport,Finset.sum_range_succ',term_zero] + exact add_comm _ _ + have hh := HasDerivAt.fun_sum (u:=Finset.range (N+1)) + (fun n _ => derivative_succ_of_integrable hi hc ht n) + have he := (hasDerivAt_const t (1:A)).add hh + have hfun : ((fun _ : ℝ => (1:A)) + fun s => ∑ n∈Finset.range (N+1),term Ω a (n+1) s) = transport Ω a (N+1) := hf.symm + rw [hfun] at he + exact he.congr_deriv (by simp only [zero_add,transport,Finset.mul_sum]) + +theorem derivative_nilpotent_transport (F : NilpotentFiltration A) {Ω : ℝ → A} + (hΩ : ∀ s, Ω s ∈ F.space 1) {a b t : ℝ} + (hi : IntervalIntegrable Ω volume a b) (hc : ContinuousOn Ω (Ioo a b)) + (ht : t ∈ Ioo a b) : + HasDerivAt (transport Ω a F.cutoff) (Ω t * transport Ω a F.cutoff t) t := by + have he : transport Ω a (F.cutoff+1)=transport Ω a F.cutoff := by + funext s + simp only [transport,Finset.sum_range_succ,last_term_zero F hΩ,add_zero] + rw [← he] + have hd := derivative_transport_of_integrable hi hc ht F.cutoff + rw [he] at hd + rw [he] + exact hd + +end FinitePicard + +namespace TruncatedWords +open AssociativeElimination WordGrading +variable {R α : Type*} [CommRing R] + +abbrev wt : α → ℕ := fun _ => 1 + +def relations (P : Set (A R α)) (N : ℕ) (x y : A R α) : Prop := + y=0 ∧ (x∈P ∨ x∈above wt (N+1)) + +abbrev Q (P : Set (A R α)) (N : ℕ) := RingQuot (relations P N) + +def quotient (P : Set (A R α)) (N : ℕ) : A R α →ₐ[R] Q P N := + RingQuot.mkAlgHom R (relations P N) + +theorem quotient_relation (P : Set (A R α)) (N : ℕ) {p : A R α} (hp : p∈P) : + quotient P N p=0 := by + have h := RingQuot.mkAlgHom_rel (S:=R) (show relations P N p 0 from ⟨rfl,Or.inl hp⟩) + simpa only [quotient,map_zero] using h + +theorem quotient_above (P : Set (A R α)) (N : ℕ) {p : A R α} + (hp : p∈above wt (N+1)) : quotient P N p=0 := by + have h := RingQuot.mkAlgHom_rel (S:=R) (show relations P N p 0 from ⟨rfl,Or.inr hp⟩) + simpa only [quotient,map_zero] using h + +def filtration (P : Set (A R α)) (N n : ℕ) : Submodule R (Q P N) := + (above wt n).map (quotient P N).toLinearMap + +theorem filtration_antitone (P : Set (A R α)) (N : ℕ) : Antitone (filtration P N) := by + intro m n h + exact Submodule.map_mono (space_mono (fun _ hw => le_trans h hw)) + +theorem filtration_one (P : Set (A R α)) (N : ℕ) : (1 : Q P N)∈filtration P N 0 := by + refine ⟨1,?_,map_one (quotient P N)⟩ + exact word_mem 1 (by simp) + +theorem filtration_mul (P : Set (A R α)) (N m n : ℕ) {x y : Q P N} + (hx : x∈filtration P N m) (hy : y∈filtration P N n) : x*y∈filtration P N (m+n) := by + obtain ⟨a,ha,rfl⟩ := hx + obtain ⟨b,hb,rfl⟩ := hy + exact ⟨a*b,above_mul ha hb,map_mul (quotient P N) _ _⟩ + +theorem filtration_terminal (P : Set (A R α)) (N : ℕ) : filtration P N (N+1)=⊥ := by + apply eq_bot_iff.mpr + rintro x ⟨p,hp,rfl⟩ + exact quotient_above P N hp + +def fromBelow (P : Set (A R α)) (N : ℕ) : below (R:=R) (wt : α → ℕ) N →ₗ[R] Q P N := + (quotient P N).toLinearMap.comp (below wt N).subtype + +theorem fromBelow_surjective (P : Set (A R α)) (N : ℕ) : Function.Surjective (fromBelow P N) := by + classical + intro x + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective R (relations P N) x + refine ⟨⟨project (fun w => degree wt w≤N) p,project_mem _ _⟩,?_⟩ + change quotient P N (project (fun w => degree wt w≤N) p)=quotient P N p + have hh : p-project (fun w => degree wt w≤N) p∈above wt (N+1) := by + apply mem_space + intro w hw + by_contra hn + have hle : degree wt w≤N := by omega + exact hw (by simp only [MonoidAlgebra.coeff_sub,Finsupp.sub_apply,project_coeff,ite_eq_left hle,sub_self]) + have hz := quotient_above P N hh + rw [map_sub] at hz + exact (sub_eq_zero.mp hz).symm + +variable [Finite α] + +theorem finite_words_below (N : ℕ) : {w : FreeMonoid α | degree wt w≤N}.Finite := by + apply Set.Finite.subset ((List.finite_length_le α N).image FreeMonoid.ofList) + intro w hw + exact ⟨w.toList,by simpa [degree] using hw,by simp⟩ + +instance finite_below (N : ℕ) : Module.Finite R (below (R:=R) (wt : α → ℕ) N) := by + let : Fintype {w : FreeMonoid α // degree wt w≤N} := (finite_words_below (α:=α) N).fintype + exact WordCoordinates.finite_space _ + +instance finite_quotient (P : Set (A R α)) (N : ℕ) : Module.Finite R (Q P N) := + Module.Finite.of_surjective (fromBelow P N) (fromBelow_surjective P N) + +variable (P : Set (A ℝ α)) (N : ℕ) + +instance normedRing : NormedRing (Q P N) := FiniteAlgebraNorm.normedRing _ +instance normedAlgebra : NormedAlgebra ℝ (Q P N) := FiniteAlgebraNorm.normedAlgebra _ + +def nilpotentFiltration : FinitePicard.NilpotentFiltration (Q P N) where + space := filtration P N + antitone := filtration_antitone P N + one_mem := filtration_one P N + mul_mem := filtration_mul P N + cutoff := N + terminal := filtration_terminal P N + +end TruncatedWords +end + +namespace TensorFiltration +open scoped TensorProduct +open FinitePicard +variable {R A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B] + + def space (F : ℕ → Submodule R A) (G : ℕ → Submodule R B) (n : ℕ) : Submodule R (A ⊗[R] B) := + Submodule.span R {z | ∃ (i j : ℕ) (a : A) (b : B),n ≤ i + j ∧ a∈F i ∧ b∈G j ∧ z=a⊗ₜ[R]b} + + theorem tmul_mem (F : ℕ → Submodule R A) (G : ℕ → Submodule R B) + {n i j : ℕ} {a : A} {b : B} (hn : n ≤ i + j) (ha : a∈F i) (hb : b∈G j) : + a⊗ₜ[R]b∈space F G n := Submodule.subset_span ⟨i,j,a,b,hn,ha,hb,rfl⟩ + + theorem antitone (F : ℕ → Submodule R A) (G : ℕ → Submodule R B) : Antitone (space F G) := by + intro m n h + apply Submodule.span_mono + rintro z ⟨i,j,a,b,hn,ha,hb,rfl⟩ + exact ⟨i,j,a,b,le_trans h hn,ha,hb,rfl⟩ + + theorem one (F : ℕ → Submodule R A) (G : ℕ → Submodule R B) + (hF : (1:A)∈F 0) (hG : (1:B)∈G 0) : (1:A⊗[R]B)∈space F G 0 := + tmul_mem F G (by omega) hF hG + + theorem mul (F : ℕ → Submodule R A) (G : ℕ → Submodule R B) + (hmF : ∀ i j {a b : A},a∈F i → b∈F j → a*b∈F (i+j)) + (hmG : ∀ i j {a b : B},a∈G i → b∈G j → a*b∈G (i+j)) + {m n : ℕ} {u v : A⊗[R]B} (hu : u∈space F G m) (hv : v∈space F G n) : + u*v∈space F G (m+n) := by + induction hu using Submodule.span_induction with + | mem u hu => + obtain ⟨i,j,a,b,hij,ha,hb,rfl⟩ := hu + induction hv using Submodule.span_induction with + | mem v hv => + obtain ⟨k,l,c,d,hkl,hc,hd,rfl⟩ := hv + rw [Algebra.TensorProduct.tmul_mul_tmul] + exact tmul_mem F G (by omega) (hmF i k ha hc) (hmG j l hb hd) + | zero => simp only [mul_zero,Submodule.zero_mem] + | add v w _ _ hv hw => rw [mul_add]; exact Submodule.add_mem _ hv hw + | smul r v _ hv => rw [Algebra.mul_smul_comm]; exact Submodule.smul_mem _ r hv + | zero => simp only [zero_mul,Submodule.zero_mem] + | add u w _ _ hu hw => rw [add_mul]; exact Submodule.add_mem _ hu hw + | smul r u _ hu => rw [Algebra.smul_mul_assoc]; exact Submodule.smul_mem _ r hu + + theorem terminal (F : ℕ → Submodule R A) (G : ℕ → Submodule R B) + (hF : Antitone F) (hG : Antitone G) (M N : ℕ) (htF : F (M+1)=⊥) (htG : G (N+1)=⊥) : + space F G (M+N+1)=⊥ := by + apply eq_bot_iff.mpr + apply Submodule.span_le.mpr + rintro z ⟨i,j,a,b,hij,ha,hb,rfl⟩ + by_cases hi : M + 1 ≤ i + · have hz := hF hi ha + rw [htF,Submodule.mem_bot] at hz + change a⊗ₜ[R]b=0 + simp only [hz,TensorProduct.zero_tmul] + · have hj : N + 1 ≤ j := by omega + have hz := hG hj hb + rw [htG,Submodule.mem_bot] at hz + change a⊗ₜ[R]b=0 + simp only [hz,TensorProduct.tmul_zero] + + theorem initial (F : ℕ → Submodule R A) (G : ℕ → Submodule R B) + (hF : F 0=⊤) (hG : G 0=⊤) : space F G 0=⊤ := by + apply eq_top_iff.mpr + intro u hu + clear hu + induction u using TensorProduct.inductionOn with + + | tmul a b => exact tmul_mem F G (Nat.zero_le _) (by rw [hF]; trivial) (by rw [hG]; trivial) + | add u v hu hv => exact Submodule.add_mem _ hu hv + +variable {C D : Type*} [NormedRing C] [NormedRing D] [NormedAlgebra ℝ C] [NormedAlgebra ℝ D] + [FiniteDimensional ℝ C] [FiniteDimensional ℝ D] +local instance : NormedRing (C⊗[ℝ]D) := FiniteAlgebraNorm.normedRing _ +local instance : NormedAlgebra ℝ (C⊗[ℝ]D) := FiniteAlgebraNorm.normedAlgebra _ + +def cutoff (F : NilpotentFiltration C) (G : NilpotentFiltration D) : NilpotentFiltration (C⊗[ℝ]D) where + space := space F.space G.space + antitone := antitone F.space G.space + one_mem := one F.space G.space F.one_mem G.one_mem + mul_mem _ _ := mul F.space G.space F.mul_mem G.mul_mem + cutoff := F.cutoff+G.cutoff + terminal := terminal F.space G.space F.antitone G.antitone F.cutoff G.cutoff F.terminal G.terminal + +end TensorFiltration + +namespace TruncatedFree +open AssociativeElimination WordGrading +variable {R α : Type*} [CommRing R] +abbrev wt : α → ℕ := fun _ => 1 +abbrev B (R α : Type*) [CommRing R] (N : ℕ) := below (R:=R) (wt : α → ℕ) N + +def trunc (N : ℕ) : A R α →ₗ[R] B R α N := + (project (fun w => degree wt w≤N)).codRestrict _ (project_mem _) + +@[simp] theorem trunc_val (N : ℕ) (p : A R α) : + (trunc N p).val=project (fun w => degree wt w≤N) p := rfl + +theorem trunc_above (N : ℕ) {p : A R α} (hp : p∈above wt (N+1)) : trunc N p=0 := by + apply Subtype.ext + exact project_eq_zero hp (by intro w hw hh; change N+1≤degree wt w at hw; omega) + +theorem sub_trunc_above (N : ℕ) (p : A R α) : p-(trunc N p).val∈above wt (N+1) := by + apply mem_space + intro w hw + by_contra hn + have hle : degree wt w≤N := by change ¬N+1≤degree wt w at hn; omega + exact hw (by simp only [MonoidAlgebra.coeff_sub,Finsupp.sub_apply,trunc_val,project_coeff,ite_eq_left hle,sub_self]) + +theorem all_ge_zero (p : A R α) : p∈above wt 0 := mem_space (by intros; exact Nat.zero_le _) + +theorem trunc_mul_trunc_right (N : ℕ) (p q : A R α) : + trunc N (p*(trunc N q).val)=trunc N (p*q) := by + have hh : p*(q-(trunc N q).val)∈above wt (N+1) := by + simpa only [Nat.zero_add] using above_mul (all_ge_zero p) (sub_trunc_above N q) + have h := trunc_above N hh + simp only [mul_sub,map_sub] at h + exact (sub_eq_zero.mp h).symm + +theorem trunc_mul_trunc_left (N : ℕ) (p q : A R α) : + trunc N ((trunc N p).val*q)=trunc N (p*q) := by + have hh : (p-(trunc N p).val)*q∈above wt (N+1) := by + simpa only [Nat.add_zero] using above_mul (sub_trunc_above N p) (all_ge_zero q) + have h := trunc_above N hh + simp only [sub_mul,map_sub] at h + exact (sub_eq_zero.mp h).symm + +def action (N : ℕ) : A R α →ₐ[R] Module.End R (B R α N) where + toFun p := + { toFun := fun q => trunc N (p*q.val) + map_add' := by intros; simp only [Submodule.coe_add,mul_add,map_add] + map_smul' := by intros; simp only [SetLike.val_smul,mul_smul_comm,map_smul,RingHom.id_apply] } + map_one' := by + apply LinearMap.ext + intro q + apply Subtype.ext + change (trunc N (1*q.val)).val=q.val + rw [one_mul,trunc_val,project_eq_self q.property] + map_mul' p q := by + apply LinearMap.ext + intro u + apply Subtype.ext + change (trunc N ((p*q)*u.val)).val=(trunc N (p*(trunc N (q*u.val)).val)).val + rw [trunc_mul_trunc_right,mul_assoc] + map_zero' := by ext q; simp + map_add' p q := by ext u; simp only [add_mul,map_add]; rfl + commutes' r := by + apply LinearMap.ext + intro q + apply Subtype.ext + change (trunc N (algebraMap R (A R α) r*q.val)).val=r • q.val + rw [←Algebra.smul_def,map_smul,SetLike.val_smul,trunc_val,project_eq_self q.property] + +def quotientAction (N : ℕ) : TruncatedWords.Q (∅ : Set (A R α)) N →ₐ[R] Module.End R (B R α N) := + RingQuot.liftAlgHom R ⟨action N,by + rintro p q ⟨rfl,hp⟩ + rcases hp with hp|hp + · exact False.elim hp + · apply LinearMap.ext + intro u + apply Subtype.ext + change (trunc N (p*u.val)).val=0 + have h : p*u.val∈above wt (N+1) := by + simpa only [Nat.add_zero] using above_mul hp (all_ge_zero u.val) + rw [trunc_above N h] + rfl⟩ + +def oneVector (N : ℕ) : B R α N := ⟨1,word_mem 1 (by simp)⟩ + +def normal (N : ℕ) : TruncatedWords.Q (∅ : Set (A R α)) N →ₗ[R] B R α N := + (LinearMap.applyₗ (R:=R) (oneVector N)).comp (quotientAction N).toLinearMap + +@[simp] theorem normal_quotient (N : ℕ) (p : A R α) : + normal N (TruncatedWords.quotient ∅ N p)=trunc N p := by + change (quotientAction N (RingQuot.mkAlgHom R _ p)) (oneVector N)=_ + simp only [quotientAction,RingQuot.liftAlgHom_mkAlgHom_apply] + change trunc N (p*1)=_ + rw [mul_one] + +theorem normal_inverse (N : ℕ) (p : B R α N) : + normal N (TruncatedWords.fromBelow ∅ N p)=p := by + change normal N (TruncatedWords.quotient ∅ N p.val)=p + rw [normal_quotient] + exact Subtype.ext (project_eq_self p.property) + +def equiv (N : ℕ) : TruncatedWords.Q (∅ : Set (A R α)) N ≃ₗ[R] B R α N where + __ := normal N + invFun := TruncatedWords.fromBelow ∅ N + left_inv := by + intro q + obtain ⟨p,rfl⟩ := TruncatedWords.fromBelow_surjective ∅ N q + change TruncatedWords.fromBelow ∅ N (normal N (TruncatedWords.fromBelow ∅ N p))=_ + rw [normal_inverse] + right_inv := normal_inverse N + +@[simp] theorem equiv_eq_normal (N : ℕ) : (equiv (R:=R) (α:=α) N).toLinearMap=normal N := rfl + +def coefficient (N : ℕ) (w : FreeMonoid α) : TruncatedWords.Q (∅ : Set (A R α)) N →ₗ[R] R := + (Finsupp.lapply w).comp ((MonoidAlgebra.coeffLinearEquiv R).toLinearMap.comp + ((B R α N).subtype.comp (normal N))) + +@[simp] theorem coefficient_quotient (N : ℕ) (w : FreeMonoid α) (p : A R α) : + coefficient N w (TruncatedWords.quotient ∅ N p)=if degree wt w≤N then p.coeff w else 0 := by + change (normal N (TruncatedWords.quotient ∅ N p)).val.coeff w=_ + rw [normal_quotient,trunc_val,project_coeff] + +end TruncatedFree + +namespace FilteredComparison +variable {R V W : Type*} [CommRing R] [AddCommGroup V] [Module R V] + [AddCommGroup W] [Module R W] + +structure Filtration (R V : Type*) [CommRing R] [AddCommGroup V] [Module R V] (N : ℕ) where + step : ℕ → Submodule R V + decreasing : Antitone step + initial : step 0=⊤ + terminal : step (N+1)=⊥ + +variable {N : ℕ} (F : Filtration R V N) (G : Filtration R W N) + (f : V →ₗ[R] W) + +def Preserves : Prop := ∀ n v,v∈F.step n → f v∈G.step n + +def GrInjective : Prop := ∀ n v,v∈F.step n → f v∈G.step (n+1) → v∈F.step (n+1) + +def GrSurjective : Prop := ∀ n w,w∈G.step n → ∃ v,v∈F.step n ∧ w-f v∈G.step (n+1) + +theorem injective (h : GrInjective F G f) : Function.Injective f := by + apply LinearMap.ker_eq_bot.mp + apply eq_bot_iff.mpr + intro v hv + have hz : f v=0 := hv + have hm : ∀ n,v∈F.step n := by + intro n + induction n with + | zero => rw [F.initial]; trivial + | succ n ih => exact h n v ih (by rw [hz]; exact Submodule.zero_mem _) + simpa only [F.terminal,Submodule.mem_bot] using hm (N+1) + +theorem lift_step (h : GrSurjective F G f) (n k : ℕ) (w : W) (hw : w∈G.step n) : + ∃ v,v∈F.step n ∧ w-f v∈G.step (n+k) := by + induction k with + | zero => exact ⟨0,Submodule.zero_mem _,by simpa only [map_zero,sub_zero,Nat.add_zero] using hw⟩ + | succ k ih => + obtain ⟨v,hv,he⟩ := ih + obtain ⟨u,hu,hr⟩ := h (n+k) (w-f v) he + refine ⟨v+u,(F.step n).add_mem hv (F.decreasing (Nat.le_add_right n k) hu),?_⟩ + convert hr using 1; first | congr 1 <;> omega | rw [map_add]; abel + +theorem surjective (h : GrSurjective F G f) : Function.Surjective f := by + intro w + obtain ⟨v,_,hv⟩ := lift_step F G f h 0 (N+1) w (by rw [G.initial]; trivial) + simp only [zero_add,G.terminal,Submodule.mem_bot,sub_eq_zero] at hv + exact ⟨v,hv.symm⟩ + +def equivalence (hi : GrInjective F G f) (hs : GrSurjective F G f) : V ≃ₗ[R] W := + LinearEquiv.ofBijective f ⟨injective F G f hi,surjective F G f hs⟩ + +theorem inverse_preserves (hi : GrInjective F G f) (hs : GrSurjective F G f) + (n : ℕ) (w : W) (hw : w∈G.step n) : (equivalence F G f hi hs).symm w∈F.step n := by + have hn : ∀ k≤n,(equivalence F G f hi hs).symm w∈F.step k := by + intro k + induction k with + | zero => intro _; rw [F.initial]; trivial + | succ k ih => + intro hk + apply hi k _ (ih (by omega)) + change (equivalence F G f hi hs) ((equivalence F G f hi hs).symm w)∈_ + rw [LinearEquiv.apply_symm_apply] + exact G.decreasing hk hw + exact hn n le_rfl + +theorem comparison_raises (g : V →ₗ[R] W) + (hi : GrInjective F G f) (hs : GrSurjective F G f) + (he : ∀ n v,v∈F.step n → g v-f v∈G.step (n+1)) + (n : ℕ) (w : W) (hw : w∈G.step n) : + g ((equivalence F G f hi hs).symm w)-w∈G.step (n+1) := by + have h := he n _ (inverse_preserves F G f hi hs n w hw) + have hf : f ((equivalence F G f hi hs).symm w)=w := + (equivalence F G f hi hs).apply_symm_apply w + rwa [hf] at h + +end FilteredComparison + +namespace TruncatedSubstitution +open AssociativeElimination WordGrading TruncatedWords +variable {R α : Type*} [CommRing R] (N : ℕ) +local notation "Q" => TruncatedWords.Q (∅ : Set (A R α)) N +local notation "F" => filtration (∅ : Set (A R α)) N + +def gen (a : α) : Q := quotient ∅ N (atom a) + +theorem gen_mem (a : α) : gen N a∈F 1 := + ⟨atom a,word_mem (FreeMonoid.of a) (by simp [wt]),rfl⟩ + +theorem lift_word_mem (f : α → Q) (hf : ∀ a,f a∈F 1) (w : FreeMonoid α) : + lift (R:=R) f (word w)∈F (degree wt w) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa only [word_one,map_one,degree_one] using filtration_one (∅ : Set (A R α)) N + | of_mul a w ih => + rw [word_mul,word_of,map_mul,lift_atom,degree_mul,degree_of] + exact filtration_mul ∅ N 1 _ (hf a) ih + +theorem lift_mem (f : α → Q) (hf : ∀ a,f a∈F 1) {n : ℕ} {p : A R α} + (hp : p∈above wt n) : lift (R:=R) f p∈F n := + map_space (lift (R:=R) f).toLinearMap _ (fun w hw => filtration_antitone ∅ N hw (lift_word_mem N f hf w)) hp + +def subst (f : α → Q) (hf : ∀ a,f a∈F 1) : Q →ₐ[R] Q := + RingQuot.liftAlgHom R ⟨lift (R:=R) f,by + rintro p q ⟨rfl,hp⟩ + rcases hp with hp|hp + · exact False.elim hp + · simpa only [filtration_terminal,Submodule.mem_bot,map_zero] using lift_mem N f hf hp⟩ + +@[simp] theorem subst_quotient (f : α → Q) (hf : ∀ a,f a∈F 1) (p : A R α) : + subst N f hf (quotient ∅ N p)=lift (R:=R) f p := by + simp only [subst,quotient,RingQuot.liftAlgHom_mkAlgHom_apply] + +@[simp] theorem subst_gen (f : α → Q) (hf : ∀ a,f a∈F 1) (a : α) : + subst N f hf (gen N a)=f a := by rw [gen,subst_quotient,lift_atom] + +theorem subst_preserves (f : α → Q) (hf : ∀ a,f a∈F 1) (n : ℕ) (u : Q) + (hu : u∈F n) : subst N f hf u∈F n := by + obtain ⟨p,hp,rfl⟩ := hu + change subst N f hf (quotient ∅ N p)∈_ + rw [subst_quotient] + exact lift_mem N f hf hp + +theorem lift_word_difference (f g : α → Q) (hf : ∀ a,f a∈F 1) (hg : ∀ a,g a∈F 1) + (hd : ∀ a,f a-g a∈F 2) (w : FreeMonoid α) : + lift (R:=R) f (word w)-lift (R:=R) g (word w)∈F (degree wt w+1) := by + induction w using FreeMonoid.inductionOn' with + | one => simp + | of_mul a w ih => + rw [word_mul,word_of,map_mul,map_mul,lift_atom,lift_atom,degree_mul,degree_of] + have he : f a*lift (R:=R) f (word w)-g a*lift (R:=R) g (word w)= + (f a-g a)*lift (R:=R) g (word w)+f a*(lift (R:=R) f (word w)-lift (R:=R) g (word w)) := by + rw [sub_mul,mul_sub] + abel + rw [he] + exact (F (1+degree wt w+1)).add_mem + (by + simpa only [show 1+degree wt w+1=2+degree wt w by omega] using filtration_mul ∅ N 2 _ (hd a) (lift_word_mem N g hg w)) + (by simpa only [Nat.add_assoc] using filtration_mul ∅ N 1 _ (hf a) ih) + +theorem lift_difference (f g : α → Q) (hf : ∀ a,f a∈F 1) (hg : ∀ a,g a∈F 1) + (hd : ∀ a,f a-g a∈F 2) {n : ℕ} {p : A R α} (hp : p∈above wt n) : + lift (R:=R) f p-lift (R:=R) g p∈F (n+1) := + map_space ((lift (R:=R) f).toLinearMap-(lift (R:=R) g).toLinearMap) _ (fun w hw => + filtration_antitone ∅ N (Nat.add_le_add_right hw 1) (lift_word_difference N f g hf hg hd w)) hp + +@[simp] theorem lift_gen : lift (R:=R) (gen (R:=R) (α:=α) N)=quotient ∅ N := by + apply hom_ext + intro a + simp only [lift_atom,gen] + +theorem subst_raises (f : α → Q) (hf : ∀ a,f a∈F 1) (hd : ∀ a,f a-gen N a∈F 2) + (n : ℕ) (u : Q) (hu : u∈F n) : subst N f hf u-u∈F (n+1) := by + obtain ⟨p,hp,rfl⟩ := hu + change subst N f hf (quotient ∅ N p)-quotient ∅ N p∈_ + rw [subst_quotient] + simpa only [lift_gen] using lift_difference N f (gen N) hf (gen_mem N) hd hp + +theorem filtration_initial : F 0=⊤ := by + apply eq_top_iff.mpr + intro u _ + obtain ⟨p,rfl⟩ := RingQuot.mkAlgHom_surjective R (relations (∅ : Set (A R α)) N) u + exact ⟨p,TruncatedFree.all_ge_zero p,rfl⟩ + +def filtered : FilteredComparison.Filtration R Q N where + step := F + decreasing := filtration_antitone ∅ N + initial := filtration_initial N + terminal := filtration_terminal ∅ N + +theorem subst_bijective (f : α → Q) (hf : ∀ a,f a∈F 1) (hd : ∀ a,f a-gen N a∈F 2) : + Function.Bijective (subst N f hf) := by + have hi : FilteredComparison.GrInjective (filtered N) (filtered N) (subst N f hf).toLinearMap := by + intro n u hu he + change subst N f hf u∈F (n+1) at he + change u∈F (n+1) + have hh := (F (n+1)).sub_mem he (subst_raises N f hf hd n u hu) + simpa only [sub_sub_cancel] using hh + have hs : FilteredComparison.GrSurjective (filtered N) (filtered N) (subst N f hf).toLinearMap := by + intro n u hu + refine ⟨u,hu,?_⟩ + change u-subst N f hf u∈F (n+1) + simpa only [neg_sub] using (F (n+1)).neg_mem (subst_raises N f hf hd n u hu) + exact ⟨FilteredComparison.injective _ _ _ hi,FilteredComparison.surjective _ _ _ hs⟩ + +def equiv (f : α → Q) (hf : ∀ a,f a∈F 1) (hd : ∀ a,f a-gen N a∈F 2) : Q ≃ₐ[R] Q := + AlgEquiv.ofBijective (subst N f hf) (subst_bijective N f hf hd) + +end TruncatedSubstitution + +namespace NilpotentFreeLift +open AssociativeElimination WordGrading TruncatedWords FinitePicard +variable {α B : Type*} [NormedRing B] [NormedAlgebra ℝ B] +variable (F : NilpotentFiltration B) (f : α → B) (hf : ∀ a,f a∈F.space 1) +include hf + theorem lift_word_mem (w : FreeMonoid α) : lift (R:=ℝ) f (word w)∈F.space (degree wt w) := by + induction w using FreeMonoid.inductionOn' with + | one => simpa only [word_one,map_one,degree_one] using F.one_mem + | of_mul a w ih => + rw [word_mul,word_of,map_mul,lift_atom,degree_mul,degree_of] + exact F.mul_mem 1 _ (hf a) ih + theorem lift_mem {n : ℕ} {p : A ℝ α} (hp : p∈above wt n) : lift (R:=ℝ) f p∈F.space n := + map_space (lift (R:=ℝ) f).toLinearMap _ (fun w hw => F.antitone hw (lift_word_mem F f hf w)) hp + def eval : Q (∅ : Set (A ℝ α)) F.cutoff →ₐ[ℝ] B := + RingQuot.liftAlgHom ℝ ⟨lift (R:=ℝ) f,by + rintro p q ⟨rfl,hp⟩ + rcases hp with hp|hp + · exact False.elim hp + · simpa only [F.terminal,Submodule.mem_bot,map_zero] using lift_mem F f hf hp⟩ + @[simp] theorem eval_quotient (p : A ℝ α) : eval F f hf (quotient ∅ F.cutoff p)=lift (R:=ℝ) f p := by + simp only [eval,quotient,RingQuot.liftAlgHom_mkAlgHom_apply] + @[simp] theorem eval_gen (a : α) : eval F f hf (TruncatedSubstitution.gen F.cutoff a)=f a := by + rw [TruncatedSubstitution.gen,eval_quotient,lift_atom] + theorem eval_preserves {n : ℕ} {p : Q (∅ : Set (A ℝ α)) F.cutoff} + (hp : p∈filtration ∅ F.cutoff n) : eval F f hf p∈F.space n := by + obtain ⟨p,hp,rfl⟩ := hp + change eval F f hf (quotient ∅ F.cutoff p)∈_ + rw [eval_quotient] + exact lift_mem F f hf hp +end NilpotentFreeLift + +end DeligneDrinfeld + +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/AdicSystems.lean b/lean/OAI/Algebra/FiniteTensor/AdicSystems.lean new file mode 100644 index 0000000000000000000000000000000000000000..00bfd5590599e96f1e6581f84ceddac9d9d902bf --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/AdicSystems.lean @@ -0,0 +1,520 @@ +import Mathlib + +namespace OAI + +/-! Quadratic remainders, adic contraction and Tougeron corrections. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +open MvPolynomial +variable {R σ : Type*} [CommRing R] [Fintype σ] [DecidableEq σ] + +def mvShift (a : σ → R) : MvPolynomial σ R →ₐ[R] MvPolynomial σ R := + aeval (fun i=>C (a i)+X i) + +def mvLinearPart (a : σ → R) (f : MvPolynomial σ R) : MvPolynomial σ R := + ∑ i : σ,C (eval a (pderiv i f))*X i + +def mvRemainder (a : σ → R) (f : MvPolynomial σ R) : MvPolynomial σ R := + mvShift a f-C (eval a f)-mvLinearPart a f + +private theorem mvLinearPart_mul_X (a : σ → R) (f : MvPolynomial σ R) (k : σ) : + mvLinearPart a (f*X k)=mvLinearPart a f*C (a k)+C (eval a f)*X k := by + simp only [mvLinearPart,pderiv_mul,map_add,map_mul,eval_X,add_mul, + Finset.sum_add_distrib] + congr 1 + · rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i hi + ring + · rw [Finset.sum_eq_single k] + · simp + · intro i hi hik + simp [pderiv_X,Ne.symm hik] + · simp + +private theorem mvRemainder_mul_X (a : σ → R) (f : MvPolynomial σ R) (k : σ) : + mvRemainder a (f*X k)=mvRemainder a f*(C (a k)+X k)+mvLinearPart a f*X k := by + rw [mvRemainder,mvRemainder,mvLinearPart_mul_X] + simp only [map_mul,eval_X,mvShift,aeval_X] + ring + +private theorem mvRemainder_mem (a : σ → R) (f : MvPolynomial σ R) : + mvRemainder a f ∈ Ideal.span (Set.range (fun ij : σ×σ=>(X ij.1*X ij.2 : MvPolynomial σ R))) := by + let J : Ideal (MvPolynomial σ R) := Ideal.span (Set.range (fun ij : σ×σ=>X ij.1*X ij.2)) + change mvRemainder a f∈J + induction f using MvPolynomial.induction_on with + | C r => + have h : mvRemainder a (C r)=0 := by + simp only [mvRemainder,mvShift,aeval_C,eval_C,mvLinearPart,pderiv_C, + map_zero,zero_mul,Finset.sum_const_zero,sub_zero] + change C r-C r=0 + exact sub_self _ + rw [h] + exact J.zero_mem + | add f g hf hg => + have h : mvRemainder a (f+g)=mvRemainder a f+mvRemainder a g := by + simp only [mvRemainder,map_add,mvLinearPart,map_add,add_mul,Finset.sum_add_distrib] + ring + rw [h] + exact J.add_mem hf hg + | mul_X f k hf => + rw [mvRemainder_mul_X] + apply J.add_mem (J.mul_mem_right _ hf) + rw [mvLinearPart,Finset.sum_mul] + apply J.sum_mem + intro i hi + have h : X i*X k∈J := Ideal.subset_span (Set.mem_range_self (i,k)) + simpa only [mul_assoc] using J.mul_mem_left (C (eval a (pderiv i f))) h + + +theorem mv_polynomial_quadratic_remainder (f : MvPolynomial σ R) (a : σ → R) : + ∃ q : σ → σ → MvPolynomial σ R, + mvShift a f=C (eval a f)+mvLinearPart a f+ + ∑ i : σ,∑ j : σ,X i*X j*q i j := by + obtain ⟨q,hq⟩ := Ideal.mem_span_range_iff_exists_fun.mp (mvRemainder_mem a f) + refine ⟨fun i j=>q (i,j),?_⟩ + have he : (∑ i : σ,∑ j : σ,X i*X j*q (i,j))=mvRemainder a f := by + rw [←Finset.sum_product'] + rw [Finset.univ_product_univ] + calc + _ = ∑ ij : σ×σ,q ij*(X ij.1*X ij.2) := by + apply Finset.sum_congr rfl + intro ij hij + cases ij + exact mul_comm _ _ + _ = _ := hq + rw [he,mvRemainder] + ring + + + +theorem mv_eval_quadratic_remainder (f : MvPolynomial σ R) (a : σ → R) : + ∃ q : σ → σ → MvPolynomial σ R,∀ h : σ → R, + eval (a+h) f=eval a f+(∑ i : σ,eval a (pderiv i f)*h i)+ + ∑ i : σ,∑ j : σ,h i*h j*eval h (q i j) := by + obtain ⟨q,hq⟩ := mv_polynomial_quadratic_remainder f a + refine ⟨q,?_⟩ + intro h + have he := congrArg (eval h) hq + have hshift : eval h (mvShift a f)=eval (a+h) f := by + have hh : (eval h).comp (mvShift a).toRingHom=eval (a+h) := by + apply MvPolynomial.ringHom_ext + · intro r + simp only [RingHom.comp_apply,mvShift,AlgHom.toRingHom_eq_coe, + AlgHom.coe_toRingHom,aeval_C,algebraMap_eq,eval_C] + · intro i + change eval h ((aeval (fun i=>C (a i)+X i)) (X i)) = _ + simp only [aeval_X,map_add,eval_C,eval_X,Pi.add_apply] + exact RingHom.congr_fun hh f + simpa only [hshift,map_add,map_sum,map_mul,eval_C,eval_X,mvLinearPart] + using he + +end +end PD4Tensor.Spreading + + + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +open MvPolynomial +variable {R σ : Type*} [CommRing R] [Fintype σ] [DecidableEq σ] + + +omit [Fintype σ] [DecidableEq σ] in +theorem mv_eval_sub_mem (J : Ideal R) (f : MvPolynomial σ R) (u v : σ → R) + (h : ∀ i,u i-v i∈J) : eval u f-eval v f∈J := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_sub,sub_eq_zero] + have he : (Ideal.Quotient.mk J).comp (eval u)=(Ideal.Quotient.mk J).comp (eval v) := by + apply MvPolynomial.ringHom_ext + · intro r + simp + · intro i + simp only [RingHom.comp_apply,eval_X] + exact sub_eq_zero.mp ((map_sub _ _ _).symm.trans (Ideal.Quotient.eq_zero_iff_mem.mpr (h i))) + exact RingHom.congr_fun he f + + +omit [DecidableEq σ] in +theorem mv_quadratic_sub_mem (I : Ideal R) (n : ℕ) + (q : σ → σ → MvPolynomial σ R) (u v : σ → R) + (hu : ∀i,u i∈I) (hv : ∀i,v i∈I) (h : ∀i,u i-v i∈I^n) : + (∑ i : σ,∑ j : σ,u i*u j*eval u (q i j))- + (∑ i : σ,∑ j : σ,v i*v j*eval v (q i j))∈I^(n+1) := by + rw [←Finset.sum_sub_distrib] + apply Ideal.sum_mem + intro i hi + rw [←Finset.sum_sub_distrib] + apply Ideal.sum_mem + intro j hj + have he : u i*u j*eval u (q i j)-v i*v j*eval v (q i j)= + (u i-v i)*u j*eval u (q i j)+ + v i*(u j-v j)*eval u (q i j)+ + v i*v j*(eval u (q i j)-eval v (q i j)) := by ring + rw [he] + apply Ideal.add_mem + · apply Ideal.add_mem + · apply Ideal.mul_mem_right + rw [pow_succ] + exact Ideal.mul_mem_mul (h i) (hu j) + · apply Ideal.mul_mem_right + rw [pow_succ'] + exact Ideal.mul_mem_mul (hv i) (h j) + · rw [mul_assoc] + apply Ideal.mul_mem_left + rw [pow_succ'] + exact Ideal.mul_mem_mul (hv j) (mv_eval_sub_mem _ _ _ _ h) + + + +omit [DecidableEq σ] in +theorem adic_quadratic_system (I : Ideal R) [IsAdicComplete I R] + (e : σ → R) (he : ∀i,e i∈I) (q : σ → σ → σ → MvPolynomial σ R) : + ∃ z : σ → R,(∀i,z i∈I) ∧ ∀k, + e k+z k+∑ i : σ,∑ j : σ,z i*z j*eval z (q k i j)=0 := by + let Q (z : σ → R) (k : σ) : R := ∑ i : σ,∑ j : σ,z i*z j*eval z (q k i j) + let c : ℕ → σ → R := fun n=>Nat.recOn n 0 (fun _ z k=>-e k-Q z k) + have hc (n : ℕ) (k : σ) : c (n+1) k=-e k-Q (c n) k := rfl + have hmem : ∀ n k,c n k∈I := by + intro n + induction n with + | zero => intro k; exact I.zero_mem + | succ n ih => + intro k + rw [hc] + apply I.sub_mem (I.neg_mem (he k)) + apply I.sum_mem + intro i hi + apply I.sum_mem + intro j hj + exact I.mul_mem_right _ (I.mul_mem_right _ (ih i)) + have hstep : ∀ n k,c (n+1) k-c n k∈I^(n+1) := by + intro n + induction n with + | zero => + intro k + simpa only [Nat.zero_add,pow_one,show c 0 k=0 from rfl,sub_zero] using hmem 1 k + | succ n ih => + intro k + rw [hc (n+1),hc n] + have hh := mv_quadratic_sub_mem I (n+1) (q k) (c (n+1)) (c n) + (hmem (n+1)) (hmem n) ih + have heq : -e k-Q (c (n+1)) k-(-e k-Q (c n) k)= + -(Q (c (n+1)) k-Q (c n) k) := by ring + rw [heq] + exact (I^((n+1)+1)).neg_mem hh + have hdiff : ∀ m n,m ≤ n → ∀k,c m k-c n k∈I^m := by + intro m n hmn + obtain ⟨l,rfl⟩ := Nat.exists_eq_add_of_le hmn + induction l with + | zero => intro k; simp only [add_zero,sub_self]; exact Ideal.zero_mem _ + | succ l ih => + intro k + have ha := Ideal.pow_le_pow_right (by omega : m ≤ m+l+1) (hstep (m+l) k) + have hb := (I^m).sub_mem (ih (by omega) k) ha + convert hb using 1 + simp only [Nat.add_assoc] + ring + have hex : ∀k,∃z : R,∀n,c n k-z∈I^n := by + intro k + obtain ⟨z,hz⟩ := IsPrecomplete.prec' (I:=I) (fun n=>c n k) (by + intro m n hmn + rw [←Ideal.one_eq_top,Ideal.smul_eq_mul,mul_one] + exact SModEq.sub_mem.mpr (hdiff m n hmn k)) + refine ⟨z,?_⟩ + intro n + specialize hz n + rw [←Ideal.one_eq_top,Ideal.smul_eq_mul,mul_one] at hz + exact SModEq.sub_mem.mp hz + choose z hz using hex + have hzi (k : σ) : z k∈I := by + have hh := hz k 1 + rw [pow_one] at hh + have h := I.sub_mem (hmem 1 k) hh + simpa only [sub_sub_cancel] using h + refine ⟨z,hzi,?_⟩ + intro k + apply IsHausdorff.haus' (I:=I) + intro n + rw [←Ideal.one_eq_top,Ideal.smul_eq_mul,mul_one,SModEq.zero] + have hq := mv_quadratic_sub_mem I n (q k) (c n) z (hmem n) hzi (fun i=>hz i n) + have hqn : Q (c n) k-Q z k∈I^n := + Ideal.pow_le_pow_right (by omega : n ≤ n+1) hq + have hcn : c (n+1) k-z k∈I^n := + Ideal.pow_le_pow_right (by omega : n ≤ n+1) (hz k (n+1)) + have hh := (I^n).neg_mem ((I^n).add_mem hcn hqn) + rw [hc] at hh + convert hh using 1 + dsimp only [Q] + ring + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +open MvPolynomial +variable {R σ : Type*} [CommRing R] [Fintype σ] [DecidableEq σ] + + + +omit [Fintype σ] [DecidableEq σ] in +theorem adic_contractive_system (I : Ideal R) [IsAdicComplete I R] + (e : σ → R) (he : ∀ i,e i∈I) (Q : (σ → R) → σ → R) + (hQI : ∀ z,(∀ i,z i∈I) → ∀ k,Q z k∈I) + (hQC : ∀ n u v,(∀ i,u i∈I) → (∀ i,v i∈I) → + (∀ i,u i-v i∈I^n) → ∀ k,Q u k-Q v k∈I^(n+1)) : + ∃ z : σ → R,(∀ i,z i∈I) ∧ ∀ k,e k+z k+Q z k=0 := by + let c : ℕ → σ → R := fun n=>Nat.recOn n 0 (fun _ z k=>-e k-Q z k) + have hc (n : ℕ) (k : σ) : c (n+1) k=-e k-Q (c n) k := rfl + have hmem : ∀ n k,c n k∈I := by + intro n + induction n with + | zero => intro k; exact I.zero_mem + | succ n ih => + intro k + rw [hc] + apply I.sub_mem (I.neg_mem (he k)) + exact hQI (c n) ih k + have hstep : ∀ n k,c (n+1) k-c n k∈I^(n+1) := by + intro n + induction n with + | zero => + intro k + simpa only [Nat.zero_add,pow_one,show c 0 k=0 from rfl,sub_zero] using hmem 1 k + | succ n ih => + intro k + rw [hc (n+1),hc n] + have hh := hQC (n+1) (c (n+1)) (c n) (hmem (n+1)) (hmem n) ih k + have heq : -e k-Q (c (n+1)) k-(-e k-Q (c n) k)= + -(Q (c (n+1)) k-Q (c n) k) := by ring + rw [heq] + exact (I^((n+1)+1)).neg_mem hh + have hdiff : ∀ m n,m ≤ n → ∀k,c m k-c n k∈I^m := by + intro m n hmn + obtain ⟨l,rfl⟩ := Nat.exists_eq_add_of_le hmn + induction l with + | zero => intro k; simp only [add_zero,sub_self]; exact Ideal.zero_mem _ + | succ l ih => + intro k + have ha := Ideal.pow_le_pow_right (by omega : m ≤ m+l+1) (hstep (m+l) k) + have hb := (I^m).sub_mem (ih (by omega) k) ha + convert hb using 1 + simp only [Nat.add_assoc] + ring + have hex : ∀k,∃z : R,∀n,c n k-z∈I^n := by + intro k + obtain ⟨z,hz⟩ := IsPrecomplete.prec' (I:=I) (fun n=>c n k) (by + intro m n hmn + rw [←Ideal.one_eq_top,Ideal.smul_eq_mul,mul_one] + exact SModEq.sub_mem.mpr (hdiff m n hmn k)) + refine ⟨z,?_⟩ + intro n + specialize hz n + rw [←Ideal.one_eq_top,Ideal.smul_eq_mul,mul_one] at hz + exact SModEq.sub_mem.mp hz + choose z hz using hex + have hzi (k : σ) : z k∈I := by + have hh := hz k 1 + rw [pow_one] at hh + have h := I.sub_mem (hmem 1 k) hh + simpa only [sub_sub_cancel] using h + refine ⟨z,hzi,?_⟩ + intro k + apply IsHausdorff.haus' (I:=I) + intro n + rw [←Ideal.one_eq_top,Ideal.smul_eq_mul,mul_one,SModEq.zero] + have hq := hQC n (c n) z (hmem n) hzi (fun i=>hz i n) k + have hqn : Q (c n) k-Q z k∈I^n := + Ideal.pow_le_pow_right (by omega : n ≤ n+1) hq + have hcn : c (n+1) k-z k∈I^n := + Ideal.pow_le_pow_right (by omega : n ≤ n+1) (hz k (n+1)) + have hh := (I^n).neg_mem ((I^n).add_mem hcn hqn) + rw [hc] at hh + convert hh using 1 + ring + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators Matrix +open MvPolynomial +variable {R σ : Type*} [CommRing R] [Fintype σ] [DecidableEq σ] + +omit [DecidableEq σ] in +theorem mv_quadratic_mixed_sub_mem (I : Ideal R) (n : ℕ) + (q : σ → σ → MvPolynomial σ R) (u v u' v' : σ → R) + (hu : ∀i,u i∈I) (hv : ∀i,v i∈I) (h : ∀i,u i-v i∈I^n) (h' : ∀i,u' i-v' i∈I^n) : + (∑ i : σ,∑ j : σ,u i*u j*eval u' (q i j))- + (∑ i : σ,∑ j : σ,v i*v j*eval v' (q i j))∈I^(n+1) := by + rw [←Finset.sum_sub_distrib] + apply Ideal.sum_mem + intro i hi + rw [←Finset.sum_sub_distrib] + apply Ideal.sum_mem + intro j hj + have he : u i*u j*eval u' (q i j)-v i*v j*eval v' (q i j)= + (u i-v i)*u j*eval u' (q i j)+ + v i*(u j-v j)*eval u' (q i j)+ + v i*v j*(eval u' (q i j)-eval v' (q i j)) := by ring + rw [he] + apply Ideal.add_mem + · apply Ideal.add_mem + · apply Ideal.mul_mem_right + rw [pow_succ] + exact Ideal.mul_mem_mul (h i) (hu j) + · apply Ideal.mul_mem_right + rw [pow_succ'] + exact Ideal.mul_mem_mul (hv i) (h j) + · rw [mul_assoc] + apply Ideal.mul_mem_left + rw [pow_succ'] + exact Ideal.mul_mem_mul (hv j) (mv_eval_sub_mem _ _ _ _ h') + +omit [DecidableEq σ] in +private theorem mulVec_mem_ideal (I : Ideal R) (A : Matrix σ σ R) (z : σ → R) + (hz : ∀ i,z i∈I) (k : σ) : (A*ᵥz) k∈I := by + apply I.sum_mem + intro i hi + exact I.mul_mem_left _ (hz i) + +omit [DecidableEq σ] in +private theorem mulVec_sub_mem_ideal (I : Ideal R) (A : Matrix σ σ R) (u v : σ → R) + (h : ∀ i,u i-v i∈I) (k : σ) : (A*ᵥu) k-(A*ᵥv) k∈I := by + rw [←Pi.sub_apply,←Matrix.mulVec_sub] + exact mulVec_mem_ideal I A (u-v) h k + + + +theorem mv_tougeron_correction (I : Ideal R) [IsAdicComplete I R] + (f : σ → MvPolynomial σ R) (a e : σ → R) + (he : ∀ k,e k∈I) + (hf : ∀ k,eval a (f k)= + (Matrix.det (fun k i=>eval a (pderiv i (f k))))^2*e k) : + ∃ b : σ → R,(∀ k,eval b (f k)=0) ∧ ∀ i,∃ v∈I, + b i=a i+(Matrix.det (fun k i=>eval a (pderiv i (f k))))*v := by + let J : Matrix σ σ R := fun k i=>eval a (pderiv i (f k)) + let δ : R := J.det + let A : Matrix σ σ R := J.adjugate + choose q hq using fun k=>mv_eval_quadratic_remainder (f k) a + let Q (z : σ → R) (k : σ) : R := + ∑ i : σ,∑ j : σ,(A*ᵥz) i*(A*ᵥz) j*eval (δ • (A*ᵥz)) (q k i j) + have hQI (z : σ → R) (hz : ∀ i,z i∈I) (k : σ) : Q z k∈I := by + apply I.sum_mem + intro i hi + apply I.sum_mem + intro j hj + exact I.mul_mem_right _ (I.mul_mem_right _ (mulVec_mem_ideal I A z hz i)) + have hQC (n : ℕ) (u v : σ → R) (hu : ∀ i,u i∈I) (hv : ∀ i,v i∈I) + (huv : ∀ i,u i-v i∈I^n) (k : σ) : Q u k-Q v k∈I^(n+1) := by + apply mv_quadratic_mixed_sub_mem I n (q k) (A*ᵥu) (A*ᵥv) + (δ • (A*ᵥu)) (δ • (A*ᵥv)) + (mulVec_mem_ideal I A u hu) (mulVec_mem_ideal I A v hv) + (mulVec_sub_mem_ideal (I^n) A u v huv) + intro i + simpa only [Pi.smul_apply,smul_eq_mul,mul_sub] using + (I^n).mul_mem_left δ (mulVec_sub_mem_ideal (I^n) A u v huv i) + obtain ⟨z,hz,hroot⟩ := adic_contractive_system I e he Q hQI hQC + let h : σ → R := δ • (A*ᵥz) + have hlin : J*ᵥh=δ^2 • z := by + dsimp only [h,A] + rw [Matrix.mulVec_smul,Matrix.mulVec_mulVec,Matrix.mul_adjugate, + Matrix.smul_mulVec,Matrix.one_mulVec,smul_smul] + simp only [δ,pow_two] + refine ⟨a+h,?_,?_⟩ + · intro k + rw [hq k h,hf k] + have hl : (∑ i : σ,eval a (pderiv i (f k))*h i)=δ^2*z k := by + exact congrFun hlin k + rw [hl] + have hquad : (∑ i : σ,∑ j : σ,h i*h j*eval h (q k i j))=δ^2*Q z k := by + dsimp only [Q,h] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j hj + simp only [Pi.smul_apply,smul_eq_mul] + ring + rw [hquad] + change δ^2*e k+δ^2*z k+δ^2*Q z k=0 + rw [←mul_add,←mul_add,hroot k,mul_zero] + · intro i + refine ⟨(A*ᵥz) i,mulVec_mem_ideal I A z hz i,?_⟩ + rfl + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators Matrix +open MvPolynomial +variable {R σ : Type*} [CommRing R] [Fintype σ] [DecidableEq σ] + +private theorem det_sub_mem_ideal (I : Ideal R) (A B : Matrix σ σ R) + (h : ∀ i j,A i j-B i j∈I) : A.det-B.det∈I := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_sub,sub_eq_zero,RingHom.map_det,RingHom.map_det] + congr 1 + ext i j + change Ideal.Quotient.mk I (A i j)=Ideal.Quotient.mk I (B i j) + exact sub_eq_zero.mp ((map_sub _ _ _).symm.trans (Ideal.Quotient.eq_zero_iff_mem.mpr (h i j))) + + + +theorem corrected_jacobian_factor (I : Ideal R) (f : σ → MvPolynomial σ R) + (a b : σ → R) + (hab : ∀ i,∃ v∈I,b i=a i+(Matrix.det (fun k j=>eval a (pderiv j (f k))))*v) : + ∃ r∈I,Matrix.det (fun k j=>eval b (pderiv j (f k)))= + (Matrix.det (fun k j=>eval a (pderiv j (f k))))*(1+r) := by + let δ := Matrix.det (fun k j=>eval a (pderiv j (f k))) + have hc (i : σ) : b i-a i∈Ideal.span {δ}*I := by + obtain ⟨v,hv,h⟩ := hab i + apply Ideal.mem_span_singleton_mul.mpr + exact ⟨v,hv,by rw [h]; ring⟩ + have hdet := det_sub_mem_ideal (Ideal.span {δ}*I) + (fun k j=>eval b (pderiv j (f k))) (fun k j=>eval a (pderiv j (f k))) + (fun k j=>mv_eval_sub_mem _ _ _ _ hc) + obtain ⟨r,hr,heq⟩ := Ideal.mem_span_singleton_mul.mp hdet + refine ⟨r,hr,?_⟩ + change _=δ*(1+r) + change δ*r=Matrix.det (fun k j=>eval b (pderiv j (f k)))-δ at heq + linear_combination -heq + + + +theorem mv_tougeron_nondegenerate [IsDomain R] (I : Ideal R) [IsAdicComplete I R] + (f : σ → MvPolynomial σ R) (a e : σ → R) + (he : ∀ k,e k∈I) + (hJ : Matrix.det (fun k i=>eval a (pderiv i (f k)))≠0) + (hf : ∀ k,eval a (f k)= + (Matrix.det (fun k i=>eval a (pderiv i (f k))))^2*e k) : + ∃ b : σ → R,(∀ k,eval b (f k)=0) ∧ + (Matrix.det (fun k i=>eval b (pderiv i (f k)))≠0) ∧ + ∀ i,∃ v∈I,b i=a i+(Matrix.det (fun k j=>eval a (pderiv j (f k))))*v := by + obtain ⟨b,hb,hclose⟩ := mv_tougeron_correction I f a e he hf + obtain ⟨r,hr,hfactor⟩ := corrected_jacobian_factor I f a b hclose + refine ⟨b,hb,?_,hclose⟩ + rw [hfactor] + apply mul_ne_zero hJ + have hu : IsUnit (1+r) := by + simpa only [mul_one,add_comm] using + (Ideal.mem_jacobson_bot.mp (IsAdicComplete.le_jacobson_bot I hr) 1) + exact hu.ne_zero + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/AlgebraicDescent.lean b/lean/OAI/Algebra/FiniteTensor/AlgebraicDescent.lean new file mode 100644 index 0000000000000000000000000000000000000000..70a8d52525cd87b04f63bd6924f07f09353ec8e2 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/AlgebraicDescent.lean @@ -0,0 +1,336 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ClosedSpecialization +import OAI.Algebra.FiniteTensor.CoefficientDescent +import OAI.Algebra.FiniteTensor.KernelRelations + +namespace OAI + +/-! Finite-type algebraic coefficient descent and the algebraic tensor contradiction. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +open scoped BigOperators +variable {K σ : Type*} [Field K] [Finite σ] + +def truncSeries (n : ℕ) (f : MvPowerSeries σ K) : MvPowerSeries σ K := + (MvPowerSeries.truncTotal n f : MvPolynomial σ K) + + theorem coeff_truncSeries (n : ℕ) (f : MvPowerSeries σ K) (d : σ →₀ ℕ) : + MvPowerSeries.coeff d (truncSeries n f)= + if d.degree simp_all + + + +theorem homogeneous_root_equation (P : Polynomial (MvPowerSeries σ K)) + (f : MvPowerSeries σ K) (hf : P.eval f=0) (r n : ℕ) (hrn : r (seriesOver A).mul_mem (hP i) ((seriesOver A).pow_mem hf i)) + + theorem homogeneous_mem_seriesOver (A : Subring K) (f : MvPowerSeries σ K) + (hf : f∈seriesOver A) (n : ℕ) : MvPowerSeries.homogeneousComponent n f∈seriesOver A := by + rw [mem_seriesOver] at hf ⊢ + intro d + rw [MvPowerSeries.coeff_homogeneousComponent] + split_ifs + · exact hf d + · exact A.zero_mem + +variable [Finite σ] [LinearOrder σ] [WellFoundedGT σ] + +theorem coefficients_root_mem (A : Subring K) (P : Polynomial (MvPowerSeries σ K)) + (f : MvPowerSeries σ K) (hf : P.eval f=0) (r : ℕ) + (hDr : (r : ℕ∞)≤(P.derivative.eval f).order) + (a : σ →₀ ℕ) + (ha : MvPowerSeries.coeff a (MvPowerSeries.homogeneousComponent r (P.derivative.eval f))≠0) + (hmin : ∀ u,toLex u + intro b hb + by_cases hn : n≤r + · exact hlow b (hb ▸ hn) + have hrn : r (P.coeff i).coeffs) + let sl : Finset K := (finite_of_degree_le r).toFinset.image (fun d => MvPowerSeries.coeff d f) + let sd : Finset K := (finite_of_degree_le r).toFinset.image (fun d => MvPowerSeries.coeff d H) + let s : Finset K := sp ∪ sl ∪ sd ∪ {(MvPowerSeries.coeff (ofLex a) H)⁻¹} + let A := Algebra.adjoin ℤ (s : Set K) + have hgen {x : K} (hx : x∈s) : x∈A.toSubring := Algebra.subset_adjoin hx + refine ⟨A,Algebra.FiniteType.adjoin_of_finite s.finite_toSet,?_⟩ + have hout : f∈seriesOver A.toSubring := by + apply coefficients_root_mem A.toSubring Q f hQf r (le_of_eq hr) (ofLex a) ha + · intro u hu + by_contra h + exact hminimal (toLex u) h (by simpa only [toLex_ofLex] using hu) + · intro i + rw [mem_seriesOver] + intro d + simp only [Q,Polynomial.coeff_map,MvPowerSeries.algebraMap_apply', + Algebra.algebraMap_self,MvPowerSeries.map_id,RingHom.id_apply,MvPolynomial.coeff_coe] + by_cases hc : (P.coeff i).coeff d=0 + · rw [hc] + exact A.zero_mem + · apply hgen + have hp : P.coeff i≠0 := by intro h; exact hc (by simp [h]) + have hh : (P.coeff i).coeff d∈sp := + Finset.mem_biUnion.mpr ⟨i,Polynomial.mem_support_iff.mpr hp, + MvPolynomial.coeff_mem_coeffs d hc⟩ + exact Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_left _ hh)) + · rw [mem_seriesOver] + intro d + change MvPowerSeries.coeff d H∈A.toSubring + by_cases hd : d.degree=r + · apply hgen + have hh : MvPowerSeries.coeff d H∈sd := + Finset.mem_image.mpr ⟨d,(finite_of_degree_le r).mem_toFinset.mpr (le_of_eq hd),rfl⟩ + exact Finset.mem_union_left _ (Finset.mem_union_right _ hh) + · have hh : MvPowerSeries.coeff d H=0 := by + simp only [H,MvPowerSeries.coeff_homogeneousComponent,ite_eq_right hd] + rw [hh] + exact A.zero_mem + · exact hgen (Finset.mem_union_right _ (Finset.mem_singleton_self _)) + · intro d hd + apply hgen + have hh : MvPowerSeries.coeff d f∈sl := + Finset.mem_image.mpr ⟨d,(finite_of_degree_le r).mem_toFinset.mpr hd,rfl⟩ + exact Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_right _ hh)) + exact (mem_seriesOver A.toSubring f).mp hout + +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +variable {K ι : Type*} [Field K] [CharZero K] [Fintype ι] + + + +theorem algebraic_family_finiteType (n : ι → ℕ) + (f : ∀ i,MvPowerSeries (Fin (n i)) K) + (hf : ∀ i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (f i)) (extra : Finset K) : + ∃ A : Subalgebra ℤ K, Algebra.FiniteType ℤ A ∧ + (∀ x∈extra,x∈A) ∧ ∀ i d,MvPowerSeries.coeff d (f i)∈A := by + classical + choose B hB hcoef using fun i => algebraic_series_finiteType (f i) (hf i) + have hfg : ∀ i,(B i).FG := fun i => (Subalgebra.fg_iff_finiteType (B i)).mpr (hB i) + choose gens hgens using hfg + let s := Finset.univ.biUnion gens ∪ extra + let A := Algebra.adjoin ℤ (s : Set K) + have hBA : ∀ i,B i≤A := by + intro i + rw [←hgens i] + apply Algebra.adjoin_mono + intro x hx + exact Finset.mem_union_left _ (Finset.mem_biUnion.mpr ⟨i,Finset.mem_univ i,hx⟩) + refine ⟨A,Algebra.FiniteType.adjoin_of_finite s.finite_toSet,?_,?_⟩ + · intro x hx + exact Algebra.subset_adjoin (Finset.mem_union_right _ hx) + · intro i d + exact hBA i (hcoef i d) + +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable {K : Type*} [Field K] [CharZero K] {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} + + + +structure AlgebraicData (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) : Prop where + F : ∀ i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i) + b : ∀ i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i) + H : ∀ v q,IsAlgebraic (MvPolynomial (Fin d) K) (boxSeries K m q (M.H v)) + G : ∀ v,IsAlgebraic (MvPolynomial (Fin c) K) (M.G v) + left : ∀ t v q,IsAlgebraic (MvPolynomial (Fin d) K) (boxSeries K m q (W.left t v)) + right : ∀ t v,IsAlgebraic (MvPolynomial (Fin c) K) (W.right t v) + + + +theorem algebraic_data_descends (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) (h : AlgebraicData M W) : + ∃ A : Subalgebra ℤ K, Algebra.FiniteType ℤ A.toSubring ∧ IsUnit (2 : A.toSubring) ∧ + Nonempty (TensorModel A.toSubring (fun i=>Fin (n i)) m d c e active) := by + classical + let V := (i : Fin l) × Fin (n i) + let I := Fin l ⊕ Fin m ⊕ (V × Box m) ⊕ V ⊕ (Triple m × V × Box m) ⊕ (Triple m × V) + let size : I → ℕ := Sum.elim n (Sum.elim (fun i=>n (active i)) + (Sum.elim (fun _=>d) (Sum.elim (fun _=>c) (Sum.elim (fun _=>d) (fun _=>c))))) + let f : ∀ i:I,MvPowerSeries (Fin (size i)) K := fun i=> + match i with + | .inl i => M.F i + | .inr (.inl i) => M.b i + | .inr (.inr (.inl (v,q))) => boxSeries K m q (M.H v) + | .inr (.inr (.inr (.inl v))) => M.G v + | .inr (.inr (.inr (.inr (.inl (t,v,q))))) => boxSeries K m q (W.left t v) + | .inr (.inr (.inr (.inr (.inr (t,v))))) => W.right t v + have hf : ∀ i,IsAlgebraic (MvPolynomial (Fin (size i)) K) (f i) := by + rintro (i|i) + · exact h.F i + rcases i with i|i + · exact h.b i + rcases i with i|i + · exact h.H i.1 i.2 + rcases i with i|i + · exact h.G i + rcases i with i|i + · exact h.left i.1 i.2.1 i.2.2 + · exact h.right i.1 i.2 + let det := (tangent K (fun i=>Fin (n i)) m e M.H M.G).det + obtain ⟨A,hA,hex,hcoef⟩ := algebraic_family_finiteType size f hf {(2:K)⁻¹,det⁻¹} + have h2inv : (2:K)⁻¹∈A := hex _ (Finset.mem_insert_self _ _) + have hdetinv : det⁻¹∈A := hex _ (Finset.mem_insert_of_mem (Finset.mem_singleton_self _)) + have hc : CoefficientsIn A.toSubring M W := { + F := fun i b=>hcoef (.inl i) b + b := fun i a=>hcoef (.inr (.inl i)) a + H := fun v q b=>hcoef (.inr (.inr (.inl (v,q)))) b + G := fun v b=>hcoef (.inr (.inr (.inr (.inl v)))) b + left := fun t v q b=>hcoef (.inr (.inr (.inr (.inr (.inl (t,v,q)))))) b + right := fun t v b=>hcoef (.inr (.inr (.inr (.inr (.inr (t,v)))))) b + det_inv := hdetinv } + refine ⟨A,hA,?_,⟨descendTensorModel A.toSubring M W hc⟩⟩ + apply isUnit_iff_exists_inv.mpr + refine ⟨⟨(2:K)⁻¹,h2inv⟩,?_⟩ + apply Subtype.val_injective + change (2:K)*(2:K)⁻¹=1 + exact mul_inv_cancel₀ (by norm_num) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {K : Type*} [Field K] [CharZero K] {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} + + + +theorem no_algebraic_tensor_model (hm : 5 ≤ m) + (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) (h : AlgebraicData M W) : False := by + obtain ⟨A,hA,h2,⟨M'⟩⟩ := algebraic_data_descends M W h + let : Algebra.FiniteType ℤ A.toSubring := hA + exact (no_tensor_model_finiteType (fun i=>Fin (n i)) A.toSubring h2 e hm active).false M' + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/ArtinCoefficients.lean b/lean/OAI/Algebra/FiniteTensor/ArtinCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7d02fa3eeb83a6d5b5596046a4dffbc79775e7c --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/ArtinCoefficients.lean @@ -0,0 +1,274 @@ +import Mathlib + +namespace OAI + +/-! Finite coefficient equations and exact polynomial remainder reconstruction. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable {B R ι κ : Type*} [CommRing B] [CommRing R] + + +abbrev CoefficientVariables (p : ι → Polynomial R) := + (i : ι) × Fin ((p i).natDegree+1) + +instance [Fintype ι] (p : ι → Polynomial R) : Fintype (CoefficientVariables p) := by + unfold CoefficientVariables + infer_instance + +instance [DecidableEq ι] (p : ι → Polynomial R) : DecidableEq (CoefficientVariables p) := by + unfold CoefficientVariables + infer_instance + + +def coefficientPolynomial (p : ι → Polynomial R) (i : ι) : + Polynomial (MvPolynomial (CoefficientVariables p) B) := + ∑ j : Fin ((p i).natDegree+1), + Polynomial.C (MvPolynomial.X (⟨i,j⟩ : CoefficientVariables p))*Polynomial.X^j.val + + +def coefficientPoint (p : ι → Polynomial R) : CoefficientVariables p → R := + fun ij => (p ij.1).coeff ij.2 + + +def realizeCoefficients (p : ι → Polynomial R) (x : CoefficientVariables p → R) (i : ι) : + Polynomial R := + ∑ j : Fin ((p i).natDegree+1),Polynomial.C (x ⟨i,j⟩)*Polynomial.X^j.val + + theorem realizeCoefficients_original (p : ι → Polynomial R) (i : ι) : + realizeCoefficients p (coefficientPoint p) i=p i := by + simp only [realizeCoefficients,coefficientPoint] + exact (Fin.sum_univ_eq_sum_range (fun j=>Polynomial.C ((p i).coeff j)*Polynomial.X^j) + ((p i).natDegree+1)).trans (p i).as_sum_range_C_mul_X_pow.symm + + theorem map_coefficientPolynomial (φ : B →+* R) (p : ι → Polynomial R) + (x : CoefficientVariables p → R) (i : ι) : + (coefficientPolynomial (B:=B) p i).map (MvPolynomial.eval₂Hom φ x) = + realizeCoefficients p x i := by + unfold coefficientPolynomial realizeCoefficients + rw [Polynomial.map_sum] + apply Finset.sum_congr rfl + intro j hj + change (Polynomial.mapRingHom (MvPolynomial.eval₂Hom φ x)) + (Polynomial.C (MvPolynomial.X (⟨i,j⟩ : CoefficientVariables p))*Polynomial.X^j.val) = _ + rw [map_mul] + simp only [Polynomial.coe_mapRingHom,Polynomial.map_C,Polynomial.map_pow,Polynomial.map_X, + MvPolynomial.eval₂Hom_X'] + + +def coefficientRelation (p : ι → Polynomial R) (F : MvPolynomial ι (Polynomial B)) : + Polynomial (MvPolynomial (CoefficientVariables p) B) := + MvPolynomial.eval₂ (Polynomial.mapRingHom MvPolynomial.C) + (coefficientPolynomial p) F + + theorem map_coefficientRelation (φ : B →+* R) (p : ι → Polynomial R) + (x : CoefficientVariables p → R) (F : MvPolynomial ι (Polynomial B)) : + (coefficientRelation p F).map (MvPolynomial.eval₂Hom φ x) = + MvPolynomial.eval₂ (Polynomial.mapRingHom φ) (realizeCoefficients p x) F := by + let e := MvPolynomial.eval₂Hom φ x + have he : (Polynomial.mapRingHom e).comp + (MvPolynomial.eval₂Hom (Polynomial.mapRingHom MvPolynomial.C) (coefficientPolynomial p)) = + MvPolynomial.eval₂Hom (Polynomial.mapRingHom φ) (realizeCoefficients p x) := by + apply MvPolynomial.ringHom_ext + · intro q + simp only [RingHom.comp_apply,MvPolynomial.eval₂Hom_C,Polynomial.coe_mapRingHom, + Polynomial.map_map] + congr 1 + ext b + simp [e] + · intro i + simp only [RingHom.comp_apply,MvPolynomial.eval₂Hom_X',Polynomial.coe_mapRingHom] + exact map_coefficientPolynomial φ p x i + exact RingHom.congr_fun he F + + +abbrev CoefficientEquations (p : ι → Polynomial R) (F : κ → MvPolynomial ι (Polynomial B)) := + (k : κ) × Fin ((coefficientRelation p (F k)).natDegree+1) + +instance [Fintype κ] (p : ι → Polynomial R) (F : κ → MvPolynomial ι (Polynomial B)) : + Fintype (CoefficientEquations p F) := by unfold CoefficientEquations; infer_instance + +instance [DecidableEq κ] (p : ι → Polynomial R) (F : κ → MvPolynomial ι (Polynomial B)) : + DecidableEq (CoefficientEquations p F) := by unfold CoefficientEquations; infer_instance + + def coefficientEquation (p : ι → Polynomial R) (F : κ → MvPolynomial ι (Polynomial B)) + (kn : CoefficientEquations p F) : MvPolynomial (CoefficientVariables p) B := + (coefficientRelation p (F kn.1)).coeff kn.2 + + + + theorem coefficient_equations_iff (φ : B →+* R) (p : ι → Polynomial R) + (F : κ → MvPolynomial ι (Polynomial B)) (x : CoefficientVariables p → R) : + (∀ kn,MvPolynomial.eval₂ φ x (coefficientEquation p F kn)=0) ↔ + ∀ k,MvPolynomial.eval₂ (Polynomial.mapRingHom φ) (realizeCoefficients p x) (F k)=0 := by + constructor + · intro hx k + rw [←map_coefficientRelation] + ext j + rw [Polynomial.coeff_map,Polynomial.coeff_zero] + by_cases hj : j<(coefficientRelation p (F k)).natDegree+1 + · exact hx ⟨k,⟨j,hj⟩⟩ + · have hz := Polynomial.coeff_eq_zero_of_natDegree_lt (p:=coefficientRelation p (F k)) + (show (coefficientRelation p (F k)).natDegreehbj (Fin.ext h.symm) + simp [h] + · simp + + + + theorem realizeCoefficients_close (p : ι → Polynomial R) + (x : CoefficientVariables p → R) (I : Ideal R) + (hx : ∀ v,x v-coefficientPoint p v∈I) (i : ι) (j : ℕ) : + (realizeCoefficients p x i).coeff j-(p i).coeff j∈I := by + by_cases hj : j<(p i).natDegree+1 + · exact (realizeCoefficients_coeff p x i ⟨j,hj⟩) ▸ hx ⟨i,⟨j,hj⟩⟩ + · have hlt : (p i).natDegreeE (a i)) (map φ f)=E (aeval a f) := by + rw [aeval_def,eval₂_map,aeval_def] + rw [hsq] + exact (hom_eval₂ f (algebraMap R A) E a).symm + + + +omit [DecidableEq ρ] in +theorem option_artin_step + (ih : PolynomialArtinAt K τ) + (f : σ → MvPolynomial (σ ⊕ ρ) (MvPolynomial (Option τ) K)) + (a : (σ ⊕ ρ) → MvPowerSeries (Option τ) K) + (ha : ∀ k,aeval a (f k)=0) + (hreg : MvPowerSeries.subst (axisVars (K:=K) none) (aeval a (minorPolynomial f))≠0) + (hnonunit : ¬IsUnit (aeval a (minorPolynomial f))) (n : ℕ) : + ∃ b : (σ ⊕ ρ) → MvPowerSeries (Option τ) K, + (∀ k,aeval b (f k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial (Option τ) K) (b i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=Option τ))^n := by + classical + let E := MvPowerSeries.optionEquivLeft τ K + let P := MvPolynomial.optionEquivLeft K τ + let f' := fun k=>map P.toRingHom (f k) + let a' := fun i=>E (a i) + have hev (q : MvPolynomial (σ ⊕ ρ) (MvPolynomial (Option τ) K)) + (v : (σ ⊕ ρ) → MvPowerSeries (Option τ) K) : + eval (fun i=>E (v i)) (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) (map P.toRingHom q))=E (aeval v q) := by + rw [seriesCoefficientMap_eq_algebraMap,←eval₂_eq_eval_map,←aeval_def] + exact aeval_map_square P.toRingHom E.toRingHom option_series_polynomial_square.symm q v + have hminor : minorPolynomial f'=map P.toRingHom (minorPolynomial f) := + (minorPolynomial_map P.toRingHom f).symm + obtain ⟨b,hb,hbalg,hba⟩ := aligned_artin_step ih f' a' + (fun k=>by rw [hev,ha,map_zero]) + (by + rw [hminor,hev] + apply residue_regular_of_constant_regular + rwa [←option_axis_constant]) + (by + rw [hminor,hev] + exact fun hu=>hnonunit ((isUnit_map_iff E _).mp hu)) n + refine ⟨fun i=>E.symm (b i),?_,fun i=>algebraic_option_series_symm (hbalg i),?_⟩ + · intro k + apply E.injective + rw [map_zero,←hev] + simpa only [AlgEquiv.apply_symm_apply] using hb k + · intro i + simpa only [a',E,map_sub,AlgEquiv.symm_apply_apply] using hba i + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {K τ σ ρ : Type*} [Field K] [Finite τ] + [Fintype σ] [DecidableEq σ] [Fintype ρ] [DecidableEq ρ] + + + +omit [Fintype ρ] [DecidableEq ρ] in +theorem unit_artin_step + (f : σ → MvPolynomial (σ ⊕ ρ) (MvPowerSeries τ K)) + (hcoeff : ∀ k d,IsAlgebraic (MvPolynomial τ K) ((f k).coeff d)) + (a : (σ ⊕ ρ) → MvPowerSeries τ K) (ha : ∀ k,eval a (f k)=0) + (hunit : IsUnit (Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k))))) + (n : ℕ) : + ∃ b : (σ ⊕ ρ) → MvPowerSeries τ K,(∀ k,eval b (f k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^n := by + classical + let δ := Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k))) + let N := 2*δ.order.toNat+n+1 + let u := fun i=>(MvPowerSeries.truncTotal N (a i):MvPowerSeries τ K) + have hc (i) : u i-a i∈(jetIdeal (K:=K) (σ:=τ))^N := truncate_close_jetIdeal _ _ + have hN : 1≤N := by dsimp [N]; omega + have hd : Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k)))-δ∈ + jetIdeal (K:=K) (σ:=τ) := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + dsimp only [δ] + rw [map_sub,sub_eq_zero] + erw [RingHom.map_det,RingHom.map_det] + congr 1 + ext row column + apply Ideal.Quotient.eq.mpr + apply mv_eval_sub_mem + intro index + simpa using Ideal.pow_le_pow_right hN (hc index) + have hcc : MvPowerSeries.constantCoeff + (Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k))))= + MvPowerSeries.constantCoeff δ := by + have hd' : Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k)))-δ∈ + (jetIdeal (K:=K) (σ:=τ))^1 := by simpa only [pow_one] using hd + have hz := (mem_jetIdeal_pow_iff_coeff _ 1).mp hd' 0 (by simp) + simpa only [MvPowerSeries.coeff_zero_eq_constantCoeff,map_sub,sub_eq_zero] using hz + have hu : IsUnit (Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k)))) := by + rw [MvPowerSeries.isUnit_iff_constantCoeff,hcc] + exact MvPowerSeries.isUnit_iff_constantCoeff.mp hunit + obtain ⟨b,hb,hbalg,hfree,hba⟩ := fixed_jet_prepared_approximation f hcoeff a u ha + (fun i=>isAlgebraic_algebraMap (MvPowerSeries.truncTotal N (a (Sum.inr i)))) n + hunit.ne_zero hc (fun k=>(hu.pow 2).dvd) + exact ⟨b,hb,hbalg,hba⟩ + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open Polynomial +variable {B A : Type*} [CommRing B] [IsDomain B] [CommRing A] [IsDomain A] + [Algebra B A] + + +theorem polynomial_remove_X_factor {R : Type*} [Semiring R] + (p : Polynomial R) (hp : p≠0) : + ∃ (n : ℕ) (q : Polynomial R),p=X^n*q ∧ q.coeff 0≠0 := by + obtain ⟨q,hq⟩ := (X_pow_dvd_iff.mpr + (fun d hd=>coeff_eq_zero_of_lt_natTrailingDegree hd) : X^p.natTrailingDegree∣p) + refine ⟨p.natTrailingDegree,q,hq,?_⟩ + have he : (X^p.natTrailingDegree*q).coeff p.natTrailingDegree=q.coeff 0 := by + simpa only [zero_add] using coeff_X_pow_mul q p.natTrailingDegree 0 + rw [←hq] at he + rw [←he] + exact trailingCoeff_nonzero_iff_nonzero.mpr hp + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/BoxCoefficients.lean b/lean/OAI/Algebra/FiniteTensor/BoxCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e57b3225c9d767c4674152d9fd38ed5cdae0e38 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/BoxCoefficients.lean @@ -0,0 +1,269 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ScalarModels + +namespace OAI + +/-! Squarefree box coefficients and finite tensor primitives. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +open scoped BigOperators +variable (A : Type*) [CommRing A] (m : ℕ) + +abbrev Box := Fin m → Fin 2 + +def boxExponent (b : Box m) : Fin m →₀ ℕ := + Finsupp.equivFunOnFinite.symm (fun i => (b i).val) + +@[simp] theorem boxExponent_apply (b : Box m) (i : Fin m) : boxExponent m b i=(b i).val := by + simp [boxExponent] + + theorem boxExponent_injective : Function.Injective (boxExponent m) := by + intro b c h + funext i + apply Fin.ext + simpa only [boxExponent_apply] using congrArg (fun f : Fin m →₀ ℕ => f i) h + + theorem squareIdeal_as_monomials : squareIdeal A m = + Ideal.span ((fun a : Fin m →₀ ℕ => MvPolynomial.monomial a (1 : A)) '' + Set.range (fun i : Fin m => Finsupp.single i 2)) := by + unfold squareIdeal + congr 1 + ext f + simp only [Set.mem_range,Set.mem_image] + constructor + · rintro ⟨i,rfl⟩ + exact ⟨Finsupp.single i 2,⟨i,rfl⟩,MvPolynomial.X_pow_eq_monomial.symm⟩ + · rintro ⟨a,⟨i,rfl⟩,rfl⟩ + exact ⟨i,MvPolynomial.X_pow_eq_monomial⟩ + + theorem squareIdeal_coeff_iff (f : MvPolynomial (Fin m) A) : + f∈squareIdeal A m ↔ ∀ b : Box m,f.coeff (boxExponent m b)=0 := by + classical + rw [squareIdeal_as_monomials,MvPolynomial.mem_ideal_span_monomial_image] + constructor + · intro hf b + by_contra hb + obtain ⟨_,⟨i,rfl⟩,hi⟩ := hf _ (MvPolynomial.mem_support_iff.mpr hb) + have hpi : 2≤(b i).val := by simpa only [Finsupp.single_eq_same,boxExponent_apply] using hi i + exact (not_le_of_gt (b i).isLt) hpi + · intro hf a ha + have hn : ¬∀ i,a i<2 := by + intro h + let b : Box m := fun i => ⟨a i,h i⟩ + have hab : boxExponent m b=a := by ext i; rfl + exact (MvPolynomial.mem_support_iff.mp ha) (hab ▸ hf b) + push Not at hn + obtain ⟨i,hi⟩ := hn + refine ⟨Finsupp.single i 2,⟨i,rfl⟩,?_⟩ + intro j + by_cases hji : j=i + · subst j + simpa using hi + · simp only [Finsupp.single_eq_of_ne hji,zero_le] + + def boxCoeff (b : Box m) : Parameters A m →ₗ[A] A := + ((squareIdeal A m).restrictScalars A).liftQ (MvPolynomial.lcoeff A (boxExponent m b)) + (by intro f hf; exact (squareIdeal_coeff_iff A m f).mp hf b) + +@[simp] theorem boxCoeff_mk (b : Box m) (f : MvPolynomial (Fin m) A) : + boxCoeff A m b (Ideal.Quotient.mk (squareIdeal A m) f)=f.coeff (boxExponent m b) := rfl + + theorem parameters_ext (x y : Parameters A m) + (h : ∀ b,boxCoeff A m b x=boxCoeff A m b y) : x=y := by + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective x + obtain ⟨q,rfl⟩ := Ideal.Quotient.mk_surjective y + apply sub_eq_zero.mp + rw [←map_sub,Ideal.Quotient.eq_zero_iff_mem,squareIdeal_coeff_iff] + intro b + rw [MvPolynomial.coeff_sub,sub_eq_zero] + exact h b + +variable {A m} {B : Type*} [CommRing B] + +@[simp] theorem boxCoeff_mapParameters (f : A →+* B) (b : Box m) (x : Parameters A m) : + boxCoeff B m b (mapParameters f x)=f (boxCoeff A m b x) := by + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective x + change (MvPolynomial.map f p).coeff (boxExponent m b)=f (p.coeff (boxExponent m b)) + exact MvPolynomial.coeff_map _ _ _ + + theorem mapParameters_injective (f : A →+* B) (hf : Function.Injective f) : + Function.Injective (mapParameters (m:=m) f) := by + intro x y h + apply parameters_ext A m x y + intro b + apply hf + rw [←boxCoeff_mapParameters,←boxCoeff_mapParameters,h] + +variable (A m) + +def boxMonomial (b : Box m) : Parameters A m := + Ideal.Quotient.mk (squareIdeal A m) (MvPolynomial.monomial (boxExponent m b) 1) + +@[simp] theorem boxCoeff_boxMonomial (b c : Box m) : + boxCoeff A m b (boxMonomial A m c)=if b=c then 1 else 0 := by + classical + simp only [boxMonomial,boxCoeff_mk,MvPolynomial.coeff_monomial, + (boxExponent_injective m).eq_iff,eq_comm] + + theorem sum_boxMonomial (x : Parameters A m) : + (∑ b : Box m,boxCoeff A m b x • boxMonomial A m b)=x := by + apply parameters_ext A m + intro b + simp only [map_sum,map_smul,boxCoeff_boxMonomial,smul_eq_mul,mul_ite,mul_one,mul_zero] + simp + + +def boxSeries {σ : Type*} (b : Box m) (f : MvPowerSeries σ (Parameters A m)) : MvPowerSeries σ A := + fun d => boxCoeff A m b (MvPowerSeries.coeff d f) + +@[simp] theorem coeff_boxSeries {σ : Type*} (b : Box m) + (f : MvPowerSeries σ (Parameters A m)) (d : σ →₀ ℕ) : + MvPowerSeries.coeff d (boxSeries A m b f)=boxCoeff A m b (MvPowerSeries.coeff d f) := rfl + + theorem sum_boxSeries {σ : Type*} (f : MvPowerSeries σ (Parameters A m)) : + (∑ b : Box m,MvPowerSeries.C (boxMonomial A m b)* + MvPowerSeries.map (algebraMap A (Parameters A m)) (boxSeries A m b f))=f := by + ext d + simp only [map_sum,MvPowerSeries.coeff_C_mul,MvPowerSeries.coeff_map,coeff_boxSeries] + calc + _ = ∑ b : Box m,boxCoeff A m b (MvPowerSeries.coeff d f) • boxMonomial A m b := by + apply Finset.sum_congr rfl + intro b _ + rw [mul_comm] + exact (Algebra.smul_def (R:=A) _ _).symm + _ = _ := sum_boxMonomial A m (MvPowerSeries.coeff d f) + +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +open scoped BigOperators +variable {A B : Type*} [CommRing A] [CommRing B] {m : ℕ} + +@[simp] theorem map_boxMonomial (f : A →+* B) (b : Box m) : + mapParameters f (boxMonomial A m b)=boxMonomial B m b := by + change Ideal.Quotient.mk (squareIdeal B m) (MvPolynomial.map f (MvPolynomial.monomial _ 1))=_ + rw [MvPolynomial.map_monomial,map_one] + rfl + + theorem sub_constant_parameters_mem (a : Parameters A m) : + a-algebraMap A (Parameters A m) (augmentation A m a)∈parameterIdeal A m := by + refine Quotient.inductionOn' a ?_ + intro p + change Ideal.Quotient.mk (squareIdeal A m) p - + algebraMap A (Parameters A m) (augmentation A m (Ideal.Quotient.mk (squareIdeal A m) p))∈_ + induction p using MvPolynomial.induction_on with + | C c => + change algebraMap A (Parameters A m) c-algebraMap A (Parameters A m) + (augmentation A m (algebraMap A (Parameters A m) c))∈_ + simp + | add p q hp hq => + simpa only [map_add,add_sub_add_comm] using (parameterIdeal A m).add_mem hp hq + | mul_X p i _ => + simp only [map_mul,show Ideal.Quotient.mk (squareIdeal A m) (MvPolynomial.X i)=parameter A m i from rfl, + augmentation_parameter,mul_zero,map_zero,sub_zero] + exact Ideal.mul_mem_left _ _ (Ideal.subset_span (Set.mem_range_self i)) + + theorem augmentation_eq_zero_of_mem {a : Parameters A m} (ha : a∈parameterIdeal A m) : + augmentation A m a=0 := by + have hh : parameterIdeal A m≤RingHom.ker (augmentation A m) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact augmentation_parameter A m i + exact hh ha + + theorem mem_parameterIdeal_iff (a : Parameters A m) : + a∈parameterIdeal A m ↔ augmentation A m a=0 := by + constructor + · exact augmentation_eq_zero_of_mem + · intro ha + simpa only [ha,map_zero,sub_zero] using sub_constant_parameters_mem a + + theorem mapParameters_mem_iff (f : A →+* B) (hf : Function.Injective f) + (a : Parameters A m) : mapParameters f a∈parameterIdeal B m ↔ a∈parameterIdeal A m := by + simp only [mem_parameterIdeal_iff,augmentation_mapParameters] + exact (map_eq_zero_iff f hf) + +variable {K σ : Type*} [Field K] (R : Subring K) + + +def liftParameterSeries (f : MvPowerSeries σ (Parameters K m)) + (hf : ∀ b d,MvPowerSeries.coeff d (boxSeries K m b f)∈R) : + MvPowerSeries σ (Parameters R m) := + ∑ b : Box m,MvPowerSeries.C (boxMonomial R m b)* + MvPowerSeries.map (algebraMap R (Parameters R m)) + (MvPowerSeries.toSubring (boxSeries K m b f) R (hf b)) + + theorem map_liftParameterSeries (f : MvPowerSeries σ (Parameters K m)) + (hf : ∀ b d,MvPowerSeries.coeff d (boxSeries K m b f)∈R) : + MvPowerSeries.map (mapParameters R.subtype) (liftParameterSeries R f hf)=f := by + calc + _ = ∑ b : Box m,MvPowerSeries.C (boxMonomial K m b)* + MvPowerSeries.map (algebraMap K (Parameters K m)) (boxSeries K m b f) := by + rw [liftParameterSeries,map_sum] + apply Finset.sum_congr rfl + intro b _ + rw [map_mul,MvPowerSeries.map_C,map_boxMonomial] + congr 1 + ext d + simp only [MvPowerSeries.coeff_map,mapParameters_algebraMap] + rfl + _ = f := sum_boxSeries K m f + +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +universe u +variable (A : Type*) [CommRing A] {l : ℕ} (σ : Fin l → Type u) + [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] (m : ℕ) + +abbrev Triple := {p : Fin m × Fin m × Fin m // + p.1≠p.2.1 ∧ p.1≠p.2.2 ∧ p.2.1≠p.2.2} + + + +structure TensorPrimitives {d c : ℕ} {e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c} + {active : Fin m ↪ Fin l} (M : TensorModel A σ m d c e active) where + left : Triple m → ((i : Fin l) × σ i) → MvPowerSeries (Fin d) (Parameters A m) + right : Triple m → ((i : Fin l) × σ i) → MvPowerSeries (Fin c) A + left_eq : ∀ q, (∑ v,left q v*MvPowerSeries.subst M.H + (MvPowerSeries.pderiv v (deformed A σ m M.F active M.b)))= + MvPowerSeries.C (parameter A m q.val.1*parameter A m q.val.2.1*parameter A m q.val.2.2) + right_eq : ∀ q, (∑ v,right q v*MvPowerSeries.subst M.G + (MvPowerSeries.pderiv v (potential A σ M.F)))= + MvPowerSeries.subst M.G (perturbation A σ m active M.b q.val.1* + perturbation A σ m active M.b q.val.2.1*perturbation A σ m active M.b q.val.2.2) + + + +theorem exists_tensorPrimitives {d c : ℕ} {e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c} + {active : Fin m ↪ Fin l} (M : TensorModel A σ m d c e active) : + Nonempty (TensorPrimitives A σ m M) := by + classical + have hL : ∀ q : Triple m, ∃ a : ((i : Fin l) × σ i) → _, + (∑ v,a v*MvPowerSeries.subst M.H + (MvPowerSeries.pderiv v (deformed A σ m M.F active M.b)))= + MvPowerSeries.C (parameter A m q.val.1*parameter A m q.val.2.1*parameter A m q.val.2.2) := by + intro q + exact Ideal.mem_span_range_iff_exists_fun.mp + (M.left_triple _ _ _ q.property.1 q.property.2.1 q.property.2.2) + have hR : ∀ q : Triple m, ∃ a : ((i : Fin l) × σ i) → _, + (∑ v,a v*MvPowerSeries.subst M.G (MvPowerSeries.pderiv v (potential A σ M.F)))= + MvPowerSeries.subst M.G (perturbation A σ m active M.b q.val.1* + perturbation A σ m active M.b q.val.2.1*perturbation A σ m active M.b q.val.2.2) := by + intro q + exact Ideal.mem_span_range_iff_exists_fun.mp + (M.right_triple _ _ _ q.property.1 q.property.2.1 q.property.2.2) + choose L hL using hL + choose R hR using hR + exact ⟨⟨L,R,hL,hR⟩⟩ + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/ChartPairings.lean b/lean/OAI/Algebra/FiniteTensor/ChartPairings.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4553c57a217c2cce0b7a57f595732846cd7aad3 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/ChartPairings.lean @@ -0,0 +1,315 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.NormalResidues + +namespace OAI + +/-! Chart-normal cycles, coordinate reindexing and oriented residue pairings. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open PD4Tensor.Forms +variable (K R υ : Type*) [Field K] [CommRing R] [Algebra K R] + [Fintype υ] [DecidableEq υ] (p : ℕ) [CharP R p] [Invertible (2 : K)] + +def chartDerivative (i : υ) : Ring R υ (fun _ => p) →ₗ[K] Ring R υ (fun _ => p) := + (relativeDeriv R υ p i).restrictScalars K + +variable {σ : Type*} {c : ℕ} + +def normalCoordinates (e : υ ≃ σ ⊕ Fin c) + (q : Ring R υ (fun _ => p) ≃ₐ[R] Ring R υ (fun _ => p)) : List (Ring R υ (fun _ => p)) := + List.ofFn (fun j => q.symm (coord R υ (fun _ => p) (e.symm (Sum.inr j)))) + +def chartNormal (e : υ ≃ σ ⊕ Fin c) + (q : Ring R υ (fun _ => p) ≃ₐ[R] Ring R υ (fun _ => p)) : + Ω K (Ring R υ (fun _ => p)) υ := + normalCycle K (Ring R υ (fun _ => p)) υ (chartDerivative K R υ p) p + (normalCoordinates R υ p e q) + +theorem chartNormal_closed (e : υ ≃ σ ⊕ Fin c) + (q : Ring R υ (fun _ => p) ≃ₐ[R] Ring R υ (fun _ => p)) : + differential K (Ring R υ (fun _ => p)) υ (chartDerivative K R υ p) + (chartNormal K R υ p e q)=0 := + normalCycle_closed (chartDerivative K R υ p) (partial_mul R υ p) + (partial_commute R υ p) p _ + +omit [Fintype υ] [DecidableEq υ] [CharP R p] in +private theorem normalCoordinates_span (e : υ ≃ σ ⊕ Fin c) + (q : Ring R υ (fun _ => p) ≃ₐ[R] Ring R υ (fun _ => p)) : + {a | a ∈ normalCoordinates R υ p e q}= + Set.range (fun j => q.symm (coord R υ (fun _ => p) (e.symm (Sum.inr j)))) := by + ext a + simp only [normalCoordinates,List.mem_ofFn,Set.mem_ofPred_eq,Set.mem_range] + +omit [Fintype υ] [DecidableEq υ] [CharP R p] in +private theorem normalCoordinates_pow (e : υ ≃ σ ⊕ Fin c) + (q : Ring R υ (fun _ => p) ≃ₐ[R] Ring R υ (fun _ => p)) : + ∀ a ∈ normalCoordinates R υ p e q, a^p=0 := by + intro a ha + obtain ⟨j,rfl⟩ := List.mem_ofFn.mp ha + rw [←map_pow,coord_pow,map_zero] + + + +theorem chartNormal_ann (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) + (a : Ring R υ (fun _ => p)) (ha : splitRestriction hp e q a=0) : + scalar K (Ring R υ (fun _ => p)) υ a * chartNormal K R υ p e q=0 ∧ + differential K (Ring R υ (fun _ => p)) υ (chartDerivative K R υ p) + (scalar K (Ring R υ (fun _ => p)) υ a) * chartNormal K R υ p e q=0 := by + apply normalCycle_ideal_ann (chartDerivative K R υ p) (partial_mul R υ p) + p hp (normalCoordinates R υ p e q) (normalCoordinates_pow R υ p e q) a + rw [normalCoordinates_span,←splitRestriction_ker hp e q] + exact ha + + + +theorem chartNormal_koszul (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) + (S : Ring R υ (fun _ => p)) (hS : splitRestriction hp e q S=0) : + oneForm K (Ring R υ (fun _ => p)) υ (fun i => chartDerivative K R υ p i S) * + chartNormal K R υ p e q=0 := by + have h := (chartNormal_ann K R υ p hp e q S hS).2 + simpa only [differential_scalar] using h + + + +theorem chartNormal_boundary (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) + (S : Ring R υ (fun _ => p)) (hS : splitRestriction hp e q S=0) + (a : Ring R υ (fun _ => p)) + (ha : splitRestriction hp e q a ∈ Ideal.span (Set.range (fun i => + splitRestriction hp e q (chartDerivative K R υ p i S)))) : + scalar K (Ring R υ (fun _ => p)) υ a * chartNormal K R υ p e q ∈ + LinearMap.range (LinearMap.mulLeft K + (oneForm K (Ring R υ (fun _ => p)) υ (fun i => chartDerivative K R υ p i S))) := by + apply restricted_gradient_boundary ((splitRestriction hp e q).restrictScalars K) + (splitRestriction_surjective hp e q) (fun i => chartDerivative K R υ p i S) + (chartNormal K R υ p e q) (chartNormal_koszul K R υ p hp e q S hS) + · intro b hb + exact (chartNormal_ann K R υ p hp e q b hb).1 + · exact ha + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open PD4Tensor.Forms +variable (K : Type*) [Field K] (c d p : ℕ) [CharP K p] [Fact p.Prime] + [Invertible (2 : K)] + + + +theorem chartNormal_pair_nonzero + (e : Fin (c+d) ≃ Fin d ⊕ Fin c) + (q : Ring K (Fin (c+d)) (fun _ => p) ≃ₐ[K] Ring K (Fin (c+d)) (fun _ => p)) : + FrobeniusTruncation.residue K (Fin (c+d)) p (Fact.out : p.Prime).pos + (topCoefficient K (Ring K (Fin (c+d)) (fun _ => p)) (c+d) + (chartNormal K K (Fin (c+d)) p e q * + chartNormal K K (Fin (c+d)) p (e.trans (Equiv.sumComm _ _)) q))≠0 := by + let perm : Fin (c+d) ≃ Fin (c+d) := + finSumFinEquiv.symm.trans ((Equiv.sumComm _ _).trans e.symm) + let E := reindexEquiv K (Fin (c+d)) (Fin (c+d)) p perm + have hn := FrobeniusTruncation.inverse_normal_residue_ne_zero K (c+d) p (E.trans q.symm) + have hlist : + List.ofFn (fun i => (E.trans q.symm) (coord K (Fin (c+d)) (fun _ => p) i))= + normalCoordinates K (Fin (c+d)) p e q ++ + normalCoordinates K (Fin (c+d)) p (e.trans (Equiv.sumComm _ _)) q := by + rw [List.ofFn_add] + apply congrArg₂ List.append + · apply congrArg List.ofFn + funext i + simp only [AlgEquiv.trans_apply,E,reindexEquiv_coord,perm,Equiv.trans_apply, + Equiv.sumComm_apply] + change q.symm (coord K (Fin (c+d)) (fun _ => p) + (e.symm ((finSumFinEquiv.symm (Fin.castAdd d i)).swap)))=_ + rw [finSumFinEquiv_symm_apply_castAdd] + rfl + · apply congrArg List.ofFn + funext i + simp only [AlgEquiv.trans_apply,E,reindexEquiv_coord,perm,Equiv.trans_apply, + finSumFinEquiv_symm_apply_natAdd,Equiv.sumComm_apply, + Equiv.symm_trans_apply,Equiv.sumComm_symm] + change FrobeniusTruncation.residue K (Fin (c+d)) p _ + (topCoefficient K (Ring K (Fin (c+d)) (fun _ => p)) (c+d) + (normalCycle K (Ring K (Fin (c+d)) (fun _ => p)) (Fin (c+d)) + (chartDerivative K K (Fin (c+d)) p) p + (List.ofFn (fun i => (E.trans q.symm) (coord K (Fin (c+d)) (fun _ => p) i)))))≠0 at hn + rw [hlist,normalCycle_append] at hn + exact hn + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct +variable (K A B σ τ : Type*) [Field K] [CommRing A] [CommRing B] + [Algebra K A] [Algebra K B] [Fintype σ] [DecidableEq σ] + [Fintype τ] [DecidableEq τ] + +theorem reindexForms_normalCycle (e : σ ≃ τ) (f : A ≃ₐ[K] B) + (derA : σ → A →ₗ[K] A) (derB : τ → B →ₗ[K] B) + (hder : ∀ i a, derB (e i) (f a)=f (derA i a)) (p : ℕ) (cs : List A) : + reindexForms K A B σ τ e f (normalCycle K A σ derA p cs)= + normalCycle K B τ derB p (cs.map f) := by + simp only [normalCycle,map_list_prod,List.map_map] + congr 1 + apply List.map_congr_left + intro c hc + simp only [Function.comp_apply,normalFactor,map_mul,reindexForms_scalar,map_pow, + reindexForms_differential K A B σ τ e f derA derB hder] + +end +end PD4Tensor.Forms + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open PD4Tensor.Forms +variable (R σ τ : Type*) [CommRing R] (p : ℕ) + +@[simp] theorem renameHom_mk (e : σ → τ) (a : MvPolynomial σ R) : + renameHom R σ τ p e (Ideal.Quotient.mk (ideal R σ (fun _ => p)) a)= + Ideal.Quotient.mk (ideal R τ (fun _ => p)) (MvPolynomial.rename e a) := by + induction a using MvPolynomial.induction_on with + | C a => + change renameHom R σ τ p e (algebraMap R _ a)=_ + rw [AlgHom.commutes,MvPolynomial.rename_C] + rfl + | add a b ha hb => simp only [map_add,ha,hb] + | mul_X a i ha => + simp only [map_mul,MvPolynomial.rename_X] + change renameHom R σ τ p e (Ideal.Quotient.mk _ a) * + renameHom R σ τ p e (coord R σ (fun _ => p) i)=_ + rw [ha,renameHom_coord] + rfl + +variable [CharP R p] +theorem reindexEquiv_partial (e : σ ≃ τ) (i : σ) (a : Ring R σ (fun _ => p)) : + relativeDeriv R τ p (e i) (reindexEquiv R σ τ p e a)= + reindexEquiv R σ τ p e (relativeDeriv R σ p i a) := by + obtain ⟨a,rfl⟩ := Ideal.Quotient.mk_surjective a + change relativeDeriv R τ p (e i) (renameHom R σ τ p e (Ideal.Quotient.mk _ a))= + renameHom R σ τ p e (relativeDeriv R σ p i (Ideal.Quotient.mk _ a)) + simp only [renameHom_mk,partial_mk,MvPolynomial.pderiv_rename e.injective] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open PD4Tensor.Forms +variable (K υ τ : Type*) [Field K] [Fintype υ] [DecidableEq υ] + [Fintype τ] [DecidableEq τ] (p : ℕ) [CharP K p] + {σ : Type*} {c : ℕ} + +def reindexChart (e : υ ≃ τ) + (q : Ring K υ (fun _ => p) ≃ₐ[K] Ring K υ (fun _ => p)) : + Ring K τ (fun _ => p) ≃ₐ[K] Ring K τ (fun _ => p) := + (reindexEquiv K υ τ p e).symm.trans (q.trans (reindexEquiv K υ τ p e)) + +theorem chartNormal_reindex [Invertible (2 : K)] (r : υ ≃ τ) (e : υ ≃ σ ⊕ Fin c) + (q : Ring K υ (fun _ => p) ≃ₐ[K] Ring K υ (fun _ => p)) : + reindexForms K (Ring K υ (fun _ => p)) (Ring K τ (fun _ => p)) υ τ + r (reindexEquiv K υ τ p r) (chartNormal K K υ p e q)= + chartNormal K K τ p (r.symm.trans e) (reindexChart K υ τ p r q) := by + rw [chartNormal,reindexForms_normalCycle K _ _ υ τ r (reindexEquiv K υ τ p r) + (chartDerivative K K υ p) (chartDerivative K K τ p) + (reindexEquiv_partial K υ τ p r)] + change normalCycle K (Ring K τ (fun _ => p)) τ (chartDerivative K K τ p) p _=_ + congr 1 + simp only [normalCoordinates,List.map_ofFn,Function.comp_def] + congr 1 + funext j + simp only [reindexChart,AlgEquiv.symm_trans_apply,AlgEquiv.symm_symm, + Equiv.symm_trans_apply,Equiv.symm_symm,reindexEquiv_symm_coord,Equiv.symm_apply_apply] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) [CharP K p] +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct +open Forms FrobeniusTruncation +variable (K : Type*) [Field K] (N p : ℕ) + +theorem residueForm_topCoefficient (hp : 0 simp only [map_add,hω,hη] + | tmul a v => + rw [residueForm_tmul,topCoefficient_tmul,map_smul,smul_eq_mul,mul_comm] + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open scoped TensorProduct +open PD4Tensor.Forms PD4Tensor.TruncatedForms +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + [CharP K p] {N : ℕ} + + + +def orientedResidue (hp : 0 p)) σ →ₗ[K] K := + (residueForm K (Fin N) p hp (topExterior K N)).comp + (reindexForms K _ _ σ (Fin N) r (reindexEquiv K σ (Fin N) p r)).toLinearMap + +theorem orientedResidue_stokes (hp : 0 p)) σ) : + orientedResidue K σ p hp r + (differential K (Ring K σ (fun _ => p)) σ (chartDerivative K K σ p) ω)=0 := by + change residueForm K (Fin N) p hp (topExterior K N) + (reindexForms K _ _ σ (Fin N) r (reindexEquiv K σ (Fin N) p r) + (differential K _ σ (chartDerivative K K σ p) ω))=0 + rw [reindexForms_differential K _ _ σ (Fin N) r (reindexEquiv K σ (Fin N) p r) + (chartDerivative K K σ p) (chartDerivative K K (Fin N) p) + (reindexEquiv_partial K σ (Fin N) p r)] + exact stokes K (Fin N) p hp (topExterior K N) _ + +theorem orientedResidue_closed_exact (hp : 0 p)) σ) + (hω : differential K (Ring K σ (fun _ => p)) σ (chartDerivative K K σ p) ω=0) : + orientedResidue K σ p hp r + (ω * differential K (Ring K σ (fun _ => p)) σ (chartDerivative K K σ p) η)=0 := by + have h := orientedResidue_stokes K σ p hp r (parity K _ σ ω * η) + rw [differential_mul (chartDerivative K K σ p) (partial_mul K σ p),differential_parity,hω,map_zero,neg_zero, + zero_mul,zero_add,parity_parity] at h + exact h + +variable [Fact p.Prime] [Invertible (2 : K)] {c d : ℕ} + + +theorem orientedResidue_chartNormal_pair + (r : σ ≃ Fin (c+d)) (e : σ ≃ Fin d ⊕ Fin c) + (q : Ring K σ (fun _ => p) ≃ₐ[K] Ring K σ (fun _ => p)) : + orientedResidue K σ p (Fact.out : p.Prime).pos r + (chartNormal K K σ p e q * chartNormal K K σ p (e.trans (Equiv.sumComm _ _)) q)≠0 := by + change residueForm K (Fin (c+d)) p _ (topExterior K (c+d)) + (reindexForms K _ _ σ (Fin (c+d)) r (reindexEquiv K σ (Fin (c+d)) p r) + (chartNormal K K σ p e q * chartNormal K K σ p (e.trans (Equiv.sumComm _ _)) q))≠0 + rw [map_mul, + chartNormal_reindex,chartNormal_reindex] + intro hzero + apply chartNormal_pair_nonzero K c d p (r.symm.trans e) + (reindexChart K σ (Fin (c+d)) p r q) + exact (residueForm_topCoefficient K (c+d) p (Fact.out : p.Prime).pos _).symm.trans hzero + +end +end PD4Tensor.FiniteCoordinates +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/ClosedSpecialization.lean b/lean/OAI/Algebra/FiniteTensor/ClosedSpecialization.lean new file mode 100644 index 0000000000000000000000000000000000000000..07e5f23eef13eb0e31ee76cbb007ed22a4a15795 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/ClosedSpecialization.lean @@ -0,0 +1,109 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.PositiveObstruction +import OAI.Algebra.FiniteTensor.ScalarModels + +namespace OAI + +/-! Closed-point specialization of finite-type tensor models. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading + + +theorem intJacobson : IsJacobsonRing ℤ := by + apply isJacobsonRing_iff_prime_eq.mpr + intro I hI + by_cases h : I = ⊥ + · subst I + apply le_antisymm + · intro x hx + have hu := Ideal.mem_jacobson_bot.mp hx (3 : ℤ) + rcases Int.isUnit_eq_one_or hu with h | h <;> + simp only [Ideal.mem_bot] <;> omega + · exact Ideal.le_jacobson + · let : I.IsMaximal := hI.isMaximal h + exact Ideal.jacobson_eq_self_of_isMaximal + + + +theorem field_finiteType_char_ne_zero (E : Type*) [Field E] + [Algebra.FiniteType ℤ E] : ringChar E ≠ 0 := by + let : IsJacobsonRing ℤ := intJacobson + let : Module.Finite ℤ E := finite_of_finite_type_of_isJacobsonRing ℤ E + intro hz + have : CharP E 0 := hz ▸ (inferInstance : CharP E (ringChar E)) + have : CharZero E := CharP.charP_to_charZero E + exact Int.not_isField (isField_of_isIntegral_of_isField + (FaithfulSMul.algebraMap_injective ℤ E) (Field.toIsField E)) + + + +theorem exists_odd_closed_point (A : Type*) [CommRing A] [Nontrivial A] + [Algebra.FiniteType ℤ A] (h2 : IsUnit (2 : A)) : + ∃ I : Ideal A, I.IsMaximal ∧ (ringChar (A ⧸ I)).Prime ∧ ringChar (A ⧸ I) ≠ 2 := by + obtain ⟨I,hI⟩ := Ideal.exists_maximal A + let : I.IsMaximal := hI + let : Field (A ⧸ I) := Ideal.Quotient.field I + let : Algebra.FiniteType ℤ (A ⧸ I) := Algebra.FiniteType.quotient ℤ I + have hp : (ringChar (A ⧸ I)).Prime := + (CharP.char_is_prime_or_zero (A ⧸ I) (ringChar (A ⧸ I))).resolve_right + (@field_finiteType_char_ne_zero (A ⧸ I) (Ideal.Quotient.field I) (by + convert (Algebra.FiniteType.quotient ℤ I) using 1 + rfl)) + refine ⟨I,hI,hp,?_⟩ + intro heq + have hu : IsUnit (2 : A ⧸ I) := by + simpa only [map_ofNat] using (Ideal.Quotient.mk I).isUnit_map h2 + apply hu.ne_zero + have hz := CharP.cast_eq_zero (A ⧸ I) (ringChar (A ⧸ I)) + simpa only [heq,Nat.cast_ofNat] using hz + +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +universe u +variable {l : ℕ} (σ : Fin l → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + + + +theorem no_tensor_model_field (K : Type*) [Field K] (p : ℕ) [CharP K p] [Fact p.Prime] + (hp : p ≠ 2) {m d c : ℕ} (e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c) + (hm : 5 ≤ m) (active : Fin m ↪ Fin l) (M : TensorModel K σ m d c e active) : False := by + have h2 : (2 : K) ≠ 0 := by + intro hz + have hd : p ∣ 2 := (CharP.cast_eq_zero_iff K p 2).mp hz + rcases (Nat.dvd_prime Nat.prime_two).mp hd with h1 | h2 + · exact (Fact.out : p.Prime).ne_one h1 + · exact hp h2 + let : Invertible (2 : K) := invertibleOfNonzero h2 + have hc := PD4Tensor.joinedMatrix_complementary e + (fun i j => augmentation K m (MvPowerSeries.coeff (Finsupp.single j 1) (M.H i))) + (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (M.G i)) M.tangent_unit.ne_zero + exact PD4Tensor.TruncatedForms.formal_active_obstruction_any K σ p e hm + M.F active M.b M.H M.G M.H_zero M.G_zero hc.1 hc.2.1 hc.2.2 + M.left_vanishing M.right_vanishing M.left_triple M.right_triple + + + +theorem no_tensor_model_finiteType (A : Type*) [CommRing A] [Nontrivial A] + [Algebra.FiniteType ℤ A] (h2 : IsUnit (2 : A)) {m d c : ℕ} + (e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c) (hm : 5 ≤ m) (active : Fin m ↪ Fin l) : + IsEmpty (TensorModel A σ m d c e active) := by + constructor + intro M + obtain ⟨I,hI,hp,hp2⟩ := exists_odd_closed_point A h2 + let : I.IsMaximal := hI + let : Field (A ⧸ I) := Ideal.Quotient.field I + let : Fact (ringChar (A ⧸ I)).Prime := ⟨hp⟩ + exact no_tensor_model_field σ (A ⧸ I) (ringChar (A ⧸ I)) hp2 e hm active + (M.map (Ideal.Quotient.mk I)) + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/CoefficientDescent.lean b/lean/OAI/Algebra/FiniteTensor/CoefficientDescent.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3cf9cf955066957ac985fde3d4200c812c7f52e --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/CoefficientDescent.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.BoxCoefficients + +namespace OAI + +/-! Exact coefficient descent of formal tensor models. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +universe u +variable {K : Type*} [Field K] {l m : ℕ} {σ : Fin l → Type u} + [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + {d c : ℕ} {e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} + +structure CoefficientsIn (R : Subring K) (M : TensorModel K σ m d c e active) + (W : TensorPrimitives K σ m M) : Prop where + F : ∀ i b,MvPowerSeries.coeff b (M.F i)∈R + b : ∀ i a,MvPowerSeries.coeff a (M.b i)∈R + H : ∀ v q b,MvPowerSeries.coeff b (boxSeries K m q (M.H v))∈R + G : ∀ v b,MvPowerSeries.coeff b (M.G v)∈R + left : ∀ t v q b,MvPowerSeries.coeff b (boxSeries K m q (W.left t v))∈R + right : ∀ t v b,MvPowerSeries.coeff b (W.right t v)∈R + det_inv : (tangent K σ m e M.H M.G).det⁻¹∈R + + theorem injective_map_series {A B τ : Type*} [CommRing A] [CommRing B] + (f : A →+* B) (hf : Function.Injective f) : + Function.Injective (MvPowerSeries.map (σ:=τ) f) := by + intro x y h + ext a + apply hf + exact congrArg (MvPowerSeries.coeff a) h + + + +def descendTensorModel (R : Subring K) (M : TensorModel K σ m d c e active) + (W : TensorPrimitives K σ m M) (h : CoefficientsIn R M W) : + TensorModel R σ m d c e active := by + let F := fun i => MvPowerSeries.toSubring (M.F i) R (h.F i) + let b := fun i => MvPowerSeries.toSubring (M.b i) R (h.b i) + let H := fun v => liftParameterSeries R (M.H v) (h.H v) + let G := fun v => MvPowerSeries.toSubring (M.G v) R (h.G v) + let L := fun t v => liftParameterSeries R (W.left t v) (h.left t v) + let U := fun t v => MvPowerSeries.toSubring (W.right t v) R (h.right t v) + have hF : ∀ i,MvPowerSeries.map R.subtype (F i)=M.F i := fun _ => rfl + have hb : ∀ i,MvPowerSeries.map R.subtype (b i)=M.b i := fun _ => rfl + have hH : ∀ v,MvPowerSeries.map (mapParameters R.subtype) (H v)=M.H v := + fun v => map_liftParameterSeries R (M.H v) (h.H v) + have hG : ∀ v,MvPowerSeries.map R.subtype (G v)=M.G v := fun _ => rfl + have hL : ∀ t v,MvPowerSeries.map (mapParameters R.subtype) (L t v)=W.left t v := + fun t v => map_liftParameterSeries R (W.left t v) (h.left t v) + have hU : ∀ t v,MvPowerSeries.map R.subtype (U t v)=W.right t v := fun _ _ => rfl + have H0 : ∀ v,MvPowerSeries.constantCoeff (H v)∈parameterIdeal R m := by + intro v + apply (mapParameters_mem_iff R.subtype Subtype.val_injective _).mp + have hh := congrArg MvPowerSeries.constantCoeff (hH v) + rw [MvPowerSeries.constantCoeff_map] at hh + rw [hh] + exact M.H_zero v + have G0 : ∀ v,MvPowerSeries.constantCoeff (G v)=0 := by + intro v + apply Subtype.val_injective + exact M.G_zero v + have Hsub := hasSubst_parameters R m H H0 + have Gsub := MvPowerSeries.hasSubst_of_constantCoeff_zero G0 + have hdet : R.subtype (tangent R σ m e H G).det=(tangent K σ m e M.H M.G).det := by + rw [R.subtype.map_det] + change ((tangent R σ m e H G).map R.subtype).det=_ + rw [map_tangent] + simp only [hH,hG] + have hunit : IsUnit (tangent R σ m e H G).det := by + let v : R := ⟨(tangent K σ m e M.H M.G).det⁻¹,h.det_inv⟩ + have hn := isUnit_iff_ne_zero.mp M.tangent_unit + have h1 : (tangent R σ m e H G).det*v=1 := by + apply Subtype.val_injective + change R.subtype (tangent R σ m e H G).det*(tangent K σ m e M.H M.G).det⁻¹=1 + rw [hdet,mul_inv_cancel₀ hn] + exact ⟨⟨(tangent R σ m e H G).det,v,h1,by simpa only [mul_comm] using h1⟩,rfl⟩ + refine { + F := F,b := b,H := H,G := G,H_zero := H0,G_zero := G0,tangent_unit := hunit + F_zero := ?_,b_zero := ?_,left_vanishing := ?_,right_vanishing := ?_ + left_triple := ?_,right_triple := ?_ } + · intro i + apply Subtype.val_injective + exact M.F_zero i + · intro i + apply Subtype.val_injective + exact M.b_zero i + · apply injective_map_series (mapParameters R.subtype) (mapParameters_injective R.subtype Subtype.val_injective) + simpa only [MvPowerSeries.map_subst Hsub,map_deformed,hH,hF,hb,map_zero] using M.left_vanishing + · apply injective_map_series R.subtype Subtype.val_injective + simpa only [MvPowerSeries.map_subst Gsub,map_potential,hG,hF,map_zero] using M.right_vanishing + · intro i j k hij hik hjk + let q : Triple m := ⟨(i,j,k),hij,hik,hjk⟩ + apply Ideal.mem_span_range_iff_exists_fun.mpr + refine ⟨L q,?_⟩ + apply injective_map_series (mapParameters R.subtype) (mapParameters_injective R.subtype Subtype.val_injective) + simp only [map_sum,map_mul,hL,MvPowerSeries.map_subst Hsub,PD4Tensor.map_formal_pderiv, + map_deformed,hH,hF,hb,MvPowerSeries.map_C,mapParameters_parameter] + simpa only [map_mul] using W.left_eq q + · intro i j k hij hik hjk + let q : Triple m := ⟨(i,j,k),hij,hik,hjk⟩ + apply Ideal.mem_span_range_iff_exists_fun.mpr + refine ⟨U q,?_⟩ + apply injective_map_series R.subtype Subtype.val_injective + simp only [map_sum,map_mul,hU,MvPowerSeries.map_subst Gsub,PD4Tensor.map_formal_pderiv, + map_potential,hG,hF,map_perturbation,hb] + exact W.right_eq q + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +open scoped BigOperators +open Finsupp +variable {K σ : Type*} [Field K] + +def seriesOver (A : Subring K) : Subring (MvPowerSeries σ K) := + (MvPowerSeries.map A.subtype).range + + theorem mem_seriesOver (A : Subring K) (F : MvPowerSeries σ K) : + F∈seriesOver A ↔ ∀ d,MvPowerSeries.coeff d F∈A := by + constructor + · rintro ⟨G,rfl⟩ d + exact (MvPowerSeries.coeff d G).property + · intro h + exact ⟨MvPowerSeries.toSubring F A h,rfl⟩ + +variable [LinearOrder σ] [WellFoundedGT σ] + + + +theorem coefficients_of_product (A : Subring K) (D H : MvPowerSeries σ K) + (a : σ →₀ ℕ) (ha : MvPowerSeries.coeff a D≠0) + (hmin : ∀ u,toLex u MvPowerSeries.coeff (ofLex b) H∈A) b ?_ + intro b ih + let c := ofLex b + have hin : (a,c)∈Finset.HasAntidiagonal.antidiagonal (a+c) := by simp + have hsum : (∑ uv∈(Finset.HasAntidiagonal.antidiagonal (a+c)).erase (a,c), + MvPowerSeries.coeff uv.1 D*MvPowerSeries.coeff uv.2 H)∈A := by + apply A.sum_mem + rintro ⟨u,v⟩ huv + have huv' := (Finset.mem_erase.mp huv).2 + have hn := (Finset.mem_erase.mp huv).1 + have heq : u+v=a+c := Finset.HasAntidiagonal.mem_antidiagonal.mp huv' + by_cases hu : toLex u hqZ _, ?_, ?_, ?_, ?_, ?_⟩ + · intro b hb; simp [hqB b hb] + · intro z hz + simpa only [LinearMap.comp_apply, hqcycle z hz] using hqmod z hz + · intro w hw; exact hqW _ (hqW w hw) + · ext v + simp only [LinearMap.comp_apply, hqcycle (q v) (hqZ v)] + · ext v + simp only [LinearMap.comp_apply, hqg] + + + +theorem exists_contraction (δ p : V →ₗ[K] V) + (hδ : ∀ v, δ (δ v) = 0) + (hpZ : ∀ v, δ (p v) = 0) + (hpB : ∀ v, p (δ v) = 0) + (hpmod : ∀ z, δ z=0 → z-p z∈LinearMap.range δ) + (hpp : ∀ v, p (p v)= p v) : + ∃ h : V →ₗ[K] V, ∀ v, δ (h v) + h (δ v) = v - p v := by + obtain ⟨s₀, hs₀⟩ := δ.rangeRestrict.exists_rightInverse_of_surjective δ.range_rangeRestrict + have hs₀v (b : LinearMap.range δ) : δ (s₀ b) = b := by + exact congrArg Subtype.val (LinearMap.congr_fun hs₀ b) + let s : LinearMap.range δ →ₗ[K] V := (LinearMap.id - p).comp s₀ + have hs (b : LinearMap.range δ) : δ (s b) = b := by + change δ (s₀ b-p (s₀ b)) = b + rw [map_sub, hpZ, sub_zero, hs₀v] + have hps (b : LinearMap.range δ) : p (s b)=0 := by + change p (s₀ b-p (s₀ b))=0 + rw [map_sub, hpp, sub_self] + let z : V →ₗ[K] V := LinearMap.id - p - s.comp δ.rangeRestrict + have hz (v : V) : z v = v-p v-s (δ.rangeRestrict v) := rfl + have hzB (v : V) : z v∈LinearMap.range δ := by + have hd : δ (z v)=0 := by + rw [hz, map_sub, map_sub, hpZ, hs] + change δ v-0-δ v=0 + abel + have hp : p (z v)=0 := by + rw [hz, map_sub, map_sub, hpp, hps]; abel + simpa only [hp, sub_zero] using hpmod (z v) hd + let zB : V →ₗ[K] LinearMap.range δ := z.codRestrict _ hzB + refine ⟨s.comp zB, ?_⟩ + intro v + change δ (s (zB v)) + s (zB (δ v)) = v-p v + rw [hs] + have hzd : zB (δ v)=δ.rangeRestrict v := by + apply Subtype.ext + change z (δ v)=δ v + rw [hz, hpB] + have he : δ.rangeRestrict (δ v)=0 := by + apply Subtype.ext + exact hδ v + rw [he, map_zero, sub_zero, sub_zero] + rw [hzd] + change z v+s (δ.rangeRestrict v)=v-p v + rw [hz, sub_add_cancel] + + +theorem exists_odd_contraction [Invertible (2 : K)] (δ p g : V →ₗ[K] V) + (hg : ∀ v, g (g v)=v) + (hdg : ∀ v, δ (g v) = -g (δ v)) + (hpg : ∀ v, p (g v) = g (p v)) + (hhom : ∃ h : V →ₗ[K] V, ∀ v, δ (h v)+h (δ v)=v-p v) : + ∃ h : V →ₗ[K] V, + (∀ v, δ (h v)+h (δ v)=v-p v) ∧ (∀ v, h (g v) = -g (h v)) := by + obtain ⟨h, hh⟩ := hhom + let c : K := (2 : K)⁻¹ + have hc : c+c=1 := by + dsimp [c] + rw [← mul_two, inv_mul_cancel₀ (isUnit_of_invertible (2 : K)).ne_zero] + let q : V →ₗ[K] V := c • (h-g.comp (h.comp g)) + have hq (v : V) : q v=c • (h v-g (h (g v))) := rfl + have hgd (v : V) : g (δ v) = -δ (g v) := by rw [hdg, neg_neg] + refine ⟨q, ?_, ?_⟩ + · intro v + rw [hq, hq] + simp only [map_smul, map_sub] + rw [hdg, hgd v] + simp only [map_neg, sub_neg_eq_add] + calc + c • (δ (h v) + g (δ (h (g v)))) + c • (h (δ v) + g (h (δ (g v)))) = + c • ((δ (h v)+h (δ v)) + g (δ (h (g v))+h (δ (g v)))) := by + simp only [map_add, smul_add]; abel + _ = c • ((v-p v)+g (g v-p (g v))) := by rw [hh, hh] + _ = (c+c) • (v-p v) := by rw [map_sub, hpg, hg, hg, smul_add, add_smul] + _ = v-p v := by rw [hc, one_smul] + · intro v + simp only [hq, hg, map_smul, map_sub, smul_sub, neg_sub] + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct +variable (K V : Type*) [Field K] [AddCommGroup V] [Module K V] + + + +structure SuperReduction where + d : V →ₗ[K] V + g : V →ₗ[K] V + p : V →ₗ[K] V + h : V →ₗ[K] V + dd : ∀ v, d (d v)=0 + gg : ∀ v, g (g v)=v + dg : ∀ v, d (g v) = -g (d v) + dp : ∀ v, d (p v)=0 + pd : ∀ v, p (d v)=0 + pp : ∀ v, p (p v)=p v + pg : ∀ v, p (g v)=g (p v) + hom : ∀ v, d (h v)+h (d v)=v-p v + hg : ∀ v, h (g v) = -g (h v) + +variable {K V} + +theorem exists_superReduction [Invertible (2 : K)] (d g : V →ₗ[K] V) + (hdd : ∀ v, d (d v)=0) (hgg : ∀ v, g (g v)=v) + (hdg : ∀ v, d (g v) = -g (d v)) (W : Submodule K V) + (hgW : ∀ v∈W, g v∈W) : + ∃ C : SuperReduction K V, C.d=d ∧ C.g=g ∧ ∀ w∈W, C.p w∈W := by + have hBZ : LinearMap.range d ≤ LinearMap.ker d := by + rintro _ ⟨v, rfl⟩; exact hdd v + have hgB : ∀ b∈LinearMap.range d, g b∈LinearMap.range d := by + rintro _ ⟨v, rfl⟩ + exact ⟨-g v, by rw [map_neg, hdg, neg_neg]⟩ + have hgZ : ∀ z∈LinearMap.ker d, g z∈LinearMap.ker d := by + intro z hz; change d (g z)=0 + rw [hdg, hz, map_zero, neg_zero] + obtain ⟨p, hpZ, hpB, hpmod, hpW, hpp, hpg⟩ := + exists_even_cohomology_projection (LinearMap.range d) (LinearMap.ker d) W hBZ + g hgg hgB hgZ hgW + have hpd (v : V) : p (d v)=0 := hpB _ (LinearMap.mem_range_self d v) + have hdp (v : V) : d (p v)=0 := hpZ v + have hppv : ∀ v, p (p v)=p v := LinearMap.congr_fun hpp + have hpgv : ∀ v, p (g v)=g (p v) := LinearMap.congr_fun hpg + obtain ⟨h, hhom, hhg⟩ := exists_odd_contraction d p g hgg hdg hpgv + (exists_contraction d p hdd hdp hpd hpmod hppv) + exact ⟨⟨d,g,p,h,hdd,hgg,hdg,hdp,hpd,hppv,hpgv,hhom,hhg⟩, rfl, rfl, hpW⟩ + +variable {W : Type*} [AddCommGroup W] [Module K W] +namespace SuperReduction + +def tensorD (C : SuperReduction K V) (E : SuperReduction K W) : + V ⊗[K] W →ₗ[K] V ⊗[K] W := + TensorProduct.map C.d LinearMap.id + TensorProduct.map C.g E.d + +def tensorG (C : SuperReduction K V) (E : SuperReduction K W) : + V ⊗[K] W →ₗ[K] V ⊗[K] W := TensorProduct.map C.g E.g + +def tensorP (C : SuperReduction K V) (E : SuperReduction K W) : + V ⊗[K] W →ₗ[K] V ⊗[K] W := TensorProduct.map C.p E.p + +def tensorH (C : SuperReduction K V) (E : SuperReduction K W) : + V ⊗[K] W →ₗ[K] V ⊗[K] W := + TensorProduct.map C.h LinearMap.id + TensorProduct.map (C.p.comp C.g) E.h + +@[simp] theorem tensorD_tmul (C : SuperReduction K V) (E : SuperReduction K W) (v : V) (w : W) : + tensorD C E (v ⊗ₜ[K] w) = C.d v ⊗ₜ[K] w + C.g v ⊗ₜ[K] E.d w := by simp [tensorD] + +@[simp] theorem tensorG_tmul (C : SuperReduction K V) (E : SuperReduction K W) (v : V) (w : W) : + tensorG C E (v ⊗ₜ[K] w) = C.g v ⊗ₜ[K] E.g w := rfl + +@[simp] theorem tensorP_tmul (C : SuperReduction K V) (E : SuperReduction K W) (v : V) (w : W) : + tensorP C E (v ⊗ₜ[K] w) = C.p v ⊗ₜ[K] E.p w := rfl + +@[simp] theorem tensorH_tmul (C : SuperReduction K V) (E : SuperReduction K W) (v : V) (w : W) : + tensorH C E (v ⊗ₜ[K] w) = C.h v ⊗ₜ[K] w + C.p (C.g v) ⊗ₜ[K] E.h w := by simp [tensorH] + + +theorem tensor_hom (C : SuperReduction K V) (E : SuperReduction K W) (ω : V ⊗[K] W) : + tensorD C E (tensorH C E ω) + tensorH C E (tensorD C E ω) = ω - tensorP C E ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp only [map_add]; rw [add_add_add_comm, ha, hb, add_sub_add_comm] + | tmul v w => + simp only [tensorH_tmul, tensorD_tmul, tensorP_tmul, map_add, C.pg, C.pd, + C.gg, C.hg, C.dg, C.dp, map_zero, neg_zero, TensorProduct.zero_tmul, zero_add, TensorProduct.neg_tmul] + calc + _ = (C.d (C.h v)+C.h (C.d v)) ⊗ₜ[K] w + + C.p v ⊗ₜ[K] (E.d (E.h w)+E.h (E.d w)) := by + simp only [TensorProduct.add_tmul, TensorProduct.tmul_add]; abel + _ = _ := by rw [C.hom, E.hom]; simp [TensorProduct.sub_tmul, TensorProduct.tmul_sub] + + +def tensor (C : SuperReduction K V) (E : SuperReduction K W) : SuperReduction K (V ⊗[K] W) where + d := tensorD C E + g := tensorG C E + p := tensorP C E + h := tensorH C E + dd ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb] + | tmul v w => simp [C.dd, E.dd, C.dg, TensorProduct.neg_tmul] + gg ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb] + | tmul v w => simp [C.gg, E.gg] + dg ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb]; abel + | tmul v w => simp [C.dg, E.dg, C.gg, TensorProduct.neg_tmul, TensorProduct.tmul_neg]; abel + dp ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb] + | tmul v w => simp [C.dp, E.dp] + pd ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb] + | tmul v w => simp [C.pd, E.pd] + pp ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb] + | tmul v w => simp [C.pp, E.pp] + pg ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb] + | tmul v w => simp [C.pg, E.pg] + hom := tensor_hom C E + hg ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb]; abel + | tmul v w => simp [C.hg, E.hg, C.pg, C.gg, TensorProduct.neg_tmul, TensorProduct.tmul_neg]; abel + + + +theorem tensor_cycle_mod_projection (C : SuperReduction K V) (E : SuperReduction K W) + (ω : V ⊗[K] W) (hω : tensorD C E ω=0) : + ω-tensorP C E ω ∈ LinearMap.range (tensorD C E) := by + refine ⟨tensorH C E ω, ?_⟩ + have h := tensor_hom C E ω + simpa only [hω, map_zero, add_zero] using h + +end SuperReduction +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct +variable {K ι : Type*} [Field K] [Fintype ι] [LinearOrder ι] +variable {E : ι → Type*} [∀ i, AddCommGroup (E i)] [∀ i, Module K (E i)] +namespace SuperReduction +variable (C : ∀ i, SuperReduction K (E i)) + +def dcoord (i j : ι) : E j →ₗ[K] E j := + if j < i then (C j).g else if j = i then (C j).d else LinearMap.id + +def hcoord (i j : ι) : E j →ₗ[K] E j := + if j < i then (C j).g else if j = i then (C j).h else (C j).p + +def finiteD : (⨂[K] i, E i) →ₗ[K] (⨂[K] i, E i) := + ∑ i, PiTensorProduct.map (dcoord C i) + +def finiteH : (⨂[K] i, E i) →ₗ[K] (⨂[K] i, E i) := + ∑ i, PiTensorProduct.map (hcoord C i) + +def finiteP : (⨂[K] i, E i) →ₗ[K] (⨂[K] i, E i) := + PiTensorProduct.map (fun i => (C i).p) + +omit [Fintype ι] in +private theorem coord_dh_lt (i j : ι) (hij : i < j) (v : ∀ i, E i) : + (fun k => dcoord C i k (hcoord C j k (v k))) = + Function.update (fun k => hcoord C j k (dcoord C i k (v k))) i + (-hcoord C j i (dcoord C i i (v i))) := by + funext k + by_cases hki : k=i + · subst k + simp [dcoord, hcoord, hij, (C i).dg] + · rw [Function.update_of_ne hki] + by_cases hkj : k=j + · subst k; simp [dcoord, hcoord, hij.not_gt, hki] + · by_cases hkin : k < i + · simp [dcoord, hcoord, hkin, hkin.trans hij] + · by_cases hkjn : k < j + · simp [dcoord, hcoord, hkin, hkjn, hki] + · simp [dcoord, hcoord, hkin, hkjn, hki, hkj] + +omit [Fintype ι] in +private theorem pair_offdiagonal (i j : ι) (hij : i ≠ j) : + (PiTensorProduct.map (dcoord C i)).comp (PiTensorProduct.map (hcoord C j)) + + (PiTensorProduct.map (hcoord C j)).comp (PiTensorProduct.map (dcoord C i)) = 0 := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply, LinearMap.add_apply, + LinearMap.comp_apply, PiTensorProduct.map_tprod, LinearMap.zero_apply] + rcases hij.lt_or_gt with hlt | hgt + · rw [coord_dh_lt C i j hlt v, (PiTensorProduct.tprod K).map_update_neg, + Function.update_eq_self] + exact neg_add_cancel _ + · have hz₁ : PiTensorProduct.tprod K (fun k => dcoord C i k (hcoord C j k (v k)))=0 := by + apply (PiTensorProduct.tprod K).map_coord_zero i + simp [dcoord, hcoord, hgt.not_gt, ne_of_gt hgt, (C i).dp] + have hz₂ : PiTensorProduct.tprod K (fun k => hcoord C j k (dcoord C i k (v k)))=0 := by + apply (PiTensorProduct.tprod K).map_coord_zero i + simp [dcoord, hcoord, hgt.not_gt, ne_of_gt hgt, (C i).pd] + rw [hz₁, hz₂, zero_add] + +omit [Fintype ι] in +private theorem pair_diagonal (i : ι) : + (PiTensorProduct.map (dcoord C i)).comp (PiTensorProduct.map (hcoord C i)) + + (PiTensorProduct.map (hcoord C i)).comp (PiTensorProduct.map (dcoord C i)) = + PiTensorProduct.map (fun j => if j < i then LinearMap.id else + if j=i then LinearMap.id-(C j).p else (C j).p) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply, LinearMap.add_apply, + LinearMap.comp_apply, PiTensorProduct.map_tprod] + let q : ∀ j, E j := fun j => if j < i then v j else (C j).p (v j) + have h₁ : (fun j => dcoord C i j (hcoord C i j (v j))) = + Function.update q i ((C i).d ((C i).h (v i))) := by + funext j + by_cases hji : j=i + · subst j; simp [dcoord,hcoord] + · by_cases hlt : j < i <;> simp [dcoord,hcoord,q,hji,hlt,(C j).gg] + have h₂ : (fun j => hcoord C i j (dcoord C i j (v j))) = + Function.update q i ((C i).h ((C i).d (v i))) := by + funext j + by_cases hji : j=i + · subst j; simp [dcoord,hcoord] + · by_cases hlt : j < i <;> simp [dcoord,hcoord,q,hji,hlt,(C j).gg] + rw [h₁,h₂,← (PiTensorProduct.tprod K).map_update_add,(C i).hom] + congr 1 + funext j + by_cases hji : j=i + · subst j; simp + · by_cases hlt : j < i <;> simp [q,hji,hlt] + + +theorem finite_hom : (finiteD C).comp (finiteH C) + (finiteH C).comp (finiteD C) = + LinearMap.id-finiteP C := by + apply LinearMap.ext + intro v + simp only [finiteD, finiteH, LinearMap.comp_apply, LinearMap.add_apply, + LinearMap.sum_apply, map_sum] + rw [Finset.sum_comm, ← Finset.sum_add_distrib] + have hdiag : ∑ j, ((∑ i, PiTensorProduct.map (dcoord C j) + (PiTensorProduct.map (hcoord C i) v)) + + ∑ i, PiTensorProduct.map (hcoord C i) + (PiTensorProduct.map (dcoord C j) v)) = + ∑ j, PiTensorProduct.map (fun k => if k < j then LinearMap.id else + if k=j then LinearMap.id-(C k).p else (C k).p) v := by + apply Finset.sum_congr rfl + intro j _ + rw [← Finset.sum_add_distrib, Finset.sum_eq_single j] + · exact LinearMap.congr_fun (pair_diagonal C j) v + · intro i _ hij; exact LinearMap.congr_fun (pair_offdiagonal C j i hij.symm) v + · simp + rw [hdiag] + have ht := (PiTensorProduct.mapMultilinear K E E).map_sub_map_piecewise + (fun i => (LinearMap.id : E i →ₗ[K] E i)) (fun i => (C i).p) Finset.univ + simp only [Finset.piecewise_univ, Finset.mem_univ, true_implies] at ht + change PiTensorProduct.map (fun i => LinearMap.id) - PiTensorProduct.map (fun i => (C i).p) = + ∑ i, PiTensorProduct.map (fun j => if j < i then LinearMap.id else + if i=j then LinearMap.id-(C j).p else (C j).p) at ht + rw [PiTensorProduct.map_id] at ht + have hs : (∑ i, PiTensorProduct.map (fun j => if j < i then LinearMap.id else + if i=j then LinearMap.id-(C j).p else (C j).p)) = + ∑ i, PiTensorProduct.map (fun j => if j < i then LinearMap.id else + if j=i then LinearMap.id-(C j).p else (C j).p) := by + apply Finset.sum_congr rfl + intro i _ + congr 1 + funext j + simp only [eq_comm] + rw [hs] at ht + simpa only [finiteP, LinearMap.sum_apply] using LinearMap.congr_fun ht.symm v + + +theorem finite_cycle_mod_projection (v : ⨂[K] i, E i) (hv : finiteD C v=0) : + v - finiteP C v ∈ LinearMap.range (finiteD C) := by + refine ⟨finiteH C v, ?_⟩ + have h := LinearMap.congr_fun (finite_hom C) v + simpa only [LinearMap.add_apply,LinearMap.comp_apply,LinearMap.sub_apply, + LinearMap.id_apply,hv,map_zero,add_zero] using h + +end SuperReduction +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/CompatibleCharts.lean b/lean/OAI/Algebra/FiniteTensor/CompatibleCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea53859459404a2afd8bbd3e3277f84ff257fbd0 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/CompatibleCharts.lean @@ -0,0 +1,391 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ComplementaryGraphs + +namespace OAI + +/-! Formal graph charts, compatible moving coordinates and actual gradient ideals. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K ι υ σ τ : Type*) [Field K] [Fintype ι] + [Fintype υ] [DecidableEq υ] [Fintype σ] [Fintype τ] + (a : ι → ℕ) (p : ℕ) [Fact p.Prime] [CharP K p] + (ha : ∀ i,0 constantMap K ι a ha + (MvPowerSeries.coeff (Finsupp.single j 1) (combinedGraph (Ring K ι a) υ σ τ e H G i)))≠0) : + ∃ q : Ring (Ring K ι a) υ (fun _ => p) ≃ₐ[Ring K ι a] Ring (Ring K ι a) υ (fun _ => p), + ∀ i, splitRestriction (Fact.out : p.Prime).pos e q + (coord (Ring K ι a) υ (fun _ => p) i)= + nilEval (Ring K ι a) (coord (Ring K ι a) σ (fun _ => p)) + (fun j => ⟨p,coord_pow _ _ _ j⟩) (H i) := by + let c := combinedGraph (Ring K ι a) υ σ τ e H G + have hc (i : υ) : constantMap K ι a ha (MvPowerSeries.constantCoeff (c i))=0 := by + simp only [c,combinedGraph_constantCoeff,hG,add_zero,hH] + let q := AlgEquiv.ofBijective (movingSubst K ι υ a p ha hap c hc) + (movingSubst_bijective K ι υ a p ha hap c hc hdet) + refine ⟨q,?_⟩ + intro i + change planeRestriction (Ring K ι a) υ σ τ p e (Fact.out : p.Prime).pos + (movingSubst K ι υ a p ha hap c hc (coord (Ring K ι a) υ (fun _ => p) i))=_ + rw [movingSubst_coord] + exact combinedGraph_eval_left (Ring K ι a) υ σ τ p e (Fact.out : p.Prime).pos H G hG i + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K R S υ : Type*) [Field K] [CommRing R] [CommRing S] + [Algebra K R] [Algebra K S] (a : υ → ℕ) + +theorem substitution_specialization (r : R →ₐ[K] S) + (f : Ring R υ a →ₐ[R] Ring R υ a) (g : Ring S υ a →ₐ[S] Ring S υ a) + (h : ∀ i, coefficientHom K R S υ a r (f (coord R υ a i))= + g (coord S υ a i)) (v : Ring R υ a) : + coefficientHom K R S υ a r (f v)=g (coefficientHom K R S υ a r v) := by + have heq : (coefficientHom K R S υ a r).comp (f.restrictScalars K)= + (g.restrictScalars K).comp (coefficientHom K R S υ a r) := by + apply Ideal.Quotient.algHom_ext + apply AlgHom.coe_ringHom_injective + apply MvPolynomial.ringHom_ext + · intro b + change coefficientHom K R S υ a r (f (algebraMap R (Ring R υ a) b))= + g (coefficientHom K R S υ a r (algebraMap R (Ring R υ a) b)) + rw [f.commutes,coefficientHom_scalar,g.commutes] + · intro i + change coefficientHom K R S υ a r (f (coord R υ a i))= + g (coefficientHom K R S υ a r (coord R υ a i)) + rw [coefficientHom_coord] + exact h i + exact AlgHom.congr_fun heq v + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K ι υ : Type*) [Field K] [Fintype ι] + [Fintype υ] [DecidableEq υ] (a : ι → ℕ) (p : ℕ) [Fact p.Prime] [CharP K p] + (ha : ∀ i,0 constantMap K ι a ha + (MvPowerSeries.coeff (Finsupp.single j 1) (c i)))≠0) + +def movingChart : Ring (Ring K ι a) υ (fun _ => p) ≃ₐ[Ring K ι a] + Ring (Ring K ι a) υ (fun _ => p) := + AlgEquiv.ofBijective (movingSubst K ι υ a p ha hap c hc) + (movingSubst_bijective K ι υ a p ha hap c hc hM) + +def centralChart : Ring K υ (fun _ => p) ≃ₐ[K] Ring K υ (fun _ => p) := + AlgEquiv.ofBijective (FrobeniusTruncation.formalSubst K υ p + (fun i => MvPowerSeries.map (constantMap K ι a ha).toRingHom (c i)) hc) + (FrobeniusTruncation.formalSubst_bijective K υ p _ hc hM) + + +theorem movingChart_specialization (v : Ring (Ring K ι a) υ (fun _ => p)) : + coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) + (movingChart K ι υ a p ha hap c hc hM v)= + centralChart K ι υ a p ha c hc hM + (coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) v) := by + refine substitution_specialization K (Ring K ι a) K υ (fun _ => p) + (constantMap K ι a ha) (movingChart K ι υ a p ha hap c hc hM).toAlgHom + (centralChart K ι υ a p ha c hc hM).toAlgHom ?_ v + intro i + change coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) + (movingSubst K ι υ a p ha hap c hc (coord (Ring K ι a) υ (fun _ => p) i))= + FrobeniusTruncation.formalSubst K υ p _ hc (coord K υ (fun _ => p) i) + rw [←specialization_eq_coefficientHom,movingSubst_central] + exact (FrobeniusTruncation.formalSubst_coord K υ p + (fun i => MvPowerSeries.map (constantMap K ι a ha).toRingHom (c i)) hc i).symm + +include ha in +omit [Fintype ι] [Fintype υ] [DecidableEq υ] [Fact p.Prime] in +theorem coefficientRingCharP : CharP (Ring K ι a) p := by + apply charP_of_injective_ringHom (f:=algebraMap K (Ring K ι a)) + apply Function.LeftInverse.injective (g:=constantMap K ι a ha) + intro b + exact (constantMap K ι a ha).commutes b + +variable [CharP (Ring K ι a) p] {σ : Type*} {d : ℕ} + +theorem movingChart_normal_specialization (e : υ ≃ σ ⊕ Fin d) : + Forms.mapCoefficients K (Ring (Ring K ι a) υ (fun _ => p)) (Ring K υ (fun _ => p)) υ + (coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha)) + (chartNormal K (Ring K ι a) υ p e (movingChart K ι υ a p ha hap c hc hM))= + chartNormal K K υ p e (centralChart K ι υ a p ha c hc hM) := by + apply chartNormal_specialization + exact movingChart_specialization K ι υ a p ha hap c hc hM + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (R S υ σ τ : Type*) [CommRing R] [CommRing S] [Fintype σ] [Fintype τ] + (e : υ ≃ σ ⊕ τ) + +theorem combinedGraph_map (r : R →+* S) (H : υ → MvPowerSeries σ R) + (G : υ → MvPowerSeries τ R) (i : υ) : + MvPowerSeries.map r (combinedGraph R υ σ τ e H G i)= + combinedGraph S υ σ τ e (fun i => MvPowerSeries.map r (H i)) + (fun i => MvPowerSeries.map r (G i)) i := by + simp only [combinedGraph,map_add,←MvPowerSeries.rename_map] + +theorem combinedGraph_swap (H : υ → MvPowerSeries σ R) (G : υ → MvPowerSeries τ R) : + combinedGraph R υ τ σ (e.trans (Equiv.sumComm _ _)) G H= + combinedGraph R υ σ τ e H G := by + funext i + change MvPowerSeries.rename (fun j => e.symm (Sum.inr j)) (G i)+ + MvPowerSeries.rename (fun j => e.symm (Sum.inl j)) (H i)=_ + exact add_comm _ _ + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K υ : Type*) [Field K] [Fintype υ] [DecidableEq υ] (p : ℕ) + [Fact p.Prime] [CharP K p] + + +def fixedChart (c0 : υ → MvPowerSeries υ K) + (h0 : ∀ i,MvPowerSeries.constantCoeff (c0 i)=0) + (hM : Matrix.det (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (c0 i))≠0) : + Ring K υ (fun _ => p) ≃ₐ[K] Ring K υ (fun _ => p) := + AlgEquiv.ofBijective (FrobeniusTruncation.formalSubst K υ p c0 h0) + (FrobeniusTruncation.formalSubst_bijective K υ p c0 h0 hM) + +@[simp] theorem fixedChart_coord (c0 : υ → MvPowerSeries υ K) + (h0 : ∀ i,MvPowerSeries.constantCoeff (c0 i)=0) + (hM : Matrix.det (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (c0 i))≠0) (i : υ) : + fixedChart K υ p c0 h0 hM (coord K υ (fun _ => p) i)= + nilEval K (coord K υ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) (c0 i) := by + exact FrobeniusTruncation.formalSubst_coord K υ p c0 h0 i + +variable (ι : Type*) [Fintype ι] (a : ι → ℕ) + (ha : ∀ i,0 MvPowerSeries.coeff (Finsupp.single j 1) (c0 i))≠0) + (c : υ → MvPowerSeries υ (Ring K ι a)) + (hc : ∀ i,MvPowerSeries.map (constantMap K ι a ha).toRingHom (c i)=c0 i) : + ∃ q : Ring (Ring K ι a) υ (fun _ => p) ≃ₐ[Ring K ι a] Ring (Ring K ι a) υ (fun _ => p), + (∀ i,q (coord (Ring K ι a) υ (fun _ => p) i)= + nilEval (Ring K ι a) (coord (Ring K ι a) υ (fun _ => p)) + (fun j => ⟨p,coord_pow _ _ _ j⟩) (c i)) ∧ + ∀ v,coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) (q v)= + fixedChart K υ p c0 h0 hM + (coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) v) := by + have hcz (i : υ) : constantMap K ι a ha (MvPowerSeries.constantCoeff (c i))=0 := by + have hh := congrArg MvPowerSeries.constantCoeff (hc i) + exact hh.trans (h0 i) + have hcM : Matrix.det (fun i j => constantMap K ι a ha + (MvPowerSeries.coeff (Finsupp.single j 1) (c i)))≠0 := by + convert hM using 1 + congr 1 + funext i j + exact congrArg (MvPowerSeries.coeff (Finsupp.single j 1)) (hc i) + let q := movingChart K ι υ a p ha hap c hcz hcM + refine ⟨q,?_,?_⟩ + · intro i + exact movingSubst_coord K ι υ a p ha hap c hcz i + · intro v + refine substitution_specialization K (Ring K ι a) K υ (fun _ => p) + (constantMap K ι a ha) q.toAlgHom (fixedChart K υ p c0 h0 hM).toAlgHom ?_ v + intro i + change coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) + (q (coord (Ring K ι a) υ (fun _ => p) i))= + fixedChart K υ p c0 h0 hM (coord K υ (fun _ => p) i) + change coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) + (movingSubst K ι υ a p ha hap c hcz (coord (Ring K ι a) υ (fun _ => p) i))=_ + rw [←specialization_eq_coefficientHom,movingSubst_central,hc i] + exact (fixedChart_coord K υ p c0 h0 hM i).symm + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K υ σ τ : Type*) [Field K] [Fintype υ] [DecidableEq υ] + [Fintype σ] [Fintype τ] + (p : ℕ) [Fact p.Prime] [CharP K p] + (ι : Type*) [Fintype ι] (a : ι → ℕ) + (ha : ∀ i,0 MvPowerSeries.coeff (Finsupp.single j 1) (H0 i)))) + (hR : Function.Injective (Matrix.mulVecLin + (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i)))) + (hcomp : IsCompl (Matrix.mulVecLin + (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (H0 i))).range + (Matrix.mulVecLin (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i))).range) : + ∃ q0 : Ring K υ (fun _ => p) ≃ₐ[K] Ring K υ (fun _ => p), + (∀ i,splitRestriction (Fact.out : p.Prime).pos e q0 (coord K υ (fun _ => p) i)= + nilEval K (coord K σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) (H0 i)) ∧ + (∀ i,splitRestriction (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 + (coord K υ (fun _ => p) i)= + nilEval K (coord K τ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) (G i)) ∧ + ∀ H : υ → MvPowerSeries σ (Ring K ι a), + (∀ i,MvPowerSeries.map (constantMap K ι a ha).toRingHom (H i)=H0 i) → + ∃ q : Ring (Ring K ι a) υ (fun _ => p) ≃ₐ[Ring K ι a] Ring (Ring K ι a) υ (fun _ => p), + (∀ i,splitRestriction (Fact.out : p.Prime).pos e q + (coord (Ring K ι a) υ (fun _ => p) i)= + nilEval (Ring K ι a) (coord (Ring K ι a) σ (fun _ => p)) + (fun j => ⟨p,coord_pow _ _ _ j⟩) (H i)) ∧ + ∀ v,coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) (q v)= + q0 (coefficientHom K (Ring K ι a) K υ (fun _ => p) (constantMap K ι a ha) v) := by + let c0 := combinedGraph K υ σ τ e H0 G + have hz (i : υ) : MvPowerSeries.constantCoeff (c0 i)=0 := by + simp only [c0,combinedGraph_constantCoeff,hH0,hG,add_zero] + have hM : Matrix.det (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (c0 i))≠0 := + combinedGraph_central_tangent K υ σ τ e (RingHom.id K) H0 G hL hR hcomp + let q0 := fixedChart K υ p c0 hz hM + refine ⟨q0,?_,?_,?_⟩ + · intro i + change planeRestriction K υ σ τ p e (Fact.out : p.Prime).pos + (q0 (coord K υ (fun _ => p) i))=_ + rw [fixedChart_coord] + exact combinedGraph_eval_left K υ σ τ p e (Fact.out : p.Prime).pos H0 G hG i + · intro i + change planeRestriction K υ τ σ p (e.trans (Equiv.sumComm _ _)) (Fact.out : p.Prime).pos + (q0 (coord K υ (fun _ => p) i))=_ + rw [fixedChart_coord] + change planeRestriction K υ τ σ p (e.trans (Equiv.sumComm _ _)) (Fact.out : p.Prime).pos + (nilEval K (coord K υ (fun _ => p)) _ (combinedGraph K υ σ τ e H0 G i))=_ + rw [←combinedGraph_swap K υ σ τ e H0 G] + exact combinedGraph_eval_left K υ τ σ p (e.trans (Equiv.sumComm _ _)) + (Fact.out : p.Prime).pos G H0 hH0 i + · intro H hH + let G' := fun i => MvPowerSeries.map (algebraMap K (Ring K ι a)) (G i) + let c := combinedGraph (Ring K ι a) υ σ τ e H G' + have hG' (i : υ) : MvPowerSeries.constantCoeff (G' i)=0 := by + simp only [G',MvPowerSeries.constantCoeff_map,hG,map_zero] + have hc (i : υ) : MvPowerSeries.map (constantMap K ι a ha).toRingHom (c i)=c0 i := by + rw [combinedGraph_map] + have hh : (fun i => MvPowerSeries.map (constantMap K ι a ha).toRingHom (H i))=H0 := funext hH + rw [hh] + congr 1 + funext j + ext d + simp only [G',MvPowerSeries.coeff_map] + exact (constantMap K ι a ha).commutes (MvPowerSeries.coeff d (G j)) + obtain ⟨q,hq,hs⟩ := compatible_moving_chart K υ p ι a ha hap c0 hz hM c hc + refine ⟨q,?_,hs⟩ + intro i + change planeRestriction (Ring K ι a) υ σ τ p e (Fact.out : p.Prime).pos + (q (coord (Ring K ι a) υ (fun _ => p) i))=_ + rw [hq] + exact combinedGraph_eval_left (Ring K ι a) υ σ τ p e (Fact.out : p.Prime).pos H G' hG' i + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K : Type*) [Field K] (m : ℕ) + + + +theorem constantMap_parameters : + constantMap K (Fin m) (fun _ => 2) (fun _ => by decide)=augmentationAlg K m := by + apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + change constantMap K (Fin m) (fun _ => 2) (fun _ => by decide) + (coord K (Fin m) (fun _ => 2) i)=augmentation K m (t K m i) + rw [constantMap_coord,augmentation_t] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor +noncomputable section +variable (K : Type*) [Field K] (m : ℕ) {υ σ : Type*} [Finite υ] + + +theorem parameter_hasSubst (H : υ → MvPowerSeries σ (T K m)) + (hH : ∀ i,augmentation K m (MvPowerSeries.constantCoeff (H i))=0) : + MvPowerSeries.HasSubst H := by + apply MvPowerSeries.hasSubst_of_constantCoeff_nilpotent + intro i + apply mem_nilradical.mp + apply parameterIdeal_le_nilradical + have hh := sub_constant_mem K m (MvPowerSeries.constantCoeff (H i)) + simpa only [hH,map_zero,sub_zero] using hh + +end +end PD4Tensor + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K R υ σ τ : Type*) [Field K] [CommRing R] [Algebra K R] + [Fintype υ] [DecidableEq υ] [Fintype σ] (p : ℕ) + + +theorem graph_zero (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) + (H : υ → MvPowerSeries σ R) (hH : MvPowerSeries.HasSubst H) + (hq : ∀ i,splitRestriction hp e q (coord R υ (fun _ => p) i)= + nilEval R (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) (H i)) + (S : MvPowerSeries υ R) (hS : MvPowerSeries.subst H S=0) : + splitRestriction hp e q + (nilEval R (coord R υ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) S)=0 := by + rw [graph_eval H hH _ _ (splitRestriction hp e q) hq,hS,map_zero] + +variable [CharP R p] + +theorem graph_gradient (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) + (H : υ → MvPowerSeries σ R) (hH : MvPowerSeries.HasSubst H) + (hq : ∀ i,splitRestriction hp e q (coord R υ (fun _ => p) i)= + nilEval R (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) (H i)) + (S a : MvPowerSeries υ R) + (ha : MvPowerSeries.subst H a∈Ideal.span + (Set.range (fun i => MvPowerSeries.subst H (MvPowerSeries.pderiv i S)))) : + splitRestriction hp e q + (nilEval R (coord R υ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) a) ∈ + Ideal.span (Set.range (fun i => splitRestriction hp e q + (chartDerivative K R υ p i + (nilEval R (coord R υ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) S)))) := by + have hh := ideal_span_range_map + (nilEval R (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩)).toRingHom + _ _ ha + change nilEval R (coord R σ (fun _ => p)) _ (MvPowerSeries.subst H a) ∈ + Ideal.span (Set.range (fun i => + nilEval R (coord R σ (fun _ => p)) _ (MvPowerSeries.subst H (MvPowerSeries.pderiv i S)))) at hh + change splitRestriction hp e q (nilEval R (coord R υ (fun _ => p)) _ a) ∈ + Ideal.span (Set.range (fun i => splitRestriction hp e q + (relativeDeriv R υ p i (nilEval R (coord R υ (fun _ => p)) _ S)))) + simp only [partial_nilEval,graph_eval H hH _ _ (splitRestriction hp e q) hq] + exact hh + +end +end PD4Tensor.FiniteCoordinates +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/ComplementaryGraphs.lean b/lean/OAI/Algebra/FiniteTensor/ComplementaryGraphs.lean new file mode 100644 index 0000000000000000000000000000000000000000..e039ad354e3abecd42a11c3a494a2aad3323d1eb --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/ComplementaryGraphs.lean @@ -0,0 +1,198 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.FiniteObstruction + +namespace OAI + +/-! Complementary graph matrices and tangent invertibility. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (R υ σ τ : Type*) [CommRing R] (p : ℕ) (e : υ ≃ σ ⊕ τ) + + +def planeRestriction (hp : 0 p) →ₐ[R] Ring R σ (fun _ => p) := + (uniformLeft R σ τ p hp).comp (reindexEquiv R υ (σ ⊕ τ) p e).toAlgHom + +@[simp] theorem planeRestriction_coord (hp : 0 p) i)= + Sum.elim (coord R σ (fun _ => p)) (fun _ => 0) (e i) := by + simp only [planeRestriction,AlgHom.comp_apply,AlgEquiv.coe_toAlgHom, + reindexEquiv_coord,uniformLeft_coord] + + +variable [Fintype σ] [Fintype τ] + +def combinedGraph (H : υ → MvPowerSeries σ R) (G : υ → MvPowerSeries τ R) : + υ → MvPowerSeries υ R := + fun i => MvPowerSeries.rename (fun j => e.symm (Sum.inl j)) (H i) + + MvPowerSeries.rename (fun j => e.symm (Sum.inr j)) (G i) + + + +theorem combinedGraph_eval_left [Fintype υ] (hp : 0 p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) + (combinedGraph R υ σ τ e H G i)) = + nilEval R (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) (H i) := by + have hh := nilEval_map (planeRestriction R υ σ τ p e hp) + (coord R υ (fun _ => p)) (fun j => (show IsNilpotent (coord R υ (fun _ => p) j) from + ⟨p,coord_pow _ _ _ j⟩)) (combinedGraph R υ σ τ e H G i) + rw [hh] + simp only [combinedGraph,map_add,nilEval_rename,Function.comp_def, + planeRestriction_coord,Equiv.apply_symm_apply,Sum.elim_inl,Sum.elim_inr] + rw [nilEval_zero,hG,map_zero,add_zero] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor +noncomputable section +open scoped BigOperators +variable {K υ σ τ : Type*} [Field K] [Fintype υ] + [Fintype σ] [Fintype τ] + +def joinedMatrix (e : υ ≃ σ ⊕ τ) (L : Matrix υ σ K) (R : Matrix υ τ K) : Matrix υ υ K := + fun i j => Sum.elim (L i) (R i) (e j) + +theorem joinedMatrix_mulVec (e : υ ≃ σ ⊕ τ) (L : Matrix υ σ K) (R : Matrix υ τ K) + (v : υ → K) : + (joinedMatrix e L R).mulVec v= + L.mulVec (fun j => v (e.symm (Sum.inl j))) + R.mulVec (fun j => v (e.symm (Sum.inr j))) := by + ext i + simp only [Matrix.mulVec,dotProduct,joinedMatrix,Pi.add_apply] + rw [←e.symm.sum_comp] + simp only [Equiv.apply_symm_apply,Fintype.sum_sum_type,Sum.elim_inl,Sum.elim_inr] + + + +theorem joinedMatrix_det_ne_zero [DecidableEq υ] + (e : υ ≃ σ ⊕ τ) (L : Matrix υ σ K) (R : Matrix υ τ K) + (hL : Function.Injective L.mulVec) (hR : Function.Injective R.mulVec) + (hcomp : IsCompl (Matrix.mulVecLin L).range (Matrix.mulVecLin R).range) : + (joinedMatrix e L R).det≠0 := by + suffices hi : Function.Injective (joinedMatrix e L R).mulVec by + exact ((Matrix.isUnit_iff_isUnit_det _).mp + (Matrix.mulVec_injective_iff_isUnit.mp hi)).ne_zero + change Function.Injective (Matrix.mulVecLin (joinedMatrix e L R)) + apply LinearMap.ker_eq_bot.mp + apply LinearMap.ker_eq_bot'.mpr + intro v hv + change (joinedMatrix e L R).mulVec v=0 at hv + rw [joinedMatrix_mulVec] at hv + have hzero : L.mulVec (fun j => v (e.symm (Sum.inl j)))=0 := by + apply (Submodule.disjoint_def.mp hcomp.disjoint) + · exact ⟨fun j => v (e.symm (Sum.inl j)),rfl⟩ + · refine ⟨-(fun j => v (e.symm (Sum.inr j))),?_⟩ + rw [map_neg] + exact (eq_neg_of_add_eq_zero_left hv).symm + have hzL : (fun j => v (e.symm (Sum.inl j)))=0 := + hL (by simpa using hzero) + have hzR : (fun j => v (e.symm (Sum.inr j)))=0 := hR (by simpa [hzero] using hv) + ext i + obtain ⟨j,rfl⟩ := e.symm.surjective i + cases j with + | inl j => exact congr_fun hzL j + | inr j => exact congr_fun hzR j + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +variable {R σ τ : Type*} [CommRing R] + +@[simp] theorem coeff_single_rename_embedding (e : σ ↪ τ) (f : MvPowerSeries σ R) (i : σ) : + MvPowerSeries.coeff (Finsupp.single (e i) 1) (MvPowerSeries.rename e f)= + MvPowerSeries.coeff (Finsupp.single i 1) f := by + simpa only [Finsupp.embDomain_single] using + (MvPowerSeries.coeff_embDomain_rename e f (Finsupp.single i 1)) + +theorem coeff_single_rename_outside [Fintype σ] (e : σ → τ) (f : MvPowerSeries σ R) + (i : τ) (hi : i∉Set.range e) : + MvPowerSeries.coeff (Finsupp.single i 1) (MvPowerSeries.rename e f)=0 := by + classical + apply MvPowerSeries.coeff_rename_eq_zero + rintro ⟨a,ha⟩ + apply hi + apply Finsupp.mem_range_of_mapDomain_ne_zero (x:=a) + rw [ha,Finsupp.single_eq_same] + exact one_ne_zero + +end +end PD4Tensor + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (R υ σ τ : Type*) [CommRing R] + [Fintype σ] [Fintype τ] + (e : υ ≃ σ ⊕ τ) + +@[simp] theorem combinedGraph_constantCoeff + (H : υ → MvPowerSeries σ R) (G : υ → MvPowerSeries τ R) (i : υ) : + MvPowerSeries.constantCoeff (combinedGraph R υ σ τ e H G i)= + MvPowerSeries.constantCoeff (H i)+MvPowerSeries.constantCoeff (G i) := by + simp [combinedGraph] + +theorem combinedGraph_coeff (H : υ → MvPowerSeries σ R) (G : υ → MvPowerSeries τ R) + (i j : υ) : + MvPowerSeries.coeff (Finsupp.single j 1) (combinedGraph R υ σ τ e H G i)= + Sum.elim (fun k => MvPowerSeries.coeff (Finsupp.single k 1) (H i)) + (fun k => MvPowerSeries.coeff (Finsupp.single k 1) (G i)) (e j) := by + let el : σ ↪ υ := ⟨fun j => e.symm (Sum.inl j),e.symm.injective.comp Sum.inl_injective⟩ + let er : τ ↪ υ := ⟨fun j => e.symm (Sum.inr j),e.symm.injective.comp Sum.inr_injective⟩ + obtain ⟨j,rfl⟩ := e.symm.surjective j + cases j with + | inl j => + change MvPowerSeries.coeff (Finsupp.single (el j) 1) + (MvPowerSeries.rename el (H i)+MvPowerSeries.rename er (G i))=_ + rw [map_add,coeff_single_rename_embedding] + rw [coeff_single_rename_outside er _ (el j) (by + rintro ⟨k,hk⟩ + have hh := e.symm.injective hk + cases hh)] + simp + | inr j => + change MvPowerSeries.coeff (Finsupp.single (er j) 1) + (MvPowerSeries.rename el (H i)+MvPowerSeries.rename er (G i))=_ + rw [map_add,coeff_single_rename_embedding] + rw [coeff_single_rename_outside el _ (er j) (by + rintro ⟨k,hk⟩ + have hh := e.symm.injective hk + cases hh)] + simp + +variable {K : Type*} [Field K] [Fintype υ] [DecidableEq υ] + +theorem combinedGraph_central_tangent + (a : R →+* K) (H : υ → MvPowerSeries σ R) (G : υ → MvPowerSeries τ R) + (hH : Function.Injective (Matrix.mulVecLin + (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) (H i))))) + (hG : Function.Injective (Matrix.mulVecLin + (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) (G i))))) + (hcomp : IsCompl (Matrix.mulVecLin + (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) (H i)))).range + (Matrix.mulVecLin (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) (G i)))).range) : + Matrix.det (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) + (combinedGraph R υ σ τ e H G i)))≠0 := by + have heq : (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) + (combinedGraph R υ σ τ e H G i)))= + joinedMatrix e (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) (H i))) + (fun i j => a (MvPowerSeries.coeff (Finsupp.single j 1) (G i))) := by + funext i j + rw [combinedGraph_coeff] + unfold joinedMatrix + cases e j <;> rfl + rw [heq] + exact joinedMatrix_det_ne_zero e _ _ hH hG hcomp + +end +end PD4Tensor.FiniteCoordinates +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/CoordinateEquivalences.lean b/lean/OAI/Algebra/FiniteTensor/CoordinateEquivalences.lean new file mode 100644 index 0000000000000000000000000000000000000000..b87ef835fff6e0d7b8d62a28b9eeabadfe6d0ec5 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/CoordinateEquivalences.lean @@ -0,0 +1,297 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.TensorResidues + +namespace OAI + +/-! Coordinate equivalences induced by invertible tangent matrices. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +noncomputable section +variable {K A : Type*} [CommRing K] [CommRing A] [Algebra K A] + + + +theorem coordinate_error_raises (J : Ideal A) (f : A →ₐ[K] A) + (h₀ : ∀ a, a-f a∈J) (h₁ : ∀ a∈J, a-f a∈J^2) : + ∀ n a, a∈J^n → a-f a∈J^(n+1) := by + intro n + induction n with + | zero => intro a _; simpa using h₀ a + | succ n ih => + intro a ha + rw [pow_succ] at ha + refine Submodule.mul_induction_on (R:=A) (C:=fun a => a-f a∈J^(n+1+1)) ha ?_ ?_ + · intro x hx y hy + have hfy : f y∈J := by + have hey : y-f y∈J := (Ideal.pow_le_self (by decide : 2 ≠ 0)) (h₁ y hy) + simpa using J.sub_mem hy hey + have hxy := Ideal.mul_mem_mul hx (h₁ y hy) + have hxy' : (x-f x)*f y∈J^(n+1)*J^1 := + Ideal.mul_mem_mul (ih x hx) (by simpa using hfy) + rw [← pow_add] at hxy + rw [← pow_add] at hxy' + have h := (J^(n+1+1)).add_mem (by simpa [Nat.add_assoc] using hxy) hxy' + convert h using 1; simp only [map_mul]; ring + · intro x y hx hy + simpa only [map_add, add_sub_add_comm] using (J^(n+1+1)).add_mem hx hy + + + +theorem coordinate_error_on_span {ι : Type*} (z : ι → A) (f : A →ₐ[K] A) + (h₀ : ∀ a, a-f a∈Ideal.span (Set.range z)) + (hz : ∀ i, z i-f (z i)∈Ideal.span (Set.range z)^2) : + ∀ a∈Ideal.span (Set.range z), a-f a∈Ideal.span (Set.range z)^2 := by + intro a ha + let J : Ideal A := Ideal.span (Set.range z) + change a-f a∈J^2 + refine Submodule.span_induction (p:=fun a _ => a-f a∈J^2) ?_ ?_ ?_ ?_ ha + · rintro a ⟨i,rfl⟩ + exact hz i + · simp + · intro a b ha hb hea heb + simpa only [map_add,add_sub_add_comm] using (J^2).add_mem hea heb + · intro r a ha hea + change r*a-f (r*a)∈J^2 + have hfa : f a∈J := by + have he : a-f a∈J := (Ideal.pow_le_self (by decide : 2≠0)) hea + simpa using J.sub_mem ha he + have hprod : (r-f r)*f a∈J^2 := by + simpa only [pow_two] using Ideal.mul_mem_mul (h₀ r) hfa + have h := (J^2).add_mem (Ideal.mul_mem_left _ r hea) hprod + convert h using 1; simp only [map_mul]; ring + + + +theorem bijective_of_identity_tangent (J : Ideal A) (f : A →ₐ[K] A) + (h₀ : ∀ a, a-f a∈J) (h₁ : ∀ a∈J, a-f a∈J^2) + (N : ℕ) (hN : J^N=⊥) : Function.Bijective f := by + let e : Module.End K A := 1-f.toLinearMap + have he (a : A) : e a=a-f a := rfl + have hen : ∀ n a, (e^n) a∈J^n := by + intro n + induction n with + | zero => intro a; simp + | succ n ih => + intro a + rw [pow_succ' e,Module.End.mul_apply,he] + exact coordinate_error_raises J f h₀ h₁ n _ (ih a) + have hn : IsNilpotent e := by + refine ⟨N,?_⟩ + ext a + have ha := hen N a + rw [hN,Ideal.mem_bot] at ha + exact ha + have hf : IsUnit f.toLinearMap := by + have h := hn.isUnit_one_sub + simpa only [e,sub_sub_cancel] using h + exact (Module.End.isUnit_iff _).mp hf + + +def coordinatesEquiv (J : Ideal A) (f : A →ₐ[K] A) + (h₀ : ∀ a, a-f a∈J) (h₁ : ∀ a∈J, a-f a∈J^2) + (N : ℕ) (hN : J^N=⊥) : A ≃ₐ[K] A := + AlgEquiv.ofBijective f (bijective_of_identity_tangent J f h₀ h₁ N hN) + +end +end PD4Tensor + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K σ : Type*) [CommRing K] [Fintype σ] [DecidableEq σ] (e : σ → ℕ) + + +def ideal : Ideal (MvPolynomial σ K) := + Ideal.span (Set.range (fun i : σ => (MvPolynomial.X i : MvPolynomial σ K)^e i)) +abbrev Ring := MvPolynomial σ K ⧸ ideal K σ e + +def coord (i : σ) : Ring K σ e := + Ideal.Quotient.mk (ideal K σ e) (MvPolynomial.X i) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem coord_pow (i : σ) : coord K σ e i ^ e i=0 := by + rw [coord,←map_pow,Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.subset_span (Set.mem_range_self i) + +variable {K σ e} {B : Type*} [CommRing B] [Algebra K B] +def evaluate (v : σ → B) (hv : ∀ i, v i^e i=0) : Ring K σ e →ₐ[K] B := + Ideal.Quotient.liftₐ (ideal K σ e) (MvPolynomial.aeval v) (by + have h : ideal K σ e ≤ RingHom.ker (MvPolynomial.aeval v).toRingHom := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + simpa using hv i + exact fun a ha => h ha) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem evaluate_coord (v : σ → B) (hv : ∀ i, v i^e i=0) (i : σ) : + evaluate v hv (coord K σ e i)=v i := by + change (MvPolynomial.aeval v) (MvPolynomial.X i)=v i + exact MvPolynomial.aeval_X v i + +omit [Fintype σ] [DecidableEq σ] in +@[ext] theorem hom_ext {f g : Ring K σ e →ₐ[K] B} + (h : ∀ i, f (coord K σ e i)=g (coord K σ e i)) : f=g := by + apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + exact h i + +variable (K σ e) +def augmentationIdeal : Ideal (Ring K σ e) := Ideal.span (Set.range (coord K σ e)) + + +omit [DecidableEq σ] in +theorem augmentation_nilpotent : IsNilpotent (augmentationIdeal K σ e) := by + have hfg : (augmentationIdeal K σ e).FG := + Submodule.fg_span (Set.finite_range (coord K σ e)) + apply hfg.isNilpotent_iff_le_nilradical.mpr + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact mem_nilradical.mpr ⟨e i,coord_pow K σ e i⟩ + +variable {K σ e} + +omit [Fintype σ] [DecidableEq σ] in +theorem error_mem (J : Ideal (Ring K σ e)) (f : Ring K σ e →ₐ[K] Ring K σ e) + (hz : ∀ i, coord K σ e i-f (coord K σ e i)∈J) (a : Ring K σ e) : + a-f a∈J := by + refine Quotient.inductionOn' a ?_ + intro q + change Ideal.Quotient.mk (ideal K σ e) q-f (Ideal.Quotient.mk (ideal K σ e) q)∈J + induction q using MvPolynomial.induction_on with + | C c => + change algebraMap K (Ring K σ e) c-f (algebraMap K (Ring K σ e) c)∈J + simp + | add q r hq hr => + simpa only [map_add,add_sub_add_comm] using J.add_mem hq hr + | mul_X q i hq => + change Ideal.Quotient.mk _ q * coord K σ e i- + f (Ideal.Quotient.mk _ q * coord K σ e i)∈J + have h := J.add_mem (Ideal.mul_mem_left J (Ideal.Quotient.mk (ideal K σ e) q) (hz i)) + (Ideal.mul_mem_right (f (coord K σ e i)) J hq) + convert h using 1; simp only [map_mul]; ring + + + +omit [DecidableEq σ] in +theorem bijective_of_tangent_identity (f : Ring K σ e →ₐ[K] Ring K σ e) + (hz : ∀ i, coord K σ e i-f (coord K σ e i)∈augmentationIdeal K σ e^2) : + Function.Bijective f := by + have h₀ : ∀ a, a-f a∈augmentationIdeal K σ e := + error_mem _ f (fun i => (Ideal.pow_le_self (by decide : 2≠0)) (hz i)) + have h₁ := coordinate_error_on_span (coord K σ e) f h₀ hz + obtain ⟨N,hN⟩ := augmentation_nilpotent K σ e + exact bijective_of_identity_tangent _ f h₀ h₁ N hN + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +open scoped BigOperators +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + [CharP K p] [Fact p.Prime] + +@[simp] theorem linearSubst_one : linearSubst K σ p (1 : Matrix σ σ K)=AlgHom.id K _ := by + apply FiniteCoordinates.hom_ext (e:=fun _ => p) + intro i + change linearSubst K σ p 1 (coord K σ p i)=coord K σ p i + simp [linearSubst_coord,Matrix.one_apply] + + + +def linearEquiv (M : Matrix σ σ K) (hM : M.det≠0) : Ring K σ p ≃ₐ[K] Ring K σ p := by + let f := linearSubst K σ p M + let g := linearSubst K σ p M⁻¹ + have hfg : f.comp g=AlgHom.id K _ := by + rw [←linearSubst_mul,Matrix.nonsing_inv_mul M (isUnit_iff_ne_zero.mpr hM),linearSubst_one] + have hgf : g.comp f=AlgHom.id K _ := by + rw [←linearSubst_mul,Matrix.mul_nonsing_inv M (isUnit_iff_ne_zero.mpr hM),linearSubst_one] + exact AlgEquiv.ofBijective f ⟨(fun a b h => by + have ha := DFunLike.congr_fun hgf a + have hb := DFunLike.congr_fun hgf b + change g (f a)=a at ha + change g (f b)=b at hb + rw [←ha,←hb,h]),fun a => ⟨g a,DFunLike.congr_fun hfg a⟩⟩ + +def polynomialSubst (c : σ → MvPolynomial σ K) + (hc : ∀ i, MvPolynomial.constantCoeff (c i)=0) : Ring K σ p →ₐ[K] Ring K σ p := + FiniteCoordinates.evaluate (fun i => Ideal.Quotient.mk (ideal K σ p) (c i)) (by + intro i + rw [frobenius_mk,hc] + simp [zero_pow (Fact.out : p.Prime).ne_zero]) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem polynomialSubst_coord (c : σ → MvPolynomial σ K) + (hc : ∀ i, MvPolynomial.constantCoeff (c i)=0) (i : σ) : + polynomialSubst K σ p c hc (coord K σ p i)=Ideal.Quotient.mk (ideal K σ p) (c i) := by + change (MvPolynomial.aeval _) (MvPolynomial.X i)=_ + exact MvPolynomial.aeval_X _ i + + + +omit [Fintype σ] [DecidableEq σ] [CharP K p] [Fact p.Prime] in +theorem map_idealOfVars : + (MvPolynomial.idealOfVars σ K).map (Ideal.Quotient.mk (ideal K σ p))= + FiniteCoordinates.augmentationIdeal K σ (fun _ => p) := by + rw [MvPolynomial.idealOfVars,Ideal.map_span] + congr 1 + exact Set.range_comp (Ideal.Quotient.mk (ideal K σ p)) MvPolynomial.X |>.symm + + + +theorem polynomialSubst_bijective (c : σ → MvPolynomial σ K) + (hc : ∀ i, MvPolynomial.constantCoeff (c i)=0) + (hM : (tangentMatrix K σ c).det≠0) : + Function.Bijective (polynomialSubst K σ p c hc) := by + let M := tangentMatrix K σ c + let J : Ideal (Ring K σ p) := FiniteCoordinates.augmentationIdeal K σ (fun _ => p) + have herr (i : σ) : Ideal.Quotient.mk (ideal K σ p) (c i)- + ∑ j : σ, M i j • coord K σ p j∈J^2 := by + have h := Ideal.mem_map_of_mem (Ideal.Quotient.mk (ideal K σ p)) + (sub_linearPart_mem K σ (c i) (hc i)) + rw [Ideal.map_pow,map_idealOfVars,map_sub] at h + have he : Ideal.Quotient.mk (ideal K σ p) (linearPart K σ (c i))= + ∑ j : σ, M i j • coord K σ p j := by + simp only [linearPart,map_sum,map_mul,M,tangentMatrix] + apply Finset.sum_congr rfl + intro j hj + exact (Algebra.smul_def ((c i).coeff (Finsupp.single j 1)) (coord K σ p j)).symm + rw [he] at h + exact h + let f := (polynomialSubst K σ p c hc).comp (linearSubst K σ p M⁻¹) + have hf : Function.Bijective f := by + apply FiniteCoordinates.bijective_of_tangent_identity + intro i + change coord K σ p i-f (coord K σ p i)∈J^2 + have hsum : (∑ j : σ, M⁻¹ i j • (Ideal.Quotient.mk (ideal K σ p) (c j)- + ∑ k : σ, M j k • coord K σ p k))∈J^2 := by + exact (J^2).sum_mem (fun j _ => ((J^2).restrictScalars K).smul_mem (M⁻¹ i j) (herr j)) + have he : (∑ j : σ, M⁻¹ i j • ∑ k : σ, M j k • coord K σ p k)=coord K σ p i := by + simp only [Finset.smul_sum,smul_smul] + rw [Finset.sum_comm] + simp only [←Finset.sum_smul,←Matrix.mul_apply, + Matrix.nonsing_inv_mul M (isUnit_iff_ne_zero.mpr hM),Matrix.one_apply] + simp + simp only [smul_sub,Finset.sum_sub_distrib,he] at hsum + have hneg : -(∑ j : σ, M⁻¹ i j • Ideal.Quotient.mk (ideal K σ p) (c j)-coord K σ p i) ∈ (J^2 : Ideal (Ring K σ p)) := (J^2).neg_mem hsum + have hn : -(∑ j : σ, M⁻¹ i j • Ideal.Quotient.mk (ideal K σ p) (c j)-coord K σ p i)= + coord K σ p i-∑ j : σ, M⁻¹ i j • Ideal.Quotient.mk (ideal K σ p) (c j) := by ring + rw [hn] at hneg + simp only [f,AlgHom.comp_apply,linearSubst_coord,map_sum,map_smul, + polynomialSubst_coord] + convert hneg using 1 + rfl + have hlin : Function.Bijective (linearSubst K σ p M⁻¹) := by + apply (linearEquiv K σ p M⁻¹ ?_).bijective + rw [Matrix.det_nonsing_inv,Ring.inverse_eq_inv] + exact inv_ne_zero hM + exact (Function.Bijective.of_comp_iff _ hlin).mp hf + +end +end PD4Tensor.FrobeniusTruncation +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/DeformedCycles.lean b/lean/OAI/Algebra/FiniteTensor/DeformedCycles.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a100683c462d947a9de7af50d6e716f1bb154eb --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/DeformedCycles.lean @@ -0,0 +1,428 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.TensorKernels + +namespace OAI + +/-! Liftable pure tensors, deformation cycles and the finite pairing obstruction. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct +open SuperReduction CohomologyTensor +variable {K ι : Type*} [Field K] [Invertible (2:K)] [Fintype ι] [LinearOrder ι] +variable {E : ι → Type*} [∀ i, AddCommGroup (E i)] [∀ i, Module K (E i)] + + + +theorem exists_liftable_pure_tensor + (C : ∀ i, SuperReduction K (E i)) (d b : ∀ i, E i →ₗ[K] E i) + (hdd : ∀ i v, d i (d i v)=0) + (hdg : ∀ i v, d i ((C i).g v) = -(C i).g (d i v)) + (hδd : ∀ i v, (C i).d (d i v) = -d i ((C i).d v)) + (hδb : ∀ i v, (C i).d (b i v) = b i ((C i).d v)) + (hbg : ∀ i v, b i ((C i).g v) = (C i).g (b i v)) + (α : ⨂[K] i, E i) + (hαδ : finiteD C α=0) + (hαd : oddTensor (fun i => (C i).g) d α=0) + (htrip : ∀ S : Finset ι, S.card=3 → partialTensor E b S α ∈ LinearMap.range (finiteD C)) + (L : (⨂[K] i, E i) →ₗ[K] K) + (hLδ : ∀ v, L (finiteD C v)=0) + (hLd : ∀ v, L (oddTensor (fun i => (C i).g) d v)=0) + (hLα : L α ≠ 0) : + ∃ (a : ∀ i, E i) (S : Finset ι), S.card ≤ 2 ∧ + (∀ i, (C i).d (a i)=0) ∧ + (∀ i, d i (a i) ∈ LinearMap.range (C i).d) ∧ + (∀ i ∉ S, b i (a i) ∈ LinearMap.range (C i).d) ∧ + L (PiTensorProduct.tprod K a) ≠ 0 := by + let D := oddTensor (fun i => (C i).g) d + let Q := CohomologyTensor.project C + let I := CohomologyTensor.embed C + let u := Q α + let Dbar := oddTensor (fun i => repMap (C i) (C i).g) (fun i => repMap (C i) (d i)) + let bbar := fun i => repMap (C i) (b i) + let Lbar := L.comp I + have hanti (v : ⨂[K] i, E i) : finiteD C (D v) + D (finiteD C v)=0 := + oddTensor_anticommute (fun i => (C i).g) (fun i => (C i).d) d + (fun i => (C i).dg) hdg hδd v + have hDδ (v : ⨂[K] i, E i) : D (finiteD C v) = -finiteD C (D v) := + eq_neg_of_add_eq_zero_right (hanti v) + have hδD (v : ⨂[K] i, E i) : finiteD C (D v) = -D (finiteD C v) := + eq_neg_of_add_eq_zero_left (hanti v) + have hQDδ (v : ⨂[K] i, E i) : Q (D (finiteD C v))=0 := by + rw [hDδ,map_neg,CohomologyTensor.project_d,neg_zero] + have huD : Dbar u=0 := by + change Dbar (CohomologyTensor.project C α)=0 + rw [← odd_sandwich C d,operator_projection C D hQDδ α hαδ,hαd,map_zero] + have htr (S : Finset ι) (hS : S.card=3) : + partialTensor (fun i => ↥(Factors C i)) bbar S u=0 := by + change partialTensor (fun i => ↥(Factors C i)) bbar S (CohomologyTensor.project C α)=0 + rw [← partial_sandwich C b S] + have hpres (v : ⨂[K] i, E i) : + CohomologyTensor.project C (partialTensor E b S (finiteD C v))=0 := by + rw [partial_commute C b (fun i v => (hδb i v).symm) hbg,CohomologyTensor.project_d] + rw [operator_projection C (partialTensor E b S) hpres α hαδ] + obtain ⟨v,hv⟩ := htrip S hS + rw [← hv,CohomologyTensor.project_d] + have hLbarD (v : ⨂[K] i, Factors C i) : Lbar (Dbar v)=0 := by + change L (I (Dbar v))=0 + rw [← odd_sandwich C d] + have hcy : finiteD C (D (I v))=0 := by + rw [hδD,CohomologyTensor.d_include,map_zero,neg_zero] + exact (pairing_projection C L hLδ (D (I v)) hcy).trans (hLd (I v)) + have huL : Lbar u ≠ 0 := by + change L (I (Q α)) ≠ 0 + rw [pairing_projection C L hLδ α hαδ] + exact hLα + choose R hRd hRg hRp using fun i => exists_induced_reduction (C i) (d i) (b i) (C i).g + (hdd i) (C i).gg (hdg i) (hδd i) (C i).dg (hδb i) (hbg i) + have htotal : finiteD R = Dbar := by + unfold finiteD Dbar oddTensor + congr 1 + funext i + congr 1 + funext j + simp only [dcoord,oddCoordinate,hRd,hRg] + have huR : finiteD R u=0 := by rw [htotal]; exact huD + have huKer : u ∈ kernelSupport (fun i => ↥(Factors C i)) bbar 2 := + triple_kernel_support (fun i => ↥(Factors C i)) bbar u htr + let Good : Set (⨂[K] i, Factors C i) := {v | ∃ (f : ∀ i, Factors C i) (S : Finset ι), + S.card ≤ 2 ∧ (∀ i, (R i).d (f i)=0) ∧ (∀ i ∉ S, bbar i (f i)=0) ∧ + PiTensorProduct.tprod K f=v} + have hspan : kernelSupport (fun i => ↥(Factors C i)) bbar 2 ≤ + (Submodule.span K Good).comap (finiteP R) := by + apply Submodule.span_le.mpr + rintro v ⟨f,S,hS,hb,hf⟩ + subst v + change finiteP R (PiTensorProduct.tprod K f) ∈ Submodule.span K Good + rw [finiteP,PiTensorProduct.map_tprod] + apply Submodule.subset_span + refine ⟨fun i => (R i).p (f i),S,hS,?_,?_,rfl⟩ + · intro i; exact (R i).dp (f i) + · intro i hi; exact hRp i (f i) (hb i hi) + have hvGood : finiteP R u ∈ Submodule.span K Good := hspan huKer + have hvL : Lbar (finiteP R u) ≠ 0 := by + obtain ⟨v,hv⟩ := finite_cycle_mod_projection R u huR + have hh := congrArg Lbar hv + rw [htotal,hLbarD,map_sub] at hh + rw [← sub_eq_zero.mp hh.symm] + exact huL + have hex : ∃ v ∈ Good, Lbar v ≠ 0 := by + by_contra hnone + push Not at hnone + have hker : Submodule.span K Good ≤ LinearMap.ker Lbar := by + apply Submodule.span_le.mpr + intro v hv + exact hnone v hv + exact hvL (hker hvGood) + obtain ⟨v,⟨f,S,hS,hfd,hfb,hfv⟩,hLv⟩ := hex + subst v + refine ⟨fun i => repInclude (C i) (f i),S,hS,?_,?_,?_,?_⟩ + · intro i; exact SuperReduction.d_include (C i) (f i) + · intro i + apply cycle_of_project_zero (C i) + · rw [hδd,SuperReduction.d_include,map_zero,neg_zero] + · change repMap (C i) (d i) (f i)=0 + rw [← hRd]; exact hfd i + · intro i hi + apply cycle_of_project_zero (C i) + · rw [hδb,SuperReduction.d_include,map_zero] + · exact hfb i hi + · simpa only [Lbar,I,CohomologyTensor.embed,LinearMap.comp_apply, + PiTensorProduct.map_tprod] using hLv + +end +end PD4Tensor + + + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct BigOperators +variable {K R ι : Type*} [Field K] [CommRing R] [Algebra K R] +variable [Fintype ι] [LinearOrder ι] +variable {E : ι → Type*} [∀ i, AddCommGroup (E i)] [∀ i, Module K (E i)] + + +def deformedTensor (g δ k : ∀ i, E i →ₗ[K] E i) (t : ι → R) : + R ⊗[K] (⨂[K] i, E i) →ₗ[K] R ⊗[K] (⨂[K] i, E i) := + TensorProduct.map LinearMap.id (oddTensor g δ) + + ∑ i, TensorProduct.map (LinearMap.mulLeft K (t i)) + (PiTensorProduct.map (oddCoordinate g k i)) + + +def tensorLift (a c : ∀ i, E i) (t : ι → R) : R ⊗[K] (⨂[K] i, E i) := + ∑ S : Finset ι, (∏ i∈S, t i) ⊗ₜ[K] PiTensorProduct.tprod K (S.piecewise c a) + + +theorem sum_finsets_split {M : Type*} [AddCommMonoid M] (f : Finset ι → M) (i : ι) : + ∑ S : Finset ι, f S = ∑ S ∈ Finset.univ.filter (fun S : Finset ι => i∉S), + (f S + f (insert i S)) := by + classical + rw [Finset.sum_add_distrib] + have h := Finset.sum_filter_add_sum_filter_not Finset.univ (fun S : Finset ι => i∉S) f + rw [← h] + congr 1 + symm + apply Finset.sum_bij (fun S hS => insert i S) + · intro S hS + simp only [Finset.mem_filter,Finset.mem_univ,true_and] at hS ⊢ + simp + · intro S hS T hT heq + have hs : i∉S := (Finset.mem_filter.mp hS).2 + have ht : i∉T := (Finset.mem_filter.mp hT).2 + simpa only [Finset.erase_insert hs,Finset.erase_insert ht] using + congrArg (fun U : Finset ι => U.erase i) heq + · intro S hS + have hs : i∈S := by simpa only [Finset.mem_filter,Finset.mem_univ,true_and,not_not] using hS + refine ⟨S.erase i,by simp,Finset.insert_erase hs⟩ + · intro S hS; rfl + +def deformedCoordinate (g δ k : ∀ i, E i →ₗ[K] E i) (t : ι → R) (i : ι) : + R ⊗[K] (⨂[K] i, E i) →ₗ[K] R ⊗[K] (⨂[K] i, E i) := + TensorProduct.map LinearMap.id (PiTensorProduct.map (oddCoordinate g δ i)) + + TensorProduct.map (LinearMap.mulLeft K (t i)) + (PiTensorProduct.map (oddCoordinate g k i)) + +theorem deformedTensor_eq_sum (g δ k : ∀ i, E i →ₗ[K] E i) (t : ι → R) : + deformedTensor g δ k t = ∑ i, deformedCoordinate g δ k t i := by + apply TensorProduct.ext + apply LinearMap.ext + intro r + apply LinearMap.ext + intro v + change deformedTensor g δ k t (r ⊗ₜ[K] v) = (∑ i, deformedCoordinate g δ k t i) (r ⊗ₜ[K] v) + simp only [deformedTensor,deformedCoordinate,oddTensor,LinearMap.sum_apply, + LinearMap.add_apply,TensorProduct.map_tmul,LinearMap.id_apply, + LinearMap.mulLeft_apply,TensorProduct.tmul_sum,Finset.sum_add_distrib] + + + +theorem tensorLift_cycle (g δ k : ∀ i, E i →ₗ[K] E i) (a c : ∀ i, E i) + (ha : ∀ i, δ i (a i)=0) (hc : ∀ i, δ i (c i)= -k i (a i)) + (t : ι → R) (ht : ∀ i, t i * t i=0) : + deformedTensor g δ k t (tensorLift a c t)=0 := by + rw [deformedTensor_eq_sum,LinearMap.sum_apply] + apply Finset.sum_eq_zero + intro i _ + simp only [tensorLift,map_sum] + rw [sum_finsets_split _ i] + apply Finset.sum_eq_zero + intro S hS + have hi : i∉S := (Finset.mem_filter.mp hS).2 + have hzero : PiTensorProduct.map (oddCoordinate g δ i) + (PiTensorProduct.tprod K (S.piecewise c a))=0 := by + rw [PiTensorProduct.map_tprod] + apply (PiTensorProduct.tprod K).map_coord_zero i + simp [oddCoordinate,hi,ha] + have hneg : PiTensorProduct.map (oddCoordinate g δ i) + (PiTensorProduct.tprod K ((insert i S).piecewise c a)) = + -PiTensorProduct.map (oddCoordinate g k i) + (PiTensorProduct.tprod K (S.piecewise c a)) := by + simp only [PiTensorProduct.map_tprod] + let factors : ∀ j, E j := fun j => oddCoordinate g k i j (S.piecewise c a j) + have hcoords : (fun j => oddCoordinate g δ i j ((insert i S).piecewise c a j)) = + Function.update factors i (-factors i) := by + funext j + by_cases hji : j=i + · subst j; simp [factors,oddCoordinate,hi,hc] + · simp only [Function.update_of_ne hji,factors] + simp only [Finset.piecewise] + by_cases hlt : j < i + · simp [oddCoordinate,hlt,hji] + · simp [oddCoordinate,hlt,hji] + rw [hcoords,(PiTensorProduct.tprod K).map_update_neg,Function.update_eq_self] + have hsq : t i * (t i * ∏ j∈S,t j)=0 := by rw [← mul_assoc,ht,zero_mul] + simp only [deformedCoordinate,LinearMap.add_apply,TensorProduct.map_tmul, + LinearMap.id_apply,LinearMap.mulLeft_apply,Finset.prod_insert hi,hzero,hneg, + TensorProduct.tmul_zero,zero_add,TensorProduct.tmul_neg,hsq, + TensorProduct.zero_tmul,add_zero,add_neg_cancel] + +variable {V : Type*} [AddCommGroup V] [Module K V] + + +def specializeTensor (ε : R →ₐ[K] K) : R ⊗[K] V →ₗ[K] V := + (TensorProduct.lid K V).toLinearMap.comp (TensorProduct.map ε.toLinearMap LinearMap.id) + +@[simp] theorem specializeTensor_tmul (ε : R →ₐ[K] K) (r : R) (v : V) : + specializeTensor ε (r ⊗ₜ[K] v) = ε r • v := by + simp [specializeTensor] + + +theorem specialize_tensorLift (a c : ∀ i, E i) (t : ι → R) (ε : R →ₐ[K] K) + (ht : ∀ i, ε (t i)=0) : + specializeTensor ε (tensorLift a c t) = PiTensorProduct.tprod K a := by + rw [tensorLift,map_sum] + rw [Finset.sum_eq_single (∅ : Finset ι)] + · simp + · intro S _ hS + obtain ⟨i,hi⟩ := Finset.nonempty_iff_ne_empty.mpr hS + rw [specializeTensor_tmul,map_prod] + have hz : ∏ j∈S, ε (t j)=0 := Finset.prod_eq_zero hi (ht i) + rw [hz,zero_smul] + · simp + +end +end PD4Tensor + + + +noncomputable section + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct BigOperators +open SuperReduction CohomologyTensor +variable {K ι : Type*} [Field K] [Invertible (2:K)] [Fintype ι] [LinearOrder ι] +variable {E : ι → Type*} [∀ i, AddCommGroup (E i)] [∀ i, Module K (E i)] + + + +omit [Invertible (2:K)] in +theorem selective_tensorLift_cycle + (g δ k : ∀ i, E i →ₗ[K] E i) (a c : ∀ i,E i) (q : Fin 3 ↪ ι) + (ha : ∀ i, δ i (a i)=0) + (hc : ∀ i∈Set.range q, δ i (c i)= -k i (a i)) + (hz : ∀ i∉Set.range q, c i=0) : + deformedTensor g δ k (threeParameters (K:=K) q) + (tensorLift a c (threeParameters (K:=K) q))=0 := by + classical + let k' : ∀ i,E i →ₗ[K] E i := fun i => if i∈Set.range q then k i else 0 + have hcorr (i : ι) : δ i (c i)= -k' i (a i) := by + by_cases hi : i∈Set.range q + · simpa only [k',ite_eq_left hi] using hc i hi + · simp only [k',ite_eq_right hi,hz i hi,map_zero,LinearMap.zero_apply,neg_zero] + have hd : deformedTensor g δ k (threeParameters (K:=K) q) = + deformedTensor g δ k' (threeParameters (K:=K) q) := by + unfold deformedTensor + congr 1 + apply Finset.sum_congr rfl + intro i _ + by_cases hi : i∈Set.range q + · congr 1 + congr 1 + funext j + simp only [oddCoordinate] + split_ifs with hji hji + · rfl + · subst j; simp only [k',ite_eq_left hi] + · rfl + · rw [threeParameters_other q i hi] + simp + rw [hd] + exact tensorLift_cycle g δ k' a c ha hcorr _ (threeParameters_sq q) + + + +theorem exists_three_deformed_cycle + (C : ∀ i, SuperReduction K (E i)) (d b : ∀ i, E i →ₗ[K] E i) + (hdd : ∀ i v, d i (d i v)=0) + (hdg : ∀ i v, d i ((C i).g v) = -(C i).g (d i v)) + (hδd : ∀ i v, (C i).d (d i v) = -d i ((C i).d v)) + (hδb : ∀ i v, (C i).d (b i v) = b i ((C i).d v)) + (hbg : ∀ i v, b i ((C i).g v) = (C i).g (b i v)) + (A : Finset ι) (hA : 5 ≤ A.card) + (α : ⨂[K] i, E i) + (hαδ : finiteD C α=0) + (hαd : oddTensor (fun i => (C i).g) d α=0) + (htrip : ∀ S : Finset ι, S.card=3 → partialTensor E b S α ∈ LinearMap.range (finiteD C)) + (L : (⨂[K] i, E i) →ₗ[K] K) + (hLδ : ∀ v, L (finiteD C v)=0) + (hLd : ∀ v, L (oddTensor (fun i => (C i).g) d v)=0) + (hLα : L α ≠ 0) : + ∃ (q : Fin 3 ↪ ι) (κ : T K 3 ⊗[K] (⨂[K] i,E i)), + (∀ j, q j∈A) ∧ + deformedTensor (fun i => (C i).g) (fun i => (C i).d) + (fun i => (d i).comp (b i) - (b i).comp (d i)) + (threeParameters (K:=K) q) κ=0 ∧ + L (specializeTensor (augmentationAlg K 3) κ) ≠ 0 := by + classical + obtain ⟨a,S,hS,ha,had,hab,hLa⟩ := exists_liftable_pure_tensor C d b hdd hdg hδd hδb hbg + α hαδ hαd htrip L hLδ hLd hLα + have hsd : 2 < (A\S).card := by + have h := Finset.card_le_card (Finset.inter_subset_right (s₁:=A) (s₂:=S)) + have h' := Finset.card_sdiff_add_card_inter A S + omega + obtain ⟨i,j,k,hi,hj,hk,hij,hik,hjk⟩ := Finset.two_lt_card_iff.mp hsd + let q : Fin 3 ↪ ι := ⟨![i,j,k],by + intro r s hrs + fin_cases r <;> fin_cases s <;> simp_all⟩ + have hq (r : Fin 3) : q r∈A\S := by fin_cases r <;> assumption + choose β hβ using had + have hgam : ∀ u∈Set.range q, ∃ γ, (C u).d γ=b u (a u) := by + rintro u ⟨r,rfl⟩ + exact hab _ (Finset.mem_sdiff.mp (hq r)).2 + choose γ hγ using hgam + let c : ∀ u,E u := fun u => if hu : u∈Set.range q then d u (γ u hu) + b u (β u) else 0 + refine ⟨q,tensorLift a c (threeParameters (K:=K) q),?_,?_,?_⟩ + · intro r; exact (Finset.mem_sdiff.mp (hq r)).1 + · apply selective_tensorLift_cycle _ _ _ a c q ha + · intro u hu + simp only [c,dite_eq_left hu,map_add,hδd,hδb,hγ,hβ, + LinearMap.sub_apply,LinearMap.comp_apply] + abel + · intro u hu; simp only [c,dite_eq_right hu] + · rw [specialize_tensorLift] + · exact hLa + · intro u; exact augmentation_threeParameters q u + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct BigOperators +open SuperReduction CohomologyTensor +variable {K ι : Type*} [Field K] [Invertible (2:K)] [Fintype ι] [LinearOrder ι] +variable {E : ι → Type*} [∀ i, AddCommGroup (E i)] [∀ i, Module K (E i)] + + + +theorem finite_tensor_pairing_obstruction + (C : ∀ i, SuperReduction K (E i)) (d b : ∀ i, E i →ₗ[K] E i) + (hdd : ∀ i v, d i (d i v)=0) + (hdg : ∀ i v, d i ((C i).g v) = -(C i).g (d i v)) + (hδd : ∀ i v, (C i).d (d i v) = -d i ((C i).d v)) + (hδb : ∀ i v, (C i).d (b i v) = b i ((C i).d v)) + (hbg : ∀ i v, b i ((C i).g v) = (C i).g (b i v)) + (A : Finset ι) (hA : 5 ≤ A.card) + (α : ⨂[K] i, E i) + (hαδ : finiteD C α=0) + (hαd : oddTensor (fun i => (C i).g) d α=0) + (htrip : ∀ S : Finset ι, S.card=3 → partialTensor E b S α ∈ LinearMap.range (finiteD C)) + (L : (⨂[K] i, E i) →ₗ[K] K) + (hLδ : ∀ v, L (finiteD C v)=0) + (hLd : ∀ v, L (oddTensor (fun i => (C i).g) d v)=0) + (hLα : L α ≠ 0) + (W : Type*) [AddCommGroup W] [Module K W] [Module (T K 3) W] + (left : (Fin 3 ↪ ι) → W) + (Δ : (Fin 3 ↪ ι) → W →ₗ[K] W) + (B : (Fin 3 ↪ ι) → W →ₗ[T K 3] (T K 3 ⊗[K] (⨂[K] i, E i)) →ₗ[T K 3] T K 3) + (hcentral : ∀ q v, augmentation K 3 (B q (left q) v) = + L (specializeTensor (augmentationAlg K 3) v)) + (hboundary : ∀ q u v, + deformedTensor (fun i => (C i).g) (fun i => (C i).d) + (fun i => (d i).comp (b i) - (b i).comp (d i)) + (threeParameters (K:=K) q) v=0 → B q (Δ q u) v=0) + (hleft : ∀ q, (∀ j, q j∈A) → ∃ u, Δ q u= + (t K 3 0 * t K 3 1 * t K 3 2) • left q) : False := by + obtain ⟨q,κ,hq,hκ,hLκ⟩ := exists_three_deformed_cycle C d b hdd hdg hδd hδb hbg + A hA α hαδ hαd htrip L hLδ hLd hLα + have hunit : IsUnit (B q (left q) κ) := by + apply isUnit_of_augmentation_ne_zero + rw [hcentral] + exact hLκ + obtain ⟨u,hu⟩ := hleft q hq + have hzero := hboundary q u κ hκ + rw [hu,LinearMap.map_smul,LinearMap.smul_apply,smul_eq_mul] at hzero + exact triple_mul_unit_ne_zero K 3 0 1 2 (by decide) (by decide) (by decide) hunit hzero + +end +end PD4Tensor +end + +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/DeformedGraphs.lean b/lean/OAI/Algebra/FiniteTensor/DeformedGraphs.lean new file mode 100644 index 0000000000000000000000000000000000000000..7997c218fcf2c1d9984570cfea6f37f9c6d8d206 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/DeformedGraphs.lean @@ -0,0 +1,221 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.SquarefreeParameters + +namespace OAI + +/-! Separated potentials, parameter selection and complementary deformed graphs. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped BigOperators +universe u +variable (K : Type*) [Field K] (p : ℕ) {n : ℕ} + (σ : Fin (n+1) → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + + +def formalSigmaPotential (F : ∀ i,MvPowerSeries (σ i) K) : + MvPowerSeries ((i : Fin (n+1)) × σ i) K := + ∑ i,MvPowerSeries.rename (Sigma.mk i) (F i) + + +def formalSigmaSelected (b : ∀ i,MvPowerSeries (σ i) K) (s : Finset (Fin (n+1))) : + MvPowerSeries ((i : Fin (n+1)) × σ i) K := + ∏ i∈s,MvPowerSeries.rename (Sigma.mk i) (b i) + + +def formalSigmaDeformed (F b : ∀ i,MvPowerSeries (σ i) K) (q : Fin 3 ↪ Fin (n+1)) : + MvPowerSeries ((i : Fin (n+1)) × σ i) (T K 3) := + MvPowerSeries.map (algebraMap K (T K 3)) (formalSigmaPotential K σ F) + + ∑ i,MvPowerSeries.C (threeParameters (K:=K) q i) * + MvPowerSeries.map (algebraMap K (T K 3)) (MvPowerSeries.rename (Sigma.mk i) (b i)) + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped BigOperators +universe u +variable (K : Type*) [Field K] {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i,Fintype (σ i)] (m : ℕ) + + + +def formalActiveDeformed (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) : + MvPowerSeries ((i : Fin (n+1)) × σ i) (T K m) := + MvPowerSeries.map (algebraMap K (T K m)) (formalSigmaPotential K σ F) + + ∑ j,MvPowerSeries.C (t K m j)*MvPowerSeries.map (algebraMap K (T K m)) + (MvPowerSeries.rename (Sigma.mk (active j)) (b j)) + +theorem augmentation_formalActiveDeformed (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) : + MvPowerSeries.map (augmentation K m) (formalActiveDeformed K σ m F active b)= + formalSigmaPotential K σ F := by + classical + have hc : (augmentation K m).comp (algebraMap K (T K m))=RingHom.id K := by + ext a + exact (augmentationAlg K m).commutes a + simp only [formalActiveDeformed,map_add,map_sum,map_mul,MvPowerSeries.map_C, + MvPowerSeries.map_map,hc,augmentation_t,map_zero,zero_mul,Finset.sum_const_zero, + add_zero,MvPowerSeries.map_id,RingHom.id_apply] + +theorem sum_threeParameters_activeExtension + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (q : Fin 3 ↪ Fin (n+1)) : + (∑ i,MvPowerSeries.C (threeParameters (K:=K) q i)* + MvPowerSeries.map (algebraMap K (T K 3)) + (MvPowerSeries.rename (Sigma.mk i) (activeExtension (A:=fun i => MvPowerSeries (σ i) K) active b i)))= + ∑ j,MvPowerSeries.C (threeParameters (K:=K) q (active j))* + MvPowerSeries.map (algebraMap K (T K 3)) + (MvPowerSeries.rename (Sigma.mk (active j)) (b j)) := by + classical + let f : ∀ i,MvPowerSeries (σ i) K →+ MvPowerSeries ((i : Fin (n+1)) × σ i) (T K 3) := + fun i => { + toFun := fun a => MvPowerSeries.C (threeParameters (K:=K) q i)* + MvPowerSeries.map (algebraMap K (T K 3)) (MvPowerSeries.rename (Sigma.mk i) a) + map_zero' := by simp only [map_zero,mul_zero] + map_add' := fun a b => by simp only [map_add,mul_add] } + exact sum_activeExtension (A:=fun i => MvPowerSeries (σ i) K) active b f + +theorem selector_formalActiveDeformed (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (q : Fin 3 ↪ Fin (n+1)) : + MvPowerSeries.map (parameterSelector K m active q).toRingHom + (formalActiveDeformed K σ m F active b)= + formalSigmaDeformed K σ F (activeExtension active b) q := by + classical + have hc : (parameterSelector K m active q).toRingHom.comp (algebraMap K (T K m))= + algebraMap K (T K 3) := by + ext a + exact (parameterSelector K m active q).commutes a + simp only [formalActiveDeformed,formalSigmaDeformed,map_add,map_sum,map_mul, + MvPowerSeries.map_C,MvPowerSeries.map_map] + erw [hc] + simp only [AlgHom.toRingHom_eq_coe,AlgHom.coe_toRingHom,parameterSelector_t] + congr 1 + exact (sum_threeParameters_activeExtension K σ m active b q).symm + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped BigOperators +universe u +variable (K : Type*) [Field K] {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i,Fintype (σ i)] (m : ℕ) + +theorem augmentation_selector_graph {υ τ : Type*} + (active : Fin m ↪ Fin (n+1)) (q : Fin 3 ↪ Fin (n+1)) + (H : υ → MvPowerSeries τ (T K m)) (i : υ) : + MvPowerSeries.map (augmentation K 3) + (MvPowerSeries.map (parameterSelector K m active q).toRingHom (H i))= + MvPowerSeries.map (augmentation K m) (H i) := by + ext d + simp only [MvPowerSeries.coeff_map,AlgHom.toRingHom_eq_coe,AlgHom.coe_toRingHom, + augmentation_parameterSelector] + +theorem central_graph_zero {d : ℕ} (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (H : ((i : Fin (n+1)) × σ i) → MvPowerSeries (Fin d) (T K m)) + (hH : MvPowerSeries.HasSubst H) + (hL : MvPowerSeries.subst H (formalActiveDeformed K σ m F active b)=0) : + MvPowerSeries.subst (fun i => MvPowerSeries.map (augmentation K m) (H i)) + (formalSigmaPotential K σ F)=0 := by + have hh := congrArg (MvPowerSeries.map (augmentation K m)) hL + rw [MvPowerSeries.map_subst hH,augmentation_formalActiveDeformed,map_zero] at hh + exact hh + +theorem selector_graph_zero {d : ℕ} (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (H : ((i : Fin (n+1)) × σ i) → MvPowerSeries (Fin d) (T K m)) + (hH : MvPowerSeries.HasSubst H) + (hL : MvPowerSeries.subst H (formalActiveDeformed K σ m F active b)=0) + (q : Fin 3 ↪ Fin (n+1)) : + MvPowerSeries.subst (fun i => MvPowerSeries.map (parameterSelector K m active q).toRingHom (H i)) + (formalSigmaDeformed K σ F (activeExtension active b) q)=0 := by + have hh := congrArg (MvPowerSeries.map (parameterSelector K m active q).toRingHom) hL + rw [MvPowerSeries.map_subst hH,selector_formalActiveDeformed,map_zero] at hh + exact hh + +theorem selector_graph_triple {d : ℕ} (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (H : ((i : Fin (n+1)) × σ i) → MvPowerSeries (Fin d) (T K m)) + (hH : MvPowerSeries.HasSubst H) + (htrip : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.C (t K m i*t K m j*t K m k)∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst H + (MvPowerSeries.pderiv x (formalActiveDeformed K σ m F active b))))) + (q : Fin 3 ↪ Fin (n+1)) (hq : ∀ j,q j∈Set.range active) : + MvPowerSeries.C (t K 3 0*t K 3 1*t K 3 2)∈Ideal.span + (Set.range (fun x => + MvPowerSeries.subst (fun i => MvPowerSeries.map (parameterSelector K m active q).toRingHom (H i)) + (MvPowerSeries.pderiv x (formalSigmaDeformed K σ F (activeExtension active b) q)))) := by + classical + obtain ⟨r,hr⟩ := embedding_preimage active q hq + have h01 : r 0≠r 1 := r.injective.ne (by decide) + have h02 : r 0≠r 2 := r.injective.ne (by decide) + have h12 : r 1≠r 2 := r.injective.ne (by decide) + have ht : MvPowerSeries.subst H + (MvPowerSeries.C (t K m (r 0)*t K m (r 1)*t K m (r 2)))∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst H + (MvPowerSeries.pderiv x (formalActiveDeformed K σ m F active b)))) := by + simpa only [MvPowerSeries.subst_C] using htrip (r 0) (r 1) (r 2) h01 h02 h12 + have hh := map_formal_gradient (parameterSelector K m active q).toRingHom H hH + (formalActiveDeformed K σ m F active b) + (MvPowerSeries.C (t K m (r 0)*t K m (r 1)*t K m (r 2))) ht + rw [selector_formalActiveDeformed] at hh + have hscalar : (parameterSelector K m active q).toRingHom + (t K m (r 0)*t K m (r 1)*t K m (r 2))=t K 3 0*t K 3 1*t K 3 2 := by + simp only [map_mul,AlgHom.toRingHom_eq_coe,AlgHom.coe_toRingHom, + parameterSelector_t,hr,threeParameters_selected] + rw [MvPowerSeries.map_C,hscalar,MvPowerSeries.subst_C] at hh + exact hh + +theorem formalSigmaSelected_active_triple + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (i j k : Fin m) (hij : i≠j) (hik : i≠k) (hjk : j≠k) : + formalSigmaSelected K σ (activeExtension active b) {active i,active j,active k}= + MvPowerSeries.rename (Sigma.mk (active i)) (b i)* + MvPowerSeries.rename (Sigma.mk (active j)) (b j)* + MvPowerSeries.rename (Sigma.mk (active k)) (b k) := by + classical + simp [formalSigmaSelected,active.injective.ne hij,active.injective.ne hik, + active.injective.ne hjk,mul_assoc] + + + +theorem active_right_triples {c : ℕ} (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (G : ((i : Fin (n+1)) × σ i) → MvPowerSeries (Fin c) K) + (htrip : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.subst G + (MvPowerSeries.rename (Sigma.mk (active i)) (b i)* + MvPowerSeries.rename (Sigma.mk (active j)) (b j)* + MvPowerSeries.rename (Sigma.mk (active k)) (b k))∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst G + (MvPowerSeries.pderiv x (formalSigmaPotential K σ F))))) + (s : Finset (Fin (n+1))) (hs : ∀ i∈s,i∈Set.range active) (hc : s.card=3) : + MvPowerSeries.subst G (formalSigmaSelected K σ (activeExtension active b) s)∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst G + (MvPowerSeries.pderiv x (formalSigmaPotential K σ F)))) := by + classical + obtain ⟨x,y,z,hxy,hxz,hyz,rfl⟩ := Finset.card_eq_three.mp hc + obtain ⟨i,rfl⟩ := hs x (by simp) + obtain ⟨j,rfl⟩ := hs y (by simp) + obtain ⟨k,rfl⟩ := hs z (by simp) + have hij : i≠j := fun h => hxy (congrArg active h) + have hik : i≠k := fun h => hxz (congrArg active h) + have hjk : j≠k := fun h => hyz (congrArg active h) + rw [formalSigmaSelected_active_triple K σ m active b i j k hij hik hjk] + exact htrip i j k hij hik hjk + +end +end PD4Tensor.TruncatedForms +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/ExteriorForms.lean b/lean/OAI/Algebra/FiniteTensor/ExteriorForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..c576226cd3ee85d476458bfe92f381a009739707 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/ExteriorForms.lean @@ -0,0 +1,364 @@ +import Mathlib + +namespace OAI + +/-! Exterior forms, differentials, Koszul operators and residue pairings. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct BigOperators + +variable (K A σ : Type*) [Field K] [CommRing A] [Algebra K A] + [Fintype σ] [DecidableEq σ] + +abbrev E := ExteriorAlgebra K (σ → K) +abbrev Ω := A ⊗[K] E K σ + +def dx (i : σ) : E K σ := ExteriorAlgebra.ι K (Pi.single i 1) +def scalar (a : A) : Ω K A σ := a ⊗ₜ[K] (1 : E K σ) +def parity : Ω K A σ →ₐ[K] Ω K A σ := + Algebra.TensorProduct.map (AlgHom.id K A) CliffordAlgebra.involute + +def oneForm (v : σ → A) : Ω K A σ := ∑ i, v i ⊗ₜ[K] dx K σ i + +variable {K A σ} + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem parity_tmul (a : A) (e : E K σ) : + parity K A σ (a ⊗ₜ[K] e) = a ⊗ₜ[K] CliffordAlgebra.involute e := rfl + +omit [Fintype σ] in +@[simp] theorem parity_dx (i : σ) : + CliffordAlgebra.involute (dx K σ i) = -dx K σ i := by + exact CliffordAlgebra.involute_ι _ + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem parity_parity (ω : Ω K A σ) : + parity K A σ (parity K A σ ω) = ω := by + induction ω using TensorProduct.inductionOn with + | tmul a e => simp + | add a b ha hb => simp [ha, hb] + +omit [Fintype σ] [DecidableEq σ] in +theorem exterior_anticommute (v : σ → K) (e : E K σ) : + ExteriorAlgebra.ι K v * e = CliffordAlgebra.involute e * ExteriorAlgebra.ι K v := by + induction e using ExteriorAlgebra.induction with + | algebraMap r => simp [Algebra.commutes] + | ι w => + rw [CliffordAlgebra.involute_ι, neg_mul] + exact eq_neg_of_add_eq_zero_left (ExteriorAlgebra.ι_add_mul_swap v w) + | mul a b ha hb => + rw [map_mul, ← mul_assoc, ha, mul_assoc, hb, ← mul_assoc] + | add a b ha hb => simp [mul_add, add_mul, ha, hb] + +theorem oneForm_anticommute (v : σ → A) (ω : Ω K A σ) : + oneForm K A σ v * ω = parity K A σ ω * oneForm K A σ v := by + induction ω using TensorProduct.inductionOn with + | tmul a e => + simp only [oneForm, Finset.sum_mul, Finset.mul_sum, parity_tmul, + Algebra.TensorProduct.tmul_mul_tmul] + apply Finset.sum_congr rfl + intro i _ + rw [mul_comm (v i) a, dx, exterior_anticommute] + | add a b ha hb => simp [mul_add, add_mul, ha, hb] + +@[simp] theorem parity_oneForm (v : σ → A) : + parity K A σ (oneForm K A σ v) = -oneForm K A σ v := by + simp only [oneForm, map_sum, parity_tmul, parity_dx, TensorProduct.tmul_neg, + Finset.sum_neg_distrib] + +theorem oneForm_sq_zero [Invertible (2 : K)] (v : σ → A) : + oneForm K A σ v * oneForm K A σ v = 0 := by + have h := oneForm_anticommute v (oneForm K A σ v) + rw [parity_oneForm, neg_mul] at h + have h2 : (2 : K) • (oneForm K A σ v * oneForm K A σ v) = 0 := by + rw [two_smul K] + exact eq_neg_iff_add_eq_zero.mp h + exact (isUnit_of_invertible (2 : K)).smul_eq_zero.mp h2 + +variable (K A σ) + +def differential (der : σ → A →ₗ[K] A) : Ω K A σ →ₗ[K] Ω K A σ := + ∑ i, TensorProduct.map (der i) (LinearMap.mulLeft K (dx K σ i)) + +variable {K A σ} +@[simp] theorem differential_tmul (der : σ → A →ₗ[K] A) (a : A) (e : E K σ) : + differential K A σ der (a ⊗ₜ[K] e) = ∑ i, der i a ⊗ₜ[K] (dx K σ i * e) := by + simp [differential] + +@[simp] theorem differential_scalar (der : σ → A →ₗ[K] A) (a : A) : + differential K A σ der (scalar K A σ a) = oneForm K A σ (fun i => der i a) := by + simp [scalar, oneForm] + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem parity_scalar (a : A) : parity K A σ (scalar K A σ a) = scalar K A σ a := by + simp [scalar] + +theorem differential_mul (der : σ → A →ₗ[K] A) + (hder : ∀ i a b, der i (a*b) = der i a * b + a * der i b) + (ω η : Ω K A σ) : + differential K A σ der (ω*η) = differential K A σ der ω * η + + parity K A σ ω * differential K A σ der η := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp only [add_mul, map_add, ha, hb]; abel + | tmul a e => + induction η using TensorProduct.inductionOn with + | add b c hb hc => simp only [mul_add, map_add, hb, hc]; abel + | tmul b f => + simp only [Algebra.TensorProduct.tmul_mul_tmul, differential_tmul, + Finset.sum_mul, Finset.mul_sum, parity_tmul, hder, TensorProduct.add_tmul] + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + simp only [dx, ← mul_assoc, exterior_anticommute (Pi.single i 1) e] + +theorem differential_parity (der : σ → A →ₗ[K] A) (ω : Ω K A σ) : + differential K A σ der (parity K A σ ω) = -parity K A σ (differential K A σ der ω) := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp only [map_add, ha, hb]; abel + | tmul a e => + simp only [parity_tmul, differential_tmul, map_sum, map_mul, parity_dx, + neg_mul, TensorProduct.tmul_neg, Finset.sum_neg_distrib, neg_neg] + +theorem differential_sq_zero [Invertible (2 : K)] (der : σ → A →ₗ[K] A) + (hder : ∀ i j a, der i (der j a) = der j (der i a)) (ω : Ω K A σ) : + differential K A σ der (differential K A σ der ω) = 0 := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha, hb] + | tmul a e => + have hanti : ∀ i j, dx K σ i * dx K σ j = -(dx K σ j * dx K σ i) := by + intro i j + exact eq_neg_of_add_eq_zero_left (ExteriorAlgebra.ι_add_mul_swap _ _) + have heq : differential K A σ der (differential K A σ der (a ⊗ₜ[K] e)) = + -differential K A σ der (differential K A σ der (a ⊗ₜ[K] e)) := by + simp only [differential_tmul, map_sum] + conv_rhs => rw [Finset.sum_comm] + simp only [← Finset.sum_neg_distrib] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rw [hder j i a, ← mul_assoc, hanti j i, neg_mul, TensorProduct.tmul_neg, mul_assoc] + exact (isUnit_of_invertible (2 : K)).smul_eq_zero.mp (by + rw [two_smul K] + exact eq_neg_iff_add_eq_zero.mp heq) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem scalar_mul (a b : A) : scalar K A σ (a*b) = scalar K A σ a * scalar K A σ b := by + simp [scalar, Algebra.TensorProduct.tmul_mul_tmul] + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem scalar_add (a b : A) : scalar K A σ (a+b) = scalar K A σ a + scalar K A σ b := by + simp [scalar, TensorProduct.add_tmul] + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem scalar_zero : scalar K A σ 0 = 0 := by simp [scalar] +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem scalar_one : scalar K A σ 1 = 1 := by + exact Algebra.TensorProduct.one_def.symm + +omit [Fintype σ] [DecidableEq σ] in +theorem scalar_commute (a : A) (ω : Ω K A σ) : scalar K A σ a * ω = ω * scalar K A σ a := by + induction ω using TensorProduct.inductionOn with + | add b c hb hc => simp [mul_add, add_mul, hb, hc] + | tmul b e => simp [scalar, Algebra.TensorProduct.tmul_mul_tmul, mul_comm a b] + +variable (K A σ) + +def contraction (i : σ) : Ω K A σ →ₗ[K] Ω K A σ := + TensorProduct.map LinearMap.id (CliffordAlgebra.contractLeft (LinearMap.proj i)) + +variable {K A σ} +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem contraction_tmul (i : σ) (a : A) (e : E K σ) : + contraction K A σ i (a ⊗ₜ[K] e) = + a ⊗ₜ[K] CliffordAlgebra.contractLeft (LinearMap.proj i) e := rfl + +theorem contraction_oneForm_mul (i : σ) (v : σ → A) (ω : Ω K A σ) : + contraction K A σ i (oneForm K A σ v * ω) = + scalar K A σ (v i) * ω - oneForm K A σ v * contraction K A σ i ω := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp only [mul_add, map_add, ha, hb]; abel + | tmul a e => + simp only [oneForm, Finset.sum_mul, map_sum, Algebra.TensorProduct.tmul_mul_tmul, + contraction_tmul, dx, CliffordAlgebra.contractLeft_ι_mul, LinearMap.proj_apply, + TensorProduct.tmul_sub, TensorProduct.tmul_smul, Finset.sum_sub_distrib] + congr 1 + simp [Pi.single_apply, scalar, Algebra.TensorProduct.tmul_mul_tmul] + +theorem gradient_multiple_boundary (v : σ → A) (ω : Ω K A σ) + (hω : oneForm K A σ v * ω = 0) (a : σ → A) : + scalar K A σ (∑ i, a i * v i) * ω ∈ LinearMap.range (LinearMap.mulLeft K (oneForm K A σ v)) := by + refine ⟨∑ i, scalar K A σ (a i) * contraction K A σ i ω, ?_⟩ + simp only [LinearMap.mulLeft_apply, Finset.mul_sum] + have hi : ∀ i, oneForm K A σ v * contraction K A σ i ω = scalar K A σ (v i) * ω := by + intro i + have h := contraction_oneForm_mul i v ω + rw [hω, map_zero] at h + exact (sub_eq_zero.mp h.symm).symm + have hsc : scalar K A σ (∑ i, a i*v i) = ∑ i, scalar K A σ (a i*v i) := by + simp [scalar, TensorProduct.sum_tmul] + rw [hsc, Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + rw [← mul_assoc, ← scalar_commute, mul_assoc, hi, ← mul_assoc, ← scalar_mul] + +variable (K A σ) + +def normalFactor (der : σ → A →ₗ[K] A) (p : ℕ) (c : A) : Ω K A σ := + scalar K A σ (c^(p-1)) * differential K A σ der (scalar K A σ c) + +def normalCycle (der : σ → A →ₗ[K] A) (p : ℕ) (cs : List A) : Ω K A σ := + (cs.map (normalFactor K A σ der p)).prod + +variable {K A σ} +variable [Invertible (2 : K)] +variable (der : σ → A →ₗ[K] A) + (hleib : ∀ i a b, der i (a*b) = der i a*b + a*der i b) + (hcomm : ∀ i j a, der i (der j a) = der j (der i a)) + +omit [Fintype σ] [DecidableEq σ] [Invertible (2 : K)] in +include hleib in +private theorem deriv_one_eq_zero (i : σ) : der i 1 = 0 := by + have h := hleib i 1 1 + simp only [mul_one, one_mul] at h + exact add_left_cancel (show der i 1 + der i 1 = der i 1 + 0 by simpa using h.symm) + +omit [Invertible (2 : K)] in +include hleib in +@[simp] theorem differential_one : differential K A σ der 1 = 0 := by + rw [← scalar_one, differential_scalar] + simp [oneForm, deriv_one_eq_zero der hleib] + +include hleib in +theorem differential_power_mul_self (c : A) (r : ℕ) : + differential K A σ der (scalar K A σ (c^r)) * + differential K A σ der (scalar K A σ c) = 0 := by + have hs : differential K A σ der (scalar K A σ c) * + differential K A σ der (scalar K A σ c) = 0 := by + rw [differential_scalar] + exact oneForm_sq_zero _ + induction r with + | zero => simp [differential_one der hleib] + | succ r ih => + rw [pow_succ, scalar_mul, differential_mul der hleib, parity_scalar, add_mul, + ← scalar_commute c, mul_assoc, ih, mul_zero, zero_add, + mul_assoc, hs, mul_zero] + +include hleib hcomm in +theorem normalFactor_closed (p : ℕ) (c : A) : + differential K A σ der (normalFactor K A σ der p c) = 0 := by + rw [normalFactor, differential_mul der hleib, differential_sq_zero der hcomm, + mul_zero, add_zero] + exact differential_power_mul_self der hleib c _ + +include hleib hcomm in +theorem normalCycle_closed (p : ℕ) (cs : List A) : + differential K A σ der (normalCycle K A σ der p cs) = 0 := by + induction cs with + | nil => simp [normalCycle, differential_one der hleib] + | cons c cs ih => + change differential K A σ der (normalFactor K A σ der p c * normalCycle K A σ der p cs) = 0 + rw [differential_mul der hleib, normalFactor_closed der hleib hcomm, ih] + simp + + +omit [Invertible (2 : K)] in +theorem normalFactor_scalar_ann (p : ℕ) (hp : 0 simp at hc + | cons a cs ih => + change scalar K A σ c * (normalFactor K A σ der p a * normalCycle K A σ der p cs) = 0 + rcases List.mem_cons.mp hc with rfl | hc + · rw [← mul_assoc, normalFactor_scalar_ann der p hp c (hnil c (by simp)), zero_mul] + · rw [← mul_assoc, scalar_commute, mul_assoc, ih (fun b hb => hnil b (by simp [hb])) hc, + mul_zero] + +theorem normalCycle_dscalar_ann (p : ℕ) (cs : List A) (c : A) (hc : c∈cs) : + differential K A σ der (scalar K A σ c) * normalCycle K A σ der p cs = 0 := by + induction cs with + | nil => simp at hc + | cons a cs ih => + change differential K A σ der (scalar K A σ c) * + (normalFactor K A σ der p a * normalCycle K A σ der p cs) = 0 + rcases List.mem_cons.mp hc with rfl | hc + · rw [← mul_assoc, normalFactor_dscalar_ann, zero_mul] + · rw [← mul_assoc, differential_scalar, oneForm_anticommute, mul_assoc, + ← differential_scalar, ih hc, mul_zero] + +include hleib in + + +theorem normalCycle_ideal_ann (p : ℕ) (hp : 0 exact ⟨normalCycle_scalar_ann der p hp cs hnil c hc, + normalCycle_dscalar_ann der p cs c hc⟩ + | zero => simp + | add a b ha hb iha ihb => + simp only [scalar_add, map_add, add_mul, iha.1, ihb.1, iha.2, ihb.2, zero_add] + trivial + | smul a b hb ih => + change scalar K A σ (a*b) * _ = 0 ∧ differential K A σ der (scalar K A σ (a*b)) * _ = 0 + rw [scalar_mul, mul_assoc, ih.1, mul_zero] + constructor + · rfl + · rw [differential_mul der hleib, add_mul, mul_assoc, ih.1, mul_zero, + mul_assoc, ih.2, mul_zero, zero_add] + + +omit [Invertible (2 : K)] in +theorem gradient_ideal_boundary (v : σ → A) (ω : Ω K A σ) + (hω : oneForm K A σ v * ω = 0) (a : A) (ha : a ∈ Ideal.span (Set.range v)) : + scalar K A σ a * ω ∈ LinearMap.range (LinearMap.mulLeft K (oneForm K A σ v)) := by + obtain ⟨b, hb⟩ := Ideal.mem_span_range_iff_exists_fun.mp ha + rw [← hb] + exact gradient_multiple_boundary v ω hω b + + +omit [Invertible (2 : K)] in +theorem oneForm_mul_zero_iff (v : σ → A) (ω : Ω K A σ) : + oneForm K A σ v * ω = 0 ↔ ω * oneForm K A σ v = 0 := by + constructor + · intro h + have he := congrArg (parity K A σ) h + simp only [map_mul, parity_oneForm, map_zero, neg_mul, neg_eq_zero] at he + rw [oneForm_anticommute, parity_parity] at he + exact he + · intro h + rw [oneForm_anticommute] + have he := congrArg (parity K A σ) h + simpa only [map_mul, parity_oneForm, map_zero, mul_neg, neg_eq_zero] using he + + +omit [Invertible (2 : K)] in +theorem boundary_mul_cycle_zero (v : σ → A) (ω η : Ω K A σ) + (hω : ω ∈ LinearMap.range (LinearMap.mulLeft K (oneForm K A σ v))) + (hη : oneForm K A σ v * η = 0) : ω * η = 0 := by + obtain ⟨β, rfl⟩ := hω + change (oneForm K A σ v * β) * η = 0 + rw [oneForm_anticommute, mul_assoc, hη, mul_zero] + +end +end PD4Tensor.Forms +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/FiniteCharts.lean b/lean/OAI/Algebra/FiniteTensor/FiniteCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..dde38da1ce240c79bec2975923f69d310d774830 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/FiniteCharts.lean @@ -0,0 +1,480 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.CoordinateEquivalences + +namespace OAI + +/-! Finite coordinate charts, coefficient extensions and nilpotent deformation equivalences. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K σ τ : Type*) [CommRing K] (e : σ → ℕ) (f : τ → ℕ) + +def leftInclusion : Ring K σ e →ₐ[K] Ring K (σ ⊕ τ) (Sum.elim e f) := + evaluate (fun i => coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inl i)) + (fun i => coord_pow K (σ ⊕ τ) (Sum.elim e f) (Sum.inl i)) + +def leftRestriction (hf : ∀ j, 0 0)) (by + intro i + cases i with + | inl i => exact coord_pow K σ e i + | inr j => exact zero_pow (Nat.ne_of_gt (hf j))) + +@[simp] theorem leftInclusion_coord (i : σ) : + leftInclusion K σ τ e f (coord K σ e i)= + coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inl i) := by + change (MvPolynomial.aeval _) (MvPolynomial.X i)=_ + exact MvPolynomial.aeval_X _ i + +@[simp] theorem leftRestriction_coord (hf : ∀ j, 0 0) i := by + exact evaluate_coord _ _ i + +def rightIdeal : Ideal (Ring K (σ ⊕ τ) (Sum.elim e f)) := + Ideal.span (Set.range (fun j => coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inr j))) + +@[simp] theorem leftRestriction_leftInclusion (hf : ∀ j, 0 simp only [AlgHom.comp_apply,leftRestriction_coord,Sum.elim_inl, + leftInclusion_coord,sub_self,Ideal.zero_mem] + | inr j => + simp only [AlgHom.comp_apply,leftRestriction,evaluate_coord,Sum.elim_inr, + map_zero,sub_zero] + exact Ideal.subset_span (Set.mem_range_self j)) a + simpa only [AlgHom.comp_apply,ha,map_zero,sub_zero] using he + · apply Ideal.span_le.mpr + rintro _ ⟨j,rfl⟩ + change leftRestriction K σ τ e f hf (coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inr j))=0 + simp [leftRestriction] + + + +theorem graphRestriction_ker (hf : ∀ j, 0 + g.symm (coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inr j)))) := by + have hmap : (rightIdeal K σ τ e f).map g.symm.toRingHom = + Ideal.span (Set.range (fun j => + g.symm (coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inr j)))) := by + rw [rightIdeal,Ideal.map_span] + congr 1 + exact Set.range_comp g.symm _ |>.symm + rw [←hmap] + ext a + rw [Ideal.mem_map_iff_of_surjective (g.symm.toRingHom) g.symm.surjective] + constructor + · intro ha + refine ⟨g a,?_,g.symm_apply_apply a⟩ + rw [←leftRestriction_ker K σ τ e f hf] + exact ha + · rintro ⟨b,hb,rfl⟩ + change leftRestriction K σ τ e f hf (g (g.symm b))=0 + rw [g.apply_symm_apply] + rw [←leftRestriction_ker K σ τ e f hf] at hb + exact hb + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open scoped TensorProduct +variable (K σ τ : Type*) [CommRing K] (e : σ → ℕ) (f : τ → ℕ) + +def rightInclusion : Ring K τ f →ₐ[K] Ring K (σ ⊕ τ) (Sum.elim e f) := + evaluate (fun j => coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inr j)) + (fun j => coord_pow K (σ ⊕ τ) (Sum.elim e f) (Sum.inr j)) + +@[simp] theorem rightInclusion_coord (j : τ) : + rightInclusion K σ τ e f (coord K τ f j)=coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inr j) := by + change (MvPolynomial.aeval _) (MvPolynomial.X j)=_ + exact MvPolynomial.aeval_X _ j + +def toTensor : Ring K (σ ⊕ τ) (Sum.elim e f) →ₐ[K] Ring K σ e ⊗[K] Ring K τ f := + evaluate (Sum.elim + (fun i => Algebra.TensorProduct.includeLeft (R:=K) (S:=K) (coord K σ e i)) + (fun j => Algebra.TensorProduct.includeRight (R:=K) (coord K τ f j))) (by + intro u + cases u with + | inl i => change (Algebra.TensorProduct.includeLeft (R:=K) (S:=K) (coord K σ e i))^e i=0 + rw [←map_pow,coord_pow,map_zero] + | inr j => change (Algebra.TensorProduct.includeRight (R:=K) (coord K τ f j))^f j=0 + rw [←map_pow,coord_pow,map_zero]) + +def fromTensor : Ring K σ e ⊗[K] Ring K τ f →ₐ[K] Ring K (σ ⊕ τ) (Sum.elim e f) := + Algebra.TensorProduct.lift (leftInclusion K σ τ e f) (rightInclusion K σ τ e f) + (fun _ _ => Commute.all _ _) + +@[simp] theorem toTensor_inl (i : σ) : + toTensor K σ τ e f (coord K (σ ⊕ τ) (Sum.elim e f) (.inl i)) = + coord K σ e i ⊗ₜ[K] (1 : Ring K τ f) := evaluate_coord _ _ _ +@[simp] theorem toTensor_inr (j : τ) : + toTensor K σ τ e f (coord K (σ ⊕ τ) (Sum.elim e f) (.inr j)) = + (1 : Ring K σ e) ⊗ₜ[K] coord K τ f j := evaluate_coord _ _ _ +@[simp] theorem fromTensor_tmul (a : Ring K σ e) (b : Ring K τ f) : + fromTensor K σ τ e f (a ⊗ₜ[K] b)=leftInclusion K σ τ e f a * rightInclusion K σ τ e f b := by + simp [fromTensor] + +theorem from_toTensor : (fromTensor K σ τ e f).comp (toTensor K σ τ e f)=AlgHom.id _ _ := by + apply hom_ext + intro u + cases u <;> simp + +theorem to_fromTensor : (toTensor K σ τ e f).comp (fromTensor K σ τ e f)=AlgHom.id _ _ := by + apply Algebra.TensorProduct.ext + · apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + change toTensor K σ τ e f (fromTensor K σ τ e f (coord K σ e i ⊗ₜ[K] 1))=coord K σ e i ⊗ₜ[K] 1 + simp + · apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro j + change toTensor K σ τ e f (fromTensor K σ τ e f (1 ⊗ₜ[K] coord K τ f j))=1 ⊗ₜ[K] coord K τ f j + simp + + + +def sumTensorEquiv : Ring K (σ ⊕ τ) (Sum.elim e f) ≃ₐ[K] Ring K σ e ⊗[K] Ring K τ f := + { toTensor K σ τ e f with + invFun := fromTensor K σ τ e f + left_inv := fun a => AlgHom.congr_fun (from_toTensor K σ τ e f) a + right_inv := fun a => AlgHom.congr_fun (to_fromTensor K σ τ e f) a } + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open scoped TensorProduct +variable (K R σ : Type*) [CommRing K] [CommRing R] [Algebra K R] (e : σ → ℕ) + +def coefficientMap : Ring K σ e →ₐ[K] Ring R σ e := + evaluate (coord R σ e) (coord_pow R σ e) + +@[simp] theorem coefficientMap_coord (i : σ) : + coefficientMap K R σ e (coord K σ e i)=coord R σ e i := evaluate_coord _ _ _ + +def baseToTensor : Ring R σ e →ₐ[R] R ⊗[K] Ring K σ e := + evaluate (fun i => Algebra.TensorProduct.includeRight (A:=R) (coord K σ e i)) (by + intro i + rw [←map_pow,coord_pow,map_zero]) + +def baseFromTensor : R ⊗[K] Ring K σ e →ₐ[R] Ring R σ e := + Algebra.TensorProduct.lift (Algebra.ofId R (Ring R σ e)) (coefficientMap K R σ e) + (fun _ _ => Commute.all _ _) + +@[simp] theorem baseToTensor_coord (i : σ) : + baseToTensor K R σ e (coord R σ e i)=(1 : R) ⊗ₜ[K] coord K σ e i := evaluate_coord _ _ _ + +@[simp] theorem baseFromTensor_tmul (r : R) (a : Ring K σ e) : + baseFromTensor K R σ e (r ⊗ₜ[K] a)=r • coefficientMap K R σ e a := by + change algebraMap R (Ring R σ e) r * coefficientMap K R σ e a=r • coefficientMap K R σ e a + exact (Algebra.smul_def r _).symm + +theorem baseFrom_toTensor : + (baseFromTensor K R σ e).comp (baseToTensor K R σ e)=AlgHom.id R _ := by + apply hom_ext + intro i + simp + +theorem baseTo_fromTensor : + (baseToTensor K R σ e).comp (baseFromTensor K R σ e)=AlgHom.id R _ := by + apply Algebra.TensorProduct.ext' + intro r a + change baseToTensor K R σ e (baseFromTensor K R σ e (r ⊗ₜ[K] a))=r ⊗ₜ[K] a + rw [baseFromTensor_tmul,map_smul] + have h : ((baseToTensor K R σ e).restrictScalars K).comp (coefficientMap K R σ e) = + Algebra.TensorProduct.includeRight (R:=K) (A:=R) (B:=Ring K σ e) := by + apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + change baseToTensor K R σ e (coefficientMap K R σ e (coord K σ e i))=(1 : R) ⊗ₜ[K] coord K σ e i + rw [coefficientMap_coord,baseToTensor_coord] + have ha := AlgHom.congr_fun h a + change baseToTensor K R σ e (coefficientMap K R σ e a)=(1 : R) ⊗ₜ[K] a at ha + rw [ha,TensorProduct.smul_tmul'] + simp + + + +def baseChangeEquiv : Ring R σ e ≃ₐ[R] R ⊗[K] Ring K σ e := + { baseToTensor K R σ e with + invFun := baseFromTensor K R σ e + left_inv := fun a => AlgHom.congr_fun (baseFrom_toTensor K R σ e) a + right_inv := fun a => AlgHom.congr_fun (baseTo_fromTensor K R σ e) a } + + + +def extendEquiv (g : Ring K σ e ≃ₐ[K] Ring K σ e) : Ring R σ e ≃ₐ[R] Ring R σ e := + (baseChangeEquiv K R σ e).trans + ((Algebra.TensorProduct.congr ((AlgEquiv.refl : R ≃ₐ[R] R)) g).trans (baseChangeEquiv K R σ e).symm) + +@[simp] theorem extendEquiv_coord (g : Ring K σ e ≃ₐ[K] Ring K σ e) (i : σ) : + extendEquiv K R σ e g (coord R σ e i)=coefficientMap K R σ e (g (coord K σ e i)) := by + change baseFromTensor K R σ e + ((Algebra.TensorProduct.congr ((AlgEquiv.refl : R ≃ₐ[R] R)) g) (baseToTensor K R σ e (coord R σ e i)))=_ + simp + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open scoped TensorProduct +variable (K σ τ : Type*) [CommRing K] (e : σ → ℕ) (f : τ → ℕ) + +def rightRestriction (he : ∀ i, 0 0) (coord K τ f)) (by + intro i + cases i with + | inl i => exact zero_pow (Nat.ne_of_gt (he i)) + | inr j => exact coord_pow K τ f j) + +@[simp] theorem rightRestriction_coord (he : ∀ i, 0 0) (coord K τ f) i := evaluate_coord _ _ _ + +def leftIdeal : Ideal (Ring K (σ ⊕ τ) (Sum.elim e f)) := + Ideal.span (Set.range (fun i => coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inl i))) + +theorem rightRestriction_ker (he : ∀ i, 0 + simp only [AlgHom.comp_apply,rightRestriction_coord,Sum.elim_inl,map_zero,sub_zero] + exact Ideal.subset_span (Set.mem_range_self i) + | inr j => + simp only [AlgHom.comp_apply,rightRestriction_coord,Sum.elim_inr, + rightInclusion_coord,sub_self,Ideal.zero_mem]) a + simpa only [AlgHom.comp_apply,ha,map_zero,sub_zero] using herr + · apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change rightRestriction K σ τ e f he (coord K (σ ⊕ τ) (Sum.elim e f) (Sum.inl i))=0 + simp + + + +def mixedEquiv : Ring K (σ ⊕ τ) (Sum.elim e f) ≃ₐ[K] Ring (Ring K σ e) τ f := + (sumTensorEquiv K σ τ e f).trans + ((baseChangeEquiv K (Ring K σ e) τ f).symm.restrictScalars K) + +@[simp] theorem mixedEquiv_inl (i : σ) : + mixedEquiv K σ τ e f (coord K (σ ⊕ τ) (Sum.elim e f) (.inl i))= + algebraMap (Ring K σ e) (Ring (Ring K σ e) τ f) (coord K σ e i) := by + change baseFromTensor K (Ring K σ e) τ f (toTensor K σ τ e f + (coord K (σ ⊕ τ) (Sum.elim e f) (.inl i)))=_ + rw [toTensor_inl,baseFromTensor_tmul,map_one] + exact (Algebra.algebraMap_eq_smul_one (A:=Ring (Ring K σ e) τ f) (coord K σ e i)).symm + +@[simp] theorem mixedEquiv_inr (j : τ) : + mixedEquiv K σ τ e f (coord K (σ ⊕ τ) (Sum.elim e f) (.inr j))=coord (Ring K σ e) τ f j := by + change baseFromTensor K (Ring K σ e) τ f (toTensor K σ τ e f + (coord K (σ ⊕ τ) (Sum.elim e f) (.inr j)))=_ + rw [toTensor_inr,baseFromTensor_tmul,one_smul,coefficientMap_coord] + +def coefficientSpecialization (he : ∀ i, 0 + algebraMap (Ring K σ e) (Ring (Ring K σ e) τ f) (coord K σ e i))) + + + +theorem coefficientSpecialization_ker (he : ∀ i, 0 + change f (algebraMap K (Ring K σ e) c)-g (algebraMap K (Ring K σ e) c)∈J + simp + | add q r hq hr => + simpa only [map_add,add_sub_add_comm] using J.add_mem hq hr + | mul_X q i hq => + change f (Ideal.Quotient.mk _ q * coord K σ e i)-g (Ideal.Quotient.mk _ q * coord K σ e i)∈J + have h := J.add_mem + (Ideal.mul_mem_left J (f (Ideal.Quotient.mk (ideal K σ e) q)) (hz i)) + (Ideal.mul_mem_right (g (coord K σ e i)) J hq) + convert h using 1 + simp only [map_mul] + ring + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K σ τ : Type*) [CommRing K] [Fintype σ] (e : σ → ℕ) (f : τ → ℕ) + + + +theorem bijective_of_central_equiv (he : ∀ i, 0 p) := + coefficientMap K (T K 3) _ (fun _ => p) (sigmaPotential K p σ S) + + ∑ i,threeParameters (K:=K) q i • + coefficientMap K (T K 3) _ (fun _ => p) (sigmaBlock K p σ i (b i)) + + + +theorem finite_chart_obstruction {d c : ℕ} + (r : ((i : Fin (n+1)) × σ i) ≃ Fin (c+d)) + (e : ((i : Fin (n+1)) × σ i) ≃ Fin d ⊕ Fin c) + (q0 : Ring K ((i : Fin (n+1)) × σ i) (fun _ => p) ≃ₐ[K] + Ring K ((i : Fin (n+1)) × σ i) (fun _ => p)) + (qL : (Fin 3 ↪ Fin (n+1)) → + Ring (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p) ≃ₐ[T K 3] + Ring (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p)) + (S b : ∀ i,A K (σ i) p) (active : Finset (Fin (n+1))) + (hb : ∀ i,i∉active → b i=0) (hA : 5≤active.card) + (hL0 : splitRestriction (Fact.out : p.Prime).pos e q0 (sigmaPotential K p σ S)=0) + (hR : splitRestriction (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 + (sigmaPotential K p σ S)=0) + (htripR : ∀ s : Finset (Fin (n+1)), s⊆active → s.card=3 → + splitRestriction (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 + (sigmaSelected K p σ b s) ∈ Ideal.span (Set.range (fun i => + splitRestriction (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 + (chartDerivative K K _ p i (sigmaPotential K p σ S))))) + (hspecial : ∀ q : Fin 3 ↪ Fin (n+1), (∀ j,q j∈active) → ∀ a, + coefficientHom K (T K 3) K _ (fun _ => p) (augmentationAlg K 3) (qL q a)= + q0 (coefficientHom K (T K 3) K _ (fun _ => p) (augmentationAlg K 3) a)) + (hL : ∀ q : Fin 3 ↪ Fin (n+1), (∀ j,q j∈active) → + splitRestriction (Fact.out : p.Prime).pos e (qL q) (sigmaDeformed K p σ S b q)=0) + (htripL : ∀ q : Fin 3 ↪ Fin (n+1), (∀ j,q j∈active) → + splitRestriction (Fact.out : p.Prime).pos e (qL q) + (algebraMap (T K 3) (Ring (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p)) + (t K 3 0*t K 3 1*t K 3 2)) ∈ Ideal.span (Set.range (fun i => + splitRestriction (Fact.out : p.Prime).pos e (qL q) + (chartDerivative K (T K 3) _ p i (sigmaDeformed K p σ S b q))))) : False := by + classical + obtain ⟨q,κ,hq,hκ,hpair⟩ := exists_three_graph_tensor_cycle K p σ r e q0 S b active hb hA hL0 hR htripR + let η := sigmaExtendedForms K (T K 3) p σ κ + let lam := chartNormal K (T K 3) ((i : Fin (n+1)) × σ i) p e (qL q) + let u : T K 3 := t K 3 0*t K 3 1*t K 3 2 + let J := extendFormFunctional K (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p) + (orientedResidue K _ p (Fact.out : p.Prime).pos r) + have hη : relativeKoszul K (T K 3) _ p (sigmaDeformed K p σ S b q) η=0 := by + change relativeKoszul K (T K 3) _ p + (coefficientMap K (T K 3) _ (fun _ => p) (sigmaPotential K p σ S) + + ∑ i,threeParameters (K:=K) q i • + coefficientMap K (T K 3) _ (fun _ => p) (sigmaBlock K p σ i (b i))) + (sigmaExtendedForms K (T K 3) p σ κ)=0 + rw [relativeKoszul_sigmaExtended,hκ] + exact (sigmaExtendedForms K (T K 3) p σ).map_zero + have hη' : oneForm K _ _ (fun i => + chartDerivative K (T K 3) _ p i (sigmaDeformed K p σ S b q))*η=0 := by + rw [relativeKoszul_eq] at hη + exact hη + have hB := chartNormal_boundary K (T K 3) ((i : Fin (n+1)) × σ i) p + (Fact.out : p.Prime).pos e (qL q) _ (hL q hq) _ (htripL q hq) + rw [scalar_parameter_mul] at hB + have hz : (u • lam)*η=0 := boundary_mul_cycle_zero _ _ _ hB hη' + have hzero : u * J (lam*η)=0 := by + change u • J (lam*η)=0 + rw [←map_smul,←smul_mul_assoc,hz,map_zero] + have hunit : IsUnit (J (lam*η)) := by + apply isUnit_of_augmentation_ne_zero + change (augmentationAlg K 3) (extendFormFunctional K (T K 3) _ (fun _ => p) + (orientedResidue K _ p (Fact.out : p.Prime).pos r) (lam*η))≠0 + rw [extendFormFunctional_specialization,map_mul] + have hlam := chartNormal_specialization K (T K 3) K ((i : Fin (n+1)) × σ i) p + (augmentationAlg K 3) e (qL q) q0 (hspecial q hq) + change mapCoefficients K _ _ _ _ lam=_ at hlam + rw [hlam] + change orientedResidue K _ p (Fact.out : p.Prime).pos r + (chartNormal K K _ p e q0 * mapCoefficients K _ _ _ _ + (sigmaExtendedForms K (T K 3) p σ κ))≠0 + rw [sigmaExtendedForms_specialization] + exact hpair + exact triple_mul_unit_ne_zero K 3 0 1 2 (by decide) (by decide) (by decide) hunit hzero + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K σ τ : Type*) [Field K] [Fintype σ] + [Fintype τ] (p : ℕ) + + +theorem formalEval_rename (f : σ → τ) (F : MvPowerSeries σ K) : + formalEval K τ p (MvPowerSeries.rename f F)=rename K σ p f (formalEval K σ p F) := by + unfold formalEval + erw [nilEval_rename] + have hh := nilEval_map (rename K σ p f) (coord K σ p) + (fun i => ⟨p,variable_pow K σ p i⟩) F + simpa only [rename_coord,Function.comp_def] using hh.symm + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K R σ : Type*) [CommRing K] [CommRing R] [Algebra K R] + [Fintype σ] (p : ℕ) + + +theorem nilEval_extension (F : MvPowerSeries σ K) : + nilEval R (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) + (MvPowerSeries.map (algebraMap K R) F)= + coefficientMap K R σ (fun _ => p) + (nilEval K (coord K σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) F) := by + have hh := nilEval_coefficients (algebraMap K R) + (coefficientMap K R σ (fun _ => p)).toRingHom + (fun k => by + change coefficientMap K R σ (fun _ => p) (algebraMap K (Ring K σ (fun _ => p)) k)=_ + rw [AlgHom.commutes] + exact IsScalarTower.algebraMap_apply K R (Ring R σ (fun _ => p)) k) + (coord K σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) F + simp only [AlgHom.toRingHom_eq_coe,AlgHom.coe_toRingHom,coefficientMap_coord] at hh + exact hh.symm + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped BigOperators +open FrobeniusTruncation +universe u +variable (K : Type*) [Field K] (p : ℕ) {n : ℕ} + (σ : Fin (n+1) → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + + + + +@[simp] theorem formalSigmaPotential_eval (F : ∀ i,MvPowerSeries (σ i) K) : + formalEval K _ p (formalSigmaPotential K σ F)= + sigmaPotential K p σ (fun i => formalEval K (σ i) p (F i)) := by + simp only [formalSigmaPotential,map_sum,formalEval_rename,sigmaPotential] + +omit [∀ i,DecidableEq (σ i)] in +@[simp] theorem formalSigmaSelected_eval (b : ∀ i,MvPowerSeries (σ i) K) + (s : Finset (Fin (n+1))) : + formalEval K _ p (formalSigmaSelected K σ b s)= + sigmaSelected K p σ (fun i => formalEval K (σ i) p (b i)) s := by + simp only [formalSigmaSelected,map_prod,formalEval_rename,sigmaSelected,sigmaBlock] + +open FiniteCoordinates in +@[simp] theorem formalSigmaDeformed_eval (F b : ∀ i,MvPowerSeries (σ i) K) + (q : Fin 3 ↪ Fin (n+1)) : + nilEval (T K 3) (coord (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p)) + (fun j => ⟨p,coord_pow _ _ _ j⟩) (formalSigmaDeformed K σ F b q)= + sigmaDeformed K p σ (fun i => formalEval K (σ i) p (F i)) + (fun i => formalEval K (σ i) p (b i)) q := by + simp only [formalSigmaDeformed,map_add,map_sum,map_mul,nilEval_extension] + unfold sigmaDeformed + congr 1 + · exact congrArg (coefficientMap K (T K 3) _ (fun _ => p)) + (formalSigmaPotential_eval K p σ F) + · apply Finset.sum_congr rfl + intro i hi + erw [show nilEval (T K 3) (coord (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p)) + (fun j => ⟨p,coord_pow _ _ _ j⟩) (MvPowerSeries.C (threeParameters (K:=K) q i))= + algebraMap (T K 3) (Ring (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p)) + (threeParameters (K:=K) q i) from (nilEval (T K 3) _ _).commutes _] + change algebraMap (T K 3) _ (threeParameters (K:=K) q i)* + coefficientMap K (T K 3) _ (fun _ => p) + (formalEval K _ p (MvPowerSeries.rename (Sigma.mk i) (b i)))=_ + rw [formalEval_rename] + exact (Algebra.smul_def _ _).symm + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor +noncomputable section +open MvPowerSeries.WithPiTopology +variable {R A σ : Type*} [CommRing R] [CommRing A] [Algebra R A] [Finite σ] + +theorem nilEval_zero (q : MvPowerSeries σ R) : + nilEval R (fun _ : σ => (0 : A)) (fun _ => IsNilpotent.zero) q = + algebraMap R A (MvPowerSeries.constantCoeff q) := by + let : UniformSpace R := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul R A := ⟨continuous_of_discreteTopology⟩ + have hn : MvPowerSeries.HasEval (fun _ : σ => (0 : A)) := + ⟨fun _ => IsNilpotent.zero.isTopologicallyNilpotent, + by simp only [Filter.cofinite_eq_bot]; exact Filter.tendsto_bot⟩ + have hc : Continuous (nilEval R (fun _ : σ => (0 : A)) + (fun _ => IsNilpotent.zero) : MvPowerSeries σ R → A) := MvPowerSeries.continuous_aeval hn + have hh := Continuous.ext_on (denseRange_toMvPowerSeries (σ:=σ) (R:=R)) hc + ((continuous_of_discreteTopology : Continuous (algebraMap R A)).comp + (continuous_constantCoeff R)) (by + rintro _ ⟨f,rfl⟩ + rw [nilEval_coe] + change MvPolynomial.aeval (fun _ : σ => (0 : A)) f = + algebraMap R A (MvPowerSeries.coeff 0 (f : MvPowerSeries σ R)) + rw [MvPolynomial.coeff_coe] + exact MvPolynomial.aeval_zero f) + exact congr_fun hh q + +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/FormBaseChange.lean b/lean/OAI/Algebra/FiniteTensor/FormBaseChange.lean new file mode 100644 index 0000000000000000000000000000000000000000..7583e2135269bed385d666a986bf77b6bb22f4a4 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/FormBaseChange.lean @@ -0,0 +1,380 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ChartPairings + +namespace OAI + +/-! Coefficient specialization and base change of form functionals. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open scoped TensorProduct BigOperators +open PD4Tensor.Forms PD4Tensor.TruncatedForms +variable (K υ : Type*) [Field K] [Fintype υ] [DecidableEq υ] (p : ℕ) + [CharP K p] + +theorem centralD_eq (ω : Space K υ p) : + D K υ p ω=differential K (Ring K υ (fun _ => p)) υ (chartDerivative K K υ p) ω := rfl + +theorem centralKoszul_eq (S : Ring K υ (fun _ => p)) (ω : Space K υ p) : + koszul K υ p S ω= + Mul.mul (α:=Space K υ p) (oneForm K (Ring K υ (fun _ => p)) υ (fun i => chartDerivative K K υ p i S)) ω := by + change Mul.mul (α:=Ω K (Ring K υ (fun _ => p)) υ) + (differential K (Ring K υ (fun _ => p)) υ (chartDerivative K K υ p) + (scalar K (Ring K υ (fun _ => p)) υ S)) ω = _ + rw [differential_scalar] + rfl + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation FiniteCoordinates +universe u +variable (K : Type*) [Field K] (p : ℕ) + {n : ℕ} (σ : Fin (n+1) → Type u) + +theorem sigmaSelected_zero_of_not_subset (b : ∀ i,A K (σ i) p) + (active s : Finset (Fin (n+1))) (hb : ∀ i,i∉active → b i=0) (hs : ¬s⊆active) : + sigmaSelected K p σ b s=0 := by + classical + obtain ⟨i,his,hia⟩ := Finset.not_subset.mp hs + apply Finset.prod_eq_zero his + simp only [sigmaBlock,hb i hia,map_zero] + +variable [CharP K p] [Fact p.Prime] [Invertible (2 : K)] + [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + + +theorem exists_three_graph_tensor_cycle {d c : ℕ} + (r : ((i : Fin (n+1)) × σ i) ≃ Fin (c+d)) + (e : ((i : Fin (n+1)) × σ i) ≃ Fin d ⊕ Fin c) + (q0 : Ring K ((i : Fin (n+1)) × σ i) (fun _ => p) ≃ₐ[K] + Ring K ((i : Fin (n+1)) × σ i) (fun _ => p)) + (S b : ∀ i,A K (σ i) p) (active : Finset (Fin (n+1))) + (hb : ∀ i,i∉active → b i=0) (hA : 5≤active.card) + (hL : splitRestriction (Fact.out : p.Prime).pos e q0 (sigmaPotential K p σ S)=0) + (hR : splitRestriction (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 + (sigmaPotential K p σ S)=0) + (htrip : ∀ s : Finset (Fin (n+1)), s⊆active → s.card=3 → + splitRestriction (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 + (sigmaSelected K p σ b s) ∈ Ideal.span (Set.range (fun i => + splitRestriction (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 + (chartDerivative K K _ p i (sigmaPotential K p σ S))))) : + ∃ (q : Fin 3 ↪ Fin (n+1)) (κ : T K 3 ⊗[K] (⨂[K] i,Space K (σ i) p)), + (∀ j,q j∈active) ∧ + deformedTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i)) (fun i => koszul K (σ i) p (b i)) + (threeParameters (K:=K) q) κ=0 ∧ + orientedResidue K _ p (Fact.out : p.Prime).pos r + (Mul.mul (α:=Space K ((i : Fin (n+1)) × σ i) p) (chartNormal K K _ p e q0) + (sigmaSeparatedEquiv K p σ (specializeTensor (augmentationAlg K 3) κ)))≠0 := by + classical + let α : Space K ((i : Fin (n+1)) × σ i) p := chartNormal K K ((i : Fin (n+1)) × σ i) p (e.trans (Equiv.sumComm _ _)) q0 + let lam : Space K ((i : Fin (n+1)) × σ i) p := chartNormal K K ((i : Fin (n+1)) × σ i) p e q0 + let L : Space K ((i : Fin (n+1)) × σ i) p →ₗ[K] K := + (orientedResidue K _ p (Fact.out : p.Prime).pos r).comp (LinearMap.mulLeft K lam) + have hlam : Mul.mul (α:=Space K ((i : Fin (n+1)) × σ i) p) (oneForm K _ _ (fun i => chartDerivative K K _ p i (sigmaPotential K p σ S))) lam=0 := + chartNormal_koszul K K _ p (Fact.out : p.Prime).pos e q0 _ hL + refine exists_three_tensor_form_cycle K p σ S b active hA α ?_ ?_ ?_ L ?_ ?_ ?_ + · erw [centralKoszul_eq] + exact chartNormal_koszul K K _ p (Fact.out : p.Prime).pos (e.trans (Equiv.sumComm _ _)) q0 _ hR + · rw [centralD_eq] + exact chartNormal_closed K K _ p (e.trans (Equiv.sumComm _ _)) q0 + · intro s hs + by_cases hsa : s⊆active + · obtain ⟨β,hβ⟩ := chartNormal_boundary K K _ p (Fact.out : p.Prime).pos + (e.trans (Equiv.sumComm _ _)) q0 _ hR _ (htrip s hsa hs) + refine ⟨β,?_⟩ + erw [centralKoszul_eq] + exact hβ + · rw [sigmaSelected_zero_of_not_subset K p σ b active s hb hsa] + change scalar K _ _ 0 * α ∈ _ + rw [scalar_zero,zero_mul] + exact Submodule.zero_mem _ + · intro v + change orientedResidue K _ p (Fact.out : p.Prime).pos r + (lam * koszul K _ p (sigmaPotential K p σ S) v)=0 + erw [centralKoszul_eq,←mul_assoc,(oneForm_mul_zero_iff _ _).mp hlam,zero_mul,map_zero] + · intro v + change orientedResidue K _ p (Fact.out : p.Prime).pos r (lam * D K _ p v)=0 + rw [centralD_eq] + apply orientedResidue_closed_exact + exact chartNormal_closed K K _ p e q0 + · exact orientedResidue_chartNormal_pair K _ p r e q0 + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct +variable (K A B σ : Type*) [Field K] [CommRing A] [Algebra K A] + [CommRing B] [Algebra K B] + +def mapCoefficients (r : A →ₐ[K] B) : Ω K A σ →ₐ[K] Ω K B σ := + Algebra.TensorProduct.map r (AlgHom.id K (E K σ)) + +@[simp] theorem mapCoefficients_tmul (r : A →ₐ[K] B) (a : A) (e : E K σ) : + mapCoefficients K A B σ r (a ⊗ₜ[K] e)=r a ⊗ₜ[K] e := rfl + +@[simp] theorem mapCoefficients_scalar (r : A →ₐ[K] B) (a : A) : + mapCoefficients K A B σ r (scalar K A σ a)=scalar K B σ (r a) := rfl + +variable [Fintype σ] [DecidableEq σ] + +@[simp] theorem mapCoefficients_oneForm (r : A →ₐ[K] B) (v : σ → A) : + mapCoefficients K A B σ r (oneForm K A σ v)=oneForm K B σ (fun i => r (v i)) := by + simp [oneForm] + +theorem mapCoefficients_differential (r : A →ₐ[K] B) + (da : σ → A →ₗ[K] A) (db : σ → B →ₗ[K] B) + (hr : ∀ i a, r (da i a)=db i (r a)) (ω : Ω K A σ) : + mapCoefficients K A B σ r (differential K A σ da ω)= + differential K B σ db (mapCoefficients K A B σ r ω) := by + induction ω using TensorProduct.inductionOn with + | add x y hx hy => simp [hx,hy] + | tmul a e => simp [differential_tmul,hr] + +theorem mapCoefficients_normalCycle (r : A →ₐ[K] B) + (da : σ → A →ₗ[K] A) (db : σ → B →ₗ[K] B) + (hr : ∀ i a, r (da i a)=db i (r a)) (p : ℕ) (cs : List A) : + mapCoefficients K A B σ r (normalCycle K A σ da p cs)= + normalCycle K B σ db p (cs.map r) := by + simp only [normalCycle,map_list_prod,List.map_map,Function.comp_def,normalFactor, + map_mul,mapCoefficients_scalar,map_pow] + congr 2 + funext a + rw [mapCoefficients_differential K A B σ r da db hr,mapCoefficients_scalar] + +end +end PD4Tensor.Forms + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K R S σ : Type*) [CommRing K] [CommRing R] [CommRing S] + [Algebra K R] [Algebra K S] (e : σ → ℕ) + + +def coefficientHom (r : R →ₐ[K] S) : Ring R σ e →ₐ[K] Ring S σ e := + Ideal.Quotient.liftₐ (ideal R σ e) + ((Ideal.Quotient.mkₐ K (ideal S σ e)).comp (MvPolynomial.mapAlgHom r)) (by + have hh : ideal R σ e ≤ RingHom.ker + (((Ideal.Quotient.mkₐ K (ideal S σ e)).comp (MvPolynomial.mapAlgHom r)).toRingHom) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change Ideal.Quotient.mk (ideal S σ e) ((MvPolynomial.map r.toRingHom) + ((MvPolynomial.X i)^e i))=0 + rw [map_pow,MvPolynomial.map_X,map_pow] + exact coord_pow S σ e i + exact fun a ha => hh ha) + +@[simp] theorem coefficientHom_mk (r : R →ₐ[K] S) (f : MvPolynomial σ R) : + coefficientHom K R S σ e r (Ideal.Quotient.mk (ideal R σ e) f)= + Ideal.Quotient.mk (ideal S σ e) ((MvPolynomial.map r.toRingHom) f) := rfl + +@[simp] theorem coefficientHom_coord (r : R →ₐ[K] S) (i : σ) : + coefficientHom K R S σ e r (coord R σ e i)=coord S σ e i := by + rw [coord,coefficientHom_mk,MvPolynomial.map_X] + rfl + +@[simp] theorem coefficientHom_scalar (r : R →ₐ[K] S) (a : R) : + coefficientHom K R S σ e r (algebraMap R (Ring R σ e) a)= + algebraMap S (Ring S σ e) (r a) := by + change Ideal.Quotient.mk (ideal S σ e) ((MvPolynomial.map r.toRingHom) (MvPolynomial.C a))=_ + rw [MvPolynomial.map_C] + rfl + +variable (p : ℕ) [CharP R p] [CharP S p] + +theorem coefficientHom_partial (r : R →ₐ[K] S) (i : σ) (a : Ring R σ (fun _ => p)) : + coefficientHom K R S σ (fun _ => p) r (relativeDeriv R σ p i a)= + relativeDeriv S σ p i (coefficientHom K R S σ (fun _ => p) r a) := by + obtain ⟨a,rfl⟩ := Ideal.Quotient.mk_surjective a + simp only [partial_mk,coefficientHom_mk,MvPolynomial.pderiv_map] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K ι σ : Type*) [Field K] + (e : ι → ℕ) (f : σ → ℕ) (he : ∀ i, 0 p)= + coefficientHom K K R σ (fun _ => p) (Algebra.ofId K R) := by + apply hom_ext + intro i + rw [coefficientMap_coord,coefficientHom_coord] + +variable [CharP K p] [CharP R p] + +@[simp] theorem partial_coefficientMap (i : σ) (a : Ring K σ (fun _ => p)) : + relativeDeriv R σ p i (coefficientMap K R σ (fun _ => p) a)= + coefficientMap K R σ (fun _ => p) (FrobeniusTruncation.derivative K σ p i a) := by + rw [coefficientMap_eq_coefficientHom] + exact (coefficientHom_partial K K R σ p (Algebra.ofId K R) i a).symm + +variable [Fintype σ] [DecidableEq σ] + + +theorem relative_differential_baseChange + (v : R ⊗[K] Ω K (Ring K σ (fun _ => p)) σ) : + differential K (Ring R σ (fun _ => p)) σ (chartDerivative K R σ p) + ((formsBaseChange K R σ (fun _ => p)).symm v)= + (formsBaseChange K R σ (fun _ => p)).symm + ((differential K (Ring K σ (fun _ => p)) σ + (chartDerivative K K σ p)).baseChange R v) := by + induction v using TensorProduct.inductionOn with + | add v w hv hw => simp only [map_add,hv,hw] + | tmul r ω => + induction ω using TensorProduct.inductionOn with + | add ω η hω hη => simp only [TensorProduct.tmul_add,map_add,hω,hη] + | tmul a e => + rw [formsBaseChange_symm_tmul,differential_tmul,LinearMap.baseChange_tmul, + differential_tmul,TensorProduct.tmul_sum,map_sum] + apply Finset.sum_congr rfl + intro i hi + rw [formsBaseChange_symm_tmul] + change relativeDeriv R σ p i (r • coefficientMap K R σ (fun _ => p) a) ⊗ₜ[K] _=_ + rw [map_smul,partial_coefficientMap] + rfl + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open scoped TensorProduct +open PD4Tensor.Forms +variable (K R σ : Type*) [Field K] [CommRing R] [Algebra K R] + (e : σ → ℕ) + +@[simp] theorem formsBaseChange_symm_tmul_form (r : R) (ω : Ω K (Ring K σ e) σ) : + (formsBaseChange K R σ e).symm (r ⊗ₜ[K] ω)= + r • mapCoefficients K (Ring K σ e) (Ring R σ e) σ (coefficientMap K R σ e) ω := by + induction ω using TensorProduct.inductionOn with + | add u v hu hv => simp only [TensorProduct.tmul_add,map_add,smul_add,hu,hv] + | tmul a v => rw [formsBaseChange_symm_tmul,mapCoefficients_tmul,TensorProduct.smul_tmul'] + + +def extendFormFunctional (L : Ω K (Ring K σ e) σ →ₗ[K] K) : + Ω K (Ring R σ e) σ →ₗ[R] R := + (TensorProduct.AlgebraTensorModule.rid K R R).toLinearMap.comp + ((L.baseChange R).comp (formsBaseChange K R σ e).toLinearMap) + +@[simp] theorem extendFormFunctional_tmul (L : Ω K (Ring K σ e) σ →ₗ[K] K) + (r : R) (ω : Ω K (Ring K σ e) σ) : + extendFormFunctional K R σ e L ((formsBaseChange K R σ e).symm (r ⊗ₜ[K] ω))= + L ω • r := by + simp only [extendFormFunctional,LinearMap.comp_apply,AlgEquiv.toLinearMap_apply, + AlgEquiv.apply_symm_apply,LinearMap.baseChange_tmul,LinearEquiv.coe_coe, + TensorProduct.AlgebraTensorModule.rid_tmul] + +theorem coefficientHom_coefficientMap (ε : R →ₐ[K] K) (a : Ring K σ e) : + coefficientHom K R K σ e ε (coefficientMap K R σ e a)=a := by + have hh : (coefficientHom K R K σ e ε).comp (coefficientMap K R σ e)= + AlgHom.id K (Ring K σ e) := by + apply hom_ext + intro i + simp only [AlgHom.comp_apply,coefficientMap_coord,coefficientHom_coord,AlgHom.id_apply] + exact AlgHom.congr_fun hh a + + +theorem forms_specialization_tmul (ε : R →ₐ[K] K) (r : R) + (ω : Ω K (Ring K σ e) σ) : + mapCoefficients K (Ring R σ e) (Ring K σ e) σ (coefficientHom K R K σ e ε) + ((formsBaseChange K R σ e).symm (r ⊗ₜ[K] ω))=ε r • ω := by + induction ω using TensorProduct.inductionOn with + | add u v hu hv => simp only [TensorProduct.tmul_add,map_add,smul_add,hu,hv] + | tmul a v => + rw [formsBaseChange_symm_tmul,mapCoefficients_tmul] + have hs : r • coefficientMap K R σ e a = + algebraMap R (Ring R σ e) r * coefficientMap K R σ e a := by + convert Algebra.smul_def (A:=Ring R σ e) r (coefficientMap K R σ e a) using 1 + rw [hs,map_mul,coefficientHom_scalar,coefficientHom_coefficientMap] + rw [←Algebra.smul_def,TensorProduct.smul_tmul'] + + + +theorem extendFormFunctional_specialization (L : Ω K (Ring K σ e) σ →ₗ[K] K) + (ε : R →ₐ[K] K) (ω : Ω K (Ring R σ e) σ) : + ε (extendFormFunctional K R σ e L ω)= + L (mapCoefficients K (Ring R σ e) (Ring K σ e) σ + (coefficientHom K R K σ e ε) ω) := by + obtain ⟨v,rfl⟩ := (formsBaseChange K R σ e).symm.surjective ω + induction v using TensorProduct.inductionOn with + | add u v hu hv => simp only [map_add,hu,hv] + | tmul r ω => + rw [extendFormFunctional_tmul,forms_specialization_tmul,map_smul,map_smul] + change L ω * ε r=ε r * L ω + exact mul_comm _ _ + +end +end PD4Tensor.FiniteCoordinates +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/FormReindexing.lean b/lean/OAI/Algebra/FiniteTensor/FormReindexing.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3d4815535211025b7aabac98348bb01db96b7f6 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/FormReindexing.lean @@ -0,0 +1,389 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.SeparatedForms + +namespace OAI + +/-! Exterior reindexing, separated potentials and parity of Koszul operators. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct +variable (K A B σ τ : Type*) [Field K] [CommRing A] [CommRing B] + [Algebra K A] [Algebra K B] + +def coordinateIsometry (e : σ ≃ τ) : + (0 : QuadraticForm K (σ → K)).IsometryEquiv (0 : QuadraticForm K (τ → K)) := + { LinearEquiv.funCongrLeft K K e.symm with + map_app' := by intro x; rfl } + +def reindexExterior (e : σ ≃ τ) : E K σ ≃ₐ[K] E K τ := + CliffordAlgebra.equivOfIsometry (coordinateIsometry K σ τ e) + +@[simp] theorem reindexExterior_ι (e : σ ≃ τ) (v : σ → K) : + reindexExterior K σ τ e (ExteriorAlgebra.ι K v)= + ExteriorAlgebra.ι K (fun j => v (e.symm j)) := by + change CliffordAlgebra.map (coordinateIsometry K σ τ e).toIsometry (CliffordAlgebra.ι _ v)=_ + rw [CliffordAlgebra.map_apply_ι] + rfl + +@[simp] theorem reindexExterior_dx [DecidableEq σ] [DecidableEq τ] (e : σ ≃ τ) (i : σ) : + reindexExterior K σ τ e (dx K σ i)=dx K τ (e i) := by + rw [dx,reindexExterior_ι,dx] + congr 1 + funext j + simp only [Pi.single_apply] + have h : e.symm j=i ↔ j=e i := e.symm_apply_eq + simp only [h] + +theorem reindexExterior_parity (e : σ ≃ τ) (v : E K σ) : + reindexExterior K σ τ e (CliffordAlgebra.involute v)= + CliffordAlgebra.involute (reindexExterior K σ τ e v) := by + induction v using ExteriorAlgebra.induction with + | algebraMap r => simp + | ι v => simp + | add a b ha hb => simp only [map_add,ha,hb] + | mul a b ha hb => simp only [map_mul,ha,hb] + + +def reindexForms (e : σ ≃ τ) (f : A ≃ₐ[K] B) : Ω K A σ ≃ₐ[K] Ω K B τ := + Algebra.TensorProduct.congr f (reindexExterior K σ τ e) + +@[simp] theorem reindexForms_tmul (e : σ ≃ τ) (f : A ≃ₐ[K] B) (a : A) (v : E K σ) : + reindexForms K A B σ τ e f (a ⊗ₜ[K] v)=f a ⊗ₜ[K] reindexExterior K σ τ e v := rfl + +@[simp] theorem reindexForms_scalar (e : σ ≃ τ) (f : A ≃ₐ[K] B) (a : A) : + reindexForms K A B σ τ e f (scalar K A σ a)=scalar K B τ (f a) := by + simp only [scalar,reindexForms_tmul,map_one] + +theorem reindexForms_differential [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] + (e : σ ≃ τ) (f : A ≃ₐ[K] B) + (derA : σ → A →ₗ[K] A) (derB : τ → B →ₗ[K] B) + (hder : ∀ i a, derB (e i) (f a)=f (derA i a)) (ω : Ω K A σ) : + reindexForms K A B σ τ e f (differential K A σ derA ω)= + differential K B τ derB (reindexForms K A B σ τ e f ω) := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp only [map_add,ha,hb] + | tmul a v => + simp only [differential_tmul,map_sum,reindexForms_tmul,map_mul,reindexExterior_dx] + exact Fintype.sum_equiv e _ _ (fun i => by rw [hder]) + +theorem reindexForms_parity (e : σ ≃ τ) (f : A ≃ₐ[K] B) (ω : Ω K A σ) : + reindexForms K A B σ τ e f (parity K A σ ω)= + parity K B τ (reindexForms K A B σ τ e f ω) := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp only [map_add,ha,hb] + | tmul a v => simp only [parity_tmul,reindexForms_tmul,reindexExterior_parity] + +end +end PD4Tensor.Forms + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K σ τ : Type*) [Field K] (p : ℕ) + +def coordinateEquiv (e : σ ≃ τ) : Ring K σ p ≃ₐ[K] Ring K τ p := + AlgEquiv.ofAlgHom (rename K σ p e) (rename K τ p e.symm) + (by apply hom_ext; intro i; simp) + (by apply hom_ext; intro i; simp) + +@[simp] theorem coordinateEquiv_coord (e : σ ≃ τ) (i : σ) : + coordinateEquiv K σ τ p e (coord K σ p i)=coord K τ p (e i) := + rename_coord K σ p e i + +variable [CharP K p] +theorem coordinateEquiv_derivative (e : σ ≃ τ) (i : σ) (a : Ring K σ p) : + derivative K τ p (e i) (coordinateEquiv K σ τ p e a)= + coordinateEquiv K σ τ p e (derivative K σ p i a) := + derivative_rename K σ p e e.injective i a + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation +universe u + +def sigmaHeadTail {n : ℕ} (σ : Fin (n+1) → Type u) : + ((i : Fin (n+1)) × σ i) ≃ σ 0 ⊕ ((i : Fin n) × σ i.succ) where + toFun v := Fin.cases (fun x => Sum.inl x) (fun i x => Sum.inr ⟨i,x⟩) v.1 v.2 + invFun := Sum.elim (fun x => ⟨0,x⟩) (fun v => ⟨v.1.succ,v.2⟩) + left_inv := by rintro ⟨i,x⟩; cases i using Fin.cases <;> rfl + right_inv := by rintro (x|⟨i,x⟩) <;> rfl + + + +def blockSigmaEquiv : {n : ℕ} → (σ : Fin (n+1) → Type u) → + BlockCoords n σ ≃ ((i : Fin (n+1)) × σ i) + | 0, σ => { + toFun := fun x => ⟨0,x⟩ + invFun := fun v => cast (congrArg σ (Fin.eq_zero v.1)) v.2 + left_inv := fun _ => rfl + right_inv := by + rintro ⟨i,x⟩ + have hi := Fin.eq_zero i + subst i + rfl } + | n+1, σ => (Equiv.sumCongr (Equiv.refl (σ 0)) + (blockSigmaEquiv (fun i => σ i.succ))).trans (sigmaHeadTail σ).symm + +@[simp] theorem blockSigmaEquiv_zero (σ : Fin 1 → Type u) (x : σ 0) : + blockSigmaEquiv σ x=⟨0,x⟩ := rfl +@[simp] theorem blockSigmaEquiv_inl {n : ℕ} (σ : Fin (n+1+1) → Type u) (x : σ 0) : + blockSigmaEquiv σ (Sum.inl x)=⟨0,x⟩ := rfl +@[simp] theorem blockSigmaEquiv_inr {n : ℕ} (σ : Fin (n+1+1) → Type u) + (x : BlockCoords n (fun i => σ i.succ)) : + blockSigmaEquiv σ (Sum.inr x)= + ⟨(blockSigmaEquiv (fun i => σ i.succ) x).1.succ, + (blockSigmaEquiv (fun i => σ i.succ) x).2⟩ := rfl + +variable (K : Type*) [Field K] (p : ℕ) + + + +def sigmaSeparatedEquiv {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] : + (⨂[K] i, Space K (σ i) p) ≃ₗ[K] Space K ((i : Fin (n+1)) × σ i) p := + (separatedEquiv K p σ).trans + (reindexForms K _ _ _ _ (blockSigmaEquiv σ) + (coordinateEquiv K _ _ p (blockSigmaEquiv σ))).toLinearEquiv + +variable [CharP K p] + +theorem D_sigmaSeparated {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (v : ⨂[K] i, Space K (σ i) p) : + D K ((i : Fin (n+1)) × σ i) p (sigmaSeparatedEquiv K p σ v) = + sigmaSeparatedEquiv K p σ (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => D K (σ i) p) v) := by + change differential K _ _ _ (reindexForms K _ _ _ _ _ _ (separatedEquiv K p σ v))=_ + rw [←reindexForms_differential K _ _ _ _ _ _ _ _ + (coordinateEquiv_derivative K _ _ p (blockSigmaEquiv σ))] + change reindexForms K _ _ _ _ _ _ (D K _ p (separatedEquiv K p σ v))=_ + rw [D_separated] + rfl + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K σ τ υ : Type*) [Field K] (p : ℕ) + +theorem rename_rename (f : σ → τ) (g : τ → υ) (a : Ring K σ p) : + rename K τ p g (rename K σ p f a)=rename K σ p (g ∘ f) a := by + have h : (rename K τ p g).comp (rename K σ p f)=rename K σ p (g ∘ f) := by + apply hom_ext + intro i + simp only [AlgHom.comp_apply,rename_coord,Function.comp_apply] + exact AlgHom.congr_fun h a + +@[simp] theorem coordinateEquiv_eq_rename (e : σ ≃ τ) (a : Ring K σ p) : + coordinateEquiv K σ τ p e a=rename K σ p e a := rfl + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation +universe u +variable (K : Type*) [Field K] (p : ℕ) + + +def sigmaPotential {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (S : ∀ i, A K (σ i) p) : + A K ((i : Fin (n+1)) × σ i) p := + ∑ i, rename K (σ i) p (Sigma.mk i) (S i) + + +def sigmaProduct {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (b : ∀ i, A K (σ i) p) : + A K ((i : Fin (n+1)) × σ i) p := + ∏ i, rename K (σ i) p (Sigma.mk i) (b i) + +theorem separatedPotential_reindex {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (S : ∀ i, A K (σ i) p) : + coordinateEquiv K _ _ p (blockSigmaEquiv σ) (separatedPotential K p σ S)= + sigmaPotential K p σ S := by + induction n with + | zero => + change rename K (σ 0) p (Sigma.mk 0) (S 0)= + ∑ i : Fin 1, rename K (σ i) p (Sigma.mk i) (S i) + rw [Fin.sum_univ_one] + | succ n ih => + change rename K (σ 0 ⊕ BlockCoords n (fun i => σ i.succ)) p (blockSigmaEquiv σ) + (rename K (σ 0) p Sum.inl (S 0) + + rename K (BlockCoords n (fun i => σ i.succ)) p Sum.inr + (separatedPotential K p (fun i => σ i.succ) (fun i => S i.succ)))= + ∑ i, rename K (σ i) p (Sigma.mk i) (S i) + rw [map_add] + erw [rename_rename,rename_rename] + rw [Fin.sum_univ_succ] + congr 1 + have h := congrArg + (rename K ((i : Fin (n+1)) × σ i.succ) p + (fun v => (⟨v.1.succ,v.2⟩ : (i : Fin (n+1+1)) × σ i))) + (ih (fun i => σ i.succ) (fun i => S i.succ)) + simp only [coordinateEquiv_eq_rename,sigmaPotential,map_sum,rename_rename,Function.comp_def] at h + exact h + +theorem separatedProduct_reindex {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (b : ∀ i, A K (σ i) p) : + coordinateEquiv K _ _ p (blockSigmaEquiv σ) (separatedProduct K p σ b)= + sigmaProduct K p σ b := by + induction n with + | zero => + change rename K (σ 0) p (Sigma.mk 0) (b 0)= + ∏ i : Fin 1, rename K (σ i) p (Sigma.mk i) (b i) + rw [Fin.prod_univ_one] + | succ n ih => + change rename K (σ 0 ⊕ BlockCoords n (fun i => σ i.succ)) p (blockSigmaEquiv σ) + (rename K (σ 0) p Sum.inl (b 0) * + rename K (BlockCoords n (fun i => σ i.succ)) p Sum.inr + (separatedProduct K p (fun i => σ i.succ) (fun i => b i.succ)))= + ∏ i, rename K (σ i) p (Sigma.mk i) (b i) + rw [map_mul] + erw [rename_rename,rename_rename] + rw [Fin.prod_univ_succ] + congr 1 + have h := congrArg + (rename K ((i : Fin (n+1)) × σ i.succ) p + (fun v => (⟨v.1.succ,v.2⟩ : (i : Fin (n+1+1)) × σ i))) + (ih (fun i => σ i.succ) (fun i => b i.succ)) + simp only [coordinateEquiv_eq_rename,sigmaProduct,map_prod,rename_rename,Function.comp_def] at h + exact h + +variable [CharP K p] + +theorem reindex_koszul (σ τ : Type*) [Fintype σ] [DecidableEq σ] + [Fintype τ] [DecidableEq τ] (e : σ ≃ τ) (S : A K σ p) (ω : Space K σ p) : + reindexForms K (A K σ p) (A K τ p) σ τ e (coordinateEquiv K σ τ p e) + (koszul K σ p S ω)= + koszul K τ p (coordinateEquiv K σ τ p e S) + (reindexForms K (A K σ p) (A K τ p) σ τ e (coordinateEquiv K σ τ p e) ω) := by + simp only [koszul,LinearMap.mulLeft_apply,map_mul,D, + reindexForms_differential K (A K σ p) (A K τ p) σ τ e (coordinateEquiv K σ τ p e) + (derivative K σ p) (derivative K τ p) (coordinateEquiv_derivative K σ τ p e), + reindexForms_scalar] + +omit [CharP K p] in +theorem reindex_mulScalar (σ τ : Type*) [Fintype σ] [DecidableEq σ] + [Fintype τ] [DecidableEq τ] (e : σ ≃ τ) (b : A K σ p) (ω : Space K σ p) : + reindexForms K (A K σ p) (A K τ p) σ τ e (coordinateEquiv K σ τ p e) + (mulScalar K σ p b ω)= + mulScalar K τ p (coordinateEquiv K σ τ p e b) + (reindexForms K (A K σ p) (A K τ p) σ τ e (coordinateEquiv K σ τ p e) ω) := by + simp only [mulScalar,LinearMap.mulLeft_apply,map_mul,reindexForms_scalar] + +theorem koszul_sigmaSeparated {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] + (S : ∀ i, A K (σ i) p) (v : ⨂[K] i, Space K (σ i) p) : + koszul K ((i : Fin (n+1)) × σ i) p (sigmaPotential K p σ S) + (sigmaSeparatedEquiv K p σ v)= + sigmaSeparatedEquiv K p σ + (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i)) v) := by + rw [←separatedPotential_reindex K p σ S] + change koszul K _ p _ + (reindexForms K (A K (BlockCoords n σ) p) (A K ((i : Fin (n+1)) × σ i) p) + _ _ (blockSigmaEquiv σ) (coordinateEquiv K _ _ p (blockSigmaEquiv σ)) + (separatedEquiv K p σ v))=_ + rw [←reindex_koszul,koszul_separated] + rfl + +omit [CharP K p] in +theorem mulScalar_sigmaSeparated {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] + (b : ∀ i, A K (σ i) p) (v : ⨂[K] i, Space K (σ i) p) : + mulScalar K ((i : Fin (n+1)) × σ i) p (sigmaProduct K p σ b) + (sigmaSeparatedEquiv K p σ v)= + sigmaSeparatedEquiv K p σ + (PiTensorProduct.map (fun i => mulScalar K (σ i) p (b i)) v) := by + rw [←separatedProduct_reindex K p σ b] + change mulScalar K _ p _ + (reindexForms K (A K (BlockCoords n σ) p) (A K ((i : Fin (n+1)) × σ i) p) + _ _ (blockSigmaEquiv σ) (coordinateEquiv K _ _ p (blockSigmaEquiv σ)) + (separatedEquiv K p σ v))=_ + rw [←reindex_mulScalar,mulScalar_separated] + rfl + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open Forms FrobeniusTruncation +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + [CharP K p] + +theorem koszul_parity (S : A K σ p) (ω : Space K σ p) : + koszul K σ p S (parity K (A K σ p) σ ω)= + -parity K (A K σ p) σ (koszul K σ p S ω) := by + change D K σ p (scalar K (A K σ p) σ S) * parity K (A K σ p) σ ω = + -parity K (A K σ p) σ (D K σ p (scalar K (A K σ p) σ S) * ω) + rw [map_mul,D,differential_scalar,parity_oneForm,neg_mul,neg_neg] + +omit [Fintype σ] [DecidableEq σ] [CharP K p] in +theorem mulScalar_parity (b : A K σ p) (ω : Space K σ p) : + mulScalar K σ p b (parity K (A K σ p) σ ω)= + parity K (A K σ p) σ (mulScalar K σ p b ω) := by + change scalar K (A K σ p) σ b * parity K (A K σ p) σ ω= + parity K (A K σ p) σ (scalar K (A K σ p) σ b * ω) + rw [map_mul,parity_scalar] + +@[simp] theorem koszul_zero : koszul K σ p 0=0 := by + apply LinearMap.ext + intro ω + change D K σ p (scalar K (A K σ p) σ 0) * ω=0 + rw [scalar_zero,map_zero,zero_mul] + +omit [Fintype σ] [DecidableEq σ] [CharP K p] in +@[simp] theorem mulScalar_one : mulScalar K σ p 1=LinearMap.id := by + apply LinearMap.ext + intro ω + change scalar K (A K σ p) σ 1 * ω=ω + rw [scalar_one,one_mul] + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct BigOperators +variable {K ι : Type*} [Field K] [Fintype ι] [LinearOrder ι] +variable {V : ι → Type*} [∀ i, AddCommGroup (V i)] [∀ i, Module K (V i)] + +omit [Fintype ι] in +theorem oddCoordinate_congr_at (g f h : ∀ i,V i →ₗ[K] V i) (i : ι) + (hh : f i=h i) : oddCoordinate g f i=oddCoordinate g h i := by + funext j + by_cases hji : j=i + · subst j; simp only [oddCoordinate,lt_self_iff_false,ite_false,ite_true,hh] + · simp only [oddCoordinate,hji,ite_false] + + +theorem oddTensor_single (g f : ∀ i,V i →ₗ[K] V i) (i : ι) : + oddTensor g (Pi.single i (f i))=PiTensorProduct.map (oddCoordinate g f i) := by + classical + unfold oddTensor + rw [Finset.sum_eq_single i] + · rw [oddCoordinate_congr_at g (Pi.single i (f i)) f i (by simp)] + · intro j _ hji + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,PiTensorProduct.map_tprod,LinearMap.zero_apply] + apply (PiTensorProduct.tprod K).map_coord_zero j + simp [oddCoordinate,hji] + · intro hi; exact (hi (Finset.mem_univ i)).elim + +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/FormalEvaluation.lean b/lean/OAI/Algebra/FiniteTensor/FormalEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1588e65c68b3f9b2f842c97458818a01137082ef --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/FormalEvaluation.lean @@ -0,0 +1,250 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.CoordinateEquivalences + +namespace OAI + +/-! Nilpotent formal evaluation and bijective formal substitutions. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +open MvPowerSeries.WithPiTopology +noncomputable section +variable (K : Type*) [CommRing K] {A σ : Type*} [CommRing A] [Algebra K A] [Finite σ] + + + +def nilEval (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) : MvPowerSeries σ K →ₐ[K] A := by + letI : UniformSpace K := ⊥ + letI : UniformSpace A := ⊥ + letI : ContinuousSMul K A := ⟨continuous_of_discreteTopology⟩ + exact MvPowerSeries.aeval ⟨fun i => (hv i).isTopologicallyNilpotent, + by simp only [Filter.cofinite_eq_bot]; exact Filter.tendsto_bot⟩ + +@[simp] theorem nilEval_X (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) (i : σ) : + nilEval K v hv (MvPowerSeries.X i)=v i := by + let : UniformSpace K := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul K A := ⟨continuous_of_discreteTopology⟩ + simp only [nilEval,MvPowerSeries.coe_aeval] + change MvPowerSeries.eval₂ (algebraMap K A) v (MvPowerSeries.X i)=v i + exact MvPowerSeries.eval₂_X (algebraMap K A) v i + +@[simp] theorem nilEval_coe (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) (q : MvPolynomial σ K) : + nilEval K v hv (q : MvPowerSeries σ K)=MvPolynomial.aeval v q := by + let : UniformSpace K := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul K A := ⟨continuous_of_discreteTopology⟩ + exact MvPowerSeries.aeval_coe _ q + +variable {K} + +theorem nilEval_map {B : Type*} [CommRing B] [Algebra K B] + (f : A →ₐ[K] B) (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) + (q : MvPowerSeries σ K) : + f (nilEval K v hv q)=nilEval K (fun i => f (v i)) (fun i => (hv i).map f) q := by + let : UniformSpace K := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul K A := ⟨continuous_of_discreteTopology⟩ + let : UniformSpace B := ⊥ + let : ContinuousSMul K B := ⟨continuous_of_discreteTopology⟩ + let hn : MvPowerSeries.HasEval v := ⟨fun i => (hv i).isTopologicallyNilpotent, + by simp only [Filter.cofinite_eq_bot]; exact Filter.tendsto_bot⟩ + exact DFunLike.congr_fun (MvPowerSeries.comp_aeval hn (continuous_of_discreteTopology : Continuous f)) q + + + +theorem nilEval_nilpotent (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) + (q : MvPowerSeries σ K) (hq : IsNilpotent (MvPowerSeries.constantCoeff q)) : + IsNilpotent (nilEval K v hv q) := by + let : UniformSpace K := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul K A := ⟨continuous_of_discreteTopology⟩ + let hn : MvPowerSeries.HasEval v := ⟨fun i => (hv i).isTopologicallyNilpotent, + by simp only [Filter.cofinite_eq_bot]; exact Filter.tendsto_bot⟩ + have h := (isTopologicallyNilpotent_of_constantCoeff_isNilpotent hq).map + (MvPowerSeries.continuous_aeval hn) + simp_rw [IsTopologicallyNilpotent,nhds_discrete,Filter.tendsto_pure] at h + exact h.exists + + + +theorem nilEval_subst {R τ : Type*} [CommRing R] [Algebra K R] [Algebra R A] + [IsScalarTower K R A] [Finite τ] + (a : σ → MvPowerSeries τ R) (ha : MvPowerSeries.HasSubst a) + (v : τ → A) (hv : ∀ i, IsNilpotent (v i)) + (q : MvPowerSeries σ K) : + nilEval R v hv (MvPowerSeries.subst a q)= + nilEval K (fun i => nilEval R v hv (a i)) + (fun i => nilEval_nilpotent v hv (a i) (ha.const_coeff i)) q := by + let : UniformSpace K := ⊥ + let : UniformSpace R := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul K A := ⟨continuous_of_discreteTopology⟩ + let : ContinuousSMul R A := ⟨continuous_of_discreteTopology⟩ + simp only [nilEval,MvPowerSeries.coe_aeval] + exact MvPowerSeries.eval₂_subst ha + ⟨fun i => (hv i).isTopologicallyNilpotent, + by simp only [Filter.cofinite_eq_bot]; exact Filter.tendsto_bot⟩ q + + +omit [Finite σ] in +theorem continuous_formal_pderiv [TopologicalSpace K] [IsTopologicalRing K] + [DecidableEq σ] (i : σ) : Continuous (MvPowerSeries.pderiv i : MvPowerSeries σ K → _) := by + apply continuous_pi + intro d + change Continuous (fun f : MvPowerSeries σ K => + MvPowerSeries.coeff (d+Finsupp.single i 1) f * (d i+1 : K)) + exact (continuous_coeff K _).mul continuous_const + + + +theorem nilEval_pderiv_coe [DecidableEq σ] (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) + (i : σ) (D : Derivation K A A) (hD : ∀ j, D (v j)=if i=j then 1 else 0) + (q : MvPolynomial σ K) : + D (nilEval K v hv (q : MvPowerSeries σ K))= + nilEval K v hv (MvPowerSeries.pderiv i (q : MvPowerSeries σ K)) := by + rw [MvPowerSeries.pderiv_coe] + simp only [nilEval_coe] + induction q using MvPolynomial.induction_on with + | C c => simp + | add q r hq hr => simp only [map_add,hq,hr] + | mul_X q j hq => + simp only [map_mul,Derivation.leibniz,MvPolynomial.aeval_X, + MvPolynomial.pderiv_X,hD,hq,smul_eq_mul,map_add,apply_ite] + split_ifs <;> simp_all [eq_comm] + + + +theorem nilEval_pderiv [DecidableEq σ] (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) + (i : σ) (D : Derivation K A A) (hD : ∀ j, D (v j)=if i=j then 1 else 0) + (q : MvPowerSeries σ K) : + D (nilEval K v hv q)=nilEval K v hv (MvPowerSeries.pderiv i q) := by + let : UniformSpace K := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul K A := ⟨continuous_of_discreteTopology⟩ + let hn : MvPowerSeries.HasEval v := ⟨fun i => (hv i).isTopologicallyNilpotent, + by simp only [Filter.cofinite_eq_bot]; exact Filter.tendsto_bot⟩ + have hc : Continuous (nilEval K v hv : MvPowerSeries σ K → A) := + MvPowerSeries.continuous_aeval hn + have h := Continuous.ext_on (denseRange_toMvPowerSeries (σ:=σ) (R:=K)) + ((continuous_of_discreteTopology : Continuous D).comp hc) + (hc.comp (continuous_formal_pderiv i)) (by + rintro _ ⟨r,rfl⟩ + exact nilEval_pderiv_coe v hv i D hD r) + exact congr_fun h q + +end +end PD4Tensor + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +open MvPowerSeries.WithPiTopology +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + [CharP K p] [Fact p.Prime] + +def boundedCoeff (a : σ →₀ ℕ) (ha : ∀ i, a i ⟨p,variable_pow K σ p i⟩) + +omit [DecidableEq σ] [CharP K p] [Fact p.Prime] in +@[simp] theorem formalEval_coe (q : MvPolynomial σ K) : + formalEval K σ p (q : MvPowerSeries σ K)=Ideal.Quotient.mk (ideal K σ p) q := by + have he : formalEval K σ p (q : MvPowerSeries σ K)=MvPolynomial.aeval (coord K σ p) q := + nilEval_coe K (coord K σ p) _ q + rw [he] + have h : MvPolynomial.aeval (coord K σ p)=Ideal.Quotient.mkₐ K (ideal K σ p) := by + apply MvPolynomial.algHom_ext + intro i + exact MvPolynomial.aeval_X _ i + exact DFunLike.congr_fun h q + + + +omit [DecidableEq σ] [CharP K p] [Fact p.Prime] in +theorem boundedCoeff_formalEval (a : σ →₀ ℕ) (ha : ∀ i, a i (Fact.out : p.Prime).pos) q + rw [←hr,boundedCoeff_mk] at h + exact h + +def formalSubst (c : σ → MvPowerSeries σ K) + (hc : ∀ i, MvPowerSeries.constantCoeff (c i)=0) : Ring K σ p →ₐ[K] Ring K σ p := + FiniteCoordinates.evaluate (fun i => formalEval K σ p (c i)) (by + intro i + rw [formalEval_pow,hc] + simp [zero_pow (Fact.out : p.Prime).ne_zero]) + +omit [DecidableEq σ] in +@[simp] theorem formalSubst_coord (c : σ → MvPowerSeries σ K) + (hc : ∀ i, MvPowerSeries.constantCoeff (c i)=0) (i : σ) : + formalSubst K σ p c hc (coord K σ p i)=formalEval K σ p (c i) := by + change (MvPolynomial.aeval _) (MvPolynomial.X i)=_ + exact MvPolynomial.aeval_X _ i + + + +theorem formalSubst_bijective (c : σ → MvPowerSeries σ K) + (hc : ∀ i, MvPowerSeries.constantCoeff (c i)=0) + (hM : Matrix.det (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (c i))≠0) : + Function.Bijective (formalSubst K σ p c hc) := by + choose r hr using fun i => Ideal.Quotient.mk_surjective (formalEval K σ p (c i)) + have hrc (i : σ) : MvPolynomial.constantCoeff (r i)=0 := by + have h := boundedCoeff_formalEval K σ p 0 (fun j => (Fact.out : p.Prime).pos) (c i) + rw [←hr i,boundedCoeff_mk] at h + exact h.trans (hc i) + have hrt : tangentMatrix K σ r=(fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (c i)) := by + ext i j + have hb : ∀ k : σ, (Finsupp.single j 1) k

have := (Fact.out : p.Prime).two_le <;> omega + have h := boundedCoeff_formalEval K σ p (Finsupp.single j 1) hb (c i) + rw [←hr i,boundedCoeff_mk] at h + exact h + have he : formalSubst K σ p c hc=polynomialSubst K σ p r hrc := by + apply FiniteCoordinates.hom_ext (e:=fun _ => p) + intro i + change formalSubst K σ p c hc (coord K σ p i)=polynomialSubst K σ p r hrc (coord K σ p i) + rw [formalSubst_coord,polynomialSubst_coord,hr] + rw [he] + apply polynomialSubst_bijective K σ p r hrc + rwa [hrt] + +end +end PD4Tensor.FrobeniusTruncation +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/FrobeniusQuotient.lean b/lean/OAI/Algebra/FiniteTensor/FrobeniusQuotient.lean new file mode 100644 index 0000000000000000000000000000000000000000..65481b3e0638f449064e310cdb89c1f91219083a --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/FrobeniusQuotient.lean @@ -0,0 +1,188 @@ +import Mathlib + +namespace OAI + +/-! Polynomial Frobenius quotients, bounded coefficients, residues and derivatives. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +namespace FrobeniusTruncation +noncomputable section + +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + +def ideal : Ideal (MvPolynomial σ K) := + Ideal.span (Set.range (fun i : σ => (MvPolynomial.X i : MvPolynomial σ K) ^ p)) + +abbrev Ring := MvPolynomial σ K ⧸ ideal K σ p + +def coord (i : σ) : Ring K σ p := + Ideal.Quotient.mk (ideal K σ p) (MvPolynomial.X i) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem variable_pow (i : σ) : coord K σ p i ^ p = 0 := by + rw [coord, ← map_pow, Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.subset_span (Set.mem_range_self i) + +omit [Fintype σ] [DecidableEq σ] in +private theorem ideal_as_monomials : ideal K σ p = + Ideal.span ((fun a : σ →₀ ℕ => MvPolynomial.monomial a (1 : K)) '' + Set.range (fun i : σ => Finsupp.single i p)) := by + unfold ideal + congr 1 + ext f + simp only [Set.mem_range, Set.mem_image] + constructor + · rintro ⟨i, rfl⟩ + exact ⟨Finsupp.single i p, ⟨i, rfl⟩, (MvPolynomial.X_pow_eq_monomial).symm⟩ + · rintro ⟨a, ⟨i, rfl⟩, rfl⟩ + exact ⟨i, MvPolynomial.X_pow_eq_monomial⟩ + + +def socleExponent : σ →₀ ℕ := Finsupp.equivFunOnFinite.symm (fun _ => p - 1) + +omit [DecidableEq σ] in +@[simp] theorem socleExponent_apply (i : σ) : socleExponent σ p i = p - 1 := by + simp [socleExponent] + + +omit [Fintype σ] [DecidableEq σ] in +theorem coeff_zero_of_mem_ideal (a : σ →₀ ℕ) (ha : ∀ i, a i < p) + (f : MvPolynomial σ K) (hf : f ∈ ideal K σ p) : f.coeff a = 0 := by + by_contra h + rw [ideal_as_monomials, MvPolynomial.mem_ideal_span_monomial_image] at hf + obtain ⟨_, ⟨i, rfl⟩, hi⟩ := hf a (MvPolynomial.mem_support_iff.mpr h) + have hpi : p ≤ a i := by simpa using hi i + exact (not_le_of_gt (ha i)) hpi + + +def residue (hp : 0 < p) : Ring K σ p →ₗ[K] K := + ((ideal K σ p).restrictScalars K).liftQ (MvPolynomial.lcoeff K (socleExponent σ p)) + (by + intro f hf + exact coeff_zero_of_mem_ideal K σ p (socleExponent σ p) + (fun i => by simp only [socleExponent_apply]; omega) f hf) + +omit [DecidableEq σ] in +@[simp] theorem residue_mk (hp : 0 < p) (f : MvPolynomial σ K) : + residue K σ p hp (Ideal.Quotient.mk (ideal K σ p) f) = + f.coeff (socleExponent σ p) := rfl + +@[simp] theorem residue_socle (hp : 0 < p) : + residue K σ p hp (Ideal.Quotient.mk (ideal K σ p) + (MvPolynomial.monomial (socleExponent σ p) 1)) = 1 := by + simp + + +theorem socle_ne_zero (hp : 0 < p) : + Ideal.Quotient.mk (ideal K σ p) (MvPolynomial.monomial (socleExponent σ p) 1) ≠ 0 := by + intro h + have he := residue_socle K σ p hp + rw [h, map_zero] at he + exact zero_ne_one he + +variable [CharP K p] + + +omit [Fintype σ] [DecidableEq σ] in +theorem pderiv_mem (i : σ) (f : MvPolynomial σ K) (hf : f ∈ ideal K σ p) : + MvPolynomial.pderiv i f ∈ ideal K σ p := by + induction hf using Submodule.span_induction with + | mem f hf => + obtain ⟨j, rfl⟩ := hf + simp only [MvPolynomial.pderiv_pow, CharP.cast_eq_zero, zero_mul] + exact Ideal.zero_mem _ + | zero => simp + | add f g hf hg ihf ihg => + simpa only [map_add] using (ideal K σ p).add_mem ihf ihg + | smul a f hf ih => + rw [smul_eq_mul, MvPolynomial.pderiv_mul] + exact (ideal K σ p).add_mem ((ideal K σ p).mul_mem_left _ hf) + ((ideal K σ p).mul_mem_left _ ih) + + + +def derivative (i : σ) : Ring K σ p →ₗ[K] Ring K σ p := + ((ideal K σ p).restrictScalars K).liftQ + ((Ideal.Quotient.mkₐ K (ideal K σ p)).toLinearMap.comp + (MvPolynomial.pderiv i).toLinearMap) + (by + intro f hf + change Ideal.Quotient.mk (ideal K σ p) (MvPolynomial.pderiv i f) = 0 + exact Ideal.Quotient.eq_zero_iff_mem.mpr (pderiv_mem K σ p i f hf)) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem derivative_mk (i : σ) (f : MvPolynomial σ K) : + derivative K σ p i (Ideal.Quotient.mk (ideal K σ p) f) = + Ideal.Quotient.mk (ideal K σ p) (MvPolynomial.pderiv i f) := rfl + + +omit [DecidableEq σ] in +theorem residue_derivative (hp : 0 < p) (i : σ) (f : Ring K σ p) : + residue K σ p hp (derivative K σ p i f) = 0 := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective f + rw [derivative_mk, residue_mk, MvPolynomial.coeff_pderiv, socleExponent_apply] + have hn : p - 1 + 1 = p := by omega + rw [← Nat.cast_add_one, hn, CharP.cast_eq_zero, mul_zero] + + +omit [Fintype σ] [DecidableEq σ] in +theorem derivative_mul (i : σ) (f g : Ring K σ p) : + derivative K σ p i (f * g) = derivative K σ p i f * g + f * derivative K σ p i g := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective f + obtain ⟨g, rfl⟩ := Ideal.Quotient.mk_surjective g + rw [← map_mul, derivative_mk, MvPolynomial.pderiv_mul] + simp + + +omit [Fintype σ] in +theorem polynomial_pderiv_commute (i j : σ) (f : MvPolynomial σ K) : + MvPolynomial.pderiv i (MvPolynomial.pderiv j f) = + MvPolynomial.pderiv j (MvPolynomial.pderiv i f) := by + by_cases hij : i = j + · subst j; rfl + induction f using MvPolynomial.induction_on with + | C a => simp + | add f g hf hg => simp [hf, hg] + | mul_X f k hf => + by_cases hi : k = i <;> by_cases hj : k = j <;> + simp [MvPolynomial.pderiv_X, hi, hj, hij, Ne.symm hij, eq_comm, hf] <;> ring + + + +omit [Fintype σ] in +theorem derivative_commute (i j : σ) (f : Ring K σ p) : + derivative K σ p i (derivative K σ p j f) = + derivative K σ p j (derivative K σ p i f) := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective f + simp only [derivative_mk, polynomial_pderiv_commute K σ] + +variable [Fact p.Prime] + + +omit [Fintype σ] [DecidableEq σ] in +theorem frobenius_mk (f : MvPolynomial σ K) : + (Ideal.Quotient.mk (ideal K σ p) f)^p = + algebraMap K (Ring K σ p) ((MvPolynomial.constantCoeff f)^p) := by + induction f using MvPolynomial.induction_on with + | C a => + rw [MvPolynomial.constantCoeff_C] + change (algebraMap K (Ring K σ p) a)^p = _ + exact (map_pow _ _ _).symm + | add f g hf hg => + rw [← map_pow, add_pow_char, map_add, map_pow, map_pow, hf, hg] + simp [add_pow_char] + | mul_X f i hf => + rw [map_mul, mul_pow] + change _ * coord K σ p i ^ p = _ + rw [variable_pow, mul_zero] + simp [zero_pow (Fact.out : p.Prime).ne_zero] + +end +end FrobeniusTruncation +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/GermBranches.lean b/lean/OAI/Algebra/FiniteTensor/GermBranches.lean new file mode 100644 index 0000000000000000000000000000000000000000..05b4f49c010d33ea63eb0b605ecf274a0d147254 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/GermBranches.lean @@ -0,0 +1,364 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ArtinSteps + +namespace OAI + +/-! Jet stability of algebraic branches, coordinate removal and constant coefficients. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open Polynomial MvPowerSeries + + + +theorem polynomial_root_equal_of_jet {K τ : Type*} [CommRing K] [IsDomain K] [Finite τ] + (P : Polynomial (MvPowerSeries τ K)) (a b : MvPowerSeries τ K) + (ha : P.eval a=0) (hb : P.eval b=0) (hd : P.derivative.eval a≠0) + (hclose : b-a∈(jetIdeal (K:=K) (σ:=τ))^((P.derivative.eval a).order.toNat+1)) : b=a := by + by_contra hne + obtain ⟨q,hq⟩ := P.exists_mul_sq_add_linear_part_eq_eval_add a (b-a) + rw [add_sub_cancel,ha,hb,add_zero] at hq + have he : (b-a)*(P.derivative.eval a+(b-a)*q)=0 := by linear_combination hq + have he' := (mul_eq_zero.mp he).resolve_left (sub_ne_zero.mpr hne) + have hmem : P.derivative.eval a∈(jetIdeal (K:=K) (σ:=τ))^ + ((P.derivative.eval a).order.toNat+1) := by + have hz := ((jetIdeal (K:=K) (σ:=τ))^((P.derivative.eval a).order.toNat+1)).neg_mem + (((jetIdeal (K:=K) (σ:=τ))^((P.derivative.eval a).order.toNat+1)).mul_mem_right q hclose) + convert hz using 1 + linear_combination he' + have ho := (mem_jetIdeal_pow_iff_order _ _).mp hmem + rw [←ne_zero_iff_order_finite.mp hd] at ho + exact Nat.not_succ_le_self _ (by exact_mod_cast ho) + + +theorem polynomial_eval₂_congr_ideal {B R : Type*} [CommRing B] [CommRing R] + (I : Ideal R) (φ ψ : B →+* R) (a b : R) + (hc : ∀ c,φ c-ψ c∈I) (hab : a-b∈I) (P : Polynomial B) : + P.eval₂ φ a-P.eval₂ ψ b∈I := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_sub,sub_eq_zero] + have hf : (Ideal.Quotient.mk I).comp φ=(Ideal.Quotient.mk I).comp ψ := by + ext c + exact sub_eq_zero.mp ((map_sub _ _ _).symm.trans (Ideal.Quotient.eq_zero_iff_mem.mpr (hc c))) + have ha : Ideal.Quotient.mk I a=Ideal.Quotient.mk I b := + sub_eq_zero.mp ((map_sub _ _ _).symm.trans (Ideal.Quotient.eq_zero_iff_mem.mpr hab)) + rw [Polynomial.hom_eval₂,Polynomial.hom_eval₂,hf,ha] + + + +theorem polynomial_moving_branch {B K τ : Type*} [CommRing B] + [CommRing K] [IsDomain K] [Finite τ] + (P : Polynomial B) (φ ψ : B →+* MvPowerSeries τ K) + (a₀ a b : MvPowerSeries τ K) + (hd : P.derivative.eval₂ ψ a₀≠0) + (hc : ∀ c,φ c-ψ c∈(jetIdeal (K:=K) (σ:=τ))^ + ((P.derivative.eval₂ ψ a₀).order.toNat+1)) + (ha : a-a₀∈(jetIdeal (K:=K) (σ:=τ))^((P.derivative.eval₂ ψ a₀).order.toNat+1)) + (hb : b-a₀∈(jetIdeal (K:=K) (σ:=τ))^((P.derivative.eval₂ ψ a₀).order.toNat+1)) + (hea : P.eval₂ φ a=0) (heb : P.eval₂ φ b=0) : b=a := by + have hdc := polynomial_eval₂_congr_ideal _ φ ψ a a₀ hc ha P.derivative + have hdn := ne_zero_of_close_jet hd hdc + have hdo := order_eq_of_close_jet hd hdc + apply polynomial_root_equal_of_jet (P.map φ) a b + · simpa only [eval_map] using hea + · simpa only [eval_map] using heb + · simpa only [derivative_map,eval_map] using hdn + · simp only [derivative_map,eval_map,hdo] + convert ((jetIdeal (K:=K) (σ:=τ))^((P.derivative.eval₂ ψ a₀).order.toNat+1)).sub_mem hb ha using 1 + abel + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ τ : Type*} [CommRing K] [Finite σ] [Finite τ] + + theorem truncTotal_eq_of_close (a b : MvPowerSeries τ K) (n : ℕ) + (h : a-b∈(jetIdeal (K:=K) (σ:=τ))^n) : truncTotal n a=truncTotal n b := by + ext d + by_cases hd : d.degree polynomial.coeff d) h + rw [coeff_truncTotal _ hd,coeff_truncTotal _ hd] at he + simpa only [map_sub,sub_eq_zero] using he + + + +theorem subst_close_jet (f : MvPowerSeries σ K) (a b : σ → MvPowerSeries τ K) + (ha : ∀ i,constantCoeff (a i)=0) (hb : ∀ i,constantCoeff (b i)=0) (n : ℕ) + (h : ∀ i,a i-b i∈(jetIdeal (K:=K) (σ:=τ))^n) : + subst a f-subst b f∈(jetIdeal (K:=K) (σ:=τ))^n := by + apply close_of_truncTotal_eq + have hc : (fun i=>((a i).truncTotal n : MvPowerSeries τ K))= + fun i=>((b i).truncTotal n : MvPowerSeries τ K) := by + funext i + rw [truncTotal_eq_of_close (a i) (b i) n (h i)] + rw [truncTotal_subst_eq_truncTotal_subst_truncTotal_of_le + (hasSubst_of_constantCoeff_zero ha) (x:=fun _=>n) (fun _=>le_rfl), + truncTotal_subst_eq_truncTotal_subst_truncTotal_of_le + (hasSubst_of_constantCoeff_zero hb) (x:=fun _=>n) (fun _=>le_rfl),hc] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ τ : Type*} [CommRing K] [IsDomain K] [Finite σ] [Finite τ] + + +omit [IsDomain K] [Finite τ] in +theorem aeval_relation_subst (F : MvPowerSeries σ K) + (P : Polynomial (MvPolynomial σ K)) + (a : σ → MvPowerSeries τ K) (ha : ∀ i,constantCoeff (a i)=0) : + P.eval₂ (MvPolynomial.aeval a).toRingHom (subst a F)= + subst a (Polynomial.aeval F P) := by + let A := substAlgHom (R:=K) (hasSubst_of_constantCoeff_zero ha) + have he : A.toRingHom.comp (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K))= + (MvPolynomial.aeval a).toRingHom := by + apply MvPolynomial.ringHom_ext + · intro c + simp [A,MvPowerSeries.algebraMap_apply',MvPowerSeries.algebraMap_apply] + · intro i + simp [A,MvPowerSeries.algebraMap_apply', + subst_X (hasSubst_of_constantCoeff_zero ha)] + rw [←substAlgHom_apply (hasSubst_of_constantCoeff_zero ha), + ←substAlgHom_apply (hasSubst_of_constantCoeff_zero ha)] + change P.eval₂ (MvPolynomial.aeval a).toRingHom (A F)=A (Polynomial.aeval F P) + rw [Polynomial.aeval_def] + change P.eval₂ (MvPolynomial.aeval a).toRingHom (A F)=A.toRingHom (P.eval₂ _ F) + rw [Polynomial.hom_eval₂,he] + rfl + + + +theorem germ_branch_stability (F : MvPowerSeries σ K) + (P : Polynomial (MvPolynomial σ K)) (hP : Polynomial.aeval F P=0) + (a₀ a : σ → MvPowerSeries τ K) + (h₀ : ∀ i,constantCoeff (a₀ i)=0) (ha : ∀ i,constantCoeff (a i)=0) + (hd : subst a₀ (Polynomial.aeval F P.derivative)≠0) + (hc : ∀ i,a i-a₀ i∈(jetIdeal (K:=K) (σ:=τ))^ + ((subst a₀ (Polynomial.aeval F P.derivative)).order.toNat+1)) + (b : MvPowerSeries τ K) + (hb : b-subst a₀ F∈(jetIdeal (K:=K) (σ:=τ))^ + ((subst a₀ (Polynomial.aeval F P.derivative)).order.toNat+1)) + (hroot : P.eval₂ (MvPolynomial.aeval a).toRingHom b=0) : b=subst a F := by + have he := aeval_relation_subst F P.derivative a₀ h₀ + apply polynomial_moving_branch P (MvPolynomial.aeval a).toRingHom + (MvPolynomial.aeval a₀).toRingHom (subst a₀ F) (subst a F) b + · rwa [he] + · intro c + rw [he] + change (MvPolynomial.aeval a) c-(MvPolynomial.aeval a₀) c∈_ + simpa only [subst_coe] using subst_close_jet (c : MvPowerSeries σ K) a a₀ ha h₀ _ hc + · rw [he] + exact subst_close_jet F a a₀ ha h₀ _ hc + · rwa [he] + · rw [aeval_relation_subst F P a ha,hP,←substAlgHom_apply (hasSubst_of_constantCoeff_zero ha),map_zero] + · exact hroot + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open Polynomial +variable {B A : Type*} [CommRing B] [IsDomain B] [CommRing A] [IsDomain A] + [Algebra B A] + + + + +omit [IsDomain B] in +theorem algebraic_constantCoeff {f : PowerSeries A} + (hf : IsAlgebraic (Polynomial B) f) : + IsAlgebraic B (PowerSeries.constantCoeff f) := by + obtain ⟨P,hP,hPf⟩ := hf + let Q := Bivariate.swap P + have hQ : Q≠0 := fun hz=>hP (Bivariate.swap.injective (by simpa only [map_zero] using hz)) + obtain ⟨n,q,hq,hq0⟩ := polynomial_remove_X_factor Q hQ + let E : Polynomial (Polynomial B) →+* PowerSeries A := + eval₂RingHom (aeval f).toRingHom PowerSeries.X + have hmap : (aeval (PowerSeries.X : PowerSeries A) : Polynomial B →ₐ[B] PowerSeries A).toRingHom = + algebraMap (Polynomial B) (PowerSeries A) := by + apply Polynomial.ringHom_ext + · intro b + simp [PowerSeries.algebraMap_apply',PowerSeries.algebraMap_apply] + · simp [PowerSeries.algebraMap_apply'] + have heswap : E.comp Bivariate.swap.toRingHom = + (aeval f : Polynomial (Polynomial B) →ₐ[Polynomial B] PowerSeries A).toRingHom := by + apply Polynomial.ringHom_ext + · intro p + change E (Bivariate.swap (C p))=(aeval f) (C p) + rw [Bivariate.swap_C,aeval_C] + change eval₂ (aeval f).toRingHom PowerSeries.X (p.map C)=_ + rw [eval₂_map] + have hc : (aeval f).toRingHom.comp (C : B →+* Polynomial B)=algebraMap B (PowerSeries A) := by + ext b + simp + rw [hc] + exact RingHom.congr_fun hmap p + · simp [E,Bivariate.swap_Y] + have hE : E Q=0 := by + exact (RingHom.congr_fun heswap P).trans hPf + have hqeval : E q=0 := by + rw [hq,map_mul,map_pow] at hE + have hx : E X=PowerSeries.X := by simp [E] + rw [hx] at hE + exact (mul_eq_zero.mp hE).resolve_left (pow_ne_zero _ PowerSeries.X_ne_zero) + refine ⟨q.coeff 0,hq0,?_⟩ + have he := congrArg PowerSeries.constantCoeff hqeval + have hhom : PowerSeries.constantCoeff.comp E = + ((aeval (PowerSeries.constantCoeff f)).toRingHom).comp (evalRingHom (0 : Polynomial B)) := by + apply Polynomial.ringHom_ext + · intro p + simp only [RingHom.comp_apply,E,coe_eval₂RingHom,eval₂_C,coe_evalRingHom,eval_C] + change PowerSeries.constantCoeff (aeval f p)=aeval (PowerSeries.constantCoeff f) p + induction p using Polynomial.induction_on' with + | add p q hp hq => simp [hp,hq] + | monomial n b => simp [aeval_monomial,PowerSeries.algebraMap_apply] + · simp [E] + have hc := RingHom.congr_fun hhom q + have hz := hc.symm.trans he + simp only [RingHom.comp_apply,coe_evalRingHom,←coeff_zero_eq_eval_zero,map_zero] at hz + exact hz + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {K σ : Type*} [CommRing K] [IsDomain K] [Finite σ] + +omit [IsDomain K] [Finite σ] in + theorem algebraic_optionEquiv {f : MvPowerSeries (Option σ) K} + (hf : IsAlgebraic (MvPolynomial (Option σ) K) f) : + IsAlgebraic (Polynomial (MvPolynomial σ K)) (MvPowerSeries.optionEquivLeft σ K f) := by + apply hf.ringHom_of_comp_eq (MvPolynomial.optionEquivLeft K σ).toRingHom + (MvPowerSeries.optionEquivLeft σ K).toRingHom (MvPolynomial.optionEquivLeft K σ).injective + apply MvPolynomial.ringHom_ext + · intro c + simp [MvPolynomial.optionEquivLeft_C,MvPowerSeries.algebraMap_apply', + PowerSeries.algebraMap_apply'] + · intro i + cases i <;> simp [MvPowerSeries.algebraMap_apply',PowerSeries.algebraMap_apply'] + + + +omit [Finite σ] in + theorem algebraic_drop_option {f : MvPowerSeries (Option σ) K} + (hf : IsAlgebraic (MvPolynomial (Option σ) K) f) : + IsAlgebraic (MvPolynomial σ K) + (PowerSeries.constantCoeff (MvPowerSeries.optionEquivLeft σ K f)) := by + let : IsDomain (MvPowerSeries σ K) := NoZeroDivisors.to_isDomain _ + exact algebraic_constantCoeff (algebraic_optionEquiv hf) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ τ υ : Type*} [CommRing K] [IsDomain K] + +omit [IsDomain K] in + theorem algebraic_rename_equiv (e : σ ≃ τ) {f : MvPowerSeries σ K} + (hf : IsAlgebraic (MvPolynomial σ K) f) : + IsAlgebraic (MvPolynomial τ K) (rename e f) := by + apply hf.ringHom_of_comp_eq (MvPolynomial.rename e).toRingHom + (rename e).toRingHom (MvPolynomial.rename_injective _ e.injective) + apply MvPolynomial.ringHom_ext + · intro c + simp [MvPowerSeries.algebraMap_apply'] + · intro i + simp [MvPowerSeries.algebraMap_apply'] + +omit [IsDomain K] in + theorem killCompl_comp_apply (e : σ ↪ τ) (g : τ ↪ υ) (f : MvPowerSeries υ K) : + killCompl e (killCompl g f)=killCompl (e.trans g) f := by + ext d + simp only [coeff_killCompl,Finsupp.embDomain_trans_apply] + +omit [IsDomain K] in + theorem killCompl_equiv (e : σ ≃ τ) (f : MvPowerSeries τ K) : + killCompl e.toEmbedding f=rename e.symm f := by + have h := killCompl_rename_app (e:=e.toEmbedding) (rename e.symm f) + have he : rename e.toEmbedding (rename e.symm f)=f := + (renameEquiv K e).apply_symm_apply f + rwa [he] at h + +omit [IsDomain K] in + theorem drop_ne_eq_killCompl [DecidableEq τ] (t : τ) (f : MvPowerSeries τ K) : + PowerSeries.constantCoeff (optionEquivLeft {i : τ // i≠t} K + (rename (Equiv.optionSubtypeNe t).symm f))= + killCompl (Function.Embedding.subtype (fun i : τ=>i≠t)) f := by + classical + ext d + rw [←PowerSeries.coeff_zero_eq_constantCoeff_apply,coeff_coeff_optionEquivLeft,coeff_killCompl] + let E := Equiv.optionSubtypeNe t + let j : {i : τ // i≠t} ↪ τ := Function.Embedding.subtype _ + have hh : j.trans E.symm.toEmbedding=Function.Embedding.some := by + apply Function.Embedding.ext + intro i + exact Equiv.optionSubtypeNe_symm_of_ne i.property + have hd : Finsupp.embDomain E.symm.toEmbedding (Finsupp.embDomain j d)=d.optionElim 0 := by + rw [←Finsupp.embDomain_trans_apply,hh] + ext i + cases i <;> simp + rw [←hd] + exact coeff_embDomain_rename E.symm.toEmbedding f _ + + theorem algebraic_drop_ne [Finite τ] (t : τ) {f : MvPowerSeries τ K} + (hf : IsAlgebraic (MvPolynomial τ K) f) : + IsAlgebraic (MvPolynomial {i : τ // i≠t} K) + (killCompl (Function.Embedding.subtype (fun i : τ=>i≠t)) f) := by + classical + rw [←drop_ne_eq_killCompl] + exact algebraic_drop_option (algebraic_rename_equiv (Equiv.optionSubtypeNe t).symm hf) + + + + theorem algebraic_killCompl [Finite σ] [Finite τ] (e : σ ↪ τ) {f : MvPowerSeries τ K} + (hf : IsAlgebraic (MvPolynomial τ K) f) : + IsAlgebraic (MvPolynomial σ K) (killCompl e f) := by + classical + generalize hn : Nat.card τ=n + induction n using Nat.strong_induction_on generalizing τ with + | h n ih => + by_cases he : Function.Surjective e + · let E : σ ≃ τ := Equiv.ofBijective e ⟨e.injective,he⟩ + have hh : e=E.toEmbedding := by ext i; rfl + rw [hh,killCompl_equiv] + exact algebraic_rename_equiv E.symm hf + · simp only [Function.Surjective, not_forall, not_exists] at he + obtain ⟨t,ht⟩ := he + let j : {i : τ // i≠t} ↪ τ := Function.Embedding.subtype _ + let e' : σ ↪ {i : τ // i≠t} := + ⟨fun i=>⟨e i,ht i⟩,fun _ _ h=>e.injective (congrArg Subtype.val h)⟩ + have hcomp : e'.trans j=e := by ext i; rfl + have hlt : Nat.card {i : τ // i≠t}i≠t) (x:=t) (not_not.mpr rfl)) + have h := ih (Nat.card {i : τ // i≠t}) hlt e' (algebraic_drop_ne t hf) rfl + rwa [killCompl_comp_apply,hcomp] at h + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/JacobianAlgebraicity.lean b/lean/OAI/Algebra/FiniteTensor/JacobianAlgebraicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..89bf7ac79356ed90c01853928502c9fbdeae66ce --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/JacobianAlgebraicity.lean @@ -0,0 +1,351 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.AdicSystems + +namespace OAI + +/-! Algebraicity from nondegenerate Jacobians and rectangular correction systems. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +open MvPolynomial + +variable {K L σ : Type*} [Field K] [Field L] [Algebra K L] +variable [Fintype σ] [DecidableEq σ] + + +theorem derivation_mv_aeval {M : Type*} [AddCommGroup M] [Module L M] + [Module K M] [IsScalarTower K L M] (D : Derivation K L M) + (a : σ → L) (p : MvPolynomial σ K) : + D (aeval a p)=∑ i : σ,aeval a (pderiv i p) • D (a i) := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp only [map_add,hp,hq,add_smul,Finset.sum_add_distrib] + | mul_X p k hp => + simp only [map_mul,aeval_X,D.leibniz,hp,pderiv_mul,map_add,add_smul, + Finset.sum_add_distrib] + rw [Finset.smul_sum] + apply Eq.trans _ (add_comm _ _) + congr 1 + · rw [Finset.sum_eq_single k] + · simp + · intro i hi hik + simp [pderiv_X,Ne.symm hik] + · simp + · apply Finset.sum_congr rfl + intro i hi + rw [mul_smul,smul_comm] + +private theorem matrix_module_kernel_zero {M : Type*} [AddCommGroup M] [Module L M] + (J : Matrix σ σ L) (hJ : J.det≠0) (v : σ → M) + (hv : ∀ k,∑ i : σ,J k i • v i=0) : ∀ i,v i=0 := by + intro i + have h : J.det • v i=0 := by + calc + J.det • v i = ∑ j : σ,(J.adjugate*J) i j • v j := by + rw [Matrix.adjugate_mul] + simp [Matrix.smul_apply,Matrix.one_apply] + _ = ∑ k : σ,J.adjugate i k • (∑ j : σ,J k j • v j) := by + simp only [Matrix.mul_apply,Finset.sum_smul,Finset.smul_sum,mul_smul] + rw [Finset.sum_comm] + _ = 0 := by simp only [hv,smul_zero,Finset.sum_const_zero] + exact (smul_eq_zero.mp h).resolve_left hJ + + + +theorem isAlgebraic_of_mv_jacobian (f : σ → MvPolynomial σ K) (a : σ → L) + (hf : ∀ k,aeval a (f k)=0) + (hJ : Matrix.det (fun k i=>aeval a (pderiv i (f k)))≠0) : + ∀ i,IsAlgebraic K (a i) := by + let E : IntermediateField K L := IntermediateField.adjoin K (Set.range a) + let b : σ → E := fun i=>⟨a i,IntermediateField.subset_adjoin K _ (Set.mem_range_self i)⟩ + have hb (k : σ) : aeval b (f k)=0 := by + apply E.val.injective + change E.val (aeval b (f k))=E.val 0 + rw [map_zero,MvPolynomial.comp_aeval_apply] + exact hf k + let J : Matrix σ σ E := fun k i=>aeval b (pderiv i (f k)) + have hJE : J.det≠0 := by + intro h + have hh := congrArg E.val h + rw [map_zero,E.val.map_det] at hh + have hm : E.val.mapMatrix J=(fun k i=>aeval a (pderiv i (f k))) := by + ext k i + exact MvPolynomial.comp_aeval_apply b E.val (pderiv i (f k)) + rw [hm] at hh + exact hJ hh + let D := KaehlerDifferential.D K E + have hDb : ∀ i,D (b i)=0 := by + apply matrix_module_kernel_zero J hJE + intro k + rw [←derivation_mv_aeval D b (f k),hb k,map_zero] + have hD : ∀ x : E,D x=0 := by + rintro ⟨x,hx⟩ + change x∈IntermediateField.adjoin K (Set.range a) at hx + induction hx using IntermediateField.adjoin_induction with + | mem x hx => + obtain ⟨i,rfl⟩ := hx + exact hDb i + | algebraMap r => exact D.map_algebraMap r + | add x y hx hy ihx ihy => + change D ((⟨x,hx⟩ : E)+⟨y,hy⟩)=0 + rw [map_add,ihx,ihy,add_zero] + | inv x hx ih => + change D ((⟨x,hx⟩ : E)⁻¹)=0 + rw [Derivation.leibniz_inv,ih,smul_zero] + | mul x y hx hy ihx ihy => + change D ((⟨x,hx⟩ : E)*⟨y,hy⟩)=0 + rw [D.leibniz,ihx,ihy,smul_zero,smul_zero,add_zero] + have hsub : (⊤ : Submodule E Ω[E⁄K])≤⊥ := by + rw [←KaehlerDifferential.span_range_derivation,Submodule.span_le] + rintro _ ⟨x,rfl⟩ + exact hD x + let : Algebra.FormallyUnramified K E := ⟨ + (subsingleton_iff_forall_eq 0).mpr (fun x=>hsub trivial)⟩ + let : Algebra.EssFiniteType K E := IntermediateField.essFiniteType_iff.mpr + (IntermediateField.fg_adjoin_of_finite (Set.finite_range a)) + let : Algebra.IsSeparable K E := Algebra.FormallyUnramified.isSeparable K E + intro i + exact (isAlgebraic_algHom_iff E.val E.val.injective).mpr + (Algebra.IsAlgebraic.isAlgebraic (b i)) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +open MvPolynomial +variable {R S L σ : Type*} [CommRing R] [IsDomain R] +variable [Fintype σ] [DecidableEq σ] + + +theorem isAlgebraic_of_mv_jacobian_domain_field [Field L] [Algebra R L] [FaithfulSMul R L] + (f : σ → MvPolynomial σ R) (a : σ → L) + (hf : ∀ k,aeval a (f k)=0) + (hJ : Matrix.det (fun k i=>aeval a (pderiv i (f k)))≠0) : + ∀ i,IsAlgebraic R (a i) := by + let F := FractionRing R + let : Algebra F L := FractionRing.liftAlgebra R L + let : IsScalarTower R F L := FractionRing.isScalarTower_liftAlgebra R L + have heval (p : MvPolynomial σ R) : + aeval a (map (algebraMap R F) p)=aeval a p := by + simp only [aeval_def,eval₂_map,←IsScalarTower.algebraMap_eq R F L] + have hf' (k : σ) : aeval a (map (algebraMap R F) (f k))=0 := by + rw [heval,hf] + have hJ' : Matrix.det (fun k i=>aeval a + (pderiv i (map (algebraMap R F) (f k))))≠0 := by + simpa only [pderiv_map,heval] using hJ + intro i + exact (IsFractionRing.isAlgebraic_iff R F L).mpr + (isAlgebraic_of_mv_jacobian (fun k=>map (algebraMap R F) (f k)) a hf' hJ' i) + + + +theorem isAlgebraic_of_mv_jacobian_domain [CommRing S] [IsDomain S] + [Algebra R S] [FaithfulSMul R S] + (f : σ → MvPolynomial σ R) (a : σ → S) + (hf : ∀ k,aeval a (f k)=0) + (hJ : Matrix.det (fun k i=>aeval a (pderiv i (f k)))≠0) : + ∀ i,IsAlgebraic R (a i) := by + let L := FractionRing S + let b : σ → L := fun i=>algebraMap S L (a i) + have heval (p : MvPolynomial σ R) : + aeval b p=algebraMap S L (aeval a p) := by + exact (MvPolynomial.comp_aeval_apply a (IsScalarTower.toAlgHom R S L) p).symm + have hb (k : σ) : aeval b (f k)=0 := by rw [heval,hf,map_zero] + have hJb : Matrix.det (fun k i=>aeval b (pderiv i (f k)))≠0 := by + simp only [heval] + have hm := (algebraMap S L).map_det + (show Matrix σ σ S from fun k i=>aeval a (pderiv i (f k))) + intro h + apply hJ + apply IsFractionRing.injective S L + exact hm.trans (h.trans (map_zero _).symm) + intro i + have ha := isAlgebraic_of_mv_jacobian_domain_field f b hb hJb i + exact (isAlgebraic_algebraMap_iff (IsFractionRing.injective S L)).mp ha + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators Matrix +open MvPolynomial +variable {K τ σ : Type*} [Field K] [Fintype σ] [DecidableEq σ] + + + +theorem algebraic_series_of_mv_jacobian + (f : σ → MvPolynomial σ (MvPowerSeries τ K)) + (hcoeff : ∀ k d,IsAlgebraic (MvPolynomial τ K) ((f k).coeff d)) + (a : σ → MvPowerSeries τ K) (hf : ∀ k,eval a (f k)=0) + (hJ : Matrix.det (fun k i=>eval a (pderiv i (f k)))≠0) : + ∀ i,IsAlgebraic (MvPolynomial τ K) (a i) := by + classical + let : IsDomain (MvPowerSeries τ K) := NoZeroDivisors.to_isDomain _ + let A := Subalgebra.algebraicClosure (MvPolynomial τ K) (MvPowerSeries τ K) + have hp (k : σ) : f k∈RingHom.range (map A.val.toRingHom) := by + apply mem_range_map_iff_coeffs_subset.mpr + intro c hc + obtain ⟨d,hd,rfl⟩ := mem_coeffs_iff.mp hc + exact ⟨⟨_,hcoeff k d⟩,rfl⟩ + choose p hmap using hp + have heval (k : σ) : aeval a (p k)=eval a (f k) := by + rw [←hmap k,eval_map] + rfl + have hderiv (k i : σ) : aeval a (pderiv i (p k))=eval a (pderiv i (f k)) := by + rw [←hmap k,pderiv_map,eval_map] + rfl + have hroot (k : σ) : aeval a (p k)=0 := by rw [heval,hf] + have hJ' : Matrix.det (fun k i=>aeval a (pderiv i (p k)))≠0 := by + simpa only [hderiv] using hJ + intro i + exact (isAlgebraic_of_mv_jacobian_domain p a hroot hJ' i).restrictScalars + (MvPolynomial τ K) + + + +theorem algebraic_series_mv_tougeron [Finite τ] + (I : Ideal (MvPowerSeries τ K)) [IsAdicComplete I (MvPowerSeries τ K)] + (f : σ → MvPolynomial σ (MvPowerSeries τ K)) + (hcoeff : ∀ k d,IsAlgebraic (MvPolynomial τ K) ((f k).coeff d)) + (a e : σ → MvPowerSeries τ K) (he : ∀ k,e k∈I) + (hJ : Matrix.det (fun k i=>eval a (pderiv i (f k)))≠0) + (hf : ∀ k,eval a (f k)= + (Matrix.det (fun k i=>eval a (pderiv i (f k))))^2*e k) : + ∃ b : σ → MvPowerSeries τ K,(∀ k,eval b (f k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + ∀ i,∃ v∈I,b i=a i+(Matrix.det (fun k j=>eval a (pderiv j (f k))))*v := by + let : IsDomain (MvPowerSeries τ K) := NoZeroDivisors.to_isDomain _ + obtain ⟨b,hb,hJb,hclose⟩ := mv_tougeron_nondegenerate I f a e he hJ hf + exact ⟨b,hb,algebraic_series_of_mv_jacobian f hcoeff b hb hJb,hclose⟩ + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {R S σ ρ : Type*} [CommRing R] [CommRing S] + + +def freezeRight (a : ρ → R) : MvPolynomial (σ ⊕ ρ) R →+* MvPolynomial σ R := + (map (eval₂Hom (RingHom.id R) a)).comp (sumAlgEquiv R σ ρ).toRingHom + +@[simp] theorem freezeRight_C (a : ρ → R) (r : R) : + freezeRight (σ:=σ) a (C r)=C r := by simp [freezeRight] +@[simp] theorem freezeRight_X_left (a : ρ → R) (i : σ) : + freezeRight a (X (Sum.inl i))=X i := by simp [freezeRight] +@[simp] theorem freezeRight_X_right (a : ρ → R) (i : ρ) : + freezeRight (σ:=σ) a (X (Sum.inr i))=C (a i) := by simp [freezeRight] + +theorem eval_freezeRight (a : ρ → R) (b : σ → R) (p : MvPolynomial (σ ⊕ ρ) R) : + eval b (freezeRight a p)=eval (Sum.elim b a) p := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp only [map_add,hp,hq] + | mul_X p i hp => cases i <;> simp only [map_mul,hp,freezeRight_X_left, + freezeRight_X_right,eval_X,eval_C,Sum.elim_inl,Sum.elim_inr] + +theorem pderiv_freezeRight (a : ρ → R) (i : σ) (p : MvPolynomial (σ ⊕ ρ) R) : + pderiv i (freezeRight a p)=freezeRight a (pderiv (Sum.inl i) p) := by + change pderiv i (map (eval₂Hom (RingHom.id R) a) ((sumAlgEquiv R σ ρ) p))= + map (eval₂Hom (RingHom.id R) a) ((sumAlgEquiv R σ ρ) (pderiv (Sum.inl i) p)) + rw [pderiv_map,pderiv_sumAlgEquiv] + +theorem freezeRight_map (φ : R →+* S) (a : ρ → R) (p : MvPolynomial (σ ⊕ ρ) R) : + freezeRight (fun i=>φ (a i)) (map φ p)=map φ (freezeRight a p) := by + induction p using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp only [map_add,hp,hq] + | mul_X p i hp => cases i <;> simp only [map_mul,map_X,hp,freezeRight_X_left, + freezeRight_X_right,map_C] + + + +theorem freezeRight_algebraic {K τ : Type*} [Field K] + (f : MvPolynomial (σ ⊕ ρ) (MvPowerSeries τ K)) + (hf : ∀ d,IsAlgebraic (MvPolynomial τ K) (f.coeff d)) + (a : ρ → MvPowerSeries τ K) (ha : ∀ i,IsAlgebraic (MvPolynomial τ K) (a i)) : + ∀ d,IsAlgebraic (MvPolynomial τ K) ((freezeRight a f).coeff d) := by + classical + let A := Subalgebra.algebraicClosure (MvPolynomial τ K) (MvPowerSeries τ K) + have hp : f∈Set.range (map A.val.toRingHom) := by + apply mem_range_map_iff_coeffs_subset.mpr + intro c hc + obtain ⟨d,hd,rfl⟩ := mem_coeffs_iff.mp hc + exact ⟨⟨_,hf d⟩,rfl⟩ + obtain ⟨p,hp⟩ := hp + let b : ρ → A := fun i=>⟨a i,ha i⟩ + have heq : freezeRight a f=map A.val.toRingHom (freezeRight b p) := by + rw [←hp] + exact freezeRight_map A.val.toRingHom b p + intro d + rw [heq,coeff_map] + exact ((freezeRight b p).coeff d).property + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators Matrix +open MvPolynomial +variable {K τ σ ρ : Type*} [Field K] [Finite τ] [Fintype σ] [DecidableEq σ] + + + +theorem algebraic_rectangular_tougeron + (I : Ideal (MvPowerSeries τ K)) [IsAdicComplete I (MvPowerSeries τ K)] + (f : σ → MvPolynomial (σ ⊕ ρ) (MvPowerSeries τ K)) + (hcoeff : ∀ k d,IsAlgebraic (MvPolynomial τ K) ((f k).coeff d)) + (a : (σ ⊕ ρ) → MvPowerSeries τ K) + (ha : ∀ i : ρ,IsAlgebraic (MvPolynomial τ K) (a (Sum.inr i))) + (e : σ → MvPowerSeries τ K) (he : ∀ k,e k∈I) + (hJ : Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k)))≠0) + (hf : ∀ k,eval a (f k)= + (Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k))))^2*e k) : + ∃ b : (σ ⊕ ρ) → MvPowerSeries τ K,(∀ k,eval b (f k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + (∀ i : ρ,b (Sum.inr i)=a (Sum.inr i)) ∧ + ∀ i : σ,∃ v∈I,b (Sum.inl i)=a (Sum.inl i)+ + (Matrix.det (fun k j=>eval a (pderiv (Sum.inl j) (f k))))*v := by + let g : σ → MvPolynomial σ (MvPowerSeries τ K) := + fun k=>freezeRight (fun i=>a (Sum.inr i)) (f k) + have haeq : Sum.elim (fun i=>a (Sum.inl i)) (fun i=>a (Sum.inr i))=a := by + funext i; cases i <;> rfl + have hg (k : σ) : eval (fun i=>a (Sum.inl i)) (g k)=eval a (f k) := by + change eval _ (freezeRight _ (f k))=eval a (f k) + rw [eval_freezeRight,haeq] + have hgderiv (k i : σ) : eval (fun j=>a (Sum.inl j)) (pderiv i (g k))= + eval a (pderiv (Sum.inl i) (f k)) := by + change eval _ (pderiv i (freezeRight _ (f k)))=eval a _ + rw [pderiv_freezeRight,eval_freezeRight,haeq] + have hgc (k : σ) : ∀ d,IsAlgebraic (MvPolynomial τ K) ((g k).coeff d) := + freezeRight_algebraic (f k) (hcoeff k) _ ha + have hJg : Matrix.det (fun k i=>eval (fun j=>a (Sum.inl j)) (pderiv i (g k)))≠0 := by + simpa only [hgderiv] using hJ + have hfg (k : σ) : eval (fun j=>a (Sum.inl j)) (g k)= + (Matrix.det (fun k i=>eval (fun j=>a (Sum.inl j)) (pderiv i (g k))))^2*e k := by + simpa only [hg,hgderiv] using hf k + obtain ⟨b,hb,halg,hclose⟩ := algebraic_series_mv_tougeron I g hgc _ e he hJg hfg + refine ⟨Sum.elim b (fun i=>a (Sum.inr i)),?_,?_,fun _=>rfl,?_⟩ + · intro k + exact (eval_freezeRight _ b (f k)).symm.trans (hb k) + · intro i + cases i with + | inl i => exact halg i + | inr i => exact ha i + · intro i + simpa only [hgderiv,Sum.elim_inl] using hclose i + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/JetSolutions.lean b/lean/OAI/Algebra/FiniteTensor/JetSolutions.lean new file mode 100644 index 0000000000000000000000000000000000000000..54a2565156622a482ab69b682ffffb99e6c7d14b --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/JetSolutions.lean @@ -0,0 +1,279 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.AlgebraicDescent +import OAI.Algebra.FiniteTensor.JetSystems + +namespace OAI + +/-! Exact tensor models reconstructed from jet solutions and their algebraicity. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable {K : Type*} [Field K] {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} +variable (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) + + + +structure JetSolution where + left : LeftUnknown ((i : Fin l) × Fin (n i)) m → MvPowerSeries (Fin d) K + right : RightUnknown ((i : Fin l) × Fin (n i)) m → MvPowerSeries (Fin c) K + left_zero : ∀ i,MvPowerSeries.constantCoeff (left i)=0 + right_zero : ∀ i,MvPowerSeries.constantCoeff (right i)=0 + left_jet : ∀ i j,MvPowerSeries.coeff (Finsupp.single j 1) (left i)= + MvPowerSeries.coeff (Finsupp.single j 1) (centerSeries (leftOriginal M W i)) + right_jet : ∀ i j,MvPowerSeries.coeff (Finsupp.single j 1) (right i)= + MvPowerSeries.coeff (Finsupp.single j 1) (centerSeries (rightOriginal M W i)) + left_solve : ∀ j,MvPowerSeries.subst left (universalLeftEquation M W j)=0 + right_solve : ∀ j,MvPowerSeries.subst right (universalRightEquation M W j)=0 + +def originalJetSolution : JetSolution M W where + left := fun i=>centerSeries (leftOriginal M W i) + right := fun i=>centerSeries (rightOriginal M W i) + left_zero := fun _=>centerSeries_zero _ + right_zero := fun _=>centerSeries_zero _ + left_jet := fun _ _=>rfl + right_jet := fun _ _=>rfl + left_solve := original_solves_left M W + right_solve := original_solves_right M W + +variable {M W} +variable (s : JetSolution M W) + +def JetSolution.H (v : (i : Fin l) × Fin (n i)) : MvPowerSeries (Fin d) (Parameters K m) := + MvPowerSeries.subst (fun i=>MvPowerSeries.map (algebraMap K (Parameters K m)) (s.left i)) + (universalLeftH M v) + +def JetSolution.G (v : (i : Fin l) × Fin (n i)) : MvPowerSeries (Fin c) K := + MvPowerSeries.subst s.right (universalRightG M v) + +def JetSolution.L (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries (Fin d) (Parameters K m) := + MvPowerSeries.subst (fun i=>MvPowerSeries.map (algebraMap K (Parameters K m)) (s.left i)) + (universalLeftP M W t v) + +def JetSolution.R (t : Triple m) (v : (i : Fin l) × Fin (n i)) : MvPowerSeries (Fin c) K := + MvPowerSeries.subst s.right (universalRightP M W t v) + +theorem JetSolution.left_hasSubst : MvPowerSeries.HasSubst s.left := + MvPowerSeries.hasSubst_of_constantCoeff_zero s.left_zero + +theorem JetSolution.right_hasSubst : MvPowerSeries.HasSubst s.right := + MvPowerSeries.hasSubst_of_constantCoeff_zero s.right_zero + +theorem JetSolution.H_box (v : (i : Fin l) × Fin (n i)) (q : Box m) : + boxSeries K m q (s.H v)=s.left (.inl (v,q))+ + MvPowerSeries.C (MvPowerSeries.constantCoeff (boxSeries K m q (M.H v))) := by + rw [JetSolution.H,universalLeftH,subst_assembleBox _ s.left_hasSubst, + boxSeries_assembleBox,subst_affineUnknown _ s.left_hasSubst] + +theorem JetSolution.L_box (t : Triple m) (v : (i : Fin l) × Fin (n i)) (q : Box m) : + boxSeries K m q (s.L t v)=s.left (.inr (t,v,q))+ + MvPowerSeries.C (MvPowerSeries.constantCoeff (boxSeries K m q (W.left t v))) := by + rw [JetSolution.L,universalLeftP,subst_assembleBox _ s.left_hasSubst, + boxSeries_assembleBox,subst_affineUnknown _ s.left_hasSubst] + +theorem JetSolution.G_eq (v : (i : Fin l) × Fin (n i)) : + s.G v=s.right (.inl v)+MvPowerSeries.C (MvPowerSeries.constantCoeff (M.G v)) := by + rw [JetSolution.G,universalRightG,subst_affineUnknown _ s.right_hasSubst] + +theorem JetSolution.R_eq (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + s.R t v=s.right (.inr (t,v))+MvPowerSeries.C (MvPowerSeries.constantCoeff (W.right t v)) := by + rw [JetSolution.R,universalRightP,subst_affineUnknown _ s.right_hasSubst] + +theorem JetSolution.H_constant (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.constantCoeff (s.H v)=MvPowerSeries.constantCoeff (M.H v) := by + apply parameters_ext K m + intro q + change MvPowerSeries.constantCoeff (boxSeries K m q (s.H v))=_ + rw [s.H_box,map_add,s.left_zero,zero_add,MvPowerSeries.constantCoeff_C] + rfl + +theorem JetSolution.H_first (v : (i : Fin l) × Fin (n i)) (j : Fin d) : + MvPowerSeries.coeff (Finsupp.single j 1) (s.H v)= + MvPowerSeries.coeff (Finsupp.single j 1) (M.H v) := by + apply parameters_ext K m + intro q + have hj : Finsupp.single j 1 ≠ (0 : Fin d →₀ ℕ) := by simp + change MvPowerSeries.coeff (Finsupp.single j 1) (boxSeries K m q (s.H v))=_ + rw [s.H_box,map_add,MvPowerSeries.coeff_C_of_ne_zero hj,add_zero,s.left_jet] + simp only [centerSeries,leftOriginal,Sum.elim_inl,map_sub, + MvPowerSeries.coeff_C_of_ne_zero hj,sub_zero,coeff_boxSeries] + +theorem JetSolution.G_constant (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.constantCoeff (s.G v)=0 := by + rw [s.G_eq,map_add,s.right_zero,MvPowerSeries.constantCoeff_C,M.G_zero,add_zero] + +theorem JetSolution.G_first (v : (i : Fin l) × Fin (n i)) (j : Fin c) : + MvPowerSeries.coeff (Finsupp.single j 1) (s.G v)= + MvPowerSeries.coeff (Finsupp.single j 1) (M.G v) := by + have hj : Finsupp.single j 1 ≠ (0 : Fin c →₀ ℕ) := by simp + rw [s.G_eq,map_add,MvPowerSeries.coeff_C_of_ne_zero hj,add_zero,s.right_jet] + simp only [centerSeries,rightOriginal,Sum.elim_inl,map_sub, + MvPowerSeries.coeff_C_of_ne_zero hj,sub_zero] + +theorem JetSolution.comp_left (f : MvPowerSeries ((i : Fin l) × Fin (n i)) (Parameters K m)) : + MvPowerSeries.subst (fun i=>MvPowerSeries.map (algebraMap K (Parameters K m)) (s.left i)) + (MvPowerSeries.subst (universalLeftH M) f)=MvPowerSeries.subst s.H f := by + rw [MvPowerSeries.subst_comp_subst_apply (hasSubst_universalLeftH M) + (s.left_hasSubst.map (algebraMap K (Parameters K m)))] + rfl + +theorem JetSolution.comp_right (f : MvPowerSeries ((i : Fin l) × Fin (n i)) K) : + MvPowerSeries.subst s.right (MvPowerSeries.subst (universalRightG M) f)= + MvPowerSeries.subst s.G f := by + rw [MvPowerSeries.subst_comp_subst_apply (hasSubst_universalRightG M) s.right_hasSubst] + rfl + +theorem JetSolution.left_vanishing : + MvPowerSeries.subst s.H (deformed K (fun i=>Fin (n i)) m M.F active M.b)=0 := by + apply boxSeries_ext (A:=K) (m:=m) + intro q + have h := s.left_solve (.inl q) + change MvPowerSeries.subst s.left (boxSeries K m q _)=0 at h + rw [←boxSeries_subst _ s.left_hasSubst,s.comp_left] at h + simpa only [boxSeries_zero] using h + +theorem JetSolution.right_vanishing : + MvPowerSeries.subst s.G (potential K (fun i=>Fin (n i)) M.F)=0 := by + have h := s.right_solve (.inl ()) + change MvPowerSeries.subst s.right (MvPowerSeries.subst (universalRightG M) _)=0 at h + rwa [s.comp_right] at h + +theorem JetSolution.left_identity (t : Triple m) : + (∑ v,s.L t v*MvPowerSeries.subst s.H + (MvPowerSeries.pderiv v (deformed K (fun i=>Fin (n i)) m M.F active M.b)))= + MvPowerSeries.C (parameter K m t.val.1*parameter K m t.val.2.1*parameter K m t.val.2.2) := by + apply sub_eq_zero.mp + apply boxSeries_ext (A:=K) (m:=m) + intro q + have h := s.left_solve (.inr (t,q)) + change MvPowerSeries.subst s.left (boxSeries K m q ((∑ v,_) - _))=0 at h + have ha := s.left_hasSubst.map (algebraMap K (Parameters K m)) + rw [←boxSeries_subst _ s.left_hasSubst,MvPowerSeries.subst_sub ha, + ←MvPowerSeries.substAlgHom_apply ha,map_sum] at h + simp only [map_mul,MvPowerSeries.substAlgHom_apply,s.comp_left, + MvPowerSeries.subst_mul ha,MvPowerSeries.subst_C] at h + simpa only [map_mul,boxSeries_zero,JetSolution.L] using h + +theorem JetSolution.right_identity (t : Triple m) : + (∑ v,s.R t v*MvPowerSeries.subst s.G + (MvPowerSeries.pderiv v (potential K (fun i=>Fin (n i)) M.F)))= + MvPowerSeries.subst s.G (perturbation K (fun i=>Fin (n i)) m active M.b t.val.1* + perturbation K (fun i=>Fin (n i)) m active M.b t.val.2.1* + perturbation K (fun i=>Fin (n i)) m active M.b t.val.2.2) := by + apply sub_eq_zero.mp + have h := s.right_solve (.inr t) + change MvPowerSeries.subst s.right ((∑ v,_) - _)=0 at h + rw [MvPowerSeries.subst_sub s.right_hasSubst, + ←MvPowerSeries.substAlgHom_apply s.right_hasSubst,map_sum] at h + simpa only [map_mul,MvPowerSeries.substAlgHom_apply,s.comp_right,JetSolution.R] using h + + + +def JetSolution.model : TensorModel K (fun i=>Fin (n i)) m d c e active where + F := M.F + b := M.b + F_zero := M.F_zero + b_zero := M.b_zero + H := s.H + G := s.G + H_zero := fun v=>by rw [s.H_constant]; exact M.H_zero v + G_zero := s.G_constant + tangent_unit := by + have heq : tangent K (fun i=>Fin (n i)) m e s.H s.G= + tangent K (fun i=>Fin (n i)) m e M.H M.G := by + ext i j + simp only [tangent,s.H_first,s.G_first] + rw [heq] + exact M.tangent_unit + left_vanishing := s.left_vanishing + right_vanishing := s.right_vanishing + left_triple := fun i j k hij hik hjk=> + Ideal.mem_span_range_iff_exists_fun.mpr ⟨s.L ⟨(i,j,k),hij,hik,hjk⟩, + s.left_identity ⟨(i,j,k),hij,hik,hjk⟩⟩ + right_triple := fun i j k hij hik hjk=> + Ideal.mem_span_range_iff_exists_fun.mpr ⟨s.R ⟨(i,j,k),hij,hik,hjk⟩, + s.right_identity ⟨(i,j,k),hij,hik,hjk⟩⟩ + +def JetSolution.primitives : TensorPrimitives K (fun i=>Fin (n i)) m s.model where + left := s.L + right := s.R + left_eq := s.left_identity + right_eq := s.right_identity + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {K : Type*} [Field K] {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} +variable {M : TensorModel K (fun i=>Fin (n i)) m d c e active} + {W : TensorPrimitives K (fun i=>Fin (n i)) m M} + + + +structure JetSolution.Algebraic (s : JetSolution M W) : Prop where + left : ∀ i,IsAlgebraic (MvPolynomial (Fin d) K) (s.left i) + right : ∀ i,IsAlgebraic (MvPolynomial (Fin c) K) (s.right i) + + theorem constant_series_algebraic {σ : Type*} (a : K) : + IsAlgebraic (MvPolynomial σ K) (MvPowerSeries.C (σ:=σ) a) := by + simpa only [MvPowerSeries.algebraMap_apply',MvPowerSeries.map_id, + Algebra.algebraMap_self,RingHom.id_apply,MvPolynomial.coe_C] using + (isAlgebraic_algebraMap (R:=MvPolynomial σ K) (A:=MvPowerSeries σ K) (MvPolynomial.C a)) + + theorem JetSolution.algebraicData (s : JetSolution M W) (hs : s.Algebraic) + (hF : ∀ i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (hb : ∀ i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) : + AlgebraicData s.model s.primitives where + F := hF + b := hb + H := fun v q=>by + change IsAlgebraic _ (boxSeries K m q (s.H v)) + rw [s.H_box] + exact (hs.left _).add (constant_series_algebraic _) + G := fun v=>by + change IsAlgebraic _ (s.G v) + rw [s.G_eq] + exact (hs.right _).add (constant_series_algebraic _) + left := fun t v q=>by + change IsAlgebraic _ (boxSeries K m q (s.L t v)) + rw [s.L_box] + exact (hs.left _).add (constant_series_algebraic _) + right := fun t v=>by + change IsAlgebraic _ (s.R t v) + rw [s.R_eq] + exact (hs.right _).add (constant_series_algebraic _) + + + +variable [CharZero K] + +theorem no_algebraic_jet_solution (hm : 5 ≤ m) + (hF : ∀ i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (hb : ∀ i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) + (s : JetSolution M W) : ¬s.Algebraic := fun hs=> + no_algebraic_tensor_model hm s.model s.primitives (s.algebraicData hs hF hb) + + + +def TensorAlgebraicApproximation : Prop := + ∀ {K : Type} [Field K] [CharZero K] {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} + (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M), + (∀ i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) → + (∀ i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) → + ∃ s : JetSolution M W,s.Algebraic + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/JetSystems.lean b/lean/OAI/Algebra/FiniteTensor/JetSystems.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f3d4f8fa845e61b090349cd97f1efcdd3046a69 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/JetSystems.lean @@ -0,0 +1,265 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.BoxCoefficients + +namespace OAI + +/-! Scalar finite equations reconstructing every squarefree component and primitive. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable {A σ τ : Type*} [CommRing A] {m : ℕ} + + +def assembleBox (f : Box m → MvPowerSeries σ A) : MvPowerSeries σ (Parameters A m) := + ∑ q, MvPowerSeries.C (boxMonomial A m q) * + MvPowerSeries.map (algebraMap A (Parameters A m)) (f q) + +@[simp] theorem assembleBox_boxSeries (f : MvPowerSeries σ (Parameters A m)) : + assembleBox (boxSeries A m · f)=f := sum_boxSeries A m f + + theorem boxCoeff_mul_algebraMap (q : Box m) (x : Parameters A m) (a : A) : + boxCoeff A m q (x*algebraMap A (Parameters A m) a)=boxCoeff A m q x*a := by + rw [mul_comm,←Algebra.smul_def,map_smul,smul_eq_mul,mul_comm] + +@[simp] theorem boxSeries_assembleBox (q : Box m) (f : Box m → MvPowerSeries σ A) : + boxSeries A m q (assembleBox f)=f q := by + classical + ext d + simp only [coeff_boxSeries,assembleBox,map_sum,MvPowerSeries.coeff_C_mul, + MvPowerSeries.coeff_map,boxCoeff_mul_algebraMap,boxCoeff_boxMonomial, + ite_mul,one_mul,zero_mul] + simp + + theorem boxSeries_ext (f g : MvPowerSeries σ (Parameters A m)) + (h : ∀ q,boxSeries A m q f=boxSeries A m q g) : f=g := by + rw [←assembleBox_boxSeries f,←assembleBox_boxSeries g] + congr 1 + funext q + exact h q + +@[simp] theorem boxSeries_zero (q : Box m) : + boxSeries A m q (0 : MvPowerSeries σ (Parameters A m))=0 := by + ext d + simp only [coeff_boxSeries,map_zero] + +@[simp] theorem boxSeries_add (q : Box m) (f g : MvPowerSeries σ (Parameters A m)) : + boxSeries A m q (f+g)=boxSeries A m q f+boxSeries A m q g := by + ext d + simp only [coeff_boxSeries,map_add] + +@[simp] theorem boxSeries_sub (q : Box m) (f g : MvPowerSeries σ (Parameters A m)) : + boxSeries A m q (f-g)=boxSeries A m q f-boxSeries A m q g := by + ext d + simp only [coeff_boxSeries,map_sub] + + theorem subst_assembleBox (a : σ → MvPowerSeries τ A) (ha : MvPowerSeries.HasSubst a) + (f : Box m → MvPowerSeries σ A) : + MvPowerSeries.subst (fun i=>MvPowerSeries.map (algebraMap A (Parameters A m)) (a i)) + (assembleBox f) = assembleBox (fun q=>MvPowerSeries.subst a (f q)) := by + let hm := ha.map (algebraMap A (Parameters A m)) + rw [assembleBox,←MvPowerSeries.substAlgHom_apply hm,map_sum] + apply Finset.sum_congr rfl + intro q _ + rw [map_mul,MvPowerSeries.substAlgHom_apply,MvPowerSeries.subst_C, + MvPowerSeries.substAlgHom_apply,←MvPowerSeries.map_subst ha] + + + +theorem boxSeries_subst (a : σ → MvPowerSeries τ A) (ha : MvPowerSeries.HasSubst a) + (q : Box m) (f : MvPowerSeries σ (Parameters A m)) : + boxSeries A m q (MvPowerSeries.subst + (fun i=>MvPowerSeries.map (algebraMap A (Parameters A m)) (a i)) f)= + MvPowerSeries.subst a (boxSeries A m q f) := by + conv_lhs => rw [←assembleBox_boxSeries f,subst_assembleBox a ha,boxSeries_assembleBox] + + + +def centerSeries (f : MvPowerSeries σ A) : MvPowerSeries σ A := + f-MvPowerSeries.C (MvPowerSeries.constantCoeff f) + +@[simp] theorem centerSeries_zero (f : MvPowerSeries σ A) : + MvPowerSeries.constantCoeff (centerSeries f)=0 := by + simp [centerSeries] + + theorem centerFamily_hasSubst [Finite σ] (f : σ → MvPowerSeries τ A) : + MvPowerSeries.HasSubst (fun i=>centerSeries (f i)) := + MvPowerSeries.hasSubst_of_constantCoeff_zero (fun _=>centerSeries_zero _) + + def affineUnknown (i : σ) (c : A) : MvPowerSeries σ A := + MvPowerSeries.X i+MvPowerSeries.C c + + theorem subst_affineUnknown (a : σ → MvPowerSeries τ A) (ha : MvPowerSeries.HasSubst a) + (i : σ) (c : A) : + MvPowerSeries.subst a (affineUnknown i c)=a i+MvPowerSeries.C c := by + simp only [affineUnknown,MvPowerSeries.subst_add ha,MvPowerSeries.subst_X ha, + MvPowerSeries.subst_C] + + theorem subst_center_affine [Finite σ] (f : σ → MvPowerSeries τ A) (i : σ) : + MvPowerSeries.subst (fun j=>centerSeries (f j)) + (affineUnknown i (MvPowerSeries.constantCoeff (f i)))=f i := by + rw [subst_affineUnknown _ (centerFamily_hasSubst f)] + simp only [centerSeries,sub_add_cancel] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable {K : Type*} [Field K] {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} + +abbrev LeftUnknown (V : Type*) (m : ℕ) := (V × Box m) ⊕ (Triple m × V × Box m) +abbrev RightUnknown (V : Type*) (m : ℕ) := V ⊕ (Triple m × V) +abbrev LeftEquation (m : ℕ) := Box m ⊕ (Triple m × Box m) +abbrev RightEquation (m : ℕ) := Unit ⊕ Triple m + +variable (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) + + + +def leftOriginal : LeftUnknown ((i : Fin l) × Fin (n i)) m → MvPowerSeries (Fin d) K := + Sum.elim (fun vq=>boxSeries K m vq.2 (M.H vq.1)) + (fun tvq=>boxSeries K m tvq.2.2 (W.left tvq.1 tvq.2.1)) + +def rightOriginal : RightUnknown ((i : Fin l) × Fin (n i)) m → MvPowerSeries (Fin c) K := + Sum.elim M.G (fun tv=>W.right tv.1 tv.2) + +def universalLeftH (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries (LeftUnknown ((i : Fin l) × Fin (n i)) m) (Parameters K m) := + assembleBox (fun q=>affineUnknown (.inl (v,q)) + (MvPowerSeries.constantCoeff (boxSeries K m q (M.H v)))) + +def universalLeftP (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries (LeftUnknown ((i : Fin l) × Fin (n i)) m) (Parameters K m) := + assembleBox (fun q=>affineUnknown (.inr (t,v,q)) + (MvPowerSeries.constantCoeff (boxSeries K m q (W.left t v)))) + +def universalRightG (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries (RightUnknown ((i : Fin l) × Fin (n i)) m) K := + affineUnknown (.inl v) (MvPowerSeries.constantCoeff (M.G v)) + +def universalRightP (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries (RightUnknown ((i : Fin l) × Fin (n i)) m) K := + affineUnknown (.inr (t,v)) (MvPowerSeries.constantCoeff (W.right t v)) + + theorem constantCoeff_universalLeftH (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.constantCoeff (universalLeftH M v)=MvPowerSeries.constantCoeff (M.H v) := by + calc + _ = MvPowerSeries.constantCoeff (assembleBox (fun q=>boxSeries K m q (M.H v))) := by + simp only [universalLeftH,assembleBox,map_sum,map_mul,MvPowerSeries.constantCoeff_C, + MvPowerSeries.constantCoeff_map,affineUnknown,map_add,MvPowerSeries.constantCoeff_X,map_zero, + zero_add] + _ = _ := by rw [assembleBox_boxSeries] + + theorem hasSubst_universalLeftH : MvPowerSeries.HasSubst (universalLeftH M) := by + apply hasSubst_parameters K m + intro v + rw [constantCoeff_universalLeftH] + exact M.H_zero v + + theorem hasSubst_universalRightG : MvPowerSeries.HasSubst (universalRightG M) := by + apply MvPowerSeries.hasSubst_of_constantCoeff_zero + intro v + simp only [universalRightG,affineUnknown,map_add,MvPowerSeries.constantCoeff_X, + MvPowerSeries.constantCoeff_C,zero_add,M.G_zero] + + + +def universalLeftEquation : LeftEquation m → + MvPowerSeries (LeftUnknown ((i : Fin l) × Fin (n i)) m) K := + Sum.elim (fun q=>boxSeries K m q (MvPowerSeries.subst (universalLeftH M) + (deformed K (fun i=>Fin (n i)) m M.F active M.b))) + (fun tq=>boxSeries K m tq.2 ((∑ v,universalLeftP M W tq.1 v * + MvPowerSeries.subst (universalLeftH M) (MvPowerSeries.pderiv v + (deformed K (fun i=>Fin (n i)) m M.F active M.b))) - + MvPowerSeries.C (parameter K m tq.1.val.1 * parameter K m tq.1.val.2.1 * + parameter K m tq.1.val.2.2))) + +def universalRightEquation : RightEquation m → + MvPowerSeries (RightUnknown ((i : Fin l) × Fin (n i)) m) K := + Sum.elim (fun _=>MvPowerSeries.subst (universalRightG M) (potential K (fun i=>Fin (n i)) M.F)) + (fun t=>(∑ v,universalRightP M W t v * MvPowerSeries.subst (universalRightG M) + (MvPowerSeries.pderiv v (potential K (fun i=>Fin (n i)) M.F))) - + MvPowerSeries.subst (universalRightG M) + (perturbation K (fun i=>Fin (n i)) m active M.b t.val.1 * + perturbation K (fun i=>Fin (n i)) m active M.b t.val.2.1 * + perturbation K (fun i=>Fin (n i)) m active M.b t.val.2.2)) + + theorem eval_universalLeftH (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.subst (fun i=>MvPowerSeries.map (algebraMap K (Parameters K m)) + (centerSeries (leftOriginal M W i))) (universalLeftH M v)=M.H v := by + rw [universalLeftH,subst_assembleBox _ (centerFamily_hasSubst _)] + convert assembleBox_boxSeries (M.H v) using 1 + congr 1 + funext q + exact subst_center_affine (leftOriginal M W) (.inl (v,q)) + + theorem eval_universalLeftP (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.subst (fun i=>MvPowerSeries.map (algebraMap K (Parameters K m)) + (centerSeries (leftOriginal M W i))) (universalLeftP M W t v)=W.left t v := by + rw [universalLeftP,subst_assembleBox _ (centerFamily_hasSubst _)] + convert assembleBox_boxSeries (W.left t v) using 1 + congr 1 + funext q + exact subst_center_affine (leftOriginal M W) (.inr (t,v,q)) + + theorem eval_universalRightG (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.subst (fun i=>centerSeries (rightOriginal M W i)) + (universalRightG M v)=M.G v := + subst_center_affine (rightOriginal M W) (.inl v) + + theorem eval_universalRightP (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.subst (fun i=>centerSeries (rightOriginal M W i)) + (universalRightP M W t v)=W.right t v := + subst_center_affine (rightOriginal M W) (.inr (t,v)) + + theorem original_solves_left (j : LeftEquation m) : + MvPowerSeries.subst (fun i=>centerSeries (leftOriginal M W i)) + (universalLeftEquation M W j)=0 := by + let a := fun i=>centerSeries (leftOriginal M W i) + have ha := centerFamily_hasSubst (leftOriginal M W) + have hma := ha.map (algebraMap K (Parameters K m)) + have hcomp (f : MvPowerSeries ((i : Fin l) × Fin (n i)) (Parameters K m)) : + MvPowerSeries.subst (fun i=>MvPowerSeries.map (algebraMap K (Parameters K m)) (a i)) + (MvPowerSeries.subst (universalLeftH M) f)=MvPowerSeries.subst M.H f := by + rw [MvPowerSeries.subst_comp_subst_apply (hasSubst_universalLeftH M) hma] + simp only [eval_universalLeftH] + rcases j with q|tq + · change MvPowerSeries.subst a (boxSeries K m q _)=0 + rw [←boxSeries_subst a ha,hcomp,M.left_vanishing,boxSeries_zero] + · change MvPowerSeries.subst a (boxSeries K m tq.2 _)=0 + rw [←boxSeries_subst a ha,MvPowerSeries.subst_sub hma, + ←MvPowerSeries.substAlgHom_apply hma,map_sum] + simp only [map_mul,MvPowerSeries.substAlgHom_apply,eval_universalLeftP] + dsimp only [a] at hcomp + simp only [hcomp,MvPowerSeries.subst_mul hma,MvPowerSeries.subst_C,W.left_eq,map_mul,sub_self,boxSeries_zero] + + theorem original_solves_right (j : RightEquation m) : + MvPowerSeries.subst (fun i=>centerSeries (rightOriginal M W i)) + (universalRightEquation M W j)=0 := by + let a := fun i=>centerSeries (rightOriginal M W i) + have ha := centerFamily_hasSubst (rightOriginal M W) + have hcomp (f : MvPowerSeries ((i : Fin l) × Fin (n i)) K) : + MvPowerSeries.subst a (MvPowerSeries.subst (universalRightG M) f)= + MvPowerSeries.subst M.G f := by + rw [MvPowerSeries.subst_comp_subst_apply (hasSubst_universalRightG M) ha] + simp only [eval_universalRightG] + rcases j with u|t + · exact (hcomp _).trans M.right_vanishing + · change MvPowerSeries.subst a ((∑ v,_) - _)=0 + rw [MvPowerSeries.subst_sub ha,←MvPowerSeries.substAlgHom_apply ha,map_sum] + simp only [map_mul,MvPowerSeries.substAlgHom_apply,eval_universalRightP] + dsimp only [a] at hcomp + simp only [hcomp,W.right_eq,sub_self] + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/JetTopology.lean b/lean/OAI/Algebra/FiniteTensor/JetTopology.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ba4ed6b3f2fb0f07ff28767dea6abb7cefbb51d --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/JetTopology.lean @@ -0,0 +1,324 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.WeierstrassConstraints + +namespace OAI + +/-! Jet ideals, completion and finite polynomial approximation statements. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ : Type*} [CommRing K] [Finite σ] + +abbrev jetIdeal : Ideal (MvPowerSeries σ K) := Ideal.span (Set.range MvPowerSeries.X) + + theorem map_jetIdeal_completion : + Ideal.map (toAdicCompletionAlgEquiv σ K).toRingEquiv (jetIdeal (K:=K) (σ:=σ)) = + (MvPolynomial.idealOfVars σ K).map + (algebraMap (MvPolynomial σ K) + (AdicCompletion (MvPolynomial.idealOfVars σ K) (MvPolynomial σ K))) := by + simp_rw [jetIdeal,MvPolynomial.idealOfVars,Ideal.map_span,←Set.range_comp] + congr 2 + ext i + simp [AdicCompletion.algebraMap_apply,←MvPolynomial.coe_X,toAdicCompletion_coe] + + theorem jetIdeal_power_completion (n : ℕ) : + ((jetIdeal (K:=K) (σ:=σ))^n).map (toAdicCompletionAlgEquiv σ K).toRingEquiv = + ((MvPolynomial.idealOfVars σ K)^n).map + (algebraMap (MvPolynomial σ K) + (AdicCompletion (MvPolynomial.idealOfVars σ K) (MvPolynomial σ K))) := by + rw [Ideal.map_pow,map_jetIdeal_completion,Ideal.map_pow] + + theorem mem_completion_power_iff (f : MvPowerSeries σ K) (n : ℕ) : + toAdicCompletion σ K f∈((MvPolynomial.idealOfVars σ K)^n).map + (algebraMap (MvPolynomial σ K) + (AdicCompletion (MvPolynomial.idealOfVars σ K) (MvPolynomial σ K))) ↔ + ∀ d,Finsupp.degree dimp_congr_right fun hd=>by rw [coeff_truncTotal _ hd] + + theorem mem_jetIdeal_pow_iff_coeff (f : MvPowerSeries σ K) (n : ℕ) : + f∈(jetIdeal (K:=K) (σ:=σ))^n ↔ ∀ d,Finsupp.degree d simp [MvPowerSeries.algebraMap_apply',PowerSeries.algebraMap_apply'] + + theorem option_series_polynomial_square_symm : + (MvPowerSeries.optionEquivLeft τ K).symm.toRingHom.comp + (algebraMap (Polynomial (MvPolynomial τ K)) (PowerSeries (MvPowerSeries τ K)))= + (algebraMap (MvPolynomial (Option τ) K) (MvPowerSeries (Option τ) K)).comp + (MvPolynomial.optionEquivLeft K τ).symm.toRingHom := by + apply RingHom.ext + intro p + apply (MvPowerSeries.optionEquivLeft τ K).injective + have h := RingHom.congr_fun (option_series_polynomial_square (K:=K) (τ:=τ)) + ((MvPolynomial.optionEquivLeft K τ).symm p) + change (MvPowerSeries.optionEquivLeft τ K) + ((MvPowerSeries.optionEquivLeft τ K).symm ((algebraMap _ _) p))=_ + rw [AlgEquiv.apply_symm_apply] + change (MvPowerSeries.optionEquivLeft τ K) + ((algebraMap _ _) ((MvPolynomial.optionEquivLeft K τ).symm p))= + (algebraMap _ _) ((MvPolynomial.optionEquivLeft K τ) + ((MvPolynomial.optionEquivLeft K τ).symm p)) at h + change (algebraMap (Polynomial (MvPolynomial τ K)) (PowerSeries (MvPowerSeries τ K))) p= + (MvPowerSeries.optionEquivLeft τ K) ((algebraMap (MvPolynomial (Option τ) K) + (MvPowerSeries (Option τ) K)) ((MvPolynomial.optionEquivLeft K τ).symm p)) + rw [AlgEquiv.apply_symm_apply] at h + exact h.symm + + theorem algebraic_option_series_symm [IsDomain K] + {f : PowerSeries (MvPowerSeries τ K)} + (hf : IsAlgebraic (Polynomial (MvPolynomial τ K)) f) : + IsAlgebraic (MvPolynomial (Option τ) K) ((MvPowerSeries.optionEquivLeft τ K).symm f) := by + exact hf.ringHom_of_comp_eq (MvPolynomial.optionEquivLeft K τ).symm.toRingHom + (MvPowerSeries.optionEquivLeft τ K).symm.toRingHom + (MvPolynomial.optionEquivLeft K τ).symm.injective option_series_polynomial_square_symm.symm + + theorem algebraic_option_series [IsDomain K] + {f : MvPowerSeries (Option τ) K} + (hf : IsAlgebraic (MvPolynomial (Option τ) K) f) : + IsAlgebraic (Polynomial (MvPolynomial τ K)) (MvPowerSeries.optionEquivLeft τ K f) := by + exact hf.ringHom_of_comp_eq (MvPolynomial.optionEquivLeft K τ).toRingHom + (MvPowerSeries.optionEquivLeft τ K).toRingHom + (MvPolynomial.optionEquivLeft K τ).injective option_series_polynomial_square.symm + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open Polynomial PowerSeries MvPolynomial +variable {A σ κ : Type*} [CommRing A] [IsDomain A] + + + +theorem finite_weierstrass_unit_constraints + (I : Ideal A) [IsAdicComplete I A] + (h : Polynomial A) (hh : h.IsDistinguishedAt I) + (hjac : (h : PowerSeries A)∈Ideal.jacobson (⊥ : Ideal (PowerSeries A))) + (a : σ → PowerSeries A) (f : κ → MvPolynomial σ (Polynomial A)) + (hf : ∀ k,eval₂ Polynomial.coeToPowerSeries.ringHom a (f k)=0) + (D : MvPolynomial σ (Polynomial A)) (u : PowerSeries A) + (hu : IsUnit u) (hD : eval₂ Polynomial.coeToPowerSeries.ringHom a D=(h : PowerSeries A)*u) : + ∃ (r : σ → Polynomial A) (q : σ → PowerSeries A) + (k : κ → Polynomial A) (w : Polynomial A), + (∀ i,a i=(r i : PowerSeries A)+(h : PowerSeries A)^2*q i) ∧ + (∀ j,eval r (f j)=h^2*k j) ∧ eval r D=h*w ∧ IsUnit (w : PowerSeries A) := by + obtain ⟨r,hrdeg,hr,hfrem,hDrem⟩ := finite_weierstrass_constraints I h hh a f hf D ⟨u,hD⟩ + have hr' (i : σ) : (h : PowerSeries A)^2∣a i-(r i : PowerSeries A) := by + simpa only [pow_two,Polynomial.coe_mul] using hr i + choose q hq using hr' + have hfrem' (j : κ) : h^2∣eval r (f j) := by simpa only [pow_two] using hfrem j + choose k hk using hfrem' + obtain ⟨w,hw⟩ := hDrem + refine ⟨r,q,k,w,fun i=>?_,hk,hw,?_⟩ + · linear_combination hq i + · have hcon := eval₂_dvd_sub ((h*h : Polynomial A) : PowerSeries A) D a + (fun i=>(r i : PowerSeries A)) hr + have hmap := MvPolynomial.map_eval Polynomial.coeToPowerSeries.ringHom r D + rw [MvPolynomial.eval_map] at hmap + change ((eval r D : Polynomial A) : PowerSeries A) = + eval₂ Polynomial.coeToPowerSeries.ringHom (fun i=>(r i : PowerSeries A)) D at hmap + rw [←hmap,hD,hw,Polynomial.coe_mul] at hcon + obtain ⟨z,hz⟩ := hcon + simp only [Polynomial.coe_mul] at hz + have hn : (h : PowerSeries A)≠0 := by exact_mod_cast hh.monic.ne_zero + have he : u-(w : PowerSeries A)=(h : PowerSeries A)*z := by + apply mul_left_cancel₀ hn + rw [mul_sub] + linear_combination hz + have hw' : (w : PowerSeries A)=u+(-(h : PowerSeries A)*z) := by linear_combination -he + rw [hw'] + have hneg : -(h : PowerSeries A)∈Ideal.jacobson (⊥ : Ideal (PowerSeries A)) := + (Ideal.jacobson (⊥ : Ideal (PowerSeries A))).neg_mem hjac + exact unit_add_jacobson hu ((Ideal.jacobson (⊥ : Ideal (PowerSeries A))).mul_mem_right _ hneg) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {K τ : Type*} [Field K] [Finite τ] + + theorem jetIdeal_eq_maximalIdeal : + jetIdeal (K:=K) (σ:=τ)=IsLocalRing.maximalIdeal (MvPowerSeries τ K) := by + ext f + rw [IsLocalRing.mem_maximalIdeal,mem_nonunits_iff,MvPowerSeries.isUnit_iff_constantCoeff,isUnit_iff_ne_zero,not_not] + rw [←pow_one (jetIdeal (K:=K) (σ:=τ)),mem_jetIdeal_pow_iff_coeff] + constructor + · intro h + exact h 0 (by simp) + · intro h d hd + have hz : Finsupp.degree d=0 := by omega + have hd0 : d=0 := (Finsupp.degree_eq_zero_iff d).mp hz + simpa only [hd0,MvPowerSeries.coeff_zero_eq_constantCoeff] using h + + theorem jetIdeal_pow_le_jacobson (n : ℕ) (hn : 0rename e (f (d.symm k)) + let a' := fun i=>a (e.symm i) + have hr (v : σ → MvPowerSeries τ K) (p : MvPolynomial σ (MvPolynomial τ K)) : + MvPolynomial.aeval (fun i=>v (e.symm i)) (rename e p)=MvPolynomial.aeval v p := by + rw [MvPolynomial.aeval_def,eval₂_rename] + simp only [Function.comp_def,Equiv.symm_apply_apply] + rfl + have hf' (k : Fin (Fintype.card κ)) : MvPolynomial.aeval a' (f' k)=0 := by + change MvPolynomial.aeval (fun i=>a (e.symm i)) (rename e (f (d.symm k)))=0 + rw [hr,ha] + obtain ⟨b,hb,halg,hclose⟩ := h _ _ f' a' hf' n + refine ⟨fun i=>b (e i),?_,fun i=>halg (e i),?_⟩ + · intro k + have hv : (fun i=>b (e (e.symm i)))=b := by funext i; simp + have he := hr (fun i=>b (e i)) (f k) + rw [hv] at he + rw [←he] + have hd : f' (d k)=rename e (f k) := by simp [f'] + rw [←hd] + exact hb (d k) + · intro i + simpa only [a',Equiv.symm_apply_apply] using hclose (e i) + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/KernelRelations.lean b/lean/OAI/Algebra/FiniteTensor/KernelRelations.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b226fb0a55ceb647865b90ed39708f3be8059e3 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/KernelRelations.lean @@ -0,0 +1,316 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ArtinSteps + +namespace OAI + +/-! Algebraic kernel relations, localization descent and polynomial parameter algebraicity. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section + + + +theorem algebraic_kernel_annihilator {F B L : Type*} [Field F] [CommRing B] + [CommRing L] [IsDomain L] [Algebra F B] [Algebra F L] + (φ : B →ₐ[F] L) (r : B) (hr : IsAlgebraic F r) (hz : φ r=0) : + ∃ (n : ℕ) (h : B),0 + change IsIntegral F (algebraMap F (MvPolynomial σ F ⧸ I) c) + exact isIntegral_algebraMap + | add p q hp hq => simpa only [map_add] using hp.add hq + | mul_X p i hp => simpa only [map_mul] using hp.mul (hX i) + + + +theorem diagonal_kernel_power_mem {F σ L : Type*} [Field F] + [CommRing L] [IsDomain L] [Algebra F L] + (a : σ → L) (P : σ → Polynomial F) + (hP : ∀ i,(P i).Monic) (hroot : ∀ i,Polynomial.aeval (a i) (P i)=0) + (g : MvPolynomial σ F) (hg : MvPolynomial.aeval a g=0) : + ∃ (n : ℕ) (H : MvPolynomial σ F),0Polynomial.aeval (MvPolynomial.X i) (P i))) := by + let I : Ideal (MvPolynomial σ F) := Ideal.span + (Set.range (fun i=>Polynomial.aeval (MvPolynomial.X i) (P i))) + have hI : ∀ x∈I,MvPolynomial.aeval a x=0 := by + intro x hx + have he : I≤RingHom.ker (MvPolynomial.aeval a).toRingHom := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change MvPolynomial.aeval a (Polynomial.aeval (MvPolynomial.X i) (P i))=0 + rw [←Polynomial.aeval_algHom_apply] + simpa using hroot i + exact he hx + have hX (i : σ) : IsIntegral F (Ideal.Quotient.mk I (MvPolynomial.X i)) := by + refine ⟨P i,hP i,?_⟩ + have hi : Polynomial.aeval (MvPolynomial.X i) (P i)∈I := + Ideal.subset_span (Set.mem_range_self i) + have he := Ideal.Quotient.eq_zero_iff_mem.mpr hi + change (Ideal.Quotient.mkₐ F I) (Polynomial.aeval (MvPolynomial.X i) (P i))=0 at he + rwa [←Polynomial.aeval_algHom_apply] at he + exact quotient_kernel_power_mem I (MvPolynomial.aeval a) hI g hg + (quotient_mvpolynomial_isIntegral I hX g).isAlgebraic + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section + + + +theorem localization_kernel_power_descent {R S L : Type*} [CommRing R] + [CommRing S] [CommRing L] [IsDomain L] [Algebra R S] + (M : Submonoid R) [IsLocalization M S] + (φ : R →+* L) (ψ : S →+* L) + (hcomp : ψ.comp (algebraMap R S)=φ) + (hM : ∀ m∈M,φ m≠0) + (I : Ideal R) (g : R) (n : ℕ) (H : S) + (hH : ψ H≠0) (hmem : H*(algebraMap R S g)^n∈I.map (algebraMap R S)) : + ∃ H₀ : R,φ H₀≠0 ∧ H₀*g^n∈I := by + obtain ⟨d,H₀,hH₀⟩ := IsLocalization.exists_integer_multiple' M H + have hc (r : R) : ψ (algebraMap R S r)=φ r := RingHom.congr_fun hcomp r + have hH₀' : φ H₀≠0 := by + rw [←hc H₀,hH₀,map_mul,hc] + exact mul_ne_zero hH (hM d d.property) + have hmem' : algebraMap R S (H₀*g^n)∈I.map (algebraMap R S) := by + rw [map_mul,map_pow,hH₀] + convert (I.map (algebraMap R S)).mul_mem_left (algebraMap R S d) hmem using 1 + ring + obtain ⟨c,hcM,hcI⟩ := (IsLocalization.algebraMap_mem_map_algebraMap_iff M S I _).mp hmem' + refine ⟨c*H₀,by rw [map_mul]; exact mul_ne_zero (hM c hcM) hH₀',?_⟩ + simpa only [mul_assoc] using hcI + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +attribute [local instance] MvPolynomial.algebraMvPolynomial + + + +theorem nonmonic_diagonal_kernel_power_mem {R L σ : Type*} [CommRing R] + [IsDomain R] [Field L] [Algebra R L] [FaithfulSMul R L] + (a : σ → L) (P : σ → Polynomial R) (hP : ∀ i,P i≠0) + (hroot : ∀ i,Polynomial.aeval (a i) (P i)=0) + (g : MvPolynomial σ R) (hg : MvPolynomial.aeval a g=0) : + ∃ (n : ℕ) (H : MvPolynomial σ R),0Polynomial.aeval (MvPolynomial.X i) (P i))) := by + let F := FractionRing R + let : Algebra F L := FractionRing.liftAlgebra R L + let : IsScalarTower R F L := FractionRing.isScalarTower_liftAlgebra R L + let I : Ideal (MvPolynomial σ R) := Ideal.span + (Set.range (fun i=>Polynomial.aeval (MvPolynomial.X i) (P i))) + let J := I.map (algebraMap (MvPolynomial σ R) (MvPolynomial σ F)) + let φ : MvPolynomial σ R →ₐ[R] L := MvPolynomial.aeval a + let ψ : MvPolynomial σ F →ₐ[F] L := MvPolynomial.aeval a + have hcomp : ψ.toRingHom.comp (algebraMap (MvPolynomial σ R) (MvPolynomial σ F))= + φ.toRingHom := by + apply RingHom.ext + intro p + change MvPolynomial.aeval a (algebraMap (MvPolynomial σ R) (MvPolynomial σ F) p)= + MvPolynomial.aeval a p + rw [MvPolynomial.algebraMap_def,MvPolynomial.aeval_map_algebraMap] + have heI : ∀ x∈I,φ x=0 := by + intro x hx + have he : I≤RingHom.ker φ.toRingHom := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change MvPolynomial.aeval a (Polynomial.aeval (MvPolynomial.X i) (P i))=0 + rw [←Polynomial.aeval_algHom_apply] + simpa using hroot i + exact he hx + have heJ : ∀ x∈J,ψ x=0 := by + intro x hx + have he : J≤RingHom.ker ψ.toRingHom := by + apply Ideal.map_le_iff_le_comap.mpr + intro y hy + change ψ (algebraMap (MvPolynomial σ R) (MvPolynomial σ F) y)=0 + exact (RingHom.congr_fun hcomp y).trans (heI y hy) + exact he hx + have hX (i : σ) : IsIntegral F (Ideal.Quotient.mk J (MvPolynomial.X i)) := by + apply IsAlgebraic.isIntegral + refine ⟨(P i).map (algebraMap R F), + (Polynomial.map_ne_zero_iff (IsFractionRing.injective R F)).mpr (hP i),?_⟩ + have hi : Polynomial.aeval (MvPolynomial.X i) (P i)∈I := + Ideal.subset_span (Set.mem_range_self i) + have hj : algebraMap (MvPolynomial σ R) (MvPolynomial σ F) + (Polynomial.aeval (MvPolynomial.X i) (P i))∈J := Ideal.mem_map_of_mem _ hi + have hr : algebraMap (MvPolynomial σ R) (MvPolynomial σ F) + (Polynomial.aeval (MvPolynomial.X i) (P i))= + Polynomial.aeval (MvPolynomial.X i) ((P i).map (algebraMap R F)) := by + rw [MvPolynomial.algebraMap_def] + induction P i using Polynomial.induction_on' with + | add p q hp hq => simp only [map_add,Polynomial.map_add,hp,hq] + | monomial n r => simp [Polynomial.aeval_monomial] + rw [hr] at hj + have hq := Ideal.Quotient.eq_zero_iff_mem.mpr hj + change (Ideal.Quotient.mkₐ F J) (Polynomial.aeval (MvPolynomial.X i) + ((P i).map (algebraMap R F)))=0 at hq + rwa [←Polynomial.aeval_algHom_apply] at hq + let g' := algebraMap (MvPolynomial σ R) (MvPolynomial σ F) g + have hg' : ψ g'=0 := (RingHom.congr_fun hcomp g).trans hg + obtain ⟨n,H,hn,hH,hHI⟩ := quotient_kernel_power_mem J ψ heJ g' hg' + (quotient_mvpolynomial_isIntegral J hX g').isAlgebraic + let M : Submonoid (MvPolynomial σ R) := (nonZeroDivisors R).map MvPolynomial.C + have hM : ∀ m∈M,φ m≠0 := by + rintro _ ⟨r,hr,rfl⟩ + change MvPolynomial.aeval a (C r)≠0 + rw [MvPolynomial.aeval_C] + exact fun hz=>(mem_nonZeroDivisors_iff_ne_zero.mp hr) + (FaithfulSMul.algebraMap_injective R L (by simpa only [map_zero] using hz)) + obtain ⟨H₀,hH₀,hH₀I⟩ := localization_kernel_power_descent M φ.toRingHom + ψ.toRingHom hcomp hM I g n H hH hHI + exact ⟨n,H₀,hn,hH₀,hH₀I⟩ + + + +theorem diagonal_relation_det_ne_zero {R L σ : Type*} [CommRing R] + [CommRing L] [IsDomain L] [Algebra R L] [Fintype σ] [DecidableEq σ] + (a : σ → L) (P : σ → Polynomial R) + (hder : ∀ i,Polynomial.aeval (a i) (P i).derivative≠0) : + Matrix.det (fun k i=>MvPolynomial.aeval (R:=R) a + (MvPolynomial.pderiv i (Polynomial.aeval (MvPolynomial.X k) (P k))))≠0 := by + have he : (fun k i=>MvPolynomial.aeval (R:=R) a + (MvPolynomial.pderiv i (Polynomial.aeval (MvPolynomial.X k) (P k))))= + Matrix.diagonal (fun k=>Polynomial.aeval (a k) (P k).derivative) := by + funext k i + rw [Derivation.map_aeval] + simp only [smul_eq_mul,map_mul,←Polynomial.aeval_algHom_apply,MvPolynomial.aeval_X] + by_cases h : k=i + · subst i + simp + · simp [MvPolynomial.pderiv_X,h] + rw [he,Matrix.det_diagonal] + exact Finset.prod_ne_zero_iff.mpr fun i _=>hder i + +end +end PD4Tensor.Spreading + + + +noncomputable section + +namespace PD4Tensor.Spreading + + + +theorem exists_relation_derivative_ne_zero {R S : Type*} [CommRing R] [IsDomain R] + [CharZero R] [CommRing S] [Algebra R S] (hi : Function.Injective (algebraMap R S)) + (f : S) (hf : IsAlgebraic R f) : + ∃ P : Polynomial R, P≠0 ∧ Polynomial.aeval f P=0 ∧ + Polynomial.aeval f P.derivative≠0 := by + classical + obtain ⟨P,hP,hPf⟩ := hf + have hex : ∃ n : ℕ, ∃ P : Polynomial R, P≠0 ∧ Polynomial.aeval f P=0 ∧ P.natDegree=n := + ⟨P.natDegree,P,hP,hPf,rfl⟩ + obtain ⟨Q,hQ,hQf,hQn⟩ := Nat.find_spec hex + refine ⟨Q,hQ,hQf,?_⟩ + intro hd + have hQd : Q.natDegree≠0 := by + intro h + have heq := Polynomial.eq_C_of_natDegree_eq_zero h + rw [heq,Polynomial.aeval_C] at hQf + have hz : Q.coeff 0=0 := hi (by simpa only [map_zero] using hQf) + apply hQ + simpa only [hz,Polynomial.C_0] using heq + have hder : Q.derivative≠0 := Polynomial.derivative_ne_zero.mpr hQd + have hlt : Q.derivative.natDegreeby + change MvPolynomial.aeval (R:=R) x p=MvPolynomial.aeval (R:=K) x + (algebraMap B C p) + rw [MvPolynomial.algebraMap_def,MvPolynomial.aeval_map_algebraMap] + let M : Submonoid B := (nonZeroDivisors R).map MvPolynomial.C + let : Algebra.IsAlgebraic B C := IsLocalization.isAlgebraic C M + have hc : IsAlgebraic C a := by + apply ha.of_ringHom_of_comp_eq hx.aevalEquiv.toRingHom (RingHom.id L) + hx.aevalEquiv.surjective Function.injective_id + apply RingHom.ext + intro p + exact hx.algebraMap_aevalEquiv p + obtain ⟨P,hP,hPa⟩ := hc.restrictScalars B + exact ⟨P,hP,hPa⟩ + +end +end PD4Tensor.Spreading +end + +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/KoszulForms.lean b/lean/OAI/Algebra/FiniteTensor/KoszulForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..c53ee07a4128d8f5c4d16935ca900768c4e3b1d3 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/KoszulForms.lean @@ -0,0 +1,156 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ExteriorForms +import OAI.Algebra.FiniteTensor.FrobeniusQuotient +import OAI.Algebra.FiniteTensor.SquarefreeParameters + +namespace OAI + +/-! First-order Koszul equations and lifting of truncated differential-form cycles. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct + +variable {K R V : Type*} [Field K] [CommRing R] [Algebra K R] +variable [AddCommGroup V] [Module K V] + + + +def firstOrderKoszul (δ d b : V →ₗ[K] V) (t : R) : + R ⊗[K] V →ₗ[K] R ⊗[K] V := + TensorProduct.map LinearMap.id δ + + TensorProduct.map (LinearMap.mulLeft K t) (d.comp b - b.comp d) + + + +theorem firstOrder_lift (δ d b : V →ₗ[K] V) + (hdδ : d.comp δ = -(δ.comp d)) (hbδ : b.comp δ = δ.comp b) + (a β γ : V) (ha : δ a = 0) (hβ : d a = δ β) (hγ : b a = δ γ) + (t : R) (ht : t * t = 0) : + firstOrderKoszul δ d b t + ((1 : R) ⊗ₜ[K] a + t ⊗ₜ[K] (d γ + b β)) = 0 := by + have hcorr : δ (d γ + b β) + (d (b a) - b (d a)) = 0 := by + have hd := LinearMap.congr_fun hdδ γ + have hb := LinearMap.congr_fun hbδ β + simp only [LinearMap.comp_apply, LinearMap.neg_apply] at hd hb + rw [hγ, hβ, hd, hb, map_add] + abel + simp only [firstOrderKoszul, LinearMap.add_apply, map_add, + TensorProduct.map_tmul, LinearMap.id_apply, LinearMap.mulLeft_apply, + LinearMap.sub_apply, LinearMap.comp_apply, ha, TensorProduct.tmul_zero, + ht, TensorProduct.zero_tmul, mul_one, zero_add, add_zero] + rw [← TensorProduct.tmul_add, ← map_add δ, add_comm, hcorr, TensorProduct.tmul_zero] + +end +end PD4Tensor + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + [CharP K p] [Invertible (2 : K)] +abbrev A := FrobeniusTruncation.Ring K σ p +abbrev Space := Ω K (A K σ p) σ + +def D : Space K σ p →ₗ[K] Space K σ p := + differential K (A K σ p) σ (FrobeniusTruncation.derivative K σ p) + +def koszul (S : A K σ p) : Space K σ p →ₗ[K] Space K σ p := + LinearMap.mulLeft K (D K σ p (scalar K (A K σ p) σ S)) + +def mulScalar (b : A K σ p) : Space K σ p →ₗ[K] Space K σ p := + LinearMap.mulLeft K (scalar K (A K σ p) σ b) + +def residueForm (hp : 0 simp [ha, hb] + | tmul a e => + simp [D, differential_tmul, FrobeniusTruncation.residue_derivative] + +@[simp] theorem D_sq_zero (ω : Space K σ p) : D K σ p (D K σ p ω) = 0 := + differential_sq_zero _ (FrobeniusTruncation.derivative_commute K σ p) ω + +omit [Invertible (2 : K)] in +theorem D_mul (ω η : Space K σ p) : + D K σ p (ω*η) = D K σ p ω * η + parity K (A K σ p) σ ω * D K σ p η := + differential_mul _ (FrobeniusTruncation.derivative_mul K σ p) ω η + + +omit [Invertible (2 : K)] in +theorem closed_mul_exact_residue (hp : 0e) := by + rw [eval₂_monomial] + apply (totalDegree_mul _ _).trans + rw [totalDegree_C,zero_add] + apply (totalDegree_finsetProd d.support _).trans + apply Finset.sum_le_sum + intro i hi + exact (totalDegree_pow _ _).trans (by simpa using Nat.mul_le_mul_left (d i) (hq i)) + change ((eval₂Hom C q) p).totalDegree≤p.totalDegree + conv_lhs => rw [p.as_sum,map_sum] + apply totalDegree_finsetSum_le + intro d hd + exact (hm d _).trans (le_totalDegree hd) + + +theorem coe_eval₂_polynomials {K σ τ : Type*} [CommRing K] + (p : MvPolynomial σ K) (q : σ → MvPolynomial τ K) : + ((eval₂ C q p : MvPolynomial τ K) : MvPowerSeries τ K) = + MvPowerSeries.subst (fun i=>(q i : MvPowerSeries τ K)) (p : MvPowerSeries σ K) := by + rw [MvPowerSeries.subst_coe] + have he : MvPolynomial.coeToMvPowerSeries.ringHom.comp (eval₂Hom C q) = + (aeval (fun i=>(q i : MvPowerSeries τ K))).toRingHom := by + apply MvPolynomial.ringHom_ext + · intro c + simp [MvPowerSeries.algebraMap_apply] + · intro i + simp + exact RingHom.congr_fun he p + + + +theorem exists_nonzero_line {K σ : Type*} [Field K] [Infinite K] [Finite σ] + (f : MvPowerSeries σ K) (hf : f≠0) : + ∃ a : σ → K,MvPowerSeries.subst + (fun i=>MvPowerSeries.C (a i)*MvPowerSeries.X ()) f≠0 := by + classical + obtain ⟨d,hd⟩ : ∃ d, MvPowerSeries.coeff d f≠0 := by + by_contra h + push Not at h + exact hf (MvPowerSeries.ext fun d=>by simp [h d]) + let n := d.degree+1 + let p := MvPowerSeries.truncTotal n f + have hn : n≠0 := Nat.succ_ne_zero _ + have hp : p≠0 := by + intro h + apply hd + have hh := congrArg (fun polynomial : MvPolynomial σ K=>polynomial.coeff d) h + change (MvPowerSeries.truncTotal n f).coeff d=0 at hh + rw [MvPowerSeries.coeff_truncTotal f (show d.degreeby + exact (totalDegree_mul _ _).trans (by simp))).trans_lt + (MvPowerSeries.totalDegree_truncTotal_lt f hn) + have hg : g≠0 := by + intro h + apply ha + have hh := congrArg (eval (fun (_ : Unit)=>(1:K))) h + have he : (eval (fun (_ : Unit)=>(1:K))).comp C = RingHom.id K := by + ext c + simp + simpa [g,q,eval_eval₂,he] using hh + refine ⟨a,?_⟩ + intro hz + have hzconst : ∀ i : σ,(MvPowerSeries.C (a i)* + MvPowerSeries.X () : MvPowerSeries Unit K).constantCoeff=0 := by + intro i + simp + have he := MvPowerSeries.truncTotal_subst_eq_truncTotal_truncTotal_subst + (f:=f) (k:=n) hzconst + rw [hz,map_zero] at he + have hc : (g : MvPowerSeries Unit K) = + MvPowerSeries.subst (fun i=>MvPowerSeries.C (a i)*MvPowerSeries.X ()) + (p : MvPowerSeries σ K) := by + simpa only [q,MvPolynomial.coe_mul,MvPolynomial.coe_C,MvPolynomial.coe_X] using + coe_eval₂_polynomials p q + change 0 = MvPowerSeries.truncTotal n + (MvPowerSeries.subst (fun i=>MvPowerSeries.C (a i)*MvPowerSeries.X ()) + (p : MvPowerSeries σ K)) at he + rw [←hc,(MvPowerSeries.truncTotal_coe_eq_self_iff g hn).mpr hgdeg] at he + exact hg he.symm + +end +end PD4Tensor.Spreading + + + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ : Type*} [Field K] [Finite σ] [DecidableEq σ] + +def linearChartVars (p : σ) (a : σ → K) (i : σ) : MvPowerSeries σ K := + if i=p then C (a i)*X p else X i+C (a i)*X p + + omit [Finite σ] in + theorem linearChartVars_const (p : σ) (a : σ → K) (i : σ) : + constantCoeff (linearChartVars p a i)=0 := by + simp [linearChartVars]; split <;> simp + + theorem linearChartVars_hasSubst (p : σ) (a : σ → K) : HasSubst (linearChartVars p a) := + hasSubst_of_constantCoeff_zero (linearChartVars_const p a) + + theorem linearChartVars_comp (p : σ) (a b : σ → K) + (hp : a p*b p=1) (hi : ∀ i,i≠p → b i+a i*b p=0) (i : σ) : + subst (linearChartVars p b) (linearChartVars p a i)=X i := by + have hb := linearChartVars_hasSubst p b + by_cases h : i=p + · subst i + simp only [linearChartVars,ite_true,subst_mul hb,subst_C,subst_X hb] + rw [←mul_assoc,←map_mul,hp,map_one,one_mul] + · simp only [linearChartVars,h,ite_false,subst_add hb,subst_X hb,subst_mul hb,subst_C] + calc + X i+C (b i)*X p+C (a i)*(C (b p)*X p) = X i+C (b i+a i*b p)*X p := by + rw [map_add,map_mul]; ring + _ = X i := by rw [hi i h]; simp + +def inverseChartPoint (p : σ) (a : σ → K) (i : σ) : K := + if i=p then (a p)⁻¹ else -(a i)/(a p) + + omit [Finite σ] in + theorem chart_inverse_relations (p : σ) (a : σ → K) (hp : a p≠0) : + a p*inverseChartPoint p a p=1 ∧ + (∀ i,i≠p → inverseChartPoint p a i+a i*inverseChartPoint p a p=0) ∧ + inverseChartPoint p a p*a p=1 ∧ + (∀ i,i≠p → a i+inverseChartPoint p a i*a p=0) := by + refine ⟨by simp [inverseChartPoint,hp],?_,by simp [inverseChartPoint,hp],?_⟩ + · intro i hi + simp [inverseChartPoint,hi,div_eq_mul_inv] + · intro i hi + simp [inverseChartPoint,hi,div_eq_mul_inv,hp] + +def linearSeriesChart (p : σ) (a : σ → K) (hp : a p≠0) : + MvPowerSeries σ K ≃ₐ[K] MvPowerSeries σ K := by + let f : MvPowerSeries σ K →ₐ[K] MvPowerSeries σ K := substAlgHom (linearChartVars_hasSubst p a) + let g : MvPowerSeries σ K →ₐ[K] MvPowerSeries σ K := substAlgHom (linearChartVars_hasSubst p (inverseChartPoint p a)) + have h := chart_inverse_relations p a hp + have hfg : f.comp g=AlgHom.id K _ := by + apply AlgHom.ext + intro x + simp only [f,g,AlgHom.comp_apply,substAlgHom_apply,AlgHom.id_apply] + change subst (linearChartVars p a) (subst (linearChartVars p (inverseChartPoint p a)) x)=x + rw [subst_comp_subst_apply (linearChartVars_hasSubst p _) (linearChartVars_hasSubst p _)] + simp_rw [linearChartVars_comp p _ _ h.2.2.1 h.2.2.2] + simp only [subst_self,Function.id_def] + have hgf : g.comp f=AlgHom.id K _ := by + apply AlgHom.ext + intro x + simp only [f,g,AlgHom.comp_apply,substAlgHom_apply,AlgHom.id_apply] + change subst (linearChartVars p (inverseChartPoint p a)) (subst (linearChartVars p a) x)=x + rw [subst_comp_subst_apply (linearChartVars_hasSubst p _) (linearChartVars_hasSubst p _)] + simp_rw [linearChartVars_comp p _ _ h.1 h.2.1] + simp only [subst_self,Function.id_def] + exact AlgEquiv.ofAlgHom f g hfg hgf + + theorem linearSeriesChart_apply (p : σ) (a : σ → K) (hp : a p≠0) + (f : MvPowerSeries σ K) : linearSeriesChart p a hp f=subst (linearChartVars p a) f := by + simp [linearSeriesChart,AlgEquiv.ofAlgHom] + + def axisVars (p : σ) (i : σ) : MvPowerSeries Unit K := if i=p then X () else 0 + + theorem axisVars_hasSubst (p : σ) : HasSubst (axisVars (K:=K) p) := + hasSubst_of_constantCoeff_zero fun i=>by simp [axisVars]; split <;> simp + + theorem axisVars_subst_linearChartVars (p : σ) (a : σ → K) (i : σ) : + subst (axisVars p) (linearChartVars p a i)=C (a i)*X () := by + have hh := axisVars_hasSubst (K:=K) p + by_cases hi : i=p + · subst i + simp [linearChartVars,subst_mul hh,axisVars,subst_X hh] + · simp [linearChartVars,hi,subst_add hh,subst_mul hh,subst_X hh,axisVars] + + + + theorem axis_linearSeriesChart (p : σ) (a : σ → K) (hp : a p≠0) + (f : MvPowerSeries σ K) : + subst (axisVars p) (linearSeriesChart p a hp f)= + subst (fun i=>C (a i)*X ()) f := by + rw [linearSeriesChart_apply,subst_comp_subst_apply (linearChartVars_hasSubst p a) (axisVars_hasSubst p)] + simp_rw [axisVars_subst_linearChartVars] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ : Type*} [Field K] [Infinite K] [Finite σ] [DecidableEq σ] + + + +theorem exists_regular_linear_chart (f : MvPowerSeries σ K) + (hf : f≠0) (hf0 : constantCoeff f=0) : + ∃ (p : σ) (a : σ → K) (hp : a p≠0), + subst (axisVars (K:=K) p) (linearSeriesChart p a hp f)≠0 := by + obtain ⟨a,ha⟩ := exists_nonzero_line f hf + have hex : ∃ p,a p≠0 := by + by_contra hn + push Not at hn + apply ha + simp only [hn,map_zero,zero_mul] + exact subst_zero_of_constantCoeff_zero hf0 + obtain ⟨p,hp⟩ := hex + exact ⟨p,a,hp,by rwa [axis_linearSeriesChart]⟩ + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ τ : Type*} [Field K] [Finite σ] [Finite τ] + + + +theorem series_equiv_jet (E : MvPowerSeries σ K ≃+* MvPowerSeries τ K) + {f : MvPowerSeries σ K} {n : ℕ} (hf : f∈(jetIdeal (K:=K) (σ:=σ))^n) : + E f∈(jetIdeal (K:=K) (σ:=τ))^n := by + have he : (jetIdeal (K:=K) (σ:=σ)).map E.toRingHom=jetIdeal (K:=K) (σ:=τ) := by + rw [jetIdeal_eq_maximalIdeal,jetIdeal_eq_maximalIdeal] + ext x + change x∈(IsLocalRing.maximalIdeal (MvPowerSeries σ K)).map E ↔ _ + rw [←Ideal.symm_apply_mem_of_equiv_iff (f:=E)] + simp only [IsLocalRing.mem_maximalIdeal,mem_nonunits_iff,isUnit_map_iff E.symm] + have h := Ideal.mem_map_of_mem E.toRingHom hf + rwa [Ideal.map_pow,he] at h + +variable [DecidableEq σ] + +def polynomialChartVars (p : σ) (a : σ → K) (i : σ) : MvPolynomial σ K := + if i=p then MvPolynomial.C (a p)*MvPolynomial.X p + else MvPolynomial.X i+MvPolynomial.C (a i)*MvPolynomial.X p + +def polynomialChart (p : σ) (a : σ → K) : MvPolynomial σ K →+* MvPolynomial σ K := + MvPolynomial.eval₂Hom MvPolynomial.C (polynomialChartVars p a) + + theorem polynomialChart_square (p : σ) (a : σ → K) (hp : a p≠0) : + (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K)).comp (polynomialChart p a)= + (linearSeriesChart p a hp).toRingHom.comp + (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K)) := by + apply MvPolynomial.ringHom_ext + · intro c + simp [polynomialChart,linearSeriesChart_apply,algebraMap_apply'] + · intro i + simp only [RingHom.comp_apply,algebraMap_apply',MvPolynomial.coe_X] + change ((polynomialChart p a (MvPolynomial.X i) : MvPolynomial σ K) : MvPowerSeries σ K)= + linearSeriesChart p a hp (X i) + rw [linearSeriesChart_apply,subst_X (linearChartVars_hasSubst p a)] + by_cases hi : i=p <;> simp [polynomialChart,polynomialChartVars,linearChartVars,hi] + + theorem polynomialChart_injective (p : σ) (a : σ → K) (hp : a p≠0) : + Function.Injective (polynomialChart p a) := by + intro f g h + apply MvPolynomial.coe_injective + apply (linearSeriesChart p a hp).injective + have hf := RingHom.congr_fun (polynomialChart_square p a hp) f + have hg := RingHom.congr_fun (polynomialChart_square p a hp) g + change (linearSeriesChart p a hp) (f : MvPowerSeries σ K)= + (linearSeriesChart p a hp) (g : MvPowerSeries σ K) + simp only [RingHom.comp_apply,algebraMap_apply'] at hf hg + change ((polynomialChart p a f : MvPolynomial σ K) : MvPowerSeries σ K)=linearSeriesChart p a hp (f : MvPowerSeries σ K) at hf + change ((polynomialChart p a g : MvPolynomial σ K) : MvPowerSeries σ K)=linearSeriesChart p a hp (g : MvPowerSeries σ K) at hg + rw [←hf,←hg,h] + + theorem algebraic_linearSeriesChart (p : σ) (a : σ → K) (hp : a p≠0) + {f : MvPowerSeries σ K} (hf : IsAlgebraic (MvPolynomial σ K) f) : + IsAlgebraic (MvPolynomial σ K) (linearSeriesChart p a hp f) := by + exact hf.ringHom_of_comp_eq (polynomialChart p a) (linearSeriesChart p a hp).toRingHom + (polynomialChart_injective p a hp) (polynomialChart_square p a hp) + + theorem linearSeriesChart_symm_apply (p : σ) (a : σ → K) (hp : a p≠0) + (f : MvPowerSeries σ K) : + (linearSeriesChart p a hp).symm f=subst (linearChartVars p (inverseChartPoint p a)) f := by + simp [linearSeriesChart,AlgEquiv.ofAlgHom] + + theorem algebraic_linearSeriesChart_symm (p : σ) (a : σ → K) (hp : a p≠0) + {f : MvPowerSeries σ K} (hf : IsAlgebraic (MvPolynomial σ K) f) : + IsAlgebraic (MvPolynomial σ K) ((linearSeriesChart p a hp).symm f) := by + have hi : inverseChartPoint p a p≠0 := by simp [inverseChartPoint,hp] + simpa only [linearSeriesChart_symm_apply,linearSeriesChart_apply] using + algebraic_linearSeriesChart p (inverseChartPoint p a) hi hf + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries WithPiTopology +variable {K σ : Type*} [Field K] [Finite σ] [DecidableEq σ] + +def axisEmbedding (p : σ) : Unit ↪ σ := ⟨fun _=>p,fun _ _ _=>Subsingleton.elim _ _⟩ + +theorem axis_subst_eq_killCompl (p : σ) (f : MvPowerSeries σ K) : + subst (axisVars p) f=killCompl (axisEmbedding p) f := by + let : UniformSpace K := ⊥ + let ε := killCompl (R:=K) (axisEmbedding p) + have hε : Continuous ε := by + apply continuous_pi + intro d + exact continuous_coeff K (Finsupp.embDomain (axisEmbedding p) d) + have hvars : (fun i : σ=>ε (X i))=axisVars p := by + funext i + by_cases hi : i=p + · subst i + simp only [axisVars,ite_true] + exact killCompl_X (R:=K) (e:=axisEmbedding p) () + · have hn : i∉Set.range (axisEmbedding p) := by + rintro ⟨u,hu⟩ + exact hi hu.symm + simpa [ε,axisVars,hi] using killCompl_X_eq_zero (R:=K) (e:=axisEmbedding p) hn + have he := aeval_unique hε + have hR := axisVars_hasSubst (K:=K) p + change subst (axisVars p) f=ε f + rw [←AlgHom.congr_fun he f] + rw [←substAlgHom_apply hR,substAlgHom_eq_aeval hR] + simp only [coe_aeval] + change eval₂ (algebraMap K (MvPowerSeries Unit K)) (axisVars p) f= + eval₂ (algebraMap K (MvPowerSeries Unit K)) (fun s=>ε (X s)) f + rw [hvars] + + theorem option_axis_constant (f : MvPowerSeries (Option σ) K) : + subst (axisVars none) f=(MvPowerSeries.optionEquivLeft σ K f).map + (MvPowerSeries.constantCoeff : MvPowerSeries σ K →+* K) := by + rw [axis_subst_eq_killCompl] + apply PowerSeries.ext + intro n + change coeff (Finsupp.single () n) (killCompl (axisEmbedding none) f)=_ + rw [coeff_killCompl,PowerSeries.coeff_map,←coeff_zero_eq_constantCoeff_apply, + coeff_coeff_optionEquivLeft] + have he : Finsupp.embDomain (axisEmbedding (σ:=Option σ) none) (Finsupp.single () n)= + Finsupp.optionElim n 0 := by + rw [Finsupp.optionElim_zero,Finsupp.embDomain_single] + rfl + rw [he] + + theorem option_axis_rename (p : σ) (f : MvPowerSeries σ K) : + subst (axisVars (K:=K) none) (rename (Equiv.optionSubtypeNe p).symm f)=subst (axisVars (K:=K) p) f := by + rw [rename_eq_subst,subst_comp_subst_apply (HasSubst.X_comp _) (axisVars_hasSubst none)] + congr 1 + funext i + rw [Function.comp_apply,subst_X (axisVars_hasSubst none)] + by_cases hi : i=p + · subst i + simp [axisVars] + · simp [axisVars,hi,Equiv.optionSubtypeNe_symm_of_ne hi] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K τ : Type*} [Field K] [Finite τ] + + omit [Finite τ] in + theorem residue_regular_of_constant_regular (f : PowerSeries (MvPowerSeries τ K)) + (hf : f.map (MvPowerSeries.constantCoeff : MvPowerSeries τ K →+* K)≠0) : + f.map (IsLocalRing.residue (MvPowerSeries τ K))≠0 := by + intro hz + apply hf + apply PowerSeries.ext + intro n + rw [PowerSeries.coeff_map,map_zero] + have he := congrArg (PowerSeries.coeff n) hz + rw [PowerSeries.coeff_map,map_zero] at he + have hm : PowerSeries.coeff n f∈IsLocalRing.maximalIdeal (MvPowerSeries τ K) := + (IsLocalRing.residue_eq_zero_iff _).mp he + rw [IsLocalRing.mem_maximalIdeal,mem_nonunits_iff, + MvPowerSeries.isUnit_iff_constantCoeff,isUnit_iff_ne_zero,not_not] at hm + exact hm + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/Main.lean b/lean/OAI/Algebra/FiniteTensor/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..49fabe4f9f5b476fcbbfd1e6b3822ab38c4aad60 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/Main.lean @@ -0,0 +1 @@ +import OAI.Algebra.FiniteTensor.TensorApproximation diff --git a/lean/OAI/Algebra/FiniteTensor/MinorReduction.lean b/lean/OAI/Algebra/FiniteTensor/MinorReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8b547730a2129c1a5a9cdaa8570308aeae2a615 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/MinorReduction.lean @@ -0,0 +1,289 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.KernelRelations + +namespace OAI + +/-! Finite generic minor reductions and polynomial Artin approximation from minors. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial + + theorem eval_sum_parameters {R L σ ι : Type*} [CommRing R] [CommRing L] + (c : R →+* L) (a : σ → L) (x : ι → L) + (q : MvPolynomial (σ ⊕ ι) R) : + eval₂ c (Sum.elim a x) q= + eval₂ (eval₂Hom c x) a (sumAlgEquiv R σ ι q) := by + induction q using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp only [map_add,eval₂_add,hp,hq] + | mul_X p i hp => cases i <;> simp [hp] + + theorem eval_sum_parameters_symm {R L σ ι : Type*} [CommRing R] [CommRing L] + (c : R →+* L) (a : σ → L) (x : ι → L) + (q : MvPolynomial σ (MvPolynomial ι R)) : + eval₂ c (Sum.elim a x) ((sumAlgEquiv R σ ι).symm q)=eval₂ (eval₂Hom c x) a q := by + rw [eval_sum_parameters,AlgEquiv.apply_symm_apply] + + theorem pderiv_sum_symm {R σ ι : Type*} [CommRing R] + (q : MvPolynomial σ (MvPolynomial ι R)) (i : σ) : + pderiv (Sum.inl i) ((sumAlgEquiv R σ ι).symm q)= + (sumAlgEquiv R σ ι).symm (pderiv i q) := by + apply (sumAlgEquiv R σ ι).injective + rw [←pderiv_sumAlgEquiv,AlgEquiv.apply_symm_apply,AlgEquiv.apply_symm_apply] + + theorem sum_symm_map_C {R σ ι : Type*} [CommRing R] (g : MvPolynomial σ R) : + (sumAlgEquiv R σ ι).symm (map MvPolynomial.C g)=rename Sum.inl g := by + induction g using MvPolynomial.induction_on with + | C r => simp + | add p q hp hq => simp only [map_add,hp,hq] + | mul_X p i hp => simp [hp] + + + +theorem finite_generic_minor_reduction {R L σ : Type*} [CommRing R] [IsDomain R] + [CharZero R] [Field L] [Algebra R L] [FaithfulSMul R L] + [Fintype σ] [DecidableEq σ] (a : σ → L) : + ∃ s : Set L,s.Finite ∧ s⊆Set.range a ∧ + ∃ f : σ → MvPolynomial (σ ⊕ s) R, + (∀ k,MvPolynomial.aeval (Sum.elim a ((↑) : s → L)) (f k)=0) ∧ + Matrix.det (fun k i=>MvPolynomial.aeval (Sum.elim a ((↑) : s → L)) + (pderiv (Sum.inl i) (f k)))≠0 ∧ + ∀ g : MvPolynomial σ R,MvPolynomial.aeval a g=0 → + ∃ (n : ℕ) (H : MvPolynomial (σ ⊕ s) R),0exists_relation_derivative_ne_zero + (FaithfulSMul.algebraMap_injective B L) (a i) (ha i) + let E := sumAlgEquiv R σ s + let q := fun i=>Polynomial.aeval (MvPolynomial.X i : MvPolynomial σ B) (P i) + let f := fun i=>E.symm (q i) + have he (p : MvPolynomial σ B) : + MvPolynomial.aeval (R:=R) (Sum.elim a x) (E.symm p)=MvPolynomial.aeval (R:=B) a p := + eval_sum_parameters_symm (algebraMap R L) a x p + have hf (i : σ) : MvPolynomial.aeval (R:=R) (Sum.elim a x) (f i)=0 := by + rw [he] + change MvPolynomial.aeval (R:=B) a (Polynomial.aeval (MvPolynomial.X i) (P i))=0 + rw [←Polynomial.aeval_algHom_apply] + simpa using hroot i + have hd : Matrix.det (fun k i=>MvPolynomial.aeval (R:=R) (Sum.elim a x) + (pderiv (Sum.inl i) (f k)))≠0 := by + have hm (k i : σ) : MvPolynomial.aeval (R:=R) (Sum.elim a x) + (pderiv (Sum.inl i) (f k))=MvPolynomial.aeval (R:=B) a (pderiv i (q k)) := by + change MvPolynomial.aeval (R:=R) (Sum.elim a x) + (pderiv (Sum.inl i) (E.symm (q k)))=_ + rw [pderiv_sum_symm,he] + simp_rw [hm] + exact diagonal_relation_det_ne_zero a P hder + refine ⟨s,hfin,hsub,f,hf,hd,?_⟩ + intro g hg + let g' : MvPolynomial σ B := map MvPolynomial.C g + have hg' : MvPolynomial.aeval (R:=B) a g'=0 := by + change eval₂ (MvPolynomial.aeval (R:=R) x).toRingHom a (map MvPolynomial.C g)=0 + rw [eval₂_map] + have hc : (MvPolynomial.aeval (R:=R) x).toRingHom.comp MvPolynomial.C=algebraMap R L := by + ext r + simp + rw [hc] + exact hg + obtain ⟨n,H,hn,hH,hHI⟩ := nonmonic_diagonal_kernel_power_mem a P hP hroot g' hg' + refine ⟨n,E.symm H,hn,by rw [he]; exact hH,?_⟩ + have hi := Ideal.mem_map_of_mem E.symm.toRingHom hHI + have hm : (Ideal.span (Set.range q)).map E.symm.toRingHom=Ideal.span (Set.range f) := by + rw [Ideal.map_span] + congr 1 + ext y + constructor + · rintro ⟨z,⟨i,rfl⟩,rfl⟩ + exact ⟨i,rfl⟩ + · rintro ⟨i,rfl⟩ + exact ⟨q i,⟨i,rfl⟩,rfl⟩ + change E.symm (H*g'^n)∈(Ideal.span (Set.range q)).map E.symm.toRingHom at hi + rw [hm,map_mul,map_pow] at hi + have hgflat : E.symm g'=rename Sum.inl g := sum_symm_map_C g + rwa [hgflat] at hi + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial + + + +theorem finite_generic_domain_reduction {R A σ : Type*} [CommRing R] [IsDomain R] + [CharZero R] [CommRing A] [IsDomain A] [Algebra R A] [FaithfulSMul R A] + [Fintype σ] [DecidableEq σ] (a : σ → A) : + ∃ (s : Set (FractionRing A)) (_ : s.Finite) (c : s → A), + (∀ j, ∃ i,c j=a i) ∧ + ∃ f : σ → MvPolynomial (σ ⊕ s) R, + (∀ k,MvPolynomial.aeval (Sum.elim a c) (f k)=0) ∧ + Matrix.det (fun k i=>MvPolynomial.aeval (Sum.elim a c) + (pderiv (Sum.inl i) (f k)))≠0 ∧ + ∀ g : MvPolynomial σ R,MvPolynomial.aeval a g=0 → + ∃ (n : ℕ) (H : MvPolynomial (σ ⊕ s) R),0j (a i)) + have hpre (v : s) : ∃ i,j (a i)=(v : L) := hsub v.property + choose t ht using hpre + let c : s → A := fun v=>a (t v) + have he (q : MvPolynomial (σ ⊕ s) R) : + j (MvPolynomial.aeval (R:=R) (Sum.elim a c) q)= + MvPolynomial.aeval (R:=R) (Sum.elim (fun i=>j (a i)) ((↑) : s → L)) q := by + change j (eval₂ (algebraMap R A) (Sum.elim a c) q)=_ + rw [hom_eval₂] + congr 1 + funext v + cases v with + | inl i => rfl + | inr v => exact ht v + refine ⟨s,hs,c,fun v=>⟨t v,rfl⟩,f,?_,?_,?_⟩ + · intro k + apply hj + rw [he,hf,map_zero] + · intro hz + apply hd + have hmap := RingHom.map_det j (fun k i=>MvPolynomial.aeval (R:=R) + (Sum.elim a c) (pderiv (Sum.inl i) (f k))) + rw [hz,map_zero] at hmap + change 0=Matrix.det (fun k i=>j (MvPolynomial.aeval (R:=R) + (Sum.elim a c) (pderiv (Sum.inl i) (f k)))) at hmap + simpa only [he] using hmap.symm + · intro g hzero + have hzeroL : MvPolynomial.aeval (R:=R) (fun i=>j (a i)) g=0 := by + change eval₂ (algebraMap R L) (fun i=>j (a i)) g=0 + have h := congrArg j hzero + rw [map_zero] at h + change j (eval₂ (algebraMap R A) a g)=0 at h + rw [hom_eval₂] at h + simpa only [j,←IsScalarTower.algebraMap_eq R A L] using h + obtain ⟨n,H,hn,hH,hI⟩ := hg g hzeroL + refine ⟨n,H,hn,?_,hI⟩ + intro hz + apply hH + rw [←he,hz,map_zero] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {K τ : Type*} [Field K] [CharZero K] [Finite τ] + +def MinorArtinAt (K τ : Type*) [Field K] [Finite τ] : Prop := + ∀ (σ ρ : Type) [Fintype σ] [DecidableEq σ] [Fintype ρ] [DecidableEq ρ] + (f : σ → MvPolynomial (σ ⊕ ρ) (MvPolynomial τ K)) + (a : (σ ⊕ ρ) → MvPowerSeries τ K), + (∀ k,aeval a (f k)=0) → + Matrix.det (fun k i=>aeval a (pderiv (Sum.inl i) (f k)))≠0 → + ∀ n,∃ b : (σ ⊕ ρ) → MvPowerSeries τ K, + (∀ k,aeval b (f k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^n + + + +theorem polynomial_artin_of_minor (hm : MinorArtinAt K τ) : PolynomialArtinAt K τ := by + intro m r g a ha n + let R := MvPolynomial τ K + let A := MvPowerSeries τ K + let : IsDomain A := NoZeroDivisors.to_isDomain _ + let : FaithfulSMul R A := (faithfulSMul_iff_algebraMap_injective R A).mpr (by + intro p q h + apply MvPolynomial.coe_injective + change (algebraMap (MvPolynomial τ K) (MvPowerSeries τ K)) p=(algebraMap (MvPolynomial τ K) (MvPowerSeries τ K)) q at h + simpa only [MvPowerSeries.algebraMap_apply', Algebra.algebraMap_self, MvPowerSeries.map_id, RingHom.id_apply] using h) + obtain ⟨s,hs,c,hc,f,hf,hd,hker⟩ := finite_generic_domain_reduction (R:=R) a + let : Finite s := hs.to_subtype + let := Fintype.ofFinite s + let : DecidableEq s := Classical.decEq _ + let a' := Sum.elim a c + choose e H he hH hI using fun k=>hker (g k) (ha k) + let N := max n (Finset.univ.sup fun k=>((aeval a' (H k) : A).order.toNat+1)) + + + let t := Fintype.equivFin s + let v : Fin m ⊕ s ≃ Fin m ⊕ Fin (Fintype.card s) := Equiv.sumCongr (Equiv.refl _) t + let f' := fun k=>rename v (f k) + let a'' := fun i=>a' (v.symm i) + have hev (q : MvPolynomial (Fin m ⊕ s) R) : aeval a'' (rename v q)=aeval a' q := by + simp only [aeval_rename] + have he : a'' ∘ v=a' := by funext i; simp [a''] + rw [he] + have hfd (k i : Fin m) : pderiv (Sum.inl i) (f' k)=rename v (pderiv (Sum.inl i) (f k)) := by + change pderiv (v (Sum.inl i)) (rename v (f k))=_ + exact pderiv_rename v.injective _ _ + obtain ⟨b,hb,hbalg,hba⟩ := hm (Fin m) (Fin (Fintype.card s)) f' a'' + (fun k=>by rw [hev]; exact hf k) + (by simp_rw [hfd,hev]; exact hd) N + let b' := fun i=>b (v i) + have hb' (k : Fin m) : aeval b' (f k)=0 := by + simpa only [f',aeval_rename,b',Function.comp_def] using hb k + have hbclose (i : Fin m ⊕ s) : b' i-a' i∈(jetIdeal (K:=K) (σ:=τ))^N := by + simpa only [b',a'',Equiv.symm_apply_apply] using hba (v i) + refine ⟨fun i=>b' (Sum.inl i),?_,fun i=>hbalg _,?_⟩ + · intro k + have hHjet : aeval b' (H k)-aeval a' (H k)∈ + (jetIdeal (K:=K) (σ:=τ))^((aeval a' (H k) : A).order.toNat+1) := by + apply Ideal.pow_le_pow_right (show (aeval a' (H k) : A).order.toNat+1≤N from + (Finset.le_sup (f:=fun k=>((aeval a' (H k) : A).order.toNat+1)) (Finset.mem_univ k)).trans (le_max_right _ _)) + simpa only [←eval₂_eq_eval_map,aeval_def] using mv_eval_sub_mem _ (map (algebraMap R A) (H k)) b' a' hbclose + have hHb : aeval b' (H k)≠0 := ne_zero_of_close_jet (hH k) hHjet + have hspan : Ideal.span (Set.range f)≤RingHom.ker (aeval b').toRingHom := by + apply Ideal.span_le.mpr + rintro _ ⟨j,rfl⟩ + exact hb' j + have heq := hspan (hI k) + change aeval b' (H k*(rename Sum.inl (g k))^e k)=0 at heq + rw [map_mul,map_pow,aeval_rename] at heq + exact (pow_eq_zero_iff (he k).ne').mp ((mul_eq_zero.mp heq).resolve_left hHb) + · intro i + exact Ideal.pow_le_pow_right (le_max_left _ _) (hbclose (Sum.inl i)) + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/MovingCoordinates.lean b/lean/OAI/Algebra/FiniteTensor/MovingCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..440dd8c4029bb2937117f60170c1bab71ac3b536 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/MovingCoordinates.lean @@ -0,0 +1,526 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.FiniteCharts +import OAI.Algebra.FiniteTensor.FormalEvaluation + +namespace OAI + +/-! Frobenius specialization, moving substitutions and split coordinate restrictions. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +open MvPowerSeries.WithPiTopology +noncomputable section +variable {R S A B σ : Type*} [CommRing R] [CommRing S] [CommRing A] [CommRing B] + [Algebra R A] [Algebra S B] [Finite σ] + + + +theorem nilEval_coefficients (f : R →+* S) (F : A →+* B) + (hF : ∀ r, F (algebraMap R A r)=algebraMap S B (f r)) + (v : σ → A) (hv : ∀ i, IsNilpotent (v i)) (q : MvPowerSeries σ R) : + F (nilEval R v hv q)=nilEval S (fun i => F (v i)) (fun i => (hv i).map F) + (MvPowerSeries.map f q) := by + let : UniformSpace R := ⊥ + let : UniformSpace S := ⊥ + let : UniformSpace A := ⊥ + let : UniformSpace B := ⊥ + let : ContinuousSMul R A := ⟨continuous_of_discreteTopology⟩ + let : ContinuousSMul S B := ⟨continuous_of_discreteTopology⟩ + have hcm : Continuous (MvPowerSeries.map (σ:=σ) f) := by + apply continuous_pi + intro d + change Continuous (fun q : MvPowerSeries σ R => f (MvPowerSeries.coeff d q)) + exact (continuous_of_discreteTopology : Continuous f).comp (continuous_coeff R d) + have hcA : Continuous (nilEval R v hv : MvPowerSeries σ R → A) := MvPowerSeries.continuous_aeval _ + have hcB : Continuous (nilEval S (fun i => F (v i)) (fun i => (hv i).map F) : + MvPowerSeries σ S → B) := MvPowerSeries.continuous_aeval _ + have h := Continuous.ext_on (denseRange_toMvPowerSeries (σ:=σ) (R:=R)) + ((continuous_of_discreteTopology : Continuous F).comp hcA) + (hcB.comp hcm) (by + rintro _ ⟨r,rfl⟩ + have hm : MvPowerSeries.map f (r : MvPowerSeries σ R)= + (MvPolynomial.map f r : MvPowerSeries σ S) := by + ext d + simp only [MvPowerSeries.coeff_map,MvPolynomial.coeff_coe,MvPolynomial.coeff_map] + change F (nilEval R v hv (r : MvPowerSeries σ R))= + nilEval S (fun i => F (v i)) (fun i => (hv i).map F) (MvPowerSeries.map f (r : MvPowerSeries σ R)) + rw [hm,nilEval_coe,nilEval_coe] + clear hm + induction r using MvPolynomial.induction_on with + | C c => simpa only [MvPolynomial.aeval_C,MvPolynomial.map_C] using hF c + | add r s hr hs => simp only [map_add,hr,hs] + | mul_X r i hr => simp only [map_mul,MvPolynomial.aeval_X,MvPolynomial.map_X,hr]) + exact congr_fun h q + +end +end PD4Tensor + +namespace PD4Tensor +open MvPowerSeries.WithPiTopology +noncomputable section +variable {R A σ : Type*} [CommRing R] [CommRing A] [Algebra R A] [Finite σ] + (p : ℕ) [Fact p.Prime] [CharP R p] + + + +theorem nilEval_frobenius (v : σ → A) (hv : ∀ i, v i ^ p=0) + (q : MvPowerSeries σ R) : + nilEval R v (fun i => ⟨p,hv i⟩) q ^ p= + algebraMap R A (MvPowerSeries.constantCoeff q ^ p) := by + let : UniformSpace R := ⊥ + let : UniformSpace A := ⊥ + let : ContinuousSMul R A := ⟨continuous_of_discreteTopology⟩ + have hc : Continuous (nilEval R v (fun i => ⟨p,hv i⟩) : MvPowerSeries σ R → A) := + MvPowerSeries.continuous_aeval _ + have h := Continuous.ext_on (denseRange_toMvPowerSeries (σ:=σ) (R:=R)) + (hc.pow p) ((continuous_of_discreteTopology : Continuous (algebraMap R A)).comp + ((continuous_constantCoeff R).pow p)) (by + rintro _ ⟨r,rfl⟩ + change nilEval R v _ (r : MvPowerSeries σ R) ^ p= + algebraMap R A (MvPolynomial.constantCoeff r ^ p) + rw [show nilEval R v _ (r : MvPowerSeries σ R)=MvPolynomial.aeval v r from + nilEval_coe R v (fun i => ⟨p,hv i⟩) r] + induction r using MvPolynomial.induction_on with + | C c => simp + | add r s hr hs => + rw [←map_pow,add_pow_char,map_add,map_pow,map_pow,hr,hs] + simp only [map_add,add_pow_char] + | mul_X r i hr => + simp only [map_mul,MvPolynomial.aeval_X,mul_pow,hv,mul_zero, + MvPolynomial.constantCoeff_X,mul_zero,zero_pow (Fact.out : p.Prime).ne_zero,map_zero]) + exact congr_fun h q + +end +end PD4Tensor + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K σ : Type*) [CommRing K] [Fintype σ] [DecidableEq σ] (e : σ → ℕ) + +def constantMap (he : ∀ i, 0 0) (fun i => zero_pow (Nat.ne_of_gt (he i))) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem constantMap_coord (he : ∀ i, 0 (0 : K)) r=MvPolynomial.constantCoeff r + simp + +omit [Fintype σ] [DecidableEq σ] in +theorem constantMap_surjective (he : ∀ i, 0 + rw [MvPolynomial.constantCoeff_C] + change algebraMap K (Ring K σ e) c ^ p=_ + exact (map_pow _ _ _).symm + | add r s hr hs => + rw [←map_pow,add_pow_char,map_add,map_pow,map_pow,hr,hs] + simp only [map_add,add_pow_char] + | mul_X r i hr => + rw [map_mul,mul_pow] + change _ * coord K σ e i ^ p=_ + rw [pow_eq_zero_of_le (hep i) (coord_pow K σ e i),mul_zero] + simp [zero_pow (Fact.out : p.Prime).ne_zero] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (K ι σ : Type*) [Field K] [Fintype ι] [DecidableEq ι] + [Fintype σ] [DecidableEq σ] (e : ι → ℕ) (p : ℕ) [Fact p.Prime] [CharP K p] + +omit [Fintype ι] [DecidableEq ι] [Fact p.Prime] in +private theorem parameter_charP (he : ∀ i, 0 p) →ₐ[Ring K ι e] Ring (Ring K ι e) σ (fun _ => p) := by + letI : CharP (Ring K ι e) p := parameter_charP K ι e p he + exact evaluate (fun j => nilEval (Ring K ι e) (coord (Ring K ι e) σ (fun _ => p)) + (fun i => ⟨p,coord_pow _ _ _ i⟩) (c j)) (by + intro j + rw [nilEval_frobenius p _ (fun i => coord_pow _ _ _ i), + pow_eq_constantMap K ι e p he hep,hc] + simp [zero_pow (Fact.out : p.Prime).ne_zero]) + +omit [Fintype ι] [DecidableEq ι] [DecidableEq σ] in +@[simp] theorem movingSubst_coord (he : ∀ i, 0 p) j)= + nilEval (Ring K ι e) (coord (Ring K ι e) σ (fun _ => p)) + (fun i => ⟨p,coord_pow _ _ _ i⟩) (c j) := evaluate_coord _ _ j + + + +omit [Fintype ι] [DecidableEq ι] [DecidableEq σ] in +theorem movingSubst_central (he : ∀ i, 0 p) he + (movingSubst K ι σ e p he hep c hc (coord (Ring K ι e) σ (fun _ => p) j))= + FrobeniusTruncation.formalEval K σ p + (MvPowerSeries.map (constantMap K ι e he).toRingHom (c j)) := by + rw [movingSubst_coord] + have hh := nilEval_coefficients (constantMap K ι e he).toRingHom + (coefficientSpecialization K ι σ e (fun _ => p) he).toRingHom + (coefficientSpecialization_scalar K ι e σ (fun _ => p) he) + (coord (Ring K ι e) σ (fun _ => p)) (fun i => ⟨p,coord_pow _ _ _ i⟩) (c j) + simp only [AlgHom.toRingHom_eq_coe,AlgHom.coe_toRingHom,coefficientSpecialization_coord] at hh + convert hh using 1; rfl + + + +omit [DecidableEq ι] in +theorem movingSubst_bijective (he : ∀ i, 0 constantMap K ι e he + (MvPowerSeries.coeff (Finsupp.single j 1) (c i)))≠0) : + Function.Bijective (movingSubst K ι σ e p he hep c hc) := by + let c₀ (j : σ) := MvPowerSeries.map (constantMap K ι e he).toRingHom (c j) + have hc₀ (j : σ) : MvPowerSeries.constantCoeff (c₀ j)=0 := by + change (constantMap K ι e he).toRingHom (MvPowerSeries.constantCoeff (c j))=0 + exact hc j + have hM₀ : Matrix.det (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (c₀ i))≠0 := by + change Matrix.det (fun i j => (constantMap K ι e he).toRingHom + (MvPowerSeries.coeff (Finsupp.single j 1) (c i)))≠0 + exact hM + let C := AlgEquiv.ofBijective (FrobeniusTruncation.formalSubst K σ p c₀ hc₀) + (FrobeniusTruncation.formalSubst_bijective K σ p c₀ hc₀ hM₀) + apply bijective_of_central_equiv K ι σ e (fun _ => p) he C + intro j + change _=FrobeniusTruncation.formalSubst K σ p c₀ hc₀ (FrobeniusTruncation.coord K σ p j) + rw [FrobeniusTruncation.formalSubst_coord] + exact movingSubst_central K ι σ e p he hep c hc j + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] + (p : ℕ) [CharP K p] [Fact p.Prime] + +abbrev constant : Ring K σ p →ₐ[K] K := + FiniteCoordinates.constantMap K σ (fun _ => p) (fun _ => (Fact.out : p.Prime).pos) + +omit [Fintype σ] [DecidableEq σ] [CharP K p] in +@[simp] theorem constant_coord (i : σ) : constant K σ p (coord K σ p i)=0 := + FiniteCoordinates.constantMap_coord _ _ _ _ i + +omit [Fintype σ] [DecidableEq σ] [CharP K p] in +@[simp] theorem constant_mk (f : MvPolynomial σ K) : + constant K σ p (Ideal.Quotient.mk (ideal K σ p) f)=MvPolynomial.constantCoeff f := + FiniteCoordinates.constantMap_mk _ _ _ _ f + + + +omit [Fintype σ] [DecidableEq σ] [CharP K p] in +@[simp] theorem constant_hom (q : Ring K σ p →ₐ[K] Ring K σ p) (a : Ring K σ p) : + constant K σ p (q a)=constant K σ p a := by + have h : (constant K σ p).comp q=constant K σ p := by + apply FiniteCoordinates.hom_ext + intro i + change constant K σ p (q (coord K σ p i))=constant K σ p (coord K σ p i) + rw [constant_coord] + apply (pow_eq_zero_iff (Fact.out : p.Prime).ne_zero).mp + rw [←map_pow,←map_pow,variable_pow,map_zero,map_zero] + exact AlgHom.congr_fun h a + +def tangentCoeff (j : σ) : Ring K σ p →ₗ[K] K := + (constant K σ p).toLinearMap.comp (derivative K σ p j) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem tangentCoeff_mk (j : σ) (f : MvPolynomial σ K) : + tangentCoeff K σ p j (Ideal.Quotient.mk (ideal K σ p) f)= + f.coeff (Finsupp.single j 1) := by + change constant K σ p (derivative K σ p j (Ideal.Quotient.mk (ideal K σ p) f))=_ + rw [derivative_mk,constant_mk,MvPolynomial.constantCoeff_eq,MvPolynomial.coeff_pderiv] + simp + +omit [Fintype σ] in +@[simp] theorem tangentCoeff_coord (j i : σ) : + tangentCoeff K σ p j (coord K σ p i)=if i=j then 1 else 0 := by + rw [coord,tangentCoeff_mk] + by_cases h : i=j + · subst i; simp + · simp [MvPolynomial.coeff_X,Finsupp.single_eq_single_iff,h] + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem tangentCoeff_scalar (j : σ) (a : K) : + tangentCoeff K σ p j (algebraMap K (Ring K σ p) a)=0 := by + change constant K σ p (derivative K σ p j + (Ideal.Quotient.mk (ideal K σ p) (MvPolynomial.C a)))=0 + rw [derivative_mk,MvPolynomial.pderiv_C,map_zero,map_zero] + +omit [Fintype σ] [DecidableEq σ] in +theorem tangentCoeff_mul (j : σ) (a b : Ring K σ p) : + tangentCoeff K σ p j (a*b)= + tangentCoeff K σ p j a * constant K σ p b + + constant K σ p a * tangentCoeff K σ p j b := by + change constant K σ p (derivative K σ p j (a*b))=_ + rw [derivative_mul,map_add,map_mul,map_mul] + rfl + + +theorem tangentCoeff_hom (q : Ring K σ p →ₐ[K] Ring K σ p) + (j : σ) (a : Ring K σ p) : + tangentCoeff K σ p j (q a)= + ∑ i, tangentCoeff K σ p i a * tangentCoeff K σ p j (q (coord K σ p i)) := by + obtain ⟨f,rfl⟩ := Ideal.Quotient.mk_surjective a + induction f using MvPolynomial.induction_on with + | C a => + change tangentCoeff K σ p j (q (algebraMap K (Ring K σ p) a))= + ∑ i, tangentCoeff K σ p i (algebraMap K (Ring K σ p) a) * _ + simp only [q.commutes,tangentCoeff_scalar,zero_mul,Finset.sum_const_zero] + | add f g hf hg => + simp only [map_add,hf,hg,add_mul,Finset.sum_add_distrib] + | mul_X f i hf => + simp only [map_mul,show Ideal.Quotient.mk (ideal K σ p) + (MvPolynomial.X i)=coord K σ p i from rfl,tangentCoeff_mul,constant_hom, + constant_coord,mul_zero,zero_add,tangentCoeff_coord] + simp + +def tangentHom (q : Ring K σ p →ₐ[K] Ring K σ p) : Matrix σ σ K := + fun i j => tangentCoeff K σ p j (q (coord K σ p i)) + +omit [Fintype σ] in +@[simp] theorem tangentHom_id : tangentHom K σ p (AlgHom.id K (Ring K σ p))=1 := by + ext i j + simp [tangentHom,Matrix.one_apply] + +theorem tangentHom_comp (q r : Ring K σ p →ₐ[K] Ring K σ p) : + tangentHom K σ p (q.comp r)=tangentHom K σ p r * tangentHom K σ p q := by + ext i j + exact tangentCoeff_hom K σ p q j (r (coord K σ p i)) + + + +theorem tangentHom_det_ne_zero (q : Ring K σ p ≃ₐ[K] Ring K σ p) : + Matrix.det (tangentHom K σ p q.toAlgHom)≠0 := by + have hc : q.toAlgHom.comp q.symm.toAlgHom=AlgHom.id K (Ring K σ p) := by + apply AlgHom.ext + intro a + exact q.apply_symm_apply a + have h := congrArg Matrix.det (tangentHom_comp K σ p q.toAlgHom q.symm.toAlgHom) + rw [hc,tangentHom_id,Matrix.det_one,Matrix.det_mul] at h + intro hz + rw [hz,mul_zero] at h + exact one_ne_zero h + + + +theorem inverse_representatives (q : Ring K σ p ≃ₐ[K] Ring K σ p) + (f : σ → MvPolynomial σ K) + (hf : ∀ i, Ideal.Quotient.mk (ideal K σ p) (f i)=q (coord K σ p i)) : + (∀ i, MvPolynomial.constantCoeff (f i)=0) ∧ (tangentMatrix K σ f).det≠0 := by + constructor + · intro i + rw [←constant_mk K σ p,hf] + change constant K σ p (q.toAlgHom (coord K σ p i))=0 + rw [constant_hom,constant_coord] + · have h : tangentMatrix K σ f=tangentHom K σ p q.toAlgHom := by + ext i j + change (f i).coeff (Finsupp.single j 1)= + tangentCoeff K σ p j (q (coord K σ p i)) + rw [←hf,tangentCoeff_mk] + rw [h] + exact tangentHom_det_ne_zero K σ p q + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +variable (R σ τ : Type*) [CommRing R] [Fintype σ] [DecidableEq σ] + [Fintype τ] [DecidableEq τ] (p : ℕ) + +def renameHom (e : σ → τ) : Ring R σ (fun _ => p) →ₐ[R] Ring R τ (fun _ => p) := + evaluate (fun i => coord R τ (fun _ => p) (e i)) (fun _ => coord_pow _ _ _ _) + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +@[simp] theorem renameHom_coord (e : σ → τ) (i : σ) : + renameHom R σ τ p e (coord R σ (fun _ => p) i)=coord R τ (fun _ => p) (e i) := + evaluate_coord _ _ _ + +def reindexEquiv (e : σ ≃ τ) : Ring R σ (fun _ => p) ≃ₐ[R] Ring R τ (fun _ => p) := + AlgEquiv.ofAlgHom (renameHom R σ τ p e) (renameHom R τ σ p e.symm) + (by apply hom_ext; intro i; simp only [AlgHom.comp_apply,renameHom_coord, + Equiv.apply_symm_apply,AlgHom.id_apply]) + (by apply hom_ext; intro i; simp only [AlgHom.comp_apply,renameHom_coord, + Equiv.symm_apply_apply,AlgHom.id_apply]) + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +@[simp] theorem reindexEquiv_coord (e : σ ≃ τ) (i : σ) : + reindexEquiv R σ τ p e (coord R σ (fun _ => p) i)=coord R τ (fun _ => p) (e i) := + renameHom_coord R σ τ p e i + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +@[simp] theorem reindexEquiv_symm_coord (e : σ ≃ τ) (i : τ) : + (reindexEquiv R σ τ p e).symm (coord R τ (fun _ => p) i)= + coord R σ (fun _ => p) (e.symm i) := renameHom_coord R τ σ p e.symm i + +def uniformLeft (hp : 0 p) →ₐ[R] Ring R σ (fun _ => p) := + evaluate (Sum.elim (coord R σ (fun _ => p)) (fun _ => 0)) (by + intro i + cases i with + | inl i => exact coord_pow _ _ _ i + | inr i => exact zero_pow (Nat.ne_of_gt hp)) + +def uniformInclude : Ring R σ (fun _ => p) →ₐ[R] Ring R (σ ⊕ τ) (fun _ => p) := + renameHom R σ (σ ⊕ τ) p Sum.inl + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +@[simp] theorem uniformLeft_coord (hp : 0 p) i)= + Sum.elim (coord R σ (fun _ => p)) (fun _ => 0) i := evaluate_coord _ _ _ + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +@[simp] theorem uniformLeft_include (hp : 0 p)) : + uniformLeft R σ τ p hp (uniformInclude R σ τ p a)=a := by + have h : (uniformLeft R σ τ p hp).comp (uniformInclude R σ τ p)=AlgHom.id R _ := by + apply hom_ext + intro i + simp only [AlgHom.comp_apply,uniformInclude,renameHom_coord,uniformLeft_coord, + Sum.elim_inl,AlgHom.id_apply] + exact AlgHom.congr_fun h a + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +theorem uniformLeft_surjective (hp : 0 ⟨uniformInclude R σ τ p a,uniformLeft_include R σ τ p hp a⟩ + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +theorem uniformLeft_ker (hp : 0 coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j))) := by + let J := Ideal.span (Set.range (fun j => coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j))) + apply le_antisymm + · intro a ha + change uniformLeft R σ τ p hp a=0 at ha + have h := error_mem J ((uniformInclude R σ τ p).comp (uniformLeft R σ τ p hp)) (by + intro i + cases i with + | inl i => + simp only [AlgHom.comp_apply,uniformLeft_coord,Sum.elim_inl,uniformInclude, + renameHom_coord,sub_self,Ideal.zero_mem] + | inr j => + simp only [AlgHom.comp_apply,uniformLeft_coord,Sum.elim_inr,map_zero,sub_zero] + exact Ideal.subset_span (Set.mem_range_self j)) a + simpa only [AlgHom.comp_apply,ha,map_zero,sub_zero] using h + · apply Ideal.span_le.mpr + rintro _ ⟨j,rfl⟩ + change uniformLeft R σ τ p hp (coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j))=0 + simp only [uniformLeft_coord,Sum.elim_inr] + +variable {R σ τ p} + +def splitRestriction {υ : Type*} [Fintype υ] [DecidableEq υ] + (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) : + Ring R υ (fun _ => p) →ₐ[R] Ring R σ (fun _ => p) := + (uniformLeft R σ τ p hp).comp + ((reindexEquiv R υ (σ ⊕ τ) p e).toAlgHom.comp q.toAlgHom) + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +theorem splitRestriction_surjective {υ : Type*} [Fintype υ] [DecidableEq υ] + (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) : + Function.Surjective (splitRestriction hp e q) := + (uniformLeft_surjective R σ τ p hp).comp + ((reindexEquiv R υ (σ ⊕ τ) p e).surjective.comp q.surjective) + + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] in +theorem splitRestriction_ker {υ : Type*} [Fintype υ] [DecidableEq υ] + (hp : 0 p) ≃ₐ[R] Ring R υ (fun _ => p)) : + RingHom.ker (splitRestriction hp e q).toRingHom= + Ideal.span (Set.range (fun j => q.symm (coord R υ (fun _ => p) (e.symm (Sum.inr j))))) := by + let E := reindexEquiv R υ (σ ⊕ τ) p e + let Q := q.trans E + have h : RingHom.ker (splitRestriction hp e q).toRingHom= + Ideal.comap Q.toRingHom (Ideal.span (Set.range (fun j => coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j)))) := by + rw [←uniformLeft_ker R σ τ p hp] + rfl + rw [h] + have hm : Ideal.comap Q.toRingHom (Ideal.span (Set.range (fun j => coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j))))= + (Ideal.span (Set.range (fun j => coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j)))).map Q.symm.toRingHom := by + ext a + rw [Ideal.mem_map_iff_of_surjective Q.symm.toRingHom Q.symm.surjective] + constructor + · intro ha + exact ⟨Q a,ha,Q.symm_apply_apply a⟩ + · rintro ⟨b,hb,rfl⟩ + change Q (Q.symm b)∈Ideal.span (Set.range (fun j => + coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j))) + rwa [Q.apply_symm_apply] + rw [hm,Ideal.map_span] + congr 1 + ext a + simp only [Set.mem_image,Set.mem_range] + constructor + · rintro ⟨b,⟨j,rfl⟩,rfl⟩ + refine ⟨j,?_⟩ + change q.symm (coord R υ (fun _ => p) (e.symm (Sum.inr j)))= + q.symm (E.symm (coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j))) + rw [reindexEquiv_symm_coord] + · rintro ⟨j,rfl⟩ + refine ⟨coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j),⟨j,rfl⟩,?_⟩ + change q.symm (E.symm (coord R (σ ⊕ τ) (fun _ => p) (Sum.inr j)))=_ + rw [reindexEquiv_symm_coord] + +end +end PD4Tensor.FiniteCoordinates +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/NilpotentRoots.lean b/lean/OAI/Algebra/FiniteTensor/NilpotentRoots.lean new file mode 100644 index 0000000000000000000000000000000000000000..00160f894ae246a6304dcb3d98f54f088311c003 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/NilpotentRoots.lean @@ -0,0 +1,378 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.JetSystems +import OAI.Algebra.FiniteTensor.PositiveObstruction + +namespace OAI + +/-! Parameter-series equivalences, nilpotent root lifting and algebraic descent. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable (A : Type*) [CommRing A] (m : ℕ) (σ : Type*) + + + +def parametersToSeries : Parameters (MvPowerSeries σ A) m →+* + MvPowerSeries σ (Parameters A m) := + Ideal.Quotient.lift (squareIdeal (MvPowerSeries σ A) m) + (MvPolynomial.eval₂Hom (MvPowerSeries.map (algebraMap A (Parameters A m))) + (fun i=>MvPowerSeries.C (parameter A m i))) (by + have h : squareIdeal (MvPowerSeries σ A) m≤RingHom.ker + (MvPolynomial.eval₂Hom (MvPowerSeries.map (algebraMap A (Parameters A m))) + (fun i=>MvPowerSeries.C (parameter A m i))) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change (MvPolynomial.eval₂Hom _ _) (MvPolynomial.X i ^ 2) = 0 + rw [map_pow,MvPolynomial.eval₂Hom_X',←map_pow,parameter_sq,map_zero] + exact fun a ha=>h ha) + +@[simp] theorem parametersToSeries_algebraMap (f : MvPowerSeries σ A) : + parametersToSeries A m σ (algebraMap (MvPowerSeries σ A) (Parameters (MvPowerSeries σ A) m) f)= + MvPowerSeries.map (algebraMap A (Parameters A m)) f := by + change (MvPolynomial.eval₂Hom _ _) (MvPolynomial.C f)=_ + exact MvPolynomial.eval₂Hom_C _ _ _ + +@[simp] theorem parametersToSeries_parameter (i : Fin m) : + parametersToSeries A m σ (parameter (MvPowerSeries σ A) m i)= + MvPowerSeries.C (parameter A m i) := by + change (MvPolynomial.eval₂Hom _ _) (MvPolynomial.X i)=_ + exact MvPolynomial.eval₂Hom_X' _ _ _ + + theorem parametersToSeries_boxMonomial (q : Box m) : + parametersToSeries A m σ (boxMonomial (MvPowerSeries σ A) m q)= + MvPowerSeries.C (boxMonomial A m q) := by + change (MvPolynomial.eval₂Hom _ _) (MvPolynomial.monomial (boxExponent m q) 1)=_ + rw [MvPolynomial.eval₂Hom_monomial,map_one,one_mul] + unfold boxMonomial + rw [MvPolynomial.monomial_eq] + simp only [map_one,one_mul,Finsupp.prod,map_prod,map_pow,parameter] + + theorem parametersToSeries_eq_assemble (f : Parameters (MvPowerSeries σ A) m) : + parametersToSeries A m σ f=assembleBox (fun q=>boxCoeff (MvPowerSeries σ A) m q f) := by + conv_lhs => rw [←sum_boxMonomial (MvPowerSeries σ A) m f] + rw [map_sum] + unfold assembleBox + apply Finset.sum_congr rfl + intro q _ + rw [Algebra.smul_def (R:=MvPowerSeries σ A) (A:=Parameters (MvPowerSeries σ A) m),map_mul,parametersToSeries_algebraMap,parametersToSeries_boxMonomial] + exact mul_comm _ _ + +@[simp] theorem boxSeries_parametersToSeries (f : Parameters (MvPowerSeries σ A) m) (q : Box m) : + boxSeries A m q (parametersToSeries A m σ f)=boxCoeff (MvPowerSeries σ A) m q f := by + rw [parametersToSeries_eq_assemble,boxSeries_assembleBox] + + theorem parametersToSeries_bijective : Function.Bijective (parametersToSeries A m σ) := by + constructor + · intro f g h + apply parameters_ext (MvPowerSeries σ A) m + intro q + rw [←boxSeries_parametersToSeries,←boxSeries_parametersToSeries,h] + · intro f + refine ⟨∑ q:Box m,boxSeries A m q f • boxMonomial (MvPowerSeries σ A) m q,?_⟩ + calc + _ = ∑ q:Box m,MvPowerSeries.C (boxMonomial A m q)* + MvPowerSeries.map (algebraMap A (Parameters A m)) (boxSeries A m q f) := by + rw [map_sum] + apply Finset.sum_congr rfl + intro q _ + rw [Algebra.smul_def (R:=MvPowerSeries σ A) (A:=Parameters (MvPowerSeries σ A) m),map_mul,parametersToSeries_algebraMap,parametersToSeries_boxMonomial] + exact mul_comm _ _ + _ = f := sum_boxSeries A m f + +def seriesParameterEquiv : MvPowerSeries σ (Parameters A m) ≃+* Parameters (MvPowerSeries σ A) m := + (RingEquiv.ofBijective (parametersToSeries A m σ) (parametersToSeries_bijective A m σ)).symm + + theorem boxCoeff_seriesParameterEquiv (f : MvPowerSeries σ (Parameters A m)) (q : Box m) : + boxCoeff (MvPowerSeries σ A) m q (seriesParameterEquiv A m σ f)=boxSeries A m q f := by + rw [←boxSeries_parametersToSeries] + change boxSeries A m q ((seriesParameterEquiv A m σ).symm (seriesParameterEquiv A m σ f))=_ + rw [RingEquiv.symm_apply_apply] + +@[simp] theorem seriesParameterEquiv_map (f : MvPowerSeries σ A) : + seriesParameterEquiv A m σ (MvPowerSeries.map (algebraMap A (Parameters A m)) f)= + algebraMap (MvPowerSeries σ A) (Parameters (MvPowerSeries σ A) m) f := by + apply (seriesParameterEquiv A m σ).symm.injective + rw [RingEquiv.symm_apply_apply] + exact (parametersToSeries_algebraMap A m σ f).symm + + theorem augmentation_eq_boxCoeff_zero (x : Parameters A m) : + augmentation A m x=boxCoeff A m (fun _=>0) x := by + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective x + change MvPolynomial.eval₂Hom (RingHom.id A) (fun _=>0) p=p.coeff _ + have hz : boxExponent m (fun _=>0)=0 := by ext i; simp + rw [hz] + exact MvPolynomial.eval₂Hom_zero_apply (RingHom.id A) p + + theorem augmentation_seriesParameterEquiv (f : MvPowerSeries σ (Parameters A m)) : + augmentation (MvPowerSeries σ A) m (seriesParameterEquiv A m σ f)= + MvPowerSeries.map (augmentation A m) f := by + rw [augmentation_eq_boxCoeff_zero,boxCoeff_seriesParameterEquiv] + ext d + rw [coeff_boxSeries,MvPowerSeries.coeff_map,augmentation_eq_boxCoeff_zero] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open Polynomial +open scoped Ring + + + +theorem root_lift_nilpotent {R : Type*} [CommRing R] (I : Ideal R) (hI : IsNilpotent I) + (f : Polynomial R) (a₀ : R) (h₀ : f.eval a₀∈I) + (hd : IsUnit (f.derivative.eval a₀)) : + ∃ a : R,f.eval a=0 ∧ a-a₀∈I := by + classical + let f' := f.derivative + let c : ℕ → R := fun n=>Nat.recOn n a₀ (fun _ b=>b-f.eval b*(f'.eval b)⁻¹ʳ) + have hc (n : ℕ) : c (n+1)=c n-f.eval (c n)*(f'.eval (c n))⁻¹ʳ := rfl + have hc_mod (n : ℕ) : c n≡a₀ [SMOD I] := by + induction n with + | zero => rfl + | succ n ih => + rw [hc,sub_eq_add_neg,←add_zero a₀] + refine ih.add ?_ + rw [SModEq.zero,Ideal.neg_mem_iff] + refine I.mul_mem_right _ ?_ + rw [←SModEq.zero] at h₀ ⊢ + exact (ih.eval f).trans h₀ + have hd_c (n : ℕ) : IsUnit (f'.eval (c n)) := by + apply hI.isUnit_quotient_mk_iff.mp + have heq := SModEq.def.mp ((hc_mod n).eval f') + change (Ideal.Quotient.mk I) (f'.eval (c n)) = (Ideal.Quotient.mk I) (f'.eval a₀) at heq + rw [heq] + exact hd.map (Ideal.Quotient.mk I) + have hfc (n : ℕ) : f.eval (c n)∈I^(n+1) := by + induction n with + | zero => simpa only [c,Nat.rec_zero,zero_add,pow_one] using h₀ + | succ n ih => + rw [←taylor_eval_sub (c n),hc,sub_eq_add_neg,sub_eq_add_neg,add_neg_cancel_comm] + rw [eval_eq_sum,sum_over_range' _ _ _ (lt_add_of_pos_right _ zero_lt_two),← + Finset.sum_range_add_sum_Ico _ (Nat.le_add_left _ _)] + swap + · intro i + rw [zero_mul] + refine Ideal.add_mem _ ?_ ?_ + · rw [←one_add_one_eq_two,Finset.sum_range_succ,Finset.range_one,Finset.sum_singleton, + taylor_coeff_zero,taylor_coeff_one,pow_zero,pow_one,mul_one,mul_neg, + mul_left_comm,Ring.mul_inverse_cancel _ (hd_c n),mul_one,add_neg_cancel] + exact Ideal.zero_mem _ + · refine Submodule.sum_mem _ ?_ + simp only [Finset.mem_Ico] + rintro i ⟨h2i,_⟩ + have hle : n + 2 ≤ i * (n + 1) := by nlinarith + refine Ideal.mul_mem_left _ _ (Ideal.pow_le_pow_right hle ?_) + rw [pow_mul'] + exact Ideal.pow_mem_pow ((Ideal.neg_mem_iff _).mpr (Ideal.mul_mem_right _ _ ih)) _ + obtain ⟨N,hN⟩ := hI + refine ⟨c N,?_,?_⟩ + · have hm : f.eval (c N)∈I^N := Ideal.pow_le_pow_right (Nat.le_succ N) (hfc N) + simpa only [hN,Ideal.zero_eq_bot,Ideal.mem_bot] using hm + · exact SModEq.sub_mem.mp (hc_mod N) + + + +theorem root_unique_nilpotent {R : Type*} [CommRing R] + (f : Polynomial R) (a b : R) (ha : f.eval a=0) (hb : f.eval b=0) + (hnil : IsNilpotent (b-a)) (hd : IsUnit (f.derivative.eval a)) : a=b := by + obtain ⟨c,hc⟩ := Polynomial.exists_mul_sq_add_linear_part_eq_eval_add f a (b-a) + have hz : (c*(b-a)+f.derivative.eval a)*(b-a)=0 := by + rw [show a+(b-a)=b by abel] at hc + rw [ha,hb] at hc + linear_combination hc + have hu : IsUnit (c*(b-a)+f.derivative.eval a) := + (show IsNilpotent (c*(b-a)) from by + obtain ⟨N,hN⟩ := hnil + exact ⟨N,by rw [mul_pow,hN,mul_zero]⟩).isUnit_add_right_of_commute hd (Commute.all _ _) + have hzero : b-a=0 := (hu.mul_right_eq_zero).mp hz + exact (sub_eq_zero.mp hzero).symm + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable (A : Type*) [CommRing A] (m : ℕ) + + theorem parameterIdeal_nilpotent : IsNilpotent (parameterIdeal A m) := by + apply (Ideal.FG.isNilpotent_iff_le_nilradical ?_).mpr (parameterIdeal_le_nilradical A m) + exact Submodule.fg_span (Set.finite_range (parameter A m)) + + theorem parameter_sub_constant_mem (x : Parameters A m) : + x-algebraMap A (Parameters A m) (augmentation A m x)∈parameterIdeal A m := by + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective x + induction p using MvPolynomial.induction_on with + | C a => + change algebraMap A (Parameters A m) a-algebraMap A (Parameters A m) + (augmentation A m (algebraMap A (Parameters A m) a))∈parameterIdeal A m + simp + | add p q hp hq => + simpa only [map_add,add_sub_add_comm] using (parameterIdeal A m).add_mem hp hq + | mul_X p i _ => + simp only [map_mul,show Ideal.Quotient.mk (squareIdeal A m) (MvPolynomial.X i)= + parameter A m i from rfl,augmentation_parameter,mul_zero,map_zero,sub_zero] + exact Ideal.mul_mem_left _ _ (Ideal.subset_span (Set.mem_range_self i)) + + theorem parameter_mem_iff_augmentation_zero (x : Parameters A m) : + x∈parameterIdeal A m ↔ augmentation A m x=0 := by + constructor + · intro hx + have hle : parameterIdeal A m ≤ RingHom.ker (augmentation A m) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact augmentation_parameter A m i + exact hle hx + · intro hx + simpa only [hx,map_zero,sub_zero] using parameter_sub_constant_mem A m x + + theorem parameter_isUnit_of_augmentation {K : Type*} [Field K] (x : Parameters K m) + (hx : augmentation K m x≠0) : IsUnit x := by + have hn : IsNilpotent (x-algebraMap K (Parameters K m) (augmentation K m x)) := + mem_nilradical.mp (parameterIdeal_le_nilradical K m (parameter_sub_constant_mem K m x)) + have hu := (isUnit_iff_ne_zero.mpr hx).map (algebraMap K (Parameters K m)) + simpa only [add_sub_cancel] using hn.isUnit_add_left_of_commute hu (Commute.all _ _) + + + +theorem squarefree_root_descent {E : Type*} [Field E] (k : Subfield E) + (P : Polynomial (Parameters k m)) (x : Parameters E m) + (hx : (P.map (mapParameters k.subtype)).eval x=0) + (hx₀ : augmentation E m x∈k) + (hd : augmentation E m ((P.map (mapParameters k.subtype)).derivative.eval x)≠0) : + ∃ y : Parameters k m,mapParameters k.subtype y=x := by + let x₀ : k := ⟨augmentation E m x,hx₀⟩ + let a₀ : Parameters k m := algebraMap k (Parameters k m) x₀ + have comm (Q : Polynomial (Parameters k m)) (a : Parameters k m) : + k.subtype (augmentation k m (Q.eval a))= + augmentation E m ((Q.map (mapParameters k.subtype)).eval (mapParameters k.subtype a)) := by + rw [Polynomial.eval_map_apply,augmentation_mapParameters] + have haug (a : Parameters E m) (Q : Polynomial (Parameters E m)) : + augmentation E m (Q.eval a)= + (Q.map (augmentation E m)).eval (augmentation E m a) := by + rw [Polynomial.eval_map,Polynomial.eval₂_at_apply] + have ha₀ : augmentation E m (mapParameters k.subtype a₀)=augmentation E m x := by + simp only [a₀,augmentation_mapParameters,augmentation_algebraMap,x₀,Subfield.subtype_apply] + have hroot₀ : P.eval a₀∈parameterIdeal k m := by + rw [parameter_mem_iff_augmentation_zero] + apply k.subtype.injective + rw [comm,haug,ha₀,←haug,hx,map_zero,map_zero] + have hd₀ : IsUnit (P.derivative.eval a₀) := by + apply parameter_isUnit_of_augmentation m + intro hz + apply hd + rw [Polynomial.derivative_map, haug, ←ha₀, ←haug, ←comm, hz, map_zero] + obtain ⟨y,hy,hy₀⟩ := root_lift_nilpotent (parameterIdeal k m) + (parameterIdeal_nilpotent k m) P a₀ hroot₀ hd₀ + refine ⟨y,?_⟩ + have hy_map : (P.map (mapParameters k.subtype)).eval (mapParameters k.subtype y)=0 := by + rw [Polynomial.eval_map,Polynomial.eval₂_at_apply,hy,map_zero] + have hy_aug : augmentation E m (mapParameters k.subtype y)=augmentation E m x := by + have h := (parameter_mem_iff_augmentation_zero k m _).mp hy₀ + simp only [map_sub,sub_eq_zero] at h + rw [augmentation_mapParameters,h] + simpa only [augmentation_mapParameters] using ha₀ + apply root_unique_nilpotent (P.map (mapParameters k.subtype)) _ _ hy_map hx + · apply mem_nilradical.mp + apply parameterIdeal_le_nilradical E m + rw [parameter_mem_iff_augmentation_zero,map_sub,hy_aug,sub_self] + · apply parameter_isUnit_of_augmentation m + rw [haug,hy_aug,←haug] + exact hd + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable {R E : Type*} [CommRing R] [IsDomain R] [Field E] [Algebra R E] + + + +def algebraicSubfield : Subfield E where + carrier := {x | IsAlgebraic R x} + zero_mem' := isAlgebraic_zero + one_mem' := isAlgebraic_one + add_mem' := IsAlgebraic.add + mul_mem' := IsAlgebraic.mul + neg_mem' := IsAlgebraic.neg + inv_mem' := fun _ h=>h.inv + + theorem mem_algebraicSubfield (x : E) : + x∈algebraicSubfield (R:=R) (E:=E) ↔ IsAlgebraic R x := Iff.rfl + +variable (m : ℕ) + + theorem exists_parameter_lift (k : Subfield E) (x : Parameters E m) + (hx : ∀ q,boxCoeff E m q x∈k) : + ∃ y : Parameters k m,mapParameters k.subtype y=x := by + classical + refine ⟨∑ q:Box m,(⟨boxCoeff E m q x,hx q⟩ : k) • boxMonomial k m q,?_⟩ + apply parameters_ext E m + intro b + rw [boxCoeff_mapParameters] + change k.subtype _=k.subtype ⟨boxCoeff E m b x,hx b⟩ + congr 1 + simp only [map_sum,map_smul,boxCoeff_boxMonomial,smul_eq_mul,mul_ite,mul_one,mul_zero] + simp + + theorem mem_parameter_range (k : Subfield E) (x : Parameters E m) : + x∈(mapParameters (m:=m) k.subtype).range ↔ ∀ q,boxCoeff E m q x∈k := by + constructor + · rintro ⟨y,rfl⟩ q + rw [boxCoeff_mapParameters] + exact (boxCoeff k m q y).property + · exact exists_parameter_lift m k x + +def parameterRangeEquiv (k : Subfield E) : Parameters k m ≃+* + (mapParameters (m:=m) k.subtype).range := + RingEquiv.ofBijective (mapParameters (m:=m) k.subtype).rangeRestrict + ⟨fun _ _ h=>mapParameters_injective k.subtype k.subtype.injective (congrArg Subtype.val h), + RingHom.rangeRestrict_surjective _⟩ + + + +def liftParametersHom {A : Type*} [CommRing A] (k : Subfield E) + (f : A →+* Parameters E m) (hf : ∀ a,∀ q,boxCoeff E m q (f a)∈k) : + A →+* Parameters k m := + (parameterRangeEquiv m k).symm.toRingHom.comp + (f.codRestrict _ (fun a=>(mem_parameter_range m k (f a)).mpr (hf a))) + + theorem map_liftParametersHom {A : Type*} [CommRing A] (k : Subfield E) + (f : A →+* Parameters E m) (hf : ∀ a,∀ q,boxCoeff E m q (f a)∈k) (a : A) : + mapParameters k.subtype (liftParametersHom m k f hf a)=f a := by + change (mapParameters k.subtype) + ((parameterRangeEquiv m k).symm ⟨f a,_⟩)=f a + exact congrArg Subtype.val ((parameterRangeEquiv m k).apply_symm_apply ⟨f a,_⟩) + + theorem squarefree_root_algebraic (P : Polynomial (Parameters E m)) (x : Parameters E m) + (hP : ∀ n q,IsAlgebraic R (boxCoeff E m q (P.coeff n))) + (hx : P.eval x=0) (hx₀ : IsAlgebraic R (augmentation E m x)) + (hd : augmentation E m (P.derivative.eval x)≠0) : + ∀ q,IsAlgebraic R (boxCoeff E m q x) := by + let k := algebraicSubfield (R:=R) (E:=E) + have hp (n : ℕ) : ∃ y : Parameters k m,mapParameters k.subtype y=P.coeff n := + exists_parameter_lift m k (P.coeff n) (hP n) + let Q : Polynomial (Parameters k m) := + ∑ n∈P.support,Polynomial.monomial n (hp n).choose + have hQ : Q.map (mapParameters k.subtype)=P := by + unfold Q + rw [Polynomial.map_sum] + simp only [Polynomial.map_monomial,(hp _).choose_spec] + exact Polynomial.sum_monomial_eq P + obtain ⟨y,hy⟩ := squarefree_root_descent m k Q x (hQ.symm ▸ hx) hx₀ (hQ.symm ▸ hd) + intro q + rw [←hy,boxCoeff_mapParameters] + exact (boxCoeff k m q y).property + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/NilpotentSubstitution.lean b/lean/OAI/Algebra/FiniteTensor/NilpotentSubstitution.lean new file mode 100644 index 0000000000000000000000000000000000000000..c426e494c131ebf5e4f4ee6a88d2b0e06fbfe1a6 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/NilpotentSubstitution.lean @@ -0,0 +1,481 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.NilpotentRoots +import OAI.Algebra.FiniteTensor.PolynomialApproximation + +namespace OAI + +/-! Algebraicity of full nilpotent substitution and the scalar equation systems. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +variable (K : Type*) [Field K] (m : ℕ) (τ : Type*) + +abbrev SeriesFraction := FractionRing (MvPowerSeries τ K) + +def seriesFractionParameters : MvPowerSeries τ (Parameters K m) →+* + Parameters (SeriesFraction K τ) m := + (mapParameters (algebraMap (MvPowerSeries τ K) (SeriesFraction K τ))).comp + (seriesParameterEquiv K m τ).toRingHom + + theorem boxCoeff_seriesFractionParameters (f : MvPowerSeries τ (Parameters K m)) (q : Box m) : + boxCoeff (SeriesFraction K τ) m q (seriesFractionParameters K m τ f)= + algebraMap (MvPowerSeries τ K) (SeriesFraction K τ) (boxSeries K m q f) := by + rw [seriesFractionParameters,RingHom.comp_apply,RingEquiv.toRingHom_eq_coe,RingEquiv.coe_toRingHom,boxCoeff_mapParameters, + boxCoeff_seriesParameterEquiv] + + theorem augmentation_seriesFractionParameters (f : MvPowerSeries τ (Parameters K m)) : + augmentation (SeriesFraction K τ) m (seriesFractionParameters K m τ f)= + algebraMap (MvPowerSeries τ K) (SeriesFraction K τ) (MvPowerSeries.map (augmentation K m) f) := by + rw [seriesFractionParameters,RingHom.comp_apply,RingEquiv.toRingHom_eq_coe,RingEquiv.coe_toRingHom,augmentation_mapParameters, + augmentation_seriesParameterEquiv] + + theorem seriesFractionParameters_map (f : MvPowerSeries τ K) : + seriesFractionParameters K m τ (MvPowerSeries.map (algebraMap K (Parameters K m)) f)= + algebraMap (SeriesFraction K τ) (Parameters (SeriesFraction K τ) m) + (algebraMap (MvPowerSeries τ K) (SeriesFraction K τ) f) := by + rw [seriesFractionParameters,RingHom.comp_apply,RingEquiv.toRingHom_eq_coe,RingEquiv.coe_toRingHom,seriesParameterEquiv_map, + mapParameters_algebraMap] + + theorem map_augmentation_map (f : MvPowerSeries τ K) : + MvPowerSeries.map (augmentation K m) (MvPowerSeries.map (algebraMap K (Parameters K m)) f)=f := by + rw [MvPowerSeries.map_map] + have h : (augmentation K m).comp (algebraMap K (Parameters K m))=RingHom.id K := by + ext a + exact augmentation_algebraMap K m a + rw [h,MvPowerSeries.map_id,RingHom.id_apply] + +variable {K m τ} {σ : Type*} [Finite σ] (H : σ → MvPowerSeries τ (Parameters K m)) + (hH : MvPowerSeries.HasSubst H) + + + +def nilSubstitution : MvPowerSeries σ K →+* Parameters (SeriesFraction K τ) m := + (seriesFractionParameters K m τ).comp + ((MvPowerSeries.substAlgHom (R:=Parameters K m) hH).toRingHom.comp + (MvPowerSeries.map (algebraMap K (Parameters K m)))) + +omit [Finite σ] in + theorem nilSubstitution_apply (f : MvPowerSeries σ K) : + nilSubstitution H hH f=seriesFractionParameters K m τ + (MvPowerSeries.subst H (MvPowerSeries.map (algebraMap K (Parameters K m)) f)) := by + simp only [nilSubstitution,RingHom.comp_apply,AlgHom.toRingHom_eq_coe, + AlgHom.coe_toRingHom,MvPowerSeries.substAlgHom_apply] + +omit [Finite σ] in + theorem augmentation_nilSubstitution (j : σ ↪ τ) + (hcentral : ∀ i,MvPowerSeries.map (augmentation K m) (H i)=MvPowerSeries.X (j i)) + (f : MvPowerSeries σ K) : + augmentation (SeriesFraction K τ) m (nilSubstitution H hH f)= + algebraMap (MvPowerSeries τ K) (SeriesFraction K τ) (MvPowerSeries.rename j f) := by + rw [nilSubstitution_apply,augmentation_seriesFractionParameters, + MvPowerSeries.map_subst hH,map_augmentation_map] + congr 1 + rw [MvPowerSeries.rename_eq_subst] + congr 1 + funext i + exact hcentral i + +omit [Finite σ] in + theorem nilSubstitution_C (a : K) : + nilSubstitution H hH (MvPowerSeries.C a)= + algebraMap (SeriesFraction K τ) (Parameters (SeriesFraction K τ) m) + (algebraMap (MvPowerSeries τ K) (SeriesFraction K τ) (MvPowerSeries.C a)) := by + rw [nilSubstitution_apply,MvPowerSeries.map_C,MvPowerSeries.subst_C] + rw [←MvPowerSeries.map_C,seriesFractionParameters_map] + +omit [Finite σ] in + theorem nilSubstitution_X (i : σ) : + nilSubstitution H hH (MvPowerSeries.X i)=seriesFractionParameters K m τ (H i) := by + rw [nilSubstitution_apply,MvPowerSeries.map_X,MvPowerSeries.subst_X hH] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {K : Type*} [Field K] [CharZero K] {m : ℕ} {σ τ : Type*} [Finite σ] + +omit [CharZero K] in + theorem algebraic_constant_series (a : K) : + IsAlgebraic (MvPolynomial τ K) (MvPowerSeries.C (σ:=τ) a) := by + simpa only [MvPowerSeries.algebraMap_apply',MvPowerSeries.map_id, + Algebra.algebraMap_self,RingHom.id_apply,MvPolynomial.coe_C] using + (isAlgebraic_algebraMap (R:=MvPolynomial τ K) (A:=MvPowerSeries τ K) (MvPolynomial.C a)) + +omit [CharZero K] in + theorem algebraic_series_fraction_iff (f : MvPowerSeries τ K) : + IsAlgebraic (MvPolynomial τ K) + (algebraMap (MvPowerSeries τ K) (SeriesFraction K τ) f) ↔ + IsAlgebraic (MvPolynomial τ K) f := + isAlgebraic_algebraMap_iff (IsFractionRing.injective (MvPowerSeries τ K) (SeriesFraction K τ)) + + + +theorem algebraic_box_subst (H : σ → MvPowerSeries τ (Parameters K m)) + (hH : MvPowerSeries.HasSubst H) + (hHalg : ∀ i q,IsAlgebraic (MvPolynomial τ K) (boxSeries K m q (H i))) + (j : σ ↪ τ) + (hcentral : ∀ i,MvPowerSeries.map (augmentation K m) (H i)=MvPowerSeries.X (j i)) + (f : MvPowerSeries σ K) (hf : IsAlgebraic (MvPolynomial σ K) f) (q : Box m) : + IsAlgebraic (MvPolynomial τ K) (boxSeries K m q + (MvPowerSeries.subst H (MvPowerSeries.map (algebraMap K (Parameters K m)) f))) := by + classical + let E := SeriesFraction K τ + let k := algebraicSubfield (R:=MvPolynomial τ K) (E:=E) + let F := nilSubstitution H hH + let r : MvPolynomial σ K →+* Parameters E m := + F.comp (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K)) + let B := (mapParameters (m:=m) k.subtype).range + have hi : Function.Injective (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K)) := by + intro x y h + apply MvPolynomial.coe_injective σ K + simpa only [MvPowerSeries.algebraMap_apply',Algebra.algebraMap_self, + MvPowerSeries.map_id,RingHom.id_apply] using h + obtain ⟨P,_,hP,hD⟩ := exists_relation_derivative_ne_zero hi f hf + have hHmem (i : σ) : seriesFractionParameters K m τ (H i)∈B := by + apply (mem_parameter_range m k _).mpr + intro b + change IsAlgebraic (MvPolynomial τ K) _ + rw [boxCoeff_seriesFractionParameters,algebraic_series_fraction_iff] + exact hHalg i b + have hr (p : MvPolynomial σ K) : r p∈B := by + induction p using MvPolynomial.induction_on with + | C a => + have ha : algebraMap (MvPowerSeries τ K) E (MvPowerSeries.C a)∈k := + (algebraic_series_fraction_iff _).mpr (algebraic_constant_series a) + refine ⟨algebraMap k (Parameters k m) ⟨_,ha⟩,?_⟩ + rw [mapParameters_algebraMap] + change _=F (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K) (MvPolynomial.C a)) + simp only [MvPowerSeries.algebraMap_apply',Algebra.algebraMap_self, + MvPowerSeries.map_id,RingHom.id_apply,MvPolynomial.coe_C] + exact (nilSubstitution_C H hH a).symm + | add p q hp hq => + rw [map_add] + exact B.add_mem hp hq + | mul_X p i hp => + rw [map_mul] + apply B.mul_mem hp + change F (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K) (MvPolynomial.X i))∈B + simp only [MvPowerSeries.algebraMap_apply',Algebra.algebraMap_self, + MvPowerSeries.map_id,RingHom.id_apply,MvPolynomial.coe_X] + rw [show F (MvPowerSeries.X i)=seriesFractionParameters K m τ (H i) from nilSubstitution_X H hH i] + exact hHmem i + have ev (Q : Polynomial (MvPolynomial σ K)) : + (Q.map r).eval (F f)=F (Polynomial.aeval f Q) := by + change (Q.map (F.comp (algebraMap _ _))).eval (F f)=_ + rw [←Polynomial.map_map,Polynomial.eval_map_apply,Polynomial.eval_map,←Polynomial.aeval_def] + have hroot : (P.map r).eval (F f)=0 := by rw [ev,hP,map_zero] + have hconstant : IsAlgebraic (MvPolynomial τ K) (augmentation E m (F f)) := by + rw [show augmentation E m (F f)=algebraMap (MvPowerSeries τ K) E (MvPowerSeries.rename j f) + from augmentation_nilSubstitution H hH j hcentral f,algebraic_series_fraction_iff] + exact algebraic_series_rename j j.injective f hf + have hder : augmentation E m ((P.map r).derivative.eval (F f))≠0 := by + rw [Polynomial.derivative_map,ev] + rw [show augmentation E m (F (Polynomial.aeval f P.derivative))= + algebraMap (MvPowerSeries τ K) E (MvPowerSeries.rename j (Polynomial.aeval f P.derivative)) + from augmentation_nilSubstitution H hH j hcentral _] + intro hz + apply hD + apply MvPowerSeries.rename_injective j + rw [map_zero] + exact (IsFractionRing.injective (MvPowerSeries τ K) E) (by simpa only [map_zero] using hz) + have halg := squarefree_root_algebraic (R:=MvPolynomial τ K) m (P.map r) (F f) + (fun n b=>by + rw [Polynomial.coeff_map] + exact (mem_parameter_range m k _).mp (hr (P.coeff n)) b) hroot hconstant hder q + change IsAlgebraic _ (boxCoeff E m q (nilSubstitution H hH f)) at halg + rw [nilSubstitution_apply,boxCoeff_seriesFractionParameters,algebraic_series_fraction_iff] at halg + exact halg + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable (K : Type*) [Field K] (m : ℕ) (σ : Type*) + + + +def algebraicBoxRing : Subring (MvPowerSeries σ (Parameters K m)) := + ((mapParameters (m:=m) + (algebraicSubfield (R:=MvPolynomial σ K) (E:=SeriesFraction K σ)).subtype).range).comap + (seriesFractionParameters K m σ) + + theorem mem_algebraicBoxRing (f : MvPowerSeries σ (Parameters K m)) : + f∈algebraicBoxRing K m σ ↔ + ∀ q,IsAlgebraic (MvPolynomial σ K) (boxSeries K m q f) := by + change seriesFractionParameters K m σ f∈ + (mapParameters (m:=m) (algebraicSubfield (R:=MvPolynomial σ K) + (E:=SeriesFraction K σ)).subtype).range ↔ _ + rw [mem_parameter_range] + apply forall_congr' + intro q + change IsAlgebraic (MvPolynomial σ K) (boxCoeff (SeriesFraction K σ) m q + (seriesFractionParameters K m σ f)) ↔ _ + rw [boxCoeff_seriesFractionParameters] + exact isAlgebraic_algebraMap_iff + (IsFractionRing.injective (MvPowerSeries σ K) (SeriesFraction K σ)) + + theorem boxSeries_C (q : Box m) (a : Parameters K m) : + boxSeries K m q (MvPowerSeries.C (σ:=σ) a)=MvPowerSeries.C (boxCoeff K m q a) := by + classical + ext d + simp only [coeff_boxSeries,MvPowerSeries.coeff_C] + split <;> simp_all only [map_zero] + + theorem C_mem_algebraicBoxRing (a : Parameters K m) : + MvPowerSeries.C (σ:=σ) a∈algebraicBoxRing K m σ := by + apply (mem_algebraicBoxRing K m σ _).mpr + intro q + rw [boxSeries_C] + simpa only [MvPowerSeries.algebraMap_apply',MvPowerSeries.map_id, + Algebra.algebraMap_self,RingHom.id_apply,MvPolynomial.coe_C] using + (isAlgebraic_algebraMap (R:=MvPolynomial σ K) (A:=MvPowerSeries σ K) + (MvPolynomial.C (boxCoeff K m q a))) + + theorem map_mem_algebraicBoxRing (f : MvPowerSeries σ K) + (hf : IsAlgebraic (MvPolynomial σ K) f) : + MvPowerSeries.map (algebraMap K (Parameters K m)) f∈algebraicBoxRing K m σ := by + let E := SeriesFraction K σ + let k := algebraicSubfield (R:=MvPolynomial σ K) (E:=E) + have hf' : algebraMap (MvPowerSeries σ K) E f∈k := + (isAlgebraic_algebraMap_iff + (IsFractionRing.injective (MvPowerSeries σ K) E)).mpr hf + refine ⟨algebraMap k (Parameters k m) ⟨_,hf'⟩,?_⟩ + rw [mapParameters_algebraMap] + exact (seriesFractionParameters_map K m σ f).symm + + theorem assembleBox_mem_algebraicBoxRing (f : Box m → MvPowerSeries σ K) + (hf : ∀q,IsAlgebraic (MvPolynomial σ K) (f q)) : + assembleBox f∈algebraicBoxRing K m σ := by + apply (mem_algebraicBoxRing K m σ _).mpr + intro q + rw [boxSeries_assembleBox] + exact hf q + + theorem boxSeries_pderiv (i : σ) (q : Box m) (f : MvPowerSeries σ (Parameters K m)) : + boxSeries K m q (MvPowerSeries.pderiv i f)= + MvPowerSeries.pderiv i (boxSeries K m q f) := by + ext d + simp only [coeff_boxSeries,MvPowerSeries.coeff_pderiv] + simpa only [nsmul_eq_mul,Nat.cast_add,Nat.cast_one,mul_comm] using + (map_nsmul (boxCoeff K m q) (d i+1) (MvPowerSeries.coeff (d+Finsupp.single i 1) f)) + +variable [CharZero K] + theorem pderiv_mem_algebraicBoxRing (i : σ) (f : MvPowerSeries σ (Parameters K m)) + (hf : f∈algebraicBoxRing K m σ) : + MvPowerSeries.pderiv i f∈algebraicBoxRing K m σ := by + apply (mem_algebraicBoxRing K m σ _).mpr + intro q + rw [boxSeries_pderiv] + exact algebraic_series_pderiv i _ ((mem_algebraicBoxRing K m σ f).mp hf q) + +variable {K m σ} {τ : Type*} [Finite σ] + theorem subst_mem_algebraicBoxRing (H : σ → MvPowerSeries τ (Parameters K m)) + (hH : MvPowerSeries.HasSubst H) + (hHalg : ∀i,H i∈algebraicBoxRing K m τ) + (j : σ ↪ τ) + (hcentral : ∀i,MvPowerSeries.map (augmentation K m) (H i)=MvPowerSeries.X (j i)) + (f : MvPowerSeries σ (Parameters K m)) (hf : f∈algebraicBoxRing K m σ) : + MvPowerSeries.subst H f∈algebraicBoxRing K m τ := by + classical + rw [←assembleBox_boxSeries f,assembleBox,←MvPowerSeries.substAlgHom_apply hH,map_sum] + apply Subring.sum_mem + intro q _ + rw [map_mul,MvPowerSeries.substAlgHom_apply,MvPowerSeries.subst_C, + MvPowerSeries.substAlgHom_apply] + apply Subring.mul_mem _ (C_mem_algebraicBoxRing K m τ _) + apply (mem_algebraicBoxRing K m τ _).mpr + intro b + exact algebraic_box_subst H hH + (fun i b=>(mem_algebraicBoxRing K m τ _).mp (hHalg i) b) j hcentral _ + ((mem_algebraicBoxRing K m σ _).mp hf q) b + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +variable {K : Type*} [Field K] [CharZero K] + +omit [CharZero K] in + theorem algebraic_variable_series {σ : Type*} (i : σ) : + IsAlgebraic (MvPolynomial σ K) (MvPowerSeries.X (R:=K) i) := by + simpa only [MvPowerSeries.algebraMap_apply',MvPowerSeries.map_id, + Algebra.algebraMap_self,RingHom.id_apply,MvPolynomial.coe_X] using + (isAlgebraic_algebraMap (R:=MvPolynomial σ K) (A:=MvPowerSeries σ K) (MvPolynomial.X i)) + +omit [CharZero K] in + theorem algebraic_affineUnknown {σ : Type*} (i : σ) (a : K) : + IsAlgebraic (MvPolynomial σ K) (affineUnknown i a) := + by + unfold affineUnknown + exact (algebraic_variable_series (K:=K) i).add (algebraic_constant_series (τ:=σ) a) + +omit [CharZero K] in + theorem algebraic_series_sum {σ ι : Type*} (s : Finset ι) (f : ι → MvPowerSeries σ K) + (hf : ∀i∈s,IsAlgebraic (MvPolynomial σ K) (f i)) : + IsAlgebraic (MvPolynomial σ K) (∑i∈s,f i) := by + classical + induction s using Finset.induction_on with + | empty => simpa only [Finset.sum_empty] using (isAlgebraic_zero (R:=MvPolynomial σ K) (A:=MvPowerSeries σ K)) + | @insert i s hi ih => + rw [Finset.sum_insert hi] + exact (hf i (Finset.mem_insert_self i s)).add (ih (fun j hj=>hf j (Finset.mem_insert_of_mem hj))) + +omit [CharZero K] in + theorem map_augmentation_eq_boxSeries_zero {σ : Type*} {m : ℕ} + (f : MvPowerSeries σ (Parameters K m)) : + MvPowerSeries.map (augmentation K m) f=boxSeries K m (fun _=>0) f := by + ext d + simp only [MvPowerSeries.coeff_map,coeff_boxSeries,augmentation_eq_boxCoeff_zero] + +variable {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} +variable (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) + +omit [CharZero K] in + theorem algebraic_potential + (hF : ∀i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) : + IsAlgebraic (MvPolynomial ((i : Fin l) × Fin (n i)) K) + (potential K (fun i=>Fin (n i)) M.F) := by + apply algebraic_series_sum + intro i _ + exact algebraic_series_rename (Sigma.mk i) (fun _ _ h=>eq_of_heq (Sigma.mk.inj h).2) _ (hF i) + +omit [CharZero K] in + theorem algebraic_perturbation + (hb : ∀i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) (j : Fin m) : + IsAlgebraic (MvPolynomial ((i : Fin l) × Fin (n i)) K) + (perturbation K (fun i=>Fin (n i)) m active M.b j) := + algebraic_series_rename (Sigma.mk (active j)) (fun _ _ h=>eq_of_heq (Sigma.mk.inj h).2) _ (hb j) + +omit [CharZero K] in + theorem deformed_mem_algebraicBoxRing + (hF : ∀i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (hb : ∀i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) : + deformed K (fun i=>Fin (n i)) m M.F active M.b∈ + algebraicBoxRing K m ((i : Fin l) × Fin (n i)) := by + apply Subring.add_mem _ (map_mem_algebraicBoxRing K m _ _ (algebraic_potential M hF)) + apply Subring.sum_mem + intro j _ + exact Subring.mul_mem _ (C_mem_algebraicBoxRing K m _ _) + (map_mem_algebraicBoxRing K m _ _ (algebraic_perturbation M hb j)) + +omit [CharZero K] in + theorem universalLeftH_mem_algebraicBoxRing (v : (i : Fin l) × Fin (n i)) : + universalLeftH M v∈algebraicBoxRing K m (LeftUnknown ((i : Fin l) × Fin (n i)) m) := + assembleBox_mem_algebraicBoxRing K m _ _ (fun _=>algebraic_affineUnknown _ _) + +omit [CharZero K] in + theorem universalLeftP_mem_algebraicBoxRing (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + universalLeftP M W t v∈algebraicBoxRing K m (LeftUnknown ((i : Fin l) × Fin (n i)) m) := + assembleBox_mem_algebraicBoxRing K m _ _ (fun _=>algebraic_affineUnknown _ _) + + def leftCentralEmbedding : ((i : Fin l) × Fin (n i)) ↪ LeftUnknown ((i : Fin l) × Fin (n i)) m where + toFun := fun v=>.inl (v,fun _=>0) + inj' := fun _ _ h=>congrArg Prod.fst (Sum.inl.inj h) + +omit [CharZero K] in + theorem augmentation_universalLeftH (v : (i : Fin l) × Fin (n i)) : + MvPowerSeries.map (augmentation K m) (universalLeftH M v)= + MvPowerSeries.X (leftCentralEmbedding (m:=m) v) := by + rw [map_augmentation_eq_boxSeries_zero,universalLeftH,boxSeries_assembleBox,affineUnknown] + have hz : MvPowerSeries.constantCoeff (boxSeries K m (fun _=>0) (M.H v))=0 := by + change boxCoeff K m (fun _=>0) (MvPowerSeries.constantCoeff (M.H v))=0 + rw [←augmentation_eq_boxCoeff_zero] + exact (parameter_mem_iff_augmentation_zero K m _).mp (M.H_zero v) + rw [hz,map_zero,add_zero] + rfl + + theorem universalLeft_substitution_algebraic + (f : MvPowerSeries ((i : Fin l) × Fin (n i)) (Parameters K m)) + (hf : f∈algebraicBoxRing K m ((i : Fin l) × Fin (n i))) : + MvPowerSeries.subst (universalLeftH M) f∈ + algebraicBoxRing K m (LeftUnknown ((i : Fin l) × Fin (n i)) m) := + subst_mem_algebraicBoxRing _ (hasSubst_universalLeftH M) + (universalLeftH_mem_algebraicBoxRing M) leftCentralEmbedding + (augmentation_universalLeftH M) f hf + +omit [CharZero K] in + theorem universalRightG_eq_X (v : (i : Fin l) × Fin (n i)) : + universalRightG M v = MvPowerSeries.X (.inl v) := by + simp only [universalRightG,affineUnknown,M.G_zero,map_zero,add_zero] + +omit [CharZero K] in + theorem universalRight_substitution_algebraic + (f : MvPowerSeries ((i : Fin l) × Fin (n i)) K) + (hf : IsAlgebraic (MvPolynomial ((i : Fin l) × Fin (n i)) K) f) : + IsAlgebraic (MvPolynomial (RightUnknown ((i : Fin l) × Fin (n i)) m) K) + (MvPowerSeries.subst (universalRightG M) f) := by + have h : universalRightG M=fun v=>MvPowerSeries.X (.inl v) := funext (universalRightG_eq_X M) + rw [h] + simpa only [MvPowerSeries.rename_eq_subst,Function.comp_def] using + (algebraic_series_rename (τ:=RightUnknown ((i : Fin l) × Fin (n i)) m) Sum.inl Sum.inl_injective f hf) + + + +theorem universalLeftEquation_algebraic + (hF : ∀i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (hb : ∀i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) + (j : LeftEquation m) : + IsAlgebraic (MvPolynomial (LeftUnknown ((i : Fin l) × Fin (n i)) m) K) + (universalLeftEquation M W j) := by + have hf := deformed_mem_algebraicBoxRing M hF hb + rcases j with q|tq + · exact (mem_algebraicBoxRing K m _ _).mp (universalLeft_substitution_algebraic M _ hf) q + · apply (mem_algebraicBoxRing K m _ _).mp _ tq.2 + apply Subring.sub_mem _ _ (C_mem_algebraicBoxRing K m _ _) + apply Subring.sum_mem + intro v _ + exact Subring.mul_mem _ (universalLeftP_mem_algebraicBoxRing M W tq.1 v) + (universalLeft_substitution_algebraic M _ (pderiv_mem_algebraicBoxRing K m _ v _ hf)) + +omit [CharZero K] in +theorem universalRightP_algebraic (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + IsAlgebraic (MvPolynomial (RightUnknown ((i : Fin l) × Fin (n i)) m) K) + (universalRightP M W t v) := by + unfold universalRightP + exact algebraic_affineUnknown (σ:=RightUnknown ((i : Fin l) × Fin (n i)) m) + (Sum.inr (t,v)) (MvPowerSeries.constantCoeff (W.right t v)) + + theorem universalRightSummand_algebraic + (hF : ∀i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (t : Triple m) (v : (i : Fin l) × Fin (n i)) : + IsAlgebraic (MvPolynomial (RightUnknown ((i : Fin l) × Fin (n i)) m) K) + (universalRightP M W t v * MvPowerSeries.subst (universalRightG M) + (MvPowerSeries.pderiv v (potential K (fun i=>Fin (n i)) M.F))) := by + exact (universalRightP_algebraic M W t v).mul + (universalRight_substitution_algebraic M _ + (algebraic_series_pderiv v _ (algebraic_potential M hF))) + + +theorem universalRightEquation_algebraic + (hF : ∀i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (hb : ∀i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) + (j : RightEquation m) : + IsAlgebraic (MvPolynomial (RightUnknown ((i : Fin l) × Fin (n i)) m) K) + (universalRightEquation M W j) := by + have hf := algebraic_potential M hF + rcases j with u|t + · exact universalRight_substitution_algebraic M _ hf + · dsimp only [universalRightEquation,Sum.elim_inr] + apply IsAlgebraic.sub + · apply algebraic_series_sum + intro v _ + exact universalRightSummand_algebraic M W hF t v + · exact universalRight_substitution_algebraic M _ + (((algebraic_perturbation M hb t.val.1).mul (algebraic_perturbation M hb t.val.2.1)).mul + (algebraic_perturbation M hb t.val.2.2)) + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/NormalResidues.lean b/lean/OAI/Algebra/FiniteTensor/NormalResidues.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9cccbdd19eac5649108c3708461ad0aabeccaaa --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/NormalResidues.lean @@ -0,0 +1,151 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.MovingCoordinates +import OAI.Algebra.FiniteTensor.RelativeDerivatives + +namespace OAI + +/-! Normal-cycle residues, restricted gradients and nonzero exterior pairings. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct BigOperators +variable (K A : Type*) [Field K] [CommRing A] [Algebra K A] +variable (σ : Type*) [Fintype σ] [DecidableEq σ] +variable (der : σ → A →ₗ[K] A) (p : ℕ) + +theorem normalCycle_product (cs : List A) : + normalCycle K A σ der p cs = + scalar K A σ (cs.map (fun c => c^(p-1))).prod * + (cs.map (fun c => differential K A σ der (scalar K A σ c))).prod := by + induction cs with + | nil => simp [normalCycle] + | cons c cs ih => + change (scalar K A σ (c^(p-1)) * differential K A σ der (scalar K A σ c)) * + normalCycle K A σ der p cs = _ + rw [ih] + simp only [List.map_cons, List.prod_cons, scalar_mul] + rw [mul_assoc, ← mul_assoc (differential K A σ der (scalar K A σ c)), + ← scalar_commute, mul_assoc, ← mul_assoc] + +variable [Invertible (2 : K)] +theorem topCoefficient_normalCycle (N : ℕ) (der : Fin N → A →ₗ[K] A) + (c : Fin N → A) : + topCoefficient K A N (normalCycle K A (Fin N) der p (List.ofFn c)) = + (∏ i, c i^(p-1)) * Matrix.det (fun i j => der j (c i)) := by + rw [normalCycle_product] + have hscalar (a : A) (ω : Ω K A (Fin N)) : scalar K A (Fin N) a * ω = a • ω := by + induction ω using TensorProduct.inductionOn with + | add x y hx hy => simp [mul_add, smul_add, hx, hy] + | tmul b e => simp [scalar, Algebra.TensorProduct.tmul_mul_tmul, TensorProduct.smul_tmul'] + rw [hscalar, map_smul, smul_eq_mul] + simp only [List.map_ofFn, Function.comp_def, List.prod_ofFn, differential_scalar] + rw [topCoefficient_oneForm_product] + +end +end PD4Tensor.Forms + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +open scoped TensorProduct BigOperators +variable (K : Type*) [Field K] (N p : ℕ) [CharP K p] [Fact p.Prime] + [Invertible (2 : K)] + + + +theorem exterior_normal_residue (hp : 0 < p) (f : Fin N → MvPolynomial (Fin N) K) + (hf : ∀ i, MvPolynomial.constantCoeff (f i)=0) : + residue K (Fin N) p hp + (Forms.topCoefficient K (Ring K (Fin N) p) N + (Forms.normalCycle K (Ring K (Fin N) p) (Fin N) (derivative K (Fin N) p) p + (List.ofFn (fun i => Ideal.Quotient.mk (ideal K (Fin N) p) (f i))))) = + (tangentMatrix K (Fin N) f).det^p := by + rw [Forms.topCoefficient_normalCycle] + simp only [derivative_mk] + have hj : Matrix.det (fun i j => Ideal.Quotient.mk (ideal K (Fin N) p) + (MvPolynomial.pderiv j (f i))) = + Ideal.Quotient.mk (ideal K (Fin N) p) (jacobianDet K (Fin N) f) := + (RingHom.map_det (Ideal.Quotient.mk (ideal K (Fin N) p)) _).symm + rw [hj] + exact normal_residue K (Fin N) p hp f hf + + +theorem exterior_normal_residue_ne_zero (hp : 0 < p) (f : Fin N → MvPolynomial (Fin N) K) + (hf : ∀ i, MvPolynomial.constantCoeff (f i)=0) + (hdet : (tangentMatrix K (Fin N) f).det ≠ 0) : + residue K (Fin N) p hp + (Forms.topCoefficient K (Ring K (Fin N) p) N + (Forms.normalCycle K (Ring K (Fin N) p) (Fin N) (derivative K (Fin N) p) p + (List.ofFn (fun i => Ideal.Quotient.mk (ideal K (Fin N) p) (f i))))) ≠ 0 := by + rw [exterior_normal_residue K N p hp f hf] + exact pow_ne_zero _ hdet + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct BigOperators +variable {K A B σ : Type*} [Field K] [CommRing A] [Algebra K A] + [CommRing B] [Algebra K B] [Fintype σ] [DecidableEq σ] + + + +theorem restricted_gradient_boundary (r : A →ₐ[K] B) (hr : Function.Surjective r) + (v : σ → A) (ω : Ω K A σ) (hω : oneForm K A σ v * ω=0) + (hann : ∀ a, r a=0 → scalar K A σ a * ω=0) + (a : A) (ha : r a∈Ideal.span (Set.range (fun i => r (v i)))) : + scalar K A σ a * ω∈LinearMap.range (LinearMap.mulLeft K (oneForm K A σ v)) := by + obtain ⟨b,hb⟩ := Ideal.mem_span_range_iff_exists_fun.mp ha + choose c hc using fun i => hr (b i) + let a' : A := ∑ i, c i * v i + have he : r (a-a')=0 := by + simp only [a',map_sub,map_sum,map_mul,hc] + rw [hb,sub_self] + have heq : scalar K A σ a * ω=scalar K A σ a' * ω := by + have h := hann (a-a') he + simpa only [map_sub,scalar,TensorProduct.sub_tmul,sub_mul,sub_eq_zero] using h + rw [heq] + apply gradient_ideal_boundary v ω hω a' + exact Ideal.mem_span_range_iff_exists_fun.mpr ⟨c,rfl⟩ + +end +end PD4Tensor.Forms + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K : Type*) [Field K] (N p : ℕ) [CharP K p] [Fact p.Prime] + [Invertible (2 : K)] + + + +theorem inverse_normal_residue_ne_zero + (q : Ring K (Fin N) p ≃ₐ[K] Ring K (Fin N) p) : + residue K (Fin N) p (Fact.out : p.Prime).pos + (Forms.topCoefficient K (Ring K (Fin N) p) N + (Forms.normalCycle K (Ring K (Fin N) p) (Fin N) (derivative K (Fin N) p) p + (List.ofFn (fun i => q (coord K (Fin N) p i)))))≠0 := by + choose f hf using fun i => Ideal.Quotient.mk_surjective (q (coord K (Fin N) p i)) + have hh := inverse_representatives K (Fin N) p q f hf + have hr := exterior_normal_residue_ne_zero K N p (Fact.out : p.Prime).pos f hh.1 hh.2 + simpa only [hf] using hr + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.Forms +noncomputable section +variable (K A σ : Type*) [Field K] [CommRing A] [Algebra K A] [Fintype σ] [DecidableEq σ] + (der : σ → A →ₗ[K] A) (p : ℕ) + +@[simp] theorem normalCycle_append (cs ds : List A) : + normalCycle K A σ der p (cs++ds)=normalCycle K A σ der p cs * normalCycle K A σ der p ds := by + simp [normalCycle,List.prod_append] + +end +end PD4Tensor.Forms +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/OddTensors.lean b/lean/OAI/Algebra/FiniteTensor/OddTensors.lean new file mode 100644 index 0000000000000000000000000000000000000000..d96f543645751e55c27cb14ddd642ec541dc8fe9 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/OddTensors.lean @@ -0,0 +1,201 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.TensorForms + +namespace OAI + +/-! Odd coordinate operators, tensor signs and naturality. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct +variable {K ι : Type*} [Field K] [Fintype ι] [LinearOrder ι] +variable {V : ι → Type*} [∀ i, AddCommGroup (V i)] [∀ i, Module K (V i)] + +def oddCoordinate (g f : ∀ i, V i →ₗ[K] V i) (i j : ι) : V j →ₗ[K] V j := + if j < i then g j else if j=i then f j else LinearMap.id + +def oddTensor (g f : ∀ i, V i →ₗ[K] V i) : + (⨂[K] i, V i) →ₗ[K] (⨂[K] i, V i) := + ∑ i, PiTensorProduct.map (oddCoordinate g f i) + +omit [Fintype ι] in +private theorem tprod_neg_at (x y : ∀ i, V i) (i : ι) + (hi : x i = -y i) (h : ∀ j, j≠i → x j=y j) : + PiTensorProduct.tprod K x = -PiTensorProduct.tprod K y := by + have hx : x=Function.update y i (-y i) := by + funext j + by_cases hji : j=i + · subst j; simpa using hi + · simpa [hji] using h j hji + rw [hx,(PiTensorProduct.tprod K).map_update_neg,Function.update_eq_self] + +omit [Fintype ι] in +private theorem odd_term_lt (g f e : ∀ i, V i →ₗ[K] V i) + (hfg : ∀ i v, f i (g i v) = -g i (f i v)) + (i j : ι) (hij : i < j) (v : ∀ i, V i) : + PiTensorProduct.tprod K (fun k => oddCoordinate g f i k (oddCoordinate g e j k (v k))) = + -PiTensorProduct.tprod K (fun k => oddCoordinate g e j k (oddCoordinate g f i k (v k))) := by + apply tprod_neg_at _ _ i + · simp [oddCoordinate,hij,hfg] + · intro k hki + by_cases hkj : k=j + · subst k; simp [oddCoordinate,hij.not_gt,hki] + · by_cases hkin : k < i + · simp [oddCoordinate,hkin,hkin.trans hij] + · by_cases hkjn : k < j + · simp [oddCoordinate,hkin,hkjn,hki] + · simp [oddCoordinate,hkin,hkjn,hki,hkj] + + +omit [Fintype ι] in +theorem odd_term_anticommute (g f e : ∀ i, V i →ₗ[K] V i) + (hfg : ∀ i v, f i (g i v) = -g i (f i v)) + (heg : ∀ i v, e i (g i v) = -g i (e i v)) + (hfe : ∀ i v, f i (e i v) = -e i (f i v)) + (i j : ι) : + (PiTensorProduct.map (oddCoordinate g f i)).comp (PiTensorProduct.map (oddCoordinate g e j)) + + (PiTensorProduct.map (oddCoordinate g e j)).comp (PiTensorProduct.map (oddCoordinate g f i))=0 := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.add_apply, + LinearMap.comp_apply,PiTensorProduct.map_tprod,LinearMap.zero_apply] + rcases lt_trichotomy i j with hij|rfl|hji + · rw [odd_term_lt g f e hfg i j hij v,neg_add_cancel] + · have h := tprod_neg_at (K := K) + (fun k => oddCoordinate g f i k (oddCoordinate g e i k (v k))) + (fun k => oddCoordinate g e i k (oddCoordinate g f i k (v k))) i + (by simp [oddCoordinate,hfe]) (by + intro k hki + by_cases hlt : k < i <;> simp [oddCoordinate,hki,hlt]) + rw [h,neg_add_cancel] + · rw [odd_term_lt g e f heg j i hji v,add_neg_cancel] + + +theorem oddTensor_anticommute (g f e : ∀ i, V i →ₗ[K] V i) + (hfg : ∀ i v, f i (g i v) = -g i (f i v)) + (heg : ∀ i v, e i (g i v) = -g i (e i v)) + (hfe : ∀ i v, f i (e i v) = -e i (f i v)) (v : ⨂[K] i, V i) : + oddTensor g f (oddTensor g e v) + oddTensor g e (oddTensor g f v)=0 := by + simp only [oddTensor,LinearMap.sum_apply,map_sum] + rw [Finset.sum_comm,← Finset.sum_add_distrib] + apply Finset.sum_eq_zero + intro i _ + rw [← Finset.sum_add_distrib] + apply Finset.sum_eq_zero + intro j _ + exact LinearMap.congr_fun (odd_term_anticommute g f e hfg heg hfe i j) v + +variable {W : ι → Type*} [∀ i, AddCommGroup (W i)] [∀ i, Module K (W i)] + + +theorem tensorMap_oddTensor_zero (g f : ∀ i, V i →ₗ[K] V i) + (q : ∀ i, V i →ₗ[K] W i) (hq : ∀ i v, q i (f i v)=0) : + (PiTensorProduct.map q).comp (oddTensor g f)=0 := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + oddTensor,LinearMap.sum_apply,map_sum,PiTensorProduct.map_tprod,LinearMap.zero_apply] + apply Finset.sum_eq_zero + intro i _ + apply (PiTensorProduct.tprod K).map_coord_zero i + simp [oddCoordinate,hq] + + +theorem oddTensor_tensorMap_zero (g f : ∀ i, V i →ₗ[K] V i) + (a : ∀ i, W i →ₗ[K] V i) (ha : ∀ i v, f i (a i v)=0) : + (oddTensor g f).comp (PiTensorProduct.map a)=0 := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + oddTensor,LinearMap.sum_apply,PiTensorProduct.map_tprod,LinearMap.zero_apply] + apply Finset.sum_eq_zero + intro i _ + apply (PiTensorProduct.tprod K).map_coord_zero i + simp [oddCoordinate,ha] + + +theorem oddTensor_sandwich (g f : ∀ i, V i →ₗ[K] V i) + (q : ∀ i, V i →ₗ[K] W i) (a : ∀ i, W i →ₗ[K] V i) + (hqa : ∀ i v, q i (a i v)=v) : + (PiTensorProduct.map q).comp ((oddTensor g f).comp (PiTensorProduct.map a)) = + oddTensor (fun i => (q i).comp ((g i).comp (a i))) + (fun i => (q i).comp ((f i).comp (a i))) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + oddTensor,LinearMap.sum_apply,map_sum,PiTensorProduct.map_tprod] + apply Finset.sum_congr rfl + intro i _ + congr 1 + funext j + by_cases hji : j < i + · simp [oddCoordinate,hji] + · by_cases heq : j=i <;> simp [oddCoordinate,hji,heq,hqa] + + +theorem oddTensor_naturality (g f : ∀ i, V i →ₗ[K] V i) + (g' f' : ∀ i, W i →ₗ[K] W i) (q : ∀ i, V i →ₗ[K] W i) + (hqg : ∀ i v, q i (g i v)=g' i (q i v)) + (hqf : ∀ i v, q i (f i v)=f' i (q i v)) : + (PiTensorProduct.map q).comp (oddTensor g f) = + (oddTensor g' f').comp (PiTensorProduct.map q) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + oddTensor,LinearMap.sum_apply,map_sum,PiTensorProduct.map_tprod] + apply Finset.sum_congr rfl + intro i _ + congr 1 + funext j + by_cases hji : j < i + · simp [oddCoordinate,hji,hqg] + · by_cases heq : j=i <;> simp [oddCoordinate,hji,heq,hqf] + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct BigOperators +variable {K : Type*} [Field K] {n : ℕ} {V : Fin (n+1) → Type*} + [∀ i, AddCommGroup (V i)] [∀ i, Module K (V i)] + +theorem headTail_map (f : ∀ i, V i →ₗ[K] V i) : + (headTailEquiv K V).toLinearMap.comp (PiTensorProduct.map f) = + (TensorProduct.map (f 0) (PiTensorProduct.map (fun i : Fin n => f i.succ))).comp + (headTailEquiv K V).toLinearMap := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + PiTensorProduct.map_tprod,LinearEquiv.coe_coe,headTailEquiv_tprod,TensorProduct.map_tmul] + +theorem headTail_oddTensor (g f : ∀ i, V i →ₗ[K] V i) : + (headTailEquiv K V).toLinearMap.comp (oddTensor g f) = + (TensorProduct.map (f 0) LinearMap.id + + TensorProduct.map (g 0) (oddTensor (fun i : Fin n => g i.succ) + (fun i : Fin n => f i.succ))).comp (headTailEquiv K V).toLinearMap := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + oddTensor,LinearMap.sum_apply,map_sum,PiTensorProduct.map_tprod, + LinearEquiv.coe_coe,headTailEquiv_tprod,LinearMap.add_apply, + TensorProduct.map_tmul,LinearMap.id_apply,TensorProduct.tmul_sum] + rw [Fin.sum_univ_succ] + congr 1 + · simp [oddCoordinate] + +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/OffsetEquations.lean b/lean/OAI/Algebra/FiniteTensor/OffsetEquations.lean new file mode 100644 index 0000000000000000000000000000000000000000..9460dcc64f33d47bb943665954e9da6a1f8cd2d1 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/OffsetEquations.lean @@ -0,0 +1,464 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.GermBranches +import OAI.Algebra.FiniteTensor.PolynomialApproximation + +namespace OAI + +/-! Finite offset equations and algebraic-germ Artin approximation. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ τ : Type*} [CommRing K] [Finite σ] [Finite τ] + + def independentOffset (a : σ → MvPowerSeries τ K) (i : σ) : MvPowerSeries (τ ⊕ σ) K := + rename Sum.inl (a i)+X (Sum.inr i) + + def offsetRetraction : τ ⊕ σ → MvPowerSeries σ K := Sum.elim (fun _=>0) X + def graphRetraction : τ ⊕ σ → MvPowerSeries τ K := Sum.elim X (fun _=>0) + +omit [Finite σ] in + theorem independentOffset_zero (a : σ → MvPowerSeries τ K) + (ha : ∀ i,constantCoeff (a i)=0) (i : σ) : constantCoeff (independentOffset a i)=0 := by + simp [independentOffset,ha] + +omit [Finite σ] [Finite τ] in + theorem offsetRetraction_zero (i : τ ⊕ σ) : constantCoeff (offsetRetraction (K:=K) i)=0 := by + cases i <;> simp [offsetRetraction] +omit [Finite σ] [Finite τ] in + theorem graphRetraction_zero (i : τ ⊕ σ) : constantCoeff (graphRetraction (K:=K) i)=0 := by + cases i <;> simp [graphRetraction] + + theorem subst_offsetRetraction_rename (f : MvPowerSeries τ K) : + subst (offsetRetraction (K:=K) (σ:=σ)) (rename Sum.inl f)=C (constantCoeff f) := by + rw [rename_eq_subst,subst_comp_subst_apply (HasSubst.X_comp _) + (hasSubst_of_constantCoeff_zero offsetRetraction_zero)] + have h : (fun s : τ=>subst (offsetRetraction (K:=K) (σ:=σ)) + ((X ∘ Sum.inl) s : MvPowerSeries (τ ⊕ σ) K))=0 := by + funext s + rw [Function.comp_apply,subst_X (hasSubst_of_constantCoeff_zero offsetRetraction_zero)] + rfl + rw [h,subst_zero_eq_C_constantCoeff] + simp + + theorem subst_graphRetraction_rename (f : MvPowerSeries τ K) : + subst (graphRetraction (K:=K) (σ:=σ)) (rename Sum.inl f)=f := by + rw [rename_eq_subst,subst_comp_subst_apply (HasSubst.X_comp _) + (hasSubst_of_constantCoeff_zero graphRetraction_zero)] + have h : (fun s : τ=>subst (graphRetraction (K:=K) (σ:=σ)) + ((X ∘ Sum.inl) s : MvPowerSeries (τ ⊕ σ) K))=(X : τ → MvPowerSeries τ K) := by + funext s + rw [Function.comp_apply,subst_X (hasSubst_of_constantCoeff_zero graphRetraction_zero)] + rfl + rw [h,←map_algebraMap_eq_subst_X] + simp + + theorem offset_retract (a : σ → MvPowerSeries τ K) + (ha : ∀ i,constantCoeff (a i)=0) (F : MvPowerSeries σ K) : + subst offsetRetraction (subst (independentOffset a) F)=F := by + have hO := hasSubst_of_constantCoeff_zero (independentOffset_zero a ha) + have hR := hasSubst_of_constantCoeff_zero (offsetRetraction_zero (K:=K) (τ:=τ) (σ:=σ)) + rw [subst_comp_subst_apply hO hR] + have h : (fun i=>subst offsetRetraction (independentOffset a i))=(X : σ → MvPowerSeries σ K) := by + funext i + rw [independentOffset,←substAlgHom_apply hR,map_add,substAlgHom_apply, + subst_offsetRetraction_rename,ha i,map_zero,zero_add,substAlgHom_X] + rfl + rw [h,←map_algebraMap_eq_subst_X] + simp + + theorem graph_retract (a : σ → MvPowerSeries τ K) + (ha : ∀ i,constantCoeff (a i)=0) (F : MvPowerSeries σ K) : + subst graphRetraction (subst (independentOffset a) F)=subst a F := by + have hO := hasSubst_of_constantCoeff_zero (independentOffset_zero a ha) + have hR := hasSubst_of_constantCoeff_zero (graphRetraction_zero (K:=K) (τ:=τ) (σ:=σ)) + rw [subst_comp_subst_apply hO hR] + have h : (fun i=>subst graphRetraction (independentOffset a i))=a := by + funext i + rw [independentOffset,←substAlgHom_apply hR,map_add,substAlgHom_apply, + subst_graphRetraction_rename,substAlgHom_X] + simp [graphRetraction] + rw [h] + + + theorem independentOffset_injective (a : σ → MvPowerSeries τ K) + (ha : ∀ i,constantCoeff (a i)=0) : Function.Injective (subst (R:=K) (independentOffset a)) := by + intro F G h + have he := congrArg (subst (offsetRetraction (K:=K))) h + simpa only [offset_retract a ha] using he + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries WithPiTopology +variable {K σ τ : Type*} [CommRing K] [Finite σ] [Finite τ] + + theorem graphRetraction_eq_killCompl (f : MvPowerSeries (τ ⊕ σ) K) : + subst graphRetraction f=killCompl (Function.Embedding.inl : τ ↪ τ ⊕ σ) f := by + let : UniformSpace K := ⊥ + let ε := killCompl (R:=K) (Function.Embedding.inl : τ ↪ τ ⊕ σ) + have hε : Continuous ε := by + apply continuous_pi + intro d + exact continuous_coeff K (Finsupp.embDomain Function.Embedding.inl d) + have hvars : (fun i : τ ⊕ σ=>ε (X i))=graphRetraction := by + funext i + cases i with + | inl i => exact killCompl_X i + | inr i => + exact killCompl_X_eq_zero (by simp) + have he := aeval_unique hε + have hR := hasSubst_of_constantCoeff_zero (graphRetraction_zero (K:=K) (τ:=τ) (σ:=σ)) + change subst graphRetraction f=ε f + rw [←AlgHom.congr_fun he f] + rw [←substAlgHom_apply hR,substAlgHom_eq_aeval hR] + simp only [coe_aeval] + change eval₂ (algebraMap K (MvPowerSeries τ K)) graphRetraction f= + eval₂ (algebraMap K (MvPowerSeries τ K)) (fun s=>ε (X s)) f + rw [hvars] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ τ : Type*} [CommRing K] [Fintype σ] [Finite τ] + + + +omit [Finite τ] in +theorem offset_kernel (f : MvPowerSeries (τ ⊕ σ) K) + (hf : killCompl (Function.Embedding.inl : τ ↪ τ ⊕ σ) f=0) : + ∃ q : σ → MvPowerSeries (τ ⊕ σ) K,f=∑ i,X (Sum.inr i)*q i := by + classical + let pick : (τ ⊕ σ →₀ ℕ) → Option σ := fun d=> + if h : ∃ i,d (Sum.inr i)≠0 then some (Classical.choose h) else none + have hpick (d : τ ⊕ σ →₀ ℕ) (i : σ) (hi : pick d=some i) : d (Sum.inr i)≠0 := by + dsimp [pick] at hi + split_ifs at hi with h + · have he : Classical.choose h=i := Option.some.inj hi + exact he ▸ Classical.choose_spec h + let g : σ → MvPowerSeries (τ ⊕ σ) K := fun i d=>if pick d=some i then coeff d f else 0 + have hg (i : σ) : X (Sum.inr i)∣g i := by + apply X_dvd_iff.mpr + intro d hd + change (if pick d=some i then coeff d f else 0)=0 + exact ite_eq_right (fun hi=>(hpick d i hi) hd) + choose q hq using hg + refine ⟨q,?_⟩ + conv_rhs => enter [2,i]; rw [←hq i] + ext d + simp only [map_sum] + change coeff d f=∑ i,if pick d=some i then coeff d f else 0 + cases he : pick d with + | some i => simp + | none => + have hz : ∀ i,d (Sum.inr i)=0 := by + intro i + by_contra hi + have hh : ∃ i,d (Sum.inr i)≠0 := ⟨i,hi⟩ + simp [pick,hh] at he + have hd : d=Finsupp.embDomain (Function.Embedding.inl : τ ↪ τ ⊕ σ) + (d.comapDomain Sum.inl Sum.inl_injective.injOn) := by + ext s + cases s <;> simp [hz] + have hc := congrArg (coeff (d.comapDomain Sum.inl Sum.inl_injective.injOn)) hf + rw [coeff_killCompl,←hd,map_zero] at hc + simp [hc] + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K σ τ κ : Type*} [Field K] [CharZero K] + [Fintype σ] [Finite τ] [Fintype κ] + +omit [CharZero K] in + theorem killCompl_mem_jet (e : σ ↪ τ) {f : MvPowerSeries τ K} (n : ℕ) + (hf : f∈(jetIdeal (K:=K) (σ:=τ))^n) : + killCompl e f∈(jetIdeal (K:=K) (σ:=σ))^n := by + apply (mem_jetIdeal_pow_iff_coeff _ _).mpr + intro d hd + rw [coeff_killCompl] + apply (mem_jetIdeal_pow_iff_coeff _ _).mp hf + have he : (Finsupp.embDomain e d).degree=d.degree := by + change (Finsupp.embDomain e d).sum (fun _ n=>n)=d.sum (fun _ n=>n) + exact Finsupp.sum_embDomain + rwa [he] + +omit [CharZero K] in + theorem centered_of_jet_close {a b : MvPowerSeries τ K} (n : ℕ) (hn : 1≤n) + (ha : constantCoeff a=0) (h : b-a∈(jetIdeal (K:=K) (σ:=τ))^n) : + constantCoeff b=0 := by + have hh := (mem_jetIdeal_pow_iff_coeff _ _).mp h 0 (by simp only [map_zero]; omega) + simpa only [map_sub,coeff_zero_eq_constantCoeff_apply,ha,sub_zero] using hh + + + +omit [Fintype κ] in + theorem exists_offset_relations (F : κ → MvPowerSeries σ K) + (hF : ∀ k,IsAlgebraic (MvPolynomial σ K) (F k)) + (a : σ → MvPowerSeries τ K) (ha : ∀ i,constantCoeff (a i)=0) + (hsol : ∀ k,subst a (F k)=0) : + ∃ P : κ → Polynomial (MvPolynomial σ K), + (∀ k,Polynomial.aeval (F k) (P k)=0) ∧ + (∀ k,subst (independentOffset a) (Polynomial.aeval (F k) (P k).derivative)≠0) ∧ + ∃ q : κ → σ → MvPowerSeries (τ ⊕ σ) K, + ∀ k,subst (independentOffset a) (F k)=∑ i,X (Sum.inr i)*q k i := by + classical + have hi : Function.Injective (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K)) := by + intro x y h + apply MvPolynomial.coe_injective σ K + simpa only [MvPowerSeries.algebraMap_apply',Algebra.algebraMap_self, + MvPowerSeries.map_id,RingHom.id_apply] using h + choose P hPn hP hD using fun k=>exists_relation_derivative_ne_zero hi (F k) (hF k) + refine ⟨P,hP,?_,?_⟩ + · intro k hz + apply hD k + apply independentOffset_injective a ha + simpa only [←substAlgHom_apply (hasSubst_of_constantCoeff_zero + (independentOffset_zero a ha)),map_zero] using hz + · have hq (k : κ) := offset_kernel (subst (independentOffset a) (F k)) (by + rw [←graphRetraction_eq_killCompl,graph_retract a ha,hsol k]) + choose q hq using hq + exact ⟨q,hq⟩ + + + +omit [CharZero K] [Fintype κ] in + theorem offset_germ_soundness (F : κ → MvPowerSeries σ K) + (P : κ → Polynomial (MvPolynomial σ K)) + (hP : ∀ k,Polynomial.aeval (F k) (P k)=0) + (a : σ → MvPowerSeries τ K) (ha : ∀ i,constantCoeff (a i)=0) + (hD : ∀ k,subst (independentOffset a) (Polynomial.aeval (F k) (P k).derivative)≠0) + (n m : ℕ) (hm : 1 ≤ m) (hn : n ≤ m) + (hprecision : ∀ k,(subst (independentOffset a) + (Polynomial.aeval (F k) (P k).derivative)).order.toNat+1 ≤ m) + (A : σ → MvPowerSeries (τ ⊕ σ) K) + (G : κ → MvPowerSeries (τ ⊕ σ) K) + (Q : κ → σ → MvPowerSeries (τ ⊕ σ) K) + (hAalg : ∀ i,IsAlgebraic (MvPolynomial (τ ⊕ σ) K) (A i)) + (hA : ∀ i,A i-independentOffset a i∈(jetIdeal (K:=K) (σ:=τ ⊕ σ))^m) + (hG : ∀ k,G k-subst (independentOffset a) (F k)∈(jetIdeal (K:=K) (σ:=τ ⊕ σ))^m) + (hroot : ∀ k,(P k).eval₂ (MvPolynomial.aeval A).toRingHom (G k)=0) + (hideal : ∀ k,G k=∑ i,X (Sum.inr i)*Q k i) : + ∃ b : σ → MvPowerSeries τ K, + (∀ i,constantCoeff (b i)=0) ∧ (∀ k,subst b (F k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^n := by + classical + let := Fintype.ofFinite τ + let e : τ ↪ τ ⊕ σ := Function.Embedding.inl + let E := killCompl (R:=K) e + let b := fun i=>E (A i) + have hA0 : ∀ i,constantCoeff (A i)=0 := fun i=> + centered_of_jet_close m hm (independentOffset_zero a ha i) (hA i) + have hEa (i : σ) : E (independentOffset a i)=a i := by + rw [←graphRetraction_eq_killCompl] + have hR := hasSubst_of_constantCoeff_zero (graphRetraction_zero (K:=K) (τ:=τ) (σ:=σ)) + rw [independentOffset,←substAlgHom_apply hR,map_add,substAlgHom_apply, + subst_graphRetraction_rename,substAlgHom_X] + simp [graphRetraction] + have hclose : ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^m := by + intro i + have h := killCompl_mem_jet e m (hA i) + change E (A i-independentOffset a i)∈_ at h + simpa only [map_sub,hEa] using h + refine ⟨b,?_,?_,?_,?_⟩ + · intro i + exact centered_of_jet_close m hm (ha i) (hclose i) + · intro k + have he : G k=subst A (F k) := germ_branch_stability (F k) (P k) (hP k) + (independentOffset a) A (independentOffset_zero a ha) hA0 (hD k) + (fun i=>Ideal.pow_le_pow_right (hprecision k) (hA i)) (G k) + (Ideal.pow_le_pow_right (hprecision k) (hG k)) (hroot k) + have hEG : E (G k)=0 := by + rw [hideal k,map_sum] + apply Finset.sum_eq_zero + intro i hi + rw [map_mul] + have hz : E (X (Sum.inr i))=0 := killCompl_X_eq_zero (by simp [e]) + rw [hz,zero_mul] + rw [he,←graphRetraction_eq_killCompl, + subst_comp_subst_apply (hasSubst_of_constantCoeff_zero hA0) + (hasSubst_of_constantCoeff_zero graphRetraction_zero)] at hEG + convert hEG using 1 + congr 1 + funext i + exact (graphRetraction_eq_killCompl (A i)).symm + · intro i + exact algebraic_killCompl e (hAalg i) + · intro i + exact Ideal.pow_le_pow_right hn (hclose i) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {K σ τ κ : Type*} [Field K] [CharZero K] + [Fintype σ] [Finite τ] [Fintype κ] + +abbrev OffsetVariables (σ κ : Type*) := σ ⊕ κ ⊕ (κ × σ) + +def offsetPoint (A : σ → MvPowerSeries (τ ⊕ σ) K) + (G : κ → MvPowerSeries (τ ⊕ σ) K) + (Q : κ → σ → MvPowerSeries (τ ⊕ σ) K) : + OffsetVariables σ κ → MvPowerSeries (τ ⊕ σ) K := + Sum.elim A (Sum.elim G (fun p=>Q p.1 p.2)) + +def offsetCoeffHom : MvPolynomial σ K →+* + MvPolynomial (OffsetVariables σ κ) (MvPolynomial (τ ⊕ σ) K) := + MvPolynomial.eval₂Hom (MvPolynomial.C.comp MvPolynomial.C) (fun i=>X (Sum.inl i)) + +def offsetRelation (P : Polynomial (MvPolynomial σ K)) (k : κ) : + MvPolynomial (OffsetVariables σ κ) (MvPolynomial (τ ⊕ σ) K) := + P.eval₂ offsetCoeffHom (X (Sum.inr (Sum.inl k))) + +def offsetIdealEquation (k : κ) : + MvPolynomial (OffsetVariables σ κ) (MvPolynomial (τ ⊕ σ) K) := + X (Sum.inr (Sum.inl k))- + ∑ i : σ,C (X (Sum.inr i))*X (Sum.inr (Sum.inr (k,i))) + +def offsetEquations (P : κ → Polynomial (MvPolynomial σ K)) : + κ ⊕ κ → MvPolynomial (OffsetVariables σ κ) (MvPolynomial (τ ⊕ σ) K) := + Sum.elim (fun k=>offsetRelation (P k) k) offsetIdealEquation + +omit [CharZero K] [Fintype σ] [Finite τ] [Fintype κ] in + theorem eval_offsetCoeffHom (v : OffsetVariables σ κ → MvPowerSeries (τ ⊕ σ) K) : + (MvPolynomial.aeval (R:=MvPolynomial (τ ⊕ σ) K) v).toRingHom.comp offsetCoeffHom= + (MvPolynomial.aeval (fun i=>v (Sum.inl i))).toRingHom := by + apply MvPolynomial.ringHom_ext + · intro c + simp [offsetCoeffHom,MvPowerSeries.algebraMap_apply',MvPowerSeries.algebraMap_apply] + · intro i + simp [offsetCoeffHom] + +omit [CharZero K] [Fintype σ] [Finite τ] [Fintype κ] in + theorem eval_offsetRelation (v : OffsetVariables σ κ → MvPowerSeries (τ ⊕ σ) K) + (P : Polynomial (MvPolynomial σ K)) (k : κ) : + MvPolynomial.aeval v (offsetRelation (τ:=τ) P k)= + P.eval₂ (MvPolynomial.aeval (fun i=>v (Sum.inl i))).toRingHom (v (Sum.inr (Sum.inl k))) := by + change (MvPolynomial.aeval v).toRingHom (P.eval₂ offsetCoeffHom _)=_ + rw [Polynomial.hom_eval₂,eval_offsetCoeffHom] + simp + +omit [CharZero K] [Finite τ] [Fintype κ] in + theorem eval_offsetIdealEquation (v : OffsetVariables σ κ → MvPowerSeries (τ ⊕ σ) K) + (k : κ) : + MvPolynomial.aeval v (offsetIdealEquation (K:=K) (τ:=τ) k)= + v (Sum.inr (Sum.inl k))- + ∑ i : σ,MvPowerSeries.X (Sum.inr i)*v (Sum.inr (Sum.inr (k,i))) := by + simp [offsetIdealEquation,MvPowerSeries.algebraMap_apply'] + +omit [CharZero K] [Finite τ] [Fintype κ] in + theorem offset_equations_iff (P : κ → Polynomial (MvPolynomial σ K)) + (v : OffsetVariables σ κ → MvPowerSeries (τ ⊕ σ) K) : + (∀ e,MvPolynomial.aeval v (offsetEquations (τ:=τ) P e)=0) ↔ + (∀ k,(P k).eval₂ (MvPolynomial.aeval (fun i=>v (Sum.inl i))).toRingHom + (v (Sum.inr (Sum.inl k)))=0) ∧ + (∀ k,v (Sum.inr (Sum.inl k))= + ∑ i : σ,MvPowerSeries.X (Sum.inr i)*v (Sum.inr (Sum.inr (k,i)))) := by + simp only [Sum.forall,offsetEquations,Sum.elim_inl,Sum.elim_inr, + eval_offsetRelation,eval_offsetIdealEquation,sub_eq_zero] + + + +omit [CharZero K] [Fintype κ] in + theorem offset_point_solves (F : κ → MvPowerSeries σ K) + (P : κ → Polynomial (MvPolynomial σ K)) + (hP : ∀ k,Polynomial.aeval (F k) (P k)=0) + (a : σ → MvPowerSeries τ K) (ha : ∀ i,MvPowerSeries.constantCoeff (a i)=0) + (Q : κ → σ → MvPowerSeries (τ ⊕ σ) K) + (hQ : ∀ k,MvPowerSeries.subst (independentOffset a) (F k)= + ∑ i,MvPowerSeries.X (Sum.inr i)*Q k i) : + ∀ e,MvPolynomial.aeval (offsetPoint (independentOffset a) + (fun k=>MvPowerSeries.subst (independentOffset a) (F k)) Q) + (offsetEquations (τ:=τ) P e)=0 := by + apply (offset_equations_iff _ _).mpr + constructor + · intro k + change (P k).eval₂ (MvPolynomial.aeval (independentOffset a)).toRingHom + (MvPowerSeries.subst (independentOffset a) (F k))=0 + rw [aeval_relation_subst (F k) (P k) _ (independentOffset_zero a ha),hP k] + rw [←MvPowerSeries.substAlgHom_apply (MvPowerSeries.hasSubst_of_constantCoeff_zero + (independentOffset_zero a ha)),map_zero] + · exact hQ + + + + theorem finite_offset_presentation (F : κ → MvPowerSeries σ K) + (hF : ∀ k,IsAlgebraic (MvPolynomial σ K) (F k)) + (a : σ → MvPowerSeries τ K) (ha : ∀ i,MvPowerSeries.constantCoeff (a i)=0) + (hsol : ∀ k,MvPowerSeries.subst a (F k)=0) (n : ℕ) : + ∃ m : ℕ,n ≤ m ∧ ∃ f : κ ⊕ κ → + MvPolynomial (OffsetVariables σ κ) (MvPolynomial (τ ⊕ σ) K), + ∃ u : OffsetVariables σ κ → MvPowerSeries (τ ⊕ σ) K, + (∀ e,MvPolynomial.aeval u (f e)=0) ∧ + ∀ v : OffsetVariables σ κ → MvPowerSeries (τ ⊕ σ) K, + (∀ e,MvPolynomial.aeval v (f e)=0) → + (∀ i,IsAlgebraic (MvPolynomial (τ ⊕ σ) K) (v i)) → + (∀ i,v i-u i∈(jetIdeal (K:=K) (σ:=τ ⊕ σ))^m) → + ∃ b : σ → MvPowerSeries τ K, + (∀ i,MvPowerSeries.constantCoeff (b i)=0) ∧ + (∀ k,MvPowerSeries.subst b (F k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^n := by + classical + obtain ⟨P,hP,hD,Q,hQ⟩ := exists_offset_relations F hF a ha hsol + let r := fun k=>(MvPowerSeries.subst (independentOffset a) + (Polynomial.aeval (F k) (P k).derivative)).order.toNat+1 + let m := max n (1+Finset.univ.sup r) + have hm : 1 ≤ m := le_trans (by omega) (le_max_right _ _) + have hn : n ≤ m := le_max_left _ _ + have hr (k : κ) : r k ≤ m := + (Finset.le_sup (f:=r) (Finset.mem_univ k)).trans + ((Nat.le_add_left _ _).trans (le_max_right _ _)) + refine ⟨m,hn,offsetEquations P,offsetPoint (independentOffset a) + (fun k=>MvPowerSeries.subst (independentOffset a) (F k)) Q, + offset_point_solves F P hP a ha Q hQ,?_⟩ + intro v hv halg hclose + obtain ⟨hroot,hideal⟩ := (offset_equations_iff P v).mp hv + exact offset_germ_soundness F P hP a ha hD n m hm hn hr + (fun i=>v (Sum.inl i)) (fun k=>v (Sum.inr (Sum.inl k))) + (fun k i=>v (Sum.inr (Sum.inr (k,i)))) + (fun i=>halg _) (fun i=>hclose _) (fun k=>hclose _) hroot hideal + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {K σ τ κ : Type*} [Field K] [CharZero K] + [Fintype σ] [Finite τ] [Fintype κ] + + + +theorem algebraic_germ_artin (F : κ → MvPowerSeries σ K) + (hF : ∀ k,IsAlgebraic (MvPolynomial σ K) (F k)) + (a : σ → MvPowerSeries τ K) (ha : ∀ i,MvPowerSeries.constantCoeff (a i)=0) + (hsol : ∀ k,MvPowerSeries.subst a (F k)=0) (n : ℕ) : + ∃ b : σ → MvPowerSeries τ K, + (∀ i,MvPowerSeries.constantCoeff (b i)=0) ∧ + (∀ k,MvPowerSeries.subst b (F k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^n := by + classical + obtain ⟨m,hn,f,u,hu,hsound⟩ := finite_offset_presentation F hF a ha hsol n + obtain ⟨v,hv,hvalg,hvu⟩ := (polynomial_artin K (τ ⊕ σ)).finite f u hu m + exact hsound v hv hvalg hvu + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/PolynomialApproximation.lean b/lean/OAI/Algebra/FiniteTensor/PolynomialApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7417f2443abdd57db596876b802c047e24d9088 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/PolynomialApproximation.lean @@ -0,0 +1,219 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.MinorReduction + +namespace OAI + +/-! Algebraic derivatives, minor induction and polynomial Artin approximation. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +variable {K σ : Type*} [Field K] [CharZero K] + + theorem aeval_isAlgebraic {R S : Type*} [CommRing R] [IsDomain R] [CommRing S] + [Algebra R S] {f : S} (hf : IsAlgebraic R f) (P : Polynomial R) : + IsAlgebraic R (Polynomial.aeval f P) := + Algebra.isAlgebraic_adjoin_singleton_iff.mpr hf _ (Polynomial.aeval_mem_adjoin_singleton R f) + + + +theorem algebraic_series_pderiv (i : σ) (f : MvPowerSeries σ K) + (hf : IsAlgebraic (MvPolynomial σ K) f) : + IsAlgebraic (MvPolynomial σ K) (MvPowerSeries.pderiv i f) := by + classical + have hi : Function.Injective (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K)) := by + intro x y h + apply MvPolynomial.coe_injective σ K + simpa only [MvPowerSeries.algebraMap_apply',Algebra.algebraMap_self, + MvPowerSeries.map_id,RingHom.id_apply] using h + obtain ⟨P,_,hP,hD⟩ := exists_relation_derivative_ne_zero hi f hf + have herr : ∀ Q : Polynomial (MvPolynomial σ K), + IsAlgebraic (MvPolynomial σ K) + (MvPowerSeries.pderiv i (Polynomial.aeval f Q)- + Polynomial.aeval f Q.derivative*MvPowerSeries.pderiv i f) := by + intro Q + induction Q using Polynomial.induction_on' with + | add Q R hQ hR => + have heq : MvPowerSeries.pderiv i (Polynomial.aeval f (Q+R)) - + Polynomial.aeval f (Q+R).derivative * MvPowerSeries.pderiv i f = + (MvPowerSeries.pderiv i (Polynomial.aeval f Q) - + Polynomial.aeval f Q.derivative * MvPowerSeries.pderiv i f) + + (MvPowerSeries.pderiv i (Polynomial.aeval f R) - + Polynomial.aeval f R.derivative * MvPowerSeries.pderiv i f) := by + simp only [map_add,add_mul] + ring + rw [heq] + exact hQ.add hR + | monomial j a => + have ha : IsAlgebraic (MvPolynomial σ K) + (MvPowerSeries.pderiv i (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K) a)) := by + simpa only [MvPowerSeries.algebraMap_apply',Algebra.algebraMap_self, + MvPowerSeries.map_id,RingHom.id_apply,MvPowerSeries.pderiv_coe] using + (isAlgebraic_algebraMap (R:=MvPolynomial σ K) (A:=MvPowerSeries σ K) + (MvPolynomial.pderiv i a)) + have heq : MvPowerSeries.pderiv i (Polynomial.aeval f (Polynomial.monomial j a)) - + Polynomial.aeval f (Polynomial.monomial j a).derivative * MvPowerSeries.pderiv i f = + MvPowerSeries.pderiv i (algebraMap (MvPolynomial σ K) (MvPowerSeries σ K) a) * f^j := by + simp only [Polynomial.aeval_monomial,Polynomial.derivative_monomial, + Derivation.leibniz,Derivation.leibniz_pow,smul_eq_mul,map_mul,map_natCast, + nsmul_eq_mul] + ring + rw [heq] + exact ha.mul (hf.pow j) + have hprod : IsAlgebraic (MvPolynomial σ K) + (Polynomial.aeval f P.derivative*MvPowerSeries.pderiv i f) := by + simpa only [hP,map_zero,zero_sub,neg_neg] using (herr P).neg + exact IsAlgebraic.of_mul (mem_nonZeroDivisors_of_ne_zero hD) + (aeval_isAlgebraic hf _) hprod + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {K σ τ : Type*} [Field K] [Finite σ] + + + +theorem algebraic_series_rename (j : σ → τ) (hj : Function.Injective j) + (f : MvPowerSeries σ K) (hf : IsAlgebraic (MvPolynomial σ K) f) : + IsAlgebraic (MvPolynomial τ K) (MvPowerSeries.rename j f) := by + apply hf.ringHom_of_comp_eq (MvPolynomial.rename j).toRingHom + (MvPowerSeries.rename j).toRingHom (MvPolynomial.rename_injective j hj) + apply RingHom.ext + intro p + simp only [RingHom.comp_apply,AlgHom.toRingHom_eq_coe,MvPowerSeries.algebraMap_apply', + Algebra.algebraMap_self,MvPowerSeries.map_id,RingHom.id_apply] + exact (MvPowerSeries.rename_coe j p).symm + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {K τ : Type*} [Field K] [CharZero K] [Finite τ] + + theorem aeval_minorPolynomial {R A σ ρ : Type*} [CommRing R] [CommRing A] + [Algebra R A] [Fintype σ] [DecidableEq σ] + (a : (σ ⊕ ρ) → A) (f : σ → MvPolynomial (σ ⊕ ρ) R) : + aeval a (minorPolynomial f)=Matrix.det (fun k i=>aeval a (pderiv (Sum.inl i) (f k))) := by + unfold minorPolynomial + exact RingHom.map_det (aeval a : MvPolynomial (σ ⊕ ρ) R →ₐ[R] A).toRingHom _ + + omit [CharZero K] [Finite τ] in + theorem rename_polynomial_square {υ : Type*} (e : τ ≃ υ) : + (algebraMap (MvPolynomial υ K) (MvPowerSeries υ K)).comp (MvPolynomial.rename e).toRingHom= + (MvPowerSeries.renameEquiv K e).toRingHom.comp + (algebraMap (MvPolynomial τ K) (MvPowerSeries τ K)) := by + apply MvPolynomial.ringHom_ext + · intro c + simp [MvPowerSeries.algebraMap_apply'] + · intro i + simp [MvPowerSeries.algebraMap_apply'] + + + +theorem minor_artin_step + (ih : ∀ p : τ,PolynomialArtinAt K {i : τ // i≠p}) : MinorArtinAt K τ := by + classical + intro σ ρ _ _ _ _ f a ha hJ n + let δ := aeval a (minorPolynomial f) + have hδ : δ≠0 := by dsimp [δ]; rw [aeval_minorPolynomial]; exact hJ + by_cases hu : IsUnit δ + · let F := fun k=>map (algebraMap (MvPolynomial τ K) (MvPowerSeries τ K)) (f k) + have hev (v : (σ ⊕ ρ) → MvPowerSeries τ K) (q : MvPolynomial (σ ⊕ ρ) (MvPolynomial τ K)) : + eval v (map (algebraMap (MvPolynomial τ K) (MvPowerSeries τ K)) q)=aeval v q := by + rw [←eval₂_eq_eval_map,aeval_def] + have hFcoeff (k : σ) (d) : IsAlgebraic (MvPolynomial τ K) ((F k).coeff d) := by + rw [coeff_map] + exact isAlgebraic_algebraMap _ + have hJF : IsUnit (Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (F k)))) := by + simp_rw [F,pderiv_map,hev] + rwa [←aeval_minorPolynomial] + obtain ⟨b,hb,hbalg,hba⟩ := unit_artin_step F hFcoeff a (fun k=>by rw [hev]; exact ha k) hJF n + exact ⟨b,fun k=>by rw [←hev]; exact hb k,hbalg,hba⟩ + · have hzero : MvPowerSeries.constantCoeff δ=0 := by + rw [MvPowerSeries.isUnit_iff_constantCoeff,isUnit_iff_ne_zero,not_not] at hu + exact hu + obtain ⟨p,c,hp,hreg⟩ := exists_regular_linear_chart δ hδ hzero + let υ := {i : τ // i≠p} + let e := Equiv.optionSubtypeNe p + let C := linearSeriesChart p c hp + let E := C.trans (MvPowerSeries.renameEquiv K e.symm) + let P := (MvPolynomial.rename e.symm).toRingHom.comp (polynomialChart p c) + have hsq : (algebraMap (MvPolynomial (Option υ) K) (MvPowerSeries (Option υ) K)).comp P= + E.toRingHom.comp (algebraMap (MvPolynomial τ K) (MvPowerSeries τ K)) := by + apply RingHom.ext + intro q + change (algebraMap (MvPolynomial (Option υ) K) (MvPowerSeries (Option υ) K)) + (MvPolynomial.rename e.symm (polynomialChart p c q))= + MvPowerSeries.rename e.symm (C ((algebraMap (MvPolynomial τ K) (MvPowerSeries τ K)) q)) + have hr := RingHom.congr_fun (rename_polynomial_square (K:=K) e.symm) (polynomialChart p c q) + have hc := RingHom.congr_fun (polynomialChart_square p c hp) q + exact hr.trans (congrArg (MvPowerSeries.rename e.symm) hc) + let f' := fun k=>map P (f k) + let a' := fun i=>E (a i) + have hev (v : (σ ⊕ ρ) → MvPowerSeries τ K) (q : MvPolynomial (σ ⊕ ρ) (MvPolynomial τ K)) : + aeval (fun i=>E (v i)) (map P q)=E (aeval v q) := + aeval_map_square P E.toRingHom hsq q v + have hminor : minorPolynomial f'=map P (minorPolynomial f) := (minorPolynomial_map P f).symm + obtain ⟨b,hb,hbalg,hba⟩ := option_artin_step (ih p) f' a' + (fun k=>by rw [hev,ha,map_zero]) + (by + rw [hminor,hev] + change MvPowerSeries.subst (axisVars (K:=K) none) + (MvPowerSeries.rename e.symm (C δ))≠0 + rwa [option_axis_rename]) + (by + rw [hminor,hev] + exact fun h=>hu ((isUnit_map_iff E _).mp h)) n + refine ⟨fun i=>E.symm (b i),?_,?_,?_⟩ + · intro k + apply E.injective + rw [map_zero,←hev] + simpa only [AlgEquiv.apply_symm_apply] using hb k + · intro i + change IsAlgebraic (MvPolynomial τ K) (C.symm (MvPowerSeries.rename e (b i))) + apply algebraic_linearSeriesChart_symm + exact algebraic_series_rename e e.injective _ (hbalg i) + · intro i + have h := series_equiv_jet E.symm.toRingEquiv (hba i) + change E.symm (b i-a' i)∈_ at h + simpa only [a',map_sub,AlgEquiv.symm_apply_apply] using h + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +universe u v +variable (K : Type u) [Field K] [CharZero K] + + + +theorem polynomial_artin (τ : Type v) [Finite τ] : PolynomialArtinAt K τ := by + classical + have h : ∀ n : ℕ,∀ (υ : Type v) [Finite υ],Nat.card υ=n → PolynomialArtinAt K υ := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro υ _ hn + apply polynomial_artin_of_minor + apply minor_artin_step + intro p + have hlt : Nat.card {i : υ // i≠p} MvPowerSeries.coeff (Finsupp.single j 1) (H0 i)))) + (hGR : Function.Injective (Matrix.mulVecLin + (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i)))) + (hcomp : IsCompl (Matrix.mulVecLin + (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (H0 i))).range + (Matrix.mulVecLin (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i))).range) + (hL0 : MvPowerSeries.subst H0 (formalSigmaPotential K σ F)=0) + (hR : MvPowerSeries.subst G (formalSigmaPotential K σ F)=0) + (htripR : ∀ s : Finset (Fin (n+1)), s⊆active → s.card=3 → + MvPowerSeries.subst G (formalSigmaSelected K σ b s)∈Ideal.span + (Set.range (fun i => MvPowerSeries.subst G + (MvPowerSeries.pderiv i (formalSigmaPotential K σ F))))) + (hL : ∀ q : Fin 3 ↪ Fin (n+1), (∀ j,q j∈active) → + MvPowerSeries.subst (H q) (formalSigmaDeformed K σ F b q)=0) + (htripL : ∀ q : Fin 3 ↪ Fin (n+1), (∀ j,q j∈active) → + MvPowerSeries.C (t K 3 0*t K 3 1*t K 3 2)∈Ideal.span + (Set.range (fun i => MvPowerSeries.subst (H q) + (MvPowerSeries.pderiv i (formalSigmaDeformed K σ F b q))))) : False := by + classical + let : CharP (T K 3) p := parameterCharP K 3 p + let : Algebra K (T K 3) := inferInstance + obtain ⟨q0,hq0L,hq0R,hqs⟩ := compatible_graph_charts K _ (Fin d) (Fin c) p + (Fin 3) (fun _ => 2) (fun _ => by decide) (fun _ => (Fact.out : p.Prime).two_le) + e H0 G hH0z hGz hHL hGR hcomp + have hHc (q : Fin 3 ↪ Fin (n+1)) (i) : + MvPowerSeries.map (constantMap K (Fin 3) (fun _ => 2) (fun _ => by decide)).toRingHom + (H q i)=H0 i := by + rw [constantMap_parameters] + exact hH q i + choose qL hqLL hqSS using fun q => hqs (H q) (hHc q) + let r := (e.trans finSumFinEquiv).trans (finCongr (Nat.add_comm d c)) + have hH0sub := MvPowerSeries.hasSubst_of_constantCoeff_zero hH0z + have hGsub := MvPowerSeries.hasSubst_of_constantCoeff_zero hGz + have hHsub (q : Fin 3 ↪ Fin (n+1)) : MvPowerSeries.HasSubst (H q) := by + apply parameter_hasSubst + intro i + exact (congrArg MvPowerSeries.constantCoeff (hH q i)).trans (hH0z i) + apply finite_chart_obstruction K p σ r e q0 qL + (fun i => formalEval K (σ i) p (F i)) (fun i => formalEval K (σ i) p (b i)) + active (fun i hi => by rw [hb i hi,map_zero]) hA + · rw [←formalSigmaPotential_eval] + exact graph_zero K _ (Fin d) (Fin c) p (Fact.out : p.Prime).pos e q0 + H0 hH0sub hq0L _ hL0 + · rw [←formalSigmaPotential_eval] + exact graph_zero K _ (Fin c) (Fin d) p (Fact.out : p.Prime).pos + (e.trans (Equiv.sumComm _ _)) q0 G hGsub hq0R _ hR + · intro s hs hc + rw [←formalSigmaSelected_eval] + simp only [←formalSigmaPotential_eval] + exact graph_gradient K K _ (Fin c) (Fin d) p (Fact.out : p.Prime).pos + (e.trans (Equiv.sumComm _ _)) q0 G hGsub hq0R + (formalSigmaPotential K σ F) (formalSigmaSelected K σ b s) (htripR s hs hc) + · intro q hq a + have hh := hqSS q a + rw [constantMap_parameters] at hh + exact hh + · intro q hq + rw [←formalSigmaDeformed_eval] + exact graph_zero (T K 3) ((i : Fin (n+1)) × σ i) (Fin d) (Fin c) + p (Fact.out : p.Prime).pos + e (qL q) (H q) (hHsub q) (hqLL q) _ (hL q hq) + · intro q hq + rw [←formalSigmaDeformed_eval] + have ht : MvPowerSeries.subst (H q) + (MvPowerSeries.C (t K 3 0*t K 3 1*t K 3 2))∈Ideal.span + (Set.range (fun i => MvPowerSeries.subst (H q) + (MvPowerSeries.pderiv i (formalSigmaDeformed K σ F b q)))) := by + simpa only [MvPowerSeries.subst_C] using htripL q hq + have hh := @graph_gradient K (T K 3) ((i : Fin (n+1)) × σ i) (Fin d) (Fin c) + inferInstance inferInstance (inferInstance : Algebra K (T K 3)) + inferInstance inferInstance inferInstance p (parameterCharP K 3 p) (Fact.out : p.Prime).pos + e (qL q) (H q) (hHsub q) (hqLL q) (formalSigmaDeformed K σ F b q) + (MvPowerSeries.C (t K 3 0*t K 3 1*t K 3 2)) ht + erw [show nilEval (T K 3) (coord (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p)) + (fun j => ⟨p,coord_pow _ _ _ j⟩) (MvPowerSeries.C (t K 3 0*t K 3 1*t K 3 2))= + algebraMap (T K 3) (Ring (T K 3) ((i : Fin (n+1)) × σ i) (fun _ => p)) + (t K 3 0*t K 3 1*t K 3 2) from (nilEval (T K 3) _ _).commutes _] at hh + exact hh + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped BigOperators +universe u +variable (K : Type*) [Field K] (p : ℕ) [CharP K p] [Fact p.Prime] [Invertible (2 : K)] + {n : ℕ} (σ : Fin (n+1) → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + +include p in + + +theorem formal_active_obstruction {d c m : ℕ} + (e : ((i : Fin (n+1)) × σ i) ≃ Fin d ⊕ Fin c) + (hm : 5 ≤ m) (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin (n+1)) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (H : ((i : Fin (n+1)) × σ i) → MvPowerSeries (Fin d) (T K m)) + (G : ((i : Fin (n+1)) × σ i) → MvPowerSeries (Fin c) K) + (hHz : ∀ i,MvPowerSeries.constantCoeff (H i)∈parameterIdeal K m) + (hGz : ∀ i,MvPowerSeries.constantCoeff (G i)=0) + (hHL : Function.Injective (Matrix.mulVecLin + (fun i j => augmentation K m (MvPowerSeries.coeff (Finsupp.single j 1) (H i))))) + (hGR : Function.Injective (Matrix.mulVecLin + (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i)))) + (hcomp : IsCompl (Matrix.mulVecLin + (fun i j => augmentation K m (MvPowerSeries.coeff (Finsupp.single j 1) (H i)))).range + (Matrix.mulVecLin (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i))).range) + (hL : MvPowerSeries.subst H (formalActiveDeformed K σ m F active b)=0) + (hR : MvPowerSeries.subst G (formalSigmaPotential K σ F)=0) + (htripL : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.C (t K m i*t K m j*t K m k)∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst H + (MvPowerSeries.pderiv x (formalActiveDeformed K σ m F active b))))) + (htripR : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.subst G + (MvPowerSeries.rename (Sigma.mk (active i)) (b i)* + MvPowerSeries.rename (Sigma.mk (active j)) (b j)* + MvPowerSeries.rename (Sigma.mk (active k)) (b k))∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst G + (MvPowerSeries.pderiv x (formalSigmaPotential K σ F))))) : False := by + classical + let A : Finset (Fin (n+1)) := Finset.univ.map active + let H0 := fun i => MvPowerSeries.map (augmentation K m) (H i) + let Hq := fun (q : Fin 3 ↪ Fin (n+1)) i => + MvPowerSeries.map (parameterSelector K m active q).toRingHom (H i) + have hHsub : MvPowerSeries.HasSubst H := + parameter_hasSubst K m H (fun i => augmentation_zero_of_mem K m _ (hHz i)) + have hmem (i : Fin (n+1)) : i∈A ↔ i∈Set.range active := by + simp only [A,Finset.mem_map,Finset.mem_univ,true_and,Set.mem_range] + apply formal_positive_obstruction K p σ e F (activeExtension active b) A + (fun i hi => activeExtension_other (A:=fun i => MvPowerSeries (σ i) K) + active b i (fun h => hi ((hmem i).mpr h))) + (by simpa only [A,Finset.card_map,Finset.card_univ,Fintype.card_fin] using hm) H0 G Hq + · intro i + change MvPowerSeries.constantCoeff (MvPowerSeries.map (augmentation K m) (H i))=0 + rw [MvPowerSeries.constantCoeff_map] + exact augmentation_zero_of_mem K m _ (hHz i) + · exact hGz + · intro q i + exact augmentation_selector_graph K m active q H i + · simpa only [H0,MvPowerSeries.coeff_map] using hHL + · exact hGR + · simpa only [H0,MvPowerSeries.coeff_map] using hcomp + · exact central_graph_zero K σ m F active b H hHsub hL + · exact hR + · intro s hs hs3 + exact active_right_triples K σ m F active b G htripR s + (fun i hi => (hmem i).mp (hs hi)) hs3 + · intro q _ + exact selector_graph_zero K σ m F active b H hHsub hL q + · intro q hq + exact selector_graph_triple K σ m F active b H hHsub htripL q + (fun j => (hmem (q j)).mp (hq j)) + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped BigOperators +universe u +variable (K : Type*) [Field K] {l : ℕ} (σ : Fin l → Type u) + [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + +def formalAnyPotential (F : ∀ i,MvPowerSeries (σ i) K) : + MvPowerSeries ((i : Fin l) × σ i) K := + ∑ i,MvPowerSeries.rename (Sigma.mk i) (F i) + +def formalAnyDeformed (m : ℕ) (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin l) (b : ∀ j,MvPowerSeries (σ (active j)) K) : + MvPowerSeries ((i : Fin l) × σ i) (T K m) := + MvPowerSeries.map (algebraMap K (T K m)) (formalAnyPotential K σ F) + + ∑ j,MvPowerSeries.C (t K m j)*MvPowerSeries.map (algebraMap K (T K m)) + (MvPowerSeries.rename (Sigma.mk (active j)) (b j)) + +variable (p : ℕ) [CharP K p] [Fact p.Prime] [Invertible (2 : K)] + +include p in + +theorem formal_active_obstruction_any {d c m : ℕ} + (e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c) + (hm : 5 ≤ m) (F : ∀ i,MvPowerSeries (σ i) K) + (active : Fin m ↪ Fin l) (b : ∀ j,MvPowerSeries (σ (active j)) K) + (H : ((i : Fin l) × σ i) → MvPowerSeries (Fin d) (T K m)) + (G : ((i : Fin l) × σ i) → MvPowerSeries (Fin c) K) + (hHz : ∀ i,MvPowerSeries.constantCoeff (H i)∈parameterIdeal K m) + (hGz : ∀ i,MvPowerSeries.constantCoeff (G i)=0) + (hHL : Function.Injective (Matrix.mulVecLin + (fun i j => augmentation K m (MvPowerSeries.coeff (Finsupp.single j 1) (H i))))) + (hGR : Function.Injective (Matrix.mulVecLin + (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i)))) + (hcomp : IsCompl (Matrix.mulVecLin + (fun i j => augmentation K m (MvPowerSeries.coeff (Finsupp.single j 1) (H i)))).range + (Matrix.mulVecLin (fun i j => MvPowerSeries.coeff (Finsupp.single j 1) (G i))).range) + (hL : MvPowerSeries.subst H (formalAnyDeformed K σ m F active b)=0) + (hR : MvPowerSeries.subst G (formalAnyPotential K σ F)=0) + (htripL : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.C (t K m i*t K m j*t K m k)∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst H + (MvPowerSeries.pderiv x (formalAnyDeformed K σ m F active b))))) + (htripR : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.subst G + (MvPowerSeries.rename (Sigma.mk (active i)) (b i)* + MvPowerSeries.rename (Sigma.mk (active j)) (b j)* + MvPowerSeries.rename (Sigma.mk (active k)) (b k))∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst G + (MvPowerSeries.pderiv x (formalAnyPotential K σ F))))) : False := by + cases l with + | zero => exact Fin.elim0 (active ⟨0, by omega⟩) + | succ n => + exact formal_active_obstruction K p σ e hm F active b H G hHz hGz hHL hGR hcomp + hL hR htripL htripR + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor + +open scoped BigOperators + +variable (K : Type*) [Field K] (m : ℕ) + + + +abbrev Coordinates (n : Fin (2*m) → ℕ) := (i : Fin (2*m)) × Fin (n i) + +abbrev N (n : Fin (2*m) → ℕ) := Fintype.card (Coordinates m n) + + +def includeBlock {n : Fin (2*m) → ℕ} (i : Fin (2*m)) + (F : MvPowerSeries (Fin (n i)) K) : MvPowerSeries (Coordinates m n) K := + MvPowerSeries.rename (fun j => (⟨i, j⟩ : Coordinates m n)) F + + +structure Germs (n : Fin (2*m) → ℕ) (active : Fin m ↪ Fin (2*m)) where + F : (i : Fin (2*m)) → MvPowerSeries (Fin (n i)) K + b : (i : Fin m) → MvPowerSeries (Fin (n (active i))) K + F_algebraic : ∀ i, IsAlgebraic (MvPolynomial (Fin (n i)) K) (F i) + b_algebraic : ∀ i, IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (b i) + F_zero : ∀ i, MvPowerSeries.constantCoeff (F i) = 0 + b_zero : ∀ i, MvPowerSeries.constantCoeff (b i) = 0 + +variable {K m} + +def Germs.S₀ {n : Fin (2*m) → ℕ} {active : Fin m ↪ Fin (2*m)} + (g : Germs K m n active) : MvPowerSeries (Coordinates m n) K := + ∑ i, includeBlock K m i (g.F i) + +def Germs.B {n : Fin (2*m) → ℕ} {active : Fin m ↪ Fin (2*m)} + (g : Germs K m n active) (i : Fin m) : MvPowerSeries (Coordinates m n) K := + includeBlock K m (active i) (g.b i) + +def Germs.Sₜ {n : Fin (2*m) → ℕ} {active : Fin m ↪ Fin (2*m)} + (g : Germs K m n active) : MvPowerSeries (Coordinates m n) (T K m) := + MvPowerSeries.map (algebraMap K (T K m)) g.S₀ + + ∑ i, MvPowerSeries.C (t K m i) * MvPowerSeries.map (algebraMap K (T K m)) (g.B i) + +variable (K m) + + + +structure Parametrizations (n : Fin (2*m) → ℕ) (d : ℕ) where + dimension_le : d ≤ N m n + HL : Coordinates m n → MvPowerSeries (Fin d) (T K m) + HR : Coordinates m n → MvPowerSeries (Fin (N m n - d)) K + HL_zero : ∀ ν, MvPowerSeries.constantCoeff (HL ν) ∈ parameterIdeal K m + HR_zero : ∀ ν, MvPowerSeries.constantCoeff (HR ν) = 0 + +variable {K m} + +def Parametrizations.leftTangent {n : Fin (2*m) → ℕ} {d : ℕ} + (h : Parametrizations K m n d) : (Fin d → K) →ₗ[K] Coordinates m n → K := + Matrix.mulVecLin (fun ν j => augmentation K m (MvPowerSeries.coeff (Finsupp.single j 1) (h.HL ν))) + +def Parametrizations.rightTangent {n : Fin (2*m) → ℕ} {d : ℕ} + (h : Parametrizations K m n d) : (Fin (N m n - d) → K) →ₗ[K] Coordinates m n → K := + Matrix.mulVecLin (fun ν j => MvPowerSeries.coeff (Finsupp.single j 1) (h.HR ν)) + +def Germs.leftJacobian {n : Fin (2*m) → ℕ} {active : Fin m ↪ Fin (2*m)} + (g : Germs K m n active) {d : ℕ} (h : Parametrizations K m n d) : + Ideal (MvPowerSeries (Fin d) (T K m)) := + Ideal.span (Set.range (fun ν => + MvPowerSeries.subst h.HL (MvPowerSeries.pderiv ν g.Sₜ))) + +def Germs.rightJacobian {n : Fin (2*m) → ℕ} {active : Fin m ↪ Fin (2*m)} + (g : Germs K m n active) {d : ℕ} (h : Parametrizations K m n d) : + Ideal (MvPowerSeries (Fin (N m n - d)) K) := + Ideal.span (Set.range (fun ν => + MvPowerSeries.subst h.HR (MvPowerSeries.pderiv ν g.S₀))) + + + +structure TensorConditions {n : Fin (2*m) → ℕ} {active : Fin m ↪ Fin (2*m)} + (g : Germs K m n active) {d : ℕ} (h : Parametrizations K m n d) : Prop where + left_injective : Function.Injective h.leftTangent + right_injective : Function.Injective h.rightTangent + complementary : IsCompl (LinearMap.range h.leftTangent) (LinearMap.range h.rightTangent) + left_vanishing : MvPowerSeries.subst h.HL g.Sₜ = 0 + right_vanishing : MvPowerSeries.subst h.HR g.S₀ = 0 + left_triple : ∀ i j k : Fin m, i ≠ j → i ≠ k → j ≠ k → + MvPowerSeries.C (t K m i * t K m j * t K m k) ∈ g.leftJacobian h + right_triple : ∀ i j k : Fin m, i ≠ j → i ≠ k → j ≠ k → + MvPowerSeries.subst h.HR (g.B i * g.B j * g.B k) ∈ g.rightJacobian h + + +def FiniteTensorObstruction : Prop := + ∀ (K : Type) (_ : Field K) (_ : CharZero K) (m : ℕ), 5 ≤ m → + ∀ (n : Fin (2*m) → ℕ) (active : Fin m ↪ Fin (2*m)) + (g : Germs K m n active) (d : ℕ) (h : Parametrizations K m n d), + ¬ TensorConditions g h + +end PD4Tensor + +namespace PD4Tensor +noncomputable section +open scoped BigOperators +variable (K : Type*) [Field K] (p : ℕ) [CharP K p] [Fact p.Prime] + +include p in + + +theorem positiveTensorObstruction (hp : p ≠ 2) (m : ℕ) (hm : 5 ≤ m) + (n : Fin (2*m) → ℕ) (active : Fin m ↪ Fin (2*m)) + (g : Germs K m n active) (d : ℕ) (h : Parametrizations K m n d) : + ¬ TensorConditions g h := by + classical + intro hc + have h2 : (2 : K) ≠ 0 := by + intro hz + have hd : p ∣ 2 := (CharP.cast_eq_zero_iff K p 2).mp hz + rcases (Nat.dvd_prime Nat.prime_two).mp hd with h1 | h2 + · exact (Fact.out : p.Prime).ne_one h1 + · exact hp h2 + let : Invertible (2 : K) := invertibleOfNonzero h2 + let e : Coordinates m n ≃ Fin d ⊕ Fin (N m n-d) := + Fintype.equivOfCardEq (by + simp only [Fintype.card_sum,Fintype.card_fin] + exact (Nat.add_sub_cancel' h.dimension_le).symm) + exact TruncatedForms.formal_active_obstruction_any K (fun i => Fin (n i)) p e + hm g.F active g.b h.HL h.HR h.HL_zero h.HR_zero hc.left_injective + hc.right_injective hc.complementary hc.left_vanishing hc.right_vanishing + hc.left_triple hc.right_triple + +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/PreparedApproximation.lean b/lean/OAI/Algebra/FiniteTensor/PreparedApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce28499dd1b674536e597215708b36dc48df3374 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/PreparedApproximation.lean @@ -0,0 +1,297 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.JacobianAlgebraicity +import OAI.Algebra.FiniteTensor.PreparedCoefficients + +namespace OAI + +/-! Fixed-jet approximation of prepared systems and the aligned Artin step. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M] + + +theorem adic_complete_power (I : Ideal R) [IsAdicComplete I M] + (c : ℕ) (hc : 0?_⟩ + have h1 := hf (hcn n) + have h2 := hL (c*n) + rw [←pow_mul] at h1 ⊢ + exact h1.trans h2 + exact IsAdicComplete.mk + +end +end PD4Tensor.Spreading + + + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +open scoped Matrix +variable {K τ σ ρ : Type*} [Field K] [Finite τ] [Fintype σ] [DecidableEq σ] [Fintype ρ] [DecidableEq ρ] + + + +omit [Fintype ρ] [DecidableEq ρ] in +theorem prepared_algebraic_approximation + (f : σ → MvPolynomial (σ ⊕ ρ) (MvPowerSeries τ K)) + (hcoeff : ∀ k d,IsAlgebraic (MvPolynomial τ K) ((f k).coeff d)) + (a u : (σ ⊕ ρ) → MvPowerSeries τ K) + (ha : ∀ k,eval a (f k)=0) + (hu : ∀ i : ρ,IsAlgebraic (MvPolynomial τ K) (u (Sum.inr i))) + (n : ℕ) + (hJ : Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k)))≠0) + (hclose : ∀ i,u i-a i∈(jetIdeal (K:=K) (σ:=τ))^ + ((Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k)))^2).order.toNat+(n+1))) + (hdiv : ∀ k,(Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k)))^2)∣eval u (f k)) : + ∃ b : (σ ⊕ ρ) → MvPowerSeries τ K,(∀ k,eval b (f k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + (∀ i : ρ,b (Sum.inr i)=u (Sum.inr i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^n := by + let δ := Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k))) + let J : Ideal (MvPowerSeries τ K) := jetIdeal + let I := J^(n+1) + have hδ : δ^2≠0 := pow_ne_zero _ hJ + choose e he using hdiv + have heI (k : σ) : e k∈I := by + apply quotient_jet_control hδ (n+1) + change δ^2*e k∈J^((δ^2).order.toNat+(n+1)) + rw [←he k] + simpa only [ha,sub_zero] using mv_eval_sub_mem _ (f k) u a hclose + let : IsAdicComplete I (MvPowerSeries τ K) := + adic_complete_power J (n+1) (Nat.succ_pos n) + obtain ⟨b,hb,halg,hfree,hbu⟩ := algebraic_rectangular_tougeron I f hcoeff u hu e heI hJ he + refine ⟨b,hb,halg,hfree,fun i=>?_⟩ + have hsmall : I≤J^n := Ideal.pow_le_pow_right (Nat.le_succ n) + have hlarge : J^((δ^2).order.toNat+(n+1))≤J^n := + Ideal.pow_le_pow_right (by omega) + have hua : u i-a i∈J^n := hlarge (hclose i) + have hbi : b i-u i∈J^n := by + cases i with + | inl i => + obtain ⟨v,hv,hvEq⟩ := hbu i + rw [hvEq,add_sub_cancel_left] + exact hsmall (I.mul_mem_left _ hv) + | inr i => simpa only [hfree,sub_self] using (J^n).zero_mem + convert (J^n).add_mem hbi hua using 1 + abel + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPowerSeries +variable {K τ : Type*} [CommRing K] [Finite τ] + + + +theorem order_eq_of_close_jet {f g : MvPowerSeries τ K} (hf : f≠0) + (hclose : g-f∈(jetIdeal (K:=K) (σ:=τ))^(f.order.toNat+1)) : + g.order=f.order := by + have ho := (ne_zero_iff_order_finite.mp hf).symm + have hh := (mem_jetIdeal_pow_iff_order _ _).mp hclose + have hlt : f.order<(g-f).order := by + apply lt_of_lt_of_le _ hh + rw [ho] + exact_mod_cast Nat.lt_succ_self f.order.toNat + have he : f+(g-f)=g := by abel + rw [←he,order_add_of_order_ne (ne_of_lt hlt),inf_eq_left.mpr (le_of_lt hlt)] + + theorem ne_zero_of_close_jet {f g : MvPowerSeries τ K} (hf : f≠0) + (hclose : g-f∈(jetIdeal (K:=K) (σ:=τ))^(f.order.toNat+1)) : g≠0 := by + intro hg + have he := order_eq_of_close_jet hf hclose + rw [hg,order_zero] at he + exact hf (order_eq_top_iff.mp he.symm) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +open scoped Matrix +variable {K τ σ ρ : Type*} [Field K] [Finite τ] [Fintype σ] [DecidableEq σ] + [Fintype ρ] [DecidableEq ρ] + + + +omit [Fintype ρ] [DecidableEq ρ] in +theorem fixed_jet_prepared_approximation + (f : σ → MvPolynomial (σ ⊕ ρ) (MvPowerSeries τ K)) + (hcoeff : ∀ k d,IsAlgebraic (MvPolynomial τ K) ((f k).coeff d)) + (a u : (σ ⊕ ρ) → MvPowerSeries τ K) + (ha : ∀ k,eval a (f k)=0) + (hu : ∀ i : ρ,IsAlgebraic (MvPolynomial τ K) (u (Sum.inr i))) + (n : ℕ) + (hJ : Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k)))≠0) + (hclose : ∀ i,u i-a i∈(jetIdeal (K:=K) (σ:=τ))^ + (2*(Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k)))).order.toNat+n+1)) + (hdiv : ∀ k,(Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k)))^2)∣eval u (f k)) : + ∃ b : (σ ⊕ ρ) → MvPowerSeries τ K,(∀ k,eval b (f k)=0) ∧ + (∀ i,IsAlgebraic (MvPolynomial τ K) (b i)) ∧ + (∀ i : ρ,b (Sum.inr i)=u (Sum.inr i)) ∧ + ∀ i,b i-a i∈(jetIdeal (K:=K) (σ:=τ))^n := by + let δ := Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k))) + let δ' := Matrix.det (fun k i=>eval u (pderiv (Sum.inl i) (f k))) + let J := jetIdeal (K:=K) (σ:=τ) + have hc : ∀ i,u i-a i∈J^(δ.order.toNat+1) := fun i=> + Ideal.pow_le_pow_right (by dsimp [δ]; omega) (hclose i) + have hd : δ'-δ∈J^(δ.order.toNat+1) := by + let approxJacobian : Matrix σ σ (MvPowerSeries τ K) := + fun row col=>eval u (pderiv (Sum.inl col) (f row)) + let baseJacobian : Matrix σ σ (MvPowerSeries τ K) := + fun row col=>eval a (pderiv (Sum.inl col) (f row)) + change approxJacobian.det-baseJacobian.det∈_ + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_sub,sub_eq_zero,RingHom.map_det,RingHom.map_det] + congr 1 + ext row col + apply Ideal.Quotient.eq.mpr + exact mv_eval_sub_mem _ (pderiv (Sum.inl col) (f row)) u a hc + have hn : δ'≠0 := ne_zero_of_close_jet hJ hd + have ho : δ'.order=δ.order := order_eq_of_close_jet hJ hd + have hsq : (δ'^2).order.toNat=2*δ.order.toNat := by + rw [pow_two,MvPowerSeries.order_mul,ho] + rw [←(MvPowerSeries.ne_zero_iff_order_finite.mp hJ)] + rw [←ENat.natCast_add] + simp only [ENat.toNat_natCast] + omega + apply prepared_algebraic_approximation f hcoeff a u ha hu n hn _ hdiv + intro i + change u i-a i∈J^((δ'^2).order.toNat+(n+1)) + rw [hsq] + simpa only [Nat.add_assoc] using hclose i + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {K τ σ ρ : Type*} [Field K] [Finite τ] + [Fintype σ] [DecidableEq σ] [Fintype ρ] [DecidableEq ρ] + +theorem minorPolynomial_map {R S ι υ : Type*} [CommRing R] [CommRing S] + [Fintype ι] [DecidableEq ι] (φ : R →+* S) + (f : ι → MvPolynomial (ι ⊕ υ) R) : + map φ (minorPolynomial f)=minorPolynomial (fun k=>map φ (f k)) := by + unfold minorPolynomial + calc + _ = Matrix.det ((map φ).mapMatrix (fun k i=>pderiv (Sum.inl i) (f k))) := + RingHom.map_det (map φ) _ + _ = _ := by + congr 1 + funext k i + exact (pderiv_map).symm + + + +omit [DecidableEq ρ] in +theorem aligned_artin_step + (ih : PolynomialArtinAt K τ) + (f : σ → MvPolynomial (σ ⊕ ρ) (Polynomial (MvPolynomial τ K))) + (a : (σ ⊕ ρ) → PowerSeries (MvPowerSeries τ K)) + (ha : ∀ k,eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) (f k))=0) + (hreg : (eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) (minorPolynomial f))).map + (IsLocalRing.residue (MvPowerSeries τ K))≠0) + (hnonunit : ¬IsUnit (eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) (minorPolynomial f)))) (n : ℕ) : + ∃ b : (σ ⊕ ρ) → PowerSeries (MvPowerSeries τ K), + (∀ k,eval b (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) (f k))=0) ∧ + (∀ i,IsAlgebraic (Polynomial (MvPolynomial τ K)) (b i)) ∧ + ∀ i,(MvPowerSeries.optionEquivLeft τ K).symm (b i-a i)∈ + (jetIdeal (K:=K) (σ:=Option τ))^n := by + let A := MvPowerSeries τ K + let E := MvPowerSeries.optionEquivLeft τ K + let F := fun k=>map (seriesCoefficientMap (B:=MvPolynomial τ K) (A:=A)) (f k) + let G := fun k=>map E.symm.toRingHom (F k) + let a' := fun i=>E.symm (a i) + let δ := eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) (A:=A)) (minorPolynomial f)) + have hδ : δ≠0 := by + intro h + apply hreg + change δ.map _=0 + simp [h] + have hev (q : MvPolynomial (σ ⊕ ρ) (PowerSeries A)) + (v : (σ ⊕ ρ) → PowerSeries A) : + eval (fun i=>E.symm (v i)) (map E.symm.toRingHom q)=E.symm (eval v q) := by + rw [←eval₂_eq_eval_map] + exact (hom_eval₂ q (RingHom.id _) E.symm.toRingHom v).symm + have hFeval (v : (σ ⊕ ρ) → PowerSeries A) (k : σ) : + eval (fun i=>E.symm (v i)) (G k)=E.symm (eval v (F k)) := hev (F k) v + have hpoly : minorPolynomial G=map E.symm.toRingHom + (map (seriesCoefficientMap (B:=MvPolynomial τ K) (A:=A)) (minorPolynomial f)) := by + rw [minorPolynomial_map,minorPolynomial_map] + have hminor (v : (σ ⊕ ρ) → PowerSeries A) : + Matrix.det (fun k i=>eval (fun j=>E.symm (v j)) (pderiv (Sum.inl i) (G k)))= + E.symm (eval v (map (seriesCoefficientMap (B:=MvPolynomial τ K) (A:=A)) (minorPolynomial f))) := by + rw [←eval_minorPolynomial,hpoly,hev] + have hGa (k : σ) : eval a' (G k)=0 := by + rw [hFeval,ha,map_zero] + have hGcoeff (k : σ) (d) : IsAlgebraic (MvPolynomial (Option τ) K) ((G k).coeff d) := by + simp only [G,F,coeff_map] + apply algebraic_option_series_symm + apply polynomial_series_algebraic_coefficients + intro m + change IsAlgebraic (MvPolynomial τ K) ((((f k).coeff d).map (algebraMap (MvPolynomial τ K) A)).coeff m) + rw [Polynomial.coeff_map] + exact isAlgebraic_algebraMap (((f k).coeff d).coeff m) + have hJa : Matrix.det (fun k i=>eval a' (pderiv (Sum.inl i) (G k)))≠0 := by + rw [hminor] + exact E.symm.injective.ne (by exact hδ) + let N := 2*(E.symm δ).order.toNat+n+1 + obtain ⟨u,hu,hun,hdiv,hclose⟩ := regular_coefficient_prepared ih f (minorPolynomial f) + a ha hreg hnonunit N (by dsimp [N]; omega) + obtain ⟨b,hb,hbalg,hfree,hba⟩ := fixed_jet_prepared_approximation G hGcoeff a' + (fun i=>E.symm (u i)) hGa + (fun i=>algebraic_option_series_symm (hu (Sum.inr i))) n hJa + (by + intro i + rw [hminor] + simpa only [a',←map_sub] using hclose i) + (by + intro k + rw [hminor,hFeval] + have hd := map_dvd E.symm.toRingHom (hdiv k) + change E.symm (_^2)∣E.symm (eval u (F k)) at hd + rwa [map_pow] at hd) + refine ⟨fun i=>E (b i),?_,fun i=>algebraic_option_series (hbalg i),?_⟩ + · intro k + apply E.symm.injective + rw [map_zero] + rw [←hFeval] + simpa only [AlgEquiv.symm_apply_apply] using hb k + · intro i + change E.symm (E (b i)-a i)∈_ + simpa only [map_sub,AlgEquiv.symm_apply_apply,a'] using hba i + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/PreparedCoefficients.lean b/lean/OAI/Algebra/FiniteTensor/PreparedCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..d488cce7801822a4b74dd1ca9dbb61af9d0e4bc5 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/PreparedCoefficients.lean @@ -0,0 +1,159 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.JetTopology + +namespace OAI + +/-! Lower and regular coefficients in prepared polynomial systems. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {K τ σ κ : Type*} [Field K] [Finite τ] + [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + + + +omit [DecidableEq σ] [DecidableEq κ] in +theorem lower_coefficient_prepared + (ih : PolynomialArtinAt K τ) + (f : κ → MvPolynomial σ (Polynomial (MvPolynomial τ K))) + (D : MvPolynomial σ (Polynomial (MvPolynomial τ K))) + (a : σ → PowerSeries (MvPowerSeries τ K)) + (ha : ∀ k,eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) (f k))=0) + (h : Polynomial (MvPowerSeries τ K)) + (hh : h.IsDistinguishedAt (jetIdeal (K:=K) (σ:=τ))) + (hjac : (h : PowerSeries (MvPowerSeries τ K))∈ + Ideal.jacobson (⊥ : Ideal (PowerSeries (MvPowerSeries τ K)))) + (u : PowerSeries (MvPowerSeries τ K)) (hu : IsUnit u) + (hD : eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) D)=(h : PowerSeries (MvPowerSeries τ K))*u) + (N : ℕ) (hN : 0map φ (f k) + let DA := map φ D + have hev (p : MvPolynomial σ (Polynomial B)) (v : σ → PowerSeries A) : + eval₂ Polynomial.coeToPowerSeries.ringHom v (map φ p)= + eval v (map (seriesCoefficientMap (B:=B) (A:=A)) p) := by + rw [eval₂_map,←eval₂_eq_eval_map] + obtain ⟨r,q,k,w,har,hfr,hDr,hw⟩ := finite_weierstrass_unit_constraints + (jetIdeal (K:=K) (σ:=τ)) h hh hjac a fA (fun k=>by rw [hev]; exact ha k) + DA u hu (by rw [hev]; exact hD) + let p := remainderPoint h r k w + have hp : ∀ e,eval₂ (Polynomial.mapRingHom (algebraMap B A)) p + (remainderEquation f D e)=0 := by + apply (remainder_equations_iff _ f D h r k w).mpr + constructor + · intro j + simpa only [fA,eval_map] using hfr j + · simpa only [DA,eval_map] using hDr + have hcoeff := coefficient_equations_original (algebraMap B A) p (remainderEquation f D) hp + obtain ⟨x,hx,hxalg,hxclose⟩ := ih.finite (coefficientEquation p (remainderEquation f D)) + (coefficientPoint p) hcoeff N + let E := MvPowerSeries.optionEquivLeft τ K + let q' : σ → PowerSeries A := fun i=>E (MvPowerSeries.truncTotal N (E.symm (q i))) + have hq' (i : σ) : IsAlgebraic (Polynomial B) (q' i) := by + apply algebraic_option_series + exact isAlgebraic_algebraMap (MvPowerSeries.truncTotal N (E.symm (q i))) + obtain ⟨b,hb,hbn,hbd,hbc⟩ := coefficient_prepared_point + ((jetIdeal (K:=K) (σ:=τ))^N) (jetIdeal_pow_le_jacobson N hN) + f D p hh.monic hjac hw x hxalg hxclose hx q' hq' + refine ⟨b,hb,hbn,hbd,fun i=>?_⟩ + let J := (jetIdeal (K:=K) (σ:=Option τ))^N + have hc : E.symm (b i-((r i : PowerSeries A)+(h : PowerSeries A)^2*q' i))∈J := + option_inverse_coefficient_jet (hbc i) + have hqclose : E.symm (q' i-q i)∈J := by + rw [map_sub] + change E.symm (E (MvPowerSeries.truncTotal N (E.symm (q i))))-E.symm (q i)∈J + rw [AlgEquiv.symm_apply_apply] + exact truncate_close_jetIdeal _ N + have hsecond : E.symm (((r i : PowerSeries A)+(h : PowerSeries A)^2*q' i)-a i)∈J := by + rw [har i] + have he : ((r i : PowerSeries A)+(h : PowerSeries A)^2*q' i)- + ((r i : PowerSeries A)+(h : PowerSeries A)^2*q i)= + (h : PowerSeries A)^2*(q' i-q i) := by ring + rw [he,map_mul,map_pow] + exact J.mul_mem_left _ hqclose + have hs := J.add_mem hc hsecond + rw [←map_add] at hs + change E.symm (b i-a i)∈J + convert hs using 1 + abel_nf + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {K τ σ κ : Type*} [Field K] [Finite τ] + [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + + + +omit [DecidableEq σ] [DecidableEq κ] in +theorem regular_coefficient_prepared + (ih : PolynomialArtinAt K τ) + (f : κ → MvPolynomial σ (Polynomial (MvPolynomial τ K))) + (D : MvPolynomial σ (Polynomial (MvPolynomial τ K))) + (a : σ → PowerSeries (MvPowerSeries τ K)) + (ha : ∀ k,eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) (f k))=0) + (hreg : (eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) D)).map (IsLocalRing.residue (MvPowerSeries τ K))≠0) + (hnonunit : ¬IsUnit (eval a (map (seriesCoefficientMap (B:=MvPolynomial τ K) + (A:=MvPowerSeries τ K)) D))) + (N : ℕ) (hN : 0 p)) : MvPolynomial.pderiv i f∈ideal R σ (fun _ => p) := by + induction hf using Submodule.span_induction with + | mem f hf => + obtain ⟨j,rfl⟩ := hf + simp only [MvPolynomial.pderiv_pow,CharP.cast_eq_zero,zero_mul] + exact Ideal.zero_mem _ + | zero => simp + | add f g hf hg ihf ihg => simpa only [map_add] using (ideal R σ (fun _ => p)).add_mem ihf ihg + | smul a f hf ih => + rw [smul_eq_mul,MvPolynomial.pderiv_mul] + exact (ideal R σ (fun _ => p)).add_mem ((ideal R σ (fun _ => p)).mul_mem_left _ hf) + ((ideal R σ (fun _ => p)).mul_mem_left _ ih) + + + +def relativeDeriv (i : σ) : Ring R σ (fun _ => p) →ₗ[R] Ring R σ (fun _ => p) := + ((ideal R σ (fun _ => p)).restrictScalars R).liftQ + ((Ideal.Quotient.mkₐ R (ideal R σ (fun _ => p))).toLinearMap.comp + (MvPolynomial.pderiv i).toLinearMap) (by + intro f hf + change Ideal.Quotient.mk (ideal R σ (fun _ => p)) (MvPolynomial.pderiv i f)=0 + exact Ideal.Quotient.eq_zero_iff_mem.mpr (pderiv_mem_uniform R σ p i f hf)) + +@[simp] theorem partial_mk (i : σ) (f : MvPolynomial σ R) : + relativeDeriv R σ p i (Ideal.Quotient.mk (ideal R σ (fun _ => p)) f)= + Ideal.Quotient.mk (ideal R σ (fun _ => p)) (MvPolynomial.pderiv i f) := rfl + +@[simp] theorem partial_coord [DecidableEq σ] (i j : σ) : + relativeDeriv R σ p i (coord R σ (fun _ => p) j)=if i=j then 1 else 0 := by + rw [coord,partial_mk,MvPolynomial.pderiv_X] + by_cases h : i=j + · subst j; simp + · simp [Ne.symm h,h] + +@[simp] theorem partial_scalar (i : σ) (a : R) : + relativeDeriv R σ p i (algebraMap R (Ring R σ (fun _ => p)) a)=0 := by + change relativeDeriv R σ p i (Ideal.Quotient.mk (ideal R σ (fun _ => p)) (MvPolynomial.C a))=0 + rw [partial_mk,MvPolynomial.pderiv_C,map_zero] + +theorem partial_mul (i : σ) (a b : Ring R σ (fun _ => p)) : + relativeDeriv R σ p i (a*b)=relativeDeriv R σ p i a*b+a*relativeDeriv R σ p i b := by + obtain ⟨a,rfl⟩ := Ideal.Quotient.mk_surjective a + obtain ⟨b,rfl⟩ := Ideal.Quotient.mk_surjective b + rw [←map_mul,partial_mk,MvPolynomial.pderiv_mul] + simp only [map_add,map_mul,partial_mk] + +private theorem pderiv_commute (i j : σ) (f : MvPolynomial σ R) : + MvPolynomial.pderiv i (MvPolynomial.pderiv j f)= + MvPolynomial.pderiv j (MvPolynomial.pderiv i f) := by + classical + by_cases hij : i=j + · subst j; rfl + induction f using MvPolynomial.induction_on with + | C a => simp + | add f g hf hg => simp [hf,hg] + | mul_X f k hf => + by_cases hi : k=i <;> by_cases hj : k=j <;> + simp [MvPolynomial.pderiv_X,hi,hj,hij,Ne.symm hij,eq_comm,hf] <;> ring + +theorem partial_commute (i j : σ) (a : Ring R σ (fun _ => p)) : + relativeDeriv R σ p i (relativeDeriv R σ p j a)=relativeDeriv R σ p j (relativeDeriv R σ p i a) := by + obtain ⟨a,rfl⟩ := Ideal.Quotient.mk_surjective a + simp only [partial_mk,pderiv_commute] + +def partialDerivation (i : σ) : Derivation R (Ring R σ (fun _ => p)) (Ring R σ (fun _ => p)) where + toLinearMap := relativeDeriv R σ p i + map_one_eq_zero' := by + rw [←map_one (algebraMap R (Ring R σ (fun _ => p))),partial_scalar] + leibniz' a b := by + simpa only [smul_eq_mul,mul_comm,add_comm] using partial_mul R σ p i a b + + + +theorem partial_nilEval [Fintype σ] (i : σ) (q : MvPowerSeries σ R) : + relativeDeriv R σ p i (nilEval R (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) q)= + nilEval R (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) + (MvPowerSeries.pderiv i q) := by + classical + exact nilEval_pderiv (coord R σ (fun _ => p)) (fun j => ⟨p,coord_pow _ _ _ j⟩) + i (partialDerivation R σ p i) (partial_coord R σ p i) q + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor +noncomputable section +variable {R A σ τ : Type*} [CommRing R] [CommRing A] [Algebra R A] + [Finite σ] [Finite τ] + +@[simp] theorem nilEval_rename (f : σ → τ) (v : τ → A) (hv : ∀ j, IsNilpotent (v j)) + (q : MvPowerSeries σ R) : + nilEval R v hv (MvPowerSeries.rename f q)=nilEval R (v ∘ f) (fun i => hv (f i)) q := by + rw [MvPowerSeries.rename_eq_subst,nilEval_subst (MvPowerSeries.X ∘ f) (MvPowerSeries.HasSubst.X_comp f)] + simp only [Function.comp_apply,nilEval_X] + rfl + + + +theorem ideal_span_range_map {B ι : Type*} [CommRing B] [Fintype ι] + (f : A →+* B) (a : A) (v : ι → A) (ha : a∈Ideal.span (Set.range v)) : + f a∈Ideal.span (Set.range (fun i => f (v i))) := by + obtain ⟨b,hb⟩ := Ideal.mem_span_range_iff_exists_fun.mp ha + refine Ideal.mem_span_range_iff_exists_fun.mpr ⟨fun i => f (b i),?_⟩ + rw [←hb] + simp only [map_sum,map_mul] + +variable {p : ℕ} + {B : Type*} [CommRing B] [Algebra R B] + + + +theorem graph_eval (H : σ → MvPowerSeries τ R) (hH : MvPowerSeries.HasSubst H) + (v : τ → B) (hv : ∀ j, IsNilpotent (v j)) + (r : FiniteCoordinates.Ring R σ (fun _ => p) →ₐ[R] B) + (hr : ∀ i, r (FiniteCoordinates.coord R σ (fun _ => p) i)=nilEval R v hv (H i)) + (q : MvPowerSeries σ R) : + r (nilEval R (FiniteCoordinates.coord R σ (fun _ => p)) + (fun i => ⟨p,FiniteCoordinates.coord_pow _ _ _ i⟩) q)= + nilEval R v hv (MvPowerSeries.subst H q) := by + calc + r (nilEval R (FiniteCoordinates.coord R σ (fun _ => p)) + (fun i => ⟨p,FiniteCoordinates.coord_pow _ _ _ i⟩) q) = + nilEval R (fun i => r (FiniteCoordinates.coord R σ (fun _ => p) i)) + (fun i => (show IsNilpotent (FiniteCoordinates.coord R σ (fun _ => p) i) from + ⟨p,FiniteCoordinates.coord_pow _ _ _ i⟩).map r) q := + nilEval_map r _ _ q + _ = _ := by + conv_rhs => rw [nilEval_subst H hH] + simp only [hr] + +end +end PD4Tensor + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct BigOperators +variable (K A : Type*) [Field K] [CommRing A] [Algebra K A] (N : ℕ) + + +def topExterior : E K (Fin N) →ₗ[K] K := + ExteriorAlgebra.liftAlternating (fun r => + if h : r=N then h.symm ▸ (Matrix.detRowAlternating : (Fin N → K) [⋀^Fin N]→ₗ[K] K) + else 0) + +@[simp] theorem topExterior_ιMulti (v : Fin N → Fin N → K) : + topExterior K N (ExteriorAlgebra.ιMulti K N v) = Matrix.det v := by + simp only [topExterior, ExteriorAlgebra.liftAlternating_apply_ιMulti] + rfl + + +def topCoefficient : Ω K A (Fin N) →ₗ[A] A := + (TensorProduct.AlgebraTensorModule.rid K A A).toLinearMap.comp + (TensorProduct.AlgebraTensorModule.map (LinearMap.id : A →ₗ[A] A) (topExterior K N)) + +@[simp] theorem topCoefficient_tmul (a : A) (e : E K (Fin N)) : + topCoefficient K A N (a ⊗ₜ[K] e) = topExterior K N e • a := by + rfl + + +def oneFormLinear : (Fin N → A) →ₗ[A] Ω K A (Fin N) where + toFun := oneForm K A (Fin N) + map_add' := by + intro v w + simp only [oneForm, Pi.add_apply, TensorProduct.add_tmul, Finset.sum_add_distrib] + map_smul' := by + intro a v + simp only [oneForm, Pi.smul_apply, Finset.smul_sum, TensorProduct.smul_tmul'] + rfl + +variable [Invertible (2 : K)] +def exteriorScalarExtension : ExteriorAlgebra A (Fin N → A) →ₐ[A] Ω K A (Fin N) := + ExteriorAlgebra.lift A ⟨oneFormLinear K A N, fun v => oneForm_sq_zero v⟩ + +@[simp] theorem exteriorScalarExtension_ι (v : Fin N → A) : + exteriorScalarExtension K A N (ExteriorAlgebra.ι A v) = oneForm K A (Fin N) v := by + exact ExteriorAlgebra.lift_ι_apply A (oneFormLinear K A N) _ v + +@[simp] theorem exteriorScalarExtension_ιMulti {r : ℕ} (v : Fin r → Fin N → A) : + exteriorScalarExtension K A N (ExteriorAlgebra.ιMulti A r v) = + (List.ofFn (fun i => oneForm K A (Fin N) (v i))).prod := by + simp only [ExteriorAlgebra.ιMulti_apply, map_list_prod, List.map_ofFn] + congr 2 + funext i + exact exteriorScalarExtension_ι K A N (v i) + + +theorem topCoefficient_oneForm_product (v : Fin N → Fin N → A) : + topCoefficient K A N (List.ofFn (fun i => oneForm K A (Fin N) (v i))).prod = Matrix.det v := by + let f : (Fin N → A) [⋀^Fin N]→ₗ[A] A := + ((topCoefficient K A N).comp (exteriorScalarExtension K A N).toLinearMap).compAlternatingMap + (ExteriorAlgebra.ιMulti A N) + have hf (v : Fin N → Fin N → A) : f v = + topCoefficient K A N (List.ofFn (fun i => oneForm K A (Fin N) (v i))).prod := by + exact congrArg (topCoefficient K A N) (exteriorScalarExtension_ιMulti K A N v) + have hstd (i : Fin N) : oneForm K A (Fin N) (Pi.basisFun A (Fin N) i) = + (1 : A) ⊗ₜ[K] dx K (Fin N) i := by + simp only [oneForm, Pi.basisFun_apply] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji; simp [hji] + · simp + have hprod : (List.ofFn (fun i => oneForm K A (Fin N) (Pi.basisFun A (Fin N) i))).prod = + (1 : A) ⊗ₜ[K] ExteriorAlgebra.ιMulti K N (Pi.basisFun K (Fin N)) := by + simp only [hstd, ExteriorAlgebra.ιMulti_apply] + have hg : (List.ofFn (fun i => (1 : A) ⊗ₜ[K] dx K (Fin N) i)).prod = + (1 : A) ⊗ₜ[K] (List.ofFn (fun i => dx K (Fin N) i)).prod := by + have h := (Algebra.TensorProduct.includeRight : E K (Fin N) →ₐ[K] Ω K A (Fin N)).map_list_prod + (List.ofFn (fun i => dx K (Fin N) i)) + change (1 : A) ⊗ₜ[K] (List.ofFn (fun i => dx K (Fin N) i)).prod = + (List.map (fun e : E K (Fin N) => (1 : A) ⊗ₜ[K] e) + (List.ofFn (fun i => dx K (Fin N) i))).prod at h + rw [List.map_ofFn] at h + exact h.symm + convert hg using 1 + simp only [dx, Pi.basisFun_apply] + have he : f (Pi.basisFun A (Fin N)) = 1 := by + rw [hf, hprod, topCoefficient_tmul, topExterior_ιMulti] + have hdet : Matrix.det (fun i => Pi.basisFun K (Fin N) i)=1 := by + have h := (Pi.basisFun K (Fin N)).det_self + change Matrix.detRowAlternating (Pi.basisFun K (Fin N))=1 + simpa only [Pi.basisFun_det] using h + rw [hdet, one_smul] + have h := f.eq_smul_basis_det (Pi.basisFun A (Fin N)) + rw [he, one_smul] at h + rw [← hf, h, Pi.basisFun_det] + rfl + +end +end PD4Tensor.Forms +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/RelativeKoszul.lean b/lean/OAI/Algebra/FiniteTensor/RelativeKoszul.lean new file mode 100644 index 0000000000000000000000000000000000000000..718114d9bd4d38fc4b68adf51b9546c2811244bf --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/RelativeKoszul.lean @@ -0,0 +1,341 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.FormBaseChange + +namespace OAI + +/-! Relative Koszul operators and specialization of deformed separated forms. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open scoped TensorProduct BigOperators +open PD4Tensor.Forms PD4Tensor.TruncatedForms +variable (K R σ : Type*) [Field K] [CommRing R] [Algebra K R] + [Fintype σ] [DecidableEq σ] (p : ℕ) [CharP K p] + + +def relativeD : Ω K (Ring R σ (fun _ => p)) σ →ₗ[R] Ω K (Ring R σ (fun _ => p)) σ := + ((formsBaseChange K R σ (fun _ => p)).symm.toLinearMap).comp + (((D K σ p).baseChange R).comp (formsBaseChange K R σ (fun _ => p)).toLinearMap) + +theorem relativeD_eq [CharP R p] (ω : Ω K (Ring R σ (fun _ => p)) σ) : + relativeD K R σ p ω= + differential K (Ring R σ (fun _ => p)) σ (chartDerivative K R σ p) ω := by + have h := relative_differential_baseChange K R σ p + (formsBaseChange K R σ (fun _ => p) ω) + rw [AlgEquiv.symm_apply_apply] at h + exact h.symm + +def relativeKoszul (S : Ring R σ (fun _ => p)) : + Ω K (Ring R σ (fun _ => p)) σ →ₗ[R] Ω K (Ring R σ (fun _ => p)) σ := + LinearMap.mulLeft R (relativeD K R σ p (scalar K (Ring R σ (fun _ => p)) σ S)) + +theorem relativeKoszul_eq [CharP R p] (S : Ring R σ (fun _ => p)) + (ω : Ω K (Ring R σ (fun _ => p)) σ) : + relativeKoszul K R σ p S ω= + oneForm K (Ring R σ (fun _ => p)) σ (fun i => chartDerivative K R σ p i S) * ω := by + rw [relativeKoszul,LinearMap.mulLeft_apply,relativeD_eq,differential_scalar] + +omit [Fintype σ] [DecidableEq σ] [CharP K p] in +theorem scalar_parameter_smul (r : R) (a : Ring R σ (fun _ => p)) : + scalar K (Ring R σ (fun _ => p)) σ (r • a)= + r • scalar K (Ring R σ (fun _ => p)) σ a := by + exact (TensorProduct.smul_tmul' r a (1 : E K σ)).symm + +@[simp] theorem relativeKoszul_add (S b : Ring R σ (fun _ => p)) : + relativeKoszul K R σ p (S+b)=relativeKoszul K R σ p S + relativeKoszul K R σ p b := by + apply LinearMap.ext + intro ω + change relativeD K R σ p _ * ω = _ + simp only [relativeKoszul,scalar_add,map_add,LinearMap.add_apply,LinearMap.mulLeft_apply,add_mul] + +@[simp] theorem relativeKoszul_zero : relativeKoszul K R σ p 0=0 := by + apply LinearMap.ext + intro ω + change relativeD K R σ p _ * ω = _ + simp only [scalar_zero,map_zero,zero_mul,LinearMap.zero_apply] + +@[simp] theorem relativeKoszul_smul (r : R) (S : Ring R σ (fun _ => p)) : + relativeKoszul K R σ p (r • S)=r • relativeKoszul K R σ p S := by + apply LinearMap.ext + intro ω + change relativeD K R σ p _ * ω = _ + simp only [relativeKoszul,scalar_parameter_smul,map_smul,LinearMap.smul_apply, + LinearMap.mulLeft_apply,smul_mul_assoc] + +theorem relativeKoszul_sum {ι : Type*} (s : Finset ι) (S : ι → Ring R σ (fun _ => p)) : + relativeKoszul K R σ p (∑ i∈s, S i)=∑ i∈s, relativeKoszul K R σ p (S i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => simp only [Finset.sum_insert ha,relativeKoszul_add,ih] + + + +theorem relativeKoszul_coefficientMap (S : Ring K σ (fun _ => p)) + (v : R ⊗[K] Ω K (Ring K σ (fun _ => p)) σ) : + relativeKoszul K R σ p (coefficientMap K R σ (fun _ => p) S) + ((formsBaseChange K R σ (fun _ => p)).symm v)= + (formsBaseChange K R σ (fun _ => p)).symm ((koszul K σ p S).baseChange R v) := by + have hscalar : scalar K (Ring R σ (fun _ => p)) σ (coefficientMap K R σ (fun _ => p) S)= + (formsBaseChange K R σ (fun _ => p)).symm + ((1 : R) ⊗ₜ[K] scalar K (Ring K σ (fun _ => p)) σ S) := by + exact (formsBaseChange_symm_one_tmul K R σ (fun _ => p) S 1).symm + have hD : relativeD K R σ p + (scalar K (Ring R σ (fun _ => p)) σ (coefficientMap K R σ (fun _ => p) S))= + (formsBaseChange K R σ (fun _ => p)).symm + ((1 : R) ⊗ₜ[K] D K σ p (scalar K (Ring K σ (fun _ => p)) σ S)) := by + rw [hscalar] + change (formsBaseChange K R σ (fun _ => p)).symm + ((D K σ p).baseChange R + (formsBaseChange K R σ (fun _ => p) + ((formsBaseChange K R σ (fun _ => p)).symm + ((1 : R) ⊗ₜ[K] scalar K (Ring K σ (fun _ => p)) σ S))))=_ + rw [AlgEquiv.apply_symm_apply] + exact congrArg (formsBaseChange K R σ (fun _ => p)).symm + (LinearMap.baseChange_tmul (D K σ p) (1 : R) (scalar K (A K σ p) σ S)) + change relativeD K R σ p _ * (formsBaseChange K R σ (fun _ => p)).symm v=_ + rw [hD,←map_mul] + apply congrArg (formsBaseChange K R σ (fun _ => p)).symm + induction v using TensorProduct.inductionOn with + | add v w hv hw => rw [mul_add,hv,hw]; exact (map_add _ v w).symm + | tmul r ω => + erw [Algebra.TensorProduct.tmul_mul_tmul,one_mul,LinearMap.baseChange_tmul] + rfl + + + +theorem relativeKoszul_deformation {ι : Type*} [Fintype ι] + (S : Ring K σ (fun _ => p)) (b : ι → Ring K σ (fun _ => p)) (t : ι → R) + (v : R ⊗[K] Ω K (Ring K σ (fun _ => p)) σ) : + relativeKoszul K R σ p + (coefficientMap K R σ (fun _ => p) S + + ∑ i, t i • coefficientMap K R σ (fun _ => p) (b i)) + ((formsBaseChange K R σ (fun _ => p)).symm v)= + (formsBaseChange K R σ (fun _ => p)).symm + (((koszul K σ p S).baseChange R + ∑ i, t i • (koszul K σ p (b i)).baseChange R) v) := by + rw [relativeKoszul_add,relativeKoszul_sum] + simp only [LinearMap.add_apply,LinearMap.sum_apply,relativeKoszul_smul, + LinearMap.smul_apply,relativeKoszul_coefficientMap] + erw [LinearMap.add_apply,LinearMap.sum_apply] + erw [map_add,map_sum] + congr 1 + apply Finset.sum_congr rfl + intro i _ + erw [LinearMap.smul_apply,map_smul] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation FiniteCoordinates +universe u +variable (K R : Type*) [Field K] [CommRing R] [Algebra K R] + (p : ℕ) [CharP K p] + {n : ℕ} (σ : Fin (n+1) → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + + +def sigmaExtendedForms : + R ⊗[K] (⨂[K] i,Space K (σ i) p) →ₗ[R] + Ω K (Ring R ((i : Fin (n+1)) × σ i) (fun _ => p)) ((i : Fin (n+1)) × σ i) := + ((formsBaseChange K R ((i : Fin (n+1)) × σ i) (fun _ => p)).symm.toLinearMap).comp + ((sigmaSeparatedEquiv K p σ).toLinearMap.baseChange R) + + + +theorem relativeKoszul_sigmaExtended (S b : ∀ i,A K (σ i) p) (t : Fin (n+1) → R) + (κ : R ⊗[K] (⨂[K] i,Space K (σ i) p)) : + relativeKoszul K R ((i : Fin (n+1)) × σ i) p + (coefficientMap K R _ (fun _ => p) (sigmaPotential K p σ S) + + ∑ i,t i • coefficientMap K R _ (fun _ => p) (sigmaBlock K p σ i (b i))) + (sigmaExtendedForms K R p σ κ)= + sigmaExtendedForms K R p σ + (deformedTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i)) (fun i => koszul K (σ i) p (b i)) t κ) := by + change relativeKoszul K R ((i : Fin (n+1)) × σ i) p _ + ((formsBaseChange K R ((i : Fin (n+1)) × σ i) (fun _ => p)).symm + ((sigmaSeparatedEquiv K p σ).toLinearMap.baseChange R κ))= + (formsBaseChange K R ((i : Fin (n+1)) × σ i) (fun _ => p)).symm + ((sigmaSeparatedEquiv K p σ).toLinearMap.baseChange R _) + erw [relativeKoszul_deformation] + apply congrArg (formsBaseChange K R ((i : Fin (n+1)) × σ i) (fun _ => p)).symm + induction κ using TensorProduct.inductionOn with + | add v w hv hw => + simp only [map_add,hv,hw]; rfl + | tmul r v => + simp only [LinearMap.baseChange_tmul,LinearMap.add_apply,LinearMap.sum_apply, + LinearMap.smul_apply,LinearEquiv.coe_coe, + deformedTensor,TensorProduct.map_tmul,LinearMap.id_apply, + LinearMap.mulLeft_apply,map_add,map_sum] + congr 1 + · exact congrArg (fun w => r ⊗ₜ[K] w) (koszul_sigmaSeparated K p σ S v) + · apply Finset.sum_congr rfl + intro i _ + erw [koszul_sigmaBlock] + exact TensorProduct.smul_tmul' (t i) r _ + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct +open Forms FrobeniusTruncation FiniteCoordinates +universe u +variable (K R : Type*) [Field K] [CommRing R] [Algebra K R] + (p : ℕ) + {n : ℕ} (σ : Fin (n+1) → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + +theorem sigmaExtendedForms_specialization (ε : R →ₐ[K] K) + (κ : R ⊗[K] (⨂[K] i,Space K (σ i) p)) : + mapCoefficients K (Ring R ((i : Fin (n+1)) × σ i) (fun _ => p)) + (Ring K ((i : Fin (n+1)) × σ i) (fun _ => p)) ((i : Fin (n+1)) × σ i) + (coefficientHom K R K _ (fun _ => p) ε) (sigmaExtendedForms K R p σ κ)= + sigmaSeparatedEquiv K p σ (specializeTensor ε κ) := by + induction κ using TensorProduct.inductionOn with + | add v w hv hw => simp only [map_add,hv,hw]; rfl + | tmul r v => + change mapCoefficients K _ _ _ _ + ((formsBaseChange K R ((i : Fin (n+1)) × σ i) (fun _ => p)).symm + ((sigmaSeparatedEquiv K p σ).toLinearMap.baseChange R (r ⊗ₜ[K] v)))=_ + erw [LinearMap.baseChange_tmul,forms_specialization_tmul,specializeTensor_tmul] + exact ((sigmaSeparatedEquiv K p σ).map_smul (ε r) v).symm + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor +namespace FrobeniusTruncation +noncomputable section + +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + + + + + +variable [CharP K p] + + + + + + +variable [Fact p.Prime] + + + + + + + + + + + + + + + + + + + + + + + + +end +end FrobeniusTruncation +end PD4Tensor + + + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] + (p : ℕ) [CharP K p] [Fact p.Prime] + + + + + + + + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open PD4Tensor.Forms +variable (K R S υ : Type*) [Field K] [CommRing R] [CommRing S] + [Algebra K R] [Algebra K S] [Fintype υ] [DecidableEq υ] + (p : ℕ) [CharP R p] [CharP S p] + {σ : Type*} {c : ℕ} + + + +theorem chartNormal_specialization + (r : R →ₐ[K] S) (e : υ ≃ σ ⊕ Fin c) + (qR : Ring R υ (fun _ => p) ≃ₐ[R] Ring R υ (fun _ => p)) + (qS : Ring S υ (fun _ => p) ≃ₐ[S] Ring S υ (fun _ => p)) + (hq : ∀ a, coefficientHom K R S υ (fun _ => p) r (qR a)= + qS (coefficientHom K R S υ (fun _ => p) r a)) : + mapCoefficients K (Ring R υ (fun _ => p)) (Ring S υ (fun _ => p)) υ + (coefficientHom K R S υ (fun _ => p) r) (chartNormal K R υ p e qR)= + chartNormal K S υ p e qS := by + rw [chartNormal,mapCoefficients_normalCycle K _ _ υ _ + (chartDerivative K R υ p) (chartDerivative K S υ p) + (coefficientHom_partial K R S υ p r)] + change normalCycle K (Ring S υ (fun _ => p)) υ (chartDerivative K S υ p) p _=_ + congr 1 + simp only [normalCoordinates,List.map_ofFn,Function.comp_def] + congr 1 + funext j + apply qS.injective + rw [←hq,qR.apply_symm_apply,coefficientHom_coord,qS.apply_symm_apply] + +end +end PD4Tensor.FiniteCoordinates + +namespace PD4Tensor +noncomputable section +variable (K : Type*) [Field K] (m p : ℕ) [CharP K p] + + +theorem parameterCharP : CharP (T K m) p := by + apply charP_of_injective_ringHom (f:=algebraMap K (T K m)) + apply Function.LeftInverse.injective (g:=augmentationAlg K m) + intro b + exact (augmentationAlg K m).commutes b + +end +end PD4Tensor + +namespace PD4Tensor.FiniteCoordinates +noncomputable section +open PD4Tensor.Forms +variable (K R σ : Type*) [Field K] [CommRing R] [Algebra K R] + (e : σ → ℕ) + +theorem scalar_parameter_mul (r : R) (ω : Ω K (Ring R σ e) σ) : + scalar K (Ring R σ e) σ (algebraMap R (Ring R σ e) r)*ω=r • ω := by + induction ω using TensorProduct.inductionOn with + | add u v hu hv => simp only [mul_add,smul_add,hu,hv] + | tmul a v => + rw [scalar,Algebra.TensorProduct.tmul_mul_tmul,one_mul] + rw [TensorProduct.smul_tmul'] + congr 1 + convert (Algebra.smul_def r a).symm using 1 + +end +end PD4Tensor.FiniteCoordinates +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/ScalarModels.lean b/lean/OAI/Algebra/FiniteTensor/ScalarModels.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1ad4087a427679acdb2faba997405ff3d705057 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/ScalarModels.lean @@ -0,0 +1,317 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ComplementaryGraphs + +namespace OAI + +/-! Squarefree scalar tensor models, primitives and complementary dimensions. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +variable (A : Type*) [CommRing A] (m : ℕ) + +def squareIdeal : Ideal (MvPolynomial (Fin m) A) := + Ideal.span (Set.range (fun i : Fin m => (MvPolynomial.X i : MvPolynomial (Fin m) A)^2)) + +abbrev Parameters := MvPolynomial (Fin m) A ⧸ squareIdeal A m + +def parameter (i : Fin m) : Parameters A m := + Ideal.Quotient.mk (squareIdeal A m) (MvPolynomial.X i) + +def augmentation : Parameters A m →+* A := + Ideal.Quotient.lift (squareIdeal A m) + (MvPolynomial.eval₂Hom (RingHom.id A) (fun _ => 0)) (by + have h : squareIdeal A m ≤ + RingHom.ker (MvPolynomial.eval₂Hom (RingHom.id A) (fun _ : Fin m => 0)) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + simp + exact fun a ha => h ha) + +def parameterIdeal : Ideal (Parameters A m) := Ideal.span (Set.range (parameter A m)) + +@[simp] theorem parameter_sq (i : Fin m) : parameter A m i ^ 2 = 0 := by + unfold parameter + rw [←map_pow,Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.subset_span (Set.mem_range_self i) + +@[simp] theorem augmentation_parameter (i : Fin m) : augmentation A m (parameter A m i)=0 := by + change (MvPolynomial.eval₂Hom (RingHom.id A) (fun _ : Fin m => 0)) (MvPolynomial.X i)=0 + simp + +@[simp] theorem augmentation_algebraMap (a : A) : + augmentation A m (algebraMap A (Parameters A m) a)=a := by + change (MvPolynomial.eval₂Hom (RingHom.id A) (fun _ : Fin m => 0)) (MvPolynomial.C a)=a + exact MvPolynomial.eval₂Hom_C _ _ _ + +theorem parameterIdeal_le_nilradical : parameterIdeal A m ≤ nilradical (Parameters A m) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact mem_nilradical.mpr ⟨2,parameter_sq A m i⟩ + +theorem hasSubst_parameters {υ σ : Type*} [Finite σ] [Finite υ] + (H : υ → MvPowerSeries σ (Parameters A m)) + (hH : ∀ i,MvPowerSeries.constantCoeff (H i)∈parameterIdeal A m) : + MvPowerSeries.HasSubst H := by + apply MvPowerSeries.hasSubst_of_constantCoeff_nilpotent + intro i + exact mem_nilradical.mp (parameterIdeal_le_nilradical A m (hH i)) + +variable {A m} {B : Type*} [CommRing B] + +def mapParameters (f : A →+* B) : Parameters A m →+* Parameters B m := + Ideal.Quotient.lift (squareIdeal A m) + ((Ideal.Quotient.mk (squareIdeal B m)).comp (MvPolynomial.map f)) (by + have h : squareIdeal A m ≤ RingHom.ker + ((Ideal.Quotient.mk (squareIdeal B m)).comp (MvPolynomial.map f)) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change (Ideal.Quotient.mk (squareIdeal B m)) ((MvPolynomial.map f) ((MvPolynomial.X i)^2))=0 + rw [map_pow,MvPolynomial.map_X,map_pow] + exact parameter_sq B m i + exact fun a ha => h ha) + +@[simp] theorem mapParameters_parameter (f : A →+* B) (i : Fin m) : + mapParameters f (parameter A m i)=parameter B m i := by + change Ideal.Quotient.mk (squareIdeal B m) (MvPolynomial.map f (MvPolynomial.X i))=_ + rw [MvPolynomial.map_X] + rfl + +@[simp] theorem mapParameters_algebraMap (f : A →+* B) (a : A) : + mapParameters (m:=m) f (algebraMap A (Parameters A m) a)= + algebraMap B (Parameters B m) (f a) := by + change Ideal.Quotient.mk (squareIdeal B m) (MvPolynomial.map f (MvPolynomial.C a))=_ + rw [MvPolynomial.map_C] + rfl + +@[simp] theorem augmentation_mapParameters (f : A →+* B) (a : Parameters A m) : + augmentation B m (mapParameters f a)=f (augmentation A m a) := by + have heq : (augmentation B m).comp (mapParameters (m:=m) f)=f.comp (augmentation A m) := by + apply Ideal.Quotient.ringHom_ext + apply MvPolynomial.ringHom_ext + · intro a + change augmentation B m (mapParameters f (algebraMap A (Parameters A m) a))= + f (augmentation A m (algebraMap A (Parameters A m) a)) + simp only [mapParameters_algebraMap,augmentation_algebraMap] + · intro i + change augmentation B m (mapParameters f (parameter A m i))=f (augmentation A m (parameter A m i)) + simp only [mapParameters_parameter,augmentation_parameter,map_zero] + exact RingHom.congr_fun heq a + +theorem mapParameters_mem (f : A →+* B) {a : Parameters A m} + (ha : a∈parameterIdeal A m) : mapParameters f a∈parameterIdeal B m := by + have hle : parameterIdeal A m ≤ Ideal.comap (mapParameters f) (parameterIdeal B m) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change mapParameters f (parameter A m i)∈parameterIdeal B m + rw [mapParameters_parameter] + exact Ideal.subset_span (Set.mem_range_self i) + exact hle ha + +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +universe u +variable (A : Type*) [CommRing A] {l : ℕ} (σ : Fin l → Type u) + [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] (m : ℕ) + +def potential (F : ∀ i,MvPowerSeries (σ i) A) : MvPowerSeries ((i : Fin l) × σ i) A := + ∑ i,MvPowerSeries.rename (Sigma.mk i) (F i) + +def perturbation (active : Fin m ↪ Fin l) (b : ∀ j,MvPowerSeries (σ (active j)) A) + (j : Fin m) : MvPowerSeries ((i : Fin l) × σ i) A := + MvPowerSeries.rename (Sigma.mk (active j)) (b j) + +def deformed (F : ∀ i,MvPowerSeries (σ i) A) + (active : Fin m ↪ Fin l) (b : ∀ j,MvPowerSeries (σ (active j)) A) : + MvPowerSeries ((i : Fin l) × σ i) (Parameters A m) := + MvPowerSeries.map (algebraMap A (Parameters A m)) (potential A σ F) + + ∑ j,MvPowerSeries.C (parameter A m j)*MvPowerSeries.map (algebraMap A (Parameters A m)) + (perturbation A σ m active b j) + +def tangent {d c : ℕ} (e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c) + (H : ((i : Fin l) × σ i) → MvPowerSeries (Fin d) (Parameters A m)) + (G : ((i : Fin l) × σ i) → MvPowerSeries (Fin c) A) : + Matrix ((i : Fin l) × σ i) ((i : Fin l) × σ i) A := + fun i j => Sum.elim + (fun k => augmentation A m (MvPowerSeries.coeff (Finsupp.single k 1) (H i))) + (fun k => MvPowerSeries.coeff (Finsupp.single k 1) (G i)) (e j) + + + +structure TensorModel (d c : ℕ) (e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c) + (active : Fin m ↪ Fin l) where + F : ∀ i,MvPowerSeries (σ i) A + b : ∀ j,MvPowerSeries (σ (active j)) A + F_zero : ∀ i,MvPowerSeries.constantCoeff (F i)=0 + b_zero : ∀ j,MvPowerSeries.constantCoeff (b j)=0 + H : ((i : Fin l) × σ i) → MvPowerSeries (Fin d) (Parameters A m) + G : ((i : Fin l) × σ i) → MvPowerSeries (Fin c) A + H_zero : ∀ i,MvPowerSeries.constantCoeff (H i)∈parameterIdeal A m + G_zero : ∀ i,MvPowerSeries.constantCoeff (G i)=0 + tangent_unit : IsUnit (tangent A σ m e H G).det + left_vanishing : MvPowerSeries.subst H (deformed A σ m F active b)=0 + right_vanishing : MvPowerSeries.subst G (potential A σ F)=0 + left_triple : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.C (parameter A m i*parameter A m j*parameter A m k)∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst H + (MvPowerSeries.pderiv x (deformed A σ m F active b)))) + right_triple : ∀ i j k : Fin m,i≠j → i≠k → j≠k → + MvPowerSeries.subst G (perturbation A σ m active b i*perturbation A σ m active b j* + perturbation A σ m active b k)∈Ideal.span + (Set.range (fun x => MvPowerSeries.subst G (MvPowerSeries.pderiv x (potential A σ F)))) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open scoped BigOperators +universe u +variable {A B : Type*} [CommRing A] [CommRing B] {l : ℕ} {σ : Fin l → Type u} + [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] {m : ℕ} + +omit [∀ i,DecidableEq (σ i)] in + theorem map_potential (f : A →+* B) (F : ∀ i,MvPowerSeries (σ i) A) : + MvPowerSeries.map f (potential A σ F)= + potential B σ (fun i => MvPowerSeries.map f (F i)) := by + simp only [potential,map_sum,←MvPowerSeries.rename_map] + +omit [∀ i,DecidableEq (σ i)] in + theorem map_perturbation (f : A →+* B) (active : Fin m ↪ Fin l) + (b : ∀ j,MvPowerSeries (σ (active j)) A) (j : Fin m) : + MvPowerSeries.map f (perturbation A σ m active b j)= + perturbation B σ m active (fun j => MvPowerSeries.map f (b j)) j := by + exact (MvPowerSeries.rename_map _ _ _).symm + + theorem map_coefficient_extension (f : A →+* B) {υ : Type*} (F : MvPowerSeries υ A) : + MvPowerSeries.map (mapParameters (m:=m) f) + (MvPowerSeries.map (algebraMap A (Parameters A m)) F)= + MvPowerSeries.map (algebraMap B (Parameters B m)) (MvPowerSeries.map f F) := by + ext j + simp only [MvPowerSeries.coeff_map,mapParameters_algebraMap] + +omit [∀ i,DecidableEq (σ i)] in + theorem map_deformed (f : A →+* B) (F : ∀ i,MvPowerSeries (σ i) A) + (active : Fin m ↪ Fin l) (b : ∀ j,MvPowerSeries (σ (active j)) A) : + MvPowerSeries.map (mapParameters f) (deformed A σ m F active b)= + deformed B σ m (fun i => MvPowerSeries.map f (F i)) active + (fun j => MvPowerSeries.map f (b j)) := by + simp only [deformed,map_add,map_sum,map_mul,MvPowerSeries.map_C, + mapParameters_parameter,map_coefficient_extension,map_potential,map_perturbation] + +omit [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] in + theorem map_tangent (f : A →+* B) {d c : ℕ} + (e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c) + (H : ((i : Fin l) × σ i) → MvPowerSeries (Fin d) (Parameters A m)) + (G : ((i : Fin l) × σ i) → MvPowerSeries (Fin c) A) : + (tangent A σ m e H G).map f = tangent B σ m e + (fun i => MvPowerSeries.map (mapParameters f) (H i)) + (fun i => MvPowerSeries.map f (G i)) := by + ext i j + simp only [Matrix.map_apply,tangent,MvPowerSeries.coeff_map,augmentation_mapParameters] + cases e j <;> rfl + + + +def TensorModel.map {d c : ℕ} {e : ((i : Fin l) × σ i) ≃ Fin d ⊕ Fin c} + {active : Fin m ↪ Fin l} (M : TensorModel A σ m d c e active) (f : A →+* B) : + TensorModel B σ m d c e active where + F := fun i => MvPowerSeries.map f (M.F i) + b := fun j => MvPowerSeries.map f (M.b j) + F_zero := fun i => by simp only [MvPowerSeries.constantCoeff_map,M.F_zero,map_zero] + b_zero := fun j => by simp only [MvPowerSeries.constantCoeff_map,M.b_zero,map_zero] + H := fun i => MvPowerSeries.map (mapParameters f) (M.H i) + G := fun i => MvPowerSeries.map f (M.G i) + H_zero := fun i => mapParameters_mem f (M.H_zero i) + G_zero := fun i => by simp only [MvPowerSeries.constantCoeff_map,M.G_zero,map_zero] + tangent_unit := by + rw [←map_tangent] + change IsUnit (f.mapMatrix (tangent A σ m e M.H M.G)).det + rw [←f.map_det] + exact f.isUnit_map M.tangent_unit + left_vanishing := by + have Hsub := hasSubst_parameters A m M.H M.H_zero + have hh := congrArg (MvPowerSeries.map (mapParameters f)) M.left_vanishing + simpa only [MvPowerSeries.map_subst Hsub,map_deformed,map_zero] using hh + right_vanishing := by + have Gsub := MvPowerSeries.hasSubst_of_constantCoeff_zero M.G_zero + have hh := congrArg (MvPowerSeries.map f) M.right_vanishing + simpa only [MvPowerSeries.map_subst Gsub,map_potential,map_zero] using hh + left_triple := by + intro i j k hij hik hjk + have Hsub := hasSubst_parameters A m M.H M.H_zero + have hh := PD4Tensor.map_formal_gradient (mapParameters f) M.H Hsub + (deformed A σ m M.F active M.b) + (MvPowerSeries.C (parameter A m i*parameter A m j*parameter A m k)) + (by simpa only [MvPowerSeries.subst_C] using M.left_triple i j k hij hik hjk) + rw [MvPowerSeries.map_C,MvPowerSeries.subst_C] at hh + simpa only [map_mul,mapParameters_parameter,map_deformed] using hh + right_triple := by + intro i j k hij hik hjk + have Gsub := MvPowerSeries.hasSubst_of_constantCoeff_zero M.G_zero + have hh := PD4Tensor.map_formal_gradient f M.G Gsub (potential A σ M.F) _ + (M.right_triple i j k hij hik hjk) + simpa only [map_mul,map_potential,map_perturbation] using hh + +end +end PD4Tensor.Spreading + +namespace PD4Tensor +variable {K υ σ τ : Type*} [Field K] [Fintype υ] [DecidableEq υ] + [Fintype σ] [Fintype τ] + + + +theorem joinedMatrix_complementary (e : υ ≃ σ ⊕ τ) (L : Matrix υ σ K) (R : Matrix υ τ K) + (hdet : (joinedMatrix e L R).det ≠ 0) : + Function.Injective (Matrix.mulVecLin L) ∧ Function.Injective (Matrix.mulVecLin R) ∧ + IsCompl (Matrix.mulVecLin L).range (Matrix.mulVecLin R).range := by + classical + let join (v : σ → K) (w : τ → K) : υ → K := fun i => Sum.elim v w (e i) + have hj (v : σ → K) (w : τ → K) : + (joinedMatrix e L R).mulVec (join v w)=L.mulVec v+R.mulVec w := by + rw [joinedMatrix_mulVec] + simp only [join,Equiv.apply_symm_apply,Sum.elim_inl,Sum.elim_inr] + have hu : IsUnit (joinedMatrix e L R) := + (Matrix.isUnit_iff_isUnit_det _).mpr (isUnit_iff_ne_zero.mpr hdet) + have hi : Function.Injective (joinedMatrix e L R).mulVec := Matrix.mulVec_injective_iff_isUnit.mpr hu + have hs : Function.Surjective (joinedMatrix e L R).mulVec := Matrix.mulVec_surjective_iff_isUnit.mpr hu + have hL : Function.Injective (Matrix.mulVecLin L) := by + intro v w hvw + have heq : join v 0=join w 0 := hi (by rw [hj,hj]; exact congrArg (fun x => x+R.mulVec 0) hvw) + ext j + simpa only [join,Equiv.apply_symm_apply,Sum.elim_inl] using congr_fun heq (e.symm (Sum.inl j)) + have hR : Function.Injective (Matrix.mulVecLin R) := by + intro v w hvw + have heq : join 0 v=join 0 w := hi (by rw [hj,hj]; exact congrArg (fun x => L.mulVec 0+x) hvw) + ext j + simpa only [join,Equiv.apply_symm_apply,Sum.elim_inr] using congr_fun heq (e.symm (Sum.inr j)) + refine ⟨hL,hR,⟨?_,?_⟩⟩ + · apply Submodule.disjoint_def.mpr + intro z hzL hzR + obtain ⟨v,rfl⟩ := hzL + obtain ⟨w,hw⟩ := hzR + change R.mulVec w=L.mulVec v at hw + have heq : join v 0=join 0 w := hi (by + rw [hj,hj] + simpa only [Matrix.mulVec_zero,add_zero,zero_add] using hw.symm) + have hv : v=0 := by + ext j + simpa only [join,Equiv.apply_symm_apply,Sum.elim_inl,Pi.zero_apply] using + congr_fun heq (e.symm (Sum.inl j)) + simp only [hv,map_zero] + · apply codisjoint_iff.mpr + apply top_unique + intro z _ + obtain ⟨v,rfl⟩ := hs z + rw [joinedMatrix_mulVec] + exact Submodule.add_mem_sup ⟨_,rfl⟩ ⟨_,rfl⟩ + +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/SeparatedForms.lean b/lean/OAI/Algebra/FiniteTensor/SeparatedForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e0d293abbbc529dd4bfed0eb9d3d71f4a06c8ea --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/SeparatedForms.lean @@ -0,0 +1,274 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.OddTensors + +namespace OAI + +/-! Separated block forms and compatibility of differential and multiplication operators. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation +universe u + +def BlockCoords : (n : ℕ) → (Fin (n+1) → Type u) → Type u + | 0, σ => σ 0 + | n+1, σ => σ 0 ⊕ BlockCoords n (fun i => σ i.succ) + +instance blockFintype (n : ℕ) (σ : Fin (n+1) → Type u) [∀ i, Fintype (σ i)] : + Fintype (BlockCoords n σ) := by + induction n with + | zero => exact inferInstanceAs (Fintype (σ 0)) + | succ n ih => + let := ih (fun i => σ i.succ) + exact inferInstanceAs (Fintype (σ 0 ⊕ BlockCoords n (fun i => σ i.succ))) + +instance blockDecEq (n : ℕ) (σ : Fin (n+1) → Type u) [∀ i, DecidableEq (σ i)] : + DecidableEq (BlockCoords n σ) := by + induction n with + | zero => exact inferInstanceAs (DecidableEq (σ 0)) + | succ n ih => + let := ih (fun i => σ i.succ) + exact inferInstanceAs (DecidableEq (σ 0 ⊕ BlockCoords n (fun i => σ i.succ))) + +variable (K : Type*) [Field K] (p : ℕ) + +def separatedEquiv : {n : ℕ} → (σ : Fin (n+1) → Type u) → + [∀ i, Fintype (σ i)] → [∀ i, DecidableEq (σ i)] → + (⨂[K] i, Space K (σ i) p) ≃ₗ[K] Space K (BlockCoords n σ) p + | 0, _, _, _ => PiTensorProduct.subsingletonEquiv (0 : Fin 1) + | n+1, σ, _, _ => (headTailEquiv K (fun i => Space K (σ i) p)).trans + ((TensorProduct.congr (LinearEquiv.refl K _) (separatedEquiv (fun i => σ i.succ))).trans + (productEquiv K (σ 0) (BlockCoords n (fun i => σ i.succ)) p)) + +@[simp] theorem separatedEquiv_zero (σ : Fin 1 → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (v : ∀ i, Space K (σ i) p) : + separatedEquiv K p σ (PiTensorProduct.tprod K v)=v 0 := + PiTensorProduct.subsingletonEquiv_apply_tprod _ _ + +theorem separatedEquiv_succ {n : ℕ} (σ : Fin (n+1+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (v : ⨂[K] i, Space K (σ i) p) : + separatedEquiv K p σ v = productEquiv K (σ 0) (BlockCoords n (fun i => σ i.succ)) p + (TensorProduct.map LinearMap.id (separatedEquiv K p (fun i => σ i.succ)).toLinearMap + (headTailEquiv K (fun i => Space K (σ i) p) v)) := rfl + +@[simp] theorem separatedEquiv_succ_tprod {n : ℕ} (σ : Fin (n+1+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (v : ∀ i, Space K (σ i) p) : + separatedEquiv K p σ (PiTensorProduct.tprod K v) = + productEquiv K (σ 0) (BlockCoords n (fun i => σ i.succ)) p + (v 0 ⊗ₜ[K] separatedEquiv K p (fun i => σ i.succ) + (PiTensorProduct.tprod K (fun i => v i.succ))) := by + rw [separatedEquiv_succ,headTailEquiv_tprod,TensorProduct.map_tmul,LinearMap.id_apply] + rfl + +variable [CharP K p] + +theorem D_separated {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (v : ⨂[K] i, Space K (σ i) p) : + D K (BlockCoords n σ) p (separatedEquiv K p σ v) = + separatedEquiv K p σ (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => D K (σ i) p) v) := by + induction n with + | zero => + have heq : (D K (BlockCoords 0 σ) p).comp (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => D K (σ i) p)) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp [oddTensor,oddCoordinate] + rfl + exact LinearMap.congr_fun heq v + | succ n ih => + have heq : (D K (BlockCoords (n+1) σ) p).comp (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => D K (σ i) p)) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + LinearEquiv.coe_coe,separatedEquiv_succ_tprod] + change D K (σ 0 ⊕ BlockCoords n (fun i => σ i.succ)) p _ = _ + rw [D_product] + rw [separatedEquiv_succ] + rw [show headTailEquiv K (fun i => Space K (σ i) p) + (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => D K (σ i) p) (PiTensorProduct.tprod K w)) = _ from + LinearMap.congr_fun (headTail_oddTensor + (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => D K (σ i) p)) (PiTensorProduct.tprod K w)] + simp only [LinearMap.comp_apply,headTailEquiv_tprod,LinearMap.add_apply, + TensorProduct.map_tmul,LinearMap.id_apply,map_add,LinearEquiv.coe_coe] + rw [ih] + rfl + exact LinearMap.congr_fun heq v + +omit [CharP K p] in +@[simp] theorem parity_product (σ τ : Type*) [Fintype σ] [DecidableEq σ] + [Fintype τ] [DecidableEq τ] (ω : Space K σ p) (η : Space K τ p) : + parity K (A K (σ ⊕ τ) p) (σ ⊕ τ) (productEquiv K σ τ p (ω ⊗ₜ[K] η)) = + productEquiv K σ τ p + (parity K (A K σ p) σ ω ⊗ₜ[K] parity K (A K τ p) τ η) := by + simp only [productEquiv_tmul,map_mul,parity_inlForm,parity_inrForm] + +omit [CharP K p] in +theorem parity_separated {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] (v : ⨂[K] i, Space K (σ i) p) : + parity K (A K (BlockCoords n σ) p) (BlockCoords n σ) (separatedEquiv K p σ v) = + separatedEquiv K p σ + (PiTensorProduct.map (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) v) := by + induction n with + | zero => + have heq : (parity K (A K (BlockCoords 0 σ) p) (BlockCoords 0 σ)).toLinearMap.comp + (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (PiTensorProduct.map (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap)) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp + rfl + exact LinearMap.congr_fun heq v + | succ n ih => + have heq : (parity K (A K (BlockCoords (n+1) σ) p) (BlockCoords (n+1) σ)).toLinearMap.comp + (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (PiTensorProduct.map (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap)) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + LinearEquiv.coe_coe,AlgHom.toLinearMap_apply,PiTensorProduct.map_tprod, + separatedEquiv_succ_tprod] + change parity K (A K (σ 0 ⊕ BlockCoords n (fun i => σ i.succ)) p) + (σ 0 ⊕ BlockCoords n (fun i => σ i.succ)) _ = _ + rw [parity_product,ih,PiTensorProduct.map_tprod] + rfl + exact LinearMap.congr_fun heq v + +def separatedPotential : {n : ℕ} → (σ : Fin (n+1) → Type u) → + [∀ i, Fintype (σ i)] → [∀ i, DecidableEq (σ i)] → + (∀ i, A K (σ i) p) → A K (BlockCoords n σ) p + | 0, _, _, _, S => S 0 + | n+1, σ, _, _, S => + rename K (σ 0) p Sum.inl (S 0) + + rename K (BlockCoords n (fun i => σ i.succ)) p Sum.inr + (separatedPotential (fun i => σ i.succ) (fun i => S i.succ)) + +theorem koszul_separated {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] + (S : ∀ i, A K (σ i) p) (v : ⨂[K] i, Space K (σ i) p) : + koszul K (BlockCoords n σ) p (separatedPotential K p σ S) (separatedEquiv K p σ v) = + separatedEquiv K p σ (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i)) v) := by + induction n with + | zero => + have heq : (koszul K (BlockCoords 0 σ) p (separatedPotential K p σ S)).comp + (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i))) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp [oddTensor,oddCoordinate] + rfl + exact LinearMap.congr_fun heq v + | succ n ih => + have heq : (koszul K (BlockCoords (n+1) σ) p (separatedPotential K p σ S)).comp + (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i))) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + LinearEquiv.coe_coe,separatedEquiv_succ_tprod] + change koszul K (σ 0 ⊕ BlockCoords n (fun i => σ i.succ)) p + (rename K (σ 0) p Sum.inl (S 0) + + rename K (BlockCoords n (fun i => σ i.succ)) p Sum.inr + (separatedPotential K p (fun i => σ i.succ) (fun i => S i.succ))) _ = _ + rw [koszul_product,separatedEquiv_succ] + rw [show headTailEquiv K (fun i => Space K (σ i) p) + (oddTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i)) (PiTensorProduct.tprod K w)) = _ from + LinearMap.congr_fun (headTail_oddTensor + (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i))) (PiTensorProduct.tprod K w)] + simp only [LinearMap.comp_apply,headTailEquiv_tprod,LinearMap.add_apply, + TensorProduct.map_tmul,LinearMap.id_apply,map_add,LinearEquiv.coe_coe] + rw [ih] + rfl + exact LinearMap.congr_fun heq v + + +omit [CharP K p] in +theorem mulScalar_product (σ τ : Type*) [Fintype σ] [DecidableEq σ] + [Fintype τ] [DecidableEq τ] (a : A K σ p) (b : A K τ p) + (ω : Space K σ p) (η : Space K τ p) : + mulScalar K (σ ⊕ τ) p (rename K σ p Sum.inl a * rename K τ p Sum.inr b) + (productEquiv K σ τ p (ω ⊗ₜ[K] η)) = + productEquiv K σ τ p (mulScalar K σ p a ω ⊗ₜ[K] mulScalar K τ p b η) := by + have h (x y : A K (σ ⊕ τ) p) (v : Space K (σ ⊕ τ) p) : + mulScalar K (σ ⊕ τ) p (x*y) v = + mulScalar K (σ ⊕ τ) p x (mulScalar K (σ ⊕ τ) p y v) := by + simp only [mulScalar,LinearMap.mulLeft_apply,scalar_mul,mul_assoc] + rw [h,mulScalar_product_right,mulScalar_product_left] + +def separatedProduct : {n : ℕ} → (σ : Fin (n+1) → Type u) → + [∀ i, Fintype (σ i)] → [∀ i, DecidableEq (σ i)] → + (∀ i, A K (σ i) p) → A K (BlockCoords n σ) p + | 0, _, _, _, b => b 0 + | n+1, σ, _, _, b => + rename K (σ 0) p Sum.inl (b 0) * + rename K (BlockCoords n (fun i => σ i.succ)) p Sum.inr + (separatedProduct (fun i => σ i.succ) (fun i => b i.succ)) + + + +omit [CharP K p] in +theorem mulScalar_separated {n : ℕ} (σ : Fin (n+1) → Type u) + [∀ i, Fintype (σ i)] [∀ i, DecidableEq (σ i)] + (b : ∀ i, A K (σ i) p) (v : ⨂[K] i, Space K (σ i) p) : + mulScalar K (BlockCoords n σ) p (separatedProduct K p σ b) (separatedEquiv K p σ v) = + separatedEquiv K p σ (PiTensorProduct.map (fun i => mulScalar K (σ i) p (b i)) v) := by + induction n with + | zero => + have heq : (mulScalar K (BlockCoords 0 σ) p (separatedProduct K p σ b)).comp + (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (PiTensorProduct.map (fun i => mulScalar K (σ i) p (b i))) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp + rfl + exact LinearMap.congr_fun heq v + | succ n ih => + have heq : (mulScalar K (BlockCoords (n+1) σ) p (separatedProduct K p σ b)).comp + (separatedEquiv K p σ).toLinearMap = + (separatedEquiv K p σ).toLinearMap.comp + (PiTensorProduct.map (fun i => mulScalar K (σ i) p (b i))) := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro w + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + LinearEquiv.coe_coe,PiTensorProduct.map_tprod,separatedEquiv_succ_tprod] + change mulScalar K (σ 0 ⊕ BlockCoords n (fun i => σ i.succ)) p + (rename K (σ 0) p Sum.inl (b 0) * + rename K (BlockCoords n (fun i => σ i.succ)) p Sum.inr + (separatedProduct K p (fun i => σ i.succ) (fun i => b i.succ))) _ = _ + rw [mulScalar_product,ih,PiTensorProduct.map_tprod] + exact LinearMap.congr_fun heq v + +end +end PD4Tensor.TruncatedForms +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/SquarefreeParameters.lean b/lean/OAI/Algebra/FiniteTensor/SquarefreeParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..0dc1678ea9b0e78ca57af56f8e40c164e4007273 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/SquarefreeParameters.lean @@ -0,0 +1,307 @@ +import Mathlib + +namespace OAI + +/-! Squarefree parameter algebras, selectors and formal gradient base change. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor + +open scoped BigOperators + +variable (K : Type*) [Field K] (m : ℕ) + + +def squareIdeal : Ideal (MvPolynomial (Fin m) K) := + Ideal.span (Set.range (fun i : Fin m => (MvPolynomial.X i : MvPolynomial (Fin m) K) ^ 2)) + +abbrev T := MvPolynomial (Fin m) K ⧸ squareIdeal K m + +def t (i : Fin m) : T K m := Ideal.Quotient.mk (squareIdeal K m) (MvPolynomial.X i) + +def augmentation : T K m →+* K := + Ideal.Quotient.lift (squareIdeal K m) + (MvPolynomial.eval₂Hom (RingHom.id K) (fun _ => 0)) (by + have h : squareIdeal K m ≤ + RingHom.ker (MvPolynomial.eval₂Hom (RingHom.id K) (fun _ : Fin m => 0)) := by + apply Ideal.span_le.mpr + rintro _ ⟨i, rfl⟩ + simp + exact fun a ha => h ha) + +def parameterIdeal : Ideal (T K m) := Ideal.span (Set.range (t K m)) + +end PD4Tensor + +namespace PD4Tensor +noncomputable section +variable (K : Type*) [Field K] (m : ℕ) + +@[simp] theorem t_sq (i : Fin m) : t K m i ^ 2 = 0 := by + unfold t + rw [← map_pow, Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.subset_span (Set.mem_range_self i) + + +theorem parameterIdeal_le_nilradical : parameterIdeal K m ≤ nilradical (T K m) := by + apply Ideal.span_le.mpr + rintro _ ⟨i, rfl⟩ + exact mem_nilradical.mpr ⟨2, t_sq K m i⟩ + +private theorem squareIdeal_as_monomials : squareIdeal K m = + Ideal.span ((fun a : Fin m →₀ ℕ => MvPolynomial.monomial a (1 : K)) '' + Set.range (fun i : Fin m => Finsupp.single i 2)) := by + unfold squareIdeal + congr 1 + ext p + simp only [Set.mem_range, Set.mem_image] + constructor + · rintro ⟨i, rfl⟩ + exact ⟨Finsupp.single i 2, ⟨i, rfl⟩, (MvPolynomial.X_pow_eq_monomial).symm⟩ + · rintro ⟨a, ⟨i, rfl⟩, rfl⟩ + exact ⟨i, MvPolynomial.X_pow_eq_monomial⟩ + + +theorem squarefree_monomial_ne_zero (a : Fin m →₀ ℕ) (ha : ∀ i, a i ≤ 1) : + Ideal.Quotient.mk (squareIdeal K m) (MvPolynomial.monomial a 1) ≠ 0 := by + classical + rw [ne_eq, Ideal.Quotient.eq_zero_iff_mem, squareIdeal_as_monomials, + MvPolynomial.mem_ideal_span_monomial_image] + intro h + obtain ⟨_, ⟨i, rfl⟩, hi⟩ := h a (by simp [MvPolynomial.support_monomial]) + have htwo : 2 ≤ a i := by simpa using hi i + have hi1 := ha i + omega + + +theorem triple_ne_zero (i j k : Fin m) (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + t K m i * t K m j * t K m k ≠ 0 := by + unfold t + rw [← map_mul, ← map_mul] + change Ideal.Quotient.mk (squareIdeal K m) + ((MvPolynomial.monomial (Finsupp.single i 1) 1) * + (MvPolynomial.monomial (Finsupp.single j 1) 1) * + (MvPolynomial.monomial (Finsupp.single k 1) 1)) ≠ 0 + simp only [MvPolynomial.monomial_mul_monomial, one_mul] + apply squarefree_monomial_ne_zero + intro l + simp only [Finsupp.add_apply, Finsupp.single_apply] + split_ifs <;> simp_all + + +theorem triple_mul_unit_ne_zero (i j k : Fin m) (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) + {b : T K m} (hb : IsUnit b) : (t K m i * t K m j * t K m k) * b ≠ 0 := by + intro h + apply triple_ne_zero K m i j k hij hik hjk + apply hb.mul_left_cancel + simpa [mul_comm] using h + +@[simp] theorem augmentation_t (i : Fin m) : augmentation K m (t K m i)=0 := by + simp [augmentation,t,Ideal.Quotient.lift_mk] + +@[simp] theorem augmentation_algebraMap (c : K) : + augmentation K m (algebraMap K (T K m) c)=c := by + change augmentation K m (Ideal.Quotient.mk (squareIdeal K m) (MvPolynomial.C c))=c + simp [augmentation,Ideal.Quotient.lift_mk] + +def augmentationAlg : T K m →ₐ[K] K := + { augmentation K m with commutes' := augmentation_algebraMap K m } + + +theorem sub_constant_mem (a : T K m) : + a - algebraMap K (T K m) (augmentation K m a) ∈ parameterIdeal K m := by + refine Quotient.inductionOn' a ?_ + intro p + change Ideal.Quotient.mk (squareIdeal K m) p - + algebraMap K (T K m) (augmentation K m (Ideal.Quotient.mk (squareIdeal K m) p)) ∈ + parameterIdeal K m + induction p using MvPolynomial.induction_on with + | C c => + change algebraMap K (T K m) c - algebraMap K (T K m) + (augmentation K m (algebraMap K (T K m) c)) ∈ parameterIdeal K m + simp + | add p q hp hq => + simpa only [map_add,add_sub_add_comm] using (parameterIdeal K m).add_mem hp hq + | mul_X p i _ => + simp only [map_mul,show Ideal.Quotient.mk (squareIdeal K m) (MvPolynomial.X i)=t K m i from rfl, + augmentation_t,mul_zero,map_zero,sub_zero] + exact Ideal.mul_mem_left _ _ (Ideal.subset_span (Set.mem_range_self i)) + + +theorem isUnit_of_augmentation_ne_zero (a : T K m) (ha : augmentation K m a ≠ 0) : IsUnit a := by + have hn : IsNilpotent (a-algebraMap K (T K m) (augmentation K m a)) := + mem_nilradical.mp (parameterIdeal_le_nilradical K m (sub_constant_mem K m a)) + have hu := (isUnit_iff_ne_zero.mpr ha).map (algebraMap K (T K m)) + have h := hn.isUnit_add_left_of_commute hu (Commute.all _ _) + simpa only [add_sub_cancel] using h + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +variable {K ι : Type*} [Field K] + +def threeParameters (q : Fin 3 ↪ ι) : ι → T K 3 := + Function.extend q (t K 3) (fun _ => 0) + +@[simp] theorem threeParameters_selected (q : Fin 3 ↪ ι) (j : Fin 3) : + threeParameters (K:=K) q (q j) = t K 3 j := q.injective.extend_apply _ _ _ + +@[simp] theorem threeParameters_other (q : Fin 3 ↪ ι) (i : ι) (hi : i∉Set.range q) : + threeParameters (K:=K) q i = 0 := Function.extend_apply' _ _ _ hi + +theorem threeParameters_sq (q : Fin 3 ↪ ι) (i : ι) : + threeParameters (K:=K) q i * threeParameters (K:=K) q i=0 := by + by_cases hi : i∈Set.range q + · obtain ⟨j,rfl⟩ := hi + simpa only [threeParameters_selected,← pow_two] using t_sq K 3 j + · simp [threeParameters_other q i hi] + +@[simp] theorem augmentation_threeParameters (q : Fin 3 ↪ ι) (i : ι) : + augmentation K 3 (threeParameters (K:=K) q i)=0 := by + by_cases hi : i∈Set.range q + · obtain ⟨j,rfl⟩ := hi; simp + · simp [threeParameters_other q i hi] + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +variable (K : Type*) [Field K] (m : ℕ) {ι : Type*} + + + +def parameterSelector (active : Fin m ↪ ι) (q : Fin 3 ↪ ι) : T K m →ₐ[K] T K 3 := + Ideal.Quotient.liftₐ (squareIdeal K m) + (MvPolynomial.aeval (fun i => threeParameters (K:=K) q (active i))) (by + change squareIdeal K m ≤ RingHom.ker (MvPolynomial.aeval (fun i => threeParameters (K:=K) q (active i))).toRingHom + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + change (MvPolynomial.aeval (fun i => threeParameters (K:=K) q (active i))) + ((MvPolynomial.X i)^2)=0 + rw [map_pow,MvPolynomial.aeval_X,pow_two,threeParameters_sq]) + +@[simp] theorem parameterSelector_t (active : Fin m ↪ ι) (q : Fin 3 ↪ ι) (i : Fin m) : + parameterSelector K m active q (t K m i)=threeParameters (K:=K) q (active i) := by + change (MvPolynomial.aeval (fun i => threeParameters (K:=K) q (active i))) (MvPolynomial.X i)=_ + exact MvPolynomial.aeval_X _ _ + +theorem augmentation_parameterSelector (active : Fin m ↪ ι) (q : Fin 3 ↪ ι) (a : T K m) : + augmentation K 3 (parameterSelector K m active q a)=augmentation K m a := by + have heq : (augmentationAlg K 3).comp (parameterSelector K m active q)=augmentationAlg K m := by + apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + change augmentation K 3 (parameterSelector K m active q (t K m i))=augmentation K m (t K m i) + simp only [parameterSelector_t,augmentation_threeParameters,augmentation_t] + exact AlgHom.congr_fun heq a + +theorem augmentation_zero_of_mem (a : T K m) (ha : a∈parameterIdeal K m) : + augmentation K m a=0 := by + have hle : parameterIdeal K m ≤ RingHom.ker (augmentation K m) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + exact augmentation_t K m i + exact hle ha + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +variable {R S σ : Type*} [CommRing R] [CommRing S] + + +theorem map_formal_pderiv (f : R →+* S) (i : σ) (F : MvPowerSeries σ R) : + MvPowerSeries.map f (MvPowerSeries.pderiv i F)= + MvPowerSeries.pderiv i (MvPowerSeries.map f F) := by + ext d + simp only [MvPowerSeries.coeff_map,MvPowerSeries.coeff_pderiv,map_mul,map_add,map_natCast,map_one] + +variable {τ : Type*} [Fintype τ] + + +theorem map_formal_gradient (f : R →+* S) + (H : τ → MvPowerSeries σ R) (hH : MvPowerSeries.HasSubst H) + (F a : MvPowerSeries τ R) + (ha : MvPowerSeries.subst H a∈Ideal.span + (Set.range (fun i => MvPowerSeries.subst H (MvPowerSeries.pderiv i F)))) : + MvPowerSeries.subst (fun i => MvPowerSeries.map f (H i)) (MvPowerSeries.map f a) ∈ + Ideal.span (Set.range (fun i => + MvPowerSeries.subst (fun i => MvPowerSeries.map f (H i)) + (MvPowerSeries.pderiv i (MvPowerSeries.map f F)))) := by + obtain ⟨b,hb⟩ := Ideal.mem_span_range_iff_exists_fun.mp ha + refine Ideal.mem_span_range_iff_exists_fun.mpr ⟨fun i => MvPowerSeries.map f (b i),?_⟩ + have hh := congrArg (MvPowerSeries.map f) hb + simpa only [map_sum,map_mul,MvPowerSeries.map_subst hH,map_formal_pderiv] using hh + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +open scoped BigOperators +variable {ι κ : Type*} [Fintype κ] [DecidableEq ι] + {A : ι → Type*} [∀ i,AddCommMonoid (A i)] + + + +def activeExtension (active : κ ↪ ι) (b : ∀ j,A (active j)) : ∀ i,A i := + ∑ j,Pi.single (active j) (b j) + +@[simp] theorem activeExtension_selected (active : κ ↪ ι) (b : ∀ j,A (active j)) (j : κ) : + activeExtension active b (active j)=b j := by + classical + simp only [activeExtension,Finset.sum_apply] + rw [Finset.sum_eq_single j] + · exact Pi.single_eq_same _ _ + · intro k _ hk + exact Pi.single_eq_of_ne (fun h => hk (active.injective h).symm) _ + · simp + +theorem activeExtension_other (active : κ ↪ ι) (b : ∀ j,A (active j)) + (i : ι) (hi : i∉Set.range active) : activeExtension active b i=0 := by + classical + simp only [activeExtension,Finset.sum_apply] + apply Finset.sum_eq_zero + intro j _ + exact Pi.single_eq_of_ne (fun h => hi ⟨j,h.symm⟩) _ + + + +theorem sum_activeExtension [Fintype ι] {B : Type*} [AddCommMonoid B] + (active : κ ↪ ι) (b : ∀ j,A (active j)) (f : ∀ i,A i →+ B) : + ∑ i,f i (activeExtension active b i)=∑ j,f (active j) (b j) := by + classical + simp only [activeExtension,Finset.sum_apply,map_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + rw [Finset.sum_eq_single (active j)] + · rw [Pi.single_eq_same] + · intro i _ hi + rw [Pi.single_eq_of_ne hi,map_zero] + · simp + + + +omit [Fintype κ] [DecidableEq ι] in +theorem embedding_preimage (active : κ ↪ ι) (q : Fin 3 ↪ ι) + (hq : ∀ j,q j∈Set.range active) : + ∃ r : Fin 3 ↪ κ,∀ j,active (r j)=q j := by + classical + choose r hr using hq + refine ⟨⟨r,?_⟩,hr⟩ + intro i j hij + apply q.injective + rw [←hr i,←hr j,hij] + +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/TensorApproximation.lean b/lean/OAI/Algebra/FiniteTensor/TensorApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..beb3f06dc711f4baf97605ea4b9c243fdae6166c --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/TensorApproximation.lean @@ -0,0 +1,146 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.JetSolutions +import OAI.Algebra.FiniteTensor.NilpotentSubstitution +import OAI.Algebra.FiniteTensor.OffsetEquations + +namespace OAI + +/-! Algebraic tensor approximation and the characteristic-zero finite tensor obstruction. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +variable {K : Type*} [Field K] [CharZero K] {l m d c : ℕ} {n : Fin l → ℕ} + {e : ((i : Fin l) × Fin (n i)) ≃ Fin d ⊕ Fin c} {active : Fin m ↪ Fin l} + + + +theorem tensor_algebraic_approximation + (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) + (hF : ∀ i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (hb : ∀ i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) : + ∃ s : JetSolution M W,s.Algebraic := by + classical + obtain ⟨L,hL0,hLeq,hLalg,hLjet⟩ := algebraic_germ_artin (universalLeftEquation M W) + (universalLeftEquation_algebraic M W hF hb) + (fun i=>centerSeries (leftOriginal M W i)) (fun _=>centerSeries_zero _) + (original_solves_left M W) 2 + obtain ⟨R,hR0,hReq,hRalg,hRjet⟩ := algebraic_germ_artin (universalRightEquation M W) + (universalRightEquation_algebraic M W hF hb) + (fun i=>centerSeries (rightOriginal M W i)) (fun _=>centerSeries_zero _) + (original_solves_right M W) 2 + let s : JetSolution M W := { + left := L + right := R + left_zero := hL0 + right_zero := hR0 + left_jet := by + intro i j + have h := (mem_jetIdeal_pow_iff_coeff _ 2).mp (hLjet i) (Finsupp.single j 1) (by simp) + simpa only [map_sub,sub_eq_zero] using h + right_jet := by + intro i j + have h := (mem_jetIdeal_pow_iff_coeff _ 2).mp (hRjet i) (Finsupp.single j 1) (by simp) + simpa only [map_sub,sub_eq_zero] using h + left_solve := hLeq + right_solve := hReq } + exact ⟨s,⟨hLalg,hRalg⟩⟩ + + theorem tensor_algebraic_approximation_target : TensorAlgebraicApproximation := by + intro K _ _ l m d c n e active M W hF hb + exact tensor_algebraic_approximation M W hF hb + + + +theorem no_formal_tensor_model (hm : 5 ≤ m) + (M : TensorModel K (fun i=>Fin (n i)) m d c e active) + (W : TensorPrimitives K (fun i=>Fin (n i)) m M) + (hF : ∀ i,IsAlgebraic (MvPolynomial (Fin (n i)) K) (M.F i)) + (hb : ∀ i,IsAlgebraic (MvPolynomial (Fin (n (active i))) K) (M.b i)) : False := by + obtain ⟨s,hs⟩ := tensor_algebraic_approximation M W hF hb + exact no_algebraic_jet_solution hm hF hb s hs + +end +end PD4Tensor.Spreading + +namespace PD4Tensor + +open scoped BigOperators + +variable (K : Type*) [Field K] (m : ℕ) + + + + + +variable {K m} + +variable (K m) + + + +variable {K m} + + + + +end PD4Tensor + +namespace PD4Tensor.Spreading +noncomputable section +variable {K : Type*} [Field K] {m : ℕ} {n : Fin (2*m) → ℕ} + {active : Fin m ↪ Fin (2*m)} {d : ℕ} + + + +def sourceIndex (h : PD4Tensor.Parametrizations K m n d) : + PD4Tensor.Coordinates m n ≃ Fin d ⊕ Fin (PD4Tensor.N m n-d) := + Fintype.equivOfCardEq (by + simp only [Fintype.card_sum,Fintype.card_fin] + exact (Nat.add_sub_cancel' h.dimension_le).symm) + + + +def sourceModel (g : PD4Tensor.Germs K m n active) + (h : PD4Tensor.Parametrizations K m n d) (hc : PD4Tensor.TensorConditions g h) : + TensorModel K (fun i=>Fin (n i)) m d (PD4Tensor.N m n-d) (sourceIndex h) active where + F := g.F + b := g.b + F_zero := g.F_zero + b_zero := g.b_zero + H := h.HL + G := h.HR + H_zero := h.HL_zero + G_zero := h.HR_zero + tangent_unit := by + apply isUnit_iff_ne_zero.mpr + exact PD4Tensor.joinedMatrix_det_ne_zero (sourceIndex h) _ _ + hc.left_injective hc.right_injective hc.complementary + left_vanishing := hc.left_vanishing + right_vanishing := hc.right_vanishing + left_triple := hc.left_triple + right_triple := hc.right_triple + + + +theorem source_primitives_exist (g : PD4Tensor.Germs K m n active) + (h : PD4Tensor.Parametrizations K m n d) (hc : PD4Tensor.TensorConditions g h) : + Nonempty (TensorPrimitives K (fun i=>Fin (n i)) m (sourceModel g h hc)) := + exists_tensorPrimitives K (fun i=>Fin (n i)) m (sourceModel g h hc) + +end +end PD4Tensor.Spreading + + + +theorem required_finite_tensor_obstruction : PD4Tensor.FiniteTensorObstruction := by + intro K _ _ m hm n active g d h hc + obtain ⟨W⟩ := PD4Tensor.Spreading.source_primitives_exist g h hc + exact PD4Tensor.Spreading.no_formal_tensor_model hm + (PD4Tensor.Spreading.sourceModel g h hc) W g.F_algebraic g.b_algebraic +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/TensorCoordinates.lean b/lean/OAI/Algebra/FiniteTensor/TensorCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..90ea31b33a860b7d878266fc0283ba7b8a2ce842 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/TensorCoordinates.lean @@ -0,0 +1,234 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ExteriorForms +import OAI.Algebra.FiniteTensor.FrobeniusQuotient + +namespace OAI + +/-! Frobenius coordinate sums, tensor decompositions and exterior coordinate maps. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +open scoped TensorProduct +variable (K σ : Type*) [Field K] (p : ℕ) +variable {K σ p} {B : Type*} [CommRing B] [Algebra K B] + +def evaluate (v : σ → B) (hv : ∀ i, v i ^ p=0) : Ring K σ p →ₐ[K] B := + Ideal.Quotient.liftₐ (ideal K σ p) (MvPolynomial.aeval v) (by + change ideal K σ p ≤ RingHom.ker (MvPolynomial.aeval v).toRingHom + apply Ideal.span_le.mpr + rintro _ ⟨i,rfl⟩ + simp [hv]) + +@[simp] theorem evaluate_coord (v : σ → B) (hv : ∀ i, v i ^ p=0) (i : σ) : + evaluate v hv (coord K σ p i)=v i := by + change (MvPolynomial.aeval v) (MvPolynomial.X i)=v i + exact MvPolynomial.aeval_X v i + +@[ext] theorem hom_ext {f g : Ring K σ p →ₐ[K] B} + (h : ∀ i, f (coord K σ p i)=g (coord K σ p i)) : f=g := by + apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + exact h i + +variable (K σ p) {τ : Type*} + +def rename (f : σ → τ) : Ring K σ p →ₐ[K] Ring K τ p := + evaluate (fun i => coord K τ p (f i)) (fun i => variable_pow K τ p (f i)) + +@[simp] theorem rename_coord (f : σ → τ) (i : σ) : + rename K σ p f (coord K σ p i)=coord K τ p (f i) := evaluate_coord _ _ _ + +variable (τ) +def toTensor : Ring K (σ ⊕ τ) p →ₐ[K] Ring K σ p ⊗[K] Ring K τ p := + evaluate (Sum.elim + (fun i => Algebra.TensorProduct.includeLeft (R:=K) (S:=K) (coord K σ p i)) + (fun j => Algebra.TensorProduct.includeRight (R:=K) (coord K τ p j))) (by + intro u + cases u with + | inl i => change (Algebra.TensorProduct.includeLeft (R:=K) (S:=K) (coord K σ p i))^p=0 + rw [← map_pow,variable_pow,map_zero] + | inr j => change (Algebra.TensorProduct.includeRight (R:=K) (coord K τ p j))^p=0 + rw [← map_pow,variable_pow,map_zero]) + +def fromTensor : Ring K σ p ⊗[K] Ring K τ p →ₐ[K] Ring K (σ ⊕ τ) p := + Algebra.TensorProduct.lift (rename K σ p Sum.inl) (rename K τ p Sum.inr) + (fun _ _ => Commute.all _ _) + +@[simp] theorem toTensor_inl (i : σ) : + toTensor K σ p τ (coord K (σ ⊕ τ) p (.inl i)) = coord K σ p i ⊗ₜ[K] (1:Ring K τ p) := + evaluate_coord _ _ _ +@[simp] theorem toTensor_inr (j : τ) : + toTensor K σ p τ (coord K (σ ⊕ τ) p (.inr j)) = (1:Ring K σ p) ⊗ₜ[K] coord K τ p j := + evaluate_coord _ _ _ +@[simp] theorem fromTensor_tmul (a : Ring K σ p) (b : Ring K τ p) : + fromTensor K σ p τ (a ⊗ₜ[K] b) = rename K σ p Sum.inl a * rename K τ p Sum.inr b := by + simp [fromTensor] + +theorem from_toTensor : (fromTensor K σ p τ).comp (toTensor K σ p τ) = AlgHom.id _ _ := by + apply hom_ext + intro u + cases u <;> simp + +theorem to_fromTensor : (toTensor K σ p τ).comp (fromTensor K σ p τ) = AlgHom.id _ _ := by + apply Algebra.TensorProduct.ext + · apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + change toTensor K σ p τ (fromTensor K σ p τ (coord K σ p i ⊗ₜ[K] 1)) = coord K σ p i ⊗ₜ[K] 1 + simp + · apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro j + change toTensor K σ p τ (fromTensor K σ p τ (1 ⊗ₜ[K] coord K τ p j)) = 1 ⊗ₜ[K] coord K τ p j + simp + + +def sumTensorEquiv : Ring K (σ ⊕ τ) p ≃ₐ[K] Ring K σ p ⊗[K] Ring K τ p := + { toTensor K σ p τ with + invFun := fromTensor K σ p τ + left_inv := fun a => AlgHom.congr_fun (from_toTensor K σ p τ) a + right_inv := fun a => AlgHom.congr_fun (to_fromTensor K σ p τ) a } + +end +end PD4Tensor.FrobeniusTruncation + +namespace PD4Tensor.FrobeniusTruncation +noncomputable section +variable (K σ : Type*) [Field K] (p : ℕ) +variable {τ : Type*} [DecidableEq τ] + +omit [DecidableEq τ] in +@[simp] theorem rename_mk (f : σ → τ) (a : MvPolynomial σ K) : + rename K σ p f (Ideal.Quotient.mk (ideal K σ p) a) = + Ideal.Quotient.mk (ideal K τ p) (MvPolynomial.rename f a) := by + have h : (rename K σ p f).comp (Ideal.Quotient.mkₐ K (ideal K σ p)) = + (Ideal.Quotient.mkₐ K (ideal K τ p)).comp (MvPolynomial.rename f) := by + ext i + simpa [coord] using rename_coord K σ p f i + exact AlgHom.congr_fun h a + +variable [CharP K p] + +omit [DecidableEq τ] in +theorem derivative_rename (f : σ → τ) (hf : Function.Injective f) (i : σ) (a : Ring K σ p) : + derivative K τ p (f i) (rename K σ p f a)=rename K σ p f (derivative K σ p i a) := by + obtain ⟨a,rfl⟩ := Ideal.Quotient.mk_surjective a + simp only [rename_mk,derivative_mk,MvPolynomial.pderiv_rename hf] + + +theorem derivative_rename_other (f : σ → τ) (j : τ) (hj : j∉Set.range f) (a : Ring K σ p) : + derivative K τ p j (rename K σ p f a)=0 := by + obtain ⟨a,rfl⟩ := Ideal.Quotient.mk_surjective a + rw [rename_mk,derivative_mk] + have hz : MvPolynomial.pderiv j (MvPolynomial.rename f a)=0 := by + induction a using MvPolynomial.induction_on with + | C c => simp + | add a b ha hb => simp [ha,hb] + | mul_X a i ha => + have hji : j≠f i := fun h => hj ⟨i,h.symm⟩ + simp [ha,hji] + rw [hz,map_zero] + +end +end PD4Tensor.FrobeniusTruncation + + + +namespace PD4Tensor.Forms +noncomputable section +open scoped TensorProduct +variable (K σ τ : Type*) [Field K] + +def sumCoordinateIsometry : + (0 : QuadraticForm K (σ ⊕ τ → K)).IsometryEquiv + ((0 : QuadraticForm K (σ → K)).prod (0 : QuadraticForm K (τ → K))) := + { LinearEquiv.sumArrowLequivProdArrow σ τ K K with + map_app' := by intro x; simp } + + + +def sumExteriorEquiv : E K (σ ⊕ τ) ≃ₗ[K] E K σ ⊗[K] E K τ := + (CliffordAlgebra.equivOfIsometry (sumCoordinateIsometry K σ τ)).toLinearEquiv.trans + ((CliffordAlgebra.prodEquiv (0 : QuadraticForm K (σ → K)) + (0 : QuadraticForm K (τ → K))).toLinearEquiv.trans + (GradedTensorProduct.of K (CliffordAlgebra.evenOdd (0 : QuadraticForm K (σ → K))) + (CliffordAlgebra.evenOdd (0 : QuadraticForm K (τ → K)))).symm) + +def inlCoordinate : (σ → K) →ₗ[K] (σ ⊕ τ → K) := + (LinearEquiv.sumArrowLequivProdArrow σ τ K K).symm.toLinearMap.comp + (LinearMap.inl K (σ → K) (τ → K)) +def inrCoordinate : (τ → K) →ₗ[K] (σ ⊕ τ → K) := + (LinearEquiv.sumArrowLequivProdArrow σ τ K K).symm.toLinearMap.comp + (LinearMap.inr K (σ → K) (τ → K)) + +def inlExterior : E K σ →ₐ[K] E K (σ ⊕ τ) := ExteriorAlgebra.map (inlCoordinate K σ τ) +def inrExterior : E K τ →ₐ[K] E K (σ ⊕ τ) := ExteriorAlgebra.map (inrCoordinate K σ τ) + +@[simp] theorem sumExteriorEquiv_symm_tmul (a : E K σ) (b : E K τ) : + (sumExteriorEquiv K σ τ).symm (a ⊗ₜ[K] b) = + inlExterior K σ τ a * inrExterior K σ τ b := by + simp only [sumExteriorEquiv,LinearEquiv.trans_symm,LinearEquiv.symm_symm, + LinearEquiv.trans_apply] + change (CliffordAlgebra.equivOfIsometry (sumCoordinateIsometry K σ τ)).symm + (CliffordAlgebra.toProd _ _ (_ ᵍ⊗ₜ[K] _)) = _ + rw [CliffordAlgebra.toProd,GradedTensorProduct.lift_tmul,map_mul] + have h1 : (CliffordAlgebra.equivOfIsometry (sumCoordinateIsometry K σ τ)).symm.toAlgHom.comp + (CliffordAlgebra.map (QuadraticMap.Isometry.inl _ _)) = inlExterior K σ τ := by + ext v + change CliffordAlgebra.map (sumCoordinateIsometry K σ τ).symm.toIsometry + (CliffordAlgebra.map (QuadraticMap.Isometry.inl _ _) (CliffordAlgebra.ι _ v)) = + ExteriorAlgebra.map (inlCoordinate K σ τ) (ExteriorAlgebra.ι K v) + rw [CliffordAlgebra.map_apply_ι, CliffordAlgebra.map_apply_ι, ExteriorAlgebra.map_apply_ι] + rfl + have h2 : (CliffordAlgebra.equivOfIsometry (sumCoordinateIsometry K σ τ)).symm.toAlgHom.comp + (CliffordAlgebra.map (QuadraticMap.Isometry.inr _ _)) = inrExterior K σ τ := by + ext v + change CliffordAlgebra.map (sumCoordinateIsometry K σ τ).symm.toIsometry + (CliffordAlgebra.map (QuadraticMap.Isometry.inr _ _) (CliffordAlgebra.ι _ v)) = + ExteriorAlgebra.map (inrCoordinate K σ τ) (ExteriorAlgebra.ι K v) + rw [CliffordAlgebra.map_apply_ι, CliffordAlgebra.map_apply_ι, ExteriorAlgebra.map_apply_ι] + rfl + rw [show (CliffordAlgebra.equivOfIsometry (sumCoordinateIsometry K σ τ)).symm + ((CliffordAlgebra.map (QuadraticMap.Isometry.inl _ _)) a) = inlExterior K σ τ a from + AlgHom.congr_fun h1 a, + show (CliffordAlgebra.equivOfIsometry (sumCoordinateIsometry K σ τ)).symm + ((CliffordAlgebra.map (QuadraticMap.Isometry.inr _ _)) b) = inrExterior K σ τ b from + AlgHom.congr_fun h2 b] + +end +end PD4Tensor.Forms + +namespace PD4Tensor.Forms +noncomputable section +variable (K σ τ : Type*) [Field K] [DecidableEq σ] [DecidableEq τ] +@[simp] theorem inlExterior_dx (i : σ) : + inlExterior K σ τ (dx K σ i) = dx K (σ ⊕ τ) (Sum.inl i) := by + simp only [inlExterior,dx,ExteriorAlgebra.map_apply_ι] + congr 1 + ext x + cases x <;> simp [inlCoordinate,Pi.single_apply] +@[simp] theorem inrExterior_dx (j : τ) : + inrExterior K σ τ (dx K τ j) = dx K (σ ⊕ τ) (Sum.inr j) := by + simp only [inrExterior,dx,ExteriorAlgebra.map_apply_ι] + congr 1 + ext x + cases x <;> simp [inrCoordinate,Pi.single_apply] + +theorem involute_map {M N : Type*} [AddCommGroup M] [Module K M] + [AddCommGroup N] [Module K N] (f : M →ₗ[K] N) (e : ExteriorAlgebra K M) : + CliffordAlgebra.involute (ExteriorAlgebra.map f e) = + ExteriorAlgebra.map f (CliffordAlgebra.involute e) := by + induction e using ExteriorAlgebra.induction with + | algebraMap r => simp + | ι v => simp + | add a b ha hb => simp [ha,hb] + | mul a b ha hb => simp [ha,hb] +end +end PD4Tensor.Forms +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/TensorForms.lean b/lean/OAI/Algebra/FiniteTensor/TensorForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bf5692cb31f56bc0607b155c95cd032db444af5 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/TensorForms.lean @@ -0,0 +1,206 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.KoszulForms +import OAI.Algebra.FiniteTensor.TensorCoordinates + +namespace OAI + +/-! Tensor products of differential forms and head-tail tensor equivalences. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation +variable (K σ τ : Type*) [Field K] +variable (p : ℕ) + +def inlForm : Space K σ p →ₐ[K] Space K (σ ⊕ τ) p := + Algebra.TensorProduct.map (rename K σ p Sum.inl) (inlExterior K σ τ) +def inrForm : Space K τ p →ₐ[K] Space K (σ ⊕ τ) p := + Algebra.TensorProduct.map (rename K τ p Sum.inr) (inrExterior K σ τ) + + +def productEquiv : (Space K σ p ⊗[K] Space K τ p) ≃ₗ[K] Space K (σ ⊕ τ) p := + (TensorProduct.tensorTensorTensorComm K (A K σ p) (E K σ) (A K τ p) (E K τ)).trans + (TensorProduct.congr (sumTensorEquiv K σ p τ).symm.toLinearEquiv + (sumExteriorEquiv K σ τ).symm) + +@[simp] theorem productEquiv_tmul (ω : Space K σ p) (η : Space K τ p) : + productEquiv K σ τ p (ω ⊗ₜ[K] η) = inlForm K σ τ p ω * inrForm K σ τ p η := by + let M : Space K σ p ⊗[K] Space K τ p →ₗ[K] Space K (σ ⊕ τ) p := + TensorProduct.lift ((LinearMap.mul K (Space K (σ ⊕ τ) p)).compl₁₂ + (inlForm K σ τ p).toLinearMap (inrForm K σ τ p).toLinearMap) + have hM : (productEquiv K σ τ p).toLinearMap=M := by + apply TensorProduct.ext_fourfold' + intro a e b f + simp only [productEquiv,LinearEquiv.coe_coe,LinearEquiv.trans_apply, + TensorProduct.tensorTensorTensorComm_tmul,TensorProduct.congr_tmul, + sumExteriorEquiv_symm_tmul,M,TensorProduct.lift.tmul,LinearMap.compl₁₂_apply, + LinearMap.mul_apply',AlgHom.toLinearMap_apply,inlForm,inrForm, + Algebra.TensorProduct.map_tmul,Algebra.TensorProduct.tmul_mul_tmul] + rfl + exact LinearMap.congr_fun hM (ω ⊗ₜ[K] η) + +@[simp] theorem parity_inlForm (ω : Space K σ p) : + parity K (A K (σ ⊕ τ) p) (σ ⊕ τ) (inlForm K σ τ p ω) = + inlForm K σ τ p (parity K (A K σ p) σ ω) := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha,hb] + | tmul a e => simp [inlForm,inlExterior,involute_map] +@[simp] theorem parity_inrForm (ω : Space K τ p) : + parity K (A K (σ ⊕ τ) p) (σ ⊕ τ) (inrForm K σ τ p ω) = + inrForm K σ τ p (parity K (A K τ p) τ ω) := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha,hb] + | tmul a e => simp [inrForm,inrExterior,involute_map] + +variable [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] [CharP K p] +@[simp] theorem D_inlForm (ω : Space K σ p) : + D K (σ ⊕ τ) p (inlForm K σ τ p ω)=inlForm K σ τ p (D K σ p ω) := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha,hb] + | tmul a e => + simp only [inlForm,Algebra.TensorProduct.map_tmul,D,differential_tmul, + Fintype.sum_sum_type,map_sum,map_mul,inlExterior_dx] + simp only [derivative_rename K σ p Sum.inl Sum.inl_injective] + have hz (j : τ) : derivative K (σ ⊕ τ) p (Sum.inr j) (rename K σ p Sum.inl a)=0 := + derivative_rename_other K σ p Sum.inl (Sum.inr j) (by rintro ⟨i,h⟩; cases h) a + simp only [hz,TensorProduct.zero_tmul,Finset.sum_const_zero,add_zero] + +@[simp] theorem D_inrForm (ω : Space K τ p) : + D K (σ ⊕ τ) p (inrForm K σ τ p ω)=inrForm K σ τ p (D K τ p ω) := by + induction ω using TensorProduct.inductionOn with + | add a b ha hb => simp [ha,hb] + | tmul a e => + simp only [inrForm,Algebra.TensorProduct.map_tmul,D,differential_tmul, + Fintype.sum_sum_type,map_sum,map_mul,inrExterior_dx] + simp only [derivative_rename K τ p Sum.inr Sum.inr_injective] + have hz (i : σ) : derivative K (σ ⊕ τ) p (Sum.inl i) (rename K τ p Sum.inr a)=0 := + derivative_rename_other K τ p Sum.inr (Sum.inl i) (by rintro ⟨j,h⟩; cases h) a + simp only [hz,TensorProduct.zero_tmul,Finset.sum_const_zero,zero_add] + + +theorem D_product (ω : Space K σ p) (η : Space K τ p) : + D K (σ ⊕ τ) p (productEquiv K σ τ p (ω ⊗ₜ[K] η)) = + productEquiv K σ τ p (D K σ p ω ⊗ₜ[K] η + + parity K (A K σ p) σ ω ⊗ₜ[K] D K τ p η) := by + simp only [productEquiv_tmul,D_mul,D_inlForm,D_inrForm,parity_inlForm,map_add] + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation +variable (K σ τ : Type*) [Field K] [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] +variable (p : ℕ) [CharP K p] + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] [CharP K p] in +@[simp] theorem inlForm_scalar (a : A K σ p) : + inlForm K σ τ p (scalar K (A K σ p) σ a)= + scalar K (A K (σ ⊕ τ) p) (σ ⊕ τ) (rename K σ p Sum.inl a) := by + simp [inlForm,scalar] +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] [CharP K p] in +@[simp] theorem inrForm_scalar (a : A K τ p) : + inrForm K σ τ p (scalar K (A K τ p) τ a)= + scalar K (A K (σ ⊕ τ) p) (σ ⊕ τ) (rename K τ p Sum.inr a) := by + simp [inrForm,scalar] + +theorem D_scalar_anticommute (b : A K σ p) (ω : Space K σ p) : + D K σ p (scalar K (A K σ p) σ b) * ω = + parity K (A K σ p) σ ω * D K σ p (scalar K (A K σ p) σ b) := by + rw [D,differential_scalar] + exact oneForm_anticommute _ _ + + +theorem koszul_product (S : A K σ p) (T : A K τ p) + (ω : Space K σ p) (η : Space K τ p) : + koszul K (σ ⊕ τ) p (rename K σ p Sum.inl S + rename K τ p Sum.inr T) + (productEquiv K σ τ p (ω ⊗ₜ[K] η)) = + productEquiv K σ τ p (koszul K σ p S ω ⊗ₜ[K] η + + parity K (A K σ p) σ ω ⊗ₜ[K] koszul K τ p T η) := by + simp only [koszul,LinearMap.mulLeft_apply,productEquiv_tmul,map_add,scalar_add,add_mul] + rw [← inlForm_scalar,← inrForm_scalar,D_inlForm] + simp only [map_mul] + congr 1 + · rw [mul_assoc] + · rw [← mul_assoc,inrForm_scalar,D_scalar_anticommute,parity_inlForm,mul_assoc, + ← inrForm_scalar,D_inrForm] + + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] [CharP K p] in +theorem mulScalar_product_left (b : A K σ p) (ω : Space K σ p) (η : Space K τ p) : + mulScalar K (σ ⊕ τ) p (rename K σ p Sum.inl b) + (productEquiv K σ τ p (ω ⊗ₜ[K] η)) = + productEquiv K σ τ p (mulScalar K σ p b ω ⊗ₜ[K] η) := by + simp only [mulScalar,LinearMap.mulLeft_apply,productEquiv_tmul,map_mul,inlForm_scalar,mul_assoc] + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] [CharP K p] in +theorem mulScalar_product_right (b : A K τ p) (ω : Space K σ p) (η : Space K τ p) : + mulScalar K (σ ⊕ τ) p (rename K τ p Sum.inr b) + (productEquiv K σ τ p (ω ⊗ₜ[K] η)) = + productEquiv K σ τ p (ω ⊗ₜ[K] mulScalar K τ p b η) := by + simp only [mulScalar,LinearMap.mulLeft_apply,productEquiv_tmul,map_mul,inrForm_scalar] + rw [← mul_assoc,scalar_commute,mul_assoc] + +end +end PD4Tensor.TruncatedForms + + + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct +variable (K : Type*) [Field K] {n : ℕ} (V : Fin (n+1) → Type*) + [∀ i, AddCommGroup (V i)] [∀ i, Module K (V i)] + +def headTailTo : (⨂[K] i, V i) →ₗ[K] V 0 ⊗[K] (⨂[K] i : Fin n, V i.succ) := + PiTensorProduct.lift (LinearMap.uncurryLeft + { toFun := fun x => (TensorProduct.mk K _ _ x).compMultilinearMap (PiTensorProduct.tprod K) + map_add' := by intro x y; ext v; simp + map_smul' := by intro c x; ext v; simp [TensorProduct.smul_tmul'] }) + +def headTailFrom : V 0 ⊗[K] (⨂[K] i : Fin n, V i.succ) →ₗ[K] (⨂[K] i, V i) := + TensorProduct.lift (PiTensorProduct.lift.toLinearMap.comp (PiTensorProduct.tprod K).curryLeft) + +@[simp] theorem headTailTo_tprod (v : ∀ i, V i) : + headTailTo K V (PiTensorProduct.tprod K v)= + v 0 ⊗ₜ[K] PiTensorProduct.tprod K (fun i : Fin n => v i.succ) := by + simp only [headTailTo,PiTensorProduct.lift.tprod,LinearMap.uncurryLeft_apply, + LinearMap.coe_mk, AddHom.coe_mk,LinearMap.compMultilinearMap_apply,TensorProduct.mk_apply] + rfl +@[simp] theorem headTailFrom_tmul (x : V 0) (v : ∀ i : Fin n, V i.succ) : + headTailFrom K V (x ⊗ₜ[K] PiTensorProduct.tprod K v)= + PiTensorProduct.tprod K (Fin.cons x v) := by simp [headTailFrom] + + +def headTailEquiv : (⨂[K] i, V i) ≃ₗ[K] V 0 ⊗[K] (⨂[K] i : Fin n, V i.succ) := + LinearEquiv.ofLinearMap (headTailTo K V) (headTailFrom K V) (by + apply TensorProduct.ext' + intro x z + induction z using PiTensorProduct.induction_on with + | smul_tprod c v => simp [headTailFrom,headTailTo] + | add a b ha hb => + simp only [LinearMap.comp_apply,LinearMap.id_apply] at ha hb ⊢ + simp only [TensorProduct.tmul_add,map_add,ha,hb]) (by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro v + simp only [LinearMap.compMultilinearMap_apply,LinearMap.comp_apply, + headTailTo_tprod,headTailFrom_tmul,LinearMap.id_apply] + congr 1 + ext i + cases i using Fin.cases <;> rfl) + +@[simp] theorem headTailEquiv_tprod (v : ∀ i, V i) : + headTailEquiv K V (PiTensorProduct.tprod K v)= + v 0 ⊗ₜ[K] PiTensorProduct.tprod K (fun i : Fin n => v i.succ) := headTailTo_tprod K V v + +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/TensorKernels.lean b/lean/OAI/Algebra/FiniteTensor/TensorKernels.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7f51f7618d5635aaee56a3914f6240f812eead9 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/TensorKernels.lean @@ -0,0 +1,381 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.CohomologyReduction +import OAI.Algebra.FiniteTensor.OddTensors + +namespace OAI + +/-! Tensor representatives, kernel support and projected operator reduction. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor +noncomputable section +variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] +namespace SuperReduction +variable (C : SuperReduction K V) + + +abbrev Representatives := LinearMap.range C.p + +def repProject : V →ₗ[K] Representatives C := C.p.rangeRestrict + +def repInclude : Representatives C →ₗ[K] V := (LinearMap.range C.p).subtype + +@[simp] theorem repProject_apply (v : V) : (repProject C v : V)=C.p v := rfl +@[simp] theorem repInclude_apply (v : Representatives C) : repInclude C v=(v:V) := rfl + +@[simp] theorem project_include (v : Representatives C) : repProject C (repInclude C v)=v := by + apply Subtype.ext + obtain ⟨w,hw⟩ := v.property + change C.p (v:V)=(v:V) + rw [← hw,C.pp] + +@[simp] theorem d_include (v : Representatives C) : C.d (repInclude C v)=0 := by + obtain ⟨w,hw⟩ := v.property + change C.d (v:V)=0 + rw [← hw,C.dp] + +@[simp] theorem project_d (v : V) : repProject C (C.d v)=0 := by + apply Subtype.ext + exact C.pd v + + +theorem project_map_project (f : V →ₗ[K] V) + (hf : ∀ v, C.p (f (C.d v))=0) (v : V) (hv : C.d v=0) : + repProject C (f (C.p v))=repProject C (f v) := by + apply Subtype.ext + change C.p (f (C.p v))=C.p (f v) + have h := C.hom v + rw [hv,map_zero,add_zero] at h + have hh := congrArg (fun x => C.p (f x)) h + rw [hf,map_sub,map_sub] at hh + exact (sub_eq_zero.mp hh.symm).symm + +def repMap (f : V →ₗ[K] V) : Representatives C →ₗ[K] Representatives C := + (repProject C).comp (f.comp (repInclude C)) + +@[simp] theorem repMap_apply (f : V →ₗ[K] V) (v : Representatives C) : + repMap C f v=repProject C (f (v:V)) := rfl + +@[simp] theorem repMap_zero : repMap C (0 : V →ₗ[K] V)=0 := by + apply LinearMap.ext; intro v; simp + +@[simp] theorem repMap_id : repMap C (LinearMap.id : V →ₗ[K] V)=LinearMap.id := by + apply LinearMap.ext; intro v + exact project_include C v + +@[simp] theorem repMap_add (f g : V →ₗ[K] V) : repMap C (f+g)=repMap C f+repMap C g := by + apply LinearMap.ext; intro v; simp + +@[simp] theorem repMap_neg (f : V →ₗ[K] V) : repMap C (-f) = -repMap C f := by + apply LinearMap.ext; intro v; simp + + +theorem repMap_comp (f g : V →ₗ[K] V) + (hf : ∀ v, C.p (f (C.d v))=0) + (hg : ∀ v, C.d v=0 → C.d (g v)=0) : + (repMap C f).comp (repMap C g)=repMap C (f.comp g) := by + apply LinearMap.ext; intro v + change repProject C (f (C.p (g (v:V))))=repProject C (f (g (v:V))) + exact project_map_project C f hf _ (hg _ (d_include C v)) + + + +theorem exists_induced_reduction [Invertible (2:K)] + (d b g : V →ₗ[K] V) + (hdd : ∀ v, d (d v)=0) (hgg : ∀ v, g (g v)=v) + (hdg : ∀ v, d (g v) = -g (d v)) + (hδd : ∀ v, C.d (d v) = -d (C.d v)) + (hδg : ∀ v, C.d (g v) = -g (C.d v)) + (hδb : ∀ v, C.d (b v) = b (C.d v)) + (hbg : ∀ v, b (g v)=g (b v)) : + ∃ E : SuperReduction K (Representatives C), + E.d=repMap C d ∧ E.g=repMap C g ∧ + ∀ v, repMap C b v=0 → repMap C b (E.p v)=0 := by + have dcycle : ∀ v, C.d v=0 → C.d (d v)=0 := by + intro v hv; rw [hδd,hv,map_zero,neg_zero] + have gcycle : ∀ v, C.d v=0 → C.d (g v)=0 := by + intro v hv; rw [hδg,hv,map_zero,neg_zero] + have bcycle : ∀ v, C.d v=0 → C.d (b v)=0 := by + intro v hv; rw [hδb,hv,map_zero] + have dbound : ∀ v, C.p (d (C.d v))=0 := by + intro v + have h := congrArg C.p (hδd v) + rw [C.pd,map_neg] at h + exact neg_eq_zero.mp h.symm + have gbound : ∀ v, C.p (g (C.d v))=0 := by + intro v + have h := congrArg C.p (hδg v) + rw [C.pd,map_neg] at h + exact neg_eq_zero.mp h.symm + have bbound : ∀ v, C.p (b (C.d v))=0 := by + intro v + have h := congrArg C.p (hδb v) + rw [C.pd] at h + exact h.symm + have dd : ∀ v, repMap C d (repMap C d v)=0 := by + have hh : d.comp d=0 := LinearMap.ext hdd + intro v + have h := LinearMap.congr_fun (repMap_comp C d d dbound dcycle) v + simpa only [LinearMap.comp_apply,hh,repMap_zero,LinearMap.zero_apply] using h + have gg : ∀ v, repMap C g (repMap C g v)=v := by + have hh : g.comp g=LinearMap.id := LinearMap.ext hgg + intro v + have h := LinearMap.congr_fun (repMap_comp C g g gbound gcycle) v + simpa only [LinearMap.comp_apply,hh,repMap_id,LinearMap.id_apply] using h + have dg : ∀ v, repMap C d (repMap C g v) = -repMap C g (repMap C d v) := by + have hh : d.comp g= -(g.comp d) := LinearMap.ext hdg + intro v + have h₁ := LinearMap.congr_fun (repMap_comp C d g dbound gcycle) v + have h₂ := LinearMap.congr_fun (repMap_comp C g d gbound dcycle) v + rw [hh,repMap_neg] at h₁ + exact h₁.trans (congrArg Neg.neg h₂.symm) + have bg : ∀ v, repMap C b (repMap C g v)=repMap C g (repMap C b v) := by + have hh : b.comp g=g.comp b := LinearMap.ext hbg + intro v + have h₁ := LinearMap.congr_fun (repMap_comp C b g bbound gcycle) v + have h₂ := LinearMap.congr_fun (repMap_comp C g b gbound bcycle) v + exact h₁.trans (hh ▸ h₂.symm) + obtain ⟨E,hEd,hEg,hEp⟩ := exists_superReduction (repMap C d) (repMap C g) + dd gg dg (LinearMap.ker (repMap C b)) (by + intro v hv + change repMap C b (repMap C g v)=0 + rw [bg,hv,map_zero]) + exact ⟨E,hEd,hEg,hEp⟩ + +end SuperReduction +end +end PD4Tensor + + + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct + +variable {K V W X : Type*} [Field K] +variable [AddCommGroup V] [Module K V] [AddCommGroup W] [Module K W] +variable [AddCommGroup X] [Module K X] + + +theorem factor_of_ker_le (f : V →ₗ[K] W) (g : V →ₗ[K] X) + (h : LinearMap.ker f ≤ LinearMap.ker g) : + ∃ l : W →ₗ[K] X, l.comp f = g := by + let a : LinearMap.range f →ₗ[K] X := + ((LinearMap.ker f).liftQ g h).comp f.quotKerEquivRange.symm.toLinearMap + obtain ⟨l, hl⟩ := a.exists_extend + refine ⟨l, ?_⟩ + ext v + have hv := LinearMap.congr_fun hl ⟨f v, LinearMap.mem_range_self f v⟩ + simpa [a] using hv + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] +variable (E : ι → Type*) [∀ i, AddCommGroup (E i)] [∀ i, Module K (E i)] + + +def partialTensor (b : ∀ i, E i →ₗ[K] E i) (S : Finset ι) : + (⨂[K] i, E i) →ₗ[K] (⨂[K] i, E i) := + PiTensorProduct.map (fun i => if i ∈ S then b i else LinearMap.id) + + +def kernelSupport (b : ∀ i, E i →ₗ[K] E i) (r : ℕ) : + Submodule K (⨂[K] i, E i) := + Submodule.span K {v | ∃ (f : ∀ i, E i) (S : Finset ι), + S.card ≤ r ∧ (∀ i ∉ S, b i (f i) = 0) ∧ PiTensorProduct.tprod K f = v} + + +theorem triple_kernel_support (b : ∀ i, E i →ₗ[K] E i) + (v : ⨂[K] i, E i) + (hv : ∀ S : Finset ι, S.card = 3 → partialTensor E b S v = 0) : + v ∈ kernelSupport E b 2 := by + classical + + choose C hC using fun i => (LinearMap.ker (b i)).exists_isCompl + let P : ∀ i, E i →ₗ[K] E i := fun i => + (LinearMap.ker (b i)).subtype.comp + ((LinearMap.ker (b i)).projectionOnto (C i) (hC i)) + let Q : ∀ i, E i →ₗ[K] E i := fun i => LinearMap.id - P i + have hP (i : ι) (x : E i) : b i (P i x) = 0 := + ((LinearMap.ker (b i)).projectionOnto (C i) (hC i) x).property + have hQ (i : ι) : LinearMap.ker (b i) ≤ LinearMap.ker (Q i) := by + intro x hx + simp only [LinearMap.mem_ker, Q, LinearMap.sub_apply, LinearMap.id_apply] + change x - ((LinearMap.ker (b i)).projectionOnto (C i) (hC i) x : E i) = 0 + rw [Submodule.projectionOnto_apply_of_mem_left (hC i) hx] + exact sub_self _ + choose L hL using fun i => factor_of_ker_le (b i) (Q i) (hQ i) + have hsum : (∑ S : Finset ι, PiTensorProduct.map (S.piecewise Q P)) = + (LinearMap.id : (⨂[K] i, E i) →ₗ[K] (⨂[K] i, E i)) := by + have h := (PiTensorProduct.mapMultilinear K E E).map_add_univ Q P + have hQP : Q + P = fun i => LinearMap.id := by + funext i + simp [Q] + rw [hQP] at h + exact h.symm.trans PiTensorProduct.map_id + have hsmall (S : Finset ι) (hS : S.card ≤ 2) : + PiTensorProduct.map (S.piecewise Q P) v ∈ kernelSupport E b 2 := by + have hrange : LinearMap.range (PiTensorProduct.map (S.piecewise Q P)) ≤ + kernelSupport E b 2 := by + rw [PiTensorProduct.map_range_eq_span_tprod] + apply Submodule.span_le.mpr + rintro z ⟨f, rfl⟩ + apply Submodule.subset_span + refine ⟨fun i => S.piecewise Q P i (f i), S, hS, ?_, rfl⟩ + intro i hi + simpa [Finset.piecewise, hi] using hP i (f i) + exact hrange (LinearMap.mem_range_self _ v) + have hlarge (S : Finset ι) (hS : 2 < S.card) : + PiTensorProduct.map (S.piecewise Q P) v = 0 := by + obtain ⟨R, hRS, hR⟩ := Finset.exists_subset_card_eq (show 3 ≤ S.card by omega) + let D : ∀ i, E i →ₗ[K] E i := fun i => + if i ∈ R then L i else S.piecewise Q P i + have hfactor : PiTensorProduct.map (S.piecewise Q P) = + (PiTensorProduct.map D).comp (partialTensor E b R) := by + rw [partialTensor, ← PiTensorProduct.map_comp] + congr 1 + funext i + by_cases hi : i ∈ R + · simpa [D, Finset.piecewise, hi, hRS hi] using (hL i).symm + · simp [D, hi] + rw [hfactor, LinearMap.comp_apply, hv R hR, map_zero] + have heq := LinearMap.congr_fun hsum v + rw [LinearMap.sum_apply, LinearMap.id_apply] at heq + rw [← heq] + apply Submodule.sum_mem + intro S _ + by_cases hS : S.card ≤ 2 + · exact hsmall S hS + · rw [hlarge S (by omega)] + exact Submodule.zero_mem _ + +end +end PD4Tensor + +namespace PD4Tensor +noncomputable section +open scoped TensorProduct +variable {K V : Type*} [Field K] [AddCommGroup V] [Module K V] +namespace SuperReduction + + +theorem cycle_of_project_zero (C : SuperReduction K V) (v : V) + (hd : C.d v=0) (hp : repProject C v=0) : v ∈ LinearMap.range C.d := by + refine ⟨C.h v, ?_⟩ + have h := C.hom v + have hp' : C.p v=0 := congrArg Subtype.val hp + simpa only [hd,hp',map_zero,add_zero,sub_zero] using h + +end SuperReduction + +namespace CohomologyTensor +open SuperReduction +variable {ι : Type*} [Fintype ι] [LinearOrder ι] +variable {E : ι → Type*} [∀ i, AddCommGroup (E i)] [∀ i, Module K (E i)] +variable (C : ∀ i, SuperReduction K (E i)) + +abbrev Factors (i : ι) := Representatives (C i) + +def project : (⨂[K] i, E i) →ₗ[K] (⨂[K] i, Factors C i) := + PiTensorProduct.map (fun i => repProject (C i)) + +def embed : (⨂[K] i, Factors C i) →ₗ[K] (⨂[K] i, E i) := + PiTensorProduct.map (fun i => repInclude (C i)) + +omit [Fintype ι] [LinearOrder ι] in +@[simp] theorem project_include (v : ⨂[K] i, Factors C i) : project C (embed C v)=v := by + have h : (project C).comp (embed C)=LinearMap.id := by + rw [project,embed,← PiTensorProduct.map_comp] + have hmap : (fun i => (repProject (C i)).comp (repInclude (C i))) = + fun i => (LinearMap.id : Factors C i →ₗ[K] Factors C i) := by + funext i + apply LinearMap.ext; intro v + exact SuperReduction.project_include (C i) v + rw [hmap,PiTensorProduct.map_id] + exact LinearMap.congr_fun h v + +omit [Fintype ι] [LinearOrder ι] in +@[simp] theorem include_project (v : ⨂[K] i, E i) : embed C (project C v)=finiteP C v := by + have h : (embed C).comp (project C)=finiteP C := by + rw [embed,project,← PiTensorProduct.map_comp] + rfl + exact LinearMap.congr_fun h v + +theorem finiteD_eq : finiteD C=oddTensor (fun i => (C i).g) (fun i => (C i).d) := rfl + +@[simp] theorem project_d (v : ⨂[K] i, E i) : project C (finiteD C v)=0 := by + exact LinearMap.congr_fun (tensorMap_oddTensor_zero (fun i => (C i).g) + (fun i => (C i).d) (fun i => repProject (C i)) (fun i => SuperReduction.project_d (C i))) v + +@[simp] theorem d_include (v : ⨂[K] i, Factors C i) : finiteD C (embed C v)=0 := by + exact LinearMap.congr_fun (oddTensor_tensorMap_zero (fun i => (C i).g) + (fun i => (C i).d) (fun i => repInclude (C i)) (fun i => SuperReduction.d_include (C i))) v + + +theorem odd_sandwich (d : ∀ i, E i →ₗ[K] E i) (v : ⨂[K] i, Factors C i) : + project C (oddTensor (fun i => (C i).g) d (embed C v)) = + oddTensor (fun i => repMap (C i) (C i).g) (fun i => repMap (C i) (d i)) v := by + exact LinearMap.congr_fun (oddTensor_sandwich (fun i => (C i).g) d + (fun i => repProject (C i)) (fun i => repInclude (C i)) + (fun i => SuperReduction.project_include (C i))) v + + +omit [Fintype ι] in +theorem partial_sandwich (b : ∀ i, E i →ₗ[K] E i) (S : Finset ι) + (v : ⨂[K] i, Factors C i) : + project C (partialTensor E b S (embed C v)) = + partialTensor (fun i => ↥(Factors C i)) (fun i => repMap (C i) (b i)) S v := by + have h : (project C).comp ((partialTensor E b S).comp (embed C)) = + partialTensor (fun i => ↥(Factors C i)) (fun i => repMap (C i) (b i)) S := by + apply PiTensorProduct.ext + apply MultilinearMap.ext + intro f + simp only [project,embed,partialTensor,LinearMap.compMultilinearMap_apply, + LinearMap.comp_apply,PiTensorProduct.map_tprod] + congr 1 + funext i + by_cases hi : i∈S + · simp only [hi,ite_true,repMap_apply,repInclude_apply] + · simp only [hi,ite_false,LinearMap.id_apply,SuperReduction.project_include] + exact LinearMap.congr_fun h v + + +theorem partial_commute (b : ∀ i, E i →ₗ[K] E i) + (hbd : ∀ i v, b i ((C i).d v)=(C i).d (b i v)) + (hbg : ∀ i v, b i ((C i).g v)=(C i).g (b i v)) + (S : Finset ι) (v : ⨂[K] i, E i) : + partialTensor E b S (finiteD C v)=finiteD C (partialTensor E b S v) := by + apply LinearMap.congr_fun (oddTensor_naturality (fun i => (C i).g) (fun i => (C i).d) + (fun i => (C i).g) (fun i => (C i).d) (fun i => if i∈S then b i else LinearMap.id) ?_ ?_) v + · intro i w; by_cases hi : i∈S <;> simp [hi,hbg] + · intro i w; by_cases hi : i∈S <;> simp [hi,hbd] + + + +theorem pairing_projection (L : (⨂[K] i, E i) →ₗ[K] K) + (hL : ∀ v, L (finiteD C v)=0) (v : ⨂[K] i, E i) (hv : finiteD C v=0) : + L (embed C (project C v))=L v := by + obtain ⟨w,hw⟩ := finite_cycle_mod_projection C v hv + have hh := congrArg L hw + rw [hL,map_sub] at hh + rw [include_project] + exact (sub_eq_zero.mp hh.symm).symm + + + +theorem operator_projection (f : (⨂[K] i, E i) →ₗ[K] (⨂[K] i, E i)) + (hf : ∀ v, project C (f (finiteD C v))=0) + (v : ⨂[K] i, E i) (hv : finiteD C v=0) : + project C (f (embed C (project C v)))=project C (f v) := by + obtain ⟨w,hw⟩ := finite_cycle_mod_projection C v hv + have hh := congrArg (fun z => project C (f z)) hw + rw [hf,map_sub,map_sub] at hh + rw [include_project] + exact (sub_eq_zero.mp hh.symm).symm + +end CohomologyTensor +end +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/TensorResidues.lean b/lean/OAI/Algebra/FiniteTensor/TensorResidues.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d14caaf061a565f834c1924d2aeef500489f4c3 --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/TensorResidues.lean @@ -0,0 +1,578 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.DeformedCycles +import OAI.Algebra.FiniteTensor.FormReindexing + +namespace OAI + +/-! Three-block cycles, Frobenius residues and nonzero normal pairings. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation +universe u +variable (K : Type*) [Field K] (p : ℕ) [CharP K p] [Invertible (2 : K)] + {n : ℕ} (σ : Fin (n+1) → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + +def sigmaBlock (i : Fin (n+1)) (b : A K (σ i) p) : A K ((i : Fin (n+1)) × σ i) p := + rename K (σ i) p (Sigma.mk i) b + +def sigmaSelected (b : ∀ i,A K (σ i) p) (s : Finset (Fin (n+1))) : + A K ((i : Fin (n+1)) × σ i) p := + ∏ i∈s, sigmaBlock K p σ i (b i) + +omit [CharP K p] [Invertible (2 : K)] in +theorem sigmaPotential_single (i : Fin (n+1)) (b : A K (σ i) p) : + sigmaPotential K p σ (Pi.single i b)=sigmaBlock K p σ i b := by + unfold sigmaPotential + rw [Finset.sum_eq_single i] + · rw [Pi.single_eq_same]; rfl + · intro j _ hji; rw [Pi.single_eq_of_ne hji,map_zero] + · intro hi; exact (hi (Finset.mem_univ i)).elim + +omit [Invertible (2 : K)] in +theorem koszul_sigmaBlock (b : ∀ i,A K (σ i) p) (i : Fin (n+1)) + (v : ⨂[K] i, Space K (σ i) p) : + koszul K ((i : Fin (n+1)) × σ i) p (sigmaBlock K p σ i (b i)) + (sigmaSeparatedEquiv K p σ v)= + sigmaSeparatedEquiv K p σ + (PiTensorProduct.map (oddCoordinate + (fun j => (parity K (A K (σ j) p) (σ j)).toLinearMap) + (fun j => koszul K (σ j) p (b j)) i) v) := by + have h := koszul_sigmaSeparated K p σ (Pi.single i (b i)) v + rw [sigmaPotential_single] at h + have hf : (fun j => koszul K (σ j) p ((Pi.single i (b i) : ∀ j,A K (σ j) p) j))= + Pi.single i (koszul K (σ i) p (b i)) := by + funext j + by_cases hji : j=i + · subst j; rw [Pi.single_eq_same,Pi.single_eq_same] + · rw [Pi.single_eq_of_ne hji,Pi.single_eq_of_ne hji,koszul_zero] + rw [hf,oddTensor_single (fun j => (parity K (A K (σ j) p) (σ j)).toLinearMap) + (fun j => koszul K (σ j) p (b j)) i] at h + exact h + +omit [CharP K p] [Invertible (2 : K)] in +theorem sigmaProduct_selected (b : ∀ i,A K (σ i) p) (s : Finset (Fin (n+1))) : + sigmaProduct K p σ (fun i => if i∈s then b i else 1)=sigmaSelected K p σ b s := by + classical + unfold sigmaProduct sigmaSelected sigmaBlock + simp only [apply_ite,map_one,Finset.prod_ite_mem,Finset.univ_inter] + +omit [CharP K p] [Invertible (2 : K)] in +theorem mulScalar_sigmaSelected (b : ∀ i,A K (σ i) p) (s : Finset (Fin (n+1))) + (v : ⨂[K] i, Space K (σ i) p) : + mulScalar K ((i : Fin (n+1)) × σ i) p (sigmaSelected K p σ b s) + (sigmaSeparatedEquiv K p σ v)= + sigmaSeparatedEquiv K p σ + (partialTensor (fun i => Space K (σ i) p) (fun i => mulScalar K (σ i) p (b i)) s v) := by + classical + have h := mulScalar_sigmaSeparated K p σ (fun i => if i∈s then b i else 1) v + rw [sigmaProduct_selected] at h + have hf : (fun i => mulScalar K (σ i) p (if i∈s then b i else 1))= + (fun i => if i∈s then mulScalar K (σ i) p (b i) else LinearMap.id) := by + funext i + split_ifs <;> simp only [mulScalar_one] + rw [hf] at h + exact h + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor.TruncatedForms +noncomputable section +open scoped TensorProduct BigOperators +open Forms FrobeniusTruncation SuperReduction +universe u +variable (K : Type*) [Field K] (p : ℕ) [CharP K p] [Invertible (2 : K)] + {n : ℕ} (σ : Fin (n+1) → Type u) [∀ i,Fintype (σ i)] [∀ i,DecidableEq (σ i)] + + + +theorem exists_three_tensor_form_cycle + (S b : ∀ i,A K (σ i) p) (active : Finset (Fin (n+1))) (hA : 5≤active.card) + (α : Space K ((i : Fin (n+1)) × σ i) p) + (hαδ : koszul K _ p (sigmaPotential K p σ S) α=0) + (hαd : D K _ p α=0) + (htrip : ∀ s : Finset (Fin (n+1)), s.card=3 → + mulScalar K _ p (sigmaSelected K p σ b s) α ∈ + LinearMap.range (koszul K _ p (sigmaPotential K p σ S))) + (L : Space K ((i : Fin (n+1)) × σ i) p →ₗ[K] K) + (hLδ : ∀ v,L (koszul K _ p (sigmaPotential K p σ S) v)=0) + (hLd : ∀ v,L (D K _ p v)=0) (hLα : L α≠0) : + ∃ (q : Fin 3 ↪ Fin (n+1)) (κ : T K 3 ⊗[K] (⨂[K] i,Space K (σ i) p)), + (∀ j,q j∈active) ∧ + deformedTensor (fun i => (parity K (A K (σ i) p) (σ i)).toLinearMap) + (fun i => koszul K (σ i) p (S i)) (fun i => koszul K (σ i) p (b i)) + (threeParameters (K:=K) q) κ=0 ∧ + L (sigmaSeparatedEquiv K p σ (specializeTensor (augmentationAlg K 3) κ))≠0 := by + classical + have hc (i : Fin (n+1)) : ∃ C : SuperReduction K (Space K (σ i) p), + C.d=koszul K (σ i) p (S i) ∧ + C.g=(parity K (A K (σ i) p) (σ i)).toLinearMap ∧ + ∀ w∈(⊤ : Submodule K (Space K (σ i) p)),C.p w∈(⊤ : Submodule K (Space K (σ i) p)) := by + apply exists_superReduction _ _ (koszul_sq_zero K (σ i) p (S i)) + (fun v => parity_parity v) (koszul_parity K (σ i) p (S i)) ⊤ + intro v _; trivial + choose C hCd hCg _ using hc + let e := sigmaSeparatedEquiv K p σ + have hδ (v : ⨂[K] i,Space K (σ i) p) : + e (finiteD C v)=koszul K _ p (sigmaPotential K p σ S) (e v) := by + change sigmaSeparatedEquiv K p σ (oddTensor (fun i => (C i).g) (fun i => (C i).d) v)=_ + simp only [hCd,hCg] + exact (koszul_sigmaSeparated K p σ S v).symm + have hd (v : ⨂[K] i,Space K (σ i) p) : + e (oddTensor (fun i => (C i).g) (fun i => D K (σ i) p) v)=D K _ p (e v) := by + simp only [hCg] + exact (D_sigmaSeparated K p σ v).symm + obtain ⟨q,κ,hq,hκ,hpair⟩ := exists_three_deformed_cycle C + (fun i => D K (σ i) p) (fun i => mulScalar K (σ i) p (b i)) + (fun i => D_sq_zero K (σ i) p) + (by intro i v; rw [hCg]; exact differential_parity _ v) + (by + intro i v + rw [hCd] + have h := LinearMap.congr_fun (D_koszul K (σ i) p (S i)) v + change D K (σ i) p (koszul K (σ i) p (S i) v)= + -koszul K (σ i) p (S i) (D K (σ i) p v) at h + simpa only [neg_neg] using congrArg Neg.neg h.symm) + (by + intro i v + rw [hCd] + exact (LinearMap.congr_fun (mulScalar_koszul K (σ i) p (S i) (b i)) v).symm) + (by intro i v; rw [hCg]; exact mulScalar_parity K (σ i) p (b i) v) + active hA (e.symm α) + (by apply e.injective; rw [hδ,e.apply_symm_apply,hαδ]; exact e.map_zero.symm) + (by apply e.injective; rw [hd,e.apply_symm_apply,hαd]; exact e.map_zero.symm) + (by + intro s hs + obtain ⟨β,hβ⟩ := htrip s hs + refine ⟨e.symm β,?_⟩ + apply e.injective + rw [hδ,e.apply_symm_apply] + change _=sigmaSeparatedEquiv K p σ + (partialTensor (fun i => Space K (σ i) p) + (fun i => mulScalar K (σ i) p (b i)) s (e.symm α)) + rw [←mulScalar_sigmaSelected] + change _=mulScalar K _ p (sigmaSelected K p σ b s) (e (e.symm α)) + rw [e.apply_symm_apply] + exact hβ) + (L.comp e.toLinearMap) + (by intro v; change L (e (finiteD C v))=0; rw [hδ]; exact hLδ _) + (by intro v; change L (e (oddTensor _ _ v))=0; rw [hd]; exact hLd _) + (by change L (e (e.symm α))≠0; rw [e.apply_symm_apply]; exact hLα) + refine ⟨q,κ,hq,?_,hpair⟩ + simpa only [hCg,hCd,D_mulScalar] using hκ + +end +end PD4Tensor.TruncatedForms + +namespace PD4Tensor +namespace FrobeniusTruncation +noncomputable section + +variable (K σ : Type*) [Field K] [Fintype σ] [DecidableEq σ] (p : ℕ) + + + + + +variable [CharP K p] + + + + + + +variable [Fact p.Prime] + + + +def socle : Ring K σ p := ∏ i : σ, coord K σ p i ^ (p - 1) + +omit [CharP K p] [Fact p.Prime] in +@[simp] theorem residue_socle_product (hp : 0 < p) : + residue K σ p hp (socle K σ p) = 1 := by + have he : (∑ i : σ, Finsupp.single i (p - 1)) = socleExponent σ p := by + ext i + simp only [Finsupp.coe_finsetSum, Finset.sum_apply, Finsupp.single_apply, socleExponent_apply] + simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] + unfold socle coord + simp only [← map_pow] + rw [← map_prod] + simp only [MvPolynomial.X_pow_eq_monomial] + rw [← MvPolynomial.monomial_sum_prod] + rw [he] + simp only [Finset.prod_const_one, residue_socle] + + +def linearForm (A : Matrix σ σ K) (i : σ) : MvPolynomial σ K := + ∑ j : σ, MvPolynomial.C (A i j) * MvPolynomial.X j + +omit [DecidableEq σ] in +@[simp] theorem linearForm_constant (A : Matrix σ σ K) (i : σ) : + MvPolynomial.constantCoeff (linearForm K σ A i) = 0 := by + simp [linearForm] + + +def linearSubst (A : Matrix σ σ K) : Ring K σ p →ₐ[K] Ring K σ p := + Ideal.Quotient.liftₐ (ideal K σ p) + (MvPolynomial.aeval (fun i => Ideal.Quotient.mk (ideal K σ p) (linearForm K σ A i))) + (by + have h : ideal K σ p ≤ RingHom.ker + (MvPolynomial.aeval (fun i => Ideal.Quotient.mk (ideal K σ p) (linearForm K σ A i))).toRingHom := by + apply Ideal.span_le.mpr + rintro _ ⟨i, rfl⟩ + change MvPolynomial.aeval _ ((MvPolynomial.X i : MvPolynomial σ K)^p) = 0 + rw [map_pow, MvPolynomial.aeval_X, frobenius_mk] + simp [zero_pow (Fact.out : p.Prime).ne_zero] + exact fun f hf => h hf) + +omit [DecidableEq σ] in +@[simp] theorem linearSubst_coord (A : Matrix σ σ K) (i : σ) : + linearSubst K σ p A (coord K σ p i) = ∑ j : σ, A i j • coord K σ p j := by + change MvPolynomial.aeval (fun j => Ideal.Quotient.mk (ideal K σ p) (linearForm K σ A j)) + (MvPolynomial.X i) = _ + rw [MvPolynomial.aeval_X] + simp only [linearForm, map_sum, map_mul] + apply Finset.sum_congr rfl + intro j hj + change algebraMap K (Ring K σ p) (A i j) * coord K σ p j = _ + exact (Algebra.smul_def _ _).symm + + +omit [DecidableEq σ] in +theorem linearSubst_mul (A B : Matrix σ σ K) : + linearSubst K σ p (A * B) = (linearSubst K σ p B).comp (linearSubst K σ p A) := by + apply Ideal.Quotient.algHom_ext + apply MvPolynomial.algHom_ext + intro i + change linearSubst K σ p (A * B) (coord K σ p i) = + linearSubst K σ p B (linearSubst K σ p A (coord K σ p i)) + simp only [linearSubst_coord, map_sum, map_smul, Finset.smul_sum, + Matrix.mul_apply, Finset.sum_smul, smul_smul] + rw [Finset.sum_comm] + +@[simp] theorem linearSubst_diagonal_coord (D : σ → K) (i : σ) : + linearSubst K σ p (Matrix.diagonal D) (coord K σ p i) = D i • coord K σ p i := by + simp [linearSubst_coord, Matrix.diagonal_apply] + +@[simp] theorem linearSubst_transvection_coord (t : Matrix.TransvectionStruct σ K) (a : σ) : + linearSubst K σ p t.toMatrix (coord K σ p a) = + coord K σ p a + if a = t.i then t.c • coord K σ p t.j else 0 := by + rw [linearSubst_coord] + simp only [Matrix.TransvectionStruct.toMatrix, Matrix.transvection, Matrix.add_apply, + add_smul, Finset.sum_add_distrib, Matrix.one_apply] + simp only [ite_smul, one_smul, zero_smul, Finset.sum_ite_eq, Finset.mem_univ, ite_true] + congr 1 + by_cases h : a = t.i + · subst a + simp [Matrix.single_apply] + · simp [h, Ne.symm h] + +private theorem add_pow_mul_eq {R : Type*} [CommRing R] (a b c : R) (hbc : b*c=0) (n : ℕ) : + (a+b)^n*c=a^n*c := by + induction n with + | zero => simp + | succ n ih => + calc + (a+b)^(n+1)*c = a*((a+b)^n*c)+(a+b)^n*(b*c) := by ring + _ = a*(a^n*c) := by rw [ih, hbc, mul_zero, add_zero] + _ = a^(n+1)*c := by ring + + +theorem linearSubst_transvection_socle (t : Matrix.TransvectionStruct σ K) : + linearSubst K σ p t.toMatrix (socle K σ p) = socle K σ p := by + have hpi : p - 1 + 1 = p := by have := (Fact.out : p.Prime).pos; omega + have hbc : (t.c • coord K σ p t.j) * coord K σ p t.j ^ (p-1) = 0 := by + rw [smul_mul_assoc, mul_comm, ← pow_succ, hpi, variable_pow, smul_zero] + have he : (coord K σ p t.i + t.c • coord K σ p t.j) ^ (p-1) * + coord K σ p t.j ^ (p-1) = coord K σ p t.i ^ (p-1) * coord K σ p t.j ^ (p-1) := + add_pow_mul_eq _ _ _ hbc _ + unfold socle + simp only [map_prod, map_pow, linearSubst_transvection_coord] + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ t.i), + ← Finset.mul_prod_erase _ _ (Finset.mem_univ t.i)] + simp only [ite_true] + rw [← Finset.mul_prod_erase _ _ (Finset.mem_erase.mpr ⟨t.hij.symm, Finset.mem_univ _⟩), + ← Finset.mul_prod_erase _ _ (Finset.mem_erase.mpr ⟨t.hij.symm, Finset.mem_univ _⟩)] + simp only [t.hij.symm, ite_false, add_zero] + rw [← mul_assoc, he, mul_assoc] + congr 2 + apply Finset.prod_congr rfl + intro i hi + have hni : i ≠ t.i := (Finset.mem_erase.mp (Finset.mem_erase.mp hi).2).1 + simp [hni] + + + +theorem linearSubst_socle (A : Matrix σ σ K) : + linearSubst K σ p A (socle K σ p) = A.det^(p-1) • socle K σ p := by + apply Matrix.diagonal_transvection_induction + (fun A => linearSubst K σ p A (socle K σ p) = A.det^(p-1) • socle K σ p) A + · intro D hD + simp only [socle, map_prod, map_pow, linearSubst_diagonal_coord, + smul_pow, Finset.prod_smul, Matrix.det_diagonal, Finset.prod_pow] + · intro t + simp [linearSubst_transvection_socle] + · intro A B hA hB + rw [linearSubst_mul, AlgHom.comp_apply, hA, map_smul, hB, smul_smul, + Matrix.det_mul, mul_pow] + + +omit [CharP K p] [Fact p.Prime] in +theorem high_augmentation_le : + MvPolynomial.idealOfVars σ K ^ (Fintype.card σ * (p-1) + 1) ≤ ideal K σ p := by + intro f hf + rw [MvPolynomial.mem_pow_idealOfVars_iff] at hf + rw [ideal] + simp only [MvPolynomial.X_pow_eq_monomial] + rw [Set.range_comp' (fun exponent : σ →₀ ℕ => MvPolynomial.monomial exponent (1 : K)) + (fun index : σ => Finsupp.single index p), MvPolynomial.mem_ideal_span_monomial_image] + intro a ha + have hd := hf a ha + have hex : ∃ i : σ, p ≤ a i := by + by_contra hn + push Not at hn + have hle : a.degree ≤ Fintype.card σ * (p-1) := by + rw [Finsupp.degree_eq_sum] + calc + ∑ i : σ, a i ≤ ∑ i : σ, (p-1) := Finset.sum_le_sum (fun i hi => by have := hn i; omega) + _ = _ := by simp + omega + obtain ⟨i, hi⟩ := hex + refine ⟨Finsupp.single i p, ⟨i, rfl⟩, ?_⟩ + intro j + by_cases hj : j = i + · subst j; simpa using hi + · simp [Ne.symm hj] + + +def linearPart (f : MvPolynomial σ K) : MvPolynomial σ K := + ∑ i : σ, MvPolynomial.C (f.coeff (Finsupp.single i 1)) * MvPolynomial.X i + +@[simp] theorem coeff_linearPart (a : σ →₀ ℕ) (f : MvPolynomial σ K) : + (linearPart K σ f).coeff a = + if a.degree = 1 then f.coeff a else 0 := by + by_cases ha : a.degree = 1 + · obtain ⟨i, rfl⟩ := (Finsupp.sum_eq_one_iff a).mp ha + simp only [linearPart, MvPolynomial.C_mul_X_eq_monomial, MvPolynomial.coeff_sum, + MvPolynomial.coeff_monomial, Finsupp.single_left_inj one_ne_zero, Finsupp.degree_single, + ite_true, Finset.sum_ite_eq', Finset.mem_univ] + · simp only [linearPart, MvPolynomial.coeff_sum, MvPolynomial.C_mul_X_eq_monomial, + MvPolynomial.coeff_monomial, ha, ite_false] + apply Finset.sum_eq_zero + intro i hi + have hne : Finsupp.single i 1 ≠ a := by + intro h + apply ha + rw [← h, Finsupp.degree_single] + simp [hne] + +omit [DecidableEq σ] in +@[simp] theorem linearPart_constant (f : MvPolynomial σ K) : + MvPolynomial.constantCoeff (linearPart K σ f) = 0 := by + simp [linearPart] + +omit [Fintype σ] [DecidableEq σ] in +private theorem mem_augmentation (f : MvPolynomial σ K) (hf : MvPolynomial.constantCoeff f = 0) : + f ∈ MvPolynomial.idealOfVars σ K := by + rw [← pow_one (MvPolynomial.idealOfVars σ K), MvPolynomial.mem_pow_idealOfVars_iff'] + intro a ha + have ha0 : a = 0 := (Finsupp.degree_eq_zero_iff a).mp (by omega) + subst a + exact hf + + + +theorem sub_linearPart_mem (f : MvPolynomial σ K) (hf : MvPolynomial.constantCoeff f = 0) : + f - linearPart K σ f ∈ MvPolynomial.idealOfVars σ K ^ 2 := by + rw [MvPolynomial.mem_pow_idealOfVars_iff'] + intro a ha + rw [MvPolynomial.coeff_sub, coeff_linearPart] + by_cases ha1 : a.degree = 1 + · simp [ha1] + · have ha0 : a = 0 := (Finsupp.degree_eq_zero_iff a).mp (by omega) + subst a + change f.coeff 0 = 0 at hf + simpa using hf + +private theorem filtered_pow_sub {R : Type*} [CommRing R] (J : Ideal R) (f g : R) + (hf : f ∈ J) (hg : g ∈ J) (hfg : f-g ∈ J^2) (n : ℕ) : + f^n-g^n ∈ J^(n+1) := by + induction n with + | zero => simp + | succ n ih => + have h1 : f*(f^n-g^n) ∈ J^(1+(n+1)) := by + rw [pow_add, pow_one] + exact Ideal.mul_mem_mul hf ih + have h2 := Ideal.mul_mem_mul hfg (Ideal.pow_mem_pow hg n) + rw [← pow_add] at h2 + have he : f^(n+1)-g^(n+1) = f*(f^n-g^n)+(f-g)*g^n := by ring + rw [he] + exact (J^(n+1+1)).add_mem + (by simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using h1) + (by convert h2 using 2; omega) + +private theorem filtered_prod_mem {R ι : Type*} [CommRing R] (J : Ideal R) + (s : Finset ι) (f : ι → R) (n : ℕ) (hf : ∀ i ∈ s, f i ∈ J^n) : + ∏ i ∈ s, f i ∈ J^(s.card*n) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.prod_insert hi, Finset.card_insert_of_notMem hi, Nat.add_mul, + one_mul, add_comm, pow_add] + exact Ideal.mul_mem_mul (hf i (Finset.mem_insert_self _ _)) + (ih (fun j hj => hf j (Finset.mem_insert_of_mem hj))) + +private theorem filtered_prod_sub {R ι : Type*} [CommRing R] (J : Ideal R) + (s : Finset ι) (f g : ι → R) (n : ℕ) + (hf : ∀ i ∈ s, f i ∈ J^n) (hg : ∀ i ∈ s, g i ∈ J^n) + (hfg : ∀ i ∈ s, f i-g i ∈ J^(n+1)) : + (∏ i ∈ s, f i) - (∏ i ∈ s, g i) ∈ J^(s.card*n+1) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.prod_insert hi, Finset.prod_insert hi, Finset.card_insert_of_notMem hi] + have hF := filtered_prod_mem J s f n (fun j hj => hf j (Finset.mem_insert_of_mem hj)) + have hD := ih (fun j hj => hf j (Finset.mem_insert_of_mem hj)) + (fun j hj => hg j (Finset.mem_insert_of_mem hj)) + (fun j hj => hfg j (Finset.mem_insert_of_mem hj)) + have h1 := Ideal.mul_mem_mul (hfg i (Finset.mem_insert_self _ _)) hF + have h2 := Ideal.mul_mem_mul (hg i (Finset.mem_insert_self _ _)) hD + rw [← pow_add] at h1 h2 + have he : f i * (∏ j ∈ s, f j) - g i * (∏ j ∈ s, g j) = + (f i-g i)*(∏ j ∈ s, f j)+g i*((∏ j ∈ s, f j)-(∏ j ∈ s, g j)) := by ring + rw [he] + apply (J^((s.card+1)*n+1)).add_mem + · have hn : (s.card+1)*n+1 = n+1+s.card*n := by ring + rw [hn] + exact h1 + · have hn : (s.card+1)*n+1 = n+(s.card*n+1) := by ring + rw [hn] + exact h2 + + +omit [CharP K p] [Fact p.Prime] in +theorem top_product_eq_linear (f : σ → MvPolynomial σ K) + (hf : ∀ i, MvPolynomial.constantCoeff (f i) = 0) : + (∏ i : σ, Ideal.Quotient.mk (ideal K σ p) (f i) ^ (p-1)) = + ∏ i : σ, Ideal.Quotient.mk (ideal K σ p) (linearPart K σ (f i)) ^ (p-1) := by + simp only [← map_pow, ← map_prod] + apply sub_eq_zero.mp + rw [← map_sub, Ideal.Quotient.eq_zero_iff_mem] + apply high_augmentation_le K σ p + apply filtered_prod_sub _ _ _ _ (p-1) + · intro i hi + exact Ideal.pow_mem_pow (mem_augmentation K σ (f i) (hf i)) _ + · intro i hi + exact Ideal.pow_mem_pow (mem_augmentation K σ _ (linearPart_constant K σ (f i))) _ + · intro i hi + exact filtered_pow_sub _ _ _ (mem_augmentation K σ (f i) (hf i)) + (mem_augmentation K σ _ (linearPart_constant K σ (f i))) + (sub_linearPart_mem K σ (f i) (hf i)) _ + + + +omit [CharP K p] in +theorem coord_mul_socle (i : σ) : coord K σ p i * socle K σ p = 0 := by + have hp : 1 + (p-1) = p := by have := (Fact.out : p.Prime).pos; omega + unfold socle + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ i), ← mul_assoc, + mul_comm (coord K σ p i), ← pow_succ] + rw [show p-1+1=p by omega, variable_pow, zero_mul] + + +omit [CharP K p] in +theorem mk_mul_socle (f : MvPolynomial σ K) : + Ideal.Quotient.mk (ideal K σ p) f * socle K σ p = + MvPolynomial.constantCoeff f • socle K σ p := by + induction f using MvPolynomial.induction_on with + | C c => + rw [MvPolynomial.constantCoeff_C] + exact (Algebra.smul_def c _).symm + | add f g hf hg => simp only [map_add, add_mul, hf, hg, add_smul] + | mul_X f i hf => + rw [map_mul, mul_assoc] + change _ * (coord K σ p i * socle K σ p) = _ + rw [coord_mul_socle, mul_zero] + simp + + +def tangentMatrix (f : σ → MvPolynomial σ K) : Matrix σ σ K := + fun i j => (f i).coeff (Finsupp.single j 1) + + + +theorem top_product_eq_socle (f : σ → MvPolynomial σ K) + (hf : ∀ i, MvPolynomial.constantCoeff (f i) = 0) : + (∏ i : σ, Ideal.Quotient.mk (ideal K σ p) (f i) ^ (p-1)) = + (tangentMatrix K σ f).det ^ (p-1) • socle K σ p := by + rw [top_product_eq_linear K σ p f hf] + have hsub : (∏ i : σ, Ideal.Quotient.mk (ideal K σ p) (linearPart K σ (f i)) ^ (p-1)) = + linearSubst K σ p (tangentMatrix K σ f) (socle K σ p) := by + simp only [socle, map_prod, map_pow] + apply Finset.prod_congr rfl + intro i hi + congr 1 + change Ideal.Quotient.mk (ideal K σ p) (linearPart K σ (f i)) = + MvPolynomial.aeval (fun j => Ideal.Quotient.mk (ideal K σ p) + (linearForm K σ (tangentMatrix K σ f) j)) (MvPolynomial.X i) + rw [MvPolynomial.aeval_X] + rfl + rw [hsub, linearSubst_socle] + + +def jacobianDet (f : σ → MvPolynomial σ K) : MvPolynomial σ K := + Matrix.det (fun i j => MvPolynomial.pderiv j (f i)) + +omit [Fintype σ] [DecidableEq σ] in +@[simp] theorem constantCoeff_pderiv (i : σ) (f : MvPolynomial σ K) : + MvPolynomial.constantCoeff (MvPolynomial.pderiv i f) = + f.coeff (Finsupp.single i 1) := by + change (MvPolynomial.pderiv i f).coeff 0 = _ + rw [MvPolynomial.coeff_pderiv] + simp + +@[simp] theorem jacobianDet_constant (f : σ → MvPolynomial σ K) : + MvPolynomial.constantCoeff (jacobianDet K σ f) = (tangentMatrix K σ f).det := by + change MvPolynomial.constantCoeff + (Matrix.det (fun i j => MvPolynomial.pderiv j (f i) : Matrix σ σ (MvPolynomial σ K))) = _ + rw [show MvPolynomial.constantCoeff + (Matrix.det (fun i j => MvPolynomial.pderiv j (f i) : Matrix σ σ (MvPolynomial σ K))) = + Matrix.det (Matrix.map (fun i j => MvPolynomial.pderiv j (f i)) + MvPolynomial.constantCoeff) from RingHom.map_det _ _] + congr 1 + ext i j + exact constantCoeff_pderiv K σ j (f i) + + + +theorem normal_residue (hp : 0 < p) (f : σ → MvPolynomial σ K) + (hf : ∀ i, MvPolynomial.constantCoeff (f i) = 0) : + residue K σ p hp ((∏ i : σ, Ideal.Quotient.mk (ideal K σ p) (f i) ^ (p-1)) * + Ideal.Quotient.mk (ideal K σ p) (jacobianDet K σ f)) = + (tangentMatrix K σ f).det^p := by + rw [top_product_eq_socle K σ p f hf, smul_mul_assoc, mul_comm, mk_mul_socle, + jacobianDet_constant, smul_smul, map_smul, residue_socle_product, smul_eq_mul, mul_one] + rw [← pow_succ, Nat.sub_add_cancel hp] + + +theorem normal_residue_ne_zero (hp : 0 < p) (f : σ → MvPolynomial σ K) + (hf : ∀ i, MvPolynomial.constantCoeff (f i) = 0) + (hdet : (tangentMatrix K σ f).det ≠ 0) : + residue K σ p hp ((∏ i : σ, Ideal.Quotient.mk (ideal K σ p) (f i) ^ (p-1)) * + Ideal.Quotient.mk (ideal K σ p) (jacobianDet K σ f)) ≠ 0 := by + rw [normal_residue K σ p hp f hf] + exact pow_ne_zero _ hdet + +end +end FrobeniusTruncation +end PD4Tensor +end + +end OAI diff --git a/lean/OAI/Algebra/FiniteTensor/WeierstrassConstraints.lean b/lean/OAI/Algebra/FiniteTensor/WeierstrassConstraints.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dbc5aeb5fdba7005444d8d766f46d52992add4f --- /dev/null +++ b/lean/OAI/Algebra/FiniteTensor/WeierstrassConstraints.lean @@ -0,0 +1,426 @@ +import Mathlib +import OAI.Algebra.FiniteTensor.ArtinCoefficients + +namespace OAI + +/-! Weierstrass reconstitution and finite constraints for distinguished division. -/ + +noncomputable section +open scoped BigOperators + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {R σ κ : Type*} [CommRing R] + + theorem polynomial_eval_divisor_congruence (h : R) (f : MvPolynomial σ R) + (a b : σ → R) (hab : ∀ i,h∣a i-b i) : h∣eval a f-eval b f := by + let J : Ideal R := Ideal.span {h} + apply Ideal.mem_span_singleton.mp + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_sub,sub_eq_zero] + have he : (Ideal.Quotient.mk J).comp (eval a)=(Ideal.Quotient.mk J).comp (eval b) := by + apply MvPolynomial.ringHom_ext + · intro r; simp + · intro i + simp only [RingHom.comp_apply,eval_X] + exact sub_eq_zero.mp ((map_sub _ _ _).symm.trans + (Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.mem_span_singleton.mpr (hab i)))) + exact RingHom.congr_fun he f + + theorem unit_add_jacobson {w h : R} (hw : IsUnit w) + (hh : h∈Ideal.jacobson (⊥ : Ideal R)) : IsUnit (w+h) := by + obtain ⟨u,rfl⟩ := hw + have hu := Ideal.mem_jacobson_bot.mp hh (↑u⁻¹ : R) + have ht := u.isUnit.mul hu + convert ht using 1 + simp [mul_add,mul_left_comm,add_comm] + + + +theorem weierstrass_prepared_minor + (f : κ → MvPolynomial σ R) (D : MvPolynomial σ R) + (r q : σ → R) (h w : R) (hw : IsUnit w) + (hh : h∈Ideal.jacobson (⊥ : Ideal R)) + (hf : ∀ k,h^2∣eval r (f k)) (hD : eval r D=h*w) : + let a := fun i=>r i+h^2*q i + (∃ v : R,IsUnit v ∧ eval a D=h*v) ∧ + ∀ k,(eval a D)^2∣eval a (f k) := by + let a := fun i=>r i+h^2*q i + have hcon (i : σ) : h^2∣a i-r i := by + exact ⟨q i,by dsimp [a]; ring⟩ + obtain ⟨z,hz⟩ := polynomial_eval_divisor_congruence (h^2) D a r hcon + have he : eval a D=h*(w+h*z) := by rw [hD] at hz; linear_combination hz + have hun : IsUnit (w+h*z) := unit_add_jacobson hw ((Ideal.jacobson ⊥).mul_mem_right _ hh) + refine ⟨⟨w+h*z,hun,he⟩,fun k=>?_⟩ + have hfa : h^2∣eval a (f k) := by + have hc := polynomial_eval_divisor_congruence (h^2) (f k) a r hcon + convert dvd_add hc (hf k) using 1 + ring + rw [he,mul_pow] + rw [mul_comm] + exact (hun.pow 2).mul_left_dvd.mpr hfa + + +def minorPolynomial [Fintype κ] [DecidableEq κ] + (f : κ → MvPolynomial (κ ⊕ σ) R) : MvPolynomial (κ ⊕ σ) R := + Matrix.det (fun k i=>pderiv (Sum.inl i) (f k)) + + theorem eval_minorPolynomial [Fintype κ] [DecidableEq κ] + (f : κ → MvPolynomial (κ ⊕ σ) R) (a : (κ ⊕ σ) → R) : + eval a (minorPolynomial f)=Matrix.det (fun k i=>eval a (pderiv (Sum.inl i) (f k))) := by + unfold minorPolynomial + exact RingHom.map_det (eval a) _ + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {R σ κ : Type*} [CommRing R] + + + +theorem reconstitute_close (J : Ideal R) (h h' : R) (r r' q q' : σ → R) + (hh : h'-h∈J) (hr : ∀ i,r' i-r i∈J) (hq : ∀ i,q' i-q i∈J) (i : σ) : + r' i+h'^2*q' i-(r i+h^2*q i)∈J := by + have hh2 : h'^2-h^2∈J := by + convert J.mul_mem_right (h'+h) hh using 1 + ring + have hs := J.add_mem (J.add_mem (hr i) (J.mul_mem_right (q' i) hh2)) + (J.mul_mem_left (h^2) (hq i)) + convert hs using 1 + ring + + + +theorem weierstrass_reconstitution + (J : Ideal R) (f : κ → MvPolynomial σ R) (D : MvPolynomial σ R) + (h h' w' : R) (r r' q q' : σ → R) + (hh0 : h'≠0) (hhjac : h'∈Ideal.jacobson (⊥ : Ideal R)) (hw : IsUnit w') + (hf : ∀ k,h'^2∣eval r' (f k)) (hD : eval r' D=h'*w') + (hh : h'-h∈J) (hr : ∀ i,r' i-r i∈J) (hq : ∀ i,q' i-q i∈J) : + let a := fun i=>r' i+h'^2*q' i + (eval a D≠0) ∧ (∀ k,(eval a D)^2∣eval a (f k)) ∧ + ∀ i,a i-(r i+h^2*q i)∈J := by + obtain ⟨⟨v,hv,hvEq⟩,hdiv⟩ := weierstrass_prepared_minor f D r' q' h' w' hw hhjac hf hD + refine ⟨?_,hdiv,reconstitute_close J h h' r r' q q' hh hr hq⟩ + rw [hvEq] + exact fun hz=>hh0 ((hv.mul_left_eq_zero).mp hz) + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +variable {B A σ : Type*} [CommRing B] [IsDomain B] [CommRing A] [IsDomain A] [Algebra B A] + + + +omit [IsDomain A] in +theorem reconstitute_algebraic (h : Polynomial A) (r : σ → Polynomial A) + (q : σ → PowerSeries A) + (hh : ∀ j,IsAlgebraic B (h.coeff j)) + (hr : ∀ i j,IsAlgebraic B ((r i).coeff j)) + (hq : ∀ i,IsAlgebraic (Polynomial B) (q i)) (i : σ) : + IsAlgebraic (Polynomial B) ((r i : PowerSeries A)+(h : PowerSeries A)^2*q i) := by + exact (polynomial_series_algebraic_coefficients (r i) (hr i)).add + (((polynomial_series_algebraic_coefficients h hh).pow 2).mul (hq i)) + +end +end PD4Tensor.Spreading + + + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {R S σ κ : Type*} [CommRing R] [CommRing S] + +abbrev RemainderVariables (σ κ : Type*) := Unit ⊕ (σ ⊕ (κ ⊕ Unit)) + +def remainderPoint (h : S) (r : σ → S) (k : κ → S) (w : S) : RemainderVariables σ κ → S := + Sum.elim (fun _=>h) (Sum.elim r (Sum.elim k (fun _=>w))) + +def remainderEmbedding : σ → RemainderVariables σ κ := fun i=>Sum.inr (Sum.inl i) + +def remainderEquation (f : κ → MvPolynomial σ R) (D : MvPolynomial σ R) : + κ ⊕ Unit → MvPolynomial (RemainderVariables σ κ) R := + Sum.elim (fun j=>rename remainderEmbedding (f j)- + X (Sum.inl ())^2*X (Sum.inr (Sum.inr (Sum.inl j)))) + (fun _=>rename remainderEmbedding D-X (Sum.inl ())*X (Sum.inr (Sum.inr (Sum.inr ())))) + + theorem eval_remainderEmbedding (φ : R →+* S) (h : S) (r : σ → S) (k : κ → S) (w : S) + (p : MvPolynomial σ R) : + eval₂ φ (remainderPoint h r k w) (rename remainderEmbedding p)=eval₂ φ r p := by + rw [eval₂_rename] + rfl + + + +theorem remainder_equations_iff (φ : R →+* S) + (f : κ → MvPolynomial σ R) (D : MvPolynomial σ R) + (h : S) (r : σ → S) (k : κ → S) (w : S) : + (∀ j,eval₂ φ (remainderPoint h r k w) (remainderEquation f D j)=0) ↔ + (∀ j,eval₂ φ r (f j)=h^2*k j) ∧ eval₂ φ r D=h*w := by + constructor + · intro he + constructor + · intro j + have hh := he (Sum.inl j) + change eval₂ φ (remainderPoint h r k w) + (rename remainderEmbedding (f j)-X (Sum.inl ())^2*X (Sum.inr (Sum.inr (Sum.inl j))))=0 at hh + simpa only [eval₂_sub,eval₂_mul,eval₂_pow,eval₂_X,eval₂_rename,Function.comp_def,remainderEmbedding, + remainderPoint,Sum.elim_inl,Sum.elim_inr,sub_eq_zero] using hh + · have hh := he (Sum.inr ()) + change eval₂ φ (remainderPoint h r k w) + (rename remainderEmbedding D-X (Sum.inl ())*X (Sum.inr (Sum.inr (Sum.inr ()))))=0 at hh + simpa only [eval₂_sub,eval₂_mul,eval₂_X,eval₂_rename,Function.comp_def,remainderEmbedding, + remainderPoint,Sum.elim_inl,Sum.elim_inr,sub_eq_zero] using hh + · rintro ⟨hf,hD⟩ (j|j) + · change eval₂ φ (remainderPoint h r k w) + (rename remainderEmbedding (f j)-X (Sum.inl ())^2*X (Sum.inr (Sum.inr (Sum.inl j))))=0 + simpa only [eval₂_sub,eval₂_mul,eval₂_pow,eval₂_X,eval₂_rename,Function.comp_def,remainderEmbedding, + remainderPoint,Sum.elim_inl,Sum.elim_inr,sub_eq_zero] using hf j + · change eval₂ φ (remainderPoint h r k w) + (rename remainderEmbedding D-X (Sum.inl ())*X (Sum.inr (Sum.inr (Sum.inr ()))))=0 + simpa only [eval₂_sub,eval₂_mul,eval₂_X,eval₂_rename,Function.comp_def,remainderEmbedding, + remainderPoint,Sum.elim_inl,Sum.elim_inr,sub_eq_zero] using hD + +omit [CommRing S] in + theorem remainder_point_reconstruct (p : RemainderVariables σ κ → S) : + remainderPoint (p (Sum.inl ())) (fun i=>p (Sum.inr (Sum.inl i))) + (fun j=>p (Sum.inr (Sum.inr (Sum.inl j)))) (p (Sum.inr (Sum.inr (Sum.inr ()))))=p := by + funext x + rcases x with x|(x|(x|x)) + · cases x; rfl + · rfl + · rfl + · cases x; rfl + +end +end PD4Tensor.Spreading + + + +namespace PD4Tensor.Spreading +noncomputable section +variable {A : Type*} [CommRing A] + + theorem powerSeries_constant_mem (I : Ideal A) {f : PowerSeries A} + (hf : f∈I.map (PowerSeries.C : A →+* PowerSeries A)) : + PowerSeries.constantCoeff f∈I := by + have hle : I.map (PowerSeries.C : A →+* PowerSeries A)≤I.comap PowerSeries.constantCoeff := by + apply Ideal.map_le_iff_le_comap.mpr + intro a ha + simpa using ha + exact hle hf + + theorem powerSeries_map_jacobson (I : Ideal A) (hI : I≤Ideal.jacobson (⊥ : Ideal A)) : + I.map (PowerSeries.C : A →+* PowerSeries A)≤Ideal.jacobson (⊥ : Ideal (PowerSeries A)) := by + intro f hf + rw [Ideal.mem_jacobson_bot] + intro g + rw [PowerSeries.isUnit_iff_constantCoeff] + simp only [map_add,map_mul,map_one] + exact Ideal.mem_jacobson_bot.mp (hI (powerSeries_constant_mem I hf)) _ + + theorem powerSeries_unit_close (I : Ideal A) (hI : I≤Ideal.jacobson (⊥ : Ideal A)) + (f g : PowerSeries A) (hf : IsUnit f) + (hgf : g-f∈I.map (PowerSeries.C : A →+* PowerSeries A)) : IsUnit g := by + obtain ⟨u,rfl⟩ := hf + have hj := powerSeries_map_jacobson I hI hgf + have hu := Ideal.mem_jacobson_bot.mp hj (↑u⁻¹ : PowerSeries A) + have hh := u.isUnit.mul hu + convert hh using 1 + calc + g=(↑u*↑u⁻¹ : PowerSeries A)*(g-↑u)+↑u := by simp + _=↑u*((g-↑u)*↑u⁻¹+1) := by ring + + theorem powerSeries_jacobson_close (I : Ideal A) (hI : I≤Ideal.jacobson (⊥ : Ideal A)) + (f g : PowerSeries A) (hf : f∈Ideal.jacobson (⊥ : Ideal (PowerSeries A))) + (hgf : g-f∈I.map (PowerSeries.C : A →+* PowerSeries A)) : + g∈Ideal.jacobson (⊥ : Ideal (PowerSeries A)) := by + convert (Ideal.jacobson (⊥ : Ideal (PowerSeries A))).add_mem + (powerSeries_map_jacobson I hI hgf) hf using 1 + abel + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open MvPolynomial +variable {B A σ κ : Type*} [CommRing B] [IsDomain B] [CommRing A] [IsDomain A] + [Algebra B A] [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +abbrev seriesCoefficientMap : Polynomial B →+* PowerSeries A := + Polynomial.coeToPowerSeries.ringHom.comp (Polynomial.mapRingHom (algebraMap B A)) + +omit [IsDomain B] [IsDomain A] [Fintype σ] [DecidableEq σ] in + theorem eval_seriesCoefficientMap (r : σ → Polynomial A) (f : MvPolynomial σ (Polynomial B)) : + eval (fun i=>(r i : PowerSeries A)) (map (seriesCoefficientMap (B:=B) (A:=A)) f)= + (eval₂ (Polynomial.mapRingHom (algebraMap B A)) r f : Polynomial A) := by + rw [←eval₂_eq_eval_map] + exact (hom_eval₂ f (Polynomial.mapRingHom (algebraMap B A)) + Polynomial.coeToPowerSeries.ringHom r).symm + + + +omit [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] in +theorem coefficient_prepared_point + (I : Ideal A) (hI : I≤Ideal.jacobson (⊥ : Ideal A)) + (f : κ → MvPolynomial σ (Polynomial B)) (D : MvPolynomial σ (Polynomial B)) + (p : RemainderVariables σ κ → Polynomial A) + (hpmonic : (p (Sum.inl ())).Monic) + (hpjac : (p (Sum.inl ()) : PowerSeries A)∈Ideal.jacobson (⊥ : Ideal (PowerSeries A))) + (hpunit : IsUnit (p (Sum.inr (Sum.inr (Sum.inr ()))) : PowerSeries A)) + (x : CoefficientVariables p → A) + (hxalg : ∀ v,IsAlgebraic B (x v)) + (hxclose : ∀ v,x v-coefficientPoint p v∈I) + (hxsol : ∀ e,eval₂ (algebraMap B A) x + (coefficientEquation p (remainderEquation f D) e)=0) + (q : σ → PowerSeries A) (hq : ∀i,IsAlgebraic (Polynomial B) (q i)) : + ∃ a : σ → PowerSeries A, + (∀ i,IsAlgebraic (Polynomial B) (a i)) ∧ + (eval a (map (seriesCoefficientMap (B:=B) (A:=A)) D)≠0) ∧ + (∀ k,eval a (map (seriesCoefficientMap (B:=B) (A:=A)) D)^2∣ + eval a (map (seriesCoefficientMap (B:=B) (A:=A)) (f k))) ∧ + ∀ i,a i-((p (Sum.inr (Sum.inl i)) : PowerSeries A)+ + (p (Sum.inl ()) : PowerSeries A)^2*q i)∈I.map (PowerSeries.C : A →+* PowerSeries A) := by + let p' := realizeCoefficients p x + let h := p (Sum.inl ()) + let h' := p' (Sum.inl ()) + let r := fun i=>p (Sum.inr (Sum.inl i)) + let r' := fun i=>p' (Sum.inr (Sum.inl i)) + let k' := fun j=>p' (Sum.inr (Sum.inr (Sum.inl j))) + let w' := p' (Sum.inr (Sum.inr (Sum.inr ()))) + have he := (coefficient_equations_iff (algebraMap B A) p (remainderEquation f D) x).mp hxsol + have hep : remainderPoint h' r' k' w'=p' := remainder_point_reconstruct p' + have hs : (∀ j,eval₂ (Polynomial.mapRingHom (algebraMap B A)) r' (f j)=h'^2*k' j) ∧ + eval₂ (Polynomial.mapRingHom (algebraMap B A)) r' D=h'*w' := by + apply (remainder_equations_iff _ f D h' r' k' w').mp + intro e + rw [hep] + exact he e + have hc (v : RemainderVariables σ κ) : + (p' v : PowerSeries A)-(p v : PowerSeries A)∈I.map (PowerSeries.C : A →+* PowerSeries A) := + realizeCoefficients_series_close p x I hxclose v + have hh0 : (h' : PowerSeries A)≠0 := by + exact_mod_cast monic_coefficient_close_ne_zero I hI h h' hpmonic + (realizeCoefficients_close p x I hxclose (Sum.inl ())) + have hhjac : (h' : PowerSeries A)∈Ideal.jacobson (⊥ : Ideal (PowerSeries A)) := + powerSeries_jacobson_close I hI _ _ hpjac (hc (Sum.inl ())) + have hwunit : IsUnit (w' : PowerSeries A) := + powerSeries_unit_close I hI _ _ hpunit (hc (Sum.inr (Sum.inr (Sum.inr ())))) + have hf (j : κ) : (h' : PowerSeries A)^2∣eval (fun i=>(r' i : PowerSeries A)) + (map (seriesCoefficientMap (B:=B) (A:=A)) (f j)) := by + rw [eval_seriesCoefficientMap,hs.1 j,Polynomial.coe_mul,Polynomial.coe_pow] + exact dvd_mul_right _ _ + have hD : eval (fun i=>(r' i : PowerSeries A)) + (map (seriesCoefficientMap (B:=B) (A:=A)) D)=(h' : PowerSeries A)*(w' : PowerSeries A) := by + rw [eval_seriesCoefficientMap,hs.2,Polynomial.coe_mul] + obtain ⟨hn,hdiv,hclose⟩ := weierstrass_reconstitution + (I.map (PowerSeries.C : A →+* PowerSeries A)) + (fun k=>map (seriesCoefficientMap (B:=B) (A:=A)) (f k)) + (map (seriesCoefficientMap (B:=B) (A:=A)) D) + (h : PowerSeries A) (h' : PowerSeries A) (w' : PowerSeries A) + (fun i=>(r i : PowerSeries A)) (fun i=>(r' i : PowerSeries A)) q q + hh0 hhjac hwunit hf hD (hc (Sum.inl ())) + (fun i=>hc (Sum.inr (Sum.inl i))) (fun i=>by simp) + refine ⟨fun i=>(r' i : PowerSeries A)+(h' : PowerSeries A)^2*q i,?_,hn,hdiv,hclose⟩ + intro i + exact reconstitute_algebraic h' r' q + (realizeCoefficients_algebraic p x hxalg (Sum.inl ())) + (fun i=>realizeCoefficients_algebraic p x hxalg (Sum.inr (Sum.inl i))) hq i + +end +end PD4Tensor.Spreading + +namespace PD4Tensor.Spreading +noncomputable section +open Polynomial PowerSeries MvPolynomial +variable {A σ κ : Type*} [CommRing A] + + +theorem distinguished_dvd_of_series_dvd (I : Ideal A) [IsAdicComplete I A] + {h p : Polynomial A} (hh : h.IsDistinguishedAt I) + (hp : (h : PowerSeries A) ∣ (p : PowerSeries A)) : h ∣ p := by + apply Ideal.mem_span_singleton.mp + apply Ideal.Quotient.eq_zero_iff_mem.mp + apply hh.algEquivQuotient.injective + rw [map_zero] + change Ideal.Quotient.mk (Ideal.span {(h : PowerSeries A)}) (p : PowerSeries A) = 0 + exact Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.mem_span_singleton.mpr hp) + + +theorem eval₂_dvd_sub (d : PowerSeries A) (f : MvPolynomial σ (Polynomial A)) + (u v : σ → PowerSeries A) (h : ∀ i,d ∣ u i-v i) : + d ∣ eval₂ Polynomial.coeToPowerSeries.ringHom u f - + eval₂ Polynomial.coeToPowerSeries.ringHom v f := by + let J : Ideal (PowerSeries A) := Ideal.span {d} + apply Ideal.mem_span_singleton.mp + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_sub,sub_eq_zero] + have he : (Ideal.Quotient.mk J).comp (eval₂Hom Polynomial.coeToPowerSeries.ringHom u) = + (Ideal.Quotient.mk J).comp (eval₂Hom Polynomial.coeToPowerSeries.ringHom v) := by + apply MvPolynomial.ringHom_ext + · intro r + simp + · intro i + simp only [RingHom.comp_apply,eval₂Hom_X'] + exact sub_eq_zero.mp ((map_sub _ _ _).symm.trans + (Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.mem_span_singleton.mpr (h i)))) + exact RingHom.congr_fun he f + + + +theorem finite_weierstrass_constraints + (I : Ideal A) [IsAdicComplete I A] + (h : Polynomial A) (hh : h.IsDistinguishedAt I) + (a : σ → PowerSeries A) (f : κ → MvPolynomial σ (Polynomial A)) + (hf : ∀ k,eval₂ Polynomial.coeToPowerSeries.ringHom a (f k)=0) + (D : MvPolynomial σ (Polynomial A)) + (hD : (h : PowerSeries A) ∣ eval₂ Polynomial.coeToPowerSeries.ringHom a D) : + ∃ r : σ → Polynomial A, + (∀ i,(r i).degree < + (((h*h : Polynomial A) : PowerSeries A).map (Ideal.Quotient.mk I)).order.toNat) ∧ + (∀ i,((h*h : Polynomial A) : PowerSeries A) ∣ a i-(r i : PowerSeries A)) ∧ + (∀ k,h*h ∣ eval r (f k)) ∧ h ∣ eval r D := by + let H := (hh.mul hh).isWeierstrassDivisorAt' + let r : σ → Polynomial A := fun i=>H.mod (a i) + have hd (i : σ) := H.isWeierstrassDivisionAt_div_mod (a i) + have hdiv (i : σ) : ((h*h : Polynomial A) : PowerSeries A) ∣ + a i-(r i : PowerSeries A) := by + exact ⟨H.div (a i), by linear_combination (hd i).eq_mul_add⟩ + refine ⟨r,fun i=>(hd i).degree_lt,hdiv,?_,?_⟩ + · intro k + apply distinguished_dvd_of_series_dvd I (hh.mul hh) + have hz := eval₂_dvd_sub ((h*h : Polynomial A) : PowerSeries A) (f k) a + (fun i=>(r i : PowerSeries A)) hdiv + rw [hf k,zero_sub] at hz + have hm := MvPolynomial.map_eval Polynomial.coeToPowerSeries.ringHom r (f k) + rw [MvPolynomial.eval_map] at hm + change ((eval r (f k) : Polynomial A) : PowerSeries A) = + eval₂ Polynomial.coeToPowerSeries.ringHom (fun i=>(r i : PowerSeries A)) (f k) at hm + rw [←hm] at hz + exact dvd_neg.mp hz + · apply distinguished_dvd_of_series_dvd I hh + have hv (i : σ) : (h : PowerSeries A) ∣ a i-(r i : PowerSeries A) := + dvd_trans (by simp only [Polynomial.coe_mul]; exact dvd_mul_right _ _) (hdiv i) + have hz := eval₂_dvd_sub (h : PowerSeries A) D a (fun i=>(r i : PowerSeries A)) hv + have hm := MvPolynomial.map_eval Polynomial.coeToPowerSeries.ringHom r D + rw [MvPolynomial.eval_map] at hm + change ((eval r D : Polynomial A) : PowerSeries A) = + eval₂ Polynomial.coeToPowerSeries.ringHom (fun i=>(r i : PowerSeries A)) D at hm + rw [←hm] at hz + have hh := dvd_sub hD hz + convert hh using 1 + ring + +end +end PD4Tensor.Spreading +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/Balanced.lean b/lean/OAI/Algebra/Finitistic/Bar/Balanced.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e004264b73493727698732a6691dfb3f946577d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/Balanced.lean @@ -0,0 +1,140 @@ +import OAI.Algebra.Finitistic.Bar.TwoSided +import Mathlib.LinearAlgebra.Quotient.Basic + +namespace OAI +open scoped TensorProduct +open TensorProduct CategoryTheory +noncomputable section + +namespace DerivedBar.Balanced +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) +variable (V : Type u) [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] + +/-- The balancing relations for the right A-action d·a = d*f(a). -/ +def relations : Submodule D (D ⊗[k] V) := + Submodule.span D {z | ∃ (d : D) (a : A) (v : V), + z = (d * f a) ⊗ₜ[k] v - d ⊗ₜ[k] (a • v)} + +/-- Noncommutative balanced tensor D ⊗_A V, presented using tensors over the field. -/ +abbrev tensor := (D ⊗[k] V) ⧸ relations f V + +/-- Its canonical D-linear quotient map. -/ +def quotient : D ⊗[k] V →ₗ[D] tensor f V := (relations f V).mkQ + +omit [IsScalarTower k A V] in +/-- The defining balanced relation, as an equality in the actual quotient module. -/ +theorem balanced (d : D) (a : A) (v : V) : + quotient f V ((d*f a) ⊗ₜ[k] v) = quotient f V (d ⊗ₜ[k] (a • v)) := by + apply sub_eq_zero.mp + rw [← map_sub] + exact (Submodule.Quotient.mk_eq_zero _).mpr (Submodule.subset_span ⟨d, a, v, rfl⟩) + +section Maps +variable (W U : Type u) [AddCommGroup W] [Module k W] [Module A W] [IsScalarTower k A W] + [AddCommGroup U] [Module k U] [Module A U] [IsScalarTower k A U] + +/-- Balanced tensor acts on all A-linear maps. -/ +theorem map_relations (h : V →ₗ[A] W) : relations f V ≤ + ((quotient f W).comp (AlgebraTensorModule.lTensor D D (h.restrictScalars k))).ker := by + apply Submodule.span_le.mpr + rintro z ⟨d, a, v, rfl⟩ + change quotient f W ((AlgebraTensorModule.lTensor D D (h.restrictScalars k)) + ((d*f a) ⊗ₜ[k] v - d ⊗ₜ[k] (a • v))) = 0 + simp only [map_sub, AlgebraTensorModule.lTensor_tmul, LinearMap.coe_restrictScalars, + LinearMap.map_smul] + rw [balanced, sub_self] + +def map (h : V →ₗ[A] W) : tensor f V →ₗ[D] tensor f W := + (relations f V).liftQ + ((quotient f W).comp (AlgebraTensorModule.lTensor D D (h.restrictScalars k))) + (map_relations f V W h) + +@[simp] theorem map_quotient_tmul (h : V →ₗ[A] W) (d : D) (v : V) : + map f V W h (quotient f V (d ⊗ₜ[k] v)) = quotient f W (d ⊗ₜ[k] h v) := rfl + +/-- Composition preservation for the actual balanced tensor, proved from its quotient presentation. -/ +theorem map_comp (h : V →ₗ[A] W) (g : W →ₗ[A] U) : + map f V U (g.comp h) = (map f W U g).comp (map f V W h) := by + apply (relations f V).linearMap_qext + apply AlgebraTensorModule.ext + intro d v + rfl + +@[simp] theorem map_zero : map f V W 0 = 0 := by + apply (relations f V).linearMap_qext + apply AlgebraTensorModule.ext + intro d v + change quotient f W (d ⊗ₜ[k] (0 : W)) = 0 + rw [TensorProduct.tmul_zero, _root_.map_zero] + +@[simp] theorem map_id : map f V V LinearMap.id = LinearMap.id := by + apply (relations f V).linearMap_qext + apply AlgebraTensorModule.ext + intro d v + rfl +end Maps + +variable (W : Type u) [AddCommGroup W] [Module k W] + +/-- Evaluation of D ⊗_k (A ⊗_k W) on the two leading coefficients. -/ +def collapse : D ⊗[k] (A ⊗[k] W) →ₗ[D] D ⊗[k] W := + (DerivedBar.action k D (D ⊗[k] W)).comp + (AlgebraTensorModule.lTensor D D (FreeBaseChange.coefficient f W)) + +@[simp] theorem collapse_tmul (d : D) (z : A ⊗[k] W) : + collapse f W (d ⊗ₜ[k] z) = d • FreeBaseChange.coefficient f W z := rfl + +/-- The evaluation kills all balancing relations, without commutativity of A or D. -/ +theorem relations_le_ker_collapse : relations f (A ⊗[k] W) ≤ (collapse f W).ker := by + apply Submodule.span_le.mpr + rintro z ⟨d, a, v, rfl⟩ + change collapse f W ((d*f a) ⊗ₜ[k] v - d ⊗ₜ[k] (a • v)) = 0 + rw [map_sub, collapse_tmul, collapse_tmul, FreeBaseChange.coefficient_smul, + mul_smul, sub_self] + +/-- Descent of coefficient evaluation to the balanced tensor. -/ +def descend : tensor f (A ⊗[k] W) →ₗ[D] D ⊗[k] W := + (relations f (A ⊗[k] W)).liftQ (collapse f W) (relations_le_ker_collapse f W) + +/-- The inverse inserts a unit A coefficient before taking the balanced quotient. -/ +def insert : D ⊗[k] W →ₗ[D] tensor f (A ⊗[k] W) := + (quotient f (A ⊗[k] W)).comp + (AlgebraTensorModule.lTensor D D (TensorProduct.mk k A W 1)) + +@[simp] theorem descend_quotient (z : D ⊗[k] (A ⊗[k] W)) : + descend f W (quotient f (A ⊗[k] W) z) = collapse f W z := rfl + +@[simp] theorem insert_tmul (d : D) (w : W) : + insert f W (d ⊗ₜ[k] w) = quotient f (A ⊗[k] W) (d ⊗ₜ[k] (1 ⊗ₜ[k] w)) := rfl + +/-- One inverse identity of the actual balanced free-module tensor equivalence. -/ +theorem descend_insert : (descend f W).comp (insert f W) = LinearMap.id := by + apply AlgebraTensorModule.ext + intro d w + simp [LinearMap.comp_apply, TensorProduct.smul_tmul'] + +/-- The other inverse identity follows from balancing, not from flatness. -/ +theorem insert_descend : (insert f W).comp (descend f W) = LinearMap.id := by + apply (relations f (A ⊗[k] W)).linearMap_qext + apply AlgebraTensorModule.ext + intro d z + induction z using TensorProduct.inductionOn with + | add x y hx hy => simp_all [TensorProduct.tmul_add] + | tmul a w => + change insert f W (collapse f W (d ⊗ₜ[k] (a ⊗ₜ[k] w))) = + quotient f (A ⊗[k] W) (d ⊗ₜ[k] (a ⊗ₜ[k] w)) + rw [collapse_tmul, FreeBaseChange.coefficient_tmul, TensorProduct.smul_tmul', + smul_eq_mul, insert_tmul, balanced] + simp [TensorProduct.smul_tmul'] + +/-- The standard identification D ⊗_A (A ⊗_k W) ≅ D ⊗_k W for arbitrary algebras. -/ +def freeEquiv : tensor f (A ⊗[k] W) ≃ₗ[D] D ⊗[k] W := + LinearEquiv.ofLinearMap (descend f W) (insert f W) (descend_insert f W) (insert_descend f W) + +end DerivedBar.Balanced + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BalancedTensorFunctor.lean b/lean/OAI/Algebra/Finitistic/Bar/BalancedTensorFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..46d133c3d7001218ef164dc1289d381c8ceb5bd7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BalancedTensorFunctor.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Bar.TensorModel +import OAI.Algebra.Finitistic.Bimodule.BimoduleComparison + +namespace OAI +open CategoryTheory TensorProduct +open scoped TensorProduct +noncomputable section +namespace DerivedBar.Balanced +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] + (f : A →ₐ[k] D) + +local instance (V : ModuleCat.{u} A) : Module k V := BimoduleTensor.scalarModule k A V +local instance (V : ModuleCat.{u} A) : IsScalarTower k A V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +def tensorFunctor : ModuleCat.{u} A ⥤ ModuleCat.{u} D where + obj V := ModuleCat.of D (tensor f V) + map h := ModuleCat.ofHom (map f _ _ h.hom) + map_id V := ModuleCat.hom_ext (map_id f V) + map_comp h g := ModuleCat.hom_ext (map_comp f _ _ _ h.hom g.hom) + +instance tensorFunctor_additive : (tensorFunctor f).Additive where + map_add := by + intro V W h g + apply ModuleCat.hom_ext + apply (relations f V).linearMap_qext + apply AlgebraTensorModule.ext + intro d v + change quotient f W (d ⊗ₜ[k] (h.hom v + g.hom v)) = + quotient f W (d ⊗ₜ[k] h.hom v) + quotient f W (d ⊗ₜ[k] g.hom v) + rw [TensorProduct.tmul_add, map_add] + +def tensorFunctorObjIso (V : Type u) [AddCommGroup V] [Module k V] + [Module A V] [IsScalarTower k A V] : + (tensorFunctor f).obj (ModuleCat.of A V) ≅ ModuleCat.of D (tensor f V) := by + have h := BimoduleTensor.scalarModule_eq k A V + cases h + exact Iso.refl _ + +theorem tensorFunctorObjIso_natural (V W : Type u) + [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] + [AddCommGroup W] [Module k W] [Module A W] [IsScalarTower k A W] + (h : V →ₗ[A] W) : + (tensorFunctor f).map (ModuleCat.ofHom h) ≫ (tensorFunctorObjIso f W).hom = + (tensorFunctorObjIso f V).hom ≫ ModuleCat.ofHom (map f V W h) := by + have hV := BimoduleTensor.scalarModule_eq k A V + have hW := BimoduleTensor.scalarModule_eq k A W + cases hV + cases hW + rfl + +variable (N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +def resolvedTensorIso : + ((tensorFunctor f).mapHomologicalComplex (.down ℕ)).obj + (DerivedBar.projectiveResolution k A N).complex ≅ tensorBarComplex k A D N f := + HomologicalComplex.Hom.isoOfComponents + (fun n => tensorFunctorObjIso f (DerivedBar.term k A N (n+1))) + (by + intro i j hij + change j+1=i at hij + subst i + simpa only [tensorBarComplex, DerivedBar.projectiveResolution, + DerivedBar.complex, ChainComplex.of_d, Functor.mapHomologicalComplex_obj_d] + using (tensorFunctorObjIso_natural f (DerivedBar.term k A N (j+1+1)) + (DerivedBar.term k A N (j+1)) (DerivedBar.differential k A N (j+1))).symm) + +/-- The left-derived balanced tensor functor is computed by exactly the +original tensorBarComplex, via the proved free bar projective resolution. -/ +def tensorBarComputesLeftDerived : + (tensorFunctor f).leftDerivedToHomotopyCategory.obj (ModuleCat.of A N) ≅ + (HomotopyCategory.quotient (ModuleCat.{u} D) (.down ℕ)).obj (tensorBarComplex k A D N f) := + (DerivedBar.projectiveResolution k A N).isoLeftDerivedToHomotopyCategoryObj (tensorFunctor f) ≪≫ + (HomotopyCategory.quotient (ModuleCat.{u} D) (.down ℕ)).mapIso (resolvedTensorIso f N) + +def tensorBarHomologyIso (i : ℕ) : + ((tensorFunctor f).leftDerived i).obj (ModuleCat.of A N) ≅ + (tensorBarComplex k A D N f).homology i := + (DerivedBar.projectiveResolution k A N).isoLeftDerivedObj (tensorFunctor f) i ≪≫ + (HomologicalComplex.homologyFunctor (ModuleCat.{u} D) (.down ℕ) i).mapIso (resolvedTensorIso f N) +end DerivedBar.Balanced + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/Bar.lean b/lean/OAI/Algebra/Finitistic/Bar/Bar.lean new file mode 100644 index 0000000000000000000000000000000000000000..8560822fdf66d81a11912f4e46dc18e838fe3f52 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/Bar.lean @@ -0,0 +1,190 @@ +import Mathlib.LinearAlgebra.TensorProduct.Tower +import Mathlib.Algebra.Category.ModuleCat.Basic +import Mathlib.Algebra.Homology.HomologicalComplex +import Mathlib.RingTheory.TensorProduct.Free +import Mathlib.LinearAlgebra.Basis.VectorSpace +import Mathlib.Algebra.Category.ModuleCat.Projective +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat +import Mathlib.CategoryTheory.Preadditive.Projective.Resolution + +namespace OAI + +open scoped TensorProduct +open TensorProduct +noncomputable section +namespace DerivedBar +universe u +variable (k A N : Type u) [Field k] [Ring A] [Algebra k A] + [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +/-- The augmented bar terms: term 0 is N; term (n+1) is A ⊗ term n. -/ +@[reducible] def term : ℕ → ModuleCat k + | 0 => ModuleCat.of k N + | n+1 => ModuleCat.of k (A ⊗[k] term n) + +@[reducible] instance termModule : (n : ℕ) → Module A (term k A N n) + | 0 => inferInstanceAs (Module A N) + | n+1 => inferInstanceAs (Module A (A ⊗[k] term k A N n)) + +instance termTower : (n : ℕ) → IsScalarTower k A (term k A N n) + | 0 => inferInstanceAs (IsScalarTower k A N) + | n+1 => inferInstanceAs (IsScalarTower k A (A ⊗[k] term k A N n)) + + +/-- Multiplication/action on the first two positions of an augmented bar word. -/ +def action (M : Type u) [AddCommGroup M] [Module k M] [Module A M] + [IsScalarTower k A M] : A ⊗[k] M →ₗ[A] M := + { (TensorProduct.lift (Algebra.lsmul k k M).toLinearMap).toAddHom with + map_smul' := by + intro a z + induction z using TensorProduct.inductionOn with + | tmul b m => simp [TensorProduct.smul_tmul'] + | add x y hx hy => simp_all [smul_add] } + +@[simp] theorem action_tmul (M : Type u) [AddCommGroup M] [Module k M] [Module A M] + [IsScalarTower k A M] (a : A) (m : M) : + action k A M (a ⊗ₜ[k] m) = a • m := rfl + +/-- Recursive alternating face differential. No A-flatness of N is required. -/ +def differential : (n : ℕ) → term k A N (n+1) →ₗ[A] term k A N n + | 0 => action k A N + | n+1 => action k A (term k A N (n+1)) - + AlgebraTensorModule.lTensor A A ((differential n).restrictScalars k) + +@[simp] theorem differential_zero_tmul (a : A) (z : N) : + differential k A N 0 (a ⊗ₜ[k] z) = a • z := rfl + +@[simp] theorem differential_succ_tmul (n : ℕ) (a : A) (z : term k A N (n+1)) : + differential k A N (n+1) (a ⊗ₜ[k] z) = + a • z - a ⊗ₜ[k] differential k A N n z := rfl + +/-- The actual bar differential squares to zero in every degree. -/ +theorem differential_sq (n : ℕ) : + (differential k A N n).comp (differential k A N (n+1)) = 0 := by + induction n with + | zero => + apply AlgebraTensorModule.ext + intro a z + change differential k A N 0 (differential k A N 1 (a ⊗ₜ[k] z)) = 0 + rw [differential_succ_tmul k A N 0 a z, map_sub, map_smul, + differential_zero_tmul k A N a (differential k A N 0 z), sub_self] + | succ n ih => + apply AlgebraTensorModule.ext + intro a z + have hz := LinearMap.congr_fun ih z + change differential k A N n (differential k A N (n+1) z) = 0 at hz + change differential k A N (n+1) (differential k A N (n+2) (a ⊗ₜ[k] z)) = 0 + rw [differential_succ_tmul k A N (n+1) a z, map_sub, map_smul, + differential_succ_tmul k A N n a (differential k A N (n+1) z), hz, + TensorProduct.tmul_zero, sub_zero, sub_self] + +/-- Unit insertion; this is k-linear, generally not A-linear. -/ +def contraction (n : ℕ) : term k A N n →ₗ[k] term k A N (n+1) := + TensorProduct.mk k A (term k A N n) 1 + +omit [Module A N] [IsScalarTower k A N] in +@[simp] theorem contraction_apply (n : ℕ) (z : term k A N n) : + contraction k A N n z = 1 ⊗ₜ[k] z := rfl + +/-- The augmented degree-zero contraction identity. -/ +theorem contraction_zero (z : N) : + differential k A N 0 (contraction k A N 0 z) = z := by + change (1 : A) • z = z + exact one_smul A z + +/-- Contracting homotopy in every positive augmented degree. -/ +theorem contraction_identity (n : ℕ) (z : term k A N (n+1)) : + differential k A N (n+1) (contraction k A N (n+1) z) + + contraction k A N n (differential k A N n z) = z := by + change differential k A N (n+1) (1 ⊗ₜ[k] z) + 1 ⊗ₜ[k] differential k A N n z = z + rw [differential_succ_tmul k A N n 1 z, one_smul, sub_add_cancel] + +/-- Exactness of the augmented absolute bar complex as actual A-linear maps. -/ +theorem differential_exact (n : ℕ) : + LinearMap.range (differential k A N (n+1)) = + LinearMap.ker (differential k A N n) := by + apply le_antisymm + · rintro _ ⟨z, rfl⟩ + exact LinearMap.congr_fun (differential_sq k A N n) z + · intro z hz + refine ⟨contraction k A N (n+1) z, ?_⟩ + have h := contraction_identity k A N n z + have hz' : differential k A N n z = 0 := hz + simpa [hz'] using h + +/-- The augmented chain complex, including N at homological degree zero. -/ +def augmentedComplex : ChainComplex (ModuleCat A) ℕ := + ChainComplex.of (fun n => ModuleCat.of A (term k A N n)) + (fun n => ModuleCat.ofHom (differential k A N n)) + (fun n => by exact ModuleCat.hom_ext (differential_sq k A N n)) + +/-- The unaugmented absolute bar complex, degree n = A ⊗ A^⊗n ⊗ N. -/ +def complex : ChainComplex (ModuleCat A) ℕ := + ChainComplex.of (fun n => ModuleCat.of A (term k A N (n+1))) + (fun n => ModuleCat.ofHom (differential k A N (n+1))) + (fun n => by exact ModuleCat.hom_ext (differential_sq k A N (n+1))) + + +open CategoryTheory CategoryTheory.Limits + +/-- Every unaugmented bar term is free as a left A-module, even for noncommutative A. -/ +instance term_free (n : ℕ) : Module.Free A (term k A N (n+1)) := + Module.Free.of_basis (Algebra.TensorProduct.basis A (Module.Free.chooseBasis k (term k A N n))) + +instance complex_projective (n : ℕ) : Projective ((complex k A N).X n) := by + change Projective (ModuleCat.of A (term k A N (n+1))) + exact inferInstance + +/-- Surjectivity of the bar augmentation, witnessed by insertion of 1. -/ +theorem augmentation_surjective : Function.Surjective (differential k A N 0) := by + intro z + exact ⟨contraction k A N 0 z, contraction_zero k A N z⟩ + +/-- The bar augmentation as a chain map to N concentrated in degree zero. -/ +def augmentation : complex k A N ⟶ (ChainComplex.single₀ (ModuleCat A)).obj (ModuleCat.of A N) := + (ChainComplex.toSingle₀Equiv _ _).symm + ⟨ModuleCat.ofHom (differential k A N 0), by + change ModuleCat.ofHom (differential k A N 1) ≫ + ModuleCat.ofHom (differential k A N 0) = 0 + exact ModuleCat.hom_ext (differential_sq k A N 0)⟩ + +/-- All positive-degree homology of the unaugmented bar complex vanishes. -/ +theorem complex_exactAt_succ (n : ℕ) : (complex k A N).ExactAt (n+1) := by + rw [HomologicalComplex.exactAt_iff' _ (n+1+1) (n+1) n (by simp) (by simp)] + rw [ShortComplex.moduleCat_exact_iff_range_eq_ker] + simpa only [HomologicalComplex.sc', HomologicalComplex.shortComplexFunctor', + complex, ChainComplex.of_d, ModuleCat.hom_ofHom] using! differential_exact k A N (n+1) + +/-- Exactness at the augmentation term, stated in the abelian category of A-modules. -/ +theorem augmentation_exact : + (ShortComplex.mk ((complex k A N).d 1 0) (ModuleCat.ofHom (differential k A N 0)) + (ModuleCat.hom_ext (differential_sq k A N 0))).Exact := by + rw [ShortComplex.moduleCat_exact_iff_range_eq_ker] + exact differential_exact k A N 0 + +instance augmentation_epi : Epi (ModuleCat.ofHom (differential k A N 0)) := + (ModuleCat.epi_iff_surjective _).mpr (augmentation_surjective k A N) + +/-- The absolute algebra bar augmentation is a genuine quasi-isomorphism. -/ +instance augmentation_quasiIso : QuasiIso (augmentation k A N) := by + refine ⟨fun n => ?_⟩ + cases n with + | zero => + rw [ChainComplex.quasiIsoAt₀_iff, ShortComplex.quasiIso_iff_of_zeros'] + · dsimp [augmentation] + exact ⟨augmentation_exact k A N, augmentation_epi k A N⟩ + all_goals rfl + | succ n => + rw [quasiIsoAt_iff_exactAt'] + · exact complex_exactAt_succ k A N n + · apply ChainComplex.exactAt_succ_single_obj + +/-- Explicit free absolute bar resolution, packaged for derived functor computations. -/ +def projectiveResolution : ProjectiveResolution (ModuleCat.of A N) where + complex := complex k A N + π := augmentation k A N +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BarAdditive.lean b/lean/OAI/Algebra/Finitistic/Bar/BarAdditive.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b7b0f79fa8dea49023a118576ecbcdb6f55e532 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BarAdditive.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.Finitistic.Bar.TwoSidedBarFunctor + +namespace OAI +open CategoryTheory TensorProduct +open scoped TensorProduct +noncomputable section +namespace DerivedBar +universe u +variable (k D : Type u) [Field k] [Ring D] [Algebra k D] +variable (V W : Type u) [AddCommGroup V] [Module k V] [Module D V] [IsScalarTower k D V] + [AddCommGroup W] [Module k W] [Module D W] [IsScalarTower k D W] + +/-- Each iterated free bar term preserves addition of maps. -/ +theorem termMap_add (f g : V →ₗ[D] W) (n : ℕ) : + termMap k D V W (f+g) n = termMap k D V W f n + termMap k D V W g n := by + induction n with + | zero => rfl + | succ n ih => + apply AlgebraTensorModule.ext + intro d v + change d ⊗ₜ[k] termMap k D V W (f+g) n v = + d ⊗ₜ[k] termMap k D V W f n v + d ⊗ₜ[k] termMap k D V W g n v + rw [ih, LinearMap.add_apply, TensorProduct.tmul_add] + +local instance barAdditiveScalarModule (N : ModuleCat.{u} D) : Module k N := + BimoduleTensor.scalarModule k D N +local instance barAdditiveScalarTower (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +instance barFunctor_additive : (barFunctor k D).Additive where + map_add := by + intro V W f g + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + exact termMap_add k D V W f.hom g.hom (n+1) + +namespace BimoduleTensor +variable (X : Type u) [AddCommGroup X] [Module k X] [Module D X] [Module Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] + +instance twoSidedBarFunctor_additive : (twoSidedBarFunctor k D X).Additive where + map_add := by + intro V W f g + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply AlgebraTensorModule.ext + intro x v + change x ⊗ₜ[k] termMap k D V W (f.hom+g.hom) n v = + x ⊗ₜ[k] termMap k D V W f.hom n v + x ⊗ₜ[k] termMap k D V W g.hom n v + rw [termMap_add, LinearMap.add_apply, TensorProduct.tmul_add] +end BimoduleTensor +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BarBimoduleCongruence.lean b/lean/OAI/Algebra/Finitistic/Bar/BarBimoduleCongruence.lean new file mode 100644 index 0000000000000000000000000000000000000000..8129c43d8407470223611d8b4ca0141f6a0f744b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BarBimoduleCongruence.lean @@ -0,0 +1,96 @@ +import OAI.Algebra.Finitistic.Bar.TotalBarDerived + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor TensorProduct +open scoped TensorProduct +namespace DerivedBar.BimoduleTensor +universe u +variable (k D : Type u) [Field k] [Ring D] [Algebra k D] +variable {X Y : Type u} + [AddCommGroup X] [Module k X] [Module D X] [Module Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] + [AddCommGroup Y] [Module k Y] [Module D Y] [Module Dᵐᵒᵖ Y] + [SMulCommClass D Dᵐᵒᵖ Y] [IsScalarTower k D Y] [IsScalarTower k Dᵐᵒᵖ Y] +variable (e : X ≃ₗ[D] Y) (he : ∀ d : Dᵐᵒᵖ, ∀ x, e (d • x) = d • e x) +variable (V : Type u) [AddCommGroup V] [Module k V] [Module D V] [IsScalarTower k D V] + +include he in +omit [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ Y] [IsScalarTower k Dᵐᵒᵖ Y] [IsScalarTower k D V] in +private theorem leftMap_relations : relations k D X V ≤ + ((quotient k D Y V).comp (AlgebraTensorModule.rTensor k V e.toLinearMap)).ker := by + apply Submodule.span_le.mpr + rintro z ⟨x,d,v,rfl⟩ + change quotient k D Y V (AlgebraTensorModule.rTensor k V e.toLinearMap + ((MulOpposite.op d • x) ⊗ₜ[k] v - x ⊗ₜ[k] (d • v))) = 0 + simp only [_root_.map_sub, AlgebraTensorModule.rTensor_tmul, LinearEquiv.coe_coe, he] + rw [balanced, sub_self] + +/-- The actual left-factor map on the bar's balanced quotient. -/ +def leftMap : tensor k D X V →ₗ[D] tensor k D Y V := + (relations k D X V).liftQ + ((quotient k D Y V).comp (AlgebraTensorModule.rTensor k V e.toLinearMap)) + (leftMap_relations k D e he V) + +omit [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ Y] [IsScalarTower k Dᵐᵒᵖ Y] [IsScalarTower k D V] in +@[simp] theorem leftMap_quotient (x : X) (v : V) : + leftMap k D e he V (quotient k D X V (x ⊗ₜ[k] v)) = + quotient k D Y V (e x ⊗ₜ[k] v) := rfl + +include he in +omit [SMulCommClass D Dᵐᵒᵖ X] [SMulCommClass D Dᵐᵒᵖ Y] in +private theorem symm_right (d : Dᵐᵒᵖ) (y : Y) : e.symm (d • y) = d • e.symm y := by + apply e.injective + simp only [LinearEquiv.apply_symm_apply, he] + +/-- A genuine bimodule equivalence induces an equivalence of the actual balanced tensors. -/ +def congrLeft : tensor k D X V ≃ₗ[D] tensor k D Y V := + LinearEquiv.ofLinearMap (leftMap k D e he V) + (leftMap k D e.symm (symm_right D e he) V) + (by + apply (relations k D Y V).linearMap_qext + apply AlgebraTensorModule.ext + intro y v + change quotient k D Y V (e (e.symm y) ⊗ₜ[k] v) = quotient k D Y V (y ⊗ₜ[k] v) + rw [e.apply_symm_apply]) + (by + apply (relations k D X V).linearMap_qext + apply AlgebraTensorModule.ext + intro x v + change quotient k D X V (e.symm (e x) ⊗ₜ[k] v) = quotient k D X V (x ⊗ₜ[k] v) + rw [e.symm_apply_apply]) + +local instance (N : ModuleCat.{u} D) : Module k N := scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +/-- Naturality in every input module retains the exterior D-action. -/ +def tensorFunctorCongr : tensorFunctor k D X ≅ tensorFunctor k D Y := + NatIso.ofComponents (fun N => (congrLeft k D e he N).toModuleIso) (by + intro N N' f + apply ModuleCat.hom_ext + apply (relations k D X N).linearMap_qext + apply AlgebraTensorModule.ext + intro x n + rfl) + +/-- The same actual tensor equivalence descends to the genuine bar-derived functor. -/ +def derivedTensorCongr : derivedTensor k D X ≅ derivedTensor k D Y := + (Localization.fullyFaithfulWhiskeringLeft (chainQ D) (chainQuasiIso D) (chainDerived D)).preimageIso + (derivedTensorResolutionIso k D X ≪≫ + isoWhiskerLeft (barTotalFunctor k D) + (isoWhiskerRight (NatIso.mapHomologicalComplex (tensorFunctorCongr k D e he) (.down ℕ)) (chainQ D)) ≪≫ + (derivedTensorResolutionIso k D Y).symm) + +/-- All finite genuine iterations are compatible with the original bimodule equivalence. -/ +def derivedIterateCongr : (r : ℕ) → derivedTensorIterate k D X r ≅ derivedTensorIterate k D Y r + | 0 => Iso.refl _ + | r+1 => isoWhiskerRight (derivedIterateCongr r) (derivedTensor k D X) ≪≫ + isoWhiskerLeft (derivedTensorIterate k D Y r) (derivedTensorCongr k D e he) +end DerivedBar.BimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BarCoordinateNaturality.lean b/lean/OAI/Algebra/Finitistic/Bar/BarCoordinateNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..54847dc2d6a34a98b68b32f01c83efddf8db0730 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BarCoordinateNaturality.lean @@ -0,0 +1,62 @@ +import OAI.Algebra.Finitistic.Bar.PatternTensorCoherence + +namespace OAI +open CategoryTheory TensorProduct +open scoped TensorProduct +noncomputable section +namespace DerivedBar.Multibar +universe u +variable (k D X : 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] +variable (V W : Type u) [AddCommGroup V] [Module k V] [Module D V] [IsScalarTower k D V] + [AddCommGroup W] [Module k W] [Module D W] [IsScalarTower k D W] + +/-- The categorical free-bar differential is the supplied-scalars literal one. -/ +theorem freeBarObjIso_d (n : ℕ) : + ((barFunctor k D).obj (ModuleCat.of D V)).d (n+1) n ≫ + (freeBarObjIso k D V n).hom = + (freeBarObjIso k D V (n+1)).hom ≫ + ModuleCat.ofHom (DerivedBar.differential k D V (n+1)) := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + simp only [barFunctor, complex, ChainComplex.of_d] + rfl + +/-- The X-bar differential retains the original noncommutative bimodule actions. -/ +theorem twoSidedBarObjIso_d (n : ℕ) : + ((BimoduleTensor.twoSidedBarFunctor k D X).obj (ModuleCat.of D V)).d (n+1) n ≫ + (twoSidedBarObjIso k D X V n).hom = + (twoSidedBarObjIso k D X V (n+1)).hom ≫ + ModuleCat.ofHom (BimoduleTensor.barDifferential k D X V n) := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + simp only [BimoduleTensor.twoSidedBarFunctor, BimoduleTensor.barComplex, ChainComplex.of_d] + rfl + +/-- Scalar coherence is natural for every D-linear map of input modules. -/ +theorem freeBarObjIso_map (f : V →ₗ[D] W) (n : ℕ) : + ((barFunctor k D).map (ModuleCat.ofHom f)).f n ≫ (freeBarObjIso k D W n).hom = + (freeBarObjIso k D V n).hom ≫ ModuleCat.ofHom (termMap k D V W f (n+1)) := by + have hv := BimoduleTensor.scalarModule_eq k D V + have hw := BimoduleTensor.scalarModule_eq k D W + cases hv + cases hw + rfl + +/-- All vertical maps of the categorical X bar become literal tensor maps. -/ +theorem twoSidedBarObjIso_map (f : V →ₗ[D] W) (n : ℕ) : + ((BimoduleTensor.twoSidedBarFunctor k D X).map (ModuleCat.ofHom f)).f n ≫ + (twoSidedBarObjIso k D X W n).hom = + (twoSidedBarObjIso k D X V n).hom ≫ ModuleCat.ofHom + (AlgebraTensorModule.lTensor D X ((termMap k D V W f n).restrictScalars k)) := by + have hv := BimoduleTensor.scalarModule_eq k D V + have hw := BimoduleTensor.scalarModule_eq k D W + cases hv + cases hw + rfl +end DerivedBar.Multibar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BarFunctor.lean b/lean/OAI/Algebra/Finitistic/Bar/BarFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..d650a9a0975aec2ee0ddf688f9b19539f285ddf4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BarFunctor.lean @@ -0,0 +1,144 @@ +import OAI.Algebra.Finitistic.Bar.Bar +import Mathlib.Algebra.Homology.TotalComplex +import Mathlib.Algebra.Category.ModuleCat.Colimits + +namespace OAI +open scoped TensorProduct +open TensorProduct CategoryTheory +noncomputable section + +namespace DerivedBar +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (V W U : Type u) [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] + [AddCommGroup W] [Module k W] [Module A W] [IsScalarTower k A W] + [AddCommGroup U] [Module k U] [Module A U] [IsScalarTower k A U] + +/-- Functorial map on every augmented bar term. -/ +def termMap (h : V →ₗ[A] W) : (n : ℕ) → term k A V n →ₗ[A] term k A W n + | 0 => h + | n+1 => AlgebraTensorModule.lTensor A A ((termMap h n).restrictScalars k) + +@[simp] theorem termMap_tmul (h : V →ₗ[A] W) (n : ℕ) (a : A) (v : term k A V n) : + termMap k A V W h (n+1) (a ⊗ₜ[k] v) = a ⊗ₜ[k] termMap k A V W h n v := rfl + +theorem termMap_comp (h : V →ₗ[A] W) (g : W →ₗ[A] U) (n : ℕ) : + termMap k A V U (g.comp h) n = (termMap k A W U g n).comp (termMap k A V W h n) := by + induction n with + | zero => rfl + | succ n ih => + apply AlgebraTensorModule.ext + intro a v + change a ⊗ₜ[k] termMap k A V U (g.comp h) n v = + a ⊗ₜ[k] termMap k A W U g n (termMap k A V W h n v) + rw [ih] + rfl + +theorem termMap_id (n : ℕ) : termMap k A V V LinearMap.id n = LinearMap.id := by + induction n with + | zero => rfl + | succ n ih => + apply AlgebraTensorModule.ext + intro a v + change a ⊗ₜ[k] termMap k A V V LinearMap.id n v = a ⊗ₜ[k] v + rw [ih] + rfl + +theorem termMap_zero (n : ℕ) : termMap k A V W 0 n = 0 := by + induction n with + | zero => rfl + | succ n ih => + apply AlgebraTensorModule.ext + intro a v + change a ⊗ₜ[k] termMap k A V W 0 n v = 0 + rw [ih, LinearMap.zero_apply, TensorProduct.tmul_zero] + +/-- The bar differential is natural for all module maps. -/ +theorem differential_natural (h : V →ₗ[A] W) (n : ℕ) : + (differential k A W n).comp (termMap k A V W h (n+1)) = + (termMap k A V W h n).comp (differential k A V n) := by + induction n with + | zero => + apply AlgebraTensorModule.ext + intro a v + exact (h.map_smul a v).symm + | succ n ih => + apply AlgebraTensorModule.ext + intro a v + have hn : differential k A W n (termMap k A V W h (n+1) v) = + termMap k A V W h n (differential k A V n v) := LinearMap.congr_fun ih v + change a • termMap k A V W h (n+1) v - + a ⊗ₜ[k] differential k A W n (termMap k A V W h (n+1) v) = + termMap k A V W h (n+1) (a • v - a ⊗ₜ[k] differential k A V n v) + rw [map_sub, map_smul] + change a • termMap k A V W h (n+1) v - + a ⊗ₜ[k] differential k A W n (termMap k A V W h (n+1) v) = + a • termMap k A V W h (n+1) v - + a ⊗ₜ[k] termMap k A V W h n (differential k A V n v) + rw [hn] + +/-- Unit insertion is natural over k, the key homotopy for the total bar augmentation. -/ +theorem contraction_natural (h : V →ₗ[A] W) (n : ℕ) (v : term k A V n) : + termMap k A V W h (n+1) (contraction k A V n v) = + contraction k A W n (termMap k A V W h n v) := rfl + +/-- An actual chain map between unaugmented free bar resolutions. -/ +def complexMap (h : V →ₗ[A] W) : complex k A V ⟶ complex k A W where + f n := ModuleCat.ofHom (termMap k A V W h (n+1)) + comm' i j hij := by + change j+1 = i at hij + subst i + apply ModuleCat.hom_ext + simpa only [complex, ChainComplex.of_d, ModuleCat.hom_comp, ModuleCat.hom_ofHom] using! + differential_natural k A V W h (j+1) + +local instance (N : ModuleCat.{u} A) : Module k N := Module.compHom N (algebraMap k A) +local instance (N : ModuleCat.{u} A) : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +/-- The explicit free bar resolution is functorial, not just an objectwise choice. -/ +def barFunctor : ModuleCat.{u} A ⥤ ChainComplex (ModuleCat.{u} A) ℕ where + obj N := complex k A N + map h := complexMap k A _ _ h.hom + map_id N := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + exact termMap_id k A N (n+1) + map_comp h g := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + exact termMap_comp k A _ _ _ h.hom g.hom (n+1) + +instance barFunctor_preservesZero : (barFunctor k A).PreservesZeroMorphisms where + map_zero V W := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + exact termMap_zero k A V W (n+1) + +/-- The bicomplex for the left-module bar resolution of a nonnegative chain complex. +Outer degree is the bar length; inner degree is the input complex degree. +The two differentials commute by the proved naturality of the absolute bar differential. -/ +def barBicomplex (Z : ChainComplex (ModuleCat.{u} A) ℕ) : + HomologicalComplex₂ (ModuleCat.{u} A) (ComplexShape.down ℕ) (ComplexShape.down ℕ) := + HomologicalComplex₂.flip (((barFunctor k A).mapHomologicalComplex (ComplexShape.down ℕ)).obj Z) + +/-- Each entry in the bar bicomplex is genuinely projective over A. -/ +instance barBicomplex_projective (Z : ChainComplex (ModuleCat.{u} A) ℕ) (i q : ℕ) : + Projective (((barBicomplex k A Z).X i).X q) := by + change Projective ((complex k A (Z.X q)).X i) + exact complex_projective k A (Z.X q) i + +/-- The ordinary direct-sum total bar complex, with standard totalization signs. +The total augmentation quasi-isomorphism must still be proved. -/ +def barTotal (Z : ChainComplex (ModuleCat.{u} A) ℕ) : + ChainComplex (ModuleCat.{u} A) ℕ := + (barBicomplex k A Z).total (ComplexShape.down ℕ) + +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BarPatternEmbedding.lean b/lean/OAI/Algebra/Finitistic/Bar/BarPatternEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..64a062aad6722f45096687ce3700a394784aeccb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BarPatternEmbedding.lean @@ -0,0 +1,64 @@ +import OAI.Algebra.Finitistic.Bar.PatternPrefixCoordinates +import OAI.Algebra.Finitistic.Bar.BarCoordinateNaturality + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar +universe u +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] [Module D N] [IsScalarTower k D N] +local notation "A" => TrivSqZeroExt D X + + +/-- The categorical X-bar pattern coordinates and the suffix formula have +exactly the same embedding into the original A bar, including the degree cast. -/ +theorem embed_twoSidedBarPatternIso (i : ℕ) (p : List Bool) + (v : ((BimoduleTensor.twoSidedBarFunctor k D X).obj + (ModuleCat.of D (patternTerm k D X N p))).X i) : + embed k D X N (true :: (List.replicate i false ++ p)) + ((twoSidedBarPatternIso k D X N i p).hom.hom v) = + termCast k D X N + (show (p.length+i)+1=(true :: (List.replicate i false ++ p)).length by simp; omega) + (idealSuffixEmbed k D X N (patternTerm k D X N p) p.length i (embed k D X N p) + ((twoSidedBarObjIso k D X (patternTerm k D X N p) i).hom.hom v)) := by + let e := (termPatternIso k D X N i p).toLinearEquiv.restrictScalars k + suffices h : ∀ w : X ⊗[k] term k D (patternTerm k D X N p) i, + embed k D X N (true :: (List.replicate i false ++ p)) + (AlgebraTensorModule.congr (LinearEquiv.refl D X) e w) = + termCast k D X N + (show (p.length+i)+1=(true :: (List.replicate i false ++ p)).length by simp; omega) + (idealSuffixEmbed k D X N (patternTerm k D X N p) p.length i (embed k D X N p) w) from + h ((twoSidedBarObjIso k D X (patternTerm k D X N p) i).hom.hom v) + intro w + induction w using TensorProduct.inductionOn with + | tmul x w => + change (inr x : A) ⊗ₜ[k] + embed k D X N (List.replicate i false ++ p) ((termPatternIso k D X N i p).hom.hom w) = _ + rw [embed_termPatternIso, idealSuffixEmbed_tmul] + exact (termCast_tmul k D X N + (show p.length+i=(List.replicate i false ++ p).length by simp; omega) + (show (p.length+i)+1=(List.replicate i false ++ p).length+1 by simp; omega) + (inr x) (suffixEmbed k D X N _ p.length (embed k D X N p) i w)).symm + | add v w hv hw => simp only [map_add, hv, hw] + +/-- The same compatibility for the final free D bar, before projecting its exterior slot. -/ +theorem embed_freeBarPatternIso (i : ℕ) (p : List Bool) + (v : ((barFunctor k D).obj (ModuleCat.of D (patternTerm k D X N p))).X i) : + embed k D X N (List.replicate (i+1) false ++ p) + ((freeBarPatternIso k D X N i p).hom.hom v) = + termCast k D X N + (show p.length+(i+1)=(List.replicate (i+1) false ++ p).length by simp; omega) + (suffixEmbed k D X N (patternTerm k D X N p) p.length (embed k D X N p) (i+1) + ((freeBarObjIso k D (patternTerm k D X N p) i).hom.hom v)) := + embed_termPatternIso k D X N (i+1) p + ((freeBarObjIso k D (patternTerm k D X N p) i).hom.hom v) +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BlockCoordinateGenerators.lean b/lean/OAI/Algebra/Finitistic/Bar/BlockCoordinateGenerators.lean new file mode 100644 index 0000000000000000000000000000000000000000..6952f2cf6d13cb13b927eb71a75b59f71d5bc895 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BlockCoordinateGenerators.lean @@ -0,0 +1,91 @@ +import OAI.Algebra.Finitistic.Bar.IndexedMultibarTotal + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.RecursiveTotal +universe u +section Congr +variable {D : Type u} [Ring D] +variable {I : Type} [DecidableEq I] (V W : I → ModuleCat.{u} D) + (e : ∀ i, V i ≅ W i) + +theorem congrLinearEquiv_symm_lof (i : I) (v : W i) : + (DirectSum.congrLinearEquiv (fun i => (e i).toLinearEquiv)).symm + (DirectSum.lof D I (fun i => W i) i v) = + DirectSum.lof D I (fun i => V i) i ((e i).inv.hom v) := by + change DirectSum.lmap (fun i => (e i).toLinearEquiv.symm.toLinearMap) + (DirectSum.lof D I (fun i => W i) i v) = _ + rw [DirectSum.lmap_lof] + rfl +end Congr + +variable (k D X : 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] +local instance (N : ModuleCat.{u} D) : Module k N := BimoduleTensor.scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat.{u} D) +local notation "Z" => (Functor.obj (ChainComplex.single₀ (ModuleCat D)) N) +local instance (r n : ℕ) : DecidableEq (Index r n) := Classical.decEq _ +local instance (r n : ℕ) : DecidableEq (Multibar.Indexed.Shape r n) := Classical.decEq _ + +/-- The inverse coordinate map on a literal block generator is exactly its +recursive tensor inclusion, with the proved tensor-coordinate isomorphism. -/ +theorem moduleFlatCoordinates_inv_lof (r n : ℕ) (p : Multibar.Indexed.Shape (r+n) r) : + ModuleCat.ofHom (DirectSum.lof D (Multibar.Indexed.Shape (r+n) r) + (Multibar.Indexed.outerTensor k D X N) p) ≫ (moduleFlatCoordinates k D X N r n).inv = + (reindexedModuleSummandIso k D X N r n p).inv ≫ + lof (leadingBarSequence k D X r) Z (r+1) n ((moduleShapeEquiv r n).symm p).val := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + dsimp only [moduleFlatCoordinates] + erw [Iso.trans_inv, Iso.trans_inv] + simp only [ModuleCat.hom_comp, + LinearEquiv.toModuleIso_inv, ModuleCat.hom_ofHom, LinearMap.comp_apply, + LinearEquiv.coe_coe] + erw [congrLinearEquiv_symm_lof, DirectSum.lequivCongrLeft_symm_lof] + simp only [supportIso] + exact DirectSum.toModule_lof D + (N := flat (leadingBarSequence k D X r) Z (r+1) n) + (M := fun t : {t : Index (r+1) n // inputDegree (r+1) t=0} => + summand (leadingBarSequence k D X r) Z (r+1) n t.val) + ((moduleShapeEquiv r n).symm p) ((reindexedModuleSummandIso k D X N r n p).inv.hom v) + +/-- The same inverse map into the actual leading total; this is the concrete +map to use when comparing the literal parity faces with the recursive total. -/ +theorem leadingModuleCoordinates_inv_lof (r n : ℕ) (p : Multibar.Indexed.Shape (r+n) r) : + ModuleCat.ofHom (DirectSum.lof D (Multibar.Indexed.Shape (r+n) r) + (Multibar.Indexed.outerTensor k D X N) p) ≫ (moduleFlatCoordinates k D X N r n).inv ≫ + assemble (leadingBarSequence k D X r) Z (r+1) n = + (reindexedModuleSummandIso k D X N r n p).inv ≫ + inclusion (leadingBarSequence k D X r) Z (r+1) n ((moduleShapeEquiv r n).symm p).val := by + erw [← Category.assoc, moduleFlatCoordinates_inv_lof, Category.assoc, lof_assemble] + +/-- Full horizontal-plus-signed-vertical formula on each actual Shape summand. +The index is obtained by the proved inverse parsing, not an assumed correspondence. -/ +theorem indexedDifferential_on_block (r n : ℕ) + (p : Multibar.Indexed.Shape (r+(n+1)) r) : + let t := ((moduleShapeEquiv r (n+1)).symm p).val + ModuleCat.ofHom (DirectSum.lof D (Multibar.Indexed.Shape (r+(n+1)) r) + (Multibar.Indexed.outerTensor k D X N) p) ≫ indexedDifferential k D X N r n = + (reindexedModuleSummandIso k D X N r (n+1) p).inv ≫ + (horizontal (leadingBarSequence k D X r) Z r n t.1.val.1 t.1.val.2 t.1.property t.2 + + vertical (leadingBarSequence k D X r) Z r n t.1.val.1 t.1.val.2 t.1.property t.2 + (differential (leadingBarSequence k D X r) Z r)) ≫ + (moduleFlatCoordinates k D X N r n).hom := by + dsimp only + erw [indexedDifferential, ← Category.assoc, moduleFlatCoordinates_inv_lof, Category.assoc] + simp only [flatLeadingMultibar, flatComplex, ChainComplex.of_d] + congr 1 + let t := ((moduleShapeEquiv r (n+1)).symm p).val + exact lof_differential_succ_assoc (leadingBarSequence k D X r) Z r n + t.1.val.1 t.1.val.2 t.1.property t.2 (moduleFlatCoordinates k D X N r n).hom +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/BlockIndexEquiv.lean b/lean/OAI/Algebra/Finitistic/Bar/BlockIndexEquiv.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4d1cd3f038c471648c81e1779b886b4c97dca20 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/BlockIndexEquiv.lean @@ -0,0 +1,108 @@ +import OAI.Algebra.Finitistic.Bar.SignedBlockModel + +namespace OAI +noncomputable section +namespace DerivedBar.Multibar + +/-- The first X uniquely determines the length of the preceding D block. -/ +theorem base_run_injective (i j : ℕ) (p q : List Bool) + (h : List.replicate i false ++ true :: p = List.replicate j false ++ true :: q) : + i=j ∧ p=q := by + induction i generalizing j with + | zero => + cases j with + | zero => simpa using h + | succ j => simp [List.replicate_succ] at h + | succ i ih => + cases j with + | zero => simp [List.replicate_succ] at h + | succ j => + have ht : List.replicate i false ++ true :: p = List.replicate j false ++ true :: q := by + simpa only [List.replicate_succ, List.cons_append, List.cons.injEq, true_and] using h + obtain ⟨hij,hpq⟩ := ih j ht + exact ⟨congrArg Nat.succ hij,hpq⟩ + +/-- Consecutive block lengths have a unique literal D/X word. -/ +theorem pattern_injective (r : ℕ) : Function.Injective (pattern r) := by + induction r with + | zero => + intro i j h + change List.replicate i false = List.replicate j false at h + exact List.length_replicate.symm.trans ((congrArg List.length h).trans List.length_replicate) + | succ r ih => + rintro ⟨i,p⟩ ⟨j,q⟩ h + obtain ⟨hij,hpq⟩ := base_run_injective i j (pattern r p) (pattern r q) h + exact Prod.ext hij (ih hpq) + +/-- Parse a word of a specified count without changing its block data. -/ +def parseOfCount (r : ℕ) (p : List Bool) (h : count p=r) : Blocks r := h ▸ parse p + +@[simp] theorem pattern_parseOfCount (r : ℕ) (p : List Bool) (h : count p=r) : + pattern r (parseOfCount r p h) = p := by + subst r + exact pattern_parse p + +@[simp] theorem parseOfCount_pattern (r : ℕ) (b : Blocks r) : + parseOfCount r (pattern r b) (count_pattern r b) = b := by + apply pattern_injective r + simp + +namespace Indexed + +def shapeOfList : (p : List Bool) → Shape p.length (count p) + | [] => .nil + | false :: p => .base (shapeOfList p) + | true :: p => .ideal (shapeOfList p) + +@[simp] theorem toList_shapeOfList (p : List Bool) : toList (shapeOfList p) = p := by + induction p with + | nil => rfl + | cons b p ih => + cases b with + | false => exact congrArg (false :: ·) ih + | true => exact congrArg (true :: ·) ih + +def castShape {n m r s : ℕ} (hn : n=m) (hr : r=s) (p : Shape n r) : Shape m s := hn ▸ hr ▸ p + +@[simp] theorem toList_castShape {n m r s : ℕ} (hn : n=m) (hr : r=s) (p : Shape n r) : + toList (castShape hn hr p) = toList p := by + subst m s + rfl + +/-- Construct the degree-indexed tensor shape of a tuple of block lengths. -/ +def shapeOfBlocks (r : ℕ) (b : Blocks r) : Shape (r+total r b) r := + castShape (length_pattern r b) (count_pattern r b) (shapeOfList (pattern r b)) + +@[simp] theorem toList_shapeOfBlocks (r : ℕ) (b : Blocks r) : + toList (shapeOfBlocks r b) = pattern r b := by + simp [shapeOfBlocks] + +def blocksOfShape {n r : ℕ} (p : Shape n r) : Blocks r := + parseOfCount r (toList p) (count_toList p) + +@[simp] theorem pattern_blocksOfShape {n r : ℕ} (p : Shape n r) : + pattern r (blocksOfShape p) = toList p := by simp [blocksOfShape] + +theorem total_blocksOfShape {n r : ℕ} (p : Shape n r) : r+total r (blocksOfShape p)=n := by + have h := length_pattern r (blocksOfShape p) + rw [pattern_blocksOfShape, length_toList] at h + exact h.symm + +/-- Reindex the finite block-length diagonal by the existing tensor shapes. +The shift by r occurs in the degree, not in a hidden tensor-power replacement. -/ +def blockDegreeEquiv (r m : ℕ) : {b : Blocks r // total r b=m} ≃ Shape (r+m) r where + toFun b := castShape (congrArg (r+·) b.property) rfl (shapeOfBlocks r b.val) + invFun p := ⟨blocksOfShape p, by have := total_blocksOfShape p; omega⟩ + left_inv b := by + apply Subtype.ext + apply pattern_injective r + simp + right_inv p := by + apply toList_injective + simp +end Indexed +end DerivedBar.Multibar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/ChainSplitting.lean b/lean/OAI/Algebra/Finitistic/Bar/ChainSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..a780455fbe61b92a1ea56c17d09321ec5341b909 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/ChainSplitting.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.Finitistic.Bar.Splitting + +namespace OAI +open scoped TensorProduct DirectSum +open TensorProduct CategoryTheory TrivSqZeroExt +noncomputable section + +namespace DerivedBar +universe u + +/-- The direct sum of module chain complexes, with the componentwise actual differential. -/ +def directSumComplex {R : Type u} [Ring R] (C : ℕ → ChainComplex (ModuleCat R) ℕ) : + ChainComplex (ModuleCat R) ℕ := + ChainComplex.of (fun n => ModuleCat.of R (⨁ r, (C r).X n)) + (fun n => ModuleCat.ofHom (DirectSum.lmap (fun r => ((C r).d (n+1) n).hom))) + (fun n => by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + apply DFinsupp.ext + intro r + exact LinearMap.congr_fun + (ModuleCat.hom_ext_iff.mp ((C r).d_comp_d (n+1+1) (n+1) n)) (z r)) + +namespace SquareZero +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] + [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] +variable (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = 0) + +/-- Chain-level count splitting of the actual two-sided absolute bar complex. +This is the first chain isomorphism in the proof of manuscript prop:bar-splitting. +Identification of these summands with derived tensor iterates is a separate dependency. -/ +def countSplitting : + directSumComplex (twoSidedWeightComplex k D X N hN) ≅ + twoSidedComplex k (TrivSqZeroExt D X) D N (fstHom k D X) := + HomologicalComplex.Hom.isoOfComponents + (fun n => (twoSidedWeightEquiv k D X N n).toModuleIso) + (by + intro i j hij + change j+1 = i at hij + subst i + apply ModuleCat.hom_ext + apply DirectSum.linearMap_ext + intro r + apply LinearMap.ext + intro v + simp only [directSumComplex, twoSidedComplex, ChainComplex.of_d, + ModuleCat.hom_comp, ModuleCat.hom_ofHom, twoSidedWeightEquiv] + change twoSidedDifferential k (TrivSqZeroExt D X) D N (fstHom k D X) j + (DirectSum.coeLinearMap (twoSidedWeight k D X N (j+1)) + (DirectSum.lof D ℕ _ r v)) = + DirectSum.coeLinearMap (twoSidedWeight k D X N j) + (DirectSum.lmap (fun r => ((twoSidedWeightComplex k D X N hN r).d (j+1) j).hom) + (DirectSum.lof D ℕ _ r v)) + rw [DirectSum.lmap_lof] + erw [DirectSum.coeLinearMap_lof, DirectSum.coeLinearMap_lof] + simp only [twoSidedWeightComplex, ChainComplex.of_d, ModuleCat.hom_ofHom] + rfl) +end SquareZero +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/CoproductHomBijections.lean b/lean/OAI/Algebra/Finitistic/Bar/CoproductHomBijections.lean new file mode 100644 index 0000000000000000000000000000000000000000..1543240cf38e97674fa9982f1f19c89374cdd11d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/CoproductHomBijections.lean @@ -0,0 +1,59 @@ +import Mathlib.CategoryTheory.Limits.Preserves.Basic +import Mathlib.CategoryTheory.EssentialImage +import Mathlib.CategoryTheory.Discrete.Basic + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace DerivedBar +universe u v u' v' +variable {C : Type u} [Category.{v} C] {D : Type u'} [Category.{v'} D] + (G : C ⥤ D) [G.EssSurj] (F : Discrete ℕ ⥤ C) (s : Cocone F) (hs : IsColimit s) + (hp : ∀ T : C, Function.Bijective (G.map : (s.pt ⟶ T) → (G.obj s.pt ⟶ G.obj T))) + (hF : ∀ (r : Discrete ℕ) (T : C), + Function.Bijective (G.map : (F.obj r ⟶ T) → (G.obj (F.obj r) ⟶ G.obj T))) + +def homBijectionCoconeLift (t : Cocone (F ⋙ G)) : Cocone F where + pt := G.objPreimage t.pt + ι := Discrete.natTrans (fun r => + (Equiv.ofBijective _ (hF r (G.objPreimage t.pt))).symm + (t.ι.app r ≫ (G.objObjPreimageIso t.pt).inv)) + +theorem homBijectionCoconeLift_map (t : Cocone (F ⋙ G)) (r : Discrete ℕ) : + G.map ((homBijectionCoconeLift G F hF t).ι.app r) = + t.ι.app r ≫ (G.objObjPreimageIso t.pt).inv := + (Equiv.ofBijective _ (hF r (G.objPreimage t.pt))).apply_symm_apply _ + +/-- A coproduct's full Hom universal property transfers through an essentially +surjective functor when Hom is bijective on its summands and its point. -/ +def mapCoproductOfHomBijections : IsColimit (G.mapCocone s) where + desc t := G.map (hs.desc (homBijectionCoconeLift G F hF t)) ≫ (G.objObjPreimageIso t.pt).hom + fac t r := by + change G.map (s.ι.app r) ≫ G.map (hs.desc (homBijectionCoconeLift G F hF t)) ≫ + (G.objObjPreimageIso t.pt).hom = t.ι.app r + erw [← Category.assoc, ← Functor.map_comp, hs.fac, homBijectionCoconeLift_map] + change (t.ι.app r ≫ (G.objObjPreimageIso t.pt).inv) ≫ (G.objObjPreimageIso t.pt).hom = _ + simp only [Category.assoc, Iso.inv_hom_id, Category.comp_id] + uniq t m hm := by + let e := G.objObjPreimageIso t.pt + let u := (Equiv.ofBijective _ (hp (G.objPreimage t.pt))).symm (m ≫ e.inv) + have hu : G.map u=m ≫ e.inv := + (Equiv.ofBijective _ (hp (G.objPreimage t.pt))).apply_symm_apply _ + have heq : u=hs.desc (homBijectionCoconeLift G F hF t) := by + apply hs.hom_ext + intro r + erw [hs.fac] + apply (hF r (G.objPreimage t.pt)).injective + have hmr := hm r + change G.map (s.ι.app r) ≫ m = t.ι.app r at hmr + have hleft : G.map (s.ι.app r ≫ u) = t.ι.app r ≫ e.inv := by + rw [Functor.map_comp, hu, ← Category.assoc, hmr] + exact hleft.trans (homBijectionCoconeLift_map G F hF t r).symm + calc + m = G.map u ≫ e.hom := by rw [hu]; simp only [Category.assoc, Iso.inv_hom_id, Category.comp_id] + _ = _ := by rw [heq]; rfl +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/CoproductHomotopy.lean b/lean/OAI/Algebra/Finitistic/Bar/CoproductHomotopy.lean new file mode 100644 index 0000000000000000000000000000000000000000..785e5f9ee65c775facde766004f2b2df8f351051 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/CoproductHomotopy.lean @@ -0,0 +1,81 @@ +import Mathlib.Algebra.Homology.HomotopyCategory +import Mathlib.Algebra.Homology.HomologicalComplexLimits + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace DerivedBar + +section +universe u v w +variable {C : Type u} [Category.{v} C] [Preadditive C] + [HasColimitsOfShape (Discrete ℕ) C] {ι : Type w} {c : ComplexShape ι} + (F : Discrete ℕ ⥤ HomologicalComplex C c) (s : Cocone F) (hs : IsColimit s) + {Y : HomologicalComplex C c} (f g : s.pt ⟶ Y) + (h : ∀ r, Homotopy (s.ι.app r ≫ f) (s.ι.app r ≫ g)) + +def coproductHomotopyHom (i j : ι) : s.pt.X i ⟶ Y.X j := + (isColimitOfPreserves (HomologicalComplex.eval C c i) hs).desc + { pt := Y.X j, ι := Discrete.natTrans (fun r => (h r).hom i j) } + +@[reassoc] theorem ι_coproductHomotopyHom (i j : ι) (r : Discrete ℕ) : + (s.ι.app r).f i ≫ coproductHomotopyHom F s hs f g h i j = (h r).hom i j := + (isColimitOfPreserves (HomologicalComplex.eval C c i) hs).fac _ r + +/-- Homotopies out of the summands assemble through the actual degreewise +coproduct, so equality after the homotopy quotient is still detected summandwise. -/ +def coproductHomotopy : Homotopy f g where + hom := coproductHomotopyHom F s hs f g h + zero i j hij := by + apply (isColimitOfPreserves (HomologicalComplex.eval C c i) hs).hom_ext + intro r + change (s.ι.app r).f i ≫ coproductHomotopyHom F s hs f g h i j = _ + rw [ι_coproductHomotopyHom, CategoryTheory.Limits.comp_zero] + exact (h r).zero i j hij + comm i := by + apply (isColimitOfPreserves (HomologicalComplex.eval C c i) hs).hom_ext + intro r + change (s.ι.app r).f i ≫ f.f i = (s.ι.app r).f i ≫ + (s.pt.d i (c.next i) ≫ coproductHomotopyHom F s hs f g h (c.next i) i + + coproductHomotopyHom F s hs f g h i (c.prev i) ≫ Y.d (c.prev i) i + g.f i) + simp only [Preadditive.comp_add] + erw [(s.ι.app r).comm_assoc i (c.next i)] + rw [ι_coproductHomotopyHom, ι_coproductHomotopyHom_assoc] + exact (h r).comm i + +end +universe u v w +variable {C : Type u} [Category.{v} C] [Preadditive C] + [HasColimitsOfShape (Discrete ℕ) C] {ι : Type w} {c : ComplexShape ι} + (F : Discrete ℕ ⥤ HomologicalComplex C c) (s : Cocone F) (hs : IsColimit s) +local notation "Q" => HomotopyCategory.quotient C c + +def homotopyCoconeLift (t : Cocone (F ⋙ Q)) : Cocone F where + pt := t.pt.as + ι := Discrete.natTrans (fun r => (t.ι.app r).out) + +/-- The actual coproduct survives the homotopy quotient. Both existence and +uniqueness are proved; the latter assembles the component homotopies. -/ +def homotopyCoproductIsColimit : IsColimit ((Q).mapCocone s) where + desc t := (Q).map (hs.desc (homotopyCoconeLift F t)) + fac t r := by + change (Q).map (s.ι.app r) ≫ (Q).map (hs.desc (homotopyCoconeLift F t)) = _ + rw [← Functor.map_comp, hs.fac] + exact HomotopyCategory.quotient_map_out _ + uniq t m hm := by + have h : Homotopy m.out (hs.desc (homotopyCoconeLift F t)) := + coproductHomotopy F s hs m.out (hs.desc (homotopyCoconeLift F t)) (fun r => + HomotopyCategory.homotopyOfEq _ _ (by + erw [hs.fac] + have hmr := hm r + change (Q).map (s.ι.app r) ≫ m = t.ι.app r at hmr + simp only [Functor.map_comp, homotopyCoconeLift, Discrete.natTrans_app, + HomotopyCategory.quotient_map_out] + exact hmr)) + exact (HomotopyCategory.quotient_map_out m).symm.trans + (HomotopyCategory.eq_of_homotopy _ _ h) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/CountHomologyDetection.lean b/lean/OAI/Algebra/Finitistic/Bar/CountHomologyDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..da5662af776f212d47ae385ca161f7c7561c0da1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/CountHomologyDetection.lean @@ -0,0 +1,91 @@ +import OAI.Algebra.Finitistic.Bar.CountRetracts +import OAI.Algebra.Finitistic.Bar.DirectSumExactness +import Mathlib.Algebra.Homology.DerivedCategory.HomologySequence + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex TrivSqZeroExt +noncomputable section +namespace DerivedBar +universe u v w z + +theorem nonzero_of_functor_retract {C : Type u} [Category.{v} C] + {E : Type w} [Category.{z} E] [HasZeroMorphisms E] + (F : C ⥤ E) {V W : C} (i : V ⟶ W) (p : W ⟶ V) (hip : i ≫ p = 𝟙 V) + (h : ¬ IsZero (F.obj V)) : ¬ IsZero (F.obj W) := by + intro hz + apply h + rw [IsZero.iff_id_eq_zero] + have hm := congrArg F.map hip + rw [F.map_comp, F.map_id] at hm + rw [← hm, hz.eq_of_tgt (F.map i) 0, zero_comp] + +variable (D : Type u) [Ring D] +local instance countHomologyDetectionHasDerivedCategory : + HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- Exact comparison of integer derived homology and the original chain degree. -/ +def integerQHomologyIso (K : ChainComplex (ModuleCat.{u} D) ℕ) (n : ℕ) : + (DerivedCategory.homologyFunctor (ModuleCat.{u} D) (-(n:ℤ))).obj ((integerQ D).obj K) ≅ + K.homology n := + (DerivedCategory.homologyFunctorFactors (ModuleCat.{u} D) (-(n:ℤ))).app + ((integerExtension D).obj K) ≪≫ integerExtensionHomologyIso D K n +end DerivedBar +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +local notation "S" => SquareZero.twoSidedWeightComplex k D X N (inflated_ideal_zero D X N) +local notation "T" => tensorBarComplex k A D N (fstHom k D X) + +/-- Uniform vanishing of the original count homologies implies vanishing of +the entire actual balanced tensor bar, including its infinite count family. -/ +theorem tensorBar_homology_zero_of_counts (n : ℕ) (h : ∀ r, IsZero ((S r).homology n)) : + IsZero ((T).homology n) := + (directSumComplex_homology_zero D S n h).of_iso + ((HomologicalComplex.homologyFunctor (ModuleCat D) (.down ℕ) n).mapIso + (SquareZero.tensorCountSplitting k D X N (inflated_ideal_zero D X N))) + +theorem tensorBar_homology_nonzero_of_count (r n : ℕ) (h : ¬ IsZero ((S r).homology n)) : + ¬ IsZero ((T).homology n) := + nonzero_of_functor_retract (HomologicalComplex.homologyFunctor (ModuleCat D) (.down ℕ) n) + (countTensorBarInclusion k D X N r) (countTensorBarProjection k D X N r) + (countTensorBar_retract k D X N r) h + +/-- Direct input bridge for uniform bounds on the original count objects in +the integer derived category, yielding actual base-change Tor vanishing. -/ +theorem baseChangeTor_zero_of_counts (n : ℕ) + (h : ∀ r, IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n:ℤ))).obj + ((integerQ D).obj (S r)))) : + IsZero (((Balanced.tensorFunctor (fstHom k D X)).leftDerived n).obj (ModuleCat.of A N)) := + (tensorBar_homology_zero_of_counts k D X N n + (fun r => (h r).of_iso (integerQHomologyIso D (S r) n).symm)).of_iso + (Balanced.tensorBarHomologyIso (fstHom k D X) N n) + +/-- A surviving original count homology is a nonzero actual Tor group. -/ +theorem baseChangeTor_nonzero_of_count (r n : ℕ) + (h : ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n:ℤ))).obj + ((integerQ D).obj (S r)))) : + ¬ IsZero (((Balanced.tensorFunctor (fstHom k D X)).leftDerived n).obj (ModuleCat.of A N)) := by + intro hz + have hc : IsZero ((S r).homology n) → False := by + intro hc + exact h (hc.of_iso (integerQHomologyIso D (S r) n)) + apply tensorBar_homology_nonzero_of_count k D X N r n hc + exact hz.of_iso (Balanced.tensorBarHomologyIso (fstHom k D X) N n).symm +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/CountProjective.lean b/lean/OAI/Algebra/Finitistic/Bar/CountProjective.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee2cffc92ebaafa634587e1be10c91adb8ef3c16 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/CountProjective.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Finitistic.Bar.DerivedCountShift +import OAI.Algebra.Finitistic.Bar.DirectSumCoproduct +import Mathlib.LinearAlgebra.DirectSum.Basis +import Mathlib.Algebra.Homology.HomotopyCategory.KProjective + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar +universe u +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] +open Multibar.Indexed +local instance countProjectiveShapeDecidableEq (n r : ℕ) : DecidableEq (Shape n r) := + Classical.decEq _ + +instance outerTensor_free {n r : ℕ} (p : Shape n r) : + Module.Free D (outerTensor k D X N p) := + Module.Free.of_basis (Algebra.TensorProduct.basis D + (Module.Free.chooseBasis k (tensor k D X N p))) + +instance countWeight_free (n r : ℕ) : + Module.Free D (SquareZero.twoSidedWeight k D X N n r) := + Module.Free.of_equiv (decomposition k D X N n r) + +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = 0) + +instance countComplex_projective (r n : ℕ) : + Projective ((SquareZero.twoSidedWeightComplex k D X N hN r).X n) := by + change Projective (ModuleCat.of D (SquareZero.twoSidedWeight k D X N n r)) + infer_instance + +instance countSum_projective (n : ℕ) : + Projective ((directSumComplex (SquareZero.twoSidedWeightComplex k D X N hN)).X n) := by + classical + let (r : ℕ) : Module.Free D ((SquareZero.twoSidedWeightComplex k D X N hN r).X n) := + countWeight_free k D X N n r + change Projective (ModuleCat.of D (⨁ r : ℕ, (SquareZero.twoSidedWeightComplex k D X N hN r).X n)) + infer_instance + +instance integerCount_isKProjective (r : ℕ) : + ((integerExtension D).obj (SquareZero.twoSidedWeightComplex k D X N hN r)).IsKProjective := by + change CochainComplex.IsKProjective ((SquareZero.twoSidedWeightComplex k D X N hN r).extend + ComplexShape.embeddingDownNat) + infer_instance + +instance integerCountSum_isKProjective : + ((integerExtension D).obj (directSumComplex + (SquareZero.twoSidedWeightComplex k D X N hN))).IsKProjective := by + change CochainComplex.IsKProjective ((directSumComplex (SquareZero.twoSidedWeightComplex k D X N hN)).extend + ComplexShape.embeddingDownNat) + infer_instance +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/CountRetracts.lean b/lean/OAI/Algebra/Finitistic/Bar/CountRetracts.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6349ee9354726529798dbeb2dcc9decfd732af3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/CountRetracts.lean @@ -0,0 +1,101 @@ +import OAI.Algebra.Finitistic.Bar.DerivedTensorBarSplitting + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex TrivSqZeroExt +open scoped DirectSum +noncomputable section +namespace DerivedBar +universe u +variable (D : Type u) [Ring D] + +/-- Projection from the original chain direct sum to its r-th complex. -/ +def directSumComplexProjection (S : ℕ → ChainComplex (ModuleCat.{u} D) ℕ) (r : ℕ) : + directSumComplex S ⟶ S r where + f n := ModuleCat.ofHom (DirectSum.component D ℕ (fun s => (S s).X n) r) + comm' i j hij := by + change j+1=i at hij + subst i + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + simp only [directSumComplex, ChainComplex.of_d, ModuleCat.hom_comp, + ModuleCat.hom_ofHom] + rfl + +@[simp] theorem directSumComplex_inclusion_projection + (S : ℕ → ChainComplex (ModuleCat.{u} D) ℕ) (r : ℕ) : + directSumComplexInclusion D S r ≫ directSumComplexProjection D S r = 𝟙 (S r) := by + ext degree value + change DirectSum.component D ℕ (fun summand => (S summand).X degree) r + (DirectSum.lof D ℕ (fun summand => (S summand).X degree) r value) = value + exact DirectSum.component.lof_self D (M := fun summand => (S summand).X degree) r value + +end DerivedBar +namespace DerivedBar.ParityBridge + +private theorem mapped_retract {C E : Type*} [Category C] [Category E] + (F : C ⥤ E) {V W : C} {U T : E} (e : U ≅ F.obj V) (f : T ≅ F.obj W) + (i : V ⟶ W) (p : W ⟶ V) (h : i ≫ p = 𝟙 V) : + (e.hom ≫ F.map i ≫ f.inv) ≫ (f.hom ≫ F.map p ≫ e.inv) = 𝟙 U := by + simp only [Category.assoc, Iso.inv_hom_id_assoc] + rw [← Functor.map_comp_assoc, h, CategoryTheory.Functor.map_id, Category.id_comp, + Iso.hom_inv_id] + +universe u +variable (k D X : 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] +local instance countRetractsScalarModule (V : ModuleCat D) : Module k V := + BimoduleTensor.scalarModule k D V +local instance countRetractsScalarTower (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local instance countRetractsInflatedModule : Module A N := inflatedModule D X N +local instance countRetractsInflatedScalarTower : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) +local instance countRetractsHasDerivedCategory : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +local notation "S" => SquareZero.twoSidedWeightComplex k D X N (inflated_ideal_zero D X N) +local notation "T" => tensorBarComplex k A D N (fstHom k D X) + +/-- The original count subcomplex included into the actual balanced tensor bar. -/ +def countTensorBarInclusion (r : ℕ) : S r ⟶ T := + directSumComplexInclusion D S r ≫ + (SquareZero.tensorCountSplitting k D X N (inflated_ideal_zero D X N)).inv + +def countTensorBarProjection (r : ℕ) : T ⟶ S r := + (SquareZero.tensorCountSplitting k D X N (inflated_ideal_zero D X N)).hom ≫ + directSumComplexProjection D S r + +@[simp] theorem countTensorBar_retract (r : ℕ) : + countTensorBarInclusion k D X N r ≫ countTensorBarProjection k D X N r = 𝟙 (S r) := by + simp only [countTensorBarInclusion, countTensorBarProjection, Category.assoc, + Iso.inv_hom_id_assoc, directSumComplex_inclusion_projection] + +/-- The genuine shifted iterate included into actual left-derived base change. -/ +def shiftedIterateInclusion (r : ℕ) : + (shiftedIterateDiagram k D X N).obj ⟨r⟩ ⟶ + (derivedBaseChange D (fstHom k D X)).obj (ModuleCat.of A N) := + (derivedIterateWeightShiftIso k D X N r).hom ≫ + (integerQ D).map (countTensorBarInclusion k D X N r) ≫ + (derivedBaseChangeBarIso D (fstHom k D X) N).inv + +def shiftedIterateProjection (r : ℕ) : + (derivedBaseChange D (fstHom k D X)).obj (ModuleCat.of A N) ⟶ + (shiftedIterateDiagram k D X N).obj ⟨r⟩ := + (derivedBaseChangeBarIso D (fstHom k D X) N).hom ≫ + (integerQ D).map (countTensorBarProjection k D X N r) ≫ + (derivedIterateWeightShiftIso k D X N r).inv + +@[simp] theorem shiftedIterate_retract (r : ℕ) : + shiftedIterateInclusion k D X N r ≫ shiftedIterateProjection k D X N r = + 𝟙 ((shiftedIterateDiagram k D X N).obj ⟨r⟩) := by + exact mapped_retract (integerQ D) (derivedIterateWeightShiftIso k D X N r) + (derivedBaseChangeBarIso D (fstHom k D X) N) _ _ (countTensorBar_retract k D X N r) +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/CountTorBounds.lean b/lean/OAI/Algebra/Finitistic/Bar/CountTorBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7f1f4e6ff67cc6b78e2705953c3808eee129714 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/CountTorBounds.lean @@ -0,0 +1,60 @@ +import OAI.Algebra.Finitistic.Bar.CountHomologyDetection + +namespace OAI +open CategoryTheory CategoryTheory.Limits TrivSqZeroExt +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +local notation "S" => SquareZero.twoSidedWeightComplex k D X N (inflated_ideal_zero D X N) +local notation "T" => tensorBarComplex k A D N (fstHom k D X) + +/-- Exact degreewise vanishing criterion for actual base-change Tor, in terms +of the original integer-derived count objects. -/ +theorem baseChangeTor_zero_iff_counts (n : ℕ) : + IsZero (((Balanced.tensorFunctor (fstHom k D X)).leftDerived n).obj (ModuleCat.of A N)) ↔ + ∀ r, IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n:ℤ))).obj + ((integerQ D).obj (S r))) := by + constructor + · intro hz r + by_contra hr + exact baseChangeTor_nonzero_of_count k D X N r n hr hz + · exact baseChangeTor_zero_of_counts k D X N n + +/-- A uniform upper bound on the original count homologies is a uniform bound +on actual base-change Tor. This is the consumer for Native's uniform count window. -/ +theorem baseChangeTor_bounded_of_counts (B : ℕ) + (h : ∀ r n, B < n → + IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n:ℤ))).obj + ((integerQ D).obj (S r)))) : + ∀ n, B < n → + IsZero (((Balanced.tensorFunctor (fstHom k D X)).leftDerived n).obj (ModuleCat.of A N)) := + fun n hn => baseChangeTor_zero_of_counts k D X N n (fun r => h r n hn) + +/-- Any nonzero count homology witness above r gives a nonzero actual Tor +witness above r, without replacing projective dimension by an invented invariant. -/ +theorem baseChangeTor_nonzero_ge_of_count (r : ℕ) + (h : ∃ n, r ≤ n ∧ + ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n:ℤ))).obj + ((integerQ D).obj (S r)))) : + ∃ n, r ≤ n ∧ + ¬ IsZero (((Balanced.tensorFunctor (fstHom k D X)).leftDerived n).obj (ModuleCat.of A N)) := by + obtain ⟨n, hn, hnonzero⟩ := h + exact ⟨n, hn, baseChangeTor_nonzero_of_count k D X N r n hnonzero⟩ +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/DerivedBarCoproduct.lean b/lean/OAI/Algebra/Finitistic/Bar/DerivedBarCoproduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..5eeaa1f998928f1205042d8ca4b9d9f66811982d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/DerivedBarCoproduct.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Bar.DerivedCountCoproduct +import OAI.Algebra.Finitistic.Bar.TensorModel + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +local notation "S" => SquareZero.twoSidedWeightComplex k D X N (inflated_ideal_zero D X N) + +/-- The actual discrete diagram of genuine shifted finite derived tensor iterates. -/ +def shiftedIterateDiagram : Discrete ℕ ⥤ DerivedCategory (ModuleCat.{u} D) := + Discrete.functor (fun r : ℕ => + ((chainToIntegerDerived D).obj + ((derivedTensorIterate k D X r).obj ((chainQ D).obj Z)))⟦(r:ℤ)⟧) + +def shiftedIterateCountIso : shiftedIterateDiagram k D X N ≅ + Discrete.functor S ⋙ integerQ D := + Discrete.natIso (fun r => derivedIterateWeightShiftIso k D X N r.as) + +def shiftedIterateCocone : Cocone (shiftedIterateDiagram k D X N) := + (Cocone.precompose (shiftedIterateCountIso k D X N).hom).obj + ((integerQ D).mapCocone (directSumComplexCocone D S)) + +/-- Both existence and uniqueness in the derived coproduct universal property +hold for the shifted iterates, without assuming a central splitting theorem. -/ +def shiftedIterateIsColimit : IsColimit (shiftedIterateCocone k D X N) := + (IsColimit.precomposeHomEquiv (shiftedIterateCountIso k D X N) _).symm + (derivedCountCoproductIsColimit k D X N (inflated_ideal_zero D X N)) + +instance hasColimitShiftedIterates : HasColimit (shiftedIterateDiagram k D X N) := + ⟨⟨_, shiftedIterateIsColimit k D X N⟩⟩ + +/-- Manuscript prop:bar-splitting, eq:bar-splitting: the balanced tensor of +D with the verified free A-bar resolution is isomorphic, in the genuine +integer derived category, to the actual coproduct of (F^r N)[r]. -/ +def derivedBarSplitting : + (integerQ D).obj (tensorBarComplex k A D N (fstHom k D X)) ≅ + colimit (shiftedIterateDiagram k D X N) := + (integerQ D).mapIso (SquareZero.tensorCountSplitting k D X N + (inflated_ideal_zero D X N)) ≪≫ + (shiftedIterateIsColimit k D X N).coconePointUniqueUpToIso + (colimit.isColimit (shiftedIterateDiagram k D X N)) +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/DerivedCountCoproduct.lean b/lean/OAI/Algebra/Finitistic/Bar/DerivedCountCoproduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..1eb8752f6832ccaa9de7e8e6ae5df72ed07dfb0a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/DerivedCountCoproduct.lean @@ -0,0 +1,37 @@ +import OAI.Algebra.Finitistic.Bar.CountProjective +import OAI.Algebra.Finitistic.Bar.KProjectiveCoproduct +import OAI.Algebra.Finitistic.Bar.ExtensionColimits + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex TrivSqZeroExt +noncomputable section +namespace DerivedBar +universe u +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] + [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = 0) +local instance derivedCountCoproductHasDerivedCategory : + HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +local notation "S" => SquareZero.twoSidedWeightComplex k D X N hN + +/-- The original count direct sum, with its original inclusions, is an actual +coproduct after passing to the genuine integer derived category. -/ +def derivedCountCoproductIsColimit : + IsColimit ((integerQ D).mapCocone (directSumComplexCocone D S)) := by + letI : PreservesColimit (Discrete.functor S) (integerExtension D) := + extensionPreservesColimit ComplexShape.embeddingDownNat (Discrete.functor S) + let s := (integerExtension D).mapCocone (directSumComplexCocone D S) + let hs := isColimitOfPreserves (integerExtension D) (directSumComplexIsColimit D S) + letI : s.pt.IsKProjective := integerCountSum_isKProjective k D X N hN + letI (r : Discrete ℕ) : (((Discrete.functor S) ⋙ integerExtension D).obj r).IsKProjective := + integerCount_isKProjective k D X N hN r.as + exact kProjectiveCoproductIsColimit ((Discrete.functor S) ⋙ integerExtension D) s hs +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/DerivedCountShift.lean b/lean/OAI/Algebra/Finitistic/Bar/DerivedCountShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c418f07cecda7e6332d4dc9724cd163b99e9e5d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/DerivedCountShift.lean @@ -0,0 +1,60 @@ +import OAI.Algebra.Finitistic.Bar.IntegerCountShift + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance (V : ModuleCat D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance derivedCountShiftIndexDecidableEq (r n : ℕ) : + DecidableEq (Index r n) := Classical.decEq _ +local instance derivedCountShiftShapeDecidableEq (n r : ℕ) : + DecidableEq (Multibar.Indexed.Shape n r) := Classical.decEq _ +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +local notation "C" => ModuleCat D +local notation "E" => ComplexShape.embeddingDownNat +local notation "K" => Multibar.Indexed.signedBlockComplex k D X N (inflated_ideal_zero D X N) + +/-- Identification with the original count subcomplex, using the actual integer +cochain shift and the already verified component sign involution. -/ +def integerIndexedWeightShiftIso (r : ℕ) : + ((integerExtension D).obj (indexedMultibar k D X N r))⟦(r:ℤ)⟧ ≅ + (integerExtension D).obj (SquareZero.twoSidedWeightComplex k D X N (inflated_ideal_zero D X N) r) := + integerIndexedCountShiftIso k D X N r ≪≫ + (integerExtension D).mapIso (Multibar.Indexed.signedBlockIso k D X N (inflated_ideal_zero D X N) r) + +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- Each original count summand is the genuine [r] shift of the constructed +finite derived tensor iterate. -/ +def derivedIterateWeightShiftIso (r : ℕ) : + ((chainToIntegerDerived D).obj + ((derivedTensorIterate k D X r).obj ((chainQ D).obj Z)))⟦(r:ℤ)⟧ ≅ + (integerQ D).obj (SquareZero.twoSidedWeightComplex k D X N (inflated_ideal_zero D X N) r) := + (CategoryTheory.shiftFunctor (DerivedCategory (ModuleCat.{u} D)) (r:ℤ)).mapIso + (integerDerivedIterateIndexedIso D k X N r) ≪≫ + ((DerivedCategory.Q.commShiftIso (r:ℤ)).symm.app + ((integerExtension D).obj (indexedMultibar k D X N r))) ≪≫ + DerivedCategory.Q.mapIso (integerIndexedWeightShiftIso k D X N r) +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/DerivedTensorBarSplitting.lean b/lean/OAI/Algebra/Finitistic/Bar/DerivedTensorBarSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7914730790db8967102fff867ee2e409ea928ce --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/DerivedTensorBarSplitting.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Bar.DerivedBarCoproduct +import OAI.Algebra.Finitistic.Bar.BalancedTensorFunctor +import Mathlib.Algebra.Homology.Embedding.ExtendHomotopy + +namespace OAI +open CategoryTheory CategoryTheory.Limits TrivSqZeroExt +noncomputable section +namespace DerivedBar +universe u +variable (D : Type u) [Ring D] +local instance derivedTensorBarSplittingHasDerivedCategory : + HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- Extension of the nonnegative homotopy category followed by the genuine +integer derived localization. -/ +abbrev homotopyToIntegerDerived : HomotopyCategory (ModuleCat.{u} D) (.down ℕ) ⥤ + DerivedCategory (ModuleCat.{u} D) := + ComplexShape.embeddingDownNat.extendHomotopyFunctor (ModuleCat.{u} D) ⋙ DerivedCategory.Qh + +def homotopyToIntegerDerivedIso (K : ChainComplex (ModuleCat.{u} D) ℕ) : + (homotopyToIntegerDerived D).obj ((HomotopyCategory.quotient _ _).obj K) ≅ + (integerQ D).obj K := + (DerivedCategory.quotientCompQhIso (ModuleCat.{u} D)).app ((integerExtension D).obj K) + +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [Algebra k D] + (f : A →ₐ[k] D) + +/-- The actual left-derived balanced base-change functor on modules, viewed +in the integer derived category. -/ +abbrev derivedBaseChange : ModuleCat.{u} A ⥤ DerivedCategory (ModuleCat.{u} D) := + (Balanced.tensorFunctor f).leftDerivedToHomotopyCategory ⋙ homotopyToIntegerDerived D + +def derivedBaseChangeBarIso (N : Type u) [AddCommGroup N] [Module k N] + [Module A N] [IsScalarTower k A N] : + (derivedBaseChange D f).obj (ModuleCat.of A N) ≅ + (integerQ D).obj (tensorBarComplex k A D N f) := + (homotopyToIntegerDerived D).mapIso (Balanced.tensorBarComputesLeftDerived f N) ≪≫ + homotopyToIntegerDerivedIso D _ +end DerivedBar +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- The actual left-derived D tensor over A is the actual categorical +coproduct of genuine shifted derived iterates. This proves the manuscript's +bar-splitting proposition; projective-dimension detection is a separate result. -/ +def derivedTensorBarSplitting : + (derivedBaseChange D (fstHom k D X)).obj (ModuleCat.of A N) ≅ + colimit (shiftedIterateDiagram k D X N) := + derivedBaseChangeBarIso D (fstHom k D X) N ≪≫ derivedBarSplitting k D X N +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/DirectSumCoproduct.lean b/lean/OAI/Algebra/Finitistic/Bar/DirectSumCoproduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..41b48fe6e1d5bb0836b31123414c930557aec994 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/DirectSumCoproduct.lean @@ -0,0 +1,71 @@ +import OAI.Algebra.Finitistic.Bar.ChainSplitting +import Mathlib.Algebra.Homology.HomologicalComplexLimits + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped DirectSum +noncomputable section +namespace DerivedBar +universe u +variable (D : Type u) [Ring D] + +/-- The native algebraic direct sum, with its actual coproduct maps. -/ +def moduleSumCocone (F : Discrete ℕ ⥤ ModuleCat.{u} D) : Cocone F where + pt := ModuleCat.of D (⨁ r : ℕ, F.obj ⟨r⟩) + ι := Discrete.natTrans (fun r => ModuleCat.ofHom (DirectSum.lof D ℕ (fun s => F.obj ⟨s⟩) r.as)) + +def moduleSumIsColimit (F : Discrete ℕ ⥤ ModuleCat.{u} D) : IsColimit (moduleSumCocone D F) where + desc s := ModuleCat.ofHom (DirectSum.toModule D ℕ s.pt (M := fun r => F.obj ⟨r⟩) + (fun r => (s.ι.app ⟨r⟩).hom)) + fac s j := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + simp only [moduleSumCocone, Discrete.natTrans_app, ModuleCat.hom_comp, + ModuleCat.hom_ofHom, LinearMap.comp_apply, DirectSum.toModule_lof] + + uniq s m hm := by + apply ModuleCat.hom_ext + apply DirectSum.linearMap_ext + intro r + apply LinearMap.ext + intro v + have h := congrArg (fun f => f.hom v) (hm ⟨r⟩) + change m.hom (DirectSum.lof D ℕ (fun s => F.obj ⟨s⟩) r v) = (s.ι.app ⟨r⟩).hom v at h + simp only [moduleSumCocone, LinearMap.comp_apply, ModuleCat.hom_ofHom, + DirectSum.toModule_lof] + exact h + +/-- The canonical summand map into the already constructed chain direct sum. -/ +def directSumComplexInclusion (S : ℕ → ChainComplex (ModuleCat.{u} D) ℕ) (r : ℕ) : + S r ⟶ directSumComplex S where + f n := ModuleCat.ofHom (DirectSum.lof D ℕ (fun s => (S s).X n) r) + comm' i j hij := by + change j+1=i at hij + subst i + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + simp only [directSumComplex, ChainComplex.of_d, ModuleCat.hom_comp, + ModuleCat.hom_ofHom] + change DirectSum.lmap (fun r => ((S r).d (j+1) j).hom) + (DirectSum.lof D ℕ (fun s => (S s).X (j+1)) r v) = + DirectSum.lof D ℕ (fun s => (S s).X j) r (((S r).d (j+1) j).hom v) + exact DirectSum.lmap_lof _ _ _ + +def directSumComplexCocone (S : ℕ → ChainComplex (ModuleCat.{u} D) ℕ) : + Cocone (Discrete.functor S) where + pt := directSumComplex S + ι := Discrete.natTrans (fun r => directSumComplexInclusion D S r.as) + +/-- The native componentwise chain direct sum is the actual categorical coproduct. -/ +def directSumComplexIsColimit (S : ℕ → ChainComplex (ModuleCat.{u} D) ℕ) : + IsColimit (directSumComplexCocone D S) := by + apply HomologicalComplex.isColimitOfEval + intro n + exact moduleSumIsColimit D (Discrete.functor S ⋙ HomologicalComplex.eval _ _ n) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/DirectSumExactness.lean b/lean/OAI/Algebra/Finitistic/Bar/DirectSumExactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..645523f63d8a1ddfe95fd81e9f5cab004827ab3d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/DirectSumExactness.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Bar.DirectSumCoproduct +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped DirectSum +noncomputable section +namespace DerivedBar +universe u +variable (D : Type u) [Ring D] + (S : ℕ → ChainComplex (ModuleCat.{u} D) ℕ) + +theorem directSumComplex_d (i j : ℕ) : + ((directSumComplex S).d i j).hom = DirectSum.lmap (fun r => ((S r).d i j).hom) := by + by_cases h : j+1=i + · subst i + simp only [directSumComplex, ChainComplex.of_d, ModuleCat.hom_ofHom] + rfl + · have hrel : ¬ (ComplexShape.down ℕ).Rel i j := h + rw [(directSumComplex S).shape i j hrel] + have hf : (fun r => ((S r).d i j).hom) = (fun r => (0 : (S r).X i →ₗ[D] (S r).X j)) := by + funext r + rw [(S r).shape i j hrel, ModuleCat.hom_zero] + rw [hf] + apply LinearMap.ext + intro v + apply DFinsupp.ext + intro r + rfl + +/-- The original componentwise direct sum is exact at a degree whenever every +summand is exact there. This includes the degree-zero boundary. -/ +theorem directSumComplex_exactAt (n : ℕ) (h : ∀ r, (S r).ExactAt n) : + (directSumComplex S).ExactAt n := by + rw [HomologicalComplex.exactAt_iff, ShortComplex.moduleCat_exact_iff_range_eq_ker] + change LinearMap.range (((directSumComplex S).d ((ComplexShape.down ℕ).prev n) n).hom) = + LinearMap.ker (((directSumComplex S).d n ((ComplexShape.down ℕ).next n)).hom) + erw [directSumComplex_d, directSumComplex_d, DirectSum.range_lmap, DirectSum.ker_lmap] + congr 2 + funext r + exact ShortComplex.Exact.moduleCat_range_eq_ker (h r) + +theorem directSumComplex_homology_zero (n : ℕ) (h : ∀ r, IsZero ((S r).homology n)) : + IsZero ((directSumComplex S).homology n) := by + rw [← HomologicalComplex.exactAt_iff_isZero_homology] + exact directSumComplex_exactAt D S n + (fun r => (HomologicalComplex.exactAt_iff_isZero_homology _ _).mpr (h r)) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/ExplicitSignedDifferential.lean b/lean/OAI/Algebra/Finitistic/Bar/ExplicitSignedDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1a948eeeceb401b58e2d04eef6b71255e40f6a1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/ExplicitSignedDifferential.lean @@ -0,0 +1,211 @@ +import OAI.Algebra.Finitistic.Bar.MultibarSigns + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.SquareZero +universe u +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] + [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] +local notation "A" => TrivSqZeroExt D X + +/-- The parity operator is +1 on a D slot and -1 on an X slot. -/ +def slotParity : Module.End k A := baseProjection k D X - idealProjection k D X + +@[simp] theorem slotParity_base (d : D) : slotParity k D X (inl d) = inl d := by + simp [slotParity] + +@[simp] theorem slotParity_ideal (x : X) : slotParity k D X (inr x) = -inr x := by + simp [slotParity] + +/-- Explicit bar faces with a sign change on crossing a D slot and no sign +change on crossing an X slot. This is defined independently of count transport. -/ +def multibarAugmentedDifferential : (n : ℕ) → term k A N (n+1) →ₗ[k] term k A N n + | 0 => ((action k A N).restrictScalars k).comp + (TensorProduct.map (slotParity k D X) LinearMap.id) + | n+1 => (((action k A (term k A N (n+1))).restrictScalars k) - + TensorProduct.map LinearMap.id (multibarAugmentedDifferential n)).comp + (TensorProduct.map (slotParity k D X) LinearMap.id) + +@[simp] theorem multibarAugmentedDifferential_zero (a : A) (v : N) : + multibarAugmentedDifferential k D X N 0 (a ⊗ₜ[k] v) = slotParity k D X a • v := rfl + +theorem multibarAugmentedDifferential_succ (n : ℕ) (a : A) (v : term k A N (n+1)) : + multibarAugmentedDifferential k D X N (n+1) (a ⊗ₜ[k] v) = + slotParity k D X a • v - + slotParity k D X a ⊗ₜ[k] multibarAugmentedDifferential k D X N n v := rfl + +/-- The independent two-sided differential. The first face uses D's right +A-action by projection. All remaining faces use the explicit slot parity recursion. -/ +def multibarTwoSidedDifferential (n : ℕ) : + D ⊗[k] term k A N (n+1) →ₗ[D] D ⊗[k] term k A N n := + (action k D (D ⊗[k] term k A N n)).comp + (AlgebraTensorModule.lTensor D D + (FreeBaseChange.coefficient (fstHom k D X) (term k A N n))) - + AlgebraTensorModule.lTensor D D (multibarAugmentedDifferential k D X N n) + +/-- Literal endpoint-minus-tail formula; no signed assembly occurs in the definition. -/ +theorem multibarTwoSidedDifferential_tmul (n : ℕ) (d : D) (v : term k A N (n+1)) : + multibarTwoSidedDifferential k D X N n (d ⊗ₜ[k] v) = + d • FreeBaseChange.coefficient (fstHom k D X) (term k A N n) v - + d ⊗ₜ[k] multibarAugmentedDifferential k D X N n v := rfl + + +/-- A zero-length internal D block has no multiplication face: X squared is zero. +The displayed surviving term consists only of the later blocks' faces. -/ +theorem multibarAugmented_empty_block (n : ℕ) (x y : X) (v : term k A N n) : + multibarAugmentedDifferential k D X N (n+1) + ((inr x : A) ⊗ₜ[k] ((inr y : A) ⊗ₜ[k] v)) = + (inr x : A) ⊗ₜ[k] multibarAugmentedDifferential k D X N n + ((inr y : A) ⊗ₜ[k] v) := by + rw [multibarAugmentedDifferential_succ, slotParity_ideal] + have ha : (-inr x : A) • ((inr y : A) ⊗ₜ[k] v) = 0 := by + change ((-inr x : A) * inr y) ⊗ₜ[k] v = 0 + simp only [neg_mul, inr_mul_inr, neg_zero, TensorProduct.zero_tmul] + rw [ha, zero_sub, TensorProduct.neg_tmul, neg_neg] + +/-- At the inflated module endpoint, an X action vanishes. -/ +theorem multibarAugmented_ideal_endpoint + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = (0 : N)) + (x : X) (v : N) : + multibarAugmentedDifferential k D X N 0 ((inr x : A) ⊗ₜ[k] v) = 0 := by + rw [multibarAugmentedDifferential_zero, slotParity_ideal, _root_.neg_smul, hN, neg_zero] + +omit [IsScalarTower k A N] in +/-- Rescaling commutes with the D-action on each word. -/ +theorem signedProjection_base_action_word {n r : ℕ} {v : term k A N n} + (hv : Word k D X N n r v) (d : D) : + signedProjection k D X N n r ((inl d : A) • v) = + (inl d : A) • signedProjection k D X N n r v := by + cases hv with + | nil v => rfl + | @base n r v b hv => + rw [TensorProduct.smul_tmul', smul_eq_mul, inl_mul_inl, + signedProjection_base, signedProjection_base] + have ha : (inl d : A) • ((inl b : A) ⊗ₜ[k] signedProjection k D X N n r v) = + (inl (d*b) : A) ⊗ₜ[k] signedProjection k D X N n r v := by + change ((inl d : A) * inl b) ⊗ₜ[k] _ = _ + rw [inl_mul_inl] + rw [smul_comm (inl d : A) ((-1 : k)^r), ha] + | @ideal n r v x hv => + rw [TensorProduct.smul_tmul', smul_eq_mul, inl_mul_inr, + signedProjection_ideal_succ, signedProjection_ideal_succ, + TensorProduct.smul_tmul', smul_eq_mul, inl_mul_inr] + +omit [IsScalarTower k A N] in +/-- Multiplying a D slot by X removes its r inversions with the remaining X slots. -/ +theorem signedProjection_ideal_action_word + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = (0 : N)) {n r : ℕ} {v : term k A N n} + (hv : Word k D X N n r v) (x : X) : + signedProjection k D X N n (r+1) ((inr x : A) • v) = + (-1 : k)^r • ((inr x : A) • signedProjection k D X N n r v) := by + cases hv with + | nil v => simp [signedProjection, hN] + | @base n r v d hv => + rw [TensorProduct.smul_tmul', smul_eq_mul, inr_mul_inl, + signedProjection_ideal_succ, signedProjection_base, + smul_comm (inr x : A) ((-1 : k)^r), smul_smul, ← mul_pow] + simp only [neg_one_mul, neg_neg, one_pow, one_smul, + TensorProduct.smul_tmul', smul_eq_mul, inr_mul_inl] + | @ideal n r v y hv => + rw [TensorProduct.smul_tmul', smul_eq_mul, inr_mul_inr, TensorProduct.zero_tmul, + map_zero, signedProjection_ideal_succ, TensorProduct.smul_tmul', smul_eq_mul, + inr_mul_inr, TensorProduct.zero_tmul, smul_zero] + +/-- Exact sign identity between the literal augmented faces and the ordinary bar +on every homogeneous word. The differential was defined independently above. -/ +theorem multibarAugmented_sign_word + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = (0 : N)) (n r : ℕ) (v : term k A N (n+1)) + (hv : Word k D X N (n+1) r v) : + multibarAugmentedDifferential k D X N n (signedProjection k D X N (n+1) r v) = + (-1 : k)^r • signedProjection k D X N n r (differential k A N n v) := by + induction n generalizing r with + | zero => + cases hv with + | base d hv => + cases hv + simp [signedProjection, multibarAugmentedDifferential, + slotParity_base, differential] + | ideal x hv => + cases hv + simp [signedProjection, multibarAugmentedDifferential, + slotParity_ideal, differential, hN] + | succ n ih => + cases hv with + | @base m r v d hv => + rw [signedProjection_base, map_smul, multibarAugmentedDifferential_succ, + slotParity_base, ih r v hv, differential_succ_tmul, map_sub, + signedProjection_base_action_word k D X N hv d, signedProjection_base, + TensorProduct.tmul_smul] + | @ideal m r v x hv => + rw [signedProjection_ideal_succ, multibarAugmentedDifferential_succ, + slotParity_ideal, ih r v hv, differential_succ_tmul, map_sub, + signedProjection_ideal_action_word k D X N hN hv x, signedProjection_ideal_succ] + simp only [TensorProduct.neg_tmul, TensorProduct.tmul_smul, smul_sub, smul_smul] + rw [← pow_add, show r+1+r=2*r+1 by omega, pow_add, pow_mul] + simp [pow_succ] + exact _root_.neg_smul (inr x : A) (signedProjection k D X N (n+1) r v) + + +omit [Module A N] [IsScalarTower k A N] in +/-- The leading endpoint has the same prescribed rescaling. -/ +theorem coefficient_signed_word (n r : ℕ) (v : term k A N (n+1)) + (hv : Word k D X N (n+1) r v) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N n) + (signedProjection k D X N (n+1) r v) = + (-1 : k)^r • twoSidedSignedProjection k D X N n r + (FreeBaseChange.coefficient (fstHom k D X) (term k A N n) v) := by + cases hv with + | base d hv => + rw [signedProjection_base, map_smul, FreeBaseChange.coefficient_tmul, + FreeBaseChange.coefficient_tmul] + rfl + | ideal x hv => + rw [signedProjection_ideal_succ, FreeBaseChange.coefficient_tmul, + FreeBaseChange.coefficient_tmul] + simp + +/-- Equality of the independently defined two-sided faces and the shifted signed +ordinary bar differential, on every homogeneous pure tensor. -/ +theorem multibarTwoSided_sign_word + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = (0 : N)) + (n r : ℕ) (d : D) (v : term k A N (n+1)) + (hv : Word k D X N (n+1) r v) : + multibarTwoSidedDifferential k D X N n + (twoSidedSignedProjection k D X N (n+1) r (d ⊗ₜ[k] v)) = + (-1 : k)^r • twoSidedSignedProjection k D X N n r + (twoSidedDifferential k A D N (fstHom k D X) n (d ⊗ₜ[k] v)) := by + change multibarTwoSidedDifferential k D X N n + (d ⊗ₜ[k] signedProjection k D X N (n+1) r v) = _ + rw [multibarTwoSidedDifferential_tmul, coefficient_signed_word k D X N n r v hv, + multibarAugmented_sign_word k D X N hN n r v hv, twoSidedDifferential_tmul, + map_sub, map_smul, smul_sub, TensorProduct.tmul_smul, + smul_comm d ((-1 : k)^r)] + rfl + +/-- The sign comparison extends to the whole count submodule by linearity. -/ +theorem multibarTwoSided_sign + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = (0 : N)) + (n r : ℕ) {z : D ⊗[k] term k A N (n+1)} + (hz : z ∈ twoSidedWeight k D X N (n+1) r) : + multibarTwoSidedDifferential k D X N n (twoSidedSignedProjection k D X N (n+1) r z) = + (-1 : k)^r • twoSidedSignedProjection k D X N n r + (twoSidedDifferential k A D N (fstHom k D X) n z) := by + have h : twoSidedWeight k D X N (n+1) r ≤ + ((multibarTwoSidedDifferential k D X N n).comp + (twoSidedSignedProjection k D X N (n+1) r) - + (-1 : k)^r • (twoSidedSignedProjection k D X N n r).comp + (twoSidedDifferential k A D N (fstHom k D X) n)).ker := by + apply Submodule.span_le.mpr + rintro z ⟨d,v,hv,rfl⟩ + exact sub_eq_zero.mpr (multibarTwoSided_sign_word k D X N hN n r d v hv) + exact sub_eq_zero.mp (h hz) +end DerivedBar.SquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/ExtensionColimits.lean b/lean/OAI/Algebra/Finitistic/Bar/ExtensionColimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d095993d56801c3818a80d4f1614f294d25e095 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/ExtensionColimits.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Bar.StrictSupportExtension +import Mathlib.Algebra.Homology.HomologicalComplexLimits + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace DerivedBar +universe u v w w' z z' +variable {C : Type u} [Category.{v} C] [HasZeroMorphisms C] [HasZeroObject C] + {ι : Type w} {ι' : Type w'} {c : ComplexShape ι} {c' : ComplexShape ι'} + (e : c.Embedding c') + +/-- Evaluation of extension at an index in its image is the original evaluation, +naturally on all complexes and chain maps. -/ +def extensionEvalIso (i : ι) (j : ι') (h : e.f i=j) : + e.extendFunctor C ⋙ HomologicalComplex.eval C c' j ≅ HomologicalComplex.eval C c i := + NatIso.ofComponents (fun K => K.extendXIso e h) (by + intro K L f + change (HomologicalComplex.extendMap f e).f j ≫ (L.extendXIso e h).hom = + (K.extendXIso e h).hom ≫ f.f i + rw [HomologicalComplex.extendMap_f f e h] + simp only [Category.assoc, Iso.inv_hom_id, Category.comp_id]) + +/-- Extension by zero preserves the actual colimit, proved degreewise including +the zero degrees. In particular it preserves the count coproduct. -/ +theorem extensionPreservesColimit {J : Type z} [Category.{z'} J] [HasColimitsOfShape J C] + (F : J ⥤ HomologicalComplex C c) : PreservesColimit F (e.extendFunctor C) := by + classical + apply preservesColimit_of_preserves_colimit_cocone (colimit.isColimit F) + apply HomologicalComplex.isColimitOfEval + intro j + by_cases hj : ∃ i, e.f i=j + · let i := hj.choose + have hi : e.f i=j := hj.choose_spec + letI : PreservesColimit F (e.extendFunctor C ⋙ HomologicalComplex.eval C c' j) := + preservesColimit_of_natIso F (extensionEvalIso e i j hi).symm + exact isColimitOfPreserves (e.extendFunctor C ⋙ HomologicalComplex.eval C c' j) (colimit.isColimit F) + · refine { desc := fun t => 0, fac := ?_, uniq := ?_ } + · intro t obj + exact ((F.obj obj).isZero_extend_X e j (not_exists.mp hj)).eq_of_src _ _ + · intro t m hm + exact ((colimit F).isZero_extend_X e j (not_exists.mp hj)).eq_of_src _ _ +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/FiniteBarResolution.lean b/lean/OAI/Algebra/Finitistic/Bar/FiniteBarResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..7080bff2d846d3b6f8716b8a9d33552c85ba1569 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/FiniteBarResolution.lean @@ -0,0 +1,38 @@ +import OAI.Algebra.Finitistic.Bar.Bar +import Mathlib.LinearAlgebra.FiniteDimensional.Defs +import Mathlib.RingTheory.Finiteness.Basic +import Mathlib.RingTheory.TensorProduct.Finite + +namespace OAI +noncomputable section +open scoped TensorProduct +open CategoryTheory +namespace DerivedBar +universe u +variable (k A N : Type u) [Field k] [Ring A] [Algebra k A] + [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + [FiniteDimensional k A] [FiniteDimensional k N] + +/-- Every absolute bar word remains finite dimensional over the base field. -/ +instance term_finiteDimensional : (n : ℕ) → FiniteDimensional k (term k A N n) + | 0 => inferInstanceAs (FiniteDimensional k N) + | n+1 => by + let := term_finiteDimensional n + exact inferInstanceAs (FiniteDimensional k (A ⊗[k] term k A N n)) + +instance term_finite (n : ℕ) : Module.Finite A (term k A N n) := + Module.Finite.of_restrictScalars_finite k A (term k A N n) + +/-- The actual bar projective resolution has finitely generated free terms. -/ +theorem projectiveResolution_finite (n : ℕ) : + Module.Finite A ((projectiveResolution k A N).complex.X n) := + term_finite k A N (n+1) +omit [FiniteDimensional k A] [FiniteDimensional k N] in +theorem projectiveResolution_free (n : ℕ) : + Module.Free A ((projectiveResolution k A N).complex.X n) := + term_free k A N n +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/FiniteSumSupport.lean b/lean/OAI/Algebra/Finitistic/Bar/FiniteSumSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f28adf01ecd0c72c9fb2fc41d359c3d28a1290e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/FiniteSumSupport.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveTotalDifferential + +namespace OAI +open CategoryTheory CategoryTheory.Limits +open scoped DirectSum +noncomputable section +namespace DerivedBar.RecursiveTotal +universe u +variable {D : Type u} [Ring D] +variable {I : Type} [Finite I] [DecidableEq I] (V : I → ModuleCat.{u} D) + (P : I → Prop) [DecidablePred P] + +/-- Omitting zero summands is an isomorphism of ordinary direct sums. -/ +def supportIso (hzero : ∀ i, ¬P i → IsZero (V i)) : + ModuleCat.of D (⨁ i, V i) ≅ ModuleCat.of D (⨁ i : {i // P i}, V i.val) where + hom := ModuleCat.ofHom (DirectSum.toModule D _ _ (fun i => + if h : P i then DirectSum.lof D {i // P i} (fun i => V i.val) ⟨i,h⟩ else 0)) + inv := ModuleCat.ofHom (DirectSum.toModule D _ _ + (fun i => DirectSum.lof D I (fun i => V i) i.val)) + hom_inv_id := by + apply ModuleCat.hom_ext + apply DirectSum.linearMap_ext + intro i + apply LinearMap.ext + intro v + by_cases h : P i + · simp only [ModuleCat.hom_comp, ModuleCat.hom_ofHom, + LinearMap.comp_apply, DirectSum.toModule_lof, dite_eq_left h, + ModuleCat.hom_id, LinearMap.id_apply] + · have hz : (𝟙 (V i)) = 0 := (hzero i h).eq_of_src _ _ + have hv : v=0 := congrArg (fun f : V i ⟶ V i => f.hom v) hz + subst v + simp + inv_hom_id := by + apply ModuleCat.hom_ext + apply DirectSum.linearMap_ext + intro i + apply LinearMap.ext + intro v + simp only [ModuleCat.hom_comp, ModuleCat.hom_ofHom, + LinearMap.comp_apply, DirectSum.toModule_lof, dite_eq_left i.property, + ModuleCat.hom_id, LinearMap.id_apply] +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/FlatSupportedAssembly.lean b/lean/OAI/Algebra/Finitistic/Bar/FlatSupportedAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..684c9d2c4aea7766cd29acc39a6f12302cb92e08 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/FlatSupportedAssembly.lean @@ -0,0 +1,87 @@ +import OAI.Algebra.Finitistic.Bar.LeadingSupportedComparison +import OAI.Algebra.Finitistic.Bar.IndexedPatternEmbedding + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance (r n : ℕ) : DecidableEq (Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +def flatEmbedding (r n : ℕ) : flat (leadingBarSequence k D X r) Z (r+1) n ⟶ + ModuleCat.of D (D ⊗[k] term k A N (r+n)) := + assemble (leadingBarSequence k D X r) Z (r+1) n ≫ + eqToHom (congrArg (fun W => W.X n) (leadingIter_total k D X N r)) ≫ + leadingTotalEmbedding k D X N r n + +@[reassoc] theorem flatEmbedding_lof (r n : ℕ) (t : Index (r+1) n) : + lof (leadingBarSequence k D X r) Z (r+1) n t ≫ flatEmbedding k D X N r n = + inclusion (leadingBarSequence k D X r) Z (r+1) n t ≫ + eqToHom (congrArg (fun W => W.X n) (leadingIter_total k D X N r)) ≫ + leadingTotalEmbedding k D X N r n := by + rw [flatEmbedding, lof_assemble_assoc] + +theorem moduleSummandIso_supported (r n : ℕ) + (t : {t : Index (r+1) n // inputDegree (r+1) t=0}) + (ht : Multibar.Indexed.tensor k D X N (moduleShapeEquiv r n t)= + patternTerm k D X N (leadingPattern r n t.val)) : + moduleSummandIso k D X N r n t = supportedLeadingIso k D X N r n t.val t.property ≪≫ + eqToIso (congrArg (fun V : ModuleCat k => ModuleCat.of D (D ⊗[k] V)) ht.symm) := by + rw [supportedLeadingIso_eq] + rfl + +theorem flatEmbedding_supported (r n : ℕ) + (t : {t : Index (r+1) n // inputDegree (r+1) t=0}) : + lof (leadingBarSequence k D X r) Z (r+1) n t.val ≫ flatEmbedding k D X N r n = + (moduleSummandIso k D X N r n t).hom ≫ + ModuleCat.ofHom (Multibar.Indexed.outerInclusion k D X N (moduleShapeEquiv r n t)) := by + rw [flatEmbedding_lof] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + let p := leadingPattern r n t.val + let s := moduleShapeEquiv r n t + have hp : Multibar.Indexed.toList s=p := moduleShape_toList r n t + have ht : Multibar.Indexed.tensor k D X N s=patternTerm k D X N p := by + rw [Multibar.Indexed.tensor_toList, hp] + have hl : p.length=r+n := supportedLeading_length r n t.val t.property + have hs := outerInclusion_pattern k D X N s p hp ht hl + ((moduleSummandIso k D X N r n t).hom.hom v) + have hc : (eqToHom (congrArg (fun V : ModuleCat k => ModuleCat.of D (D ⊗[k] V)) ht)).hom + ((moduleSummandIso k D X N r n t).hom.hom v) = + (supportedLeadingIso k D X N r n t.val t.property).hom.hom v := by + rw [moduleSummandIso_supported k D X N r n t ht] + simp only [Iso.trans_hom, eqToIso.hom, ModuleCat.hom_comp, LinearMap.comp_apply] + have he := congrArg (fun f => f.hom + ((supportedLeadingIso k D X N r n t.val t.property).hom.hom v)) + (eqToHom_trans (congrArg (fun V : ModuleCat k => ModuleCat.of D (D ⊗[k] V)) ht.symm) + (congrArg (fun V : ModuleCat k => ModuleCat.of D (D ⊗[k] V)) ht)) + simpa only [ModuleCat.hom_comp, LinearMap.comp_apply, eqToHom_refl, + ModuleCat.hom_id, LinearMap.id_apply] using he + rw [hc] at hs + change _ = Multibar.Indexed.outerInclusion k D X N s ((moduleSummandIso k D X N r n t).hom.hom v) + rw [hs] + rcases t with ⟨⟨⟨⟨i,q⟩,hq⟩,t⟩,h⟩ + exact leadingTotalEmbedding_supported k D X N r n i q hq t h v +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/GlobalIndexedComparison.lean b/lean/OAI/Algebra/Finitistic/Bar/GlobalIndexedComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..50040d96b7c7940e4bf24918a3bab0e3ce768c90 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/GlobalIndexedComparison.lean @@ -0,0 +1,103 @@ +import OAI.Algebra.Finitistic.Bar.IndexedAssemblyComparison +import OAI.Algebra.Finitistic.Bar.SignedBlockExplicit + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance globalIndexedComparisonIndexDecidableEq (r n : ℕ) : + DecidableEq (Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +@[reassoc] theorem eqToHom_chain_d {Y W : ChainComplex (ModuleCat.{u} D) ℕ} + (h : Y=W) (i j : ℕ) : + Y.d i j ≫ eqToHom (congrArg (fun T => T.X j) h) = + eqToHom (congrArg (fun T => T.X i) h) ≫ W.d i j := by + subst W + simp + +/-- The full leading comparison transferred through the actual flattening. -/ +theorem flatEmbedding_differential (r n : ℕ) : + flatEmbedding k D X N r (n+1) ≫ + ModuleCat.ofHom (SquareZero.multibarTwoSidedDifferential k D X N (r+n)) = + RecursiveTotal.differential (leadingBarSequence k D X r) Z (r+1) n ≫ flatEmbedding k D X N r n := by + simp only [flatEmbedding, Category.assoc, leadingTotalEmbedding_differential] + rw [← eqToHom_chain_d_assoc (h := leadingIter_total k D X N r)] + rw [← Category.assoc, ← differential_assemble, Category.assoc] + +private theorem conjugated_differential_comp {C : Type*} [Category C] + {S₁ S₀ T₁ T₀ V₁ V₀ : C} (a : T₁ ⟶ S₁) (b : S₀ ⟶ T₀) + (d : S₁ ⟶ S₀) (δ : V₁ ⟶ V₀) (s₁ : T₁ ⟶ V₁) (s₀ : T₀ ⟶ V₀) + (f₁ : S₁ ⟶ V₁) (f₀ : S₀ ⟶ V₀) + (h₀ : f₀ = b ≫ s₀) (h₁ : a ≫ f₁ = s₁) (hd : f₁ ≫ δ = d ≫ f₀) : + (a ≫ d ≫ b) ≫ s₀ = s₁ ≫ δ := by + rw [Category.assoc, Category.assoc, ← h₀, ← hd, ← Category.assoc, h₁] + +/-- The original Shape differential intertwines the independently defined literal +parity faces through the original tensor-block assembly. -/ +theorem indexedDifferential_assembly (r n : ℕ) : + indexedDifferential k D X N r n ≫ shapeAssembly k D X N r n = + shapeAssembly k D X N r (n+1) ≫ + ModuleCat.ofHom (SquareZero.multibarTwoSidedDifferential k D X N (r+n)) := by + simp only [indexedDifferential, flatLeadingMultibar, flatComplex, ChainComplex.of_d] + exact conjugated_differential_comp _ _ _ _ _ _ _ _ + (flatEmbedding_coordinates k D X N r n) + (moduleFlatCoordinates_inv_flatEmbedding k D X N r (n+1)) + (flatEmbedding_differential k D X N r n) + +theorem inflated_ideal_zero (x : X) (v : N) : (inr x : A) • v=0 := by + change (0:D) • v=0 + exact zero_smul D v + +/-- The global comparison identifies the independently defined recursive differential, +Shape coordinates, signed block differential, and both sign identities. -/ +theorem globalIndexedComparison (r n : ℕ) : + (indexedDifferential k D X N r n).hom = + (-1:k)^r • Multibar.Indexed.blockDifferential k D X N + (fun x v => inflated_ideal_zero D X N x v) (r+n) r := by + apply LinearMap.ext + intro v + apply shapeAssembly_injective k D X N r n + have hd := congrArg (fun f => f.hom v) (indexedDifferential_assembly k D X N r n) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom] at hd + rw [hd] + rw [Multibar.Indexed.blockDifferential_eq_explicit] + change SquareZero.multibarTwoSidedDifferential k D X N (r+n) + (Multibar.Indexed.decomposition k D X N (r+(n+1)) r v).val = + (Multibar.Indexed.decomposition k D X N (r+n) r + ((-1:k)^r • ((Multibar.Indexed.decomposition k D X N (r+n) r).symm + ((-1:k)^r • SquareZero.multibarCountDifferential k D X N + (fun x v => inflated_ideal_zero D X N x v) (r+n) r + (Multibar.Indexed.decomposition k D X N (r+(n+1)) r v))))).val + have hs := ((Multibar.Indexed.decomposition k D X N (r+n) r).toLinearMap.restrictScalars k).map_smul + ((-1:k)^r) ((Multibar.Indexed.decomposition k D X N (r+n) r).symm + ((-1:k)^r • SquareZero.multibarCountDifferential k D X N + (fun x v => inflated_ideal_zero D X N x v) (r+n) r + (Multibar.Indexed.decomposition k D X N (r+(n+1)) r v))) + change Multibar.Indexed.decomposition k D X N (r+n) r (_ • _) = + _ • Multibar.Indexed.decomposition k D X N (r+n) r _ at hs + rw [hs, LinearEquiv.apply_symm_apply, smul_smul, ← mul_pow] + simp only [neg_one_mul, neg_neg, one_pow, one_smul] + rfl +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IndexedAssemblyComparison.lean b/lean/OAI/Algebra/Finitistic/Bar/IndexedAssemblyComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..758ada2cb1463034487ef5255906ede3a1690d42 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IndexedAssemblyComparison.lean @@ -0,0 +1,101 @@ +import OAI.Algebra.Finitistic.Bar.FlatSupportedAssembly +import OAI.Algebra.Finitistic.Bar.BlockCoordinateGenerators + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal + +private theorem assembly_eq {C : Type*} [Category C] {A B V W U T : C} + {l : A ⟶ B} {e : B ⟶ V} {f : V ⟶ W} {i : A ⟶ U} + {s : U ⟶ V} {a : U ⟶ T} {b : T ⟶ W} {t : A ⟶ W} {u : B ⟶ W} + (h₁ : l ≫ e = i ≫ s) (h₂ : s ≫ f = a ≫ b) + (h₃ : i ≫ a ≫ b = t) (h₄ : l ≫ u = t) : l ≫ e ≫ f = l ≫ u := by + rw [← Category.assoc, h₁, Category.assoc, h₂, h₃, h₄] + +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance indexedAssemblyComparisonIndexDecidableEq (r n : ℕ) : + DecidableEq (Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +local instance indexedAssemblyComparisonShapeDecidableEq (n r : ℕ) : + DecidableEq (Multibar.Indexed.Shape n r) := Classical.decEq _ + +def shapeAssembly (r n : ℕ) : indexedModule k D X N r n ⟶ + ModuleCat.of D (D ⊗[k] term k A N (r+n)) := + ModuleCat.ofHom ((SquareZero.twoSidedWeight k D X N (r+n) r).subtype.comp + (Multibar.Indexed.decomposition k D X N (r+n) r).toLinearMap) + +theorem shapeAssembly_injective (r n : ℕ) : Function.Injective (shapeAssembly k D X N r n).hom := by + intro v w h + exact (Multibar.Indexed.decomposition k D X N (r+n) r).injective (Subtype.ext h) + +@[reassoc] theorem shapeAssembly_lof (r n : ℕ) (p : Multibar.Indexed.Shape (r+n) r) : + ModuleCat.ofHom (DirectSum.lof D _ (Multibar.Indexed.outerTensor k D X N) p) ≫ + shapeAssembly k D X N r n = ModuleCat.ofHom (Multibar.Indexed.outerInclusion k D X N p) := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + change (Multibar.Indexed.assemble k D X N (r+n) r + (DirectSum.lof D _ _ p v)).val = _ + simp only [Multibar.Indexed.assemble, DirectSum.toModule_lof, LinearMap.codRestrict_apply] + rfl + +theorem outerInclusion_eqToHom {n r : ℕ} (p q : Multibar.Indexed.Shape n r) (h : p=q) : + eqToHom (congrArg (fun t => ModuleCat.of D (Multibar.Indexed.outerTensor k D X N t)) h) ≫ + ModuleCat.ofHom (Multibar.Indexed.outerInclusion k D X N q) = + ModuleCat.ofHom (Multibar.Indexed.outerInclusion k D X N p) := by + subst q + simp + +theorem reindexedModuleSummand_assembly (r n : ℕ) (p : Multibar.Indexed.Shape (r+n) r) : + (reindexedModuleSummandIso k D X N r n p).inv ≫ + (moduleSummandIso k D X N r n ((moduleShapeEquiv r n).symm p)).hom ≫ + ModuleCat.ofHom (Multibar.Indexed.outerInclusion k D X N + (moduleShapeEquiv r n ((moduleShapeEquiv r n).symm p))) = + ModuleCat.ofHom (Multibar.Indexed.outerInclusion k D X N p) := by + simp only [reindexedModuleSummandIso, Iso.trans_inv, Category.assoc, Iso.inv_hom_id_assoc] + exact outerInclusion_eqToHom k D X N _ _ ((moduleShapeEquiv r n).apply_symm_apply p).symm + +/-- The new embedding is exactly the old Shape assembly after the old inverse +coordinates. No new differential or replacement coordinate system is used. -/ +theorem moduleFlatCoordinates_inv_flatEmbedding (r n : ℕ) : + (moduleFlatCoordinates k D X N r n).inv ≫ flatEmbedding k D X N r n = + shapeAssembly k D X N r n := by + apply ModuleCat.hom_ext + apply DirectSum.linearMap_ext + intro p + change (ModuleCat.ofHom (DirectSum.lof D _ (Multibar.Indexed.outerTensor k D X N) p) ≫ + (moduleFlatCoordinates k D X N r n).inv ≫ flatEmbedding k D X N r n).hom = + (ModuleCat.ofHom (DirectSum.lof D _ (Multibar.Indexed.outerTensor k D X N) p) ≫ + shapeAssembly k D X N r n).hom + apply congrArg ModuleCat.Hom.hom + exact assembly_eq (moduleFlatCoordinates_inv_lof k D X N r n p) + (flatEmbedding_supported k D X N r n ((moduleShapeEquiv r n).symm p)) + (reindexedModuleSummand_assembly k D X N r n p) (shapeAssembly_lof k D X N r n p) + +theorem flatEmbedding_coordinates (r n : ℕ) : flatEmbedding k D X N r n = + (moduleFlatCoordinates k D X N r n).hom ≫ shapeAssembly k D X N r n := by + apply (cancel_epi (moduleFlatCoordinates k D X N r n).inv).mp + rw [moduleFlatCoordinates_inv_flatEmbedding, Iso.inv_hom_id_assoc] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IndexedMultibarTotal.lean b/lean/OAI/Algebra/Finitistic/Bar/IndexedMultibarTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..8336bc95e40cca7b90f8c468be2524c7065c4edc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IndexedMultibarTotal.lean @@ -0,0 +1,87 @@ +import OAI.Algebra.Finitistic.Bar.ModuleMultibarCoordinates + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive TensorProduct +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.RecursiveTotal +open DerivedBar.Multibar +universe u +variable (k D X : 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] +local instance (N : ModuleCat.{u} D) : Module k N := BimoduleTensor.scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat.{u} D) +local notation "Z" => (Functor.obj (ChainComplex.single₀ (ModuleCat D)) N) +local notation "B" => leadingBarSequence k D X +local notation "F" => flatLeadingMultibar k D X Z + +abbrev indexedModule (r n : ℕ) : ModuleCat.{u} D := + ModuleCat.of D (⨁ p : Multibar.Indexed.Shape (r+n) r, + Multibar.Indexed.outerTensor k D X N p) + +/-- The independently recursive multibar faces in the exact Shape coordinates. +This uses the horizontal/vertical differential of RecursiveTotal, not the count +complex differential. -/ +def indexedDifferential (r n : ℕ) : indexedModule k D X N r (n+1) ⟶ indexedModule k D X N r n := + (moduleFlatCoordinates k D X N r (n+1)).inv ≫ + (F r).d (n+1) n ≫ (moduleFlatCoordinates k D X N r n).hom + +theorem indexedDifferential_sq (r n : ℕ) : + indexedDifferential k D X N r (n+1) ≫ indexedDifferential k D X N r n = 0 := by + simp only [indexedDifferential, Category.assoc, Iso.hom_inv_id_assoc] + rw [← Category.assoc ((F r).d (n+2) (n+1)), HomologicalComplex.d_comp_d, + zero_comp, comp_zero] + +/-- Exact tensor-block coordinates, with the unshifted multibar total degree n. -/ +def indexedMultibar (r : ℕ) : ChainComplex (ModuleCat.{u} D) ℕ := + ChainComplex.of (indexedModule k D X N r) (indexedDifferential k D X N r) + (indexedDifferential_sq k D X N r) + +/-- Chain isomorphism from the exact tensor-block direct sum to the recursive flat model. -/ +def indexedFlatIso (r : ℕ) : indexedMultibar k D X N r ≅ F r := + HomologicalComplex.Hom.isoOfComponents + (fun n => (moduleFlatCoordinates k D X N r n).symm) + (by + intro i j hij + change j+1=i at hij + subst i + change (moduleFlatCoordinates k D X N r (j+1)).inv ≫ (F r).d (j+1) j = + (indexedMultibar k D X N r).d (j+1) j ≫ (moduleFlatCoordinates k D X N r j).inv + simp only [indexedMultibar, ChainComplex.of_d, indexedDifferential, + Category.assoc, Iso.hom_inv_id, Category.comp_id]) + +/-- Actual chain isomorphism flattening the recursive leading total into the +same Shape-indexed block tensors as the square-zero count decomposition. -/ +def indexedLeadingIso (r : ℕ) : indexedMultibar k D X N r ≅ + barTotal k D (explicitMultibar k D X r Z) := + indexedFlatIso k D X N r ≪≫ flatLeadingMultibarIso k D X Z r + +/-- Exact signed differential formula on a recursive generator, now in the +literal Shape-indexed block coordinates. The vertical face includes (-1)^i. -/ +theorem indexedDifferential_on_generator (r n i q : ℕ) (h : i+q=n+1) (t : Index r q) : + lof (B r) Z (r+1) (n+1) ⟨⟨⟨i,q⟩,h⟩,t⟩ ≫ + (moduleFlatCoordinates k D X N r (n+1)).hom ≫ indexedDifferential k D X N r n = + (horizontal (B r) Z r n i q h t + + vertical (B r) Z r n i q h t (differential (B r) Z r)) ≫ + (moduleFlatCoordinates k D X N r n).hom := by + dsimp only [indexedDifferential] + erw [Iso.hom_inv_id_assoc] + simp only [flatLeadingMultibar, flatComplex, ChainComplex.of_d] + change lof (B r) Z (r+1) (n+1) _ ≫ differential (B r) Z (r+1) n ≫ _ = _ + rw [lof_differential_succ_assoc] + rfl + +/-- Genuine derived tensor iteration represented by the exact indexed block +complex. No count splitting or projective-dimension statement is assumed. -/ +def derivedIterateIndexedIso (r : ℕ) : + (derivedTensorIterate k D X r).obj ((chainQ D).obj Z) ≅ + (chainQ D).obj (indexedMultibar k D X N r) := + derivedIterateFlatIso k D X Z r ≪≫ (chainQ D).mapIso (indexedFlatIso k D X N r).symm +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IndexedPatternEmbedding.lean b/lean/OAI/Algebra/Finitistic/Bar/IndexedPatternEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..49f19a2165c758ab14f7c216747568ef60f1900c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IndexedPatternEmbedding.lean @@ -0,0 +1,122 @@ +import OAI.Algebra.Finitistic.Bar.SupportedInnerCoordinates +import OAI.Algebra.Finitistic.Bar.LeadingTotalComparison + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance indexedPatternEmbeddingScalarModule (V : ModuleCat.{u} D) : + Module k V := BimoduleTensor.scalarModule k D V +local instance indexedPatternEmbeddingScalarTower (V : ModuleCat.{u} D) : + IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance indexedPatternEmbeddingIndexDecidableEq (r n : ℕ) : + DecidableEq (Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance indexedPatternEmbeddingInflatedModule : Module A N := inflatedModule D X N +local instance indexedPatternEmbeddingInflatedScalarTower : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +theorem eqToHom_tensor_tmul (L : Type u) [AddCommGroup L] [Module k L] + (V W : ModuleCat.{u} k) (h : V=W) (x : L) (v : V) : + (eqToHom (congrArg (fun T : ModuleCat k => ModuleCat.of k (L ⊗[k] T)) h)).hom (x ⊗ₜ[k] v) = + x ⊗ₜ[k] (eqToHom h).hom v := by + subst W + rfl + +theorem eqToHom_outer_tmul (V W : ModuleCat.{u} k) (h : V=W) (d : D) (v : V) : + (eqToHom (congrArg (fun T : ModuleCat k => ModuleCat.of D (D ⊗[k] T)) h)).hom (d ⊗ₜ[k] v) = + d ⊗ₜ[k] (eqToHom h).hom v := by + subst W + rfl + +/-- The old indexed inclusion and old list-pattern embedding agree; transports +come solely from the proved equality of their tensor objects and their degrees. -/ +theorem indexedInclusion_toList {n r : ℕ} (p : Multibar.Indexed.Shape n r) + (v : Multibar.Indexed.tensor k D X N p) : + Multibar.Indexed.inclusion k D X N p v = + termCast k D X N (Multibar.Indexed.length_toList p) + (embed k D X N (Multibar.Indexed.toList p) + ((eqToHom (Multibar.Indexed.tensor_toList k D X N p)).hom v)) := by + induction p with + | nil => rfl + | @base n r p ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + change (inl d : A) ⊗ₜ[k] Multibar.Indexed.inclusion k D X N p v = + termCast k D X N (show (false :: Multibar.Indexed.toList p).length=n+1 by simp) + (embed k D X N (false :: Multibar.Indexed.toList p) + ((eqToHom (congrArg (fun T : ModuleCat k => ModuleCat.of k (D ⊗[k] T)) + (Multibar.Indexed.tensor_toList k D X N p))).hom (d ⊗ₜ[k] v))) + rw [eqToHom_tensor_tmul k D (Multibar.Indexed.tensor k D X N p) + (patternTerm k D X N (Multibar.Indexed.toList p)) + (Multibar.Indexed.tensor_toList k D X N p) d v] + change (inl d : A) ⊗ₜ[k] Multibar.Indexed.inclusion k D X N p v = + termCast k D X N (show (false :: Multibar.Indexed.toList p).length=n+1 by simp) ((inl d : A) ⊗ₜ[k] _) + rw [ih] + exact (termCast_tmul k D X N (Multibar.Indexed.length_toList p) + (by simp) _ _).symm + | add v w hv hw => simp only [map_add, hv, hw] + | @ideal n r p ih => + induction v using TensorProduct.inductionOn with + | tmul x v => + change (inr x : A) ⊗ₜ[k] Multibar.Indexed.inclusion k D X N p v = + termCast k D X N (show (true :: Multibar.Indexed.toList p).length=n+1 by simp) + (embed k D X N (true :: Multibar.Indexed.toList p) + ((eqToHom (congrArg (fun T : ModuleCat k => ModuleCat.of k (X ⊗[k] T)) + (Multibar.Indexed.tensor_toList k D X N p))).hom (x ⊗ₜ[k] v))) + rw [eqToHom_tensor_tmul k X (Multibar.Indexed.tensor k D X N p) + (patternTerm k D X N (Multibar.Indexed.toList p)) + (Multibar.Indexed.tensor_toList k D X N p) x v] + change (inr x : A) ⊗ₜ[k] Multibar.Indexed.inclusion k D X N p v = + termCast k D X N (show (true :: Multibar.Indexed.toList p).length=n+1 by simp) ((inr x : A) ⊗ₜ[k] _) + rw [ih] + exact (termCast_tmul k D X N (Multibar.Indexed.length_toList p) + (by simp) _ _).symm + | add v w hv hw => simp only [map_add, hv, hw] + +theorem outerInclusion_toList {n r : ℕ} (p : Multibar.Indexed.Shape n r) + (v : Multibar.Indexed.outerTensor k D X N p) : + Multibar.Indexed.outerInclusion k D X N p v = + outerCast k D X N (Multibar.Indexed.length_toList p) + (AlgebraTensorModule.lTensor D D (embed k D X N (Multibar.Indexed.toList p)) + ((eqToHom (congrArg (fun T : ModuleCat k => ModuleCat.of D (D ⊗[k] T)) + (Multibar.Indexed.tensor_toList k D X N p))).hom v)) := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [eqToHom_outer_tmul k D (Multibar.Indexed.tensor k D X N p) + (patternTerm k D X N (Multibar.Indexed.toList p)) + (Multibar.Indexed.tensor_toList k D X N p) d v] + change d ⊗ₜ[k] Multibar.Indexed.inclusion k D X N p v = + d ⊗ₜ[k] termCast k D X N _ + (embed k D X N (Multibar.Indexed.toList p) + ((eqToHom (Multibar.Indexed.tensor_toList k D X N p)).hom v)) + rw [indexedInclusion_toList] + | add v w hv hw => simp only [map_add, hv, hw] + +theorem outerInclusion_pattern {n r : ℕ} (s : Multibar.Indexed.Shape n r) + (p : List Bool) (hp : Multibar.Indexed.toList s=p) + (ht : Multibar.Indexed.tensor k D X N s=patternTerm k D X N p) + (hl : p.length=n) (v : Multibar.Indexed.outerTensor k D X N s) : + Multibar.Indexed.outerInclusion k D X N s v = + outerCast k D X N hl (AlgebraTensorModule.lTensor D D (embed k D X N p) + ((eqToHom (congrArg (fun T : ModuleCat k => ModuleCat.of D (D ⊗[k] T)) ht)).hom v)) := by + subst p + exact outerInclusion_toList k D X N s v +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/InflatedParityFaces.lean b/lean/OAI/Algebra/Finitistic/Bar/InflatedParityFaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6df2d0858cabf29c8399ba6eec9f6a5641ba4d4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/InflatedParityFaces.lean @@ -0,0 +1,186 @@ +import OAI.Algebra.Finitistic.Bar.ExplicitSignedDifferential +import OAI.Algebra.Finitistic.Bimodule.BimoduleBar + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.ParityBridge +universe u +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] [Module D N] [IsScalarTower k D N] +local notation "A" => TrivSqZeroExt D X + +/-- The original D module is inflated by the actual projection, without a new action hypothesis. -/ +@[instance_reducible] def inflatedModule : Module A N := Module.compHom N + { toFun := fun a => a.fst + map_one' := rfl + map_mul' := fun _ _ => rfl + map_zero' := rfl + map_add' := fun _ _ => rfl } +section Compatible +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] +variable (hbase : ∀ (d : D) (v : N), (inl d : TrivSqZeroExt D X) • v = d • v) + +/-- Literal insertion of D slots into square-zero-extension slots. -/ +def baseEmbed : (n : ℕ) → term k D N n →ₗ[k] term k A N n + | 0 => LinearMap.id + | n+1 => TensorProduct.map (inlAlgHom k D X).toLinearMap (baseEmbed n) + +omit [Module D N] [IsScalarTower k D N] [Module A N] [IsScalarTower k A N] in +@[simp] theorem baseEmbed_tmul (n : ℕ) (d : D) (v : term k D N n) : + baseEmbed k D X N (n+1) (d ⊗ₜ[k] v) = (inl d : A) ⊗ₜ[k] baseEmbed k D X N n v := rfl + +include hbase in +omit [IsScalarTower k D N] [IsScalarTower k A N] in +/-- D-equivariance of insertion, including the inflated module endpoint. -/ +theorem baseEmbed_smul (n : ℕ) (d : D) (v : term k D N n) : + baseEmbed k D X N n (d • v) = (inl d : A) • baseEmbed k D X N n v := by + cases n with + | zero => exact (hbase d v).symm + | succ n => + induction v using TensorProduct.inductionOn with + | tmul b v => + change (inl (d*b) : A) ⊗ₜ[k] baseEmbed k D X N n v = + ((inl d : A)*inl b) ⊗ₜ[k] baseEmbed k D X N n v + rw [inl_mul_inl] + | add v w hv hw => simp only [smul_add, map_add, hv, hw] + +include hbase in +/-- All-D faces in the independently defined parity recursion are exactly +ordinary D-bar faces. This is an equality of actual maps on tensors. -/ +theorem parity_baseEmbed (n : ℕ) (v : term k D N (n+1)) : + SquareZero.multibarAugmentedDifferential k D X N n (baseEmbed k D X N (n+1) v) = + baseEmbed k D X N n (DerivedBar.differential k D N n v) := by + induction n with + | zero => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [baseEmbed_tmul, SquareZero.multibarAugmentedDifferential_zero, + SquareZero.slotParity_base] + exact hbase d v + | add v w hv hw => simp only [map_add, hv, hw] + | succ n ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [baseEmbed_tmul, SquareZero.multibarAugmentedDifferential_succ, + SquareZero.slotParity_base, ih, DerivedBar.differential_succ_tmul, + map_sub, baseEmbed_smul k D X N hbase, baseEmbed_tmul] + | add v w hv hw => simp only [map_add, hv, hw] + +/-- Literal insertion of a leading X and its following D block. -/ +def idealEmbed (n : ℕ) : X ⊗[k] term k D N n →ₗ[k] term k A N (n+1) := + TensorProduct.map ((inrHom D X).restrictScalars k) (baseEmbed k D X N n) + +omit [Module D N] [IsScalarTower k D N] [Module A N] [IsScalarTower k A N] in +@[simp] theorem idealEmbed_tmul (n : ℕ) (x : X) (v : term k D N n) : + idealEmbed k D X N n (x ⊗ₜ[k] v) = (inr x : A) ⊗ₜ[k] baseEmbed k D X N n v := rfl + +omit [Module D N] [IsScalarTower k D N] [Module A N] [IsScalarTower k A N] in +/-- The D action on a leading X is its original left bimodule action. -/ +theorem idealEmbed_base_smul (n : ℕ) (d : D) (v : X ⊗[k] term k D N n) : + idealEmbed k D X N n (d • v) = (inl d : A) • idealEmbed k D X N n v := by + induction v using TensorProduct.inductionOn with + | tmul x v => + change (inr (d • x) : A) ⊗ₜ[k] baseEmbed k D X N n v = + ((inl d : A) * inr x) ⊗ₜ[k] baseEmbed k D X N n v + rw [inl_mul_inr] + | add v w hv hw => simp only [smul_add, map_add, hv, hw] + +omit [Module D N] [IsScalarTower k D N] [Module A N] [IsScalarTower k A N] in +/-- An inner bar beginning with X is annihilated by the square-zero ideal. +This is the boundary fact needed when the following D block has length zero. -/ +theorem idealEmbed_ideal_smul (n : ℕ) (x : X) (v : X ⊗[k] term k D N n) : + (inr x : A) • idealEmbed k D X N n v = 0 := by + induction v using TensorProduct.inductionOn with + | tmul y v => + change ((inr x : A) * inr y) ⊗ₜ[k] baseEmbed k D X N n v = 0 + rw [inr_mul_inr, TensorProduct.zero_tmul] + | add v w hv hw => simp only [map_add, smul_add, hv, hw, add_zero] + +omit [Module D N] [IsScalarTower k D N] [Module A N] [IsScalarTower k A N] in +/-- Multiplying X by the first D entry is precisely the original right +D action used by the two-sided bar collapse map. -/ +theorem ideal_action_baseEmbed (n : ℕ) (x : X) (v : term k D N (n+1)) : + (inr x : A) • baseEmbed k D X N (n+1) v = + idealEmbed k D X N n + (BimoduleTensor.collapse k D X (term k D N n) (x ⊗ₜ[k] v)) := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [baseEmbed_tmul, BimoduleTensor.collapse_tmul, idealEmbed_tmul] + change ((inr x : A) * inl d) ⊗ₜ[k] baseEmbed k D X N n v = + (inr (MulOpposite.op d • x) : A) ⊗ₜ[k] baseEmbed k D X N n v + rw [inr_mul_inl] + | add v w hv hw => simp only [map_add, smul_add, TensorProduct.tmul_add, hv, hw] + +include hbase in +/-- The inner X bar is minus the augmented slot-parity recursion. The leading +D two-sided differential contributes the other minus sign in the full multibar. -/ +theorem parity_idealEmbed (n : ℕ) (v : X ⊗[k] term k D N (n+1)) : + SquareZero.multibarAugmentedDifferential k D X N (n+1) (idealEmbed k D X N (n+1) v) = + -idealEmbed k D X N n (BimoduleTensor.barDifferential k D X N n v) := by + induction v using TensorProduct.inductionOn with + | tmul x v => + rw [idealEmbed_tmul, SquareZero.multibarAugmentedDifferential_succ, + SquareZero.slotParity_ideal, parity_baseEmbed k D X N hbase, + BimoduleTensor.barDifferential_tmul, map_sub, idealEmbed_tmul] + have hneg : (-inr x : A) • baseEmbed k D X N (n+1) v = + -((inr x : A) • baseEmbed k D X N (n+1) v) := + _root_.neg_smul (inr x : A) (baseEmbed k D X N (n+1) v) + rw [hneg, ideal_action_baseEmbed, TensorProduct.neg_tmul, sub_neg_eq_add, neg_sub] + exact add_comm _ _ + | add v w hv hw => simp only [map_add, hv, hw, neg_add] + +omit [Module D N] [IsScalarTower k D N] in +/-- The missing outgoing face at the module end of an empty X bar is zero. -/ +theorem parity_idealEmbed_zero + (hN : ∀ (x : X) (v : N), (inr x : A) • v = 0) (v : X ⊗[k] N) : + SquareZero.multibarAugmentedDifferential k D X N 0 (idealEmbed k D X N 0 v) = 0 := by + induction v using TensorProduct.inductionOn with + | tmul x v => + exact SquareZero.multibarAugmented_ideal_endpoint k D X N + hN x v + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + +end Compatible + +/-- Direct specialization to the original module inflated along A -> D. +The inflation is a local instance for this N, never a blanket action on bar terms. -/ +theorem inflated_parity_idealEmbed (n : ℕ) (v : X ⊗[k] term k D N (n+1)) : + letI : Module A N := inflatedModule D X N + letI : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + SquareZero.multibarAugmentedDifferential k D X N (n+1) (idealEmbed k D X N (n+1) v) = + -idealEmbed k D X N n (BimoduleTensor.barDifferential k D X N n v) := by + let : Module A N := inflatedModule D X N + let : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + exact parity_idealEmbed k D X N (fun _ _ => rfl) n v + +theorem inflated_parity_baseEmbed (n : ℕ) (v : term k D N (n+1)) : + letI : Module A N := inflatedModule D X N + letI : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + SquareZero.multibarAugmentedDifferential k D X N n (baseEmbed k D X N (n+1) v) = + baseEmbed k D X N n (DerivedBar.differential k D N n v) := by + let : Module A N := inflatedModule D X N + let : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + exact parity_baseEmbed k D X N (fun _ _ => rfl) n v + +theorem inflated_parity_idealEmbed_zero (v : X ⊗[k] N) : + letI : Module A N := inflatedModule D X N + letI : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + SquareZero.multibarAugmentedDifferential k D X N 0 (idealEmbed k D X N 0 v) = 0 := by + let : Module A N := inflatedModule D X N + let : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + exact parity_idealEmbed_zero k D X N (fun _ v => zero_smul D v) v +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IntegerCountObject.lean b/lean/OAI/Algebra/Finitistic/Bar/IntegerCountObject.lean new file mode 100644 index 0000000000000000000000000000000000000000..2becdcebbaded506d7d54162ff93648ea4ddb16e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IntegerCountObject.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Bar.DerivedCountShift + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance integerCountScalarModule (V : ModuleCat D) : Module k V := + BimoduleTensor.scalarModule k D V +local instance integerCountScalarTower (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance integerCountIndexDecidableEq (r n : ℕ) : DecidableEq (Index r n) := + Classical.decEq _ +local instance integerCountShapeDecidableEq (n r : ℕ) : + DecidableEq (Multibar.Indexed.Shape n r) := Classical.decEq _ +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance integerCountInflatedModule : Module A N := inflatedModule D X N +local instance integerCountInflatedScalarTower : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +local notation "C" => ModuleCat D +local notation "E" => ComplexShape.embeddingDownNat +local notation "K" => Multibar.Indexed.signedBlockComplex k D X N (inflated_ideal_zero D X N) + +/-- The original r-count object, with exactly the original scalar and inflated actions. -/ +abbrev countObject (r : ℕ) := + (integerQ D).obj (SquareZero.twoSidedWeightComplex k D X N (inflated_ideal_zero D X N) r) + +local instance integerCountHasDerivedCategory : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- The proved genuine shift comparison, with its target named for downstream use. -/ +def countObjectComparison (r : ℕ) : + ((chainToIntegerDerived D).obj + ((derivedTensorIterate k D X r).obj ((chainQ D).obj Z)))⟦(r:ℤ)⟧ ≅ countObject k D X N r := + derivedIterateWeightShiftIso k D X N r +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IntegerCountRestriction.lean b/lean/OAI/Algebra/Finitistic/Bar/IntegerCountRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..998b0052dacec2f4660c264a8b4037c28f3f3598 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IntegerCountRestriction.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.Finitistic.Bar.GlobalIndexedComparison +import OAI.Algebra.Finitistic.Bar.IntegerDerivedMultibar +import OAI.Algebra.Finitistic.Bar.StrictSupportExtension + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt HomologicalComplex +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance integerCountRestrictionScalarModule (V : ModuleCat D) : Module k V := + BimoduleTensor.scalarModule k D V +local instance integerCountRestrictionScalarTower (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance integerCountRestrictionIndexDecidableEq (r n : ℕ) : + DecidableEq (Index r n) := Classical.decEq _ +local instance integerCountRestrictionShapeDecidableEq (n r : ℕ) : + DecidableEq (Multibar.Indexed.Shape n r) := Classical.decEq _ +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance integerCountRestrictionInflatedModule : Module A N := inflatedModule D X N +local instance integerCountRestrictionInflatedScalarTower : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +local notation "C" => ModuleCat D +local notation "E" => ComplexShape.embeddingDownNat +local notation "K" => Multibar.Indexed.signedBlockComplex k D X N (inflated_ideal_zero D X N) + +/-- The actual integer cochain count complex shifted by -r. -/ +def deshiftedCount (r : ℕ) : CochainComplex C ℤ := + ((integerExtension D).obj (K r))⟦-(r:ℤ)⟧ + +def deshiftedCountRestriction (r : ℕ) : ChainComplex C ℕ := + (deshiftedCount k D X N r).restriction E + +def deshiftedCountXIso (r n : ℕ) : (deshiftedCountRestriction k D X N r).X n ≅ + indexedModule k D X N r n := + (K r).extendXIso E + (show (E).f (r+n) = (E).f n + -(r:ℤ) by change -((r+n:ℕ):ℤ) = -(n:ℤ) + -(r:ℤ); push_cast; omega) + +theorem units_hom_apply (V W : ModuleCat.{u} D) (s : ℤˣ) (f : V ⟶ W) (v : V) : + (s • f).hom v = s • f.hom v := by + change ((s:ℤ) • f).hom v = (s:ℤ) • f.hom v + simp only [ModuleCat.hom_smul, LinearMap.smul_apply] + +/-- The standard unit-valued cochain shift sign is the proved count sign. -/ +theorem deshiftedCount_sign (r n : ℕ) : + (-(r:ℤ)).negOnePow • (K r).d (r+(n+1)) (r+n) = indexedDifferential k D X N r n := by + have hd : (K r).d (r+(n+1)) (r+n) = + ModuleCat.ofHom (Multibar.Indexed.blockDifferential k D X N (inflated_ideal_zero D X N) (r+n) r) := by + change ChainComplex.of.d + (fun m => ModuleCat.of D (⨁ p : Multibar.Indexed.Shape m r, Multibar.Indexed.outerTensor k D X N p)) + (fun m => ModuleCat.ofHom (Multibar.Indexed.blockDifferential k D X N + (inflated_ideal_zero D X N) m r)) ((r+n)+1) (r+n) = _ + exact ChainComplex.of_d _ _ (r+n) + rw [hd] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + erw [units_hom_apply] + erw [globalIndexedComparison] + change (-(r:ℤ)).negOnePow • + Multibar.Indexed.blockDifferential k D X N (inflated_ideal_zero D X N) (r+n) r v = + (-1:k)^r • + Multibar.Indexed.blockDifferential k D X N (inflated_ideal_zero D X N) (r+n) r v + have hu : (r:ℤ).negOnePow = (-1:ℤˣ)^r := by + apply Units.ext + simpa using Int.coe_negOnePow_natCast r + rw [Int.negOnePow_neg, hu] + exact totalSign_smul k (⨁ p : Multibar.Indexed.Shape (r+n) r, Multibar.Indexed.outerTensor k D X N p) r + (Multibar.Indexed.blockDifferential k D X N (inflated_ideal_zero D X N) (r+n) r v) + +theorem deshiftedCount_d (r n : ℕ) : + (deshiftedCountRestriction k D X N r).d (n+1) n = + (deshiftedCountXIso k D X N r (n+1)).hom ≫ indexedDifferential k D X N r n ≫ + (deshiftedCountXIso k D X N r n).inv := by + change (-(r:ℤ)).negOnePow • ((K r).extend E).d ((E).f (n+1) + -(r:ℤ)) ((E).f n + -(r:ℤ)) = _ + rw [extend_d_eq (K r) E + (show (E).f (r+(n+1))=(E).f (n+1) + -(r:ℤ) by change -((r+(n+1):ℕ):ℤ) = -((n+1:ℕ):ℤ) + -(r:ℤ); push_cast; omega) + (show (E).f (r+n)=(E).f n + -(r:ℤ) by change -((r+n:ℕ):ℤ) = -(n:ℤ) + -(r:ℤ); push_cast; omega)] + rw [← deshiftedCount_sign] + erw [CategoryTheory.Linear.units_smul_comp, CategoryTheory.Linear.comp_units_smul] + rfl + +/-- A genuine chain isomorphism using the standard integer shift differential, +not a newly stipulated shift or transported count differential. -/ +def indexedDeshiftedCountIso (r : ℕ) : indexedMultibar k D X N r ≅ + deshiftedCountRestriction k D X N r := + HomologicalComplex.Hom.isoOfComponents + (fun n => (deshiftedCountXIso k D X N r n).symm) (by + intro i j hij + change j+1=i at hij + subst i + rw [deshiftedCount_d] + simp only [Iso.symm_hom] + erw [Iso.inv_hom_id_assoc] + simp only [indexedMultibar, ChainComplex.of_d]) +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IntegerCountShift.lean b/lean/OAI/Algebra/Finitistic/Bar/IntegerCountShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f640d78ebf5473e839bcb432198b8dfbdc07215 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IntegerCountShift.lean @@ -0,0 +1,91 @@ +import OAI.Algebra.Finitistic.Bar.IntegerCountRestriction + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance (V : ModuleCat D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance (r n : ℕ) : DecidableEq (Index r n) := Classical.decEq _ +local instance (n r : ℕ) : DecidableEq (Multibar.Indexed.Shape n r) := Classical.decEq _ +variable (N : ModuleCat D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +local notation "C" => ModuleCat D +local notation "E" => ComplexShape.embeddingDownNat +local notation "K" => Multibar.Indexed.signedBlockComplex k D X N (inflated_ideal_zero D X N) + +theorem shapeCount_le {n r : ℕ} (p : Multibar.Indexed.Shape n r) : r≤n := by + induction p <;> omega + +theorem signedBlock_isZero_of_lt (n r : ℕ) (h : n (Nat.not_le_of_lt h) (shapeCount_le shape)⟩ + change IsZero (ModuleCat.of D (⨁ p : Multibar.Indexed.Shape n r, Multibar.Indexed.outerTensor k D X N p)) + exact ModuleCat.isZero_of_subsingleton _ + +/-- The actual -r-shifted count complex is strictly zero in positive cochain +degrees, including the range cut off by the lower count bound. -/ +theorem deshiftedCount_isZero_positive (r : ℕ) (j : ℤ) (hj : 0 by + change -(i:ℤ)=j + -(r:ℤ) at hi + omega) + +instance deshiftedCount_strictSupport (r : ℕ) : (deshiftedCount k D X N r).IsStrictlySupported E where + isZero j hj := deshiftedCount_isZero_positive k D X N r j (by + by_contra h + have hle : j≤0 := by omega + apply hj (-j).toNat + change -((-j).toNat:ℤ)=j + rw [Int.toNat_of_nonneg (by omega)] + omega) + +/-- Extension of the genuine recursive complex is the actual -r shift of +the count complex. Strict support, not truncation by assumption, supplies the inverse. -/ +def integerIndexedDeshiftedCountIso (r : ℕ) : + (integerExtension D).obj (indexedMultibar k D X N r) ≅ deshiftedCount k D X N r := + (integerExtension D).mapIso (indexedDeshiftedCountIso k D X N r) ≪≫ + strictSupportExtensionIso E (deshiftedCount k D X N r) + +/-- The manuscript's actual [r] cochain shift of the indexed recursive bar +is isomorphic to the entire signed count complex. -/ +def integerIndexedCountShiftIso (r : ℕ) : + ((integerExtension D).obj (indexedMultibar k D X N r))⟦(r:ℤ)⟧ ≅ + (integerExtension D).obj (K r) := + (CategoryTheory.shiftFunctor (CochainComplex C ℤ) (r:ℤ)).mapIso + (integerIndexedDeshiftedCountIso k D X N r) ≪≫ + ((CategoryTheory.shiftFunctorAdd' (CochainComplex C ℤ) (-(r:ℤ)) (r:ℤ) 0 (by omega)).symm.app + ((integerExtension D).obj (K r))) ≪≫ + (CategoryTheory.shiftFunctorZero (CochainComplex C ℤ) ℤ).app ((integerExtension D).obj (K r)) +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IntegerDerivedMultibar.lean b/lean/OAI/Algebra/Finitistic/Bar/IntegerDerivedMultibar.lean new file mode 100644 index 0000000000000000000000000000000000000000..83150d2d762569ea0a08655cc9dffbdd0afde3f0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IntegerDerivedMultibar.lean @@ -0,0 +1,71 @@ +import OAI.Algebra.Finitistic.Bar.IndexedMultibarTotal +import Mathlib.Algebra.Homology.DerivedCategory.Basic +import Mathlib.Algebra.Homology.Embedding.ExtendHomology + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace DerivedBar +universe u +variable (D : Type u) [Ring D] + +/-- Choose mathlib's constructed localization, rather than postulating a derived category. -/ +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- Nonnegative homological degree n is genuine integer cochain degree -n; +positive cochain degrees are extended by zero. -/ +abbrev integerExtension : ChainComplex (ModuleCat.{u} D) ℕ ⥤ + CochainComplex (ModuleCat.{u} D) ℤ := + ComplexShape.embeddingDownNat.extendFunctor (ModuleCat.{u} D) + +/-- The actual integer derived-category value of a nonnegative chain complex. -/ +def integerQ : ChainComplex (ModuleCat.{u} D) ℕ ⥤ DerivedCategory (ModuleCat.{u} D) := + integerExtension D ⋙ DerivedCategory.Q + +theorem integerQ_inverts : (chainQuasiIso D).IsInvertedBy (integerQ D) := by + intro Z W f hf + have : QuasiIso f := hf + exact inferInstanceAs (IsIso (DerivedCategory.Q.map + (HomologicalComplex.extendMap f ComplexShape.embeddingDownNat))) + +/-- Comparison from the nonnegative-chain localization into the genuine integer +cochain derived category, obtained by its localization universal property. -/ +def chainToIntegerDerived : chainDerived D ⥤ DerivedCategory (ModuleCat.{u} D) := + Localization.lift (integerQ D) (integerQ_inverts D) (chainQ D) + +def chainToIntegerDerivedIso : chainQ D ⋙ chainToIntegerDerived D ≅ integerQ D := + Localization.fac (integerQ D) (integerQ_inverts D) (chainQ D) + +/-- Exact homology-degree comparison for the integer construction. -/ +def integerExtensionHomologyIso (Z : ChainComplex (ModuleCat.{u} D) ℕ) (n : ℕ) : + ((integerExtension D).obj Z).homology (-(n : ℤ)) ≅ Z.homology n := + Z.extendHomologyIso ComplexShape.embeddingDownNat rfl + +variable (k X : Type u) [Field k] [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] +variable (N : ModuleCat.{u} D) +local notation "Z" => (Functor.obj (ChainComplex.single₀ (ModuleCat D)) N) + +/-- The constructed finite derived iterate, now viewed in the actual integer +cochain derived category, is represented by the exact indexed block complex. +This does not assert an extension of the tensor functor to arbitrary integer inputs. -/ +def integerDerivedIterateIndexedIso (r : ℕ) : + (chainToIntegerDerived D).obj + ((derivedTensorIterate k D X r).obj ((chainQ D).obj Z)) ≅ + DerivedCategory.Q.obj + ((integerExtension D).obj (RecursiveTotal.indexedMultibar k D X N r)) := + (chainToIntegerDerived D).mapIso (RecursiveTotal.derivedIterateIndexedIso k D X N r) ≪≫ + (chainToIntegerDerivedIso D).app (RecursiveTotal.indexedMultibar k D X N r) + +/-- The entire leading-bar chain isomorphism survives in the integer derived category. -/ +def integerIndexedLeadingIso (r : ℕ) : + (integerQ D).obj (RecursiveTotal.indexedMultibar k D X N r) ≅ + (integerQ D).obj (barTotal k D (explicitMultibar k D X r Z)) := + (integerQ D).mapIso (RecursiveTotal.indexedLeadingIso k D X N r) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/IntegerStalk.lean b/lean/OAI/Algebra/Finitistic/Bar/IntegerStalk.lean new file mode 100644 index 0000000000000000000000000000000000000000..826a8048a0e236ad35d2027d0c5fe7029ab90937 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/IntegerStalk.lean @@ -0,0 +1,23 @@ +import OAI.Algebra.Finitistic.Bar.IntegerDerivedMultibar + +namespace OAI +noncomputable section +open CategoryTheory +namespace DerivedBar +universe u +variable (D : Type u) [Ring D] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- The original nonnegative stalk maps to the actual integer derived stalk. -/ +def integerStalkIso (N : ModuleCat.{u} D) : + (integerQ D).obj ((ChainComplex.single₀ (ModuleCat D)).obj N) ≅ + (DerivedCategory.singleFunctor (ModuleCat D) 0).obj N := + DerivedCategory.Q.mapIso (HomologicalComplex.extendSingleIso + ComplexShape.embeddingDownNat N 0 0 rfl) ≪≫ + ((DerivedCategory.singleFunctorIsoCompQ (ModuleCat D) 0).app N).symm +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/KProjectiveCoproduct.lean b/lean/OAI/Algebra/Finitistic/Bar/KProjectiveCoproduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..62ff7fdb22d5541b3983c0d0f3a65135cf4c8e37 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/KProjectiveCoproduct.lean @@ -0,0 +1,32 @@ +import OAI.Algebra.Finitistic.Bar.CoproductHomotopy +import OAI.Algebra.Finitistic.Bar.CoproductHomBijections +import Mathlib.Algebra.Homology.DerivedCategory.KProjective + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace DerivedBar +universe u v w +variable {C : Type u} [Category.{v} C] [Abelian C] + [HasColimitsOfShape (Discrete ℕ) C] [HasDerivedCategory.{w} C] + (F : Discrete ℕ ⥤ CochainComplex C ℤ) (s : Cocone F) (hs : IsColimit s) + [s.pt.IsKProjective] [∀ r, (F.obj r).IsKProjective] + +/-- An actual coproduct of K-projective cochain complexes with K-projective +coproduct object remains a coproduct in the genuine derived category. -/ +def kProjectiveCoproductIsColimit : IsColimit (DerivedCategory.Q.mapCocone s) := by + let H := HomotopyCategory.quotient C (.up ℤ) + let hsH := homotopyCoproductIsColimit F s hs + let hsD := mapCoproductOfHomBijections DerivedCategory.Qh (F ⋙ H) (H.mapCocone s) hsH + (fun T => CochainComplex.IsKProjective.Qh_map_bijective s.pt T) + (fun r T => CochainComplex.IsKProjective.Qh_map_bijective (F.obj r) T) + letI : PreservesColimit F (H ⋙ DerivedCategory.Qh) := + preservesColimit_of_preserves_colimit_cocone hs hsD + letI : PreservesColimit F (DerivedCategory.Q : CochainComplex C ℤ ⥤ _) := + preservesColimit_of_natIso F (DerivedCategory.quotientCompQhIso C) + exact isColimitOfPreserves DerivedCategory.Q hs +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/LeadingBarSuffix.lean b/lean/OAI/Algebra/Finitistic/Bar/LeadingBarSuffix.lean new file mode 100644 index 0000000000000000000000000000000000000000..44d6ab12dae9103f3ee60761b8a9b68c8290f2f4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/LeadingBarSuffix.lean @@ -0,0 +1,165 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixFaces + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance leadingBarSuffixScalarModule (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance leadingBarSuffixScalarTower (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "DB" => barFunctor k D +local instance leadingBarSuffixInflatedModule : Module A N := inflatedModule D X N +local instance leadingBarSuffixInflatedTower : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +/-- Retain the exterior D coefficient while applying an exact degree transport. -/ +def outerCast {a b : ℕ} (h : a=b) : + D ⊗[k] term k A N a →ₗ[D] D ⊗[k] term k A N b := + AlgebraTensorModule.lTensor D D (termCast k D X N h) + +@[simp] theorem outerCast_refl (a : ℕ) : outerCast k D X N (rfl : a=a) = LinearMap.id := by + ext value + rfl + +theorem outerCast_trans {a b c : ℕ} (h : a=b) (g : b=c) + (v : D ⊗[k] term k A N a) : + outerCast k D X N g (outerCast k D X N h v) = outerCast k D X N (h.trans g) v := by + subst b; subst c + simp only [outerCast_refl, LinearMap.id_apply] + +theorem twoSidedParity_outerCast {a b : ℕ} (h : a=b) (h' : a+1=b+1) + (v : D ⊗[k] term k A N (a+1)) : + SquareZero.multibarTwoSidedDifferential k D X N b (outerCast k D X N h' v) = + outerCast k D X N h (SquareZero.multibarTwoSidedDifferential k D X N a v) := by + subst b + simp only [outerCast_refl, LinearMap.id_apply] + +/-- The exterior free D bar uses its actual categorical coordinates. -/ +def outerBarSuffix (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N s) : + ((DB).obj V).X i →ₗ[D] D ⊗[k] term k A N (s+i) := + (outerSuffixEmbed k D X N V s i e).comp (Multibar.freeBarObjIso k D V i).hom.hom + +theorem outerBarSuffix_map (V W : ModuleCat.{u} D) (s i : ℕ) + (e : W →ₗ[k] term k A N s) (f : V ⟶ W) (v : ((DB).obj V).X i) : + outerBarSuffix k D X N W s i e ((((DB).map f).f i).hom v) = + outerBarSuffix k D X N V s i (e.comp (f.hom.restrictScalars k)) v := by + have h := congrArg (fun g => g.hom v) (Multibar.freeBarObjIso_map k D V W f.hom i) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom] at h + unfold outerBarSuffix + simp only [LinearMap.comp_apply] + erw [h] + exact outerSuffixEmbed_termMap k D X N V W s i e f.hom _ + +theorem parity_outerBarSuffix (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N (s+1)) + (he : ∀ (d : D) (v : V), e (d • v) = (inl d : A) • e v) + (v : ((DB).obj V).X (i+1)) : + SquareZero.multibarTwoSidedDifferential k D X N ((s+1)+i) + (outerBarSuffix k D X N V (s+1) (i+1) e v) = + outerBarSuffix k D X N V (s+1) i e ((((DB).obj V).d (i+1) i).hom v) + + (-1:k)^i • outerCast k D X N (show s+(i+1)=(s+1)+i by omega) + (outerBarSuffix k D X N V s (i+1) + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v) := by + have h := congrArg (fun g => g.hom v) (Multibar.freeBarObjIso_d k D V i) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom] at h + unfold outerBarSuffix + simp only [LinearMap.comp_apply] + erw [h] + exact parity_outerSuffixEmbed k D X N V s i e he _ + +theorem parity_outerBarSuffix_zero (V : ModuleCat.{u} D) (s : ℕ) + (e : V →ₗ[k] term k A N (s+1)) + (he : ∀ v, FreeBaseChange.coefficient (fstHom k D X) (term k A N s) (e v) = 0) + (v : ((DB).obj V).X 0) : + SquareZero.multibarTwoSidedDifferential k D X N s + (outerBarSuffix k D X N V (s+1) 0 e v) = + -outerBarSuffix k D X N V s 0 + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v := + parity_outerSuffixEmbed_zero k D X N V s e he _ + +theorem outerBarSuffix_neg (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N s) : + outerBarSuffix k D X N V s i (-e) = -outerBarSuffix k D X N V s i e := by + ext v + unfold outerBarSuffix + simp only [LinearMap.neg_apply, LinearMap.comp_apply] + generalize (Multibar.freeBarObjIso k D V i).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul d w => + change d ⊗ₜ[k] suffixEmbed k D X N V s (-e) i w = + -(d ⊗ₜ[k] suffixEmbed k D X N V s e i w) + rw [← neg_one_smul k e, suffixEmbed_smul_map, neg_one_smul, TensorProduct.tmul_neg] + | add v w hv hw => simp only [map_add, neg_add, hv, hw] + +theorem outerBarSuffix_zero (V : ModuleCat.{u} D) (s i : ℕ) : + outerBarSuffix k D X N V s i 0 = 0 := by + ext v + unfold outerBarSuffix + simp only [LinearMap.zero_apply, LinearMap.comp_apply] + generalize (Multibar.freeBarObjIso k D V i).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul d w => + change d ⊗ₜ[k] suffixEmbed k D X N V s 0 i w = 0 + have hz := suffixEmbed_smul_map k D X N V s i (0:k) (0 : V →ₗ[k] term k A N s) w + simp only [zero_smul] at hz + rw [hz, TensorProduct.tmul_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + +def outerBaseEmbed (i : ℕ) : D ⊗[k] term k D N i →ₗ[D] D ⊗[k] term k A N i := + AlgebraTensorModule.lTensor D D (baseEmbed k D X N i) + +theorem coefficient_baseEmbed (i : ℕ) (v : term k D N (i+1)) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N i) + (baseEmbed k D X N (i+1) v) = outerBaseEmbed k D X N i v := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [baseEmbed_tmul, FreeBaseChange.coefficient_tmul] + rfl + | add v w hv hw => simp only [map_add, hv, hw] + +theorem parity_outerBaseEmbed (i : ℕ) (v : D ⊗[k] term k D N (i+1)) : + SquareZero.multibarTwoSidedDifferential k D X N i (outerBaseEmbed k D X N (i+1) v) = + outerBaseEmbed k D X N i (DerivedBar.differential k D N (i+1) v) := by + induction v using TensorProduct.inductionOn with + | tmul d v => + change SquareZero.multibarTwoSidedDifferential k D X N i + (d ⊗ₜ[k] baseEmbed k D X N (i+1) v) = _ + rw [SquareZero.multibarTwoSidedDifferential_tmul, coefficient_baseEmbed, + inflated_parity_baseEmbed, DerivedBar.differential_succ_tmul, map_sub, map_smul] + rfl + | add v w hv hw => simp only [map_add, hv, hw] + +theorem outerSuffixEmbed_id (i : ℕ) (v : D ⊗[k] term k D N i) : + outerSuffixEmbed k D X N N 0 i LinearMap.id v = + outerCast k D X N (Nat.zero_add i).symm (outerBaseEmbed k D X N i v) := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [outerSuffixEmbed_tmul, suffixEmbed_id] + rfl + | add v w hv hw => simp only [map_add, hv, hw] + +theorem parity_outerBarSuffix_terminal (i : ℕ) (v : ((DB).obj N).X (i+1)) : + SquareZero.multibarTwoSidedDifferential k D X N (0+i) + (outerBarSuffix k D X N N 0 (i+1) LinearMap.id v) = + outerBarSuffix k D X N N 0 i LinearMap.id ((((DB).obj N).d (i+1) i).hom v) := by + have h := congrArg (fun g => g.hom v) (Multibar.freeBarObjIso_d k D N i) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom] at h + unfold outerBarSuffix + simp only [LinearMap.comp_apply] + erw [h] + rw [outerSuffixEmbed_id, outerSuffixEmbed_id] + erw [twoSidedParity_outerCast k D X N (Nat.zero_add i).symm + (show i+1=(0+i)+1 by omega), parity_outerBaseEmbed] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/LeadingSuffixFaces.lean b/lean/OAI/Algebra/Finitistic/Bar/LeadingSuffixFaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..9aa33b0e322f8dbeae44debaaa369885374b369e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/LeadingSuffixFaces.lean @@ -0,0 +1,96 @@ +import OAI.Algebra.Finitistic.Bar.SuffixParityFaces + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.ParityBridge +universe u +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] +local notation "A" => TrivSqZeroExt D X + +variable (M : Type u) [AddCommGroup M] [Module k M] [Module D M] + [IsScalarTower k D M] +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + +/-- Retain the exterior D coefficient while inserting an arbitrary suffix. -/ +def outerSuffixEmbed (s n : ℕ) (e : M →ₗ[k] term k A N s) : + D ⊗[k] term k D M n →ₗ[D] D ⊗[k] term k A N (s+n) := + AlgebraTensorModule.lTensor D D (suffixEmbed k D X N M s e n) + +omit [Module D M] [IsScalarTower k D M] [Module A N] [IsScalarTower k A N] in +@[simp] theorem outerSuffixEmbed_tmul (s n : ℕ) (e : M →ₗ[k] term k A N s) + (d : D) (v : term k D M n) : + outerSuffixEmbed k D X N M s n e (d ⊗ₜ[k] v) = + d ⊗ₜ[k] suffixEmbed k D X N M s e n v := rfl + +omit [Module D M] [IsScalarTower k D M] [Module A N] [IsScalarTower k A N] in +/-- The projected leading face is exactly the original D multiplication. -/ +theorem coefficient_suffixEmbed (s n : ℕ) (e : M →ₗ[k] term k A N s) + (v : term k D M (n+1)) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N (s+n)) + (suffixEmbed k D X N M s e (n+1) v) = outerSuffixEmbed k D X N M s n e v := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [suffixEmbed_tmul, FreeBaseChange.coefficient_tmul] + rfl + | add v w hv hw => simp only [map_add, hv, hw] + +/-- Exterior D comparison with the genuine free-bar differential and all later +suffix faces. Negating the suffix differential gives the total sign (-1)^i. -/ +theorem parity_outerSuffixEmbed (s n : ℕ) (e : M →ₗ[k] term k A N (s+1)) + (he : ∀ (d : D) (v : M), e (d • v) = (inl d : A) • e v) + (v : D ⊗[k] term k D M (n+1)) : + SquareZero.multibarTwoSidedDifferential k D X N ((s+1)+n) + (outerSuffixEmbed k D X N M (s+1) (n+1) e v) = + outerSuffixEmbed k D X N M (s+1) n e (DerivedBar.differential k D M (n+1) v) + + (-1 : k)^n • AlgebraTensorModule.lTensor D D + (termCast k D X N (show s+(n+1)=(s+1)+n by omega)) + (outerSuffixEmbed k D X N M s (n+1) + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v) := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [outerSuffixEmbed_tmul, SquareZero.multibarTwoSidedDifferential_tmul, + coefficient_suffixEmbed, parity_suffixEmbed k D X N M s n e he, + DerivedBar.differential_succ_tmul, map_sub, map_smul, outerSuffixEmbed_tmul, + outerSuffixEmbed_tmul, AlgebraTensorModule.lTensor_tmul] + erw [TensorProduct.tmul_add, TensorProduct.tmul_smul] + have hs : (-1 : k)^(n+1) = -((-1 : k)^n) := by rw [pow_succ, mul_neg_one] + rw [hs] + have hn : (-((-1 : k)^n)) • + (d ⊗ₜ[k] termCast k D X N (show s+(n+1)=(s+1)+n by omega) + (suffixEmbed k D X N M s ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) (n+1) v)) = + -(((-1 : k)^n) • (d ⊗ₜ[k] termCast k D X N (show s+(n+1)=(s+1)+n by omega) + (suffixEmbed k D X N M s ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) (n+1) v))) := + _root_.neg_smul ((-1:k)^n) + (d ⊗ₜ[k] termCast k D X N (show s+(n+1)=(s+1)+n by omega) + (suffixEmbed k D X N M s ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) (n+1) v)) + rw [hn] + abel + | add v w hv hw => simp only [map_add, hv, hw, smul_add]; abel + +omit [Module D M] [IsScalarTower k D M] in +/-- At a zero-length leading D block the projected X endpoint is zero. -/ +theorem parity_outerSuffixEmbed_zero (s : ℕ) (e : M →ₗ[k] term k A N (s+1)) + (he : ∀ v, FreeBaseChange.coefficient (fstHom k D X) (term k A N s) (e v) = 0) + (v : D ⊗[k] M) : + SquareZero.multibarTwoSidedDifferential k D X N s + (outerSuffixEmbed k D X N M (s+1) 0 e v) = + -outerSuffixEmbed k D X N M s 0 + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [outerSuffixEmbed_tmul, SquareZero.multibarTwoSidedDifferential_tmul] + change d • FreeBaseChange.coefficient (fstHom k D X) (term k A N s) (e v) - + d ⊗ₜ[k] SquareZero.multibarAugmentedDifferential k D X N s (e v) = _ + rw [he, smul_zero, zero_sub] + rfl + | add v w hv hw => simp only [map_add, hv, hw, neg_add] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/LeadingSupportedComparison.lean b/lean/OAI/Algebra/Finitistic/Bar/LeadingSupportedComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..07c54e57603362898ca8792670a185eee96f4ee1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/LeadingSupportedComparison.lean @@ -0,0 +1,229 @@ +import OAI.Algebra.Finitistic.Bar.SupportedOuterCoordinates +import OAI.Algebra.Finitistic.Bar.RecursivePrefixInclusions + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal + +private theorem mapIso_trans_congr {R : Type*} [Ring R] + (F : ModuleCat R ⥤ ModuleCat R) {U V W Z T : ModuleCat R} + (e : U ≅ V) (f : V ≅ W) (g : W ≅ Z) + (j : F.obj Z ≅ T) (j' : F.obj W ≅ T) (h : F.mapIso g ≪≫ j = j') : + F.mapIso (e ≪≫ (f ≪≫ g)) ≪≫ j = F.mapIso (e ≪≫ f) ≪≫ j' := by + simpa only [Functor.mapIso_trans, Iso.trans_assoc] using + congrArg (fun t => F.mapIso (e ≪≫ f) ≪≫ t) h + +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance leadingSupportedComparisonIndexDecidableEq (r n : ℕ) : + DecidableEq (Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +def supportedLeadingIso (r n : ℕ) (t : Index (r+1) n) (h : inputDegree (r+1) t=0) : + summand (leadingBarSequence k D X r) Z (r+1) n t ≅ + ModuleCat.of D (D ⊗[k] patternTerm k D X N (leadingPattern r n t)) := by + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + exact eqToIso (leadingSummand_last k D X N r n i q hq t) ≪≫ + (barFunctor k D ⋙ HomologicalComplex.eval _ c i).mapIso + (eqToIso (leadingSummand_prefix k D X Z r r q le_rfl t) ≪≫ + supportedInnerIso k D X N r q t h) ≪≫ freeBarPatternIso k D X N i (innerPattern r t) + +theorem iso_mpr_source {U U' V : ModuleCat.{u} D} (h : U=U') (e : U' ≅ V) : + Eq.mpr (congrArg (fun W : ModuleCat D => W ≅ V) h) e = eqToIso h ≪≫ e := by + subst U' + simp + +theorem leadingSummandIso_explicit (r n i q : ℕ) (hq : i+q=n) (t : Index r q) : + leadingSummandIso k D X Z r n ⟨⟨⟨i,q⟩,hq⟩,t⟩ = + eqToIso (leadingSummand_last k D X N r n i q hq t) ≪≫ + (barFunctor k D ⋙ HomologicalComplex.eval _ c i).mapIso + (eqToIso (leadingSummand_prefix k D X Z r r q le_rfl t) ≪≫ + innerSummandIso k D X Z r q t) ≪≫ + freeBarPatternIso k D X ((Z).X (inputDegree r t)) i (innerPattern r t) := by + unfold leadingSummandIso + change Eq.mpr (congrArg (fun W : ModuleCat D => W ≅ + ModuleCat.of D (D ⊗[k] patternTerm k D X ((Z).X (inputDegree r t)) + (List.replicate i false ++ innerPattern r t))) + (leadingSummand_last k D X N r n i q hq t)) _ = _ + erw [iso_mpr_source] + rfl + +theorem supportedLeadingIso_eq (r n : ℕ) (t : Index (r+1) n) (h : inputDegree (r+1) t=0) : + supportedLeadingIso k D X N r n t h = leadingSummandIso k D X Z r n t ≪≫ + eqToIso (congrArg (fun V : ModuleCat D => ModuleCat.of D + (D ⊗[k] patternTerm k D X V (leadingPattern r n t))) + (show (Z).X (inputDegree (r+1) t)=N by rw [h]; rfl)) := by + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + let F := barFunctor k D ⋙ HomologicalComplex.eval _ c i + let p := innerPattern r t + let V := (Z).X (inputDegree r t) + have hv : V=N := by change (Z).X (inputDegree r t)=N; rw [show inputDegree r t=0 from h]; rfl + rw [leadingSummandIso_explicit] + dsimp only [supportedLeadingIso] + erw [Iso.trans_assoc] + congr 1 + change F.mapIso (eqToIso _ ≪≫ supportedInnerIso k D X N r q t h) ≪≫ + freeBarPatternIso k D X N i p = + F.mapIso (eqToIso _ ≪≫ innerSummandIso k D X Z r q t) ≪≫ (freeBarPatternIso k D X V i p ≪≫ + eqToIso (congrArg (fun W : ModuleCat D => + ModuleCat.of D (patternTerm k D X W (List.replicate (i+1) false ++ p))) hv)) + erw [supportedInnerIso_eq] + exact mapIso_trans_congr F _ _ _ _ _ (freeBarPatternIso_eqToIso k D X V N hv i p) + +theorem supportedLeading_length (r n : ℕ) (t : Index (r+1) n) (h : inputDegree (r+1) t=0) : + (leadingPattern r n t).length=r+n := by + have ht := length_leadingPattern r n t + omega + +private theorem innerTotalEmbedding_supported_comp (r q : ℕ) (t : Index r q) + (h : inputDegree r t = 0) : + let p := innerPattern r t + let V := summand B Z r q t + let W := ModuleCat.of D (patternTerm k D X N p) + let e := canonicalLinear k D X N (patternTerm k D X N p) p.length (embed k D X N p) + (innerTotalEmbedding k D X N r q).comp + (canonicalRestrict k D V ((iter B Z r).X q) (inclusion B Z r q t)) = + (termCast k D X N (supportedInner_length r q t h)).comp + (e.comp (canonicalRestrict k D V W (supportedInnerIso k D X N r q t h).hom)) := by + dsimp only + ext w + change innerTotalEmbedding k D X N r q ((inclusion B Z r q t).hom w) = + termCast k D X N (supportedInner_length r q t h) + (canonicalLinear k D X N (patternTerm k D X N (innerPattern r t)) + (innerPattern r t).length (embed k D X N (innerPattern r t)) + ((supportedInnerIso k D X N r q t h).hom.hom w)) + rw [canonicalLinear_apply, innerTotalEmbedding_inclusion] + exact innerEmbedding_supported k D X N r q t h w + +private theorem leadingTotalEmbedding_on_summand (r n i q : ℕ) (hq : i+q=n) + (t : Index r q) + (v : summand (leadingBarSequence k D X r) Z (r+1) n ⟨⟨⟨i,q⟩,hq⟩,t⟩) : + let g := eqToHom (leadingSummand_prefix k D X Z r r q le_rfl t) + let v' := (eqToHom (leadingSummand_last k D X N r n i q hq t)).hom v + let u := ((barFunctor k D ⋙ HomologicalComplex.eval _ c i).map g).hom v' + ((inclusion (leadingBarSequence k D X r) Z (r+1) n ⟨⟨⟨i,q⟩,hq⟩,t⟩ ≫ + eqToHom (congrArg (fun W => W.X n) (leadingIter_total k D X N r)) ≫ + leadingTotalEmbedding k D X N r n).hom v) = + outerCast k D X N (show (r+q)+i=r+n by omega) + (outerBarSuffix k D X N ((iter B Z r).X q) (r+q) i + (innerTotalEmbedding k D X N r q) + ((((barFunctor k D).map (inclusion B Z r q t)).f i).hom u)) := by + dsimp only + rw [← Category.assoc, leadingInclusion_total] + erw [Category.assoc, Category.assoc, leadingTotalEmbedding_ι] + simp only [Functor.map_comp, Category.assoc, ModuleCat.hom_comp, LinearMap.comp_apply, + ModuleCat.hom_ofHom] + rfl + +private theorem supportedLeadingIso_apply (r n i q : ℕ) (hq : i+q=n) + (t : Index r q) (h : inputDegree r t = 0) + (v : summand (leadingBarSequence k D X r) Z (r+1) n ⟨⟨⟨i,q⟩,hq⟩,t⟩) : + let p := innerPattern r t + let g := eqToHom (leadingSummand_prefix k D X Z r r q le_rfl t) + let f := (supportedInnerIso k D X N r q t h).hom + let v' := (eqToHom (leadingSummand_last k D X N r n i q hq t)).hom v + let u := ((barFunctor k D ⋙ HomologicalComplex.eval _ c i).map g).hom v' + (supportedLeadingIso k D X N r n ⟨⟨⟨i,q⟩,hq⟩,t⟩ h).hom.hom v = + (freeBarPatternIso k D X N i p).hom.hom ((((barFunctor k D).map f).f i).hom u) := by + dsimp only + simp only [supportedLeadingIso, Iso.trans_hom, + ModuleCat.hom_comp, LinearMap.comp_apply, eqToIso.hom] + erw [Iso.trans_hom, Functor.mapIso_hom, Iso.trans_hom, Functor.map_comp] + rfl + +private theorem outerBarSuffix_of_pattern (V : ModuleCat.{u} D) (p : List Bool) + (f : V ⟶ ModuleCat.of D (patternTerm k D X N p)) (i b m : ℕ) + (hp : p.length=b) (h₁ : b+i=m) (h₂ : (List.replicate i false ++ p).length=m) + (v : ((barFunctor k D).obj V).X i) : + outerCast k D X N h₁ + (outerBarSuffix k D X N V b i + ((termCast k D X N hp).comp + ((canonicalLinear k D X N (patternTerm k D X N p) p.length (embed k D X N p)).comp + (canonicalRestrict k D V (ModuleCat.of D (patternTerm k D X N p)) f))) v) = + outerCast k D X N h₂ + (AlgebraTensorModule.lTensor D D (embed k D X N (List.replicate i false ++ p)) + ((freeBarPatternIso k D X N i p).hom.hom ((((barFunctor k D).map f).f i).hom v))) := by + rw [outerBarSuffix_termCast] + erw [← outerBarSuffix_map k D X N V (ModuleCat.of D (patternTerm k D X N p)) + p.length i (canonicalLinear k D X N (patternTerm k D X N p) p.length + (embed k D X N p)) f v] + erw [outerBarSuffix_canonicalLinear k D X N (patternTerm k D X N p) p.length i + (embed k D X N p)] + rw [outerEmbed_freeBarPatternIso, outerCast_trans, outerCast_trans] + +private theorem outerBarSuffix_supported (r n i q : ℕ) (hq : i+q=n) + (t : Index r q) (h : inputDegree r t=0) + (u : ((barFunctor k D).obj (summand B Z r q t)).X i) : + outerCast k D X N (show (r+q)+i=r+n by omega) + (outerBarSuffix k D X N (summand B Z r q t) (r+q) i + ((innerTotalEmbedding k D X N r q).comp + (canonicalRestrict k D (summand B Z r q t) ((iter B Z r).X q) + (inclusion B Z r q t))) u) = + outerCast k D X N (supportedLeading_length r n ⟨⟨⟨i,q⟩,hq⟩,t⟩ h) + (AlgebraTensorModule.lTensor D D (embed k D X N (List.replicate i false ++ innerPattern r t)) + ((freeBarPatternIso k D X N i (innerPattern r t)).hom.hom + ((((barFunctor k D).map (supportedInnerIso k D X N r q t h).hom).f i).hom u))) := by + let p := innerPattern r t + let V := summand B Z r q t + let W := ModuleCat.of D (patternTerm k D X N p) + let f : V ⟶ W := (supportedInnerIso k D X N r q t h).hom + let e := canonicalLinear k D X N (patternTerm k D X N p) p.length (embed k D X N p) + have hp : p.length=r+q := supportedInner_length r q t h + have he : (innerTotalEmbedding k D X N r q).comp + (canonicalRestrict k D V ((iter B Z r).X q) (inclusion B Z r q t)) = + (termCast k D X N hp).comp (e.comp (canonicalRestrict k D V W f)) := + innerTotalEmbedding_supported_comp k D X N r q t h + rw [he] + exact outerBarSuffix_of_pattern k D X N V p f i (r+q) (r+n) hp _ _ u + +/-- The leading total embedding on every surviving recursive summand is the +original literal tensor inclusion under the previously constructed coordinates. -/ +theorem leadingTotalEmbedding_supported (r n i q : ℕ) (hq : i+q=n) (t : Index r q) + (h : inputDegree r t=0) + (v : summand (leadingBarSequence k D X r) Z (r+1) n ⟨⟨⟨i,q⟩,hq⟩,t⟩) : + ((inclusion (leadingBarSequence k D X r) Z (r+1) n ⟨⟨⟨i,q⟩,hq⟩,t⟩ ≫ + eqToHom (congrArg (fun W => W.X n) (leadingIter_total k D X N r)) ≫ + leadingTotalEmbedding k D X N r n).hom v) = + outerCast k D X N (supportedLeading_length r n ⟨⟨⟨i,q⟩,hq⟩,t⟩ h) + (AlgebraTensorModule.lTensor D D (embed k D X N (List.replicate i false ++ innerPattern r t)) + ((supportedLeadingIso k D X N r n ⟨⟨⟨i,q⟩,hq⟩,t⟩ h).hom.hom v)) := by + let p := innerPattern r t + let V := summand B Z r q t + let g : summand (leadingBarSequence k D X r) Z r q t ⟶ V := + eqToHom (leadingSummand_prefix k D X Z r r q le_rfl t) + let v' := (eqToHom (leadingSummand_last k D X N r n i q hq t)).hom v + let u := (((barFunctor k D ⋙ HomologicalComplex.eval _ c i).map g).hom v') + refine (leadingTotalEmbedding_on_summand k D X N r n i q hq t v).trans ?_ + change outerCast k D X N (show (r+q)+i=r+n by omega) + (outerBarSuffix k D X N ((iter B Z r).X q) (r+q) i (innerTotalEmbedding k D X N r q) + ((((barFunctor k D).map (inclusion B Z r q t)).f i).hom u)) = _ + rw [outerBarSuffix_map] + change outerCast k D X N _ (outerBarSuffix k D X N V (r+q) i + ((innerTotalEmbedding k D X N r q).comp + (canonicalRestrict k D V ((iter B Z r).X q) (inclusion B Z r q t))) u) = _ + refine (outerBarSuffix_supported k D X N r n i q hq t h u).trans ?_ + exact (congrArg (fun w => + outerCast k D X N (supportedLeading_length r n ⟨⟨⟨i,q⟩,hq⟩,t⟩ h) + (AlgebraTensorModule.lTensor D D (embed k D X N (List.replicate i false ++ p)) w)) + (supportedLeadingIso_apply k D X N r n i q hq t h v)).symm +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalComparison.lean b/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..61e17444c4f885a7143d67680ebbf8aece17646e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalComparison.lean @@ -0,0 +1,138 @@ +import OAI.Algebra.Finitistic.Bar.LeadingTotalDifferential + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "DB" => barFunctor k D +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local notation "I" => RecursiveTotal.iter B Z +local notation "K" => barBicomplex k D +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +theorem outerCast_smul {a b : ℕ} (h : a=b) (z : k) + (v : D ⊗[k] term k A N a) : + outerCast k D X N h (z • v) = z • outerCast k D X N h v := by + subst b + simp only [outerCast_refl, LinearMap.id_apply] + +theorem leadingTotalComparison_positive (r n i q : ℕ) (h : i+(q+1)=n+1) + (v : (((DB).obj ((I r).X (q+1))).X i)) : + SquareZero.multibarTwoSidedDifferential k D X N (r+n) + (outerCast k D X N (show (r+(q+1))+i=r+(n+1) by omega) + (outerBarSuffix k D X N ((I r).X (q+1)) (r+(q+1)) i + (innerTotalEmbedding k D X N r (q+1)) v)) = + (((K (I r)).d₁ c i (q+1) n ≫ leadingTotalEmbedding k D X N r n).hom v) + + (((K (I r)).d₂ c i (q+1) n ≫ leadingTotalEmbedding k D X N r n).hom v) := by + have hδ : (SquareZero.multibarAugmentedDifferential k D X N (r+q)).comp + (innerTotalEmbedding k D X N r (q+1)) = + -((innerTotalEmbedding k D X N r q).comp (((I r).d (q+1) q).hom.restrictScalars k)) := by + ext w + exact innerTotalEmbedding_differential k D X N r q w + cases i with + | zero => + have hn : n=q := by omega + subst n + simp only [Nat.add_zero, outerCast_refl, LinearMap.id_apply] + erw [parity_outerBarSuffix_zero k D X N ((I r).X (q+1)) (r+q) + (innerTotalEmbedding k D X N r (q+1)) + (fun w => innerTotalEmbedding_coefficient_of_pos k D X N r (q+1) (r+q) rfl w)] + rw [hδ, outerBarSuffix_neg, LinearMap.neg_apply, neg_neg] + rw [leadingTotalEmbedding_d₁_zero] + erw [leadingTotalEmbedding_d₂ k D X N r q 0 q h v] + simp only [ModuleCat.hom_zero, + pow_zero, one_smul, Nat.add_zero, outerCast_refl, LinearMap.id_apply] + erw [LinearMap.zero_apply (σ₁₂ := RingHom.id D) + (M₂ := D ⊗[k] term k A N (r+q)) v, zero_add] + | succ i => + erw [twoSidedParity_outerCast k D X N + (show (r+(q+1))+i=r+n by omega) + (show ((r+(q+1))+i)+1=(r+n)+1 by omega)] + erw [parity_outerBarSuffix k D X N ((I r).X (q+1)) (r+q) i + (innerTotalEmbedding k D X N r (q+1)) (innerTotalEmbedding_smul k D X N r (q+1))] + simp only [hδ, outerBarSuffix_neg, LinearMap.neg_apply, map_add, outerCast_smul, map_neg] + erw [leadingTotalEmbedding_d₁ k D X N r n i (q+1) h v] + erw [leadingTotalEmbedding_d₂ k D X N r n (i+1) q h v] + apply congrArg₂ (· + ·) (by rfl) + let w := outerBarSuffix k D X N ((I r).X (q+1)) (r+q) (i+1) + ((innerTotalEmbedding k D X N r q).comp (((I r).d (q+1) q).hom.restrictScalars k)) v + have hc := outerCast_trans k D X N + (show (r+q)+(i+1)=(r+q+1)+i by omega) + (show (r+q+1)+i=r+n by omega) w + change (-1:k)^i • -(outerCast k D X N (show (r+q+1)+i=r+n by omega) + (outerCast k D X N (show (r+q)+(i+1)=(r+q+1)+i by omega) w)) = + (-1:k)^(i+1) • outerCast k D X N (show (r+q)+(i+1)=r+n by omega) w + rw [hc] + have hs : (-1:k)^(i+1) = -((-1:k)^i) := by rw [pow_succ, mul_neg_one] + rw [hs] + exact (smul_neg _ _).trans (_root_.neg_smul _ _).symm + +theorem leadingTotalComparison_bottom (r n i : ℕ) (h : i+0=n+1) + (v : (((DB).obj ((I r).X 0)).X i)) : + SquareZero.multibarTwoSidedDifferential k D X N (r+n) + (outerCast k D X N (show (r+0)+i=r+(n+1) by omega) + (outerBarSuffix k D X N ((I r).X 0) (r+0) i + (innerTotalEmbedding k D X N r 0) v)) = + (((K (I r)).d₁ c i 0 n ≫ leadingTotalEmbedding k D X N r n).hom v) + + (((K (I r)).d₂ c i 0 n ≫ leadingTotalEmbedding k D X N r n).hom v) := by + have hi : i=n+1 := by omega + subst i + simp only [Nat.add_zero, outerCast_refl, LinearMap.id_apply] + rw [leadingTotalEmbedding_d₂_zero] + simp only [ModuleCat.hom_zero] + erw [LinearMap.zero_apply (σ₁₂ := RingHom.id D) + (M₂ := D ⊗[k] term k A N (r+n)) v] + simp only [add_zero] + erw [leadingTotalEmbedding_d₁ k D X N r n n 0 h v] + simp only [Nat.add_zero, outerCast_refl, LinearMap.id_apply] + cases r with + | zero => + rw [innerTotalEmbedding_zero] + exact parity_outerBarSuffix_terminal k D X N n v + | succ r => + erw [parity_outerBarSuffix k D X N ((I (r+1)).X 0) r n + (innerTotalEmbedding k D X N (r+1) 0) (innerTotalEmbedding_smul k D X N (r+1) 0)] + have hz : (SquareZero.multibarAugmentedDifferential k D X N r).comp + (innerTotalEmbedding k D X N (r+1) 0) = 0 := by + ext w + exact innerTotalEmbedding_bottom k D X N r w + simp only [hz, outerBarSuffix_zero, LinearMap.zero_apply, map_zero, smul_zero, add_zero] + +/-- The canonical leading total embedding intertwines its original total +horizontal/vertical differential with the literal square-zero-extension faces. -/ +theorem leadingTotalEmbedding_differential (r n : ℕ) : + leadingTotalEmbedding k D X N r (n+1) ≫ + ModuleCat.ofHom (SquareZero.multibarTwoSidedDifferential k D X N (r+n)) = + (barTotal k D (I r)).d (n+1) n ≫ leadingTotalEmbedding k D X N r n := by + apply HomologicalComplex₂.total.hom_ext + intro i q h + erw [← Category.assoc, leadingTotalEmbedding_ι, leadingTotalEmbedding_ι_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + change SquareZero.multibarTwoSidedDifferential k D X N (r+n) + (outerCast k D X N _ (outerBarSuffix k D X N ((I r).X q) (r+q) i + (innerTotalEmbedding k D X N r q) v)) = _ + cases q with + | zero => exact leadingTotalComparison_bottom k D X N r n i h v + | succ q => exact leadingTotalComparison_positive k D X N r n i q h v +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalDifferential.lean b/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4209d3da20ff71b0bba8876b93a5f098cab8c01 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalDifferential.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Bar.LeadingTotalEmbedding + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "DB" => barFunctor k D +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local notation "I" => RecursiveTotal.iter B Z +local notation "K" => barBicomplex k D +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +theorem leadingTotalEmbedding_d₁ (r n i q : ℕ) (h : (i+1)+q=n+1) + (v : (((DB).obj ((I r).X q)).X (i+1))) : + (((K (I r)).d₁ c (i+1) q n ≫ leadingTotalEmbedding k D X N r n).hom v) = + outerCast k D X N (show (r+q)+i=r+n by omega) + (outerBarSuffix k D X N ((I r).X q) (r+q) i (innerTotalEmbedding k D X N r q) + ((((DB).obj ((I r).X q)).d (i+1) i).hom v)) := by + rw [HomologicalComplex₂.d₁_eq _ _ (by rfl : (c).Rel (i+1) i) q n (by change i+q=n; omega)] + change (((1:ℤˣ) • ((((DB).obj ((I r).X q)).d (i+1) i) ≫ + (K (I r)).ιTotal c i q n (by change i+q=n; omega))) ≫ leadingTotalEmbedding k D X N r n).hom v = _ + erw [one_smul, Category.assoc, leadingTotalEmbedding_ι] + rfl + +theorem leadingTotalEmbedding_d₂ (r n i q : ℕ) (h : i+(q+1)=n+1) + (v : (((DB).obj ((I r).X (q+1))).X i)) : + (((K (I r)).d₂ c i (q+1) n ≫ leadingTotalEmbedding k D X N r n).hom v) = + (-1:k)^i • outerCast k D X N (show (r+q)+i=r+n by omega) + (outerBarSuffix k D X N ((I r).X (q+1)) (r+q) i + ((innerTotalEmbedding k D X N r q).comp + (((I r).d (q+1) q).hom.restrictScalars k)) v) := by + rw [HomologicalComplex₂.d₂_eq _ _ i (by rfl : (c).Rel (q+1) q) n (by change i+q=n; omega)] + change ((((-1:ℤˣ)^i) • (((DB).map ((I r).d (q+1) q)).f i ≫ + (K (I r)).ιTotal c i q n (by change i+q=n; omega))) ≫ leadingTotalEmbedding k D X N r n).hom v = _ + erw [Linear.units_smul_comp, Category.assoc, leadingTotalEmbedding_ι] + change ((-1:ℤˣ)^i) • + outerCast k D X N _ + (outerBarSuffix k D X N ((I r).X q) (r+q) i (innerTotalEmbedding k D X N r q) + ((((DB).map ((I r).d (q+1) q)).f i).hom v)) = _ + rw [totalSign_smul k (D ⊗[k] term k A N (r+n)), outerBarSuffix_map] + +/-- Both total faces vanish at the respective zero degree by the actual chain shape. -/ +theorem leadingTotalEmbedding_d₁_zero (r n q : ℕ) : + (K (I r)).d₁ c 0 q n ≫ leadingTotalEmbedding k D X N r n = 0 := by + erw [HomologicalComplex₂.d₁_eq_zero _ _ _ _ _ (by simp), zero_comp] + +theorem leadingTotalEmbedding_d₂_zero (r n i : ℕ) : + (K (I r)).d₂ c i 0 n ≫ leadingTotalEmbedding k D X N r n = 0 := by + erw [HomologicalComplex₂.d₂_eq_zero _ _ _ _ _ (by simp), zero_comp] + +theorem leadingTotalEmbedding_ι_d (r n i q : ℕ) (h : i+q=n+1) : + (K (I r)).ιTotal c i q (n+1) h ≫ (barTotal k D (I r)).d (n+1) n ≫ + leadingTotalEmbedding k D X N r n = + (K (I r)).d₁ c i q n ≫ leadingTotalEmbedding k D X N r n + + (K (I r)).d₂ c i q n ≫ leadingTotalEmbedding k D X N r n := by + simp only [barTotal, HomologicalComplex₂.total_d] + erw [add_comp, comp_add, HomologicalComplex₂.ι_D₁_assoc, + HomologicalComplex₂.ι_D₂_assoc] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalEmbedding.lean b/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee72af8d3317466f26cf5763b75ab000b6a86b67 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/LeadingTotalEmbedding.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixCoefficient +import OAI.Algebra.Finitistic.Bar.LeadingBarSuffix + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local notation "I" => RecursiveTotal.iter B Z +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +/-- The exterior D bar is assembled on its actual finite totalization diagonal. -/ +def leadingTotalEmbedding (r n : ℕ) : + (barTotal k D (I r)).X n ⟶ ModuleCat.of D (D ⊗[k] term k A N (r+n)) := + totalMapDesc (𝟭 _) (barBicomplex k D (I r)) (fun i q h => + ModuleCat.ofHom ((outerCast k D X N (show (r+q)+i=r+n by omega)).comp + (outerBarSuffix k D X N ((I r).X q) (r+q) i (innerTotalEmbedding k D X N r q)))) + +@[reassoc (attr := simp)] theorem leadingTotalEmbedding_ι (r n i q : ℕ) (h : i+q=n) : + (barBicomplex k D (I r)).ιTotal c i q n h ≫ leadingTotalEmbedding k D X N r n = + ModuleCat.ofHom ((outerCast k D X N (show (r+q)+i=r+n by omega)).comp + (outerBarSuffix k D X N ((I r).X q) (r+q) i (innerTotalEmbedding k D X N r q))) := by + exact ι_totalMapDesc (𝟭 _) (barBicomplex k D (I r)) _ i q h + +/-- The independently recursive inner total is the previously constructed explicit multibar. -/ +theorem innerIter_eq_explicit (r : ℕ) : I r = explicitMultibar k D X r Z := by + induction r with + | zero => rfl + | succ r ih => + simp only [RecursiveTotal.iter, RecursiveTotal.bicomplex, ih, explicitMultibar, + BimoduleTensor.explicitBarTotal, BimoduleTensor.twoSidedBarBicomplex] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/LiteralMultibarCoordinates.lean b/lean/OAI/Algebra/Finitistic/Bar/LiteralMultibarCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..46327c9233be1d0b741767b5ead6c5f7dba2d163 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/LiteralMultibarCoordinates.lean @@ -0,0 +1,106 @@ +import OAI.Algebra.Finitistic.Bar.PatternTensorCoherence +import OAI.Algebra.Finitistic.Bar.MultibarFlattenDerived +import OAI.Algebra.Finitistic.Bar.RecursiveBlockIndex + +namespace OAI +open CategoryTheory TensorProduct +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.RecursiveTotal +open DerivedBar.Multibar +universe u + +/-- The final input degree, separated from all bar lengths. -/ +def inputDegree : (r : ℕ) → {n : ℕ} → Index r n → ℕ + | 0, n, _ => n + | r+1, _, ⟨_,t⟩ => inputDegree r t + +/-- The literal slots from the X bars, ordered outside to inside. -/ +def innerPattern : (r : ℕ) → {n : ℕ} → Index r n → List Bool + | 0, _, _ => [] + | r+1, _, ⟨p,t⟩ => true :: (List.replicate p.val.1 false ++ innerPattern r t) + +@[simp] theorem count_innerPattern (r n : ℕ) (t : Index r n) : + count (innerPattern r t) = r := by + induction r generalizing n with + | zero => rfl + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + simp [innerPattern, count, ih] + +theorem length_innerPattern (r n : ℕ) (t : Index r n) : + (innerPattern r t).length + inputDegree r t = r+n := by + induction r generalizing n with + | zero => rfl + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + have ht := ih q t + simp only [innerPattern, inputDegree, List.length_cons, List.length_append, + List.length_replicate] + omega + +/-- Leading internal D slots; the exterior D coefficient is kept separate. -/ +def leadingPattern (r n : ℕ) (t : Index (r+1) n) : List Bool := + List.replicate t.1.val.1 false ++ innerPattern r t.2 + +@[simp] theorem count_leadingPattern (r n : ℕ) (t : Index (r+1) n) : + count (leadingPattern r n t) = r := by + simp [leadingPattern] + +theorem length_leadingPattern (r n : ℕ) (t : Index (r+1) n) : + (leadingPattern r n t).length + inputDegree (r+1) t = r+n := by + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + have ht := length_innerPattern r q t + simp only [leadingPattern, inputDegree, List.length_append, List.length_replicate] + omega + +variable (k D X : 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] +local instance (N : ModuleCat.{u} D) : Module k N := BimoduleTensor.scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (Z : ChainComplex (ModuleCat.{u} D) ℕ) +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "c" => ComplexShape.down ℕ + +/-- Every inner summand is isomorphic, D-linearly, to its literal field tensor. -/ +def innerSummandIso : (r n : ℕ) → (t : Index r n) → + summand (fun _ => XB) Z r n t ≅ + ModuleCat.of D (patternTerm k D X (Z.X (inputDegree r t)) (innerPattern r t)) + | 0, _, _ => Iso.refl _ + | r+1, _, ⟨p,t⟩ => + (XB ⋙ HomologicalComplex.eval _ c p.val.1).mapIso (innerSummandIso r p.val.2 t) ≪≫ + twoSidedBarPatternIso k D X (Z.X (inputDegree r t)) p.val.1 (innerPattern r t) + +/-- The prefix of the leading sequence is exactly the sequence of X bars, +also at the literal summand level. -/ +theorem leadingSummand_prefix (r m n : ℕ) (h : m≤r) (t : Index m n) : + summand (leadingBarSequence k D X r) Z m n t = summand (fun _ => XB) Z m n t := by + induction m generalizing n with + | zero => rfl + | succ m ih => + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + change (degreeFunctor (leadingBarSequence k D X r) m i).obj _ = _ + simp only [degreeFunctor, leadingBarSequence, ite_eq_left (show m p.val.1 + | r+1, _, ⟨p,t⟩ => (p.val.1, moduleBlocks r t) + +theorem total_moduleBlocks (r n : ℕ) (t : Index (r+1) n) : + total r (moduleBlocks r t) + inputDegree (r+1) t = n := by + induction r generalizing n with + | zero => rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩; exact h + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + have ht := ih q t + change i + total r (moduleBlocks r t) + inputDegree (r+1) t = n + omega + +theorem pattern_moduleBlocks (r n : ℕ) (t : Index (r+1) n) : + pattern r (moduleBlocks r t) = leadingPattern r n t := by + induction r generalizing n with + | zero => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + simp [moduleBlocks, pattern, leadingPattern, innerPattern] + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + change List.replicate i false ++ true :: pattern r (moduleBlocks r t) = _ + rw [ih q t] + rfl + +/-- The recursive total index attached to a block tuple, with input degree zero. -/ +def moduleIndex : (r : ℕ) → (b : Blocks r) → Index (r+1) (total r b) + | 0, i => ⟨⟨⟨i,0⟩,by exact Nat.add_zero i⟩,()⟩ + | r+1, (i,b) => ⟨⟨⟨i,total r b⟩,rfl⟩,moduleIndex r b⟩ + +@[simp] theorem inputDegree_moduleIndex (r : ℕ) (b : Blocks r) : + inputDegree (r+1) (moduleIndex r b) = 0 := by + induction r with + | zero => rfl + | succ r ih => rcases b with ⟨i,b⟩; exact ih b + +@[simp] theorem moduleBlocks_moduleIndex (r : ℕ) (b : Blocks r) : + moduleBlocks r (moduleIndex r b) = b := by + induction r with + | zero => rfl + | succ r ih => rcases b with ⟨i,b⟩; change (i,moduleBlocks r (moduleIndex r b)) = _; rw [ih] + +@[simp] theorem inputDegree_castIndex {r n m : ℕ} (h : n=m) (t : Index r n) : + inputDegree r (castIndex h t) = inputDegree r t := by subst m; rfl + +@[simp] theorem moduleBlocks_castIndex {r n m : ℕ} (h : n=m) (t : Index (r+1) n) : + moduleBlocks r (castIndex h t) = moduleBlocks r t := by subst m; rfl + +/-- All indices are recovered from the blocks and input degree; no quotient of +block tensors or identification of distinct patterns is introduced. -/ +theorem moduleBlocks_injective (r n : ℕ) (t s : Index (r+1) n) + (ht : inputDegree (r+1) t=0) (hs : inputDegree (r+1) s=0) + (h : moduleBlocks r t=moduleBlocks r s) : t=s := by + induction r generalizing n with + | zero => + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + rcases s with ⟨⟨⟨j,p⟩,hp⟩,s⟩ + change q=0 at ht + change p=0 at hs + subst q p + have hij : i=j := by omega + subst j + cases t; cases s; rfl + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + rcases s with ⟨⟨⟨j,p⟩,hp⟩,s⟩ + change (i,moduleBlocks r t) = (j,moduleBlocks r s) at h + have hij := congrArg Prod.fst h + dsimp at hij + subst j + have hqp : q=p := by omega + subst p + have hts := ih q t s ht hs (congrArg Prod.snd h) + subst s + rfl + +/-- Exact module-input indexing by the manuscript's tuples of r+1 block lengths. -/ +def moduleBlockEquiv (r n : ℕ) : + {t : Index (r+1) n // inputDegree (r+1) t=0} ≃ + {b : Blocks r // total r b=n} where + toFun t := ⟨moduleBlocks r t.val, by + have h := total_moduleBlocks r n t.val + rw [t.property, Nat.add_zero] at h + exact h⟩ + invFun b := ⟨castIndex b.property (moduleIndex r b.val), by simp⟩ + left_inv t := by + apply Subtype.ext + apply moduleBlocks_injective r n _ _ (by simp) t.property + simp + right_inv b := by apply Subtype.ext; simp + +/-- Exact full-degree shape index, including the shift by the number of X slots. -/ +def moduleShapeEquiv (r n : ℕ) : + {t : Index (r+1) n // inputDegree (r+1) t=0} ≃ + Multibar.Indexed.Shape (r+n) r := + (moduleBlockEquiv r n).trans (Multibar.Indexed.blockDegreeEquiv r n) +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/ModuleMultibarCoordinates.lean b/lean/OAI/Algebra/Finitistic/Bar/ModuleMultibarCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..42aea3cdf81148db4d1c31c2aaac2c1e1f07f548 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/ModuleMultibarCoordinates.lean @@ -0,0 +1,107 @@ +import OAI.Algebra.Finitistic.Bar.ModuleBlockIndex +import OAI.Algebra.Finitistic.Bar.FiniteSumSupport + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.RecursiveTotal +open DerivedBar.Multibar +universe u +local instance (r n : ℕ) : DecidableEq (Index r n) := Classical.decEq _ +local instance (r n : ℕ) : DecidableEq (Multibar.Indexed.Shape r n) := Classical.decEq _ + +/-- The supported index change preserves the literal D/X word. -/ +theorem moduleShape_toList (r n : ℕ) + (t : {t : Index (r+1) n // inputDegree (r+1) t=0}) : + Multibar.Indexed.toList (moduleShapeEquiv r n t) = leadingPattern r n t.val := by + simp [moduleShapeEquiv, moduleBlockEquiv, Multibar.Indexed.blockDegreeEquiv, + pattern_moduleBlocks] + +section General +variable {D : Type u} [Ring D] +local notation "c" => ComplexShape.down ℕ + +/-- A zero input term remains zero through every additive bar degree functor. -/ +theorem summand_isZero + (B : ℕ → ModuleCat.{u} D ⥤ ChainComplex (ModuleCat.{u} D) ℕ) + [∀ r, (B r).Additive] (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (r n : ℕ) (t : Index r n) (h : IsZero (Z.X (inputDegree r t))) : + IsZero (summand B Z r n t) := by + induction r generalizing n with + | zero => exact h + | succ r ih => + rcases t with ⟨p,t⟩ + exact Functor.map_isZero (degreeFunctor B r p.val.1) (ih p.val.2 t h) + +end General +local notation "c" => ComplexShape.down ℕ +variable (k D X : 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] +local instance (N : ModuleCat.{u} D) : Module k N := BimoduleTensor.scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (N : ModuleCat.{u} D) +local notation "Z" => (Functor.obj (ChainComplex.single₀ (ModuleCat D)) N) + +/-- Positive final input degrees contribute zero, without any assumption on X. -/ +theorem moduleSummand_isZero (r n : ℕ) (t : Index (r+1) n) + (h : inputDegree (r+1) t ≠ 0) : + IsZero (summand (leadingBarSequence k D X r) Z (r+1) n t) := + summand_isZero _ Z _ _ t (HomologicalComplex.isZero_single_obj_X c 0 N _ h) + +/-- Each surviving recursive-total summand is the exact previously indexed +block tensor in degree r+n; the input is the original D-module. -/ +def moduleSummandIso (r n : ℕ) + (t : {t : Index (r+1) n // inputDegree (r+1) t=0}) : + summand (leadingBarSequence k D X r) Z (r+1) n t.val ≅ + ModuleCat.of D (Multibar.Indexed.outerTensor k D X N (moduleShapeEquiv r n t)) := by + have h : Multibar.Indexed.tensor k D X N (moduleShapeEquiv r n t) = + patternTerm k D X N (leadingPattern r n t.val) := by + rw [Multibar.Indexed.tensor_toList, moduleShape_toList] + have e : summand (leadingBarSequence k D X r) Z (r+1) n t.val ≅ + ModuleCat.of D (D ⊗[k] patternTerm k D X N (leadingPattern r n t.val)) := by + have hn : (Z).X (inputDegree (r+1) t.val) = N := by + rw [t.property] + rfl + exact leadingSummandIso k D X Z r n t.val ≪≫ eqToIso + (congrArg (fun V : ModuleCat D => ModuleCat.of D + (D ⊗[k] patternTerm k D X V (leadingPattern r n t.val))) hn) + exact e ≪≫ eqToIso (congrArg (fun V : ModuleCat k => ModuleCat.of D (D ⊗[k] V)) h.symm) + +/-- The exact block tensor after reindexing supported summands by Shape. -/ +def reindexedModuleSummandIso (r n : ℕ) (p : Multibar.Indexed.Shape (r+n) r) : + summand (leadingBarSequence k D X r) Z (r+1) n ((moduleShapeEquiv r n).symm p).val ≅ + ModuleCat.of D (Multibar.Indexed.outerTensor k D X N p) := by + exact moduleSummandIso k D X N r n ((moduleShapeEquiv r n).symm p) ≪≫ + eqToIso (congrArg (fun s : Multibar.Indexed.Shape (r+n) r => + ModuleCat.of D (Multibar.Indexed.outerTensor k D X N s)) + ((moduleShapeEquiv r n).apply_symm_apply p)) + +/-- All recursive-total terms are identified with the manuscript's exact finite +sum of tensor blocks. This includes discarding only proved zero input-degree terms. -/ +def moduleFlatCoordinates (r n : ℕ) : + (flatLeadingMultibar k D X Z r).X n ≅ + ModuleCat.of D (⨁ p : Multibar.Indexed.Shape (r+n) r, + Multibar.Indexed.outerTensor k D X N p) := by + let V := summand (leadingBarSequence k D X r) Z (r+1) n + let P := fun t : Index (r+1) n => inputDegree (r+1) t=0 + let e := moduleShapeEquiv r n + exact supportIso V P (moduleSummand_isZero k D X N r n) ≪≫ + (DirectSum.lequivCongrLeft D (M := fun t : {t // P t} => V t.val) e).toModuleIso ≪≫ + (DirectSum.congrLinearEquiv (fun p => + (reindexedModuleSummandIso k D X N r n p).toLinearEquiv)).toModuleIso + +/-- The degreewise tensor-block isomorphism for the actual recursive leading total. -/ +def leadingModuleCoordinates (r n : ℕ) : + (barTotal k D (explicitMultibar k D X r Z)).X n ≅ + ModuleCat.of D (⨁ p : Multibar.Indexed.Shape (r+n) r, + Multibar.Indexed.outerTensor k D X N p) := + (HomologicalComplex.eval _ c n).mapIso (flatLeadingMultibarIso k D X Z r).symm ≪≫ + moduleFlatCoordinates k D X N r n +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/MultibarBlocks.lean b/lean/OAI/Algebra/Finitistic/Bar/MultibarBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..c67517b33f4d17693b86f0e11cb4d91918eaa2c0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/MultibarBlocks.lean @@ -0,0 +1,217 @@ +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 diff --git a/lean/OAI/Algebra/Finitistic/Bar/MultibarDecomposition.lean b/lean/OAI/Algebra/Finitistic/Bar/MultibarDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..95e6e746a6c1a5b121d900e642c7bdc6855314d2 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/MultibarDecomposition.lean @@ -0,0 +1,224 @@ +import OAI.Algebra.Finitistic.Bar.MultibarIndex + +namespace OAI +open scoped TensorProduct DirectSum +open TensorProduct TrivSqZeroExt +noncomputable section + +namespace DerivedBar.Multibar.Indexed +universe u + +/-- A D/X pattern with length and X-count in its type, avoiding any degree casts. -/ +inductive Shape : ℕ → ℕ → Type + | nil : Shape 0 0 + | base {n r : ℕ} : Shape n r → Shape (n+1) r + | ideal {n r : ℕ} : Shape n r → Shape (n+1) (r+1) + +local instance (n r : ℕ) : DecidableEq (Shape n r) := Classical.decEq _ + +def toList : {n r : ℕ} → Shape n r → List Bool + | _, _, .nil => [] + | _, _, .base p => false :: toList p + | _, _, .ideal p => true :: toList p + +@[simp] theorem length_toList {n r : ℕ} (p : Shape n r) : (toList p).length = n := by + induction p <;> simp_all [toList] + +@[simp] theorem count_toList {n r : ℕ} (p : Shape n r) : count (toList p) = r := by + induction p <;> simp_all [toList, count] + +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] + +@[reducible] def tensor : {n r : ℕ} → Shape n r → ModuleCat k + | _, _, .nil => ModuleCat.of k N + | _, _, .base p => ModuleCat.of k (D ⊗[k] tensor p) + | _, _, .ideal p => ModuleCat.of k (X ⊗[k] tensor p) + +def inclusion : {n r : ℕ} → (p : Shape n r) → + tensor k D X N p →ₗ[k] DerivedBar.term k (TrivSqZeroExt D X) N n + | _, _, .nil => LinearMap.id + | _, _, .base p => TensorProduct.map (inlAlgHom k D X).toLinearMap (inclusion p) + | _, _, .ideal p => TensorProduct.map ((inrHom D X).restrictScalars k) (inclusion p) + +def retraction : {n r : ℕ} → (p : Shape n r) → + DerivedBar.term k (TrivSqZeroExt D X) N n →ₗ[k] tensor k D X N p + | _, _, .nil => LinearMap.id + | _, _, .base p => TensorProduct.map (fstHom k D X).toLinearMap (retraction p) + | _, _, .ideal p => TensorProduct.map ((sndHom D X).restrictScalars k) (retraction p) + +theorem retraction_inclusion {n r : ℕ} (p : Shape n r) (v : tensor k D X N p) : + retraction k D X N p (inclusion k D X N p v) = v := by + induction p with + | nil => rfl + | base p ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + change d ⊗ₜ[k] retraction k D X N p (inclusion k D X N p v) = _ + rw [ih] + | add v w hv hw => simp only [map_add, hv, hw] + | ideal p ih => + induction v using TensorProduct.inductionOn with + | tmul x v => + change x ⊗ₜ[k] retraction k D X N p (inclusion k D X N p v) = _ + rw [ih] + | add v w hv hw => simp only [map_add, hv, hw] + +/-- Distinct patterns are separated by slotwise projections, including non-flat bimodules. -/ +theorem retraction_other {n r : ℕ} (p q : Shape n r) (hpq : p ≠ q) + (v : tensor k D X N q) : retraction k D X N p (inclusion k D X N q v) = 0 := by + induction p with + | nil => cases q; exact (hpq rfl).elim + | base p ih => + cases q with + | base q => + have h : p ≠ q := fun h => hpq (congrArg Shape.base h) + induction v using TensorProduct.inductionOn with + | tmul d v => + change d ⊗ₜ[k] retraction k D X N p (inclusion k D X N q v) = 0 + rw [ih q h, TensorProduct.tmul_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + | ideal q => + induction v using TensorProduct.inductionOn with + | tmul x v => exact TensorProduct.zero_tmul _ _ + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + | ideal p ih => + cases q with + | base q => + induction v using TensorProduct.inductionOn with + | tmul d v => exact TensorProduct.zero_tmul _ _ + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + | ideal q => + have h : p ≠ q := fun h => hpq (congrArg Shape.ideal h) + induction v using TensorProduct.inductionOn with + | tmul x v => + change x ⊗ₜ[k] retraction k D X N p (inclusion k D X N q v) = 0 + rw [ih q h, TensorProduct.tmul_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + +theorem inclusion_mem {n r : ℕ} (p : Shape n r) (v : tensor k D X N p) : + inclusion k D X N p v ∈ SquareZero.weight k D X N n r := by + induction p with + | nil => exact Submodule.subset_span (SquareZero.Word.nil v) + | base p ih => + induction v using TensorProduct.inductionOn with + | tmul d v => exact SquareZero.base_tmul_mem d (ih v) + | add v w hv hw => simpa only [map_add] using Submodule.add_mem _ hv hw + | ideal p ih => + induction v using TensorProduct.inductionOn with + | tmul x v => exact SquareZero.ideal_tmul_mem x (ih v) + | add v w hv hw => simpa only [map_add] using Submodule.add_mem _ hv hw + +/-- Every homogeneous word is an actual tensor in one of the prescribed blocks. -/ +theorem word_inclusion {n r : ℕ} {z : DerivedBar.term k (TrivSqZeroExt D X) N n} + (hz : SquareZero.Word k D X N n r z) : + ∃ (p : Shape n r) (v : tensor k D X N p), inclusion k D X N p v = z := by + induction hz with + | nil v => exact ⟨.nil, v, rfl⟩ + | base d h ih => + obtain ⟨p, v, hv⟩ := ih + exact ⟨.base p, d ⊗ₜ[k] v, by change (inl d : TrivSqZeroExt D X) ⊗ₜ[k] _ = _; rw [hv]⟩ + | ideal x h ih => + obtain ⟨p, v, hv⟩ := ih + exact ⟨.ideal p, x ⊗ₜ[k] v, by change (inr x : TrivSqZeroExt D X) ⊗ₜ[k] _ = _; rw [hv]⟩ + +abbrev outerTensor {n r : ℕ} (p : Shape n r) := D ⊗[k] tensor k D X N p + +def outerInclusion {n r : ℕ} (p : Shape n r) : outerTensor k D X N p →ₗ[D] + D ⊗[k] DerivedBar.term k (TrivSqZeroExt D X) N n := + AlgebraTensorModule.lTensor D D (inclusion k D X N p) + +def outerRetraction {n r : ℕ} (p : Shape n r) : + D ⊗[k] DerivedBar.term k (TrivSqZeroExt D X) N n →ₗ[D] outerTensor k D X N p := + AlgebraTensorModule.lTensor D D (retraction k D X N p) + +theorem outerRetraction_inclusion {n r : ℕ} (p : Shape n r) (v : outerTensor k D X N p) : + outerRetraction k D X N p (outerInclusion k D X N p v) = v := by + induction v using TensorProduct.inductionOn with + | tmul d v => + change d ⊗ₜ[k] retraction k D X N p (inclusion k D X N p v) = _ + rw [retraction_inclusion] + | add v w hv hw => simp only [map_add, hv, hw] + +theorem outerRetraction_other {n r : ℕ} (p q : Shape n r) (hpq : p ≠ q) + (v : outerTensor k D X N q) : + outerRetraction k D X N p (outerInclusion k D X N q v) = 0 := by + induction v using TensorProduct.inductionOn with + | tmul d v => + change d ⊗ₜ[k] retraction k D X N p (inclusion k D X N q v) = 0 + rw [retraction_other k D X N p q hpq, TensorProduct.tmul_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + +theorem outerInclusion_mem {n r : ℕ} (p : Shape n r) (v : outerTensor k D X N p) : + outerInclusion k D X N p v ∈ SquareZero.twoSidedWeight k D X N n r := by + induction v using TensorProduct.inductionOn with + | tmul d v => exact SquareZero.tensor_weight_mem d (inclusion_mem k D X N p v) + | add v w hv hw => simpa only [map_add] using Submodule.add_mem _ hv hw + +/-- The actual sum of all tensor-block inclusions in count r and degree n. -/ +def assemble (n r : ℕ) : (⨁ p : Shape n r, outerTensor k D X N p) →ₗ[D] + SquareZero.twoSidedWeight k D X N n r := + DirectSum.toModule D (Shape n r) _ (fun p => + (outerInclusion k D X N p).codRestrict _ (outerInclusion_mem k D X N p)) + +/-- Surjectivity is proved from the original homogeneous-word spanning definition. -/ +theorem assemble_surjective (n r : ℕ) : Function.Surjective (assemble k D X N n r) := by + let S := LinearMap.range (assemble k D X N n r) + have hle : SquareZero.twoSidedWeight k D X N n r ≤ + S.map (SquareZero.twoSidedWeight k D X N n r).subtype := by + apply Submodule.span_le.mpr + rintro z ⟨d, v, hv, rfl⟩ + obtain ⟨p, w, hw⟩ := word_inclusion k D X N hv + refine ⟨assemble k D X N n r (DirectSum.lof D _ _ p (d ⊗ₜ[k] w)), ⟨_, rfl⟩, ?_⟩ + simp only [assemble, DirectSum.toModule_lof, LinearMap.codRestrict_apply, + Submodule.subtype_apply] + change d ⊗ₜ[k] inclusion k D X N p w = d ⊗ₜ[k] v + rw [hw] + intro v + obtain ⟨w, ⟨z, hz⟩, hw⟩ := hle v.property + refine ⟨z, ?_⟩ + apply Subtype.ext + rw [hz] + exact hw + +/-- Projection onto an actual block after summation recovers the direct-sum component. -/ +theorem outerRetraction_assemble (n r : ℕ) (p : Shape n r) + (z : ⨁ p : Shape n r, outerTensor k D X N p) : + outerRetraction k D X N p (assemble k D X N n r z) = z p := by + have h : (outerRetraction k D X N p).comp + ((SquareZero.twoSidedWeight k D X N n r).subtype.comp (assemble k D X N n r)) = + DirectSum.component D (Shape n r) (outerTensor k D X N) p := by + apply DirectSum.linearMap_ext + intro q + apply LinearMap.ext + intro v + by_cases hpq : p = q + · subst q + simpa only [LinearMap.comp_apply, assemble, DirectSum.toModule_lof, + LinearMap.codRestrict_apply, Submodule.subtype_apply, + DirectSum.component.lof_self] using + outerRetraction_inclusion k D X N p v + · simpa only [LinearMap.comp_apply, assemble, DirectSum.toModule_lof, + LinearMap.codRestrict_apply, Submodule.subtype_apply, + DirectSum.component.of, Ne.symm hpq, dite_eq_right, dite_false] using + outerRetraction_other k D X N p q hpq v + exact LinearMap.congr_fun h z + +/-- The block direct sum is linearly isomorphic to the entire actual count submodule. -/ +def decomposition (n r : ℕ) : (⨁ p : Shape n r, outerTensor k D X N p) ≃ₗ[D] + SquareZero.twoSidedWeight k D X N n r := + LinearEquiv.ofBijective (assemble k D X N n r) + ⟨by + intro z w h + apply DFinsupp.ext + intro p + rw [← outerRetraction_assemble k D X N n r p z, + ← outerRetraction_assemble k D X N n r p w, h], + assemble_surjective k D X N n r⟩ +end DerivedBar.Multibar.Indexed + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/MultibarFlattenDerived.lean b/lean/OAI/Algebra/Finitistic/Bar/MultibarFlattenDerived.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ddd650950466fc53ac472318401030130d4abb9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/MultibarFlattenDerived.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveTotalDifferential +import OAI.Algebra.Finitistic.Bar.BarAdditive +import OAI.Algebra.Finitistic.Bar.TotalBarDerived + +namespace OAI +open CategoryTheory +noncomputable section +namespace DerivedBar +universe u +variable (k D X : 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] +local notation "c" => ComplexShape.down ℕ + +/-- The actual sequence of two-sided X bars, ending in one leading free D bar. -/ +def leadingBarSequence (r j : ℕ) : + ModuleCat.{u} D ⥤ ChainComplex (ModuleCat.{u} D) ℕ := + if j infer_instance + +variable (Z : ChainComplex (ModuleCat.{u} D) ℕ) + +/-- Before the final D bar, the actual recursive complexes agree. -/ +theorem leadingBarSequence_prefix (r n : ℕ) (h : n≤r) : + RecursiveTotal.iter (leadingBarSequence k D X r) Z n = explicitMultibar k D X n Z := by + induction n with + | zero => rfl + | succ n ih => + have hn : n Nat.succ i + | r+1, (i, tail), j => + Fin.cases (i+1, tail) (fun j => (i, increment r tail j)) j + +/-- Number of D entries strictly before block j, the ordinary totalization offset. -/ +def blockOffset : (r : ℕ) → Blocks r → Fin (r+1) → ℕ + | 0, _, _ => 0 + | r+1, (i, tail), j => Fin.cases 0 (fun j => i + blockOffset r tail j) j + +/-- The degree drops by one under a nonzero face in any block. -/ +theorem total_increment (r : ℕ) (b : Blocks r) (j : Fin (r+1)) : + total r (increment r b j) = total r b + 1 := by + induction r with + | zero => rfl + | succ r ih => + rcases b with ⟨i, tail⟩ + refine Fin.cases ?_ (fun j => ?_) j + · change (i+1) + total r tail = i + total r tail + 1 + omega + · change i + total r (increment r tail j) = i + total r tail + 1 + rw [ih] + omega + +/-- The exponent changes by r-j when a face removes a D slot in block j. -/ +theorem exponent_increment (r : ℕ) (b : Blocks r) (j : Fin (r+1)) : + exponent r (increment r b j) = exponent r b + (r-j.val) := by + induction r with + | zero => simp [exponent] + | succ r ih => + rcases b with ⟨i, tail⟩ + refine Fin.cases ?_ (fun j => ?_) j + · change (r+1) * (i+1) + exponent r tail = (r+1) * i + exponent r tail + (r+1) + simp only [Nat.mul_add, Nat.mul_one] + omega + · change (r+1) * i + exponent r (increment r tail j) = + (r+1) * i + exponent r tail + ((r+1) - (j.val+1)) + rw [ih] + omega + +/-- Equality of the actual scalar coefficients for each signed block face. +The left side applies the rescaling followed by the shifted multibar sign; +the right side applies the absolute bar sign followed by the target rescaling. +`ell` is the local bar-face number, and the offset `blockOffset` counts earlier D slots. -/ +theorem face_sign {k : Type*} [Field k] (r : ℕ) (b : Blocks r) + (j : Fin (r+1)) (ell : ℕ) : + (-1 : k)^(exponent r (increment r b j)) * + (-1 : k)^(r + blockOffset r b j + ell) = + (-1 : k)^(j.val + blockOffset r b j + ell) * (-1 : k)^(exponent r b) := by + rw [exponent_increment, ← pow_add, ← pow_add] + have hj : j.val ≤ r := by omega + have he : exponent r b + (r-j.val) + (r + blockOffset r b j + ell) = + j.val + blockOffset r b j + ell + exponent r b + 2*(r-j.val) := by omega + rw [he, pow_add, pow_mul] + simp + +/-- Raise the first block length. -/ +def leadingBase : (r : ℕ) → Blocks r → Blocks r + | 0, i => Nat.succ i + | _+1, (i, tail) => (i+1, tail) + +@[simp] theorem pattern_leadingBase (r : ℕ) (b : Blocks r) : + pattern r (leadingBase r b) = false :: pattern r b := by + cases r with + | zero => exact List.replicate_succ + | succ r => rcases b with ⟨i, tail⟩ + simp [leadingBase, pattern, List.replicate_succ] + +/-- Parse any word into its unique consecutive D blocks. -/ +def parse : (p : List Bool) → Blocks (count p) + | [] => (0 : ℕ) + | false :: p => leadingBase (count p) (parse p) + | true :: p => (0, parse p) + +/-- Every D/X word has a block-length description, including zero-length blocks. -/ +@[simp] theorem pattern_parse (p : List Bool) : pattern (count p) (parse p) = p := by + induction p with + | nil => rfl + | cons b p ih => + cases b <;> simp [parse, count, pattern, ih] + +/-- Block indices of bounded total degree form a finite type. -/ +theorem finite_bounded (r m : ℕ) : Finite {b : Blocks r // total r b ≤ m} := by + induction r with + | zero => + exact Finite.of_injective (fun b => (⟨b.val, Nat.lt_succ_of_le b.property⟩ : Fin (m+1))) + (fun a b h => Subtype.ext (Fin.mk.inj h)) + | succ r ih => + have := ih + let f : {b : Blocks (r+1) // total (r+1) b ≤ m} → + Fin (m+1) × {b : Blocks r // total r b ≤ m} := fun b => + (⟨b.val.1, by have h := b.property; change b.val.1 + total r b.val.2 ≤ m at h; omega⟩, + ⟨b.val.2, by have h := b.property; change b.val.1 + total r b.val.2 ≤ m at h; omega⟩) + apply Finite.of_injective f + intro a b h + apply Subtype.ext + apply Prod.ext + · exact Fin.mk.inj (congrArg Prod.fst h) + · exact congrArg Subtype.val (congrArg Prod.snd h) + +/-- The fixed-r multibar uses finitely many block tensors in every total degree. -/ +theorem finite_degree (r n : ℕ) : Finite {b : Blocks r // r + total r b = n} := by + have := finite_bounded r n + exact Finite.of_injective + (fun b : {b : Blocks r // r + total r b = n} => + (⟨b.val, by have h := b.property; omega⟩ : {b : Blocks r // total r b ≤ n})) + (fun a b h => Subtype.ext (congrArg (fun x : {b : Blocks r // total r b ≤ n} => x.val) h)) +end DerivedBar.Multibar + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/MultibarSigns.lean b/lean/OAI/Algebra/Finitistic/Bar/MultibarSigns.lean new file mode 100644 index 0000000000000000000000000000000000000000..81afcec089bf5f3998eaabfdd08d0f2a7ff9aac3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/MultibarSigns.lean @@ -0,0 +1,146 @@ +import OAI.Algebra.Finitistic.Bar.Splitting + +namespace OAI +open scoped TensorProduct +open TensorProduct TrivSqZeroExt +noncomputable section + +namespace DerivedBar.SquareZero +universe u + +private theorem sign_square {k : Type u} [Field k] (r : ℕ) : + (-1 : k)^r * (-1 : k)^r = 1 := by + rw [← mul_pow] + simp + +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] + +/-- Projection to count r, rescaled by one minus sign per base/ideal inversion. +For block lengths i₀,...,iᵣ the exponent is Σⱼ (r-j)iⱼ. -/ +def signedProjection : (n r : ℕ) → Module.End k (term k (TrivSqZeroExt D X) N n) + | 0, 0 => LinearMap.id + | 0, _+1 => 0 + | n+1, 0 => TensorProduct.map (baseProjection k D X) (signedProjection n 0) + | n+1, r+1 => (-1 : k)^(r+1) • + TensorProduct.map (baseProjection k D X) (signedProjection n (r+1)) + + TensorProduct.map (idealProjection k D X) (signedProjection n r) + +@[simp] theorem signedProjection_base (n r : ℕ) (d : D) + (v : term k (TrivSqZeroExt D X) N n) : + signedProjection k D X N (n+1) r ((inl d : TrivSqZeroExt D X) ⊗ₜ[k] v) = + (-1 : k)^r • ((inl d : TrivSqZeroExt D X) ⊗ₜ[k] + signedProjection k D X N n r v) := by + cases r <;> simp [signedProjection] + +@[simp] theorem signedProjection_ideal_zero (n : ℕ) (x : X) + (v : term k (TrivSqZeroExt D X) N n) : + signedProjection k D X N (n+1) 0 ((inr x : TrivSqZeroExt D X) ⊗ₜ[k] v) = 0 := by + simp [signedProjection] + +@[simp] theorem signedProjection_ideal_succ (n r : ℕ) (x : X) + (v : term k (TrivSqZeroExt D X) N n) : + signedProjection k D X N (n+1) (r+1) ((inr x : TrivSqZeroExt D X) ⊗ₜ[k] v) = + (inr x : TrivSqZeroExt D X) ⊗ₜ[k] signedProjection k D X N n r v := by + simp [signedProjection] + +variable {k D X N} + +/-- The rescaling stays inside the actual count subspace. -/ +theorem signedProjection_word_mem {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} + (hv : Word k D X N n r v) : + signedProjection k D X N n r v ∈ weight k D X N n r := by + induction hv with + | nil v => exact Submodule.subset_span (Word.nil v) + | base d h ih => + rw [signedProjection_base] + exact Submodule.smul_mem _ _ (base_tmul_mem d ih) + | ideal x h ih => + rw [signedProjection_ideal_succ] + exact ideal_tmul_mem x ih + +/-- The sign rescaling is its own inverse on homogeneous pure tensors. -/ +theorem signedProjection_sq_word {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} + (hv : Word k D X N n r v) : + signedProjection k D X N n r (signedProjection k D X N n r v) = v := by + induction hv with + | nil v => rfl + | @base n r v d h ih => + rw [signedProjection_base, map_smul, signedProjection_base, ih, smul_smul, + sign_square, one_smul] + | @ideal n r v x h ih => + rw [signedProjection_ideal_succ, signedProjection_ideal_succ, ih] + +theorem signedProjection_mem {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : + signedProjection k D X N n r v ∈ weight k D X N n r := by + have h : weight k D X N n r ≤ + (weight k D X N n r).comap (signedProjection k D X N n r) := + Submodule.span_le.mpr (fun _ hw => signedProjection_word_mem hw) + exact h hv + +/-- Involutivity holds on the entire submodule, including sums of block tensors. -/ +theorem signedProjection_sq {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : + signedProjection k D X N n r (signedProjection k D X N n r v) = v := by + have h : weight k D X N n r ≤ + ((signedProjection k D X N n r).comp (signedProjection k D X N n r) - + LinearMap.id).ker := by + apply Submodule.span_le.mpr + intro w hw + change signedProjection k D X N n r (signedProjection k D X N n r w) - w = 0 + rw [signedProjection_sq_word hw, sub_self] + exact sub_eq_zero.mp (h hv) + +variable (k D X N) + +/-- The signed count operator preserves the exterior left D-action. -/ +def twoSidedSignedProjection (n r : ℕ) : + Module.End D (D ⊗[k] term k (TrivSqZeroExt D X) N n) := + AlgebraTensorModule.lTensor D D (signedProjection k D X N n r) + +variable {k D X N} + +theorem twoSidedSignedProjection_mem {n r : ℕ} + {v : D ⊗[k] term k (TrivSqZeroExt D X) N n} + (hv : v ∈ twoSidedWeight k D X N n r) : + twoSidedSignedProjection k D X N n r v ∈ twoSidedWeight k D X N n r := by + have h : twoSidedWeight k D X N n r ≤ + (twoSidedWeight k D X N n r).comap (twoSidedSignedProjection k D X N n r) := by + apply Submodule.span_le.mpr + rintro w ⟨d, z, hz, rfl⟩ + exact tensor_weight_mem d (signedProjection_word_mem hz) + exact h hv + +theorem twoSidedSignedProjection_sq {n r : ℕ} + {v : D ⊗[k] term k (TrivSqZeroExt D X) N n} + (hv : v ∈ twoSidedWeight k D X N n r) : + twoSidedSignedProjection k D X N n r (twoSidedSignedProjection k D X N n r v) = v := by + have h : twoSidedWeight k D X N n r ≤ + ((twoSidedSignedProjection k D X N n r).comp + (twoSidedSignedProjection k D X N n r) - LinearMap.id).ker := by + apply Submodule.span_le.mpr + rintro w ⟨d, z, hz, rfl⟩ + change d ⊗ₜ[k] signedProjection k D X N n r (signedProjection k D X N n r z) - + d ⊗ₜ[k] z = 0 + rw [signedProjection_sq_word hz, sub_self] + exact sub_eq_zero.mp (h hv) + +variable (k D X N) + +/-- Actual D-linear involution giving the manuscript's component rescaling. +This alone is not the chain comparison or the derived tensor identification. -/ +def signEquiv (n r : ℕ) : twoSidedWeight k D X N n r ≃ₗ[D] + twoSidedWeight k D X N n r where + toLinearMap := (twoSidedSignedProjection k D X N n r).restrict + (fun _ hv => twoSidedSignedProjection_mem hv) + invFun v := ⟨twoSidedSignedProjection k D X N n r v, twoSidedSignedProjection_mem v.property⟩ + left_inv v := Subtype.ext (twoSidedSignedProjection_sq v.property) + right_inv v := Subtype.ext (twoSidedSignedProjection_sq v.property) +end DerivedBar.SquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/PatternPrefixCoordinates.lean b/lean/OAI/Algebra/Finitistic/Bar/PatternPrefixCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..a37c3f649848191189861695ffde4c569e3d2cc3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/PatternPrefixCoordinates.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.Finitistic.Bar.PatternSuffixFaces +import OAI.Algebra.Finitistic.Bar.PatternTensorCoherence + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar +universe u +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] [Module D N] [IsScalarTower k D N] +local notation "A" => TrivSqZeroExt D X +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + + +omit [Module Dᵐᵒᵖ X] [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] + [Module A N] [IsScalarTower k A N] in +/-- Prefix coordinates act literally on each tensor generator. -/ +theorem termPatternIso_hom_tmul (i : ℕ) (p : List Bool) (d : D) + (v : term k D (patternTerm k D X N p) i) : + (termPatternIso k D X N (i+1) p).hom.hom (d ⊗ₜ[k] v) = + d ⊗ₜ[k] (termPatternIso k D X N i p).hom.hom v := rfl + +omit [Module A N] [IsScalarTower k A N] in +/-- The recursive suffix embedding is exactly the existing literal block embedding, +with every degree cast exposed. -/ +theorem embed_termPatternIso (i : ℕ) (p : List Bool) + (v : term k D (patternTerm k D X N p) i) : + embed k D X N (List.replicate i false ++ p) + ((termPatternIso k D X N i p).hom.hom v) = + termCast k D X N (show p.length+i=(List.replicate i false ++ p).length by simp; omega) + (suffixEmbed k D X N (patternTerm k D X N p) p.length (embed k D X N p) i v) := by + induction i with + | zero => rfl + | succ i ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [termPatternIso_hom_tmul, suffixEmbed_tmul] + change (inl d : A) ⊗ₜ[k] + embed k D X N (List.replicate i false ++ p) ((termPatternIso k D X N i p).hom.hom v) = _ + rw [ih] + exact (termCast_tmul k D X N + (show p.length+i=(List.replicate i false ++ p).length by simp; omega) + (show (p.length+i)+1=(List.replicate i false ++ p).length+1 by simp; omega) + (inl d) (suffixEmbed k D X N _ p.length (embed k D X N p) i v)).symm + | add v w hv hw => simp only [map_add, hv, hw] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/PatternSuffixFaces.lean b/lean/OAI/Algebra/Finitistic/Bar/PatternSuffixFaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfb4d6549392b3f195581d43dbea45e8789a8975 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/PatternSuffixFaces.lean @@ -0,0 +1,90 @@ +import OAI.Algebra.Finitistic.Bar.SuffixParityFaces +import OAI.Algebra.Finitistic.Bar.PatternTensorCoherence + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar +universe u +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] [Module D N] [IsScalarTower k D N] +local notation "A" => TrivSqZeroExt D X +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + +omit [IsScalarTower k D N] [IsScalarTower k A N] in +/-- Every literal recursive suffix has its original D action. -/ +theorem patternEmbed_smul (p : List Bool) + (hbase : ∀ (d : D) (v : N), (inl d : A) • v = d • v) + (d : D) (v : patternTerm k D X N p) : + embed k D X N p (d • v) = (inl d : A) • embed k D X N p v := by + cases p with + | nil => exact (hbase d v).symm + | cons b p => + cases b <;> induction v using TensorProduct.inductionOn with + | tmul a v => + first + | change (inl (d*a) : A) ⊗ₜ[k] _ = ((inl d : A)*inl a) ⊗ₜ[k] _ + rw [inl_mul_inl] + | change (inr (d • a) : A) ⊗ₜ[k] _ = ((inl d : A)*inr a) ⊗ₜ[k] _ + rw [inl_mul_inr] + | add v w hv hw => simp only [smul_add, map_add, hv, hw] + +omit [Module D N] [IsScalarTower k D N] [IsScalarTower k A N] in +/-- The leading X annihilates any X-leading suffix, irrespective of later blocks. -/ +theorem patternEmbed_ideal_zero (p : List Bool) (x : X) + (v : patternTerm k D X N (true :: p)) : + (inr x : A) • embed k D X N (true :: p) v = 0 := by + induction v using TensorProduct.inductionOn with + | tmul y v => + change ((inr x : A)*inr y) ⊗ₜ[k] _ = 0 + rw [inr_mul_inr, TensorProduct.zero_tmul] + | add v w hv hw => simp only [map_add, smul_add, hv, hw, add_zero] + +omit [Module D N] [IsScalarTower k D N] [IsScalarTower k A N] in +/-- Compatibility of every X-leading recursive suffix needs no condition at N. -/ +theorem idealPatternEmbed_smul (p : List Bool) (d : D) + (v : patternTerm k D X N (true :: p)) : + embed k D X N (true :: p) (d • v) = + (inl d : A) • embed k D X N (true :: p) v := by + induction v using TensorProduct.inductionOn with + | tmul x v => + change (inr (d • x) : A) ⊗ₜ[k] _ = ((inl d : A)*inr x) ⊗ₜ[k] _ + rw [inl_mul_inr] + | add v w hv hw => simp only [map_add, smul_add, hv, hw] + +omit [Module D N] [IsScalarTower k D N] in +/-- All later X and D blocks are admitted literally, with no assumed chain comparison. -/ +theorem parity_recursiveSuffix (p : List Bool) (n : ℕ) + (v : X ⊗[k] term k D (patternTerm k D X N (true :: p)) (n+1)) : + let M := patternTerm k D X N (true :: p) + let e := embed k D X N (true :: p) + SquareZero.multibarAugmentedDifferential k D X N (((p.length+1)+n)+1) + (idealSuffixEmbed k D X N M (p.length+1) (n+1) e v) = + -idealSuffixEmbed k D X N M (p.length+1) n e (BimoduleTensor.barDifferential k D X M n v) + + (-1 : k)^(n+1) • termCast k D X N + (show (p.length+(n+1))+1=((p.length+1)+n)+1 by omega) + (idealSuffixEmbed k D X N M p.length (n+1) + ((SquareZero.multibarAugmentedDifferential k D X N p.length).comp e) v) := by + exact parity_idealSuffixEmbed k D X N _ p.length n _ + (idealPatternEmbed_smul k D X N p) v + +omit [Module D N] [IsScalarTower k D N] in +/-- Empty intervening D blocks retain exactly the later suffix differential. -/ +theorem parity_recursiveSuffix_zero (p : List Bool) + (v : X ⊗[k] patternTerm k D X N (true :: p)) : + SquareZero.multibarAugmentedDifferential k D X N (p.length+1) + (idealSuffixEmbed k D X N _ (p.length+1) 0 (embed k D X N (true :: p)) v) = + idealSuffixEmbed k D X N _ p.length 0 + ((SquareZero.multibarAugmentedDifferential k D X N p.length).comp + (embed k D X N (true :: p))) v := by + exact parity_idealSuffixEmbed_zero k D X N _ p.length _ + (patternEmbed_ideal_zero k D X N p) v +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/PatternTensorCoherence.lean b/lean/OAI/Algebra/Finitistic/Bar/PatternTensorCoherence.lean new file mode 100644 index 0000000000000000000000000000000000000000..af6789e1ba4c1743e8a7ed859dbfc3eef99bce68 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/PatternTensorCoherence.lean @@ -0,0 +1,84 @@ +import OAI.Algebra.Finitistic.Bar.MultibarBlocks +import OAI.Algebra.Finitistic.Bar.TwoSidedBarFunctor + +namespace OAI +open CategoryTheory TensorProduct +open scoped TensorProduct +noncomputable section +namespace DerivedBar.Multibar +universe u +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] [Module D N] [IsScalarTower k D N] + +/-- The exterior D action on a literal pattern is the action on its first slot. -/ +@[reducible] instance patternModule : (p : List Bool) → Module D (patternTerm k D X N p) + | [] => inferInstanceAs (Module D N) + | false :: p => inferInstanceAs (Module D (D ⊗[k] patternTerm k D X N p)) + | true :: p => inferInstanceAs (Module D (X ⊗[k] patternTerm k D X N p)) + +instance patternTower : (p : List Bool) → IsScalarTower k D (patternTerm k D X N p) + | [] => inferInstanceAs (IsScalarTower k D N) + | false :: p => inferInstanceAs (IsScalarTower k D (D ⊗[k] patternTerm k D X N p)) + | true :: p => inferInstanceAs (IsScalarTower k D (X ⊗[k] patternTerm k D X N p)) + +omit [Module D X] [Module Dᵐᵒᵖ X] [SMulCommClass D Dᵐᵒᵖ X] + [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] [Module D N] [IsScalarTower k D N] in +/-- Prefixing i D slots is literally the i-fold free bar term. -/ +theorem term_pattern (i : ℕ) (p : List Bool) : + DerivedBar.term k D (patternTerm k D X N p) i = + patternTerm k D X N (List.replicate i false ++ p) := by + induction i with + | zero => rfl + | succ i ih => + simpa only [DerivedBar.term, List.replicate_succ, List.cons_append, patternTerm] using + congrArg (fun V : ModuleCat k => ModuleCat.of k (D ⊗[k] V)) ih + +/-- Exterior actions agree as well as the underlying field-tensor modules. -/ +def termPatternIso (i : ℕ) (p : List Bool) : + ModuleCat.of D (DerivedBar.term k D (patternTerm k D X N p) i) ≅ + ModuleCat.of D (patternTerm k D X N (List.replicate i false ++ p)) := by + induction i with + | zero => exact Iso.refl _ + | succ i ih => + let e := ih.toLinearEquiv + exact (AlgebraTensorModule.congr (LinearEquiv.refl D D) (e.restrictScalars k)).toModuleIso + +/-- Coherence between canonical categorical scalars and supplied compatible scalars. -/ +def freeBarObjIso (V : Type u) [AddCommGroup V] [Module k V] + [Module D V] [IsScalarTower k D V] (i : ℕ) : + ((DerivedBar.barFunctor k D).obj (ModuleCat.of D V)).X i ≅ + ModuleCat.of D (DerivedBar.term k D V (i+1)) := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + exact Iso.refl _ + +/-- The same coherence for arbitrary X bimodule coefficients. -/ +def twoSidedBarObjIso (V : Type u) [AddCommGroup V] [Module k V] + [Module D V] [IsScalarTower k D V] (i : ℕ) : + ((BimoduleTensor.twoSidedBarFunctor k D X).obj (ModuleCat.of D V)).X i ≅ + ModuleCat.of D (X ⊗[k] DerivedBar.term k D V i) := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + exact Iso.refl _ + +/-- Coherence of a free bar term with a literal leading block. -/ +def freeBarPatternIso (i : ℕ) (p : List Bool) : + ((DerivedBar.barFunctor k D).obj (ModuleCat.of D (patternTerm k D X N p))).X i ≅ + ModuleCat.of D (patternTerm k D X N (List.replicate (i+1) false ++ p)) := + freeBarObjIso k D (patternTerm k D X N p) i ≪≫ termPatternIso k D X N (i+1) p + +/-- Coherence of a two-sided bar term with its literal X and D slots. -/ +def twoSidedBarPatternIso (i : ℕ) (p : List Bool) : + ((BimoduleTensor.twoSidedBarFunctor k D X).obj + (ModuleCat.of D (patternTerm k D X N p))).X i ≅ + ModuleCat.of D (patternTerm k D X N (true :: (List.replicate i false ++ p))) := + twoSidedBarObjIso k D X (patternTerm k D X N p) i ≪≫ + (AlgebraTensorModule.congr (LinearEquiv.refl D X) + ((termPatternIso k D X N i p).toLinearEquiv.restrictScalars k)).toModuleIso +end DerivedBar.Multibar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/Projection.lean b/lean/OAI/Algebra/Finitistic/Bar/Projection.lean new file mode 100644 index 0000000000000000000000000000000000000000..985b933692e34e1d5b607f9eba23fc0d2fb9f870 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/Projection.lean @@ -0,0 +1,168 @@ +import OAI.Algebra.Finitistic.Bar.TwoSidedWeight +import Mathlib.Algebra.BigOperators.Module + +namespace OAI +open scoped TensorProduct +open TensorProduct CategoryTheory TrivSqZeroExt +noncomputable section + +namespace DerivedBar.SquareZero +universe u +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] + +def baseProjection : Module.End k (TrivSqZeroExt D X) := + (inlAlgHom k D X).toLinearMap.comp (fstHom k D X).toLinearMap + +def idealProjection : Module.End k (TrivSqZeroExt D X) := + LinearMap.id - baseProjection k D X + +@[simp] theorem baseProjection_inl (d : D) : + baseProjection k D X (inl d) = inl d := rfl +@[simp] theorem baseProjection_inr (x : X) : + baseProjection k D X (inr x) = 0 := rfl +@[simp] theorem idealProjection_inl (d : D) : + idealProjection k D X (inl d) = 0 := by simp [idealProjection] +@[simp] theorem idealProjection_inr (x : X) : + idealProjection k D X (inr x) = inr x := by simp [idealProjection] + +/-- The actual linear projection onto words with a prescribed X-count. -/ +def projection : (n r : ℕ) → Module.End k (term k (TrivSqZeroExt D X) N n) + | 0, 0 => LinearMap.id + | 0, _+1 => 0 + | n+1, 0 => TensorProduct.map (baseProjection k D X) (projection n 0) + | n+1, r+1 => TensorProduct.map (baseProjection k D X) (projection n (r+1)) + + TensorProduct.map (idealProjection k D X) (projection n r) + +@[simp] theorem projection_base (n r : ℕ) (d : D) + (v : term k (TrivSqZeroExt D X) N n) : + projection k D X N (n+1) r ((inl d : TrivSqZeroExt D X) ⊗ₜ[k] v) = + (inl d : TrivSqZeroExt D X) ⊗ₜ[k] projection k D X N n r v := by + cases r <;> simp [projection] + +@[simp] theorem projection_ideal_zero (n : ℕ) (x : X) + (v : term k (TrivSqZeroExt D X) N n) : + projection k D X N (n+1) 0 ((inr x : TrivSqZeroExt D X) ⊗ₜ[k] v) = 0 := by + simp [projection] + +@[simp] theorem projection_ideal_succ (n r : ℕ) (x : X) + (v : term k (TrivSqZeroExt D X) N n) : + projection k D X N (n+1) (r+1) ((inr x : TrivSqZeroExt D X) ⊗ₜ[k] v) = + (inr x : TrivSqZeroExt D X) ⊗ₜ[k] projection k D X N n r v := by + simp [projection] + +variable {k D X N} + +/-- The projections separate homogeneous bar words exactly. -/ +theorem projection_word {n s : ℕ} {v : term k (TrivSqZeroExt D X) N n} + (hv : Word k D X N n s v) (r : ℕ) : + projection k D X N n r v = if r = s then v else 0 := by + induction hv generalizing r with + | nil v => cases r <;> simp [projection] + | @base n s v d h ih => + rw [projection_base, ih] + split <;> simp_all + | @ideal n s v x h ih => + cases r with + | zero => + rw [projection_ideal_zero k D X N n x v] + simp + | succ r => + rw [projection_ideal_succ, ih] + by_cases hrs : r = s <;> simp [hrs] + +/-- Identity on the whole homogeneous subspace, not merely on individual words. -/ +theorem projection_self {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : projection k D X N n r v = v := by + have hle : weight k D X N n r ≤ + (projection k D X N n r - LinearMap.id).ker := by + apply Submodule.span_le.mpr + intro z hz + change projection k D X N n r z - z = 0 + rw [projection_word hz r, ite_eq_left rfl, sub_self] + have h := hle hv + change projection k D X N n r v - v = 0 at h + exact sub_eq_zero.mp h + +/-- Distinct counts are annihilated by the projection. -/ +theorem projection_other {n r s : ℕ} (hrs : r ≠ s) + {v : term k (TrivSqZeroExt D X) N n} (hv : v ∈ weight k D X N n s) : + projection k D X N n r v = 0 := by + have hle : weight k D X N n s ≤ (projection k D X N n r).ker := by + apply Submodule.span_le.mpr + intro z hz + change projection k D X N n r z = 0 + rw [projection_word hz r, ite_eq_right hrs] + exact hle hv + +/-- Homogeneous bar subspaces with distinct counts have zero intersection. -/ +theorem weight_disjoint (n : ℕ) {r s : ℕ} (hrs : r ≠ s) : + Disjoint (weight k D X N n r) (weight k D X N n s) := by + rw [Submodule.disjoint_def] + intro v hr hs + rw [← projection_self hr, projection_other hrs hs] + + +variable (k D X N) + +/-- Expanding each actual algebra entry as D ⊕ X spans every absolute bar term. -/ +theorem all_words_span (n : ℕ) : + Submodule.span k {v : term k (TrivSqZeroExt D X) N n | + ∃ r, Word k D X N n r v} = ⊤ := by + induction n with + | zero => + apply top_unique + intro v _ + exact Submodule.subset_span ⟨0, Word.nil v⟩ + | succ n ih => + apply top_unique + intro v _ + induction v using TensorProduct.inductionOn with + | add x y hx hy => exact Submodule.add_mem _ (hx trivial) (hy trivial) + | tmul a v => + let T := Submodule.span k {w : term k (TrivSqZeroExt D X) N (n+1) | + ∃ r, Word k D X N (n+1) r w} + let g := TensorProduct.mk k (TrivSqZeroExt D X) (term k (TrivSqZeroExt D X) N n) a + have hle : Submodule.span k {w | ∃ r, Word k D X N n r w} ≤ T.comap g := by + apply Submodule.span_le.mpr + rintro w ⟨r, hw⟩ + change a ⊗ₜ[k] w ∈ T + rw [← inl_fst_add_inr_snd_eq a, TensorProduct.add_tmul] + exact Submodule.add_mem _ + (Submodule.subset_span ⟨r, Word.base a.fst hw⟩) + (Submodule.subset_span ⟨r+1, Word.ideal a.snd hw⟩) + apply hle + rw [ih] + trivial + +/-- Every value of the count projection lies in the corresponding homogeneous subspace. -/ +theorem projection_mem (n r : ℕ) (v : term k (TrivSqZeroExt D X) N n) : + projection k D X N n r v ∈ weight k D X N n r := by + have hle : Submodule.span k {w | ∃ s, Word k D X N n s w} ≤ + (weight k D X N n r).comap (projection k D X N n r) := by + apply Submodule.span_le.mpr + rintro w ⟨s, hw⟩ + change projection k D X N n r w ∈ weight k D X N n r + rw [projection_word hw r] + split_ifs with h + · subst s + exact Submodule.subset_span hw + · exact Submodule.zero_mem _ + apply hle + rw [all_words_span] + trivial + +/-- The count subspaces span the entire bar term. -/ +theorem weight_iSup (n : ℕ) : (⨆ r, weight k D X N n r) = ⊤ := by + apply top_unique + rw [← all_words_span k D X N n] + apply Submodule.span_le.mpr + rintro v ⟨r, hr⟩ + exact (le_iSup (fun r => weight k D X N n r) r) (Submodule.subset_span hr) +end DerivedBar.SquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/ProjectiveTail.lean b/lean/OAI/Algebra/Finitistic/Bar/ProjectiveTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..fee7299095ad010604427cf94188210a9d31f0b4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/ProjectiveTail.lean @@ -0,0 +1,68 @@ +import Mathlib.CategoryTheory.Abelian.Projective.Dimension +import Mathlib.Algebra.Homology.HomologicalComplexAbelian + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace DerivedBar.ProjectiveTail +universe u v +variable {C : Type u} [Category.{v} C] [Abelian C] +variable (K : ChainComplex C ℕ) + +abbrev cyclesSequence (i : ℕ) : ShortComplex C := + ShortComplex.mk (K.iCycles (i+1)) (K.toCycles (i+1) i) (by + rw [← cancel_mono (K.iCycles i), Category.assoc, K.toCycles_i, + K.iCycles_d, zero_comp]) + +def cyclesSequenceKernel (i : ℕ) : + IsLimit (KernelFork.ofι (cyclesSequence K i).f (cyclesSequence K i).zero) := by + refine isLimitAux _ (fun s => K.liftCycles s.ι i (by simp) ?_) ?_ ?_ + · calc + s.ι ≫ K.d (i+1) i = (s.ι ≫ K.toCycles (i+1) i) ≫ K.iCycles i := by simp only [Category.assoc, K.toCycles_i] + _ = 0 := by rw [show s.ι ≫ K.toCycles (i+1) i = 0 from s.condition]; simp + · intro s + exact K.liftCycles_i _ _ _ _ + · intro s m hm + apply (cancel_mono (K.iCycles (i+1))).mp + exact hm.trans (K.liftCycles_i _ _ _ _).symm + +theorem cyclesSequence_exact (i : ℕ) : (cyclesSequence K i).Exact := + ShortComplex.exact_of_f_is_kernel _ (cyclesSequenceKernel K i) + +theorem cyclesSequence_shortExact (i : ℕ) (h : K.ExactAt i) : + (cyclesSequence K i).ShortExact := by + have : Epi (K.toCycles (i+1) i) := by + have hs : (K.sc' (i+1) i ((ComplexShape.down ℕ).next i)).Exact := + (K.exactAt_iff' (i+1) i _ (by simp) rfl).mp h + have hf : K.toCycles (i+1) i ≫ + (K.cyclesIsoSc' (i+1) i _ (by simp) rfl).hom = + (K.sc' (i+1) i ((ComplexShape.down ℕ).next i)).toCycles := by + exact K.toCycles_cyclesIsoSc'_hom _ _ _ _ _ + apply (epi_comp_iff_of_isIso (K.toCycles (i+1) i) + (K.cyclesIsoSc' (i+1) i _ (by simp) rfl).hom).mp + rw [hf] + exact hs.epi_toCycles + have : Mono (cyclesSequence K i).f := inferInstanceAs (Mono (K.iCycles (i+1))) + have : Epi (cyclesSequence K i).g := inferInstanceAs (Epi (K.toCycles (i+1) i)) + exact ⟨cyclesSequence_exact K i⟩ + +/-- In an exact tail of projective terms, projective dimension drops by one +at each successive cycle. This does not identify free terms with finite length. -/ +theorem cycles_projective (a g : ℕ) + (he : ∀ i, a ≤ i → K.ExactAt i) + (hp : ∀ i, Projective (K.X i)) + (hd : HasProjectiveDimensionLE (K.cycles a) g) : + Projective (K.cycles (a+g)) := by + induction g generalizing a with + | zero => simpa using (projective_iff_hasProjectiveDimensionLE_zero _).mpr hd + | succ g ih => + have hs := cyclesSequence_shortExact K a (he a le_rfl) + have : Projective (cyclesSequence K a).X₂ := hp (a+1) + have hnext : HasProjectiveDimensionLE (K.cycles (a+1)) g := + (hs.hasProjectiveDimensionLT_X₃_iff g inferInstance).mp hd + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (a+1) (fun i hi => he i (by omega)) hnext +end DerivedBar.ProjectiveTail + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveBlockIndex.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveBlockIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..56dad42ec0a0becfe3fd008e674f34229cca0ba9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveBlockIndex.lean @@ -0,0 +1,73 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveTotalFlatten +import OAI.Algebra.Finitistic.Bar.BlockIndexEquiv + +namespace OAI +noncomputable section +namespace DerivedBar.RecursiveTotal +open DerivedBar.Multibar + +/-- Recursive total diagonals record exactly r+1 block lengths; the final +input degree is the last block length. -/ +def blocks (r : ℕ) : {n : ℕ} → Index r n → Blocks r := by + induction r with + | zero => exact fun {n} _ => n + | succ r ih => exact fun ⟨p,t⟩ => (p.val.1, ih t) + +@[simp] theorem total_blocks (r n : ℕ) (t : Index r n) : + total r (blocks r t) = n := by + induction r generalizing n with + | zero => rfl + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + change i + total r (blocks r t) = n + rw [ih, h] + +/-- Recover the successive diagonal choices from the literal block lengths. -/ +def indexOfBlocks : (r : ℕ) → (b : Blocks r) → Index r (total r b) + | 0, _ => () + | r+1, (i,b) => ⟨⟨⟨i,total r b⟩,rfl⟩,indexOfBlocks r b⟩ + +def castIndex {r n m : ℕ} (h : n=m) (t : Index r n) : Index r m := h ▸ t + +@[simp] theorem blocks_castIndex {r n m : ℕ} (h : n=m) (t : Index r n) : + blocks r (castIndex h t) = blocks r t := by subst m; rfl + +@[simp] theorem blocks_indexOfBlocks (r : ℕ) (b : Blocks r) : + blocks r (indexOfBlocks r b) = b := by + induction r with + | zero => rfl + | succ r ih => + rcases b with ⟨i,b⟩ + change (i, blocks r (indexOfBlocks r b)) = (i,b) + rw [ih] + +theorem blocks_injective (r n : ℕ) : Function.Injective (@blocks r n) := by + induction r generalizing n with + | zero => intro t s _; cases t; cases s; rfl + | succ r ih => + rintro ⟨⟨⟨i,q⟩,h⟩,t⟩ ⟨⟨⟨j,p⟩,g⟩,s⟩ e + change (i,blocks r t) = (j,blocks r s) at e + have hi := congrArg Prod.fst e + dsimp at hi + subst j + have hq : q=p := by omega + subst p + have ht := ih q (congrArg Prod.snd e) + subst s + rfl + +/-- Actual equivalence used to flatten the recursively nested finite diagonals. -/ +def blockIndexEquiv (r n : ℕ) : Index r n ≃ {b : Blocks r // total r b=n} where + toFun t := ⟨blocks r t,total_blocks r n t⟩ + invFun b := castIndex b.property (indexOfBlocks r b.val) + left_inv t := by apply blocks_injective r n; simp + right_inv b := by apply Subtype.ext; simp + +/-- The recursive total index is exactly the manuscript's full-degree D/X shape. -/ +def shapeIndexEquiv (r n : ℕ) : Index r n ≃ Multibar.Indexed.Shape (r+n) r := + (blockIndexEquiv r n).trans (Multibar.Indexed.blockDegreeEquiv r n) +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursivePrefixInclusions.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursivePrefixInclusions.lean new file mode 100644 index 0000000000000000000000000000000000000000..929bbc374c7342cfc3ee6041843cf836f81c9361 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursivePrefixInclusions.lean @@ -0,0 +1,122 @@ +import OAI.Algebra.Finitistic.Bar.LeadingTotalEmbedding + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace DerivedBar.ParityBridge +universe u +local notation "c" => ComplexShape.down ℕ +section General +variable {D : Type u} [Ring D] + +theorem hom_square_of_heq {U U' V V' : ModuleCat.{u} D} (hU : U=U') (hV : V=V') + (f : U ⟶ V) (g : U' ⟶ V') (h : HEq f g) : + f ≫ eqToHom hV = eqToHom hU ≫ g := by + subst U'; subst V' + cases h + simp + +theorem hom_heq_of_square {U V V' : ModuleCat.{u} D} (hV : V=V') + (f : U ⟶ V) (g : U ⟶ V') (h : f ≫ eqToHom hV=g) : HEq f g := by + subst V' + simpa using h + +theorem barInclusionStep_heq + (G G' : ModuleCat.{u} D ⥤ ChainComplex (ModuleCat.{u} D) ℕ) [G.Additive] [G'.Additive] + (hG : G=G') + {U U' : ModuleCat.{u} D} {V V' : ChainComplex (ModuleCat.{u} D) ℕ} + (hU : U=U') (hV : V=V') (i q n : ℕ) (h : i+q=n) + (f : U ⟶ V.X q) (g : U' ⟶ V'.X q) (hf : HEq f g) : + HEq ((G ⋙ HomologicalComplex.eval _ c i).map f ≫ + (RecursiveTotal.bicomplex (fun _ => G) 0 V).ιTotal c i q n h) + ((G' ⋙ HomologicalComplex.eval _ c i).map g ≫ + (RecursiveTotal.bicomplex (fun _ => G') 0 V').ιTotal c i q n h) := by + subst G'; subst U'; subst V' + cases hf + rfl + +theorem barInclusionStep_target + (G : ModuleCat.{u} D ⥤ ChainComplex (ModuleCat.{u} D) ℕ) [G.Additive] + {U : ModuleCat.{u} D} {V V' : ChainComplex (ModuleCat.{u} D) ℕ} + (hV : V=V') (i q n : ℕ) (h : i+q=n) (f : U ⟶ V.X q) : + (G ⋙ HomologicalComplex.eval _ c i).map f ≫ + (RecursiveTotal.bicomplex (fun _ => G) 0 V).ιTotal c i q n h ≫ + eqToHom (congrArg (fun W => ((RecursiveTotal.bicomplex (fun _ => G) 0 W).total c).X n) hV) = + (G ⋙ HomologicalComplex.eval _ c i).map (f ≫ eqToHom (congrArg (fun W => W.X q) hV)) ≫ + (RecursiveTotal.bicomplex (fun _ => G) 0 V').ιTotal c i q n h := by + subst V' + simp + erw [Category.comp_id] +end General + +open DerivedBar.RecursiveTotal +variable (k D X : 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] +variable (N : ModuleCat.{u} D) +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) + +theorem leadingIter_prefix (r m : ℕ) (h : m≤r) : + iter (leadingBarSequence k D X r) Z m = iter B Z m := + (leadingBarSequence_prefix k D X Z r m h).trans (innerIter_eq_explicit k D X N m).symm + +/-- Literal recursive inclusions depend only on the functors in their prefix. -/ +theorem leadingInclusion_prefix_heq (r m n : ℕ) (h : m≤r) (t : Index m n) : + HEq (inclusion (leadingBarSequence k D X r) Z m n t) (inclusion B Z m n t) := by + induction m generalizing n with + | zero => rfl + | succ m ih => + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + have hm : m W.X n) (leadingIter_prefix k D X N r m h)) = + eqToHom (leadingSummand_prefix k D X Z r m n h t) ≫ inclusion B Z m n t := + hom_square_of_heq _ _ _ _ (leadingInclusion_prefix_heq k D X N r m n h t) + +/-- The final total agrees with the actual exterior bar on the constant-X prefix. -/ +theorem leadingIter_total (r : ℕ) : + iter (leadingBarSequence k D X r) Z (r+1) = barTotal k D (iter B Z r) := + (leadingBarSequence_total k D X Z r).trans + (congrArg (barTotal k D) (innerIter_eq_explicit k D X N r).symm) + +theorem leadingSummand_last (r n i q : ℕ) (h : i+q=n) (t : Index r q) : + summand (leadingBarSequence k D X r) Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩ = + (barFunctor k D ⋙ HomologicalComplex.eval _ c i).obj + (summand (leadingBarSequence k D X r) Z r q t) := by + simp only [summand, degreeFunctor, leadingBarSequence, lt_self_iff_false, ite_false] + +/-- The exterior inclusion is exactly the free-bar map of the original inner inclusion. -/ +theorem leadingInclusion_total (r n i q : ℕ) (h : i+q=n) (t : Index r q) : + inclusion (leadingBarSequence k D X r) Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩ ≫ + eqToHom (congrArg (fun W => W.X n) (leadingIter_total k D X N r)) = + eqToHom (leadingSummand_last k D X N r n i q h t) ≫ + (barFunctor k D ⋙ HomologicalComplex.eval _ c i).map + (eqToHom (leadingSummand_prefix k D X Z r r q le_rfl t) ≫ inclusion B Z r q t) ≫ + (barBicomplex k D (iter B Z r)).ιTotal c i q n h := by + have hi := hom_heq_of_square + (congrArg (fun W => W.X q) (leadingIter_prefix k D X N r r le_rfl)) + (inclusion (leadingBarSequence k D X r) Z r q t) + (eqToHom (leadingSummand_prefix k D X Z r r q le_rfl t) ≫ inclusion B Z r q t) + (leadingInclusion_prefix k D X N r r q le_rfl t) + have he := barInclusionStep_heq (leadingBarSequence k D X r r) (barFunctor k D) + (by simp only [leadingBarSequence, lt_self_iff_false, ite_false]) rfl + (leadingIter_prefix k D X N r r le_rfl) i q n h + (inclusion (leadingBarSequence k D X r) Z r q t) + (eqToHom (leadingSummand_prefix k D X Z r r q le_rfl t) ≫ inclusion B Z r q t) hi + exact hom_square_of_heq _ _ _ _ he +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixCoefficient.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..9660e915b5b74ae9b083e38e22e3bd391d1eed40 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixCoefficient.lean @@ -0,0 +1,99 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixTotal + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance recursiveSuffixCoefficientIndexDecidableEq (r n : ℕ) : + DecidableEq (RecursiveTotal.Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +theorem coefficient_termCast {a b : ℕ} (h : a=b) (h' : a+1=b+1) + (v : term k A N (a+1)) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N b) (termCast k D X N h' v) = + AlgebraTensorModule.lTensor D D (termCast k D X N h) + (FreeBaseChange.coefficient (fstHom k D X) (term k A N a) v) := by + subst b + simp only [termCast, LinearMap.id_apply, AlgebraTensorModule.lTensor_id] + +/-- The first X factor is killed by the exterior projection A -> D. -/ +theorem barSuffix_coefficient_zero (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N s) (v : ((XB).obj V).X i) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N (s+i)) + (barSuffix k D X N V s i e v) = 0 := by + unfold barSuffix + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply] + generalize (Multibar.twoSidedBarObjIso k D X V i).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul x w => + rw [idealSuffixEmbed_tmul, FreeBaseChange.coefficient_tmul] + simp + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + +/-- The exterior endpoint vanishes at every positive suffix degree, including +zero input summands when no X has yet been inserted. -/ +theorem innerEmbedding_coefficient_of_pos (r n s : ℕ) (hs : r+n=s+1) + (v : RecursiveTotal.flat B Z r n) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N s) + (termCast k D X N hs (innerEmbedding k D X N r n v)) = 0 := by + cases r with + | zero => + cases n with + | zero => omega + | succ n => simp only [innerEmbedding, LinearMap.zero_apply, map_zero] + | succ r => + induction v using DirectSum.induction_on with + | zero => simp only [map_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + | of t v => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + change FreeBaseChange.coefficient (fstHom k D X) (term k A N s) + (termCast k D X N hs (innerEmbedding k D X N (r+1) n + ((RecursiveTotal.lof B Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩).hom v))) = 0 + erw [innerEmbedding_lof_succ k D X N r n i q h t v] + erw [termCast_trans k D X N (show ((r+q)+i)+1=(r+1)+n by omega) hs] + erw [coefficient_termCast k D X N (show (r+q)+i=s by omega) + (show ((r+q)+i)+1=s+1 by omega)] + erw [barSuffix_coefficient_zero k D X N (RecursiveTotal.summand B Z r q t) + (r+q) i _ v] + exact map_zero _ + +theorem innerTotalEmbedding_coefficient_of_pos (r n s : ℕ) (hs : r+n=s+1) + (v : (RecursiveTotal.iter B Z r).X n) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N s) + (termCast k D X N hs (innerTotalEmbedding k D X N r n v)) = 0 := + innerEmbedding_coefficient_of_pos k D X N r n s hs _ + +theorem innerEmbedding_coefficient_zero (r n : ℕ) + (v : RecursiveTotal.flat B Z (r+1) n) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N (r+n)) + (termCast k D X N (show (r+1)+n=(r+n)+1 by omega) + (innerEmbedding k D X N (r+1) n v)) = 0 := + innerEmbedding_coefficient_of_pos k D X N (r+1) n (r+n) (by omega) v + +theorem innerTotalEmbedding_coefficient_zero (r n : ℕ) + (v : (RecursiveTotal.iter B Z (r+1)).X n) : + FreeBaseChange.coefficient (fstHom k D X) (term k A N (r+n)) + (termCast k D X N (show (r+1)+n=(r+n)+1 by omega) + (innerTotalEmbedding k D X N (r+1) n v)) = 0 := + innerTotalEmbedding_coefficient_of_pos k D X N (r+1) n (r+n) (by omega) v +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixDifferential.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..99c851b50ba255eb5ebc5ee2341caf3894219879 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixDifferential.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixFaces +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixSums + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance recursiveSuffixDifferentialScalarModule (V : ModuleCat.{u} D) : Module k V := + BimoduleTensor.scalarModule k D V +local instance recursiveSuffixDifferentialScalarTower (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance recursiveSuffixDifferentialIndexDecidableEq (r n : ℕ) : + DecidableEq (RecursiveTotal.Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local instance recursiveSuffixDifferentialInflatedModule : Module A N := inflatedModule D X N +local instance recursiveSuffixDifferentialInflatedScalarTower : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +/-- The actual horizontal differential followed by the complete suffix embedding. -/ +theorem innerEmbedding_horizontal (r n i q : ℕ) (h : (i+1)+q=n+1) + (t : RecursiveTotal.Index r q) + (v : (RecursiveTotal.degreeFunctor B r (i+1)).obj (RecursiveTotal.summand B Z r q t)) : + innerEmbedding k D X N (r+1) n + ((RecursiveTotal.horizontal B Z r n (i+1) q h t).hom v) = + termCast k D X N (show ((r+q)+i)+1=(r+1)+n by omega) + (barSuffix k D X N (RecursiveTotal.summand B Z r q t) (r+q) i + ((innerEmbedding k D X N r q).comp + ((RecursiveTotal.lof B Z r q t).hom.restrictScalars k)) + ((((XB).obj (RecursiveTotal.summand B Z r q t)).d (i+1) i).hom v)) := by + simp only [RecursiveTotal.horizontal] + exact innerEmbedding_lof_succ k D X N r n i q (by omega) t _ + +/-- The actual signed vertical face is computed after distribution over the +whole inner sum, rather than on an assumed single supported output summand. -/ +theorem innerEmbedding_vertical (r n i q : ℕ) (h : i+(q+1)=n+1) + (t : RecursiveTotal.Index r (q+1)) + (d : ∀ q, RecursiveTotal.flat B Z r (q+1) ⟶ RecursiveTotal.flat B Z r q) + (v : (RecursiveTotal.degreeFunctor B r i).obj (RecursiveTotal.summand B Z r (q+1) t)) : + innerEmbedding k D X N (r+1) n + ((RecursiveTotal.vertical B Z r n i (q+1) h t d).hom v) = + (-1:k)^i • termCast k D X N (show ((r+q)+i)+1=(r+1)+n by omega) + (barSuffix k D X N (RecursiveTotal.summand B Z r (q+1) t) (r+q) i + ((innerEmbedding k D X N r q).comp + ((RecursiveTotal.lof B Z r (q+1) t ≫ d q).hom.restrictScalars k)) v) := by + change innerEmbedding k D X N (r+1) n + (((-1:ℤˣ)^i) • + ((RecursiveTotal.sumDesc (RecursiveTotal.summand B Z r q) + (RecursiveTotal.degreeFunctor B r i) + (fun s => RecursiveTotal.lof B Z (r+1) n ⟨⟨⟨i,q⟩,by omega⟩,s⟩)).hom + (((RecursiveTotal.degreeFunctor B r i).map + (RecursiveTotal.lof B Z r (q+1) t ≫ d q)).hom v))) = _ + rw [totalSign_smul k (RecursiveTotal.flat B Z (r+1) n), map_smul, + innerEmbedding_sumDesc] + change (-1:k)^i • termCast k D X N _ + (barSuffix k D X N (RecursiveTotal.flat B Z r q) (r+q) i + (innerEmbedding k D X N r q) + ((((XB).map (RecursiveTotal.lof B Z r (q+1) t ≫ d q)).f i).hom v)) = _ + rw [barSuffix_map] + +/-- Evaluation of the independently recursive differential on one input summand. -/ +theorem innerEmbedding_differential_lof (r n i q : ℕ) (h : i+q=n+1) + (t : RecursiveTotal.Index r q) + (v : RecursiveTotal.summand B Z (r+1) (n+1) ⟨⟨⟨i,q⟩,h⟩,t⟩) : + innerEmbedding k D X N (r+1) n + ((RecursiveTotal.differential B Z (r+1) n).hom + ((RecursiveTotal.lof B Z (r+1) (n+1) ⟨⟨⟨i,q⟩,h⟩,t⟩).hom v)) = + innerEmbedding k D X N (r+1) n + ((RecursiveTotal.horizontal B Z r n i q h t).hom v) + + innerEmbedding k D X N (r+1) n + ((RecursiveTotal.vertical B Z r n i q h t (RecursiveTotal.differential B Z r)).hom v) := by + have he := congrArg (fun f => f.hom v) + (RecursiveTotal.lof_differential_succ B Z r n i q h t) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply] at he + erw [ModuleCat.hom_add, LinearMap.add_apply] at he + erw [he, map_add] + rfl + +/-- Degree transports compose by equality elimination alone. -/ +theorem termCast_trans {a b c : ℕ} (h : a=b) (g : b=c) (v : term k A N a) : + termCast k D X N g (termCast k D X N h v) = termCast k D X N (h.trans g) v := by + subst b; subst c + rfl + +/-- Composition of the induction hypothesis with an actual summand inclusion. -/ +theorem innerEmbedding_suffix_induction (r q : ℕ) (t : RecursiveTotal.Index r (q+1)) + (ih : ∀ (v : RecursiveTotal.flat B Z r (q+1)), + SquareZero.multibarAugmentedDifferential k D X N (r+q) + (innerEmbedding k D X N r (q+1) v) = + -innerEmbedding k D X N r q ((RecursiveTotal.differential B Z r q).hom v)) : + (SquareZero.multibarAugmentedDifferential k D X N (r+q)).comp + ((innerEmbedding k D X N r (q+1)).comp + ((RecursiveTotal.lof B Z r (q+1) t).hom.restrictScalars k)) = + -((innerEmbedding k D X N r q).comp + ((RecursiveTotal.lof B Z r (q+1) t ≫ RecursiveTotal.differential B Z r q).hom.restrictScalars k)) := by + ext v + exact ih ((RecursiveTotal.lof B Z r (q+1) t).hom v) +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixEmbedding.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..d617b3315ea778646f68f7d8faff9156fd2dd581 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixEmbedding.lean @@ -0,0 +1,167 @@ +import OAI.Algebra.Finitistic.Bar.SuffixNaturality +import OAI.Algebra.Finitistic.Bar.BarCoordinateNaturality +import OAI.Algebra.Finitistic.Bar.ModuleMultibarCoordinates + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance (r n : ℕ) : DecidableEq (RecursiveTotal.Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) + +/-- Prefix one original categorical X bar to a linear suffix map. -/ +def barSuffix (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N s) : + ((XB).obj V).X i →ₗ[k] term k A N ((s+i)+1) := + (idealSuffixEmbed k D X N V s i e).comp + ((Multibar.twoSidedBarObjIso k D X V i).hom.hom.restrictScalars k) + +/-- The prefix keeps the original left D action. -/ +theorem barSuffix_smul (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N s) (d : D) (v : ((XB).obj V).X i) : + letI : Module A N := inflatedModule D X N + barSuffix k D X N V s i e (d • v) = + (inl d : A) • barSuffix k D X N V s i e v := by + let : Module A N := inflatedModule D X N + unfold barSuffix + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply, map_smul] + generalize (Multibar.twoSidedBarObjIso k D X V i).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul x w => + change (inr (d • x) : A) ⊗ₜ[k] _ = ((inl d : A) * inr x) ⊗ₜ[k] _ + rw [inl_mul_inr] + | add v w hv hw => simp only [map_add, smul_add, hv, hw] + +theorem barSuffix_ideal_zero (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N s) (x : X) (v : ((XB).obj V).X i) : + letI : Module A N := inflatedModule D X N + (inr x : A) • barSuffix k D X N V s i e v = 0 := by + let : Module A N := inflatedModule D X N + unfold barSuffix + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply] + generalize (Multibar.twoSidedBarObjIso k D X V i).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul y w => + change ((inr x : A) * inr y) ⊗ₜ[k] _ = 0 + rw [inr_mul_inr, TensorProduct.zero_tmul] + | add v w hv hw => simp only [map_add, smul_add, hv, hw, add_zero] + +/-- Naturality uses the original bar functor, including its supplied scalar coherence. -/ +theorem barSuffix_map (V W : ModuleCat.{u} D) (s i : ℕ) + (e : W →ₗ[k] term k A N s) (f : V ⟶ W) (v : ((XB).obj V).X i) : + barSuffix k D X N W s i e ((((XB).map f).f i).hom v) = + barSuffix k D X N V s i (e.comp (f.hom.restrictScalars k)) v := by + have h := congrArg (fun g => g.hom v) + (Multibar.twoSidedBarObjIso_map k D X V W f.hom i) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom] at h + unfold barSuffix + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply] + erw [h] + let : Module A N := inflatedModule D X N + let : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + exact idealSuffixEmbed_termMap k D X N V W s i e f.hom _ + +/-- Literal recursive suffix embedding on every summand, including zero input degrees. -/ +def innerEmbedding : (r n : ℕ) → + RecursiveTotal.flat B Z r n →ₗ[k] term k A N (r+n) + | 0, 0 => DirectSum.toModule k _ _ (fun _ => LinearMap.id) + | 0, n+1 => 0 + | r+1, n => DirectSum.toModule k _ _ (fun t => + (termCast k D X N (show ((r+t.1.val.2)+t.1.val.1)+1=(r+1)+n by + have h := t.1.property; omega)).comp + (barSuffix k D X N (RecursiveTotal.summand B Z r t.1.val.2 t.2) + (r+t.1.val.2) t.1.val.1 + ((innerEmbedding r t.1.val.2).comp + ((RecursiveTotal.lof B Z r t.1.val.2 t.2).hom.restrictScalars k)))) + +theorem toModule_of_scalar {I : Type} [DecidableEq I] + (V : I → Type u) [∀ t, AddCommGroup (V t)] [∀ t, Module k (V t)] + (W : Type u) [AddCommGroup W] [Module k W] + (f : ∀ t, V t →ₗ[k] W) (t : I) (v : V t) : + DirectSum.toModule k I W f (DirectSum.of V t v) = f t v := + DirectSum.toModule_lof (M := V) (N := W) (φ := f) k t v + +@[simp] theorem innerEmbedding_lof_succ (r n i q : ℕ) (h : i+q=n) + (t : RecursiveTotal.Index r q) (v : RecursiveTotal.summand B Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩) : + innerEmbedding k D X N (r+1) n + ((RecursiveTotal.lof B Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩).hom v) = + termCast k D X N (show ((r+q)+i)+1=(r+1)+n by omega) + (barSuffix k D X N (RecursiveTotal.summand B Z r q t) (r+q) i + ((innerEmbedding k D X N r q).comp + ((RecursiveTotal.lof B Z r q t).hom.restrictScalars k)) v) := by + simp only [innerEmbedding, RecursiveTotal.lof, ModuleCat.hom_ofHom] + erw [DirectSum.lof_eq_of, toModule_of_scalar] + rfl + +theorem termCast_smul {a b : ℕ} (h : a=b) (d : A) (v : term k A N a) : + letI : Module A N := inflatedModule D X N + termCast k D X N h (d • v) = d • termCast k D X N h v := by + subst b + rfl + +/-- The complete finite-sum suffix map has its original D action. -/ +theorem innerEmbedding_smul (r n : ℕ) (d : D) (v : RecursiveTotal.flat B Z r n) : + letI : Module A N := inflatedModule D X N + innerEmbedding k D X N r n (d • v) = + (inl d : A) • innerEmbedding k D X N r n v := by + let : Module A N := inflatedModule D X N + induction v using DirectSum.induction_on with + | zero => simp only [map_zero, smul_zero] + | add v w hv hw => simp only [smul_add, map_add, hv, hw] + | of t v => + change innerEmbedding k D X N r n + (d • (RecursiveTotal.lof B Z r n t).hom v) = + (inl d : A) • innerEmbedding k D X N r n ((RecursiveTotal.lof B Z r n t).hom v) + rw [← map_smul] + cases r with + | zero => + cases n with + | zero => + simp only [innerEmbedding, RecursiveTotal.lof, ModuleCat.hom_ofHom, + DirectSum.lof_eq_of] + erw [toModule_of_scalar, toModule_of_scalar] + rfl + | succ n => simp only [innerEmbedding, LinearMap.zero_apply, smul_zero] + | succ r => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + erw [innerEmbedding_lof_succ, innerEmbedding_lof_succ, barSuffix_smul, + termCast_smul] + +/-- Every recursive X-leading sum is killed by the square-zero ideal; +the r=0 degree-zero input is killed by the specified inflation. -/ +theorem innerEmbedding_ideal_zero (r n : ℕ) (x : X) (v : RecursiveTotal.flat B Z r n) : + letI : Module A N := inflatedModule D X N + (inr x : A) • innerEmbedding k D X N r n v = 0 := by + let : Module A N := inflatedModule D X N + induction v using DirectSum.induction_on with + | zero => simp only [map_zero, smul_zero] + | add v w hv hw => simp only [map_add, smul_add, hv, hw, add_zero] + | of t v => + change (inr x : A) • innerEmbedding k D X N r n + ((RecursiveTotal.lof B Z r n t).hom v) = 0 + cases r with + | zero => + cases n with + | zero => exact zero_smul D _ + | succ n => simp only [innerEmbedding, LinearMap.zero_apply, smul_zero] + | succ r => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + erw [innerEmbedding_lof_succ, ← termCast_smul, barSuffix_ideal_zero, map_zero] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixFaces.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixFaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0902bdfc6c1012e9f08d37627843cf4841b24cb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixFaces.lean @@ -0,0 +1,209 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixEmbedding + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance (r n : ℕ) : DecidableEq (RecursiveTotal.Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +/-- The original augmented parity operator commutes with degree transport. -/ +theorem parity_termCast {a b : ℕ} (h : a=b) (h' : a+1=b+1) + (v : term k A N (a+1)) : + SquareZero.multibarAugmentedDifferential k D X N b (termCast k D X N h' v) = + termCast k D X N h (SquareZero.multibarAugmentedDifferential k D X N a v) := by + subst b + rfl + +/-- Positive-block face comparison for the actual categorical bar functor. -/ +theorem parity_barSuffix (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N (s+1)) + (he : ∀ (d : D) (v : V), e (d • v) = (inl d : A) • e v) + (v : ((XB).obj V).X (i+1)) : + SquareZero.multibarAugmentedDifferential k D X N (((s+1)+i)+1) + (barSuffix k D X N V (s+1) (i+1) e v) = + -barSuffix k D X N V (s+1) i e ((((XB).obj V).d (i+1) i).hom v) + + (-1:k)^(i+1) • termCast k D X N (show (s+(i+1))+1=((s+1)+i)+1 by omega) + (barSuffix k D X N V s (i+1) + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v) := by + have h := congrArg (fun g => g.hom v) (Multibar.twoSidedBarObjIso_d k D X V i) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom] at h + unfold barSuffix + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply] + erw [h] + exact parity_idealSuffixEmbed k D X N V s i e he _ + +/-- Empty blocks retain the suffix face with no extra sign. -/ +theorem parity_barSuffix_zero (V : ModuleCat.{u} D) (s : ℕ) + (e : V →ₗ[k] term k A N (s+1)) + (he : ∀ (x : X) (v : V), (inr x : A) • e v = 0) + (v : ((XB).obj V).X 0) : + SquareZero.multibarAugmentedDifferential k D X N (s+1) + (barSuffix k D X N V (s+1) 0 e v) = + barSuffix k D X N V s 0 + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v := + parity_idealSuffixEmbed_zero k D X N V s e he _ + +/-- A terminal empty block has zero face by the actual inflation of N. -/ +theorem parity_barSuffix_endpoint (V : ModuleCat.{u} D) + (e : V →ₗ[k] term k A N 0) (v : ((XB).obj V).X 0) : + SquareZero.multibarAugmentedDifferential k D X N 0 + (barSuffix k D X N V 0 0 e v) = 0 := by + unfold barSuffix + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply] + generalize (Multibar.twoSidedBarObjIso k D X V 0).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul x w => + exact SquareZero.multibarAugmented_ideal_endpoint k D X N + (fun _ v => zero_smul D v) x (e w) + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + +/-- Prefix insertion is linear in the complete suffix map. -/ +theorem barSuffix_neg (V : ModuleCat.{u} D) (s i : ℕ) + (e : V →ₗ[k] term k A N s) : + barSuffix k D X N V s i (-e) = -barSuffix k D X N V s i e := by + ext v + unfold barSuffix + simp only [LinearMap.neg_apply, LinearMap.comp_apply, LinearMap.restrictScalars_apply] + generalize (Multibar.twoSidedBarObjIso k D X V i).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul x w => + change (inr x : A) ⊗ₜ[k] suffixEmbed k D X N V s (-e) i w = + -((inr x : A) ⊗ₜ[k] suffixEmbed k D X N V s e i w) + rw [← neg_one_smul k e, suffixEmbed_smul_map, neg_one_smul, TensorProduct.tmul_neg] + | add v w hv hw => simp only [map_add, neg_add, hv, hw] + +theorem barSuffix_zero (V : ModuleCat.{u} D) (s i : ℕ) : + barSuffix k D X N V s i 0 = 0 := by + ext v + unfold barSuffix + simp only [LinearMap.zero_apply, LinearMap.comp_apply, LinearMap.restrictScalars_apply] + generalize (Multibar.twoSidedBarObjIso k D X V i).hom.hom v = w + induction w using TensorProduct.inductionOn with + | tmul x w => + change (inr x : A) ⊗ₜ[k] suffixEmbed k D X N V s 0 i w = 0 + have hz := suffixEmbed_smul_map k D X N V s i (0:k) (0 : V →ₗ[k] term k A N s) w + simp only [zero_smul] at hz + rw [hz, TensorProduct.tmul_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + +/-- Prefix insertion commutes with exact degree casts on a suffix. -/ +theorem barSuffix_termCast (V : ModuleCat.{u} D) {a b : ℕ} (h : a=b) (i : ℕ) + (e : V →ₗ[k] term k A N a) (v : ((XB).obj V).X i) : + barSuffix k D X N V b i ((termCast k D X N h).comp e) v = + termCast k D X N (show (a+i)+1=(b+i)+1 by omega) + (barSuffix k D X N V a i e v) := by + subst b + rfl + +theorem suffixEmbed_id (i : ℕ) (v : term k D N i) : + suffixEmbed k D X N N 0 LinearMap.id i v = + termCast k D X N (Nat.zero_add i).symm (baseEmbed k D X N i v) := by + induction i with + | zero => rfl + | succ i ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [suffixEmbed_tmul, baseEmbed_tmul, ih] + exact (termCast_tmul k D X N (Nat.zero_add i).symm + (show i+1=(0+i)+1 by omega) (inl d) (baseEmbed k D X N i v)).symm + | add v w hv hw => simp only [map_add, hv, hw] + +theorem idealSuffixEmbed_id (i : ℕ) (v : X ⊗[k] term k D N i) : + idealSuffixEmbed k D X N N 0 i LinearMap.id v = + termCast k D X N (show i+1=(0+i)+1 by omega) (idealEmbed k D X N i v) := by + induction v using TensorProduct.inductionOn with + | tmul x v => + rw [idealSuffixEmbed_tmul, idealEmbed_tmul, + termCast_tmul k D X N (Nat.zero_add i).symm, suffixEmbed_id] + | add v w hv hw => simp only [map_add, hv, hw] + +/-- The degree-zero input embedding is the identity on its sole summand. -/ +theorem innerEmbedding_zero_lof (t : RecursiveTotal.Index 0 0) : + (innerEmbedding k D X N 0 0).comp + ((RecursiveTotal.lof B Z 0 0 t).hom.restrictScalars k) = LinearMap.id := by + ext v + simp only [innerEmbedding, RecursiveTotal.lof, ModuleCat.hom_ofHom, + LinearMap.comp_apply, LinearMap.restrictScalars_apply, DirectSum.lof_eq_of] + erw [toModule_of_scalar] + +/-- The terminal positive X bar has exactly minus its original bar differential. -/ +theorem parity_barSuffix_terminal (i : ℕ) (v : ((XB).obj N).X (i+1)) : + SquareZero.multibarAugmentedDifferential k D X N ((0+i)+1) + (barSuffix k D X N N 0 (i+1) LinearMap.id v) = + -barSuffix k D X N N 0 i LinearMap.id + ((((XB).obj N).d (i+1) i).hom v) := by + have h := congrArg (fun g => g.hom v) (Multibar.twoSidedBarObjIso_d k D X N i) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom] at h + unfold barSuffix + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply] + erw [h] + rw [idealSuffixEmbed_id, idealSuffixEmbed_id] + erw [parity_termCast k D X N (show i+1=(0+i)+1 by omega) + (show (i+1)+1=((0+i)+1)+1 by omega)] + rw [inflated_parity_idealEmbed, map_neg] + +/-- The augmented bottom face vanishes at every recursive depth. -/ +theorem innerEmbedding_bottom (r : ℕ) (v : RecursiveTotal.flat B Z (r+1) 0) : + SquareZero.multibarAugmentedDifferential k D X N r + (termCast k D X N (show (r+1)+0=r+1 by omega) + (innerEmbedding k D X N (r+1) 0 v)) = 0 := by + induction r with + | zero => + induction v using DirectSum.induction_on with + | zero => simp only [map_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + | of t v => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + have hi : i=0 := by omega + have hq : q=0 := by omega + subst i; subst q + change SquareZero.multibarAugmentedDifferential k D X N 0 + (innerEmbedding k D X N 1 0 ((RecursiveTotal.lof B Z 1 0 _).hom v)) = 0 + rw [innerEmbedding_lof_succ] + exact parity_barSuffix_endpoint k D X N _ _ v + | succ r ih => + induction v using DirectSum.induction_on with + | zero => simp only [map_zero] + | add v w hv hw => simp only [map_add, hv, hw, add_zero] + | of t v => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + have hi : i=0 := by omega + have hq : q=0 := by omega + subst i; subst q + change SquareZero.multibarAugmentedDifferential k D X N (r+1) + (innerEmbedding k D X N (r+1+1) 0 ((RecursiveTotal.lof B Z (r+1+1) 0 _).hom v)) = 0 + rw [innerEmbedding_lof_succ] + change SquareZero.multibarAugmentedDifferential k D X N (r+1) + (barSuffix k D X N _ (r+1) 0 _ v) = 0 + erw [parity_barSuffix_zero k D X N _ r _ + (fun x w => innerEmbedding_ideal_zero k D X N (r+1) 0 x + ((RecursiveTotal.lof B Z (r+1) 0 t).hom w))] + have hz : (SquareZero.multibarAugmentedDifferential k D X N r).comp + ((innerEmbedding k D X N (r+1) 0).comp + ((RecursiveTotal.lof B Z (r+1) 0 t).hom.restrictScalars k)) = 0 := by + ext w + exact ih _ + rw [hz] + rw [barSuffix_zero] + rfl +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixInduction.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixInduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..978be7bb5ac6834d21c69a703f3019af3b1a4f73 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixInduction.lean @@ -0,0 +1,169 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixDifferential + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance recursiveSuffixInductionIndexDecidableEq (r n : ℕ) : + DecidableEq (RecursiveTotal.Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +theorem innerEmbedding_generator_positive (r n i q : ℕ) (h : i+(q+1)=n+1) + (t : RecursiveTotal.Index r (q+1)) + (ih : ∀ (v : RecursiveTotal.flat B Z r (q+1)), + SquareZero.multibarAugmentedDifferential k D X N (r+q) + (innerEmbedding k D X N r (q+1) v) = + -innerEmbedding k D X N r q ((RecursiveTotal.differential B Z r q).hom v)) + (v : RecursiveTotal.summand B Z (r+1) (n+1) ⟨⟨⟨i,q+1⟩,h⟩,t⟩) : + SquareZero.multibarAugmentedDifferential k D X N ((r+1)+n) + (innerEmbedding k D X N (r+1) (n+1) + ((RecursiveTotal.lof B Z (r+1) (n+1) ⟨⟨⟨i,q+1⟩,h⟩,t⟩).hom v)) = + -innerEmbedding k D X N (r+1) n + ((RecursiveTotal.differential B Z (r+1) n).hom + ((RecursiveTotal.lof B Z (r+1) (n+1) ⟨⟨⟨i,q+1⟩,h⟩,t⟩).hom v)) := by + erw [innerEmbedding_differential_lof, neg_add, innerEmbedding_lof_succ] + have hδ := innerEmbedding_suffix_induction k D X N r q t ih + let V := RecursiveTotal.summand B Z r (q+1) t + let e : V →ₗ[k] term k A N ((r+q)+1) := + (innerEmbedding k D X N r (q+1)).comp + ((RecursiveTotal.lof B Z r (q+1) t).hom.restrictScalars k) + have he : ∀ (d : D) (w : V), e (d • w) = (inl d : A) • e w := by + intro d w + change innerEmbedding k D X N r (q+1) + ((RecursiveTotal.lof B Z r (q+1) t).hom (d • w)) = + (inl d : A) • innerEmbedding k D X N r (q+1) + ((RecursiveTotal.lof B Z r (q+1) t).hom w) + rw [map_smul] + exact innerEmbedding_smul k D X N r (q+1) d _ + cases i with + | zero => + have hn : n=q := by omega + subst n + erw [parity_termCast k D X N (show ((r+(q+1))+0)=(r+1)+q by omega) + (show ((r+(q+1))+0)+1=((r+1)+q)+1 by omega)] + erw [parity_barSuffix_zero k D X N V (r+q) e + (fun x w => innerEmbedding_ideal_zero k D X N r (q+1) x + ((RecursiveTotal.lof B Z r (q+1) t).hom w))] + erw [hδ, barSuffix_neg, LinearMap.neg_apply, map_neg, innerEmbedding_vertical] + simp only [RecursiveTotal.horizontal, ModuleCat.hom_zero, pow_zero, one_smul] + erw [LinearMap.zero_apply (σ₁₂ := RingHom.id D) + (M₂ := RecursiveTotal.flat B Z (r+1) q) v] + simp only [map_zero, neg_zero, zero_add] + rfl + | succ i => + erw [parity_termCast k D X N (show ((r+(q+1))+(i+1))=(r+1)+n by omega) + (show ((r+(q+1))+(i+1))+1=((r+1)+n)+1 by omega)] + erw [parity_barSuffix k D X N V (r+q) i e he] + simp only [e, hδ, barSuffix_neg, map_add, map_neg, map_smul] + erw [LinearMap.neg_apply, map_neg, map_neg, smul_neg] + erw [innerEmbedding_horizontal k D X N r n i (q+1) h t v] + erw [innerEmbedding_vertical k D X N r n (i+1) q h t (RecursiveTotal.differential B Z r) v] + erw [termCast_trans k D X N + (show ((r+q)+(i+1))+1=((r+q+1)+i)+1 by omega) + (show ((r+q+1)+i)+1=(r+1)+n by omega)] + rfl + +/-- A zero final input term cannot contribute an element, at any recursive depth. -/ +theorem innerSummand_positive_input_zero (r n : ℕ) (t : RecursiveTotal.Index r n) + (h : RecursiveTotal.inputDegree r t ≠ 0) (v : RecursiveTotal.summand B Z r n t) : v=0 := by + have hz := RecursiveTotal.summand_isZero B Z r n t + (HomologicalComplex.isZero_single_obj_X (ComplexShape.down ℕ) 0 N _ h) + exact congrArg (fun f : RecursiveTotal.summand B Z r n t ⟶ + RecursiveTotal.summand B Z r n t => f.hom v) (hz.eq_of_src (𝟙 _) 0) + +/-- The only remaining generator case has suffix total degree zero. Its tail +face vanishes by the already proved augmented bottom identity. -/ +theorem innerEmbedding_generator_bottom (r n i : ℕ) (h : i+0=n+1) + (t : RecursiveTotal.Index r 0) + (v : RecursiveTotal.summand B Z (r+1) (n+1) ⟨⟨⟨i,0⟩,h⟩,t⟩) : + SquareZero.multibarAugmentedDifferential k D X N ((r+1)+n) + (innerEmbedding k D X N (r+1) (n+1) + ((RecursiveTotal.lof B Z (r+1) (n+1) ⟨⟨⟨i,0⟩,h⟩,t⟩).hom v)) = + -innerEmbedding k D X N (r+1) n + ((RecursiveTotal.differential B Z (r+1) n).hom + ((RecursiveTotal.lof B Z (r+1) (n+1) ⟨⟨⟨i,0⟩,h⟩,t⟩).hom v)) := by + have hi : i=n+1 := by omega + subst i + erw [innerEmbedding_differential_lof, innerEmbedding_lof_succ] + simp only [RecursiveTotal.vertical, ModuleCat.hom_zero] + erw [LinearMap.zero_apply (σ₁₂ := RingHom.id D) + (M₂ := RecursiveTotal.flat B Z (r+1) n) v] + simp only [map_zero, add_zero] + erw [innerEmbedding_horizontal] + cases r with + | zero => + cases t + erw [innerEmbedding_zero_lof] + erw [parity_termCast k D X N (show (0+0)+(n+1)=(0+1)+n by omega) + (show ((0+0)+(n+1))+1=((0+1)+n)+1 by omega)] + erw [parity_barSuffix_terminal, map_neg] + rfl + | succ r => + erw [parity_termCast k D X N (show ((r+1)+0)+(n+1)=((r+1)+1)+n by omega) + (show (((r+1)+0)+(n+1))+1=(((r+1)+1)+n)+1 by omega)] + erw [parity_barSuffix k D X N (RecursiveTotal.summand B Z (r+1) 0 t) r n + ((innerEmbedding k D X N (r+1) 0).comp + ((RecursiveTotal.lof B Z (r+1) 0 t).hom.restrictScalars k)) + (fun d w => by + change innerEmbedding k D X N (r+1) 0 + ((RecursiveTotal.lof B Z (r+1) 0 t).hom (d • w)) = + (inl d : A) • innerEmbedding k D X N (r+1) 0 + ((RecursiveTotal.lof B Z (r+1) 0 t).hom w) + rw [map_smul] + exact innerEmbedding_smul k D X N (r+1) 0 d _)] + have hz : (SquareZero.multibarAugmentedDifferential k D X N r).comp + ((innerEmbedding k D X N (r+1) 0).comp + ((RecursiveTotal.lof B Z (r+1) 0 t).hom.restrictScalars k)) = 0 := by + ext w + exact innerEmbedding_bottom k D X N r _ + simp only [hz, barSuffix_zero] + erw [LinearMap.zero_apply] + simp only [map_zero, smul_zero, add_zero, map_neg] + +/-- The canonical inner finite-sum embedding compares the actual independently +recursive differential with minus augmented slot parity, at every depth and degree. -/ +theorem innerEmbedding_differential (r n : ℕ) (v : RecursiveTotal.flat B Z r (n+1)) : + SquareZero.multibarAugmentedDifferential k D X N (r+n) + (innerEmbedding k D X N r (n+1) v) = + -innerEmbedding k D X N r n ((RecursiveTotal.differential B Z r n).hom v) := by + induction r generalizing n with + | zero => + induction v using DirectSum.induction_on with + | zero => simp only [map_zero, neg_zero] + | add v w hv hw => simp only [map_add, hv, hw, neg_add] + | of t v => + have hv := innerSummand_positive_input_zero k D X N 0 (n+1) t (by simp [RecursiveTotal.inputDegree]) v + subst v + simp only [map_zero, neg_zero] + | succ r ih => + induction v using DirectSum.induction_on with + | zero => simp only [map_zero, neg_zero] + | add v w hv hw => simp only [map_add, hv, hw, neg_add] + | of t v => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + change SquareZero.multibarAugmentedDifferential k D X N ((r+1)+n) + (innerEmbedding k D X N (r+1) (n+1) + ((RecursiveTotal.lof B Z (r+1) (n+1) ⟨⟨⟨i,q⟩,h⟩,t⟩).hom v)) = _ + cases q with + | zero => exact innerEmbedding_generator_bottom k D X N r n i h t v + | succ q => exact innerEmbedding_generator_positive k D X N r n i q h t (ih q) v +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixSums.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..772af7b7285fa1fb7d6d217273dd1033ac500f24 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixSums.lean @@ -0,0 +1,81 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixEmbedding +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance recursiveSuffixSumsScalarModule (V : ModuleCat.{u} D) : Module k V := + BimoduleTensor.scalarModule k D V +local instance recursiveSuffixSumsScalarTower (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance recursiveSuffixSumsIndexDecidableEq (r n : ℕ) : + DecidableEq (RecursiveTotal.Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) + +/-- Finite coproduct extensionality also holds for k-linear maps out of a D bar. -/ +theorem sum_hom_ext_scalar {I : Type} [Finite I] [DecidableEq I] + (V : I → ModuleCat.{u} D) (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) [G.Additive] + (W : ModuleCat.{u} k) + {f g : G.obj (ModuleCat.of D (⨁ t, V t)) →ₗ[k] W} + (h : ∀ t, f.comp ((G.map (ModuleCat.ofHom (DirectSum.lof D I (fun t => V t) t))).hom.restrictScalars k) = + g.comp ((G.map (ModuleCat.ofHom (DirectSum.lof D I (fun t => V t) t))).hom.restrictScalars k)) : + f=g := by + let : Fintype I := Fintype.ofFinite I + let R := ModuleCat.restrictScalars (algebraMap k D) + have he : (ModuleCat.ofHom f : R.obj (G.obj (ModuleCat.of D (⨁ t, V t))) ⟶ W) = + ModuleCat.ofHom g := by + apply (isColimitOfPreserves (G ⋙ R) (ModuleCat.coproductCoconeIsColimit V)).hom_ext + rintro ⟨t⟩ + exact ModuleCat.hom_ext (h t) + exact congrArg ModuleCat.Hom.hom he + +/-- Suffix insertion commutes with the actual finite-sum distribution map +appearing in the independently defined vertical differential. -/ +theorem innerEmbedding_sumDesc (r n i q : ℕ) (h : i+q=n) + (v : (RecursiveTotal.degreeFunctor B r i).obj (RecursiveTotal.flat B Z r q)) : + innerEmbedding k D X N (r+1) n + ((RecursiveTotal.sumDesc (RecursiveTotal.summand B Z r q) + (RecursiveTotal.degreeFunctor B r i) + (fun t => RecursiveTotal.lof B Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩)).hom v) = + termCast k D X N (show ((r+q)+i)+1=(r+1)+n by omega) + (barSuffix k D X N (RecursiveTotal.flat B Z r q) (r+q) i + (innerEmbedding k D X N r q) v) := by + let C := termCast k D X N (show ((r+q)+i)+1=(r+1)+n by omega) + let S := RecursiveTotal.sumDesc (RecursiveTotal.summand B Z r q) + (RecursiveTotal.degreeFunctor B r i) + (fun t => RecursiveTotal.lof B Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩) + have he : (innerEmbedding k D X N (r+1) n).comp (S.hom.restrictScalars k) = + C.comp (barSuffix k D X N (RecursiveTotal.flat B Z r q) (r+q) i + (innerEmbedding k D X N r q)) := by + apply sum_hom_ext_scalar k D (RecursiveTotal.summand B Z r q) + (RecursiveTotal.degreeFunctor B r i) (term k A N ((r+1)+n)) + intro t + ext w + have hs := congrArg (fun f => f.hom w) + (RecursiveTotal.lof_sumDesc (RecursiveTotal.summand B Z r q) + (RecursiveTotal.degreeFunctor B r i) + (fun t => RecursiveTotal.lof B Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,t⟩) t) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply] at hs + simp only [LinearMap.comp_apply, LinearMap.restrictScalars_apply] + change innerEmbedding k D X N (r+1) n (S.hom _) = C _ + erw [hs] + erw [innerEmbedding_lof_succ k D X N r n i q h t w] + change C _ = C (barSuffix k D X N (RecursiveTotal.flat B Z r q) (r+q) i + (innerEmbedding k D X N r q) ((((XB).map (RecursiveTotal.lof B Z r q t)).f i).hom w)) + rw [barSuffix_map] + exact congrArg (fun f => f v) he +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixTotal.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cbdcf2c4a487a69c5f72078b3888eec879428d7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveSuffixTotal.lean @@ -0,0 +1,99 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixInduction + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +universe u +variable (k D X : 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] +local instance (V : ModuleCat.{u} D) : Module k V := BimoduleTensor.scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance recursiveSuffixTotalIndexDecidableEq (r n : ℕ) : + DecidableEq (RecursiveTotal.Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local instance : Module A N := inflatedModule D X N +local instance : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +/-- The same canonical embedding on the actual recursive total, through the +previously proved finite-sum flattening. -/ +def innerTotalEmbedding (r n : ℕ) : + (RecursiveTotal.iter B Z r).X n →ₗ[k] term k A N (r+n) := + (innerEmbedding k D X N r n).comp + ((RecursiveTotal.flattenIso B Z r n (𝟭 _)).hom.hom.restrictScalars k) + +theorem innerTotalEmbedding_assemble (r n : ℕ) (v : RecursiveTotal.flat B Z r n) : + innerTotalEmbedding k D X N r n ((RecursiveTotal.assemble B Z r n).hom v) = + innerEmbedding k D X N r n v := by + change innerEmbedding k D X N r n + ((RecursiveTotal.flattenIso B Z r n (𝟭 _)).hom.hom + ((RecursiveTotal.flattenIso B Z r n (𝟭 _)).inv.hom v)) = _ + have h := congrArg (fun f => f.hom v) (RecursiveTotal.flattenIso B Z r n (𝟭 _)).inv_hom_id + simp only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_id, LinearMap.id_apply] at h + exact congrArg (innerEmbedding k D X N r n) h + +theorem innerTotalEmbedding_differential (r n : ℕ) + (v : (RecursiveTotal.iter B Z r).X (n+1)) : + SquareZero.multibarAugmentedDifferential k D X N (r+n) + (innerTotalEmbedding k D X N r (n+1) v) = + -innerTotalEmbedding k D X N r n (((RecursiveTotal.iter B Z r).d (n+1) n).hom v) := by + obtain ⟨w,rfl⟩ := (RecursiveTotal.flattenIso B Z r (n+1) (𝟭 _)).toLinearEquiv.symm.surjective v + change SquareZero.multibarAugmentedDifferential k D X N (r+n) + (innerTotalEmbedding k D X N r (n+1) ((RecursiveTotal.assemble B Z r (n+1)).hom w)) = _ + rw [innerTotalEmbedding_assemble, innerEmbedding_differential] + have h := congrArg (fun f => f.hom w) (RecursiveTotal.differential_assemble B Z r n) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply] at h + erw [← h, innerTotalEmbedding_assemble] + +theorem innerTotalEmbedding_smul (r n : ℕ) (d : D) + (v : (RecursiveTotal.iter B Z r).X n) : + innerTotalEmbedding k D X N r n (d • v) = + (inl d : A) • innerTotalEmbedding k D X N r n v := by + change innerEmbedding k D X N r n + ((RecursiveTotal.flattenIso B Z r n (𝟭 _)).hom.hom (d • v)) = + (inl d : A) • innerEmbedding k D X N r n + ((RecursiveTotal.flattenIso B Z r n (𝟭 _)).hom.hom v) + rw [map_smul] + exact innerEmbedding_smul k D X N r n d _ + +theorem innerTotalEmbedding_ideal_zero (r n : ℕ) (x : X) + (v : (RecursiveTotal.iter B Z r).X n) : + (inr x : A) • innerTotalEmbedding k D X N r n v = 0 := + innerEmbedding_ideal_zero k D X N r n x _ + +theorem innerTotalEmbedding_bottom (r : ℕ) (v : (RecursiveTotal.iter B Z (r+1)).X 0) : + SquareZero.multibarAugmentedDifferential k D X N r + (innerTotalEmbedding k D X N (r+1) 0 v) = 0 := + innerEmbedding_bottom k D X N r _ + +theorem innerTotalEmbedding_inclusion (r n : ℕ) (t : RecursiveTotal.Index r n) + (v : RecursiveTotal.summand B Z r n t) : + innerTotalEmbedding k D X N r n ((RecursiveTotal.inclusion B Z r n t).hom v) = + innerEmbedding k D X N r n ((RecursiveTotal.lof B Z r n t).hom v) := by + have h := congrArg (fun f => f.hom v) (RecursiveTotal.lof_assemble B Z r n t) + simp only [ModuleCat.hom_comp, LinearMap.comp_apply] at h + rw [← h, innerTotalEmbedding_assemble] + +theorem innerTotalEmbedding_zero : innerTotalEmbedding k D X N 0 0 = LinearMap.id := by + ext v + have h := innerTotalEmbedding_inclusion k D X N 0 0 () v + change innerTotalEmbedding k D X N 0 0 v = _ at h + have he := congrArg (fun f => f v) (innerEmbedding_zero_lof k D X N ()) + exact h.trans he + +theorem innerTotalEmbedding_zero_succ (n : ℕ) : innerTotalEmbedding k D X N 0 (n+1) = 0 := by + unfold innerTotalEmbedding + simp only [innerEmbedding, LinearMap.zero_comp] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveTotalDifferential.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveTotalDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..06b1b91c7f31c1d5b06ce940c8305a396bcc15a7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveTotalDifferential.lean @@ -0,0 +1,222 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveTotalFlatten + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive +open scoped DirectSum +noncomputable section +namespace DerivedBar.RecursiveTotal +universe u +variable {D : Type u} [Ring D] +local notation "c" => ComplexShape.down ℕ +local instance (r n : ℕ) : DecidableEq (Index r n) := Classical.decEq _ + +section Sums +variable {I : Type} [Finite I] [DecidableEq I] (V : I → ModuleCat.{u} D) + (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) [G.Additive] +local instance : Fintype I := Fintype.ofFinite I + +/-- Distribution over a finite direct sum, defined by its coproduct property. -/ +def sumDesc {Y : ModuleCat.{u} D} (f : ∀ t, G.obj (V t) ⟶ Y) : + G.obj (ModuleCat.of D (⨁ t, V t)) ⟶ Y := + (isColimitOfPreserves G (ModuleCat.coproductCoconeIsColimit V)).desc + { pt := Y + ι := Discrete.natTrans (fun t => f t.as) } + +@[reassoc (attr := simp)] +theorem lof_sumDesc {Y : ModuleCat.{u} D} (f : ∀ t, G.obj (V t) ⟶ Y) (t : I) : + G.map (ModuleCat.ofHom (DirectSum.lof D I (fun t => V t) t)) ≫ + sumDesc V G f = f t := + (isColimitOfPreserves G (ModuleCat.coproductCoconeIsColimit V)).fac _ ⟨t⟩ + +theorem sum_hom_ext {Y : ModuleCat.{u} D} + {f g : G.obj (ModuleCat.of D (⨁ t, V t)) ⟶ Y} + (h : ∀ t, G.map (ModuleCat.ofHom (DirectSum.lof D I (fun t => V t) t)) ≫ f = + G.map (ModuleCat.ofHom (DirectSum.lof D I (fun t => V t) t)) ≫ g) : f=g := by + apply (isColimitOfPreserves G (ModuleCat.coproductCoconeIsColimit V)).hom_ext + rintro ⟨t⟩ + exact h t +end Sums + +variable (B : ℕ → ModuleCat.{u} D ⥤ ChainComplex (ModuleCat.{u} D) ℕ) + [∀ r, (B r).Additive] (Z : ChainComplex (ModuleCat.{u} D) ℕ) + +abbrev flat (r n : ℕ) : ModuleCat.{u} D := + ModuleCat.of D (⨁ t : Index r n, summand B Z r n t) + +def lof (r n : ℕ) (t : Index r n) : summand B Z r n t ⟶ flat B Z r n := + ModuleCat.ofHom (DirectSum.lof D (Index r n) (fun t => summand B Z r n t) t) + +abbrev assemble (r n : ℕ) : flat B Z r n ⟶ (iter B Z r).X n := + (flattenIso B Z r n (𝟭 _)).inv + +@[reassoc (attr := simp)] +theorem lof_assemble (r n : ℕ) (t : Index r n) : + lof B Z r n t ≫ assemble B Z r n = inclusion B Z r n t := by + apply (cancel_mono (flattenIso B Z r n (𝟭 _)).hom).mp + change lof B Z r n t ≫ (flattenIso B Z r n (𝟭 _)).inv ≫ _ = _ + rw [Iso.inv_hom_id, Category.comp_id] + exact (inclusion_desc B Z r (𝟭 _) + (fun t => ModuleCat.ofHom (DirectSum.lof D (Index r n) + (fun t => (𝟭 (ModuleCat D)).obj (summand B Z r n t)) t)) t).symm + +/-- The horizontal face in a literal outer block; there is no face at length zero. -/ +def horizontal (r n i q : ℕ) (h : i+q=n+1) (t : Index r q) : + (degreeFunctor B r i).obj (summand B Z r q t) ⟶ flat B Z (r+1) n := + match i with + | 0 => 0 + | i+1 => ((B r).obj (summand B Z r q t)).d (i+1) i ≫ + lof B Z (r+1) n ⟨⟨⟨i,q⟩,by omega⟩,t⟩ + +/-- The vertical face applies the already defined inner differential, with +exactly the totalization sign (-1)^i, then distributes the resulting finite sum. -/ +def vertical (r n i q : ℕ) (h : i+q=n+1) (t : Index r q) + (d : ∀ q, flat B Z r (q+1) ⟶ flat B Z r q) : + (degreeFunctor B r i).obj (summand B Z r q t) ⟶ flat B Z (r+1) n := + match q with + | 0 => 0 + | q+1 => ((-1 : ℤˣ)^i) • + ((degreeFunctor B r i).map (lof B Z r (q+1) t ≫ d q) ≫ + sumDesc (summand B Z r q) (degreeFunctor B r i) + (fun s => lof B Z (r+1) n ⟨⟨⟨i,q⟩,by omega⟩,s⟩)) + +/-- Independently recursive differential on the flattened direct sum. Its +construction uses only the original functor differentials, finite-sum distribution, +and the previously constructed inner differential, never the total differential. -/ +def differential : (r n : ℕ) → flat B Z r (n+1) ⟶ flat B Z r n + | 0, n => ModuleCat.ofHom (DirectSum.toModule D _ _ + (fun _ => (Z.d (n+1) n ≫ lof B Z 0 n ()).hom)) + | r+1, n => ModuleCat.ofHom (DirectSum.toModule D _ _ + (fun t => (horizontal B Z r n t.1.val.1 t.1.val.2 t.1.property t.2 + + vertical B Z r n t.1.val.1 t.1.val.2 t.1.property t.2 + (differential r)).hom)) + +@[reassoc (attr := simp)] +theorem lof_differential_succ (r n i q : ℕ) (h : i+q=n+1) (t : Index r q) : + lof B Z (r+1) (n+1) ⟨⟨⟨i,q⟩,h⟩,t⟩ ≫ differential B Z (r+1) n = + horizontal B Z r n i q h t + vertical B Z r n i q h t (differential B Z r) := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + simp only [lof, differential, ModuleCat.hom_comp, ModuleCat.hom_ofHom, + LinearMap.comp_apply] + erw [DirectSum.toModule_lof] + rfl + +@[reassoc (attr := simp)] +theorem sumDesc_assemble (r n i q : ℕ) (h : i+q=n) : + sumDesc (summand B Z r q) (degreeFunctor B r i) + (fun s => lof B Z (r+1) n ⟨⟨⟨i,q⟩,h⟩,s⟩) ≫ assemble B Z (r+1) n = + (degreeFunctor B r i).map (assemble B Z r q) ≫ + (bicomplex B r (iter B Z r)).ιTotal c i q n h := by + apply sum_hom_ext + intro t + erw [lof_sumDesc_assoc, lof_assemble] + erw [← Category.assoc, ← Functor.map_comp] + change _ = (degreeFunctor B r i).map (lof B Z r q t ≫ assemble B Z r q) ≫ _ + rw [lof_assemble] + rfl + +/-- The horizontal face agrees with the actual total on every nested tensor. -/ +theorem horizontal_assemble (r n i q : ℕ) (h : i+q=n+1) (t : Index r q) : + horizontal B Z r n i q h t ≫ assemble B Z (r+1) n = + (degreeFunctor B r i).map (inclusion B Z r q t) ≫ + (bicomplex B r (iter B Z r)).d₁ c i q n := by + cases i with + | zero => + erw [horizontal, zero_comp, HomologicalComplex₂.d₁_eq_zero _ _ _ _ _ (by simp), comp_zero] + rfl + | succ i => + erw [horizontal, Category.assoc, lof_assemble, + HomologicalComplex₂.d₁_eq _ _ (by rfl : (c).Rel (i+1) i) q n (by change i+q=n; omega)] + change _ = _ ≫ ((1 : ℤˣ) • _) + erw [one_smul] + change ((B r).obj (summand B Z r q t)).d (i+1) i ≫ + (degreeFunctor B r i).map (inclusion B Z r q t) ≫ _ = + (degreeFunctor B r (i+1)).map (inclusion B Z r q t) ≫ + ((B r).obj ((iter B Z r).X q)).d (i+1) i ≫ _ + exact (((B r).map (inclusion B Z r q t)).comm_assoc (i+1) i + ((bicomplex B r (iter B Z r)).ιTotal c i q n (by change i+q=n; omega))).symm + +/-- The signed vertical face agrees with the actual total whenever the inner +comparison has been proved; the induction below discharges that premise. -/ +theorem vertical_assemble (r n i q : ℕ) (h : i+q=n+1) (t : Index r q) + (ih : ∀ q, differential B Z r q ≫ assemble B Z r q = + assemble B Z r (q+1) ≫ (iter B Z r).d (q+1) q) : + vertical B Z r n i q h t (differential B Z r) ≫ assemble B Z (r+1) n = + (degreeFunctor B r i).map (inclusion B Z r q t) ≫ + (bicomplex B r (iter B Z r)).d₂ c i q n := by + cases q with + | zero => + erw [vertical, zero_comp, HomologicalComplex₂.d₂_eq_zero _ _ _ _ _ (by simp), comp_zero] + rfl + | succ q => + erw [vertical, HomologicalComplex₂.d₂_eq _ _ i (by rfl : (c).Rel (q+1) q) n + (by change i+q=n; omega)] + change _ = _ ≫ (((-1 : ℤˣ)^i) • _) + erw [Linear.units_smul_comp, Linear.comp_units_smul, Category.assoc, + sumDesc_assemble] + congr 1 + erw [← Category.assoc, ← Functor.map_comp, Category.assoc, ih, + ← Category.assoc, lof_assemble, Functor.map_comp, Category.assoc] + +theorem differential_assemble (r n : ℕ) : + differential B Z r n ≫ assemble B Z r n = + assemble B Z r (n+1) ≫ (iter B Z r).d (n+1) n := by + induction r generalizing n with + | zero => + apply sum_hom_ext (summand B Z 0 (n+1)) (𝟭 _) + intro t + cases t + have hf : lof B Z 0 (n+1) () ≫ differential B Z 0 n = + Z.d (n+1) n ≫ lof B Z 0 n () := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + simp only [lof, differential, ModuleCat.hom_comp, ModuleCat.hom_ofHom, + LinearMap.comp_apply] + erw [DirectSum.toModule_lof] + rfl + change lof B Z 0 (n+1) () ≫ _ = lof B Z 0 (n+1) () ≫ _ + erw [← Category.assoc, hf, Category.assoc, lof_assemble, lof_assemble_assoc] + simp only [inclusion, iter] + exact Category.comp_id _ + | succ r ih => + apply sum_hom_ext (summand B Z (r+1) (n+1)) (𝟭 _) + rintro ⟨⟨⟨i,q⟩,h⟩,t⟩ + change lof B Z (r+1) (n+1) _ ≫ _ = lof B Z (r+1) (n+1) _ ≫ _ + erw [lof_differential_succ_assoc, add_comp, horizontal_assemble, + vertical_assemble B Z r n i q h t ih, lof_assemble_assoc] + simp only [inclusion, iter, HomologicalComplex₂.total_d, comp_add] + erw [Category.assoc, Category.assoc, HomologicalComplex₂.ι_D₁, HomologicalComplex₂.ι_D₂] + rfl + +/-- Square-zero is a consequence of the proved differential comparison. -/ +theorem differential_sq (r n : ℕ) : + differential B Z r (n+1) ≫ differential B Z r n = 0 := by + apply (cancel_mono (assemble B Z r n)).mp + rw [Category.assoc, differential_assemble, ← Category.assoc, + differential_assemble, Category.assoc, HomologicalComplex.d_comp_d, + comp_zero, zero_comp] + +/-- The direct sum with its independently recursive signed differential. -/ +def flatComplex (r : ℕ) : ChainComplex (ModuleCat.{u} D) ℕ := + ChainComplex.of (flat B Z r) (differential B Z r) (differential_sq B Z r) + +/-- An actual chain isomorphism flattening every recursive total, with both +horizontal and signed vertical differential verified on literal summands. -/ +def flattenChainIso (r : ℕ) : flatComplex B Z r ≅ iter B Z r := + HomologicalComplex.Hom.isoOfComponents + (fun n => (flattenIso B Z r n (𝟭 _)).symm) + (by + intro i j hij + change j+1=i at hij + subst i + change assemble B Z r (j+1) ≫ (iter B Z r).d (j+1) j = + (flatComplex B Z r).d (j+1) j ≫ assemble B Z r j + simpa only [flatComplex, ChainComplex.of_d] using + (differential_assemble B Z r j).symm) +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/RecursiveTotalFlatten.lean b/lean/OAI/Algebra/Finitistic/Bar/RecursiveTotalFlatten.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb8ac599d9337bc9d66fa45ac226195ebd4ba16f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/RecursiveTotalFlatten.lean @@ -0,0 +1,138 @@ +import OAI.Algebra.Finitistic.Bar.TotalMap +import Mathlib.Algebra.Category.ModuleCat.Products + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive +open scoped DirectSum +noncomputable section +namespace DerivedBar.RecursiveTotal +universe u +variable {D : Type u} [Ring D] +local notation "c" => ComplexShape.down ℕ + +abbrev Diagonal (n : ℕ) := {p : ℕ × ℕ // p.1+p.2=n} + +/-- Every index records every bar length and the final input degree. -/ +def Index : ℕ → ℕ → Type + | 0, _ => Unit + | r+1, n => (p : Diagonal n) × Index r p.val.2 + +instance indexFinite (r n : ℕ) : Finite (Index r n) := by + induction r generalizing n with + | zero => exact inferInstanceAs (Finite Unit) + | succ r ih => + have : Finite (Diagonal n) := DerivedBar.finiteTotalDiagonal n + have (degree : ℕ) : Finite (Index r degree) := ih degree + exact inferInstanceAs (Finite ((p : Diagonal n) × Index r p.val.2)) + +local instance (r n : ℕ) : DecidableEq (Index r n) := Classical.decEq _ + +variable (B : ℕ → ModuleCat.{u} D ⥤ ChainComplex (ModuleCat.{u} D) ℕ) + [∀ r, (B r).Additive] + +abbrev degreeFunctor (r i : ℕ) : ModuleCat.{u} D ⥤ ModuleCat.{u} D := + B r ⋙ HomologicalComplex.eval _ c i + +variable (Z : ChainComplex (ModuleCat.{u} D) ℕ) + +def bicomplex (r : ℕ) (W : ChainComplex (ModuleCat.{u} D) ℕ) : + HomologicalComplex₂ (ModuleCat.{u} D) c c := + HomologicalComplex₂.flip (((B r).mapHomologicalComplex c).obj W) + +/-- Successively totalize the given module-to-chain functors. -/ +def iter : ℕ → ChainComplex (ModuleCat.{u} D) ℕ + | 0 => Z + | r+1 => (bicomplex B r (iter r)).total c + +/-- Literal nested terms, before any coproducts are taken. -/ +def summand : (r n : ℕ) → Index r n → ModuleCat.{u} D + | 0, n, _ => Z.X n + | r+1, _, ⟨p,t⟩ => (degreeFunctor B r p.val.1).obj (summand r p.val.2 t) + +/-- Insert a literal nested term into the actual recursive total. -/ +def inclusion : (r n : ℕ) → (t : Index r n) → summand B Z r n t ⟶ (iter B Z r).X n + | 0, _, _ => 𝟙 _ + | r+1, n, ⟨p,t⟩ => + (degreeFunctor B r p.val.1).map (inclusion r p.val.2 t) ≫ + (bicomplex B r (iter B Z r)).ιTotal c p.val.1 p.val.2 n p.property + +/-- A map out of an additive image of the recursive total is specified on all +literal nested terms. Only finite diagonal coproducts are distributed. -/ +def desc : (r : ℕ) → (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) → [G.Additive] → + {n : ℕ} → {Y : ModuleCat.{u} D} → + (∀ t : Index r n, G.obj (summand B Z r n t) ⟶ Y) → + (G.obj ((iter B Z r).X n) ⟶ Y) + | 0, _, _, _, _, f => f () + | r+1, G, _, _, _, f => totalMapDesc G (bicomplex B r (iter B Z r)) + (fun i q h => desc r (degreeFunctor B r i ⋙ G) (fun t => f ⟨⟨⟨i,q⟩,h⟩,t⟩)) + +@[reassoc (attr := simp)] +theorem inclusion_desc (r : ℕ) (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) [G.Additive] + {n : ℕ} {Y : ModuleCat.{u} D} + (f : ∀ t : Index r n, G.obj (summand B Z r n t) ⟶ Y) (t : Index r n) : + G.map (inclusion B Z r n t) ≫ desc B Z r G f = f t := by + induction r generalizing G n with + | zero => + cases t + change G.map (𝟙 (Z.X n)) ≫ f () = f () + erw [G.map_id, Category.id_comp] + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,h⟩,t⟩ + simp only [inclusion, desc] + erw [Functor.map_comp, Category.assoc, ι_totalMapDesc] + exact ih (degreeFunctor B r i ⋙ G) _ t + +theorem hom_ext (r : ℕ) (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) [G.Additive] + {n : ℕ} {Y : ModuleCat.{u} D} + {f g : G.obj ((iter B Z r).X n) ⟶ Y} + (h : ∀ t : Index r n, G.map (inclusion B Z r n t) ≫ f = + G.map (inclusion B Z r n t) ≫ g) : f=g := by + induction r generalizing G n with + | zero => + have hh := h () + change G.map (𝟙 (Z.X n)) ≫ f = G.map (𝟙 (Z.X n)) ≫ g at hh + erw [G.map_id, Category.id_comp, Category.id_comp] at hh + exact hh + | succ r ih => + apply totalMap_hom_ext G (bicomplex B r (iter B Z r)) + intro i q hq + apply ih (degreeFunctor B r i ⋙ G) + intro t + have hh := h ⟨⟨⟨i,q⟩,hq⟩,t⟩ + dsimp only [inclusion] at hh + erw [Functor.map_comp] at hh + simpa only [Category.assoc, Functor.comp_map] using! hh + +/-- Actual degreewise flattening into an ordinary direct sum of nested tensors. +The universal property is proved for the recursive totals, not assumed. -/ +def flattenIso (r n : ℕ) (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) [G.Additive] : + G.obj ((iter B Z r).X n) ≅ + ModuleCat.of D (⨁ t : Index r n, G.obj (summand B Z r n t)) where + hom := desc B Z r G (fun t => ModuleCat.ofHom (DirectSum.lof D (Index r n) (fun t => G.obj (summand B Z r n t)) t)) + inv := ModuleCat.ofHom (DirectSum.toModule D _ _ + (fun t => (G.map (inclusion B Z r n t)).hom)) + hom_inv_id := by + apply hom_ext B Z r G + intro t + simp only [inclusion_desc_assoc, Category.comp_id] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + simp only [ModuleCat.hom_comp, ModuleCat.hom_ofHom, LinearMap.comp_apply, + DirectSum.toModule_lof] + inv_hom_id := by + apply ModuleCat.hom_ext + apply DirectSum.linearMap_ext + intro t + apply LinearMap.ext + intro v + have h := congrArg (fun f => f.hom v) + (inclusion_desc B Z r G + (fun t => ModuleCat.ofHom (DirectSum.lof D (Index r n) (fun t => G.obj (summand B Z r n t)) t)) t) + simpa only [ModuleCat.hom_comp, ModuleCat.hom_ofHom, LinearMap.comp_apply, + DirectSum.toModule_lof, ModuleCat.hom_id, LinearMap.id_apply] using h +end DerivedBar.RecursiveTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/ResolutionDerived.lean b/lean/OAI/Algebra/Finitistic/Bar/ResolutionDerived.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce100823143d65f69ac90a45cfbe2437d28d6872 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/ResolutionDerived.lean @@ -0,0 +1,84 @@ +import Mathlib.CategoryTheory.Functor.Derived.LeftDerived + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Functor +noncomputable section +namespace DerivedBar +variable {C E H : Type*} [Category* C] [Category* E] [Category* H] +variable (W : MorphismProperty C) (L : C ⥤ E) [L.IsLocalization W] +variable (R : C ⥤ C) (ε : R ⟶ 𝟭 C) (hε : ∀ X, W (ε.app X)) +variable (F : C ⥤ H) (LF : E ⥤ H) (e : L ⋙ LF ≅ R ⋙ F) +variable (α : L ⋙ LF ⟶ F) (hα : α = e.hom ≫ whiskerRight ε F) +variable (hres : ∀ X, IsIso (α.app (R.obj X))) + +include hε in +lemma resolution_map_isIso (X : C) : IsIso (L.map (ε.app X)) := + Localization.inverts L W _ (hε X) + +/-- A candidate map into the resolved model, before descending the localization. -/ +def resolutionLiftUp (G : E ⥤ H) (β : L ⋙ G ⟶ F) : L ⋙ G ⟶ L ⋙ LF := by + have : IsIso (whiskerRight ε (L ⋙ G)) := by + rw [NatTrans.isIso_iff_isIso_app] + intro X + have := resolution_map_isIso W L R ε hε X + exact inferInstanceAs (IsIso (G.map (L.map (ε.app X)))) + exact inv (whiskerRight ε (L ⋙ G)) ≫ whiskerLeft R β ≫ e.inv + +/-- Full faithfulness of precomposition by the localization descends that map. -/ +def resolutionLift (G : E ⥤ H) (β : L ⋙ G ⟶ F) : G ⟶ LF := + (Localization.fullyFaithfulWhiskeringLeft L W H).preimage + (resolutionLiftUp W L R ε hε F LF e G β) + +lemma whisker_resolutionLift (G : E ⥤ H) (β : L ⋙ G ⟶ F) : + whiskerLeft L (resolutionLift W L R ε hε F LF e G β) = + resolutionLiftUp W L R ε hε F LF e G β := + (Localization.fullyFaithfulWhiskeringLeft L W H).map_preimage _ + +include hα in +lemma resolutionLift_fac (G : E ⥤ H) (β : L ⋙ G ⟶ F) : + whiskerLeft L (resolutionLift W L R ε hε F LF e G β) ≫ α = β := by + rw [whisker_resolutionLift, hα] + ext X + have := resolution_map_isIso W L R ε hε X + simp only [resolutionLiftUp, NatTrans.comp_app, NatIso.isIso_inv_app, whiskerLeft_app, + whiskerRight_app, Category.assoc, Iso.inv_hom_id_app_assoc] + change inv (G.map (L.map (ε.app X))) ≫ β.app (R.obj X) ≫ F.map (ε.app X) = β.app X + rw [← β.naturality (ε.app X)] + simp + +include hres hε in +lemma resolutionLift_unique (G : E ⥤ H) (γ₁ γ₂ : G ⟶ LF) + (h : whiskerLeft L γ₁ ≫ α = whiskerLeft L γ₂ ≫ α) : γ₁ = γ₂ := by + apply Localization.natTrans_ext L W + intro X + have := resolution_map_isIso W L R ε hε X + have := hres X + have heq : γ₁.app (L.obj (R.obj X)) = γ₂.app (L.obj (R.obj X)) := by + apply (cancel_mono (α.app (R.obj X))).mp + exact congrArg (fun τ => τ.app (R.obj X)) h + rw [← cancel_epi (G.map (L.map (ε.app X)))] + have hn₁ := γ₁.naturality (L.map (ε.app X)) + have hn₂ := γ₂.naturality (L.map (ε.app X)) + dsimp only [Functor.id_obj] at hn₁ hn₂ + rw [heq] at hn₁ + exact hn₁.trans hn₂.symm + +include hε hα hres in +/-- A functorial resolution computes the genuine left derived functor. +The criterion is a right Kan extension universal property; its hypotheses are +checked on the actual bar resolution in the application. -/ +theorem isLeftDerivedFunctor_of_resolution : LF.IsLeftDerivedFunctor α W where + isRightKanExtension := by + refine ⟨⟨IsTerminal.ofUniqueHom (fun y => + CostructuredArrow.homMk (resolutionLift W L R ε hε F LF e y.left y.hom) + (resolutionLift_fac W L R ε hε F LF e α hα y.left y.hom)) ?_⟩⟩ + intro y m + apply CostructuredArrow.hom_ext + apply resolutionLift_unique W L R ε hε F LF α hres y.left + have hm : whiskerLeft L m.left ≫ α = y.hom := by simpa using m.w + exact hm.trans (resolutionLift_fac W L R ε hε F LF e α hα y.left y.hom).symm +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/SignedBlockExplicit.lean b/lean/OAI/Algebra/Finitistic/Bar/SignedBlockExplicit.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5718e46321a6e76782ecff2ec1e184dd766fe4c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/SignedBlockExplicit.lean @@ -0,0 +1,124 @@ +import OAI.Algebra.Finitistic.Bar.ExplicitSignedDifferential +import OAI.Algebra.Finitistic.Bar.SignedBlockModel + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.SquareZero +universe u +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] + [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] +local notation "A" => TrivSqZeroExt D X +variable (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = (0 : N)) + +include hN in +/-- The explicit faces equal the conjugated ordinary faces; this is a theorem, +not the definition of the independent differential. -/ +theorem multibarTwoSided_eq_conjugate (n r : ℕ) + {z : D ⊗[k] term k A N (n+1)} (hz : z ∈ twoSidedWeight k D X N (n+1) r) : + multibarTwoSidedDifferential k D X N n z = + (-1 : k)^r • twoSidedSignedProjection k D X N n r + (twoSidedDifferential k A D N (fstHom k D X) n + (twoSidedSignedProjection k D X N (n+1) r z)) := by + have h := multibarTwoSided_sign k D X N hN n r (twoSidedSignedProjection_mem hz) + rw [twoSidedSignedProjection_sq hz] at h + exact h + +include hN in +theorem multibarTwoSided_mem (n r : ℕ) + {z : D ⊗[k] term k A N (n+1)} (hz : z ∈ twoSidedWeight k D X N (n+1) r) : + multibarTwoSidedDifferential k D X N n z ∈ twoSidedWeight k D X N n r := by + rw [multibarTwoSided_eq_conjugate k D X N hN n r hz] + exact (twoSidedWeight k D X N n r).restrictScalars k |>.smul_mem _ + (twoSidedSignedProjection_mem (twoSidedDifferential_mem hN n r + (twoSidedSignedProjection_mem hz))) + +include hN in +theorem multibarTwoSided_shifted (n r : ℕ) + {z : D ⊗[k] term k A N (n+1)} (hz : z ∈ twoSidedWeight k D X N (n+1) r) : + (-1 : k)^r • multibarTwoSidedDifferential k D X N n z = + twoSidedSignedProjection k D X N n r + (twoSidedDifferential k A D N (fstHom k D X) n + (twoSidedSignedProjection k D X N (n+1) r z)) := by + rw [multibarTwoSided_eq_conjugate k D X N hN n r hz, smul_smul, ← mul_pow] + simp + +/-- Restriction of the independently defined literal faces to count r. -/ +def multibarCountDifferential (n r : ℕ) : + twoSidedWeight k D X N (n+1) r →ₗ[D] twoSidedWeight k D X N n r := + (multibarTwoSidedDifferential k D X N n).restrict + (fun _ hz => multibarTwoSided_mem k D X N hN n r hz) + +/-- There is no outgoing differential from an all-X word, or below its count. +The ordinary r=0 degree-zero boundary is supplied by the chain shape. -/ +theorem multibarCountDifferential_zero_of_lt (n r : ℕ) (hn : n < r) : + multibarCountDifferential k D X N hN n r = 0 := by + apply LinearMap.ext + intro z + apply Subtype.ext + have hz := (multibarCountDifferential k D X N hN n r z).property + exact (show twoSidedWeight k D X N n r ≤ ⊥ from + le_of_eq (twoSidedWeight_eq_bot_of_lt hn)) hz + +end DerivedBar.SquareZero +namespace DerivedBar.Multibar.Indexed +universe u +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] + [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] +variable (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = (0 : N)) + +/-- Literal multibar faces on the direct sum of actual tensor blocks, with the +[r] sign. Only the degreewise tensor decomposition is used for coordinates. -/ +def explicitBlockDifferential (n r : ℕ) : + (⨁ p : Shape (n+1) r, outerTensor k D X N p) →ₗ[D] + (⨁ p : Shape n r, outerTensor k D X N p) := + (decomposition k D X N n r).symm.toLinearMap.comp + (((-1 : k)^r • SquareZero.multibarCountDifferential k D X N hN n r).comp + (decomposition k D X N (n+1) r).toLinearMap) + +/-- The previously transported signed differential is identified with independent +literal faces, including the endpoint and square-zero empty-block cases. -/ +theorem blockDifferential_eq_explicit (n r : ℕ) : + blockDifferential k D X N hN n r = explicitBlockDifferential k D X N hN n r := by + apply LinearMap.ext + intro z + apply (decomposition k D X N n r).injective + apply Subtype.ext + change ((decomposition k D X N n r) + ((decomposition k D X N n r).symm + ((SquareZero.signEquiv k D X N n r).symm + (((SquareZero.twoSidedWeightComplex k D X N hN r).d (n+1) n).hom + (SquareZero.signEquiv k D X N (n+1) r (decomposition k D X N (n+1) r z)))))).val = + ((decomposition k D X N n r) ((decomposition k D X N n r).symm + (((-1 : k)^r • SquareZero.multibarCountDifferential k D X N hN n r) + (decomposition k D X N (n+1) r z)))).val + rw [LinearEquiv.apply_symm_apply, LinearEquiv.apply_symm_apply] + simp only [SquareZero.twoSidedWeightComplex, ChainComplex.of_d, ModuleCat.hom_ofHom] + exact (SquareZero.multibarTwoSided_shifted k D X N hN n r + (decomposition k D X N (n+1) r z).property).symm + +/-- Square-zero follows after identifying the independent differential with the +verified chain differential; no transported differential was used to define it. -/ +theorem explicitBlockDifferential_sq (n r : ℕ) : + (explicitBlockDifferential k D X N hN n r).comp + (explicitBlockDifferential k D X N hN (n+1) r) = 0 := by + rw [← blockDifferential_eq_explicit, ← blockDifferential_eq_explicit] + exact blockDifferential_sq k D X N hN n r + +theorem explicitBlockDifferential_zero_of_lt (n r : ℕ) (hn : n < r) : + explicitBlockDifferential k D X N hN n r = 0 := by + unfold explicitBlockDifferential + rw [SquareZero.multibarCountDifferential_zero_of_lt k D X N hN n r hn] + simp +end DerivedBar.Multibar.Indexed + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/SignedBlockModel.lean b/lean/OAI/Algebra/Finitistic/Bar/SignedBlockModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..d95615c527ff6878e17aef84b4d31f1ff29f739f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/SignedBlockModel.lean @@ -0,0 +1,148 @@ +import OAI.Algebra.Finitistic.Bar.MultibarDecomposition +import Mathlib.Data.Fintype.Vector + +namespace OAI +open scoped TensorProduct DirectSum +open TensorProduct TrivSqZeroExt CategoryTheory +noncomputable section + +namespace DerivedBar.Multibar.Indexed +universe u + +/-- The degree-indexed shapes faithfully record their D/X words. -/ +theorem toList_injective {n r : ℕ} : Function.Injective (@toList n r) := by + intro p + induction p with + | nil => intro q h; cases q; rfl + | base p ih => + intro q h + cases q with + | base q => exact congrArg Shape.base (ih (List.cons.inj h).2) + | ideal q => exact Bool.noConfusion (List.cons.inj h).1 + | ideal p ih => + intro q h + cases q with + | base q => exact Bool.noConfusion (List.cons.inj h).1 + | ideal q => exact congrArg Shape.ideal (ih (List.cons.inj h).2) + +/-- The block direct sum is finite in every degree, without any completion. -/ +instance shape_finite (n r : ℕ) : Finite (Shape n r) := + @Finite.of_injective (Shape n r) (List.Vector Bool n) _ (fun p => (⟨toList p, length_toList p⟩ : List.Vector Bool n)) + (fun _ _ h => toList_injective (congrArg Subtype.val h)) + +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] + +omit [Module D X] [Module Dᵐᵒᵖ X] [SMulCommClass D Dᵐᵒᵖ X] + [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] in +/-- The indexed tensor is exactly the earlier literal D/X pattern tensor. -/ +theorem tensor_toList {n r : ℕ} (p : Shape n r) : + tensor k D X N p = patternTerm k D X N (toList p) := by + induction p with + | nil => rfl + | base p ih => exact congrArg (fun V : ModuleCat k => ModuleCat.of k (D ⊗[k] V)) ih + | ideal p ih => exact congrArg (fun V : ModuleCat k => ModuleCat.of k (X ⊗[k] V)) ih + +/-- The sign involution acts by the prescribed inversion count on each tensor summand. -/ +theorem inclusion_sign {n r : ℕ} (p : Shape n r) (v : tensor k D X N p) : + SquareZero.signedProjection k D X N n r (inclusion k D X N p v) = + (-1 : k)^(inversions (toList p)) • inclusion k D X N p v := by + induction p with + | nil => simp only [inclusion, toList, inversions, pow_zero, one_smul, + SquareZero.signedProjection, LinearMap.id_apply] + | @base n r p ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + change SquareZero.signedProjection k D X N (n+1) r + ((inl d : TrivSqZeroExt D X) ⊗ₜ[k] inclusion k D X N p v) = _ + rw [SquareZero.signedProjection_base, ih, TensorProduct.tmul_smul, smul_smul, + ← pow_add] + simp only [toList, inversions, count_toList] + rfl + | add v w hv hw => simp only [map_add, hv, hw, smul_add] + | @ideal n r p ih => + induction v using TensorProduct.inductionOn with + | tmul x v => + change SquareZero.signedProjection k D X N (n+1) (r+1) + ((inr x : TrivSqZeroExt D X) ⊗ₜ[k] inclusion 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] + +theorem outerInclusion_sign {n r : ℕ} (p : Shape n r) (v : outerTensor k D X N p) : + SquareZero.twoSidedSignedProjection k D X N n r (outerInclusion k D X N p v) = + (-1 : k)^(inversions (toList p)) • outerInclusion k D X N p v := by + induction v using TensorProduct.inductionOn with + | tmul d v => + change d ⊗ₜ[k] SquareZero.signedProjection k D X N n r (inclusion k D X N p v) = _ + rw [inclusion_sign, TensorProduct.tmul_smul] + rfl + | add v w hv hw => simp only [map_add, hv, hw, smul_add] + +/-- Summation of genuine tensor blocks followed by the source's sign rescaling. -/ +def signedAssembly (n r : ℕ) : (⨁ p : Shape n r, outerTensor k D X N p) ≃ₗ[D] + SquareZero.twoSidedWeight k D X N n r := + (decomposition k D X N n r).trans (SquareZero.signEquiv k D X N n r) + +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] +variable (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = 0) + +/-- Transport of the actual count differential to signed tensor blocks. -/ +def blockDifferential (n r : ℕ) : + (⨁ p : Shape (n+1) r, outerTensor k D X N p) →ₗ[D] + (⨁ p : Shape n r, outerTensor k D X N p) := + (signedAssembly k D X N n r).symm.toLinearMap.comp + (((SquareZero.twoSidedWeightComplex k D X N hN r).d (n+1) n).hom.comp + (signedAssembly k D X N (n+1) r).toLinearMap) + +theorem blockDifferential_sq (n r : ℕ) : + (blockDifferential k D X N hN n r).comp (blockDifferential k D X N hN (n+1) r) = 0 := by + apply LinearMap.ext + intro z + change (signedAssembly k D X N n r).symm + (((SquareZero.twoSidedWeightComplex k D X N hN r).d (n+1) n).hom + (signedAssembly k D X N (n+1) r + ((signedAssembly k D X N (n+1) r).symm + (((SquareZero.twoSidedWeightComplex k D X N hN r).d (n+1+1) (n+1)).hom + (signedAssembly k D X N (n+1+1) r z))))) = 0 + erw [LinearEquiv.apply_symm_apply] + have h := LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp + ((SquareZero.twoSidedWeightComplex k D X N hN r).d_comp_d (n+1+1) (n+1) n)) + (signedAssembly k D X N (n+1+1) r z) + change ((SquareZero.twoSidedWeightComplex k D X N hN r).d (n+1) n).hom + (((SquareZero.twoSidedWeightComplex k D X N hN r).d (n+1+1) (n+1)).hom + (signedAssembly k D X N (n+1+1) r z)) = 0 at h + change (signedAssembly k D X N n r).symm _ = 0 + exact (congrArg (signedAssembly k D X N n r).symm h).trans + (map_zero (signedAssembly k D X N n r).symm) + +/-- Signed block chain model, still indexed by the full homological degree r+Σiⱼ. -/ +def signedBlockComplex (r : ℕ) : ChainComplex (ModuleCat D) ℕ := + ChainComplex.of (fun n => ModuleCat.of D (⨁ p : Shape n r, outerTensor k D X N p)) + (fun n => ModuleCat.ofHom (blockDifferential k D X N hN n r)) + (fun n => ModuleCat.hom_ext (blockDifferential_sq k D X N hN n r)) + +/-- Chain isomorphism between the signed block model and the preserved count subcomplex. -/ +def signedBlockIso (r : ℕ) : signedBlockComplex k D X N hN r ≅ + SquareZero.twoSidedWeightComplex k D X N hN r := + HomologicalComplex.Hom.isoOfComponents + (fun n => (signedAssembly k D X N n r).toModuleIso) + (by + intro i j hij + change j+1 = i at hij + subst i + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + simp only [LinearEquiv.toModuleIso_hom, signedBlockComplex, ChainComplex.of_d] + change ((SquareZero.twoSidedWeightComplex k D X N hN r).d (j+1) j).hom + (signedAssembly k D X N (j+1) r v) = + signedAssembly k D X N j r (blockDifferential k D X N hN j r v) + exact (LinearEquiv.apply_symm_apply (signedAssembly k D X N j r) _).symm) +end DerivedBar.Multibar.Indexed + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/SplitProjectiveTail.lean b/lean/OAI/Algebra/Finitistic/Bar/SplitProjectiveTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b9d19182a8ebf3eef7b0683a13816ac3c2b12e7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/SplitProjectiveTail.lean @@ -0,0 +1,89 @@ +import OAI.Algebra.Finitistic.Bar.ProjectiveTail + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive CategoryTheory.Category +namespace DerivedBar.ProjectiveTail +universe u v u' v' +variable {C : Type u} [Category.{v} C] [Abelian C] +variable {E : Type u'} [Category.{v'} E] [Abelian E] + +/-- A local contracting identity forces exactness, without assumptions on the +first or third term. -/ +theorem exact_of_local_contraction (S : ShortComplex C) + (a : S.X₂ ⟶ S.X₁) (b : S.X₃ ⟶ S.X₂) + (h : a ≫ S.f + S.g ≫ b = 𝟙 _) : S.Exact := by + apply S.exact_iff_epi_toCycles.mpr + have : IsSplitEpi S.toCycles := ⟨⟨{ + section_ := S.iCycles ≫ a + id := by + apply (cancel_mono S.iCycles).mp + rw [Category.assoc, S.toCycles_i] + have hh := congrArg (fun f => S.iCycles ≫ f) h + simpa only [comp_add, Category.assoc, S.iCycles_g_assoc, zero_comp, + add_zero, comp_id, id_comp] using hh }⟩⟩ + infer_instance + +variable (K : ChainComplex C ℕ) + +/-- Three adjacent split cycle sequences contract the middle degree. -/ +theorem contraction_of_splittings (n : ℕ) + (s0 : (cyclesSequence K n).Splitting) + (s1 : (cyclesSequence K (n+1)).Splitting) + (s2 : (cyclesSequence K (n+2)).Splitting) : + (s1.r ≫ s2.s) ≫ K.d (n+3) (n+2) + + K.d (n+2) (n+1) ≫ (s0.r ≫ s1.s) = 𝟙 (K.X (n+2)) := by + have hleft : (s1.r ≫ s2.s) ≫ K.d (n+3) (n+2) = + s1.r ≫ (cyclesSequence K (n+1)).f := by + rw [← K.toCycles_i (n+3) (n+2)] + change (s1.r ≫ s2.s) ≫ (cyclesSequence K (n+2)).g ≫ + (cyclesSequence K (n+1)).f = _ + simp only [Category.assoc, s2.s_g_assoc] + have hright : K.d (n+2) (n+1) ≫ (s0.r ≫ s1.s) = + (cyclesSequence K (n+1)).g ≫ s1.s := by + rw [← K.toCycles_i (n+2) (n+1)] + change ((cyclesSequence K (n+1)).g ≫ (cyclesSequence K n).f) ≫ + (s0.r ≫ s1.s) = _ + simp only [Category.assoc, s0.f_r_assoc] + rw [hleft, hright] + exact s1.id + +/-- Every additive functor preserves exactness in such a split tail. -/ +theorem map_exact_of_splittings (F : C ⥤ E) [F.Additive] (n : ℕ) + (s0 : (cyclesSequence K n).Splitting) + (s1 : (cyclesSequence K (n+1)).Splitting) + (s2 : (cyclesSequence K (n+2)).Splitting) : + ((F.mapHomologicalComplex (.down ℕ)).obj K).ExactAt (n+2) := by + let L := (F.mapHomologicalComplex (.down ℕ)).obj K + apply (L.exactAt_iff' (n+3) (n+2) (n+1) (by simp) (by simp)).mpr + apply exact_of_local_contraction _ (F.map (s1.r ≫ s2.s)) (F.map (s0.r ≫ s1.s)) + change F.map (s1.r ≫ s2.s) ≫ F.map (K.d (n+3) (n+2)) + + F.map (K.d (n+2) (n+1)) ≫ F.map (s0.r ≫ s1.s) = 𝟙 _ + rw [← F.map_comp, ← F.map_comp, ← F.map_add, contraction_of_splittings K n s0 s1 s2, + F.map_id] + +/-- A global dimension bound makes the exact projective tail split, uniformly +for every additive functor. The harmless two-degree allowance avoids boundary +conventions and suffices for finite cohomological amplitude. -/ +theorem map_exact_tail (F : C ⥤ E) [F.Additive] (a g : ℕ) + (he : ∀ i, a ≤ i → K.ExactAt i) + (hp : ∀ i, Projective (K.X i)) + (hg : ∀ M : C, HasProjectiveDimensionLE M g) + (n : ℕ) (hn : a+g+2 ≤ n) : + ((F.mapHomologicalComplex (.down ℕ)).obj K).ExactAt n := by + have hc (i : ℕ) (hi : a+g ≤ i) : Projective (K.cycles i) := by + obtain ⟨t, rfl⟩ := Nat.exists_eq_add_of_le hi + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using + cycles_projective K (a+t) g (fun j hj => he j (by omega)) hp (hg _) + let split (i : ℕ) (hi : a+g ≤ i) : (cyclesSequence K i).Splitting := by + haveI : Projective (cyclesSequence K i).X₃ := hc i hi + exact (cyclesSequence_shortExact K i (he i (by omega))).splittingOfProjective + obtain ⟨t,rfl⟩ := Nat.exists_eq_add_of_le hn + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using + map_exact_of_splittings K F (a+g+t) + (split _ (by omega)) (split _ (by omega)) (split _ (by omega)) +end DerivedBar.ProjectiveTail + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/Splitting.lean b/lean/OAI/Algebra/Finitistic/Bar/Splitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..44c0a1d857ec071f765b3a7ae2b5c131c3eae724 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/Splitting.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.Finitistic.Bar.Projection +import Mathlib.Algebra.DirectSum.Module + +namespace OAI +open scoped TensorProduct DirectSum +open TensorProduct CategoryTheory TrivSqZeroExt +noncomputable section + +namespace DerivedBar.SquareZero +universe u + +private theorem internal_of_projections {R V : Type u} [Ring R] [AddCommGroup V] [Module R V] + (S : ℕ → Submodule R V) (p : ℕ → Module.End R V) + (hself : ∀ r v, v ∈ S r → p r v = v) + (hother : ∀ r s, r ≠ s → ∀ v, v ∈ S s → p r v = 0) + (htop : iSup S = ⊤) : DirectSum.IsInternal S := by + apply DirectSum.isInternal_submodule_of_iSupIndep_of_iSup_eq_top _ htop + intro r + rw [Submodule.disjoint_def] + intro v hv hrest + have hle : (⨆ (s : ℕ) (_ : s ≠ r), S s) ≤ (p r).ker := by + refine iSup_le fun s => iSup_le fun hs => ?_ + intro w hw + exact hother r s (Ne.symm hs) w hw + have hz := hle hrest + change p r v = 0 at hz + rwa [hself r v hv] at hz + +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] + +/-- The homogeneous absolute bar term is an internal direct sum. -/ +theorem weight_internal (n : ℕ) : DirectSum.IsInternal (weight k D X N n) := + internal_of_projections _ (projection k D X N n) + (fun _ _ h => projection_self h) (fun _ _ h _ hv => projection_other h hv) + (weight_iSup k D X N n) + +/-- Actual D-linear count projection on the two-sided bar term. -/ +def twoSidedProjection (n r : ℕ) : Module.End D (D ⊗[k] term k (TrivSqZeroExt D X) N n) := + AlgebraTensorModule.lTensor D D (projection k D X N n r) + +@[simp] theorem twoSidedProjection_tmul (n r : ℕ) (d : D) + (v : term k (TrivSqZeroExt D X) N n) : + twoSidedProjection k D X N n r (d ⊗ₜ[k] v) = d ⊗ₜ[k] projection k D X N n r v := rfl + +variable {k D X N} + +theorem twoSidedProjection_self {n r : ℕ} + {v : D ⊗[k] term k (TrivSqZeroExt D X) N n} (hv : v ∈ twoSidedWeight k D X N n r) : + twoSidedProjection k D X N n r v = v := by + have hle : twoSidedWeight k D X N n r ≤ + (twoSidedProjection k D X N n r - LinearMap.id).ker := by + apply Submodule.span_le.mpr + rintro w ⟨d, z, hz, rfl⟩ + change d ⊗ₜ[k] projection k D X N n r z - d ⊗ₜ[k] z = 0 + rw [projection_word hz r, ite_eq_left rfl, sub_self] + have hz := hle hv + change twoSidedProjection k D X N n r v - v = 0 at hz + exact sub_eq_zero.mp hz + +theorem twoSidedProjection_other {n r s : ℕ} (hrs : r ≠ s) + {v : D ⊗[k] term k (TrivSqZeroExt D X) N n} (hv : v ∈ twoSidedWeight k D X N n s) : + twoSidedProjection k D X N n r v = 0 := by + have hle : twoSidedWeight k D X N n s ≤ (twoSidedProjection k D X N n r).ker := by + apply Submodule.span_le.mpr + rintro w ⟨d, z, hz, rfl⟩ + change d ⊗ₜ[k] projection k D X N n r z = 0 + rw [projection_word hz r, ite_eq_right hrs, TensorProduct.tmul_zero] + exact hle hv + +variable (k D X N) + +/-- Expansion of internal A entries as D ⊕ X spans the two-sided bar term as a D-module. -/ +theorem twoSidedWeight_iSup (n : ℕ) : (⨆ r, twoSidedWeight k D X N n r) = ⊤ := by + apply top_unique + intro v hv + clear hv + induction v using TensorProduct.inductionOn with + | add x y hx hy => exact Submodule.add_mem _ hx hy + | tmul d v => + let T := (⨆ r, twoSidedWeight k D X N n r) + let g := TensorProduct.mk k D (term k (TrivSqZeroExt D X) N n) d + have hle : Submodule.span k {w | ∃ r, Word k D X N n r w} ≤ + (T.restrictScalars k).comap g := by + apply Submodule.span_le.mpr + rintro w ⟨r, hw⟩ + exact (le_iSup (twoSidedWeight k D X N n) r) + (Submodule.subset_span ⟨d, w, hw, rfl⟩) + apply hle + rw [all_words_span] + trivial + +/-- The genuine D-module decomposition of each two-sided bar term by X-count. -/ +theorem twoSidedWeight_internal (n : ℕ) : DirectSum.IsInternal (twoSidedWeight k D X N n) := + internal_of_projections _ (twoSidedProjection k D X N n) + (fun _ _ h => twoSidedProjection_self h) + (fun _ _ h _ hv => twoSidedProjection_other h hv) + (twoSidedWeight_iSup k D X N n) + +/-- Canonical sum of homogeneous tensors, as a linear equivalence. -/ +def twoSidedWeightEquiv (n : ℕ) : + (⨁ r : ℕ, twoSidedWeight k D X N n r) ≃ₗ[D] + D ⊗[k] term k (TrivSqZeroExt D X) N n := + LinearEquiv.ofBijective (DirectSum.coeLinearMap _) (twoSidedWeight_internal k D X N n) +end DerivedBar.SquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/StrictSupportExtension.lean b/lean/OAI/Algebra/Finitistic/Bar/StrictSupportExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6f16db7c8d0290ba3f44fd1b4d93e14f8d7c819 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/StrictSupportExtension.lean @@ -0,0 +1,52 @@ +import Mathlib.Algebra.Homology.Embedding.StupidTrunc + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace DerivedBar +universe u v w w' +variable {C : Type u} [Category.{v} C] [HasZeroMorphisms C] [HasZeroObject C] + {ι : Type w} {ι' : Type w'} {c : ComplexShape ι} {c' : ComplexShape ι'} + (e : c.Embedding c') [e.IsRelIff] (K : HomologicalComplex C c') + [K.IsStrictlySupported e] + +/-- Actual component isomorphisms for extension after restriction of a complex +which is already zero outside the index embedding. -/ +def supportedExtensionXIso (j : ι') : ((K.restriction e).extend e).X j ≅ K.X j := by + classical + exact if h : ∃ i, e.f i=j then + (K.restriction e).extendXIso e h.choose_spec ≪≫ K.restrictionXIso e h.choose_spec + else + ((K.restriction e).isZero_extend_X e j (not_exists.mp h)).iso + (K.isZero_X_of_isStrictlySupported e j (not_exists.mp h)) + +theorem supportedExtensionXIso_image (i : ι) (j : ι') (hi : e.f i=j) : + supportedExtensionXIso e K j = + (K.restriction e).extendXIso e hi ≪≫ K.restrictionXIso e hi := by + classical + unfold supportedExtensionXIso + split_ifs with h + · have hh : h.choose=i := e.injective_f (h.choose_spec.trans hi.symm) + subst i + rfl + · exact (h ⟨i,hi⟩).elim + +/-- The genuine chain isomorphism, including all boundary differentials. -/ +def strictSupportExtensionIso : (K.restriction e).extend e ≅ K := + HomologicalComplex.Hom.isoOfComponents (supportedExtensionXIso e K) (by + intro i' j' hij + classical + by_cases hi : ∃ i, e.f i=i' + · by_cases hj : ∃ j, e.f j=j' + · obtain ⟨i,hi⟩ := hi + obtain ⟨j,hj⟩ := hj + rw [supportedExtensionXIso_image e K i i' hi, supportedExtensionXIso_image e K j j' hj, + extend_d_eq _ e hi hj, restriction_d_eq _ e hi hj] + simp only [Iso.trans_hom, Category.assoc, Iso.inv_hom_id_assoc, Iso.inv_hom_id, Category.comp_id] + · exact (K.isZero_X_of_isStrictlySupported e j' (not_exists.mp hj)).eq_of_tgt _ _ + · exact ((K.restriction e).isZero_extend_X e i' (not_exists.mp hi)).eq_of_src _ _) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/SuffixNaturality.lean b/lean/OAI/Algebra/Finitistic/Bar/SuffixNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..5bb081bbe49d0d1bba5ed697a4c891a89e622960 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/SuffixNaturality.lean @@ -0,0 +1,124 @@ +import OAI.Algebra.Finitistic.Bar.LeadingSuffixFaces +import OAI.Algebra.Finitistic.Bar.BarFunctor + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.ParityBridge +universe u +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] +local notation "A" => TrivSqZeroExt D X + +variable (M : Type u) [AddCommGroup M] [Module k M] [Module D M] + [IsScalarTower k D M] +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + +variable (W : Type u) [AddCommGroup W] [Module k W] [Module D W] [IsScalarTower k D W] + +omit [Module A N] [IsScalarTower k A N] in +/-- Inserting D slots commutes with every actual vertical map of suffix modules. -/ +theorem suffixEmbed_termMap (s n : ℕ) (e : W →ₗ[k] term k A N s) + (f : M →ₗ[D] W) (v : term k D M n) : + suffixEmbed k D X N W s e n (termMap k D M W f n v) = + suffixEmbed k D X N M s (e.comp (f.restrictScalars k)) n v := by + induction n with + | zero => rfl + | succ n ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [termMap_tmul, suffixEmbed_tmul, suffixEmbed_tmul, ih] + | add v w hv hw => simp only [map_add, hv, hw] + +omit [Module A N] [IsScalarTower k A N] in +/-- X coefficients commute with the same vertical suffix maps. -/ +theorem idealSuffixEmbed_termMap (s n : ℕ) (e : W →ₗ[k] term k A N s) + (f : M →ₗ[D] W) (v : X ⊗[k] term k D M n) : + idealSuffixEmbed k D X N W s n e + (AlgebraTensorModule.lTensor D X ((termMap k D M W f n).restrictScalars k) v) = + idealSuffixEmbed k D X N M s n (e.comp (f.restrictScalars k)) v := by + induction v using TensorProduct.inductionOn with + | tmul x v => + rw [AlgebraTensorModule.lTensor_tmul, idealSuffixEmbed_tmul, idealSuffixEmbed_tmul] + change (inr x : A) ⊗ₜ[k] suffixEmbed k D X N W s e n (termMap k D M W f n v) = _ + rw [suffixEmbed_termMap] + | add v w hv hw => simp only [map_add, hv, hw] + +omit [Module A N] [IsScalarTower k A N] in +/-- Exterior D coefficients commute with all vertical suffix maps. -/ +theorem outerSuffixEmbed_termMap (s n : ℕ) (e : W →ₗ[k] term k A N s) + (f : M →ₗ[D] W) (v : D ⊗[k] term k D M n) : + outerSuffixEmbed k D X N W s n e (termMap k D M W f (n+1) v) = + outerSuffixEmbed k D X N M s n (e.comp (f.restrictScalars k)) v := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [termMap_tmul, outerSuffixEmbed_tmul, outerSuffixEmbed_tmul, suffixEmbed_termMap] + | add v w hv hw => simp only [map_add, hv, hw] + +omit [Module D M] [IsScalarTower k D M] [Module A N] [IsScalarTower k A N] in +/-- The prefix construction is additive in the whole suffix map. -/ +theorem suffixEmbed_add_map (s n : ℕ) (e f : M →ₗ[k] term k A N s) + (v : term k D M n) : + suffixEmbed k D X N M s (e+f) n v = + suffixEmbed k D X N M s e n v + suffixEmbed k D X N M s f n v := by + induction n with + | zero => rfl + | succ n ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [suffixEmbed_tmul, suffixEmbed_tmul, suffixEmbed_tmul, ih, TensorProduct.tmul_add] + | add v w hv hw => simp only [map_add, hv, hw]; abel + +omit [Module D M] [IsScalarTower k D M] [Module A N] [IsScalarTower k A N] in +/-- Scalar totalization signs pass through the unchanged tensor prefix. -/ +theorem suffixEmbed_smul_map (s n : ℕ) (a : k) (e : M →ₗ[k] term k A N s) + (v : term k D M n) : + suffixEmbed k D X N M s (a • e) n v = a • suffixEmbed k D X N M s e n v := by + induction n with + | zero => rfl + | succ n ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [suffixEmbed_tmul, suffixEmbed_tmul, ih] + exact TensorProduct.tmul_smul _ _ _ + | add v w hv hw => simp only [map_add, hv, hw, smul_add] + +/-- A genuine linear operation on suffix maps, so finite sums distribute exactly. -/ +def suffixEmbedLinear (s n : ℕ) : + (M →ₗ[k] term k A N s) →ₗ[k] (term k D M n →ₗ[k] term k A N (s+n)) where + toFun e := suffixEmbed k D X N M s e n + map_add' e f := by + ext v + exact suffixEmbed_add_map k D X N M s n e f v + map_smul' a e := by + ext v + exact suffixEmbed_smul_map k D X N M s n a e v + +omit [Module D M] [IsScalarTower k D M] [Module A N] [IsScalarTower k A N] in +/-- The actual finite-sum distribution needed for an arbitrary recursive suffix differential. -/ +theorem suffixEmbed_sum {I : Type*} (S : Finset I) (s n : ℕ) + (e : I → M →ₗ[k] term k A N s) (v : term k D M n) : + suffixEmbed k D X N M s (∑ i ∈ S, e i) n v = + ∑ i ∈ S, suffixEmbed k D X N M s (e i) n v := by + change suffixEmbedLinear k D X N M s n (∑ i ∈ S, e i) v = _ + rw [map_sum, LinearMap.sum_apply] + rfl + +/-- Mathlib's unit-valued totalization sign is exactly the field-valued sign. -/ +theorem totalSign_smul (n : ℕ) (v : M) : + ((-1 : ℤˣ)^n) • v = (-1 : k)^n • v := by + induction n with + | zero => simp + | succ n ih => + have hu : (-1 : ℤˣ) • v = -v := by + change (-1 : ℤ) • v = -v + exact neg_one_zsmul v + simpa only [pow_succ, mul_smul, hu, neg_one_smul, smul_neg] using congrArg Neg.neg ih +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/SuffixParityFaces.lean b/lean/OAI/Algebra/Finitistic/Bar/SuffixParityFaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5f1133ff52d21e000e7bd962877d4e7ee8efa55 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/SuffixParityFaces.lean @@ -0,0 +1,180 @@ +import OAI.Algebra.Finitistic.Bar.InflatedParityFaces + +namespace OAI +open CategoryTheory TensorProduct TrivSqZeroExt +open scoped TensorProduct +noncomputable section +namespace DerivedBar.ParityBridge +universe u +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] +local notation "A" => TrivSqZeroExt D X + +/-- Explicit degree transport; it changes no tensor factor or action. -/ +def termCast {a b : ℕ} (h : a=b) : term k A N a →ₗ[k] term k A N b := by + subst b + exact LinearMap.id + +@[simp] theorem termCast_refl (a : ℕ) (v : term k A N a) : + termCast k D X N (rfl : a=a) v = v := rfl + +theorem termCast_tmul {a b : ℕ} (h : a=b) (h' : a+1=b+1) + (x : A) (v : term k A N a) : + termCast k D X N h' (x ⊗ₜ[k] v) = x ⊗ₜ[k] termCast k D X N h v := by + subst b + rfl + +variable (M : Type u) [AddCommGroup M] [Module k M] [Module D M] + [IsScalarTower k D M] + +/-- Insert any D block before an arbitrary linear suffix, preserving its tensor order. -/ +def suffixEmbed (s : ℕ) (e : M →ₗ[k] term k A N s) : + (n : ℕ) → term k D M n →ₗ[k] term k A N (s+n) + | 0 => e + | n+1 => TensorProduct.map (inlAlgHom k D X).toLinearMap (suffixEmbed s e n) + +omit [Module D M] [IsScalarTower k D M] in +@[simp] theorem suffixEmbed_tmul (s n : ℕ) (e : M →ₗ[k] term k A N s) + (d : D) (v : term k D M n) : + suffixEmbed k D X N M s e (n+1) (d ⊗ₜ[k] v) = + (inl d : A) ⊗ₜ[k] suffixEmbed k D X N M s e n v := rfl + +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + +omit [IsScalarTower k D M] [IsScalarTower k A N] in +theorem suffixEmbed_smul (s n : ℕ) (e : M →ₗ[k] term k A N s) + (he : ∀ (d : D) (v : M), e (d • v) = (inl d : A) • e v) + (d : D) (v : term k D M n) : + suffixEmbed k D X N M s e n (d • v) = + (inl d : A) • suffixEmbed k D X N M s e n v := by + cases n with + | zero => exact he d v + | succ n => + induction v using TensorProduct.inductionOn with + | tmul b v => + change (inl (d*b) : A) ⊗ₜ[k] _ = ((inl d : A)*inl b) ⊗ₜ[k] _ + rw [inl_mul_inl] + | add v w hv hw => simp only [smul_add, map_add, hv, hw] + +/-- General D-block comparison, including the differential of an arbitrary +positive-length suffix. The second term is the totalization sign, not zero. -/ +theorem parity_suffixEmbed (s n : ℕ) (e : M →ₗ[k] term k A N (s+1)) + (he : ∀ (d : D) (v : M), e (d • v) = (inl d : A) • e v) + (v : term k D M (n+1)) : + SquareZero.multibarAugmentedDifferential k D X N ((s+1)+n) + (suffixEmbed k D X N M (s+1) e (n+1) v) = + suffixEmbed k D X N M (s+1) e n (DerivedBar.differential k D M n v) + + (-1 : k)^(n+1) • termCast k D X N (show s+(n+1)=(s+1)+n by omega) + (suffixEmbed k D X N M s + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) (n+1) v) := by + induction n with + | zero => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [suffixEmbed_tmul, SquareZero.multibarAugmentedDifferential_succ, + SquareZero.slotParity_base, DerivedBar.differential_zero_tmul, + suffixEmbed_tmul] + change (inl d : A) • e v - (inl d : A) ⊗ₜ[k] _ = e (d • v) + (-1:k)^1 • _ + rw [he] + simp only [pow_one, neg_one_smul, sub_eq_add_neg] + rfl + | add v w hv hw => simp only [map_add, hv, hw, smul_add]; abel + | succ n ih => + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [suffixEmbed_tmul] + change SquareZero.slotParity k D X (inl d) • suffixEmbed k D X N M (s+1) e (n+1) v - + SquareZero.slotParity k D X (inl d) ⊗ₜ[k] + SquareZero.multibarAugmentedDifferential k D X N (s+1+n) + (suffixEmbed k D X N M (s+1) e (n+1) v) = _ + rw [SquareZero.slotParity_base, ih, DerivedBar.differential_succ_tmul, + map_sub, suffixEmbed_smul k D X N M (s+1) (n+1) e he, + suffixEmbed_tmul, suffixEmbed_tmul] + erw [termCast_tmul k D X N (show s+(n+1)=(s+1)+n by omega) + (show (s+(n+1))+1=((s+1)+n)+1 by omega) (inl d) + (suffixEmbed k D X N M s ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) (n+1) v)] + erw [TensorProduct.tmul_add, TensorProduct.tmul_smul] + have hs : (-1 : k)^(n+1+1) = -((-1 : k)^(n+1)) := by + rw [pow_succ, mul_neg_one] + rw [hs] + erw [neg_smul] + abel + | add v w hv hw => simp only [map_add, hv, hw, smul_add]; abel + + +/-- Literal X coefficient followed by any D block and any recursive suffix. -/ +def idealSuffixEmbed (s n : ℕ) (e : M →ₗ[k] term k A N s) : + X ⊗[k] term k D M n →ₗ[k] term k A N ((s+n)+1) := + TensorProduct.map ((inrHom D X).restrictScalars k) (suffixEmbed k D X N M s e n) + +omit [Module D M] [IsScalarTower k D M] [Module A N] [IsScalarTower k A N] in +@[simp] theorem idealSuffixEmbed_tmul (s n : ℕ) (e : M →ₗ[k] term k A N s) + (x : X) (v : term k D M n) : + idealSuffixEmbed k D X N M s n e (x ⊗ₜ[k] v) = + (inr x : A) ⊗ₜ[k] suffixEmbed k D X N M s e n v := rfl + +omit [Module D M] [IsScalarTower k D M] [Module A N] [IsScalarTower k A N] in +/-- The original right D action supplies the first face for every suffix. -/ +theorem ideal_action_suffixEmbed (s n : ℕ) (e : M →ₗ[k] term k A N s) + (x : X) (v : term k D M (n+1)) : + (inr x : A) • suffixEmbed k D X N M s e (n+1) v = + idealSuffixEmbed k D X N M s n e + (BimoduleTensor.collapse k D X (term k D M n) (x ⊗ₜ[k] v)) := by + induction v using TensorProduct.inductionOn with + | tmul d v => + rw [suffixEmbed_tmul, BimoduleTensor.collapse_tmul, idealSuffixEmbed_tmul] + change ((inr x : A) * inl d) ⊗ₜ[k] _ = (inr (MulOpposite.op d • x) : A) ⊗ₜ[k] _ + rw [inr_mul_inl] + | add v w hv hw => simp only [map_add, smul_add, TensorProduct.tmul_add, hv, hw] + +/-- General two-sided X-bar comparison. Both horizontal and signed suffix +faces are retained; the right D action is the bimodule's original action. -/ +theorem parity_idealSuffixEmbed (s n : ℕ) (e : M →ₗ[k] term k A N (s+1)) + (he : ∀ (d : D) (v : M), e (d • v) = (inl d : A) • e v) + (v : X ⊗[k] term k D M (n+1)) : + SquareZero.multibarAugmentedDifferential k D X N (((s+1)+n)+1) + (idealSuffixEmbed k D X N M (s+1) (n+1) e v) = + -idealSuffixEmbed k D X N M (s+1) n e (BimoduleTensor.barDifferential k D X M n v) + + (-1 : k)^(n+1) • termCast k D X N (show (s+(n+1))+1=((s+1)+n)+1 by omega) + (idealSuffixEmbed k D X N M s (n+1) + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v) := by + induction v using TensorProduct.inductionOn with + | tmul x v => + rw [idealSuffixEmbed_tmul, SquareZero.multibarAugmentedDifferential_succ, + SquareZero.slotParity_ideal, parity_suffixEmbed k D X N M s n e he, + BimoduleTensor.barDifferential_tmul, map_sub, idealSuffixEmbed_tmul, + idealSuffixEmbed_tmul, termCast_tmul k D X N (show s+(n+1)=(s+1)+n by omega)] + have hn : (-inr x : A) • suffixEmbed k D X N M (s+1) e (n+1) v = + -((inr x : A) • suffixEmbed k D X N M (s+1) e (n+1) v) := + _root_.neg_smul (inr x : A) (suffixEmbed k D X N M (s+1) e (n+1) v) + rw [hn, ideal_action_suffixEmbed] + erw [TensorProduct.neg_tmul, TensorProduct.tmul_add, TensorProduct.tmul_smul] + abel + | add v w hv hw => simp only [map_add, hv, hw, neg_add, smul_add]; abel + +omit [Module D M] [IsScalarTower k D M] in +/-- At an empty D block the ideal endpoint vanishes, leaving all suffix faces. -/ +theorem parity_idealSuffixEmbed_zero (s : ℕ) (e : M →ₗ[k] term k A N (s+1)) + (he : ∀ (x : X) (v : M), (inr x : A) • e v = 0) + (v : X ⊗[k] M) : + SquareZero.multibarAugmentedDifferential k D X N (s+1) + (idealSuffixEmbed k D X N M (s+1) 0 e v) = + idealSuffixEmbed k D X N M s 0 + ((SquareZero.multibarAugmentedDifferential k D X N s).comp e) v := by + induction v using TensorProduct.inductionOn with + | tmul x v => + rw [idealSuffixEmbed_tmul, SquareZero.multibarAugmentedDifferential_succ, + SquareZero.slotParity_ideal] + change (-inr x : A) • e v - (-inr x : A) ⊗ₜ[k] _ = (inr x : A) ⊗ₜ[k] _ + have hn : (-inr x : A) • e v = -((inr x : A) • e v) := + _root_.neg_smul (inr x : A) (e v) + rw [hn, he, neg_zero, TensorProduct.neg_tmul, zero_sub, neg_neg] + rfl + | add v w hv hw => simp only [map_add, hv, hw] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/SupportedInnerCoordinates.lean b/lean/OAI/Algebra/Finitistic/Bar/SupportedInnerCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..dae7bc0d4b2641b227b4b317cff8edf2a1ad45f7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/SupportedInnerCoordinates.lean @@ -0,0 +1,175 @@ +import OAI.Algebra.Finitistic.Bar.RecursiveSuffixInduction +import OAI.Algebra.Finitistic.Bar.BarPatternEmbedding + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance supportedInnerCoordinatesScalarModule (V : ModuleCat.{u} D) : Module k V := + BimoduleTensor.scalarModule k D V +local instance supportedInnerCoordinatesScalarTower (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance supportedInnerCoordinatesIndexDecidableEq (r n : ℕ) : + DecidableEq (Index r n) := Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance supportedInnerCoordinatesInflatedModule : Module A N := inflatedModule D X N +local instance supportedInnerCoordinatesInflatedTower : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +/-- Re-express a supplied k-linear map using the canonical scalars of ModuleCat D. -/ +def canonicalLinear (V : Type u) [AddCommGroup V] [Module k V] [Module D V] + [IsScalarTower k D V] (s : ℕ) (e : V →ₗ[k] term k A N s) : + letI : Module k V := BimoduleTensor.scalarModule k D (ModuleCat.of D V) + V →ₗ[k] term k A N s := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + exact e + +@[simp] theorem canonicalLinear_apply (V : Type u) [AddCommGroup V] [Module k V] + [Module D V] [IsScalarTower k D V] (s : ℕ) (e : V →ₗ[k] term k A N s) (v : V) : + canonicalLinear k D X N V s e v = e v := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + rfl + +/-- Prefixing a canonically re-expressed map recovers the supplied-scalars literal formula. -/ +theorem barSuffix_canonicalLinear (V : Type u) [AddCommGroup V] [Module k V] + [Module D V] [IsScalarTower k D V] (s i : ℕ) (e : V →ₗ[k] term k A N s) + (v : ((XB).obj (ModuleCat.of D V)).X i) : + barSuffix k D X N (ModuleCat.of D V) s i (canonicalLinear k D X N V s e) v = + idealSuffixEmbed k D X N V s i e ((twoSidedBarObjIso k D X V i).hom.hom v) := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + rfl + +/-- The same literal inner coordinates, with the proved degree-zero input made explicit. -/ +def supportedInnerIso : (r n : ℕ) → (t : Index r n) → (h : inputDegree r t=0) → + summand B Z r n t ≅ ModuleCat.of D (patternTerm k D X N (innerPattern r t)) + | 0, n, t, h => by + change n=0 at h + subst n + exact Iso.refl _ + | r+1, _, ⟨p,t⟩, h => + (XB ⋙ HomologicalComplex.eval _ c p.val.1).mapIso (supportedInnerIso r p.val.2 t h) ≪≫ + twoSidedBarPatternIso k D X N p.val.1 (innerPattern r t) + +/-- Transport of the terminal input along an equality of D-modules commutes +with the genuine categorical bar pattern coordinates. -/ +theorem twoSidedBarPatternIso_eqToIso (V W : ModuleCat.{u} D) (h : V=W) + (i : ℕ) (p : List Bool) : + (XB ⋙ HomologicalComplex.eval _ c i).mapIso + (eqToIso (congrArg (fun V : ModuleCat D => ModuleCat.of D (patternTerm k D X V p)) h)) ≪≫ + twoSidedBarPatternIso k D X W i p = + twoSidedBarPatternIso k D X V i p ≪≫ + eqToIso (congrArg (fun V : ModuleCat D => + ModuleCat.of D (patternTerm k D X V (true :: (List.replicate i false ++ p)))) h) := by + subst W + simp + +/-- The supported recursion equals the already existing innerSummandIso, +followed only by the forced zero-degree input transport. -/ +theorem supportedInnerIso_eq (r n : ℕ) (t : Index r n) (h : inputDegree r t=0) : + supportedInnerIso k D X N r n t h = + innerSummandIso k D X Z r n t ≪≫ eqToIso + (congrArg (fun V : ModuleCat D => ModuleCat.of D (patternTerm k D X V (innerPattern r t))) + (show (Z).X (inputDegree r t)=N by rw [h]; rfl)) := by + induction r generalizing n with + | zero => + change n=0 at h + subst n + rfl + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + let F := XB ⋙ HomologicalComplex.eval _ c i + let p := innerPattern r t + let V := (Z).X (inputDegree r t) + have hv : V=N := by change (Z).X (inputDegree r t)=N; rw [show inputDegree r t=0 from h]; rfl + change F.mapIso (supportedInnerIso k D X N r q t h) ≪≫ + twoSidedBarPatternIso k D X N i p = + (F.mapIso (innerSummandIso k D X Z r q t) ≪≫ twoSidedBarPatternIso k D X V i p) ≪≫ + eqToIso (congrArg (fun W : ModuleCat D => + ModuleCat.of D (patternTerm k D X W (true :: (List.replicate i false ++ p)))) hv) + rw [ih q t h, Functor.mapIso_trans, Iso.trans_assoc, Iso.trans_assoc] + congr 1 + exact twoSidedBarPatternIso_eqToIso k D X V N hv i p + +/-- Every surviving summand has exactly r+n literal internal slots. -/ +theorem supportedInner_length (r n : ℕ) (t : Index r n) (h : inputDegree r t=0) : + (innerPattern r t).length = r+n := by + have ht := length_innerPattern r n t + omega + +def canonicalRestrict (V W : ModuleCat.{u} D) (f : V ⟶ W) : V →ₗ[k] W := + f.hom.restrictScalars k + +@[simp] theorem canonicalRestrict_apply (V W : ModuleCat.{u} D) (f : V ⟶ W) (v : V) : + canonicalRestrict k D V W f v = f.hom v := rfl + +/-- The canonical recursive embedding agrees with the original literal word +embedding on every supported summand, through the actual bar coordinate maps. -/ +theorem innerEmbedding_supported (r n : ℕ) (t : Index r n) (h : inputDegree r t=0) + (v : summand B Z r n t) : + innerEmbedding k D X N r n ((lof B Z r n t).hom v) = + termCast k D X N (supportedInner_length r n t h) + (embed k D X N (innerPattern r t) ((supportedInnerIso k D X N r n t h).hom.hom v)) := by + induction r generalizing n with + | zero => + change n=0 at h + subst n + have he := congrArg (fun f => f v) (innerEmbedding_zero_lof k D X N t) + exact he + | succ r ih => + rcases t with ⟨⟨⟨i,q⟩,hq⟩,t⟩ + let p := innerPattern r t + let V := summand B Z r q t + let W := ModuleCat.of D (patternTerm k D X N p) + let f : V ⟶ W := (supportedInnerIso k D X N r q t h).hom + let e := canonicalLinear k D X N (patternTerm k D X N p) p.length (embed k D X N p) + have hp : p.length=r+q := supportedInner_length r q t h + have he : (innerEmbedding k D X N r q).comp ((lof B Z r q t).hom.restrictScalars k) = + (termCast k D X N hp).comp (e.comp (canonicalRestrict k D V W f)) := by + ext w + change innerEmbedding k D X N r q ((lof B Z r q t).hom w) = + termCast k D X N hp + (canonicalLinear k D X N (patternTerm k D X N p) p.length (embed k D X N p) + ((supportedInnerIso k D X N r q t h).hom.hom w)) + rw [canonicalLinear_apply] + exact ih q t h w + erw [innerEmbedding_lof_succ k D X N r n i q hq t v, he] + erw [barSuffix_termCast k D X N V hp i (e.comp (canonicalRestrict k D V W f)) v] + erw [← barSuffix_map k D X N V W p.length i e f v] + change termCast k D X N (show ((r+q)+i)+1=(r+1)+n by omega) + (termCast k D X N (show (p.length+i)+1=((r+q)+i)+1 by omega) + (barSuffix k D X N W p.length i e ((((XB).map f).f i).hom v))) = _ + erw [barSuffix_canonicalLinear k D X N (patternTerm k D X N p) p.length i + (embed k D X N p)] + change _ = termCast k D X N + (show (true :: (List.replicate i false ++ p)).length=(r+1)+n by + simp only [List.length_cons, List.length_append, List.length_replicate]; omega) + (embed k D X N (true :: (List.replicate i false ++ p)) + ((twoSidedBarPatternIso k D X N i p).hom.hom ((((XB).map f).f i).hom v))) + erw [embed_twoSidedBarPatternIso k D X N i p] + erw [termCast_trans k D X N + (show (p.length+i)+1=((r+q)+i)+1 by omega) + (show ((r+q)+i)+1=(r+1)+n by omega)] + erw [termCast_trans k D X N + (show (p.length+i)+1=(true :: (List.replicate i false ++ p)).length by simp; omega) + (show (true :: (List.replicate i false ++ p)).length=(r+1)+n by + simp only [List.length_cons, List.length_append, List.length_replicate]; omega)] +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/SupportedOuterCoordinates.lean b/lean/OAI/Algebra/Finitistic/Bar/SupportedOuterCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..512267c5f75e071e5f820d38769505a9b9a9e85c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/SupportedOuterCoordinates.lean @@ -0,0 +1,91 @@ +import OAI.Algebra.Finitistic.Bar.SupportedInnerCoordinates +import OAI.Algebra.Finitistic.Bar.LeadingTotalComparison + +namespace OAI +open CategoryTheory CategoryTheory.Limits TensorProduct TrivSqZeroExt +open scoped TensorProduct DirectSum +noncomputable section +namespace DerivedBar.ParityBridge +open DerivedBar.Multibar DerivedBar.RecursiveTotal +universe u +variable (k D X : 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] +local instance supportedOuterScalarModule (V : ModuleCat.{u} D) : Module k V := + BimoduleTensor.scalarModule k D V +local instance supportedOuterScalarTower (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local instance supportedOuterIndexDecidableEq (r n : ℕ) : DecidableEq (Index r n) := + Classical.decEq _ +variable (N : ModuleCat.{u} D) +local notation "A" => TrivSqZeroExt D X +local notation "XB" => BimoduleTensor.twoSidedBarFunctor k D X +local notation "Z" => Functor.obj (ChainComplex.single₀ (ModuleCat D)) N +local notation "B" => (fun _ : ℕ => XB) +local notation "c" => ComplexShape.down ℕ +local instance supportedOuterInflatedModule : Module A N := inflatedModule D X N +local instance supportedOuterInflatedScalarTower : IsScalarTower k A N := IsScalarTower.of_algebraMap_smul + (fun a v => IsScalarTower.algebraMap_smul D a v) + +/-- The projected exterior coefficient remains D while the internal word uses +exactly the old literal pattern embedding. -/ +theorem outerEmbed_freeBarPatternIso (i : ℕ) (p : List Bool) + (v : ((barFunctor k D).obj (ModuleCat.of D (patternTerm k D X N p))).X i) : + AlgebraTensorModule.lTensor D D (embed k D X N (List.replicate i false ++ p)) + ((freeBarPatternIso k D X N i p).hom.hom v) = + outerCast k D X N + (show p.length+i=(List.replicate i false ++ p).length by simp; omega) + (outerSuffixEmbed k D X N (patternTerm k D X N p) p.length i (embed k D X N p) + ((freeBarObjIso k D (patternTerm k D X N p) i).hom.hom v)) := by + suffices h : ∀ w : D ⊗[k] term k D (patternTerm k D X N p) i, + AlgebraTensorModule.lTensor D D (embed k D X N (List.replicate i false ++ p)) + ((termPatternIso k D X N (i+1) p).hom.hom w) = + outerCast k D X N + (show p.length+i=(List.replicate i false ++ p).length by simp; omega) + (outerSuffixEmbed k D X N (patternTerm k D X N p) p.length i (embed k D X N p) w) from + h ((freeBarObjIso k D (patternTerm k D X N p) i).hom.hom v) + intro w + induction w using TensorProduct.inductionOn with + | tmul d w => + change d ⊗ₜ[k] embed k D X N (List.replicate i false ++ p) + ((termPatternIso k D X N i p).hom.hom w) = + d ⊗ₜ[k] termCast k D X N _ + (suffixEmbed k D X N (patternTerm k D X N p) p.length (embed k D X N p) i w) + rw [embed_termPatternIso] + | add v w hv hw => simp only [map_add, hv, hw] + +theorem outerBarSuffix_canonicalLinear (V : Type u) [AddCommGroup V] [Module k V] + [Module D V] [IsScalarTower k D V] (s i : ℕ) (e : V →ₗ[k] term k A N s) + (v : ((barFunctor k D).obj (ModuleCat.of D V)).X i) : + outerBarSuffix k D X N (ModuleCat.of D V) s i (canonicalLinear k D X N V s e) v = + outerSuffixEmbed k D X N V s i e ((freeBarObjIso k D V i).hom.hom v) := by + have h := BimoduleTensor.scalarModule_eq k D V + cases h + rfl + +theorem outerBarSuffix_termCast (V : ModuleCat.{u} D) {a b : ℕ} (h : a=b) + (i : ℕ) (e : V →ₗ[k] term k A N a) + (v : ((barFunctor k D).obj V).X i) : + outerBarSuffix k D X N V b i ((termCast k D X N h).comp e) v = + outerCast k D X N (congrArg (fun n => n+i) h) + (outerBarSuffix k D X N V a i e v) := by + subst b + rw [show termCast k D X N (rfl : a=a) = LinearMap.id from rfl, LinearMap.id_comp, + outerCast_refl, LinearMap.id_apply] + +omit [Module Dᵐᵒᵖ X] [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] in +theorem freeBarPatternIso_eqToIso (V W : ModuleCat.{u} D) (h : V=W) + (i : ℕ) (p : List Bool) : + (barFunctor k D ⋙ HomologicalComplex.eval _ c i).mapIso + (eqToIso (congrArg (fun V : ModuleCat D => ModuleCat.of D (patternTerm k D X V p)) h)) ≪≫ + freeBarPatternIso k D X W i p = + freeBarPatternIso k D X V i p ≪≫ + eqToIso (congrArg (fun V : ModuleCat D => + ModuleCat.of D (patternTerm k D X V (List.replicate (i+1) false ++ p))) h) := by + subst W + simp +end DerivedBar.ParityBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TensorModel.lean b/lean/OAI/Algebra/Finitistic/Bar/TensorModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..e22c00b04dee581362ed3e4489e9795a93480d96 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TensorModel.lean @@ -0,0 +1,75 @@ +import OAI.Algebra.Finitistic.Bar.Balanced +import OAI.Algebra.Finitistic.Bar.ChainSplitting + +namespace OAI +open scoped TensorProduct DirectSum +open TensorProduct CategoryTheory TrivSqZeroExt +noncomputable section + +namespace DerivedBar +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) + +/-- The balanced free-tensor equivalence respects arbitrary A-linear maps, including bar faces. -/ +theorem freeEquiv_natural (V W : Type u) [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] (h : A ⊗[k] V →ₗ[A] A ⊗[k] W) : + (Balanced.descend f W).comp (Balanced.map f (A ⊗[k] V) (A ⊗[k] W) h) = + (FreeBaseChange.map f V W h).comp (Balanced.descend f V) := by + apply (Balanced.relations f (A ⊗[k] V)).linearMap_qext + apply AlgebraTensorModule.ext + intro d z + change d • FreeBaseChange.coefficient f W (h z) = + FreeBaseChange.map f V W h (d • FreeBaseChange.coefficient f V z) + rw [LinearMap.map_smul, FreeBaseChange.map_coefficient] + +variable (k A D N : Type u) [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] + [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable (f : A →ₐ[k] D) + +/-- The actual balanced tensor of D with every term and differential of the verified bar resolution. -/ +def tensorBarComplex : ChainComplex (ModuleCat D) ℕ := + ChainComplex.of (fun n => ModuleCat.of D (Balanced.tensor f (term k A N (n+1)))) + (fun n => ModuleCat.ofHom (Balanced.map f _ _ (differential k A N (n+1)))) + (fun n => by + apply ModuleCat.hom_ext + change (Balanced.map f _ _ (differential k A N (n+1))).comp + (Balanced.map f _ _ (differential k A N (n+1+1))) = 0 + rw [← Balanced.map_comp, differential_sq, Balanced.map_zero]) + +/-- The explicit two-sided bar is isomorphic to balanced tensor applied to a genuine projective resolution. -/ +def tensorBarIso : tensorBarComplex k A D N f ≅ twoSidedComplex k A D N f := + HomologicalComplex.Hom.isoOfComponents + (fun n => (Balanced.freeEquiv f (term k A N n)).toModuleIso) + (by + intro i j hij + change j+1 = i at hij + subst i + apply ModuleCat.hom_ext + simp only [tensorBarComplex, twoSidedComplex, ChainComplex.of_d, + ModuleCat.hom_comp, ModuleCat.hom_ofHom] + exact (freeEquiv_natural f (term k A N (j+1)) (term k A N j) + (differential k A N (j+1))).symm) + +namespace SquareZero +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] + [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + +/-- The tensor of the actual free resolution splits by X-count as a D-module chain complex. +The identification of count r with the shifted r-fold derived tensor remains separate. -/ +def tensorCountSplitting + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = 0) : + tensorBarComplex k (TrivSqZeroExt D X) D N (fstHom k D X) ≅ + directSumComplex (twoSidedWeightComplex k D X N hN) := + tensorBarIso k (TrivSqZeroExt D X) D N (fstHom k D X) ≪≫ + (countSplitting k D X N hN).symm + +end SquareZero +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalAdditive.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalAdditive.lean new file mode 100644 index 0000000000000000000000000000000000000000..67b62b1a17588d4d028bebdc29416a8aef3ac49a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalAdditive.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.Finitistic.Bar.BarFunctor + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section + +namespace DerivedBar +universe u +abbrev moduleForgetAdd (A : Type u) [Ring A] : ModuleCat.{u} A ⥤ AddCommGrpCat.{u} := + forget₂ (ModuleCat.{u} A) AddCommGrpCat +variable {A : Type u} [Ring A] +variable (K : HomologicalComplex₂ (ModuleCat.{u} A) (ComplexShape.down ℕ) (ComplexShape.down ℕ)) +local notation "c" => ComplexShape.down ℕ + +local notation "F" => moduleForgetAdd A + +/-- Additive maps out of a module totalization, using its preserved coproduct. +This permits unit insertion, which need not be A-linear. -/ +def totalAddDesc {n : ℕ} {Y : AddCommGrpCat.{u}} + (f : ∀ i q (_ : i+q=n), (F).obj ((K.X i).X q) ⟶ Y) : + (F).obj ((K.total c).X n) ⟶ Y := + (isColimitOfPreserves F (K.toGradedObject.isColimitCofanMapObj + (ComplexShape.π c c c) n)).desc + { pt := Y + ι := Discrete.natTrans (fun j => f j.as.val.1 j.as.val.2 j.as.property) } + +@[reassoc (attr := simp)] +theorem ι_totalAddDesc {n : ℕ} {Y : AddCommGrpCat.{u}} + (f : ∀ i q (_ : i+q=n), (F).obj ((K.X i).X q) ⟶ Y) + (i q : ℕ) (h : i+q=n) : + (F).map (K.ιTotal c i q n h) ≫ totalAddDesc K f = f i q h := by + exact (isColimitOfPreserves F (K.toGradedObject.isColimitCofanMapObj + (ComplexShape.π c c c) n)).fac _ ⟨⟨⟨i,q⟩,h⟩⟩ + +theorem totalAdd_hom_ext {n : ℕ} {Y : AddCommGrpCat.{u}} + {f g : (F).obj ((K.total c).X n) ⟶ Y} + (h : ∀ i q (hi : i+q=n), + (F).map (K.ιTotal c i q n hi) ≫ f = (F).map (K.ιTotal c i q n hi) ≫ g) : f=g := by + apply IsColimit.hom_ext + (isColimitOfPreserves F (K.toGradedObject.isColimitCofanMapObj + (ComplexShape.π c c c) n)) + rintro ⟨⟨⟨i,q⟩,hi⟩⟩ + exact h i q hi +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalBar.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalBar.lean new file mode 100644 index 0000000000000000000000000000000000000000..3086900d3e6460025846aceb3bd71063e2ef4624 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalBar.lean @@ -0,0 +1,134 @@ +import OAI.Algebra.Finitistic.Bar.BarFunctor +import Mathlib.Algebra.Homology.Homotopy + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive +noncomputable section +namespace DerivedBar +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +local instance (N : ModuleCat.{u} A) : Module k N := Module.compHom N (algebraMap k A) +local instance (N : ModuleCat.{u} A) : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +/-- Total terms are projective for every nonnegative input, without projectivity +or flatness assumptions on the input terms. -/ +instance barTotal_projective (Z : ChainComplex (ModuleCat.{u} A) ℕ) (n : ℕ) : + Projective ((barTotal k A Z).X n) where + factors f e he := by + dsimp only [barTotal] at f ⊢ + refine ⟨(barBicomplex k A Z).totalDesc + (fun i q h => Projective.factorThru + ((barBicomplex k A Z).ιTotal _ i q n h ≫ f) e), ?_⟩ + apply HomologicalComplex₂.total.hom_ext + intro i q h + simp + +variable (Z : ChainComplex (ModuleCat.{u} A) ℕ) +local notation "B" => barBicomplex k A Z +local notation "T" => barTotal k A Z +local notation "c" => ComplexShape.down ℕ + +/-- The augmentation is the action in bar length zero and zero elsewhere. -/ +def barTotalAugmentationF (n : ℕ) : (T).X n ⟶ Z.X n := + (B).totalDesc (fun i q h => match i with + | 0 => ModuleCat.ofHom (differential k A (Z.X q) 0) ≫ + (Z.XIsoOfEq (by simpa using h)).hom + | _+1 => 0) + +@[reassoc (attr := simp)] +theorem ι_barTotalAugmentationF_zero (q n : ℕ) (h : 0 + q = n) : + (B).ιTotal c 0 q n h ≫ barTotalAugmentationF k A Z n = + ModuleCat.ofHom (differential k A (Z.X q) 0) ≫ + (Z.XIsoOfEq (by omega : q = n)).hom := by + apply HomologicalComplex₂.ι_totalDesc + +@[reassoc (attr := simp)] +theorem ι_barTotalAugmentationF_succ (i q n : ℕ) (h : i+1+q=n) : + (B).ιTotal c (i+1) q n h ≫ barTotalAugmentationF k A Z n = 0 := by + apply HomologicalComplex₂.ι_totalDesc + +/-- Horizontal face formula in positive bar length. -/ +theorem barTotal_d₁_succ (i q n : ℕ) (h : i+q=n) : + (B).d₁ c (i+1) q n = + ModuleCat.ofHom (differential k A (Z.X q) (i+1)) ≫ (B).ιTotal c i q n h := by + rw [HomologicalComplex₂.d₁_eq _ _ (by rfl : (c).Rel (i+1) i) q n h] + change (1 : ℤˣ) • ((complex k A (Z.X q)).d (i+1) i ≫ _) = _ + erw [one_smul] + simp only [complex, ChainComplex.of_d] + +/-- The horizontal differential is absent in bar length zero. -/ +@[simp] theorem barTotal_d₁_zero (q n : ℕ) : (B).d₁ c 0 q n = 0 := by + apply HomologicalComplex₂.d₁_eq_zero + simp + +/-- The vertical differential is absent in input degree zero. -/ +@[simp] theorem barTotal_d₂_zero (i n : ℕ) : (B).d₂ c i 0 n = 0 := by + apply HomologicalComplex₂.d₂_eq_zero + simp + +/-- Vertical face formula, with the standard totalization sign. -/ +theorem barTotal_d₂_succ (i q n : ℕ) (h : i+q=n) : + (B).d₂ c i (q+1) n = + ((-1 : ℤˣ)^i) • (ModuleCat.ofHom + (termMap k A (Z.X (q+1)) (Z.X q) (Z.d (q+1) q).hom (i+1)) ≫ + (B).ιTotal c i q n h) := by + rw [HomologicalComplex₂.d₂_eq _ _ i (by rfl : (c).Rel (q+1) q) n h] + rfl + +/-- The total augmentation is a chain map. -/ +theorem barTotalAugmentation_comm (n : ℕ) : + (T).d (n+1) n ≫ barTotalAugmentationF k A Z n = + barTotalAugmentationF k A Z (n+1) ≫ Z.d (n+1) n := by + apply HomologicalComplex₂.total.hom_ext + intro i q h + change i+q=n+1 at h + simp only [barTotal, HomologicalComplex₂.total_d] + erw [add_comp, comp_add, HomologicalComplex₂.ι_D₁_assoc, + HomologicalComplex₂.ι_D₂_assoc] + cases i with + | zero => + have hq : q=n+1 := by omega + subst q + erw [barTotal_d₁_zero, zero_comp, zero_add, + barTotal_d₂_succ k A Z 0 n n (by omega)] + erw [pow_zero, one_smul, Category.assoc, ι_barTotalAugmentationF_zero, + ι_barTotalAugmentationF_zero_assoc] + simp only [HomologicalComplex.XIsoOfEq, eqToIso_refl, Iso.refl_hom, Category.comp_id] + apply ModuleCat.hom_ext + exact differential_natural k A (Z.X (n+1)) (Z.X n) (Z.d (n+1) n).hom 0 + | succ i => + erw [barTotal_d₁_succ k A Z i q n (by omega)] + erw [Category.assoc] + erw [ι_barTotalAugmentationF_succ_assoc k A Z i q (n+1) h] + erw [zero_comp] + have hhor : ModuleCat.ofHom (differential k A (Z.X q) (i+1)) ≫ + (B).ιTotal c i q n (show i+q=n by omega) ≫ barTotalAugmentationF k A Z n = 0 := by + cases i with + | zero => + have hn : q=n := by omega + subst n + erw [ι_barTotalAugmentationF_zero] + simp only [HomologicalComplex.XIsoOfEq, eqToIso_refl, + Iso.refl_hom, Category.comp_id] + exact ModuleCat.hom_ext (differential_sq k A (Z.X q) 0) + | succ i => erw [ι_barTotalAugmentationF_succ, comp_zero] + erw [hhor, zero_add] + cases q with + | zero => erw [barTotal_d₂_zero, zero_comp] + | succ q => + erw [barTotal_d₂_succ k A Z (i+1) q n (by omega)] + erw [CategoryTheory.Linear.units_smul_comp, Category.assoc, + ι_barTotalAugmentationF_succ, comp_zero, smul_zero] + +def barTotalAugmentation : T ⟶ Z where + f := barTotalAugmentationF k A Z + comm' i j h := by + change j+1=i at h + subst i + exact (barTotalAugmentation_comm k A Z j).symm +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalBarComparison.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalBarComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..e69a68fa35d15155ae65d84282ae80ea14c8097c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalBarComparison.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Bar.TotalMap +import OAI.Algebra.Finitistic.Bar.TwoSidedBarFunctor +import OAI.Algebra.Finitistic.Bar.TotalBarTensor + +namespace OAI +open CategoryTheory CategoryTheory.Preadditive +open scoped TensorProduct +noncomputable section +namespace DerivedBar.BimoduleTensor +universe u +variable (k D X : 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] +local instance (N : ModuleCat.{u} D) : Module k N := scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local notation "c" => ComplexShape.down ℕ + +/-- The termwise balanced/free comparison is an isomorphism of bicomplexes. -/ +def tensorBarBicomplexIso (Z : ChainComplex (ModuleCat.{u} D) ℕ) : + mapBicomplex (tensorFunctor k D X) (barBicomplex k D Z) ≅ + twoSidedBarBicomplex k D X Z := + (HomologicalComplex₂.flipFunctor _ c c).mapIso + ((NatIso.mapHomologicalComplex (freeBarTensorNatIso k D X) c).app Z) + +/-- The explicit two-sided total bar on a nonnegative chain complex. -/ +def explicitBarTotal (Z : ChainComplex (ModuleCat.{u} D) ℕ) : + ChainComplex (ModuleCat.{u} D) ℕ := + (twoSidedBarBicomplex k D X Z).total c + +/-- Resolving the whole input and applying balanced tensor gives precisely the +explicit two-sided bar total. Finite diagonal sums suffice; X need not be flat. -/ +def tensorTotalExplicitIso (Z : ChainComplex (ModuleCat.{u} D) ℕ) : + (tensorTotalFunctor k D X).obj Z ≅ explicitBarTotal k D X Z := + totalMapIso (tensorFunctor k D X) (barBicomplex k D Z) ≪≫ + HomologicalComplex₂.total.mapIso (tensorBarBicomplexIso k D X Z) c + +/-- Actual horizontal endpoint-minus-tail face in the explicit bicomplex. -/ +theorem explicitBar_horizontal (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (i q : ℕ) (x : X) (z : term k D (Z.X q) (i+1)) : + (((twoSidedBarBicomplex k D X Z).d (i+1) i).f q).hom (x ⊗ₜ[k] z) = + collapse k D X (term k D (Z.X q) i) (x ⊗ₜ[k] z) - + x ⊗ₜ[k] differential k D (Z.X q) i z := by + rw [twoSidedBarBicomplex_d₁] + exact barDifferential_tmul k D X (Z.X q) i x z + +/-- Actual vertical differential applies the input differential to the last factor. -/ +theorem explicitBar_vertical (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (i q q' : ℕ) : + ((twoSidedBarBicomplex k D X Z).X i).d q q' = + ModuleCat.ofHom (barTermMap k D X (Z.d q q') i) := rfl + +/-- Horizontal differential in the explicit total. -/ +theorem explicitBarTotal_d₁_succ (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (i q n : ℕ) (h : i+q=n) : + (twoSidedBarBicomplex k D X Z).d₁ c (i+1) q n = + ModuleCat.ofHom (barDifferential k D X (Z.X q) i) ≫ + (twoSidedBarBicomplex k D X Z).ιTotal c i q n h := by + rw [HomologicalComplex₂.d₁_eq _ _ (by rfl : (c).Rel (i+1) i) q n h] + change (1 : ℤˣ) • (_ ≫ _) = _ + rw [one_smul, twoSidedBarBicomplex_d₁] + rfl + +/-- Standard vertical totalization sign, independent of the count differential. -/ +theorem explicitBarTotal_d₂_succ (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (i q n : ℕ) (h : i+q=n) : + (twoSidedBarBicomplex k D X Z).d₂ c i (q+1) n = + ((-1 : ℤˣ)^i) • (ModuleCat.ofHom (barTermMap k D X (Z.d (q+1) q) i) ≫ + (twoSidedBarBicomplex k D X Z).ιTotal c i q n h) := by + rw [HomologicalComplex₂.d₂_eq _ _ i (by rfl : (c).Rel (q+1) q) n h] + rfl + +@[simp] theorem explicitBarTotal_d₁_zero (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (q n : ℕ) : (twoSidedBarBicomplex k D X Z).d₁ c 0 q n = 0 := by + apply HomologicalComplex₂.d₁_eq_zero + simp + +@[simp] theorem explicitBarTotal_d₂_zero (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (i n : ℕ) : (twoSidedBarBicomplex k D X Z).d₂ c i 0 n = 0 := by + apply HomologicalComplex₂.d₂_eq_zero + simp +end DerivedBar.BimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalBarContraction.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalBarContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..965b97655ec52b56bd2470b09a512d7f0fd0edec --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalBarContraction.lean @@ -0,0 +1,232 @@ +import OAI.Algebra.Finitistic.Bar.TotalBar +import OAI.Algebra.Finitistic.Bar.TotalAdditive + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive +noncomputable section +namespace DerivedBar +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +local instance (N : ModuleCat.{u} A) : Module k N := Module.compHom N (algebraMap k A) +local instance (N : ModuleCat.{u} A) : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable (Z : ChainComplex (ModuleCat.{u} A) ℕ) +local notation "B" => barBicomplex k A Z +local notation "T" => barTotal k A Z +local notation "c" => ComplexShape.down ℕ +local notation "F" => moduleForgetAdd A + +/-- Horizontal contribution with the declared total object as codomain. -/ +def barTotalDH (i q n : ℕ) : (F).obj (((B).X i).X q) ⟶ (F).obj ((T).X n) := + (F).map ((B).d₁ c i q n) + +/-- Vertical contribution with the declared total object as codomain. -/ +def barTotalDV (i q n : ℕ) : (F).obj (((B).X i).X q) ⟶ (F).obj ((T).X n) := + (F).map ((B).d₂ c i q n) + +/-- Unit insertion on an individual bar term, viewed as an additive map. -/ +def barUnit (i q : ℕ) : + AddCommGrpCat.of (term k A (Z.X q) i) ⟶ AddCommGrpCat.of (term k A (Z.X q) (i+1)) := + AddCommGrpCat.ofHom (contraction k A (Z.X q) i).toAddMonoidHom + +/-- Unit insertion with the exact bicomplex source and target objects. -/ +def barRaise (i q : ℕ) : + (F).obj (((B).X i).X q) ⟶ (F).obj (((B).X (i+1)).X q) := + barUnit k A Z (i+1) q + +/-- Natural unit insertion in the total bar, increasing bar length by one. -/ +def barTotalH (n : ℕ) : (F).obj ((T).X n) ⟶ (F).obj ((T).X (n+1)) := + totalAddDesc B (fun i q h => barRaise k A Z i q ≫ + (F).map ((B).ιTotal c (i+1) q (n+1) (show i+1+q=n+1 by omega))) + +@[reassoc (attr := simp)] +theorem ι_barTotalH (i q n : ℕ) (h : i+q=n) : + (F).map ((B).ιTotal c i q n h) ≫ barTotalH k A Z n = + barRaise k A Z i q ≫ + (F).map ((B).ιTotal c (i+1) q (n+1) (show i+1+q=n+1 by omega)) := by + exact ι_totalAddDesc _ _ _ _ _ + +/-- Unit insertion in bar length zero gives the additive section. -/ +def barTotalSectionF (n : ℕ) : (F).obj (Z.X n) ⟶ (F).obj ((T).X n) := + barUnit k A Z 0 n ≫ (F).map ((B).ιTotal c 0 n n (Nat.zero_add n)) + +@[reassoc (attr := simp)] +theorem barTotalSectionF_augmentation (n : ℕ) : + barTotalSectionF k A Z n ≫ (F).map ((barTotalAugmentation k A Z).f n) = 𝟙 _ := by + dsimp only [barTotal] + dsimp only [barTotalSectionF, barTotalAugmentation] + erw [Category.assoc, ← Functor.map_comp, ι_barTotalAugmentationF_zero] + simp only [HomologicalComplex.XIsoOfEq_rfl, Iso.refl_hom, Category.comp_id] + ext x + exact contraction_zero k A (Z.X n) x + +/-- Naturality of unit insertion under the input differential. -/ +@[reassoc] +theorem barUnit_natural (i p q : ℕ) : + (F).map (ModuleCat.ofHom (termMap k A (Z.X p) (Z.X q) (Z.d p q).hom i)) ≫ + barUnit k A Z i q = + barUnit k A Z i p ≫ + (F).map (ModuleCat.ofHom (termMap k A (Z.X p) (Z.X q) (Z.d p q).hom (i+1))) := by + ext x + exact (contraction_natural k A (Z.X p) (Z.X q) (Z.d p q).hom i x).symm + +/-- The additive section commutes with the input differential. -/ +theorem barTotalSectionF_comm (n : ℕ) : + barTotalSectionF k A Z (n+1) ≫ (F).map ((T).d (n+1) n) = + (F).map (Z.d (n+1) n) ≫ barTotalSectionF k A Z n := by + dsimp only [barTotal] + dsimp only [barTotalSectionF] + erw [Category.assoc, ← Functor.map_comp] + simp only [barTotal, HomologicalComplex₂.total_d, comp_add, + HomologicalComplex₂.ι_D₁, HomologicalComplex₂.ι_D₂, + barTotal_d₁_zero, zero_add] + erw [barTotal_d₂_succ k A Z 0 n n (by omega)] + simp only [pow_zero, one_smul] + erw [Functor.map_comp, ← Category.assoc, ← barUnit_natural] + +/-- The row contraction identity, expressed in additive maps. -/ +theorem barUnit_identity (i q : ℕ) : + barUnit k A Z (i+1) q ≫ (F).map (ModuleCat.ofHom (differential k A (Z.X q) (i+1))) + + (F).map (ModuleCat.ofHom (differential k A (Z.X q) i)) ≫ barUnit k A Z i q = 𝟙 _ := by + ext x + exact contraction_identity k A (Z.X q) i x + +@[reassoc] +theorem ι_barTotal_d (i q n m : ℕ) (h : i+q=n) : + (F).map ((B).ιTotal c i q n h) ≫ (F).map ((T).d n m) = + barTotalDH k A Z i q m + barTotalDV k A Z i q m := by + dsimp only [barTotal, barTotalDH, barTotalDV] + erw [← Functor.map_comp] + simp only [HomologicalComplex₂.total_d, comp_add, + HomologicalComplex₂.ι_D₁, HomologicalComplex₂.ι_D₂, Functor.map_add] + rfl + +/-- The vertical contributions cancel because unit insertion changes bar parity. -/ +theorem barTotal_vertical_cancel (i q n : ℕ) (h : i+q=n) : + barTotalDV k A Z i (q+1) n ≫ barTotalH k A Z n + + barRaise k A Z i (q+1) ≫ barTotalDV k A Z (i+1) (q+1) (n+1) = 0 := by + dsimp only [barTotalDV] + erw [barTotal_d₂_succ k A Z i q n h, + barTotal_d₂_succ k A Z (i+1) q (n+1) (by omega)] + erw [Functor.map_units_smul, Functor.map_units_smul, + Functor.map_comp, Functor.map_comp, Linear.units_smul_comp, + Linear.comp_units_smul, Category.assoc, ι_barTotalH] + dsimp only [barRaise] + erw [barUnit_natural_assoc] + erw [pow_succ, mul_neg_one, Units.neg_smul, add_neg_cancel] + +/-- Total contraction equation in degree zero. -/ +theorem barTotalH_identity_zero : + barTotalH k A Z 0 ≫ (F).map ((T).d 1 0) + + (F).map ((barTotalAugmentation k A Z).f 0) ≫ barTotalSectionF k A Z 0 = 𝟙 _ := by + dsimp only [barTotal] + apply totalAdd_hom_ext B + intro i q h + have hi : i=0 := by omega + have hq : q=0 := by omega + subst i q + erw [comp_add, ← Category.assoc, ι_barTotalH] + erw [Category.assoc, ι_barTotal_d] + dsimp only [barTotalDH, barTotalDV] + erw [barTotal_d₁_succ k A Z 0 0 0 rfl, barTotal_d₂_zero] + erw [Functor.map_zero, add_zero, Functor.map_comp] + have ha : (F).map ((B).ιTotal c 0 0 0 h) ≫ + (F).map ((barTotalAugmentation k A Z).f 0) = + (F).map (ModuleCat.ofHom (differential k A (Z.X 0) 0)) := by + erw [← Functor.map_comp] + change (F).map (_ ≫ barTotalAugmentationF k A Z 0) = _ + erw [ι_barTotalAugmentationF_zero] + simp + rfl + erw [← Category.assoc ((F).map ((B).ιTotal c 0 0 0 h)) + ((F).map ((barTotalAugmentation k A Z).f 0)) (barTotalSectionF k A Z 0), ha] + dsimp only [barTotalSectionF] + erw [← Category.assoc] + dsimp only [barRaise] + erw [← Category.assoc, ← add_comp, barUnit_identity] + ext x + rfl + +private theorem barTotal_horizontal_identity (n i q : ℕ) (h : i+q=n+1) : + barTotalDH k A Z i q n ≫ barTotalH k A Z n + + barRaise k A Z i q ≫ barTotalDH k A Z (i+1) q (n+1) + + (F).map ((B).ιTotal c i q (n+1) h) ≫ + (F).map ((barTotalAugmentation k A Z).f (n+1)) ≫ + barTotalSectionF k A Z (n+1) = (F).map ((B).ιTotal c i q (n+1) h) := by + dsimp only [barTotalDH] + erw [barTotal_d₁_succ k A Z i q (n+1) h] + cases i with + | zero => + have hq : q=n+1 := by omega + subst q + erw [barTotal_d₁_zero, Functor.map_zero, zero_comp, zero_add, + Functor.map_comp] + dsimp only [barTotalAugmentation] + erw [← Functor.map_comp_assoc (F) ((B).ιTotal c 0 (n+1) (n+1) h) + (barTotalAugmentationF k A Z (n+1)) (barTotalSectionF k A Z (n+1))] + erw [ι_barTotalAugmentationF_zero] + simp only [HomologicalComplex.XIsoOfEq_rfl, Iso.refl_hom, Category.comp_id] + dsimp only [barTotalSectionF] + erw [← Category.assoc] + dsimp only [barRaise] + erw [← Category.assoc, ← add_comp, barUnit_identity] + ext x + rfl + | succ i => + erw [barTotal_d₁_succ k A Z i q n (by omega)] + erw [Functor.map_comp, Functor.map_comp, Category.assoc, + ι_barTotalH k A Z i q n (by omega)] + dsimp only [barTotalAugmentation] + erw [← Functor.map_comp_assoc (F) ((B).ιTotal c (i+1) q (n+1) h) + (barTotalAugmentationF k A Z (n+1)) (barTotalSectionF k A Z (n+1))] + erw [ι_barTotalAugmentationF_succ k A Z i q (n+1) h] + erw [Functor.map_zero, zero_comp, add_zero, ← Category.assoc, ← Category.assoc] + dsimp only [barRaise] + erw [← add_comp] + ext x + exact congrArg ((F).map ((B).ιTotal c (i+1) q (n+1) h)).hom + ((add_comm _ _).trans (contraction_identity k A (Z.X q) (i+1) x)) + +private theorem add_interleave {M : Type*} [AddCommMonoid M] (aa bb cc dd ee : M) : + aa + bb + (cc + dd) + ee = (aa + cc + ee) + (bb + dd) := by + abel + +/-- Total contraction equation in every positive degree. -/ +theorem barTotalH_identity_succ (n : ℕ) : + (F).map ((T).d (n+1) n) ≫ barTotalH k A Z n + + barTotalH k A Z (n+1) ≫ (F).map ((T).d (n+2) (n+1)) + + (F).map ((barTotalAugmentation k A Z).f (n+1)) ≫ + barTotalSectionF k A Z (n+1) = 𝟙 _ := by + dsimp only [barTotal] + apply totalAdd_hom_ext B + intro i q h + have hv : barTotalDV k A Z i q n ≫ barTotalH k A Z n + + barRaise k A Z i q ≫ barTotalDV k A Z (i+1) q (n+1) = 0 := by + cases q with + | zero => + dsimp only [barTotalDV] + erw [barTotal_d₂_zero, barTotal_d₂_zero, Functor.map_zero, + Functor.map_zero, zero_comp, comp_zero, add_zero] + | succ q => exact barTotal_vertical_cancel k A Z i q n (by omega) + have hh := barTotal_horizontal_identity k A Z n i q h + erw [comp_add, comp_add, ← Category.assoc, ← Category.assoc, + ι_barTotalH k A Z i q (n+1) h] + erw [ι_barTotal_d, Category.assoc, ι_barTotal_d, add_comp, comp_add] + calc + _ = (barTotalDH k A Z i q n ≫ barTotalH k A Z n + + barRaise k A Z i q ≫ barTotalDH k A Z (i+1) q (n+1) + + (F).map ((B).ιTotal c i q (n+1) h) ≫ + (F).map ((barTotalAugmentation k A Z).f (n+1)) ≫ + barTotalSectionF k A Z (n+1)) + + (barTotalDV k A Z i q n ≫ barTotalH k A Z n + + barRaise k A Z i q ≫ barTotalDV k A Z (i+1) q (n+1)) := + add_interleave _ _ _ _ _ + _ = _ := by + erw [hh, hv, add_zero] + ext x + rfl +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalBarDerived.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalBarDerived.lean new file mode 100644 index 0000000000000000000000000000000000000000..654c3e5dea1812ca9fdf465b1d7ec9566aef3fe1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalBarDerived.lean @@ -0,0 +1,119 @@ +import OAI.Algebra.Finitistic.Bar.ResolutionDerived +import OAI.Algebra.Finitistic.Bar.TotalBarComparison + +namespace OAI +open CategoryTheory CategoryTheory.Functor HomologicalComplex +noncomputable section +namespace DerivedBar +universe u +variable (k D : Type u) [Field k] [Ring D] [Algebra k D] +local notation "c" => ComplexShape.down ℕ + +abbrev chainQuasiIso := HomologicalComplex.quasiIso (ModuleCat.{u} D) c +abbrev chainDerived := (chainQuasiIso D).Localization +abbrev chainQ : ChainComplex (ModuleCat.{u} D) ℕ ⥤ chainDerived D := (chainQuasiIso D).Q + +variable (X : Type u) [AddCommGroup X] [Module k X] [Module D X] [Module Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] + +/-- Ordinary balanced tensor on chains followed by the quasi-isomorphism localization. -/ +def ordinaryTensorToDerived : ChainComplex (ModuleCat.{u} D) ℕ ⥤ chainDerived D := + (BimoduleTensor.tensorFunctor k D X).mapHomologicalComplex c ⋙ chainQ D + +omit [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] in +theorem tensorTotal_inverts : (chainQuasiIso D).IsInvertedBy + (tensorTotalFunctor k D X ⋙ chainQ D) := by + intro Z U f hf + have : QuasiIso f := hf + exact Localization.inverts (chainQ D) (chainQuasiIso D) _ + (show QuasiIso ((tensorTotalFunctor k D X).map f) from inferInstance) + +/-- Left derived balanced tensor on the localization of nonnegative chain complexes. -/ +def derivedTensor : chainDerived D ⥤ chainDerived D := + Localization.lift (tensorTotalFunctor k D X ⋙ chainQ D) + (tensorTotal_inverts k D X) (chainQ D) + +def derivedTensorResolutionIso : chainQ D ⋙ derivedTensor k D X ≅ + barTotalFunctor k D ⋙ ordinaryTensorToDerived k D X := + Localization.fac (tensorTotalFunctor k D X ⋙ chainQ D) + (tensorTotal_inverts k D X) (chainQ D) + +def derivedTensorCounit : chainQ D ⋙ derivedTensor k D X ⟶ ordinaryTensorToDerived k D X := + (derivedTensorResolutionIso k D X).hom ≫ + whiskerRight (barTotalAugmentationNat k D) (ordinaryTensorToDerived k D X) + +/-- The constructed tensor functor satisfies mathlib's genuine left-derived +universal property, proved using the projective total bar and its augmentation. -/ +instance derivedTensor_isLeftDerivedFunctor : + (derivedTensor k D X).IsLeftDerivedFunctor (derivedTensorCounit k D X) (chainQuasiIso D) := by + apply isLeftDerivedFunctor_of_resolution (chainQuasiIso D) (chainQ D) + (barTotalFunctor k D) (barTotalAugmentationNat k D) + (fun Z => (show QuasiIso (barTotalAugmentation k D Z) from inferInstance)) + (ordinaryTensorToDerived k D X) (derivedTensor k D X) + (derivedTensorResolutionIso k D X) (derivedTensorCounit k D X) rfl + intro Z + let : ∀ n, Projective (((barTotalFunctor k D).obj Z).X n) := barTotal_projective k D Z + have ht : QuasiIso + (((BimoduleTensor.tensorFunctor k D X).mapHomologicalComplex c).map + (barTotalAugmentation k D ((barTotalFunctor k D).obj Z))) := inferInstance + have hi := Localization.inverts (chainQ D) (chainQuasiIso D) _ ht + exact IsIso.comp_isIso' inferInstance hi + + +/-- The explicit two-sided total represents the genuine derived tensor of the input. -/ +def derivedTensorExplicitIso (Z : ChainComplex (ModuleCat.{u} D) ℕ) : + (derivedTensor k D X).obj ((chainQ D).obj Z) ≅ + (chainQ D).obj (BimoduleTensor.explicitBarTotal k D X Z) := + (derivedTensorResolutionIso k D X).app Z ≪≫ + (chainQ D).mapIso (BimoduleTensor.tensorTotalExplicitIso k D X Z) + +/-- Genuine derived functor iteration, with the manuscript's right-to-left order. -/ +def derivedTensorIterate : ℕ → (chainDerived D ⥤ chainDerived D) + | 0 => 𝟭 _ + | r+1 => derivedTensorIterate r ⋙ derivedTensor k D X + +/-- Successive resolve-and-tensor complexes represent iteration of the genuine +left derived functor. No derived comparison is included as a hypothesis. -/ +def derivedTensorIterateIso : (r : ℕ) → + chainQ D ⋙ derivedTensorIterate k D X r ≅ tensorTotalIterate k D X r ⋙ chainQ D + | 0 => (Functor.rightUnitor _ ) ≪≫ (Functor.leftUnitor _).symm + | r+1 => + (Functor.associator _ _ _).symm ≪≫ + isoWhiskerRight (derivedTensorIterateIso r) (derivedTensor k D X) ≪≫ + Functor.associator _ _ _ ≪≫ + isoWhiskerLeft (tensorTotalIterate k D X r) (derivedTensorResolutionIso k D X) ≪≫ + (Functor.associator _ _ _).symm + +/-- The independent recursive multibar. Every new block uses the explicit +endpoint-minus-tail horizontal differential and the standard vertical total sign. -/ +def explicitMultibar : ℕ → ChainComplex (ModuleCat.{u} D) ℕ → ChainComplex (ModuleCat.{u} D) ℕ + | 0, Z => Z + | r+1, Z => BimoduleTensor.explicitBarTotal k D X (explicitMultibar r Z) + +def iterateExplicitMultibarIso (Z : ChainComplex (ModuleCat.{u} D) ℕ) : (r : ℕ) → + (tensorTotalIterate k D X r).obj Z ≅ explicitMultibar k D X r Z + | 0 => Iso.refl _ + | r+1 => (tensorTotalFunctor k D X).mapIso (iterateExplicitMultibarIso Z r) ≪≫ + BimoduleTensor.tensorTotalExplicitIso k D X (explicitMultibar k D X r Z) + +/-- The independent recursive multibar represents genuine finite derived iteration. -/ +def derivedIterateMultibarIso (Z : ChainComplex (ModuleCat.{u} D) ℕ) (r : ℕ) : + (derivedTensorIterate k D X r).obj ((chainQ D).obj Z) ≅ + (chainQ D).obj (explicitMultibar k D X r Z) := + (derivedTensorIterateIso k D X r).app Z ≪≫ + (chainQ D).mapIso (iterateExplicitMultibarIso k D X Z r) + +/-- The final leading D-bar resolution leaves the represented derived iterate unchanged. -/ +def derivedIterateLeadingBarIso (Z : ChainComplex (ModuleCat.{u} D) ℕ) (r : ℕ) : + (derivedTensorIterate k D X r).obj ((chainQ D).obj Z) ≅ + (chainQ D).obj (barTotal k D (explicitMultibar k D X r Z)) := by + have := Localization.inverts (chainQ D) (chainQuasiIso D) + (barTotalAugmentation k D (explicitMultibar k D X r Z)) + (show QuasiIso (barTotalAugmentation k D (explicitMultibar k D X r Z)) from inferInstance) + exact derivedIterateMultibarIso k D X Z r ≪≫ + (asIso ((chainQ D).map (barTotalAugmentation k D (explicitMultibar k D X r Z)))).symm +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalBarFunctor.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalBarFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fe4752885e4b85e38d5d5e36198a6a7410bcbc5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalBarFunctor.lean @@ -0,0 +1,64 @@ +import OAI.Algebra.Finitistic.Bar.TotalBarResolution + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace DerivedBar +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +local instance (N : ModuleCat.{u} A) : Module k N := Module.compHom N (algebraMap k A) +local instance (N : ModuleCat.{u} A) : IsScalarTower k A N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local notation "c" => ComplexShape.down ℕ + +/-- The total bar resolution is a functor on nonnegative chain complexes. -/ +def barTotalFunctor : ChainComplex (ModuleCat.{u} A) ℕ ⥤ ChainComplex (ModuleCat.{u} A) ℕ := + (barFunctor k A).mapHomologicalComplex c ⋙ + HomologicalComplex₂.flipFunctor _ c c ⋙ HomologicalComplex₂.totalFunctor _ c c c + +@[reassoc] +theorem ι_barTotalFunctor_map {Z W : ChainComplex (ModuleCat.{u} A) ℕ} (f : Z ⟶ W) + (i q n : ℕ) (h : i+q=n) : + (barBicomplex k A Z).ιTotal c i q n h ≫ ((barTotalFunctor k A).map f).f n = + ModuleCat.ofHom (termMap k A (Z.X q) (W.X q) (f.f q).hom (i+1)) ≫ + (barBicomplex k A W).ιTotal c i q n h := by + dsimp only [barTotalFunctor, Functor.comp_map, HomologicalComplex₂.totalFunctor] + erw [HomologicalComplex₂.ιTotal_map] + rfl + +private theorem augmentation_zero_diagonal (Z : ChainComplex (ModuleCat.{u} A) ℕ) (n : ℕ) + (h : 0 + n = n) : + (barBicomplex k A Z).ιTotal c 0 n n h ≫ barTotalAugmentationF k A Z n = + ModuleCat.ofHom (differential k A (Z.X n) 0) := by + erw [ι_barTotalAugmentationF_zero, HomologicalComplex.XIsoOfEq_rfl, + Iso.refl_hom, Category.comp_id] + +/-- The augmentation is natural for all chain maps, not only quasi-isomorphisms. -/ +def barTotalAugmentationNat : barTotalFunctor k A ⟶ 𝟭 _ where + app Z := barTotalAugmentation k A Z + naturality {Z W} f := by + apply HomologicalComplex.Hom.ext + funext n + apply HomologicalComplex₂.total.hom_ext (K := barBicomplex k A Z) + intro i q h + change i+q=n at h + change (barBicomplex k A Z).ιTotal c i q n h ≫ ((barTotalFunctor k A).map f).f n ≫ barTotalAugmentationF k A W n = + (barBicomplex k A Z).ιTotal c i q n h ≫ barTotalAugmentationF k A Z n ≫ f.f n + erw [ι_barTotalFunctor_map_assoc] + cases i with + | zero => + have hq : q=n := by omega + subst q + erw [Category.assoc, augmentation_zero_diagonal k A W n h, + ← Category.assoc, augmentation_zero_diagonal k A Z n h] + exact ModuleCat.hom_ext (differential_natural k A (Z.X n) (W.X n) (f.f n).hom 0) + | succ i => + erw [Category.assoc, ι_barTotalAugmentationF_succ k A W i q n h, + ← Category.assoc, ι_barTotalAugmentationF_succ k A Z i q n h] + simp only [zero_comp] + exact comp_zero +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalBarResolution.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalBarResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..552024562625ab29206ddcdfad8278940235278c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalBarResolution.lean @@ -0,0 +1,76 @@ +import OAI.Algebra.Finitistic.Bar.TotalBarContraction +import Mathlib.Algebra.Homology.HomotopyCategory.KProjective + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace DerivedBar +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Z : ChainComplex (ModuleCat.{u} A) ℕ) +local notation "c" => ComplexShape.down ℕ +local notation "F" => moduleForgetAdd A +local notation "P" => CategoryTheory.Functor.obj + (CategoryTheory.Functor.mapHomologicalComplex (moduleForgetAdd A) (ComplexShape.down ℕ)) (barTotal k A Z) +local notation "Q" => CategoryTheory.Functor.obj + (CategoryTheory.Functor.mapHomologicalComplex (moduleForgetAdd A) (ComplexShape.down ℕ)) Z +local notation "π" => CategoryTheory.Functor.map + (CategoryTheory.Functor.mapHomologicalComplex (moduleForgetAdd A) (ComplexShape.down ℕ)) (barTotalAugmentation k A Z) + +/-- Unit insertion is an actual additive chain section of the total augmentation. -/ +def barTotalSection : Q ⟶ P where + f := barTotalSectionF k A Z + comm' i j h := by + change j+1=i at h + subst i + exact barTotalSectionF_comm k A Z j + +/-- The explicit additive contraction, with its degree condition. -/ +def barTotalHomotopy : Homotopy (𝟙 P) (π ≫ barTotalSection k A Z) where + hom i j := if h : i+1=j then barTotalH k A Z i ≫ ((P).XIsoOfEq h).hom else 0 + zero i j h := by + change ¬ i+1=j at h + exact dite_eq_right h + comm i := by + rw [prevD_eq _ (by rfl : (c).Rel (i+1) i)] + simp only [HomologicalComplex.XIsoOfEq_rfl, Iso.refl_hom] + cases i with + | zero => + rw [dNext_eq_zero _ 0 (by simp), zero_add] + exact (barTotalH_identity_zero k A Z).symm + | succ n => + rw [dNext_eq _ (by rfl : (c).Rel (n+1) n)] + simp only [HomologicalComplex.XIsoOfEq_rfl, Iso.refl_hom] + exact (barTotalH_identity_succ k A Z n).symm + +/-- The total augmentation is a homotopy equivalence after forgetting the A-action. +The inverse and homotopy are explicit unit insertions, not A-linear splittings. -/ +def barTotalAdditiveEquiv : HomotopyEquiv P Q where + hom := π + inv := barTotalSection k A Z + homotopyHomInvId := (barTotalHomotopy k A Z).symm + homotopyInvHomId := Homotopy.ofEq (by + apply HomologicalComplex.Hom.ext + funext n + exact barTotalSectionF_augmentation k A Z n) + +/-- The actual D-linear total-bar augmentation is a quasi-isomorphism for every +nonnegative chain input; neither projectivity nor flatness of the input is assumed. -/ +instance barTotalAugmentation_quasiIso : QuasiIso (barTotalAugmentation k A Z) := by + rw [← HomologicalComplex.quasiIso_map_iff_of_preservesHomology + (barTotalAugmentation k A Z) (moduleForgetAdd A)] + exact (barTotalAdditiveEquiv k A Z).quasiIso_hom + +/-- The source's bounded-above cochain model is obtained by the literal n ↦ -n extension. -/ +def barTotalCochain : CochainComplex (ModuleCat.{u} A) ℤ := + (barTotal k A Z).extend ComplexShape.embeddingDownNat + +/-- The proved projective total terms make the cochain extension K-projective. -/ +instance barTotalCochain_isKProjective : (barTotalCochain k A Z).IsKProjective := by + let : ∀ n, Projective ((barTotal k A Z).X n) := barTotal_projective k A Z + exact inferInstanceAs (CochainComplex.IsKProjective ((barTotal k A Z).extend ComplexShape.embeddingDownNat)) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalBarTensor.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalBarTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..6620e7fb72502a89ae273d13eeaca06ba1f26424 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalBarTensor.lean @@ -0,0 +1,74 @@ +import OAI.Algebra.Finitistic.Bar.TotalBarFunctor +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerived +import Mathlib.Algebra.Homology.DerivedCategory.KProjective + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace DerivedBar +universe u +variable (k D : Type u) [Field k] [Ring D] [Algebra k D] + +/-- Resolving a quasi-isomorphism gives a quasi-isomorphism between projective complexes. -/ +instance barTotalFunctor_map_quasiIso {Z W : ChainComplex (ModuleCat.{u} D) ℕ} + (f : Z ⟶ W) [QuasiIso f] : QuasiIso ((barTotalFunctor k D).map f) := by + apply (quasiIso_iff_comp_right (K := barTotal k D Z) (L := barTotal k D W) + ((barTotalFunctor k D).map f) (barTotalAugmentation k D W)).mp + erw [(barTotalAugmentationNat k D).naturality f] + exact inferInstanceAs (QuasiIso (barTotalAugmentation k D Z ≫ f)) + +/-- Additive functors preserve quasi-isomorphisms between nonnegative projective complexes. +This uses the proved homotopy-equivalence criterion, not a flatness hypothesis. -/ +theorem additive_map_quasiIso_of_projective (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) + [G.Additive] {P Q : ChainComplex (ModuleCat.{u} D) ℕ} + [∀ n, Projective (P.X n)] [∀ n, Projective (Q.X n)] + (f : P ⟶ Q) [QuasiIso f] : + QuasiIso ((G.mapHomologicalComplex (ComplexShape.down ℕ)).map f) := by + obtain ⟨e, he⟩ := (ChainComplex.quasiIso_iff_of_projective f).mp inferInstance + rw [← he] + exact (G.mapHomotopyEquiv e).quasiIso_hom + +variable (X : Type u) [AddCommGroup X] [Module k X] [Module D X] [Module Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] + +/-- Resolve the entire input complex before applying the actual balanced tensor functor. -/ +def tensorTotalFunctor : ChainComplex (ModuleCat.{u} D) ℕ ⥤ ChainComplex (ModuleCat.{u} D) ℕ := + barTotalFunctor k D ⋙ + (BimoduleTensor.tensorFunctor k D X).mapHomologicalComplex (ComplexShape.down ℕ) + +/-- The resolved tensor construction preserves all quasi-isomorphisms. -/ +instance tensorTotalFunctor_map_quasiIso {Z W : ChainComplex (ModuleCat.{u} D) ℕ} + (f : Z ⟶ W) [QuasiIso f] : QuasiIso ((tensorTotalFunctor k D X).map f) := by + let : ∀ n, Projective (((barTotalFunctor k D).obj Z).X n) := barTotal_projective k D Z + let : ∀ n, Projective (((barTotalFunctor k D).obj W).X n) := barTotal_projective k D W + exact additive_map_quasiIso_of_projective D (BimoduleTensor.tensorFunctor k D X) + ((barTotalFunctor k D).map f) + +/-- On a projective chain input, tensoring the augmentation is a quasi-isomorphism, +even when X is not flat. This identifies the construction with tensor of that projective model. -/ +instance tensorTotalAugmentation_quasiIso (P : ChainComplex (ModuleCat.{u} D) ℕ) + [∀ n, Projective (P.X n)] : + QuasiIso (((BimoduleTensor.tensorFunctor k D X).mapHomologicalComplex (ComplexShape.down ℕ)).map + (barTotalAugmentation k D P)) := by + let : ∀ n, Projective ((barTotal k D P).X n) := barTotal_projective k D P + exact additive_map_quasiIso_of_projective D (BimoduleTensor.tensorFunctor k D X) + (barTotalAugmentation k D P) + +/-- Repeated resolution and balanced tensor, proceeding from the right as in Section 6. +The identification with the independently signed literal multibar is a separate obligation. -/ +def tensorTotalIterate : ℕ → (ChainComplex (ModuleCat.{u} D) ℕ ⥤ ChainComplex (ModuleCat.{u} D) ℕ) + | 0 => 𝟭 _ + | r+1 => tensorTotalIterate r ⋙ tensorTotalFunctor k D X + +instance tensorTotalIterate_map_quasiIso (r : ℕ) {Z W : ChainComplex (ModuleCat.{u} D) ℕ} + (f : Z ⟶ W) [QuasiIso f] : QuasiIso ((tensorTotalIterate k D X r).map f) := by + induction r with + | zero => exact inferInstanceAs (QuasiIso f) + | succ r ih => + let := ih + exact tensorTotalFunctor_map_quasiIso k D X ((tensorTotalIterate k D X r).map f) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TotalMap.lean b/lean/OAI/Algebra/Finitistic/Bar/TotalMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cf037523657bc78447e22f93411ec5a79627309 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TotalMap.lean @@ -0,0 +1,129 @@ +import OAI.Algebra.Finitistic.Bar.BarFunctor +import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor + +namespace OAI +open CategoryTheory CategoryTheory.Limits CategoryTheory.Preadditive +noncomputable section +namespace DerivedBar +universe u +variable {D : Type u} [Ring D] +local notation "c" => ComplexShape.down ℕ + +/-- Each diagonal of a first-quadrant total complex is finite. -/ +instance finiteTotalDiagonal (n : ℕ) : Finite ((ComplexShape.π c c c) ⁻¹' {n}) := by + apply Finite.of_injective (fun p => (⟨p.val.1, show p.val.1 < n+1 by + have := p.property; change p.val.1+p.val.2=n at this; omega⟩ : Fin (n+1))) + intro a b h + apply Subtype.ext + have hab := congrArg Fin.val h + change a.val.1=b.val.1 at hab + have ha := a.property + have hb := b.property + change a.val.1+a.val.2=n at ha + change b.val.1+b.val.2=n at hb + exact Prod.ext hab (by omega) + +noncomputable instance fintypeTotalDiagonal (n : ℕ) : + Fintype ((ComplexShape.π c c c) ⁻¹' {n}) := Fintype.ofFinite _ + +variable (G : ModuleCat.{u} D ⥤ ModuleCat.{u} D) [G.Additive] +variable (K : HomologicalComplex₂ (ModuleCat.{u} D) c c) + +abbrev mapBicomplex : HomologicalComplex₂ (ModuleCat.{u} D) c c := + ((G.mapHomologicalComplex c).mapHomologicalComplex c).obj K + +/-- Maps out of the image of a total term, using only a finite coproduct. -/ +def totalMapDesc {n : ℕ} {Y : ModuleCat.{u} D} + (f : ∀ i q (_ : i+q=n), G.obj ((K.X i).X q) ⟶ Y) : + G.obj ((K.total c).X n) ⟶ Y := + (isColimitOfPreserves G (K.toGradedObject.isColimitCofanMapObj + (ComplexShape.π c c c) n)).desc + { pt := Y + ι := Discrete.natTrans (fun j => f j.as.val.1 j.as.val.2 j.as.property) } + +@[reassoc (attr := simp)] +theorem ι_totalMapDesc {n : ℕ} {Y : ModuleCat.{u} D} + (f : ∀ i q (_ : i+q=n), G.obj ((K.X i).X q) ⟶ Y) + (i q : ℕ) (h : i+q=n) : + G.map (K.ιTotal c i q n h) ≫ totalMapDesc G K f = f i q h := by + exact (isColimitOfPreserves G (K.toGradedObject.isColimitCofanMapObj + (ComplexShape.π c c c) n)).fac _ ⟨⟨⟨i,q⟩,h⟩⟩ + +theorem totalMap_hom_ext {n : ℕ} {Y : ModuleCat.{u} D} + {f g : G.obj ((K.total c).X n) ⟶ Y} + (h : ∀ i q (hi : i+q=n), + G.map (K.ιTotal c i q n hi) ≫ f = G.map (K.ιTotal c i q n hi) ≫ g) : f=g := by + apply IsColimit.hom_ext + (isColimitOfPreserves G (K.toGradedObject.isColimitCofanMapObj + (ComplexShape.π c c c) n)) + rintro ⟨⟨⟨i,q⟩,hi⟩⟩ + exact h i q hi + +/-- Additive functors commute with each finite diagonal sum. -/ +def totalMapIsoX (n : ℕ) : + G.obj ((K.total c).X n) ≅ ((mapBicomplex G K).total c).X n where + hom := totalMapDesc G K (fun i q h => (mapBicomplex G K).ιTotal c i q n h) + inv := (mapBicomplex G K).totalDesc (fun i q h => G.map (K.ιTotal c i q n h)) + hom_inv_id := by apply totalMap_hom_ext G K; intros; simp + inv_hom_id := by apply HomologicalComplex₂.total.hom_ext; intros; simp + +@[reassoc (attr := simp)] +theorem ι_totalMapIsoX_inv (i q n : ℕ) (h : i+q=n) : + (mapBicomplex G K).ιTotal c i q n h ≫ (totalMapIsoX G K n).inv = + G.map (K.ιTotal c i q n h) := by + simp [totalMapIsoX] + +theorem ιTotalOrZero_totalMapIsoX_inv (i q n : ℕ) : + (mapBicomplex G K).ιTotalOrZero c i q n ≫ (totalMapIsoX G K n).inv = + G.map (K.ιTotalOrZero c i q n) := by + by_cases h : i+q=n + · rw [HomologicalComplex₂.ιTotalOrZero_eq _ _ _ _ _ h, + HomologicalComplex₂.ιTotalOrZero_eq _ _ _ _ _ h, ι_totalMapIsoX_inv] + · rw [HomologicalComplex₂.ιTotalOrZero_eq_zero _ _ _ _ _ h, + HomologicalComplex₂.ιTotalOrZero_eq_zero _ _ _ _ _ h, zero_comp, G.map_zero] + +theorem d₁_totalMapIsoX_inv (i q n : ℕ) : + (mapBicomplex G K).d₁ c i q n ≫ (totalMapIsoX G K n).inv = + G.map (K.d₁ c i q n) := by + by_cases h : (c).Rel i ((c).next i) + · rw [HomologicalComplex₂.d₁_eq' _ _ h, HomologicalComplex₂.d₁_eq' _ _ h] + simp only [Units.smul_def, zsmul_comp, Category.assoc, + ιTotalOrZero_totalMapIsoX_inv, Units.smul_def, G.map_zsmul, G.map_comp] + rfl + · rw [HomologicalComplex₂.d₁_eq_zero _ _ _ _ _ h, + HomologicalComplex₂.d₁_eq_zero _ _ _ _ _ h, zero_comp, G.map_zero] + +theorem d₂_totalMapIsoX_inv (i q n : ℕ) : + (mapBicomplex G K).d₂ c i q n ≫ (totalMapIsoX G K n).inv = + G.map (K.d₂ c i q n) := by + by_cases h : (c).Rel q ((c).next q) + · rw [HomologicalComplex₂.d₂_eq' _ _ _ h, HomologicalComplex₂.d₂_eq' _ _ _ h] + simp only [Units.smul_def, zsmul_comp, Category.assoc, + ιTotalOrZero_totalMapIsoX_inv, Units.smul_def, G.map_zsmul, G.map_comp] + rfl + · rw [HomologicalComplex₂.d₂_eq_zero _ _ _ _ _ h, + HomologicalComplex₂.d₂_eq_zero _ _ _ _ _ h, zero_comp, G.map_zero] + +/-- Additive functors commute with first-quadrant totalization as chain complexes, +with the actual horizontal and signed vertical differential. -/ +def totalMapIso : (G.mapHomologicalComplex c).obj (K.total c) ≅ + (mapBicomplex G K).total c := + (HomologicalComplex.Hom.isoOfComponents (fun n => (totalMapIsoX G K n).symm) + (by + intro i j hij + apply HomologicalComplex₂.total.hom_ext + intro a b h + change (mapBicomplex G K).ιTotal c a b i h ≫ (totalMapIsoX G K i).inv ≫ + G.map ((K.total c).d i j) = + (mapBicomplex G K).ιTotal c a b i h ≫ + ((mapBicomplex G K).total c).d i j ≫ (totalMapIsoX G K j).inv + rw [ι_totalMapIsoX_inv_assoc, ← G.map_comp] + simp only [HomologicalComplex₂.total_d, comp_add, add_comp, + HomologicalComplex₂.ι_D₁, HomologicalComplex₂.ι_D₂, + HomologicalComplex₂.ι_D₁_assoc, HomologicalComplex₂.ι_D₂_assoc, + G.map_add, d₁_totalMapIsoX_inv, d₂_totalMapIsoX_inv])).symm +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TwoSided.lean b/lean/OAI/Algebra/Finitistic/Bar/TwoSided.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e9ed9b9fef226324af8ad392071d13b9cd4f34c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TwoSided.lean @@ -0,0 +1,107 @@ +import OAI.Algebra.Finitistic.Bar.Bar + +namespace OAI +open scoped TensorProduct +open TensorProduct CategoryTheory +noncomputable section + +namespace DerivedBar +namespace FreeBaseChange +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) +variable (V W U : Type u) [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] + +/-- Replace only the free leading algebra coefficient along f. -/ +def coefficient : A ⊗[k] V →ₗ[k] D ⊗[k] V := + TensorProduct.map f.toLinearMap LinearMap.id + +@[simp] theorem coefficient_tmul (a : A) (v : V) : + coefficient f V (a ⊗ₜ[k] v) = f a ⊗ₜ[k] v := rfl + +/-- Coefficient change intertwines the two regular left actions. -/ +theorem coefficient_smul (a : A) (z : A ⊗[k] V) : + coefficient f V (a • z) = f a • coefficient f V z := by + induction z using TensorProduct.inductionOn with + | tmul b v => simp [TensorProduct.smul_tmul', map_mul] + | add x y hx hy => simp_all [smul_add] + +/-- Scalar extension of a morphism between explicitly free A-modules. -/ +def map (h : A ⊗[k] V →ₗ[A] A ⊗[k] W) : D ⊗[k] V →ₗ[D] D ⊗[k] W := + (action k D (D ⊗[k] W)).comp + (AlgebraTensorModule.lTensor D D + ((coefficient f W).comp ((h.restrictScalars k).comp (TensorProduct.mk k A V 1)))) + +@[simp] theorem map_tmul (h : A ⊗[k] V →ₗ[A] A ⊗[k] W) (d : D) (v : V) : + map f V W h (d ⊗ₜ[k] v) = d • coefficient f W (h (1 ⊗ₜ[k] v)) := rfl + +/-- Extension commutes with the map on arbitrary free tensors, not just generators. -/ +theorem map_coefficient (h : A ⊗[k] V →ₗ[A] A ⊗[k] W) (z : A ⊗[k] V) : + map f V W h (coefficient f V z) = coefficient f W (h z) := by + induction z using TensorProduct.inductionOn with + | tmul a v => + rw [coefficient_tmul, map_tmul] + have hz : a ⊗ₜ[k] v = a • ((1 : A) ⊗ₜ[k] v) := by + simp [TensorProduct.smul_tmul'] + rw [hz, h.map_smul, coefficient_smul] + | add x y hx hy => simp_all + +/-- Composition of actual free-module maps is preserved by extension. -/ +theorem map_comp (h : A ⊗[k] V →ₗ[A] A ⊗[k] W) + (g : A ⊗[k] W →ₗ[A] A ⊗[k] U) : + map f V U (g.comp h) = (map f W U g).comp (map f V W h) := by + apply AlgebraTensorModule.ext + intro d v + change d • coefficient f U (g (h (1 ⊗ₜ[k] v))) = + map f W U g (d • coefficient f W (h (1 ⊗ₜ[k] v))) + rw [LinearMap.map_smul, map_coefficient] + +@[simp] theorem map_zero : map f V W 0 = 0 := by + apply AlgebraTensorModule.ext + intro d v + simp only [map_tmul, LinearMap.zero_apply, _root_.map_zero, smul_zero] + +@[simp] theorem map_id : map f V V LinearMap.id = LinearMap.id := by + apply AlgebraTensorModule.ext + intro d v + simp [map_tmul, TensorProduct.smul_tmul'] + +end FreeBaseChange + +universe u +variable (k A D N : Type u) [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] + [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable (f : A →ₐ[k] D) + +/-- The two-sided absolute bar differential after changing the free coefficient A to D. -/ +def twoSidedDifferential (n : ℕ) : + D ⊗[k] term k A N (n+1) →ₗ[D] D ⊗[k] term k A N n := + FreeBaseChange.map f _ _ (differential k A N (n+1)) + +/-- The endpoint face minus the remaining absolute bar faces, with their actual signs. -/ +theorem twoSidedDifferential_tmul (n : ℕ) (d : D) (z : term k A N (n+1)) : + twoSidedDifferential k A D N f n (d ⊗ₜ[k] z) = + d • FreeBaseChange.coefficient f (term k A N n) z - + d ⊗ₜ[k] differential k A N n z := by + unfold twoSidedDifferential + rw [FreeBaseChange.map_tmul, differential_succ_tmul k A N n 1 z, + one_smul, map_sub, FreeBaseChange.coefficient_tmul, map_one, smul_sub, + TensorProduct.smul_tmul', smul_eq_mul, mul_one] + +theorem twoSidedDifferential_sq (n : ℕ) : + (twoSidedDifferential k A D N f n).comp + (twoSidedDifferential k A D N f (n+1)) = 0 := by + unfold twoSidedDifferential + rw [← FreeBaseChange.map_comp, differential_sq, FreeBaseChange.map_zero] + +/-- Actual D-linear two-sided bar complex with degree-n term D ⊗_k A^⊗n ⊗_k N. -/ +def twoSidedComplex : ChainComplex (ModuleCat D) ℕ := + ChainComplex.of (fun n => ModuleCat.of D (D ⊗[k] term k A N n)) + (fun n => ModuleCat.ofHom (twoSidedDifferential k A D N f n)) + (fun n => ModuleCat.hom_ext (twoSidedDifferential_sq k A D N f n)) +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TwoSidedBarFunctor.lean b/lean/OAI/Algebra/Finitistic/Bar/TwoSidedBarFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8b472d29ca8e15fc81f7d996bed3277b8b22a01 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TwoSidedBarFunctor.lean @@ -0,0 +1,127 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleComparison +import OAI.Algebra.Finitistic.Bar.BarFunctor + +namespace OAI +open CategoryTheory TensorProduct +open scoped TensorProduct +noncomputable section +namespace DerivedBar.BimoduleTensor +universe u +variable (k D X : 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] +local instance (N : ModuleCat.{u} D) : Module k N := scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +local notation "c" => ComplexShape.down ℕ + +/-- The component comparison to the explicit two-sided bar. -/ +def freeBarTensorIso (N : ModuleCat.{u} D) : + ((barFunctor k D ⋙ (tensorFunctor k D X).mapHomologicalComplex c).obj N) ≅ + barComplex k D X N := + resolvedTensorIso k D X N ≪≫ tensorResolutionIso k D X N + +/-- The map on the explicit field-tensor bar terms. -/ +def barTermMap {V W : ModuleCat.{u} D} (f : V ⟶ W) (n : ℕ) : + X ⊗[k] term k D V n →ₗ[D] X ⊗[k] term k D W n := + AlgebraTensorModule.lTensor D X ((termMap k D V W f.hom n).restrictScalars k) + +theorem freeMap_termMap {V W : ModuleCat.{u} D} (f : V ⟶ W) (n : ℕ) : + freeMap k D X _ _ (termMap k D V W f.hom (n+1)) = + barTermMap k D X f n := by + apply AlgebraTensorModule.ext + intro x v + change descend k D X _ (map k D X _ _ (termMap k D V W f.hom (n+1)) + (insert k D X _ (x ⊗ₜ[k] v))) = x ⊗ₜ[k] termMap k D V W f.hom n v + rw [insert_tmul, map_quotient, termMap_tmul, descend_quotient, + collapse_tmul, MulOpposite.op_one, one_smul] + +theorem barDifferential_natural {V W : ModuleCat.{u} D} (f : V ⟶ W) (n : ℕ) : + (barDifferential k D X W n).comp (barTermMap k D X f (n+1)) = + (barTermMap k D X f n).comp (barDifferential k D X V n) := by + rw [← freeMap_termMap, ← freeMap_termMap] + unfold barDifferential + rw [← freeMap_comp, ← freeMap_comp, differential_natural] + +/-- The two-sided bar map is defined on literal tensor coordinates. -/ +def twoSidedBarMap {V W : ModuleCat.{u} D} (f : V ⟶ W) : + barComplex k D X V ⟶ barComplex k D X W where + f n := ModuleCat.ofHom (barTermMap k D X f n) + comm' i j hij := by + change j+1=i at hij + subst i + apply ModuleCat.hom_ext + simpa only [barComplex, ChainComplex.of_d, ModuleCat.hom_comp, ModuleCat.hom_ofHom] + using! barDifferential_natural k D X f j + +/-- A functor with both maps and differential defined on the explicit bar tensors. -/ +def twoSidedBarFunctor : ModuleCat.{u} D ⥤ ChainComplex (ModuleCat.{u} D) ℕ where + obj N := barComplex k D X N + map f := twoSidedBarMap k D X f + map_id N := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply AlgebraTensorModule.ext + intro x v + change x ⊗ₜ[k] termMap k D N N LinearMap.id n v = x ⊗ₜ[k] v + rw [termMap_id]; rfl + map_comp {V W U} f g := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply AlgebraTensorModule.ext + intro x v + change x ⊗ₜ[k] termMap k D V U (g.hom.comp f.hom) n v = + x ⊗ₜ[k] termMap k D W U g.hom n (termMap k D V W f.hom n v) + rw [termMap_comp]; rfl + +instance twoSidedBarFunctor_preservesZero : (twoSidedBarFunctor k D X).PreservesZeroMorphisms where + map_zero V W := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply AlgebraTensorModule.ext + intro x v + change x ⊗ₜ[k] termMap k D V W 0 n v = 0 + rw [termMap_zero, LinearMap.zero_apply, TensorProduct.tmul_zero] + +/-- Natural comparison, preserving the exterior D-action. -/ +def freeBarTensorNatIso : + barFunctor k D ⋙ (tensorFunctor k D X).mapHomologicalComplex c ≅ + twoSidedBarFunctor k D X := + NatIso.ofComponents (freeBarTensorIso k D X) (by + intro V W f + apply HomologicalComplex.Hom.ext + funext n + change (tensorFunctor k D X).map (ModuleCat.ofHom (termMap k D V W f.hom (n+1))) ≫ + (tensorFunctorObjIso k D X (term k D W (n+1))).hom ≫ + (freeEquiv k D X (term k D W n)).toModuleIso.hom = + (tensorFunctorObjIso k D X (term k D V (n+1))).hom ≫ + (freeEquiv k D X (term k D V n)).toModuleIso.hom ≫ + ModuleCat.ofHom (barTermMap k D X f n) + rw [← Category.assoc, tensorFunctorObjIso_natural, Category.assoc] + congr 1 + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (freeMap_termMap k D X f n ▸ + freeMap_descend k D X (term k D V n) (term k D W n) + (termMap k D V W f.hom (n+1)) z).symm) + +/-- The literal two-sided bar bicomplex of an arbitrary nonnegative chain input. -/ +def twoSidedBarBicomplex (Z : ChainComplex (ModuleCat.{u} D) ℕ) : + HomologicalComplex₂ (ModuleCat.{u} D) c c := + HomologicalComplex₂.flip (((twoSidedBarFunctor k D X).mapHomologicalComplex c).obj Z) + +/-- Horizontal differential is the explicit two-sided bar, without count transport. -/ +theorem twoSidedBarBicomplex_d₁ (Z : ChainComplex (ModuleCat.{u} D) ℕ) (i q : ℕ) : + ((twoSidedBarBicomplex k D X Z).d (i+1) i).f q = + ModuleCat.ofHom (barDifferential k D X (Z.X q) i) := by + change (barComplex k D X (Z.X q)).d (i+1) i = _ + simp only [barComplex, ChainComplex.of_d] +end DerivedBar.BimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/TwoSidedWeight.lean b/lean/OAI/Algebra/Finitistic/Bar/TwoSidedWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ae92412f35207eb98cd8f044ec4840598a24de1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/TwoSidedWeight.lean @@ -0,0 +1,113 @@ +import OAI.Algebra.Finitistic.Bar.Weight + +namespace OAI +open scoped TensorProduct +open TensorProduct CategoryTheory TrivSqZeroExt +noncomputable section + +namespace DerivedBar.SquareZero +universe u +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] + +/-- Count-r submodule of the two-sided bar term, with the leading D coefficient uncounted. -/ +def twoSidedWeight (n r : ℕ) : Submodule D (D ⊗[k] term k (TrivSqZeroExt D X) N n) := + Submodule.span D {w | ∃ (d : D) (v : term k (TrivSqZeroExt D X) N n), + Word k D X N n r v ∧ w = d ⊗ₜ[k] v} + +variable {k D X N} + +theorem word_count_le {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} + (hv : Word k D X N n r v) : r ≤ n := by + induction hv with + | nil => exact Nat.le_refl 0 + | base d h ih => exact Nat.le_trans ih (Nat.le_succ _) + | ideal x h ih => exact Nat.succ_le_succ ih + +theorem weight_eq_bot_of_lt {n r : ℕ} (h : n < r) : weight k D X N n r = ⊥ := by + apply Submodule.span_eq_bot.mpr + intro v hv + exact False.elim (Nat.not_le_of_gt h (word_count_le hv)) + +/-- A count-r two-sided bar term is zero below degree r. -/ +theorem twoSidedWeight_eq_bot_of_lt {n r : ℕ} (h : n < r) : + twoSidedWeight k D X N n r = ⊥ := by + apply Submodule.span_eq_bot.mpr + rintro v ⟨d, z, hz, rfl⟩ + exact False.elim (Nat.not_le_of_gt h (word_count_le hz)) + +theorem tensor_weight_mem {n r : ℕ} (d : D) {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : d ⊗ₜ[k] v ∈ twoSidedWeight k D X N n r := by + let g := TensorProduct.mk k D (term k (TrivSqZeroExt D X) N n) d + have hle : weight k D X N n r ≤ + ((twoSidedWeight k D X N n r).restrictScalars k).comap g := by + apply Submodule.span_le.mpr + intro z hz + exact Submodule.subset_span ⟨d, z, hz, rfl⟩ + exact hle hv + +/-- Projection of the leading square-zero coefficient kills an ideal letter and retains a base letter. -/ +theorem coefficient_weight_mem {n r : ℕ} + {v : term k (TrivSqZeroExt D X) N (n+1)} (hv : v ∈ weight k D X N (n+1) r) : + FreeBaseChange.coefficient (fstHom k D X) (term k (TrivSqZeroExt D X) N n) v ∈ + twoSidedWeight k D X N n r := by + let g := FreeBaseChange.coefficient (fstHom k D X) (term k (TrivSqZeroExt D X) N n) + have hle : weight k D X N (n+1) r ≤ + ((twoSidedWeight k D X N n r).restrictScalars k).comap g := by + apply Submodule.span_le.mpr + intro z hz + cases hz with + | base d h => + exact Submodule.subset_span ⟨d, _, h, rfl⟩ + | ideal x h => + change (0 : D) ⊗ₜ[k] _ ∈ twoSidedWeight k D X N n _ + rw [TensorProduct.zero_tmul] + exact Submodule.zero_mem _ + exact hle hv + +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + +/-- The actual D-linear two-sided differential preserves X-count; no flatness enters the proof. -/ +theorem twoSidedDifferential_mem + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = 0) + (n r : ℕ) {v : D ⊗[k] term k (TrivSqZeroExt D X) N (n+1)} + (hv : v ∈ twoSidedWeight k D X N (n+1) r) : + twoSidedDifferential k (TrivSqZeroExt D X) D N (fstHom k D X) n v ∈ + twoSidedWeight k D X N n r := by + have hle : twoSidedWeight k D X N (n+1) r ≤ + (twoSidedWeight k D X N n r).comap + (twoSidedDifferential k (TrivSqZeroExt D X) D N (fstHom k D X) n) := by + apply Submodule.span_le.mpr + rintro v ⟨d, z, hz, rfl⟩ + change twoSidedDifferential k (TrivSqZeroExt D X) D N (fstHom k D X) n + (d ⊗ₜ[k] z) ∈ twoSidedWeight k D X N n r + rw [twoSidedDifferential_tmul] + exact Submodule.sub_mem _ + (Submodule.smul_mem _ d (coefficient_weight_mem (Submodule.subset_span hz))) + (tensor_weight_mem d (differential_mem hN n r (Submodule.subset_span hz))) + exact hle hv + +variable (k D X N) + +/-- A genuine D-module chain complex for each fixed number of square-zero entries. -/ +def twoSidedWeightComplex + (hN : ∀ (x : X) (v : N), (inr x : TrivSqZeroExt D X) • v = 0) (r : ℕ) : + ChainComplex (ModuleCat D) ℕ := + ChainComplex.of (fun n => ModuleCat.of D (twoSidedWeight k D X N n r)) + (fun n => ModuleCat.ofHom + ((twoSidedDifferential k (TrivSqZeroExt D X) D N (fstHom k D X) n).restrict + (fun v hv => twoSidedDifferential_mem hN n r hv))) + (fun n => by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + apply Subtype.ext + exact LinearMap.congr_fun + (twoSidedDifferential_sq k (TrivSqZeroExt D X) D N (fstHom k D X) n) v) +end DerivedBar.SquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bar/Weight.lean b/lean/OAI/Algebra/Finitistic/Bar/Weight.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3e935bb1b33b6a22b6d972a2b065296e99c1b81 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bar/Weight.lean @@ -0,0 +1,141 @@ +import OAI.Algebra.Finitistic.Bar.TwoSided +import Mathlib.Algebra.TrivSqZeroExt.Basic + +namespace OAI +open scoped TensorProduct +open TensorProduct CategoryTheory TrivSqZeroExt +noncomputable section + +namespace DerivedBar +namespace SquareZero +universe u +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] + +/-- (TrivSqZeroExt D X) pure bar word with precisely r factors in the square-zero ideal. -/ +inductive Word : (n r : ℕ) → term k (TrivSqZeroExt D X) N n → Prop + | nil (v : N) : Word 0 0 v + | base {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} (d : D) (h : Word n r v) : + Word (n+1) r ((inl d : (TrivSqZeroExt D X)) ⊗ₜ[k] v) + | ideal {n r : ℕ} {v : term k (TrivSqZeroExt D X) N n} (x : X) (h : Word n r v) : + Word (n+1) (r+1) ((inr x : (TrivSqZeroExt D X)) ⊗ₜ[k] v) + +/-- The homogeneous subspace, defined by actual tensors rather than formal signs. -/ +def weight (n r : ℕ) : Submodule k (term k (TrivSqZeroExt D X) N n) := + Submodule.span k {v | Word k D X N n r v} + +private theorem map_span_mem {V W : Type u} [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] (g : V →ₗ[k] W) (s : Set V) (t : Submodule k W) + (h : ∀ v ∈ s, g v ∈ t) {v : V} (hv : v ∈ Submodule.span k s) : g v ∈ t := by + have hle : Submodule.span k s ≤ t.comap g := Submodule.span_le.mpr h + exact hle hv + +variable {k D X N} + +theorem base_tmul_mem {n r : ℕ} (d : D) {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : + (inl d : (TrivSqZeroExt D X)) ⊗ₜ[k] v ∈ weight k D X N (n+1) r := + map_span_mem k (TensorProduct.mk k (TrivSqZeroExt D X) (term k (TrivSqZeroExt D X) N n) (inl d)) _ _ + (fun _ h => Submodule.subset_span (Word.base d h)) hv + +theorem ideal_tmul_mem {n r : ℕ} (x : X) {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : + (inr x : (TrivSqZeroExt D X)) ⊗ₜ[k] v ∈ weight k D X N (n+1) (r+1) := + map_span_mem k (TensorProduct.mk k (TrivSqZeroExt D X) (term k (TrivSqZeroExt D X) N n) (inr x)) _ _ + (fun _ h => Submodule.subset_span (Word.ideal x h)) hv + +variable [Module (TrivSqZeroExt D X) N] [IsScalarTower k (TrivSqZeroExt D X) N] + +/-- Degree-zero multiplication preserves the number of ideal factors. -/ +theorem base_smul_mem {n r : ℕ} (d : D) {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : + (inl d : (TrivSqZeroExt D X)) • v ∈ weight k D X N n r := by + apply map_span_mem k (Algebra.lsmul k k (term k (TrivSqZeroExt D X) N n) (inl d)) _ _ _ hv + intro v h + cases h with + | nil v => exact Submodule.subset_span (Word.nil _) + | base b hb => + simp only [Algebra.lsmul_coe, TensorProduct.smul_tmul', smul_eq_mul, + inl_mul_inl, weight] + exact Submodule.subset_span (Word.base (d*b) hb) + | ideal x hx => + simp only [Algebra.lsmul_coe, TensorProduct.smul_tmul', smul_eq_mul, + inl_mul_inr, weight] + exact Submodule.subset_span (Word.ideal (d • x) hx) + +/-- Degree-one multiplication raises the count, with square-zero products vanishing. -/ +theorem ideal_smul_mem (hN : ∀ (x : X) (v : N), (inr x : (TrivSqZeroExt D X)) • v = 0) + {n r : ℕ} (x : X) {v : term k (TrivSqZeroExt D X) N n} + (hv : v ∈ weight k D X N n r) : + (inr x : (TrivSqZeroExt D X)) • v ∈ weight k D X N n (r+1) := by + apply map_span_mem k (Algebra.lsmul k k (term k (TrivSqZeroExt D X) N n) (inr x)) _ _ _ hv + intro v h + cases h with + | nil v => + simp only [Algebra.lsmul_coe, hN] + + exact Submodule.zero_mem _ + | base b hb => + simp only [Algebra.lsmul_coe, TensorProduct.smul_tmul', smul_eq_mul, + inr_mul_inl, weight] + exact Submodule.subset_span (Word.ideal (MulOpposite.op b • x) hb) + | ideal y hy => + simp only [Algebra.lsmul_coe, TensorProduct.smul_tmul', smul_eq_mul, + inr_mul_inr, TensorProduct.zero_tmul] + exact Submodule.zero_mem _ + +/-- Every face of the augmented algebra bar differential preserves the X-count. -/ +theorem differential_mem (hN : ∀ (x : X) (v : N), (inr x : (TrivSqZeroExt D X)) • v = 0) + (n r : ℕ) {v : term k (TrivSqZeroExt D X) N (n+1)} (hv : v ∈ weight k D X N (n+1) r) : + differential k (TrivSqZeroExt D X) N n v ∈ weight k D X N n r := by + induction n generalizing r with + | zero => + apply map_span_mem k ((differential k (TrivSqZeroExt D X) N 0).restrictScalars k) _ _ _ hv + intro v h + cases h with + | base d h => + cases h with + | nil v => + exact Submodule.subset_span (Word.nil _) + | ideal x h => + cases h with + | nil v => + simp only [LinearMap.coe_restrictScalars, + differential_zero_tmul k (TrivSqZeroExt D X) N, hN] + exact Submodule.zero_mem _ + | succ n ih => + apply map_span_mem k ((differential k (TrivSqZeroExt D X) N (n+1)).restrictScalars k) _ _ _ hv + intro v h + cases h with + | base d h => + rw [LinearMap.coe_restrictScalars, differential_succ_tmul k (TrivSqZeroExt D X) N n] + exact Submodule.sub_mem _ (base_smul_mem d (Submodule.subset_span h)) + (base_tmul_mem d (ih _ (Submodule.subset_span h))) + | ideal x h => + rw [LinearMap.coe_restrictScalars, differential_succ_tmul k (TrivSqZeroExt D X) N n] + exact Submodule.sub_mem _ (ideal_smul_mem hN x (Submodule.subset_span h)) + (ideal_tmul_mem x (ih _ (Submodule.subset_span h))) + +variable (k D X N) + +/-- The actual complex formed by the fixed-count homogeneous bar subspaces. -/ +def weightComplex (hN : ∀ (x : X) (v : N), (inr x : (TrivSqZeroExt D X)) • v = 0) (r : ℕ) : + ChainComplex (ModuleCat k) ℕ := + ChainComplex.of (fun n => ModuleCat.of k (weight k D X N n r)) + (fun n => ModuleCat.ofHom + (((differential k (TrivSqZeroExt D X) N n).restrictScalars k).restrict + (fun v hv => differential_mem hN n r hv))) + (fun n => by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro v + apply Subtype.ext + exact LinearMap.congr_fun (differential_sq k (TrivSqZeroExt D X) N n) v) +end SquareZero +end DerivedBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Basic.lean b/lean/OAI/Algebra/Finitistic/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..be0ee799e2be602fdd910502d4c16171b3d1a3d5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Basic.lean @@ -0,0 +1,52 @@ +import Mathlib.Algebra.Category.ModuleCat.Abelian +import Mathlib.CategoryTheory.Abelian.Projective.Dimension +import Mathlib.RingTheory.Finiteness.Defs + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] + +/-- The little finitistic dimension: the supremum of the actual projective +dimensions of finitely generated modules whose projective dimension is finite. +The value of the zero module follows mathlib's -∞ convention. -/ +def littleFinitisticDimension : WithBot ℕ∞ := + ⨆ (M : ModuleCat.{u} A) (_ : Module.Finite A M) (_ : projectiveDimension M < ⊤), + projectiveDimension M + +theorem le_littleFinitisticDimension (M : ModuleCat.{u} A) [Module.Finite A M] + (h : projectiveDimension M < ⊤) : + projectiveDimension M ≤ littleFinitisticDimension A := by + unfold littleFinitisticDimension + exact le_iSup_of_le M (le_iSup_of_le inferInstance (le_iSup_of_le h le_rfl)) + +/-- Unbounded finite projective dimensions of actual finitely generated modules +force the little finitistic dimension to be infinite. -/ +theorem littleFinitisticDimension_eq_top_of_unbounded + (h : ∀ n : ℕ, ∃ M : ModuleCat.{u} A, Module.Finite A M ∧ + projectiveDimension M < ⊤ ∧ (n : WithBot ℕ∞) ≤ projectiveDimension M) : + littleFinitisticDimension A = ⊤ := by + apply ENat.WithBot.eq_top_iff_forall_ge.mpr + intro n + obtain ⟨M, hM, hfinite, hn⟩ := h n + let := hM + exact hn.trans (le_littleFinitisticDimension A M hfinite) + +/-- The manuscript's concrete lower-bound pattern is sufficient; all finite +projective-dimension premises must still be supplied by the constructed modules. -/ +theorem littleFinitisticDimension_eq_top_of_two_mul_bounds + (h : ∀ m : ℕ, 0 < m → ∃ M : ModuleCat.{u} A, Module.Finite A M ∧ + projectiveDimension M < ⊤ ∧ ((2*m-2 : ℕ) : WithBot ℕ∞) ≤ projectiveDimension M) : + littleFinitisticDimension A = ⊤ := by + apply littleFinitisticDimension_eq_top_of_unbounded + intro n + obtain ⟨M,hM,hfinite,hm⟩ := h (n+1) (by omega) + refine ⟨M,hM,hfinite,le_trans ?_ hm⟩ + exact_mod_cast (show n ≤ 2*(n+1)-2 by omega) +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentationEpi.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentationEpi.lean new file mode 100644 index 0000000000000000000000000000000000000000..2563849c1a524ddd78ffc6b907a60667a28072c0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentationEpi.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleAugmentedResolution +import Mathlib.Algebra.Homology.HomologicalComplexAbelian + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {P : BiComplex k B} {X : ModuleCat.{u} (Enveloping k B)} +variable (res : AugmentedProjective k B P X) + +/-- A quasi-isomorphism onto a stalk is surjective in each degree; this is +proved from its homology map, not imposed on the resolution data. -/ +theorem augmentation_epi_f (n : ℤ) : Epi (res.augmentation.f n) := by + let T := bimoduleStalk k B X + let := res.quasiIso + have : IsIso (T.homologyπ n) := T.isIso_homologyπ (n-1) n (by simp) (by simp [T,bimoduleStalk]) + have : IsIso (T.iCycles n) := T.isIso_iCycles n (n+1) (by simp) (by simp [T,bimoduleStalk]) + have heq : cyclesMap res.augmentation n = P.homologyπ n ≫ + homologyMap res.augmentation n ≫ inv (T.homologyπ n) := by + rw [← Category.assoc,homologyπ_naturality,Category.assoc,IsIso.hom_inv_id,Category.comp_id] + have : Epi (cyclesMap res.augmentation n) := by + rw [heq] + infer_instance + have : Epi (P.iCycles n ≫ res.augmentation.f n) := by + rw [← cyclesMap_i] + infer_instance + exact epi_of_epi (P.iCycles n) (res.augmentation.f n) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentationQuasiIso.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentationQuasiIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..276494ee3ffda059f3c3798b34c57b7f1f28a1e9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentationQuasiIso.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleAugmentationEpi +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalShortExact +import OAI.Algebra.Finitistic.Bimodule.BimoduleFiniteRowsAcyclic +import Mathlib.Algebra.Homology.HomologySequenceLemmas + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- An acyclic kernel in an actual short exact sequence makes the quotient map +an isomorphism on homology. -/ +theorem shortExact_quasiIso_g (S : ShortComplex (CochainComplex (ModuleCat.{u} B) ℤ)) + (hS : S.ShortExact) (hK : S.X₁.Acyclic) : QuasiIso S.g := by + rw [quasiIso_iff] + intro n + rw [quasiIsoAt_iff_isIso_homologyMap] + have hz (a : ℤ) : IsZero (S.X₁.homology a) := + (exactAt_iff_isZero_homology _ _).mp (hK a) + have : Mono (homologyMap S.g n) := (hS.homology_exact₂ n).mono_g_iff.mpr + ((hz n).eq_of_src _ _) + have : Epi (homologyMap S.g n) := (hS.homology_exact₃ n (n+1) rfl).epi_f_iff.mpr + ((hz (n+1)).eq_of_tgt _ _) + exact isIso_of_mono_of_epi _ + +variable {P : BiComplex k B} {X : ModuleCat.{u} (Enveloping k B)} +variable (res : AugmentedProjective k B P X) + +/-- The actual bimodule augmentation is an epimorphism of complexes. -/ +theorem augmentation_epi : Epi res.augmentation := by + let : ∀ n, Epi (res.augmentation.f n) := augmentation_epi_f res + constructor + intro Y f g h + apply HomologicalComplex.Hom.ext + funext n + apply (cancel_epi (res.augmentation.f n)).mp + exact congrArg (fun φ => φ.f n) h + +/-- Tensoring the actual bounded resolution augmentation with a complex of +projective left modules gives a quasi-isomorphism of B-module complexes. -/ +theorem augmentation_total_quasiIso (Z : CochainComplex (ModuleCat.{u} B) ℤ) + [∀ q, Projective (Z.X q)] : + QuasiIso (leftTotalMap res.augmentation Z res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper)) := by + let := augmentation_epi res + let K := kernel res.augmentation + let S : ShortComplex (BiComplex k B) := + ShortComplex.mk (kernel.ι res.augmentation) res.augmentation (kernel.condition _) + have hS : S.ShortExact := { exact := ShortComplex.exact_kernel res.augmentation } + have hK : K.Acyclic := hS.acyclic_X₁ res.quasiIso + have hb (a : ℤ) (ha : ∀ i, res.data.degrees i ≠ a) : IsZero (K.X a) := by + have hz : IsZero (P.X a) := outside_interval_isZero k B P + res.data.lower res.data.upper res.data.bounded a ha + have : Subsingleton (P.X a) := ModuleCat.isZero_iff_subsingleton.mp hz + have hinj := (ModuleCat.mono_iff_injective ((kernel.ι res.augmentation).f a)).mp inferInstance + have : Subsingleton (K.X a) := ⟨fun x y => hinj (Subsingleton.elim _ _)⟩ + exact ModuleCat.isZero_of_subsingleton _ + have htK : (total k B K res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) Z).Acyclic := by + apply total_acyclic_of_rows k B K Z res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) hb hK + res.data.lower (res.data.lower + (res.data.upper-res.data.lower).toNat) + · intro i + dsimp [BoundedProjective.degrees,intervalDegrees] + omega + · intro i + have := i.isLt + dsimp [BoundedProjective.degrees,intervalDegrees] + omega + exact shortExact_quasiIso_g _ + (leftTotal_shortExact k B Z res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) S hS) htK +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentedResolution.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentedResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a97324d165ce9d837e95caee94a659ceb35f854 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleAugmentedResolution.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBarResolution +import OAI.Algebra.Finitistic.Tensor.BalancedProjectiveLeft + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +abbrev bimoduleStalk (X : ModuleCat.{u} (Enveloping k B)) : BiComplex k B := + (HomologicalComplex.single (ModuleCat (Enveloping k B)) (.up ℤ) 0).obj X + +/-- Actual bounded right-projective resolution data, including the bimodule +augmentation and its quasi-isomorphism; no tensor comparison is assumed. -/ +structure AugmentedProjective (P : BiComplex k B) (X : ModuleCat.{u} (Enveloping k B)) where + data : BoundedProjective k B P + augmentation : P ⟶ bimoduleStalk k B X + quasiIso : QuasiIso augmentation + +namespace AugmentedProjective +variable {k B} {P : BiComplex k B} {X : ModuleCat.{u} (Enveloping k B)} +variable (res : AugmentedProjective k B P X) + +/-- The augmentation induces the concrete finite-total transformation. -/ +def tensorAugmentation : functor k B P res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) ⟶ + functor k B (bimoduleStalk k B X) res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) := + leftTensorNat res.data.degrees (intervalDegrees_strictMono res.data.lower res.data.upper) + res.augmentation + +/-- Each horizontal augmentation row is a B-linear quasi-isomorphism on a +projective left-module input, including every term of the total bar. -/ +theorem projectiveRow_quasiIso (N : ModuleCat.{u} B) [Projective N] : + QuasiIso (((BimoduleBalancedTensor.functor k B + (BalancedTensor.ScalarLeftModule k B N)).mapHomologicalComplex (.up ℤ)).map + res.augmentation) := by + let : Module.Projective B (BalancedTensor.ScalarLeftModule k B N) := + inferInstanceAs (Module.Projective B N) + let := res.quasiIso + exact BimoduleBalancedTensor.projectiveInput_quasiIso k B _ res.augmentation + +/-- In particular the actual resolution supplied by DerivedBar has all the +projective rows needed for the remaining finite-total quasi-isomorphism proof. -/ +theorem barRow_quasiIso (Z : ChainComplex (ModuleCat.{u} B) ℕ) (n : ℕ) : + QuasiIso (((BimoduleBalancedTensor.functor k B + (BalancedTensor.ScalarLeftModule k B ((DerivedBar.barTotal k B Z).X n))).mapHomologicalComplex + (.up ℤ)).map res.augmentation) := by + let : Projective ((DerivedBar.barTotal k B Z).X n) := DerivedBar.barTotal_projective k B Z n + exact projectiveRow_quasiIso res _ +end AugmentedProjective +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBalancedTensor.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBalancedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..a69ca0a015f34007b682898b2e303e94430be126 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBalancedTensor.lean @@ -0,0 +1,70 @@ +import OAI.Algebra.Finitistic.Rectification.VertexTensorLinear +import OAI.Algebra.Finitistic.Localization.TensorEvaluationFunctor +import OAI.Algebra.Finitistic.Rectification.ColumnProperties + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.BimoduleBalancedTensor +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (M : ModuleCat.{u} (Enveloping k B)) +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +abbrev Input := BalancedTensor.ScalarModule k B ((forgetRight k B).obj M) +local instance inputEnveloping : Module (Enveloping k B) (Input k B M) := + inferInstanceAs (Module (Enveloping k B) M) + +abbrev Tensor := BalancedTensor.Tensor k B (Input k B M) N + +def inputAction (b : B) : Input k B M →ₗ[Bᵐᵒᵖ] Input k B M := + VertexFunctor.action (BimoduleVertex.restriction k B) (BimoduleVertex.vertex k B b) + (BimoduleVertex.vertex_commute k B b) M + +/-- The original left B action on a genuine bimodule descends through balancing over B. -/ +def action : B →+* Module.End k (Tensor k B M N) where + toFun b := BalancedTensor.mapLeft (k := k) N (inputAction k B M b) + map_zero' := by + apply BalancedTensor.ext + intro m n + change BalancedTensor.mk k B (Input k B M) N (((0 : B) ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M)) n = 0 + rw [TensorProduct.zero_tmul] + have hz : (0 : Enveloping k B) • (m : M) = 0 := Module.zero_smul (R := Enveloping k B) m + rw [hz] + simp + map_one' := by + apply BalancedTensor.ext + intro m n + change BalancedTensor.mk k B (Input k B M) N (((1 : B) ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M)) n = + BalancedTensor.mk k B (Input k B M) N m n + rw [← Algebra.TensorProduct.one_def,one_smul] + map_add' a b := by + apply BalancedTensor.ext + intro m n + change BalancedTensor.mk k B (Input k B M) N (((a+b) ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M)) n = + BalancedTensor.mk k B (Input k B M) N ((a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M)) n + + BalancedTensor.mk k B (Input k B M) N ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M)) n + rw [TensorProduct.add_tmul,add_smul] + exact LinearMap.congr_fun ((BalancedTensor.mk k B (Input k B M) N).map_add _ _) n + map_mul' a b := by + apply BalancedTensor.ext + intro m n + change BalancedTensor.mk k B (Input k B M) N (((a*b) ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M)) n = + BalancedTensor.mk k B (Input k B M) N + ((a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M))) n + rw [← mul_smul,Algebra.TensorProduct.tmul_mul_tmul,one_mul] + +instance leftModule : Module B (Tensor k B M N) := + Module.compHom (Tensor k B M N) (action k B M N) + +@[simp] theorem smul_mk (b : B) (m : Input k B M) (n : N) : + b • BalancedTensor.mk k B (Input k B M) N m n = + BalancedTensor.mk k B (Input k B M) N + ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M)) n := rfl +end LittleFinitistic.BimoduleBalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBar.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBar.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d92962ef65dc2b4eb5f4a1a564c96bd70f21448 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBar.lean @@ -0,0 +1,108 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensor + +namespace OAI +open scoped TensorProduct +open TensorProduct CategoryTheory +noncomputable section + +namespace DerivedBar.BimoduleTensor +universe u +variable (k D X : 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] + +section FreeMaps +variable (V W U : Type u) [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] + +/-- Balanced tensor on a map of free modules, in the explicit field-tensor coordinates. -/ +def freeMap (h : D ⊗[k] V →ₗ[D] D ⊗[k] W) : X ⊗[k] V →ₗ[D] X ⊗[k] W := + (descend k D X W).comp ((map k D X _ _ h).comp (insert k D X V)) + +/-- Coordinate change commutes with every free-module differential. -/ +theorem freeMap_descend (h : D ⊗[k] V →ₗ[D] D ⊗[k] W) + (z : tensor k D X (D ⊗[k] V)) : + freeMap k D X V W h (descend k D X V z) = + descend k D X W (map k D X _ _ h z) := by + change descend k D X W (map k D X _ _ h (insert k D X V (descend k D X V z))) = _ + rw [show insert k D X V (descend k D X V z) = z from + LinearMap.congr_fun (insert_descend k D X V) z] + +theorem freeMap_comp (h : D ⊗[k] V →ₗ[D] D ⊗[k] W) + (g : D ⊗[k] W →ₗ[D] D ⊗[k] U) : + freeMap k D X V U (g.comp h) = + (freeMap k D X W U g).comp (freeMap k D X V W h) := by + apply LinearMap.ext + intro z + change descend k D X U (map k D X _ _ (g.comp h) (insert k D X V z)) = + freeMap k D X W U g (descend k D X W (map k D X _ _ h (insert k D X V z))) + rw [freeMap_descend, map_comp] + rfl + +@[simp] theorem freeMap_zero : freeMap k D X V W 0 = 0 := by + apply LinearMap.ext + intro z + simp only [freeMap, LinearMap.comp_apply, map_zero, LinearMap.zero_apply, _root_.map_zero] +end FreeMaps + +variable (N : Type u) [AddCommGroup N] [Module k N] [Module D N] [IsScalarTower k D N] + +/-- The two-sided bar differential for arbitrary bimodule coefficients X. -/ +def barDifferential (n : ℕ) : X ⊗[k] DerivedBar.term k D N (n+1) →ₗ[D] + X ⊗[k] DerivedBar.term k D N n := + freeMap k D X _ _ (DerivedBar.differential k D N (n+1)) + +/-- Independent endpoint-minus-tail formula, including the noncommutative right action. -/ +theorem barDifferential_tmul (n : ℕ) (x : X) (z : DerivedBar.term k D N (n+1)) : + barDifferential k D X N n (x ⊗ₜ[k] z) = + collapse k D X (DerivedBar.term k D N n) (x ⊗ₜ[k] z) - + x ⊗ₜ[k] DerivedBar.differential k D N n z := by + change descend k D X (DerivedBar.term k D N n) + (map k D X _ _ (DerivedBar.differential k D N (n+1)) + (insert k D X (DerivedBar.term k D N (n+1)) (x ⊗ₜ[k] z))) = _ + rw [insert_tmul, map_quotient, DerivedBar.differential_succ_tmul, one_smul, + TensorProduct.tmul_sub, _root_.map_sub, _root_.map_sub, + descend_quotient, descend_quotient, collapse_tmul, MulOpposite.op_one, one_smul] + +theorem barDifferential_sq (n : ℕ) : + (barDifferential k D X N n).comp (barDifferential k D X N (n+1)) = 0 := by + unfold barDifferential + rw [← freeMap_comp, DerivedBar.differential_sq, freeMap_zero] + +/-- Balanced X tensor of the actual free projective resolution of N. -/ +def tensorResolution : ChainComplex (ModuleCat D) ℕ := + ChainComplex.of (fun n => ModuleCat.of D (tensor k D X (DerivedBar.term k D N (n+1)))) + (fun n => ModuleCat.ofHom (map k D X _ _ (DerivedBar.differential k D N (n+1)))) + (fun n => by + apply ModuleCat.hom_ext + change (map k D X _ _ (DerivedBar.differential k D N (n+1))).comp + (map k D X _ _ (DerivedBar.differential k D N (n+1+1))) = 0 + rw [← map_comp, DerivedBar.differential_sq, map_zero]) + +/-- The explicit two-sided X,D,N bar complex, with no D-flatness assumption. -/ +def barComplex : ChainComplex (ModuleCat D) ℕ := + ChainComplex.of (fun n => ModuleCat.of D (X ⊗[k] DerivedBar.term k D N n)) + (fun n => ModuleCat.ofHom (barDifferential k D X N n)) + (fun n => ModuleCat.hom_ext (barDifferential_sq k D X N n)) + +/-- The explicit two-sided bar is isomorphic to genuine balanced tensor of the free resolution. -/ +def tensorResolutionIso : tensorResolution k D X N ≅ barComplex k D X N := + HomologicalComplex.Hom.isoOfComponents + (fun n => (freeEquiv k D X (DerivedBar.term k D N n)).toModuleIso) + (by + intro i j hij + change j+1 = i at hij + subst i + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + simp only [tensorResolution, barComplex, ChainComplex.of_d, + ModuleCat.hom_comp, ModuleCat.hom_ofHom, + LinearEquiv.toModuleIso_hom] + exact freeMap_descend k D X (DerivedBar.term k D N (j+1)) + (DerivedBar.term k D N j) (DerivedBar.differential k D N (j+1)) z) +end DerivedBar.BimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarComparisonIso.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarComparisonIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..4de40566f4e72a6b5519140c9eaac51709e21d36 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarComparisonIso.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBarComparisonMap +import OAI.Algebra.Finitistic.Bimodule.BimoduleAugmentationQuasiIso + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} B) := + HasDerivedCategory.standard (ModuleCat.{u} B) +variable {P : BiComplex k B} {X : ModuleCat.{u} (Enveloping k B)} +variable (res : AugmentedProjective k B P X) +variable (i₀ : Fin ((res.data.upper-res.data.lower).toNat+1)) (hi₀ : res.data.degrees i₀=0) + +/-- The original augmentation, evaluated on the actual free bar resolution, +becomes an isomorphism in the integer derived category. -/ +instance resolvedTensorAugmentation_isIso : IsIso + (whiskerLeft (DerivedBar.barTotalFunctor k B) + (whiskerLeft (DerivedBar.integerExtension B) + (whiskerRight res.tensorAugmentation DerivedCategory.Q))) := by + rw [NatTrans.isIso_iff_isIso_app] + intro Z + let : ∀ n, Projective ((DerivedBar.barTotal k B Z).X n) := + DerivedBar.barTotal_projective k B Z + let Z' := (DerivedBar.integerExtension B).obj (DerivedBar.barTotal k B Z) + have : ∀ n, Projective (Z'.X n) := by + intro n + exact inferInstanceAs (Projective + (((DerivedBar.barTotal k B Z).extend ComplexShape.embeddingDownNat).X n)) + have := augmentation_total_quasiIso res Z' + exact inferInstanceAs (IsIso (DerivedCategory.Q.map + (leftTotalMap res.augmentation Z' res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper)))) + +instance augmentationComparisonOnChains_isIso : + IsIso (augmentationComparisonOnChains res i₀ hi₀) := by + unfold augmentationComparisonOnChains + infer_instance + +/-- Natural identification of the native D(B-Mod) tensor by the actual bounded +right-projective bimodule resolution and DerivedBar's genuine localized tensor, +after chainToIntegerDerived. Both outside module actions are retained. -/ +def nativeBarIso : + DerivedBar.chainToIntegerDerived B ⋙ res.data.derived ≅ + DerivedBar.derivedTensor k B (barModule (X := X)) ⋙ DerivedBar.chainToIntegerDerived B := + (Localization.fullyFaithfulWhiskeringLeft (DerivedBar.chainQ B) + (DerivedBar.chainQuasiIso B) (DerivedCategory (ModuleCat.{u} B))).preimageIso + (asIso (augmentationComparisonOnChains res i₀ hi₀)) + +/-- This isomorphism uses precisely the original augmentation-induced map. -/ +theorem nativeBarIso_hom : (nativeBarIso res i₀ hi₀).hom = augmentationComparison res i₀ hi₀ := rfl +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarComparisonMap.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarComparisonMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..944c183c0e755e1eb921c1da6dc2495210ba9311 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarComparisonMap.lean @@ -0,0 +1,88 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleStalkTotal +import OAI.Algebra.Finitistic.Bimodule.BimoduleBarTensorComparison +import OAI.Algebra.Finitistic.Localization.IntegerExtensionFunctor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} B) := + HasDerivedCategory.standard (ModuleCat.{u} B) +variable {P : BiComplex k B} {X : ModuleCat.{u} (Enveloping k B)} +variable (res : AugmentedProjective k B P X) +variable (i₀ : Fin ((res.data.upper-res.data.lower).toNat+1)) (hi₀ : res.data.degrees i₀=0) + +abbrev barModule := BimoduleBarComparison.Actions k B X +abbrev actualBarFunctor := DerivedBar.BimoduleTensor.tensorFunctor k B (barModule (X := X)) + +/-- The stalk total on extended chains agrees with the exact tensor functor used by DerivedBar. -/ +def stalkChainIso : DerivedBar.integerExtension B ⋙ + functor k B (bimoduleStalk k B X) res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) ≅ + (actualBarFunctor (X := X)).mapHomologicalComplex (.down ℕ) ⋙ DerivedBar.integerExtension B := + isoWhiskerLeft (DerivedBar.integerExtension B) + (stalkTotalIso k B X res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) i₀ hi₀) ≪≫ + isoWhiskerLeft (DerivedBar.integerExtension B) + (NatIso.mapHomologicalComplex (BimoduleBarComparison.tensorFunctorIso k B X) (.up ℤ)) ≪≫ + IntegerExtensionFunctor.naturalIso (actualBarFunctor (X := X)) + +def resolvedStalkIso : + DerivedBar.barTotalFunctor k B ⋙ DerivedBar.integerExtension B ⋙ + functor k B (bimoduleStalk k B X) res.data.degrees + (intervalDegrees_strictMono res.data.lower res.data.upper) ⋙ DerivedCategory.Q ≅ + DerivedBar.tensorTotalFunctor k B (barModule (X := X)) ⋙ DerivedBar.integerQ B := + isoWhiskerLeft (DerivedBar.barTotalFunctor k B) + ((Functor.associator _ _ _).symm ≪≫ + isoWhiskerRight (stalkChainIso res i₀ hi₀) DerivedCategory.Q ≪≫ + Functor.associator _ _ _) ≪≫ + (Functor.associator _ _ _).symm + +/-- The native bar functor's defining localization comparisons, with integer extension. -/ +def actualBarResolutionIso : + DerivedBar.chainQ B ⋙ + (DerivedBar.derivedTensor k B (barModule (X := X)) ⋙ DerivedBar.chainToIntegerDerived B) ≅ + DerivedBar.tensorTotalFunctor k B (barModule (X := X)) ⋙ DerivedBar.integerQ B := + (Functor.associator _ _ _).symm ≪≫ + isoWhiskerRight (DerivedBar.derivedTensorResolutionIso k B (barModule (X := X))) + (DerivedBar.chainToIntegerDerived B) ≪≫ + Functor.associator _ _ _ ≪≫ + isoWhiskerLeft (DerivedBar.tensorTotalFunctor k B (barModule (X := X))) + (DerivedBar.chainToIntegerDerivedIso B) + +/-- Actual comparison induced by the actual bimodule augmentation, before +localization descent. Invertibility is a separate finite-total proof obligation. -/ +def augmentationComparisonOnChains : + DerivedBar.chainQ B ⋙ (DerivedBar.chainToIntegerDerived B ⋙ res.data.derived) ⟶ + DerivedBar.chainQ B ⋙ + (DerivedBar.derivedTensor k B (barModule (X := X)) ⋙ DerivedBar.chainToIntegerDerived B) := + (nativeChainBarResolutionIso res.data).hom ≫ + whiskerLeft (DerivedBar.barTotalFunctor k B) + (whiskerLeft (DerivedBar.integerExtension B) + (whiskerRight res.tensorAugmentation DerivedCategory.Q)) ≫ + (resolvedStalkIso res i₀ hi₀).hom ≫ + (actualBarResolutionIso (X := X)).inv + +/-- The concrete augmentation comparison descends to the genuine chain localization. +This constructs a map; it does not assert the still-unproved isomorphism property. -/ +def augmentationComparison : + DerivedBar.chainToIntegerDerived B ⋙ res.data.derived ⟶ + DerivedBar.derivedTensor k B (barModule (X := X)) ⋙ DerivedBar.chainToIntegerDerived B := + (Localization.fullyFaithfulWhiskeringLeft (DerivedBar.chainQ B) + (DerivedBar.chainQuasiIso B) (DerivedCategory (ModuleCat.{u} B))).preimage + (augmentationComparisonOnChains res i₀ hi₀) + +/-- Descent preserves the original comparison, rather than choosing an unrelated map. -/ +theorem augmentationComparison_fac : + whiskerLeft (DerivedBar.chainQ B) (augmentationComparison res i₀ hi₀) = + augmentationComparisonOnChains res i₀ hi₀ := + (Localization.fullyFaithfulWhiskeringLeft (DerivedBar.chainQ B) + (DerivedBar.chainQuasiIso B) (DerivedCategory (ModuleCat.{u} B))).map_preimage _ +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarIteration.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1e9e5ef0c945075f92c40fa7527771ed56700de --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarIteration.lean @@ -0,0 +1,60 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBarComparisonIso + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} B) := + HasDerivedCategory.standard (ModuleCat.{u} B) +variable {P : BiComplex k B} {X : ModuleCat.{u} (Enveloping k B)} +variable (res : AugmentedProjective k B P X) +variable (i₀ : Fin ((res.data.upper-res.data.lower).toNat+1)) (hi₀ : res.data.degrees i₀=0) + +/-- Iteration of the native full-left-action integer derived endofunctor. -/ +def nativeIterate : ℕ → (DerivedCategory (ModuleCat.{u} B) ⥤ DerivedCategory (ModuleCat.{u} B)) + | 0 => 𝟭 _ + | r+1 => nativeIterate r ⋙ res.data.derived + +/-- The augmentation comparison iterates naturally on the genuine localized +chain category. This identifies actual derived functors, not only vector spaces. -/ +def nativeBarIterateIso : (r : ℕ) → + DerivedBar.chainToIntegerDerived B ⋙ nativeIterate res r ≅ + DerivedBar.derivedTensorIterate k B (barModule (X := X)) r ⋙ DerivedBar.chainToIntegerDerived B + | 0 => (Functor.rightUnitor _) ≪≫ (Functor.leftUnitor _).symm + | r+1 => + (Functor.associator _ _ _).symm ≪≫ + isoWhiskerRight (nativeBarIterateIso r) res.data.derived ≪≫ + Functor.associator _ _ _ ≪≫ + isoWhiskerLeft (DerivedBar.derivedTensorIterate k B (barModule (X := X)) r) + (nativeBarIso res i₀ hi₀) ≪≫ + (Functor.associator _ _ _).symm + +/-- The native iterate on an extended chain input is the manuscript's actual +recursive bar total, with the endpoint-minus-tail and signed vertical differentials. -/ +def nativeIterateMultibarIso (Z : ChainComplex (ModuleCat.{u} B) ℕ) (r : ℕ) : + (nativeIterate res r).obj ((DerivedBar.integerQ B).obj Z) ≅ + (DerivedBar.integerQ B).obj (DerivedBar.explicitMultibar k B (barModule (X := X)) r Z) := + (nativeIterate res r).mapIso ((DerivedBar.chainToIntegerDerivedIso B).app Z).symm ≪≫ + (nativeBarIterateIso res i₀ hi₀ r).app ((DerivedBar.chainQ B).obj Z) ≪≫ + (DerivedBar.chainToIntegerDerived B).mapIso + (DerivedBar.derivedIterateMultibarIso k B (barModule (X := X)) Z r) ≪≫ + (DerivedBar.chainToIntegerDerivedIso B).app _ + +/-- On degree-zero modules, the same native derived iteration is represented +by the actual Section 6 indexed multibar with all module actions retained. -/ +def nativeIterateIndexedIso (N : ModuleCat.{u} B) (r : ℕ) : + (nativeIterate res r).obj ((DerivedBar.integerQ B).obj ((ChainComplex.single₀ _).obj N)) ≅ + DerivedCategory.Q.obj ((DerivedBar.integerExtension B).obj + (DerivedBar.RecursiveTotal.indexedMultibar k B (barModule (X := X)) N r)) := + (nativeIterate res r).mapIso + ((DerivedBar.chainToIntegerDerivedIso B).app ((ChainComplex.single₀ _).obj N)).symm ≪≫ + (nativeBarIterateIso res i₀ hi₀ r).app ((DerivedBar.chainQ B).obj ((ChainComplex.single₀ _).obj N)) ≪≫ + DerivedBar.integerDerivedIterateIndexedIso B k (barModule (X := X)) N r +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarResolution.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..87e358468cb75421aed5bf10f6b5da2888403ae6 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarResolution.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Bimodule.BoundedBimoduleDerived +import OAI.Algebra.Finitistic.Bimodule.BimoduleLeftNaturality +import OAI.Algebra.Finitistic.Bar.IntegerDerivedMultibar + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} B) := + HasDerivedCategory.standard (ModuleCat.{u} B) +variable {P : BiComplex k B} (data : BoundedProjective k B P) + +abbrev integerTotalFunctor := DerivedBar.integerExtension B ⋙ + functor k B P data.degrees (intervalDegrees_strictMono data.lower data.upper) ⋙ DerivedCategory.Q + +/-- The original bar augmentation, followed by the fixed finite bimodule total. -/ +def barInputAugmentation : DerivedBar.barTotalFunctor k B ⋙ integerTotalFunctor data ⟶ + integerTotalFunctor data := + Functor.whiskerRight (DerivedBar.barTotalAugmentationNat k B) (integerTotalFunctor data) + +/-- The left leg of the actual comparison zigzag is invertible for every chain input. -/ +instance barInputAugmentation_isIso : IsIso (barInputAugmentation data) := by + rw [NatTrans.isIso_iff_isIso_app] + intro Z + let : ∀ i, Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + let ε := (DerivedBar.integerExtension B).map (DerivedBar.barTotalAugmentation k B Z) + have : QuasiIso ε := inferInstanceAs (QuasiIso + (HomologicalComplex.extendMap (DerivedBar.barTotalAugmentation k B Z) + ComplexShape.embeddingDownNat)) + have := totalMap_quasiIso k B P data.degrees + (intervalDegrees_strictMono data.lower data.upper) ε + exact inferInstanceAs (IsIso (DerivedCategory.Q.map + (totalMap k B P data.degrees (intervalDegrees_strictMono data.lower data.upper) ε))) + +/-- The native derived tensor of the integer extension is computed on its genuine +projective bar resolution, with no hypothesis on the input's terms. -/ +def nativeBarResolutionIso : DerivedBar.integerQ B ⋙ data.derived ≅ + DerivedBar.barTotalFunctor k B ⋙ integerTotalFunctor data := + Functor.associator _ _ _ ≪≫ + Functor.isoWhiskerLeft (DerivedBar.integerExtension B) data.comparison ≪≫ + (asIso (barInputAugmentation data)).symm + +/-- The same comparison written using the native chain-localization inclusion. -/ +def nativeChainBarResolutionIso : + DerivedBar.chainQ B ⋙ (DerivedBar.chainToIntegerDerived B ⋙ data.derived) ≅ + DerivedBar.barTotalFunctor k B ⋙ integerTotalFunctor data := + (Functor.associator _ _ _).symm ≪≫ + Functor.isoWhiskerRight (DerivedBar.chainToIntegerDerivedIso B) data.derived ≪≫ + nativeBarResolutionIso data +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarStalk.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarStalk.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ed889f19d35e313b0ebe2428707223812e9ca55 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarStalk.lean @@ -0,0 +1,56 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBarIteration + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} B) := + HasDerivedCategory.standard (ModuleCat.{u} B) +variable {P : BiComplex k B} {X : ModuleCat.{u} (Enveloping k B)} +variable (res : AugmentedProjective k B P X) + +/-- A support interval containing degree zero supplies the finite-total index; +this is automatic for the ordinary resolution's interval [-length,0]. -/ +def zeroDegreeIndex (hlo : res.data.lower ≤ 0) (hhi : 0 ≤ res.data.upper) : + Fin ((res.data.upper-res.data.lower).toNat+1) := + Classical.choose (intervalDegrees_covers res.data.lower res.data.upper 0 ⟨hlo,hhi⟩) + +theorem zeroDegreeIndex_eq (hlo : res.data.lower ≤ 0) (hhi : 0 ≤ res.data.upper) : + res.data.degrees (zeroDegreeIndex res hlo hhi) = 0 := + Classical.choose_spec (intervalDegrees_covers res.data.lower res.data.upper 0 ⟨hlo,hhi⟩) + +/-- The chain stalk's integer extension is the native integer stalk. -/ +def integerSingleIso (N : ModuleCat.{u} B) : + (DerivedBar.integerQ B).obj ((ChainComplex.single₀ _).obj N) ≅ + DerivedCategory.Q.obj (singleInput B N) := + DerivedCategory.Q.mapIso + (HomologicalComplex.extendSingleIso ComplexShape.embeddingDownNat N 0 0 (by simp)) + +/-- Genuine native iteration on the native integer stalk, identified with the +actual Section 6 indexed multibar. No bar comparison is supplied as a premise. -/ +def nativeStalkIndexedIso (hlo : res.data.lower ≤ 0) (hhi : 0 ≤ res.data.upper) + (N : ModuleCat.{u} B) (r : ℕ) : + (nativeIterate res r).obj (DerivedCategory.Q.obj (singleInput B N)) ≅ + DerivedCategory.Q.obj ((DerivedBar.integerExtension B).obj + (DerivedBar.RecursiveTotal.indexedMultibar k B (barModule (X := X)) N r)) := + (nativeIterate res r).mapIso (integerSingleIso N).symm ≪≫ + nativeIterateIndexedIso res (zeroDegreeIndex res hlo hhi) + (zeroDegreeIndex_eq res hlo hhi) N r + +/-- Functor iteration here is the usual repeated application of the native +integer-derived tensor on objects. -/ +theorem nativeIterate_obj (r : ℕ) (Y : DerivedCategory (ModuleCat.{u} B)) : + (nativeIterate res r).obj Y = (res.data.derived.obj^[r]) Y := by + induction r with + | zero => rfl + | succ r ih => + change res.data.derived.obj ((nativeIterate res r).obj Y) = _ + rw [ih,Function.iterate_succ_apply'] +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarTensorComparison.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarTensorComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e3564ca1f28ea4432e10abeb3dd06a0ef050eaf --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBarTensorComparison.lean @@ -0,0 +1,123 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleInputFunctor +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerived + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleBarComparison +open ExternalTensor.Section4 BimoduleTotal +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (M : ModuleCat.{u} (Enveloping k B)) + +abbrev Actions := BimoduleBalancedTensor.Input k B M +attribute [local instance] BimoduleBalancedTensor.inputEnveloping + +instance outsideModule : Module B (Actions k B M) := + Module.compHom (Actions k B M) (Algebra.TensorProduct.includeLeft : B →ₐ[k] Enveloping k B).toRingHom + +instance outsideComm : SMulCommClass B Bᵐᵒᵖ (Actions k B M) where + smul_comm b r x := by + change ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (((1 : B) ⊗ₜ[k] r) • (x : M))) = + (((1 : B) ⊗ₜ[k] r) • ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (x : M))) + rw [← mul_smul,← mul_smul] + congr 1 + simp only [Algebra.TensorProduct.tmul_mul_tmul,mul_one,one_mul] + +instance outsideTower : IsScalarTower k B (Actions k B M) := + IsScalarTower.of_algebraMap_smul (by + intro c x + change (Algebra.TensorProduct.includeLeft : B →ₐ[k] Enveloping k B) (algebraMap k B c) • (x : M) = + (Algebra.TensorProduct.includeRight : Bᵐᵒᵖ →ₐ[k] Enveloping k B) (algebraMap k Bᵐᵒᵖ c) • (x : M) + rw [AlgHom.commutes,AlgHom.commutes]) + +variable (N : ModuleCat.{u} B) +local instance (N : ModuleCat.{u} B) : Module k N := DerivedBar.BimoduleTensor.scalarModule k B N +local instance (N : ModuleCat.{u} B) : IsScalarTower k B N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +abbrev BarTensor := DerivedBar.BimoduleTensor.tensor k B (Actions k B M) N + +/-- The field-linear balanced universal map to the bar worker's B-linear quotient. -/ +def toBarLinear : InputTensor k B M N →ₗ[k] BarTensor k B M N := + BalancedTensor.lift + ((TensorProduct.mk k (Actions k B M) (BalancedTensor.ScalarLeftModule k B N)).compr₂ + ((DerivedBar.BimoduleTensor.quotient k B (Actions k B M) N).restrictScalars k)) + (by intro b m n; exact DerivedBar.BimoduleTensor.balanced k B (Actions k B M) N m b n) + +/-- This comparison retains the actual outside B-action. -/ +def toBar : InputTensor k B M N →ₗ[B] BarTensor k B M N where + __ := (toBarLinear k B M N).toAddMonoidHom + map_smul' b x := by + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => + change DerivedBar.BimoduleTensor.quotient k B (Actions k B M) N ((b • m) ⊗ₜ[k] n) = + b • DerivedBar.BimoduleTensor.quotient k B (Actions k B M) N (m ⊗ₜ[k] n) + exact (DerivedBar.BimoduleTensor.quotient k B (Actions k B M) N).map_smul b + ((m : Actions k B M) ⊗ₜ[k] (n : N)) + | ha x y hx hy => simp_all [smul_add] + +/-- The reverse unbalanced tensor map is B-linear before passing to the quotient. -/ +def fromBarUnbalanced : Actions k B M ⊗[k] (BalancedTensor.ScalarLeftModule k B N) →ₗ[B] + InputTensor k B M N where + __ := (TensorProduct.lift (BalancedTensor.mk k B (Actions k B M) + (BalancedTensor.ScalarLeftModule k B N))).toAddMonoidHom + map_smul' b x := by + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => simp_all [smul_add] + +def fromBar : BarTensor k B M N →ₗ[B] InputTensor k B M N := + (DerivedBar.BimoduleTensor.relations k B (Actions k B M) N).liftQ + (fromBarUnbalanced k B M N) (by + apply Submodule.span_le.mpr + rintro z ⟨m,b,n,rfl⟩ + change fromBarUnbalanced k B M N ((MulOpposite.op b • m) ⊗ₜ[k] n - m ⊗ₜ[k] (b • n)) = 0 + exact ((fromBarUnbalanced k B M N).map_sub _ _).trans + (sub_eq_zero.mpr (BalancedTensor.balance b m n))) + +/-- The two independently defined balanced quotients are naturally B-linearly isomorphic. -/ +def tensorEquiv : InputTensor k B M N ≃ₗ[B] BarTensor k B M N where + __ := toBar k B M N + invFun := fromBar k B M N + left_inv x := by + change fromBar k B M N (toBar k B M N x) = x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => simp only [map_add,hx,hy] + right_inv x := by + change toBar k B M N (fromBar k B M N x) = x + induction x using Submodule.Quotient.induction_on with + | _ x => + change toBar k B M N (fromBar k B M N + (DerivedBar.BimoduleTensor.quotient k B (Actions k B M) N x)) = + DerivedBar.BimoduleTensor.quotient k B (Actions k B M) N x + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => + exact (((toBar k B M N).comp ((fromBar k B M N).comp + (DerivedBar.BimoduleTensor.quotient k B (Actions k B M) N))).map_add x y).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +/-- Agreement with the exact ordinary bimodule functor used by DerivedBar. -/ +def tensorFunctorIso : inputFunctor k B M ≅ + DerivedBar.BimoduleTensor.tensorFunctor k B (Actions k B M) := + NatIso.ofComponents (fun N => (tensorEquiv k B M N).toModuleIso) (by + intro N N' f + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm)) +end LittleFinitistic.BimoduleBarComparison + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBoundedPresentation.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBoundedPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fe712d861ce418859fec76e57db494ef9f52c07 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleBoundedPresentation.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerivedPresentation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor +namespace LittleFinitistic.BimoduleTotalPresentation +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) + +instance projectiveDegrees {l : ℕ} (p : Fin l → ℤ) + [hproj : ∀ n, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (BimoduleTotal.right k B P) n)] : + ∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (BimoduleTotal.right k B P) (p i)) := + fun i => hproj (p i) + +variable (data : BimoduleTotal.BoundedProjective k B P) (length : ℕ) +local notation "p" => OrdinarySimulation.TensorResolution.finiteDegrees length +local notation "hp" => OrdinarySimulation.TensorResolution.finiteDegrees_strictMono length + +/-- Any native bounded model with these endpoints uses exactly the ordinary finite degree list. -/ +def boundedNonpositiveTotalIso (hlo : data.lower = -(length : ℤ)) (hhi : data.upper = 0) : + BimoduleComplexTensor.totalFunctor k B B P p hp ≅ + BimoduleTotal.functor k B P data.degrees + (BimoduleTotal.intervalDegrees_strictMono data.lower data.upper) := by + dsimp only [BimoduleTotal.BoundedProjective.degrees] + rw [hlo, hhi] + exact nonpositiveTotalFunctorIso k B P length + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [hproj : ∀ n, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (BimoduleTotal.right k B P) n)] + +/-- Generic bridge for a shifted P as well as Q_X. No augmentation or target module +is needed to compare two presentations of the very same bounded complex. -/ +def boundedNonpositiveDerivedIso (hlo : data.lower = -(length : ℤ)) (hhi : data.upper = 0) : + BimoduleComplexTensor.derivedTotal k B B P p hp ≅ data.derived := + (Localization.fullyFaithfulWhiskeringLeft (DerivedCategory.Q (C := ModuleCat.{u} B)) + (HomologicalComplex.quasiIso (ModuleCat.{u} B) (.up ℤ)) + (DerivedCategory (ModuleCat.{u} B))).preimageIso + (BimoduleComplexTensor.derivedTotalComparison k B B P p hp ≪≫ + isoWhiskerRight (boundedNonpositiveTotalIso k B P data length hlo hhi) DerivedCategory.Q ≪≫ + data.comparison.symm) + +/-- Exact localization compatibility for the generic bounded model. -/ +theorem boundedNonpositiveDerivedIso_comparison (hlo : data.lower = -(length : ℤ)) (hhi : data.upper = 0) : + whiskerLeft DerivedCategory.Q (boundedNonpositiveDerivedIso k B P data length hlo hhi).hom ≫ + data.comparison.hom = + (BimoduleComplexTensor.derivedTotalComparison k B B P p hp).hom ≫ + whiskerRight (boundedNonpositiveTotalIso k B P data length hlo hhi).hom DerivedCategory.Q := by + have h := (Localization.fullyFaithfulWhiskeringLeft + (DerivedCategory.Q (C := ModuleCat.{u} B)) + (HomologicalComplex.quasiIso (ModuleCat.{u} B) (.up ℤ)) + (DerivedCategory (ModuleCat.{u} B))).map_preimage + ((BimoduleComplexTensor.derivedTotalComparison k B B P p hp ≪≫ + isoWhiskerRight (boundedNonpositiveTotalIso k B P data length hlo hhi) DerivedCategory.Q ≪≫ + data.comparison.symm).hom) + change whiskerLeft DerivedCategory.Q + (boundedNonpositiveDerivedIso k B P data length hlo hhi).hom = _ at h + rw [h] + simp + +/-- A natural endofunctor comparison identifies every actual object-function iterate. -/ +def powerObjIso {C : Type*} [Category C] {F G : C ⥤ C} (e : F ≅ G) : + (r : ℕ) → (Y : C) → (F.obj^[r]) Y ≅ (G.obj^[r]) Y + | 0, Y => Iso.refl Y + | r+1, Y => by + rw [Function.iterate_succ_apply', Function.iterate_succ_apply'] + exact e.app _ ≪≫ G.mapIso (powerObjIso e r Y) + +/-- Direct iterate transport for any same-complex bounded model on [-length,0]. -/ +def boundedNonpositivePowerIso (hlo : data.lower = -(length : ℤ)) (hhi : data.upper = 0) + (r : ℕ) (Y : DerivedCategory (ModuleCat.{u} B)) : + ((BimoduleComplexTensor.derivedTotal k B B P p hp).obj^[r]) Y ≅ + (data.derived.obj^[r]) Y := + powerObjIso (boundedNonpositiveDerivedIso k B P data length hlo hhi) r Y +end LittleFinitistic.BimoduleTotalPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleComparison.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..60373cc1db3bea2c37202244bca98f1fb06f8509 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleComparison.lean @@ -0,0 +1,83 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBar +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerived + +namespace OAI +open CategoryTheory +noncomputable section + +namespace DerivedBar.BimoduleTensor +universe u +variable (k D X : 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] + +/-- Canonical scalar restriction agrees with every supplied compatible field action. -/ +theorem scalarModule_eq (V : Type u) [AddCommGroup V] [Module k V] + [Module D V] [IsScalarTower k D V] : + scalarModule k D (ModuleCat.of D V) = (inferInstance : Module k V) := by + apply Module.ext + funext c v + exact IsScalarTower.algebraMap_smul D c v + +/-- Coherence between the categorical tensor functor and the literal balancing quotient. -/ +def tensorFunctorObjIso (V : Type u) [AddCommGroup V] [Module k V] + [Module D V] [IsScalarTower k D V] : + (tensorFunctor k D X).obj (ModuleCat.of D V) ≅ ModuleCat.of D (tensor k D X V) := by + have h := scalarModule_eq k D V + cases h + exact Iso.refl _ + +omit [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] in +/-- The scalar-action coherence is natural for every D-linear map. -/ +theorem tensorFunctorObjIso_natural (V W : Type u) + [AddCommGroup V] [Module k V] [Module D V] [IsScalarTower k D V] + [AddCommGroup W] [Module k W] [Module D W] [IsScalarTower k D W] + (h : V →ₗ[D] W) : + (tensorFunctor k D X).map (ModuleCat.ofHom h) ≫ (tensorFunctorObjIso k D X W).hom = + (tensorFunctorObjIso k D X V).hom ≫ ModuleCat.ofHom (map k D X V W h) := by + have hV := scalarModule_eq k D V + have hW := scalarModule_eq k D W + cases hV + cases hW + rfl + +local instance (V : ModuleCat.{u} D) : Module k V := scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +/-- The categorical derived-resolution model and the explicit balanced bar complex agree. -/ +def resolvedTensorIso (N : ModuleCat.{u} D) : + resolvedTensor k D X N ≅ tensorResolution k D X N := + HomologicalComplex.Hom.isoOfComponents + (fun n => tensorFunctorObjIso k D X (DerivedBar.term k D N (n+1))) + (by + intro i j hij + change j+1 = i at hij + subst i + simpa only [tensorResolution, resolvedTensor, DerivedBar.projectiveResolution, + DerivedBar.complex, ChainComplex.of_d, Functor.mapHomologicalComplex_obj_d] using (tensorFunctorObjIso_natural k D X (DerivedBar.term k D N (j+1+1)) + (DerivedBar.term k D N (j+1)) (DerivedBar.differential k D N (j+1))).symm) + +/-- The literal arbitrary-bimodule two-sided bar computes genuine derived tensor of a module. +There is no flatness assumption or ordinary tensor-power replacement. -/ +def explicitBarComputesDerivedTensor (N : ModuleCat.{u} D) : + (tensorFunctor k D X).leftDerivedToHomotopyCategory.obj N ≅ + (HomotopyCategory.quotient (ModuleCat.{u} D) (ComplexShape.down ℕ)).obj + (barComplex k D X N) := + barComputesDerivedTensor k D X N ≪≫ + (HomotopyCategory.quotient (ModuleCat.{u} D) (ComplexShape.down ℕ)).mapIso + (resolvedTensorIso k D X N ≪≫ tensorResolutionIso k D X N) + +/-- Actual left-derived tensor homology (Tor), computed by the explicit two-sided bar. -/ +def barHomologyIso (N : ModuleCat.{u} D) (i : ℕ) : + ((tensorFunctor k D X).leftDerived i).obj N ≅ + (HomologicalComplex.homologyFunctor (ModuleCat.{u} D) (ComplexShape.down ℕ) i).obj + (barComplex k D X N) := + (DerivedBar.projectiveResolution k D N).isoLeftDerivedObj (tensorFunctor k D X) i ≪≫ + (HomologicalComplex.homologyFunctor (ModuleCat.{u} D) (ComplexShape.down ℕ) i).mapIso + (resolvedTensorIso k D X N ≪≫ tensorResolutionIso k D X N) +end DerivedBar.BimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerived.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerived.lean new file mode 100644 index 0000000000000000000000000000000000000000..61b476fa2b04e6edf9501187ea9b3ac6b8b4db98 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerived.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensor +import Mathlib.CategoryTheory.Abelian.LeftDerived + +namespace OAI +open CategoryTheory +noncomputable section + +namespace DerivedBar.BimoduleTensor +universe u +variable (k D X : 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] + +/-- The canonical field action on a left D-module. -/ +@[instance_reducible] def scalarModule (V : ModuleCat.{u} D) : Module k V := Module.compHom V (algebraMap k D) + +local instance (V : ModuleCat.{u} D) : Module k V := scalarModule k D V +local instance (V : ModuleCat.{u} D) : IsScalarTower k D V := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +/-- Actual balanced tensor by the arbitrary bimodule X, as an additive endofunctor. -/ +def tensorFunctor : ModuleCat.{u} D ⥤ ModuleCat.{u} D where + obj V := ModuleCat.of D (tensor k D X V) + map h := ModuleCat.ofHom (map k D X _ _ h.hom) + map_id V := ModuleCat.hom_ext (map_id k D X V) + map_comp h g := ModuleCat.hom_ext (map_comp k D X _ _ _ h.hom g.hom) + +instance tensorFunctor_additive : (tensorFunctor k D X).Additive where + map_add := by + intro V W h g + exact ModuleCat.hom_ext (map_add k D X _ _ h.hom g.hom) + +/-- Tensor of X with the verified absolute bar projective resolution. +This construction applies the genuine balanced functor to every differential. -/ +def resolvedTensor (N : ModuleCat.{u} D) : ChainComplex (ModuleCat.{u} D) ℕ := + ((tensorFunctor k D X).mapHomologicalComplex (ComplexShape.down ℕ)).obj + (DerivedBar.projectiveResolution k D N).complex + +/-- The explicit projective bar resolution computes actual derived tensor on modules, +via mathlib's left derived functor to the homotopy category. +Extension to bounded-above complexes and repeated totalization remains separate. -/ +def barComputesDerivedTensor (N : ModuleCat.{u} D) : + (tensorFunctor k D X).leftDerivedToHomotopyCategory.obj N ≅ + (HomotopyCategory.quotient (ModuleCat.{u} D) (ComplexShape.down ℕ)).obj + (resolvedTensor k D X N) := + (DerivedBar.projectiveResolution k D N).isoLeftDerivedToHomotopyCategoryObj + (tensorFunctor k D X) +end DerivedBar.BimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedFunctor.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..34d27f128eee4bd43c1a33424fc4c77fa86ef31d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedFunctor.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalUnderlying +import Mathlib.CategoryTheory.Localization.Preadditive + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (p i))] + +/-- Every quasi-isomorphism becomes invertible after applying the actual B-valued total. -/ +theorem inverts : (HomologicalComplex.quasiIso (ModuleCat.{u} B) (.up ℤ)).IsInvertedBy + (functor k B P p hp ⋙ DerivedCategory.Q) := by + intro Z Z' f hf + let : QuasiIso f := hf + let := totalMap_quasiIso k B P p hp f + exact (inferInstance : IsIso (DerivedCategory.Q.map (totalMap k B P p hp f))) + +/-- The actual fixed bimodule tensor total descends to the native derived category of B-modules. -/ +def derived : DerivedCategory (ModuleCat.{u} B) ⥤ DerivedCategory (ModuleCat.{u} B) := + Localization.lift (functor k B P p hp ⋙ DerivedCategory.Q) + (inverts k B P p hp) DerivedCategory.Q + +/-- This derived endofunctor is computed by the signed tensor total on every input complex. -/ +def derivedComparison : DerivedCategory.Q ⋙ derived k B P p hp ≅ + functor k B P p hp ⋙ DerivedCategory.Q := + Localization.fac (functor k B P p hp ⋙ DerivedCategory.Q) + (inverts k B P p hp) DerivedCategory.Q + +instance derived_additive : (derived k B P p hp).Additive := by + rw [Localization.functor_additive_iff DerivedCategory.Qh + (HomotopyCategory.subcategoryAcyclic (ModuleCat.{u} B)).trW] + let e : HomotopyCategory.quotient (ModuleCat.{u} B) (.up ℤ) ⋙ + (DerivedCategory.Qh ⋙ derived k B P p hp) ≅ + functor k B P p hp ⋙ DerivedCategory.Q := + (Functor.associator _ _ _).symm ≪≫ + Functor.isoWhiskerRight (DerivedCategory.quotientCompQhIso (ModuleCat.{u} B)) _ ≪≫ + derivedComparison k B P p hp + let := Functor.additive_of_iso e.symm + exact Functor.additive_of_full_essSurj_comp + (HomotopyCategory.quotient (ModuleCat.{u} B) (.up ℤ)) _ +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedInterval.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedInterval.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0f354caf463117fc5eb565cac2682d32789f881 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedInterval.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerivedFunctor +import OAI.Algebra.Finitistic.Rectification.InducedRectification + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u + +/-- A finite interval of actual right-complex degrees, including both endpoints. -/ +def intervalDegrees (lo hi : ℤ) (i : Fin ((hi-lo).toNat+1)) : ℤ := lo + i.val + +theorem intervalDegrees_strictMono (lo hi : ℤ) : StrictMono (intervalDegrees lo hi) := by + intro i j hij + change lo + (i.val : ℤ) < lo + (j.val : ℤ) + change i.val < j.val at hij + omega + +/-- Every degree in the support interval really occurs in the finite total. -/ +theorem intervalDegrees_covers (lo hi n : ℤ) (hn : lo ≤ n ∧ n ≤ hi) : + ∃ i, intervalDegrees lo hi i = n := by + refine ⟨⟨(n-lo).toNat,by omega⟩,?_⟩ + dsimp [intervalDegrees] + omega + +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable (P : BiComplex k B) +variable [∀ n, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) n)] + +/-- The native B-valued derived tensor total on a chosen support interval. -/ +abbrev derivedInterval (lo hi : ℤ) := + derived k B P (intervalDegrees lo hi) (intervalDegrees_strictMono lo hi) + +omit [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + [∀ n, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) n)] in +/-- Boundedness ensures this finite total contains every nonzero right degree. -/ +theorem outside_interval_isZero (lo hi : ℤ) + (hP : ∀ n, n < lo ∨ hi < n → IsZero (P.X n)) (n : ℤ) + (hn : ∀ i, intervalDegrees lo hi i ≠ n) : IsZero (P.X n) := by + apply hP n + by_contra h + have hbounds : lo ≤ n ∧ n ≤ hi := by omega + obtain ⟨i,hi⟩ := intervalDegrees_covers lo hi n hbounds + exact hn i hi +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedPresentation.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..378017d98e84f2798c424ce5c89f7dc0805f70f0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedPresentation.lean @@ -0,0 +1,94 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalPresentation +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleDerivedTensor +import OAI.Algebra.Finitistic.Bimodule.BoundedBimoduleDerived + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor +namespace LittleFinitistic.BimoduleTotalPresentation + +section +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (BimoduleTotal.right k B P) (p i))] + +/-- The coefficient presentations have exactly the same right module structure. -/ +instance ordinaryProjective : ∀ i, Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (BimoduleComplexTensor.rightComplex k B B P) (p i)) := + fun i => inferInstanceAs (Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (BimoduleTotal.right k B P) (p i))) + +/-- The already proved chain comparison descends through the actual localization. -/ +def derivedIso : BimoduleComplexTensor.derivedTotal k B B P p hp ≅ + BimoduleTotal.derived k B P p hp := + (Localization.fullyFaithfulWhiskeringLeft (DerivedCategory.Q (C := ModuleCat.{u} B)) + (HomologicalComplex.quasiIso (ModuleCat.{u} B) (.up ℤ)) + (DerivedCategory (ModuleCat.{u} B))).preimageIso + (BimoduleComplexTensor.derivedTotalComparison k B B P p hp ≪≫ + Functor.isoWhiskerRight (totalFunctorIso k B P p hp) DerivedCategory.Q ≪≫ + (BimoduleTotal.derivedComparison k B P p hp).symm) + +/-- Exact compatibility with the two localization comparison maps. -/ +theorem derivedIso_comparison : + whiskerLeft DerivedCategory.Q (derivedIso k B P p hp).hom ≫ + (BimoduleTotal.derivedComparison k B P p hp).hom = + (BimoduleComplexTensor.derivedTotalComparison k B B P p hp).hom ≫ + whiskerRight (totalFunctorIso k B P p hp).hom DerivedCategory.Q := by + have h := (Localization.fullyFaithfulWhiskeringLeft + (DerivedCategory.Q (C := ModuleCat.{u} B)) + (HomologicalComplex.quasiIso (ModuleCat.{u} B) (.up ℤ)) + (DerivedCategory (ModuleCat.{u} B))).map_preimage + ((BimoduleComplexTensor.derivedTotalComparison k B B P p hp ≪≫ + Functor.isoWhiskerRight (totalFunctorIso k B P p hp) DerivedCategory.Q ≪≫ + (BimoduleTotal.derivedComparison k B P p hp).symm).hom) + change whiskerLeft DerivedCategory.Q (derivedIso k B P p hp).hom = _ at h + rw [h] + simp +end + +open CategoryTheory ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) + +/-- Transport only the finite indexing type; every degree and both signed maps are unchanged. -/ +def enumerationIso {l l' : ℕ} (p : Fin l → ℤ) (q : Fin l' → ℤ) + (hp : StrictMono p) (hq : StrictMono q) (hl : l = l') + (he : ∀ i, p i = q (Fin.cast hl i)) : + BimoduleTotal.functor k B P p hp ≅ BimoduleTotal.functor k B P q hq := by + subst l' + have h : p = q := by funext i; exact he i + subst q + exact Iso.refl _ + +/-- Exact comparison of the ordinary resolution's finite list with the native interval. -/ +def nonpositiveTotalFunctorIso (length : ℕ) : + BimoduleComplexTensor.totalFunctor k B B P + (OrdinarySimulation.TensorResolution.finiteDegrees length) + (OrdinarySimulation.TensorResolution.finiteDegrees_strictMono length) ≅ + BimoduleTotal.functor k B P (BimoduleTotal.intervalDegrees (-(length : ℤ)) 0) + (BimoduleTotal.intervalDegrees_strictMono (-(length : ℤ)) 0) := + totalFunctorIso k B P _ _ ≪≫ enumerationIso k B P _ _ _ _ (by omega) (by intro i; rfl) + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable (data : BimoduleTotal.BoundedProjective k B P) + +/-- The comparison for exactly the same bounded Q and its chosen interval. -/ +def boundedDerivedIso : + (letI : ∀ i, Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (BimoduleTotal.right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + BimoduleComplexTensor.derivedTotal k B B P data.degrees + (BimoduleTotal.intervalDegrees_strictMono data.lower data.upper)) ≅ data.derived := by + letI : ∀ i, Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (BimoduleTotal.right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + exact derivedIso k B P data.degrees _ +end LittleFinitistic.BimoduleTotalPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedShift.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..91227a4e923f4cc4b64c1ce4ab6825e11c36f3f3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleDerivedShift.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleShiftCoherence +import OAI.Algebra.Finitistic.Localization.NativeBoundedDerived +import Mathlib.CategoryTheory.Shift.Localization + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +section Finite +variable (P : BiComplex k B) {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (p i))] + +/-- The proved total-complex shift structure descends through the native derived localization. -/ +instance derived_commShift : (derived k B P p hp).CommShift ℤ := by + letI : Localization.Lifting DerivedCategory.Q + (HomologicalComplex.quasiIso (ModuleCat.{u} B) (.up ℤ)) + (functor k B P p hp ⋙ DerivedCategory.Q) (derived k B P p hp) := + ⟨derivedComparison k B P p hp⟩ + exact Functor.commShiftOfLocalization DerivedCategory.Q + (HomologicalComplex.quasiIso (ModuleCat.{u} B) (.up ℤ)) ℤ + (functor k B P p hp ⋙ DerivedCategory.Q) (derived k B P p hp) +end Finite + +namespace BoundedProjective +variable {k B} {P : BiComplex k B} (data : BoundedProjective k B P) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + +instance commShift : data.derived.CommShift ℤ := by + letI : ∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + exact BimoduleTotal.derived_commShift k B P data.degrees + (intervalDegrees_strictMono data.lower data.upper) + +/-- Full left B-valued derived tensor commutes with every integer shift. -/ +def shiftComparison (s : ℤ) : shiftFunctor _ s ⋙ data.derived ≅ data.derived ⋙ shiftFunctor _ s := + data.derived.commShiftIso s +end BoundedProjective +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleExactRows.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleExactRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e83667c72d3602439340b92ae578a23897c25be --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleExactRows.lean @@ -0,0 +1,64 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedProjectiveLeft +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalDifferential +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorAcross + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- The cross-variable tensor map with an identity input is the original bimodule map. -/ +theorem tensorAcross_right_id {M M' : ModuleCat.{u} (Enveloping k B)} + (f : M ⟶ M') (N : ModuleCat.{u} B) : + tensorAcross f (𝟙 N) = BimoduleBalancedTensor.map k B (BalancedTensor.ScalarLeftModule k B N) f := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +variable (k B) (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) +variable (hP : P.Acyclic) [∀ q, Projective (Z.X q)] + +include hP in +/-- Every row of an acyclic bimodule complex tensored with a projective input term is exact. -/ +theorem row_exact (a q : ℤ) : + Function.Exact (tensorAcross (P.d (a-1) a) (𝟙 (Z.X q))) + (tensorAcross (P.d a (a+1)) (𝟙 (Z.X q))) := by + let : Module.Projective B (BalancedTensor.ScalarLeftModule k B (Z.X q)) := + inferInstanceAs (Module.Projective B (Z.X q)) + let S := ShortComplex.mk (P.d (a-1) a) (P.d a (a+1)) (P.d_comp_d (a-1) a (a+1)) + have hs : S.Exact := + (HomologicalComplex.exactAt_iff' P (a-1) a (a+1) (by simp) (by simp)).mp (hP a) + have ht := BimoduleBalancedTensor.projectiveInput_mapsExact k B + (BalancedTensor.ScalarLeftModule k B (Z.X q)) S hs + rw [tensorAcross_right_id,tensorAcross_right_id] + exact (ShortComplex.ShortExact.moduleCat_exact_iff_function_exact _).mp ht + +include hP in +/-- The row exactness statement with precisely the transports occurring in the signed total. -/ +theorem horizontal_exact (n a : ℤ) : + Function.Exact + (horizontalBetween k B P Z (n-1) n (a-1) a (by omega) (by omega)) + (horizontalBetween k B P Z n (n+1) a (a+1) rfl rfl) := by + have ht := row_exact k B P Z hP a (n + -a) + have transport (q₀ q₂ : ℤ) (h₀ : q₀ = n + -a) (h₂ : n + -a = q₂) : + Function.Exact + (tensorAcross (P.d (a-1) a) (eqToHom (congrArg Z.X h₀))) + (tensorAcross (P.d a (a+1)) (eqToHom (congrArg Z.X h₂))) := by + subst q₀ q₂ + exact ht + unfold horizontalBetween + rw [← tensorAcross_eq_termMap,← tensorAcross_eq_termMap] + exact transport ((n-1) + -(a-1)) ((n+1) + -(a+1)) (by omega) (by omega) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleFiniteRowsAcyclic.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleFiniteRowsAcyclic.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6a4296b08117a073e16e75919c877864a487e8e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleFiniteRowsAcyclic.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalInsertion +import OAI.Algebra.Finitistic.Bimodule.BimoduleExactRows + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable (hP : ∀ a, (∀ i, p i ≠ a) → IsZero (P.X a)) +variable (hacyc : P.Acyclic) [∀ q, Projective (Z.X q)] + +include hP in +omit [∀ q, Projective (Z.X q)] in +/-- A closed total element whose higher coordinates vanish is closed in the next row. -/ +theorem closed_horizontal (n a : ℤ) (x : TotalTerm k B P p Z n) + (hx : ((total k B P p hp Z).d n (n+1)).hom x = 0) + (hhigh : coefficient k B P Z p n (a+1) x = 0) : + horizontalBetween k B P Z n (n+1) a (a+1) rfl rfl + (coefficient k B P Z p n a x) = 0 := by + have hc := congrArg (coefficient k B P Z p (n+1) (a+1)) hx + erw [coefficient_d k B P Z p hp hP,hhigh,map_zero,zero_add,map_zero] at hc + have transfer (b : ℤ) (hb : b=a) (hba : b+1=a+1) : + horizontalBetween k B P Z n (n+1) b (a+1) rfl hba + (coefficient k B P Z p n b x) = + horizontalBetween k B P Z n (n+1) a (a+1) rfl rfl + (coefficient k B P Z p n a x) := by + subst b + rfl + rw [transfer (a+1-1) (by omega) (by omega)] at hc + exact hc + +include hP hacyc in +/-- Row-by-row elimination gives an actual preimage for every closed finite-total element. -/ +theorem total_exact_of_rows (lo hi n : ℤ) (hlo : ∀ i, lo ≤ p i) (hhi : ∀ i, p i ≤ hi) : + Function.Exact ((total k B P p hp Z).d (n-1) n).hom + ((total k B P p hp Z).d n (n+1)).hom := by + intro z + constructor + · intro hz + let d := ((total k B P p hp Z).d (n-1) n).hom + let e := ((total k B P p hp Z).d n (n+1)).hom + have ed (w : TotalTerm k B P p Z (n-1)) : e (d w) = 0 := + congrArg (fun f => f.hom w) ((total k B P p hp Z).d_comp_d (n-1) n (n+1)) + have step (j : ℕ) : ∃ w : TotalTerm k B P p Z (n-1), + ∀ b : ℤ, hi+1-(j : ℤ) ≤ b → coefficient k B P Z p n b (z-d w) = 0 := by + induction j with + | zero => + refine ⟨0, ?_⟩ + intro b hb + erw [map_zero,sub_zero,coefficient_outside k B P Z p n b (by + intro i heq + have := hhi i + omega),LinearMap.zero_apply] + | succ j ih => + obtain ⟨w,hw⟩ := ih + let a : ℤ := hi-(j : ℤ) + let x := z-d w + have hx : e x = 0 := by + dsimp [x] + rw [map_sub,hz,ed,sub_self] + have hxhigh : coefficient k B P Z p n (a+1) x = 0 := hw (a+1) (by dsimp [a]; omega) + have hc := closed_horizontal k B P Z p hp hP n a x hx hxhigh + obtain ⟨y,hy⟩ := (horizontal_exact k B P Z hacyc n a _).mp hc + let v := insertion k B P Z p (n-1) (a-1) y + have hv : coefficient k B P Z p n a (d v) = coefficient k B P Z p n a x := by + exact (coefficient_d_insertion_next k B P Z p hp hP (n-1) n (by omega) + (a-1) a (by omega) y).trans hy + refine ⟨w+v, ?_⟩ + intro b hb + have hba : a ≤ b := by dsimp [a] at *; omega + have hr : coefficient k B P Z p n b (z-d (w+v)) = + coefficient k B P Z p n b x - coefficient k B P Z p n b (d v) := by + dsimp [x] + erw [map_add,map_sub,map_sub,map_add] + abel + rw [hr] + by_cases hbeq : b=a + · subst b + rw [hv,sub_self] + · have hbgt : a < b := lt_of_le_of_ne hba (Ne.symm hbeq) + have hx0 := hw b (by dsimp [a] at *; omega) + have hv0 : coefficient k B P Z p n b (d v) = 0 := + coefficient_d_insertion_above k B P Z p hp hP (n-1) n (by omega) (a-1) b (by omega) y + rw [hx0,hv0,sub_self] + obtain ⟨w,hw⟩ := step ((hi-lo).toNat+1) + refine ⟨w, ?_⟩ + funext i + have hwi := hw (p i) (by have := hlo i; omega) + erw [coefficient_at k B P Z p hp] at hwi + exact (sub_eq_zero.mp hwi).symm + · rintro ⟨w,rfl⟩ + exact congrArg (fun f => f.hom w) ((total k B P p hp Z).d_comp_d (n-1) n (n+1)) + +include hP hacyc in +/-- A bounded acyclic bimodule complex tensors to an acyclic finite total with +any complex of projective left modules. The full outside B-action is retained. -/ +theorem total_acyclic_of_rows (lo hi : ℤ) (hlo : ∀ i, lo ≤ p i) (hhi : ∀ i, p i ≤ hi) : + (total k B P p hp Z).Acyclic := by + intro n + apply (HomologicalComplex.exactAt_iff' _ (n-1) n (n+1) (by simp) (by simp)).mpr + exact (ShortComplex.ShortExact.moduleCat_exact_iff_function_exact _).mpr + (total_exact_of_rows k B P Z p hp hP hacyc lo hi n hlo hhi) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleInputFunctor.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleInputFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..5cbda2206efb1041a6d824664f1ce9234dd0be8d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleInputFunctor.lean @@ -0,0 +1,75 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalTerms + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (M : ModuleCat.{u} (Enveloping k B)) + +abbrev InputTensor (N : ModuleCat.{u} B) := + BimoduleBalancedTensor.Tensor k B M (BalancedTensor.ScalarLeftModule k B N) + +def inputModuleMap {N N' : ModuleCat.{u} B} (f : N ⟶ N') : + InputTensor k B M N →ₗ[B] InputTensor k B M N' where + __ := (@BalancedTensor.mapRightTo k B (BimoduleBalancedTensor.Input k B M) + (BalancedTensor.ScalarLeftModule k B N) (BalancedTensor.ScalarLeftModule k B N') + _ _ _ _ _ _ _ _ _ (BalancedTensor.scalarLeftTower k B N) + _ _ _ (BalancedTensor.scalarLeftTower k B N') f.hom).toAddMonoidHom + map_smul' b x := by + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => simp_all [smul_add] + +/-- Tensor by one genuine bimodule, varying the left-module input and retaining the outside action. -/ +def inputFunctor : ModuleCat.{u} B ⥤ ModuleCat.{u} B where + obj N := ModuleCat.of B (InputTensor k B M N) + map f := ModuleCat.ofHom (inputModuleMap k B M f) + map_id N := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + map_comp f g := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +instance inputFunctor_additive : (inputFunctor k B M).Additive where + map_add {N N'} {f g} := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m n => exact (BalancedTensor.mk k B _ _ m).map_add _ _ + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +abbrev columnFunctor (P : BiComplex k B) (p : ℤ) : + CochainComplex (ModuleCat.{u} B) ℤ ⥤ CochainComplex (ModuleCat.{u} B) ℤ := + (inputFunctor k B (P.X p)).mapHomologicalComplex (.up ℤ) ⋙ shiftFunctor _ (-p) + +instance columnFunctor_additive (P : BiComplex k B) (p : ℤ) : + (columnFunctor k B P p).Additive := by unfold columnFunctor; infer_instance + +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleInputNaturality.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleInputNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..506c336f5bd44a1fcd2d1a9e5210e5a86179c1ea --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleInputNaturality.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleInputFunctor +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalTermMaps + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +/-- The canonical maps in the two tensor variables commute, preserving the full outside action. -/ +theorem input_tensor_square {M M' : ModuleCat.{u} (Enveloping k B)} + {N N' : ModuleCat.{u} B} (f : M ⟶ M') (g : N ⟶ N') : + (inputFunctor k B M).map g ≫ + (BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N')).map f = + (BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N)).map f ≫ + (inputFunctor k B M').map g := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +variable {P : BiComplex k B} {Z Z' : CochainComplex (ModuleCat.{u} B) ℤ} +variable {a b q r : ℤ} + +theorem termMap_decompose (f : P.X a ⟶ P.X b) (g : Z.X q ⟶ Z'.X r) : + ModuleCat.ofHom (termMap f g) = + (inputFunctor k B (P.X a)).map g ≫ + (BimoduleBalancedTensor.functor k B (ComplexTensor.leftTerm k B Z' r)).map f := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleLeftNaturality.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleLeftNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ce3be9acaa82a25599fe08dcf07a83762f57305 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleLeftNaturality.lean @@ -0,0 +1,93 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleLeftTotalMap + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {P P' P'' : BiComplex k B} +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable {Z Z' : CochainComplex (ModuleCat.{u} B) ℤ} + +/-- Naturality of the actual bimodule-induced tensor map on arbitrary complexes. -/ +theorem leftTotalMap_naturality (f : P ⟶ P') (g : Z ⟶ Z') : + totalMap k B P p hp g ≫ leftTotalMap f Z' p hp = + leftTotalMap f Z p hp ≫ totalMap k B P' p hp g := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext i + change leftTermMap f Z' (p i) (n + -(p i)) + (((ComplexTensor.finiteTotalMap k B (right k B P) p hp g).f n).hom x i) = + ((ComplexTensor.finiteTotalMap k B (right k B P') p hp g).f n).hom + (leftTotalMapF f Z p n x) i + erw [ComplexTensor.finiteTotalMap_apply,ComplexTensor.finiteTotalMap_apply] + change leftTermMap f Z' (p i) (n + -(p i)) + (ComplexTensor.inputMap k B (right k B P) g (p i) (n + -(p i)) (x i)) = + ComplexTensor.inputMap k B (right k B P') g (p i) (n + -(p i)) + (leftTermMap f Z (p i) (n + -(p i)) (x i)) + let L := (leftTermMap f Z' (p i) (n + -(p i))).toAddMonoidHom.comp + (ComplexTensor.inputMap k B (right k B P) g (p i) (n + -(p i))).toAddMonoidHom + let R := (ComplexTensor.inputMap k B (right k B P') g (p i) (n + -(p i))).toAddMonoidHom.comp + (leftTermMap f Z (p i) (n + -(p i))).toAddMonoidHom + induction x i using BalancedTensor.induction_on with + | hz => exact L.map_zero.trans R.map_zero.symm + | ht m n => rfl + | ha x y hx hy => + exact (L.map_add x y).trans + ((congrArg₂ (· + ·) hx hy).trans (R.map_add x y).symm) + +/-- An augmentation of bimodule complexes induces this concrete natural transformation. -/ +def leftTensorNat (f : P ⟶ P') : functor k B P p hp ⟶ functor k B P' p hp where + app Z := leftTotalMap f Z p hp + naturality {_ _} g := leftTotalMap_naturality p hp f g + +@[simp] theorem leftTotalMap_id (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + leftTotalMap (𝟙 P) Z p hp = 𝟙 _ := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext i + change tensorAcross (𝟙 (P.X (p i))) (𝟙 (Z.X (n + -(p i)))) (x i) = x i + rw [tensorAcross_id,LinearMap.id_apply] + +@[simp] theorem leftTotalMap_comp (f : P ⟶ P') (g : P' ⟶ P'') + (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + leftTotalMap (f ≫ g) Z p hp = leftTotalMap f Z p hp ≫ leftTotalMap g Z p hp := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext i + change tensorAcross ((f.f (p i)) ≫ g.f (p i)) (𝟙 (Z.X (n + -(p i)))) (x i) = + tensorAcross (g.f (p i)) (𝟙 (Z.X (n + -(p i)))) + (tensorAcross (f.f (p i)) (𝟙 (Z.X (n + -(p i)))) (x i)) + have h := LinearMap.congr_fun (tensorAcross_comp (f.f (p i)) (g.f (p i)) + (𝟙 (Z.X (n + -(p i)))) (𝟙 (Z.X (n + -(p i))))) (x i) + simpa only [Category.id_comp,LinearMap.comp_apply] using h.symm + +/-- The finite signed total is functorial in the genuine bimodule complex too. -/ +def leftTensorFunctor : BiComplex k B ⥤ + (CochainComplex (ModuleCat.{u} B) ℤ ⥤ CochainComplex (ModuleCat.{u} B) ℤ) where + obj P := functor k B P p hp + map f := leftTensorNat p hp f + map_id P := by + apply NatTrans.ext + funext Z + exact leftTotalMap_id p hp Z + map_comp f g := by + apply NatTrans.ext + funext Z + exact leftTotalMap_comp p hp f g Z +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleLeftTotalMap.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleLeftTotalMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..4537f7ef1b5a53be1f0a3d6935581e4e4b11d542 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleLeftTotalMap.lean @@ -0,0 +1,92 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorAcross +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalDifferential + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {P P' P'' : BiComplex k B} (f : P ⟶ P') +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +/-- The actual tensor map induced by a bimodule-complex morphism in each bidegree. -/ +def leftTermMap (a q : ℤ) : Term k B P Z a q →ₗ[B] Term k B P' Z a q := + tensorAcross (f.f a) (𝟙 (Z.X q)) + +theorem leftTermMap_horizontal (n m a b : ℤ) (h : n+1=m) (hab : a+1=b) : + (leftTermMap f Z b (m + -b)).comp (horizontalBetween k B P Z n m a b h hab) = + (horizontalBetween k B P' Z n m a b h hab).comp (leftTermMap f Z a (n + -a)) := by + unfold horizontalBetween leftTermMap + rw [← tensorAcross_eq_termMap, ← tensorAcross_eq_termMap, + tensorAcross_comp,tensorAcross_comp] + simp only [Category.comp_id,Category.id_comp] + rw [f.comm] + +theorem leftTermMap_entry (n m a b : ℤ) (h : n+1=m) : + (leftTermMap f Z b (m + -b)).comp (entryBetween k B P Z n m a b h) = + (entryBetween k B P' Z n m a b h).comp (leftTermMap f Z a (n + -a)) := by + unfold entryBetween + split_ifs with hab + · exact leftTermMap_horizontal f Z n m a b h hab + · simp + +theorem leftTermMap_vertical (n m a : ℤ) (x : Term k B P Z a (n + -a)) : + leftTermMap f Z a (m + -a) + (((ComplexTensor.column k B (right k B P) Z a).d n m).hom x) = + ((ComplexTensor.column k B (right k B P') Z a).d n m).hom + (leftTermMap f Z a (n + -a) x) := by + let L := (leftTermMap f Z a (m + -a)).toAddMonoidHom.comp + ((ComplexTensor.column k B (right k B P) Z a).d n m).hom.toAddMonoidHom + let R := ((ComplexTensor.column k B (right k B P') Z a).d n m).hom.toAddMonoidHom.comp + (leftTermMap f Z a (n + -a)).toAddMonoidHom + induction x using BalancedTensor.induction_on with + | hz => exact L.map_zero.trans R.map_zero.symm + | ht x y => + rw [ComplexTensor.column_d,ComplexTensor.column_d] + change leftTermMap f Z a (m + -a) + ((-a).negOnePow • BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P.X a)) + (ComplexTensor.leftTerm k B Z (m + -a)) x ((Z.d (n + -a) (m + -a)).hom y)) = + (-a).negOnePow • BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P'.X a)) + (ComplexTensor.leftTerm k B Z (m + -a)) ((f.f a).hom x) ((Z.d (n + -a) (m + -a)).hom y) + simp only [Units.smul_def, map_zsmul] + rfl + | ha x y hx hy => + exact (L.map_add x y).trans + ((congrArg₂ (· + ·) hx hy).trans (R.map_add x y).symm) + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +def leftTotalMapF (n : ℤ) : TotalTerm k B P p Z n →ₗ[B] TotalTerm k B P' p Z n where + toFun x i := leftTermMap f Z (p i) (n + -(p i)) (x i) + map_add' x y := by ext i; exact map_add _ _ _ + map_smul' b x := by + funext i + exact (leftTermMap f Z (p i) (n + -(p i))).map_smul b (x i) + +/-- Tensoring an actual bimodule chain map gives an actual B-linear total chain map. -/ +def leftTotalMap : total k B P p hp Z ⟶ total k B P' p hp Z where + f n := ModuleCat.ofHom (leftTotalMapF f Z p n) + comm' n m h := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext j + change ((total k B P' p hp Z).d n m).hom (leftTotalMapF f Z p n x) j = + leftTermMap f Z (p j) (m + -(p j)) (((total k B P p hp Z).d n m).hom x j) + erw [total_d_apply k B P' Z p hp n m h, total_d_apply k B P Z p hp n m h, + map_add, map_sum] + congr 1 + · exact (leftTermMap_vertical f Z n m (p j) (x j)).symm + · apply Finset.sum_congr rfl + intro i _ + exact (LinearMap.congr_fun (leftTermMap_entry f Z n m (p i) (p j) h) (x i)).symm + +@[simp] theorem leftTotalMap_apply (n : ℤ) (x : TotalTerm k B P p Z n) (i : Fin l) : + ((leftTotalMap f Z p hp).f n).hom x i = leftTermMap f Z (p i) (n + -(p i)) (x i) := rfl +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleResolutionBarAPI.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleResolutionBarAPI.lean new file mode 100644 index 0000000000000000000000000000000000000000..25cddd4484f11c88587aee651c1c028664058638 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleResolutionBarAPI.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBarStalk + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} B) := + HasDerivedCategory.standard (ModuleCat.{u} B) +variable (P : BiComplex k B) (X : ModuleCat.{u} (Enveloping k B)) (length : ℕ) +variable (ε : P ⟶ bimoduleStalk k B X) (hε : QuasiIso ε) +variable (hproj : ∀ n, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) n)) +variable (hbound : ∀ n, n < -(length : ℤ) ∨ 0 < n → IsZero (P.X n)) + +/-- Package exactly the ordinary worker's actual bounded bimodule resolution +API. Augmentation, quasi-isomorphism, projectivity and support are all explicit. -/ +def ofNonpositiveResolution : AugmentedProjective k B P X where + data := { lower := -(length : ℤ), upper := 0, bounded := hbound, projective := hproj } + augmentation := ε + quasiIso := hε + +local notation "R" => ofNonpositiveResolution P X length ε hε hproj hbound + +/-- Integration API for Q_X: the native integer-derived functor agrees naturally +with the genuine bar-derived functor after chainToIntegerDerived. -/ +def nonpositiveResolutionBarIso : + DerivedBar.chainToIntegerDerived B ⋙ (R).data.derived ≅ + DerivedBar.derivedTensor k B (barModule (X := X)) ⋙ DerivedBar.chainToIntegerDerived B := + nativeBarIso R (zeroDegreeIndex R (by dsimp [ofNonpositiveResolution]; omega) (by rfl)) + (zeroDegreeIndex_eq R (by dsimp [ofNonpositiveResolution]; omega) (by rfl)) + +/-- Exact source-style F^r applied to a native degree-zero module, represented +by the genuine Section 6 indexed multibar. All comparison data is constructed. -/ +def nonpositiveResolutionPowerIso (N : ModuleCat.{u} B) (r : ℕ) : + ((R).data.derived.obj^[r]) (DerivedCategory.Q.obj (singleInput B N)) ≅ + DerivedCategory.Q.obj ((DerivedBar.integerExtension B).obj + (DerivedBar.RecursiveTotal.indexedMultibar k B (barModule (X := X)) N r)) := + (eqToIso (nativeIterate_obj R r _)).symm ≪≫ + nativeStalkIndexedIso R (by dsimp [ofNonpositiveResolution]; omega) (by rfl) N r +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleScalarEvaluation.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleScalarEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d24a838c922dfe961a8a3bf47b42d15f08aecb73 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleScalarEvaluation.lean @@ -0,0 +1,88 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleSingleEvaluation + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] [hN : IsScalarTower k B N] +abbrev CanonicalInput := BalancedTensor.ScalarLeftModule k B (ModuleCat.of B N) + +variable (M : ModuleCat.{u} (Enveloping k B)) + +def toNativeScalar : BimoduleBalancedTensor.Tensor k B M (CanonicalInput k B N) →ₗ[B] + BimoduleBalancedTensor.Tensor k B M N where + __ := (@BalancedTensor.mapRightTo k B (BimoduleBalancedTensor.Input k B M) + (CanonicalInput k B N) N _ _ _ _ _ _ + _ _ _ (BalancedTensor.scalarLeftTower k B (ModuleCat.of B N)) _ _ _ hN (LinearMap.id : CanonicalInput k B N →ₗ[B] N)).toAddMonoidHom + map_smul' b x := by + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => simp_all [smul_add] + +def fromNativeScalar : BimoduleBalancedTensor.Tensor k B M N →ₗ[B] + BimoduleBalancedTensor.Tensor k B M (CanonicalInput k B N) where + __ := (@BalancedTensor.mapRightTo k B (BimoduleBalancedTensor.Input k B M) + N (CanonicalInput k B N) _ _ _ _ _ _ + _ _ _ hN _ _ _ (BalancedTensor.scalarLeftTower k B (ModuleCat.of B N)) (LinearMap.id : N →ₗ[B] CanonicalInput k B N)).toAddMonoidHom + map_smul' b x := by + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => simp_all [smul_add] + +/-- Canonical restriction and the native compatible k action give the same B-valued tensor. -/ +def scalarTensorIso : + (BimoduleBalancedTensor.functor k B (CanonicalInput k B N)).obj M ≅ + (BimoduleBalancedTensor.functor k B N).obj M where + hom := ModuleCat.ofHom (toNativeScalar k B N M) + inv := ModuleCat.ofHom (fromNativeScalar k B N M) + hom_inv_id := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + inv_hom_id := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +variable {M} {M' : ModuleCat.{u} (Enveloping k B)} +theorem scalarTensor_natural (f : M ⟶ M') : + (BimoduleBalancedTensor.functor k B (CanonicalInput k B N)).map f ≫ (scalarTensorIso k B N M').hom = + (scalarTensorIso k B N M).hom ≫ (BimoduleBalancedTensor.functor k B N).map f := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +/-- Exact comparison to native module evaluation with its original compatible scalar structure. -/ +def scalarEvaluationIso (P : BiComplex k B) : + moduleEvaluation k B P (ModuleCat.of B N) ≅ + ((BimoduleBalancedTensor.functor k B N).mapHomologicalComplex (.up ℤ)).obj P := + HomologicalComplex.Hom.isoOfComponents (fun n => scalarTensorIso k B N (P.X n)) + (fun n m _ => (scalarTensor_natural k B N (P.d n m)).symm) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftCoherence.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftCoherence.lean new file mode 100644 index 0000000000000000000000000000000000000000..27c4973c3d791bba16a8d4ed2c206823d610a941 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftCoherence.lean @@ -0,0 +1,158 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleShiftTotal +import OAI.Algebra.Finitistic.Localization.SignedCochainShift + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +local instance signedShift (a : ℤ) : + (shiftFunctor (CochainComplex (ModuleCat.{u} B) ℤ) a).CommShift ℤ := + signedShiftComm (ModuleCat.{u} B) a + +instance columnCommShift (P : BiComplex k B) (a : ℤ) : + (columnFunctor k B P a).CommShift ℤ := by unfold columnFunctor; infer_instance + +variable (P : BiComplex k B) + +theorem column_commShiftIso_eq (Z : CochainComplex (ModuleCat.{u} B) ℤ) (s a : ℤ) : + ((columnFunctor k B P a).commShiftIso s).app Z = shiftColumnIso k B P Z s a := by + apply Iso.ext + apply HomologicalComplex.Hom.ext + funext n + rw [shiftColumn_hom_f] + simp only [Iso.app_hom,columnFunctor,Functor.commShiftIso_comp_hom_app, + HomologicalComplex.comp_f,CochainComplex.shiftFunctor_map_f', + Functor.mapHomologicalComplex_commShiftIso_hom_app_f] + change ((signedShiftIso (ModuleCat.{u} B) (-a) s).hom.app + (((inputFunctor k B (P.X a)).mapHomologicalComplex (.up ℤ)).obj Z)).f n = _ + rw [signedShiftIso_hom_f] + simp [shiftReindex,HomologicalComplex.XIsoOfEq,mul_comm] + rfl + +variable {Z Z' : CochainComplex (ModuleCat.{u} B) ℤ} + +theorem fullColumn_map (f : Z ⟶ Z') (a n : ℤ) (x : Term k B P Z a (n + -a)) : + (((columnFunctor k B P a).map f).f n).hom x = + ComplexTensor.inputMap k B (right k B P) f a (n + -a) x := by + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht m y => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +theorem functor_map_component (f : Z ⟶ Z') (n : ℤ) + (x : TotalTerm k B P p Z n) (i : Fin l) : + (((functor k B P p hp).map f).f n).hom x i = + (((columnFunctor k B P (p i)).map f).f n).hom (x i) := by + change ((ComplexTensor.finiteTotalMap k B (right k B P) p hp f).f n).hom x i = _ + erw [ComplexTensor.finiteTotalMap_apply] + exact (fullColumn_map k B P f (p i) n (x i)).symm + +@[simp] theorem shiftTotal_hom_apply (Z : CochainComplex (ModuleCat.{u} B) ℤ) (s n : ℤ) + (x : TotalTerm k B P p (Z⟦s⟧) n) (i : Fin l) : + (((shiftTotalIso k B P p hp Z s).hom).f n).hom x i = + (((shiftColumnIso k B P Z s (p i)).hom).f n).hom (x i) := rfl + +/-- Naturality of the full tensor shift, in every input complex and chain map. -/ +def shiftIso (s : ℤ) : shiftFunctor _ s ⋙ functor k B P p hp ≅ + functor k B P p hp ⋙ shiftFunctor _ s := + NatIso.ofComponents (fun Z => shiftTotalIso k B P p hp Z s) (by + intro Z Z' f + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext i + have h := congrArg (fun g => (g.f n).hom (x i)) + (((columnFunctor k B P (p i)).commShiftIso s).hom.naturality f) + simp only [← Iso.app_hom,column_commShiftIso_eq] at h + change (((shiftColumnIso k B P Z' s (p i)).hom).f n).hom + ((((functor k B P p hp).map ((shiftFunctor _ s).map f)).f n).hom x i) = + (((functor k B P p hp).map f).f (n+s)).hom + (((shiftTotalIso k B P p hp Z s).hom.f n).hom x) i + erw [functor_map_component,functor_map_component,shiftTotal_hom_apply] + simp only [Functor.comp_map,Functor.comp_obj,HomologicalComplex.comp_f,ModuleCat.hom_comp, + CochainComplex.shiftFunctor_map_f'] at h + convert h using 1 <;> rfl) + +theorem total_transport_apply (Z : CochainComplex (ModuleCat.{u} B) ℤ) + (n m : ℤ) (h : n = m) (x : TotalTerm k B P p Z n) (i : Fin l) : + ((eqToHom (congrArg (fun q => (total k B P p hp Z).X q) h)).hom x) i = + (eqToHom (congrArg (fun q => ((columnFunctor k B P (p i)).obj Z).X q) h)).hom (x i) := by + subst m + rfl + +@[simp] theorem shiftIso_apply (Z : CochainComplex (ModuleCat.{u} B) ℤ) (s n : ℤ) + (x : TotalTerm k B P p (Z⟦s⟧) n) (i : Fin l) : + (((shiftIso k B P p hp s).hom.app Z).f n).hom x i = + (((shiftColumnIso k B P Z s (p i)).hom).f n).hom (x i) := rfl + +theorem shiftZero_inv_component (Z : CochainComplex (ModuleCat.{u} B) ℤ) + (n : ℤ) (x : TotalTerm k B P p Z n) (i : Fin l) : + (((shiftFunctorZero (CochainComplex (ModuleCat.{u} B) ℤ) ℤ).inv.app + ((functor k B P p hp).obj Z)).f n).hom x i = + (((shiftFunctorZero (CochainComplex (ModuleCat.{u} B) ℤ) ℤ).inv.app + ((columnFunctor k B P (p i)).obj Z)).f n).hom (x i) := by + convert total_transport_apply k B P p hp Z n (n+0) (by omega) x i using 1 + rfl + +theorem shiftAdd_inv_component (Z : CochainComplex (ModuleCat.{u} B) ℤ) + (s t n : ℤ) (x : TotalTerm k B P p Z (n+t+s)) (i : Fin l) : + (((shiftFunctorAdd (CochainComplex (ModuleCat.{u} B) ℤ) s t).inv.app + ((functor k B P p hp).obj Z)).f n).hom x i = + (((shiftFunctorAdd (CochainComplex (ModuleCat.{u} B) ℤ) s t).inv.app + ((columnFunctor k B P (p i)).obj Z)).f n).hom (x i) := by + convert total_transport_apply k B P p hp Z (n+t+s) (n+(s+t)) (by omega) x i using 1 + rfl + +/-- All integer shifts satisfy zero and addition coherence for the actual tensor endofunctor. -/ +instance commShift : (functor k B P p hp).CommShift ℤ where + commShiftIso := shiftIso k B P p hp + commShiftIso_zero := by + ext Z n x + funext i + have h := congrArg (fun e => ((e.hom.app Z).f n).hom (x i)) + ((columnFunctor k B P (p i)).commShiftIso_zero ℤ) + simp only [← Iso.app_hom,column_commShiftIso_eq] at h + simp only [Iso.app_hom,Functor.CommShift.isoZero_hom_app, HomologicalComplex.comp_f, + ModuleCat.hom_comp, LinearMap.comp_apply] at h ⊢ + have hc := shiftZero_inv_component k B P p hp Z n + ((((functor k B P p hp).map ((shiftFunctorZero _ ℤ).hom.app Z)).f n).hom x) i + have hf := functor_map_component k B P p hp ((shiftFunctorZero _ ℤ).hom.app Z) n x i + have he := hc.trans (congrArg (fun y => + (((shiftFunctorZero (CochainComplex (ModuleCat.{u} B) ℤ) ℤ).inv.app + ((columnFunctor k B P (p i)).obj Z)).f n).hom y) hf) + exact h.trans he.symm + commShiftIso_add s t := by + ext Z n x + funext i + have h := congrArg (fun e => ((e.hom.app Z).f n).hom (x i)) + ((columnFunctor k B P (p i)).commShiftIso_add s t) + simp only [← Iso.app_hom,column_commShiftIso_eq] at h + simp only [Iso.app_hom,Functor.CommShift.isoAdd_hom_app, HomologicalComplex.comp_f, + ModuleCat.hom_comp, LinearMap.comp_apply,CochainComplex.shiftFunctor_map_f'] at h ⊢ + simp only [← Iso.app_hom,column_commShiftIso_eq] at h + let y := ((((functor k B P p hp).map ((shiftFunctorAdd _ s t).hom.app Z)).f n).hom x) + let z := (((shiftIso k B P p hp t).hom.app (Z⟦s⟧)).f n).hom y + have hf := functor_map_component k B P p hp ((shiftFunctorAdd _ s t).hom.app Z) n x i + have ht := shiftIso_apply k B P p hp (Z⟦s⟧) t n y i + have hs := shiftIso_apply k B P p hp Z s (n+t) z i + have ht' := ht.trans (congrArg (fun w => ((shiftColumnIso k B P (Z⟦s⟧) t (p i)).hom.f n).hom w) hf) + have hs' := hs.trans (congrArg (fun w => ((shiftColumnIso k B P Z s (p i)).hom.f (n+t)).hom w) ht') + have hc := shiftAdd_inv_component k B P p hp Z s t n + ((((shiftIso k B P p hp s).hom.app Z).f (n+t)).hom z) i + have he := hc.trans (congrArg (fun w => + (((shiftFunctorAdd (CochainComplex (ModuleCat.{u} B) ℤ) s t).inv.app + ((columnFunctor k B P (p i)).obj Z)).f n).hom w) hs') + exact h.trans he.symm +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftColumns.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftColumns.lean new file mode 100644 index 0000000000000000000000000000000000000000..62b83b9599c4ca90524efa91a66a46870b7cc77d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftColumns.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleInputFunctor +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalTermMaps +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +/-- The B-valued column has exactly the frozen signed differential on underlying elements. -/ +theorem fullColumn_d (p n m : ℤ) (x : Term k B P Z p (n + -p)) : + (((columnFunctor k B P p).obj Z).d n m).hom x = + ((ComplexTensor.column k B (right k B P) Z p).d n m).hom x := by + induction x using BalancedTensor.induction_on with + | hz => exact (map_zero _).trans (map_zero _).symm + | ht a b => rfl + | ha a b ha hb => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) ha hb).trans (map_add _ _ _).symm) + +/-- The tensor shift has the Koszul sign (-1)^(s*p) on its pth column. -/ +def shiftColumnIso (s p : ℤ) : + (columnFunctor k B P p).obj (Z⟦s⟧) ≅ ((columnFunctor k B P p).obj Z)⟦s⟧ := + OrdinarySimulation.integerUnitIso _ (s*p).negOnePow ≪≫ + (shiftFunctor _ (-p)).mapIso + (((inputFunctor k B (P.X p)).mapHomologicalComplex (.up ℤ)).commShiftIso s |>.app Z) ≪≫ + (shiftFunctorComm (CochainComplex (ModuleCat.{u} B) ℤ) s (-p)).app + (((inputFunctor k B (P.X p)).mapHomologicalComplex (.up ℤ)).obj Z) + +def shiftReindex (s a n : ℤ) : + ((columnFunctor k B P a).obj (Z⟦s⟧)).X n ≅ + (((columnFunctor k B P a).obj Z)⟦s⟧).X n := + eqToIso (congrArg (fun q => ModuleCat.of B (Term k B P Z a q)) + (show n + -a + s = n + s + -a by omega)) + +theorem shiftColumn_hom_f (s a n : ℤ) : + ((shiftColumnIso k B P Z s a).hom).f n = + (s*a).negOnePow • (shiftReindex k B P Z s a n).hom := by + simp only [shiftColumnIso, Iso.trans_hom, HomologicalComplex.comp_f] + change ((s*a).negOnePow • 𝟙 (((columnFunctor k B P a).obj (Z⟦s⟧)).X n)) ≫ _ = _ + rw [Linear.units_smul_comp, Category.id_comp] + congr 1 + simp only [Functor.mapIso_hom, Iso.app_hom, CochainComplex.shiftFunctor_map_f', + Functor.mapHomologicalComplex_commShiftIso_hom_app_f, + CochainComplex.shiftFunctorComm_hom_app_f] + rfl +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftHorizontal.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftHorizontal.lean new file mode 100644 index 0000000000000000000000000000000000000000..66407824e21d0f4a00f3ba653fd012ed169e7f81 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftHorizontal.lean @@ -0,0 +1,57 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleShiftColumns +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalDifferential + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {P : BiComplex k B} {Z : CochainComplex (ModuleCat.{u} B) ℤ} + +/-- Reindexing the unchanged input degree commutes with the original bimodule map. -/ +theorem termMap_transport {a b q₁ q₂ q₃ q₄ : ℤ} (f : P.X a ⟶ P.X b) + (h₁₂ : q₁=q₂) (h₃₄ : q₃=q₄) (h₁₃ : q₁=q₃) (h₂₄ : q₂=q₄) : + ModuleCat.ofHom (termMap (Z := Z) (Z' := Z) f (eqToHom (congrArg Z.X h₁₂))) ≫ + eqToHom (congrArg (fun q => ModuleCat.of B (Term k B P Z b q)) h₂₄) = + eqToHom (congrArg (fun q => ModuleCat.of B (Term k B P Z a q)) h₁₃) ≫ + ModuleCat.ofHom (termMap (Z := Z) (Z' := Z) f (eqToHom (congrArg Z.X h₃₄))) := by + subst q₂ q₃ q₄ + simp + +variable (k B P Z) + +theorem horizontal_shift_reindex (s n m a b : ℤ) (h : n+1=m) (hab : a+1=b) : + ModuleCat.ofHom (horizontalBetween k B P (Z⟦s⟧) n m a b h hab) ≫ + (shiftReindex k B P Z s b m).hom = + (shiftReindex k B P Z s a n).hom ≫ + ModuleCat.ofHom (horizontalBetween k B P Z (n+s) (m+s) a b (by omega) hab) := + termMap_transport (k := k) (B := B) (P := P) (Z := Z) + (q₁ := n + -a + s) (q₂ := m + -b + s) + (q₃ := n+s + -a) (q₄ := m+s + -b) + (P.d a b) (by omega) (by omega) (by omega) (by omega) + +/-- The Koszul sign compensates exactly for the sign on the shifted horizontal differential. -/ +theorem entry_shift (s n m a b : ℤ) (h : n+1=m) : + ModuleCat.ofHom (entryBetween k B P (Z⟦s⟧) n m a b h) ≫ + ((shiftColumnIso k B P Z s b).hom).f m = + ((shiftColumnIso k B P Z s a).hom).f n ≫ + (s.negOnePow • ModuleCat.ofHom (entryBetween k B P Z (n+s) (m+s) a b (by omega))) := by + rw [shiftColumn_hom_f,shiftColumn_hom_f] + unfold entryBetween + split_ifs with hab + · erw [Linear.comp_units_smul,Linear.units_smul_comp,Linear.comp_units_smul, + smul_smul,horizontal_shift_reindex] + congr 1 + rw [← Int.negOnePow_add] + congr 1 + rw [← hab] + simp [mul_add,add_comm] + · erw [CategoryTheory.Limits.zero_comp, CategoryTheory.Limits.comp_zero] + rfl +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftTotal.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..e89ce3b1c235ff070e09891d4544777a3331f420 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftTotal.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleShiftHorizontal + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +def shiftTermIso (s n : ℤ) : + (total k B P p hp (Z⟦s⟧)).X n ≅ ((total k B P p hp Z)⟦s⟧).X n := + (LinearEquiv.piCongrRight (fun i : Fin l => + (HomologicalComplex.Hom.isoApp (shiftColumnIso k B P Z s (p i)) n).toLinearEquiv)).toModuleIso + +@[simp] theorem shiftTerm_hom_apply (s n : ℤ) + (x : TotalTerm k B P p (Z⟦s⟧) n) (i : Fin l) : + (shiftTermIso k B P p hp Z s n).hom.hom x i = + (((shiftColumnIso k B P Z s (p i)).hom).f n).hom (x i) := rfl + +/-- The complete signed total commutes with every integer shift, with the actual horizontal maps. -/ +def shiftTotalIso (s : ℤ) : total k B P p hp (Z⟦s⟧) ≅ (total k B P p hp Z)⟦s⟧ := + HomologicalComplex.Hom.isoOfComponents (shiftTermIso k B P p hp Z s) (by + intro n m h + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext j + have hv := congrArg (fun f => f.hom (x j)) ((shiftColumnIso k B P Z s (p j)).hom.comm n m) + have hh (i : Fin l) := congrArg (fun f => f.hom (x i)) + (entry_shift k B P Z s n m (p i) (p j) h) + change s.negOnePow • (((total k B P p hp Z).d (n+s) (m+s)).hom + ((shiftTermIso k B P p hp Z s n).hom.hom x) j) = + (((shiftColumnIso k B P Z s (p j)).hom).f m).hom + (((total k B P p hp (Z⟦s⟧)).d n m).hom x j) + erw [total_d_apply k B P Z p hp (n+s) (m+s) (by change n+1=m at h; omega), + total_d_apply k B P (Z⟦s⟧) p hp n m h] + erw [map_add, map_sum, smul_add, Finset.smul_sum] + refine congrArg₂ HAdd.hAdd ?_ ?_ + · change s.negOnePow • ((((columnFunctor k B P (p j)).obj Z).d (n+s) (m+s)).hom + (((shiftColumnIso k B P Z s (p j)).hom.f n).hom (x j))) = + ((shiftColumnIso k B P Z s (p j)).hom.f m).hom + ((((columnFunctor k B P (p j)).obj (Z⟦s⟧)).d n m).hom (x j)) at hv + exact (congrArg (s.negOnePow • ·) + (fullColumn_d k B P Z (p j) (n+s) (m+s) + (((shiftColumnIso k B P Z s (p j)).hom.f n).hom (x j)))).symm.trans + (hv.trans (congrArg (((shiftColumnIso k B P Z s (p j)).hom.f m).hom) + (fullColumn_d k B P (Z⟦s⟧) (p j) n m (x j)))) + · apply Finset.sum_congr rfl + intro i _ + exact hh i |>.symm) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftedPresentation.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftedPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6558304c4ee1930cf86cd784954dc96abe23cb23 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleShiftedPresentation.lean @@ -0,0 +1,38 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBoundedPresentation +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftDerivedTensor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotalPresentation +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (b : ℤ) (length : ℕ) +variable [∀ n, Module.Projective Bᵐᵒᵖ ((OrdinarySimulation.underlyingRightComplex P).X n)] + +local instance : ∀ n, Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (BimoduleTotal.right k B (P⟦b⟧)) n) := + fun n => inferInstanceAs (Module.Projective Bᵐᵒᵖ + ((OrdinarySimulation.underlyingRightComplex P).X (n+b))) + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable (data : BimoduleTotal.BoundedProjective k B (P⟦b⟧)) + +/-- The ordinary shifted-derived API agrees with any native model of the identical +shifted complex on [-length,0]. No shift-left tensor theorem is reproved or assumed. -/ +def shiftedDerivedIso (hlo : data.lower = -(length : ℤ)) (hhi : data.upper = 0) : + OrdinarySimulation.shiftedDerivedTensor P b length ≅ data.derived := + boundedNonpositiveDerivedIso k B (P⟦b⟧) data length hlo hhi + +/-- The same comparison on every actual shifted-derived iterate. -/ +def shiftedPowerIso (hlo : data.lower = -(length : ℤ)) (hhi : data.upper = 0) + (r : ℕ) (Y : DerivedCategory (ModuleCat.{u} B)) : + ((OrdinarySimulation.shiftedDerivedTensor P b length).obj^[r]) Y ≅ + (data.derived.obj^[r]) Y := + powerObjIso (shiftedDerivedIso P b length data hlo hhi) r Y +end LittleFinitistic.BimoduleTotalPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleDifferential.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..44e4edbaae99a6db1eaa64944af943a146c26671 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleDifferential.lean @@ -0,0 +1,82 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleSingleTerms +import OAI.Algebra.Finitistic.Bimodule.BimoduleInputNaturality +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalDifferential + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (N : ModuleCat.{u} B) + +/-- On the unique nonzero summands, the total differential becomes the original native tensor differential. -/ +theorem single_horizontal (n m : ℤ) (h : n+1=m) : + ModuleCat.ofHom (horizontalBetween k B P (singleInput B N) n m n m h h) ≫ + (singleTermIso k B P N m m rfl).hom = + (singleTermIso k B P N n n rfl).hom ≫ (moduleEvaluation k B P N).d n m := by + let φn := (HomologicalComplex.singleObjXIsoOfEq (.up ℤ) 0 N (n + -n) (by omega)).hom + let φm := (HomologicalComplex.singleObjXIsoOfEq (.up ℤ) 0 N (m + -m) (by omega)).hom + let e := eqToHom (congrArg (singleInput B N).X (show n + -n = m + -m by omega)) + have he : e ≫ φm = φn := by + simp only [e,φn,φm,HomologicalComplex.singleObjXIsoOfEq,eqToIso.hom,eqToHom_trans] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht a b => + change BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P.X m)) + (BalancedTensor.ScalarLeftModule k B N) ((P.d n m).hom a) (φm.hom (e.hom b)) = + BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P.X m)) + (BalancedTensor.ScalarLeftModule k B N) ((P.d n m).hom a) (φn.hom b) + exact congrArg (fun t => BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P.X m)) + (BalancedTensor.ScalarLeftModule k B N) ((P.d n m).hom a) t) + (congrArg (fun f => f.hom b) he) + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +theorem single_total_d (i j : Fin l) (h : p i+1=p j) + (x : TotalTerm k B P p (singleInput B N) (p i)) : + ((total k B P p hp (singleInput B N)).d (p i) (p j)).hom x j = + horizontalBetween k B P (singleInput B N) (p i) (p j) (p i) (p j) h h (x i) := by + rw [total_d_apply k B P (singleInput B N) p hp (p i) (p j) h] + have hv : ((ComplexTensor.column k B (right k B P) (singleInput B N) (p j)).d (p i) (p j)).hom (x j) = 0 := by + rw [ComplexTensor.column_d] + simp only [singleInput,HomologicalComplex.single_obj_d,ComplexTensor.map_zero_right, + smul_zero] + rfl + erw [hv,zero_add] + classical + rw [Finset.sum_eq_single i] + · simp only [entryBetween,dite_eq_left h] + · intro t _ ht + let := ModuleCat.subsingleton_of_isZero + (singleTerm_isZero k B P N (p i) (p t) (fun he => ht (hp.injective he))) + have hx : x t=0 := Subsingleton.elim _ _ + rw [hx,map_zero] + · simp + +/-- The degreewise comparison intertwines the full native differential at every pair of included consecutive degrees. -/ +theorem evaluationAtIndex_comm (i j : Fin l) (h : p i+1=p j) : + (evaluationAtIndex k B P N p hp i).hom ≫ (moduleEvaluation k B P N).d (p i) (p j) = + (total k B P p hp (singleInput B N)).d (p i) (p j) ≫ + (evaluationAtIndex k B P N p hp j).hom := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + change ((moduleEvaluation k B P N).d (p i) (p j)).hom + ((singleTermIso k B P N (p i) (p i) rfl).hom.hom (x i)) = + (singleTermIso k B P N (p j) (p j) rfl).hom.hom + (((total k B P p hp (singleInput B N)).d (p i) (p j)).hom x j) + rw [single_total_d k B P N p hp i j h] + exact (congrArg (fun f => f.hom (x i)) (single_horizontal k B P N (p i) (p j) h)).symm +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleEvaluation.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..5231cf2bc6d35bcf84b6dd8d5e275af1b8bed024 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleEvaluation.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleSingleDifferential +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerivedFunctor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (N : ModuleCat.{u} B) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable (hP : ∀ n, (∀ i, p i ≠ n) → IsZero (P.X n)) + +theorem evaluationAtIndex_transport (i j : Fin l) (h : i=j) : + eqToIso (congrArg (fun n => ModuleCat.of B (TotalTerm k B P p (singleInput B N) n)) + (congrArg p h).symm) ≪≫ evaluationAtIndex k B P N p hp i ≪≫ + (moduleEvaluation k B P N).XIsoOfEq (congrArg p h) = evaluationAtIndex k B P N p hp j := by + subst j + simp [HomologicalComplex.XIsoOfEq] + +theorem evaluationTermIso_at (i : Fin l) : + evaluationTermIso k B P N p hp hP (p i) = evaluationAtIndex k B P N p hp i := by + classical + unfold evaluationTermIso + split_ifs with h + · have hi : h.choose=i := hp.injective h.choose_spec + exact evaluationAtIndex_transport k B P N p hp h.choose i hi + · exact False.elim (h ⟨i,rfl⟩) + +/-- The ordinary signed total on an input module in degree zero is the exact native P tensor_B N complex. -/ +def singleEvaluationIso : total k B P p hp (singleInput B N) ≅ moduleEvaluation k B P N := + HomologicalComplex.Hom.isoOfComponents (evaluationTermIso k B P N p hp hP) (by + intro n m h + classical + by_cases hn : ∃ i, p i=n + · obtain ⟨i,rfl⟩ := hn + by_cases hm : ∃ j, p j=m + · obtain ⟨j,rfl⟩ := hm + rw [evaluationTermIso_at,evaluationTermIso_at] + exact evaluationAtIndex_comm k B P N p hp i j h + · exact ((BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N)).map_isZero + (hP m (by simpa only [not_exists] using hm))).eq_of_tgt _ _ + · exact (totalSingle_isZero k B P N p n (by simpa only [not_exists] using hn)).eq_of_src _ _) + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (p i))] + +/-- Evaluation of the actual derived endofunctor on a degree-zero module is the native tensor complex in D(B-Mod). -/ +def derivedSingleEvaluation : + (derived k B P p hp).obj (DerivedCategory.Q.obj (singleInput B N)) ≅ + DerivedCategory.Q.obj (moduleEvaluation k B P N) := + (derivedComparison k B P p hp).app (singleInput B N) ≪≫ + DerivedCategory.Q.mapIso (singleEvaluationIso k B P N p hp hP) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleTerms.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..7428a0e2610d16df20382b3a3fd680bdf2e3d876 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleSingleTerms.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleInputFunctor +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalFunctor +import Mathlib.Algebra.Homology.Single + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (N : ModuleCat.{u} B) + +abbrev singleInput := (HomologicalComplex.single (ModuleCat.{u} B) (.up ℤ) 0).obj N + +/-- The native degree-zero-module evaluation, retaining its original B action and differential. -/ +abbrev moduleEvaluation := + ((BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N)).mapHomologicalComplex + (.up ℤ)).obj P + +def singleTermIso (n a : ℤ) (h : a=n) : + ModuleCat.of B (Term k B P (singleInput B N) a (n + -a)) ≅ (moduleEvaluation k B P N).X n := + (inputFunctor k B (P.X a)).mapIso + (HomologicalComplex.singleObjXIsoOfEq (.up ℤ) 0 N (n + -a) (by omega)) ≪≫ + (BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N)).mapIso (P.XIsoOfEq h) + +theorem singleTerm_isZero (n a : ℤ) (h : a ≠ n) : + IsZero (ModuleCat.of B (Term k B P (singleInput B N) a (n + -a))) := + (inputFunctor k B (P.X a)).map_isZero + (HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 N (n + -a) (by omega)) + +variable {k B} +/-- A finite product with only one possibly nonzero factor is that actual factor. -/ +def piSingleEquiv {l : ℕ} (V : Fin l → Type u) [∀ i, AddCommGroup (V i)] [∀ i, Module B (V i)] + (i : Fin l) (hz : ∀ j, j ≠ i → Subsingleton (V j)) : (∀ j, V j) ≃ₗ[B] V i where + toFun x := x i + invFun x := Pi.single i x + left_inv x := by + funext j + by_cases h : j=i + · subst j; simp + · let := hz j h + exact Subsingleton.elim _ _ + right_inv x := by simp + map_add' _ _ := rfl + map_smul' _ _ := rfl + +variable (k B) {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +def evaluationAtIndex (i : Fin l) : + ModuleCat.of B (TotalTerm k B P p (singleInput B N) (p i)) ≅ + (moduleEvaluation k B P N).X (p i) := + (piSingleEquiv (fun j => Term k B P (singleInput B N) (p j) (p i + -(p j))) i + (fun j h => ModuleCat.subsingleton_of_isZero + (singleTerm_isZero k B P N (p i) (p j) (fun hji => h (hp.injective hji))))).toModuleIso ≪≫ + singleTermIso k B P N (p i) (p i) rfl + +theorem totalSingle_isZero (n : ℤ) (hn : ∀ i, p i ≠ n) : + IsZero (ModuleCat.of B (TotalTerm k B P p (singleInput B N) n)) := by + let (i : Fin l) := ModuleCat.subsingleton_of_isZero (singleTerm_isZero k B P N n (p i) (hn i)) + exact ModuleCat.isZero_of_subsingleton _ + +/-- The finite total and the native module evaluation agree in every degree, provided every nonzero P-degree is included. -/ +def evaluationTermIso + (hP : ∀ n, (∀ i, p i ≠ n) → IsZero (P.X n)) (n : ℤ) : + ModuleCat.of B (TotalTerm k B P p (singleInput B N) n) ≅ (moduleEvaluation k B P N).X n := by + classical + by_cases h : ∃ i, p i=n + · let i := h.choose + have hi : p i=n := h.choose_spec + exact eqToIso (congrArg (fun n => ModuleCat.of B (TotalTerm k B P p (singleInput B N) n)) hi.symm) ≪≫ + evaluationAtIndex k B P N p hp i ≪≫ (moduleEvaluation k B P N).XIsoOfEq hi + · have hn : ∀ i, p i ≠ n := by simpa only [not_exists] using h + exact (totalSingle_isZero k B P N p n hn).iso + ((BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N)).map_isZero (hP n hn)) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleStalkTotal.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleStalkTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2eb121bbb385a79af61f8575b53813525d5e522 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleStalkTotal.lean @@ -0,0 +1,92 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleAugmentedResolution +import OAI.Algebra.Finitistic.Bimodule.BimoduleShiftColumns + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (X : ModuleCat.{u} (Enveloping k B)) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) (i₀ : Fin l) (hi₀ : p i₀=0) + +include hp hi₀ in +/-- Every off-zero column of the stalk bimodule total is actually zero. -/ +theorem stalkTerm_isZero (Z : CochainComplex (ModuleCat.{u} B) ℤ) (n : ℤ) + (i : Fin l) (hi : i ≠ i₀) : + IsZero (ModuleCat.of B (Term k B (bimoduleStalk k B X) Z (p i) (n + -(p i)))) := by + have hpi : p i ≠ 0 := fun h => hi (hp.injective (h.trans hi₀.symm)) + exact (BimoduleBalancedTensor.functor k B (ComplexTensor.leftTerm k B Z (n + -(p i)))).map_isZero + (HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 X (p i) hpi) + +/-- Projecting onto its sole nonzero column is a genuine B-linear chain isomorphism. -/ +def stalkTotalColumnIso (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + total k B (bimoduleStalk k B X) p hp Z ≅ + (columnFunctor k B (bimoduleStalk k B X) (p i₀)).obj Z := + HomologicalComplex.Hom.isoOfComponents + (fun n => (piSingleEquiv (fun i => Term k B (bimoduleStalk k B X) Z (p i) (n + -(p i))) + i₀ (fun i hi => ModuleCat.subsingleton_of_isZero + (stalkTerm_isZero k B X p hp i₀ hi₀ Z n i hi))).toModuleIso) + (by + intro n m h + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + change (((columnFunctor k B (bimoduleStalk k B X) (p i₀)).obj Z).d n m).hom (x i₀) = + ((total k B (bimoduleStalk k B X) p hp Z).d n m).hom x i₀ + erw [fullColumn_d,total_d_apply k B (bimoduleStalk k B X) Z p hp n m h] + have hd (a b : ℤ) : (bimoduleStalk k B X).d a b = 0 := by + simp [bimoduleStalk] + have he (i : Fin l) : entryBetween k B (bimoduleStalk k B X) Z n m (p i) (p i₀) h = 0 := by + unfold entryBetween horizontalBetween + split_ifs + · rw [hd,← tensorAcross_eq_termMap,tensorAcross_zero_left] + · rfl + simp only [he,LinearMap.zero_apply,Finset.sum_const_zero] + exact (add_zero _).symm) + +/-- The stalk-total comparison is natural in the entire input complex. -/ +def stalkTotalColumnNatIso : functor k B (bimoduleStalk k B X) p hp ≅ + columnFunctor k B (bimoduleStalk k B X) (p i₀) := + NatIso.ofComponents (stalkTotalColumnIso k B X p hp i₀ hi₀) (by + intro Z Z' f + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + change ((ComplexTensor.finiteTotalMap k B (right k B (bimoduleStalk k B X)) p hp f).f n).hom x i₀ = _ + erw [ComplexTensor.finiteTotalMap_apply] + change ComplexTensor.inputMap k B (right k B (bimoduleStalk k B X)) f + (p i₀) (n + -(p i₀)) (x i₀) = + inputModuleMap k B ((bimoduleStalk k B X).X (p i₀)) (f.f (n + -(p i₀))) (x i₀) + induction x i₀ using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => simpa only [map_add] using congrArg₂ HAdd.hAdd hx hy) + +/-- An actual bimodule isomorphism induces a natural isomorphism of input tensor functors. -/ +def inputBimoduleIso {M M' : ModuleCat.{u} (Enveloping k B)} (e : M ≅ M') : + inputFunctor k B M ≅ inputFunctor k B M' := + NatIso.ofComponents (fun N => + (BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N)).mapIso e) + (by intro N N' f; exact input_tensor_square k B e.hom f) + +/-- Finite total with the stalk bimodule is the ordinary tensor functor on all +integer complexes. The only indexing condition is that degree zero is included. -/ +def stalkTotalIso : functor k B (bimoduleStalk k B X) p hp ≅ + (inputFunctor k B X).mapHomologicalComplex (.up ℤ) := by + refine stalkTotalColumnNatIso k B X p hp i₀ hi₀ ≪≫ ?_ + rw [hi₀] + exact Functor.isoWhiskerLeft + ((inputFunctor k B ((bimoduleStalk k B X).X 0)).mapHomologicalComplex (.up ℤ)) + (shiftFunctorZero (CochainComplex (ModuleCat.{u} B) ℤ) ℤ) ≪≫ + Functor.rightUnitor _ ≪≫ + NatIso.mapHomologicalComplex + (inputBimoduleIso k B (HomologicalComplex.singleObjXIsoOfEq (.up ℤ) 0 X 0 rfl)) (.up ℤ) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensor.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7bb09f412cdb7cd5dcef04513698c3a3b165a37 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensor.lean @@ -0,0 +1,188 @@ +import OAI.Algebra.Finitistic.Bar.Balanced + +namespace OAI +open scoped TensorProduct +open TensorProduct +noncomputable section + +namespace DerivedBar.BimoduleTensor +universe u +variable (k D X : Type u) [Field k] [Ring D] [Algebra k D] + [AddCommGroup X] [Module k X] [Module D X] [Module Dᵐᵒᵖ X] + [IsScalarTower k D X] +variable (V : Type u) [AddCommGroup V] [Module k V] [Module D V] [IsScalarTower k D V] + +/-- Noncommutative balancing relations for an arbitrary (D,D)-bimodule X. -/ +def relations : Submodule D (X ⊗[k] V) := + Submodule.span D {z | ∃ (x : X) (d : D) (v : V), + z = (MulOpposite.op d • x) ⊗ₜ[k] v - x ⊗ₜ[k] (d • v)} + +/-- Genuine balanced X ⊗_D V, with its exterior left D-action. -/ +abbrev tensor := (X ⊗[k] V) ⧸ relations k D X V + +def quotient : X ⊗[k] V →ₗ[D] tensor k D X V := (relations k D X V).mkQ + +omit [IsScalarTower k D V] in +theorem balanced (x : X) (d : D) (v : V) : + quotient k D X V ((MulOpposite.op d • x) ⊗ₜ[k] v) = + quotient k D X V (x ⊗ₜ[k] (d • v)) := by + apply sub_eq_zero.mp + rw [← map_sub] + exact (Submodule.Quotient.mk_eq_zero _).mpr (Submodule.subset_span ⟨x, d, v, rfl⟩) + +section Maps +variable (W U : Type u) [AddCommGroup W] [Module k W] [Module D W] [IsScalarTower k D W] + [AddCommGroup U] [Module k U] [Module D U] [IsScalarTower k D U] + +theorem map_relations (h : V →ₗ[D] W) : relations k D X V ≤ + ((quotient k D X W).comp (AlgebraTensorModule.lTensor D X (h.restrictScalars k))).ker := by + apply Submodule.span_le.mpr + rintro z ⟨x, d, v, rfl⟩ + change quotient k D X W ((AlgebraTensorModule.lTensor D X (h.restrictScalars k)) + ((MulOpposite.op d • x) ⊗ₜ[k] v - x ⊗ₜ[k] (d • v))) = 0 + simp only [map_sub, AlgebraTensorModule.lTensor_tmul, LinearMap.coe_restrictScalars, + LinearMap.map_smul] + rw [balanced, sub_self] + +def map (h : V →ₗ[D] W) : tensor k D X V →ₗ[D] tensor k D X W := + (relations k D X V).liftQ + ((quotient k D X W).comp (AlgebraTensorModule.lTensor D X (h.restrictScalars k))) + (map_relations k D X V W h) + +@[simp] theorem map_quotient (h : V →ₗ[D] W) (x : X) (v : V) : + map k D X V W h (quotient k D X V (x ⊗ₜ[k] v)) = + quotient k D X W (x ⊗ₜ[k] h v) := rfl + +theorem map_comp (h : V →ₗ[D] W) (g : W →ₗ[D] U) : + map k D X V U (g.comp h) = (map k D X W U g).comp (map k D X V W h) := by + apply (relations k D X V).linearMap_qext + apply AlgebraTensorModule.ext + intro x v + rfl + +@[simp] theorem map_zero : map k D X V W 0 = 0 := by + apply (relations k D X V).linearMap_qext + apply AlgebraTensorModule.ext + intro x v + change quotient k D X W (x ⊗ₜ[k] (0 : W)) = 0 + rw [TensorProduct.tmul_zero, _root_.map_zero] + +@[simp] theorem map_id : map k D X V V LinearMap.id = LinearMap.id := by + apply (relations k D X V).linearMap_qext + apply AlgebraTensorModule.ext + intro x v + rfl + +theorem map_add (h g : V →ₗ[D] W) : + map k D X V W (h+g) = map k D X V W h + map k D X V W g := by + apply (relations k D X V).linearMap_qext + apply AlgebraTensorModule.ext + intro x v + change quotient k D X W (x ⊗ₜ[k] (h v + g v)) = + quotient k D X W (x ⊗ₜ[k] h v) + quotient k D X W (x ⊗ₜ[k] g v) + rw [TensorProduct.tmul_add, _root_.map_add] +end Maps + +variable [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] + +/-- The bimodule right action, bilinear over the field. -/ +def rightMul : X →ₗ[k] D →ₗ[k] X where + toFun x := + { toFun := fun d => MulOpposite.op d • x + map_add' := by intro a b; simp [add_smul] + map_smul' := by intro c d; simp [MulOpposite.op_smul, smul_assoc] } + map_add' := by intro x y; ext d; simp [smul_add] + map_smul' := by intro c x; ext d; simp [smul_comm (MulOpposite.op d) c] + +/-- Multiplication X ⊗_k D → X respects the arbitrary exterior D-action. -/ +def rightAction : X ⊗[k] D →ₗ[D] X := + { (TensorProduct.lift (rightMul k D X)).toAddHom with + map_smul' := by + intro a z + induction z using TensorProduct.inductionOn with + | tmul x d => + change (TensorProduct.lift (rightMul k D X)) (a • (x ⊗ₜ[k] d)) = + a • ((TensorProduct.lift (rightMul k D X)) (x ⊗ₜ[k] d)) + rw [TensorProduct.smul_tmul'] + exact (smul_comm a (MulOpposite.op d) x).symm + | add v w hv hw => simp_all [smul_add] } + +@[simp] theorem rightAction_tmul (x : X) (d : D) : + rightAction k D X (x ⊗ₜ[k] d) = MulOpposite.op d • x := rfl + +variable (W : Type u) [AddCommGroup W] [Module k W] + +/-- Collapse the first two slots using the right D-action on X. -/ +def collapse : X ⊗[k] (D ⊗[k] W) →ₗ[D] X ⊗[k] W := + { ((TensorProduct.map ((rightAction k D X).restrictScalars k) LinearMap.id).comp + (TensorProduct.assoc k X D W).symm.toLinearMap).toAddHom with + map_smul' := by + intro a z + induction z using TensorProduct.inductionOn with + | tmul x v => + induction v using TensorProduct.inductionOn with + | tmul d w => + rw [TensorProduct.smul_tmul'] + change (MulOpposite.op d • (a • x)) ⊗ₜ[k] w = + a • ((MulOpposite.op d • x) ⊗ₜ[k] w) + rw [TensorProduct.smul_tmul', ← smul_comm a (MulOpposite.op d) x] + | add v w hv hw => simp_all [TensorProduct.tmul_add, smul_add] + | add v w hv hw => simp_all [smul_add] } + +@[simp] theorem collapse_tmul (x : X) (d : D) (w : W) : + collapse k D X W (x ⊗ₜ[k] (d ⊗ₜ[k] w)) = (MulOpposite.op d • x) ⊗ₜ[k] w := rfl + +/-- The collapse descends through the actual balancing relations. -/ +theorem relations_le_ker_collapse : relations k D X (D ⊗[k] W) ≤ (collapse k D X W).ker := by + apply Submodule.span_le.mpr + rintro z ⟨x, d, v, rfl⟩ + change collapse k D X W ((MulOpposite.op d • x) ⊗ₜ[k] v - x ⊗ₜ[k] (d • v)) = 0 + induction v using TensorProduct.inductionOn with + | tmul a w => + rw [_root_.map_sub, collapse_tmul, TensorProduct.smul_tmul', smul_eq_mul, collapse_tmul] + simp [← mul_smul, ← MulOpposite.op_mul] + | add v w hv hw => + simp only [TensorProduct.tmul_add, smul_add, _root_.map_sub, _root_.map_add] at * + rw [sub_eq_zero.mp hv, sub_eq_zero.mp hw, sub_self] + +def descend : tensor k D X (D ⊗[k] W) →ₗ[D] X ⊗[k] W := + (relations k D X (D ⊗[k] W)).liftQ (collapse k D X W) (relations_le_ker_collapse k D X W) + +def insert : X ⊗[k] W →ₗ[D] tensor k D X (D ⊗[k] W) := + (quotient k D X (D ⊗[k] W)).comp + (AlgebraTensorModule.lTensor D X (TensorProduct.mk k D W 1)) + +@[simp] theorem descend_quotient (z : X ⊗[k] (D ⊗[k] W)) : + descend k D X W (quotient k D X (D ⊗[k] W) z) = collapse k D X W z := rfl + +omit [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] in +@[simp] theorem insert_tmul (x : X) (w : W) : + insert k D X W (x ⊗ₜ[k] w) = quotient k D X (D ⊗[k] W) (x ⊗ₜ[k] (1 ⊗ₜ[k] w)) := rfl + +theorem descend_insert : (descend k D X W).comp (insert k D X W) = LinearMap.id := by + apply AlgebraTensorModule.ext + intro x w + simp only [LinearMap.comp_apply, insert_tmul, descend_quotient, collapse_tmul, + MulOpposite.op_one, one_smul, LinearMap.id_apply] + +theorem insert_descend : (insert k D X W).comp (descend k D X W) = LinearMap.id := by + apply (relations k D X (D ⊗[k] W)).linearMap_qext + apply AlgebraTensorModule.ext + intro x v + induction v using TensorProduct.inductionOn with + | tmul d w => + change insert k D X W (collapse k D X W (x ⊗ₜ[k] (d ⊗ₜ[k] w))) = + quotient k D X (D ⊗[k] W) (x ⊗ₜ[k] (d ⊗ₜ[k] w)) + rw [collapse_tmul, insert_tmul, balanced] + simp [TensorProduct.smul_tmul'] + | add v w hv hw => simp_all [TensorProduct.tmul_add] + +/-- Genuine X ⊗_D (D ⊗_k W) ≅ X ⊗_k W, with no flatness of X. -/ +def freeEquiv : tensor k D X (D ⊗[k] W) ≃ₗ[D] X ⊗[k] W := + LinearEquiv.ofLinearMap (descend k D X W) (insert k D X W) + (descend_insert k D X W) (insert_descend k D X W) +end DerivedBar.BimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorAcross.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorAcross.lean new file mode 100644 index 0000000000000000000000000000000000000000..c95b80f0219af630e59ed8fca4e4bd121edc141b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorAcross.lean @@ -0,0 +1,91 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleInputNaturality + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {M M' M'' : ModuleCat.{u} (Enveloping k B)} +variable {N N' N'' : ModuleCat.{u} B} + +/-- Tensor a bimodule map and an input map, retaining the outside B-action. -/ +def tensorAcross (f : M ⟶ M') (g : N ⟶ N') : + InputTensor k B M N →ₗ[B] InputTensor k B M' N' := + ((BimoduleBalancedTensor.functor k B (BalancedTensor.ScalarLeftModule k B N')).map f).hom.comp + (inputModuleMap k B M g) + +@[simp] theorem tensorAcross_mk (f : M ⟶ M') (g : N ⟶ N') + (m : BimoduleBalancedTensor.Input k B M) (n : BalancedTensor.ScalarLeftModule k B N) : + tensorAcross f g (BalancedTensor.mk k B _ _ m n) = + BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B M') + (BalancedTensor.ScalarLeftModule k B N') (f.hom m) (g.hom n) := rfl + +@[simp] theorem tensorAcross_comp (f : M ⟶ M') (f' : M' ⟶ M'') + (g : N ⟶ N') (g' : N' ⟶ N'') : + (tensorAcross f' g').comp (tensorAcross f g) = tensorAcross (f ≫ f') (g ≫ g') := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +@[simp] theorem tensorAcross_id : + tensorAcross (𝟙 M) (𝟙 N) = LinearMap.id := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +@[simp] theorem tensorAcross_zero_left (g : N ⟶ N') : + tensorAcross (0 : M ⟶ M') g = 0 := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => + exact LinearMap.congr_fun ((BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B M') + (BalancedTensor.ScalarLeftModule k B N')).map_zero) (g.hom n) + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +@[simp] theorem tensorAcross_zero_right (f : M ⟶ M') : + tensorAcross f (0 : N ⟶ N') = 0 := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => + exact (BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B M') + (BalancedTensor.ScalarLeftModule k B N') (f.hom m)).map_zero + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +variable {P : BiComplex k B} {Z Z' : CochainComplex (ModuleCat.{u} B) ℤ} +variable {a b q r : ℤ} + +theorem tensorAcross_eq_termMap (f : P.X a ⟶ P.X b) (g : Z.X q ⟶ Z'.X r) : + tensorAcross f g = termMap f g := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorFunctor.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..5aed6403ecefcb317bad63e23c6bbfddb5ae6643 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorFunctor.lean @@ -0,0 +1,104 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleBalancedTensor + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.BimoduleBalancedTensor +open ExternalTensor.Section4 +attribute [local instance] inputEnveloping +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (M : ModuleCat.{u} (Enveloping k B)) +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +theorem algebraMap_smul (c : k) (x : Tensor k B M N) : + algebraMap k B c • x = c • x := by + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => + rw [smul_mk] + have he : (algebraMap k B c ⊗ₜ[k] (1 : Bᵐᵒᵖ)) = + algebraMap k (Enveloping k B) c := + (Algebra.TensorProduct.includeLeft : B →ₐ[k] Enveloping k B).commutes c + rw [he] + have hm : algebraMap k (Enveloping k B) c • (m : M) = (c • m : Input k B M) := by + change algebraMap k (Enveloping k B) c • (m : M) = + BimoduleVertex.restriction k B (algebraMap k Bᵐᵒᵖ c) • (m : M) + rw [show BimoduleVertex.restriction k B (algebraMap k Bᵐᵒᵖ c) = + algebraMap k (Enveloping k B) c from + (Algebra.TensorProduct.includeRight : Bᵐᵒᵖ →ₐ[k] Enveloping k B).commutes c] + rw [hm] + exact LinearMap.congr_fun ((BalancedTensor.mk k B (Input k B M) N).map_smul c m) n + | ha x y hx hy => simp_all [smul_add] + +instance scalarTower : IsScalarTower k B (Tensor k B M N) := + IsScalarTower.of_algebraMap_smul (algebraMap_smul k B M N) + +variable {M} {M' : ModuleCat.{u} (Enveloping k B)} +/-- A genuine bimodule map induces a map preserving the full left B action after tensoring. -/ +def map (f : M ⟶ M') : Tensor k B M N →ₗ[B] Tensor k B M' N where + __ := (BalancedTensor.mapLeft (k := k) N ((forgetRight k B).map f).hom).toAddMonoidHom + map_smul' b x := by + induction x using BalancedTensor.induction_on with + | hz => + rw [smul_zero] + exact (map_zero _).trans + ((congrArg (b • ·) (map_zero _)).trans (smul_zero b)).symm + | ht m n => + change BalancedTensor.mk k B (Input k B M') N (f.hom + ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : M))) n = + BalancedTensor.mk k B (Input k B M') N + ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • f.hom m) n + exact congrArg (fun m' => BalancedTensor.mk k B (Input k B M') N m' n) + (f.hom.map_smul (b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) (m : M)) + | ha x y hx hy => + rw [smul_add] + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans + ((smul_add b _ _).symm.trans (congrArg (b • ·) (map_add _ _ _).symm))) + +/-- The actual balanced tensor functor from bimodules to left modules. -/ +def functor : ModuleCat.{u} (Enveloping k B) ⥤ ModuleCat.{u} B where + obj M := ModuleCat.of B (Tensor k B M N) + map f := ModuleCat.ofHom (map k B N f) + map_id M := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + map_comp f g := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +instance additive : (functor k B N).Additive where + map_add := by + intros M M' f g + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => + exact (map_zero _).trans (map_zero _).symm + | ht m n => + change BalancedTensor.mk k B (Input k B M') N (f.hom m + g.hom m) n = _ + exact LinearMap.congr_fun ((BalancedTensor.mk k B (Input k B M') N).map_add _ _) n + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) +end LittleFinitistic.BimoduleBalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorUnderlying.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorUnderlying.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e85937b2f9e762d3c67bafb55948aaacd53af4c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorUnderlying.lean @@ -0,0 +1,44 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorFunctor + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.BimoduleBalancedTensor +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +/-- Forgetting the actual left B action gives exactly the original balanced tensor vector space. -/ +def underlyingEquiv (M : ModuleCat.{u} (Enveloping k B)) : + (ModuleCat.restrictScalars (algebraMap k B)).obj ((functor k B N).obj M) ≃ₗ[k] + (BalancedTensor.tensorFunctor k B N).obj ((forgetRight k B).obj M) where + toFun := id + invFun := id + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' c x := algebraMap_smul k B M N c x + +/-- The comparison is natural, retaining the actual underlying maps and differentials. -/ +def underlyingComparison : functor k B N ⋙ ModuleCat.restrictScalars (algebraMap k B) ≅ + forgetRight k B ⋙ BalancedTensor.tensorFunctor k B N := + NatIso.ofComponents (fun M => (underlyingEquiv k B N M).toModuleIso) (by + intros M M' f + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl) + +/-- Finite input vector spaces give finite balanced tensor spaces. -/ +instance finite (M : ModuleCat.{u} (Enveloping k B)) + [FiniteDimensional k (Input k B M)] [FiniteDimensional k N] : + FiniteDimensional k (Tensor k B M N) := by + dsimp [Tensor] + infer_instance +end LittleFinitistic.BimoduleBalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorVertexBridge.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorVertexBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5da519f686add39c3fc54073f862ab283596cbc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTensorVertexBridge.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Rectification.LeftVertexHomology +import OAI.Algebra.Finitistic.Tensor.BalancedVertexFunctor +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorUnderlying + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleTensorVertexBridge +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +/-- The full B-valued tensor functor has exactly the previously constructed +vertex spaces, with scalar restriction accounted for explicitly. -/ +def equiv (e : B) (M : ModuleCat.{u} (Enveloping k B)) : + (LeftVertexHomology.vertex k B e).obj ((BimoduleBalancedTensor.functor k B N).obj M) ≃ₗ[k] + BalancedVertexFunctor.Space k B e N M where + toFun x := ⟨x.val, (VertexFunctor.mem_fixed (algebraMap k B) e (LeftVertexHomology.scalar_commute k B e) + ((BimoduleBalancedTensor.functor k B N).obj M) x.val).1 x.property⟩ + invFun x := ⟨x.val, (VertexFunctor.mem_fixed (algebraMap k B) e (LeftVertexHomology.scalar_commute k B e) + ((BimoduleBalancedTensor.functor k B N).obj M) x.val).2 x.property⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' c x := Subtype.ext (BimoduleBalancedTensor.algebraMap_smul k B M N c x.val) + +/-- All induced differential and module maps are retained by the comparison. -/ +def comparison (e : B) : BimoduleBalancedTensor.functor k B N ⋙ + LeftVertexHomology.vertex k B e ≅ BalancedVertexFunctor.functor k B e N := + NatIso.ofComponents (fun M => (equiv k B N e M).toModuleIso) (by + intro M M' f + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + rfl) + +/-- An actual chain comparison with the vertex of the full B-module tensor complex. -/ +def complexIso (e : B) (P : BiComplex k B) : + (((LeftVertexHomology.vertex k B e).mapHomologicalComplex (.up ℤ)).obj + (((BimoduleBalancedTensor.functor k B N).mapHomologicalComplex (.up ℤ)).obj P)) ≅ + (((BalancedVertexFunctor.functor k B e N).mapHomologicalComplex (.up ℤ)).obj P) := + HomologicalComplex.Hom.isoOfComponents (fun n => (comparison k B N e).app (P.X n)) + (fun n m _ => ((comparison k B N e).hom.naturality (P.d n m)).symm) +end LittleFinitistic.BimoduleTensorVertexBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalCoefficient.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..e31edf77e25b35c2f9e496005240277e96255d30 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalCoefficient.lean @@ -0,0 +1,97 @@ +import OAI.Algebra.Finitistic.Localization.FiniteSupportReindex +import OAI.Algebra.Finitistic.Bimodule.BimoduleLeftNaturality + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +def coefficient (n a : ℤ) : TotalTerm k B P p Z n →ₗ[B] Term k B P Z a (n + -a) := + FiniteSupportReindex.coefficient (fun a => ModuleCat.of B (Term k B P Z a (n + -a))) p a + +include hp in +@[simp] theorem coefficient_at (n : ℤ) (i : Fin l) (x : TotalTerm k B P p Z n) : + coefficient k B P Z p n (p i) x = x i := + FiniteSupportReindex.coefficient_at + (fun a => ModuleCat.of B (Term k B P Z a (n + -a))) p hp.injective i x + +theorem coefficient_outside (n a : ℤ) (ha : ∀ i, p i ≠ a) : coefficient k B P Z p n a = 0 := + FiniteSupportReindex.coefficient_outside _ p a ha + +theorem term_left_isZero (a q : ℤ) (ha : IsZero (P.X a)) : + IsZero (ModuleCat.of B (Term k B P Z a q)) := + (BimoduleBalancedTensor.functor k B (ComplexTensor.leftTerm k B Z q)).map_isZero ha + +variable (hP : ∀ a, (∀ i, p i ≠ a) → IsZero (P.X a)) + +include hP in +/-- The original total differential, read in any integer left degree, including +zero degrees outside the chosen finite support. -/ +theorem coefficient_d_sum (n a : ℤ) (x : TotalTerm k B P p Z n) : + coefficient k B P Z p (n+1) a (((total k B P p hp Z).d n (n+1)).hom x) = + (show Term k B P Z a ((n+1) + -a) from + ((ComplexTensor.column k B (right k B P) Z a).d n (n+1)).hom + (coefficient k B P Z p n a x)) + + ∑ i : Fin l, entryBetween k B P Z n (n+1) (p i) a rfl (x i) := by + classical + by_cases ha : ∃ i, p i=a + · obtain ⟨i,rfl⟩ := ha + erw [coefficient_at k B P Z p hp,coefficient_at k B P Z p hp] + exact total_d_apply k B P Z p hp n (n+1) rfl x i + · let := ModuleCat.subsingleton_of_isZero + (term_left_isZero k B P Z a ((n+1) + -a) (hP a (by simpa only [not_exists] using ha))) + exact Subsingleton.elim _ _ + +include hp in +/-- The horizontal sum has at most its immediately preceding left-degree component. -/ +theorem horizontal_sum_predecessor (n a : ℤ) (x : TotalTerm k B P p Z n) : + (∑ i : Fin l, entryBetween k B P Z n (n+1) (p i) a rfl (x i)) = + horizontalBetween k B P Z n (n+1) (a-1) a rfl (by omega) + (coefficient k B P Z p n (a-1) x) := by + classical + by_cases ha : ∃ i, p i=a-1 + · obtain ⟨i,hi⟩ := ha + rw [Finset.sum_eq_single i] + · have transfer (b : ℤ) (hb : b=p i) (hba : b+1=a) : + horizontalBetween k B P Z n (n+1) b a rfl hba + (coefficient k B P Z p n b x) = + entryBetween k B P Z n (n+1) (p i) a rfl (x i) := by + subst b + rw [coefficient_at k B P Z p hp] + unfold entryBetween + rw [dite_eq_left hba] + exact (transfer (a-1) hi.symm (by omega)).symm + · intro j _ hji + unfold entryBetween + rw [dite_eq_right (fun h => hji (hp.injective (by omega)))] + rfl + · simp + · have ha' : ∀ i, p i ≠ a-1 := by simpa only [not_exists] using ha + rw [coefficient_outside k B P Z p n (a-1) ha',LinearMap.zero_apply,map_zero] + apply Finset.sum_eq_zero + intro i _ + unfold entryBetween + rw [dite_eq_right (fun h => ha' i (by omega))] + rfl + +include hP in +/-- The complete finite tensor differential consists of its signed vertical term +and its immediately preceding horizontal term. -/ +theorem coefficient_d (n a : ℤ) (x : TotalTerm k B P p Z n) : + coefficient k B P Z p (n+1) a (((total k B P p hp Z).d n (n+1)).hom x) = + (show Term k B P Z a ((n+1) + -a) from + ((ComplexTensor.column k B (right k B P) Z a).d n (n+1)).hom + (coefficient k B P Z p n a x)) + + horizontalBetween k B P Z n (n+1) (a-1) a rfl (by omega) + (coefficient k B P Z p n (a-1) x) := by + rw [coefficient_d_sum k B P Z p hp hP,horizontal_sum_predecessor k B P Z p hp] +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalDifferential.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..d30b521e060a28ebaee81b8a5615f26d728cf573 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalDifferential.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalTermMaps +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +def horizontalBetween (n m a b : ℤ) (h : n+1=m) (hab : a+1=b) : + Term k B P Z a (n + -a) →ₗ[B] Term k B P Z b (m + -b) := + termMap (P.d a b) (eqToHom (congrArg Z.X (show n + -a = m + -b by omega))) + +def entryBetween (n m a b : ℤ) (h : n+1=m) : + Term k B P Z a (n + -a) →ₗ[B] Term k B P Z b (m + -b) := + if hab : a+1=b then horizontalBetween k B P Z n m a b h hab else 0 + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +/-- The exact differential of the B-valued total, in arbitrary consecutive total degrees. -/ +theorem total_d_apply (n m : ℤ) (h : n+1=m) (x : TotalTerm k B P p Z n) (j : Fin l) : + ((total k B P p hp Z).d n m).hom x j = + (show Term k B P Z (p j) (m + -(p j)) from + ((ComplexTensor.column k B (right k B P) Z (p j)).d n m).hom (x j)) + + ∑ i : Fin l, entryBetween k B P Z n m (p i) (p j) h (x i) := by + subst m + change ((ComplexTensor.finiteTotal k B (right k B P) Z p hp).d n (n+1)).hom x j = _ + simp only [ComplexTensor.finiteTotal, FiniteColumnComplex.total, + FiniteColumnComplex.complex_d_hom] + change (show Term k B P Z (p j) ((n+1) + -(p j)) from + ((ComplexTensor.column k B (right k B P) Z (p j)).d n (n+1)).hom (x j)) + + (show Term k B P Z (p j) ((n+1) + -(p j)) from + ComplexTensor.matrix k B (right k B P) Z p n x j) = _ + erw [ComplexTensor.matrix_apply] + congr 1 + apply Finset.sum_congr rfl + intro i _ + unfold entryBetween ComplexTensor.entry + split_ifs with h + · rfl + · rfl +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalFunctor.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6ba417bbfbb7a3b7013a8980ab3555d6287a354 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalFunctor.lean @@ -0,0 +1,141 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalTerms + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +abbrev TotalTerm (n : ℤ) := ∀ i : Fin l, Term k B P Z (p i) (n + -(p i)) +abbrev vectorTotal := ComplexTensor.finiteTotal k B (right k B P) Z p hp + +theorem matrix_smul (n : ℤ) (b : B) (x : TotalTerm k B P p Z n) : + ComplexTensor.matrix k B (right k B P) Z p n (b • x) = + b • (show TotalTerm k B P p Z (n+1) from + ComplexTensor.matrix k B (right k B P) Z p n x) := by + funext j + change ComplexTensor.matrix k B (right k B P) Z p n (b • x) j = + b • (show Term k B P Z (p j) ((n+1) + -(p j)) from + ComplexTensor.matrix k B (right k B P) Z p n x j) + erw [ComplexTensor.matrix_apply, ComplexTensor.matrix_apply] + rw [Finset.smul_sum] + apply Finset.sum_congr rfl + intro i _ + unfold ComplexTensor.entry + split_ifs with h + · exact horizontal_smul k B P Z n (p i) (p j) h b (x i) + · simp + rfl + +theorem differential_smul (n m : ℤ) (b : B) (x : TotalTerm k B P p Z n) : + ((vectorTotal k B P p hp Z).d n m).hom (b • x) = + b • (show TotalTerm k B P p Z m from ((vectorTotal k B P p hp Z).d n m).hom x) := by + by_cases h : n+1=m + · subst m + simp only [vectorTotal, ComplexTensor.finiteTotal, FiniteColumnComplex.total, + FiniteColumnComplex.complex_d_hom] + change (FiniteColumnComplex.diagonal _ n (b • x) + + ComplexTensor.matrix k B (right k B P) Z p n (b • x)) = + b • (show TotalTerm k B P p Z (n+1) from + FiniteColumnComplex.diagonal _ n x + ComplexTensor.matrix k B (right k B P) Z p n x) + funext i + exact (congrArg₂ HAdd.hAdd + (column_d_smul k B P Z (p i) n (n+1) b (x i)) + (congrFun (matrix_smul k B P p Z n b x) i)).trans + (smul_add b + (show Term k B P Z (p i) ((n+1) + -(p i)) from + ((ComplexTensor.column k B (right k B P) Z (p i)).d n (n+1)).hom (x i)) + (show Term k B P Z (p i) ((n+1) + -(p i)) from + ComplexTensor.matrix k B (right k B P) Z p n x i)).symm + · have hz := (vectorTotal k B P p hp Z).shape n m h + rw [hz] + change (0 : TotalTerm k B P p Z m) = b • (0 : TotalTerm k B P p Z m) + funext i + exact (smul_zero b : b • (0 : Term k B P Z (p i) (m + -(p i))) = 0).symm + +/-- The same signed finite tensor total, retaining the full left B action. -/ +def total : CochainComplex (ModuleCat.{u} B) ℤ where + X n := ModuleCat.of B (TotalTerm k B P p Z n) + d n m := ModuleCat.ofHom + { __ := ((vectorTotal k B P p hp Z).d n m).hom.toAddMonoidHom + map_smul' := differential_smul k B P p hp Z n m } + shape n m h := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact congrArg (fun f => f.hom x) ((vectorTotal k B P p hp Z).shape n m h) + d_comp_d' n m t _ _ := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact congrArg (fun f => f.hom x) ((vectorTotal k B P p hp Z).d_comp_d n m t) + +variable {Z} {Z' Z'' : CochainComplex (ModuleCat.{u} B) ℤ} + +/-- The original input tensor map is B-linear in every degree. -/ +def totalMap (f : Z ⟶ Z') : total k B P p hp Z ⟶ total k B P p hp Z' where + f n := ModuleCat.ofHom + { __ := ((ComplexTensor.finiteTotalMap k B (right k B P) p hp f).f n).hom.toAddMonoidHom + map_smul' := by + intro b x + funext i + change ((ComplexTensor.finiteTotalMap k B (right k B P) p hp f).f n).hom (b • x) i = + b • (show Term k B P Z' (p i) (n + -(p i)) from + ((ComplexTensor.finiteTotalMap k B (right k B P) p hp f).f n).hom x i) + erw [ComplexTensor.finiteTotalMap_apply,ComplexTensor.finiteTotalMap_apply] + exact inputMap_smul k B P f (p i) (n + -(p i)) b (x i) } + comm' n m _ := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact congrArg (fun g => g.hom x) + ((ComplexTensor.finiteTotalMap k B (right k B P) p hp f).comm n m) + +/-- Tensoring with the fixed bimodule complex acts on every left-module complex. -/ +def functor : CochainComplex (ModuleCat.{u} B) ℤ ⥤ CochainComplex (ModuleCat.{u} B) ℤ where + obj Z := total k B P p hp Z + map f := totalMap k B P p hp f + map_id Z := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact congrArg (fun f => (f.f n).hom x) + ((ComplexTensor.finiteTotalFunctor k B (right k B P) p hp).map_id Z) + map_comp f g := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact congrArg (fun f => (f.f n).hom x) + ((ComplexTensor.finiteTotalFunctor k B (right k B P) p hp).map_comp f g) + +instance additive : (functor k B P p hp).Additive where + map_add {Z Z'} {f g} := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext i + change ((ComplexTensor.finiteTotalMap k B (right k B P) p hp (f+g)).f n).hom x i = + ((ComplexTensor.finiteTotalMap k B (right k B P) p hp f).f n).hom x i + + ((ComplexTensor.finiteTotalMap k B (right k B P) p hp g).f n).hom x i + erw [ComplexTensor.finiteTotalMap_apply, ComplexTensor.finiteTotalMap_apply, ComplexTensor.finiteTotalMap_apply] + induction x i using BalancedTensor.induction_on with + | hz => + simp + exact (zero_add _).symm + | ht a b => exact (BalancedTensor.mk k B _ _ a).map_add _ _ + | ha a b ha hb => simp_all [map_add]; abel +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalInsertion.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalInsertion.lean new file mode 100644 index 0000000000000000000000000000000000000000..2897e993b37ca07d2dcfb12b5ee63277eaa114ef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalInsertion.lean @@ -0,0 +1,95 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalCoefficient + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +/-- Insert one actual left-degree component into the finite total. -/ +def insertion (n a : ℤ) : Term k B P Z a (n + -a) →ₗ[B] TotalTerm k B P p Z n := by + classical + exact LinearMap.pi (fun i => if h : p i=a then + (eqToHom (congrArg (fun a => ModuleCat.of B (Term k B P Z a (n + -a))) h.symm)).hom else 0) + +@[simp] theorem insertion_same (n : ℤ) (i : Fin l) (y : Term k B P Z (p i) (n + -(p i))) : + insertion k B P Z p n (p i) y i = y := by + classical + simp [insertion] + +theorem insertion_other (n a : ℤ) (i : Fin l) (h : p i ≠ a) (y : Term k B P Z a (n + -a)) : + insertion k B P Z p n a y i = 0 := by + classical + simp only [insertion,LinearMap.pi_apply,dite_eq_right h,LinearMap.zero_apply] + +include hp in +theorem coefficient_insertion_other (n a b : ℤ) (h : b ≠ a) (y : Term k B P Z a (n + -a)) : + coefficient k B P Z p n b (insertion k B P Z p n a y) = 0 := by + classical + by_cases hb : ∃ i, p i=b + · obtain ⟨i,rfl⟩ := hb + rw [coefficient_at k B P Z p hp] + exact insertion_other k B P Z p n a i h y + · rw [coefficient_outside k B P Z p n b (by simpa only [not_exists] using hb),LinearMap.zero_apply] + +variable (hP : ∀ a, (∀ i, p i ≠ a) → IsZero (P.X a)) + +include hp hP in +theorem coefficient_insertion_self (n a : ℤ) (y : Term k B P Z a (n + -a)) : + coefficient k B P Z p n a (insertion k B P Z p n a y) = y := by + classical + by_cases ha : ∃ i, p i=a + · obtain ⟨i,rfl⟩ := ha + rw [coefficient_at k B P Z p hp,insertion_same] + · let := ModuleCat.subsingleton_of_isZero + (term_left_isZero k B P Z a (n + -a) (hP a (by simpa only [not_exists] using ha))) + exact Subsingleton.elim _ _ + +include hP in +theorem coefficient_d_between (n m : ℤ) (h : n+1=m) (a : ℤ) (x : TotalTerm k B P p Z n) : + coefficient k B P Z p m a (((total k B P p hp Z).d n m).hom x) = + (show Term k B P Z a (m + -a) from + ((ComplexTensor.column k B (right k B P) Z a).d n m).hom + (coefficient k B P Z p n a x)) + + horizontalBetween k B P Z n m (a-1) a h (by omega) + (coefficient k B P Z p n (a-1) x) := by + subst m + exact coefficient_d k B P Z p hp hP n a x + +include hP in +/-- A correction inserted in degree a cannot affect total coordinates above a+1. -/ +theorem coefficient_d_insertion_above (n m : ℤ) (h : n+1=m) (a b : ℤ) (hab : a+1 exact addHom_smul_zero F b + | ht m n => rfl + | ha x y hx hy => exact addHom_smul_add F b x y hx hy } + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +def totalTermEquiv (n : ℤ) : + BimoduleComplexTensor.totalTerm k B B P Z p n ≃ₗ[B] + BimoduleTotal.TotalTerm k B P p Z n := + LinearEquiv.piCongrRight (fun i => termEquiv k B P Z (p i) (n + -(p i))) + +/-- The two signed totals coincide through their actual tensor-summand equivalences. -/ +def totalIso : BimoduleComplexTensor.total k B B P Z p hp ≅ + BimoduleTotal.total k B P p hp Z := + HomologicalComplex.Hom.isoOfComponents (fun n => (totalTermEquiv k B P Z p n).toModuleIso) (by + intro n m h + change n + 1 = m at h + subst m + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + have h := congrArg (fun f => f.hom x) + ((BimoduleComplexTensor.forgetTotalIso k B B P Z p hp).hom.comm n (n+1)) + exact h) + +variable {Z} {Z' : CochainComplex (ModuleCat.{u} B) ℤ} +theorem totalIso_natural (f : Z ⟶ Z') : + BimoduleComplexTensor.totalMap k B B P f p hp ≫ (totalIso k B P Z' p hp).hom = + (totalIso k B P Z p hp).hom ≫ BimoduleTotal.totalMap k B P p hp f := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact BimoduleComplexTensor.forget_totalInputMap k B B P f p hp n x + +/-- Natural comparison on all input complexes, with the complete outside action. -/ +def totalFunctorIso : BimoduleComplexTensor.totalFunctor k B B P p hp ≅ + BimoduleTotal.functor k B P p hp := + NatIso.ofComponents (fun Z => totalIso k B P Z p hp) + (fun f => totalIso_natural k B P p hp f) +end LittleFinitistic.BimoduleTotalPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalShortExact.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalShortExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4ac745e3c7cf132c364adc44c4f681f511cf8d8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalShortExact.lean @@ -0,0 +1,94 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleLeftNaturality +import OAI.Algebra.Finitistic.Bimodule.BimoduleExactRows +import Mathlib.Algebra.Homology.HomologicalComplexAbelian + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) [∀ q, Projective (Z.X q)] +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +/-- Fixed-input finite tensor total as an actual functor on bimodule complexes. -/ +def leftTotalFunctor : BiComplex k B ⥤ CochainComplex (ModuleCat.{u} B) ℤ where + obj P := total k B P p hp Z + map f := leftTotalMap f Z p hp + map_id _ := leftTotalMap_id p hp Z + map_comp f g := leftTotalMap_comp p hp f g Z + +instance leftTotalFunctor_preservesZeroMorphisms : (leftTotalFunctor k B Z p hp).PreservesZeroMorphisms where + map_zero := by + intros P P' + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + funext i + change tensorAcross (0 : P.X (p i) ⟶ P'.X (p i)) (𝟙 (Z.X (n + -(p i)))) (x i) = 0 + rw [tensorAcross_zero_left,LinearMap.zero_apply] + +/-- Short exact sequences of bimodules remain short exact after the finite total +on an input complex of projective left modules. -/ +theorem leftTotal_shortExact (S : ShortComplex (BiComplex k B)) (hS : S.ShortExact) : + (S.map (leftTotalFunctor k B Z p hp)).ShortExact := by + let := hS.mono_f + let := hS.epi_g + apply HomologicalComplex.shortExact_of_degreewise_shortExact + intro n + have hs (i : Fin l) : + ((S.map (HomologicalComplex.eval _ (.up ℤ) (p i))).map + (BimoduleBalancedTensor.functor k B (ComplexTensor.leftTerm k B Z (n + -(p i))))).ShortExact := by + let : Module.Projective B (ComplexTensor.leftTerm k B Z (n + -(p i))) := + inferInstanceAs (Module.Projective B (Z.X (n + -(p i)))) + let := BimoduleBalancedTensor.projectiveInput_preservesHomology k B + (ComplexTensor.leftTerm k B Z (n + -(p i))) + let F := BimoduleBalancedTensor.functor k B (ComplexTensor.leftTerm k B Z (n + -(p i))) + let := Functor.preservesMonomorphisms_of_map_exact F + (BimoduleBalancedTensor.projectiveInput_mapsExact k B _) + let := Functor.preservesEpimorphisms_of_map_exact F + (BimoduleBalancedTensor.projectiveInput_mapsExact k B _) + have hSe := hS.map (HomologicalComplex.eval _ (.up ℤ) (p i)) + let := hSe.mono_f + let := hSe.epi_g + exact hSe.map F + have hf (i : Fin l) : Function.Injective + (leftTermMap S.f Z (p i) (n + -(p i))) := by + have := (hs i).mono_f + rw [leftTermMap,tensorAcross_right_id] + exact (ModuleCat.mono_iff_injective + ((BimoduleBalancedTensor.functor k B (ComplexTensor.leftTerm k B Z (n + -(p i)))).map (S.f.f (p i)))).mp (hs i).mono_f + have hg (i : Fin l) : Function.Surjective + (leftTermMap S.g Z (p i) (n + -(p i))) := by + have := (hs i).epi_g + rw [leftTermMap,tensorAcross_right_id] + exact (ModuleCat.epi_iff_surjective + ((BimoduleBalancedTensor.functor k B (ComplexTensor.leftTerm k B Z (n + -(p i)))).map (S.g.f (p i)))).mp (hs i).epi_g + have he (i : Fin l) : Function.Exact + (leftTermMap S.f Z (p i) (n + -(p i))) + (leftTermMap S.g Z (p i) (n + -(p i))) := by + rw [leftTermMap,leftTermMap,tensorAcross_right_id,tensorAcross_right_id] + exact (ShortComplex.ShortExact.moduleCat_exact_iff_function_exact _).mp (hs i).exact + refine { exact := ?_, mono_f := ?_, epi_g := ?_ } + · rw [ShortComplex.moduleCat_exact_iff] + intro y hy + have hyi (i : Fin l) : leftTermMap S.g Z (p i) (n + -(p i)) (y i) = 0 := + congrArg (fun x => x i) hy + choose x hx using fun i => (he i (y i)).mp (hyi i) + exact ⟨x,funext hx⟩ + · rw [ModuleCat.mono_iff_injective] + intro x y h + funext i + exact hf i (congrArg (fun x => x i) h) + · rw [ModuleCat.epi_iff_surjective] + intro y + choose x hx using fun i => hg i (y i) + exact ⟨x,funext hx⟩ +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalTermMaps.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalTermMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..346dbdf7f8c677842a5a04660b9762f5c36f567c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalTermMaps.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalTerms + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {P : BiComplex k B} {Z Z' Z'' : CochainComplex (ModuleCat.{u} B) ℤ} +variable {p p' p'' q q' q'' : ℤ} + +def termMap (f : P.X p ⟶ P.X p') (g : Z.X q ⟶ Z'.X q') : + Term k B P Z p q →ₗ[B] Term k B P Z' p' q' where + __ := (@BalancedTensor.bimap k B + (ComplexTensor.rightTerm k B (right k B P) p) + (ComplexTensor.rightTerm k B (right k B P) p') + (ComplexTensor.leftTerm k B Z q) (ComplexTensor.leftTerm k B Z' q') _ _ _ + _ _ _ (BalancedTensor.scalarLeftTower k Bᵐᵒᵖ ((right k B P).X p)) + _ _ _ (BalancedTensor.scalarLeftTower k Bᵐᵒᵖ ((right k B P).X p')) + _ _ _ (BalancedTensor.scalarLeftTower k B (Z.X q)) + _ _ _ (BalancedTensor.scalarLeftTower k B (Z'.X q')) + ((forgetRight k B).map f).hom g.hom).toAddMonoidHom + map_smul' := bimap_smul f g + +@[simp] theorem termMap_comp + (f : P.X p ⟶ P.X p') (f' : P.X p' ⟶ P.X p'') + (g : Z.X q ⟶ Z'.X q') (g' : Z'.X q' ⟶ Z''.X q'') : + (termMap f' g').comp (termMap f g) = termMap (f ≫ f') (g ≫ g') := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + + +@[simp] theorem termMap_id : termMap (𝟙 (P.X p)) (𝟙 (Z.X q)) = LinearMap.id := by + apply LinearMap.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +/-- Right-degree transport keeps the actual balanced tensor and the full left action. -/ +def rightDegreeIso (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) + (p q q' : ℤ) (h : q=q') : + ModuleCat.of B (Term k B P Z p q) ≅ ModuleCat.of B (Term k B P Z p q') := + eqToIso (congrArg (fun q => ModuleCat.of B (Term k B P Z p q)) h) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalTerms.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6c55e69245f11ee65a1ebc5d4a31d839ca63d32 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalTerms.lean @@ -0,0 +1,99 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorDerivedFunctor +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorUnderlying + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +attribute [local instance] BimoduleBalancedTensor.inputEnveloping +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +abbrev right (P : BiComplex k B) : RightComplex B := + ((forgetRight k B).mapHomologicalComplex (.up ℤ)).obj P + +abbrev Term (P : BiComplex k B) (Z : CochainComplex (ModuleCat.{u} B) ℤ) (p q : ℤ) := + BimoduleBalancedTensor.Tensor k B (P.X p) (ComplexTensor.leftTerm k B Z q) + +variable {k B} +variable {P : BiComplex k B} {Z Z' : CochainComplex (ModuleCat.{u} B) ℤ} +variable {p p' q q' : ℤ} + +/-- Balanced tensor maps retain the original outside left B action. -/ +theorem bimap_smul (f : P.X p ⟶ P.X p') (g : Z.X q ⟶ Z'.X q') + (b : B) (x : Term k B P Z p q) : + @BalancedTensor.bimap k B + (ComplexTensor.rightTerm k B (right k B P) p) + (ComplexTensor.rightTerm k B (right k B P) p') + (ComplexTensor.leftTerm k B Z q) (ComplexTensor.leftTerm k B Z' q') _ _ _ + _ _ _ (BalancedTensor.scalarLeftTower k Bᵐᵒᵖ ((right k B P).X p)) + _ _ _ (BalancedTensor.scalarLeftTower k Bᵐᵒᵖ ((right k B P).X p')) + _ _ _ (BalancedTensor.scalarLeftTower k B (Z.X q)) + _ _ _ (BalancedTensor.scalarLeftTower k B (Z'.X q')) + ((forgetRight k B).map f).hom g.hom (b • x) = + b • (show Term k B P Z' p' q' from @BalancedTensor.bimap k B + (ComplexTensor.rightTerm k B (right k B P) p) + (ComplexTensor.rightTerm k B (right k B P) p') + (ComplexTensor.leftTerm k B Z q) (ComplexTensor.leftTerm k B Z' q') _ _ _ + _ _ _ (BalancedTensor.scalarLeftTower k Bᵐᵒᵖ ((right k B P).X p)) + _ _ _ (BalancedTensor.scalarLeftTower k Bᵐᵒᵖ ((right k B P).X p')) + _ _ _ (BalancedTensor.scalarLeftTower k B (Z.X q)) + _ _ _ (BalancedTensor.scalarLeftTower k B (Z'.X q')) + ((forgetRight k B).map f).hom g.hom x) := by + induction x using BalancedTensor.induction_on with + | hz => + rw [smul_zero] + exact (map_zero _).trans + ((congrArg (fun y : Term k B P Z' p' q' => b • y) (map_zero _)).trans + (smul_zero b : b • (0 : Term k B P Z' p' q') = 0)).symm + | ht m n => + change BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P.X p')) + (ComplexTensor.leftTerm k B Z' q') (f.hom ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (m : P.X p))) (g.hom n) = + BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P.X p')) + (ComplexTensor.leftTerm k B Z' q') ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (f.hom m : P.X p')) (g.hom n) + exact congrArg (fun m' => BalancedTensor.mk k B (BimoduleBalancedTensor.Input k B (P.X p')) + (ComplexTensor.leftTerm k B Z' q') m' (g.hom n)) + (f.hom.map_smul (b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) (m : P.X p)) + | ha x y hx hy => + rw [smul_add] + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans + ((smul_add b (show Term k B P Z' p' q' from _) + (show Term k B P Z' p' q' from _)).symm.trans + (congrArg (fun y : Term k B P Z' p' q' => b • y) (map_add _ _ _).symm))) + +variable (k B P Z) + +theorem horizontal_smul (n p p' : ℤ) (h : p+1=p') (b : B) + (x : Term k B P Z p (n + -p)) : + ComplexTensor.horizontal k B (right k B P) Z n p p' h (b • x) = + b • (show Term k B P Z p' ((n+1) + -p') from + ComplexTensor.horizontal k B (right k B P) Z n p p' h x) := + bimap_smul (P.d p p') (eqToHom (congrArg Z.X (show n + -p = (n+1) + -p' by omega))) b x + +theorem column_d_smul (p n m : ℤ) (b : B) + (x : Term k B P Z p (n + -p)) : + ((ComplexTensor.column k B (right k B P) Z p).d n m).hom (b • x) = + b • (show Term k B P Z p (m + -p) from + ((ComplexTensor.column k B (right k B P) Z p).d n m).hom x) := by + rw [ComplexTensor.column_d] + change (-p).negOnePow • (ComplexTensor.map k B (right k B P) Z (𝟙 _) (Z.d _ _) (b • x)) = + b • ((-p).negOnePow • (show Term k B P Z p (m + -p) from + ComplexTensor.map k B (right k B P) Z (𝟙 _) (Z.d _ _) x)) + rw [show ComplexTensor.map k B (right k B P) Z (𝟙 _) (Z.d _ _) (b • x) = + b • (show Term k B P Z p (m + -p) from + ComplexTensor.map k B (right k B P) Z (𝟙 _) (Z.d _ _) x) from + bimap_smul (𝟙 (P.X p)) (Z.d _ _) b x] + exact smul_comm _ _ _ + +variable {Z} +theorem inputMap_smul (f : Z ⟶ Z') (p q : ℤ) (b : B) (x : Term k B P Z p q) : + ComplexTensor.inputMap k B (right k B P) f p q (b • x) = + b • (show Term k B P Z' p q from ComplexTensor.inputMap k B (right k B P) f p q x) := + bimap_smul (𝟙 (P.X p)) (f.f q) b x +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalUnderlying.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalUnderlying.lean new file mode 100644 index 0000000000000000000000000000000000000000..58deea22443e6da04fd188eb510c65ae99a4a689 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleTotalUnderlying.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTotalFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (P : BiComplex k B) {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +abbrev forget := (ModuleCat.restrictScalars (algebraMap k B)).mapHomologicalComplex (.up ℤ) + +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +def underlyingTerm (n : ℤ) : + ((forget k B).obj (total k B P p hp Z)).X n ≃ₗ[k] + (vectorTotal k B P p hp Z).X n where + toFun := id + invFun := id + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' c x := by + funext i + exact BimoduleBalancedTensor.algebraMap_smul k B (P.X (p i)) + (ComplexTensor.leftTerm k B Z (n + -(p i))) c (x i) + +/-- Forgetting the full left action recovers the frozen signed tensor total with its actual differential. -/ +def underlyingIso : (forget k B).obj (total k B P p hp Z) ≅ vectorTotal k B P p hp Z := + HomologicalComplex.Hom.isoOfComponents (fun n => (underlyingTerm k B P p hp Z n).toModuleIso) + (by intros n m h; apply ModuleCat.hom_ext; apply LinearMap.ext; intro x; rfl) + +/-- The comparison preserves the original maps in the arbitrary input complex. -/ +def underlyingComparison : + functor k B P p hp ⋙ forget k B ≅ ComplexTensor.finiteTotalFunctor k B (right k B P) p hp := + NatIso.ofComponents (underlyingIso k B P p hp) (by + intros Z Z' f + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl) + +instance restrictPreservesHomology : + (ModuleCat.restrictScalars (algebraMap k B)).PreservesHomology := + Functor.preservesHomology_of_map_exact _ (fun S hS => by + rw [ShortComplex.moduleCat_exact_iff] at hS ⊢ + exact hS) + +/-- The frozen K-flatness proof applies to the total with its complete B action. -/ +theorem totalMap_quasiIso + [∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (p i))] + {Z Z' : CochainComplex (ModuleCat.{u} B) ℤ} (f : Z ⟶ Z') [QuasiIso f] : + QuasiIso (totalMap k B P p hp f) := by + apply (HomologicalComplex.quasiIso_map_iff_of_preservesHomology + (totalMap k B P p hp f) (ModuleCat.restrictScalars (algebraMap k B))).mp + let e : Arrow.mk ((forget k B).map (totalMap k B P p hp f)) ≅ + Arrow.mk (ComplexTensor.finiteTotalMap k B (right k B P) p hp f) := Arrow.isoMk (underlyingIso k B P p hp Z) (underlyingIso k B P p hp Z') + ((underlyingComparison k B P p hp).hom.naturality f).symm + apply (quasiIso_iff_of_arrow_mk_iso _ _ e).mpr + exact ComplexTensor.finiteTotalMap_quasiIso k B (right k B P) f p hp +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleVertex.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleVertex.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3cb1e1ee34aac2dbc783dc9d7cbe6ce37656346 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BimoduleVertex.lean @@ -0,0 +1,89 @@ +import OAI.Algebra.Finitistic.Rectification.VertexFunctor +import OAI.Algebra.Finitistic.Rectification.CornerTensor +import OAI.Algebra.Finitistic.Rectification.ColumnComplex + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.BimoduleVertex + +section +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +abbrev restriction : Bᵐᵒᵖ →+* B ⊗[k] Bᵐᵒᵖ := + Algebra.TensorProduct.includeRight.toRingHom +abbrev vertex (e : B) : B ⊗[k] Bᵐᵒᵖ := e ⊗ₜ[k] 1 + +theorem vertex_idempotent (e : B) (he : e*e=e) : + vertex k B e * vertex k B e = vertex k B e := by + simp [vertex,Algebra.TensorProduct.tmul_mul_tmul,he] + +theorem vertex_commute (e : B) (b : Bᵐᵒᵖ) : + vertex k B e * restriction k B b = restriction k B b * vertex k B e := by + simp [vertex,restriction,Algebra.TensorProduct.tmul_mul_tmul] + +/-- The original left vertex action, with the right B-module structure retained. -/ +abbrev functor (e : B) : ModuleCat.{u} (B ⊗[k] Bᵐᵒᵖ) ⥤ ModuleCat.{u} Bᵐᵒᵖ := + VertexFunctor.functor (restriction k B) (vertex k B e) (vertex_commute k B e) + +theorem map_shortExact (e : B) (he : e*e=e) + (S : ShortComplex (ModuleCat.{u} (B ⊗[k] Bᵐᵒᵖ))) (hS : S.ShortExact) : + (S.map (functor k B e)).ShortExact := + VertexFunctor.map_shortExact _ _ (vertex_idempotent k B e he) _ S hS + +end +universe u +variable {k : Type u} [Field k] +variable {V W U : Type u} [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +local notation "T" => ThreeVertexAlgebra μ +variable (N : ModuleCat.{u} (ThreeVertexAlgebra μ)ᵐᵒᵖ) +attribute [local instance] ExternalTensor.Section4.rightModuleK + ExternalTensor.rightModule ExternalTensor.bimodule + +abbrev columnObj (j : Fin 3) : ModuleCat.{u} (T ⊗[k] Tᵐᵒᵖ) := + ModuleCat.of _ (ExternalTensor.Column k T N (ThreeVertexAlgebra.vertex μ j)) +abbrev columnFixed (i j : Fin 3) := + VertexFunctor.fixed (restriction k T) (vertex k T (ThreeVertexAlgebra.vertex μ i)) + (vertex_commute k T (ThreeVertexAlgebra.vertex μ i)) (columnObj μ N j) + +/-- Identifies the original enveloping vertex action with its corner projector. -/ +def columnFixedEquiv (i j : Fin 3) : + columnFixed μ N i j ≃ₗ[Tᵐᵒᵖ] + TensorProjection.fixed (B := T) (N := N) (CornerProjection.projection μ i j) := by + refine + { toFun := fun x => ⟨x.val, ?_⟩ + invFun := fun x => ⟨x.val, ?_⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun b x => ?_ } + · apply (CornerTensor.fixed_iff_left_action μ N i j _).2 + have hx := (VertexFunctor.mem_fixed _ _ _ _ x.val).1 x.property + change (ThreeVertexAlgebra.vertex μ i ⊗ₜ[k] (1 : Tᵐᵒᵖ)) • x.val = x.val at hx + exact (ExternalTensor.left_eq_enveloping k T + (ExternalTensor.leftIdeal T (ThreeVertexAlgebra.vertex μ j)) N + (ThreeVertexAlgebra.vertex μ i) x.val).trans hx + · apply Subtype.ext + exact (ExternalTensor.right_eq_enveloping k T + (ExternalTensor.leftIdeal T (ThreeVertexAlgebra.vertex μ j)) N b x.val).symm + + · apply (VertexFunctor.mem_fixed _ _ _ _ _).2 + have hx := (CornerTensor.fixed_iff_left_action μ N i j x.val).1 x.property + exact (ExternalTensor.left_eq_enveloping k T + (ExternalTensor.leftIdeal T (ThreeVertexAlgebra.vertex μ j)) N + (ThreeVertexAlgebra.vertex μ i) x.val).symm.trans hx +/-- A column's own vertex is its original right module, with no replacement action. -/ +def diagonalEquiv (i : Fin 3) : + (functor k T (ThreeVertexAlgebra.vertex μ i)).obj + ((ExternalTensor.Section4.columnFunctor k T + (ThreeVertexAlgebra.vertex μ i)).obj N) ≃ₗ[Tᵐᵒᵖ] N := + (columnFixedEquiv μ N i i).trans (CornerTensor.diagonalColumnEquiv μ N i) +end LittleFinitistic.BimoduleVertex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Bimodule/BoundedBimoduleDerived.lean b/lean/OAI/Algebra/Finitistic/Bimodule/BoundedBimoduleDerived.lean new file mode 100644 index 0000000000000000000000000000000000000000..61a5b9c81eff086b7c4f07efd594cef2d90cc50a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Bimodule/BoundedBimoduleDerived.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleSingleEvaluation +import OAI.Algebra.Finitistic.Rectification.InducedDerivedFunctor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +/-- Exactly the bounded-right-projective data needed to compute tensor on every complex. -/ +structure BoundedProjective (P : BiComplex k B) where + lower : ℤ + upper : ℤ + bounded : ∀ n, n < lower ∨ upper < n → IsZero (P.X n) + projective : ∀ n, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) n) + +namespace BoundedProjective +variable {k B} {P : BiComplex k B} (data : BoundedProjective k B P) + +abbrev degrees := intervalDegrees data.lower data.upper + +theorem complete (n : ℤ) (hn : ∀ i, data.degrees i ≠ n) : IsZero (P.X n) := + outside_interval_isZero k B P data.lower data.upper data.bounded n hn + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + +/-- The native derived tensor endofunctor of this one fixed bounded projective bimodule complex. -/ +def derived : DerivedCategory (ModuleCat.{u} B) ⥤ DerivedCategory (ModuleCat.{u} B) := by + letI : ∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + exact BimoduleTotal.derived k B P data.degrees (intervalDegrees_strictMono data.lower data.upper) + +instance additive : data.derived.Additive := by + let : ∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + exact BimoduleTotal.derived_additive k B P data.degrees (intervalDegrees_strictMono data.lower data.upper) + +def comparison : DerivedCategory.Q ⋙ data.derived ≅ + BimoduleTotal.functor k B P data.degrees (intervalDegrees_strictMono data.lower data.upper) ⋙ DerivedCategory.Q := by + letI : ∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + exact derivedComparison k B P data.degrees (intervalDegrees_strictMono data.lower data.upper) + +/-- Agreement with the canonical native degree-zero evaluation, including its full B action. -/ +def singleEvaluation (N : ModuleCat.{u} B) : + data.derived.obj (DerivedCategory.Q.obj (singleInput B N)) ≅ + DerivedCategory.Q.obj (moduleEvaluation k B P N) := by + letI : ∀ i, Module.Projective Bᵐᵒᵖ (ComplexTensor.rightTerm k B (right k B P) (data.degrees i)) := + fun i => data.projective (data.degrees i) + exact derivedSingleEvaluation k B P N data.degrees + (intervalDegrees_strictMono data.lower data.upper) data.complete +end BoundedProjective +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDAllSimples.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDAllSimples.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c57d70f2f3711f24ad60d20a3458e5c9fbde6f3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDAllSimples.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Dimension.PDResidueSemisimple +import OAI.Algebra.Finitistic.Dimension.PDSimpleTensor +import OAI.Algebra.Finitistic.Dimension.PDLowerBound +import OAI.Algebra.Finitistic.Tensor.BalancedTensorMaps + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open CategoryTheory CategoryTheory.Limits Submodule +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] + +/-- A nonzero finite module is detected by tensor with an actual simple right +submodule of A/rad A. This is an existence proof, not an assumed simple detector. -/ +theorem exists_simple_tensor_nonzero + (N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + [Module.Finite A N] [Nontrivial N] : + ∃ S : Submodule Aᵐᵒᵖ (Residue (A := A)), IsSimpleModule Aᵐᵒᵖ S ∧ + ¬ Subsingleton (BalancedTensor.Tensor k A S N) := by + have := residue_semisimple (k := k) (A := A) + by_contra h + have hS (S : Submodule Aᵐᵒᵖ (Residue (A := A))) (hs : IsSimpleModule Aᵐᵒᵖ S) : + Subsingleton (BalancedTensor.Tensor k A S N) := by + by_contra hn + exact h ⟨S, hs, hn⟩ + let K : Submodule Aᵐᵒᵖ (Residue (A := A)) := + { carrier := {u | ∀ n : N, BalancedTensor.mk k A (Residue (A := A)) N u n=0} + zero_mem' := fun n => LinearMap.congr_fun (map_zero (BalancedTensor.mk k A (Residue (A := A)) N)) n + add_mem' := fun hu hv n => by + change (BalancedTensor.mk k A (Residue (A := A)) N ( _ + _)) n=0 + rw [map_add, LinearMap.add_apply, hu, hv, add_zero] + smul_mem' := fun a u hu n => by + rw [show a = MulOpposite.op a.unop from rfl, BalancedTensor.balance] + exact hu _ } + have hK : (⊤ : Submodule Aᵐᵒᵖ (Residue (A := A))) ≤ K := by + rw [← IsSemisimpleModule.sSup_simples_eq_top Aᵐᵒᵖ (Residue (A := A))] + apply sSup_le + intro S hs u hu n + let f := BalancedTensor.mapLeft (k := k) N S.subtype + have hz : BalancedTensor.mk k A S N ⟨u,hu⟩ n = 0 := (hS S hs).elim _ _ + have hz' := congrArg f hz + simpa [f] using hz' + have hz (z : BalancedTensor.Tensor k A (Residue (A := A)) N) : z=0 := by + induction z using BalancedTensor.induction_on with + | hz => rfl + | ht u n => exact hK mem_top n + | ha x y hx hy => rw [hx,hy,add_zero] + have := residueTensor_nontrivial (k := k) (A := A) N + obtain ⟨x,y,hxy⟩ := exists_pair_ne (BalancedTensor.Tensor k A (Residue (A := A)) N) + exact hxy ((hz x).trans (hz y).symm) + +variable (M : PDMinimal.FiniteModule k A) + +/-- The exact simple-module form of projective-dimension detection. The test +modules here are actual simple right submodules of the fixed radical quotient. -/ +theorem pdLE_iff_simpleTor_zero (n : ℕ) : + HasProjectiveDimensionLE M.cat n ↔ + ∀ S : Submodule Aᵐᵒᵖ (Residue (A := A)), IsSimpleModule Aᵐᵒᵖ S → + IsZero (Tor (k := k) S M.cat (n+1)) := by + constructor + · intro h S _ + exact tor_zero_of_pdLT S M (n+1) h + · intro h + apply (PDMinimal.pdLE_iff_term_zero M n).mpr + by_contra ht + have : Nontrivial (PDMinimal.term M (n+1)) := not_subsingleton_iff_nontrivial.mp ht + have : Nontrivial (ScalarModule k A (PDMinimal.term M (n+1)).cat) := + show Nontrivial (PDMinimal.term M (n+1)) from inferInstance + have : Module.Finite A (ScalarModule k A (PDMinimal.term M (n+1)).cat) := + show Module.Finite A (PDMinimal.term M (n+1)) from inferInstance + obtain ⟨S, hS, hnonzero⟩ := exists_simple_tensor_nonzero (k := k) (A := A) + (ScalarModule k A (PDMinimal.term M (n+1)).cat) + have := hS + have hz := (h S hS).of_iso (simpleTorIsoTerm S M (n+1)).symm + exact hnonzero (ModuleCat.isZero_iff_subsingleton.mp hz) +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDBalancedRight.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDBalancedRight.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5860a9a40de14d1c3e297da5e80a45c2e0bcd24 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDBalancedRight.lean @@ -0,0 +1,75 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedTensor +import Mathlib.RingTheory.Jacobson.Radical +import Mathlib.Algebra.Algebra.Opposite + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open LinearMap Submodule +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] +variable {M N : Type u} [AddCommGroup M] [Module k M] [Module A M] + [IsScalarTower k A M] [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +def mapRight (f : M →ₗ[A] N) : BalancedTensor.Tensor k A U M →ₗ[k] + BalancedTensor.Tensor k A U N := + BalancedTensor.lift + ((BalancedTensor.mk k A U N).compl₁₂ LinearMap.id (f.restrictScalars k)) (by + intro a u m + change BalancedTensor.mk k A U N (MulOpposite.op a • u) (f m) = + BalancedTensor.mk k A U N u (f (a • m)) + rw [f.map_smul, BalancedTensor.balance]) + +@[simp] theorem mapRight_mk (f : M →ₗ[A] N) (u : U) (m : M) : + mapRight (k := k) U f (BalancedTensor.mk k A U M u m) = + BalancedTensor.mk k A U N u (f m) := rfl + +omit [Algebra k A] [IsScalarTower k A N] in +/-- Radical multiplication is killed by tensor with any right module +annihilated by the ring radical. -/ +theorem mk_radical_zero + (hU : ∀ a ∈ Ring.jacobson A, ∀ u : U, MulOpposite.op a • u = 0) + (n : N) (hn : n ∈ Ring.jacobson A • (⊤ : Submodule A N)) (u : U) : + BalancedTensor.mk k A U N u n = 0 := by + let K : Submodule A N := + { carrier := {n | ∀ u : U, BalancedTensor.mk k A U N u n = 0} + zero_mem' := fun u => map_zero _ + add_mem' := fun hx hy u => by rw [map_add, hx, hy, add_zero] + smul_mem' := fun a x hx u => by rw [← BalancedTensor.balance]; exact hx _ } + have hK : Ring.jacobson A • (⊤ : Submodule A N) ≤ K := by + apply Submodule.smul_le.mpr + intro a ha x _ u + rw [← BalancedTensor.balance, hU a ha u] + exact LinearMap.congr_fun (map_zero (BalancedTensor.mk k A U N)) x + exact hK hn u + +theorem mapRight_radical_zero + (hU : ∀ a ∈ Ring.jacobson A, ∀ u : U, MulOpposite.op a • u = 0) + (f : M →ₗ[A] N) + (hf : LinearMap.range f ≤ Ring.jacobson A • (⊤ : Submodule A N)) : + mapRight (k := k) U f = 0 := by + apply BalancedTensor.ext + intro u m + exact mk_radical_zero (k := k) U hU (f m) (hf (mem_range_self f m)) u + +/-- The actual right radical quotient of the regular module. -/ +def rightRadical : Submodule Aᵐᵒᵖ A where + carrier := Ring.jacobson A + zero_mem' := (Ring.jacobson A).zero_mem + add_mem' := (Ring.jacobson A).add_mem + smul_mem' b _ ha := (Ring.jacobson A).mul_mem_right b.unop ha + +abbrev Residue := A ⧸ (rightRadical (A := A)) + +theorem residue_annihilated (a : A) (ha : a ∈ Ring.jacobson A) (s : Residue (A := A)) : + MulOpposite.op a • s = 0 := by + induction s using Submodule.Quotient.induction_on with + | _ b => + apply (Submodule.Quotient.mk_eq_zero _).mpr + exact (Ring.jacobson A).mul_mem_left b ha +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDBarDetection.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDBarDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..bdf2f7cde6ad8437399bc8ed3325f6fa4a14fd0f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDBarDetection.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.Finitistic.Dimension.PDAllSimples +import OAI.Algebra.Finitistic.Dimension.PDResolutionDetection +import OAI.Algebra.Finitistic.Bar.Bar + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.PDBar +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] +variable (M : PDMinimal.FiniteModule k A) +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] + +abbrev tensorComplex (P : ProjectiveResolution M.cat) : ChainComplex (ModuleCat k) ℕ := + ((PDTensor.tensorFunctor k A U).mapHomologicalComplex _).obj P.complex + +/-- Any actual projective resolution computes the same Tor, including the +constructed absolute bar resolution. -/ +def torIsoResolution (P : ProjectiveResolution M.cat) (n : ℕ) : + PDTensor.Tor (k := k) U M.cat n ≅ (tensorComplex M U P).homology n := + P.isoLeftDerivedObj (PDTensor.tensorFunctor k A U) n + +abbrev resolution : ProjectiveResolution M.cat := DerivedBar.projectiveResolution k A M + +/-- No extra identification between the bar augmentation and M is assumed. -/ +def torIsoBar (n : ℕ) : + PDTensor.Tor (k := k) U M.cat n ≅ (tensorComplex M U (resolution M)).homology n := + torIsoResolution M U (resolution M) n + +variable {U} +theorem pdLE_iff_residue_resolution (P : ProjectiveResolution M.cat) (n : ℕ) : + HasProjectiveDimensionLE M.cat n ↔ + IsZero ((tensorComplex M (PDTensor.Residue (A := A)) P).homology (n+1)) := by + rw [PDTensor.pdLE_iff_residueTor_zero M n] + exact (torIsoResolution M _ P (n+1)).isZero_iff + +theorem pdLE_iff_simple_resolution (P : ProjectiveResolution M.cat) (n : ℕ) : + HasProjectiveDimensionLE M.cat n ↔ + ∀ S : Submodule Aᵐᵒᵖ (PDTensor.Residue (A := A)), IsSimpleModule Aᵐᵒᵖ S → + IsZero ((tensorComplex M S P).homology (n+1)) := by + rw [PDTensor.pdLE_iff_simpleTor_zero M n] + exact forall_congr' fun S => imp_congr_right fun _ => + (torIsoResolution M S P (n+1)).isZero_iff +end LittleFinitistic.PDBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDBarQuotient.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDBarQuotient.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5f9290cecc84e6c22cb0437d376055866a8a296 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDBarQuotient.lean @@ -0,0 +1,105 @@ +import OAI.Algebra.Finitistic.Dimension.PDTensorFunctor +import OAI.Algebra.Finitistic.Bar.Balanced + +namespace OAI +noncomputable section +open CategoryTheory TensorProduct +open scoped TensorProduct +namespace LittleFinitistic.PDBarQuotient +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) + +/-- D with the actual right A action through f. -/ +def RightBase (_f : A →ₐ[k] D) := D +instance : Ring (RightBase f) := inferInstanceAs (Ring D) +instance : Algebra k (RightBase f) := inferInstanceAs (Algebra k D) +instance : Module Aᵐᵒᵖ (RightBase f) := Module.compHom D f.toRingHom.op + +@[simp] theorem right_smul (a : A) (d : RightBase f) : + MulOpposite.op a • d = (show RightBase f from (show D from d) * f a) := rfl + +variable (V : Type u) [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] + +/-- Quotient map from the detector tensor to the actual left D-linear bar quotient. -/ +def forward : BalancedTensor.Tensor k A (RightBase f) V →ₗ[k] DerivedBar.Balanced.tensor f V := + BalancedTensor.lift + ((TensorProduct.mk k (RightBase f) V).compr₂ + ((DerivedBar.Balanced.quotient f V).restrictScalars k)) + (fun a d v => DerivedBar.Balanced.balanced f V d a v) + +omit [IsScalarTower k A V] in +/-- Every D-linear balancing relation lies in the detector's k-linear relation +space; the proof retains all left D multiples, rather than assuming the quotients equal. -/ +theorem relations_kill : (DerivedBar.Balanced.relations f V).restrictScalars k ≤ + (BalancedTensor.relations k A (RightBase f) V).mkQ.ker := by + intro z hz + change (BalancedTensor.relations k A (RightBase f) V).mkQ z = 0 + have h : ∀ d : D, (BalancedTensor.relations k A (RightBase f) V).mkQ (d • z) = 0 := by + induction hz using Submodule.span_induction with + | mem x hx => + obtain ⟨b,a,v,rfl⟩ := hx + intro d + rw [smul_sub, TensorProduct.smul_tmul', TensorProduct.smul_tmul'] + change (BalancedTensor.relations k A (RightBase f) V).mkQ + ((d*(b*f a)) ⊗ₜ[k] v - (d*b) ⊗ₜ[k] (a • v)) = 0 + erw [← mul_assoc, map_sub] + exact sub_eq_zero.mpr (BalancedTensor.balance (k := k) (M := RightBase f) a (d*b) v) + | zero => intro d; rw [smul_zero]; exact map_zero _ + | add x y hx hy ihx ihy => + intro d + rw [smul_add] + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) (ihx d) (ihy d)).trans (add_zero _)) + | smul c x hx ih => intro d; simpa [smul_smul] using ih (d*c) + simpa only [one_smul] using h 1 + +def inverse : DerivedBar.Balanced.tensor f V →ₗ[k] BalancedTensor.Tensor k A (RightBase f) V := + ((DerivedBar.Balanced.relations f V).restrictScalars k).liftQ + (BalancedTensor.relations k A (RightBase f) V).mkQ (relations_kill f V) + +omit [IsScalarTower k A V] in +@[simp] theorem forward_mk (d : RightBase f) (v : V) : + forward f V (BalancedTensor.mk k A (RightBase f) V d v) = + DerivedBar.Balanced.quotient f V (d ⊗ₜ[k] v) := rfl + +omit [IsScalarTower k A V] in +@[simp] theorem inverse_quotient (d : D) (v : V) : + inverse f V (DerivedBar.Balanced.quotient f V (d ⊗ₜ[k] v)) = + BalancedTensor.mk k A (RightBase f) V d v := rfl + +/-- Canonical actual quotient equivalence, on representatives d tensor v. -/ +def equiv : BalancedTensor.Tensor k A (RightBase f) V ≃ₗ[k] DerivedBar.Balanced.tensor f V := + LinearEquiv.ofLinearMap (forward f V) (inverse f V) (by + apply ((DerivedBar.Balanced.relations f V).restrictScalars k).linearMap_qext + apply TensorProduct.ext + apply LinearMap.ext + intro d + apply LinearMap.ext + intro v + rfl) (by + apply BalancedTensor.ext + intro base vector + rfl) + +variable {V} {W : Type u} [AddCommGroup W] [Module k W] [Module A W] [IsScalarTower k A W] +theorem natural (h : V →ₗ[A] W) : + (forward f W).comp (PDTensor.mapRight (k := k) (RightBase f) h) = + ((DerivedBar.Balanced.map f V W h).restrictScalars k).comp (forward f V) := by + apply BalancedTensor.ext + intro d v + rfl + +omit [IsScalarTower k A V] in +/-- Exterior D multiplication agrees on every tensor generator. -/ +theorem left_action (d b : D) (v : V) : + forward f V (BalancedTensor.mk k A (RightBase f) V (d*b) v) = + d • forward f V (BalancedTensor.mk k A (RightBase f) V b v) := by + change DerivedBar.Balanced.quotient f V ((d*b) ⊗ₜ[k] v) = + d • DerivedBar.Balanced.quotient f V (b ⊗ₜ[k] v) + rw [← LinearMap.map_smul, TensorProduct.smul_tmul'] + rfl +end LittleFinitistic.PDBarQuotient + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDBarQuotientAction.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDBarQuotientAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..ede9c1512d37105cd2de5e12d2024165d01f2714 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDBarQuotientAction.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Dimension.PDBarQuotient +import Mathlib.Algebra.Module.TransferInstance + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.PDBarQuotient +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) +variable (V : Type u) [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] + +/-- The actual exterior D-action transferred through the proved quotient equivalence. -/ +instance leftModule : Module D (BalancedTensor.Tensor k A (RightBase f) V) := + (equiv f V).toAddEquiv.module D + +instance leftTower : IsScalarTower k D (BalancedTensor.Tensor k A (RightBase f) V) := + (equiv f V).isScalarTower (A := D) + +def linearEquiv : BalancedTensor.Tensor k A (RightBase f) V ≃ₗ[D] + DerivedBar.Balanced.tensor f V := (equiv f V).toAddEquiv.linearEquiv D + +omit [IsScalarTower k A V] in +/-- The transferred action is the original left regular multiplication. -/ +@[simp] theorem smul_mk (d b : D) (v : V) : + d • BalancedTensor.mk k A (RightBase f) V b v = + BalancedTensor.mk k A (RightBase f) V (d*b) v := by + apply (equiv f V).injective + exact ((linearEquiv f V).map_smul d _).trans (left_action f d b v).symm + +omit [IsScalarTower k A V] in +/-- Compatibility with every exterior scalar, on arbitrary balanced tensors. -/ +theorem equiv_smul (d : D) (z : BalancedTensor.Tensor k A (RightBase f) V) : + equiv f V (d • z) = d • equiv f V z := (linearEquiv f V).map_smul d z + +variable {V} {W : Type u} [AddCommGroup W] [Module k W] [Module A W] [IsScalarTower k A W] +def map (h : V →ₗ[A] W) : BalancedTensor.Tensor k A (RightBase f) V →ₗ[D] + BalancedTensor.Tensor k A (RightBase f) W := + (linearEquiv f W).symm.toLinearMap.comp + ((DerivedBar.Balanced.map f V W h).comp (linearEquiv f V).toLinearMap) + +theorem map_eq (h : V →ₗ[A] W) : + (map f h).restrictScalars k = PDTensor.mapRight (k := k) (RightBase f) h := by + apply BalancedTensor.ext + intro d v + rfl +end LittleFinitistic.PDBarQuotient + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDBarTensorComparison.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDBarTensorComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..8430b30e56dfc91e68d818cefaaf974afbbb2f8a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDBarTensorComparison.lean @@ -0,0 +1,93 @@ +import OAI.Algebra.Finitistic.Dimension.PDBarQuotientAction +import OAI.Algebra.Finitistic.Dimension.PDBarDetection +import OAI.Algebra.Finitistic.Bar.TensorModel + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.PDBarQuotient +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) +variable (V : Type u) [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] + +/-- The restricted scalar convention in the detector agrees with the original +compatible k action by actual tensor maps in both directions. -/ +def scalarEquiv : + (PDTensor.tensorFunctor k A (RightBase f)).obj (ModuleCat.of A V) ≃ₗ[k] + BalancedTensor.Tensor k A (RightBase f) V := + LinearEquiv.ofLinearMap + (PDTensor.mapRight (k := k) (M := PDTensor.ScalarModule k A (ModuleCat.of A V)) + (N := V) (RightBase f) LinearMap.id) + (PDTensor.mapRight (k := k) (M := V) + (N := PDTensor.ScalarModule k A (ModuleCat.of A V)) (RightBase f) LinearMap.id) + (by apply BalancedTensor.ext; intros; rfl) + (by apply BalancedTensor.ext; intros; rfl) + +def nativeScalarEquiv : DerivedBar.Balanced.tensor f V ≃ₗ[k] + (ModuleCat.restrictScalars (algebraMap k D)).obj + (ModuleCat.of D (DerivedBar.Balanced.tensor f V)) where + toFun := id + invFun := id + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' c z := (IsScalarTower.algebraMap_smul D c z).symm + +def objectIso : + (PDTensor.tensorFunctor k A (RightBase f)).obj (ModuleCat.of A V) ≅ + (ModuleCat.restrictScalars (algebraMap k D)).obj + (ModuleCat.of D (DerivedBar.Balanced.tensor f V)) := + (((scalarEquiv f V).trans (equiv f V)).trans (nativeScalarEquiv f V)).toModuleIso + +variable {V} {W : Type u} [AddCommGroup W] [Module k W] [Module A W] [IsScalarTower k A W] +theorem objectIso_natural (h : V →ₗ[A] W) : + (PDTensor.tensorFunctor k A (RightBase f)).map (ModuleCat.ofHom h) ≫ (objectIso f W).hom = + (objectIso f V).hom ≫ (ModuleCat.restrictScalars (algebraMap k D)).map + (ModuleCat.ofHom (DerivedBar.Balanced.map f V W h)) := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro d v + rfl + +variable (N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +/-- The detector's tensor of the actual bar resolution is the bar worker's +balanced complex, after restricting only its exterior scalars. -/ +def barQuotientIso : + ((PDTensor.tensorFunctor k A (RightBase f)).mapHomologicalComplex _).obj + (DerivedBar.projectiveResolution k A N).complex ≅ + ((ModuleCat.restrictScalars (algebraMap k D)).mapHomologicalComplex _).obj + (DerivedBar.tensorBarComplex k A D N f) := + HomologicalComplex.Hom.isoOfComponents + (fun n => objectIso f (DerivedBar.term k A N (n+1))) (by + intro i j hij + change j+1=i at hij + subst i + simpa only [DerivedBar.tensorBarComplex, DerivedBar.projectiveResolution, DerivedBar.complex, ChainComplex.of_d, Functor.mapHomologicalComplex_obj_d] using (objectIso_natural f (DerivedBar.differential k A N (j+1))).symm) + +/-- Comparison to the literal two-sided bar complex used in the splitting. -/ +def twoSidedIso : + ((PDTensor.tensorFunctor k A (RightBase f)).mapHomologicalComplex _).obj + (DerivedBar.projectiveResolution k A N).complex ≅ + ((ModuleCat.restrictScalars (algebraMap k D)).mapHomologicalComplex _).obj + (DerivedBar.twoSidedComplex k A D N f) := + barQuotientIso f N ≪≫ + ((ModuleCat.restrictScalars (algebraMap k D)).mapHomologicalComplex _).mapIso + (DerivedBar.tensorBarIso k A D N f) + +variable [FiniteDimensional k A] [FiniteDimensional k N] +/-- Tor computed by the literal two-sided bar, with no assumed quotient comparison. -/ +def torIsoTwoSided (n : ℕ) : + PDTensor.Tor (k := k) (RightBase f) (ModuleCat.of A N) n ≅ + (((ModuleCat.restrictScalars (algebraMap k D)).mapHomologicalComplex _).obj + (DerivedBar.twoSidedComplex k A D N f)).homology n := + (DerivedBar.projectiveResolution k A N).isoLeftDerivedObj + (PDTensor.tensorFunctor k A (RightBase f)) n ≪≫ + (HomologicalComplex.homologyFunctor _ _ n).mapIso (twoSidedIso f N) +end LittleFinitistic.PDBarQuotient + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDBaseBarConsumer.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDBaseBarConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..75d9e02c12402908567f3efc544d96359772fb3b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDBaseBarConsumer.lean @@ -0,0 +1,70 @@ +import Mathlib.CategoryTheory.Abelian.Exact +import OAI.Algebra.Finitistic.Dimension.PDBarTensorComparison +import OAI.Algebra.Finitistic.Dimension.PDDerivedBarConsumer +import Mathlib.Algebra.Homology.ShortComplex.PreservesHomology + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.PDBarQuotient +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) +variable (N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [FiniteDimensional k A] [FiniteDimensional k N] + +/-- Restriction of scalars preserves the actual homology of a D-complex. -/ +def restrictHomologyIso (C : ChainComplex (ModuleCat.{u} D) ℕ) (n : ℕ) : + (((ModuleCat.restrictScalars (algebraMap k D)).mapHomologicalComplex _).obj C).homology n ≅ + (ModuleCat.restrictScalars (algebraMap k D)).obj (C.homology n) := + by + let F : ModuleCat.{u} D ⥤ ModuleCat.{u} k := ModuleCat.restrictScalars (algebraMap k D) + letI : F.PreservesHomology := Functor.preservesHomology_of_preservesMonos_and_cokernels F + exact (C.sc n).mapHomologyIso F + +/-- Actual nonzero D-module bar homology, with its exterior action intact, +forces the same projective-dimension lower bound over A. -/ +theorem lower_bound_of_base_bar (r n : ℕ) (hrn : r ≤ n) + (h : ¬ IsZero ((DerivedBar.twoSidedComplex k A D N f).homology n)) : + r ≤ projectiveDimension (ModuleCat.of A N) := by + apply PDTensor.lower_bound_of_nonzero_Tor (RightBase f) (PDMinimal.FiniteModule.of (k := k) (A := A) N) r n hrn + intro hz + have hz' := hz.of_iso ((torIsoTwoSided f N n) ≪≫ + restrictHomologyIso (DerivedBar.twoSidedComplex k A D N f) n).symm + apply h + have hs := (ModuleCat.isZero_iff_subsingleton (R := k)).mp hz' + exact ModuleCat.isZero_iff_subsingleton.mpr hs + +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +abbrev baseDerived := DerivedCategory.Q.obj + ((DerivedBar.twoSidedComplex k A D N f).extend ComplexShape.embeddingDownNat) + +def baseDerivedHomologyIso (n : ℕ) : + (DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj (baseDerived f N) ≅ + (DerivedBar.twoSidedComplex k A D N f).homology n := + (DerivedCategory.homologyFunctorFactors (ModuleCat D) (-(n : ℤ))).app _ ≪≫ + (DerivedBar.twoSidedComplex k A D N f).extendHomologyIso ComplexShape.embeddingDownNat rfl + +/-- Consumer of an actual D-linear derived bar splitting. No splitting or +nonzero-iterate theorem is assumed implicitly; the iso, retract and class are inputs. -/ +theorem lower_bound_of_base_derived_retract + (Z T : DerivedCategory (ModuleCat.{u} D)) (e : baseDerived f N ≅ Z) + (i : T ⟶ Z) (p : Z ⟶ T) (hip : i ≫ p = 𝟙 T) + (r n : ℕ) (hrn : r ≤ n) + (h : ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj T)) : + r ≤ projectiveDimension (ModuleCat.of A N) := by + apply lower_bound_of_base_bar f N r n hrn + intro hz + let F := DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ)) + have hz' : IsZero (F.obj Z) := hz.of_iso (F.mapIso e.symm ≪≫ baseDerivedHomologyIso f N n) + apply h + apply (IsZero.iff_id_eq_zero _).mpr + have he : F.map i ≫ F.map p = 𝟙 (F.obj T) := by rw [← F.map_comp, hip, F.map_id] + rw [← he, hz'.eq_of_tgt (F.map i) 0, zero_comp] +end LittleFinitistic.PDBarQuotient + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDCoverRadical.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDCoverRadical.lean new file mode 100644 index 0000000000000000000000000000000000000000..901ab3d2a6edd68eab1921423174a047d2099d10 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDCoverRadical.lean @@ -0,0 +1,66 @@ +import OAI.Algebra.Finitistic.Dimension.PDCovers +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import Mathlib.RingTheory.Artinian.Instances + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDCovers +open Module LinearMap Submodule +universe u +variable {A : Type u} [Ring A] +variable {E N : Type u} [AddCommGroup E] [Module A E] + [AddCommGroup N] [Module A N] + +/-- A projective right-minimal epimorphism has a superfluous kernel. -/ +theorem eq_top_of_sup_ker [Module.Projective A E] + (p : E →ₗ[A] N) (hp : Function.Surjective p) (hm : RightMinimal p) + (L : Submodule A E) (hL : L ⊔ LinearMap.ker p = ⊤) : L = ⊤ := by + have hsurj : Function.Surjective (p.comp L.subtype) := by + intro y + obtain ⟨x, hx⟩ := hp y + have hm : x ∈ L ⊔ LinearMap.ker p := hL.symm ▸ mem_top + obtain ⟨z, hz, w, hw, hzw⟩ := Submodule.mem_sup.mp hm + refine ⟨⟨z, hz⟩, ?_⟩ + have hw0 : p w = 0 := hw + change p z = y + rw [← hx, ← hzw, map_add, hw0, add_zero] + obtain ⟨g, hg⟩ := Module.projective_lifting_property (p.comp L.subtype) p hsurj + have hfg : p.comp (L.subtype.comp g) = p := by rwa [← LinearMap.comp_assoc] + have hfgsurj := hm (L.subtype.comp g) hfg + apply top_unique + intro x _ + obtain ⟨z, hz⟩ := hfgsurj x + rw [← hz] + exact (g z).property + +/-- Projective-cover kernels lie in the actual module Jacobson radical. -/ +theorem ker_le_jacobson [Module.Projective A E] + (p : E →ₗ[A] N) (hp : Function.Surjective p) (hm : RightMinimal p) : + LinearMap.ker p ≤ Module.jacobson A E := by + apply le_sInf + intro L hL + by_contra h + have hlt : L < L ⊔ LinearMap.ker p := lt_of_le_of_ne le_sup_left (fun he => h (he ▸ le_sup_right)) + have htop : L ⊔ LinearMap.ker p = ⊤ := hL.2 _ hlt + exact hL.1 (eq_top_of_sup_ker p hp hm L htop) + +/-- Over a finite-dimensional algebra every finite-dimensional module has an +actual finitely generated projective cover, constructed inside a finite free module. -/ +theorem exists_finite_projective_cover + {k : Type u} [Field k] [Algebra k A] [FiniteDimensional k A] + [Module k N] [IsScalarTower k A N] [FiniteDimensional k N] : + ∃ (n : ℕ) (S : Submodule A (Fin n → A)) (p : S →ₗ[A] N), + Module.Projective A S ∧ Function.Surjective p ∧ + RightMinimal p ∧ LinearMap.ker p ≤ Module.jacobson A S := by + have : Module.Finite A N := Module.Finite.of_restrictScalars_finite k A N + obtain ⟨n, p, hp⟩ := Module.Finite.exists_fin' A N + have : IsArtinian A (Fin n → A) := isArtinian_of_tower k inferInstance + have : IsNoetherian A (Fin n → A) := isNoetherian_of_tower k inferInstance + obtain ⟨S, hS, hs, hm⟩ := exists_rightMinimal p hp + have := hS + exact ⟨n, S, p.comp S.subtype, hS, hs, hm, ker_le_jacobson _ hs hm⟩ +end LittleFinitistic.PDCovers + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDCovers.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDCovers.lean new file mode 100644 index 0000000000000000000000000000000000000000..09d8172271c91d300f108a26ada1c85d46902c00 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDCovers.lean @@ -0,0 +1,83 @@ +import Mathlib.RingTheory.Artinian.Module +import Mathlib.RingTheory.Finiteness.Projective +import Mathlib.LinearAlgebra.Projection +import Mathlib.RingTheory.Jacobson.Radical + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDCovers +open Module LinearMap Submodule +universe u v +variable {A : Type u} [Ring A] +variable {E N : Type v} [AddCommGroup E] [Module A E] + [AddCommGroup N] [Module A N] + +/-- An epimorphism is right minimal if every endomorphism over it is surjective. -/ +def RightMinimal (p : E →ₗ[A] N) : Prop := + ∀ f : Module.End A E, p.comp f = p → Function.Surjective f + +lemma comp_pow_eq {p : E →ₗ[A] N} {f : Module.End A E} + (h : p.comp f = p) (n : ℕ) : p.comp (f ^ n) = p := by + induction n with + | zero => ext x; rfl + | succ n ih => rw [pow_succ, Module.End.mul_eq_comp, ← LinearMap.comp_assoc, ih, h] + +/-- Fitting decomposition upgrades minimality among projective submodules to +right minimality of an actual epimorphism. -/ +theorem rightMinimal_of_minimal [IsArtinian A E] [IsNoetherian A E] + (p : E →ₗ[A] N) (S : Submodule A E) + (hS : Minimal (fun T : Submodule A E => + Module.Projective A T ∧ Function.Surjective (p.comp T.subtype)) S) : + RightMinimal (p.comp S.subtype) := by + have : Module.Projective A S := hS.1.1 + intro f hf + obtain ⟨n, hn⟩ := Filter.eventually_atTop.mp f.eventually_isCompl_ker_pow_range_pow + let r := f ^ (n+1) + have hc : IsCompl (LinearMap.range r) (LinearMap.ker r) := + (hn (n+1) (by omega)).symm + let R := LinearMap.range r + have : Module.Projective A R := Module.Projective.of_split R.subtype + (R.projectionOnto (LinearMap.ker r) hc) (Submodule.projectionOnto_comp_subtype hc) + let T := R.map S.subtype + let i : R →ₗ[A] E := S.subtype.comp R.subtype + have hi : Function.Injective i := S.injective_subtype.comp R.injective_subtype + have he : LinearMap.range i = T := by simp [i, T, LinearMap.range_comp] + let e : R ≃ₗ[A] T := (LinearEquiv.ofInjective i hi).trans (LinearEquiv.ofEq _ _ he) + have : Module.Projective A T := Module.Projective.of_equiv e + have hpr : (p.comp S.subtype).comp r = p.comp S.subtype := comp_pow_eq hf _ + have hTsurj : Function.Surjective (p.comp T.subtype) := by + intro y + obtain ⟨x, hx⟩ := hS.1.2 y + refine ⟨⟨S.subtype (r x), ⟨r x, mem_range_self r x, rfl⟩⟩, ?_⟩ + exact (DFunLike.congr_fun hpr x).trans hx + have hTS : T ≤ S := by + rintro x ⟨z, hz, rfl⟩ + exact z.property + have hST : S ≤ T := hS.2 ⟨inferInstance, hTsurj⟩ hTS + have hr : Function.Surjective r := by + intro x + obtain ⟨z, ⟨w, hw⟩, hz⟩ := hST x.property + refine ⟨w, ?_⟩ + exact hw.trans (Subtype.ext hz) + intro x + obtain ⟨y, hy⟩ := hr x + refine ⟨(f ^ n) y, ?_⟩ + simpa [r, pow_succ', Module.End.mul_eq_comp] using hy + +/-- Every projective epimorphism from a finite-length module contains a +projective cover. This proves existence rather than assuming covers. -/ +theorem exists_rightMinimal [IsArtinian A E] [IsNoetherian A E] + [Module.Projective A E] (p : E →ₗ[A] N) (hp : Function.Surjective p) : + ∃ S : Submodule A E, Module.Projective A S ∧ + Function.Surjective (p.comp S.subtype) ∧ RightMinimal (p.comp S.subtype) := by + have : Module.Projective A (⊤ : Submodule A E) := + Module.Projective.of_equiv (Submodule.topEquiv : (⊤ : Submodule A E) ≃ₗ[A] E).symm + obtain ⟨S, hS⟩ := WellFoundedLT.exists_minimal (inferInstance : WellFoundedLT (Submodule A E)) + {T : Submodule A E | Module.Projective A T ∧ Function.Surjective (p.comp T.subtype)} + ⟨⊤, inferInstance, fun y => by obtain ⟨x, hx⟩ := hp y; exact ⟨⟨x, mem_top⟩, hx⟩⟩ + exact ⟨S, hS.1.1, hS.1.2, rightMinimal_of_minimal p S hS⟩ +end LittleFinitistic.PDCovers + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDDerivedBarConsumer.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDDerivedBarConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c9785b181c74e280b4f8ef088b3cc859b2d71b5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDDerivedBarConsumer.lean @@ -0,0 +1,65 @@ +import OAI.Algebra.Finitistic.Dimension.PDBarDetection +import Mathlib.Algebra.Homology.DerivedCategory.Basic +import Mathlib.Algebra.Homology.Embedding.ExtendHomology + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.PDBar +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} k) := + HasDerivedCategory.standard (ModuleCat.{u} k) + +/-- Actual derived object of a nonnegative chain complex, with degree n sent to -n. -/ +abbrev derivedObject (C : ChainComplex (ModuleCat.{u} k) ℕ) := + DerivedCategory.Q.obj (C.extend ComplexShape.embeddingDownNat) + +def derivedHomologyIso (C : ChainComplex (ModuleCat.{u} k) ℕ) (n : ℕ) : + (DerivedCategory.homologyFunctor (ModuleCat k) (-(n : ℤ))).obj (derivedObject C) ≅ + C.homology n := + (DerivedCategory.homologyFunctorFactors (ModuleCat k) (-(n : ℤ))).app _ ≪≫ + C.extendHomologyIso ComplexShape.embeddingDownNat rfl + +variable (M : PDMinimal.FiniteModule k A) (P : ProjectiveResolution M.cat) + +/-- A supplied actual derived bar comparison and bounded residue cohomology +imply finite projective dimension. The comparison is an explicit input. -/ +theorem finite_pd_of_derived_iso + (Z : DerivedCategory (ModuleCat.{u} k)) + (e : derivedObject (tensorComplex M (PDTensor.Residue (A := A)) P) ≅ Z) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero + ((DerivedCategory.homologyFunctor (ModuleCat k) (-(n : ℤ))).obj Z)) : + projectiveDimension M.cat < ⊤ := by + apply PDTensor.finite_pd_of_resolution M P + obtain ⟨b,hb⟩ := h + refine ⟨b, fun n hn => ?_⟩ + exact (hb n hn).of_iso + ((DerivedCategory.homologyFunctor (ModuleCat k) (-(n : ℤ))).mapIso e.symm ≪≫ + derivedHomologyIso _ n).symm + +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] + +/-- Nonzero cohomology of a retract of the supplied actual derived bar object +provides the lower pd bound. Inclusion and projection retain the summand data. -/ +theorem lower_bound_of_derived_retract + (Z T : DerivedCategory (ModuleCat.{u} k)) + (e : derivedObject (tensorComplex M U P) ≅ Z) + (i : T ⟶ Z) (p : Z ⟶ T) (hip : i ≫ p = 𝟙 T) + (r n : ℕ) (hrn : r ≤ n) + (h : ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat k) (-(n : ℤ))).obj T)) : + r ≤ projectiveDimension M.cat := by + apply PDTensor.lower_bound_of_resolution M U P r n hrn + intro hz + let F := DerivedCategory.homologyFunctor (ModuleCat k) (-(n : ℤ)) + have hz' : IsZero (F.obj Z) := hz.of_iso + (F.mapIso e.symm ≪≫ derivedHomologyIso _ n) + apply h + apply (IsZero.iff_id_eq_zero _).mpr + have he : F.map i ≫ F.map p = 𝟙 (F.obj T) := by rw [← F.map_comp, hip, F.map_id] + rw [← he, hz'.eq_of_tgt (F.map i) 0, zero_comp] +end LittleFinitistic.PDBar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDDetection.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..c064e1addf27b33ace7f332d989e0f6c849fee70 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDDetection.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Dimension.PDTor +import OAI.Algebra.Finitistic.Dimension.PDResidueTensor +import OAI.Algebra.Finitistic.Dimension.PDDimension + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open CategoryTheory CategoryTheory.Limits +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] + +/-- Nakayama detects zero modules using the actual radical-quotient tensor. -/ +theorem residueTensor_subsingleton_iff + (N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + [Module.Finite A N] : + Subsingleton (BalancedTensor.Tensor k A (Residue (A := A)) N) ↔ Subsingleton N := by + constructor + · intro h + by_contra hn + have : Nontrivial N := not_subsingleton_iff_nontrivial.mp hn + have := residueTensor_nontrivial (k := k) (A := A) N + obtain ⟨x, y, hxy⟩ := exists_pair_ne (BalancedTensor.Tensor k A (Residue (A := A)) N) + exact hxy (h.elim x y) + · intro h + have := h + infer_instance + +variable [FiniteDimensional k A] (M : PDMinimal.FiniteModule k A) + +/-- For the semisimple quotient S, the n-th Tor is zero exactly when the n-th +term of the constructed minimal projective resolution is zero. -/ +theorem residueTor_zero_iff_term (n : ℕ) : + IsZero (Tor (k := k) (Residue (A := A)) M.cat n) ↔ + Subsingleton (PDMinimal.term M n) := by + let e := torIsoTerm (Residue (A := A)) M residue_annihilated n + rw [e.isZero_iff] + change IsZero (ModuleCat.of k (BalancedTensor.Tensor k A (Residue (A := A)) + (ScalarModule k A (PDMinimal.term M n).cat))) ↔ _ + rw [ModuleCat.isZero_iff_subsingleton] + have : Module.Finite A (ScalarModule k A (PDMinimal.term M n).cat) := + show Module.Finite A (PDMinimal.term M n) from inferInstance + exact residueTensor_subsingleton_iff (k := k) (ScalarModule k A (PDMinimal.term M n).cat) + +/-- Projective dimension of a finite-dimensional module over an actual +finite-dimensional algebra is detected by its derived tensor with A/rad A. +No detection theorem is assumed: the proof constructs minimal resolutions. -/ +theorem pdLE_iff_residueTor_zero (n : ℕ) : + HasProjectiveDimensionLE M.cat n ↔ + IsZero (Tor (k := k) (Residue (A := A)) M.cat (n+1)) := by + rw [PDMinimal.pdLE_iff_term_zero, residueTor_zero_iff_term] + +/-- The finite-projective-dimension implication used in cor:pd-detection. -/ +theorem finite_pd_of_bounded_residueTor + (h : ∃ b : ℕ, ∀ n, b < n → IsZero (Tor (k := k) (Residue (A := A)) M.cat n)) : + ∃ b : ℕ, HasProjectiveDimensionLE M.cat b := by + obtain ⟨b, hb⟩ := h + exact ⟨b, (pdLE_iff_residueTor_zero M b).mpr (hb (b+1) (by omega))⟩ + +/-- The conclusion uses mathlib's actual numerical projective dimension. -/ +theorem projectiveDimension_le_of_residueTor_zero (n : ℕ) + (h : IsZero (Tor (k := k) (Residue (A := A)) M.cat (n+1))) : + projectiveDimension M.cat ≤ n := + (projectiveDimension_le_iff _ _).mpr ((pdLE_iff_residueTor_zero M n).mpr h) +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDDimension.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..647b70f3fbc6e2a670904ede57797c15d050c92b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDDimension.lean @@ -0,0 +1,93 @@ +import OAI.Algebra.Finitistic.Dimension.PDMinimalResolution +import Mathlib.Algebra.Category.ModuleCat.ProjectiveDimension + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDMinimal +open CategoryTheory CategoryTheory.Limits +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] + +lemma cover_subsingleton (M : FiniteModule k A) [Subsingleton M] : + Subsingleton (cover M).source := by + have hp : (cover M).π = 0 := Subsingleton.elim _ _ + have hsurj := (cover M).minimal 0 (by simp [hp]) + refine ⟨fun x y => ?_⟩ + obtain ⟨a, ha⟩ := hsurj x + obtain ⟨b, hb⟩ := hsurj y + exact ha.symm.trans hb + +lemma cover_injective (M : FiniteModule k A) [Module.Projective A M] : + Function.Injective (cover M).π := by + obtain ⟨g, hg⟩ := Module.projective_lifting_property (cover M).π LinearMap.id + (cover M).surjective + have he : (cover M).π.comp (g.comp (cover M).π) = (cover M).π := by + rw [← LinearMap.comp_assoc, hg, LinearMap.id_comp] + have hs := (cover M).minimal _ he + have hgs : Function.Surjective g := by + intro x + obtain ⟨y, hy⟩ := hs x + exact ⟨(cover M).π y, hy⟩ + have hgp : g.comp (cover M).π = LinearMap.id := by + ext x + obtain ⟨y, rfl⟩ := hgs x + exact congrArg g (DFunLike.congr_fun hg y) + exact LinearMap.injective_of_comp_eq_id _ _ hgp + +lemma next_subsingleton_of_projective (M : FiniteModule k A) [Module.Projective A M] : + Subsingleton (next M) := by + have he := LinearMap.ker_eq_bot.mpr (cover_injective M) + change Subsingleton (LinearMap.ker (cover M).π) + rw [he] + infer_instance + +/-- Vanishing of a term of the constructed resolution gives the standard +categorical projective-dimension bound. -/ +theorem pdLT_of_term_zero (M : FiniteModule k A) (n i : ℕ) + (hz : Subsingleton (term M (i+n))) : + HasProjectiveDimensionLT (syzygy M i).cat n := by + induction n generalizing i with + | zero => + have : Subsingleton (term M i) := by simpa using hz + have : Subsingleton (syzygy M i) := + Function.Surjective.subsingleton (cover _).surjective + exact (hasProjectiveDimensionLT_zero_iff_isZero _).mpr + (ModuleCat.isZero_iff_subsingleton.mpr (show Subsingleton (syzygy M i) from inferInstance)) + | succ n ih => + have hnext : HasProjectiveDimensionLT (syzygy M (i+1)).cat n := + ih (i+1) (by simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using hz) + have hs := LinearMap.shortExact_shortComplexKer (cover (syzygy M i)).surjective + exact hs.hasProjectiveDimensionLT_X₃ n hnext inferInstance + +lemma syzygy_projective (M : FiniteModule k A) (n i : ℕ) + (h : HasProjectiveDimensionLT (syzygy M i).cat (n+1)) : + Projective (syzygy M (i+n)).cat := by + induction n generalizing i with + | zero => + simpa using projective_iff_hasProjectiveDimensionLT_one.mpr h + | succ n ih => + have hs := LinearMap.shortExact_shortComplexKer (cover (syzygy M i)).surjective + have hn : HasProjectiveDimensionLT (syzygy M (i+1)).cat (n+1) := + (hs.hasProjectiveDimensionLT_X₃_iff n inferInstance).mp h + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (i+1) hn + +/-- Finite projective dimension forces the minimal resolution to terminate. -/ +theorem term_zero_of_pdLE (M : FiniteModule k A) (n : ℕ) + (h : HasProjectiveDimensionLE M.cat n) : Subsingleton (term M (n+1)) := by + have hp := syzygy_projective M n 0 h + rw [Nat.zero_add] at hp + have : Module.Projective A (syzygy M n) := + (IsProjective.iff_projective _).mpr (by simpa only [Nat.zero_add, FiniteModule.cat] using hp) + have : Subsingleton (syzygy M (n+1)) := next_subsingleton_of_projective (syzygy M n) + exact cover_subsingleton _ + +/-- The actual minimal-resolution term criterion, proved from covers and +short-exact-sequence dimension shifting. -/ +theorem pdLE_iff_term_zero (M : FiniteModule k A) (n : ℕ) : + HasProjectiveDimensionLE M.cat n ↔ Subsingleton (term M (n+1)) := + ⟨term_zero_of_pdLE M n, fun h => pdLT_of_term_zero M (n+1) 0 (by simpa using h)⟩ +end LittleFinitistic.PDMinimal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDLowerBound.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec2cdfe5ff8270c807063b9190be90afc0287847 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDLowerBound.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Dimension.PDDetection + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open CategoryTheory CategoryTheory.Limits +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] +variable (M : PDMinimal.FiniteModule k A) + +/-- Any right module detects a lower bound through nonzero Tor; it need not +be flat, finite-dimensional, or annihilated by the radical. -/ +theorem tor_zero_of_pdLT (n : ℕ) (h : HasProjectiveDimensionLT M.cat n) : + IsZero (Tor (k := k) U M.cat n) := by + have ht : Subsingleton (PDMinimal.term M n) := by + cases n with + | zero => + have hm := (hasProjectiveDimensionLT_zero_iff_isZero _).mp h + have : Subsingleton M := ModuleCat.subsingleton_of_isZero hm + exact PDMinimal.cover_subsingleton M + | succ n => exact PDMinimal.term_zero_of_pdLE M n h + have hz : IsZero (PDMinimal.term M n).cat := ModuleCat.isZero_iff_subsingleton.mpr ht + have hm : IsZero ((model U M).X n) := (tensorFunctor k A U).map_isZero hz + exact (HomologicalComplex.ExactAt.of_isZero hm).isZero_homology.of_iso (torIsoModel U M n) + +theorem le_projectiveDimension_of_nonzero_Tor (n : ℕ) + (h : ¬ IsZero (Tor (k := k) U M.cat n)) : n ≤ projectiveDimension M.cat := by + by_contra hn + exact h (tor_zero_of_pdLT U M n (projectiveDimension_lt_iff.mp (lt_of_not_ge hn))) + +theorem lower_bound_of_nonzero_Tor (r n : ℕ) (hrn : r ≤ n) + (h : ¬ IsZero (Tor (k := k) U M.cat n)) : r ≤ projectiveDimension M.cat := by + exact le_trans (by exact_mod_cast hrn) (le_projectiveDimension_of_nonzero_Tor U M n h) + +/-- Bounded radical-quotient Tor gives finite numerical projective dimension. -/ +theorem projectiveDimension_lt_top_of_bounded_residueTor + (h : ∃ b : ℕ, ∀ n, b < n → IsZero (Tor (k := k) (Residue (A := A)) M.cat n)) : + projectiveDimension M.cat < ⊤ := by + obtain ⟨b, hb⟩ := h + exact lt_of_le_of_lt + (projectiveDimension_le_of_residueTor_zero M b (hb (b+1) (by omega))) (WithBot.coe_lt_coe.mpr (ENat.natCast_lt_top b)) +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDMinimalData.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDMinimalData.lean new file mode 100644 index 0000000000000000000000000000000000000000..125fdf2096c2921ce0f9aecf836ce0d4032963c9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDMinimalData.lean @@ -0,0 +1,108 @@ +import OAI.Algebra.Finitistic.Dimension.PDCoverRadical +import OAI.Algebra.Finitistic.Dimension.PDRadical +import Mathlib.Algebra.Category.ModuleCat.Projective + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDMinimal +open Module LinearMap Submodule +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] + +/-- Finite-dimensional actual left modules, retaining the scalar compatibility. -/ +structure FiniteModule where + carrier : Type u + [add : AddCommGroup carrier] + [moduleA : Module A carrier] + [moduleK : Module k carrier] + [tower : IsScalarTower k A carrier] + [finite : FiniteDimensional k carrier] +attribute [instance] FiniteModule.add FiniteModule.moduleA FiniteModule.moduleK + FiniteModule.tower FiniteModule.finite +instance : CoeSort (FiniteModule k A) (Type u) := ⟨FiniteModule.carrier⟩ + +namespace FiniteModule +variable {k A} +abbrev of (M : Type u) [AddCommGroup M] [Module A M] [Module k M] + [IsScalarTower k A M] [FiniteDimensional k M] : FiniteModule k A := ⟨M⟩ +def cat (M : FiniteModule k A) : ModuleCat A := ModuleCat.of A M +instance (M : FiniteModule k A) : Module.Finite A M := + Module.Finite.of_restrictScalars_finite k A M +end FiniteModule + +variable [FiniteDimensional k A] +/-- Projective covers with their actual maps and radical-kernel property. -/ +structure Cover (M : FiniteModule k A) where + source : FiniteModule k A + [projective : Module.Projective A source] + π : source →ₗ[A] M + surjective : Function.Surjective π + minimal : PDCovers.RightMinimal π + radical : LinearMap.ker π ≤ Ring.jacobson A • (⊤ : Submodule A source) +attribute [instance] Cover.projective + +variable {k A} +theorem cover_nonempty (M : FiniteModule k A) : Nonempty (Cover k A M) := by + obtain ⟨n, S, p, hP, hp, hm, hr⟩ := PDCovers.exists_finite_projective_cover (k := k) (A := A) (N := M) + have := hP + have : FiniteDimensional k S := Module.Finite.of_injective + (S.subtype.restrictScalars k) S.injective_subtype + have : Module.Finite A S := Module.Finite.of_restrictScalars_finite k A S + refine ⟨⟨FiniteModule.of S, p, hp, hm, ?_⟩⟩ + exact hr.trans (PDRadical.jacobson_eq_smul S).le + +def cover (M : FiniteModule k A) : Cover k A M := Classical.choice (cover_nonempty M) + +abbrev next (M : FiniteModule k A) : FiniteModule k A := by + have : FiniteDimensional k (LinearMap.ker (cover M).π) := + Module.Finite.of_injective ((LinearMap.ker (cover M).π).subtype.restrictScalars k) + (Submodule.injective_subtype _) + exact FiniteModule.of (LinearMap.ker (cover M).π) + +@[reducible] def syzygy (M : FiniteModule k A) : ℕ → FiniteModule k A + | 0 => M + | n+1 => next (syzygy M n) + +abbrev term (M : FiniteModule k A) (n : ℕ) := (cover (syzygy M n)).source +abbrev augment (M : FiniteModule k A) (n : ℕ) := (cover (syzygy M n)).π + +def differential (M : FiniteModule k A) (n : ℕ) : term M (n+1) →ₗ[A] term M n := + (LinearMap.ker (augment M n)).subtype.comp (augment M (n+1)) + +@[simp] theorem augment_differential (M : FiniteModule k A) (n : ℕ) : + (augment M n).comp (differential M n) = 0 := by + ext x + exact (augment M (n+1) x).property + +@[simp] theorem differential_comp (M : FiniteModule k A) (n : ℕ) : + (differential M n).comp (differential M (n+1)) = 0 := by + rw [differential, LinearMap.comp_assoc, augment_differential, LinearMap.comp_zero] + +theorem range_differential (M : FiniteModule k A) (n : ℕ) : + LinearMap.range (differential M n) = LinearMap.ker (augment M n) := by + rw [differential, LinearMap.range_comp, LinearMap.range_eq_top.mpr (cover _).surjective, + Submodule.map_top, Submodule.range_subtype] + +theorem ker_differential (M : FiniteModule k A) (n : ℕ) : + LinearMap.ker (differential M n) = LinearMap.ker (augment M (n+1)) := by + ext x + change ((augment M (n+1) x : LinearMap.ker (augment M n)) : term M n) = 0 ↔ + augment M (n+1) x = 0 + constructor + · intro h; exact Subtype.ext h + · intro h; exact congrArg (fun z : LinearMap.ker (augment M n) => z.val) h + +theorem exact_differential (M : FiniteModule k A) (n : ℕ) : + LinearMap.range (differential M (n+1)) = LinearMap.ker (differential M n) := by + rw [range_differential, ker_differential] + +theorem differential_radical (M : FiniteModule k A) (n : ℕ) : + LinearMap.range (differential M n) ≤ + Ring.jacobson A • (⊤ : Submodule A (term M n)) := by + rw [range_differential] + exact (cover _).radical +end LittleFinitistic.PDMinimal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDMinimalResolution.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDMinimalResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1e0becc12fb27096928c657a6882a0a9a7b0126 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDMinimalResolution.lean @@ -0,0 +1,73 @@ +import OAI.Algebra.Finitistic.Dimension.PDMinimalData +import Mathlib.CategoryTheory.Abelian.Projective.Resolution +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDMinimal +open CategoryTheory CategoryTheory.Limits +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] +variable (M : FiniteModule k A) + +/-- The actual chain complex of the successive projective covers. -/ +def complex : ChainComplex (ModuleCat A) ℕ := ChainComplex.of + (fun n => (term M n).cat) + (fun n => ModuleCat.ofHom (differential M n)) + (fun n => ModuleCat.hom_ext (differential_comp M n)) + +@[simp] theorem complex_d (n : ℕ) : + (complex M).d (n+1) n = ModuleCat.ofHom (differential M n) := by + exact ChainComplex.of_d (fun n => (term M n).cat) + (fun n => ModuleCat.ofHom (differential M n)) n + +instance term_projective (n : ℕ) : Projective ((complex M).X n) := by + exact (IsProjective.iff_projective _).mp (cover (syzygy M n)).projective + +lemma complex_exactAt (n : ℕ) : (complex M).ExactAt (n+1) := by + rw [HomologicalComplex.exactAt_iff' _ (n+2) (n+1) n (by simp) (by simp)] + apply (ShortComplex.moduleCat_exact_iff_range_eq_ker _).mpr + change LinearMap.range ((complex M).d (n+2) (n+1)).hom = + LinearMap.ker ((complex M).d (n+1) n).hom + rw [complex_d, complex_d] + exact exact_differential M n + +lemma complex_d_augment : (complex M).d 1 0 ≫ ModuleCat.ofHom (augment M 0) = 0 := by + rw [complex_d] + exact ModuleCat.hom_ext (augment_differential M 0) + +lemma complex_exact_augment : + (ShortComplex.mk _ _ (complex_d_augment M)).Exact := by + apply (ShortComplex.moduleCat_exact_iff_range_eq_ker _).mpr + change LinearMap.range ((complex M).d 1 0).hom = LinearMap.ker (augment M 0) + rw [complex_d] + exact range_differential M 0 + +instance augment_epi : Epi (ModuleCat.ofHom (augment M 0)) := + (ModuleCat.epi_iff_surjective _).mpr (cover _).surjective + +/-- A projective resolution, including its augmentation quasi-isomorphism. -/ +def resolution : ProjectiveResolution M.cat where + complex := complex M + π := (ChainComplex.toSingle₀Equiv _ _).symm ⟨ModuleCat.ofHom (augment M 0), + complex_d_augment M⟩ + quasiIso := ⟨fun n => by + cases n with + | zero => + rw [ChainComplex.quasiIsoAt₀_iff, ShortComplex.quasiIso_iff_of_zeros'] + · + refine (ShortComplex.exact_and_epi_g_iff_of_iso ?_).2 + ⟨complex_exact_augment M, augment_epi M⟩ + exact ShortComplex.isoMk (Iso.refl _) (Iso.refl _) (Iso.refl _) + (by erw [Category.id_comp]) + (by erw [Category.id_comp]) + all_goals rfl + | succ n => + rw [quasiIsoAt_iff_exactAt'] + · exact complex_exactAt M n + · apply ChainComplex.exactAt_succ_single_obj⟩ +end LittleFinitistic.PDMinimal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDRadical.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDRadical.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1db21875aa180b7ba647c2835d24349a6d0d892 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDRadical.lean @@ -0,0 +1,62 @@ +import Mathlib.RingTheory.Finiteness.Projective +import Mathlib.RingTheory.Jacobson.Radical +import Mathlib.RingTheory.SimpleModule.Basic + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDRadical +open Module LinearMap Submodule +universe u v +variable {A : Type u} [Ring A] +variable (P : Type v) [AddCommGroup P] [Module A P] + +/-- For a finitely generated projective module the module radical is exactly +multiplication by the ring Jacobson radical. No commutativity is assumed. -/ +theorem jacobson_eq_smul [Module.Finite A P] [Module.Projective A P] : + Module.jacobson A P = Ring.jacobson A • (⊤ : Submodule A P) := by + apply le_antisymm _ (Ring.jacobson_smul_top_le A P) + intro x hx + obtain ⟨n, f, g, hf, hg, hfg⟩ := Module.Finite.exists_comp_eq_id_of_projective A P + have hcoord (i : Fin n) : g x i ∈ Ring.jacobson A := + Module.le_comap_jacobson ((LinearMap.proj i).comp g) hx + have hsum : g x = ∑ i : Fin n, Pi.single i (g x i) := by + classical + ext j + simp + have hxsum : x = ∑ i : Fin n, (g x i) • f (Pi.single i 1) := by + classical + calc + x = f (g x) := (DFunLike.congr_fun hfg x).symm + _ = ∑ i : Fin n, f (Pi.single i (g x i)) := by conv_lhs => rw [hsum, map_sum] + _ = _ := by + apply Finset.sum_congr rfl + intro i _ + have he : Pi.single i (g x i) = (g x i) • (Pi.single i 1 : Fin n → A) := by + ext j + by_cases hj : i = j + · subst j; simp + · simp [Ne.symm hj] + rw [he, map_smul] + rw [hxsum] + exact Submodule.sum_mem _ fun i _ => Submodule.smul_mem_smul (hcoord i) mem_top + +/-- The noncommutative Nakayama step used in the manuscript. -/ +theorem quotient_radical_nontrivial [Module.Finite A P] [Nontrivial P] : + Nontrivial (P ⧸ (Ring.jacobson A • (⊤ : Submodule A P))) := by + apply Submodule.Quotient.nontrivial_iff.mpr + exact ne_of_lt (Submodule.jacobson_smul_lt_top (R := A) (M := P) ⊤) + +/-- Any map into a simple module annihilates the radical of its domain. -/ +theorem simple_map_radical_zero + {S : Type v} [AddCommGroup S] [Module A S] [IsSimpleModule A S] + (f : P →ₗ[A] S) (x : P) (hx : x ∈ Module.jacobson A P) : f x = 0 := by + have h := Module.le_comap_jacobson f hx + have hs : Module.jacobson A S = ⊥ := by + apply bot_unique + exact sInf_le isCoatom_bot + simpa [hs] using h +end LittleFinitistic.PDRadical + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResidueAssociativity.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueAssociativity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b7f0abacad2b18acadd14dbb00db4b7f7ce40c5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueAssociativity.lean @@ -0,0 +1,124 @@ +import OAI.Algebra.Finitistic.Dimension.PDResidueProjection +import OAI.Algebra.Finitistic.Dimension.PDBarTensorComparison + +namespace OAI +noncomputable section +open CategoryTheory TensorProduct +open scoped TensorProduct +namespace LittleFinitistic.PDResidueAssociativity +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) +variable (V : Type u) [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] +local notation "S" => PDTensor.Residue (A := D) +local notation "SA" => PDResidueProjection.InflatedResidue f +local notation "T" => BalancedTensor.Tensor k A SA V +local notation "DV" => DerivedBar.Balanced.tensor f V + +def coefficient (s : S) : PDBarQuotient.RightBase f →ₗ[k] V →ₗ[k] T where + toFun d := BalancedTensor.mk k A SA V (MulOpposite.op (show D from d) • s) + map_add' a b := by + ext v + exact (congrArg (fun x : SA => BalancedTensor.mk k A SA V x v) + (add_smul (MulOpposite.op (show D from a)) + (MulOpposite.op (show D from b)) s)).trans + (LinearMap.congr_fun ((BalancedTensor.mk k A SA V).map_add _ _) v) + map_smul' c d := by + ext v + change BalancedTensor.mk k A SA V (MulOpposite.op (c • (show D from d)) • s) v = _ + rw [MulOpposite.op_smul, smul_assoc] + exact LinearMap.congr_fun ((BalancedTensor.mk k A SA V).map_smul c _) v + +def inner (s : S) : DV →ₗ[k] T := + (BalancedTensor.lift (coefficient f V s) (by + intro a d v + change BalancedTensor.mk k A SA V (MulOpposite.op ((show D from d)*f a) • s) v = + BalancedTensor.mk k A SA V (MulOpposite.op (show D from d) • s) (a • v) + rw [MulOpposite.op_mul, mul_smul] + exact BalancedTensor.balance (k := k) (M := SA) a _ v)).comp (PDBarQuotient.inverse f V) + +omit [IsScalarTower k A V] in +@[simp] theorem inner_mk (s : S) (d : D) (v : V) : + inner f V s (DerivedBar.Balanced.quotient f V (d ⊗ₜ[k] v)) = + BalancedTensor.mk k A SA V (MulOpposite.op d • s) v := rfl + +def pair : S →ₗ[k] DV →ₗ[k] T where + toFun := inner f V + map_add' s t := by + apply ((DerivedBar.Balanced.relations f V).restrictScalars k).linearMap_qext + apply TensorProduct.ext + ext d v + change BalancedTensor.mk k A SA V (MulOpposite.op d • (s+t)) v = + BalancedTensor.mk k A SA V (MulOpposite.op d • s) v + BalancedTensor.mk k A SA V (MulOpposite.op d • t) v + rw [smul_add] + exact LinearMap.congr_fun ((BalancedTensor.mk k A SA V).map_add _ _) v + map_smul' c s := by + apply ((DerivedBar.Balanced.relations f V).restrictScalars k).linearMap_qext + apply TensorProduct.ext + ext d v + change BalancedTensor.mk k A SA V (MulOpposite.op d • (c • s)) v = + c • BalancedTensor.mk k A SA V (MulOpposite.op d • s) v + rw [smul_comm] + exact LinearMap.congr_fun ((BalancedTensor.mk k A SA V).map_smul c _) v + +def forward : BalancedTensor.Tensor k D S DV →ₗ[k] T := + BalancedTensor.lift (pair f V) (by + intro d s z + induction z using Submodule.Quotient.induction_on with + | _ z => + induction z using TensorProduct.inductionOn with + | tmul b v => + change inner f V (MulOpposite.op d • s) (DerivedBar.Balanced.quotient f V (b ⊗ₜ[k] v)) = + inner f V s (d • DerivedBar.Balanced.quotient f V (b ⊗ₜ[k] v)) + rw [inner_mk, ← LinearMap.map_smul, TensorProduct.smul_tmul', inner_mk] + rw [← mul_smul, ← MulOpposite.op_mul] + rfl + | add x y hx hy => simpa only [Submodule.Quotient.mk_add, map_add, smul_add] using congrArg₂ (·+·) hx hy) + +def unit : V →ₗ[k] DV := + ((DerivedBar.Balanced.quotient f V).restrictScalars k).comp (TensorProduct.mk k D V 1) + +def inverse : T →ₗ[k] BalancedTensor.Tensor k D S DV := + BalancedTensor.lift ((BalancedTensor.mk k D S DV).compl₁₂ LinearMap.id (unit f V)) (by + intro a s v + change BalancedTensor.mk k D S DV (MulOpposite.op (f a) • s) (unit f V v) = + BalancedTensor.mk k D S DV s (unit f V (a • v)) + erw [BalancedTensor.balance (k := k) (A := D) (M := S) (N := DV) + (f a) (show S from s) (unit f V v)] + congr 1 + change f a • DerivedBar.Balanced.quotient f V ((1 : D) ⊗ₜ[k] v) = + DerivedBar.Balanced.quotient f V ((1 : D) ⊗ₜ[k] (a • v)) + rw [← LinearMap.map_smul, TensorProduct.smul_tmul', smul_eq_mul, mul_one] + simpa only [one_mul] using DerivedBar.Balanced.balanced f V (1 : D) a v) + +omit [IsScalarTower k A V] in +@[simp] theorem inverse_mk (s : SA) (v : V) : + inverse f V (BalancedTensor.mk k A SA V s v) = BalancedTensor.mk k D S DV s (unit f V v) := rfl + +/-- Actual balanced associativity S tensor_D (D tensor_A V) = S tensor_A V, +with the right A action restricted along f. -/ +def equiv : BalancedTensor.Tensor k D S DV ≃ₗ[k] T := + LinearEquiv.ofLinearMap (forward f V) (inverse f V) (by + apply BalancedTensor.ext + intro s v + change BalancedTensor.mk k A SA V (MulOpposite.op (1 : D) • s) v = _ + rw [MulOpposite.op_one, one_smul] + rfl) (by + apply BalancedTensor.ext + intro s z + induction z using Submodule.Quotient.induction_on with + | _ z => + induction z using TensorProduct.inductionOn with + | tmul d v => + change BalancedTensor.mk k D S DV (MulOpposite.op d • s) (unit f V v) = + BalancedTensor.mk k D S DV s (DerivedBar.Balanced.quotient f V (d ⊗ₜ[k] v)) + rw [BalancedTensor.balance] + congr 1 + change d • DerivedBar.Balanced.quotient f V ((1 : D) ⊗ₜ[k] v) = _ + rw [← LinearMap.map_smul, TensorProduct.smul_tmul', smul_eq_mul, mul_one] + | add x y hx hy => simpa only [Submodule.Quotient.mk_add, map_add] using congrArg₂ (·+·) hx hy) +end LittleFinitistic.PDResidueAssociativity + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResidueBaseBar.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueBaseBar.lean new file mode 100644 index 0000000000000000000000000000000000000000..706313dbec50adf99ce76177301ae68d6bd4c13d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueBaseBar.lean @@ -0,0 +1,117 @@ +import OAI.Algebra.Finitistic.Dimension.PDResidueAssociativity +import OAI.Algebra.Finitistic.Dimension.PDBaseBarConsumer +import OAI.Algebra.Finitistic.Bar.SplitProjectiveTail + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits TensorProduct +open scoped TensorProduct +namespace LittleFinitistic.PDResidueAssociativity +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] + +/-- Scalar restriction coherence for an arbitrary right tensor factor. -/ +def scalarTensorEquiv {R : Type u} [Ring R] [Algebra k R] + (U V : Type u) [AddCommGroup U] [Module k U] [Module Rᵐᵒᵖ U] + [AddCommGroup V] [Module k V] [Module R V] [IsScalarTower k R V] : + (PDTensor.tensorFunctor k R U).obj (ModuleCat.of R V) ≃ₗ[k] BalancedTensor.Tensor k R U V := + LinearEquiv.ofLinearMap + (PDTensor.mapRight (k := k) (M := PDTensor.ScalarModule k R (ModuleCat.of R V)) (N := V) U LinearMap.id) + (PDTensor.mapRight (k := k) (M := V) (N := PDTensor.ScalarModule k R (ModuleCat.of R V)) U LinearMap.id) + (by apply BalancedTensor.ext; intros; rfl) (by apply BalancedTensor.ext; intros; rfl) + +variable (f : A →ₐ[k] D) +variable (V : Type u) [AddCommGroup V] [Module k V] [Module A V] [IsScalarTower k A V] +local notation "S" => PDTensor.Residue (A := D) +local notation "SA" => PDResidueProjection.InflatedResidue f + +def objectIso : (PDTensor.tensorFunctor k A SA).obj (ModuleCat.of A V) ≅ + (PDTensor.tensorFunctor k D S).obj (ModuleCat.of D (DerivedBar.Balanced.tensor f V)) := + (((scalarTensorEquiv SA V).trans (equiv f V).symm).trans + (scalarTensorEquiv S (DerivedBar.Balanced.tensor f V)).symm).toModuleIso + +variable {V} {W : Type u} [AddCommGroup W] [Module k W] [Module A W] [IsScalarTower k A W] +theorem objectIso_natural (h : V →ₗ[A] W) : + (PDTensor.tensorFunctor k A SA).map (ModuleCat.ofHom h) ≫ (objectIso f W).hom = + (objectIso f V).hom ≫ (PDTensor.tensorFunctor k D S).map + (ModuleCat.ofHom (DerivedBar.Balanced.map f V W h)) := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro s v + rfl + +variable (N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +def barIso : + ((PDTensor.tensorFunctor k A SA).mapHomologicalComplex _).obj (DerivedBar.projectiveResolution k A N).complex ≅ + ((PDTensor.tensorFunctor k D S).mapHomologicalComplex _).obj (DerivedBar.tensorBarComplex k A D N f) := + HomologicalComplex.Hom.isoOfComponents (fun n => objectIso f (DerivedBar.term k A N (n+1))) (by + intro i j hij + change j+1=i at hij + subst i + simpa only [DerivedBar.tensorBarComplex, DerivedBar.projectiveResolution, DerivedBar.complex, + ChainComplex.of_d, Functor.mapHomologicalComplex_obj_d] using + (objectIso_natural f (DerivedBar.differential k A N (j+1))).symm) + +def twoSidedIso : + ((PDTensor.tensorFunctor k A SA).mapHomologicalComplex _).obj (DerivedBar.projectiveResolution k A N).complex ≅ + ((PDTensor.tensorFunctor k D S).mapHomologicalComplex _).obj (DerivedBar.twoSidedComplex k A D N f) := + barIso f N ≪≫ ((PDTensor.tensorFunctor k D S).mapHomologicalComplex _).mapIso + (DerivedBar.tensorBarIso k A D N f) + +variable (hf : Function.Surjective f) +variable (hsq : ∀ a ∈ RingHom.ker f.toRingHom, ∀ b ∈ RingHom.ker f.toRingHom, a*b=0) + +/-- Actual residue Tor is computed by tensoring the free D-bar with D/rad D. +This proves the needed change-of-rings comparison on the actual models. -/ +def residueTorIso (n : ℕ) : PDTensor.Tor (k := k) (PDTensor.Residue (A := A)) (ModuleCat.of A N) n ≅ + (((PDTensor.tensorFunctor k D S).mapHomologicalComplex _).obj + (DerivedBar.twoSidedComplex k A D N f)).homology n := + PDResidueProjection.torIso f hf hsq (ModuleCat.of A N) (DerivedBar.projectiveResolution k A N) n ≪≫ + (DerivedBar.projectiveResolution k A N).isoLeftDerivedObj (PDTensor.tensorFunctor k A SA) n ≪≫ + (HomologicalComplex.homologyFunctor _ _ n).mapIso (twoSidedIso f N) + +/-- The actual D-bar has projective terms, even when its length is infinite. -/ +theorem twoSided_projective (n : ℕ) : Projective ((DerivedBar.twoSidedComplex k A D N f).X n) := by + have : Module.Free D (D ⊗[k] DerivedBar.term k A N n) := + Module.Free.of_basis (Algebra.TensorProduct.basis D (Module.Free.chooseBasis k (DerivedBar.term k A N n))) + change Projective (ModuleCat.of D (D ⊗[k] DerivedBar.term k A N n)) + infer_instance + +include hf hsq + +variable [FiniteDimensional k A] [FiniteDimensional k N] + +/-- Bounded D-derived bar homology suffices for finite pd over A. The +exact-tail theorem supplies the amplitude after residue tensor. -/ +theorem finite_pd_of_bounded_base_bar (g : ℕ) (hg : ∀ M : ModuleCat.{u} D, HasProjectiveDimensionLE M g) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero ((DerivedBar.twoSidedComplex k A D N f).homology n)) : + projectiveDimension (ModuleCat.of A N) < ⊤ := by + apply PDTensor.projectiveDimension_lt_top_of_bounded_residueTor (PDMinimal.FiniteModule.of (k := k) (A := A) N) + obtain ⟨b,hb⟩ := h + refine ⟨b+g+3, fun n hn => ?_⟩ + have he : ∀ i, b+1 ≤ i → (DerivedBar.twoSidedComplex k A D N f).ExactAt i := by + intro i hi + exact ((DerivedBar.twoSidedComplex k A D N f).exactAt_iff_isZero_homology i).mpr (hb i (by omega)) + have ht := DerivedBar.ProjectiveTail.map_exact_tail (DerivedBar.twoSidedComplex k A D N f) + (PDTensor.tensorFunctor k D S) (b+1) g he (twoSided_projective f N) hg n (by omega) + exact ht.isZero_homology.of_iso (residueTorIso f N hf hsq n) + +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := HasDerivedCategory.standard (ModuleCat.{u} D) + +theorem finite_pd_of_base_derived_iso (g : ℕ) (hg : ∀ M : ModuleCat.{u} D, HasProjectiveDimensionLE M g) + (Z : DerivedCategory (ModuleCat.{u} D)) (e : PDBarQuotient.baseDerived f N ≅ Z) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero + ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj Z)) : + projectiveDimension (ModuleCat.of A N) < ⊤ := by + apply finite_pd_of_bounded_base_bar f N hf hsq g hg + obtain ⟨b,hb⟩ := h + refine ⟨b,fun n hn => ?_⟩ + exact (hb n hn).of_iso + (((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).mapIso e.symm) ≪≫ + PDBarQuotient.baseDerivedHomologyIso f N n).symm +end LittleFinitistic.PDResidueAssociativity + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResidueProjection.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f8d84a6b3caa4e9fc39c5a0114de544b96ace5e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueProjection.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.Finitistic.Dimension.PDSquareZeroResidue +import OAI.Algebra.Finitistic.Dimension.PDResidueRing +import OAI.Algebra.Finitistic.Dimension.PDTor +import OAI.Algebra.Finitistic.Tensor.BalancedTensorMaps + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.PDResidueProjection +universe u +variable {k A D : Type u} [Field k] [Ring A] [Algebra k A] [Ring D] [Algebra k D] +variable (f : A →ₐ[k] D) (hf : Function.Surjective f) +variable (hsq : ∀ a ∈ RingHom.ker f.toRingHom, ∀ b ∈ RingHom.ker f.toRingHom, a*b=0) + +def InflatedResidue (_f : A →ₐ[k] D) := PDTensor.Residue (A := D) +instance : AddCommGroup (InflatedResidue f) := inferInstanceAs (AddCommGroup (PDTensor.Residue (A := D))) +instance : Module k (InflatedResidue f) := inferInstanceAs (Module k (PDTensor.Residue (A := D))) +instance : Module Aᵐᵒᵖ (InflatedResidue f) := + Module.compHom (PDTensor.Residue (A := D)) f.toRingHom.op +instance (priority := 50) : Module Dᵐᵒᵖ (InflatedResidue f) := + inferInstanceAs (Module Dᵐᵒᵖ (PDTensor.Residue (A := D))) +instance (priority := 50) : IsScalarTower k Dᵐᵒᵖ (InflatedResidue f) := + inferInstanceAs (IsScalarTower k Dᵐᵒᵖ (PDTensor.Residue (A := D))) +instance : IsScalarTower k Aᵐᵒᵖ (InflatedResidue f) where + smul_assoc c a s := by + change MulOpposite.op (f (c • a.unop)) • (s : PDTensor.Residue (A := D)) = + c • (MulOpposite.op (f a.unop) • (s : PDTensor.Residue (A := D))) + rw [map_smul, MulOpposite.op_smul, smul_assoc] + +def map : PDTensor.Residue (A := A) →ₗ[k] InflatedResidue f := + ((PDTensor.rightRadical (A := A)).restrictScalars k).liftQ + (((PDTensor.rightRadical (A := D)).restrictScalars k).mkQ.comp f.toLinearMap) (by + intro a ha + apply (Submodule.Quotient.mk_eq_zero _).mpr + have he := PDSquareZero.comap_jacobson f.toRingHom hf hsq + change a ∈ Ring.jacobson A at ha + rw [← he] at ha + exact ha) + +@[simp] theorem map_mk (a : A) : map f hf hsq (Submodule.Quotient.mk a) = + (Submodule.Quotient.mk (f a) : PDTensor.Residue (A := D)) := rfl + +/-- The radical quotient-ring comparison also respects the actual k action. -/ +def equiv : PDTensor.Residue (A := A) ≃ₗ[k] InflatedResidue f := + LinearEquiv.ofBijective (map f hf hsq) (by + have he : (fun s => map f hf hsq s) = + (fun s => PDSquareZero.residueQuotientEquiv f.toRingHom hf hsq s) := by + funext s + induction s using Submodule.Quotient.induction_on with + | _ a => exact (PDSquareZero.residueQuotientEquiv_mk f.toRingHom hf hsq a).symm + change Function.Bijective (fun s => map f hf hsq s) + rw [he] + exact (PDSquareZero.residueQuotientEquiv f.toRingHom hf hsq).bijective) + +/-- Its right A action is precisely restriction through the canonical projection. -/ +def rightEquiv : PDTensor.Residue (A := A) ≃ₗ[Aᵐᵒᵖ] InflatedResidue f where + __ := (equiv f hf hsq).toAddEquiv + map_smul' a s := by + induction s using Submodule.Quotient.induction_on with + | _ b => + change (Submodule.Quotient.mk (f (b*a.unop)) : PDTensor.Residue (A := D)) = + Submodule.Quotient.mk (f b * f a.unop) + rw [map_mul] + +variable (N : Type u) [AddCommGroup N] [Module k N] [Module A N] + +def tensorEquiv : BalancedTensor.Tensor k A (PDTensor.Residue (A := A)) N ≃ₗ[k] + BalancedTensor.Tensor k A (InflatedResidue f) N := + LinearEquiv.ofLinearMap + (BalancedTensor.mapLeft (k := k) N (rightEquiv f hf hsq).toLinearMap) + (BalancedTensor.mapLeft (k := k) N (rightEquiv f hf hsq).symm.toLinearMap) + (by + apply BalancedTensor.ext + intro s n + simp only [LinearMap.comp_apply, BalancedTensor.mapLeft_mk, LinearEquiv.coe_coe, + LinearEquiv.apply_symm_apply, LinearMap.id_apply]) + (by + apply BalancedTensor.ext + intro s n + simp only [LinearMap.comp_apply, BalancedTensor.mapLeft_mk, LinearEquiv.coe_coe, + LinearEquiv.symm_apply_apply, LinearMap.id_apply]) + +/-- The residue projection comparison is natural on all actual left A-modules. -/ +def tensorNatIso : PDTensor.tensorFunctor k A (PDTensor.Residue (A := A)) ≅ + PDTensor.tensorFunctor k A (InflatedResidue f) := + NatIso.ofComponents (fun M => (tensorEquiv f hf hsq (PDTensor.ScalarModule k A M)).toModuleIso) + (by + intro M L h + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro s n + rfl) + +variable (M : ModuleCat.{u} A) (P : ProjectiveResolution M) +def resolutionIso : + ((PDTensor.tensorFunctor k A (PDTensor.Residue (A := A))).mapHomologicalComplex _).obj P.complex ≅ + ((PDTensor.tensorFunctor k A (InflatedResidue f)).mapHomologicalComplex _).obj P.complex := + HomologicalComplex.Hom.isoOfComponents (fun n => (tensorNatIso f hf hsq).app (P.complex.X n)) + (fun i j _ => ((tensorNatIso f hf hsq).hom.naturality (P.complex.d i j)).symm) + +/-- Actual derived residue tensor is unchanged by the proved right-module identification. -/ +def torIso (n : ℕ) : PDTensor.Tor (k := k) (PDTensor.Residue (A := A)) M n ≅ + PDTensor.Tor (k := k) (InflatedResidue f) M n := + P.isoLeftDerivedObj (PDTensor.tensorFunctor k A (PDTensor.Residue (A := A))) n ≪≫ + (HomologicalComplex.homologyFunctor _ _ n).mapIso (resolutionIso f hf hsq M P) ≪≫ + (P.isoLeftDerivedObj (PDTensor.tensorFunctor k A (InflatedResidue f)) n).symm +end LittleFinitistic.PDResidueProjection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResidueRing.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueRing.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f369c765e17942859dacfb61b0bb98e72385dbd --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueRing.lean @@ -0,0 +1,19 @@ +import OAI.Algebra.Finitistic.Dimension.PDResidueTensor +import OAI.Algebra.Finitistic.Dimension.PDSquareZero +import Mathlib.RingTheory.Ideal.Quotient.Operations + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] + +/-- The right-module quotient used by tensor detection is the underlying +vector space of the usual quotient ring A/rad A. -/ +def residueRingEquiv : Residue (A := A) ≃ₗ[k] A ⧸ Ring.jacobson A := + LinearEquiv.refl k _ +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResidueScalar.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4abcab451635e0551be38b7ffc691f1a8a6b50f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueScalar.lean @@ -0,0 +1,20 @@ +import OAI.Algebra.Finitistic.Dimension.PDResidueRing + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDResidueScalar +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] + +/-- Name the generic residue scalar structure so concrete square-zero algebras +need not unfold their entire construction during typeclass search. -/ +@[instance_reducible] def moduleK : Module k (PDTensor.Residue (A := A)) := inferInstance + +attribute [local instance] moduleK + +theorem towerK : IsScalarTower k Aᵐᵒᵖ (PDTensor.Residue (A := A)) := inferInstance +end LittleFinitistic.PDResidueScalar + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResidueSemisimple.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueSemisimple.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d85eeb4b5a44625aa8c62699c2ccfd36a847b55 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueSemisimple.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Dimension.PDResidueRing +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import Mathlib.RingTheory.Artinian.Module +import Mathlib.RingTheory.SimpleModule.WedderburnArtin + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] + +include k in +/-- The actual residue right module is semisimple. -/ +theorem residue_semisimple : IsSemisimpleModule Aᵐᵒᵖ (Residue (A := A)) := by + have : IsArtinianRing A := isArtinian_of_tower k inferInstance + let S := A ⧸ Ring.jacobson A + let q : A →+* S := Ideal.Quotient.mk (Ring.jacobson A) + have : IsSemisimpleRing S := inferInstance + have : IsSemisimpleRing Sᵐᵒᵖ := inferInstance + have : RingHomSurjective q.op := ⟨fun s => by + obtain ⟨a, ha⟩ := Ideal.Quotient.mk_surjective s.unop + exact ⟨MulOpposite.op a, congrArg MulOpposite.op ha⟩⟩ + let f : A →ₛₗ[q.op] Sᵐᵒᵖ := + { toFun := fun a => MulOpposite.op (q a) + map_add' := fun a b => by simp + map_smul' := fun a b => by change MulOpposite.op (q (b*a.unop)) = _; simp } + let e : Residue (A := A) →ₛₗ[q.op] Sᵐᵒᵖ := + (rightRadical (A := A)).liftQ f (by + intro a ha + change MulOpposite.op (Ideal.Quotient.mk (Ring.jacobson A) a) = 0 + rw [(Ideal.Quotient.eq_zero_iff_mem).mpr ha, MulOpposite.op_zero]) + have hef : (fun s => e s) = (fun s : Residue (A := A) => MulOpposite.op (residueRingEquiv (k := k) s)) := by + funext s + induction s using Submodule.Quotient.induction_on with + | _ a => rfl + have he : Function.Bijective e := by + change Function.Bijective (fun s => e s) + rw [hef] + exact MulOpposite.op_bijective.comp (residueRingEquiv (k := k)).bijective + exact (e.isSemisimpleModule_iff_of_bijective he).mpr inferInstance +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResidueTensor.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..a018a8985c1cbf9c57c716a0b80c40291bc1506c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResidueTensor.lean @@ -0,0 +1,85 @@ +import OAI.Algebra.Finitistic.Dimension.PDBalancedRight +import OAI.Algebra.Finitistic.Dimension.PDRadical + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open LinearMap Submodule +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] +variable (N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +abbrev radicalProduct := Ring.jacobson A • (⊤ : Submodule A N) +abbrev Top := N ⧸ radicalProduct (A := A) N + +def residuePair : Residue (A := A) →ₗ[k] N →ₗ[k] Top (A := A) N := by + let f : A →ₗ[k] N →ₗ[k] Top (A := A) N := + { toFun := fun a => + { toFun := fun n => (radicalProduct N).mkQ (a • n) + map_add' := fun x y => by simp [smul_add] + map_smul' := fun c n => by simp [smul_comm a c] } + map_add' := fun a b => by ext n; simp [add_smul] + map_smul' := fun c a => by ext n; simp [smul_assoc] } + exact ((rightRadical (A := A)).restrictScalars k).liftQ f (by + intro a ha + ext n + apply (Submodule.Quotient.mk_eq_zero _).mpr + exact Submodule.smul_mem_smul ha mem_top) + +@[simp] theorem residuePair_mk (a : A) (n : N) : + residuePair (k := k) N (Submodule.Quotient.mk a) n = + (radicalProduct N).mkQ (a • n) := rfl + +def residueEval : BalancedTensor.Tensor k A (Residue (A := A)) N →ₗ[k] Top (A := A) N := + BalancedTensor.lift (residuePair (k := k) N) (by + intro a s n + induction s using Submodule.Quotient.induction_on with + | _ b => change (radicalProduct N).mkQ ((b*a) • n) = _; rw [mul_smul]; rfl) + +def residueInverse : Top (A := A) N →ₗ[k] BalancedTensor.Tensor k A (Residue (A := A)) N := + ((radicalProduct (A := A) N).restrictScalars k).liftQ + (BalancedTensor.mk k A (Residue (A := A)) N (Submodule.Quotient.mk (1 : A))) (by + intro n hn + exact mk_radical_zero (k := k) (Residue (A := A)) residue_annihilated n hn _) + +@[simp] theorem residueEval_mk (a : A) (n : N) : + residueEval (k := k) N (BalancedTensor.mk k A (Residue (A := A)) N + (Submodule.Quotient.mk a) n) = (radicalProduct N).mkQ (a • n) := rfl + +@[simp] theorem residueInverse_mk (n : N) : + residueInverse (k := k) N ((radicalProduct N).mkQ n) = + BalancedTensor.mk k A (Residue (A := A)) N (Submodule.Quotient.mk (1 : A)) n := rfl + +/-- The actual noncommutative tensor/quotient identification in cor:pd-detection. -/ +def residueTensorEquiv : BalancedTensor.Tensor k A (Residue (A := A)) N ≃ₗ[k] Top (A := A) N where + __ := residueEval (k := k) N + invFun := residueInverse (k := k) N + left_inv z := by + change residueInverse (k := k) N (residueEval (k := k) N z) = z + induction z using BalancedTensor.induction_on with + | hz => simp + | ht s n => + induction s using Submodule.Quotient.induction_on with + | _ a => + rw [residueEval_mk, residueInverse_mk, ← BalancedTensor.balance] + congr 2 + change Submodule.Quotient.mk ((1 : A)*a) = Submodule.Quotient.mk a + rw [one_mul] + | ha x y hx hy => simp [hx,hy] + right_inv z := by + induction z using Submodule.Quotient.induction_on with + | _ n => + change residueEval (k := k) N (residueInverse (k := k) N ((radicalProduct N).mkQ n)) = _ + rw [residueInverse_mk, residueEval_mk, one_smul] + rfl + +/-- Nakayama proves tensor detection for every finitely generated nonzero module. -/ +theorem residueTensor_nontrivial [Module.Finite A N] [Nontrivial N] : + Nontrivial (BalancedTensor.Tensor k A (Residue (A := A)) N) := by + have := PDRadical.quotient_radical_nontrivial (A := A) N + exact (residueTensorEquiv (k := k) N).toEquiv.nontrivial +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDResolutionDetection.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDResolutionDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5128159a402d8ca12e019a0dd0e219c91bc4a47 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDResolutionDetection.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Dimension.PDLowerBound + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open CategoryTheory CategoryTheory.Limits +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] [FiniteDimensional k A] +variable (M : PDMinimal.FiniteModule k A) + +theorem bounded_residueTor_of_finite_pd + (h : ∃ b : ℕ, HasProjectiveDimensionLE M.cat b) : + ∃ b : ℕ, ∀ n, b < n → IsZero (Tor (k := k) (Residue (A := A)) M.cat n) := by + obtain ⟨b, hb⟩ := h + have : HasProjectiveDimensionLT M.cat (b+1) := hb + refine ⟨b, fun n hn => tor_zero_of_pdLT (Residue (A := A)) M n ?_⟩ + exact hasProjectiveDimensionLT_of_ge M.cat (b+1) n (by omega) + +/-- Finite projective dimension is equivalent to bounded actual residue Tor. -/ +theorem finite_pd_iff_bounded_residueTor : + projectiveDimension M.cat ≠ ⊤ ↔ + ∃ b : ℕ, ∀ n, b < n → IsZero (Tor (k := k) (Residue (A := A)) M.cat n) := by + rw [projectiveDimension_ne_top_iff] + exact ⟨bounded_residueTor_of_finite_pd M, finite_pd_of_bounded_residueTor M⟩ + +/-- The upper detector accepts any actual projective resolution, including a +bar resolution once its exactness and projectivity have been proved. -/ +theorem finite_pd_of_resolution + (P : ProjectiveResolution M.cat) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero + (((tensorFunctor k A (Residue (A := A))).mapHomologicalComplex _).obj P.complex |>.homology n)) : + projectiveDimension M.cat < ⊤ := by + apply projectiveDimension_lt_top_of_bounded_residueTor M + obtain ⟨b, hb⟩ := h + exact ⟨b, fun n hn => (hb n hn).of_iso + (P.isoLeftDerivedObj (tensorFunctor k A (Residue (A := A))) n)⟩ + +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] + +/-- The lower detector also accepts any actual projective resolution. +The nonzero class can be supplied by a summand of the bar decomposition. -/ +theorem lower_bound_of_resolution (P : ProjectiveResolution M.cat) (r n : ℕ) (hrn : r ≤ n) + (h : ¬ IsZero (((tensorFunctor k A U).mapHomologicalComplex _).obj P.complex |>.homology n)) : + r ≤ projectiveDimension M.cat := by + apply lower_bound_of_nonzero_Tor U M r n hrn + intro hz + exact h (hz.of_iso (P.isoLeftDerivedObj (tensorFunctor k A U) n).symm) +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDSimpleTensor.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDSimpleTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..84e40dc73458081947c90377bcd9042a85b80a1f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDSimpleTensor.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.Finitistic.Dimension.PDTor +import Mathlib.RingTheory.Jacobson.Ideal + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open CategoryTheory CategoryTheory.Limits +universe u +variable {A : Type u} [Ring A] + +/-- For an Artinian ring the left-defined ring radical annihilates every +actual simple right module. The proof uses cyclicity and a genuine inverse; +it does not assume a left/right-radical identification theorem. -/ +theorem right_simple_annihilated [IsArtinianRing A] + (U : Type u) [AddCommGroup U] [Module Aᵐᵒᵖ U] [IsSimpleModule Aᵐᵒᵖ U] + (a : A) (ha : a ∈ Ring.jacobson A) (u : U) : MulOpposite.op a • u=0 := by + by_contra hv + obtain ⟨b, hb⟩ := IsSimpleModule.toSpanSingleton_surjective Aᵐᵒᵖ hv u + change b • (MulOpposite.op a • u) = u at hb + have hab : -(a*b.unop) ∈ (⊥ : Ideal A).jacobson := by + rw [Ideal.jacobson_bot] + exact (Ring.jacobson A).neg_mem ((Ring.jacobson A).mul_mem_right b.unop ha) + obtain ⟨z, hz⟩ := Ideal.exists_mul_add_sub_mem_of_mem_jacobson (-(a*b.unop)) hab + have hz1 : z * (1-a*b.unop)=1 := by + have h : z * (-(a*b.unop)+1)-1=0 := hz + simpa [sub_eq_add_neg, add_comm] using sub_eq_zero.mp h + have hz2 : (1-a*b.unop)*z=1 := mul_eq_one_comm.mp hz1 + have hu : MulOpposite.op (1-a*b.unop) • u=0 := by + simp [MulOpposite.op_sub, MulOpposite.op_mul, sub_smul, mul_smul, hb] + have hu0 : u=0 := by + calc + u = MulOpposite.op ((1-a*b.unop)*z) • u := by rw [hz2, MulOpposite.op_one, one_smul] + _ = MulOpposite.op z • (MulOpposite.op (1-a*b.unop) • u) := by + rw [MulOpposite.op_mul, mul_smul] + _ = 0 := by rw [hu, smul_zero] + apply hv + rw [hu0, smul_zero] + +variable {k : Type u} [Field k] [Algebra k A] [FiniteDimensional k A] +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] + [IsSimpleModule Aᵐᵒᵖ U] +variable (M : PDMinimal.FiniteModule k A) + +/-- The derived tensor with every actual simple right module is the tensor +of that simple module with the n-th minimal projective-resolution term. -/ +def simpleTorIsoTerm (n : ℕ) : Tor (k := k) U M.cat n ≅ + (tensorFunctor k A U).obj (PDMinimal.term M n).cat := by + haveI : IsArtinianRing A := isArtinian_of_tower k inferInstance + exact torIsoTerm U M (right_simple_annihilated U) n +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDSquareZero.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDSquareZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ff4af2276c35ec0f9c986273e93302c4ea3b67b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDSquareZero.lean @@ -0,0 +1,68 @@ +import Mathlib.RingTheory.Jacobson.Radical +import Mathlib.Algebra.TrivSqZeroExt.Basic + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDSquareZero +open Submodule +universe u +variable {A D : Type u} [Ring A] [Ring D] + +/-- A square-zero ideal lies in the actual noncommutative Jacobson radical. -/ +theorem squareZero_le_jacobson (I : Ideal A) + (hI : ∀ a ∈ I, ∀ b ∈ I, a*b=0) : I ≤ Ring.jacobson A := by + apply le_sInf + intro L hL + by_contra hn + have hlt : L < L ⊔ I := lt_of_le_of_ne le_sup_left (fun he => hn (he ▸ le_sup_right)) + have htop : L ⊔ I = ⊤ := hL.2 _ hlt + have hone : (1 : A) ∈ L ⊔ I := htop.symm ▸ mem_top + obtain ⟨l, hl, x, hx, hlx⟩ := Submodule.mem_sup.mp hone + have hxx : x*x=0 := hI x hx x hx + have hleq : l=1-x := eq_sub_iff_add_eq.mpr hlx + have heq : (1+x)*l=1 := by + simp [hleq, mul_sub, add_mul, hxx] + have h1 : (1 : A) ∈ L := heq ▸ L.smul_mem (1+x) hl + exact hL.1 (Ideal.eq_top_of_isUnit_mem L h1 isUnit_one) + +/-- A surjection with square-zero kernel pulls back the ring radical exactly. -/ +theorem comap_jacobson (f : A →+* D) (hf : Function.Surjective f) + (hsq : ∀ a ∈ RingHom.ker f, ∀ b ∈ RingHom.ker f, a*b=0) : + Ideal.comap f (Ring.jacobson D) = Ring.jacobson A := by + let : RingHomSurjective f := ⟨hf⟩ + exact Module.comap_jacobson_of_ker_le (f := f.toSemilinearMap) hf + (squareZero_le_jacobson (RingHom.ker f) hsq) + +variable {k : Type u} [Field k] [Algebra k D] +variable (X : Type u) [AddCommGroup X] [Module D X] [Module Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ X] [Module k X] + [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] + +/-- The manuscript's actual split square-zero projection has square-zero kernel. -/ +theorem kernel_square_zero (a b : TrivSqZeroExt D X) + (ha : a ∈ RingHom.ker (TrivSqZeroExt.fstHom k D X).toRingHom) + (hb : b ∈ RingHom.ker (TrivSqZeroExt.fstHom k D X).toRingHom) : a*b=0 := by + have ha0 : a.fst=0 := ha + have hb0 : b.fst=0 := hb + apply TrivSqZeroExt.ext <;> simp [TrivSqZeroExt.fst_mul, TrivSqZeroExt.snd_mul, ha0, hb0] + +/-- rad(D ⋉ X) is the preimage of rad(D), hence consists precisely of pairs +whose D coordinate is in rad(D). The X coordinate is unrestricted. -/ +theorem radical_eq_comap : + Ring.jacobson (TrivSqZeroExt D X) = + Ideal.comap (TrivSqZeroExt.fstHom k D X).toRingHom (Ring.jacobson D) := by + symm + apply comap_jacobson + · intro d; exact ⟨TrivSqZeroExt.inl d, rfl⟩ + · exact fun a ha b hb => kernel_square_zero X a b ha hb + +/-- Every simple A-module is annihilated by the square-zero ideal, as used +when identifying the simple modules with those over D. -/ +theorem square_zero_ideal_le_radical : + RingHom.ker (TrivSqZeroExt.fstHom k D X).toRingHom ≤ Ring.jacobson (TrivSqZeroExt D X) := + squareZero_le_jacobson _ (fun a ha b hb => kernel_square_zero X a b ha hb) +end LittleFinitistic.PDSquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDSquareZeroResidue.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDSquareZeroResidue.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c676d1ab448fce2f129c8c1ec216a2fe08e037e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDSquareZeroResidue.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Dimension.PDSquareZero +import Mathlib.RingTheory.Ideal.Quotient.Operations +import Mathlib.RingTheory.Jacobson.Semiprimary + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDSquareZero +universe u +variable {A D : Type u} [Ring A] [Ring D] + +/-- The radical quotient is unchanged by a square-zero kernel. -/ +def residueQuotientEquiv (f : A →+* D) (hf : Function.Surjective f) + (hsq : ∀ a ∈ RingHom.ker f, ∀ b ∈ RingHom.ker f, a*b=0) : + A ⧸ Ring.jacobson A ≃+* D ⧸ Ring.jacobson D := by + let g := (Ideal.Quotient.mk (Ring.jacobson D)).comp f + have hk : RingHom.ker g = Ring.jacobson A := by + ext a + change Ideal.Quotient.mk (Ring.jacobson D) (f a) = 0 ↔ a ∈ Ring.jacobson A + rw [Ideal.Quotient.eq_zero_iff_mem] + change a ∈ Ideal.comap f (Ring.jacobson D) ↔ _ + rw [comap_jacobson f hf hsq] + exact (Ideal.quotEquivOfEq hk.symm).trans + (RingHom.quotientKerEquivOfSurjective (f := g) (Ideal.Quotient.mk_surjective.comp hf)) + +@[simp] theorem residueQuotientEquiv_mk (f : A →+* D) (hf : Function.Surjective f) + (hsq : ∀ a ∈ RingHom.ker f, ∀ b ∈ RingHom.ker f, a*b=0) (a : A) : + residueQuotientEquiv f hf hsq (Ideal.Quotient.mk (Ring.jacobson A) a) = + Ideal.Quotient.mk (Ring.jacobson D) (f a) := by + simp [residueQuotientEquiv] + +/-- The nilpotent ideal annihilates every actual simple left A-module. -/ +theorem kernel_annihilates_simple (f : A →+* D) + (hsq : ∀ a ∈ RingHom.ker f, ∀ b ∈ RingHom.ker f, a*b=0) + (S : Type u) [AddCommGroup S] [Module A S] [IsSimpleModule A S] + (a : A) (ha : a ∈ RingHom.ker f) (s : S) : a • s=0 := + Module.mem_annihilator.mp + (IsSemisimpleModule.jacobson_le_annihilator A S + (squareZero_le_jacobson (RingHom.ker f) hsq ha)) s + +variable {k : Type u} [Field k] [Algebra k D] +variable (X : Type u) [AddCommGroup X] [Module D X] [Module Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ X] [Module k X] + [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] + +/-- The exact quotient-ring isomorphism S in Section 6. -/ +def squareZeroResidueEquiv : + TrivSqZeroExt D X ⧸ Ring.jacobson (TrivSqZeroExt D X) ≃+* D ⧸ Ring.jacobson D := + residueQuotientEquiv (TrivSqZeroExt.fstHom k D X).toRingHom + (fun d => ⟨TrivSqZeroExt.inl d, rfl⟩) + (fun a ha b hb => kernel_square_zero X a b ha hb) + +@[simp] theorem squareZeroResidueEquiv_mk (a : TrivSqZeroExt D X) : + squareZeroResidueEquiv (k := k) X (Ideal.Quotient.mk _ a) = + Ideal.Quotient.mk (Ring.jacobson D) a.fst := residueQuotientEquiv_mk _ _ _ _ +end LittleFinitistic.PDSquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDTensorFunctor.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDTensorFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4796b5c92b52cd454e0bacde76cdf7a28e50a77 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDTensorFunctor.lean @@ -0,0 +1,41 @@ +import OAI.Algebra.Finitistic.Dimension.PDBalancedRight +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open CategoryTheory +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] + +abbrev ScalarModule (M : ModuleCat.{u} A) := + (ModuleCat.restrictScalars (algebraMap k A)).obj M + +instance scalarModuleTower (M : ModuleCat.{u} A) : + IsScalarTower k A (ScalarModule k A M) where + smul_assoc c a m := by + change (c • a) • (m : M) = algebraMap k A c • (a • (m : M)) + rw [Algebra.smul_def, mul_smul] + +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] + +/-- Tensor with a fixed right module, on actual left modules over A. -/ +def tensorFunctor : ModuleCat.{u} A ⥤ ModuleCat.{u} k where + obj M := ModuleCat.of k (BalancedTensor.Tensor k A U (ScalarModule k A M)) + map {M N} f := ModuleCat.ofHom + (mapRight (k := k) (M := ScalarModule k A M) (N := ScalarModule k A N) U f.hom) + map_id M := by apply ModuleCat.hom_ext; apply BalancedTensor.ext; intros; rfl + map_comp f g := by apply ModuleCat.hom_ext; apply BalancedTensor.ext; intros; rfl + +instance tensorFunctorAdditive : (tensorFunctor k A U).Additive where + map_add := by + intro M N f g + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro u m + exact map_add (BalancedTensor.mk k A U (ScalarModule k A N) u) (f.hom m) (g.hom m) +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Dimension/PDTor.lean b/lean/OAI/Algebra/Finitistic/Dimension/PDTor.lean new file mode 100644 index 0000000000000000000000000000000000000000..caa1bd192117805bdeb8a4d129f81ed29b36aeb1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Dimension/PDTor.lean @@ -0,0 +1,56 @@ +import OAI.Algebra.Finitistic.Dimension.PDTensorFunctor +import OAI.Algebra.Finitistic.Dimension.PDMinimalResolution +import Mathlib.CategoryTheory.Abelian.LeftDerived + +namespace OAI +noncomputable section +namespace LittleFinitistic.PDTensor +open CategoryTheory CategoryTheory.Limits +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] +variable (U : Type u) [AddCommGroup U] [Module k U] [Module Aᵐᵒᵖ U] + +/-- Tor is the left derived functor of the actual balanced tensor functor. -/ +abbrev Tor (M : ModuleCat.{u} A) (n : ℕ) : ModuleCat.{u} k := + ((tensorFunctor k A U).leftDerived n).obj M + +variable [FiniteDimensional k A] (M : PDMinimal.FiniteModule k A) + +def model : ChainComplex (ModuleCat k) ℕ := + ((tensorFunctor k A U).mapHomologicalComplex _).obj (PDMinimal.complex M) + +/-- The chosen minimal resolution computes this actual derived functor. -/ +def torIsoModel (n : ℕ) : Tor (k := k) U M.cat n ≅ (model U M).homology n := + (PDMinimal.resolution M).isoLeftDerivedObj (tensorFunctor k A U) n + +variable (hU : ∀ a ∈ Ring.jacobson A, ∀ u : U, MulOpposite.op a • u = 0) + +include hU in +/-- Minimality annihilates every tensor differential, including non-adjacent ones. -/ +theorem model_d_zero (i j : ℕ) : (model U M).d i j = 0 := by + change (tensorFunctor k A U).map ((PDMinimal.complex M).d i j) = 0 + by_cases h : i = j+1 + · subst i + rw [PDMinimal.complex_d] + apply ModuleCat.hom_ext + exact @mapRight_radical_zero k A _ _ _ U _ _ _ + (ScalarModule k A (PDMinimal.term M (j+1)).cat) + (ScalarModule k A (PDMinimal.term M j).cat) + _ _ _ (scalarModuleTower k A (PDMinimal.term M (j+1)).cat) + _ _ _ (scalarModuleTower k A (PDMinimal.term M j).cat) + hU (PDMinimal.differential M j) (PDMinimal.differential_radical M j) + · rw [(PDMinimal.complex M).shape i j (by change ¬ j+1=i; exact Ne.symm h)] + exact Functor.map_zero _ _ _ + +/-- Homology of the tensor of a minimal resolution is its term, because all +its differentials have been proved zero. -/ +def torIsoTerm (n : ℕ) : Tor (k := k) U M.cat n ≅ + (tensorFunctor k A U).obj (PDMinimal.term M n).cat := + torIsoModel U M n ≪≫ + (ShortComplex.LeftHomologyData.ofZeros ((model U M).sc n) + (model_d_zero U M hU _ _) (model_d_zero U M hU _ _)).homologyIso +end LittleFinitistic.PDTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/ArrowBasisIso.lean b/lean/OAI/Algebra/Finitistic/Encoding/ArrowBasisIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa8c2d0f61134df2a01d29f3097c28906667a7ed --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/ArrowBasisIso.lean @@ -0,0 +1,42 @@ +import Mathlib.Algebra.Category.ModuleCat.Biproducts +import OAI.Algebra.Finitistic.Rectification.TensorComplex +import OAI.Algebra.Finitistic.Encoding.RelationBasisCoefficients + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.ArrowBasisIso +universe u +variable (k : Type u) [Field k] (d : ℕ) + +abbrev family : Fin (d+1) → ModuleCat.{u} k := fun _ => ModuleCat.of k k + +/-- The adjacent arrow space is precisely the direct sum of its scalar arrow columns. -/ +def iso : (⨁ family k d) ≅ ModuleCat.of k (QuadraticEncoding.Arrows k d) := + ModuleCat.biproductIsoPi (family k d) + +theorem hom_proj (j : Fin (d+1)) : + (iso k d).hom ≫ ModuleCat.ofHom (LinearMap.proj j) = biproduct.π (family k d) j := by + rw [← ModuleCat.biproductIsoPi_inv_comp_π (family k d) j] + simp only [iso,Iso.hom_inv_id_assoc] + +/-- The coproduct injection sends a scalar to that scalar times its original arrow basis. -/ +theorem injection_apply (i : Fin (d+1)) (c : k) : + ((biproduct.ι (family k d) i ≫ (iso k d).hom).hom) c = + c • QuadraticEncoding.basis i := by + funext j + have h := congrArg (fun f : (family k d i) ⟶ ModuleCat.of k k => f.hom c) + (congrArg (fun f => biproduct.ι (family k d) i ≫ f) (hom_proj k d j)) + have h' : ((biproduct.ι (family k d) i ≫ (iso k d).hom).hom c) j = + (biproduct.ι (family k d) i ≫ biproduct.π (family k d) j).hom c := h + rw [h'] + classical + by_cases hij : i=j + · subst j + simp [QuadraticEncoding.basis] + · simp [hij,QuadraticEncoding.basis,Ne.symm hij] +end LittleFinitistic.ArrowBasisIso + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/AuxiliaryQuadraticPresentation.lean b/lean/OAI/Algebra/Finitistic/Encoding/AuxiliaryQuadraticPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9bc177c44e3b0efb73858f71b41335a45c58681 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/AuxiliaryQuadraticPresentation.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.Finitistic.Encoding.QuadraticPresentation +import OAI.Algebra.Finitistic.Selection.AuxiliaryGroupAlgebraPresentation + +namespace OAI +noncomputable section +namespace LittleFinitistic.QuadraticPresentation + +open GroupAlgebraPresentation in +/-- The Section 3 conversion applied to the exact Section 2 complex group algebra. -/ +theorem auxiliaryGroupAlgebra_hasFiniteQuadraticPresentation : + HasFiniteQuadraticPresentation ℂ (MonoidAlgebra ℂ Presentation.AuxiliaryGroup) := + finite_presentation_to_quadratic ℂ auxiliaryGroupAlgebra_hasFinitePresentation + +abbrev AuxiliaryOldLetter := GroupAlgebraPresentation.Letter FinitePresentation.SeedGenerator +abbrev AuxiliaryOldEquation := GroupAlgebraPresentation.EquationIndex + FinitePresentation.SeedGenerator FinitePresentation.finiteRelators + +def auxiliaryOriginalRelation (i : AuxiliaryOldEquation) : FreeAlgebra ℂ AuxiliaryOldLetter := + GroupAlgebraPresentation.equation ℂ FinitePresentation.SeedGenerator + FinitePresentation.finiteRelators i - 1 + +def auxiliaryWordBound : ℕ := + Classical.choose (exists_word_bound ℂ AuxiliaryOldLetter auxiliaryOriginalRelation) + +theorem auxiliaryWordBound_spec (i : AuxiliaryOldEquation) (w : FreeMonoid AuxiliaryOldLetter) + (hw : w ∈ (coefficients ℂ AuxiliaryOldLetter (auxiliaryOriginalRelation i)).support) : + w.toList.length ≤ auxiliaryWordBound := + Classical.choose_spec (exists_word_bound ℂ AuxiliaryOldLetter auxiliaryOriginalRelation) i w hw + +abbrev AuxiliaryLetter := Letter AuxiliaryOldLetter auxiliaryWordBound +abbrev AuxiliaryEquation := EquationIndex AuxiliaryOldLetter auxiliaryWordBound (κ := AuxiliaryOldEquation) + +def auxiliaryRelation : AuxiliaryEquation → FreeAlgebra ℂ AuxiliaryLetter := + relation ℂ AuxiliaryOldLetter auxiliaryOriginalRelation auxiliaryWordBound + +instance : Finite AuxiliaryLetter := inferInstanceAs (Finite (Letter AuxiliaryOldLetter auxiliaryWordBound)) +instance : Finite AuxiliaryEquation := inferInstanceAs + (Finite (EquationIndex AuxiliaryOldLetter auxiliaryWordBound (κ := AuxiliaryOldEquation))) + +theorem auxiliaryRelation_degree (i : AuxiliaryEquation) : + auxiliaryRelation i ∈ degreeLE ℂ AuxiliaryLetter 2 := + relation_degree ℂ AuxiliaryOldLetter auxiliaryOriginalRelation auxiliaryWordBound i + +/-- Concrete quadratic quotient and actual algebra equivalence, retaining the +proved stable group's generators and relators and eliminating its word auxiliaries. -/ +def auxiliaryQuadraticEquiv : Original ℂ AuxiliaryLetter auxiliaryRelation ≃ₐ[ℂ] + MonoidAlgebra ℂ Presentation.AuxiliaryGroup := + (quadraticEquiv ℂ AuxiliaryOldLetter auxiliaryOriginalRelation auxiliaryWordBound + auxiliaryWordBound_spec).trans GroupAlgebraPresentation.auxiliaryGroupAlgebraZeroEquiv + +end LittleFinitistic.QuadraticPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/DirectedBound.lean b/lean/OAI/Algebra/Finitistic/Encoding/DirectedBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..17321b8abfce395b9ce7188b4ffe0caea0d431ef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/DirectedBound.lean @@ -0,0 +1,272 @@ +import Mathlib.Algebra.Category.ModuleCat.ProjectiveDimension +import Mathlib.LinearAlgebra.TensorProduct.Tower +import Mathlib.LinearAlgebra.Basis.VectorSpace +import Mathlib.Algebra.Algebra.Opposite +import Mathlib.Data.Fin.Rev +import Mathlib.LinearAlgebra.FiniteDimensional.Defs + +namespace OAI +noncomputable section +open scoped TensorProduct +open TensorProduct +namespace LittleFinitistic.DirectedBound +universe u v +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] {n : ℕ} + +/-- The displayed algebraic hypotheses of Section 3, Lemma directed-bound. +The field and algebra are unital; zero idempotents are allowed by the source. -/ +structure DirectedSystem (k A : Type u) [Field k] [Ring A] [Algebra k A] (n : ℕ) where + e : Fin n → A + idem : ∀ i, e i * e i = e i + orthogonal : ∀ i j, i ≠ j → e i * e j = 0 + complete : ∑ i, e i = 1 + diagonal : ∀ i a, ∃ c : k, e i * a * e i = c • e i + directed : ∀ i j, j < i → ∀ a, e j * a * e i = 0 + +namespace DirectedSystem +variable (D : DirectedSystem k A n) +variable (M : Type v) [AddCommGroup M] [Module A M] [Module k M] + [IsScalarTower k A M] + +/-- Vanishing of vertex components below p, for arbitrary modules. -/ +def Supported (p : ℕ) : Prop := ∀ j : Fin n, j.val < p → ∀ m : M, D.e j • m = 0 + +/-- Evaluation of the free induced module. -/ +def evaluation (_D : DirectedSystem k A n) : A ⊗[k] M →ₗ[A] M := AlgebraTensorModule.lift + { toFun := fun a => + { toFun := fun m => a • m + map_add' := smul_add a + map_smul' := fun c m => smul_comm a c m } + map_add' := fun a b => by ext m; exact add_smul a b m + map_smul' := fun a b => by ext m; exact mul_smul a b m } + +@[simp] theorem evaluation_tmul (a : A) (m : M) : + evaluation M D (a ⊗ₜ[k] m) = a • m := rfl + +/-- One summand of the separable diagonal projection. -/ +def vertexProjection (i : Fin n) : A ⊗[k] M →ₗ[A] A ⊗[k] M := + AlgebraTensorModule.lift + { toFun := fun a => + { toFun := fun m => (a * D.e i) ⊗ₜ[k] (D.e i • m) + map_add' := fun x y => by simp [smul_add, tmul_add] + map_smul' := fun c m => by + simp only [RingHom.id_apply, smul_comm (D.e i) c, tmul_smul] } + map_add' := fun a b => by ext m; simp [add_mul, add_tmul] + map_smul' := fun a b => by + ext m + change ((a * b) * D.e i) ⊗ₜ[k] (D.e i • m) = + a • ((b * D.e i) ⊗ₜ[k] (D.e i • m)) + rw [smul_tmul', smul_eq_mul, mul_assoc] } + +@[simp] theorem vertexProjection_tmul (i : Fin n) (a : A) (m : M) : + D.vertexProjection M i (a ⊗ₜ[k] m) = (a * D.e i) ⊗ₜ[k] (D.e i • m) := rfl + +def projection : A ⊗[k] M →ₗ[A] A ⊗[k] M := ∑ i, D.vertexProjection M i + +@[simp] theorem projection_tmul (a : A) (m : M) : + D.projection M (a ⊗ₜ[k] m) = ∑ i, (a * D.e i) ⊗ₜ[k] (D.e i • m) := by + simp [projection] + + +lemma projection_vertexTensor (i : Fin n) (a : A) (m : M) : + D.projection M ((a * D.e i) ⊗ₜ[k] (D.e i • m)) = + (a * D.e i) ⊗ₜ[k] (D.e i • m) := by + rw [projection_tmul, Finset.sum_eq_single i] + · simp only [mul_assoc, D.idem, ← mul_smul] + · intro j _ hji + rw [mul_assoc, D.orthogonal i j hji.symm, mul_zero, zero_tmul] + · simp + +lemma projection_idempotent (x : A ⊗[k] M) : + D.projection M (D.projection M x) = D.projection M x := by + induction x using TensorProduct.inductionOn with + | tmul a m => + rw [projection_tmul, map_sum] + simp only [projection_vertexTensor] + | add x y hx hy => simp only [map_add, hx, hy] + +lemma evaluation_projection (x : A ⊗[k] M) : + evaluation M D (D.projection M x) = evaluation M D x := by + induction x using TensorProduct.inductionOn with + | tmul a m => + simp only [projection_tmul, map_sum, evaluation_tmul, ← mul_smul, mul_assoc, D.idem] + rw [← Finset.sum_smul, ← Finset.mul_sum, D.complete, mul_one] + | add x y hx hy => simp only [map_add, hx, hy] + +/-- The manuscript's projective cover, realized as an actual direct summand. -/ +abbrev Cover := LinearMap.range (D.projection M) + +instance cover_addCommGroup : AddCommGroup (D.Cover M) := + Submodule.addCommGroup _ + +instance cover_projective : Module.Projective A (D.Cover M) := by + apply Module.Projective.of_split (D.projection M).range.subtype + (D.projection M).rangeRestrict + ext x + obtain ⟨t, ht⟩ := x.property + change D.projection M x.val = x.val + rw [← ht, projection_idempotent] + +/-- Evaluation restricted to the projective summand. -/ +abbrev coverMap : D.Cover M →ₗ[A] M := + (evaluation M D).comp (D.projection M).range.subtype + +lemma coverMap_surjective : Function.Surjective (D.coverMap M) := by + intro m + refine ⟨(D.projection M).rangeRestrict (1 ⊗ₜ[k] m), ?_⟩ + change evaluation M D (D.projection M (1 ⊗ₜ[k] m)) = m + rw [evaluation_projection, evaluation_tmul, one_smul] + +lemma low_tensor {p : ℕ} (hM : D.Supported M p) (j : Fin n) (hj : j.val ≤ p) + (i : Fin n) (a : A) (m : M) : + (D.e j * a * D.e i) ⊗ₜ[k] (D.e i • m) = + D.e j ⊗ₜ[k] ((D.e j * a * D.e i) • (D.e i • m)) := by + by_cases hij : i = j + · subst i + obtain ⟨c, hc⟩ := D.diagonal j a + rw [hc, smul_tmul, smul_assoc, ← mul_smul, D.idem, tmul_smul] + · rcases lt_or_gt_of_ne hij with hij | hij + · have hz := hM i (by omega) m + simp [hz] + · rw [D.directed i j hij a] + simp + +lemma low_projection {p : ℕ} (hM : D.Supported M p) (j : Fin n) (hj : j.val ≤ p) + (x : A ⊗[k] M) : + D.e j • D.projection M x = + D.e j ⊗ₜ[k] evaluation M D (D.e j • D.projection M x) := by + induction x using TensorProduct.inductionOn with + | tmul a m => + simp only [projection_tmul, Finset.smul_sum, smul_tmul', smul_eq_mul, map_sum, + evaluation_tmul, tmul_sum] + apply Finset.sum_congr rfl + intro i _ + simpa only [← mul_assoc] using D.low_tensor M hM j hj i a m + | add x y hx hy => + simp only [map_add, smul_add, tmul_add] + exact congrArg₂ (· + ·) hx hy + +/-- One syzygy raises the lower bound on the support by one. -/ +lemma kernel_supported {p : ℕ} (hM : D.Supported M p) : + D.Supported (LinearMap.ker (D.coverMap M)) (p + 1) := by + intro j hj x + apply Subtype.ext + apply Subtype.ext + change D.e j • x.val.val = 0 + obtain ⟨t, ht⟩ := x.val.property + have h := D.low_projection M hM j (by omega) t + rw [ht] at h + rw [h, map_smul] + have hz : evaluation M D x.val.val = 0 := x.property + rw [hz, smul_zero, tmul_zero] + +open CategoryTheory + +omit [Module k M] [IsScalarTower k A M] in +lemma supported_subsingleton (hM : D.Supported M n) : Subsingleton M := by + have hz (m : M) : m = 0 := by + calc + m = (1 : A) • m := (one_smul A m).symm + _ = (∑ i, D.e i) • m := by rw [D.complete] + _ = ∑ i, D.e i • m := Finset.sum_smul + _ = 0 := Finset.sum_eq_zero (fun i _ => hM i i.isLt m) + exact ⟨fun x y => (hz x).trans (hz y).symm⟩ + +/-- The support induction uses genuine projective dimensions (vanishing Ext), +via mathlib's short exact sequence dimension-shifting theorem. -/ +theorem supported_projectiveDimensionLT (r : ℕ) : + ∀ (p : ℕ), p + r = n → ∀ (N : Type (max u v)) + [AddCommGroup N] [Module A N] [Module k N] [IsScalarTower k A N], + D.Supported N p → HasProjectiveDimensionLT (ModuleCat.of A N) r := by + induction r with + | zero => + intro p hp N _ _ _ _ hN + have hp' : p = n := by omega + subst p + have := D.supported_subsingleton N hN + exact (ModuleCat.isZero_iff_subsingleton.mpr inferInstance).hasProjectiveDimensionLT_zero + | succ r ih => + intro p hp N _ _ _ _ hN + have hK := ih (p + 1) (by omega) (LinearMap.ker (D.coverMap N)) + (D.kernel_supported N hN) + have hP : HasProjectiveDimensionLT (ModuleCat.of A (D.Cover N)) (r + 1) := + hasProjectiveDimensionLT_of_ge _ 1 (r + 1) (by omega) + exact (LinearMap.shortExact_shortComplexKer (D.coverMap_surjective N)).hasProjectiveDimensionLT_X₃ r hK hP + +include D + +/-- Every left module is covered, with no finite generation restriction. -/ +theorem all_modules_projectiveDimensionLT (N : ModuleCat.{max u v} A) : + HasProjectiveDimensionLT N n := by + let : Module k N := Module.compHom N (algebraMap k A) + let : IsScalarTower k A N := IsScalarTower.of_compHom k A N + exact D.supported_projectiveDimensionLT n 0 (by omega) N (by + intro j hj + omega) + +theorem all_modules_projectiveDimension_le (N : ModuleCat.{max u v} A) : + projectiveDimension N ≤ (n - 1 : ℕ) := by + have := D.all_modules_projectiveDimensionLT N + apply (projectiveDimension_le_iff N (n - 1)).mpr + exact hasProjectiveDimensionLT_of_ge N n ((n - 1) + 1) (by omega) + +/-- Reversing the vertices transfers exactly the hypotheses to right modules. -/ +def opposite : DirectedSystem k Aᵐᵒᵖ n where + e i := MulOpposite.op (D.e i.rev) + idem i := by + apply MulOpposite.unop_injective + exact D.idem i.rev + orthogonal i j hij := by + apply MulOpposite.unop_injective + exact D.orthogonal j.rev i.rev (fun h => hij (Fin.rev_injective h.symm)) + complete := by + apply MulOpposite.unop_injective + change (MulOpposite.opAddEquiv.symm : Aᵐᵒᵖ ≃+ A) + (∑ i : Fin n, MulOpposite.op (D.e i.rev)) = 1 + rw [map_sum] + change (∑ i : Fin n, D.e i.rev) = 1 + calc + ∑ i : Fin n, D.e i.rev = ∑ i, D.e i := Equiv.sum_comp Fin.revPerm D.e + _ = 1 := D.complete + diagonal i a := by + obtain ⟨c, hc⟩ := D.diagonal i.rev a.unop + refine ⟨c, ?_⟩ + apply MulOpposite.unop_injective + simpa only [MulOpposite.unop_mul, MulOpposite.unop_op, MulOpposite.unop_smul, + mul_assoc] using hc + directed i j hij a := by + apply MulOpposite.unop_injective + simpa only [MulOpposite.unop_mul, MulOpposite.unop_op, MulOpposite.unop_zero, + mul_assoc] using D.directed j.rev i.rev (Fin.rev_lt_rev.mpr hij) a.unop + +/-- Both sides, quantified over arbitrary modules in any larger universe. -/ +theorem both_sides_projectiveDimension_le : + (∀ N : ModuleCat.{max u v} A, projectiveDimension N ≤ (n - 1 : ℕ)) ∧ + (∀ N : ModuleCat.{max u v} Aᵐᵒᵖ, projectiveDimension N ≤ (n - 1 : ℕ)) := + ⟨D.all_modules_projectiveDimension_le, D.opposite.all_modules_projectiveDimension_le⟩ + +/-- The global dimensions are the suprema of the actual module projective dimensions. -/ +theorem both_sides_globalDimension_le : + (⨆ N : ModuleCat.{max u v} A, projectiveDimension N) ≤ (n - 1 : ℕ) ∧ + (⨆ N : ModuleCat.{max u v} Aᵐᵒᵖ, projectiveDimension N) ≤ (n - 1 : ℕ) := + ⟨iSup_le D.all_modules_projectiveDimension_le, + iSup_le D.opposite.all_modules_projectiveDimension_le⟩ +end DirectedSystem + +open CategoryTheory +/-- Section 3, Lemma directed-bound, with its displayed hypotheses expanded. +Finite dimensionality is retained here although the proof proves a stronger result. -/ +theorem directed_bound [FiniteDimensional k A] (e : Fin n → A) + (idem : ∀ i, e i * e i = e i) + (orthogonal : ∀ i j, i ≠ j → e i * e j = 0) + (complete : ∑ i, e i = 1) + (diagonal : ∀ i a, ∃ c : k, e i * a * e i = c • e i) + (directed : ∀ i j, j < i → ∀ a, e j * a * e i = 0) : + (⨆ N : ModuleCat.{max u v} A, projectiveDimension N) ≤ (n - 1 : ℕ) ∧ + (⨆ N : ModuleCat.{max u v} Aᵐᵒᵖ, projectiveDimension N) ≤ (n - 1 : ℕ) := + (DirectedSystem.mk e idem orthogonal complete diagonal directed).both_sides_globalDimension_le +end LittleFinitistic.DirectedBound + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/EncodingGenerators.lean b/lean/OAI/Algebra/Finitistic/Encoding/EncodingGenerators.lean new file mode 100644 index 0000000000000000000000000000000000000000..1521bb082fae6c7770433cd9b56484f969acec4c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/EncodingGenerators.lean @@ -0,0 +1,79 @@ +import OAI.Algebra.Finitistic.Encoding.RelationBasisCoefficients + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.EncodingGenerators +open QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The entire first arrow space inside the encoding algebra. -/ +def first : Arrows k d →ₗ[k] B P where + toFun x := (0,0,0,x,0,0) + map_add' x y := by ext <;> simp + map_smul' c x := by ext <;> simp + +/-- The entire second arrow space inside the encoding algebra. -/ +def second : Arrows k d →ₗ[k] B P where + toFun x := (0,0,0,0,x,0) + map_add' x y := by ext <;> simp + map_smul' c x := by ext <;> simp + +lemma first_mem (S : Subalgebra k (B P)) (h : ∀ a, arrow01 P a ∈ S) + (x : Arrows k d) : first P x ∈ S := by + have hx := congrArg (first P) ((Pi.basisFun k (Fin (d+1))).sum_repr x) + rw [map_sum] at hx + rw [← hx] + exact S.sum_mem fun a _ => by + simpa only [map_smul, Pi.basisFun_apply, first, LinearMap.coe_mk, + AddHom.coe_mk, arrow01, basis] using S.smul_mem (h a) (((Pi.basisFun k (Fin (d+1))).repr x) a) + +lemma second_mem (S : Subalgebra k (B P)) (h : ∀ a, arrow12 P a ∈ S) + (x : Arrows k d) : second P x ∈ S := by + have hx := congrArg (second P) ((Pi.basisFun k (Fin (d+1))).sum_repr x) + rw [map_sum] at hx + rw [← hx] + exact S.sum_mem fun a _ => by + simpa only [map_smul, Pi.basisFun_apply, second, LinearMap.coe_mk, + AddHom.coe_mk, arrow12, basis] using S.smul_mem (h a) (((Pi.basisFun k (Fin (d+1))).repr x) a) + +lemma path_mem (S : Subalgebra k (B P)) + (h01 : ∀ a, arrow01 P a ∈ S) (h12 : ∀ a, arrow12 P a ∈ S) + (x : Paths k d) : pathMap P x ∈ S := by + have hx := congrArg (pathMap P) + ((RelationBasisCoefficients.pathBasis (k := k) (d := d)).sum_repr x) + rw [map_sum] at hx + rw [← hx] + apply S.sum_mem + intro ⟨b,a⟩ _ + rw [map_smul] + apply S.smul_mem + simp only [RelationBasisCoefficients.pathBasis, Module.Basis.tensorProduct_apply, + Pi.basisFun_apply] + change pathMap P (basis b ⊗ₜ[k] basis a) ∈ S + rw [← arrow_product] + exact S.mul_mem (h12 b) (h01 a) + +/-- Vertices and the specified finite arrow list generate the full encoding, +including the quotient length-two path component. -/ +theorem eq_top (S : Subalgebra k (B P)) + (hv : ∀ i, ThreeVertexAlgebra.vertex (composition P) i ∈ S) + (h01 : ∀ a, arrow01 P a ∈ S) (h12 : ∀ a, arrow12 P a ∈ S) : S = ⊤ := by + apply top_unique + intro x _ + rcases x with ⟨c0,c1,c2,v,w,z⟩ + obtain ⟨r,hr⟩ := Submodule.Quotient.mk_surjective (relationSpace P) z + have hz : lengthTwo P z ∈ S := by + rw [← hr] + exact path_mem P S h01 h12 r + have h := S.add_mem (S.add_mem (S.add_mem (S.add_mem (S.add_mem + (S.smul_mem (hv 0) c0) (S.smul_mem (hv 1) c1)) (S.smul_mem (hv 2) c2)) + (first_mem P S h01 v)) (second_mem P S h12 w)) hz + simpa [ThreeVertexAlgebra.vertex, ThreeVertexAlgebra.add_eq, + ThreeVertexAlgebra.smul_eq, first, second, lengthTwo] using h +end LittleFinitistic.EncodingGenerators + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/EncodingLinearity.lean b/lean/OAI/Algebra/Finitistic/Encoding/EncodingLinearity.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fb42f74cb2607844146fda0c9783725e856cf52 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/EncodingLinearity.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Encoding.EncodingGenerators +import Mathlib.Algebra.Algebra.Tower + +namespace OAI +noncomputable section +namespace LittleFinitistic.EncodingLinearity +open QuadraticEncoding +universe u v w +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable {M : Type v} {N : Type w} [AddCommGroup M] [AddCommGroup N] + [Module k M] [Module k N] [Module (B P) M] [Module (B P) N] + [IsScalarTower k (B P) M] [IsScalarTower k (B P) N] + +/-- Elements whose action commutes with a specified linear map form a subalgebra. -/ +def intertwining (f : M →ₗ[k] N) : Subalgebra k (B P) where + carrier := {b | ∀ x, f (b • x) = b • f x} + zero_mem' := by intro x; simp only [zero_smul, map_zero] + one_mem' := by intro x; simp only [one_smul] + add_mem' := by + intro a b ha hb x + simp only [add_smul, map_add] + rw [ha x, hb x] + mul_mem' := by + intro a b ha hb x + simp only [mul_smul] + rw [ha (b • x), hb x] + algebraMap_mem' := by intro c x; simp only [IsScalarTower.algebraMap_smul, map_smul] + +/-- Full B-linearity follows from the actual three vertex and two finite arrow lists. +Length-two actions require no additional hypothesis. -/ +theorem map_smul (f : M →ₗ[k] N) + (hv : ∀ i x, f (ThreeVertexAlgebra.vertex (composition P) i • x) = + ThreeVertexAlgebra.vertex (composition P) i • f x) + (h01 : ∀ a x, f (arrow01 P a • x) = arrow01 P a • f x) + (h12 : ∀ a x, f (arrow12 P a • x) = arrow12 P a • f x) + (b : B P) (x : M) : f (b • x) = b • f x := by + have h := EncodingGenerators.eq_top P (intertwining P f) hv h01 h12 + have hb : b ∈ intertwining P f := by rw [h]; trivial + exact hb x + +/-- The original k-linear map, upgraded without changing its values. -/ +def linearMap (f : M →ₗ[k] N) + (hv : ∀ i x, f (ThreeVertexAlgebra.vertex (composition P) i • x) = + ThreeVertexAlgebra.vertex (composition P) i • f x) + (h01 : ∀ a x, f (arrow01 P a • x) = arrow01 P a • f x) + (h12 : ∀ a x, f (arrow12 P a • x) = arrow12 P a • f x) : M →ₗ[B P] N where + toFun := f + map_add' := f.map_add + map_smul' := map_smul P f hv h01 h12 + +/-- A vector-space isomorphism respecting the finite generating actions is a +B-module isomorphism with exactly the original forward and inverse functions. -/ +def linearEquiv (f : M ≃ₗ[k] N) + (hv : ∀ i x, f (ThreeVertexAlgebra.vertex (composition P) i • x) = + ThreeVertexAlgebra.vertex (composition P) i • f x) + (h01 : ∀ a x, f (arrow01 P a • x) = arrow01 P a • f x) + (h12 : ∀ a x, f (arrow12 P a • x) = arrow12 P a • f x) : M ≃ₗ[B P] N := + { linearMap P f.toLinearMap hv h01 h12, f.toEquiv with } +end LittleFinitistic.EncodingLinearity + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/EncodingModuleAssembly.lean b/lean/OAI/Algebra/Finitistic/Encoding/EncodingModuleAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..e45ee87e01060f7d9e99d040ac71f966602edcda --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/EncodingModuleAssembly.lean @@ -0,0 +1,41 @@ +import OAI.Algebra.Finitistic.Rectification.VertexModuleAssembly +import OAI.Algebra.Finitistic.Encoding.EncodingLinearity +import OAI.Algebra.Finitistic.Rectification.CanonicalArrowCompatibility + +namespace OAI +noncomputable section +namespace LittleFinitistic.EncodingModuleAssembly +open QuadraticEncoding VertexDecomposition VertexModuleAssembly +universe u v w +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable {M : Type v} {N : Type w} [AddCommGroup M] [AddCommGroup N] + [Module k M] [Module k N] [Module (B P) M] [Module (B P) N] + [IsScalarTower k (B P) M] [IsScalarTower k (B P) N] + +abbrev system := ThreeVertexAlgebra.directedSystem (composition P) + +/-- Reconstruct a full module isomorphism from the three actual vertex-space +isomorphisms and the two finite arrow families. Its underlying vector-space map +is precisely the direct-sum assembly of the supplied vertex isomorphisms. -/ +def equiv (E : ∀ i, Space (system P) M i ≃ₗ[k] Space (system P) N i) + (h01 : ∀ a x, E 1 (arrow (system P) (i := 0) (j := 1) (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a) x) = + arrow (system P) (i := 0) (j := 1) (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a) (E 0 x)) + (h12 : ∀ b x, E 2 (arrow (system P) (i := 1) (j := 2) (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b) x) = + arrow (system P) (i := 1) (j := 2) (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b) (E 1 x)) : M ≃ₗ[B P] N := + EncodingLinearity.linearEquiv P (assembled (system P) E) + (vertex_smul (system P) E) + (fun a => arrow_smul (system P) E (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a) + ((ConcreteQuadraticDiagram.quadratic P).ha a) (h01 a)) + (fun b => arrow_smul (system P) E (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b) + ((ConcreteQuadraticDiagram.quadratic P).hb b) (h12 b)) +end LittleFinitistic.EncodingModuleAssembly + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/FiniteBasisIso.lean b/lean/OAI/Algebra/Finitistic/Encoding/FiniteBasisIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..229ad322a8cc233ee28bae0887913da7cf3e0cd6 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/FiniteBasisIso.lean @@ -0,0 +1,45 @@ +import Mathlib.Algebra.Category.ModuleCat.Biproducts +import OAI.Algebra.Finitistic.Encoding.RelationBasisCoefficients + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.FiniteBasisIso +universe u +variable {k V : Type u} [Field k] [AddCommGroup V] [Module k V] +variable {I : Type} [Fintype I] (b : Module.Basis I k V) +abbrev family : I → ModuleCat.{u} k := fun _ => ModuleCat.of k k + +/-- An actual finite basis gives the scalar-column isomorphism, including the empty basis. -/ +def iso : (⨁ (family (k := k) : I → _)) ≅ ModuleCat.of k V := + ModuleCat.biproductIsoPi _ ≪≫ b.equivFun.symm.toModuleIso + +theorem pi_hom_proj (j : I) : + (ModuleCat.biproductIsoPi (family (k := k) : I → _)).hom ≫ + ModuleCat.ofHom (LinearMap.proj j) = biproduct.π _ j := by + rw [← ModuleCat.biproductIsoPi_inv_comp_π (family (k := k) : I → _) j] + simp only [Iso.hom_inv_id_assoc] + +theorem injection_apply (i : I) (c : k) : + (biproduct.ι (family (k := k) : I → _) i ≫ (iso b).hom).hom c = c • b i := by + apply b.equivFun.injective + change b.equivFun (b.equivFun.symm ((ModuleCat.Hom.hom + (biproduct.ι (family (k := k) : I → _) i ≫ (ModuleCat.biproductIsoPi _).hom)) c)) = + b.equivFun (c • b i) + rw [LinearEquiv.apply_symm_apply] + funext j + have h := congrArg (fun f : ModuleCat.of k k ⟶ ModuleCat.of k k => f.hom c) + (congrArg (fun f => biproduct.ι (family (k := k) : I → _) i ≫ f) + (pi_hom_proj (k := k) j)) + rw [show ((biproduct.ι (family (k := k) : I → _) i ≫ + (ModuleCat.biproductIsoPi _).hom).hom c) j = + (biproduct.ι (family (k := k) : I → _) i ≫ biproduct.π _ j).hom c from h] + classical + by_cases hij : i=j + · subst j; simp + · simp [hij,Ne.symm hij] +end LittleFinitistic.FiniteBasisIso + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/PathBasisIso.lean b/lean/OAI/Algebra/Finitistic/Encoding/PathBasisIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..00496b66940509bef58a684f5a68defb8f27a213 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/PathBasisIso.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.Finitistic.Encoding.ArrowBasisIso +import Mathlib.LinearAlgebra.TensorProduct.Pi + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct +namespace LittleFinitistic.PathBasisIso +universe u +variable (k : Type u) [Field k] (d : ℕ) +abbrev family : Fin (d+1) → ModuleCat.{u} k := fun _ => ModuleCat.of k (QuadraticEncoding.Arrows k d) + +/-- Group paths by their first traversed arrow; the later arrow is the first tensor factor. -/ +def iso : (⨁ family k d) ≅ ModuleCat.of k (QuadraticEncoding.Paths k d) := + ModuleCat.biproductIsoPi (family k d) ≪≫ + (TensorProduct.piScalarRight k k (QuadraticEncoding.Arrows k d) (Fin (d+1))).symm.toModuleIso + +theorem pi_hom_proj (j : Fin (d+1)) : + (ModuleCat.biproductIsoPi (family k d)).hom ≫ ModuleCat.ofHom (LinearMap.proj j) = + biproduct.π (family k d) j := by + rw [← ModuleCat.biproductIsoPi_inv_comp_π (family k d) j] + simp only [Iso.hom_inv_id_assoc] + +theorem pi_injection_apply (a : Fin (d+1)) (w : QuadraticEncoding.Arrows k d) : + (biproduct.ι (family k d) a ≫ (ModuleCat.biproductIsoPi (family k d)).hom).hom w = Pi.single a w := by + funext j + have h := congrArg (fun f : (family k d a) ⟶ family k d j => f.hom w) + (congrArg (fun f => biproduct.ι (family k d) a ≫ f) (pi_hom_proj k d j)) + change ((biproduct.ι (family k d) a ≫ (ModuleCat.biproductIsoPi (family k d)).hom).hom w) j = _ + rw [show ((biproduct.ι (family k d) a ≫ (ModuleCat.biproductIsoPi (family k d)).hom).hom w) j = + (biproduct.ι (family k d) a ≫ biproduct.π (family k d) j).hom w from h] + classical + by_cases haj : a=j + · subst j; simp + · simp [haj,Ne.symm haj] + +/-- A summand w at a maps to the actual tensor path w tensor a. -/ +theorem injection_apply (a : Fin (d+1)) (w : QuadraticEncoding.Arrows k d) : + (biproduct.ι (family k d) a ≫ (iso k d).hom).hom w = w ⊗ₜ[k] QuadraticEncoding.basis a := by + change (TensorProduct.piScalarRight k k (QuadraticEncoding.Arrows k d) (Fin (d+1))).symm + ((biproduct.ι (family k d) a ≫ (ModuleCat.biproductIsoPi (family k d)).hom).hom w) = _ + rw [pi_injection_apply,TensorProduct.piScalarRight_symm_single] + rfl +end LittleFinitistic.PathBasisIso + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/PresentationReindex.lean b/lean/OAI/Algebra/Finitistic/Encoding/PresentationReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..297d78a3c9d200a7080183ffcf6e68d678eca190 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/PresentationReindex.lean @@ -0,0 +1,130 @@ +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import OAI.Algebra.Finitistic.Encoding.QuadraticCoefficients +import OAI.Algebra.Finitistic.Localization.QuotientAction +import OAI.Algebra.Finitistic.Encoding.AuxiliaryQuadraticPresentation + +namespace OAI + +namespace LittleFinitistic.PresentationReindex +open QuadraticPresentation + +variable {k : Type*} [Field k] {α β κ ι : Type*} + +noncomputable def renameHom (e : α ≃ β) : FreeAlgebra k α →ₐ[k] FreeAlgebra k β := + FreeAlgebra.lift k (fun a => FreeAlgebra.ι k (e a)) + +@[simp] theorem rename_ι (e : α ≃ β) (a : α) : + renameHom (k := k) e (FreeAlgebra.ι k a) = FreeAlgebra.ι k (e a) := by + simp [renameHom] + +noncomputable def rename (e : α ≃ β) : FreeAlgebra k α ≃ₐ[k] FreeAlgebra k β := + AlgEquiv.ofAlgHom (renameHom e) (renameHom e.symm) + (by apply FreeAlgebra.hom_ext; funext a; simp) + (by apply FreeAlgebra.hom_ext; funext a; simp) + +@[simp] theorem rename_apply (e : α ≃ β) (p : FreeAlgebra k α) : rename e p = renameHom e p := rfl + +@[simp] theorem rename_word (e : α ≃ β) (w : List α) : + renameHom (k := k) e (word k α w) = word k β (w.map e) := by + unfold word + rw [map_list_prod] + simp only [List.map_map,Function.comp_def,rename_ι] + +lemma rename_degree (e : α ≃ β) {p : FreeAlgebra k α} {n : ℕ} + (hp : p ∈ degreeLE k α n) : rename e p ∈ degreeLE k β n := by + induction hp using Submodule.span_induction with + | mem x hx => + rcases hx with ⟨w,hw,rfl⟩ + simpa using word_mem_degreeLE (R := k) (w.map e) n (by simpa using hw) + | zero => simp + | add x y hx hy ihx ihy => simpa using (degreeLE k β n).add_mem ihx ihy + | smul r x hx ih => simpa using (degreeLE k β n).smul_mem r ih + +variable (e : α ≃ β) (j : κ ≃ ι) (p : κ → FreeAlgebra k α) + +noncomputable def renamedRelation (i : ι) : FreeAlgebra k β := rename e (p (j.symm i)) + +noncomputable def forward : Original k α p →ₐ[k] Original k β (renamedRelation e j p) := + (original k α p).liftₐ ((originalMap k β (renamedRelation e j p)).comp (rename e).toAlgHom) + (RingCon.ringConGen_le.mpr (by + rintro x y ⟨i,rfl,rfl⟩ + change originalMap k β (renamedRelation e j p) (rename e (p i)) = _ + have h := original_relation k β (renamedRelation e j p) (j i) + simpa [renamedRelation] using h)) + +noncomputable def backward : Original k β (renamedRelation e j p) →ₐ[k] Original k α p := + (original k β (renamedRelation e j p)).liftₐ + ((originalMap k α p).comp (rename e).symm.toAlgHom) + (RingCon.ringConGen_le.mpr (by + rintro x y ⟨i,rfl,rfl⟩ + change originalMap k α p ((rename e).symm (rename e (p (j.symm i)))) = _ + simpa only [AlgEquiv.symm_apply_apply,map_zero,AlgHom.comp_apply] using original_relation k α p (j.symm i))) + +@[simp] theorem forward_mk (f : FreeAlgebra k α) : + forward e j p (originalMap k α p f) = + originalMap k β (renamedRelation e j p) (rename e f) := rfl + +@[simp] theorem backward_mk (f : FreeAlgebra k β) : + backward e j p (originalMap k β (renamedRelation e j p) f) = + originalMap k α p ((rename e).symm f) := rfl + +/-- Relabeling finite generators and relations preserves the actual presented algebra. -/ +noncomputable def presentationEquiv : Original k α p ≃ₐ[k] Original k β (renamedRelation e j p) := + AlgEquiv.ofAlgHom (forward e j p) (backward e j p) + (by + apply AlgHom.ext + intro x + obtain ⟨f,rfl⟩ := (original k β (renamedRelation e j p)).mkₐ_surjective (α := k) x + change forward e j p (backward e j p + (originalMap k β (renamedRelation e j p) f)) = originalMap k β (renamedRelation e j p) f + rw [backward_mk,forward_mk,AlgEquiv.apply_symm_apply]) + (by + apply AlgHom.ext + intro x + obtain ⟨f,rfl⟩ := (original k α p).mkₐ_surjective (α := k) x + change backward e j p (forward e j p (originalMap k α p f)) = originalMap k α p f + rw [forward_mk,backward_mk,AlgEquiv.symm_apply_apply]) + +/-- Every finite list of quadratic polynomials has the concrete coefficient interface +used by the three-vertex algebra. -/ +theorem exists_relations {d t : ℕ} (p : Fin t → FreeAlgebra k (Fin d)) + (hp : ∀ i, p i ∈ degreeLE k (Fin d) 2) : + ∃ P : QuadraticEncoding.Relations k d t, ∀ i, QuotientAction.polynomial P i = p i := by + classical + choose c l q h using fun i => exists_coefficients k (Fin d) (p i) (hp i) + refine ⟨⟨c,l,q⟩,?_⟩ + intro i + rw [← h i] + simp only [QuotientAction.polynomial,coefficientPolynomial,Algebra.algebraMap_eq_smul_one] + abel + +/-- Finite generator and equation types may both be replaced by Fin, and all +coefficient choices preserve the exact quotient algebra. -/ +theorem finite_quadratic_encoding [Finite α] [Finite κ] + (p : κ → FreeAlgebra k α) (hp : ∀ i, p i ∈ degreeLE k α 2) : + ∃ (d t : ℕ) (P : QuadraticEncoding.Relations k d t), + Nonempty (Original k (Fin d) (QuotientAction.polynomial P) ≃ₐ[k] Original k α p) := by + classical + let := Fintype.ofFinite α + let := Fintype.ofFinite κ + let e := Fintype.equivFin α + let j := Fintype.equivFin κ + let p' := renamedRelation e j p + have hp' (i) : p' i ∈ degreeLE k (Fin (Fintype.card α)) 2 := rename_degree e (hp (j.symm i)) + obtain ⟨P,hP⟩ := exists_relations p' hp' + refine ⟨Fintype.card α,Fintype.card κ,P,?_⟩ + have heq : QuotientAction.polynomial P = p' := funext hP + rw [heq] + exact ⟨(presentationEquiv e j p).symm⟩ + +/-- The entire actual complex group algebra feeds the finite directed encoding. -/ +theorem auxiliaryGroupAlgebra_has_encoding : + ∃ (d t : ℕ) (P : QuadraticEncoding.Relations ℂ d t), + Nonempty (Original ℂ (Fin d) (QuotientAction.polynomial P) ≃ₐ[ℂ] + MonoidAlgebra ℂ Presentation.AuxiliaryGroup) := by + obtain ⟨d,t,P,⟨E⟩⟩ := finite_quadratic_encoding auxiliaryRelation auxiliaryRelation_degree + exact ⟨d,t,P,⟨E.trans auxiliaryQuadraticEquiv⟩⟩ + +end LittleFinitistic.PresentationReindex + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/QuadraticCoefficients.lean b/lean/OAI/Algebra/Finitistic/Encoding/QuadraticCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5fd17d7c354b953843de972198ac50ac8ccab2e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/QuadraticCoefficients.lean @@ -0,0 +1,96 @@ +import OAI.Algebra.Finitistic.Encoding.QuadraticPresentation +import Mathlib.LinearAlgebra.Finsupp.LinearCombination + +namespace OAI +noncomputable section +namespace LittleFinitistic.QuadraticPresentation + +variable (R : Type*) [CommRing R] (α : Type*) + +abbrev Term := Unit ⊕ (α ⊕ (α × α)) + +def term : Term α → FreeAlgebra R α + | .inl _ => 1 + | .inr (.inl a) => FreeAlgebra.ι R a + | .inr (.inr (a,b)) => FreeAlgebra.ι R a * FreeAlgebra.ι R b + +/-- The degree bound is exactly the span of constants, generators, and ordered +products of two generators. The two factors are never commuted. -/ +theorem degreeLE_two_eq_span : + degreeLE R α 2 = Submodule.span R (Set.range (term R α)) := by + apply le_antisymm + · apply Submodule.span_le.mpr + rintro f ⟨w,hw,rfl⟩ + apply Submodule.subset_span + cases w with + | nil => exact ⟨.inl (), rfl⟩ + | cons a w => + cases w with + | nil => exact ⟨.inr (.inl a), by simp [term, word]⟩ + | cons b w => + cases w with + | nil => exact ⟨.inr (.inr (a,b)), by simp [term, word]⟩ + | cons c w => simp only [List.length_cons] at hw; omega + · apply Submodule.span_le.mpr + rintro f ⟨i,rfl⟩ + rcases i with u | (a | ⟨a,b⟩) + · exact one_mem_degreeLE 2 + · exact generator_mem_degreeLE a + · exact product_mem_degreeLE a b + +/-- Finite coefficient form, suitable for the source's homogenization rule. -/ +def coefficientPolynomial [Fintype α] (c : R) (l : α → R) (q : α → α → R) : + FreeAlgebra R α := + algebraMap R (FreeAlgebra R α) c + + ∑ a, l a • FreeAlgebra.ι R a + + ∑ a, ∑ b, q a b • (FreeAlgebra.ι R a * FreeAlgebra.ι R b) + +theorem exists_coefficients [Fintype α] (p : FreeAlgebra R α) + (h : p ∈ degreeLE R α 2) : + ∃ (c : R) (l : α → R) (q : α → α → R), coefficientPolynomial R α c l q = p := by + rw [degreeLE_two_eq_span] at h + obtain ⟨f,hf⟩ := (Submodule.mem_span_range_iff_exists_fun R).mp h + refine ⟨f (.inl ()), fun a => f (.inr (.inl a)), + fun a b => f (.inr (.inr (a,b))), ?_⟩ + simpa [coefficientPolynomial, Fintype.sum_sum_type, Fintype.sum_prod_type, + term, Algebra.smul_def, add_assoc] using hf + +theorem coefficientPolynomial_degree [Fintype α] (c : R) (l : α → R) (q : α → α → R) : + coefficientPolynomial R α c l q ∈ degreeLE R α 2 := by + unfold coefficientPolynomial + apply Submodule.add_mem + · apply Submodule.add_mem + · simpa only [Algebra.smul_def, mul_one] using + (degreeLE R α 2).smul_mem c (one_mem_degreeLE (R := R) (α := α) 2) + · exact Submodule.sum_mem _ (fun a _ => + (degreeLE R α 2).smul_mem (l a) (generator_mem_degreeLE a)) + · exact Submodule.sum_mem _ (fun a _ => Submodule.sum_mem _ (fun b _ => + (degreeLE R α 2).smul_mem (q a b) (product_mem_degreeLE a b))) + +/-- An exact characterization; the degree predicate hides no higher terms. -/ +theorem degreeLE_two_iff_coefficients [Fintype α] (p : FreeAlgebra R α) : + p ∈ degreeLE R α 2 ↔ + ∃ (c : R) (l : α → R) (q : α → α → R), coefficientPolynomial R α c l q = p := by + refine ⟨exists_coefficients R α p, ?_⟩ + rintro ⟨c,l,q,rfl⟩ + exact coefficientPolynomial_degree R α c l q + +/-- Every new quadratic relation has explicit constant, linear, and ordered +quadratic coefficients, with a simultaneous choice for the whole finite family. -/ +theorem relation_coefficients [Finite α] {κ : Type*} (p : κ → FreeAlgebra R α) (N : ℕ) : + letI := Fintype.ofFinite (Letter α N) + ∃ (c : EquationIndex α N (κ := κ) → R) + (l : EquationIndex α N (κ := κ) → Letter α N → R) + (q : EquationIndex α N (κ := κ) → Letter α N → Letter α N → R), + ∀ i, coefficientPolynomial R (Letter α N) (c i) (l i) (q i) = relation R α p N i := by + let := Fintype.ofFinite (Letter α N) + have h := fun i => exists_coefficients R (Letter α N) (relation R α p N i) + (relation_degree R α p N i) + choose c l q h using h + exact ⟨c,l,q,h⟩ + +end LittleFinitistic.QuadraticPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/QuadraticEncoding.lean b/lean/OAI/Algebra/Finitistic/Encoding/QuadraticEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b3d07dfbe1d9c02c97141db385936e37d902b72 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/QuadraticEncoding.lean @@ -0,0 +1,109 @@ +import OAI.Algebra.Finitistic.Encoding.ThreeVertexAlgebra +import Mathlib.RingTheory.TensorProduct.Finite + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.QuadraticEncoding +universe u v +variable {k : Type u} [Field k] {d t : ℕ} + +/-- Coefficients of the finite quadratic relation list, including degrees zero and one. -/ +structure Relations (k : Type u) (d t : ℕ) where + constant : Fin t → k + linear : Fin t → Fin d → k + quadratic : Fin t → Fin d → Fin d → k + +abbrev Arrows (k : Type u) (d : ℕ) := Fin (d + 1) → k +abbrev Paths (k : Type u) [Field k] (d : ℕ) := Arrows k d ⊗[k] Arrows k d + +def basis (i : Fin (d + 1)) : Arrows k d := Pi.single i 1 + +def commutation (h : Fin d) : Paths k d := + basis h.succ ⊗ₜ[k] basis 0 - basis 0 ⊗ₜ[k] basis h.succ + +def homogenized (P : Relations k d t) (j : Fin t) : Paths k d := + (∑ h, ∑ l, P.quadratic j h l • (basis h.succ ⊗ₜ[k] basis l.succ)) + + (∑ h, P.linear j h • (basis 0 ⊗ₜ[k] basis h.succ)) + + P.constant j • (basis 0 ⊗ₜ[k] basis 0) + +/-- Exactly the span of a'_h s - s' a_h and all homogenized p_j. -/ +def relationSpace (P : Relations k d t) : Submodule k (Paths k d) := + Submodule.span k (Set.range (commutation (k := k) (d := d)) ∪ Set.range (homogenized P)) + +/-- Compose arrows, then quotient only the length-two path space by the specified relations. -/ +def composition (P : Relations k d t) : + Arrows k d →ₗ[k] Arrows k d →ₗ[k] (Paths k d ⧸ relationSpace P) := + (TensorProduct.mk k (Arrows k d) (Arrows k d)).compr₂ (relationSpace P).mkQ + +/-- The six path-endpoint components of the manuscript's directed encoding. -/ +abbrev B (P : Relations k d t) := ThreeVertexAlgebra (composition P) + +variable (P : Relations k d t) + +theorem finiteDimensional : FiniteDimensional k (B P) := by + have : FiniteDimensional k (Arrows k d) := inferInstance + have : FiniteDimensional k (Paths k d) := inferInstance + have : FiniteDimensional k (Paths k d ⧸ relationSpace P) := inferInstance + exact inferInstanceAs (FiniteDimensional k + (k × k × k × Arrows k d × Arrows k d × (Paths k d ⧸ relationSpace P))) + +open CategoryTheory in +/-- Actual global dimensions of the constructed finite-dimensional encoding. -/ +theorem globalDimension_le_two : + (⨆ N : ModuleCat.{max u v} (B P), projectiveDimension N) ≤ (2 : ℕ) ∧ + (⨆ N : ModuleCat.{max u v} (B P)ᵐᵒᵖ, projectiveDimension N) ≤ (2 : ℕ) := + ThreeVertexAlgebra.globalDimension_le_two (composition P) + +/-- Includes a length-two residue class as the 0-to-2 component. -/ +def lengthTwo : (Paths k d ⧸ relationSpace P) →ₗ[k] B P where + toFun z := (0, 0, 0, 0, 0, z) + map_add' x y := by + change ((0, 0, 0, 0, 0, x+y) : B P) = (0, 0, 0, 0, 0, x) + (0, 0, 0, 0, 0, y) + rw [ThreeVertexAlgebra.add_eq (composition P)] + simp + map_smul' c x := by + change ((0, 0, 0, 0, 0, c • x) : B P) = c • (0, 0, 0, 0, 0, x) + rw [ThreeVertexAlgebra.smul_eq (composition P)] + simp + +def pathMap : Paths k d →ₗ[k] B P := (lengthTwo P).comp (relationSpace P).mkQ + +/-- This records that no additional linear length-two relation was introduced. -/ +theorem pathMap_eq_zero_iff (z : Paths k d) : pathMap P z = 0 ↔ z ∈ relationSpace P := by + have hi : Function.Injective (lengthTwo P) := by + intro x y h + exact congrArg (fun a : B P => a.2.2.2.2.2) h + rw [pathMap, LinearMap.comp_apply, (map_eq_zero_iff _ hi)] + exact Submodule.Quotient.mk_eq_zero _ + +/-- Arrows s,a_1,...,a_d from vertex 0 to 1; index zero is s. -/ +def arrow01 (i : Fin (d + 1)) : B P := (0, 0, 0, basis i, 0, 0) +/-- Arrows s',a'_1,...,a'_d from vertex 1 to 2; index zero is s'. -/ +def arrow12 (i : Fin (d + 1)) : B P := (0, 0, 0, 0, basis i, 0) + +lemma arrow_product (i j : Fin (d + 1)) : + arrow12 P i * arrow01 P j = pathMap P (basis i ⊗ₜ[k] basis j) := by + change ThreeVertexAlgebra.mul (composition P) (0,0,0,0,basis i,0) + (0,0,0,basis j,0,0) = (0,0,0,0,0,(relationSpace P).mkQ (basis i ⊗ₜ[k] basis j)) + simp [ThreeVertexAlgebra.mul, composition] + +/-- Equation a'_h s = s' a_h, with exactly the manuscript's composition order. -/ +theorem commutation_holds (h : Fin d) : + arrow12 P h.succ * arrow01 P 0 = arrow12 P 0 * arrow01 P h.succ := by + rw [arrow_product, arrow_product, ← sub_eq_zero, ← map_sub] + exact (pathMap_eq_zero_iff P _).mpr (Submodule.subset_span (Or.inl ⟨h, rfl⟩)) + +/-- Every homogenized defining equation holds in the constructed algebra. -/ +theorem homogenized_holds (j : Fin t) : + (∑ h, ∑ l, P.quadratic j h l • (arrow12 P h.succ * arrow01 P l.succ)) + + (∑ h, P.linear j h • (arrow12 P 0 * arrow01 P h.succ)) + + P.constant j • (arrow12 P 0 * arrow01 P 0) = 0 := by + have hz := (pathMap_eq_zero_iff P (homogenized P j)).mpr + (Submodule.subset_span (Or.inr ⟨j, rfl⟩)) + simpa only [homogenized, map_add, map_sum, map_smul, ← arrow_product] using hz +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/QuadraticPresentation.lean b/lean/OAI/Algebra/Finitistic/Encoding/QuadraticPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c23e9c0faafd6cdcc229cc4292c2f8e7baaae237 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/QuadraticPresentation.lean @@ -0,0 +1,337 @@ +import OAI.Algebra.Finitistic.Selection.GroupAlgebraPresentation +import Mathlib.Data.Set.Finite.List +import Lean.Elab.Tactic.Omega + +namespace OAI +noncomputable section +namespace LittleFinitistic.QuadraticPresentation + +variable (R : Type*) [CommRing R] (α : Type*) + +def word (w : List α) : FreeAlgebra R α := (w.map (FreeAlgebra.ι R)).prod + +@[simp] theorem word_nil : word R α [] = 1 := rfl +@[simp] theorem word_append (u v : List α) : + word R α (u ++ v) = word R α u * word R α v := by + simp [word] +@[simp] theorem word_singleton (a : α) : word R α [a] = FreeAlgebra.ι R a := by + simp [word] + +def coefficients (p : FreeAlgebra R α) : FreeMonoid α →₀ R := + (FreeAlgebra.equivMonoidAlgebraFreeMonoid p).coeff + +theorem expansion (p : FreeAlgebra R α) : + (coefficients R α p).sum (fun w c => c • word R α w.toList) = p := by + have h := FreeAlgebra.equivMonoidAlgebraFreeMonoid.symm_apply_apply p + change MonoidAlgebra.lift R (FreeAlgebra R α) (FreeMonoid α) + (FreeMonoid.lift (FreeAlgebra.ι R)) + (FreeAlgebra.equivMonoidAlgebraFreeMonoid p) = p at h + simpa only [MonoidAlgebra.lift_apply, FreeMonoid.lift_apply, coefficients, word] using h + +/-- Degree at most n means an R-linear combination of words of length at most n. +This definition includes zero, constants, and linear terms. -/ +def degreeLE (n : ℕ) : Submodule R (FreeAlgebra R α) := + Submodule.span R {p | ∃ w : List α, w.length ≤ n ∧ p = word R α w} + +variable {R α} +theorem word_mem_degreeLE (w : List α) (n : ℕ) (h : w.length ≤ n) : + word R α w ∈ degreeLE R α n := + Submodule.subset_span ⟨w,h,rfl⟩ + +theorem one_mem_degreeLE (n : ℕ) : (1 : FreeAlgebra R α) ∈ degreeLE R α n := by + simpa using word_mem_degreeLE (R := R) ([] : List α) n (Nat.zero_le n) + +theorem generator_mem_degreeLE (a : α) : FreeAlgebra.ι R a ∈ degreeLE R α 2 := by + simpa using word_mem_degreeLE (R := R) [a] 2 (by simp) + +theorem product_mem_degreeLE (a b : α) : + FreeAlgebra.ι R a * FreeAlgebra.ι R b ∈ degreeLE R α 2 := by + simpa [word] using word_mem_degreeLE (R := R) [a,b] 2 (by simp) + +variable (R α) +/-- A single common bound for every monomial in finitely many relations. -/ +theorem exists_word_bound {κ : Type*} [Finite κ] (p : κ → FreeAlgebra R α) : + ∃ N : ℕ, ∀ i w, w ∈ (coefficients R α (p i)).support → w.toList.length ≤ N := by + let := Fintype.ofFinite κ + classical + refine ⟨Finset.univ.sup (fun i => (coefficients R α (p i)).support.sup + (fun w => w.toList.length)), ?_⟩ + intro i w hw + exact (Finset.le_sup (f := fun w : FreeMonoid α => w.toList.length) hw).trans + (Finset.le_sup (f := fun i => (coefficients R α (p i)).support.sup + (fun w => w.toList.length)) (Finset.mem_univ i)) + + + +abbrev Word (N : ℕ) := {w : List α // w.length ≤ N} +abbrev Letter (N : ℕ) := α ⊕ Word α N +abbrev Step (N : ℕ) := {s : List α × α // (s.1 ++ [s.2]).length ≤ N} + +instance word_finite [Finite α] (N : ℕ) : Finite (Word α N) := + List.finite_length_le α N + +instance step_finite [Finite α] (N : ℕ) : Finite (Step α N) := by + apply Finite.of_injective (fun s : Step α N => + ((⟨s.val.1, by have := s.property; simp only [List.length_append, + List.length_singleton] at this; omega⟩ : Word α N), s.val.2)) + intro a b h + apply Subtype.ext + exact Prod.ext (congrArg (fun x => x.1.val) h) (congrArg (fun x : Word α N × α => x.2) h) + +def wordPrefix {N : ℕ} (s : Step α N) : Word α N := + ⟨s.val.1, by have := s.property; simp only [List.length_append, + List.length_singleton] at this; omega⟩ +def extended {N : ℕ} (s : Step α N) : Word α N := ⟨s.val.1 ++ [s.val.2], s.property⟩ + +def inclusion (N : ℕ) : FreeAlgebra R α →ₐ[R] FreeAlgebra R (Letter α N) := + FreeAlgebra.lift R (fun a => FreeAlgebra.ι R (.inl a)) + +def eliminate (N : ℕ) : FreeAlgebra R (Letter α N) →ₐ[R] FreeAlgebra R α := + FreeAlgebra.lift R (Sum.elim (FreeAlgebra.ι R) (fun w => word R α w.val)) + +def encodeWord (N : ℕ) (w : FreeMonoid α) : FreeAlgebra R (Letter α N) := + if h : w.toList.length ≤ N then FreeAlgebra.ι R (.inr ⟨w.toList,h⟩) else 0 + +def linearize (N : ℕ) (p : FreeAlgebra R α) : FreeAlgebra R (Letter α N) := + (coefficients R α p).sum (fun w c => c • encodeWord R α N w) + +theorem eliminate_linearize (N : ℕ) (p : FreeAlgebra R α) + (h : ∀ w ∈ (coefficients R α p).support, w.toList.length ≤ N) : + eliminate R α N (linearize R α N p) = p := by + apply Eq.trans (b := (coefficients R α p).sum (fun w c => c • word R α w.toList)) _ (expansion R α p) + simp only [linearize, Finsupp.sum, map_sum, map_smul] + apply Finset.sum_congr rfl + intro w hw + simp [encodeWord, h w hw, eliminate] + +theorem linearize_degree (N : ℕ) (p : FreeAlgebra R α) : + linearize R α N p ∈ degreeLE R (Letter α N) 2 := by + classical + apply Submodule.sum_mem + intro w hw + apply Submodule.smul_mem + unfold encodeWord + split + · apply generator_mem_degreeLE + · apply Submodule.zero_mem + +variable {κ : Type*} (p : κ → FreeAlgebra R α) (N : ℕ) +abbrev EquationIndex := κ ⊕ (Unit ⊕ Step α N) + +def relation : EquationIndex α N (κ := κ) → FreeAlgebra R (Letter α N) + | .inl i => linearize R α N (p i) + | .inr (.inl _) => FreeAlgebra.ι R (.inr ⟨[], Nat.zero_le N⟩) - 1 + | .inr (.inr s) => FreeAlgebra.ι R (.inr (extended α s)) - + FreeAlgebra.ι R (.inr (wordPrefix α s)) * FreeAlgebra.ι R (.inl s.val.2) + +theorem relation_degree (i : EquationIndex α N (κ := κ)) : + relation R α p N i ∈ degreeLE R (Letter α N) 2 := by + rcases i with i | (u | s) + · exact linearize_degree R α N (p i) + · exact Submodule.sub_mem _ (generator_mem_degreeLE _) (one_mem_degreeLE _) + · exact Submodule.sub_mem _ (generator_mem_degreeLE _) (product_mem_degreeLE _ _) + +def original : RingCon (FreeAlgebra R α) := + ringConGen (fun x y => ∃ i, x = p i ∧ y = 0) + +def quadratic : RingCon (FreeAlgebra R (Letter α N)) := + ringConGen (fun x y => ∃ i, x = relation R α p N i ∧ y = 0) + +abbrev Original := (original R α p).Quotient +abbrev Quadratic := (quadratic R α p N).Quotient + +def originalMap : FreeAlgebra R α →ₐ[R] Original R α p := (original R α p).mkₐ R + +def quadraticMap : FreeAlgebra R (Letter α N) →ₐ[R] Quadratic R α p N := + (quadratic R α p N).mkₐ R + +theorem original_relation (i : κ) : originalMap R α p (p i) = 0 := + (original R α p).eq.mpr (RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩) + +theorem quadratic_relation (i : EquationIndex α N (κ := κ)) : + quadraticMap R α p N (relation R α p N i) = 0 := + (quadratic R α p N).eq.mpr (RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩) + + + +def oldInNew : FreeAlgebra R α →ₐ[R] Quadratic R α p N := + (quadraticMap R α p N).comp (inclusion R α N) + +/-- Every auxiliary prefix generator equals its original word in the quotient. -/ +theorem auxiliary_eq_word (w : List α) (h : w.length ≤ N) : + quadraticMap R α p N (FreeAlgebra.ι R (.inr ⟨w,h⟩)) = + oldInNew R α p N (word R α w) := by + induction w using List.reverseRecOn with + | nil => + have hh := quadratic_relation R α p N (.inr (.inl ())) + simpa only [relation, map_sub, map_one, sub_eq_zero, word_nil] using hh + | append_singleton w a ih => + have hw : w.length ≤ N := by simp only [List.length_append, List.length_singleton] at h; omega + have hh := quadratic_relation R α p N (.inr (.inr ⟨(w,a),h⟩)) + simp only [relation, map_sub, map_mul, sub_eq_zero] at hh + change quadraticMap R α p N (FreeAlgebra.ι R (.inr ⟨w ++ [a],h⟩)) = + quadraticMap R α p N (FreeAlgebra.ι R (.inr ⟨w,hw⟩)) * + quadraticMap R α p N (FreeAlgebra.ι R (.inl a)) at hh + rw [ih hw] at hh + simpa [word_append, word_singleton, map_mul, oldInNew, inclusion] using hh + +theorem linearize_in_quotient (f : FreeAlgebra R α) + (h : ∀ w ∈ (coefficients R α f).support, w.toList.length ≤ N) : + quadraticMap R α p N (linearize R α N f) = oldInNew R α p N f := by + conv_rhs => rw [← expansion R α f] + simp only [linearize, Finsupp.sum, map_sum, map_smul] + apply Finset.sum_congr rfl + intro w hw + simp only [encodeWord, dite_eq_left (h w hw)] + rw [auxiliary_eq_word] + +variable (bound : ∀ i w, w ∈ (coefficients R α (p i)).support → w.toList.length ≤ N) + +include bound in +theorem eliminate_relation (i : EquationIndex α N (κ := κ)) : + originalMap R α p (eliminate R α N (relation R α p N i)) = 0 := by + rcases i with i | (u | s) + · rw [relation, eliminate_linearize R α N (p i) (bound i)] + exact original_relation R α p i + · simp [relation, eliminate] + · simp [relation, eliminate, extended, wordPrefix] + +def toOriginal : Quadratic R α p N →ₐ[R] Original R α p := + (quadratic R α p N).liftₐ ((originalMap R α p).comp (eliminate R α N)) + (RingCon.ringConGen_le.mpr (by + rintro x y ⟨i,rfl,rfl⟩ + exact (eliminate_relation R α p N bound i).trans (map_zero _).symm)) + +def toQuadratic : Original R α p →ₐ[R] Quadratic R α p N := + (original R α p).liftₐ (oldInNew R α p N) + (RingCon.ringConGen_le.mpr (by + rintro x y ⟨i,rfl,rfl⟩ + change oldInNew R α p N (p i) = oldInNew R α p N 0 + rw [map_zero, ← linearize_in_quotient R α p N (p i) (bound i)] + exact quadratic_relation R α p N (.inl i))) + +@[simp] theorem toOriginal_quotient (f : FreeAlgebra R (Letter α N)) : + toOriginal R α p N bound (quadraticMap R α p N f) = + originalMap R α p (eliminate R α N f) := rfl + +@[simp] theorem toQuadratic_quotient (f : FreeAlgebra R α) : + toQuadratic R α p N bound (originalMap R α p f) = oldInNew R α p N f := rfl + +/-- Eliminating auxiliaries after including the old generators fixes the old algebra. -/ +theorem original_roundtrip : + (toOriginal R α p N bound).comp (toQuadratic R α p N bound) = + AlgHom.id R (Original R α p) := by + have h : ((toOriginal R α p N bound).comp (toQuadratic R α p N bound)).comp + (originalMap R α p) = originalMap R α p := by + apply FreeAlgebra.hom_ext + funext a + simp [oldInNew, inclusion, eliminate, AlgHom.comp_apply, + toQuadratic_quotient, toOriginal_quotient] + apply AlgHom.ext + intro x + obtain ⟨f,rfl⟩ := (original R α p).mkₐ_surjective (α := R) x + exact DFunLike.congr_fun h f + +/-- Prefix equations prove that the other composite fixes every new generator too. -/ +theorem quadratic_roundtrip : + (toQuadratic R α p N bound).comp (toOriginal R α p N bound) = + AlgHom.id R (Quadratic R α p N) := by + have h : ((toQuadratic R α p N bound).comp (toOriginal R α p N bound)).comp + (quadraticMap R α p N) = quadraticMap R α p N := by + apply FreeAlgebra.hom_ext + funext a + rcases a with a | ⟨w,hw⟩ + · simp [oldInNew, inclusion, eliminate, AlgHom.comp_apply, + toQuadratic_quotient, toOriginal_quotient] + · change toQuadratic R α p N bound + (toOriginal R α p N bound (quadraticMap R α p N + (FreeAlgebra.ι R (.inr ⟨w,hw⟩)))) = _ + rw [toOriginal_quotient] + simp only [eliminate, FreeAlgebra.lift_ι_apply, Sum.elim_inr] + rw [toQuadratic_quotient] + exact (auxiliary_eq_word R α p N w hw).symm + apply AlgHom.ext + intro x + obtain ⟨f,rfl⟩ := (quadratic R α p N).mkₐ_surjective (α := R) x + exact DFunLike.congr_fun h f + +/-- An algebra equivalence with mutually inverse composites. -/ +def quadraticEquiv : Quadratic R α p N ≃ₐ[R] Original R α p := + AlgEquiv.ofAlgHom (toOriginal R α p N bound) (toQuadratic R α p N bound) + (original_roundtrip R α p N bound) (quadratic_roundtrip R α p N bound) + + + +/-- Converting arbitrary equations to zero relations changes no quotient. -/ +theorem equations_eq_zero (lhs rhs : κ → FreeAlgebra R α) : + ringConGen (fun x y => ∃ i, x = lhs i ∧ y = rhs i) = + original R α (fun i => lhs i - rhs i) := by + apply le_antisymm + · apply RingCon.ringConGen_le.mpr + rintro x y ⟨i,rfl,rfl⟩ + have h : original R α (fun i => lhs i - rhs i) (lhs i - rhs i) 0 := + RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩ + have hh := (original R α (fun i => lhs i - rhs i)).add h + ((original R α (fun i => lhs i - rhs i)).refl (rhs i)) + simpa only [sub_add_cancel, zero_add] using hh + · apply RingCon.ringConGen_le.mpr + rintro x y ⟨i,rfl,rfl⟩ + let c := ringConGen (fun x y => ∃ i, x = lhs i ∧ y = rhs i) + have h : c (lhs i) (rhs i) := RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩ + have hh := c.add h (c.refl (-rhs i)) + simpa only [← sub_eq_add_neg, sub_self] using hh + +/-- A finite noncommutative presentation whose zero relations have degree ≤ 2. -/ +def HasFiniteQuadraticPresentation (A : Type*) [Ring A] [Algebra R A] : Prop := + ∃ (ι κ : Type) (_ : Finite ι) (_ : Finite κ) (p : κ → FreeAlgebra R ι), + (∀ i, p i ∈ degreeLE R ι 2) ∧ Nonempty (Original R ι p ≃ₐ[R] A) + +/-- Finite prefix conversion of any finite family of polynomial zero relations. -/ +theorem finite_zero_presentation_to_quadratic (ι κ : Type) [Finite ι] [Finite κ] + (p : κ → FreeAlgebra R ι) : + HasFiniteQuadraticPresentation R (Original R ι p) := by + obtain ⟨N,hN⟩ := exists_word_bound R ι p + exact ⟨Letter ι N, EquationIndex ι N (κ := κ), inferInstance, inferInstance, + relation R ι p N, relation_degree R ι p N, ⟨quadraticEquiv R ι p N hN⟩⟩ + +variable {R} in +/-- Transport preserves every generator, relation, and degree bound. -/ +theorem HasFiniteQuadraticPresentation.of_equiv {A B : Type*} [Ring A] [Ring B] + [Algebra R A] [Algebra R B] (h : HasFiniteQuadraticPresentation R A) + (e : A ≃ₐ[R] B) : HasFiniteQuadraticPresentation R B := by + obtain ⟨ι,κ,hι,hκ,p,hd,⟨q⟩⟩ := h + exact ⟨ι,κ,hι,hκ,p,hd,⟨q.trans e⟩⟩ + +/-- Equality of generated congruences gives an algebra equivalence of quotients. -/ +def quotientCongr {B : Type*} [Ring B] [Algebra R B] + (c d : RingCon B) (h : c = d) : c.Quotient ≃ₐ[R] d.Quotient := by + subst d + exact AlgEquiv.refl + +/-- Section 3, lines 22–31: every finitely presented associative unital algebra +has a finite quadratic presentation, allowing linear and constant terms. +Only the coefficient ring is commutative. The algebra itself need not be. -/ +theorem finite_presentation_to_quadratic {A : Type*} [Ring A] [Algebra R A] + (h : GroupAlgebraPresentation.HasFinitePresentation R A) : + HasFiniteQuadraticPresentation R A := by + obtain ⟨ι,κ,hι,hκ,lhs,rhs,⟨e⟩⟩ := h + let : Finite ι := hι + let : Finite κ := hκ + have e' : Original R ι (fun i => lhs i - rhs i) ≃ₐ[R] A := + (quotientCongr R _ _ (equations_eq_zero R ι lhs rhs).symm).trans e + exact (finite_zero_presentation_to_quadratic R ι κ (fun i => lhs i - rhs i)).of_equiv e' + +/-- The conversion also characterizes finite presentation: forgetting a degree +bound yields the original finite noncommutative notion. -/ +theorem finite_presentation_iff_quadratic {A : Type*} [Ring A] [Algebra R A] : + GroupAlgebraPresentation.HasFinitePresentation R A ↔ + HasFiniteQuadraticPresentation R A := by + refine ⟨finite_presentation_to_quadratic R, ?_⟩ + rintro ⟨ι,κ,hι,hκ,p,_,⟨e⟩⟩ + exact ⟨ι,κ,hι,hκ,p,fun _ => 0,⟨e⟩⟩ + +end LittleFinitistic.QuadraticPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/RelationBasisAction.lean b/lean/OAI/Algebra/Finitistic/Encoding/RelationBasisAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..64fcb470a2e41503c0f81cc3a74eb06e5a7e182d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/RelationBasisAction.lean @@ -0,0 +1,60 @@ +import OAI.Algebra.Finitistic.Encoding.RelationBasisCoefficients +import OAI.Algebra.Finitistic.Selection.SelectionEncoding + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.RelationBasisAction +open QuadraticEncoding RelationBasisCoefficients +universe u v +variable {k : Type u} [Field k] {R : Type v} [Ring R] [Algebra k R] +variable {d t : ℕ} (P : Relations k d t) (x : Fin d → R) + +/-- The distinguished arrow acts by one, followed by the original generators. -/ +def arrow : Fin (d+1) → R := Fin.cases 1 x + +/-- Evaluate a length-two path b a in the original algebra. -/ +def pathValue : Paths k d →ₗ[k] R := + (pathBasis (k := k) (d := d)).constr k (fun ba => arrow x ba.1 * arrow x ba.2) + +@[simp] theorem pathValue_basis (b a : Fin (d+1)) : + pathValue x (basis b ⊗ₜ[k] basis a) = arrow x b * arrow x a := by + have hb : (pathBasis (k := k) (d := d)) (b,a) = basis b ⊗ₜ[k] basis a := by + simp [pathBasis,basis] + rw [← hb] + exact (pathBasis (k := k) (d := d)).constr_basis k _ (b,a) + +variable (hx : ∀ j, (∑ h, ∑ l, P.quadratic j h l • (x h * x l)) + + (∑ h, P.linear j h • x h) + P.constant j • (1 : R) = 0) + +include hx in +/-- The entire relation space vanishes, including every chosen independent basis vector. -/ +theorem relationSpace_le_kernel : relationSpace P ≤ (pathValue x).ker := by + apply Submodule.span_le.2 + rintro z (⟨h,rfl⟩ | ⟨j,rfl⟩) + · change pathValue x (commutation h) = 0 + simp [commutation,arrow] + · change pathValue x (homogenized P j) = 0 + simpa only [homogenized,map_add,map_sum,map_smul,pathValue_basis,arrow, + Fin.cases_zero,Fin.cases_succ,one_mul,mul_one] using hx j + +include hx in +/-- Exact homogeneous coefficient equations for the fixed-diagram lifting theorem. -/ +theorem basis_action_relation (r : RelationIndex P) : + (∑ a, ∑ b, basisCoefficient P r a b • (arrow x b * arrow x a)) = 0 := by + have hz := relationSpace_le_kernel P x hx (RelationSequence.relationBasis P r).property + change pathValue x (RelationSequence.relationBasis P r).val = 0 at hz + rw [← expansion P (RelationSequence.relationBasis P r)] at hz + simpa only [map_sum,map_smul,pathValue_basis,basisCoefficient] using hz + +/-- The concrete selected algebra satisfies all equations of the independent relation basis. -/ +theorem encoding_basis_action (E : SelectionEncoding.Encoding k R) (r : RelationIndex E.relations) : + (∑ a, ∑ b, basisCoefficient E.relations r a b • + (arrow (SelectionEncoding.generator E) b * arrow (SelectionEncoding.generator E) a)) = 0 := + basis_action_relation E.relations (SelectionEncoding.generator E) + (SelectionEncoding.generator_relations E) r +end LittleFinitistic.RelationBasisAction + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/RelationBasisCoefficients.lean b/lean/OAI/Algebra/Finitistic/Encoding/RelationBasisCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..64675147d62a55769468d6e8e08ebd748283f8af --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/RelationBasisCoefficients.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Encoding.RelationSequence + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.RelationBasisCoefficients +open QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The actual ordered length-two path basis, with the later arrow first. -/ +def pathBasis : Module.Basis (Fin (d+1) × Fin (d+1)) k (Paths k d) := + (Pi.basisFun k (Fin (d+1))).tensorProduct (Pi.basisFun k (Fin (d+1))) + +/-- Coefficient of the path b a in a vector of the actual relation subspace. -/ +def coefficient (r : relationSpace P) (a b : Fin (d+1)) : k := + (pathBasis (k := k) (d := d)).repr r.val (b,a) + +theorem expansion (r : relationSpace P) : + (∑ a, ∑ b, coefficient P r a b • (basis b ⊗ₜ[k] basis a)) = r.val := by + rw [Finset.sum_comm] + simpa only [coefficient,pathBasis,Fintype.sum_prod_type, + Module.Basis.tensorProduct_apply,Pi.basisFun_apply,basis] using + (pathBasis (k := k) (d := d)).sum_repr r.val + +/-- Every vector in the chosen relation basis gives the genuine algebra equation. -/ +theorem algebra_relation (r : relationSpace P) : + (∑ a, ∑ b, coefficient P r a b • (arrow12 P b * arrow01 P a)) = 0 := by + have h := (pathMap_eq_zero_iff P r.val).2 r.property + rw [← expansion P r] at h + simpa only [map_sum,map_smul,← arrow_product] using h + +abbrev RelationIndex := Fin (Module.finrank k (relationSpace P)) + +def basisCoefficient (r : RelationIndex P) (a b : Fin (d+1)) : k := + coefficient P (RelationSequence.relationBasis P r) a b + +theorem basis_relation (r : RelationIndex P) : + (∑ a, ∑ b, basisCoefficient P r a b • (arrow12 P b * arrow01 P a)) = 0 := + algebra_relation P (RelationSequence.relationBasis P r) +end LittleFinitistic.RelationBasisCoefficients + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/RelationMatrixSequence.lean b/lean/OAI/Algebra/Finitistic/Encoding/RelationMatrixSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa4d3e33e2a0e9023c89a2fb9f5be5e9044c6bd1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/RelationMatrixSequence.lean @@ -0,0 +1,84 @@ +import OAI.Algebra.Finitistic.Encoding.FiniteBasisIso +import OAI.Algebra.Finitistic.Encoding.RelationPathCoordinates + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct +namespace LittleFinitistic.RelationMatrixSequence +open QuadraticEncoding RelationBasisCoefficients +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +abbrev relationIso := FiniteBasisIso.iso (k := k) (V := relationSpace P) (RelationSequence.relationBasis P) +abbrev pathIso := PathBasisIso.iso k d + +def inclusion := (relationIso P).hom ≫ (RelationSequence.sequence P).f ≫ (pathIso (k := k) (d := d)).inv + +def quotient := (pathIso (k := k) (d := d)).hom ≫ (RelationSequence.sequence P).g + +private theorem transported_zero {C : Type*} [Category C] [HasZeroMorphisms C] + {X₁ X₂ X₃ Y₁ Y₂ : C} (e₁ : Y₁ ≅ X₁) (e₂ : Y₂ ≅ X₂) + (f : X₁ ⟶ X₂) (g : X₂ ⟶ X₃) (h : f ≫ g = 0) : + (e₁.hom ≫ f ≫ e₂.inv) ≫ (e₂.hom ≫ g) = 0 := by + simp only [Category.assoc, Iso.inv_hom_id_assoc, h, comp_zero] + +private theorem transported_comp_hom {C : Type*} [Category C] + {X₁ X₂ Y₁ Y₂ : C} (e₁ : Y₁ ≅ X₁) (e₂ : Y₂ ≅ X₂) (f : X₁ ⟶ X₂) : + e₁.hom ≫ f = (e₁.hom ≫ f ≫ e₂.inv) ≫ e₂.hom := by + simp only [Category.assoc, Iso.inv_hom_id, Category.comp_id] + +def sequence : ShortComplex (ModuleCat.{u} k) := + .mk (inclusion P) (quotient P) + (transported_zero (relationIso P) pathIso _ _ (RelationSequence.sequence P).zero) + +/-- The actual independent relation columns and first-arrow path columns are the canonical exact sequence. -/ +def sequenceIso : sequence P ≅ RelationSequence.sequence P := + ShortComplex.isoMk (relationIso P) (pathIso (k := k) (d := d)) (Iso.refl _) + (transported_comp_hom (relationIso P) pathIso _) (by simp [sequence,quotient]; rfl) + +theorem shortExact : (sequence P).ShortExact := + (ShortComplex.shortExact_iff_of_iso (sequenceIso P)).2 (RelationSequence.sequence_shortExact P) + +/-- The concrete matrix sequence splits over the base field. -/ +def splitting : (sequence P).Splitting := (shortExact P).splittingOfProjective + +theorem realized_total_acyclic {C : Type*} [Category C] [Abelian C] + (F : ModuleCat.{u} k ⥤ CochainComplex C ℤ) [F.Additive] : + (RectificationTotal.total ((sequence P).map F).g ((sequence P).map F).f + (Homotopy.ofEq ((sequence P).map F).zero)).Acyclic := + RectificationAcyclic.short_exact_total_acyclic _ ((splitting P).map F).shortExact + +/-- Each middle column maps by the original length-two path quotient. -/ +theorem quotient_injection (a : Fin (d+1)) (w : Arrows k d) : + (biproduct.ι (PathBasisIso.family k d) a ≫ quotient P).hom w = + (relationSpace P).mkQ (w ⊗ₜ[k] basis a) := by + change (relationSpace P).mkQ ((biproduct.ι (PathBasisIso.family k d) a ≫ + (PathBasisIso.iso k d).hom).hom w) = _ + rw [PathBasisIso.injection_apply] + +/-- An independent relation column has exactly the source coefficient matrix. -/ +theorem inclusion_coordinate (r : RelationIndex P) (a : Fin (d+1)) (c : k) : + (biproduct.ι (FiniteBasisIso.family (k := k) : RelationIndex P → _) r ≫ + inclusion P ≫ biproduct.π (PathBasisIso.family k d) a).hom c = + c • ∑ b, basisCoefficient P r a b • basis b := by + have hp : (pathIso (k := k) (d := d)).inv ≫ biproduct.π (PathBasisIso.family k d) a = + ModuleCat.ofHom ((LinearMap.proj a).comp RelationPathCoordinates.coordinates.toLinearMap) := by + simp only [pathIso,PathBasisIso.iso,Iso.trans_inv,Category.assoc, + ModuleCat.biproductIsoPi_inv_comp_π] + rfl + simp only [inclusion, Category.assoc] + erw [Category.assoc (RelationSequence.sequence P).f, hp] + change RelationPathCoordinates.coordinates + (((biproduct.ι (FiniteBasisIso.family (k := k) : RelationIndex P → _) r ≫ + (relationIso P).hom).hom c : relationSpace P) : Paths k d) a = _ + rw [FiniteBasisIso.injection_apply] + change RelationPathCoordinates.coordinates + (c • ((RelationSequence.relationBasis P r : relationSpace P) : Paths k d)) a = _ + rw [map_smul] + exact congrArg (c • ·) (RelationPathCoordinates.basis_coordinate P r a) +end LittleFinitistic.RelationMatrixSequence + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/RelationPathCoordinates.lean b/lean/OAI/Algebra/Finitistic/Encoding/RelationPathCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8e7665634a23620ad81d1d12fec7ce022bff3ee --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/RelationPathCoordinates.lean @@ -0,0 +1,30 @@ +import OAI.Algebra.Finitistic.Encoding.PathBasisIso + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.RelationPathCoordinates +open QuadraticEncoding RelationBasisCoefficients +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +abbrev coordinates : Paths k d ≃ₗ[k] (Fin (d+1) → Arrows k d) := + TensorProduct.piScalarRight k k (Arrows k d) (Fin (d+1)) + +/-- The coefficient matrix of an actual relation, grouped by its first traversed arrow. -/ +theorem relation_coordinate (r : relationSpace P) (a : Fin (d+1)) : + coordinates (r : Paths k d) a = ∑ b, coefficient P r a b • basis b := by + have h := congrArg (fun z : Paths k d => coordinates z a) (expansion P r) + simpa [coordinates,TensorProduct.piScalarRightHom_tmul,Finset.sum_apply, + basis,Pi.single_apply] using h.symm + +/-- The actual independent relation basis has precisely the manuscript's q coefficients. -/ +theorem basis_coordinate (r : RelationIndex P) (a : Fin (d+1)) : + coordinates ((RelationSequence.relationBasis P r : relationSpace P) : Paths k d) a = + ∑ b, basisCoefficient P r a b • basis b := + relation_coordinate P (RelationSequence.relationBasis P r) a +end LittleFinitistic.RelationPathCoordinates + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/RelationSequence.lean b/lean/OAI/Algebra/Finitistic/Encoding/RelationSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..65efae5dc3fa43cdeb57e267a0b269006953d3d7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/RelationSequence.lean @@ -0,0 +1,66 @@ +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat +import OAI.Algebra.Finitistic.Encoding.QuadraticEncoding +import OAI.Algebra.Finitistic.Rectification.RectificationAcyclic + +namespace OAI + +namespace LittleFinitistic.RelationSequence +open CategoryTheory CategoryTheory.Limits +open QuadraticEncoding + +variable {k : Type*} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The actual length-two relation subspace, all paths, and their quotient. -/ +noncomputable def sequence : ShortComplex (ModuleCat k) where + X₁ := ModuleCat.of k (relationSpace P) + X₂ := ModuleCat.of k (Paths k d) + X₃ := ModuleCat.of k (Paths k d ⧸ relationSpace P) + f := ModuleCat.ofHom + { toFun := fun x => x.val + map_add' := by intros; rfl + map_smul' := by intros; rfl } + g := ModuleCat.ofHom + { toFun := (relationSpace P).mkQ + map_add' := (relationSpace P).mkQ.map_add + map_smul' := (relationSpace P).mkQ.map_smul } + zero := by ext x; exact (Submodule.Quotient.mk_eq_zero _).2 x.property + +/-- No additional relation appears: the path quotient sequence is genuinely exact. -/ +theorem sequence_shortExact : (sequence P).ShortExact := by + apply ModuleCat.shortComplex_shortExact + · intro x + change (relationSpace P).mkQ x = 0 ↔ ∃ y : relationSpace P, (y : Paths k d) = x + constructor + · intro hx + exact ⟨⟨x,(Submodule.Quotient.mk_eq_zero _).1 hx⟩,rfl⟩ + · rintro ⟨y,hy⟩ + exact (Submodule.Quotient.mk_eq_zero _).2 (hy ▸ y.property) + · exact (relationSpace P).injective_subtype + · exact (relationSpace P).mkQ_surjective + +/-- Over the base field this exact sequence has an actual splitting. -/ +noncomputable def sequenceSplitting : (sequence P).Splitting := + (sequence_shortExact P).splittingOfProjective + +/-- The finite relation basis used by the manuscript exists for this exact subspace. -/ +noncomputable def relationBasis : Module.Basis (Fin (Module.finrank k (relationSpace P))) k + (relationSpace P) := by + letI : Module.Free k (relationSpace P) := Module.Free.of_divisionRing k (relationSpace P) + exact Module.finBasis k (relationSpace P) + +/-- Tensoring the split path sequence with a complex, or applying any additive +realization functor, gives a short exact sequence of actual complexes. -/ +theorem realized_sequence_shortExact {C : Type*} [Category C] [Abelian C] + (F : ModuleCat k ⥤ CochainComplex C ℤ) [F.Additive] : + ((sequence P).map F).ShortExact := + ((sequenceSplitting P).map F).shortExact + +/-- The (0,2) associated graded total is acyclic after such a realization. -/ +theorem realized_sequence_total_acyclic {C : Type*} [Category C] [Abelian C] + (F : ModuleCat k ⥤ CochainComplex C ℤ) [F.Additive] : + (RectificationTotal.total ((sequence P).map F).g ((sequence P).map F).f + (Homotopy.ofEq ((sequence P).map F).zero)).Acyclic := + RectificationAcyclic.short_exact_total_acyclic _ (realized_sequence_shortExact P F) +end LittleFinitistic.RelationSequence + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/RelationVertexCoordinates.lean b/lean/OAI/Algebra/Finitistic/Encoding/RelationVertexCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..99b0e607ba33c173ac40db686d4e3863f3e0a9a2 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/RelationVertexCoordinates.lean @@ -0,0 +1,96 @@ +import OAI.Algebra.Finitistic.Rectification.VertexTensorLinear + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.RelationVertexCoordinates +open QuadraticEncoding RelationBasisCoefficients ExternalTensor.Section4 +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (D : RightComplex (QuadraticEncoding.B P)) +local notation "T" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P +abbrev vertex := AdjacentArrowSum.vertexComplex (composition P) 2 +abbrev tensor := TensorComplex.tensorFunctor (k := k) D + +def zeroIso := CornerPathTransport.coordinateIso (composition P) D 2 0 + (CornerSpaces.corner20Equiv (composition P)) +def oneIso := CornerPathTransport.coordinateIso (composition P) D 2 1 + (CornerSpaces.corner21Equiv (composition P)) +def twoIso := CornerPathTransport.coordinateIso (composition P) D 2 2 + (CornerSpaces.diagonalEquiv (composition P) 2) + +def quotientEntry (a : Fin (d+1)) := + biproduct.ι (PathBasisIso.family k d) a ≫ RelationMatrixSequence.quotient P + +def relationEntry (r : RelationIndex P) (a : Fin (d+1)) := + biproduct.ι (FiniteBasisIso.family (k := k) : RelationIndex P → _) r ≫ + RelationMatrixSequence.inclusion P ≫ biproduct.π (PathBasisIso.family k d) a + +theorem relationEntry_eq (r : RelationIndex P) (a : Fin (d+1)) : + relationEntry P r a = ∑ b, basisCoefficient P r a b • TensorArrowSum.insertion k d b := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro c + change (biproduct.ι _ r ≫ RelationMatrixSequence.inclusion P ≫ biproduct.π _ a).hom c = _ + rw [RelationMatrixSequence.inclusion_coordinate] + simp only [Finset.smul_sum,ModuleCat.hom_sum,ModuleCat.hom_smul, + LinearMap.sum_apply,LinearMap.smul_apply] + apply Finset.sum_congr rfl + intro b hb + rw [TensorArrowSum.insertion_apply] + simp only [smul_smul,mul_comm] + +/-- The source-zero p entry becomes the actual length-two path quotient. -/ +theorem p_square (a : Fin (d+1)) : + (oneIso P D).hom ≫ (tensor P D).map (quotientEntry P a) = + (vertex P).map (path k T (s).e₀ (s).e₁ (arrow01 P a) ((s).ha a) D) ≫ + (zeroIso P D).hom := by + apply CornerPathTransport.path_square + intro x + change (CornerSpaces.corner20Equiv (composition P)) + (CornerColumnPaths.cornerMap (composition P) 2 0 1 (arrow01 P a) ((s).ha a) x) = + (quotientEntry P a).hom ((CornerSpaces.corner21Equiv (composition P)) x) + rw [show (quotientEntry P a).hom ((CornerSpaces.corner21Equiv (composition P)) x) = + (relationSpace P).mkQ (((CornerSpaces.corner21Equiv (composition P)) x) ⊗ₜ[k] basis a) + from RelationMatrixSequence.quotient_injection P a _] + simpa only [LinearEquiv.symm_apply_apply] using + CornerArrowCoordinates.lengthTwo_coordinate P a ((CornerSpaces.corner21Equiv (composition P)) x) + +/-- The source-zero q entry uses the original coefficients and actual b-arrow maps. -/ +theorem q_square (r : RelationIndex P) (a : Fin (d+1)) : + (twoIso P D).hom ≫ (tensor P D).map (relationEntry P r a) = + (vertex P).map (∑ b, basisCoefficient P r a b • + path k T (s).e₁ (s).e₂ (arrow12 P b) ((s).hb b) D) ≫ (oneIso P D).hom := by + have hb (b : Fin (d+1)) : + (twoIso P D).hom ≫ (tensor P D).map (TensorArrowSum.insertion k d b) = + (vertex P).map (path k T (s).e₁ (s).e₂ (arrow12 P b) ((s).hb b) D) ≫ + (oneIso P D).hom := by + refine CornerPathTransport.path_square (composition P) D 2 1 2 + (CornerSpaces.diagonalEquiv (composition P) 2) (CornerSpaces.corner21Equiv (composition P)) + (arrow12 P b) ((s).hb b) (TensorArrowSum.insertion k d b).hom ?_ + intro x + change (CornerSpaces.corner21Equiv (composition P)) + (CornerColumnPaths.cornerMap (composition P) 2 1 2 (arrow12 P b) ((s).hb b) x) = + (TensorArrowSum.insertion k d b).hom ((CornerSpaces.diagonalEquiv (composition P) 2) x) + rw [TensorArrowSum.insertion_apply] + simpa only [LinearEquiv.symm_apply_apply] using + CornerArrowCoordinates.arrow12_coordinate P b ((CornerSpaces.diagonalEquiv (composition P) 2) x) + rw [relationEntry_eq] + simp only [Functor.map_sum,Functor.map_smul,Preadditive.comp_sum,Linear.comp_smul] + refine (Finset.sum_congr rfl + (fun b _ => congrArg (basisCoefficient P r a b • ·) (hb b))).trans ?_ + refine (Finset.sum_congr rfl (fun b _ => + (Linear.smul_comp _ _ _ (basisCoefficient P r a b) + ((vertex P).map (path k T (s).e₁ (s).e₂ (arrow12 P b) ((s).hb b) D)) + (oneIso P D).hom).symm)).trans ?_ + exact (Preadditive.sum_comp Finset.univ + (fun b => basisCoefficient P r a b • + (vertex P).map (path k T (s).e₁ (s).e₂ (arrow12 P b) ((s).hb b) D)) + (oneIso P D).hom).symm +end LittleFinitistic.RelationVertexCoordinates + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/RelationVertexSequence.lean b/lean/OAI/Algebra/Finitistic/Encoding/RelationVertexSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..f588868209cd96f1cee1e42e3764cf9d2864f2f5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/RelationVertexSequence.lean @@ -0,0 +1,82 @@ +import OAI.Algebra.Finitistic.Encoding.RelationVertexCoordinates +import OAI.Algebra.Finitistic.Localization.FiniteSumTransport +import OAI.Algebra.Finitistic.Rectification.SourceFiltrationComplex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.RelationVertexSequence +open QuadraticEncoding RelationBasisCoefficients ExternalTensor.Section4 +open ExternalTensor.Section4.SourceFiltration RelationVertexCoordinates +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +local notation "T" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P +local notation "data" => Exactness.data s D₀ D₁ D₂ f g +local instance : HasFiniteBiproducts (RightComplex T) := HasFiniteBiproducts.of_hasFiniteProducts +local instance : HasFiniteBiproducts (BiComplex k T) := HasFiniteBiproducts.of_hasFiniteProducts + +abbrev arrowFamily : Fin (d+1) → BiComplex k T := fun _ => (columnComplex k T (s).e₁).obj D₀ +abbrev relationFamily : RelationIndex P → BiComplex k T := fun _ => (columnComplex k T (s).e₂).obj D₀ + +def oneSumIso := FiniteSumTransport.iso (vertex P) (tensor P D₀) + (arrowFamily P D₀) (PathBasisIso.family k d) (fun _ => oneIso P D₀) +def twoSumIso := FiniteSumTransport.iso (vertex P) (tensor P D₀) + (relationFamily P D₀) (FiniteBasisIso.family (k := k) : RelationIndex P → _) (fun _ => twoIso P D₀) + +theorem p_square : (oneSumIso P D₀).hom ≫ (tensor P D₀).map (RelationMatrixSequence.quotient P) = + (vertex P).map (p0 data) ≫ (zeroIso P D₀).hom := by + have hg : biproduct.desc (quotientEntry P) = RelationMatrixSequence.quotient P := by + apply biproduct.hom_ext' + intro a + simp [quotientEntry] + rw [← hg] + exact FiniteSumTransport.desc_square (vertex P) (tensor P D₀) + (arrowFamily P D₀) (PathBasisIso.family k d) (fun _ => oneIso P D₀) + (zeroIso P D₀) (data).pa₀ (quotientEntry P) (RelationVertexCoordinates.p_square P D₀) + +theorem q_entry (r : RelationIndex P) (a : Fin (d+1)) : + biproduct.ι (relationFamily P D₀) r ≫ q0 data ≫ biproduct.π (arrowFamily P D₀) a = + ∑ b, basisCoefficient P r a b • + path k T (s).e₁ (s).e₂ (arrow12 P b) ((s).hb b) D₀ := by + classical + change biproduct.ι (data).W r ≫ q0 data ≫ biproduct.π (data).U a = _ + simp only [q0,biproduct.ι_desc_assoc,Preadditive.sum_comp,Category.assoc] + simp only [biproduct.ι_π] + rw [Finset.sum_eq_single a] + · simp [Exactness.data,inducedData,ConcreteQuadraticDiagram.quadratic] + rfl + · intro b hb hba + simp [hba] + · simp + +theorem q_square : (twoSumIso P D₀).hom ≫ (tensor P D₀).map (RelationMatrixSequence.inclusion P) = + (vertex P).map (q0 data) ≫ (oneSumIso P D₀).hom := by + apply FiniteSumTransport.matrix_square + intro r a + have he := q_entry P D₀ D₁ D₂ f g r a + change (twoIso P D₀).hom ≫ (tensor P D₀).map (relationEntry P r a) = + (vertex P).map (biproduct.ι (relationFamily P D₀) r ≫ q0 data ≫ + biproduct.π (arrowFamily P D₀) a) ≫ (oneIso P D₀).hom + rw [he] + exact RelationVertexCoordinates.q_square P D₀ r a + +def originalSequence : ShortComplex (BiComplex k T) := .mk (q0 data) (p0 data) (q0_p0 data) + +def sequenceIso : (originalSequence P D₀ D₁ D₂ f g).map (vertex P) ≅ + (RelationMatrixSequence.sequence P).map (tensor P D₀) := + ShortComplex.isoMk (twoSumIso P D₀) (oneSumIso P D₀) (zeroIso P D₀) + (q_square P D₀ D₁ D₂ f g) (p_square P D₀ D₁ D₂ f g) + +/-- The original source-zero p/q maps are a short exact relation sequence at the final vertex. -/ +theorem shortExact : ((originalSequence P D₀ D₁ D₂ f g).map (vertex P)).ShortExact := + (ShortComplex.shortExact_iff_of_iso (sequenceIso P D₀ D₁ D₂ f g)).2 + (((RelationMatrixSequence.splitting P).map (tensor P D₀)).shortExact) +end LittleFinitistic.RelationVertexSequence + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Encoding/ThreeVertexAlgebra.lean b/lean/OAI/Algebra/Finitistic/Encoding/ThreeVertexAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d7be0f8abbd884ffd3842173a9a485a6ac135b3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Encoding/ThreeVertexAlgebra.lean @@ -0,0 +1,165 @@ +import OAI.Algebra.Finitistic.Encoding.DirectedBound +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import Mathlib.Tactic.FinCases + +namespace OAI +noncomputable section +namespace LittleFinitistic +universe u v +variable {k V W U : Type u} [Field k] + [AddCommGroup V] [Module k V] [AddCommGroup W] [Module k W] + [AddCommGroup U] [Module k U] + +/-- Coordinates by the six possible path endpoints: three vertices, +0-to-1 arrows, 1-to-2 arrows, and length-two paths modulo relations. -/ +abbrev ThreeVertexAlgebra (_μ : W →ₗ[k] V →ₗ[k] U) := k × k × k × V × W × U + +namespace ThreeVertexAlgebra +variable (μ : W →ₗ[k] V →ₗ[k] U) + +instance : AddCommGroup (ThreeVertexAlgebra μ) := + inferInstanceAs (AddCommGroup (k × k × k × V × W × U)) +instance : Module k (ThreeVertexAlgebra μ) := + inferInstanceAs (Module k (k × k × k × V × W × U)) + +@[simp] theorem zero_eq : (0 : ThreeVertexAlgebra μ) = (0, 0, 0, 0, 0, 0) := rfl +@[simp] theorem add_eq (x y : ThreeVertexAlgebra μ) : + x + y = (x.1+y.1, x.2.1+y.2.1, x.2.2.1+y.2.2.1, + x.2.2.2.1+y.2.2.2.1, x.2.2.2.2.1+y.2.2.2.2.1, + x.2.2.2.2.2+y.2.2.2.2.2) := rfl +@[simp] theorem smul_eq (c : k) (x : ThreeVertexAlgebra μ) : + c • x = (c*x.1, c*x.2.1, c*x.2.2.1, + c • x.2.2.2.1, c • x.2.2.2.2.1, c • x.2.2.2.2.2) := rfl + +def mul (x y : ThreeVertexAlgebra μ) : ThreeVertexAlgebra μ := + (x.1 * y.1, x.2.1 * y.2.1, x.2.2.1 * y.2.2.1, + y.1 • x.2.2.2.1 + x.2.1 • y.2.2.2.1, + y.2.1 • x.2.2.2.2.1 + x.2.2.1 • y.2.2.2.2.1, + y.1 • x.2.2.2.2.2 + μ x.2.2.2.2.1 y.2.2.2.1 + x.2.2.1 • y.2.2.2.2.2) + +def unit : ThreeVertexAlgebra μ := (1, 1, 1, 0, 0, 0) + +@[ext] theorem ext (x y : ThreeVertexAlgebra μ) + (h0 : x.1 = y.1) (h1 : x.2.1 = y.2.1) (h2 : x.2.2.1 = y.2.2.1) + (hv : x.2.2.2.1 = y.2.2.2.1) (hw : x.2.2.2.2.1 = y.2.2.2.2.1) + (hu : x.2.2.2.2.2 = y.2.2.2.2.2) : x = y := + Prod.ext h0 (Prod.ext h1 (Prod.ext h2 (Prod.ext hv (Prod.ext hw hu)))) + +instance : Ring (ThreeVertexAlgebra μ) where + __ := (inferInstance : AddCommGroup (ThreeVertexAlgebra μ)) + mul := mul μ + one := unit μ + mul_assoc x y z := by + change mul μ (mul μ x y) z = mul μ x (mul μ y z) + apply Prod.ext <;> dsimp [mul] + · ring + apply Prod.ext + · ring + apply Prod.ext + · ring + apply Prod.ext + · simp only [smul_add, smul_smul]; module + apply Prod.ext + · simp only [smul_add, smul_smul]; module + · simp only [map_add, map_smul, LinearMap.add_apply, LinearMap.smul_apply, + smul_add, smul_smul]; module + one_mul x := by + change mul μ (unit μ) x = x + apply Prod.ext <;> dsimp [mul, unit] + · simp + apply Prod.ext + · simp + apply Prod.ext + · simp + apply Prod.ext + · simp + apply Prod.ext <;> simp + mul_one x := by + change mul μ x (unit μ) = x + apply Prod.ext <;> dsimp [mul, unit] + · simp + apply Prod.ext + · simp + apply Prod.ext + · simp + apply Prod.ext + · simp + apply Prod.ext <;> simp + left_distrib x y z := by + change mul μ x (y + z) = mul μ x y + mul μ x z + rw [add_eq μ (mul μ x y) (mul μ x z), add_eq μ y z] + ext <;> simp [mul, mul_add, smul_add, add_smul, map_add] <;> abel + right_distrib x y z := by + change mul μ (x + y) z = mul μ x z + mul μ y z + rw [add_eq μ (mul μ x z) (mul μ y z), add_eq μ x y] + ext <;> simp [mul, add_mul, smul_add, add_smul, map_add] <;> abel + zero_mul x := by + change (mul μ 0 x : k × k × k × V × W × U) = 0 + ext <;> simp [mul] + mul_zero x := by + change (mul μ x 0 : k × k × k × V × W × U) = 0 + ext <;> simp [mul] + + +@[simp] theorem mul_eq (x y : ThreeVertexAlgebra μ) : x * y = mul μ x y := rfl +@[simp] theorem one_eq : (1 : ThreeVertexAlgebra μ) = unit μ := rfl + +instance : Algebra k (ThreeVertexAlgebra μ) where + algebraMap := + { toFun := fun c => (c, c, c, 0, 0, 0) + map_zero' := (zero_eq μ).symm + map_one' := rfl + map_add' := fun a b => by + change ((a+b, a+b, a+b, 0, 0, 0) : ThreeVertexAlgebra μ) = + (a, a, a, 0, 0, 0) + (b, b, b, 0, 0, 0) + rw [add_eq μ] + simp + map_mul' := fun a b => by + change ((a*b, a*b, a*b, 0, 0, 0) : ThreeVertexAlgebra μ) = + mul μ (a, a, a, 0, 0, 0) (b, b, b, 0, 0, 0) + simp [mul] } + commutes' c x := by + change mul μ (c, c, c, 0, 0, 0) x = mul μ x (c, c, c, 0, 0, 0) + ext <;> simp [mul, mul_comm] + smul_def' c x := by + change c • x = mul μ (c, c, c, 0, 0, 0) x + rw [smul_eq μ] + simp [mul] + +instance [FiniteDimensional k V] [FiniteDimensional k W] [FiniteDimensional k U] : + FiniteDimensional k (ThreeVertexAlgebra μ) := + inferInstanceAs (FiniteDimensional k (k × k × k × V × W × U)) + +/-- The three vertex idempotents, in the manuscript's order. -/ +def vertex : Fin 3 → ThreeVertexAlgebra μ + | ⟨0, _⟩ => (1, 0, 0, 0, 0, 0) + | ⟨1, _⟩ => (0, 1, 0, 0, 0, 0) + | ⟨2, _⟩ => (0, 0, 1, 0, 0, 0) + +def directedSystem : DirectedBound.DirectedSystem k (ThreeVertexAlgebra μ) 3 where + e := vertex μ + idem i := by fin_cases i <;> ext <;> simp [vertex, mul] + orthogonal i j hij := by + fin_cases i <;> fin_cases j <;> simp_all [vertex, mul] + complete := by + simp [Fin.sum_univ_succ, vertex, unit, add_eq μ] + diagonal i a := by + fin_cases i + · exact ⟨a.1, by ext <;> simp [vertex, mul, smul_eq μ]⟩ + · exact ⟨a.2.1, by ext <;> simp [vertex, mul, smul_eq μ]⟩ + · exact ⟨a.2.2.1, by ext <;> simp [vertex, mul, smul_eq μ]⟩ + directed i j hij a := by + fin_cases i <;> fin_cases j <;> simp_all [vertex, mul] + +open CategoryTheory +/-- The three-vertex coordinate algebra has global dimension at most two on both sides. -/ +theorem globalDimension_le_two : + (⨆ N : ModuleCat.{max u v} (ThreeVertexAlgebra μ), projectiveDimension N) ≤ (2 : ℕ) ∧ + (⨆ N : ModuleCat.{max u v} (ThreeVertexAlgebra μ)ᵐᵒᵖ, projectiveDimension N) ≤ (2 : ℕ) := + (directedSystem μ).both_sides_globalDimension_le +end ThreeVertexAlgebra +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/AdditiveIterateAmplitude.lean b/lean/OAI/Algebra/Finitistic/Iteration/AdditiveIterateAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..03c1718a9020a726fa3d1f739e0f953d67c3d2b8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/AdditiveIterateAmplitude.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Finitistic.Iteration.IntegerIterateAmplitude + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace DerivedBar.IterateSupport +universe u w v +variable (k D : Type u) [Field k] [Ring D] [Algebra k D] +variable {E : Type w} [Category.{v} E] [Abelian E] +variable (F : ModuleCat.{u} D ⥤ E) [F.Additive] +variable (g : ℕ) (hg : ∀ M : ModuleCat.{u} D, HasProjectiveDimensionLE M g) + +include hg in +/-- A terminal additive functor applied to the actual projective bar resolution +has finite support when the input has finite cohomological support. This covers +balanced tensor with arbitrary right modules, not just the fixed bimodule. -/ +theorem additive_resolved_exact_above (Z : ChainComplex (ModuleCat.{u} D) ℕ) (m : ℕ) + (hZ : ∀ i, m < i → Z.ExactAt i) (n : ℕ) (hn : m+g+2 < n) : + ((F.mapHomologicalComplex (.down ℕ)).obj (barTotal k D Z)).ExactAt n := by + apply ProjectiveTail.map_exact_tail (barTotal k D Z) F (m+1) g + · intro i hi + exact (exactAt_iff_of_quasiIsoAt (barTotalAugmentation k D Z) i).mpr (hZ i (by omega)) + · exact barTotal_projective k D Z + · exact hg + · omega + +variable (X : Type u) [AddCommGroup X] [Module k X] [Module D X] [Module Dᵐᵒᵖ X] + [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k D X] [IsScalarTower k Dᵐᵒᵖ X] +variable (N : ModuleCat.{u} D) + +include hg in +omit [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] in +/-- The extra resolved tensor used for residue/base Tor also has a finite +bound, uniformly after every actual derived iteration. -/ +theorem iterated_additive_exact_above (r n : ℕ) (hn : (r+1)*(g+2) < n) : + ((F.mapHomologicalComplex (.down ℕ)).obj + (barTotal k D (resolvedModel k D X N r))).ExactAt n := by + apply additive_resolved_exact_above k D F g hg (resolvedModel k D X N r) + (r*(g+2)) (resolvedModel_exact_above k D X g hg N r) n + simpa only [Nat.add_mul, Nat.one_mul, Nat.add_assoc] using hn + +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +include hg in +/-- Nonzero genuine iterates are detected in a proved finite cohomological window. -/ +theorem nonzero_in_finite_window (r : ℕ) (h : ¬ IsZero (object k D X N r)) : + ∃ n : ℕ, n ≤ r*(g+2) ∧ + ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj + (object k D X N r)) := by + obtain ⟨n,hn⟩ := nonzero_homology k D X N r h + refine ⟨n, ?_, hn⟩ + by_contra hbound + have := isGE_bound k D X g hg N r + apply hn + exact DerivedCategory.isZero_of_isGE _ (-((r*(g+2) : ℕ) : ℤ)) (-(n : ℤ)) (by omega) +end DerivedBar.IterateSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/BinomialBiproduct.lean b/lean/OAI/Algebra/Finitistic/Iteration/BinomialBiproduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..76609c6a698790b37479b0b02472816593bcfc90 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/BinomialBiproduct.lean @@ -0,0 +1,53 @@ +import Mathlib.Data.Fintype.Sum +import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor +import Mathlib.CategoryTheory.Shift.CommShift + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace ExternalTensor.Binomial +attribute [local instance] preservesBinaryBiproducts_of_preservesBiproducts +universe v u +variable {C : Type u} [Category.{v} C] [Preadditive C] [HasFiniteBiproducts C] [HasBinaryBiproducts C] + +/-- Distribute a finite biproduct of binary biproducts and retain the two branch labels. -/ +def biproductBiprod {I : Type} [Fintype I] (f g : I → C) : + (⨁ fun i => f i ⊞ g i) ≅ ⨁ (Sum.elim f g) where + hom := biproduct.desc fun i => biprod.desc + (biproduct.ι (Sum.elim f g) (Sum.inl i)) (biproduct.ι (Sum.elim f g) (Sum.inr i)) + inv := biproduct.desc fun x => match x with + | .inl i => biprod.inl ≫ biproduct.ι (fun i => f i ⊞ g i) i + | .inr i => biprod.inr ≫ biproduct.ι (fun i => f i ⊞ g i) i + hom_inv_id := by + apply biproduct.hom_ext' + intro i + apply biprod.hom_ext' + · simp only [biproduct.ι_desc_assoc, Category.comp_id] + erw [biprod.inl_desc_assoc, biproduct.ι_desc] + rfl + · simp only [biproduct.ι_desc_assoc, Category.comp_id] + erw [biprod.inr_desc_assoc, biproduct.ι_desc] + rfl + inv_hom_id := by + apply biproduct.hom_ext' + intro x + cases x <;> erw [biproduct.ι_desc_assoc] + · erw [Category.assoc, biproduct.ι_desc] + erw [biprod.inl_desc, Category.comp_id] + · erw [Category.assoc, biproduct.ι_desc] + erw [biprod.inr_desc, Category.comp_id] + +variable [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] + +/-- Shift a binary splitting, using the actual shift functors and their addition isomorphism. -/ +def splitShift (Phi : C ⥤ C) [Phi.Additive] [Phi.CommShift ℤ] + (X Z : C) (b d t : ℤ) (split : Phi.obj X ≅ Z⟦b⟧ ⊞ Z⟦b+d⟧) : + Phi.obj (X⟦t⟧) ≅ Z⟦b+t⟧ ⊞ Z⟦b+d+t⟧ := + (Phi.commShiftIso t).app X ≪≫ (shiftFunctor C t).mapIso split ≪≫ + (shiftFunctor C t).mapBiprod _ _ ≪≫ + biprod.mapIso (shiftAdd Z b t).symm (shiftAdd Z (b+d) t).symm +end ExternalTensor.Binomial + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/BinomialEvenIteration.lean b/lean/OAI/Algebra/Finitistic/Iteration/BinomialEvenIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..a905049cd3565454b8240f2e7e834bf3e2acc4f3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/BinomialEvenIteration.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Iteration.BinomialVanishing + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace ExternalTensor.Binomial +universe v u w +variable {C : Type u} [Category.{v} C] [Preadditive C] + [HasFiniteBiproducts C] [HasBinaryBiproducts C] + [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] +variable {S : Type w} (F : C ⥤ C) [F.Additive] [F.CommShift ℤ] + (M : S → C) (H : S → S) (b : ℤ) + +/-- Section 6's even-iterate formula, for an actual endofunctor and an objectwise two-step split. -/ +def evenIteration + (split : ∀ Y, F.obj (F.obj (M Y)) ≅ (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+3⟧) + (j : ℕ) (Y : S) : + (F.obj^[2*j]) (M Y) ≅ + ⨁ fun q : Fin (j+1) => ⨁ fun _ : Fin (Nat.choose j q.val) => + (M ((H^[j]) Y))⟦(j : ℤ)*b + 3*(q.val : ℤ)⟧ := by + have he : (F ⋙ F).obj = F.obj ∘ F.obj := rfl + simpa only [he, binomialObject, Function.iterate_mul, Function.iterate_succ, + Function.iterate_zero, Function.id_comp, Functor.comp_obj] using + binomialIteration (F ⋙ F) M H b 3 split j Y + +/-- The precise vanishing equivalence behind the main proof's extinction step. -/ +theorem evenIteration_isZero_iff + (split : ∀ Y, F.obj (F.obj (M Y)) ≅ (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+3⟧) + (j : ℕ) (Y : S) : + IsZero ((F.obj^[2*j]) (M Y)) ↔ IsZero (M ((H^[j]) Y)) := + (evenIteration F M H b split j Y).isZero_iff.trans + (binomialObject_isZero_iff b 3 j _) + +/-- Transfer a concrete zero/nonzero pair without assuming M preserves or reflects zero. -/ +theorem even_extinction_pair + (split : ∀ Y, F.obj (F.obj (M Y)) ≅ (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+3⟧) + (m : ℕ) (Y : S) + (vanishes : IsZero (M ((H^[m+1]) Y))) + (survives : ¬ IsZero (M ((H^[m]) Y))) : + IsZero ((F.obj^[2*(m+1)]) (M Y)) ∧ ¬ IsZero ((F.obj^[2*m]) (M Y)) := + ⟨(evenIteration_isZero_iff F M H b split (m+1) Y).mpr vanishes, + fun h => survives ((evenIteration_isZero_iff F M H b split m Y).mp h)⟩ +end ExternalTensor.Binomial + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/BinomialIndex.lean b/lean/OAI/Algebra/Finitistic/Iteration/BinomialIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..7111fbfffb5c495c30b3c5ea7978630109d379e1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/BinomialIndex.lean @@ -0,0 +1,95 @@ +import Mathlib.Data.Fintype.EquivFin +import Mathlib.Data.Fintype.Sum +import Mathlib.Data.Nat.Choose.Basic +import Mathlib.Logic.Equiv.Sum + +namespace OAI +noncomputable section +namespace ExternalTensor.Binomial + +/-- A branch records the choices of the two summands during iteration. -/ +def Branch : ℕ → Type + | 0 => Unit + | n + 1 => Branch n ⊕ Branch n + +instance branchFintype : (n : ℕ) → Fintype (Branch n) + | 0 => inferInstanceAs (Fintype Unit) + | n + 1 => letI := branchFintype n; inferInstanceAs (Fintype (Branch n ⊕ Branch n)) + +def weight : {n : ℕ} → Branch n → ℕ + | 0, _ => 0 + | _ + 1, .inl x => weight x + | _ + 1, .inr x => weight x + 1 + +theorem weight_le : ∀ {n : ℕ} (x : Branch n), weight x ≤ n + | 0, _ => Nat.le_refl _ + | _n + 1, .inl x => Nat.le_succ_of_le (weight_le x) + | _n + 1, .inr x => Nat.succ_le_succ (weight_le x) + +/-- The left branch has weight zero exactly when the old branch does. -/ +def zeroFiber (n : ℕ) : {x : Branch (n+1) // weight x = 0} ≃ + {x : Branch n // weight x = 0} where + toFun x := match x with + | ⟨.inl x, h⟩ => ⟨x, h⟩ + | ⟨.inr x, h⟩ => False.elim (Nat.noConfusion h) + invFun x := ⟨.inl x.val, x.property⟩ + left_inv x := by + rcases x with ⟨x | x, h⟩ + · rfl + · exact False.elim (Nat.noConfusion h) + right_inv x := rfl + +/-- The two disjoint ways to achieve weight q+1 give Pascal's recurrence. -/ +def succFiber (n q : ℕ) : {x : Branch (n+1) // weight x = q+1} ≃ + ({x : Branch n // weight x = q+1} ⊕ {x : Branch n // weight x = q}) where + toFun x := match x with + | ⟨.inl x, h⟩ => .inl ⟨x, h⟩ + | ⟨.inr x, h⟩ => .inr ⟨x, Nat.succ.inj h⟩ + invFun x := match x with + | .inl x => ⟨.inl x.val, x.property⟩ + | .inr x => ⟨.inr x.val, congrArg Nat.succ x.property⟩ + left_inv x := by rcases x with ⟨x | x, h⟩ <;> rfl + right_inv x := by cases x <;> rfl + +theorem card_weight (n q : ℕ) : + Fintype.card {x : Branch n // weight x = q} = Nat.choose n q := by + classical + induction n generalizing q with + | zero => + cases q with + | zero => + let : Unique {x : Branch 0 // weight x = 0} := + ⟨⟨⟨(), rfl⟩⟩, fun x => by rcases x with ⟨⟨⟩, h⟩; rfl⟩ + simp + | succ q => + let : IsEmpty {x : Branch 0 // weight x = q+1} := + ⟨fun x => Nat.noConfusion x.property⟩ + simp + | succ n ih => + cases q with + | zero => rw [Fintype.card_congr (zeroFiber n), ih]; simp + | succ q => rw [Fintype.card_congr (succFiber n q), Fintype.card_sum, ih, ih, + Nat.choose_succ_succ, Nat.add_comm] + +def degree {n : ℕ} (x : Branch n) : Fin (n+1) := ⟨weight x, Nat.lt_succ_of_le (weight_le x)⟩ + +def degreeFiber (n : ℕ) (q : Fin (n+1)) : + {x : Branch n // degree x = q} ≃ {x : Branch n // weight x = q.val} := + Equiv.subtypeEquivRight (fun _ => Fin.ext_iff) + +def fiberFin (n : ℕ) (q : Fin (n+1)) : + {x : Branch n // degree x = q} ≃ Fin (Nat.choose n q.val) := by + classical + exact Fintype.equivFinOfCardEq ((Fintype.card_congr (degreeFiber n q)).trans (card_weight n q)) + +/-- Group branches by their weight, with the binomial coefficient as the exact fiber size. -/ +def groupEquiv (n : ℕ) : Branch n ≃ Σ q : Fin (n+1), Fin (Nat.choose n q.val) := + (Equiv.sigmaFiberEquiv (@degree n)).symm.trans (Equiv.sigmaCongrRight (fiberFin n)) + +@[simp] theorem groupEquiv_fst (n : ℕ) (x : Branch n) : + (groupEquiv n x).1 = degree x := rfl +end ExternalTensor.Binomial + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/BinomialIteration.lean b/lean/OAI/Algebra/Finitistic/Iteration/BinomialIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..0389cc964add6a1f2394f4b4de83c2806a442129 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/BinomialIteration.lean @@ -0,0 +1,83 @@ +import Mathlib.Data.Fintype.Sigma +import OAI.Algebra.Finitistic.Iteration.BinomialIndex +import OAI.Algebra.Finitistic.Iteration.BinomialBiproduct + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace ExternalTensor.Binomial +universe v u w +variable {C : Type u} [Category.{v} C] [Preadditive C] [HasFiniteBiproducts C] [HasBinaryBiproducts C] +variable [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] +variable {S : Type w} (Phi : C ⥤ C) [Phi.Additive] [Phi.CommShift ℤ] +variable (M : S → C) (H : S → S) (b d : ℤ) + +/-- Apply the splitting independently at each object; no naturality in S is present. -/ +def branchIteration (split : ∀ Y, Phi.obj (M Y) ≅ (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+d⟧) + (j : ℕ) (Y : S) : + (Phi.obj^[j]) (M Y) ≅ + ⨁ fun x : Branch j => (M ((H^[j]) Y))⟦(j : ℤ)*b + d*(weight x : ℤ)⟧ := by + induction j with + | zero => + letI : Unique (Branch 0) := inferInstanceAs (Unique Unit) + simpa only [Function.iterate_zero_apply, Nat.cast_zero, zero_mul, mul_zero, zero_add, weight] using + (shiftZero ℤ (M Y)).symm ≪≫ + (biproductUniqueIso (fun _ : Branch 0 => (M Y)⟦(0 : ℤ)⟧)).symm + | succ j ih => + rw [Function.iterate_succ_apply'] + refine Phi.mapIso ih ≪≫ Phi.mapBiproduct _ ≪≫ ?_ + let X := M ((H^[j+1]) Y) + let f : Branch j → C := fun x => X⟦((j+1 : ℕ) : ℤ)*b + d*(weight x : ℤ)⟧ + let g : Branch j → C := fun x => X⟦((j+1 : ℕ) : ℤ)*b + d*((weight x+1 : ℕ) : ℤ)⟧ + have step (x : Branch j) : + Phi.obj ((M ((H^[j]) Y))⟦(j : ℤ)*b+d*(weight x : ℤ)⟧) ≅ f x ⊞ g x := by + simpa only [f, g, X, Function.iterate_succ_apply', Nat.cast_add, Nat.cast_one, + add_mul, mul_add, mul_one, one_mul, add_assoc, add_left_comm, add_comm] using + splitShift Phi (M ((H^[j]) Y)) (M (H ((H^[j]) Y))) b d + ((j : ℤ)*b+d*(weight x : ℤ)) (split ((H^[j]) Y)) + refine biproduct.mapIso step ≪≫ biproductBiprod f g ≪≫ biproduct.mapIso (J := Branch j ⊕ Branch j) + (f := Sum.elim f g) + (g := fun x : Branch j ⊕ Branch j => + (M ((H^[j+1]) Y))⟦((j+1 : ℕ) : ℤ)*b + d*(weight (n := j+1) x : ℤ)⟧) ?_ + intro x + cases x with + | inl x => exact Iso.refl _ + | inr x => exact Iso.refl _ + +/-- The manuscript's repeated finite biproduct, including the multiplicity index. -/ +def binomialObject (j : ℕ) (X : C) : C := + ⨁ fun q : Fin (j+1) => ⨁ fun _ : Fin (Nat.choose j q.val) => + X⟦(j : ℤ)*b + d*(q.val : ℤ)⟧ + +/-- Regroup by weight using the proved fiber cardinality, not an assumed decomposition. -/ +def groupBiproduct (j : ℕ) (X : C) : + (⨁ fun x : Branch j => X⟦(j : ℤ)*b + d*(weight x : ℤ)⟧) ≅ + binomialObject b d j X := + biproduct.whiskerEquiv + (f := fun x : Branch j => X⟦(j : ℤ)*b + d*(weight x : ℤ)⟧) + (g := fun p : Σ q : Fin (j+1), Fin (Nat.choose j q.val) => + X⟦(j : ℤ)*b + d*(p.1.val : ℤ)⟧) + (groupEquiv j) (fun _ => Iso.refl _) ≪≫ + (biproductBiproductIso (fun q : Fin (j+1) => Fin (Nat.choose j q.val)) + (fun q _ => X⟦(j : ℤ)*b + d*(q.val : ℤ)⟧)).symm + +/-- Categorical binomial iteration with a common shift offset. -/ +def binomialIteration (split : ∀ Y, Phi.obj (M Y) ≅ (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+d⟧) + (j : ℕ) (Y : S) : + (Phi.obj^[j]) (M Y) ≅ binomialObject b d j (M ((H^[j]) Y)) := + branchIteration Phi M H b d split j Y ≪≫ groupBiproduct b d j _ + +/-- Section 4, final corollary, with only objectwise splitting isomorphisms. -/ +def section4Iteration (split : ∀ Y, Phi.obj (M Y) ≅ M (H Y) ⊞ (M (H Y))⟦(3 : ℤ)⟧) + (j : ℕ) (Y : S) : + (Phi.obj^[j]) (M Y) ≅ + ⨁ fun q : Fin (j+1) => ⨁ fun _ : Fin (Nat.choose j q.val) => + (M ((H^[j]) Y))⟦(3 : ℤ)*(q.val : ℤ)⟧ := by + have h (Y : S) : Phi.obj (M Y) ≅ (M (H Y))⟦(0 : ℤ)⟧ ⊞ (M (H Y))⟦(0+3 : ℤ)⟧ := + split Y ≪≫ biprod.mapIso (shiftZero ℤ (M (H Y))).symm (Iso.refl _) + simpa only [binomialObject, mul_zero, zero_add] using binomialIteration Phi M H 0 3 h j Y +end ExternalTensor.Binomial + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/BinomialVanishing.lean b/lean/OAI/Algebra/Finitistic/Iteration/BinomialVanishing.lean new file mode 100644 index 0000000000000000000000000000000000000000..660ec53e2c0317dce6f6ba9f712540d2fe9b902a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/BinomialVanishing.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.Finitistic.Iteration.BinomialIteration + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace ExternalTensor.Binomial +universe v u w +variable {C : Type u} [Category.{v} C] [Preadditive C] + +/-- A finite biproduct is zero exactly when all its summands are zero. -/ +theorem isZero_biproduct_iff [HasFiniteBiproducts C] {I : Type} [Fintype I] (f : I → C) : + IsZero (⨁ f) ↔ ∀ i, IsZero (f i) := by + constructor + · intro h i + exact IsZero.of_mono (biproduct.ι f i) h + · intro h + apply (IsZero.iff_id_eq_zero _).mpr + apply biproduct.hom_ext + intro i + exact (h i).eq_of_tgt _ _ + +variable [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] + +/-- Integer shifts preserve and reflect the zero object. -/ +theorem isZero_shift_iff (X : C) (n : ℤ) : IsZero (X⟦n⟧) ↔ IsZero X := by + constructor + · exact IsZero.of_full_of_faithful_of_isZero (shiftFunctor C n) X + · intro h + apply (IsZero.iff_id_eq_zero _).mpr + rw [← (shiftFunctor C n).map_id, h.eq_zero_of_src (𝟙 X), Functor.map_zero] + +variable [HasFiniteBiproducts C] + +/-- The q=0 summand always occurs once, so the binomial expansion detects zero. -/ +theorem binomialObject_isZero_iff (b d : ℤ) (j : ℕ) (X : C) : + IsZero (binomialObject b d j X) ↔ IsZero X := by + unfold binomialObject + rw [isZero_biproduct_iff] + simp only [isZero_biproduct_iff, isZero_shift_iff] + constructor + · intro h + exact h ⟨0, Nat.succ_pos j⟩ ⟨0, by simp⟩ + · intro h _ _ + exact h + +variable [HasBinaryBiproducts C] +variable {S : Type w} (Phi : C ⥤ C) [Phi.Additive] [Phi.CommShift ℤ] + (M : S → C) (H : S → S) (b d : ℤ) + +/-- Exact zero detection for the iterates; no faithfulness of M is silently assumed. -/ +theorem iteration_isZero_iff + (split : ∀ Y, Phi.obj (M Y) ≅ (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+d⟧) + (j : ℕ) (Y : S) : + IsZero ((Phi.obj^[j]) (M Y)) ↔ IsZero (M ((H^[j]) Y)) := + (binomialIteration Phi M H b d split j Y).isZero_iff.trans + (binomialObject_isZero_iff b d j _) + +theorem iteration_nonzero_iff + (split : ∀ Y, Phi.obj (M Y) ≅ (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+d⟧) + (j : ℕ) (Y : S) : + ¬ IsZero ((Phi.obj^[j]) (M Y)) ↔ ¬ IsZero (M ((H^[j]) Y)) := + not_congr (iteration_isZero_iff Phi M H b d split j Y) +end ExternalTensor.Binomial + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/FiniteIntegerIterate.lean b/lean/OAI/Algebra/Finitistic/Iteration/FiniteIntegerIterate.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d30d4c60379b3168f9641dd017a72cedcbf0557 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/FiniteIntegerIterate.lean @@ -0,0 +1,91 @@ +import OAI.Algebra.Finitistic.Iteration.IntegerIterateSupport +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRingsExact +import OAI.Algebra.Finitistic.Bar.SignedBlockModel +import Mathlib.LinearAlgebra.DirectSum.Finite +import Mathlib.RingTheory.TensorProduct.Finite +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct DirectSum +namespace DerivedBar.IterateSupport +universe u +variable (k D X : 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] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +local instance (N : ModuleCat.{u} D) : Module k N := BimoduleTensor.scalarModule k D N +local instance (N : ModuleCat.{u} D) : IsScalarTower k D N := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) +variable [FiniteDimensional k D] [FiniteDimensional k X] +variable (N : ModuleCat.{u} D) [FiniteDimensional k N] + +instance tensor_finite {n r : ℕ} (p : Multibar.Indexed.Shape n r) : + FiniteDimensional k (Multibar.Indexed.tensor k D X N p) := by + induction p with + | nil => exact inferInstanceAs (FiniteDimensional k N) + | base p ih => + let := ih + exact inferInstanceAs (FiniteDimensional k (D ⊗[k] Multibar.Indexed.tensor k D X N p)) + | ideal p ih => + let := ih + exact inferInstanceAs (FiniteDimensional k (X ⊗[k] Multibar.Indexed.tensor k D X N p)) + +instance indexed_finite (r n : ℕ) : FiniteDimensional k + ((ModuleCat.restrictScalars (algebraMap k D)).obj + ((RecursiveTotal.indexedMultibar k D X N r).X n)) := by + let V := ⨁ p : Multibar.Indexed.Shape (r+n) r, + Multibar.Indexed.outerTensor k D X N p + have : Module.Finite k V := inferInstance + have : Module.Finite D V := Module.Finite.of_restrictScalars_finite k D V + have : Module.Finite D ((ModuleCat.restrictScalars (algebraMap k D)).obj + ((RecursiveTotal.indexedMultibar k D X N r).X n)) := + inferInstanceAs (Module.Finite D V) + have : IsScalarTower k D ((ModuleCat.restrictScalars (algebraMap k D)).obj + ((RecursiveTotal.indexedMultibar k D X N r).X n)) := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + exact Module.Finite.trans D ((ModuleCat.restrictScalars (algebraMap k D)).obj + ((RecursiveTotal.indexedMultibar k D X N r).X n)) + +omit [FiniteDimensional k D] in +/-- Homology is a quotient of a subspace of the term in that degree. -/ +theorem homology_finite {ι : Type*} (c : ComplexShape ι) + (Z : HomologicalComplex (ModuleCat.{u} D) c) (i : ι) + [FiniteDimensional k ((ModuleCat.restrictScalars (algebraMap k D)).obj (Z.X i))] : + FiniteDimensional k ((ModuleCat.restrictScalars (algebraMap k D)).obj (Z.homology i)) := by + let F := ModuleCat.restrictScalars (algebraMap k D) + have : FiniteDimensional k (F.obj (Z.sc i).X₂) := + inferInstanceAs (FiniteDimensional k ((ModuleCat.restrictScalars (algebraMap k D)).obj (Z.X i))) + have : FiniteDimensional k (F.obj (Z.sc i).cycles) := + FiniteDimensional.of_injective (F.map (Z.sc i).iCycles).hom + ((ModuleCat.mono_iff_injective _).mp inferInstance) + exact FiniteDimensional.of_surjective (F.map (Z.sc i).homologyπ).hom + ((ModuleCat.epi_iff_surjective _).mp inferInstance) + +/-- Actual cohomology of every derived iterate is finite-dimensional in every degree. -/ +theorem cohomology_finite (r : ℕ) (i : ℤ) : FiniteDimensional k + ((ModuleCat.restrictScalars (algebraMap k D)).obj + ((DerivedCategory.homologyFunctor (ModuleCat D) i).obj (object k D X N r))) := by + let F := ModuleCat.restrictScalars (algebraMap k D) + by_cases hi : i ≤ 0 + · obtain ⟨n,rfl⟩ := Int.exists_eq_neg_ofNat hi + let Z := RecursiveTotal.indexedMultibar k D X N r + let e := (DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).mapIso + (integerDerivedIterateIndexedIso D k X N r) ≪≫ + (DerivedCategory.homologyFunctorFactors (ModuleCat D) (-(n : ℤ))).app + ((integerExtension D).obj Z) ≪≫ integerExtensionHomologyIso D Z n + have : FiniteDimensional k (F.obj (Z.homology n)) := + homology_finite k D (.down ℕ) Z n + exact FiniteDimensional.of_injective (F.map e.hom).hom + ((ModuleCat.mono_iff_injective _).mp inferInstance) + · have hz := Functor.map_isZero F (positive_homology_zero k D X N r i (by omega)) + have := ModuleCat.isZero_iff_subsingleton.mp hz + infer_instance +end DerivedBar.IterateSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/FunctorObjectIteration.lean b/lean/OAI/Algebra/Finitistic/Iteration/FunctorObjectIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b71b890161ba0f2180ed0dd98c1724ff8c9e261 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/FunctorObjectIteration.lean @@ -0,0 +1,33 @@ +import Mathlib.CategoryTheory.Functor.Basic +import Mathlib.CategoryTheory.NatIso +import Mathlib.Logic.Function.Iterate + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u v +variable {C : Type u} [Category.{v} C] {F G : C ⥤ C} + +/-- An actual natural isomorphism identifies every objectwise iterate. -/ +def functorObjectIteration (e : F ≅ G) (r : ℕ) (Y : C) : + (F.obj^[r]) Y ≅ (G.obj^[r]) Y := by + induction r with + | zero => exact Iso.refl _ + | succ r ih => + rw [Function.iterate_succ_apply', Function.iterate_succ_apply'] + exact F.mapIso ih ≪≫ e.app _ + +/-- Transport an object isomorphism through an actual repeated functor. -/ +def mapObjectIteration (F : C ⥤ C) {X Y : C} (e : X ≅ Y) (r : ℕ) : + (F.obj^[r]) X ≅ (F.obj^[r]) Y := by + induction r with + | zero => exact e + | succ r ih => + rw [Function.iterate_succ_apply', Function.iterate_succ_apply'] + exact F.mapIso ih +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateAmplitude.lean b/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..531bb983254bee4d4568a2e19193430a17ac4964 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateAmplitude.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Bar.SplitProjectiveTail +import OAI.Algebra.Finitistic.Iteration.FiniteIntegerIterate + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace DerivedBar.IterateSupport +universe u +variable (k D X : Type u) [Field k] [Ring D] [Algebra k D] + [AddCommGroup X] [Module k X] [Module D X] [Module Dᵐᵒᵖ X] + [IsScalarTower k D X] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +variable (g : ℕ) (hg : ∀ M : ModuleCat.{u} D, HasProjectiveDimensionLE M g) +variable (N : ModuleCat.{u} D) + +abbrev resolvedModel (r : ℕ) := (tensorTotalIterate k D X r).obj + ((ChainComplex.single₀ (ModuleCat D)).obj N) + +include hg in +/-- A bounded input remains cohomologically bounded after actual derived tensor. +The input is resolved by its genuine projective bar total. -/ +theorem tensor_exact_above (Z : ChainComplex (ModuleCat.{u} D) ℕ) (m : ℕ) + (hZ : ∀ i, m < i → Z.ExactAt i) (n : ℕ) (hn : m+g+2 < n) : + ((tensorTotalFunctor k D X).obj Z).ExactAt n := by + apply ProjectiveTail.map_exact_tail (barTotal k D Z) (BimoduleTensor.tensorFunctor k D X) + (m+1) g + · intro i hi + exact (exactAt_iff_of_quasiIsoAt (barTotalAugmentation k D Z) i).mpr (hZ i (by omega)) + · exact barTotal_projective k D Z + · exact hg + · omega + +include hg in +/-- The actual finite iteration has an explicit finite homological support bound. +This bound has a two-degree allowance per step; no optimal upper bound is claimed. -/ +theorem resolvedModel_exact_above (r n : ℕ) (hn : r*(g+2) < n) : + (resolvedModel k D X N r).ExactAt n := by + induction r generalizing n with + | zero => + cases n with + | zero => simp at hn + | succ n => exact ChainComplex.exactAt_succ_single_obj _ _ + | succ r ih => + apply tensor_exact_above k D X g hg (resolvedModel k D X N r) (r*(g+2)) ih n + simpa only [Nat.add_mul, Nat.one_mul, Nat.add_assoc] using hn + +def resolvedModelIso (r : ℕ) : object k D X N r ≅ + DerivedCategory.Q.obj ((integerExtension D).obj (resolvedModel k D X N r)) := + (chainToIntegerDerived D).mapIso + ((derivedTensorIterateIso k D X r).app ((ChainComplex.single₀ (ModuleCat D)).obj N)) ≪≫ + (chainToIntegerDerivedIso D).app (resolvedModel k D X N r) + +include hg in +/-- Actual derived tensor iterates have finite lower cohomological support over +any ring with the supplied genuine global projective-dimension bound. -/ +theorem isGE_bound (r : ℕ) : (object k D X N r).IsGE (-((r*(g+2) : ℕ) : ℤ)) := by + apply (DerivedCategory.isGE_iff _ _).mpr + intro i hi + obtain ⟨n,rfl⟩ := Int.exists_eq_neg_ofNat (show i ≤ 0 by omega) + let e := (DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).mapIso + (resolvedModelIso k D X N r) ≪≫ + (DerivedCategory.homologyFunctorFactors (ModuleCat D) (-(n : ℤ))).app + ((integerExtension D).obj (resolvedModel k D X N r)) ≪≫ + integerExtensionHomologyIso D (resolvedModel k D X N r) n + exact e.isZero_iff.mpr ((resolvedModel_exact_above k D X g hg N r n (by omega)).isZero_homology) + +variable [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] + +include hg in +theorem bounded_amplitude (r : ℕ) : + (object k D X N r).IsGE (-((r*(g+2) : ℕ) : ℤ)) ∧ (object k D X N r).IsLE 0 := + ⟨isGE_bound k D X g hg N r, inferInstance⟩ +end DerivedBar.IterateSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateExtinction.lean b/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateExtinction.lean new file mode 100644 index 0000000000000000000000000000000000000000..91e073bc86327a418ab20df787a8a5cb645d030d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateExtinction.lean @@ -0,0 +1,97 @@ +import OAI.Algebra.Finitistic.Iteration.IntegerIterateAmplitude +import OAI.Algebra.Finitistic.Bar.BarAdditive + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex ZeroObject +namespace DerivedBar.IterateSupport +universe u +variable (k D X : 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] +local instance integerIterateExtinctionHasDerivedCategory : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) + +/-- The integer derived object of an actual nonnegative chain complex vanishes +exactly when the original chain complex is exact in every degree. -/ +theorem integerQ_isZero_iff (Z : ChainComplex (ModuleCat.{u} D) ℕ) : + IsZero ((integerQ D).obj Z) ↔ ∀ n, Z.ExactAt n := by + constructor + · intro h n + apply (exactAt_iff_isZero_homology _ _).mpr + have hz := (DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).map_isZero h + exact ((DerivedCategory.homologyFunctorFactors (ModuleCat D) (-(n : ℤ))).app + ((integerExtension D).obj Z) ≪≫ integerExtensionHomologyIso D Z n).isZero_iff.mp hz + · intro h + have : ((integerExtension D).obj Z).IsStrictlyLE 0 := by + exact inferInstanceAs (CochainComplex.IsStrictlyLE + (Z.extend ComplexShape.embeddingDownNat) 0) + have : ((integerQ D).obj Z).IsLE 0 := by + change (DerivedCategory.Q.obj ((integerExtension D).obj Z)).IsLE 0 + infer_instance + have hz (i : ℤ) : IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) i).obj + ((integerQ D).obj Z)) := by + by_cases hi : i ≤ 0 + · obtain ⟨n,rfl⟩ := Int.exists_eq_neg_ofNat hi + exact ((DerivedCategory.homologyFunctorFactors (ModuleCat D) (-(n : ℤ))).app + ((integerExtension D).obj Z) ≪≫ integerExtensionHomologyIso D Z n).isZero_iff.mpr + ((exactAt_iff_isZero_homology _ _).mp (h n)) + · exact DerivedCategory.isZero_of_isLE _ 0 i (by omega) + have : ((integerQ D).obj Z).IsLE (-1) := + (DerivedCategory.isLE_iff _ _).mpr (fun i _ => hz i) + have : ((integerQ D).obj Z).IsGE 0 := + (DerivedCategory.isGE_iff _ _).mpr (fun i _ => hz i) + apply (IsZero.iff_id_eq_zero _).mpr + exact DerivedCategory.TStructure.t.zero (𝟙 _) (-1) 0 (by omega) + +local instance : (barTotalFunctor k D).PreservesZeroMorphisms where + map_zero Z W := by + apply HomologicalComplex.Hom.ext + funext n + apply HomologicalComplex₂.total.hom_ext (K := barBicomplex k D Z) + intro i q h + erw [ι_barTotalFunctor_map k D (0 : Z ⟶ W) i q n h] + simp [termMap_zero] + erw [zero_comp,comp_zero] + rfl +local instance : (tensorTotalFunctor k D X).PreservesZeroMorphisms := by + dsimp [tensorTotalFunctor] + infer_instance + +omit [SMulCommClass D Dᵐᵒᵖ X] [IsScalarTower k Dᵐᵒᵖ X] +/-- The actual resolve-and-tensor functor sends an acyclic chain input to an acyclic output. -/ +theorem tensor_acyclic (Z : ChainComplex (ModuleCat.{u} D) ℕ) + (h : ∀ n, Z.ExactAt n) : ∀ n, ((tensorTotalFunctor k D X).obj Z).ExactAt n := by + let f : Z ⟶ 0 := 0 + have : QuasiIso f := ⟨fun n => (quasiIsoAt_iff_exactAt f n (h n)).mpr + ((exactAt_iff_isZero_homology _ _).mpr + ((HomologicalComplex.homologyFunctor _ (.down ℕ) n).map_isZero (Limits.isZero_zero _)))⟩ + let G := tensorTotalFunctor k D X + have hz := G.map_isZero (Limits.isZero_zero (ChainComplex (ModuleCat.{u} D) ℕ)) + intro n + apply (exactAt_iff_of_quasiIsoAt (G.map f) n).mpr + exact (exactAt_iff_isZero_homology _ _).mpr + ((HomologicalComplex.homologyFunctor _ (.down ℕ) n).map_isZero hz) + +variable (N : ModuleCat.{u} D) + +/-- Extinction is permanent for the genuine bar-derived iteration. -/ +theorem zero_succ (r : ℕ) (h : IsZero (object k D X N r)) : + IsZero (object k D X N (r+1)) := by + apply (resolvedModelIso k D X N (r+1)).isZero_iff.mpr + apply (integerQ_isZero_iff (D := D) (resolvedModel k D X N (r+1))).mpr + apply tensor_acyclic k D X (resolvedModel k D X N r) + exact (integerQ_isZero_iff (D := D) (resolvedModel k D X N r)).mp + ((resolvedModelIso k D X N r).isZero_iff.mp h) + +/-- A proved zero iterate kills every later iterate, without a native-functor comparison premise. -/ +theorem zero_of_le (t r : ℕ) (htr : t ≤ r) (h : IsZero (object k D X N t)) : + IsZero (object k D X N r) := by + induction r, htr using Nat.le_induction with + | base => exact h + | succ r _ ih => exact zero_succ k D X N r ih +end DerivedBar.IterateSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateSupport.lean b/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..bea43ce068668f1d4c5bc792967283b88c24355d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/IntegerIterateSupport.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Bar.IntegerDerivedMultibar +import Mathlib.Algebra.Homology.DerivedCategory.TStructure +import Mathlib.Algebra.Homology.Embedding.CochainComplex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace DerivedBar.IterateSupport +universe u +variable (k D X : 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] +local instance : HasDerivedCategory.{u+1} (ModuleCat.{u} D) := + HasDerivedCategory.standard (ModuleCat.{u} D) +variable (N : ModuleCat.{u} D) + +/-- The already constructed genuine derived iterate, viewed in integer degrees. -/ +abbrev object (r : ℕ) := (chainToIntegerDerived D).obj + ((derivedTensorIterate k D X r).obj + ((chainQ D).obj ((ChainComplex.single₀ (ModuleCat D)).obj N))) + +/-- Every actual iterate is cohomologically nonpositive. This uses the proved +integer comparison and its actual nonnegative chain representative. -/ +instance isLE_zero (r : ℕ) : (object k D X N r).IsLE 0 := by + let Z := RecursiveTotal.indexedMultibar k D X N r + have : ((integerExtension D).obj Z).IsStrictlyLE 0 := + inferInstanceAs (CochainComplex.IsStrictlyLE (Z.extend ComplexShape.embeddingDownNat) 0) + have : (DerivedCategory.Q.obj ((integerExtension D).obj Z)).IsLE 0 := inferInstance + exact DerivedCategory.TStructure.t.isLE_of_iso + (integerDerivedIterateIndexedIso D k X N r).symm 0 + +theorem positive_homology_zero (r : ℕ) (i : ℤ) (hi : 0 < i) : + IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) i).obj (object k D X N r)) := + DerivedCategory.isZero_of_isLE _ 0 i hi + +/-- Nonzero actual iterates have a nonzero cohomology group in nonpositive degree. -/ +theorem nonzero_homology (r : ℕ) (h : ¬ IsZero (object k D X N r)) : + ∃ n : ℕ, ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj + (object k D X N r)) := by + by_contra hn + push Not at hn + have hz (i : ℤ) : IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) i).obj + (object k D X N r)) := by + by_cases hi : i ≤ 0 + · obtain ⟨n,rfl⟩ := Int.exists_eq_neg_ofNat hi + exact hn n + · exact positive_homology_zero k D X N r i (by omega) + have : (object k D X N r).IsLE (-1) := + (DerivedCategory.isLE_iff _ _).mpr (fun i _ => hz i) + have : (object k D X N r).IsGE 0 := + (DerivedCategory.isGE_iff _ _).mpr (fun i _ => hz i) + apply h + apply (IsZero.iff_id_eq_zero _).mpr + exact DerivedCategory.TStructure.t.zero (𝟙 _) (-1) 0 (by omega) +end DerivedBar.IterateSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Iteration/ObjectwiseSplitting.lean b/lean/OAI/Algebra/Finitistic/Iteration/ObjectwiseSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ac0ba36692af3fd5b58c96d561c4d730027c9e6 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Iteration/ObjectwiseSplitting.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.Finitistic.Iteration.BinomialEvenIteration + +namespace OAI +open CategoryTheory CategoryTheory.Limits +noncomputable section +namespace ExternalTensor.Binomial.Objectwise +universe v u w +variable {C : Type u} [Category.{v} C] [Preadditive C] + [HasFiniteBiproducts C] [HasBinaryBiproducts C] + [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] +variable {S : Type w} + +/-- Exact generic Section 4 statement, assuming only existence of each objectwise split. -/ +theorem section4_objectwise (Phi : C ⥤ C) [Phi.Additive] [Phi.CommShift ℤ] + (M : S → C) (H : S → S) + (split : ∀ Y, Nonempty (Phi.obj (M Y) ≅ M (H Y) ⊞ (M (H Y))⟦(3 : ℤ)⟧)) + (j : ℕ) (Y : S) : + Nonempty ((Phi.obj^[j]) (M Y) ≅ + ⨁ fun q : Fin (j+1) => ⨁ fun _ : Fin (Nat.choose j q.val) => + (M ((H^[j]) Y))⟦(3 : ℤ)*(q.val : ℤ)⟧) := + ⟨section4Iteration Phi M H (fun Y => Classical.choice (split Y)) j Y⟩ + +/-- Exact generic Section 6 formula, assuming only existence of each two-step split. -/ +theorem section6_objectwise (F : C ⥤ C) [F.Additive] [F.CommShift ℤ] + (M : S → C) (H : S → S) (b : ℤ) + (split : ∀ Y, Nonempty (F.obj (F.obj (M Y)) ≅ + (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+3⟧)) + (j : ℕ) (Y : S) : + Nonempty ((F.obj^[2*j]) (M Y) ≅ + ⨁ fun q : Fin (j+1) => ⨁ fun _ : Fin (Nat.choose j q.val) => + (M ((H^[j]) Y))⟦(j : ℤ)*b + 3*(q.val : ℤ)⟧) := + ⟨evenIteration F M H b (fun Y => Classical.choice (split Y)) j Y⟩ + +/-- Exact generic zero detection for the two-step formula, with all hypotheses exposed. -/ +theorem section6_zero_detection (F : C ⥤ C) [F.Additive] [F.CommShift ℤ] + (M : S → C) (H : S → S) (b : ℤ) + (split : ∀ Y, Nonempty (F.obj (F.obj (M Y)) ≅ + (M (H Y))⟦b⟧ ⊞ (M (H Y))⟦b+3⟧)) + (j : ℕ) (Y : S) : + IsZero ((F.obj^[2*j]) (M Y)) ↔ IsZero (M ((H^[j]) Y)) := + evenIteration_isZero_iff F M H b (fun Y => Classical.choice (split Y)) j Y +end ExternalTensor.Binomial.Objectwise + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/AdditiveSplitImage.lean b/lean/OAI/Algebra/Finitistic/Localization/AdditiveSplitImage.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ad27af224e1d22e40f2cabfaff25c202ecde2e8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/AdditiveSplitImage.lean @@ -0,0 +1,50 @@ +import Mathlib.Algebra.Category.ModuleCat.Basic +import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.AdditiveSplitImage +universe u v +variable {C : Type*} [Category C] +variable {R : Type u} [Ring R] +variable (F : C ⥤ ModuleCat.{v} R) +variable {V M : C} (i : V ⟶ M) (p : M ⟶ V) (hip : i ≫ p = 𝟙 V) + +def fixed : Submodule R (F.obj M) := ((F.map (p ≫ i)).hom - LinearMap.id).ker + +@[simp] theorem mem_fixed (x : F.obj M) : x ∈ fixed F i p ↔ (F.map (p ≫ i)).hom x = x := by + simp [fixed,sub_eq_zero] + +def forward : F.obj V →ₗ[R] fixed F i p := + (F.map i).hom.codRestrict _ (by + intro x + rw [mem_fixed] + have he : F.map i ≫ F.map (p ≫ i) = F.map i := by + rw [← F.map_comp,← Category.assoc,hip,Category.id_comp] + exact congrArg (fun a : F.obj V ⟶ F.obj M => a.hom x) he) + +def inverse : fixed F i p →ₗ[R] F.obj V := + (F.map p).hom.comp (fixed F i p).subtype + +/-- Any additive module-valued functor preserves the actual image of a split idempotent. -/ +def equiv : F.obj V ≃ₗ[R] fixed F i p where + __ := forward F i p hip + invFun := inverse F i p + left_inv x := by + have he : F.map i ≫ F.map p = 𝟙 (F.obj V) := by rw [← F.map_comp,hip,F.map_id] + exact congrArg (fun a : F.obj V ⟶ F.obj V => a.hom x) he + right_inv x := by + apply Subtype.ext + change (F.map i).hom ((F.map p).hom x.val) = x.val + rw [show (F.map i).hom ((F.map p).hom x.val) = (F.map (p ≫ i)).hom x.val from + congrArg (fun a : F.obj M ⟶ F.obj M => a.hom x.val) (F.map_comp p i).symm] + exact (mem_fixed F i p x.val).1 x.property + +@[simp] theorem equiv_apply_val (x : F.obj V) : (equiv F i p hip x).val = (F.map i).hom x := rfl +@[simp] theorem equiv_symm_apply (x : fixed F i p) : (equiv F i p hip).symm x = (F.map p).hom x.val := rfl +end LittleFinitistic.AdditiveSplitImage + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/AmbientQuotientEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/AmbientQuotientEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..78e834012071e03cf861a244b92d69c6f4160f49 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/AmbientQuotientEvaluation.lean @@ -0,0 +1,89 @@ +import OAI.Algebra.Finitistic.Selected.SelectedVertexTensorEvaluation +import OAI.Algebra.Finitistic.Localization.HomotopyEvaluation +import OAI.Algebra.Finitistic.Localization.ThickEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +namespace LittleFinitistic +open BalancedTensor ThickEvaluation +universe u v +namespace QuadraticEncoding +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The ambient homotopy category; no bounded-projective identification is asserted here. -/ +abbrev Ambient := HomotopyCategory (ModuleCat.{u} (B P)ᵐᵒᵖ) (ComplexShape.up ℤ) + +def degreeZero := HomologicalComplex.single (ModuleCat.{u} (B P)ᵐᵒᵖ) (ComplexShape.up ℤ) (0 : ℤ) +def coneS : Ambient P := (HomotopyCategory.quotient _ _).obj + (CochainComplex.mappingCone ((degreeZero P).map (arrowModule01 P 0))) +def coneS' : Ambient P := (HomotopyCategory.quotient _ _).obj + (CochainComplex.mappingCone ((degreeZero P).map (arrowModule12 P 0))) + +def coneGenerators : ObjectProperty (Ambient P) := fun T => T = coneS P ∨ T = coneS' P + +def ambientDenominators : MorphismProperty (Ambient P) := + ObjectProperty.trW (Thick (coneGenerators P)) + +/-- A quotient fixed before Y is chosen, for the ambient homotopy category. -/ +abbrev AmbientQuotient := (ambientDenominators P).Localization + +variable {P} {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +lemma eval_single_isIso {M M' : ModuleCat.{u} (B P)ᵐᵒᵖ} (f : M ⟶ M') + [IsIso ((tensorFunctor k (B P) X.Evaluation).map f)] : + IsIso ((homotopyEvaluation k (B P) X.Evaluation).map + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map f))) := by + let F := tensorFunctor k (B P) X.Evaluation + have h : IsIso ((F.mapHomologicalComplex (ComplexShape.up ℤ)).map ((degreeZero P).map f)) := by + exact (NatIso.isIso_map_iff + (HomologicalComplex.singleMapHomologicalComplex F (ComplexShape.up ℤ) (0 : ℤ)) f).mpr + (by + change IsIso ((HomologicalComplex.single _ (ComplexShape.up ℤ) (0 : ℤ)).map + ((tensorFunctor k (B P) X.Evaluation).map f)) + infer_instance) + change IsIso ((HomotopyCategory.quotient _ _).map + ((F.mapHomologicalComplex (ComplexShape.up ℤ)).map ((degreeZero P).map f))) + infer_instance + +lemma evaluation_coneS_zero : IsZero ((homotopyEvaluation k (B P) X.Evaluation).obj (coneS P)) := by + have := evaluation_s_isIso X + have := eval_single_isIso X (arrowModule01 P 0) + exact Triangle.isZero₃_of_isIso₁ _ + ((homotopyEvaluation k (B P) X.Evaluation).map_distinguished _ + (HomotopyCategory.mappingCone_triangleh_distinguished ((degreeZero P).map (arrowModule01 P 0)))) + (inferInstanceAs (IsIso ((homotopyEvaluation k (B P) X.Evaluation).map + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule01 P 0)))))) + +lemma evaluation_coneS'_zero : IsZero ((homotopyEvaluation k (B P) X.Evaluation).obj (coneS' P)) := by + have := evaluation_s'_isIso X + have := eval_single_isIso X (arrowModule12 P 0) + exact Triangle.isZero₃_of_isIso₁ _ + ((homotopyEvaluation k (B P) X.Evaluation).map_distinguished _ + (HomotopyCategory.mappingCone_triangleh_distinguished ((degreeZero P).map (arrowModule12 P 0)))) + (inferInstanceAs (IsIso ((homotopyEvaluation k (B P) X.Evaluation).map + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule12 P 0)))))) + +lemma kills_coneGenerators : ∀ T, coneGenerators P T → + IsZero ((homotopyEvaluation k (B P) X.Evaluation).obj T) := by + rintro T (rfl | rfl) + · exact evaluation_coneS_zero X + · exact evaluation_coneS'_zero X + +/-- Actual tensor evaluation on the ambient quotient, with the generator hypotheses proved. -/ +def ambientQuotientEvaluation : AmbientQuotient P ⥤ + HomotopyCategory (ModuleCat.{max u v} k) (ComplexShape.up ℤ) := + quotientEvaluation (coneGenerators P) (homotopyEvaluation k (B P) X.Evaluation) + (kills_coneGenerators X) + +def ambientQuotientEvaluationFactors : + (ambientDenominators P).Q ⋙ ambientQuotientEvaluation X ≅ + homotopyEvaluation k (B P) X.Evaluation := + quotientEvaluationFactors (coneGenerators P) (homotopyEvaluation k (B P) X.Evaluation) + (kills_coneGenerators X) +end QuadraticEncoding +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/BoundedDerivedEmbedding.lean b/lean/OAI/Algebra/Finitistic/Localization/BoundedDerivedEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..8602a0e688d754b6d28bc776f304a7561666952f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/BoundedDerivedEmbedding.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Localization.FiniteProjectiveHomotopy +import Mathlib.Algebra.Homology.DerivedCategory.KProjective +import Mathlib.CategoryTheory.EssentialImage + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.FiniteProjectiveHomotopy +universe u v +variable (R : Type u) [Ring R] + +instance underlyingKProjective (T : K.{u,v} R) : CochainComplex.IsKProjective T.obj.as := by + obtain ⟨⟨a,b,hb⟩,hp⟩ := T.property + have : ∀ n, Projective (T.obj.as.X n) := fun n => (hp n).2 + have : CochainComplex.IsStrictlyLE T.obj.as b := by + rw [CochainComplex.isStrictlyLE_iff] + intro i hi + exact hb i (Or.inr hi) + exact CochainComplex.isKProjective_of_projective T.obj.as b + +/-- The canonical derived-category functor on the actual bounded projective source. -/ +def derivedEmbedding : K.{u,v} R ⥤ DerivedCategory (ModuleCat.{v} R) := + inclusion R ⋙ DerivedCategory.Qh + +instance derivedEmbeddingFaithful : (derivedEmbedding.{u,v} R).Faithful where + map_injective {M N} {f g} h := by + apply (inclusion R).map_injective + exact (CochainComplex.IsKProjective.Qh_map_bijective M.obj.as N.obj).injective h + +instance derivedEmbeddingFull : (derivedEmbedding.{u,v} R).Full where + map_surjective {M N} f := by + obtain ⟨g,hg⟩ := (CochainComplex.IsKProjective.Qh_map_bijective M.obj.as N.obj).surjective f + refine ⟨(inclusion R).preimage g,?_⟩ + change DerivedCategory.Qh.map ((inclusion R).map ((inclusion R).preimage g)) = f + erw [Functor.map_preimage] + exact hg + +instance derivedEmbeddingShift : (derivedEmbedding.{u,v} R).CommShift ℤ := + inferInstanceAs ((inclusion R ⋙ DerivedCategory.Qh).CommShift ℤ) +instance derivedEmbeddingTriangulated : (derivedEmbedding.{u,v} R).IsTriangulated := + inferInstanceAs (inclusion R ⋙ DerivedCategory.Qh).IsTriangulated + +/-- Bounded complexes of f.g. projectives form a full subcategory of the actual derived category. -/ +def boundedDerivedEquivalence : K.{u,v} R ≌ (derivedEmbedding.{u,v} R).EssImageSubcategory := + (derivedEmbedding R).toEssImage.asEquivalence +end LittleFinitistic.FiniteProjectiveHomotopy + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/BoundedHomotopy.lean b/lean/OAI/Algebra/Finitistic/Localization/BoundedHomotopy.lean new file mode 100644 index 0000000000000000000000000000000000000000..78fa4b6324b4e91ac47a44c52879f85bafbc8311 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/BoundedHomotopy.lean @@ -0,0 +1,94 @@ +import Mathlib.Algebra.Homology.HomotopyCategory.Plus +import Mathlib.Algebra.Homology.HomotopyCategory.Triangulated + +namespace OAI +noncomputable section +open CategoryTheory Limits ZeroObject Pretriangulated +namespace LittleFinitistic.BoundedHomotopy + +variable (C : Type*) [Category* C] [Preadditive C] + +/-- Strict boundedness of the underlying complex, at both ends. -/ +def boundedComplex : ObjectProperty (CochainComplex C ℤ) := + fun X => ∃ a b : ℤ, X.IsStrictlyGE a ∧ X.IsStrictlyLE b + +/-- The actual category of bounded cochain complexes, with chain maps. -/ +abbrev Complex := (boundedComplex C).FullSubcategory + +/-- Bounded representatives, with homotopy classes of chain maps. -/ +def bounded : ObjectProperty (HomotopyCategory C (.up ℤ)) := + (boundedComplex C).strictMap (HomotopyCategory.quotient _ _) + +@[simp] theorem bounded_quotient_obj_iff (X : CochainComplex C ℤ) : + bounded C ((HomotopyCategory.quotient _ _).obj X) ↔ boundedComplex C X := by + refine ⟨?_, fun h => ⟨_, h⟩⟩ + simp only [bounded, ObjectProperty.strictMap_iff] + rintro ⟨Y, h, he⟩ + obtain rfl : Y = X := congr_arg CategoryTheory.Quotient.as he + exact h + +instance [HasZeroObject C] : (bounded C).ContainsZero where + exists_zero := ⟨(HomotopyCategory.quotient _ _).obj 0, + Functor.map_isZero _ (isZero_zero _), by + rw [bounded_quotient_obj_iff] + exact ⟨0, 0, inferInstance, inferInstance⟩⟩ + +instance : (bounded C).IsStableUnderShift ℤ where + isStableUnderShiftBy n := + { le_shift := by + intro X hX + obtain ⟨X : CochainComplex _ _, rfl⟩ := X.quotient_obj_surjective + rw [bounded_quotient_obj_iff] at hX + obtain ⟨a, b, ha, hb⟩ := hX + rw [ObjectProperty.prop_shift_iff, HomotopyCategory.shift_quotient_obj, + bounded_quotient_obj_iff] + exact ⟨a-n, b-n, X.isStrictlyGE_shift a n (a-n) (by omega), + X.isStrictlyLE_shift b n (b-n) (by omega)⟩ } + +variable {C} +theorem bounded_mappingCone [HasBinaryBiproducts C] + {X Y : CochainComplex C ℤ} (f : X ⟶ Y) + (hX : boundedComplex C X) (hY : boundedComplex C Y) : + boundedComplex C (CochainComplex.mappingCone f) := by + obtain ⟨a,b,ha,hb⟩ := hX + obtain ⟨c,d,hc,hd⟩ := hY + refine ⟨min (a-1) c, max b d, CochainComplex.isStrictlyGE_mappingCone f a c _ + (by omega) (by omega), ?_⟩ + rw [CochainComplex.isStrictlyLE_iff] + intro i hi + rw [CochainComplex.mappingCone.isZero_X_iff] + exact ⟨X.isZero_of_isStrictlyLE b _ (by omega), + Y.isZero_of_isStrictlyLE d _ (by omega)⟩ + +variable (C) +instance [HasZeroObject C] [HasBinaryBiproducts C] : + (bounded C).IsTriangulatedClosed₃ where + ext₃' T hT h₁ h₂ := by + have h₁' : boundedComplex C T.obj₁.as := (bounded_quotient_obj_iff _ _).mp h₁ + have h₂' : boundedComplex C T.obj₂.as := (bounded_quotient_obj_iff _ _).mp h₂ + obtain ⟨f : T.obj₁.as ⟶ T.obj₂.as, hf⟩ := + (HomotopyCategory.quotient _ _).map_surjective T.mor₁ + refine ⟨_, ?_, ⟨Triangle.π₃.mapIso (isoTriangleOfIso₁₂ T _ hT + (HomotopyCategory.mappingCone_triangleh_distinguished f) + (Iso.refl _) (Iso.refl _) ?_)⟩⟩ + · exact (bounded_quotient_obj_iff _ _).mpr (bounded_mappingCone f h₁' h₂') + · exact (Category.comp_id _).trans (hf.symm.trans (Category.id_comp _).symm) + +instance [HasZeroObject C] [HasBinaryBiproducts C] : (bounded C).IsTriangulated where + toIsTriangulatedClosed₂ := .of_isTriangulatedClosed₃ + +/-- The homotopy category Kᵇ(C); boundedness is part of each object. -/ +abbrev K := (bounded C).FullSubcategory + +/-- Pass from bounded chain maps to their homotopy classes. -/ +def quotient : Complex C ⥤ K C := + ObjectProperty.lift _ ((boundedComplex C).ι ⋙ HomotopyCategory.quotient _ _) + (fun X => (bounded_quotient_obj_iff _ _).mpr X.property) + +instance [HasZeroObject C] [HasBinaryBiproducts C] : IsTriangulated (K C) := inferInstance + +end LittleFinitistic.BoundedHomotopy + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/BoundedQuotientEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/BoundedQuotientEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6598ccf752c7ade02fc49ec2bb68dc819871185b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/BoundedQuotientEvaluation.lean @@ -0,0 +1,105 @@ +import OAI.Algebra.Finitistic.Localization.FiniteProjectiveHomotopy +import OAI.Algebra.Finitistic.Localization.AmbientQuotientEvaluation +import OAI.Algebra.Finitistic.Selected.SelectedFiniteTensorEvaluation +import Mathlib.Algebra.Homology.HomotopyCategory.Triangulated + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic +open BalancedTensor ThickEvaluation FiniteProjectiveHomotopy IdempotentTensor +universe u v + +namespace FiniteProjectiveHomotopy +variable {R : Type u} [Ring R] + +lemma single_property (M : ModuleCat.{v} R) [Module.Finite R M] [Projective M] (n : ℤ) : + ComplexProperty R ((HomologicalComplex.single _ (.up ℤ) n).obj M) := by + constructor + · exact ⟨n,n,fun i hi => HomologicalComplex.isZero_single_obj_X (.up ℤ) n M i (by omega)⟩ + · intro i + by_cases h : i=n + · subst i + let e := HomologicalComplex.singleObjXSelf (.up ℤ) n M + exact ⟨finite_of_iso R e.symm,Projective.of_iso e.symm inferInstance⟩ + · exact finite_projective_of_isZero R _ + (HomologicalComplex.isZero_single_obj_X (.up ℤ) n M i h) +end FiniteProjectiveHomotopy + +namespace QuadraticEncoding +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +instance vertexModuleFinite (i : Fin 3) : Module.Finite (B P)ᵐᵒᵖ (vertexModule P i) := by + let e := Representation.vertexId (P := P) i + have he : e*e=e := (ThreeVertexAlgebra.directedSystem (composition P)).idem i + apply Module.Finite.of_surjective (splitProjection he) + intro m + exact ⟨MulOpposite.op m.val,Subtype.ext m.property⟩ + +instance vertexModuleProjective (i : Fin 3) : Projective (vertexModule P i) := by + have : Module.Projective (B P)ᵐᵒᵖ (vertexModule P i) := + rightIdeal_projective ((ThreeVertexAlgebra.directedSystem (composition P)).idem i) + exact ModuleCat.projective_of_categoryTheory_projective (vertexModule P i) + +/-- The exact bounded-projective source category used in Section 3. -/ +abbrev BoundedK := K.{u,u} (B P)ᵐᵒᵖ + +def boundedConeS : BoundedK P := ⟨coneS P, + mappingCone_property _ _ (single_property (vertexModule P 0) 0) (single_property (vertexModule P 1) 0)⟩ +def boundedConeS' : BoundedK P := ⟨coneS' P, + mappingCone_property _ _ (single_property (vertexModule P 1) 0) (single_property (vertexModule P 2) 0)⟩ + +def boundedConeGenerators : ObjectProperty (BoundedK P) := + fun T => T = boundedConeS P ∨ T = boundedConeS' P + +abbrev boundedDenominators : MorphismProperty (BoundedK P) := + ObjectProperty.trW (Thick (boundedConeGenerators P)) + +/-- The actual localization of K^b(proj-B) by the thick subcategory generated by the two cones. -/ +abbrev BoundedQ := (boundedDenominators P).Localization + +variable {P} {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +def boundedEvaluation : BoundedK P ⥤ HomotopyCategory (ModuleCat.{max u v} k) (.up ℤ) := + inclusion (B P)ᵐᵒᵖ ⋙ homotopyEvaluation k (B P) X.Evaluation + +instance boundedEvaluationAdditive : (boundedEvaluation X).Additive := + inferInstanceAs (inclusion (B P)ᵐᵒᵖ ⋙ homotopyEvaluation k (B P) X.Evaluation).Additive +instance boundedEvaluationShift : (boundedEvaluation X).CommShift ℤ := + inferInstanceAs ((inclusion (B P)ᵐᵒᵖ ⋙ homotopyEvaluation k (B P) X.Evaluation).CommShift ℤ) +instance boundedEvaluationTriangulated : (boundedEvaluation X).IsTriangulated := + inferInstanceAs (inclusion (B P)ᵐᵒᵖ ⋙ homotopyEvaluation k (B P) X.Evaluation).IsTriangulated + +lemma boundedEvaluation_kills_generators : ∀ T, boundedConeGenerators P T → + IsZero ((boundedEvaluation X).obj T) := by + rintro T (rfl | rfl) + · exact evaluation_coneS_zero X + · exact evaluation_coneS'_zero X + +/-- Tensor evaluation on the manuscript's fixed quotient; no generator-vanishing assumption remains. -/ +def boundedQuotientEvaluation : BoundedQ P ⥤ HomotopyCategory (ModuleCat.{max u v} k) (.up ℤ) := + quotientEvaluation (boundedConeGenerators P) (boundedEvaluation X) + (boundedEvaluation_kills_generators X) + +def boundedQuotientEvaluationFactors : + (boundedDenominators P).Q ⋙ boundedQuotientEvaluation X ≅ boundedEvaluation X := + quotientEvaluationFactors (boundedConeGenerators P) (boundedEvaluation X) + (boundedEvaluation_kills_generators X) + +/-- Evaluation of every bounded-projective representative has bounded finite-dimensional terms. -/ +theorem boundedEvaluation_finite [FiniteDimensional k Y] (T : BoundedK P) : + (∃ a b : ℤ, ∀ i, i < a ∨ b < i → IsZero (((boundedEvaluation X).obj T).as.X i)) ∧ + ∀ i, FiniteDimensional k (((boundedEvaluation X).obj T).as.X i) := by + obtain ⟨⟨a,b,hb⟩,hp⟩ := T.property + constructor + · exact ⟨a,b,bounded_support X.Evaluation T.obj.as a b hb⟩ + · intro i + have := (hp i).1 + have : FiniteDimensional k (B P) := finiteDimensional P + exact tensorFunctor_finite X.Evaluation (T.obj.as.X i) +end QuadraticEncoding +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/BoundedQuotientGenerators.lean b/lean/OAI/Algebra/Finitistic/Localization/BoundedQuotientGenerators.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8150f661f0287a48ef0416c705df8ef252b3b31 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/BoundedQuotientGenerators.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Localization.LocalizedEvaluationStructure + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +namespace LittleFinitistic.QuadraticEncoding +open FiniteProjectiveHomotopy ThickEvaluation +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The actual degree-zero right vertex projective in K. -/ +def vertexK (i : Fin 3) : BoundedK P := + ⟨(HomotopyCategory.quotient _ _).obj ((degreeZero P).obj (vertexModule P i)), + single_property (vertexModule P i) 0⟩ + +def arrowK01 (h : Fin (d+1)) : vertexK P 0 ⟶ vertexK P 1 := + (inclusion (B P)ᵐᵒᵖ).preimage + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule01 P h))) +def arrowK12 (h : Fin (d+1)) : vertexK P 1 ⟶ vertexK P 2 := + (inclusion (B P)ᵐᵒᵖ).preimage + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule12 P h))) + +theorem s_denominator : boundedDenominators P (arrowK01 P 0) := by + obtain ⟨Z,g,h,hT⟩ := distinguished_cocone_triangle (arrowK01 P 0) + let I := inclusion (B P)ᵐᵒᵖ + have e : I.obj Z ≅ I.obj (boundedConeS P) := + Triangle.π₃.mapIso (isoTriangleOfIso₁₂ _ _ (I.map_distinguished _ hT) + (HomotopyCategory.mappingCone_triangleh_distinguished + ((degreeZero P).map (arrowModule01 P 0))) (Iso.refl _) (Iso.refl _) (by + change I.map (arrowK01 P 0) ≫ 𝟙 _ = 𝟙 _ ≫ + (HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule01 P 0)) + unfold arrowK01 + erw [Functor.map_preimage] + simp + exact Category.comp_id _)) + have eK : Z ≅ boundedConeS P := I.preimageIso e + exact ⟨Z,g,h,hT,Thick.iso eK.symm (Thick.generator (Or.inl rfl))⟩ + +instance quotient_s_isIso : IsIso ((boundedDenominators P).Q.map (arrowK01 P 0)) := + Localization.inverts (boundedDenominators P).Q (boundedDenominators P) _ (s_denominator P) + +theorem s'_denominator : boundedDenominators P (arrowK12 P 0) := by + obtain ⟨Z,g,h,hT⟩ := distinguished_cocone_triangle (arrowK12 P 0) + let I := inclusion (B P)ᵐᵒᵖ + have e : I.obj Z ≅ I.obj (boundedConeS' P) := + Triangle.π₃.mapIso (isoTriangleOfIso₁₂ _ _ (I.map_distinguished _ hT) + (HomotopyCategory.mappingCone_triangleh_distinguished + ((degreeZero P).map (arrowModule12 P 0))) (Iso.refl _) (Iso.refl _) (by + change I.map (arrowK12 P 0) ≫ 𝟙 _ = 𝟙 _ ≫ + (HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule12 P 0)) + unfold arrowK12 + erw [Functor.map_preimage] + simp + exact Category.comp_id _)) + have eK : Z ≅ boundedConeS' P := I.preimageIso e + exact ⟨Z,g,h,hT,Thick.iso eK.symm (Thick.generator (Or.inr rfl))⟩ + +instance quotient_s'_isIso : IsIso ((boundedDenominators P).Q.map (arrowK12 P 0)) := + Localization.inverts (boundedDenominators P).Q (boundedDenominators P) _ (s'_denominator P) + +/-- The three actual images in the fixed quotient. -/ +def vertexQ (i : Fin 3) : BoundedQ P := (boundedDenominators P).Q.obj (vertexK P i) +def arrowQ01 (h : Fin (d+1)) : vertexQ P 0 ⟶ vertexQ P 1 := + (boundedDenominators P).Q.map (arrowK01 P h) +def arrowQ12 (h : Fin (d+1)) : vertexQ P 1 ⟶ vertexQ P 2 := + (boundedDenominators P).Q.map (arrowK12 P h) + +instance arrowQ01_zero_isIso : IsIso (arrowQ01 P 0) := quotient_s_isIso P +instance arrowQ12_zero_isIso : IsIso (arrowQ12 P 0) := quotient_s'_isIso P + +/-- The normalized generator s^{-1} a_h on L=E_0 in Q. -/ +def normalizedGenerator (h : Fin d) : End (vertexQ P 0) := + arrowQ01 P h.succ ≫ inv (arrowQ01 P 0) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/BoundedRepresentatives.lean b/lean/OAI/Algebra/Finitistic/Localization/BoundedRepresentatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c516f025c91a224ab38b0b213d29890495154ba --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/BoundedRepresentatives.lean @@ -0,0 +1,41 @@ +import OAI.Algebra.Finitistic.Localization.BoundedHomotopy + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BoundedHomotopy +variable (C : Type*) [Category* C] [Preadditive C] + +/-- An actual bounded representative of each homotopy-category object. -/ +def representative (X : K C) : Complex C := + ⟨X.obj.as, (bounded_quotient_obj_iff _ _).mp X.property⟩ + +@[simp] theorem quotient_representative (X : K C) : + (quotient C).obj (representative C X) = X := by + cases X + rfl + +variable {C} +/-- A bounded chain-map representative of a homotopy-category morphism. -/ +def representativeMap {X Y : K C} (f : X ⟶ Y) : + representative C X ⟶ representative C Y := + ObjectProperty.homMk ((HomotopyCategory.quotient C (.up ℤ)).preimage f.hom) + +@[simp] theorem quotient_representativeMap {X Y : K C} (f : X ⟶ Y) : + (HomotopyCategory.quotient C (.up ℤ)).map (representativeMap f).hom = f.hom := + (HomotopyCategory.quotient C (.up ℤ)).map_preimage _ + +/-- Zero in K means a genuine right-linear null-homotopy of the chain representative. -/ +def nullHomotopy {X Y : Complex C} (f : X ⟶ Y) (hf : (quotient C).map f = 0) : + Homotopy f.hom 0 := + HomotopyCategory.homotopyOfEq _ _ (by + have h := congrArg (fun g : (quotient C).obj X ⟶ (quotient C).obj Y => + (bounded C).ι.map g) hf + rw [Functor.map_zero] at h + exact h) + +end LittleFinitistic.BoundedHomotopy + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ChainRepresentatives.lean b/lean/OAI/Algebra/Finitistic/Localization/ChainRepresentatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbcb0cce27eb34b55a098e1f6e7b45e5fb160255 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ChainRepresentatives.lean @@ -0,0 +1,50 @@ +import Mathlib.Algebra.Homology.HomotopyCategory.Pretriangulated +import Mathlib.Algebra.Homology.Linear + +namespace OAI + +namespace LittleFinitistic.ChainRepresentatives +open CategoryTheory CategoryTheory.Category CategoryTheory.Limits +open HomologicalComplex + +variable {k : Type*} [CommRing k] +variable {V : Type*} [Category V] [Preadditive V] [Linear k V] +variable {ι : Type*} {s : ComplexShape ι} + +/-- Choosing chain representatives of a finite quadratic diagram supplies actual, +specified null-homotopies for all its relations. -/ +theorem quadratic_chain_representatives (na nb nr : ℕ) + (D₀ D₁ D₂ : HomologicalComplex V s) + (a : Fin na → ((HomotopyCategory.quotient V s).obj D₀ ⟶ + (HomotopyCategory.quotient V s).obj D₁)) + (b : Fin nb → ((HomotopyCategory.quotient V s).obj D₁ ⟶ + (HomotopyCategory.quotient V s).obj D₂)) + (c : Fin nr → Fin na → Fin nb → k) + (hc : ∀ t, ∑ i, ∑ j, c t i j • (a i ≫ b j) = 0) : + ∃ (f : Fin na → (D₀ ⟶ D₁)) (g : Fin nb → (D₁ ⟶ D₂)), + (∀ i, (HomotopyCategory.quotient V s).map (f i) = a i) ∧ + (∀ j, (HomotopyCategory.quotient V s).map (g j) = b j) ∧ + Nonempty (∀ t, Homotopy (∑ i, ∑ j, c t i j • (f i ≫ g j)) 0) := by + classical + let q := HomotopyCategory.quotient V s + let f := fun i => q.preimage (a i) + let g := fun j => q.preimage (b j) + have hf (i) : q.map (f i) = a i := q.map_preimage _ + have hg (j) : q.map (g j) = b j := q.map_preimage _ + refine ⟨f,g,hf,hg,⟨fun t => ?_⟩⟩ + apply HomotopyCategory.homotopyOfEq + change q.map (∑ i, ∑ j, c t i j • (f i ≫ g j)) = q.map 0 + simp only [Functor.map_sum,Functor.map_smul,Functor.map_comp,hf,hg,Functor.map_zero,hc] + +/-- In cochain conventions the chosen homotopy has degree minus one, with the +exact differential equation used in the tensor construction. -/ +theorem cochain_null_homotopy_equation {D E : CochainComplex V ℤ} + (f : D ⟶ E) (h : Homotopy f 0) (i : ℤ) : + f.f i = D.d i (i+1) ≫ h.hom (i+1) i + h.hom i (i-1) ≫ E.d (i-1) i := by + have hi := h.comm i + rw [dNext_eq h.hom (show (ComplexShape.up ℤ).Rel i (i+1) by simp), + prevD_eq h.hom (show (ComplexShape.up ℤ).Rel (i-1) i by simp)] at hi + simpa only [zero_f,add_zero] using hi +end LittleFinitistic.ChainRepresentatives + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/CompletedCornerEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/CompletedCornerEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..95efbf2979e5aa0c8616f552a19cd1463318d41c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/CompletedCornerEvaluation.lean @@ -0,0 +1,129 @@ +import OAI.Algebra.Finitistic.Localization.CompletedImageEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +universe u v w z +section General +variable {C : Type u} [Category.{v} C] [Preadditive C] +variable {D : Type w} [Category.{z} D] [Preadditive D] [IsIdempotentComplete D] +variable (F : C ⥤ D) [F.Additive] (U : Karoubi C) (I : D) +variable (π : F.obj U.X ⟶ I) (ι : I ⟶ F.obj U.X) +variable (hπι : π ≫ ι = F.map U.p) (hιπ : ι ≫ π = 𝟙 I) + +omit [Preadditive C] [Preadditive D] [F.Additive] in +theorem completedExtensionImageSquare (a : U ⟶ U) (b : I ⟶ I) + (h : F.map a.f ≫ π = π ≫ b) : + ((functorExtension C D).obj F).map a ≫ + (completedExtensionImageIso F U I π ι hπι hιπ).hom = + (completedExtensionImageIso F U I π ι hπι hιπ).hom ≫ b := by + let e := splitKaroubiIso (F.map U.p) (by rw [← F.map_comp, U.idem]) π ι hπι hιπ + have he : ((functorExtension₂ C D).obj F).map a ≫ e.hom = + e.hom ≫ (toKaroubi D).map b := by + apply Karoubi.Hom.ext + exact h + change (toKaroubiEquivalence D).inverse.map (((functorExtension₂ C D).obj F).map a) ≫ + ((toKaroubiEquivalence D).inverse.map e.hom ≫ (toKaroubiEquivalence D).unitIso.inv.app I) = + ((toKaroubiEquivalence D).inverse.map e.hom ≫ (toKaroubiEquivalence D).unitIso.inv.app I) ≫ b + erw [← Category.assoc, ← Functor.map_comp, he, Functor.map_comp, Category.assoc] + erw [(toKaroubiEquivalence D).unitIso.inv.naturality b] + exact (Category.assoc _ _ _).symm +end General + +section Image +variable {k : Type u} [Field k] {V : Type v} [AddCommGroup V] [Module k V] +variable (p a : Module.End k V) (hp : p*p=p) + +def imageCornerEnd : ModuleCat.of k (LinearMap.range p) ⟶ ModuleCat.of k (LinearMap.range p) := + imageInclusion p ≫ ModuleCat.ofHom a ≫ imageProjection p + +include hp in +lemma image_corner_square : + ModuleCat.ofHom (p*a*p) ≫ imageProjection p = imageProjection p ≫ imageCornerEnd p a := by + change ((ModuleCat.ofHom p ≫ ModuleCat.ofHom a) ≫ ModuleCat.ofHom p) ≫ imageProjection p = _ + rw [← image_projection_inclusion p] + simp only [imageCornerEnd, Category.assoc, image_inclusion_projection p hp, Category.comp_id] + +include hp in +/-- When a commutes with p, the corner operator is the restriction of a to the image. -/ +lemma imageCornerEnd_apply (ha : p*a=a*p) (x : LinearMap.range p) : + ((imageCornerEnd p a) x).val = a x.val := by + change p (a x.val) = a x.val + have h := LinearMap.congr_fun ha x.val + change p (a x.val) = a (p x.val) at h + rw [h] + obtain ⟨y,hy⟩ := x.property + have hp' : p x.val = x.val := by rw [← hy]; exact LinearMap.congr_fun hp y + rw [hp'] +end Image + +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) (e a : PresentedAlgebra P) (he : e*e=e) + +def quotientCornerEnd : quotientSummand e he ⟶ quotientSummand e he := + ⟨quotientAction P (e*a*e), by + change (quotientAction P e * quotientAction P (e*a*e)) * quotientAction P e = _ + simp only [← map_mul] + congr 1 + simp only [← mul_assoc, he] + rw [mul_assoc (e*a) e e, he]⟩ + +def evaluatedCornerEnd : evaluatedImageDerived X e ⟶ evaluatedImageDerived X e := + (derivedTargetInclusion (k := k)).preimage (DerivedCategory.Qh.map + ((vectorStalk (k := k)).map (imageCornerEnd + (liftedEndHom (givenAction X e)).hom (liftedEndHom (givenAction X a)).hom))) + +include he in +lemma derived_corner_projection_square : + (derivedQuotientEvaluation X ⋙ derivedTargetInclusion (k := k)).map + (quotientAction P (e*a*e)) ≫ derivedImageProjection X e = + derivedImageProjection X e ≫ (derivedTargetInclusion (k := k)).map (evaluatedCornerEnd X e a) := by + unfold evaluatedCornerEnd + erw [Functor.map_preimage] + unfold derivedImageProjection + erw [← Category.assoc, derived_quotientAction_square, Category.assoc] + erw [← Functor.map_comp, ← Functor.map_comp] + have h := image_corner_square (liftedEndHom (givenAction X e)).hom + (liftedEndHom (givenAction X a)).hom (lifted_action_idempotent X e he) + have hc : liftedEndHom (givenAction X (e*a*e)) = ModuleCat.ofHom + ((liftedEndHom (givenAction X e)).hom * (liftedEndHom (givenAction X a)).hom * + (liftedEndHom (givenAction X e)).hom) := by + simp only [map_mul] + rfl + erw [hc, h, Functor.map_comp, Functor.map_comp, ← Category.assoc] + rfl + +/-- The complete derived evaluation intertwines every corner endomorphism with +its concrete action on eY; this includes e alpha(r) e from Section 3. -/ +theorem completed_corner_square : + (completedDerivedEvaluation X).map (quotientCornerEnd e a he) ≫ + (completedSummandImageIso X e he).hom = + (completedSummandImageIso X e he).hom ≫ evaluatedCornerEnd X e a := by + apply completedExtensionImageSquare + apply (derivedTargetInclusion (k := k)).map_injective + rw [Functor.map_comp, Functor.map_comp] + erw [Functor.map_preimage] + exact derived_corner_projection_square X e a he + +omit [FiniteDimensional k Y] in +include he in +/-- For a central e and any algebra endomorphism alpha, the concrete map on eY +is the restriction of alpha(r), exactly as in the manuscript. -/ +theorem central_alpha_restriction (hec : ∀ b : PresentedAlgebra P, e*b=b*e) + (α : PresentedAlgebra P →ₐ[k] PresentedAlgebra P) (b : PresentedAlgebra P) + (y : evaluatedImage X e) : + ((imageCornerEnd (liftedEndHom (givenAction X e)).hom + (liftedEndHom (givenAction X (α b))).hom) y).val = + (liftedEndHom (givenAction X (α b))).hom y.val := by + apply imageCornerEnd_apply _ _ (lifted_action_idempotent X e he) + have h := congrArg (fun c => (liftedEndHom (givenAction X c)).hom) (hec (α b)) + simp only [map_mul] at h + exact h +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/CompletedDerivedEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/CompletedDerivedEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..273823bc350943aeb087b47f9bcc1360ead9a4ca --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/CompletedDerivedEvaluation.lean @@ -0,0 +1,77 @@ +import OAI.Algebra.Finitistic.Localization.VectorIdempotentCompleteness + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +open FiniteProjectiveHomotopy VectorComplexFormality +universe u v w z +section General +variable {C : Type u} [Category.{v} C] [Preadditive C] +variable {D : Type w} [Category.{z} D] [Preadditive D] +variable (F : C ⥤ D) [F.Additive] + +instance karoubiExtensionAdditive : ((functorExtension₂ C D).obj F).Additive where + map_add := by + intro A B f g + apply Karoubi.Hom.ext + exact F.map_add + +variable [IsIdempotentComplete D] + +instance completedExtensionAdditive : ((functorExtension C D).obj F).Additive := + inferInstanceAs (((functorExtension₂ C D).obj F ⋙ (toKaroubiEquivalence D).inverse).Additive) + +/-- The extension restricts to the original functor under the canonical embedding. -/ +def completedExtensionFactors : + toKaroubi C ⋙ (functorExtension C D).obj F ≅ F := + (Functor.associator _ _ _).symm ≪≫ + Functor.isoWhiskerRight + ((functorExtension₂CompWhiskeringLeftToKaroubiIso C D).app F) + (toKaroubiEquivalence D).inverse ≪≫ + Functor.associator _ _ _ ≪≫ + Functor.isoWhiskerLeft F (toKaroubiEquivalence D).unitIso.symm ≪≫ + Functor.rightUnitor F +/-- An explicitly split evaluated idempotent identifies the value of the completion. -/ +def completedExtensionImageIso (U : Karoubi C) (I : D) + (π : F.obj U.X ⟶ I) (ι : I ⟶ F.obj U.X) + (hπι : π ≫ ι = F.map U.p) (hιπ : ι ≫ π = 𝟙 I) : + ((functorExtension C D).obj F).obj U ≅ I := + (toKaroubiEquivalence D).inverse.mapIso + (splitKaroubiIso (F.map U.p) (by rw [← F.map_comp, U.idem]) π ι hπι hιπ) ≪≫ + (toKaroubiEquivalence D).unitIso.symm.app I + +end General + +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) + +instance derivedEmbeddingAdditive : (derivedEmbedding.{u,max u v} k).Additive := + inferInstanceAs ((inclusion k ⋙ DerivedCategory.Qh).Additive) + +instance derivedToEssImageAdditive : ((derivedEmbedding.{u,max u v} k).toEssImage).Additive := by + dsimp [Functor.toEssImage] + infer_instance + +instance derivedQuotientEvaluationAdditive : (derivedQuotientEvaluation X).Additive := by + dsimp [derivedQuotientEvaluation] + infer_instance + +/-- The manuscript's additive extension of evaluation to all of Kar(Q), with +values in the actual bounded finite-dimensional derived category. -/ +def completedDerivedEvaluation : Karoubi (BoundedQ P) ⥤ FiniteVectorDerived.{u,v} (k := k) := + (functorExtension _ _).obj (derivedQuotientEvaluation X) + +instance completedDerivedEvaluationAdditive : (completedDerivedEvaluation X).Additive := + completedExtensionAdditive (derivedQuotientEvaluation X) + +def completedDerivedEvaluationFactors : + toKaroubi (BoundedQ P) ⋙ completedDerivedEvaluation X ≅ derivedQuotientEvaluation X := + completedExtensionFactors (derivedQuotientEvaluation X) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/CompletedImageEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/CompletedImageEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a5d4d463cdf943d68a8f7d59091d4b3ead6c10c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/CompletedImageEvaluation.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Localization.CompletedDerivedEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +open FiniteProjectiveHomotopy +universe u v +private theorem sandwich_cancel {C : Type*} [Category C] {A B I : C} + (e : A ≅ B) (p : B ⟶ I) (i : I ⟶ B) : + ((e.hom ≫ p) ≫ (i ≫ e.inv)) ≫ e.hom = e.hom ≫ (p ≫ i) := by + simp only [Category.assoc, e.inv_hom_id, Category.comp_id] + +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) (r : PresentedAlgebra P) (hr : r*r=r) + +/-- The image vector space, as an actual bounded finite-dimensional stalk complex. -/ +def evaluatedImageK : K.{u,max u v} k := + ⟨(vectorStalk (k := k)).obj (ModuleCat.of k (evaluatedImage X r)), + single_property (ModuleCat.of k (evaluatedImage X r)) 0⟩ + +def evaluatedImageDerived : FiniteVectorDerived.{u,v} (k := k) := + (derivedEmbedding k).toEssImage.obj (evaluatedImageK X r) + +abbrev derivedTargetInclusion := (derivedEmbedding.{u,max u v} k).essImage.ι + +def derivedImageProjection : + (derivedTargetInclusion (k := k)).obj ((derivedQuotientEvaluation X).obj (vertexQ P 0)) ⟶ + (derivedTargetInclusion (k := k)).obj (evaluatedImageDerived X r) := + (derivedVertexIso X 0).hom ≫ DerivedCategory.Qh.map + ((vectorStalk (k := k)).map (imageProjection (liftedEndHom (givenAction X r)).hom)) + +def derivedImageInclusion : + (derivedTargetInclusion (k := k)).obj (evaluatedImageDerived X r) ⟶ + (derivedTargetInclusion (k := k)).obj ((derivedQuotientEvaluation X).obj (vertexQ P 0)) := + DerivedCategory.Qh.map + ((vectorStalk (k := k)).map (imageInclusion (liftedEndHom (givenAction X r)).hom)) ≫ + (derivedVertexIso X 0).inv + +include hr in +lemma derived_image_inclusion_projection : + derivedImageInclusion X r ≫ derivedImageProjection X r = 𝟙 _ := by + dsimp [derivedImageInclusion, derivedImageProjection] + erw [Category.assoc, Iso.inv_hom_id_assoc] + erw [← Functor.map_comp, ← Functor.map_comp, + image_inclusion_projection _ (lifted_action_idempotent X r hr)] + erw [CategoryTheory.Functor.map_id, CategoryTheory.Functor.map_id] + rfl + +lemma derived_image_projection_inclusion : + derivedImageProjection X r ≫ derivedImageInclusion X r = + (derivedQuotientEvaluation X ⋙ derivedTargetInclusion (k := k)).map (quotientAction P r) := by + apply (cancel_mono (derivedVertexIso X 0).hom).mp + dsimp [derivedImageProjection, derivedImageInclusion] + erw [sandwich_cancel (derivedVertexIso X 0) + (DerivedCategory.Qh.map ((vectorStalk (k := k)).map + (imageProjection (liftedEndHom (givenAction X r)).hom))) + (DerivedCategory.Qh.map ((vectorStalk (k := k)).map + (imageInclusion (liftedEndHom (givenAction X r)).hom)))] + erw [← Functor.map_comp, ← Functor.map_comp, image_projection_inclusion] + exact (derived_quotientAction_square X r).symm + +/-- The full completed derived evaluation takes U to the actual finite-dimensional eY stalk. -/ +def completedSummandImageIso : + (completedDerivedEvaluation X).obj (quotientSummand r hr) ≅ evaluatedImageDerived X r := + completedExtensionImageIso (derivedQuotientEvaluation X) (quotientSummand r hr) + (evaluatedImageDerived X r) + ((derivedTargetInclusion (k := k)).preimage (derivedImageProjection X r)) + ((derivedTargetInclusion (k := k)).preimage (derivedImageInclusion X r)) + (by + apply (derivedTargetInclusion (k := k)).map_injective + rw [Functor.map_comp] + erw [Functor.map_preimage, Functor.map_preimage] + exact derived_image_projection_inclusion X r) + (by + apply (derivedTargetInclusion (k := k)).map_injective + erw [Functor.map_comp, CategoryTheory.Functor.map_id] + erw [Functor.map_preimage, Functor.map_preimage] + exact derived_image_inclusion_projection X r hr) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/CompletedOddDoubleEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/CompletedOddDoubleEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..9780f74632c9cabfc7ca471ca0a3baf98cdfbc21 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/CompletedOddDoubleEvaluation.lean @@ -0,0 +1,65 @@ +import OAI.Algebra.Finitistic.Localization.CompletedShiftedCornerEvaluation +import OAI.Algebra.Finitistic.Localization.CompletedCornerEvaluation +import Mathlib.CategoryTheory.Idempotents.Biproducts +import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Biproducts + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +private theorem mapBiprod_square {C D : Type*} [Category C] [Category D] + [Preadditive C] [Preadditive D] [HasBinaryBiproducts C] [HasBinaryBiproducts D] + (F : C ⥤ D) [F.Additive] [PreservesBinaryBiproducts F] + {A B : C} {X Y : D} (a : A ⟶ A) (b : B ⟶ B) (x : X ⟶ X) (y : Y ⟶ Y) + (e : F.obj A ≅ X) (f : F.obj B ≅ Y) + (ha : F.map a ≫ e.hom = e.hom ≫ x) (hb : F.map b ≫ f.hom = f.hom ≫ y) : + F.map (biprod.map a b) ≫ (F.mapBiprod A B ≪≫ biprod.mapIso e f).hom = + (F.mapBiprod A B ≪≫ biprod.mapIso e f).hom ≫ biprod.map x y := by + apply biprod.hom_ext + · simp only [Iso.trans_hom, Functor.mapBiprod_hom, biprod.mapIso_hom, + Category.assoc, biprod.map_fst, biprod.map_fst_assoc, biprod.lift_fst_assoc] + rw [← Category.assoc, ← Functor.map_comp, biprod.map_fst, Functor.map_comp, + Category.assoc, ha] + · simp only [Iso.trans_hom, Functor.mapBiprod_hom, biprod.mapIso_hom, + Category.assoc, biprod.map_snd, biprod.map_snd_assoc, biprod.lift_snd_assoc] + rw [← Category.assoc, ← Functor.map_comp, biprod.map_snd, Functor.map_comp, + Category.assoc, hb] + +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) +local instance : HasFiniteBiproducts (Karoubi (BoundedQ P)) := Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi (BoundedQ P)) := hasBinaryBiproducts_of_finite_biproducts _ + +local instance : PreservesBinaryBiproducts (completedDerivedEvaluation X) := + preservesBinaryBiproducts_of_preservesBiproducts _ + +/-- Evaluation of the formal odd double used in Section 3. -/ +def completedOddDoubleImageIso (r : PresentedAlgebra P) (hr : r*r=r) (n : ℤ) : + (completedDerivedEvaluation X).obj + (quotientSummand r hr ⊞ + ((functorExtension₂ (BoundedQ P) (BoundedQ P)).obj (shiftFunctor (BoundedQ P) n)).obj + (quotientSummand r hr)) ≅ + evaluatedImageDerived X r ⊞ (evaluatedImageDerived X r)⟦n⟧ := + (completedDerivedEvaluation X).mapBiprod _ _ ≪≫ + biprod.mapIso (completedSummandImageIso X r hr) (completedShiftedSummandImageIso X r hr n) + +/-- The two summands of the evaluated odd double carry exactly the original +corner action and its shift. This is the action used at each diagram vertex. -/ +theorem completed_oddDouble_corner_square (e a : PresentedAlgebra P) (he : e*e=e) (n : ℤ) : + (completedDerivedEvaluation X).map + (biprod.map (quotientCornerEnd e a he) + (((functorExtension₂ (BoundedQ P) (BoundedQ P)).obj (shiftFunctor (BoundedQ P) n)).map + (quotientCornerEnd e a he))) ≫ (completedOddDoubleImageIso X e he n).hom = + (completedOddDoubleImageIso X e he n).hom ≫ + biprod.map (evaluatedCornerEnd X e a) ((evaluatedCornerEnd X e a)⟦n⟧') := by + exact mapBiprod_square (completedDerivedEvaluation X) _ _ _ _ + (completedSummandImageIso X e he) (completedShiftedSummandImageIso X e he n) + (completed_corner_square X e a he) (completed_shifted_corner_square X e a he n) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/CompletedShiftEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/CompletedShiftEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b237cdd18472dc655e74e5a5ce7af39e57f6b6d9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/CompletedShiftEvaluation.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.Finitistic.Localization.CompletedImageEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +universe u v w z +section General +variable {C : Type u} [Category.{v} C] [Preadditive C] +variable {D : Type w} [Category.{z} D] [Preadditive D] [IsIdempotentComplete D] +variable (F : C ⥤ D) [F.Additive] + +/-- Commutation with any endofunctor extends uniquely across idempotent completion. -/ +def completedCommutationIso (S : C ⥤ C) (T : D ⥤ D) (e : S ⋙ F ≅ F ⋙ T) : + (functorExtension₂ C C).obj S ⋙ (functorExtension C D).obj F ≅ + (functorExtension C D).obj F ⋙ T := by + let G := (functorExtension C D).obj F + let S' := (functorExtension₂ C C).obj S + let h : toKaroubi C ⋙ (S' ⋙ G) ≅ toKaroubi C ⋙ (G ⋙ T) := + (Functor.associator _ _ _).symm ≪≫ + Functor.isoWhiskerRight ((functorExtension₂CompWhiskeringLeftToKaroubiIso C C).app S) G ≪≫ + Functor.associator _ _ _ ≪≫ + Functor.isoWhiskerLeft S (completedExtensionFactors F) ≪≫ e ≪≫ + Functor.isoWhiskerRight (completedExtensionFactors F).symm T ≪≫ + Functor.associator _ _ _ + exact (whiskeringLeftObjToKaroubiFullyFaithful (C := C) (D := D)).preimageIso h +end General + +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) + +/-- This is the formal shift used by the native odd-double construction: shift +the underlying object and its idempotent. No shift coherence is assumed. -/ +def completedDerivedShiftIso (n : ℤ) : + (functorExtension₂ (BoundedQ P) (BoundedQ P)).obj (shiftFunctor (BoundedQ P) n) ⋙ + completedDerivedEvaluation X ≅ + completedDerivedEvaluation X ⋙ shiftFunctor (FiniteVectorDerived.{u,v} (k := k)) n := + completedCommutationIso (derivedQuotientEvaluation X) _ _ + ((derivedQuotientEvaluation X).commShiftIso n) + +/-- In particular, every formal shift of U evaluates to the same shift of eY. -/ +def completedShiftedSummandImageIso (r : PresentedAlgebra P) (hr : r*r=r) (n : ℤ) : + (completedDerivedEvaluation X).obj + (((functorExtension₂ (BoundedQ P) (BoundedQ P)).obj (shiftFunctor (BoundedQ P) n)).obj + (quotientSummand r hr)) ≅ (evaluatedImageDerived X r)⟦n⟧ := + (completedDerivedShiftIso X n).app (quotientSummand r hr) ≪≫ + (shiftFunctor _ n).mapIso (completedSummandImageIso X r hr) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/CompletedShiftedCornerEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/CompletedShiftedCornerEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..88fbc5194ded6f7d53d9478d3defcb66abf9cc1d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/CompletedShiftedCornerEvaluation.lean @@ -0,0 +1,38 @@ +import OAI.Algebra.Finitistic.Localization.CompletedCornerEvaluation +import OAI.Algebra.Finitistic.Localization.CompletedShiftEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) (e a : PresentedAlgebra P) (he : e*e=e) + +/-- The same corner action evaluates correctly on every formal shift, including shift 3. -/ +theorem completed_shifted_corner_square (n : ℤ) : + (completedDerivedEvaluation X).map + (((functorExtension₂ (BoundedQ P) (BoundedQ P)).obj (shiftFunctor (BoundedQ P) n)).map + (quotientCornerEnd e a he)) ≫ (completedShiftedSummandImageIso X e he n).hom = + (completedShiftedSummandImageIso X e he n).hom ≫ (evaluatedCornerEnd X e a)⟦n⟧' := by + have hn := (completedDerivedShiftIso X n).hom.naturality (quotientCornerEnd e a he) + have hm := congrArg (shiftFunctor (FiniteVectorDerived.{u,v} (k := k)) n).map + (completed_corner_square X e a he) + simp only [Functor.map_comp] at hm + change _ ≫ ((completedDerivedShiftIso X n).hom.app (quotientSummand e he) ≫ + (shiftFunctor _ n).map (completedSummandImageIso X e he).hom) = + ((completedDerivedShiftIso X n).hom.app (quotientSummand e he) ≫ + (shiftFunctor _ n).map (completedSummandImageIso X e he).hom) ≫ _ + rw [← Category.assoc] + change (((functorExtension₂ (BoundedQ P) (BoundedQ P)).obj (shiftFunctor (BoundedQ P) n) ⋙ + completedDerivedEvaluation X).map (quotientCornerEnd e a he) ≫ _) ≫ _ = _ + rw [hn, Category.assoc] + change _ ≫ ((shiftFunctor _ n).map ((completedDerivedEvaluation X).map (quotientCornerEnd e a he)) ≫ _) = _ + rw [hm, ← Category.assoc] +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ConcreteChainRepresentatives.lean b/lean/OAI/Algebra/Finitistic/Localization/ConcreteChainRepresentatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9aac0eb396aad14d53efb21ec4aa3aacf905ad1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ConcreteChainRepresentatives.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Localization.BoundedRepresentatives +import OAI.Algebra.Finitistic.Localization.SourceLinear +import OAI.Algebra.Finitistic.Localization.ChainRepresentatives + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ConcreteChainRepresentatives +open SourceVerdier +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) + +abbrev representative (X : K P) : CochainComplex (Proj P) ℤ := X.obj.as + +theorem representative_bounded (X : K P) : + BoundedHomotopy.boundedComplex (Proj P) (representative P X) := + (BoundedHomotopy.bounded_quotient_obj_iff _ _).1 X.property + +/-- The lifted source diagram has genuine bounded projective chain representatives +and a specified null-homotopy for every relation; no chain representatives are assumed. -/ +theorem quadratic_representatives (na nb nr : ℕ) (X₀ X₁ X₂ : K P) + (a : Fin na → (X₀ ⟶ X₁)) (b : Fin nb → (X₁ ⟶ X₂)) + (c : Fin nr → Fin na → Fin nb → k) + (hc : ∀ r, ∑ i, ∑ j, c r i j • (a i ≫ b j) = 0) : + ∃ (f : Fin na → (representative P X₀ ⟶ representative P X₁)) + (g : Fin nb → (representative P X₁ ⟶ representative P X₂)), + (∀ i, (HomotopyCategory.quotient (Proj P) (.up ℤ)).map (f i) = (a i).hom) ∧ + (∀ j, (HomotopyCategory.quotient (Proj P) (.up ℤ)).map (g j) = (b j).hom) ∧ + Nonempty (∀ r, Homotopy (∑ i, ∑ j, c r i j • (f i ≫ g j)) 0) := by + let I := (BoundedHomotopy.bounded (Proj P)).ι + apply ChainRepresentatives.quadratic_chain_representatives na nb nr + (representative P X₀) (representative P X₁) (representative P X₂) + (fun i => I.map (a i)) (fun j => I.map (b j)) c + intro r + have h := congrArg I.map (hc r) + simp only [Functor.map_sum,Functor.map_smul,Functor.map_comp,Functor.map_zero] at h + exact h +end LittleFinitistic.ConcreteChainRepresentatives + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ConcreteFixedDiagram.lean b/lean/OAI/Algebra/Finitistic/Localization/ConcreteFixedDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..65dadc6ed8b2b55d21d1d937cf592bd6da2b6ed1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ConcreteFixedDiagram.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.Finitistic.Localization.FixedDiagram +import OAI.Algebra.Finitistic.Localization.SourceShiftLinear +import OAI.Algebra.Finitistic.Encoding.RelationBasisAction + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Idempotents +namespace LittleFinitistic.ConcreteFixedDiagram +open SelectionEncoding RelationBasisCoefficients RelationBasisAction FormalSummandAction +universe u v +variable {k : Type u} [Field k] {R : Type v} [Ring R] [Algebra k R] +variable (E : Encoding k R) +local instance : HasFiniteBiproducts (Karoubi (SourceVerdier.Q E.relations)) := + Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi (SourceVerdier.Q E.relations)) := + hasBinaryBiproducts_of_finite_biproducts _ + +/-- The fixed odd-double diagram in the actual Kᵇ(proj-B) and its actual Verdier +quotient. Every independent relation of the constructed path algebra is included. -/ +theorem fixed_diagram {L : SourceVerdier.Q E.relations} (θ : R →ₐ[k] End L) + (e : R) (he : e*e=e) (hec : ∀ r : R, e*r=r*e) (α : R →ₐ[k] R) : + ∃ (V₀ : SourceVerdier.Q E.relations) (ρ₀ : R →ₐ[k] End V₀) + (i : (toKaroubi (SourceVerdier.Q E.relations)).obj V₀ ≅ + summand θ e he ⊞ OddDouble.formalShift (summand θ e he) 3) + (D₀ D₁ D₂ : SourceVerdier.K E.relations) + (φ₀ : (SourceVerdier.q E.relations).obj D₀ ≅ V₀) + (φ₁ : (SourceVerdier.q E.relations).obj D₁ ≅ V₀) + (φ₂ : (SourceVerdier.q E.relations).obj D₂ ≅ V₀) + (f : Fin (E.generators+1) → (D₀ ⟶ D₁)) + (g : Fin (E.generators+1) → (D₁ ⟶ D₂)), + (∀ r : R, (toKaroubi (SourceVerdier.Q E.relations)).map (ρ₀ r) ≫ i.hom = + i.hom ≫ oddDoubleAction θ e he hec α r) ∧ + (∀ a, (SourceVerdier.q E.relations).map (f a) ≫ φ₁.hom = + φ₀.hom ≫ ρ₀ (arrow (generator E) a)) ∧ + (∀ b, (SourceVerdier.q E.relations).map (g b) ≫ φ₂.hom = + φ₁.hom ≫ ρ₀ (arrow (generator E) b)) ∧ + (∀ r : RelationIndex E.relations, + ∑ a, ∑ b, basisCoefficient E.relations r a b • (f a ≫ g b) = 0) := + FixedDiagram.fixed_diagram (SourceVerdier.q E.relations) (SourceVerdier.Sigma E.relations) + θ e he hec α (E.generators+1) (E.generators+1) + (Module.finrank k (QuadraticEncoding.relationSpace E.relations)) + (arrow (generator E)) (arrow (generator E)) (basisCoefficient E.relations) + (encoding_basis_action E) +end LittleFinitistic.ConcreteFixedDiagram + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ConcreteQuadraticDiagram.lean b/lean/OAI/Algebra/Finitistic/Localization/ConcreteQuadraticDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..909f9d6f9c8d0d8d278c8d3aaa1ee2b1d043d51a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ConcreteQuadraticDiagram.lean @@ -0,0 +1,32 @@ +import OAI.Algebra.Finitistic.Encoding.RelationBasisCoefficients +import OAI.Algebra.Finitistic.Rectification.InducedDiagram + +namespace OAI +noncomputable section +namespace LittleFinitistic.ConcreteQuadraticDiagram +open QuadraticEncoding RelationBasisCoefficients ThreeVertexAlgebra +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The exact three-vertex algebra and its actual independent relation basis, +packaged for the induced-column construction. -/ +def quadratic : ExternalTensor.Section4.Quadratic k (B P) + (A := Fin (d+1)) (J := Fin (d+1)) (R := RelationIndex P) where + e₀ := vertex (composition P) 0 + e₁ := vertex (composition P) 1 + e₂ := vertex (composition P) 2 + a := arrow01 P + b := arrow12 P + ha i := by + change mul (composition P) (0,0,0,basis i,0,0) (vertex (composition P) 0) = _ + simp [vertex,mul,arrow01] + hb j := by + change mul (composition P) (0,0,0,0,basis j,0) (vertex (composition P) 1) = _ + simp [vertex,mul,arrow12] + coeff := basisCoefficient P + relation := basis_relation P +end LittleFinitistic.ConcreteQuadraticDiagram + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ConcreteTensorEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/ConcreteTensorEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f265f389196058ebc17122469fa1cb65bae3ef6b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ConcreteTensorEvaluation.lean @@ -0,0 +1,122 @@ +import OAI.Algebra.Finitistic.Localization.SourceVerdier +import OAI.Algebra.Finitistic.Rectification.VertexTensorEvaluation +import OAI.Algebra.Finitistic.Localization.TensorEvaluationFunctor + +namespace OAI +noncomputable section +open CategoryTheory Limits Category +namespace LittleFinitistic.ConcreteTensorEvaluation +open QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type u} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +/-- Match the opposite-regular presentation of eB to the fixed-point presentation. -/ +def idealEquiv (e : B P) (he : e*e=e) : + VertexProjectives.ideal e ≃ₗ[(B P)ᵐᵒᵖ] IdempotentTensor.rightIdeal e where + toFun x := ⟨x.val.unop, by + exact congrArg MulOpposite.unop (VertexProjectives.fixed e he x)⟩ + invFun x := ⟨MulOpposite.op x.val, ⟨MulOpposite.op x.val, by + change MulOpposite.op x.val * MulOpposite.op e = MulOpposite.op x.val + exact congrArg MulOpposite.op x.property⟩⟩ + left_inv x := by rfl + right_inv x := by rfl + map_add' x y := rfl + map_smul' a x := rfl + +section TensorCongr +variable {A : Type u} [Ring A] [Algebra k A] +variable {M M' N : Type u} [AddCommGroup M] [AddCommGroup M'] [AddCommGroup N] +variable [Module k M] [Module k M'] [Module k N] +variable [Module Aᵐᵒᵖ M] [Module Aᵐᵒᵖ M'] [Module A N] +variable [IsScalarTower k Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M'] + +/-- Balanced tensor respects actual right-module equivalences. -/ +def tensorCongr (e : M ≃ₗ[Aᵐᵒᵖ] M') : + BalancedTensor.Tensor k A M N ≃ₗ[k] BalancedTensor.Tensor k A M' N where + __ := BalancedTensor.mapLeft (k := k) N e.toLinearMap + invFun := BalancedTensor.mapLeft (k := k) N e.symm.toLinearMap + left_inv z := by + change BalancedTensor.mapLeft (k := k) N e.symm.toLinearMap + (BalancedTensor.mapLeft (k := k) N e.toLinearMap z) = z + induction z using BalancedTensor.induction_on with + | hz => simp + | ht m n => simp + | ha a b ha hb => + simp only [map_add] + exact congrArg₂ (· + ·) ha hb + right_inv z := by + change BalancedTensor.mapLeft (k := k) N e.toLinearMap + (BalancedTensor.mapLeft (k := k) N e.symm.toLinearMap z) = z + induction z using BalancedTensor.induction_on with + | hz => simp + | ht m n => simp + | ha a b ha hb => + simp only [map_add] + exact congrArg₂ (· + ·) ha hb +end TensorCongr + +/-- Actual tensor evaluation on projectives. -/ +abbrev moduleEvaluation : SourceVerdier.Proj P ⥤ ModuleCat.{u} k := + (ProjectiveComplexes.finiteProjective (B P)).ι ⋙ + BalancedTensor.tensorFunctor k (B P) X.Evaluation + +instance vertexScalarTower (i : Fin 3) : + IsScalarTower k (B P)ᵐᵒᵖ (BalancedTensor.ScalarModule k (B P) (SourceVerdier.E P i).obj) := + BalancedTensor.scalarModuleTower k (B P) (SourceVerdier.E P i).obj + +/-- The exact natural vertex identification E_i tensor_B M(Y) = Y. -/ +def vertexIso (i : Fin 3) : (moduleEvaluation X).obj (SourceVerdier.E P i) ≅ ModuleCat.of k Y := + ((@tensorCongr k _ (B P) _ _ + (BalancedTensor.ScalarModule k (B P) (SourceVerdier.E P i).obj) + (IdempotentTensor.rightIdeal (SourceVerdier.vertex P i)) X.Evaluation + _ _ _ (BalancedTensor.ScalarModule k (B P) (SourceVerdier.E P i).obj).isModule _ _ + _ _ _ (vertexScalarTower (P := P) i) inferInstance + (idealEquiv (SourceVerdier.vertex P i) (SourceVerdier.vertex_idem P i))).trans + (X.vertexTensorEquiv i)).toModuleIso + +@[simp] theorem vertexIso_mk (i : Fin 3) + (m : BalancedTensor.ScalarModule k (B P) (SourceVerdier.E P i).obj) (y : X.Evaluation) : + (vertexIso X i).hom.hom + (BalancedTensor.mk k (B P) _ X.Evaluation m y) = X.projection i (m.val.unop • y) := rfl + +/-- The two actual identity-arrow tensor maps become identities on Y. -/ +theorem s_naturality : + (moduleEvaluation X).map (SourceVerdier.arrow01 P 0) ≫ (vertexIso X 1).hom = + (vertexIso X 0).hom := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m y + change X.projection 1 ((m.val * MulOpposite.op (QuadraticEncoding.arrow01 P 0)).unop • y) = + X.projection 0 (m.val.unop • y) + rw [MulOpposite.unop_mul, MulOpposite.unop_op, mul_smul, X.arrow01_smul] + simp [Representation.projection] + +theorem s'_naturality : + (moduleEvaluation X).map (SourceVerdier.arrow12 P 0) ≫ (vertexIso X 2).hom = + (vertexIso X 1).hom := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m y + change X.projection 2 ((m.val * MulOpposite.op (QuadraticEncoding.arrow12 P 0)).unop • y) = + X.projection 1 (m.val.unop • y) + rw [MulOpposite.unop_mul, MulOpposite.unop_op, mul_smul, X.arrow12_smul] + simp [Representation.projection] + +instance s_inverted : IsIso ((moduleEvaluation X).map (SourceVerdier.arrow01 P 0)) := by + have : IsIso ((moduleEvaluation X).map (SourceVerdier.arrow01 P 0) ≫ (vertexIso X 1).hom) := by + rw [s_naturality] + infer_instance + exact IsIso.of_isIso_comp_right _ (vertexIso X 1).hom + +instance s'_inverted : IsIso ((moduleEvaluation X).map (SourceVerdier.arrow12 P 0)) := by + have : IsIso ((moduleEvaluation X).map (SourceVerdier.arrow12 P 0) ≫ (vertexIso X 2).hom) := by + rw [s'_naturality] + infer_instance + exact IsIso.of_isIso_comp_right _ (vertexIso X 2).hom + +end LittleFinitistic.ConcreteTensorEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/DerivedActionCompatibility.lean b/lean/OAI/Algebra/Finitistic/Localization/DerivedActionCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..93d1b28e7ae0086234c4fdde90af2a95dac995c5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/DerivedActionCompatibility.lean @@ -0,0 +1,62 @@ +import OAI.Algebra.Finitistic.Localization.ModuleActionCompatibility +import OAI.Algebra.Finitistic.Localization.FiniteDerivedEvaluation + +namespace OAI +noncomputable section +open CategoryTheory +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +open FiniteProjectiveHomotopy +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) + +instance finiteUnderlyingLifting : Localization.Lifting + (boundedDenominators P).Q (boundedDenominators P) (boundedEvaluation X) + (finiteQuotientEvaluation X ⋙ inclusion k) where + iso := (Functor.associator _ _ _).symm ≪≫ + Functor.isoWhiskerRight (finiteQuotientEvaluationFactors X) (inclusion k) + +/-- Both constructions of evaluation through Q agree by uniqueness of localization. -/ +def finiteUnderlyingComparison : finiteQuotientEvaluation X ⋙ inclusion k ≅ + boundedQuotientEvaluation X := + Localization.liftNatIso (boundedDenominators P).Q (boundedDenominators P) + (boundedEvaluation X) (boundedEvaluation X) _ _ (Iso.refl _) + +/-- The existing finite derived evaluation agrees with canonical derived localization +of the explicitly computed homotopy evaluation. -/ +def derivedUnderlyingComparison : + derivedQuotientEvaluation X ⋙ (derivedEmbedding k).essImage.ι ≅ + boundedQuotientEvaluation X ⋙ DerivedCategory.Qh := + Functor.isoWhiskerRight (finiteUnderlyingComparison X) DerivedCategory.Qh + +def derivedVertexIso (i : Fin 3) : + ((derivedQuotientEvaluation X ⋙ (derivedEmbedding k).essImage.ι).obj (vertexQ P i)) ≅ + DerivedCategory.Qh.obj ((vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y))) := + (derivedUnderlyingComparison X).app (vertexQ P i) ≪≫ + DerivedCategory.Qh.mapIso (quotientVertexIso X i) + +/-- The full action square in the actual derived category, for the previously +constructed bounded finite-dimensional evaluation functor. -/ +theorem derived_quotientAction_square (r : PresentedAlgebra P) : + (derivedQuotientEvaluation X ⋙ (derivedEmbedding k).essImage.ι).map (quotientAction P r) ≫ + (derivedVertexIso X 0).hom = + (derivedVertexIso X 0).hom ≫ DerivedCategory.Qh.map + ((vectorStalk (k := k)).map (liftedEndHom (givenAction X r))) := by + have hn := (derivedUnderlyingComparison X).hom.naturality (quotientAction P r) + have hm := congrArg DerivedCategory.Qh.map (quotientAction_square X r) + simp only [Functor.map_comp] at hm + change _ ≫ ((derivedUnderlyingComparison X).hom.app (vertexQ P 0) ≫ + DerivedCategory.Qh.map (quotientVertexIso X 0).hom) = + ((derivedUnderlyingComparison X).hom.app (vertexQ P 0) ≫ + DerivedCategory.Qh.map (quotientVertexIso X 0).hom) ≫ _ + rw [← Category.assoc, hn, Category.assoc] + change (derivedUnderlyingComparison X).hom.app (vertexQ P 0) ≫ + (DerivedCategory.Qh.map ((boundedQuotientEvaluation X).map (quotientAction P r)) ≫ _) = _ + rw [hm, ← Category.assoc] +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/DerivedTruncationCohomology.lean b/lean/OAI/Algebra/Finitistic/Localization/DerivedTruncationCohomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a6cb1bc6ee77d64b165f0299bbc3bdaf3068521 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/DerivedTruncationCohomology.lean @@ -0,0 +1,92 @@ +import Mathlib.Algebra.Homology.DerivedCategory.TStructure +import Mathlib.Algebra.Homology.DerivedCategory.FullyFaithful +import Mathlib.CategoryTheory.Triangulated.TStructure.TruncLTGE + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +namespace LittleFinitistic.DerivedTruncation +universe u v w +variable {C : Type u} [Category.{v} C] [Abelian C] [HasDerivedCategory.{w} C] +open DerivedCategory + +abbrev t := (DerivedCategory.TStructure.t : CategoryTheory.Triangulated.TStructure (DerivedCategory C)) +abbrev lower (X : DerivedCategory C) := (t.truncLT 0).obj X +abbrev upper (X : DerivedCategory C) := (t.truncGE 0).obj X +abbrev inclusion (X : DerivedCategory C) := (t.truncLTι 0).app X +abbrev projection (X : DerivedCategory C) := (t.truncGEπ 0).app X +abbrev triangle (X : DerivedCategory C) := (t.triangleLTGE 0).obj X +instance lower_isLE_minus_one (X : DerivedCategory C) : (lower X).IsLE (-1) := + t.isLE_truncLT_obj X 0 (-1) (by omega) +lemma distinguished (X : DerivedCategory C) : triangle X ∈ distTriang _ := + t.triangleLTGE_distinguished 0 X + +lemma lower_homology_isIso (X : DerivedCategory C) (n : ℤ) (hn : n < 0) : + IsIso ((homologyFunctor C n).map (inclusion X)) := by + have h₀ := DerivedCategory.isZero_of_isGE (upper X) 0 n hn + have h₁ := DerivedCategory.isZero_of_isGE (upper X) 0 (n-1) (by omega) + have : Mono ((homologyFunctor C n).map (inclusion X)) := + (HomologySequence.exact₁ (triangle X) (distinguished X) (n-1) n (by omega)).mono_g + (h₁.eq_of_src _ _) + have : Epi ((homologyFunctor C n).map (inclusion X)) := + (HomologySequence.exact₂ (triangle X) (distinguished X) n).epi_f (h₀.eq_of_tgt _ _) + exact isIso_of_mono_of_epi _ + +lemma upper_homology_isIso (X : DerivedCategory C) (n : ℤ) (hn : 0 ≤ n) : + IsIso ((homologyFunctor C n).map (projection X)) := by + have h₀ := DerivedCategory.isZero_of_isLE (lower X) (-1) n (by omega) + have h₁ := DerivedCategory.isZero_of_isLE (lower X) (-1) (n+1) (by omega) + have : Mono ((homologyFunctor C n).map (projection X)) := + (HomologySequence.exact₂ (triangle X) (distinguished X) n).mono_g (h₀.eq_of_src _ _) + have : Epi ((homologyFunctor C n).map (projection X)) := + (HomologySequence.exact₃ (triangle X) (distinguished X) n (n+1) rfl).epi_f + (h₁.eq_of_tgt _ _) + exact isIso_of_mono_of_epi _ + +def lowerHomologyIso (X : DerivedCategory C) (n : ℤ) (hn : n < 0) : + (homologyFunctor C n).obj (lower X) ≅ (homologyFunctor C n).obj X := by + haveI := lower_homology_isIso X n hn + exact asIso ((homologyFunctor C n).map (inclusion X)) + +def upperHomologyIso (X : DerivedCategory C) (n : ℤ) (hn : 0 ≤ n) : + (homologyFunctor C n).obj X ≅ (homologyFunctor C n).obj (upper X) := by + haveI := upper_homology_isIso X n hn + exact asIso ((homologyFunctor C n).map (projection X)) + +/-- The exact cohomological support hypothesis in Section 4. -/ +def TwoDegrees (X : DerivedCategory C) : Prop := + ∀ n : ℤ, n ≠ 0 → n ≠ -3 → IsZero ((homologyFunctor C n).obj X) + +lemma isLE_zero (X : DerivedCategory C) (hX : TwoDegrees X) : X.IsLE 0 := by + rw [DerivedCategory.isLE_iff] + intro n hn + exact hX n (by omega) (by omega) +lemma isGE_neg_three (X : DerivedCategory C) (hX : TwoDegrees X) : X.IsGE (-3) := by + rw [DerivedCategory.isGE_iff] + intro n hn + exact hX n (by omega) (by omega) +lemma lower_isGE (X : DerivedCategory C) (hX : TwoDegrees X) : (lower X).IsGE (-3) := by + have := isGE_neg_three X hX + infer_instance +lemma lower_isLE (X : DerivedCategory C) (hX : TwoDegrees X) : (lower X).IsLE (-3) := by + rw [DerivedCategory.isLE_iff] + intro n hn + by_cases hn₀ : n < 0 + · exact (lowerHomologyIso X n hn₀).isZero_iff.mpr (hX n (by omega) (by omega)) + · exact DerivedCategory.isZero_of_isLE (lower X) (-1) n (by omega) +lemma upper_isLE (X : DerivedCategory C) (hX : TwoDegrees X) : (upper X).IsLE 0 := by + have := isLE_zero X hX + infer_instance + +/-- An object concentrated in one degree is the stalk of its actual cohomology. -/ +def singleIso (X : DerivedCategory C) (n : ℤ) [X.IsGE n] [X.IsLE n] : + X ≅ (singleFunctor C n).obj ((homologyFunctor C n).obj X) := Classical.choice (by + obtain ⟨Y,⟨e⟩⟩ := DerivedCategory.exists_iso_singleFunctor_obj_of_isGE_of_isLE X n + let h : (homologyFunctor C n).obj X ≅ Y := + (homologyFunctor C n).mapIso e ≪≫ (singleFunctorCompHomologyFunctorIso C n).app Y + exact ⟨e ≪≫ (singleFunctor C n).mapIso h.symm⟩) +end LittleFinitistic.DerivedTruncation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/DiagramEvaluationSquares.lean b/lean/OAI/Algebra/Finitistic/Localization/DiagramEvaluationSquares.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a55358c7a690f8a0c49f6dd2ae40237c2d556fe --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/DiagramEvaluationSquares.lean @@ -0,0 +1,19 @@ +import Mathlib.CategoryTheory.Functor.Category + +namespace OAI +open CategoryTheory +namespace LittleFinitistic.DiagramEvaluationSquares +universe u v +variable {C : Type u} [Category.{v} C] + +/-- Compose two isomorphisms of arrow diagrams, retaining the displayed arrow. -/ +theorem compose {A₀ A₁ B₀ B₁ C₀ C₁ : C} + (f : A₀ ⟶ A₁) (g : B₀ ⟶ B₁) (h : C₀ ⟶ C₁) + (i₀ : A₀ ≅ B₀) (i₁ : A₁ ≅ B₁) (j₀ : B₀ ≅ C₀) (j₁ : B₁ ≅ C₁) + (hi : f ≫ i₁.hom = i₀.hom ≫ g) (hj : g ≫ j₁.hom = j₀.hom ≫ h) : + f ≫ (i₁ ≪≫ j₁).hom = (i₀ ≪≫ j₀).hom ≫ h := by + simp only [Iso.trans_hom] + rw [← Category.assoc,hi,Category.assoc,hj,← Category.assoc] +end LittleFinitistic.DiagramEvaluationSquares + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/DiagramLifting.lean b/lean/OAI/Algebra/Finitistic/Localization/DiagramLifting.lean new file mode 100644 index 0000000000000000000000000000000000000000..850bc488b62fc609ae550b2d393748768b38d3b3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/DiagramLifting.lean @@ -0,0 +1,139 @@ +import Mathlib.CategoryTheory.Localization.CalculusOfFractions +import Mathlib.CategoryTheory.Linear.LinearFunctor + +namespace OAI +namespace LittleFinitistic.DiagramLifting +open CategoryTheory CategoryTheory.Category CategoryTheory.Limits + +variable {C D : Type*} [Category C] [Category D] +variable (L : C ⥤ D) (W : MorphismProperty C) [L.IsLocalization W] +variable [W.HasRightCalculusOfFractions] + +/-- Finitely many localized arrows admit one common source denominator. -/ +theorem finite_roof (n : ℕ) (X : C) (Y : Fin n → C) + (f : ∀ i, L.obj X ⟶ L.obj (Y i)) : + ∃ (Z : C) (u : Z ⟶ X), W u ∧ + ∃ (g : ∀ i, Z ⟶ Y i), ∀ i, L.map u ≫ f i = L.map (g i) := by + induction n generalizing X with + | zero => exact ⟨X,𝟙 X,W.id_mem X,(fun i => Fin.elim0 i),fun i => Fin.elim0 i⟩ + | succ n ih => + obtain ⟨φ,hφ⟩ := Localization.exists_rightFraction L W (f 0) + obtain ⟨Z,u,hu,g,hg⟩ := ih φ.X' (fun i => Y i.succ) + (fun i => L.map φ.s ≫ f i.succ) + refine ⟨Z,u ≫ φ.s,W.comp_mem _ _ hu φ.hs,Fin.cases (u ≫ φ.f) g,?_⟩ + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [Fin.cases_zero,Functor.map_comp,assoc,hφ,φ.map_s_comp_map] + · simpa only [Fin.cases_succ,Functor.map_comp,assoc] using hg j + +section Zero +variable [HasZeroMorphisms C] [HasZeroMorphisms D] [L.PreservesZeroMorphisms] + +/-- A finite family vanishing after localization is annihilated by one source denominator. -/ +theorem finite_zero_refinement (n : ℕ) (X : C) (Y : Fin n → C) + (f : ∀ i, X ⟶ Y i) (hf : ∀ i, L.map (f i) = 0) : + ∃ (Z : C) (u : Z ⟶ X), W u ∧ ∀ i, u ≫ f i = 0 := by + induction n generalizing X with + | zero => exact ⟨X,𝟙 X,W.id_mem X,fun i => Fin.elim0 i⟩ + | succ n ih => + have h0 : L.map (f 0) = L.map (0 : X ⟶ Y 0) := by simpa using hf 0 + obtain ⟨X',u,hu,he⟩ := (MorphismProperty.map_eq_iff_precomp L W (f 0) 0).mp h0 + have he0 : u ≫ f 0 = 0 := by simpa using he + obtain ⟨Z,v,hv,hg⟩ := ih X' (fun i => Y i.succ) (fun i => u ≫ f i.succ) + (fun i => by simp [hf]) + refine ⟨Z,v ≫ u,W.comp_mem _ _ hv hu,?_⟩ + intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp [assoc,he0] + · simpa only [assoc] using hg j + +end Zero + +open scoped BigOperators +variable {k : Type*} [CommRing k] [Preadditive C] [Preadditive D] +variable [Linear k C] [Linear k D] [L.Additive] [L.Linear k] + +/-- A finite three-vertex diagram with arbitrary homogeneous quadratic relations +lifts along a right-fraction localization. The displayed denominator maps give +an isomorphism from the localized lift to the original entire diagram. -/ +theorem quadratic_diagram_lift (na nb nr : ℕ) (X₀ X₁ X₂ : C) + (a : Fin na → (L.obj X₀ ⟶ L.obj X₁)) + (b : Fin nb → (L.obj X₁ ⟶ L.obj X₂)) + (r : Fin nr → Fin na → Fin nb → k) + (hr : ∀ ρ, ∑ i, ∑ j, r ρ i j • (a i ≫ b j) = 0) : + ∃ (D₀ D₁ : C) (u₀ : D₀ ⟶ X₀) (u₁ : D₁ ⟶ X₁), W u₀ ∧ W u₁ ∧ + ∃ (f : Fin na → (D₀ ⟶ D₁)) (g : Fin nb → (D₁ ⟶ X₂)), + (∀ i, L.map u₀ ≫ a i = L.map (f i) ≫ L.map u₁) ∧ + (∀ j, L.map u₁ ≫ b j = L.map (g j)) ∧ + (∀ ρ, ∑ i, ∑ j, r ρ i j • (f i ≫ g j) = 0) := by + classical + obtain ⟨D₁,u₁,hu₁,g,hg⟩ := finite_roof L W nb X₁ (fun _ => X₂) b + have : IsIso (L.map u₁) := Localization.inverts L W _ hu₁ + obtain ⟨D₀,u₀,hu₀,f,hf⟩ := finite_roof L W na X₀ (fun _ => D₁) + (fun i => a i ≫ inv (L.map u₁)) + have hpath (i : Fin na) (j : Fin nb) : + L.map (f i ≫ g j) = L.map u₀ ≫ (a i ≫ b j) := by + rw [Functor.map_comp,← hf i,← hg j] + simp only [assoc,IsIso.inv_hom_id_assoc] + let relations : Fin nr → (D₀ ⟶ X₂) := fun ρ => ∑ i, ∑ j, r ρ i j • (f i ≫ g j) + have hrel (ρ : Fin nr) : L.map (relations ρ) = 0 := by + dsimp [relations] + simp only [Functor.map_sum,Functor.map_smul,hpath] + have h := congrArg (fun t => L.map u₀ ≫ t) (hr ρ) + simpa only [Preadditive.comp_sum,Linear.comp_smul,comp_zero] using h + obtain ⟨D₀',v,hv,hvrel⟩ := finite_zero_refinement L W nr D₀ (fun _ => X₂) relations hrel + refine ⟨D₀',D₁,v ≫ u₀,u₁,W.comp_mem _ _ hv hu₀,hu₁, + (fun i => v ≫ f i),g,?_,hg,?_⟩ + · intro i + have hi := congrArg (fun t => t ≫ L.map u₁) (hf i) + simp only [assoc,IsIso.inv_hom_id,comp_id] at hi + simp only [Functor.map_comp,assoc] + rw [← hi] + · intro ρ + have h := hvrel ρ + dsimp [relations] at h + simpa only [Preadditive.comp_sum,Linear.comp_smul,assoc] using h + +include W in +/-- Every finite three-level quadratic diagram in the localized category, +including objects not literally presented as functor images, has an isomorphic lift. -/ +theorem finite_quadratic_diagram_lifting (na nb nr : ℕ) (Y₀ Y₁ Y₂ : D) + (a : Fin na → (Y₀ ⟶ Y₁)) (b : Fin nb → (Y₁ ⟶ Y₂)) + (r : Fin nr → Fin na → Fin nb → k) + (hr : ∀ ρ, ∑ i, ∑ j, r ρ i j • (a i ≫ b j) = 0) : + ∃ (X₀ X₁ X₂ : C) (e₀ : L.obj X₀ ≅ Y₀) (e₁ : L.obj X₁ ≅ Y₁) + (e₂ : L.obj X₂ ≅ Y₂) (f : Fin na → (X₀ ⟶ X₁)) (g : Fin nb → (X₁ ⟶ X₂)), + (∀ i, L.map (f i) ≫ e₁.hom = e₀.hom ≫ a i) ∧ + (∀ j, L.map (g j) ≫ e₂.hom = e₁.hom ≫ b j) ∧ + (∀ ρ, ∑ i, ∑ j, r ρ i j • (f i ≫ g j) = 0) := by + classical + have := Localization.essSurj L W + let X₀ := L.objPreimage Y₀ + let X₁ := L.objPreimage Y₁ + let X₂ := L.objPreimage Y₂ + let e₀ : L.obj X₀ ≅ Y₀ := L.objObjPreimageIso Y₀ + let e₁ : L.obj X₁ ≅ Y₁ := L.objObjPreimageIso Y₁ + let e₂ : L.obj X₂ ≅ Y₂ := L.objObjPreimageIso Y₂ + let a' := fun i => e₀.hom ≫ a i ≫ e₁.inv + let b' := fun j => e₁.hom ≫ b j ≫ e₂.inv + have hr' (ρ : Fin nr) : ∑ i, ∑ j, r ρ i j • (a' i ≫ b' j) = 0 := by + dsimp [a',b'] + simp only [assoc,Iso.inv_hom_id_assoc] + have h := congrArg (fun t => e₀.hom ≫ t ≫ e₂.inv) (hr ρ) + simpa only [Preadditive.comp_sum,Preadditive.sum_comp,Linear.comp_smul, + Linear.smul_comp,assoc,comp_zero,zero_comp] using h + obtain ⟨D₀,D₁,u₀,u₁,hu₀,hu₁,f,g,hf,hg,hrel⟩ := + quadratic_diagram_lift L W na nb nr X₀ X₁ X₂ a' b' r hr' + refine ⟨D₀,D₁,X₂,(Localization.isoOfHom L W u₀ hu₀) ≪≫ e₀, + (Localization.isoOfHom L W u₁ hu₁) ≪≫ e₁,e₂,f,g,?_,?_,hrel⟩ + · intro i + have h := congrArg (fun t => t ≫ e₁.hom) (hf i) + simpa only [a',Iso.trans_hom,Localization.isoOfHom_hom,assoc, + Iso.inv_hom_id,comp_id] using h.symm + · intro j + have h := congrArg (fun t => t ≫ e₂.hom) (hg j) + simpa only [b',Iso.trans_hom,Localization.isoOfHom_hom,assoc, + Iso.inv_hom_id,comp_id] using h.symm +end LittleFinitistic.DiagramLifting + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/EvaluationFromAlgebra.lean b/lean/OAI/Algebra/Finitistic/Localization/EvaluationFromAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..b915f54fbb91cc2d3d71d8782a873e3069267c4c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/EvaluationFromAlgebra.lean @@ -0,0 +1,40 @@ +import OAI.Algebra.Finitistic.Localization.EvaluationModule +import Mathlib.Algebra.Algebra.Tower + +namespace OAI +noncomputable section +namespace LittleFinitistic.QuadraticEncoding +universe u v w +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable {R : Type v} [Ring R] [Algebra k R] + +/-- The displayed finite list of quadratic equations, in an arbitrary k-algebra. -/ +def Relations.Satisfies (x : Fin d → R) : Prop := ∀ j, + (∑ h, ∑ l, P.quadratic j h l • (x h * x l)) + + (∑ h, P.linear j h • x h) + P.constant j • (1 : R) = 0 + +namespace Representation +variable {P} {Y : Type w} [AddCommGroup Y] [Module k Y] + +/-- Evaluate the quadratic presentation in any actual algebra action. -/ +def ofAction (x : Fin d → R) (hx : P.Satisfies x) (ρ : R →ₐ[k] Module.End k Y) : + Representation P Y where + generator h := ρ (x h) + relation j := by + have h := congrArg ρ (hx j) + simpa only [map_add, map_sum, map_smul, map_mul, map_one, map_zero] using h + +/-- In particular, every R-module supplies the required representation. -/ +def ofModule (x : Fin d → R) (hx : P.Satisfies x) + [Module R Y] [IsScalarTower k R Y] : Representation P Y := + ofAction x hx (Algebra.lsmul k k Y) + +@[simp] theorem ofModule_generator (x : Fin d → R) (hx : P.Satisfies x) + [Module R Y] [IsScalarTower k R Y] (h : Fin d) (y : Y) : + (ofModule (Y := Y) x hx).generator h y = x h • y := rfl +end Representation +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/EvaluationLinear.lean b/lean/OAI/Algebra/Finitistic/Localization/EvaluationLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ad59f85c805caa57a037df1db41a9bb38bbab6f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/EvaluationLinear.lean @@ -0,0 +1,38 @@ +import OAI.Algebra.Finitistic.Localization.QuotientActionEvaluation + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic +open BalancedTensor FiniteProjectiveHomotopy +universe u v w z +namespace BalancedTensor +variable (k : Type u) [Field k] (A : Type v) [Ring A] [Algebra k A] +variable (N : Type z) [AddCommGroup N] [Module k N] [Module A N] + +instance tensorFunctorLinear : (tensorFunctor.{u,v,w,z} k A N).Linear k where + map_smul {M M'} f c := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m n + exact LinearMap.congr_fun ((mk k A (ScalarModule k A M') N).map_smul c (f.hom m)) n + +instance homotopyEvaluationLinear : (homotopyEvaluation.{u,v,w,z} k A N).Linear k := + inferInstanceAs (((tensorFunctor.{u,v,w,z} k A N).mapHomotopyCategory (.up ℤ)).Linear k) +end BalancedTensor +namespace QuadraticEncoding +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +instance boundedEvaluationLinear : (boundedEvaluation X).Linear k := + inferInstanceAs ((inclusion (B P)ᵐᵒᵖ ⋙ homotopyEvaluation k (B P) X.Evaluation).Linear k) + +instance boundedQuotientEvaluationLinear : (boundedQuotientEvaluation X).Linear k := + (Localization.functor_linear_iff (boundedDenominators P).Q (boundedDenominators P) k + (boundedEvaluation X) (boundedQuotientEvaluation X)).mp inferInstance +end QuadraticEncoding +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/EvaluationModule.lean b/lean/OAI/Algebra/Finitistic/Localization/EvaluationModule.lean new file mode 100644 index 0000000000000000000000000000000000000000..5bccd36e2dcb9a110552937da0dac96521ae4af8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/EvaluationModule.lean @@ -0,0 +1,193 @@ +import OAI.Algebra.Finitistic.Encoding.QuadraticEncoding +import Mathlib.LinearAlgebra.Pi + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.QuadraticEncoding +universe u v +variable {k : Type u} [Field k] {d t : ℕ} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] + +/-- An arbitrary vector-space representation of the presented quadratic algebra. -/ +structure Representation (P : Relations k d t) (Y : Type v) + [AddCommGroup Y] [Module k Y] where + generator : Fin d → Module.End k Y + relation : ∀ j, (∑ h, ∑ l, P.quadratic j h l • (generator h * generator l)) + + (∑ h, P.linear j h • generator h) + P.constant j • (1 : Module.End k Y) = 0 + +namespace Representation +variable {P : Relations k d t} (X : Representation P Y) + +def arrowAction : Arrows k d →ₗ[k] Module.End k Y := + ∑ i, (LinearMap.proj i).smulRight (Fin.cases 1 X.generator i) + +@[simp] theorem arrowAction_basis (i : Fin (d+1)) : + X.arrowAction (basis i) = Fin.cases 1 X.generator i := by + classical + simp [arrowAction, basis, Pi.single_apply] + +def rawPathAction : Paths k d →ₗ[k] Module.End k Y := + TensorProduct.lift ((LinearMap.mul k (Module.End k Y)).compl₁₂ X.arrowAction X.arrowAction) + +@[simp] theorem rawPathAction_tmul (w v : Arrows k d) : + X.rawPathAction (w ⊗ₜ[k] v) = X.arrowAction w * X.arrowAction v := rfl + + theorem relations_killed : relationSpace P ≤ X.rawPathAction.ker := by + rw [relationSpace, Submodule.span_le] + rintro z (⟨h, rfl⟩ | ⟨j, rfl⟩) + · simp [LinearMap.mem_ker, commutation] + · simpa [LinearMap.mem_ker, homogenized] using X.relation j + +/-- The actual descended length-two action, using the proved relation ideal. -/ +def pathAction : (Paths k d ⧸ relationSpace P) →ₗ[k] Module.End k Y := + (relationSpace P).liftQ X.rawPathAction X.relations_killed + +@[simp] theorem pathAction_mk (z : Paths k d) : + X.pathAction ((relationSpace P).mkQ z) = X.rawPathAction z := rfl + +@[simp] theorem pathAction_composition (w v : Arrows k d) : + X.pathAction (composition P w v) = X.arrowAction w * X.arrowAction v := rfl + +/-- Three copies of Y, with its representation kept in the type. -/ +def Evaluation (_X : Representation P Y) := Y × Y × Y +instance : AddCommGroup X.Evaluation := inferInstanceAs (AddCommGroup (Y × Y × Y)) +instance : Module k X.Evaluation := inferInstanceAs (Module k (Y × Y × Y)) + +@[simp] theorem evaluation_add (y z : X.Evaluation) : + y + z = (y.1+z.1,y.2.1+z.2.1,y.2.2+z.2.2) := rfl +@[simp] theorem evaluation_zero : (0 : X.Evaluation) = (0,0,0) := rfl +@[simp] theorem evaluation_smul (c : k) (y : X.Evaluation) : + c • y = (c • y.1,c • y.2.1,c • y.2.2) := rfl + +def act (a : B P) (y : X.Evaluation) : X.Evaluation := + (a.1 • y.1, + X.arrowAction a.2.2.2.1 y.1 + a.2.1 • y.2.1, + X.pathAction a.2.2.2.2.2 y.1 + X.arrowAction a.2.2.2.2.1 y.2.1 + a.2.2.1 • y.2.2) + +instance evaluationModule : Module (B P) X.Evaluation where + smul := X.act + one_smul y := by + change X.act (ThreeVertexAlgebra.unit (composition P)) y = y + rcases y with ⟨a,b,c⟩ + simp [act, ThreeVertexAlgebra.unit]; rfl + mul_smul a b y := by + change X.act (ThreeVertexAlgebra.mul (composition P) a b) y = X.act a (X.act b y) + apply Prod.ext + · simp [act, ThreeVertexAlgebra.mul, mul_smul] + apply Prod.ext + · simp [act, ThreeVertexAlgebra.mul, map_add, map_smul, smul_add, smul_smul] + module + · simp [act, ThreeVertexAlgebra.mul, map_add, map_smul, smul_add, smul_smul, + Module.End.mul_apply] + module + smul_zero a := by + change X.act a (0,0,0) = (0,0,0) + simp [act]; rfl + smul_add a y z := by + change X.act a (y.1+z.1,y.2.1+z.2.1,y.2.2+z.2.2) = + ((X.act a y).1+(X.act a z).1,(X.act a y).2.1+(X.act a z).2.1, + (X.act a y).2.2+(X.act a z).2.2) + apply Prod.ext + · simp [act, smul_add] + apply Prod.ext <;> simp [act, smul_add, map_add] <;> abel + add_smul a b y := by + change X.act (a+b) y = + ((X.act a y).1+(X.act b y).1,(X.act a y).2.1+(X.act b y).2.1, + (X.act a y).2.2+(X.act b y).2.2) + rw [ThreeVertexAlgebra.add_eq] + apply Prod.ext + · simp [act, add_smul] + apply Prod.ext <;> simp [act, add_smul, map_add] <;> abel + zero_smul y := by + change X.act (0,0,0,0,0,0) y = (0,0,0) + simp [act]; rfl + +theorem smul_eq (a : B P) (y : X.Evaluation) : a • y = X.act a y := rfl + + +instance : IsScalarTower k (B P) X.Evaluation where + smul_assoc c a y := by + change X.act (c • a) y = c • X.act a y + rw [ThreeVertexAlgebra.smul_eq, evaluation_smul] + apply Prod.ext + · simp [act, mul_smul] + apply Prod.ext <;> simp [act, smul_add, smul_smul] + +instance : SMulCommClass k (B P) X.Evaluation where + smul_comm c a y := by + change c • X.act a y = X.act a (c • y) + rw [evaluation_smul, evaluation_smul] + apply Prod.ext + · simp [act, smul_comm c a.1] + apply Prod.ext <;> simp [act, smul_add, smul_smul, mul_comm] + +instance [FiniteDimensional k Y] : FiniteDimensional k X.Evaluation := + inferInstanceAs (FiniteDimensional k (Y × Y × Y)) + +@[simp] theorem vertex0_smul (y : X.Evaluation) : + ThreeVertexAlgebra.vertex (composition P) 0 • y = (y.1,0,0) := by + simp [smul_eq, act, ThreeVertexAlgebra.vertex]; rfl +@[simp] theorem vertex1_smul (y : X.Evaluation) : + ThreeVertexAlgebra.vertex (composition P) 1 • y = (0,y.2.1,0) := by + simp [smul_eq, act, ThreeVertexAlgebra.vertex]; rfl +@[simp] theorem vertex2_smul (y : X.Evaluation) : + ThreeVertexAlgebra.vertex (composition P) 2 • y = (0,0,y.2.2) := by + simp [smul_eq, act, ThreeVertexAlgebra.vertex]; rfl + +@[simp] theorem arrow01_smul (i : Fin (d+1)) (y : X.Evaluation) : + arrow01 P i • y = (0, (Fin.cases (motive := fun _ => Module.End k Y) 1 X.generator i) y.1, 0) := by + simp [smul_eq, act, arrow01]; rfl +@[simp] theorem arrow12_smul (i : Fin (d+1)) (y : X.Evaluation) : + arrow12 P i • y = (0, 0, (Fin.cases (motive := fun _ => Module.End k Y) 1 X.generator i) y.2.1) := by + simp [smul_eq, act, arrow12]; rfl + +@[simp] theorem s_smul (y : X.Evaluation) : arrow01 P 0 • y = (0,y.1,0) := by + simp; rfl +@[simp] theorem s'_smul (y : X.Evaluation) : arrow12 P 0 • y = (0,0,y.2.1) := by + simp; rfl +@[simp] theorem generator01_smul (h : Fin d) (y : X.Evaluation) : + arrow01 P h.succ • y = (0,X.generator h y.1,0) := by simp; rfl +@[simp] theorem generator12_smul (h : Fin d) (y : X.Evaluation) : + arrow12 P h.succ • y = (0,0,X.generator h y.2.1) := by simp; rfl + +@[simp] theorem pathMap_smul (z : Paths k d) (y : X.Evaluation) : + pathMap P z • y = (0,0,X.rawPathAction z y.1) := by + simp [smul_eq, act, pathMap, lengthTwo, pathAction]; rfl + +/-- Inclusion of the copy of Y at each vertex. -/ +def inclusion (i : Fin 3) : Y →ₗ[k] X.Evaluation where + toFun y := match i with + | 0 => (y,0,0) + | 1 => (0,y,0) + | 2 => (0,0,y) + map_add' y z := by fin_cases i <;> rw [evaluation_add] <;> simp <;> rfl + map_smul' c y := by fin_cases i <;> rw [evaluation_smul] <;> simp <;> rfl + +def projection (i : Fin 3) : X.Evaluation →ₗ[k] Y where + toFun y := match i with + | 0 => y.1 + | 1 => y.2.1 + | 2 => y.2.2 + map_add' y z := by fin_cases i <;> rfl + map_smul' c y := by fin_cases i <;> rfl + +@[simp] theorem projection_inclusion (i : Fin 3) (y : Y) : + X.projection i (X.inclusion i y) = y := by fin_cases i <;> rfl + +theorem vertex_smul (i : Fin 3) (y : X.Evaluation) : + ThreeVertexAlgebra.vertex (composition P) i • y = X.inclusion i (X.projection i y) := by + fin_cases i <;> simp [inclusion, projection] <;> rfl + +/-- The vertex space e_i M(Y), as an actual k-subspace of the constructed module. -/ +def vertexSpace (i : Fin 3) : Submodule k X.Evaluation := (X.inclusion i).range + +def vertexEquiv (i : Fin 3) : Y ≃ₗ[k] X.vertexSpace i := + LinearEquiv.ofInjective (X.inclusion i) (Function.LeftInverse.injective + (X.projection_inclusion i)) +end Representation +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/EvaluationVertexDiagram.lean b/lean/OAI/Algebra/Finitistic/Localization/EvaluationVertexDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f95ac3b6d75c4ace45891164e0b651596e9ea5f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/EvaluationVertexDiagram.lean @@ -0,0 +1,69 @@ +import OAI.Algebra.Finitistic.Rectification.LeftVertexHomology +import OAI.Algebra.Finitistic.Localization.EvaluationModule + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.EvaluationVertexDiagram +open QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type u} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +abbrev module := ModuleCat.of (B P) X.Evaluation + +/-- The vertex of the actual evaluation module is exactly the original vector space. -/ +def equiv (i : Fin 3) : + (LeftVertexHomology.vertex k (B P) (ThreeVertexAlgebra.vertex (composition P) i)).obj (module X) ≃ₗ[k] Y where + toFun z := X.projection i z.val + invFun y := ⟨X.inclusion i y, by + erw [VertexFunctor.mem_fixed, X.vertex_smul, X.projection_inclusion]⟩ + left_inv z := by + apply Subtype.ext + have hz := (VertexFunctor.mem_fixed _ _ _ _ z.val).1 z.property + exact (X.vertex_smul i (show X.Evaluation from z.val)).symm.trans hz + right_inv y := X.projection_inclusion i y + map_add' x y := (X.projection i).map_add x.val y.val + map_smul' c z := by + change X.projection i (algebraMap k (B P) c • z.val) = c • X.projection i z.val + calc + X.projection i (algebraMap k (B P) c • (show X.Evaluation from z.val)) = + X.projection i (c • (show X.Evaluation from z.val)) := + congrArg (X.projection i) (IsScalarTower.algebraMap_smul (B P) c (show X.Evaluation from z.val)) + _ = c • X.projection i z.val := (X.projection i).map_smul c (show X.Evaluation from z.val) + +def vertexIso (i : Fin 3) := (equiv X i).toModuleIso + +def action (a : Fin (d+1)) : ModuleCat.of k Y ⟶ ModuleCat.of k Y := + ModuleCat.ofHom (Fin.cases (motive := fun _ => Module.End k Y) (1 : Module.End k Y) X.generator a) + +/-- The first arrow family acts by the given representation, including the identity arrow. -/ +theorem arrow01_square (a : Fin (d+1)) + (ha : ThreeVertexAlgebra.vertex (composition P) 1 * arrow01 P a = arrow01 P a) : + (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 0) + (ThreeVertexAlgebra.vertex (composition P) 1) (arrow01 P a) ha).app (module X) ≫ + (vertexIso X 1).hom = (vertexIso X 0).hom ≫ action X a := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + change X.projection 1 (arrow01 P a • z.val) = + (Fin.cases (motive := fun _ => Module.End k Y) (1 : Module.End k Y) X.generator a) (X.projection 0 z.val) + exact congrArg (X.projection 1) (X.arrow01_smul a (show X.Evaluation from z.val)) + +/-- The second arrow family has the same specified representation action. -/ +theorem arrow12_square (b : Fin (d+1)) + (hb : ThreeVertexAlgebra.vertex (composition P) 2 * arrow12 P b = arrow12 P b) : + (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 1) + (ThreeVertexAlgebra.vertex (composition P) 2) (arrow12 P b) hb).app (module X) ≫ + (vertexIso X 2).hom = (vertexIso X 1).hom ≫ action X b := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + change X.projection 2 (arrow12 P b • z.val) = + (Fin.cases (motive := fun _ => Module.End k Y) (1 : Module.End k Y) X.generator b) (X.projection 1 z.val) + exact congrArg (X.projection 2) (X.arrow12_smul b (show X.Evaluation from z.val)) +end LittleFinitistic.EvaluationVertexDiagram + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/FiniteDerivedEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/FiniteDerivedEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1d451d3a56755c5d747677a62bf06bb934c5bcb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/FiniteDerivedEvaluation.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Localization.FiniteEvaluationTarget +import OAI.Algebra.Finitistic.Localization.BoundedDerivedEmbedding + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +open FiniteProjectiveHomotopy +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) + +instance finiteQuotientEvaluationAdditive : (finiteQuotientEvaluation X).Additive := by + rw [Localization.functor_additive_iff (boundedDenominators P).Q (boundedDenominators P)] + exact Functor.additive_of_iso (finiteQuotientEvaluationFactors X).symm + +instance finiteQuotientEvaluationLifting : Localization.Lifting + (boundedDenominators P).Q (boundedDenominators P) + (finiteEvaluation X) (finiteQuotientEvaluation X) := + ⟨finiteQuotientEvaluationFactors X⟩ + +instance finiteQuotientEvaluationShift : (finiteQuotientEvaluation X).CommShift ℤ := + Functor.commShiftOfLocalization (boundedDenominators P).Q (boundedDenominators P) ℤ + (finiteEvaluation X) (finiteQuotientEvaluation X) + +instance finiteQuotientEvaluationFactorsShift : + NatTrans.CommShift (finiteQuotientEvaluationFactors X).hom ℤ := + inferInstanceAs (NatTrans.CommShift + (Localization.Lifting.iso (boundedDenominators P).Q (boundedDenominators P) + (finiteEvaluation X) (finiteQuotientEvaluation X)).hom ℤ) + +instance finiteQuotientEvaluationTriangulated : (finiteQuotientEvaluation X).IsTriangulated := by + have : (boundedDenominators P).Q.mapArrow.EssSurj := + Localization.essSurj_mapArrow (boundedDenominators P).Q (boundedDenominators P) + exact Functor.isTriangulated_of_precomp_iso (finiteQuotientEvaluationFactors X) + +/-- The full subcategory of the canonical derived category represented by bounded +finite-dimensional complexes. Over a field all its terms are projective. -/ +abbrev FiniteVectorDerived := (derivedEmbedding.{u,max u v} k).EssImageSubcategory + +instance derivedToEssImageShift : ((derivedEmbedding.{u,max u v} k).toEssImage).CommShift ℤ := by + dsimp [Functor.toEssImage] + infer_instance +instance derivedToEssImageTriangulated : ((derivedEmbedding.{u,max u v} k).toEssImage).IsTriangulated := by + dsimp [Functor.toEssImage] + infer_instance + +def derivedEvaluation : BoundedK P ⥤ FiniteVectorDerived.{u,v} (k := k) := + finiteEvaluation X ⋙ (derivedEmbedding k).toEssImage + +def derivedQuotientEvaluation : BoundedQ P ⥤ FiniteVectorDerived.{u,v} (k := k) := + finiteQuotientEvaluation X ⋙ (derivedEmbedding k).toEssImage + +def derivedQuotientEvaluationFactors : + (boundedDenominators P).Q ⋙ derivedQuotientEvaluation X ≅ derivedEvaluation X := + (Functor.associator _ _ _).symm ≪≫ + Functor.isoWhiskerRight (finiteQuotientEvaluationFactors X) (derivedEmbedding k).toEssImage + +instance derivedEvaluationShift : (derivedEvaluation X).CommShift ℤ := by + dsimp [derivedEvaluation] + infer_instance +instance derivedEvaluationTriangulated : (derivedEvaluation X).IsTriangulated := by + dsimp [derivedEvaluation] + infer_instance +instance derivedQuotientEvaluationShift : (derivedQuotientEvaluation X).CommShift ℤ := by + dsimp [derivedQuotientEvaluation] + infer_instance +instance derivedQuotientEvaluationTriangulated : + (derivedQuotientEvaluation X).IsTriangulated := by + dsimp [derivedQuotientEvaluation] + infer_instance +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/FiniteEvaluationTarget.lean b/lean/OAI/Algebra/Finitistic/Localization/FiniteEvaluationTarget.lean new file mode 100644 index 0000000000000000000000000000000000000000..86a812af042afcaed4ab0a177c21d113b596d97a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/FiniteEvaluationTarget.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.Finitistic.Localization.LocalizedEvaluationStructure + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.QuadraticEncoding +open FiniteProjectiveHomotopy ThickEvaluation +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] +variable (X : Representation P Y) + +/-- The concrete bounded homotopy category of finite-dimensional vector spaces. -/ +abbrev FiniteVectorHomotopy := K.{u,max u v} k + +theorem finiteEvaluation_property (T : BoundedK P) : + objects k ((boundedEvaluation X).obj T) := by + obtain ⟨hb,hf⟩ := boundedEvaluation_finite X T + refine ⟨hb,fun i => ⟨hf i,?_⟩⟩ + exact ModuleCat.projective_of_categoryTheory_projective _ + +/-- Evaluation with bounded finite-dimensional vector-space complexes as its actual target. -/ +def finiteEvaluation : BoundedK P ⥤ FiniteVectorHomotopy.{u,v} (k := k) := + (objects k).lift (boundedEvaluation X) (finiteEvaluation_property X) + +instance finiteEvaluationAdditive : (finiteEvaluation X).Additive := by + dsimp [finiteEvaluation] + infer_instance +instance finiteEvaluationShift : (finiteEvaluation X).CommShift ℤ := by + dsimp [finiteEvaluation] + infer_instance +instance finiteEvaluationTriangulated : (finiteEvaluation X).IsTriangulated := by + dsimp [finiteEvaluation] + infer_instance + +lemma finiteEvaluation_kills_generators : ∀ T, boundedConeGenerators P T → + IsZero ((finiteEvaluation X).obj T) := by + intro T hT + apply IsZero.of_full_of_faithful_of_isZero (inclusion k) + exact boundedEvaluation_kills_generators X T hT + +/-- The fixed quotient Q evaluates directly into bounded finite-dimensional complexes. -/ +def finiteQuotientEvaluation : BoundedQ P ⥤ FiniteVectorHomotopy.{u,v} (k := k) := + quotientEvaluation (boundedConeGenerators P) (finiteEvaluation X) + (finiteEvaluation_kills_generators X) + +def finiteQuotientEvaluationFactors : + (boundedDenominators P).Q ⋙ finiteQuotientEvaluation X ≅ finiteEvaluation X := + quotientEvaluationFactors (boundedConeGenerators P) (finiteEvaluation X) + (finiteEvaluation_kills_generators X) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/FiniteProjectiveHomotopy.lean b/lean/OAI/Algebra/Finitistic/Localization/FiniteProjectiveHomotopy.lean new file mode 100644 index 0000000000000000000000000000000000000000..1532328d2d7b23f8bf65e22c8ca317129cbf8449 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/FiniteProjectiveHomotopy.lean @@ -0,0 +1,101 @@ +import Mathlib.Algebra.Homology.HomotopyCategory.Plus +import Mathlib.Algebra.Category.ModuleCat.Projective +import Mathlib.Algebra.Category.ModuleCat.Biproducts +import Mathlib.RingTheory.Finiteness.Basic +import Mathlib.RingTheory.Finiteness.Prod + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +open ZeroObject +namespace LittleFinitistic.FiniteProjectiveHomotopy +universe u v +variable (R : Type u) [Ring R] + +/-- Actual bounded complexes of finitely generated projective right/left modules, +according to the chosen scalar ring R. -/ +def ComplexProperty (K : CochainComplex (ModuleCat.{v} R) ℤ) : Prop := + (∃ a b : ℤ, ∀ i, i < a ∨ b < i → IsZero (K.X i)) ∧ + ∀ i, Module.Finite R (K.X i) ∧ Projective (K.X i) + +def objects : ObjectProperty (HomotopyCategory (ModuleCat.{v} R) (.up ℤ)) := + fun T => ComplexProperty R T.as + +@[simp] theorem objects_quotient (K : CochainComplex (ModuleCat.{v} R) ℤ) : + objects R ((HomotopyCategory.quotient _ _).obj K) ↔ ComplexProperty R K := Iff.rfl + +lemma finite_of_iso {M N : ModuleCat.{v} R} (e : M ≅ N) [Module.Finite R M] : Module.Finite R N := + Module.Finite.of_surjective e.toLinearEquiv.toLinearMap e.toLinearEquiv.surjective + +lemma finite_biprod (M N : ModuleCat.{v} R) [Module.Finite R M] [Module.Finite R N] : + Module.Finite R ((M ⊞ N) : ModuleCat R) := + finite_of_iso R (ModuleCat.biprodIsoProd M N).symm + +lemma mappingCone_property {K L : CochainComplex (ModuleCat.{v} R) ℤ} (f : K ⟶ L) + (hK : ComplexProperty R K) (hL : ComplexProperty R L) : + ComplexProperty R (CochainComplex.mappingCone f) := by + obtain ⟨⟨a,b,hbK⟩,hpK⟩ := hK + obtain ⟨⟨c,d,hbL⟩,hpL⟩ := hL + constructor + · refine ⟨min a c - 1,max b d,fun i hi => ?_⟩ + rw [CochainComplex.mappingCone.isZero_X_iff] + exact ⟨hbK (i+1) (by omega),hbL i (by omega)⟩ + · intro i + have := (hpK (i+1)).1 + have := (hpK (i+1)).2 + have := (hpL i).1 + have := (hpL i).2 + let e := HomologicalComplex.homotopyCofiber.XIsoBiprod f i (i+1) rfl + have := finite_biprod R (K.X (i+1)) (L.X i) + exact ⟨finite_of_iso R e.symm, Projective.of_iso e.symm inferInstance⟩ + +lemma finite_projective_of_isZero (M : ModuleCat.{v} R) (h : IsZero M) : + Module.Finite R M ∧ Projective M := by + have := ModuleCat.subsingleton_of_isZero h + exact ⟨inferInstance,h.projective⟩ + +instance objectsZero : (objects.{u,v} R).ContainsZero where + exists_zero := ⟨(HomotopyCategory.quotient _ _).obj 0, + (HomotopyCategory.quotient _ _).map_isZero (isZero_zero _), by + have hz (i : ℤ) : IsZero ((0 : CochainComplex (ModuleCat.{v} R) ℤ).X i) := + (HomologicalComplex.eval _ _ i).map_isZero (isZero_zero _) + exact ⟨⟨0,0,fun i _ => hz i⟩,fun i => finite_projective_of_isZero R _ (hz i)⟩⟩ + +instance objectsShift : (objects.{u,v} R).IsStableUnderShift ℤ where + isStableUnderShiftBy n := + { le_shift T hT := by + obtain ⟨K,rfl⟩ := T.quotient_obj_surjective + rw [ObjectProperty.prop_shift_iff, HomotopyCategory.shift_quotient_obj] + change ComplexProperty R (K⟦n⟧) + obtain ⟨⟨a,b,hb⟩,hp⟩ := hT + constructor + · refine ⟨a-n,b-n,fun i hi => ?_⟩ + change IsZero (K.X (i+n)) + exact hb (i+n) (by omega) + · intro i + exact hp (i+n) } + +instance objectsClosed₃ : (objects.{u,v} R).IsTriangulatedClosed₃ where + ext₃' T hT h₁ h₂ := by + obtain ⟨f : T.obj₁.as ⟶ T.obj₂.as,hf⟩ := (HomotopyCategory.quotient _ _).map_surjective T.mor₁ + refine ⟨(HomotopyCategory.quotient _ _).obj (CochainComplex.mappingCone f), + mappingCone_property R f h₁ h₂, ⟨?_⟩⟩ + exact Triangle.π₃.mapIso (isoTriangleOfIso₁₂ T _ hT + (HomotopyCategory.mappingCone_triangleh_distinguished f) + (Iso.refl _) (Iso.refl _) (by + change T.mor₁ ≫ 𝟙 _ = 𝟙 _ ≫ (HomotopyCategory.quotient _ _).map f + rw [Category.comp_id,Category.id_comp,hf])) + +instance objectsTriangulated : (objects.{u,v} R).IsTriangulated where + toIsTriangulatedClosed₂ := .of_isTriangulatedClosed₃ + +/-- K^b(proj-R), as a full subcategory with actual bounded f.g. projective representatives. -/ +abbrev K := (objects.{u,v} R).FullSubcategory + +/-- Its full and faithful inclusion into the ambient homotopy category. -/ +abbrev inclusion : K.{u,v} R ⥤ HomotopyCategory (ModuleCat.{v} R) (.up ℤ) := (objects R).ι +end LittleFinitistic.FiniteProjectiveHomotopy + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/FiniteSumTransport.lean b/lean/OAI/Algebra/Finitistic/Localization/FiniteSumTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e63a8eb65ade42d7f7a62f88b23472553c4370f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/FiniteSumTransport.lean @@ -0,0 +1,86 @@ +import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Biproducts +import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.FiniteSumTransport +variable {C D E : Type*} [Category C] [Category D] [Category E] + [Preadditive C] [Preadditive D] [Preadditive E] + [HasFiniteBiproducts C] [HasFiniteBiproducts D] +variable (F : C ⥤ E) (G : D ⥤ E) [F.Additive] [G.Additive] +variable {I : Type} [Finite I] (X : I → C) (Y : I → D) +variable (α : ∀ i, F.obj (X i) ≅ G.obj (Y i)) + +def iso : F.obj (⨁ X) ≅ G.obj (⨁ Y) := + F.mapBiproduct X ≪≫ biproduct.mapIso α ≪≫ (G.mapBiproduct Y).symm + +@[reassoc (attr := simp)] +theorem injection (i : I) : + F.map (biproduct.ι X i) ≫ (iso F G X Y α).hom = + (α i).hom ≫ G.map (biproduct.ι Y i) := by + have hi : F.map (biproduct.ι X i) ≫ (F.mapBiproduct X).hom = + biproduct.ι (fun j => F.obj (X j)) i := by + apply (cancel_mono (F.mapBiproduct X).inv).1 + rw [Category.assoc,Iso.hom_inv_id,Category.comp_id] + simp only [Functor.mapBiproduct_inv,biproduct.ι_desc] + simp only [iso,Iso.trans_hom,Iso.symm_hom,← Category.assoc,hi] + simp [biproduct.mapIso_hom] + erw [Category.assoc, biproduct.ι_desc] + rfl + +/-- Coordinate isomorphisms commute with the supplied map from a finite sum. -/ +theorem desc_square {U : C} {V : D} (β : F.obj U ≅ G.obj V) + (f : ∀ i, X i ⟶ U) (g : ∀ i, Y i ⟶ V) + (h : ∀ i, (α i).hom ≫ G.map (g i) = F.map (f i) ≫ β.hom) : + (iso F G X Y α).hom ≫ G.map (biproduct.desc g) = + F.map (biproduct.desc f) ≫ β.hom := by + apply (cancel_epi (F.mapBiproduct X).inv).1 + apply biproduct.hom_ext' + intro i + simp only [Functor.mapBiproduct_inv,biproduct.ι_desc_assoc] + rw [← Category.assoc,injection,Category.assoc,← Functor.map_comp, + biproduct.ι_desc,h] + rw [← Category.assoc,← Functor.map_comp,biproduct.ι_desc] + +@[reassoc (attr := simp)] +theorem projection (i : I) : + (iso F G X Y α).hom ≫ G.map (biproduct.π Y i) = + F.map (biproduct.π X i) ≫ (α i).hom := by + apply (cancel_epi (F.mapBiproduct X).inv).1 + apply biproduct.hom_ext' + intro j + simp only [Functor.mapBiproduct_inv,biproduct.ι_desc_assoc] + rw [← Category.assoc,injection,Category.assoc,← Functor.map_comp, + ← Category.assoc (F.map (biproduct.ι X j)),← Functor.map_comp] + classical + by_cases hji : j=i + · subst j; simp + · simp [hji] + +/-- Entrywise coordinate squares identify the entire supplied finite matrix map. -/ +theorem matrix_square {J : Type} [Finite J] (X' : J → C) (Y' : J → D) + (β : ∀ j, F.obj (X' j) ≅ G.obj (Y' j)) + (f : (⨁ X) ⟶ (⨁ X')) (g : (⨁ Y) ⟶ (⨁ Y')) + (h : ∀ i j, (α i).hom ≫ G.map (biproduct.ι Y i ≫ g ≫ biproduct.π Y' j) = + F.map (biproduct.ι X i ≫ f ≫ biproduct.π X' j) ≫ (β j).hom) : + (iso F G X Y α).hom ≫ G.map g = F.map f ≫ (iso F G X' Y' β).hom := by + apply (cancel_epi (F.mapBiproduct X).inv).1 + apply biproduct.hom_ext' + intro i + simp only [Functor.mapBiproduct_inv,biproduct.ι_desc_assoc] + apply (cancel_mono (G.mapBiproduct Y').hom).1 + apply biproduct.hom_ext + intro j + have hp : (G.mapBiproduct Y').hom ≫ biproduct.π (G.obj ∘ Y') j = + G.map (biproduct.π Y' j) := by + change (biproduct.lift (fun j => G.map (biproduct.π Y' j))) ≫ + biproduct.π (fun j => G.obj (Y' j)) j = _ + exact biproduct.lift_π _ j + simp only [Category.assoc,hp,injection_assoc,projection] + simpa only [Functor.map_comp,Category.assoc] using h i j +end LittleFinitistic.FiniteSumTransport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/FiniteSupportReindex.lean b/lean/OAI/Algebra/Finitistic/Localization/FiniteSupportReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a3f7754e2d732b1bf1a89fbf868738dd1975d67 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/FiniteSupportReindex.lean @@ -0,0 +1,75 @@ +import Mathlib.Algebra.Category.ModuleCat.Basic +import Mathlib.CategoryTheory.Limits.Shapes.ZeroObjects +import Mathlib.LinearAlgebra.Pi + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.FiniteSupportReindex +universe u +variable {R : Type u} [Ring R] +variable (V : ℤ → ModuleCat.{u} R) +variable {l m : ℕ} (p : Fin l → ℤ) (q : Fin m → ℤ) + +/-- Extend a finite family of actual components by zero in every other degree. -/ +def coefficient (n : ℤ) : (∀ i, V (p i)) →ₗ[R] V n := by + classical + exact if h : ∃ i, p i = n then + ((eqToHom (congrArg V h.choose_spec)).hom).comp (LinearMap.proj h.choose) + else 0 + +@[simp] theorem coefficient_at (hp : Function.Injective p) (i : Fin l) (x : ∀ i, V (p i)) : + coefficient V p (p i) x = x i := by + classical + unfold coefficient + split_ifs with h + · have transport (j : Fin l) (hji : j=i) (hpi : p j=p i) : + (eqToHom (congrArg V hpi)).hom (x j) = x i := by + subst j + rfl + exact transport h.choose (hp h.choose_spec) h.choose_spec + · exact False.elim (h ⟨i,rfl⟩) + +theorem coefficient_outside (n : ℤ) (hn : ∀ i, p i ≠ n) : coefficient V p n = 0 := by + classical + exact dite_eq_right (by simpa only [not_exists] using hn) + +/-- Read the same family using another finite set of support degrees. -/ +def reindex : (∀ i, V (p i)) →ₗ[R] (∀ j, V (q j)) := + LinearMap.pi (fun j => coefficient V p (q j)) + +@[simp] theorem reindex_apply (x : ∀ i, V (p i)) (j : Fin m) : + reindex V p q x j = coefficient V p (q j) x := rfl + +theorem coefficient_reindex (hq : Function.Injective q) + (hV : ∀ n, (∀ j, q j ≠ n) → IsZero (V n)) + (n : ℤ) (x : ∀ i, V (p i)) : + coefficient V q n (reindex V p q x) = coefficient V p n x := by + classical + by_cases h : ∃ j, q j=n + · obtain ⟨j,rfl⟩ := h + rw [coefficient_at V q hq,reindex_apply] + · let := ModuleCat.subsingleton_of_isZero (hV n (by simpa only [not_exists] using h)) + exact Subsingleton.elim _ _ + +/-- Changing finite support indices adds or removes only zero terms. The maps +are the actual coordinate inclusions/projections, including all degree transports. -/ +def equivalence (hp : Function.Injective p) (hq : Function.Injective q) + (hVp : ∀ n, (∀ i, p i ≠ n) → IsZero (V n)) + (hVq : ∀ n, (∀ j, q j ≠ n) → IsZero (V n)) : + (∀ i, V (p i)) ≃ₗ[R] (∀ j, V (q j)) where + __ := reindex V p q + invFun := reindex V q p + left_inv x := by + funext i + change coefficient V q (p i) (reindex V p q x) = x i + rw [coefficient_reindex V p q hq hVq,coefficient_at V p hp] + right_inv x := by + funext j + change coefficient V p (q j) (reindex V q p x) = x j + rw [coefficient_reindex V q p hp hVp,coefficient_at V q hq] +end LittleFinitistic.FiniteSupportReindex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/FixedDiagram.lean b/lean/OAI/Algebra/Finitistic/Localization/FixedDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..57ae4fb7620f7e4d4a72e22be9ef2420229cf429 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/FixedDiagram.lean @@ -0,0 +1,57 @@ +import OAI.Algebra.Finitistic.Localization.FormalSummandAction +import OAI.Algebra.Finitistic.Localization.DiagramLifting + +namespace OAI + +namespace LittleFinitistic.FixedDiagram +open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Idempotents +open FormalSummandAction + +variable {k R : Type*} [CommRing k] [Ring R] [Algebra k R] +variable {C Q : Type*} [Category C] [Category Q] [Preadditive C] [Preadditive Q] + [Linear k C] [Linear k Q] + +/-- Algebra relations are the homogeneous quadratic diagram relations under any action. -/ +theorem action_relations {X : Q} (ρ : R →ₐ[k] End X) (na nb nr : ℕ) + (x : Fin na → R) (y : Fin nb → R) (c : Fin nr → Fin na → Fin nb → k) + (hc : ∀ t, ∑ a, ∑ b, c t a b • (y b * x a) = 0) : + ∀ t, ∑ a, ∑ b, c t a b • ((ρ (x a) : X ⟶ X) ≫ ρ (y b)) = 0 := by + intro t + have h := congrArg ρ (hc t) + simpa only [map_sum,map_smul,map_mul,map_zero,End.mul_def] using h + +variable (q : C ⥤ Q) (W : MorphismProperty C) [q.IsLocalization W] + [W.HasRightCalculusOfFractions] [q.Additive] [q.Linear k] +variable [HasShift Q ℤ] [HasZeroObject Q] + [∀ n : ℤ, (shiftFunctor Q n).Additive] [Pretriangulated Q] + [∀ n : ℤ, (shiftFunctor Q n).Linear k] +local instance : HasFiniteBiproducts (Karoubi Q) := Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi Q) := + hasBinaryBiproducts_of_finite_biproducts (Karoubi Q) + +include W in +/-- Fixed source-category objects and arrows, with every quadratic relation exact, +represent the odd double of the selecting action in the localization. -/ +theorem fixed_diagram {L : Q} (θ : R →ₐ[k] End L) + (e : R) (he : e*e=e) (hec : ∀ r : R, e*r=r*e) (α : R →ₐ[k] R) + (na nb nr : ℕ) (x : Fin na → R) (y : Fin nb → R) + (c : Fin nr → Fin na → Fin nb → k) + (hc : ∀ t, ∑ a, ∑ b, c t a b • (y b * x a) = 0) : + ∃ (V₀ : Q) (ρ₀ : R →ₐ[k] End V₀) + (i : (toKaroubi Q).obj V₀ ≅ + summand θ e he ⊞ OddDouble.formalShift (summand θ e he) 3) + (D₀ D₁ D₂ : C) (φ₀ : q.obj D₀ ≅ V₀) (φ₁ : q.obj D₁ ≅ V₀) + (φ₂ : q.obj D₂ ≅ V₀) (f : Fin na → (D₀ ⟶ D₁)) (g : Fin nb → (D₁ ⟶ D₂)), + (∀ r : R, (toKaroubi Q).map (ρ₀ r) ≫ i.hom = + i.hom ≫ oddDoubleAction θ e he hec α r) ∧ + (∀ a, q.map (f a) ≫ φ₁.hom = φ₀.hom ≫ ρ₀ (x a)) ∧ + (∀ b, q.map (g b) ≫ φ₂.hom = φ₁.hom ≫ ρ₀ (y b)) ∧ + (∀ t, ∑ a, ∑ b, c t a b • (f a ≫ g b) = 0) := by + obtain ⟨V₀,ρ₀,i,hi⟩ := fixed_old_object_with_action θ e he hec α + obtain ⟨D₀,D₁,D₂,φ₀,φ₁,φ₂,f,g,hf,hg,hrel⟩ := + DiagramLifting.finite_quadratic_diagram_lifting q W na nb nr V₀ V₀ V₀ + (fun a => ρ₀ (x a)) (fun b => ρ₀ (y b)) c (action_relations ρ₀ na nb nr x y c hc) + exact ⟨V₀,ρ₀,i,D₀,D₁,D₂,φ₀,φ₁,φ₂,f,g,hi,hf,hg,hrel⟩ +end LittleFinitistic.FixedDiagram + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/FormalSummandAction.lean b/lean/OAI/Algebra/Finitistic/Localization/FormalSummandAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..d76e0f8488f1fa2db1c1097afe058bd7829de0c2 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/FormalSummandAction.lean @@ -0,0 +1,185 @@ +import Mathlib.Algebra.Algebra.Hom +import OAI.Algebra.Finitistic.Localization.OddDouble + +namespace OAI + +open CategoryTheory CategoryTheory.Category CategoryTheory.Preadditive +open CategoryTheory.Idempotents CategoryTheory.Limits + +namespace LittleFinitistic.FormalSummandAction + +universe u v w +variable {k : Type w} [CommRing k] +variable {C : Type u} [Category.{v} C] [Preadditive C] [Linear k C] + +instance karoubiHomSMul (P Q : Karoubi C) : SMul k (P ⟶ Q) where + smul r f := ⟨r • f.f, by rw [Linear.smul_comp,Linear.comp_smul,f.comm]⟩ + +@[simp] theorem smul_f (P Q : Karoubi C) (r : k) (f : P ⟶ Q) : + (r • f).f = r • f.f := rfl + +instance karoubiHomModule (P Q : Karoubi C) : Module k (P ⟶ Q) := + Function.Injective.module k (Karoubi.inclusionHom P Q) + (fun _ _ h => Karoubi.hom_ext _ _ h) (fun _ _ => rfl) + +instance karoubiLinear : Linear k (Karoubi C) where + smul_comp _ _ _ _ _ _ := by apply Karoubi.hom_ext; exact Linear.smul_comp _ _ _ _ _ _ + comp_smul _ _ _ _ _ _ := by apply Karoubi.hom_ext; exact Linear.comp_smul _ _ _ _ _ _ + +instance toKaroubiLinear : (toKaroubi C).Linear k where + map_smul := by intros; rfl + +variable {R : Type*} [Ring R] [Algebra k R] +variable {L : C} (θ : R →ₐ[k] End L) (e : R) (he : e * e = e) + +/-- The formal image of the central selecting idempotent. -/ +def summand : Karoubi C := + ⟨L,θ e,by change θ e * θ e = θ e; rw [← map_mul,he]⟩ + +variable (hc : ∀ r : R, e * r = r * e) + +include he hc in +lemma sandwich (r : R) : e * r * e = e * r := by + calc + e * r * e = e * e * r := by rw [mul_assoc,← hc r,← mul_assoc] + _ = e * r := by rw [he] + +include he hc in +lemma compressed_mul (r s : R) : (e*r)*(e*s) = e*(r*s) := by + rw [← mul_assoc,sandwich e he hc,mul_assoc] + +/-- The action on the formal summand, with restriction along alpha. -/ +def action (α : R →ₐ[k] R) : R →ₐ[k] End (summand θ e he) where + toFun r := ⟨θ (e * α r),by + change θ e ≫ θ (e * α r) ≫ θ e = θ (e * α r) + change (θ e * θ (e * α r)) * θ e = θ (e * α r) + rw [← map_mul,← map_mul] + congr 1 + rw [← mul_assoc e e,he,sandwich e he hc]⟩ + map_one' := by apply Karoubi.hom_ext; change θ (e * α 1) = θ e; rw [map_one,mul_one] + map_mul' r s := by + apply Karoubi.hom_ext + change θ (e * α (r*s)) = θ (e * α r) * θ (e * α s) + rw [← map_mul θ,map_mul α,compressed_mul e he hc] + map_zero' := by apply Karoubi.hom_ext; change θ (e * α 0) = 0; simp + map_add' r s := by apply Karoubi.hom_ext; change θ (e * α (r+s)) = θ (e * α r) + θ (e * α s); simp [mul_add] + commutes' r := by + apply Karoubi.hom_ext + change θ (e * α (algebraMap k R r)) = (algebraMap k (End (summand θ e he)) r).f + rw [α.commutes] + change θ (e * algebraMap k R r) = (r • (𝟙 (summand θ e he))).f + rw [smul_f] + change θ (e * algebraMap k R r) = r • θ e + rw [hc,Algebra.algebraMap_eq_smul_one,smul_mul_assoc,one_mul,map_smul] + +@[simp] theorem action_f (α : R →ₐ[k] R) (r : R) : + ((action θ e he hc α r) : End (summand θ e he)).f = θ (e * α r * e) := by + rw [sandwich e he hc] + rfl + +variable {D : Type*} [Category D] [Preadditive D] [Linear k D] + +/-- A linear functor transports an algebra action on endomorphisms. -/ +def mapAction (F : C ⥤ D) [F.Additive] [F.Linear k] {X : C} + (ρ : R →ₐ[k] End X) : R →ₐ[k] End (F.obj X) where + toFun r := F.map (ρ r) + map_one' := by simp + map_mul' r s := by simp [End.mul_def] + map_zero' := by simp + map_add' r s := by rw [map_add]; exact F.map_add + commutes' r := by + rw [ρ.commutes] + change F.map (r • (𝟙 X)) = r • (𝟙 (F.obj X)) + rw [Functor.map_smul,F.map_id] + +/-- Direct sum of two actions of the same algebra. -/ +noncomputable def biprodAction [HasBinaryBiproducts C] {X Y : C} + (ρ : R →ₐ[k] End X) (σ : R →ₐ[k] End Y) : R →ₐ[k] End (X ⊞ Y) where + toFun r := biprod.map (ρ r) (σ r) + map_one' := by apply biprod.hom_ext <;> simp + map_mul' r s := by apply biprod.hom_ext <;> simp [End.mul_def] + map_zero' := by apply biprod.hom_ext <;> simp + map_add' r s := by + rw [map_add,map_add] + change biprod.map ((ρ r : X ⟶ X) + (ρ s : X ⟶ X)) + ((σ r : Y ⟶ Y) + (σ s : Y ⟶ Y)) = + (biprod.map (ρ r) (σ r) : X ⊞ Y ⟶ X ⊞ Y) + biprod.map (ρ s) (σ s) + apply biprod.hom_ext <;> simp only [biprod.map_fst,biprod.map_snd, + Preadditive.add_comp] + all_goals exact Preadditive.comp_add _ _ _ _ _ _ + commutes' r := by + rw [ρ.commutes,σ.commutes] + change biprod.map (r • (𝟙 X)) (r • (𝟙 Y)) = r • (𝟙 (X ⊞ Y)) + apply biprod.hom_ext <;> simp + +/-- Conjugating an action along an isomorphism. -/ +def transportAction {X Y : C} (i : X ≅ Y) (ρ : R →ₐ[k] End Y) : + R →ₐ[k] End X where + toFun r := i.hom ≫ ρ r ≫ i.inv + map_one' := by simp + map_mul' r s := by simp [End.mul_def] + map_zero' := by simp + map_add' r s := by + rw [map_add] + change i.hom ≫ ((ρ r : Y ⟶ Y) + (ρ s : Y ⟶ Y)) ≫ i.inv = _ + rw [add_comp,comp_add] + commutes' r := by + rw [ρ.commutes] + change i.hom ≫ (r • (𝟙 Y)) ≫ i.inv = r • (𝟙 X) + simp + +/-- An action on an old object in the completion is an actual old action. -/ +def oldAction {X : C} (ρ : R →ₐ[k] End ((toKaroubi C).obj X)) : + R →ₐ[k] End X where + toFun r := (ρ r).f + map_one' := by rw [map_one]; rfl + map_mul' r s := by rw [map_mul]; rfl + map_zero' := by rw [map_zero]; rfl + map_add' r s := by rw [map_add]; rfl + commutes' r := by rw [ρ.commutes]; rfl + +@[simp] theorem oldAction_lift {X : C} (ρ : R →ₐ[k] End ((toKaroubi C).obj X)) + (r : R) : (toKaroubi C).map (oldAction ρ r) = ρ r := by + apply Karoubi.hom_ext + rfl + +variable [HasShift C ℤ] [HasZeroObject C] + [∀ n : ℤ, (shiftFunctor C n).Additive] [Pretriangulated C] + [∀ n : ℤ, (shiftFunctor C n).Linear k] + +instance formalShiftLinear (n : ℤ) : + (OddDouble.formalShiftFunctor (C := C) n).Linear k where + map_smul := by + intro X Y f r + apply Karoubi.hom_ext + exact Functor.map_smul (shiftFunctor C n) r f.f + +local instance : HasFiniteBiproducts (Karoubi C) := Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi C) := + hasBinaryBiproducts_of_finite_biproducts (Karoubi C) + +/-- The selecting action on the odd double. -/ +noncomputable def oddDoubleAction (α : R →ₐ[k] R) : + R →ₐ[k] End (summand θ e he ⊞ OddDouble.formalShift (summand θ e he) 3) := + biprodAction (action θ e he hc α) + (mapAction (OddDouble.formalShiftFunctor 3) (action θ e he hc α)) + +/-- The object and its unital action are both chosen before any evaluation module. -/ +theorem fixed_old_object_with_action (α : R →ₐ[k] R) : + ∃ (V₀ : C) (ρ₀ : R →ₐ[k] End V₀) + (i : (toKaroubi C).obj V₀ ≅ + summand θ e he ⊞ OddDouble.formalShift (summand θ e he) 3), + ∀ r : R, (toKaroubi C).map (ρ₀ r) ≫ i.hom = + i.hom ≫ oddDoubleAction θ e he hc α r := by + obtain ⟨V₀,⟨i⟩⟩ := OddDouble.odd_double_three (summand θ e he) + let σ := oddDoubleAction θ e he hc α + let τ := transportAction i σ + refine ⟨V₀,oldAction τ,i,?_⟩ + intro r + rw [oldAction_lift] + change (i.hom ≫ σ r ≫ i.inv) ≫ i.hom = i.hom ≫ σ r + simp + +end LittleFinitistic.FormalSummandAction + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/HomotopyEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/HomotopyEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c3eb364f0c58964c5f2f1decde7212ef26a6ce7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/HomotopyEvaluation.lean @@ -0,0 +1,28 @@ +import OAI.Algebra.Finitistic.Localization.TensorEvaluationFunctor +import Mathlib.Algebra.Category.ModuleCat.Abelian +import Mathlib.Algebra.Homology.HomotopyCategory.Pretriangulated + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BalancedTensor +universe u v w z +variable (k : Type u) [Field k] (A : Type v) [Ring A] [Algebra k A] +variable (N : Type z) [AddCommGroup N] [Module k N] [Module A N] + +/-- Termwise tensor evaluation on actual complexes, descended through chain homotopies. -/ +def homotopyEvaluation : + HomotopyCategory (ModuleCat.{w} Aᵐᵒᵖ) (ComplexShape.up ℤ) ⥤ + HomotopyCategory (ModuleCat.{max w z} k) (ComplexShape.up ℤ) := + (tensorFunctor k A N).mapHomotopyCategory (ComplexShape.up ℤ) + +instance homotopyEvaluationShift : (homotopyEvaluation.{u,v,w,z} k A N).CommShift ℤ := + inferInstanceAs (((tensorFunctor.{u,v,w,z} k A N).mapHomotopyCategory (ComplexShape.up ℤ)).CommShift ℤ) + +instance homotopyEvaluationTriangulated : (homotopyEvaluation.{u,v,w,z} k A N).IsTriangulated := + inferInstanceAs (((tensorFunctor.{u,v,w,z} k A N).mapHomotopyCategory (ComplexShape.up ℤ)).IsTriangulated) +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/HomotopyVertexEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/HomotopyVertexEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed2bfab4b62ffd935111ad3947e6126d1e432853 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/HomotopyVertexEvaluation.lean @@ -0,0 +1,125 @@ +import OAI.Algebra.Finitistic.Localization.QuotientRelations +import Mathlib.Algebra.Module.ULift + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.QuadraticEncoding +open BalancedTensor FiniteProjectiveHomotopy +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +abbrev liftedY := ULift.{u} Y + +def liftedVertexEquiv (i : Fin 3) : + (tensorFunctor k (B P) X.Evaluation).obj (vertexModule P i) ≃ₗ[k] ULift.{u} Y := + (evaluationVertexEquiv X i).trans ULift.moduleEquiv.symm + +def actionArrow (h : Fin (d+1)) : ModuleCat.of k (ULift.{u} Y) ⟶ ModuleCat.of k (ULift.{u} Y) := + ModuleCat.ofHom (ULift.moduleEquiv.symm.toLinearMap.comp + ((Fin.cases (motive := fun _ => Module.End k Y) 1 X.generator h).comp + ULift.moduleEquiv.toLinearMap)) + +lemma tensor_arrow01_square (h : Fin (d+1)) : + (tensorFunctor k (B P) X.Evaluation).map (arrowModule01 P h) ≫ + (liftedVertexEquiv X 1).toModuleIso.hom = + (liftedVertexEquiv X 0).toModuleIso.hom ≫ actionArrow X h := by + ext z + have h := evaluation_arrow01 X h (evaluationVertexEquiv X 0 z) + simpa [liftedVertexEquiv, actionArrow] using h + +lemma tensor_arrow12_square (h : Fin (d+1)) : + (tensorFunctor k (B P) X.Evaluation).map (arrowModule12 P h) ≫ + (liftedVertexEquiv X 2).toModuleIso.hom = + (liftedVertexEquiv X 1).toModuleIso.hom ≫ actionArrow X h := by + ext z + have h := evaluation_arrow12 X h (evaluationVertexEquiv X 1 z) + simpa [liftedVertexEquiv, actionArrow] using h + +abbrev vectorStalk := HomotopyCategory.singleFunctor (ModuleCat.{max u v} k) 0 + +/-- Evaluation of each concrete degree-zero vertex object is the stalk complex Y. -/ +def homotopyVertexIso (i : Fin 3) : + (boundedEvaluation X).obj (vertexK P i) ≅ (vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y)) := + (HomotopyCategory.quotient _ _).mapIso + ((HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).app (vertexModule P i)) ≪≫ + (vectorStalk (k := k)).mapIso (liftedVertexEquiv X i).toModuleIso + +lemma homotopy_arrow01_square (h : Fin (d+1)) : + (boundedEvaluation X).map (arrowK01 P h) ≫ (homotopyVertexIso X 1).hom = + (homotopyVertexIso X 0).hom ≫ (vectorStalk (k := k)).map (actionArrow X h) := by + change (homotopyEvaluation k (B P) X.Evaluation).map + ((inclusion (B P)ᵐᵒᵖ).map (arrowK01 P h)) ≫ _ = _ + unfold arrowK01 + erw [Functor.map_preimage] + change ((tensorFunctor k (B P) X.Evaluation).mapHomotopyCategory (.up ℤ)).map + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule01 P h))) ≫ + ((HomotopyCategory.quotient _ _).map + ((HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.app (vertexModule P 1)) ≫ + (HomotopyCategory.quotient _ _).map + ((HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map (liftedVertexEquiv X 1).toModuleIso.hom)) = + ((HomotopyCategory.quotient _ _).map + ((HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.app (vertexModule P 0)) ≫ + (HomotopyCategory.quotient _ _).map + ((HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map (liftedVertexEquiv X 0).toModuleIso.hom)) ≫ + (HomotopyCategory.quotient _ _).map + ((HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map (actionArrow X h)) + simp only [Functor.mapHomotopyCategory_map] + have hn := (HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.naturality (arrowModule01 P h) + have hm := congrArg (fun f => (HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map f) + (tensor_arrow01_square X h) + simp only [Functor.map_comp] at hm + have hc := (congrArg (fun f => f ≫ + (HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map + (liftedVertexEquiv X 1).toModuleIso.hom) hn).trans (by + simpa only [Category.assoc, Functor.comp_map, degreeZero] using congrArg (fun f => + (HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.app (vertexModule P 0) ≫ f) hm) + simpa only [Functor.map_comp, Category.assoc, Functor.comp_map, degreeZero] using + congrArg (fun f => (HomotopyCategory.quotient (ModuleCat.{max u v} k) (.up ℤ)).map f) hc + +lemma homotopy_arrow12_square (h : Fin (d+1)) : + (boundedEvaluation X).map (arrowK12 P h) ≫ (homotopyVertexIso X 2).hom = + (homotopyVertexIso X 1).hom ≫ (vectorStalk (k := k)).map (actionArrow X h) := by + change (homotopyEvaluation k (B P) X.Evaluation).map + ((inclusion (B P)ᵐᵒᵖ).map (arrowK12 P h)) ≫ _ = _ + unfold arrowK12 + erw [Functor.map_preimage] + change ((tensorFunctor k (B P) X.Evaluation).mapHomotopyCategory (.up ℤ)).map + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map (arrowModule12 P h))) ≫ + ((HomotopyCategory.quotient _ _).map + ((HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.app (vertexModule P 2)) ≫ + (HomotopyCategory.quotient _ _).map + ((HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map (liftedVertexEquiv X 2).toModuleIso.hom)) = + ((HomotopyCategory.quotient _ _).map + ((HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.app (vertexModule P 1)) ≫ + (HomotopyCategory.quotient _ _).map + ((HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map (liftedVertexEquiv X 1).toModuleIso.hom)) ≫ + (HomotopyCategory.quotient _ _).map + ((HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map (actionArrow X h)) + simp only [Functor.mapHomotopyCategory_map] + have hn := (HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.naturality (arrowModule12 P h) + have hm := congrArg (fun f => (HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map f) + (tensor_arrow12_square X h) + simp only [Functor.map_comp] at hm + have hc := (congrArg (fun f => f ≫ + (HomologicalComplex.single (ModuleCat.{max u v} k) (.up ℤ) (0 : ℤ)).map + (liftedVertexEquiv X 2).toModuleIso.hom) hn).trans (by + simpa only [Category.assoc, Functor.comp_map, degreeZero] using congrArg (fun f => + (HomologicalComplex.singleMapHomologicalComplex + (tensorFunctor k (B P) X.Evaluation) (.up ℤ) (0 : ℤ)).hom.app (vertexModule P 1) ≫ f) hm) + simpa only [Functor.map_comp, Category.assoc, Functor.comp_map, degreeZero] using + congrArg (fun f => (HomotopyCategory.quotient (ModuleCat.{max u v} k) (.up ℤ)).map f) hc +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/IdempotentImageEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/IdempotentImageEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e28b45b4d5acd724e948d0c1de8d37e43adea33 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/IdempotentImageEvaluation.lean @@ -0,0 +1,85 @@ +import OAI.Algebra.Finitistic.Localization.KaroubiEvaluation +import OAI.Algebra.Finitistic.Localization.DerivedActionCompatibility + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.QuadraticEncoding +universe u v w z +section Image +variable {k : Type u} [Field k] {V : Type v} [AddCommGroup V] [Module k V] +variable (p : Module.End k V) (hp : p*p=p) + +def imageProjection : ModuleCat.of k V ⟶ ModuleCat.of k (LinearMap.range p) := + ModuleCat.ofHom p.rangeRestrict + +def imageInclusion : ModuleCat.of k (LinearMap.range p) ⟶ ModuleCat.of k V := + ModuleCat.ofHom (LinearMap.range p).subtype + +lemma image_projection_inclusion : imageProjection p ≫ imageInclusion p = ModuleCat.ofHom p := rfl +include hp in +lemma image_inclusion_projection : imageInclusion p ≫ imageProjection p = 𝟙 _ := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + obtain ⟨y,hy⟩ := x.property + change p x.val = x.val + rw [← hy] + exact LinearMap.congr_fun hp y + +variable {D : Type w} [Category.{z} D] (F : ModuleCat.{v} k ⥤ D) + +/-- A functor takes a concrete linear idempotent's formal image to the actual image module. -/ +def linearImageKaroubiIso : + (⟨F.obj (ModuleCat.of k V), F.map (ModuleCat.ofHom p), by + rw [← F.map_comp] + congr 1 + exact congrArg ModuleCat.ofHom hp⟩ : Karoubi D) ≅ + (toKaroubi D).obj (F.obj (ModuleCat.of k (LinearMap.range p))) := + splitKaroubiIso _ _ (F.map (imageProjection p)) (F.map (imageInclusion p)) + (by rw [← F.map_comp, image_projection_inclusion]) + (by rw [← F.map_comp, image_inclusion_projection p hp, F.map_id]) +end Image + +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) +variable (r : PresentedAlgebra P) (hr : r*r=r) + +/-- The actual image eY, represented in the same universe as tensor evaluation. -/ +def evaluatedImage := LinearMap.range ((liftedEndHom (givenAction X r)).hom) + +include hr in +lemma lifted_action_idempotent : + (liftedEndHom (givenAction X r)).hom * (liftedEndHom (givenAction X r)).hom = + (liftedEndHom (givenAction X r)).hom := by + have h := congrArg (fun a => (liftedEndHom (givenAction X a)).hom) hr + simp only [map_mul] at h + exact h + +/-- The formal evaluated summand is the stalk of the concrete image of the action. -/ +def stalkSummandImageIso : stalkSummand X r hr ≅ + (toKaroubi _).obj ((vectorStalk (k := k)).obj (ModuleCat.of k (evaluatedImage X r))) := by + let e := linearImageKaroubiIso ((liftedEndHom (givenAction X r)).hom) + (lifted_action_idempotent X r hr) (vectorStalk (k := k)) + dsimp [stalkSummand, givenStalkAction, identifiedEndHom, evaluatedImage] at e ⊢ + exact e + +/-- Section 3: evaluation sends the formal quotient summand U to eY. -/ +def quotientSummandImageIso : (karoubiEvaluation X).obj (quotientSummand r hr) ≅ + (toKaroubi _).obj ((vectorStalk (k := k)).obj (ModuleCat.of k (evaluatedImage X r))) := + evaluatedSummandIso X r hr ≪≫ stalkSummandImageIso X r hr + +instance evaluatedImageFinite [FiniteDimensional k Y] : FiniteDimensional k (evaluatedImage X r) := by + have : FiniteDimensional k (ULift.{u} Y) := + Module.Finite.of_injective (ULift.moduleEquiv : ULift.{u} Y ≃ₗ[k] Y).toLinearMap + ULift.moduleEquiv.injective + let p : Module.End k (ULift.{u} Y) := (liftedEndHom (givenAction X r)).hom + have hp : FiniteDimensional k p.range := inferInstance + exact hp +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/IntegerExtensionFunctor.lean b/lean/OAI/Algebra/Finitistic/Localization/IntegerExtensionFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d01864a1219ba5b2c6701a4aa751b63d8c0a619 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/IntegerExtensionFunctor.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Finitistic.Bar.IntegerDerivedMultibar + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.IntegerExtensionFunctor +universe u +variable {B : Type u} [Ring B] +variable (F : ModuleCat.{u} B ⥤ ModuleCat.{u} B) [F.Additive] +variable (Z : ChainComplex (ModuleCat.{u} B) ℕ) +local notation "c" => ComplexShape.down ℕ +local notation "e" => ComplexShape.embeddingDownNat + +/-- Additive functors preserve the zero components added by integer extension. -/ +def termIso : (o : Option ℕ) → F.obj (HomologicalComplex.extend.X Z o) ≅ + HomologicalComplex.extend.X ((F.mapHomologicalComplex c).obj Z) o + | none => (F.map_isZero (isZero_zero _)).iso (isZero_zero _) + | some _ => Iso.refl _ + +theorem termIso_d (o o' : Option ℕ) : + (termIso F Z o).hom ≫ HomologicalComplex.extend.d ((F.mapHomologicalComplex c).obj Z) o o' = + F.map (HomologicalComplex.extend.d Z o o') ≫ (termIso F Z o').hom := by + cases o <;> cases o' <;> + simp [termIso,HomologicalComplex.extend.d,HomologicalComplex.extend.X] <;> + erw [Functor.map_zero] <;> (try erw [comp_zero]) <;> (try erw [zero_comp]) + +/-- Applying an additive module functor commutes with the actual n ↦ -n zero extension. -/ +def complexIso : (F.mapHomologicalComplex (.up ℤ)).obj ((DerivedBar.integerExtension B).obj Z) ≅ + (DerivedBar.integerExtension B).obj ((F.mapHomologicalComplex c).obj Z) := + HomologicalComplex.Hom.isoOfComponents (fun n => termIso F Z (ComplexShape.embeddingDownNat.r n)) + (by intro n m h; exact termIso_d F Z (ComplexShape.embeddingDownNat.r n) (ComplexShape.embeddingDownNat.r m)) + +variable {Z} {Z' : ChainComplex (ModuleCat.{u} B) ℕ} +theorem termIso_natural (f : Z ⟶ Z') (o : Option ℕ) : + F.map (HomologicalComplex.extend.mapX f o) ≫ (termIso F Z' o).hom = + (termIso F Z o).hom ≫ + HomologicalComplex.extend.mapX ((F.mapHomologicalComplex c).map f) o := by + cases o <;> simp [termIso,HomologicalComplex.extend.mapX,HomologicalComplex.extend.X] + erw [Functor.map_zero,comp_zero,zero_comp] + +/-- Naturality holds on every chain map, including the added zero degrees. -/ +def naturalIso : DerivedBar.integerExtension B ⋙ F.mapHomologicalComplex (.up ℤ) ≅ + F.mapHomologicalComplex c ⋙ DerivedBar.integerExtension B := + NatIso.ofComponents (complexIso F) (by + intro Z Z' f + apply HomologicalComplex.Hom.ext + funext n + exact termIso_natural F f (ComplexShape.embeddingDownNat.r n)) +end LittleFinitistic.IntegerExtensionFunctor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/KaroubiEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/KaroubiEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..963a7782e80b4605950bc011171246991c5adb8d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/KaroubiEvaluation.lean @@ -0,0 +1,71 @@ +import OAI.Algebra.Finitistic.Localization.ModuleActionCompatibility +import Mathlib.CategoryTheory.Idempotents.FunctorExtension + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +namespace LittleFinitistic.QuadraticEncoding +universe u v w +section General +variable {C : Type u} [Category.{v} C] + +/-- An actual splitting realizes the corresponding formal Karoubi object. -/ +def splitKaroubiIso {A I : C} (p : A ⟶ A) (hp : p ≫ p = p) + (π : A ⟶ I) (ι : I ⟶ A) (hπι : π ≫ ι = p) (hιπ : ι ≫ π = 𝟙 I) : + (⟨A,p,hp⟩ : Karoubi C) ≅ (toKaroubi C).obj I where + hom := ⟨π, by simp only [toKaroubi_obj_p]; rw [← hπι]; simp [Category.assoc,hιπ]⟩ + inv := ⟨ι, by simp only [toKaroubi_obj_p]; rw [← hπι]; simp [← Category.assoc,hιπ]⟩ + hom_inv_id := by ext; exact hπι + inv_hom_id := by ext; exact hιπ + +/-- An isomorphism commuting with idempotents identifies their formal summands. -/ +def transportKaroubiIso (A B : Karoubi C) (e : A.X ≅ B.X) + (h : A.p ≫ e.hom = e.hom ≫ B.p) : A ≅ B where + hom := ⟨A.p ≫ e.hom, by + simp only [← Category.assoc, A.idem] + rw [h, Category.assoc, B.idem]⟩ + inv := ⟨e.inv ≫ A.p, by + have hi : B.p ≫ e.inv = e.inv ≫ A.p := by + apply (cancel_mono e.hom).mp + simpa [Category.assoc] using congrArg (fun f => e.inv ≫ f) h.symm + simp [← hi, Category.assoc]⟩ + hom_inv_id := by ext; simp [Category.assoc] + inv_hom_id := by + ext + simp only [Karoubi.comp_f, Karoubi.id_f, Category.assoc] + rw [← Category.assoc A.p A.p, A.idem, h] + simp +end General + +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +def karoubiEvaluation : Karoubi (BoundedQ P) ⥤ + Karoubi (HomotopyCategory (ModuleCat.{max u v} k) (.up ℤ)) := + (functorExtension₂ _ _).obj (boundedQuotientEvaluation X) + +def quotientSummand (r : PresentedAlgebra P) (hr : r*r=r) : Karoubi (BoundedQ P) := + ⟨vertexQ P 0, quotientAction P r, by + change (quotientAction P r) * (quotientAction P r) = quotientAction P r + rw [← map_mul, hr]⟩ + +def stalkSummand (r : PresentedAlgebra P) (hr : r*r=r) : + Karoubi (HomotopyCategory (ModuleCat.{max u v} k) (.up ℤ)) := + ⟨(vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y)), + givenStalkAction X r, by + change (givenStalkAction X r) * (givenStalkAction X r) = givenStalkAction X r + rw [← map_mul, hr]⟩ + +/-- The evaluated formal summand has precisely the idempotent induced by r on Y. -/ +def evaluatedSummandIso (r : PresentedAlgebra P) (hr : r*r=r) : + (karoubiEvaluation X).obj (quotientSummand r hr) ≅ stalkSummand X r hr := + transportKaroubiIso _ _ (quotientVertexIso X 0) (by + change (boundedQuotientEvaluation X).map (quotientAction P r) ≫ + (quotientVertexIso X 0).hom = (quotientVertexIso X 0).hom ≫ + (𝟙 _ ≫ (vectorStalk (k := k)).map (liftedEndHom (givenAction X r)) ≫ 𝟙 _) + simpa using quotientAction_square X r) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/LocalizedEvaluationStructure.lean b/lean/OAI/Algebra/Finitistic/Localization/LocalizedEvaluationStructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..72bfeec847afd753a423414fd16e295db4801776 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/LocalizedEvaluationStructure.lean @@ -0,0 +1,43 @@ +import OAI.Algebra.Finitistic.Localization.BoundedQuotientEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.QuadraticEncoding +open ThickEvaluation +universe u v +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The constructed quotient carries its canonical triangulated structure. -/ +theorem boundedQ_triangulated : IsTriangulated (BoundedQ P) := inferInstance + +variable {P} {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +instance quotientEvaluationAdditive : (boundedQuotientEvaluation X).Additive := by + rw [Localization.functor_additive_iff (boundedDenominators P).Q (boundedDenominators P)] + exact Functor.additive_of_iso (boundedQuotientEvaluationFactors X).symm + +instance quotientEvaluationLifting : Localization.Lifting + (boundedDenominators P).Q (boundedDenominators P) + (boundedEvaluation X) (boundedQuotientEvaluation X) := + ⟨boundedQuotientEvaluationFactors X⟩ + +instance quotientEvaluationShift : (boundedQuotientEvaluation X).CommShift ℤ := + Functor.commShiftOfLocalization (boundedDenominators P).Q (boundedDenominators P) ℤ + (boundedEvaluation X) (boundedQuotientEvaluation X) + +instance quotientEvaluationFactorsShift : + NatTrans.CommShift (boundedQuotientEvaluationFactors X).hom ℤ := + inferInstanceAs (NatTrans.CommShift + (Localization.Lifting.iso (boundedDenominators P).Q (boundedDenominators P) + (boundedEvaluation X) (boundedQuotientEvaluation X)).hom ℤ) + +instance quotientEvaluationTriangulated : (boundedQuotientEvaluation X).IsTriangulated := by + have : (boundedDenominators P).Q.mapArrow.EssSurj := + Localization.essSurj_mapArrow (boundedDenominators P).Q (boundedDenominators P) + exact Functor.isTriangulated_of_precomp_iso (boundedQuotientEvaluationFactors X) +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ModuleActionCompatibility.lean b/lean/OAI/Algebra/Finitistic/Localization/ModuleActionCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ad3e0678bd18a0ded63eb73259c9f305fed9f6e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ModuleActionCompatibility.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Finitistic.Localization.PresentedActionCompatibility + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.QuadraticEncoding +universe u v w +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +theorem quotientAction_square (r : PresentedAlgebra P) : + (boundedQuotientEvaluation X).map (quotientAction P r) ≫ (quotientVertexIso X 0).hom = + (quotientVertexIso X 0).hom ≫ (vectorStalk (k := k)).map + (liftedEndHom (givenAction X r)) := by + have h := congrArg (fun f => (quotientVertexIso X 0).hom ≫ f) + (AlgHom.congr_fun (quotientAction_evaluates X) r) + change (quotientVertexIso X 0).hom ≫ ((quotientVertexIso X 0).inv ≫ + (boundedQuotientEvaluation X).map (quotientAction P r) ≫ (quotientVertexIso X 0).hom) = + (quotientVertexIso X 0).hom ≫ (𝟙 _ ≫ (vectorStalk (k := k)).map + (liftedEndHom (givenAction X r)) ≫ 𝟙 _) at h + simpa only [← Category.assoc, Iso.hom_inv_id, Category.id_comp, Category.comp_id] using h + +variable {R : Type w} [Ring R] [Algebra k R] +variable (e : PresentedAlgebra P ≃ₐ[k] R) + +def presentationRepresentation [Module R Y] [IsScalarTower k R Y] : Representation P Y := + Representation.ofAction (presentedGenerator P) (presentedGenerator_satisfies P) + ((Algebra.lsmul k k Y).comp e.toAlgHom) + +lemma presentationRepresentation_givenAction [Module R Y] [IsScalarTower k R Y] : + givenAction (presentationRepresentation (Y := Y) e) = + (Algebra.lsmul k k Y).comp e.toAlgHom := by + apply RingQuot.ringQuot_ext' + apply FreeAlgebra.hom_ext + funext h + exact presentationLift_generator P _ _ h + +/-- For a genuinely presented algebra R, every element of theta evaluates to its R-module action. -/ +theorem module_quotientAction_square [Module R Y] [IsScalarTower k R Y] (r : R) : + (boundedQuotientEvaluation (presentationRepresentation (Y := Y) e)).map + (quotientActionOfPresentation P e r) ≫ + (quotientVertexIso (presentationRepresentation (Y := Y) e) 0).hom = + (quotientVertexIso (presentationRepresentation (Y := Y) e) 0).hom ≫ + (vectorStalk (k := k)).map (liftedEndHom ((Algebra.lsmul k k Y) r)) := by + have h := quotientAction_square (presentationRepresentation (Y := Y) e) (e.symm r) + rw [presentationRepresentation_givenAction] at h + simpa only [AlgHom.comp_apply, AlgEquiv.coe_toAlgHom, AlgEquiv.apply_symm_apply, + quotientActionOfPresentation] using h +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/NativeArrowBridge.lean b/lean/OAI/Algebra/Finitistic/Localization/NativeArrowBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..17a8321cb5e20b85ca336909adbd6bd5ff4d37a4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/NativeArrowBridge.lean @@ -0,0 +1,93 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleVertex +import OAI.Algebra.Finitistic.Rectification.InducedRectification +import OAI.Algebra.Finitistic.Rectification.ArrowCompatibility + +namespace OAI +open CategoryTheory HomologicalComplex +open scoped TensorProduct +noncomputable section +namespace ExternalTensor.Section4.ArrowVertex.NativeBridge +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +/-- The native and generic functors retain definitionally the same original fixed submodule. -/ +theorem vertex_eq (e : B) : vertex k B e = LittleFinitistic.BimoduleVertex.functor k B e := rfl + +variable {k B} +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +/-- The native P is exactly the total already used for actual arrow compatibility. -/ +theorem total_eq : actualP s D₀ D₁ D₂ f g H = + LittleFinitistic.InducedRectification.total s D₀ D₁ D₂ f g H := rfl + +/-- The native zero-column inclusion is exactly the one in the proved endpoints. -/ +theorem inclusion_eq : LittleFinitistic.RectificationTotal.inclusion + (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H) = + LittleFinitistic.InducedRectification.inclusion s D₀ D₁ D₂ f g H := rfl + +abbrev nativeVertex (e : B) := + (LittleFinitistic.BimoduleVertex.functor k B e).mapHomologicalComplex (ComplexShape.up ℤ) + +/-- The direct original insertion in the native P and native fixed-submodule functor. -/ +def originalIota (e : B) (he : e * e = e) (D : RightComplex B) + (t : (columnComplex k B e).obj D ⟶ L0Prime s D₀ D₁ D₂ f g) : + D ⟶ (nativeVertex e).obj (LittleFinitistic.InducedRectification.total s D₀ D₁ D₂ f g H) := + diagonalComplex k B e he D ≫ (nativeVertex e).map t ≫ + (nativeVertex e).map (LittleFinitistic.InducedRectification.inclusion s D₀ D₁ D₂ f g H) + +/-- No comparison hypothesis is needed to identify the proved insertion with native maps. -/ +theorem iota_eq_original (e : B) (he : e * e = e) (D : RightComplex B) + (t : (columnComplex k B e).obj D ⟶ L0Prime s D₀ D₁ D₂ f g) : + iota (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) + (nullHomotopy s D₀ D₁ D₂ f g H) e he D t = + originalIota s D₀ D₁ D₂ f g H e he D t := by + simp only [iota, originalIota, Functor.map_comp] + rfl + +/-- The native original diagonal map is determined by its tensor formula. -/ +theorem diagonal_eq_of_original (e : B) (he : e * e = e) (D : RightComplex B) + (j : D ⟶ (nativeVertex e).obj ((columnComplex k B e).obj D)) + (hj : ∀ n x, ((j.f n) x).val = generator B e ⊗ₜ[k] x) : + j = diagonalComplex k B e he D := by + ext n x + apply Subtype.ext + exact hj n x + +/-- Actual arrow-01 compatibility with the native P, vertex functors and inclusions. -/ +def nativeCompatibility01 (h₀ : s.e₀ * s.e₀ = s.e₀) (h₁ : s.e₁ * s.e₁ = s.e₁) + (a : A) (ha : s.e₁ * s.a a = s.a a) : + Homotopy + (originalIota s D₀ D₁ D₂ f g H s.e₀ h₀ D₀ (inducedData s D₀ D₁ D₂ f g).in₀ ≫ + arrowComplex k B s.e₀ s.e₁ (s.a a) ha + (LittleFinitistic.InducedRectification.total s D₀ D₁ D₂ f g H)) + (f a ≫ originalIota s D₀ D₁ D₂ f g H s.e₁ h₁ D₁ + (inducedData s D₀ D₁ D₂ f g).in₁) := by + have ht := compatibility01 s D₀ D₁ D₂ f g H h₀ h₁ a ha + dsimp only [iota0, iota1] at ht + erw [iota_eq_original s D₀ D₁ D₂ f g H, + iota_eq_original s D₀ D₁ D₂ f g H] at ht + exact ht + +/-- Actual arrow-12 compatibility with the native P, vertex functors and inclusions. -/ +def nativeCompatibility12 (h₁ : s.e₁ * s.e₁ = s.e₁) (h₂ : s.e₂ * s.e₂ = s.e₂) + (b : J) (hb : s.e₂ * s.b b = s.b b) : + Homotopy + (originalIota s D₀ D₁ D₂ f g H s.e₁ h₁ D₁ (inducedData s D₀ D₁ D₂ f g).in₁ ≫ + arrowComplex k B s.e₁ s.e₂ (s.b b) hb + (LittleFinitistic.InducedRectification.total s D₀ D₁ D₂ f g H)) + (g b ≫ originalIota s D₀ D₁ D₂ f g H s.e₂ h₂ D₂ + (inducedData s D₀ D₁ D₂ f g).in₂) := by + have ht := compatibility12 s D₀ D₁ D₂ f g H h₁ h₂ b hb + dsimp only [iota1, iota2] at ht + erw [iota_eq_original s D₀ D₁ D₂ f g H, + iota_eq_original s D₀ D₁ D₂ f g H] at ht + exact ht +end ExternalTensor.Section4.ArrowVertex.NativeBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/NativeBoundedDerived.lean b/lean/OAI/Algebra/Finitistic/Localization/NativeBoundedDerived.lean new file mode 100644 index 0000000000000000000000000000000000000000..24bcdf812124a25ba1743e8391f2e3a6e8efc2ac --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/NativeBoundedDerived.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Bimodule.BoundedBimoduleDerived +import OAI.Algebra.Finitistic.Bimodule.BimoduleScalarEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- Build the complete derived-tensor model from the actual native rectification, with no tensor-comparison assumption. -/ +def inducedBoundedProjective + {A J R : Type} [Fintype A] [Fintype J] [Fintype R] + (s : Quadratic k B (A := A) (J := J) (R := R)) + (D₀ D₁ D₂ : RightComplex B) (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) + (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + (lo hi : ℤ) + (b₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (b₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (b₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) + (h₀ : ∀ n, Module.Projective Bᵐᵒᵖ (D₀.X n)) + (h₁ : ∀ n, Module.Projective Bᵐᵒᵖ (D₁.X n)) + (h₂ : ∀ n, Module.Projective Bᵐᵒᵖ (D₂.X n)) : + BoundedProjective k B (InducedRectification.total s D₀ D₁ D₂ f g H) where + lower := lo-2 + upper := hi + bounded := InducedRectification.total_bounded s D₀ D₁ D₂ f g H lo hi b₀ b₁ b₂ + projective := induced_term_projective s D₀ D₁ D₂ f g H h₀ h₁ h₂ + +namespace BoundedProjective +variable {P : BiComplex k B} (data : BoundedProjective k B P) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + +/-- The exact native module-valued degree-zero evaluation, using the module's original compatible k action. -/ +def nativeEvaluation (N : Type u) [AddCommGroup N] [Module k N] [Module B N] [IsScalarTower k B N] : + data.derived.obj (DerivedCategory.Q.obj (singleInput B (ModuleCat.of B N))) ≅ + DerivedCategory.Q.obj (((BimoduleBalancedTensor.functor k B N).mapHomologicalComplex (.up ℤ)).obj P) := + data.singleEvaluation (ModuleCat.of B N) ≪≫ DerivedCategory.Q.mapIso (scalarEvaluationIso k B N P) +end BoundedProjective +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/NativeProjectiveModel.lean b/lean/OAI/Algebra/Finitistic/Localization/NativeProjectiveModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..faca1933636a1d186162b22009f479218314fb30 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/NativeProjectiveModel.lean @@ -0,0 +1,26 @@ +import OAI.Algebra.Finitistic.Localization.NativeBoundedDerived + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- Direct adapter for the boundedness and right-projectivity fields of the native fixed rectification. -/ +def nativeProjectiveModel (P : BiComplex k B) (lo hi : ℤ) + (bounded : ∀ n, n < lo ∨ hi < n → IsZero (P.X n)) + (projective : ∀ n, CategoryTheory.Projective ((right k B P).X n)) : + BoundedProjective k B P where + lower := lo + upper := hi + bounded := bounded + projective n := by + let := projective n + exact inferInstanceAs (Module.Projective Bᵐᵒᵖ ((right k B P).X n)) +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/NativeSingleEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/NativeSingleEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ac055b2824fd81e92aa1985a7c6143ca8a7d4ce --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/NativeSingleEvaluation.lean @@ -0,0 +1,24 @@ +import OAI.Algebra.Finitistic.Localization.NativeProjectiveModel +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerivedShift + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal.BoundedProjective +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {P : BiComplex k B} (data : BoundedProjective k B P) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + +/-- Native degree-zero module embedding, with the module's original compatible scalar action. -/ +def nativeSingleEvaluation (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + [IsScalarTower k B N] : + data.derived.obj ((DerivedCategory.singleFunctor (ModuleCat.{u} B) 0).obj (ModuleCat.of B N)) ≅ + DerivedCategory.Q.obj (((BimoduleBalancedTensor.functor k B N).mapHomologicalComplex (.up ℤ)).obj P) := + data.nativeEvaluation N +end LittleFinitistic.BimoduleTotal.BoundedProjective + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/NormalizedQuotientAction.lean b/lean/OAI/Algebra/Finitistic/Localization/NormalizedQuotientAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..82b1ffccd4debaf95d8b90dd3505dbb82e1cac6a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/NormalizedQuotientAction.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Localization.QuotientRelations + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +lemma quotient_arrow12 (h : Fin d) : + arrowQ12 P h.succ = inv (arrowQ01 P 0) ≫ arrowQ01 P h.succ ≫ arrowQ12 P 0 := by + have h := congrArg (fun f => inv (arrowQ01 P 0) ≫ f) (quotient_commutation P h) + simpa using h + +/-- Divide each homogenized path by s's on the target side. -/ +def normalizePath : (vertexQ P 0 ⟶ vertexQ P 2) →ₗ[k] End (vertexQ P 0) where + toFun f := f ≫ inv (arrowQ12 P 0) ≫ inv (arrowQ01 P 0) + map_add' f g := by simp [Preadditive.add_comp] + map_smul' c f := by simp [Linear.smul_comp] + +lemma normalizePath_quadratic (h l : Fin d) : + normalizePath P (arrowQ01 P l.succ ≫ arrowQ12 P h.succ) = + normalizedGenerator P h * normalizedGenerator P l := by + change (arrowQ01 P l.succ ≫ arrowQ12 P h.succ) ≫ inv (arrowQ12 P 0) ≫ inv (arrowQ01 P 0) = + (arrowQ01 P l.succ ≫ inv (arrowQ01 P 0)) ≫ (arrowQ01 P h.succ ≫ inv (arrowQ01 P 0)) + rw [quotient_arrow12] + simp [Category.assoc] + +lemma normalizePath_linear (h : Fin d) : + normalizePath P (arrowQ01 P h.succ ≫ arrowQ12 P 0) = normalizedGenerator P h := by + change (arrowQ01 P h.succ ≫ arrowQ12 P 0) ≫ inv (arrowQ12 P 0) ≫ inv (arrowQ01 P 0) = _ + simp [Category.assoc,normalizedGenerator] + +lemma normalizePath_constant : + normalizePath P (arrowQ01 P 0 ≫ arrowQ12 P 0) = (1 : End (vertexQ P 0)) := by + change (arrowQ01 P 0 ≫ arrowQ12 P 0) ≫ inv (arrowQ12 P 0) ≫ inv (arrowQ01 P 0) = 𝟙 _ + simp [Category.assoc] + +/-- The original, inhomogeneous relations hold on L in the actual quotient. -/ +theorem normalizedGenerator_satisfies : P.Satisfies (normalizedGenerator P) := by + intro j + have h := congrArg (normalizePath P) (quotient_homogenized P j) + simpa only [map_add,map_sum,map_smul,map_zero,normalizePath_quadratic, + normalizePath_linear,normalizePath_constant] using h +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/OddDouble.lean b/lean/OAI/Algebra/Finitistic/Localization/OddDouble.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b3764b0f31d17c8408df501849c079e2421ce0a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/OddDouble.lean @@ -0,0 +1,335 @@ +import Mathlib.CategoryTheory.Idempotents.Biproducts +import Mathlib.CategoryTheory.Triangulated.Subcategory +import Mathlib.Tactic.Abel + +namespace OAI + +namespace LittleFinitistic.OddDouble +open CategoryTheory CategoryTheory.Category CategoryTheory.Limits +open CategoryTheory.Preadditive CategoryTheory.Pretriangulated +open CategoryTheory.Idempotents + +variable {C : Type*} [Category C] [Preadditive C] [HasShift C ℤ] + +noncomputable def sourceProjector (T : Triangle C) (u : T.obj₂ ⟶ T.obj₁) := + 𝟙 T.obj₁ - T.mor₁ ≫ u + +noncomputable def targetProjector (T : Triangle C) (u : T.obj₂ ⟶ T.obj₁) := + 𝟙 T.obj₂ - u ≫ T.mor₁ + +variable (T : Triangle C) (u : T.obj₂ ⟶ T.obj₁) +variable (hu : T.mor₁ ≫ u ≫ T.mor₁ = T.mor₁) +include hu + +theorem sourceProjector_idem : sourceProjector T u ≫ sourceProjector T u = sourceProjector T u := by + unfold sourceProjector + simp only [comp_sub,sub_comp,id_comp,comp_id,assoc,reassoc_of% hu] + abel + +theorem targetProjector_idem : targetProjector T u ≫ targetProjector T u = targetProjector T u := by + unfold targetProjector + simp only [comp_sub,sub_comp,id_comp,comp_id,assoc,hu] + abel + +theorem sourceProjector_comp : sourceProjector T u ≫ T.mor₁ = 0 := by + simp only [sourceProjector,sub_comp,id_comp,assoc,hu,sub_self] + +theorem comp_targetProjector : T.mor₁ ≫ targetProjector T u = 0 := by + simp only [targetProjector,comp_sub,comp_id,hu,sub_self] + +variable [HasZeroObject C] [∀ n : ℤ, (shiftFunctor C n).Additive] [Pretriangulated C] + +local instance : HasFiniteBiproducts (Karoubi C) := Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi C) := hasBinaryBiproducts_of_finite_biproducts (Karoubi C) + +variable (hT : T ∈ distTriang C) +include hT + +omit hu in +theorem targetProjector_comp_second : targetProjector T u ≫ T.mor₂ = T.mor₂ := by + simp only [targetProjector,sub_comp,id_comp,assoc,comp_distTriang_mor_zero₁₂ T hT, + comp_zero,sub_zero] + +omit hu in +theorem third_comp_sourceProjector : + T.mor₃ ≫ (sourceProjector T u)⟦(1 : ℤ)⟧' = T.mor₃ := by + simp only [sourceProjector,Functor.map_sub,Functor.map_comp,comp_sub, + ← assoc,comp_distTriang_mor_zero₃₁ T hT,zero_comp,sub_zero] + rw [(shiftFunctor C (1 : ℤ)).map_id,comp_id] + +/-- Splitting data for the cone of a morphism admitting a generalized inverse. +These are the five biproduct equations in the idempotent completion. -/ +theorem cone_splitting : + ∃ (s : T.obj₁⟦(1 : ℤ)⟧ ⟶ T.obj₃) (t : T.obj₃ ⟶ T.obj₂), + (sourceProjector T u)⟦(1 : ℤ)⟧' ≫ s = s ∧ + s ≫ T.mor₃ = (sourceProjector T u)⟦(1 : ℤ)⟧' ∧ + t ≫ targetProjector T u = t ∧ + T.mor₂ ≫ t = targetProjector T u ∧ + s ≫ t = 0 ∧ + t ≫ T.mor₂ + T.mor₃ ≫ s = 𝟙 T.obj₃ := by + let p := sourceProjector T u + let q := targetProjector T u + have hp : p ≫ p = p := sourceProjector_idem T u hu + have hq : q ≫ q = q := targetProjector_idem T u hu + have hpf : p ≫ T.mor₁ = 0 := sourceProjector_comp T u hu + have hfq : T.mor₁ ≫ q = 0 := comp_targetProjector T u hu + have hqg : q ≫ T.mor₂ = T.mor₂ := targetProjector_comp_second T u hT + have hhp : T.mor₃ ≫ p⟦(1 : ℤ)⟧' = T.mor₃ := third_comp_sourceProjector T u hT + have hp1 : p⟦(1 : ℤ)⟧' ≫ p⟦(1 : ℤ)⟧' = p⟦(1 : ℤ)⟧' := by + rw [← Functor.map_comp,hp] + obtain ⟨s₀,hs₀⟩ := T.coyoneda_exact₁ hT (p⟦(1 : ℤ)⟧') (by + rw [← Functor.map_comp,hpf,Functor.map_zero]) + let s := p⟦(1 : ℤ)⟧' ≫ s₀ + have hps : p⟦(1 : ℤ)⟧' ≫ s = s := by + dsimp [s]; rw [← assoc,hp1] + have hsh : s ≫ T.mor₃ = p⟦(1 : ℤ)⟧' := by + dsimp [s]; rw [assoc,← hs₀,hp1] + have hdelta : (𝟙 T.obj₃ - T.mor₃ ≫ s) ≫ T.mor₃ = 0 := by + rw [sub_comp,id_comp,assoc,hsh,hhp,sub_self] + obtain ⟨t₀,ht₀⟩ := T.coyoneda_exact₃ hT _ hdelta + let t := t₀ ≫ q + have htq : t ≫ q = t := by dsimp [t]; rw [assoc,hq] + have htg : t ≫ T.mor₂ = 𝟙 T.obj₃ - T.mor₃ ≫ s := by + dsimp [t]; rw [assoc,hqg,← ht₀] + have hgt : T.mor₂ ≫ t = q := by + have hz : (T.mor₂ ≫ t - q) ≫ T.mor₂ = 0 := by + rw [sub_comp,assoc,htg,comp_sub,comp_id,← assoc, + comp_distTriang_mor_zero₂₃ T hT,zero_comp,hqg,sub_zero,sub_self] + obtain ⟨v,hv⟩ := T.coyoneda_exact₂ hT _ hz + have he := congrArg (fun z => z ≫ q) hv + simp only [sub_comp,assoc,htq,hq,hfq,comp_zero] at he + exact sub_eq_zero.mp he + have hst : s ≫ t = 0 := by + have hz : (s ≫ t) ≫ T.mor₂ = 0 := by + rw [assoc,htg,comp_sub,comp_id,← assoc,hsh,hps,sub_self] + obtain ⟨v,hv⟩ := T.coyoneda_exact₂ hT _ hz + have he := congrArg (fun z => z ≫ q) hv + simpa only [assoc,htq,hfq,comp_zero] using he + exact ⟨s,t,hps,hsh,htq,hgt,hst,by rw [htg,sub_add_cancel]⟩ + +noncomputable def formalKernel : Karoubi C where + X := T.obj₁⟦(1 : ℤ)⟧ + p := (sourceProjector T u)⟦(1 : ℤ)⟧' + idem := by rw [← Functor.map_comp,sourceProjector_idem T u hu] + +noncomputable def formalCokernel : Karoubi C where + X := T.obj₂ + p := targetProjector T u + idem := targetProjector_idem T u hu + +/-- The cone of a regular morphism is the direct sum of its formal cokernel +and the shifted formal kernel in the idempotent completion. -/ +theorem regular_cone_iso : + Nonempty ((toKaroubi C).obj T.obj₃ ≅ formalCokernel T u hu ⊞ formalKernel T u hu) := by + obtain ⟨s,t,hps,hsh,htq,hgt,hst,htotal⟩ := cone_splitting T u hu hT + let Q := formalCokernel T u hu + let P := formalKernel T u hu + let S := (toKaroubi C).obj T.obj₃ + let gi : Q ⟶ S := ⟨T.mor₂,by + change targetProjector T u ≫ T.mor₂ ≫ 𝟙 _ = T.mor₂ + rw [comp_id,targetProjector_comp_second T u hT]⟩ + let tr : S ⟶ Q := ⟨t,by + change 𝟙 _ ≫ t ≫ targetProjector T u = t + rw [id_comp,htq]⟩ + let hr : S ⟶ P := ⟨T.mor₃,by + change 𝟙 _ ≫ T.mor₃ ≫ (sourceProjector T u)⟦(1 : ℤ)⟧' = T.mor₃ + rw [id_comp,third_comp_sourceProjector T u hT]⟩ + let si : P ⟶ S := ⟨s,by + change (sourceProjector T u)⟦(1 : ℤ)⟧' ≫ s ≫ 𝟙 _ = s + rw [comp_id,hps]⟩ + let bc : BinaryBicone Q P := + { pt := S + fst := tr + snd := hr + inl := gi + inr := si + inl_fst := by apply Karoubi.hom_ext; exact hgt + inl_snd := by apply Karoubi.hom_ext; exact comp_distTriang_mor_zero₂₃ T hT + inr_fst := by apply Karoubi.hom_ext; exact hst + inr_snd := by apply Karoubi.hom_ext; exact hsh } + have hb : bc.IsBilimit := isBinaryBilimitOfTotal bc (by + apply Karoubi.hom_ext + exact htotal) + exact ⟨biprod.uniqueUpToIso Q P hb⟩ + +omit hu hT + +noncomputable def formalShift (P : Karoubi C) (n : ℤ) : Karoubi C where + X := P.X⟦n⟧ + p := P.p⟦n⟧' + idem := by rw [← Functor.map_comp,P.idem] + +/-- The first odd double is the cone of the complementary idempotent. -/ +theorem odd_double_one (U : Karoubi C) : + ∃ S : C, Nonempty ((toKaroubi C).obj S ≅ U ⊞ formalShift U 1) := by + let f := 𝟙 U.X - U.p + have hf : f ≫ f = f := by + dsimp [f] + simp only [comp_sub,sub_comp,id_comp,comp_id,U.idem] + abel + obtain ⟨S,g,h,hT⟩ := distinguished_cocone_triangle f + let T := Triangle.mk f g h + have hu : T.mor₁ ≫ f ≫ T.mor₁ = T.mor₁ := by change f ≫ f ≫ f = f; rw [hf,hf] + have hq : formalCokernel T f hu = U := by + refine Karoubi.ext (P := formalCokernel T f hu) (Q := U) rfl ?_ + change (𝟙 U.X - f ≫ f) ≫ 𝟙 U.X = 𝟙 U.X ≫ U.p + rw [hf,comp_id,id_comp] + dsimp [f] + abel + have hp : formalKernel T f hu = formalShift U 1 := by + refine Karoubi.ext (P := formalKernel T f hu) (Q := formalShift U 1) rfl ?_ + change (𝟙 U.X - f ≫ f)⟦(1 : ℤ)⟧' ≫ 𝟙 _ = 𝟙 _ ≫ U.p⟦(1 : ℤ)⟧' + rw [comp_id,id_comp,hf] + congr 1 + dsimp [f] + abel + refine ⟨S,?_⟩ + have hc := regular_cone_iso T f hu hT + rw [hq,hp] at hc + exact hc + +noncomputable def formalShiftFunctor (n : ℤ) : Karoubi C ⥤ Karoubi C where + obj P := formalShift P n + map {P Q} f := ⟨f.f⟦n⟧',by + change P.p⟦n⟧' ≫ f.f⟦n⟧' ≫ Q.p⟦n⟧' = f.f⟦n⟧' + simp only [← Functor.map_comp,f.comm]⟩ + map_id _ := by apply Karoubi.hom_ext; rfl + map_comp _ _ := by apply Karoubi.hom_ext; exact Functor.map_comp _ _ _ + +instance (n : ℤ) : (formalShiftFunctor (C := C) n).Additive where + map_add := by intros; apply Karoubi.hom_ext; exact Functor.map_add _ + +noncomputable def retractProjector {A P : Karoubi C} (i : P ⟶ A) (r : A ⟶ P) + (hi : i ≫ r = 𝟙 P) : Karoubi C where + X := A.X + p := r.f ≫ i.f + idem := by + have h : i.f ≫ r.f = P.p := congrArg Karoubi.Hom.f hi + calc + (r.f ≫ i.f) ≫ (r.f ≫ i.f) = (r.f ≫ (i.f ≫ r.f)) ≫ i.f := by simp only [assoc] + _ = (r.f ≫ P.p) ≫ i.f := by rw [h] + _ = r.f ≫ i.f := by rw [Karoubi.comp_p] + +noncomputable def retractProjectorIso {A P : Karoubi C} (i : P ⟶ A) (r : A ⟶ P) + (hi : i ≫ r = 𝟙 P) : retractProjector i r hi ≅ P := by + have h : i.f ≫ r.f = P.p := congrArg Karoubi.Hom.f hi + exact + { hom := ⟨r.f,by + change (r.f ≫ i.f) ≫ r.f ≫ P.p = r.f + simp only [assoc,h,Karoubi.comp_p]⟩ + inv := ⟨i.f,by + change P.p ≫ i.f ≫ (r.f ≫ i.f) = i.f + rw [← assoc,Karoubi.p_comp,← assoc,h,Karoubi.p_comp]⟩ + hom_inv_id := by apply Karoubi.hom_ext; rfl + inv_hom_id := by apply Karoubi.hom_ext; exact h } + +/-- The second cone realizes the third odd double, with three successive shifts. -/ +theorem odd_double_three_nested (U : Karoubi C) : + ∃ Z : C, Nonempty ((toKaroubi C).obj Z ≅ + U ⊞ formalShift (formalShift (formalShift U 1) 1) 1) := by + classical + obtain ⟨S,⟨e⟩⟩ := odd_double_one U + let A := (toKaroubi C).obj S + let F := formalShiftFunctor (C := C) 1 + let P := F.obj U + let i₀ : U ⟶ A := biprod.inl ≫ e.inv + let r₀ : A ⟶ U := e.hom ≫ biprod.fst + let i₁ : P ⟶ A := biprod.inr ≫ e.inv + let r₁ : A ⟶ P := e.hom ≫ biprod.snd + have h₀ : i₀ ≫ r₀ = 𝟙 U := by simp only [i₀,r₀,assoc,Iso.inv_hom_id_assoc,biprod.inl_fst] + have h₁ : i₁ ≫ r₁ = 𝟙 P := by + change (biprod.inr ≫ e.inv) ≫ e.hom ≫ biprod.snd = 𝟙 (formalShift U 1) + rw [assoc, e.inv_hom_id_assoc] + exact biprod.inr_snd (X := U) (Y := formalShift U 1) + have htotal : r₀ ≫ i₀ + r₁ ≫ i₁ = 𝟙 A := by + change (e.hom ≫ biprod.fst) ≫ (biprod.inl ≫ e.inv) + + (e.hom ≫ biprod.snd) ≫ (biprod.inr ≫ e.inv) = 𝟙 A + calc + _ = e.hom ≫ (biprod.fst ≫ biprod.inl + biprod.snd ≫ biprod.inr) ≫ e.inv := by + simp only [comp_add,add_comp,assoc] + _ = 𝟙 A := by rw [biprod.total,id_comp,e.hom_inv_id] + let δ : F.obj A ⟶ A := F.map r₀ ≫ i₁ + let γ : A ⟶ F.obj A := r₁ ≫ F.map i₀ + have hδγ : δ ≫ γ = F.map (r₀ ≫ i₀) := by + dsimp only [δ,γ] + rw [assoc,← assoc i₁ r₁,h₁,id_comp,← F.map_comp] + have hγδ : γ ≫ δ = r₁ ≫ i₁ := by + dsimp only [δ,γ] + rw [assoc,← assoc (F.map i₀) (F.map r₀),← F.map_comp,h₀,F.map_id,id_comp] + have hreg : δ ≫ γ ≫ δ = δ := by + rw [← assoc,hδγ] + dsimp only [δ] + rw [F.map_comp,assoc,← assoc (F.map i₀) (F.map r₀),← F.map_comp,h₀,F.map_id,id_comp] + obtain ⟨Z,g,h,hT⟩ := distinguished_cocone_triangle δ.f + let T := Triangle.mk δ.f g h + have hu : T.mor₁ ≫ γ.f ≫ T.mor₁ = T.mor₁ := congrArg Karoubi.Hom.f hreg + have hq : formalCokernel T γ.f hu = retractProjector i₀ r₀ h₀ := by + refine Karoubi.ext (P := formalCokernel T γ.f hu) + (Q := retractProjector i₀ r₀ h₀) rfl ?_ + change (𝟙 A.X - γ.f ≫ δ.f) ≫ 𝟙 A.X = 𝟙 A.X ≫ (r₀.f ≫ i₀.f) + rw [comp_id,id_comp] + have he : 𝟙 A - γ ≫ δ = r₀ ≫ i₀ := by rw [hγδ,← htotal]; abel + have he' := congrArg (Karoubi.inclusionHom A A) he + rw [map_sub] at he' + exact he' + have h₁' : F.map (F.map i₁) ≫ F.map (F.map r₁) = 𝟙 (F.obj (F.obj P)) := by + rw [← F.map_comp,← F.map_comp,h₁,F.map_id,F.map_id] + have hp : formalKernel T γ.f hu = + retractProjector (F.map (F.map i₁)) (F.map (F.map r₁)) h₁' := by + refine Karoubi.ext (P := formalKernel T γ.f hu) + (Q := retractProjector (F.map (F.map i₁)) (F.map (F.map r₁)) h₁') rfl ?_ + change (𝟙 (F.obj A).X - δ.f ≫ γ.f)⟦(1 : ℤ)⟧' ≫ 𝟙 _ = + 𝟙 _ ≫ ((F.map (F.map r₁)).f ≫ (F.map (F.map i₁)).f) + rw [comp_id,id_comp] + have he : 𝟙 (F.obj A) - δ ≫ γ = F.map (r₁ ≫ i₁) := by + rw [hδγ,← F.map_id,← F.map_sub] + congr 1 + rw [← htotal] + abel + have hA : (F.obj A).p = 𝟙 (F.obj A).X := (shiftFunctor C (1 : ℤ)).map_id S + have he' := congrArg (Karoubi.inclusionHom (F.obj A) (F.obj A)) he + rw [map_sub] at he' + change (F.obj A).p - δ.f ≫ γ.f = (F.map (r₁ ≫ i₁)).f at he' + rw [hA] at he' + rw [he'] + change (shiftFunctor C (1 : ℤ)).map ((shiftFunctor C (1 : ℤ)).map (r₁.f ≫ i₁.f)) = _ + simp only [Functor.map_comp] + rfl + obtain ⟨econe⟩ := regular_cone_iso T γ.f hu hT + rw [hq,hp] at econe + refine ⟨Z,⟨econe ≪≫ biprod.mapIso (retractProjectorIso i₀ r₀ h₀) + (retractProjectorIso (F.map (F.map i₁)) (F.map (F.map r₁)) h₁')⟩⟩ + +noncomputable def formalIso {P Q : Karoubi C} (e : P.X ≅ Q.X) + (he : P.p ≫ e.hom = e.hom ≫ Q.p) : P ≅ Q := by + have hi : Q.p ≫ e.inv = e.inv ≫ P.p := by + apply (cancel_epi e.hom).mp + rw [← assoc,← he,assoc,e.hom_inv_id,comp_id,e.hom_inv_id_assoc] + exact + { hom := ⟨P.p ≫ e.hom,by + simp only [assoc,reassoc_of% he,he,Q.idem]⟩ + inv := ⟨Q.p ≫ e.inv,by + simp only [assoc,reassoc_of% hi,hi,P.idem]⟩ + hom_inv_id := by + apply Karoubi.hom_ext + change (P.p ≫ e.hom) ≫ (Q.p ≫ e.inv) = P.p + rw [assoc,hi,← assoc e.hom e.inv,e.hom_inv_id,id_comp,P.idem] + inv_hom_id := by + apply Karoubi.hom_ext + change (Q.p ≫ e.inv) ≫ (P.p ≫ e.hom) = Q.p + rw [assoc,he,← assoc e.inv e.hom,e.inv_hom_id,id_comp,Q.idem] } + +noncomputable def formalShiftAdd (P : Karoubi C) (n m : ℤ) : + formalShift (formalShift P n) m ≅ formalShift P (n+m) := + formalIso ((shiftFunctorAdd C n m).app P.X).symm + ((shiftFunctorAdd C n m).inv.naturality P.p) + +/-- Both odd doubles in the manuscript are represented by actual objects. -/ +theorem odd_double_three (U : Karoubi C) : + ∃ Z : C, Nonempty ((toKaroubi C).obj Z ≅ U ⊞ formalShift U 3) := by + obtain ⟨Z,⟨e⟩⟩ := odd_double_three_nested U + exact ⟨Z,⟨e ≪≫ biprod.mapIso (Iso.refl U) + (formalShiftAdd (formalShift U 1) 1 1 ≪≫ formalShiftAdd U 1 2)⟩⟩ +end LittleFinitistic.OddDouble + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/PresentedActionCompatibility.lean b/lean/OAI/Algebra/Finitistic/Localization/PresentedActionCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0a2a91b98f51671683f16202be70b745398c2ca --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/PresentedActionCompatibility.lean @@ -0,0 +1,83 @@ +import OAI.Algebra.Finitistic.Localization.EvaluationLinear + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.QuadraticEncoding +universe u v w z + +section LinearFunctor +variable {k : Type u} [Field k] +variable {C : Type v} [Category.{w} C] [Preadditive C] [Linear k C] +variable {D : Type z} [Category D] [Preadditive D] [Linear k D] +variable (F : C ⥤ D) [F.Additive] [F.Linear k] (L : C) {T : D} (e : F.obj L ≅ T) + +/-- Evaluation of endomorphisms, expressed in a specified identification of the target. -/ +def identifiedEndHom : End L →ₐ[k] End T where + toFun a := e.inv ≫ F.map a ≫ e.hom + map_zero' := by simp + map_add' a b := by + change e.inv ≫ F.map ((a : L ⟶ L) + b) ≫ e.hom = + (e.inv ≫ F.map a ≫ e.hom) + (e.inv ≫ F.map b ≫ e.hom) + rw [F.map_add, Preadditive.add_comp, Preadditive.comp_add] + map_one' := by simp + map_mul' a b := by simp [End.mul_def, Functor.map_comp, Category.assoc] + commutes' c := by + change e.inv ≫ F.map (c • 𝟙 L) ≫ e.hom = c • 𝟙 T + simp [Linear.comp_smul, Linear.smul_comp] +end LinearFunctor + +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +/-- Canonical transport of every endomorphism of Y to its universe lift. -/ +def liftedEndHom : Module.End k Y →ₐ[k] End (ModuleCat.of k (ULift.{u} Y)) where + toFun a := ModuleCat.ofHom (ULift.moduleEquiv.symm.toLinearMap.comp + (a.comp ULift.moduleEquiv.toLinearMap)) + map_zero' := by apply ModuleCat.hom_ext; apply LinearMap.ext; intro y; rfl + map_add' a b := by apply ModuleCat.hom_ext; apply LinearMap.ext; intro y; rfl + map_one' := by apply ModuleCat.hom_ext; apply LinearMap.ext; intro y; rfl + map_mul' a b := by apply ModuleCat.hom_ext; apply LinearMap.ext; intro y; rfl + commutes' c := by apply ModuleCat.hom_ext; apply LinearMap.ext; intro y; rfl + +/-- The presented algebra acts on Y by precisely its specified generator endomorphisms. -/ +def givenAction : PresentedAlgebra P →ₐ[k] Module.End k Y := + presentationLift P X.generator X.relation + +def givenStalkAction : PresentedAlgebra P →ₐ[k] + End ((vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y))) := + (identifiedEndHom (vectorStalk (k := k)) _ (Iso.refl _)).comp + ((liftedEndHom (k := k) (Y := Y)).comp (givenAction X)) + +/-- The quotient action, evaluated and identified with the stalk of Y. -/ +def evaluatedAction : PresentedAlgebra P →ₐ[k] + End ((vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y))) := + (identifiedEndHom (boundedQuotientEvaluation X) (vertexQ P 0) (quotientVertexIso X 0)).comp + (quotientAction P) + +lemma evaluatedAction_generator (h : Fin d) : + evaluatedAction X (presentedGenerator P h) = + givenStalkAction X (presentedGenerator P h) := by + change (quotientVertexIso X 0).inv ≫ + (boundedQuotientEvaluation X).map (quotientAction P (presentedGenerator P h)) ≫ + (quotientVertexIso X 0).hom = _ + rw [quotientAction_generator, normalizedGenerator_evaluates] + simp only [← Category.assoc, Iso.inv_hom_id, Category.id_comp] + change (vectorStalk (k := k)).map ((liftedEndHom (k := k) (Y := Y)) (X.generator h)) = + 𝟙 _ ≫ (vectorStalk (k := k)).map ((liftedEndHom (k := k) (Y := Y)) + (givenAction X (presentedGenerator P h))) ≫ 𝟙 _ + rw [Category.id_comp, Category.comp_id] + rw [show givenAction X (presentedGenerator P h) = X.generator h from + presentationLift_generator P X.generator X.relation h] + +/-- Section 3, lines 167–168: the entire quotient action evaluates to the given action. -/ +theorem quotientAction_evaluates : evaluatedAction X = givenStalkAction X := by + apply RingQuot.ringQuot_ext' + apply FreeAlgebra.hom_ext + funext h + exact evaluatedAction_generator X h +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/PresentedQuotientAction.lean b/lean/OAI/Algebra/Finitistic/Localization/PresentedQuotientAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..909ac5c178cb1ef965ce7f33c9fe7f91ecb9393a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/PresentedQuotientAction.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Localization.NormalizedQuotientAction +import Mathlib.Algebra.FreeAlgebra +import Mathlib.Algebra.RingQuot + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.QuadraticEncoding +universe u v +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The literal inhomogeneous relation polynomial. -/ +def relationPolynomial (j : Fin t) : FreeAlgebra k (Fin d) := + (∑ h, ∑ l, P.quadratic j h l • (FreeAlgebra.ι k h * FreeAlgebra.ι k l)) + + (∑ h, P.linear j h • FreeAlgebra.ι k h) + P.constant j • 1 + +def presentationRelation (a b : FreeAlgebra k (Fin d)) : Prop := + ∃ j, a = relationPolynomial P j ∧ b = 0 + +/-- The algebra with exactly the displayed finite quadratic presentation. -/ +abbrev PresentedAlgebra := RingQuot (presentationRelation P) +def presentedGenerator (h : Fin d) : PresentedAlgebra P := + RingQuot.mkAlgHom k (presentationRelation P) (FreeAlgebra.ι k h) + +theorem presentedGenerator_satisfies : P.Satisfies (presentedGenerator P) := by + intro j + have h := RingQuot.mkAlgHom_rel k (s := presentationRelation P) ⟨j,rfl,rfl⟩ + simpa only [relationPolynomial,map_add,map_sum,map_smul,map_mul,map_one,map_zero, + presentedGenerator] using h + +variable {A : Type v} [Ring A] [Algebra k A] + +/-- Descent through the actual presentation, with every relation checked. -/ +def presentationLift (x : Fin d → A) (hx : P.Satisfies x) : PresentedAlgebra P →ₐ[k] A := + RingQuot.liftAlgHom k ⟨FreeAlgebra.lift k x, by + rintro a b ⟨j,rfl,rfl⟩ + simpa only [relationPolynomial,map_add,map_sum,map_smul,map_mul,map_one,map_zero, + FreeAlgebra.lift_ι_apply] using hx j⟩ + +@[simp] theorem presentationLift_generator (x : Fin d → A) (hx : P.Satisfies x) (h : Fin d) : + presentationLift P x hx (presentedGenerator P h) = x h := by + simp [presentationLift,presentedGenerator,RingQuot.liftAlgHom_mkAlgHom_apply] + +/-- The manuscript's quotient action for its displayed presentation. -/ +def quotientAction : PresentedAlgebra P →ₐ[k] End (vertexQ P 0) := + presentationLift P (normalizedGenerator P) (normalizedGenerator_satisfies P) + +@[simp] theorem quotientAction_generator (h : Fin d) : + quotientAction P (presentedGenerator P h) = normalizedGenerator P h := + presentationLift_generator _ _ _ _ + +/-- Transport the action along a genuine presentation isomorphism for R. -/ +def quotientActionOfPresentation (e : PresentedAlgebra P ≃ₐ[k] A) : + A →ₐ[k] End (vertexQ P 0) := (quotientAction P).comp e.symm.toAlgHom + +@[simp] theorem quotientActionOfPresentation_generator (e : PresentedAlgebra P ≃ₐ[k] A) + (h : Fin d) : quotientActionOfPresentation P e (e (presentedGenerator P h)) = + normalizedGenerator P h := by simp [quotientActionOfPresentation] +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ProjectiveComplexes.lean b/lean/OAI/Algebra/Finitistic/Localization/ProjectiveComplexes.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5f284827cdcc82b5147edc2956e035f92fdef25 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ProjectiveComplexes.lean @@ -0,0 +1,71 @@ +import OAI.Algebra.Finitistic.Localization.BoundedHomotopy +import Mathlib.Algebra.Category.ModuleCat.Projective +import Mathlib.Algebra.Category.ModuleCat.Biproducts +import Mathlib.RingTheory.Finiteness.Prod +import Mathlib.RingTheory.Finiteness.Basic + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.ProjectiveComplexes +universe u +variable (B : Type u) [Ring B] + +/-- Right B-modules are left modules over the opposite ring. -/ +abbrev RightModule := ModuleCat.{u} Bᵐᵒᵖ + +def finiteProjective : ObjectProperty (RightModule B) := + fun M => Module.Finite Bᵐᵒᵖ M ∧ Module.Projective Bᵐᵒᵖ M + +instance : (finiteProjective B).IsClosedUnderIsomorphisms where + of_iso e h := by + let := h.1 + let := h.2 + exact ⟨Module.Finite.equiv e.toLinearEquiv, + Module.Projective.of_equiv e.toLinearEquiv⟩ + +instance : (finiteProjective B).ContainsZero where + exists_zero := ⟨ModuleCat.of Bᵐᵒᵖ PUnit, ModuleCat.isZero_of_subsingleton _, + by constructor <;> infer_instance⟩ + +instance : (finiteProjective B).IsClosedUnderBinaryProducts where + limitsOfShape_le := by + rintro X ⟨p⟩ + let M := p.diag.obj (.mk .left) + let N := p.diag.obj (.mk .right) + have hM := p.prop_diag_obj (.mk .left) + have hN := p.prop_diag_obj (.mk .right) + let := hM.1 + let := hM.2 + let := hN.1 + let := hN.2 + have hp : finiteProjective B (ModuleCat.of Bᵐᵒᵖ (M × N)) := + ⟨inferInstance, inferInstance⟩ + apply (finiteProjective B).prop_of_iso _ hp + exact IsLimit.conePointUniqueUpToIso (ModuleCat.binaryProductLimitCone M N).isLimit + ((IsLimit.postcomposeHomEquiv (diagramIsoPair p.diag) _).2 p.isLimit) + +instance : (finiteProjective B).IsClosedUnderFiniteProducts := .mk' + +/-- The additive category of finitely generated projective right B-modules. -/ +abbrev Proj := (finiteProjective B).FullSubcategory + +instance : HasBinaryBiproducts (Proj B) := .of_hasBinaryProducts + +/-- The actual category of bounded complexes of finitely generated projectives. -/ +abbrev Complex := BoundedHomotopy.Complex (Proj B) + +/-- Section 3's K = Kᵇ(proj-B), with homotopy classes of chain maps. -/ +abbrev K := BoundedHomotopy.K (Proj B) + +example : HasBinaryBiproducts (Proj B) := inferInstance +example : IsTriangulated (K B) := inferInstance + +/-- The passage from bounded projective complexes to their homotopy category. -/ +abbrev quotient : Complex B ⥤ K B := BoundedHomotopy.quotient (Proj B) + +end LittleFinitistic.ProjectiveComplexes + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/QuotientAction.lean b/lean/OAI/Algebra/Finitistic/Localization/QuotientAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..9031656406be45a04a4c3246c8b3e4049ac30c1d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/QuotientAction.lean @@ -0,0 +1,93 @@ +import Mathlib.CategoryTheory.Linear.Basic +import OAI.Algebra.Finitistic.Encoding.QuadraticEncoding +import OAI.Algebra.Finitistic.Encoding.QuadraticPresentation + +namespace OAI + +namespace LittleFinitistic.QuotientAction +open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive +open QuadraticEncoding + +variable {k : Type*} [Field k] {C : Type*} [Category C] [Preadditive C] [Linear k C] +variable {X₀ X₁ X₂ : C} {d t : ℕ} (P : Relations k d t) + (s : X₀ ⟶ X₁) (s' : X₁ ⟶ X₂) [IsIso s] [IsIso s'] + (a : Fin d → (X₀ ⟶ X₁)) (b : Fin d → (X₁ ⟶ X₂)) + (hc : ∀ h, s ≫ b h = a h ≫ s') + +noncomputable def normalized (h : Fin d) : End X₀ := a h ≫ inv s + +include hc in +omit [Preadditive C] [IsIso s'] in +lemma normalized_product_comp (h l : Fin d) : + (normalized s a h * normalized s a l) ≫ s ≫ s' = a l ≫ b h := by + simp only [normalized,End.mul_def,assoc,IsIso.inv_hom_id_assoc] + rw [← hc h] + simp only [IsIso.inv_hom_id_assoc] + +omit [Preadditive C] [IsIso s'] in +lemma normalized_comp (h : Fin d) : normalized s a h ≫ s ≫ s' = a h ≫ s' := by + simp [normalized] + +variable (hr : ∀ j, + (∑ h, ∑ l, P.quadratic j h l • (a l ≫ b h)) + + (∑ h, P.linear j h • (a h ≫ s')) + P.constant j • (s ≫ s') = 0) + +include hc hr in +/-- Normalizing the invertible arrows recovers the original quadratic equations. -/ +theorem normalized_relations (j : Fin t) : + (∑ h, ∑ l, P.quadratic j h l • (normalized s a h * normalized s a l)) + + (∑ h, P.linear j h • normalized s a h) + P.constant j • (1 : End X₀) = 0 := by + apply (cancel_mono (s ≫ s')).mp + dsimp only [End] + simp only [Preadditive.add_comp,Preadditive.sum_comp,Linear.smul_comp,End.one_def,id_comp,zero_comp] + simpa only [← End.mul_def,normalized_product_comp s s' a b hc,normalized_comp] using hr j + +/-- The degree-at-most-two defining polynomial with the displayed coefficients. -/ +def polynomial (j : Fin t) : FreeAlgebra k (Fin d) := + (∑ h, ∑ l, P.quadratic j h l • (FreeAlgebra.ι k h * FreeAlgebra.ι k l)) + + (∑ h, P.linear j h • FreeAlgebra.ι k h) + P.constant j • 1 + +noncomputable def freeAction : FreeAlgebra k (Fin d) →ₐ[k] End X₀ := + FreeAlgebra.lift k (normalized s a) + +include hc hr in +lemma freeAction_polynomial (j : Fin t) : freeAction s a (polynomial P j) = 0 := by + simpa only [freeAction,polynomial,map_add,map_sum,map_smul,map_mul,map_one, + FreeAlgebra.lift_ι_apply] using normalized_relations P s s' a b hc hr j + +/-- The genuine quotient action theta, obtained by descending the free action. -/ +noncomputable def quotientAction : + QuadraticPresentation.Original k (Fin d) (polynomial P) →ₐ[k] End X₀ := + (QuadraticPresentation.original k (Fin d) (polynomial P)).liftₐ (freeAction s a) + (RingCon.ringConGen_le.mpr (by + rintro x y ⟨j,rfl,rfl⟩ + change freeAction s a (polynomial P j) = freeAction s a 0 + rw [map_zero,freeAction_polynomial P s s' a b hc hr])) + +@[simp] theorem quotientAction_generator (h : Fin d) : + quotientAction P s s' a b hc hr + (QuadraticPresentation.originalMap k (Fin d) (polynomial P) (FreeAlgebra.ι k h)) = + normalized s a h := by + simp [quotientAction,QuadraticPresentation.originalMap,freeAction] + +/-- Transport the descended action through the actual presentation equivalence. -/ +noncomputable def presentedAction {R : Type*} [Ring R] [Algebra k R] + (E : QuadraticPresentation.Original k (Fin d) (polynomial P) ≃ₐ[k] R) : + R →ₐ[k] End X₀ := (quotientAction P s s' a b hc hr).comp E.symm.toAlgHom + +omit [Preadditive C] in +/-- Evaluation of normalized generators, with the natural vertex identifications. -/ +theorem normalized_evaluation {D : Type*} [Category D] (F : C ⥤ D) + {Y : D} (e₀ : F.obj X₀ ≅ Y) (e₁ : F.obj X₁ ≅ Y) + (x : Fin d → (Y ⟶ Y)) + (hs : F.map s ≫ e₁.hom = e₀.hom) + (ha : ∀ h, F.map (a h) ≫ e₁.hom = e₀.hom ≫ x h) (h : Fin d) : + F.map (normalized s a h) ≫ e₀.hom = e₀.hom ≫ x h := by + have hsi : F.map (inv s) ≫ e₀.hom = e₁.hom := by + apply (cancel_epi (F.map s)).mp + rw [← assoc,← F.map_comp,IsIso.hom_inv_id,F.map_id,id_comp,hs] + change F.map (a h ≫ inv s) ≫ e₀.hom = _ + rw [F.map_comp,assoc,hsi,ha] +end LittleFinitistic.QuotientAction + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/QuotientActionEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/QuotientActionEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6aaaa13d9abfb4e17dad2f36c454a2894ef960d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/QuotientActionEvaluation.lean @@ -0,0 +1,56 @@ +import OAI.Algebra.Finitistic.Localization.HomotopyVertexEvaluation +import OAI.Algebra.Finitistic.Localization.PresentedQuotientAction + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.QuadraticEncoding +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +/-- The canonical evaluation identification on each vertex of the fixed quotient. -/ +def quotientVertexIso (i : Fin 3) : + (boundedQuotientEvaluation X).obj (vertexQ P i) ≅ + (vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y)) := + (boundedQuotientEvaluationFactors X).app (vertexK P i) ≪≫ homotopyVertexIso X i + +lemma quotient_arrow01_square (h : Fin (d+1)) : + (boundedQuotientEvaluation X).map (arrowQ01 P h) ≫ (quotientVertexIso X 1).hom = + (quotientVertexIso X 0).hom ≫ (vectorStalk (k := k)).map (actionArrow X h) := by + have hn := (boundedQuotientEvaluationFactors X).hom.naturality (arrowK01 P h) + change ((boundedDenominators P).Q ⋙ boundedQuotientEvaluation X).map (arrowK01 P h) ≫ + ((boundedQuotientEvaluationFactors X).hom.app (vertexK P 1) ≫ (homotopyVertexIso X 1).hom) = + ((boundedQuotientEvaluationFactors X).hom.app (vertexK P 0) ≫ (homotopyVertexIso X 0).hom) ≫ _ + rw [← Category.assoc, hn, Category.assoc, homotopy_arrow01_square, ← Category.assoc] + +lemma quotient_arrow12_square (h : Fin (d+1)) : + (boundedQuotientEvaluation X).map (arrowQ12 P h) ≫ (quotientVertexIso X 2).hom = + (quotientVertexIso X 1).hom ≫ (vectorStalk (k := k)).map (actionArrow X h) := by + have hn := (boundedQuotientEvaluationFactors X).hom.naturality (arrowK12 P h) + change ((boundedDenominators P).Q ⋙ boundedQuotientEvaluation X).map (arrowK12 P h) ≫ + ((boundedQuotientEvaluationFactors X).hom.app (vertexK P 2) ≫ (homotopyVertexIso X 2).hom) = + ((boundedQuotientEvaluationFactors X).hom.app (vertexK P 1) ≫ (homotopyVertexIso X 1).hom) ≫ _ + rw [← Category.assoc, hn, Category.assoc, homotopy_arrow12_square, ← Category.assoc] + +@[simp] lemma actionArrow_zero : actionArrow X 0 = 𝟙 _ := by ext y; rfl + +lemma quotient_inverse_s_square : + (boundedQuotientEvaluation X).map (inv (arrowQ01 P 0)) ≫ (quotientVertexIso X 0).hom = + (quotientVertexIso X 1).hom := by + apply (cancel_epi ((boundedQuotientEvaluation X).map (arrowQ01 P 0))).mp + simp only [← Category.assoc, ← Functor.map_comp, IsIso.hom_inv_id] + symm + simpa using quotient_arrow01_square X 0 + +/-- The normalized quotient generator evaluates to the given generator on Y. -/ +theorem normalizedGenerator_evaluates (h : Fin d) : + (boundedQuotientEvaluation X).map (normalizedGenerator P h) ≫ (quotientVertexIso X 0).hom = + (quotientVertexIso X 0).hom ≫ (vectorStalk (k := k)).map (actionArrow X h.succ) := by + simp only [normalizedGenerator, Functor.map_comp, Category.assoc] + rw [quotient_inverse_s_square, quotient_arrow01_square] +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/QuotientRelations.lean b/lean/OAI/Algebra/Finitistic/Localization/QuotientRelations.lean new file mode 100644 index 0000000000000000000000000000000000000000..61a309276813c112ffbd8db1617ccdd117e0cf53 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/QuotientRelations.lean @@ -0,0 +1,117 @@ +import OAI.Algebra.Finitistic.Localization.BoundedQuotientGenerators +import OAI.Algebra.Finitistic.Localization.EvaluationFromAlgebra +import Mathlib.Algebra.Homology.HomotopyCategory.SingleFunctors +import Mathlib.Algebra.Category.ModuleCat.Algebra +import Mathlib.CategoryTheory.Localization.Linear + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.QuadraticEncoding +open Representation IdempotentTensor FiniteProjectiveHomotopy +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +instance boundedKLinear : Linear k (BoundedK P) := inferInstance +instance boundedQLinear : Linear k (BoundedQ P) := inferInstance + +lemma pathMap_target (z : Paths k d) : vertexId (P := P) 2 * pathMap P z = pathMap P z := by + change ThreeVertexAlgebra.mul (composition P) (0,0,1,0,0,0) + (0,0,0,0,0,(relationSpace P).mkQ z) = _ + simp [ThreeVertexAlgebra.mul, pathMap, lengthTwo] + +/-- Left multiplication by a length-two path, as a linear family of module maps. -/ +def pathModuleMap : Paths k d →ₗ[k] (vertexModule P 0 ⟶ vertexModule P 2) where + toFun z := ModuleCat.ofHom (leftMultiply (pathMap P z) (pathMap_target P z)) + map_add' z w := by + ext m : 2 + apply Subtype.ext + change pathMap P (z+w) * m.val = pathMap P z * m.val + pathMap P w * m.val + rw [map_add, add_mul] + map_smul' c z := by + ext m : 2 + apply Subtype.ext + change pathMap P (c • z) * m.val = (pathMap P z * m.val) * algebraMap k (B P) c + rw [map_smul, smul_mul_assoc, Algebra.smul_def, Algebra.commutes] + +lemma pathModuleMap_basis (h l : Fin (d+1)) : + pathModuleMap P (basis h ⊗ₜ[k] basis l) = arrowModule01 P l ≫ arrowModule12 P h := by + ext m : 2 + apply Subtype.ext + change pathMap P (basis h ⊗ₜ[k] basis l) * m.val = arrow12 P h * (arrow01 P l * m.val) + rw [← arrow_product, mul_assoc] + +instance degreeZeroAdditive : (degreeZero P).Additive := by + dsimp [degreeZero] + infer_instance +instance degreeZeroLinear : (degreeZero P).Linear k := + inferInstanceAs ((CochainComplex.singleFunctor (ModuleCat.{u} (B P)ᵐᵒᵖ) 0).Linear k) + +def vertexHomEquiv (i j : Fin 3) : (vertexK P i ⟶ vertexK P j) ≃ₗ[k] + ((inclusion (B P)ᵐᵒᵖ).obj (vertexK P i) ⟶ (inclusion (B P)ᵐᵒᵖ).obj (vertexK P j)) := + LinearEquiv.ofBijective ((inclusion (B P)ᵐᵒᵖ).mapLinearMap k) + ⟨(inclusion (B P)ᵐᵒᵖ).map_injective, (inclusion (B P)ᵐᵒᵖ).map_surjective⟩ + +/-- Transport module maps to the concrete degree-zero objects of K. -/ +def vertexHomMap (i j : Fin 3) : + (vertexModule P i ⟶ vertexModule P j) →ₗ[k] (vertexK P i ⟶ vertexK P j) := + (vertexHomEquiv P i j).symm.toLinearMap.comp + (((HomotopyCategory.quotient _ _).mapLinearMap k).comp ((degreeZero P).mapLinearMap k)) + +lemma vertexHomMap_eq (i j : Fin 3) (f : vertexModule P i ⟶ vertexModule P j) : + vertexHomMap P i j f = (inclusion (B P)ᵐᵒᵖ).preimage + ((HomotopyCategory.quotient _ _).map ((degreeZero P).map f)) := by + apply (inclusion (B P)ᵐᵒᵖ).map_injective + erw [Functor.map_preimage] + exact (vertexHomEquiv P i j).apply_symm_apply _ + +lemma vertexHomMap_comp {i j l : Fin 3} (f : vertexModule P i ⟶ vertexModule P j) + (g : vertexModule P j ⟶ vertexModule P l) : + vertexHomMap P i l (f ≫ g) = vertexHomMap P i j f ≫ vertexHomMap P j l g := by + rw [vertexHomMap_eq,vertexHomMap_eq,vertexHomMap_eq] + apply (inclusion (B P)ᵐᵒᵖ).map_injective + erw [(inclusion (B P)ᵐᵒᵖ).map_comp] + erw [Functor.map_preimage,Functor.map_preimage,Functor.map_preimage] + rw [(degreeZero P).map_comp] + exact (HomotopyCategory.quotient _ _).map_comp _ _ + +def pathQMap : Paths k d →ₗ[k] (vertexQ P 0 ⟶ vertexQ P 2) := + ((boundedDenominators P).Q.mapLinearMap k).comp + ((vertexHomMap P 0 2).comp (pathModuleMap P)) + +lemma pathQMap_basis (h l : Fin (d+1)) : + pathQMap P (basis h ⊗ₜ[k] basis l) = arrowQ01 P l ≫ arrowQ12 P h := by + change (boundedDenominators P).Q.map + (vertexHomMap P 0 2 (pathModuleMap P (basis h ⊗ₜ[k] basis l))) = _ + rw [pathModuleMap_basis,vertexHomMap_comp,Functor.map_comp,vertexHomMap_eq,vertexHomMap_eq] + rfl + +lemma pathModuleMap_kills (z : Paths k d) (hz : z ∈ relationSpace P) : pathModuleMap P z = 0 := by + ext m : 2 + apply Subtype.ext + change pathMap P z * m.val = 0 + rw [(pathMap_eq_zero_iff P z).mpr hz,zero_mul] + +lemma pathQMap_kills (z : Paths k d) (hz : z ∈ relationSpace P) : pathQMap P z = 0 := by + change (boundedDenominators P).Q.map (vertexHomMap P 0 2 (pathModuleMap P z)) = 0 + rw [pathModuleMap_kills P z hz,map_zero,Functor.map_zero] + +lemma quotient_commutation (h : Fin d) : + arrowQ01 P 0 ≫ arrowQ12 P h.succ = arrowQ01 P h.succ ≫ arrowQ12 P 0 := by + have hz := pathQMap_kills P (commutation h) + (Submodule.subset_span (Or.inl ⟨h,rfl⟩)) + simpa only [commutation,map_sub,pathQMap_basis,sub_eq_zero] using hz + +lemma quotient_homogenized (j : Fin t) : + (∑ h, ∑ l, P.quadratic j h l • (arrowQ01 P l.succ ≫ arrowQ12 P h.succ)) + + (∑ h, P.linear j h • (arrowQ01 P h.succ ≫ arrowQ12 P 0)) + + P.constant j • (arrowQ01 P 0 ≫ arrowQ12 P 0) = 0 := by + have hz := pathQMap_kills P (homogenized P j) + (Submodule.subset_span (Or.inr ⟨j,rfl⟩)) + simpa only [homogenized,map_add,map_sum,map_smul,pathQMap_basis] using hz +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SignedCochainShift.lean b/lean/OAI/Algebra/Finitistic/Localization/SignedCochainShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..5756039ef78769f7f6a1aef685bf991448b16b9b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SignedCochainShift.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftSign +import Mathlib.CategoryTheory.Preadditive.FunctorCategory + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BimoduleTotal +universe u v +variable (C : Type u) [Category.{v} C] [Preadditive C] + +def signedShiftIso (a s : ℤ) : + shiftFunctor (CochainComplex C ℤ) s ⋙ shiftFunctor _ a ≅ + shiftFunctor (CochainComplex C ℤ) a ⋙ shiftFunctor _ s := + OrdinarySimulation.integerUnitIso _ (a*s).negOnePow ≪≫ shiftFunctorComm _ s a + +theorem signedShiftIso_hom_f (a s n : ℤ) (K : CochainComplex C ℤ) : + ((signedShiftIso C a s).hom.app K).f n = + (a*s).negOnePow • (K.XIsoOfEq (show n+a+s=n+s+a by omega)).hom := by + simp [signedShiftIso,OrdinarySimulation.integerUnitIso, + CochainComplex.shiftFunctorComm_hom_app_f] + +/-- The standard signed commutation structure for a cochain shift. -/ +@[instance_reducible] +def signedShiftComm (a : ℤ) : (shiftFunctor (CochainComplex C ℤ) a).CommShift ℤ where + commShiftIso s := signedShiftIso C a s + commShiftIso_zero := by + ext K n + simp [signedShiftIso_hom_f,Functor.CommShift.isoZero, + CochainComplex.shiftFunctorZero_hom_app_f,CochainComplex.shiftFunctorZero_inv_app_f, + HomologicalComplex.XIsoOfEq] + commShiftIso_add s t := by + ext K n + simp [signedShiftIso_hom_f,Functor.CommShift.isoAdd_hom_app, + CochainComplex.shiftFunctorAdd_hom_app_f,CochainComplex.shiftFunctorAdd_inv_app_f, + CochainComplex.shiftFunctor_map_f',HomologicalComplex.XIsoOfEq, + Linear.units_smul_comp,Linear.comp_units_smul,smul_smul, + ← Int.negOnePow_add,mul_add] +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SingleDegreeNaturality.lean b/lean/OAI/Algebra/Finitistic/Localization/SingleDegreeNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..922cc7aa6358b6fdcbc3732c4ca35350a72f930b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SingleDegreeNaturality.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Localization.DerivedTruncationCohomology + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.DerivedTruncation +open DerivedCategory +universe u v w +variable {C : Type u} [Category.{v} C] [Abelian C] [HasDerivedCategory.{w} C] +variable (n : ℤ) + +lemma single_homology_injective {A B : C} + (f g : (singleFunctor C n).obj A ⟶ (singleFunctor C n).obj B) + (h : (homologyFunctor C n).map f = (homologyFunctor C n).map g) : f = g := by + obtain ⟨a,rfl⟩ := (singleFunctor C n).map_surjective f + obtain ⟨b,rfl⟩ := (singleFunctor C n).map_surjective g + congr 1 + let e := singleFunctorCompHomologyFunctorIso C n + apply (cancel_epi (e.app A).hom).mp + have ha : (homologyFunctor C n).map ((singleFunctor C n).map a) ≫ (e.app B).hom = + (e.app A).hom ≫ a := e.hom.naturality a + have hb : (homologyFunctor C n).map ((singleFunctor C n).map b) ≫ (e.app B).hom = + (e.app A).hom ≫ b := e.hom.naturality b + rw [← ha,← hb,h] + +lemma homology_injective {X Y : DerivedCategory C} + [X.IsGE n] [X.IsLE n] [Y.IsGE n] [Y.IsLE n] + (f g : X ⟶ Y) (h : (homologyFunctor C n).map f = (homologyFunctor C n).map g) : f = g := by + apply (cancel_epi (singleIso X n).inv).mp + apply (cancel_mono (singleIso Y n).hom).mp + apply single_homology_injective n + simp only [Functor.map_comp,h] + +variable (X : DerivedCategory C) [X.IsGE n] [X.IsLE n] + +def cohomologyAutomorphism : (homologyFunctor C n).obj X ≅ (homologyFunctor C n).obj X := + (homologyFunctor C n).mapIso (singleIso X n) ≪≫ + (singleFunctorCompHomologyFunctorIso C n).app ((homologyFunctor C n).obj X) + +/-- Normalize a single-degree identification to induce the identity on its actual cohomology. -/ +def canonicalIso : X ≅ (singleFunctor C n).obj ((homologyFunctor C n).obj X) := + singleIso X n ≪≫ (singleFunctor C n).mapIso (cohomologyAutomorphism n X).symm + +lemma canonicalIso_homology : + (homologyFunctor C n).map (canonicalIso n X).hom ≫ + ((singleFunctorCompHomologyFunctorIso C n).app ((homologyFunctor C n).obj X)).hom = 𝟙 _ := by + let e := singleFunctorCompHomologyFunctorIso C n + have hn : (homologyFunctor C n).map ((singleFunctor C n).map (cohomologyAutomorphism n X).inv) ≫ + ((singleFunctorCompHomologyFunctorIso C n).app ((homologyFunctor C n).obj X)).hom = + ((singleFunctorCompHomologyFunctorIso C n).app ((homologyFunctor C n).obj X)).hom ≫ + (cohomologyAutomorphism n X).inv := e.hom.naturality _ + dsimp only [canonicalIso,Iso.trans_hom,Functor.mapIso_hom,Iso.symm_hom] + rw [Functor.map_comp,Category.assoc,hn] + rw [← Category.assoc] + change (cohomologyAutomorphism n X).hom ≫ (cohomologyAutomorphism n X).inv = 𝟙 _ + exact Iso.hom_inv_id _ + +variable {X} {Y : DerivedCategory C} [Y.IsGE n] [Y.IsLE n] + +/-- The normalized single-degree identification commutes with every derived morphism. -/ +theorem canonicalIso_naturality (f : X ⟶ Y) : + f ≫ (canonicalIso n Y).hom = + (canonicalIso n X).hom ≫ (singleFunctor C n).map ((homologyFunctor C n).map f) := by + apply homology_injective n + apply (cancel_mono + ((singleFunctorCompHomologyFunctorIso C n).app ((homologyFunctor C n).obj Y)).hom).mp + simp only [Functor.map_comp,Category.assoc,canonicalIso_homology,Category.comp_id] + have hn : (homologyFunctor C n).map ((singleFunctor C n).map ((homologyFunctor C n).map f)) ≫ + ((singleFunctorCompHomologyFunctorIso C n).app ((homologyFunctor C n).obj Y)).hom = + ((singleFunctorCompHomologyFunctorIso C n).app ((homologyFunctor C n).obj X)).hom ≫ + (homologyFunctor C n).map f := + (singleFunctorCompHomologyFunctorIso C n).hom.naturality _ + rw [hn,← Category.assoc,canonicalIso_homology,Category.id_comp] +end LittleFinitistic.DerivedTruncation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceActionEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceActionEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8b7b025bd927fef1443a68494a912dea2a4b45b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceActionEvaluation.lean @@ -0,0 +1,100 @@ +import OAI.Algebra.Finitistic.Localization.SourceEvaluation + +namespace OAI +noncomputable section +open CategoryTheory +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SourceActionEvaluation +open QuadraticEncoding SelectionEncoding QuadraticPresentation +universe u v w +variable {k : Type u} [Field k] {R : Type w} [Ring R] [Algebra k R] +variable (E : Encoding k R) +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] + [Module R Y] [IsScalarTower k R Y] + +def representation : Representation E.relations Y := + LittleFinitistic.QuadraticEncoding.Representation.ofModule (generator E) (generator_relations E) + +abbrev evaluation := SourceEvaluation.quotientHomotopy (representation (Y := Y) E) +abbrev vertexIso := SourceEvaluation.quotientVertexIso (representation (Y := Y) E) + +def given (_E : Encoding k R) : R →ₐ[k] End ((vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y))) := + (identifiedEndHom (vectorStalk (k := k)) _ (Iso.refl _)).comp + ((liftedEndHom (k := k) (Y := Y)).comp (Algebra.lsmul k k Y)) + +def evaluated : R →ₐ[k] End ((vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y))) := + (identifiedEndHom (evaluation (Y := Y) E) _ (vertexIso (Y := Y) E 0)).comp + (SourceQuotientAction.theta E) + +lemma theta_generator (h : Fin E.generators) : + SourceQuotientAction.theta E (generator E h) = + SourceQuotientAction.a01 E.relations h.succ ≫ inv (SourceQuotientAction.a01 E.relations 0) := by + simp only [SourceQuotientAction.theta,QuotientAction.presentedAction,AlgHom.comp_apply, + AlgEquiv.coe_toAlgHom,generator,AlgEquiv.symm_apply_apply,QuotientAction.quotientAction_generator, + QuotientAction.normalized] + +lemma generator_square (h : Fin E.generators) : + (evaluation (Y := Y) E).map (SourceQuotientAction.theta E (generator E h)) ≫ + (vertexIso (Y := Y) E 0).hom = (vertexIso (Y := Y) E 0).hom ≫ + (vectorStalk (k := k)).map (liftedEndHom ((Algebra.lsmul k k Y) (generator E h))) := by + rw [theta_generator] + apply QuotientAction.normalized_evaluation (SourceQuotientAction.a01 E.relations 0) + (fun h => SourceQuotientAction.a01 E.relations h.succ) (evaluation (Y := Y) E) + (vertexIso (Y := Y) E 0) (vertexIso (Y := Y) E 1) + (fun h => (vectorStalk (k := k)).map (liftedEndHom ((Algebra.lsmul k k Y) (generator E h)))) + · simpa only [SourceEvaluation.actionArrow_zero,CategoryTheory.Functor.map_id,Category.comp_id] using + SourceEvaluation.quotient_arrow01_square (representation (Y := Y) E) 0 + · intro h + exact SourceEvaluation.quotient_arrow01_square (representation (Y := Y) E) h.succ + +lemma evaluated_generator (h : Fin E.generators) : + evaluated (Y := Y) E (generator E h) = given (Y := Y) E (generator E h) := by + have hh := congrArg (fun f => (vertexIso (Y := Y) E 0).inv ≫ f) (generator_square (Y := Y) E h) + change (vertexIso (Y := Y) E 0).inv ≫ + ((evaluation (Y := Y) E).map (SourceQuotientAction.theta E (generator E h)) ≫ + (vertexIso (Y := Y) E 0).hom) = _ at hh + dsimp [evaluated,given,identifiedEndHom] + simpa only [Category.assoc,Iso.inv_hom_id_assoc,Category.id_comp,Category.comp_id] using hh + +/-- The native theta evaluates to the entire R-action, not just its generators. -/ +theorem action_evaluates : evaluated (Y := Y) E = given (Y := Y) E := by + let q := originalMap k (Fin E.generators) (QuotientAction.polynomial E.relations) + have h : ((evaluated (Y := Y) E).comp E.equiv.toAlgHom).comp q = + ((given (Y := Y) E).comp E.equiv.toAlgHom).comp q := by + apply FreeAlgebra.hom_ext + funext a + exact evaluated_generator E a + apply AlgHom.ext + intro r + obtain ⟨f,hf⟩ := (original k (Fin E.generators) (QuotientAction.polynomial E.relations)).mkₐ_surjective + (α := k) (E.equiv.symm r) + have hr : E.equiv (q f) = r := by rw [show q f = E.equiv.symm r from hf]; exact E.equiv.apply_symm_apply r + have hh := AlgHom.congr_fun h f + simpa only [AlgHom.comp_apply,AlgEquiv.coe_toAlgHom,hr] using hh + +theorem action_square (r : R) : + (evaluation (Y := Y) E).map (SourceQuotientAction.theta E r) ≫ (vertexIso (Y := Y) E 0).hom = + (vertexIso (Y := Y) E 0).hom ≫ + (vectorStalk (k := k)).map (liftedEndHom ((Algebra.lsmul k k Y) r)) := by + have h := congrArg (fun f => (vertexIso (Y := Y) E 0).hom ≫ f) + (AlgHom.congr_fun (action_evaluates (Y := Y) E) r) + dsimp [evaluated,given,identifiedEndHom] at h + simpa only [← Category.assoc,Iso.hom_inv_id,Category.id_comp,Category.comp_id] using h + + +/-- Whole-action compatibility in the bounded finite-dimensional derived target. -/ +theorem derived_action_square (r : R) : + (SourceEvaluation.derived (representation (Y := Y) E) ⋙ derivedTargetInclusion (k := k)).map + (SourceQuotientAction.theta E r) ≫ + (SourceEvaluation.derivedVertexIso (representation (Y := Y) E) 0).hom = + (SourceEvaluation.derivedVertexIso (representation (Y := Y) E) 0).hom ≫ + DerivedCategory.Qh.map ((vectorStalk (k := k)).map (liftedEndHom ((Algebra.lsmul k k Y) r))) := by + have h := congrArg DerivedCategory.Qh.map (action_square (Y := Y) E r) + simp only [Functor.map_comp] at h + exact h + +end LittleFinitistic.SourceActionEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceCornerEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceCornerEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..034ba0192c1cd0747ad36e80a4b67ea5958a4c52 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceCornerEvaluation.lean @@ -0,0 +1,85 @@ +import OAI.Algebra.Finitistic.Localization.SourceImageEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SourceImageEvaluation +private theorem map_projection_square {C D : Type*} [Category C] [Category D] + (F : C ⥤ D) {A : D} {B I : C} (e : A ≅ F.obj B) + (p : B ⟶ I) (b : B ⟶ B) (c : I ⟶ I) (a : A ⟶ A) + (sq : a ≫ e.hom = e.hom ≫ F.map b) (h : b ≫ p = p ≫ c) : + a ≫ (e.hom ≫ F.map p) = (e.hom ≫ F.map p) ≫ F.map c := by + rw [← Category.assoc, sq, Category.assoc, ← F.map_comp, h, F.map_comp, ← Category.assoc] + +open QuadraticEncoding +universe u v w +variable {k : Type u} [Field k] {R : Type w} [Ring R] [Algebra k R] +variable (E : SelectionEncoding.Encoding k R) +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] + [Module R Y] [IsScalarTower k R Y] + +def corner (e a : R) (he : e*e=e) : U E e he ⟶ U E e he := + ⟨SourceQuotientAction.theta E (e*a*e), by + change ((SourceQuotientAction.theta E) e * (SourceQuotientAction.theta E) (e*a*e)) * + (SourceQuotientAction.theta E) e = _ + simp only [← map_mul] + congr 1 + simp only [← mul_assoc,he] + rw [mul_assoc (e*a) e e,he]⟩ + +def imageCorner (e a : R) : imageDerived (k := k) (Y := Y) e ⟶ imageDerived (k := k) (Y := Y) e := + (derivedTargetInclusion (k := k)).preimage (DerivedCategory.Qh.map + ((vectorStalk (k := k)).map (imageCornerEnd (action (k := k) (Y := Y) e).hom (action (k := k) (Y := Y) a).hom))) + +lemma corner_projection_square (e a : R) (he : e*e=e) : + (evaluation (Y := Y) E ⋙ derivedTargetInclusion (k := k)).map (SourceQuotientAction.theta E (e*a*e)) ≫ + projection (Y := Y) E e = projection (Y := Y) E e ≫ + (derivedTargetInclusion (k := k)).map (imageCorner (k := k) (Y := Y) e a) := by + unfold imageCorner + erw [Functor.map_preimage] + have h := image_corner_square (action (k := k) (Y := Y) e).hom (action (k := k) (Y := Y) a).hom (action_idem (k := k) (Y := Y) e he) + have hc : action (k := k) (Y := Y) (e*a*e) = ModuleCat.ofHom + ((action (k := k) (Y := Y) e).hom * (action (k := k) (Y := Y) a).hom * (action (k := k) (Y := Y) e).hom) := by + simp only [action,map_mul] + rfl + rw [← hc] at h + exact map_projection_square ((vectorStalk (k := k)) ⋙ DerivedCategory.Qh) + (vertexIso (Y := Y) E) (imageProjection (action (k := k) (Y := Y) e).hom) + (action (k := k) (Y := Y) (e*a*e)) + (imageCornerEnd (action (k := k) (Y := Y) e).hom (action (k := k) (Y := Y) a).hom) + ((evaluation (Y := Y) E ⋙ derivedTargetInclusion (k := k)).map + (SourceQuotientAction.theta E (e*a*e))) + (SourceActionEvaluation.derived_action_square (Y := Y) E (e*a*e)) h + +theorem completed_corner_square (e a : R) (he : e*e=e) : + (completed (Y := Y) E).map (corner E e a he) ≫ (summandImageIso (Y := Y) E e he).hom = + (summandImageIso (Y := Y) E e he).hom ≫ imageCorner (k := k) (Y := Y) e a := by + apply completedExtensionImageSquare + apply (derivedTargetInclusion (k := k)).map_injective + rw [Functor.map_comp,Functor.map_comp] + erw [Functor.map_preimage] + exact corner_projection_square E e a he + +omit [FiniteDimensional k Y] in +/-- The central corner is exactly restriction of a, on actual vectors in eY. -/ +theorem imageCorner_restriction (e a : R) (he : e*e=e) (hc : e*a=a*e) + (x : imageSpace (k := k) (Y := Y) e) : + ((imageCornerEnd (action (k := k) (Y := Y) e).hom (action (k := k) (Y := Y) a).hom) x).val = + (action (k := k) (Y := Y) a).hom x.val := by + apply imageCornerEnd_apply _ _ (action_idem (k := k) (Y := Y) e he) + have h := congrArg (fun r => (action (k := k) (Y := Y) r).hom) hc + simp only [action,map_mul] at h + exact h + +lemma selecting_action_eq_corner (e : R) (he : e*e=e) (hc : ∀ r : R,e*r=r*e) + (alpha : R →ₐ[k] R) (r : R) : + FormalSummandAction.action (SourceQuotientAction.theta E) e he hc alpha r = + corner E e (alpha r) he := by + apply Karoubi.Hom.ext + exact FormalSummandAction.action_f _ _ _ _ _ _ +end LittleFinitistic.SourceImageEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fdb4d149a28f1068cb7115e64b36b44ea43bc71 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceEvaluation.lean @@ -0,0 +1,129 @@ +import OAI.Algebra.Finitistic.Localization.SourceModelBridge +import OAI.Algebra.Finitistic.Localization.VerdierEvaluationExact + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SourceEvaluation +open QuadraticEncoding FiniteProjectiveHomotopy +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +def evaluation : SourceVerdier.K P ⥤ HomotopyCategory (ModuleCat.{max u v} k) (.up ℤ) := + SourceModelBridge.toBounded P ⋙ boundedEvaluation X +instance : (evaluation X).Additive := by unfold evaluation; infer_instance +instance : (evaluation X).Linear k := by unfold evaluation; infer_instance +instance : (evaluation X).CommShift ℤ := by unfold evaluation; infer_instance +instance : (evaluation X).IsTriangulated := by unfold evaluation; infer_instance + +def vertexIso (i : Fin 3) : + (evaluation X).obj ((SourceVerdier.stalk P).obj (SourceVerdier.E P i)) ≅ + (vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y)) := + (boundedEvaluation X).mapIso (SourceModelBridge.vertexIso P i) ≪≫ homotopyVertexIso X i + +lemma arrow01_square (a : Fin (d+1)) : + (evaluation X).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow01 P a)) ≫ + (vertexIso X 1).hom = (vertexIso X 0).hom ≫ (vectorStalk (k := k)).map (actionArrow X a) := by + have h := congrArg (fun f => (boundedEvaluation X).map f) (SourceModelBridge.vertex_arrow01 P a) + simp only [Functor.map_comp] at h + dsimp only [vertexIso,Iso.trans_hom,Functor.mapIso_hom,evaluation,Functor.comp_map] + rw [← Category.assoc,h,Category.assoc,homotopy_arrow01_square,← Category.assoc] + +lemma arrow12_square (a : Fin (d+1)) : + (evaluation X).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow12 P a)) ≫ + (vertexIso X 2).hom = (vertexIso X 1).hom ≫ (vectorStalk (k := k)).map (actionArrow X a) := by + have h := congrArg (fun f => (boundedEvaluation X).map f) (SourceModelBridge.vertex_arrow12 P a) + simp only [Functor.map_comp] at h + dsimp only [vertexIso,Iso.trans_hom,Functor.mapIso_hom,evaluation,Functor.comp_map] + rw [← Category.assoc,h,Category.assoc,homotopy_arrow12_square,← Category.assoc] + +lemma actionArrow_zero : actionArrow X 0 = 𝟙 _ := by + apply ModuleCat.hom_ext + ext y + rfl + +instance first_inverted : IsIso ((evaluation X).map (SourceVerdier.cones P).first.mor₁) := by + change IsIso ((evaluation X).map (SourceVerdier.s P)) + have : IsIso ((evaluation X).map (SourceVerdier.s P) ≫ (vertexIso X 1).hom) := by + change IsIso ((evaluation X).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow01 P 0)) ≫ _) + rw [arrow01_square,actionArrow_zero,CategoryTheory.Functor.map_id,Category.comp_id] + infer_instance + exact IsIso.of_isIso_comp_right _ (vertexIso X 1).hom +instance second_inverted : IsIso ((evaluation X).map (SourceVerdier.cones P).second.mor₁) := by + change IsIso ((evaluation X).map (SourceVerdier.s' P)) + have : IsIso ((evaluation X).map (SourceVerdier.s' P) ≫ (vertexIso X 2).hom) := by + change IsIso ((evaluation X).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow12 P 0)) ≫ _) + rw [arrow12_square,actionArrow_zero,CategoryTheory.Functor.map_id,Category.comp_id] + infer_instance + exact IsIso.of_isIso_comp_right _ (vertexIso X 2).hom + +variable [FiniteDimensional k Y] +def finite : SourceVerdier.K P ⥤ FiniteVectorHomotopy.{u,v} (k := k) := + SourceModelBridge.toBounded P ⋙ finiteEvaluation X +instance : (finite X).Additive := by unfold finite; infer_instance +instance : (finite X).CommShift ℤ := by unfold finite; infer_instance +instance : (finite X).IsTriangulated := by unfold finite; infer_instance +instance finite_first : IsIso ((finite X).map (SourceVerdier.cones P).first.mor₁) := by + have : IsIso ((inclusion k).map ((finite X).map (SourceVerdier.cones P).first.mor₁)) := + inferInstanceAs (IsIso ((evaluation X).map (SourceVerdier.cones P).first.mor₁)) + exact isIso_of_reflects_iso _ (inclusion k) +instance finite_second : IsIso ((finite X).map (SourceVerdier.cones P).second.mor₁) := by + have : IsIso ((inclusion k).map ((finite X).map (SourceVerdier.cones P).second.mor₁)) := + inferInstanceAs (IsIso ((evaluation X).map (SourceVerdier.cones P).second.mor₁)) + exact isIso_of_reflects_iso _ (inclusion k) + +def quotientFinite : SourceVerdier.Q P ⥤ FiniteVectorHomotopy.{u,v} (k := k) := + (SourceVerdier.cones P).evaluation (finite X) +def finiteFactors : SourceVerdier.q P ⋙ quotientFinite X ≅ finite X := + (SourceVerdier.cones P).evaluation_fac (finite X) +instance : (quotientFinite X).Additive := by + rw [Localization.functor_additive_iff (SourceVerdier.q P) (SourceVerdier.Sigma P)] + exact Functor.additive_of_iso (finiteFactors X).symm +instance : (quotientFinite X).CommShift ℤ := by unfold quotientFinite; infer_instance +instance : (quotientFinite X).IsTriangulated := by unfold quotientFinite; infer_instance + +def quotientHomotopy : SourceVerdier.Q P ⥤ HomotopyCategory (ModuleCat.{max u v} k) (.up ℤ) := + quotientFinite X ⋙ inclusion k +instance : (quotientHomotopy X).Additive := by unfold quotientHomotopy; infer_instance + +def homotopyFactors : SourceVerdier.q P ⋙ quotientHomotopy X ≅ evaluation X := + (Functor.associator _ _ _).symm ≪≫ Functor.isoWhiskerRight (finiteFactors X) (inclusion k) +instance : Localization.Lifting (SourceVerdier.q P) (SourceVerdier.Sigma P) + (evaluation X) (quotientHomotopy X) := ⟨homotopyFactors X⟩ +instance : (quotientHomotopy X).Linear k := + (Localization.functor_linear_iff (SourceVerdier.q P) (SourceVerdier.Sigma P) k + (evaluation X) (quotientHomotopy X)).mp inferInstance + +def quotientVertexIso (i : Fin 3) : + (quotientHomotopy X).obj (SourceQuotientAction.vertex P i) ≅ + (vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y)) := + (homotopyFactors X).app ((SourceVerdier.stalk P).obj (SourceVerdier.E P i)) ≪≫ vertexIso X i + +lemma quotient_arrow01_square (a : Fin (d+1)) : + (quotientHomotopy X).map (SourceQuotientAction.a01 P a) ≫ (quotientVertexIso X 1).hom = + (quotientVertexIso X 0).hom ≫ (vectorStalk (k := k)).map (actionArrow X a) := by + have h := (homotopyFactors X).hom.naturality ((SourceVerdier.stalk P).map (SourceVerdier.arrow01 P a)) + have h' : (quotientHomotopy X).map (SourceQuotientAction.a01 P a) ≫ + ((homotopyFactors X).app ((SourceVerdier.stalk P).obj (SourceVerdier.E P 1))).hom = + ((homotopyFactors X).app ((SourceVerdier.stalk P).obj (SourceVerdier.E P 0))).hom ≫ + (evaluation X).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow01 P a)) := h + dsimp only [quotientVertexIso,Iso.trans_hom] + rw [← Category.assoc,h',Category.assoc,arrow01_square,← Category.assoc] + +def derived : SourceVerdier.Q P ⥤ FiniteVectorDerived.{u,v} (k := k) := + quotientFinite X ⋙ (derivedEmbedding k).toEssImage +instance : (derived X).Additive := by unfold derived; infer_instance +instance : (derived X).CommShift ℤ := by unfold derived; infer_instance +instance : (derived X).IsTriangulated := by unfold derived; infer_instance + +def derivedVertexIso (i : Fin 3) : + (derived X ⋙ derivedTargetInclusion (k := k)).obj (SourceQuotientAction.vertex P i) ≅ + DerivedCategory.Qh.obj ((vectorStalk (k := k)).obj (ModuleCat.of k (ULift.{u} Y))) := + DerivedCategory.Qh.mapIso (quotientVertexIso X i) +end LittleFinitistic.SourceEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceImageEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceImageEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ddb077489e6cc0eb8dfce9fab909ff7d88cb2cc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceImageEvaluation.lean @@ -0,0 +1,101 @@ +import OAI.Algebra.Finitistic.Localization.SourceActionEvaluation +import OAI.Algebra.Finitistic.Localization.FormalSummandAction + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SourceImageEvaluation +private theorem sandwich_map_eq {C D : Type*} [Category C] [Category D] + (F : C ⥤ D) {A : D} {B I : C} (e : A ≅ F.obj B) + (p : B ⟶ I) (i : I ⟶ B) (b : B ⟶ B) (a : A ⟶ A) + (h : p ≫ i = b) (sq : a ≫ e.hom = e.hom ≫ F.map b) : + (e.hom ≫ F.map p) ≫ (F.map i ≫ e.inv) = a := by + apply (cancel_mono e.hom).mp + simp only [Category.assoc, e.inv_hom_id, Category.comp_id] + rw [← F.map_comp, h, sq] + +open QuadraticEncoding FiniteProjectiveHomotopy +universe u v w +variable {k : Type u} [Field k] {R : Type w} [Ring R] [Algebra k R] +variable (E : SelectionEncoding.Encoding k R) +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] + [Module R Y] [IsScalarTower k R Y] + +abbrev representation := SourceActionEvaluation.representation (Y := Y) E +abbrev evaluation := SourceEvaluation.derived (representation (Y := Y) E) +abbrev action (r : R) : End (ModuleCat.of k (ULift.{u} Y)) := + liftedEndHom ((Algebra.lsmul k k Y) r) +abbrev vertexIso := SourceEvaluation.derivedVertexIso (representation (Y := Y) E) 0 + +def completed : Karoubi (SourceVerdier.Q E.relations) ⥤ FiniteVectorDerived.{u,v} (k := k) := + (functorExtension _ _).obj (evaluation (Y := Y) E) +instance : (completed (Y := Y) E).Additive := completedExtensionAdditive _ +def factors : toKaroubi (SourceVerdier.Q E.relations) ⋙ completed (Y := Y) E ≅ evaluation (Y := Y) E := + completedExtensionFactors _ + +/-- Literal range of the selecting operator on the canonical universe lift of Y. -/ +abbrev imageSpace (e : R) := LinearMap.range (action (k := k) (Y := Y) e).hom + +def imageK (e : R) : K.{u,max u v} k := + ⟨(vectorStalk (k := k)).obj (ModuleCat.of k (imageSpace (k := k) (Y := Y) e)), + single_property _ 0⟩ +def imageDerived (e : R) : FiniteVectorDerived.{u,v} (k := k) := + (derivedEmbedding k).toEssImage.obj (imageK (k := k) (Y := Y) e) + +omit [FiniteDimensional k Y] in +lemma action_idem (e : R) (he : e*e=e) : + (action (k := k) (Y := Y) e).hom * (action (k := k) (Y := Y) e).hom = (action (k := k) (Y := Y) e).hom := by + have h := congrArg (fun r => (action (k := k) (Y := Y) r).hom) he + simp only [action,map_mul] at h + exact h + +abbrev U (e : R) (he : e*e=e) := FormalSummandAction.summand (SourceQuotientAction.theta E) e he + +def projection (e : R) : + (derivedTargetInclusion (k := k)).obj ((evaluation (Y := Y) E).obj (SourceQuotientAction.vertex E.relations 0)) ⟶ + (derivedTargetInclusion (k := k)).obj (imageDerived (k := k) (Y := Y) e) := + (vertexIso (Y := Y) E).hom ≫ DerivedCategory.Qh.map + ((vectorStalk (k := k)).map (imageProjection (action (k := k) (Y := Y) e).hom)) +def inclusion (e : R) : + (derivedTargetInclusion (k := k)).obj (imageDerived (k := k) (Y := Y) e) ⟶ + (derivedTargetInclusion (k := k)).obj ((evaluation (Y := Y) E).obj (SourceQuotientAction.vertex E.relations 0)) := + DerivedCategory.Qh.map ((vectorStalk (k := k)).map (imageInclusion (action (k := k) (Y := Y) e).hom)) ≫ + (vertexIso (Y := Y) E).inv + +lemma inclusion_projection (e : R) (he : e*e=e) : + inclusion (Y := Y) E e ≫ projection (Y := Y) E e = 𝟙 _ := by + dsimp only [inclusion,projection] + erw [Category.assoc,Iso.inv_hom_id_assoc] + erw [← Functor.map_comp,← Functor.map_comp,image_inclusion_projection _ (action_idem (k := k) (Y := Y) e he)] + erw [CategoryTheory.Functor.map_id,CategoryTheory.Functor.map_id] + rfl +lemma projection_inclusion (e : R) : + projection (Y := Y) E e ≫ inclusion (Y := Y) E e = + (evaluation (Y := Y) E ⋙ derivedTargetInclusion (k := k)).map (SourceQuotientAction.theta E e) := by + exact sandwich_map_eq ((vectorStalk (k := k)) ⋙ DerivedCategory.Qh) + (vertexIso (Y := Y) E) (imageProjection (action (k := k) (Y := Y) e).hom) + (imageInclusion (action (k := k) (Y := Y) e).hom) (action (k := k) (Y := Y) e) + ((evaluation (Y := Y) E ⋙ derivedTargetInclusion (k := k)).map (SourceQuotientAction.theta E e)) + (image_projection_inclusion _) (SourceActionEvaluation.derived_action_square (Y := Y) E e) + +def summandImageIso (e : R) (he : e*e=e) : + (completed (Y := Y) E).obj (U E e he) ≅ imageDerived (k := k) (Y := Y) e := + completedExtensionImageIso (evaluation (Y := Y) E) (U E e he) (imageDerived (k := k) (Y := Y) e) + ((derivedTargetInclusion (k := k)).preimage (projection (Y := Y) E e)) + ((derivedTargetInclusion (k := k)).preimage (inclusion (Y := Y) E e)) + (by + apply (derivedTargetInclusion (k := k)).map_injective + rw [Functor.map_comp] + erw [Functor.map_preimage,Functor.map_preimage] + exact projection_inclusion E e) + (by + apply (derivedTargetInclusion (k := k)).map_injective + erw [Functor.map_comp,CategoryTheory.Functor.map_id] + erw [Functor.map_preimage,Functor.map_preimage] + exact inclusion_projection E e he) +end LittleFinitistic.SourceImageEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceLinear.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..23208b4fadd069be3d20f5eadd1870e5e8380095 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceLinear.lean @@ -0,0 +1,20 @@ +import OAI.Algebra.Finitistic.Localization.SourceVerdier + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SourceVerdier +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) + +open scoped ModuleCat.Algebra in +instance linearProj : Linear k (Proj P) := inferInstance +instance linearK : Linear k (K P) := inferInstance +instance linearQ : Linear k (Q P) := inferInstance +instance linearQuotient : (q P).Linear k := inferInstance + +end LittleFinitistic.SourceVerdier + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceModelBridge.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceModelBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..79afd820f3320f15769f11a851f75a2c83441a62 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceModelBridge.lean @@ -0,0 +1,108 @@ +import OAI.Algebra.Finitistic.Localization.SourceQuotientAction +import OAI.Algebra.Finitistic.Localization.CompletedOddDoubleEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SourceModelBridge +open QuadraticEncoding FiniteProjectiveHomotopy +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +abbrev forgetProj := (ProjectiveComplexes.finiteProjective (B P)).ι +abbrev ambient : SourceVerdier.K P ⥤ HomotopyCategory (ModuleCat.{u} (B P)ᵐᵒᵖ) (.up ℤ) := + (BoundedHomotopy.bounded (SourceVerdier.Proj P)).ι ⋙ (forgetProj P).mapHomotopyCategory (.up ℤ) + +lemma ambient_property (T : SourceVerdier.K P) : objects (B P)ᵐᵒᵖ ((ambient P).obj T) := by + obtain ⟨a,b,ha,hb⟩ := (BoundedHomotopy.bounded_quotient_obj_iff _ _).mp T.property + change ComplexProperty (B P)ᵐᵒᵖ (((forgetProj P).mapHomologicalComplex (.up ℤ)).obj T.obj.as) + constructor + · refine ⟨a,b,fun i hi => ?_⟩ + apply (forgetProj P).map_isZero + rcases hi with hi | hi + · exact CochainComplex.isZero_of_isStrictlyGE T.obj.as a i hi + · exact CochainComplex.isZero_of_isStrictlyLE T.obj.as b i hi + · intro i + change Module.Finite (B P)ᵐᵒᵖ (T.obj.as.X i).obj ∧ Projective (T.obj.as.X i).obj + have := (T.obj.as.X i).property.2 + exact ⟨(T.obj.as.X i).property.1,ModuleCat.projective_of_categoryTheory_projective _⟩ + +/-- Forgetting the projective subcategory gives actual bounded projective module complexes. -/ +def toBounded : SourceVerdier.K P ⥤ BoundedK P := + (objects (B P)ᵐᵒᵖ).lift (ambient P) (ambient_property P) +instance : (toBounded P).Additive := by unfold toBounded; infer_instance +instance : (toBounded P).Linear k where + map_smul := by + intro X Y f a + apply ObjectProperty.hom_ext + exact (ambient P).map_smul a f +instance : (toBounded P).CommShift ℤ := by unfold toBounded; infer_instance +instance : (toBounded P).IsTriangulated := by unfold toBounded; infer_instance + +abbrev rightStalk := HomotopyCategory.singleFunctor (ModuleCat.{u} (B P)ᵐᵒᵖ) 0 + +def stalkUnderlyingIso (M : SourceVerdier.Proj P) : + (ambient P).obj ((SourceVerdier.stalk P).obj M) ≅ (rightStalk P).obj M.obj := + (HomotopyCategory.quotient _ _).mapIso + ((HomologicalComplex.singleMapHomologicalComplex (forgetProj P) (.up ℤ) (0 : ℤ)).app M) + +lemma stalkUnderlying_square {M N : SourceVerdier.Proj P} (f : M ⟶ N) : + (ambient P).map ((SourceVerdier.stalk P).map f) ≫ (stalkUnderlyingIso P N).hom = + (stalkUnderlyingIso P M).hom ≫ (rightStalk P).map f.hom := by + have h := (HomologicalComplex.singleMapHomologicalComplex + (forgetProj P) (.up ℤ) (0 : ℤ)).hom.naturality f + have h' := congrArg (fun g => (HomotopyCategory.quotient _ _).map g) h + change ((forgetProj P).mapHomotopyCategory (.up ℤ)).map + ((HomotopyCategory.quotient _ _).map + ((HomologicalComplex.single (SourceVerdier.Proj P) (.up ℤ) (0 : ℤ)).map f)) ≫ _ = _ + rw [Functor.mapHomotopyCategory_map] + simp only [Functor.map_comp, Functor.comp_map] at h' + exact h' + + +def vertexIso (i : Fin 3) : + (toBounded P).obj ((SourceVerdier.stalk P).obj (SourceVerdier.E P i)) ≅ vertexK P i := + (inclusion (B P)ᵐᵒᵖ).preimageIso + (stalkUnderlyingIso P (SourceVerdier.E P i) ≪≫ + (rightStalk P).mapIso (SourceQuotientAction.vertexIso P i)) + +lemma vertex_arrow01 (a : Fin (d+1)) : + (toBounded P).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow01 P a)) ≫ + (vertexIso P 1).hom = (vertexIso P 0).hom ≫ arrowK01 P a := by + apply (inclusion (B P)ᵐᵒᵖ).map_injective + simp only [Functor.map_comp,vertexIso,Functor.preimageIso,Functor.map_preimage] + change (ambient P).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow01 P a)) ≫ + ((stalkUnderlyingIso P (SourceVerdier.E P 1)).hom ≫ + (rightStalk P).map (SourceQuotientAction.vertexIso P 1).hom) = _ + rw [← Category.assoc,stalkUnderlying_square,Category.assoc,← Functor.map_comp] + have h := congrArg (fun f => f.hom ≫ (SourceQuotientAction.vertexIso P 1).hom) + (SourceQuotientAction.nativeHom_arrow01 P a) + dsimp [SourceQuotientAction.nativeHom] at h + simp only [Category.assoc,Iso.inv_hom_id,Category.comp_id] at h + rw [← h,Functor.map_comp] + unfold arrowK01 + erw [Functor.map_preimage] + exact (Category.assoc _ _ _).symm + +lemma vertex_arrow12 (a : Fin (d+1)) : + (toBounded P).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow12 P a)) ≫ + (vertexIso P 2).hom = (vertexIso P 1).hom ≫ arrowK12 P a := by + apply (inclusion (B P)ᵐᵒᵖ).map_injective + simp only [Functor.map_comp,vertexIso,Functor.preimageIso,Functor.map_preimage] + change (ambient P).map ((SourceVerdier.stalk P).map (SourceVerdier.arrow12 P a)) ≫ + ((stalkUnderlyingIso P (SourceVerdier.E P 2)).hom ≫ + (rightStalk P).map (SourceQuotientAction.vertexIso P 2).hom) = _ + rw [← Category.assoc,stalkUnderlying_square,Category.assoc,← Functor.map_comp] + have h := congrArg (fun f => f.hom ≫ (SourceQuotientAction.vertexIso P 2).hom) + (SourceQuotientAction.nativeHom_arrow12 P a) + dsimp [SourceQuotientAction.nativeHom] at h + simp only [Category.assoc,Iso.inv_hom_id,Category.comp_id] at h + rw [← h,Functor.map_comp] + unfold arrowK12 + erw [Functor.map_preimage] + exact (Category.assoc _ _ _).symm +end LittleFinitistic.SourceModelBridge + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceOddDoubleEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceOddDoubleEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..94ce860c995fb15b42efe0eaa29a72944f081f77 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceOddDoubleEvaluation.lean @@ -0,0 +1,88 @@ +import OAI.Algebra.Finitistic.Localization.SourceCornerEvaluation +import OAI.Algebra.Finitistic.Rectification.BiprodEvaluationSquare + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Idempotents CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SourceImageEvaluation +private theorem compose_square {C : Type*} [Category C] {A B D : C} + (f : A ⟶ A) (g : B ⟶ B) (h : D ⟶ D) (e : A ⟶ B) (p : B ⟶ D) + (he : f ≫ e = e ≫ g) (hp : g ≫ p = p ≫ h) : + f ≫ (e ≫ p) = (e ≫ p) ≫ h := by + rw [← Category.assoc, he, Category.assoc, hp, ← Category.assoc] + +open QuadraticEncoding +universe u v w +variable {k : Type u} [Field k] {R : Type w} [Ring R] [Algebra k R] +variable (E : SelectionEncoding.Encoding k R) +variable {Y : Type v} [AddCommGroup Y] [Module k Y] [FiniteDimensional k Y] + [Module R Y] [IsScalarTower k R Y] + +/-- The additive extension respects the native formal shift. -/ +def shiftIso (n : ℤ) : + OddDouble.formalShiftFunctor (C := SourceVerdier.Q E.relations) n ⋙ completed (Y := Y) E ≅ + completed (Y := Y) E ⋙ shiftFunctor (FiniteVectorDerived.{u,v} (k := k)) n := + completedCommutationIso (evaluation (Y := Y) E) _ _ ((evaluation (Y := Y) E).commShiftIso n) + +def shiftedImageIso (e : R) (he : e*e=e) (n : ℤ) : + (completed (Y := Y) E).obj (OddDouble.formalShift (U E e he) n) ≅ + (imageDerived (k := k) (Y := Y) e)⟦n⟧ := + (shiftIso (Y := Y) E n).app (U E e he) ≪≫ + (shiftFunctor _ n).mapIso (summandImageIso (Y := Y) E e he) + +theorem shifted_corner_square (e a : R) (he : e*e=e) (n : ℤ) : + (completed (Y := Y) E).map ((OddDouble.formalShiftFunctor n).map (corner E e a he)) ≫ + (shiftedImageIso (Y := Y) E e he n).hom = + (shiftedImageIso (Y := Y) E e he n).hom ≫ (imageCorner (k := k) (Y := Y) e a)⟦n⟧' := by + have hn := (shiftIso (Y := Y) E n).hom.naturality (corner E e a he) + have hm := congrArg (shiftFunctor (FiniteVectorDerived.{u,v} (k := k)) n).map + (completed_corner_square (Y := Y) E e a he) + simp only [Functor.map_comp] at hm + exact compose_square _ _ _ _ _ hn hm + +local instance : HasFiniteBiproducts (Karoubi (SourceVerdier.Q E.relations)) := + Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi (SourceVerdier.Q E.relations)) := + hasBinaryBiproducts_of_finite_biproducts _ +local instance : PreservesBinaryBiproducts (completed (Y := Y) E) := + preservesBinaryBiproducts_of_preservesBiproducts _ + +def oddDoubleImageIso (e : R) (he : e*e=e) : + (completed (Y := Y) E).obj (U E e he ⊞ OddDouble.formalShift (U E e he) 3) ≅ + imageDerived (k := k) (Y := Y) e ⊞ (imageDerived (k := k) (Y := Y) e)⟦(3 : ℤ)⟧ := + (completed (Y := Y) E).mapBiprod _ _ ≪≫ + biprod.mapIso (summandImageIso (Y := Y) E e he) (shiftedImageIso (Y := Y) E e he 3) + +theorem oddDouble_corner_square (e a : R) (he : e*e=e) : + (completed (Y := Y) E).map + (biprod.map (corner E e a he) ((OddDouble.formalShiftFunctor 3).map (corner E e a he))) ≫ + (oddDoubleImageIso (Y := Y) E e he).hom = + (oddDoubleImageIso (Y := Y) E e he).hom ≫ + biprod.map (imageCorner (k := k) (Y := Y) e a) ((imageCorner (k := k) (Y := Y) e a)⟦(3 : ℤ)⟧') := by + exact BiprodEvaluationSquare.square (completed (Y := Y) E) + (corner E e a he) ((OddDouble.formalShiftFunctor 3).map (corner E e a he)) + (summandImageIso (Y := Y) E e he) (shiftedImageIso (Y := Y) E e he 3) + (imageCorner (k := k) (Y := Y) e a) ((imageCorner (k := k) (Y := Y) e a)⟦(3 : ℤ)⟧') + (completed_corner_square E e a he) (shifted_corner_square E e a he 3) + +theorem oddDouble_selecting_square (e : R) (he : e*e=e) (hc : ∀ r : R,e*r=r*e) + (alpha : R →ₐ[k] R) (r : R) : + (completed (Y := Y) E).map + (FormalSummandAction.oddDoubleAction (SourceQuotientAction.theta E) e he hc alpha r) ≫ + (oddDoubleImageIso (Y := Y) E e he).hom = + (oddDoubleImageIso (Y := Y) E e he).hom ≫ + biprod.map (imageCorner (k := k) (Y := Y) e (alpha r)) ((imageCorner (k := k) (Y := Y) e (alpha r))⟦(3 : ℤ)⟧') := by + have hc' := selecting_action_eq_corner E e he hc alpha r + have hd := (BiprodEvaluationSquare.action_formula + (SourceQuotientAction.theta E) e he hc alpha r).trans + (congrArg₂ (fun f g => biprod.map f g) hc' + (congrArg (OddDouble.formalShiftFunctor 3).map hc')) + exact (congrArg (fun f => (completed (Y := Y) E).map f ≫ + (oddDoubleImageIso (Y := Y) E e he).hom) hd).trans + (oddDouble_corner_square E e (alpha r) he) +end LittleFinitistic.SourceImageEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceQuotientAction.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceQuotientAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e00273d9386d25460aa9ae10e4dadb9b35d78b2 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceQuotientAction.lean @@ -0,0 +1,119 @@ +import OAI.Algebra.Finitistic.Localization.SourceShiftLinear +import OAI.Algebra.Finitistic.Localization.ConcreteTensorEvaluation +import OAI.Algebra.Finitistic.Localization.QuotientRelations +import OAI.Algebra.Finitistic.Localization.QuotientAction +import OAI.Algebra.Finitistic.Selection.SelectionEncoding + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.SourceQuotientAction +open QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The two concrete presentations of the same right ideal e_i B. -/ +def vertexIso (i : Fin 3) : (SourceVerdier.E P i).obj ≅ vertexModule P i := + (ConcreteTensorEvaluation.idealEquiv (SourceVerdier.vertex P i) + (SourceVerdier.vertex_idem P i)).toModuleIso + +def nativeHom (i j : Fin 3) : + (vertexModule P i ⟶ vertexModule P j) →ₗ[k] + (SourceVerdier.E P i ⟶ SourceVerdier.E P j) where + toFun f := ObjectProperty.homMk ((vertexIso P i).hom ≫ f ≫ (vertexIso P j).inv) + map_add' f g := by + apply ObjectProperty.hom_ext + change (vertexIso P i).hom ≫ (f+g) ≫ (vertexIso P j).inv = + (vertexIso P i).hom ≫ f ≫ (vertexIso P j).inv + + (vertexIso P i).hom ≫ g ≫ (vertexIso P j).inv + simp [Preadditive.comp_add,Preadditive.add_comp] + map_smul' a f := by + apply ObjectProperty.hom_ext + change (vertexIso P i).hom ≫ (a • f) ≫ (vertexIso P j).inv = + a • ((vertexIso P i).hom ≫ f ≫ (vertexIso P j).inv) + simp + +lemma nativeHom_comp {i j l : Fin 3} + (f : vertexModule P i ⟶ vertexModule P j) (g : vertexModule P j ⟶ vertexModule P l) : + nativeHom P i l (f ≫ g) = nativeHom P i j f ≫ nativeHom P j l g := by + apply ObjectProperty.hom_ext + change _ = ((vertexIso P i).hom ≫ f ≫ (vertexIso P j).inv) ≫ + ((vertexIso P j).hom ≫ g ≫ (vertexIso P l).inv) + simp [nativeHom] + +lemma nativeHom_arrow01 (a : Fin (d+1)) : + nativeHom P 0 1 (arrowModule01 P a) = SourceVerdier.arrow01 P a := by + apply ObjectProperty.hom_ext + apply ModuleCat.hom_ext + ext x + rfl +lemma nativeHom_arrow12 (a : Fin (d+1)) : + nativeHom P 1 2 (arrowModule12 P a) = SourceVerdier.arrow12 P a := by + apply ObjectProperty.hom_ext + apply ModuleCat.hom_ext + ext x + rfl + +instance singleAdditive : (HomologicalComplex.single (SourceVerdier.Proj P) (.up ℤ) (0 : ℤ)).Additive := + inferInstanceAs ((CochainComplex.singleFunctor (SourceVerdier.Proj P) 0).Additive) +instance singleLinear : (HomologicalComplex.single (SourceVerdier.Proj P) (.up ℤ) (0 : ℤ)).Linear k := + inferInstanceAs ((CochainComplex.singleFunctor (SourceVerdier.Proj P) 0).Linear k) +instance stalkAdditive : (SourceVerdier.stalk P).Additive := by + unfold SourceVerdier.stalk + infer_instance +instance stalkLinear : (SourceVerdier.stalk P).Linear k where + map_smul := by + intro X Y f a + apply ObjectProperty.hom_ext + exact (HomologicalComplex.single (SourceVerdier.Proj P) (.up ℤ) (0 : ℤ) ⋙ + HomotopyCategory.quotient _ _).map_smul a f + +abbrev vertex (i : Fin 3) : SourceVerdier.Q P := + (SourceVerdier.q P).obj ((SourceVerdier.stalk P).obj (SourceVerdier.E P i)) +abbrev a01 (a : Fin (d+1)) : vertex P 0 ⟶ vertex P 1 := + (SourceVerdier.stalk P ⋙ SourceVerdier.q P).map (SourceVerdier.arrow01 P a) +abbrev a12 (a : Fin (d+1)) : vertex P 1 ⟶ vertex P 2 := + (SourceVerdier.stalk P ⋙ SourceVerdier.q P).map (SourceVerdier.arrow12 P a) +instance : IsIso (a01 P 0) := SourceVerdier.s_inverted P +instance : IsIso (a12 P 0) := SourceVerdier.s'_inverted P + +def path : Paths k d →ₗ[k] (vertex P 0 ⟶ vertex P 2) := + ((SourceVerdier.stalk P ⋙ SourceVerdier.q P).mapLinearMap k).comp + ((nativeHom P 0 2).comp (pathModuleMap P)) + +lemma path_basis (h l : Fin (d+1)) : + path P (basis h ⊗ₜ[k] basis l) = a01 P l ≫ a12 P h := by + change (SourceVerdier.stalk P ⋙ SourceVerdier.q P).map + (nativeHom P 0 2 (pathModuleMap P (basis h ⊗ₜ[k] basis l))) = _ + rw [pathModuleMap_basis,nativeHom_comp,nativeHom_arrow01,nativeHom_arrow12,Functor.map_comp] + +lemma path_kills (z : Paths k d) (hz : z ∈ relationSpace P) : path P z = 0 := by + change (SourceVerdier.stalk P ⋙ SourceVerdier.q P).map + (nativeHom P 0 2 (pathModuleMap P z)) = 0 + rw [pathModuleMap_kills P z hz,map_zero,Functor.map_zero] + +lemma commutation (h : Fin d) : a01 P 0 ≫ a12 P h.succ = a01 P h.succ ≫ a12 P 0 := by + have hz := path_kills P (QuadraticEncoding.commutation h) + (Submodule.subset_span (Or.inl ⟨h,rfl⟩)) + simpa only [QuadraticEncoding.commutation,map_sub,path_basis,sub_eq_zero] using hz + +lemma homogenized (j : Fin t) : + (∑ h, ∑ l, P.quadratic j h l • (a01 P l.succ ≫ a12 P h.succ)) + + (∑ h, P.linear j h • (a01 P h.succ ≫ a12 P 0)) + + P.constant j • (a01 P 0 ≫ a12 P 0) = 0 := by + have hz := path_kills P (QuadraticEncoding.homogenized P j) + (Submodule.subset_span (Or.inr ⟨j,rfl⟩)) + simpa only [QuadraticEncoding.homogenized,map_add,map_sum,map_smul,path_basis] using hz + +/-- The actual theta on E0 in the primary's source Verdier quotient. -/ +def theta {R : Type*} [Ring R] [Algebra k R] (E : SelectionEncoding.Encoding k R) : + R →ₐ[k] End (vertex E.relations 0) := + QuotientAction.presentedAction E.relations (a01 E.relations 0) (a12 E.relations 0) + (fun h => a01 E.relations h.succ) (fun h => a12 E.relations h.succ) + (commutation E.relations) (homogenized E.relations) E.equiv +end LittleFinitistic.SourceQuotientAction + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceShiftLinear.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceShiftLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ce2a4d9c0a223681788121835c2c3f0a8548e9c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceShiftLinear.lean @@ -0,0 +1,33 @@ +import OAI.Algebra.Finitistic.Localization.SourceLinear + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SourceVerdier +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) + +/-- Scalar action commutes with shifts on bounded projective homotopy complexes. -/ +instance shiftLinearK (n : ℤ) : (shiftFunctor (K P) n).Linear k := by + let I := (BoundedHomotopy.bounded (Proj P)).ι + have : (shiftFunctor (K P) n ⋙ I).Linear k := + Functor.linear_of_iso k (I.commShiftIso n).symm + constructor + intro X Y f a + apply I.map_injective + rw [I.map_smul] + exact (shiftFunctor (K P) n ⋙ I).map_smul a f + +/-- Scalar action commutes with shifts on the actual source Verdier quotient. -/ +instance shiftLinearQ (n : ℤ) : (shiftFunctor (Q P) n).Linear k := by + let : Localization.Lifting (q P) (Sigma P) + (shiftFunctor (K P) n ⋙ q P) (shiftFunctor (Q P) n) := + ⟨((q P).commShiftIso n).symm⟩ + exact (Localization.functor_linear_iff (q P) (Sigma P) k + (shiftFunctor (K P) n ⋙ q P) (shiftFunctor (Q P) n)).mp inferInstance + +end LittleFinitistic.SourceVerdier + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SourceVerdier.lean b/lean/OAI/Algebra/Finitistic/Localization/SourceVerdier.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a247ca903725a205c39ecb37ef29e8a85e1177e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SourceVerdier.lean @@ -0,0 +1,89 @@ +import OAI.Algebra.Finitistic.Rectification.VertexProjectives +import OAI.Algebra.Finitistic.Encoding.QuadraticEncoding +import OAI.Algebra.Finitistic.Localization.TwoConeVerdier + +namespace OAI +noncomputable section +open CategoryTheory Limits Category Pretriangulated +namespace LittleFinitistic.SourceVerdier +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) + +open QuadraticEncoding +abbrev Proj := ProjectiveComplexes.Proj (B P) +abbrev K := ProjectiveComplexes.K (B P) + +/-- The manuscript's specified vertex idempotent. -/ +abbrev vertex (i : Fin 3) : B P := ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) i + +theorem vertex_idem (i : Fin 3) : vertex P i * vertex P i = vertex P i := + (ThreeVertexAlgebra.directedSystem (QuadraticEncoding.composition P)).idem i + +/-- E_i = e_i B as an actual finite projective right module. -/ +def E (i : Fin 3) : Proj P := VertexProjectives.object (vertex P i) (vertex_idem P i) + +theorem target01 (i : Fin (d+1)) : vertex P 1 * QuadraticEncoding.arrow01 P i = + QuadraticEncoding.arrow01 P i := by + ext <;> simp [vertex, ThreeVertexAlgebra.vertex, QuadraticEncoding.arrow01, + ThreeVertexAlgebra.mul] + +theorem target12 (i : Fin (d+1)) : vertex P 2 * QuadraticEncoding.arrow12 P i = + QuadraticEncoding.arrow12 P i := by + ext <;> simp [vertex, ThreeVertexAlgebra.vertex, QuadraticEncoding.arrow12, + ThreeVertexAlgebra.mul] + +/-- The actual right-module arrow maps, given by left multiplication. -/ +def arrow01 (i : Fin (d+1)) : E P 0 ⟶ E P 1 := + VertexProjectives.arrow (vertex_idem P 0) (vertex_idem P 1) + (QuadraticEncoding.arrow01 P i) (target01 P i) +def arrow12 (i : Fin (d+1)) : E P 1 ⟶ E P 2 := + VertexProjectives.arrow (vertex_idem P 1) (vertex_idem P 2) + (QuadraticEncoding.arrow12 P i) (target12 P i) + +/-- Regard a projective as a bounded complex concentrated in degree zero. -/ +def stalk : Proj P ⥤ K P := + ObjectProperty.lift _ + (HomologicalComplex.single (Proj P) (.up ℤ) 0 ⋙ HomotopyCategory.quotient _ _) + (fun _ => (BoundedHomotopy.bounded_quotient_obj_iff _ _).mpr + ⟨0,0,inferInstance,inferInstance⟩) + +def s : (stalk P).obj (E P 0) ⟶ (stalk P).obj (E P 1) := (stalk P).map (arrow01 P 0) +def s' : (stalk P).obj (E P 1) ⟶ (stalk P).obj (E P 2) := (stalk P).map (arrow12 P 0) + +/-- The cone choices are made once, in K, before any evaluation module is chosen. -/ +def cones : TwoConeVerdier.ConePair (K P) := by + let H := distinguished_cocone_triangle (s P) + let H' := distinguished_cocone_triangle (s' P) + exact ⟨Triangle.mk (s P) H.choose_spec.choose H.choose_spec.choose_spec.choose, + Triangle.mk (s' P) H'.choose_spec.choose H'.choose_spec.choose_spec.choose, + H.choose_spec.choose_spec.choose_spec, H'.choose_spec.choose_spec.choose_spec⟩ + +@[simp] theorem cones_first : (cones P).first.mor₁ = s P := rfl +@[simp] theorem cones_second : (cones P).second.mor₁ = s' P := rfl + +/-- Exactly the thick closure of Cone(s), Cone(s'). -/ +abbrev S : ObjectProperty (K P) := (cones P).S +abbrev Sigma : MorphismProperty (K P) := (cones P).Sigma +/-- Section 3's actual Verdier quotient K/S. -/ +abbrev Q := (cones P).Q +abbrev q : K P ⥤ Q P := (cones P).q + +/-- The actual, proved fraction and localization hypotheses needed by DiagramLifting. -/ +theorem fraction_calculus : (Sigma P).HasRightCalculusOfFractions := inferInstance +theorem localization : (q P).IsLocalization (Sigma P) := inferInstance +theorem triangulated : IsTriangulated (Q P) := inferInstance + +instance s_inverted : IsIso ((q P).map (s P)) := + inferInstanceAs (IsIso ((cones P).q.map (cones P).first.mor₁)) +instance s'_inverted : IsIso ((q P).map (s' P)) := + inferInstanceAs (IsIso ((cones P).q.map (cones P).second.mor₁)) + +theorem zero_fraction {X Y : K P} (f : X ⟶ Y) (hf : (q P).map f = 0) : + ∃ (Z : K P) (v : Z ⟶ X), Sigma P v ∧ v ≫ f = 0 := + (cones P).zero_fraction f hf + +end LittleFinitistic.SourceVerdier + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/SplitComponentExact.lean b/lean/OAI/Algebra/Finitistic/Localization/SplitComponentExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad751ab0a16635e7853e1aa801fe78e3d2a59466 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/SplitComponentExact.lean @@ -0,0 +1,65 @@ +import OAI.Algebra.Finitistic.Rectification.TotalExact +import Mathlib.Algebra.Homology.HomologicalComplexLimits + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace ExternalTensor.Section4.SourceFiltration +universe u +variable {S : Type u} [Ring S] +variable {X Y Z : CochainComplex (ModuleCat.{u} S) ℤ} + +/-- A specified degreewise splitting proves exactness for its original maps. -/ +theorem component_shortExact (i : X ⟶ Y) (q : Y ⟶ Z) + (r : Y ⟶ X) (s : Z ⟶ Y) + (hi : i ≫ r = 𝟙 _) (hq : s ≫ q = 𝟙 _) + (hz : i ≫ q = 0) (hs : r ≫ i + q ≫ s = 𝟙 _) (n : ℤ) : + Function.Injective (i.f n) ∧ Function.Exact (i.f n) (q.f n) ∧ + Function.Surjective (q.f n) := by + have hi' (x : X.X n) : r.f n (i.f n x) = x := + congrArg (fun a : X ⟶ X => a.f n x) hi + have hq' (z : Z.X n) : q.f n (s.f n z) = z := + congrArg (fun a : Z ⟶ Z => a.f n z) hq + have hz' (x : X.X n) : q.f n (i.f n x) = 0 := + congrArg (fun a : X ⟶ Z => a.f n x) hz + have hs' (y : Y.X n) : i.f n (r.f n y) + s.f n (q.f n y) = y := + congrArg (fun a : Y ⟶ Y => a.f n y) hs + refine ⟨?_, ?_, ?_⟩ + · intro x y he + simpa only [hi'] using congrArg (r.f n) he + · intro y + constructor + · intro hy + exact ⟨r.f n y, by simpa [hy] using hs' y⟩ + · rintro ⟨x, rfl⟩ + exact hz' x + · intro z + exact ⟨s.f n z, hq' z⟩ + +variable (X Y : CochainComplex (ModuleCat.{u} S) ℤ) +theorem inr_fst_shortExact (n : ℤ) : + Function.Injective ((biprod.inr : Y ⟶ X ⊞ Y).f n) ∧ + Function.Exact ((biprod.inr : Y ⟶ X ⊞ Y).f n) + ((biprod.fst : X ⊞ Y ⟶ X).f n) ∧ + Function.Surjective ((biprod.fst : X ⊞ Y ⟶ X).f n) := by + apply component_shortExact _ _ biprod.snd biprod.inl (by simp) (by simp) (by simp) + simp [add_comm] + +theorem zero_id_shortExact (Z : CochainComplex (ModuleCat.{u} S) ℤ) + (hZ : ∀ n, Subsingleton (Z.X n)) (n : ℤ) : + Function.Injective ((0 : Z ⟶ X).f n) ∧ + Function.Exact ((0 : Z ⟶ X).f n) ((𝟙 X : X ⟶ X).f n) ∧ + Function.Surjective ((𝟙 X : X ⟶ X).f n) := by + let := hZ n + refine ⟨fun _ _ _ => Subsingleton.elim _ _, ?_, fun x => ⟨x, rfl⟩⟩ + intro x + constructor + · intro hx + exact ⟨0, hx.symm⟩ + · rintro ⟨z, rfl⟩ + rfl +end ExternalTensor.Section4.SourceFiltration + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TensorCohomologyDiagram.lean b/lean/OAI/Algebra/Finitistic/Localization/TensorCohomologyDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e622dfb31c1f53ad9f8f5e1566a182e4b9f4800 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TensorCohomologyDiagram.lean @@ -0,0 +1,83 @@ +import OAI.Algebra.Finitistic.Rectification.FullTensorRectification + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.TensorCohomologyDiagram +open ExternalTensor.Section4 QuadraticEncoding FullTensorRectification +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) +variable (N : Type u) [AddCommGroup N] [Module k N] [Module (B P) N] + +/-- From cohomology of an evaluated representative to the actual vertex of +cohomology of the full B-module tensor complex. -/ +def comparison (v : Fin 3) (n : ℤ) : (source P D₀ D₁ D₂ N v).homology n ⟶ + (LeftVertexHomology.vertex k (B P) (ThreeVertexAlgebra.vertex (composition P) v)).obj + ((tensor P D₀ D₁ D₂ f g H N).homology n) := + homologyMap (iota P D₀ D₁ D₂ f g H N v) n ≫ + (VertexHomology.iso (algebraMap k (B P)) (ThreeVertexAlgebra.vertex (composition P) v) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem v) + (LeftVertexHomology.scalar_commute k (B P) _) (tensor P D₀ D₁ D₂ f g H N) n).hom + +/-- The canonical cohomology comparison is invertible under the proved input hypotheses. -/ +theorem comparison_isIso (v : Fin 3) (n lo hi : ℤ) + (b₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (b₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (b₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) + (p₀ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₀.X n)) + (p₁ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₁.X n)) + (p₂ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₂.X n)) : + IsIso (comparison P D₀ D₁ D₂ f g H N v n) := by + obtain ⟨E,hE⟩ := FullTensorRectification.equivalence P D₀ D₁ D₂ f g H N + v lo hi b₀ b₁ b₂ p₀ p₁ p₂ + have : IsIso (homologyMap (iota P D₀ D₁ D₂ f g H N v) n) := by + rw [← hE] + exact (E.toHomologyIso n).isIso_hom + unfold comparison + infer_instance + +/-- The first-family cohomology square retains the full original arrow action. -/ +theorem arrow01_square (a : Fin (d+1)) (n : ℤ) : + homologyMap (((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).map (f a)) n ≫ + comparison P D₀ D₁ D₂ f g H N 1 n = + comparison P D₀ D₁ D₂ f g H N 0 n ≫ + (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 0) + (ThreeVertexAlgebra.vertex (composition P) 1) (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a)).app + ((tensor P D₀ D₁ D₂ f g H N).homology n) := by + have h := (FullTensorRectification.compatibility01 P D₀ D₁ D₂ f g H N a).homologyMap_eq n + erw [homologyMap_comp (iota P D₀ D₁ D₂ f g H N 0) + (arrow01Map P D₀ D₁ D₂ f g H N a) n, + homologyMap_comp (((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).map (f a)) + (iota P D₀ D₁ D₂ f g H N 1) n] at h + dsimp only [comparison] + erw [← Category.assoc, ← h, Category.assoc] + erw [LeftVertexHomology.arrow_homology] + exact (Category.assoc _ _ _).symm + +/-- The second-family cohomology square retains the full original arrow action. -/ +theorem arrow12_square (b : Fin (d+1)) (n : ℤ) : + homologyMap (((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).map (g b)) n ≫ + comparison P D₀ D₁ D₂ f g H N 2 n = + comparison P D₀ D₁ D₂ f g H N 1 n ≫ + (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 1) + (ThreeVertexAlgebra.vertex (composition P) 2) (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b)).app + ((tensor P D₀ D₁ D₂ f g H N).homology n) := by + have h := (FullTensorRectification.compatibility12 P D₀ D₁ D₂ f g H N b).homologyMap_eq n + erw [homologyMap_comp (iota P D₀ D₁ D₂ f g H N 1) + (arrow12Map P D₀ D₁ D₂ f g H N b) n, + homologyMap_comp (((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).map (g b)) + (iota P D₀ D₁ D₂ f g H N 2) n] at h + dsimp only [comparison] + erw [← Category.assoc, ← h, Category.assoc] + erw [LeftVertexHomology.arrow_homology] + exact (Category.assoc _ _ _).symm +end LittleFinitistic.TensorCohomologyDiagram + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TensorEvaluationComparison.lean b/lean/OAI/Algebra/Finitistic/Localization/TensorEvaluationComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee1ff75edd5b623ebb565b07f61aed8f3860e831 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TensorEvaluationComparison.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.Finitistic.Localization.TensorEvaluationFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BalancedTensor +universe u v w z +variable {k : Type u} [Field k] {A : Type v} [Ring A] [Algebra k A] +variable (M : Type w) [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] + [IsScalarTower k Aᵐᵒᵖ M] +variable (N : Type z) [AddCommGroup N] [Module k N] [Module A N] + +def fromScalarModule : ScalarModule k A (ModuleCat.of Aᵐᵒᵖ M) →ₗ[Aᵐᵒᵖ] M where + toFun m := m + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def toScalarModule : M →ₗ[Aᵐᵒᵖ] ScalarModule k A (ModuleCat.of Aᵐᵒᵖ M) where + toFun m := m + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- Compare the functor's canonical scalar restriction with an existing compatible k-action. -/ +def tensorFunctorEquiv : + (tensorFunctor k A N).obj (ModuleCat.of Aᵐᵒᵖ M) ≃ₗ[k] Tensor k A M N where + __ := mapLeft (k := k) N (fromScalarModule (k := k) M) + invFun := mapLeft (k := k) N (toScalarModule (k := k) M) + left_inv z := by + change mapLeft (k := k) N (toScalarModule (k := k) M) + (mapLeft (k := k) N (fromScalarModule (k := k) M) z) = z + induction z using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha a b h₁ h₂ => + simp only [map_add] + exact congrArg₂ (fun a b => a+b) h₁ h₂ + right_inv z := by + change mapLeft (k := k) N (fromScalarModule (k := k) M) + (mapLeft (k := k) N (toScalarModule (k := k) M) z) = z + induction z using BalancedTensor.induction_on with + | hz => simp + | ht m n => rfl + | ha a b h₁ h₂ => + simp only [map_add] + exact congrArg₂ (fun a b => a+b) h₁ h₂ + +@[simp] theorem tensorFunctorEquiv_mk (m : ScalarModule k A (ModuleCat.of Aᵐᵒᵖ M)) (n : N) : + tensorFunctorEquiv M N (mk k A (ScalarModule k A (ModuleCat.of Aᵐᵒᵖ M)) N m n) = + mk k A M N m n := rfl +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TensorEvaluationFunctor.lean b/lean/OAI/Algebra/Finitistic/Localization/TensorEvaluationFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d47cc64b82b49fd21335bb8fc939873e3b42921 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TensorEvaluationFunctor.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedTensorMaps +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BalancedTensor +universe u v w z +variable (k : Type u) [Field k] (A : Type v) [Ring A] [Algebra k A] + +abbrev ScalarModule (M : ModuleCat.{w} Aᵐᵒᵖ) := + (ModuleCat.restrictScalars (algebraMap k Aᵐᵒᵖ)).obj M + +instance scalarModuleTower (M : ModuleCat.{w} Aᵐᵒᵖ) : + IsScalarTower k Aᵐᵒᵖ (ScalarModule k A M) where + smul_assoc c a m := by + change (c • a) • (m : M) = algebraMap k Aᵐᵒᵖ c • (a • (m : M)) + rw [Algebra.smul_def, mul_smul] + +variable (N : Type z) [AddCommGroup N] [Module k N] [Module A N] + +/-- The actual tensor evaluation functor on all right A-modules. -/ +def tensorFunctor : ModuleCat.{w} Aᵐᵒᵖ ⥤ ModuleCat.{max w z} k where + obj M := ModuleCat.of k (Tensor k A (ScalarModule k A M) N) + map {M M'} f := ModuleCat.ofHom + (mapLeft (k := k) (M := ScalarModule k A M) (M' := ScalarModule k A M') N f.hom) + map_id M := ModuleCat.hom_ext (mapLeft_id (k := k) N) + map_comp f g := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m n + rfl + +instance tensorFunctorAdditive : (tensorFunctor k A N).Additive where + map_add {M M'} {f g} := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m n + change mk k A (ScalarModule k A M') N (f.hom m + g.hom m) n = + mk k A (ScalarModule k A M') N (f.hom m) n + mk k A (ScalarModule k A M') N (g.hom m) n + exact LinearMap.congr_fun ((mk k A (ScalarModule k A M') N).map_add (f.hom m) (g.hom m)) n +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/ThickEvaluation.lean b/lean/OAI/Algebra/Finitistic/Localization/ThickEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6b400c08663e8605232714e25c6e1ad8962a172 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/ThickEvaluation.lean @@ -0,0 +1,90 @@ +import Mathlib.CategoryTheory.Triangulated.Subcategory + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +open ZeroObject +namespace LittleFinitistic.ThickEvaluation +universe u v u' v' +variable {C : Type u} [Category.{v} C] [Preadditive C] [HasZeroObject C] + [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] [Pretriangulated C] + +/-- The actual thick closure: zero, isomorphisms, shifts, extensions, and retracts. -/ +inductive Thick (S : ObjectProperty C) : C → Prop + | generator {X : C} : S X → Thick S X + | zero : Thick S 0 + | iso {X Y : C} : (X ≅ Y) → Thick S X → Thick S Y + | shift {X : C} (n : ℤ) : Thick S X → Thick S (X⟦n⟧) + | extension (T : Triangle C) : T ∈ distTriang C → Thick S T.obj₁ → Thick S T.obj₃ → Thick S T.obj₂ + | retract {X Y : C} : Retract X Y → Thick S Y → Thick S X + +variable (S : ObjectProperty C) + +instance thickRetracts : ObjectProperty.IsStableUnderRetracts (Thick S) where + of_retract r h := Thick.retract r h + +instance thickZero : ObjectProperty.ContainsZero (Thick S) where + exists_zero := ⟨0,isZero_zero C,Thick.zero⟩ + +instance thickShift : ObjectProperty.IsStableUnderShift (Thick S) ℤ where + isStableUnderShiftBy n := ⟨fun _ h => Thick.shift n h⟩ + +instance thickTriangulated : ObjectProperty.IsTriangulated (Thick S) where + toIsTriangulatedClosed₂ := .mk' (fun T hT h₁ h₃ => Thick.extension T hT h₁ h₃) + +/-- Minimality proves that this is the thick subcategory generated by S. -/ +theorem thick_minimal (P : ObjectProperty C) [P.IsTriangulated] [P.IsStableUnderRetracts] + (h : S ≤ P) : Thick S ≤ P := by + intro X hX + induction hX with + | generator hX => exact h _ hX + | zero => exact P.prop_zero + | iso e _ ih => exact P.prop_of_iso e ih + | shift n _ ih => exact P.le_shift n _ ih + | extension T hT _ _ ih₁ ih₃ => exact P.ext_of_isTriangulatedClosed₂ T hT ih₁ ih₃ + | retract r _ ih => exact P.prop_of_retract r ih + +variable {D : Type u'} [Category.{v'} D] [Preadditive D] [HasZeroObject D] + [HasShift D ℤ] [∀ n : ℤ, (shiftFunctor D n).Additive] [Pretriangulated D] +variable (F : C ⥤ D) [F.Additive] [F.CommShift ℤ] [F.IsTriangulated] + +omit [F.Additive] in +/-- Exact evaluation kills the whole thick closure once it kills the generators. -/ +theorem kills_thick (hS : ∀ X, S X → IsZero (F.obj X)) : + ∀ X, Thick S X → IsZero (F.obj X) := by + intro X hX + induction hX with + | generator hX => exact hS _ hX + | zero => exact F.map_isZero (isZero_zero C) + | iso e _ ih => exact ih.of_iso (F.mapIso e).symm + | shift n _ ih => + exact ((shiftFunctor D n).map_isZero ih).of_iso ((F.commShiftIso n).app _) + | extension T hT _ _ ih₁ ih₃ => + exact Triangle.isZero₂_of_isZero₁₃ _ (F.map_distinguished T hT) ih₁ ih₃ + | retract r _ ih => + apply (IsZero.iff_id_eq_zero _).2 + rw [← (r.map F).retract] + change F.map r.i ≫ F.map r.r = 0 + rw [ih.eq_of_src (F.map r.r) 0, comp_zero] + +omit [F.Additive] in +/-- Every morphism whose cone lies in the generated thick subcategory evaluates to an isomorphism. -/ +theorem inverts_thick (hS : ∀ X, S X → IsZero (F.obj X)) : + (ObjectProperty.trW (Thick S)).IsInvertedBy F := by + rintro X Y f ⟨Z,g,h,hT,hZ⟩ + exact (Triangle.isZero₃_iff_isIso₁ _ (F.map_distinguished _ hT)).mp + (kills_thick S F hS Z hZ) + +/-- Evaluation on the actual localization at cones in the thick closure. -/ +def quotientEvaluation (hS : ∀ X, S X → IsZero (F.obj X)) : + (ObjectProperty.trW (Thick S)).Localization ⥤ D := + Localization.lift F (inverts_thick S F hS) (ObjectProperty.trW (Thick S)).Q + +def quotientEvaluationFactors (hS : ∀ X, S X → IsZero (F.obj X)) : + (ObjectProperty.trW (Thick S)).Q ⋙ quotientEvaluation S F hS ≅ F := + Localization.fac F (inverts_thick S F hS) (ObjectProperty.trW (Thick S)).Q +end LittleFinitistic.ThickEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TruncationSplitNaturality.lean b/lean/OAI/Algebra/Finitistic/Localization/TruncationSplitNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6c4d3e40e719a2405abfda5d865591d94be3d48 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TruncationSplitNaturality.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.Finitistic.Localization.TwoDegreeSplitting + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.TwoDegreeFormality +open QuadraticEncoding DerivedTruncation DerivedCategory +universe u v +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (X Y : D.{u,v} P) (hX : TwoDegrees X) (hY : TwoDegrees Y) + +include hX hY in +/-- Ext^3 kills the only possible off-diagonal ambiguity in a truncation splitting. -/ +theorem upper_to_lower_eq_zero (f : upper X ⟶ lower Y) : f = 0 := by + have hz := shifted_hom_eq_zero P (H P 0 X) (H P (-3) Y) 3 (by omega) + ((upperIso P X hX).inv ≫ f ≫ (lowerIso P Y hY).hom) + apply (cancel_epi (upperIso P X hX).inv).mp + apply (cancel_mono (lowerIso P Y hY).hom).mp + simpa only [Category.assoc,zero_comp,comp_zero] using hz + +include hX hY in +lemma truncation_split_square (sX : TruncationSplit P X) (sY : TruncationSplit P Y) (f : X ⟶ Y) : + f ≫ sY.iso.hom = sX.iso.hom ≫ biprod.map + ((DerivedTruncation.t.truncLT 0).map f) ((DerivedTruncation.t.truncGE 0).map f) := by + have hix : biprod.inl ≫ sX.iso.inv = DerivedTruncation.inclusion X := by + rw [← sX.inclusion,Category.assoc,Iso.hom_inv_id,Category.comp_id] + have hnat : (DerivedTruncation.t.truncLT 0).map f ≫ DerivedTruncation.inclusion Y = + DerivedTruncation.inclusion X ≫ f := (DerivedTruncation.t.truncLTι 0).naturality f + have hpnat : f ≫ DerivedTruncation.projection Y = + DerivedTruncation.projection X ≫ (DerivedTruncation.t.truncGE 0).map f := + (DerivedTruncation.t.truncGEπ 0).naturality f + have hxy : DerivedTruncation.inclusion X ≫ f ≫ sY.iso.hom = + (DerivedTruncation.t.truncLT 0).map f ≫ biprod.inl := by + rw [← Category.assoc,← hnat,Category.assoc,sY.inclusion] + apply (cancel_epi sX.iso.inv).mp + simp only [Iso.inv_hom_id_assoc] + apply biprod.hom_ext + · apply biprod.hom_ext' + · simp only [← Category.assoc,hix] + simpa only [Category.assoc,biprod.map_fst,biprod.inl_fst_assoc,biprod.inl_fst,Category.comp_id] + using congrArg (fun a => a ≫ biprod.fst) hxy + · simp only [Category.assoc,biprod.map_fst,biprod.inr_fst_assoc,zero_comp] + exact upper_to_lower_eq_zero P X Y hX hY _ + · simp only [Category.assoc,biprod.map_snd] + rw [← sY.projection,hpnat,sX.projection] + simp only [Category.assoc,Iso.inv_hom_id_assoc] + +/-- The chosen actual splitting commutes with every morphism of two-degree objects. -/ +theorem truncationSplit_naturality (f : X ⟶ Y) : + f ≫ (truncationSplit P Y hY).iso.hom = (truncationSplit P X hX).iso.hom ≫ biprod.map + ((DerivedTruncation.t.truncLT 0).map f) ((DerivedTruncation.t.truncGE 0).map f) := + truncation_split_square P X Y hX hY (truncationSplit P X hX) (truncationSplit P Y hY) f +end LittleFinitistic.TwoDegreeFormality + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TruncationStalkNaturality.lean b/lean/OAI/Algebra/Finitistic/Localization/TruncationStalkNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..33018a8a7ad16724302b649a08aab37b335934cf --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TruncationStalkNaturality.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Localization.TwoDegreeSplitting +import OAI.Algebra.Finitistic.Localization.DiagramEvaluationSquares + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.TwoDegreeFormality +open QuadraticEncoding DerivedTruncation DerivedCategory +universe u v +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (X Y : D.{u,v} P) (hX : TwoDegrees X) (hY : TwoDegrees Y) (f : X ⟶ Y) + +lemma upperIso_naturality : + (DerivedTruncation.t.truncGE 0).map f ≫ (upperIso P Y hY).hom = + (upperIso P X hX).hom ≫ (singleFunctor (C P) 0).map ((homologyFunctor (C P) 0).map f) := by + have := upper_isLE X hX + have := upper_isLE Y hY + let px := upperHomologyIso X 0 (by omega) + let py := upperHomologyIso Y 0 (by omega) + have hp : (homologyFunctor (C P) 0).map f ≫ py.hom = + px.hom ≫ (homologyFunctor (C P) 0).map ((DerivedTruncation.t.truncGE 0).map f) := by + have h₀ : f ≫ DerivedTruncation.projection Y = DerivedTruncation.projection X ≫ + (DerivedTruncation.t.truncGE 0).map f := (DerivedTruncation.t.truncGEπ 0).naturality f + have h := congrArg (homologyFunctor (C P) 0).map h₀ + dsimp only [px,py,upperHomologyIso,asIso] + simpa only [Functor.map_comp] using h + have hn : (homologyFunctor (C P) 0).map ((DerivedTruncation.t.truncGE 0).map f) ≫ py.inv = + px.inv ≫ (homologyFunctor (C P) 0).map f := by + apply (cancel_epi px.hom).mp + rw [← Category.assoc,← hp,Category.assoc,Iso.hom_inv_id,Category.comp_id,Iso.hom_inv_id_assoc] + have hs := congrArg (singleFunctor (C P) 0).map hn + simp only [Functor.map_comp] at hs + exact DiagramEvaluationSquares.compose _ _ _ + (canonicalIso 0 (upper X)) (canonicalIso 0 (upper Y)) + ((singleFunctor (C P) 0).mapIso px.symm) ((singleFunctor (C P) 0).mapIso py.symm) + (canonicalIso_naturality 0 _) hs + +lemma lowerIso_naturality : + (DerivedTruncation.t.truncLT 0).map f ≫ (lowerIso P Y hY).hom = + (lowerIso P X hX).hom ≫ + ((singleFunctor (C P) 0).map ((homologyFunctor (C P) (-3)).map f))⟦(3 : ℤ)⟧' := by + have := lower_isLE X hX + have := lower_isGE X hX + have := lower_isLE Y hY + have := lower_isGE Y hY + let ix := lowerHomologyIso X (-3) (by omega) + let iy := lowerHomologyIso Y (-3) (by omega) + have hn : (homologyFunctor (C P) (-3)).map ((DerivedTruncation.t.truncLT 0).map f) ≫ iy.hom = + ix.hom ≫ (homologyFunctor (C P) (-3)).map f := by + have h₀ : (DerivedTruncation.t.truncLT 0).map f ≫ DerivedTruncation.inclusion Y = + DerivedTruncation.inclusion X ≫ f := (DerivedTruncation.t.truncLTι 0).naturality f + have h := congrArg (homologyFunctor (C P) (-3)).map h₀ + dsimp only [ix,iy,lowerHomologyIso,asIso] + simpa only [Functor.map_comp] using h + have hs := congrArg (singleFunctor (C P) (-3)).map hn + simp only [Functor.map_comp] at hs + let sh := ((singleFunctors (C P)).shiftIso 3 (-3) 0 (by omega)).symm + have ht : (singleFunctor (C P) (-3)).map ((homologyFunctor (C P) (-3)).map f) ≫ + (sh.app (H P (-3) Y)).hom = (sh.app (H P (-3) X)).hom ≫ + ((singleFunctor (C P) 0).map ((homologyFunctor (C P) (-3)).map f))⟦(3 : ℤ)⟧' := + sh.hom.naturality _ + have hm := DiagramEvaluationSquares.compose _ _ _ + (canonicalIso (-3) (lower X)) (canonicalIso (-3) (lower Y)) + ((singleFunctor (C P) (-3)).mapIso ix) ((singleFunctor (C P) (-3)).mapIso iy) + (canonicalIso_naturality (-3) ((DerivedTruncation.t.truncLT 0).map f)) hs + have hh := DiagramEvaluationSquares.compose _ _ _ + (canonicalIso (-3) (lower X) ≪≫ (singleFunctor (C P) (-3)).mapIso ix) + (canonicalIso (-3) (lower Y) ≪≫ (singleFunctor (C P) (-3)).mapIso iy) + (sh.app (H P (-3) X)) (sh.app (H P (-3) Y)) hm ht + dsimp only [Iso.trans] at hh + dsimp only [lowerIso,Iso.trans] + simpa only [ix,iy,sh,Category.assoc] using hh +end LittleFinitistic.TwoDegreeFormality + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TwoConeVerdier.lean b/lean/OAI/Algebra/Finitistic/Localization/TwoConeVerdier.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bf01c519f4c35dca3aaaa185bbd6438161c6c76 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TwoConeVerdier.lean @@ -0,0 +1,128 @@ +import Mathlib.CategoryTheory.Triangulated.Generators +import Mathlib.CategoryTheory.Localization.Linear + +namespace OAI +noncomputable section +open CategoryTheory Limits Pretriangulated Category +namespace LittleFinitistic.TwoConeVerdier + +variable {C : Type*} [Category* C] [HasZeroObject C] [Preadditive C] + [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] + [Pretriangulated C] + +/-- Two specified cone triangles, with the first maps the denominators to invert. -/ +structure ConePair (C : Type*) [Category* C] [HasShift C ℤ] [Preadditive C] + [HasZeroObject C] [∀ n : ℤ, (shiftFunctor C n).Additive] [Pretriangulated C] where + first : Triangle C + second : Triangle C + first_distinguished : first ∈ distTriang C + second_distinguished : second ∈ distTriang C + +namespace ConePair +variable (T : ConePair C) + +/-- Only the two cone objects are generators. -/ +def generators : ObjectProperty C := fun X => X = T.first.obj₃ ∨ X = T.second.obj₃ +instance : T.generators.Nonempty := ⟨T.first.obj₃, Or.inl rfl⟩ + +/-- The least thick subcategory containing these two cones. -/ +abbrev S : ObjectProperty C := T.generators.triangEnvelope + +/-- Exactly the maps whose cone lies in S. -/ +abbrev Sigma : MorphismProperty C := T.S.trW + +/-- The Verdier localization at the cone class. -/ +abbrev Q := T.Sigma.Localization +abbrev q : C ⥤ T.Q := T.Sigma.Q + +/-- This is a proved fraction calculus, inherited from the triangle axioms. -/ +theorem rightFractions [IsTriangulated C] : T.Sigma.HasRightCalculusOfFractions := inferInstance + +theorem quotient_triangulated [IsTriangulated C] : IsTriangulated T.Q := inferInstance + +theorem source_localization : T.q.IsLocalization T.Sigma := inferInstance + +theorem first_cone_mem : T.S T.first.obj₃ := T.generators.le_triangEnvelope _ (Or.inl rfl) +theorem second_cone_mem : T.S T.second.obj₃ := T.generators.le_triangEnvelope _ (Or.inr rfl) + +theorem first_mem : T.Sigma T.first.mor₁ := + ObjectProperty.trW.mk _ T.first_distinguished T.first_cone_mem + +theorem second_mem : T.Sigma T.second.mor₁ := + ObjectProperty.trW.mk _ T.second_distinguished T.second_cone_mem + +instance : IsIso (T.q.map T.first.mor₁) := Localization.inverts _ _ _ T.first_mem +instance : IsIso (T.q.map T.second.mor₁) := Localization.inverts _ _ _ T.second_mem + +/-- The cone criterion agrees with any distinguished cone triangle. -/ +theorem sigma_iff (U : Triangle C) (hU : U ∈ distTriang C) : + T.Sigma U.mor₁ ↔ T.S U.obj₃ := T.S.trW_iff_of_distinguished U hU + +/-- Exact minimality, including closure under retracts. -/ +theorem thick_minimal (P : ObjectProperty C) [P.IsTriangulated] [P.IsStableUnderRetracts] + (h₁ : P T.first.obj₃) (h₂ : P T.second.obj₃) : T.S ≤ P := by + change T.generators.triangEnvelope ≤ P + apply (ObjectProperty.triangEnvelope_le_iff T.generators (Q := P)).mpr + intro X hX + rcases hX with rfl | rfl <;> assumption + +/-- Every morphism is a roof with a source denominator. -/ +theorem roof [IsTriangulated C] {X Y : C} (f : T.q.obj X ⟶ T.q.obj Y) : + ∃ (r : T.Sigma.RightFraction X Y), f = r.map T.q (Localization.inverts _ _) := + Localization.exists_rightFraction _ _ f + +/-- The manuscript's zero-fraction rule, with a genuine denominator. -/ +theorem zero_fraction [IsTriangulated C] {X Y : C} (f : X ⟶ Y) (hf : T.q.map f = 0) : + ∃ (Z : C) (v : Z ⟶ X), T.Sigma v ∧ v ≫ f = 0 := by + have he : T.q.map f = T.q.map (0 : X ⟶ Y) := by simpa using hf + obtain ⟨Z,v,hv,h⟩ := (MorphismProperty.map_eq_iff_precomp T.q T.Sigma f 0).mp he + exact ⟨Z,v,hv,by simpa using h⟩ + +variable {D : Type*} [Category* D] [HasZeroObject D] [Preadditive D] + [HasShift D ℤ] [∀ n : ℤ, (shiftFunctor D n).Additive] [Pretriangulated D] + +instance zeroRetracts : ObjectProperty.IsStableUnderRetracts (IsZero (C := D)) where + of_retract r h := by + rw [IsZero.iff_id_eq_zero, ← r.retract, h.eq_of_tgt r.i 0, zero_comp] + +instance zeroShift : ObjectProperty.IsStableUnderShift (IsZero (C := D)) ℤ where + isStableUnderShiftBy n := { le_shift := fun _ h => (shiftFunctor D n).map_isZero h } + +instance zeroTriangulated : ObjectProperty.IsTriangulated (IsZero (C := D)) where + toIsTriangulatedClosed₂ := .mk' (fun U hU h₁ h₃ => U.isZero₂_of_isZero₁₃ hU h₁ h₃) + +variable (F : C ⥤ D) [F.CommShift ℤ] [F.IsTriangulated] + [IsIso (F.map T.first.mor₁)] [IsIso (F.map T.second.mor₁)] + +instance kernelRetracts : F.kernel.IsStableUnderRetracts where + of_retract r h := ObjectProperty.IsStableUnderRetracts.of_retract (P := IsZero (C := D)) (r.map F) h + +/-- An exact functor inverting the two displayed arrows kills both +required generating cones, hence their entire thick closure. -/ +theorem evaluation_kills : T.S ≤ F.kernel := by + apply T.thick_minimal F.kernel + · exact (F.mapTriangle.obj T.first).isZero₃_of_isIso₁ + (F.map_distinguished _ T.first_distinguished) + (inferInstanceAs (IsIso (F.map T.first.mor₁))) + · exact (F.mapTriangle.obj T.second).isZero₃_of_isIso₁ + (F.map_distinguished _ T.second_distinguished) + (inferInstanceAs (IsIso (F.map T.second.mor₁))) + +theorem evaluation_inverts : T.Sigma.IsInvertedBy F := by + intro X Y f hf + obtain ⟨Z,g,h,hU,hZ⟩ := hf + exact ((F.mapTriangle.obj (Triangle.mk f g h)).isZero₃_iff_isIso₁ + (F.map_distinguished _ hU)).mp (T.evaluation_kills F _ hZ) + +/-- The induced functor from the actual quotient. -/ +def evaluation : T.Q ⥤ D := Localization.lift F (T.evaluation_inverts F) T.q + +def evaluation_fac : T.q ⋙ T.evaluation F ≅ F := + Localization.fac F (T.evaluation_inverts F) T.q + +end ConePair +end LittleFinitistic.TwoConeVerdier + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeExtVanishing.lean b/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeExtVanishing.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd20231f16a91850556debd2fc669fe574ba2e8d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeExtVanishing.lean @@ -0,0 +1,37 @@ +import OAI.Algebra.Finitistic.Encoding.QuadraticEncoding +import Mathlib.Algebra.Homology.DerivedCategory.Ext.Basic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Abelian +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.TwoDegreeFormality +open QuadraticEncoding +universe u v +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +lemma pd_lt_three (X : ModuleCat.{max u v} (B P)) : HasProjectiveDimensionLT X 3 := by + have h : projectiveDimension X ≤ (2 : ℕ) := + le_trans (le_iSup (fun N : ModuleCat.{max u v} (B P) => projectiveDimension N) X) + (globalDimension_le_two P).1 + exact (projectiveDimension_le_iff X 2).mp h + +/-- Actual higher Ext vanishing from the proved global-dimension bound for B. -/ +theorem ext_eq_zero (X Y : ModuleCat.{max u v} (B P)) (n : ℕ) (hn : 3 ≤ n) + (x : Ext X Y n) : x = 0 := by + have := pd_lt_three P X + exact x.eq_zero_of_hasProjectiveDimensionLT 3 hn + +/-- In particular every possible degree-four connecting morphism is zero. -/ +theorem shifted_hom_eq_zero (X Y : ModuleCat.{max u v} (B P)) (n : ℕ) (hn : 3 ≤ n) + (f : (DerivedCategory.singleFunctor _ 0).obj X ⟶ + ((DerivedCategory.singleFunctor _ 0).obj Y)⟦(n : ℤ)⟧) : f = 0 := by + let x : Ext X Y n := Ext.homEquiv.symm f + have h := ext_eq_zero P X Y n hn x + have h' := congrArg (fun x : Ext X Y n => x.hom) h + simpa only [x,Equiv.apply_symm_apply,Ext.zero_hom] using h' +end LittleFinitistic.TwoDegreeFormality + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeFormalityNaturality.lean b/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeFormalityNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..63410b689bf2dea85451d46bf850f04096dc8c93 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeFormalityNaturality.lean @@ -0,0 +1,73 @@ +import OAI.Algebra.Finitistic.Localization.TruncationSplitNaturality +import OAI.Algebra.Finitistic.Localization.TruncationStalkNaturality + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.TwoDegreeFormality +open QuadraticEncoding DerivedTruncation DerivedCategory +universe u v w +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable {X Y : D.{u,v} P} + +abbrev modelMap (f : X ⟶ Y) := + biprod.map ((singleFunctor (C P) 0).map ((homologyFunctor (C P) 0).map f)) + (((singleFunctor (C P) 0).map ((homologyFunctor (C P) (-3)).map f))⟦(3 : ℤ)⟧') + +lemma braiding_square {A B A' B' : D.{u,v} P} (f : A ⟶ A') (g : B ⟶ B') : + biprod.map f g ≫ (biprod.braiding A' B').hom = + (biprod.braiding A B).hom ≫ biprod.map g f := by + apply biprod.hom_ext <;> simp [biprod.braiding,Category.assoc] + +variable (X Y) (hX : TwoDegrees X) (hY : TwoDegrees Y) (f : X ⟶ Y) + +lemma stalk_diagonal_square : + biprod.map ((DerivedTruncation.t.truncLT 0).map f) ((DerivedTruncation.t.truncGE 0).map f) ≫ + (biprod.mapIso (lowerIso P Y hY) (upperIso P Y hY)).hom = + (biprod.mapIso (lowerIso P X hX) (upperIso P X hX)).hom ≫ + biprod.map (((singleFunctor (C P) 0).map ((homologyFunctor (C P) (-3)).map f))⟦(3 : ℤ)⟧') + ((singleFunctor (C P) 0).map ((homologyFunctor (C P) 0).map f)) := by + apply biprod.hom_ext + · simp only [biprod.mapIso_hom,Category.assoc,biprod.map_fst,biprod.map_fst_assoc, + lowerIso_naturality P X Y hX hY f] + · simp only [biprod.mapIso_hom,Category.assoc,biprod.map_snd,biprod.map_snd_assoc, + upperIso_naturality P X Y hX hY f] + +/-- The actual two-degree formality isomorphism is natural for all derived B-morphisms. -/ +theorem splitIso_naturality : + f ≫ (splitIso P Y hY).hom = (splitIso P X hX).hom ≫ modelMap P f := by + have hm := DiagramEvaluationSquares.compose _ _ _ + (truncationSplit P X hX).iso (truncationSplit P Y hY).iso + (biprod.mapIso (lowerIso P X hX) (upperIso P X hX)) + (biprod.mapIso (lowerIso P Y hY) (upperIso P Y hY)) + (truncationSplit_naturality P X Y hX hY f) (stalk_diagonal_square P X Y hX hY f) + have hh := DiagramEvaluationSquares.compose _ _ _ + ((truncationSplit P X hX).iso ≪≫ biprod.mapIso (lowerIso P X hX) (upperIso P X hX)) + ((truncationSplit P Y hY).iso ≪≫ biprod.mapIso (lowerIso P Y hY) (upperIso P Y hY)) + (biprod.braiding _ _) (biprod.braiding _ _) hm (braiding_square P _ _) + dsimp only [Iso.trans] at hh + dsimp only [splitIso,Iso.trans] + simp only [Category.assoc] at hh ⊢ + exact hh + +/-- In particular every endomorphism acts diagonally by its two actual cohomology maps. -/ +theorem splitIso_endomorphism (a : End X) : + a ≫ (splitIso P X hX).hom = (splitIso P X hX).hom ≫ modelMap P a := + splitIso_naturality P X X hX hX a + +/-- The splitting retains any specified action by derived B-linear endomorphisms. -/ +theorem splitIso_action (S : Type w) [Monoid S] (rho : S →* End X) (r : S) : + rho r ≫ (splitIso P X hX).hom = (splitIso P X hX).hom ≫ modelMap P (rho r) := + splitIso_endomorphism P X hX (rho r) + +/-- Substitute actual B-module identifications of the two cohomology modules. -/ +def splitIsoWithModels (M N : C.{u,v} P) (e0 : H P 0 X ≅ M) (em : H P (-3) X ≅ N) : + X ≅ stalk P M ⊞ (stalk P N)⟦(3 : ℤ)⟧ := + splitIso P X hX ≪≫ biprod.mapIso ((singleFunctor (C P) 0).mapIso e0) + ((shiftFunctor (D P) (3 : ℤ)).mapIso ((singleFunctor (C P) 0).mapIso em)) +end LittleFinitistic.TwoDegreeFormality + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeSplitting.lean b/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce53804403aa8c038abc23530caf4a0cb6c9fe4d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/TwoDegreeSplitting.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Localization.TwoDegreeExtVanishing +import OAI.Algebra.Finitistic.Localization.SingleDegreeNaturality + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.TwoDegreeFormality +open QuadraticEncoding DerivedTruncation DerivedCategory +universe u v +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +abbrev C := ModuleCat.{max u v} (B P) +abbrev D := DerivedCategory (C.{u,v} P) +abbrev H (n : ℤ) (X : D.{u,v} P) := (homologyFunctor (C P) n).obj X +abbrev stalk (M : C.{u,v} P) := (singleFunctor (C P) 0).obj M +variable (X : D.{u,v} P) (hX : TwoDegrees X) + +def upperIso : upper X ≅ stalk P (H P 0 X) := by + haveI := upper_isLE X hX + exact canonicalIso 0 (upper X) ≪≫ (singleFunctor (C P) 0).mapIso + (upperHomologyIso X 0 (by omega)).symm + +def lowerIso : lower X ≅ (stalk P (H P (-3) X))⟦(3 : ℤ)⟧ := by + haveI := lower_isLE X hX + haveI := lower_isGE X hX + exact canonicalIso (-3) (lower X) ≪≫ + (singleFunctor (C P) (-3)).mapIso (lowerHomologyIso X (-3) (by omega)) ≪≫ + ((singleFunctors (C P)).shiftIso 3 (-3) 0 (by omega)).symm.app (H P (-3) X) + +def lowerShiftIso : (lower X)⟦(1 : ℤ)⟧ ≅ (stalk P (H P (-3) X))⟦(4 : ℤ)⟧ := + (shiftFunctor (D P) (1 : ℤ)).mapIso (lowerIso P X hX) ≪≫ + (shiftFunctorAdd (D P) (3 : ℤ) (1 : ℤ)).symm.app (stalk P (H P (-3) X)) + +include hX in +/-- The connecting map of the actual truncation triangle vanishes by Ext^4=0. -/ +theorem connecting_eq_zero : (triangle X).mor₃ = 0 := by + have hz := shifted_hom_eq_zero P (H P 0 X) (H P (-3) X) 4 (by omega) + ((upperIso P X hX).inv ≫ (triangle X).mor₃ ≫ (lowerShiftIso P X hX).hom) + apply (cancel_epi (upperIso P X hX).inv).mp + apply (cancel_mono (lowerShiftIso P X hX).hom).mp + erw [Category.assoc, comp_zero, zero_comp] + exact hz + +/-- A splitting of the actual truncation triangle, retaining its inclusion and projection. -/ +structure TruncationSplit where + iso : X ≅ lower X ⊞ upper X + inclusion : DerivedTruncation.inclusion X ≫ iso.hom = biprod.inl + projection : DerivedTruncation.projection X = iso.hom ≫ biprod.snd + +def truncationSplit : TruncationSplit P X := Classical.choice (by + obtain ⟨e,hi,hp⟩ := exists_iso_binaryBiproduct_of_distTriang + (triangle X) (distinguished X) (connecting_eq_zero P X hX) + exact ⟨⟨e,hi,hp⟩⟩) + +/-- Actual B-linear two-degree formality, with the manuscript's shift by three. -/ +def splitIso : X ≅ stalk P (H P 0 X) ⊞ (stalk P (H P (-3) X))⟦(3 : ℤ)⟧ := + (truncationSplit P X hX).iso ≪≫ biprod.mapIso (lowerIso P X hX) (upperIso P X hX) ≪≫ + biprod.braiding _ _ +end LittleFinitistic.TwoDegreeFormality + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/UnderlyingRepresentatives.lean b/lean/OAI/Algebra/Finitistic/Localization/UnderlyingRepresentatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..62037cc17bc0706755fd614900fbdda9176f1251 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/UnderlyingRepresentatives.lean @@ -0,0 +1,63 @@ +import Mathlib.Algebra.Category.ModuleCat.Algebra +import OAI.Algebra.Finitistic.Localization.ConcreteChainRepresentatives +import OAI.Algebra.Finitistic.Rectification.ColumnComplex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.UnderlyingRepresentatives +open SourceVerdier ConcreteChainRepresentatives +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) + +abbrev forget : Proj P ⥤ ModuleCat.{u} (QuadraticEncoding.B P)ᵐᵒᵖ := + (ProjectiveComplexes.finiteProjective (QuadraticEncoding.B P)).ι + +abbrev complex (X : K P) : CochainComplex (ModuleCat.{u} (QuadraticEncoding.B P)ᵐᵒᵖ) ℤ := + ((forget P).mapHomologicalComplex (.up ℤ)).obj (representative P X) + +theorem projective (X : K P) (n : ℤ) : + Module.Projective (QuadraticEncoding.B P)ᵐᵒᵖ ((complex P X).X n) := + ((representative P X).X n).property.2 + +theorem finite (X : K P) (n : ℤ) : + Module.Finite (QuadraticEncoding.B P)ᵐᵒᵖ ((complex P X).X n) := + ((representative P X).X n).property.1 + +attribute [local instance] ExternalTensor.Section4.rightModuleK + +theorem finiteDimensional (X : K P) (n : ℤ) : + FiniteDimensional k ((complex P X).X n) := by + let := QuadraticEncoding.finiteDimensional P + let := finite P X n + exact Module.Finite.trans (QuadraticEncoding.B P)ᵐᵒᵖ ((complex P X).X n) + +/-- Genuine boundedness after forgetting the projective subcategory. -/ +theorem bounded (X : K P) : + ∃ lo hi : ℤ, ∀ n, n < lo ∨ hi < n → IsZero ((complex P X).X n) := by + obtain ⟨lo,hi,hlo,hhi⟩ := representative_bounded P X + let := hlo + let := hhi + refine ⟨lo,hi,fun n hn => ?_⟩ + apply (forget P).map_isZero + rcases hn with hn | hn + · exact (representative P X).isZero_of_isStrictlyGE lo n hn + · exact (representative P X).isZero_of_isStrictlyLE hi n hn + +/-- The actual chain-representative relation homotopies survive the forgetful functor. -/ +def relationHomotopy (na nb nr : ℕ) (X₀ X₁ X₂ : K P) + (f : Fin na → (representative P X₀ ⟶ representative P X₁)) + (g : Fin nb → (representative P X₁ ⟶ representative P X₂)) + (c : Fin nr → Fin na → Fin nb → k) + (H : ∀ r, Homotopy (∑ i, ∑ j, c r i j • (f i ≫ g j)) 0) (r : Fin nr) : + Homotopy + (∑ i, ∑ j, c r i j • + (((forget P).mapHomologicalComplex (.up ℤ)).map (f i) ≫ + ((forget P).mapHomologicalComplex (.up ℤ)).map (g j))) 0 := by + simpa only [Functor.map_sum,Functor.map_smul,Functor.map_comp,Functor.map_zero] + using (forget P).mapHomotopy (H r) +end LittleFinitistic.UnderlyingRepresentatives + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/VectorComplexFormality.lean b/lean/OAI/Algebra/Finitistic/Localization/VectorComplexFormality.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d7033de70d23e4ee806678a19d4fda4c6e4c473 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/VectorComplexFormality.lean @@ -0,0 +1,98 @@ +import OAI.Algebra.Finitistic.Localization.BoundedDerivedEmbedding +import Mathlib.LinearAlgebra.Basis.VectorSpace +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex +import Mathlib.Algebra.Category.ModuleCat.Algebra + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.VectorComplexFormality +open FiniteProjectiveHomotopy +universe u v +variable {k : Type u} [Field k] + +/-- A graded vector space regarded as a complex with zero differential. -/ +def zeroComplex (V : ℤ → ModuleCat.{v} k) : CochainComplex (ModuleCat.{v} k) ℤ where + X := V + d _ _ := 0 + shape _ _ _ := rfl + d_comp_d' _ _ _ _ _ := by simp + +def homologySection (C : CochainComplex (ModuleCat.{v} k) ℤ) (i : ℤ) : + C.homology i ⟶ C.cycles i := by + haveI : Projective (C.homology i) := ModuleCat.projective_of_categoryTheory_projective _ + exact Projective.factorThru (𝟙 _) (C.homologyπ i) + +lemma homologySection_comp (C : CochainComplex (ModuleCat.{v} k) ℤ) (i : ℤ) : + homologySection C i ≫ C.homologyπ i = 𝟙 _ := by + have : Projective (C.homology i) := ModuleCat.projective_of_categoryTheory_projective _ + exact Projective.factorThru_comp (𝟙 _) (C.homologyπ i) + +/-- Choose cycle representatives for each homology vector space. -/ +def formalityMap (C : CochainComplex (ModuleCat.{v} k) ℤ) : + zeroComplex (fun i => C.homology i) ⟶ C where + f i := homologySection C i ≫ C.iCycles i + comm' i j _ := by + change (homologySection C i ≫ C.iCycles i) ≫ C.d i j = 0 ≫ _ + rw [Category.assoc, C.iCycles_d, Limits.comp_zero, Limits.zero_comp] + +lemma formality_cycles (C : CochainComplex (ModuleCat.{v} k) ℤ) (i : ℤ) : + cyclesMap (formalityMap C) i = (zeroComplex (fun i => C.homology i)).iCycles i ≫ homologySection C i := by + apply (cancel_mono (C.iCycles i)).mp + erw [cyclesMap_i, Category.assoc] + rfl + +lemma formality_homology (C : CochainComplex (ModuleCat.{v} k) ℤ) (i : ℤ) : + (zeroComplex (fun i => C.homology i)).homologyπ i ≫ homologyMap (formalityMap C) i = + (zeroComplex (fun i => C.homology i)).iCycles i := by + erw [homologyπ_naturality, formality_cycles, Category.assoc, homologySection_comp] + exact Category.comp_id _ + +instance formalityMapQuasiIso (C : CochainComplex (ModuleCat.{v} k) ℤ) : + QuasiIso (formalityMap C) := by + rw [quasiIso_iff] + intro i + rw [quasiIsoAt_iff_isIso_homologyMap] + have := (zeroComplex (fun i => C.homology i)).isIso_homologyπ (i-1) i (by simp) rfl + apply (isIso_comp_left_iff ((zeroComplex (fun i => C.homology i)).homologyπ i) + (homologyMap (formalityMap C) i)).mp + erw [formality_homology C i] + exact (zeroComplex (fun i => C.homology i)).isIso_iCycles i (i+1) (by simp) rfl + +lemma homology_finite (C : CochainComplex (ModuleCat.{v} k) ℤ) (i : ℤ) + [Module.Finite k (C.X i)] : Module.Finite k (C.homology i) := by + have : Module.Finite k (C.cycles i) := Module.Finite.of_injective (C.iCycles i).hom + ((ModuleCat.mono_iff_injective _).mp inferInstance) + exact Module.Finite.of_surjective (C.homologyπ i).hom + ((ModuleCat.epi_iff_surjective _).mp inferInstance) + +lemma zeroHomology_property (C : CochainComplex (ModuleCat.{v} k) ℤ) (hC : ComplexProperty k C) : + ComplexProperty k (zeroComplex (fun i => C.homology i)) := by + obtain ⟨⟨a,b,hb⟩,hf⟩ := hC + constructor + · exact ⟨a,b,fun i hi => (HomologicalComplex.ExactAt.of_isZero (hb i hi)).isZero_homology⟩ + · intro i + have := (hf i).1 + exact ⟨homology_finite C i, ModuleCat.projective_of_categoryTheory_projective _⟩ + +/-- The bounded homology representative has the same finite support and finite terms. -/ +def zeroHomologyK (T : K.{u,v} k) : K.{u,v} k := + ⟨(HomotopyCategory.quotient _ _).obj (zeroComplex (fun i => T.obj.as.homology i)), + zeroHomology_property T.obj.as T.property⟩ + +/-- Every bounded complex of vector spaces is isomorphic to its homology with zero differential. -/ +def formalityIso (T : K.{u,v} k) : zeroHomologyK T ≅ T := by + let C := T.obj.as + let H := zeroComplex (fun i => C.homology i) + let e : (derivedEmbedding k).obj (zeroHomologyK T) ≅ (derivedEmbedding k).obj T := + (DerivedCategory.quotientCompQhIso _).app H ≪≫ + asIso (DerivedCategory.Q.map (formalityMap C)) ≪≫ + ((DerivedCategory.quotientCompQhIso _).app C).symm + exact (derivedEmbedding k).preimageIso e +end LittleFinitistic.VectorComplexFormality + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/VectorIdempotentCompleteness.lean b/lean/OAI/Algebra/Finitistic/Localization/VectorIdempotentCompleteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd6b650d5d8edc1a0e37ae4e460ecef5d5a95cec --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/VectorIdempotentCompleteness.lean @@ -0,0 +1,90 @@ +import OAI.Algebra.Finitistic.Localization.VectorComplexFormality +import OAI.Algebra.Finitistic.Localization.IdempotentImageEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Idempotents HomologicalComplex +namespace LittleFinitistic.VectorComplexFormality +open FiniteProjectiveHomotopy QuadraticEncoding +universe u v +variable {k : Type u} [Field k] + +lemma zeroDifferential_homotopy_eq {C D : CochainComplex (ModuleCat.{v} k) ℤ} + (hC : ∀ i j, C.d i j = 0) (hD : ∀ i j, D.d i j = 0) (f g : C ⟶ D) + (h : (HomotopyCategory.quotient _ _).map f = (HomotopyCategory.quotient _ _).map g) : f=g := by + ext i : 1 + have h' := (HomotopyCategory.homotopyOfEq f g h).comm i + simpa [dNext, prevD, hC, hD] using h' + +lemma zeroDifferential_idempotents_split (T : K.{u,v} k) + (hT : ∀ i j, T.obj.as.d i j = 0) (p : T ⟶ T) (hp : p ≫ p=p) : + ∃ (I : K.{u,v} k) (ι : I ⟶ T) (π : T ⟶ I), ι ≫ π = 𝟙 I ∧ π ≫ ι = p := by + let C := T.obj.as + let q := HomotopyCategory.quotient (ModuleCat.{v} k) (.up ℤ) + let J := inclusion k + obtain ⟨f,hf⟩ := q.map_surjective (J.map p) + have hff : f ≫ f=f := zeroDifferential_homotopy_eq hT hT _ _ (by + erw [q.map_comp, hf, ← J.map_comp, hp]) + have hi (i : ℤ) : (f.f i).hom * (f.f i).hom = (f.f i).hom := by + exact congrArg (fun g => (g.f i).hom) hff + let V (i : ℤ) : ModuleCat.{v} k := ModuleCat.of k (LinearMap.range (f.f i).hom) + let D := zeroComplex V + let inc : D ⟶ C := { + f := fun i => imageInclusion (f.f i).hom + comm' := fun i j _ => by simp [D, zeroComplex, hT, C] } + let pr : C ⟶ D := { + f := fun i => imageProjection (f.f i).hom + comm' := fun i j _ => by simp [D, zeroComplex, hT, C] } + have hip : inc ≫ pr = 𝟙 D := by + ext i : 1 + exact image_inclusion_projection (f.f i).hom (hi i) + have hpi : pr ≫ inc = f := by + ext i : 1 + exact image_projection_inclusion (f.f i).hom + have hD : ComplexProperty k D := by + obtain ⟨⟨a,b,hb⟩,hfin⟩ := T.property + constructor + · refine ⟨a,b,fun i hi => ?_⟩ + have hm : Mono (imageInclusion (f.f i).hom) := by + rw [ModuleCat.mono_iff_injective] + exact Submodule.subtype_injective _ + exact @IsZero.of_mono (ModuleCat k) _ _ _ _ + (imageInclusion (f.f i).hom) hm (hb i hi) + · intro i + have := (hfin i).1 + refine ⟨?_,ModuleCat.projective_of_categoryTheory_projective _⟩ + exact Module.Finite.of_injective (LinearMap.range (f.f i).hom).subtype + (Submodule.subtype_injective _) + let I : K.{u,v} k := ⟨q.obj D,hD⟩ + refine ⟨I,J.preimage (q.map inc),J.preimage (q.map pr),?_,?_⟩ + · apply J.map_injective + rw [J.map_comp, J.map_id] + erw [Functor.map_preimage, Functor.map_preimage] + exact (q.map_comp inc pr).symm.trans ((congrArg q.map hip).trans (q.map_id D)) + · apply J.map_injective + rw [J.map_comp] + erw [Functor.map_preimage, Functor.map_preimage] + exact (q.map_comp pr inc).symm.trans ((congrArg q.map hpi).trans hf) + +/-- Bounded finite-dimensional homotopy complexes split every idempotent. -/ +instance finiteVectorHomotopyIdempotentComplete : IsIdempotentComplete (K.{u,v} k) where + idempotents_split T p hp := by + let e := formalityIso T + let p' := e.hom ≫ p ≫ e.inv + have hp' : p' ≫ p'=p' := by + dsimp [p'] + simp only [Category.assoc, Iso.inv_hom_id_assoc] + rw [← Category.assoc p p, hp] + have hz : ∀ i j, (zeroHomologyK T).obj.as.d i j = 0 := fun _ _ => rfl + exact split_imp_of_iso e p' p (by simp [p',Category.assoc]) + (zeroDifferential_idempotents_split (zeroHomologyK T) hz p' hp') + +/-- The actual bounded finite-dimensional derived target is idempotent complete. -/ +instance finiteVectorDerivedIdempotentComplete : + IsIdempotentComplete (FiniteVectorDerived.{u,v} (k := k)) := + CategoryTheory.Idempotents.Equivalence.isIdempotentComplete (boundedDerivedEquivalence k) inferInstance +end LittleFinitistic.VectorComplexFormality + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Localization/VerdierEvaluationExact.lean b/lean/OAI/Algebra/Finitistic/Localization/VerdierEvaluationExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a86431aae47c3cbc32f6577363bbb75ff061dc6 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Localization/VerdierEvaluationExact.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Localization.TwoConeVerdier + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.TwoConeVerdier.ConePair +variable {C : Type*} [Category* C] [HasZeroObject C] [Preadditive C] + [HasShift C ℤ] [∀ n : ℤ, (shiftFunctor C n).Additive] + [Pretriangulated C] [IsTriangulated C] +variable (T : ConePair C) +variable {D : Type*} [Category* D] [HasZeroObject D] [Preadditive D] + [HasShift D ℤ] [∀ n : ℤ, (shiftFunctor D n).Additive] [Pretriangulated D] +variable (F : C ⥤ D) [F.CommShift ℤ] [F.IsTriangulated] + [IsIso (F.map T.first.mor₁)] [IsIso (F.map T.second.mor₁)] + +instance evaluationLift : Localization.Lifting T.q T.Sigma F (T.evaluation F) := by + unfold evaluation + infer_instance + +instance evaluationShift : (T.evaluation F).CommShift ℤ := + Functor.commShiftOfLocalization T.q T.Sigma ℤ F (T.evaluation F) + +instance evaluationFacShift : NatTrans.CommShift (T.evaluation_fac F).hom ℤ := + NatTrans.commShift_iso_hom_of_localization T.q T.Sigma ℤ F (T.evaluation F) + +/-- The actual factor through the Verdier quotient is exact. -/ +instance evaluationExact : (T.evaluation F).IsTriangulated := by + let := Localization.essSurj_mapArrow_of_hasRightCalculusOfFractions T.q T.Sigma + exact Functor.isTriangulated_of_precomp_iso (T.evaluation_fac F) + +end LittleFinitistic.TwoConeVerdier.ConePair + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Main.lean b/lean/OAI/Algebra/Finitistic/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..c240b665334da6dc7eca86d52224ae38ed233872 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Main.lean @@ -0,0 +1,56 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryOrbit +import OAI.Algebra.Finitistic.Selected.SelectedPDConclusion +import OAI.Algebra.Finitistic.Basic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Main +open SelectedOrdinaryAlgebra SelectedOrdinaryModules + +/-- The fixed algebra and every actual witness are finite dimensional over ℂ. -/ +theorem algebra_finite : FiniteDimensional ℂ A := inferInstance + +theorem test_finite (m : ℕ) [NeZero m] : FiniteDimensional ℂ (testModule m) := inferInstance + +/-- For the one fixed finite-dimensional complex algebra constructed in the +manuscript, every positive m has the actual finite module N_m with the stated +finite projective-dimension bounds. -/ +theorem projective_dimension_bounds (m : ℕ) [NeZero m] : + ((2*m-2 : ℕ) : WithBot ℕ∞) ≤ projectiveDimension (testModule m) ∧ + projectiveDimension (testModule m) < ⊤ := by + have h := SelectedOrdinaryOrbit.extinction m + exact ⟨SelectedPDConclusion.lower_bound_of_survival (FiniteSelectionFamily.test m) (2*m-2) h.2, + SelectedPDConclusion.finite_pd_of_extinction (FiniteSelectionFamily.test m) (2*m) h.1⟩ + +/-- The actual constructed algebra has infinite little finitistic dimension. -/ +theorem infinite_littleFinitisticDimension : littleFinitisticDimension A = ⊤ := by + apply littleFinitisticDimension_eq_top_of_two_mul_bounds + intro m hm + let : NeZero m := ⟨by omega⟩ + exact ⟨testModule m, inferInstance, (projective_dimension_bounds m).2, + (projective_dimension_bounds m).1⟩ + +/-- Main theorem, with finite dimensionality of the one fixed A explicit and +with actual finitely generated witness modules for every positive m. -/ +theorem counterexample : FiniteDimensional ℂ A ∧ littleFinitisticDimension A = ⊤ ∧ + ∀ m : ℕ, 0 < m → ∃ N : ModuleCat.{0} A, Module.Finite A N ∧ + ((2*m-2 : ℕ) : WithBot ℕ∞) ≤ projectiveDimension N ∧ projectiveDimension N < ⊤ := by + refine ⟨inferInstance, infinite_littleFinitisticDimension, ?_⟩ + intro m hm + let : NeZero m := ⟨by omega⟩ + exact ⟨testModule m, inferInstance, projective_dimension_bounds m⟩ + +theorem exists_counterexample : + ∃ (A : Type) (_ : Ring A) (_ : Algebra ℂ A), + FiniteDimensional ℂ A ∧ littleFinitisticDimension A = ⊤ ∧ + ∀ m : ℕ, 0 < m → ∃ N : ModuleCat.{0} A, Module.Finite A N ∧ + ((2*m-2 : ℕ) : WithBot ℕ∞) ≤ projectiveDimension N ∧ + projectiveDimension N < ⊤ := by + exact ⟨SelectedOrdinaryAlgebra.A, inferInstance, inferInstance, counterexample⟩ + +end LittleFinitistic.Main + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryAssociativeTensorModules.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryAssociativeTensorModules.lean new file mode 100644 index 0000000000000000000000000000000000000000..69f61bc6e16b3b8e29f7260a1e3f359fc5830533 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryAssociativeTensorModules.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedActions + +namespace OAI +noncomputable section +namespace LittleFinitistic +universe u +/-- A tensor retaining the right action of the middle bimodule. -/ +def RightTensor (k A : Type u) (_ : Type u) (M N : Type u) [Field k] [Ring A] [Algebra k A] + [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] + [AddCommGroup N] [Module k N] [Module A N] := BalancedTensor.Tensor k A M N + +/-- A tensor retaining the left action of the middle bimodule. -/ +def LeftTensor (k B : Type u) (_ : Type u) (N Z : Type u) [Field k] [Ring B] [Algebra k B] + [AddCommGroup N] [Module k N] [Module Bᵐᵒᵖ N] + [AddCommGroup Z] [Module k Z] [Module B Z] := BalancedTensor.Tensor k B N Z + +variable (k A B M N Z : Type u) [Field k] [Ring A] [Ring B] [Algebra k A] [Algebra k B] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] +variable [AddCommGroup Z] [Module k Z] [Module B Z] [IsScalarTower k B Z] + +namespace RightTensor +instance : AddCommGroup (RightTensor k A B M N) := inferInstanceAs (AddCommGroup (BalancedTensor.Tensor k A M N)) +instance : Module k (RightTensor k A B M N) := inferInstanceAs (Module k (BalancedTensor.Tensor k A M N)) + +local instance : SMulCommClass Bᵐᵒᵖ A N := ⟨fun b a n => (smul_comm a b n).symm⟩ + +def action : Bᵐᵒᵖ →ₐ[k] Module.End k (RightTensor k A B M N) := + BalancedTensor.rightAction +instance : Module Bᵐᵒᵖ (RightTensor k A B M N) := Module.compHom _ (action k A B M N).toRingHom +instance : IsScalarTower k Bᵐᵒᵖ (RightTensor k A B M N) where + smul_assoc r b z := by + change action k A B M N (r • b) z = r • action k A B M N b z + rw [map_smul] + rfl + +def mk : M →ₗ[k] N →ₗ[k] RightTensor k A B M N := BalancedTensor.mk k A M N + +omit [IsScalarTower k Aᵐᵒᵖ M] in +@[simp] theorem smul_mk (b : Bᵐᵒᵖ) (m : M) (n : N) : + b • mk k A B M N m n = mk k A B M N m (b • n) := rfl +end RightTensor + +namespace LeftTensor +instance : AddCommGroup (LeftTensor k B A N Z) := inferInstanceAs (AddCommGroup (BalancedTensor.Tensor k B N Z)) +instance : Module k (LeftTensor k B A N Z) := inferInstanceAs (Module k (BalancedTensor.Tensor k B N Z)) + +def action : A →ₐ[k] Module.End k (LeftTensor k B A N Z) := BalancedTensor.leftAction +instance : Module A (LeftTensor k B A N Z) := Module.compHom _ (action k A B N Z).toRingHom +instance : IsScalarTower k A (LeftTensor k B A N Z) where + smul_assoc r a z := by + change action k A B N Z (r • a) z = r • action k A B N Z a z + rw [map_smul] + rfl + +def mk : N →ₗ[k] Z →ₗ[k] LeftTensor k B A N Z := BalancedTensor.mk k B N Z + +omit [IsScalarTower k B Z] in +@[simp] theorem smul_mk (a : A) (n : N) (z : Z) : + a • mk k A B N Z n z = mk k A B N Z (a • n) z := rfl +end LeftTensor +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryAssociativityNaturality.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryAssociativityNaturality.lean new file mode 100644 index 0000000000000000000000000000000000000000..15c6ca4b0ea0a1d02e7dde9919e3f4c8c9e92e6a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryAssociativityNaturality.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedAssociativity +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorExactness + +namespace OAI +noncomputable section +namespace LittleFinitistic +universe u +variable {k A B M M' N Z Z' : Type u} [Field k] [Ring A] [Ring B] [Algebra k A] [Algebra k B] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] +variable [AddCommGroup Z] [Module k Z] [Module B Z] [IsScalarTower k B Z] +variable [AddCommGroup Z'] [Module k Z'] [Module B Z'] [IsScalarTower k B Z'] + +/-- A map of the first right module retains the middle bimodule's right B-action. -/ +def RightTensor.mapFirst (f : M →ₗ[Aᵐᵒᵖ] M') : RightTensor k A B M N →ₗ[Bᵐᵒᵖ] RightTensor k A B M' N where + __ := (BalancedTensor.mapLeft (k := k) N f).toAddHom + map_smul' b x := by + let F : RightTensor k A B M N →ₗ[k] RightTensor k A B M' N := + BalancedTensor.mapLeft (k := k) N f + have h : F.comp (RightTensor.action k A B M N b) = + (RightTensor.action k A B M' N b).comp F := by + apply BalancedTensor.ext + intro m n + rfl + exact congrArg (fun g => g x) h + +/-- A map of the last left module retains the middle bimodule's left A-action. -/ +def LeftTensor.mapLast (g : Z →ₗ[B] Z') : LeftTensor k B A N Z →ₗ[A] LeftTensor k B A N Z' where + __ := (BalancedTensor.mapRightTo (k := k) (M := N) g).toAddHom + map_smul' a x := by + let F : LeftTensor k B A N Z →ₗ[k] LeftTensor k B A N Z' := + BalancedTensor.mapRightTo (k := k) (M := N) g + have h : F.comp (LeftTensor.action k A B N Z a) = + (LeftTensor.action k A B N Z' a).comp F := by + apply BalancedTensor.ext + intro n z + rfl + exact congrArg (fun g => g x) h + +namespace BalancedAssociativity + +omit [IsScalarTower k B Z] in +/-- Actual associativity is natural in the complex's right-module term. -/ +theorem natural_first (f : M →ₗ[Aᵐᵒᵖ] M') : + (forward k A B M' N Z).comp + (BalancedTensor.mapLeft (k := k) Z (RightTensor.mapFirst (k := k) (B := B) (N := N) f)) = + (BalancedTensor.mapLeft (k := k) (LeftTensor k B A N Z) f).comp (forward k A B M N Z) := by + let F := (forward k A B M' N Z).comp + (BalancedTensor.mapLeft (k := k) Z (RightTensor.mapFirst (k := k) (B := B) (N := N) f)) + let G := (BalancedTensor.mapLeft (k := k) (LeftTensor k B A N Z) f).comp (forward k A B M N Z) + apply BalancedTensor.ext + intro x z + have h : F.comp ((BalancedTensor.mk k B (RightTensor k A B M N) Z).flip z) = + G.comp ((BalancedTensor.mk k B (RightTensor k A B M N) Z).flip z) := by + apply BalancedTensor.ext + intro m n + rfl + exact congrArg (fun f => f x) h + +omit [IsScalarTower k Aᵐᵒᵖ M] in +/-- Actual associativity is natural in the arbitrary input module. -/ +theorem natural_last (g : Z →ₗ[B] Z') : + (forward k A B M N Z').comp (BalancedTensor.mapRightTo (k := k) (M := RightTensor k A B M N) g) = + (BalancedTensor.mapRightTo (k := k) (M := M) (LeftTensor.mapLast (k := k) (A := A) (N := N) g)).comp + (forward k A B M N Z) := by + let F := (forward k A B M N Z').comp + (BalancedTensor.mapRightTo (k := k) (M := RightTensor k A B M N) g) + let G := (BalancedTensor.mapRightTo (k := k) (M := M) + (LeftTensor.mapLast (k := k) (A := A) (N := N) g)).comp (forward k A B M N Z) + apply BalancedTensor.ext + intro x z + have h : F.comp ((BalancedTensor.mk k B (RightTensor k A B M N) Z).flip z) = + G.comp ((BalancedTensor.mk k B (RightTensor k A B M N) Z).flip z) := by + apply BalancedTensor.ext + intro m n + rfl + exact congrArg (fun f => f x) h + +end BalancedAssociativity +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedActions.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedActions.lean new file mode 100644 index 0000000000000000000000000000000000000000..e10322c9531b1d6dcbb137a5cb312f26e9a43c06 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedActions.lean @@ -0,0 +1,72 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedTensorMaps +import Mathlib.RingTheory.TensorProduct.Maps + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.BalancedTensor +universe u +variable {k A M N S T : Type u} [Field k] [Ring A] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +/-- Tensor an actual left-module homomorphism with the identity. -/ +def mapRight (f : N →ₗ[A] N) : Tensor k A M N →ₗ[k] Tensor k A M N := + lift ((mk k A M N).compl₁₂ LinearMap.id (f.restrictScalars k)) (by + intro a m n + change mk k A M N (MulOpposite.op a • m) (f n) = mk k A M N m (f (a • n)) + rw [f.map_smul, balance]) + +omit [IsScalarTower k Aᵐᵒᵖ M] in +@[simp] theorem mapRight_mk (f : N →ₗ[A] N) (m : M) (n : N) : + mapRight (k := k) (M := M) f (mk k A M N m n) = mk k A M N m (f n) := rfl + +variable [Ring S] [Algebra k S] [Module S M] [IsScalarTower k S M] + [SMulCommClass S Aᵐᵒᵖ M] + +/-- The left coefficient action is induced from the first balanced-tensor factor. -/ +def leftAction : S →ₐ[k] Module.End k (Tensor k A M N) where + toFun s := mapLeft N (Algebra.lsmul k Aᵐᵒᵖ M s) + map_one' := by apply ext; intro m n; simp + map_mul' s t := by apply ext; intro m n; simp + map_zero' := by apply ext; intro m n; simp + map_add' s t := by apply ext; intro m n; simp + commutes' r := by apply ext; intro m n; simp + +omit [IsScalarTower k A N] in +@[simp] theorem leftAction_mk (s : S) (m : M) (n : N) : + leftAction (k := k) (A := A) (N := N) s (mk k A M N m n) = mk k A M N (s • m) n := rfl + +variable [Ring T] [Algebra k T] [Module T N] [IsScalarTower k T N] + [SMulCommClass T A N] + +/-- The right coefficient action is induced from the second balanced-tensor factor. -/ +def rightAction : T →ₐ[k] Module.End k (Tensor k A M N) where + toFun t := mapRight (Algebra.lsmul k A N t) + map_one' := by apply ext; intro m n; simp + map_mul' s t := by apply ext; intro m n; simp + map_zero' := by apply ext; intro m n; simp + map_add' s t := by apply ext; intro m n; simp + commutes' r := by apply ext; intro m n; simp + +omit [IsScalarTower k Aᵐᵒᵖ M] in +@[simp] theorem rightAction_mk (t : T) (m : M) (n : N) : + rightAction (k := k) (A := A) (M := M) t (mk k A M N m n) = mk k A M N m (t • n) := rfl + +/-- Both outside actions on a balanced tensor, combined without forgetting either factor. -/ +def bimoduleAction : (S ⊗[k] T) →ₐ[k] Module.End k (Tensor k A M N) := + Algebra.TensorProduct.lift (leftAction (k := k) (A := A) (M := M) (N := N)) + (rightAction (k := k) (A := A) (M := M) (N := N)) (by + intro s t + apply ext + intro m n + rfl) + +@[simp] theorem bimoduleAction_tmul_mk (s : S) (t : T) (m : M) (n : N) : + bimoduleAction (k := k) (A := A) (M := M) (N := N) (s ⊗ₜ[k] t) (mk k A M N m n) = + mk k A M N (s • m) (t • n) := rfl +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedAssociativity.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedAssociativity.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a3e45ca35ef765a91494e6a28710a2981bb5257 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedAssociativity.lean @@ -0,0 +1,153 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryAssociativeTensorModules +import Mathlib.Tactic.Abel + +namespace OAI +noncomputable section +namespace LittleFinitistic.BalancedAssociativity +open BalancedTensor +universe u +variable (k A B M N Z : Type u) [Field k] [Ring A] [Ring B] [Algebra k A] [Algebra k B] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] +variable [AddCommGroup Z] [Module k Z] [Module B Z] + +abbrev Left := Tensor k B (RightTensor k A B M N) Z +abbrev Right := Tensor k A M (LeftTensor k B A N Z) + +/-- Reassociate a fixed last input through the actual A-balanced quotient. -/ +def forwardAt (z : Z) : RightTensor k A B M N →ₗ[k] Right k A B M N Z := + lift ((mk k A M (LeftTensor k B A N Z)).compl₁₂ LinearMap.id ((LeftTensor.mk k A B N Z).flip z)) (by + intro a m n + change mk k A M (LeftTensor k B A N Z) (MulOpposite.op a • m) (LeftTensor.mk k A B N Z n z) = + mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z (a • n) z) + rw [balance,LeftTensor.smul_mk]) + +@[simp] theorem forwardAt_mk (m : M) (n : N) (z : Z) : + forwardAt k A B M N Z z (RightTensor.mk k A B M N m n) = + mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n z) := rfl + +def forwardBilinear : RightTensor k A B M N →ₗ[k] Z →ₗ[k] Right k A B M N Z where + toFun x := + { toFun := fun z => forwardAt k A B M N Z z x + map_add' := fun z z' => by + have h : forwardAt k A B M N Z (z+z') = + forwardAt k A B M N Z z + forwardAt k A B M N Z z' := by + apply BalancedTensor.ext + intro m n + change mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n (z+z')) = + mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n z) + + mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n z') + simp only [map_add] + exact congrArg (fun f => f x) h + map_smul' := fun r z => by + have h : forwardAt k A B M N Z (r • z) = r • forwardAt k A B M N Z z := by + apply BalancedTensor.ext + intro m n + change mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n (r • z)) = + r • mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n z) + simp only [map_smul] + exact congrArg (fun f => f x) h } + map_add' x y := by ext z; exact (forwardAt k A B M N Z z).map_add x y + map_smul' r x := by ext z; exact (forwardAt k A B M N Z z).map_smul r x + +/-- The actual forward associativity map of balanced tensors. -/ +def forward : Left k A B M N Z →ₗ[k] Right k A B M N Z := + lift (forwardBilinear k A B M N Z) (by + intro b x z + have h : (forwardAt k A B M N Z z).comp (RightTensor.action k A B M N (MulOpposite.op b)) = + forwardAt k A B M N Z (b • z) := by + apply BalancedTensor.ext + intro m n + change forwardAt k A B M N Z z (MulOpposite.op b • RightTensor.mk k A B M N m n) = + forwardAt k A B M N Z (b • z) (RightTensor.mk k A B M N m n) + rw [RightTensor.smul_mk,forwardAt_mk,forwardAt_mk] + exact congrArg (mk k A M (LeftTensor k B A N Z) m) (balance b n z) + exact congrArg (fun f => f x) h) + + +@[simp] theorem forward_mk (m : M) (n : N) (z : Z) : + forward k A B M N Z (mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m n) z) = + mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n z) := rfl + +/-- Reassociate a fixed first input through the actual B-balanced quotient. -/ +def inverseAt (m : M) : LeftTensor k B A N Z →ₗ[k] Left k A B M N Z := + lift ((mk k B (RightTensor k A B M N) Z).compl₁₂ (RightTensor.mk k A B M N m) LinearMap.id) (by + intro b n z + change mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m (MulOpposite.op b • n)) z = + mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m n) (b • z) + rw [← RightTensor.smul_mk,balance]) + +@[simp] theorem inverseAt_mk (m : M) (n : N) (z : Z) : + inverseAt k A B M N Z m (LeftTensor.mk k A B N Z n z) = + mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m n) z := rfl + +def inverseBilinear : M →ₗ[k] LeftTensor k B A N Z →ₗ[k] Left k A B M N Z where + toFun := inverseAt k A B M N Z + map_add' m m' := by + apply BalancedTensor.ext + intro n z + change mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N (m+m') n) z = + mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m n) z + + mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m' n) z + simp only [map_add,LinearMap.add_apply] + map_smul' r m := by + apply BalancedTensor.ext + intro n z + change mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N (r • m) n) z = + r • mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m n) z + simp only [map_smul,LinearMap.smul_apply] + +/-- The actual inverse associativity map of balanced tensors. -/ +def inverse : Right k A B M N Z →ₗ[k] Left k A B M N Z := + lift (inverseBilinear k A B M N Z) (by + intro a m x + have h : inverseAt k A B M N Z (MulOpposite.op a • m) = + (inverseAt k A B M N Z m).comp (LeftTensor.action k A B N Z a) := by + apply BalancedTensor.ext + intro n z + change inverseAt k A B M N Z (MulOpposite.op a • m) (LeftTensor.mk k A B N Z n z) = + inverseAt k A B M N Z m (a • LeftTensor.mk k A B N Z n z) + rw [LeftTensor.smul_mk,inverseAt_mk,inverseAt_mk] + exact congrArg (fun y => mk k B (RightTensor k A B M N) Z y z) (balance a m n) + exact congrArg (fun f => f x) h) + + +@[simp] theorem inverse_mk (m : M) (n : N) (z : Z) : + inverse k A B M N Z (mk k A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n z)) = + mk k B (RightTensor k A B M N) Z (RightTensor.mk k A B M N m n) z := rfl + +/-- Associativity of the actual noncommutative balanced tensor, with no flatness hypotheses. -/ +def equivalence : Left k A B M N Z ≃ₗ[k] Right k A B M N Z where + __ := forward k A B M N Z + invFun := inverse k A B M N Z + left_inv x := by + let F := (inverse k A B M N Z).comp (forward k A B M N Z) + have h : F = LinearMap.id := by + apply BalancedTensor.ext + intro y z + have hz : F.comp ((mk k B (RightTensor k A B M N) Z).flip z) = + (mk k B (RightTensor k A B M N) Z).flip z := by + apply BalancedTensor.ext + intro m n + rfl + exact congrArg (fun f => f y) hz + exact congrArg (fun f => f x) h + right_inv x := by + let F := (forward k A B M N Z).comp (inverse k A B M N Z) + have h : F = LinearMap.id := by + apply BalancedTensor.ext + intro m y + have hm : F.comp (mk k A M (LeftTensor k B A N Z) m) = + mk k A M (LeftTensor k B A N Z) m := by + apply BalancedTensor.ext + intro n z + rfl + exact congrArg (fun f => f y) hm + exact congrArg (fun f => f x) h + +end LittleFinitistic.BalancedAssociativity + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedCongruence.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedCongruence.lean new file mode 100644 index 0000000000000000000000000000000000000000..35500fdfb41e0e384634be97e81c24de845b147c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBalancedCongruence.lean @@ -0,0 +1,33 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorBimap + +namespace OAI +noncomputable section +namespace LittleFinitistic.BalancedTensor +universe u +variable {k A M M' N N' : Type u} [Field k] [Ring A] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] + +/-- Actual balanced tensor congruence under module equivalences in both factors. -/ +def congr (e : M ≃ₗ[Aᵐᵒᵖ] M') (f : N ≃ₗ[A] N') : Tensor k A M N ≃ₗ[k] Tensor k A M' N' where + __ := bimap (k := k) e.toLinearMap f.toLinearMap + invFun := bimap (k := k) e.symm.toLinearMap f.symm.toLinearMap + left_inv x := by + change bimap e.symm.toLinearMap f.symm.toLinearMap (bimap e.toLinearMap f.toLinearMap x) = x + induction x using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => simp only [bimap_mk,LinearEquiv.coe_coe,LinearEquiv.symm_apply_apply] + | ha x y hx hy => simp only [map_add,hx,hy] + right_inv x := by + change bimap e.toLinearMap f.toLinearMap (bimap e.symm.toLinearMap f.symm.toLinearMap x) = x + induction x using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => simp only [bimap_mk,LinearEquiv.coe_coe,LinearEquiv.apply_symm_apply] + | ha x y hx hy => simp only [map_add,hx,hy] +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimodule.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimodule.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f124d930d2809735f3bcad2bcfd3009762c4e79 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimodule.lean @@ -0,0 +1,98 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryCompression +import Mathlib.Algebra.Algebra.Opposite + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +abbrev Enveloping (k B : Type u) [Field k] [Ring B] [Algebra k B] := B ⊗[k] Bᵐᵒᵖ + +/-- O from the genuine dg B-bimodule, as an ordinary finite sum of its terms. -/ +def BimoduleO (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) + (a : ℤ) (l : ℕ) := Compression P a l + +namespace BimoduleO +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +instance : AddCommGroup (BimoduleO P a l) := inferInstanceAs (AddCommGroup (Compression P a l)) +instance : Module k (BimoduleO P a l) := inferInstanceAs (Module k (Compression P a l)) +instance : Module (Enveloping k B) (BimoduleO P a l) := inferInstanceAs (Module (Enveloping k B) (Compression P a l)) +instance : IsScalarTower k (Enveloping k B) (BimoduleO P a l) := inferInstanceAs (IsScalarTower k (Enveloping k B) (Compression P a l)) +instance : Module B (BimoduleO P a l) := + Module.compHom (Compression P a l) (Algebra.TensorProduct.includeLeft (R := k) (S := k) (B := Bᵐᵒᵖ)).toRingHom +instance : Module Bᵐᵒᵖ (BimoduleO P a l) := + Module.compHom (Compression P a l) (Algebra.TensorProduct.includeRight (R := k) (A := B)).toRingHom +instance : Module (ChainAlgebra k l) (BimoduleO P a l) := + inferInstanceAs (Module (ChainAlgebra k l) (Compression P a l)) +instance : IsScalarTower k (ChainAlgebra k l) (BimoduleO P a l) := + inferInstanceAs (IsScalarTower k (ChainAlgebra k l) (Compression P a l)) + +instance : SMulCommClass (ChainAlgebra k l) (Enveloping k B) (BimoduleO P a l) := + inferInstanceAs (SMulCommClass (ChainAlgebra k l) (Enveloping k B) (Compression P a l)) + +instance towerLeft : IsScalarTower k B (BimoduleO P a l) := by + apply IsScalarTower.of_algebraMap_smul + intro c v + change (Algebra.TensorProduct.includeLeft (R := k) (S := k) (B := Bᵐᵒᵖ) ((algebraMap k B) c)) • + (v : Compression P a l) = c • v + rw [AlgHom.commutes] + exact algebraMap_smul (Enveloping k B) c v + +instance towerRight : IsScalarTower k Bᵐᵒᵖ (BimoduleO P a l) := by + apply IsScalarTower.of_algebraMap_smul + intro c v + change (Algebra.TensorProduct.includeRight (R := k) (A := B) ((algebraMap k Bᵐᵒᵖ) c)) • + (v : Compression P a l) = c • v + rw [AlgHom.commutes] + exact algebraMap_smul (Enveloping k B) c v + +instance commuteLeftRight : SMulCommClass B Bᵐᵒᵖ (BimoduleO P a l) where + smul_comm b r v := by + change ((b ⊗ₜ[k] (1:Bᵐᵒᵖ)) : Enveloping k B) • + (((1:B) ⊗ₜ[k] r) • (v : Compression P a l)) = + ((1:B) ⊗ₜ[k] r) • ((b ⊗ₜ[k] (1:Bᵐᵒᵖ)) • (v : Compression P a l)) + rw [← mul_smul, ← mul_smul] + simp [Algebra.TensorProduct.tmul_mul_tmul] + +instance commuteChainLeft : SMulCommClass (ChainAlgebra k l) B (BimoduleO P a l) where + smul_comm x b v := by + change x • (((b ⊗ₜ[k] (1:Bᵐᵒᵖ)) : Enveloping k B) • (v : Compression P a l)) = + ((b ⊗ₜ[k] (1:Bᵐᵒᵖ)) : Enveloping k B) • (x • (v : Compression P a l)) + exact smul_comm _ _ _ + +instance commuteChainRight : SMulCommClass (ChainAlgebra k l) Bᵐᵒᵖ (BimoduleO P a l) where + smul_comm x b v := by + change x • ((((1:B) ⊗ₜ[k] b) : Enveloping k B) • (v : Compression P a l)) = + (((1:B) ⊗ₜ[k] b) : Enveloping k B) • (x • (v : Compression P a l)) + exact smul_comm _ _ _ + +/-- The left B tensor C action takes values in actual right-B-linear maps. -/ +def leftAction : (B ⊗[k] ChainAlgebra k l) →ₐ[k] Module.End Bᵐᵒᵖ (BimoduleO P a l) := + Algebra.TensorProduct.lift (Algebra.lsmul k Bᵐᵒᵖ (BimoduleO P a l)) + (Algebra.lsmul k Bᵐᵒᵖ (BimoduleO P a l)) (by + intro b x + ext v + exact (smul_comm x b v).symm) + +instance leftModule : Module (B ⊗[k] ChainAlgebra k l) (BimoduleO P a l) := + Module.compHom (BimoduleO P a l) (leftAction P a l).toRingHom + +instance towerTensor : IsScalarTower k (B ⊗[k] ChainAlgebra k l) (BimoduleO P a l) where + smul_assoc c x v := by + change leftAction P a l (c • x) v = c • leftAction P a l x v + rw [map_smul] + rfl + +instance commuteTensorRight : SMulCommClass (B ⊗[k] ChainAlgebra k l) Bᵐᵒᵖ (BimoduleO P a l) where + smul_comm x b v := (leftAction P a l x).map_smul b v + +instance finiteDimensional [∀ n, FiniteDimensional k ((underlyingComplex (k := k) P).X n)] : + FiniteDimensional k (BimoduleO P a l) := inferInstanceAs (FiniteDimensional k (Compression P a l)) +end BimoduleO +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAssociativeTerms.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAssociativeTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1da02909a92aa2d44e6a1ce1796ba7c809e8127 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAssociativeTerms.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleAssociativity +import OAI.Algebra.Finitistic.Ordinary.OrdinaryLeftTensorCongruence +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTerms +import OAI.Algebra.Finitistic.Ordinary.OrdinaryMiddleTensorFunctors + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A B N : Type u) [Field k] [Ring S] [Ring A] [Ring B] + [Algebra k S] [Algebra k A] [Algebra k B] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] +local instance : SMulCommClass Bᵐᵒᵖ A N := ⟨fun b a n => (smul_comm a b n).symm⟩ +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +abbrev middleBimoduleComplex := ((bimoduleTensorFunctor k S A Bᵐᵒᵖ N).mapHomologicalComplex (.up ℤ)).obj Q + +/-- Associativity on actual cochain terms, retaining the outside S-action. -/ +def associativeTermEquiv (p q : ℤ) : + term k S B (middleBimoduleComplex k S A B N Q) Z p q ≃ₗ[S] + term k S A Q (middleLeftComplex k A B N Z) p q := by + let eZ : LeftTensor k B A N (ComplexTensor.leftTerm k B Z q) ≃ₗ[A] + ComplexTensor.leftTerm k A (middleLeftComplex k A B N Z) q := LinearEquiv.refl _ _ + exact (BimoduleAssociativity.equivalence k S A B (BimoduleCoefficients k S A (Q.X p)) N + (ComplexTensor.leftTerm k B Z q)).trans + (LeftTensor.congr (LinearEquiv.refl Aᵐᵒᵖ (BimoduleCoefficients k S A (Q.X p))) (fun _ _ => rfl) eZ) + +/-- Associativity commutes with both actual cochain-term maps. -/ +theorem associativeTermEquiv_map {p p' q q' : ℤ} (f : Q.X p ⟶ Q.X p') (g : Z.X q ⟶ Z.X q') : + (associativeTermEquiv k S A B N Q Z p' q').toLinearMap.comp + (map k S B (middleBimoduleComplex k S A B N Q) Z ((bimoduleTensorFunctor k S A Bᵐᵒᵖ N).map f) g) = + (map k S A Q (middleLeftComplex k A B N Z) f ((middleLeftFunctor k A B N).map g)).comp + (associativeTermEquiv k S A B N Q Z p q).toLinearMap := by + let F := (associativeTermEquiv k S A B N Q Z p' q').toLinearMap.comp + (map k S B (middleBimoduleComplex k S A B N Q) Z ((bimoduleTensorFunctor k S A Bᵐᵒᵖ N).map f) g) + let G := (map k S A Q (middleLeftComplex k A B N Z) f ((middleLeftFunctor k A B N).map g)).comp + (associativeTermEquiv k S A B N Q Z p q).toLinearMap + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x z + let j := (LeftTensor.mk k S B + (BimoduleCoefficients k S B ((middleBimoduleComplex k S A B N Q).X p)) + (ComplexTensor.leftTerm k B Z q)).flip z + let L : BalancedTensor.Tensor k A (BimoduleCoefficients k S A (Q.X p)) N →+ + term k S A Q (middleLeftComplex k A B N Z) p' q' := + ((F.restrictScalars k).comp j).toAddMonoidHom + let R : BalancedTensor.Tensor k A (BimoduleCoefficients k S A (Q.X p)) N →+ + term k S A Q (middleLeftComplex k A B N Z) p' q' := + ((G.restrictScalars k).comp j).toAddMonoidHom + have h : L = R := by + apply AddMonoidHom.ext + intro x + induction x using BalancedTensor.induction_on with + | hz => exact L.map_zero.trans R.map_zero.symm + | ht m n => rfl + | ha x y hx hy => + exact (L.map_add x y).trans ((congrArg₂ (· + ·) hx hy).trans (R.map_add x y).symm) + exact congrArg (fun f => f x) h + +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAssociativity.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAssociativity.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ea453676b9cd59d2e7bd9eeb6efc6c8f6a5ae7c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAssociativity.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorFunctor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorRightRestriction +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedAssociativity +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedCongruence +import OAI.Algebra.Finitistic.Ordinary.OrdinaryLeftTensorMaps + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleAssociativity +universe u +variable (k S A B M N Z : Type u) [Field k] [Ring S] [Ring A] [Ring B] + [Algebra k S] [Algebra k A] [Algebra k B] +variable [AddCommGroup M] [Module k M] [Module S M] [Module Aᵐᵒᵖ M] + [IsScalarTower k S M] [IsScalarTower k Aᵐᵒᵖ M] [SMulCommClass S Aᵐᵒᵖ M] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] +variable [AddCommGroup Z] [Module k Z] [Module B Z] [IsScalarTower k B Z] +local instance : SMulCommClass Bᵐᵒᵖ A N := ⟨fun b a n => (smul_comm a b n).symm⟩ + +abbrev coefficient := BimoduleCoefficients k S B + (ModuleCat.of (S ⊗[k] Bᵐᵒᵖ) (TwoSidedTensor k A S Bᵐᵒᵖ M N)) +abbrev source := LeftTensor k B S (coefficient k S A B M N) Z +abbrev target := LeftTensor k A S M (LeftTensor k B A N Z) + +def scalarEquiv : source k S A B M N Z ≃ₗ[k] target k S A B M N Z := by + let e : coefficient k S A B M N ≃ₗ[Bᵐᵒᵖ] RightTensor k A B M N := + (TwoSidedTensor.rightActionEquiv k A B S M N).symm + exact (BalancedTensor.congr (k := k) e (LinearEquiv.refl B Z)).trans + (BalancedAssociativity.equivalence k A B M N Z) + +@[simp] theorem scalarEquiv_mk (m : M) (n : N) (z : Z) : + scalarEquiv k S A B M N Z (LeftTensor.mk k S B (coefficient k S A B M N) Z + (TwoSidedTensor.mk k A S Bᵐᵒᵖ M N m n) z) = + LeftTensor.mk k S A M (LeftTensor k B A N Z) m (LeftTensor.mk k A B N Z n z) := rfl + +theorem coefficient_smul_mk (s : S) (m : M) (n : N) : + s • (show coefficient k S A B M N from TwoSidedTensor.mk k A S Bᵐᵒᵖ M N m n) = + (show coefficient k S A B M N from TwoSidedTensor.mk k A S Bᵐᵒᵖ M N (s • m) n) := by + change (s ⊗ₜ[k] (1:Bᵐᵒᵖ)) • TwoSidedTensor.mk k A S Bᵐᵒᵖ M N m n = _ + rw [TwoSidedTensor.tmul_smul_mk,one_smul] + +private theorem scalarEquiv_smul_mk (s : S) (m : M) (n : N) (z : Z) : + scalarEquiv k S A B M N Z + (s • LeftTensor.mk k S B (coefficient k S A B M N) Z + (show coefficient k S A B M N from TwoSidedTensor.mk k A S Bᵐᵒᵖ M N m n) z) = + s • scalarEquiv k S A B M N Z + (LeftTensor.mk k S B (coefficient k S A B M N) Z + (show coefficient k S A B M N from TwoSidedTensor.mk k A S Bᵐᵒᵖ M N m n) z) := by + erw [LeftTensor.smul_mk, coefficient_smul_mk] + exact (scalarEquiv_mk k S A B M N Z (s • m) n z).trans + ((LeftTensor.smul_mk k S A M (LeftTensor k B A N Z) s m + (LeftTensor.mk k A B N Z n z)).symm.trans + (congrArg (fun y => s • y) (scalarEquiv_mk k S A B M N Z m n z).symm)) + +/-- Ordinary balanced associativity retains the actual outside left action. -/ +def equivalence : source k S A B M N Z ≃ₗ[S] target k S A B M N Z where + __ := (scalarEquiv k S A B M N Z).toAddEquiv + map_smul' s x := by + let e := (scalarEquiv k S A B M N Z).toLinearMap + let L := e.comp (LeftTensor.action k S B (coefficient k S A B M N) Z s) + let R := (LeftTensor.action k S A M (LeftTensor k B A N Z) s).comp e + have h : L = R := by + apply BalancedTensor.ext + intro y z + let Lz : BalancedTensor.Tensor k A M N →+ target k S A B M N Z := + (L.comp ((LeftTensor.mk k S B (coefficient k S A B M N) Z).flip z)).toAddMonoidHom + let Rz : BalancedTensor.Tensor k A M N →+ target k S A B M N Z := + (R.comp ((LeftTensor.mk k S B (coefficient k S A B M N) Z).flip z)).toAddMonoidHom + have hz : Lz = Rz := by + apply AddMonoidHom.ext + intro y + induction y using BalancedTensor.induction_on with + | hz => exact Lz.map_zero.trans Rz.map_zero.symm + | ha x y hx hy => + exact (Lz.map_add x y).trans ((congrArg₂ (· + ·) hx hy).trans (Rz.map_add x y).symm) + | ht m n => exact scalarEquiv_smul_mk k S A B M N Z s m n z + exact congrArg (fun f => f y) hz + exact congrArg (fun f => f x) h + +end LittleFinitistic.BimoduleAssociativity + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAugmentation.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAugmentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9065366d40a2f7c677659b30341186918e5d381 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAugmentation.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorBimoduleResolution +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRestrictionHomology + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +abbrev bimoduleTerminal := RetainedBimodule k B (B ⊗[k] ChainAlgebra k l) (TerminalTensor B) +abbrev bimoduleTerminalObject : ModuleCat.{u} (B ⊗[k] (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ) := + ModuleCat.of _ (bimoduleTerminal k B l) + +def bimoduleAugmentationHom : (bimoduleComplex k B l).X l ⟶ bimoduleTerminalObject k B l := + ModuleCat.ofHom (RetainedBimodule.map (k := k) (S := B) (A := B ⊗[k] ChainAlgebra k l) + (augmentation k B l) (augmentation_left k B l)) + +/-- The actual augmentation of the genuine finite bimodule resolution. -/ +def bimoduleAugmentationMap : bimoduleComplex k B l ⟶ + (HomologicalComplex.single _ (.up ℕ) l).obj (bimoduleTerminalObject k B l) := + HomologicalComplex.mkHomToSingle (bimoduleAugmentationHom k B l) (by + intro i hi + change i+1=l at hi + subst l + change CochainComplex.of.d _ _ i (i+1) ≫ bimoduleAugmentationHom k B (i+1) = 0 + erw [CochainComplex.of_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact congrArg (fun f => f x) (augmentation_comp k B i)) + +def forgetBimoduleTerminal : (forgetBimodule k B l).obj (bimoduleTerminalObject k B l) ≅ + ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B) := by + let e : (forgetBimodule k B l).obj (bimoduleTerminalObject k B l) ≃ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] + TerminalTensor B := + { toFun := fun x => x + invFun := fun x => x + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun r x => by + change (1:B) * (TerminalTensor.value B x * terminalAugmentation k B l r.unop) = + TerminalTensor.value B x * terminalAugmentation k B l r.unop + exact one_mul _ } + exact e.toModuleIso + +def forgetAugmentationTargetIso : + ((forgetBimodule k B l).mapHomologicalComplex (.up ℕ)).obj + ((HomologicalComplex.single _ (.up ℕ) l).obj (bimoduleTerminalObject k B l)) ≅ + (HomologicalComplex.single _ (.up ℕ) l).obj + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) := + (HomologicalComplex.singleMapHomologicalComplex (forgetBimodule k B l) (.up ℕ) l).app + (bimoduleTerminalObject k B l) ≪≫ + (HomologicalComplex.single _ (.up ℕ) l).mapIso (forgetBimoduleTerminal k B l) +end LittleFinitistic.OrdinarySimulation.TensorResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAugmentationQuasiIso.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAugmentationQuasiIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..c3849c9c7d0ff797422a5c90103a1c9d67f998ef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleAugmentationQuasiIso.lean @@ -0,0 +1,88 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleAugmentation + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +/-- The genuine augmentation becomes exactly the already verified right-module augmentation. -/ +theorem forget_bimoduleAugmentation : + (forgetBimoduleComplex k B l).hom ≫ augmentationMap k B l = + ((forgetBimodule k B l).mapHomologicalComplex (.up ℕ)).map (bimoduleAugmentationMap k B l) ≫ + (forgetAugmentationTargetIso k B l).hom := by + apply HomologicalComplex.Hom.ext + funext n + by_cases hn : n = l + · subst n + change (forgetBimoduleTerm k B l l).hom ≫ (augmentationMap k B l).f l = + (forgetBimodule k B l).map ((bimoduleAugmentationMap k B l).f l) ≫ + (forgetAugmentationTargetIso k B l).hom.f l + have h₁ : (augmentationMap k B l).f l = augmentationHom k B l ≫ + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B))).inv := by + unfold augmentationMap + apply HomologicalComplex.mkHomToSingle_f + have h₂ : (bimoduleAugmentationMap k B l).f l = bimoduleAugmentationHom k B l ≫ + (HomologicalComplex.singleObjXSelf (.up ℕ) l (bimoduleTerminalObject k B l)).inv := by + unfold bimoduleAugmentationMap + apply HomologicalComplex.mkHomToSingle_f + rw [h₁,h₂] + change (forgetBimoduleTerm k B l l).hom ≫ augmentationHom k B l ≫ + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B))).inv = + (forgetBimodule k B l).map (bimoduleAugmentationHom k B l ≫ + (HomologicalComplex.singleObjXSelf (.up ℕ) l (bimoduleTerminalObject k B l)).inv) ≫ + ((HomologicalComplex.singleMapHomologicalComplex (forgetBimodule k B l) (.up ℕ) l).hom.app + (bimoduleTerminalObject k B l)).f l ≫ + ((HomologicalComplex.single _ (.up ℕ) l).map (forgetBimoduleTerminal k B l).hom).f l + rw [HomologicalComplex.singleMapHomologicalComplex_hom_app_self, + HomologicalComplex.single_map_f_self] + simp only [Category.assoc,Iso.inv_hom_id_assoc] + rw [(forgetBimodule k B l).map_comp] + have hc := ((forgetBimodule k B l).mapIso + (HomologicalComplex.singleObjXSelf (.up ℕ) l (bimoduleTerminalObject k B l))).inv_hom_id_assoc + ((forgetBimoduleTerminal k B l).hom ≫ + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B))).inv) + rw [Category.assoc] + refine Eq.trans ?_ (congrArg (fun t => (forgetBimodule k B l).map (bimoduleAugmentationHom k B l) ≫ t) hc).symm + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl + · exact (HomologicalComplex.isZero_single_obj_X (.up ℕ) l + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) n hn).eq_of_tgt _ _ + +/-- Actual augmentation quasi-isomorphism with its outside left B-action retained. -/ +theorem bimoduleAugmentationMap_quasiIso : QuasiIso (bimoduleAugmentationMap k B l) := by + apply (RestrictionHomology.quasiIso_iff + (Algebra.TensorProduct.includeRight (R := k) (A := B) (B := (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ)).toRingHom _).mp + let g := ((forgetBimodule k B l).mapHomologicalComplex (.up ℕ)).map (bimoduleAugmentationMap k B l) + let := augmentationMap_quasiIso k B l + have h : QuasiIso (g ≫ (forgetAugmentationTargetIso k B l).hom) := by + dsimp only [g] + rw [← forget_bimoduleAugmentation] + infer_instance + exact (quasiIso_iff_comp_right g (forgetAugmentationTargetIso k B l).hom).mp h + +/-- The source's augmentation in degrees [-l,0], as a genuine bimodule map. -/ +def integerBimoduleAugmentation : integerBimoduleComplex k B l ⟶ + (HomologicalComplex.single _ (.up ℤ) 0).obj (bimoduleTerminalObject k B l) := + HomologicalComplex.extendMap (bimoduleAugmentationMap k B l) (degreeEmbedding l) ≫ + (HomologicalComplex.extendSingleIso (e := degreeEmbedding l) + (X := bimoduleTerminalObject k B l) l 0 (by simp)).hom + +theorem integerBimoduleAugmentation_quasiIso : QuasiIso (integerBimoduleAugmentation k B l) := by + have := bimoduleAugmentationMap_quasiIso k B l + exact inferInstanceAs (QuasiIso + (HomologicalComplex.extendMap (bimoduleAugmentationMap k B l) (degreeEmbedding l) ≫ + (HomologicalComplex.extendSingleIso (e := degreeEmbedding l) + (X := bimoduleTerminalObject k B l) l 0 (by simp)).hom)) +end LittleFinitistic.OrdinarySimulation.TensorResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleCoefficientEquiv.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleCoefficientEquiv.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9544c256b8cc8c8eadb1edd8736278dd74e370b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleCoefficientEquiv.lean @@ -0,0 +1,56 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleCoefficients +import OAI.Algebra.Finitistic.Ordinary.OrdinaryLeftTensorCongruence +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTerms + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleCoefficients +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable {M N : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)} + +def equiv (e : M ≅ N) : BimoduleCoefficients k S A M ≃ₗ[Aᵐᵒᵖ] BimoduleCoefficients k S A N where + __ := map k S A e.hom + invFun := map k S A e.inv + left_inv x := congrArg (fun h => h.hom x) e.hom_inv_id + right_inv x := congrArg (fun h => h.hom x) e.inv_hom_id + +theorem equiv_left (e : M ≅ N) (s : S) (x : BimoduleCoefficients k S A M) : + equiv k S A e (s • x) = s • equiv k S A e x := map_left k S A e.hom s x +end LittleFinitistic.BimoduleCoefficients +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable {Q Q' : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ} +variable (e : Q ≅ Q') (Z : CochainComplex (ModuleCat.{u} A) ℤ) + +def rightTermEquiv (p q : ℤ) : term k S A Q Z p q ≃ₗ[S] term k S A Q' Z p q := + LeftTensor.congr (BimoduleCoefficients.equiv k S A ((HomologicalComplex.eval _ _ p).mapIso e)) + (BimoduleCoefficients.equiv_left k S A ((HomologicalComplex.eval _ _ p).mapIso e)) + (LinearEquiv.refl A (ComplexTensor.leftTerm k A Z q)) + +/-- Both actual tensor maps respect an isomorphism of genuine bimodule complexes. -/ +theorem rightTermEquiv_map (p p' q q' : ℤ) (g : Z.X q ⟶ Z.X q') : + (rightTermEquiv k S A e Z p' q').toLinearMap.comp (map k S A Q Z (Q.d p p') g) = + (map k S A Q' Z (Q'.d p p') g).comp (rightTermEquiv k S A e Z p q).toLinearMap := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x z + exact congrArg (fun y => LeftTensor.mk k S A (BimoduleCoefficients k S A (Q'.X p')) + (ComplexTensor.leftTerm k A Z q') y (g.hom z)) + (congrArg (fun f => f.hom x) (e.hom.comm p p')).symm + +theorem rightTermEquiv_map_id (p q q' : ℤ) (g : Z.X q ⟶ Z.X q') : + (rightTermEquiv k S A e Z p q').toLinearMap.comp (map k S A Q Z (𝟙 (Q.X p)) g) = + (map k S A Q' Z (𝟙 (Q'.X p)) g).comp (rightTermEquiv k S A e Z p q).toLinearMap := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x z + rfl +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleCoefficients.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cdf5d2ccd22230280b5cb8c01a58e9ecbc44246 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleCoefficients.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryCompression +import Mathlib.Algebra.Algebra.Opposite + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic +universe u +/-- A genuine tensor-algebra module with both scalar restrictions recorded together. -/ +def BimoduleCoefficients (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] + (M : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) := M +namespace BimoduleCoefficients +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (M : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) +instance : AddCommGroup (BimoduleCoefficients k S A M) := inferInstanceAs (AddCommGroup M) +instance : Module (S ⊗[k] Aᵐᵒᵖ) (BimoduleCoefficients k S A M) := inferInstanceAs (Module (S ⊗[k] Aᵐᵒᵖ) M) +instance : Module k (BimoduleCoefficients k S A M) := Module.compHom _ (algebraMap k (S ⊗[k] Aᵐᵒᵖ)) +instance : Module S (BimoduleCoefficients k S A M) := Module.compHom _ + (Algebra.TensorProduct.includeLeft (R := k) (S := k) (A := S) (B := Aᵐᵒᵖ)).toRingHom +instance : Module Aᵐᵒᵖ (BimoduleCoefficients k S A M) := Module.compHom _ + (Algebra.TensorProduct.includeRight (R := k) (A := S) (B := Aᵐᵒᵖ)).toRingHom +instance towerLeft : IsScalarTower k S (BimoduleCoefficients k S A M) := by + apply IsScalarTower.of_algebraMap_smul + intro r m + change (Algebra.TensorProduct.includeLeft (R := k) (S := k) (A := S) (B := Aᵐᵒᵖ) (algebraMap k S r)) • (m : M) = + (algebraMap k (S ⊗[k] Aᵐᵒᵖ) r) • (m : M) + rw [AlgHom.commutes] +instance towerRight : IsScalarTower k Aᵐᵒᵖ (BimoduleCoefficients k S A M) := by + apply IsScalarTower.of_algebraMap_smul + intro r m + change (Algebra.TensorProduct.includeRight (R := k) (A := S) (B := Aᵐᵒᵖ) (algebraMap k Aᵐᵒᵖ r)) • (m : M) = + (algebraMap k (S ⊗[k] Aᵐᵒᵖ) r) • (m : M) + rw [AlgHom.commutes] +instance commute : SMulCommClass S Aᵐᵒᵖ (BimoduleCoefficients k S A M) where + smul_comm s a m := by + change (s ⊗ₜ[k] (1:Aᵐᵒᵖ)) • (((1:S) ⊗ₜ[k] a) • (m : M)) = + ((1:S) ⊗ₜ[k] a) • ((s ⊗ₜ[k] (1:Aᵐᵒᵖ)) • (m : M)) + rw [← mul_smul,← mul_smul] + simp only [Algebra.TensorProduct.tmul_mul_tmul,one_mul,mul_one] + +variable {M} {M' : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)} +def map (f : M ⟶ M') : BimoduleCoefficients k S A M →ₗ[Aᵐᵒᵖ] BimoduleCoefficients k S A M' where + __ := f.hom.toAddHom + map_smul' a m := f.hom.map_smul (((1:S) ⊗ₜ[k] a)) m + +theorem map_left (f : M ⟶ M') (s : S) (m : BimoduleCoefficients k S A M) : + map k S A f (s • m) = s • map k S A f m := + f.hom.map_smul (s ⊗ₜ[k] (1:Aᵐᵒᵖ)) m +end BimoduleCoefficients +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleDerivedTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleDerivedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..dabde93ca9e2821e6a7541750bf8f9fa55de6fa3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleDerivedTensor.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTotalFunctor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleResolutionProjective +import Mathlib.Algebra.Homology.DerivedCategory.Basic + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} A)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} S)] +variable [∀ i, Module.Projective Aᵐᵒᵖ (ComplexTensor.rightTerm k A (rightComplex k S A Q) (p i))] + +omit [HasDerivedCategory.{u+1} (ModuleCat.{u} A)] in +theorem total_inverts : (HomologicalComplex.quasiIso (ModuleCat.{u} A) (.up ℤ)).IsInvertedBy + (totalFunctor k S A Q p hp ⋙ DerivedCategory.Q) := by + intro Z Z' f hf + let : QuasiIso f := hf + let := totalFunctor_quasiIso k S A Q p hp f + exact (inferInstance : IsIso (DerivedCategory.Q.map ((totalFunctor k S A Q p hp).map f))) + +/-- Localization of the actual tensor total, retaining the outside action. -/ +def derivedTotal : DerivedCategory (ModuleCat.{u} A) ⥤ DerivedCategory (ModuleCat.{u} S) := + Localization.lift (totalFunctor k S A Q p hp ⋙ DerivedCategory.Q) + (total_inverts k S A Q p hp) DerivedCategory.Q + +def derivedTotalComparison : + DerivedCategory.Q ⋙ derivedTotal k S A Q p hp ≅ totalFunctor k S A Q p hp ⋙ DerivedCategory.Q := + Localization.fac (totalFunctor k S A Q p hp ⋙ DerivedCategory.Q) + (total_inverts k S A Q p hp) DerivedCategory.Q +end LittleFinitistic.BimoduleComplexTensor +namespace LittleFinitistic.OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l))] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + +/-- The actual Q_T tensor lift with the source's left B-action retained. -/ +def derivedBimoduleTensor : DerivedCategory (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)) ⥤ + DerivedCategory (ModuleCat.{u} B) := + BimoduleComplexTensor.derivedTotal k B (B ⊗[k] ChainAlgebra k l) (integerBimoduleComplex k B l) + (finiteDegrees l) (finiteDegrees_strictMono l) + +def derivedBimoduleTensorComparison : + DerivedCategory.Q ⋙ derivedBimoduleTensor k B l ≅ + BimoduleComplexTensor.totalFunctor k B (B ⊗[k] ChainAlgebra k l) (integerBimoduleComplex k B l) + (finiteDegrees l) (finiteDegrees_strictMono l) ⋙ DerivedCategory.Q := + BimoduleComplexTensor.derivedTotalComparison k B (B ⊗[k] ChainAlgebra k l) (integerBimoduleComplex k B l) + (finiteDegrees l) (finiteDegrees_strictMono l) +end LittleFinitistic.OrdinarySimulation.TensorResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleResolutionProjective.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleResolutionProjective.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2c3379143c70f3c722a603bc390e7e9df42d946 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleResolutionProjective.lean @@ -0,0 +1,40 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorBimoduleResolution +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTerms +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorTotalAcyclic + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +/-- The actual genuine bimodule resolution is right-projective in every integer degree. -/ +instance integerBimoduleRight_projective (n : ℤ) : + Module.Projective (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ + (ComplexTensor.rightTerm k (B ⊗[k] ChainAlgebra k l) + (BimoduleComplexTensor.rightComplex k B (B ⊗[k] ChainAlgebra k l) (integerBimoduleComplex k B l)) n) := by + let e := (HomologicalComplex.eval _ _ n).mapIso (forgetIntegerBimoduleComplex k B l) + let : Projective ((((forgetBimodule k B l).mapHomologicalComplex (.up ℤ)).obj + (integerBimoduleComplex k B l)).X n) := Projective.of_iso e.symm (integerTerm_projective k B l n) + exact ModuleCat.projective_of_module_projective + ((((forgetBimodule k B l).mapHomologicalComplex (.up ℤ)).obj (integerBimoduleComplex k B l)).X n) + +theorem integerBimodule_lower (n : ℤ) (hn : n < -(l:ℤ)) : IsZero ((integerBimoduleComplex k B l).X n) := by + apply (bimoduleComplex k B l).isZero_extend_X (degreeEmbedding l) n + intro j hj + simp only [degreeEmbedding_apply] at hj + omega + +theorem integerBimodule_upper (n : ℤ) (hn : 0 < n) : IsZero ((integerBimoduleComplex k B l).X n) := by + have h := (integerTerm_upper k B l n hn).of_iso + ((HomologicalComplex.eval _ _ n).mapIso (forgetIntegerBimoduleComplex k B l)) + apply ModuleCat.isZero_iff_subsingleton.mpr + have hs := ModuleCat.isZero_iff_subsingleton.mp h + exact hs +end LittleFinitistic.OrdinarySimulation.TensorResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorFunctor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..06e300a21efe36fa21db1a4993194026f216a7e5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorFunctor.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleCoefficients +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTwoSidedTensor +import Mathlib.Algebra.Homology.Additive + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic +universe u +variable (k S A T N : Type u) [Field k] [Ring S] [Ring A] [Ring T] + [Algebra k S] [Algebra k A] [Algebra k T] +variable [AddCommGroup N] [Module k N] [Module A N] [Module T N] + [IsScalarTower k A N] [IsScalarTower k T N] [SMulCommClass T A N] + +/-- Actual ordinary tensor with a fixed bimodule, preserving both outside actions. -/ +def bimoduleTensorFunctor : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ) ⥤ ModuleCat.{u} (S ⊗[k] T) where + obj M := ModuleCat.of _ (TwoSidedTensor k A S T (BimoduleCoefficients k S A M) N) + map f := ModuleCat.ofHom (TwoSidedTensor.map (T := T) (N := N) + (BimoduleCoefficients.map k S A f) (BimoduleCoefficients.map_left k S A f)) + map_id M := by + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m n + rfl + map_comp f g := by + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m n + rfl + +instance bimoduleTensorFunctor_additive : (bimoduleTensorFunctor k S A T N).Additive where + map_add {M M'} {f g} := by + dsimp only [bimoduleTensorFunctor] + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m n + exact congrArg (fun h => h n) + ((BalancedTensor.mk k A (BimoduleCoefficients k S A M') N).map_add (f.hom m) (g.hom m)) +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorTerms.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..cdc5bf13dcbe858670c3f9861b32c305a4da2cef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorTerms.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleCoefficients +import OAI.Algebra.Finitistic.Ordinary.OrdinaryLeftTensorMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorFiniteMatrix +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedCongruence + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) + +abbrev rightComplex : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ := + ((ModuleCat.restrictScalars + (Algebra.TensorProduct.includeRight (R := k) (A := S) (B := Aᵐᵒᵖ)).toRingHom).mapHomologicalComplex (.up ℤ)).obj Q + +abbrev term (p q : ℤ) := LeftTensor k A S (BimoduleCoefficients k S A (Q.X p)) (ComplexTensor.leftTerm k A Z q) + +/-- Both actual term maps with the outside left action retained. -/ +def map {p p' q q' : ℤ} (f : Q.X p ⟶ Q.X p') (g : Z.X q ⟶ Z.X q') : + term k S A Q Z p q →ₗ[S] term k S A Q Z p' q' := + LeftTensor.bimap (BimoduleCoefficients.map k S A f) (BimoduleCoefficients.map_left k S A f) g.hom + +/-- Forgetting the outside action gives exactly the previous balanced tensor term. -/ +def forgetEquiv (p q : ℤ) : term k S A Q Z p q ≃ₗ[k] + ComplexTensor.term k A (rightComplex k S A Q) Z p q := by + let e : BimoduleCoefficients k S A (Q.X p) ≃ₗ[Aᵐᵒᵖ] + ComplexTensor.rightTerm k A (rightComplex k S A Q) p := LinearEquiv.refl _ _ + exact BalancedTensor.congr (k := k) e (LinearEquiv.refl A (ComplexTensor.leftTerm k A Z q)) + +/-- The retained-action map has precisely the same underlying balanced map. -/ +theorem forget_map {p p' q q' : ℤ} (f : Q.X p ⟶ Q.X p') (g : Z.X q ⟶ Z.X q') : + (forgetEquiv k S A Q Z p' q').toLinearMap.comp ((map k S A Q Z f g).restrictScalars k) = + (ComplexTensor.map k A (rightComplex k S A Q) Z + ((ModuleCat.restrictScalars (Algebra.TensorProduct.includeRight (R := k) (A := S) (B := Aᵐᵒᵖ)).toRingHom).map f) g).comp + (forgetEquiv k S A Q Z p q).toLinearMap := by + apply BalancedTensor.ext + intro x y + rfl +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorTotal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..9aec2dde5de062a02a9389eb49e0c9b640cb888e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTensorTotal.lean @@ -0,0 +1,95 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTerms + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +abbrev totalTerm (n : ℤ) := ∀ i : Fin l, term k S A Q Z (p i) (n + -(p i)) + +def forgetTotalEquiv (n : ℤ) : totalTerm k S A Q Z p n ≃ₗ[k] + FiniteColumnComplex.term (ComplexTensor.columns k A (rightComplex k S A Q) Z p) n := + LinearEquiv.piCongrRight (fun i => forgetEquiv k S A Q Z (p i) (n + -(p i))) + +/-- The horizontal arrow map retains its left action and exact degree transport. -/ +def entry (n : ℤ) (i j : Fin l) : term k S A Q Z (p i) (n + -(p i)) →ₗ[S] + term k S A Q Z (p j) ((n+1) + -(p j)) := + if h : p i + 1 = p j then map k S A Q Z (Q.d (p i) (p j)) + (eqToHom (congrArg Z.X (by omega))) else 0 + +/-- The actual signed differential, now linear for the outside algebra. -/ +def differential (n : ℤ) : totalTerm k S A Q Z p n →ₗ[S] totalTerm k S A Q Z p (n+1) := + LinearMap.pi (fun j => + ((-(p j)).negOnePow • map k S A Q Z (𝟙 (Q.X (p j))) + (Z.d (n + -(p j)) ((n+1) + -(p j)))).comp (LinearMap.proj j) + + ∑ i : Fin l, (entry k S A Q Z p n i j).comp (LinearMap.proj i)) + +theorem forget_entry (n : ℤ) (i j : Fin l) (z : term k S A Q Z (p i) (n + -(p i))) : + forgetEquiv k S A Q Z (p j) ((n+1) + -(p j)) (entry k S A Q Z p n i j z) = + ComplexTensor.entry k A (rightComplex k S A Q) Z p n i j + (forgetEquiv k S A Q Z (p i) (n + -(p i)) z) := by + unfold entry ComplexTensor.entry + split_ifs with h + · exact congrArg (fun f => f z) (forget_map k S A Q Z (Q.d (p i) (p j)) + (eqToHom (congrArg Z.X (show n + -(p i) = (n+1) + -(p j) by omega)))) + · exact map_zero _ + +/-- Forgetting the outside action gives exactly the previously verified signed differential. -/ +theorem forget_differential (n : ℤ) (z : totalTerm k S A Q Z p n) : + forgetTotalEquiv k S A Q Z p (n+1) (differential k S A Q Z p n z) = + (FiniteColumnComplex.totalDifferential (ComplexTensor.columns k A (rightComplex k S A Q) Z p) + (ComplexTensor.tensorHorizontal k A (rightComplex k S A Q) Z p hp)).d n + (forgetTotalEquiv k S A Q Z p n z) := by + funext j + change forgetEquiv k S A Q Z (p j) ((n+1) + -(p j)) + ((differential k S A Q Z p n z) j) = _ + simp only [forgetTotalEquiv,differential, + LinearMap.pi_apply,LinearMap.add_apply,LinearMap.comp_apply,LinearMap.proj_apply, + LinearMap.sum_apply,FiniteColumnComplex.totalDifferential,ComplexTensor.tensorHorizontal, + FiniteColumnComplex.diagonal_apply,Pi.add_apply,ComplexTensor.matrix_apply] + simp only [map_add,map_sum,LinearMap.smul_apply,ComplexTensor.column_d] + apply congrArg₂ (· + ·) + · change forgetEquiv k S A Q Z (p j) ((n+1) + -(p j)) + ((((-(p j)).negOnePow : ℤ)) • + (map k S A Q Z (𝟙 (Q.X (p j))) (Z.d (n + -(p j)) ((n+1) + -(p j))) (z j))) = + (((-(p j)).negOnePow : ℤ)) • + (ComplexTensor.map k A (rightComplex k S A Q) Z (𝟙 ((rightComplex k S A Q).X (p j))) + (Z.d (n + -(p j)) ((n+1) + -(p j))) + (forgetEquiv k S A Q Z (p j) (n + -(p j)) (z j))) + rw [map_zsmul] + congr 1 + exact congrArg (fun f => f (z j)) (forget_map k S A Q Z (𝟙 (Q.X (p j))) + (Z.d (n + -(p j)) ((n+1) + -(p j)))) + · apply Finset.sum_congr rfl + intro i _ + exact forget_entry k S A Q Z p n i j (z i) + +include hp in +theorem differential_square (n : ℤ) : + (differential k S A Q Z p (n+1)).comp (differential k S A Q Z p n) = 0 := by + apply LinearMap.ext + intro z + apply (forgetTotalEquiv k S A Q Z p ((n+1)+1)).injective + change forgetTotalEquiv k S A Q Z p ((n+1)+1) + (differential k S A Q Z p (n+1) (differential k S A Q Z p n z)) = _ + rw [forget_differential k S A Q Z p hp,forget_differential k S A Q Z p hp,LinearMap.zero_apply,map_zero] + exact congrArg (fun f => f (forgetTotalEquiv k S A Q Z p n z)) + ((FiniteColumnComplex.totalDifferential (ComplexTensor.columns k A (rightComplex k S A Q) Z p) + (ComplexTensor.tensorHorizontal k A (rightComplex k S A Q) Z p hp)).square n) + +/-- Actual signed finite tensor total in modules over the outside algebra. -/ +def total : CochainComplex (ModuleCat.{u} S) ℤ := + CochainComplex.of (fun n => ModuleCat.of S (totalTerm k S A Q Z p n)) + (fun n => ModuleCat.ofHom (differential k S A Q Z p n)) + (fun n => ModuleCat.hom_ext (differential_square k S A Q Z p hp n)) +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalAssociativity.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalAssociativity.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a0e56fd0ccf421a7c84140f744d52bb760137ba --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalAssociativity.lean @@ -0,0 +1,107 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleAssociativeTerms +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTotal + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A B N : Type u) [Field k] [Ring S] [Ring A] [Ring B] + [Algebra k S] [Algebra k A] [Algebra k B] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] +local instance : SMulCommClass Bᵐᵒᵖ A N := ⟨fun b a n => (smul_comm a b n).symm⟩ +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +def associativeTotalEquiv (n : ℤ) : + totalTerm k S B (middleBimoduleComplex k S A B N Q) Z p n ≃ₗ[S] + totalTerm k S A Q (middleLeftComplex k A B N Z) p n := + LinearEquiv.piCongrRight (fun i => associativeTermEquiv k S A B N Q Z (p i) (n + -(p i))) + +theorem associative_entry (n : ℤ) (i j : Fin l) : + (associativeTermEquiv k S A B N Q Z (p j) ((n+1) + -(p j))).toLinearMap.comp + (entry k S B (middleBimoduleComplex k S A B N Q) Z p n i j) = + (entry k S A Q (middleLeftComplex k A B N Z) p n i j).comp + (associativeTermEquiv k S A B N Q Z (p i) (n + -(p i))).toLinearMap := by + unfold entry + split_ifs with h + · have he : n + -(p i) = (n+1) + -(p j) := by omega + have hh := associativeTermEquiv_map k S A B N Q Z (Q.d (p i) (p j)) (eqToHom (congrArg Z.X he)) + have ht : (middleLeftFunctor k A B N).map (eqToHom (congrArg Z.X he)) = + eqToHom (congrArg (middleLeftComplex k A B N Z).X he) := by + generalize n + -(p i) = q at he ⊢ + generalize (n+1) + -(p j) = q' at he ⊢ + subst q' + simp only [eqToHom_refl,CategoryTheory.Functor.map_id] + rfl + rw [ht] at hh + exact hh + · simp only [LinearMap.comp_zero,LinearMap.zero_comp] + +theorem associative_vertical (n : ℤ) (i : Fin l) : + (associativeTermEquiv k S A B N Q Z (p i) ((n+1) + -(p i))).toLinearMap.comp + (map k S B (middleBimoduleComplex k S A B N Q) Z (𝟙 _) + (Z.d (n + -(p i)) ((n+1) + -(p i)))) = + (map k S A Q (middleLeftComplex k A B N Z) (𝟙 _) + ((middleLeftComplex k A B N Z).d (n + -(p i)) ((n+1) + -(p i)))).comp + (associativeTermEquiv k S A B N Q Z (p i) (n + -(p i))).toLinearMap := by + have h := associativeTermEquiv_map k S A B N Q Z (𝟙 (Q.X (p i))) + (Z.d (n + -(p i)) ((n+1) + -(p i))) + rw [(bimoduleTensorFunctor k S A Bᵐᵒᵖ N).map_id] at h + exact h + +theorem associative_differential (n : ℤ) + (z : totalTerm k S B (middleBimoduleComplex k S A B N Q) Z p n) : + associativeTotalEquiv k S A B N Q Z p (n+1) + (differential k S B (middleBimoduleComplex k S A B N Q) Z p n z) = + differential k S A Q (middleLeftComplex k A B N Z) p n + (associativeTotalEquiv k S A B N Q Z p n z) := by + funext j + simp only [associativeTotalEquiv,LinearEquiv.piCongrRight_apply,differential, + LinearMap.pi_apply,LinearMap.add_apply,LinearMap.comp_apply,LinearMap.proj_apply, + LinearMap.sum_apply,map_add,map_sum] + apply congrArg₂ (· + ·) + · change associativeTermEquiv k S A B N Q Z (p j) ((n+1) + -(p j)) + ((((-(p j)).negOnePow : ℤ)) • + (map k S B (middleBimoduleComplex k S A B N Q) Z (𝟙 _) + (Z.d (n + -(p j)) ((n+1) + -(p j))) (z j))) = + (((-(p j)).negOnePow : ℤ)) • + (map k S A Q (middleLeftComplex k A B N Z) (𝟙 _) + ((middleLeftComplex k A B N Z).d (n + -(p j)) ((n+1) + -(p j)))) + (associativeTermEquiv k S A B N Q Z (p j) (n + -(p j)) (z j)) + rw [map_zsmul] + congr 1 + exact congrArg (fun f => f (z j)) (associative_vertical k S A B N Q Z p n j) + · apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun f => f (z i)) (associative_entry k S A B N Q Z p n i j) + +/-- Full signed total associativity in S-modules, on every input complex Z. -/ +def totalAssociativityIso : + total k S B (middleBimoduleComplex k S A B N Q) Z p hp ≅ + total k S A Q (middleLeftComplex k A B N Z) p hp := + HomologicalComplex.Hom.isoOfComponents (fun n => (associativeTotalEquiv k S A B N Q Z p n).toModuleIso) (by + intro n m h + change n+1=m at h + subst m + have h₁ : (total k S B (middleBimoduleComplex k S A B N Q) Z p hp).d n (n+1) = + ModuleCat.ofHom (differential k S B (middleBimoduleComplex k S A B N Q) Z p n) := CochainComplex.of_d + (fun n => ModuleCat.of S (totalTerm k S B (middleBimoduleComplex k S A B N Q) Z p n)) + (fun n => ModuleCat.ofHom (differential k S B (middleBimoduleComplex k S A B N Q) Z p n)) n + have h₂ : (total k S A Q (middleLeftComplex k A B N Z) p hp).d n (n+1) = + ModuleCat.ofHom (differential k S A Q (middleLeftComplex k A B N Z) p n) := CochainComplex.of_d + (fun n => ModuleCat.of S (totalTerm k S A Q (middleLeftComplex k A B N Z) p n)) + (fun n => ModuleCat.ofHom (differential k S A Q (middleLeftComplex k A B N Z) p n)) n + rw [h₁,h₂] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (associative_differential k S A B N Q Z p n z).symm) +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalCongruence.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalCongruence.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe412b59600bea8aadc7bda72f33536779e591d7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalCongruence.lean @@ -0,0 +1,70 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleCoefficientEquiv +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTotal + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable {Q Q' : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ} +variable (e : Q ≅ Q') (Z : CochainComplex (ModuleCat.{u} A) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +def rightTotalEquiv (n : ℤ) : totalTerm k S A Q Z p n ≃ₗ[S] totalTerm k S A Q' Z p n := + LinearEquiv.piCongrRight (fun i => rightTermEquiv k S A e Z (p i) (n + -(p i))) + +theorem right_entry (n : ℤ) (i j : Fin l) : + (rightTermEquiv k S A e Z (p j) ((n+1) + -(p j))).toLinearMap.comp + (entry k S A Q Z p n i j) = + (entry k S A Q' Z p n i j).comp + (rightTermEquiv k S A e Z (p i) (n + -(p i))).toLinearMap := by + unfold entry + split_ifs with h + · exact rightTermEquiv_map k S A e Z _ _ _ _ (eqToHom (congrArg Z.X (show n + -(p i) = (n+1) + -(p j) by omega))) + · simp only [LinearMap.comp_zero,LinearMap.zero_comp] + +theorem right_differential (n : ℤ) (z : totalTerm k S A Q Z p n) : + rightTotalEquiv k S A e Z p (n+1) (differential k S A Q Z p n z) = + differential k S A Q' Z p n (rightTotalEquiv k S A e Z p n z) := by + funext j + simp only [rightTotalEquiv,LinearEquiv.piCongrRight_apply,differential, + LinearMap.pi_apply,LinearMap.add_apply,LinearMap.comp_apply,LinearMap.proj_apply, + LinearMap.sum_apply,map_add,map_sum] + apply congrArg₂ (· + ·) + · change rightTermEquiv k S A e Z (p j) ((n+1) + -(p j)) + ((((-(p j)).negOnePow : ℤ)) • (map k S A Q Z (𝟙 _) + (Z.d (n + -(p j)) ((n+1) + -(p j))) (z j))) = + (((-(p j)).negOnePow : ℤ)) • (map k S A Q' Z (𝟙 _) + (Z.d (n + -(p j)) ((n+1) + -(p j)))) + (rightTermEquiv k S A e Z (p j) (n + -(p j)) (z j)) + rw [map_zsmul] + congr 1 + exact congrArg (fun f => f (z j)) (rightTermEquiv_map_id k S A e Z (p j) (n + -(p j)) ((n+1) + -(p j)) (Z.d (n + -(p j)) ((n+1) + -(p j)))) + · apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun f => f (z i)) (right_entry k S A e Z p n i j) + +/-- Tensor total preserves actual isomorphisms of genuine bimodule complexes and their outside action. -/ +def totalRightIso : total k S A Q Z p hp ≅ total k S A Q' Z p hp := + HomologicalComplex.Hom.isoOfComponents (fun n => (rightTotalEquiv k S A e Z p n).toModuleIso) (by + intro n m h + change n+1=m at h + subst m + have h₁ : (total k S A Q Z p hp).d n (n+1) = ModuleCat.ofHom (differential k S A Q Z p n) := + CochainComplex.of_d (fun n => ModuleCat.of S (totalTerm k S A Q Z p n)) + (fun n => ModuleCat.ofHom (differential k S A Q Z p n)) n + have h₂ : (total k S A Q' Z p hp).d n (n+1) = ModuleCat.ofHom (differential k S A Q' Z p n) := + CochainComplex.of_d (fun n => ModuleCat.of S (totalTerm k S A Q' Z p n)) + (fun n => ModuleCat.ofHom (differential k S A Q' Z p n)) n + rw [h₁,h₂] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (right_differential k S A e Z p n z).symm) +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalForget.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalForget.lean new file mode 100644 index 0000000000000000000000000000000000000000..5edc09f196a4ed40aed07690c5ba9fe33ef89d1c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalForget.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTotal +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +abbrev forgetTotal : CochainComplex (ModuleCat.{u} k) ℤ := + ((ModuleCat.restrictScalars (algebraMap k S)).mapHomologicalComplex (.up ℤ)).obj (total k S A Q Z p hp) + +def forgetTermIso (n : ℤ) : (forgetTotal k S A Q Z p hp).X n ≅ + (ComplexTensor.finiteTotal k A (rightComplex k S A Q) Z p hp).X n := by + let e : (forgetTotal k S A Q Z p hp).X n ≃ₗ[k] totalTerm k S A Q Z p n := + { toFun := fun x => x + invFun := fun x => x + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun r x => by + have h (y : totalTerm k S A Q Z p n) : (algebraMap k S r) • y = r • y := + algebraMap_smul S r y + exact h x } + exact (e.trans (forgetTotalEquiv k S A Q Z p n)).toModuleIso + +/-- The genuine outside-action total forgets to the actual previously verified k-total. -/ +def forgetTotalIso : forgetTotal k S A Q Z p hp ≅ + ComplexTensor.finiteTotal k A (rightComplex k S A Q) Z p hp := + HomologicalComplex.Hom.isoOfComponents (forgetTermIso k S A Q Z p hp) (by + intro n m h + change n+1=m at h + subst m + have h₁ : (total k S A Q Z p hp).d n (n+1) = ModuleCat.ofHom (differential k S A Q Z p n) := + CochainComplex.of_d (fun n => ModuleCat.of S (totalTerm k S A Q Z p n)) + (fun n => ModuleCat.ofHom (differential k S A Q Z p n)) n + have h₂ : (ComplexTensor.finiteTotal k A (rightComplex k S A Q) Z p hp).d n (n+1) = + ModuleCat.ofHom ((FiniteColumnComplex.totalDifferential + (ComplexTensor.columns k A (rightComplex k S A Q) Z p) + (ComplexTensor.tensorHorizontal k A (rightComplex k S A Q) Z p hp)).d n) := + CochainComplex.of_d (fun n => ModuleCat.of k + (FiniteColumnComplex.term (ComplexTensor.columns k A (rightComplex k S A Q) Z p) n)) + (fun n => ModuleCat.ofHom ((FiniteColumnComplex.totalDifferential + (ComplexTensor.columns k A (rightComplex k S A Q) Z p) + (ComplexTensor.tensorHorizontal k A (rightComplex k S A Q) Z p hp)).d n)) n + change (forgetTermIso k S A Q Z p hp n).hom ≫ _ = + (ModuleCat.restrictScalars (algebraMap k S)).map ((total k S A Q Z p hp).d n (n+1)) ≫ + (forgetTermIso k S A Q Z p hp (n+1)).hom + rw [h₁,h₂] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (forget_differential k S A Q Z p hp n z).symm) +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalFunctor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8e841450469ca02043391054e51390410fa1753 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalFunctor.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTotalMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRestrictionHomology +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorTotalQuasiIso + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +/-- The actual tensor total is a functor retaining its outside action on every complex. -/ +def totalFunctor : CochainComplex (ModuleCat.{u} A) ℤ ⥤ CochainComplex (ModuleCat.{u} S) ℤ where + obj Z := total k S A Q Z p hp + map f := totalMap k S A Q f p hp + map_id Z := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + funext i + change termInputMap k S A Q (𝟙 Z) (p i) (n + -(p i)) (z i) = z i + rw [termInputMap_id] + rfl + map_comp f g := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + funext i + change termInputMap k S A Q (f ≫ g) (p i) (n + -(p i)) (z i) = + termInputMap k S A Q g (p i) (n + -(p i)) (termInputMap k S A Q f (p i) (n + -(p i)) (z i)) + rw [termInputMap_comp] + rfl + +/-- The forgetful chain comparison is natural in all input complexes. -/ +def forgetTotalFunctorIso : + totalFunctor k S A Q p hp ⋙ (ModuleCat.restrictScalars (algebraMap k S)).mapHomologicalComplex (.up ℤ) ≅ + ComplexTensor.finiteTotalFunctor k A (rightComplex k S A Q) p hp := + NatIso.ofComponents (fun Z => forgetTotalIso k S A Q Z p hp) + (fun f => forgetTotalIso_natural k S A Q f p hp) + +/-- The genuine outside-action tensor preserves arbitrary quasi-isomorphisms when its right terms +are projective. There are no restrictions on either input complex. -/ +theorem totalFunctor_quasiIso + [∀ i, Module.Projective Aᵐᵒᵖ (ComplexTensor.rightTerm k A (rightComplex k S A Q) (p i))] + {Z Z' : CochainComplex (ModuleCat.{u} A) ℤ} (f : Z ⟶ Z') [QuasiIso f] : + QuasiIso ((totalFunctor k S A Q p hp).map f) := by + apply (RestrictionHomology.quasiIso_iff (algebraMap k S) _).mp + let g := ((ModuleCat.restrictScalars (algebraMap k S)).mapHomologicalComplex (.up ℤ)).map + (totalMap k S A Q f p hp) + have := ComplexTensor.finiteTotalMap_quasiIso k A (rightComplex k S A Q) f p hp + have hg : QuasiIso (g ≫ (forgetTotalIso k S A Q Z' p hp).hom) := by + dsimp only [g] + rw [forgetTotalIso_natural] + infer_instance + exact (quasiIso_iff_comp_right g (forgetTotalIso k S A Q Z' p hp).hom).mp hg +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalMaps.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8d28716f5871dedb2ce2c38d89c1a6ddf820d5b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBimoduleTotalMaps.lean @@ -0,0 +1,110 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTotalForget +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorTotalFunctor + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BimoduleComplexTensor +universe u +variable (k S A : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ) +variable {Z Z' : CochainComplex (ModuleCat.{u} A) ℤ} (f : Z ⟶ Z') +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +def termInputMap (r q : ℤ) : term k S A Q Z r q →ₗ[S] term k S A Q Z' r q := + LeftTensor.bimap (N := ComplexTensor.leftTerm k A Z q) (N' := ComplexTensor.leftTerm k A Z' q) + (BimoduleCoefficients.map k S A (𝟙 (Q.X r))) + (BimoduleCoefficients.map_left k S A (𝟙 (Q.X r))) (f.f q).hom + +theorem termInputMap_id (Z : CochainComplex (ModuleCat.{u} A) ℤ) (r q : ℤ) : + termInputMap k S A Q (𝟙 Z) r q = LinearMap.id := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x y + rfl + +theorem termInputMap_comp {Z'' : CochainComplex (ModuleCat.{u} A) ℤ} (g : Z' ⟶ Z'') (r q : ℤ) : + termInputMap k S A Q (f ≫ g) r q = + (termInputMap k S A Q g r q).comp (termInputMap k S A Q f r q) := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x y + rfl + +def totalInputMap (n : ℤ) : totalTerm k S A Q Z p n →ₗ[S] totalTerm k S A Q Z' p n := + LinearMap.pi (fun i => (termInputMap k S A Q f (p i) (n + -(p i))).comp (LinearMap.proj i)) + +/-- The retained-action input map is exactly the prior tensor map after forgetting. -/ +theorem forget_totalInputMap (n : ℤ) (z : totalTerm k S A Q Z p n) : + forgetTotalEquiv k S A Q Z' p n (totalInputMap k S A Q f p n z) = + ((ComplexTensor.finiteTotalMap k A (rightComplex k S A Q) p hp f).f n).hom + (forgetTotalEquiv k S A Q Z p n z) := by + funext i + rw [ComplexTensor.finiteTotalMap_apply] + change forgetEquiv k S A Q Z' (p i) (n + -(p i)) + (termInputMap k S A Q f (p i) (n + -(p i)) (z i)) = + ComplexTensor.inputMap k A (rightComplex k S A Q) f (p i) (n + -(p i)) + (forgetEquiv k S A Q Z (p i) (n + -(p i)) (z i)) + let L := (forgetEquiv k S A Q Z' (p i) (n + -(p i))).toLinearMap.comp + ((termInputMap k S A Q f (p i) (n + -(p i))).restrictScalars k) + let R := (ComplexTensor.inputMap k A (rightComplex k S A Q) f (p i) (n + -(p i))).comp + (forgetEquiv k S A Q Z (p i) (n + -(p i))).toLinearMap + change L (z i) = R (z i) + induction z i using BalancedTensor.induction_on with + | hz => exact L.map_zero.trans R.map_zero.symm + | ht x y => rfl + | ha x y hx hy => + exact (L.map_add x y).trans ((congrArg₂ (· + ·) hx hy).trans (R.map_add x y).symm) + +include hp in +theorem totalInputMap_comm (n : ℤ) : + (differential k S A Q Z' p n).comp (totalInputMap k S A Q f p n) = + (totalInputMap k S A Q f p (n+1)).comp (differential k S A Q Z p n) := by + apply LinearMap.ext + intro z + apply (forgetTotalEquiv k S A Q Z' p (n+1)).injective + change forgetTotalEquiv k S A Q Z' p (n+1) + (differential k S A Q Z' p n (totalInputMap k S A Q f p n z)) = + forgetTotalEquiv k S A Q Z' p (n+1) + (totalInputMap k S A Q f p (n+1) (differential k S A Q Z p n z)) + rw [forget_differential k S A Q Z' p hp,forget_totalInputMap k S A Q f p hp, + forget_totalInputMap k S A Q f p hp,forget_differential k S A Q Z p hp] + have h := congrArg (fun g => g.hom (forgetTotalEquiv k S A Q Z p n z)) + ((ComplexTensor.finiteTotalMap k A (rightComplex k S A Q) p hp f).comm n (n+1)) + dsimp only [ComplexTensor.finiteTotal,FiniteColumnComplex.total] at h + rw [FiniteColumnComplex.complex_d,FiniteColumnComplex.complex_d] at h + exact h + +/-- Actual chain maps of the outside-action tensor total. -/ +def totalMap : total k S A Q Z p hp ⟶ total k S A Q Z' p hp where + f n := ModuleCat.ofHom (totalInputMap k S A Q f p n) + comm' n m h := by + change n+1=m at h + subst m + have h₁ : (total k S A Q Z p hp).d n (n+1) = ModuleCat.ofHom (differential k S A Q Z p n) := + CochainComplex.of_d (fun n => ModuleCat.of S (totalTerm k S A Q Z p n)) + (fun n => ModuleCat.ofHom (differential k S A Q Z p n)) n + have h₂ : (total k S A Q Z' p hp).d n (n+1) = ModuleCat.ofHom (differential k S A Q Z' p n) := + CochainComplex.of_d (fun n => ModuleCat.of S (totalTerm k S A Q Z' p n)) + (fun n => ModuleCat.ofHom (differential k S A Q Z' p n)) n + rw [h₁,h₂] + apply ModuleCat.hom_ext + exact totalInputMap_comm k S A Q f p hp n + +theorem forgetTotalIso_natural : + ((ModuleCat.restrictScalars (algebraMap k S)).mapHomologicalComplex (.up ℤ)).map + (totalMap k S A Q f p hp) ≫ (forgetTotalIso k S A Q Z' p hp).hom = + (forgetTotalIso k S A Q Z p hp).hom ≫ + ComplexTensor.finiteTotalMap k A (rightComplex k S A Q) p hp f := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact forget_totalInputMap k S A Q f p hp n z +end LittleFinitistic.BimoduleComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockBimodule.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockBimodule.lean new file mode 100644 index 0000000000000000000000000000000000000000..964d8980557840bba70b44fe6b69d4ccde1ea88f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockBimodule.lean @@ -0,0 +1,88 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTerminal + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k L R O T : Type u} [Field k] [Ring L] [Ring R] + [AddCommGroup O] [AddCommGroup T] + +/-- The off-diagonal ordinary bimodule O ⊕ T over L × R. -/ +def OffDiagonal (O T : Type u) := O × T +namespace OffDiagonal +instance : AddCommGroup (OffDiagonal O T) := inferInstanceAs (AddCommGroup (O × T)) +instance [Module k O] [Module k T] : Module k (OffDiagonal O T) := + inferInstanceAs (Module k (O × T)) + +instance leftModule [Module R O] [Module L T] : Module (L × R) (OffDiagonal O T) := by + let : Module (L × R) O := Module.compHom O (RingHom.snd L R) + let : Module (L × R) T := Module.compHom T (RingHom.fst L R) + exact inferInstanceAs (Module (L × R) (O × T)) + +instance rightModule [Module Lᵐᵒᵖ O] [Module Rᵐᵒᵖ T] : + Module (L × R)ᵐᵒᵖ (OffDiagonal O T) := by + let : Module (L × R)ᵐᵒᵖ O := Module.compHom O (RingHom.fst L R).op + let : Module (L × R)ᵐᵒᵖ T := Module.compHom T (RingHom.snd L R).op + exact inferInstanceAs (Module (L × R)ᵐᵒᵖ (O × T)) + +instance commuteActions [Module R O] [Module L T] [Module Lᵐᵒᵖ O] [Module Rᵐᵒᵖ T] + [SMulCommClass R Lᵐᵒᵖ O] [SMulCommClass L Rᵐᵒᵖ T] : + SMulCommClass (L × R) (L × R)ᵐᵒᵖ (OffDiagonal O T) where + smul_comm x y z := by + apply Prod.ext + · change x.2 • (MulOpposite.op y.unop.1 • z.1) = MulOpposite.op y.unop.1 • (x.2 • z.1) + exact smul_comm _ _ _ + · change x.1 • (MulOpposite.op y.unop.2 • z.2) = MulOpposite.op y.unop.2 • (x.1 • z.2) + exact smul_comm _ _ _ + +instance towerLeft [Algebra k L] [Algebra k R] [Module k O] [Module k T] + [Module R O] [Module L T] [IsScalarTower k R O] [IsScalarTower k L T] : + IsScalarTower k (L × R) (OffDiagonal O T) where + smul_assoc c x z := Prod.ext (smul_assoc c x.2 z.1) (smul_assoc c x.1 z.2) + +instance towerRight [Algebra k L] [Algebra k R] [Module k O] [Module k T] + [Module Lᵐᵒᵖ O] [Module Rᵐᵒᵖ T] [IsScalarTower k Lᵐᵒᵖ O] [IsScalarTower k Rᵐᵒᵖ T] : + IsScalarTower k (L × R)ᵐᵒᵖ (OffDiagonal O T) where + smul_assoc c x z := Prod.ext (smul_assoc c (MulOpposite.op x.unop.1) z.1) + (smul_assoc c (MulOpposite.op x.unop.2) z.2) + +instance finiteDimensional [Module k O] [Module k T] + [FiniteDimensional k O] [FiniteDimensional k T] : FiniteDimensional k (OffDiagonal O T) := + inferInstanceAs (FiniteDimensional k (O × T)) + +/-- The first left block selects precisely T. -/ +theorem first_left [Module R O] [Module L T] (x : OffDiagonal O T) : + ((1,0) : L × R) • x = (0,x.2) := by + apply Prod.ext + · exact zero_smul _ _ + · exact one_smul _ _ + +/-- The first right block selects precisely O. -/ +theorem first_right [Module Lᵐᵒᵖ O] [Module Rᵐᵒᵖ T] (x : OffDiagonal O T) : + MulOpposite.op ((1,0) : L × R) • x = (x.1,0) := by + apply Prod.ext + · exact one_smul _ _ + · exact zero_smul _ _ +end OffDiagonal + +open CategoryTheory +open scoped TensorProduct +variable {B : Type u} [Ring B] [Algebra k B] + +/-- The actual ordinary Section 5 bimodule X over D=B×(B tensor C). -/ +abbrev BimoduleX (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) := + OffDiagonal (BimoduleO P a l) (TerminalTensor B) + +theorem ordinary_bimodule (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) + (a : ℤ) (l : ℕ) : + SMulCommClass (AlgebraD k l B) (AlgebraD k l B)ᵐᵒᵖ (BimoduleX P a l) := inferInstance + +theorem ordinary_finite (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) + (a : ℤ) (l : ℕ) [FiniteDimensional k B] + [∀ n, FiniteDimensional k ((underlyingComplex (k := k) P).X n)] : + FiniteDimensional k (BimoduleX P a l) := inferInstance +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockComplexes.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockComplexes.lean new file mode 100644 index 0000000000000000000000000000000000000000..0082da605a14f26a933f0ac04091dc25994df4d1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockComplexes.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockModules +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductSplitting +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalObjects + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.BlockModule +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] + +abbrev firstComplex (Z : CochainComplex (ModuleCat.{u} L) ℤ) := + ((ProductModules.firstInflation L R).mapHomologicalComplex (.up ℤ)).obj Z +abbrev secondComplex (Z : CochainComplex (ModuleCat.{u} R) ℤ) := + ((ProductModules.secondInflation L R).mapHomologicalComplex (.up ℤ)).obj Z + +variable {U V : Type u} [AddCommGroup U] [AddCommGroup V] [Module k U] [Module k V] + +def firstMap [Module L U] [Module L V] (f : U →ₗ[L] V) : First k L R U →ₗ[L × R] First k L R V where + __ := f.toAddHom + map_smul' d x := f.map_smul d.1 x + +def secondMap [Module R U] [Module R V] (f : U →ₗ[R] V) : Second k L R U →ₗ[L × R] Second k L R V where + __ := f.toAddHom + map_smul' d x := f.map_smul d.2 x +end LittleFinitistic.BlockModule +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ) +variable (T : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ) + +theorem complex_d_all (n m : ℤ) : (complex k L R O T).d n m = objectMap k L R (O.d n m) (T.d n m) := by + by_cases h : n+1=m + · subst m + rw [complex_d] + rfl + · have hh : ¬ (ComplexShape.up ℤ).Rel n m := h + rw [(complex k L R O T).shape n m hh,O.shape n m hh,T.shape n m hh] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockDerived.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockDerived.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b9e17bb80987dc5a064f56b5e34c26e7d23e591 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockDerived.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockComplexes +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRestrictionHomology +import Mathlib.Algebra.Homology.DerivedCategory.Basic + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BlockModule +universe u +variable (L R : Type u) [Ring L] [Ring R] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} L)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (L × R))] + +abbrev firstComplexFunctor := (ProductModules.firstInflation L R).mapHomologicalComplex (.up ℤ) + +omit [HasDerivedCategory.{u+1} (ModuleCat.{u} L)] in +theorem first_inverts : (HomologicalComplex.quasiIso (ModuleCat.{u} L) (.up ℤ)).IsInvertedBy + (firstComplexFunctor L R ⋙ DerivedCategory.Q) := by + intro Z Z' f hf + let : QuasiIso f := hf + have : QuasiIso ((firstComplexFunctor L R).map f) := + (RestrictionHomology.quasiIso_iff (RingHom.fst L R) f).mpr inferInstance + exact (inferInstance : IsIso (DerivedCategory.Q.map ((firstComplexFunctor L R).map f))) + +/-- Native derived inflation on the first block of the product algebra. -/ +def derivedFirst : DerivedCategory (ModuleCat.{u} L) ⥤ DerivedCategory (ModuleCat.{u} (L × R)) := + Localization.lift (firstComplexFunctor L R ⋙ DerivedCategory.Q) (first_inverts L R) DerivedCategory.Q + +def derivedFirstComparison : DerivedCategory.Q ⋙ derivedFirst L R ≅ firstComplexFunctor L R ⋙ DerivedCategory.Q := + Localization.fac (firstComplexFunctor L R ⋙ DerivedCategory.Q) (first_inverts L R) DerivedCategory.Q +end LittleFinitistic.BlockModule + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockModules.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockModules.lean new file mode 100644 index 0000000000000000000000000000000000000000..af2c3eeadcbf6483e5fcc6d3c67e5a8e2191b9ed --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockModules.lean @@ -0,0 +1,32 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockBimodule +import OAI.Algebra.Finitistic.Ordinary.OrdinaryAssociativeTensorModules + +namespace OAI +noncomputable section +namespace LittleFinitistic.BlockModule +universe u +/-- A module supported on the first factor of the actual product algebra. -/ +def First (_k _L _R Z : Type u) := Z +/-- A module supported on the second factor of the actual product algebra. -/ +def Second (_k _L _R Z : Type u) := Z +variable (k L R Z : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] + [AddCommGroup Z] [Module k Z] +namespace First +instance : AddCommGroup (First k L R Z) := inferInstanceAs (AddCommGroup Z) +instance : Module k (First k L R Z) := inferInstanceAs (Module k Z) +instance [Module L Z] : Module (L × R) (First k L R Z) := Module.compHom Z (RingHom.fst L R) +instance [Module L Z] [IsScalarTower k L Z] : IsScalarTower k (L × R) (First k L R Z) where + smul_assoc c d z := smul_assoc c d.1 (show Z from z) +end First +namespace Second +instance : AddCommGroup (Second k L R Z) := inferInstanceAs (AddCommGroup Z) +instance : Module k (Second k L R Z) := inferInstanceAs (Module k Z) +instance [Module R Z] : Module (L × R) (Second k L R Z) := Module.compHom Z (RingHom.snd L R) +instance [Module R Z] [IsScalarTower k R Z] : IsScalarTower k (L × R) (Second k L R Z) where + smul_assoc c d z := smul_assoc c d.2 (show Z from z) +end Second +end LittleFinitistic.BlockModule + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockTensorTerms.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockTensorTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..e23ce89dfaba8d0206963d5204af44d087582695 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryBlockTensorTerms.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockComplexes +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFirstBlockTensor +import OAI.Algebra.Finitistic.Ordinary.OrdinarySecondBlockTensor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryLeftTensorCongruence +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTerms + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.BlockTensor +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ) +variable (T : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ) + +open BimoduleComplexTensor + +def firstTermEquiv (Z : CochainComplex (ModuleCat.{u} L) ℤ) (p q : ℤ) : + term k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p q ≃ₗ[L × R] + BlockModule.Second k L R (term k R L O Z p q) := by + let M := OffDiagonal (BimoduleCoefficients k R L (O.X p)) (BimoduleCoefficients k L R (T.X p)) + let eM := RetainedBimodule.rightEquiv k (L × R) (L × R) M + let eZ : ComplexTensor.leftTerm k (L × R) (BlockModule.firstComplex L R Z) q ≃ₗ[L × R] + BlockModule.First k L R (ComplexTensor.leftTerm k L Z q) := LinearEquiv.refl _ _ + exact (LeftTensor.congr (k := k) (A := L × R) (S := L × R) eM (RetainedBimodule.rightEquiv_left k (L × R) (L × R) M) eZ).trans + (FirstBlockTensor.equivalence k L R (BimoduleCoefficients k R L (O.X p)) + (BimoduleCoefficients k L R (T.X p)) (ComplexTensor.leftTerm k L Z q)) + +def secondTermEquiv (Z : CochainComplex (ModuleCat.{u} R) ℤ) (p q : ℤ) : + term k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p q ≃ₗ[L × R] + BlockModule.First k L R (term k L R T Z p q) := by + let M := OffDiagonal (BimoduleCoefficients k R L (O.X p)) (BimoduleCoefficients k L R (T.X p)) + let eM := RetainedBimodule.rightEquiv k (L × R) (L × R) M + let eZ : ComplexTensor.leftTerm k (L × R) (BlockModule.secondComplex L R Z) q ≃ₗ[L × R] + BlockModule.Second k L R (ComplexTensor.leftTerm k R Z q) := LinearEquiv.refl _ _ + exact (LeftTensor.congr (k := k) (A := L × R) (S := L × R) eM (RetainedBimodule.rightEquiv_left k (L × R) (L × R) M) eZ).trans + (SecondBlockTensor.equivalence k L R (BimoduleCoefficients k R L (O.X p)) + (BimoduleCoefficients k L R (T.X p)) (ComplexTensor.leftTerm k R Z q)) + +theorem firstTermEquiv_map (Z : CochainComplex (ModuleCat.{u} L) ℤ) {p p' q q' : ℤ} + (fO : O.X p ⟶ O.X p') (fT : T.X p ⟶ T.X p') (g : Z.X q ⟶ Z.X q') : + (firstTermEquiv k L R O T Z p' q').toLinearMap.comp + (map k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) + (OffDiagonal.objectMap k L R fO fT) ((ProductModules.firstInflation L R).map g)) = + (BlockModule.secondMap k L R (map k R L O Z fO g)).comp + (firstTermEquiv k L R O T Z p q).toLinearMap := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x z + rfl + +theorem secondTermEquiv_map (Z : CochainComplex (ModuleCat.{u} R) ℤ) {p p' q q' : ℤ} + (fO : O.X p ⟶ O.X p') (fT : T.X p ⟶ T.X p') (g : Z.X q ⟶ Z.X q') : + (secondTermEquiv k L R O T Z p' q').toLinearMap.comp + (map k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) + (OffDiagonal.objectMap k L R fO fT) ((ProductModules.secondInflation L R).map g)) = + (BlockModule.firstMap k L R (map k L R T Z fT g)).comp + (secondTermEquiv k L R O T Z p q).toLinearMap := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x z + rfl +end LittleFinitistic.OrdinarySimulation.BlockTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainAlgebra.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..24555d00d8dbb2efd89a1e70c343a663720d2a09 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainAlgebra.lean @@ -0,0 +1,145 @@ +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import Mathlib.LinearAlgebra.Prod +import Mathlib.RingTheory.TensorProduct.Finite +import Mathlib.RingTheory.TensorProduct.Basic +import Mathlib.Tactic.Ring + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable (k : Type u) [Field k] (l : ℕ) + +/-- The radical-square-zero chain algebra, in vertex and arrow coordinates. +Arrow i goes from i to i+1, with the manuscript's right-projective convention. -/ +def ChainAlgebra := (Fin (l+1) → k) × (Fin l → k) +namespace ChainAlgebra +instance : AddCommGroup (ChainAlgebra k l) := + inferInstanceAs (AddCommGroup ((Fin (l+1) → k) × (Fin l → k))) +instance : Module k (ChainAlgebra k l) := + inferInstanceAs (Module k ((Fin (l+1) → k) × (Fin l → k))) +instance : FiniteDimensional k (ChainAlgebra k l) := + inferInstanceAs (FiniteDimensional k ((Fin (l+1) → k) × (Fin l → k))) + +@[simp] theorem zero_eq : (0 : ChainAlgebra k l) = (0,0) := rfl +@[simp] theorem add_eq (x y : ChainAlgebra k l) : x+y = (x.1+y.1,x.2+y.2) := rfl +@[simp] theorem smul_eq (c : k) (x : ChainAlgebra k l) : c • x = (c • x.1,c • x.2) := rfl + +def diagonal (x : ChainAlgebra k l) := x.1 +def radical (x : ChainAlgebra k l) := x.2 + +def mul (x y : ChainAlgebra k l) : ChainAlgebra k l := + (fun i => x.1 i * y.1 i, + fun i => x.1 i.succ * y.2 i + x.2 i * y.1 i.castSucc) +def unit : ChainAlgebra k l := (fun _ => 1, fun _ => 0) + +instance : Ring (ChainAlgebra k l) where + __ := (inferInstance : AddCommGroup (ChainAlgebra k l)) + mul := mul k l + one := unit k l + mul_assoc x y z := by + change mul k l (mul k l x y) z = mul k l x (mul k l y z) + apply Prod.ext <;> funext i <;> simp only [mul] <;> ring + one_mul x := by + change mul k l (unit k l) x = x + apply Prod.ext <;> funext i <;> simp [mul, unit] + mul_one x := by + change mul k l x (unit k l) = x + apply Prod.ext <;> funext i <;> simp [mul, unit] + left_distrib x y z := by + change mul k l x (y+z) = mul k l x y + mul k l x z + rw [add_eq k l (mul k l x y) (mul k l x z), add_eq k l y z] + apply Prod.ext <;> funext i <;> simp only [mul, Pi.add_apply] <;> ring + right_distrib x y z := by + change mul k l (x+y) z = mul k l x z + mul k l y z + rw [add_eq k l (mul k l x z) (mul k l y z), add_eq k l x y] + apply Prod.ext <;> funext i <;> simp only [mul, Pi.add_apply] <;> ring + zero_mul x := by + change mul k l 0 x = 0 + apply Prod.ext <;> funext i <;> simp [mul, zero_eq] + mul_zero x := by + change mul k l x 0 = 0 + apply Prod.ext <;> funext i <;> simp [mul, zero_eq] + +instance : Algebra k (ChainAlgebra k l) where + algebraMap := + { toFun := fun c => (fun _ => c, fun _ => 0) + map_one' := rfl + map_mul' := by + intro x y + change ( ((fun _ => x*y), (0 : Fin l → k)) : ChainAlgebra k l) = mul k l (fun _ => x, 0) (fun _ => y, 0) + apply Prod.ext <;> funext i <;> simp [mul] + map_zero' := rfl + map_add' := by + intro x y + change ((fun _ => x+y), (0 : Fin l → k)) = ((fun _ => x)+(fun _ => y), (0 : Fin l → k)+(0 : Fin l → k)) + apply Prod.ext <;> funext i <;> simp } + commutes' c x := by + apply Prod.ext <;> funext i + · exact mul_comm c (x.1 i) + · change c * x.2 i + 0 * x.1 i.castSucc = x.1 i.succ * 0 + x.2 i * c + ring + smul_def' c x := by + apply Prod.ext <;> funext i + · rfl + · change c * x.2 i = c * x.2 i + 0 * x.1 i.castSucc + ring + +@[simp] theorem mul_diagonal (x y : ChainAlgebra k l) (i : Fin (l+1)) : + (x*y).1 i = x.1 i * y.1 i := rfl +@[simp] theorem mul_radical (x y : ChainAlgebra k l) (i : Fin l) : + (x*y).2 i = x.1 i.succ * y.2 i + x.2 i * y.1 i.castSucc := rfl + +def vertex (i : Fin (l+1)) : ChainAlgebra k l := (Pi.single i 1, 0) +def arrow (i : Fin l) : ChainAlgebra k l := (0, Pi.single i 1) + +@[simp] theorem vertex_idempotent (i : Fin (l+1)) : + vertex k l i * vertex k l i = vertex k l i := by + apply Prod.ext <;> funext j + · change ((Pi.single i 1 : _ → k) j) * ((Pi.single i 1 : _ → k) j) = (Pi.single i 1 : _ → k) j + by_cases h : j = i <;> simp [h] + · change (mul k l (vertex k l i) (vertex k l i)).2 j = 0 + simp [mul, vertex] + +@[simp] theorem arrow_mul_arrow (i j : Fin l) : + arrow k l i * arrow k l j = 0 := by + change mul k l (arrow k l i) (arrow k l j) = 0 + apply Prod.ext <;> funext a <;> simp [mul, arrow, zero_eq] + +@[simp] theorem vertex_target_arrow (i : Fin l) : + vertex k l i.succ * arrow k l i = arrow k l i := by + apply Prod.ext <;> funext j + · change (Pi.single i.succ 1 : Fin (l+1) → k) j * 0 = 0 + simp + · change (Pi.single i.succ 1 : _ → k) j.succ * (Pi.single i 1 : _ → k) j + 0 * 0 = (Pi.single i 1 : _ → k) j + by_cases h : j = i <;> simp [h, Fin.succ_inj] + +@[simp] theorem arrow_vertex_source (i : Fin l) : + arrow k l i * vertex k l i.castSucc = arrow k l i := by + apply Prod.ext <;> funext j + · change (0:k) * (Pi.single i.castSucc 1 : Fin (l+1) → k) j = 0 + simp + · change 0 * 0 + (Pi.single i 1 : _ → k) j * (Pi.single i.castSucc 1 : _ → k) j.castSucc = (Pi.single i 1 : _ → k) j + by_cases h : j = i <;> simp [h, Fin.castSucc_inj] + +/-- The terminal simple right module is the character at vertex l. -/ +def terminalCharacter : ChainAlgebra k l →ₐ[k] k where + toFun x := x.1 (Fin.last l) + map_one' := rfl + map_mul' _ _ := rfl + map_zero' := rfl + map_add' _ _ := rfl + commutes' _ := rfl +end ChainAlgebra + +variable (B : Type u) [Ring B] [Algebra k B] +/-- The actual ordinary algebra D of Section 5. -/ +abbrev AlgebraD := B × (B ⊗[k] ChainAlgebra k l) +instance finiteDimensionalD [FiniteDimensional k B] : + FiniteDimensional k (AlgebraD k l B) := inferInstance +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainDirected.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainDirected.lean new file mode 100644 index 0000000000000000000000000000000000000000..aaaca46f4ec82c9ecc70329edab0e7d5ac4e94db --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainDirected.lean @@ -0,0 +1,90 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryChainAlgebra +import OAI.Algebra.Finitistic.Encoding.DirectedBound + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation.ChainAlgebra +universe u +variable (k : Type u) [Field k] (l : ℕ) + +theorem vertex_orthogonal (i j : Fin (l+1)) (hij : i ≠ j) : vertex k l i * vertex k l j = 0 := by + apply Prod.ext + · funext t + change (Pi.single i (1:k) : Fin (l+1) → k) t * (Pi.single j (1:k) : Fin (l+1) → k) t = 0 + by_cases ht : t=i + · subst t; simp [hij.symm] + · simp [ht] + · funext t + change (Pi.single i (1:k) : Fin (l+1) → k) t.succ * 0 + 0 * (Pi.single j (1:k) : Fin (l+1) → k) t.castSucc = 0 + simp + +theorem vertex_complete : ∑ i : Fin (l+1), vertex k l i = 1 := by + apply Prod.ext + · funext t + have h := map_sum ((LinearMap.proj t).comp + (LinearMap.fst k (Fin (l+1) → k) (Fin l → k))) (fun i : Fin (l+1) => vertex k l i) Finset.univ + change (∑ i : Fin (l+1), vertex k l i).1 t = 1 + exact h.trans (by + change (∑ i : Fin (l+1), (Pi.single i (1:k) : Fin (l+1) → k) t) = 1 + simp [Pi.single_apply]) + · funext t + have h := map_sum ((LinearMap.proj t).comp + (LinearMap.snd k (Fin (l+1) → k) (Fin l → k))) (fun i : Fin (l+1) => vertex k l i) Finset.univ + change (∑ i : Fin (l+1), vertex k l i).2 t = 0 + exact h.trans (by + change (∑ _i : Fin (l+1), (0:k)) = 0 + simp) + +theorem vertex_corner_diagonal (i : Fin (l+1)) (x : ChainAlgebra k l) : + vertex k l i * x * vertex k l i = x.1 i • vertex k l i := by + apply Prod.ext + · funext t + change ((Pi.single i (1:k) : Fin (l+1) → k) t * x.1 t) * + (Pi.single i (1:k) : Fin (l+1) → k) t = x.1 i * (Pi.single i (1:k) : Fin (l+1) → k) t + by_cases ht : t=i <;> simp [ht] + · funext t + change ((Pi.single i (1:k) : Fin (l+1) → k) t.succ * x.1 t.succ) * 0 + + ((Pi.single i (1:k) : Fin (l+1) → k) t.succ * x.2 t + 0 * x.1 t.castSucc) * + (Pi.single i (1:k) : Fin (l+1) → k) t.castSucc = x.1 i * 0 + by_cases h₁ : t.succ = i + · have h₂ : t.castSucc ≠ i := by intro h; have := congrArg Fin.val h₁; have := congrArg Fin.val h; simp at *; omega + simp [h₂] + · simp [h₁] + +theorem vertex_directed (i j : Fin (l+1)) (hij : j < i) (x : ChainAlgebra k l) : + vertex k l j * x * vertex k l i = 0 := by + apply Prod.ext + · funext t + change ((Pi.single j (1:k) : Fin (l+1) → k) t * x.1 t) * + (Pi.single i (1:k) : Fin (l+1) → k) t = 0 + by_cases ht : t=j + · subst t; simp [ne_of_lt hij] + · simp [ht] + · funext t + change ((Pi.single j (1:k) : Fin (l+1) → k) t.succ * x.1 t.succ) * 0 + + ((Pi.single j (1:k) : Fin (l+1) → k) t.succ * x.2 t + 0 * x.1 t.castSucc) * + (Pi.single i (1:k) : Fin (l+1) → k) t.castSucc = 0 + by_cases h₁ : t.succ=j + · have h₂ : t.castSucc ≠ i := by + intro h + have := congrArg Fin.val h₁ + have := congrArg Fin.val h + change j.val < i.val at hij + simp at * + omega + simp [h₂] + · simp [h₁] + +/-- The actual chain algebra has the source's directed vertex system, including l=0. -/ +def directedSystem : DirectedBound.DirectedSystem k (ChainAlgebra k l) (l+1) where + e := vertex k l + idem := vertex_idempotent k l + orthogonal := vertex_orthogonal k l + complete := vertex_complete k l + diagonal i x := ⟨x.1 i,vertex_corner_diagonal k l i x⟩ + directed := vertex_directed k l +end LittleFinitistic.OrdinarySimulation.ChainAlgebra + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainResolution.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb282b026d4859f8d123d7d66226604b3beadf2d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryChainResolution.lean @@ -0,0 +1,169 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryChainAlgebra +import OAI.Algebra.Finitistic.Tensor.IdempotentTensor +import Mathlib.Algebra.Module.Projective + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k : Type u} [Field k] {l : ℕ} +namespace ChainAlgebra + +@[simp] theorem arrow_mul (i : Fin l) (x : ChainAlgebra k l) : + arrow k l i * x = x.1 i.castSucc • arrow k l i := by + apply Prod.ext <;> funext j + · change (0:k) * x.1 j = x.1 i.castSucc * 0 + simp + · change 0 * x.2 j + (Pi.single i 1 : Fin l → k) j * x.1 j.castSucc = + x.1 i.castSucc * (Pi.single i 1 : Fin l → k) j + by_cases h : j = i <;> simp [h] + +@[simp] theorem smul_diagonal (c : k) (x : ChainAlgebra k l) (i : Fin (l+1)) : + (c • x).1 i = c * x.1 i := rfl +@[simp] theorem smul_radical (c : k) (x : ChainAlgebra k l) (i : Fin l) : + (c • x).2 i = c * x.2 i := rfl +@[simp] theorem vertex_diagonal (i j : Fin (l+1)) : + (vertex k l i).1 j = (Pi.single i 1 : Fin (l+1) → k) j := rfl +@[simp] theorem arrow_diagonal (i : Fin l) (j : Fin (l+1)) : + (arrow k l i).1 j = 0 := rfl +@[simp] theorem arrow_radical (i j : Fin l) : + (arrow k l i).2 j = (Pi.single i 1 : Fin l → k) j := rfl + +/-- The two displayed coordinates of each noninitial right projective. -/ +theorem vertex_succ_mul (i : Fin l) (x : ChainAlgebra k l) : + vertex k l i.succ * x = x.1 i.succ • vertex k l i.succ + x.2 i • arrow k l i := by + rw [add_eq, smul_eq, smul_eq] + apply Prod.ext <;> funext j + · change (Pi.single i.succ 1 : Fin (l+1) → k) j * x.1 j = + x.1 i.succ * (Pi.single i.succ 1 : Fin (l+1) → k) j + x.2 i * 0 + by_cases h : j = i.succ <;> simp [h] + · change (Pi.single i.succ 1 : Fin (l+1) → k) j.succ * x.2 j + 0 * x.1 j.castSucc = + x.1 i.succ * 0 + x.2 i * (Pi.single i 1 : Fin l → k) j + by_cases h : j = i + · subst j; simp + · have hs : j.succ ≠ i.succ := fun e => h (Fin.succ_injective _ e) + simp [h, hs] + +/-- The initial projective has no radical coordinate. -/ +theorem vertex_zero_mul (x : ChainAlgebra k l) : + vertex k l 0 * x = x.1 0 • vertex k l 0 := by + rw [smul_eq] + apply Prod.ext <;> funext j + · change (Pi.single 0 1 : Fin (l+1) → k) j * x.1 j = + x.1 0 * (Pi.single 0 1 : Fin (l+1) → k) j + by_cases h : j = 0 <;> simp [h] + · change (Pi.single 0 1 : Fin (l+1) → k) j.succ * x.2 j + 0 * x.1 j.castSucc = x.1 0 * 0 + simp + +/-- Actual right projectives in the source resolution. -/ +abbrev rightTerm (i : Fin (l+1)) := IdempotentTensor.rightIdeal (vertex k l i) + +def leftMultiply (x : ChainAlgebra k l) : ChainAlgebra k l →ₗ[(ChainAlgebra k l)ᵐᵒᵖ] ChainAlgebra k l where + toFun y := x*y + map_add' := mul_add x + map_smul' r y := (mul_assoc x y r.unop).symm + +def retract (i : Fin (l+1)) : ChainAlgebra k l →ₗ[(ChainAlgebra k l)ᵐᵒᵖ] rightTerm (k := k) i := + (leftMultiply (vertex k l i)).codRestrict _ (fun x => by + change vertex k l i * (vertex k l i * x) = vertex k l i * x + rw [← mul_assoc, vertex_idempotent]) + +def rightRegularEquiv : (ChainAlgebra k l)ᵐᵒᵖ ≃ₗ[(ChainAlgebra k l)ᵐᵒᵖ] ChainAlgebra k l where + toFun := MulOpposite.unop + invFun := MulOpposite.op + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +theorem rightTerm_projective (i : Fin (l+1)) : + Module.Projective (ChainAlgebra k l)ᵐᵒᵖ (rightTerm (k := k) i) := by + let : Module.Projective (ChainAlgebra k l)ᵐᵒᵖ (ChainAlgebra k l) := Module.Projective.of_equiv rightRegularEquiv + apply Module.Projective.of_split (rightTerm (k := k) i).subtype (retract i) + ext x + exact x.property + +/-- The differential is actual left multiplication by the source arrow. -/ +def resolutionMap (i : Fin l) : rightTerm (k := k) i.castSucc →ₗ[(ChainAlgebra k l)ᵐᵒᵖ] rightTerm (k := k) i.succ := + ((leftMultiply (arrow k l i)).comp (rightTerm (k := k) i.castSucc).subtype).codRestrict _ (fun x => by + change vertex k l i.succ * (arrow k l i * x.val) = arrow k l i * x.val + rw [← mul_assoc, vertex_target_arrow]) + +@[simp] theorem resolutionMap_value (i : Fin l) (x : rightTerm (k := k) i.castSucc) : + (resolutionMap (k := k) i x).val = x.val.1 i.castSucc • arrow k l i := arrow_mul i x.val + +/-- This is the explicit two-coordinate expansion, not a dimension argument. -/ +theorem rightTerm_succ_expansion (i : Fin l) (x : rightTerm (k := k) i.succ) : + x.val = x.val.1 i.succ • vertex k l i.succ + x.val.2 i • arrow k l i := by + rw [← vertex_succ_mul] + exact x.property.symm + +/-- The source's resolution differentials square to zero. -/ +theorem resolutionMap_square (i : ℕ) (hi : i+1 < l) : + (resolutionMap (k := k) (⟨i+1,hi⟩ : Fin l)).comp + (resolutionMap (k := k) (⟨i,by omega⟩ : Fin l)) = 0 := by + ext x + change arrow k l ⟨i+1,hi⟩ * (arrow k l ⟨i,by omega⟩ * x.val) = 0 + rw [← mul_assoc, arrow_mul_arrow, zero_mul] + +theorem resolutionMap_zero_iff (i : Fin l) (x : rightTerm (k := k) i.castSucc) : + resolutionMap (k := k) i x = 0 ↔ x.val.1 i.castSucc = 0 := by + constructor + · intro h + have hr := congrArg (fun y : rightTerm (k := k) i.succ => y.val.2 i) h + rw [resolutionMap_value, smul_radical, arrow_radical] at hr + simpa using hr + · intro h + apply Subtype.ext + rw [resolutionMap_value, h, zero_smul] + rfl + +/-- Exact description of the image: the one-dimensional radical in the next term. -/ +theorem resolutionMap_range (i : Fin l) (x : rightTerm (k := k) i.succ) : + (∃ y, resolutionMap (k := k) i y = x) ↔ x.val.1 i.succ = 0 := by + constructor + · rintro ⟨y,rfl⟩ + rw [resolutionMap_value, smul_diagonal, arrow_diagonal, mul_zero] + · intro hx + let y : rightTerm (k := k) i.castSucc := ⟨x.val.2 i • vertex k l i.castSucc, by + change vertex k l i.castSucc * (x.val.2 i • vertex k l i.castSucc) = + x.val.2 i • vertex k l i.castSucc + rw [mul_smul_comm, vertex_idempotent]⟩ + refine ⟨y, ?_⟩ + apply Subtype.ext + rw [resolutionMap_value] + have hy : y.val.1 i.castSucc = x.val.2 i := by + dsimp [y] + simp + rw [hy] + have he := rightTerm_succ_expansion i x + rw [hx, zero_smul, zero_add] at he + exact he.symm + +/-- Exactness at every interior projective, with no assumed resolution predicate. -/ +theorem resolution_exact (i : ℕ) (hi : i+1 < l) + (x : rightTerm (k := k) (⟨i+1,by omega⟩ : Fin (l+1))) : + resolutionMap (k := k) (⟨i+1,hi⟩ : Fin l) x = 0 ↔ + ∃ y : rightTerm (k := k) (⟨i,by omega⟩ : Fin (l+1)), resolutionMap (k := k) (⟨i,by omega⟩ : Fin l) y = x := by + exact (resolutionMap_zero_iff (⟨i+1,hi⟩ : Fin l) x).trans + (resolutionMap_range (⟨i,by omega⟩ : Fin l) x).symm + +/-- Injectivity of the first nonzero differential in the resolution. -/ +theorem resolution_first_injective (hl : 0 < l) : + Function.Injective (resolutionMap (k := k) (⟨0,hl⟩ : Fin l)) := by + intro x y hxy + have hx : resolutionMap (k := k) (⟨0,hl⟩ : Fin l) (x-y) = 0 := by + rw [map_sub, hxy, sub_self] + have hz := (resolutionMap_zero_iff _ (x-y)).mp hx + have he := vertex_zero_mul (x-y).val + have hp : vertex k l 0 * (x-y).val = (x-y).val := (x-y).property + change (x-y).val.1 0 = 0 at hz + rw [hp, hz, zero_smul] at he + have hsub : x-y = 0 := Subtype.ext he + exact sub_eq_zero.mp hsub +end ChainAlgebra +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryCochain.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryCochain.lean new file mode 100644 index 0000000000000000000000000000000000000000..921db8a601cda46f429c7f4470be62bfe7ab8fcf --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryCochain.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryComplexAction +import Mathlib.Algebra.Homology.HomologicalComplex +import Mathlib.Algebra.Category.ModuleCat.Basic + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k : Type u} [Field k] + +/-- The genuine cochain differential on the selected finite interval. -/ +abbrev intervalTerms (P : CochainComplex (ModuleCat.{u} k) ℤ) (a : ℤ) (l : ℕ) + (i : Fin (l+1)) : Type u := P.X (a + (i.val : ℤ)) + +def intervalDifferential (P : CochainComplex (ModuleCat.{u} k) ℤ) (a : ℤ) (l : ℕ) + (i j : Fin (l+1)) : intervalTerms P a l i →ₗ[k] intervalTerms P a l j := + (P.d (a + (i.val : ℤ)) (a + (j.val : ℤ))).hom + +theorem intervalDifferential_square (P : CochainComplex (ModuleCat.{u} k) ℤ) + (a : ℤ) (l : ℕ) (i j h : Fin (l+1)) : + (intervalDifferential P a l j h).comp (intervalDifferential P a l i j) = 0 := by + have h := P.d_comp_d (a + (i.val : ℤ)) (a + (j.val : ℤ)) (a + (h.val : ℤ)) + exact congrArg (fun f => f.hom) h + +/-- The ordinary C-module O formed from the actual terms and differential of P. -/ +@[instance_reducible] +def cochainModule (P : CochainComplex (ModuleCat.{u} k) ℤ) (a : ℤ) (l : ℕ) : + Module (ChainAlgebra k l) (OrdinaryTerms (intervalTerms P a l)) := + OrdinaryTerms.module _ (intervalDifferential P a l) (intervalDifferential_square P a l) +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryComplexAction.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryComplexAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..92b46d268b33a81898d09fae4f940d2d2afb9913 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryComplexAction.lean @@ -0,0 +1,198 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryChainAlgebra +import Mathlib.Algebra.BigOperators.Module +import Mathlib.LinearAlgebra.Pi +import Mathlib.Tactic.Module + +namespace OAI +noncomputable section +open scoped BigOperators +namespace LittleFinitistic.OrdinarySimulation +universe u v +variable {k : Type u} [Field k] {l : ℕ} +namespace ChainAlgebra +/-- The coefficient of the unique possible arrow from j to i. -/ +def coefficient (x : ChainAlgebra k l) (i j : Fin (l+1)) : k := + if h : j.val < l then if i.val = j.val+1 then x.2 ⟨j.val,h⟩ else 0 else 0 + +@[simp] theorem coefficient_mul (x y : ChainAlgebra k l) (i j : Fin (l+1)) : + coefficient (x*y) i j = x.1 i * coefficient y i j + coefficient x i j * y.1 j := by + unfold coefficient + split + next h => + split + next hij => + have hi : i = (⟨j.val,h⟩ : Fin l).succ := Fin.ext hij + have hj : j = (⟨j.val,h⟩ : Fin l).castSucc := rfl + rw [mul_radical, hi] + rfl + next h => simp + next h => simp + +@[simp] theorem coefficient_one (i j : Fin (l+1)) : + coefficient (1 : ChainAlgebra k l) i j = 0 := by + unfold coefficient + have hz (j : Fin l) : (1 : ChainAlgebra k l).2 j = 0 := rfl + split <;> simp [hz] + +@[simp] theorem coefficient_zero (i j : Fin (l+1)) : + coefficient (0 : ChainAlgebra k l) i j = 0 := by + unfold coefficient + split <;> simp + +@[simp] theorem coefficient_add (x y : ChainAlgebra k l) (i j : Fin (l+1)) : + coefficient (x+y) i j = coefficient x i j + coefficient y i j := by + unfold coefficient + split <;> simp + split <;> simp + +@[simp] theorem coefficient_vertex (h i j : Fin (l+1)) : + coefficient (vertex k l h) i j = 0 := by + unfold coefficient + split <;> simp [vertex] + +@[simp] theorem coefficient_arrow (h : Fin l) (i j : Fin (l+1)) : + coefficient (arrow k l h) i j = if i = h.succ ∧ j = h.castSucc then 1 else 0 := by + classical + simp only [coefficient, arrow, Pi.single_apply, Fin.ext_iff, + Fin.val_succ, Fin.val_castSucc] + split_ifs <;> simp_all + +end ChainAlgebra + +/-- Actual finite direct sum of terms; the finite product is canonically that sum. -/ +abbrev OrdinaryTerms (V : Fin (l+1) → Type v) := ∀ i, V i + +namespace OrdinaryTerms +variable (V : Fin (l+1) → Type v) [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] +variable (d : ∀ i j, V i →ₗ[k] V j) + +/-- Coordinate action induced by the genuine differential, not an assumed representation. -/ +def action (x : ChainAlgebra k l) (v : OrdinaryTerms V) (i : Fin (l+1)) : V i := + x.1 i • v i + ∑ j, ChainAlgebra.coefficient x i j • d j i (v j) + +theorem action_add (x : ChainAlgebra k l) (v w : OrdinaryTerms V) : + action V d x (v+w) = action V d x v + action V d x w := by + funext i + simp only [action, Pi.add_apply, map_add, smul_add, Finset.sum_add_distrib] + abel + +theorem action_smul (x : ChainAlgebra k l) (c : k) (v : OrdinaryTerms V) : + action V d x (c • v) = c • action V d x v := by + funext i + simp only [action, Pi.smul_apply, map_smul, smul_add, Finset.smul_sum] + congr 1 + · exact smul_comm _ _ _ + · apply Finset.sum_congr rfl; intro j _; exact smul_comm _ _ _ + +/-- The complex equation d²=0 implies associativity of the ordinary action. -/ +theorem action_mul (dd : ∀ i j h, (d j h).comp (d i j) = 0) + (x y : ChainAlgebra k l) (v : OrdinaryTerms V) : + action V d (x*y) v = action V d x (action V d y v) := by + have hz (i j h) (w : V i) : d j h (d i j w) = 0 := by + have := LinearMap.congr_fun (dd i j h) w + simpa using this + funext i + simp only [action, ChainAlgebra.mul_diagonal, ChainAlgebra.coefficient_mul, + map_add, map_smul, map_sum, hz, smul_zero, Finset.sum_const_zero, add_zero, + smul_add, Finset.smul_sum, add_smul, Finset.sum_add_distrib, smul_smul] + simp only [mul_comm] + abel + +def actionLinear (x : ChainAlgebra k l) : OrdinaryTerms V →ₗ[k] OrdinaryTerms V where + toFun := action V d x + map_add' := action_add V d x + map_smul' := action_smul V d x + +/-- Each ordinary vertex projects onto the corresponding genuine term. -/ +theorem action_vertex (h : Fin (l+1)) (v : OrdinaryTerms V) : + action V d (ChainAlgebra.vertex k l h) v = Pi.single h (v h) := by + classical + funext i + simp only [action, ChainAlgebra.coefficient_vertex, zero_smul, + Finset.sum_const_zero, add_zero] + change (Pi.single h 1 : Fin (l+1) → k) i • v i = Pi.single h (v h) i + by_cases hi : i = h + · subst i; simp + · simp [hi] + +/-- Each ordinary arrow acts by the actual differential on its source term. -/ +theorem action_arrow (h : Fin l) (v : OrdinaryTerms V) : + action V d (ChainAlgebra.arrow k l h) v = + Pi.single h.succ (d h.castSucc h.succ (v h.castSucc)) := by + classical + funext i + have hz : (ChainAlgebra.arrow k l h).1 i = 0 := rfl + simp only [action, hz, zero_smul, zero_add, ChainAlgebra.coefficient_arrow] + by_cases hi : i = h.succ + · subst i; simp + · simp [hi] + +theorem action_one (v : OrdinaryTerms V) : action V d 1 v = v := by + funext i + have ho : (1 : ChainAlgebra k l).1 i = 1 := rfl + simp [action, ho] + +theorem action_zero (v : OrdinaryTerms V) : action V d 0 v = 0 := by + funext i + simp only [action, ChainAlgebra.coefficient_zero, zero_smul, Finset.sum_const_zero, add_zero] + simp [ChainAlgebra.zero_eq] + +theorem add_action (x y : ChainAlgebra k l) (v : OrdinaryTerms V) : + action V d (x+y) v = action V d x v + action V d y v := by + funext i + have ha : (x+y).1 i = x.1 i + y.1 i := rfl + simp only [action, ha, Pi.add_apply, ChainAlgebra.coefficient_add, add_smul, Finset.sum_add_distrib] + abel + +/-- The ordinary C-module constructed from the complex equation. -/ +@[instance_reducible] +def module (dd : ∀ i j h, (d j h).comp (d i j) = 0) : + Module (ChainAlgebra k l) (OrdinaryTerms V) where + smul := action V d + one_smul := action_one V d + mul_smul := action_mul V d dd + smul_zero x := by + change action V d x 0 = 0 + funext i + simp [action] + smul_add := action_add V d + add_smul := add_action V d + zero_smul := action_zero V d + +variable (dd : ∀ i j h, (d j h).comp (d i j) = 0) + +/-- The constructed action retains the given k-vector-space structure. -/ +theorem scalarTower : letI := module V d dd; IsScalarTower k (ChainAlgebra k l) (OrdinaryTerms V) := by + let := module V d dd + refine ⟨?_⟩ + intro c x v + change action V d (c • x) v = c • action V d x v + funext i + have hc (i j : Fin (l+1)) : + ChainAlgebra.coefficient (c • x) i j = c * ChainAlgebra.coefficient x i j := by + unfold ChainAlgebra.coefficient + split <;> simp [ChainAlgebra.smul_eq] + simp only [action, hc] + simp only [ChainAlgebra.smul_eq, Pi.smul_apply, action, + smul_eq_mul, mul_smul, smul_add, Finset.smul_sum] +/-- Any additional scalar action commuting with k and with d commutes with C. +Applied to B and Bᵐᵒᵖ this proves both bimodule actions, without postulating them. -/ +theorem action_commutes (R : Type*) [Monoid R] [∀ i, DistribMulAction R (V i)] + [∀ i, SMulCommClass k R (V i)] + (hd : ∀ i j (r : R) (v : V i), d i j (r • v) = r • d i j v) + (x : ChainAlgebra k l) (r : R) (v : OrdinaryTerms V) : + action V d x (r • v) = r • action V d x v := by + funext i + simp only [action, Pi.smul_apply, hd, smul_add, Finset.smul_sum] + congr 1 + · exact smul_comm _ _ _ + · apply Finset.sum_congr rfl; intro j _; exact smul_comm _ _ _ + +instance finiteDimensional [∀ i, FiniteDimensional k (V i)] : + FiniteDimensional k (OrdinaryTerms V) := inferInstanceAs (FiniteDimensional k (∀ i, V i)) +end OrdinaryTerms +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryComplexTensorMaps.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryComplexTensorMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cc9ff40f5315dae5034ca49f3fe3bc89e8cf72b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryComplexTensorMaps.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorBimap +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftSign + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ComplexTensor +open BalancedTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) + +abbrev rightTerm (p : ℤ) := ScalarLeftModule k Aᵐᵒᵖ (Q.X p) +abbrev leftTerm (q : ℤ) := ScalarLeftModule k A (Z.X q) +abbrev term (p q : ℤ) := Tensor k A (rightTerm k A Q p) (leftTerm k A Z q) + +/-- The balanced map for actual maps between terms of the two input complexes. -/ +def map {p p' q q' : ℤ} (f : Q.X p ⟶ Q.X p') (g : Z.X q ⟶ Z.X q') : + term k A Q Z p q →ₗ[k] term k A Q Z p' q' := + bimap (k := k) + (M := rightTerm k A Q p) (M' := rightTerm k A Q p') + (N := leftTerm k A Z q) (N' := leftTerm k A Z q') f.hom g.hom + +@[simp] theorem map_comp {p p' p'' q q' q'' : ℤ} + (f : Q.X p ⟶ Q.X p') (f' : Q.X p' ⟶ Q.X p'') + (g : Z.X q ⟶ Z.X q') (g' : Z.X q' ⟶ Z.X q'') : + (map k A Q Z f' g').comp (map k A Q Z f g) = map k A Q Z (f ≫ f') (g ≫ g') := + bimap_comp _ _ _ _ + +@[simp] theorem map_zero_left {p p' q q' : ℤ} (g : Z.X q ⟶ Z.X q') : + map k A Q Z (0 : Q.X p ⟶ Q.X p') g = 0 := bimap_zero_left _ + +@[simp] theorem map_zero_right {p p' q q' : ℤ} (f : Q.X p ⟶ Q.X p') : + map k A Q Z f (0 : Z.X q ⟶ Z.X q') = 0 := bimap_zero_right _ + +/-- The column at right degree p, including the standard total-complex sign (-1)^p. -/ +def column (p : ℤ) : CochainComplex (ModuleCat.{u} k) ℤ := + (((fixedTensorFunctor k A (rightTerm k A Q p)).mapHomologicalComplex (.up ℤ)).obj Z)⟦-p⟧ + +@[simp] theorem column_d (p n m : ℤ) : + ((column k A Q Z p).d n m).hom = + (-p).negOnePow • map k A Q Z (𝟙 (Q.X p)) (Z.d (n + -p) (m + -p)) := by + apply BalancedTensor.ext + intro x y + rfl + +/-- Horizontal tensor maps reindex the unchanged left factor along the total degree. -/ +def horizontal (n p p' : ℤ) (h : p+1=p') : + term k A Q Z p (n + -p) →ₗ[k] term k A Q Z p' ((n+1) + -p') := + map k A Q Z (Q.d p p') (eqToHom (congrArg Z.X (by omega))) + +theorem horizontal_square (n p p' p'' : ℤ) (h : p+1=p') (h' : p'+1=p'') : + (horizontal k A Q Z (n+1) p' p'' h').comp (horizontal k A Q Z n p p' h) = 0 := by + unfold horizontal + rw [map_comp,Q.d_comp_d,map_zero_left] +end LittleFinitistic.ComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryCompression.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryCompression.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb6b923b2243264b2d17434515d02b11db012e63 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryCompression.lean @@ -0,0 +1,74 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryCochain +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings +import Mathlib.Algebra.Homology.Additive +import Mathlib.RingTheory.TensorProduct.Maps + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] + +/-- Forgetting to k uses the actual restriction-of-scalars functor on complexes. -/ +abbrev underlyingComplex (P : CochainComplex (ModuleCat.{u} A) ℤ) : + CochainComplex (ModuleCat.{u} k) ℤ := + ((ModuleCat.restrictScalars (algebraMap k A)).mapHomologicalComplex (.up ℤ)).obj P + +/-- Ordinary finite compression of the actual dg A-module P on [a,a+l]. +Take A=B tensor Bᵐᵒᵖ for a genuine dg B-bimodule. -/ +def Compression (P : CochainComplex (ModuleCat.{u} A) ℤ) (a : ℤ) (l : ℕ) := + ∀ i : Fin (l+1), P.X (a + (i.val : ℤ)) + +namespace Compression +variable (P : CochainComplex (ModuleCat.{u} A) ℤ) (a : ℤ) (l : ℕ) +instance : AddCommGroup (Compression P a l) := + inferInstanceAs (AddCommGroup (∀ i : Fin (l+1), P.X (a + (i.val : ℤ)))) +instance : Module k (Compression P a l) := + inferInstanceAs (Module k (OrdinaryTerms (intervalTerms (underlyingComplex (k := k) P) a l))) +instance : Module A (Compression P a l) := + inferInstanceAs (Module A (∀ i : Fin (l+1), P.X (a + (i.val : ℤ)))) +instance : Module (ChainAlgebra k l) (Compression P a l) := + cochainModule (underlyingComplex (k := k) P) a l +instance : IsScalarTower k (ChainAlgebra k l) (Compression P a l) := + OrdinaryTerms.scalarTower _ _ (intervalDifferential_square (underlyingComplex (k := k) P) a l) + +instance scalarTowerA : IsScalarTower k A (Compression P a l) where + smul_assoc c r v := by + funext i + change (c • r) • v i = (algebraMap k A c) • r • v i + rw [Algebra.smul_def, mul_smul] + +instance : SMulCommClass (ChainAlgebra k l) A (Compression P a l) where + smul_comm x r v := by + let (n : ℤ) : Module k (P.X n) := Module.compHom _ (algebraMap k A) + let (n : ℤ) : IsScalarTower k A (P.X n) := IsScalarTower.of_compHom k A (P.X n) + let (i : Fin (l+1)) : Module A (intervalTerms (underlyingComplex (k := k) P) a l i) := inferInstanceAs (Module A (P.X (a + (i.val : ℤ)))) + let (i : Fin (l+1)) : SMulCommClass k A (intervalTerms (underlyingComplex (k := k) P) a l i) := inferInstanceAs (SMulCommClass k A (P.X (a + (i.val : ℤ)))) + change OrdinaryTerms.action (intervalTerms (underlyingComplex (k := k) P) a l) (intervalDifferential (underlyingComplex (k := k) P) a l) x (r • v) = r • OrdinaryTerms.action (intervalTerms (underlyingComplex (k := k) P) a l) (intervalDifferential (underlyingComplex (k := k) P) a l) x v + apply OrdinaryTerms.action_commutes + intro i j r v + exact (P.d (a + (i.val : ℤ)) (a + (j.val : ℤ))).hom.map_smul r v + +/-- The commuting actions give the actual tensor-algebra representation. -/ +def tensorAction : (A ⊗[k] ChainAlgebra k l) →ₐ[k] Module.End k (Compression P a l) := + Algebra.TensorProduct.lift (Algebra.lsmul k k (Compression P a l)) + (Algebra.lsmul k k (Compression P a l)) (by + intro r x + ext v + change r • (x • v) = x • (r • v) + exact (smul_comm x r v).symm) + +@[simp] theorem tensorAction_tmul (r : A) (x : ChainAlgebra k l) (v : Compression P a l) : + tensorAction (k := k) P a l (r ⊗ₜ[k] x) v = r • (x • v) := rfl + +instance finiteDimensional [∀ n, FiniteDimensional k ((underlyingComplex (k := k) P).X n)] : + FiniteDimensional k (Compression P a l) := + inferInstanceAs (FiniteDimensional k (∀ i : Fin (l+1), (underlyingComplex (k := k) P).X (a+(i.val:ℤ)))) +end Compression +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryConeCoordinates.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryConeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..a95b68a1295f5c0458c69a04d561e1d6dd91a220 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryConeCoordinates.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryConeQuasiIso +import Mathlib.Algebra.Category.ModuleCat.Biproducts + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.ConeCoordinates +universe u +variable {R : Type u} [Ring R] +variable {K L : CochainComplex (ModuleCat.{u} R) ℤ} (f : K ⟶ L) + +/-- The native cone term in its actual two module coordinates. -/ +def coordinateIso (n : ℤ) : (CochainComplex.mappingCone f).X n ≅ + ModuleCat.of R (K.X (n+1) × L.X n) := + HomologicalComplex.homotopyCofiber.XIsoBiprod f n (n+1) rfl ≪≫ + ModuleCat.biprodIsoProd (K.X (n+1)) (L.X n) + +def coordinateEquiv (n : ℤ) : (CochainComplex.mappingCone f).X n ≃ₗ[R] (K.X (n+1) × L.X n) := + (coordinateIso f n).toLinearEquiv + +theorem coordinate_fst (n : ℤ) : + (coordinateIso f n).hom ≫ ModuleCat.ofHom (LinearMap.fst R (K.X (n+1)) (L.X n)) = + HomologicalComplex.homotopyCofiber.fstX f n (n+1) rfl := by + unfold coordinateIso + erw [Iso.trans_hom,Category.assoc,← ModuleCat.biprodIsoProd_inv_comp_fst,Iso.hom_inv_id_assoc] + rfl + +theorem coordinate_snd (n : ℤ) : + (coordinateIso f n).hom ≫ ModuleCat.ofHom (LinearMap.snd R (K.X (n+1)) (L.X n)) = + HomologicalComplex.homotopyCofiber.sndX f n := by + unfold coordinateIso + erw [Iso.trans_hom,Category.assoc,← ModuleCat.biprodIsoProd_inv_comp_snd,Iso.hom_inv_id_assoc] + apply HomologicalComplex.homotopyCofiber.ext_from_X f (n+1) n rfl + · erw [← Category.assoc, HomologicalComplex.homotopyCofiber.inlX_XIsoBiprod_hom, + biprod.inl_snd, HomologicalComplex.homotopyCofiber.inlX_sndX] + · erw [← Category.assoc, HomologicalComplex.homotopyCofiber.inrX_XIsoBiprod_hom, + biprod.inr_snd, HomologicalComplex.homotopyCofiber.inrX_sndX] + +/-- The first coordinate of the native cone differential carries its negative sign. -/ +theorem differential_fst (n : ℤ) (z : (CochainComplex.mappingCone f).X n) : + (coordinateEquiv f (n+1) (((CochainComplex.mappingCone f).d n (n+1)).hom z)).1 = + -((K.d (n+1) ((n+1)+1)).hom (coordinateEquiv f n z).1) := by + have hh := HomologicalComplex.homotopyCofiber.d_fstX f n (n+1) ((n+1)+1) rfl rfl + rw [← coordinate_fst,← coordinate_fst] at hh + exact congrArg (fun g => g.hom z) hh + +/-- The second coordinate contains the input map and the target differential. -/ +theorem differential_snd (n : ℤ) (z : (CochainComplex.mappingCone f).X n) : + (coordinateEquiv f (n+1) (((CochainComplex.mappingCone f).d n (n+1)).hom z)).2 = + (f.f (n+1)).hom (coordinateEquiv f n z).1 + + (L.d n (n+1)).hom (coordinateEquiv f n z).2 := by + have hh := HomologicalComplex.homotopyCofiber.d_sndX f n (n+1) rfl + rw [← coordinate_snd,← coordinate_snd,← coordinate_fst] at hh + exact congrArg (fun g => g.hom z) hh +end LittleFinitistic.ConeCoordinates + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryConeQuasiIso.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryConeQuasiIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..5688125698e7faa61a00c277f2d9ae71bcf9806b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryConeQuasiIso.lean @@ -0,0 +1,23 @@ +import Mathlib.Algebra.Homology.HomotopyCategory.Acyclic + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u v +variable {C : Type u} [Category.{v} C] [Abelian C] +variable {K L : CochainComplex C ℤ} (f : K ⟶ L) + +/-- The actual native mapping cone detects quasi-isomorphisms. -/ +theorem quasiIso_iff_mappingCone_acyclic : QuasiIso f ↔ (CochainComplex.mappingCone f).Acyclic := by + rw [← HomologicalComplex.mem_quasiIso_iff, + ← HomotopyCategory.quotient_map_mem_quasiIso_iff, + HomotopyCategory.quasiIso_eq_trW_subcategoryAcyclic] + exact ((HomotopyCategory.subcategoryAcyclic C).trW_iff_of_distinguished + (CochainComplex.mappingCone.triangleh f) (HomotopyCategory.mappingCone_triangleh_distinguished f)).trans + (HomotopyCategory.quotient_obj_mem_subcategoryAcyclic_iff_acyclic _) +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryDerivedIterates.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryDerivedIterates.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e7a8d186519966b69d96079fac5c6b6e2d29878 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryDerivedIterates.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinarySourceDerivedComparison +import Mathlib.Logic.Function.Iterate + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.XResolution +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +variable (b : ℤ) (hb : a+(l:ℤ)=b) +variable (hP : ∀ n : ℤ, n < a ∨ b < n → Limits.IsZero (P.X n)) +variable [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (AlgebraD k l B))] + +/-- The actual ordinary square on every native derived object, using essential surjectivity of Q. -/ +def derivedSquareObject (Y : DerivedCategory (ModuleCat.{u} B)) : + (derivedTensor P a l).obj ((derivedTensor P a l).obj + ((BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj Y)) ≅ + (BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj + ((shiftedDerivedTensor P b l).obj Y) := + let e := DerivedCategory.Q.objObjPreimageIso Y + (derivedTensor P a l).mapIso ((derivedTensor P a l).mapIso + ((BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).mapIso e.symm)) ≪≫ + derivedSquareComparison P a l b hb hP (DerivedCategory.Q.objPreimage Y) ≪≫ + (BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).mapIso + ((shiftedDerivedTensor P b l).mapIso e) + +/-- Every even iterate is the first-block inflation of the corresponding actual P[b] tensor iterate. -/ +def derivedEvenIterate (n : ℕ) (Y : DerivedCategory (ModuleCat.{u} B)) : + ((derivedTensor P a l).obj)^[2*n] + ((BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj Y) ≅ + (BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj + (((shiftedDerivedTensor P b l).obj)^[n] Y) := by + induction n with + | zero => exact Iso.refl _ + | succ n ih => + have hn : 2*(n+1) = (2*n+1)+1 := by omega + rw [hn,Function.iterate_succ_apply',Function.iterate_succ_apply',Function.iterate_succ_apply'] + exact (derivedTensor P a l).mapIso ((derivedTensor P a l).mapIso ih) ≪≫ + derivedSquareObject P a l b hb hP (((shiftedDerivedTensor P b l).obj)^[n] Y) +end LittleFinitistic.OrdinarySimulation.XResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryDerivedSquareComparison.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryDerivedSquareComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ba77a8723d8d4cdeda7d534718c33c719a781f9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryDerivedSquareComparison.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryXBlockComparison +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockDerived +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftDerivedTensor + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.XResolution +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +variable (b : ℤ) (hb : a+(l:ℤ)=b) +variable (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) +variable [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (AlgebraD k l B))] + +/-- The actual native derived square comparison on every complex Z, with first-block support. +Both tensor functors are the localization lifts of their verified bounded projective models. -/ +def derivedSquareComparison (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + (derivedTensor P a l).obj ((derivedTensor P a l).obj + ((BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj (DerivedCategory.Q.obj Z))) ≅ + (BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj + ((shiftedDerivedTensor P b l).obj (DerivedCategory.Q.obj Z)) := + (derivedTensor P a l).mapIso ((derivedTensor P a l).mapIso + ((BlockModule.derivedFirstComparison B (B ⊗[k] ChainAlgebra k l)).app Z)) ≪≫ + (derivedTensor P a l).mapIso ((derivedTensorComparison P a l).app + (BlockModule.firstComplex B (B ⊗[k] ChainAlgebra k l) Z)) ≪≫ + (derivedTensorComparison P a l).app + ((tensorFunctor P a l).obj (BlockModule.firstComplex B (B ⊗[k] ChainAlgebra k l) Z)) ≪≫ + DerivedCategory.Q.mapIso (squareComparison P a l b hb hP Z) ≪≫ + ((BlockModule.derivedFirstComparison B (B ⊗[k] ChainAlgebra k l)).app + (BimoduleComplexTensor.total k B B (P⟦b⟧) Z + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l))).symm ≪≫ + (BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).mapIso + ((shiftedDerivedTensorComparison P b l).app Z).symm +end LittleFinitistic.OrdinarySimulation.XResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteColumnComplex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteColumnComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..20cbd164c97e343b670165bf19c9469b01db0272 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteColumnComplex.lean @@ -0,0 +1,84 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTriangularExactness +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat +import Mathlib.Algebra.Homology.QuasiIso + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.FiniteColumnComplex +universe u +variable {R : Type u} [Ring R] {l : ℕ} +variable (K : Fin l → CochainComplex (ModuleCat.{u} R) ℤ) + +abbrev term (n : ℤ) := ∀ i, (K i).X n + +/-- A finite-column total differential, recorded independently of a chosen direct-sum presentation. -/ +structure Differential where + d : ∀ n : ℤ, term K n →ₗ[R] term K (n+1) + square : ∀ n, (d (n+1)).comp (d n) = 0 + triangular : ∀ (n : ℤ) (i : Fin l) (z : term K n), + (∀ j : Fin l, j.val < i.val → z j = 0) → + d n z i = ((K i).d n (n+1)).hom (z i) + +variable (δ : Differential K) + +def complex : CochainComplex (ModuleCat.{u} R) ℤ := + CochainComplex.of (fun n => ModuleCat.of R (term K n)) + (fun n => ModuleCat.ofHom (δ.d n)) (fun n => ModuleCat.hom_ext (δ.square n)) + +@[simp] theorem complex_d (n : ℤ) : + (complex K δ).d n (n+1) = ModuleCat.ofHom (δ.d n) := by + exact CochainComplex.of_d (fun n => ModuleCat.of R (term K n)) + (fun n => ModuleCat.ofHom (δ.d n)) n + +@[simp] theorem complex_d_hom (n : ℤ) : + ((complex K δ).d n (n+1)).hom = δ.d n := by + rw [complex_d] + rfl + +theorem lower_single (n : ℤ) (i : Fin l) (x : (K i).X n) (j : Fin l) (hji : j.val < i.val) : + δ.d n (Pi.single i x : term K n) j = 0 := by + classical + have ht : ∀ t : Fin l, t.val < j.val → (Pi.single i x : term K n) t = 0 := by + intro t ht + simp [show t ≠ i from by intro h; subst t; omega] + rw [δ.triangular n j (Pi.single i x) ht] + rw [Pi.single_eq_of_ne (show j ≠ i from by intro h; subst j; omega),map_zero] + +theorem diagonal_single (n : ℤ) (i : Fin l) (x : (K i).X n) : + δ.d n (Pi.single i x) i = ((K i).d n (n+1)).hom x := by + classical + have ht : ∀ j : Fin l, j.val < i.val → (Pi.single i x : term K n) j = 0 := by + intro j hj + simp [show j ≠ i from by intro h; subst j; omega] + rw [δ.triangular n i (Pi.single i x) ht,Pi.single_eq_same] + +/-- Finite totalization preserves acyclicity when every column is acyclic. -/ +theorem acyclic (hK : ∀ i, (K i).Acyclic) : (complex K δ).Acyclic := by + intro n + have hn : n-1+1=n := by omega + suffices hh : (complex K δ).ExactAt (n-1+1) by simpa only [hn] using hh + apply (HomologicalComplex.exactAt_iff' _ (n-1) (n-1+1) ((n-1+1)+1) (by simp) (by simp)).2 + rw [ShortComplex.moduleCat_exact_iff] + have hex (i : Fin l) : Function.Exact + ((K i).d (n-1) (n-1+1)).hom ((K i).d (n-1+1) ((n-1+1)+1)).hom := by + have hh := (HomologicalComplex.exactAt_iff' (K i) (n-1) (n-1+1) ((n-1+1)+1) + (by simp) (by simp)).mp (hK i _) + exact (ShortComplex.ShortExact.moduleCat_exact_iff_function_exact _).mp hh + have ht := TriangularExactness.exact_of_diagonal + (fun i => (K i).X (n-1)) (fun i => (K i).X (n-1+1)) (fun i => (K i).X ((n-1+1)+1)) + (δ.d (n-1)) (δ.d (n-1+1)) + (fun i => ((K i).d (n-1) (n-1+1)).hom) + (fun i => ((K i).d (n-1+1) ((n-1+1)+1)).hom) + (δ.square (n-1)) (lower_single K δ (n-1)) (diagonal_single K δ (n-1)) + (δ.triangular (n-1+1)) hex + change ∀ (z : term K (n-1+1)), + ((complex K δ).d (n-1+1) ((n-1+1)+1)).hom z = 0 → + ∃ w : term K (n-1), ((complex K δ).d (n-1) (n-1+1)).hom w = z + simp only [complex_d_hom] + exact fun z hz => (ht z).mp hz +end LittleFinitistic.FiniteColumnComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteConeReindex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteConeReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed93a9381bf0c9548b7941624065051edb2ccb3e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteConeReindex.lean @@ -0,0 +1,72 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryConeCoordinates +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFiniteTotalMaps + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.FiniteColumnComplex +universe u +variable {R : Type u} [Ring R] {l : ℕ} +variable (K L : Fin l → CochainComplex (ModuleCat.{u} R) ℤ) +variable (δ : Differential K) (ε : Differential L) +variable (f : ∀ i, K i ⟶ L i) +variable (hc : ∀ n, + (ε.d n).comp (componentMap K L f n) = (componentMap K L f (n+1)).comp (δ.d n)) + +abbrev coneColumn (i : Fin l) := CochainComplex.mappingCone (f i) +abbrev totalCone := CochainComplex.mappingCone (complexMap K L δ ε f hc) + +/-- Distribution of a binary module product over the finite family of columns. -/ +def pairEquiv (n : ℤ) : (term K (n+1) × term L n) ≃ₗ[R] (∀ i, (K i).X (n+1) × (L i).X n) where + toFun z i := (z.1 i,z.2 i) + invFun z := (fun i => (z i).1,fun i => (z i).2) + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- Reindex the actual cone of a total map into the actual cones of its column maps. -/ +def coneEquiv (n : ℤ) : (totalCone K L δ ε f hc).X n ≃ₗ[R] term (coneColumn K L f) n := + (ConeCoordinates.coordinateEquiv (complexMap K L δ ε f hc) n).trans + ((pairEquiv K L n).trans + (LinearEquiv.piCongrRight (fun i => (ConeCoordinates.coordinateEquiv (f i) n).symm))) + +@[simp] theorem coneEquiv_coordinate (n : ℤ) (z : (totalCone K L δ ε f hc).X n) (i : Fin l) : + ConeCoordinates.coordinateEquiv (f i) n (coneEquiv K L δ ε f hc n z i) = + ((ConeCoordinates.coordinateEquiv (complexMap K L δ ε f hc) n z).1 i, + (ConeCoordinates.coordinateEquiv (complexMap K L δ ε f hc) n z).2 i) := by + exact (ConeCoordinates.coordinateEquiv (f i) n).apply_symm_apply _ + +@[simp] theorem coneEquiv_symm_coordinate (n : ℤ) (z : term (coneColumn K L f) n) (i : Fin l) : + ((ConeCoordinates.coordinateEquiv (complexMap K L δ ε f hc) n ((coneEquiv K L δ ε f hc n).symm z)).1 i, + (ConeCoordinates.coordinateEquiv (complexMap K L δ ε f hc) n ((coneEquiv K L δ ε f hc n).symm z)).2 i) = + ConeCoordinates.coordinateEquiv (f i) n (z i) := by + have hh := coneEquiv_coordinate K L δ ε f hc n ((coneEquiv K L δ ε f hc n).symm z) i + rw [LinearEquiv.apply_symm_apply] at hh + exact hh.symm + +/-- Transport the genuine cone differential through this coordinate equivalence. -/ +def coneDifferential (n : ℤ) : term (coneColumn K L f) n →ₗ[R] term (coneColumn K L f) (n+1) := + (coneEquiv K L δ ε f hc (n+1)).toLinearMap.comp + (((totalCone K L δ ε f hc).d n (n+1)).hom.comp (coneEquiv K L δ ε f hc n).symm.toLinearMap) + +theorem coneDifferential_square (n : ℤ) : + (coneDifferential K L δ ε f hc (n+1)).comp (coneDifferential K L δ ε f hc n) = 0 := by + apply LinearMap.ext + intro z + change coneEquiv K L δ ε f hc ((n+1)+1) + (((totalCone K L δ ε f hc).d (n+1) ((n+1)+1)).hom + ((coneEquiv K L δ ε f hc (n+1)).symm + (coneEquiv K L δ ε f hc (n+1) + (((totalCone K L δ ε f hc).d n (n+1)).hom ((coneEquiv K L δ ε f hc n).symm z))))) = 0 + rw [LinearEquiv.symm_apply_apply] + have hh := congrArg (fun g => g.hom ((coneEquiv K L δ ε f hc n).symm z)) + ((totalCone K L δ ε f hc).d_comp_d n (n+1) ((n+1)+1)) + change ((totalCone K L δ ε f hc).d (n+1) ((n+1)+1)).hom + (((totalCone K L δ ε f hc).d n (n+1)).hom ((coneEquiv K L δ ε f hc n).symm z)) = 0 at hh + rw [hh,map_zero] +end LittleFinitistic.FiniteColumnComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteConeTriangular.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteConeTriangular.lean new file mode 100644 index 0000000000000000000000000000000000000000..7595cdbc922fcec6c91fd5ba48b479f221a91dc9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteConeTriangular.lean @@ -0,0 +1,87 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFiniteConeReindex + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.FiniteColumnComplex +universe u +variable {R : Type u} [Ring R] {l : ℕ} +variable (K L : Fin l → CochainComplex (ModuleCat.{u} R) ℤ) +variable (δ : Differential K) (ε : Differential L) +variable (f : ∀ i, K i ⟶ L i) +variable (hc : ∀ n, + (ε.d n).comp (componentMap K L f n) = (componentMap K L f (n+1)).comp (δ.d n)) + +abbrev coneSource (n : ℤ) (z : term (coneColumn K L f) n) : term K (n+1) := + fun i => (ConeCoordinates.coordinateEquiv (f i) n (z i)).1 +abbrev coneTarget (n : ℤ) (z : term (coneColumn K L f) n) : term L n := + fun i => (ConeCoordinates.coordinateEquiv (f i) n (z i)).2 + +theorem coneEquiv_symm_pair (n : ℤ) (z : term (coneColumn K L f) n) : + ConeCoordinates.coordinateEquiv (complexMap K L δ ε f hc) n + ((coneEquiv K L δ ε f hc n).symm z) = (coneSource K L f n z,coneTarget K L f n z) := by + apply Prod.ext + · funext i + exact congrArg Prod.fst (coneEquiv_symm_coordinate K L δ ε f hc n z i) + · funext i + exact congrArg Prod.snd (coneEquiv_symm_coordinate K L δ ε f hc n z i) + +/-- The conjugated genuine cone differential has the expected finite-column formula. -/ +theorem coneDifferential_coordinate (n : ℤ) (z : term (coneColumn K L f) n) (i : Fin l) : + ConeCoordinates.coordinateEquiv (f i) (n+1) (coneDifferential K L δ ε f hc n z i) = + (-(δ.d (n+1) (coneSource K L f n z)) i, + ((f i).f (n+1)).hom (coneSource K L f n z i) + (ε.d n (coneTarget K L f n z)) i) := by + change ConeCoordinates.coordinateEquiv (f i) (n+1) + (coneEquiv K L δ ε f hc (n+1) + (((totalCone K L δ ε f hc).d n (n+1)).hom ((coneEquiv K L δ ε f hc n).symm z)) i) = _ + rw [coneEquiv_coordinate,ConeCoordinates.differential_fst,ConeCoordinates.differential_snd, + coneEquiv_symm_pair] + simp only [complex_d_hom] + rfl + +/-- The cone of a componentwise total map is triangular with the actual column cones on its diagonal. -/ +def coneTriangular : Differential (coneColumn K L f) where + d := coneDifferential K L δ ε f hc + square := coneDifferential_square K L δ ε f hc + triangular n i z hz := by + apply (ConeCoordinates.coordinateEquiv (f i) (n+1)).injective + rw [coneDifferential_coordinate] + have hSource : ∀ j : Fin l, j.val < i.val → coneSource K L f n z j = 0 := by + intro j hj + simp only [coneSource,hz j hj,map_zero,Prod.fst_zero] + have hTarget : ∀ j : Fin l, j.val < i.val → coneTarget K L f n z j = 0 := by + intro j hj + simp only [coneTarget,hz j hj,map_zero,Prod.snd_zero] + rw [δ.triangular (n+1) i _ hSource,ε.triangular n i _ hTarget] + apply Prod.ext + · exact (ConeCoordinates.differential_fst (f i) n (z i)).symm + · exact (ConeCoordinates.differential_snd (f i) n (z i)).symm + +/-- The triangular cone model is isomorphic to the native cone, not an assumed cone replacement. -/ +def coneIso : totalCone K L δ ε f hc ≅ complex (coneColumn K L f) (coneTriangular K L δ ε f hc) := + HomologicalComplex.Hom.isoOfComponents (fun n => (coneEquiv K L δ ε f hc n).toModuleIso) (by + intro n m h + change n+1=m at h + subst m + rw [complex_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + change coneEquiv K L δ ε f hc (n+1) + (((totalCone K L δ ε f hc).d n (n+1)).hom + ((coneEquiv K L δ ε f hc n).symm (coneEquiv K L δ ε f hc n z))) = + coneEquiv K L δ ε f hc (n+1) (((totalCone K L δ ε f hc).d n (n+1)).hom z) + rw [LinearEquiv.symm_apply_apply]) + +/-- Quasi-isomorphisms in every column induce a quasi-isomorphism of the actual finite totals. -/ +theorem complexMap_quasiIso [∀ i, QuasiIso (f i)] : QuasiIso (complexMap K L δ ε f hc) := by + apply (LittleFinitistic.quasiIso_iff_mappingCone_acyclic _).mpr + have ha := acyclic (coneColumn K L f) (coneTriangular K L δ ε f hc) + (fun i => (LittleFinitistic.quasiIso_iff_mappingCone_acyclic (f i)).mp inferInstance) + intro n + exact (exactAt_iff_of_quasiIsoAt (coneIso K L δ ε f hc).hom n).mpr (ha n) +end LittleFinitistic.FiniteColumnComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFinitePiSupport.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFinitePiSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c86935e80a9d56a30aafc8757bb71d5e16f0ea0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFinitePiSupport.lean @@ -0,0 +1,29 @@ +import Mathlib.LinearAlgebra.Pi + +namespace OAI +noncomputable section +namespace LittleFinitistic.FinitePiSupport +universe u v w +variable {R : Type u} [Ring R] {ι : Type v} [DecidableEq ι] +variable (V : ι → Type w) [∀ i, AddCommGroup (V i)] [∀ i, Module R (V i)] +variable (i₀ : ι) (hV : ∀ i, i ≠ i₀ → Subsingleton (V i)) + +/-- A product with all but one coordinate zero is exactly its remaining coordinate. -/ +def equivalence : (∀ i, V i) ≃ₗ[R] V i₀ := + LinearEquiv.ofBijective (LinearMap.proj i₀) ⟨by + intro x y h + funext i + by_cases hi : i = i₀ + · subst i + exact h + · exact (hV i hi).elim _ _, by + intro x + refine ⟨fun i => if h : i = i₀ then h.symm ▸ x else 0, ?_⟩ + simp⟩ + +@[simp] theorem equivalence_apply (x : ∀ i, V i) : equivalence (R := R) V i₀ hV x = x i₀ := rfl +end LittleFinitistic.FinitePiSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteTotal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b14f245c3a695e666b9ee0ab70061f2fa3ef224 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteTotal.lean @@ -0,0 +1,62 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFiniteColumnComplex + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.FiniteColumnComplex +universe u +variable {R : Type u} [Ring R] {l : ℕ} +variable (K : Fin l → CochainComplex (ModuleCat.{u} R) ℤ) + +/-- The vertical differential on the finite direct sum of the columns. -/ +def diagonal (n : ℤ) : term K n →ₗ[R] term K (n+1) := + LinearMap.pi (fun i => ((K i).d n (n+1)).hom.comp (LinearMap.proj i)) + +@[simp] theorem diagonal_apply (n : ℤ) (z : term K n) (i : Fin l) : + diagonal K n z i = ((K i).d n (n+1)).hom (z i) := rfl + +theorem diagonal_square (n : ℤ) : (diagonal K (n+1)).comp (diagonal K n) = 0 := by + apply LinearMap.ext + intro z + funext i + exact congrArg (fun f => f.hom (z i)) ((K i).d_comp_d n (n+1) ((n+1)+1)) + +/-- A horizontal differential on signed columns, with its actual square and mixed relation. -/ +structure Horizontal where + d : ∀ n : ℤ, term K n →ₗ[R] term K (n+1) + square : ∀ n, (d (n+1)).comp (d n) = 0 + mixed : ∀ n, (diagonal K (n+1)).comp (d n) + (d (n+1)).comp (diagonal K n) = 0 + strictUpper : ∀ (n : ℤ) (i : Fin l) (z : term K n), + (∀ j : Fin l, j.val < i.val → z j = 0) → d n z i = 0 + +variable (H : Horizontal K) + +/-- The full differential is the sum of the signed vertical and horizontal differentials. -/ +def totalDifferential : Differential K where + d n := diagonal K n + H.d n + square n := by + apply LinearMap.ext + intro z + funext i + have hv := congrArg (fun f : term K n →ₗ[R] term K ((n+1)+1) => f z i) (diagonal_square K n) + have hh := congrArg (fun f : term K n →ₗ[R] term K ((n+1)+1) => f z i) (H.square n) + have hm := congrArg (fun f : term K n →ₗ[R] term K ((n+1)+1) => f z i) (H.mixed n) + simp only [LinearMap.comp_apply,LinearMap.add_apply,LinearMap.zero_apply,Pi.add_apply,Pi.zero_apply] at hv hh hm ⊢ + simp only [map_add,Pi.add_apply] + simp only [diagonal_apply] at hv hh hm ⊢ + rw [hv,hh] + simpa only [zero_add,add_zero] using hm + triangular n i z hz := by + change diagonal K n z i + H.d n z i = _ + rw [H.strictUpper n i z hz,add_zero] + rfl + +def total : CochainComplex (ModuleCat.{u} R) ℤ := complex K (totalDifferential K H) + +theorem total_acyclic (hK : ∀ i, (K i).Acyclic) : (total K H).Acyclic := + acyclic K (totalDifferential K H) hK +end LittleFinitistic.FiniteColumnComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteTotalMaps.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteTotalMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..5641fdc36ed6708b5e27d77977606b226f7b1230 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFiniteTotalMaps.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFiniteTotal + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.FiniteColumnComplex +universe u +variable {R : Type u} [Ring R] {l : ℕ} +variable (K L : Fin l → CochainComplex (ModuleCat.{u} R) ℤ) +variable (δ : Differential K) (ε : Differential L) +variable (f : ∀ i, K i ⟶ L i) + +/-- The degreewise map between the actual finite sums of columns. -/ +def componentMap (n : ℤ) : term K n →ₗ[R] term L n := + LinearMap.pi (fun i => ((f i).f n).hom.comp (LinearMap.proj i)) + +@[simp] theorem componentMap_apply (n : ℤ) (z : term K n) (i : Fin l) : + componentMap K L f n z i = ((f i).f n).hom (z i) := rfl + +/-- A compatible family of column maps gives an actual map of total complexes. -/ +def complexMap (hc : ∀ n, + (ε.d n).comp (componentMap K L f n) = (componentMap K L f (n+1)).comp (δ.d n)) : + complex K δ ⟶ complex L ε where + f n := ModuleCat.ofHom (componentMap K L f n) + comm' n m h := by + change n+1=m at h + subst m + rw [complex_d,complex_d] + apply ModuleCat.hom_ext + exact hc n +end LittleFinitistic.FiniteColumnComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstBlockTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstBlockTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..d27c73e6713d251d7574550e943daf8375bda779 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstBlockTensor.lean @@ -0,0 +1,102 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockModules +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedCongruence + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation.FirstBlockTensor +universe u +variable (k L R O T Z : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable [AddCommGroup O] [Module k O] [Module R O] [Module Lᵐᵒᵖ O] + [IsScalarTower k R O] [IsScalarTower k Lᵐᵒᵖ O] [SMulCommClass R Lᵐᵒᵖ O] +variable [AddCommGroup T] [Module k T] [Module L T] [Module Rᵐᵒᵖ T] + [IsScalarTower k L T] [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] +variable [AddCommGroup Z] [Module k Z] [Module L Z] [IsScalarTower k L Z] + +abbrev source := LeftTensor k (L × R) (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) +abbrev target := BlockModule.Second k L R (LeftTensor k L R O Z) + +def forward : source k L R O T Z →ₗ[k] target k L R O Z := + BalancedTensor.lift ((BalancedTensor.mk k L O Z).compl₁₂ + (show OffDiagonal O T →ₗ[k] O from LinearMap.fst k O T) + (show BlockModule.First k L R Z →ₗ[k] Z from LinearMap.id)) (by + intro d x z + exact BalancedTensor.balance (k := k) (A := L) (M := O) (N := Z) d.1 x.1 (show Z from z)) + +def inverse : target k L R O Z →ₗ[k] source k L R O T Z := + BalancedTensor.lift ((BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z)).compl₁₂ + (show O →ₗ[k] OffDiagonal O T from LinearMap.inl k O T) + (show Z →ₗ[k] BlockModule.First k L R Z from LinearMap.id)) (by + intro a o z + have h := BalancedTensor.balance (k := k) (A := L × R) (M := OffDiagonal O T) + (N := BlockModule.First k L R Z) (a,0) (o,0) z + change BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) + (MulOpposite.op a • o,(0:Rᵐᵒᵖ) • (0:T)) (show BlockModule.First k L R Z from z) = + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) (o,0) + (show BlockModule.First k L R Z from a • z) at h + rw [smul_zero] at h + exact h) + +omit [Algebra k L] [Algebra k R] [Module R O] [IsScalarTower k R O] + [IsScalarTower k Lᵐᵒᵖ O] [SMulCommClass R Lᵐᵒᵖ O] [Module L T] + [IsScalarTower k L T] [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] + [IsScalarTower k L Z] in +theorem other_block_zero (t : T) (z : BlockModule.First k L R Z) : + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) (0,t) z = 0 := by + have h := BalancedTensor.balance (k := k) (A := L × R) (M := OffDiagonal O T) + (N := BlockModule.First k L R Z) (0,1) (0,t) z + change BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) + ((0:Lᵐᵒᵖ) • (0:O),(1:Rᵐᵒᵖ) • t) z = + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) (0,t) ((0:L) • (show Z from z)) at h + erw [zero_smul, one_smul, zero_smul, map_zero] at h + exact h + +omit [Module R O] [IsScalarTower k R O] [IsScalarTower k Lᵐᵒᵖ O] + [SMulCommClass R Lᵐᵒᵖ O] [Module L T] [IsScalarTower k L T] + [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] [IsScalarTower k L Z] in +theorem inverse_forward (x : source k L R O T Z) : + inverse k L R O T Z (forward k L R O T Z x) = x := by + let F := (inverse k L R O T Z).comp (forward k L R O T Z) + have h : F = LinearMap.id := by + apply BalancedTensor.ext + intro x z + change BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) (x.1,0) z = + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z) x z + let q := (BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.First k L R Z)).flip z + have hx : x = (x.1,0) + (0,x.2) := Prod.ext (add_zero _).symm (zero_add _).symm + exact ((congrArg q hx).trans ((q.map_add _ _).trans + ((congrArg (q (x.1,0) + ·) (other_block_zero k L R O T Z x.2 z)).trans (add_zero _)))).symm + exact congrArg (fun f => f x) h + +omit [Module R O] [IsScalarTower k R O] [IsScalarTower k Lᵐᵒᵖ O] + [SMulCommClass R Lᵐᵒᵖ O] [Module L T] [IsScalarTower k L T] + [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] [IsScalarTower k L Z] in +theorem forward_inverse (x : target k L R O Z) : + forward k L R O T Z (inverse k L R O T Z x) = x := by + have h : (forward k L R O T Z).comp (inverse k L R O T Z) = LinearMap.id := by + apply BalancedTensor.ext + intro o z + rfl + exact congrArg (fun f => f x) h + +/-- Tensor on the first block selects O and has its actual output on the second block. -/ +def equivalence : source k L R O T Z ≃ₗ[L × R] target k L R O Z where + toFun := forward k L R O T Z + invFun := inverse k L R O T Z + left_inv := inverse_forward k L R O T Z + right_inv := forward_inverse k L R O T Z + map_add' := (forward k L R O T Z).map_add + map_smul' d x := by + let F := forward k L R O T Z + have h : F.comp (LeftTensor.action k (L × R) (L × R) (OffDiagonal O T) + (BlockModule.First k L R Z) d) = + (Algebra.lsmul k k (target k L R O Z) d).comp F := by + apply BalancedTensor.ext + intro x z + rfl + exact congrArg (fun f => f x) h + +end LittleFinitistic.OrdinarySimulation.FirstBlockTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstBlockTotal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstBlockTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..66e588a1ecaf270357569d75dc44a84b843b9b9d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstBlockTotal.lean @@ -0,0 +1,113 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockTensorTerms +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTotal + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.BlockTensor +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ) +variable (T : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} L) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +open BimoduleComplexTensor + +def firstTotalEquiv (n : ℤ) : + totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n ≃ₗ[L × R] + BlockModule.Second k L R (totalTerm k R L O Z p n) := + (LinearEquiv.piCongrRight (fun i => firstTermEquiv k L R O T Z (p i) (n + -(p i)))).trans + (show (∀ i : Fin l, BlockModule.Second k L R (term k R L O Z (p i) (n + -(p i)))) ≃ₗ[L × R] + BlockModule.Second k L R (totalTerm k R L O Z p n) from LinearEquiv.refl _ _) + +@[simp] theorem firstTotalEquiv_apply (n : ℤ) + (z : totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n) + (i : Fin l) : firstTotalEquiv k L R O T Z p n z i = + firstTermEquiv k L R O T Z (p i) (n + -(p i)) (z i) := rfl + +theorem first_entry (n : ℤ) (i j : Fin l) : + (firstTermEquiv k L R O T Z (p j) ((n+1) + -(p j))).toLinearMap.comp + (entry k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n i j) = + (BlockModule.secondMap k L R (entry k R L O Z p n i j)).comp + (firstTermEquiv k L R O T Z (p i) (n + -(p i))).toLinearMap := by + unfold entry + split_ifs with h + · have he : n + -(p i) = (n+1) + -(p j) := by omega + have ht : (ProductModules.firstInflation L R).map (eqToHom (congrArg Z.X he)) = + eqToHom (congrArg (BlockModule.firstComplex L R Z).X he) := by + generalize n + -(p i) = q at he ⊢ + generalize (n+1) + -(p j) = q' at he ⊢ + subst q' + simp only [eqToHom_refl,CategoryTheory.Functor.map_id] + rfl + have hh := firstTermEquiv_map k L R O T Z (O.d (p i) (p j)) (T.d (p i) (p j)) (eqToHom (congrArg Z.X he)) + rw [ht,← OffDiagonal.complex_d_all] at hh + exact hh + · apply LinearMap.ext + intro x + change firstTermEquiv k L R O T Z (p j) ((n+1) + -(p j)) 0 = 0 + exact (firstTermEquiv k L R O T Z (p j) ((n+1) + -(p j))).map_zero + +theorem first_vertical (n : ℤ) (i : Fin l) : + (firstTermEquiv k L R O T Z (p i) ((n+1) + -(p i))).toLinearMap.comp + (map k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) (𝟙 _) + ((BlockModule.firstComplex L R Z).d (n + -(p i)) ((n+1) + -(p i)))) = + (BlockModule.secondMap k L R (map k R L O Z (𝟙 _) (Z.d (n + -(p i)) ((n+1) + -(p i))))).comp + (firstTermEquiv k L R O T Z (p i) (n + -(p i))).toLinearMap := by + exact firstTermEquiv_map k L R O T Z (𝟙 (O.X (p i))) (𝟙 (T.X (p i))) (Z.d _ _) + +theorem first_differential (n : ℤ) + (z : totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n) : + firstTotalEquiv k L R O T Z p (n+1) + (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n z) = + differential k R L O Z p n (firstTotalEquiv k L R O T Z p n z) := by + funext j + change firstTermEquiv k L R O T Z (p j) ((n+1) + -(p j)) + (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n z j) = + differential k R L O Z p n (firstTotalEquiv k L R O T Z p n z) j + simp only [differential, + LinearMap.pi_apply,LinearMap.add_apply,LinearMap.comp_apply,LinearMap.proj_apply, + LinearMap.sum_apply,map_add,map_sum] + apply congrArg₂ (· + ·) + · change firstTermEquiv k L R O T Z (p j) ((n+1) + -(p j)) + ((((-(p j)).negOnePow : ℤ)) • + (map k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) (𝟙 _) + ((BlockModule.firstComplex L R Z).d (n + -(p j)) ((n+1) + -(p j))) (z j))) = + (((-(p j)).negOnePow : ℤ)) • + (map k R L O Z (𝟙 _) (Z.d (n + -(p j)) ((n+1) + -(p j)))) + (firstTermEquiv k L R O T Z (p j) (n + -(p j)) (z j)) + rw [map_zsmul] + congr 1 + exact congrArg (fun f => f (z j)) (first_vertical k L R O T Z p n j) + · erw [LinearMap.sum_apply] + apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun f => f (z i)) (first_entry k L R O T Z p n i j) + +/-- Actual tensor with the off-diagonal complex on a first-block input is the second-block O-total. -/ +def firstTotalIso : + total k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p hp ≅ + BlockModule.secondComplex L R (total k R L O Z p hp) := + HomologicalComplex.Hom.isoOfComponents (fun n => (firstTotalEquiv k L R O T Z p n).toModuleIso) (by + intro n m h + change n+1=m at h + subst m + have h₁ : (total k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p hp).d n (n+1) = + ModuleCat.ofHom (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n) := + CochainComplex.of_d (fun n => ModuleCat.of (L × R) (totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n)) + (fun n => ModuleCat.ofHom (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.firstComplex L R Z) p n)) n + have h₂ : (total k R L O Z p hp).d n (n+1) = ModuleCat.ofHom (differential k R L O Z p n) := + CochainComplex.of_d (fun n => ModuleCat.of R (totalTerm k R L O Z p n)) + (fun n => ModuleCat.ofHom (differential k R L O Z p n)) n + change _ ≫ (ProductModules.secondInflation L R).map ((total k R L O Z p hp).d n (n+1)) = _ + rw [h₁,h₂] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (first_differential k L R O T Z p n z).symm) +end LittleFinitistic.OrdinarySimulation.BlockTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstComponentExact.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstComponentExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c509453125f458c01a0239da77211500cbbc2f0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstComponentExact.lean @@ -0,0 +1,56 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductProjective +import Mathlib.Algebra.Homology.ShortComplex.ExactFunctor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.ProductModules +universe u +variable (L R : Type u) [Ring L] [Ring R] + +instance firstFunctor_additive : (firstFunctor.{u,u} L R).Additive where + map_add := by intros; rfl + +/-- Exactness on the first central-idempotent component follows by projecting a preimage. -/ +theorem firstFunctor_mapsExact (K : ShortComplex (ModuleCat.{u} (L × R))) (hK : K.Exact) : + (K.map (firstFunctor L R)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] at hK ⊢ + intro y hy + obtain ⟨x,hx⟩ := hK y.val (congrArg Subtype.val hy) + refine ⟨⟨((1,0) : L × R) • x,?_⟩,?_⟩ + · change ((1,0) : L × R) • (((1,0) : L × R) • x) = ((1,0) : L × R) • x + rw [← mul_smul] + have h : ((1,0) : L × R) * (1,0) = (1,0) := by ext <;> simp + rw [h] + · apply Subtype.ext + change K.f.hom (((1,0) : L × R) • x) = y.val + rw [K.f.hom.map_smul,hx,y.property] + +instance firstFunctor_preservesHomology : (firstFunctor.{u,u} L R).PreservesHomology := + Functor.preservesHomology_of_map_exact _ (firstFunctor_mapsExact L R) + +instance firstFunctor_preservesFiniteLimits : PreservesFiniteLimits (firstFunctor.{u,u} L R) := + Functor.preservesFiniteLimits_of_preservesHomology _ + +instance firstFunctor_preservesFiniteColimits : PreservesFiniteColimits (firstFunctor.{u,u} L R) := + Functor.preservesFiniteColimits_of_preservesHomology _ + +/-- Taking the first component of an inflated module recovers the original module. -/ +def firstInflationComponentEquiv (M : ModuleCat.{u} L) : + firstObject L R ((firstInflation L R).obj M) ≃ₗ[L] M where + toFun x := x.val + invFun x := ⟨x, one_smul L x⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- This recovery is natural in every module and linear map. -/ +def firstInflationComponentIso : firstInflation.{u,u} L R ⋙ firstFunctor L R ≅ 𝟭 (ModuleCat.{u} L) := + NatIso.ofComponents (fun M => (firstInflationComponentEquiv L R M).toModuleIso) + (by intros; rfl) +end LittleFinitistic.ProductModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstDerivedCompatibility.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstDerivedCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ee71bf546f2258413a68dd5f64fcbcdcb5008fe --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstDerivedCompatibility.lean @@ -0,0 +1,69 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockDerived +import Mathlib.Algebra.Homology.DerivedCategory.ExactFunctor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BlockModule +universe u +variable (L R : Type u) [Ring L] [Ring R] + +/-- First-block inflation is exact for arbitrary, possibly noncommutative rings. -/ +instance firstInflation_preservesFiniteLimits : + PreservesFiniteLimits (ProductModules.firstInflation.{u,u} L R) := by + let := RestrictionHomology.preservesHomology (RingHom.fst L R) + exact Functor.preservesFiniteLimits_of_preservesHomology _ + +instance firstInflation_preservesFiniteColimits : + PreservesFiniteColimits (ProductModules.firstInflation.{u,u} L R) := by + let := RestrictionHomology.preservesHomology (RingHom.fst L R) + exact Functor.preservesFiniteColimits_of_preservesHomology _ + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} L)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (L × R))] + +instance derivedFirst_lifting : Localization.Lifting DerivedCategory.Q + (HomologicalComplex.quasiIso (ModuleCat.{u} L) (.up ℤ)) + (firstComplexFunctor L R ⋙ DerivedCategory.Q) (derivedFirst L R) := + ⟨derivedFirstComparison L R⟩ + +/-- The ordinary localization model is naturally the exact derived inflation. -/ +def derivedFirstIso : derivedFirst L R ≅ (ProductModules.firstInflation L R).mapDerivedCategory := + Localization.liftNatIso DerivedCategory.Q + (HomologicalComplex.quasiIso (ModuleCat.{u} L) (.up ℤ)) + (firstComplexFunctor L R ⋙ DerivedCategory.Q) + (firstComplexFunctor L R ⋙ DerivedCategory.Q) + (derivedFirst L R) (ProductModules.firstInflation L R).mapDerivedCategory (Iso.refl _) + +/-- The comparison agrees with both specified localization comparison maps. -/ +@[reassoc (attr := simp)] +theorem derivedFirstIso_hom_app_Q (Z : CochainComplex (ModuleCat.{u} L) ℤ) : + (derivedFirstIso L R).hom.app (DerivedCategory.Q.obj Z) ≫ + (ProductModules.firstInflation L R).mapDerivedCategoryFactors.hom.app Z = + (derivedFirstComparison L R).hom.app Z := by + simp only [derivedFirstIso, Localization.liftNatIso_hom, + Localization.liftNatTrans_app, Iso.refl_hom, NatTrans.id_app, Category.id_comp] + change ((derivedFirstComparison L R).hom.app Z ≫ + (ProductModules.firstInflation L R).mapDerivedCategoryFactors.inv.app Z) ≫ + (ProductModules.firstInflation L R).mapDerivedCategoryFactors.hom.app Z = _ + simp + +/-- Transport the coherent integer shift structure of the exact derived functor. -/ +instance derivedFirst_commShift : (derivedFirst L R).CommShift ℤ := + Functor.CommShift.ofIso (derivedFirstIso L R).symm ℤ + +instance derivedFirstIso_inv_commShift : NatTrans.CommShift (derivedFirstIso L R).inv ℤ := + Functor.CommShift.ofIso_compatibility (derivedFirstIso L R).symm ℤ + +instance derivedFirstIso_hom_commShift : NatTrans.CommShift (derivedFirstIso L R).hom ℤ := by + let : NatTrans.CommShift (derivedFirstIso L R).symm.hom ℤ := + derivedFirstIso_inv_commShift L R + exact NatTrans.CommShift.of_iso_inv (derivedFirstIso L R).symm ℤ + +instance derivedFirst_isTriangulated : (derivedFirst L R).IsTriangulated := + Functor.isTriangulated_of_iso (derivedFirstIso L R).symm +end LittleFinitistic.BlockModule + +end + +end OAI