Concrete coordinates, quadratic testers, and the self-Gram form
Lax342547.ConcreteGeometry · concepts/Lax342547/ConcreteGeometry.lean · lax-342547
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Lemma
The coordinate realization of §2.3. The three common blocks are indexed by 0 (S), 1 (#), and 2 (Z). Tester pairs use coordinates 2ρ and 2ρ+1 in zero-based indexing. The self-Gram matrix has the ordered tester part and the selector-dependent # part; it has no Z entries.
Concept map
Evidence
Lean source view on GitHub
| 1 | import Lax342547.TagGeometry |
| 2 | import Lax342547.GradientForm |
| 3 | import Lean.Elab.Tactic.Omega |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: Concrete coordinates, quadratic testers, and the self-Gram form |
| 8 | type: lemma |
| 9 | --- |
| 10 | The coordinate realization of §2.3. The three common blocks are indexed |
| 11 | by 0 (S), 1 (#), and 2 (Z). Tester pairs use coordinates 2ρ and 2ρ+1 |
| 12 | in zero-based indexing. The self-Gram matrix has the ordered tester |
| 13 | part and the selector-dependent # part; it has no Z entries. |
| 14 | -/ |
| 15 | |
| 16 | namespace Lax342547.ConcreteGeometry |
| 17 | |
| 18 | open Lax342547.MomentSpace Lax342547.TagGeometry |
| 19 | |
| 20 | abbrev Coordinate (k n b degree : ℕ) := SelectorCoordinates b degree × Option (Base k n) |
| 21 | noncomputable instance (k n b degree : ℕ) : DecidableEq (Coordinate k n b degree) := Classical.decEq _ |
| 22 | abbrev Vector (k n b degree : ℕ) := Coordinate k n b degree → Binary |
| 23 | abbrev Moment (k n b degree : ℕ) := Matrix (Coordinate k n b degree) (Coordinate k n b degree) Binary |
| 24 | |
| 25 | def ordinary {k n : ℕ} (d t : Tag k) (i : Fin n) : Base k n := Sum.inl ((d, t), i) |
| 26 | def shared {k n : ℕ} (i : Fin n) : Base k n := Sum.inr (0, i) |
| 27 | def sharp {k n : ℕ} (i : Fin n) : Base k n := Sum.inr (1, i) |
| 28 | def free {k n : ℕ} (i : Fin n) : Base k n := Sum.inr (2, i) |
| 29 | |
| 30 | def emptySelector (b degree : ℕ) : SelectorCoordinates b degree := ⟨∅, Nat.zero_le _⟩ |
| 31 | def bitSelector {b degree : ℕ} (h : 1 ≤ degree) (a : Fin b) : SelectorCoordinates b degree := |
| 32 | ⟨{a}, by simpa using h⟩ |
| 33 | |
| 34 | def pairLeft {n r : ℕ} (h : 2 * r ≤ n) (ρ : Fin r) : Fin n := ⟨2 * ρ.val, by omega⟩ |
| 35 | def pairRight {n r : ℕ} (h : 2 * r ≤ n) (ρ : Fin r) : Fin n := ⟨2 * ρ.val + 1, by omega⟩ |
| 36 | |
| 37 | def matrixEntry {I : Type} (i j : I) : Matrix I I Binary →ₗ[Binary] Binary where |
| 38 | toFun w := w i j |
| 39 | map_add' _ _ := rfl |
| 40 | map_smul' _ _ := rfl |
| 41 | |
| 42 | def blockTester {k n b degree r : ℕ} (h : 2 * r ≤ n) (c : Fin n → Base k n) : |
| 43 | Moment k n b degree →ₗ[Binary] Binary := |
| 44 | ∑ ρ : Fin r, matrixEntry (emptySelector b degree, some (c (pairLeft h ρ))) |
| 45 | (emptySelector b degree, some (c (pairRight h ρ))) |
| 46 | |
| 47 | def etaO {k n b degree r : ℕ} (h : 2 * r ≤ n) : Moment k n b degree →ₗ[Binary] Binary := |
| 48 | ∑ d : Tag k, ∑ t : Tag k, blockTester h (ordinary d t) |
| 49 | |
| 50 | def eta {k n b degree r : ℕ} (h : 2 * r ≤ n) : Moment k n b degree →ₗ[Binary] Binary := |
| 51 | etaO h + blockTester h shared |
| 52 | |
| 53 | def blockForm {k n b degree r : ℕ} (h : 2 * r ≤ n) (c : Fin n → Base k n) : |
| 54 | LinearMap.BilinForm Binary (Vector k n b degree) := |
| 55 | ∑ ρ : Fin r, GradientForm.rankOne |
| 56 | (LinearMap.proj (emptySelector b degree, some (c (pairLeft h ρ)))) |
| 57 | (LinearMap.proj (emptySelector b degree, some (c (pairRight h ρ)))) |
| 58 | |
| 59 | def testerForm {k n b degree r : ℕ} (h : 2 * r ≤ n) : |
| 60 | LinearMap.BilinForm Binary (Vector k n b degree) := |
| 61 | (∑ d : Tag k, ∑ t : Tag k, blockForm h (ordinary d t)) + blockForm h shared |
| 62 | |
| 63 | def sharpForm {k n b degree : ℕ} (h : 1 ≤ degree) |
| 64 | (M : Fin b → Matrix (Fin n) (Fin n) Binary) : |
| 65 | LinearMap.BilinForm Binary (Vector k n b degree) := |
| 66 | ∑ a : Fin b, ∑ i : Fin n, ∑ j : Fin n, M a i j • |
| 67 | (GradientForm.rankOne (LinearMap.proj (bitSelector h a, some (sharp i))) |
| 68 | (LinearMap.proj (emptySelector b degree, some (sharp j))) + |
| 69 | GradientForm.rankOne (LinearMap.proj (emptySelector b degree, some (sharp i))) |
| 70 | (LinearMap.proj (bitSelector h a, some (sharp j)))) |
| 71 | |
| 72 | noncomputable def selfGram {k n b degree r : ℕ} (hr : 2 * r ≤ n) (hd : 1 ≤ degree) |
| 73 | (M : Fin b → Matrix (Fin n) (Fin n) Binary) : Moment k n b degree := |
| 74 | (testerForm hr + sharpForm hd M).toMatrix' |
| 75 | |
| 76 | def matrixPair {I : Type} [Fintype I] (E : Matrix I I Binary) : |
| 77 | Matrix I I Binary →ₗ[Binary] Binary := |
| 78 | ∑ i, ∑ j, E i j • matrixEntry i j |
| 79 | |
| 80 | /-- The action on all coefficient vectors induced by a common Z-coordinate change. -/ |
| 81 | def changeZ {k n b degree : ℕ} (A : Matrix (Fin n) (Fin n) Binary) : |
| 82 | Vector k n b degree →ₗ[Binary] Vector k n b degree where |
| 83 | toFun v c := match c.2 with |
| 84 | | some (Sum.inr (q, i)) => if q = 2 then ∑ j, A i j * v (c.1, some (free j)) else v c |
| 85 | | _ => v c |
| 86 | map_add' v w := by |
| 87 | ext ⟨S, c⟩ |
| 88 | cases c with |
| 89 | | none => rfl |
| 90 | | some c => |
| 91 | cases c with |
| 92 | | inl c => rfl |
| 93 | | inr c => |
| 94 | rcases c with ⟨q, i⟩ |
| 95 | by_cases hq : q = 2 <;> simp [hq, mul_add, Finset.sum_add_distrib] |
| 96 | map_smul' a v := by |
| 97 | ext ⟨S, c⟩ |
| 98 | cases c with |
| 99 | | none => rfl |
| 100 | | some c => |
| 101 | cases c with |
| 102 | | inl c => rfl |
| 103 | | inr c => |
| 104 | rcases c with ⟨q, i⟩ |
| 105 | by_cases hq : q = 2 <;> simp [hq, Finset.mul_sum, mul_left_comm] |
| 106 | |
| 107 | axiom selfGram_moments {k n b degree r : ℕ} (hr : 2 * r ≤ n) (hd : 1 ≤ degree) |
| 108 | (M : Fin b → Matrix (Fin n) (Fin n) Binary) (w : Moment k n b degree) |
| 109 | (hw : w ∈ momentSpace (selectorEval (degree := degree)) Set.univ) : |
| 110 | matrixPair (selfGram hr hd M) w = eta hr w |
| 111 | |
| 112 | axiom selfGram_changeZ {k n b degree r : ℕ} (hr : 2 * r ≤ n) (hd : 1 ≤ degree) |
| 113 | (M : Fin b → Matrix (Fin n) (Fin n) Binary) (A : Matrix (Fin n) (Fin n) Binary) : |
| 114 | (changeZ A).toMatrix'.transpose * selfGram (k := k) (b := b) hr hd M * |
| 115 | (changeZ A).toMatrix' = selfGram hr hd M |
| 116 | |
| 117 | end Lax342547.ConcreteGeometry |
| 118 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments