While this submission is a draft, it cannot be used by other submissions.

Finite spaces and maps used by the construction

Lax793645.ConstructionData · concepts/Lax793645/ConstructionData.lean · lax-793645

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    The construction uses binary component matrices on an odd cycle, a quadratic frame at each component, and finite laws of queries at those frames. This module gives the concrete types used by the individual statements. The ambient dimension in the frame coordinates is twice the hyperbolic dimension parameter.

    Concept map
    1 concept
    100%
    DefinitionThis conceptDescendants are omitted for concepts with more than 10 descendants.

    Lean source view on GitHub

    1/-
    2Adapted from OpenAI, openai/math, commit fd4aeeb2ee4fc729c18d98444fed42fd0529eeeb
    3(Apache-2.0), and the quadratic-frame construction in this submission.
    4The data have been collected under a public namespace for the paper's statements.
    5See LICENSE and NOTICE for the source history.
    6-/
    7import Mathlib
    8
    9/-!
    10---
    11title: Finite spaces and maps used by the construction
    12type: definition
    13---
    14The construction uses binary component matrices on an odd cycle, a quadratic frame at
    15each component, and finite laws of queries at those frames. This module gives the
    16concrete types used by the individual statements. The ambient dimension in the frame
    17coordinates is twice the hyperbolic dimension parameter.
    18-/
    19
    20set_option autoImplicit false
    21set_option maxHeartbeats 1500000
    22
    23section
    24namespace Lax793645.ConstructionData.Binary
    25noncomputable section
    26namespace HadwigerCounterexample
    27open scoped BigOperators
    28open Matrix
    29abbrev F := ZMod 2
    30
    31abbrev Vec (I : Type) := I → F
    32
    33abbrev Mat (I J : Type) := Matrix I J F
    34
    35abbrev Space (V : Type) [AddCommGroup V] [Module F V] := Submodule F V
    36
    37theorem char_two {V : Type*} [AddCommGroup V] [Module F V] (x : V) : x+x=0 :=
    38 ZModModule.add_self x
    39
    40section Linear
    41variable {I J K L R S : Type} [Fintype I] [Fintype J]
    42def evmat (M : Mat I J) (x : Vec I) (y : Vec J) := dotProduct x (M *ᵥ y)
    43
    44def mpair (M : Mat I J) : Mat I J →ₗ[F] F where
    45 toFun A := ∑ i, ∑ j, M i j * A i j
    46 map_add' A B := by simp only [Matrix.add_apply,mul_add,Finset.sum_add_distrib]
    47 map_smul' b A := by
    48 simp only [Matrix.smul_apply, smul_eq_mul,RingHom.id_apply,Finset.mul_sum,mul_left_comm b]
    49
    50theorem mpair_comm (M A : Mat I J) : mpair M A = mpair A M := by
    51 dsimp [mpair]
    52 simp only [mul_comm]
    53
    54theorem mpair_outer (M : Mat I J) (x : Vec I) (y : Vec J) :
    55 mpair M (vecMulVec x y) = evmat M x y := by
    56 dsimp [mpair,evmat,mulVec,dotProduct,vecMulVec]
    57 simp only [Finset.mul_sum,mul_left_comm]
    58
    59/-- Apply frame maps to the two factors of every tensor. -/
    60def liftM (P : Mat K I) (Q : Mat L J) : Mat I J →ₗ[F] Mat K L where
    61 toFun A := P* A* Qᵀ
    62 map_add' A B := by rw [Matrix.mul_add,Matrix.add_mul]
    63 map_smul' b A := by simp only [Matrix.mul_smul, Matrix.smul_mul,RingHom.id_apply]
    64
    65theorem liftM_def (P : Mat K I) (Q : Mat L J) (A : Mat I J) :
    66 liftM P Q A = P* A* Qᵀ := rfl
    67
    68theorem liftM_outer (P : Mat K I) (Q : Mat L J) (x : Vec I) (y : Vec J) :
    69 liftM P Q (vecMulVec x y) = vecMulVec (P *ᵥ x) (Q *ᵥ y) := by
    70 rw [liftM_def,mul_vecMulVec,vecMulVec_mul,vecMul_transpose]
    71
    72variable [Fintype K] [Fintype L]
    73theorem liftM_comp (P : Mat K I) (Q : Mat L J) (P' : Mat R K) (Q' : Mat S L)
    74 (A : Mat I J) :
    75 liftM P' Q' (liftM P Q A) = liftM (P'* P) (Q'* Q) A := by
    76 simp only [liftM_def, Matrix.transpose_mul,Matrix.mul_assoc]
    77
    78theorem mpair_liftM (P : Mat K I) (Q : Mat L J) (M : Mat K L) (A : Mat I J) :
    79 mpair M (liftM P Q A) = mpair (liftM Pᵀ Qᵀ M) A := by
    80
    81 simp only [liftM_def, mpair, transpose_transpose, LinearMap.coe_mk,AddHom.coe_mk,
    82 Matrix.mul_apply, Finset.sum_mul, Finset.mul_sum, transpose_apply]
    83
    84 conv_lhs =>
    85 arg 2
    86 intro k
    87 rw [Finset.sum_comm]
    88 rw [Finset.sum_comm]
    89
    90 conv_rhs => rw [Finset.sum_comm]
    91 refine Finset.sum_congr rfl fun j _ => ?_
    92 conv_lhs =>
    93 arg 2
    94 intro k
    95 rw [Finset.sum_comm]
    96 rw [Finset.sum_comm]
    97 refine Finset.sum_congr rfl fun i _ => ?_
    98 rw [Finset.sum_comm]
    99 refine Finset.sum_congr rfl fun l _ => Finset.sum_congr rfl fun k _ => ?_
    100 ring
    101
    102theorem mat_left_inv [DecidableEq I] {P : Mat K I} (hp : Function.Injective P.mulVec) :
    103 ∃ Q : Mat I K, Q* P = 1 := by
    104 classical
    105 have hp' : Function.Injective (P.mulVecLin) := hp
    106 obtain ⟨f,hf⟩ := P.mulVecLin.exists_leftInverse_of_injective (LinearMap.ker_eq_bot.mpr hp')
    107 refine ⟨LinearMap.toMatrix' f, ?_⟩
    108 apply Matrix.toLin'.injective
    109 rw [Matrix.toLin'_mul]
    110 simp only [Matrix.toLin'_one]
    111 change ((LinearMap.toMatrix').symm _) ∘ₗ _ = _
    112 rw [LinearEquiv.symm_apply_apply]
    113 exact hf
    114
    115theorem liftM_inj {P : Mat K I} {Q : Mat L J} (hp : Function.Injective P.mulVec)
    116 (hq : Function.Injective Q.mulVec) : Function.Injective (liftM P Q) := by
    117 classical
    118 obtain ⟨P', hP⟩ := mat_left_inv hp
    119 obtain ⟨Q', hQ⟩ := mat_left_inv hq
    120 intro A B hab
    121 have hh := congrArg (liftM P' Q') hab
    122 rw [liftM_comp,liftM_comp,hP,hQ] at hh
    123 simpa only [liftM_def, Matrix.one_mul, Matrix.transpose_one,
    124 Matrix.mul_one] using hh
    125
    126end Linear
    127end HadwigerCounterexample
    128end
    129end Lax793645.ConstructionData.Binary
    130end
    131
    132section
    133namespace Lax793645.ConstructionData.Binary
    134noncomputable section
    135namespace HadwigerCounterexample
    136open Matrix Module Submodule LinearMap Function
    137abbrev dim (V : Type) [AddCommGroup V] [Module F V] := finrank F V
    138
    139abbrev rk {V W : Type} [AddCommGroup V] [Module F V]
    140 [AddCommGroup W] [Module F W] (f : V →ₗ[F] W) := dim (LinearMap.range f)
    141
    142variable {V W U V' : Type}
    143variable [AddCommGroup V] [Module F V] [AddCommGroup W] [Module F W]
    144variable [AddCommGroup U] [Module F U] [AddCommGroup V'] [Module F V']
    145end HadwigerCounterexample
    146end
    147end Lax793645.ConstructionData.Binary
    148end
    149
    150section
    151namespace Lax793645.ConstructionData.Binary
    152noncomputable section
    153namespace HadwigerCounterexample
    154open Matrix Module LinearMap Function
    155section Generic
    156variable {V W U : Type}
    157 [AddCommGroup V] [Module F V] [AddCommGroup W] [Module F W]
    158 [AddCommGroup U] [Module F U]
    159theorem rk_comp_le_right [FiniteDimensional F W] (f : V →ₗ[F] W) (g : W →ₗ[F] U) :
    160 rk (g ∘ₗ f) ≤ rk f := by
    161 dsimp only [rk]; rw [LinearMap.range_comp]
    162 exact Submodule.finrank_map_le _ _
    163
    164end Generic
    165variable {I J K : Type}
    166variable [Fintype I] [Fintype J]
    167omit [Fintype I] in
    168theorem rank_cast (P : Mat I J) : P.rank = rk P.mulVecLin := rfl
    169
    170abbrev colSp (P : Mat I J) := range P.mulVecLin
    171
    172/-- A coordinate set of basis vectors of a subspace arranged as columns. -/
    173def pack (S : Space (Vec I)) : Mat I (Fin (dim S)) :=
    174 let E : Vec (Fin (dim S)) ≃ₗ[F] S := LinearEquiv.ofFinrankEq (Vec (Fin (dim S))) S (by
    175 rw [finrank_pi]; simp)
    176 LinearMap.toMatrix' (S.subtype ∘ₗ E.toLinearMap)
    177
    178theorem pack_eq {S : Space (Vec I)} :
    179 ∃ E : Vec (Fin (dim S)) ≃ₗ[F] S, (pack S).mulVecLin = S.subtype ∘ₗ E.toLinearMap := by
    180 unfold pack
    181 refine ⟨LinearEquiv.ofFinrankEq _ _ (by rw [finrank_pi]; simp),?_⟩
    182 rw [← toLin'_apply']
    183 exact LinearEquiv.symm_apply_apply _ _
    184
    185theorem pack_inj (S : Space (Vec I)) : Function.Injective (pack S).mulVec := by
    186 rw [← Matrix.coe_mulVecLin]
    187 obtain ⟨E,he⟩ := pack_eq (S:=S)
    188 rw [he]
    189 exact Subtype.val_injective.comp E.injective
    190
    191theorem colSp_pack (S : Space (Vec I)) : colSp (pack S) = S := by
    192 obtain ⟨E,he⟩ := pack_eq (S:=S)
    193 rw [colSp,he,LinearMap.range_comp]
    194 simp
    195
    196omit [Fintype I] in
    197theorem toMat_map [DecidableEq J] (f : Vec J →ₗ[F] Vec I) :
    198 (LinearMap.toMatrix' f).mulVecLin = f := by
    199 rw [← toLin'_apply']; exact LinearEquiv.symm_apply_apply _ _
    200
    201end HadwigerCounterexample
    202end
    203end Lax793645.ConstructionData.Binary
    204end
    205
    206section
    207namespace Lax793645.ConstructionData.Frames
    208open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    209open Matrix Submodule Module
    210open scoped BigOperators
    211noncomputable section
    212variable {S T : Type} [Fintype S] [Fintype T]
    213/-- A base-coordinate slice of a vector in the product coordinate space. -/
    214def selectorSlice (i : T) : Vec (S × T) →ₗ[F] Vec S where
    215 toFun x a := x (a,i)
    216 map_add' _ _ := rfl
    217 map_smul' _ _ := rfl
    218
    219end
    220end Lax793645.ConstructionData.Frames
    221end
    222
    223section
    224namespace Lax793645.ConstructionData.Frames.CycleGeometry
    225open scoped BigOperators
    226noncomputable section
    227abbrev Tag := Fin
    228
    229abbrev Comp (g : ℕ) :=
    230 {e : Tag g × Tag g // e.1 < e.2 ∧ (SimpleGraph.cycleGraph g).Adj e.1 e.2}
    231
    232def degree (g : ℕ) := min 2 (g-1)
    233
    234def edge {g : ℕ} (l d : Tag g) (h : (SimpleGraph.cycleGraph g).Adj l d) : Comp g :=
    235 if hl : l < d then ⟨(l,d),hl,h⟩ else
    236 ⟨(d,l),lt_of_le_of_ne (le_of_not_gt hl) h.ne.symm,h.symm⟩
    237
    238theorem edge_eq {g : ℕ} {l d : Tag g} (h : l < d)
    239 (ha : (SimpleGraph.cycleGraph g).Adj l d) : edge l d ha=⟨(l,d),h,ha⟩ := by
    240 simp [edge,h]
    241
    242theorem edge_symm {g : ℕ} {l d : Tag g} (h : (SimpleGraph.cycleGraph g).Adj l d) :
    243 edge l d h=edge d l h.symm := by
    244 rcases lt_or_gt_of_ne h.ne with e|e
    245 · simp [edge,e,not_lt.mpr e.le]
    246 · simp [edge,e,not_lt.mpr e.le]
    247
    248def inc {g : ℕ} (e : Comp g) (l : Tag g) := e.val.1=l ∨ e.val.2=l
    249
    250theorem inc_edge_iff {g : ℕ} {l d x : Tag g} (h : (SimpleGraph.cycleGraph g).Adj l d) :
    251 inc (edge l d h) x ↔ l=x ∨ d=x := by
    252 by_cases e : l< d <;> simp [inc,edge,e,or_comm]
    253
    254def next {g : ℕ} (l : Tag g) : Tag g :=
    255 ⟨(l.val+1)%g,Nat.mod_lt _ (by have := l.isLt; omega)⟩
    256
    257theorem next_eq_add {g : ℕ} [NeZero g] (l : Tag g) : next l=l+1 := by
    258 apply Fin.ext
    259 simp [next,Fin.val_add,Nat.add_mod_mod]
    260
    261theorem adjacent_next {g : ℕ} (hg : 2≤ g) (l : Tag g) :
    262 (SimpleGraph.cycleGraph g).Adj l (next l) := by
    263 rcases g with _|_|k
    264 · omega
    265 · omega
    266 rw [next_eq_add,SimpleGraph.cycleGraph_adj]
    267 exact Or.inr (add_sub_cancel_left l 1)
    268
    269def forward {g : ℕ} (hg : 2≤ g) (l : Tag g) : Comp g := edge l (next l) (adjacent_next hg l)
    270
    271theorem inc_forward {g : ℕ} (hg : 2≤ g) (l t : Tag g) :
    272 inc (forward hg l) t ↔ l=t ∨ next l=t := inc_edge_iff _
    273
    274theorem forward_injective {g : ℕ} (hg : 3≤ g) : Function.Injective (forward (by omega : 2≤ g)) := by
    275 have : NeZero g := ⟨by omega⟩
    276 intro l d he
    277 have h1 : inc (forward (by omega : 2≤ g) d) l := by
    278 rw [←he]; exact (inc_forward _ _ _).mpr (Or.inl rfl)
    279 have h2 : inc (forward (by omega : 2≤ g) d) (next l) := by
    280 rw [←he]; exact (inc_forward _ _ _).mpr (Or.inr rfl)
    281 rcases (inc_forward _ _ _).mp h1 with h|h
    282 · exact h.symm
    283 rcases (inc_forward _ _ _).mp h2 with h'|h'
    284 · simp only [next_eq_add] at h h'
    285 have hx : d+1+1=d := by rw [h,←h']
    286 have hx' : d+(1+1)=d+0 := by simpa only [add_assoc,add_zero] using hx
    287 have hz := congrArg Fin.val (add_left_cancel hx')
    288 change (1%g+1%g)%g=0 at hz
    289 rw [Nat.mod_eq_of_lt (by omega : 1< g),Nat.mod_eq_of_lt (by omega : 1+1< g)] at hz
    290 omega
    291 simp only [next_eq_add] at h'
    292 exact add_right_cancel h'.symm
    293
    294theorem forward_surjective {g : ℕ} (hg : 2≤ g) : Function.Surjective (forward hg) := by
    295 rcases g with _|_|k
    296 · omega
    297 · omega
    298 rintro ⟨⟨l,d⟩,hlt,ha⟩
    299 rcases SimpleGraph.cycleGraph_adj.mp ha with h|h
    300 · have hd : next d=l := by rw [next_eq_add]; simpa only [add_comm] using (sub_eq_iff_eq_add.mp h).symm
    301 refine ⟨d,?_⟩
    302 unfold forward
    303 simp only [hd]
    304 rw [edge_symm,edge_eq hlt]
    305 · have hl : next l=d := by rw [next_eq_add]; simpa only [add_comm] using (sub_eq_iff_eq_add.mp h).symm
    306 refine ⟨l,?_⟩
    307 unfold forward
    308 simp only [hl]
    309 rw [edge_eq hlt]
    310
    311def forwardEquiv {g : ℕ} (hg : 3≤ g) : Tag g ≃ Comp g :=
    312 Equiv.ofBijective (forward (by omega : 2≤ g))
    313 ⟨forward_injective hg,forward_surjective (by omega)⟩
    314
    315/-- A total outgoing projection, including the empty one-tag geometry. -/
    316def outgoingMap {g : ℕ} {V : Type*} [AddCommGroup V] [Module (ZMod 2) V]
    317 (l : Tag g) : (Comp g → V) →ₗ[ZMod 2] V :=
    318 if hg : 2≤ g then LinearMap.proj (forward hg l) else 0
    319
    320/-- The starting vertex of an edge in the matching obtained by deleting t. -/
    321def matchingVertex {g : ℕ} (t : Tag g) (i : Fin ((g-1)/2)) : Tag g :=
    322 ⟨2* i.val+1,by have := i.isLt; omega⟩+t
    323
    324def matchingMap {g : ℕ} {V : Type*} [AddCommGroup V] [Module (ZMod 2) V]
    325 (t : Tag g) : (Comp g → V) →ₗ[ZMod 2] V :=
    326 ∑ i : Fin ((g-1)/2),outgoingMap (matchingVertex t i)
    327
    328end
    329end Lax793645.ConstructionData.Frames.CycleGeometry
    330end
    331
    332section
    333namespace Lax793645.ConstructionData.Binary
    334noncomputable section
    335namespace HadwigerCounterexample
    336abbrev Tag := Fin
    337
    338abbrev Comp := Lax793645.ConstructionData.Frames.CycleGeometry.Comp
    339
    340abbrev tagDegree := Lax793645.ConstructionData.Frames.CycleGeometry.degree
    341
    342def inc {g : ℕ} (e : Comp g) (l : Tag g) := e.val.1=l ∨ e.val.2=l
    343
    344instance {g : ℕ} (e : Comp g) (l : Tag g) : Decidable (inc e l) :=
    345 inferInstanceAs (Decidable (_ ∨ _))
    346
    347abbrev TagStar {g : ℕ} (l : Tag g) := {e : Comp g // inc e l}
    348
    349variable {g : ℕ}
    350/-- A private ordinary block belongs only to its owner. Empty degenerate
    351geometries retain no ordinary block. -/
    352def allowed (d l : Tag g) := 1< g ∧ d=l
    353
    354end HadwigerCounterexample
    355end
    356end Lax793645.ConstructionData.Binary
    357end
    358
    359section
    360namespace Lax793645.ConstructionData.Binary
    361noncomputable section
    362namespace HadwigerCounterexample
    363open scoped BigOperators
    364open Matrix Finset
    365/-- Construction parameters that affect dimensions (except n,N). j = selector degree;
    366r = number of ordered tester pairs in a tester. J, h mix and channel indices. -/
    367structure Shape where
    368 g : ℕ
    369 b : ℕ
    370 j : ℕ
    371 J : ℕ
    372 r : ℕ
    373 h : ℕ
    374
    375abbrev Block (g : ℕ) := (Tag g × Tag g) ⊕ Fin 3
    376
    377namespace Block
    378variable {g : ℕ}
    379abbrev O (d t : Tag g) : Block g := .inl (d,t)
    380
    381abbrev S : Block g := .inr 0
    382
    383abbrev sharp : Block g := .inr 1
    384
    385abbrev Z : Block g := .inr 2
    386
    387end Block
    388abbrev BaseIdx (g n : ℕ) := Block g × Fin n
    389
    390abbrev Base (g n : ℕ) := Vec (BaseIdx g n)
    391
    392abbrev AIdx (g n : ℕ) := Option (BaseIdx g n)
    393
    394abbrev Label (b : ℕ) := Vec (Fin b)
    395
    396abbrev SelIdx (b j : ℕ) := { m : Finset (Fin b) // m.card ≤ j }
    397
    398abbrev Row (p : Shape) (n : ℕ) := SelIdx p.b p.j × AIdx p.g n
    399
    400abbrev Ray (p : Shape) (n : ℕ) := Vec (Row p n)
    401
    402abbrev Moment (p : Shape) (n : ℕ) := Mat (Row p n) (Row p n)
    403
    404def psize (p : Shape) := Fintype.card (SelIdx p.b p.j)
    405
    406def emptySel {b j} : SelIdx b j := ⟨∅,by simp⟩
    407
    408def selV {b} (j) (s : Label b) : Vec (SelIdx b j) := fun x => ∏ i ∈ x.val, s i
    409
    410def baseV {g n} (z : Base g n) : Vec (AIdx g n) := Option.elim' 1 z
    411
    412variable (p : Shape)
    413variable {n : ℕ}
    414/-- Embedding of the affine coordinate space at a fixed label. -/
    415def putLab (n : ℕ) (s : Label p.b) : Vec (AIdx p.g n) →ₗ[F] Ray p n where
    416 toFun z r := selV p.j s r.1 * z r.2
    417 map_add' z w := by ext; simp only [Pi.add_apply,mul_add]
    418 map_smul' b z := by ext; simp only [Pi.smul_apply,RingHom.id_apply,smul_eq_mul]; ring
    419
    420def point (s : Label p.b) (z : Base p.g n) : Ray p n := putLab p n s (baseV z)
    421
    422def mom (s : Label p.b) (z : Base p.g n) : Moment p n := vecMulVec (point p s z) (point p s z)
    423
    424/-- O-blocks disallowed at l are set to zero. -/
    425def allows {g n} (l : Tag g) (z : Base g n) :=
    426 ∀ d t : Tag g, ¬ allowed d l → ∀ i : Fin n, z (Block.O d t,i) = 0
    427
    428def Wtag (n : ℕ) (l : Tag p.g) : Space (Moment p n) :=
    429 Submodule.span F {m | ∃ s z, allows l z ∧ m = mom p s z}
    430
    431variable {p}
    432/-- Cut profiles in the direct sum over unordered components. -/
    433abbrev Profile (p : Shape) (n : ℕ) := Comp p.g → Moment p n
    434
    435def cut (p : Shape) (n : ℕ) : (Tag p.g → Moment p n) →ₗ[F] Profile p n where
    436 toFun w e := w e.val.1 + w e.val.2
    437 map_add' w w' := by
    438 funext e
    439 simp only [Pi.add_apply]
    440 ac_rfl
    441 map_smul' b w := by funext; simp only [Pi.smul_apply, RingHom.id_apply, smul_add]
    442
    443def Xspace (p : Shape) (n : ℕ) : Space (Profile p n) :=
    444 (Submodule.pi Set.univ (fun l => Wtag p n l)).map (cut p n)
    445
    446/-- Single star atoms as profiles in ambient coordinates. -/
    447def atom (p : Shape) (l : Tag p.g) (s : Label p.b) (z : Base p.g n) : Profile p n :=
    448 cut p n (Pi.single l (mom p s z))
    449
    450end HadwigerCounterexample
    451end
    452end Lax793645.ConstructionData.Binary
    453end
    454
    455section
    456namespace Lax793645.ConstructionData.Frames
    457open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    458open Matrix Submodule
    459open scoped BigOperators
    460noncomputable section
    461variable {S T : Type} [Fintype S] [Fintype T]
    462def tensorRay (s : Vec S) (t : Vec T) : Vec (S × T) := fun x => s x.1* t x.2
    463
    464def affineTensorSpace (εS : Vec S) (εT : Vec T) : Space (Mat (S × T) (S × T)) :=
    465 Submodule.span F {w | ∃ s t, dotProduct εS s=1 ∧ dotProduct εT t=1 ∧
    466 w=vecMulVec (tensorRay s t) (tensorRay s t)}
    467
    468structure TensorIdentities (εS : Vec S) (εT : Vec T)
    469 (w : Mat (S × T) (S × T)) : Prop where
    470 selector_sym : ∀ a b i j, w (a,i) (b,j)=w (b,i) (a,j)
    471 base_sym : ∀ a b i j, w (a,i) (b,j)=w (a,j) (b,i)
    472 selector_diag : ∀ a i j, w (a,i) (a,j)=∑ b, εS b* w (a,i) (b,j)
    473 base_diag : ∀ a b i, w (a,i) (b,i)=∑ j, εT j* w (a,i) (b,j)
    474
    475end
    476end Lax793645.ConstructionData.Frames
    477end
    478
    479section
    480namespace Lax793645.ConstructionData.Binary
    481noncomputable section
    482namespace HadwigerCounterexample
    483open scoped BigOperators
    484open Matrix Finset
    485variable {b : ℕ}
    486def monoBit (s : Label b) (S : Finset (Fin b)) := ∏ i ∈ S, s i
    487
    488variable {p : Shape} {n : ℕ}
    489def labMat (p : Shape) (n) (s : Label p.b) :
    490 Mat (Row p n) (AIdx p.g n) :=
    491 Matrix.of (fun v i => if v.2=i then monoBit s v.1.val else 0)
    492
    493end HadwigerCounterexample
    494end
    495end Lax793645.ConstructionData.Binary
    496end
    497
    498section
    499namespace Lax793645.ConstructionData.Binary
    500noncomputable section
    501namespace HadwigerCounterexample
    502open Matrix
    503open scoped BigOperators
    504theorem mpair_add {I J : Type} [Fintype I] [Fintype J] (A B M : Mat I J) :
    505 mpair (A+B) M = mpair A M + mpair B M := by rw [mpair_comm,map_add,mpair_comm M,mpair_comm M]
    506
    507theorem mpair_smul {I J : Type} [Fintype I] [Fintype J] (b : F) (A M : Mat I J) :
    508 mpair (b • A) M = b * mpair A M := by rw [mpair_comm,map_smul,mpair_comm M, smul_eq_mul]
    509
    510variable (p : Shape)
    511def pick (n : ℕ) (u : SelIdx p.b p.j) (d : Block p.g) (i : ℕ) : Ray p n :=
    512 if h : i < n then Pi.single (u,some (d,⟨i,h⟩)) 1 else 0
    513
    514def testM (n : ℕ) (d : Block p.g) : Moment p n :=
    515 ∑ i : Fin p.r, vecMulVec (pick p n emptySel d (2* i.val))
    516 (pick p n emptySel d (2* i.val+1))
    517
    518def etab (n) (d : Block p.g) : Moment p n →ₗ[F] F := mpair (testM p n d)
    519
    520/-- all O testers. -/
    521def etaO (n) : Moment p n →ₗ[F] F :=
    522 ∑ (d : Tag p.g), ∑ (t : Tag p.g), etab p n (Block.O d t)
    523
    524def eta (n) : Moment p n →ₗ[F] F := etaO p n + etab p n Block.S
    525
    526/-- The ordinary functional reads each owner's outgoing cycle component. -/
    527def roleT (n : ℕ) (t : Tag p.g) : Profile p n →ₗ[F] F :=
    528 ∑ l : Tag p.g, etab p n (Block.O l t) ∘ₗ
    529 Lax793645.ConstructionData.Frames.CycleGeometry.outgoingMap l
    530
    531def role (n : ℕ) := ∑ t : Tag p.g, roleT p n t
    532
    533/-- The shared functional sums the matching obtained by deleting t. -/
    534def sharedT (n : ℕ) (t : Tag p.g) : Profile p n →ₗ[F] F :=
    535 etab p n Block.S ∘ₗ Lax793645.ConstructionData.Frames.CycleGeometry.matchingMap t
    536
    537def sharpPick (n : ℕ) (a : Fin p.b) (i : Fin n) : Ray p n :=
    538 if h : 1 ≤ p.j then pick p n ⟨{a},by simp [h]⟩ Block.sharp i.val else 0
    539
    540def sharpM (n : ℕ) (Y : Fin p.b → Mat (Fin n) (Fin n)) : Moment p n :=
    541 ∑ a : Fin p.b, ∑ i : Fin n, ∑ j : Fin n,
    542 Y a i j • (vecMulVec (sharpPick p n a i) (pick p n emptySel Block.sharp j.val) +
    543 vecMulVec (pick p n emptySel Block.sharp i.val) (sharpPick p n a j))
    544
    545def selfM (n) (Y : Fin p.b → Mat (Fin n) (Fin n)) : Moment p n :=
    546 ((∑ d : Tag p.g, ∑ t : Tag p.g, testM p n (Block.O d t)) +
    547 testM p n Block.S) + sharpM p n Y
    548
    549end HadwigerCounterexample
    550end
    551end Lax793645.ConstructionData.Binary
    552end
    553
    554section
    555namespace Lax793645.ConstructionData.Binary
    556noncomputable section
    557namespace HadwigerCounterexample
    558open Matrix Module Function
    559open scoped BigOperators
    560variable {U V I J K T : Type} [Fintype U] [Fintype V] [Fintype I] [Fintype J]
    561 [Fintype K] [Fintype T]
    562def embedMat [DecidableEq U] (f : I → U) : Mat U I := Matrix.of (fun i j => if i=f j then 1 else 0)
    563
    564omit [Fintype U] in
    565theorem inj_fromCols {A : Mat U I} {B : Mat U J} (hA : Injective A.mulVec)
    566 (hB : Injective B.mulVec) (h : Disjoint (colSp A) (colSp B)) :
    567 Injective (fromCols A B).mulVec := by
    568 rw [← Matrix.coe_mulVecLin,← LinearMap.ker_eq_bot, Matrix.ker_mulVecLin_eq_bot_iff]
    569 intro x hx
    570 let a := fun i => x (Sum.inl i)
    571 let b := fun j => x (Sum.inr j)
    572 rw [fromCols_mulVec] at hx
    573 have he : A*ᵥa=B*ᵥb := add_right_cancel (hx.trans (char_two (B*ᵥb)).symm)
    574 have hi : A*ᵥa ∈ colSp A ⊓ colSp B :=
    575 ⟨⟨a,rfl⟩, he.symm ▸ (show B*ᵥb∈colSp B from ⟨b,rfl⟩)⟩
    576 rw [h.eq_bot] at hi
    577 have hg : A*ᵥa=0 := by simpa using hi
    578 have ha : a=0 := hA (hg.trans (Matrix.mulVec_zero A).symm)
    579 rw [he] at hg
    580 have hb : b=0 := hB (hg.trans (Matrix.mulVec_zero B).symm)
    581 funext i
    582 cases i
    583 · exact congr_fun ha _
    584 · exact congr_fun hb _
    585
    586end HadwigerCounterexample
    587end
    588end Lax793645.ConstructionData.Binary
    589end
    590
    591section
    592namespace Lax793645.ConstructionData.Binary
    593noncomputable section
    594namespace HadwigerCounterexample
    595open Matrix
    596open scoped BigOperators
    597variable {p : Shape} {n : ℕ}
    598def blockA (p : Shape) (n : ℕ) (B : Block p.g) : Mat (AIdx p.g n) (Fin n) :=
    599 embedMat (fun i => some (B,i))
    600
    601def blockRay (p : Shape) (n : ℕ) (s : Label p.b) (B : Block p.g) : Mat (Row p n) (Fin n) :=
    602 labMat p n s * blockA p n B
    603
    604def pullM {I J V U : Type} [Fintype V] [Fintype U] (P : Mat V I) (Q : Mat U J) :
    605 Mat V U →ₗ[F] Mat I J := liftM Pᵀ Qᵀ
    606
    607theorem pullM_def {I J V U : Type} [Fintype V] [Fintype U] (P : Mat V I)
    608 (Q : Mat U J) (M : Mat V U) : pullM P Q M=Pᵀ* M* Q := rfl
    609
    610end HadwigerCounterexample
    611end
    612end Lax793645.ConstructionData.Binary
    613end
    614
    615section
    616namespace Lax793645.ConstructionData.Binary
    617namespace HadwigerMatching
    618universe u
    619variable {V : Type u}
    620/-- A finite matching whose edges are pairwise touching: each member is a
    621two-vertex clique, and distinct members are disjoint and joined by an edge. -/
    622def IsTouchingMatching (G : SimpleGraph V) (M : Finset (Finset V)) : Prop :=
    623 (∀ e ∈ M, e.card = 2 ∧ G.IsClique (e : Set V)) ∧
    624 (∀ e ∈ M, ∀ f ∈ M, e ≠ f → Disjoint e f) ∧
    625 (∀ e ∈ M, ∀ f ∈ M, e ≠ f →
    626 ∃ v ∈ e, ∃ w ∈ f, G.Adj v w)
    627
    628/-- The supremum of the cardinalities of pairwise touching matchings.
    629For finite vertex types, this supremum is attained. -/
    630noncomputable def connectedMatchingNumber (G : SimpleGraph V) : ℕ :=
    631 sSup {n : ℕ | ∃ M : Finset (Finset V), IsTouchingMatching G M ∧ M.card = n}
    632
    633end HadwigerMatching
    634end Lax793645.ConstructionData.Binary
    635end
    636
    637section
    638namespace Lax793645.ConstructionData.Binary
    639noncomputable section
    640namespace HadwigerCounterexample
    641open HadwigerMatching Finset
    642variable {A V : Type*}
    643structure Holes (A : Type*) where
    644 rel : A → A → Prop
    645 sym {x y : A} : rel x y → rel y x
    646 irr (x : A) : ¬ rel x x
    647 ntri {x y z : A} : rel x y → rel y z → ¬ rel x z
    648
    649namespace Holes
    650variable (H : Holes A)
    651def unit (p : A × A) := ¬H.rel p.1 p.2
    652
    653def conflict (p q : A × A) := H.rel p.1 q.1 ∧ H.rel p.1 q.2 ∧ H.rel p.2 q.1 ∧ H.rel p.2 q.2
    654
    655def graph (x : V → A) : SimpleGraph V where
    656 Adj i j := i ≠ j ∧ ¬H.rel (x i) (x j)
    657 symm := ⟨fun _ _ ⟨hne,h⟩ => ⟨hne.symm,fun h' => h (H.sym h')⟩⟩
    658 loopless := ⟨fun _ h => h.1 rfl⟩
    659
    660end Holes
    661end HadwigerCounterexample
    662end
    663end Lax793645.ConstructionData.Binary
    664end
    665
    666section
    667namespace Lax793645.ConstructionData.Binary
    668noncomputable section
    669namespace HadwigerCounterexample
    670open Matrix
    671open scoped BigOperators
    672structure Mixer (p : Shape) (n : ℕ) where
    673 mixL : Fin p.J → Comp p.g → Comp p.g → Moment p n
    674 mixR : Fin p.J → Comp p.g → Comp p.g → Moment p n
    675 mixM : Fin p.b → Mat (Fin n) (Fin n)
    676
    677abbrev Pdual (p : Shape) (n : ℕ) := Profile p n →ₗ[F] F
    678
    679def linTensor {V : Type} [AddCommGroup V] [Module F V] (a b : V →ₗ[F] F) : V →ₗ[F] V →ₗ[F] F :=
    680 a.smulRight b
    681
    682theorem linTensor_val {V : Type} [AddCommGroup V] [Module F V] (a b : V →ₗ[F] F)
    683 (x y : V) : linTensor a b x y = a x * b y := rfl
    684
    685variable {p : Shape} {n N : ℕ}
    686def T0 (p : Shape) (n : ℕ) : Profile p n →ₗ[F] Pdual p n :=
    687 linTensor (role p n) (role p n) +
    688 ∑ i : Tag p.g, (linTensor (roleT p n i) (sharedT p n i) +
    689 linTensor (sharedT p n i) (roleT p n i))
    690
    691theorem T0_val (x y : Profile p n) : T0 p n x y =
    692 role p n x * role p n y +
    693 ∑ i : Tag p.g, (roleT p n i x * sharedT p n i y + sharedT p n i x * roleT p n i y) := by
    694 simp only [T0,LinearMap.add_apply,LinearMap.sum_apply,linTensor_val]
    695
    696def B1 (m : Mixer p n) : Profile p n →ₗ[F] Pdual p n where
    697 toFun x := {
    698 toFun := fun y => ∑ j, ∑ e, ∑ f,
    699 mpair (x e) (liftM (m.mixL j e f) (m.mixR j e f) (y f))
    700 map_add' y z := by simp only [Pi.add_apply,map_add, Finset.sum_add_distrib]
    701 map_smul' b y := by simp only [Pi.smul_apply,map_smul,RingHom.id_apply,smul_eq_mul,
    702 Finset.mul_sum] }
    703 map_add' x y := LinearMap.ext fun z => by
    704 simp only [LinearMap.coe_mk,AddHom.coe_mk,LinearMap.add_apply,
    705 Pi.add_apply,mpair_add, Finset.sum_add_distrib]
    706 map_smul' b x := LinearMap.ext fun z => by
    707 simp only [LinearMap.coe_mk,AddHom.coe_mk,LinearMap.smul_apply,RingHom.id_apply,
    708 Pi.smul_apply,mpair_smul,smul_eq_mul, Finset.mul_sum]
    709
    710def Tmix (m : Mixer p n) := B1 m + LinearMap.flip (B1 m)
    711
    712def Tsym (m : Mixer p n) := T0 p n + Tmix m
    713
    714theorem Tsym_val (m : Mixer p n) (x y : Profile p n) :
    715 Tsym m x y = T0 p n x y + (B1 m x y + B1 m y x) := by
    716 change (T0 p n + (B1 m + _)) x y = _
    717 simp
    718
    719theorem T_swap (m : Mixer p n) (x y : Profile p n) : Tsym m x y = Tsym m y x := by
    720 simp only [Tsym_val,T0_val]
    721 refine congrArg₂ (· + ·) (congrArg₂ (· + ·) (mul_comm _ _)
    722 (Finset.sum_congr rfl fun i _ => ?_)) (add_comm _ _)
    723 rw [mul_comm (roleT p n i x),mul_comm (sharedT p n i x),add_comm]
    724
    725def grad (m : Mixer p n) (x : Profile p n) := role p n + Tsym m x
    726
    727theorem grad_val (m : Mixer p n) (x y : Profile p n) :
    728 grad m x y = role p n y + Tsym m x y := rfl
    729
    730abbrev Ambient (p : Shape) (N : ℕ) := Comp p.g → Mat (Fin N) (Fin N)
    731
    732end HadwigerCounterexample
    733end
    734end Lax793645.ConstructionData.Binary
    735end
    736
    737section
    738namespace Lax793645.ConstructionData.Binary
    739noncomputable section
    740open scoped BigOperators
    741namespace HadwigerCounterexample
    742abbrev Wgt (α : Type*) := α → ℝ
    743
    744variable {α β : Type*}
    745/-- Real indicator. -/
    746def ind (p : Prop) : ℝ := @ite ℝ p (Classical.propDecidable _) 1 0
    747
    748/-- Total weight. -/
    749def tot [Fintype α] (w : Wgt α) : ℝ := ∑ x, w x
    750
    751/-- Weighted average (not normalized if the weights are not a probability law). -/
    752def avg [Fintype α] (w f : Wgt α) : ℝ := ∑ x, w x * f x
    753
    754/-- Weight of an event. -/
    755def pr [Fintype α] (w : Wgt α) (p : α → Prop) := avg w (fun x => ind (p x))
    756
    757structure SubLaw [Fintype α] (w : Wgt α) : Prop where
    758 nz (x : α) : 0 ≤ w x
    759 total : tot w ≤ 1
    760
    761structure IsLaw [Fintype α] (w : Wgt α) : Prop where
    762 nz (x : α) : 0 ≤ w x
    763 total : tot w = 1
    764
    765/-- All positive mass is supported on `p`. We use the equivalent contrapositive with
    766zero mass (and supply nonnegativity wherever we speak of a law). -/
    767def carried (w : Wgt α) (p : α → Prop) := ∀ x : α, ¬ p x → w x = 0
    768
    769section Basic
    770variable [Fintype α] {w v f g : Wgt α} {p q : α → Prop}
    771end Basic
    772/-- Restrict weights; * not* renormalized. -/
    773def subW (w : Wgt α) (p : α → Prop) := fun x => w x * ind (p x)
    774
    775/-- Divide a finite weight function by its total, giving zero if total is zero. -/
    776def normW [Fintype α] (w : Wgt α) := fun x => w x / tot w
    777
    778def unif [Fintype α] : Wgt α := normW fun _ => 1
    779
    780def unifOn [Fintype α] (p : α → Prop) : Wgt α := normW (fun x => ind (p x))
    781
    782section Restrict
    783variable [Fintype α] {w : Wgt α} {p : α → Prop}
    784end Restrict
    785def pairW (w : Wgt α) (v : Wgt β) : Wgt (α × β) := fun p => w p.1 * v p.2
    786
    787def mixW [Fintype α] (w : Wgt α) (F : α → Wgt β) : Wgt β := fun y => avg w (fun x => F x y)
    788
    789def mapW [Fintype α] (w : Wgt α) (f : α → β) : Wgt β := fun y => pr w (fun x => f x = y)
    790
    791section Prod
    792variable [Fintype α] [Fintype β] {w : Wgt α} {v : Wgt β}
    793end Prod
    794end HadwigerCounterexample
    795end
    796end Lax793645.ConstructionData.Binary
    797end
    798
    799section
    800namespace Lax793645.ConstructionData.Binary
    801noncomputable section
    802open scoped BigOperators
    803namespace HadwigerCounterexample
    804variable {ι κ α : Type*}
    805variable {β : ι → Type*}
    806def prodW [Fintype ι] (w : ∀ i, Wgt (β i)) : Wgt (∀ i, β i) := fun x => ∏ i, w i (x i)
    807
    808section
    809variable [Fintype ι] [DecidableEq ι] [∀ i, Fintype (β i)]
    810end
    811section
    812variable [Fintype ι] [Fintype κ] [Fintype α] [DecidableEq κ]
    813end
    814end HadwigerCounterexample
    815end
    816end Lax793645.ConstructionData.Binary
    817end
    818
    819section
    820namespace Lax793645.ConstructionData.Binary
    821noncomputable section
    822namespace HadwigerCounterexample
    823open scoped BigOperators
    824variable {A B : Type*} [Fintype A]
    825def onW (w : Wgt A) (p : A → Prop) := normW (subW w p)
    826
    827variable [Fintype B]
    828end HadwigerCounterexample
    829end
    830end Lax793645.ConstructionData.Binary
    831end
    832
    833section
    834namespace Lax793645.ConstructionData.Binary
    835noncomputable section
    836namespace HadwigerCounterexample
    837open Filter Real
    838open scoped Topology
    839def bp (x : ℝ) := (2:ℝ)^x
    840
    841variable {ι : Type*} {l : Filter ι} {n f g : ι → ℝ}
    842namespace ExpSmall
    843end ExpSmall
    844end HadwigerCounterexample
    845end
    846end Lax793645.ConstructionData.Binary
    847end
    848
    849section
    850namespace Lax793645.ConstructionData.Binary
    851noncomputable section
    852namespace HadwigerCounterexample
    853open scoped BigOperators
    854open Matrix Function LinearMap
    855abbrev num (I : Type) [Fintype I] : ℝ := (Fintype.card I:ℝ)
    856
    857variable {I J U : Type} [Fintype I] [Fintype J] [Fintype U]
    858variable [DecidableEq U] [DecidableEq I] [DecidableEq J]
    859end HadwigerCounterexample
    860end
    861end Lax793645.ConstructionData.Binary
    862end
    863
    864section
    865namespace Lax793645.ConstructionData.Binary
    866noncomputable section
    867namespace HadwigerCounterexample
    868open scoped BigOperators
    869variable {A B I : Type} [Fintype A] [Fintype B]
    870def semi (w : Wgt A) (k : A → Wgt B) : Wgt (A × B) := fun x => w x.1 * k x.1 x.2
    871
    872variable [Fintype I] [DecidableEq I]
    873end HadwigerCounterexample
    874end
    875end Lax793645.ConstructionData.Binary
    876end
    877
    878section
    879namespace Lax793645.ConstructionData.Binary
    880noncomputable section
    881namespace HadwigerCounterexample
    882open Matrix
    883open scoped BigOperators
    884variable {p : Shape} {n N : ℕ}
    885instance rowDecidableEq (p : Shape) (n : ℕ) : DecidableEq (Row p n) := inferInstance
    886
    887abbrev Place (p : Shape) := Comp p.g × Bool
    888
    889end HadwigerCounterexample
    890end
    891end Lax793645.ConstructionData.Binary
    892end
    893
    894section
    895namespace Lax793645.ConstructionData.Binary
    896noncomputable section
    897namespace HadwigerCounterexample
    898open Matrix
    899open scoped BigOperators
    900variable {p : Shape} {n : ℕ}
    901def totalRank (x : Profile p n) : ℕ := ∑ i, (x i).rank
    902
    903end HadwigerCounterexample
    904end
    905end Lax793645.ConstructionData.Binary
    906end
    907
    908section
    909namespace Lax793645.ConstructionData.Binary
    910noncomputable section
    911namespace HadwigerCounterexample
    912open Matrix LinearMap Submodule Module
    913open scoped BigOperators
    914variable {I J K L : Type} [Fintype I] [Fintype J] [Fintype K] [Fintype L]
    915def box (S : Space (Vec I)) (T : Space (Vec J)) :=
    916 LinearMap.range (liftM (pack S) (pack T))
    917
    918theorem pack_mem_iff (v : Vec I) (S : Space (Vec I)) :
    919 v∈S ↔ ∃ x, pack S *ᵥ x=v := by
    920 change _ ↔ v∈colSp (pack S)
    921 rw [colSp_pack]
    922
    923theorem evmat_pull (P : Mat K I) (Q : Mat L J) (A : Mat K L) (x : Vec I) (y : Vec J) :
    924 evmat (pullM P Q A) x y=evmat A (P *ᵥ x) (Q *ᵥ y) := by
    925 rw [←mpair_outer,←mpair_outer,← liftM_outer,mpair_liftM]; rfl
    926
    927def annih (S : Space (Vec I)) := ker ((pack S)ᵀ.mulVecLin)
    928
    929def vanish (S : Space (Vec I)) (T : Space (Vec J)) (M : Mat I J) :=
    930 ∀ x ∈ annih S, ∀ y∈ annih T, evmat M x y=0
    931
    932end HadwigerCounterexample
    933end
    934end Lax793645.ConstructionData.Binary
    935end
    936
    937section
    938namespace Lax793645.ConstructionData.Frames
    939open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    940open Matrix Submodule Module LinearMap
    941open scoped BigOperators Kronecker
    942noncomputable section
    943variable {S T S' T' : Type} [Fintype S] [Fintype T] [Fintype S'] [Fintype T']
    944def flattenMatrix : Mat S T ≃ₗ[F] Vec (S × T) where
    945 toFun M x := M x.1 x.2
    946 invFun x a i := x (a,i)
    947 left_inv _ := rfl
    948 right_inv _ := rfl
    949 map_add' _ _ := rfl
    950 map_smul' _ _ := rfl
    951
    952def tensorRectangle (U : Space (Vec S)) (V : Space (Vec T)) : Space (Vec (S × T)) :=
    953 (box U V).map flattenMatrix.toLinearMap
    954
    955def tensorCross (U : Space (Vec S)) (V : Space (Vec T)) : Space (Vec (S × T)) :=
    956 tensorRectangle U ⊤ ⊔ tensorRectangle ⊤ V
    957
    958end
    959end Lax793645.ConstructionData.Frames
    960end
    961
    962section
    963namespace Lax793645.ConstructionData.Frames
    964open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    965open Matrix Submodule Module LinearMap
    966open scoped BigOperators Kronecker
    967noncomputable section
    968variable {S T I S' T' : Type} [Fintype S] [Fintype T] [Fintype I]
    969 [Fintype S'] [Fintype T']
    970def selectedTensorSpace (s : I → Vec S) (t : I → Vec T) : Space (Vec (S × T)) :=
    971 Submodule.span F (Set.range (fun i => tensorRay (s i) (t i)))
    972
    973end
    974end Lax793645.ConstructionData.Frames
    975end
    976
    977section
    978namespace Lax793645.ConstructionData.Binary
    979noncomputable section
    980namespace HadwigerCounterexample
    981open Matrix Module
    982open scoped BigOperators
    983variable {p : Shape} {n N : ℕ}
    984def onSide {A : Type} (x : A × A) (b : Bool) := if b then x.1 else x.2
    985
    986abbrev Chan (p : Shape) := Fin p.h
    987
    988end HadwigerCounterexample
    989end
    990end Lax793645.ConstructionData.Binary
    991end
    992
    993section
    994namespace Lax793645.ConstructionData.Binary
    995noncomputable section
    996namespace HadwigerCounterexample
    997open Matrix
    998open scoped BigOperators
    999variable {p : Shape} {n N : ℕ}
    1000def fee (N : ℕ) (ζ : ℝ) (t : ℕ) := bp (-(1-ζ)* t* N)
    1001
    1002end HadwigerCounterexample
    1003end
    1004end Lax793645.ConstructionData.Binary
    1005end
    1006
    1007section
    1008namespace Lax793645.ConstructionData.Binary
    1009noncomputable section
    1010namespace HadwigerCounterexample
    1011open scoped BigOperators
    1012open Matrix Finset
    1013variable {I : Type} [Fintype I]
    1014variable {p : Shape} {n N : ℕ}
    1015/-- One side of the lists, with actual point inputs, indexed by the
    1016simultaneous (both units') list positions. Tags passed separately
    1017because matched across the two sides. -/
    1018structure Volley (p : Shape) (n : ℕ) (I : Type) where
    1019 obj : I → Bool
    1020 sel : I → Label p.b
    1021 par : I → Base p.g n
    1022
    1023abbrev Tagging (p : Shape) (I : Type) := I → Tag p.g
    1024
    1025abbrev AtomKey {p : Shape} (l : Tag p.g) (N : ℕ) := TagStar l → Bool → Vec (Fin N)
    1026
    1027namespace Volley
    1028variable (v : Volley p n I)
    1029def atomAt (t : Tagging p I) (i) := atom p (t i) (v.sel i) (v.par i)
    1030
    1031def rayAt (i) := point p (v.sel i) (v.par i)
    1032
    1033/-- List from endpoint j to endpoint k of the other unit. -/
    1034def shoots (w : I → Bool) (j k : Bool) := univ.filter (fun i => v.obj i=j ∧ w i=k)
    1035
    1036def here (j : Bool) := Finset.univ.filter (fun i => v.obj i=j)
    1037
    1038def sumAt (t : Tagging p I) (w : I→ Bool) (j k : Bool) :=
    1039 ∑ i∈shoots v w j k, v.atomAt t i
    1040
    1041end Volley
    1042namespace Volley
    1043variable (v : Volley p n I)
    1044end Volley
    1045end HadwigerCounterexample
    1046end
    1047end Lax793645.ConstructionData.Binary
    1048end
    1049
    1050section
    1051namespace Lax793645.ConstructionData.Binary
    1052noncomputable section
    1053namespace HadwigerCounterexample
    1054open Matrix
    1055open scoped BigOperators
    1056variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I]
    1057namespace Volley
    1058variable (v w : Volley p n I)
    1059def legal (t : Tagging p I) := ∀ i : I, allows (t i) (v.par i)
    1060
    1061def diagonalAt (i : I) := eta p n (mom p (v.sel i) (v.par i))
    1062
    1063end Volley
    1064end HadwigerCounterexample
    1065end
    1066end Lax793645.ConstructionData.Binary
    1067end
    1068
    1069section
    1070namespace Lax793645.ConstructionData.Binary
    1071noncomputable section
    1072namespace HadwigerCounterexample
    1073open scoped BigOperators
    1074open Matrix Submodule
    1075variable {I : Type} [Fintype I]
    1076/-- Onto projection in coordinates, killing a specified disjoint subspace. -/
    1077structure ProjData (S T : Space (Vec I)) (A : Mat I I) : Prop where
    1078 onto (x) : A *ᵥ x ∈ S
    1079 fixes x : x ∈ S → A *ᵥ x=x
    1080 kills x : x∈T → A *ᵥ x=0
    1081
    1082theorem proj_exists (S T : Space (Vec I)) (h : Disjoint S T) :
    1083 ∃ A, ProjData S T A := by
    1084 classical
    1085 obtain ⟨A,hA⟩ := mat_left_inv (inj_fromCols (pack_inj S) (pack_inj T)
    1086 (by rw [colSp_pack, colSp_pack]; exact h))
    1087 let B := A.toRows₁
    1088 let C := A.toRows₂
    1089 have he : fromRows B C * fromCols (pack S) (pack T)=1 := by
    1090 rw [show fromRows B C=A from Matrix.fromRows_toRows A,hA]
    1091 rw [Matrix.fromRows_mul_fromCols, ← Matrix.fromBlocks_one] at he
    1092 have hb : B* pack S=1 := congrArg Matrix.toBlocks₁₁ he
    1093 have hg : B* pack T=0 := congrArg Matrix.toBlocks₁₂ he
    1094 refine ⟨pack S* B,fun x => ?_,fun x hx => ?_,fun x hx => ?_⟩
    1095 · rw [←mulVec_mulVec]
    1096 exact (pack_mem_iff ..).mpr ⟨_,rfl⟩
    1097 · obtain ⟨x,rfl⟩ := (pack_mem_iff ..).mp hx
    1098 rw [←mulVec_mulVec, mulVec_mulVec _ B, hb,one_mulVec]
    1099 · obtain ⟨x,rfl⟩ := (pack_mem_iff ..).mp hx
    1100 rw [←mulVec_mulVec,mulVec_mulVec _ B,hg,zero_mulVec,mulVec_zero]
    1101
    1102variable {p : Shape} {n : ℕ}
    1103end HadwigerCounterexample
    1104end
    1105end Lax793645.ConstructionData.Binary
    1106end
    1107
    1108section
    1109namespace Lax793645.ConstructionData.Frames
    1110open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    1111open Matrix Submodule Module LinearMap
    1112open scoped BigOperators
    1113noncomputable section
    1114variable {p : Shape} {n : ℕ} {I : Type} [Fintype I]
    1115abbrev CallsAt (v : Volley p n I) (i : Bool) := {j : I // j ∈ v.here i}
    1116
    1117end
    1118end Lax793645.ConstructionData.Frames
    1119end
    1120
    1121section
    1122namespace Lax793645.ConstructionData.Binary
    1123noncomputable section
    1124namespace HadwigerCounterexample
    1125open Matrix LinearMap Submodule Module
    1126open scoped BigOperators
    1127variable {p : Shape} {N : ℕ}
    1128variable {I J : Type} [Fintype I] [Fintype J]
    1129noncomputable def prj (S : Space (Vec I)) : Mat I I :=
    1130 (proj_exists S ⊥ disjoint_bot_right).choose
    1131
    1132variable [DecidableEq I] [DecidableEq J]
    1133def chop (S : Space (Vec I)) := 1-prj S
    1134
    1135abbrev Cov (p : Shape) (N : ℕ) := Place p → Space (Vec (Fin N))
    1136
    1137def cdSign (p : Shape) {N} (S : Cov p N) (i : Bool) :=
    1138 ∑ e : Comp p.g,dim (S (e,i))
    1139
    1140def epoch (p : Shape) {N} (x : Ambient p N) := ∑ e : Comp p.g,(x e).rank
    1141
    1142def erased (p : Shape) {N} (S : Cov p N) : Ambient p N →ₗ[F] Ambient p N :=
    1143 LinearMap.pi (fun i => liftM (chop (S (i,true))) (chop (S (i,false))) ∘ₗ LinearMap.proj i)
    1144
    1145def covered (p : Shape) {N} (S : Cov p N) (x : Ambient p N) :=
    1146 erased p S x=0
    1147
    1148end HadwigerCounterexample
    1149end
    1150end Lax793645.ConstructionData.Binary
    1151end
    1152
    1153section
    1154namespace Lax793645.ConstructionData.Binary
    1155noncomputable section
    1156namespace HadwigerCounterexample
    1157open scoped BigOperators
    1158open Finset
    1159variable {A I : Type} [Fintype A] [Fintype I] [DecidableEq I]
    1160def draws (I : Type) [Fintype I] (w : Wgt A) : Wgt (I→ A) := prodW (fun _ : I => w)
    1161
    1162variable {p : Shape} {N : ℕ}
    1163end HadwigerCounterexample
    1164end
    1165end Lax793645.ConstructionData.Binary
    1166end
    1167
    1168section
    1169namespace Lax793645.ConstructionData.Binary
    1170noncomputable section
    1171namespace HadwigerCounterexample
    1172open Matrix LinearMap Finset Function
    1173open scoped BigOperators
    1174variable {g r n b : ℕ} {p : Shape}
    1175abbrev Flavor (_g : ℕ) := Option Unit
    1176
    1177namespace Flavor
    1178abbrev full {g : ℕ} : Flavor g := none
    1179
    1180def keeps (f : Flavor g) (x : Tag g) (y : Block g) : Prop :=
    1181 match f,y with
    1182 | none, .inl (i,_) => allowed i x
    1183 | some _,.inl _ => False
    1184 | _, .inr _ => True
    1185
    1186instance (f : Flavor g) (x : Tag g) (y : Block g) : Decidable (keeps f x y) :=
    1187 Classical.propDecidable _
    1188
    1189end Flavor
    1190abbrev Knobs (g n : ℕ) := Block g → Vec (Fin n)
    1191
    1192def lit (f : Flavor g) (x : Tag g) (y : Knobs g n) : Base g n :=
    1193 fun i => if f.keeps x i.1 then y i.1 i.2 else 0
    1194
    1195def useAtom (p : Shape) {n : ℕ} (x : Tag p.g) (s : Label p.b) (f : Flavor p.g)
    1196 (y : Knobs p.g n) := atom p x s (lit f x y)
    1197
    1198abbrev ProbeIdx (g : ℕ) := (Tag g × Tag g)⊕Unit
    1199
    1200abbrev Digest (g : ℕ) := Vec (ProbeIdx g)
    1201
    1202def asBlock (i : ProbeIdx g) : Block g := i.elim (fun q => Block.O q.1 q.2) (fun _ => Block.S)
    1203
    1204def zget (y : Vec (Fin n)) (i : ℕ) := if h:i< n then y ⟨i,h⟩ else 0
    1205
    1206def tested (r : ℕ) (y : Vec (Fin n)) :=
    1207 ∑ i : Fin r,zget y (2* i.val)* zget y (2* i.val+1)
    1208
    1209def scan (p : Shape) {n} (l : Tag p.g) (f : Flavor p.g) (x : Knobs p.g n) :
    1210 Digest p.g :=
    1211 fun i => if Flavor.keeps f l (asBlock i) then tested p.r (x (asBlock i)) else 0
    1212
    1213namespace Digest
    1214variable (q : Digest g)
    1215def feasible (l : Tag g) (f : Flavor g) := ∀ i,¬ Flavor.keeps f l (asBlock i) → q i=0
    1216
    1217def diagO := ∑ d : Tag g, ∑ t,q (.inl (d,t))
    1218
    1219def sumBit := q.diagO+q (.inr ())
    1220
    1221end Digest
    1222def dialed (p : Shape) {n} (l : Tag p.g) (f : Flavor p.g) (x : Knobs p.g n) :=
    1223 (scan p l f x).sumBit
    1224
    1225def spins (p : Shape) (n : ℕ) : Wgt (Knobs p.g n) := draws (Block p.g) unif
    1226
    1227/-- Projection notation for conditioning on a specified (possible)
    1228diagnostic or diagonal only. -/
    1229def scopedBit (p : Shape) (n : ℕ) (l : Tag p.g) (f : Flavor p.g) (q : F) :
    1230 Wgt (Knobs p.g n) := onW (spins p n) (fun x => dialed p l f x=q)
    1231
    1232def scopedScan (p : Shape) (n : ℕ) (l : Tag p.g) (f : Flavor p.g) (z : Digest p.g) :
    1233 Wgt (Knobs p.g n) := onW (spins p n) (fun x => scan p l f x=z)
    1234
    1235end HadwigerCounterexample
    1236end
    1237end Lax793645.ConstructionData.Binary
    1238end
    1239
    1240section
    1241namespace Lax793645.ConstructionData.Binary
    1242noncomputable section
    1243namespace HadwigerCounterexample
    1244open Matrix LinearMap Module Submodule Finset Function
    1245open scoped BigOperators
    1246variable {A B : Type} [Fintype A] [Fintype B]
    1247variable {I J U : Type} [Fintype I] [Fintype J] [Fintype U]
    1248variable [DecidableEq I] [DecidableEq J] [DecidableEq U]
    1249variable {p : Shape} {n N : ℕ}
    1250abbrev HMat (p : Shape) (N : ℕ) := Mat (Fin N) (Chan p)
    1251
    1252abbrev HFrame (p : Shape) (N : ℕ) := HMat p N × HMat p N
    1253
    1254abbrev HCube (p : Shape) (N : ℕ) := Comp p.g → HFrame p N
    1255
    1256end HadwigerCounterexample
    1257end
    1258end Lax793645.ConstructionData.Binary
    1259end
    1260
    1261section
    1262namespace Lax793645.ConstructionData.Binary
    1263noncomputable section
    1264namespace HadwigerCounterexample
    1265open Matrix LinearMap Module Submodule Finset
    1266open scoped BigOperators
    1267variable {p : Shape} {n : ℕ} {I J : Type} [Fintype I] [Fintype J]
    1268def nbBlock (p : Shape) := Fintype.card (Block p.g)
    1269
    1270def ncComp (p : Shape) := Fintype.card (Comp p.g)
    1271
    1272def dbits (p : Shape) (T R : ℕ) := ncComp p*2* psize p*(T+R)
    1273
    1274def drow (p : Shape) (T R : ℕ) := psize p+psize p*(nbBlock p* dbits p T R)
    1275
    1276end HadwigerCounterexample
    1277end
    1278end Lax793645.ConstructionData.Binary
    1279end
    1280
    1281section
    1282namespace Lax793645.ConstructionData.Binary
    1283noncomputable section
    1284namespace HadwigerCounterexample
    1285open scoped BigOperators
    1286def wsign (x : F) : ℝ := if x = 0 then 1 else -1
    1287
    1288variable {A B V W : Type} [Fintype A] [Fintype B]
    1289variable [AddCommGroup V] [Module F V] [AddCommGroup W] [Module F W] [Fintype V] [Fintype W]
    1290end HadwigerCounterexample
    1291end
    1292end Lax793645.ConstructionData.Binary
    1293end
    1294
    1295section
    1296namespace Lax793645.ConstructionData.Binary
    1297noncomputable section
    1298namespace HadwigerCounterexample
    1299open Matrix LinearMap
    1300open scoped BigOperators
    1301variable {I J K : Type} [Fintype I] [Fintype J] [Fintype K]
    1302 [DecidableEq I] [DecidableEq J] [DecidableEq K]
    1303variable (p : Shape)
    1304def profileA (K : ℕ) := 10*(K+1)* psize p*(p.g* p.g+5)
    1305
    1306open Filter
    1307end HadwigerCounterexample
    1308end
    1309end Lax793645.ConstructionData.Binary
    1310end
    1311
    1312section
    1313namespace Lax793645.ConstructionData.Binary
    1314noncomputable section
    1315namespace HadwigerCounterexample
    1316open Matrix LinearMap Module Submodule Finset
    1317open scoped BigOperators
    1318variable {p : Shape} {n N : ℕ} {J K : Type} [Fintype J] [Fintype K]
    1319abbrev PhasePair (p : Shape) (N : ℕ) := HCube p N × HCube p N
    1320
    1321abbrev Party := Vec Bool
    1322
    1323def uPhase (p : Shape) {N} (v : HCube p N) : Ambient p N →ₗ[F] F :=
    1324 ∑ e : Comp p.g, mpair ((v e).2*(v e).1ᵀ) ∘ₗ LinearMap.proj e
    1325
    1326def joinPhase (p : Shape) {N} (v : PhasePair p N) (o : Party) :=
    1327 ∑ b : Bool, o b • uPhase p (onSide v b)
    1328
    1329variable [DecidableEq J] [DecidableEq K]
    1330end HadwigerCounterexample
    1331end
    1332end Lax793645.ConstructionData.Binary
    1333end
    1334
    1335section
    1336namespace Lax793645.ConstructionData.Binary
    1337noncomputable section
    1338namespace HadwigerCounterexample
    1339open Matrix LinearMap Module Submodule Finset Function
    1340open scoped BigOperators
    1341variable {p : Shape} {r n N : ℕ}
    1342variable {q t : Place p→ ℕ} {S : Cov p N}
    1343def unary (i : Bool) : Party := Pi.single i 1
    1344
    1345variable {I J : Type} [Fintype I] [Fintype J]
    1346end HadwigerCounterexample
    1347end
    1348end Lax793645.ConstructionData.Binary
    1349end
    1350
    1351section
    1352namespace Lax793645.ConstructionData.Binary
    1353noncomputable section
    1354namespace HadwigerCounterexample
    1355open Matrix LinearMap Module Submodule Function Finset
    1356open scoped BigOperators
    1357variable {p : Shape} {n N r : ℕ} {T : Cov p N}
    1358namespace Bazaar
    1359end Bazaar
    1360def loseA (_ : Shape) (N x y : ℕ) := bp (-((x:ℝ)+y)* N+0.01* N)
    1361
    1362namespace Bazaar
    1363end Bazaar
    1364variable {A B V : Type} [Fintype A] [Fintype B] [Fintype V]
    1365variable [AddCommGroup V] [Module F V]
    1366end HadwigerCounterexample
    1367end
    1368end Lax793645.ConstructionData.Binary
    1369end
    1370
    1371section
    1372namespace Lax793645.ConstructionData.Binary
    1373noncomputable section
    1374namespace HadwigerCounterexample
    1375open Matrix LinearMap Module Finset
    1376open scoped BigOperators
    1377variable {p : Shape} {n N : ℕ} {A : Type} [Fintype A]
    1378def exponentErr (p : Shape) (m b : ℕ) (c : ℝ) :=
    1379 let s := 2^m*(2* b)
    1380 ((2:ℝ)^s*(2:ℝ)^s)* c^b + bp (- (p.h:ℝ)* b/2)
    1381
    1382end HadwigerCounterexample
    1383end
    1384end Lax793645.ConstructionData.Binary
    1385end
    1386
    1387section
    1388namespace Lax793645.ConstructionData.Binary
    1389noncomputable section
    1390namespace HadwigerCounterexample
    1391open Matrix LinearMap Module Submodule Function Finset
    1392open scoped BigOperators
    1393variable {p : Shape} {n N r : ℕ}
    1394variable {A : Type} [Fintype A]
    1395def rhUp (H c : ℝ) := (c/2)⁻¹ * H
    1396
    1397namespace Bazaar
    1398variable {T : Cov p N}
    1399end Bazaar
    1400end HadwigerCounterexample
    1401end
    1402end Lax793645.ConstructionData.Binary
    1403end
    1404
    1405section
    1406namespace Lax793645.ConstructionData.Binary
    1407noncomputable section
    1408namespace HadwigerCounterexample
    1409open Matrix LinearMap Module Finset Function
    1410open scoped BigOperators
    1411variable {p : Shape} {r n : ℕ} {A I : Type} [Fintype A] [Fintype I]
    1412variable [DecidableEq I]
    1413def scanPrice (p : Shape) : ℝ := (1/4)^Fintype.card (ProbeIdx p.g)
    1414
    1415def canDial (p : Shape) (l : Tag p.g) (f : Flavor p.g) (q : F) :=
    1416 ∃ v : Digest p.g, v.feasible l f ∧ v.sumBit=q
    1417
    1418end HadwigerCounterexample
    1419end
    1420end Lax793645.ConstructionData.Binary
    1421end
    1422
    1423section
    1424namespace Lax793645.ConstructionData.Binary
    1425noncomputable section
    1426namespace HadwigerCounterexample
    1427open Matrix Module LinearMap Finset Function
    1428open scoped BigOperators
    1429variable {I J G A B : Type} [Fintype I] [Fintype J] [Fintype A] [Fintype B]
    1430variable {p : Shape} {n N : ℕ}
    1431abbrev PlusRack (I : Type) (N : ℕ) := Mat (Fin N) I
    1432
    1433abbrev Rack (I : Type) (N : ℕ) := PlusRack I N × PlusRack I N
    1434
    1435abbrev Route (I G : Type) := I → G
    1436
    1437abbrev Port {I G : Type} (f : Route I G) (g : G) := {i:I//f i=g}
    1438
    1439variable [Fintype G]
    1440variable [DecidableEq I] [DecidableEq J] [DecidableEq G]
    1441variable {f : Route I G}
    1442abbrev GeoM (f : Route I G) := ∀ i,Mat (Port f i) (Port f i)
    1443
    1444end HadwigerCounterexample
    1445end
    1446end Lax793645.ConstructionData.Binary
    1447end
    1448
    1449section
    1450namespace Lax793645.ConstructionData.Binary
    1451noncomputable section
    1452namespace HadwigerCounterexample
    1453open Matrix Module Finset Filter
    1454open scoped BigOperators
    1455variable {p : Shape} {n N : ℕ}
    1456variable {I A B : Type} [Fintype I] [Fintype A] [Fintype B]
    1457def density (v w : Wgt I) := fun x => w x/v x
    1458def overlap (v a b : Wgt I) := avg v (fun x => density v a x * density v b x)
    1459def lsupp (p q : Wgt I) := ∀ x,p x ≠ 0 → q x ≠ 0
    1460
    1461
    1462namespace Volley
    1463end Volley
    1464end HadwigerCounterexample
    1465end
    1466end Lax793645.ConstructionData.Binary
    1467end
    1468
    1469section
    1470namespace Lax793645.ConstructionData.Binary
    1471noncomputable section
    1472namespace HadwigerCounterexample
    1473open scoped BigOperators
    1474open Matrix Module LinearMap Function
    1475variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    1476structure Template (p : Shape) (I : Type) where
    1477 aim : I→ Bool
    1478 t : Tagging p I
    1479 s : I→ Label p.b
    1480 f : I→ Flavor p.g
    1481
    1482abbrev Inputs (p : Shape) (n : ℕ) (I : Type) := I → Knobs p.g n
    1483
    1484namespace Template
    1485variable (v : Template p I)
    1486def draw (y : Inputs p n I) : Volley p n I where
    1487 obj := v.aim
    1488 sel := v.s
    1489 par i := lit (v.f i) (v.t i) (y i)
    1490
    1491def state (q : I→ F) (n : ℕ) : Wgt (Inputs p n I) :=
    1492 prodW (fun i : I => scopedBit p n (v.t i) (v.f i) (q i))
    1493
    1494end Template
    1495abbrev KeySlots (p : Shape) (t : Tagging p I) := Σ i, TagStar (t i)
    1496
    1497instance keySlotsFintype (t : Tagging p I) : Fintype (KeySlots p t) := by
    1498 classical
    1499 infer_instance
    1500
    1501def ownPort (t : Tagging p I) : Route (KeySlots p t) (Comp p.g) := fun x => x.2.val
    1502
    1503def ownMap (t : Tagging p I) (q : I→ F) : GeoM (ownPort (p:=p) t) :=
    1504 fun _ => Matrix.diagonal (fun i => q i.val.1)
    1505
    1506def ownOne (p : Shape) {N : ℕ} (l : Tag p.g) (q : F) (x : AtomKey (p:=p) l N) :=
    1507 ∀ i,dotProduct (x i true) (x i false) = q
    1508
    1509def lawOmega (p : Shape) (N : ℕ) (l : Tag p.g) (q : F) :
    1510 Wgt (AtomKey (p:=p) l N) := unifOn (ownOne p l q)
    1511
    1512end HadwigerCounterexample
    1513end
    1514end Lax793645.ConstructionData.Binary
    1515end
    1516
    1517section
    1518namespace Lax793645.ConstructionData.Binary
    1519noncomputable section
    1520namespace HadwigerCounterexample
    1521open scoped BigOperators
    1522open Matrix Module LinearMap Submodule Finset Function
    1523variable {p : Shape} {n N : ℕ}
    1524variable {I J K A B : Type} [Fintype I] [Fintype J] [Fintype K]
    1525variable [DecidableEq I] [DecidableEq J] [DecidableEq K]
    1526def layerPhase (M : Mat I J) (N : ℕ) :
    1527 PlusRack I N →ₗ[F] (PlusRack J N →ₗ[F] F) where
    1528 toFun X := mpair (X* M)
    1529 map_add' X Y := LinearMap.ext fun Z => by rw [Matrix.add_mul,mpair_add,LinearMap.add_apply]
    1530 map_smul' a X := LinearMap.ext fun Z => by rw [Matrix.smul_mul,mpair_smul,LinearMap.smul_apply]; rfl
    1531
    1532end HadwigerCounterexample
    1533end
    1534end Lax793645.ConstructionData.Binary
    1535end
    1536
    1537section
    1538namespace Lax793645.ConstructionData.Binary
    1539noncomputable section
    1540namespace HadwigerCounterexample
    1541open Matrix Module LinearMap Function Finset
    1542open scoped BigOperators
    1543variable {I J : Type} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J]
    1544 {N : ℕ}
    1545def vectorPhase (x y : Vec I) := wsign (dotProduct x y)
    1546
    1547abbrev Rail (I : Type) := Finset (I × I)
    1548
    1549variable {E : Rail I}
    1550def withinRail (M : Mat I I) (E : Rail I) :=
    1551 ∀ i j, (i,j)∉ E→ M i j=0
    1552
    1553def crowded (g : Route I J) : Rail I := Finset.univ.filter (fun x => g x.1=g x.2)
    1554
    1555end HadwigerCounterexample
    1556end
    1557end Lax793645.ConstructionData.Binary
    1558end
    1559
    1560section
    1561namespace Lax793645.ConstructionData.Binary
    1562noncomputable section
    1563namespace HadwigerCounterexample
    1564open scoped BigOperators
    1565open Matrix LinearMap Module Submodule Function Finset
    1566variable {p : Shape} {n N : ℕ}
    1567variable {I J G : Type} [Fintype I] [Fintype J] [Fintype G]
    1568variable [DecidableEq I] [DecidableEq J] [DecidableEq G]
    1569instance knFin (g n : ℕ) : Fintype (Knobs g n) := inferInstanceAs (Fintype (Knobs g n))
    1570
    1571def freePart (p : Shape) {n} (x : Knobs p.g n) := x Block.Z
    1572
    1573variable {g : Route I G}
    1574namespace Template
    1575variable (v : Template p I)
    1576end Template
    1577end HadwigerCounterexample
    1578end
    1579end Lax793645.ConstructionData.Binary
    1580end
    1581
    1582section
    1583namespace Lax793645.ConstructionData.Binary
    1584noncomputable section
    1585namespace HadwigerCounterexample
    1586open Matrix
    1587open scoped BigOperators
    1588variable {p : Shape} {n : ℕ}
    1589abbrev MIdx (p : Shape) := Fin p.J × Comp p.g × Comp p.g
    1590
    1591abbrev MOne (p : Shape) := (MIdx p × Bool)
    1592
    1593def orderedM (m : Mixer p n) (i : MOne p) : Moment p n :=
    1594 if i.2 then m.mixL i.1.1 i.1.2.1 i.1.2.2 else m.mixR i.1.1 i.1.2.1 i.1.2.2
    1595
    1596def eitherM (b : Bool) {I : Type} (A : Mat I I) := if b then A else Aᵀ
    1597
    1598def selfSum (m : Mixer p n) (f : Vec Bool) :=
    1599 ∑ i : Bool,f i • eitherM i (selfM p n m.mixM)
    1600
    1601def blockRank (d : Block p.g) (s t : Label p.b) (A : Moment p n) :=
    1602 (pullM (blockRay p n s d) (blockRay p n t d) A).rank
    1603
    1604/-- Matrix on a point's v coordinates for Tmix(x,atom_l). -/
    1605def qmix (m : Mixer p n) (x : Profile p n) (l : Tag p.g) : Moment p n :=
    1606 ∑ j : Fin p.J, ∑ f : TagStar l, ∑ e : Comp p.g,
    1607 (liftM (m.mixL j e f.val)ᵀ (m.mixR j e f.val)ᵀ (x e) +
    1608 liftM (m.mixL j f.val e) (m.mixR j f.val e) (x e))
    1609
    1610def unaryGood (m : Mixer p n) (K s0 : ℕ) :=
    1611 ∀ (x : Profile p n) (l : Tag p.g) (s : Label p.b), totalRank x ≤ K → totalRank x > 0 →
    1612 2*(p.J-s0) ≤ blockRank Block.Z s s (qmix m x l + (qmix m x l)ᵀ)
    1613
    1614end HadwigerCounterexample
    1615end
    1616end Lax793645.ConstructionData.Binary
    1617end
    1618
    1619section
    1620namespace Lax793645.ConstructionData.Binary
    1621noncomputable section
    1622namespace HadwigerCounterexample
    1623open Finset Matrix Module Function
    1624open scoped BigOperators
    1625variable {I J A : Type} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] [Fintype A]
    1626def prism (B : J → Type) [∀ i,Fintype (B i)] [∀ i,DecidableEq (B i)] :
    1627 Wgt (∀ i,Vec (B i)) := prodW (fun _ : J => unif)
    1628
    1629def wavelength (B : J → Type) [∀ i,Fintype (B i)] [∀ i,DecidableEq (B i)] :=
    1630 prism B 0
    1631
    1632end HadwigerCounterexample
    1633end
    1634end Lax793645.ConstructionData.Binary
    1635end
    1636
    1637section
    1638namespace Lax793645.ConstructionData.Binary
    1639noncomputable section
    1640namespace HadwigerCounterexample
    1641open scoped BigOperators
    1642open Matrix Finset
    1643variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I]
    1644/-- list for a cross edge -/
    1645def aiming (a b : I → Bool) (i j : Bool) :=
    1646 Finset.univ.filter (fun x => a x=i ∧ b x=j)
    1647
    1648/-- within-endpoint L/R bit tests. Read only a x=a y, x≠y.
    1649(tests between ordered points; no double counting since L,R and
    1650both orientations are in the mixer hypothesis). -/
    1651abbrev Script (p : Shape) (I : Type) := I → I → Vec (MOne p)
    1652
    1653namespace Volley
    1654variable (v : Volley p n I)
    1655def reads (s : Script p I) (m : Mixer p n) :=
    1656 ∀ x y : I,x≠y → v.obj x=v.obj y →
    1657 ∀ i : MOne p, s x y i = evmat (orderedM m i) (v.rayAt x) (v.rayAt y)
    1658
    1659end Volley
    1660def prescribedB (p : Shape) (t : Tagging p I) (s : Script p I) (x y : I) :=
    1661 ∑ i : Fin p.J,∑ e : Comp p.g, ∑ f : Comp p.g, if inc e (t x) ∧ inc f (t y) then
    1662 s x y ((i,e,f),true)* s x y ((i,e,f),false) else 0
    1663
    1664noncomputable def prescribedT (p : Shape) (t : Tagging p I) (d : Vec I)
    1665 (h : Mat I I) (s : Script p I) (x y : I) : F :=
    1666 @ite _ (x=y) (Classical.propDecidable _) (d x)
    1667 (h x y+(prescribedB p t s x y+prescribedB p t s y x))
    1668
    1669def fulfills (p : Shape) (t : Tagging p I) (d f : Vec I) (u : Mat I I)
    1670 (s : Script p I) (a b : I → Bool) :=
    1671 ∀ (x : I) (j : Bool),
    1672 d x+ (∑ i∈aiming a b (a x) j, prescribedT p t d u s i x) =
    1673 if j=b x then 0 else f x
    1674
    1675namespace Volley
    1676variable {v : Volley p n I}
    1677end Volley
    1678end HadwigerCounterexample
    1679end
    1680end Lax793645.ConstructionData.Binary
    1681end
    1682
    1683section
    1684namespace Lax793645.ConstructionData.Binary
    1685noncomputable section
    1686namespace HadwigerCounterexample
    1687open Finset Matrix Function LinearMap
    1688open scoped BigOperators
    1689variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    1690namespace Template
    1691variable (v : Template p I)
    1692abbrev SameDuet (v : Template p I) :=
    1693 {i : I×I//v.aim i.1=v.aim i.2 ∧ Fintype.equivFin I i.1< Fintype.equivFin I i.2}
    1694
    1695abbrev OppDuet (v : Template p I) := {i:I×I//v.aim i.1=true∧v.aim i.2=false}
    1696
    1697abbrev Chorus (v : Template p I) := v.SameDuet ⊕ v.OppDuet
    1698
    1699instance : Fintype v.SameDuet := inferInstance
    1700
    1701instance : Fintype v.OppDuet := inferInstance
    1702
    1703/-- Self-Gram bits are tested only when the tags share a component. -/
    1704def sharesComponent (p : Shape) (l d : Tag p.g) :=
    1705 ∃ e : Comp p.g, inc e l ∧ inc e d
    1706
    1707instance (p : Shape) (l d : Tag p.g) : Decidable (sharesComponent p l d) :=
    1708 inferInstanceAs (Decidable (∃ e : Comp p.g, inc e l ∧ inc e d))
    1709
    1710end Template
    1711end HadwigerCounterexample
    1712end
    1713end Lax793645.ConstructionData.Binary
    1714end
    1715
    1716section
    1717namespace Lax793645.ConstructionData.Binary
    1718noncomputable section
    1719namespace HadwigerCounterexample
    1720open scoped BigOperators
    1721open Matrix Finset Filter Function LinearMap
    1722variable {p : Shape} {n N : ℕ}
    1723namespace Template
    1724def solo (p : Shape) (t : Tag p.g) (s : Label p.b) (f : Flavor p.g) :
    1725 Template p Unit := ⟨fun _ => true,fun _=> t,fun _ => s,fun _=> f⟩
    1726
    1727abbrev Solo (p : Shape) := Template p Unit
    1728
    1729variable (v : Solo p)
    1730end Template
    1731end HadwigerCounterexample
    1732end
    1733end Lax793645.ConstructionData.Binary
    1734end
    1735
    1736section
    1737namespace Lax793645.ConstructionData.Binary
    1738noncomputable section
    1739namespace HadwigerCounterexample
    1740open Finset Real
    1741open scoped BigOperators
    1742variable {A B C : Type} [Fintype A] [Fintype B] [Fintype C]
    1743def varOne (p q : Wgt A) := ∑ x, |p x-q x|
    1744
    1745end HadwigerCounterexample
    1746end
    1747end Lax793645.ConstructionData.Binary
    1748end
    1749
    1750section
    1751namespace Lax793645.ConstructionData.Binary
    1752noncomputable section
    1753namespace HadwigerCounterexample
    1754open Matrix Module LinearMap Finset Filter Function
    1755open scoped BigOperators
    1756variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    1757def glintRate (K : ℕ) := bp (-((K^2:ℕ):ℝ)-3)
    1758
    1759namespace Template
    1760variable (v : Solo p)
    1761def stains (m : Mixer p n) (f : Vec I →ₗ[F] Profile p n) (z : Knobs p.g n) : Vec I :=
    1762 fun i=> Tsym m (f (Pi.single i 1)) (useAtom p (v.t ()) (v.s ()) (v.f ()) z)
    1763
    1764end Template
    1765end HadwigerCounterexample
    1766end
    1767end Lax793645.ConstructionData.Binary
    1768end
    1769
    1770section
    1771namespace Lax793645.ConstructionData.Binary
    1772noncomputable section
    1773namespace HadwigerCounterexample
    1774open Finset Matrix Module LinearMap Function Filter
    1775open scoped BigOperators
    1776variable {p : Shape} {n N : ℕ}
    1777namespace Template
    1778variable (v : Solo p)
    1779variable {K s : ℕ}
    1780def basebeta (p : Shape) (K : ℕ) :=
    1781 bp (-((K^2:ℕ):ℝ)-1)* scanPrice p
    1782
    1783end Template
    1784end HadwigerCounterexample
    1785end
    1786end Lax793645.ConstructionData.Binary
    1787end
    1788
    1789section
    1790namespace Lax793645.ConstructionData.Binary
    1791noncomputable section
    1792namespace HadwigerCounterexample
    1793open Matrix Module LinearMap Function Finset Submodule
    1794open scoped BigOperators
    1795variable {p : Shape} {n N : ℕ}
    1796def silent (w : Pdual p n) := ∀ x, x∈Xspace p n → w x=0
    1797
    1798end HadwigerCounterexample
    1799end
    1800end Lax793645.ConstructionData.Binary
    1801end
    1802
    1803section
    1804namespace Lax793645.ConstructionData.Frames
    1805open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    1806open Function Finset
    1807open scoped BigOperators
    1808noncomputable section
    1809set_option backward.isDefEq.respectTransparency false
    1810variable {V Q A B T : Type} [AddCommGroup V] [Module F V]
    1811/-- One set of linear coordinates works for every status of the prefix
    1812(in particular, both possible diagonal bits). -/
    1813def HasLinearCells (f : Q→ V→ A) (R : ℕ) : Prop :=
    1814 ∃ r : ℕ,r≤ R ∧ ∃ L : V→ₗ[F] Vec (Fin r),∃ φ : Q→ Vec (Fin r)→ A,
    1815 ∀ q x,f q x=φ q (L x)
    1816
    1817variable {p : Shape} {N : ℕ}
    1818end
    1819end Lax793645.ConstructionData.Frames
    1820end
    1821
    1822section
    1823namespace Lax793645.ConstructionData.Binary
    1824noncomputable section
    1825namespace HadwigerCounterexample
    1826open Matrix LinearMap Submodule Finset Function Module
    1827open scoped BigOperators
    1828namespace StatusAnalysis
    1829abbrev Nodes := Bool
    1830
    1831abbrev Grid := Nodes × Nodes
    1832
    1833abbrev Cell (d : ℕ) := Vec (Fin d)
    1834
    1835abbrev Par (d : ℕ) := F × Cell d
    1836
    1837abbrev Whole (d : ℕ) := Par d × F
    1838
    1839abbrev Signal (d e : ℕ) := F × Whole d × Whole e
    1840
    1841abbrev View (d e : ℕ) := F × Par d × Par e
    1842
    1843abbrev Question (d e : ℕ) := F × F × Cell d × Cell e
    1844
    1845variable {d e : ℕ}
    1846def view (d e : ℕ) : Signal d e→ₗ[F] View d e where
    1847 toFun x := (x.1,x.2.1.1,x.2.2.1)
    1848 map_add' _ _ := rfl
    1849 map_smul' _ _ := rfl
    1850
    1851def testV (d e : ℕ) : View d e →ₗ[F] Question d e where
    1852 toFun x := (x.1,x.2.1.1 + x.2.2.1,x.2.1.2,x.2.2.2)
    1853 map_add' _ _ := Prod.ext rfl (Prod.ext (add_add_add_comm ..) rfl)
    1854 map_smul' _ _ := Prod.ext rfl (Prod.ext (mul_add _ _ _).symm rfl)
    1855
    1856def want (d e : ℕ) := testV d e ∘ₗ view d e
    1857
    1858def couple (d : ℕ) : Whole d→ₗ[F] F where
    1859 toFun x := x.1.1+x.2
    1860 map_add' _ _ := add_add_add_comm ..
    1861 map_smul' a _ := (mul_add a _ _).symm
    1862
    1863def coverBase (V : Space (Signal d e)) := Surjective (view d e ∘ₗ V.subtype)
    1864
    1865abbrev Rates := Nodes→ ℕ
    1866
    1867abbrev Suite (A B : Rates) (i : Grid) := Signal (A i.1) (B i.2)
    1868
    1869abbrev LedgerS (A B : Rates) (i : Grid) := Question (A i.1) (B i.2)
    1870
    1871abbrev Cabinet (A B : Rates) := ∀ i, LedgerS A B i
    1872
    1873abbrev Quota := Vec Nodes
    1874
    1875abbrev Court (A B : Rates) := Cabinet A B × Quota × Quota
    1876
    1877abbrev StatusSp (A B : Rates) := ∀ i,Space (Suite A B i)
    1878
    1879variable {A B : Rates}
    1880def separate (A B : Rates) (i : Grid) :
    1881 Suite A B i →ₗ[F] Court A B :=
    1882 (LinearMap.single F (LedgerS A B) i ∘ₗ want _ _).prod
    1883 ((LinearMap.single F (fun _ : Bool=> F) i.2 ∘ₗ
    1884 (couple (A i.1) ∘ₗ LinearMap.fst F _ _ ∘ₗ LinearMap.snd F _ _)).prod
    1885 (LinearMap.single F (fun _ : Bool=> F) i.1 ∘ₗ
    1886 (couple (B i.2) ∘ₗ LinearMap.snd F _ _ ∘ₗ LinearMap.snd F _ _)))
    1887
    1888def speak (A B : Rates) :
    1889 (∀ i,Suite A B i) →ₗ[F] Court A B := ∑ i:Grid,separate A B i ∘ₗ LinearMap.proj i
    1890
    1891def scorecard (V : StatusSp A B) (T : Cabinet A B) :=
    1892 ∃ v : ∀ i,Suite A B i,(∀ i,v i∈V i) ∧ speak A B v=(T,0)
    1893
    1894structure Critic (A B : Rates) where
    1895 alf : ∀ i : Grid, LedgerS A B i →ₗ[F] F
    1896 altL : Quota
    1897 altR : Quota
    1898
    1899def Counter (g : Critic A B) (V : StatusSp A B) :=
    1900 ∀ i:Grid,∀ v∈V i, g.alf i (want _ _ v) =
    1901 g.altL i.2 * couple _ v.2.1 + g.altR i.1 * couple _ v.2.2
    1902
    1903end StatusAnalysis
    1904end HadwigerCounterexample
    1905end
    1906end Lax793645.ConstructionData.Binary
    1907end
    1908
    1909section
    1910namespace Lax793645.ConstructionData.Binary
    1911noncomputable section
    1912namespace HadwigerCounterexample
    1913open Finset Matrix Module LinearMap Submodule Function
    1914open scoped BigOperators
    1915namespace StatusAnalysis
    1916variable {A B : Rates} {d e : ℕ}
    1917structure DualCoefficients (A B : Rates) where
    1918 left : Quota
    1919 right : Quota
    1920 gam : Grid→ F
    1921 hed : Grid→ F
    1922 north : (i:Grid)→ Cell (A i.1)
    1923 south : (i:Grid)→ Cell (B i.2)
    1924
    1925end StatusAnalysis
    1926end HadwigerCounterexample
    1927end
    1928end Lax793645.ConstructionData.Binary
    1929end
    1930
    1931section
    1932namespace Lax793645.ConstructionData.Binary
    1933noncomputable section
    1934namespace HadwigerCounterexample
    1935open Finset Matrix Function LinearMap Submodule Module
    1936open scoped BigOperators
    1937namespace StatusAnalysis
    1938variable {L I X Y : Type} [DecidableEq L] [DecidableEq I] [AddCommGroup X]
    1939 [Module F X] [AddCommGroup Y] [Module F Y]
    1940structure Club (I X L : Type) where
    1941 valid : I→ Prop
    1942 writes : I→ X
    1943 addr : I→ Bool→ L
    1944
    1945abbrev Straps (L : Type) := Bool→ Finset L
    1946
    1947variable (C : Club I X L)
    1948namespace Club
    1949def zone (s : Straps L) (i) := C.valid i ∧ ∀ b,C.addr i b∉s b
    1950
    1951def band (s : Straps L) : Space X := Submodule.span F {x|∃ i, C.zone s i∧C.writes i=x}
    1952
    1953def bundle (p : Finset I) (s : Straps L) :=
    1954 (∀ i∈p,zone C s i) ∧ ∀ b : Bool, Set.InjOn (fun i => C.addr i b) (p : Set I)
    1955
    1956def contents (p : Finset I) := ∑ i∈p,C.writes i
    1957
    1958end Club
    1959end StatusAnalysis
    1960end HadwigerCounterexample
    1961end
    1962end Lax793645.ConstructionData.Binary
    1963end
    1964
    1965section
    1966namespace Lax793645.ConstructionData.Binary
    1967noncomputable section
    1968namespace HadwigerCounterexample
    1969open Matrix Module LinearMap Submodule Function Finset
    1970open scoped BigOperators
    1971namespace StatusAnalysis
    1972variable {I L : Type} [DecidableEq L] [DecidableEq I] {d e : ℕ}
    1973open Club
    1974variable {I : Grid → Type} [∀ i,DecidableEq (I i)] {A B : Rates}
    1975abbrev Congress (I : Grid→ Type) (A B : Rates) (L : Type) := ∀ i,Club (I i) (Suite A B i) L
    1976
    1977namespace Guild
    1978variable (C : Congress I A B L)
    1979abbrev Bags (I : Grid → Type) := ∀ i,Finset (I i)
    1980def chapter (s : Straps L) : ∀ i,Space (Suite A B i) := fun i => (C i).band s
    1981end Guild
    1982end StatusAnalysis
    1983end HadwigerCounterexample
    1984end
    1985end Lax793645.ConstructionData.Binary
    1986end
    1987
    1988section
    1989namespace Lax793645.ConstructionData.Binary
    1990noncomputable section
    1991namespace HadwigerCounterexample
    1992open Finset Matrix Function Module LinearMap Submodule
    1993open scoped BigOperators
    1994namespace StatusAnalysis
    1995abbrev Ax (p : Shape) (n : ℕ) (d : ℕ) := Cell d→ₗ[F] Profile p n
    1996
    1997abbrev Charts (p : Shape) (n : ℕ) (d : Rates) := ∀ i, Ax p n (d i)
    1998
    1999variable {p : Shape} {n N : ℕ} {d e : Rates}
    2000abbrev Format := Grid→ ℕ
    2001
    2002abbrev Messenger (q : Format) := Σ i:Grid,Fin (q i)
    2003
    2004def sendId (b : Bool) (i : Grid) := if b then i.1 else i.2
    2005
    2006def transit (b : Bool) (q : Grid) := if b then q else (q.2,q.1)
    2007
    2008def parcel (b : Bool) {q : Format} (x : Messenger q) := sendId b x.1
    2009
    2010def manager {q : Format} (b : Bool) (t : Tagging p (Messenger q)) (s : Messenger q→ Label p.b)
    2011 (f : Messenger q→ Flavor p.g) : Template p (Messenger q) := ⟨parcel b,t,s,f⟩
    2012
    2013def roll {u : ℕ} (f : Ax p n u) (g : Pdual p n) : Cell u := fun i=> g (f (Pi.single i 1))
    2014
    2015abbrev Magazine (p : Shape) (d : ℕ) := Digest p.g × Whole d
    2016
    2017variable {q : Format}
    2018abbrev Amounts (p : Shape) (q : Format) (d : Rates) (b : Bool) :=
    2019 ∀ i:Messenger q,Magazine p (d (parcel b i))
    2020
    2021variable {H : Type} [AddCommMonoid H]
    2022end StatusAnalysis
    2023end HadwigerCounterexample
    2024end
    2025end Lax793645.ConstructionData.Binary
    2026end
    2027
    2028section
    2029namespace Lax793645.ConstructionData.Binary
    2030noncomputable section
    2031namespace HadwigerCounterexample
    2032open Matrix Module LinearMap Submodule Finset Function
    2033open scoped BigOperators
    2034namespace StatusAnalysis
    2035variable {d e : Rates} {p : Shape} {n N : ℕ} {q : Format}
    2036def funds {b : Bool} (x : Amounts p q d b) (i : Grid) :
    2037 Whole (d (sendId b i)) :=
    2038 ∑ k: Fin (q i),(x (⟨i,k⟩ : Messenger q)).2
    2039
    2040def fullq (z : Messenger q → F) (i : Grid) := ∑ k:Fin (q i),z ⟨i,k⟩
    2041
    2042def rhyme {b : Bool} (a : Amounts p q d b) (x : Amounts p q e (!b)) :=
    2043 ∀ i:Grid,(funds a i).1.1+(funds x i).1.1=1
    2044
    2045end StatusAnalysis
    2046end HadwigerCounterexample
    2047end
    2048end Lax793645.ConstructionData.Binary
    2049end
    2050
    2051section
    2052namespace Lax793645.ConstructionData.Binary
    2053noncomputable section
    2054namespace HadwigerCounterexample
    2055open Finset Matrix Function LinearMap Module Submodule
    2056open scoped BigOperators
    2057namespace StatusAnalysis
    2058variable {p : Shape} {n N : ℕ} {q : Format} {d e : Rates}
    2059def owing (p : Shape) {q : Format} {d : Rates}
    2060 (b : Bool) (a : Amounts p q d b) (u : Messenger q→ F) :=
    2061 ∀ i,(a i).1.sumBit=u i
    2062
    2063end StatusAnalysis
    2064end HadwigerCounterexample
    2065end
    2066end Lax793645.ConstructionData.Binary
    2067end
    2068
    2069section
    2070namespace Lax793645.ConstructionData.Binary
    2071noncomputable section
    2072namespace HadwigerCounterexample
    2073open Finset Matrix Module LinearMap Function Submodule
    2074open scoped BigOperators
    2075namespace StatusAnalysis
    2076variable {p : Shape} {n N : ℕ} {q : Format} {d e : Rates}
    2077def mailRole {b} (a : Amounts p q d b) :=
    2078 fun i=>(a i).2.1.1
    2079
    2080def mailBias {b} (a : Amounts p q d b) :=
    2081 fun i=>(a i).2.2
    2082
    2083def TMill (p : Shape) {b} {d} (t : Tagging p (Messenger q)) (w : Amounts p q d b) :
    2084 Mat (Messenger q) (Messenger q) :=
    2085 let a (x : Tag p.g) (i : Messenger q) := ∑ z:Tag p.g,(w i).1 (Sum.inl (z,x))
    2086 let f (x : Tag p.g) (i : Messenger q) :=
    2087 let c:=(w i).1 (Sum.inr ())
    2088 c+(if t i=x then c else 0)
    2089 Matrix.of fun i j => mailRole w i * mailRole w j +
    2090 ∑ x:Tag p.g,(a x i * f x j + f x i * a x j)
    2091
    2092def proclaims {b : Bool} (p : Shape) {d e}
    2093 (a : Amounts p q d b) (w : Amounts p q e (!b)) (t : Tagging p (Messenger q))
    2094 (g : Script p (Messenger q)) :=
    2095 fulfills p t (mailRole a) (mailBias w) (TMill p t a) g (parcel b) (parcel (!b))
    2096
    2097end StatusAnalysis
    2098end HadwigerCounterexample
    2099end
    2100end Lax793645.ConstructionData.Binary
    2101end
    2102
    2103section
    2104namespace Lax793645.ConstructionData.Binary
    2105noncomputable section
    2106namespace HadwigerCounterexample
    2107open Matrix LinearMap Module Submodule Function Finset
    2108open scoped BigOperators
    2109variable {p : Shape} {n N r : ℕ}
    2110def maxSpan (m b r : ℕ) := r*(2^m*(2* b))
    2111
    2112end HadwigerCounterexample
    2113end
    2114end Lax793645.ConstructionData.Binary
    2115end
    2116
    2117section
    2118namespace Lax793645.ConstructionData.Binary
    2119noncomputable section
    2120namespace HadwigerCounterexample
    2121open scoped BigOperators
    2122open Finset
    2123variable {A : Type} [Fintype A]
    2124abbrev Tiles (A : Type) := Finset (Finset A)
    2125
    2126def inTiles (T : Tiles A) := fun x:A => ∃ i∈ T,x∈i
    2127
    2128def apart (T : Tiles A) :=
    2129 ∀ x,∀ S∈T, ∀ F∈ T,x∈S→ x∈F→ S=F
    2130
    2131def partMass (w : Wgt A) (S : Finset A) := pr w (fun x => x∈S)
    2132
    2133def partW (w : Wgt A) (S : Finset A) := onW w (fun x => x∈S)
    2134
    2135def allMass (w : Wgt A) (T : Tiles A) := pr w (inTiles T)
    2136
    2137def allW (w : Wgt A) (T : Tiles A) := onW w (inTiles T)
    2138
    2139variable {w : Wgt A} {T : Tiles A}
    2140def portionW (w : Wgt A) (T : Tiles A) : Wgt T :=
    2141 fun x => partMass w x.val / allMass w T
    2142
    2143end HadwigerCounterexample
    2144end
    2145end Lax793645.ConstructionData.Binary
    2146end
    2147
    2148section
    2149namespace Lax793645.ConstructionData.Binary
    2150noncomputable section
    2151namespace HadwigerCounterexample
    2152open Filter Real Finset
    2153open scoped Topology
    2154variable {A B : Type} {l : Filter A} {U : Ultrafilter A} {x y z v a : A → ℝ}
    2155/-- At least subexponential mass. -/
    2156def warm (l : Filter A) (z x : A→ ℝ) :=
    2157 ∀ ε:ℝ,0<ε → ∀ᶠ i in l,bp (-ε * z i) ≤ x i
    2158
    2159namespace warm
    2160end warm
    2161namespace ExpSmall
    2162end ExpSmall
    2163end HadwigerCounterexample
    2164end
    2165end Lax793645.ConstructionData.Binary
    2166end
    2167
    2168section
    2169namespace Lax793645.ConstructionData.Binary
    2170noncomputable section
    2171namespace HadwigerCounterexample
    2172open scoped BigOperators Topology
    2173open Filter
    2174variable {p : Shape} {n N : ℕ}
    2175def mstep (r : ℕ) := 100* r+10
    2176
    2177def Bstep (r : ℕ) := 2^(mstep r)*2
    2178
    2179def denomStep (r : ℕ) := 10000*(r+1)^2* Bstep r
    2180
    2181def stage (g r : ℕ) (D : ℝ) := 2* r* num (Comp g)+D+1
    2182
    2183def pcoef (g r : ℕ) (D : ℝ) :=
    2184 12* Bstep r+2*(denomStep r:ℝ)* stage g r D
    2185
    2186def tinyPhase (g r : ℕ) (D : ℝ) := bp (-(pcoef g r D))
    2187
    2188def warn := bp (-10)
    2189
    2190def coin : ℝ := 0.0001
    2191
    2192def heatloss (r k : ℕ) := 0.001 / (4*(r:ℝ)+k+1 : ℝ)
    2193
    2194end HadwigerCounterexample
    2195end
    2196end Lax793645.ConstructionData.Binary
    2197end
    2198
    2199section
    2200namespace Lax793645.ConstructionData.Binary
    2201noncomputable section
    2202namespace HadwigerCounterexample
    2203open Matrix LinearMap Module Submodule Function Finset
    2204open scoped BigOperators
    2205variable {p : Shape} {n N : ℕ}
    2206variable {A B : Type}
    2207def named (P : A×A → Prop) (C : ℝ) :=
    2208 ∃ k : ℕ,(k:ℝ) ≤ C ∧ ∃ S : Fin k → A → Prop,∀ y,∃ i,∀ x,P (x,y)↔S i x
    2209
    2210end HadwigerCounterexample
    2211end
    2212end Lax793645.ConstructionData.Binary
    2213end
    2214
    2215section
    2216namespace Lax793645.ConstructionData.Binary
    2217noncomputable section
    2218namespace HadwigerCounterexample
    2219open Matrix LinearMap Module Submodule Function Finset Filter
    2220open scoped BigOperators Topology
    2221variable {p : Shape} {n N : ℕ}
    2222def shine (N : ℕ) := bp (0.01* N)
    2223
    2224def edgeError (N : ℕ) := bp (-0.005* N)
    2225
    2226end HadwigerCounterexample
    2227end
    2228end Lax793645.ConstructionData.Binary
    2229end
    2230
    2231section
    2232namespace Lax793645.ConstructionData.Binary
    2233noncomputable section
    2234namespace HadwigerCounterexample
    2235open Matrix LinearMap Module Submodule Function Finset
    2236open scoped BigOperators
    2237variable {p : Shape} {n N : ℕ} {A B V : Type} [Fintype A] [Fintype B]
    2238def allSide : Party := fun _ => 1
    2239
    2240variable [AddCommGroup V] [Module F V] [FiniteDimensional F V]
    2241end HadwigerCounterexample
    2242end
    2243end Lax793645.ConstructionData.Binary
    2244end
    2245
    2246section
    2247namespace Lax793645.ConstructionData.Binary
    2248noncomputable section
    2249namespace HadwigerCounterexample
    2250open Matrix Module Finset
    2251open scoped BigOperators
    2252variable {p : Shape} {n N : ℕ}
    2253abbrev Quad := Party × Party
    2254
    2255def repeatQ (i : F) : Quad := (fun _ => i,fun _ => i)
    2256
    2257end HadwigerCounterexample
    2258end
    2259end Lax793645.ConstructionData.Binary
    2260end
    2261
    2262section
    2263namespace Lax793645.ConstructionData.Binary
    2264noncomputable section
    2265namespace HadwigerCounterexample
    2266open Filter Matrix Finset
    2267open scoped BigOperators Topology
    2268inductive PredictionClass
    2269| dusk
    2270| dawn (i : Bool)
    2271| twinned
    2272| noon
    2273deriving Inhabited, DecidableEq
    2274
    2275variable {p : Shape}
    2276namespace PredictionClass
    2277def active : PredictionClass→ Bool→ Prop
    2278| dusk,_=> False
    2279| dawn i,j=> i=j
    2280| twinned,_=> True
    2281| noon,_=> True
    2282
    2283def firstBit (α : Party) (i : Bool) := 1+α i
    2284
    2285def lit (c : PredictionClass) (α : Party) :=
    2286 (∀ i,¬c.active i → firstBit α i=0) ∧
    2287 (c=twinned → α true=α false)
    2288
    2289end PredictionClass
    2290end HadwigerCounterexample
    2291end
    2292end Lax793645.ConstructionData.Binary
    2293end
    2294
    2295section
    2296namespace Lax793645.ConstructionData.Binary
    2297noncomputable section
    2298namespace HadwigerCounterexample
    2299open Matrix Finset LinearMap
    2300open scoped BigOperators
    2301variable {p : Shape} {n N : ℕ}
    2302namespace PredictionClass
    2303def compatible (α : Party) (x : F) : PredictionClass→ Quad→ Prop
    2304| dusk,v=> v=repeatQ x
    2305| dawn i,v=> v.1 i+v.2 i=firstBit α i
    2306| twinned,v=> dotProduct allSide v.1 +dotProduct allSide v.2=0
    2307| noon,_=> True
    2308
    2309end PredictionClass
    2310open PredictionClass
    2311def glint (p : Shape) {n} (x : Bool → Profile p n) := ∑ i, role p n (x i)
    2312
    2313end HadwigerCounterexample
    2314end
    2315end Lax793645.ConstructionData.Binary
    2316end
    2317
    2318section
    2319namespace Lax793645.ConstructionData.Frames
    2320open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2321open Matrix Finset LinearMap
    2322open scoped BigOperators
    2323noncomputable section
    2324variable {p : Shape} {n : ℕ}
    2325def bitSupport {g : ℕ} (t : Fin g → F) : Finset (Fin g) :=
    2326 Finset.univ.filter (fun l => t l≠0)
    2327
    2328/-- Read just the ordinary testers owned by the outgoing tag. -/
    2329def ordinaryBit (p : Shape) (n : ℕ) (x : Profile p n) (l : Tag p.g) : F :=
    2330 ∑ t : Tag p.g,etab p n (Block.O l t) (CycleGeometry.outgoingMap l x)
    2331
    2332end
    2333end Lax793645.ConstructionData.Frames
    2334end
    2335
    2336section
    2337namespace Lax793645.ConstructionData.Binary
    2338noncomputable section
    2339namespace HadwigerCounterexample
    2340open Matrix Module Function Finset
    2341open scoped BigOperators
    2342variable {p : Shape} {n : ℕ}
    2343abbrev Punch (p : Shape) := ProbeIdx p.g × Fin p.r
    2344
    2345abbrev Gauge (p : Shape) := Punch p × Bool
    2346
    2347end HadwigerCounterexample
    2348end
    2349end Lax793645.ConstructionData.Binary
    2350end
    2351
    2352section
    2353namespace Lax793645.ConstructionData.Binary
    2354noncomputable section
    2355namespace HadwigerCounterexample
    2356open Filter Finset
    2357open scoped BigOperators Topology
    2358open PredictionClass
    2359structure PreparationParameters where
    2360 D : ℕ
    2361 L : ℝ
    2362 d : ℕ
    2363 e : ℕ
    2364 s : ℕ
    2365 u : ℕ
    2366 k : ℕ
    2367 ζ : ℝ
    2368 B : ℕ
    2369
    2370namespace PreparationParameters
    2371def rank (q : PreparationParameters) := 2* q.e + 2
    2372
    2373def leafOld (q : PreparationParameters) : ℝ := ↑q.D+q.e+2
    2374
    2375def leafNew (q : PreparationParameters) : ℝ := q.leafOld+q.u+q.s+2
    2376
    2377def spJoint (q : PreparationParameters) : ℝ := (q.D:ℝ)+1
    2378
    2379def spear (q : PreparationParameters) := bp (100)* q.L
    2380
    2381variable {p : Shape} {M n N : ℕ}
    2382abbrev cycleM (p : Shape) := ∀ n,Mixer p n
    2383
    2384end PreparationParameters
    2385end HadwigerCounterexample
    2386end
    2387end Lax793645.ConstructionData.Binary
    2388end
    2389
    2390section
    2391namespace Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2392noncomputable section
    2393variable {α : Type*} [Fintype α]
    2394/-- Individual marginal caps (mapW denotes the actual marginals) and a joint cap. -/
    2395def pairCaps (μ : Wgt α) (m d : ℝ) (w : Wgt (α × α)) :=
    2396 (∀ x, mapW w Prod.fst x ≤ m * μ x) ∧
    2397 (∀ x, mapW w Prod.snd x ≤ m * μ x) ∧
    2398 (∀ p, w p ≤ d * pairW μ μ p)
    2399
    2400end
    2401end Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2402end
    2403
    2404section
    2405namespace Lax793645.ConstructionData.Binary
    2406noncomputable section
    2407namespace HadwigerCounterexample
    2408open Filter Real Finset Matrix Function
    2409open scoped BigOperators
    2410variable {p : Shape} {M n N : ℕ}
    2411variable {I J K G : Type} [Fintype I] [Fintype J] [Fintype K] [Fintype G]
    2412variable [DecidableEq I] [DecidableEq J] [DecidableEq K] [DecidableEq G]
    2413namespace Template
    2414variable (v : Template p I) (z : Template p J)
    2415instance inpFinite (p : Shape) (I : Type) [Fintype I] [DecidableEq I] (n : ℕ) :
    2416 Fintype (Inputs p n I) := inferInstanceAs (Fintype (I→ Knobs p.g n))
    2417
    2418instance keySlotFinite (v : Template p I) : Fintype (KeySlots p v.t) := inferInstance
    2419
    2420end Template
    2421end HadwigerCounterexample
    2422end
    2423end Lax793645.ConstructionData.Binary
    2424end
    2425
    2426section
    2427namespace Lax793645.ConstructionData.Binary
    2428noncomputable section
    2429namespace HadwigerCounterexample
    2430open Finset Real
    2431open scoped BigOperators
    2432variable {A B C X Y : Type} [Fintype A] [Fintype B] [Fintype C] [Fintype X] [Fintype Y]
    2433variable {w : Wgt X}
    2434def stained (w : Wgt X) (f : X→ Y) (i : Y) : Wgt X := by
    2435 classical exact if mapW w f i≠0 then onW w (fun x => f x=i) else w
    2436
    2437variable {μ : Wgt A}
    2438def colored (μ : Wgt A) (w : Wgt X) (v : A→ X→ Y) :=
    2439 semi μ (fun i => mapW w (v i))
    2440
    2441def coloredP (w : Wgt X) (v : A→ X→ Y) (K : A→ X→ B) :=
    2442 fun i : A×Y => mapW (stained w (v i.1) i.2) (K i.1)
    2443
    2444end HadwigerCounterexample
    2445end
    2446end Lax793645.ConstructionData.Binary
    2447end
    2448
    2449section
    2450namespace Lax793645.ConstructionData.Binary
    2451noncomputable section
    2452namespace HadwigerCounterexample
    2453open Finset Real Function
    2454open scoped BigOperators
    2455variable {A B C K : Type} [Fintype A] [Fintype B] [Fintype C]
    2456def dip (μ f g : Wgt A) := avg μ (fun i => f i* g i)
    2457
    2458def ode (μ f : Wgt A) := dip μ f f
    2459
    2460def cashbook (μ : Wgt A) (f : A→ B) (g : Wgt A) :=
    2461 fun i => mapW (fun x => μ x* g x) f i / mapW μ f i
    2462
    2463def banner (μ : Wgt A) (f : A→ B) (g : Wgt A) := cashbook μ f g ∘ f
    2464
    2465end HadwigerCounterexample
    2466end
    2467end Lax793645.ConstructionData.Binary
    2468end
    2469
    2470section
    2471namespace Lax793645.ConstructionData.Binary
    2472noncomputable section
    2473namespace HadwigerCounterexample
    2474open Matrix Module LinearMap Finset Submodule Function
    2475open scoped BigOperators
    2476namespace StatusAnalysis
    2477variable {p : Shape} {n N K : ℕ}
    2478structure Quill (p : Shape) (q : Format) (d : Rates) (b : Bool) where
    2479 sel : Messenger q → Label p.b
    2480 flav : Messenger q → Flavor p.g
    2481 amp : Amounts p q d b
    2482 script : Script p (Messenger q)
    2483
    2484structure Typus (p : Shape) (q : Format) (d e : Rates) where
    2485 t : Tagging p (Messenger q)
    2486 z : Messenger q → F
    2487 qA : Quill p q d true
    2488 qB : Quill p q e false
    2489
    2490abbrev Volumes := Grid → Fin 8
    2491
    2492abbrev Stakes (K : ℕ) := Nodes → Fin (K^2+1)
    2493
    2494abbrev Master (K : ℕ) := Volumes × Stakes K × Stakes K
    2495
    2496def toFormat (q : Volumes) : Format := fun i=>(q i).val
    2497
    2498def toRates {K : ℕ} (d : Stakes K) : Rates := fun i=>(d i).val
    2499
    2500abbrev OnFile (p : Shape) {K : ℕ} (q : Master K) :=
    2501 Typus p (toFormat q.1) (toRates q.2.1) (toRates q.2.2)
    2502
    2503variable {q : Format} {d e : Rates}
    2504namespace Quill
    2505variable {b : Bool} (w : Quill p q d b) (t : Tagging p (Messenger q)) (z : Messenger q→ F)
    2506def pen := manager b t w.sel w.flav
    2507
    2508def moral :=
    2509 Injective w.sel ∧ owing p b w.amp z ∧ ∀ i, (w.amp i).1.feasible (t i) (w.flav i)
    2510
    2511end Quill
    2512namespace Typus
    2513variable (w : Typus p q d e)
    2514end Typus
    2515namespace Station
    2516variable (w : Typus p q d e)
    2517end Station
    2518end StatusAnalysis
    2519end HadwigerCounterexample
    2520end
    2521end Lax793645.ConstructionData.Binary
    2522end
    2523
    2524section
    2525namespace Lax793645.ConstructionData.Binary
    2526noncomputable section
    2527namespace HadwigerCounterexample
    2528open Filter Finset Matrix Function
    2529open scoped BigOperators Topology
    2530variable {A B C H : Type} [Fintype A] [Fintype B] [Fintype C] [Fintype H]
    2531variable {p : Shape} {n N K M r : ℕ}
    2532namespace StatusAnalysis
    2533structure Appearance (p : Shape) where
    2534 l : Tag p.g
    2535 s : Label p.b
    2536 f : Flavor p.g
    2537 q : F
    2538
    2539namespace Appearance
    2540variable (x : Appearance p)
    2541def apt := canDial p x.l x.f x.q
    2542
    2543def trot := Template.solo p x.l x.s x.f
    2544
    2545def wit (x : Appearance p) (n : ℕ) := scopedBit p n x.l x.f x.q
    2546
    2547variable {d : ℕ}
    2548end Appearance
    2549namespace Appearance
    2550variable {d : ℕ}
    2551end Appearance
    2552end StatusAnalysis
    2553end HadwigerCounterexample
    2554end
    2555end Lax793645.ConstructionData.Binary
    2556end
    2557
    2558section
    2559namespace Lax793645.ConstructionData.Binary
    2560noncomputable section
    2561namespace HadwigerCounterexample
    2562open Filter Finset Matrix Function
    2563open scoped BigOperators Topology
    2564variable {p:Shape} {n N K r d : ℕ}
    2565namespace StatusAnalysis
    2566open Template
    2567namespace Appearance
    2568def nearly (p: Shape) (z: Digest p.g) (u: Par d) (x: Magazine p d) :=
    2569 x.1=z∧ x.2.1=u
    2570
    2571def fitsink (x : Appearance p) (w : Magazine p d) :=
    2572 w.1.feasible x.l x.f ∧ w.1.sumBit=x.q ∧ w.1.diagO=w.2.1.1
    2573
    2574end Appearance
    2575end StatusAnalysis
    2576end HadwigerCounterexample
    2577end
    2578end Lax793645.ConstructionData.Binary
    2579end
    2580
    2581section
    2582namespace Lax793645.ConstructionData.Binary
    2583noncomputable section
    2584namespace HadwigerCounterexample
    2585open Filter Finset Matrix Function
    2586open scoped BigOperators Topology
    2587open Template
    2588variable {p : Shape} {n N K M r : ℕ}
    2589namespace StatusAnalysis
    2590variable {q:Format} {d : Rates} {b:Bool}
    2591namespace Quill
    2592variable (w : Quill p q d b) (t : Tagging p (Messenger q)) (z : Messenger q → F)
    2593def allure (i : Messenger q) : Appearance p := ⟨t i,w.sel i,w.flav i,z i⟩
    2594
    2595variable (m : Mixer p n)
    2596end Quill
    2597end StatusAnalysis
    2598end HadwigerCounterexample
    2599end
    2600end Lax793645.ConstructionData.Binary
    2601end
    2602
    2603section
    2604namespace Lax793645.ConstructionData.Binary
    2605noncomputable section
    2606namespace HadwigerCounterexample
    2607open Finset Matrix LinearMap Module Filter Function
    2608open scoped BigOperators
    2609variable {A B I : Type} [Fintype A] [Fintype B] [Fintype I]
    2610def lcost (u f g : Wgt A) := avg u (fun i=>|f i-g i|)
    2611
    2612end HadwigerCounterexample
    2613end
    2614end Lax793645.ConstructionData.Binary
    2615end
    2616
    2617section
    2618namespace Lax793645.ConstructionData.Binary
    2619noncomputable section
    2620namespace HadwigerCounterexample
    2621open Finset Real Function
    2622open scoped BigOperators
    2623variable {A B I J : Type} [Fintype A] [Fintype B] [Fintype I] [Fintype J]
    2624def bower (f : Wgt A) := (∀ i,0≤ f i)∧ (∀ i,f i≤1)
    2625
    2626end HadwigerCounterexample
    2627end
    2628end Lax793645.ConstructionData.Binary
    2629end
    2630
    2631section
    2632namespace Lax793645.ConstructionData.Frames
    2633open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2634open Finset Function
    2635noncomputable section
    2636set_option backward.isDefEq.respectTransparency false
    2637variable {A B C J : Type} [Fintype A] [Fintype B] [Fintype C] [Fintype J]
    2638def densityFamilyEnergy (ν : Wgt A) (μ : Wgt J) (d : J→ Wgt A) (P : A→ B) : ℝ :=
    2639 avg μ (fun i=> ode ν (banner ν P (d i)))
    2640
    2641end
    2642end Lax793645.ConstructionData.Frames
    2643end
    2644
    2645section
    2646namespace Lax793645.ConstructionData.Frames
    2647open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2648open Finset Function
    2649open scoped Classical
    2650noncomputable section
    2651set_option backward.isDefEq.respectTransparency false
    2652variable {O X Y B : Type} [Fintype O] [Fintype X] [Fintype Y] [Fintype B]
    2653def coloredCutDensities (ν : Wgt B) (κ : Wgt X) (v : O→ X→ Y) (K : O→ X→ B)
    2654 (S : B→ Prop) : O×Y→ Wgt B :=
    2655 fun i=> density ν (subW (coloredP κ v K i) S)
    2656
    2657end
    2658end Lax793645.ConstructionData.Frames
    2659end
    2660
    2661section
    2662namespace Lax793645.ConstructionData.Frames
    2663open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2664open Finset Matrix
    2665noncomputable section
    2666set_option backward.isDefEq.respectTransparency false
    2667variable {I : Type} [Fintype I] [DecidableEq I]
    2668def linearFourier (f : Wgt (Vec I)) (ξ : Vec I) : ℝ :=
    2669 avg unif (fun x=> vectorPhase ξ x* f x)
    2670
    2671end
    2672end Lax793645.ConstructionData.Frames
    2673end
    2674
    2675section
    2676namespace Lax793645.ConstructionData.Frames
    2677open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2678open Finset Matrix Function
    2679noncomputable section
    2680set_option backward.isDefEq.respectTransparency false
    2681variable {I : Type} [Fintype I] [DecidableEq I]
    2682def fourierNorm (f : Wgt (Vec I)) : ℝ := ∑ ξ:Vec I,|linearFourier f ξ|
    2683
    2684end
    2685end Lax793645.ConstructionData.Frames
    2686end
    2687
    2688section
    2689namespace Lax793645.ConstructionData.Frames
    2690open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2691open Finset Matrix Function LinearMap
    2692noncomputable section
    2693set_option backward.isDefEq.respectTransparency false
    2694variable {I J : Type} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J]
    2695variable {N : ℕ}
    2696abbrev KeyCoordinates (I : Type) (N : ℕ) := Vec (Fin N×(Bool×I))
    2697
    2698def keyPlus : KeyCoordinates I N→ₗ[F] PlusRack I N where
    2699 toFun x u i := x (u,(false,i))
    2700 map_add' _ _ := rfl
    2701 map_smul' _ _ := rfl
    2702
    2703def keyMinus : KeyCoordinates I N→ₗ[F] PlusRack I N where
    2704 toFun x u i := x (u,(true,i))
    2705 map_add' _ _ := rfl
    2706 map_smul' _ _ := rfl
    2707
    2708def gramPrimitive (M : Mat I I) (x : KeyCoordinates I N) : F :=
    2709 layerPhase M N (keyPlus x) (keyMinus x)
    2710
    2711end
    2712end Lax793645.ConstructionData.Frames
    2713end
    2714
    2715section
    2716namespace Lax793645.ConstructionData.Frames
    2717open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2718open Finset Matrix Function LinearMap
    2719noncomputable section
    2720set_option backward.isDefEq.respectTransparency false
    2721variable {I J A : Type} [Fintype I] [Fintype J] [Fintype A]
    2722 [DecidableEq I] [DecidableEq J] [DecidableEq A] {N : ℕ}
    2723/-- Ambient coordinate order used by the Fourier lemmas. -/
    2724def rackCoordinates (I : Type) (N : ℕ) : KeyCoordinates I N≃ₗ[F] Rack I N where
    2725 toFun x := (keyPlus x,keyMinus x)
    2726 invFun x v := if v.2.1 then x.2 v.1 v.2.2 else x.1 v.1 v.2.2
    2727 left_inv x := by funext v; rcases v with ⟨u,b,i⟩; cases b <;> rfl
    2728 right_inv x := rfl
    2729 map_add' _ _ := rfl
    2730 map_smul' _ _ := rfl
    2731
    2732end
    2733end Lax793645.ConstructionData.Frames
    2734end
    2735
    2736section
    2737namespace Lax793645.ConstructionData.Frames
    2738open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2739open Finset Matrix Function LinearMap
    2740open scoped Classical
    2741noncomputable section
    2742set_option backward.isDefEq.respectTransparency false
    2743variable {I : Type} [Fintype I] [DecidableEq I] {p : Shape} {n N : ℕ}
    2744def inputCoordinates (p : Shape) (n : ℕ) (I : Type) :
    2745 Vec (I×Block p.g×Fin n)≃ₗ[F] Inputs p n I where
    2746 toFun x i b k:=x (i,b,k)
    2747 invFun x v:=x v.1 v.2.1 v.2.2
    2748 left_inv _:=rfl
    2749 right_inv _:=rfl
    2750 map_add' _ _:=rfl
    2751 map_smul' _ _:=rfl
    2752
    2753def inputFourierNorm (w : Wgt (Inputs p n I)) : ℝ:=
    2754 fourierNorm (fun x=> w (inputCoordinates p n I x))
    2755
    2756end
    2757end Lax793645.ConstructionData.Frames
    2758end
    2759
    2760section
    2761namespace Lax793645.ConstructionData.Frames
    2762open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2763open StatusAnalysis Finset Matrix Function Filter
    2764open scoped Classical
    2765noncomputable section
    2766set_option backward.isDefEq.respectTransparency false
    2767variable {p : Shape} {n N : ℕ} {q : Format} {d : Rates} {b : Bool}
    2768abbrev NominalAmounts (p : Shape) (q : Format) (d : Rates) (b : Bool) :=
    2769 ∀ i:Messenger q,Digest p.g×Par (d (parcel b i))
    2770
    2771def nominalPrinted (b : Bool) (v : Charts p n d) (t : Tagging p (Messenger q))
    2772 (s : Messenger q→ Label p.b) (f : Messenger q→ Flavor p.g) (m : Mixer p n)
    2773 (x : Inputs p n (Messenger q)) : NominalAmounts p q d b :=
    2774 fun i=>(scan p (t i) (f i) (x i),
    2775 role p n (useAtom p (t i) (s i) (f i) (x i)),
    2776 roll (v (parcel b i)) (Tsym m (useAtom p (t i) (s i) (f i) (x i))))
    2777
    2778def joinPrinted (a : NominalAmounts p q d b) (r : Messenger q→ F) : Amounts p q d b :=
    2779 fun i=>(a i|>.1,a i|>.2,r i)
    2780
    2781end
    2782end Lax793645.ConstructionData.Frames
    2783end
    2784
    2785section
    2786namespace Lax793645.ConstructionData.Binary
    2787noncomputable section
    2788namespace HadwigerCounterexample
    2789open Filter Finset Matrix LinearMap Function
    2790open scoped BigOperators Topology
    2791open Template
    2792variable {p:Shape} {M n N K r s0:ℕ}
    2793namespace StatusAnalysis
    2794namespace Quill
    2795variable {q:Format} {d:Rates} {b:Bool} (w:Quill p q d b) (t : Tagging p (Messenger q))
    2796 (z:Messenger q→ F) (m:Mixer p n)
    2797def prelim (K:ℕ) (s:Charts p n d) (i:Messenger q) :=
    2798 d (parcel b i)≤ K^2 ∧ Injective (s (parcel b i)) ∧
    2799 ∀ x,totalRank (s (parcel b i) x)≤ K
    2800
    2801def sameInk (i:Messenger q) (v: Magazine p (d (parcel b i))) :=
    2802 Appearance.nearly p (w.amp i).1 (w.amp i).2.1 v
    2803
    2804end Quill
    2805end StatusAnalysis
    2806end HadwigerCounterexample
    2807end
    2808end Lax793645.ConstructionData.Binary
    2809end
    2810
    2811section
    2812namespace Lax793645.ConstructionData.Binary
    2813noncomputable section
    2814namespace HadwigerCounterexample
    2815open Finset Matrix Function Module LinearMap
    2816open scoped BigOperators
    2817variable {p:Shape} {n N M K s0:ℕ}
    2818namespace StatusAnalysis
    2819variable {q:Format} {d e: Rates} {b:Bool}
    2820abbrev Stalls (p:Shape) := Bool→ Finset (Label p.b)
    2821
    2822namespace Fabric
    2823end Fabric
    2824variable {i j:Bool} {L:ℕ}
    2825end StatusAnalysis
    2826end HadwigerCounterexample
    2827end
    2828end Lax793645.ConstructionData.Binary
    2829end
    2830
    2831section
    2832namespace Lax793645.ConstructionData.Binary
    2833noncomputable section
    2834namespace HadwigerCounterexample
    2835open Filter Matrix Finset Function LinearMap Module
    2836open scoped BigOperators Topology
    2837open Template
    2838variable {p : Shape} {N n r K : ℕ}
    2839namespace StatusAnalysis
    2840/-- envelope information to certify a generator, shared l and q. -/
    2841structure Zodiac (p : Shape) where
    2842 l : Tag p.g
    2843 q : F
    2844 s : Bool → Label p.b
    2845 f : Bool→ Flavor p.g
    2846
    2847namespace Zodiac
    2848def aspect (w : Zodiac p) (b : Bool) : Appearance p :=
    2849 ⟨w.l,w.s b,w.f b,w.q⟩
    2850
    2851def common (w : Zodiac p) := ∀ b,(w.aspect b).apt
    2852
    2853end Zodiac
    2854abbrev Terrain (p:Shape) (r:ℕ):= Tag p.g → F → Wgt (Fin r)
    2855
    2856abbrev Gazette (p:Shape) (r:ℕ) (d : Rates) :=
    2857 (i:Nodes)→ Appearance p → Fin r→ Wgt (Magazine p (d i))
    2858
    2859variable {d e : Rates}
    2860namespace DualAnalysis
    2861def origami (p:Shape) (r:ℕ) (u:Terrain p r) (δ:ℝ) :=
    2862 (∀ i q,IsLaw (u i q)) ∧ ∀ i q,1/2 ≤ pr (u i q) (fun x=>δ ≤ u i q x)
    2863
    2864structure reports (p:Shape) (r:ℕ) (u:Terrain p r) (s:Gazette p r d)
    2865 (β δ:ℝ) : Prop where
    2866 law : ∀ i (x:Appearance p),x.apt → ∀ k:Fin r,IsLaw (s i x k)
    2867 supp : ∀ i (x:Appearance p),x.apt →∀ k,carried (s i x k) x.fitsink
    2868 generous : ∀ i (x:Appearance p), x.f=Flavor.full → x.apt →
    2869 ∀ k:Fin r,δ ≤ u x.l x.q k → ∀ v: Par (d i),
    2870 β ≤ pr (s i x k) (fun w=> w.2.1=v)
    2871
    2872def playbook (p : Shape) (K : ℕ) := num (Magazine p (K^2) × Magazine p (K^2))
    2873
    2874abbrev Scriptum (p:Shape) (d e: Rates) (i : Grid) :=
    2875 Zodiac p × Magazine p (d i.1) × Magazine p (e i.2)
    2876
    2877abbrev Touch (p:Shape) (d e : Rates) (i : Grid) := Magazine p (d i.1) × Magazine p (e i.2)
    2878
    2879variable (u:Terrain p r) (s:Gazette p r d) (t:Gazette p r e)
    2880 (η:ℝ)
    2881def couplePage (x:Zodiac p) (i:Grid) :=
    2882 fun j:Fin r=> pairW (s i.1 (x.aspect true) j) (t i.2 (x.aspect false) j)
    2883
    2884def circlet (x:Zodiac p) (i:Grid) : Wgt (Touch p d e i) :=
    2885 mixW (u x.l x.q) (couplePage s t x i)
    2886
    2887def eligible (x:Zodiac p) (i:Grid) (a : Touch p d e i) :=
    2888 x.common ∧ (x.aspect true).fitsink a.1 ∧ (x.aspect false).fitsink a.2 ∧
    2889 η ≤ circlet u s t x i a
    2890
    2891def stellar (A B : Stalls p) : Congress (Scriptum p d e) d e (Label p.b) :=
    2892 fun i=> {
    2893 valid x:= x.1.s true∉ A i.1 ∧ x.1.s false∉ B i.2 ∧ eligible u s t η x.1 i x.2
    2894 writes x:= (x.1.q,x.2.1.2,x.2.2.2)
    2895 addr x:= x.1.s
    2896 }
    2897
    2898variable {β δ:ℝ}
    2899end DualAnalysis
    2900end StatusAnalysis
    2901end HadwigerCounterexample
    2902end
    2903end Lax793645.ConstructionData.Binary
    2904end
    2905
    2906section
    2907namespace Lax793645.ConstructionData.Binary
    2908noncomputable section
    2909namespace HadwigerCounterexample
    2910open Filter Matrix Finset Function Submodule LinearMap
    2911open scoped BigOperators Topology
    2912open Template
    2913variable {p:Shape} {N n r K : ℕ}
    2914namespace StatusAnalysis
    2915namespace DualAnalysis
    2916open Club Guild
    2917variable {d e : Rates}
    2918 {u:Terrain p r} {s:Gazette p r d} {t:Gazette p r e}
    2919 {β η δ:ℝ}
    2920structure RhymeSet (d : ℕ) where
    2921 bit : F
    2922 coal : Cell d
    2923 headBit : F
    2924 gamma : F
    2925
    2926def RhymeSet.read {k : ℕ} (s:RhymeSet k) (q:F) (x: Whole k) :=
    2927 s.bit* x.2+ dotProduct s.coal x.1.2+ (s.bit+s.headBit)* x.1.1+s.gamma* q
    2928
    2929def RhymeSet.soot {k : ℕ} (s:RhymeSet k) {p:Shape} (x:Appearance p) (y:Magazine p k) :=
    2930 s.read x.q y.2
    2931
    2932def leftChime (q:DualCoefficients d e) (i:Grid) : RhymeSet (d i.1) :=
    2933 ⟨q.left i.2,q.north i,q.hed i,0⟩
    2934
    2935def rightChime (q:DualCoefficients d e) (i:Grid) : RhymeSet (e i.2) :=
    2936 ⟨q.right i.1,q.south i,q.hed i,q.gam i⟩
    2937
    2938end DualAnalysis
    2939end StatusAnalysis
    2940end HadwigerCounterexample
    2941end
    2942end Lax793645.ConstructionData.Binary
    2943end
    2944
    2945section
    2946namespace Lax793645.ConstructionData.Frames
    2947open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2948open StatusAnalysis StatusAnalysis.DualAnalysis Club Guild Finset Function
    2949noncomputable section
    2950set_option backward.isDefEq.respectTransparency false
    2951variable {p : Shape} {r : ℕ} {d e : Rates}
    2952variable {u : Terrain p r} {s : Gazette p r d} {t : Gazette p r e}
    2953variable {β δ η : ℝ}
    2954/-- A fixed positive support gap makes threshold availability exact.
    2955The statement applies to all labels retained for the scalar system. -/
    2956def HasStatusSupportGap (u : Terrain p r) (s : Gazette p r d)
    2957 (t : Gazette p r e) (η : ℝ) : Prop :=
    2958 ∀ (x : Zodiac p),x.common→∀ i y,
    2959 circlet u s t x i y=0 ∨ η≤ circlet u s t x i y
    2960
    2961end
    2962end Lax793645.ConstructionData.Frames
    2963end
    2964
    2965section
    2966namespace Lax793645.ConstructionData.Binary
    2967noncomputable section
    2968namespace HadwigerCounterexample
    2969open Finset Matrix Filter Function Submodule Module LinearMap
    2970open scoped BigOperators
    2971variable {A B J H : Type} [Fintype A] [Fintype B] [Fintype J]
    2972namespace StatusAnalysis
    2973namespace DualAnalysis
    2974variable {p:Shape} {d e: Rates} {r K:ℕ}
    2975abbrev Pulsar (p:Shape) (r:ℕ):= Tag p.g → F → Fin r→ F
    2976
    2977variable (u:Terrain p r) (s:Gazette p r d) (t:Gazette p r e)
    2978end DualAnalysis
    2979end StatusAnalysis
    2980end HadwigerCounterexample
    2981end
    2982end Lax793645.ConstructionData.Binary
    2983end
    2984
    2985section
    2986namespace Lax793645.ConstructionData.Frames
    2987open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    2988open StatusAnalysis StatusAnalysis.DualAnalysis Club Guild Function Finset
    2989noncomputable section
    2990set_option backward.isDefEq.respectTransparency false
    2991variable {p : Shape} {r : ℕ} {d e : Rates}
    2992variable {u : Terrain p r} {s : Gazette p r d} {t : Gazette p r e}
    2993variable {β δ η : ℝ}
    2994def ExactStatusPrediction (u : Terrain p r) (s : Gazette p r d)
    2995 (i : Nodes) (A : Finset (Label p.b)) (a : RhymeSet (d i)) (f : Pulsar p r) : Prop :=
    2996 ∀ x : Appearance p,x.s∉A→ x.apt→∀ c,0< u x.l x.q c→
    2997 ∀ v,0< s i x c v→ a.soot x v=f x.l x.q c
    2998
    2999end
    3000end Lax793645.ConstructionData.Frames
    3001end
    3002
    3003section
    3004namespace Lax793645.ConstructionData.Binary
    3005noncomputable section
    3006namespace HadwigerCounterexample
    3007open Matrix Filter Finset LinearMap Module Function
    3008open scoped BigOperators Topology
    3009open Template
    3010namespace StatusAnalysis
    3011namespace DualAnalysis
    3012variable {p:Shape} {r n N K:ℕ} {d:Rates}
    3013def yokeSet {n:ℕ} (w:Cell n) (α:F) : RhymeSet n :=
    3014 ⟨1,w,1+α,0⟩
    3015
    3016end DualAnalysis
    3017end StatusAnalysis
    3018end HadwigerCounterexample
    3019end
    3020end Lax793645.ConstructionData.Binary
    3021end
    3022
    3023section
    3024namespace Lax793645.ConstructionData.Frames
    3025open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3026open StatusAnalysis StatusAnalysis.DualAnalysis Function Finset
    3027noncomputable section
    3028set_option backward.isDefEq.respectTransparency false
    3029set_option maxHeartbeats 500000
    3030variable {p : Shape} {r : ℕ} {d : Rates}
    3031def SamePrediction (u : Terrain p r) (f g : Pulsar p r) : Prop :=
    3032 ∀ l q c,0< u l q c→ f l q c=g l q c
    3033
    3034def ExactCatalog (u : Terrain p r) (s : Gazette p r d)
    3035 (B : ℕ) (f : Nodes→ Pulsar p r) : Prop :=
    3036 ∀ i E,(E.card≤ B)→∀ w α g,
    3037 ExactStatusPrediction u s i E (yokeSet w α) g→ SamePrediction u g (f i)
    3038
    3039end
    3040end Lax793645.ConstructionData.Frames
    3041end
    3042
    3043section
    3044namespace Lax793645.ConstructionData.Binary
    3045noncomputable section
    3046namespace HadwigerCounterexample
    3047open Filter Finset Matrix Module LinearMap
    3048open scoped BigOperators Topology
    3049variable {p:Shape} {r n:ℕ}
    3050namespace StatusAnalysis
    3051namespace DualAnalysis
    3052variable {d e:Rates} {u:Terrain p r} {s:Gazette p r d} {t:Gazette p r e}
    3053open PredictionClass
    3054abbrev styles (d:Rates) := ∀ i:Nodes, Cell (d i)
    3055
    3056end DualAnalysis
    3057end StatusAnalysis
    3058end HadwigerCounterexample
    3059end
    3060end Lax793645.ConstructionData.Binary
    3061end
    3062
    3063section
    3064namespace Lax793645.ConstructionData.Frames
    3065open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3066open StatusAnalysis StatusAnalysis.DualAnalysis Function Finset
    3067noncomputable section
    3068set_option backward.isDefEq.respectTransparency false
    3069set_option maxHeartbeats 700000
    3070variable {p : Shape} {r : ℕ} {d e : Rates}
    3071def TesterSeparated (u : Terrain p r) (Free : Pulsar p r→ Prop) : Prop :=
    3072 ∀ f g γ,Free f→ Free g→
    3073 SamePrediction u f (fun l q c=> g l q c+γ* q)→γ=0
    3074
    3075/-- The seven possible pairs consist of the zero pair and three
    3076nonzero endpoint masks for each of the two second-side predictors. -/
    3077def sevenPredictionPairs (f : Nodes→ Pulsar p r) : Finset (Nodes→ Pulsar p r) := by
    3078 classical
    3079 exact {0} ∪ (univ.image fun j : Nodes=> fun i=> if i then f j else 0) ∪
    3080 (univ.image fun j : Nodes=> fun i=> if i then 0 else f j) ∪
    3081 (univ.image fun j : Nodes=> fun _=> f j)
    3082
    3083def ExactAnnounced (u : Terrain p r) (s : Gazette p r d)
    3084 (cat : Nodes→ Pulsar p r) (B : ℕ) : Prop :=
    3085 ∃ f∈sevenPredictionPairs cat,∃ w : styles d,∃ α : Party,∃ E : Stalls p,
    3086 ∀ i,(E i).card≤ B ∧ ExactStatusPrediction u s i (E i) (yokeSet (w i) (α i)) (f i)
    3087
    3088end
    3089end Lax793645.ConstructionData.Frames
    3090end
    3091
    3092section
    3093namespace Lax793645.ConstructionData.Frames
    3094open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3095open StatusAnalysis StatusAnalysis.DualAnalysis Club Guild Function LinearMap Finset Matrix Submodule
    3096open scoped BigOperators Classical
    3097noncomputable section
    3098set_option backward.isDefEq.respectTransparency false
    3099set_option maxHeartbeats 1000000
    3100variable {p : Shape} {n N r K c R : ℕ} {d e : Rates}
    3101variable {u : Terrain p r} {s : Gazette p r d} {t : Gazette p r e}
    3102variable {β δ η : ℝ}
    3103def GenericStatusPrediction (u : Terrain p r) (s : Gazette p r d)
    3104 (i : Nodes) (A : Finset (Label p.b)) (a : RhymeSet (d i)) (f : Pulsar p r) : Prop :=
    3105 ∀ x : Appearance p,x.s∉A→ x.apt→ x.f=Flavor.full→∀ c,0< u x.l x.q c→
    3106 ∀ v,0< s i x c v→ a.soot x v=f x.l x.q c
    3107
    3108def GenericStatusContinuation (u : Terrain p r) (s : Gazette p r d) (B : ℕ) : Prop :=
    3109 ∀ i E,E.card≤ B→∀ a f,GenericStatusPrediction u s i E a f→
    3110 ExactStatusPrediction u s i ∅ a f
    3111
    3112def genericStellar (u : Terrain p r) (s : Gazette p r d) (t : Gazette p r e)
    3113 (η : ℝ) (A B : Stalls p) : Congress (Scriptum p d e) d e (Label p.b) :=
    3114 fun i=>{stellar u s t η A B i with
    3115 valid x:=(stellar u s t η A B i).valid x ∧ ∀ side,x.1.f side=Flavor.full}
    3116
    3117end
    3118end Lax793645.ConstructionData.Frames
    3119end
    3120
    3121section
    3122namespace Lax793645.ConstructionData.Frames
    3123open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3124open Function LinearMap Module Finset
    3125noncomputable section
    3126set_option backward.isDefEq.respectTransparency false
    3127variable {V Q A B T : Type} [AddCommGroup V] [Module F V]
    3128/-- The cells are precisely the fibers of one linear map. Merely being
    3129a function of linear coordinates would permit arbitrary coarsenings. -/
    3130def HasFullLinearCells (f : Q→ V→ A) (R : ℕ) : Prop :=
    3131 ∃ r : ℕ,r≤ R ∧ ∃ L : V→ₗ[F]Vec (Fin r),
    3132 ∀ q x y,f q x=f q y ↔ L x=L y
    3133
    3134end
    3135end Lax793645.ConstructionData.Frames
    3136end
    3137
    3138section
    3139namespace Lax793645.ConstructionData.Frames
    3140noncomputable section
    3141abbrev QField := ZMod 2
    3142
    3143variable {B H : Type} [AddCommGroup B] [Module QField B]
    3144 [AddCommGroup H] [Module QField H]
    3145end
    3146end Lax793645.ConstructionData.Frames
    3147end
    3148
    3149section
    3150namespace Lax793645.ConstructionData.Frames
    3151noncomputable section
    3152set_option backward.isDefEq.respectTransparency false
    3153open scoped BigOperators
    3154abbrev Hyperbolic (h : ℕ) := (Fin h→ QField)×(Fin h→ QField)
    3155
    3156def hyperbolicQuadratic (h : ℕ) : QuadraticForm QField (Hyperbolic h) :=
    3157 LinearMap.BilinMap.toQuadraticMap
    3158 ((dotProductBilin QField QField : (Fin h→ QField)→ₗ[QField]
    3159 (Fin h→ QField)→ₗ[QField] QField).compl₁₂
    3160 (LinearMap.fst QField _ _) (LinearMap.snd QField _ _))
    3161
    3162theorem hyperbolic_apply (h : ℕ) (v : Hyperbolic h) :
    3163 hyperbolicQuadratic h v=dotProduct v.1 v.2 := rfl
    3164
    3165theorem hyperbolic_polar (h : ℕ) (v w : Hyperbolic h) :
    3166 (hyperbolicQuadratic h).polarBilin v w=dotProduct v.1 w.2+dotProduct w.1 v.2 := by
    3167 rw [QuadraticMap.polarBilin_apply_apply,QuadraticMap.polar]
    3168 simp only [hyperbolic_apply,Prod.fst_add,Prod.snd_add,add_dotProduct,dotProduct_add]
    3169 ring
    3170
    3171theorem hyperbolic_nondegenerate (h : ℕ) :
    3172 (hyperbolicQuadratic h).polarBilin.Nondegenerate := by
    3173 constructor
    3174 · intro v hv
    3175 apply Prod.ext
    3176 · funext i
    3177 have hi := hv (0,Pi.single i 1)
    3178 change (hyperbolicQuadratic h).polarBilin v (0,Pi.single i 1)=0 at hi
    3179 rw [hyperbolic_polar] at hi
    3180 simpa using hi
    3181 · funext i
    3182 have hi := hv (Pi.single i 1,0)
    3183 change (hyperbolicQuadratic h).polarBilin v (Pi.single i 1,0)=0 at hi
    3184 rw [hyperbolic_polar] at hi
    3185 simpa using hi
    3186 · intro v hv
    3187 apply Prod.ext
    3188 · funext i
    3189 have hi := hv (0,Pi.single i 1)
    3190 change (hyperbolicQuadratic h).polarBilin (0,Pi.single i 1) v=0 at hi
    3191 rw [hyperbolic_polar] at hi
    3192 simpa using hi
    3193 · funext i
    3194 have hi := hv (Pi.single i 1,0)
    3195 change (hyperbolicQuadratic h).polarBilin (Pi.single i 1,0) v=0 at hi
    3196 rw [hyperbolic_polar] at hi
    3197 simpa using hi
    3198
    3199end
    3200end Lax793645.ConstructionData.Frames
    3201end
    3202
    3203section
    3204namespace Lax793645.ConstructionData.Frames
    3205open Matrix
    3206noncomputable section
    3207set_option backward.isDefEq.respectTransparency false
    3208abbrev HyperbolicIdx (h : ℕ) := Fin h⊕Fin h
    3209
    3210/-- An ordered matrix representative: its symmetric part is the polar
    3211form, whereas the matrix itself retains the quadratic values. -/
    3212def hyperbolicMatrix (h : ℕ) : Matrix (HyperbolicIdx h) (HyperbolicIdx h) QField :=
    3213 Matrix.fromBlocks 0 1 0 0
    3214
    3215def hyperbolicCoordinates (h : ℕ) :
    3216 (HyperbolicIdx h→ QField)≃ₗ[QField]Hyperbolic h :=
    3217 LinearEquiv.sumArrowLequivProdArrow _ _ _ _
    3218
    3219theorem hyperbolic_matrix_apply (h : ℕ) (v : HyperbolicIdx h→ QField) :
    3220 (hyperbolicMatrix h).toQuadraticForm' v=
    3221 hyperbolicQuadratic h (hyperbolicCoordinates h v) := by
    3222 change Matrix.toBilin' (hyperbolicMatrix h) v v=_
    3223 rw [Matrix.toBilin'_apply',hyperbolic_apply]
    3224 change dotProduct v (hyperbolicMatrix h*ᵥv)=dotProduct (v∘Sum.inl) (v∘Sum.inr)
    3225 simp only [hyperbolicMatrix,Matrix.fromBlocks_mulVec,Matrix.zero_mulVec,
    3226 Matrix.one_mulVec,zero_add,add_zero]
    3227 rw [show v=Sum.elim (v∘Sum.inl) (v∘Sum.inr) from by ext i; cases i <;> rfl]
    3228 simp only [sumElim_dotProduct_sumElim,dotProduct_zero,add_zero]
    3229 rfl
    3230
    3231end
    3232end Lax793645.ConstructionData.Frames
    3233end
    3234
    3235section
    3236namespace Lax793645.ConstructionData.Frames
    3237open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3238open Submodule Module
    3239open scoped BigOperators
    3240noncomputable section
    3241set_option backward.isDefEq.respectTransparency false
    3242theorem linear_image_dimension_growth {V W : Type} [AddCommGroup V] [Module F V]
    3243 [AddCommGroup W] [Module F W] [FiniteDimensional F V]
    3244 (f : V→ₗ[F]W) (S T : Space V) (hST : S≤ T) :
    3245 dim (T.map f)-dim (S.map f)≤ dim T-dim S := by
    3246 let fS:=f.comp S.subtype
    3247 let fT:=f.comp T.subtype
    3248 let g : fS.ker→ₗ[F]fT.ker:=
    3249 ((Submodule.inclusion hST).comp fS.ker.subtype).codRestrict fT.ker (fun x=> x.property)
    3250 have hg : Function.Injective g := by
    3251 intro x y h
    3252 apply Subtype.ext
    3253 apply Subtype.ext
    3254 exact congrArg (fun z : fT.ker=>(z.val:V)) h
    3255 have hk:=LinearMap.finrank_le_finrank_of_injective hg
    3256 have hs:=fS.finrank_range_add_finrank_ker
    3257 have ht:=fT.finrank_range_add_finrank_ker
    3258 have hrS : fS.range=S.map f := by rw [LinearMap.range_comp,Submodule.range_subtype]
    3259 have hrT : fT.range=T.map f := by rw [LinearMap.range_comp,Submodule.range_subtype]
    3260 rw [hrS] at hs
    3261 rw [hrT] at ht
    3262 have hm:=Submodule.finrank_mono hST
    3263 change dim fS.ker≤ dim fT.ker at hk
    3264 change dim (S.map f)+dim fS.ker=dim S at hs
    3265 change dim (T.map f)+dim fT.ker=dim T at ht
    3266 omega
    3267
    3268variable {I : Type} [Fintype I] {V : I→ Type}
    3269 [∀ i,AddCommGroup (V i)] [∀ i,Module F (V i)]
    3270/-- Close a pin space under the coordinate block projections. -/
    3271def blockClosure (S : Space (∀ i,V i)) : Space (∀ i,V i) :=
    3272 Submodule.pi Set.univ (fun i=> S.map (LinearMap.proj i))
    3273
    3274omit [Fintype I] in
    3275theorem le_blockClosure (S : Space (∀ i,V i)) : S≤ blockClosure S := by
    3276 intro x hx
    3277 exact Submodule.mem_pi.mpr (fun i _=>⟨x,hx,rfl⟩)
    3278
    3279omit [Fintype I] in
    3280theorem blockClosure_projection (S : Space (∀ i,V i)) (i : I) :
    3281 (blockClosure S).map (LinearMap.proj i)=S.map (LinearMap.proj i) := by
    3282 apply le_antisymm
    3283 · rintro _ ⟨x,hx,rfl⟩
    3284 exact (Submodule.mem_pi.mp hx) i (Set.mem_univ i)
    3285 · exact Submodule.map_mono (le_blockClosure S)
    3286
    3287omit [Fintype I] in
    3288theorem blockClosure_idempotent (S : Space (∀ i,V i)) :
    3289 blockClosure (blockClosure S)=blockClosure S := by
    3290 unfold blockClosure
    3291 congr 1
    3292 funext i
    3293 exact blockClosure_projection S i
    3294
    3295def blockClosureEquiv (S : Space (∀ i,V i)) :
    3296 blockClosure S≃ₗ[F](∀ i,S.map (LinearMap.proj i)) where
    3297 toFun x i:=⟨x.val i,(Submodule.mem_pi.mp x.property) i (Set.mem_univ i)⟩
    3298 invFun x:=⟨fun i=>(x i).val,Submodule.mem_pi.mpr (fun i _=>(x i).property)⟩
    3299 left_inv _:=rfl
    3300 right_inv _:=rfl
    3301 map_add' _ _:=rfl
    3302 map_smul' _ _:=rfl
    3303
    3304variable [∀ i,FiniteDimensional F (V i)]
    3305theorem blockClosure_dimension (S : Space (∀ i,V i)) :
    3306 dim (blockClosure S)=∑ i,dim (S.map (LinearMap.proj i)) := by
    3307 unfold dim
    3308 rw [(blockClosureEquiv S).finrank_eq]
    3309 exact Module.finrank_pi_fintype F
    3310
    3311/-- Closing a new t-dimensional extension of an already closed pin space
    3312adds at most one copy of t for each coordinate block. -/
    3313theorem blockClosure_dimension_step (S T : Space (∀ i,V i)) (hST : S≤ T)
    3314 (hS : blockClosure S=S) :
    3315 dim (blockClosure T)-dim S≤ Fintype.card I*(dim T-dim S) := by
    3316 have h (i : I) : dim (T.map (LinearMap.proj i))≤
    3317 dim (S.map (LinearMap.proj i))+(dim T-dim S) := by
    3318 have hi:=linear_image_dimension_growth (LinearMap.proj i) S T hST
    3319 omega
    3320 have hh:=Finset.sum_le_sum (s:=Finset.univ) (fun i _=> h i)
    3321 rw [Finset.sum_add_distrib,←blockClosure_dimension,←blockClosure_dimension,hS] at hh
    3322 simp only [Finset.sum_const,Finset.card_univ,smul_eq_mul] at hh
    3323 omega
    3324
    3325end
    3326end Lax793645.ConstructionData.Frames
    3327end
    3328
    3329section
    3330namespace Lax793645.ConstructionData.Frames
    3331open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3332open Matrix Submodule
    3333open scoped BigOperators
    3334noncomputable section
    3335set_option backward.isDefEq.respectTransparency false
    3336abbrev ImagePlan (C I : Type) := C→ Space (Vec I)
    3337
    3338def imagePlanRank {C I : Type} [Fintype C] [Fintype I] (P : ImagePlan C I) :=∑ e,dim (P e)
    3339
    3340structure ImagePin (C I : Type) (N : ℕ) where
    3341 sp : ImagePlan C I
    3342 target : C→ Mat (Fin N) I
    3343
    3344variable {A C I : Type} [Fintype A] [Fintype C] [Fintype I] [DecidableEq I] {N : ℕ}
    3345def imagePinAgree (X : A→ C→ Mat (Fin N) I) (P : ImagePin C I N) (x : A) :=
    3346 ∀ e,∀ v∈P.sp e,X x e*ᵥv=P.target e*ᵥv
    3347
    3348end
    3349end Lax793645.ConstructionData.Frames
    3350end
    3351
    3352section
    3353namespace Lax793645.ConstructionData.Frames
    3354open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3355open Matrix Submodule
    3356open scoped BigOperators
    3357noncomputable section
    3358set_option backward.isDefEq.respectTransparency false
    3359variable {A C I : Type} [Fintype A] [Fintype C] [Fintype I] [DecidableEq I] {N : ℕ}
    3360def imagePinClear (X : A→ C→ Mat (Fin N) I) (a : ImagePin C I N) (ζ : ℝ) (w : Wgt A) :=
    3361 ∀ b : ImagePin C I N,pr w (imagePinAgree X b)≤
    3362 fee N ζ (imagePlanRank (a.sp⊔b.sp)-imagePlanRank a.sp)
    3363
    3364structure ImageClosure (C I : Type) [Fintype C] [Fintype I] (c : ℕ) where
    3365 close : ImagePlan C I→ ImagePlan C I
    3366 extensive : ∀ P,P≤ close P
    3367 idempotent : ∀ P,close (close P)=close P
    3368 growth : ∀ P Q,P≤ Q→ close P=P→
    3369 imagePlanRank (close Q)-imagePlanRank P≤ c*(imagePlanRank Q-imagePlanRank P)
    3370
    3371end
    3372end Lax793645.ConstructionData.Frames
    3373end
    3374
    3375section
    3376namespace Lax793645.ConstructionData.Frames
    3377open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3378open Matrix LinearMap Module Submodule
    3379open scoped BigOperators
    3380noncomputable section
    3381set_option backward.isDefEq.respectTransparency false
    3382variable {A C I : Type} [Fintype A] [Fintype C] [Fintype I] [DecidableEq I] {N : ℕ}
    3383abbrev ImageCross (C I : Type) := C→ Mat I I
    3384
    3385end
    3386end Lax793645.ConstructionData.Frames
    3387end
    3388
    3389section
    3390namespace Lax793645.ConstructionData.Frames
    3391open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3392open Matrix LinearMap Finset
    3393noncomputable section
    3394set_option backward.isDefEq.respectTransparency false
    3395variable {A C I : Type} [Fintype A] [Fintype C] [Fintype I] [DecidableEq I] {N c : ℕ}
    3396def imageDustPin : ImagePin C I N:=⟨⊥,0⟩
    3397
    3398structure ImageRipe (X : A→ C→ Mat (Fin N) I) (cl : ImageClosure C I c)
    3399 (w μ : Wgt A) (S : Finset A) (a : ImagePin C I N) (D ζ : ℝ) (K : ℕ) : Prop where
    3400 pos : 0< partMass w S
    3401 fixpin : ∀ x∈S,imagePinAgree X a x
    3402 closed : cl.close a.sp=a.sp
    3403 bound : imagePlanRank a.sp≤ K
    3404 clear : imagePinClear X a ζ (partW w S)
    3405 density x : partW w S x≤ bp (D* N)*μ x
    3406
    3407structure ImageLeafMixture (A C I : Type) [Fintype C] [Fintype I] (N : ℕ) where
    3408 T : Tiles A
    3409 pin : Finset A→ ImagePin C I N
    3410
    3411namespace ImageLeafMixture
    3412variable (s : ImageLeafMixture A C I N)
    3413def poller (x : A) : ImagePin C I N:=
    3414 open scoped Classical in
    3415 if h : inTiles s.T x then s.pin h.choose else imageDustPin
    3416
    3417def rooting (x : A):=(s.poller x).sp
    3418
    3419def amount (w : Wgt A):=allMass w s.T
    3420
    3421def sap (w : Wgt A):=allW w s.T
    3422
    3423def within (P : A→ Prop):=∀ i∈s.T,∀ x∈i,P x
    3424
    3425structure strength (X : A→ C→ Mat (Fin N) I) (cl : ImageClosure C I c)
    3426 (w μ : Wgt A) (D ζ : ℝ) (K : ℕ) : Prop where
    3427 part : apart s.T
    3428 leaf : ∀ i∈s.T,ImageRipe X cl w μ i (s.pin i) D ζ K
    3429
    3430variable {s} {X : A→ C→ Mat (Fin N) I} {cl : ImageClosure C I c}
    3431 {w μ : Wgt A} {D ζ : ℝ} {K : ℕ}
    3432end ImageLeafMixture
    3433end
    3434end Lax793645.ConstructionData.Frames
    3435end
    3436
    3437section
    3438namespace Lax793645.ConstructionData.Frames
    3439open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3440open StatusAnalysis Matrix LinearMap Submodule Module Finset Function
    3441open scoped BigOperators
    3442noncomputable section
    3443namespace IndependentClub
    3444variable {L I S X Y : Type} [DecidableEq L] [DecidableEq I] [Fintype S]
    3445variable [AddCommGroup X] [Module F X] [AddCommGroup Y] [Module F Y]
    3446variable (C : Club I X L) (U : Bool → Space (Vec S)) (v : Bool → I → Vec S)
    3447def bundle (p : Finset I) (s : Straps L) : Prop :=
    3448 (∀ i∈p,C.zone s i) ∧ ∀ b,LinearIndepOn F ((U b).mkQ ∘ v b) (p : Set I)
    3449
    3450def length3 (s : Straps L) (π : X →ₗ[F] Y) (x : X) : Prop :=
    3451 ∃ p : Finset I,bundle C U v p s ∧ p.card ≤ 3 ∧ C.contents p=x ∧ π x=0
    3452
    3453def ration (s : Straps L) (π : X →ₗ[F] Y) : Space X :=
    3454 Submodule.span F (length3 C U v s π)
    3455
    3456end IndependentClub
    3457end
    3458end Lax793645.ConstructionData.Frames
    3459end
    3460
    3461section
    3462namespace Lax793645.ConstructionData.Frames
    3463open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3464open StatusAnalysis Matrix LinearMap Submodule Module Finset Function
    3465open scoped BigOperators
    3466noncomputable section
    3467namespace IndependentClub
    3468variable {L I S X Y : Type} [DecidableEq L] [DecidableEq I] [Fintype S]
    3469variable [AddCommGroup X] [Module F X] [AddCommGroup Y] [Module F Y]
    3470variable (C : Club I X L) (U : Bool → Space (Vec S)) (v : Bool → I → Vec S)
    3471def enlarge (p : Finset I) (b : Bool) : Space (Vec S) :=
    3472 U b ⊔ Submodule.span F (v b '' (p : Set I))
    3473
    3474variable [Module.Finite F X]
    3475end IndependentClub
    3476end
    3477end Lax793645.ConstructionData.Frames
    3478end
    3479
    3480section
    3481namespace Lax793645.ConstructionData.Frames
    3482open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3483noncomputable section
    3484set_option backward.isDefEq.respectTransparency false
    3485variable {B R V : Type} [AddCommGroup B] [Module QField B]
    3486 [AddCommGroup R] [Module QField R] [AddCommGroup V] [Module QField V]
    3487def quadraticFramesAt (q : QuadraticForm QField V) (C : QuadraticForm QField B→ Prop)
    3488 (P : B→ₗ[QField]V) := Function.Injective P ∧ C (q.comp P)
    3489
    3490end
    3491end Lax793645.ConstructionData.Frames
    3492end
    3493
    3494section
    3495namespace Lax793645.ConstructionData.Frames
    3496open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3497noncomputable section
    3498set_option backward.isDefEq.respectTransparency false
    3499variable {B C V R : Type} [AddCommGroup B] [Module QField B]
    3500 [AddCommGroup C] [Module QField C] [AddCommGroup V] [Module QField V]
    3501 [AddCommGroup R] [Module QField R]
    3502/-- The three stored blocks are one primal block and the two channel blocks. -/
    3503abbrev QuadraticFull (B C : Type) := B×(C×C)
    3504
    3505def quadraticPrimalIn : B→ₗ[QField]QuadraticFull B C:=LinearMap.inl QField _ _
    3506
    3507def quadraticXIn : C→ₗ[QField]QuadraticFull B C:=
    3508 (LinearMap.inr QField _ _).comp (LinearMap.inl QField _ _)
    3509
    3510def quadraticYIn : C→ₗ[QField]QuadraticFull B C:=
    3511 (LinearMap.inr QField _ _).comp (LinearMap.inr QField _ _)
    3512
    3513/-- Exactly the proposed own-frame conditions: a prescribed quadratic form
    3514on the primal image and polar orthogonality of X to that image. Y is free. -/
    3515def quadraticChannelClass (Q : QuadraticForm QField B)
    3516 (A : QuadraticForm QField (QuadraticFull B C)) : Prop :=
    3517 A.comp quadraticPrimalIn=Q ∧
    3518 ∀ (c : C) (b : B),A.polarBilin (quadraticXIn c) (quadraticPrimalIn b)=0
    3519
    3520def quadraticChannelValid (q : QuadraticForm QField V) (Q : QuadraticForm QField B)
    3521 (P : QuadraticFull B C→ₗ[QField]V) :=
    3522 quadraticFramesAt q (quadraticChannelClass Q) P
    3523
    3524def quadraticChannelRaw [Fintype (QuadraticFull B C→ₗ[QField]V)]
    3525 (q : QuadraticForm QField V) (Q : QuadraticForm QField B) :
    3526 Wgt (QuadraticFull B C→ₗ[QField]V):=unifOn (quadraticChannelValid q Q)
    3527
    3528end
    3529end Lax793645.ConstructionData.Frames
    3530end
    3531
    3532section
    3533namespace Lax793645.ConstructionData.Frames
    3534open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3535open Matrix Submodule Module LinearMap
    3536noncomputable section
    3537variable {I : Type} [Fintype I]
    3538/-- Squares in a subspace, over the binary field. -/
    3539def quadraticSquares (S : Space (Vec I)) : Space (Mat I I) :=
    3540 Submodule.span F {W | ∃ x∈S,W=vecMulVec x x}
    3541
    3542def quadraticCross (K : Space (Vec I)) : Space (Mat I I) :=
    3543 Submodule.span F {W | ∃ k∈K,∃ b,W=vecMulVec k b+vecMulVec b k}
    3544
    3545end
    3546end Lax793645.ConstructionData.Frames
    3547end
    3548
    3549section
    3550namespace Lax793645.ConstructionData.Frames
    3551open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3552open Matrix
    3553open scoped BigOperators
    3554noncomputable section
    3555set_option backward.isDefEq.respectTransparency false
    3556variable {I A J : Type} [Fintype I] [Fintype A] [Fintype J]
    3557/-- A single primal map acts on both factors of a moment. -/
    3558def quadraticMomentMap (P : Vec I→ₗ[F]Vec A) : Mat I I→ₗ[F]Mat A A := by
    3559 classical
    3560 exact liftM (LinearMap.toMatrix' P) (LinearMap.toMatrix' P)
    3561
    3562theorem quadratic_moment_injective (P : Vec I→ₗ[F]Vec A)
    3563 (hP : Function.Injective P) : Function.Injective (quadraticMomentMap P) := by
    3564 classical
    3565 have hi : Function.Injective (LinearMap.toMatrix' P).mulVec := by
    3566 intro x y he
    3567 exact hP (by simpa only [LinearMap.toMatrix'_mulVec] using he)
    3568 exact liftM_inj hi hi
    3569
    3570/-- The ordered product of two polar channel evaluations. Its matrix is
    3571used only as a representative of a quadratic functional. -/
    3572def quadraticChannelBilin (q : QuadraticForm F (Vec A))
    3573 (X Y : J→ Vec A) : LinearMap.BilinForm F (Vec A) :=
    3574 ∑ j,(q.polarBilin (X j)).smulRight (q.polarBilin (Y j))
    3575
    3576def quadraticChannelFunctional (q : QuadraticForm F (Vec A))
    3577 (X Y : J→ Vec A) : Mat A A→ₗ[F]F := by
    3578 classical
    3579 exact mpair (quadraticChannelBilin q X Y).toMatrix'
    3580
    3581end
    3582end Lax793645.ConstructionData.Frames
    3583end
    3584
    3585section
    3586namespace Lax793645.ConstructionData.Frames
    3587open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3588open Matrix
    3589noncomputable section
    3590set_option backward.isDefEq.respectTransparency false
    3591theorem matrix_quadratic_comp {I A : Type} [Fintype I] [Fintype A]
    3592 [DecidableEq I] [DecidableEq A] (E : Mat A A) (P : Vec I→ₗ[F]Vec A) :
    3593 E.toQuadraticForm'.comp P=
    3594 (pullM (LinearMap.toMatrix' P) (LinearMap.toMatrix' P) E).toQuadraticForm' := by
    3595 apply QuadraticMap.ext
    3596 intro x
    3597 change Matrix.toBilin' E (P x) (P x)=
    3598 Matrix.toBilin' (pullM (LinearMap.toMatrix' P) (LinearMap.toMatrix' P) E) x x
    3599 simp only [Matrix.toBilin'_apply']
    3600 simpa only [evmat,LinearMap.toMatrix'_mulVec] using
    3601 (evmat_pull (LinearMap.toMatrix' P) (LinearMap.toMatrix' P) E x x).symm
    3602
    3603variable {I : Type} [Fintype I] [DecidableEq I]
    3604end
    3605end Lax793645.ConstructionData.Frames
    3606end
    3607
    3608section
    3609namespace Lax793645.ConstructionData.Frames
    3610open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3611open Matrix Submodule
    3612noncomputable section
    3613set_option backward.isDefEq.respectTransparency false
    3614variable {I : Type} [Fintype I] [DecidableEq I]
    3615/-- A hyperbolic channel map of small image has an ordered quadratic
    3616matrix representative of at most the same rank. -/
    3617theorem hyperbolic_matrix_representative (h : ℕ) (g : Vec I→ₗ[F]Hyperbolic h) :
    3618 ∃ M : Mat I I,(∀ v,M.toQuadraticForm' v=hyperbolicQuadratic h (g v)) ∧
    3619 M.rank≤ rk g := by
    3620 let L:=(hyperbolicCoordinates h).symm.toLinearMap.comp g
    3621 let A:=LinearMap.toMatrix' L
    3622 refine ⟨pullM A A (hyperbolicMatrix h),?_,?_⟩
    3623 · intro v
    3624 rw [←matrix_quadratic_comp,QuadraticMap.comp_apply,hyperbolic_matrix_apply]
    3625 exact congrArg (hyperbolicQuadratic h) ((hyperbolicCoordinates h).apply_symm_apply (g v))
    3626 · rw [pullM_def]
    3627 exact (Matrix.rank_mul_le_right ..).trans (by
    3628 change A.rank≤ rk g
    3629 rw [rank_cast,toMat_map]
    3630 exact rk_comp_le_right g (hyperbolicCoordinates h).symm.toLinearMap)
    3631
    3632end
    3633end Lax793645.ConstructionData.Frames
    3634end
    3635
    3636section
    3637namespace Lax793645.ConstructionData.Frames
    3638open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3639open Matrix Submodule
    3640open scoped BigOperators
    3641noncomputable section
    3642set_option backward.isDefEq.respectTransparency false
    3643variable {p : Shape} {n : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    3644def selectedAtComponent (l : I→ Tag p.g) (s : I→ Label p.b) (z : I→ Base p.g n)
    3645 (e : Comp p.g) : Space (Ray p n) :=
    3646 Submodule.span F {v | ∃ i,inc e (l i) ∧ v=point p (s i) (z i)}
    3647
    3648end
    3649end Lax793645.ConstructionData.Frames
    3650end
    3651
    3652section
    3653namespace Lax793645.ConstructionData.Frames
    3654open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3655open Matrix Submodule
    3656open scoped BigOperators
    3657noncomputable section
    3658set_option backward.isDefEq.respectTransparency false
    3659variable {D B : Type} [Fintype D] [Fintype B] [DecidableEq B]
    3660def jointProjection (b : B) : Vec (D×B)→ₗ[F]Vec D where
    3661 toFun v d:=v (d,b)
    3662 map_add' _ _:=rfl
    3663 map_smul' _ _:=rfl
    3664
    3665def jointInjection (b : B) : Vec D→ₗ[F]Vec (D×B) where
    3666 toFun v x:=if x.2=b then v x.1 else 0
    3667 map_add' _ _:=by ext x; by_cases h : x.2=b <;> simp [h]
    3668 map_smul' _ _:=by ext x; by_cases h : x.2=b <;> simp [h]
    3669
    3670def jointSpace (P : B→ Space (Vec D)) : Space (Vec (D×B)) where
    3671 carrier:={v | ∀ b,jointProjection b v∈P b}
    3672 add_mem' hx hy b:= (P b).add_mem (hx b) (hy b)
    3673 zero_mem' b:=(P b).zero_mem
    3674 smul_mem' c x hx b:=(P b).smul_mem c (hx b)
    3675
    3676end
    3677end Lax793645.ConstructionData.Frames
    3678end
    3679
    3680section
    3681namespace Lax793645.ConstructionData.Frames
    3682open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3683open Matrix Submodule
    3684open scoped BigOperators
    3685noncomputable section
    3686set_option backward.isDefEq.respectTransparency false
    3687abbrev JointRay (p : Shape) (n : ℕ) := Vec (Row p n×Bool)
    3688
    3689abbrev JointMoment (p : Shape) (n : ℕ) := Mat (Row p n×Bool) (Row p n×Bool)
    3690
    3691abbrev JointProfile (p : Shape) (n : ℕ) := Comp p.g→ JointMoment p n
    3692
    3693def jointCutEmbed {p : Shape} {n : ℕ} (x : Bool→ Profile p n) : JointProfile p n :=
    3694 fun e=> blockDiagonal (fun i=> x i e)
    3695
    3696variable {p : Shape} {n : ℕ} {I : Bool→ Type}
    3697 [∀ i,Fintype (I i)] [∀ i,DecidableEq (I i)]
    3698end
    3699end Lax793645.ConstructionData.Frames
    3700end
    3701
    3702section
    3703namespace Lax793645.ConstructionData.Frames
    3704open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3705open Finset Matrix Function LinearMap
    3706noncomputable section
    3707set_option backward.isDefEq.respectTransparency false
    3708variable {I : Type} [Fintype I] [DecidableEq I] {N : ℕ}
    3709/-- Only symmetric supported Gram characters are fixed. This is precisely
    3710quadratic Gram information, without specifying ordered pairings. -/
    3711def quadraticTraced (E : Rail I) (Z : Mat I I) (x : KeyCoordinates I N) : Prop:=
    3712 ∀ M : Mat I I,Mᵀ=M → withinRail M E → gramPrimitive M x=mpair M Z
    3713
    3714end
    3715end Lax793645.ConstructionData.Frames
    3716end
    3717
    3718section
    3719namespace Lax793645.ConstructionData.Frames
    3720open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3721open Finset Matrix Function LinearMap Module Submodule
    3722noncomputable section
    3723set_option backward.isDefEq.respectTransparency false
    3724variable {I G : Type} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G]
    3725def geoMatrix (g : Route I G) (A : GeoM g) : Mat I I:=
    3726 fun i j=> if h:g i=g j then A (g i) ⟨i,rfl⟩ ⟨j,h.symm⟩ else 0
    3727
    3728end
    3729end Lax793645.ConstructionData.Frames
    3730end
    3731
    3732section
    3733namespace Lax793645.ConstructionData.Frames
    3734open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3735open Matrix
    3736open scoped BigOperators
    3737noncomputable section
    3738set_option backward.isDefEq.respectTransparency false
    3739/-- N is half the ambient dimension. The primal frame is stored once. -/
    3740abbrev OneFrame (p : Shape) (n N : ℕ) :=
    3741 QuadraticFull (Ray p n) (Vec (Fin p.h))→ₗ[F]Vec (HyperbolicIdx N)
    3742
    3743abbrev OneOrient (p : Shape) (n N : ℕ) := Comp p.g→ OneFrame p n N
    3744
    3745abbrev OneAmbient (p : Shape) (N : ℕ) :=
    3746 Comp p.g→ Mat (HyperbolicIdx N) (HyperbolicIdx N)
    3747
    3748variable {p : Shape} {n N : ℕ}
    3749def oneFrameLaw (m : Mixer p n) (o : OneOrient p n N) : Prop :=
    3750 ∀ e,quadraticChannelValid (hyperbolicMatrix N).toQuadraticForm'
    3751 (selfM p n m.mixM).toQuadraticForm' (o e)
    3752
    3753def onePrimal (P : OneFrame p n N) : Ray p n→ₗ[F]Vec (HyperbolicIdx N) :=
    3754 P.comp quadraticPrimalIn
    3755
    3756def oneChannelX (P : OneFrame p n N) (j : Fin p.h) :=
    3757 P (quadraticXIn (Pi.single j 1))
    3758
    3759def oneChannelY (P : OneFrame p n N) (j : Fin p.h) :=
    3760 P (quadraticYIn (Pi.single j 1))
    3761
    3762def oneMomentEmbed (o : OneOrient p n N) : Profile p n→ₗ[F]OneAmbient p N where
    3763 toFun x e:=quadraticMomentMap (onePrimal (o e)) (x e)
    3764 map_add' x y:=by ext e i j; simp only [Pi.add_apply,map_add,Matrix.add_apply]
    3765 map_smul' c x:=by ext e i j; simp only [Pi.smul_apply,map_smul,RingHom.id_apply,
    3766 Matrix.smul_apply]
    3767
    3768def oneFunctional (o : OneOrient p n N) : OneAmbient p N→ₗ[F]F where
    3769 toFun x:=∑ e,quadraticChannelFunctional (hyperbolicMatrix N).toQuadraticForm'
    3770 (oneChannelX (o e)) (oneChannelY (o e)) (x e)
    3771 map_add' x y:=by simp only [Pi.add_apply,map_add,Finset.sum_add_distrib]
    3772 map_smul' c x:=by simp only [Pi.smul_apply,map_smul,RingHom.id_apply,
    3773 Finset.smul_sum]
    3774
    3775theorem one_primal_injective {m : Mixer p n} {o : OneOrient p n N}
    3776 (ho : oneFrameLaw m o) (e : Comp p.g) : Function.Injective (onePrimal (o e)) := by
    3777 intro x y he
    3778 exact congrArg Prod.fst ((ho e).1 he)
    3779
    3780theorem one_moment_injective {m : Mixer p n} {o : OneOrient p n N}
    3781 (ho : oneFrameLaw m o) : Function.Injective (oneMomentEmbed o) := by
    3782 intro x y he
    3783 funext e
    3784 exact quadratic_moment_injective _ (one_primal_injective ho e) (congrFun he e)
    3785
    3786/-- The hole definition uses the new single-frame embedding and functional. -/
    3787def oneHole (m : Mixer p n) (x y : OneOrient p n N) : Prop :=
    3788 oneFrameLaw m x ∧ oneFrameLaw m y ∧ ∃ v w : Profile p n,
    3789 v∈Xspace p n ∧ w∈Xspace p n ∧
    3790 oneMomentEmbed x v=oneMomentEmbed y w ∧
    3791 (∀ i∈Xspace p n,oneFunctional y (oneMomentEmbed x i)=grad m v i) ∧
    3792 (∀ i∈Xspace p n,oneFunctional x (oneMomentEmbed y i)=grad m w i) ∧
    3793 role p n v+role p n w=1
    3794
    3795theorem one_hole_sym {m : Mixer p n} {x y : OneOrient p n N}
    3796 (h : oneHole m x y) : oneHole m y x := by
    3797 obtain ⟨hx,hy,v,w,hv,hw,he,h,g,hp⟩:=h
    3798 exact ⟨hy,hx,w,v,hw,hv,he.symm,g,h,(add_comm _ _).trans hp⟩
    3799
    3800theorem one_hole_irrefl (m : Mixer p n) (x : OneOrient p n N) : ¬oneHole m x x := by
    3801 rintro ⟨hx,_,v,w,_,_,he,_,_,hp⟩
    3802 rw [one_moment_injective hx he,char_two] at hp
    3803 exact zero_ne_one hp
    3804
    3805theorem one_hole_triangle {m : Mixer p n} {x y z : OneOrient p n N}
    3806 (h1 : oneHole m x y) (h2 : oneHole m y z) : ¬oneHole m x z := by
    3807 intro h3
    3808 obtain ⟨_,_,a,b,ha,hb,hab,u1,u2,p1⟩:=h1
    3809 obtain ⟨_,_,c,d,hc,hd,hcd,u3,u4,p2⟩:=h2
    3810 obtain ⟨_,_,e,f,he,hf,hef,u5,u6,p3⟩:=h3
    3811 have hx : grad m b c=grad m f d := by rw [←u2 _ hc,←u6 _ hd,hcd]
    3812 have hy : grad m a e=grad m d f := by rw [←u1 _ he,←u4 _ hf,hef]
    3813 have hz : grad m e a=grad m c b := by rw [←u5 _ ha,←u3 _ hb,hab]
    3814 simp only [grad_val] at hx hy hz
    3815 let A:=role p n
    3816 let T:=Tsym m
    3817 have cancel (x y : F) (he : x=y) : x+y=0 := by rw [he,char_two]
    3818 have ht (u v) : T u v+T v u=0:=cancel _ _ (T_swap m _ _)
    3819 have hp : (A a+A b)+(A c+A d)+(A e+A f)=0 := by
    3820 change A _+T _ _=A _+T _ _ at hx hy hz
    3821 calc
    3822 (A a+A b)+(A c+A d)+(A e+A f)
    3823 = ((A c+T b c)+(A d+T f d))+
    3824 ((A e+T a e)+(A f+T d f))+
    3825 ((A a+T e a)+(A b+T c b)) := by
    3826 symm
    3827 calc
    3828 _ = ((A a+A b)+(A c+A d)+(A e+A f))+
    3829 (T b c+T c b)+(T f d+T d f)+(T a e+T e a) := by ac_rfl
    3830 _ = _ := by simp only [ht,add_zero]
    3831 _ = 0 := by rw [cancel _ _ hx,cancel _ _ hy,cancel _ _ hz]; simp
    3832 unfold A at hp
    3833 rw [p1,p2,p3,char_two,zero_add] at hp
    3834 exact one_ne_zero hp
    3835
    3836def oneRawHoles (m : Mixer p n) : Holes (OneOrient p n N) where
    3837 rel:=oneHole m
    3838 sym:=one_hole_sym
    3839 irr:=one_hole_irrefl m
    3840 ntri:=one_hole_triangle
    3841
    3842end
    3843end Lax793645.ConstructionData.Frames
    3844end
    3845
    3846section
    3847namespace Lax793645.ConstructionData.Frames
    3848open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3849noncomputable section
    3850set_option backward.isDefEq.respectTransparency false
    3851variable {p : Shape} {n N : ℕ}
    3852instance oneFrameFintype (p : Shape) (n N : ℕ) : Fintype (OneFrame p n N) := by
    3853 classical
    3854 letI : Fintype (QuadraticFull (Ray p n) (Vec (Fin p.h))):=inferInstance
    3855 letI : Fintype (Vec (HyperbolicIdx N)):=inferInstance
    3856 exact Fintype.ofInjective (fun f : OneFrame p n N=>⇑f) DFunLike.coe_injective
    3857
    3858instance oneOrientFintype (p : Shape) (n N : ℕ) : Fintype (OneOrient p n N) :=
    3859 inferInstanceAs (Fintype (Comp p.g→ OneFrame p n N))
    3860
    3861/-- The new raw law samples independent, uniformly distributed single frames
    3862at the cycle components. The own X-channel constraints are part of its support. -/
    3863def oneRaw (m : Mixer p n) (N : ℕ) : Wgt (OneOrient p n N) := by
    3864 classical
    3865 exact prodW (fun _ : Comp p.g=> quadraticChannelRaw (C:=Vec (Fin p.h))
    3866 (hyperbolicMatrix N).toQuadraticForm' (selfM p n m.mixM).toQuadraticForm')
    3867
    3868end
    3869end Lax793645.ConstructionData.Frames
    3870end
    3871
    3872section
    3873namespace Lax793645.ConstructionData.Frames
    3874open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3875open Matrix Submodule
    3876open scoped BigOperators
    3877noncomputable section
    3878set_option backward.isDefEq.respectTransparency false
    3879variable {A B : Type} [AddCommGroup A] [Module F A] [AddCommGroup B] [Module F B]
    3880abbrev UnitChannels (h : ℕ) := Bool→ Hyperbolic h
    3881
    3882end
    3883end Lax793645.ConstructionData.Frames
    3884end
    3885
    3886section
    3887namespace Lax793645.ConstructionData.Frames
    3888open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3889open Matrix Submodule
    3890open scoped BigOperators
    3891noncomputable section
    3892set_option backward.isDefEq.respectTransparency false
    3893variable {p : Shape} {n : ℕ}
    3894def jointCutMap : (Bool→ Profile p n)→ₗ[F]JointProfile p n where
    3895 toFun:=jointCutEmbed
    3896 map_add' x y:=by
    3897 funext e
    3898 exact Matrix.blockDiagonal_add _ _
    3899 map_smul' c x:=by
    3900 funext e
    3901 exact Matrix.blockDiagonal_smul c _
    3902
    3903def jointXspace : Space (JointProfile p n) :=
    3904 (Submodule.pi Set.univ (fun _ : Bool=> Xspace p n)).map jointCutMap
    3905
    3906def jointEndpointMap (i : Bool) : Profile p n→ₗ[F]JointProfile p n :=
    3907 jointCutMap.comp (LinearMap.single F (fun _ : Bool=> Profile p n) i)
    3908
    3909def jointMatrixFunctional (M : JointProfile p n) : JointProfile p n→ₗ[F]F :=
    3910 ∑ e,(mpair (M e)).comp (LinearMap.proj e)
    3911
    3912def jointQuadraticConstraints (P K : Comp p.g→ Space (JointRay p n)) :
    3913 Space (JointProfile p n) :=
    3914 Submodule.pi Set.univ (fun e=> quadraticSquares (P e)⊔quadraticCross (K e))
    3915
    3916end
    3917end Lax793645.ConstructionData.Frames
    3918end
    3919
    3920section
    3921namespace Lax793645.ConstructionData.Frames
    3922open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3923open Matrix Submodule
    3924open scoped BigOperators
    3925noncomputable section
    3926set_option backward.isDefEq.respectTransparency false
    3927variable {p : Shape} {n : ℕ}
    3928def jointCompressionRank (p : Shape) (f r : ℕ) : ℕ:=2* drow p (2* f) (2* r)
    3929
    3930end
    3931end Lax793645.ConstructionData.Frames
    3932end
    3933
    3934section
    3935namespace Lax793645.ConstructionData.Frames
    3936open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3937open Matrix Submodule
    3938noncomputable section
    3939set_option backward.isDefEq.respectTransparency false
    3940variable {p : Shape} {n : ℕ}
    3941def frozenChannelKernel {I : Type} [Fintype I] (h : ℕ) (P : Space (Vec I))
    3942 (C : Space (Hyperbolic h)) (g₀ : P→ₗ[F]Hyperbolic h) : Space (Vec I) :=
    3943 (C.comap g₀).map P.subtype
    3944
    3945end
    3946end Lax793645.ConstructionData.Frames
    3947end
    3948
    3949section
    3950namespace Lax793645.ConstructionData.Frames
    3951open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3952open Matrix Submodule
    3953open scoped BigOperators
    3954noncomputable section
    3955set_option backward.isDefEq.respectTransparency false
    3956abbrev OneUnit (p : Shape) (n N : ℕ) := Bool→ OneOrient p n N
    3957
    3958abbrev OneUnitFull (p : Shape) (n : ℕ) := JointRay p n×UnitChannels p.h
    3959
    3960variable {p : Shape} {n N : ℕ}
    3961def oneUnitMap (x : OneUnit p n N) (e : Comp p.g) :
    3962 OneUnitFull p n→ₗ[F]Vec (HyperbolicIdx N) :=
    3963 ∑ i,(x i e).comp
    3964 (((jointProjection i).comp (LinearMap.fst F _ _)).prod
    3965 ((LinearMap.proj i).comp (LinearMap.snd F _ _)))
    3966
    3967def oneUnitActual (x y : OneUnit p n N) (e : Comp p.g) :
    3968 OneUnitFull p n→ₗ[F]OneUnitFull p n→ₗ[F]F :=
    3969 (hyperbolicMatrix N).toQuadraticForm'.polarBilin.compl₁₂ (oneUnitMap x e) (oneUnitMap y e)
    3970
    3971end
    3972end Lax793645.ConstructionData.Frames
    3973end
    3974
    3975section
    3976namespace Lax793645.ConstructionData.Frames
    3977open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3978open Matrix Submodule
    3979open scoped BigOperators
    3980noncomputable section
    3981set_option backward.isDefEq.respectTransparency false
    3982variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I]
    3983abbrev OneKeys (t : Tagging p I) (N : ℕ) := ∀ a,TagStar (t a)→ Vec (HyperbolicIdx N)
    3984
    3985def oneVolleyKeys (v : Volley p n I) (t : Tagging p I) (x : OneUnit p n N) : OneKeys t N :=
    3986 fun a e=> onePrimal (x (v.obj a) e.val) (v.rayAt a)
    3987
    3988end
    3989end Lax793645.ConstructionData.Frames
    3990end
    3991
    3992section
    3993namespace Lax793645.ConstructionData.Frames
    3994open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    3995open Submodule
    3996open scoped BigOperators
    3997noncomputable section
    3998set_option backward.isDefEq.respectTransparency false
    3999variable {I J : Type} [Fintype I] [Fintype J] {V : J→ Type}
    4000 [∀ j,AddCommGroup (V j)] [∀ j,Module F (V j)] [∀ j,FiniteDimensional F (V j)]
    4001def coordinateClosure (E : Vec I≃ₗ[F](∀ j,V j)) (P : Space (Vec I)) : Space (Vec I) :=
    4002 (blockClosure (P.map E.toLinearMap)).map E.symm.toLinearMap
    4003
    4004theorem coordinate_closure_map (E : Vec I≃ₗ[F](∀ j,V j)) (P : Space (Vec I)) :
    4005 (coordinateClosure E P).map E.toLinearMap=blockClosure (P.map E.toLinearMap) := by
    4006 rw [coordinateClosure,←Submodule.map_comp]
    4007 simp
    4008
    4009theorem le_coordinate_closure (E : Vec I≃ₗ[F](∀ j,V j)) (P : Space (Vec I)) :
    4010 P≤ coordinateClosure E P := by
    4011 intro v hv
    4012 exact ⟨E v,le_blockClosure _ ⟨v,hv,rfl⟩,E.symm_apply_apply v⟩
    4013
    4014theorem coordinate_closure_idempotent (E : Vec I≃ₗ[F](∀ j,V j)) (P : Space (Vec I)) :
    4015 coordinateClosure E (coordinateClosure E P)=coordinateClosure E P := by
    4016 change (blockClosure ((coordinateClosure E P).map E.toLinearMap)).map E.symm.toLinearMap=_
    4017 rw [coordinate_closure_map,blockClosure_idempotent]
    4018 rfl
    4019
    4020theorem coordinate_closure_growth (E : Vec I≃ₗ[F](∀ j,V j)) (P Q : Space (Vec I))
    4021 (hPQ : P≤ Q) (hP : coordinateClosure E P=P) :
    4022 dim (coordinateClosure E Q)-dim P≤ Fintype.card J*(dim Q-dim P) := by
    4023 have hp : blockClosure (P.map E.toLinearMap)=P.map E.toLinearMap :=
    4024 (coordinate_closure_map E P).symm.trans (congrArg (Submodule.map E.toLinearMap) hP)
    4025 have h:=blockClosure_dimension_step (P.map E.toLinearMap) (Q.map E.toLinearMap)
    4026 (Submodule.map_mono hPQ) hp
    4027 have he : dim (coordinateClosure E Q)=dim (blockClosure (Q.map E.toLinearMap)):=
    4028 E.symm.finrank_map_eq _
    4029 change dim (blockClosure (Q.map E.toLinearMap))-dim (P.map E.toLinearMap)≤
    4030 Fintype.card J*(dim (Q.map E.toLinearMap)-dim (P.map E.toLinearMap)) at h
    4031 rw [he]
    4032 simpa only [dim,LinearEquiv.finrank_map_eq] using h
    4033
    4034variable {C : Type} [Fintype C]
    4035/-- Closing every component under the same coordinate blocks has the
    4036same closure factor; the number of components does not inflate it. -/
    4037def coordinateImageClosure (E : Vec I≃ₗ[F](∀ j,V j)) : ImageClosure C I (Fintype.card J) where
    4038 close P e:=coordinateClosure E (P e)
    4039 extensive P e:=le_coordinate_closure E (P e)
    4040 idempotent P:=funext (fun e=> coordinate_closure_idempotent E (P e))
    4041 growth P Q hPQ hP:=by
    4042 have hg (e : C) : dim (coordinateClosure E (Q e))≤
    4043 dim (P e)+Fintype.card J*(dim (Q e)-dim (P e)) := by
    4044 have h:=coordinate_closure_growth E (P e) (Q e) (hPQ e) (congrFun hP e)
    4045 omega
    4046 have hh:=Finset.sum_le_sum (s:=Finset.univ) (fun e _=> hg e)
    4047 rw [Finset.sum_add_distrib,←Finset.mul_sum] at hh
    4048 have hd : (∑ e,(dim (Q e)-dim (P e)))=imagePlanRank Q-imagePlanRank P := by
    4049 rw [imagePlanRank,imagePlanRank,Finset.sum_tsub_distrib]
    4050 exact fun e _=> Submodule.finrank_mono (hPQ e)
    4051 rw [hd] at hh
    4052 change imagePlanRank (fun e=> coordinateClosure E (Q e))≤
    4053 imagePlanRank P+Fintype.card J*(imagePlanRank Q-imagePlanRank P) at hh
    4054 omega
    4055
    4056end
    4057end Lax793645.ConstructionData.Frames
    4058end
    4059
    4060section
    4061namespace Lax793645.ConstructionData.Frames
    4062open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4063open Matrix Submodule
    4064noncomputable section
    4065set_option backward.isDefEq.respectTransparency false
    4066abbrev OneBlock := Bool⊕(Bool⊕Bool)
    4067
    4068def oneBlockSlots (p : Shape) (n : ℕ) : OneBlock→ Type
    4069 | Sum.inl _=> Row p n
    4070 | Sum.inr _=> Fin p.h
    4071
    4072instance oneBlockSlotsFintype (p : Shape) (n : ℕ) (b : OneBlock) : Fintype (oneBlockSlots p n b) := by
    4073 cases b <;> dsimp only [oneBlockSlots] <;> infer_instance
    4074
    4075instance oneBlockSlotsDecidable (p : Shape) (n : ℕ) (b : OneBlock) : DecidableEq (oneBlockSlots p n b) := by
    4076 cases b <;> dsimp only [oneBlockSlots] <;> infer_instance
    4077
    4078abbrev OneColumn (p : Shape) (n : ℕ) := Σ b : OneBlock,oneBlockSlots p n b
    4079
    4080def oneBlockCoordinates (p : Shape) (n : ℕ) :
    4081 Vec (OneColumn p n)≃ₗ[F](∀ b : OneBlock,Vec (oneBlockSlots p n b)) where
    4082 toFun v b i:=v ⟨b,i⟩
    4083 invFun v i:=v i.1 i.2
    4084 left_inv _:=rfl
    4085 right_inv _:=rfl
    4086 map_add' _ _:=rfl
    4087 map_smul' _ _:=rfl
    4088
    4089def oneNominalCoordinates (p : Shape) (n : ℕ) : Vec (OneColumn p n)≃ₗ[F]OneUnitFull p n where
    4090 toFun v:=(fun ri=> v ⟨Sum.inl ri.2,ri.1⟩,
    4091 fun i=>(fun j=> v ⟨Sum.inr (Sum.inl i),j⟩,fun j=> v ⟨Sum.inr (Sum.inr i),j⟩))
    4092 invFun v k:=match k with
    4093 | ⟨Sum.inl i,r⟩=> v.1 (r,i)
    4094 | ⟨Sum.inr (Sum.inl i),j⟩=>((v.2 i).1) j
    4095 | ⟨Sum.inr (Sum.inr i),j⟩=>((v.2 i).2) j
    4096 left_inv v:=by
    4097 funext k
    4098 rcases k with ⟨i,k⟩
    4099 rcases i with i|i
    4100 · rfl
    4101 · cases i <;> rfl
    4102 right_inv _:=rfl
    4103 map_add' _ _:=rfl
    4104 map_smul' _ _:=rfl
    4105
    4106def oneAmbientCoordinates (N : ℕ) : Vec (HyperbolicIdx N)≃ₗ[F]Vec (Fin (2* N)) :=
    4107 LinearEquiv.funCongrLeft F F
    4108 (finSumFinEquiv.trans (finCongr (Nat.two_mul N).symm)).symm
    4109
    4110def oneCoordinateImages {p : Shape} {n N : ℕ} (x : OneUnit p n N) (e : Comp p.g) :
    4111 Mat (Fin (2* N)) (OneColumn p n) :=
    4112 LinearMap.toMatrix' ((oneAmbientCoordinates N).toLinearMap.comp
    4113 ((oneUnitMap x e).comp (oneNominalCoordinates p n).toLinearMap))
    4114
    4115/-- The actual one-frame nominal columns split into P1, P2, X1, X2, Y1,
    4116Y2. The resulting closure factor is exactly six. -/
    4117def onePinClosure (p : Shape) (n : ℕ) : ImageClosure (Comp p.g) (OneColumn p n) 6 := by
    4118 have hc : Fintype.card OneBlock=6:=by simp [OneBlock]
    4119 exact hc ▸ coordinateImageClosure (oneBlockCoordinates p n)
    4120
    4121end
    4122end Lax793645.ConstructionData.Frames
    4123end
    4124
    4125section
    4126namespace Lax793645.ConstructionData.Frames
    4127open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4128open Matrix Submodule
    4129open scoped BigOperators
    4130noncomputable section
    4131set_option backward.isDefEq.respectTransparency false
    4132abbrev OneFull (p : Shape) (n : ℕ) := QuadraticFull (Ray p n) (Vec (Fin p.h))
    4133
    4134variable {p : Shape} {n N : ℕ}
    4135end
    4136end Lax793645.ConstructionData.Frames
    4137end
    4138
    4139section
    4140namespace Lax793645.ConstructionData.Frames
    4141open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4142open Matrix Submodule
    4143open scoped BigOperators
    4144noncomputable section
    4145set_option backward.isDefEq.respectTransparency false
    4146variable {p : Shape} {n N : ℕ}
    4147def oneUnitRaw (m : Mixer p n) (N : ℕ) : Wgt (OneUnit p n N) :=
    4148 prodW (fun _ : Bool=> oneRaw m N)
    4149
    4150end
    4151end Lax793645.ConstructionData.Frames
    4152end
    4153
    4154section
    4155namespace Lax793645.ConstructionData.Frames
    4156open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4157open Finset Matrix LinearMap Function
    4158noncomputable section
    4159set_option backward.isDefEq.respectTransparency false
    4160variable {I G : Type} [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G]
    4161 {p : Shape} {n N : ℕ}
    4162def oneScatter (t : Tagging p I) (N : ℕ) : OneKeys t N ≃ Rack (KeySlots p t) N where
    4163 toFun x:=(fun a i=> x i.1 i.2 (Sum.inl a),fun a i=> x i.1 i.2 (Sum.inr a))
    4164 invFun x:=fun i e a=> Sum.elim (x.1.col ⟨i,e⟩) (x.2.col ⟨i,e⟩) a
    4165 left_inv x:=by funext i e a; cases a <;> rfl
    4166 right_inv x:=by apply Prod.ext <;> rfl
    4167
    4168end
    4169end Lax793645.ConstructionData.Frames
    4170end
    4171
    4172section
    4173namespace Lax793645.ConstructionData.Frames
    4174open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4175open Finset Matrix Function LinearMap
    4176open scoped Classical
    4177noncomputable section
    4178set_option backward.isDefEq.respectTransparency false
    4179variable {I T G : Type} [Fintype I] [DecidableEq I] [Fintype T] [DecidableEq T]
    4180 [Fintype G] [DecidableEq G] {p : Shape} {n N : ℕ}
    4181def oneTemplateCoordinates (v : Template p I) (o : OneUnit p n N) (x : Inputs p n I) :
    4182 KeyCoordinates (KeySlots p v.t) N:=
    4183 (rackCoordinates (KeySlots p v.t) N).symm (oneScatter v.t N (oneVolleyKeys (v.draw x) v.t o))
    4184
    4185end
    4186end Lax793645.ConstructionData.Frames
    4187end
    4188
    4189section
    4190namespace Lax793645.ConstructionData.Frames
    4191open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4192open LinearMap Module Function
    4193noncomputable section
    4194set_option backward.isDefEq.respectTransparency false
    4195variable {B R V : Type} [AddCommGroup B] [Module F B]
    4196 [AddCommGroup R] [Module F R] [FiniteDimensional F R]
    4197 [AddCommGroup V] [Module F V] [FiniteDimensional F V]
    4198def quadraticPolarRead (q : QuadraticForm F V) (P : R→ₗ[F]V) :
    4199 V→ₗ[F]Module.Dual F R:=P.dualMap.comp q.polarBilin
    4200
    4201variable [Fintype V] [Fintype (B→ₗ[F]V)] [Fintype (Module.Dual F R)]
    4202end
    4203end Lax793645.ConstructionData.Frames
    4204end
    4205
    4206section
    4207namespace Lax793645.ConstructionData.Frames
    4208open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4209open Matrix LinearMap Module Submodule
    4210open scoped BigOperators
    4211noncomputable section
    4212set_option backward.isDefEq.respectTransparency false
    4213abbrev OneChannels (p : Shape) (N : ℕ) := Vec (HyperbolicIdx p.h)→ₗ[F]Vec (HyperbolicIdx N)
    4214
    4215def oneChannelIn (p : Shape) (n : ℕ) : Vec (HyperbolicIdx p.h)→ₗ[F]OneFull p n:=
    4216 (LinearMap.inr F _ _).comp (hyperbolicCoordinates p.h).toLinearMap
    4217
    4218variable {p : Shape} {n N : ℕ}
    4219def oneChannels (x : OneFrame p n N) : OneChannels p N:=x.comp (oneChannelIn p n)
    4220
    4221def oneChannelPrice (p : Shape) := bp ((2*(p.h:ℝ))^2+2)
    4222
    4223def oneCubePrice (p : Shape) := (oneChannelPrice p)^(Fintype.card (Comp p.g))
    4224
    4225end
    4226end Lax793645.ConstructionData.Frames
    4227end
    4228
    4229section
    4230namespace Lax793645.ConstructionData.Frames
    4231open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4232open Matrix LinearMap Module Submodule
    4233open scoped BigOperators
    4234noncomputable section
    4235set_option backward.isDefEq.respectTransparency false
    4236def oneDualCoordinates (N : ℕ) : Vec (HyperbolicIdx N)≃ₗ[F]Vec (Fin (2* N)) :=
    4237 (LinearEquiv.funCongrLeft F F (Equiv.sumComm (Fin N) (Fin N))).trans
    4238 (oneAmbientCoordinates N)
    4239
    4240def splitChannelMatrix {A J : Type} [Fintype A] [Fintype J] :
    4241 Mat A (J⊕J)≃ₗ[F](Mat A J×Mat A J) where
    4242 toFun M:=(fun a j=> M a (Sum.inl j),fun a j=> M a (Sum.inr j))
    4243 invFun M:=Matrix.fromCols M.1 M.2
    4244 left_inv M:=by ext a j; cases j <;> rfl
    4245 right_inv _:=rfl
    4246 map_add' _ _:=rfl
    4247 map_smul' _ _:=rfl
    4248
    4249/-- Polar channel evaluations are a bijective change of coordinates on
    4250the entire channel pair, so their uniform law is exactly the old free law. -/
    4251def oneChannelPairEquiv (p : Shape) (N : ℕ) : OneChannels p N≃ₗ[F]HFrame p (2* N) :=
    4252 (((LinearEquiv.arrowCongr (LinearEquiv.refl F (Vec (HyperbolicIdx p.h)))
    4253 (oneDualCoordinates N)).trans LinearMap.toMatrix').trans splitChannelMatrix).trans
    4254 (LinearEquiv.prodComm F _ _)
    4255
    4256def onePhaseCube {p : Shape} {n N : ℕ} (o : OneOrient p n N) : HCube p (2* N) :=
    4257 fun e=> oneChannelPairEquiv p N (oneChannels (o e))
    4258
    4259end
    4260end Lax793645.ConstructionData.Frames
    4261end
    4262
    4263section
    4264namespace Lax793645.ConstructionData.Frames
    4265open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4266open Matrix LinearMap Module Submodule
    4267open scoped BigOperators
    4268noncomputable section
    4269set_option backward.isDefEq.respectTransparency false
    4270variable {p : Shape} {n N : ℕ}
    4271def oneListens (x : OneUnit p n N) : PhasePair p (2* N):=
    4272 (onePhaseCube (x true),onePhaseCube (x false))
    4273
    4274end
    4275end Lax793645.ConstructionData.Frames
    4276end
    4277
    4278section
    4279namespace Lax793645.ConstructionData.Frames
    4280open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4281open LinearMap Module Function Finset
    4282open scoped Classical
    4283noncomputable section
    4284set_option backward.isDefEq.respectTransparency false
    4285variable {p : Shape} {n N : ℕ}
    4286def oneFreeColumns (p : Shape) (n : ℕ) (s : Label p.b) :
    4287 Vec (Fin n)→ₗ[F]OneFull p n:=
    4288 quadraticPrimalIn.comp (blockRay p n s Block.Z).mulVecLin
    4289
    4290def oneMixedRow (J : Vec (Fin n)→ₗ[F]OneFull p n) (o : OneOrient p n N) :
    4291 (Comp p.g→ Vec (HyperbolicIdx N))→ₗ[F]Module.Dual F (Vec (Fin n)):=
    4292 ∑ e,(quadraticPolarRead (hyperbolicMatrix N).toQuadraticForm' ((o e).comp J)).comp
    4293 (LinearMap.proj e)
    4294
    4295end
    4296end Lax793645.ConstructionData.Frames
    4297end
    4298
    4299section
    4300namespace Lax793645.ConstructionData.Frames
    4301open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4302open LinearMap Module Function Finset Submodule
    4303open scoped Classical
    4304noncomputable section
    4305set_option backward.isDefEq.respectTransparency false
    4306variable {p : Shape} {n N : ℕ}
    4307abbrev OneJointKey (p : Shape) (N : ℕ):=Comp p.g→ Vec (HyperbolicIdx N)
    4308
    4309abbrev OneAtomKey (l : Tag p.g) (N : ℕ):=TagStar l→ Vec (HyperbolicIdx N)
    4310
    4311abbrev OneAugur (p : Shape) (N : ℕ):=∀ l : Tag p.g,F→ OneAtomKey l N→ F
    4312
    4313def OneLinearAugur (g : OneAugur p N) (R : ℕ):=∀ l,HasLinearCells (g l) R
    4314
    4315def oneStarKey (l : Tag p.g) : OneJointKey p N→ₗ[F]OneAtomKey l N:=
    4316 LinearMap.pi (fun e=> LinearMap.proj e.val)
    4317
    4318end
    4319end Lax793645.ConstructionData.Frames
    4320end
    4321
    4322section
    4323namespace Lax793645.ConstructionData.Frames
    4324open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4325open Matrix Function LinearMap Submodule Finset Module
    4326open scoped BigOperators
    4327noncomputable section
    4328set_option backward.isDefEq.respectTransparency false
    4329variable {p : Shape} {n N : ℕ}
    4330def onePrimalKey (o : OneOrient p n N) : Ray p n→ₗ[F]OneJointKey p N:=
    4331 LinearMap.pi (fun e=> onePrimal (o e))
    4332
    4333def oneAtomKeyValue (o : OneOrient p n N) (l : Tag p.g) (s : Label p.b)
    4334 (z : Base p.g n) : OneAtomKey l N:=oneStarKey l (onePrimalKey o (point p s z))
    4335
    4336end
    4337end Lax793645.ConstructionData.Frames
    4338end
    4339
    4340section
    4341namespace Lax793645.ConstructionData.Frames
    4342open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4343open Finset Matrix Function LinearMap Filter Real
    4344open scoped Classical Topology
    4345noncomputable section
    4346set_option backward.isDefEq.respectTransparency false
    4347variable {I : Type} [Fintype I] [DecidableEq I] {p : Shape} {n N : ℕ}
    4348def oneCallOne (v : Template p I) (i : I) (x : Knobs p.g n) (o : OneOrient p n N):=
    4349 oneAtomKeyValue o (v.t i) (v.s i) (lit (v.f i) (v.t i) x)
    4350
    4351end
    4352end Lax793645.ConstructionData.Frames
    4353end
    4354
    4355section
    4356namespace Lax793645.ConstructionData.Frames
    4357open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4358open Finset Matrix Function LinearMap
    4359open scoped Classical
    4360noncomputable section
    4361set_option backward.isDefEq.respectTransparency false
    4362variable {p : Shape} {n N : ℕ}
    4363/-- A coordinate equivalence, not a pair of independently sampled frames. -/
    4364def oneAtomSplit (l : Tag p.g) (N : ℕ) : OneAtomKey l N≃AtomKey l N where
    4365 toFun x e b a:=x e (if b then Sum.inl a else Sum.inr a)
    4366 invFun x e:=Sum.elim (x e true) (x e false)
    4367 left_inv x:=by funext e a; cases a <;> rfl
    4368 right_inv x:=by funext e b a; cases b <;> rfl
    4369
    4370def oneLawOmega (p : Shape) (N : ℕ) (l : Tag p.g) (q : F) : Wgt (OneAtomKey l N):=
    4371 mapW (lawOmega p N l q) (oneAtomSplit l N).symm
    4372
    4373def oneDesc (v : Template.Solo p) (x : Knobs p.g n) (o : OneOrient p n N):=
    4374 oneCallOne v () x o
    4375
    4376end
    4377end Lax793645.ConstructionData.Frames
    4378end
    4379
    4380section
    4381namespace Lax793645.ConstructionData.Frames
    4382open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4383open Matrix Submodule
    4384noncomputable section
    4385set_option backward.isDefEq.respectTransparency false
    4386def channelQuadraticMatrix {D : Type} [Fintype D] [DecidableEq D] (h : ℕ) (g : Vec D→ₗ[F]Hyperbolic h) : Mat D D:=
    4387 Classical.choose (hyperbolic_matrix_representative h g)
    4388
    4389variable {p : Shape} {n : ℕ} {I : Bool→ Type}
    4390 [∀ i,Fintype (I i)] [∀ i,DecidableEq (I i)]
    4391end
    4392end Lax793645.ConstructionData.Frames
    4393end
    4394
    4395section
    4396namespace Lax793645.ConstructionData.Frames
    4397open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4398open Matrix LinearMap Module Submodule
    4399open scoped BigOperators
    4400noncomputable section
    4401set_option backward.isDefEq.respectTransparency false
    4402def oneAmbientPolar (N : ℕ) : LinearMap.BilinForm F (Vec (Fin (2* N))) :=
    4403 (hyperbolicMatrix N).toQuadraticForm'.polarBilin.compl₁₂
    4404 (oneAmbientCoordinates N).symm.toLinearMap (oneAmbientCoordinates N).symm.toLinearMap
    4405
    4406variable {p : Shape} {n N : ℕ}
    4407abbrev OneCross (p : Shape) (n : ℕ) := ImageCross (Comp p.g) (OneColumn p n)
    4408
    4409def oneTableOfCross (Q : OneCross p n) (e : Comp p.g) :
    4410 LinearMap.BilinForm F (OneUnitFull p n):=
    4411 (Q e).toBilin'.compl₁₂ (oneNominalCoordinates p n).symm.toLinearMap
    4412 (oneNominalCoordinates p n).symm.toLinearMap
    4413
    4414variable {V : Type} [AddCommGroup V] [Module F V] [Fintype V]
    4415end
    4416end Lax793645.ConstructionData.Frames
    4417end
    4418
    4419section
    4420namespace Lax793645.ConstructionData.Frames
    4421open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4422open Matrix Submodule
    4423open scoped BigOperators
    4424noncomputable section
    4425set_option backward.isDefEq.respectTransparency false
    4426variable {A B : Type} [AddCommGroup A] [Module F A] [AddCommGroup B] [Module F B]
    4427def unitLeftChannels (h : ℕ)
    4428 (T : (A×UnitChannels h)→ₗ[F](B×UnitChannels h)→ₗ[F]F) (j : Bool) :
    4429 A→ₗ[F]Hyperbolic h :=
    4430 (LinearMap.BilinForm.toDual (hyperbolicQuadratic h).polarBilin
    4431 (hyperbolic_nondegenerate h)).symm.toLinearMap.comp
    4432 (T.compl₁₂ (LinearMap.inl F _ _)
    4433 ((LinearMap.inr F _ _).comp (LinearMap.single F (fun _ : Bool=> Hyperbolic h) j)))
    4434
    4435def unitRightChannels (h : ℕ)
    4436 (T : (A×UnitChannels h)→ₗ[F](B×UnitChannels h)→ₗ[F]F) (i : Bool) :
    4437 B→ₗ[F]Hyperbolic h := unitLeftChannels h T.flip i
    4438
    4439end
    4440end Lax793645.ConstructionData.Frames
    4441end
    4442
    4443section
    4444namespace Lax793645.ConstructionData.Frames
    4445open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4446open Matrix LinearMap Module Submodule
    4447open scoped BigOperators
    4448noncomputable section
    4449set_option backward.isDefEq.respectTransparency false
    4450abbrev OneCheckSide (p : Shape) (n : ℕ) :=
    4451 Bool→ Comp p.g→ JointRay p n→ₗ[F]Hyperbolic p.h
    4452
    4453abbrev OneCheckGram (p : Shape) (n : ℕ) := OneCheckSide p n×OneCheckSide p n
    4454
    4455variable {p : Shape} {n N : ℕ}
    4456end
    4457end Lax793645.ConstructionData.Frames
    4458end
    4459
    4460section
    4461namespace Lax793645.ConstructionData.Frames
    4462open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4463open Matrix LinearMap Module Submodule
    4464noncomputable section
    4465set_option backward.isDefEq.respectTransparency false
    4466variable {p : Shape} {n N : ℕ}
    4467def onePrimalPins (P : ImagePlan (Comp p.g) (OneColumn p n)) (e : Comp p.g) : Space (JointRay p n):=
    4468 (P e).map ((LinearMap.fst F _ _).comp (oneNominalCoordinates p n).toLinearMap)
    4469
    4470def oneChannelPins (P : ImagePlan (Comp p.g) (OneColumn p n)) (i : Bool) (e : Comp p.g) :
    4471 Space (Hyperbolic p.h):=
    4472 (P e).map ((LinearMap.proj i).comp ((LinearMap.snd F _ _).comp (oneNominalCoordinates p n).toLinearMap))
    4473
    4474variable {I : Type} [Fintype I]
    4475end
    4476end Lax793645.ConstructionData.Frames
    4477end
    4478
    4479section
    4480namespace Lax793645.ConstructionData.Frames
    4481open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4482open Matrix LinearMap Module Submodule
    4483open scoped BigOperators
    4484noncomputable section
    4485set_option backward.isDefEq.respectTransparency false
    4486variable {p : Shape} {n N : ℕ}
    4487def onePinSafe (P : Bool→ Comp p.g→ Space (Ray p n))
    4488 (C : Bool→ Comp p.g→ Space (Hyperbolic p.h)) (x y : OneUnit p n N) : Prop :=
    4489 ∀ e i j,∀ v∈P i e,
    4490 unitLeftChannels p.h (oneUnitActual x y e) j (jointInjection i v)∈C j e→ v=0
    4491
    4492end
    4493end Lax793645.ConstructionData.Frames
    4494end
    4495
    4496section
    4497namespace Lax793645.ConstructionData.Frames
    4498open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4499open Matrix LinearMap Module Submodule
    4500open scoped BigOperators
    4501noncomputable section
    4502set_option backward.isDefEq.respectTransparency false
    4503variable {p : Shape} {n : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    4504def oneSelectedPrimal (v : Volley p n I) (t : Tagging p I)
    4505 (P : Bool→ Comp p.g→ Space (Ray p n)) (e : Comp p.g) : Space (JointRay p n) :=
    4506 jointSpace (fun i=> P i e⊔selectedAtComponent
    4507 (fun a : CallsAt v i=> t a.val) (fun a=> v.sel a.val) (fun a=> v.par a.val) e)
    4508
    4509/-- The protected-subspace conditions needed by the joint quadratic
    4510annihilator, stated directly on the query's actual selected points. -/
    4511structure OneProtectedVolley (v : Volley p n I) (t : Tagging p I)
    4512 (P : Bool→ Comp p.g→ Space (Ray p n)) (R : ℕ) where
    4513 selector : Bool→ Space (Vec (SelIdx p.b p.j))
    4514 base : Bool→ Space (Vec (AIdx p.g n))
    4515 pinCross : ∀ i e,P i e≤ tensorCross (selector i) (base i)
    4516 selectorIndependent : ∀ i,LinearIndependent F ((selector i).mkQ∘
    4517 fun a : CallsAt v i=> selV p.j (v.sel a.val))
    4518 baseIndependent : ∀ i,LinearIndependent F ((base i).mkQ∘
    4519 fun a : CallsAt v i=> baseV (v.par a.val))
    4520 rankBound : ∀ e,2* dim (oneSelectedPrimal v t P e)≤ R
    4521 lowPin : ∀ i e,∀ u∈P i e,Matrix.rank (flattenMatrix.symm u)≤ R^2+Fintype.card (CallsAt v i)→
    4522 u∈tensorRectangle (selector i) (base i)
    4523
    4524variable {N : ℕ}
    4525end
    4526end Lax793645.ConstructionData.Frames
    4527end
    4528
    4529section
    4530namespace Lax793645.ConstructionData.Frames
    4531open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4532open Matrix LinearMap Module Submodule
    4533open scoped BigOperators
    4534noncomputable section
    4535set_option backward.isDefEq.respectTransparency false
    4536variable {p : Shape} {n : ℕ}
    4537def oneEndpointPrimalPins (P : ImagePlan (Comp p.g) (OneColumn p n))
    4538 (i : Bool) (e : Comp p.g) : Space (Ray p n) :=
    4539 (onePrimalPins P e).map (jointProjection i)
    4540
    4541variable {I : Type} [Fintype I] [DecidableEq I]
    4542end
    4543end Lax793645.ConstructionData.Frames
    4544end
    4545
    4546section
    4547namespace Lax793645.ConstructionData.Frames
    4548open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4549open Matrix LinearMap Module Submodule
    4550open scoped BigOperators
    4551noncomputable section
    4552set_option backward.isDefEq.respectTransparency false
    4553variable {p : Shape} {n N : ℕ}
    4554def oneEffectivePins (P : Bool→ Comp p.g→ Space (Ray p n)) (i : Bool) : Space (Profile p n) :=
    4555 Xspace p n⊓Submodule.pi Set.univ (fun e=> quadraticSquares (P i e))
    4556
    4557def oneInner (x : OneUnit p n N) (i : Bool) : Profile p n→ₗ[F]F:=
    4558 (oneFunctional (x (!i))).comp (oneMomentEmbed (x i))
    4559
    4560variable {I : Type} [Fintype I]
    4561structure OneScalarRecipe (v : Volley p n I) (w : I→ Bool) (t : Tagging p I)
    4562 (m : Mixer p n) (x y : OneUnit p n N)
    4563 (P : Bool→ Comp p.g→ Space (Ray p n)) : Prop where
    4564 summ (i j : Bool) : ∑ a∈v.shoots w i j,v.diagonalAt a=1
    4565 gradient (i j : Bool) (z : Profile p n) : z∈oneEffectivePins P i→
    4566 grad m (v.sumAt t w i j) z=oneFunctional (y j) (oneMomentEmbed (x i) z)
    4567
    4568def oneAttackGrad (v w : Volley p n I) (t : Tagging p I) (m : Mixer p n)
    4569 (y : OneUnit p n N) : Prop :=∀ a j,
    4570 grad m (v.sumAt t w.obj (v.obj a) j) (v.atomAt t a)=
    4571 if j=w.obj a then 0 else oneInner y (w.obj a) (w.atomAt t a)
    4572
    4573end
    4574end Lax793645.ConstructionData.Frames
    4575end
    4576
    4577section
    4578namespace Lax793645.ConstructionData.Frames
    4579open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4580noncomputable section
    4581variable {p : Shape} {n N : ℕ}
    4582def oneMismatch (g : OneAugur p N) (w : Pdual p n) (l : Tag p.g)
    4583 (s : Label p.b) (f : Flavor p.g) (o : OneOrient p n N) (y : Knobs p.g n):=
    4584 w (useAtom p l s f y)≠g l (dialed p l f y) (oneAtomKeyValue o l s (lit f l y))
    4585
    4586def onePostulates (o : OneOrient p n N) (g : OneAugur p N) (w : Pdual p n)
    4587 (E : Finset (Label p.b)) (δ : ℝ):=
    4588 ∀ s,s∉E→∀ l f,pr (spins p n) (oneMismatch g w l s f o)≤δ
    4589
    4590def oneYoke (m : Mixer p n) (x : OneUnit p n N) (i : Bool) (u : Profile p n) (α : F):=
    4591 oneInner x i+(Tsym m u+α • role p n)
    4592
    4593def oneClaimed (x : OneUnit p n N) (g : Bool→ OneAugur p N) (m : Mixer p n)
    4594 (w : Bool→ Profile p n) (α : Bool→ F) (L : Bool→ Finset (Label p.b)) (δ : ℝ):=
    4595 ∀ i,onePostulates (x i) (g i) (oneYoke m x i (w i) (α i)) (L i) δ
    4596
    4597end
    4598end Lax793645.ConstructionData.Frames
    4599end
    4600
    4601section
    4602namespace Lax793645.ConstructionData.Frames
    4603open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4604open Filter Finset PredictionClass
    4605open scoped Classical Topology
    4606noncomputable section
    4607set_option backward.isDefEq.respectTransparency false
    4608variable {p : Shape} {N M : ℕ}
    4609def oneAssembly (g : Bool→ OneAugur p N) (i j : Bool) (s t : F) : OneAugur p N:=
    4610 fun l q x=> s* g i l q x+t* g j l q x
    4611
    4612abbrev OneSeason (p : Shape) (M : ℕ):=∀ n,OneAugur p (M* n)
    4613
    4614end
    4615end Lax793645.ConstructionData.Frames
    4616end
    4617
    4618section
    4619namespace Lax793645.ConstructionData.Frames
    4620open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4621open PredictionClass
    4622noncomputable section
    4623set_option backward.isDefEq.respectTransparency false
    4624set_option maxHeartbeats 800000
    4625variable {p : Shape} {N : ℕ}
    4626/-- Both predictor values are functions of fixed linear rows. The same
    4627function is used on the two diagonal slices. -/
    4628structure OneAlgebraicRows (g : Bool → OneAugur p N) (R : ℕ) : Prop where
    4629 rows : ∀ i, OneLinearAugur (g i) R
    4630 sameSlice : ∀ i l q x, g i l q x = g i l 0 x
    4631
    4632def oneLiteral (g : OneAugur p N) (r : F) :=
    4633 ∀ l q x,g l q x=r* q
    4634
    4635def oneInactive (g : Bool→ OneAugur p N) (α : Party) (i : Bool) :=
    4636 firstBit α i=0 ∧ ∃ r,oneLiteral (g i) r
    4637
    4638def oneCoincident (g : Bool→ OneAugur p N) (α : Party) :=
    4639 α true=α false ∧ ∃ r,oneLiteral (oneAssembly g true false 1 1) r
    4640
    4641def oneFiniteClass (g : Bool→ OneAugur p N) (α : Party) : PredictionClass := by
    4642 classical
    4643 exact if oneInactive g α true then
    4644 if oneInactive g α false then dusk else dawn false
    4645 else if oneInactive g α false then dawn true
    4646 else if oneCoincident g α then twinned else noon
    4647
    4648end
    4649end Lax793645.ConstructionData.Frames
    4650end
    4651
    4652section
    4653namespace Lax793645.ConstructionData.Frames
    4654open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4655open Matrix LinearMap Module
    4656noncomputable section
    4657set_option backward.isDefEq.respectTransparency false
    4658variable {p : Shape} {n N : ℕ}
    4659def oneDuality (N : ℕ) : Vec (Fin (2* N))≃ₗ[F]Vec (Fin (2* N)):=
    4660 (oneAmbientCoordinates N).symm.trans (oneDualCoordinates N)
    4661
    4662def oneDualImages (x : OneUnit p n N) (e : Comp p.g) : Mat (Fin (2* N)) (OneColumn p n):=
    4663 LinearMap.toMatrix' (oneDuality N).toLinearMap* oneCoordinateImages x e
    4664
    4665end
    4666end Lax793645.ConstructionData.Frames
    4667end
    4668
    4669section
    4670namespace Lax793645.ConstructionData.Frames
    4671open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4672open Matrix LinearMap Module Submodule Function
    4673open scoped BigOperators
    4674noncomputable section
    4675set_option backward.isDefEq.respectTransparency false
    4676abbrev SymCover (p : Shape) (N : ℕ) := Comp p.g→ Space (Vec (Fin N))
    4677
    4678abbrev SymWidths (p : Shape) (r : ℕ) := Comp p.g→ Fin (r+1)
    4679
    4680abbrev SymOffsetBasis (p : Shape) (r : ℕ) {N : ℕ} (S : SymCover p N) (q : SymWidths p r) :=
    4681 ∀ e,Mat (Fin (dim (S e))) (Fin (q e).val)
    4682
    4683abbrev SymOffsetCost (p : Shape) (r : ℕ) (q : SymWidths p r) :=
    4684 ∀ e : Comp p.g,Mat (Fin (q e).val) (Fin (q e).val)
    4685
    4686abbrev SymAtlas (p : Shape) (r : ℕ) {N : ℕ} (S : SymCover p N) :=
    4687 Σ q : SymWidths p r,SymOffsetBasis p r S q×SymOffsetCost p r q
    4688
    4689instance symAtlasFintype {p : Shape} {r N : ℕ} (S : SymCover p N) : Fintype (SymAtlas p r S) := by
    4690 classical
    4691 exact inferInstanceAs (Fintype (Σ q : SymWidths p r,SymOffsetBasis p r S q×SymOffsetCost p r q))
    4692
    4693variable {p : Shape} {r N : ℕ} {S : SymCover p N}
    4694end
    4695end Lax793645.ConstructionData.Frames
    4696end
    4697
    4698section
    4699namespace Lax793645.ConstructionData.Frames
    4700open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4701open Matrix LinearMap Module Submodule
    4702open scoped BigOperators
    4703noncomputable section
    4704set_option backward.isDefEq.respectTransparency false
    4705variable {p : Shape} {n N : ℕ}
    4706def onePrimalMatrix (P : OneFrame p n N) : Mat (Fin (2* N)) (Row p n):=
    4707 LinearMap.toMatrix' ((oneAmbientCoordinates N).toLinearMap.comp (onePrimal P))
    4708
    4709def oneHeatRate (p : Shape) (n N : ℕ) (ζ : ℝ) (q t : ℕ) :=
    4710 bp (num (Row p n)* q+4* p.h* t)* fee (2* N) ζ (q+t)
    4711
    4712end
    4713end Lax793645.ConstructionData.Frames
    4714end
    4715
    4716section
    4717namespace Lax793645.ConstructionData.Frames
    4718open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4719open Matrix LinearMap Module
    4720open scoped BigOperators
    4721noncomputable section
    4722set_option backward.isDefEq.respectTransparency false
    4723variable {p : Shape} {n N : ℕ}
    4724abbrev OneCover (p : Shape) (N : ℕ) := Comp p.g→ Space (Vec (Fin (2* N)))
    4725
    4726def oneCoverDimension (C : OneCover p N) : ℕ:=∑ e,dim (C e)
    4727
    4728end
    4729end Lax793645.ConstructionData.Frames
    4730end
    4731
    4732section
    4733namespace Lax793645.ConstructionData.Frames
    4734open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4735open Matrix LinearMap Module Finset
    4736open scoped BigOperators
    4737noncomputable section
    4738set_option backward.isDefEq.respectTransparency false
    4739variable {A : Type} [Fintype A] {p : Shape} {N : ℕ}
    4740def channelPitch (Δ : A→ Ambient p N) (read : A→ PhasePair p N)
    4741 (w : Wgt A) (S R : Party) :=
    4742 avg (pairW w w) (fun x=> wsign
    4743 (joinPhase p (read x.1) R (Δ x.2)+joinPhase p (read x.2) S (Δ x.1)))
    4744
    4745variable {n : ℕ}
    4746end
    4747end Lax793645.ConstructionData.Frames
    4748end
    4749
    4750section
    4751namespace Lax793645.ConstructionData.Frames
    4752open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4753open Matrix LinearMap Module Submodule
    4754noncomputable section
    4755set_option backward.isDefEq.respectTransparency false
    4756variable {p : Shape} {n N r : ℕ} {T : SymCover p (2* N)}
    4757namespace OneBazaar
    4758end OneBazaar
    4759def oneSelectionPrice (p : Shape) (r n N : ℕ) (H ζ : ℝ) : Prop:=
    4760 ∀ q t : ℕ,q≤ r→ t≤ r→ H* oneHeatRate p n N ζ q t≤ loseA p (2* N) q t
    4761
    4762namespace OneBazaar
    4763end OneBazaar
    4764end
    4765end Lax793645.ConstructionData.Frames
    4766end
    4767
    4768section
    4769namespace Lax793645.ConstructionData.Frames
    4770open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4771open Matrix LinearMap Module Submodule
    4772open scoped BigOperators
    4773noncomputable section
    4774set_option backward.isDefEq.respectTransparency false
    4775variable {p : Shape} {n N r : ℕ}
    4776def oneImageProfile (o : OneOrient p n N) : Profile p n→ₗ[F]Ambient p (2* N) where
    4777 toFun z e:=liftM (onePrimalMatrix (o e)) (onePrimalMatrix (o e)) (z e)
    4778 map_add' z w:=by ext e a b; simp only [Pi.add_apply,map_add,Matrix.add_apply]
    4779 map_smul' c z:=by ext e a b; simp only [Pi.smul_apply,map_smul,RingHom.id_apply,Matrix.smul_apply]
    4780
    4781def oneMarkedDelta (x : OneUnit p n N) (marks : Bool→ Profile p n) : Ambient p (2* N):=
    4782 oneImageProfile (x true) (marks true)+oneImageProfile (x false) (marks false)
    4783
    4784end
    4785end Lax793645.ConstructionData.Frames
    4786end
    4787
    4788section
    4789namespace Lax793645.ConstructionData.Frames
    4790open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4791open Matrix LinearMap Module Submodule
    4792open scoped BigOperators
    4793noncomputable section
    4794set_option backward.isDefEq.respectTransparency false
    4795variable {p : Shape} {n N : ℕ}
    4796def oneBySide (w : Wgt (OneUnit p n N)) (m : Mixer p n) (H : ℝ) : Prop :=
    4797 ∀ i o,mapW w (fun x=> x i) o≤ H* oneRaw m N o
    4798
    4799abbrev OnePrimalPinFamily (p : Shape) (n N : ℕ) :=
    4800 OneUnit p n N→ Bool→ Comp p.g→ Space (Ray p n)
    4801
    4802abbrev OneChannelPinFamily (p : Shape) (n N : ℕ) :=
    4803 OneUnit p n N→ Bool→ Comp p.g→ Space (Hyperbolic p.h)
    4804
    4805def oneAcceptsPin (P : OnePrimalPinFamily p n N) (B : OneChannelPinFamily p n N)
    4806 (x : OneUnit p n N×OneUnit p n N) :=onePinSafe (P x.1) (B x.2) x.1 x.2
    4807
    4808def oneSecurePin (P : OnePrimalPinFamily p n N) (B : OneChannelPinFamily p n N)
    4809 (x : OneUnit p n N×OneUnit p n N) :=oneAcceptsPin P B x ∧ oneAcceptsPin P B x.swap
    4810
    4811end
    4812end Lax793645.ConstructionData.Frames
    4813end
    4814
    4815section
    4816namespace Lax793645.ConstructionData.Frames
    4817open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4818open Filter Finset
    4819open scoped Topology
    4820noncomputable section
    4821set_option backward.isDefEq.respectTransparency false
    4822variable {p : Shape} {n N : ℕ}
    4823abbrev OneLeafMixture (p : Shape) (n N : ℕ):=
    4824 ImageLeafMixture (OneUnit p n N) (Comp p.g) (OneColumn p n) (2* N)
    4825
    4826def oneLeafStrength (s : OneLeafMixture p n N) (w : Wgt (OneUnit p n N))
    4827 (m : Mixer p n) (D ζ : ℝ) (K : ℕ):=
    4828 s.strength oneCoordinateImages (onePinClosure p n) w (oneUnitRaw m N) D ζ K
    4829
    4830end
    4831end Lax793645.ConstructionData.Frames
    4832end
    4833
    4834section
    4835namespace Lax793645.ConstructionData.Frames
    4836open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4837open Matrix LinearMap Module Submodule
    4838noncomputable section
    4839set_option backward.isDefEq.respectTransparency false
    4840variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    4841def oneGradientRank (p : Shape) : ℕ :=
    4842 2*(15* p.r+14* p.J* Fintype.card (Comp p.g))
    4843
    4844def oneRealizationRoom (p : Shape) (K t : ℕ) : Prop :=
    4845 let f:=2*(K+t)
    4846 oneGradientRank p+(f+K)+jointCompressionRank p f (2* f+(f+K))+5* K+6* f+2≤ p.h
    4847
    4848end
    4849end Lax793645.ConstructionData.Frames
    4850end
    4851
    4852section
    4853namespace Lax793645.ConstructionData.Frames
    4854open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4855open Matrix LinearMap Module Submodule Function Finset
    4856open scoped BigOperators
    4857noncomputable section
    4858set_option backward.isDefEq.respectTransparency false
    4859variable {p : Shape} {n N r : ℕ} {T : SymCover p (2* N)}
    4860def oneGlimpseBill (p : Shape) (r : ℕ) (H : ℝ):=num (Comp p.g)*(H*2* bp ((r:ℝ)-p.h))
    4861
    4862namespace OneBazaar
    4863end OneBazaar
    4864end
    4865end Lax793645.ConstructionData.Frames
    4866end
    4867
    4868section
    4869namespace Lax793645.ConstructionData.Frames
    4870open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4871open Matrix LinearMap Module Submodule Function Finset
    4872open scoped BigOperators
    4873noncomputable section
    4874set_option backward.isDefEq.respectTransparency false
    4875variable {p : Shape} {n N r : ℕ} {T : SymCover p (2* N)}
    4876def oneQuest (p : Shape) (r k n N : ℕ) (H ε : ℝ) :=
    4877 ∀ x : ℕ,x≤ r →
    4878 bp ((x:ℝ)*(2* N))* bp (0.51* k*(2* N))*(H* oneHeatRate p n N ε x k)≤ bp (-0.2*(2* N))
    4879
    4880namespace OneBazaar
    4881end OneBazaar
    4882end
    4883end Lax793645.ConstructionData.Frames
    4884end
    4885
    4886section
    4887namespace Lax793645.ConstructionData.Frames
    4888open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4889open Matrix LinearMap Module Submodule Function Finset
    4890open scoped BigOperators
    4891noncomputable section
    4892set_option backward.isDefEq.respectTransparency false
    4893variable {p : Shape} {n N r : ℕ}
    4894def oneSymCov {p : Shape} {N : ℕ} (C : SymCover p N) : Cov p N:=fun z=> C z.1
    4895
    4896def oneSymCovered {p : Shape} {N : ℕ} (C : SymCover p N) (x : Ambient p N):=covered p (oneSymCov C) x
    4897
    4898def oneTonalMix {p : Shape} {n N} (Δ : OneUnit p n N → Ambient p (2* N)) (w) :=
    4899 ∀ S R,S ≠ 0 ∨ R ≠ 0 → |channelPitch Δ oneListens w S R|< 0.005
    4900
    4901def oneTonalTiny {p : Shape} {n N} (Δ : OneUnit p n N → Ambient p (2* N)) (w : Wgt (OneUnit p n N)) (d : ℕ) :=
    4902 ∃ S : SymCover p (2* N), oneCoverDimension S≤ d ∧ (∀ x,w x≠0 → oneSymCovered S (Δ x)) ∧
    4903 ∀ i : Bool,∀ R : Party, |channelPitch Δ oneListens w (unary i) R|≤ bp (-0.24*(2* N))
    4904
    4905namespace OneBazaar
    4906variable {T : SymCover p (2* N)}
    4907end OneBazaar
    4908end
    4909end Lax793645.ConstructionData.Frames
    4910end
    4911
    4912section
    4913namespace Lax793645.ConstructionData.Frames
    4914open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4915open Matrix LinearMap Module Submodule Function Finset
    4916open scoped BigOperators
    4917noncomputable section
    4918set_option backward.isDefEq.respectTransparency false
    4919variable {p : Shape} {n N : ℕ}
    4920def oneQuench (Δ : OneUnit p n N→ Ambient p (2* N))
    4921 (x : OneUnit p n N×OneUnit p n N) : Quad :=
    4922 (fun i=> joinPhase p (oneListens x.2) (unary i) (Δ x.1),
    4923 fun i=> joinPhase p (oneListens x.1) (unary i) (Δ x.2))
    4924
    4925end
    4926end Lax793645.ConstructionData.Frames
    4927end
    4928
    4929section
    4930namespace Lax793645.ConstructionData.Frames
    4931open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4932open Matrix LinearMap Module Function Finset PredictionClass
    4933open scoped BigOperators
    4934noncomputable section
    4935set_option backward.isDefEq.respectTransparency false
    4936variable {p : Shape} {n N : ℕ}
    4937def oneMatchUp (Δ : OneUnit p n N→ Ambient p (2* N)) (α : Party) (r : F)
    4938 (c : PredictionClass) (x : OneUnit p n N×OneUnit p n N) :=
    4939 c.compatible α r (oneQuench Δ x)
    4940
    4941def oneExactInk (m : Mixer p n) (marks : OneUnit p n N→ Bool→ Profile p n)
    4942 (x : OneUnit p n N) := ∀ i,silent (oneYoke m x i (marks x i) 1)
    4943
    4944end
    4945end Lax793645.ConstructionData.Frames
    4946end
    4947
    4948section
    4949namespace Lax793645.ConstructionData.Frames
    4950open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4951open Matrix LinearMap Module Function Finset PredictionClass
    4952open scoped BigOperators
    4953noncomputable section
    4954set_option backward.isDefEq.respectTransparency false
    4955variable {p : Shape} {n N : ℕ}
    4956/-- A finite label for each unit determines a relation on pairs. The bound
    4957counts labels in either coordinate, including after transposing the test. -/
    4958structure PairCode (A : Type) (budget : ℝ) where
    4959 count : ℕ
    4960 fits : (count:ℝ)≤ budget
    4961 label : A→ Fin count
    4962 test : Fin count × Fin count → Prop
    4963
    4964def PairCode.read {A : Type} {B : ℝ} (c : PairCode A B) (v : A×A) :=
    4965 c.test (c.label v.1,c.label v.2)
    4966
    4967end
    4968end Lax793645.ConstructionData.Frames
    4969end
    4970
    4971section
    4972namespace Lax793645.ConstructionData.Frames
    4973open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4974open Matrix LinearMap Module Submodule Function Finset
    4975open scoped BigOperators
    4976noncomputable section
    4977set_option backward.isDefEq.respectTransparency false
    4978variable {p : Shape} {n N r : ℕ}
    4979def oneScaleBill (p : Shape) (n N d : ℕ) (H : ℝ):=
    4980 2* num (Comp p.g)* H* bp (num (Row p n)+d+3-2*(N:ℝ))
    4981
    4982end
    4983end Lax793645.ConstructionData.Frames
    4984end
    4985
    4986section
    4987namespace Lax793645.ConstructionData.Frames
    4988open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    4989open Matrix LinearMap Module Submodule Function Finset
    4990open scoped BigOperators
    4991noncomputable section
    4992set_option backward.isDefEq.respectTransparency false
    4993variable {p : Shape} {n N r : ℕ}
    4994def oneNoSweepBudget (p : Shape) (N m b r : ℕ) (c ψ H : ℝ):=
    4995 bp (2*(r:ℝ)* num (Comp p.g)*(2* N))*(H* oneCubePrice p^2*
    4996 (exponentErr p m b c/ψ^(2^m*(2* b))))
    4997
    4998/-- All numerical costs of the one-frame phase argument. The raw image
    4999cap is the concrete quadratic-frame cap, not a two-frame assumption. -/
    5000structure OnePhaseReady (p : Shape) (n N m b r k d : ℕ) (mix : Mixer p n)
    5001 (c l ψ ε L H : ℝ) : Prop where
    5002 hb : 1≤ b
    5003 hm : 16* r< m
    5004 hk : k≤ d
    5005 hc : 0< c
    5006 hc' : c≤1
    5007 hl : 0< l
    5008 hl' : l≤1
    5009 hψ : 0<ψ
    5010 hL : 0≤ L
    5011 hH : 0≤ H
    5012 hroom : Fintype.card (Row p n)+2* p.h+1≤ N
    5013 hN : 5≤ N
    5014 hchannels : 4* p.h+3≤ N
    5015 cap : ∀ a : ImagePin (Comp p.g) (OneColumn p n) (2* N),
    5016 pr (oneUnitRaw mix N) (imagePinAgree oneDualImages a)≤ fee (2* N) ε (imagePlanRank a.sp)
    5017 noBranch : ψ+oneNoSweepBudget p N m b r c ψ H<0.005
    5018 frames : oneScaleBill p n N (2* maxSpan m b r) L≤ c/2
    5019 atlas (T : SymCover p (2* N)) (ht : oneCoverDimension T≤2* maxSpan m b r) :
    5020 num (SymAtlas p r T)≤ bp (0.002*(2* N))
    5021 price : oneSelectionPrice p r n N (rhUp L c) ε
    5022 price' : oneSelectionPrice p r n N (rhUp (rhUp L c) l) ε
    5023 localQ : oneQuest p r k n N (rhUp H c) ε
    5024 testFailure : oneGlimpseBill p k (rhUp L c)+bp (-0.1*(2* N))< l^(k+1)
    5025 testFailure' : 2* oneGlimpseBill p d (rhUp L c)≤ l/2
    5026 beatSlack : 5* l+bp (-0.24*(2* N))<0.005
    5027
    5028end
    5029end Lax793645.ConstructionData.Frames
    5030end
    5031
    5032section
    5033namespace Lax793645.ConstructionData.Frames
    5034open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5035open PreparationParameters PredictionClass Filter Finset
    5036open scoped Topology
    5037noncomputable section
    5038set_option backward.isDefEq.respectTransparency false
    5039variable {p : Shape} {n N M : ℕ}
    5040abbrev OneTale (p : Shape) (M : ℕ):=∀ n,Wgt (OneUnit p n (M* n))
    5041
    5042abbrev OneRhythms (p : Shape) (M : ℕ):=∀ n,OneLeafMixture p n (M* n)
    5043
    5044abbrev OneMarks (p : Shape) (n N : ℕ):=OneUnit p n N→ Bool→ Profile p n
    5045
    5046def oneFrameSide (m : Mixer p n) (x : OneUnit p n N):=∀ i,oneFrameLaw m (x i)
    5047
    5048def onePreparationPins (q : PreparationParameters):=q.e+q.s
    5049
    5050/-- A symmetric cover of dimension d gives a two-sided cover of dimension 2d. -/
    5051def onePreparationCover (q : PreparationParameters):=2* q.d
    5052
    5053structure OnePreparationAllows (q : PreparationParameters) : Prop where
    5054 pos : 0< q.ζ
    5055 small : q.ζ<1
    5056 hL : 0≤ q.L
    5057 bigS : q.leafOld+q.u+q.ζ≤((q.ζ/6)-(q.ζ/6)/4)* q.s
    5058
    5059structure OneNascent (q : PreparationParameters) (m : Mixer p n)
    5060 (w : Wgt (OneUnit p n N)) : Prop where
    5061 law : IsLaw w
    5062 border : oneBySide w m q.L
    5063 total : ∀ x,w x≤ bp ((q.D:ℝ)*(2* N))* oneUnitRaw m N x
    5064
    5065structure OneEntered (q : PreparationParameters) (m : Mixer p n)
    5066 (w : Wgt (OneUnit p n N)) (s : OneLeafMixture p n N) : Prop where
    5067 weight : (1/2:ℝ)≤ s.amount w
    5068 strength : oneLeafStrength s w m q.leafOld q.ζ q.e
    5069 onTile : s.within (fun x=> w x≠0 ∧ (oneRawHoles m).unit (x true,x false) ∧
    5070 oneFrameSide m x)
    5071
    5072structure OneDurable (q : PreparationParameters) (l : Filter ℕ) (m : cycleM p)
    5073 (w : OneTale p M) (s : OneRhythms p M) : Prop where
    5074 mass : warm l (fun n=>(2*(M* n):ℕ)) (fun n=>(s n).amount (w n))
    5075 shape : ∀ᶠ n in l,oneLeafStrength (s n) (w n) (m n) q.leafNew (2* q.ζ)
    5076 (onePreparationPins q) ∧ (s n).within (oneFrameSide (m n))
    5077 retained : ∃ c : ℝ,0< c ∧ ∀ᶠ n in l,c≤(s n).amount (w n)
    5078
    5079def oneSeems (q : PreparationParameters) (m : Mixer p n) (s : OneLeafMixture p n N)
    5080 (x : OneUnit p n N) (g : Bool→ OneAugur p N) (z : Bool→ Profile p n)
    5081 (L : Bool→ Finset (Label p.b)) (α : Party) (ε : ℝ):=
    5082 (∀ i,(L i).card≤ q.B ∧ z i∈oneEffectivePins (oneEndpointPrimalPins (s.rooting x)) i) ∧
    5083 oneClaimed x g m z α L ε
    5084
    5085def oneSecureAt (s : OneLeafMixture p n N):=
    5086 oneSecurePin (fun x=> oneEndpointPrimalPins (s.rooting x))
    5087 (fun x=> oneChannelPins (s.rooting x))
    5088
    5089structure OneSketch (p : Shape) (M : ℕ) where
    5090 c : PredictionClass
    5091 α : Party
    5092 r : F
    5093 m : ∀ n,OneMarks p n (M* n)
    5094 L : ∀ n,OneUnit p n (M* n)→ Bool→ Finset (Label p.b)
    5095 g : Bool→ OneSeason p M
    5096 ε : ℕ→ ℝ
    5097
    5098def oneMatchProg (b : OneSketch p M) (n : ℕ):=
    5099 oneMatchUp (fun x=> oneMarkedDelta x (b.m n x)) b.α b.r b.c
    5100
    5101def oneGlow (s : OneRhythms p M) (w : OneTale p M) (b : OneSketch p M) (n : ℕ):=
    5102 pr (pairW ((s n).sap (w n)) ((s n).sap (w n))) (oneMatchProg b n)
    5103
    5104def oneGleam (s : OneRhythms p M) (w : OneTale p M) (b : OneSketch p M) (n : ℕ):=
    5105 pr (pairW ((s n).sap (w n)) ((s n).sap (w n)))
    5106 (fun x=> oneMatchProg b n x ∧ ¬oneSecureAt (s n) x)
    5107
    5108abbrev OneCompatibilityCode (q : PreparationParameters) (p : Shape) (n N : ℕ) :=
    5109 PairCode (OneUnit p n N) (bp (3*(onePreparationCover q)*(2* N:ℝ)))
    5110
    5111def oneCodedLeaves (q : PreparationParameters) (s : OneLeafMixture p n N)
    5112 (R : OneUnit p n N × OneUnit p n N → Prop) :=
    5113 ∃ code : OneCompatibilityCode q p n N,
    5114 (∀ i∈s.T,∀ x∈i,∀ y∈i,code.label x=code.label y) ∧
    5115 ∀ x y,inTiles s.T x → inTiles s.T y → (code.read (x,y) ↔ R (x,y))
    5116
    5117def oneOutside (q : PreparationParameters) (p : Shape) (n N : ℕ):=
    5118 ∀ E : OneUnit p n N×OneUnit p n N→ Prop,named E (bp (3*(onePreparationCover q)*(2* N:ℝ)))→
    5119 named (E∘Prod.swap) (bp (3*(onePreparationCover q)*(2* N:ℝ)))→
    5120 ∀ w (s : OneLeafMixture p n N) (m : Mixer p n),
    5121 (∀ x,imagePlanRank (s.rooting x)≤ onePreparationPins q)→
    5122 IsLaw w→ oneBySide w m (shine (2* N))→ carried w (oneFrameSide m)→
    5123 pr (pairW w w) (fun x=> E x ∧ ¬oneSecureAt s x)≤
    5124 0.0005* pr (pairW w w) E+edgeError (2* N)
    5125
    5126end
    5127end Lax793645.ConstructionData.Frames
    5128end
    5129
    5130section
    5131namespace Lax793645.ConstructionData.Frames
    5132open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5133open Finset Function
    5134open scoped Classical
    5135noncomputable section
    5136set_option backward.isDefEq.respectTransparency false
    5137variable {p:Shape} {n N K:ℕ} {C ζ:ℝ}
    5138abbrev OneAspect (pop:OneLeafMixture p n N):=pop.T×OneUnit p n N
    5139
    5140def oneTroupe (pop:OneLeafMixture p n N) (μ:Wgt (OneUnit p n N)):=
    5141 semi (portionW μ pop.T) (fun i=> partW μ i.val)
    5142
    5143def oneCirque (pop:OneLeafMixture p n N) (μ:Wgt (OneUnit p n N)):=
    5144 pairW (oneTroupe pop μ) (oneTroupe pop μ)
    5145
    5146structure OneLead (μ:Wgt (OneUnit p n N)) (pop:OneLeafMixture p n N)
    5147 (m:Mixer p n) (C ζ:ℝ) (K:ℕ):Prop where
    5148 strength:oneLeafStrength pop μ m C ζ K
    5149 amount:0< pop.amount μ
    5150 law:IsLaw μ
    5151 cover:pop.within (oneFrameSide m)
    5152
    5153variable {pop:OneLeafMixture p n N} {μ:Wgt (OneUnit p n N)} {m:Mixer p n}
    5154end
    5155end Lax793645.ConstructionData.Frames
    5156end
    5157
    5158section
    5159namespace Lax793645.ConstructionData.Frames
    5160open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5161open StatusAnalysis Matrix LinearMap Module Submodule Function
    5162noncomputable section
    5163set_option backward.isDefEq.respectTransparency false
    5164variable {p : Shape} {n N : ℕ} {d : Rates}
    5165def oneCharted (v : Charts p n d) (a : ImagePlan (Comp p.g) (OneColumn p n)) :=
    5166 ∀ i,LinearMap.range (v i)=oneEffectivePins (oneEndpointPrimalPins a) i ∧ Injective (v i)
    5167
    5168def oneSpecify (p : Shape) {d : ℕ} (i : Nodes) (v : Ax p n d)
    5169 (m : Mixer p n) (o : OneUnit p n N) (l : Tag p.g) (s : Label p.b)
    5170 (f : Flavor p.g) (x : Knobs p.g n) : Magazine p d :=
    5171 let A:=useAtom p l s f x
    5172 (scan p l f x,(role p n A,roll v (Tsym m A)),oneInner o i A)
    5173
    5174end
    5175end Lax793645.ConstructionData.Frames
    5176end
    5177
    5178section
    5179namespace Lax793645.ConstructionData.Frames
    5180open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5181open StatusAnalysis Filter Finset Matrix Function
    5182open scoped BigOperators Topology
    5183noncomputable section
    5184set_option backward.isDefEq.respectTransparency false
    5185variable {p : Shape} {n N r : ℕ}
    5186abbrev OneSilhouette (p : Shape) (N r : ℕ):=∀ l : Tag p.g,F→ OneAtomKey l N→ Fin r
    5187
    5188namespace OneAppearance
    5189variable (x : Appearance p)
    5190def oneFace (o : OneOrient p n N) (w : Knobs p.g n) : OneAtomKey (p:=p) x.l N :=
    5191 oneDesc x.trot w o
    5192
    5193def oneProfile {d : ℕ} (i : Nodes) (o : OneUnit p n N) (m : Mixer p n) (v : Ax p n d)
    5194 (z : Knobs p.g n) : Magazine p d :=
    5195 oneSpecify p i v m o x.l x.s x.f z
    5196
    5197variable (Y : OneSilhouette p N r)
    5198def oneShowTag (o : OneOrient p n N) := fun w=> Y x.l x.q (oneFace x o w)
    5199
    5200def oneReference := mapW (oneLawOmega p N x.l x.q) (Y x.l x.q)
    5201
    5202def oneEmpirical (o : OneOrient p n N) := mapW (x.wit n) (oneShowTag x Y o)
    5203
    5204variable {d : ℕ}
    5205def oneReflected (i : Nodes) (o : OneUnit p n N) (m : Mixer p n) (v : Ax p n d) (a : Fin r) :=
    5206 mapW (stained (x.wit n) (oneShowTag x Y (o i)) a) (oneProfile x i o m v)
    5207
    5208def oneClose (o : OneOrient p n N) (ε : ℝ) :=
    5209 varOne (oneReference x Y) (oneEmpirical x Y o) ≤ ε
    5210
    5211end OneAppearance
    5212namespace OneAppearance
    5213variable (x : Appearance p) (Y : OneSilhouette p N r)
    5214variable {d : ℕ}
    5215end OneAppearance
    5216end
    5217end Lax793645.ConstructionData.Frames
    5218end
    5219
    5220section
    5221namespace Lax793645.ConstructionData.Frames
    5222open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5223open Finset Matrix Function LinearMap Module Submodule Filter Real
    5224open scoped Classical Topology
    5225noncomputable section
    5226set_option backward.isDefEq.respectTransparency false
    5227variable {p : Shape} {n N K s : ℕ}
    5228variable (v : Template.Solo p)
    5229def oneOffBeat (v : Template.Solo p) (P : OneAtomKey (p:=p) (v.t ()) N → Prop) (o : OneOrient p n N) :=
    5230 fun z => P (oneDesc v z o)
    5231
    5232end
    5233end Lax793645.ConstructionData.Frames
    5234end
    5235
    5236section
    5237namespace Lax793645.ConstructionData.Frames
    5238open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5239open Template Finset Matrix Function LinearMap Module Submodule Filter Real
    5240open scoped Classical Topology
    5241noncomputable section
    5242set_option backward.isDefEq.respectTransparency false
    5243variable {p : Shape} {n N : ℕ}
    5244def oneLuminous (v : Template.Solo p) (m : Mixer p n) (w : Wgt (Knobs p.g n)) (D : OneAtomKey (p:=p) (v.t ())
    5245 N → Prop) (K : ℕ) (i : OneOrient p n N) :=
    5246 let P := oneOffBeat v D i
    5247 0< pr w P ∧ ∀ (d : ℕ), d≤ K^2 → ∀ f : Vec (Fin d)→ₗ[F] Profile p n,
    5248 Injective f → (∀ x,totalRank (f x)≤ K) → ∀ x,
    5249 (7/8:ℝ)* bp (-(d:ℝ)) ≤ pr (onW w P) (fun z=> stains v m f z=x)
    5250
    5251end
    5252end Lax793645.ConstructionData.Frames
    5253end
    5254
    5255section
    5256namespace Lax793645.ConstructionData.Frames
    5257open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5258open Template Finset Matrix Function LinearMap Module Submodule Filter Real
    5259open scoped Classical Topology
    5260noncomputable section
    5261set_option backward.isDefEq.respectTransparency false
    5262variable {p : Shape} {n N : ℕ}
    5263variable (v : Solo p)
    5264def onePatrol (m : Mixer p n) (w : Wgt (Knobs p.g n))
    5265 (S : OneAtomKey (p:=p) (v.t ()) N→ Prop) (K : ℕ) (q : F) (x : OneOrient p n N) :=
    5266 oneLuminous v m w S K x ∧
    5267 3/4* pr (oneLawOmega p N (v.t ()) q) S ≤ pr w (oneOffBeat v S x)
    5268
    5269variable {K s : ℕ}
    5270end
    5271end Lax793645.ConstructionData.Frames
    5272end
    5273
    5274section
    5275namespace Lax793645.ConstructionData.Frames
    5276open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5277open StatusAnalysis Filter Finset Matrix Function Template
    5278open scoped BigOperators Topology
    5279noncomputable section
    5280set_option backward.isDefEq.respectTransparency false
    5281variable {p : Shape} {n N K M r : ℕ}
    5282structure OneUnaryParameters (p : Shape) (M K s : ℕ) : Prop where
    5283 hM : 1≤ M
    5284 hg : Odd p.g
    5285 hJ : 1≤ p.j
    5286 hR : 1≤ p.r
    5287 profiles : 2* profileA p K< s
    5288 gleaming : bp (-((p.J-s:ℕ):ℝ))* bp s< glintRate K
    5289
    5290namespace OneAppearance
    5291variable (x : Appearance p) {s0 : ℕ}
    5292def oneFoil (x : Appearance p) (Y : OneSilhouette p N r) (o : OneOrient p n N)
    5293 (m : Mixer p n) (K : ℕ) (δ : ℝ) :=
    5294 ∀ (z:Digest p.g) (i:Fin r), z.feasible x.l x.f → z.sumBit=x.q →
    5295 δ ≤ oneReference x Y i → onePatrol x.trot m (scopedScan p n x.l x.f z)
    5296 (fun y => Y x.l x.q y=i) K x.q o
    5297
    5298end OneAppearance
    5299open OneAppearance
    5300variable {s0 : ℕ}
    5301end
    5302end Lax793645.ConstructionData.Frames
    5303end
    5304
    5305section
    5306namespace Lax793645.ConstructionData.Frames
    5307open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5308open Template StatusAnalysis StatusAnalysis.DualAnalysis OneAppearance Filter Finset Matrix Function LinearMap Module
    5309open scoped BigOperators Topology
    5310noncomputable section
    5311set_option backward.isDefEq.respectTransparency false
    5312variable {p : Shape} {n N r : ℕ} {d : Rates}
    5313def oneWisp (p : Shape) (Y : OneSilhouette p N r) : Terrain p r:=
    5314 fun l q=> mapW (oneLawOmega p N l q) (Y l q)
    5315
    5316def oneWake (p : Shape) (Y : OneSilhouette p N r) (m : Mixer p n) (o : OneUnit p n N)
    5317 (s : Charts p n d) : Gazette p r d:=fun i x a=> oneReflected x Y i o m (s i) a
    5318
    5319end
    5320end Lax793645.ConstructionData.Frames
    5321end
    5322
    5323section
    5324namespace Lax793645.ConstructionData.Frames
    5325open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5326open StatusAnalysis StatusAnalysis.DualAnalysis OneAppearance Template
    5327open Matrix Filter Finset LinearMap Module Function
    5328open scoped BigOperators Topology
    5329noncomputable section
    5330set_option backward.isDefEq.respectTransparency false
    5331variable {p : Shape} {r n N : ℕ} {d : Rates}
    5332def oneFromPulse (Y: OneSilhouette p N r) (f:Pulsar p r) : OneAugur p N :=
    5333 fun l q x=> f l q (Y l q x)
    5334
    5335end
    5336end Lax793645.ConstructionData.Frames
    5337end
    5338
    5339section
    5340namespace Lax793645.ConstructionData.Frames
    5341open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5342open StatusAnalysis StatusAnalysis.DualAnalysis Function Finset
    5343open scoped BigOperators
    5344noncomputable section
    5345set_option backward.isDefEq.respectTransparency false
    5346variable {T : Type} {p : Shape} {N r s K R : ℕ}
    5347def OneLinearSilhouette (Y : OneSilhouette p N r) (K : ℕ) :=
    5348 ∀ l,HasLinearCells (Y l) K
    5349
    5350end
    5351end Lax793645.ConstructionData.Frames
    5352end
    5353
    5354section
    5355namespace Lax793645.ConstructionData.Frames
    5356open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5357open Finset Matrix Function Filter
    5358open scoped Classical
    5359noncomputable section
    5360set_option backward.isDefEq.respectTransparency false
    5361variable {I : Type} [Fintype I] [DecidableEq I] {p : Shape} {n N : ℕ}
    5362def oneQueryCoordinateEquiv (t : Tagging p I) (N : ℕ) :
    5363 KeyCoordinates (KeySlots p t) N ≃ OneKeys t N :=
    5364 (rackCoordinates (KeySlots p t) N).toEquiv.trans (oneScatter t N).symm
    5365
    5366end
    5367end Lax793645.ConstructionData.Frames
    5368end
    5369
    5370section
    5371namespace Lax793645.ConstructionData.Frames
    5372open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5373open Finset Matrix Function LinearMap
    5374open scoped Classical
    5375noncomputable section
    5376set_option backward.isDefEq.respectTransparency false
    5377set_option maxHeartbeats 200000
    5378variable {I T : Type} [Fintype I] [DecidableEq I] [Fintype T] [DecidableEq T]
    5379 {p : Shape} {n N : ℕ}
    5380/-- The one-frame reference fixes quadratic values and polar pairings
    5381within each component, without fixing ordered products of its halves. -/
    5382def oneOwnPart (t : Tagging p I) (q : I → F)
    5383 (x : KeyCoordinates (KeySlots p t) N) : Prop:=
    5384 quadraticTraced (crowded (ownPort t)) (geoMatrix (ownPort t) (ownMap t q)) x
    5385
    5386end
    5387end Lax793645.ConstructionData.Frames
    5388end
    5389
    5390section
    5391namespace Lax793645.ConstructionData.Frames
    5392open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5393open Matrix LinearMap Module Function Finset
    5394open scoped Classical BigOperators
    5395noncomputable section
    5396set_option backward.isDefEq.respectTransparency false
    5397variable {I J : Type} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J]
    5398 {p : Shape} {N : ℕ}
    5399def oneOwnKeyPart (t : Tagging p I) (q : I→ F) (x : OneKeys t N):=
    5400 oneOwnPart t q ((oneQueryCoordinateEquiv t N).symm x)
    5401
    5402def oneLawNu (p : Shape) (N : ℕ) (t : Tagging p I) (q : I→ F) : Wgt (OneKeys t N):=
    5403 unifOn (oneOwnKeyPart t q)
    5404
    5405end
    5406end Lax793645.ConstructionData.Frames
    5407end
    5408
    5409section
    5410namespace Lax793645.ConstructionData.Frames
    5411open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5412open LinearMap Module Function Finset
    5413open scoped Classical BigOperators
    5414noncomputable section
    5415set_option backward.isDefEq.respectTransparency false
    5416variable {p : Shape} {N R r s : ℕ} {I T : Type} [Fintype I] [DecidableEq I]
    5417def OneRefines (Y : OneSilhouette p N r) (X : OneSilhouette p N s):=
    5418 ∀ l q,∃ f : Fin r→ Fin s,∀ x,X l q x=f (Y l q x)
    5419
    5420end
    5421end Lax793645.ConstructionData.Frames
    5422end
    5423
    5424section
    5425namespace Lax793645.ConstructionData.Frames
    5426open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5427open Function LinearMap Module Finset
    5428open scoped Classical BigOperators
    5429noncomputable section
    5430set_option backward.isDefEq.respectTransparency false
    5431variable {p : Shape} {N r s K R : ℕ} {I T : Type} [Fintype I] [DecidableEq I]
    5432def OneFullLinearSilhouette (Y : OneSilhouette p N r) (K : ℕ) :=
    5433 ∀ l,HasFullLinearCells (Y l) K
    5434
    5435end
    5436end Lax793645.ConstructionData.Frames
    5437end
    5438
    5439section
    5440namespace Lax793645.ConstructionData.Frames
    5441open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5442open Matrix LinearMap Function Finset
    5443open scoped BigOperators Classical
    5444noncomputable section
    5445variable {g : ℕ}
    5446/-- The vertex at the start of an oriented cycle component. -/
    5447def cycleOrigin (e : Comp g) : Tag g :=
    5448 if h : 3≤ g then (CycleGeometry.forwardEquiv h).symm e else e.val.1
    5449
    5450def cycleWeight (e f : Comp g) : F :=
    5451 if h : 2≤ g then ∑ i : Fin ((g-1)/2),
    5452 if CycleGeometry.forward h (CycleGeometry.matchingVertex (cycleOrigin e) i)=f then 1 else 0
    5453 else 0
    5454
    5455theorem matching_vertex_injective (t : Tag g) :
    5456 Injective (CycleGeometry.matchingVertex t) := by
    5457 intro i j h
    5458 have he:=congrArg Fin.val (add_right_cancel h)
    5459 apply Fin.ext
    5460 dsimp only [CycleGeometry.matchingVertex] at he
    5461 omega
    5462
    5463theorem cycle_weight_exists (hg : 3≤ g) (e : Comp g) : ∃ f,cycleWeight e f=1 := by
    5464 let i : Fin ((g-1)/2):=⟨0,by omega⟩
    5465 let f:=CycleGeometry.forward (by omega : 2≤ g) (CycleGeometry.matchingVertex (cycleOrigin e) i)
    5466 refine ⟨f,?_⟩
    5467 simp only [cycleWeight,dif_pos (show 2≤ g by omega)]
    5468 rw [sum_eq_single i]
    5469 · simp [f]
    5470 · intro j _ hji
    5471 rw [if_neg]
    5472 intro h
    5473 exact hji (matching_vertex_injective _ (CycleGeometry.forward_injective hg h))
    5474 simp
    5475
    5476/-- One representative suffices to store the matrix for a whole matching. -/
    5477def cycleAnchor (e : Comp g) : Comp g :=
    5478 if hg : 3≤ g then (cycle_weight_exists hg e).choose else e
    5479
    5480end
    5481end Lax793645.ConstructionData.Frames
    5482end
    5483
    5484section
    5485namespace Lax793645.ConstructionData.Frames
    5486open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5487open Matrix LinearMap Function Finset
    5488open scoped BigOperators Classical
    5489noncomputable section
    5490set_option backward.isDefEq.respectTransparency false
    5491variable {p : Shape} {n : ℕ}
    5492abbrev ReducedIndex (p : Shape):=Fin p.J × Comp p.g
    5493
    5494abbrev ReducedOne (p : Shape):=ReducedIndex p × Bool
    5495
    5496abbrev ReducedBits (p : Shape):=ReducedOne p × Bool
    5497
    5498def reducedSlot (i : ReducedOne p) : MOne p:=
    5499 ((i.1.1,i.1.2,cycleAnchor i.1.2),i.2)
    5500
    5501def reducedOrdered (m : Mixer p n) (i : ReducedOne p):=orderedM m (reducedSlot i)
    5502
    5503def reducedIndexedSum (m : Mixer p n) (c : Vec (ReducedBits p)):=
    5504 ∑ i,c i •eitherM i.2 (reducedOrdered m i.1)
    5505
    5506/-- The expanded storage table contains only one independent L/R pair per
    5507cycle component. It is retained as an adapter to the scalar geometry API. -/
    5508def ReducedMixerLaw (m : Mixer p n) : Prop :=
    5509 3≤ p.g ∧
    5510 (∀ j e f,m.mixL j e f=cycleWeight e f •m.mixL j e (cycleAnchor e)) ∧
    5511 (∀ j e f,m.mixR j e f=m.mixR j e (cycleAnchor e))
    5512
    5513def reducedBinaryGood (m : Mixer p n) : Prop :=
    5514 ReducedMixerLaw m ∧ ∀ s t : Label p.b,s≠t→
    5515 ∀ (c : Vec (ReducedBits p)) (b : Vec Bool),c≠0 ∨ b≠0→
    5516 n≤5* blockRank Block.sharp s t (reducedIndexedSum m c+selfSum m b)
    5517
    5518/-- Expand one set of independent prescribed bits along the cycle matchings. -/
    5519def reducedScript {I : Type} (s : Script p I) : Script p I:=fun x y i=>
    5520 if i.2 then cycleWeight i.1.2.1 i.1.2.2* s x y ((i.1.1,i.1.2.1,cycleAnchor i.1.2.1),true)
    5521 else s x y ((i.1.1,i.1.2.1,cycleAnchor i.1.2.1),false)
    5522
    5523end
    5524end Lax793645.ConstructionData.Frames
    5525end
    5526
    5527section
    5528namespace Lax793645.ConstructionData.Frames
    5529open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5530open Matrix LinearMap Module Function Finset Filter
    5531open scoped Classical BigOperators
    5532noncomputable section
    5533set_option backward.isDefEq.respectTransparency false
    5534variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    5535abbrev OneCrossing (p : Shape) (l d : Tag p.g):={e : Comp p.g//inc e l ∧inc e d}
    5536
    5537abbrev OneHarm (p : Shape) (l d : Tag p.g):=
    5538 ReducedBits p⊕{u : Unit//Template.sharesComponent p l d}
    5539
    5540abbrev oneAbbey (v : Template p I) : v.Chorus→ Type
    5541 | .inl i=> OneHarm p (v.t i.val.1) (v.t i.val.2)
    5542 | .inr i=> OneCrossing p (v.t i.val.1) (v.t i.val.2)
    5543
    5544instance (v : Template p I) (i : v.Chorus) : Fintype (oneAbbey v i):=
    5545 i.rec (fun _=> inferInstanceAs (Fintype (OneHarm p _ _)))
    5546 (fun _=> inferInstanceAs (Fintype (OneCrossing p _ _)))
    5547
    5548instance (v : Template p I) (i : v.Chorus) : DecidableEq (oneAbbey v i):=Classical.typeDecidableEq _
    5549
    5550def oneKappa (v : Template p I):=wavelength (oneAbbey v)
    5551
    5552end
    5553end Lax793645.ConstructionData.Frames
    5554end
    5555
    5556section
    5557namespace Lax793645.ConstructionData.Frames
    5558open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5559open Finset
    5560open scoped Classical
    5561noncomputable section
    5562set_option backward.isDefEq.respectTransparency false
    5563variable {I : Type} [Fintype I] [DecidableEq I] {p : Shape} {n N : ℕ}
    5564def oneQueryWeightBad (v : Template p I)
    5565 (D : Wgt (KeyCoordinates (KeySlots p v.t) N)) (ψ : Wgt (Inputs p n I))
    5566 (b ε : ℝ) (o : OneUnit p n N) : Prop :=
    5567 ∃ w : Wgt (Inputs p n I),inputFourierNorm w≤ b ∧
    5568 ε < |avg unif (fun x=> D (oneTemplateCoordinates v o x)*ψ x* w x)|
    5569
    5570end
    5571end Lax793645.ConstructionData.Frames
    5572end
    5573
    5574section
    5575namespace Lax793645.ConstructionData.Frames
    5576open Lax793645.ConstructionData.Binary
    5577open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5578open Finset Matrix Function Filter
    5579open scoped Classical
    5580noncomputable section
    5581set_option backward.isDefEq.respectTransparency false
    5582variable {I A : Type} [Fintype I] [DecidableEq I] [Fintype A] [Nonempty A]
    5583 {p : Shape} {n N : ℕ}
    5584def oneQueryPValues (v : Template p I) (o : OneUnit p n N) (x : Inputs p n I) : I→ F :=
    5585 fun i=> oneInner o (v.aim i) (useAtom p (v.t i) (v.s i) (v.f i) (x i))
    5586
    5587end
    5588end Lax793645.ConstructionData.Frames
    5589end
    5590
    5591section
    5592namespace Lax793645.ConstructionData.Frames
    5593open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5594open Finset Matrix Function Filter
    5595open scoped Classical
    5596noncomputable section
    5597set_option backward.isDefEq.respectTransparency false
    5598variable {I A : Type} [Fintype I] [DecidableEq I] [Fintype A] [Nonempty A]
    5599 {p : Shape} {n N : ℕ}
    5600def oneQueryFlags (v : Template p I) (χ : Inputs p n I→ A)
    5601 (o : OneUnit p n N) (x : Inputs p n I) : A×(I→ F):=(χ x,oneQueryPValues v o x)
    5602
    5603def oneQueryReferenceSet (v : Template p I) (q : I→ F) (N : ℕ) :
    5604 KeyCoordinates (KeySlots p v.t) N→ Prop :=
    5605 fun x=> oneOwnPart v.t q x
    5606
    5607end
    5608end Lax793645.ConstructionData.Frames
    5609end
    5610
    5611section
    5612namespace Lax793645.ConstructionData.Frames
    5613open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5614open StatusAnalysis Finset Matrix Function Filter
    5615open scoped Classical
    5616noncomputable section
    5617set_option backward.isDefEq.respectTransparency false
    5618variable {p : Shape} {n N : ℕ} {q : Format} {d : Rates} {b : Bool}
    5619/-- The scalar status vocabulary is unchanged; its parity coordinate now
    5620comes from the single quadratic frame and its opposite channels. -/
    5621def onePrinted (b : Bool) (v : Charts p n d) (t : Tagging p (Messenger q))
    5622 (s : Messenger q→ Label p.b) (f : Messenger q→ Flavor p.g) (m : Mixer p n)
    5623 (o : OneUnit p n N) (x : Inputs p n (Messenger q)) : Amounts p q d b :=
    5624 joinPrinted (nominalPrinted b v t s f m x) (oneQueryPValues (manager b t s f) o x)
    5625
    5626end
    5627end Lax793645.ConstructionData.Frames
    5628end
    5629
    5630section
    5631namespace Lax793645.ConstructionData.Frames
    5632open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5633open StatusAnalysis Filter Finset Matrix Function
    5634open scoped Classical BigOperators
    5635noncomputable section
    5636set_option backward.isDefEq.respectTransparency false
    5637variable {p : Shape} {n N r : ℕ} {q : Format} {d : Rates} {b : Bool}
    5638namespace OneQuill
    5639variable (w : Quill p q d b) (t : Tagging p (Messenger q)) (z : Messenger q→ F)
    5640 (o : OneUnit p n N)
    5641variable (m : Mixer p n)
    5642def oneSeraph (s : Charts p n d) (Y : OneSilhouette p N r) (i : Messenger q) :
    5643 Wgt (OneAtomKey (p:=p) (t i) N):=fun h=>
    5644 OneAppearance.oneReflected (w.allure t z i) Y (parcel b i) o m
    5645 (s (parcel b i)) (Y (t i) (z i) h) (w.amp i)
    5646
    5647end OneQuill
    5648end
    5649end Lax793645.ConstructionData.Frames
    5650end
    5651
    5652section
    5653namespace Lax793645.ConstructionData.Frames
    5654open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5655open Function LinearMap Finset StatusAnalysis Filter
    5656open scoped Classical Topology
    5657noncomputable section
    5658set_option backward.isDefEq.respectTransparency false
    5659set_option maxHeartbeats 800000
    5660def supportLower (θ a : ℝ) : ℝ:=θ* ind (0< a)
    5661
    5662end
    5663end Lax793645.ConstructionData.Frames
    5664end
    5665
    5666section
    5667namespace Lax793645.ConstructionData.Frames
    5668open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5669open StatusAnalysis LinearMap Module Matrix Function Finset
    5670open scoped Classical BigOperators
    5671noncomputable section
    5672set_option backward.isDefEq.respectTransparency false
    5673set_option maxHeartbeats 800000
    5674variable {p : Shape} {n N d : ℕ}
    5675/-- This budget records the tester coordinates once, then two factors
    5676for each basis quadratic and for the internal status bit. -/
    5677def oneStatusCoordinateBound (p : Shape) (d K : ℕ) : ℕ :=
    5678 Fintype.card (Gauge p)+d*(2*(p.J* tagDegree p.g*(2* K)))+
    5679 2*(tagDegree p.g*(2* p.h))
    5680
    5681end
    5682end Lax793645.ConstructionData.Frames
    5683end
    5684
    5685section
    5686namespace Lax793645.ConstructionData.Frames
    5687open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5688open Function LinearMap Finset StatusAnalysis Filter
    5689open scoped Classical Topology
    5690noncomputable section
    5691set_option backward.isDefEq.respectTransparency false
    5692set_option maxHeartbeats 800000
    5693namespace OneQuill
    5694variable {p : Shape} {n N r : ℕ} {q : Format} {d : Rates} {b : Bool}
    5695variable (w : Quill p q d b) (t : Tagging p (Messenger q)) (z : Messenger q→ F)
    5696 (o : OneUnit p n N) (m : Mixer p n) (s : Charts p n d) (Y : OneSilhouette p N r)
    5697def oneSupportSeraph (θ : ℝ) (i : Messenger q) : Wgt (OneAtomKey (p:=p) (t i) N):=
    5698 fun x=> supportLower θ (oneSeraph w t z o m s Y i x)
    5699
    5700end OneQuill
    5701end
    5702end Lax793645.ConstructionData.Frames
    5703end
    5704
    5705section
    5706namespace Lax793645.ConstructionData.Frames
    5707open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5708open StatusAnalysis Finset Function
    5709open scoped Classical BigOperators
    5710noncomputable section
    5711set_option backward.isDefEq.respectTransparency false
    5712variable {p : Shape} {n N r : ℕ} {q : Format} {d e : Rates} {b : Bool}
    5713namespace OneQuill
    5714variable (w : Quill p q d b) (t : Tagging p (Messenger q)) (z : Messenger q→ F)
    5715 (μ : Wgt (OneUnit p n N)) (P : OneUnit p n N→ Prop)
    5716 (m : Mixer p n) (s : Charts p n d) (Y : OneSilhouette p N r)
    5717end OneQuill
    5718namespace OneTypus
    5719variable (w : Typus p q d e) (o o' : OneUnit p n N)
    5720 (s : Charts p n d) (t : Charts p n e) (m : Mixer p n) (Y : OneSilhouette p N r)
    5721def oneMomus :=oneKappa (w.qA.pen w.t)* oneKappa (w.qB.pen w.t)
    5722
    5723end OneTypus
    5724end
    5725end Lax793645.ConstructionData.Frames
    5726end
    5727
    5728section
    5729namespace Lax793645.ConstructionData.Frames
    5730open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5731open Function LinearMap Finset StatusAnalysis Filter
    5732open scoped Classical Topology
    5733noncomputable section
    5734set_option backward.isDefEq.respectTransparency false
    5735set_option maxHeartbeats 800000
    5736namespace OneTypus
    5737variable {p : Shape} {n N r : ℕ} {q : Format} {d e : Rates}
    5738variable (w : Typus p q d e) (o o' : OneUnit p n N)
    5739 (s : Charts p n d) (t : Charts p n e) (m : Mixer p n) (Y : OneSilhouette p N r)
    5740def oneSupportChimera (i : Messenger q):=
    5741 dip (oneLawOmega p N (w.t i) (w.z i)) (OneQuill.oneSupportSeraph w.qA w.t w.z o m s Y 1 i)
    5742 (OneQuill.oneSupportSeraph w.qB w.t w.z o' m t Y 1 i)
    5743
    5744def oneSupportConstellation:=oneMomus w*∏ i,oneSupportChimera w o o' s t m Y i
    5745
    5746end OneTypus
    5747namespace OneTypus
    5748variable {p : Shape} {n N r : ℕ} {q : Format} {d e : Rates}
    5749variable (w : Typus p q d e) (μ ρ : Wgt (OneUnit p n N))
    5750 (F G : OneUnit p n N→ Prop) (s : Charts p n d) (t : Charts p n e)
    5751 (m : Mixer p n) (Y : OneSilhouette p N r) (θ : ℝ)
    5752end OneTypus
    5753end
    5754end Lax793645.ConstructionData.Frames
    5755end
    5756
    5757section
    5758namespace Lax793645.ConstructionData.Frames
    5759open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5760open Matrix LinearMap Submodule Module Finset Function
    5761open scoped BigOperators Classical
    5762noncomputable section
    5763set_option backward.isDefEq.respectTransparency false
    5764variable {p : Shape} {n : ℕ} {I : Type} [Fintype I] [DecidableEq I]
    5765def oneProtectionThreshold (K t : ℕ):=(4*(K+t))^2+t
    5766
    5767def oneSelectorProtectionDim (p : Shape) (K : ℕ):=
    5768 oneProtectionThreshold K 28*(Fintype.card (Bool×Comp p.g)* K)
    5769
    5770def oneBaseProtectionDim (p : Shape) (K : ℕ):=
    5771 Fintype.card (SelIdx p.b p.j)*(Fintype.card (Bool×Comp p.g)* K)
    5772
    5773def OnePenSpace (v : Template p I) (a : ImagePlan (Comp p.g) (OneColumn p n)) (K : ℕ) : Prop :=
    5774 (∀ e,dim (a e)≤ K) ∧
    5775 ∃ (U : Space (Vec (SelIdx p.b p.j))) (V : Space (Vec (AIdx p.g n))),
    5776 dim U≤ oneSelectorProtectionDim p K ∧ dim V≤ oneBaseProtectionDim p K ∧
    5777 (∀ i e,oneEndpointPrimalPins a i e≤ tensorCross U V) ∧
    5778 (∀ i e x,x∈oneEndpointPrimalPins a i e→
    5779 Matrix.rank (flattenMatrix.symm x)≤ oneProtectionThreshold K (Fintype.card I)→
    5780 x∈tensorRectangle U V) ∧
    5781 LinearIndependent F (U.mkQ ∘ (fun j=> selV p.j (v.s j)))
    5782
    5783end
    5784end Lax793645.ConstructionData.Frames
    5785end
    5786
    5787section
    5788namespace Lax793645.ConstructionData.Frames
    5789open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5790open StatusAnalysis
    5791noncomputable section
    5792variable {p : Shape} {q : Format} {d e : Rates}
    5793/-- Scalar compatibility of the deterministic expansion of the smaller
    5794binary prescription. All other status and flag conditions are unchanged. -/
    5795def onePermission (w : Typus p q d e) : Prop :=
    5796 (∀ i,1≤ q i ∧q i≤7) ∧w.qA.moral w.t w.z ∧w.qB.moral w.t w.z ∧
    5797 (∀ i,fullq w.z i=1) ∧rhyme w.qA.amp w.qB.amp ∧
    5798 proclaims p w.qA.amp w.qB.amp w.t (reducedScript w.qA.script) ∧
    5799 proclaims p w.qB.amp w.qA.amp w.t (reducedScript w.qB.script)
    5800
    5801end
    5802end Lax793645.ConstructionData.Frames
    5803end
    5804
    5805section
    5806namespace Lax793645.ConstructionData.Frames
    5807open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5808open Matrix Finset LinearMap Submodule Module Function
    5809open scoped BigOperators Classical
    5810noncomputable section
    5811set_option backward.isDefEq.respectTransparency false
    5812variable {p : Shape} {n : ℕ}
    5813def oneChannelInjection (p : Shape) (n : ℕ) : (Bool→ Hyperbolic p.h)→ₗ[F]Vec (OneColumn p n):=
    5814 (oneNominalCoordinates p n).symm.toLinearMap.comp (LinearMap.inr F _ _)
    5815
    5816def oneAllChannels (p : Shape) (n : ℕ):=LinearMap.range (oneChannelInjection p n)
    5817
    5818def oneTabSpace (a : ImagePlan (Comp p.g) (OneColumn p n)) (e : Comp p.g):=
    5819 a e⊔oneAllChannels p n
    5820
    5821def oneFitsTable (a b : ImagePlan (Comp p.g) (OneColumn p n)) (T Q : OneCross p n) :=
    5822 ∀ e,∀ v∈oneTabSpace a e,∀ w∈oneTabSpace b e,evmat (T e) v w=evmat (Q e) v w
    5823
    5824def oneDeckMax (p : Shape) (K : ℕ):=Fintype.card (Comp p.g)*(K+4* p.h)^2
    5825
    5826end
    5827end Lax793645.ConstructionData.Frames
    5828end
    5829
    5830section
    5831namespace Lax793645.ConstructionData.Frames
    5832open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5833open Matrix LinearMap Submodule Module Function
    5834open scoped BigOperators Classical
    5835noncomputable section
    5836set_option backward.isDefEq.respectTransparency false
    5837variable {p : Shape} {n N : ℕ}
    5838def oneTableFlag (a b : ImagePin (Comp p.g) (OneColumn p n) (2* N))
    5839 (T : OneCross p n) (x : OneUnit p n N) :=
    5840 ∀ e,∀ v∈oneTabSpace a.sp e,∀ w∈b.sp e,
    5841 evmat (T e) v w=oneAmbientPolar N (oneCoordinateImages x e*ᵥv) (b.target e*ᵥw)
    5842
    5843end
    5844end Lax793645.ConstructionData.Frames
    5845end
    5846
    5847section
    5848namespace Lax793645.ConstructionData.Frames
    5849open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5850open Matrix LinearMap Submodule Module Function Finset
    5851open scoped BigOperators Classical
    5852noncomputable section
    5853set_option backward.isDefEq.respectTransparency false
    5854set_option maxHeartbeats 800000
    5855variable {p : Shape} {n N : ℕ}
    5856def oneContract (T : OneCross p n) (i j : Bool) : Profile p n→ₗ[F]F:=
    5857 (jointMatrixFunctional (fun e=> channelQuadraticMatrix p.h
    5858 (unitLeftChannels p.h (oneTableOfCross T e) j))).comp (jointEndpointMap i)
    5859
    5860def oneTableSafe (a b : ImagePlan (Comp p.g) (OneColumn p n)) (T : OneCross p n) :=
    5861 ∀ e i j,∀ v∈oneEndpointPrimalPins a i e,
    5862 unitLeftChannels p.h (oneTableOfCross T e) j (jointInjection i v)∈oneChannelPins b j e→ v=0
    5863
    5864end
    5865end Lax793645.ConstructionData.Frames
    5866end
    5867
    5868section
    5869namespace Lax793645.ConstructionData.Frames
    5870open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5871open StatusAnalysis Finset Matrix Function LinearMap Module Submodule
    5872open scoped BigOperators Classical
    5873noncomputable section
    5874set_option backward.isDefEq.respectTransparency false
    5875set_option maxHeartbeats 800000
    5876variable {p : Shape} {n N : ℕ} {q : Format} {d e : Rates}
    5877def oneTargetMark (v : Charts p n d) (T : OneCross p n) (i j : Bool) : Cell (d i):=
    5878 roll (v i) (oneContract T i j+role p n)
    5879
    5880def oneHailing (v : Charts p n d) (w : Charts p n e) (T : OneCross p n) : Cabinet d e:=
    5881 fun i=>(1,1,oneTargetMark v T i.1 i.2,oneTargetMark w (fun e=>(T e)ᵀ) i.2 i.1)
    5882
    5883def oneStill (b : Bool) (a : Amounts p q d b) (v : Charts p n d) (T : OneCross p n) :=
    5884 (∀ i:Grid,(funds a i).1.2=oneTargetMark v T (sendId b i) (sendId (!b) i)) ∧
    5885 ∀ j:Bool,couple _ (funds a (transit b (true,j)))=
    5886 couple _ (funds a (transit b (false,j)))
    5887
    5888end
    5889end Lax793645.ConstructionData.Frames
    5890end
    5891
    5892section
    5893namespace Lax793645.ConstructionData.Frames
    5894open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5895open StatusAnalysis Matrix LinearMap Submodule Module Finset Function
    5896open scoped BigOperators Classical
    5897noncomputable section
    5898set_option backward.isDefEq.respectTransparency false
    5899namespace OneOptions
    5900variable {p : Shape} {n N K : ℕ} {q : Format} {d e : Rates} {side : Bool}
    5901def signed (w : Quill p q d side) (t : Tagging p (Messenger q))
    5902 (x y : ImagePin (Comp p.g) (OneColumn p n) (2* N))
    5903 (s : Charts p n d) (T : OneCross p n) (K : ℕ) :=
    5904 oneCharted s x.sp ∧ OnePenSpace (w.pen t) x.sp K ∧
    5905 oneStill side w.amp s T ∧ oneTableSafe x.sp y.sp T
    5906
    5907def chances (w : Typus p q d e) (s : Charts p n d) (v : Charts p n e)
    5908 (x y : ImagePin (Comp p.g) (OneColumn p n) (2* N)) (T : OneCross p n) (K : ℕ) :=
    5909 (onePermission w) ∧ signed w.qA w.t x y s T K ∧
    5910 signed w.qB w.t y x v (fun e=>(T e)ᵀ) K
    5911
    5912def notified (m : Mixer p n) (x y : ImagePin (Comp p.g) (OneColumn p n) (2* N))
    5913 (T : OneCross p n) (C : Prop) (o : OneUnit p n N) :=
    5914 C ∧ imagePinAgree oneCoordinateImages x o ∧
    5915 (∀ i,oneFrameLaw m (o i)) ∧ oneTableFlag x y T o
    5916
    5917end OneOptions
    5918end
    5919end Lax793645.ConstructionData.Frames
    5920end
    5921
    5922section
    5923namespace Lax793645.ConstructionData.Frames
    5924open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5925open StatusAnalysis Matrix LinearMap Submodule Module Finset Function
    5926open scoped BigOperators Classical
    5927noncomputable section
    5928set_option backward.isDefEq.respectTransparency false
    5929variable {p : Shape} {n N K : ℕ}
    5930abbrev OneScrip (p : Shape) (K : ℕ):=Σ q : Master K,Fin (2^oneDeckMax p K)×OnFile p q
    5931
    5932structure OneStation (p : Shape) (n N K : ℕ) (s : OneLeafMixture p n N) where
    5933 cAxes : s.T→(d : Rates)→ Charts p n d
    5934 mails : s.T→ s.T→ Fin (2^oneDeckMax p K)→ OneCross p n
    5935
    5936namespace OneStation
    5937variable {s : OneLeafMixture p n N} (v : OneStation p n N K s)
    5938def bank :=
    5939 (∀ i,let d:=fun j=> dim (oneEffectivePins (oneEndpointPrimalPins (s.pin i.val).sp) j)
    5940 oneCharted (v.cAxes i d) (s.pin i.val).sp) ∧
    5941 ∀ i j T,∃ k,oneFitsTable (s.pin i.val).sp (s.pin j.val).sp (v.mails i j k) T
    5942
    5943variable {q:Format} {d e:Rates} (w:Typus p q d e)
    5944def news (i j:s.T) (k:Fin (2^oneDeckMax p K)):=
    5945 OneOptions.chances w (v.cAxes i d) (v.cAxes j e) (s.pin i.val) (s.pin j.val) (v.mails i j k) K
    5946
    5947def frontPage (m:Mixer p n) (i j:s.T) (k:Fin (2^oneDeckMax p K)):=
    5948 OneOptions.notified m (s.pin i.val) (s.pin j.val) (v.mails i j k) (v.news w i j k)
    5949
    5950def backPage (m:Mixer p n) (i j:s.T) (k:Fin (2^oneDeckMax p K)):=
    5951 OneOptions.notified m (s.pin j.val) (s.pin i.val) (fun e=>(v.mails i j k e)ᵀ) (v.news w i j k)
    5952
    5953end OneStation
    5954end
    5955end Lax793645.ConstructionData.Frames
    5956end
    5957
    5958section
    5959namespace Lax793645.ConstructionData.Frames
    5960open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5961open Matrix LinearMap Submodule Module Finset Function
    5962open scoped BigOperators Classical
    5963noncomputable section
    5964set_option backward.isDefEq.respectTransparency false
    5965variable {p : Shape} {n N : ℕ}
    5966variable {I A B : Type} [Fintype I] [DecidableEq I] [Fintype A] [Fintype B]
    5967def oneSlots (p : Shape) (I : Type) [Fintype I] := Fintype.card I * tagDegree p.g
    5968def oneMaxSlots (p : Shape):=28* tagDegree p.g
    5969
    5970end
    5971end Lax793645.ConstructionData.Frames
    5972end
    5973
    5974section
    5975namespace Lax793645.ConstructionData.Frames
    5976open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    5977open StatusAnalysis Matrix LinearMap Submodule Module Finset Function
    5978open scoped BigOperators Classical
    5979noncomputable section
    5980set_option backward.isDefEq.respectTransparency false
    5981variable {p : Shape} {n N K : ℕ} {q : Format} {d e : Rates}
    5982def oneClash (m : Mixer p n) (xy : OneUnit p n N×OneUnit p n N) :=
    5983 (oneRawHoles m).conflict (xy.1 true,xy.1 false) (xy.2 true,xy.2 false)
    5984
    5985structure OneEarnsScore (p : Shape) (n N K : ℕ) (ζ : ℝ) : Prop where
    5986 hr : 1≤ p.r
    5987 hn : 2* p.r≤ n
    5988 odd : Odd p.g
    5989 room : ∀ t≤28,oneRealizationRoom p K t
    5990 smooth : 0≤ζ
    5991 low : ζ≤0.004
    5992 light : ζ* oneMaxSlots p≤0.004
    5993 hN : 100≤2* N
    5994 gram : (dim (OneCheckGram p n):ℝ)≤0.01*(2* N)
    5995 budget : (K+(oneMaxSlots p:ℝ))* num (OneColumn p n)≤0.005*(2* N)
    5996
    5997namespace OneStation
    5998variable {pop : OneLeafMixture p n N} (v : OneStation p n N K pop)
    5999end OneStation
    6000end
    6001end Lax793645.ConstructionData.Frames
    6002end
    6003
    6004section
    6005namespace Lax793645.ConstructionData.Frames
    6006open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6007open StatusAnalysis Finset Function
    6008open scoped Classical BigOperators
    6009noncomputable section
    6010set_option backward.isDefEq.respectTransparency false
    6011variable {p:Shape} {n N K r:ℕ} {pop:OneLeafMixture p n N}
    6012namespace OneStation
    6013def twilight {q:Format} {d e:Rates} (v:OneStation p n N K pop)
    6014 (w:Typus p q d e) (m:Mixer p n) (k:Fin (2^oneDeckMax p K))
    6015 (Y:OneSilhouette p N r) (i j:pop.T) (o:OneUnit p n N×OneUnit p n N):=
    6016 ind (v.frontPage w m i j k o.1 ∧ v.backPage w m i j k o.2)*
    6017 OneTypus.oneSupportConstellation w o.1 o.2 (v.cAxes i d) (v.cAxes j e) m Y
    6018
    6019end OneStation
    6020def oneSupportBudget (p:Shape) (K:ℕ) (η a:ℝ):=
    6021 0< a ∧ ∀ k:OneScrip p K,a≤ OneTypus.oneMomus k.2.2*
    6022 η^Fintype.card (Messenger (toFormat k.1.1))
    6023
    6024end
    6025end Lax793645.ConstructionData.Frames
    6026end
    6027
    6028section
    6029namespace Lax793645.ConstructionData.Frames
    6030open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6031open StatusAnalysis StatusAnalysis.DualAnalysis StatusAnalysis.Guild StatusAnalysis.Club
    6032open Matrix LinearMap Submodule Module Finset Function
    6033open scoped BigOperators
    6034noncomputable section
    6035variable {p : Shape} {n N r K : ℕ} {d e : Rates}
    6036variable {u : Terrain p r} {s : Gazette p r d} {t : Gazette p r e} {β η δ : ℝ}
    6037def oneScalarBudget (p : Shape) (K : ℕ) :=
    6038 2^(oneSelectorProtectionDim p K+34)
    6039
    6040end
    6041end Lax793645.ConstructionData.Frames
    6042end
    6043
    6044section
    6045namespace Lax793645.ConstructionData.Frames
    6046open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6047open Finset Matrix Module LinearMap Submodule Function
    6048open scoped BigOperators
    6049noncomputable section
    6050set_option backward.isDefEq.respectTransparency false
    6051variable {p : Shape} {n N : ℕ}
    6052def oneScreenRank (p : Shape) (K : ℕ) := (tagDegree p.g)*(2* p.h+2* p.J* K)
    6053
    6054end
    6055end Lax793645.ConstructionData.Frames
    6056end
    6057
    6058section
    6059namespace Lax793645.ConstructionData.Frames
    6060open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6061open PreparationParameters PredictionClass Filter Finset
    6062open scoped Topology
    6063noncomputable section
    6064set_option backward.isDefEq.respectTransparency false
    6065variable {p : Shape} {n N M : ℕ} {q : PreparationParameters}
    6066def oneIntern (q : PreparationParameters) (p : Shape) (n N : ℕ):=
    6067 ∀ m : Mixer p n,OnePhaseReady p n N (mstep q.rank) ((2* N)/denomStep q.rank)
    6068 q.rank q.k q.d m (tinyPhase p.g q.rank q.spJoint) coin warn
    6069 (heatloss q.rank q.k) q.spear (bp (q.spJoint*(2* N)))
    6070
    6071/-- The preparation schedule records only bounds already supplied by the
    6072one-frame counting, closed-pin, phase, and injection calendars. -/
    6073structure OnePlanted (q : PreparationParameters) (p : Shape) (M : ℕ) : Prop where
    6074 early : OnePreparationAllows q
    6075 hM : 1≤ M
    6076 hg : Odd p.g
    6077 hG : 3≤ p.g
    6078 hJ : 1≤ p.j
    6079 hR : 1≤ p.r
    6080 hB : (q.B:ℝ)< bp ((p.b:ℝ)-2* p.j)
    6081 exactRoom : 4* oneScreenRank p q.e+2* q.e* p.r< p.g* p.r
    6082 wrap : ∀ᶠ n : ℕ in atTop,let N:=M* n;
    6083 2* dim (OneFull p n)+3≤ N ∧ 4≤ N ∧
    6084 (3*(onePreparationCover q):ℝ)*(2* N)≤((q.u:ℝ)-1)*(2* N) ∧
    6085 (∀ (m : Mixer p n) (a : ImagePin (Comp p.g) (OneColumn p n) (2* N)),
    6086 (onePinClosure p n).close a.sp=a.sp →
    6087 pr (oneUnitRaw m N) (imagePinAgree oneCoordinateImages a)≤
    6088 fee (2* N) ((q.ζ/6)/4) (imagePlanRank a.sp)) ∧
    6089 oneIntern q p n N ∧ oneOutside q p n N
    6090
    6091end
    6092end Lax793645.ConstructionData.Frames
    6093end
    6094
    6095section
    6096namespace Lax793645.ConstructionData.Frames
    6097open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6098open PreparationParameters PredictionClass Filter Finset
    6099open scoped BigOperators Topology
    6100noncomputable section
    6101set_option backward.isDefEq.respectTransparency false
    6102variable {l : Filter ℕ} {p : Shape} {M n N : ℕ} {q : PreparationParameters}
    6103 {m : cycleM p} {s : OneRhythms p M} {w : OneTale p M}
    6104/-- Inside each pair of independently drawn leaves, every positive
    6105compatibility probability has at least the specified mass. -/
    6106def oneCompatibilityFloor (s : OneLeafMixture p n N) (w : Wgt (OneUnit p n N))
    6107 (C : OneUnit p n N × OneUnit p n N → Prop) (γ : ℝ) :=
    6108 ∀ i j : s.T,0< pr (pairW (partW w i.val) (partW w j.val)) C →
    6109 γ≤ pr (pairW (partW w i.val) (partW w j.val)) C
    6110
    6111variable {b : OneSketch p M}
    6112end
    6113end Lax793645.ConstructionData.Frames
    6114end
    6115
    6116section
    6117namespace Lax793645.ConstructionData.Frames
    6118open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6119open PreparationParameters PredictionClass Filter Finset Matrix
    6120open scoped BigOperators Topology
    6121noncomputable section
    6122set_option backward.isDefEq.respectTransparency false
    6123variable {p : Shape} {n N : ℕ} {q : PreparationParameters}
    6124structure OneSage (p : Shape) (n N : ℕ) where
    6125 g : Bool→ OneAugur p N
    6126 m : OneMarks p n N
    6127 L : OneUnit p n N → Bool→ Finset (Label p.b)
    6128
    6129end
    6130end Lax793645.ConstructionData.Frames
    6131end
    6132
    6133section
    6134namespace Lax793645.ConstructionData.Frames
    6135open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6136open StatusAnalysis OneAppearance Function LinearMap Finset
    6137open StatusAnalysis.DualAnalysis
    6138noncomputable section
    6139set_option backward.isDefEq.respectTransparency false
    6140variable {p : Shape} {n N c R : ℕ}
    6141def OnePaletteGood (H : Space (OneJointKey p N)) (o : OneUnit p n N) : Prop :=
    6142 ∀ i s,Injective ((oneMixedRow (oneFreeColumns p n s) (o i)).comp H.subtype)
    6143
    6144def OneFullTableGap (Y : OneSilhouette p N c) (m : Mixer p n) (K : ℕ)
    6145 (o o' : OneUnit p n N) : Prop :=
    6146 ∀ d d',d≤ K^2→ d'≤ K^2→∀ i i',∀ v : Ax p n d,∀ v' : Ax p n d',
    6147 (∀ j : Fin d,totalRank (v (Pi.single j 1))≤ K)→
    6148 (∀ j : Fin d',totalRank (v' (Pi.single j 1))≤ K)→
    6149 ∀ l q a b f f',
    6150 (⟨l,a,f,q⟩ : Appearance p).apt→(⟨l,b,f',q⟩ : Appearance p).apt→
    6151 ∀ z : Magazine p d,∀ z' : Magazine p d',z.1.sumBit=q→ z'.1.sumBit=q→
    6152 let x : Appearance p:=⟨l,a,f,q⟩
    6153 let y : Appearance p:=⟨l,b,f',q⟩
    6154 let overlap:=avg (oneReference x Y) (fun j=>
    6155 oneReflected x Y i o m v j z* oneReflected y Y i' o' m v' j z')
    6156 overlap=0 ∨ bp (-(4*(oneStatusCoordinateBound p (K^2) K:ℝ)+1))≤ overlap
    6157
    6158end
    6159end Lax793645.ConstructionData.Frames
    6160end
    6161
    6162section
    6163namespace Lax793645.ConstructionData.Frames
    6164open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6165open Function LinearMap Finset PreparationParameters
    6166open scoped BigOperators
    6167noncomputable section
    6168set_option backward.isDefEq.respectTransparency false
    6169set_option maxHeartbeats 800000
    6170variable {p : Shape} {n N : ℕ} {q : PreparationParameters}
    6171def exactPredictorRows (p : Shape) (q : PreparationParameters) := 2* oneScreenRank p q.e
    6172
    6173end
    6174end Lax793645.ConstructionData.Frames
    6175end
    6176
    6177section
    6178namespace Lax793645.ConstructionData.Frames
    6179open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6180open Function LinearMap Finset
    6181open scoped Classical
    6182noncomputable section
    6183set_option backward.isDefEq.respectTransparency false
    6184variable {p : Shape} {n N : ℕ}
    6185def oneGenericPostulates (o : OneOrient p n N) (g : OneAugur p N) (w : Pdual p n)
    6186 (E : Finset (Label p.b)) (δ : ℝ):=
    6187 ∀ s,s∉E→∀ l,pr (spins p n) (oneMismatch g w l s Flavor.full o)≤δ
    6188
    6189def oneGenericSeems (q : PreparationParameters) (m : Mixer p n) (s : OneLeafMixture p n N)
    6190 (x : OneUnit p n N) (g : Bool→ OneAugur p N) (z : Bool→ Profile p n)
    6191 (L : Bool→ Finset (Label p.b)) (α : Party) (ε : ℝ):=
    6192 (∀ i,(L i).card≤ q.B ∧ z i∈oneEffectivePins (oneEndpointPrimalPins (s.rooting x)) i) ∧
    6193 ∀ i,oneGenericPostulates (x i) (g i) (oneYoke m x i (z i) (α i)) (L i) ε
    6194
    6195end
    6196end Lax793645.ConstructionData.Frames
    6197end
    6198
    6199section
    6200namespace Lax793645.ConstructionData.Frames
    6201open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6202open PreparationParameters PredictionClass Filter Finset
    6203open scoped Topology
    6204noncomputable section
    6205set_option backward.isDefEq.respectTransparency false
    6206variable {p : Shape} {n N M : ℕ} {q : PreparationParameters} {l : Filter ℕ}
    6207 {m : cycleM p} {w : OneTale p M} {s : OneRhythms p M} {U : Ultrafilter ℕ}
    6208 {b : OneSketch p M}
    6209def oneBoundedLinearAugurs (p : Shape) (n N : ℕ) (g : Bool→ OneAugur p N):=
    6210 ∃ R : ℕ,8* p.g* R≤ n ∧ ∀ i,OneLinearAugur (g i) R
    6211
    6212def oneBoundedLinearPredicts (q : PreparationParameters) (m : Mixer p n)
    6213 (s : OneLeafMixture p n N) (w : Wgt (OneUnit p n N)) (ε : ℝ):=
    6214 ∃ g : Bool→ OneAugur p N,oneBoundedLinearAugurs p n N g ∧
    6215 (0.000001:ℝ)≤ pr (s.sap w) (fun x=>∃ z L α,oneGenericSeems q m s x g z L α ε)
    6216
    6217def oneLinearSilenceOutcome (q : PreparationParameters) (l : Filter ℕ) (m : cycleM p)
    6218 (w : OneTale p M) (s : OneRhythms p M):=
    6219 ∃ ε : ℝ,0≤ε ∧ ∀ᶠ n in l,
    6220 ¬oneBoundedLinearPredicts q (m n) (s n) (w n) ε ∧
    6221 0.99< pr (pairW ((s n).sap (w n)) ((s n).sap (w n))) (oneSecureAt (s n))
    6222
    6223end
    6224end Lax793645.ConstructionData.Frames
    6225end
    6226
    6227section
    6228namespace Lax793645.ConstructionData.Frames
    6229open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6230open PreparationParameters StatusAnalysis Filter
    6231open scoped Topology
    6232noncomputable section
    6233structure OneAnalyticParameters (p:Shape) (M:ℕ) (q:PreparationParameters) (s0:ℕ):Prop where
    6234 planted:OnePlanted q p M
    6235 unary:OneUnaryParameters p M (onePreparationPins q) s0
    6236 thickness:4≤ M
    6237 affine:p.j=1
    6238 jump:1≤ p.J
    6239 reserve:10* oneScalarBudget p (onePreparationPins q)+1000≤ q.B
    6240 poolRoom : 2^(oneSelectorProtectionDim p (onePreparationPins q) +
    6241 4 * 2^(2*(onePreparationPins q)^2+5)) ≤ q.B
    6242 spare:3* q.B< Fintype.card (Label p.b)
    6243 exactLateRoom:4* oneScreenRank p (onePreparationPins q)< p.g* p.r
    6244 secure:∀ᶠ n:ℕ in atTop,OneEarnsScore p n (M* n) (onePreparationPins q) (2* q.ζ)
    6245
    6246def oneConflicted {p:Shape} {n N:ℕ} (m:Mixer p n) (w:Wgt (OneUnit p n N)):=
    6247 pr (pairW w w) (oneClash m)< bp (-200*(2* N:ℝ))
    6248
    6249structure OneVeil (p:Shape) (M:ℕ) (q:PreparationParameters) (s0:ℕ)
    6250 (l:Filter ℕ) (m:cycleM p) (s:OneRhythms p M) (w:OneTale p M):Prop where
    6251 parameters:OneAnalyticParameters p M q s0
    6252 time:l≤ atTop
    6253 durable:OneDurable q l m w s
    6254 moment:∀ᶠ n in l,OneNascent q (m n) (w n) ∧
    6255 unaryGood (m n) (onePreparationPins q) s0 ∧ reducedBinaryGood (m n) ∧ oneConflicted (m n) (w n)
    6256
    6257abbrev OneStations (p:Shape) (M K:ℕ) (s:OneRhythms p M):=
    6258 ∀ n:ℕ,OneStation p n (M* n) K (s n)
    6259
    6260end
    6261end Lax793645.ConstructionData.Frames
    6262end
    6263
    6264section
    6265namespace Lax793645.ConstructionData.Frames
    6266open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6267open Filter PreparationParameters PredictionClass Finset
    6268open scoped Topology
    6269noncomputable section
    6270set_option backward.isDefEq.respectTransparency false
    6271abbrev OneBranch := Option (PredictionClass × Party × F × Bool)
    6272
    6273def preparationQuota (k : ℕ) : ℝ := 1 / ((k:ℝ)+1)
    6274
    6275variable {p : Shape} {n N M : ℕ} {q : PreparationParameters}
    6276/-- Finite output of preparation at a single size. The rare case gives a
    6277lower bound on positive conditional compatibility probabilities. -/
    6278def OneBranchAt (q : PreparationParameters) (m : Mixer p n) (w : Wgt (OneUnit p n N))
    6279 (s : OneLeafMixture p n N) (a : ℝ) : OneBranch → Prop
    6280 | none => ¬oneBoundedLinearPredicts q m s w 0 ∧ 0.99< pr (pairW (s.sap w) (s.sap w)) (oneSecureAt s)
    6281 | some (c,α,r,rare) => c.lit α ∧ ∃ i : OneSage p n N,
    6282 OneAlgebraicRows i.g (exactPredictorRows p q) ∧ oneFiniteClass i.g α=c ∧
    6283 s.within (fun x=> oneSeems q m s x i.g (i.m x) (i.L x) α 0 ∧
    6284 glint p (i.m x)=r ∧ (c=dusk → oneExactInk m i.m x)) ∧
    6285 let phases := oneMatchUp (fun x=> oneMarkedDelta x (i.m x)) α r c
    6286 let law := pairW (s.sap w) (s.sap w)
    6287 if rare then oneCompatibilityFloor s w phases a ∧ a/((2* N:ℕ):ℝ)^4≤ pr law phases ∧
    6288 pr law (fun x=> phases x ∧ ¬oneSecureAt s x)≤0.001* pr law phases
    6289 else a≤ pr law (fun x=> phases x ∧ oneSecureAt s x)
    6290
    6291def OnePreparedAt (q : PreparationParameters) (m : Mixer p n)
    6292 (w : Wgt (OneUnit p n N)) (k : ℕ) : Prop :=
    6293 ∃ s : OneLeafMixture p n N,preparationQuota k≤ s.amount w ∧
    6294 (oneLeafStrength s w m q.leafNew (2* q.ζ) (onePreparationPins q) ∧ s.within (oneFrameSide m)) ∧
    6295 ∃ tag,OneBranchAt q m w s (preparationQuota k) tag
    6296
    6297variable {m : cycleM p} {w : OneTale p M} {l : Filter ℕ}
    6298end
    6299end Lax793645.ConstructionData.Frames
    6300end
    6301
    6302section
    6303namespace Lax793645.ConstructionData.Frames
    6304open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6305open Filter Matrix PreparationParameters
    6306open scoped BigOperators Topology
    6307noncomputable section
    6308namespace OneParameters
    6309structure Complete (p:Shape) (M:ℕ) (b:PreparationParameters) (s0:ℕ):Prop
    6310 extends OneAnalyticParameters p M b s0 where
    6311 initial:∀ᶠ n:ℕ in atTop,∀ (m:Mixer p n) (w:Wgt (OneUnit p n (M* n))),
    6312 OneNascent b m w → carried w (fun x=>(oneRawHoles m).unit (x true,x false)) →
    6313 ∃ s:OneLeafMixture p n (M* n),OneEntered b m w s
    6314 mixerRoom:s0≤ p.J
    6315
    6316end OneParameters
    6317end
    6318end Lax793645.ConstructionData.Frames
    6319end
    6320
    6321section
    6322namespace Lax793645.ConstructionData.Binary
    6323noncomputable section
    6324namespace HadwigerCounterexample
    6325open Matrix Function Finset Module LinearMap Filter
    6326open scoped BigOperators Topology
    6327open Template
    6328variable {p:Shape} {n N K M r s0:ℕ}
    6329namespace StatusAnalysis
    6330open PreparationParameters Station PredictionClass DualAnalysis Club Guild
    6331def trimBeta (p : Shape) (K:ℕ):=basebeta p K/2
    6332
    6333structure Jubilee (p : Shape) (K:ℕ) (ε η:ℝ) : Prop where
    6334 pos : 0<η
    6335 book : playbook p K*η≤ε
    6336 sturdyR : playbook p K*η<1/2* trimBeta p K^2
    6337 low : 6*ε<1/2* trimBeta p K
    6338
    6339variable {b:PreparationParameters}
    6340end StatusAnalysis
    6341end HadwigerCounterexample
    6342end
    6343end Lax793645.ConstructionData.Binary
    6344end
    6345
    6346section
    6347namespace Lax793645.ConstructionData.Frames
    6348open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6349open PreparationParameters StatusAnalysis StatusAnalysis.DualAnalysis
    6350open Filter Finset Matrix Function
    6351open scoped BigOperators Topology
    6352noncomputable section
    6353set_option backward.isDefEq.respectTransparency false
    6354variable {p:Shape} {n N K M r s0:ℕ} {q:PreparationParameters}
    6355 {pop:OneLeafMixture p n N} {m:Mixer p n}
    6356structure OneLoupe (pop:OneLeafMixture p n N) (K:ℕ) where
    6357 r:pop.T→ Stakes K
    6358
    6359structure OneShipped (pop:OneLeafMixture p n N) (K:ℕ)
    6360 (v:OneStation p n N K pop) (t:OneLoupe pop K):Prop where
    6361 charts i:oneCharted (v.cAxes i (toRates (t.r i))) (pop.pin i.val).sp
    6362
    6363def oneRouteC (t:OneLoupe pop K) (v:OneStation p n N K pop) (x:OneAspect pop):=
    6364 v.cAxes x.1 (toRates (t.r x.1))
    6365
    6366end
    6367end Lax793645.ConstructionData.Frames
    6368end
    6369
    6370section
    6371namespace Lax793645.ConstructionData.Frames
    6372open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6373open StatusAnalysis StatusAnalysis.Appearance StatusAnalysis.DualAnalysis OneAppearance Filter Finset Matrix Function LinearMap Module Template
    6374open scoped BigOperators Topology
    6375noncomputable section
    6376set_option backward.isDefEq.respectTransparency false
    6377set_option maxHeartbeats 1000000
    6378variable {p : Shape} {n N K M r s0 : ℕ} {d : Rates}
    6379def oneGenericSmoothSilk (p : Shape) (ε δ:ℝ) (Y:OneSilhouette p N r)
    6380 (m:Mixer p n) (K:ℕ) (o:OneOrient p n N) :=
    6381 ∀ x : Appearance p,x.f=Flavor.full→
    6382 (x.apt → oneClose x Y o ε) ∧ oneFoil x Y o m K δ
    6383
    6384def oneGenericGauze (p : Shape) (ε δ:ℝ) (Y:OneSilhouette p N r)
    6385 (m:Mixer p n) (K:ℕ) (o:OneUnit p n N) :=
    6386 ∀ i,oneGenericSmoothSilk p ε δ Y m K (o i)
    6387
    6388namespace OneAppearance
    6389variable (x : Appearance p) (Y : OneSilhouette p N r)
    6390variable {d : ℕ}
    6391end OneAppearance
    6392namespace OneQuill
    6393variable {q : Format} {d : Rates} {b : Bool}
    6394def oneGeneric (w : Quill p q d b) : Prop:=∀ i,w.flav i=Flavor.full
    6395
    6396end OneQuill
    6397def oneGenericOption {q : Format} {d e : Rates} (w : Typus p q d e) : Prop :=
    6398 OneQuill.oneGeneric w.qA ∧ OneQuill.oneGeneric w.qB
    6399
    6400def oneGenericPermission {q : Format} {d e : Rates} (w : Typus p q d e) : Prop :=
    6401 onePermission w ∧ oneGenericOption w
    6402
    6403end
    6404end Lax793645.ConstructionData.Frames
    6405end
    6406
    6407section
    6408namespace Lax793645.ConstructionData.Frames
    6409open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6410open StatusAnalysis Finset Function
    6411open scoped Classical BigOperators
    6412noncomputable section
    6413set_option backward.isDefEq.respectTransparency false
    6414variable {p:Shape} {n N K r:ℕ} {pop:OneLeafMixture p n N}
    6415namespace OneStation
    6416def genericEligiblePair (v:OneStation p n N K pop) (m:Mixer p n) (i j:OneAspect pop)
    6417 (Y:OneSilhouette p N r) (a:ℝ):=
    6418 ∃ k:OneScrip p K,(oneGenericPermission k.2.2 ∧ oneSlots p (Messenger (toFormat k.1.1)) ≤ 32) ∧ a≤ v.twilight k.2.2 m k.2.1 Y i.1 j.1 (i.2,j.2)
    6419
    6420end OneStation
    6421end
    6422end Lax793645.ConstructionData.Frames
    6423end
    6424
    6425section
    6426namespace Lax793645.ConstructionData.Frames
    6427open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6428open PreparationParameters StatusAnalysis Filter Finset Function
    6429open scoped Topology BigOperators
    6430noncomputable section
    6431set_option backward.isDefEq.respectTransparency false
    6432set_option maxHeartbeats 1000000
    6433variable {p:Shape} {M s0:ℕ} {q:PreparationParameters} {l:Filter ℕ}
    6434 {m:cycleM p} {s:OneRhythms p M} {w:OneTale p M}
    6435structure OneGenericBeams {n N r K:ℕ} (m:Mixer p n) (Y:OneSilhouette p N r)
    6436 (pop:OneLeafMixture p n N) (μ:Wgt (OneUnit p n N))
    6437 (v:OneStation p n N K pop) (a ε δ τ:ℝ):Prop where
    6438 soft:StatusAnalysis.DualAnalysis.origami p r (oneWisp p Y) δ
    6439 rare:pr (pop.sap μ) (fun i=>¬oneGenericGauze p δ δ Y m K i)≤τ
    6440 zone:pr (oneCirque pop μ) (fun x=> v.genericEligiblePair m x.1 x.2 Y a)≤τ
    6441 haze:0<δ ∧ δ≤ε
    6442
    6443end
    6444end Lax793645.ConstructionData.Frames
    6445end
    6446
    6447section
    6448namespace Lax793645.ConstructionData.Frames
    6449open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6450open StatusAnalysis StatusAnalysis.DualAnalysis Function LinearMap
    6451noncomputable section
    6452set_option backward.isDefEq.respectTransparency false
    6453set_option maxHeartbeats 600000
    6454variable {p : Shape} {n N c R : ℕ}
    6455def OneTesterFree (Y : OneSilhouette p N c) (f : Pulsar p c) : Prop :=
    6456 ∀ l q q' k,oneFromPulse Y f l q k=oneFromPulse Y f l q' k
    6457
    6458end
    6459end Lax793645.ConstructionData.Frames
    6460end
    6461
    6462section
    6463namespace Lax793645.ConstructionData.Frames
    6464open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6465open StatusAnalysis StatusAnalysis.DualAnalysis Club Guild Function LinearMap Finset Matrix Submodule
    6466open scoped BigOperators Classical
    6467noncomputable section
    6468set_option backward.isDefEq.respectTransparency false
    6469set_option maxHeartbeats 1000000
    6470variable {p : Shape} {n N r K c R : ℕ} {d e : Rates}
    6471variable {u : Terrain p r} {s : Gazette p r d} {t : Gazette p r e}
    6472variable {β δ η : ℝ}
    6473open OneAppearance
    6474def OneFullStatusSupport (Y : OneSilhouette p N r) (m : Mixer p n)
    6475 (o : OneUnit p n N) : Prop :=
    6476 ∀ d : Rates, ∀ v : Charts p n d, ∀ i (x : Appearance p), x.apt →
    6477 ∀ c, 0 < oneReference x Y c → ∀ w, 0 < oneWake p Y m o v i x c w →
    6478 0 < oneWake p Y m o v i {x with f := Flavor.full} c w
    6479
    6480
    6481end
    6482end Lax793645.ConstructionData.Frames
    6483end
    6484
    6485section
    6486namespace Lax793645.ConstructionData.Frames
    6487open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6488noncomputable section
    6489open Filter Matrix Module LinearMap Finset Function
    6490open scoped BigOperators Topology
    6491open Template
    6492open StatusAnalysis
    6493namespace OneExactOptions
    6494open PreparationParameters OneStation PredictionClass Club Guild DualAnalysis
    6495variable {p : Shape} {n N M r s0 K coords : ℕ} {w:OneLeafMixture p n N} {b:PreparationParameters}
    6496def witnessed (w : OneLeafMixture p n N) (v : OneStation p n N K w) (L : OneLoupe w K)
    6497 (m : Mixer p n) (Y : OneSilhouette p N r) (H : Space (OneJointKey p N))
    6498 (B : ℕ) (cat : Nodes→ Pulsar p r) (x : OneAspect w) :=
    6499 OnePaletteGood H x.2 ∧ ExactAnnounced (oneWisp p Y)
    6500 (oneWake p Y m x.2 (oneRouteC L v x)) cat B
    6501
    6502end OneExactOptions
    6503end
    6504end Lax793645.ConstructionData.Frames
    6505end
    6506
    6507section
    6508namespace Lax793645.ConstructionData.Frames
    6509open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6510open StatusAnalysis Matrix Submodule LinearMap
    6511open scoped BigOperators
    6512noncomputable section
    6513variable {d e : ℕ}
    6514abbrev PredictedTriple := F × F × F
    6515
    6516def predictedGenerator (α β : F) (X : Cell d) (Y : Cell e)
    6517 (r : PredictedTriple) (u : Par d) (v : Par e) : Signal d e :=
    6518 (r.1,(u,dotProduct X u.2+α* u.1+r.2.1),(v,dotProduct Y v.2+β* v.1+r.2.2))
    6519
    6520def predictedSpan (α β : F) (X : Cell d) (Y : Cell e) (R : Set PredictedTriple) :
    6521 Space (Signal d e) :=
    6522 Submodule.span F {s | ∃ r ∈ R, ∃ u v, s=predictedGenerator α β X Y r u v}
    6523
    6524end
    6525end Lax793645.ConstructionData.Frames
    6526end
    6527
    6528section
    6529namespace Lax793645.ConstructionData.Frames
    6530open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6531open StatusAnalysis StatusAnalysis.DualAnalysis PredictionClass
    6532open Finset Matrix Function
    6533open scoped BigOperators
    6534noncomputable section
    6535variable {p : Shape} {n N r : ℕ} {A B : Rates}
    6536def retainedPatterns (u : Terrain p r) (f : Bool → Pulsar p r) (η : ℝ)
    6537 (i : Grid) : Set PredictedTriple :=
    6538 {v | ∃ (l : Tag p.g) (k : Fin r), η ≤ u l v.1 k ∧
    6539 v.2.1=f i.1 l v.1 k ∧ v.2.2=f i.2 l v.1 k}
    6540
    6541end
    6542end Lax793645.ConstructionData.Frames
    6543end
    6544
    6545section
    6546namespace Lax793645.ConstructionData.Frames
    6547open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6548open StatusAnalysis StatusAnalysis.DualAnalysis PredictionClass Template
    6549open Finset Matrix Function
    6550open scoped BigOperators
    6551noncomputable section
    6552variable {p : Shape} {N r : ℕ}
    6553def predictorCellCount : ℕ := Fintype.card (F×F)
    6554
    6555def predictorPulse (c : PredictionClass) : Bool → Pulsar p predictorCellCount :=
    6556 fun i _ _ k => if c=dusk then 0 else if i then
    6557 ((Fintype.equivFin (F×F)).symm k).1 else ((Fintype.equivFin (F×F)).symm k).2
    6558
    6559end
    6560end Lax793645.ConstructionData.Frames
    6561end
    6562
    6563section
    6564namespace Lax793645.ConstructionData.Frames
    6565open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6566open StatusAnalysis Filter Finset Function
    6567open scoped Classical BigOperators
    6568noncomputable section
    6569set_option backward.isDefEq.respectTransparency false
    6570variable {p:Shape} {N r s:ℕ} {I J:Type} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J]
    6571structure OnePaint (t:Tagging p I) (N:ℕ) where
    6572 coeff:ℝ
    6573 flies:∀ i,OneAtomKey (p:=p) (t i) N→ Prop
    6574
    6575def oneMural {t:Tagging p I} (F:J→ OnePaint t N):Wgt (OneKeys t N):=
    6576 fun x=>∑ j,(F j).coeff*∏ i,ind ((F j).flies i (x i))
    6577
    6578def OneDesign (t:Tagging p I) (W:Wgt (OneKeys t N)) (k:ℕ):Prop:=
    6579 ∃ F:Fin k→ OnePaint t N,W=oneMural F ∧ ∀ j,|(F j).coeff|≤1
    6580
    6581end
    6582end Lax793645.ConstructionData.Frames
    6583end
    6584
    6585section
    6586namespace Lax793645.ConstructionData.Frames
    6587open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6588open StatusAnalysis StatusAnalysis.DualAnalysis PredictionClass Template Filter
    6589open Finset Matrix Function
    6590open scoped BigOperators Classical
    6591noncomputable section
    6592set_option backward.isDefEq.respectTransparency false
    6593variable {p:Shape} {N r:ℕ}
    6594def onePreparedPredictor (c:PredictionClass) (g:Bool→ OneAugur p N):Bool→ OneAugur p N:=
    6595 if c=dusk then 0 else g
    6596
    6597def onePredictorPartition (c:PredictionClass) (g:Bool→ OneAugur p N):
    6598 OneSilhouette p N predictorCellCount:=
    6599 fun l q k=> Fintype.equivFin (F×F)
    6600 (onePreparedPredictor c g true l q k,onePreparedPredictor c g false l q k)
    6601
    6602end
    6603end Lax793645.ConstructionData.Frames
    6604end
    6605
    6606section
    6607namespace Lax793645.ConstructionData.Frames
    6608open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6609open StatusAnalysis StatusAnalysis.DualAnalysis PredictionClass
    6610open Matrix Finset Function LinearMap Module
    6611open scoped BigOperators Classical
    6612noncomputable section
    6613set_option backward.isDefEq.respectTransparency false
    6614variable {p:Shape} {n N r:ℕ} {A B:Rates}
    6615def oneCoordSpec (m:OneUnit p n N→ Bool→ Profile p n) (o:OneUnit p n N)
    6616 (s:Charts p n A) (g:∀ i,Cell (A i)):=∀ i,s i (g i)=m o i
    6617
    6618def oneCardTone (m:OneUnit p n N→ Bool→ Profile p n) (x:OneUnit p n N)
    6619 (T:OneCross p n) (j:Bool):F:=∑ i:Bool,oneContract T i j (m x i)
    6620
    6621end
    6622end Lax793645.ConstructionData.Frames
    6623end
    6624
    6625section
    6626namespace Lax793645.ConstructionData.Frames
    6627open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6628open StatusAnalysis OneAppearance Template Filter Finset Matrix Function
    6629open scoped BigOperators Topology Classical
    6630noncomputable section
    6631set_option backward.isDefEq.respectTransparency false
    6632namespace OneQuill
    6633variable {p:Shape} {q:Format} {d:Rates} {b:Bool} {n N K r:ℕ}
    6634variable (w:Quill p q d b) (t:Tagging p (Messenger q)) (z:Messenger q→ F)
    6635def oneBaseDeposit (m:Mixer p n) (o:OneUnit p n N) (s:Charts p n d)
    6636 (x:Inputs p n (Messenger q)):Prop:=
    6637 (∀ i,w.sameInk i (onePrinted b s t w.sel w.flav m o x i)) ∧
    6638 ((w.pen t).draw x).reads (reducedScript w.script) m ∧
    6639 oneOwnKeyPart t z (oneVolleyKeys ((w.pen t).draw x) t o)
    6640
    6641def oneBaseProwl (s:Charts p n d) (m:Mixer p n) (o:OneUnit p n N)
    6642 (W:Wgt (OneKeys t N)):=
    6643 avg ((w.pen t).state z n) (fun x=> ind (oneBaseDeposit w t z m o s x)*
    6644 W (oneVolleyKeys ((w.pen t).draw x) t o))
    6645
    6646structure OneBaseSteady (m:Mixer p n) (K:ℕ) (s:Charts p n d)
    6647 (o:OneUnit p n N):Prop where
    6648 frame:∀ i,oneFrameLaw m (o i)
    6649 steadyAxes (i:Messenger q):Quill.prelim (b:=b) K s i
    6650 enough (i:Messenger q):(w.amp i).1.diagO=(w.amp i).2.1.1
    6651 generic:oneGeneric w
    6652
    6653def oneDilate (K:ℕ):=oneKappa (w.pen t)*(basebeta p K/2)^Fintype.card (Messenger q)
    6654
    6655end OneQuill
    6656end
    6657end Lax793645.ConstructionData.Frames
    6658end
    6659
    6660section
    6661namespace Lax793645.ConstructionData.Frames
    6662open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6663open StatusAnalysis Filter Finset Function
    6664open scoped Classical Topology BigOperators
    6665noncomputable section
    6666set_option backward.isDefEq.respectTransparency false
    6667namespace OneQuill
    6668variable {p:Shape} {q:Format} {d:Rates} {b:Bool} {K s0:ℕ}
    6669def OneBaseSober {n N:ℕ} (w:Quill p q d b) (t:Tagging p (Messenger q))
    6670 (z:Messenger q→ F) (K:ℕ) (H:OneKeys t N→ Prop) (m:Mixer p n) (α:ℝ)
    6671 (o:OneUnit p n N):=
    6672 ∀ s:Charts p n d,OneBaseSteady w m K s o →
    6673 α≤ oneBaseProwl w t z s m o (fun k=> ind (H k))
    6674
    6675end OneQuill
    6676end
    6677end Lax793645.ConstructionData.Frames
    6678end
    6679
    6680section
    6681namespace Lax793645.ConstructionData.Binary
    6682noncomputable section
    6683namespace HadwigerCounterexample
    6684open HadwigerMatching Real Filter
    6685def ord (g N : ℕ) := (2:ℕ)^(1000* g* N)
    6686
    6687end HadwigerCounterexample
    6688end
    6689end Lax793645.ConstructionData.Binary
    6690end
    6691
    6692section
    6693namespace Lax793645.ConstructionData.Frames
    6694open Lax793645.ConstructionData.Binary Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6695open Matrix Filter Finset PreparationParameters
    6696open scoped BigOperators Topology
    6697noncomputable section
    6698set_option backward.isDefEq.respectTransparency false
    6699namespace OneConstruction
    6700variable {p:Shape} {n N M s0:ℕ} {b:PreparationParameters}
    6701def conflictLowerBound (m:Mixer p n) (N:ℕ) (b:PreparationParameters):=
    6702 ∀ w:Wgt (OneUnit p n N),OneNascent b m w →
    6703 carried w (fun x=>(oneRawHoles m).unit (x true,x false)) →
    6704 bp (-200*(2* N:ℝ))≤ pr (pairW w w) (oneClash m)
    6705
    6706open HadwigerMatching
    6707end OneConstruction
    6708end
    6709end Lax793645.ConstructionData.Frames
    6710end
    6711
    6712namespace Lax793645.ConstructionData.Frames
    6713open Lax793645.ConstructionData.Binary.HadwigerCounterexample
    6714open StatusAnalysis StatusAnalysis.Guild Finset Function
    6715noncomputable section
    6716variable {I : Grid → Type} [∀ i,DecidableEq (I i)] {A B : Rates} {b j : ℕ}
    6717def congressDirections (C : Congress I A B (Label b)) (side : Bool) (k : Σ i,I i) :=
    6718 selV j ((C k.1).addr k.2 side)
    6719
    6720structure IndependentParade (C : Congress I A B (Label b))
    6721 (U : Bool → Space (Vec (SelIdx b j))) (s : Straps (Label b))
    6722 (target : ∀ i,Suite A B i) (g : Bags I) (p : Finset Grid) : Prop where
    6723 batch (i) (h : i∈p) : (C i).bundle (g i) s ∧
    6724 (C i).contents (g i)=target i ∧ 1 ≤ (g i).card ∧ (g i).card ≤ 7
    6725 independent : ∀ side,LinearIndepOn F ((U side).mkQ ∘ congressDirections C side)
    6726 (p.sigma g : Set (Σ i,I i))
    6727
    6728end
    6729end Lax793645.ConstructionData.Frames
    6730

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…