Sync from openai/math@faee2cf485a8 (part 9)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- lean/OAI/Combinatorics/HadwigerCounterexample/AdaptiveProjectionBounds.lean+124-124
- lean/OAI/Combinatorics/HadwigerCounterexample/AdaptiveRecordBounds.lean+102-102
- lean/OAI/Combinatorics/HadwigerCounterexample/AdditionalProbeBounds.lean+171-171
- lean/OAI/Combinatorics/HadwigerCounterexample/AffineFrames.lean+195-195
- lean/OAI/Combinatorics/HadwigerCounterexample/AggregateCostBounds.lean+124-124
- lean/OAI/Combinatorics/HadwigerCounterexample/AmbientBatchSlots.lean+211-211
- lean/OAI/Combinatorics/HadwigerCounterexample/AnalyticParameters.lean+143-143
- lean/OAI/Combinatorics/HadwigerCounterexample/AtomFlavors.lean+148-148
- lean/OAI/Combinatorics/HadwigerCounterexample/AttackCutDecomposition.lean+277-277
- lean/OAI/Combinatorics/HadwigerCounterexample/BaselineExtension.lean+124-124
- lean/OAI/Combinatorics/HadwigerCounterexample/BaselineForms.lean+147-147
- lean/OAI/Combinatorics/HadwigerCounterexample/BasisConditioning.lean+113-113
- lean/OAI/Combinatorics/HadwigerCounterexample/BatchCharacters.lean+153-153
- lean/OAI/Combinatorics/HadwigerCounterexample/BiasedRotationBounds.lean+142-142
- lean/OAI/Combinatorics/HadwigerCounterexample/BilinearBlockCorrelation.lean+107-107
- lean/OAI/Combinatorics/HadwigerCounterexample/BilinearCompression.lean+126-126
- lean/OAI/Combinatorics/HadwigerCounterexample/BinaryEvaluationForms.lean+174-174
- lean/OAI/Combinatorics/HadwigerCounterexample/BinaryMatrices.lean+125-125
- lean/OAI/Combinatorics/HadwigerCounterexample/BinaryMixingBounds.lean+106-106
- lean/OAI/Combinatorics/HadwigerCounterexample/BinaryPrescriptions.lean+265-265
- lean/OAI/Combinatorics/HadwigerCounterexample/BinaryStatusComparison.lean+143-143
- lean/OAI/Combinatorics/HadwigerCounterexample/BooleanLabels.lean+151-151
- lean/OAI/Combinatorics/HadwigerCounterexample/BoundedQueryTemplates.lean+134-134
- lean/OAI/Combinatorics/HadwigerCounterexample/CellPositivityScales.lean+177-177
- lean/OAI/Combinatorics/HadwigerCounterexample/CellPruning.lean+128-128
- lean/OAI/Combinatorics/HadwigerCounterexample/ChannelFactorization.lean+144-144
- lean/OAI/Combinatorics/HadwigerCounterexample/ChannelFrameLaws.lean+186-186
- lean/OAI/Combinatorics/HadwigerCounterexample/CollisionInequality.lean+204-204
- lean/OAI/Combinatorics/HadwigerCounterexample/CommonPartitionRefinement.lean+79-79
- lean/OAI/Combinatorics/HadwigerCounterexample/CommonPartitions.lean+119-119
- lean/OAI/Combinatorics/HadwigerCounterexample/CommonPredictions.lean+112-112
- lean/OAI/Combinatorics/HadwigerCounterexample/CompatibleOptionRealization.lean+130-130
- lean/OAI/Combinatorics/HadwigerCounterexample/CompatiblePairTests.lean+105-105
- lean/OAI/Combinatorics/HadwigerCounterexample/CompatibleTableEvents.lean+149-149
- lean/OAI/Combinatorics/HadwigerCounterexample/ComponentIndices.lean+115-115
- lean/OAI/Combinatorics/HadwigerCounterexample/ConcentrationScales.lean+169-169
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalCellEntropy.lean+156-156
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalFlags.lean+107-107
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalFourCorners.lean+101-101
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalLargeSetHits.lean+106-106
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalProductLaws.lean+125-125
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalProjection.lean+96-96
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalSignaturePositivity.lean+110-110
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionedBatchLaws.lean+198-198
- lean/OAI/Combinatorics/HadwigerCounterexample/ConditionedCorrelations.lean+97-97
- lean/OAI/Combinatorics/HadwigerCounterexample/ConstructionScales.lean+100-100
- lean/OAI/Combinatorics/HadwigerCounterexample/CoordinateBlocks.lean+147-147
- lean/OAI/Combinatorics/HadwigerCounterexample/CoordinateDuality.lean+87-87
- lean/OAI/Combinatorics/HadwigerCounterexample/CoordinateEmbeddings.lean+163-163
- lean/OAI/Combinatorics/HadwigerCounterexample/CoverAlternatives.lean+86-86
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124import OAI.Combinatorics.HadwigerCounterexample.KeyProjectionBounds
namespace OAI
/-! # Adaptive Projection Bounds -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Matrix
open scoped BigOperators Topology
open Template
namespace StatusAnalysis
variable {p:Shape} {n N K M r z s0:ℕ} {q:Format} {d e:Rates} {b:Bool}
private theorem avg_side_bounds {A : Type} [Fintype A] (w : Wgt A) (hw:IsLaw w)
(b:Bool) (f : Wgt A) (F:A×A→ℝ) (h:∀ i,F i≤f (onSide i b)) :
avg (pairW w w) F≤avg w f := by
apply (avg_mono (pairW_law hw hw).nz h).trans
cases b
· rw [pairW_avg]
simp [onSide,hw.avg_const]
rw [pairW_avg]; simp only [onSide,ite_true,hw.avg_const]; rfl
namespace Quill
variable (w:Quill p q d b)
(m:Mixer p n) (t:Tagging p (Messenger q)) (φ:Messenger q→F)
(u:LeafMixture p n N) (Y:Silhouette p N r)
set_option maxHeartbeats 1200000 in
theorem oneTrestle (omega_:Wgt u.T) (hv:IsLaw omega_) (s:u.T→ Charts p n d)
(μ:u.T→Wgt (UnitType p n N)) (hμ:∀ i,IsLaw (μ i))
(P : Keys (p:=p) t N→ Fin z) (F:u.T×u.T → UnitType p n N→Prop)
(hF : ∀ i o,F i o→PreparationParameters.frameSide p m o)
(hw:∀ i,IsLaw (w.policies t φ n i)) (hν:IsLaw (lawNu p N t φ))
(ε v A B:ℝ) (he:0≤ε)
(ha:∀ i:Fin z,
pr (mixW omega_ μ) (w.flunk t φ Y (fun x=>ind (P x=i)) m v ε) ≤ A)
(hh: pr (mixW omega_ μ) (fun x=>¬ w.matchesArea t φ Y x v)≤B) :
let L (i:u.T×u.T):=onSide i b
avg (pairW omega_ omega_) (fun i=>varOne (mapW (w.displayMass t φ (μ (L i)) (F i) m (s (L i)) Y) P)
(mapW (w.sales t φ (μ (L i)) (F i) m (s (L i))) P)) ≤ z*(ε+2*(A+B)) := by
classical
intro L
let Q (i:u.T×u.T) (x:Fin z):=
|mapW (w.displayMass t φ (μ (L i)) (F i) m (s (L i)) Y) P x-
mapW (w.sales t φ (μ (L i)) (F i) m (s (L i))) P x|
let V:= pairW omega_ omega_
have h (x : Fin z) :
avg V (fun i=>Q i x) ≤ ε+ 2*(A+B) := by
let H k:= P k=x
let R:= w.flunk t φ Y (fun i=>ind (H i)) m v ε
let Z (i:UnitType p n N):= ¬ w.matchesArea t φ Y i v
let S o:=R o∨ Z o
have heq (i): Q i x≤ ε+2*pr (μ (L i)) S := by
refine w.display_test t φ (μ (L i)) (F i) m (s (L i)) Y H (hμ _) hw hν S he
(fun y hy hz=> ?_)
by_cases hf :Z y
· exact Or.inr hf
exact Or.inl ⟨hF _ _ hy,not_not.mp hf,s (L i),hz⟩
let U:=mixW omega_ μ
have hu : IsLaw U:=mixW_law hv hμ
have hm (o) : avg omega_ (fun i=>pr (μ i) o)= pr U o := (mixW_avg ..).symm
apply (avg_side_bounds omega_ hv b (fun i=>ε+2*pr (μ i) S) _ heq).trans
rw [avg_add,avg_mul',hm,hv.avg_const]
exact add_le_add_right (mul_le_mul_of_nonneg_left ((pr_or_le hu.nz).trans
(add_le_add (ha _) hh)) (by norm_num)) _
change avg V (fun x=> ∑ i,Q x i) ≤ _
rw [avg_sum]; exact (Finset.sum_le_sum fun i _=> h i).trans_eq (by simp; ring)
end Quill
open Station PreparationParameters
namespace Station
variable {w:LeafMixture p n N} (t:Station p n N K w)
(x:Typus p q d e) (m:Mixer p n) (k: Fin (2^deckMax p K))
(μ:Wgt (UnitType p n N)) (Y:Silhouette p N r)
theorem gauzed_area (Y:Silhouette p N r) (w : Quill p q d b)
(t: Tagging p (Messenger q)) (u : Messenger q → F)
(h:w.moral t u) (δ:ℝ)
{K : ℕ} {m:Mixer p n} {ε v:ℝ} (he:ε≤v)
(o : UnitType p n N) (hc:gauze p ε δ Y m K o) :
w.matchesArea t u Y o v := by
intro i; have heq := w.allure_apt t u h i
exact ((hc _ (w.allure t u i)).1 heq).trans he
set_option maxHeartbeats 1200000 in
theorem projectSum (P : Keys (p:=p) x.t N→Fin z)
(h :apart w.T) (hm:IsLaw μ) (hw :∀ i∈w.T,0<partMass μ i) (hs : 0<w.amount μ)
(ha : ∀ i,IsLaw (x.qA.policies x.t x.z n i)) (hb:∀ i,IsLaw (x.qB.policies x.t x.z n i))
(hν : IsLaw (lawNu p N x.t x.z)) (ε v v' τ B δ : ℝ) (he:0≤ε)
(hf : x.permission)
(ht : τ ≤ v ∧ τ≤v')
(hh : pr (w.sap μ) (fun i=>¬gauze p τ δ Y m K i)≤B)
(hx : ∀ i:Fin z,pr (w.sap μ) (x.qA.flunk x.t x.z Y (fun y=>ind (P y=i)) m v ε)≤B)
(hy : ∀ i:Fin z,pr (w.sap μ) (x.qB.flunk x.t x.z Y (fun y=>ind (P y=i)) m v' ε)≤B) :
t.due x m μ k Y P≤2*(z*(ε+2*(B+B))) := by
classical
obtain ⟨hp,hq⟩:=rebuild hm.nz h hw hs
let A (i:w.T):=partW μ i.val
let u:=portionW μ w.T
have hQ : w.sap μ=mixW u A :=hq
let V:=pairW u u; have hA i:IsLaw (A i):=on_law hm.nz (hw i.val i.property)
have hL : avg V (fun i=> taxLeft t x m μ k Y P i.1 i.2) ≤ z*(ε+2*(B+B)) := by
refine x.qA.oneTrestle m x.t x.z w Y u hp (fun i=>t.cAxes i d) A hA P
(fun i=> t.frontPage x m i.1 i.2 k) (fun i o h => h.2.2.1) ha hν ε v B B he
(fun i=>by rw [←hQ]; exact hx i) ?_
rw [←hQ]; apply (pr_mono (LeafMixture.sapLaw hs hm).nz ?_).trans hh
exact fun i hi h=> hi (gauzed_area _ _ _ _ hf.2.1 δ ht.1 i h)
have hR : avg V (fun i=> taxRight t x m μ k Y P i.1 i.2) ≤ z*(ε+2*(B+B)) := by
refine x.qB.oneTrestle m x.t x.z w Y u hp (fun i=>t.cAxes i e) A hA P
(fun i=> t.backPage x m i.1 i.2 k) (fun i o h => h.2.2.1) hb hν ε v' B B he
(fun i=>by rw [←hQ]; exact hy i) ?_
rw [←hQ]; apply (pr_mono (LeafMixture.sapLaw hs hm).nz ?_).trans hh
exact fun i hi h=>hi (gauzed_area _ _ _ _ hf.2.2.1 δ ht.2 i h)
unfold due; rw [avg_add,two_mul]
exact add_le_add hL hR
end Station
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.KeyProjectionBounds
namespace OAI
/-! # Adaptive Projection Bounds -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Matrixopen scoped BigOperators Topologyopen Templatenamespace StatusAnalysisvariable {p:Shape} {n N K M r z s0:ℕ} {q:Format} {d e:Rates} {b:Bool}
private theorem avg_side_bounds {A : Type} [Fintype A] (w : Wgt A) (hw:IsLaw w) (b:Bool) (f : Wgt A) (F:A×A→ℝ) (h:∀ i,F i≤f (onSide i b)) : avg (pairW w w) F≤avg w f := by apply (avg_mono (pairW_law hw hw).nz h).trans cases b · rw [pairW_avg] simp [onSide,hw.avg_const] rw [pairW_avg]; simp only [onSide,ite_true,hw.avg_const]; rfl
namespace Quillvariable (w:Quill p q d b) (m:Mixer p n) (t:Tagging p (Messenger q)) (φ:Messenger q→F) (u:LeafMixture p n N) (Y:Silhouette p N r)
set_option maxHeartbeats 1200000 intheorem oneTrestle (omega_:Wgt u.T) (hv:IsLaw omega_) (s:u.T→ Charts p n d) (μ:u.T→Wgt (UnitType p n N)) (hμ:∀ i,IsLaw (μ i)) (P : Keys (p:=p) t N→ Fin z) (F:u.T×u.T → UnitType p n N→Prop) (hF : ∀ i o,F i o→PreparationParameters.frameSide p m o) (hw:∀ i,IsLaw (w.policies t φ n i)) (hν:IsLaw (lawNu p N t φ)) (ε v A B:ℝ) (he:0≤ε) (ha:∀ i:Fin z, pr (mixW omega_ μ) (w.flunk t φ Y (fun x=>ind (P x=i)) m v ε) ≤ A) (hh: pr (mixW omega_ μ) (fun x=>¬ w.matchesArea t φ Y x v)≤B) : let L (i:u.T×u.T):=onSide i b avg (pairW omega_ omega_) (fun i=>varOne (mapW (w.displayMass t φ (μ (L i)) (F i) m (s (L i)) Y) P) (mapW (w.sales t φ (μ (L i)) (F i) m (s (L i))) P)) ≤ z*(ε+2*(A+B)) := by classical intro L let Q (i:u.T×u.T) (x:Fin z):= |mapW (w.displayMass t φ (μ (L i)) (F i) m (s (L i)) Y) P x- mapW (w.sales t φ (μ (L i)) (F i) m (s (L i))) P x| let V:= pairW omega_ omega_ have h (x : Fin z) : avg V (fun i=>Q i x) ≤ ε+ 2*(A+B) := by let H k:= P k=x let R:= w.flunk t φ Y (fun i=>ind (H i)) m v ε let Z (i:UnitType p n N):= ¬ w.matchesArea t φ Y i v let S o:=R o∨ Z o have heq (i): Q i x≤ ε+2*pr (μ (L i)) S := by refine w.display_test t φ (μ (L i)) (F i) m (s (L i)) Y H (hμ _) hw hν S he (fun y hy hz=> ?_) by_cases hf :Z y · exact Or.inr hf exact Or.inl ⟨hF _ _ hy,not_not.mp hf,s (L i),hz⟩ let U:=mixW omega_ μ have hu : IsLaw U:=mixW_law hv hμ have hm (o) : avg omega_ (fun i=>pr (μ i) o)= pr U o := (mixW_avg ..).symm apply (avg_side_bounds omega_ hv b (fun i=>ε+2*pr (μ i) S) _ heq).trans rw [avg_add,avg_mul',hm,hv.avg_const] exact add_le_add_right (mul_le_mul_of_nonneg_left ((pr_or_le hu.nz).trans (add_le_add (ha _) hh)) (by norm_num)) _ change avg V (fun x=> ∑ i,Q x i) ≤ _ rw [avg_sum]; exact (Finset.sum_le_sum fun i _=> h i).trans_eq (by simp; ring)end Quill
open Station PreparationParametersnamespace Stationvariable {w:LeafMixture p n N} (t:Station p n N K w) (x:Typus p q d e) (m:Mixer p n) (k: Fin (2^deckMax p K)) (μ:Wgt (UnitType p n N)) (Y:Silhouette p N r)
theorem gauzed_area (Y:Silhouette p N r) (w : Quill p q d b) (t: Tagging p (Messenger q)) (u : Messenger q → F) (h:w.moral t u) (δ:ℝ) {K : ℕ} {m:Mixer p n} {ε v:ℝ} (he:ε≤v) (o : UnitType p n N) (hc:gauze p ε δ Y m K o) : w.matchesArea t u Y o v := by intro i; have heq := w.allure_apt t u h i exact ((hc _ (w.allure t u i)).1 heq).trans he
set_option maxHeartbeats 1200000 intheorem projectSum (P : Keys (p:=p) x.t N→Fin z) (h :apart w.T) (hm:IsLaw μ) (hw :∀ i∈w.T,0<partMass μ i) (hs : 0<w.amount μ) (ha : ∀ i,IsLaw (x.qA.policies x.t x.z n i)) (hb:∀ i,IsLaw (x.qB.policies x.t x.z n i)) (hν : IsLaw (lawNu p N x.t x.z)) (ε v v' τ B δ : ℝ) (he:0≤ε) (hf : x.permission) (ht : τ ≤ v ∧ τ≤v') (hh : pr (w.sap μ) (fun i=>¬gauze p τ δ Y m K i)≤B) (hx : ∀ i:Fin z,pr (w.sap μ) (x.qA.flunk x.t x.z Y (fun y=>ind (P y=i)) m v ε)≤B) (hy : ∀ i:Fin z,pr (w.sap μ) (x.qB.flunk x.t x.z Y (fun y=>ind (P y=i)) m v' ε)≤B) : t.due x m μ k Y P≤2*(z*(ε+2*(B+B))) := by classical obtain ⟨hp,hq⟩:=rebuild hm.nz h hw hs let A (i:w.T):=partW μ i.val let u:=portionW μ w.T have hQ : w.sap μ=mixW u A :=hq let V:=pairW u u; have hA i:IsLaw (A i):=on_law hm.nz (hw i.val i.property) have hL : avg V (fun i=> taxLeft t x m μ k Y P i.1 i.2) ≤ z*(ε+2*(B+B)) := by refine x.qA.oneTrestle m x.t x.z w Y u hp (fun i=>t.cAxes i d) A hA P (fun i=> t.frontPage x m i.1 i.2 k) (fun i o h => h.2.2.1) ha hν ε v B B he (fun i=>by rw [←hQ]; exact hx i) ?_ rw [←hQ]; apply (pr_mono (LeafMixture.sapLaw hs hm).nz ?_).trans hh exact fun i hi h=> hi (gauzed_area _ _ _ _ hf.2.1 δ ht.1 i h) have hR : avg V (fun i=> taxRight t x m μ k Y P i.1 i.2) ≤ z*(ε+2*(B+B)) := by refine x.qB.oneTrestle m x.t x.z w Y u hp (fun i=>t.cAxes i e) A hA P (fun i=> t.backPage x m i.1 i.2 k) (fun i o h => h.2.2.1) hb hν ε v' B B he (fun i=>by rw [←hQ]; exact hy i) ?_ rw [←hQ]; apply (pr_mono (LeafMixture.sapLaw hs hm).nz ?_).trans hh exact fun i hi h=>hi (gauzed_area _ _ _ _ hf.2.2.1 δ ht.2 i h) unfold due; rw [avg_add,two_mul] exact add_le_add hL hR
end Stationend StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102import OAI.Combinatorics.HadwigerCounterexample.IndependentTestWitnesses
namespace OAI
/-! # Adaptive Record Bounds -/
noncomputable section
namespace HadwigerCounterexample
open Matrix LinearMap Module Submodule Function Finset
open scoped BigOperators
variable {p : Shape} {n N r : ℕ} {T : Cov p N}
def quest (p : Shape) (r k n N : ℕ) (H ε : ℝ) :=
∀ x : ℕ,x≤2*r →
bp ((x:ℝ)*N)*bp (0.51*k*N)*(H*heatRate p n N ε x k)≤bp (-0.2*N)
namespace Bazaar
variable (s : Bazaar p n r T)
set_option maxHeartbeats 800000 in
private theorem probe_event {w : Wgt (UnitType p n N)} {Δ}
(hw : IsLaw w) (h : s.opened Δ w)
(S : Party) (j : Bool) (hi : S j=1) {k : ℕ}
{q : Place p→ℕ} (R : DTuple (p:=p) q N) (F : Catalog p T r q)
(hq : ctot p q=k) (hr : ∀ M Z,(↑(F M Z).card:ℝ) ≤ bp (0.51*k*N))
(m : Mixer p n) {ε H : ℝ} (he₀ : initCap p N m ε) (hH : 0≤H) (hZ : quest p r k n N H ε)
(hg : ∀ x,w x≤H*pairW (raw m N) (raw m N) x)
(hT : num (Atlas p r T) ≤ bp (0.002*N)) :
pr w (fun x => s.atList S j R F x ∧ glimpse p x j R) ≤ bp (-0.1*N) := by
classical
let P (M : Atlas p r T) (z : Batch M N) (v : DTuple (p:=p) q N) :=
fun x => basisFrom p (x : UnitType p n N) j z ∧ glimpse p x j R ∧ thermal p x S R=v
let L (M : Atlas p r T) (x) := standard M ∧ ∃ z,∃ v∈ F M z,P M z v x
have he x : w x≠0 → s.atList S j R F x ∧ glimpse p x j R →
∃ M,L M x := by
rintro hx ⟨hx',hy⟩
exact ⟨s.ix x,(h x hx).1,s.bag (s.ix x) j x, thermal p x S R,hx',
((h x hx).2 j).1,hy,rfl⟩
have ht (M : Atlas p r T) : pr w (L M) ≤ bp (-0.2*N) := by
by_cases hu : standard M
· let x := cells M
have hb (z : Batch M N) :
pr w (fun y => ∃ v∈F M z,P M z v y) ≤ bp (0.51*k*N)*(H*heatRate p n N ε x k) := by
have ha v : pr w (P M z v) ≤ H*heatRate p n N ε x k := by
rw [← hq]; exact (pr_cap hg _).trans
(mul_le_mul_of_nonneg_left (heat_rate _ S hi R v z m he₀) hH)
refine (pr_union_le hw.nz (F M z) (P M z)).trans ((Finset.sum_le_sum fun v _ => ha v).trans ?_)
rw [Finset.sum_const,nsmul_eq_mul]
apply mul_le_mul_of_nonneg_right (hr M z)
unfold heatRate
exact mul_nonneg hH (mul_nonneg (bp_pos _).le (bp_pos _).le)
simp only [L,hu,true_and]
refine (pr_exists_le hw.nz (fun z y => ∃ v∈F M z,P M z v y)).trans
((Finset.sum_le_sum (fun z _ => hb z)).trans ?_)
simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,card_space]
rw [show dim (Batch M N)=x*N from tuple_dim.trans (Nat.mul_comm ..),
Nat.cast_mul, ← mul_assoc]
exact hZ x hu.2.1
simp only [L,hu,false_and,pr_false]
exact (bp_pos _).le
refine ((pr_on_mono hw.nz he).trans (pr_exists_le hw.nz L)).trans
((Finset.sum_le_sum fun i _ => ht i).trans ?_)
rw [Finset.sum_const,nsmul_eq_mul]
apply (mul_le_mul_of_nonneg_right hT (bp_pos _).le).trans
rw [←bp_add]
apply bp_le; linarith [(Nat.cast_nonneg N : 0≤(N:ℝ))]
set_option maxHeartbeats 600000 in
theorem frequent_sparse {w : Wgt (UnitType p n N)} {Δ}
(hw : IsLaw w) (h : s.opened Δ w)
(S : Party) (j : Bool) (hi : S j=1)
(k d : ℕ) (hh : k ≤ d) (l : ℝ) (hl : 0< l)
(hC : ∀ C : Cov p N,cdim p C≤d → pr w (fun x => offsetCov (s.ix x) ≤ C) ≤ l)
(hb : ∀ A M Z,(↑(s.bids w S j A M Z).card:ℝ) ≤ bp (0.51*N))
(m : Mixer p n) {ε H L : ℝ} (hN : 2*num (Full p n)-N≤ -1)
(he : initCap p N m ε)
(hH : 0≤H) (hZ : quest p r k n N H ε)
(hg : ∀ x,w x≤H*pairW (raw m N) (raw m N) x)
(hL : 0 ≤ L) (hv : bySide p w m L)
(hT : num (Atlas p r T) ≤ bp (0.002*N))
(hk : glimpsesBill p k L+bp (-0.1*N)<l^(k+1)) :
pr (pairW w w) (fun x => s.frequent w S j (s.ix x.1) (s.ix x.2) x.2) ≤5*l := by
classical
by_contra! hr
obtain ⟨q,R,F,hq,hR,hF,hx⟩ := s.shooting hw S j k d hh l hl hr.le hC hb
have hp := s.probe_event hw h S j hi R F hq hF m he hH hZ hg hT
have hq' z : q z≤ k := hq ▸ Finset.single_le_sum (fun i _ => Nat.zero_le (q i))
(Finset.mem_univ z)
have hu := glimpse_failure m hL hv hw.sub j hN R k hR hq'
let T := fun (x : UnitType p n N) => glimpse p x j R
let V := s.atList S j R F
have hh' x : V x → ¬T x ∨ (V x ∧ T x) := fun h => by by_cases ht:T x <;> simp [ht,h]
exact not_lt_of_ge
(hx.trans ((pr_mono hw.nz hh').trans ((pr_or_le hw.nz).trans (add_le_add hu hp)))) hk
end Bazaar
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.IndependentTestWitnesses
namespace OAI
/-! # Adaptive Record Bounds -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix LinearMap Module Submodule Function Finsetopen scoped BigOperatorsvariable {p : Shape} {n N r : ℕ} {T : Cov p N}
def quest (p : Shape) (r k n N : ℕ) (H ε : ℝ) := ∀ x : ℕ,x≤2*r → bp ((x:ℝ)*N)*bp (0.51*k*N)*(H*heatRate p n N ε x k)≤bp (-0.2*N)
namespace Bazaarvariable (s : Bazaar p n r T)
set_option maxHeartbeats 800000 inprivate theorem probe_event {w : Wgt (UnitType p n N)} {Δ} (hw : IsLaw w) (h : s.opened Δ w) (S : Party) (j : Bool) (hi : S j=1) {k : ℕ} {q : Place p→ℕ} (R : DTuple (p:=p) q N) (F : Catalog p T r q) (hq : ctot p q=k) (hr : ∀ M Z,(↑(F M Z).card:ℝ) ≤ bp (0.51*k*N)) (m : Mixer p n) {ε H : ℝ} (he₀ : initCap p N m ε) (hH : 0≤H) (hZ : quest p r k n N H ε) (hg : ∀ x,w x≤H*pairW (raw m N) (raw m N) x) (hT : num (Atlas p r T) ≤ bp (0.002*N)) : pr w (fun x => s.atList S j R F x ∧ glimpse p x j R) ≤ bp (-0.1*N) := by classical let P (M : Atlas p r T) (z : Batch M N) (v : DTuple (p:=p) q N) := fun x => basisFrom p (x : UnitType p n N) j z ∧ glimpse p x j R ∧ thermal p x S R=v let L (M : Atlas p r T) (x) := standard M ∧ ∃ z,∃ v∈ F M z,P M z v x have he x : w x≠0 → s.atList S j R F x ∧ glimpse p x j R → ∃ M,L M x := by rintro hx ⟨hx',hy⟩ exact ⟨s.ix x,(h x hx).1,s.bag (s.ix x) j x, thermal p x S R,hx', ((h x hx).2 j).1,hy,rfl⟩ have ht (M : Atlas p r T) : pr w (L M) ≤ bp (-0.2*N) := by by_cases hu : standard M · let x := cells M have hb (z : Batch M N) : pr w (fun y => ∃ v∈F M z,P M z v y) ≤ bp (0.51*k*N)*(H*heatRate p n N ε x k) := by have ha v : pr w (P M z v) ≤ H*heatRate p n N ε x k := by rw [← hq]; exact (pr_cap hg _).trans (mul_le_mul_of_nonneg_left (heat_rate _ S hi R v z m he₀) hH) refine (pr_union_le hw.nz (F M z) (P M z)).trans ((Finset.sum_le_sum fun v _ => ha v).trans ?_) rw [Finset.sum_const,nsmul_eq_mul] apply mul_le_mul_of_nonneg_right (hr M z) unfold heatRate exact mul_nonneg hH (mul_nonneg (bp_pos _).le (bp_pos _).le) simp only [L,hu,true_and] refine (pr_exists_le hw.nz (fun z y => ∃ v∈F M z,P M z v y)).trans ((Finset.sum_le_sum (fun z _ => hb z)).trans ?_) simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,card_space] rw [show dim (Batch M N)=x*N from tuple_dim.trans (Nat.mul_comm ..), Nat.cast_mul, ← mul_assoc] exact hZ x hu.2.1 simp only [L,hu,false_and,pr_false] exact (bp_pos _).le refine ((pr_on_mono hw.nz he).trans (pr_exists_le hw.nz L)).trans ((Finset.sum_le_sum fun i _ => ht i).trans ?_) rw [Finset.sum_const,nsmul_eq_mul] apply (mul_le_mul_of_nonneg_right hT (bp_pos _).le).trans rw [←bp_add] apply bp_le; linarith [(Nat.cast_nonneg N : 0≤(N:ℝ))]
set_option maxHeartbeats 600000 intheorem frequent_sparse {w : Wgt (UnitType p n N)} {Δ} (hw : IsLaw w) (h : s.opened Δ w) (S : Party) (j : Bool) (hi : S j=1) (k d : ℕ) (hh : k ≤ d) (l : ℝ) (hl : 0< l) (hC : ∀ C : Cov p N,cdim p C≤d → pr w (fun x => offsetCov (s.ix x) ≤ C) ≤ l) (hb : ∀ A M Z,(↑(s.bids w S j A M Z).card:ℝ) ≤ bp (0.51*N)) (m : Mixer p n) {ε H L : ℝ} (hN : 2*num (Full p n)-N≤ -1) (he : initCap p N m ε) (hH : 0≤H) (hZ : quest p r k n N H ε) (hg : ∀ x,w x≤H*pairW (raw m N) (raw m N) x) (hL : 0 ≤ L) (hv : bySide p w m L) (hT : num (Atlas p r T) ≤ bp (0.002*N)) (hk : glimpsesBill p k L+bp (-0.1*N)<l^(k+1)) : pr (pairW w w) (fun x => s.frequent w S j (s.ix x.1) (s.ix x.2) x.2) ≤5*l := by classical by_contra! hr obtain ⟨q,R,F,hq,hR,hF,hx⟩ := s.shooting hw S j k d hh l hl hr.le hC hb have hp := s.probe_event hw h S j hi R F hq hF m he hH hZ hg hT have hq' z : q z≤ k := hq ▸ Finset.single_le_sum (fun i _ => Nat.zero_le (q i)) (Finset.mem_univ z) have hu := glimpse_failure m hL hv hw.sub j hN R k hR hq' let T := fun (x : UnitType p n N) => glimpse p x j R let V := s.atList S j R F have hh' x : V x → ¬T x ∨ (V x ∧ T x) := fun h => by by_cases ht:T x <;> simp [ht,h] exact not_lt_of_ge (hx.trans ((pr_mono hw.nz hh').trans ((pr_or_le hw.nz).trans (add_le_add hu hp)))) hk
end Bazaar
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171import OAI.Combinatorics.HadwigerCounterexample.SingletonPhaseTests
namespace OAI
/-! # Additional Probe Bounds -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Module Submodule Function Finset
open scoped BigOperators
variable {I J K : Type} [Fintype I] [Fintype J] [Fintype K]
private def moreMatrix {r : ℕ} (A : Mat I (Fin r)) (v : Vec I) : Mat I (Fin (r+1)) :=
Matrix.of (fun i => Fin.cons (v i) (A i))
omit [Fintype I] in
private theorem moreMatrix_act {r : ℕ} (A : Mat I (Fin r)) (v : Vec I)
(x : Vec (Fin (r+1))) :
moreMatrix A v *ᵥ x=x 0 • v + A *ᵥ (fun i => x i.succ) := by
funext i; simp only [Matrix.mulVec,dotProduct,moreMatrix,Matrix.of_apply,
Fin.sum_univ_succ,Pi.add_apply,Pi.smul_apply,smul_eq_mul,Fin.cons_zero,Fin.cons_succ]
congr 1; exact mul_comm _ _
omit [Fintype I] in
private theorem moreMatrix_inj {r : ℕ} (A : Mat I (Fin r)) (v : Vec I)
(ha : Injective A.mulVec) (h : v∉colSp A) :
Injective (moreMatrix A v).mulVec := by
rw [← Matrix.coe_mulVecLin,← LinearMap.ker_eq_bot, Matrix.ker_mulVecLin_eq_bot_iff]
intro x hx
rw [moreMatrix_act] at hx
let b (i : Fin r) := x i.succ
rcases bit_cases (x 0) with he|he
· have hh : b=0 := by
apply ha
rw [he,zero_smul,zero_add] at hx
exact hx.trans (Matrix.mulVec_zero _).symm
funext i
refine Fin.cases he (fun k => ?_) i
exact congr_fun hh k
· rw [he,one_smul] at hx
have heq : v=A *ᵥ b := add_right_cancel (hx.trans (char_two _).symm)
exact (h ⟨b,heq.symm⟩).elim
omit [Fintype J] in
private theorem moreMatrix_mul {r} (B : Mat J I) (A : Mat I (Fin r)) (v) :
B*moreMatrix A v=moreMatrix (B*A) (B *ᵥ v) := by
ext i j
refine Fin.cases ?_ (fun j => ?_) j
· rfl
simp only [moreMatrix,Matrix.mul_apply,Matrix.of_apply,Fin.cons_succ]
variable {p : Shape} {n N r : ℕ} {T : Cov p N}
variable {q : Place p → ℕ}
private def growFmt (q : Place p→ℕ) (z : Place p) := fun i =>
q i+(if i=z then 1 else 0)
private theorem grow_sum (q : Place p→ℕ) (z : Place p) :
ctot p (growFmt (p:=p) q z)=ctot p q+1 := by simp [growFmt,ctot,Finset.sum_add_distrib]
private def growing (A : DTuple (p:=p) q N) (z : Place p) (v : Vec (Fin N)) :
DTuple (p:=p) (growFmt (p:=p) q z) N := fun i => by
change Mat (Fin N) (Fin (q i+ if i=z then 1 else 0))
by_cases h : i=z
· rw [ite_eq_left h]; exact moreMatrix (A i) v
rw [ite_eq_right h]; exact A i
private theorem castMat_inj {r n m : ℕ} (e : r=n)
(A : Mat (Fin m) (Fin r)) (h : Injective A.mulVec) :
Injective (cast (show Mat (Fin m) (Fin r)=Mat (Fin m) (Fin n) from congrArg (fun t => Mat (Fin m) (Fin t)) e) A).mulVec := by
subst n
exact h
private theorem castMat_prod {r n m : ℕ} (e : r=n)
(A : Mat (Fin m) (Fin r)) (B : Mat (Fin m) (Fin m)) :
B*(cast (show Mat (Fin m) (Fin r)=Mat (Fin m) (Fin n) from congrArg (fun t => Mat (Fin m) (Fin t)) e) A) =
cast (show Mat (Fin m) (Fin r)=Mat (Fin m) (Fin n) from congrArg (fun t => Mat (Fin m) (Fin t)) e) (B*A) := by
subst n; rfl
private theorem growth_inj (A : DTuple (p:=p) q N) (z : Place p) (v : Vec (Fin N))
(hv : v∉colSp (A z)) (h : ∀ i, Injective (A i).mulVec) :
∀ i,Injective (growing A z v i).mulVec := by
intro i
by_cases he : i=z
· subst i
simp [growing,growFmt]
apply castMat_inj _ (moreMatrix (A z) v) (moreMatrix_inj (A z) v (h z) hv)
simp
simp [growing,growFmt,he]
apply castMat_inj _ (A i) (h i)
simp [he]
private theorem growth_value (A : DTuple (p:=p) q N) (z : Place p) (v : Vec (Fin N))
(x : UnitType p n N) (S : Party) :
thermal p x S (growing A z v)=growing (thermal p x S A) z (heat p x S z *ᵥ v) := by
funext i
by_cases he : i=z
· subst i
simp [thermal,growing,growFmt]
rw [←moreMatrix_mul]
apply castMat_prod
simp
simp [thermal,growing,growFmt,he]
apply castMat_prod
simp [he]
theorem column_observe (A : DTuple (p:=p) q N) (z : Place p) (j : Fin (q z))
(x : UnitType p n N) (S : Party) :
heat p x S z *ᵥ (A z).col j=(thermal p x S A z).col j := rfl
namespace Bazaar
variable (s : Bazaar p n r T)
abbrev Catalog (p : Shape) {N} (T : Cov p N) (r : ℕ) (q : Place p→ℕ) :=
(M : Atlas p r T) → Batch M N → Finset (DTuple (p:=p) q N)
def atList (s : Bazaar p n r T) (S : Party) (j : Bool)
(A : DTuple (p:=p) q N) (F : Catalog p T r q) (x : UnitType p n N) :=
let M := s.ix x
thermal p x S A∈ F M (s.bag M j x)
def probed (p : Shape) {N} {q : Place p→ℕ} (A : DTuple (p:=p) q N) : Cov p N :=
fun z => colSp (A z)
theorem extend_probe (w : Wgt (UnitType p n N)) (S : Party) (j : Bool) {k : ℕ}
(A : DTuple (p:=p) q N) (hq : ctot p q=k)
(h : ∀ i, Injective (A i).mulVec)
(F : Catalog p T r q) (hF : ∀ M Z,(↑(F M Z).card:ℝ) ≤ bp (0.51*k*N))
(G : Atlas p r T) (hg : ¬ offsetCov G ≤ probed p A)
(hb : ∀ M Z,(↑(s.bids w S j G M Z).card:ℝ) ≤ bp (0.51*N)) :
∃ (q : Place p→ℕ) (A' : DTuple (p:=p) q N)
(F' : Catalog p T r q), ctot p q=k+1 ∧
(∀ i, Injective (A' i).mulVec) ∧
(∀ M Z,(↑(F' M Z).card:ℝ) ≤ bp (0.51*(k+1)*N)) ∧
∀ x,s.atList S j A F x → s.frequent w S j G (s.ix x) x →
s.atList S j A' F' x := by
classical
obtain ⟨z,i,hg⟩ :
∃ (z : Place p) (i : Fin (breadth G z)),(src G z).col i∉colSp (A z) := by
by_contra! hh
apply hg
intro z
change colSp (src G z) ≤ _
rw [colSp,range_mulVecLin]
exact Submodule.span_le.mpr (Set.range_subset_iff.mpr (hh z))
let q' := growFmt (p:=p) q z
let v := (src G z).col i
let f (M Z) : Finset (DTuple (p:=p) q' N) :=
((F M Z) ×ˢ (s.bids w S j G M Z)).image
(fun a => growing a.1 z ((a.2 z).col i))
refine ⟨q',growing A z v, f,(grow_sum q z).trans (by rw [hq]),
growth_inj A z v hg h,fun M Z => ?_,fun x hx hi => ?_⟩
· have he := bp_pos (0.51*(k:ℝ)*N)
have h1 :
(↑(f M Z).card:ℝ) ≤ (↑(F M Z).card:ℝ)*(↑(s.bids w S j G M Z).card:ℝ) := by
exact_mod_cast (show (f M Z).card ≤ _*_ from
Finset.card_image_le.trans_eq (Finset.card_product ..))
apply (h1.trans (mul_le_mul (hF M Z) (hb M Z) (Nat.cast_nonneg _) he.le)).trans_eq
rw [←bp_add]; congr 1; ring
· rw [atList,growth_value]
refine Finset.mem_image.mpr ⟨(thermal p x S A,thermal p x S (src G)),?_,?_⟩
· exact Finset.mem_product.mpr ⟨hx,(s.bids_mem ..).mp hi⟩
· change growing _ _ _ = _
rw [show heat p x S z *ᵥ v=_ from column_observe (src G) z i x S]
end Bazaar
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.SingletonPhaseTests
namespace OAI
/-! # Additional Probe Bounds -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Module Submodule Function Finsetopen scoped BigOperatorsvariable {I J K : Type} [Fintype I] [Fintype J] [Fintype K]
private def moreMatrix {r : ℕ} (A : Mat I (Fin r)) (v : Vec I) : Mat I (Fin (r+1)) := Matrix.of (fun i => Fin.cons (v i) (A i))
omit [Fintype I] inprivate theorem moreMatrix_act {r : ℕ} (A : Mat I (Fin r)) (v : Vec I) (x : Vec (Fin (r+1))) : moreMatrix A v *ᵥ x=x 0 • v + A *ᵥ (fun i => x i.succ) := by funext i; simp only [Matrix.mulVec,dotProduct,moreMatrix,Matrix.of_apply, Fin.sum_univ_succ,Pi.add_apply,Pi.smul_apply,smul_eq_mul,Fin.cons_zero,Fin.cons_succ] congr 1; exact mul_comm _ _
omit [Fintype I] inprivate theorem moreMatrix_inj {r : ℕ} (A : Mat I (Fin r)) (v : Vec I) (ha : Injective A.mulVec) (h : v∉colSp A) : Injective (moreMatrix A v).mulVec := by rw [← Matrix.coe_mulVecLin,← LinearMap.ker_eq_bot, Matrix.ker_mulVecLin_eq_bot_iff] intro x hx rw [moreMatrix_act] at hx let b (i : Fin r) := x i.succ rcases bit_cases (x 0) with he|he · have hh : b=0 := by apply ha rw [he,zero_smul,zero_add] at hx exact hx.trans (Matrix.mulVec_zero _).symm funext i refine Fin.cases he (fun k => ?_) i exact congr_fun hh k · rw [he,one_smul] at hx have heq : v=A *ᵥ b := add_right_cancel (hx.trans (char_two _).symm) exact (h ⟨b,heq.symm⟩).elim
omit [Fintype J] inprivate theorem moreMatrix_mul {r} (B : Mat J I) (A : Mat I (Fin r)) (v) : B*moreMatrix A v=moreMatrix (B*A) (B *ᵥ v) := by ext i j refine Fin.cases ?_ (fun j => ?_) j · rfl simp only [moreMatrix,Matrix.mul_apply,Matrix.of_apply,Fin.cons_succ]
variable {p : Shape} {n N r : ℕ} {T : Cov p N}variable {q : Place p → ℕ}
private def growFmt (q : Place p→ℕ) (z : Place p) := fun i => q i+(if i=z then 1 else 0)
private theorem grow_sum (q : Place p→ℕ) (z : Place p) : ctot p (growFmt (p:=p) q z)=ctot p q+1 := by simp [growFmt,ctot,Finset.sum_add_distrib]
private def growing (A : DTuple (p:=p) q N) (z : Place p) (v : Vec (Fin N)) : DTuple (p:=p) (growFmt (p:=p) q z) N := fun i => by change Mat (Fin N) (Fin (q i+ if i=z then 1 else 0)) by_cases h : i=z · rw [ite_eq_left h]; exact moreMatrix (A i) v rw [ite_eq_right h]; exact A i
private theorem castMat_inj {r n m : ℕ} (e : r=n) (A : Mat (Fin m) (Fin r)) (h : Injective A.mulVec) : Injective (cast (show Mat (Fin m) (Fin r)=Mat (Fin m) (Fin n) from congrArg (fun t => Mat (Fin m) (Fin t)) e) A).mulVec := by subst n exact hprivate theorem castMat_prod {r n m : ℕ} (e : r=n) (A : Mat (Fin m) (Fin r)) (B : Mat (Fin m) (Fin m)) : B*(cast (show Mat (Fin m) (Fin r)=Mat (Fin m) (Fin n) from congrArg (fun t => Mat (Fin m) (Fin t)) e) A) = cast (show Mat (Fin m) (Fin r)=Mat (Fin m) (Fin n) from congrArg (fun t => Mat (Fin m) (Fin t)) e) (B*A) := by subst n; rfl
private theorem growth_inj (A : DTuple (p:=p) q N) (z : Place p) (v : Vec (Fin N)) (hv : v∉colSp (A z)) (h : ∀ i, Injective (A i).mulVec) : ∀ i,Injective (growing A z v i).mulVec := by intro i by_cases he : i=z · subst i simp [growing,growFmt] apply castMat_inj _ (moreMatrix (A z) v) (moreMatrix_inj (A z) v (h z) hv) simp simp [growing,growFmt,he] apply castMat_inj _ (A i) (h i) simp [he]
private theorem growth_value (A : DTuple (p:=p) q N) (z : Place p) (v : Vec (Fin N)) (x : UnitType p n N) (S : Party) : thermal p x S (growing A z v)=growing (thermal p x S A) z (heat p x S z *ᵥ v) := by funext i by_cases he : i=z · subst i simp [thermal,growing,growFmt] rw [←moreMatrix_mul] apply castMat_prod simp simp [thermal,growing,growFmt,he] apply castMat_prod simp [he]
theorem column_observe (A : DTuple (p:=p) q N) (z : Place p) (j : Fin (q z)) (x : UnitType p n N) (S : Party) : heat p x S z *ᵥ (A z).col j=(thermal p x S A z).col j := rfl
namespace Bazaarvariable (s : Bazaar p n r T)
abbrev Catalog (p : Shape) {N} (T : Cov p N) (r : ℕ) (q : Place p→ℕ) := (M : Atlas p r T) → Batch M N → Finset (DTuple (p:=p) q N)
def atList (s : Bazaar p n r T) (S : Party) (j : Bool) (A : DTuple (p:=p) q N) (F : Catalog p T r q) (x : UnitType p n N) := let M := s.ix x thermal p x S A∈ F M (s.bag M j x)
def probed (p : Shape) {N} {q : Place p→ℕ} (A : DTuple (p:=p) q N) : Cov p N := fun z => colSp (A z)
theorem extend_probe (w : Wgt (UnitType p n N)) (S : Party) (j : Bool) {k : ℕ} (A : DTuple (p:=p) q N) (hq : ctot p q=k) (h : ∀ i, Injective (A i).mulVec) (F : Catalog p T r q) (hF : ∀ M Z,(↑(F M Z).card:ℝ) ≤ bp (0.51*k*N)) (G : Atlas p r T) (hg : ¬ offsetCov G ≤ probed p A) (hb : ∀ M Z,(↑(s.bids w S j G M Z).card:ℝ) ≤ bp (0.51*N)) : ∃ (q : Place p→ℕ) (A' : DTuple (p:=p) q N) (F' : Catalog p T r q), ctot p q=k+1 ∧ (∀ i, Injective (A' i).mulVec) ∧ (∀ M Z,(↑(F' M Z).card:ℝ) ≤ bp (0.51*(k+1)*N)) ∧ ∀ x,s.atList S j A F x → s.frequent w S j G (s.ix x) x → s.atList S j A' F' x := by classical obtain ⟨z,i,hg⟩ : ∃ (z : Place p) (i : Fin (breadth G z)),(src G z).col i∉colSp (A z) := by by_contra! hh apply hg intro z change colSp (src G z) ≤ _ rw [colSp,range_mulVecLin] exact Submodule.span_le.mpr (Set.range_subset_iff.mpr (hh z)) let q' := growFmt (p:=p) q z let v := (src G z).col i let f (M Z) : Finset (DTuple (p:=p) q' N) := ((F M Z) ×ˢ (s.bids w S j G M Z)).image (fun a => growing a.1 z ((a.2 z).col i)) refine ⟨q',growing A z v, f,(grow_sum q z).trans (by rw [hq]), growth_inj A z v hg h,fun M Z => ?_,fun x hx hi => ?_⟩ · have he := bp_pos (0.51*(k:ℝ)*N) have h1 : (↑(f M Z).card:ℝ) ≤ (↑(F M Z).card:ℝ)*(↑(s.bids w S j G M Z).card:ℝ) := by exact_mod_cast (show (f M Z).card ≤ _*_ from Finset.card_image_le.trans_eq (Finset.card_product ..)) apply (h1.trans (mul_le_mul (hF M Z) (hb M Z) (Nat.cast_nonneg _) he.le)).trans_eq rw [←bp_add]; congr 1; ring · rw [atList,growth_value]
refine Finset.mem_image.mpr ⟨(thermal p x S A,thermal p x S (src G)),?_,?_⟩ · exact Finset.mem_product.mpr ⟨hx,(s.bids_mem ..).mp hi⟩ · change growing _ _ _ = _ rw [show heat p x S z *ᵥ v=_ from column_observe (src G) z i x S]
end Bazaarend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195import OAI.Combinatorics.HadwigerCounterexample.QuadraticTesters
import OAI.Combinatorics.HadwigerCounterexample.SampledGraphs
import Mathlib.Data.Matrix.ColumnRowPartitioned
namespace OAI
/-! # Affine Frames -/
noncomputable section
namespace HadwigerCounterexample
open Matrix
open scoped BigOperators
structure Mixer (p : Shape) (n : ℕ) where
mixL : Fin p.J → Comp p.g → Comp p.g → Moment p n
mixR : Fin p.J → Comp p.g → Comp p.g → Moment p n
mixM : Fin p.b → Mat (Fin n) (Fin n)
abbrev Pdual (p : Shape) (n : ℕ) := Profile p n →ₗ[F] F
def linTensor {V : Type} [AddCommGroup V] [Module F V] (a b : V →ₗ[F] F) : V →ₗ[F] V →ₗ[F] F :=
a.smulRight b
theorem linTensor_val {V : Type} [AddCommGroup V] [Module F V] (a b : V →ₗ[F] F)
(x y : V) : linTensor a b x y = a x * b y := rfl
variable {p : Shape} {n N : ℕ}
def T0 (p : Shape) (n : ℕ) : Profile p n →ₗ[F] Pdual p n :=
linTensor (role p n) (role p n) +
∑ i : Tag p.g, (linTensor (roleT p n i) (sharedT p n i) +
linTensor (sharedT p n i) (roleT p n i))
theorem T0_val (x y : Profile p n) : T0 p n x y =
role p n x * role p n y +
∑ 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
simp only [T0,LinearMap.add_apply,LinearMap.sum_apply,linTensor_val]
def B1 (m : Mixer p n) : Profile p n →ₗ[F] Pdual p n where
toFun x := {
toFun := fun y => ∑ j, ∑ e, ∑ f,
mpair (x e) (liftM (m.mixL j e f) (m.mixR j e f) (y f))
map_add' y z := by simp only [Pi.add_apply,map_add, Finset.sum_add_distrib]
map_smul' b y := by simp only [Pi.smul_apply,map_smul,RingHom.id_apply,smul_eq_mul,
Finset.mul_sum] }
map_add' x y := LinearMap.ext fun z => by
simp only [LinearMap.coe_mk,AddHom.coe_mk,LinearMap.add_apply,
Pi.add_apply,mpair_add, Finset.sum_add_distrib]
map_smul' b x := LinearMap.ext fun z => by
simp only [LinearMap.coe_mk,AddHom.coe_mk,LinearMap.smul_apply,RingHom.id_apply,
Pi.smul_apply,mpair_smul,smul_eq_mul, Finset.mul_sum]
def Tmix (m : Mixer p n) := B1 m + LinearMap.flip (B1 m)
def Tsym (m : Mixer p n) := T0 p n + Tmix m
theorem Tsym_val (m : Mixer p n) (x y : Profile p n) :
Tsym m x y = T0 p n x y + (B1 m x y + B1 m y x) := by
change (T0 p n + (B1 m + _)) x y = _
simp
theorem T_swap (m : Mixer p n) (x y : Profile p n) : Tsym m x y = Tsym m y x := by
simp only [Tsym_val,T0_val]
refine congrArg₂ (· + ·) (congrArg₂ (· + ·) (mul_comm _ _)
(Finset.sum_congr rfl fun i _ => ?_)) (add_comm _ _)
rw [mul_comm (roleT p n i x),mul_comm (sharedT p n i x),add_comm]
theorem T_diag (m : Mixer p n) (x : Profile p n) : Tsym m x x = role p n x := by
have h (a b : F) : a*b+b*a=0 := by rw [mul_comm b a,char_two]
simp only [Tsym_val,T0_val,char_two,h,Finset.sum_const_zero,add_zero,bit_sq]
def grad (m : Mixer p n) (x : Profile p n) := role p n + Tsym m x
theorem grad_val (m : Mixer p n) (x y : Profile p n) :
grad m x y = role p n y + Tsym m x y := rfl
abbrev Full (p : Shape) (n : ℕ) := Row p n ⊕ Fin p.h
abbrev RawFrame (I J : Type) := Mat J I × Mat J I
abbrev Oframe (p : Shape) (n N : ℕ) := RawFrame (Full p n) (Fin N)
abbrev Orient (p : Shape) (n N : ℕ) := Comp p.g → Oframe p n N
def primary {I J E : Type} (M : Mat E (I ⊕ J)) : Mat E I := M.submatrix id Sum.inl
def channel {I J E : Type} (M : Mat E (I ⊕ J)) : Mat E J := M.submatrix id Sum.inr
theorem fromCols_frame {I J E : Type} (M : Mat E (I ⊕ J)) :
fromCols (primary M) (channel M) = M := by ext i j; rcases j with i|j <;> rfl
theorem primary_inj {I J E : Type} [Fintype I] [Fintype J]
{M : Mat E (I ⊕ J)} (h : Function.Injective M.mulVec) :
Function.Injective (primary M).mulVec := by
intro a b hab
let v (x : Vec I) := Sum.elim x (fun _ : J => (0:F))
have he (x : Vec I) : M *ᵥ v x = primary M *ᵥ x := by
conv_lhs => rw [← fromCols_frame M]
unfold v; rw [fromCols_mulVec_sumElim]
change _ + (channel M *ᵥ 0) = _
rw [Matrix.mulVec_zero,add_zero]
have hh : v a = v b := h (by rw [he,he]; exact hab)
exact funext fun i => congr_fun hh (.inl i)
def valid (M : Moment p n) (o : Oframe p n N) : Prop :=
Function.Injective o.1.mulVec ∧ Function.Injective o.2.mulVec ∧
(primary o.1)ᵀ * primary o.2 = M ∧ (channel o.1)ᵀ * primary o.2 = 0 ∧
(primary o.1)ᵀ * channel o.2 = 0
def frameLaw (m : Mixer p n) (o : Orient p n N) :=
∀ e, valid (selfM p n m.mixM) (o e)
abbrev Ambient (p : Shape) (N : ℕ) := Comp p.g → Mat (Fin N) (Fin N)
def Uembed (o : Orient p n N) : Profile p n →ₗ[F] Ambient p N where
toFun x e := liftM (primary (o e).1) (primary (o e).2) (x e)
map_add' x y := by funext e; simp only [Pi.add_apply,map_add]
map_smul' a x := by funext e; simp only [Pi.smul_apply,map_smul,RingHom.id_apply]
def ufun (o : Orient p n N) : Ambient p N →ₗ[F] F where
toFun x := ∑ e, mpair (channel (o e).2 * (channel (o e).1)ᵀ) (x e)
map_add' x y := by simp only [Pi.add_apply,map_add, Finset.sum_add_distrib]
map_smul' a x := by simp only [Pi.smul_apply,map_smul,RingHom.id_apply,
smul_eq_mul,Finset.mul_sum]
theorem Uembed_inj {m : Mixer p n} {o : Orient p n N} (h : frameLaw m o) :
Function.Injective (Uembed o) := by
intro x y e
exact funext fun i =>
liftM_inj (primary_inj (h i).1) (primary_inj (h i).2.1) (congr_fun e i)
theorem ufun_self {m : Mixer p n} {o : Orient p n N} (h : frameLaw m o) (x : Profile p n) :
ufun o (Uembed o x) = 0 := by
simp only [ufun,Uembed,LinearMap.coe_mk,AddHom.coe_mk]
refine Finset.sum_eq_zero fun i _ => ?_
rw [mpair_liftM,liftM_def,← Matrix.mul_assoc,(h i).2.2.2.2,Matrix.zero_mul,
Matrix.zero_mul,mpair_comm,map_zero]
/-- Witnesses v,w are in the cut-profile space. The gradients agree over that
*whole* space. -/
def hole (m : Mixer p n) (x y : Orient p n N) :=
frameLaw m x ∧ frameLaw m y ∧ ∃ v w : Profile p n,
v ∈ Xspace p n ∧ w ∈ Xspace p n ∧
Uembed x v = Uembed y w ∧
(∀ i ∈ Xspace p n, ufun y (Uembed x i) = grad m v i) ∧
(∀ i ∈ Xspace p n, ufun x (Uembed y i) = grad m w i) ∧
role p n v + role p n w = 1
theorem hole_sym {m : Mixer p n} {x y : Orient p n N} (h : hole m x y) : hole m y x := by
obtain ⟨hx,hy,v,w,hv,hw,e,h,g,p⟩ := h
exact ⟨hy,hx,w,v,hw,hv,e.symm,g,h,(add_comm _ _).trans p⟩
theorem not_hole_self (m : Mixer p n) (x : Orient p n N) : ¬hole m x x := by
rintro ⟨hx,_,v,w,_,_,e,_,_,hp⟩
rw [Uembed_inj hx e,char_two] at hp
exact zero_ne_one hp
theorem hole_triangle {m : Mixer p n} {x y z : Orient p n N}
(h1 : hole m x y) (h2 : hole m y z) : ¬ hole m x z := by
intro h3
obtain ⟨_,_,a,b,ha,hb,hab,u1,u2,p1⟩ := h1
obtain ⟨_,_,c,d,hc,hd,hcd,u3,u4,p2⟩ := h2
obtain ⟨_,_,e,f,he,hf,hef,u5,u6,p3⟩ := h3
have hx : grad m b c = grad m f d := by rw [←u2 _ hc, ←u6 _ hd,hcd]
have hy : grad m a e = grad m d f := by rw [←u1 _ he, ←u4 _ hf,hef]
have hz : grad m e a = grad m c b := by rw [←u5 _ ha, ←u3 _ hb,hab]
simp only [grad_val] at hx hy hz
let A := role p n
have hw (x y : F) (h : x=y) : x+y=0 := by rw [h,char_two]
have hp : (A a+A b)+(A c+A d)+(A e+A f)=0 := by
let H := Tsym m
change A _ + H _ _ = A _ + H _ _ at hx hy hz
calc (A a+A b)+(A c+A d)+(A e+A f)
_ = ((A c+H b c)+(A d+H f d)) +
((A e+H a e)+(A f+H d f)) +
((A a+H e a)+(A b+H c b)) := by
have h (x y) : H x y+H y x=0 := hw _ _ (T_swap m _ _)
symm
calc ((A c+H b c)+(A d+H f d)) +
((A e+H a e)+(A f+H d f)) +
((A a+H e a)+(A b+H c b))
_ = ((A a+A b)+(A c+A d)+(A e+A f)) + (H b c+H c b) +
(H f d+H d f)+(H a e+H e a) := by ac_rfl
_ = _ := by simp only [h,add_zero]
_ = 0 := by rw [hw _ _ hx, hw _ _ hy, hw _ _ hz]; simp
unfold A at hp
rw [p1,p2,p3,char_two,zero_add] at hp
exact one_ne_zero hp
def rawHoles (m : Mixer p n) : Holes (Orient p n N) where
rel := hole m
sym := hole_sym
irr := not_hole_self m
ntri := hole_triangle
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.QuadraticTestersimport OAI.Combinatorics.HadwigerCounterexample.SampledGraphsimport Mathlib.Data.Matrix.ColumnRowPartitioned
namespace OAI
/-! # Affine Frames -/
noncomputable sectionnamespace HadwigerCounterexample
open Matrixopen scoped BigOperators
structure Mixer (p : Shape) (n : ℕ) where mixL : Fin p.J → Comp p.g → Comp p.g → Moment p n mixR : Fin p.J → Comp p.g → Comp p.g → Moment p n mixM : Fin p.b → Mat (Fin n) (Fin n)
abbrev Pdual (p : Shape) (n : ℕ) := Profile p n →ₗ[F] F
def linTensor {V : Type} [AddCommGroup V] [Module F V] (a b : V →ₗ[F] F) : V →ₗ[F] V →ₗ[F] F := a.smulRight b
theorem linTensor_val {V : Type} [AddCommGroup V] [Module F V] (a b : V →ₗ[F] F) (x y : V) : linTensor a b x y = a x * b y := rfl
variable {p : Shape} {n N : ℕ}
def T0 (p : Shape) (n : ℕ) : Profile p n →ₗ[F] Pdual p n := linTensor (role p n) (role p n) + ∑ i : Tag p.g, (linTensor (roleT p n i) (sharedT p n i) + linTensor (sharedT p n i) (roleT p n i))
theorem T0_val (x y : Profile p n) : T0 p n x y = role p n x * role p n y + ∑ 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 simp only [T0,LinearMap.add_apply,LinearMap.sum_apply,linTensor_val]
def B1 (m : Mixer p n) : Profile p n →ₗ[F] Pdual p n where toFun x := { toFun := fun y => ∑ j, ∑ e, ∑ f, mpair (x e) (liftM (m.mixL j e f) (m.mixR j e f) (y f)) map_add' y z := by simp only [Pi.add_apply,map_add, Finset.sum_add_distrib] map_smul' b y := by simp only [Pi.smul_apply,map_smul,RingHom.id_apply,smul_eq_mul, Finset.mul_sum] } map_add' x y := LinearMap.ext fun z => by simp only [LinearMap.coe_mk,AddHom.coe_mk,LinearMap.add_apply, Pi.add_apply,mpair_add, Finset.sum_add_distrib] map_smul' b x := LinearMap.ext fun z => by simp only [LinearMap.coe_mk,AddHom.coe_mk,LinearMap.smul_apply,RingHom.id_apply, Pi.smul_apply,mpair_smul,smul_eq_mul, Finset.mul_sum]
def Tmix (m : Mixer p n) := B1 m + LinearMap.flip (B1 m)def Tsym (m : Mixer p n) := T0 p n + Tmix m
theorem Tsym_val (m : Mixer p n) (x y : Profile p n) : Tsym m x y = T0 p n x y + (B1 m x y + B1 m y x) := by change (T0 p n + (B1 m + _)) x y = _ simp
theorem T_swap (m : Mixer p n) (x y : Profile p n) : Tsym m x y = Tsym m y x := by simp only [Tsym_val,T0_val] refine congrArg₂ (· + ·) (congrArg₂ (· + ·) (mul_comm _ _) (Finset.sum_congr rfl fun i _ => ?_)) (add_comm _ _) rw [mul_comm (roleT p n i x),mul_comm (sharedT p n i x),add_comm]
theorem T_diag (m : Mixer p n) (x : Profile p n) : Tsym m x x = role p n x := by have h (a b : F) : a*b+b*a=0 := by rw [mul_comm b a,char_two] simp only [Tsym_val,T0_val,char_two,h,Finset.sum_const_zero,add_zero,bit_sq]
def grad (m : Mixer p n) (x : Profile p n) := role p n + Tsym m xtheorem grad_val (m : Mixer p n) (x y : Profile p n) : grad m x y = role p n y + Tsym m x y := rfl
abbrev Full (p : Shape) (n : ℕ) := Row p n ⊕ Fin p.habbrev RawFrame (I J : Type) := Mat J I × Mat J Iabbrev Oframe (p : Shape) (n N : ℕ) := RawFrame (Full p n) (Fin N)abbrev Orient (p : Shape) (n N : ℕ) := Comp p.g → Oframe p n N
def primary {I J E : Type} (M : Mat E (I ⊕ J)) : Mat E I := M.submatrix id Sum.inldef channel {I J E : Type} (M : Mat E (I ⊕ J)) : Mat E J := M.submatrix id Sum.inr
theorem fromCols_frame {I J E : Type} (M : Mat E (I ⊕ J)) : fromCols (primary M) (channel M) = M := by ext i j; rcases j with i|j <;> rfl
theorem primary_inj {I J E : Type} [Fintype I] [Fintype J] {M : Mat E (I ⊕ J)} (h : Function.Injective M.mulVec) : Function.Injective (primary M).mulVec := by intro a b hab let v (x : Vec I) := Sum.elim x (fun _ : J => (0:F)) have he (x : Vec I) : M *ᵥ v x = primary M *ᵥ x := by conv_lhs => rw [← fromCols_frame M] unfold v; rw [fromCols_mulVec_sumElim] change _ + (channel M *ᵥ 0) = _ rw [Matrix.mulVec_zero,add_zero] have hh : v a = v b := h (by rw [he,he]; exact hab) exact funext fun i => congr_fun hh (.inl i)
def valid (M : Moment p n) (o : Oframe p n N) : Prop := Function.Injective o.1.mulVec ∧ Function.Injective o.2.mulVec ∧ (primary o.1)ᵀ * primary o.2 = M ∧ (channel o.1)ᵀ * primary o.2 = 0 ∧ (primary o.1)ᵀ * channel o.2 = 0
def frameLaw (m : Mixer p n) (o : Orient p n N) := ∀ e, valid (selfM p n m.mixM) (o e)
abbrev Ambient (p : Shape) (N : ℕ) := Comp p.g → Mat (Fin N) (Fin N)
def Uembed (o : Orient p n N) : Profile p n →ₗ[F] Ambient p N where toFun x e := liftM (primary (o e).1) (primary (o e).2) (x e) map_add' x y := by funext e; simp only [Pi.add_apply,map_add] map_smul' a x := by funext e; simp only [Pi.smul_apply,map_smul,RingHom.id_apply]
def ufun (o : Orient p n N) : Ambient p N →ₗ[F] F where toFun x := ∑ e, mpair (channel (o e).2 * (channel (o e).1)ᵀ) (x e) map_add' x y := by simp only [Pi.add_apply,map_add, Finset.sum_add_distrib] map_smul' a x := by simp only [Pi.smul_apply,map_smul,RingHom.id_apply, smul_eq_mul,Finset.mul_sum]
theorem Uembed_inj {m : Mixer p n} {o : Orient p n N} (h : frameLaw m o) : Function.Injective (Uembed o) := by intro x y e exact funext fun i => liftM_inj (primary_inj (h i).1) (primary_inj (h i).2.1) (congr_fun e i)
theorem ufun_self {m : Mixer p n} {o : Orient p n N} (h : frameLaw m o) (x : Profile p n) : ufun o (Uembed o x) = 0 := by simp only [ufun,Uembed,LinearMap.coe_mk,AddHom.coe_mk] refine Finset.sum_eq_zero fun i _ => ?_ rw [mpair_liftM,liftM_def,← Matrix.mul_assoc,(h i).2.2.2.2,Matrix.zero_mul, Matrix.zero_mul,mpair_comm,map_zero]
/-- Witnesses v,w are in the cut-profile space. The gradients agree over that*whole* space. -/def hole (m : Mixer p n) (x y : Orient p n N) := frameLaw m x ∧ frameLaw m y ∧ ∃ v w : Profile p n, v ∈ Xspace p n ∧ w ∈ Xspace p n ∧ Uembed x v = Uembed y w ∧ (∀ i ∈ Xspace p n, ufun y (Uembed x i) = grad m v i) ∧ (∀ i ∈ Xspace p n, ufun x (Uembed y i) = grad m w i) ∧ role p n v + role p n w = 1
theorem hole_sym {m : Mixer p n} {x y : Orient p n N} (h : hole m x y) : hole m y x := by obtain ⟨hx,hy,v,w,hv,hw,e,h,g,p⟩ := h exact ⟨hy,hx,w,v,hw,hv,e.symm,g,h,(add_comm _ _).trans p⟩
theorem not_hole_self (m : Mixer p n) (x : Orient p n N) : ¬hole m x x := by rintro ⟨hx,_,v,w,_,_,e,_,_,hp⟩ rw [Uembed_inj hx e,char_two] at hp exact zero_ne_one hp
theorem hole_triangle {m : Mixer p n} {x y z : Orient p n N} (h1 : hole m x y) (h2 : hole m y z) : ¬ hole m x z := by intro h3 obtain ⟨_,_,a,b,ha,hb,hab,u1,u2,p1⟩ := h1 obtain ⟨_,_,c,d,hc,hd,hcd,u3,u4,p2⟩ := h2 obtain ⟨_,_,e,f,he,hf,hef,u5,u6,p3⟩ := h3 have hx : grad m b c = grad m f d := by rw [←u2 _ hc, ←u6 _ hd,hcd] have hy : grad m a e = grad m d f := by rw [←u1 _ he, ←u4 _ hf,hef] have hz : grad m e a = grad m c b := by rw [←u5 _ ha, ←u3 _ hb,hab] simp only [grad_val] at hx hy hz let A := role p n have hw (x y : F) (h : x=y) : x+y=0 := by rw [h,char_two] have hp : (A a+A b)+(A c+A d)+(A e+A f)=0 := by let H := Tsym m change A _ + H _ _ = A _ + H _ _ at hx hy hz calc (A a+A b)+(A c+A d)+(A e+A f) _ = ((A c+H b c)+(A d+H f d)) + ((A e+H a e)+(A f+H d f)) + ((A a+H e a)+(A b+H c b)) := by have h (x y) : H x y+H y x=0 := hw _ _ (T_swap m _ _) symm calc ((A c+H b c)+(A d+H f d)) + ((A e+H a e)+(A f+H d f)) + ((A a+H e a)+(A b+H c b)) _ = ((A a+A b)+(A c+A d)+(A e+A f)) + (H b c+H c b) + (H f d+H d f)+(H a e+H e a) := by ac_rfl _ = _ := by simp only [h,add_zero] _ = 0 := by rw [hw _ _ hx, hw _ _ hy, hw _ _ hz]; simp unfold A at hp rw [p1,p2,p3,char_two,zero_add] at hp exact one_ne_zero hp
def rawHoles (m : Mixer p n) : Holes (Orient p n N) where rel := hole m sym := hole_sym irr := not_hole_self m ntri := hole_triangle
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124import OAI.Combinatorics.HadwigerCounterexample.PositiveTestMass
namespace OAI
/-! # Aggregate Cost Bounds -/
noncomputable section
namespace HadwigerCounterexample
open Finset Matrix Filter Function
open scoped BigOperators Topology
open Template
variable {p:Shape} {n N r M s0 K:ℕ}
namespace StatusAnalysis
open PreparationParameters Station DualAnalysis
theorem couplings {I A : Type} [Fintype I] [Fintype A] (p:Wgt I)(f:I→ Wgt A)
(F:(I×A)×(I×A)→ℝ):
avg (pairW (semi p f) (semi p f)) F=
avg (pairW p p) (fun i=>avg (pairW (f i.1) (f i.2)) (fun a=>F ((i.1,a.1),(i.2,a.2)))) := by
rw [pairW_avg,pairW_avg]
simp_rw [semi_avg,pairW_avg]
refine avg_congr (fun i _=>?_); exact avg_avg ..
theorem ship_cost (w:LeafMixture p n N)(U:Wgt (UnitType p n N))(m:Mixer p n)
(v:Station p n N K w) (i:Scrip p K) (Y:Silhouette p N r) :
avg (cirque w U) (fun x=>v.twilight i.2.2 m i.2.1 Y x.1.1 x.2.1 (x.1.2,x.2.2))
= v.stratum i.2.2 m U i.2.1 Y := couplings (portionW U w.T) (fun i=>partW U i.val) _
theorem ship_pos (w:LeafMixture p n N) (m:Mixer p n)
(v:Station p n N K w) (i:Scrip p K) (Y:Silhouette p N r)
(h:i.2.2.permission)(hp:1≤p.r)(hn:2*p.r≤n)
(x:ViewPair p n N w):
0≤ v.twilight i.2.2 m i.2.1 Y x.1.1 x.2.1 (x.1.2,x.2.2) := by
classical
let a:=i.2.2
have hA j:= Appearance.witLaw (a.qA.allure_apt a.t a.z h.2.1 j) hp hn
have hB j:= Appearance.witLaw (a.qB.allure_apt a.t a.z h.2.2.1 j) hp hn
let s:= v.cAxes x.1.1 (toRates i.1.2.1)
let t:= v.cAxes x.2.1 (toRates i.1.2.2)
have hc (j) : 0≤ a.chimera x.1.2 x.2.2 s t m Y j := avg_nonneg (unifOn_sub _).nz
(fun k=> mul_nonneg (a.qA.seraphFloor a.t a.z x.1.2 m s Y j (hA j) k).1
(a.qB.seraphFloor a.t a.z x.2.2 m t Y j (hB j) k).1)
have hM : 0≤a.momus:= mul_nonneg (kappa_pos _).le (kappa_pos _).le
exact mul_nonneg (ind_nonneg _) (mul_nonneg hM (Finset.prod_nonneg fun i _=>hc i))
theorem prognosis (w:LeafMixture p n N) (U: Wgt (UnitType p n N)) (m:Mixer p n)
(b:PreparationParameters) (v:Station p n N b.pins w) (Y:Silhouette p N r)
{ε a : ℝ} (he:0 ≤ ε)(ha:0<a) (hp:1≤p.r)(hn:2*p.r≤n)
(hs:Lead U w m b)
(h:∀ i:Scrip p b.pins,i.2.2.permission→v.stratum i.2.2 m U i.2.1 Y ≤ ε):
pr (cirque w U) (fun x=> eligiblePair v m x.1 x.2 Y a)≤ num (Scrip p b.pins)*(ε/a) := by
classical
let J:= Scrip p b.pins; let I:=ViewPair p n N w; let V:=cirque w U
let Q (i:J)(x:I):= v.twilight i.2.2 m i.2.1 Y x.1.1 x.2.1 (x.1.2,x.2.2)
have ht:= (troupe_bill hs).1; have hv:IsLaw V:=pairW_law ht ht
let P (i:J)(x:I):= i.2.2.permission∧ a ≤ Q i x
have hF (i:J): pr V (P i)≤ ε/a := by
by_cases ht:i.2.2.permission
· simp only [P,ht,true_and]
refine (le_div_iff₀ ha).mpr ?_
rw [mul_comm]
exact ((le_avg_markov hv.nz (ship_pos w m v i Y ht hp hn) a).trans_eq (ship_cost ..)).trans
(h i ht)
rw [show P i=(fun _=>False) from funext fun a=>eq_false fun hh=>ht hh.1,pr_false]; exact div_nonneg he ha.le
change pr V (fun x=>∃ i,P i x)≤ _
exact ((pr_exists_le hv.nz P).trans (Finset.sum_le_sum fun i _=> hF i)).trans_eq (by simp [J,num])
structure Beams (b:PreparationParameters) (m:Mixer p n) (Y:Silhouette p N r)
(w:LeafMixture p n N)(U:Wgt (UnitType p n N)) (v:Station p n N b.pins w)
(a ε δ τ :ℝ):Prop where
soft : origami p r (wisp p Y) δ
rare : pr (w.sap U) (fun i=>¬gauze p δ δ Y m b.pins i) ≤ τ
zone : pr (cirque w U) (fun x=> eligiblePair v m x.1 x.2 Y a) ≤ τ
haze : 0<δ∧ δ≤ ε
variable {l:Filter ℕ} {m:cycleM p} {U:tale p M} {w:rhythms p M} {b:PreparationParameters}
set_option maxHeartbeats 1400000 in
theorem lightmap (v:Stations p M b.pins w) (h:veil p M b s0 l m w U)
(a ε τ:ℝ) (ha:0<a)(he:0<ε)(hτ:0<τ)
(k:ℕ)(Y:∀ n,Silhouette p (M*n) k):
∃ (r:ℕ) (δ:ℝ), ∀ᶠ n in l,
∃ X:Silhouette p (M*n) r,refines X (Y n)∧
Beams b (m n) X (w n) (U n) (v n) a ε δ τ := by
classical
let L:= num (Scrip p b.pins); have hL:0≤L:=Nat.cast_nonneg _
let η := a*τ/(L+1)
have hη:0<η:=by unfold η; positivity
let u:= min τ (min ε (1/4))
have hu :0<u:=lt_min hτ (lt_min he (by norm_num))
obtain ⟨r,δ,hd,hV,hT⟩:= lateSilk v h η u hη hu k
refine ⟨r,δ,?_⟩; have he:= h.easel.enter.first
filter_upwards [h.upright,hT,h.moment,h.durableS.shape,h.durableS.mass.positive,
(trend_sizes l h.timeL he.hM).2.eventually (eventually_ge_atTop (2*num (Toast p)+1))]
with n hn ht hp hC hP hN
obtain ⟨X,hX,hW,hY⟩:=ht (Y n)
let N:=M*n
refine ⟨X,hX, ?_,hW.trans (min_le_left ..),?_, hd,?_⟩
· have h0 i j:IsLaw (wisp p X i j):=
mapW_law (omegaLaw p i j (show 2*num (Toast p)-(N:ℝ)≤-1 by
change _≤(N:ℝ) at hN
linarith only [hN])) _
refine ⟨h0,fun i j=>?_⟩
let ν:=wisp p X i j
have hs : pr ν (fun i=>¬δ≤ν i) = 1-pr ν (fun i=>δ≤ν i) :=by rw [pr_not,(show tot ν=1
from (h0 i j).total)]
have hi:u≤1/4:=le_trans (min_le_right ..) (min_le_right ..)
simp_rw [not_le] at hs
have hf:= haze_small ν δ hd.le
linarith only [hf,hs,hV,hi,hd]
· apply (prognosis (w n) (U n) (m n) b (v n) X hη.le ha he.hR hn.age
⟨hC.1,hP,hp.1.law,hC.2⟩ hY).trans
change L*(η/a)≤τ
have h : η/a= τ/(L+1) := by unfold η; field_simp
rw [h,mul_div_assoc',div_le_iff₀ (by linarith)]
linarith only [hτ]
have hi:u≤ε:=le_trans (min_le_right ..) (min_le_left ..)
nlinarith only [hi,hV,hd,Nat.cast_nonneg (α:=ℝ) r]
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PositiveTestMass
namespace OAI
/-! # Aggregate Cost Bounds -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Matrix Filter Functionopen scoped BigOperators Topologyopen Templatevariable {p:Shape} {n N r M s0 K:ℕ}namespace StatusAnalysisopen PreparationParameters Station DualAnalysis
theorem couplings {I A : Type} [Fintype I] [Fintype A] (p:Wgt I)(f:I→ Wgt A) (F:(I×A)×(I×A)→ℝ): avg (pairW (semi p f) (semi p f)) F= avg (pairW p p) (fun i=>avg (pairW (f i.1) (f i.2)) (fun a=>F ((i.1,a.1),(i.2,a.2)))) := by rw [pairW_avg,pairW_avg] simp_rw [semi_avg,pairW_avg] refine avg_congr (fun i _=>?_); exact avg_avg ..
theorem ship_cost (w:LeafMixture p n N)(U:Wgt (UnitType p n N))(m:Mixer p n) (v:Station p n N K w) (i:Scrip p K) (Y:Silhouette p N r) : avg (cirque w U) (fun x=>v.twilight i.2.2 m i.2.1 Y x.1.1 x.2.1 (x.1.2,x.2.2)) = v.stratum i.2.2 m U i.2.1 Y := couplings (portionW U w.T) (fun i=>partW U i.val) _
theorem ship_pos (w:LeafMixture p n N) (m:Mixer p n) (v:Station p n N K w) (i:Scrip p K) (Y:Silhouette p N r) (h:i.2.2.permission)(hp:1≤p.r)(hn:2*p.r≤n) (x:ViewPair p n N w): 0≤ v.twilight i.2.2 m i.2.1 Y x.1.1 x.2.1 (x.1.2,x.2.2) := by classical let a:=i.2.2 have hA j:= Appearance.witLaw (a.qA.allure_apt a.t a.z h.2.1 j) hp hn have hB j:= Appearance.witLaw (a.qB.allure_apt a.t a.z h.2.2.1 j) hp hn let s:= v.cAxes x.1.1 (toRates i.1.2.1) let t:= v.cAxes x.2.1 (toRates i.1.2.2) have hc (j) : 0≤ a.chimera x.1.2 x.2.2 s t m Y j := avg_nonneg (unifOn_sub _).nz (fun k=> mul_nonneg (a.qA.seraphFloor a.t a.z x.1.2 m s Y j (hA j) k).1 (a.qB.seraphFloor a.t a.z x.2.2 m t Y j (hB j) k).1) have hM : 0≤a.momus:= mul_nonneg (kappa_pos _).le (kappa_pos _).le exact mul_nonneg (ind_nonneg _) (mul_nonneg hM (Finset.prod_nonneg fun i _=>hc i))
theorem prognosis (w:LeafMixture p n N) (U: Wgt (UnitType p n N)) (m:Mixer p n) (b:PreparationParameters) (v:Station p n N b.pins w) (Y:Silhouette p N r) {ε a : ℝ} (he:0 ≤ ε)(ha:0<a) (hp:1≤p.r)(hn:2*p.r≤n) (hs:Lead U w m b) (h:∀ i:Scrip p b.pins,i.2.2.permission→v.stratum i.2.2 m U i.2.1 Y ≤ ε): pr (cirque w U) (fun x=> eligiblePair v m x.1 x.2 Y a)≤ num (Scrip p b.pins)*(ε/a) := by classical let J:= Scrip p b.pins; let I:=ViewPair p n N w; let V:=cirque w U let Q (i:J)(x:I):= v.twilight i.2.2 m i.2.1 Y x.1.1 x.2.1 (x.1.2,x.2.2) have ht:= (troupe_bill hs).1; have hv:IsLaw V:=pairW_law ht ht let P (i:J)(x:I):= i.2.2.permission∧ a ≤ Q i x have hF (i:J): pr V (P i)≤ ε/a := by by_cases ht:i.2.2.permission · simp only [P,ht,true_and] refine (le_div_iff₀ ha).mpr ?_ rw [mul_comm] exact ((le_avg_markov hv.nz (ship_pos w m v i Y ht hp hn) a).trans_eq (ship_cost ..)).trans (h i ht) rw [show P i=(fun _=>False) from funext fun a=>eq_false fun hh=>ht hh.1,pr_false]; exact div_nonneg he ha.le change pr V (fun x=>∃ i,P i x)≤ _ exact ((pr_exists_le hv.nz P).trans (Finset.sum_le_sum fun i _=> hF i)).trans_eq (by simp [J,num])
structure Beams (b:PreparationParameters) (m:Mixer p n) (Y:Silhouette p N r) (w:LeafMixture p n N)(U:Wgt (UnitType p n N)) (v:Station p n N b.pins w) (a ε δ τ :ℝ):Prop where soft : origami p r (wisp p Y) δ rare : pr (w.sap U) (fun i=>¬gauze p δ δ Y m b.pins i) ≤ τ zone : pr (cirque w U) (fun x=> eligiblePair v m x.1 x.2 Y a) ≤ τ haze : 0<δ∧ δ≤ ε
variable {l:Filter ℕ} {m:cycleM p} {U:tale p M} {w:rhythms p M} {b:PreparationParameters}set_option maxHeartbeats 1400000 intheorem lightmap (v:Stations p M b.pins w) (h:veil p M b s0 l m w U) (a ε τ:ℝ) (ha:0<a)(he:0<ε)(hτ:0<τ) (k:ℕ)(Y:∀ n,Silhouette p (M*n) k): ∃ (r:ℕ) (δ:ℝ), ∀ᶠ n in l, ∃ X:Silhouette p (M*n) r,refines X (Y n)∧ Beams b (m n) X (w n) (U n) (v n) a ε δ τ := by classical let L:= num (Scrip p b.pins); have hL:0≤L:=Nat.cast_nonneg _ let η := a*τ/(L+1) have hη:0<η:=by unfold η; positivity let u:= min τ (min ε (1/4)) have hu :0<u:=lt_min hτ (lt_min he (by norm_num)) obtain ⟨r,δ,hd,hV,hT⟩:= lateSilk v h η u hη hu k refine ⟨r,δ,?_⟩; have he:= h.easel.enter.first filter_upwards [h.upright,hT,h.moment,h.durableS.shape,h.durableS.mass.positive, (trend_sizes l h.timeL he.hM).2.eventually (eventually_ge_atTop (2*num (Toast p)+1))] with n hn ht hp hC hP hN obtain ⟨X,hX,hW,hY⟩:=ht (Y n) let N:=M*n refine ⟨X,hX, ?_,hW.trans (min_le_left ..),?_, hd,?_⟩ · have h0 i j:IsLaw (wisp p X i j):= mapW_law (omegaLaw p i j (show 2*num (Toast p)-(N:ℝ)≤-1 by change _≤(N:ℝ) at hN linarith only [hN])) _ refine ⟨h0,fun i j=>?_⟩ let ν:=wisp p X i j have hs : pr ν (fun i=>¬δ≤ν i) = 1-pr ν (fun i=>δ≤ν i) :=by rw [pr_not,(show tot ν=1 from (h0 i j).total)] have hi:u≤1/4:=le_trans (min_le_right ..) (min_le_right ..) simp_rw [not_le] at hs have hf:= haze_small ν δ hd.le linarith only [hf,hs,hV,hi,hd] · apply (prognosis (w n) (U n) (m n) b (v n) X hη.le ha he.hR hn.age ⟨hC.1,hP,hp.1.law,hC.2⟩ hY).trans change L*(η/a)≤τ have h : η/a= τ/(L+1) := by unfold η; field_simp rw [h,mul_div_assoc',div_le_iff₀ (by linarith)] linarith only [hτ] have hi:u≤ε:=le_trans (min_le_right ..) (min_le_left ..) nlinarith only [hi,hV,hd,Nat.cast_nonneg (α:=ℝ) r]
end StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211import OAI.Combinatorics.HadwigerCounterexample.TesterSummaryMass
import OAI.Combinatorics.HadwigerCounterexample.ChannelFrameLaws
namespace OAI
/-! # Ambient Batch Slots -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Module LinearMap Finset Function
open scoped BigOperators
variable {I J G A B : Type} [Fintype I] [Fintype J] [Fintype A] [Fintype B]
variable {p : Shape} {n N : ℕ}
omit [Fintype B] in
theorem mapW_equiv_val (e : A≃B) (w : Wgt A) (y : B) :
mapW w e y=w (e.symm y) := by
classical
have h : (fun x => e x=y)=(fun x => x=e.symm y) := by
funext x; apply propext
exact ⟨fun h => by rw [← h,Equiv.symm_apply_apply],fun h => by rw [h,Equiv.apply_symm_apply]⟩
unfold mapW; rw [h]; simp
theorem unif_equiv (e : A≃B) : mapW unif e = unif := by
funext x; rw [mapW_equiv_val, unif_apply, unif_apply, Fintype.card_congr e]
theorem on_equiv (e : A≃B) (p : B→Prop) :
mapW (unifOn (fun x => p (e x))) e = unifOn p := by
classical
have h : nbr (fun x => p (e x))=nbr p := Equiv.sum_comp e (fun y => ind (p y))
funext x
rw [mapW_equiv_val,unifOn_val,unifOn_val]; simp only [Equiv.apply_symm_apply,h]
abbrev PlusRack (I : Type) (N : ℕ) := Mat (Fin N) I
abbrev Rack (I : Type) (N : ℕ) := PlusRack I N × PlusRack I N
def sectionR {I J : Type} (f : J→I) (x : Rack I N) : Rack J N :=
((x.1).submatrix _root_.id f, (x.2).submatrix _root_.id f)
abbrev Route (I G : Type) := I → G
abbrev Port {I G : Type} (f : Route I G) (g : G) := {i:I//f i=g}
abbrev Network {I G : Type} (f : Route I G) (N : ℕ) := ∀ i,Rack (Port f i) N
variable [Fintype G]
variable [DecidableEq I] [DecidableEq J] [DecidableEq G]
variable {f : Route I G}
def rackEquiv (f : Route I G) (N : ℕ) : Rack I N ≃ Network f N where
toFun x i := sectionR Subtype.val x
invFun x := (Matrix.of (fun j i => (x (f i)).1 j ⟨i,rfl⟩),
Matrix.of (fun j i => (x (f i)).2 j ⟨i,rfl⟩))
left_inv x := by apply Prod.ext <;> rfl
right_inv x := by
funext i; apply Prod.ext <;>
· ext j ⟨y,rfl⟩; rfl
abbrev GeoM (f : Route I G) := ∀ i,Mat (Port f i) (Port f i)
def gramPart {N} (A : GeoM f) (x : Rack I N) :=
∀ i,let P:=rackEquiv f N x i;
P.1ᵀ*P.2=A i
def injPart (f : Route I G) {N} (x : Rack I N) :=
∀ i,let P:=rackEquiv f N x i;
Injective P.1.mulVec ∧ Injective P.2.mulVec
def bothPart {N} (A : GeoM f) (x : Rack I N) := ∀ i, gramGood (A i) (rackEquiv f N x i)
def scoreR {I : Type} (x : Rack I N) (i j : I) : F := (x.1ᵀ*x.2) i j
omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] in
theorem part_scores (x : Rack I N) (A : GeoM f) :
gramPart A x↔ ∀ i, ∀ a b : Port f i,scoreR x a.val b.val=A i a b := by
constructor
· intro h i a b; exact congr_fun (congr_fun (h i) a) b
intro h i; exact Matrix.ext (fun a b => h i a b)
omit [Fintype G] [DecidableEq I] in
theorem both_test (A : GeoM f) (x : Rack I N) :
bothPart A x↔ gramPart A x ∧injPart f x := by simp [gramPart,injPart,bothPart,gramGood,forall_and]
private theorem pi_unif {I : Type} [Fintype I] [DecidableEq I]
{A : I→Type} [∀ i,Fintype (A i)] :
unif (α:=(∀ i,A i)) = prodW (fun i => unif (α:=A i)) := by
classical
funext x
simp [unif_apply,prodW,Fintype.card_pi]
private theorem pi_unifOn {I : Type} [Fintype I] [DecidableEq I]
{A : I→Type} [∀ i,Fintype (A i)] (p : ∀ i,A i→Prop) :
unifOn (fun x => ∀ i,p i (x i)) = prodW (fun i => unifOn (p i)) := by
classical
funext x
rw [unifOn_val]
have he : nbr (fun x : (∀ i, A i) => ∀ i,p i (x i)) = ∏ i,nbr (p i) := by
unfold nbr; simp_rw [ind_all]
exact prodW_tot (fun (i : I) (x : A i) => ind (p i x))
simp only [prodW,he,unifOn_val,ind_all,Finset.prod_div_distrib]
def rackStation (A : GeoM f) (N : ℕ) : Wgt (Rack I N) := unifOn (bothPart A)
def rackWave (A : GeoM f) (N : ℕ) : Wgt (Rack I N) := unifOn (gramPart A)
theorem station_split (A : GeoM f) (N : ℕ) :
mapW (rackStation A N) (rackEquiv f N)=
prodW (fun i => unifOn (gramGood (A i))) := by
classical
unfold rackStation bothPart
rw [show mapW _ _= _ from on_equiv (rackEquiv f N)
(fun x => ∀ i,gramGood (A i) (x i))]
exact pi_unifOn _
def netSize (f : Route I G) := ∑ i : G,num (Port f i)*num (Port f i)
def netFact (f : Route I G) :=
(4:ℝ)^(Fintype.card G)*bp (netSize f)
omit [DecidableEq I] in
theorem netFact_pos : 0<netFact f := mul_pos (pow_pos (by norm_num) _) (bp_pos _)
theorem net_norm (A : GeoM f) (N : ℕ)
(h : ∀ i,2*num (Port f i)-N≤ -1) :
(netFact f)⁻¹ ≤ pr unif (bothPart (N:=N) A) ∧
pr unif (bothPart (N:=N) A) ≤ bp (-netSize f) := by
classical
let p := fun i => gramGood (U:=Fin N) (A i)
have hnum (t : ℕ) : num (Fin t)=(t:ℝ) := by simp [num]
have ht i : num (Port f i) + num (Port f i)-num (Fin N)≤ -1 := by rw [←two_mul,hnum]; exact h _
have he : pr unif (bothPart (N:=N) A) = ∏ i,pr unif (p i) := by
unfold bothPart
rw [←mapW_pr unif (rackEquiv f N) (fun x => ∀ i,p i (x i)), unif_equiv]
conv_lhs => rw [pi_unif]
exact prodW_pr ..
rw [he]; constructor
· let h' (i : G) := bp (-(num (Port f i))*num (Port f i))/4
have hh i : h' i ≤ pr unif (p i) := gram_norm_quarter _ (ht _)
refine le_trans ?_ (Finset.prod_le_prod₀ (fun i _ => div_nonneg (bp_pos _).le
(by norm_num)) fun i _ => hh i)
unfold netFact
rw [_root_.mul_inv_rev,Finset.prod_div_distrib,←bp_sum,netSize,Finset.prod_const,
← bp_neg, ← Finset.sum_neg_distrib]
simp_rw [neg_mul, Finset.card_univ,div_eq_mul_inv]
exact le_rfl
· have h i :=
(gram_norm (U:=Fin N) (A i) (show _≤ _ by linarith only [ht i])).1
unfold netSize
rw [← Finset.sum_neg_distrib, bp_sum]
apply Finset.prod_le_prod₀ (fun i _ => pr_nonneg unif_law.nz)
intro i _
rw [pair_unif,←neg_mul]
exact h i
theorem wave_norm (A : GeoM f) (N : ℕ)
(h : ∀ i,2*num (Port f i)-N≤ -1) :
(netFact f)⁻¹ ≤ pr unif (gramPart (N:=N) A) :=
((net_norm A N h).1).trans
(pr_mono unif_law.nz (fun _ hx => ((both_test ..).mp hx).1))
theorem injPart_failure (f : Route I G) (N : ℕ) (k : ℝ) (h : ∀ i,num (Port f i)≤k) :
pr unif (fun x : Rack I N => ¬injPart f x)≤num G*(2*bp (k-N)) := by
classical
let Q := fun x : Network f N =>
∀ i, Injective (x i).1.mulVec ∧ Injective (x i).2.mulVec
have he :
pr unif (fun x : Rack I N => ¬injPart f x)=
pr (prodW (fun i : G => unif (α:=Rack (Port f i) N))) (fun x => ¬Q x) := by
rw [←pi_unif,← unif_equiv (rackEquiv f N),mapW_pr]
rfl
rw [he]
let P i := fun x : Rack (Port f i) N => ¬ (Injective x.1.mulVec∧Injective x.2.mulVec)
let w : Wgt (Network f N) := prodW (fun i => unif)
have hw : IsLaw w := prodW_law (fun _ => unif_law)
have ht i : pr unif (P i) ≤ 2*bp (k-N) := by
let g := fun x : PlusRack (Port f i) N => ¬Injective x.mulVec
have hi : pr unif g≤ bp (k-N) := by
refine unif_fail.trans (bp_le ?_)
have he := h i
simp only [num,Fintype.card_fin] at *
linarith only [he]
have hQ (x : Rack (Port f i) N) :
P i x→ (True∧g x.2)∨(g x.1∧True) := by unfold P g; tauto
rw [pair_unif,two_mul]
let nz := (pairW_law (α:=PlusRack (Port f i) N) unif_law (β:=PlusRack (Port f i) N) unif_law).nz
calc pr _ _
_ ≤ _ := pr_mono nz hQ
_ ≤ _ := pr_or_le nz
_ ≤ _ := by rw [pairW_pr unif unif (fun _ : PlusRack (Port f i) N => True) g,pairW_pr unif unif g (fun _ : PlusRack (Port f i) N => True),pr_true,unif_law.total,one_mul,mul_one]
exact add_le_add hi hi
have hP x (h : ¬Q x) : ∃ i,P i (x i) := Classical.byContradiction (fun g =>
h (fun i => Classical.byContradiction (fun he => g ⟨i,he⟩)))
have hc i :
pr w (fun x => P i (x i))=pr unif (P i) := by
let g (j : G) (x : Rack (Port f j) N) :=
if h:j=i then by subst i; exact P j x else True
have he (x : Network f N) :
P i (x i) ↔ ∀ j,g j (x j) := by
constructor
· intro h j
by_cases he : j=i
· subst j; exact (by simpa [g])
simp [g,he]
· intro h; simpa [g] using h i
simp_rw [he]; unfold w; rw [prodW_pr _ g,Finset.prod_eq_single i]
· simp [g]
· intro j _ hj; simp [g,hj,unif_law.total]
simp
refine le_trans (pr_mono hw.nz hP) ((pr_exists_le hw.nz (fun i x => P i (x i))).trans ?_)
simp_rw [hc]
refine (Finset.sum_le_sum fun i _ => ht i).trans_eq ?_
simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,num]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.TesterSummaryMassimport OAI.Combinatorics.HadwigerCounterexample.ChannelFrameLaws
namespace OAI
/-! # Ambient Batch Slots -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Module LinearMap Finset Functionopen scoped BigOperatorsvariable {I J G A B : Type} [Fintype I] [Fintype J] [Fintype A] [Fintype B]variable {p : Shape} {n N : ℕ}
omit [Fintype B] intheorem mapW_equiv_val (e : A≃B) (w : Wgt A) (y : B) : mapW w e y=w (e.symm y) := by classical have h : (fun x => e x=y)=(fun x => x=e.symm y) := by funext x; apply propext exact ⟨fun h => by rw [← h,Equiv.symm_apply_apply],fun h => by rw [h,Equiv.apply_symm_apply]⟩ unfold mapW; rw [h]; simp
theorem unif_equiv (e : A≃B) : mapW unif e = unif := by funext x; rw [mapW_equiv_val, unif_apply, unif_apply, Fintype.card_congr e]
theorem on_equiv (e : A≃B) (p : B→Prop) : mapW (unifOn (fun x => p (e x))) e = unifOn p := by classical have h : nbr (fun x => p (e x))=nbr p := Equiv.sum_comp e (fun y => ind (p y)) funext x rw [mapW_equiv_val,unifOn_val,unifOn_val]; simp only [Equiv.apply_symm_apply,h]
abbrev PlusRack (I : Type) (N : ℕ) := Mat (Fin N) Iabbrev Rack (I : Type) (N : ℕ) := PlusRack I N × PlusRack I Ndef sectionR {I J : Type} (f : J→I) (x : Rack I N) : Rack J N := ((x.1).submatrix _root_.id f, (x.2).submatrix _root_.id f)abbrev Route (I G : Type) := I → Gabbrev Port {I G : Type} (f : Route I G) (g : G) := {i:I//f i=g}abbrev Network {I G : Type} (f : Route I G) (N : ℕ) := ∀ i,Rack (Port f i) N
variable [Fintype G]variable [DecidableEq I] [DecidableEq J] [DecidableEq G]variable {f : Route I G}
def rackEquiv (f : Route I G) (N : ℕ) : Rack I N ≃ Network f N where toFun x i := sectionR Subtype.val x invFun x := (Matrix.of (fun j i => (x (f i)).1 j ⟨i,rfl⟩), Matrix.of (fun j i => (x (f i)).2 j ⟨i,rfl⟩)) left_inv x := by apply Prod.ext <;> rfl right_inv x := by funext i; apply Prod.ext <;> · ext j ⟨y,rfl⟩; rfl
abbrev GeoM (f : Route I G) := ∀ i,Mat (Port f i) (Port f i)
def gramPart {N} (A : GeoM f) (x : Rack I N) := ∀ i,let P:=rackEquiv f N x i; P.1ᵀ*P.2=A idef injPart (f : Route I G) {N} (x : Rack I N) := ∀ i,let P:=rackEquiv f N x i; Injective P.1.mulVec ∧ Injective P.2.mulVec
def bothPart {N} (A : GeoM f) (x : Rack I N) := ∀ i, gramGood (A i) (rackEquiv f N x i)
def scoreR {I : Type} (x : Rack I N) (i j : I) : F := (x.1ᵀ*x.2) i j
omit [Fintype I] [Fintype G] [DecidableEq I] [DecidableEq G] intheorem part_scores (x : Rack I N) (A : GeoM f) : gramPart A x↔ ∀ i, ∀ a b : Port f i,scoreR x a.val b.val=A i a b := by constructor · intro h i a b; exact congr_fun (congr_fun (h i) a) b intro h i; exact Matrix.ext (fun a b => h i a b)
omit [Fintype G] [DecidableEq I] intheorem both_test (A : GeoM f) (x : Rack I N) : bothPart A x↔ gramPart A x ∧injPart f x := by simp [gramPart,injPart,bothPart,gramGood,forall_and]
private theorem pi_unif {I : Type} [Fintype I] [DecidableEq I] {A : I→Type} [∀ i,Fintype (A i)] : unif (α:=(∀ i,A i)) = prodW (fun i => unif (α:=A i)) := by classical funext x simp [unif_apply,prodW,Fintype.card_pi]
private theorem pi_unifOn {I : Type} [Fintype I] [DecidableEq I] {A : I→Type} [∀ i,Fintype (A i)] (p : ∀ i,A i→Prop) : unifOn (fun x => ∀ i,p i (x i)) = prodW (fun i => unifOn (p i)) := by classical funext x rw [unifOn_val] have he : nbr (fun x : (∀ i, A i) => ∀ i,p i (x i)) = ∏ i,nbr (p i) := by unfold nbr; simp_rw [ind_all] exact prodW_tot (fun (i : I) (x : A i) => ind (p i x)) simp only [prodW,he,unifOn_val,ind_all,Finset.prod_div_distrib]
def rackStation (A : GeoM f) (N : ℕ) : Wgt (Rack I N) := unifOn (bothPart A)def rackWave (A : GeoM f) (N : ℕ) : Wgt (Rack I N) := unifOn (gramPart A)
theorem station_split (A : GeoM f) (N : ℕ) : mapW (rackStation A N) (rackEquiv f N)= prodW (fun i => unifOn (gramGood (A i))) := by classical unfold rackStation bothPart rw [show mapW _ _= _ from on_equiv (rackEquiv f N) (fun x => ∀ i,gramGood (A i) (x i))] exact pi_unifOn _
def netSize (f : Route I G) := ∑ i : G,num (Port f i)*num (Port f i)def netFact (f : Route I G) := (4:ℝ)^(Fintype.card G)*bp (netSize f)
omit [DecidableEq I] intheorem netFact_pos : 0<netFact f := mul_pos (pow_pos (by norm_num) _) (bp_pos _)
theorem net_norm (A : GeoM f) (N : ℕ) (h : ∀ i,2*num (Port f i)-N≤ -1) : (netFact f)⁻¹ ≤ pr unif (bothPart (N:=N) A) ∧ pr unif (bothPart (N:=N) A) ≤ bp (-netSize f) := by classical let p := fun i => gramGood (U:=Fin N) (A i) have hnum (t : ℕ) : num (Fin t)=(t:ℝ) := by simp [num] have ht i : num (Port f i) + num (Port f i)-num (Fin N)≤ -1 := by rw [←two_mul,hnum]; exact h _ have he : pr unif (bothPart (N:=N) A) = ∏ i,pr unif (p i) := by unfold bothPart rw [←mapW_pr unif (rackEquiv f N) (fun x => ∀ i,p i (x i)), unif_equiv] conv_lhs => rw [pi_unif] exact prodW_pr .. rw [he]; constructor · let h' (i : G) := bp (-(num (Port f i))*num (Port f i))/4 have hh i : h' i ≤ pr unif (p i) := gram_norm_quarter _ (ht _) refine le_trans ?_ (Finset.prod_le_prod₀ (fun i _ => div_nonneg (bp_pos _).le (by norm_num)) fun i _ => hh i) unfold netFact rw [_root_.mul_inv_rev,Finset.prod_div_distrib,←bp_sum,netSize,Finset.prod_const, ← bp_neg, ← Finset.sum_neg_distrib] simp_rw [neg_mul, Finset.card_univ,div_eq_mul_inv] exact le_rfl · have h i := (gram_norm (U:=Fin N) (A i) (show _≤ _ by linarith only [ht i])).1 unfold netSize rw [← Finset.sum_neg_distrib, bp_sum] apply Finset.prod_le_prod₀ (fun i _ => pr_nonneg unif_law.nz) intro i _ rw [pair_unif,←neg_mul] exact h i
theorem wave_norm (A : GeoM f) (N : ℕ) (h : ∀ i,2*num (Port f i)-N≤ -1) : (netFact f)⁻¹ ≤ pr unif (gramPart (N:=N) A) := ((net_norm A N h).1).trans (pr_mono unif_law.nz (fun _ hx => ((both_test ..).mp hx).1))
theorem injPart_failure (f : Route I G) (N : ℕ) (k : ℝ) (h : ∀ i,num (Port f i)≤k) : pr unif (fun x : Rack I N => ¬injPart f x)≤num G*(2*bp (k-N)) := by classical let Q := fun x : Network f N => ∀ i, Injective (x i).1.mulVec ∧ Injective (x i).2.mulVec have he : pr unif (fun x : Rack I N => ¬injPart f x)= pr (prodW (fun i : G => unif (α:=Rack (Port f i) N))) (fun x => ¬Q x) := by rw [←pi_unif,← unif_equiv (rackEquiv f N),mapW_pr] rfl rw [he] let P i := fun x : Rack (Port f i) N => ¬ (Injective x.1.mulVec∧Injective x.2.mulVec) let w : Wgt (Network f N) := prodW (fun i => unif) have hw : IsLaw w := prodW_law (fun _ => unif_law) have ht i : pr unif (P i) ≤ 2*bp (k-N) := by let g := fun x : PlusRack (Port f i) N => ¬Injective x.mulVec have hi : pr unif g≤ bp (k-N) := by refine unif_fail.trans (bp_le ?_) have he := h i simp only [num,Fintype.card_fin] at * linarith only [he] have hQ (x : Rack (Port f i) N) : P i x→ (True∧g x.2)∨(g x.1∧True) := by unfold P g; tauto rw [pair_unif,two_mul] let nz := (pairW_law (α:=PlusRack (Port f i) N) unif_law (β:=PlusRack (Port f i) N) unif_law).nz calc pr _ _ _ ≤ _ := pr_mono nz hQ _ ≤ _ := pr_or_le nz _ ≤ _ := by rw [pairW_pr unif unif (fun _ : PlusRack (Port f i) N => True) g,pairW_pr unif unif g (fun _ : PlusRack (Port f i) N => True),pr_true,unif_law.total,one_mul,mul_one] exact add_le_add hi hi have hP x (h : ¬Q x) : ∃ i,P i (x i) := Classical.byContradiction (fun g => h (fun i => Classical.byContradiction (fun he => g ⟨i,he⟩))) have hc i : pr w (fun x => P i (x i))=pr unif (P i) := by let g (j : G) (x : Rack (Port f j) N) := if h:j=i then by subst i; exact P j x else True have he (x : Network f N) : P i (x i) ↔ ∀ j,g j (x j) := by constructor · intro h j by_cases he : j=i · subst j; exact (by simpa [g]) simp [g,he] · intro h; simpa [g] using h i simp_rw [he]; unfold w; rw [prodW_pr _ g,Finset.prod_eq_single i] · simp [g] · intro j _ hj; simp [g,hj,unif_law.total] simp refine le_trans (pr_mono hw.nz hP) ((pr_exists_le hw.nz (fun i x => P i (x i))).trans ?_) simp_rw [hc] refine (Finset.sum_le_sum fun i _ => ht i).trans_eq ?_ simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,num]
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143import OAI.Combinatorics.HadwigerCounterexample.PairedMassIdentities
import OAI.Combinatorics.HadwigerCounterexample.UnaryPositivityBounds
import OAI.Combinatorics.HadwigerCounterexample.RecursiveComparisonErrors
import OAI.Combinatorics.HadwigerCounterexample.MixerExistence
namespace OAI
/-! # Analytic Parameters -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Matrix
open scoped BigOperators Topology
open StatusAnalysis StatusAnalysis.Station
def frameBills (g K : ℕ) :=
2*Fintype.card (Comp g)*K*qorth K
structure AnalyticParameters (p : Shape) (M : ℕ) (b : PreparationParameters) (r : ℕ) : Prop where
enter : b.entry p M
thickness : 4≤ M
profiles : 2*profileA p b.pins < r
jump : 1≤p.J
bigJ : r≤p.J
gleaming : bp (-((p.J-r:ℕ):ℝ))*bp r < glintRate b.pins
penRoom : (b.pins+1)*qorth b.pins≤p.j+1
forbid : frameBills p.g b.pins+1000 ≤ b.B
spare : 3*b.B < Fintype.card (Label p.b)
secure : ∀ᶠ n : ℕ in atTop, Station.earnsScore p n (M*n) b.pins (2*b.ζ)
namespace PreparationParameters
variable {b : PreparationParameters} {p : Shape} {N M r : ℕ} {l : Filter ℕ} {m : cycleM p}
{s : rhythms p M} {w : tale p M}
def conflicted {n : ℕ} (p : Shape) (m : Mixer p n) (N : ℕ) (w : Wgt (UnitType p n N)) :=
pr (pairW w w) (clash p m N)<bp (-100*p.g*(N:ℝ))
structure veil (p : Shape) (M : ℕ) (b : PreparationParameters) (r : ℕ)
(l : Filter ℕ) (m : cycleM p) (s : rhythms p M) (w : tale p M) : Prop where
easel : AnalyticParameters p M b r
timeL : l≤atTop
durableS : b.durable l p M m w s
moment : ∀ᶠ n in l,b.nascent p (M*n) (w n) (m n) ∧ unaryGood (m n) b.pins r ∧
binaryGood (m n) ∧ conflicted p (m n) (M*n) (w n)
abbrev Stations (p : Shape) (M K : ℕ) (s : rhythms p M) :=
∀ n : ℕ, Station p n (M*n) K (s n)
theorem beam_cost (p : Shape) (N : ℕ) (h : 3≤p.g) :
beamPrice p N * bp (-100*p.g*(N:ℝ)) ≤ bp (-(N:ℝ)) := by
unfold beamPrice; rw [←bp_add]; refine bp_le ?_
have hh : kmax p ≤56*p.g := by unfold kmax; omega
have ht : (kmax p:ℝ)≤56*p.g := by exact_mod_cast hh
have hg : 3 ≤ (p.g:ℝ) := by exact_mod_cast h
apply le_trans ?_ (le_of_eq (neg_one_mul _))
rw [← add_mul]
exact mul_le_mul_of_nonneg_right (by linarith only [ht,hg]) (by positivity)
set_option maxHeartbeats 1200000 in
theorem veil.score_cost (h : veil p M b r l m s w)
(v : Stations p M b.pins s) :
∃ δ : ℕ → ℝ,ExpSmall l (fun n=> ((M*n:ℕ):ℝ)) δ ∧
∀ᶠ n in l, ∀ (q : Format) (d e : Rates) (x : Typus p q d e) (k : Fin (2^deckMax p b.pins)),
|arena (v n) x (m n) (w n) k|≤δ n := by
let N:=fun n : ℕ=> M*n; let z:=fun n=>((N n):ℝ)
have hq := h.easel
have ht := hq.enter.first
have hz : Tendsto z l atTop := (trend_sizes l h.timeL ht.hM).2
let C n:= ((s n).amount (w n))⁻¹
have hc := h.durableS.mass.inv_cap
let δ n := bp (-1*z n)*C n*C n + bp (-0.005*z n)*2
have hd : ExpSmall l z δ :=
(((ExpSmall.bp_n zero_lt_one).mul hc).mul hc).add hz
((ExpSmall.bp_n (by norm_num)).mul (expO_const hz _))
refine ⟨δ,hd,?_⟩
filter_upwards [h.moment,h.durableS.mass.positive,h.durableS.shape,hq.secure.filter_mono h.timeL]
with n hn hN hA hB q d e x k
have hm := hn.1.law
rw [abs_of_nonneg (arena_pos _ _ _ _ _ hN hm)]
let u:=(s n).sap (w n)
refine (arena_bound (v n) x _ _ k hA.1 hm hN hB).trans ?_
have hμ i : 0≤u i := (LeafMixture.sapLaw hN hm).nz _
have hk i : u i ≤ C n*w n i := LeafMixture.upper_sap hm hN i
have hv (x:UnitType p n (N n) × UnitType p n (N n)) :
pairW u u x ≤ (C n*C n)*pairW (w n) (w n) x :=
(mul_le_mul (hk _) (hk _) (hμ _) ((hμ _).trans (hk _))).trans_eq (by unfold pairW; ring)
have hf : pr (pairW u u) (clash p (m n) (N n)) ≤
(C n*C n)*bp (-100*p.g * (z n)) := (pr_cap hv _).trans
(mul_le_mul_of_nonneg_left hn.2.2.2.le (mul_self_nonneg _))
unfold δ
rw [mul_comm _ 2]
refine add_le_add_left ((mul_le_mul_of_nonneg_left hf (bp_pos _).le).trans ?_) _
calc _ = (beamPrice p (N n) * bp (-100 * p.g * z n))*(C n*C n) := by unfold beamPrice N; ring
_ ≤ _ := (mul_le_mul_of_nonneg_right (beam_cost p (N n) ht.hG) (mul_self_nonneg _)).trans_eq
(by unfold z; rw [neg_one_mul,mul_assoc])
structure Align (b : PreparationParameters) (r : ℕ) (p : Shape) (M n : ℕ) (m : Mixer p n)
(u : Wgt (UnitType p n (M*n))) : Prop where
rum : binaryGood m
hymn : unaryGood m b.pins r
age : 2*p.r ≤ n
cols : 2*num (Full p n)<(M*n:ℕ)
drain : Template.drained m b.spJoint u
set_option maxHeartbeats 1200000 in
theorem veil.upright (h : veil p M b r l m s w) :
∀ᶠ n in l,Align b r p M n (m n) ((s n).sap (w n)) := by
let z n:= ((M*n:ℕ):ℝ)
have ht := h.easel.enter.first
have hM : 1 ≤ (M:ℝ) := by exact_mod_cast ht.hM
let e : �� := 1/(128*M)
have he : 0< e:=by unfold e; positivity
have hz := (trend_sizes l h.timeL ht.hM).2
let D n:=((s n).amount (w n))⁻¹
filter_upwards [h.moment,h.durableS.mass.inv_cap e he,
h.durableS.mass.positive,expO_const hz b.L e he, ht.wrap.filter_mono h.timeL,
(eventually_ge_atTop (2*p.r)).filter_mono h.timeL] with n hn he' ht' hL hG hH
have hw := hn.1.law
have h1 (i) := LeafMixture.upper_sap hw ht' i
have h2 : 0≤D n := (inv_pos_of_pos ht').le
have hB : D n * b.L ≤ bp (1/32*(n:ℝ)) := by
have hi : e*z n=(1/128)*(n:ℝ) := by unfold e z; push_cast; field_simp
calc _ ≤ bp (e*z n)*bp (e*z n) :=
mul_le_mul ((le_abs_self _).trans he') ((le_abs_self _).trans hL) ht.early.hL
(bp_pos _).le
_ ≤ _ := by rw [←bp_add,hi]; apply bp_le; linarith [(Nat.cast_nonneg n :0≤(n:ℝ))]
have hv := LeafMixture.upperSide hn.1.border h1 h2 hB
refine ⟨hn.2.2.1,hn.2.1,hH,hG.1, LeafMixture.sapLaw ht' hw, hv true,hv false,fun i=>?_⟩
have hh := hn.1.total i
apply ((h1 i).trans (mul_le_mul_of_nonneg_left hh h2)).trans
rw [←mul_assoc]
refine mul_le_mul_of_nonneg_right ?_ (mul_nonneg (raw_nonneg ..) (raw_nonneg ..))
have hx : e ≤1 := by unfold e; exact (div_le_iff₀ (by positivity)).mpr (by linarith)
refine (mul_le_mul_of_nonneg_right ((le_abs_self _).trans he') (bp_pos _).le).trans ?_
rw [←bp_add]
unfold spJoint; refine bp_le ?_; rw [←add_mul]
exact mul_le_mul_of_nonneg_right (by linarith only [hx]) (by positivity)
end PreparationParameters
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PairedMassIdentitiesimport OAI.Combinatorics.HadwigerCounterexample.UnaryPositivityBoundsimport OAI.Combinatorics.HadwigerCounterexample.RecursiveComparisonErrorsimport OAI.Combinatorics.HadwigerCounterexample.MixerExistence
namespace OAI
/-! # Analytic Parameters -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Matrixopen scoped BigOperators Topologyopen StatusAnalysis StatusAnalysis.Station
def frameBills (g K : ℕ) := 2*Fintype.card (Comp g)*K*qorth K
structure AnalyticParameters (p : Shape) (M : ℕ) (b : PreparationParameters) (r : ℕ) : Prop where enter : b.entry p M thickness : 4≤ M profiles : 2*profileA p b.pins < r jump : 1≤p.J bigJ : r≤p.J gleaming : bp (-((p.J-r:ℕ):ℝ))*bp r < glintRate b.pins penRoom : (b.pins+1)*qorth b.pins≤p.j+1 forbid : frameBills p.g b.pins+1000 ≤ b.B spare : 3*b.B < Fintype.card (Label p.b) secure : ∀ᶠ n : ℕ in atTop, Station.earnsScore p n (M*n) b.pins (2*b.ζ)
namespace PreparationParametersvariable {b : PreparationParameters} {p : Shape} {N M r : ℕ} {l : Filter ℕ} {m : cycleM p} {s : rhythms p M} {w : tale p M}
def conflicted {n : ℕ} (p : Shape) (m : Mixer p n) (N : ℕ) (w : Wgt (UnitType p n N)) := pr (pairW w w) (clash p m N)<bp (-100*p.g*(N:ℝ))
structure veil (p : Shape) (M : ℕ) (b : PreparationParameters) (r : ℕ) (l : Filter ℕ) (m : cycleM p) (s : rhythms p M) (w : tale p M) : Prop where easel : AnalyticParameters p M b r timeL : l≤atTop durableS : b.durable l p M m w s moment : ∀ᶠ n in l,b.nascent p (M*n) (w n) (m n) ∧ unaryGood (m n) b.pins r ∧ binaryGood (m n) ∧ conflicted p (m n) (M*n) (w n)
abbrev Stations (p : Shape) (M K : ℕ) (s : rhythms p M) := ∀ n : ℕ, Station p n (M*n) K (s n)
theorem beam_cost (p : Shape) (N : ℕ) (h : 3≤p.g) : beamPrice p N * bp (-100*p.g*(N:ℝ)) ≤ bp (-(N:ℝ)) := by unfold beamPrice; rw [←bp_add]; refine bp_le ?_ have hh : kmax p ≤56*p.g := by unfold kmax; omega have ht : (kmax p:ℝ)≤56*p.g := by exact_mod_cast hh have hg : 3 ≤ (p.g:ℝ) := by exact_mod_cast h apply le_trans ?_ (le_of_eq (neg_one_mul _)) rw [← add_mul] exact mul_le_mul_of_nonneg_right (by linarith only [ht,hg]) (by positivity)
set_option maxHeartbeats 1200000 intheorem veil.score_cost (h : veil p M b r l m s w) (v : Stations p M b.pins s) : ∃ δ : ℕ → ℝ,ExpSmall l (fun n=> ((M*n:ℕ):ℝ)) δ ∧ ∀ᶠ n in l, ∀ (q : Format) (d e : Rates) (x : Typus p q d e) (k : Fin (2^deckMax p b.pins)), |arena (v n) x (m n) (w n) k|≤δ n := by let N:=fun n : ℕ=> M*n; let z:=fun n=>((N n):ℝ) have hq := h.easel have ht := hq.enter.first have hz : Tendsto z l atTop := (trend_sizes l h.timeL ht.hM).2 let C n:= ((s n).amount (w n))⁻¹ have hc := h.durableS.mass.inv_cap let δ n := bp (-1*z n)*C n*C n + bp (-0.005*z n)*2 have hd : ExpSmall l z δ := (((ExpSmall.bp_n zero_lt_one).mul hc).mul hc).add hz ((ExpSmall.bp_n (by norm_num)).mul (expO_const hz _)) refine ⟨δ,hd,?_⟩ filter_upwards [h.moment,h.durableS.mass.positive,h.durableS.shape,hq.secure.filter_mono h.timeL] with n hn hN hA hB q d e x k have hm := hn.1.law rw [abs_of_nonneg (arena_pos _ _ _ _ _ hN hm)] let u:=(s n).sap (w n) refine (arena_bound (v n) x _ _ k hA.1 hm hN hB).trans ?_ have hμ i : 0≤u i := (LeafMixture.sapLaw hN hm).nz _ have hk i : u i ≤ C n*w n i := LeafMixture.upper_sap hm hN i have hv (x:UnitType p n (N n) × UnitType p n (N n)) : pairW u u x ≤ (C n*C n)*pairW (w n) (w n) x := (mul_le_mul (hk _) (hk _) (hμ _) ((hμ _).trans (hk _))).trans_eq (by unfold pairW; ring) have hf : pr (pairW u u) (clash p (m n) (N n)) ≤ (C n*C n)*bp (-100*p.g * (z n)) := (pr_cap hv _).trans (mul_le_mul_of_nonneg_left hn.2.2.2.le (mul_self_nonneg _)) unfold δ rw [mul_comm _ 2] refine add_le_add_left ((mul_le_mul_of_nonneg_left hf (bp_pos _).le).trans ?_) _ calc _ = (beamPrice p (N n) * bp (-100 * p.g * z n))*(C n*C n) := by unfold beamPrice N; ring _ ≤ _ := (mul_le_mul_of_nonneg_right (beam_cost p (N n) ht.hG) (mul_self_nonneg _)).trans_eq (by unfold z; rw [neg_one_mul,mul_assoc])
structure Align (b : PreparationParameters) (r : ℕ) (p : Shape) (M n : ℕ) (m : Mixer p n) (u : Wgt (UnitType p n (M*n))) : Prop where rum : binaryGood m hymn : unaryGood m b.pins r age : 2*p.r ≤ n cols : 2*num (Full p n)<(M*n:ℕ) drain : Template.drained m b.spJoint u
set_option maxHeartbeats 1200000 intheorem veil.upright (h : veil p M b r l m s w) : ∀ᶠ n in l,Align b r p M n (m n) ((s n).sap (w n)) := by let z n:= ((M*n:ℕ):ℝ) have ht := h.easel.enter.first have hM : 1 ≤ (M:ℝ) := by exact_mod_cast ht.hM let e : ℝ := 1/(128*M) have he : 0< e:=by unfold e; positivity have hz := (trend_sizes l h.timeL ht.hM).2 let D n:=((s n).amount (w n))⁻¹ filter_upwards [h.moment,h.durableS.mass.inv_cap e he, h.durableS.mass.positive,expO_const hz b.L e he, ht.wrap.filter_mono h.timeL, (eventually_ge_atTop (2*p.r)).filter_mono h.timeL] with n hn he' ht' hL hG hH have hw := hn.1.law have h1 (i) := LeafMixture.upper_sap hw ht' i have h2 : 0≤D n := (inv_pos_of_pos ht').le have hB : D n * b.L ≤ bp (1/32*(n:ℝ)) := by have hi : e*z n=(1/128)*(n:ℝ) := by unfold e z; push_cast; field_simp calc _ ≤ bp (e*z n)*bp (e*z n) := mul_le_mul ((le_abs_self _).trans he') ((le_abs_self _).trans hL) ht.early.hL (bp_pos _).le _ ≤ _ := by rw [←bp_add,hi]; apply bp_le; linarith [(Nat.cast_nonneg n :0≤(n:ℝ))] have hv := LeafMixture.upperSide hn.1.border h1 h2 hB refine ⟨hn.2.2.1,hn.2.1,hH,hG.1, LeafMixture.sapLaw ht' hw, hv true,hv false,fun i=>?_⟩ have hh := hn.1.total i apply ((h1 i).trans (mul_le_mul_of_nonneg_left hh h2)).trans rw [←mul_assoc] refine mul_le_mul_of_nonneg_right ?_ (mul_nonneg (raw_nonneg ..) (raw_nonneg ..)) have hx : e ≤1 := by unfold e; exact (div_le_iff₀ (by positivity)).mpr (by linarith) refine (mul_le_mul_of_nonneg_right ((le_abs_self _).trans he') (bp_pos _).le).trans ?_ rw [←bp_add] unfold spJoint; refine bp_le ?_; rw [←add_mul] exact mul_le_mul_of_nonneg_right (by linarith only [hx]) (by positivity)end PreparationParametersend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148import OAI.Combinatorics.HadwigerCounterexample.QuadraticTesters
import OAI.Combinatorics.HadwigerCounterexample.KeyDirections
import OAI.Combinatorics.HadwigerCounterexample.SumRankBounds
namespace OAI
/-! # Atom Flavors -/
noncomputable section
namespace HadwigerCounterexample
open Matrix LinearMap Finset Function
open scoped BigOperators
variable {g r n b : ℕ} {p : Shape}
abbrev Flavor (g : ℕ) := Option (Option (Finset (Tag g × Tag g)))
namespace Flavor
abbrev full {g : ℕ} : Flavor g := none
abbrev sharedOnly {g : ℕ} : Flavor g := some none
abbrev pure {g : ℕ} (s : Finset (Tag g × Tag g)) : Flavor g := some (some s)
def keeps (f : Flavor g) (x : Tag g) (y : Block g) : Prop :=
match f,y with
| none, .inl (i,_) => allowed i x
| some none,.inl _ => False
| some (some s),.inl (i,j) => allowed i x ∧ (i,j) ∈ s
| some (some _), .inr v => v≠0
| _, .inr _ => True
instance (f : Flavor g) (x : Tag g) (y : Block g) : Decidable (keeps f x y) :=
Classical.propDecidable _
theorem keep_o {f : Flavor g} {x : Tag g} {i j}
(h : keeps f x (Block.O i j)) : allowed i x := by
rcases f with (_|_|_) <;> simp [keeps] at h
· exact h
exact h.1
theorem keepZ (f : Flavor g) (x : Tag g) : keeps f x Block.Z := by
rcases f with (_|_|_) <;> simp [keeps]
theorem keepSharp (f : Flavor g) (x : Tag g) : keeps f x Block.sharp := by
rcases f with (_|_|_) <;> simp [keeps]
end Flavor
abbrev Knobs (g n : ℕ) := Block g → Vec (Fin n)
def lit (f : Flavor g) (x : Tag g) (y : Knobs g n) : Base g n :=
fun i => if f.keeps x i.1 then y i.1 i.2 else 0
theorem lit_allows (f : Flavor g) (x : Tag g) (y : Knobs g n) :
allows x (lit f x y) :=
fun _ _ h _ => ite_eq_right (fun g => h (Flavor.keep_o g))
def useAtom (p : Shape) {n : ℕ} (x : Tag p.g) (s : Label p.b) (f : Flavor p.g)
(y : Knobs p.g n) := atom p x s (lit f x y)
theorem mem_useAtom (p : Shape) {n : ℕ} (x : Tag p.g) (s : Label p.b)
(f : Flavor p.g) (y : Knobs p.g n) : useAtom p x s f y∈Xspace p n :=
atom_mem s (lit_allows f x y)
abbrev ProbeIdx (g : ℕ) := (Tag g × Tag g)⊕Unit
abbrev Digest (g : ℕ) := Vec (ProbeIdx g)
def asBlock (i : ProbeIdx g) : Block g := i.elim (fun q => Block.O q.1 q.2) (fun _ => Block.S)
theorem asBlock_inj {g : ℕ} : Injective (@asBlock g) := by
rintro (⟨i,j⟩|⟨⟩) (⟨k,l⟩|⟨⟩) e <;> simp_all [asBlock,Block.O,Block.S]
def zget (y : Vec (Fin n)) (i : ℕ) := if h:i<n then y ⟨i,h⟩ else 0
def tested (r : ℕ) (y : Vec (Fin n)) :=
∑ i : Fin r,zget y (2*i.val)*zget y (2*i.val+1)
def scan (p : Shape) {n} (l : Tag p.g) (f : Flavor p.g) (x : Knobs p.g n) :
Digest p.g :=
fun i => if Flavor.keeps f l (asBlock i) then tested p.r (x (asBlock i)) else 0
namespace Digest
variable (q : Digest g)
def feasible (l : Tag g) (f : Flavor g) := ∀ i,¬ Flavor.keeps f l (asBlock i) → q i=0
def diagO := ∑ d : Tag g, ∑ t,q (.inl (d,t))
def sumBit := q.diagO+q (.inr ())
end Digest
theorem scan_feasible (p : Shape) {n} (l) (f : Flavor p.g) (x : Knobs p.g n) :
(scan p l f x).feasible l f := fun _ h => ite_eq_right h
theorem scan_is (p : Shape) {n} (l) (s : Label p.b) (f : Flavor p.g) (x : Knobs p.g n)
(i : ProbeIdx p.g) :
scan p l f x i=etab p n (asBlock i) (mom p s (lit f l x)) := by
classical
rw [mom,etab_point]
let d := asBlock i
unfold scan
split
· rename_i he
have hg j : readBit (lit f l x) d j=zget (x d) j := by
by_cases h : j<n <;> simp [readBit,zget,h,lit,d,he]
unfold tested test
simp_rw [show ∀ j, readBit (lit f l x) (asBlock i) j=zget (x (asBlock i)) j from hg]
rename_i he
unfold test
have hZ j :
readBit (lit f l x) (asBlock i) j=0 := by
by_cases h : j<n <;> simp [readBit,lit,h,he]
simp_rw [hZ,zero_mul,Finset.sum_const_zero]
theorem etaScan (p : Shape) {n} (l s f) (x : Knobs p.g n) :
(scan p l f x).sumBit=eta p n (mom p s (lit f l x)) := by
simp only [Digest.sumBit,Digest.diagO,eta,etaO,LinearMap.add_apply,LinearMap.sum_apply]
simp_rw [scan_is p l s]
rfl
theorem role_scan (p : Shape) {n} (l s f) (x : Knobs p.g n) :
role p n (useAtom p l s f x)=(scan p l f x).diagO := by
unfold Digest.diagO useAtom atom
let M := mom p s (lit f l x)
have h (i : Tag p.g) :
(Pi.single l M : Tag p.g → Moment p n) i∈Wtag p n i := by
by_cases h : i=l
· subst i; rw [Pi.single_eq_same]
exact Submodule.subset_span ⟨_,_,lit_allows f l x,rfl⟩
simp [h]
rw [role_cut _ _ h,Finset.sum_eq_single l]
· rw [Pi.single_eq_same,etaO,LinearMap.sum_apply]
simp_rw [LinearMap.sum_apply,scan_is p l s]
rfl
· intro i _ hi; simp [hi]
simp
def dialed (p : Shape) {n} (l : Tag p.g) (f : Flavor p.g) (x : Knobs p.g n) :=
(scan p l f x).sumBit
def spins (p : Shape) (n : ℕ) : Wgt (Knobs p.g n) := draws (Block p.g) unif
theorem spins_law (p : Shape) (n : ℕ) : IsLaw (spins p n) := draws_law unif_law
/-- Projection notation for conditioning on a specified (possible)
diagnostic or diagonal only. -/
def scopedBit (p : Shape) (n : ℕ) (l : Tag p.g) (f : Flavor p.g) (q : F) :
Wgt (Knobs p.g n) := onW (spins p n) (fun x => dialed p l f x=q)
def scopedScan (p : Shape) (n : ℕ) (l : Tag p.g) (f : Flavor p.g) (z : Digest p.g) :
Wgt (Knobs p.g n) := onW (spins p n) (fun x => scan p l f x=z)
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.QuadraticTestersimport OAI.Combinatorics.HadwigerCounterexample.KeyDirectionsimport OAI.Combinatorics.HadwigerCounterexample.SumRankBounds
namespace OAI
/-! # Atom Flavors -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix LinearMap Finset Functionopen scoped BigOperatorsvariable {g r n b : ℕ} {p : Shape}
abbrev Flavor (g : ℕ) := Option (Option (Finset (Tag g × Tag g)))namespace Flavorabbrev full {g : ℕ} : Flavor g := noneabbrev sharedOnly {g : ℕ} : Flavor g := some noneabbrev pure {g : ℕ} (s : Finset (Tag g × Tag g)) : Flavor g := some (some s)
def keeps (f : Flavor g) (x : Tag g) (y : Block g) : Prop := match f,y with | none, .inl (i,_) => allowed i x | some none,.inl _ => False | some (some s),.inl (i,j) => allowed i x ∧ (i,j) ∈ s | some (some _), .inr v => v≠0 | _, .inr _ => Trueinstance (f : Flavor g) (x : Tag g) (y : Block g) : Decidable (keeps f x y) := Classical.propDecidable _
theorem keep_o {f : Flavor g} {x : Tag g} {i j} (h : keeps f x (Block.O i j)) : allowed i x := by rcases f with (_|_|_) <;> simp [keeps] at h · exact h exact h.1
theorem keepZ (f : Flavor g) (x : Tag g) : keeps f x Block.Z := by rcases f with (_|_|_) <;> simp [keeps]theorem keepSharp (f : Flavor g) (x : Tag g) : keeps f x Block.sharp := by rcases f with (_|_|_) <;> simp [keeps]
end Flavor
abbrev Knobs (g n : ℕ) := Block g → Vec (Fin n)
def lit (f : Flavor g) (x : Tag g) (y : Knobs g n) : Base g n := fun i => if f.keeps x i.1 then y i.1 i.2 else 0
theorem lit_allows (f : Flavor g) (x : Tag g) (y : Knobs g n) : allows x (lit f x y) := fun _ _ h _ => ite_eq_right (fun g => h (Flavor.keep_o g))
def useAtom (p : Shape) {n : ℕ} (x : Tag p.g) (s : Label p.b) (f : Flavor p.g) (y : Knobs p.g n) := atom p x s (lit f x y)theorem mem_useAtom (p : Shape) {n : ℕ} (x : Tag p.g) (s : Label p.b) (f : Flavor p.g) (y : Knobs p.g n) : useAtom p x s f y∈Xspace p n := atom_mem s (lit_allows f x y)
abbrev ProbeIdx (g : ℕ) := (Tag g × Tag g)⊕Unitabbrev Digest (g : ℕ) := Vec (ProbeIdx g)
def asBlock (i : ProbeIdx g) : Block g := i.elim (fun q => Block.O q.1 q.2) (fun _ => Block.S)theorem asBlock_inj {g : ℕ} : Injective (@asBlock g) := by rintro (⟨i,j⟩|⟨⟩) (⟨k,l⟩|⟨⟩) e <;> simp_all [asBlock,Block.O,Block.S]
def zget (y : Vec (Fin n)) (i : ℕ) := if h:i<n then y ⟨i,h⟩ else 0def tested (r : ℕ) (y : Vec (Fin n)) := ∑ i : Fin r,zget y (2*i.val)*zget y (2*i.val+1)
def scan (p : Shape) {n} (l : Tag p.g) (f : Flavor p.g) (x : Knobs p.g n) : Digest p.g := fun i => if Flavor.keeps f l (asBlock i) then tested p.r (x (asBlock i)) else 0
namespace Digestvariable (q : Digest g)
def feasible (l : Tag g) (f : Flavor g) := ∀ i,¬ Flavor.keeps f l (asBlock i) → q i=0
def diagO := ∑ d : Tag g, ∑ t,q (.inl (d,t))def sumBit := q.diagO+q (.inr ())
end Digest
theorem scan_feasible (p : Shape) {n} (l) (f : Flavor p.g) (x : Knobs p.g n) : (scan p l f x).feasible l f := fun _ h => ite_eq_right h
theorem scan_is (p : Shape) {n} (l) (s : Label p.b) (f : Flavor p.g) (x : Knobs p.g n) (i : ProbeIdx p.g) : scan p l f x i=etab p n (asBlock i) (mom p s (lit f l x)) := by classical rw [mom,etab_point] let d := asBlock i unfold scan split · rename_i he have hg j : readBit (lit f l x) d j=zget (x d) j := by by_cases h : j<n <;> simp [readBit,zget,h,lit,d,he] unfold tested test simp_rw [show ∀ j, readBit (lit f l x) (asBlock i) j=zget (x (asBlock i)) j from hg] rename_i he unfold test have hZ j : readBit (lit f l x) (asBlock i) j=0 := by by_cases h : j<n <;> simp [readBit,lit,h,he] simp_rw [hZ,zero_mul,Finset.sum_const_zero]
theorem etaScan (p : Shape) {n} (l s f) (x : Knobs p.g n) : (scan p l f x).sumBit=eta p n (mom p s (lit f l x)) := by simp only [Digest.sumBit,Digest.diagO,eta,etaO,LinearMap.add_apply,LinearMap.sum_apply] simp_rw [scan_is p l s] rfl
theorem role_scan (p : Shape) {n} (l s f) (x : Knobs p.g n) : role p n (useAtom p l s f x)=(scan p l f x).diagO := by unfold Digest.diagO useAtom atom let M := mom p s (lit f l x) have h (i : Tag p.g) : (Pi.single l M : Tag p.g → Moment p n) i∈Wtag p n i := by by_cases h : i=l · subst i; rw [Pi.single_eq_same] exact Submodule.subset_span ⟨_,_,lit_allows f l x,rfl⟩ simp [h] rw [role_cut _ _ h,Finset.sum_eq_single l] · rw [Pi.single_eq_same,etaO,LinearMap.sum_apply] simp_rw [LinearMap.sum_apply,scan_is p l s] rfl · intro i _ hi; simp [hi] simp
def dialed (p : Shape) {n} (l : Tag p.g) (f : Flavor p.g) (x : Knobs p.g n) := (scan p l f x).sumBit
def spins (p : Shape) (n : ℕ) : Wgt (Knobs p.g n) := draws (Block p.g) unif
theorem spins_law (p : Shape) (n : ℕ) : IsLaw (spins p n) := draws_law unif_law
/-- Projection notation for conditioning on a specified (possible)diagnostic or diagonal only. -/def scopedBit (p : Shape) (n : ℕ) (l : Tag p.g) (f : Flavor p.g) (q : F) : Wgt (Knobs p.g n) := onW (spins p n) (fun x => dialed p l f x=q)def scopedScan (p : Shape) (n : ℕ) (l : Tag p.g) (f : Flavor p.g) (z : Digest p.g) : Wgt (Knobs p.g n) := onW (spins p n) (fun x => scan p l f x=z)
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277import OAI.Combinatorics.HadwigerCounterexample.ResponseAnnihilators
namespace OAI
/-! # Attack Cut Decomposition -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Submodule LinearMap Module Finset
open scoped BigOperators
variable {p : Shape} {n : ℕ}
variable {I J : Type} [Fintype I] [Fintype J]
theorem colSp_kill (S : Space (Vec I)) (M : Mat I J) :
colSp M ≤ annih S ↔ ∀ x∈S,Mᵀ *ᵥ x=0 := by
constructor
· intro h x hx
refine dot_ext_zero fun y => ?_
rw [dotProduct_transpose_mulVec,dotProduct_comm]
exact (annih_mem ..).mp (h ⟨y,rfl⟩) x hx
rintro h z ⟨y,rfl⟩
rw [annih_mem]; intro x hx
rw [dotProduct_comm,mulVecLin_apply,←dotProduct_transpose_mulVec,h x hx,dotProduct_zero]
theorem box_kill {S : Space (Vec I)} {T : Space (Vec J)} {M : Mat I J} :
M∈box (annih S) (annih T) ↔ (∀ x∈S,Mᵀ *ᵥ x=0) ∧ (∀ y ∈ T,M *ᵥ y=0) := by
rw [box_mem,colSp_kill,colSp_kill,transpose_transpose]
theorem orth_sub {f b : Plan p n} {x y : Xpair p n} {C : ChanOut p n} {j}
(hx : orth p C f b j x) (hy : orth p C f b j y) : orth p C f b j (x-y) := by
intro D hd A ha; rw [map_sub,hx _ hd _ ha,hy _ hd _ ha,sub_self]
theorem orth_sum {f b : Plan p n} (x : I→Xpair p n) (c : I→F) {C : ChanOut p n} {j}
(hx : ∀ i,orth p C f b j (x i)) : orth p C f b j (∑ i,c i • x i) := by
intro D hd A ha
rw [map_sum]
refine Finset.sum_eq_zero fun i _ => ?_
rw [map_smul,hx i _ hd _ ha,smul_zero]
namespace Volley
variable (v : Volley p n I)
def strike (t : Tagging p I) (ht : v.legal t) (j : I) : Xpair p n :=
Pi.single (v.obj j) (⟨v.atomAt t j,atom_mem _ (ht j)⟩ : Xspace p n)
theorem strike_here (t : Tagging p I) (ht : v.legal t)
(c : I → F) (i : Bool) :
((∑ j : I, c j • v.strike t ht j) i).val=∑ j∈v.here i,c j • v.atomAt t j := by
classical
rw [Finset.sum_apply]
simp only [Submodule.coe_sum, Pi.smul_apply,Submodule.coe_smul,here,Finset.sum_filter]
refine Finset.sum_congr rfl fun j _ => ?_
by_cases h : v.obj j=i
· simp only [ite_eq_left h]
unfold strike
rw [h,Pi.single_eq_same]
simp [strike,h]
omit [Fintype I] in
theorem strike_pair (t : Tagging p I) (ht : v.legal t) (j : I) (e : Comp p.g) :
purePair p n (v.strike t ht j) e=
if inc e (t j) then vecMulVec (v.rayLoc j) (v.rayLoc j) else 0 := by
classical
simp only [purePair, Finset.sum_apply]
rw [Finset.sum_eq_single (v.obj j)]
· rw [strike,Pi.single_eq_same]
change liftM _ _ (atom p _ _ _ e)=_
rw [atom_def]; split
· exact liftM_outer _ _ _ _
rw [map_zero]
· intro i _ hi; rw [strike,Pi.single_eq_of_ne hi]; exact map_zero _
simp
theorem strike_orth {a b : Plan p n} {C : ChanOut p n} {i : Bool}
(t : Tagging p I) (ht : v.legal t) (j : I) :
orth p C (v.frozen a t) b i (v.strike t ht j) := by
intro D hd A ha
change ∑ e, _ = _
refine Finset.sum_eq_zero fun e _ => ?_
rw [v.strike_pair]
by_cases h : inc e (t j)
· have hy (z) : v.rayLoc j ∈ (v.frozen a t (e,z)) :=
Submodule.mem_sup_right (colSp_mem (P:=v.keyM t e) (⟨j,h⟩ : visits p t e))
let V := v.rayLoc j
have h1 : A e *ᵥ V=0 := (box_kill.mp ((pureSpace_mem _).mp ha e)).2 V (hy false)
have h2 (z) : D (e,z) *ᵥ V=0 :=
(box_kill.mp ((deltaSpace_mem _).mp hd _)).2 V (hy z)
rw [ite_eq_left h,mpair_outer,evmat]
change dotProduct V (((C (e,true))ᵀ * D (e,false)+
(D (e,true))ᵀ * C (e,false)+A e) *ᵥ V)=_
simp only [Matrix.add_mulVec, ← Matrix.mulVec_mulVec,h1,h2,mulVec_zero,
dotProduct_zero,zero_add,add_zero,dotProduct_transpose_mulVec]
rw [ite_eq_right h,map_zero]
end Volley
def labStruct (p : Shape) (n : ℕ) (M : Moment p n) (R : ℕ)
(L : Finset (Label p.b)) (Z : Label p.b→BaseMat p n) :=
M=labelSum p L Z ∧ L.card ≤ R ∧ (∀ s,s∉L → Z s=0) ∧
∀ s∈L,(Z s)ᵀ=Z s ∧ ∀ i,Z s i i=Z s none i
private theorem struct_tri {M1 M2 M3 : Moment p n} {R : ℕ}
{L1 L2 L3 : Finset (Label p.b)} {Z1 Z2 Z3 : Label p.b→BaseMat p n}
(h1 : labStruct p n M1 R L1 Z1)
(h2 : labStruct p n M2 R L2 Z2)
(h3 : labStruct p n M3 R L3 Z3)
(hr : 3*R≤p.j) (hm : M1+M2+M3=0) (s : Label p.b) :
Z1 s+Z2 s+Z3 s=0 := by
classical
let W := L1∪L2∪L3
have hs1 : L1⊆W := subset_trans subset_union_left subset_union_left
have hs2 : L2⊆W := subset_trans subset_union_right subset_union_left
have hs3 : L3⊆W := subset_union_right
have hh : W.card ≤ p.j+1 :=
(Finset.card_union_le (L1∪L2) L3).trans ((add_le_add
((Finset.card_union_le L1 L2).trans (add_le_add h1.2.1 h2.2.1)) h3.2.1).trans (by omega))
by_cases hs : s∈W
· have hv {M : Moment p n} {L Z} (h : labStruct p n M R L Z) (hL : L ⊆ W)
(i j : AIdx p.g n) (r : SelIdx p.b p.j) :
(∑ s∈W,Z s i j*monoBit s r.val) = M (r,i) (emptySel,j) := by
rw [h.1,labelSum, Matrix.sum_apply,←Finset.sum_subset hL]
· simp only [mput_apply,emptySel,monoBit,Finset.prod_empty,mul_one,mul_comm]
intro y _ hy
simp [h.2.2.1 y hy]
ext i j
refine selector_indep W (fun s => (Z1 s i j+Z2 s i j+Z3 s i j)) p.j hh ?_ s hs
intro T hT
let r : SelIdx p.b p.j := ⟨T,hT⟩
simp only [add_mul,Finset.sum_add_distrib]
rw [hv h1 hs1 i j r,hv h2 hs2 i j r,hv h3 hs3 i j r]
exact congr_fun (congr_fun hm (r,i)) (emptySel,j)
rw [h1.2.2.1 s (fun h => hs (hs1 h)), h2.2.2.1 s (fun h => hs (hs2 h)),
h3.2.2.1 s (fun h => hs (hs3 h)), zero_add,zero_add]
namespace Volley
variable {v : Volley p n I}
private theorem orth_structure {x : Xpair p n} {a b : Plan p n}
{C : ChanOut p n} {t : Tagging p I} {w : I→Bool} {j : Bool}
(hb : v.bounded w) (ho : orth p C (v.frozen a t) b j x)
(R : ℕ) (hr : 2*planRank a+28≤R) (hj : 6*R+4 ≤ p.j)
(i : Bool) (e : Comp p.g) :
∃ L Z,labStruct p n ((x i).val e) R L Z := by
classical
have h (z) := v.frozen_here_dim hb a t i z
have he : ((x i).val e).rank ≤ R :=
(rank_vanish (vanish_one ho i e)).trans
((Nat.add_le_add (h (e,true)) (h (e,false))).trans (by omega))
have hf : ((x i).val e)∈ Wspace p n := by
obtain ⟨w,h,hx⟩ := mem_X.mp (x i).property
rw [← hx]
exact ((Wspace p n).add_mem ((Wtag_le _) (h e.val.1)) ((Wtag_le _) (h e.val.2)))
obtain ⟨L,Z,hL,_,hZ,hA⟩ := label_support hf R hj he
let g (s : Label p.b) := if s∈L then Z s else 0
refine ⟨L,g,?_,hL,(fun s hs => ite_eq_right hs), fun s hs => ?_⟩
· rw [hZ]
exact Finset.sum_congr rfl fun s hs => by simp [g,hs]
simp only [g,ite_eq_left hs]
exact hA _ hs
private theorem edge_at (l : Tag p.g) (e : Comp p.g) (h : inc e l) :
∃ (k : Tag p.g) (h : l≠k),e = edge l k h := by
rcases e with ⟨⟨i,j⟩,hj⟩
change i=l∨j=l at h
rcases h with rfl|rfl
· exact ⟨j,hj.ne,(edge_eq hj).symm⟩
exact ⟨i,hj.ne.symm, by rw [edge_symm,edge_eq hj]⟩
private theorem cut_tri {x : Profile p n} (hx : x∈Xspace p n)
(l k j : Tag p.g) (h : l≠k) (h' : l ≠ j) (h'' : k≠j) :
x (edge l k h)+x (edge l j h')+x (edge k j h'')=0 := by
obtain ⟨w,hv,rfl⟩ := mem_X.mp hx
rw [← getPair_edge l k h (cut p n w), ←getPair_edge l j h' (cut p n w), ←getPair_edge k j h'' (cut p n w),
getPair_cut,getPair_cut,getPair_cut]
have he (x y z : Moment p n) : x+y+(x+z)+(y+z)=0 := calc
_ = (x+x)+(y+y)+(z+z) := by ac_rfl
_ = _ := by simp only [char_two]
exact he _ _ _
private theorem structure_mark {x : Xpair p n} {a b : Plan p n}
{C : ChanOut p n} {t : Tagging p I} {w : I→Bool} {j : Bool}
{q R : ℕ} (hb : v.bounded w) (ho : orth p C (v.frozen a t) b j x) (hv : v.avoids a q)
(hr : 6*R+4≤p.j) (hq : R+14≤q)
(l : I)
{L : Comp p.g → Finset (Label p.b)} {Z : Comp p.g → Label p.b → BaseMat p n}
(he : ∀ e,labStruct p n ((x (v.obj l)).val e) R (L e) (Z e)) :
∃ c : F, ∀ e,mput p (v.sel l) (Z e (v.sel l))=c • v.atomAt t l e := by
classical
let s := v.sel l
let u := t l
let M := vecMulVec (baseV (v.par l)) (baseV (v.par l))
let coeff := fun e : Comp p.g => Z e s none none
have h1 (e : Comp p.g) : Z e s= if inc e u then coeff e • M else 0 := by
have ⟨hE,hL,hT,hH⟩ := he e
exact mark_atom hb t hv l e _ (le_trans (Nat.add_le_add_right hL 14) hq)
_ hT hH (hE ▸ vanish_one ho (v.obj l) e)
have h2 (e f : Comp p.g) (h : inc e u) (h' : inc f u) :
coeff e=coeff f := by
by_cases hi : e=f
· rw [hi]
obtain ⟨k,hk,rfl⟩ := edge_at u e h
obtain ⟨u2,hl,rfl⟩ := edge_at u f h'
have hj : k ≠ u2 := by rintro rfl; exact hi rfl
have hh := cut_tri (x (v.obj l)).property u k u2 hk hl hj
have heq := struct_tri (he (edge u k hk)) (he (edge u u2 hl)) (he (edge k u2 hj))
(by omega) hh s
have hn : ¬ inc (edge k u2 hj) u := fun he => by
rcases (inc_edge_iff _).mp he with h|h; exact hk h.symm; exact hl h.symm
rw [h1 (edge k u2 hj), ite_eq_right hn,add_zero] at heq
have h0 := congr_fun (congr_fun heq none) none
change coeff _ + coeff _ = 0 at h0
exact add_right_cancel (h0.trans (char_two _).symm)
have h3 (e) : mput p s (Z e s)= coeff e • v.atomAt t l e := by
rw [h1,atomAt,atom_def]
by_cases hf : inc e u
· rw [ite_eq_left hf,ite_eq_left hf,map_smul]
change coeff e • liftM (labMat p n s) (labMat p n s) M=_
unfold M
rw [liftM_outer,labMat_act]; rfl
rw [ite_eq_right hf,ite_eq_right hf,map_zero,smul_zero]
by_cases hh : ∃ e,inc e u
· obtain ⟨f,hf⟩ := hh
refine ⟨coeff f,fun e => ?_⟩
by_cases h : inc e u
· exact (h3 e).trans (by rw [h2 e f h hf])
refine (h3 e).trans ?_
rw [atomAt,atom_def,ite_eq_right h,smul_zero,smul_zero]
refine ⟨0,fun e => ?_��
refine (h3 e).trans ?_
rw [atomAt,atom_def,ite_eq_right (show ¬inc e u from fun he => hh ⟨e,he⟩),
smul_zero,zero_smul]
/-- a component uses at most R nonattack labels. -/
def clean (v : Volley p n I) (i : Bool) (R : ℕ) (M : Moment p n) :=
∃ (L : Finset (Label p.b)) (Z : Label p.b → BaseMat p n),
M=labelSum p L Z ∧ L.card≤R ∧ Disjoint L (v.marked i)
theorem split_orth {x : Xpair p n} {a b : Plan p n}
{C : ChanOut p n} {t : Tagging p I} {w : I→Bool} {j : Bool}
{q R : ℕ} (hb : v.bounded w) (ht : v.legal t)
(ho : orth p C (v.frozen a t) b j x) (hv : v.avoids a q)
(hr : 6*R+4≤p.j) (hr' : 2*planRank a+28≤R) (hq : R+14≤q) :
∃ (c : I → F) (y : Xpair p n), x=y+∑ i,c i • v.strike t ht i ∧
orth p C (v.frozen a t) b j y ∧ ∀ i e,v.clean i R ((y i).val e) := by
classical
choose L Z hZ using orth_structure hb ho R hr' hr
choose c hc using fun l => structure_mark hb ho hv hr hq l (hZ (v.obj l))
let A := ∑ i,c i • v.strike t ht i
refine ⟨c,x-A,(sub_add_cancel x A).symm,orth_sub ho (orth_sum _ _ (v.strike_orth t ht)),
fun i e => ?_⟩
obtain ⟨B,h1,hA,hv',h3⟩ := hv i
let T := v.marked i
have he : (A i).val e=labelSum p T (Z i e) := by
rw [show (A i).val=_ from v.strike_here t ht c i, Finset.sum_apply]
dsimp only [labelSum,T,marked]
rw [Finset.sum_image h3]
refine Finset.sum_congr rfl fun l hl => ?_
have he : v.obj l=i := (mem_filter.mp hl).2
exact (he ▸ hc l e).symm
let W := L i e
refine ⟨W \ T,Z i e,?_,(Finset.card_le_card sdiff_subset).trans (hZ i e).2.1, ?_⟩
· change (x i).val e-(A i).val e=_
rw [(hZ i e).1,he]
have hz : labelSum p W (Z i e)=labelSum p (W∪T) (Z i e) := by
refine Finset.sum_subset subset_union_left fun s _ hs => ?_
rw [(hZ i e).2.2.1 s hs,map_zero]
rw [hz]
have hS : (W∪T)=(W \ T) ∪ T := by ext i; simp
rw [hS,labelSum,Finset.sum_union (show Disjoint (W \ T) T from Disjoint.symm disjoint_sdiff)]
exact add_sub_cancel_right _ _
exact Disjoint.symm disjoint_sdiff
end Volley
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.ResponseAnnihilators
namespace OAI
/-! # Attack Cut Decomposition -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Submodule LinearMap Module Finsetopen scoped BigOperatorsvariable {p : Shape} {n : ℕ}variable {I J : Type} [Fintype I] [Fintype J]
theorem colSp_kill (S : Space (Vec I)) (M : Mat I J) : colSp M ≤ annih S ↔ ∀ x∈S,Mᵀ *ᵥ x=0 := by constructor · intro h x hx refine dot_ext_zero fun y => ?_ rw [dotProduct_transpose_mulVec,dotProduct_comm] exact (annih_mem ..).mp (h ⟨y,rfl⟩) x hx rintro h z ⟨y,rfl⟩ rw [annih_mem]; intro x hx rw [dotProduct_comm,mulVecLin_apply,←dotProduct_transpose_mulVec,h x hx,dotProduct_zero]
theorem box_kill {S : Space (Vec I)} {T : Space (Vec J)} {M : Mat I J} : M∈box (annih S) (annih T) ↔ (∀ x∈S,Mᵀ *ᵥ x=0) ∧ (∀ y ∈ T,M *ᵥ y=0) := by rw [box_mem,colSp_kill,colSp_kill,transpose_transpose]
theorem orth_sub {f b : Plan p n} {x y : Xpair p n} {C : ChanOut p n} {j} (hx : orth p C f b j x) (hy : orth p C f b j y) : orth p C f b j (x-y) := by intro D hd A ha; rw [map_sub,hx _ hd _ ha,hy _ hd _ ha,sub_self]
theorem orth_sum {f b : Plan p n} (x : I→Xpair p n) (c : I→F) {C : ChanOut p n} {j} (hx : ∀ i,orth p C f b j (x i)) : orth p C f b j (∑ i,c i • x i) := by intro D hd A ha rw [map_sum] refine Finset.sum_eq_zero fun i _ => ?_ rw [map_smul,hx i _ hd _ ha,smul_zero]
namespace Volleyvariable (v : Volley p n I)
def strike (t : Tagging p I) (ht : v.legal t) (j : I) : Xpair p n := Pi.single (v.obj j) (⟨v.atomAt t j,atom_mem _ (ht j)⟩ : Xspace p n)
theorem strike_here (t : Tagging p I) (ht : v.legal t) (c : I → F) (i : Bool) : ((∑ j : I, c j • v.strike t ht j) i).val=∑ j∈v.here i,c j • v.atomAt t j := by classical rw [Finset.sum_apply] simp only [Submodule.coe_sum, Pi.smul_apply,Submodule.coe_smul,here,Finset.sum_filter] refine Finset.sum_congr rfl fun j _ => ?_ by_cases h : v.obj j=i · simp only [ite_eq_left h] unfold strike rw [h,Pi.single_eq_same] simp [strike,h]
omit [Fintype I] intheorem strike_pair (t : Tagging p I) (ht : v.legal t) (j : I) (e : Comp p.g) : purePair p n (v.strike t ht j) e= if inc e (t j) then vecMulVec (v.rayLoc j) (v.rayLoc j) else 0 := by classical simp only [purePair, Finset.sum_apply] rw [Finset.sum_eq_single (v.obj j)] · rw [strike,Pi.single_eq_same] change liftM _ _ (atom p _ _ _ e)=_ rw [atom_def]; split · exact liftM_outer _ _ _ _ rw [map_zero] · intro i _ hi; rw [strike,Pi.single_eq_of_ne hi]; exact map_zero _ simp
theorem strike_orth {a b : Plan p n} {C : ChanOut p n} {i : Bool} (t : Tagging p I) (ht : v.legal t) (j : I) : orth p C (v.frozen a t) b i (v.strike t ht j) := by intro D hd A ha change ∑ e, _ = _ refine Finset.sum_eq_zero fun e _ => ?_ rw [v.strike_pair] by_cases h : inc e (t j) · have hy (z) : v.rayLoc j ∈ (v.frozen a t (e,z)) := Submodule.mem_sup_right (colSp_mem (P:=v.keyM t e) (⟨j,h⟩ : visits p t e)) let V := v.rayLoc j have h1 : A e *ᵥ V=0 := (box_kill.mp ((pureSpace_mem _).mp ha e)).2 V (hy false) have h2 (z) : D (e,z) *ᵥ V=0 := (box_kill.mp ((deltaSpace_mem _).mp hd _)).2 V (hy z) rw [ite_eq_left h,mpair_outer,evmat] change dotProduct V (((C (e,true))ᵀ * D (e,false)+ (D (e,true))ᵀ * C (e,false)+A e) *ᵥ V)=_ simp only [Matrix.add_mulVec, ← Matrix.mulVec_mulVec,h1,h2,mulVec_zero, dotProduct_zero,zero_add,add_zero,dotProduct_transpose_mulVec] rw [ite_eq_right h,map_zero]end Volley
def labStruct (p : Shape) (n : ℕ) (M : Moment p n) (R : ℕ) (L : Finset (Label p.b)) (Z : Label p.b→BaseMat p n) := M=labelSum p L Z ∧ L.card ≤ R ∧ (∀ s,s∉L → Z s=0) ∧ ∀ s∈L,(Z s)ᵀ=Z s ∧ ∀ i,Z s i i=Z s none i
private theorem struct_tri {M1 M2 M3 : Moment p n} {R : ℕ} {L1 L2 L3 : Finset (Label p.b)} {Z1 Z2 Z3 : Label p.b→BaseMat p n} (h1 : labStruct p n M1 R L1 Z1) (h2 : labStruct p n M2 R L2 Z2) (h3 : labStruct p n M3 R L3 Z3) (hr : 3*R≤p.j) (hm : M1+M2+M3=0) (s : Label p.b) : Z1 s+Z2 s+Z3 s=0 := by classical let W := L1∪L2∪L3 have hs1 : L1⊆W := subset_trans subset_union_left subset_union_left have hs2 : L2⊆W := subset_trans subset_union_right subset_union_left have hs3 : L3⊆W := subset_union_right have hh : W.card ≤ p.j+1 := (Finset.card_union_le (L1∪L2) L3).trans ((add_le_add ((Finset.card_union_le L1 L2).trans (add_le_add h1.2.1 h2.2.1)) h3.2.1).trans (by omega)) by_cases hs : s∈W · have hv {M : Moment p n} {L Z} (h : labStruct p n M R L Z) (hL : L ⊆ W) (i j : AIdx p.g n) (r : SelIdx p.b p.j) : (∑ s∈W,Z s i j*monoBit s r.val) = M (r,i) (emptySel,j) := by rw [h.1,labelSum, Matrix.sum_apply,←Finset.sum_subset hL] · simp only [mput_apply,emptySel,monoBit,Finset.prod_empty,mul_one,mul_comm] intro y _ hy simp [h.2.2.1 y hy] ext i j refine selector_indep W (fun s => (Z1 s i j+Z2 s i j+Z3 s i j)) p.j hh ?_ s hs intro T hT let r : SelIdx p.b p.j := ⟨T,hT⟩ simp only [add_mul,Finset.sum_add_distrib] rw [hv h1 hs1 i j r,hv h2 hs2 i j r,hv h3 hs3 i j r] exact congr_fun (congr_fun hm (r,i)) (emptySel,j) rw [h1.2.2.1 s (fun h => hs (hs1 h)), h2.2.2.1 s (fun h => hs (hs2 h)), h3.2.2.1 s (fun h => hs (hs3 h)), zero_add,zero_add]
namespace Volleyvariable {v : Volley p n I}
private theorem orth_structure {x : Xpair p n} {a b : Plan p n} {C : ChanOut p n} {t : Tagging p I} {w : I→Bool} {j : Bool} (hb : v.bounded w) (ho : orth p C (v.frozen a t) b j x) (R : ℕ) (hr : 2*planRank a+28≤R) (hj : 6*R+4 ≤ p.j) (i : Bool) (e : Comp p.g) : ∃ L Z,labStruct p n ((x i).val e) R L Z := by classical have h (z) := v.frozen_here_dim hb a t i z have he : ((x i).val e).rank ≤ R := (rank_vanish (vanish_one ho i e)).trans ((Nat.add_le_add (h (e,true)) (h (e,false))).trans (by omega)) have hf : ((x i).val e)∈ Wspace p n := by obtain ⟨w,h,hx⟩ := mem_X.mp (x i).property rw [← hx] exact ((Wspace p n).add_mem ((Wtag_le _) (h e.val.1)) ((Wtag_le _) (h e.val.2))) obtain ⟨L,Z,hL,_,hZ,hA⟩ := label_support hf R hj he let g (s : Label p.b) := if s∈L then Z s else 0 refine ⟨L,g,?_,hL,(fun s hs => ite_eq_right hs), fun s hs => ?_⟩ · rw [hZ] exact Finset.sum_congr rfl fun s hs => by simp [g,hs] simp only [g,ite_eq_left hs] exact hA _ hs
private theorem edge_at (l : Tag p.g) (e : Comp p.g) (h : inc e l) : ∃ (k : Tag p.g) (h : l≠k),e = edge l k h := by rcases e with ⟨⟨i,j⟩,hj⟩ change i=l∨j=l at h rcases h with rfl|rfl · exact ⟨j,hj.ne,(edge_eq hj).symm⟩ exact ⟨i,hj.ne.symm, by rw [edge_symm,edge_eq hj]⟩
private theorem cut_tri {x : Profile p n} (hx : x∈Xspace p n) (l k j : Tag p.g) (h : l≠k) (h' : l ≠ j) (h'' : k≠j) : x (edge l k h)+x (edge l j h')+x (edge k j h'')=0 := by obtain ⟨w,hv,rfl⟩ := mem_X.mp hx rw [← getPair_edge l k h (cut p n w), ←getPair_edge l j h' (cut p n w), ←getPair_edge k j h'' (cut p n w), getPair_cut,getPair_cut,getPair_cut] have he (x y z : Moment p n) : x+y+(x+z)+(y+z)=0 := calc _ = (x+x)+(y+y)+(z+z) := by ac_rfl _ = _ := by simp only [char_two] exact he _ _ _
private theorem structure_mark {x : Xpair p n} {a b : Plan p n} {C : ChanOut p n} {t : Tagging p I} {w : I→Bool} {j : Bool} {q R : ℕ} (hb : v.bounded w) (ho : orth p C (v.frozen a t) b j x) (hv : v.avoids a q) (hr : 6*R+4≤p.j) (hq : R+14≤q) (l : I) {L : Comp p.g → Finset (Label p.b)} {Z : Comp p.g → Label p.b → BaseMat p n} (he : ∀ e,labStruct p n ((x (v.obj l)).val e) R (L e) (Z e)) : ∃ c : F, ∀ e,mput p (v.sel l) (Z e (v.sel l))=c • v.atomAt t l e := by classical let s := v.sel l let u := t l let M := vecMulVec (baseV (v.par l)) (baseV (v.par l)) let coeff := fun e : Comp p.g => Z e s none none have h1 (e : Comp p.g) : Z e s= if inc e u then coeff e • M else 0 := by have ⟨hE,hL,hT,hH⟩ := he e exact mark_atom hb t hv l e _ (le_trans (Nat.add_le_add_right hL 14) hq) _ hT hH (hE ▸ vanish_one ho (v.obj l) e) have h2 (e f : Comp p.g) (h : inc e u) (h' : inc f u) : coeff e=coeff f := by by_cases hi : e=f · rw [hi] obtain ⟨k,hk,rfl⟩ := edge_at u e h obtain ⟨u2,hl,rfl⟩ := edge_at u f h' have hj : k ≠ u2 := by rintro rfl; exact hi rfl have hh := cut_tri (x (v.obj l)).property u k u2 hk hl hj have heq := struct_tri (he (edge u k hk)) (he (edge u u2 hl)) (he (edge k u2 hj)) (by omega) hh s have hn : ¬ inc (edge k u2 hj) u := fun he => by rcases (inc_edge_iff _).mp he with h|h; exact hk h.symm; exact hl h.symm rw [h1 (edge k u2 hj), ite_eq_right hn,add_zero] at heq have h0 := congr_fun (congr_fun heq none) none change coeff _ + coeff _ = 0 at h0 exact add_right_cancel (h0.trans (char_two _).symm) have h3 (e) : mput p s (Z e s)= coeff e • v.atomAt t l e := by rw [h1,atomAt,atom_def] by_cases hf : inc e u · rw [ite_eq_left hf,ite_eq_left hf,map_smul] change coeff e • liftM (labMat p n s) (labMat p n s) M=_ unfold M rw [liftM_outer,labMat_act]; rfl rw [ite_eq_right hf,ite_eq_right hf,map_zero,smul_zero] by_cases hh : ∃ e,inc e u · obtain ⟨f,hf⟩ := hh refine ⟨coeff f,fun e => ?_⟩ by_cases h : inc e u · exact (h3 e).trans (by rw [h2 e f h hf]) refine (h3 e).trans ?_ rw [atomAt,atom_def,ite_eq_right h,smul_zero,smul_zero] refine ⟨0,fun e => ?_⟩ refine (h3 e).trans ?_ rw [atomAt,atom_def,ite_eq_right (show ¬inc e u from fun he => hh ⟨e,he⟩), smul_zero,zero_smul]
/-- a component uses at most R nonattack labels. -/def clean (v : Volley p n I) (i : Bool) (R : ℕ) (M : Moment p n) := ∃ (L : Finset (Label p.b)) (Z : Label p.b → BaseMat p n), M=labelSum p L Z ∧ L.card≤R ∧ Disjoint L (v.marked i)
theorem split_orth {x : Xpair p n} {a b : Plan p n} {C : ChanOut p n} {t : Tagging p I} {w : I→Bool} {j : Bool} {q R : ℕ} (hb : v.bounded w) (ht : v.legal t) (ho : orth p C (v.frozen a t) b j x) (hv : v.avoids a q) (hr : 6*R+4≤p.j) (hr' : 2*planRank a+28≤R) (hq : R+14≤q) : ∃ (c : I → F) (y : Xpair p n), x=y+∑ i,c i • v.strike t ht i ∧ orth p C (v.frozen a t) b j y ∧ ∀ i e,v.clean i R ((y i).val e) := by classical choose L Z hZ using orth_structure hb ho R hr' hr choose c hc using fun l => structure_mark hb ho hv hr hq l (hZ (v.obj l)) let A := ∑ i,c i • v.strike t ht i refine ⟨c,x-A,(sub_add_cancel x A).symm,orth_sub ho (orth_sum _ _ (v.strike_orth t ht)), fun i e => ?_⟩ obtain ⟨B,h1,hA,hv',h3⟩ := hv i let T := v.marked i have he : (A i).val e=labelSum p T (Z i e) := by rw [show (A i).val=_ from v.strike_here t ht c i, Finset.sum_apply] dsimp only [labelSum,T,marked] rw [Finset.sum_image h3] refine Finset.sum_congr rfl fun l hl => ?_ have he : v.obj l=i := (mem_filter.mp hl).2 exact (he ▸ hc l e).symm let W := L i e refine ⟨W \ T,Z i e,?_,(Finset.card_le_card sdiff_subset).trans (hZ i e).2.1, ?_⟩ · change (x i).val e-(A i).val e=_ rw [(hZ i e).1,he] have hz : labelSum p W (Z i e)=labelSum p (W∪T) (Z i e) := by refine Finset.sum_subset subset_union_left fun s _ hs => ?_ rw [(hZ i e).2.2.1 s hs,map_zero] rw [hz] have hS : (W∪T)=(W \ T) ∪ T := by ext i; simp rw [hS,labelSum,Finset.sum_union (show Disjoint (W \ T) T from Disjoint.symm disjoint_sdiff)] exact add_sub_cancel_right _ _ exact Disjoint.symm disjoint_sdiff
end Volleyend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124import OAI.Combinatorics.HadwigerCounterexample.PrimalChannelDecomposition
namespace OAI
/-! # Baseline Extension -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Submodule
variable {p : Shape} {n : ℕ}
theorem project_table (a : Plan p n) (z : Place p) (Q : Space (Dir p n))
(hq : Q ≤ primal p n) (hd : Disjoint (tabSpace a z) Q) :
∃ B, ProjData (tabSpace a z) Q B ∧ ∀ x∈ primal p n, B*ᵥx∈prSmall a z := by
classical
let H := channels p n
let A := primal p n
let P := prSmall a z
have hp : P≤ A := prSmall_le _ _
have he : tabSpace a z=P ⊔ H := prSmall_table a z
obtain ⟨X,hX⟩ := proj_exists H A channels_disjoint.symm
have hj : Disjoint P (Q⊔H) := by
rw [disjoint_iff_inf_le]
rintro v ⟨hv,hv'⟩
obtain ⟨y,hy,w,hw,g⟩ := Submodule.mem_sup.mp hv'
have h := (show w=v-y by rw [←g]; abel) ▸
A.sub_mem (hp hv) (hq hy)
have hz : w∈ A ⊓ H := ⟨h,hw⟩
rw [channels_disjoint.eq_bot] at hz
have hi : w=0 := by simpa using hz
rw [hi,add_zero] at g
have ht : v∈tabSpace a z ⊓ Q :=
⟨he.symm ▸ Submodule.mem_sup_left hv,g ▸ hy⟩
rwa [hd.eq_bot] at ht
obtain ⟨Y,hY⟩ := proj_exists P (Q⊔H) hj
refine ⟨X+Y,⟨fun x => ?_,fun x hx => ?_,fun x hx => ?_⟩, fun x hx => ?_⟩
· rw [add_mulVec,he,add_comm]; exact add_mem_sup (hY.onto _) (hX.onto _)
· rw [he] at hx
obtain ⟨v,hv,w,hw,rfl⟩ := Submodule.mem_sup.mp hx
rw [add_mulVec,mulVec_add,mulVec_add,hX.kills v (hp hv),hX.fixes _ hw,hY.fixes _ hv,
hY.kills _ (Submodule.mem_sup_right hw),add_zero,zero_add,add_comm]
· rw [add_mulVec,hX.kills x (hq hx),hY.kills x (Submodule.mem_sup_left hx),zero_add]
· rw [add_mulVec,hX.kills x hx,zero_add]; exact hY.onto _
abbrev CrossM (p : Shape) (n : ℕ) := Mat (JointIdx p n) (JointIdx p n)
set_option maxHeartbeats 800000 in
theorem base_pair (a b : Plan p n) (u v : Place p)
(K J : Space (Dir p n)) (hk : K≤primal p n) (hj : J≤primal p n)
(hK : Disjoint (tabSpace a u) K) (hJ : Disjoint (tabSpace b v) J)
(A B : CrossM p n)
(heq : ∀ x∈ tabSpace a u,∀ y∈tabSpace b v,x∈a u ∨ y∈b v → evmat A x y=evmat B x y) :
∃ M : CrossM p n,
(∀ x∈tabSpace a u,∀ y∈tabSpace b v,evmat M x y=evmat B x y) ∧
(∀ x y, x∈ (a u⊔K) ∨ y∈(b v⊔J) → evmat M x y=evmat A x y) ∧
(∀ i,(Mᵀ*IP p n i).rank ≤ dim (a u⊔K : Submodule _ _) + dim (b v⊔J : Submodule _ _) +
2*planRank a) ∧
(∀ i,(M*IP p n i).rank ≤ dim (a u⊔K : Submodule _ _) + dim (b v⊔J : Submodule _ _) +
2*planRank b) := by
let P := a u⊔K
let Q := b v⊔J
obtain ⟨X,hX⟩ := proj_exists P ⊥ disjoint_bot_right
obtain ⟨Y,hY⟩ := proj_exists Q ⊥ disjoint_bot_right
obtain ⟨L,hL,gL⟩ := project_table a u K hk hK
obtain ⟨R,hR,gR⟩ := project_table b v J hj hJ
let C := pullM X (1:CrossM p n) A + pullM (1-X) Y A
let M := C + pullM L R (B-C)
have h1 (x y) (hx : x∈P ∨ y∈Q) : evmat C x y=evmat A x y := by
rw [show C=_ from rfl,evmat_addM,evmat_pull,evmat_pull,sub_mulVec,Matrix.one_mulVec,
Matrix.one_mulVec]
rcases hx with h|h
· rw [hX.fixes _ h,sub_self]; simp [evmat]
rw [hY.fixes _ h]
simp [evmat,sub_dotProduct]
have h2 (x y) : evmat M x y=evmat C x y+
(evmat B (L *ᵥ x) (R *ᵥ y)-evmat C (L*ᵥ x) (R*ᵥ y)) := by
rw [show M=_ from rfl,evmat_addM,evmat_pull,evmat_subM]
have hRank : C.rank≤dim P+dim Q := by
apply (mrk_add_le ..).trans
have hx : X.rank≤dim P := rank_maps _ hX.onto
have hy : Y.rank≤dim Q := rank_maps _ hY.onto
apply Nat.add_le_add
· rw [pullM_def]
refine ((Matrix.rank_mul_le_left ..).trans (Matrix.rank_mul_le_left ..)).trans ?_
rwa [Matrix.rank_transpose]
· rw [pullM_def]; exact (Matrix.rank_mul_le_right ..).trans hy
have hr (i) {a : Plan p n} (u)
(R : CrossM p n) (h : ∀ x∈primal p n,R*ᵥ x∈prSmall a u) :
(R*IP p n i).rank≤ 2*planRank a := by
apply le_trans (rank_maps (prSmall a u) _)
(prSmall_dim a u)
intro x
rw [← Matrix.mulVec_mulVec]
exact h _ (ip_le_primal i (show IP p n i*ᵥx∈colSp (IP p n i) from ⟨x,rfl⟩))
refine ⟨M, fun x hx y hy => ?_, fun x y h => ?_, fun i => ?_, fun i => ?_⟩
· rw [h2,hL.fixes x hx,hR.fixes y hy,add_sub_cancel]
· have hi : L*ᵥ x ∈ a u ∨ R *ᵥ y ∈ b v := by
rcases h with h|h
· left; obtain ⟨x,hx,y,hy,rfl⟩ := Submodule.mem_sup.mp h
rwa [Matrix.mulVec_add,hL.kills _ hy,hL.fixes _ (pin_le_table _ _ hx),add_zero]
right; obtain ⟨x,hx,y,hy,rfl⟩ := Submodule.mem_sup.mp h
rwa [Matrix.mulVec_add,hR.kills _ hy,hR.fixes _ (pin_le_table _ _ hx),add_zero]
have he : L*ᵥx ∈ P ∨ R*ᵥy∈Q := hi.imp Submodule.mem_sup_left Submodule.mem_sup_left
rw [h2,h1 _ _ h,h1 _ _ he,heq _ (hL.onto _) _ (hR.onto _) hi,sub_self,add_zero]
· unfold M
rw [transpose_add,Matrix.add_mul]
refine (mrk_add_le ..).trans (Nat.add_le_add ?_ ?_)
· exact (Matrix.rank_mul_le_left ..).trans ((Matrix.rank_transpose _).trans_le hRank)
rw [pullM_def,transpose_mul,transpose_mul,transpose_transpose,Matrix.mul_assoc,
Matrix.mul_assoc]
exact ((Matrix.rank_mul_le_right ..).trans (Matrix.rank_mul_le_right ..)).trans (hr i u L gL)
· unfold M
rw [Matrix.add_mul]
refine (mrk_add_le ..).trans (Nat.add_le_add ?_ ?_)
· exact (Matrix.rank_mul_le_left ..).trans hRank
rw [pullM_def,Matrix.mul_assoc]
exact (Matrix.rank_mul_le_right ..).trans (hr i v R gR)
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PrimalChannelDecomposition
namespace OAI
/-! # Baseline Extension -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Submodule
variable {p : Shape} {n : ℕ}
theorem project_table (a : Plan p n) (z : Place p) (Q : Space (Dir p n)) (hq : Q ≤ primal p n) (hd : Disjoint (tabSpace a z) Q) : ∃ B, ProjData (tabSpace a z) Q B ∧ ∀ x∈ primal p n, B*ᵥx∈prSmall a z := by classical let H := channels p n let A := primal p n let P := prSmall a z have hp : P≤ A := prSmall_le _ _ have he : tabSpace a z=P ⊔ H := prSmall_table a z obtain ⟨X,hX⟩ := proj_exists H A channels_disjoint.symm have hj : Disjoint P (Q⊔H) := by rw [disjoint_iff_inf_le] rintro v ⟨hv,hv'⟩ obtain ⟨y,hy,w,hw,g⟩ := Submodule.mem_sup.mp hv' have h := (show w=v-y by rw [←g]; abel) ▸ A.sub_mem (hp hv) (hq hy) have hz : w∈ A ⊓ H := ⟨h,hw⟩ rw [channels_disjoint.eq_bot] at hz have hi : w=0 := by simpa using hz rw [hi,add_zero] at g have ht : v∈tabSpace a z ⊓ Q := ⟨he.symm ▸ Submodule.mem_sup_left hv,g ▸ hy⟩ rwa [hd.eq_bot] at ht obtain ⟨Y,hY⟩ := proj_exists P (Q⊔H) hj refine ⟨X+Y,⟨fun x => ?_,fun x hx => ?_,fun x hx => ?_⟩, fun x hx => ?_⟩ · rw [add_mulVec,he,add_comm]; exact add_mem_sup (hY.onto _) (hX.onto _) · rw [he] at hx obtain ⟨v,hv,w,hw,rfl⟩ := Submodule.mem_sup.mp hx rw [add_mulVec,mulVec_add,mulVec_add,hX.kills v (hp hv),hX.fixes _ hw,hY.fixes _ hv, hY.kills _ (Submodule.mem_sup_right hw),add_zero,zero_add,add_comm] · rw [add_mulVec,hX.kills x (hq hx),hY.kills x (Submodule.mem_sup_left hx),zero_add] · rw [add_mulVec,hX.kills x hx,zero_add]; exact hY.onto _
abbrev CrossM (p : Shape) (n : ℕ) := Mat (JointIdx p n) (JointIdx p n)
set_option maxHeartbeats 800000 intheorem base_pair (a b : Plan p n) (u v : Place p) (K J : Space (Dir p n)) (hk : K≤primal p n) (hj : J≤primal p n) (hK : Disjoint (tabSpace a u) K) (hJ : Disjoint (tabSpace b v) J) (A B : CrossM p n) (heq : ∀ x∈ tabSpace a u,∀ y∈tabSpace b v,x∈a u ∨ y∈b v → evmat A x y=evmat B x y) : ∃ M : CrossM p n, (∀ x∈tabSpace a u,∀ y∈tabSpace b v,evmat M x y=evmat B x y) ∧ (∀ x y, x∈ (a u⊔K) ∨ y∈(b v⊔J) → evmat M x y=evmat A x y) ∧ (∀ i,(Mᵀ*IP p n i).rank ≤ dim (a u⊔K : Submodule _ _) + dim (b v⊔J : Submodule _ _) + 2*planRank a) ∧ (∀ i,(M*IP p n i).rank ≤ dim (a u⊔K : Submodule _ _) + dim (b v⊔J : Submodule _ _) + 2*planRank b) := by let P := a u⊔K let Q := b v⊔J obtain ⟨X,hX⟩ := proj_exists P ⊥ disjoint_bot_right obtain ⟨Y,hY⟩ := proj_exists Q ⊥ disjoint_bot_right obtain ⟨L,hL,gL⟩ := project_table a u K hk hK obtain ⟨R,hR,gR⟩ := project_table b v J hj hJ let C := pullM X (1:CrossM p n) A + pullM (1-X) Y A let M := C + pullM L R (B-C) have h1 (x y) (hx : x∈P ∨ y∈Q) : evmat C x y=evmat A x y := by rw [show C=_ from rfl,evmat_addM,evmat_pull,evmat_pull,sub_mulVec,Matrix.one_mulVec, Matrix.one_mulVec] rcases hx with h|h · rw [hX.fixes _ h,sub_self]; simp [evmat] rw [hY.fixes _ h] simp [evmat,sub_dotProduct] have h2 (x y) : evmat M x y=evmat C x y+ (evmat B (L *ᵥ x) (R *ᵥ y)-evmat C (L*ᵥ x) (R*ᵥ y)) := by rw [show M=_ from rfl,evmat_addM,evmat_pull,evmat_subM] have hRank : C.rank≤dim P+dim Q := by apply (mrk_add_le ..).trans have hx : X.rank≤dim P := rank_maps _ hX.onto have hy : Y.rank≤dim Q := rank_maps _ hY.onto apply Nat.add_le_add · rw [pullM_def] refine ((Matrix.rank_mul_le_left ..).trans (Matrix.rank_mul_le_left ..)).trans ?_ rwa [Matrix.rank_transpose] · rw [pullM_def]; exact (Matrix.rank_mul_le_right ..).trans hy have hr (i) {a : Plan p n} (u) (R : CrossM p n) (h : ∀ x∈primal p n,R*ᵥ x∈prSmall a u) : (R*IP p n i).rank≤ 2*planRank a := by apply le_trans (rank_maps (prSmall a u) _) (prSmall_dim a u) intro x rw [← Matrix.mulVec_mulVec] exact h _ (ip_le_primal i (show IP p n i*ᵥx∈colSp (IP p n i) from ⟨x,rfl⟩)) refine ⟨M, fun x hx y hy => ?_, fun x y h => ?_, fun i => ?_, fun i => ?_⟩ · rw [h2,hL.fixes x hx,hR.fixes y hy,add_sub_cancel] · have hi : L*ᵥ x ∈ a u ∨ R *ᵥ y ∈ b v := by rcases h with h|h · left; obtain ⟨x,hx,y,hy,rfl⟩ := Submodule.mem_sup.mp h rwa [Matrix.mulVec_add,hL.kills _ hy,hL.fixes _ (pin_le_table _ _ hx),add_zero] right; obtain ⟨x,hx,y,hy,rfl⟩ := Submodule.mem_sup.mp h rwa [Matrix.mulVec_add,hR.kills _ hy,hR.fixes _ (pin_le_table _ _ hx),add_zero] have he : L*ᵥx ∈ P ∨ R*ᵥy∈Q := hi.imp Submodule.mem_sup_left Submodule.mem_sup_left rw [h2,h1 _ _ h,h1 _ _ he,heq _ (hL.onto _) _ (hR.onto _) hi,sub_self,add_zero] · unfold M rw [transpose_add,Matrix.add_mul] refine (mrk_add_le ..).trans (Nat.add_le_add ?_ ?_) · exact (Matrix.rank_mul_le_left ..).trans ((Matrix.rank_transpose _).trans_le hRank) rw [pullM_def,transpose_mul,transpose_mul,transpose_transpose,Matrix.mul_assoc, Matrix.mul_assoc] exact ((Matrix.rank_mul_le_right ..).trans (Matrix.rank_mul_le_right ..)).trans (hr i u L gL) · unfold M rw [Matrix.add_mul] refine (mrk_add_le ..).trans (Nat.add_le_add ?_ ?_) · exact (Matrix.rank_mul_le_left ..).trans hRank rw [pullM_def,Matrix.mul_assoc] exact (Matrix.rank_mul_le_right ..).trans (hr i v R gR)
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147import OAI.Combinatorics.HadwigerCounterexample.BaselineExtension
namespace OAI
/-! # Baseline Forms -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix
variable {p : Shape} {n N : ℕ}
def lowCross (K : ℕ) (B : Cross p n) :=
∀ z i,( (B z)ᵀ * IP p n i).rank ≤ K
def fitsTable (a b : Plan p n) (B T : Cross p n) :=
∀ z, ∀ x∈tabSpace a z,∀ y∈tabSpace b (flipZ p z), evmat (B z) x y=evmat (T z) x y
theorem fits_recip {B T : Cross p n} {a b : Plan p n} (h : fitsTable a b B T) :
fitsTable b a (reciprocal p B) (reciprocal p T) := by
intro z x hx y hy
have hx' : x∈tabSpace b (flipZ p (flipZ p z)) := by rwa [flipZ_flip]
change evmat _ _ _=evmat _ _ _
unfold reciprocal
rw [evmat_transpose,evmat_transpose,h _ y hy x hx']
def blin (K : ℕ) := 4*K+56
set_option maxHeartbeats 800000 in
theorem start_form (a b : Pin p n N) (x y : UnitType p n N) (T : Cross p n)
(ka kb : Plan p n)
(hA : ∀ z,ka z≤primal p n) (hB : ∀ z,kb z≤primal p n)
(hd : ∀ z, Disjoint (tabSpace a.sp z) (ka z))
(hd' : ∀ z, Disjoint (tabSpace b.sp z) (kb z))
(ha : a.agree x) (hb : b.agree y) (h1 : tableFlag a b T x)
(h2 : tableFlag b a (reciprocal p T) y)
(K : ℕ) (hk : planRank a.sp ≤ K) (hk' : planRank b.sp ≤ K)
(hv : ∀ z, dim (ka z) ≤ 28) (hv' : ∀ z, dim (kb z) ≤ 28) :
∃ M : Cross p n, fitsTable a.sp b.sp M T ∧
rowAgree (a.sp ⊔ ka) M (actual p x y) ∧
rowAgree (b.sp ⊔ kb) (reciprocal p M) (actual p y x) ∧
lowCross (blin K) M ∧ lowCross (blin K) (reciprocal p M) := by
let A := actual p x y
have hh (z : Place p) (u v) (hu : u∈tabSpace a.sp z) (hv : v∈tabSpace b.sp (flipZ p z))
(h : u∈a.sp z ∨ v∈b.sp (flipZ p z)) : evmat (A z) u v=evmat (T z) u v := by
rcases h with h|h
· have h' : u ∈ a.sp (flipZ p (flipZ p z)) := by rwa [flipZ_flip]
have he := h2 _ v hv u h'
have hf := flag_actual (a:=b) y x ha (flipZ p z) v hv u h'
have hg := hf.trans he.symm
rw [← reciprocal_actual x y] at hg
simp only [reciprocal,flipZ_flip,evmat_transpose] at hg
exact hg
exact (flag_actual (a:=a) x y hb _ u hu v h).trans (h1 _ u hu v h).symm
choose M hC hD hE hF using fun z =>
base_pair a.sp b.sp z (flipZ p z) (ka z) (kb (flipZ p z)) (hA _) (hB _) (hd _) (hd' _)
(A z) (T z) (fun u hu v hv g => hh z u v hu hv g)
have hr (z) {a s : Plan p n} (h : planRank a≤K) (hg : ∀ z,dim (s z)≤28) :
dim (a z ⊔ s z : Submodule _ _) ≤ K+28 :=
(Submodule.finrank_add_le_finrank_add_finrank ..).trans
(Nat.add_le_add ((dim_le_plan a _).trans h) (hg _))
have hm z {L} (hl : L≤K) : dim (a.sp z ⊔ ka z : Submodule _ _)+
dim (b.sp (flipZ p z) ⊔ kb (flipZ p z):Submodule _ _)+2*L ≤ blin K := by
apply le_trans (Nat.add_le_add (Nat.add_le_add (hr z hk hv) (hr _ hk' hv'))
(Nat.mul_le_mul_left 2 hl))
unfold blin; omega
refine ⟨M,hC,(fun z u hu v => hD z u v (Or.inl hu)),?_,
fun z i => (hE z i).trans (hm z hk),?_⟩
· rw [← reciprocal_actual x y]
intro z v hv u
unfold reciprocal; rw [evmat_transpose,evmat_transpose]
apply hD
right
rw [flipZ_flip]; exact hv
intro z i
unfold reciprocal; rw [transpose_transpose]
exact (hF (flipZ p z) i).trans (hm _ hk')
theorem channel_eval (p : Shape) {n} (M : Cross p n) (j : Bool) (z : Place p)
(x : Dir p n) (y : Vec (Chan p)) :
dotProduct y (channelOut p M j z *ᵥ x)=evmat (M z) x (IH p n j *ᵥ y) := by
unfold channelOut evmat
rw [dotProduct_transpose_mulVec, Matrix.mulVec_mulVec]
theorem channel_same {M T : Cross p n} (i z u)
(h : ∀ v : Vec (Chan p), evmat (M z) u (IH p n i *ᵥ v)=evmat (T z) u (IH p n i *ᵥ v)) :
channelOut p M i z *ᵥ u = channelOut p T i z *ᵥ u := by
classical
funext j
have he v : dotProduct v (channelOut p M i z *ᵥ u)=dotProduct v (channelOut p T i z*ᵥ u) := by
rw [channel_eval, channel_eval, h]
simpa using he (Pi.single j 1)
theorem fits_channel {M T : Cross p n} {a b : Plan p n} (h : fitsTable a b M T)
(z : Place p) (x : Dir p n) (hx : x∈tabSpace a z) (j : Bool) :
channelOut p M j z *ᵥ x = channelOut p T j z *ᵥ x := by
apply channel_same j
intro v
exact h z x hx _ (channel_le_table b _ j ⟨_,rfl⟩)
theorem fits_inj {M T : Cross p n} {a b : Plan p n} (h : fitsTable a b M T)
(ht : tableInj a b T) : tableInj a b M := by
intro z i j v hv hh
apply ht z i j v hv
rwa [fits_channel h z _ (pin_le_table a z hv) j] at hh
private theorem cout_ev (A B : Mat (Chan p) (JointIdx p n)) (x y) :
evmat (Aᵀ*B) x y=dotProduct (A *ᵥ x) (B *ᵥ y) := by
rw [evmat,← mulVec_mulVec,dotProduct_transpose_mulVec,dotProduct_comm]
theorem fits_contract {M T : Cross p n} {a b : Plan p n} (h : fitsTable a b M T)
(i j : Bool) (x : Profile p n) (hx : x ∈ effective a i) :
contract p M i j x=contract p T i j x := by
change ∑ e : Comp p.g, _ = _
refine Finset.sum_congr rfl fun e _ => ?_
apply (box_eval_iff (tabSpace a (e,true)) (tabSpace a (e,false)) _ _).mp ?_ _
· have hp := lift_mem_box (IP p n i) (IP p n i) ((effective_mem.mp hx).2 e)
exact box_le (le_trans le_sup_left (half_le_table a _ i))
(le_trans le_sup_left (half_le_table a _ i)) hp
intro x hx y hy; rw [cout_ev, cout_ev,fits_channel h _ _ hx,fits_channel h _ _ hy]
variable {I : Type} [Fintype I]
theorem frozen_contract_key {M T : Cross p n} {a} (v : Volley p n I) (t : Tagging p I)
(h : rowAgree (a⊔v.keyPlan t) M T) (i : I) (j : Bool) :
contract p M (v.obj i) j (v.atomAt t i)=contract p T (v.obj i) j (v.atomAt t i) := by
classical
change ∑ e : Comp p.g, _ = _
refine Finset.sum_congr rfl fun e _ => ?_
by_cases he : inc e (t i)
· have hx b :
v.rayLoc i ∈ (v.keyPlan t (e,b)) := colSp_mem (P:=v.keyM t e)
(⟨i,he⟩ : Volley.visits p t e)
have hE (b : Bool) : channelOut p M j (e,b) *ᵥ v.rayLoc i =
channelOut p T j (e,b) *ᵥ v.rayLoc i :=
channel_same j _ _ (fun y => h _ _ (Submodule.mem_sup_right (hx b)) _)
simp only [Volley.atomAt,atom_def,he, ite_true,mom,liftM_outer,mpair_outer]
rw [cout_ev,cout_ev]
exact congrArg₂ dotProduct (hE true) (hE false)
simp only [Volley.atomAt,atom_def,he,ite_false,map_zero]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.BaselineExtension
namespace OAI
/-! # Baseline Forms -/
noncomputable sectionnamespace HadwigerCounterexample
open scoped BigOperatorsopen Matrixvariable {p : Shape} {n N : ℕ}
def lowCross (K : ℕ) (B : Cross p n) := ∀ z i,( (B z)ᵀ * IP p n i).rank ≤ K
def fitsTable (a b : Plan p n) (B T : Cross p n) := ∀ z, ∀ x∈tabSpace a z,∀ y∈tabSpace b (flipZ p z), evmat (B z) x y=evmat (T z) x y
theorem fits_recip {B T : Cross p n} {a b : Plan p n} (h : fitsTable a b B T) : fitsTable b a (reciprocal p B) (reciprocal p T) := by intro z x hx y hy have hx' : x∈tabSpace b (flipZ p (flipZ p z)) := by rwa [flipZ_flip] change evmat _ _ _=evmat _ _ _ unfold reciprocal rw [evmat_transpose,evmat_transpose,h _ y hy x hx']
def blin (K : ℕ) := 4*K+56
set_option maxHeartbeats 800000 intheorem start_form (a b : Pin p n N) (x y : UnitType p n N) (T : Cross p n) (ka kb : Plan p n) (hA : ∀ z,ka z≤primal p n) (hB : ∀ z,kb z≤primal p n) (hd : ∀ z, Disjoint (tabSpace a.sp z) (ka z)) (hd' : ∀ z, Disjoint (tabSpace b.sp z) (kb z)) (ha : a.agree x) (hb : b.agree y) (h1 : tableFlag a b T x) (h2 : tableFlag b a (reciprocal p T) y) (K : ℕ) (hk : planRank a.sp ≤ K) (hk' : planRank b.sp ≤ K) (hv : ∀ z, dim (ka z) ≤ 28) (hv' : ∀ z, dim (kb z) ≤ 28) : ∃ M : Cross p n, fitsTable a.sp b.sp M T ∧ rowAgree (a.sp ⊔ ka) M (actual p x y) ∧ rowAgree (b.sp ⊔ kb) (reciprocal p M) (actual p y x) ∧ lowCross (blin K) M ∧ lowCross (blin K) (reciprocal p M) := by let A := actual p x y have hh (z : Place p) (u v) (hu : u∈tabSpace a.sp z) (hv : v∈tabSpace b.sp (flipZ p z)) (h : u∈a.sp z ∨ v∈b.sp (flipZ p z)) : evmat (A z) u v=evmat (T z) u v := by rcases h with h|h · have h' : u ∈ a.sp (flipZ p (flipZ p z)) := by rwa [flipZ_flip] have he := h2 _ v hv u h' have hf := flag_actual (a:=b) y x ha (flipZ p z) v hv u h' have hg := hf.trans he.symm rw [← reciprocal_actual x y] at hg simp only [reciprocal,flipZ_flip,evmat_transpose] at hg exact hg exact (flag_actual (a:=a) x y hb _ u hu v h).trans (h1 _ u hu v h).symm choose M hC hD hE hF using fun z => base_pair a.sp b.sp z (flipZ p z) (ka z) (kb (flipZ p z)) (hA _) (hB _) (hd _) (hd' _) (A z) (T z) (fun u hu v hv g => hh z u v hu hv g) have hr (z) {a s : Plan p n} (h : planRank a≤K) (hg : ∀ z,dim (s z)≤28) : dim (a z ⊔ s z : Submodule _ _) ≤ K+28 := (Submodule.finrank_add_le_finrank_add_finrank ..).trans (Nat.add_le_add ((dim_le_plan a _).trans h) (hg _)) have hm z {L} (hl : L≤K) : dim (a.sp z ⊔ ka z : Submodule _ _)+ dim (b.sp (flipZ p z) ⊔ kb (flipZ p z):Submodule _ _)+2*L ≤ blin K := by apply le_trans (Nat.add_le_add (Nat.add_le_add (hr z hk hv) (hr _ hk' hv')) (Nat.mul_le_mul_left 2 hl)) unfold blin; omega refine ⟨M,hC,(fun z u hu v => hD z u v (Or.inl hu)),?_, fun z i => (hE z i).trans (hm z hk),?_⟩ · rw [← reciprocal_actual x y] intro z v hv u unfold reciprocal; rw [evmat_transpose,evmat_transpose] apply hD right rw [flipZ_flip]; exact hv intro z i unfold reciprocal; rw [transpose_transpose] exact (hF (flipZ p z) i).trans (hm _ hk')
theorem channel_eval (p : Shape) {n} (M : Cross p n) (j : Bool) (z : Place p) (x : Dir p n) (y : Vec (Chan p)) : dotProduct y (channelOut p M j z *ᵥ x)=evmat (M z) x (IH p n j *ᵥ y) := by unfold channelOut evmat rw [dotProduct_transpose_mulVec, Matrix.mulVec_mulVec]
theorem channel_same {M T : Cross p n} (i z u) (h : ∀ v : Vec (Chan p), evmat (M z) u (IH p n i *ᵥ v)=evmat (T z) u (IH p n i *ᵥ v)) : channelOut p M i z *ᵥ u = channelOut p T i z *ᵥ u := by classical funext j have he v : dotProduct v (channelOut p M i z *ᵥ u)=dotProduct v (channelOut p T i z*ᵥ u) := by rw [channel_eval, channel_eval, h] simpa using he (Pi.single j 1)
theorem fits_channel {M T : Cross p n} {a b : Plan p n} (h : fitsTable a b M T) (z : Place p) (x : Dir p n) (hx : x∈tabSpace a z) (j : Bool) : channelOut p M j z *ᵥ x = channelOut p T j z *ᵥ x := by apply channel_same j intro v exact h z x hx _ (channel_le_table b _ j ⟨_,rfl⟩)
theorem fits_inj {M T : Cross p n} {a b : Plan p n} (h : fitsTable a b M T) (ht : tableInj a b T) : tableInj a b M := by intro z i j v hv hh apply ht z i j v hv rwa [fits_channel h z _ (pin_le_table a z hv) j] at hh
private theorem cout_ev (A B : Mat (Chan p) (JointIdx p n)) (x y) : evmat (Aᵀ*B) x y=dotProduct (A *ᵥ x) (B *ᵥ y) := by rw [evmat,← mulVec_mulVec,dotProduct_transpose_mulVec,dotProduct_comm]
theorem fits_contract {M T : Cross p n} {a b : Plan p n} (h : fitsTable a b M T) (i j : Bool) (x : Profile p n) (hx : x ∈ effective a i) : contract p M i j x=contract p T i j x := by change ∑ e : Comp p.g, _ = _ refine Finset.sum_congr rfl fun e _ => ?_ apply (box_eval_iff (tabSpace a (e,true)) (tabSpace a (e,false)) _ _).mp ?_ _ · have hp := lift_mem_box (IP p n i) (IP p n i) ((effective_mem.mp hx).2 e) exact box_le (le_trans le_sup_left (half_le_table a _ i)) (le_trans le_sup_left (half_le_table a _ i)) hp intro x hx y hy; rw [cout_ev, cout_ev,fits_channel h _ _ hx,fits_channel h _ _ hy]
variable {I : Type} [Fintype I]
theorem frozen_contract_key {M T : Cross p n} {a} (v : Volley p n I) (t : Tagging p I) (h : rowAgree (a⊔v.keyPlan t) M T) (i : I) (j : Bool) : contract p M (v.obj i) j (v.atomAt t i)=contract p T (v.obj i) j (v.atomAt t i) := by classical change ∑ e : Comp p.g, _ = _ refine Finset.sum_congr rfl fun e _ => ?_ by_cases he : inc e (t i) · have hx b : v.rayLoc i ∈ (v.keyPlan t (e,b)) := colSp_mem (P:=v.keyM t e) (⟨i,he⟩ : Volley.visits p t e) have hE (b : Bool) : channelOut p M j (e,b) *ᵥ v.rayLoc i = channelOut p T j (e,b) *ᵥ v.rayLoc i := channel_same j _ _ (fun y => h _ _ (Submodule.mem_sup_right (hx b)) _) simp only [Volley.atomAt,atom_def,he, ite_true,mom,liftM_outer,mpair_outer] rw [cout_ev,cout_ev] exact congrArg₂ dotProduct (hE true) (hE false) simp only [Volley.atomAt,atom_def,he,ite_false,map_zero]
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113import OAI.Combinatorics.HadwigerCounterexample.OrientationRankBounds
namespace OAI
/-! # Basis Conditioning -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Module LinearMap Finset Filter Function
open scoped BigOperators
variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
theorem totalRank_pos {x : Profile p n} (h : x≠0) :
0<totalRank x := by
obtain ⟨i,hi⟩ := Function.ne_iff.mp h
apply lt_of_lt_of_le _ (Finset.single_le_sum (fun i _=>Nat.zero_le ((x i).rank))
(Finset.mem_univ i))
apply Nat.pos_of_ne_zero; intro h
obtain ⟨A,B,hh⟩ := mul_factor (x i) 0 h.le
apply hi; ext a b; rw [←hh,Matrix.mul_apply]; simp
def glintRate (K : ℕ) := bp (-((K^2:ℕ):ℝ)-3)
theorem glint_within {K d : ℕ} (h : d≤ K^2) :
glintRate K ≤ (1/8:ℝ)*bp (- (d:ℝ)) := by
unfold glintRate
have hh : bp (-3)=1/8 := by norm_num [bp]
rw [←hh,←bp_add]
exact bp_le (by linarith only [(show (d:ℝ) ≤ ((K^2:ℕ):ℝ) from by exact_mod_cast h)])
namespace Template
variable (v : Solo p)
def stains (m : Mixer p n) (f : Vec I →ₗ[F] Profile p n) (z : Knobs p.g n) : Vec I :=
fun i=> Tsym m (f (Pi.single i 1)) (useAtom p (v.t ()) (v.s ()) (v.f ()) z)
theorem staining (m : Mixer p n) (f : Vec I→ₗ[F] Profile p n) (z : Knobs p.g n) (i : Vec I) :
vectorPhase i (stains v m f z)=shanty v m (f i) z := by
classical
let h := LinearMap.flip (Tsym m) (useAtom p (v.t ()) (v.s ()) (v.f ()) z) ∘ₗ f
have ht : h i=h (∑ j: I,i j • (Pi.single j 1 : Vec I)) := by
have he (j:I) : i j • (Pi.single j 1 : Vec I)=Pi.single j (i j) := by
funext k; by_cases hh:k=j <;> simp [hh]
simp_rw [he]
rw [Finset.univ_sum_single]
change wsign (∑ j:I,i j*h (Pi.single j 1))=wsign (h i)
rw [ht,map_sum]; simp_rw [map_smul]; rfl
def luminous (v : Solo p) (m : Mixer p n) (w : Wgt (Knobs p.g n)) (D : AtomKey (p:=p) (v.t ())
N →Prop) (K : ℕ) (i : Orient p n N) :=
let P := offBeat v D i
0<pr w P ∧ ∀ (d : ℕ), d≤ K^2 → ∀ f : Vec (Fin d)→ₗ[F] Profile p n,
Injective f → (∀ x,totalRank (f x)≤K) → ∀ x,
(7/8:ℝ)*bp (-(d:ℝ)) ≤ pr (onW w P) (fun z=> stains v m f z=x)
set_option maxHeartbeats 800000 in
theorem glow_luminous (v : Solo p) (m : Mixer p n) (w : Wgt (Knobs p.g n))
(hw : IsLaw w)
(S : AtomKey (p:=p) (v.t ()) N → Prop)
(K : ℕ) (i : Orient p n N) (δ : ℝ) (hδ : 0<δ) (he : δ ≤ pr w (offBeat v S i))
(h : ∀ x, 0<totalRank x → totalRank x≤K → ¬ glow v m w S (glintRate K) δ x i) :
luminous v m w S K i := by
classical
let P := offBeat v S i
have hP : 0<pr w P := hδ.trans_le he
let u := onW w P; have hu : IsLaw u := on_law hw.nz hP
refine ⟨hP,fun d hd f hf hg x => ?_⟩
let s := stains v m f
have heq :
pr u (fun z => s z=x) = avg unif (fun i => vectorPhase i x*
avg u (fun z => vectorPhase i (s z))) := by
unfold pr
simp_rw [vector_expand]
rw [avg_avg]
apply avg_congr
intro i hi
rw [avg_mul]; ring
let b := bp (-(d:ℝ))
let Q (k : Vec (Fin d)) := vectorPhase k x * avg u (fun z => vectorPhase k (s z))
have hb : 0 < b := bp_pos _
have hh k : ind (k=0)-b/8 ≤ Q k := by
by_cases hk : k=0
· subst k
have hQ : Q 0=1 := by unfold Q; simp only [vectorPhase,zero_dotProduct,wsign_zero,one_mul,
hu.avg_const]
rw [ind_one (show (0:Vec (Fin d))=0 from rfl),hQ]; linarith
let k' := f k
have hT := h k' (totalRank_pos (hf.ne hk |>.trans_eq (map_zero f))) (hg k)
have hz : |zsumPeak p w (v.shanty m k') P| ≤ (glintRate K)*pr w P :=
le_of_lt (lt_of_not_ge (fun h => hT ⟨he,h⟩))
have ht :
avg u (fun z => vectorPhase k (s z))=
zsumPeak p w (v.shanty m k') P/pr w P := by
unfold s u onW; simp_rw [staining]; rw [avg_norm,subW_tot]
congr 1; simp [zsumPeak,avg,subW,mul_assoc,k']
have h1 : |Q k|≤b/8 := by
unfold Q; rw [ht,abs_mul,vectorPhase,wsign_abs,one_mul,abs_div,abs_of_pos hP]
refine le_trans ((div_le_iff₀ hP).mpr hz) ((glint_within hd).trans_eq (by unfold b; ring))
rw [ind_zero hk,zero_sub]; exact (abs_le.mp h1).1
have h0 : unif (0:Vec (Fin d))=b := by
unfold b; rw [unif_apply,card_space,dim_vec,bp_neg,Fintype.card_fin]
change _ ≤ pr u (fun z => s z=x)
rw [heq]
refine le_trans ?_ (avg_mono unif_law.nz hh)
rw [avg_sub,unif_law.avg_const,
show avg unif (fun i : Vec (Fin d)=> ind (i=0))=b from (pr_point' unif _).trans h0]
change 7/8*b≤_
linarith
end Template
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.OrientationRankBounds
namespace OAI
/-! # Basis Conditioning -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Module LinearMap Finset Filter Functionopen scoped BigOperatorsvariable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
theorem totalRank_pos {x : Profile p n} (h : x≠0) : 0<totalRank x := by obtain ⟨i,hi⟩ := Function.ne_iff.mp h apply lt_of_lt_of_le _ (Finset.single_le_sum (fun i _=>Nat.zero_le ((x i).rank)) (Finset.mem_univ i)) apply Nat.pos_of_ne_zero; intro h obtain ⟨A,B,hh⟩ := mul_factor (x i) 0 h.le apply hi; ext a b; rw [←hh,Matrix.mul_apply]; simp
def glintRate (K : ℕ) := bp (-((K^2:ℕ):ℝ)-3)
theorem glint_within {K d : ℕ} (h : d≤ K^2) : glintRate K ≤ (1/8:ℝ)*bp (- (d:ℝ)) := by unfold glintRate have hh : bp (-3)=1/8 := by norm_num [bp] rw [←hh,←bp_add] exact bp_le (by linarith only [(show (d:ℝ) ≤ ((K^2:ℕ):ℝ) from by exact_mod_cast h)])
namespace Templatevariable (v : Solo p)
def stains (m : Mixer p n) (f : Vec I →ₗ[F] Profile p n) (z : Knobs p.g n) : Vec I := fun i=> Tsym m (f (Pi.single i 1)) (useAtom p (v.t ()) (v.s ()) (v.f ()) z)theorem staining (m : Mixer p n) (f : Vec I→ₗ[F] Profile p n) (z : Knobs p.g n) (i : Vec I) : vectorPhase i (stains v m f z)=shanty v m (f i) z := by classical let h := LinearMap.flip (Tsym m) (useAtom p (v.t ()) (v.s ()) (v.f ()) z) ∘ₗ f have ht : h i=h (∑ j: I,i j • (Pi.single j 1 : Vec I)) := by have he (j:I) : i j • (Pi.single j 1 : Vec I)=Pi.single j (i j) := by funext k; by_cases hh:k=j <;> simp [hh] simp_rw [he] rw [Finset.univ_sum_single] change wsign (∑ j:I,i j*h (Pi.single j 1))=wsign (h i) rw [ht,map_sum]; simp_rw [map_smul]; rfl
def luminous (v : Solo p) (m : Mixer p n) (w : Wgt (Knobs p.g n)) (D : AtomKey (p:=p) (v.t ()) N →Prop) (K : ℕ) (i : Orient p n N) := let P := offBeat v D i 0<pr w P ∧ ∀ (d : ℕ), d≤ K^2 → ∀ f : Vec (Fin d)→ₗ[F] Profile p n, Injective f → (∀ x,totalRank (f x)≤K) → ∀ x, (7/8:ℝ)*bp (-(d:ℝ)) ≤ pr (onW w P) (fun z=> stains v m f z=x)
set_option maxHeartbeats 800000 intheorem glow_luminous (v : Solo p) (m : Mixer p n) (w : Wgt (Knobs p.g n)) (hw : IsLaw w) (S : AtomKey (p:=p) (v.t ()) N → Prop) (K : ℕ) (i : Orient p n N) (δ : ℝ) (hδ : 0<δ) (he : δ ≤ pr w (offBeat v S i)) (h : ∀ x, 0<totalRank x → totalRank x≤K → ¬ glow v m w S (glintRate K) δ x i) : luminous v m w S K i := by classical let P := offBeat v S i have hP : 0<pr w P := hδ.trans_le he let u := onW w P; have hu : IsLaw u := on_law hw.nz hP refine ⟨hP,fun d hd f hf hg x => ?_⟩ let s := stains v m f have heq : pr u (fun z => s z=x) = avg unif (fun i => vectorPhase i x* avg u (fun z => vectorPhase i (s z))) := by unfold pr simp_rw [vector_expand] rw [avg_avg] apply avg_congr intro i hi rw [avg_mul]; ring let b := bp (-(d:ℝ)) let Q (k : Vec (Fin d)) := vectorPhase k x * avg u (fun z => vectorPhase k (s z)) have hb : 0 < b := bp_pos _ have hh k : ind (k=0)-b/8 ≤ Q k := by by_cases hk : k=0 · subst k have hQ : Q 0=1 := by unfold Q; simp only [vectorPhase,zero_dotProduct,wsign_zero,one_mul, hu.avg_const] rw [ind_one (show (0:Vec (Fin d))=0 from rfl),hQ]; linarith let k' := f k have hT := h k' (totalRank_pos (hf.ne hk |>.trans_eq (map_zero f))) (hg k) have hz : |zsumPeak p w (v.shanty m k') P| ≤ (glintRate K)*pr w P := le_of_lt (lt_of_not_ge (fun h => hT ⟨he,h⟩)) have ht : avg u (fun z => vectorPhase k (s z))= zsumPeak p w (v.shanty m k') P/pr w P := by unfold s u onW; simp_rw [staining]; rw [avg_norm,subW_tot] congr 1; simp [zsumPeak,avg,subW,mul_assoc,k'] have h1 : |Q k|≤b/8 := by unfold Q; rw [ht,abs_mul,vectorPhase,wsign_abs,one_mul,abs_div,abs_of_pos hP] refine le_trans ((div_le_iff₀ hP).mpr hz) ((glint_within hd).trans_eq (by unfold b; ring)) rw [ind_zero hk,zero_sub]; exact (abs_le.mp h1).1 have h0 : unif (0:Vec (Fin d))=b := by unfold b; rw [unif_apply,card_space,dim_vec,bp_neg,Fintype.card_fin] change _ ≤ pr u (fun z => s z=x) rw [heq] refine le_trans ?_ (avg_mono unif_law.nz hh) rw [avg_sub,unif_law.avg_const, show avg unif (fun i : Vec (Fin d)=> ind (i=0))=b from (pr_point' unif _).trans h0] change 7/8*b≤_ linarithend Templateend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153import OAI.Combinatorics.HadwigerCounterexample.CrossPatternCounting
namespace OAI
/-! # Batch Characters -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix Module LinearMap Function Finset
variable {I J A B : Type} [Fintype I] [Fintype J] [Fintype A] [Fintype B]
variable [DecidableEq I] [DecidableEq J] [DecidableEq A] [DecidableEq B]
variable {n N t : ℕ}
def led (i : I) (x : Rack (I×J) N) := sectionR (fun j => (i,j)) x
def relay (I J : Type) [Fintype I] [Fintype J] (N) :
Rack (I×J) N ≃ (I → Rack J N) where
toFun x i := led i x
invFun x := (Matrix.of (fun i j => (x j.1).1 i j.2), Matrix.of (fun i j => (x j.1).2 i j.2))
left_inv x := by apply Prod.ext <;> rfl
right_inv x := funext fun _ => Prod.ext rfl rfl
theorem led_uniform (F : Wgt (I→Rack J N)) :
avg (unif : Wgt (Rack (I×J) N)) (fun x => F (fun i => led i x))=
avg (draws I unif) F := by
change avg unif (fun x => F (relay I J N x))=_
rw [← mapW_avg,unif_equiv,← draws_unif]
theorem led_piece (T : Finset I) (p : I→Rack J N→Prop) :
avg unif (fun x => ∏ i∈T,ind (p i (led i x))) =
∏ i∈T,pr unif (p i) := by
classical
let F (i : I) (z) := if i∈T then ind (p i z) else 1
let H : Wgt (I→ Rack J N) := prodW F
have he x : (∏ i∈T,ind (p i (led i x))) = H (fun i => led i x) := by
unfold H F prodW
rw [← Finset.prod_filter]; simp
have hf i : avg unif (F i) = if i∈T then pr unif (p i) else 1 := by
by_cases hh : i∈T <;> simp [F,pr,hh,unif_law.avg_const]
simp_rw [he]; rw [led_uniform]
unfold H draws
rw [prodW_avg]; simp_rw [hf]; rw [← Finset.prod_filter]; simp
def heard (T : A → I×J) := Finset.univ.image (Prod.fst ∘ T)
omit [Fintype I] [Fintype J] [DecidableEq A] in
theorem heard_fresh {T : A→I × J} {i : I} (B : PlusRack A N) (h : i∉heard T) (j : J) (k) :
upliftR T B k (i,j)=0 := by
classical
unfold upliftR
rw [Matrix.mul_apply]
refine Finset.sum_eq_zero fun x _ => ?_
have he : (i,j)≠T x := fun e => h (mem_image.mpr
⟨x,mem_univ _, (congrArg Prod.fst e).symm⟩)
simp [embedMat,he]
omit [Fintype I] [Fintype J] [DecidableEq A] in
private theorem led_off_r (x : Rack (I×J) N) {T : A→I×J} {i : I} (B : PlusRack A N)
(h : i∉heard T) :
led i (x+(0,upliftR T B)) = led i x := by
apply Prod.ext
· ext; simp [led,sectionR]
ext
simp only [led,sectionR,Prod.snd_add,Matrix.add_apply,Matrix.submatrix_apply,
heard_fresh B h,add_zero]
omit [Fintype I] [Fintype J] [DecidableEq A] in
private theorem led_off_l (x : Rack (I×J) N) {T : A→I×J} {i : I} (B : PlusRack A N)
(h : i∉heard T) :
led i (x+(upliftR T B,0)) = led i x := by
apply Prod.ext
· ext
simp only [led,sectionR,Prod.fst_add,Matrix.add_apply,Matrix.submatrix_apply,
heard_fresh B h,add_zero]
ext; simp [led,sectionR]
def phot (P : I→Rack J N→Prop) (x : Rack (I×J) N) :=
∏ i:I,ind (P i (led i x))
set_option maxHeartbeats 800000 in
theorem light_bound (M : Avenue I J) (P : I→Rack J N→Prop) (u : ℝ) (hu : 0 ≤ u)
(hp : ∀ i,bp (-u) ≤ pr unif (P i)) :
|avg unif (fun x => phasedBy M x*phot P x)| ≤
bp ((-(N:ℝ)/2+2*u)*(peak M:ℝ)) * ∏ i,pr unif (P i) := by
classical
obtain ⟨T,U,hTU,hA⟩ := real_peak M
let t := peak M
let L := heard T
let R := heard U
let D := L∪R
let S := Finset.univ \ D
have hd : Disjoint L R := by
refine Finset.disjoint_left.mpr ?_
intro x hx hy
obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hx
obtain ⟨j,_,he⟩ := Finset.mem_image.mp hy
exact hTU i j he.symm
let f (Z : Finset I) (x : Rack (I×J) N) := ∏ i∈Z,ind (P i (led i x))
have hs (V : Finset I) x : |f V x|=f V x := abs_of_nonneg (Finset.prod_nonneg (fun i _ =>
ind_nonneg _))
have heq (V : Finset I) x : |f V x|≤1 := (hs V x).trans_le
((Finset.prod_le_prod₀ (fun _ _ => ind_nonneg _) (fun _ _ => ind_le_one _)).trans_eq (by simp))
have h1 :
(∏ i,pr unif (P i))=(∏ i∈D,pr unif (P i))*(∏ i∈S,pr unif (P i)) := by
rw [←Finset.prod_union (show Disjoint D S from disjoint_sdiff),
Finset.union_sdiff_of_subset (Finset.subset_univ D)]
have hf x : phot P x=f L x*f R x*f S x := by
unfold phot f
rw [←Finset.prod_union hd,←Finset.prod_union (show Disjoint D S from disjoint_sdiff),
Finset.union_sdiff_of_subset (Finset.subset_univ D)]
have hl :
|avg unif (fun x => phasedBy M x*phot P x)| ≤ bp (-(N:ℝ)*t/2) * avg unif (fun x => |f S x|) := by
have he x : phasedBy M x*phot P x=phasedBy M x*f L x*f R x*f S x := by rw [hf]; ring
simp_rw [he]
rw [←show (M.submatrix T U).rank=t from
(mrk_inj.mp hA).trans (Fintype.card_fin _)]
refine layerLeak M (f L) (f R) (f S) T U (heq _) (heq _) (fun x y => ?_)
(fun x y => ?_) (fun x y z => ?_)
· refine Finset.prod_congr rfl fun i hi => ?_
rw [led_off_r x y (fun h => Finset.disjoint_left.mp hd hi h)]
· refine Finset.prod_congr rfl fun i hi => ?_
rw [led_off_l x y (fun h => Finset.disjoint_left.mp hd h hi)]
· refine Finset.prod_congr rfl fun i hi => ?_
have hr := (Finset.mem_sdiff.mp hi).2
rw [show x+(upliftR T y,upliftR U z)=x+(0,upliftR U z)+(upliftR T y,0) from
by rw [add_assoc]; apply congrArg; apply Prod.ext <;> simp,
led_off_l _ y (fun h => hr (mem_union_left _ h)),
led_off_r _ z (fun h => hr (mem_union_right _ h))]
apply hl.trans
simp_rw [hs]
rw [show avg unif (fun x => f S x)= _ from led_piece S P,h1,← mul_assoc]
refine mul_le_mul_of_nonneg_right ?_ (Finset.prod_nonneg fun _ _ => pr_nonneg unif_law.nz)
have hc : D.card ≤ 2*t := by
apply le_trans (Finset.card_union_le ..)
have hi (T : Fin t→ I × J) : (heard T).card≤t :=
Finset.card_image_le.trans_eq (by simp)
rw [two_mul]; exact add_le_add (hi T) (hi U)
have hQ : bp (-u*(2*(t:ℝ))) ≤ ∏ i∈D,pr unif (P i) := by
refine le_trans ?_ (Finset.prod_le_prod₀ (fun i _ => (bp_pos _).le) fun i _ => hp i)
rw [Finset.prod_const,←bp_mul_nat]
apply bp_le
apply mul_le_mul_of_nonpos_left
· exact_mod_cast hc
exact neg_nonpos.mpr hu
calc bp _
_ = bp ((-(N:ℝ)/2+2*u)*(peak M:ℝ)) * bp (-u*(2*t)) := by rw [←bp_add]; congr 1; unfold t; ring
_ ≤ _ := mul_le_mul_of_nonneg_left hQ (bp_pos _).le
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.CrossPatternCounting
namespace OAI
/-! # Batch Characters -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperatorsopen Matrix Module LinearMap Function Finsetvariable {I J A B : Type} [Fintype I] [Fintype J] [Fintype A] [Fintype B]variable [DecidableEq I] [DecidableEq J] [DecidableEq A] [DecidableEq B]variable {n N t : ℕ}
def led (i : I) (x : Rack (I×J) N) := sectionR (fun j => (i,j)) xdef relay (I J : Type) [Fintype I] [Fintype J] (N) : Rack (I×J) N ≃ (I → Rack J N) where toFun x i := led i x invFun x := (Matrix.of (fun i j => (x j.1).1 i j.2), Matrix.of (fun i j => (x j.1).2 i j.2)) left_inv x := by apply Prod.ext <;> rfl right_inv x := funext fun _ => Prod.ext rfl rfl
theorem led_uniform (F : Wgt (I→Rack J N)) : avg (unif : Wgt (Rack (I×J) N)) (fun x => F (fun i => led i x))= avg (draws I unif) F := by change avg unif (fun x => F (relay I J N x))=_ rw [← mapW_avg,unif_equiv,← draws_unif]
theorem led_piece (T : Finset I) (p : I→Rack J N→Prop) : avg unif (fun x => ∏ i∈T,ind (p i (led i x))) = ∏ i∈T,pr unif (p i) := by classical let F (i : I) (z) := if i∈T then ind (p i z) else 1 let H : Wgt (I→ Rack J N) := prodW F have he x : (∏ i∈T,ind (p i (led i x))) = H (fun i => led i x) := by unfold H F prodW rw [← Finset.prod_filter]; simp have hf i : avg unif (F i) = if i∈T then pr unif (p i) else 1 := by by_cases hh : i∈T <;> simp [F,pr,hh,unif_law.avg_const] simp_rw [he]; rw [led_uniform] unfold H draws rw [prodW_avg]; simp_rw [hf]; rw [← Finset.prod_filter]; simp
def heard (T : A → I×J) := Finset.univ.image (Prod.fst ∘ T)
omit [Fintype I] [Fintype J] [DecidableEq A] intheorem heard_fresh {T : A→I × J} {i : I} (B : PlusRack A N) (h : i∉heard T) (j : J) (k) : upliftR T B k (i,j)=0 := by classical unfold upliftR rw [Matrix.mul_apply] refine Finset.sum_eq_zero fun x _ => ?_ have he : (i,j)≠T x := fun e => h (mem_image.mpr ⟨x,mem_univ _, (congrArg Prod.fst e).symm⟩) simp [embedMat,he]
omit [Fintype I] [Fintype J] [DecidableEq A] inprivate theorem led_off_r (x : Rack (I×J) N) {T : A→I×J} {i : I} (B : PlusRack A N) (h : i∉heard T) : led i (x+(0,upliftR T B)) = led i x := by apply Prod.ext · ext; simp [led,sectionR] ext simp only [led,sectionR,Prod.snd_add,Matrix.add_apply,Matrix.submatrix_apply, heard_fresh B h,add_zero]
omit [Fintype I] [Fintype J] [DecidableEq A] inprivate theorem led_off_l (x : Rack (I×J) N) {T : A→I×J} {i : I} (B : PlusRack A N) (h : i∉heard T) : led i (x+(upliftR T B,0)) = led i x := by apply Prod.ext · ext simp only [led,sectionR,Prod.fst_add,Matrix.add_apply,Matrix.submatrix_apply, heard_fresh B h,add_zero] ext; simp [led,sectionR]
def phot (P : I→Rack J N→Prop) (x : Rack (I×J) N) := ∏ i:I,ind (P i (led i x))
set_option maxHeartbeats 800000 intheorem light_bound (M : Avenue I J) (P : I→Rack J N→Prop) (u : ℝ) (hu : 0 ≤ u) (hp : ∀ i,bp (-u) ≤ pr unif (P i)) : |avg unif (fun x => phasedBy M x*phot P x)| ≤ bp ((-(N:ℝ)/2+2*u)*(peak M:ℝ)) * ∏ i,pr unif (P i) := by classical obtain ⟨T,U,hTU,hA⟩ := real_peak M let t := peak M let L := heard T let R := heard U let D := L∪R let S := Finset.univ \ D have hd : Disjoint L R := by refine Finset.disjoint_left.mpr ?_ intro x hx hy obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hx obtain ⟨j,_,he⟩ := Finset.mem_image.mp hy exact hTU i j he.symm let f (Z : Finset I) (x : Rack (I×J) N) := ∏ i∈Z,ind (P i (led i x)) have hs (V : Finset I) x : |f V x|=f V x := abs_of_nonneg (Finset.prod_nonneg (fun i _ => ind_nonneg _)) have heq (V : Finset I) x : |f V x|≤1 := (hs V x).trans_le ((Finset.prod_le_prod₀ (fun _ _ => ind_nonneg _) (fun _ _ => ind_le_one _)).trans_eq (by simp)) have h1 : (∏ i,pr unif (P i))=(∏ i∈D,pr unif (P i))*(∏ i∈S,pr unif (P i)) := by rw [←Finset.prod_union (show Disjoint D S from disjoint_sdiff), Finset.union_sdiff_of_subset (Finset.subset_univ D)] have hf x : phot P x=f L x*f R x*f S x := by unfold phot f rw [←Finset.prod_union hd,←Finset.prod_union (show Disjoint D S from disjoint_sdiff), Finset.union_sdiff_of_subset (Finset.subset_univ D)] have hl : |avg unif (fun x => phasedBy M x*phot P x)| ≤ bp (-(N:ℝ)*t/2) * avg unif (fun x => |f S x|) := by have he x : phasedBy M x*phot P x=phasedBy M x*f L x*f R x*f S x := by rw [hf]; ring simp_rw [he] rw [←show (M.submatrix T U).rank=t from (mrk_inj.mp hA).trans (Fintype.card_fin _)]
refine layerLeak M (f L) (f R) (f S) T U (heq _) (heq _) (fun x y => ?_) (fun x y => ?_) (fun x y z => ?_) · refine Finset.prod_congr rfl fun i hi => ?_ rw [led_off_r x y (fun h => Finset.disjoint_left.mp hd hi h)] · refine Finset.prod_congr rfl fun i hi => ?_ rw [led_off_l x y (fun h => Finset.disjoint_left.mp hd h hi)] · refine Finset.prod_congr rfl fun i hi => ?_ have hr := (Finset.mem_sdiff.mp hi).2 rw [show x+(upliftR T y,upliftR U z)=x+(0,upliftR U z)+(upliftR T y,0) from by rw [add_assoc]; apply congrArg; apply Prod.ext <;> simp, led_off_l _ y (fun h => hr (mem_union_left _ h)), led_off_r _ z (fun h => hr (mem_union_right _ h))] apply hl.trans simp_rw [hs] rw [show avg unif (fun x => f S x)= _ from led_piece S P,h1,← mul_assoc] refine mul_le_mul_of_nonneg_right ?_ (Finset.prod_nonneg fun _ _ => pr_nonneg unif_law.nz) have hc : D.card ≤ 2*t := by apply le_trans (Finset.card_union_le ..) have hi (T : Fin t→ I × J) : (heard T).card≤t := Finset.card_image_le.trans_eq (by simp) rw [two_mul]; exact add_le_add (hi T) (hi U) have hQ : bp (-u*(2*(t:ℝ))) ≤ ∏ i∈D,pr unif (P i) := by refine le_trans ?_ (Finset.prod_le_prod₀ (fun i _ => (bp_pos _).le) fun i _ => hp i) rw [Finset.prod_const,←bp_mul_nat] apply bp_le apply mul_le_mul_of_nonpos_left · exact_mod_cast hc exact neg_nonpos.mpr hu calc bp _ _ = bp ((-(N:ℝ)/2+2*u)*(peak M:ℝ)) * bp (-u*(2*t)) := by rw [←bp_add]; congr 1; unfold t; ring _ ≤ _ := mul_le_mul_of_nonneg_left hQ (bp_pos _).leend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142import OAI.Combinatorics.HadwigerCounterexample.OrthogonalSpectrumBounds
namespace OAI
/-! # Biased Rotation Bounds -/
noncomputable section
namespace HadwigerCounterexample
open Finset Matrix Module Submodule Function LinearMap Filter Real
open scoped BigOperators
variable {p : Shape} {n : ℕ}
set_option maxHeartbeats 1200000 in
theorem spinning (p : Shape) (w : Wgt (Knobs p.g n))
(f : Flit n→Wgt (Knobs p.g n)) (P : Knobs p.g n→Prop)
(hw : IsLaw w) (hf : ∀ i j,|f i j|≤1) (h : flowZ p w)
(b g δ : ℝ) (hb : 0≤b)
(T : Space (Vec (Fin n))) (s l : ℕ) (hk : s<n)
(hh : ∀ (c : Flit n) x i, |zchar p (f c) i x|≤b ∧
(i∉ c.plume T → zchar p (f c) i x=0))
(hδ : 0<δ) (ht : b*bp s < g) (hP : δ≤ pr w P)
(hL : 1 < l * ((g-b*bp s)*δ)^2) :
pr unif (fun c => g*pr w P ≤ |zsumPeak p w (f c) P|) ≤
bp (1+((dim T:ℝ)+l*(dim T:ℝ)-n)*s) := by
classical
let M := g-b*bp s; have hM : 0<M := sub_pos.mpr ht
let D c := g*pr w P ≤ |zsumPeak p w (f c) P|
by_contra! H
have progress (i : ℕ) (h' : i≤l) :
∃ (S : Space (Vec (Fin n))) (U : Wgt (Knobs p.g n)),
zsafe p w U S ∧ dim S≤ i*dim T ∧ i*(M*δ) ≤ zsumPeak p w U P ∧
avg w (fun x=>U x ^ 2) ≤ i := by
induction i with
| zero =>
refine ⟨⊥,fun _=>0,?_,?_,?_,?_⟩
· intro i t h; simp only [zero_mul,avg_zero]
· simp [dim]
· simp [zsumPeak,avg_zero]
simp only [zero_pow (by decide : 2 ≠ 0),avg_zero,Nat.cast_zero,le_refl]
| succ i ih =>
obtain ⟨S,U,hS,hU,h1,h2⟩ := ih (by omega)
let Q (c : Flit n) := s < dim (c.plume T ⊓ S : Space (Vec (Fin n)))
have hh' : ∃ c : Flit n, D c ∧ ¬ Q c := by
by_contra! hh
have hz := (pr_mono unif_law.nz (fun c (h : D c) =>
(hh c h).le)).trans (Move.plume_meets n s hk T S)
have hy : (dim S:ℝ)≤ l*(dim T:ℝ) := by
exact_mod_cast (hU.trans (Nat.mul_le_mul_right _ (by omega) : i*dim T ≤ l*dim T))
apply (not_lt_of_ge (le_trans hz (bp_le ?_))) H
nlinarith only [mul_le_mul_of_nonneg_right hy (Nat.cast_nonneg s : 0≤(s:ℝ))]
obtain ⟨c,he,hc⟩ := hh'
let W := c.plume T
have hk : dim (S ⊓ W : Space (Vec (Fin n))) ≤ s := by
have hh : dim (W⊓S : Space (Vec (Fin n))) ≤ s := le_of_not_gt hc
rw [inf_comm]; exact hh
obtain ⟨t,a,ha,hA,hy,hz⟩ := clear_band p w (f c) P hw (hf c) h b g hb he S W s hk (hh c)
let Z i := a*zim p (f c) t i
let C i := U i+Z i
have hQ : avg w (fun i=>U i * Z i)=0 := by
have he := hS (f c) t (fun i hi => (hA i hi).1)
unfold Z; simp_rw [mul_left_comm _ a,avg_mul',he,mul_zero]
refine ⟨S ⊔ W,C,?_,?_,?_,?_⟩
· intro i s hh
have hL := zsplit_orth p (f c) i w h t s (Finset.disjoint_left.mpr (fun j hj he =>
hh j he ((show W≤S⊔W from le_sup_right) (hA j hj).2)))
have he := hS i s (fun j hj h => hh j hj ((show S≤S⊔W from le_sup_left) h))
unfold C Z; simp only [add_mul,mul_assoc,avg_add,avg_mul',he,hL,mul_zero,add_zero]
· have h := Submodule.finrank_add_le_finrank_add_finrank S W
refine le_trans h ?_
change dim S+dim W≤_
unfold W; rw [Move.plume_dim c T,Nat.add_mul,one_mul]
omega
· unfold zsumPeak C; simp_rw [mul_add,avg_add]
change _≤zsumPeak p w U P+zsumPeak p w Z P
change M*pr w P ≤ zsumPeak p w Z P at hy
push_cast
nlinarith only [h1,hy,mul_le_mul_of_nonneg_left hP hM.le]
· have hh (i) : C i^2=U i^2+Z i^2+2*(U i*Z i) := by unfold C; ring
simp_rw [hh,avg_add,avg_mul',hQ,mul_zero,add_zero]
exact (add_le_add h2 hz).trans_eq (by push_cast; rfl)
obtain ⟨S,U,_,_,hu,hq⟩ := progress l (le_refl _)
have hh : ↑l * (M*δ) ≤ zsumPeak p w U P := hu
have hx :
zsumPeak p w U P ^2 ≤ l := by
apply (avg_CS hw.nz (fun i=>ind (P i)) U).trans
have hz (i : Knobs p.g n) : ind (P i)^2 ≤ 1 :=
calc ind (P i)^2 ≤ 1^2 := pow_le_pow_left₀ (ind_nonneg _) (ind_le_one _) _
_ = _ := one_pow _
exact (mul_le_mul (hw.avg_le hz) hq (avg_nonneg hw.nz (fun _ => sq_nonneg _))
zero_le_one).trans_eq (one_mul _)
have hy := pow_le_pow_left₀ (by positivity) hh 2
change 1<↑l*(M*δ)^2 at hL
have hl : 0<l := by
by_contra! he
obtain rfl : l=0 := by omega
norm_num at hL
nlinarith only [hx,hy,mul_lt_mul_of_pos_left hL
(Nat.cast_pos.mpr hl : (0:ℝ) < l)]
namespace Template
variable {K s A : ℕ}
theorem rotor_levels (v : Solo p) (K s a : ℕ)
(hs : 2*a<s) (hg : Odd p.g)
(δ g : ℝ) (hδ : 0<δ)
(hG : bp (-((p.J-s:ℕ):ℝ))*bp s < g) :
∀ᶠ n : ℕ in atTop, ∀ m : Mixer p n, unaryGood m K s →
∀ x : Profile p n, 0<totalRank x → totalRank x ≤ K →
∀ w : Wgt (Knobs p.g n), IsLaw w → flowZ p w →
∀ P : Knobs p.g n → Prop, δ ≤ pr w P →
pr unif (fun c => g*pr w P ≤|zsumPeak p w (v.rotor c m x) P|) ≤ bp (-(2*a:ℝ)*n) := by
classical
let b := bp (-((p.J-s:ℕ):ℝ))
have hb : b*bp s<g := hG
let t := ((g-b*bp s)*δ)^2
have ht : 0<t := by apply pow_pos (mul_pos (sub_pos.mpr hb) hδ)
obtain ⟨l,hl⟩ := exists_nat_gt (1/t)
let d := 2*(p.J*(p.g-1)*(2*K))
have ha : 0<(s:ℝ)-2*a := sub_pos.mpr (by exact_mod_cast hs)
have hz : Tendsto (fun n:ℕ => (↑s-2*a:ℝ)*n) atTop atTop :=
(tendsto_const_mul_atTop_of_pos ha).mpr tendsto_natCast_atTop_atTop
filter_upwards [eventually_gt_atTop s,hz.eventually (eventually_ge_atTop
(1+((d:ℝ)+l*d)*s))] with n hn hN m hm x hx hK w hw hh P hP
have he := spinning p w (fun c=>v.rotor c m x) P hw (by
intro i j; unfold rotor Move.zreroute shanty; rw [wsign_abs]) hh b g δ
(bp_pos _).le _ s l hn (fun c y i => v.rotor_budget c m x K s hg hm hK hx y i)
hδ hb hP ((div_lt_iff₀ ht).mp hl)
apply he.trans
apply bp_le
have hy :
dim (v.scroll m x) ≤ d :=
(scroll_dim v m x).trans (by unfold d; gcongr)
have hx : ((dim (v.scroll m x)):ℝ) ≤ d := by exact_mod_cast hy
change 1+((d:ℝ)+l*d)*s≤ ((s:ℝ)-2*a)*n at hN
have hB := mul_le_mul_of_nonneg_left hx (Nat.cast_nonneg l : 0≤(l:ℝ))
nlinarith only [mul_le_mul_of_nonneg_right (add_le_add hx hB)
(Nat.cast_nonneg s : 0≤(s:ℝ)),hN]
end Template
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.OrthogonalSpectrumBounds
namespace OAI
/-! # Biased Rotation Bounds -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Matrix Module Submodule Function LinearMap Filter Realopen scoped BigOperatorsvariable {p : Shape} {n : ℕ}
set_option maxHeartbeats 1200000 intheorem spinning (p : Shape) (w : Wgt (Knobs p.g n)) (f : Flit n→Wgt (Knobs p.g n)) (P : Knobs p.g n→Prop) (hw : IsLaw w) (hf : ∀ i j,|f i j|≤1) (h : flowZ p w) (b g δ : ℝ) (hb : 0≤b) (T : Space (Vec (Fin n))) (s l : ℕ) (hk : s<n) (hh : ∀ (c : Flit n) x i, |zchar p (f c) i x|≤b ∧ (i∉ c.plume T → zchar p (f c) i x=0)) (hδ : 0<δ) (ht : b*bp s < g) (hP : δ≤ pr w P) (hL : 1 < l * ((g-b*bp s)*δ)^2) : pr unif (fun c => g*pr w P ≤ |zsumPeak p w (f c) P|) ≤ bp (1+((dim T:ℝ)+l*(dim T:ℝ)-n)*s) := by classical let M := g-b*bp s; have hM : 0<M := sub_pos.mpr ht let D c := g*pr w P ≤ |zsumPeak p w (f c) P| by_contra! H have progress (i : ℕ) (h' : i≤l) : ∃ (S : Space (Vec (Fin n))) (U : Wgt (Knobs p.g n)), zsafe p w U S ∧ dim S≤ i*dim T ∧ i*(M*δ) ≤ zsumPeak p w U P ∧ avg w (fun x=>U x ^ 2) ≤ i := by induction i with | zero => refine ⟨⊥,fun _=>0,?_,?_,?_,?_⟩ · intro i t h; simp only [zero_mul,avg_zero] · simp [dim] · simp [zsumPeak,avg_zero] simp only [zero_pow (by decide : 2 ≠ 0),avg_zero,Nat.cast_zero,le_refl] | succ i ih => obtain ⟨S,U,hS,hU,h1,h2⟩ := ih (by omega) let Q (c : Flit n) := s < dim (c.plume T ⊓ S : Space (Vec (Fin n))) have hh' : ∃ c : Flit n, D c ∧ ¬ Q c := by by_contra! hh have hz := (pr_mono unif_law.nz (fun c (h : D c) => (hh c h).le)).trans (Move.plume_meets n s hk T S) have hy : (dim S:ℝ)≤ l*(dim T:ℝ) := by exact_mod_cast (hU.trans (Nat.mul_le_mul_right _ (by omega) : i*dim T ≤ l*dim T)) apply (not_lt_of_ge (le_trans hz (bp_le ?_))) H nlinarith only [mul_le_mul_of_nonneg_right hy (Nat.cast_nonneg s : 0≤(s:ℝ))] obtain ⟨c,he,hc⟩ := hh' let W := c.plume T have hk : dim (S ⊓ W : Space (Vec (Fin n))) ≤ s := by have hh : dim (W⊓S : Space (Vec (Fin n))) ≤ s := le_of_not_gt hc rw [inf_comm]; exact hh obtain ⟨t,a,ha,hA,hy,hz⟩ := clear_band p w (f c) P hw (hf c) h b g hb he S W s hk (hh c) let Z i := a*zim p (f c) t i let C i := U i+Z i have hQ : avg w (fun i=>U i * Z i)=0 := by have he := hS (f c) t (fun i hi => (hA i hi).1) unfold Z; simp_rw [mul_left_comm _ a,avg_mul',he,mul_zero] refine ⟨S ⊔ W,C,?_,?_,?_,?_⟩ · intro i s hh have hL := zsplit_orth p (f c) i w h t s (Finset.disjoint_left.mpr (fun j hj he => hh j he ((show W≤S⊔W from le_sup_right) (hA j hj).2))) have he := hS i s (fun j hj h => hh j hj ((show S≤S⊔W from le_sup_left) h)) unfold C Z; simp only [add_mul,mul_assoc,avg_add,avg_mul',he,hL,mul_zero,add_zero] · have h := Submodule.finrank_add_le_finrank_add_finrank S W refine le_trans h ?_ change dim S+dim W≤_ unfold W; rw [Move.plume_dim c T,Nat.add_mul,one_mul] omega · unfold zsumPeak C; simp_rw [mul_add,avg_add] change _≤zsumPeak p w U P+zsumPeak p w Z P change M*pr w P ≤ zsumPeak p w Z P at hy push_cast nlinarith only [h1,hy,mul_le_mul_of_nonneg_left hP hM.le] · have hh (i) : C i^2=U i^2+Z i^2+2*(U i*Z i) := by unfold C; ring simp_rw [hh,avg_add,avg_mul',hQ,mul_zero,add_zero] exact (add_le_add h2 hz).trans_eq (by push_cast; rfl) obtain ⟨S,U,_,_,hu,hq⟩ := progress l (le_refl _) have hh : ↑l * (M*δ) ≤ zsumPeak p w U P := hu have hx : zsumPeak p w U P ^2 ≤ l := by apply (avg_CS hw.nz (fun i=>ind (P i)) U).trans have hz (i : Knobs p.g n) : ind (P i)^2 ≤ 1 := calc ind (P i)^2 ≤ 1^2 := pow_le_pow_left₀ (ind_nonneg _) (ind_le_one _) _ _ = _ := one_pow _ exact (mul_le_mul (hw.avg_le hz) hq (avg_nonneg hw.nz (fun _ => sq_nonneg _)) zero_le_one).trans_eq (one_mul _) have hy := pow_le_pow_left₀ (by positivity) hh 2 change 1<↑l*(M*δ)^2 at hL have hl : 0<l := by by_contra! he obtain rfl : l=0 := by omega norm_num at hL nlinarith only [hx,hy,mul_lt_mul_of_pos_left hL (Nat.cast_pos.mpr hl : (0:ℝ) < l)]
namespace Templatevariable {K s A : ℕ}theorem rotor_levels (v : Solo p) (K s a : ℕ) (hs : 2*a<s) (hg : Odd p.g) (δ g : ℝ) (hδ : 0<δ) (hG : bp (-((p.J-s:ℕ):ℝ))*bp s < g) : ∀ᶠ n : ℕ in atTop, ∀ m : Mixer p n, unaryGood m K s → ∀ x : Profile p n, 0<totalRank x → totalRank x ≤ K → ∀ w : Wgt (Knobs p.g n), IsLaw w → flowZ p w → ∀ P : Knobs p.g n → Prop, δ ≤ pr w P → pr unif (fun c => g*pr w P ≤|zsumPeak p w (v.rotor c m x) P|) ≤ bp (-(2*a:ℝ)*n) := by classical let b := bp (-((p.J-s:ℕ):ℝ)) have hb : b*bp s<g := hG let t := ((g-b*bp s)*δ)^2 have ht : 0<t := by apply pow_pos (mul_pos (sub_pos.mpr hb) hδ) obtain ⟨l,hl⟩ := exists_nat_gt (1/t) let d := 2*(p.J*(p.g-1)*(2*K)) have ha : 0<(s:ℝ)-2*a := sub_pos.mpr (by exact_mod_cast hs) have hz : Tendsto (fun n:ℕ => (↑s-2*a:ℝ)*n) atTop atTop := (tendsto_const_mul_atTop_of_pos ha).mpr tendsto_natCast_atTop_atTop filter_upwards [eventually_gt_atTop s,hz.eventually (eventually_ge_atTop (1+((d:ℝ)+l*d)*s))] with n hn hN m hm x hx hK w hw hh P hP have he := spinning p w (fun c=>v.rotor c m x) P hw (by intro i j; unfold rotor Move.zreroute shanty; rw [wsign_abs]) hh b g δ (bp_pos _).le _ s l hn (fun c y i => v.rotor_budget c m x K s hg hm hK hx y i) hδ hb hP ((div_lt_iff₀ ht).mp hl) apply he.trans apply bp_le have hy : dim (v.scroll m x) ≤ d := (scroll_dim v m x).trans (by unfold d; gcongr) have hx : ((dim (v.scroll m x)):ℝ) ≤ d := by exact_mod_cast hy change 1+((d:ℝ)+l*d)*s≤ ((s:ℝ)-2*a)*n at hN have hB := mul_le_mul_of_nonneg_left hx (Nat.cast_nonneg l : 0≤(l:ℝ)) nlinarith only [mul_le_mul_of_nonneg_right (add_le_add hx hB) (Nat.cast_nonneg s : 0≤(s:ℝ)),hN]end Templateend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107import OAI.Combinatorics.HadwigerCounterexample.OppositeEndpointForms
namespace OAI
/-! # Bilinear Block Correlation -/
noncomputable section
namespace HadwigerCounterexample
open Finset LinearMap Module Matrix Function
open scoped BigOperators
variable {p : Shape} {I J A : Type} [Fintype I] [Fintype J] [Fintype A]
variable {n : ℕ}
def spring (p : Shape) (l : Tag p.g) (s : Label p.b) (f : Flavor p.g)
(y : Knobs p.g n) := point p s (lit f l y)
theorem spring_update (p : Shape) (l : Tag p.g) (s : Label p.b) (f : Flavor p.g)
(y : Knobs p.g n) (B) (h : f.keeps l B) (z : Vec (Fin n)) :
spring p l s f (update y B z)= spring p l s f (update y B 0)+
blockRay p n s B *ᵥ z := by
classical
have he : baseV (lit f l (update y B z))=baseV (lit f l (update y B 0))+blockA p n B *ᵥ z := by
funext a
rcases a with _|⟨d,j⟩
· simp [baseV,blockA,mulVec,dotProduct,embedMat]
by_cases hk : d=B
· subst d; simp [baseV,blockA,mulVec,dotProduct,embedMat,lit,h]
simp [baseV,blockA,mulVec,dotProduct,embedMat,lit,hk]
unfold spring point blockRay
rw [he,map_add,←Matrix.mulVec_mulVec,labMat_act]
private def dotLB (I : Type) [Fintype I] : Vec I →ₗ[F] Vec I→ₗ[F] F where
toFun := dotL
map_add' p q := LinearMap.ext fun i => add_dotProduct p q i
map_smul' a p := LinearMap.ext fun i => by
change dotProduct (a • p) i=a*dotProduct p i
rw [smul_dotProduct]; rfl
theorem spark_walsh [DecidableEq I] [DecidableEq J] (M : Mat I J) (p : Wgt (Vec I)) (q : Wgt (Vec J))
(hp : ∀ i, |p i|≤1) (hq : ∀ i, |q i|≤1) :
|avg (pairW unif unif) (fun i => wsign (evmat M i.1 i.2)*(p i.1*q i.2))| ≤
bp (-(M.rank:ℝ)/2) := by
classical
let Q := dotLB I
let L := Q ∘ₗ M.mulVecLin
have he (i j) : evmat M i j=L j i := dotProduct_comm ..
have hh : Injective Q := fun x y h => funext (fun i => by
have hg := LinearMap.congr_fun h (Pi.single i 1)
change dotProduct x (Pi.single i 1)=dotProduct y (Pi.single i 1) at hg
simpa using hg)
have ht : rk L=M.rank := by
have h : LinearMap.ker L=LinearMap.ker M.mulVecLin := by
ext x; change Q (M.mulVecLin x)=0 ↔ M.mulVecLin x=0
rw [← map_zero Q,hh.eq_iff]
have hv := L.finrank_range_add_finrank_ker
rw [h, ← M.mulVecLin.finrank_range_add_finrank_ker] at hv
exact Nat.add_right_cancel hv
rw [pairW_avg]
have hz (x : Vec I) (y : Vec J) : wsign (evmat M x y)*(p x*q y)=p x*(q y*wsign (L y x)) := by
rw [he]; ring
simp_rw [hz,avg_mul']
rw [←ht]
exact walsh_bound _ q p hq hp
set_option maxHeartbeats 800000 in
theorem spark_uncap (p : Shape) (M : Moment p n) (s t : Label p.b) (l j : Tag p.g)
(f g : Flavor p.g) (B) (hB : f.keeps l B) (hB' : g.keeps j B)
(w u : Wgt (Knobs p.g n)) (hw : ∀ i,|w i| ≤ 1) (hu : ∀ i,|u i|≤1) :
let Q i z := evmat M (spring p l s f i) (spring p j t g z)
|avg (pairW unif unif) (fun x => wsign (Q x.1 x.2)*(w x.1*u x.2))|≤
bp (-(blockRank B s t M:ℝ)/2) := by
classical
intro Q
let F (x : Knobs p.g n × _) := wsign (Q x.1 x.2)*(w x.1*u x.2)
let K := Wgt (Vec (Fin n))
let v : Block p.g→ K := fun _ => unif
have ht := update2_avg v v B F unif_law unif_law
have he : prodW v=unif := draws_unif.symm
let R := blockRay p n s B; let S:=blockRay p n t B
let H := pullM R S M
have hi (x y : Knobs p.g n) :
|avg (pairW (v B) (v B)) (fun i => F (update x B i.1,update y B i.2))|≤
bp (-(blockRank B s t M:ℝ)/2) := by
let X := spring p l s f (update x B 0); let Y := spring p j t g (update y B 0)
let A i := evmat M (R *ᵥ i) Y; let D j := evmat M X (S *ᵥ j)+evmat M X Y
let Z i := wsign (A i)*w (update x B i); let W j := wsign (D j)*u (update y B j)
have hp i j' :
Q (update x B i) (update y B j')= evmat H i j'+(A i+D j') := by
unfold Q; rw [spring_update _ _ _ _ _ _ hB,spring_update _ _ _ _ _ _ hB']
unfold H A D X Y; rw [evmat_pull]
simp only [evmat,mulVec_add,add_dotProduct,dotProduct_add,R,S]; ac_rfl
have hh i j : F (update x B i,update y B j)=wsign (evmat H i j)*(Z i*W j) := by
unfold F Z W; dsimp only; rw [hp,wsign_add,wsign_add]; ring
have hz i : |Z i|≤1 := by unfold Z; rw [abs_mul,wsign_abs,one_mul]; exact hw _
have hy i : |W i|≤1 := by unfold W; rw [abs_mul,wsign_abs,one_mul]; exact hu _
simp_rw [hh]
exact spark_walsh _ Z W hz hy
simp only [he] at ht
change |avg (pairW unif unif) F|≤_
rw [ht]
let hq := pairW_law (α:=Knobs p.g n) (β:=Knobs p.g n) unif_law unif_law
exact (abs_avg_le hq.nz).trans (hq.avg_le fun x => hi x.1 x.2)
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.OppositeEndpointForms
namespace OAI
/-! # Bilinear Block Correlation -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset LinearMap Module Matrix Functionopen scoped BigOperatorsvariable {p : Shape} {I J A : Type} [Fintype I] [Fintype J] [Fintype A]variable {n : ℕ}
def spring (p : Shape) (l : Tag p.g) (s : Label p.b) (f : Flavor p.g) (y : Knobs p.g n) := point p s (lit f l y)
theorem spring_update (p : Shape) (l : Tag p.g) (s : Label p.b) (f : Flavor p.g) (y : Knobs p.g n) (B) (h : f.keeps l B) (z : Vec (Fin n)) : spring p l s f (update y B z)= spring p l s f (update y B 0)+ blockRay p n s B *ᵥ z := by classical have he : baseV (lit f l (update y B z))=baseV (lit f l (update y B 0))+blockA p n B *ᵥ z := by funext a rcases a with _|⟨d,j⟩ · simp [baseV,blockA,mulVec,dotProduct,embedMat] by_cases hk : d=B · subst d; simp [baseV,blockA,mulVec,dotProduct,embedMat,lit,h] simp [baseV,blockA,mulVec,dotProduct,embedMat,lit,hk] unfold spring point blockRay rw [he,map_add,←Matrix.mulVec_mulVec,labMat_act]
private def dotLB (I : Type) [Fintype I] : Vec I →ₗ[F] Vec I→ₗ[F] F where toFun := dotL map_add' p q := LinearMap.ext fun i => add_dotProduct p q i map_smul' a p := LinearMap.ext fun i => by change dotProduct (a • p) i=a*dotProduct p i rw [smul_dotProduct]; rfl
theorem spark_walsh [DecidableEq I] [DecidableEq J] (M : Mat I J) (p : Wgt (Vec I)) (q : Wgt (Vec J)) (hp : ∀ i, |p i|≤1) (hq : ∀ i, |q i|≤1) : |avg (pairW unif unif) (fun i => wsign (evmat M i.1 i.2)*(p i.1*q i.2))| ≤ bp (-(M.rank:ℝ)/2) := by classical let Q := dotLB I let L := Q ∘ₗ M.mulVecLin have he (i j) : evmat M i j=L j i := dotProduct_comm .. have hh : Injective Q := fun x y h => funext (fun i => by have hg := LinearMap.congr_fun h (Pi.single i 1) change dotProduct x (Pi.single i 1)=dotProduct y (Pi.single i 1) at hg simpa using hg) have ht : rk L=M.rank := by have h : LinearMap.ker L=LinearMap.ker M.mulVecLin := by ext x; change Q (M.mulVecLin x)=0 ↔ M.mulVecLin x=0 rw [← map_zero Q,hh.eq_iff] have hv := L.finrank_range_add_finrank_ker rw [h, ← M.mulVecLin.finrank_range_add_finrank_ker] at hv exact Nat.add_right_cancel hv rw [pairW_avg] have hz (x : Vec I) (y : Vec J) : wsign (evmat M x y)*(p x*q y)=p x*(q y*wsign (L y x)) := by rw [he]; ring simp_rw [hz,avg_mul'] rw [←ht] exact walsh_bound _ q p hq hp
set_option maxHeartbeats 800000 intheorem spark_uncap (p : Shape) (M : Moment p n) (s t : Label p.b) (l j : Tag p.g) (f g : Flavor p.g) (B) (hB : f.keeps l B) (hB' : g.keeps j B) (w u : Wgt (Knobs p.g n)) (hw : ∀ i,|w i| ≤ 1) (hu : ∀ i,|u i|≤1) : let Q i z := evmat M (spring p l s f i) (spring p j t g z) |avg (pairW unif unif) (fun x => wsign (Q x.1 x.2)*(w x.1*u x.2))|≤ bp (-(blockRank B s t M:ℝ)/2) := by classical intro Q let F (x : Knobs p.g n × _) := wsign (Q x.1 x.2)*(w x.1*u x.2) let K := Wgt (Vec (Fin n)) let v : Block p.g→ K := fun _ => unif have ht := update2_avg v v B F unif_law unif_law have he : prodW v=unif := draws_unif.symm let R := blockRay p n s B; let S:=blockRay p n t B let H := pullM R S M have hi (x y : Knobs p.g n) : |avg (pairW (v B) (v B)) (fun i => F (update x B i.1,update y B i.2))|≤ bp (-(blockRank B s t M:ℝ)/2) := by let X := spring p l s f (update x B 0); let Y := spring p j t g (update y B 0) let A i := evmat M (R *ᵥ i) Y; let D j := evmat M X (S *ᵥ j)+evmat M X Y let Z i := wsign (A i)*w (update x B i); let W j := wsign (D j)*u (update y B j) have hp i j' : Q (update x B i) (update y B j')= evmat H i j'+(A i+D j') := by unfold Q; rw [spring_update _ _ _ _ _ _ hB,spring_update _ _ _ _ _ _ hB'] unfold H A D X Y; rw [evmat_pull] simp only [evmat,mulVec_add,add_dotProduct,dotProduct_add,R,S]; ac_rfl have hh i j : F (update x B i,update y B j)=wsign (evmat H i j)*(Z i*W j) := by unfold F Z W; dsimp only; rw [hp,wsign_add,wsign_add]; ring have hz i : |Z i|≤1 := by unfold Z; rw [abs_mul,wsign_abs,one_mul]; exact hw _ have hy i : |W i|≤1 := by unfold W; rw [abs_mul,wsign_abs,one_mul]; exact hu _ simp_rw [hh] exact spark_walsh _ Z W hz hy simp only [he] at ht change |avg (pairW unif unif) F|≤_ rw [ht] let hq := pairW_law (α:=Knobs p.g n) (β:=Knobs p.g n) unif_law unif_law exact (abs_avg_le hq.nz).trans (hq.avg_le fun x => hi x.1 x.2)end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126import OAI.Combinatorics.HadwigerCounterexample.PrimalSpaceCompression
namespace OAI
/-! # Bilinear Compression -/
noncomputable section
namespace HadwigerCounterexample
open Matrix LinearMap Submodule Module Finset
open scoped BigOperators
variable {p : Shape} {n : ℕ} {I J : Type} [Fintype I] [Fintype J]
def dqBound (p : Shape) (T H R : ℕ) := 2*(drow p T R+H)
private theorem pullM_fix (A : Mat I I) (P : Mat I I)
(h : ∀ x ∈ colSp P,Aᵀ *ᵥ x=x) (h' : ∀ x∈colSp Pᵀ,Aᵀ *ᵥ x=x) :
pullM A A P=P := by
rw [pullM_def,mat_mul_fix h]
have he := congrArg Matrix.transpose (mat_mul_fix h')
simpa only [Matrix.transpose_mul,Matrix.transpose_transpose] using he
private def dualSpace (M : Profile p n) (z : Place p) :=
colSp (if z.2 then M z.1 else (M z.1)ᵀ)
private theorem dualSpace_dim (M : Profile p n) (z : Place p) :
dim (dualSpace M z)=(M z.1).rank := by
cases z with
| mk i b =>
cases b; exact Matrix.rank_transpose _; rfl
private def jointShrink (A : Bool → Nendo p n) (B : Place p → Bool → Mat (Chan p) (Chan p))
(z : Place p) :=
∑ i : Bool,(liftM (IP p n i) (IP p n i) (rowShrink p (A i))+
liftM (IH p n i) (IH p n i) (B z i))
private theorem joint_ip (A : Bool → Nendo p n) (B : Place p → Bool → Mat (Chan p) (Chan p))
(z : Place p) (i : Bool) :
jointShrink A B z * IP p n i = IP p n i * rowShrink p (A i) := by
classical
simp only [jointShrink,Fintype.sum_bool,liftM_def,Matrix.add_mul,Matrix.mul_assoc,
IH_IP,Matrix.mul_zero,add_zero]
cases i <;> simp only [IP_self,IP_cross (show true≠false by decide),
IP_cross (show false≠true by decide),Matrix.mul_zero,Matrix.mul_one,add_zero,zero_add]
set_option maxHeartbeats 800000 in
theorem shrink_pure {f : Plan p n} {M : Individual p n} {P : PureForms p n}
(T H R : ℕ) (ht : ∀ z i,dim (sPin f z i)≤T) (hh : ∀ z i,dim (hPin f z i)≤H)
(hr : ∀ i e,(M i e).rank≤R)
(hp : P∈pureSpace p f) (he : obsPair p P=obsI p M) :
∃ Q∈pureSpace p f,obsPair p Q=obsPair p P ∧ ∀ e,(Q e).rank≤dqBound p T H R := by
classical
choose A hA hL hT using fun i => shrink_both (fun z => sPin f z i) (dualSpace (M i)) T R
(fun z => ht z i) (fun z => by rw [dualSpace_dim]; exact hr i z.1)
choose B hB using fun z i => proj_exists (hPin f z i) ⊥ disjoint_bot_right
let D := jointShrink A B
have hf (z : Place p) (x : Dir p n) (hx : x∈f z) : D z *ᵥ x=x := by
have h1 (i : Bool) : rowShrink p (A i) *ᵥ ((IP p n i)ᵀ *ᵥ x)=(IP p n i)ᵀ *ᵥ x :=
hA i z _ ⟨_,hx,rfl⟩
have h2 (i : Bool) : B z i *ᵥ ((IH p n i)ᵀ *ᵥ x)=(IH p n i)ᵀ *ᵥ x :=
(hB z i).fixes _ ⟨_,hx,rfl⟩
unfold D jointShrink
simp only [Matrix.sum_mulVec,Matrix.add_mulVec,liftM_def,← Matrix.mulVec_mulVec,h1,h2]
exact ip_decomp x
have hR (z : Place p) : (D z).rank ≤ dqBound p T H R := by
apply le_trans (mrk_sum_le ..)
have hx i :
(liftM (IP p n i) (IP p n i) (rowShrink p (A i))+
liftM (IH p n i) (IH p n i) (B z i)).rank ≤ drow p T R+H :=
(mrk_add_le ..).trans (add_le_add
((rank_lift_le ..).trans (hT i)) ((rank_lift_le ..).trans
((rank_maps (hPin f z i) (hB z i).onto).trans (hh z i))))
rw [Fintype.sum_bool,dqBound,two_mul]; exact add_le_add (hx _) (hx _)
let Q (e : Comp p.g) := pullM (D (e,true)) (D (e,false)) (P e)
have hG (i : Bool) (e : Comp p.g) : pullM (rowShrink p (A i)) (rowShrink p (A i)) (M i e)=
M i e := pullM_fix _ _ (hL i (e,true)) (hL i (e,false))
have hY (i : Bool) (e : Comp p.g) : eachF p Q i e=
pullM (rowShrink p (A i)) (rowShrink p (A i)) (eachF p P i e) := by
change pullM _ _ (Q e)=pullM _ _ (pullM _ _ _)
let G := IP p n i
have hw {I J K U V W : Type} [Fintype U] [Fintype V] [Fintype W] [Fintype I]
[Fintype J] [Fintype K] (L : Mat U I) (R : Mat V J)
(L' : Mat I K) (R' : Mat J W) (P : Mat U V) :
pullM L' R' (pullM L R P) = pullM (L*L') (R*R') P := by
unfold pullM
rw [liftM_comp,Matrix.transpose_mul,Matrix.transpose_mul]
unfold Q
rw [hw,hw]
have h (b) := joint_ip A B (e,b) i
rw [show D (e,true)*IP p n i=_ from h true, show D (e,false)*IP p n i=_ from h false]
refine ⟨Q,?_,?_,fun e => ?_⟩
· refine (pureSpace_mem _).mpr fun e => ?_
obtain ⟨h1,h2⟩ := box_kill.mp ((pureSpace_mem _).mp hp e)
unfold Q; rw [box_kill,pullM_def]; constructor
· intro x hx
simp only [transpose_mul,transpose_transpose,←Matrix.mulVec_mulVec,hf (e,true) x hx,h1 x hx,
mulVec_zero]
intro x hx
rw [← mulVec_mulVec,hf (e,false) x hx]
rw [← mulVec_mulVec,h2 x hx,mulVec_zero]
· rw [he,obsPair_each]
rw [obsPair_each] at he
change combineF p _=combineF p _
change combineF p _=combineF p _ at he
have he := (combineF_same ..).mp he
apply (combineF_same ..).mpr
intro i x hx
let y : Profile p n := fun e => liftM (rowShrink p (A i)) (rowShrink p (A i)) (x e)
rw [repF_rep,repF_rep]
have hv := he i y (shrink_X (A i) x hx)
rw [repF_rep,repF_rep] at hv
have hu (F : Individual p n) : (∑ e,mpair (F i e) (y e))=
∑ e,mpair (pullM (rowShrink p (A i)) (rowShrink p (A i)) (F i e)) (x e) :=
Finset.sum_congr rfl fun e _ => mpair_liftM ..
rw [hu,hu] at hv
simp_rw [← hY,hG] at hv
exact hv
unfold Q; rw [pullM_def]
exact ((Matrix.rank_mul_le_left ..).trans (Matrix.rank_mul_le_left ..)).trans
(by rw [Matrix.rank_transpose]; exact hR _)
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PrimalSpaceCompression
namespace OAI
/-! # Bilinear Compression -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix LinearMap Submodule Module Finsetopen scoped BigOperators
variable {p : Shape} {n : ℕ} {I J : Type} [Fintype I] [Fintype J]
def dqBound (p : Shape) (T H R : ℕ) := 2*(drow p T R+H)
private theorem pullM_fix (A : Mat I I) (P : Mat I I) (h : ∀ x ∈ colSp P,Aᵀ *ᵥ x=x) (h' : ∀ x∈colSp Pᵀ,Aᵀ *ᵥ x=x) : pullM A A P=P := by rw [pullM_def,mat_mul_fix h] have he := congrArg Matrix.transpose (mat_mul_fix h') simpa only [Matrix.transpose_mul,Matrix.transpose_transpose] using he
private def dualSpace (M : Profile p n) (z : Place p) := colSp (if z.2 then M z.1 else (M z.1)ᵀ)private theorem dualSpace_dim (M : Profile p n) (z : Place p) : dim (dualSpace M z)=(M z.1).rank := by cases z with | mk i b => cases b; exact Matrix.rank_transpose _; rfl
private def jointShrink (A : Bool → Nendo p n) (B : Place p → Bool → Mat (Chan p) (Chan p)) (z : Place p) := ∑ i : Bool,(liftM (IP p n i) (IP p n i) (rowShrink p (A i))+ liftM (IH p n i) (IH p n i) (B z i))
private theorem joint_ip (A : Bool → Nendo p n) (B : Place p → Bool → Mat (Chan p) (Chan p)) (z : Place p) (i : Bool) : jointShrink A B z * IP p n i = IP p n i * rowShrink p (A i) := by classical simp only [jointShrink,Fintype.sum_bool,liftM_def,Matrix.add_mul,Matrix.mul_assoc, IH_IP,Matrix.mul_zero,add_zero] cases i <;> simp only [IP_self,IP_cross (show true≠false by decide), IP_cross (show false≠true by decide),Matrix.mul_zero,Matrix.mul_one,add_zero,zero_add]
set_option maxHeartbeats 800000 intheorem shrink_pure {f : Plan p n} {M : Individual p n} {P : PureForms p n} (T H R : ℕ) (ht : ∀ z i,dim (sPin f z i)≤T) (hh : ∀ z i,dim (hPin f z i)≤H) (hr : ∀ i e,(M i e).rank≤R) (hp : P∈pureSpace p f) (he : obsPair p P=obsI p M) : ∃ Q∈pureSpace p f,obsPair p Q=obsPair p P ∧ ∀ e,(Q e).rank≤dqBound p T H R := by classical choose A hA hL hT using fun i => shrink_both (fun z => sPin f z i) (dualSpace (M i)) T R (fun z => ht z i) (fun z => by rw [dualSpace_dim]; exact hr i z.1) choose B hB using fun z i => proj_exists (hPin f z i) ⊥ disjoint_bot_right let D := jointShrink A B have hf (z : Place p) (x : Dir p n) (hx : x∈f z) : D z *ᵥ x=x := by have h1 (i : Bool) : rowShrink p (A i) *ᵥ ((IP p n i)ᵀ *ᵥ x)=(IP p n i)ᵀ *ᵥ x := hA i z _ ⟨_,hx,rfl⟩ have h2 (i : Bool) : B z i *ᵥ ((IH p n i)ᵀ *ᵥ x)=(IH p n i)ᵀ *ᵥ x := (hB z i).fixes _ ⟨_,hx,rfl⟩ unfold D jointShrink simp only [Matrix.sum_mulVec,Matrix.add_mulVec,liftM_def,← Matrix.mulVec_mulVec,h1,h2] exact ip_decomp x have hR (z : Place p) : (D z).rank ≤ dqBound p T H R := by apply le_trans (mrk_sum_le ..) have hx i : (liftM (IP p n i) (IP p n i) (rowShrink p (A i))+ liftM (IH p n i) (IH p n i) (B z i)).rank ≤ drow p T R+H := (mrk_add_le ..).trans (add_le_add ((rank_lift_le ..).trans (hT i)) ((rank_lift_le ..).trans ((rank_maps (hPin f z i) (hB z i).onto).trans (hh z i)))) rw [Fintype.sum_bool,dqBound,two_mul]; exact add_le_add (hx _) (hx _) let Q (e : Comp p.g) := pullM (D (e,true)) (D (e,false)) (P e) have hG (i : Bool) (e : Comp p.g) : pullM (rowShrink p (A i)) (rowShrink p (A i)) (M i e)= M i e := pullM_fix _ _ (hL i (e,true)) (hL i (e,false)) have hY (i : Bool) (e : Comp p.g) : eachF p Q i e= pullM (rowShrink p (A i)) (rowShrink p (A i)) (eachF p P i e) := by change pullM _ _ (Q e)=pullM _ _ (pullM _ _ _) let G := IP p n i have hw {I J K U V W : Type} [Fintype U] [Fintype V] [Fintype W] [Fintype I] [Fintype J] [Fintype K] (L : Mat U I) (R : Mat V J) (L' : Mat I K) (R' : Mat J W) (P : Mat U V) : pullM L' R' (pullM L R P) = pullM (L*L') (R*R') P := by unfold pullM rw [liftM_comp,Matrix.transpose_mul,Matrix.transpose_mul] unfold Q rw [hw,hw] have h (b) := joint_ip A B (e,b) i rw [show D (e,true)*IP p n i=_ from h true, show D (e,false)*IP p n i=_ from h false]
refine ⟨Q,?_,?_,fun e => ?_⟩ · refine (pureSpace_mem _).mpr fun e => ?_ obtain ⟨h1,h2⟩ := box_kill.mp ((pureSpace_mem _).mp hp e) unfold Q; rw [box_kill,pullM_def]; constructor · intro x hx simp only [transpose_mul,transpose_transpose,←Matrix.mulVec_mulVec,hf (e,true) x hx,h1 x hx, mulVec_zero] intro x hx rw [← mulVec_mulVec,hf (e,false) x hx] rw [← mulVec_mulVec,h2 x hx,mulVec_zero] · rw [he,obsPair_each] rw [obsPair_each] at he change combineF p _=combineF p _ change combineF p _=combineF p _ at he have he := (combineF_same ..).mp he apply (combineF_same ..).mpr intro i x hx let y : Profile p n := fun e => liftM (rowShrink p (A i)) (rowShrink p (A i)) (x e) rw [repF_rep,repF_rep] have hv := he i y (shrink_X (A i) x hx) rw [repF_rep,repF_rep] at hv have hu (F : Individual p n) : (∑ e,mpair (F i e) (y e))= ∑ e,mpair (pullM (rowShrink p (A i)) (rowShrink p (A i)) (F i e)) (x e) := Finset.sum_congr rfl fun e _ => mpair_liftM .. rw [hu,hu] at hv simp_rw [← hY,hG] at hv exact hv unfold Q; rw [pullM_def] exact ((Matrix.rank_mul_le_left ..).trans (Matrix.rank_mul_le_left ..)).trans (by rw [Matrix.rank_transpose]; exact hR _)
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174import OAI.Combinatorics.HadwigerCounterexample.MixerConditions
namespace OAI
/-! # Binary Evaluation Forms -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix
variable {p : Shape} {n : ℕ}
theorem pullT {I J V U : Type} [Fintype V] [Fintype U]
(A : Mat V U) (P : Mat U I) (Q : Mat V J) :
pullM P Q Aᵀ = (pullM Q P A)ᵀ := by
rw [pullM_def,pullM_def,transpose_mul,transpose_mul,transpose_transpose,Matrix.mul_assoc]
theorem indexed_linear {c : Vec (MBits p)} {D D' : Draw p n} :
indexedSum (drawn (p:=p) (D+D')) c =
indexedSum (drawn D) c + indexedSum (drawn D') c := by
have h (i : MBits p) :
eitherM i.2 (orderedM (drawn (p:=p) (D+D')) i.1) =
eitherM i.2 (orderedM (drawn D) i.1) + eitherM i.2 (orderedM (drawn D') i.1) := by
rcases i with ⟨⟨⟨a,b,d⟩,_|_⟩,_|_⟩ <;> rfl
unfold indexedSum
simp_rw [h,smul_add,Finset.sum_add_distrib]
def obsZ (p : Shape) (n : ℕ) (s t : Label p.b) (c : Vec (MBits p)) :
Draw p n →ₗ[F] Mat (Fin n) (Fin n) where
toFun D := pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z) (indexedSum (drawn D) c)
map_add' _ _ := by rw [indexed_linear,map_add]
map_smul' a x := by
have h (i : MBits p) :
eitherM i.2 (orderedM (drawn (p:=p) (a•x)) i.1)=
a • eitherM i.2 (orderedM (drawn x) i.1) := by
rcases i with ⟨⟨⟨a,b,d⟩,_|_⟩,_|_⟩ <;> rfl
simp only [indexedSum,h,map_sum,map_smul,RingHom.id_apply,Finset.smul_sum]
exact Finset.sum_congr rfl fun i _ => smul_comm _ _ _
theorem obsZ_self (s t : Label p.b) (f : Vec Bool) (m : Mixer p n) :
pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z) (selfSum m f) = 0 := by
rw [selfSum,Fintype.sum_bool,map_add,map_smul,map_smul]
change _ • pullM _ _ (selfM p n m.mixM) + _ • pullM _ _ (selfM p n m.mixM)ᵀ = 0
rw [pullT,pull_self_Z,pull_self_Z]
simp
private theorem two_eval (s t : Label p.b) (hj : 1≤p.j) (hs : s≠t)
(x : Bool → Mat (Fin n) (Fin n)) :
∃ A : Moment p n, ∀ b, pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z)
(eitherM b A) = x b := by
let P := blockRay p n s Block.Z
let Q := blockRay p n t Block.Z
have hh : Function.Injective (fromCols P Q).mulVec := joined_block_inj hj hs _
obtain ⟨L,hL⟩ := prescribe_between hh hh
(fromBlocks (0:Mat (Fin n) (Fin n)) (x true) (x false)ᵀ (0:Mat (Fin n) (Fin n)))
rw [transpose_fromCols,fromRows_mul,fromRows_mul_fromCols] at hL
have hx : pullM P Q L = x true := congrArg Matrix.toBlocks₁₂ hL
have hy : pullM Q P L = (x false)ᵀ := congrArg Matrix.toBlocks₂₁ hL
refine ⟨L,fun b => ?_⟩
cases b
· change pullM P Q Lᵀ=x false
rw [pullT,hy,transpose_transpose]
· exact hx
theorem obsZ_surj (s t : Label p.b) (hj : 1≤p.j) (hs : s≠t)
{c : Vec (MBits p)} (hc : c ≠ 0) : Function.Surjective (obsZ p n s t c) := by
classical
simp only [ne_eq,funext_iff,Pi.zero_apply,not_forall] at hc
obtain ⟨i,hi⟩ := hc
intro M
let y (j : MBits p) := if j=i then M else 0
choose A hA using fun j : MOne p => two_eval s t hj hs (fun b => y (j,b))
let D : Draw p n := (fun j => A (j,true), fun j => A (j,false), 0)
have he (j : MBits p) :
pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z)
(eitherM j.2 (orderedM (drawn D) j.1)) = y j := by
rcases j with ⟨⟨j,_|_⟩,x⟩
· exact hA _ _
· exact hA _ _
refine ⟨D,?_⟩
simp only [obsZ,indexedSum,map_sum,map_smul,he,LinearMap.coe_mk,AddHom.coe_mk]
rw [Finset.sum_eq_single i]
· simp [y,(bit_cases (c i)).resolve_left hi]
· intro j _ hj; simp [y,hj]
simp
def selfPartial (s t : Label p.b) (f : Vec Bool) (D : Draw p n) : Mat (Fin n) (Fin n) :=
let A := ∑ a, (s a+t a) • D.2.2 a
f true • A+f false • Aᵀ
theorem pull_selfPart (s t : Label p.b) (hj : 1 ≤ p.j) (f : Vec Bool) (D : Draw p n) :
pullM (blockRay p n s Block.sharp) (blockRay p n t Block.sharp) (selfSum (drawn D) f) =
selfPartial (p:=p) s t f D := by
rw [selfSum, Fintype.sum_bool,map_add,map_smul,map_smul]
change _ • pullM _ _ (selfM p n D.2.2) + _ • pullM _ _ (selfM p n D.2.2)ᵀ = _
rw [pullT,pull_self_sharp _ _ _ hj,pull_self_sharp _ _ _ hj]
unfold selfPartial
congr 2
simp only [add_comm]
def obsHalf (p : Shape) (s t : Label p.b) (f : Vec Bool) (n : ℕ)
(l r : Fin (n/2)→Fin n) : Draw p n →ₗ[F] Mat (Fin (n/2)) (Fin (n/2)) where
toFun D := (selfPartial (p:=p) s t f D).submatrix l r
map_add' _ _ := by
simp only [selfPartial, Prod.snd_add, Pi.add_apply, smul_add, Finset.sum_add_distrib,
transpose_add, Matrix.submatrix_add]
abel
map_smul' a D := by
simp only [selfPartial,Prod.smul_snd,Pi.smul_apply,RingHom.id_apply]
let F (D : Draw p n) := ∑ i, (s i+t i) • D.2.2 i
have h :
∑ i, (s i+t i) • (a • D.2.2 i) = a • F D := by
unfold F; rw [Finset.smul_sum]; exact Finset.sum_congr rfl fun _ _ => smul_comm _ _ _
rw [h,Matrix.transpose_smul]
rw [smul_comm (f true),smul_comm (f false) a, ← smul_add]
rfl
/-- Uniform off-diagonal block even in transpose-character case. -/
theorem obsHalf_surj (s t : Label p.b) (hs : s≠t) {f : Vec Bool} (hf : f≠0) (n : ℕ)
{l r : Fin (n/2)→Fin n} (hl : Function.Injective l) (hr : Function.Injective r)
(h : ∀ i j,l i≠r j) : Function.Surjective (obsHalf p s t f n l r) := by
classical
intro M
obtain ⟨a,ha⟩ : ∃ a,s a+t a=1 := by
obtain ⟨a,ha⟩ := Function.ne_iff.mp hs
exact ⟨a,(bit_cases _).resolve_left (fun h => ha
(add_right_cancel (h.trans (char_two _).symm)))⟩
let m := n/2
let P := embedMat l
let Q := embedMat r
have hi : Function.Injective (fromCols P Q).mulVec := by
have he : fromCols P Q = embedMat (Sum.elim l r) := by ext i j; cases j <;> rfl
rw [he]; apply embedMat_inj
rintro (x|x) (y|y) g
· rw [hl g]
· exact (h _ _ g).elim
· exact (h _ _ g.symm).elim
· rw [hr g]
have hv (x y : Mat (Fin m) (Fin m)) :
∃ A : Mat (Fin n) (Fin n), A.submatrix l r=x ∧ Aᵀ.submatrix l r=y := by
obtain ⟨A,hA⟩ := prescribe_between hi hi (fromBlocks (0:Mat (Fin m) (Fin m)) x yᵀ
(0:Mat (Fin m) (Fin m)))
rw [transpose_fromCols,fromRows_mul,fromRows_mul_fromCols] at hA
have h1 : Pᵀ*A*Q=x := congrArg Matrix.toBlocks₁₂ hA
have h2 : Qᵀ*A*P=yᵀ := congrArg Matrix.toBlocks₂₁ hA
unfold P Q at *
rw [embedMat_mul,mul_embedMat] at h1 h2
exact ⟨A,h1,congrArg Matrix.transpose h2⟩
obtain ⟨x,y,hx⟩ : ∃ x y : Mat (Fin m) (Fin m), f true • x+f false • y=M := by
rcases bit_cases (f true) with g|g
· have hg : f false≠0 := fun hg => hf (funext fun i => by cases i <;> assumption)
exact ⟨0,M,by rw [(bit_cases _).resolve_left hg]; simp⟩
· exact ⟨M,0,by rw [g]; simp⟩
obtain ⟨A,h1,h2⟩ := hv x y
let D : Draw p n := (0,0,Pi.single a A)
have hE :
∑ i,(s i+t i) • D.2.2 i=A := by
rw [Finset.sum_eq_single a]
· simp [D,ha]
· intro i _ hi; simp [D,Pi.single_eq_of_ne hi]
simp
refine ⟨D,?_⟩
change (selfPartial (p:=p) s t f D).submatrix l r=M
unfold selfPartial
rw [hE]
change (f true • A + f false • Aᵀ).submatrix l r = _
change f true • A.submatrix l r + f false • Aᵀ.submatrix l r = M
rw [h1,h2,hx]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.MixerConditions
namespace OAI
/-! # Binary Evaluation Forms -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperatorsopen Matrixvariable {p : Shape} {n : ℕ}
theorem pullT {I J V U : Type} [Fintype V] [Fintype U] (A : Mat V U) (P : Mat U I) (Q : Mat V J) : pullM P Q Aᵀ = (pullM Q P A)ᵀ := by rw [pullM_def,pullM_def,transpose_mul,transpose_mul,transpose_transpose,Matrix.mul_assoc]
theorem indexed_linear {c : Vec (MBits p)} {D D' : Draw p n} : indexedSum (drawn (p:=p) (D+D')) c = indexedSum (drawn D) c + indexedSum (drawn D') c := by have h (i : MBits p) : eitherM i.2 (orderedM (drawn (p:=p) (D+D')) i.1) = eitherM i.2 (orderedM (drawn D) i.1) + eitherM i.2 (orderedM (drawn D') i.1) := by rcases i with ⟨⟨⟨a,b,d⟩,_|_⟩,_|_⟩ <;> rfl unfold indexedSum simp_rw [h,smul_add,Finset.sum_add_distrib]
def obsZ (p : Shape) (n : ℕ) (s t : Label p.b) (c : Vec (MBits p)) : Draw p n →ₗ[F] Mat (Fin n) (Fin n) where toFun D := pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z) (indexedSum (drawn D) c) map_add' _ _ := by rw [indexed_linear,map_add] map_smul' a x := by have h (i : MBits p) : eitherM i.2 (orderedM (drawn (p:=p) (a•x)) i.1)= a • eitherM i.2 (orderedM (drawn x) i.1) := by rcases i with ⟨⟨⟨a,b,d⟩,_|_⟩,_|_⟩ <;> rfl simp only [indexedSum,h,map_sum,map_smul,RingHom.id_apply,Finset.smul_sum] exact Finset.sum_congr rfl fun i _ => smul_comm _ _ _
theorem obsZ_self (s t : Label p.b) (f : Vec Bool) (m : Mixer p n) : pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z) (selfSum m f) = 0 := by rw [selfSum,Fintype.sum_bool,map_add,map_smul,map_smul] change _ • pullM _ _ (selfM p n m.mixM) + _ • pullM _ _ (selfM p n m.mixM)ᵀ = 0 rw [pullT,pull_self_Z,pull_self_Z] simp
private theorem two_eval (s t : Label p.b) (hj : 1≤p.j) (hs : s≠t) (x : Bool → Mat (Fin n) (Fin n)) : ∃ A : Moment p n, ∀ b, pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z) (eitherM b A) = x b := by let P := blockRay p n s Block.Z let Q := blockRay p n t Block.Z have hh : Function.Injective (fromCols P Q).mulVec := joined_block_inj hj hs _ obtain ⟨L,hL⟩ := prescribe_between hh hh (fromBlocks (0:Mat (Fin n) (Fin n)) (x true) (x false)ᵀ (0:Mat (Fin n) (Fin n))) rw [transpose_fromCols,fromRows_mul,fromRows_mul_fromCols] at hL have hx : pullM P Q L = x true := congrArg Matrix.toBlocks₁₂ hL have hy : pullM Q P L = (x false)ᵀ := congrArg Matrix.toBlocks₂₁ hL refine ⟨L,fun b => ?_⟩ cases b · change pullM P Q Lᵀ=x false rw [pullT,hy,transpose_transpose] · exact hx
theorem obsZ_surj (s t : Label p.b) (hj : 1≤p.j) (hs : s≠t) {c : Vec (MBits p)} (hc : c ≠ 0) : Function.Surjective (obsZ p n s t c) := by classical simp only [ne_eq,funext_iff,Pi.zero_apply,not_forall] at hc obtain ⟨i,hi⟩ := hc intro M let y (j : MBits p) := if j=i then M else 0 choose A hA using fun j : MOne p => two_eval s t hj hs (fun b => y (j,b)) let D : Draw p n := (fun j => A (j,true), fun j => A (j,false), 0) have he (j : MBits p) : pullM (blockRay p n s Block.Z) (blockRay p n t Block.Z) (eitherM j.2 (orderedM (drawn D) j.1)) = y j := by rcases j with ⟨⟨j,_|_⟩,x⟩ · exact hA _ _ · exact hA _ _ refine ⟨D,?_⟩ simp only [obsZ,indexedSum,map_sum,map_smul,he,LinearMap.coe_mk,AddHom.coe_mk] rw [Finset.sum_eq_single i] · simp [y,(bit_cases (c i)).resolve_left hi] · intro j _ hj; simp [y,hj] simp
def selfPartial (s t : Label p.b) (f : Vec Bool) (D : Draw p n) : Mat (Fin n) (Fin n) := let A := ∑ a, (s a+t a) • D.2.2 a f true • A+f false • Aᵀ
theorem pull_selfPart (s t : Label p.b) (hj : 1 ≤ p.j) (f : Vec Bool) (D : Draw p n) : pullM (blockRay p n s Block.sharp) (blockRay p n t Block.sharp) (selfSum (drawn D) f) = selfPartial (p:=p) s t f D := by rw [selfSum, Fintype.sum_bool,map_add,map_smul,map_smul] change _ • pullM _ _ (selfM p n D.2.2) + _ • pullM _ _ (selfM p n D.2.2)ᵀ = _ rw [pullT,pull_self_sharp _ _ _ hj,pull_self_sharp _ _ _ hj] unfold selfPartial congr 2 simp only [add_comm]
def obsHalf (p : Shape) (s t : Label p.b) (f : Vec Bool) (n : ℕ) (l r : Fin (n/2)→Fin n) : Draw p n →ₗ[F] Mat (Fin (n/2)) (Fin (n/2)) where toFun D := (selfPartial (p:=p) s t f D).submatrix l r map_add' _ _ := by simp only [selfPartial, Prod.snd_add, Pi.add_apply, smul_add, Finset.sum_add_distrib, transpose_add, Matrix.submatrix_add] abel map_smul' a D := by simp only [selfPartial,Prod.smul_snd,Pi.smul_apply,RingHom.id_apply] let F (D : Draw p n) := ∑ i, (s i+t i) • D.2.2 i have h : ∑ i, (s i+t i) • (a • D.2.2 i) = a • F D := by unfold F; rw [Finset.smul_sum]; exact Finset.sum_congr rfl fun _ _ => smul_comm _ _ _ rw [h,Matrix.transpose_smul] rw [smul_comm (f true),smul_comm (f false) a, ← smul_add] rfl
/-- Uniform off-diagonal block even in transpose-character case. -/theorem obsHalf_surj (s t : Label p.b) (hs : s≠t) {f : Vec Bool} (hf : f≠0) (n : ℕ) {l r : Fin (n/2)→Fin n} (hl : Function.Injective l) (hr : Function.Injective r) (h : ∀ i j,l i≠r j) : Function.Surjective (obsHalf p s t f n l r) := by classical intro M obtain ⟨a,ha⟩ : ∃ a,s a+t a=1 := by obtain ⟨a,ha⟩ := Function.ne_iff.mp hs exact ⟨a,(bit_cases _).resolve_left (fun h => ha (add_right_cancel (h.trans (char_two _).symm)))⟩ let m := n/2 let P := embedMat l let Q := embedMat r have hi : Function.Injective (fromCols P Q).mulVec := by have he : fromCols P Q = embedMat (Sum.elim l r) := by ext i j; cases j <;> rfl rw [he]; apply embedMat_inj rintro (x|x) (y|y) g · rw [hl g] · exact (h _ _ g).elim · exact (h _ _ g.symm).elim · rw [hr g] have hv (x y : Mat (Fin m) (Fin m)) : ∃ A : Mat (Fin n) (Fin n), A.submatrix l r=x ∧ Aᵀ.submatrix l r=y := by obtain ⟨A,hA⟩ := prescribe_between hi hi (fromBlocks (0:Mat (Fin m) (Fin m)) x yᵀ (0:Mat (Fin m) (Fin m))) rw [transpose_fromCols,fromRows_mul,fromRows_mul_fromCols] at hA have h1 : Pᵀ*A*Q=x := congrArg Matrix.toBlocks₁₂ hA have h2 : Qᵀ*A*P=yᵀ := congrArg Matrix.toBlocks₂₁ hA unfold P Q at * rw [embedMat_mul,mul_embedMat] at h1 h2 exact ⟨A,h1,congrArg Matrix.transpose h2⟩ obtain ⟨x,y,hx⟩ : ∃ x y : Mat (Fin m) (Fin m), f true • x+f false • y=M := by rcases bit_cases (f true) with g|g · have hg : f false≠0 := fun hg => hf (funext fun i => by cases i <;> assumption) exact ⟨0,M,by rw [(bit_cases _).resolve_left hg]; simp⟩ · exact ⟨M,0,by rw [g]; simp⟩ obtain ⟨A,h1,h2⟩ := hv x y let D : Draw p n := (0,0,Pi.single a A) have hE : ∑ i,(s i+t i) • D.2.2 i=A := by rw [Finset.sum_eq_single a] · simp [D,ha] · intro i _ hi; simp [D,Pi.single_eq_of_ne hi] simp refine ⟨D,?_⟩ change (selfPartial (p:=p) s t f D).submatrix l r=M unfold selfPartial rw [hE] change (f true • A + f false • Aᵀ).submatrix l r = _ change f true • A.submatrix l r + f false • Aᵀ.submatrix l r = M rw [h1,h2,hx]
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125import Mathlib.Algebra.Field.ZMod
import Mathlib.LinearAlgebra.Matrix.Rank
import Mathlib.LinearAlgebra.Matrix.Trace
import Mathlib.FieldTheory.Finiteness
import Mathlib.Tactic.Ring
namespace OAI
/-! # Binary Matrices -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix
abbrev F := ZMod 2
abbrev Vec (I : Type) := I → F
abbrev Mat (I J : Type) := Matrix I J F
abbrev Space (V : Type) [AddCommGroup V] [Module F V] := Submodule F V
theorem bit_cases (x : F) : x = 0 ∨ x = 1 :=
(by decide : ∀ x : ZMod 2, x = 0 ∨ x = 1) x
theorem bit_sq (x : F) : x*x = x := by rcases bit_cases x with e|e <;> rw [e] <;> simp
theorem char_two {V : Type*} [AddCommGroup V] [Module F V] (x : V) : x+x=0 :=
ZModModule.add_self x
theorem odd_smul_bit {n : ℕ} (hn : Odd n) (x : F) : n • x = x := by
obtain ⟨m,rfl⟩ := hn
rw [add_smul, one_smul, mul_smul, two_smul,char_two,zero_add]
section Linear
variable {I J K L R S : Type} [Fintype I] [Fintype J]
def evmat (M : Mat I J) (x : Vec I) (y : Vec J) := dotProduct x (M *ᵥ y)
def mpair (M : Mat I J) : Mat I J →ₗ[F] F where
toFun A := ∑ i, ∑ j, M i j * A i j
map_add' A B := by simp only [Matrix.add_apply,mul_add,Finset.sum_add_distrib]
map_smul' b A := by
simp only [Matrix.smul_apply, smul_eq_mul,RingHom.id_apply,Finset.mul_sum,mul_left_comm b]
theorem mpair_comm (M A : Mat I J) : mpair M A = mpair A M := by
dsimp [mpair]
simp only [mul_comm]
theorem mpair_outer (M : Mat I J) (x : Vec I) (y : Vec J) :
mpair M (vecMulVec x y) = evmat M x y := by
dsimp [mpair,evmat,mulVec,dotProduct,vecMulVec]
simp only [Finset.mul_sum,mul_left_comm]
/-- Apply frame maps to the two factors of every tensor. -/
def liftM (P : Mat K I) (Q : Mat L J) : Mat I J →ₗ[F] Mat K L where
toFun A := P*A*Qᵀ
map_add' A B := by rw [Matrix.mul_add,Matrix.add_mul]
map_smul' b A := by simp only [Matrix.mul_smul, Matrix.smul_mul,RingHom.id_apply]
theorem liftM_def (P : Mat K I) (Q : Mat L J) (A : Mat I J) :
liftM P Q A = P*A*Qᵀ := rfl
theorem liftM_outer (P : Mat K I) (Q : Mat L J) (x : Vec I) (y : Vec J) :
liftM P Q (vecMulVec x y) = vecMulVec (P *ᵥ x) (Q *ᵥ y) := by
rw [liftM_def,mul_vecMulVec,vecMulVec_mul,vecMul_transpose]
variable [Fintype K] [Fintype L]
theorem liftM_comp (P : Mat K I) (Q : Mat L J) (P' : Mat R K) (Q' : Mat S L)
(A : Mat I J) :
liftM P' Q' (liftM P Q A) = liftM (P'*P) (Q'*Q) A := by
simp only [liftM_def, Matrix.transpose_mul,Matrix.mul_assoc]
theorem mpair_liftM (P : Mat K I) (Q : Mat L J) (M : Mat K L) (A : Mat I J) :
mpair M (liftM P Q A) = mpair (liftM Pᵀ Qᵀ M) A := by
simp only [liftM_def, mpair, transpose_transpose, LinearMap.coe_mk,AddHom.coe_mk,
Matrix.mul_apply, Finset.sum_mul, Finset.mul_sum, transpose_apply]
conv_lhs =>
arg 2
intro k
rw [Finset.sum_comm]
rw [Finset.sum_comm]
conv_rhs => rw [Finset.sum_comm]
refine Finset.sum_congr rfl fun j _ => ?_
conv_lhs =>
arg 2
intro k
rw [Finset.sum_comm]
rw [Finset.sum_comm]
refine Finset.sum_congr rfl fun i _ => ?_
rw [Finset.sum_comm]
refine Finset.sum_congr rfl fun l _ => Finset.sum_congr rfl fun k _ => ?_
ring
theorem mat_left_inv [DecidableEq I] {P : Mat K I} (hp : Function.Injective P.mulVec) :
∃ Q : Mat I K, Q*P = 1 := by
classical
have hp' : Function.Injective (P.mulVecLin) := hp
obtain ⟨f,hf⟩ := P.mulVecLin.exists_leftInverse_of_injective (LinearMap.ker_eq_bot.mpr hp')
refine ⟨LinearMap.toMatrix' f, ?_⟩
apply Matrix.toLin'.injective
rw [Matrix.toLin'_mul]
simp only [Matrix.toLin'_one]
change ((LinearMap.toMatrix').symm _) ∘ₗ _ = _
rw [LinearEquiv.symm_apply_apply]
exact hf
theorem liftM_inj {P : Mat K I} {Q : Mat L J} (hp : Function.Injective P.mulVec)
(hq : Function.Injective Q.mulVec) : Function.Injective (liftM P Q) := by
classical
obtain ⟨P', hP⟩ := mat_left_inv hp
obtain ⟨Q', hQ⟩ := mat_left_inv hq
intro A B hab
have hh := congrArg (liftM P' Q') hab
rw [liftM_comp,liftM_comp,hP,hQ] at hh
simpa only [liftM_def, Matrix.one_mul, Matrix.transpose_one,
Matrix.mul_one] using hh
end Linear
end HadwigerCounterexample
end
end OAIimport Mathlib.Algebra.Field.ZModimport Mathlib.LinearAlgebra.Matrix.Rankimport Mathlib.LinearAlgebra.Matrix.Traceimport Mathlib.FieldTheory.Finitenessimport Mathlib.Tactic.Ring
namespace OAI
/-! # Binary Matrices -/
noncomputable sectionnamespace HadwigerCounterexample
open scoped BigOperatorsopen Matrix
abbrev F := ZMod 2abbrev Vec (I : Type) := I → Fabbrev Mat (I J : Type) := Matrix I J Fabbrev Space (V : Type) [AddCommGroup V] [Module F V] := Submodule F V
theorem bit_cases (x : F) : x = 0 ∨ x = 1 := (by decide : ∀ x : ZMod 2, x = 0 ∨ x = 1) xtheorem bit_sq (x : F) : x*x = x := by rcases bit_cases x with e|e <;> rw [e] <;> simptheorem char_two {V : Type*} [AddCommGroup V] [Module F V] (x : V) : x+x=0 := ZModModule.add_self xtheorem odd_smul_bit {n : ℕ} (hn : Odd n) (x : F) : n • x = x := by obtain ⟨m,rfl⟩ := hn rw [add_smul, one_smul, mul_smul, two_smul,char_two,zero_add]
section Linear
variable {I J K L R S : Type} [Fintype I] [Fintype J]
def evmat (M : Mat I J) (x : Vec I) (y : Vec J) := dotProduct x (M *ᵥ y)
def mpair (M : Mat I J) : Mat I J →ₗ[F] F where toFun A := ∑ i, ∑ j, M i j * A i j map_add' A B := by simp only [Matrix.add_apply,mul_add,Finset.sum_add_distrib] map_smul' b A := by simp only [Matrix.smul_apply, smul_eq_mul,RingHom.id_apply,Finset.mul_sum,mul_left_comm b]
theorem mpair_comm (M A : Mat I J) : mpair M A = mpair A M := by dsimp [mpair] simp only [mul_comm]
theorem mpair_outer (M : Mat I J) (x : Vec I) (y : Vec J) : mpair M (vecMulVec x y) = evmat M x y := by dsimp [mpair,evmat,mulVec,dotProduct,vecMulVec] simp only [Finset.mul_sum,mul_left_comm]
/-- Apply frame maps to the two factors of every tensor. -/def liftM (P : Mat K I) (Q : Mat L J) : Mat I J →ₗ[F] Mat K L where toFun A := P*A*Qᵀ map_add' A B := by rw [Matrix.mul_add,Matrix.add_mul] map_smul' b A := by simp only [Matrix.mul_smul, Matrix.smul_mul,RingHom.id_apply]
theorem liftM_def (P : Mat K I) (Q : Mat L J) (A : Mat I J) : liftM P Q A = P*A*Qᵀ := rfl
theorem liftM_outer (P : Mat K I) (Q : Mat L J) (x : Vec I) (y : Vec J) : liftM P Q (vecMulVec x y) = vecMulVec (P *ᵥ x) (Q *ᵥ y) := by rw [liftM_def,mul_vecMulVec,vecMulVec_mul,vecMul_transpose]
variable [Fintype K] [Fintype L]
theorem liftM_comp (P : Mat K I) (Q : Mat L J) (P' : Mat R K) (Q' : Mat S L) (A : Mat I J) : liftM P' Q' (liftM P Q A) = liftM (P'*P) (Q'*Q) A := by simp only [liftM_def, Matrix.transpose_mul,Matrix.mul_assoc]
theorem mpair_liftM (P : Mat K I) (Q : Mat L J) (M : Mat K L) (A : Mat I J) : mpair M (liftM P Q A) = mpair (liftM Pᵀ Qᵀ M) A := by
simp only [liftM_def, mpair, transpose_transpose, LinearMap.coe_mk,AddHom.coe_mk, Matrix.mul_apply, Finset.sum_mul, Finset.mul_sum, transpose_apply]
conv_lhs => arg 2 intro k rw [Finset.sum_comm] rw [Finset.sum_comm]
conv_rhs => rw [Finset.sum_comm] refine Finset.sum_congr rfl fun j _ => ?_ conv_lhs => arg 2 intro k rw [Finset.sum_comm] rw [Finset.sum_comm] refine Finset.sum_congr rfl fun i _ => ?_ rw [Finset.sum_comm] refine Finset.sum_congr rfl fun l _ => Finset.sum_congr rfl fun k _ => ?_ ring
theorem mat_left_inv [DecidableEq I] {P : Mat K I} (hp : Function.Injective P.mulVec) : ∃ Q : Mat I K, Q*P = 1 := by classical have hp' : Function.Injective (P.mulVecLin) := hp obtain ⟨f,hf⟩ := P.mulVecLin.exists_leftInverse_of_injective (LinearMap.ker_eq_bot.mpr hp') refine ⟨LinearMap.toMatrix' f, ?_⟩ apply Matrix.toLin'.injective rw [Matrix.toLin'_mul] simp only [Matrix.toLin'_one] change ((LinearMap.toMatrix').symm _) ∘ₗ _ = _ rw [LinearEquiv.symm_apply_apply] exact hf
theorem liftM_inj {P : Mat K I} {Q : Mat L J} (hp : Function.Injective P.mulVec) (hq : Function.Injective Q.mulVec) : Function.Injective (liftM P Q) := by classical obtain ⟨P', hP⟩ := mat_left_inv hp obtain ⟨Q', hQ⟩ := mat_left_inv hq intro A B hab have hh := congrArg (liftM P' Q') hab rw [liftM_comp,liftM_comp,hP,hQ] at hh simpa only [liftM_def, Matrix.one_mul, Matrix.transpose_one, Matrix.mul_one] using hh
end Linearend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106import OAI.Combinatorics.HadwigerCounterexample.KeyTestCorrespondence
namespace OAI
/-! # Binary Mixing Bounds -/
noncomputable section
namespace HadwigerCounterexample
open Finset Filter Matrix Function
open scoped BigOperators
variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
namespace Template
variable (v : Template p I)
def kappa := wavelength v.Abbey
omit [DecidableEq I] in
theorem kappa_pos : 0<v.kappa := wavelength_pos _
def diffsel (v : Template p I) := ∀ i j, i≠j → v.aim i=v.aim j → v.s i≠ v.s j
omit [DecidableEq I] in
theorem choral_live (v : Template p I) (m : Mixer p n) (hm : binaryGood m)
(x : UnitType p n N) (hx : litFire p x) (hv : v.diffsel)
(i : v.Chorus) (c : Vec (v.Abbey i)) (hc : c≠0) :
let j := v.choral.first i; let l := v.choral.nextP i
∃ B, (v.f j).keeps (v.t j) B ∧ (v.f l).keeps (v.t l) B ∧
n≤5*blockRank B (v.s j) (v.s l) (v.chorusM m x i c) := by
classical
rcases i with i|i
· intro j l
let a : Vec (MBits p) := fun y => c (.inl y)
let b : Vec Bool := fun y => c (.inr y)
have hh : v.s j≠v.s l := hv j l (v.choral.diff (.inl i)) i.property.1
by_cases h : a=0
· refine ⟨Block.sharp,Flavor.keepSharp ..,Flavor.keepSharp ..,?_⟩
have he : indexedSum m a=0 := by simp [h,indexedSum]
rw [chorus_same]
change n ≤ 5*blockRank _ _ _ (indexedSum m a+selfSum m b)
rw [he,zero_add]
have hz : b≠0 := by
intro hb; apply hc; funext y
cases y
next l => exact congr_fun h l
next l => exact congr_fun hb l
exact (hm _ _ hh).2 b hz
refine ⟨Block.Z,Flavor.keepZ ..,Flavor.keepZ ..,?_⟩
rw [chorus_same]; exact (hm _ _ hh).1 a b h
intro j l; refine ⟨Block.Z,Flavor.keepZ ..,Flavor.keepZ ..,?_⟩
obtain ⟨w,hw,hh⟩ := chorus_cross v m x i c hc
rw [hh]; exact hx _ _ w hw
theorem resonant (v : Template p I) (m : Mixer p n) (hm : binaryGood m)
(x : UnitType p n N) (hx : litFire p x) (hv : v.diffsel)
(w : I → Wgt (Knobs p.g n)) (hw : ∀ i,IsLaw (w i))
(C : ℝ) (hC : 0 < C) (hc : ∀ i j,w i j ≤ C*unif j)
(s : Script p I) :
∀ u : I → Wgt (Knobs p.g n),(∀ i x, |u i x|≤1) →
|avg (prodW w) (fun z => ind (v.performs s m x z)*prodW u z) -
v.kappa * ∏ i:I,avg (w i) (u i)|≤ C^2*bp (-(n:ℝ)/10) := by
classical
refine hear_band v.choral (v.chime m x) (v.lyrics s) w hw _
(mul_nonneg (sq_nonneg _) (bp_pos _).le) ?_
intro i c hc' p q hp hq
obtain ⟨b,hb,hb',hz⟩ := v.choral_live m hm x hx hv i c hc'
simp_rw [vectorPhase,v.chime_seq]
exact spark_condition _ (v.chorusM m x i c) _ _ _ _ _ _ b hb hb' p q hp hq
_ _ (hw _) (hw _) C hC (hc _) (hc _) hz
theorem resonance_calendar (v : Template p I) (M : ℕ) (hM : 4≤ M) (C L : ℝ) (hL : 0<L) :
∀ᶠ n : ℕ in atTop, let N := M*n; ∀ m : Mixer p n, binaryGood m →
v.diffsel → 2*num (Full p n)<N → ∀ ρ : Wgt (UnitType p n N),
(∀ i,ρ i ≤ bp (C*N)*pairW (raw m N) (raw m N) i) →
pr ρ (fun i=>¬litFire p i) ≤ bp (-(n:ℝ)*n/8) ∧
∀ x : UnitType p n N,litFire p x →
∀ w : I → Wgt (Knobs p.g n),(∀ i,IsLaw (w i)) →
(∀ i j,w i j≤ L*unif j) →
∀ (s : Script p I) (u : I→ Wgt (Knobs p.g n)),(∀ i j,|u i j|≤1) →
|avg (prodW w) (fun z => ind (v.performs s m x z)*prodW u z) -
v.kappa*∏ i:I,avg (w i) (u i)| ≤ bp (-(1/20:ℝ)*n) := by
filter_upwards [litFire_calendar p C M hM,pay_nat (a:=1/10) (b:=1/20) (L^2) (by norm_num)]
with n hn ha N m hm hv hN ρ hρ
refine ⟨hn m hN ρ hρ,fun x hx w hw hh s u hu => ?_⟩
exact (resonant v m hm x hx hv w hw L hL hh s u hu).trans
(by rw [show -(↑n:ℝ)/10 = -(1/10:ℝ)*n by ring]; exact ha)
end Template
theorem scanCap (p : Shape) {n : ℕ} (l : Tag p.g) (z : Digest p.g)
(f : Flavor p.g) (hr : 1 ≤ p.r) (hn : 2*p.r≤n) (h : z.feasible l f) :
∀ x,scopedScan p n l f z x≤(scanPrice p)⁻¹*unif x := by
intro x
refine (on_mon (spins_law p n).nz (scanPrice_pos p) (scan_fraction l f z hr hn h)
x).trans_eq ?_
rw [spins,← draws_unif]
theorem dialCap (p : Shape) {n : ℕ} (l : Tag p.g) (z : F)
(f : Flavor p.g) (hr : 1 ≤ p.r) (hn : 2*p.r≤n) (h : canDial p l f z) :
∀ x,scopedBit p n l f z x≤(scanPrice p)⁻¹*unif x := by
intro x
refine (on_mon (spins_law p n).nz (scanPrice_pos p) (dial_fraction p n _ _ _ hr hn h)
x).trans_eq ?_
rw [spins,← draws_unif]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.KeyTestCorrespondence
namespace OAI
/-! # Binary Mixing Bounds -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Filter Matrix Functionopen scoped BigOperatorsvariable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]namespace Templatevariable (v : Template p I)
def kappa := wavelength v.Abbeyomit [DecidableEq I] intheorem kappa_pos : 0<v.kappa := wavelength_pos _
def diffsel (v : Template p I) := ∀ i j, i≠j → v.aim i=v.aim j → v.s i≠ v.s j
omit [DecidableEq I] intheorem choral_live (v : Template p I) (m : Mixer p n) (hm : binaryGood m) (x : UnitType p n N) (hx : litFire p x) (hv : v.diffsel) (i : v.Chorus) (c : Vec (v.Abbey i)) (hc : c≠0) : let j := v.choral.first i; let l := v.choral.nextP i ∃ B, (v.f j).keeps (v.t j) B ∧ (v.f l).keeps (v.t l) B ∧ n≤5*blockRank B (v.s j) (v.s l) (v.chorusM m x i c) := by classical rcases i with i|i · intro j l let a : Vec (MBits p) := fun y => c (.inl y) let b : Vec Bool := fun y => c (.inr y) have hh : v.s j≠v.s l := hv j l (v.choral.diff (.inl i)) i.property.1 by_cases h : a=0 · refine ⟨Block.sharp,Flavor.keepSharp ..,Flavor.keepSharp ..,?_⟩ have he : indexedSum m a=0 := by simp [h,indexedSum] rw [chorus_same] change n ≤ 5*blockRank _ _ _ (indexedSum m a+selfSum m b) rw [he,zero_add] have hz : b≠0 := by intro hb; apply hc; funext y cases y next l => exact congr_fun h l next l => exact congr_fun hb l exact (hm _ _ hh).2 b hz refine ⟨Block.Z,Flavor.keepZ ..,Flavor.keepZ ..,?_⟩ rw [chorus_same]; exact (hm _ _ hh).1 a b h intro j l; refine ⟨Block.Z,Flavor.keepZ ..,Flavor.keepZ ..,?_⟩ obtain ⟨w,hw,hh⟩ := chorus_cross v m x i c hc rw [hh]; exact hx _ _ w hw
theorem resonant (v : Template p I) (m : Mixer p n) (hm : binaryGood m) (x : UnitType p n N) (hx : litFire p x) (hv : v.diffsel) (w : I → Wgt (Knobs p.g n)) (hw : ∀ i,IsLaw (w i)) (C : ℝ) (hC : 0 < C) (hc : ∀ i j,w i j ≤ C*unif j) (s : Script p I) : ∀ u : I → Wgt (Knobs p.g n),(∀ i x, |u i x|≤1) → |avg (prodW w) (fun z => ind (v.performs s m x z)*prodW u z) - v.kappa * ∏ i:I,avg (w i) (u i)|≤ C^2*bp (-(n:ℝ)/10) := by classical refine hear_band v.choral (v.chime m x) (v.lyrics s) w hw _ (mul_nonneg (sq_nonneg _) (bp_pos _).le) ?_ intro i c hc' p q hp hq obtain ⟨b,hb,hb',hz⟩ := v.choral_live m hm x hx hv i c hc' simp_rw [vectorPhase,v.chime_seq] exact spark_condition _ (v.chorusM m x i c) _ _ _ _ _ _ b hb hb' p q hp hq _ _ (hw _) (hw _) C hC (hc _) (hc _) hz
theorem resonance_calendar (v : Template p I) (M : ℕ) (hM : 4≤ M) (C L : ℝ) (hL : 0<L) : ∀ᶠ n : ℕ in atTop, let N := M*n; ∀ m : Mixer p n, binaryGood m → v.diffsel → 2*num (Full p n)<N → ∀ ρ : Wgt (UnitType p n N), (∀ i,ρ i ≤ bp (C*N)*pairW (raw m N) (raw m N) i) → pr ρ (fun i=>¬litFire p i) ≤ bp (-(n:ℝ)*n/8) ∧ ∀ x : UnitType p n N,litFire p x → ∀ w : I → Wgt (Knobs p.g n),(∀ i,IsLaw (w i)) → (∀ i j,w i j≤ L*unif j) → ∀ (s : Script p I) (u : I→ Wgt (Knobs p.g n)),(∀ i j,|u i j|≤1) → |avg (prodW w) (fun z => ind (v.performs s m x z)*prodW u z) - v.kappa*∏ i:I,avg (w i) (u i)| ≤ bp (-(1/20:ℝ)*n) := by filter_upwards [litFire_calendar p C M hM,pay_nat (a:=1/10) (b:=1/20) (L^2) (by norm_num)] with n hn ha N m hm hv hN ρ hρ refine ⟨hn m hN ρ hρ,fun x hx w hw hh s u hu => ?_⟩ exact (resonant v m hm x hx hv w hw L hL hh s u hu).trans (by rw [show -(↑n:ℝ)/10 = -(1/10:ℝ)*n by ring]; exact ha)end Template
theorem scanCap (p : Shape) {n : ℕ} (l : Tag p.g) (z : Digest p.g) (f : Flavor p.g) (hr : 1 ≤ p.r) (hn : 2*p.r≤n) (h : z.feasible l f) : ∀ x,scopedScan p n l f z x≤(scanPrice p)⁻¹*unif x := by intro x refine (on_mon (spins_law p n).nz (scanPrice_pos p) (scan_fraction l f z hr hn h) x).trans_eq ?_ rw [spins,← draws_unif]
theorem dialCap (p : Shape) {n : ℕ} (l : Tag p.g) (z : F) (f : Flavor p.g) (hr : 1 ≤ p.r) (hn : 2*p.r≤n) (h : canDial p l f z) : ∀ x,scopedBit p n l f z x≤(scanPrice p)⁻¹*unif x := by intro x refine (on_mon (spins_law p n).nz (scanPrice_pos p) (dial_fraction p n _ _ _ hr hn h) x).trans_eq ?_ rw [spins,← draws_unif]end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265import OAI.Combinatorics.HadwigerCounterexample.RealizationConditions
import OAI.Combinatorics.HadwigerCounterexample.MixerConditions
namespace OAI
/-! # Binary Prescriptions -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix Finset
variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I]
/-- list for a cross edge -/
def aiming (a b : I → Bool) (i j : Bool) :=
Finset.univ.filter (fun x => a x=i ∧ b x=j)
/-- within-endpoint L/R bit tests. Read only a x=a y, x≠y.
(tests between ordered points; no double counting since L,R and
both orientations are in the mixer hypothesis). -/
abbrev Script (p : Shape) (I : Type) := I → I → Vec (MOne p)
namespace Volley
variable (v : Volley p n I)
def reads (s : Script p I) (m : Mixer p n) :=
∀ x y : I,x≠y → v.obj x=v.obj y →
∀ i : MOne p, s x y i = evmat (orderedM m i) (v.rayAt x) (v.rayAt y)
end Volley
def prescribedB (p : Shape) (t : Tagging p I) (s : Script p I) (x y : I) :=
∑ i : Fin p.J,∑ e : Comp p.g, ∑ f : Comp p.g, if inc e (t x) ∧ inc f (t y) then
s x y ((i,e,f),true)*s x y ((i,e,f),false) else 0
noncomputable def prescribedT (p : Shape) (t : Tagging p I) (d : Vec I)
(h : Mat I I) (s : Script p I) (x y : I) : F :=
@ite _ (x=y) (Classical.propDecidable _) (d x)
(h x y+(prescribedB p t s x y+prescribedB p t s y x))
def fulfills (p : Shape) (t : Tagging p I) (d f : Vec I) (u : Mat I I)
(s : Script p I) (a b : I → Bool) :=
∀ (x : I) (j : Bool),
d x+ (∑ i∈aiming a b (a x) j, prescribedT p t d u s i x) =
if j=b x then 0 else f x
namespace Volley
variable {v : Volley p n I}
omit [Fintype I] in
private theorem B1_eval {s : Script p I} (t : Tagging p I) (m : Mixer p n)
(ha : v.reads s m) {x y : I} (hg : x ≠ y) (hh : v.obj x=v.obj y) :
B1 m (v.atomAt t x) (v.atomAt t y)=prescribedB p t s x y := by
classical
change ∑ i : Fin p.J, _ = _
refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun e _ =>
Finset.sum_congr rfl fun f _ => ?_
by_cases he : inc e (t x)
· by_cases hf : inc f (t y)
· rw [ite_eq_left ⟨he,hf⟩,ha x y hg hh,ha x y hg hh]
simp only [atomAt,atom_def,he,hf,ite_true,mom,liftM_outer,pair_outers]
rfl
rw [ite_eq_right (show ¬ (_ ∧ _) from fun h => hf h.2)]
simp only [atomAt,atom_def,hf,ite_false,map_zero]
rw [ite_eq_right (show ¬ (_ ∧ _) from fun h => he h.1)]
simp only [atomAt,atom_def,he,ite_false]
rw [mpair_comm,map_zero]
theorem grads_by_script (t : Tagging p I) (m : Mixer p n) (w : Volley p n I)
(y : UnitType p n N) {d f : Vec I} {u : Mat I I} {s : Script p I}
(h : fulfills p t d f u s v.obj w.obj) (hs : v.reads s m)
(hd : ∀ x,role p n (v.atomAt t x)=d x)
(hf : ∀ x,innerP p y (w.obj x) (w.atomAt t x)=f x)
(hu : ∀ x y : I,T0 p n (v.atomAt t x) (v.atomAt t y)=u x y) :
v.attackGrad w t m y := by
classical
intro x j
rw [grad_val,hd,hf,sumAt,map_sum,LinearMap.sum_apply]
rw [← h x j]; congr 1
refine Finset.sum_congr rfl fun i hi => ?_
unfold prescribedT
split
· rename_i he
subst x
rw [T_diag,hd]
rename_i he
have hx := (Finset.mem_filter.mp hi).2.1
rw [Tsym_val,hu, B1_eval t m hs he hx,B1_eval t m hs (Ne.symm he) hx.symm]
end Volley
/-- Solve symmetric row sums at one endpoint. Couple via opposite
same-target pmiss/role sum equality. Only the resulting necessary
(common d+f sum) is used as input here. -/
private theorem binary_plan (a b : I→Bool) (i : Bool) (d f : Vec I)
(h : (∑ j∈aiming a b i true,(d j+f j))=∑ j∈aiming a b i false,(d j+f j))
(h' : ∀ j,(aiming a b i j).Nonempty) :
∃ M : Mat I I, Mᵀ=M ∧ (∀ x,M x x=d x) ∧ ∀ j : Bool,∀ x∈Finset.univ.filter (fun l => a l=i),
(∑ l∈aiming a b i j,M l x) = d x+(if j=b x then 0 else f x) := by
classical
let S := aiming a b i
let X : Mat I Bool := Matrix.of (fun i j => if i∈S j then 1 else 0)
let V : Mat I Bool := Matrix.of (fun x j => d x + (if j=b x then 0 else f x))
let D := Matrix.diagonal d
let Y := V+D*X
obtain ⟨L,hL⟩ := mat_left_inv (P:=X) (by
intro x y he
funext j
obtain ⟨v,hv⟩ := h' j
have ha := (Finset.mem_filter.mp hv).2
have heq (x) : (X *ᵥ x) v=x j := by
unfold X Matrix.mulVec dotProduct
rw [Finset.sum_eq_single j]
· simp [hv,S]
· intro k _ hk; simp [S,aiming,ha,hk.symm]
simp
rw [← heq x,← heq y,he])
let B := Xᵀ*Y
have hg (j k : Bool) : B j k=if j=k then 0 else (∑ l∈S j,(d l+f l)) := by
have hi {l : I} (hh : l∈S j) : a l=i ∧ b l=j := (Finset.mem_filter.mp hh).2
have hy {l : I} (hL : l∈S j) :
Y l k= (if j=k then 0 else d l+f l) := by
unfold Y V X; rw [Matrix.add_apply,Matrix.of_apply,Matrix.diagonal_mul,Matrix.of_apply]
by_cases h : j=k
· subst k
simp only [(hi hL).2,hL,ite_true,add_zero,mul_one,char_two]
have hv : l∉S k := fun hw => h ((hi hL).2.symm.trans (Finset.mem_filter.mp hw).2.2)
simp [h,Ne.symm h,(hi hL).2,hv]
have ht (l : I) : X l j*Y l k= if l∈S j then Y l k else 0 := by
by_cases hv : l∈S j <;> simp [X,hv]
unfold B; rw [Matrix.mul_apply]
simp_rw [Matrix.transpose_apply,ht,← Finset.sum_filter]
rw [show Finset.univ.filter (fun x => x∈S j)=S j from (by simp)]
by_cases g : j=k
· rw [ite_eq_left g]
exact Finset.sum_eq_zero fun l hl => (hy hl).trans (ite_eq_left g)
rw [ite_eq_right g]
exact Finset.sum_congr rfl fun l hl => (hy hl).trans (ite_eq_right g)
have ha (j : Bool) : B j j=0 := by rw [hg,ite_eq_left rfl]
have hB : Bᵀ=B := by
ext j k
rw [Matrix.transpose_apply,hg,hg]
cases j <;> cases k
all_goals simp
· exact h
exact h.symm
let W := Lᵀ*B*L
have hW : Wᵀ=W := by unfold W; simp only [transpose_mul,transpose_transpose,hB,Matrix.mul_assoc]
have hw (x : I) : W x x=0 := by
unfold W
have hf : B false true=B true false := congr_fun (congr_fun hB true) false
simp only [Matrix.mul_apply,Fintype.sum_bool,Matrix.transpose_apply,ha,mul_zero,zero_add,
add_zero,hf]
rw [mul_right_comm (L false x), show L true x * B true false * L false x=
L false x * L true x * B true false from (by ring),char_two]
let Z := Y*L+(Y*L)ᵀ + W
have he : (D+Z)*X=V := by
have he : (Y*L)ᵀ*X=W*X := by
unfold W
have hh : Yᵀ * X=B := by
have ht : Bᵀ=Yᵀ*X := by unfold B; rw [Matrix.transpose_mul,transpose_transpose]
rw [← ht,hB]
rw [Matrix.transpose_mul,Matrix.mul_assoc Lᵀ Yᵀ X,hh,Matrix.mul_assoc _ L X,hL,
Matrix.mul_one]
unfold Z
rw [Matrix.add_mul,Matrix.add_mul,Matrix.add_mul,Matrix.mul_assoc Y L X,hL,
Matrix.mul_one,he,add_assoc Y,char_two,add_zero]
unfold Y
rw [add_left_comm,char_two,add_zero]
refine ⟨D+Z,?_,?_,fun j x hx => ?_⟩
· unfold Z D
simp only [transpose_add,Matrix.diagonal_transpose,transpose_transpose,hW]
ac_rfl
· intro x
unfold D Z
simp only [Matrix.add_apply,Matrix.diagonal_apply_eq,Matrix.transpose_apply,hw,
char_two,add_zero]
let Q := D+Z
have hq : Qᵀ=Q := by
unfold Q Z D
simp only [transpose_add,Matrix.diagonal_transpose,transpose_transpose,hW]
ac_rfl
have h1 : (Q * X) x j= _ := congr_fun (congr_fun he x) j
rw [Matrix.mul_apply] at h1
have hy : ∑ l∈S j, Q l x =∑ l, Q x l * X l j := by
conv_rhs => unfold X
simp only [Matrix.of_apply,mul_ite,mul_one,mul_zero, ←Finset.sum_filter]
rw [show Finset.univ.filter (fun x => x∈ S j)=S j from (by simp)]
exact Finset.sum_congr rfl fun l _ => congr_fun (congr_fun hq x) l
exact hy.trans h1
omit [Fintype I] in
private theorem scripted (p : Shape) (t : Tagging p I) (g : I→I→F)
(h : 2≤p.g) (hJ : 1 ≤ p.J) :
∃ s : Script p I,∀ x y,prescribedB p t s x y=g x y := by
classical
have hh (x : I) : ∃ i : Comp p.g,inc i (t x) := by
have he := card_star (t x)
have hi : Nonempty (TagStar (t x)) := Fintype.card_pos_iff.mp (by omega)
obtain ⟨⟨i,h⟩⟩ := hi
exact ⟨i,h⟩
choose q hq using hh
let i0 : Fin p.J := ⟨0,hJ⟩
let s : Script p I := fun x y i =>
if i.1=(i0,q x,q y) then if i.2 then g x y else 1 else 0
refine ⟨s,fun x y => ?_⟩
unfold prescribedB
rw [Finset.sum_eq_single i0]
· rw [Finset.sum_eq_single (q x)]
· rw [Finset.sum_eq_single (q y)]
· simp [s,hq]
· intro i _ hi; simp [s,hi]
simp
· intro i _ hi; simp [s,hi]
simp
· intro i _ hi; simp [s,hi]
simp
set_option maxHeartbeats 600000 in
theorem choose_script (p : Shape) (t : Tagging p I) (a b : I→Bool)
(d : Vec I)
(f : Vec I)
(d' : Vec I)
(h : ∀ i : Bool,(∑ x∈aiming a b i true,(d' x+f x)) =
∑ x∈aiming a b i false,(d' x+f x))
(ha : ∀ i j : Bool, ∑ x∈aiming a b i j,(d x+d' x)=1)
(hc : ∀ i j : Bool,(aiming a b i j).Nonempty)
(u : Mat I I) (hu : uᵀ=u)
(hg : 2≤p.g) (hi : 1≤p.J) :
∃ s : Script p I, fulfills p t d f u s a b := by
classical
have hh (i j : Bool) :
(∑ x∈aiming a b i j,(d x+f x))=1+ ∑ x∈aiming a b i j,(d' x+f x) := by
rw [←ha,← Finset.sum_add_distrib]
refine Finset.sum_congr rfl fun x _ => ?_
rw [add_assoc,←add_assoc (d' x),char_two,zero_add]
choose M hM hD hA using fun i : Bool => binary_plan a b i d f (by rw [hh,hh,h]) (hc i)
let F' := Fintype.equivFin I
let g (x y : I) := if F' x < F' y then M (a x) x y+u x y else 0
obtain ⟨s,hs⟩ := scripted p t g hg hi
have hf (x y : I) (h : a x=a y) : prescribedT p t d u s x y=M (a x) x y := by
unfold prescribedT
split
· rename_i he
subst y
exact (hD _ _).symm
rename_i he
rw [hs x y, hs y x]
rcases lt_or_gt_of_ne (show F' x ≠ F' y from fun h => he (F'.injective h)) with e|e
· simp only [g, ite_eq_left e,ite_eq_right (not_lt.mpr e.le),add_zero]
rw [add_left_comm,char_two,add_zero]
simp only [g,ite_eq_left e,ite_eq_right (not_lt.mpr e.le),zero_add]
rw [←h,show u y x=u x y from congr_fun (congr_fun hu x) y,
show M (a x) y x=M (a x) x y from congr_fun (congr_fun (hM (a x)) x) y]
rw [add_left_comm,char_two,add_zero]
refine ⟨s,fun x j => ?_⟩
let S := aiming a b (a x) j
have he : ∑ i∈S,prescribedT p t d u s i x=∑ i∈S,M (a x) i x :=
Finset.sum_congr rfl fun i hi => by
have hm : a i=a x := (Finset.mem_filter.mp hi).2.1
rw [hf i x hm,hm]
rw [he,hA (a x) j x (by simp), ← add_assoc, char_two,zero_add]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.RealizationConditionsimport OAI.Combinatorics.HadwigerCounterexample.MixerConditions
namespace OAI
/-! # Binary Prescriptions -/
noncomputable sectionnamespace HadwigerCounterexample
open scoped BigOperatorsopen Matrix Finsetvariable {p : Shape} {n N : ℕ} {I : Type} [Fintype I]
/-- list for a cross edge -/def aiming (a b : I → Bool) (i j : Bool) := Finset.univ.filter (fun x => a x=i ∧ b x=j)
/-- within-endpoint L/R bit tests. Read only a x=a y, x≠y.(tests between ordered points; no double counting since L,R andboth orientations are in the mixer hypothesis). -/abbrev Script (p : Shape) (I : Type) := I → I → Vec (MOne p)
namespace Volleyvariable (v : Volley p n I)def reads (s : Script p I) (m : Mixer p n) := ∀ x y : I,x≠y → v.obj x=v.obj y → ∀ i : MOne p, s x y i = evmat (orderedM m i) (v.rayAt x) (v.rayAt y)end Volley
def prescribedB (p : Shape) (t : Tagging p I) (s : Script p I) (x y : I) := ∑ i : Fin p.J,∑ e : Comp p.g, ∑ f : Comp p.g, if inc e (t x) ∧ inc f (t y) then s x y ((i,e,f),true)*s x y ((i,e,f),false) else 0
noncomputable def prescribedT (p : Shape) (t : Tagging p I) (d : Vec I) (h : Mat I I) (s : Script p I) (x y : I) : F := @ite _ (x=y) (Classical.propDecidable _) (d x) (h x y+(prescribedB p t s x y+prescribedB p t s y x))
def fulfills (p : Shape) (t : Tagging p I) (d f : Vec I) (u : Mat I I) (s : Script p I) (a b : I → Bool) := ∀ (x : I) (j : Bool), d x+ (∑ i∈aiming a b (a x) j, prescribedT p t d u s i x) = if j=b x then 0 else f x
namespace Volleyvariable {v : Volley p n I}
omit [Fintype I] inprivate theorem B1_eval {s : Script p I} (t : Tagging p I) (m : Mixer p n) (ha : v.reads s m) {x y : I} (hg : x ≠ y) (hh : v.obj x=v.obj y) : B1 m (v.atomAt t x) (v.atomAt t y)=prescribedB p t s x y := by classical change ∑ i : Fin p.J, _ = _ refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun e _ => Finset.sum_congr rfl fun f _ => ?_ by_cases he : inc e (t x) · by_cases hf : inc f (t y) · rw [ite_eq_left ⟨he,hf⟩,ha x y hg hh,ha x y hg hh] simp only [atomAt,atom_def,he,hf,ite_true,mom,liftM_outer,pair_outers] rfl rw [ite_eq_right (show ¬ (_ ∧ _) from fun h => hf h.2)] simp only [atomAt,atom_def,hf,ite_false,map_zero] rw [ite_eq_right (show ¬ (_ ∧ _) from fun h => he h.1)] simp only [atomAt,atom_def,he,ite_false] rw [mpair_comm,map_zero]
theorem grads_by_script (t : Tagging p I) (m : Mixer p n) (w : Volley p n I) (y : UnitType p n N) {d f : Vec I} {u : Mat I I} {s : Script p I} (h : fulfills p t d f u s v.obj w.obj) (hs : v.reads s m) (hd : ∀ x,role p n (v.atomAt t x)=d x) (hf : ∀ x,innerP p y (w.obj x) (w.atomAt t x)=f x) (hu : ∀ x y : I,T0 p n (v.atomAt t x) (v.atomAt t y)=u x y) : v.attackGrad w t m y := by classical intro x j rw [grad_val,hd,hf,sumAt,map_sum,LinearMap.sum_apply] rw [← h x j]; congr 1 refine Finset.sum_congr rfl fun i hi => ?_ unfold prescribedT split · rename_i he subst x rw [T_diag,hd] rename_i he have hx := (Finset.mem_filter.mp hi).2.1 rw [Tsym_val,hu, B1_eval t m hs he hx,B1_eval t m hs (Ne.symm he) hx.symm]end Volley
/-- Solve symmetric row sums at one endpoint. Couple via oppositesame-target pmiss/role sum equality. Only the resulting necessary(common d+f sum) is used as input here. -/private theorem binary_plan (a b : I→Bool) (i : Bool) (d f : Vec I) (h : (∑ j∈aiming a b i true,(d j+f j))=∑ j∈aiming a b i false,(d j+f j)) (h' : ∀ j,(aiming a b i j).Nonempty) : ∃ M : Mat I I, Mᵀ=M ∧ (∀ x,M x x=d x) ∧ ∀ j : Bool,∀ x∈Finset.univ.filter (fun l => a l=i), (∑ l∈aiming a b i j,M l x) = d x+(if j=b x then 0 else f x) := by classical let S := aiming a b i let X : Mat I Bool := Matrix.of (fun i j => if i∈S j then 1 else 0) let V : Mat I Bool := Matrix.of (fun x j => d x + (if j=b x then 0 else f x)) let D := Matrix.diagonal d let Y := V+D*X obtain ⟨L,hL⟩ := mat_left_inv (P:=X) (by intro x y he funext j obtain ⟨v,hv⟩ := h' j have ha := (Finset.mem_filter.mp hv).2 have heq (x) : (X *ᵥ x) v=x j := by unfold X Matrix.mulVec dotProduct rw [Finset.sum_eq_single j] · simp [hv,S] · intro k _ hk; simp [S,aiming,ha,hk.symm] simp rw [← heq x,← heq y,he]) let B := Xᵀ*Y have hg (j k : Bool) : B j k=if j=k then 0 else (∑ l∈S j,(d l+f l)) := by have hi {l : I} (hh : l∈S j) : a l=i ∧ b l=j := (Finset.mem_filter.mp hh).2 have hy {l : I} (hL : l∈S j) : Y l k= (if j=k then 0 else d l+f l) := by unfold Y V X; rw [Matrix.add_apply,Matrix.of_apply,Matrix.diagonal_mul,Matrix.of_apply] by_cases h : j=k · subst k simp only [(hi hL).2,hL,ite_true,add_zero,mul_one,char_two] have hv : l∉S k := fun hw => h ((hi hL).2.symm.trans (Finset.mem_filter.mp hw).2.2) simp [h,Ne.symm h,(hi hL).2,hv] have ht (l : I) : X l j*Y l k= if l∈S j then Y l k else 0 := by by_cases hv : l∈S j <;> simp [X,hv] unfold B; rw [Matrix.mul_apply] simp_rw [Matrix.transpose_apply,ht,← Finset.sum_filter] rw [show Finset.univ.filter (fun x => x∈S j)=S j from (by simp)] by_cases g : j=k · rw [ite_eq_left g] exact Finset.sum_eq_zero fun l hl => (hy hl).trans (ite_eq_left g) rw [ite_eq_right g] exact Finset.sum_congr rfl fun l hl => (hy hl).trans (ite_eq_right g) have ha (j : Bool) : B j j=0 := by rw [hg,ite_eq_left rfl] have hB : Bᵀ=B := by ext j k rw [Matrix.transpose_apply,hg,hg] cases j <;> cases k all_goals simp · exact h exact h.symm let W := Lᵀ*B*L have hW : Wᵀ=W := by unfold W; simp only [transpose_mul,transpose_transpose,hB,Matrix.mul_assoc] have hw (x : I) : W x x=0 := by unfold W have hf : B false true=B true false := congr_fun (congr_fun hB true) false simp only [Matrix.mul_apply,Fintype.sum_bool,Matrix.transpose_apply,ha,mul_zero,zero_add, add_zero,hf] rw [mul_right_comm (L false x), show L true x * B true false * L false x= L false x * L true x * B true false from (by ring),char_two] let Z := Y*L+(Y*L)ᵀ + W have he : (D+Z)*X=V := by have he : (Y*L)ᵀ*X=W*X := by unfold W have hh : Yᵀ * X=B := by have ht : Bᵀ=Yᵀ*X := by unfold B; rw [Matrix.transpose_mul,transpose_transpose] rw [← ht,hB] rw [Matrix.transpose_mul,Matrix.mul_assoc Lᵀ Yᵀ X,hh,Matrix.mul_assoc _ L X,hL, Matrix.mul_one] unfold Z rw [Matrix.add_mul,Matrix.add_mul,Matrix.add_mul,Matrix.mul_assoc Y L X,hL, Matrix.mul_one,he,add_assoc Y,char_two,add_zero] unfold Y rw [add_left_comm,char_two,add_zero] refine ⟨D+Z,?_,?_,fun j x hx => ?_⟩ · unfold Z D simp only [transpose_add,Matrix.diagonal_transpose,transpose_transpose,hW] ac_rfl · intro x unfold D Z simp only [Matrix.add_apply,Matrix.diagonal_apply_eq,Matrix.transpose_apply,hw, char_two,add_zero] let Q := D+Z have hq : Qᵀ=Q := by unfold Q Z D simp only [transpose_add,Matrix.diagonal_transpose,transpose_transpose,hW] ac_rfl have h1 : (Q * X) x j= _ := congr_fun (congr_fun he x) j rw [Matrix.mul_apply] at h1 have hy : ∑ l∈S j, Q l x =∑ l, Q x l * X l j := by conv_rhs => unfold X simp only [Matrix.of_apply,mul_ite,mul_one,mul_zero, ←Finset.sum_filter] rw [show Finset.univ.filter (fun x => x∈ S j)=S j from (by simp)] exact Finset.sum_congr rfl fun l _ => congr_fun (congr_fun hq x) l exact hy.trans h1
omit [Fintype I] inprivate theorem scripted (p : Shape) (t : Tagging p I) (g : I→I→F) (h : 2≤p.g) (hJ : 1 ≤ p.J) : ∃ s : Script p I,∀ x y,prescribedB p t s x y=g x y := by classical have hh (x : I) : ∃ i : Comp p.g,inc i (t x) := by have he := card_star (t x) have hi : Nonempty (TagStar (t x)) := Fintype.card_pos_iff.mp (by omega) obtain ⟨⟨i,h⟩⟩ := hi exact ⟨i,h⟩ choose q hq using hh let i0 : Fin p.J := ⟨0,hJ⟩ let s : Script p I := fun x y i => if i.1=(i0,q x,q y) then if i.2 then g x y else 1 else 0 refine ⟨s,fun x y => ?_⟩ unfold prescribedB rw [Finset.sum_eq_single i0] · rw [Finset.sum_eq_single (q x)] · rw [Finset.sum_eq_single (q y)] · simp [s,hq] · intro i _ hi; simp [s,hi] simp · intro i _ hi; simp [s,hi] simp · intro i _ hi; simp [s,hi] simp
set_option maxHeartbeats 600000 intheorem choose_script (p : Shape) (t : Tagging p I) (a b : I→Bool) (d : Vec I) (f : Vec I) (d' : Vec I) (h : ∀ i : Bool,(∑ x∈aiming a b i true,(d' x+f x)) = ∑ x∈aiming a b i false,(d' x+f x)) (ha : ∀ i j : Bool, ∑ x∈aiming a b i j,(d x+d' x)=1) (hc : ∀ i j : Bool,(aiming a b i j).Nonempty) (u : Mat I I) (hu : uᵀ=u) (hg : 2≤p.g) (hi : 1≤p.J) : ∃ s : Script p I, fulfills p t d f u s a b := by classical have hh (i j : Bool) : (∑ x∈aiming a b i j,(d x+f x))=1+ ∑ x∈aiming a b i j,(d' x+f x) := by rw [←ha,← Finset.sum_add_distrib] refine Finset.sum_congr rfl fun x _ => ?_ rw [add_assoc,←add_assoc (d' x),char_two,zero_add] choose M hM hD hA using fun i : Bool => binary_plan a b i d f (by rw [hh,hh,h]) (hc i) let F' := Fintype.equivFin I let g (x y : I) := if F' x < F' y then M (a x) x y+u x y else 0 obtain ⟨s,hs⟩ := scripted p t g hg hi have hf (x y : I) (h : a x=a y) : prescribedT p t d u s x y=M (a x) x y := by unfold prescribedT split · rename_i he subst y exact (hD _ _).symm rename_i he rw [hs x y, hs y x] rcases lt_or_gt_of_ne (show F' x ≠ F' y from fun h => he (F'.injective h)) with e|e · simp only [g, ite_eq_left e,ite_eq_right (not_lt.mpr e.le),add_zero] rw [add_left_comm,char_two,add_zero] simp only [g,ite_eq_left e,ite_eq_right (not_lt.mpr e.le),zero_add] rw [←h,show u y x=u x y from congr_fun (congr_fun hu x) y, show M (a x) y x=M (a x) x y from congr_fun (congr_fun (hM (a x)) x) y] rw [add_left_comm,char_two,add_zero] refine ⟨s,fun x j => ?_⟩ let S := aiming a b (a x) j have he : ∑ i∈S,prescribedT p t d u s i x=∑ i∈S,M (a x) i x := Finset.sum_congr rfl fun i hi => by have hm : a i=a x := (Finset.mem_filter.mp hi).2.1 rw [hf i x hm,hm] rw [he,hA (a x) j x (by simp), ← add_assoc, char_two,zero_add]end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143import OAI.Combinatorics.HadwigerCounterexample.FiniteOptionLabels
namespace OAI
/-! # Binary Status Comparison -/
noncomputable section
namespace HadwigerCounterexample
open Finset Matrix Filter Function Submodule Module LinearMap
open scoped BigOperators
variable {A B J H : Type} [Fintype A] [Fintype B] [Fintype J]
theorem disagreement_bound (w : Wgt A) (hw : ∀ x,0 ≤ w x) (f g h:A→ H) :
pr w (fun i=> f i≠ h i) ≤ pr w (fun i=>f i≠ g i) + pr w (fun i=>g i≠h i) :=
let p (i:A) := f i≠g i∨g i≠h i
((pr_mono hw fun i h=>show p i from Classical.byContradiction (fun hi => h (Eq.trans
(not_not.mp (mt Or.inl hi)) (not_not.mp (mt Or.inr hi))))).trans (pr_or_le hw))
def majority (w : Wgt A) (f : A→F) :=
if 1/2≤ pr w (fun i=>f i=0) then (0:F) else 1
theorem majority_bound (w : Wgt A) (hw:IsLaw w) (f : A→F) :
1/2 ≤ pr w (fun i=> f i= majority w f) := by
classical
unfold majority
split
next h => exact h
next h =>
have hi i : f i=1 ↔ ¬f i=0 :=
⟨fun hh=>by rw [hh]; exact one_ne_zero,fun hh=>(bit_cases _).resolve_left hh⟩
simp_rw [hi,pr_not,hw.total]
exact le_of_lt (by linarith only [h])
theorem majority_charge (p:Wgt A) (q:Wgt B) (hp:IsLaw p) (hq:IsLaw q)
(f:A→F) (g:B→F) :
pr p (fun i=> f i≠majority q g)≤2 * pr (pairW p q) (fun i=> f i.1≠g i.2) := by
classical
let Q i:= g i=majority q g; let P i:= f i≠majority q g
let v:= pairW p q
have hm (z:A×B) (h:P z.1∧Q z.2): f z.1≠g z.2 := h.2 ▸ h.1
have hh : pr p P*pr q Q ≤ pr v (fun i=>f i.1≠g i.2) :=
(pairW_pr ..).symm.le.trans (pr_mono (pairW_law hp hq).nz hm)
have hx:=majority_bound q hq g
have hh' := mul_le_mul_of_nonneg_left hx (pr_nonneg (p:=P) hp.nz)
change _* (1/2) ≤ _*pr q Q at hh'
change pr p P≤2*pr v _
linarith only [hh,hh']
theorem reflect_cost (p:Wgt A) (q:Wgt B) (hp:IsLaw p) (hq:IsLaw q)
(f:A→H) (g:B→H) (k:H) :
pr q (fun i=>g i≠k)≤ pr (pairW p q) (fun i=>f i.1≠g i.2)+pr p (fun i=>f i≠k) := by
let w:=pairW p q
let t i:= g i≠k; let s i:= f i≠k
have hi : pr q t=pr w (fun i=> t i.2) := by simpa [hp.total] using
(pairW_pr p q (fun _=>True) t).symm
have hj : pr p s=pr w (fun i=>s i.1) := by simpa [hq.total] using
(pairW_pr p q s (fun _=>True)).symm
let P (i:A×B):= f i.1 ≠ g i.2
rw [hi,hj]
have hh (i:A×B) (h:t i.2): P i∨ s i.1 := by
by_cases he:P i
· exact Or.inl he
exact Or.inr (fun hc=> h ((not_not.mp he).symm.trans hc))
exact (pr_mono (pairW_law hp hq).nz hh).trans (pr_or_le (pairW_law hp hq).nz)
namespace StatusAnalysis
namespace DualAnalysis
variable {p:Shape} {d e: Rates} {r K:ℕ}
abbrev Pulsar (p:Shape) (r:ℕ):= Tag p.g → F → Fin r→F
variable (u:Terrain p r) (s:Gazette p r d) (t:Gazette p r e)
def shot (i:Nodes) (x:Appearance p) (a:RhymeSet (d i)) (f:Pulsar p r) :=
avg (u x.l x.q) (fun j=>pr (s i x j) (fun v=> a.soot x v ≠f x.l x.q j))
def praise (u:Terrain p r) (s:Gazette p r d) (i:Nodes)
(A:Finset (Label p.b)) (a:RhymeSet (d i)) (f:Pulsar p r) (ε:ℝ) :=
∀ x:Appearance p,x.s∉A →x.apt → shot u s i x a f≤ε
def counsel (i:Grid) (A B:Finset (Label p.b))
(a : RhymeSet (d i.1)) (b : RhymeSet (e i.2)) (ε :ℝ) :=
∀ x:Zodiac p,x.common → x.s true∉A →x.s false∉ B →charge u x s t i a b≤ε
def amazes (p:Shape) (z:Label p.b) (l: Tag p.g) (q:F):Appearance p:=⟨l,z,Flavor.full,q⟩
def amends (p:Shape) (x y:Appearance p): Zodiac p :=
{l:=x.l
q:=x.q
s i:=if i then x.s else y.s
f i:=if i then x.f else y.f}
theorem amendsB (x y: Appearance p)(h:x.l=y.l)(ht:x.q=y.q):
(amends p x y).aspect false=y := by cases x; cases y; simp_all [amends,Zodiac.aspect]
theorem splitCounsel (i:Grid) (A B:Finset (Label p.b))
(a : RhymeSet (d i.1)) (b : RhymeSet (e i.2)) (ε :ℝ)
(h:counsel u s t i A B a b ε) (x y:Appearance p)
(hx:x.s∉A) (hy:y.s∉B) (he:x.apt) (hf:y.apt) (hg:x.l=y.l) (hk:x.q=y.q) :
avg (u x.l x.q) (fun j=>pr (pairW (s i.1 x j) (t i.2 y j)) (fun k=>a.soot x k.1 ≠
b.soot y k.2))≤ε := by
classical
let Z:=amends p x y
have hQ : Z.aspect false=y := amendsB _ _ hg hk
have hP : Z.aspect true=x := rfl
have hm : Z.common := by intro i;cases i; rw [hQ];exact hf; rw [hP];exact he
have hi:= h Z hm hx hy
unfold charge circlet pr couplePage at hi
rw [mixW_avg,hQ,hP] at hi
exact hi
set_option maxHeartbeats 800000 in
theorem paeans {β δ:ℝ} (hu:origami p r u δ)(hs:reports p r u s β δ)(ht:reports p r u t β δ)
(i:Grid) (A B:Finset (Label p.b)) (hx:A.card<Fintype.card (Label p.b))
(hy:B.card<Fintype.card (Label p.b)) (hg:3≤p.g)
(a : RhymeSet (d i.1)) (b : RhymeSet (e i.2)) (ε:ℝ) (he:0≤ε)
(h:counsel u s t i A B a b ε) :
∃ f:Pulsar p r, praise u s i.1 A a f (3*ε) ∧ praise u t i.2 B b f (3*ε) := by
classical
obtain ⟨x,hx⟩:=any_label A hx
obtain ⟨y,hy⟩:=any_label B hy
let Z:= amazes p y
let f l q j:= majority (t i.2 (Z l q) j) (b.soot (Z l q))
have hl:praise u s i.1 A a f (2*ε) := by
intro z hz hhq
let w:= Z z.l z.q
have ht' := generic_apt p hg w rfl
have hh := splitCounsel u s t i A B a b ε h z w hz hy hhq ht' rfl rfl
refine le_trans (avg_mono (hu.1 z.l z.q).nz (fun j=> majority_charge (s i.1 z j) (t i.2 w j)
(hs.law _ _ hhq _) (ht.law _ _ ht' _) (a.soot z) (b.soot w))) ?_
rw [avg_mul']
exact mul_le_mul_of_nonneg_left hh (by norm_num)
refine ⟨f,fun w hw hx=>(hl _ hw hx).trans (by linarith only [he]), fun w hw hv=>?_⟩
let z:=amazes p x w.l w.q
have hf : z.apt:=generic_apt _ hg _ rfl
have hx0:= splitCounsel u s t i A B a b ε h z w hx hw hf hv rfl rfl
have hl0:=hl z hx hf
let W:=u w.l w.q
have heq j:= reflect_cost (s i.1 z j) (t i.2 w j) (hs.law _ _ hf j) (ht.law _ _ hv j)
(a.soot z) (b.soot w) (f w.l w.q j)
apply (avg_mono (hu.1 w.l w.q).nz heq).trans
rw [avg_add]; exact (add_le_add hx0 hl0).trans_eq (by ring)
end DualAnalysis
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.FiniteOptionLabels
namespace OAI
/-! # Binary Status Comparison -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Matrix Filter Function Submodule Module LinearMapopen scoped BigOperatorsvariable {A B J H : Type} [Fintype A] [Fintype B] [Fintype J]
theorem disagreement_bound (w : Wgt A) (hw : ∀ x,0 ≤ w x) (f g h:A→ H) : pr w (fun i=> f i≠ h i) ≤ pr w (fun i=>f i≠ g i) + pr w (fun i=>g i≠h i) := let p (i:A) := f i≠g i∨g i≠h i ((pr_mono hw fun i h=>show p i from Classical.byContradiction (fun hi => h (Eq.trans (not_not.mp (mt Or.inl hi)) (not_not.mp (mt Or.inr hi))))).trans (pr_or_le hw))
def majority (w : Wgt A) (f : A→F) := if 1/2≤ pr w (fun i=>f i=0) then (0:F) else 1
theorem majority_bound (w : Wgt A) (hw:IsLaw w) (f : A→F) : 1/2 ≤ pr w (fun i=> f i= majority w f) := by classical unfold majority split next h => exact h next h => have hi i : f i=1 ↔ ¬f i=0 := ⟨fun hh=>by rw [hh]; exact one_ne_zero,fun hh=>(bit_cases _).resolve_left hh⟩ simp_rw [hi,pr_not,hw.total] exact le_of_lt (by linarith only [h])
theorem majority_charge (p:Wgt A) (q:Wgt B) (hp:IsLaw p) (hq:IsLaw q) (f:A→F) (g:B→F) : pr p (fun i=> f i≠majority q g)≤2 * pr (pairW p q) (fun i=> f i.1≠g i.2) := by classical let Q i:= g i=majority q g; let P i:= f i≠majority q g let v:= pairW p q have hm (z:A×B) (h:P z.1∧Q z.2): f z.1≠g z.2 := h.2 ▸ h.1 have hh : pr p P*pr q Q ≤ pr v (fun i=>f i.1≠g i.2) := (pairW_pr ..).symm.le.trans (pr_mono (pairW_law hp hq).nz hm) have hx:=majority_bound q hq g have hh' := mul_le_mul_of_nonneg_left hx (pr_nonneg (p:=P) hp.nz) change _* (1/2) ≤ _*pr q Q at hh' change pr p P≤2*pr v _ linarith only [hh,hh']
theorem reflect_cost (p:Wgt A) (q:Wgt B) (hp:IsLaw p) (hq:IsLaw q) (f:A→H) (g:B→H) (k:H) : pr q (fun i=>g i≠k)≤ pr (pairW p q) (fun i=>f i.1≠g i.2)+pr p (fun i=>f i≠k) := by let w:=pairW p q let t i:= g i≠k; let s i:= f i≠k have hi : pr q t=pr w (fun i=> t i.2) := by simpa [hp.total] using (pairW_pr p q (fun _=>True) t).symm have hj : pr p s=pr w (fun i=>s i.1) := by simpa [hq.total] using (pairW_pr p q s (fun _=>True)).symm let P (i:A×B):= f i.1 ≠ g i.2 rw [hi,hj] have hh (i:A×B) (h:t i.2): P i∨ s i.1 := by by_cases he:P i · exact Or.inl he exact Or.inr (fun hc=> h ((not_not.mp he).symm.trans hc)) exact (pr_mono (pairW_law hp hq).nz hh).trans (pr_or_le (pairW_law hp hq).nz)
namespace StatusAnalysisnamespace DualAnalysisvariable {p:Shape} {d e: Rates} {r K:ℕ}abbrev Pulsar (p:Shape) (r:ℕ):= Tag p.g → F → Fin r→Fvariable (u:Terrain p r) (s:Gazette p r d) (t:Gazette p r e)
def shot (i:Nodes) (x:Appearance p) (a:RhymeSet (d i)) (f:Pulsar p r) := avg (u x.l x.q) (fun j=>pr (s i x j) (fun v=> a.soot x v ≠f x.l x.q j))def praise (u:Terrain p r) (s:Gazette p r d) (i:Nodes) (A:Finset (Label p.b)) (a:RhymeSet (d i)) (f:Pulsar p r) (ε:ℝ) := ∀ x:Appearance p,x.s∉A →x.apt → shot u s i x a f≤εdef counsel (i:Grid) (A B:Finset (Label p.b)) (a : RhymeSet (d i.1)) (b : RhymeSet (e i.2)) (ε :ℝ) := ∀ x:Zodiac p,x.common → x.s true∉A →x.s false∉ B →charge u x s t i a b≤ε
def amazes (p:Shape) (z:Label p.b) (l: Tag p.g) (q:F):Appearance p:=⟨l,z,Flavor.full,q⟩def amends (p:Shape) (x y:Appearance p): Zodiac p := {l:=x.l q:=x.q s i:=if i then x.s else y.s f i:=if i then x.f else y.f}theorem amendsB (x y: Appearance p)(h:x.l=y.l)(ht:x.q=y.q): (amends p x y).aspect false=y := by cases x; cases y; simp_all [amends,Zodiac.aspect]
theorem splitCounsel (i:Grid) (A B:Finset (Label p.b)) (a : RhymeSet (d i.1)) (b : RhymeSet (e i.2)) (ε :ℝ) (h:counsel u s t i A B a b ε) (x y:Appearance p) (hx:x.s∉A) (hy:y.s∉B) (he:x.apt) (hf:y.apt) (hg:x.l=y.l) (hk:x.q=y.q) : avg (u x.l x.q) (fun j=>pr (pairW (s i.1 x j) (t i.2 y j)) (fun k=>a.soot x k.1 ≠ b.soot y k.2))≤ε := by classical let Z:=amends p x y have hQ : Z.aspect false=y := amendsB _ _ hg hk have hP : Z.aspect true=x := rfl have hm : Z.common := by intro i;cases i; rw [hQ];exact hf; rw [hP];exact he have hi:= h Z hm hx hy unfold charge circlet pr couplePage at hi rw [mixW_avg,hQ,hP] at hi exact hi
set_option maxHeartbeats 800000 intheorem paeans {β δ:ℝ} (hu:origami p r u δ)(hs:reports p r u s β δ)(ht:reports p r u t β δ) (i:Grid) (A B:Finset (Label p.b)) (hx:A.card<Fintype.card (Label p.b)) (hy:B.card<Fintype.card (Label p.b)) (hg:3≤p.g) (a : RhymeSet (d i.1)) (b : RhymeSet (e i.2)) (ε:ℝ) (he:0≤ε) (h:counsel u s t i A B a b ε) : ∃ f:Pulsar p r, praise u s i.1 A a f (3*ε) ∧ praise u t i.2 B b f (3*ε) := by classical obtain ⟨x,hx⟩:=any_label A hx obtain ⟨y,hy⟩:=any_label B hy let Z:= amazes p y let f l q j:= majority (t i.2 (Z l q) j) (b.soot (Z l q)) have hl:praise u s i.1 A a f (2*ε) := by intro z hz hhq let w:= Z z.l z.q have ht' := generic_apt p hg w rfl have hh := splitCounsel u s t i A B a b ε h z w hz hy hhq ht' rfl rfl refine le_trans (avg_mono (hu.1 z.l z.q).nz (fun j=> majority_charge (s i.1 z j) (t i.2 w j) (hs.law _ _ hhq _) (ht.law _ _ ht' _) (a.soot z) (b.soot w))) ?_ rw [avg_mul'] exact mul_le_mul_of_nonneg_left hh (by norm_num) refine ⟨f,fun w hw hx=>(hl _ hw hx).trans (by linarith only [he]), fun w hw hv=>?_⟩ let z:=amazes p x w.l w.q have hf : z.apt:=generic_apt _ hg _ rfl have hx0:= splitCounsel u s t i A B a b ε h z w hx hw hf hv rfl rfl have hl0:=hl z hx hf let W:=u w.l w.q have heq j:= reflect_cost (s i.1 z j) (t i.2 w j) (hs.law _ _ hf j) (ht.law _ _ hv j) (a.soot z) (b.soot w) (f w.l w.q j) apply (avg_mono (hu.1 w.l w.q).nz heq).trans rw [avg_add]; exact (add_le_add hx0 hl0).trans_eq (by ring)end DualAnalysisend StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151import OAI.Combinatorics.HadwigerCounterexample.MomentCoordinates
import OAI.Combinatorics.HadwigerCounterexample.MatrixFactorization
namespace OAI
/-! # Boolean Labels -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix Finset
variable {b : ℕ}
def monoBit (s : Label b) (S : Finset (Fin b)) := ∏ i ∈ S, s i
theorem mono_insert (s : Label b) (S : Finset (Fin b)) (i) :
monoBit s (insert i S) = s i * monoBit s S := by
by_cases h : i∈S
· rw [insert_eq_of_mem h]
unfold monoBit
rw [← Finset.mul_prod_erase _ _ h,← mul_assoc,bit_sq]
· simp [monoBit,h]
theorem mono_union (s : Label b) (S T : Finset (Fin b)) :
monoBit s (S∪T)= monoBit s S*monoBit s T := by
induction S using Finset.induction with
| empty => simp [monoBit]
| insert i S h ih =>
rw [insert_union,mono_insert,mono_insert,ih,mul_assoc]
/-- Independence up to degree j for at most j+1 labels, in coefficient form. -/
theorem selector_indep (L : Finset (Label b)) (c : Label b → F) (j : ℕ)
(h : L.card ≤ j+1) (hf : ∀ S : Finset (Fin b), S.card ≤ j →
∑ s ∈ L,c s*monoBit s S=0) : ∀ i∈L,c i=0 := by
classical
intro s hs
induction L using Finset.strongInductionOn generalizing c j with | _ L ih
by_cases hL : ∃ i∈L,i≠s
· obtain ⟨t,ht,hst⟩ := hL
obtain ⟨i,hi⟩ : ∃ i : Fin b,t i≠s i := Function.ne_iff.mp hst
let d (u : Label b) := (u i-t i) * c u
have hg : j>0 := by have he := Finset.one_lt_card.mpr ⟨t,ht,s,hs,hst⟩; omega
have he : (L.erase t).card ≤ (j-1)+1 := by
have he := card_erase_add_one ht; omega
have hw (U : Finset (Fin b)) (hu : U.card ≤ j-1) :
∑ s ∈ L.erase t,d s*monoBit s U=0 := by
have heq (s : Label b) :
d s * monoBit s U = c s * monoBit s (insert i U) - t i*(c s*monoBit s U) := by
unfold d; rw [mono_insert]; ring
rw [show ∑ s ∈ L.erase t,d s*monoBit s U = ∑ s ∈ L,d s*monoBit s U by
conv_rhs => rw [← Finset.add_sum_erase _ _ ht]
simp [d]]
simp_rw [heq, Finset.sum_sub_distrib,← Finset.mul_sum]
have hj : (insert i U).card ≤ j := by
by_cases hh : i∈U
· rw [insert_eq_of_mem hh]; omega
· rw [card_insert_of_notMem hh]; omega
rw [hf _ hj, hf _ (by omega),mul_zero,sub_zero]
have hu := ih (L.erase t) (erase_ssubset ht) d (j-1) he hw
(Finset.mem_erase.mpr ⟨hst.symm,hs⟩)
exact (mul_eq_zero.mp hu).resolve_left (sub_ne_zero.mpr hi.symm)
· have he : L={s} := by
ext x; constructor
· intro hx; exact mem_singleton.mpr (Classical.byContradiction fun h => hL ⟨x,hx,h⟩)
intro hx; rwa [mem_singleton.mp hx]
have hh := hf ∅ (by simp)
simpa [he,monoBit] using hh
variable {p : Shape} {n : ℕ}
def hankel (M : Moment p n) :=
∀ (i k : AIdx p.g n) (a b c d : SelIdx p.b p.j),
a.val ∪ b.val = c.val ∪ d.val → M (a,i) (b,k) = M (c,i) (d,k)
def diagBase (M : Moment p n) :=
∀ (i : AIdx p.g n) (a b : SelIdx p.b p.j), M (a,i) (b,i) = M (a,none) (b,i)
theorem point_eval (p : Shape) (s : Label p.b) (z : Base p.g n)
(r : SelIdx p.b p.j) (i : AIdx p.g n) : point p s z (r,i) = monoBit s r.val * baseV z i :=
rfl
theorem Wspace_hank {M : Moment p n} (h : M∈Wspace p n) : hankel M := by
intro i k a b c d hab
unfold Wspace at h
induction h using Submodule.span_induction with
| mem M hm =>
obtain ⟨s,z,rfl⟩ := hm
have h (a b : SelIdx p.b p.j) :
mom p s z (a,i) (b,k) = monoBit s (a.val ∪ b.val) * (baseV z i*baseV z k) := by
simp only [mom,vecMulVec_apply,point_eval,mono_union]; ring
rw [h,h,hab]
| zero => rfl
| add x y _ _ hx hy => simp only [Matrix.add_apply,hx,hy]
| smul v x _ hx => simp only [Matrix.smul_apply,hx]
theorem Wspace_diag {M : Moment p n} (h : M∈Wspace p n) : diagBase M := by
intro i a b
unfold Wspace at h
induction h using Submodule.span_induction with
| mem M hm =>
obtain ⟨s,z,rfl⟩ := hm
simp only [mom,vecMulVec_apply,point_eval,baseV]
rw [mul_mul_mul_comm,bit_sq]
have hn : Option.elim' (1:F) z none = 1 := rfl
rw [hn]
ring
| zero => rfl
| add x y _ _ hx hy => simp only [Matrix.add_apply,hx,hy]
| smul v x _ hx => simp only [Matrix.smul_apply,hx]
abbrev BaseMat (p : Shape) (n : ℕ) := Mat (AIdx p.g n) (AIdx p.g n)
def labMat (p : Shape) (n) (s : Label p.b) :
Mat (Row p n) (AIdx p.g n) :=
Matrix.of (fun v i => if v.2=i then monoBit s v.1.val else 0)
theorem labMat_act (s) (z : Vec (AIdx p.g n)) :
labMat p n s *ᵥ z = putLab p n s z := by
funext i
simp [Matrix.mulVec,dotProduct,labMat,putLab,monoBit,selV]
def mput (p : Shape) (s : Label p.b) {n} :
BaseMat p n →ₗ[F] Moment p n := liftM (labMat p n s) (labMat p n s)
theorem mput_apply (s) (Z : BaseMat p n) (i j) : mput p s Z i j =
monoBit s i.1.val*monoBit s j.1.val*Z i.2 j.2 := by
classical
simp [mput,liftM_def,Matrix.mul_apply,transpose_apply,labMat, mul_comm,mul_left_comm,mul_assoc]
theorem mput_hank (s) (Z : BaseMat p n) : hankel (mput p s Z) := by
intro i j a b c d h
rw [mput_apply,mput_apply]
simp_rw [← mono_union,h]
/-- Short label-tagged rays give a direct family of copies of the affine-vector space. -/
theorem ray_indep (L : Finset (Label p.b)) (Z : Label p.b → Vec (AIdx p.g n))
(hj : L.card ≤ p.j+1) (he : ∑ i∈L, putLab p n i (Z i) = 0) :
∀ i∈L, Z i=0 := by
have hg (u : AIdx p.g n) (i : Label p.b) (hi : i ∈ L) :
Z i u=0 := by
refine selector_indep L (fun i => Z i u) p.j hj ?_ i hi
intro S hS
have hh := congr_fun he ((⟨S,hS⟩ : SelIdx p.b p.j),u)
simpa [putLab,Finset.sum_apply,monoBit,selV,mul_comm] using hh
exact fun i hi => funext (fun u => hg u i hi)
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.MomentCoordinatesimport OAI.Combinatorics.HadwigerCounterexample.MatrixFactorization
namespace OAI
/-! # Boolean Labels -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperatorsopen Matrix Finsetvariable {b : ℕ}
def monoBit (s : Label b) (S : Finset (Fin b)) := ∏ i ∈ S, s i
theorem mono_insert (s : Label b) (S : Finset (Fin b)) (i) : monoBit s (insert i S) = s i * monoBit s S := by by_cases h : i∈S · rw [insert_eq_of_mem h] unfold monoBit rw [← Finset.mul_prod_erase _ _ h,← mul_assoc,bit_sq] · simp [monoBit,h]
theorem mono_union (s : Label b) (S T : Finset (Fin b)) : monoBit s (S∪T)= monoBit s S*monoBit s T := by induction S using Finset.induction with | empty => simp [monoBit] | insert i S h ih => rw [insert_union,mono_insert,mono_insert,ih,mul_assoc]
/-- Independence up to degree j for at most j+1 labels, in coefficient form. -/theorem selector_indep (L : Finset (Label b)) (c : Label b → F) (j : ℕ) (h : L.card ≤ j+1) (hf : ∀ S : Finset (Fin b), S.card ≤ j → ∑ s ∈ L,c s*monoBit s S=0) : ∀ i∈L,c i=0 := by classical intro s hs induction L using Finset.strongInductionOn generalizing c j with | _ L ih by_cases hL : ∃ i∈L,i≠s · obtain ⟨t,ht,hst⟩ := hL obtain ⟨i,hi⟩ : ∃ i : Fin b,t i≠s i := Function.ne_iff.mp hst let d (u : Label b) := (u i-t i) * c u have hg : j>0 := by have he := Finset.one_lt_card.mpr ⟨t,ht,s,hs,hst⟩; omega have he : (L.erase t).card ≤ (j-1)+1 := by have he := card_erase_add_one ht; omega have hw (U : Finset (Fin b)) (hu : U.card ≤ j-1) : ∑ s ∈ L.erase t,d s*monoBit s U=0 := by have heq (s : Label b) : d s * monoBit s U = c s * monoBit s (insert i U) - t i*(c s*monoBit s U) := by unfold d; rw [mono_insert]; ring rw [show ∑ s ∈ L.erase t,d s*monoBit s U = ∑ s ∈ L,d s*monoBit s U by conv_rhs => rw [← Finset.add_sum_erase _ _ ht] simp [d]] simp_rw [heq, Finset.sum_sub_distrib,← Finset.mul_sum] have hj : (insert i U).card ≤ j := by by_cases hh : i∈U · rw [insert_eq_of_mem hh]; omega · rw [card_insert_of_notMem hh]; omega rw [hf _ hj, hf _ (by omega),mul_zero,sub_zero] have hu := ih (L.erase t) (erase_ssubset ht) d (j-1) he hw (Finset.mem_erase.mpr ⟨hst.symm,hs⟩) exact (mul_eq_zero.mp hu).resolve_left (sub_ne_zero.mpr hi.symm) · have he : L={s} := by ext x; constructor · intro hx; exact mem_singleton.mpr (Classical.byContradiction fun h => hL ⟨x,hx,h⟩) intro hx; rwa [mem_singleton.mp hx] have hh := hf ∅ (by simp) simpa [he,monoBit] using hh
variable {p : Shape} {n : ℕ}
def hankel (M : Moment p n) := ∀ (i k : AIdx p.g n) (a b c d : SelIdx p.b p.j), a.val ∪ b.val = c.val ∪ d.val → M (a,i) (b,k) = M (c,i) (d,k)
def diagBase (M : Moment p n) := ∀ (i : AIdx p.g n) (a b : SelIdx p.b p.j), M (a,i) (b,i) = M (a,none) (b,i)
theorem point_eval (p : Shape) (s : Label p.b) (z : Base p.g n) (r : SelIdx p.b p.j) (i : AIdx p.g n) : point p s z (r,i) = monoBit s r.val * baseV z i := rfl
theorem Wspace_hank {M : Moment p n} (h : M∈Wspace p n) : hankel M := by intro i k a b c d hab unfold Wspace at h induction h using Submodule.span_induction with | mem M hm => obtain ⟨s,z,rfl⟩ := hm have h (a b : SelIdx p.b p.j) : mom p s z (a,i) (b,k) = monoBit s (a.val ∪ b.val) * (baseV z i*baseV z k) := by simp only [mom,vecMulVec_apply,point_eval,mono_union]; ring rw [h,h,hab] | zero => rfl | add x y _ _ hx hy => simp only [Matrix.add_apply,hx,hy] | smul v x _ hx => simp only [Matrix.smul_apply,hx]
theorem Wspace_diag {M : Moment p n} (h : M∈Wspace p n) : diagBase M := by intro i a b unfold Wspace at h induction h using Submodule.span_induction with | mem M hm => obtain ⟨s,z,rfl⟩ := hm simp only [mom,vecMulVec_apply,point_eval,baseV] rw [mul_mul_mul_comm,bit_sq] have hn : Option.elim' (1:F) z none = 1 := rfl rw [hn] ring | zero => rfl | add x y _ _ hx hy => simp only [Matrix.add_apply,hx,hy] | smul v x _ hx => simp only [Matrix.smul_apply,hx]
abbrev BaseMat (p : Shape) (n : ℕ) := Mat (AIdx p.g n) (AIdx p.g n)
def labMat (p : Shape) (n) (s : Label p.b) : Mat (Row p n) (AIdx p.g n) := Matrix.of (fun v i => if v.2=i then monoBit s v.1.val else 0)
theorem labMat_act (s) (z : Vec (AIdx p.g n)) : labMat p n s *ᵥ z = putLab p n s z := by funext i simp [Matrix.mulVec,dotProduct,labMat,putLab,monoBit,selV]
def mput (p : Shape) (s : Label p.b) {n} : BaseMat p n →ₗ[F] Moment p n := liftM (labMat p n s) (labMat p n s)
theorem mput_apply (s) (Z : BaseMat p n) (i j) : mput p s Z i j = monoBit s i.1.val*monoBit s j.1.val*Z i.2 j.2 := by classical simp [mput,liftM_def,Matrix.mul_apply,transpose_apply,labMat, mul_comm,mul_left_comm,mul_assoc]
theorem mput_hank (s) (Z : BaseMat p n) : hankel (mput p s Z) := by intro i j a b c d h rw [mput_apply,mput_apply] simp_rw [← mono_union,h]
/-- Short label-tagged rays give a direct family of copies of the affine-vector space. -/theorem ray_indep (L : Finset (Label p.b)) (Z : Label p.b → Vec (AIdx p.g n)) (hj : L.card ≤ p.j+1) (he : ∑ i∈L, putLab p n i (Z i) = 0) : ∀ i∈L, Z i=0 := by have hg (u : AIdx p.g n) (i : Label p.b) (hi : i ∈ L) : Z i u=0 := by refine selector_indep L (fun i => Z i u) p.j hj ?_ i hi intro S hS have hh := congr_fun he ((⟨S,hS⟩ : SelIdx p.b p.j),u) simpa [putLab,Finset.sum_apply,monoBit,selV,mul_comm] using hh exact fun i hi => funext (fun u => hg u i hi)
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134import OAI.Combinatorics.HadwigerCounterexample.IndependentColumnBatches
import OAI.Combinatorics.HadwigerCounterexample.CollisionInequality
namespace OAI
/-! # Bounded Query Templates -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix Module LinearMap Function
variable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
structure Template (p : Shape) (I : Type) where
aim : I→Bool
t : Tagging p I
s : I→Label p.b
f : I→Flavor p.g
abbrev Inputs (p : Shape) (n : ℕ) (I : Type) := I → Knobs p.g n
namespace Template
variable (v : Template p I)
def draw (y : Inputs p n I) : Volley p n I where
obj := v.aim
sel := v.s
par i := lit (v.f i) (v.t i) (y i)
def state (q : I→F) (n : ℕ) : Wgt (Inputs p n I) :=
prodW (fun i : I => scopedBit p n (v.t i) (v.f i) (q i))
omit [Fintype I] [DecidableEq I] in
theorem draw_legal (y : Inputs p n I) : (v.draw y).legal v.t :=
fun _ => lit_allows _ _ _
end Template
abbrev KeySlots (p : Shape) (t : Tagging p I) := Σ i, TagStar (t i)
def scatter (t : Tagging p I) (N : ℕ) : Keys (p:=p) t N ≃ Rack (KeySlots p t) N where
toFun x := (Matrix.of (fun j i => x i.1 i.2 true j),Matrix.of (fun j i => x i.1 i.2 false j))
invFun x := fun i j b => if b then x.1.col ⟨i,j⟩ else x.2.col ⟨i,j⟩
left_inv x := by funext i j b; cases b <;> rfl
right_inv x := by apply Prod.ext <;> rfl
def globPort (p : Shape) (t : Tagging p I) (q : I→Bool) :
Route (KeySlots p t) (Ports p) :=
fun x => (q x.1,x.2.val)
def nomAsk (t : Tagging p I) (v : Volley p n I) :
NomQuery p n (globPort p t v.obj) :=
fun _ => Matrix.of (fun i j => v.rayAt j.val.1 i)
omit [Fintype I] [DecidableEq I] in
theorem peek_keys (t : Tagging p I) (v : Volley p n I) (x : UnitType p n N) :
peekR p (globPort p t v.obj) (nomAsk t v) (nomAsk t v) (mergeR p x) =
scatter t N (v.keys t x) := by
apply Prod.ext
· ext i j; rfl
· ext i j; rfl
theorem raw_keys (t : Tagging p I) (v : Volley p n I) (m : Mixer p n) {N : ℕ}
(hN : 2*num (Full p n)<N) (ha : ∀ i, Injective (nomAsk t v i).mulVec) :
let r := raw m N
mapW (pairW r r) ((scatter t N) ∘ v.keys t) = rackStation (database m (nomAsk t v) (nomAsk t v)) N := by
classical
let g := globPort p t v.obj
let A := nomAsk t v
have hh := law_peekR m hN ha ha
rw [← law_mergeR m N, mapW_nested] at hh
refine Eq.trans ?_ hh
congr 1
def ownPort (t : Tagging p I) : Route (KeySlots p t) (Comp p.g) := fun x => x.2.val
def ownMap (t : Tagging p I) (q : I→F) : GeoM (ownPort (p:=p) t) :=
fun _ => Matrix.diagonal (fun i => q i.val.1)
def ownPart (t : Tagging p I) (q : I→F) {N : ℕ}
(x : Keys (p:=p) t N) :=
gramPart (ownMap (p:=p) t q) (scatter t N x)
def lawNu (p : Shape) (N : ℕ) (t : Tagging p I) (q : I→F) :
Wgt (Keys (p:=p) t N) := unifOn (ownPart (p:=p) t q)
theorem lawNu_rack (t : Tagging p I) (q : I→F) :
mapW (lawNu p N t q) (scatter t N) = rackWave (ownMap t q) N :=
on_equiv ..
def ownOne (p : Shape) {N : ℕ} (l : Tag p.g) (q : F) (x : AtomKey (p:=p) l N) :=
∀ i,dotProduct (x i true) (x i false) = q
def lawOmega (p : Shape) (N : ℕ) (l : Tag p.g) (q : F) :
Wgt (AtomKey (p:=p) l N) := unifOn (ownOne p l q)
omit [Fintype I] in
theorem ownPart_def (t : Tagging p I) (q : I→F) {N : ℕ} (x : Keys (p:=p) t N) :
ownPart (p:=p) t q x ↔
(∀ i, ownOne p (t i) (q i) (x i)) ∧
∀ (i j : I) (e : Comp p.g) (hi : inc e (t i)) (hj : inc e (t j)), i≠j →
dotProduct (x i ⟨e,hi⟩ true) (x j ⟨e,hj⟩ false)=0 := by
classical
let Q := ownPort (p:=p) t
unfold ownPart
rw [part_scores]
have he i j (e : Comp p.g) (hi : inc e (t i)) (hj : inc e (t j)) :
let a : Port Q e := ⟨⟨i,⟨e,hi⟩⟩,rfl⟩
let b : Port Q e := ⟨⟨j,⟨e,hj⟩⟩,rfl⟩
scoreR (scatter t N x) a b=dotProduct (x i ⟨e,hi⟩ true) (x j ⟨e,hj⟩ false) := rfl
constructor
· intro h
constructor
· rintro i ⟨e,hi⟩
let a : Port Q e := ⟨⟨i,⟨e,hi⟩⟩,rfl⟩
exact (he i i e hi hi).symm.trans ((h e a a).trans (Matrix.diagonal_apply_eq ..))
intro i j e hi hj heq
let a : Port Q e := ⟨⟨i,⟨e,hi⟩⟩,rfl⟩
let b : Port Q e := ⟨⟨j,⟨e,hj⟩⟩,rfl⟩
have hh : a≠b := fun h => heq (congrArg (fun x:Port Q e => x.val.1) h)
exact (he i j e hi hj).symm.trans ((h e a b).trans (Matrix.diagonal_apply_ne _ hh))
· rintro ⟨h,h'⟩ e ⟨⟨i,v⟩,ha⟩ ⟨⟨j,w⟩,hb⟩
rcases v with ⟨v,hv⟩; rcases w with ⟨w,hw⟩
change v = e at ha; change w=e at hb
subst v; subst w
let a : Port Q e := ⟨⟨i,⟨e,hv⟩⟩,rfl⟩
let b : Port Q e := ⟨⟨j,⟨e,hw⟩⟩,rfl⟩
by_cases he : i=j
· subst j
refine (show scoreR (scatter t N x) a.val a.val=_ from h i ��e,hv⟩).trans ?_
exact (Matrix.diagonal_apply_eq (fun j : Port Q e => q j.val.1) a).symm
have hh : a≠b := fun h => he (congrArg (fun x:Port Q e => x.val.1) h)
refine Eq.trans (h' i j e hv hw he) ?_
exact (Matrix.diagonal_apply_ne (fun j : Port Q e => q j.val.1) hh).symm
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.IndependentColumnBatchesimport OAI.Combinatorics.HadwigerCounterexample.CollisionInequality
namespace OAI
/-! # Bounded Query Templates -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperatorsopen Matrix Module LinearMap Functionvariable {p : Shape} {n N : ℕ} {I : Type} [Fintype I] [DecidableEq I]
structure Template (p : Shape) (I : Type) where aim : I→Bool t : Tagging p I s : I→Label p.b f : I→Flavor p.g
abbrev Inputs (p : Shape) (n : ℕ) (I : Type) := I → Knobs p.g n
namespace Templatevariable (v : Template p I)
def draw (y : Inputs p n I) : Volley p n I where obj := v.aim sel := v.s par i := lit (v.f i) (v.t i) (y i)
def state (q : I→F) (n : ℕ) : Wgt (Inputs p n I) := prodW (fun i : I => scopedBit p n (v.t i) (v.f i) (q i))omit [Fintype I] [DecidableEq I] intheorem draw_legal (y : Inputs p n I) : (v.draw y).legal v.t := fun _ => lit_allows _ _ _end Template
abbrev KeySlots (p : Shape) (t : Tagging p I) := Σ i, TagStar (t i)
def scatter (t : Tagging p I) (N : ℕ) : Keys (p:=p) t N ≃ Rack (KeySlots p t) N where toFun x := (Matrix.of (fun j i => x i.1 i.2 true j),Matrix.of (fun j i => x i.1 i.2 false j)) invFun x := fun i j b => if b then x.1.col ⟨i,j⟩ else x.2.col ⟨i,j⟩ left_inv x := by funext i j b; cases b <;> rfl right_inv x := by apply Prod.ext <;> rfl
def globPort (p : Shape) (t : Tagging p I) (q : I→Bool) : Route (KeySlots p t) (Ports p) := fun x => (q x.1,x.2.val)
def nomAsk (t : Tagging p I) (v : Volley p n I) : NomQuery p n (globPort p t v.obj) := fun _ => Matrix.of (fun i j => v.rayAt j.val.1 i)
omit [Fintype I] [DecidableEq I] intheorem peek_keys (t : Tagging p I) (v : Volley p n I) (x : UnitType p n N) : peekR p (globPort p t v.obj) (nomAsk t v) (nomAsk t v) (mergeR p x) = scatter t N (v.keys t x) := by apply Prod.ext · ext i j; rfl · ext i j; rfl
theorem raw_keys (t : Tagging p I) (v : Volley p n I) (m : Mixer p n) {N : ℕ} (hN : 2*num (Full p n)<N) (ha : ∀ i, Injective (nomAsk t v i).mulVec) : let r := raw m N mapW (pairW r r) ((scatter t N) ∘ v.keys t) = rackStation (database m (nomAsk t v) (nomAsk t v)) N := by classical let g := globPort p t v.obj let A := nomAsk t v have hh := law_peekR m hN ha ha rw [← law_mergeR m N, mapW_nested] at hh refine Eq.trans ?_ hh congr 1
def ownPort (t : Tagging p I) : Route (KeySlots p t) (Comp p.g) := fun x => x.2.valdef ownMap (t : Tagging p I) (q : I→F) : GeoM (ownPort (p:=p) t) := fun _ => Matrix.diagonal (fun i => q i.val.1)def ownPart (t : Tagging p I) (q : I→F) {N : ℕ} (x : Keys (p:=p) t N) := gramPart (ownMap (p:=p) t q) (scatter t N x)def lawNu (p : Shape) (N : ℕ) (t : Tagging p I) (q : I→F) : Wgt (Keys (p:=p) t N) := unifOn (ownPart (p:=p) t q)
theorem lawNu_rack (t : Tagging p I) (q : I→F) : mapW (lawNu p N t q) (scatter t N) = rackWave (ownMap t q) N := on_equiv ..
def ownOne (p : Shape) {N : ℕ} (l : Tag p.g) (q : F) (x : AtomKey (p:=p) l N) := ∀ i,dotProduct (x i true) (x i false) = qdef lawOmega (p : Shape) (N : ℕ) (l : Tag p.g) (q : F) : Wgt (AtomKey (p:=p) l N) := unifOn (ownOne p l q)
omit [Fintype I] intheorem ownPart_def (t : Tagging p I) (q : I→F) {N : ℕ} (x : Keys (p:=p) t N) : ownPart (p:=p) t q x ↔ (∀ i, ownOne p (t i) (q i) (x i)) ∧ ∀ (i j : I) (e : Comp p.g) (hi : inc e (t i)) (hj : inc e (t j)), i≠j → dotProduct (x i ⟨e,hi⟩ true) (x j ⟨e,hj⟩ false)=0 := by classical let Q := ownPort (p:=p) t unfold ownPart rw [part_scores] have he i j (e : Comp p.g) (hi : inc e (t i)) (hj : inc e (t j)) : let a : Port Q e := ⟨⟨i,⟨e,hi⟩⟩,rfl⟩ let b : Port Q e := ⟨⟨j,⟨e,hj⟩⟩,rfl⟩ scoreR (scatter t N x) a b=dotProduct (x i ⟨e,hi⟩ true) (x j ⟨e,hj⟩ false) := rfl constructor · intro h constructor · rintro i ⟨e,hi⟩ let a : Port Q e := ⟨⟨i,⟨e,hi⟩⟩,rfl⟩ exact (he i i e hi hi).symm.trans ((h e a a).trans (Matrix.diagonal_apply_eq ..)) intro i j e hi hj heq let a : Port Q e := ⟨⟨i,⟨e,hi⟩⟩,rfl⟩ let b : Port Q e := ⟨⟨j,⟨e,hj⟩⟩,rfl⟩ have hh : a≠b := fun h => heq (congrArg (fun x:Port Q e => x.val.1) h) exact (he i j e hi hj).symm.trans ((h e a b).trans (Matrix.diagonal_apply_ne _ hh)) · rintro ⟨h,h'⟩ e ⟨⟨i,v⟩,ha⟩ ⟨⟨j,w⟩,hb⟩ rcases v with ⟨v,hv⟩; rcases w with ⟨w,hw⟩ change v = e at ha; change w=e at hb subst v; subst w let a : Port Q e := ⟨⟨i,⟨e,hv⟩⟩,rfl⟩ let b : Port Q e := ⟨⟨j,⟨e,hw⟩⟩,rfl⟩ by_cases he : i=j · subst j refine (show scoreR (scatter t N x) a.val a.val=_ from h i ⟨e,hv⟩).trans ?_ exact (Matrix.diagonal_apply_eq (fun j : Port Q e => q j.val.1) a).symm have hh : a≠b := fun h => he (congrArg (fun x:Port Q e => x.val.1) h) refine Eq.trans (h' i j e hv hw he) ?_ exact (Matrix.diagonal_apply_ne (fun j : Port Q e => q j.val.1) hh).symm
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177import OAI.Combinatorics.HadwigerCounterexample.SurrogateStatusLaws
namespace OAI
/-! # Cell Positivity Scales -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Matrix Function
open scoped BigOperators Topology
variable {p:Shape} {n N K M r : ℕ}
namespace StatusAnalysis
open Template
variable {b : PreparationParameters}
namespace Appearance
variable (x : Appearance p) {s0 : ℕ}
theorem readCap (x : Appearance p) (r M : ℕ) (h : AnalyticParameters p M b s0)
(ε : ℝ) (hε : 0<ε) :
∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,2*num (Full p n)<(N:ℝ) →
∀ Y : Silhouette p N r,pr (raw m N) (fun o=> x.apt∧¬ x.close Y o ε)≤bp (-(1/16:ℝ)*n) := by
classical
have hp:=h.enter.first
by_cases ha : x.apt
· let δ : ℝ := ε/(r+1:ℝ)
have hδ : 0<δ:=by unfold δ; positivity
filter_upwards [flat_recital x.trot M hp.hM hp.hJ δ hδ,eventually_ge_atTop (2*p.r),
pay_nat (a:=1/8) (b:=1/16) (num (Fin r)) (by norm_num)] with n hn ht hB N m hN Y
let w:= x.wit n; let v:= raw m N
have hw : IsLaw w:= witLaw ha hp.hR ht
let P (i : Fin r) (o : Orient p n N):=
δ≤ |x.empirical Y o i - x.reference Y i|
have hk (i : Fin r) : pr v (P i) ≤ bp (-(1/8:ℝ)*n) := by
let S (z) := ind (Y x.l x.q z=i)
have hf z : |S z|≤1 := by unfold S; rw [abs_of_nonneg (ind_nonneg _)]; exact ind_le_one _
refine hn m w x.q hw (normW_carried (subW_carried _ _))
(scopedZ_bit p n _ _ _ hw) hN S hf
have he (o : Orient p n N) (h : x.apt∧¬x.close Y o ε) : ∃ i,P i o := by
by_contra! hh
apply h.2
unfold close varOne
calc _ ≤ ∑ i : Fin r,δ:= Finset.sum_le_sum fun i _=>le_trans (abs_sub_comm ..).le
(le_of_not_ge (hh i))
_ ≤ ε := by
simp; unfold δ
calc _ ≤ ((r:ℝ)+1)* (ε/(r+1:ℝ)) := mul_le_mul_of_nonneg_right (by linarith) hδ.le
_ = ε := by field_simp
have hv : IsLaw v:= raw_law m hN
exact ((pr_mono hv.nz he).trans (pr_exists_le hv.nz P)).trans
(((Finset.sum_le_sum fun i _=>hk i).trans_eq (by simp [num])).trans hB)
filter_upwards with n N m hN Y
simp_rw [show (x.apt)=False from eq_false ha,false_and,pr_false]; exact (bp_pos _).le
def foil (x : Appearance p) (Y : Silhouette p N r) (o : Orient p n N)
(m : Mixer p n) (K : ℕ) (δ : ℝ) :=
∀ (z:Digest p.g) (i:Fin r), z.feasible x.l x.f → z.sumBit=x.q →
δ ≤ x.reference Y i → Template.patrol x.trot m (scopedScan p n x.l x.f z)
(fun y => Y x.l x.q y=i) K x.q o
theorem foilCap (x : Appearance p) (r M : ℕ) (h : AnalyticParameters p M b s0)
(δ:ℝ) (hδ:0<δ) :
∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,2*num (Full p n)<(N:ℝ) →
unaryGood m b.pins s0 → ∀ Y: Silhouette p N r,
pr (raw m N) (fun i=>¬x.foil Y i m b.pins δ)≤bp (-(1/18:ℝ)*n) := by
classical
have ht:=h.enter.first
let A:= Digest p.g × Fin r
let Q n (m:Mixer p n) (Y:Silhouette p (M*n) r) (a : A) (o : Orient p n (M*n)) :=
a.1.feasible x.l x.f ∧ a.1.sumBit=x.q ∧ δ≤x.reference Y a.2 ∧
¬Template.patrol x.trot m (scopedScan p n x.l x.f a.1)
(fun y=>Y x.l x.q y=a.2) b.pins x.q o
have hg (a:A) :
∀ᶠ n:ℕ in atTop,let N:=M*n;∀ m:Mixer p n,2*num (Full p n)<(N:ℝ) →
unaryGood m b.pins s0→∀ Y:Silhouette p N r,
pr (raw m N) (Q n m Y a) ≤ bp (-(1/16:ℝ)*n) := by
by_cases hf : a.1.feasible x.l x.f ∧ a.1.sumBit=x.q
· filter_upwards [patrolled x.trot M ht.hM ht.hg ht.hJ a.1 hf.1 ht.hR δ hδ h.profiles
h.gleaming] with n hn N m hN hM Y
by_cases he : δ ≤ x.reference Y a.2
· let S : AtomKey (p:=p) (x.trot.t ()) (M*n) →Prop := fun i=>Y x.l x.q i=a.2
let v:=scopedScan p n (x.trot.t ()) (x.trot.f ()) a.1
have hx : δ ≤ pr (lawOmega p (M*n) (x.trot.t ()) a.1.sumBit) S := by
rw [hf.2]; exact he
have hh (i:Orient p n (M*n)) (h:Q n m Y a i) :
¬Template.patrol x.trot m v S b.pins a.1.sumBit i := hf.2 ▸ h.2.2.2
exact (pr_mono (raw_law m hN).nz hh).trans (hn m hM hN S hx)
have hg : Q n m Y a=fun _=> False :=
funext fun i=> eq_false (fun h=>he h.2.2.1)
change pr (raw m (M*n)) (Q n m Y a) ≤ _
rw [hg,pr_false]; exact (bp_pos _).le
filter_upwards with n N m hN hg Y
have hh : Q n m Y a=fun _=> False :=
funext fun i=> eq_false (fun h=> hf ⟨h.1,h.2.1⟩)
change pr (raw m (M*n)) (Q n m Y a) ≤ _
rw [hh,pr_false]; exact (bp_pos _).le
filter_upwards [eventually_all.mpr hg,pay_nat (a:=1/16) (b:=1/18) (num A) (by norm_num)]
with n hn hB N m hN hM Y
have he o (h : ¬x.foil Y o m b.pins δ) : ∃ i, Q n m Y i o := by
unfold foil at h
push Not at h
obtain ⟨z,i,h⟩:=h
exact ⟨(z,i),h⟩
let v:=raw m N
have hv : IsLaw v:=raw_law m hN
exact ((pr_mono hv.nz he).trans (pr_exists_le hv.nz _)).trans
(((Finset.sum_le_sum fun i _=>hn i m hN hM Y).trans_eq (by simp [num])).trans hB)
end Appearance
def smoothSilk (p : Shape) (ε δ:ℝ) (Y:Silhouette p N r)
(m:Mixer p n) (K:ℕ) (o:Orient p n N) :=
∀ x : Appearance p,(x.apt → x.close Y o ε) ∧ x.foil Y o m K δ
variable {s0 : ℕ}
def gauze (p : Shape) (ε δ:ℝ) (Y:Silhouette p N r)
(m:Mixer p n) (K:ℕ) (o:UnitType p n N) :=
∀ i,smoothSilk p ε δ Y m K (onSide o i)
private theorem silken (p : Shape) (r M : ℕ) (h : AnalyticParameters p M b s0)
(ε δ : ℝ) (he:0<ε) (hd:0<δ) :
∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,2*num (Full p n)<(N:ℝ) →
unaryGood m b.pins s0 → ∀ Y: Silhouette p N r,
pr (raw m N) (fun i=>¬smoothSilk p ε δ Y m b.pins i)≤bp (-(1/20:ℝ)*n) := by
classical
let A:= Appearance p
filter_upwards [eventually_all.mpr (fun x:A=>x.foilCap r M h δ hd),
eventually_all.mpr (fun x:A=>x.readCap r M h ε he),
pay_nat (a:=1/18) (b:=1/20) (num A*2) (by norm_num)] with n hn ht hB N m hN hM Y
let v:=raw m N
have hv : IsLaw v:=raw_law m hN
let P (x:A) (o:Orient p n N) :=
(x.apt ∧ ¬x.close Y o ε)∨ ¬x.foil Y o m b.pins δ
have hk x : pr v (P x) ≤ 2*bp (-(1/18:ℝ)*n) := by
rw [two_mul]; apply (pr_or_le hv.nz).trans
refine add_le_add ((ht x m hN Y).trans (bp_le ?_)) (hn x m hN hM Y)
linarith [(Nat.cast_nonneg n :0≤(n:ℝ))]
have hi o (h : ¬smoothSilk p ε δ Y m b.pins o) : ∃ i, P i o := by
unfold smoothSilk at h
obtain ⟨i,h⟩:= Classical.not_forall.mp h
exact ⟨i,by unfold P; tauto⟩
refine ((pr_mono hv.nz hi).trans (pr_exists_le hv.nz _)).trans
(((Finset.sum_le_sum fun i _=>hk i).trans_eq ?_).trans hB)
simp [num,mul_assoc]
theorem gauzeCalendar (p : Shape) (r M : ℕ) (h : AnalyticParameters p M b s0)
(ε δ:ℝ) (he:0<ε) (hd:0<δ) :
∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,∀ u : Wgt (UnitType p n N),
PreparationParameters.Align b s0 p M n m u → ∀ Y: Silhouette p N r,
pr u (fun i=>¬gauze p ε δ Y m b.pins i)≤bp (-(1/100:ℝ)*n) := by
classical
filter_upwards [silken p r M h ε δ he hd,pay_nat (a:=1/20-1/32) (b:=1/100) 2
(by norm_num)] with n hn ht N m u hu Y
let P (o:Orient p n N) := ¬smoothSilk p ε δ Y m b.pins o
let Q (i:Bool) (o:UnitType p n N):=P (onSide o i)
have hc : bySide p u m (bp ((1/32:ℝ)*n)) := fun i=> by
have hh:= hu.drain
cases i; exact hh.2.2.1; exact hh.2.1
have hf : ∀ i,pr u (Q i) ≤bp (-((1/20:ℝ)-1/32)*n) := by
intro i
let x := fun o:UnitType p n N=>onSide o i
change pr u (fun i=>P (x i)) ≤_
rw [←mapW_pr]
exact (pr_cap (hc i) P).trans ((mul_le_mul_of_nonneg_left
(hn m hu.cols hu.hymn Y) (bp_pos _).le).trans_eq (by rw [←bp_add]; congr 1; ring))
have he o (h : ¬gauze p ε δ Y m b.pins o) : ∃ i,Q i o := Classical.not_forall.mp h
have hv : IsLaw u:=hu.drain.1
rw [two_mul] at ht
refine ((pr_mono hv.nz he).trans ((pr_exists_le hv.nz _).trans ?_))
rw [Fintype.sum_bool]; exact (add_le_add (hf _) (hf _)).trans ht
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.SurrogateStatusLaws
namespace OAI
/-! # Cell Positivity Scales -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Matrix Functionopen scoped BigOperators Topologyvariable {p:Shape} {n N K M r : ℕ}namespace StatusAnalysisopen Templatevariable {b : PreparationParameters}
namespace Appearancevariable (x : Appearance p) {s0 : ℕ}
theorem readCap (x : Appearance p) (r M : ℕ) (h : AnalyticParameters p M b s0) (ε : ℝ) (hε : 0<ε) : ∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,2*num (Full p n)<(N:ℝ) → ∀ Y : Silhouette p N r,pr (raw m N) (fun o=> x.apt∧¬ x.close Y o ε)≤bp (-(1/16:ℝ)*n) := by classical have hp:=h.enter.first by_cases ha : x.apt · let δ : ℝ := ε/(r+1:ℝ) have hδ : 0<δ:=by unfold δ; positivity filter_upwards [flat_recital x.trot M hp.hM hp.hJ δ hδ,eventually_ge_atTop (2*p.r), pay_nat (a:=1/8) (b:=1/16) (num (Fin r)) (by norm_num)] with n hn ht hB N m hN Y let w:= x.wit n; let v:= raw m N have hw : IsLaw w:= witLaw ha hp.hR ht let P (i : Fin r) (o : Orient p n N):= δ≤ |x.empirical Y o i - x.reference Y i| have hk (i : Fin r) : pr v (P i) ≤ bp (-(1/8:ℝ)*n) := by let S (z) := ind (Y x.l x.q z=i) have hf z : |S z|≤1 := by unfold S; rw [abs_of_nonneg (ind_nonneg _)]; exact ind_le_one _ refine hn m w x.q hw (normW_carried (subW_carried _ _)) (scopedZ_bit p n _ _ _ hw) hN S hf have he (o : Orient p n N) (h : x.apt∧¬x.close Y o ε) : ∃ i,P i o := by by_contra! hh apply h.2 unfold close varOne calc _ ≤ ∑ i : Fin r,δ:= Finset.sum_le_sum fun i _=>le_trans (abs_sub_comm ..).le (le_of_not_ge (hh i)) _ ≤ ε := by simp; unfold δ calc _ ≤ ((r:ℝ)+1)* (ε/(r+1:ℝ)) := mul_le_mul_of_nonneg_right (by linarith) hδ.le _ = ε := by field_simp have hv : IsLaw v:= raw_law m hN exact ((pr_mono hv.nz he).trans (pr_exists_le hv.nz P)).trans (((Finset.sum_le_sum fun i _=>hk i).trans_eq (by simp [num])).trans hB) filter_upwards with n N m hN Y simp_rw [show (x.apt)=False from eq_false ha,false_and,pr_false]; exact (bp_pos _).le
def foil (x : Appearance p) (Y : Silhouette p N r) (o : Orient p n N) (m : Mixer p n) (K : ℕ) (δ : ℝ) := ∀ (z:Digest p.g) (i:Fin r), z.feasible x.l x.f → z.sumBit=x.q → δ ≤ x.reference Y i → Template.patrol x.trot m (scopedScan p n x.l x.f z) (fun y => Y x.l x.q y=i) K x.q o
theorem foilCap (x : Appearance p) (r M : ℕ) (h : AnalyticParameters p M b s0) (δ:ℝ) (hδ:0<δ) : ∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,2*num (Full p n)<(N:ℝ) → unaryGood m b.pins s0 → ∀ Y: Silhouette p N r, pr (raw m N) (fun i=>¬x.foil Y i m b.pins δ)≤bp (-(1/18:ℝ)*n) := by classical have ht:=h.enter.first let A:= Digest p.g × Fin r let Q n (m:Mixer p n) (Y:Silhouette p (M*n) r) (a : A) (o : Orient p n (M*n)) := a.1.feasible x.l x.f ∧ a.1.sumBit=x.q ∧ δ≤x.reference Y a.2 ∧ ¬Template.patrol x.trot m (scopedScan p n x.l x.f a.1) (fun y=>Y x.l x.q y=a.2) b.pins x.q o have hg (a:A) : ∀ᶠ n:ℕ in atTop,let N:=M*n;∀ m:Mixer p n,2*num (Full p n)<(N:ℝ) → unaryGood m b.pins s0→∀ Y:Silhouette p N r, pr (raw m N) (Q n m Y a) ≤ bp (-(1/16:ℝ)*n) := by by_cases hf : a.1.feasible x.l x.f ∧ a.1.sumBit=x.q · filter_upwards [patrolled x.trot M ht.hM ht.hg ht.hJ a.1 hf.1 ht.hR δ hδ h.profiles h.gleaming] with n hn N m hN hM Y by_cases he : δ ≤ x.reference Y a.2 · let S : AtomKey (p:=p) (x.trot.t ()) (M*n) →Prop := fun i=>Y x.l x.q i=a.2 let v:=scopedScan p n (x.trot.t ()) (x.trot.f ()) a.1 have hx : δ ≤ pr (lawOmega p (M*n) (x.trot.t ()) a.1.sumBit) S := by rw [hf.2]; exact he have hh (i:Orient p n (M*n)) (h:Q n m Y a i) : ¬Template.patrol x.trot m v S b.pins a.1.sumBit i := hf.2 ▸ h.2.2.2 exact (pr_mono (raw_law m hN).nz hh).trans (hn m hM hN S hx) have hg : Q n m Y a=fun _=> False := funext fun i=> eq_false (fun h=>he h.2.2.1) change pr (raw m (M*n)) (Q n m Y a) ≤ _ rw [hg,pr_false]; exact (bp_pos _).le filter_upwards with n N m hN hg Y have hh : Q n m Y a=fun _=> False := funext fun i=> eq_false (fun h=> hf ⟨h.1,h.2.1⟩) change pr (raw m (M*n)) (Q n m Y a) ≤ _ rw [hh,pr_false]; exact (bp_pos _).le filter_upwards [eventually_all.mpr hg,pay_nat (a:=1/16) (b:=1/18) (num A) (by norm_num)] with n hn hB N m hN hM Y have he o (h : ¬x.foil Y o m b.pins δ) : ∃ i, Q n m Y i o := by unfold foil at h push Not at h obtain ⟨z,i,h⟩:=h exact ⟨(z,i),h⟩ let v:=raw m N have hv : IsLaw v:=raw_law m hN exact ((pr_mono hv.nz he).trans (pr_exists_le hv.nz _)).trans (((Finset.sum_le_sum fun i _=>hn i m hN hM Y).trans_eq (by simp [num])).trans hB)end Appearance
def smoothSilk (p : Shape) (ε δ:ℝ) (Y:Silhouette p N r) (m:Mixer p n) (K:ℕ) (o:Orient p n N) := ∀ x : Appearance p,(x.apt → x.close Y o ε) ∧ x.foil Y o m K δ
variable {s0 : ℕ}
def gauze (p : Shape) (ε δ:ℝ) (Y:Silhouette p N r) (m:Mixer p n) (K:ℕ) (o:UnitType p n N) := ∀ i,smoothSilk p ε δ Y m K (onSide o i)
private theorem silken (p : Shape) (r M : ℕ) (h : AnalyticParameters p M b s0) (ε δ : ℝ) (he:0<ε) (hd:0<δ) : ∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,2*num (Full p n)<(N:ℝ) → unaryGood m b.pins s0 → ∀ Y: Silhouette p N r, pr (raw m N) (fun i=>¬smoothSilk p ε δ Y m b.pins i)≤bp (-(1/20:ℝ)*n) := by classical let A:= Appearance p filter_upwards [eventually_all.mpr (fun x:A=>x.foilCap r M h δ hd), eventually_all.mpr (fun x:A=>x.readCap r M h ε he), pay_nat (a:=1/18) (b:=1/20) (num A*2) (by norm_num)] with n hn ht hB N m hN hM Y let v:=raw m N have hv : IsLaw v:=raw_law m hN let P (x:A) (o:Orient p n N) := (x.apt ∧ ¬x.close Y o ε)∨ ¬x.foil Y o m b.pins δ have hk x : pr v (P x) ≤ 2*bp (-(1/18:ℝ)*n) := by rw [two_mul]; apply (pr_or_le hv.nz).trans refine add_le_add ((ht x m hN Y).trans (bp_le ?_)) (hn x m hN hM Y) linarith [(Nat.cast_nonneg n :0≤(n:ℝ))] have hi o (h : ¬smoothSilk p ε δ Y m b.pins o) : ∃ i, P i o := by unfold smoothSilk at h obtain ⟨i,h⟩:= Classical.not_forall.mp h exact ⟨i,by unfold P; tauto⟩ refine ((pr_mono hv.nz hi).trans (pr_exists_le hv.nz _)).trans (((Finset.sum_le_sum fun i _=>hk i).trans_eq ?_).trans hB) simp [num,mul_assoc]
theorem gauzeCalendar (p : Shape) (r M : ℕ) (h : AnalyticParameters p M b s0) (ε δ:ℝ) (he:0<ε) (hd:0<δ) : ∀ᶠ n : ℕ in atTop, let N:=M*n; ∀ m : Mixer p n,∀ u : Wgt (UnitType p n N), PreparationParameters.Align b s0 p M n m u → ∀ Y: Silhouette p N r, pr u (fun i=>¬gauze p ε δ Y m b.pins i)≤bp (-(1/100:ℝ)*n) := by classical filter_upwards [silken p r M h ε δ he hd,pay_nat (a:=1/20-1/32) (b:=1/100) 2 (by norm_num)] with n hn ht N m u hu Y let P (o:Orient p n N) := ¬smoothSilk p ε δ Y m b.pins o let Q (i:Bool) (o:UnitType p n N):=P (onSide o i) have hc : bySide p u m (bp ((1/32:ℝ)*n)) := fun i=> by have hh:= hu.drain cases i; exact hh.2.2.1; exact hh.2.1 have hf : ∀ i,pr u (Q i) ≤bp (-((1/20:ℝ)-1/32)*n) := by intro i let x := fun o:UnitType p n N=>onSide o i change pr u (fun i=>P (x i)) ≤_ rw [←mapW_pr] exact (pr_cap (hc i) P).trans ((mul_le_mul_of_nonneg_left (hn m hu.cols hu.hymn Y) (bp_pos _).le).trans_eq (by rw [←bp_add]; congr 1; ring)) have he o (h : ¬gauze p ε δ Y m b.pins o) : ∃ i,Q i o := Classical.not_forall.mp h have hv : IsLaw u:=hu.drain.1 rw [two_mul] at ht refine ((pr_mono hv.nz he).trans ((pr_exists_le hv.nz _).trans ?_)) rw [Fintype.sum_bool]; exact (add_le_add (hf _) (hf _)).trans ht
end StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128import OAI.Combinatorics.HadwigerCounterexample.FiniteConditioning
import OAI.Combinatorics.HadwigerCounterexample.ConditionalProductLaws
namespace OAI
/-! # Cell Pruning -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Finset
variable {A B I J : Type} [Fintype A] [Fintype B] [Fintype I] [Fintype J]
theorem sum_pr_tag (w : Wgt A) (P : A → Prop) (f : A→I) :
∑ i:I,pr w (fun x => P x ∧ f x=i) = pr w P := by
classical
unfold pr
rw [← avg_sum]
refine avg_congr fun x _ => ?_
simp only [ind_and, ← Finset.mul_sum]
rw [Finset.sum_eq_single (f x)]
· rw [ind_one rfl,mul_one]
· intro j _ hj; exact ind_zero hj.symm
simp
/-- implication needed only almost surely for finite measures. -/
theorem pr_on_mono {w : Wgt A} (hw : ∀ x,0≤w x) {P Q : A→Prop}
(h : ∀ x,w x≠0→ P x→ Q x) : pr w P ≤ pr w Q :=
Finset.sum_le_sum (fun x _ => by
by_cases he : w x=0
· simp [he]
exact mul_le_mul_of_nonneg_left (ind_mono (h x he)) (hw x))
theorem sum_pr_cells (w : Wgt (A × B)) (P : A × B → Prop) (f : A→I) (g : B→J) :
∑ i:I,∑ j:J,pr w (fun x => P x ∧ f x.1=i ∧ g x.2=j) = pr w P := by
classical
rw [← sum_pr_tag w P (fun x => (f x.1,g x.2)), Fintype.sum_prod_type]
simp only [Prod.mk.injEq]
/-- restore the full pair-event probability in a specified cell. -/
theorem pair_restore (u : Wgt A) (v : Wgt B) (P : A → Prop) (Q : B → Prop)
(hP : 0 < pr u P) (hQ : 0 < pr v Q)
(c : A × B → Prop) :
pr (pairW u v) (fun x => P x.1 ∧ Q x.2 ∧ c x)=
pr u P * pr v Q * pr (pairW (onW u P) (onW v Q)) c := by
classical
let D := pr u P * pr v Q
let d := pairW (onW u P) (onW v Q)
change avg _ _ = D*avg d _
unfold avg
rw [Finset.mul_sum]
refine Finset.sum_congr rfl fun i _ => ?_
simp only [pairW,d,onW_val,D,ind_and]
field_simp
def memberC (p : A→Prop) (f : A→I) (i : I) (x : A) := p x ∧ f x=i
/-- heavy cells criterion. Loss charged to τ times opposite mass
rather than τ alone (key q fixed). -/
theorem prune_pairs (w : Wgt A) (v : Wgt B) (hw : SubLaw w) (hv : SubLaw v)
(P : A → Prop) (Q : B→Prop) (f : A→I) (g : B→J)
(C : A×B→Prop) (H T : ℝ) (hH : 0≤H) (hT : 0<T)
{L : ℝ} (hi : (Fintype.card I : ℝ) ≤ L)
(hj : (Fintype.card J : ℝ) ≤ L)
(h : ∀ i j,T ≤ pr w (memberC P f i) → T ≤ pr v (memberC Q g j) →
H≤ pr (pairW (onW w (memberC P f i)) (onW v (memberC Q g j))) C) :
H * (pr w P * pr v Q) ≤ pr (pairW w v) (fun x => P x.1 ∧ Q x.2 ∧ C x) +
(H*T*L)*(pr w P+pr v Q) := by
classical
let a (i:I) := pr w (memberC P f i)
let b (i:J) := pr v (memberC Q g i)
let d (i:I) (j:J) := pr (pairW w v) (fun x => memberC P f i x.1 ∧ memberC Q g j x.2 ∧ C x)
have ha i : 0≤a i := pr_nonneg hw.nz
have hb i : 0≤b i := pr_nonneg hv.nz
have he i j : H*(a i*b j) ≤ d i j+ H*T*b j + H*T*a i := by
have hz : 0≤ d i j := pr_nonneg (subLaw_pair hw hv).nz
have ha' := mul_nonneg (mul_nonneg hH hT.le) (ha i)
have hb' := mul_nonneg (mul_nonneg hH hT.le) (hb j)
by_cases ht : T ≤ a i
· by_cases hh : T ≤ b j
· have hc := mul_le_mul_of_nonneg_right (h i j ht hh) (mul_nonneg (ha i) (hb j))
have h1 := pair_restore w v _ _ (lt_of_lt_of_le hT ht) (lt_of_lt_of_le hT hh) C
refine hc.trans ?_
rw [mul_comm (pr _ C)]
change _ ≤ d i j + _ + _
unfold d
rw [h1]
change _ ≤ a i*b j * _ + _+_
linarith
· have hg := mul_le_mul_of_nonneg_left (le_of_not_ge hh) (mul_nonneg hH (ha i))
calc H*(a i*b j) ≤ H*T*a i := by linarith only [hg]
_ ≤ _ := by linarith only [hb',hz]
have hg := mul_le_mul_of_nonneg_left (le_of_not_ge ht) (mul_nonneg hH (hb j))
calc H*(a i*b j) ≤ H*T*b j := by linarith only [hg]
_ ≤ _ := by linarith only [ha',hz]
have hA : pr w P=∑ i,a i := (sum_pr_tag w P f).symm
have hB : pr v Q=∑ j,b j := (sum_pr_tag v Q g).symm
have hC :
pr (pairW w v) (fun x => P x.1 ∧ Q x.2 ∧ C x) = ∑ i,∑ j,d i j := by
rw [← sum_pr_cells (pairW w v) _ f g]
refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => ?_
unfold d; congr 1; unfold memberC; ext; tauto
have h1 : H * (pr w P * pr v Q)=∑ i,∑ j,H*(a i*b j) := by
rw [hA,hB]
simp only [Finset.sum_mul,Finset.mul_sum]
exact Finset.sum_comm;
have h2 : ∑ i:I,∑ j:J,H*T*b j=(Fintype.card I:ℝ)*(H*T*pr v Q) := by
simp only [← Finset.mul_sum,←hB,Finset.sum_const, Finset.card_univ, nsmul_eq_mul]
ring
have h3 : ∑ i:I,∑ j:J,H*T*a i=(Fintype.card J:ℝ)*(H*T*pr w P) := by
rw [Finset.sum_comm]
simp only [← Finset.mul_sum,←hA,Finset.sum_const,Finset.card_univ,nsmul_eq_mul]
ring
rw [h1]
refine (Finset.sum_le_sum fun i _ => Finset.sum_le_sum fun j _ => he i j).trans ?_
simp only [Finset.sum_add_distrib]
rw [h2,h3,← hC]
have hh := mul_le_mul_of_nonneg_right hj (show 0≤H*T*pr w P from
mul_nonneg (mul_nonneg hH hT.le) (pr_nonneg hw.nz))
have hh' := mul_le_mul_of_nonneg_right hi (show 0≤H*T*pr v Q from
mul_nonneg (mul_nonneg hH hT.le) (pr_nonneg hv.nz))
linarith only [hh,hh']
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.FiniteConditioningimport OAI.Combinatorics.HadwigerCounterexample.ConditionalProductLaws
namespace OAI
/-! # Cell Pruning -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperatorsopen Finsetvariable {A B I J : Type} [Fintype A] [Fintype B] [Fintype I] [Fintype J]
theorem sum_pr_tag (w : Wgt A) (P : A → Prop) (f : A→I) : ∑ i:I,pr w (fun x => P x ∧ f x=i) = pr w P := by classical unfold pr rw [← avg_sum] refine avg_congr fun x _ => ?_ simp only [ind_and, ← Finset.mul_sum] rw [Finset.sum_eq_single (f x)] · rw [ind_one rfl,mul_one] · intro j _ hj; exact ind_zero hj.symm simp
/-- implication needed only almost surely for finite measures. -/theorem pr_on_mono {w : Wgt A} (hw : ∀ x,0≤w x) {P Q : A→Prop} (h : ∀ x,w x≠0→ P x→ Q x) : pr w P ≤ pr w Q := Finset.sum_le_sum (fun x _ => by by_cases he : w x=0 · simp [he] exact mul_le_mul_of_nonneg_left (ind_mono (h x he)) (hw x))
theorem sum_pr_cells (w : Wgt (A × B)) (P : A × B → Prop) (f : A→I) (g : B→J) : ∑ i:I,∑ j:J,pr w (fun x => P x ∧ f x.1=i ∧ g x.2=j) = pr w P := by classical rw [← sum_pr_tag w P (fun x => (f x.1,g x.2)), Fintype.sum_prod_type] simp only [Prod.mk.injEq]
/-- restore the full pair-event probability in a specified cell. -/theorem pair_restore (u : Wgt A) (v : Wgt B) (P : A → Prop) (Q : B → Prop) (hP : 0 < pr u P) (hQ : 0 < pr v Q) (c : A × B → Prop) : pr (pairW u v) (fun x => P x.1 ∧ Q x.2 ∧ c x)= pr u P * pr v Q * pr (pairW (onW u P) (onW v Q)) c := by classical let D := pr u P * pr v Q let d := pairW (onW u P) (onW v Q) change avg _ _ = D*avg d _ unfold avg rw [Finset.mul_sum] refine Finset.sum_congr rfl fun i _ => ?_ simp only [pairW,d,onW_val,D,ind_and] field_simp
def memberC (p : A→Prop) (f : A→I) (i : I) (x : A) := p x ∧ f x=i
/-- heavy cells criterion. Loss charged to τ times opposite massrather than τ alone (key q fixed). -/theorem prune_pairs (w : Wgt A) (v : Wgt B) (hw : SubLaw w) (hv : SubLaw v) (P : A → Prop) (Q : B→Prop) (f : A→I) (g : B→J) (C : A×B→Prop) (H T : ℝ) (hH : 0≤H) (hT : 0<T) {L : ℝ} (hi : (Fintype.card I : ℝ) ≤ L) (hj : (Fintype.card J : ℝ) ≤ L) (h : ∀ i j,T ≤ pr w (memberC P f i) → T ≤ pr v (memberC Q g j) → H≤ pr (pairW (onW w (memberC P f i)) (onW v (memberC Q g j))) C) : H * (pr w P * pr v Q) ≤ pr (pairW w v) (fun x => P x.1 ∧ Q x.2 ∧ C x) + (H*T*L)*(pr w P+pr v Q) := by classical let a (i:I) := pr w (memberC P f i) let b (i:J) := pr v (memberC Q g i) let d (i:I) (j:J) := pr (pairW w v) (fun x => memberC P f i x.1 ∧ memberC Q g j x.2 ∧ C x) have ha i : 0≤a i := pr_nonneg hw.nz have hb i : 0≤b i := pr_nonneg hv.nz have he i j : H*(a i*b j) ≤ d i j+ H*T*b j + H*T*a i := by have hz : 0≤ d i j := pr_nonneg (subLaw_pair hw hv).nz have ha' := mul_nonneg (mul_nonneg hH hT.le) (ha i) have hb' := mul_nonneg (mul_nonneg hH hT.le) (hb j) by_cases ht : T ≤ a i · by_cases hh : T ≤ b j · have hc := mul_le_mul_of_nonneg_right (h i j ht hh) (mul_nonneg (ha i) (hb j)) have h1 := pair_restore w v _ _ (lt_of_lt_of_le hT ht) (lt_of_lt_of_le hT hh) C refine hc.trans ?_ rw [mul_comm (pr _ C)] change _ ≤ d i j + _ + _ unfold d rw [h1] change _ ≤ a i*b j * _ + _+_ linarith · have hg := mul_le_mul_of_nonneg_left (le_of_not_ge hh) (mul_nonneg hH (ha i)) calc H*(a i*b j) ≤ H*T*a i := by linarith only [hg] _ ≤ _ := by linarith only [hb',hz] have hg := mul_le_mul_of_nonneg_left (le_of_not_ge ht) (mul_nonneg hH (hb j)) calc H*(a i*b j) ≤ H*T*b j := by linarith only [hg] _ ≤ _ := by linarith only [ha',hz] have hA : pr w P=∑ i,a i := (sum_pr_tag w P f).symm have hB : pr v Q=∑ j,b j := (sum_pr_tag v Q g).symm have hC : pr (pairW w v) (fun x => P x.1 ∧ Q x.2 ∧ C x) = ∑ i,∑ j,d i j := by rw [← sum_pr_cells (pairW w v) _ f g] refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => ?_ unfold d; congr 1; unfold memberC; ext; tauto have h1 : H * (pr w P * pr v Q)=∑ i,∑ j,H*(a i*b j) := by rw [hA,hB] simp only [Finset.sum_mul,Finset.mul_sum] exact Finset.sum_comm; have h2 : ∑ i:I,∑ j:J,H*T*b j=(Fintype.card I:ℝ)*(H*T*pr v Q) := by simp only [← Finset.mul_sum,←hB,Finset.sum_const, Finset.card_univ, nsmul_eq_mul] ring have h3 : ∑ i:I,∑ j:J,H*T*a i=(Fintype.card J:ℝ)*(H*T*pr w P) := by rw [Finset.sum_comm] simp only [← Finset.mul_sum,←hA,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] ring rw [h1] refine (Finset.sum_le_sum fun i _ => Finset.sum_le_sum fun j _ => he i j).trans ?_ simp only [Finset.sum_add_distrib] rw [h2,h3,← hC] have hh := mul_le_mul_of_nonneg_right hj (show 0≤H*T*pr w P from mul_nonneg (mul_nonneg hH hT.le) (pr_nonneg hw.nz)) have hh' := mul_le_mul_of_nonneg_right hi (show 0≤H*T*pr v Q from mul_nonneg (mul_nonneg hH hT.le) (pr_nonneg hv.nz)) linarith only [hh,hh']
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144import OAI.Combinatorics.HadwigerCounterexample.BilinearCompression
namespace OAI
/-! # Channel Factorization -/
noncomputable section
namespace HadwigerCounterexample
open Matrix LinearMap Submodule Module
open scoped BigOperators
variable {p : Shape} {n : ℕ}
variable {I J : Type} [Fintype I] [Fintype J]
/-- Pairing rank after imposing orthogonality constraints. -/
theorem biorth_exists (S T : Space (Vec I)) (r : ℕ)
(h : r+dim S+dim T≤Fintype.card I) :
∃ A B : Mat I (Fin r), colSp A≤ annih S ∧ colSp B≤ annih T ∧ Aᵀ*B=1 := by
classical
let V := annih S
let W := annih T
let M := (pack V)ᵀ * pack W
let t := M.rank
have ht : r≤t := by
have h1 := rank_ge_mul (pack V)ᵀ (pack W)
rw [Matrix.rank_transpose,mrk_inj.mp (pack_inj V),mrk_inj.mp (pack_inj W),
Fintype.card_fin,Fintype.card_fin] at h1
have h2 : dim S+dim V=Fintype.card I := annih_dim S
have h3 : dim T+dim W=Fintype.card I := annih_dim T
have he (a b c d t r e : ℕ) (h : r+a+b ≤ e) (hx : a+c=e) (hy : b+d=e) (ht : c+d≤t+e) :
r≤t := by omega
exact he _ _ _ _ _ _ _ h h2 h3 h1
obtain ⟨A,B,hA,hB,hM⟩ := rank_product M
obtain ⟨L,hL⟩ := mat_left_inv hA
obtain ⟨R,hR⟩ := mat_left_inv (P:=Bᵀ) (transpose_surj_iff.mp (by rw [Matrix.transpose_transpose]; exact hB))
let E := embedMat (Fin.castLE ht)
refine ⟨pack V * (Lᵀ * E),pack W*(Rᵀ*E),?_,?_,?_⟩
· rintro x ⟨x,rfl⟩
rw [Matrix.mulVecLin_apply,← Matrix.mulVec_mulVec]
exact (pack_mem_iff ..).mpr ⟨_,rfl⟩
· rintro x ⟨x,rfl⟩
rw [Matrix.mulVecLin_apply,← Matrix.mulVec_mulVec]
exact (pack_mem_iff ..).mpr ⟨_,rfl⟩
have he : L*M*Rᵀ=1 := by
have hg : B*Rᵀ=1 := by
simpa only [Matrix.transpose_mul, Matrix.transpose_transpose, Matrix.transpose_one] using
congrArg Matrix.transpose hR
refine (congrArg (fun X => L*X*Rᵀ) hM).symm.trans ?_
rw [← Matrix.mul_assoc L,hL,Matrix.one_mul,hg]
have heq : Eᵀ * E=1 := embedMat_self (Fin.castLE_injective ht)
rw [Matrix.transpose_mul,Matrix.transpose_mul,Matrix.transpose_transpose]
calc _ = Eᵀ*(L*M*Rᵀ)*E := by simp only [M,Matrix.mul_assoc]
_ = _ := by rw [he,Matrix.mul_one,heq]
/-- split desired respective bounded-rank bilinear form -/
theorem pure_chan_split (M : Mat J J) (S T : Space (Vec I)) (X Y : Space (Vec J))
(h : M∈box (annih X) (annih Y)) (ht : M.rank+dim S+dim T ≤ Fintype.card I) :
∃ A ∈ box (annih S) (annih X),∃ B∈box (annih T) (annih Y), Aᵀ * B=M := by
classical
obtain ⟨P,Q,hP,hQ,hM⟩ := rank_product M
obtain ⟨A,B,hA,hB,he⟩ := biorth_exists S T M.rank ht
obtain ⟨hx,hy⟩ := box_kill.mp h
refine ⟨A * Pᵀ,?_,B*Q,?_,?_⟩
· rw [box_kill]
constructor
· intro x hx; rw [Matrix.transpose_mul,← Matrix.mulVec_mulVec,(colSp_kill ..).mp hA x hx,
Matrix.mulVec_zero]
intro x hv
have hv' : Pᵀ *ᵥ x=0 := by
have hqi := (transpose_surj_iff (P:=Qᵀ)).mp (by rw [Matrix.transpose_transpose]; exact hQ)
apply hqi
rw [Matrix.mulVec_mulVec,← Matrix.transpose_mul,hM,hx x hv,Matrix.mulVec_zero]
rw [←Matrix.mulVec_mulVec,hv',mulVec_zero]
· rw [box_kill]
constructor
· intro x hv; rw [Matrix.transpose_mul,←Matrix.mulVec_mulVec,(colSp_kill ..).mp hB x hv,
Matrix.mulVec_zero]
intro y hv
have hv' : Q *ᵥ y=0 := by
apply hP
rw [Matrix.mulVec_mulVec,hM,hy y hv,mulVec_zero]
rw [←Matrix.mulVec_mulVec,hv',mulVec_zero]
· rw [Matrix.transpose_mul,Matrix.transpose_transpose,← Matrix.mul_assoc _ B, Matrix.mul_assoc P,
he,Matrix.mul_one,hM]
/-- The final channel change for fixed B endpoint. -/
theorem chan_factor {f b : Plan p n} {P : PureForms p n} {C : ChanOut p n} {j : Bool}
(H T K : ℕ) (hc : outSmall H C) (hK : ∀ z,dim (hPin b z j)≤K)
(hh : T+2*(K+2*H)≤p.h)
(hP : P∈pureSpace p f) (ht : ∀ e,(P e).rank≤T) :
∃ D∈deltaSpace p f b j,obsPair p (chanInner p (C+D) (C+D))=
obsPair p (chanInner p C C)+obsPair p P := by
classical
let S (z : Place p) := hPin b (flipZ p z) j ⊔ priOut p C (flipZ p z)
have h (z : Place p) : dim (S z) ≤ K+2*H :=
(Submodule.finrank_add_le_finrank_add_finrank ..).trans
(add_le_add (hK _) (dim_priOut hc _))
choose A hA B hB hQ using fun e : Comp p.g =>
pure_chan_split (P e) (S (e,true)) (S (e,false)) (f (e,true)) (f (e,false))
((pureSpace_mem _).mp hP e) ((add_le_add
(add_le_add (ht e) (h (e,true))) (h (e,false))).trans
(by
rw [Fintype.card_fin]
rwa [two_mul, ← add_assoc] at hh))
let D : ChanOut p n := fun z => if z.2 then A z.1 else B z.1
have h1 (z : Place p) : D z∈box (annih (S z)) (annih (f z)) := by
cases z with | mk e c => cases c; exact hB e; exact hA e
refine ⟨D,(deltaSpace_mem _).mpr ?_,?_⟩
· intro z
refine box_le ?_ le_rfl (h1 z)
intro x hx
rw [annih_mem]
exact fun y hy => (annih_mem ..).mp hx y (Submodule.mem_sup_left hy)
have hg : chanInner p D D=P := funext (fun e => hQ e)
have he (z : Place p) (i l : Bool) (x y : Ray p n) :
dotProduct ((C (flipZ p z)*IP p n i) *ᵥ x) ((D z*IP p n l)*ᵥ y)=0 := by
have hq : ((C (flipZ p z)*IP p n i) *ᵥ x) ∈ S z :=
Submodule.mem_sup_right (le_priOut C _ i ⟨x,rfl⟩)
have hl : ((D z * IP p n l)*ᵥ y) ∈ annih (S z) := by
rw [←Matrix.mulVec_mulVec]
exact ((box_mem ..).mp (h1 z)).1 ⟨_,rfl⟩
rw [dotProduct_comm]
exact (annih_mem ..).mp hl _ hq
have hd : obsPair p (chanDeriv p C D)=0 := by
rw [←obsI_each]
have hz : eachF p (chanDeriv p C D)=0 := by
unfold chanDeriv; rw [map_add]
funext i e
rw [Pi.add_apply,Pi.add_apply,each_chan_val,each_chan_val]
refine evmat_ext fun x y => ?_
rw [evmat_addM,ev_duom,ev_duom]
have hh1 := he (e,false) i i x y
have hh2 := he (e,true) i i y x
simp only [flipZ,Bool.not_false,Bool.not_true] at hh1 hh2
rw [hh1,
dotProduct_comm ((D (e,true) * IP p n i) *ᵥ _),hh2]
simp [evmat]
rw [hz,map_zero]
rw [obsPair_chan_change,hd,add_zero,hg]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.BilinearCompression
namespace OAI
/-! # Channel Factorization -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix LinearMap Submodule Moduleopen scoped BigOperatorsvariable {p : Shape} {n : ℕ}variable {I J : Type} [Fintype I] [Fintype J]
/-- Pairing rank after imposing orthogonality constraints. -/theorem biorth_exists (S T : Space (Vec I)) (r : ℕ) (h : r+dim S+dim T≤Fintype.card I) : ∃ A B : Mat I (Fin r), colSp A≤ annih S ∧ colSp B≤ annih T ∧ Aᵀ*B=1 := by classical let V := annih S let W := annih T let M := (pack V)ᵀ * pack W let t := M.rank have ht : r≤t := by have h1 := rank_ge_mul (pack V)ᵀ (pack W) rw [Matrix.rank_transpose,mrk_inj.mp (pack_inj V),mrk_inj.mp (pack_inj W), Fintype.card_fin,Fintype.card_fin] at h1 have h2 : dim S+dim V=Fintype.card I := annih_dim S have h3 : dim T+dim W=Fintype.card I := annih_dim T have he (a b c d t r e : ℕ) (h : r+a+b ≤ e) (hx : a+c=e) (hy : b+d=e) (ht : c+d≤t+e) : r≤t := by omega exact he _ _ _ _ _ _ _ h h2 h3 h1 obtain ⟨A,B,hA,hB,hM⟩ := rank_product M obtain ⟨L,hL⟩ := mat_left_inv hA obtain ⟨R,hR⟩ := mat_left_inv (P:=Bᵀ) (transpose_surj_iff.mp (by rw [Matrix.transpose_transpose]; exact hB)) let E := embedMat (Fin.castLE ht) refine ⟨pack V * (Lᵀ * E),pack W*(Rᵀ*E),?_,?_,?_⟩ · rintro x ⟨x,rfl⟩ rw [Matrix.mulVecLin_apply,← Matrix.mulVec_mulVec] exact (pack_mem_iff ..).mpr ⟨_,rfl⟩ · rintro x ⟨x,rfl⟩ rw [Matrix.mulVecLin_apply,← Matrix.mulVec_mulVec] exact (pack_mem_iff ..).mpr ⟨_,rfl⟩ have he : L*M*Rᵀ=1 := by have hg : B*Rᵀ=1 := by simpa only [Matrix.transpose_mul, Matrix.transpose_transpose, Matrix.transpose_one] using congrArg Matrix.transpose hR refine (congrArg (fun X => L*X*Rᵀ) hM).symm.trans ?_ rw [← Matrix.mul_assoc L,hL,Matrix.one_mul,hg] have heq : Eᵀ * E=1 := embedMat_self (Fin.castLE_injective ht) rw [Matrix.transpose_mul,Matrix.transpose_mul,Matrix.transpose_transpose] calc _ = Eᵀ*(L*M*Rᵀ)*E := by simp only [M,Matrix.mul_assoc] _ = _ := by rw [he,Matrix.mul_one,heq]
/-- split desired respective bounded-rank bilinear form -/theorem pure_chan_split (M : Mat J J) (S T : Space (Vec I)) (X Y : Space (Vec J)) (h : M∈box (annih X) (annih Y)) (ht : M.rank+dim S+dim T ≤ Fintype.card I) : ∃ A ∈ box (annih S) (annih X),∃ B∈box (annih T) (annih Y), Aᵀ * B=M := by classical obtain ⟨P,Q,hP,hQ,hM⟩ := rank_product M obtain ⟨A,B,hA,hB,he⟩ := biorth_exists S T M.rank ht obtain ⟨hx,hy⟩ := box_kill.mp h refine ⟨A * Pᵀ,?_,B*Q,?_,?_⟩ · rw [box_kill] constructor · intro x hx; rw [Matrix.transpose_mul,← Matrix.mulVec_mulVec,(colSp_kill ..).mp hA x hx, Matrix.mulVec_zero] intro x hv have hv' : Pᵀ *ᵥ x=0 := by have hqi := (transpose_surj_iff (P:=Qᵀ)).mp (by rw [Matrix.transpose_transpose]; exact hQ) apply hqi rw [Matrix.mulVec_mulVec,← Matrix.transpose_mul,hM,hx x hv,Matrix.mulVec_zero] rw [←Matrix.mulVec_mulVec,hv',mulVec_zero] · rw [box_kill] constructor · intro x hv; rw [Matrix.transpose_mul,←Matrix.mulVec_mulVec,(colSp_kill ..).mp hB x hv, Matrix.mulVec_zero] intro y hv have hv' : Q *ᵥ y=0 := by apply hP rw [Matrix.mulVec_mulVec,hM,hy y hv,mulVec_zero] rw [←Matrix.mulVec_mulVec,hv',mulVec_zero] · rw [Matrix.transpose_mul,Matrix.transpose_transpose,← Matrix.mul_assoc _ B, Matrix.mul_assoc P, he,Matrix.mul_one,hM]
/-- The final channel change for fixed B endpoint. -/theorem chan_factor {f b : Plan p n} {P : PureForms p n} {C : ChanOut p n} {j : Bool} (H T K : ℕ) (hc : outSmall H C) (hK : ∀ z,dim (hPin b z j)≤K) (hh : T+2*(K+2*H)≤p.h) (hP : P∈pureSpace p f) (ht : ∀ e,(P e).rank≤T) : ∃ D∈deltaSpace p f b j,obsPair p (chanInner p (C+D) (C+D))= obsPair p (chanInner p C C)+obsPair p P := by classical let S (z : Place p) := hPin b (flipZ p z) j ⊔ priOut p C (flipZ p z) have h (z : Place p) : dim (S z) ≤ K+2*H := (Submodule.finrank_add_le_finrank_add_finrank ..).trans (add_le_add (hK _) (dim_priOut hc _)) choose A hA B hB hQ using fun e : Comp p.g => pure_chan_split (P e) (S (e,true)) (S (e,false)) (f (e,true)) (f (e,false)) ((pureSpace_mem _).mp hP e) ((add_le_add (add_le_add (ht e) (h (e,true))) (h (e,false))).trans (by rw [Fintype.card_fin] rwa [two_mul, ← add_assoc] at hh)) let D : ChanOut p n := fun z => if z.2 then A z.1 else B z.1 have h1 (z : Place p) : D z∈box (annih (S z)) (annih (f z)) := by cases z with | mk e c => cases c; exact hB e; exact hA e refine ⟨D,(deltaSpace_mem _).mpr ?_,?_⟩ · intro z refine box_le ?_ le_rfl (h1 z) intro x hx rw [annih_mem] exact fun y hy => (annih_mem ..).mp hx y (Submodule.mem_sup_left hy) have hg : chanInner p D D=P := funext (fun e => hQ e) have he (z : Place p) (i l : Bool) (x y : Ray p n) : dotProduct ((C (flipZ p z)*IP p n i) *ᵥ x) ((D z*IP p n l)*ᵥ y)=0 := by have hq : ((C (flipZ p z)*IP p n i) *ᵥ x) ∈ S z := Submodule.mem_sup_right (le_priOut C _ i ⟨x,rfl⟩) have hl : ((D z * IP p n l)*ᵥ y) ∈ annih (S z) := by rw [←Matrix.mulVec_mulVec] exact ((box_mem ..).mp (h1 z)).1 ⟨_,rfl⟩ rw [dotProduct_comm] exact (annih_mem ..).mp hl _ hq have hd : obsPair p (chanDeriv p C D)=0 := by rw [←obsI_each] have hz : eachF p (chanDeriv p C D)=0 := by unfold chanDeriv; rw [map_add] funext i e rw [Pi.add_apply,Pi.add_apply,each_chan_val,each_chan_val] refine evmat_ext fun x y => ?_ rw [evmat_addM,ev_duom,ev_duom] have hh1 := he (e,false) i i x y have hh2 := he (e,true) i i y x simp only [flipZ,Bool.not_false,Bool.not_true] at hh1 hh2 rw [hh1, dotProduct_comm ((D (e,true) * IP p n i) *ᵥ _),hh2] simp [evmat] rw [hz,map_zero] rw [obsPair_chan_change,hd,add_zero,hg]
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186import OAI.Combinatorics.HadwigerCounterexample.SumRankBounds
namespace OAI
/-! # Channel Frame Laws -/
noncomputable section
namespace HadwigerCounterexample
open Matrix LinearMap Module Submodule Finset Function
open scoped BigOperators
variable {A B : Type} [Fintype A] [Fintype B]
theorem map_pair_law {C D : Type} [Fintype C] [Fintype D]
(w : Wgt A) (v : Wgt B) (f : A→C) (g : B→D) :
mapW (pairW w v) (Prod.map f g)=pairW (mapW w f) (mapW v g) := by
funext x
unfold mapW pairW
simp only [Prod.ext_iff]
exact pairW_pr w v (fun y => f y=x.1) (fun y => g y=x.2)
theorem mapW_nested {C : Type} (w : Wgt A) (f : A→B) (g : B→C) :
mapW (mapW w f) g=mapW w (g ∘ f) :=
funext fun _ => mapW_pr _ _ _
omit [Fintype B] in
theorem mapW_repeat {I : Type} [Fintype I] [DecidableEq I]
(w : I→ Wgt A) (f : I→ A→B) :
mapW (prodW w) (fun x i => f i (x i))=prodW (fun i => mapW (w i) (f i)) := by
funext x
unfold mapW
simp_rw [funext_iff]
exact prodW_pr _ (fun i y => f i y=x i)
omit [Fintype B] in
theorem mapW_pr_eq (e : A≃A) (f : A→B) (u : B≃B) (h : ∀ x,f (e x)=u (f x))
(w : Wgt A) (hw : ∀ x, w (e x)=w x) (x : B) : mapW w f (u x)=mapW w f x := by
have he := avg_bij e w (fun y => ind (f y=u x))
simp_rw [hw,h,u.injective.eq_iff] at he
exact he.symm
private theorem pmax_test {x : A} (p : A → Prop) {w : Wgt A} (hw : SubLaw w)
(h : ∀ y, p y → w y=w x) {m : ℝ} (hm : 0 < m)
(hp : m ≤ pr unif p) [Nonempty A] :
w x ≤ m⁻¹ * unif x := by
have hh : pr w p=w x*nbr p := by
simp only [pr,avg,nbr,tot,Finset.mul_sum]
refine Finset.sum_congr rfl fun i _ => ?_
by_cases he : p i
· rw [h i he]
rw [ind_zero he,mul_zero,mul_zero]
have h1 := (pr_le_tot (p:=p) hw.nz).trans hw.total
rw [hh] at h1
have hU : 0 < (Fintype.card A : ℝ) := by exact_mod_cast Fintype.card_pos
rw [pr_unif (A:=A)] at hp
have hi := (le_div_iff₀ hU).mp hp
rw [unif_apply]
field_simp
nlinarith only [h1,hi,mul_le_mul_of_nonneg_left hi (hw.nz x)]
theorem gram_norm_quarter {I J L : Type} [Fintype I] [Fintype J] [Fintype L]
[DecidableEq I] [DecidableEq J] [DecidableEq L] (G : Mat I J)
(h : num I + num J-num L ≤ -1) :
bp (-num I * num J)/4 ≤ pr unif (gramGood (U:=L) G) := by
have hn := (gram_norm G (by linarith : num I+num J≤num L)).2
rw [pair_unif]
refine le_trans ?_ hn
have he {x : ℝ} (hx : x ≤ -1) : (1/2 : ℝ)≤ 1-bp x := by
have ht := bp_le hx
rw [bp_neg,bp_one] at ht
linarith only [ht]
let d := bp (-num I*num J)
change d/4 ≤ d* _ * _
have hk : 0 < d := bp_pos _
have h1 := he (x:= num I-num L) (by
have hg : 0≤num J := Nat.cast_nonneg _
linarith)
calc d/4 = d*(1/2)*(1/2) := by ring
_ ≤ _ := mul_le_mul (mul_le_mul_of_nonneg_left h1 hk.le) (he h) (by norm_num)
(mul_nonneg hk.le (le_trans (by norm_num) h1))
variable {I J U : Type} [Fintype I] [Fintype J] [Fintype U]
variable [DecidableEq I] [DecidableEq J] [DecidableEq U]
theorem gramObsCap {C : Mat (I⊕J) (I⊕J) → Prop}
(hc : ∃ x : Mat U (I⊕J) × _, FramesAt C x)
(T : Mat (I⊕J) J) (ht : Function.Injective T.mulVec)
(hN : 2*num J-num U≤ -1) :
let w := unifOn (FramesAt C)
∀ x : Mat U J × Mat U J,
mapW w (observe T T) x ≤ (4*bp (num J*num J))*pairW unif unif x := by
classical
let w := unifOn (FramesAt (U:=U) C)
have hw := unifOn_law hc
let f := observe T T (U:=U)
let v := mapW w f
have hv : IsLaw v := mapW_law hw f
have hg :
carried v (fun x : Mat U J × _ => Injective x.1.mulVec ∧ Injective x.2.mulVec) := by
refine mapW_carried (unifOn_carried _) (fun x hx => ?_)
exact ⟨inj_comp_mat _ _ hx.2.1 ht,inj_comp_mat _ _ hx.2.2 ht⟩
dsimp only
intro x
rw [← pair_unif]
by_cases h : v x≠0
· let G := (x.1ᵀ*x.2 : Mat J J)
have hx : gramGood G x := ⟨rfl,Classical.byContradiction fun he => h (hg x he)⟩
let m := bp (-num J*num J)/4
have he (y : Mat U J × Mat U J) (hy : gramGood G y) : v y=v x := by
obtain ⟨L,hL⟩ := move_exists G x y hx hy
let e := L.perm (I⊕J) (I⊕J)
have hl (y) : f (e y)=(L.perm J J) (f y) :=
Prod.ext (Matrix.mul_assoc ..) (Matrix.mul_assoc ..)
have hp y : w (e y)=w y := by
unfold w; rw [unifOn_val, unifOn_val]
congr 2
exact propext (L.invar C y).symm
exact hL ▸ mapW_pr_eq e f (L.perm J J) hl w hp x
have hi := pmax_test (gramGood (U:=U) G) hv.sub he (m:=m)
(div_pos (bp_pos _) (by norm_num)) (gram_norm_quarter G (by linarith only [hN]))
apply hi.trans
unfold m; rw [neg_mul,bp_neg]; field_simp
exact le_rfl
· change v x ≤ _
rw [not_ne_iff.mp h]
exact mul_nonneg (mul_nonneg (by norm_num) (bp_pos _).le) (unif_subLaw.nz _)
variable {p : Shape} {n N : ℕ}
abbrev HMat (p : Shape) (N : ℕ) := Mat (Fin N) (Chan p)
abbrev HFrame (p : Shape) (N : ℕ) := HMat p N × HMat p N
abbrev HCube (p : Shape) (N : ℕ) := Comp p.g → HFrame p N
def hchan (p : Shape) {n N} (x : Oframe p n N) : HFrame p N :=
(channel x.1,channel x.2)
def hcube (p : Shape) {n N} (x : Orient p n N) : HCube p N := fun z => hchan p (x z)
def lawH (p : Shape) (N : ℕ) : Wgt (HCube p N) :=
prodW (fun (_ : Comp p.g) => pairW unif unif)
def intoChan (p : Shape) (n) : Mat (Full p n) (Chan p) := embedMat (.inr ·)
theorem intoChan_inj : Injective (intoChan p n).mulVec :=
embedMat_inj Sum.inr_injective
theorem intoChan_val (p : Shape) {n N} (x : Mat (Fin N) (Full p n)) :
x * intoChan p n=channel x := by rw [intoChan,mul_embedMat]; rfl
theorem hchan_val (p : Shape) {n N} :
hchan p (n:=n) (N:=N) = observe (intoChan p n) (intoChan p n) := by
funext x
exact Prod.ext (intoChan_val ..).symm (intoChan_val ..).symm
def chanPrice (p : Shape) : ℝ :=
(4*bp ((p.h:ℝ)*p.h))^(Fintype.card (Comp p.g))
theorem hchan_cap (m : Mixer p n) (hN : 2*num (Full p n)-N≤ -1) :
let w := unifOn (FramesAt (U:=Fin N) (gramCond m))
∀ x : HFrame p N,mapW w (hchan p) x≤(4*bp ((p.h:ℝ)*p.h))*pairW unif unif x := by
classical
have he : 2*num (Full p n)-num (Fin N)≤ -1 := by simpa [num] using hN
have hh : ∃ x : Oframe p n N, FramesAt (gramCond m) x :=
framesAt_exists (gramCond_exists m) (by linarith only [he])
rw [hchan_val]
have hr : num (Chan p) ≤ num (Full p n) := by
have hf : Fintype.card (Row p n) + Fintype.card (Chan p)=Fintype.card (Full p n) :=
(Fintype.card_sum ..).symm
exact_mod_cast (show Fintype.card (Chan p)≤Fintype.card (Full p n) by omega)
have hk := gramObsCap hh (intoChan p n) intoChan_inj (by linarith only [he,hr])
rw [show num (Chan p)=(p.h:ℝ) from (by simp [num,Chan])] at hk
exact hk
theorem hcube_cap (m : Mixer p n) (hN : 2*num (Full p n)-N≤ -1)
(x : HCube p N) : mapW (raw m N) (hcube p) x ≤ chanPrice p*lawH p N x := by
let w := unifOn (FramesAt (U:=Fin N) (gramCond m))
have hh i := hchan_cap m hN (x i)
change mapW (prodW (fun (_ : Comp p.g) => w)) _ x ≤ _
unfold hcube
rw [mapW_repeat (w:=fun (_:Comp p.g) => w) (f:=fun i => hchan p (n:=n) (N:=N))]
refine le_trans (Finset.prod_le_prod₀ ?_ fun i _ => hh i) ?_
· intro i _
exact pr_nonneg (unifOn_sub _).nz
rw [Finset.prod_mul_distrib]
simp [chanPrice,lawH,prodW]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.SumRankBounds
namespace OAI
/-! # Channel Frame Laws -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix LinearMap Module Submodule Finset Functionopen scoped BigOperators
variable {A B : Type} [Fintype A] [Fintype B]
theorem map_pair_law {C D : Type} [Fintype C] [Fintype D] (w : Wgt A) (v : Wgt B) (f : A→C) (g : B→D) : mapW (pairW w v) (Prod.map f g)=pairW (mapW w f) (mapW v g) := by funext x unfold mapW pairW simp only [Prod.ext_iff] exact pairW_pr w v (fun y => f y=x.1) (fun y => g y=x.2)
theorem mapW_nested {C : Type} (w : Wgt A) (f : A→B) (g : B→C) : mapW (mapW w f) g=mapW w (g ∘ f) := funext fun _ => mapW_pr _ _ _
omit [Fintype B] intheorem mapW_repeat {I : Type} [Fintype I] [DecidableEq I] (w : I→ Wgt A) (f : I→ A→B) : mapW (prodW w) (fun x i => f i (x i))=prodW (fun i => mapW (w i) (f i)) := by funext x unfold mapW simp_rw [funext_iff] exact prodW_pr _ (fun i y => f i y=x i)
omit [Fintype B] intheorem mapW_pr_eq (e : A≃A) (f : A→B) (u : B≃B) (h : ∀ x,f (e x)=u (f x)) (w : Wgt A) (hw : ∀ x, w (e x)=w x) (x : B) : mapW w f (u x)=mapW w f x := by have he := avg_bij e w (fun y => ind (f y=u x)) simp_rw [hw,h,u.injective.eq_iff] at he exact he.symm
private theorem pmax_test {x : A} (p : A → Prop) {w : Wgt A} (hw : SubLaw w) (h : ∀ y, p y → w y=w x) {m : ℝ} (hm : 0 < m) (hp : m ≤ pr unif p) [Nonempty A] : w x ≤ m⁻¹ * unif x := by have hh : pr w p=w x*nbr p := by simp only [pr,avg,nbr,tot,Finset.mul_sum] refine Finset.sum_congr rfl fun i _ => ?_ by_cases he : p i · rw [h i he] rw [ind_zero he,mul_zero,mul_zero] have h1 := (pr_le_tot (p:=p) hw.nz).trans hw.total rw [hh] at h1 have hU : 0 < (Fintype.card A : ℝ) := by exact_mod_cast Fintype.card_pos rw [pr_unif (A:=A)] at hp have hi := (le_div_iff₀ hU).mp hp rw [unif_apply] field_simp nlinarith only [h1,hi,mul_le_mul_of_nonneg_left hi (hw.nz x)]
theorem gram_norm_quarter {I J L : Type} [Fintype I] [Fintype J] [Fintype L] [DecidableEq I] [DecidableEq J] [DecidableEq L] (G : Mat I J) (h : num I + num J-num L ≤ -1) : bp (-num I * num J)/4 ≤ pr unif (gramGood (U:=L) G) := by have hn := (gram_norm G (by linarith : num I+num J≤num L)).2 rw [pair_unif] refine le_trans ?_ hn have he {x : ℝ} (hx : x ≤ -1) : (1/2 : ℝ)≤ 1-bp x := by have ht := bp_le hx rw [bp_neg,bp_one] at ht linarith only [ht] let d := bp (-num I*num J) change d/4 ≤ d* _ * _ have hk : 0 < d := bp_pos _ have h1 := he (x:= num I-num L) (by have hg : 0≤num J := Nat.cast_nonneg _ linarith) calc d/4 = d*(1/2)*(1/2) := by ring _ ≤ _ := mul_le_mul (mul_le_mul_of_nonneg_left h1 hk.le) (he h) (by norm_num) (mul_nonneg hk.le (le_trans (by norm_num) h1))
variable {I J U : Type} [Fintype I] [Fintype J] [Fintype U]variable [DecidableEq I] [DecidableEq J] [DecidableEq U]
theorem gramObsCap {C : Mat (I⊕J) (I⊕J) → Prop} (hc : ∃ x : Mat U (I⊕J) × _, FramesAt C x) (T : Mat (I⊕J) J) (ht : Function.Injective T.mulVec) (hN : 2*num J-num U≤ -1) : let w := unifOn (FramesAt C) ∀ x : Mat U J × Mat U J, mapW w (observe T T) x ≤ (4*bp (num J*num J))*pairW unif unif x := by classical let w := unifOn (FramesAt (U:=U) C) have hw := unifOn_law hc let f := observe T T (U:=U) let v := mapW w f have hv : IsLaw v := mapW_law hw f have hg : carried v (fun x : Mat U J × _ => Injective x.1.mulVec ∧ Injective x.2.mulVec) := by refine mapW_carried (unifOn_carried _) (fun x hx => ?_) exact ⟨inj_comp_mat _ _ hx.2.1 ht,inj_comp_mat _ _ hx.2.2 ht⟩ dsimp only intro x rw [← pair_unif] by_cases h : v x≠0 · let G := (x.1ᵀ*x.2 : Mat J J) have hx : gramGood G x := ⟨rfl,Classical.byContradiction fun he => h (hg x he)⟩ let m := bp (-num J*num J)/4 have he (y : Mat U J × Mat U J) (hy : gramGood G y) : v y=v x := by obtain ⟨L,hL⟩ := move_exists G x y hx hy let e := L.perm (I⊕J) (I⊕J) have hl (y) : f (e y)=(L.perm J J) (f y) := Prod.ext (Matrix.mul_assoc ..) (Matrix.mul_assoc ..) have hp y : w (e y)=w y := by unfold w; rw [unifOn_val, unifOn_val] congr 2 exact propext (L.invar C y).symm exact hL ▸ mapW_pr_eq e f (L.perm J J) hl w hp x have hi := pmax_test (gramGood (U:=U) G) hv.sub he (m:=m) (div_pos (bp_pos _) (by norm_num)) (gram_norm_quarter G (by linarith only [hN])) apply hi.trans unfold m; rw [neg_mul,bp_neg]; field_simp exact le_rfl · change v x ≤ _ rw [not_ne_iff.mp h] exact mul_nonneg (mul_nonneg (by norm_num) (bp_pos _).le) (unif_subLaw.nz _)
variable {p : Shape} {n N : ℕ}abbrev HMat (p : Shape) (N : ℕ) := Mat (Fin N) (Chan p)abbrev HFrame (p : Shape) (N : ℕ) := HMat p N × HMat p Nabbrev HCube (p : Shape) (N : ℕ) := Comp p.g → HFrame p N
def hchan (p : Shape) {n N} (x : Oframe p n N) : HFrame p N := (channel x.1,channel x.2)def hcube (p : Shape) {n N} (x : Orient p n N) : HCube p N := fun z => hchan p (x z)def lawH (p : Shape) (N : ℕ) : Wgt (HCube p N) := prodW (fun (_ : Comp p.g) => pairW unif unif)
def intoChan (p : Shape) (n) : Mat (Full p n) (Chan p) := embedMat (.inr ·)
theorem intoChan_inj : Injective (intoChan p n).mulVec := embedMat_inj Sum.inr_injectivetheorem intoChan_val (p : Shape) {n N} (x : Mat (Fin N) (Full p n)) : x * intoChan p n=channel x := by rw [intoChan,mul_embedMat]; rfltheorem hchan_val (p : Shape) {n N} : hchan p (n:=n) (N:=N) = observe (intoChan p n) (intoChan p n) := by funext x exact Prod.ext (intoChan_val ..).symm (intoChan_val ..).symm
def chanPrice (p : Shape) : ℝ := (4*bp ((p.h:ℝ)*p.h))^(Fintype.card (Comp p.g))
theorem hchan_cap (m : Mixer p n) (hN : 2*num (Full p n)-N≤ -1) : let w := unifOn (FramesAt (U:=Fin N) (gramCond m)) ∀ x : HFrame p N,mapW w (hchan p) x≤(4*bp ((p.h:ℝ)*p.h))*pairW unif unif x := by classical have he : 2*num (Full p n)-num (Fin N)≤ -1 := by simpa [num] using hN have hh : ∃ x : Oframe p n N, FramesAt (gramCond m) x := framesAt_exists (gramCond_exists m) (by linarith only [he]) rw [hchan_val] have hr : num (Chan p) ≤ num (Full p n) := by have hf : Fintype.card (Row p n) + Fintype.card (Chan p)=Fintype.card (Full p n) := (Fintype.card_sum ..).symm exact_mod_cast (show Fintype.card (Chan p)≤Fintype.card (Full p n) by omega) have hk := gramObsCap hh (intoChan p n) intoChan_inj (by linarith only [he,hr]) rw [show num (Chan p)=(p.h:ℝ) from (by simp [num,Chan])] at hk exact hk
theorem hcube_cap (m : Mixer p n) (hN : 2*num (Full p n)-N≤ -1) (x : HCube p N) : mapW (raw m N) (hcube p) x ≤ chanPrice p*lawH p N x := by let w := unifOn (FramesAt (U:=Fin N) (gramCond m)) have hh i := hchan_cap m hN (x i) change mapW (prodW (fun (_ : Comp p.g) => w)) _ x ≤ _ unfold hcube rw [mapW_repeat (w:=fun (_:Comp p.g) => w) (f:=fun i => hchan p (n:=n) (N:=N))] refine le_trans (Finset.prod_le_prod₀ ?_ fun i _ => hh i) ?_ · intro i _ exact pr_nonneg (unifOn_sub _).nz rw [Finset.prod_mul_distrib] simp [chanPrice,lawH,prodW]
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204import OAI.Combinatorics.HadwigerCounterexample.UnaryRecords
import OAI.Combinatorics.HadwigerCounterexample.ConstructionScales
namespace OAI
/-! # Collision Inequality -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Module Finset Filter
open scoped BigOperators
variable {p : Shape} {n N : ℕ}
variable {I A B : Type} [Fintype I] [Fintype A] [Fintype B]
def density (v w : Wgt I) := fun x => w x/v x
def overlap (v a b : Wgt I) :=
avg v (fun x => density v a x*density v b x)
theorem overlap_count (P : I→Prop) (p q : Wgt I) (h : ∀ x, 0 ≤ p x) (h' : ∀ x, 0≤ q x) :
overlap (unifOn P) p q ≤ (Fintype.card I:ℝ) * (∑ i, p i*q i) := by
classical
simp only [overlap,density, avg,Finset.mul_sum]
refine Finset.sum_le_sum fun i _ => ?_
have hg := mul_nonneg (h i) (h' i)
have hw : 0 ≤ (↑(Fintype.card I) : ℝ) := Nat.cast_nonneg _
by_cases he : P i
· have hh : 0 < nbr P := by
have hpos : 0 < Fintype.card {x//P x} := Fintype.card_pos_iff.mpr ⟨⟨i,he⟩⟩
rw [nbr_eq_card]; exact_mod_cast hpos
have hd : unifOn P i * (p i/unifOn P i * (q i / unifOn P i))=nbr P*(p i*q i) := by
rw [unifOn_val,ind_one he]
field_simp
rw [hd]
apply mul_le_mul_of_nonneg_right _ hg
rw [nbr_eq_card]
exact_mod_cast Fintype.card_le_of_injective _ (@Subtype.val_injective _ P)
rw [unifOn_carried P i he,zero_mul]
exact mul_nonneg hw hg
namespace Volley
/-- law of accepted keys as an unnormalized histogram -/
def hist (v : A → Volley p n I) (t : Tagging p I)
(μ : Wgt (UnitType p n N)) (rho' : Wgt A) (U : A → UnitType p n N → Prop) :
Wgt (Keys (p:=p) t N) :=
fun u => avg rho' (fun a => pr μ (fun x => U a x ∧ (v a).keys t x=u))
set_option maxHeartbeats 800000 in
private theorem record_sum (v w : Volley p n I) {t : Tagging p I} (m : Mixer p n)
{a b : Pin p n N} {μ δ : Wgt (UnitType p n N)}
(U V : UnitType p n N → Prop)
(ha : ∀ x, U x → a.agree x ∧ (∀ i,frameLaw m (onSide x i)))
(hb : ∀ x, V x → b.agree x ∧ (∀ i,frameLaw m (onSide x i)))
{ζ : ℝ} {q : ℕ}
(h : ∀ x,U x → ∀ y,V y → v.keys t x=w.keys t y → v.promised w t m a.sp b.sp x y)
(hv : v.avoids a.sp q) (hw : w.avoids b.sp q)
(hz : ζ ≤ 0.004) (hK : ζ*(kslots p I) ≤ 0.004)
(hμ : SubLaw μ) (hδ : SubLaw δ)
(hA : a.clear ζ μ) (hB : b.clear ζ δ)
(hN : 100 ≤ N) (hT : (dim (CheckGram p n) : ℝ) ≤ 0.01*N)
(L : ℝ)
(hLf : bp (dim (Ledger (v.frozen a.sp t))) ≤ L)
(hLg : bp (dim (Ledger (w.frozen b.sp t))) ≤ L) :
hit N *
(∑ u : Keys (p:=p) t N, pr μ (fun x => U x ∧ v.keys t x=u) *
pr δ (fun x => V x ∧ w.keys t x=u)) ≤
pr (pairW μ δ) (fun x => (rawHoles m).conflict x.1 x.2)+
2*(hit N*tau N (kslots p I)*L) := by
classical
let X := UnitType p n N
let T := Keys (p:=p) t N
let K (u : T) (x : X) := U x ∧ v.keys t x=u
let K' (u : T) (x : X) := V x ∧ w.keys t x=u
let H := hit N*tau N (kslots p I)*L
let P := pairW μ δ
let C (x : X × X) := (rawHoles m).conflict x.1 x.2
let G (u : T) (x : X × X) := K u x.1 ∧ K' u x.2 ∧ C x
rw [Finset.mul_sum]
have hh (i : Keys (p:=p) t N) :
hit N * (pr μ (K i) * pr δ (K' i))≤ pr P (G i)+H*(pr μ (K i)+pr δ (K' i)) := by
apply record_hit v w m (K i) (K' i) i _ _ _ hv hw hz hK hμ hδ hA hB hN hT L hLf hLg
· exact fun x h => ⟨(ha x h.1).1,(ha x h.1).2,h.2⟩
· exact fun x h => ⟨(hb x h.1).1,(hb x h.1).2,h.2⟩
exact fun x hx y hy => h x hx.1 y hy.1 (hx.2.trans hy.2.symm)
refine (Finset.sum_le_sum fun i _ => hh i).trans ?_
rw [Finset.sum_add_distrib]
have hi : (∑ i : Keys (p:=p) t N, pr P (G i)) ≤ pr P C := by
rw [← sum_pr_tag P C (v.keys t ∘ Prod.fst)]
exact Finset.sum_le_sum fun i _ => pr_mono (subLaw_pair hμ hδ).nz (fun x h => ⟨h.2.2,h.1.2⟩)
refine add_le_add hi ?_
have hU : (∑ i : Keys (p:=p) t N, pr μ (K i))≤1 :=
(sum_pr_tag μ U (v.keys t)).trans_le ((pr_le_tot hμ.nz).trans hμ.total)
have hV : (∑ i : Keys (p:=p) t N, pr δ (K' i))≤1 :=
(sum_pr_tag δ V (w.keys t)).trans_le ((pr_le_tot hδ.nz).trans hδ.total)
have hz : 0 ≤ H := mul_nonneg (mul_nonneg (bp_pos _).le (bp_pos _).le) ((bp_pos _).le.trans hLf)
rw [← Finset.mul_sum,Finset.sum_add_distrib,mul_comm 2]
exact mul_le_mul_of_nonneg_left (by linarith only [hU,hV]) hz
set_option maxHeartbeats 1200000 in
theorem collision (v : A→Volley p n I) (w : B→Volley p n I)
{t : Tagging p I} (m : Mixer p n)
{a b : Pin p n N} {μ δ : Wgt (UnitType p n N)}
(rhoA : Wgt A) (rhoB : Wgt B)
(U : A → UnitType p n N → Prop) (V : B → UnitType p n N → Prop)
(ha : ∀ i x, U i x → a.agree x ∧ (∀ i,frameLaw m (onSide x i)))
(hb : ∀ i x, V i x → b.agree x ∧ (∀ i,frameLaw m (onSide x i)))
{ζ : ℝ} {q K : ℕ}
(h : ∀ i j x,U i x → ∀ y,V j y → (v i).keys t x=(w j).keys t y →
(v i).promised (w j) t m a.sp b.sp x y)
(hv : ∀ i, (v i).avoids a.sp q) (hw : ∀ i, (w i).avoids b.sp q)
(hκ : planRank a.sp≤K) (hκ' : planRank b.sp≤K)
(hz : ζ ≤ 0.004) (hK : ζ*(kslots p I) ≤ 0.004) (hslots : kslots p I≤kmax p)
(hμ : SubLaw μ) (hδ : SubLaw δ) (hu : SubLaw rhoA) (hu' : SubLaw rhoB)
(hA : a.clear ζ μ) (hB : b.clear ζ δ)
(hN : 100 ≤ N) (hT : (dim (CheckGram p n) : ℝ) ≤ 0.01*N)
(hL : (K+(kmax p:ℝ))*num (JointIdx p n) ≤ 0.005*N)
(J : Keys (p:=p) t N → Prop) :
overlap (unifOn J) (hist v t μ rhoA U) (hist w t δ rhoB V) ≤
bp (((kslots p I:ℝ)+0.02)*N)*pr (pairW μ δ) (fun x =>
(rawHoles m).conflict x.1 x.2) + 2*bp (-0.005*N) := by
classical
let k := kslots p I
let L := bp (0.005*N)
let C := fun (x : UnitType p n N × _) => (rawHoles m).conflict x.1 x.2
let X := hist v t μ rhoA U
let Y := hist w t δ rhoB V
let H := hit N*tau N k*L
let D := pr (pairW μ δ) C
let α (u : Keys (p:=p) t N) i := pr μ (fun x => U i x ∧ (v i).keys t x=u)
let β (u : Keys (p:=p) t N) i := pr δ (fun x => V i x ∧ (w i).keys t x=u)
have hX u : 0≤ X u := avg_nonneg hu.nz (fun i => pr_nonneg hμ.nz)
have hY u : 0≤ Y u := avg_nonneg hu'.nz (fun i => pr_nonneg hδ.nz)
have hW (f : Plan p n) (hk : planRank f ≤ K) (v : Volley p n I) (hv : v.avoids f q) :
bp (dim (Ledger (v.frozen f t)))≤L := by
apply bp_le
rw [ledger_dim]
push_cast
have ht : (planRank (v.frozen f t) : ℝ) ≤ K+(kmax p:ℝ) := by
have hh := plan_add_rank f (v.keyPlan t)
rw [key_slots t hv] at hh
exact_mod_cast (show planRank (f⊔v.keyPlan t) ≤ K+kmax p from
hh.symm ▸ add_le_add hk hslots)
exact le_trans (mul_le_mul_of_nonneg_right ht (Nat.cast_nonneg _)) hL
have hf (x : A × B) :
hit N * (∑ u : Keys (p:=p) t N, α u x.1*β u x.2) ≤ D+ 2*H :=
record_sum (v x.1) (w x.2) m (U _) (V _) (ha x.1) (hb x.2) (h x.1 x.2)
(hv x.1) (hw x.2) hz hK hμ hδ hA hB hN hT L (hW a.sp hκ _ (hv _)) (hW _ hκ' _ (hw _))
have hh : hit N * (∑ u : Keys (p:=p) t N,X u * Y u) ≤ D + 2*H := by
let F := pairW rhoA rhoB
have hh' : 0 ≤ D+2*H := by
apply add_nonneg (pr_nonneg (subLaw_pair hμ hδ).nz)
exact mul_nonneg (by norm_num) (mul_nonneg (mul_nonneg (bp_pos _).le (bp_pos _).le)
(bp_pos _).le)
have hl := (subLaw_pair hu hu').avg_le hh' hf
rw [avg_mul',avg_sum] at hl
have ht (u : Keys (p:=p) t N) :
X u*Y u=avg F (fun x : A×B => α u x.1*β u x.2) := (pairW_separate ..).symm
simp_rw [ht]; exact hl
apply (overlap_count J X Y hX hY).trans
rw [card_space,dim_keys,Nat.cast_mul]
let Z := bp (((k:ℝ)+0.02)*N)
have he : Z*hit N = bp ((k:ℝ)*N) := by
unfold Z hit; rw [← bp_add]; congr 1; ring
have he' : Z*H = bp (-0.005*N) := by
unfold H; rw [← mul_assoc,← mul_assoc,he]
unfold L tau
rw [← bp_add,← bp_add]; congr 1; ring
change bp ((k:ℝ)*N)*_≤ Z*D+_
rw [← he, mul_assoc,← he']
refine (mul_le_mul_of_nonneg_left hh (bp_pos _).le).trans_eq ?_
ring
end Volley
theorem collision_scales (p : Shape) (K : ℕ) :
∀ᶠ M : ℕ in atTop,∀ᶠ n : ℕ in atTop, let N := M*n;
100≤N ∧ (dim (CheckGram p n):ℝ) ≤ 0.01*N ∧
(K+(kmax p:ℝ))*num (JointIdx p n) ≤ 0.005*N := by
filter_upwards [columns_budget p (δ:=0.01) (by norm_num)
(16*(ncComp p:ℝ)*p.h) 0 (by positivity) (by norm_num),
columns_budget p (δ:=0.005) (by norm_num)
(2*(K+(kmax p:ℝ))) 0 (by positivity) (by norm_num),eventually_ge_atTop 1] with M hM hB hg
filter_upwards [eventually_ge_atTop 100] with n hn
specialize hM n (by omega)
specialize hB n (by omega)
have hN : 100 ≤ M*n := by nlinarith
refine ⟨hN,?_,?_⟩
· rw [checkgram_dim]
simp only [Nat.cast_mul,Nat.cast_ofNat]; unfold num at hM
have hi : (↑(Fintype.card (Row p n)):ℝ)≤Fintype.card (Full p n) := by
have he : Fintype.card (Full p n)=_+_ := Fintype.card_sum ..
exact_mod_cast (show Fintype.card (Row p n)≤Fintype.card (Full p n) from he.symm ▸
Nat.le_add_right ..)
rw [add_zero] at hM
rw [Nat.cast_mul] at hM
exact le_trans (mul_le_mul_of_nonneg_left hi (by positivity)) hM
rw [show num (JointIdx p n) = 2*num (Full p n) from (by
unfold num JointIdx; rw [Fintype.card_sum]; push_cast; ring)]
linarith only [hB]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.UnaryRecordsimport OAI.Combinatorics.HadwigerCounterexample.ConstructionScales
namespace OAI
/-! # Collision Inequality -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Module Finset Filteropen scoped BigOperatorsvariable {p : Shape} {n N : ℕ}variable {I A B : Type} [Fintype I] [Fintype A] [Fintype B]
def density (v w : Wgt I) := fun x => w x/v xdef overlap (v a b : Wgt I) := avg v (fun x => density v a x*density v b x)
theorem overlap_count (P : I→Prop) (p q : Wgt I) (h : ∀ x, 0 ≤ p x) (h' : ∀ x, 0≤ q x) : overlap (unifOn P) p q ≤ (Fintype.card I:ℝ) * (∑ i, p i*q i) := by classical simp only [overlap,density, avg,Finset.mul_sum] refine Finset.sum_le_sum fun i _ => ?_ have hg := mul_nonneg (h i) (h' i) have hw : 0 ≤ (↑(Fintype.card I) : ℝ) := Nat.cast_nonneg _ by_cases he : P i · have hh : 0 < nbr P := by have hpos : 0 < Fintype.card {x//P x} := Fintype.card_pos_iff.mpr ⟨⟨i,he⟩⟩ rw [nbr_eq_card]; exact_mod_cast hpos have hd : unifOn P i * (p i/unifOn P i * (q i / unifOn P i))=nbr P*(p i*q i) := by rw [unifOn_val,ind_one he] field_simp rw [hd] apply mul_le_mul_of_nonneg_right _ hg rw [nbr_eq_card] exact_mod_cast Fintype.card_le_of_injective _ (@Subtype.val_injective _ P) rw [unifOn_carried P i he,zero_mul] exact mul_nonneg hw hg
namespace Volley
/-- law of accepted keys as an unnormalized histogram -/def hist (v : A → Volley p n I) (t : Tagging p I) (μ : Wgt (UnitType p n N)) (rho' : Wgt A) (U : A → UnitType p n N → Prop) : Wgt (Keys (p:=p) t N) := fun u => avg rho' (fun a => pr μ (fun x => U a x ∧ (v a).keys t x=u))
set_option maxHeartbeats 800000 inprivate theorem record_sum (v w : Volley p n I) {t : Tagging p I} (m : Mixer p n) {a b : Pin p n N} {μ δ : Wgt (UnitType p n N)} (U V : UnitType p n N → Prop) (ha : ∀ x, U x → a.agree x ∧ (∀ i,frameLaw m (onSide x i))) (hb : ∀ x, V x → b.agree x ∧ (∀ i,frameLaw m (onSide x i))) {ζ : ℝ} {q : ℕ} (h : ∀ x,U x → ∀ y,V y → v.keys t x=w.keys t y → v.promised w t m a.sp b.sp x y) (hv : v.avoids a.sp q) (hw : w.avoids b.sp q) (hz : ζ ≤ 0.004) (hK : ζ*(kslots p I) ≤ 0.004) (hμ : SubLaw μ) (hδ : SubLaw δ) (hA : a.clear ζ μ) (hB : b.clear ζ δ) (hN : 100 ≤ N) (hT : (dim (CheckGram p n) : ℝ) ≤ 0.01*N) (L : ℝ) (hLf : bp (dim (Ledger (v.frozen a.sp t))) ≤ L) (hLg : bp (dim (Ledger (w.frozen b.sp t))) ≤ L) : hit N * (∑ u : Keys (p:=p) t N, pr μ (fun x => U x ∧ v.keys t x=u) * pr δ (fun x => V x ∧ w.keys t x=u)) ≤ pr (pairW μ δ) (fun x => (rawHoles m).conflict x.1 x.2)+ 2*(hit N*tau N (kslots p I)*L) := by classical let X := UnitType p n N let T := Keys (p:=p) t N let K (u : T) (x : X) := U x ∧ v.keys t x=u let K' (u : T) (x : X) := V x ∧ w.keys t x=u let H := hit N*tau N (kslots p I)*L let P := pairW μ δ let C (x : X × X) := (rawHoles m).conflict x.1 x.2 let G (u : T) (x : X × X) := K u x.1 ∧ K' u x.2 ∧ C x rw [Finset.mul_sum] have hh (i : Keys (p:=p) t N) : hit N * (pr μ (K i) * pr δ (K' i))≤ pr P (G i)+H*(pr μ (K i)+pr δ (K' i)) := by apply record_hit v w m (K i) (K' i) i _ _ _ hv hw hz hK hμ hδ hA hB hN hT L hLf hLg · exact fun x h => ⟨(ha x h.1).1,(ha x h.1).2,h.2⟩ · exact fun x h => ⟨(hb x h.1).1,(hb x h.1).2,h.2⟩ exact fun x hx y hy => h x hx.1 y hy.1 (hx.2.trans hy.2.symm) refine (Finset.sum_le_sum fun i _ => hh i).trans ?_ rw [Finset.sum_add_distrib] have hi : (∑ i : Keys (p:=p) t N, pr P (G i)) ≤ pr P C := by rw [← sum_pr_tag P C (v.keys t ∘ Prod.fst)] exact Finset.sum_le_sum fun i _ => pr_mono (subLaw_pair hμ hδ).nz (fun x h => ⟨h.2.2,h.1.2⟩) refine add_le_add hi ?_ have hU : (∑ i : Keys (p:=p) t N, pr μ (K i))≤1 := (sum_pr_tag μ U (v.keys t)).trans_le ((pr_le_tot hμ.nz).trans hμ.total) have hV : (∑ i : Keys (p:=p) t N, pr δ (K' i))≤1 := (sum_pr_tag δ V (w.keys t)).trans_le ((pr_le_tot hδ.nz).trans hδ.total) have hz : 0 ≤ H := mul_nonneg (mul_nonneg (bp_pos _).le (bp_pos _).le) ((bp_pos _).le.trans hLf) rw [← Finset.mul_sum,Finset.sum_add_distrib,mul_comm 2] exact mul_le_mul_of_nonneg_left (by linarith only [hU,hV]) hz
set_option maxHeartbeats 1200000 intheorem collision (v : A→Volley p n I) (w : B→Volley p n I) {t : Tagging p I} (m : Mixer p n) {a b : Pin p n N} {μ δ : Wgt (UnitType p n N)} (rhoA : Wgt A) (rhoB : Wgt B) (U : A → UnitType p n N → Prop) (V : B → UnitType p n N → Prop) (ha : ∀ i x, U i x → a.agree x ∧ (∀ i,frameLaw m (onSide x i))) (hb : ∀ i x, V i x → b.agree x ∧ (∀ i,frameLaw m (onSide x i))) {ζ : ℝ} {q K : ℕ} (h : ∀ i j x,U i x → ∀ y,V j y → (v i).keys t x=(w j).keys t y → (v i).promised (w j) t m a.sp b.sp x y) (hv : ∀ i, (v i).avoids a.sp q) (hw : ∀ i, (w i).avoids b.sp q) (hκ : planRank a.sp≤K) (hκ' : planRank b.sp≤K) (hz : ζ ≤ 0.004) (hK : ζ*(kslots p I) ≤ 0.004) (hslots : kslots p I≤kmax p) (hμ : SubLaw μ) (hδ : SubLaw δ) (hu : SubLaw rhoA) (hu' : SubLaw rhoB) (hA : a.clear ζ μ) (hB : b.clear ζ δ) (hN : 100 ≤ N) (hT : (dim (CheckGram p n) : ℝ) ≤ 0.01*N) (hL : (K+(kmax p:ℝ))*num (JointIdx p n) ≤ 0.005*N) (J : Keys (p:=p) t N → Prop) : overlap (unifOn J) (hist v t μ rhoA U) (hist w t δ rhoB V) ≤ bp (((kslots p I:ℝ)+0.02)*N)*pr (pairW μ δ) (fun x => (rawHoles m).conflict x.1 x.2) + 2*bp (-0.005*N) := by classical let k := kslots p I let L := bp (0.005*N) let C := fun (x : UnitType p n N × _) => (rawHoles m).conflict x.1 x.2 let X := hist v t μ rhoA U let Y := hist w t δ rhoB V let H := hit N*tau N k*L let D := pr (pairW μ δ) C let α (u : Keys (p:=p) t N) i := pr μ (fun x => U i x ∧ (v i).keys t x=u) let β (u : Keys (p:=p) t N) i := pr δ (fun x => V i x ∧ (w i).keys t x=u) have hX u : 0≤ X u := avg_nonneg hu.nz (fun i => pr_nonneg hμ.nz) have hY u : 0≤ Y u := avg_nonneg hu'.nz (fun i => pr_nonneg hδ.nz) have hW (f : Plan p n) (hk : planRank f ≤ K) (v : Volley p n I) (hv : v.avoids f q) : bp (dim (Ledger (v.frozen f t)))≤L := by apply bp_le rw [ledger_dim] push_cast have ht : (planRank (v.frozen f t) : ℝ) ≤ K+(kmax p:ℝ) := by have hh := plan_add_rank f (v.keyPlan t) rw [key_slots t hv] at hh exact_mod_cast (show planRank (f⊔v.keyPlan t) ≤ K+kmax p from hh.symm ▸ add_le_add hk hslots) exact le_trans (mul_le_mul_of_nonneg_right ht (Nat.cast_nonneg _)) hL have hf (x : A × B) : hit N * (∑ u : Keys (p:=p) t N, α u x.1*β u x.2) ≤ D+ 2*H := record_sum (v x.1) (w x.2) m (U _) (V _) (ha x.1) (hb x.2) (h x.1 x.2) (hv x.1) (hw x.2) hz hK hμ hδ hA hB hN hT L (hW a.sp hκ _ (hv _)) (hW _ hκ' _ (hw _)) have hh : hit N * (∑ u : Keys (p:=p) t N,X u * Y u) ≤ D + 2*H := by let F := pairW rhoA rhoB have hh' : 0 ≤ D+2*H := by apply add_nonneg (pr_nonneg (subLaw_pair hμ hδ).nz) exact mul_nonneg (by norm_num) (mul_nonneg (mul_nonneg (bp_pos _).le (bp_pos _).le) (bp_pos _).le) have hl := (subLaw_pair hu hu').avg_le hh' hf rw [avg_mul',avg_sum] at hl have ht (u : Keys (p:=p) t N) : X u*Y u=avg F (fun x : A×B => α u x.1*β u x.2) := (pairW_separate ..).symm simp_rw [ht]; exact hl apply (overlap_count J X Y hX hY).trans rw [card_space,dim_keys,Nat.cast_mul] let Z := bp (((k:ℝ)+0.02)*N) have he : Z*hit N = bp ((k:ℝ)*N) := by unfold Z hit; rw [← bp_add]; congr 1; ring have he' : Z*H = bp (-0.005*N) := by unfold H; rw [← mul_assoc,← mul_assoc,he] unfold L tau rw [← bp_add,← bp_add]; congr 1; ring change bp ((k:ℝ)*N)*_≤ Z*D+_ rw [← he, mul_assoc,← he'] refine (mul_le_mul_of_nonneg_left hh (bp_pos _).le).trans_eq ?_ ringend Volley
theorem collision_scales (p : Shape) (K : ℕ) : ∀ᶠ M : ℕ in atTop,∀ᶠ n : ℕ in atTop, let N := M*n; 100≤N ∧ (dim (CheckGram p n):ℝ) ≤ 0.01*N ∧ (K+(kmax p:ℝ))*num (JointIdx p n) ≤ 0.005*N := by filter_upwards [columns_budget p (δ:=0.01) (by norm_num) (16*(ncComp p:ℝ)*p.h) 0 (by positivity) (by norm_num), columns_budget p (δ:=0.005) (by norm_num) (2*(K+(kmax p:ℝ))) 0 (by positivity) (by norm_num),eventually_ge_atTop 1] with M hM hB hg filter_upwards [eventually_ge_atTop 100] with n hn specialize hM n (by omega) specialize hB n (by omega) have hN : 100 ≤ M*n := by nlinarith refine ⟨hN,?_,?_⟩ · rw [checkgram_dim] simp only [Nat.cast_mul,Nat.cast_ofNat]; unfold num at hM have hi : (↑(Fintype.card (Row p n)):ℝ)≤Fintype.card (Full p n) := by have he : Fintype.card (Full p n)=_+_ := Fintype.card_sum .. exact_mod_cast (show Fintype.card (Row p n)≤Fintype.card (Full p n) from he.symm ▸ Nat.le_add_right ..) rw [add_zero] at hM rw [Nat.cast_mul] at hM exact le_trans (mul_le_mul_of_nonneg_left hi (by positivity)) hM rw [show num (JointIdx p n) = 2*num (Full p n) from (by unfold num JointIdx; rw [Fintype.card_sum]; push_cast; ring)] linarith only [hB]
end HadwigerCounterexample
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787912345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879import OAI.Combinatorics.HadwigerCounterexample.RectangleComparisons
namespace OAI
/-! # Common Partition Refinement -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Matrix Function
open scoped BigOperators Topology
variable {p:Shape} {n N K M r : ℕ}
def refines {r r':ℕ} (Y:Silhouette p N r) (Y':Silhouette p N r') :=
∀ l q, ∃ f:Fin r→Fin r',∀ x,Y' l q x=f (Y l q x)
theorem self_refine (Y:Silhouette p N r): refines Y Y :=
fun _ _=> ⟨id,fun _=>rfl⟩
theorem refines_next {r s t:ℕ} {Y:Silhouette p N r} {X:Silhouette p N s}
{Z:Silhouette p N t} (h : refines Y X) (hg : refines X Z) :
refines Y Z := by
intro l q
obtain ⟨f,hf⟩:=h l q; obtain ⟨g,hg⟩:=hg l q
refine ⟨g∘ f,fun x => ?_⟩; rw [hg,hf]; rfl
variable {A B : Type} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B]
def bouquet (f : A→ℕ) := Fintype.card ((i:A)→ Fin (f i))
def bundleY (f:A→ℕ) (w: (i:A)→ Silhouette p N (f i)) :
Silhouette p N (bouquet f) :=
fun l q x=> Fintype.equivFin ((i:A)→ Fin (f i)) (fun i=> w i l q x)
theorem bundle_refines (f:A→ℕ) (w:(i:A)→ Silhouette p N (f i)) :
∀ i,refines (bundleY f w) (w i) := by
intro i l q
let e:= Fintype.equivFin ((i:A)→Fin (f i))
exact ⟨fun x=> e.symm x i,fun x=>(congr_fun (e.symm_apply_apply (fun i=> w i l q x)) i).symm⟩
def duoY {r s} (Y : Silhouette p N r) (X : Silhouette p N s) :
Silhouette p N (r*s) :=
open scoped Classical in fun i q x => finProdFinEquiv (Y i q x,X i q x)
theorem duo_good {r s} (Y : Silhouette p N r) (X : Silhouette p N s) :
refines (duoY Y X) Y ∧ refines (duoY Y X) X := by
let e : Fin r × Fin s ≃ Fin (r*s):=finProdFinEquiv
constructor
· intro i j; exact ⟨fun k=>(e.symm k).1,fun x=> (congrArg Prod.fst
(e.symm_apply_apply (Y i j x,X i j x))).symm⟩
intro i j; exact ⟨fun k=>(e.symm k).2,fun x=> (congrArg Prod.snd
(e.symm_apply_apply (Y i j x,X i j x))).symm⟩
namespace StatusAnalysis
variable (v : Template p A)
def paletteSize (A B : Type) [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B] := Fintype.card (B × A → Bool)
theorem buildPalette (N : ℕ) (q : A → F) (w : B → Template.Paint v N) :
∃ Y : Silhouette p N (paletteSize A B),∀ i,pigments q Y (w i) := by
classical
let E := Fintype.equivFin (B × A→Bool)
let H (l) (q:F) (x : AtomKey (p:=p) l N) (i:B) (j:A) :=
if h:v.t j=l then decide ((w i).flies j (h ▸ x)) else false
let Y : Silhouette p N (paletteSize A B) :=
fun l q x=> E (fun i=> H l q x i.1 i.2)
refine ⟨Y,fun i j=>⟨fun x=>(E.symm x (i,j)),fun x=>?_⟩⟩
change _ ↔ E.symm (E (fun i => H (v.t j) (q j) x i.1 i.2)) (i,j)=true
rw [Equiv.symm_apply_apply]
unfold H; rw [dite_eq_left rfl]; simp
omit [Fintype A] [DecidableEq A] in
theorem finerPigment {v : Template p A} {r s:ℕ} (Y : Silhouette p N r)
(Y' : Silhouette p N s) (h : refines Y' Y) {q} (w : Template.Paint v N)
(hh : pigments q Y w) : pigments q Y' w := by
intro i
obtain ⟨g,hg⟩:=hh i; obtain ⟨f,hf⟩:=h (v.t i) (q i)
exact ⟨g∘ f,fun x=> (hg x).trans (by rw [hf]; rfl)⟩
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.RectangleComparisons
namespace OAI
/-! # Common Partition Refinement -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Matrix Functionopen scoped BigOperators Topologyvariable {p:Shape} {n N K M r : ℕ}
def refines {r r':ℕ} (Y:Silhouette p N r) (Y':Silhouette p N r') := ∀ l q, ∃ f:Fin r→Fin r',∀ x,Y' l q x=f (Y l q x)
theorem self_refine (Y:Silhouette p N r): refines Y Y := fun _ _=> ⟨id,fun _=>rfl⟩theorem refines_next {r s t:ℕ} {Y:Silhouette p N r} {X:Silhouette p N s} {Z:Silhouette p N t} (h : refines Y X) (hg : refines X Z) : refines Y Z := by intro l q obtain ⟨f,hf⟩:=h l q; obtain ⟨g,hg⟩:=hg l q refine ⟨g∘ f,fun x => ?_⟩; rw [hg,hf]; rfl
variable {A B : Type} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B]
def bouquet (f : A→ℕ) := Fintype.card ((i:A)→ Fin (f i))def bundleY (f:A→ℕ) (w: (i:A)→ Silhouette p N (f i)) : Silhouette p N (bouquet f) := fun l q x=> Fintype.equivFin ((i:A)→ Fin (f i)) (fun i=> w i l q x)theorem bundle_refines (f:A→ℕ) (w:(i:A)→ Silhouette p N (f i)) : ∀ i,refines (bundleY f w) (w i) := by intro i l q let e:= Fintype.equivFin ((i:A)→Fin (f i)) exact ⟨fun x=> e.symm x i,fun x=>(congr_fun (e.symm_apply_apply (fun i=> w i l q x)) i).symm⟩
def duoY {r s} (Y : Silhouette p N r) (X : Silhouette p N s) : Silhouette p N (r*s) := open scoped Classical in fun i q x => finProdFinEquiv (Y i q x,X i q x)theorem duo_good {r s} (Y : Silhouette p N r) (X : Silhouette p N s) : refines (duoY Y X) Y ∧ refines (duoY Y X) X := by let e : Fin r × Fin s ≃ Fin (r*s):=finProdFinEquiv constructor · intro i j; exact ⟨fun k=>(e.symm k).1,fun x=> (congrArg Prod.fst (e.symm_apply_apply (Y i j x,X i j x))).symm⟩ intro i j; exact ⟨fun k=>(e.symm k).2,fun x=> (congrArg Prod.snd (e.symm_apply_apply (Y i j x,X i j x))).symm⟩
namespace StatusAnalysisvariable (v : Template p A)
def paletteSize (A B : Type) [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B] := Fintype.card (B × A → Bool)theorem buildPalette (N : ℕ) (q : A → F) (w : B → Template.Paint v N) : ∃ Y : Silhouette p N (paletteSize A B),∀ i,pigments q Y (w i) := by classical let E := Fintype.equivFin (B × A→Bool) let H (l) (q:F) (x : AtomKey (p:=p) l N) (i:B) (j:A) := if h:v.t j=l then decide ((w i).flies j (h ▸ x)) else false let Y : Silhouette p N (paletteSize A B) := fun l q x=> E (fun i=> H l q x i.1 i.2) refine ⟨Y,fun i j=>⟨fun x=>(E.symm x (i,j)),fun x=>?_⟩⟩ change _ ↔ E.symm (E (fun i => H (v.t j) (q j) x i.1 i.2)) (i,j)=true rw [Equiv.symm_apply_apply] unfold H; rw [dite_eq_left rfl]; simp
omit [Fintype A] [DecidableEq A] intheorem finerPigment {v : Template p A} {r s:ℕ} (Y : Silhouette p N r) (Y' : Silhouette p N s) (h : refines Y' Y) {q} (w : Template.Paint v N) (hh : pigments q Y w) : pigments q Y' w := by intro i obtain ⟨g,hg⟩:=hh i; obtain ⟨f,hf⟩:=h (v.t i) (q i) exact ⟨g∘ f,fun x=> (hg x).trans (by rw [hf]; rfl)⟩
end StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119import OAI.Combinatorics.HadwigerCounterexample.ProjectionError
namespace OAI
/-! # Common Partitions -/
noncomputable section
namespace HadwigerCounterexample
open Finset Module Matrix Filter Function
open scoped BigOperators
variable {A B I J X : Type} [Fintype A] [Fintype B] [Fintype I] [Fintype J] [Fintype X]
variable (u : Wgt A) (w : Wgt I) (v : Wgt J)
set_option maxHeartbeats 800000 in
theorem rollup [Nonempty B] (hw : IsLaw w) (hv : IsLaw v) (hu : IsLaw u)
(f : I×B→Wgt A) (g : J×B→Wgt A) (h k : I×J→ B) (R : ℝ) (hr : 0<R)
(hg : ∀ i x, |g i x|≤R)
(p : A→X) (ε : ℝ) (hx : wanes (pairW w unif) u f p ε) :
avg (pairW w v) (fun i=> |rebate u (f (i.1,h i)) (g (i.2,k i)) p|) ≤
num B ^ 2 * (R*ε) := by
classical
let H (i : I × B) (j : J × B) := |rebate u (f i) (g j) p|
let T := num B
have ht : 0<T := by unfold T num; positivity
have he j :
avg (pairW w (unif : Wgt B)) (fun i=> H i j)≤ R*ε := by
let g' (i:A) := g j i/R
have hh (i) : |g' i|≤1 := by
unfold g'; rw [abs_div,abs_of_pos hr,div_le_one hr]; exact hg _ _
have hz (i) :
H i j=R* |dip u (fun x=> f i x-banner u p (f i) x) g'| := by
unfold H; rw [rebate_calc _ _ _ _ hu.nz]
unfold g' dip; simp_rw [←mul_div_assoc,avg_div]
rw [abs_div,abs_of_pos hr]; field_simp
simp_rw [hz,avg_mul']; exact mul_le_mul_of_nonneg_left (hx g' hh) hr.le
have hh i j :
H (i,h (i,j)) (j,k (i,j))≤ ∑ b : B,∑ c : B,H (i,b) (j,c) :=
(Finset.single_le_sum (f:=fun x=> H (i,h (i,j)) (j,x)) (fun _ _ => abs_nonneg _) (mem_univ (k (i,j)))).trans
(Finset.single_le_sum (f:=fun x => ∑ c:B,H (i,x) (j,c)) (fun _ _=> Finset.sum_nonneg (fun _ _=>abs_nonneg _)) (mem_univ (h (i,j))))
have hi j c :
avg w (fun i=>∑ b : B,H (i,b) (j,c))≤ T*(R*ε) := by
have hg : ∀ i : I,(∑ b:B,H (i,b) (j,c))=T*avg unif (fun b=> H (i,b) (j,c)) := by
intro i; simp only [avg,unif_apply,← Finset.mul_sum]
change _ = T*(T⁻¹ * _)
rw [←mul_assoc,mul_inv_cancel₀ ht.ne',one_mul]
simp_rw [hg,avg_mul']
refine mul_le_mul_of_nonneg_left ?_ ht.le; rw [← pairW_avg w unif (fun p : I×B=>H p (j,c))]
exact he _
change avg (pairW w v) _ ≤ T^2*(R*ε)
rw [pairW_avg,avg_avg]
refine hv.avg_le fun j=> ?_
have hz i : ∑ b:B,∑ c:B,H (i,b) (j,c)=∑ c:B,∑ b:B,H (i,b) (j,c) :=
Finset.sum_comm
apply (avg_mono hw.nz (fun i => (hh i j).trans_eq (hz i))).trans
rw [avg_sum]
exact (Finset.sum_le_sum fun i _=>hi j i).trans_eq (by
simp only [sum_const,nsmul_eq_mul,Finset.card_univ,T,num]; ring)
set_option maxHeartbeats 1200000 in
theorem global_net (R ε : ℝ) (hr : 0<R) (hε : 0<ε) :
∃ δ : ℝ,0<δ ∧ ∀ r : ℕ,∃ l : ℕ,∀ (I J A : Type) [Fintype I] [Fintype J] [Fintype A]
(w : Wgt I) (v : Wgt J) (u : Wgt A), IsLaw w→IsLaw v →IsLaw u →
∀ (P : I→Wgt A→Prop) (Q : J→Wgt A→Prop), (∀ i,roster (P i) r δ) →
(∀ i,roster (Q i) r δ) →
∃ k : ℕ,k ≤ l∧ ∃ p:A→Fin k,
∀ f g:I × J→Wgt A,(∀ i,P i.1 (f i)) → (∀ i,Q i.2 (g i)) →
avg (pairW w v) (fun i => |rebate u (mcut R u (f i)) (mcut R u (g i)) p|)≤ ε := by
classical
let δ := ε/(8*R)
have hd : 0<δ := by positivity
refine ⟨δ,hd,fun r=>?_⟩
let B:=Fin (r+1); let t:=num B
have ht : 0<t := by unfold t num; positivity
let c:=ε/(2*(t^2)*R)
have hc : 0<c := by positivity
obtain ⟨l,hl⟩:= erosive R c hr.le hc
refine ⟨l,fun I J A _ _ _ w v u hw hv hu P Q hp hq=>?_⟩
choose s hs h1 using fun i=> roster_clip R u hu hr.le (P i) r δ (hp i)
choose y hy h2 using fun i=> roster_clip R u hu hr.le (Q i) r δ (hq i)
let F : I×B→Wgt A := uncurry s
let G : J×B→Wgt A := uncurry y
obtain ⟨m,hm,p,hP⟩:= hl A (I×B) (pairW w unif) u F (pairW_law hw unif_law) hu (fun i j=> hs _ _ _)
refine ⟨m,hm,p,fun f g hf hg=>?_⟩
let f' (i : I×J):= mcut R u (f i)
let g' (i : I×J):= mcut R u (g i)
choose a hA using fun i:I×J => h1 i.1 (f i) (hf i)
choose b hB using fun i:I×J => h2 i.2 (g i) (hg i)
let H (i:I×J) := |rebate u (F (i.1,a i)) (G (i.2,b i)) p|
let D:=pairW w v; have hD:= pairW_law hw hv
have he := rollup u w v hw hv hu F G a b R hr (fun i j=> hy _ _ _) p c hP
have hb : 0≤2*R := by linarith only [hr]
have hi (i:I×J) : |rebate u (f' i) (g' i) p|≤ H i+(δ*(4*R)) := by
let A' := F (i.1,a i); let B' := G (i.2,b i)
have h1 (j) : |g' i j|≤R := by
rw [abs_of_nonneg ((mcut_range _ _ _ hr.le j).1)]
exact (mcut_range _ _ _ hr.le j).2
have h3 : |rebate u (f' i) (g' i) p - rebate u A' (g' i) p|≤ δ*(2*R) := by
exact (rebate_cost u _ _ A' p hu.nz R hr.le h1).trans (mul_le_mul_of_nonneg_right (hA i) hb)
have h4 : |rebate u A' (g' i) p - rebate u A' B' p|≤δ*(2*R) := by
rw [rebate_sym u A',rebate_sym u A']
exact (rebate_cost u _ _ B' p hu.nz R hr.le (fun i=>hs _ _ _)).trans
(mul_le_mul_of_nonneg_right (hB i) hb)
let U:=rebate u A' B' p
let X:=rebate u (f' i) (g' i) p
have hz:= (abs_sub_le X (rebate u A' (g' i) p) U).trans (add_le_add h3 h4)
calc |X| = |(X-U)+U| := by rw [sub_add_cancel]
_ ≤ _ := ((abs_add_le _ _).trans (add_le_add_left hz _)).trans_eq (by
change _+ |U| = |U|+δ*(4*R)
ring)
refine (avg_mono hD.nz hi).trans ?_
rw [avg_add,hD.avg_const]
exact (add_le_add_left he _).trans_eq (by
change t^2*(R*c)+δ*(4*R)=_
unfold δ c; field_simp; ring)
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.ProjectionError
namespace OAI
/-! # Common Partitions -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Module Matrix Filter Functionopen scoped BigOperatorsvariable {A B I J X : Type} [Fintype A] [Fintype B] [Fintype I] [Fintype J] [Fintype X]variable (u : Wgt A) (w : Wgt I) (v : Wgt J)
set_option maxHeartbeats 800000 intheorem rollup [Nonempty B] (hw : IsLaw w) (hv : IsLaw v) (hu : IsLaw u) (f : I×B→Wgt A) (g : J×B→Wgt A) (h k : I×J→ B) (R : ℝ) (hr : 0<R) (hg : ∀ i x, |g i x|≤R) (p : A→X) (ε : ℝ) (hx : wanes (pairW w unif) u f p ε) : avg (pairW w v) (fun i=> |rebate u (f (i.1,h i)) (g (i.2,k i)) p|) ≤ num B ^ 2 * (R*ε) := by classical let H (i : I × B) (j : J × B) := |rebate u (f i) (g j) p| let T := num B have ht : 0<T := by unfold T num; positivity have he j : avg (pairW w (unif : Wgt B)) (fun i=> H i j)≤ R*ε := by let g' (i:A) := g j i/R have hh (i) : |g' i|≤1 := by unfold g'; rw [abs_div,abs_of_pos hr,div_le_one hr]; exact hg _ _ have hz (i) : H i j=R* |dip u (fun x=> f i x-banner u p (f i) x) g'| := by unfold H; rw [rebate_calc _ _ _ _ hu.nz] unfold g' dip; simp_rw [←mul_div_assoc,avg_div] rw [abs_div,abs_of_pos hr]; field_simp simp_rw [hz,avg_mul']; exact mul_le_mul_of_nonneg_left (hx g' hh) hr.le have hh i j : H (i,h (i,j)) (j,k (i,j))≤ ∑ b : B,∑ c : B,H (i,b) (j,c) := (Finset.single_le_sum (f:=fun x=> H (i,h (i,j)) (j,x)) (fun _ _ => abs_nonneg _) (mem_univ (k (i,j)))).trans (Finset.single_le_sum (f:=fun x => ∑ c:B,H (i,x) (j,c)) (fun _ _=> Finset.sum_nonneg (fun _ _=>abs_nonneg _)) (mem_univ (h (i,j)))) have hi j c : avg w (fun i=>∑ b : B,H (i,b) (j,c))≤ T*(R*ε) := by have hg : ∀ i : I,(∑ b:B,H (i,b) (j,c))=T*avg unif (fun b=> H (i,b) (j,c)) := by intro i; simp only [avg,unif_apply,← Finset.mul_sum] change _ = T*(T⁻¹ * _) rw [←mul_assoc,mul_inv_cancel₀ ht.ne',one_mul] simp_rw [hg,avg_mul'] refine mul_le_mul_of_nonneg_left ?_ ht.le; rw [← pairW_avg w unif (fun p : I×B=>H p (j,c))] exact he _ change avg (pairW w v) _ ≤ T^2*(R*ε) rw [pairW_avg,avg_avg] refine hv.avg_le fun j=> ?_ have hz i : ∑ b:B,∑ c:B,H (i,b) (j,c)=∑ c:B,∑ b:B,H (i,b) (j,c) := Finset.sum_comm apply (avg_mono hw.nz (fun i => (hh i j).trans_eq (hz i))).trans rw [avg_sum] exact (Finset.sum_le_sum fun i _=>hi j i).trans_eq (by simp only [sum_const,nsmul_eq_mul,Finset.card_univ,T,num]; ring)
set_option maxHeartbeats 1200000 intheorem global_net (R ε : ℝ) (hr : 0<R) (hε : 0<ε) : ∃ δ : ℝ,0<δ ∧ ∀ r : ℕ,∃ l : ℕ,∀ (I J A : Type) [Fintype I] [Fintype J] [Fintype A] (w : Wgt I) (v : Wgt J) (u : Wgt A), IsLaw w→IsLaw v →IsLaw u → ∀ (P : I→Wgt A→Prop) (Q : J→Wgt A→Prop), (∀ i,roster (P i) r δ) → (∀ i,roster (Q i) r δ) → ∃ k : ℕ,k ≤ l∧ ∃ p:A→Fin k, ∀ f g:I × J→Wgt A,(∀ i,P i.1 (f i)) → (∀ i,Q i.2 (g i)) → avg (pairW w v) (fun i => |rebate u (mcut R u (f i)) (mcut R u (g i)) p|)≤ ε := by classical let δ := ε/(8*R) have hd : 0<δ := by positivity refine ⟨δ,hd,fun r=>?_⟩ let B:=Fin (r+1); let t:=num B have ht : 0<t := by unfold t num; positivity let c:=ε/(2*(t^2)*R) have hc : 0<c := by positivity obtain ⟨l,hl⟩:= erosive R c hr.le hc refine ⟨l,fun I J A _ _ _ w v u hw hv hu P Q hp hq=>?_⟩ choose s hs h1 using fun i=> roster_clip R u hu hr.le (P i) r δ (hp i) choose y hy h2 using fun i=> roster_clip R u hu hr.le (Q i) r δ (hq i) let F : I×B→Wgt A := uncurry s let G : J×B→Wgt A := uncurry y obtain ⟨m,hm,p,hP⟩:= hl A (I×B) (pairW w unif) u F (pairW_law hw unif_law) hu (fun i j=> hs _ _ _) refine ⟨m,hm,p,fun f g hf hg=>?_⟩ let f' (i : I×J):= mcut R u (f i) let g' (i : I×J):= mcut R u (g i) choose a hA using fun i:I×J => h1 i.1 (f i) (hf i) choose b hB using fun i:I×J => h2 i.2 (g i) (hg i) let H (i:I×J) := |rebate u (F (i.1,a i)) (G (i.2,b i)) p| let D:=pairW w v; have hD:= pairW_law hw hv have he := rollup u w v hw hv hu F G a b R hr (fun i j=> hy _ _ _) p c hP have hb : 0≤2*R := by linarith only [hr] have hi (i:I×J) : |rebate u (f' i) (g' i) p|≤ H i+(δ*(4*R)) := by let A' := F (i.1,a i); let B' := G (i.2,b i) have h1 (j) : |g' i j|≤R := by rw [abs_of_nonneg ((mcut_range _ _ _ hr.le j).1)] exact (mcut_range _ _ _ hr.le j).2 have h3 : |rebate u (f' i) (g' i) p - rebate u A' (g' i) p|≤ δ*(2*R) := by exact (rebate_cost u _ _ A' p hu.nz R hr.le h1).trans (mul_le_mul_of_nonneg_right (hA i) hb) have h4 : |rebate u A' (g' i) p - rebate u A' B' p|≤δ*(2*R) := by rw [rebate_sym u A',rebate_sym u A'] exact (rebate_cost u _ _ B' p hu.nz R hr.le (fun i=>hs _ _ _)).trans (mul_le_mul_of_nonneg_right (hB i) hb) let U:=rebate u A' B' p let X:=rebate u (f' i) (g' i) p have hz:= (abs_sub_le X (rebate u A' (g' i) p) U).trans (add_le_add h3 h4) calc |X| = |(X-U)+U| := by rw [sub_add_cancel] _ ≤ _ := ((abs_add_le _ _).trans (add_le_add_left hz _)).trans_eq (by change _+ |U| = |U|+δ*(4*R) ring) refine (avg_mono hD.nz hi).trans ?_ rw [avg_add,hD.avg_const] exact (add_le_add_left he _).trans_eq (by change t^2*(R*c)+δ*(4*R)=_ unfold δ c; field_simp; ring)end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112import OAI.Combinatorics.HadwigerCounterexample.PointAtomVanishing
import OAI.Combinatorics.HadwigerCounterexample.UnaryPositivityBounds
namespace OAI
/-! # Common Predictions -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Module LinearMap Function Finset Submodule
open scoped BigOperators
variable {p : Shape} {n N : ℕ}
abbrev Augur (p : Shape) (N : ℕ) := ∀ t : Tag p.g,F→AtomKey (p:=p) t N→F
def mismatch (p : Shape) {n N : ℕ} (g : Augur p N) (F : Pdual p n) (l : Tag p.g)
(s : Label p.b) (f : Flavor p.g) (x : Orient p n N) (y : Knobs p.g n) :=
F (useAtom p l s f y)≠ g l (dialed p l f y) (keyOne p l s (lit f l y) x)
def postulates (p : Shape) (o : Orient p n N)
(g : Augur p N) (w : Pdual p n) (E : Finset (Label p.b)) (δ : ℝ) :=
∀ s,s∉E→∀ l f, pr (spins p n) (fun i => mismatch p g w l s f o i)≤δ
def yoke (p : Shape) (m : Mixer p n) (x : UnitType p n N) (i : Bool)
(u : Profile p n) (α : F) : Pdual p n :=
innerP p x i + (Tsym m u + α • role p n)
def claimed (p : Shape) (x : UnitType p n N)
(g : Bool→Augur p N) (m : Mixer p n)
(w : Bool→Profile p n) (α : Bool→F) (L : Bool → Finset (Label p.b)) (δ : ℝ) :=
∀ i,postulates p (onSide x i) (g i) (yoke p m x i (w i) (α i)) (L i) δ
def silent (w : Pdual p n) := ∀ x, x∈Xspace p n → w x=0
def fixStar (p : Shape) (n : ℕ) (l : Tag p.g) :
Moment p n →ₗ[F] Profile p n :=
cut p n ∘ₗ LinearMap.single F (fun _ : Tag p.g => Moment p n) l
theorem fix_one (p : Shape) (n : ℕ) (l : Tag p.g) (s : Label p.b) (z : Base p.g n) :
atom p l s z=fixStar p n l (mom p s z) := rfl
theorem atom_silent {w : Pdual p n}
(h : ∀ l s z,allows l z → w (atom p l s z)=0) : silent w := by
classical
intro x hx
obtain ⟨u,hu,rfl⟩ := mem_X.mp hx
have he l : Wtag p n l≤LinearMap.ker (w∘ₗfixStar p n l) := by
refine Submodule.span_le.mpr ?_
rintro x ⟨s,z,hz,rfl⟩
exact h l s z hz
have ht : (cut p n u)=∑ i : Tag p.g,fixStar p n i (u i) := by
have hh := Finset.univ_sum_single u
unfold fixStar
simp_rw [LinearMap.comp_apply, ← map_sum (cut p n)]
exact congrArg (cut p n) (Eq.symm hh)
rw [ht,map_sum]; exact Finset.sum_eq_zero fun i _=>he _ (hu i)
theorem shared_base (p : Shape) (hn : 2*p.r≤n) (hr : 1 ≤ p.r) (hg : 0 < p.g) :
∃ (z : Base p.g n) (s : Label p.b), (∀ l, allows l z) ∧ eta p n (mom p s z)=1 := by
classical
let l : Tag p.g := ⟨0,hg⟩
let f : Flavor p.g:= Flavor.sharedOnly
let i := (Sum.inr () : ProbeIdx p.g)
let v : Digest p.g := Pi.single i 1
have hx : v.feasible l f := by
rintro (x|⟨⟩) _
· exact Pi.single_eq_of_ne (by simp [i]) _
exact (‹¬_› trivial).elim
have he := exists_of_pr_pos (spins_law p n).nz
((scanPrice_pos p).trans_le (scan_fraction (n:=n) l f v hr hn hx))
obtain ⟨x,h,_⟩ := he
refine ⟨lit f l x,0,fun i d t h k => ite_eq_right (by simp [f,Flavor.keeps]),?_⟩
rw [←etaScan,h]; simp [v,Digest.sumBit,Digest.diagO,i]
theorem atom_union (p : Shape) (n : ℕ) (z : Base p.g n) (s : Label p.b) :
∑ i:Tag p.g,atom p i s z=0 := by
simp_rw [atom,←map_sum (cut p n)]
rw [Finset.univ_sum_single (fun i : Tag p.g => mom p s z)]
funext x
exact char_two (mom p s z)
set_option maxHeartbeats 800000 in
theorem exact_vat (w : Pdual p n) (E : Finset (Label p.b)) (g : F)
(hE : (E.card:ℝ)<bp ((p.b:ℝ)-2*p.j))
(hj : Odd p.g) (hn : 2*p.r≤n) (hr : 1≤p.r)
(h : ∀ l s,s∉E → pr (spins p n)
(fun x => w (useAtom p l s Flavor.full x)≠g *dialed p l Flavor.full x)<1/4) :
g=0∧ silent w := by
classical
let Q l := w ∘ₗ fixStar p n l - g • eta p n
have hi (l : Tag p.g) (s : Label p.b) (z : Base p.g n) :
Q l (mom p s z)= w (atom p l s z)-g*eta p n (mom p s z) := rfl
have hh (l s z) (hz : allows l z) : Q l (mom p s z)=0 := by
have he (s) (hs : s∉E) :
pr (spins p n) (fun x=> Q l (mom p s (lit Flavor.full l x))≠0)<1/4 := by
simp_rw [hi,←etaScan p l s Flavor.full]
simpa only [sub_ne_zero,useAtom,dialed] using h l s hs
exact vat_excluded z E (Q l) (fun i h=>vat_erase l i (Q l) (he i h) z hz) hE s
simp_rw [hi] at hh
have he l s z (h : allows l z) : w (atom p l s z) =g*eta p n (mom p s z) :=
sub_eq_zero.mp (hh l s z h)
obtain ⟨z,s,hz,hb⟩ := shared_base p hn hr (by obtain ⟨_,hh⟩ := hj; omega)
have h0 : g=0 := by
have ht : w (∑ l:Tag p.g,atom p l s z)=0 := by rw [atom_union,map_zero]
rw [map_sum] at ht
simp_rw [he _ s z (hz _),hb,mul_one] at ht
simpa only [Finset.sum_const, Finset.card_univ,Tag,Fintype.card_fin,
odd_smul_bit hj] using ht
refine ⟨h0,atom_silent (fun i s z h=> (he i s z h).trans ?_)⟩
rw [h0,zero_mul]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PointAtomVanishingimport OAI.Combinatorics.HadwigerCounterexample.UnaryPositivityBounds
namespace OAI
/-! # Common Predictions -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Module LinearMap Function Finset Submoduleopen scoped BigOperatorsvariable {p : Shape} {n N : ℕ}
abbrev Augur (p : Shape) (N : ℕ) := ∀ t : Tag p.g,F→AtomKey (p:=p) t N→Fdef mismatch (p : Shape) {n N : ℕ} (g : Augur p N) (F : Pdual p n) (l : Tag p.g) (s : Label p.b) (f : Flavor p.g) (x : Orient p n N) (y : Knobs p.g n) := F (useAtom p l s f y)≠ g l (dialed p l f y) (keyOne p l s (lit f l y) x)def postulates (p : Shape) (o : Orient p n N) (g : Augur p N) (w : Pdual p n) (E : Finset (Label p.b)) (δ : ℝ) := ∀ s,s∉E→∀ l f, pr (spins p n) (fun i => mismatch p g w l s f o i)≤δ
def yoke (p : Shape) (m : Mixer p n) (x : UnitType p n N) (i : Bool) (u : Profile p n) (α : F) : Pdual p n := innerP p x i + (Tsym m u + α • role p n)
def claimed (p : Shape) (x : UnitType p n N) (g : Bool→Augur p N) (m : Mixer p n) (w : Bool→Profile p n) (α : Bool→F) (L : Bool → Finset (Label p.b)) (δ : ℝ) := ∀ i,postulates p (onSide x i) (g i) (yoke p m x i (w i) (α i)) (L i) δ
def silent (w : Pdual p n) := ∀ x, x∈Xspace p n → w x=0
def fixStar (p : Shape) (n : ℕ) (l : Tag p.g) : Moment p n →ₗ[F] Profile p n := cut p n ∘ₗ LinearMap.single F (fun _ : Tag p.g => Moment p n) ltheorem fix_one (p : Shape) (n : ℕ) (l : Tag p.g) (s : Label p.b) (z : Base p.g n) : atom p l s z=fixStar p n l (mom p s z) := rfl
theorem atom_silent {w : Pdual p n} (h : ∀ l s z,allows l z → w (atom p l s z)=0) : silent w := by classical intro x hx obtain ⟨u,hu,rfl⟩ := mem_X.mp hx have he l : Wtag p n l≤LinearMap.ker (w∘ₗfixStar p n l) := by refine Submodule.span_le.mpr ?_ rintro x ⟨s,z,hz,rfl⟩ exact h l s z hz have ht : (cut p n u)=∑ i : Tag p.g,fixStar p n i (u i) := by have hh := Finset.univ_sum_single u unfold fixStar simp_rw [LinearMap.comp_apply, ← map_sum (cut p n)] exact congrArg (cut p n) (Eq.symm hh) rw [ht,map_sum]; exact Finset.sum_eq_zero fun i _=>he _ (hu i)
theorem shared_base (p : Shape) (hn : 2*p.r≤n) (hr : 1 ≤ p.r) (hg : 0 < p.g) : ∃ (z : Base p.g n) (s : Label p.b), (∀ l, allows l z) ∧ eta p n (mom p s z)=1 := by classical let l : Tag p.g := ⟨0,hg⟩ let f : Flavor p.g:= Flavor.sharedOnly let i := (Sum.inr () : ProbeIdx p.g) let v : Digest p.g := Pi.single i 1 have hx : v.feasible l f := by rintro (x|⟨⟩) _ · exact Pi.single_eq_of_ne (by simp [i]) _ exact (‹¬_› trivial).elim have he := exists_of_pr_pos (spins_law p n).nz ((scanPrice_pos p).trans_le (scan_fraction (n:=n) l f v hr hn hx)) obtain ⟨x,h,_⟩ := he refine ⟨lit f l x,0,fun i d t h k => ite_eq_right (by simp [f,Flavor.keeps]),?_⟩ rw [←etaScan,h]; simp [v,Digest.sumBit,Digest.diagO,i]
theorem atom_union (p : Shape) (n : ℕ) (z : Base p.g n) (s : Label p.b) : ∑ i:Tag p.g,atom p i s z=0 := by simp_rw [atom,←map_sum (cut p n)] rw [Finset.univ_sum_single (fun i : Tag p.g => mom p s z)] funext x exact char_two (mom p s z)
set_option maxHeartbeats 800000 intheorem exact_vat (w : Pdual p n) (E : Finset (Label p.b)) (g : F) (hE : (E.card:ℝ)<bp ((p.b:ℝ)-2*p.j)) (hj : Odd p.g) (hn : 2*p.r≤n) (hr : 1≤p.r) (h : ∀ l s,s∉E → pr (spins p n) (fun x => w (useAtom p l s Flavor.full x)≠g *dialed p l Flavor.full x)<1/4) : g=0∧ silent w := by classical let Q l := w ∘ₗ fixStar p n l - g • eta p n have hi (l : Tag p.g) (s : Label p.b) (z : Base p.g n) : Q l (mom p s z)= w (atom p l s z)-g*eta p n (mom p s z) := rfl have hh (l s z) (hz : allows l z) : Q l (mom p s z)=0 := by have he (s) (hs : s∉E) : pr (spins p n) (fun x=> Q l (mom p s (lit Flavor.full l x))≠0)<1/4 := by simp_rw [hi,←etaScan p l s Flavor.full] simpa only [sub_ne_zero,useAtom,dialed] using h l s hs exact vat_excluded z E (Q l) (fun i h=>vat_erase l i (Q l) (he i h) z hz) hE s simp_rw [hi] at hh have he l s z (h : allows l z) : w (atom p l s z) =g*eta p n (mom p s z) := sub_eq_zero.mp (hh l s z h) obtain ⟨z,s,hz,hb⟩ := shared_base p hn hr (by obtain ⟨_,hh⟩ := hj; omega) have h0 : g=0 := by have ht : w (∑ l:Tag p.g,atom p l s z)=0 := by rw [atom_union,map_zero] rw [map_sum] at ht simp_rw [he _ s z (hz _),hb,mul_one] at ht simpa only [Finset.sum_const, Finset.card_univ,Tag,Fintype.card_fin, odd_smul_bit hj] using ht refine ⟨h0,atom_silent (fun i s z h=> (he i s z h).trans ?_)⟩ rw [h0,zero_mul]end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130import OAI.Combinatorics.HadwigerCounterexample.PairedEventBounds
namespace OAI
/-! # Compatible Option Realization -/
noncomputable section
namespace HadwigerCounterexample
open Finset Matrix Function Module LinearMap
open scoped BigOperators
variable {p:Shape} {n N M K s0:ℕ}
namespace StatusAnalysis
variable {q:Format} {d e: Rates} {b:Bool}
abbrev Stalls (p:Shape) := Bool→Finset (Label p.b)
def booths (p:Shape) (K:ℕ) (s: Plan p n) (H:Stalls p) :=
(∀ i,(H i).card≤frameBills p.g K) ∧
∀ i j, protectedBy p (sPin s j i) (qorth K) (H i)
theorem buildBooths (K:ℕ) (s:Plan p n) (h:planRank s≤K)
(hj:(K+1)*qorth K≤p.j+1) :
∃ H,booths p K s H := by
classical
choose H hH hG using fun i : Bool=> pin_protection s i K (qorth K) h hj
exact ⟨H,hH,hG⟩
theorem shelter (K :ℕ) (S:Pin p n N) (t : Quill p q d b) (z : Tagging p (Messenger q)) (H:Stalls p)
(h:booths p K S.sp H) (hp : Injective t.sel)
(ht:∀ i:Messenger q,t.sel i∉H (parcel b i))
(hg : ∀ i,1≤q i ∧ q i≤7) : t.penSpace z S K := by
intro x i
let v:=(t.pen z).draw x
refine ⟨H i,h.2 i,fun j hj=>?_,?_,hp.injOn⟩
· have he : parcel b j=i := Finset.mem_filter.mp hj|>.2
rw [←he]; exact ht j
exact (Volley.here_card v (shots_ok b v rfl hg) i).trans (by unfold qorth; omega)
theorem sizedCharts (K:ℕ) (w:LeafMixture p n N) (t:Station p n N K w) (ht:t.bank)
(i:w.T) (h:planRank (w.pin i.val).sp≤K) :
∃ d:Stakes K,charted (t.cAxes i (toRates d)) (w.pin i.val).sp := by
let s:=(w.pin i.val).sp
let d (i:Nodes):= dim (effective s i)
have hd i : d i < K^2+1 := Nat.lt_of_le_of_lt
((effective_dim s i).trans (by gcongr)) (Nat.lt_succ_self _)
exact ⟨fun i=>⟨d i,hd i⟩,ht.1 i⟩
structure Fabric (p:Shape) (q:Format) (d:Rates) (b:Bool) where
sel : Messenger q → Label p.b
flav : Messenger q → Flavor p.g
amp : Amounts p q d b
namespace Fabric
variable (w:Fabric p q d b) (t:Tagging p (Messenger q))
def hang (s:Script p (Messenger q)) : Quill p q d b :=
⟨w.sel,w.flav,w.amp,s⟩
def up (w:Fabric p q d b) (t:Tagging p (Messenger q)) (z: Messenger q→F) :=
(w.hang 0).moral t z
end Fabric
variable {i j:Bool} {L:ℕ}
set_option maxHeartbeats 1200000 in
theorem optionVia (q:Format) (d e : Rates) (s t:Pin p n N) (T:Cross p n) (K:ℕ)
(ha: tableInj s.sp t.sp T) (hb : tableInj t.sp s.sp (reciprocal p T))
(p':Tagging p (Messenger q)) (x:Charts p n d) (y:Charts p n e)
(hx:charted x s.sp) (hy:charted y t.sp)
(f:Fabric p q d true) (g:Fabric p q e false)
(hs h:Stalls p) (hm:booths p K s.sp hs) (hu : booths p K t.sp h)
(hf:∀ i,f.sel i∉ hs (parcel true i)) (hg:∀ i,g.sel i∉ h (parcel false i))
(z:Messenger q→F) (hF:f.up p' z)(hG:g.up p' z)
(hj : 1≤p.J) (h2: 2≤p.g) (h₀:∀ i,1≤q i∧q i≤7)
(he:speak _ _ (sendSum z f.amp g.amp)=(hailing p x y T,0)) :
∃ (a b:Script p (Messenger q)),Typus.chances ⟨p',z,f.hang a,g.hang b⟩ x y s t T K := by
obtain ⟨hQ,hR,hL,hS⟩:= (spoken x y T z f.amp g.amp).mp he
obtain ⟨a,ha'⟩:= proclaim_script true f.amp g.amp p' y (reciprocal p T) hR (fun i=>(h₀ i).1)
hS h2 hj
have hh : rhyme g.amp f.amp := fun i=> (add_comm ..).trans (hR i)
obtain ⟨b,hb'⟩:= proclaim_script false g.amp f.amp p' x T hh (fun i=>(h₀ i).1)
hL h2 hj
exact ⟨a,b, ⟨h₀,hF,hG,hQ,hR,ha',hb'⟩,⟨hx,shelter K s (f.hang a) p' hs hm hF.1 hf h₀,hL,ha⟩,
⟨hy,shelter K t (g.hang b) p' h hu hG.1 hg h₀,hS,hb⟩⟩
def berthTicket (a b:Pin p n N) (T: Cross p n)
(x:UnitType p n N × UnitType p n N) :=
tableInj a.sp b.sp T ∧ tableInj b.sp a.sp (reciprocal p T)
∧ fitsTable a.sp b.sp T (actual p x.1 x.2)
theorem issueTicket (x y:UnitType p n N) (w : LeafMixture p n N) (t:Station p n N K w)
(i j:w.T) (ha:apart w.T)
(hx:x∈i.val) (hy:y∈j.val) (ht:t.bank)
(he : secureAt p w.rooting (x,y)) :
∃ k, berthTicket (w.pin i.val) (w.pin j.val) (t.mails i j k) (x,y) := by
obtain ⟨k,hk⟩:=ht.2 i j (actual p x y)
obtain ⟨h1,h2⟩:=he
let a:= w.pin i.val; let b:= w.pin j.val
have hh : w.rooting x=a.sp:= congrArg Pin.sp (LeafMixture.poller_eq w ha i.property hx)
have hg : w.rooting y=b.sp:= congrArg Pin.sp (LeafMixture.poller_eq w ha j.property hy)
change tableInj (w.rooting x) (w.rooting y) (actual p x y) at h1
change tableInj (w.rooting y) (w.rooting x) (actual p y x) at h2
rw [hh,hg] at h1 h2
rw [← reciprocal_actual] at h2
exact ⟨k, fits_inj hk h1,fits_inj (fits_recip hk) h2,hk⟩
theorem berth_flags (a b:Pin p n N) (T:Cross p n) {x:UnitType p n N × UnitType p n N}
(h:berthTicket a b T x) (ha:a.agree x.1) (hb:b.agree x.2) :
tableFlag a b T x.1 ∧ tableFlag b a (reciprocal p T) x.2 := by
have hg:=fits_recip h.2.2; rw [reciprocal_actual] at hg
exact ⟨fits_flag T _ a b x.1 h.2.2 (flag_actual _ _ hb),
fits_flag _ _ b a x.2 hg (flag_actual _ _ ha)⟩
def cardTone (m:BMark p n N) (x:UnitType p n N) (T:Cross p n) (j:Bool) : F :=
∑ i:Bool,contract p T i j (m x i)
theorem actualTone (m:BMark p n N) (a b : UnitType p n N) (j:Bool) :
cardTone m a (actual p a b) j = tone p b (unary j) (delta m a) := by
rw [lone]
unfold cardTone delta
rw [map_add,Fintype.sum_bool]
simp_rw [contract_actual]; rfl
theorem fitsTone {w v: Plan p n} {T U:Cross p n}
(m:BMark p n N) (x:UnitType p n N)
(h:fitsTable w v T U) (hx:∀ i,m x i∈effective w i) (j) :
cardTone m x T j=cardTone m x U j :=
Finset.sum_congr rfl (fun i _=>fits_contract h i j _ (hx i))
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PairedEventBounds
namespace OAI
/-! # Compatible Option Realization -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Matrix Function Module LinearMapopen scoped BigOperatorsvariable {p:Shape} {n N M K s0:ℕ}namespace StatusAnalysis
variable {q:Format} {d e: Rates} {b:Bool}abbrev Stalls (p:Shape) := Bool→Finset (Label p.b)
def booths (p:Shape) (K:ℕ) (s: Plan p n) (H:Stalls p) := (∀ i,(H i).card≤frameBills p.g K) ∧ ∀ i j, protectedBy p (sPin s j i) (qorth K) (H i)theorem buildBooths (K:ℕ) (s:Plan p n) (h:planRank s≤K) (hj:(K+1)*qorth K≤p.j+1) : ∃ H,booths p K s H := by classical choose H hH hG using fun i : Bool=> pin_protection s i K (qorth K) h hj exact ⟨H,hH,hG⟩
theorem shelter (K :ℕ) (S:Pin p n N) (t : Quill p q d b) (z : Tagging p (Messenger q)) (H:Stalls p) (h:booths p K S.sp H) (hp : Injective t.sel) (ht:∀ i:Messenger q,t.sel i∉H (parcel b i)) (hg : ∀ i,1≤q i ∧ q i≤7) : t.penSpace z S K := by intro x i let v:=(t.pen z).draw x refine ⟨H i,h.2 i,fun j hj=>?_,?_,hp.injOn⟩ · have he : parcel b j=i := Finset.mem_filter.mp hj|>.2 rw [←he]; exact ht j exact (Volley.here_card v (shots_ok b v rfl hg) i).trans (by unfold qorth; omega)
theorem sizedCharts (K:ℕ) (w:LeafMixture p n N) (t:Station p n N K w) (ht:t.bank) (i:w.T) (h:planRank (w.pin i.val).sp≤K) : ∃ d:Stakes K,charted (t.cAxes i (toRates d)) (w.pin i.val).sp := by let s:=(w.pin i.val).sp let d (i:Nodes):= dim (effective s i) have hd i : d i < K^2+1 := Nat.lt_of_le_of_lt ((effective_dim s i).trans (by gcongr)) (Nat.lt_succ_self _) exact ⟨fun i=>⟨d i,hd i⟩,ht.1 i⟩
structure Fabric (p:Shape) (q:Format) (d:Rates) (b:Bool) where sel : Messenger q → Label p.b flav : Messenger q → Flavor p.g amp : Amounts p q d b
namespace Fabricvariable (w:Fabric p q d b) (t:Tagging p (Messenger q))def hang (s:Script p (Messenger q)) : Quill p q d b := ⟨w.sel,w.flav,w.amp,s⟩def up (w:Fabric p q d b) (t:Tagging p (Messenger q)) (z: Messenger q→F) := (w.hang 0).moral t z
end Fabric
variable {i j:Bool} {L:ℕ}set_option maxHeartbeats 1200000 intheorem optionVia (q:Format) (d e : Rates) (s t:Pin p n N) (T:Cross p n) (K:ℕ) (ha: tableInj s.sp t.sp T) (hb : tableInj t.sp s.sp (reciprocal p T)) (p':Tagging p (Messenger q)) (x:Charts p n d) (y:Charts p n e) (hx:charted x s.sp) (hy:charted y t.sp) (f:Fabric p q d true) (g:Fabric p q e false) (hs h:Stalls p) (hm:booths p K s.sp hs) (hu : booths p K t.sp h) (hf:∀ i,f.sel i∉ hs (parcel true i)) (hg:∀ i,g.sel i∉ h (parcel false i)) (z:Messenger q→F) (hF:f.up p' z)(hG:g.up p' z) (hj : 1≤p.J) (h2: 2≤p.g) (h₀:∀ i,1≤q i∧q i≤7) (he:speak _ _ (sendSum z f.amp g.amp)=(hailing p x y T,0)) : ∃ (a b:Script p (Messenger q)),Typus.chances ⟨p',z,f.hang a,g.hang b⟩ x y s t T K := by obtain ⟨hQ,hR,hL,hS⟩:= (spoken x y T z f.amp g.amp).mp he obtain ⟨a,ha'⟩:= proclaim_script true f.amp g.amp p' y (reciprocal p T) hR (fun i=>(h₀ i).1) hS h2 hj have hh : rhyme g.amp f.amp := fun i=> (add_comm ..).trans (hR i) obtain ⟨b,hb'⟩:= proclaim_script false g.amp f.amp p' x T hh (fun i=>(h₀ i).1) hL h2 hj exact ⟨a,b, ⟨h₀,hF,hG,hQ,hR,ha',hb'⟩,⟨hx,shelter K s (f.hang a) p' hs hm hF.1 hf h₀,hL,ha⟩, ⟨hy,shelter K t (g.hang b) p' h hu hG.1 hg h₀,hS,hb⟩⟩
def berthTicket (a b:Pin p n N) (T: Cross p n) (x:UnitType p n N × UnitType p n N) := tableInj a.sp b.sp T ∧ tableInj b.sp a.sp (reciprocal p T) ∧ fitsTable a.sp b.sp T (actual p x.1 x.2)
theorem issueTicket (x y:UnitType p n N) (w : LeafMixture p n N) (t:Station p n N K w) (i j:w.T) (ha:apart w.T) (hx:x∈i.val) (hy:y∈j.val) (ht:t.bank) (he : secureAt p w.rooting (x,y)) : ∃ k, berthTicket (w.pin i.val) (w.pin j.val) (t.mails i j k) (x,y) := by obtain ⟨k,hk⟩:=ht.2 i j (actual p x y) obtain ⟨h1,h2⟩:=he let a:= w.pin i.val; let b:= w.pin j.val have hh : w.rooting x=a.sp:= congrArg Pin.sp (LeafMixture.poller_eq w ha i.property hx) have hg : w.rooting y=b.sp:= congrArg Pin.sp (LeafMixture.poller_eq w ha j.property hy) change tableInj (w.rooting x) (w.rooting y) (actual p x y) at h1 change tableInj (w.rooting y) (w.rooting x) (actual p y x) at h2 rw [hh,hg] at h1 h2 rw [← reciprocal_actual] at h2 exact ⟨k, fits_inj hk h1,fits_inj (fits_recip hk) h2,hk⟩
theorem berth_flags (a b:Pin p n N) (T:Cross p n) {x:UnitType p n N × UnitType p n N} (h:berthTicket a b T x) (ha:a.agree x.1) (hb:b.agree x.2) : tableFlag a b T x.1 ∧ tableFlag b a (reciprocal p T) x.2 := by have hg:=fits_recip h.2.2; rw [reciprocal_actual] at hg exact ⟨fits_flag T _ a b x.1 h.2.2 (flag_actual _ _ hb), fits_flag _ _ b a x.2 hg (flag_actual _ _ ha)⟩
def cardTone (m:BMark p n N) (x:UnitType p n N) (T:Cross p n) (j:Bool) : F := ∑ i:Bool,contract p T i j (m x i)
theorem actualTone (m:BMark p n N) (a b : UnitType p n N) (j:Bool) : cardTone m a (actual p a b) j = tone p b (unary j) (delta m a) := by rw [lone] unfold cardTone delta rw [map_add,Fintype.sum_bool] simp_rw [contract_actual]; rfltheorem fitsTone {w v: Plan p n} {T U:Cross p n} (m:BMark p n N) (x:UnitType p n N) (h:fitsTable w v T U) (hx:∀ i,m x i∈effective w i) (j) : cardTone m x T j=cardTone m x U j := Finset.sum_congr rfl (fun i _=>fits_contract h i j _ (hx i))end StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105import OAI.Combinatorics.HadwigerCounterexample.PredictionClassBounds
namespace OAI
/-! # Compatible Pair Tests -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Function Module LinearMap Matrix
open scoped BigOperators Topology
open Template
namespace StatusAnalysis
open PreparationParameters Station PredictionClass Club Guild DualAnalysis
variable {p:Shape} {n N M r s0:ℕ}
{w:rhythms p M} {b:PreparationParameters}
set_option maxHeartbeats 1800000 in
theorem foretold (w:rhythms p M) (m:cycleM p) (x:Sketch p M)
(v:Station p n (M*n) b.pins (w n)) (hv:v.bank)
(U:Wgt (UnitType p n (M*n))) (h:Lead U (w n) (m n) b)
(hE:AnalyticParameters p M b s0)
(hm:(w n).within (engrave x b m w n))
(hn:2*p.r≤n) (Y:Silhouette p (M*n) r) (f:Bool→Pulsar p r)
{τ ε δ η a d0:ℝ} (hh: hue x.c Y f (fun i=>x.g i n) x.α τ)
(hε:0<ε) (hp:Jubilee p b.pins ε η)
(hB:supportBudget p b.pins η a)
(hz:x.ε n ≤scanPrice p*ε) (ht:10*ε≤τ) (hT:2*τ<1)
(hF:Beams b (m n) Y (w n) U v a ε δ d0) (i : ViewPair p n (M*n) (w n))
(hx:cirque (w n) U i ≠0)
(hg1:gauze p δ δ Y (m n) b.pins i.1.2) (hg2:gauze p δ δ Y (m n) b.pins i.2.2)
(hC:matchProg x n (i.1.2,i.2.2))
(hS:secureAt p (w n).rooting (i.1.2,i.2.2)) :
eligiblePair v (m n) i.1 i.2 Y a := by
classical
let s:=w n; let μ:= U; let K:=b.pins
let X:=i.1.2; let Z:=i.2.2
let j:=i.1.1; let k:=i.2.1
let L:=troupe s μ
have hs : L i.1≠0:=left_ne_zero_of_mul hx
have hl : L i.2 ≠0:=right_ne_zero_of_mul hx
have hX := troupe_home h i.1 hs
have hZ:= troupe_home h i.2 hl
have hL i:= (h.strength.leaf _ (Subtype.prop (show s.T from i))).bound
obtain ⟨g,hg⟩:= ready_loupe s v hv hE hL
let d:= g.r j; let e:=g.r k
let t:=v.cAxes j (toRates d); let u:=v.cAxes k (toRates e)
let A:=g.H j; let B:=g.H k
let m':=x.m n
let F:=x.L n X; let H:=x.L n Z
let P:= A⊔F; let Q:=B⊔ H
obtain ⟨⟨h1,h2⟩,h3,h4⟩:=hm _ j.property X hX.1
obtain ⟨⟨h1',h2'⟩,h3',h4'⟩:=hm _ k.property Z hZ.1
let M0:=s.pin j.val; let M1:=s.pin k.val
have he (i):m' X i∈ effective M0.sp i:= (hX.2.1 ▸ (h1 i).2)
have he' i:m' Z i∈effective M1.sp i:= (hZ.2.1 ▸ (h1' i).2)
choose T hP using fun i=> show m' X i∈LinearMap.range (t i) from
(hg.charts j i).1.symm ▸ he i
choose S hQ using fun i=> show m' Z i∈ LinearMap.range (u i) from
(hg.charts k i).1.symm ▸ he' i
let Γ:PredictionData p (toRates d) (toRates e) r := ⟨x.α,f,T,S⟩
have ht0:= hE.enter.first
let M' := m n
let D:=wisp p Y; let X0:=wake p Y M' X t; let X1:=wake p Y M' Z u
let β:=trimBeta p K
let C:=stellar D X0 X1 η P Q
have hk0 i t:=Nat.lt_succ_iff.mp (g.r i t).isLt
have hA: reports p r D X0 β δ:=routeLive s g v hg M' hE hn i.1 Y δ hF.haze.1 (hL _) hg1
have hB1: reports p r D X1 β δ:=routeLive s g v hg M' hE hn i.2 Y δ hF.haze.1 (hL _) hg2
have hR := boothseek b _ (g.H j) F (hg.baseline j) hE (fun i=>(h1 i).1)
have hR' := boothseek b _ (g.H k) H (hg.baseline k) hE (fun i=>(h1' i).1)
have hG: rich C:= plenitude hF.soft hA hB1 ht0.hG P Q hR hR' (trimBeta_pos ..) hp.pos
hp.sturdyR (hk0 _) (hk0 _)
obtain ⟨E,hE0,hr⟩:=stable C hG
obtain ⟨y,hy⟩:= issueTicket X Z s v j k h.strength.part hX.1 hZ.1 hv hS
let U0:=v.mails j k y
have hQ': x.c.compatible x.α (glint p (m' X)) (cardTone m' X U0,cardTone m' Z
(reciprocal p U0)) := by
change glint p _=_ at h3
have he1 l: cardTone m' X U0 l=(quench p (delta m') (X,Z)).1 l:=
(fitsTone m' X hy.2.2 he l).trans (actualTone m' X Z l)
have he2 l:cardTone m' Z (reciprocal p U0) l=(quench p (delta m') (X,Z)).2 l:= by
have hg := fits_recip hy.2.2; rw [reciprocal_actual] at hg
exact (fitsTone m' Z hg he' l).trans (actualTone m' Z X l)
rw [funext he1,funext he2,h3]; exact hC
have hc: countStory p K η δ ε β D:=⟨hF.soft,(trimBeta_pos ..).le,hε.le,hp.pos.le,
hp.book,hp.low⟩
have hv : Γ.colored D X0 X1 P Q (2*ε):= by
constructor
· exact crew_praise p x.c Y f (fun i=>x.g i n) x.α τ hh (m n) t T m' X F P le_sup_right
hP hε.le hF.haze.2 hE hn (fun i j hj k f=>(h2 i j hj k f).trans hz) h4 hg1
exact crew_praise p x.c Y f (fun i=>x.g i n) x.α τ hh (m n) u S m' Z H Q le_sup_right
hQ hε.le hF.haze.2 hE hn (fun i j hj k f=>(h2' i j hj k f).trans hz) h4' hg2
have hZ0 := laysScore p K Y (m n) D X Z m' (toRates d) (toRates e) t u x.c Γ P Q
E η ε β δ τ hP hQ (paintChorus _ _ f _ x.α τ hh T S) (by linarith only [hε,ht]) hT hc
hA hB1 hv (hk0 _) (hk0 _) ht0.hG ht hR hR' hE0 U0 (h3.trans h3'.symm) hQ' hG
exact inform (w n) v _ Y i.1 i.2 hX.2.2.1 hZ.2.2.1 hX.2.2.2 hZ.2.2.2 d e (hg.charts _)
(hg.charts _) hB A B (hg.baseline _) (hg.baseline _) P Q le_sup_left le_sup_left ht0.hG
hE.jump hp.pos y hy E hr hZ0
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PredictionClassBounds
namespace OAI
/-! # Compatible Pair Tests -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Function Module LinearMap Matrixopen scoped BigOperators Topologyopen Templatenamespace StatusAnalysisopen PreparationParameters Station PredictionClass Club Guild DualAnalysisvariable {p:Shape} {n N M r s0:ℕ} {w:rhythms p M} {b:PreparationParameters}
set_option maxHeartbeats 1800000 intheorem foretold (w:rhythms p M) (m:cycleM p) (x:Sketch p M) (v:Station p n (M*n) b.pins (w n)) (hv:v.bank) (U:Wgt (UnitType p n (M*n))) (h:Lead U (w n) (m n) b) (hE:AnalyticParameters p M b s0) (hm:(w n).within (engrave x b m w n)) (hn:2*p.r≤n) (Y:Silhouette p (M*n) r) (f:Bool→Pulsar p r) {τ ε δ η a d0:ℝ} (hh: hue x.c Y f (fun i=>x.g i n) x.α τ) (hε:0<ε) (hp:Jubilee p b.pins ε η) (hB:supportBudget p b.pins η a) (hz:x.ε n ≤scanPrice p*ε) (ht:10*ε≤τ) (hT:2*τ<1) (hF:Beams b (m n) Y (w n) U v a ε δ d0) (i : ViewPair p n (M*n) (w n)) (hx:cirque (w n) U i ≠0) (hg1:gauze p δ δ Y (m n) b.pins i.1.2) (hg2:gauze p δ δ Y (m n) b.pins i.2.2) (hC:matchProg x n (i.1.2,i.2.2)) (hS:secureAt p (w n).rooting (i.1.2,i.2.2)) : eligiblePair v (m n) i.1 i.2 Y a := by classical let s:=w n; let μ:= U; let K:=b.pins let X:=i.1.2; let Z:=i.2.2 let j:=i.1.1; let k:=i.2.1 let L:=troupe s μ have hs : L i.1≠0:=left_ne_zero_of_mul hx have hl : L i.2 ≠0:=right_ne_zero_of_mul hx have hX := troupe_home h i.1 hs have hZ:= troupe_home h i.2 hl have hL i:= (h.strength.leaf _ (Subtype.prop (show s.T from i))).bound obtain ⟨g,hg⟩:= ready_loupe s v hv hE hL let d:= g.r j; let e:=g.r k let t:=v.cAxes j (toRates d); let u:=v.cAxes k (toRates e) let A:=g.H j; let B:=g.H k let m':=x.m n let F:=x.L n X; let H:=x.L n Z let P:= A⊔F; let Q:=B⊔ H obtain ⟨⟨h1,h2⟩,h3,h4⟩:=hm _ j.property X hX.1 obtain ⟨⟨h1',h2'⟩,h3',h4'⟩:=hm _ k.property Z hZ.1 let M0:=s.pin j.val; let M1:=s.pin k.val have he (i):m' X i∈ effective M0.sp i:= (hX.2.1 ▸ (h1 i).2) have he' i:m' Z i∈effective M1.sp i:= (hZ.2.1 ▸ (h1' i).2) choose T hP using fun i=> show m' X i∈LinearMap.range (t i) from (hg.charts j i).1.symm ▸ he i choose S hQ using fun i=> show m' Z i∈ LinearMap.range (u i) from (hg.charts k i).1.symm ▸ he' i let Γ:PredictionData p (toRates d) (toRates e) r := ⟨x.α,f,T,S⟩ have ht0:= hE.enter.first let M' := m n let D:=wisp p Y; let X0:=wake p Y M' X t; let X1:=wake p Y M' Z u let β:=trimBeta p K let C:=stellar D X0 X1 η P Q have hk0 i t:=Nat.lt_succ_iff.mp (g.r i t).isLt have hA: reports p r D X0 β δ:=routeLive s g v hg M' hE hn i.1 Y δ hF.haze.1 (hL _) hg1 have hB1: reports p r D X1 β δ:=routeLive s g v hg M' hE hn i.2 Y δ hF.haze.1 (hL _) hg2 have hR := boothseek b _ (g.H j) F (hg.baseline j) hE (fun i=>(h1 i).1) have hR' := boothseek b _ (g.H k) H (hg.baseline k) hE (fun i=>(h1' i).1) have hG: rich C:= plenitude hF.soft hA hB1 ht0.hG P Q hR hR' (trimBeta_pos ..) hp.pos hp.sturdyR (hk0 _) (hk0 _) obtain ⟨E,hE0,hr⟩:=stable C hG obtain ⟨y,hy⟩:= issueTicket X Z s v j k h.strength.part hX.1 hZ.1 hv hS let U0:=v.mails j k y have hQ': x.c.compatible x.α (glint p (m' X)) (cardTone m' X U0,cardTone m' Z (reciprocal p U0)) := by change glint p _=_ at h3 have he1 l: cardTone m' X U0 l=(quench p (delta m') (X,Z)).1 l:= (fitsTone m' X hy.2.2 he l).trans (actualTone m' X Z l) have he2 l:cardTone m' Z (reciprocal p U0) l=(quench p (delta m') (X,Z)).2 l:= by have hg := fits_recip hy.2.2; rw [reciprocal_actual] at hg exact (fitsTone m' Z hg he' l).trans (actualTone m' Z X l) rw [funext he1,funext he2,h3]; exact hC have hc: countStory p K η δ ε β D:=⟨hF.soft,(trimBeta_pos ..).le,hε.le,hp.pos.le, hp.book,hp.low⟩ have hv : Γ.colored D X0 X1 P Q (2*ε):= by constructor · exact crew_praise p x.c Y f (fun i=>x.g i n) x.α τ hh (m n) t T m' X F P le_sup_right hP hε.le hF.haze.2 hE hn (fun i j hj k f=>(h2 i j hj k f).trans hz) h4 hg1 exact crew_praise p x.c Y f (fun i=>x.g i n) x.α τ hh (m n) u S m' Z H Q le_sup_right hQ hε.le hF.haze.2 hE hn (fun i j hj k f=>(h2' i j hj k f).trans hz) h4' hg2 have hZ0 := laysScore p K Y (m n) D X Z m' (toRates d) (toRates e) t u x.c Γ P Q E η ε β δ τ hP hQ (paintChorus _ _ f _ x.α τ hh T S) (by linarith only [hε,ht]) hT hc hA hB1 hv (hk0 _) (hk0 _) ht0.hG ht hR hR' hE0 U0 (h3.trans h3'.symm) hQ' hG exact inform (w n) v _ Y i.1 i.2 hX.2.2.1 hZ.2.2.1 hX.2.2.2 hZ.2.2.2 d e (hg.charts _) (hg.charts _) hB A B (hg.baseline _) (hg.baseline _) P Q le_sup_left le_sup_left ht0.hG hE.jump hp.pos y hy E hr hZ0
end StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149import OAI.Combinatorics.HadwigerCounterexample.RareTestEvents
namespace OAI
/-! # Compatible Table Events -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Matrix LinearMap Function
open scoped BigOperators Topology
open Template
namespace StatusAnalysis
open PreparationParameters PredictionClass
variable {p:Shape} {n M K s0 N :ℕ} {w:LeafMixture p n N} {q:PreparationParameters}
structure Settled (t: LeafMixture p n N) (m:Mixer p n) (q:PreparationParameters)
(U : Wgt (UnitType p n N)) (z:BMark p n N) (k:F) : Prop where
readyC :
IsLaw U ∧ t.strength U (usual p m N) q.leafNew (2*q.ζ) q.pins ∧
t.within (fun o=>frameSide p m o ∧ exactInk p m z o ∧
(∀ i,z o i∈effective (t.rooting o) i) ∧ glint p (z o)=k)
hard : q.hardened p N t z
def shimmer (z:BMark p n N) (r:F) (x:UnitType p n N× UnitType p n N) :=
quench p (delta z) x=repeatQ r
variable (v: Station p n N q.pins w) (i j:w.T)
(U:Wgt (UnitType p n N)) (m:Mixer p n) (z:BMark p n N)
private theorem chartKnown {r : F} (q:PreparationParameters) (x:w.T) (d: Stakes q.pins)
(hw:Settled w m q U z r)
{v : Charts p n (toRates d)} (hc:charted v (w.pin x.val).sp)
(o : UnitType p n N) (hx:o∈x.val) :
(∀ i,totalRank (z o i)≤ q.pins) ∧ ∃ y,∀ i∈x.val,coordSpec z i v y := by
obtain ⟨h1,h2,h3⟩:=hw.readyC
let A:=(w.pin x.val).sp
have hi j : z o j∈effective A j := by
have hh : w.rooting o=A:=congrArg Pin.sp (LeafMixture.poller_eq w h2.part x.property hx)
rw [←hh]; exact (h3 x.val x.property o hx).2.2.1 j
obtain ⟨T,hK,hB,hG⟩:=hw.hard
obtain ⟨b,hb,hf⟩:=hG x.val x.property
choose y hy using fun j=> show z o j∈LinearMap.range (v j) from (hc j).1.symm ▸ hi j
refine ⟨fun i=>(effective_rank (hi i)).trans (h2.leaf x.val x.property).bound,y,
fun i hh j=>?_⟩
exact (hy j).trans (congr_fun (hb.2.2 _ hx _ hh).1 j)
set_option maxHeartbeats 1800000 in
theorem invoke (k:Fin (2^deckMax p q.pins))
(r:F) (a:ℝ) (hα:0<a) (h:AnalyticParameters p M q s0)
(hw:Settled w m q U z r) (ht:v.bank)
(hk:2*a ≤ pr (pairW (partW U i.val) (partW U j.val))
(fun x=> shimmer z r x∧ berthTicket (w.pin i.val) (w.pin j.val) (v.mails i j k) x)) :
∃ x:Scrip p q.pins, v.charter x.2.2 m x.2.1 U a (i,j) := by
classical
let K:=q.pins
let T:=v.mails i j k
have hq:=h.enter.first
let a0:= w.pin i.val; let b0:= w.pin j.val
let μ i:=partW U (Subtype.val (show w.T from i))
let S:=pairW (μ i) (μ j)
obtain ⟨hm,hv,hC⟩:=hw.readyC
have hu x:=show IsLaw (μ x) from on_law hm.nz (hv.leaf x.val x.property).pos
have hμ: IsLaw S:= pairW_law (hu _) (hu _)
have hK x : planRank (w.pin (Subtype.val (show w.T from x))).sp ≤ K :=
(hv.leaf _ (Subtype.prop x)).bound
obtain ⟨f,hF⟩:=sizedCharts q.pins w v ht i (hK i)
obtain ⟨g,hG⟩:=sizedCharts q.pins w v ht j (hK j)
let A:= toRates f; let B:=toRates g; let X:=v.cAxes i A; let Y:=v.cAxes j B
let P x:= shimmer z r x∧ berthTicket a0 b0 T x
obtain ⟨o,⟨hop,hOK⟩,ho⟩:= exists_of_pr_pos hμ.nz (lt_of_lt_of_le
(show 0<2*a by positivity) hk)
let x:=o.1; let y:=o.2
have hcol i x (hx:μ i x≠0) : x∈ i.val := (onW_ne hx).1
have hx : x∈ i.val:= hcol i x (left_ne_zero_of_mul ho.ne')
have hy : y∈ j.val:= hcol j y (right_ne_zero_of_mul ho.ne')
obtain ⟨hχ,l,hl⟩:= chartKnown (v:=X) U m z q i f hw hF x hx
obtain ⟨hξ,t,ht'⟩:= chartKnown (v:=Y) U m z q j g hw hG y hy
have he (i : w.T) x (hx:x∈ i.val) : ∀ j,z x j∈effective (w.pin i.val).sp j := by
have hi : w.rooting x=(w.pin i.val).sp:=congrArg Pin.sp (LeafMixture.poller_eq w hv.part i.property hx)
rw [← hi]; exact (hC _ i.property _ hx).2.2.1
let kappa : Tag p.g:= ⟨0,by linarith only [hq.hG]⟩
let tt : Tagging p (Messenger singles):=fun _=>kappa
let ref := show Messenger singles→F from fun _=>1
obtain ⟨E,h1,h2,h3⟩:= generic_summary p hq.hG kappa 1 0
obtain ⟨H,h4,h5,h6⟩:= generic_summary p hq.hG kappa 1 1
obtain ⟨L,hLa⟩:= buildBooths K a0.sp (hK i) h.penRoom
obtain ⟨O,hLb⟩:= buildBooths K b0.sp (hK j) h.penRoom
have hh : 2*frameBills p.g K+4 ≤ Fintype.card (Label p.b) := by
have hl : frameBills p.g K + 1000 ≤ q.B:=h.forbid
have he:= h.spare; omega
obtain ⟨J,hJ,hJ'⟩:= fourPens _ K L hLa hh
obtain ⟨I,hI,hI'⟩:= fourPens _ K O hLb hh
let F0:Fabric p singles A true:=⟨J,fun _ => Flavor.full,beacon p X l true T E⟩
let T':= reciprocal p T
let G0:Fabric p singles B false:=⟨I,fun _=> Flavor.full,beacon p Y t false T' H⟩
have hs : speak A B (sendSum ref F0.amp G0.amp)=(hailing p X Y T,0) := by
apply (spoken X Y T ref F0.amp G0.amp).mpr
have hFq a : fullq ref a=1 := by
unfold fullq
change (∑ _:Fin 1,(1:F))=1; rw [Fintype.sum_unique]
have hR : rhyme F0.amp G0.amp := by
intro i; have hf : (funds F0.amp i).1.1=E.diagO := congrArg (fun x=> x.1.1) (funds_one F0 i)
have hg : (funds G0.amp i).1.1=H.diagO := congrArg (fun x=> x.1.1) (funds_one G0 i)
change (funds (b:=true) F0.amp i).1.1+(funds (b:=false) G0.amp i).1.1=_; rw [hf,hg,h3,h6,zero_add]
refine ⟨hFq,hR, stillBeacon z x X l true T E (hl _ hx) (fun k=>?_),stillBeacon z y Y t false
T' H (ht' _ hy) (fun k=>?_)⟩
· rw [fitsTone z x hOK.2.2 (he _ _ hx), actualTone,(hC _ i.property _ hx).2.2.2]
exact congr_fun (congrArg Prod.fst hop) k
have hg:=fits_recip hOK.2.2; rw [reciprocal_actual] at hg
rw [fitsTone z y hg (he _ _ hy), actualTone,(hC _ j.property _ hy).2.2.2]
exact congr_fun (congrArg Prod.snd hop) k
obtain ⟨P0,Q0,hf⟩:= optionVia singles A B a0 b0 T K hOK.1 hOK.2.1 tt X Y hF hG F0 G0 L O hLa hLb
(fun i=>hJ' i _) (fun i=> hI' i _) ref ⟨hJ,fun i=>h2,fun i=>h1⟩
⟨hI,fun i=>h5,fun i=>h4⟩ h.jump (by linarith only [hq.hG]) singles_short hs
let τ:Typus p singles A B:= ⟨tt,ref,F0.hang P0,G0.hang Q0⟩
let Front:=v.frontPage τ m i j k; let Back:=v.backPage τ m i j k
have hi a (ha:a∈ i.val): a0.agree a := (hv.leaf _ i.property).fixpin _ ha
have hi' a (ha:a∈ j.val): b0.agree a := (hv.leaf _ j.property).fixpin _ ha
have hm : 2*a≤ (pr (μ i) Front)*(pr (μ j) Back) := by
rw [←pairW_pr]
apply hk.trans
refine pr_on_mono hμ.nz (fun x hx he=>?_)
have h1 := hcol i x.1 (left_ne_zero_of_mul hx)
have h2 := hcol j x.2 (right_ne_zero_of_mul hx)
obtain ⟨ha,hb⟩:= berth_flags a0 b0 T he.2 (hi _ h1) (hi' _ h2)
exact ⟨⟨hf,hi _ h1,(hC _ i.property x.1 h1).1, ha⟩,
⟨hf,hi' _ h2,(hC _ j.property _ h2).1,hb⟩⟩
refine ⟨⟨(volume1,f,g),k,show OnFile p _ from τ⟩,hf.1,⟨?_,fun o ho hx=>?_⟩,
⟨?_,fun o ho hx=>?_⟩⟩
· exact hm.trans ((mul_le_mul_of_nonneg_left ((pr_le_tot (hu _).nz).trans (hu j).total.le)
(pr_nonneg (hu _).nz)).trans_eq (mul_one _))
· have hv := hcol i o hx
exact steadyBeacon z o X l true T τ.qA tt m E K
(fun x=> Nat.lt_succ_iff.mp (f x).isLt) rfl (hK i) hF (hl _ hv) ho.2.2.1
(hC _ i.property _ hv).2.1
· exact hm.trans ((mul_le_mul_of_nonneg_right ((pr_le_tot (hu _).nz).trans (hu i).total.le)
(pr_nonneg (hu _).nz)).trans_eq (one_mul _))
have hv:=hcol j o hx
exact steadyBeacon z o Y t false T' τ.qB tt m H K
(fun x=> Nat.lt_succ_iff.mp (g x).isLt) rfl (hK j) hG (ht' _ hv) ho.2.2.1
(hC _ j.property _ hv).2.1
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.RareTestEvents
namespace OAI
/-! # Compatible Table Events -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Matrix LinearMap Functionopen scoped BigOperators Topologyopen Templatenamespace StatusAnalysisopen PreparationParameters PredictionClass
variable {p:Shape} {n M K s0 N :ℕ} {w:LeafMixture p n N} {q:PreparationParameters}
structure Settled (t: LeafMixture p n N) (m:Mixer p n) (q:PreparationParameters) (U : Wgt (UnitType p n N)) (z:BMark p n N) (k:F) : Prop where readyC : IsLaw U ∧ t.strength U (usual p m N) q.leafNew (2*q.ζ) q.pins ∧ t.within (fun o=>frameSide p m o ∧ exactInk p m z o ∧ (∀ i,z o i∈effective (t.rooting o) i) ∧ glint p (z o)=k) hard : q.hardened p N t z
def shimmer (z:BMark p n N) (r:F) (x:UnitType p n N× UnitType p n N) := quench p (delta z) x=repeatQ r
variable (v: Station p n N q.pins w) (i j:w.T) (U:Wgt (UnitType p n N)) (m:Mixer p n) (z:BMark p n N)
private theorem chartKnown {r : F} (q:PreparationParameters) (x:w.T) (d: Stakes q.pins) (hw:Settled w m q U z r) {v : Charts p n (toRates d)} (hc:charted v (w.pin x.val).sp) (o : UnitType p n N) (hx:o∈x.val) : (∀ i,totalRank (z o i)≤ q.pins) ∧ ∃ y,∀ i∈x.val,coordSpec z i v y := by obtain ⟨h1,h2,h3⟩:=hw.readyC let A:=(w.pin x.val).sp have hi j : z o j∈effective A j := by have hh : w.rooting o=A:=congrArg Pin.sp (LeafMixture.poller_eq w h2.part x.property hx) rw [←hh]; exact (h3 x.val x.property o hx).2.2.1 j obtain ⟨T,hK,hB,hG⟩:=hw.hard obtain ⟨b,hb,hf⟩:=hG x.val x.property choose y hy using fun j=> show z o j∈LinearMap.range (v j) from (hc j).1.symm ▸ hi j refine ⟨fun i=>(effective_rank (hi i)).trans (h2.leaf x.val x.property).bound,y, fun i hh j=>?_⟩ exact (hy j).trans (congr_fun (hb.2.2 _ hx _ hh).1 j)
set_option maxHeartbeats 1800000 intheorem invoke (k:Fin (2^deckMax p q.pins)) (r:F) (a:ℝ) (hα:0<a) (h:AnalyticParameters p M q s0) (hw:Settled w m q U z r) (ht:v.bank) (hk:2*a ≤ pr (pairW (partW U i.val) (partW U j.val)) (fun x=> shimmer z r x∧ berthTicket (w.pin i.val) (w.pin j.val) (v.mails i j k) x)) : ∃ x:Scrip p q.pins, v.charter x.2.2 m x.2.1 U a (i,j) := by classical let K:=q.pins let T:=v.mails i j k have hq:=h.enter.first let a0:= w.pin i.val; let b0:= w.pin j.val let μ i:=partW U (Subtype.val (show w.T from i)) let S:=pairW (μ i) (μ j) obtain ⟨hm,hv,hC⟩:=hw.readyC have hu x:=show IsLaw (μ x) from on_law hm.nz (hv.leaf x.val x.property).pos have hμ: IsLaw S:= pairW_law (hu _) (hu _) have hK x : planRank (w.pin (Subtype.val (show w.T from x))).sp ≤ K := (hv.leaf _ (Subtype.prop x)).bound obtain ⟨f,hF⟩:=sizedCharts q.pins w v ht i (hK i) obtain ⟨g,hG⟩:=sizedCharts q.pins w v ht j (hK j) let A:= toRates f; let B:=toRates g; let X:=v.cAxes i A; let Y:=v.cAxes j B let P x:= shimmer z r x∧ berthTicket a0 b0 T x obtain ⟨o,⟨hop,hOK⟩,ho⟩:= exists_of_pr_pos hμ.nz (lt_of_lt_of_le (show 0<2*a by positivity) hk) let x:=o.1; let y:=o.2 have hcol i x (hx:μ i x≠0) : x∈ i.val := (onW_ne hx).1 have hx : x∈ i.val:= hcol i x (left_ne_zero_of_mul ho.ne') have hy : y∈ j.val:= hcol j y (right_ne_zero_of_mul ho.ne') obtain ⟨hχ,l,hl⟩:= chartKnown (v:=X) U m z q i f hw hF x hx obtain ⟨hξ,t,ht'⟩:= chartKnown (v:=Y) U m z q j g hw hG y hy have he (i : w.T) x (hx:x∈ i.val) : ∀ j,z x j∈effective (w.pin i.val).sp j := by have hi : w.rooting x=(w.pin i.val).sp:=congrArg Pin.sp (LeafMixture.poller_eq w hv.part i.property hx) rw [← hi]; exact (hC _ i.property _ hx).2.2.1 let kappa : Tag p.g:= ⟨0,by linarith only [hq.hG]⟩ let tt : Tagging p (Messenger singles):=fun _=>kappa let ref := show Messenger singles→F from fun _=>1 obtain ⟨E,h1,h2,h3⟩:= generic_summary p hq.hG kappa 1 0 obtain ⟨H,h4,h5,h6⟩:= generic_summary p hq.hG kappa 1 1 obtain ⟨L,hLa⟩:= buildBooths K a0.sp (hK i) h.penRoom obtain ⟨O,hLb⟩:= buildBooths K b0.sp (hK j) h.penRoom have hh : 2*frameBills p.g K+4 ≤ Fintype.card (Label p.b) := by have hl : frameBills p.g K + 1000 ≤ q.B:=h.forbid have he:= h.spare; omega obtain ⟨J,hJ,hJ'⟩:= fourPens _ K L hLa hh obtain ⟨I,hI,hI'⟩:= fourPens _ K O hLb hh let F0:Fabric p singles A true:=⟨J,fun _ => Flavor.full,beacon p X l true T E⟩ let T':= reciprocal p T let G0:Fabric p singles B false:=⟨I,fun _=> Flavor.full,beacon p Y t false T' H⟩ have hs : speak A B (sendSum ref F0.amp G0.amp)=(hailing p X Y T,0) := by apply (spoken X Y T ref F0.amp G0.amp).mpr have hFq a : fullq ref a=1 := by unfold fullq change (∑ _:Fin 1,(1:F))=1; rw [Fintype.sum_unique] have hR : rhyme F0.amp G0.amp := by intro i; have hf : (funds F0.amp i).1.1=E.diagO := congrArg (fun x=> x.1.1) (funds_one F0 i) have hg : (funds G0.amp i).1.1=H.diagO := congrArg (fun x=> x.1.1) (funds_one G0 i) change (funds (b:=true) F0.amp i).1.1+(funds (b:=false) G0.amp i).1.1=_; rw [hf,hg,h3,h6,zero_add] refine ⟨hFq,hR, stillBeacon z x X l true T E (hl _ hx) (fun k=>?_),stillBeacon z y Y t false T' H (ht' _ hy) (fun k=>?_)⟩ · rw [fitsTone z x hOK.2.2 (he _ _ hx), actualTone,(hC _ i.property _ hx).2.2.2] exact congr_fun (congrArg Prod.fst hop) k have hg:=fits_recip hOK.2.2; rw [reciprocal_actual] at hg rw [fitsTone z y hg (he _ _ hy), actualTone,(hC _ j.property _ hy).2.2.2] exact congr_fun (congrArg Prod.snd hop) k obtain ⟨P0,Q0,hf⟩:= optionVia singles A B a0 b0 T K hOK.1 hOK.2.1 tt X Y hF hG F0 G0 L O hLa hLb (fun i=>hJ' i _) (fun i=> hI' i _) ref ⟨hJ,fun i=>h2,fun i=>h1⟩ ⟨hI,fun i=>h5,fun i=>h4⟩ h.jump (by linarith only [hq.hG]) singles_short hs let τ:Typus p singles A B:= ⟨tt,ref,F0.hang P0,G0.hang Q0⟩ let Front:=v.frontPage τ m i j k; let Back:=v.backPage τ m i j k have hi a (ha:a∈ i.val): a0.agree a := (hv.leaf _ i.property).fixpin _ ha have hi' a (ha:a∈ j.val): b0.agree a := (hv.leaf _ j.property).fixpin _ ha have hm : 2*a≤ (pr (μ i) Front)*(pr (μ j) Back) := by rw [←pairW_pr] apply hk.trans refine pr_on_mono hμ.nz (fun x hx he=>?_) have h1 := hcol i x.1 (left_ne_zero_of_mul hx) have h2 := hcol j x.2 (right_ne_zero_of_mul hx) obtain ⟨ha,hb⟩:= berth_flags a0 b0 T he.2 (hi _ h1) (hi' _ h2) exact ⟨⟨hf,hi _ h1,(hC _ i.property x.1 h1).1, ha⟩, ⟨hf,hi' _ h2,(hC _ j.property _ h2).1,hb⟩⟩ refine ⟨⟨(volume1,f,g),k,show OnFile p _ from τ⟩,hf.1,⟨?_,fun o ho hx=>?_⟩, ⟨?_,fun o ho hx=>?_⟩⟩ · exact hm.trans ((mul_le_mul_of_nonneg_left ((pr_le_tot (hu _).nz).trans (hu j).total.le) (pr_nonneg (hu _).nz)).trans_eq (mul_one _)) · have hv := hcol i o hx exact steadyBeacon z o X l true T τ.qA tt m E K (fun x=> Nat.lt_succ_iff.mp (f x).isLt) rfl (hK i) hF (hl _ hv) ho.2.2.1 (hC _ i.property _ hv).2.1 · exact hm.trans ((mul_le_mul_of_nonneg_right ((pr_le_tot (hu _).nz).trans (hu i).total.le) (pr_nonneg (hu _).nz)).trans_eq (one_mul _)) have hv:=hcol j o hx exact steadyBeacon z o Y t false T' τ.qB tt m H K (fun x=> Nat.lt_succ_iff.mp (g x).isLt) rfl (hK j) hG (ht' _ hv) ho.2.2.1 (hC _ j.property _ hv).2.1
end StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115import Mathlib.Algebra.Group.Fin.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Fintype.Prod
namespace OAI
/-! # Component Indices -/
noncomputable section
namespace HadwigerCounterexample
abbrev Tag := Fin
abbrev Comp (g : ℕ) := { p : Tag g × Tag g // p.1 < p.2 }
variable {g : ℕ}
def edge (l d : Tag g) (h : l ≠ d) : Comp g :=
if hl : l < d then ⟨(l,d),hl⟩ else ⟨(d,l),lt_of_le_of_ne (le_of_not_gt hl) h.symm⟩
theorem edge_eq {l d : Tag g} (h : l < d) : edge l d (ne_of_lt h) = ⟨(l,d),h⟩ := by
simp [edge,h]
theorem edge_symm {l d : Tag g} (h : l ≠ d) : edge l d h = edge d l h.symm := by
rcases lt_or_gt_of_ne h with e|e
· simp [edge,e,not_lt.mpr e.le]
· simp [edge,e,not_lt.mpr e.le]
def inc (e : Comp g) (l : Tag g) : Prop := e.val.1 = l ∨ e.val.2 = l
instance (e : Comp g) (l : Tag g) : Decidable (inc e l) := inferInstanceAs (Decidable (_ ∨ _))
theorem inc_edge_fst {l d : Tag g} (h : l ≠ d) : inc (edge l d h) l := by
by_cases e : l < d <;> simp [inc,edge,e]
theorem inc_edge_iff {l d x : Tag g} (h : l ≠ d) : inc (edge l d h) x ↔ (l=x ∨ d=x) := by
by_cases e : l < d <;> simp [inc,edge,e,or_comm]
abbrev TagStar (l : Tag g) := {e : Comp g // inc e l}
def starEquiv (l : Tag g) : {d : Tag g // l ≠ d} ≃ TagStar l := by
let f (d : {d : Tag g // l ≠ d}) : TagStar l := ⟨edge l d d.property,inc_edge_fst _⟩
apply Equiv.ofBijective f
constructor
· intro i j h
have hi : inc (edge l i i.property) i := (inc_edge_iff _).mpr (Or.inr rfl)
change inc (f i).val i at hi
rw [h] at hi
exact Subtype.ext (((inc_edge_iff j.property).mp hi).resolve_left i.property).symm
· rintro ⟨⟨⟨i,j⟩,hij⟩,he⟩
rcases he with g|g
· change i = l at g
subst l
refine ⟨⟨j,hij.ne⟩,Subtype.ext ?_⟩
exact edge_eq hij
· change j = l at g
subst l
refine ⟨⟨i,hij.ne.symm⟩,Subtype.ext ?_⟩
dsimp only [f]
rw [edge_symm,edge_eq hij]
theorem card_star (l : Tag g) : Fintype.card (TagStar l) = g - 1 := by
rw [← Fintype.card_congr (starEquiv l)]
exact (Fintype.card_subtype_compl (fun d => l=d)).trans (by simp)
/-- l in I_d. -/
def allowed (d l : Tag g) :=
0 < (l-d).val ∧ (l-d).val ≤ (g-1)/2
instance (d l : Tag g) : Decidable (allowed d l) :=
inferInstanceAs (Decidable (_ ∧ _))
theorem not_allowed (d : Tag g) : ¬allowed d d := by
have : NeZero g := ⟨by have := d.isLt; omega⟩
simp [allowed]
theorem card_allowed (d : Tag g) : Fintype.card {l : Tag g // allowed d l} = (g-1)/2 := by
have : NeZero g := ⟨by have := d.isLt; omega⟩
let T := {l : Tag g // allowed d l}
let f (i : Fin ((g-1)/2)) : Tag g := ⟨i.val+1,by have := i.isLt; omega⟩
have hf (i) : allowed d (f i + d) := by
have := i.isLt
simp only [allowed,add_sub_cancel_right,f]
omega
let h : Fin ((g-1)/2) → T := fun i => ⟨f i + d,hf i⟩
have hh : Function.Bijective h := by
constructor
· intro i j hij
have he : f i = f j := add_right_cancel (congrArg Subtype.val hij)
have he' := congrArg Fin.val he
exact Fin.ext (Nat.add_right_cancel he')
· intro l
have hl := l.property
unfold allowed at hl
let i : Fin ((g-1)/2) := ⟨(l.val-d).val-1,by omega⟩
have hi : f i = l.val-d := Fin.ext (by dsimp only [i,f]; omega)
refine ⟨i,Subtype.ext ?_⟩
change f i + d = _
rw [hi,sub_add_cancel]
simpa using (Fintype.card_congr (Equiv.ofBijective h hh)).symm
theorem card_allowed' (l : Tag g) :
Fintype.card {d : Tag g // allowed d l} = (g-1)/2 := by
have : NeZero g := ⟨by have := l.isLt; omega⟩
let h : {d : Tag g // allowed d l} ≃ {x : Tag g // allowed 0 x} := {
toFun := fun d => ⟨l-d.val, by simpa only [allowed,sub_zero] using d.property⟩
invFun := fun x => ⟨l-x.val, by simpa only [allowed,sub_sub_cancel,sub_zero] using
x.property⟩
left_inv := fun d => Subtype.ext (sub_sub_cancel _ _)
right_inv := fun x => Subtype.ext (sub_sub_cancel _ _) }
exact (Fintype.card_congr h).trans (card_allowed _)
end HadwigerCounterexample
end
end OAIimport Mathlib.Algebra.Group.Fin.Basicimport Mathlib.Data.Fintype.Cardimport Mathlib.Data.Fintype.Prod
namespace OAI
/-! # Component Indices -/
noncomputable sectionnamespace HadwigerCounterexample
abbrev Tag := Finabbrev Comp (g : ℕ) := { p : Tag g × Tag g // p.1 < p.2 }
variable {g : ℕ}
def edge (l d : Tag g) (h : l ≠ d) : Comp g := if hl : l < d then ⟨(l,d),hl⟩ else ⟨(d,l),lt_of_le_of_ne (le_of_not_gt hl) h.symm⟩
theorem edge_eq {l d : Tag g} (h : l < d) : edge l d (ne_of_lt h) = ⟨(l,d),h⟩ := by simp [edge,h]
theorem edge_symm {l d : Tag g} (h : l ≠ d) : edge l d h = edge d l h.symm := by rcases lt_or_gt_of_ne h with e|e · simp [edge,e,not_lt.mpr e.le] · simp [edge,e,not_lt.mpr e.le]
def inc (e : Comp g) (l : Tag g) : Prop := e.val.1 = l ∨ e.val.2 = linstance (e : Comp g) (l : Tag g) : Decidable (inc e l) := inferInstanceAs (Decidable (_ ∨ _))
theorem inc_edge_fst {l d : Tag g} (h : l ≠ d) : inc (edge l d h) l := by by_cases e : l < d <;> simp [inc,edge,e]
theorem inc_edge_iff {l d x : Tag g} (h : l ≠ d) : inc (edge l d h) x ↔ (l=x ∨ d=x) := by by_cases e : l < d <;> simp [inc,edge,e,or_comm]
abbrev TagStar (l : Tag g) := {e : Comp g // inc e l}
def starEquiv (l : Tag g) : {d : Tag g // l ≠ d} ≃ TagStar l := by let f (d : {d : Tag g // l ≠ d}) : TagStar l := ⟨edge l d d.property,inc_edge_fst _⟩ apply Equiv.ofBijective f constructor · intro i j h have hi : inc (edge l i i.property) i := (inc_edge_iff _).mpr (Or.inr rfl) change inc (f i).val i at hi rw [h] at hi exact Subtype.ext (((inc_edge_iff j.property).mp hi).resolve_left i.property).symm · rintro ⟨⟨⟨i,j⟩,hij⟩,he⟩ rcases he with g|g · change i = l at g subst l refine ⟨⟨j,hij.ne⟩,Subtype.ext ?_⟩ exact edge_eq hij · change j = l at g subst l refine ⟨⟨i,hij.ne.symm⟩,Subtype.ext ?_⟩ dsimp only [f] rw [edge_symm,edge_eq hij]
theorem card_star (l : Tag g) : Fintype.card (TagStar l) = g - 1 := by rw [← Fintype.card_congr (starEquiv l)] exact (Fintype.card_subtype_compl (fun d => l=d)).trans (by simp)
/-- l in I_d. -/def allowed (d l : Tag g) := 0 < (l-d).val ∧ (l-d).val ≤ (g-1)/2
instance (d l : Tag g) : Decidable (allowed d l) := inferInstanceAs (Decidable (_ ∧ _))
theorem not_allowed (d : Tag g) : ¬allowed d d := by have : NeZero g := ⟨by have := d.isLt; omega⟩ simp [allowed]
theorem card_allowed (d : Tag g) : Fintype.card {l : Tag g // allowed d l} = (g-1)/2 := by have : NeZero g := ⟨by have := d.isLt; omega⟩ let T := {l : Tag g // allowed d l} let f (i : Fin ((g-1)/2)) : Tag g := ⟨i.val+1,by have := i.isLt; omega⟩ have hf (i) : allowed d (f i + d) := by have := i.isLt simp only [allowed,add_sub_cancel_right,f] omega let h : Fin ((g-1)/2) → T := fun i => ⟨f i + d,hf i⟩ have hh : Function.Bijective h := by constructor · intro i j hij have he : f i = f j := add_right_cancel (congrArg Subtype.val hij) have he' := congrArg Fin.val he exact Fin.ext (Nat.add_right_cancel he') · intro l have hl := l.property unfold allowed at hl let i : Fin ((g-1)/2) := ⟨(l.val-d).val-1,by omega⟩ have hi : f i = l.val-d := Fin.ext (by dsimp only [i,f]; omega) refine ⟨i,Subtype.ext ?_⟩ change f i + d = _ rw [hi,sub_add_cancel] simpa using (Fintype.card_congr (Equiv.ofBijective h hh)).symm
theorem card_allowed' (l : Tag g) : Fintype.card {d : Tag g // allowed d l} = (g-1)/2 := by have : NeZero g := ⟨by have := l.isLt; omega⟩ let h : {d : Tag g // allowed d l} ≃ {x : Tag g // allowed 0 x} := { toFun := fun d => ⟨l-d.val, by simpa only [allowed,sub_zero] using d.property⟩ invFun := fun x => ⟨l-x.val, by simpa only [allowed,sub_sub_cancel,sub_zero] using x.property⟩ left_inv := fun d => Subtype.ext (sub_sub_cancel _ _) right_inv := fun x => Subtype.ext (sub_sub_cancel _ _) } exact (Fintype.card_congr h).trans (card_allowed _)
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169import OAI.Combinatorics.HadwigerCounterexample.DependentPairConcentration
namespace OAI
/-! # Concentration Scales -/
noncomputable section
namespace HadwigerCounterexample
open Matrix LinearMap Module Finset Filter Real Function
open scoped BigOperators Topology
variable {X : Type*}
/-- pay slack for any fixed multiple of exponentially smaller term. -/
theorem pay_nat {a b : ℝ} (c : ℝ) (hab : b < a) :
∀ᶠ n : ℕ in atTop,c * bp (-a*n) ≤ bp (-b*n) := by
have h := (bp_tendsto (sub_pos.mpr hab)).comp (tendsto_natCast_atTop_atTop (R:=ℝ))
filter_upwards [h.eventually (eventually_ge_atTop c)] with n hn
change c ≤ bp ((a-b)*n) at hn
refine (mul_le_mul_of_nonneg_right hn (bp_pos _).le).trans_eq ?_
rw [← bp_add, show (a-b)*n + -a*n= -b*n by ring]
theorem pay_div_nat {a b : ℝ} (c u : ℝ) (hu : 0 < u) (hab : b < a) :
∀ᶠ n : ℕ in atTop,c * bp (-a*n) ≤ u*bp (-b*n) := by
filter_upwards [pay_nat (c/u) hab] with n hn
calc _ = u*(c/u*bp (-a*n)) := by field_simp
_ ≤ _ := mul_le_mul_of_nonneg_left hn hu.le
theorem cast_tops (M : ℕ) (hM : 1≤M) :
Tendsto (fun n : ℕ => (↑(M*n):ℝ)) atTop atTop := by
simp_rw [Nat.cast_mul]; exact
(tendsto_const_mul_atTop_of_pos (show 0<(M:ℝ) from by
exact_mod_cast (show 0 < M from hM))).mpr tendsto_natCast_atTop_atTop
variable {p : Shape} {M n N : ℕ}
variable {I J K G A B : Type} [Fintype I] [Fintype J] [Fintype K] [Fintype G]
variable [DecidableEq I] [DecidableEq J] [DecidableEq K] [DecidableEq G]
variable [Fintype A] [Fintype B]
variable {g : Route J G}
omit [Fintype G] [DecidableEq J] in
theorem port_limit (g : Route J G) (i : G) :
num (Port g i) ≤ num J := by
exact_mod_cast Fintype.card_subtype_le _
namespace Program
variable {s : Program p n g A}
/-- empirical input-and-image law -/
def makeData (s : Program p n g A) (w : Wgt A) (o : Forum p n N G) :
Wgt (A×Rack J N) :=
mapW w (fun x => (x,s.showKey x o))
omit [Fintype G] [DecidableEq G] in
theorem data_law (s : Program p n g A) (w : Wgt A) (o : Forum p n N G)
(hw : IsLaw w) : IsLaw (s.makeData w o) := mapW_law hw _
omit [Fintype G] [DecidableEq G] in
theorem view_data (s : Program p n g A) (w : Wgt A) (o : Forum p n N G)
(f : Wgt (A×Rack J N)) :
avg (s.makeData w o) f=s.oexpect w (fun a b => f (a,b)) o := mapW_avg ..
omit [Fintype G] [DecidableEq G] in
theorem freq_data (s : Program p n g A) (w : Wgt A) (o : Forum p n N G)
(P : A×Rack J N→Prop) :
pr (s.makeData w o) P = oFreq w (fun a b => P (a,b)) o s := mapW_pr ..
set_option maxHeartbeats 600000 in
theorem variance_calendar (p : Shape) (M : ℕ) (g : Route J G)
(r u : ℝ) (hu : 0 < u) (hM : 1≤M) :
∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n)
(A : Type) [Fintype A] (s : Program p n g A)
(T : A→ Wgt (Rack J N)) (w : Wgt A), IsLaw w →
(∀ x y, |T x y|≤1) →2*num (Full p n)<N →
pr (draws Bool w) (fun x => ¬ s.free x) ≤ bp (r-n) →
(let v := forumLaw m N
let f := s.oexpect w T
avg v (fun x => (f x-avg v f)^2)) ≤ u*bp (-(1/4:ℝ)*n) := by
let t := tied g Bool
let k := num (Bool×J)
let b := 2*netFact t
let c := num G* (2*bp k)+1
filter_upwards [pay_div_nat (a:=1) (2*bp r) (u/2) (by positivity) (b:=1/4) (by norm_num),
pay_div_nat (a:=1/2) (b*c) (u/2) (by positivity) (b:=1/4) (by norm_num),
(cast_tops M hM).eventually (eventually_ge_atTop (2*k+1))]
with n hn hh hk N m A _ s T w hw hT hN h
change (2*k+1) ≤ (↑(M*n) : ℝ) at hk
have he := oVar m hN T w hw hT k (fun i => port_limit _ i) (by linarith only [hk])
(bp (r-n)) h
apply he.trans
subst N
have hv : (n:ℝ) ≤ (M*n:ℕ) := by exact_mod_cast (show n ≤ M*n from by nlinarith)
let P := bp (-(1/2:ℝ)*n)
have ht : twinkle t k (M*n) ≤ c*P := by
have hq : bp (k-(M*n:ℕ)) ≤ bp k*P := by
unfold P; rw [← bp_add]; apply bp_le; linarith only [hv,Nat.cast_nonneg (α:=ℝ) n]
have hr : bp (-(↑(M*n):ℝ)/2)≤P := bp_le (by linarith only [hv])
calc _ ≤ num G*(2*(bp k * P))+P := add_le_add
(mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hq (by norm_num))
(Nat.cast_nonneg _)) hr
_ = _ := by unfold c; ring
have h1 : 2*bp (r-n) ≤ u/2*bp (-(1/4:ℝ)*n) := by
simpa only [mul_assoc,← bp_add,neg_mul,one_mul,←sub_eq_add_neg] using hn
have h2 : 2*netFact t* twinkle t k (M*n)≤ u/2*bp (-(1/4:ℝ)*n) :=
(mul_le_mul_of_nonneg_left ht (by apply mul_nonneg (by norm_num) netFact_pos.le)).trans
(le_trans (le_of_eq (Eq.symm (mul_assoc b c P))) hh)
exact (add_le_add h1 h2).trans_eq (by ring)
theorem approx_calendar (p : Shape) (M : ℕ) (g : Route J G)
(r η : ℝ) (hη : 0<η) (hM : 1 ≤ M) :
∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n)
(A : Type) [Fintype A] (s : Program p n g A)
(w : Wgt A), IsLaw w →
2*num (Full p n)<N →
pr (draws Bool w) (fun x => ¬ s.free x) ≤ bp (r-n) →
approxData (forumLaw m N) (s.makeData w) η (bp (-(1/4:ℝ)*n)) := by
filter_upwards [variance_calendar p M g r (η^2) (by positivity) hM]
with n hn N m A _ s w hw hN he F hF
subst N
let T (x : A) (y : Rack J (M*n)) := F (x,y)
rw [mixW_avg]; simp_rw [view_data]
refine (outlier (forum_law m hN).nz _ η hη
(hn m _ s T w hw (fun x y => hF _) hN he)).trans_eq ?_
field_simp
theorem thin_calendar (p : Shape) (M : ℕ) (g : Route J G)
(b η c : ℝ) (hc : 0 < c) (hη : 0<η) (hM : 1≤M) :
∃ l : ℕ, ∀ r : ℝ, ∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n)
(A : Type) [Fintype A] (s : Program p n g A)
(w : Wgt A), IsLaw w →
2*num (Full p n)<N →
pr (draws (Fin l) w) (fun x => ¬ s.free x) ≤ bp (r-n) →
thinData (forumLaw m N) (s.makeData w) (bp (-c*n)) η (bp (-b*n)) := by
obtain ⟨l,hl⟩ := exists_nat_gt (b/c)
let d := η^l/2
have hd : 0<d := by positivity
let t := tied g (Fin l)
let k := num (Fin l × J)
refine ⟨l,fun r => ?_⟩
filter_upwards [pay_div_nat (a:=1) (bp r) d hd (b:=0) (by norm_num),
pay_div_nat (a:=c*l) (netFact t) d hd (b:=b)
(by rwa [div_lt_iff₀ hc,mul_comm] at hl),
(cast_tops M hM).eventually (eventually_ge_atTop (2*k+1))]
with n hn hh hk N m A _ s w hw hN hr P hP
subst N; let N := M*n
change 2*k+1 ≤ (N:ℝ) at hk
let T (x : A) (y : Rack J N) := P (x,y)
let v := forumLaw (G:=G) m N
let f := fun o => oFreq w T o s
rw [show pr (mixW v (s.makeData w)) P=avg v (fun x => pr (s.makeData w x) P) from mixW_avg ..] at hP
simp_rw [freq_data] at *
have hi : bp (r-n) ≤ d := by
simpa only [neg_zero,zero_mul,bp_zero,mul_one,← bp_add,neg_mul,one_mul, ← sub_eq_add_neg]
using hn
have hj : η^l=d+d := by unfold d; ring
have he := oTail m hN T w hw (k:=k) (fun i => port_limit _ i) (by linarith only [hk])
(bp (r-n)) hr hη.le
have hv := forum_law (G:=G) m hN
apply le_of_mul_le_mul_left _ hd
calc d*pr v (fun x => η ≤ f x)
_ ≤ _ := mul_le_mul_of_nonneg_right (show d≤η^l-bp (r-n) from by
rw [hj]; linarith only [hi]) (pr_nonneg hv.nz)
_ ≤ _ := he
_ ≤ netFact t * bp (-c*n)^l := mul_le_mul_of_nonneg_left
(pow_le_pow_left₀ (avg_nonneg hv.nz fun x => pr_nonneg hw.nz) hP l) netFact_pos.le
_ ≤ _ := by rw [← bp_mul_nat,show -c*n*l= -(c*l)*n by ring]; exact hh
end Program
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.DependentPairConcentration
namespace OAI
/-! # Concentration Scales -/
noncomputable sectionnamespace HadwigerCounterexample
open Matrix LinearMap Module Finset Filter Real Functionopen scoped BigOperators Topologyvariable {X : Type*}
/-- pay slack for any fixed multiple of exponentially smaller term. -/theorem pay_nat {a b : ℝ} (c : ℝ) (hab : b < a) : ∀ᶠ n : ℕ in atTop,c * bp (-a*n) ≤ bp (-b*n) := by have h := (bp_tendsto (sub_pos.mpr hab)).comp (tendsto_natCast_atTop_atTop (R:=ℝ)) filter_upwards [h.eventually (eventually_ge_atTop c)] with n hn change c ≤ bp ((a-b)*n) at hn refine (mul_le_mul_of_nonneg_right hn (bp_pos _).le).trans_eq ?_ rw [← bp_add, show (a-b)*n + -a*n= -b*n by ring]
theorem pay_div_nat {a b : ℝ} (c u : ℝ) (hu : 0 < u) (hab : b < a) : ∀ᶠ n : ℕ in atTop,c * bp (-a*n) ≤ u*bp (-b*n) := by filter_upwards [pay_nat (c/u) hab] with n hn calc _ = u*(c/u*bp (-a*n)) := by field_simp _ ≤ _ := mul_le_mul_of_nonneg_left hn hu.le
theorem cast_tops (M : ℕ) (hM : 1≤M) : Tendsto (fun n : ℕ => (↑(M*n):ℝ)) atTop atTop := by simp_rw [Nat.cast_mul]; exact (tendsto_const_mul_atTop_of_pos (show 0<(M:ℝ) from by exact_mod_cast (show 0 < M from hM))).mpr tendsto_natCast_atTop_atTop
variable {p : Shape} {M n N : ℕ}variable {I J K G A B : Type} [Fintype I] [Fintype J] [Fintype K] [Fintype G]variable [DecidableEq I] [DecidableEq J] [DecidableEq K] [DecidableEq G]variable [Fintype A] [Fintype B]variable {g : Route J G}
omit [Fintype G] [DecidableEq J] intheorem port_limit (g : Route J G) (i : G) : num (Port g i) ≤ num J := by exact_mod_cast Fintype.card_subtype_le _
namespace Programvariable {s : Program p n g A}
/-- empirical input-and-image law -/def makeData (s : Program p n g A) (w : Wgt A) (o : Forum p n N G) : Wgt (A×Rack J N) := mapW w (fun x => (x,s.showKey x o))omit [Fintype G] [DecidableEq G] intheorem data_law (s : Program p n g A) (w : Wgt A) (o : Forum p n N G) (hw : IsLaw w) : IsLaw (s.makeData w o) := mapW_law hw _omit [Fintype G] [DecidableEq G] intheorem view_data (s : Program p n g A) (w : Wgt A) (o : Forum p n N G) (f : Wgt (A×Rack J N)) : avg (s.makeData w o) f=s.oexpect w (fun a b => f (a,b)) o := mapW_avg ..omit [Fintype G] [DecidableEq G] intheorem freq_data (s : Program p n g A) (w : Wgt A) (o : Forum p n N G) (P : A×Rack J N→Prop) : pr (s.makeData w o) P = oFreq w (fun a b => P (a,b)) o s := mapW_pr ..
set_option maxHeartbeats 600000 intheorem variance_calendar (p : Shape) (M : ℕ) (g : Route J G) (r u : ℝ) (hu : 0 < u) (hM : 1≤M) : ∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n) (A : Type) [Fintype A] (s : Program p n g A) (T : A→ Wgt (Rack J N)) (w : Wgt A), IsLaw w → (∀ x y, |T x y|≤1) →2*num (Full p n)<N → pr (draws Bool w) (fun x => ¬ s.free x) ≤ bp (r-n) → (let v := forumLaw m N let f := s.oexpect w T avg v (fun x => (f x-avg v f)^2)) ≤ u*bp (-(1/4:ℝ)*n) := by let t := tied g Bool let k := num (Bool×J) let b := 2*netFact t let c := num G* (2*bp k)+1 filter_upwards [pay_div_nat (a:=1) (2*bp r) (u/2) (by positivity) (b:=1/4) (by norm_num), pay_div_nat (a:=1/2) (b*c) (u/2) (by positivity) (b:=1/4) (by norm_num), (cast_tops M hM).eventually (eventually_ge_atTop (2*k+1))] with n hn hh hk N m A _ s T w hw hT hN h change (2*k+1) ≤ (↑(M*n) : ℝ) at hk have he := oVar m hN T w hw hT k (fun i => port_limit _ i) (by linarith only [hk]) (bp (r-n)) h apply he.trans subst N have hv : (n:ℝ) ≤ (M*n:ℕ) := by exact_mod_cast (show n ≤ M*n from by nlinarith) let P := bp (-(1/2:ℝ)*n) have ht : twinkle t k (M*n) ≤ c*P := by have hq : bp (k-(M*n:ℕ)) ≤ bp k*P := by unfold P; rw [← bp_add]; apply bp_le; linarith only [hv,Nat.cast_nonneg (α:=ℝ) n] have hr : bp (-(↑(M*n):ℝ)/2)≤P := bp_le (by linarith only [hv]) calc _ ≤ num G*(2*(bp k * P))+P := add_le_add (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hq (by norm_num)) (Nat.cast_nonneg _)) hr _ = _ := by unfold c; ring have h1 : 2*bp (r-n) ≤ u/2*bp (-(1/4:ℝ)*n) := by simpa only [mul_assoc,← bp_add,neg_mul,one_mul,←sub_eq_add_neg] using hn have h2 : 2*netFact t* twinkle t k (M*n)≤ u/2*bp (-(1/4:ℝ)*n) := (mul_le_mul_of_nonneg_left ht (by apply mul_nonneg (by norm_num) netFact_pos.le)).trans (le_trans (le_of_eq (Eq.symm (mul_assoc b c P))) hh) exact (add_le_add h1 h2).trans_eq (by ring)
theorem approx_calendar (p : Shape) (M : ℕ) (g : Route J G) (r η : ℝ) (hη : 0<η) (hM : 1 ≤ M) : ∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n) (A : Type) [Fintype A] (s : Program p n g A) (w : Wgt A), IsLaw w → 2*num (Full p n)<N → pr (draws Bool w) (fun x => ¬ s.free x) ≤ bp (r-n) → approxData (forumLaw m N) (s.makeData w) η (bp (-(1/4:ℝ)*n)) := by filter_upwards [variance_calendar p M g r (η^2) (by positivity) hM] with n hn N m A _ s w hw hN he F hF subst N let T (x : A) (y : Rack J (M*n)) := F (x,y) rw [mixW_avg]; simp_rw [view_data] refine (outlier (forum_law m hN).nz _ η hη (hn m _ s T w hw (fun x y => hF _) hN he)).trans_eq ?_ field_simp
theorem thin_calendar (p : Shape) (M : ℕ) (g : Route J G) (b η c : ℝ) (hc : 0 < c) (hη : 0<η) (hM : 1≤M) : ∃ l : ℕ, ∀ r : ℝ, ∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n) (A : Type) [Fintype A] (s : Program p n g A) (w : Wgt A), IsLaw w → 2*num (Full p n)<N → pr (draws (Fin l) w) (fun x => ¬ s.free x) ≤ bp (r-n) → thinData (forumLaw m N) (s.makeData w) (bp (-c*n)) η (bp (-b*n)) := by obtain ⟨l,hl⟩ := exists_nat_gt (b/c) let d := η^l/2 have hd : 0<d := by positivity let t := tied g (Fin l) let k := num (Fin l × J) refine ⟨l,fun r => ?_⟩ filter_upwards [pay_div_nat (a:=1) (bp r) d hd (b:=0) (by norm_num), pay_div_nat (a:=c*l) (netFact t) d hd (b:=b) (by rwa [div_lt_iff₀ hc,mul_comm] at hl), (cast_tops M hM).eventually (eventually_ge_atTop (2*k+1))] with n hn hh hk N m A _ s w hw hN hr P hP subst N; let N := M*n change 2*k+1 ≤ (N:ℝ) at hk let T (x : A) (y : Rack J N) := P (x,y) let v := forumLaw (G:=G) m N let f := fun o => oFreq w T o s rw [show pr (mixW v (s.makeData w)) P=avg v (fun x => pr (s.makeData w x) P) from mixW_avg ..] at hP simp_rw [freq_data] at * have hi : bp (r-n) ≤ d := by simpa only [neg_zero,zero_mul,bp_zero,mul_one,← bp_add,neg_mul,one_mul, ← sub_eq_add_neg] using hn have hj : η^l=d+d := by unfold d; ring have he := oTail m hN T w hw (k:=k) (fun i => port_limit _ i) (by linarith only [hk]) (bp (r-n)) hr hη.le have hv := forum_law (G:=G) m hN apply le_of_mul_le_mul_left _ hd calc d*pr v (fun x => η ≤ f x) _ ≤ _ := mul_le_mul_of_nonneg_right (show d≤η^l-bp (r-n) from by rw [hj]; linarith only [hi]) (pr_nonneg hv.nz) _ ≤ _ := he _ ≤ netFact t * bp (-c*n)^l := mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (avg_nonneg hv.nz fun x => pr_nonneg hw.nz) hP l) netFact_pos.le _ ≤ _ := by rw [← bp_mul_nat,show -c*n*l= -(c*l)*n by ring]; exact hhend Programend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156import OAI.Combinatorics.HadwigerCounterexample.GradientRealization
import OAI.Combinatorics.HadwigerCounterexample.WalshBounds
namespace OAI
/-! # Conditional Cell Entropy -/
noncomputable section
namespace HadwigerCounterexample
open Matrix LinearMap Submodule Module Finset
open scoped BigOperators
variable {p : Shape} {n N : ℕ}
theorem plan_add_disjoint (a b : Plan p n) (h : ∀ z, Disjoint (a z) (b z)) :
planRank (a⊔b)=planRank a+planRank b := by
unfold planRank
rw [← Finset.sum_add_distrib]
refine Finset.sum_congr rfl fun i _ => ?_
have he := Submodule.finrank_sup_add_finrank_inf_eq (a i) (b i)
rw [(h i).eq_bot,finrank_bot,add_zero] at he
exact he
theorem plan_new_disjoint (a b : Plan p n) (h : ∀ z,Disjoint (a z) (b z)) :
planNew a b=planRank b := by rw [planNew,plan_add_disjoint a b h,Nat.add_sub_cancel_left]
variable {I : Type} [Fintype I]
def kslots (p : Shape) (I : Type) [Fintype I] :=
Fintype.card I*(p.g-1)*2
def kmax (p : Shape) := 56*(p.g-1)
theorem slots_budget {w : I→Bool} (v : Volley p n I)
(hb : v.bounded w) : kslots p I ≤ kmax p := by
classical
have h := v.call_count hb
unfold kslots kmax; nlinarith
instance instFKeys (t : Tagging p I) (N : ℕ) : Fintype (Keys (p:=p) t N) :=
by classical exact inferInstance
theorem dim_keys (t : Tagging p I) :
dim (Keys (p:=p) t N) = kslots p I * N := by
have h (l : Tag p.g) :
dim (AtomKey (p:=p) l N)=(p.g-1)*(2*N) := by
unfold AtomKey dim
rw [finrank_pi_fintype]
have he : finrank F (Bool → Vec (Fin N))=2*N := by
rw [finrank_pi_fintype]
simp_rw [show finrank F (Vec (Fin N))=_ from dim_vec _]
simp
simp_rw [he]
simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,card_star]; rfl
unfold dim Keys kslots
rw [finrank_pi_fintype]
have hx i : finrank F (AtomKey (p:=p) (t i) N)=(p.g-1)*(2*N) := h (t i)
simp_rw [hx]
simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Nat.cast_id]
ring
namespace Volley
variable {v : Volley p n I}
theorem key_slots (t : Tagging p I) {q} {a : Plan p n}
(h : v.avoids a q) :
planNew a (v.keyPlan t) = kslots p I := by
classical
let Y := visits p t
have hh i := key_independent v t h i
have he (z : Place p) : dim (keyPlan v t z)=Fintype.card (Y z.1) :=
mrk_inj.mp (hh z).1
rw [plan_new_disjoint a _ (fun i => Disjoint.mono_left (pin_le_table a i)
(hh i).2.symm), planRank,Fintype.sum_prod_type]
simp_rw [Fintype.sum_bool,he,←two_mul,←Finset.mul_sum]
have hE : ∑ i : Comp p.g,Fintype.card (Y i)=Fintype.card I*(p.g-1) := by
have hf {A : Type} [Fintype A] (p : A → Prop) [DecidablePred p] :
Fintype.card {i:A//p i}=∑ i:A, if p i then (1:ℕ) else 0 := by
rw [Fintype.card_subtype,←Finset.sum_filter]; simp
have hY (i) : Fintype.card (Y i)=∑ j:I,if inc i (t j) then (1:ℕ) else 0 := hf _
simp_rw [hY]
rw [Finset.sum_comm]
simp_rw [← hf (fun i => inc i _)]
have hz (j) : Fintype.card {i:Comp p.g//inc i (t j)}=p.g-1 := card_star (t j)
simp_rw [hz]
simp
rw [hE]; unfold kslots; ring
/-- chosen reference x fixes the pin made of a and all key directions
for every y in the same pin which agrees on query key. -/
theorem key_pin (t : Tagging p I) {a : Pin p n N} {x y : UnitType p n N}
(hx : a.agree x) (hy : a.agree y) (h : v.keys t x=v.keys t y) :
(Pin.make (v.frozen a.sp t) x).agree y := by
classical
intro i u hu
obtain ⟨l,hl,r,⟨z,rfl⟩,rfl⟩ := Submodule.mem_sup.mp
(show u∈a.sp i⊔v.keyPlan t i from hu)
have hZ : images y i * v.keyM t i.1 = images x i * v.keyM t i.1 := by
ext b j
obtain ⟨k,hk⟩ := j
have ht := congr_fun (congr_fun (congr_fun h k) (⟨i.1,hk⟩ : TagStar _)) i.2
rw [v.keys_loc,v.keys_loc] at ht
exact congr_fun ht.symm b
change images y i *ᵥ _ = images x i *ᵥ _
rw [Matrix.mulVec_add,Matrix.mulVec_add,hx _ _ hl,hy _ _ hl]
rw [mulVecLin_apply,mulVec_mulVec,mulVec_mulVec,hZ]
end Volley
def tau (N k : ℕ) := bp (-((k:ℝ)+0.01)*N)
def hit (N : ℕ) := bp (-0.02*N)
theorem in_clear {a f : Pin p n N} {k : ℕ} {ζ : ℝ} {w : Wgt (UnitType p n N)}
(hz : ζ ≤ 0.004) (hkz : ζ*k ≤ 0.004)
(hw : SubLaw w) (h : a.clear ζ w) (hF : a.sp≤f.sp) (hk : planRank f.sp=planRank a.sp+k)
(S : UnitType p n N → Prop)
(hS : ∀ x,S x → f.agree x) (ht : tau N k ≤ pr w S) :
IsLaw (onW w S) ∧ f.clear 0.05 (onW w S) := by
classical
have hpos : 0 < pr w S := lt_of_lt_of_le (bp_pos _) ht
have hh : IsLaw (onW w S) := normW_law (subW_nonneg hw.nz _) hpos
refine ⟨hh,fun b => ?_⟩
let t := planNew f.sp b.sp
by_cases he : t=0
· change pr _ _ ≤ fee N _ t
rw [he,fee]
simp only [Nat.cast_zero,mul_zero,zero_mul,bp_zero]
exact (pr_le_tot hh.nz).trans hh.total.le
let R := fun x => S x ∧ b.agree x
by_cases hf : 0 < pr w R
· obtain ⟨x,⟨hx,hB⟩,_⟩ := exists_of_pr_pos hw.nz hf
let c := Pin.make (f.sp⊔b.sp) x
have hc : pr w R≤ fee N ζ (planNew a.sp c.sp) := (pr_mono hw.nz (q:=c.agree)
(fun y hy => ((Pin.combine (hS x hx) hB).mpr ⟨hS _ hy.1,hy.2⟩))).trans (h c)
have hN : planNew a.sp c.sp=k+t := by
have hh : planNew a.sp f.sp+t=planNew a.sp c.sp := planNew_mono_add hF
rw [← hh]
rw [planNew, sup_eq_right.mpr hF,hk, Nat.add_sub_cancel_left]
rw [hN] at hc
rw [pr_on]
refine ((div_le_div₀ (bp_pos _).le hc (bp_pos _) ht)).trans ?_
unfold fee
rw [←bp_sub]
refine bp_le ?_
have h1 : 1 ≤ (t:ℝ) := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr he
have hg := mul_le_mul_of_nonneg_right hz (show 0≤(t:ℝ) from Nat.cast_nonneg _)
rw [Nat.cast_add]
change _ ≤ -(1-0.05)*(t : ℝ)*N
rw [← sub_mul]
exact mul_le_mul_of_nonneg_right (by linarith only [hkz,h1,hg]) (Nat.cast_nonneg _)
· rw [pr_on]
exact (div_nonpos_of_nonpos_of_nonneg (not_lt.mp hf) hpos.le).trans (bp_pos _).le
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.GradientRealizationimport OAI.Combinatorics.HadwigerCounterexample.WalshBounds
namespace OAI
/-! # Conditional Cell Entropy -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix LinearMap Submodule Module Finsetopen scoped BigOperatorsvariable {p : Shape} {n N : ℕ}
theorem plan_add_disjoint (a b : Plan p n) (h : ∀ z, Disjoint (a z) (b z)) : planRank (a⊔b)=planRank a+planRank b := by unfold planRank rw [← Finset.sum_add_distrib] refine Finset.sum_congr rfl fun i _ => ?_ have he := Submodule.finrank_sup_add_finrank_inf_eq (a i) (b i) rw [(h i).eq_bot,finrank_bot,add_zero] at he exact he
theorem plan_new_disjoint (a b : Plan p n) (h : ∀ z,Disjoint (a z) (b z)) : planNew a b=planRank b := by rw [planNew,plan_add_disjoint a b h,Nat.add_sub_cancel_left]
variable {I : Type} [Fintype I]
def kslots (p : Shape) (I : Type) [Fintype I] := Fintype.card I*(p.g-1)*2def kmax (p : Shape) := 56*(p.g-1)theorem slots_budget {w : I→Bool} (v : Volley p n I) (hb : v.bounded w) : kslots p I ≤ kmax p := by classical have h := v.call_count hb unfold kslots kmax; nlinarith
instance instFKeys (t : Tagging p I) (N : ℕ) : Fintype (Keys (p:=p) t N) := by classical exact inferInstance
theorem dim_keys (t : Tagging p I) : dim (Keys (p:=p) t N) = kslots p I * N := by have h (l : Tag p.g) : dim (AtomKey (p:=p) l N)=(p.g-1)*(2*N) := by unfold AtomKey dim
rw [finrank_pi_fintype] have he : finrank F (Bool → Vec (Fin N))=2*N := by rw [finrank_pi_fintype] simp_rw [show finrank F (Vec (Fin N))=_ from dim_vec _] simp simp_rw [he] simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,card_star]; rfl unfold dim Keys kslots rw [finrank_pi_fintype] have hx i : finrank F (AtomKey (p:=p) (t i) N)=(p.g-1)*(2*N) := h (t i) simp_rw [hx] simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Nat.cast_id] ring
namespace Volleyvariable {v : Volley p n I}
theorem key_slots (t : Tagging p I) {q} {a : Plan p n} (h : v.avoids a q) : planNew a (v.keyPlan t) = kslots p I := by classical let Y := visits p t have hh i := key_independent v t h i have he (z : Place p) : dim (keyPlan v t z)=Fintype.card (Y z.1) := mrk_inj.mp (hh z).1 rw [plan_new_disjoint a _ (fun i => Disjoint.mono_left (pin_le_table a i) (hh i).2.symm), planRank,Fintype.sum_prod_type] simp_rw [Fintype.sum_bool,he,←two_mul,←Finset.mul_sum] have hE : ∑ i : Comp p.g,Fintype.card (Y i)=Fintype.card I*(p.g-1) := by have hf {A : Type} [Fintype A] (p : A → Prop) [DecidablePred p] : Fintype.card {i:A//p i}=∑ i:A, if p i then (1:ℕ) else 0 := by rw [Fintype.card_subtype,←Finset.sum_filter]; simp
have hY (i) : Fintype.card (Y i)=∑ j:I,if inc i (t j) then (1:ℕ) else 0 := hf _ simp_rw [hY] rw [Finset.sum_comm] simp_rw [← hf (fun i => inc i _)] have hz (j) : Fintype.card {i:Comp p.g//inc i (t j)}=p.g-1 := card_star (t j) simp_rw [hz] simp rw [hE]; unfold kslots; ring
/-- chosen reference x fixes the pin made of a and all key directionsfor every y in the same pin which agrees on query key. -/theorem key_pin (t : Tagging p I) {a : Pin p n N} {x y : UnitType p n N} (hx : a.agree x) (hy : a.agree y) (h : v.keys t x=v.keys t y) : (Pin.make (v.frozen a.sp t) x).agree y := by classical intro i u hu obtain ⟨l,hl,r,⟨z,rfl⟩,rfl⟩ := Submodule.mem_sup.mp (show u∈a.sp i⊔v.keyPlan t i from hu) have hZ : images y i * v.keyM t i.1 = images x i * v.keyM t i.1 := by ext b j obtain ⟨k,hk⟩ := j have ht := congr_fun (congr_fun (congr_fun h k) (⟨i.1,hk⟩ : TagStar _)) i.2 rw [v.keys_loc,v.keys_loc] at ht exact congr_fun ht.symm b change images y i *ᵥ _ = images x i *ᵥ _ rw [Matrix.mulVec_add,Matrix.mulVec_add,hx _ _ hl,hy _ _ hl] rw [mulVecLin_apply,mulVec_mulVec,mulVec_mulVec,hZ]end Volley
def tau (N k : ℕ) := bp (-((k:ℝ)+0.01)*N)def hit (N : ℕ) := bp (-0.02*N)
theorem in_clear {a f : Pin p n N} {k : ℕ} {ζ : ℝ} {w : Wgt (UnitType p n N)} (hz : ζ ≤ 0.004) (hkz : ζ*k ≤ 0.004) (hw : SubLaw w) (h : a.clear ζ w) (hF : a.sp≤f.sp) (hk : planRank f.sp=planRank a.sp+k) (S : UnitType p n N → Prop) (hS : ∀ x,S x → f.agree x) (ht : tau N k ≤ pr w S) : IsLaw (onW w S) ∧ f.clear 0.05 (onW w S) := by classical have hpos : 0 < pr w S := lt_of_lt_of_le (bp_pos _) ht have hh : IsLaw (onW w S) := normW_law (subW_nonneg hw.nz _) hpos refine ⟨hh,fun b => ?_⟩ let t := planNew f.sp b.sp by_cases he : t=0 · change pr _ _ ≤ fee N _ t rw [he,fee] simp only [Nat.cast_zero,mul_zero,zero_mul,bp_zero] exact (pr_le_tot hh.nz).trans hh.total.le let R := fun x => S x ∧ b.agree x by_cases hf : 0 < pr w R · obtain ⟨x,⟨hx,hB⟩,_⟩ := exists_of_pr_pos hw.nz hf let c := Pin.make (f.sp⊔b.sp) x have hc : pr w R≤ fee N ζ (planNew a.sp c.sp) := (pr_mono hw.nz (q:=c.agree) (fun y hy => ((Pin.combine (hS x hx) hB).mpr ⟨hS _ hy.1,hy.2⟩))).trans (h c) have hN : planNew a.sp c.sp=k+t := by have hh : planNew a.sp f.sp+t=planNew a.sp c.sp := planNew_mono_add hF rw [← hh] rw [planNew, sup_eq_right.mpr hF,hk, Nat.add_sub_cancel_left] rw [hN] at hc rw [pr_on] refine ((div_le_div₀ (bp_pos _).le hc (bp_pos _) ht)).trans ?_ unfold fee rw [←bp_sub] refine bp_le ?_ have h1 : 1 ≤ (t:ℝ) := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr he have hg := mul_le_mul_of_nonneg_right hz (show 0≤(t:ℝ) from Nat.cast_nonneg _) rw [Nat.cast_add] change _ ≤ -(1-0.05)*(t : ℝ)*N rw [← sub_mul] exact mul_le_mul_of_nonneg_right (by linarith only [hkz,h1,hg]) (Nat.cast_nonneg _) · rw [pr_on] exact (div_nonpos_of_nonpos_of_nonneg (not_lt.mp hf) hpos.le).trans (bp_pos _).le
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107import OAI.Combinatorics.HadwigerCounterexample.FiniteProjectionCenters
namespace OAI
/-! # Conditional Flags -/
noncomputable section
namespace HadwigerCounterexample
open Finset Real
open scoped BigOperators
variable {A B C X Y : Type} [Fintype A] [Fintype B] [Fintype C] [Fintype X] [Fintype Y]
variable {w : Wgt X}
def stained (w : Wgt X) (f : X→Y) (i : Y) : Wgt X := by
classical exact if mapW w f i≠0 then onW w (fun x => f x=i) else w
theorem stained_law (f : X→Y) (hw : IsLaw w) (i : Y) : IsLaw (stained w f i) := by
unfold stained; split
next h => exact on_law hw.nz (lt_of_le_of_ne ((mapW_law hw f).nz _) (Ne.symm h))
next => exact hw
theorem stain_rebuild (f : X→Y) (P : Y→Prop) (hw : IsLaw w) :
subW w (P∘f) = mixW (subW (mapW w f) P) (stained w f) := by
classical
have hh := disintegrate hw.nz f
funext i
have hi (y) :
mapW w f y * stained w f y i=
mapW w f y * onW w (fun x => f x=y) i := by
by_cases h : mapW w f y=0 <;> simp [stained,h]
have he := congr_fun hh i
unfold subW mixW Function.comp
unfold mixW at he
rw [he,avg,Finset.sum_mul]
unfold avg at *
apply sum_congr rfl
intro j _
rw [mul_right_comm _ (ind _), hi]
by_cases hx : f i=j
· rw [hx]
simp only [onW_val,ind_zero hx,mul_zero,zero_div,zero_mul]
theorem stain_inputs (f : X→Y) (hw : IsLaw w) :
w=mixW (mapW w f) (stained w f) := by
have ht := stain_rebuild f (fun _ => True) hw
unfold subW at ht
simpa only [Function.comp_apply,ind_true,mul_one] using ht
variable {μ : Wgt A}
def colored (μ : Wgt A) (w : Wgt X) (v : A→ X→ Y) :=
semi μ (fun i => mapW w (v i))
def coloredP (w : Wgt X) (v : A→ X→Y) (K : A→X→B) :=
fun i : A×Y => mapW (stained w (v i.1) i.2) (K i.1)
def flaggedW (μ : Wgt A) (w : Wgt X) (v : A→X→Y) (K : A→X→B) (P : A→Y→Prop) :=
mixW μ (fun i => mapW (subW w (P i ∘ v i)) (K i))
theorem semi_total (μ : Wgt A) (v : A → Wgt Y) :
tot (semi μ v)=avg μ (fun i=>tot (v i)) := by
simpa only [avg_const,mul_one] using semi_avg μ v (fun i=>1)
theorem colored_ultra (hμ : IsLaw μ) (hw : IsLaw w) (K : A→X→B) (v : A→X→Y) :
Ultra (colored μ w v) (coloredP w v K) := by
have ht (i) := mapW_law hw (v i)
refine ⟨⟨fun x => mul_nonneg (hμ.nz _) ((ht _).nz _),?_⟩,
fun i => mapW_law (stained_law _ hw _) (K i.1)⟩
unfold colored; rw [semi_total]
simp_rw [(ht _).total]
exact hμ.avg_const _
theorem flag_catalog (K : A→ X→B) (v : A→ X→ Y) (P : A→ Y→ Prop)
(hw : IsLaw w) (hμ : IsLaw μ) :
catalog (colored μ w v) (coloredP w v K)
(flaggedW μ w v K P) := by
classical
let W := colored μ w v
have hh := (colored_ultra hμ hw K v).law
refine ⟨subW W (fun i => P i.1 i.2),subW_nonneg hh.nz _,subW_le hh.nz _,?_⟩
unfold flaggedW
simp_rw [stain_rebuild (v _) (P _) hw,map_mix]
funext x
simp only [mixW,coloredP,colored,W,avg,subW,semi,Finset.mul_sum,Fintype.sum_prod_type]
exact sum_congr rfl fun i _ => sum_congr rfl fun j _ => by ring
theorem colored_budget [Nonempty Y] (K : A→ X→B) (v : A→ X→ Y) (f : B→C)
(hw : IsLaw w) (hμ : IsLaw μ) :
budget (colored μ w v) (coloredP w v K) f ≤
budget μ (fun i => mapW w (K i)) f + Real.log (num Y) := by
unfold budget colored coloredP
rw [semi_avg,← hμ.avg_const (Real.log _),← avg_add]
apply avg_mono hμ.nz
intro i
let u := mapW w (v i)
have he : IsLaw u := mapW_law hw (v i)
let q (j : Y) := mapW (mapW (stained w (v i) j) (K i)) f
have hq (j) : IsLaw (q j) := mapW_law (mapW_law (stained_law _ hw _) _) _
have ht : mapW (mapW w (K i)) f=mixW u q := by
calc mapW _ _ = mapW (mapW (mixW u (stained w (v i))) (K i)) f :=
congrArg (fun z => mapW (mapW z (K i)) f) (stain_inputs (v i) hw)
_ = _ := by rw [map_mix,map_mix]
change avg u (fun j => tension (q j) _)≤ tension _ _+_
rw [tension_mix,add_comm _ (log _),ht]
exact add_le_add_left (mix_charge he hq) _
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.FiniteProjectionCenters
namespace OAI
/-! # Conditional Flags -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Realopen scoped BigOperatorsvariable {A B C X Y : Type} [Fintype A] [Fintype B] [Fintype C] [Fintype X] [Fintype Y]variable {w : Wgt X}
def stained (w : Wgt X) (f : X→Y) (i : Y) : Wgt X := by classical exact if mapW w f i≠0 then onW w (fun x => f x=i) else wtheorem stained_law (f : X→Y) (hw : IsLaw w) (i : Y) : IsLaw (stained w f i) := by unfold stained; split next h => exact on_law hw.nz (lt_of_le_of_ne ((mapW_law hw f).nz _) (Ne.symm h)) next => exact hw
theorem stain_rebuild (f : X→Y) (P : Y→Prop) (hw : IsLaw w) : subW w (P∘f) = mixW (subW (mapW w f) P) (stained w f) := by classical have hh := disintegrate hw.nz f funext i have hi (y) : mapW w f y * stained w f y i= mapW w f y * onW w (fun x => f x=y) i := by by_cases h : mapW w f y=0 <;> simp [stained,h] have he := congr_fun hh i unfold subW mixW Function.comp unfold mixW at he rw [he,avg,Finset.sum_mul] unfold avg at * apply sum_congr rfl intro j _ rw [mul_right_comm _ (ind _), hi] by_cases hx : f i=j · rw [hx] simp only [onW_val,ind_zero hx,mul_zero,zero_div,zero_mul]
theorem stain_inputs (f : X→Y) (hw : IsLaw w) : w=mixW (mapW w f) (stained w f) := by have ht := stain_rebuild f (fun _ => True) hw unfold subW at ht simpa only [Function.comp_apply,ind_true,mul_one] using ht
variable {μ : Wgt A}
def colored (μ : Wgt A) (w : Wgt X) (v : A→ X→ Y) := semi μ (fun i => mapW w (v i))def coloredP (w : Wgt X) (v : A→ X→Y) (K : A→X→B) := fun i : A×Y => mapW (stained w (v i.1) i.2) (K i.1)def flaggedW (μ : Wgt A) (w : Wgt X) (v : A→X→Y) (K : A→X→B) (P : A→Y→Prop) := mixW μ (fun i => mapW (subW w (P i ∘ v i)) (K i))
theorem semi_total (μ : Wgt A) (v : A → Wgt Y) : tot (semi μ v)=avg μ (fun i=>tot (v i)) := by simpa only [avg_const,mul_one] using semi_avg μ v (fun i=>1)
theorem colored_ultra (hμ : IsLaw μ) (hw : IsLaw w) (K : A→X→B) (v : A→X→Y) : Ultra (colored μ w v) (coloredP w v K) := by have ht (i) := mapW_law hw (v i) refine ⟨⟨fun x => mul_nonneg (hμ.nz _) ((ht _).nz _),?_⟩, fun i => mapW_law (stained_law _ hw _) (K i.1)⟩ unfold colored; rw [semi_total] simp_rw [(ht _).total] exact hμ.avg_const _
theorem flag_catalog (K : A→ X→B) (v : A→ X→ Y) (P : A→ Y→ Prop) (hw : IsLaw w) (hμ : IsLaw μ) : catalog (colored μ w v) (coloredP w v K) (flaggedW μ w v K P) := by classical let W := colored μ w v have hh := (colored_ultra hμ hw K v).law refine ⟨subW W (fun i => P i.1 i.2),subW_nonneg hh.nz _,subW_le hh.nz _,?_⟩ unfold flaggedW simp_rw [stain_rebuild (v _) (P _) hw,map_mix] funext x simp only [mixW,coloredP,colored,W,avg,subW,semi,Finset.mul_sum,Fintype.sum_prod_type] exact sum_congr rfl fun i _ => sum_congr rfl fun j _ => by ring
theorem colored_budget [Nonempty Y] (K : A→ X→B) (v : A→ X→ Y) (f : B→C) (hw : IsLaw w) (hμ : IsLaw μ) : budget (colored μ w v) (coloredP w v K) f ≤ budget μ (fun i => mapW w (K i)) f + Real.log (num Y) := by unfold budget colored coloredP rw [semi_avg,← hμ.avg_const (Real.log _),← avg_add] apply avg_mono hμ.nz intro i let u := mapW w (v i) have he : IsLaw u := mapW_law hw (v i) let q (j : Y) := mapW (mapW (stained w (v i) j) (K i)) f have hq (j) : IsLaw (q j) := mapW_law (mapW_law (stained_law _ hw _) _) _ have ht : mapW (mapW w (K i)) f=mixW u q := by calc mapW _ _ = mapW (mapW (mixW u (stained w (v i))) (K i)) f := congrArg (fun z => mapW (mapW z (K i)) f) (stain_inputs (v i) hw) _ = _ := by rw [map_mix,map_mix] change avg u (fun j => tension (q j) _)≤ tension _ _+_ rw [tension_mix,add_comm _ (log _),ht] exact add_le_add_left (mix_charge he hq) _end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101import OAI.Combinatorics.HadwigerCounterexample.UnseenCrossingFactorization
import OAI.Combinatorics.HadwigerCounterexample.GramConditionedLaws
namespace OAI
/-! # Conditional Four Corners -/
noncomputable section
namespace HadwigerCounterexample
open Finset Matrix Module LinearMap Function Filter
open scoped BigOperators
variable {p : Shape} {n N : ℕ} {I J : Type} [Fintype I] [DecidableEq I]
set_option maxHeartbeats 600000 in
private theorem stip_mask (E : Rail I) (t : Vec E) (p : Wgt (Rack I N)) (δ : ℝ)
(hδ : 0≤δ) (hh : |avg unif p|≤δ) (h : ∀ f:Vec E,f≠0 →
|avg unif (fun i=>phasedBy (ledgerM E f) i*p i)|≤bp (-(N:ℝ)/2)) :
|partMean (fun x=>traced x E t) p|≤δ+bp (-(N:ℝ)/2) := by
classical
have he (f : Vec E) :
|vectorPhase f t*avg unif (fun i : Rack I N=>phasedBy (ledgerM E f) i*p i)|≤ δ+bp (-(N:ℝ)/2) := by
rw [abs_mul,vectorPhase,wsign_abs,one_mul]
by_cases hz : f=0
· subst f; simpa only [ledger_zero,layer_zero,one_mul] using hh.trans (le_add_of_nonneg_right (bp_pos (-(N:ℝ)/2)).le)
exact (h f hz).trans (le_add_of_nonneg_left hδ)
have hf : partMean (fun x=>traced x E t) p=avg unif (fun f:Vec E => vectorPhase f t*avg unif
(fun i:Rack I N=>phasedBy (ledgerM E f) i*p i)) := by
unfold partMean; simp_rw [rail_expand,←avg_mul]
rw [avg_avg]; simp_rw [←avg_mul']; exact avg_congr (fun i _=>avg_congr fun j _=>by ring)
rw [hf]
exact (abs_avg_le unif_law.nz).trans (unif_law.avg_le he)
namespace Template
variable (v : Template p I)
theorem pack_bound (v : Template p I) (j : I) (U : Wgt (Keys (p:=p) v.t N))
(hU : ∀ i, |U i|≤1) (i) : |packSecs v j U i| ≤1 := by
unfold packSecs; rw [Finset.abs_prod]
exact (Finset.prod_le_prod₀ (fun i _=>abs_nonneg _) (fun i _ => hU _)).trans_eq (by simp)
set_option maxHeartbeats 800000 in
theorem lopsided (v : Template p I) (j : I) (q : I→F)
(U : Wgt (Keys (p:=p) v.t N)) (δ : ℝ) (hδ : 0≤δ)
(hU : ∀ x,|U x|≤1) (h : chairCut v j U δ)
(hW : carried U (ownPart (p:=p) v.t q))
(Z : GeoM v.seam) :
|partMean (gramPart Z) (packSecs v j U)|≤δ+bp (-(N:ℝ)/2) := by
classical
let P := packSecs v j U
let Q := gramPart Z (N:=N)
have hb := bp_pos (-(N:ℝ)/2)
by_cases hp : ∃ x,Q x∧P x≠0
· obtain ⟨x,hx,hP⟩ := hp
let E := cantRail v j
let T (y : v.PackStack N) := traced y E (cantVec v j Z)
have hg i : ind (Q i)*P i=ind (T i)*P i := by
by_cases hh : P i=0
· rw [hh,mul_zero,mul_zero]
rw [show Q i=T i from propext
(cant_bridge v j q Z x i (pack_gate v j q U hW hP) (pack_gate v j q U hW hh) hx)]
change |avg unif (fun x => ind (Q x)*P x)|≤_
simp_rw [hg]
exact stip_mask E (cantVec v j Z) P δ hδ (global_quart v j U hU δ h) (cant_leak v j U hU)
have hh (x) : ind (Q x)*P x=0 := by
by_cases he : Q x <;> simp only [he,ind_true,ind_false,one_mul,zero_mul]
exact not_ne_iff.mp (fun hx => hp ⟨x,he,hx⟩)
change |avg unif (fun x=>ind (Q x)*P x)|≤_
simp_rw [hh,avg_zero,abs_zero]
exact add_nonneg hδ hb.le
set_option maxHeartbeats 800000 in
theorem pack_hot (v : Template p I) (j : I) (q : I→F) (U : Wgt (Keys (p:=p) v.t N))
(δ : ℝ) (hδ : 0≤δ) (hU : ∀ x, |U x|≤1) (h : chairCut v j U δ)
(hW : carried U (ownPart (p:=p) v.t q))
(Z : GeoM v.seam) (k : ℝ) (hk : ∀ i,num (Port v.seam i)≤ k)
(hN : 2*k-(N:ℝ) ≤ -1) :
let W := netFact v.seam
|avg (rackStation Z N) (packSecs v j U)|≤
2*W*(num (Ports p)*(2*bp (k-N)))+W*(δ+bp (-(N:ℝ)/2)) := by
classical
intro W
let B := pr unif (gramPart Z (N:=N))
have hb := wave_norm Z N (fun i => by linarith only [hN,hk i])
have h0 : 0<W := netFact_pos
have he : 0<B := (inv_pos_of_pos h0).trans_le hb
let V := packSecs v j U
let D := avg (rackWave Z N) V
have hl := lopsided v j q U δ hδ hU h hW Z
rw [part_reset _ _ he,abs_mul,abs_of_nonneg he.le] at hl
have hh :
|D| ≤ W*(δ+bp (-(N:ℝ)/2)) := by
apply le_of_mul_le_mul_left _ (inv_pos_of_pos h0)
exact (le_trans (mul_le_mul_of_nonneg_right hb (abs_nonneg _)) hl).trans_eq (by field_simp)
let A := avg (rackStation Z N) V
have hs := compare_station Z V (pack_bound v j U hU) k hk hN
change |A|≤_
exact le_trans (by simpa only [sub_zero] using (abs_sub_le A D 0)) (add_le_add hs hh)
end Template
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.UnseenCrossingFactorizationimport OAI.Combinatorics.HadwigerCounterexample.GramConditionedLaws
namespace OAI
/-! # Conditional Four Corners -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Matrix Module LinearMap Function Filteropen scoped BigOperatorsvariable {p : Shape} {n N : ℕ} {I J : Type} [Fintype I] [DecidableEq I]set_option maxHeartbeats 600000 inprivate theorem stip_mask (E : Rail I) (t : Vec E) (p : Wgt (Rack I N)) (δ : ℝ) (hδ : 0≤δ) (hh : |avg unif p|≤δ) (h : ∀ f:Vec E,f≠0 → |avg unif (fun i=>phasedBy (ledgerM E f) i*p i)|≤bp (-(N:ℝ)/2)) : |partMean (fun x=>traced x E t) p|≤δ+bp (-(N:ℝ)/2) := by classical have he (f : Vec E) : |vectorPhase f t*avg unif (fun i : Rack I N=>phasedBy (ledgerM E f) i*p i)|≤ δ+bp (-(N:ℝ)/2) := by rw [abs_mul,vectorPhase,wsign_abs,one_mul] by_cases hz : f=0 · subst f; simpa only [ledger_zero,layer_zero,one_mul] using hh.trans (le_add_of_nonneg_right (bp_pos (-(N:ℝ)/2)).le) exact (h f hz).trans (le_add_of_nonneg_left hδ) have hf : partMean (fun x=>traced x E t) p=avg unif (fun f:Vec E => vectorPhase f t*avg unif (fun i:Rack I N=>phasedBy (ledgerM E f) i*p i)) := by unfold partMean; simp_rw [rail_expand,←avg_mul] rw [avg_avg]; simp_rw [←avg_mul']; exact avg_congr (fun i _=>avg_congr fun j _=>by ring) rw [hf] exact (abs_avg_le unif_law.nz).trans (unif_law.avg_le he)namespace Templatevariable (v : Template p I)
theorem pack_bound (v : Template p I) (j : I) (U : Wgt (Keys (p:=p) v.t N)) (hU : ∀ i, |U i|≤1) (i) : |packSecs v j U i| ≤1 := by unfold packSecs; rw [Finset.abs_prod] exact (Finset.prod_le_prod₀ (fun i _=>abs_nonneg _) (fun i _ => hU _)).trans_eq (by simp)
set_option maxHeartbeats 800000 intheorem lopsided (v : Template p I) (j : I) (q : I→F) (U : Wgt (Keys (p:=p) v.t N)) (δ : ℝ) (hδ : 0≤δ) (hU : ∀ x,|U x|≤1) (h : chairCut v j U δ) (hW : carried U (ownPart (p:=p) v.t q)) (Z : GeoM v.seam) : |partMean (gramPart Z) (packSecs v j U)|≤δ+bp (-(N:ℝ)/2) := by classical let P := packSecs v j U let Q := gramPart Z (N:=N) have hb := bp_pos (-(N:ℝ)/2) by_cases hp : ∃ x,Q x∧P x≠0 · obtain ⟨x,hx,hP⟩ := hp let E := cantRail v j let T (y : v.PackStack N) := traced y E (cantVec v j Z) have hg i : ind (Q i)*P i=ind (T i)*P i := by by_cases hh : P i=0 · rw [hh,mul_zero,mul_zero] rw [show Q i=T i from propext (cant_bridge v j q Z x i (pack_gate v j q U hW hP) (pack_gate v j q U hW hh) hx)] change |avg unif (fun x => ind (Q x)*P x)|≤_ simp_rw [hg] exact stip_mask E (cantVec v j Z) P δ hδ (global_quart v j U hU δ h) (cant_leak v j U hU) have hh (x) : ind (Q x)*P x=0 := by by_cases he : Q x <;> simp only [he,ind_true,ind_false,one_mul,zero_mul] exact not_ne_iff.mp (fun hx => hp ⟨x,he,hx⟩) change |avg unif (fun x=>ind (Q x)*P x)|≤_ simp_rw [hh,avg_zero,abs_zero] exact add_nonneg hδ hb.le
set_option maxHeartbeats 800000 intheorem pack_hot (v : Template p I) (j : I) (q : I→F) (U : Wgt (Keys (p:=p) v.t N)) (δ : ℝ) (hδ : 0≤δ) (hU : ∀ x, |U x|≤1) (h : chairCut v j U δ) (hW : carried U (ownPart (p:=p) v.t q)) (Z : GeoM v.seam) (k : ℝ) (hk : ∀ i,num (Port v.seam i)≤ k) (hN : 2*k-(N:ℝ) ≤ -1) : let W := netFact v.seam |avg (rackStation Z N) (packSecs v j U)|≤ 2*W*(num (Ports p)*(2*bp (k-N)))+W*(δ+bp (-(N:ℝ)/2)) := by classical intro W let B := pr unif (gramPart Z (N:=N)) have hb := wave_norm Z N (fun i => by linarith only [hN,hk i]) have h0 : 0<W := netFact_pos have he : 0<B := (inv_pos_of_pos h0).trans_le hb let V := packSecs v j U let D := avg (rackWave Z N) V have hl := lopsided v j q U δ hδ hU h hW Z rw [part_reset _ _ he,abs_mul,abs_of_nonneg he.le] at hl have hh : |D| ≤ W*(δ+bp (-(N:ℝ)/2)) := by apply le_of_mul_le_mul_left _ (inv_pos_of_pos h0) exact (le_trans (mul_le_mul_of_nonneg_right hb (abs_nonneg _)) hl).trans_eq (by field_simp) let A := avg (rackStation Z N) V have hs := compare_station Z V (pack_bound v j U hU) k hk hN change |A|≤_ exact le_trans (by simpa only [sub_zero] using (abs_sub_le A D 0)) (add_le_add hs hh)end Templateend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106import OAI.Combinatorics.HadwigerCounterexample.SimultaneousProjection
namespace OAI
/-! # Conditional Large Set Hits -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Matrix LinearMap Function
open scoped BigOperators Topology
open Template
variable {p:Shape} {M n N K r s0:ℕ}
namespace StatusAnalysis
namespace Quill
variable {q:Format} {d:Rates} {b:Bool} (w:Quill p q d b) (t : Tagging p (Messenger q))
(z:Messenger q→F) (m:Mixer p n)
def prelim (K:ℕ) (s:Charts p n d) (i:Messenger q) :=
d (parcel b i)≤ K^2 ∧ Injective (s (parcel b i)) ∧
∀ x,totalRank (s (parcel b i) x)≤ K
def sameInk (i:Messenger q) (v: Magazine p (d (parcel b i))) :=
Appearance.nearly p (w.amp i).1 (w.amp i).2.1 v
structure steady (K:ℕ) (s:Charts p n d) (o: UnitType p n N) : Prop where
frame : PreparationParameters.frameSide p m o
steadyAxes (i:Messenger q) : prelim (b:=b) K s i
enough i : (w.amp i).1.diagO=(w.amp i).2.1.1
sufficesP i :
let j:= parcel b i; let x:=w.allure t z i
carried (w.policies t z n i) (fun y=> w.sameInk i (x.profile j o m (s j) y) →
x.profile j o m (s j) y=w.amp i)
set_option maxHeartbeats 800000 in
theorem thinGlaze (Y : Silhouette p N r) (o : UnitType p n N) (i : Messenger q)
(s : Charts p n d) (k:AtomKey (p:=p) (t i) N)
{δ : ℝ} (hd:0<δ)
(hw:w.moral t z) (hp : w.steady t z m K s o)
(he : gauze p δ δ Y m K o) (ht : 1≤p.r) (hn : 2*p.r≤n) :
let x:=w.allure t z i
δ ≤ x.reference Y (Y (t i) (z i) k) →
basebeta p K/2 ≤ w.seraph t z o m s Y i k := by
classical
intro x h
let j:=parcel b i
let z':= w.amp i; let a:=Y (t i) (z i) k
let μ:=x.reflected Y j o m (s j) a
have hx : x.apt := w.allure_apt t z hw i
have hm : IsLaw μ:= x.reflectedLaw Y (Appearance.witLaw hx ht hn) _ _ _ _ _
obtain ⟨h1,h2,h3⟩:=hp.steadyAxes i
have hh := x.demonstrates Y o (m:=m) (s j) K j a δ hd z'.1 z'.2.1.2 (hw.2.2 i)
(hw.2.1 i) ht hn h (he _) h1 h2 h3
have hq (y) (h:μ y≠0) (hz:w.sameInk i y): y=w.amp i := by
let P := fun x=>w.sameInk i x → x=w.amp i
have hb : carried μ P:= x.reflection_exact Y j o m (s j) a P (hp.sufficesP i)
exact (show P y from not_not.mp fun hi=>h (hb y hi)) hz
have h4 : (z'.1.diagO,z'.2.1.2)=z'.2.1 := Prod.ext (hp.enough i) rfl
rw [h4] at hh
exact hh.trans ((pr_on_mono hm.nz hq).trans_eq (pr_point' ..))
theorem tinyCell_loss (Y:Silhouette p N r) {δ:ℝ} (hd:0≤δ) (i : Messenger q)
(hN: 2*num (Messenger q×Toast p)-(N:ℝ)≤ -1)
(hh:2*num (Toast p)-(N:ℝ)≤ -1) :
let x:= w.allure t z i
let μ:=lawNu p N t z
pr μ (fun y=> x.reference Y (Y (t i) (z i) (y i)) < δ) ≤
r*δ+2*netFact (trayPort p t)*bp (-(N:ℝ)/2) := by
classical
intro a μ
let I:=Messenger q
let Ω:=fun i=> lawOmega p N (t i) (z i)
let S:=fun y=>a.reference Y (Y (t i) (z i) y)<δ
let f : ∀ i:Messenger q,Wgt (AtomKey (p:=p) (t i) N) := fun j=>
if h:j=i then h ▸ (fun x : AtomKey (p:=p) (t i) N=> ind (S x)) else fun _=>1
have hi : f i=fun x=>ind (S x) := by unfold f; simp
have hf j (h:j≠i) : f j=fun _ => 1 := by unfold f; simp [h]
have hg j x : |f j x| ≤ 1 := by
by_cases h:j=i
· subst j; rw [hi]; exact (abs_of_nonneg (ind_nonneg _)).le.trans (ind_le_one _)
rw [hf j h]; simp
have he x : prodW f x= ind (S (x i)) := by
unfold prodW; rw [Finset.prod_eq_single i _ (by simp),hi]
intro b _ hb; rw [hf _ hb]
have hR :
∏ i,avg (Ω i) (f i) = pr (Ω i) S := by
rw [Finset.prod_eq_single i _ (by simp),hi]; rfl
intro b _ hb; rw [hf _ hb,(omegaLaw _ _ _ hh).avg_const]
let L:=2*netFact (trayPort p t)*bp (-(N:ℝ)/2)
have hM : pr μ (fun x=> S (x i)) ≤ pr (Ω i) S+L := by
have hm := reference_product t z f hg hN
change |avg μ (prodW f)-∏ i,avg (Ω i) (f i)|≤L at hm
rw [show prodW f=(fun x=>ind (S (x i))) from funext he,hR] at hm
exact sub_le_iff_le_add'.mp ((abs_le.mp hm).2)
have hZ : pr (Ω i) S ≤ r*δ := by
let Q:=fun x=> a.reference Y x < δ
rw [show pr (Ω i) S= pr (a.reference Y) Q from (mapW_pr (Ω i) (Y (t i) (z i)) Q).symm]
exact haze_small _ δ hd
exact hM.trans (add_le_add_left hZ _)
end Quill
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.SimultaneousProjection
namespace OAI
/-! # Conditional Large Set Hits -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Matrix LinearMap Functionopen scoped BigOperators Topologyopen Templatevariable {p:Shape} {M n N K r s0:ℕ}namespace StatusAnalysisnamespace Quillvariable {q:Format} {d:Rates} {b:Bool} (w:Quill p q d b) (t : Tagging p (Messenger q)) (z:Messenger q→F) (m:Mixer p n)
def prelim (K:ℕ) (s:Charts p n d) (i:Messenger q) := d (parcel b i)≤ K^2 ∧ Injective (s (parcel b i)) ∧ ∀ x,totalRank (s (parcel b i) x)≤ K
def sameInk (i:Messenger q) (v: Magazine p (d (parcel b i))) := Appearance.nearly p (w.amp i).1 (w.amp i).2.1 v
structure steady (K:ℕ) (s:Charts p n d) (o: UnitType p n N) : Prop where frame : PreparationParameters.frameSide p m o steadyAxes (i:Messenger q) : prelim (b:=b) K s i enough i : (w.amp i).1.diagO=(w.amp i).2.1.1 sufficesP i : let j:= parcel b i; let x:=w.allure t z i carried (w.policies t z n i) (fun y=> w.sameInk i (x.profile j o m (s j) y) → x.profile j o m (s j) y=w.amp i)
set_option maxHeartbeats 800000 intheorem thinGlaze (Y : Silhouette p N r) (o : UnitType p n N) (i : Messenger q) (s : Charts p n d) (k:AtomKey (p:=p) (t i) N) {δ : ℝ} (hd:0<δ) (hw:w.moral t z) (hp : w.steady t z m K s o) (he : gauze p δ δ Y m K o) (ht : 1≤p.r) (hn : 2*p.r≤n) : let x:=w.allure t z i δ ≤ x.reference Y (Y (t i) (z i) k) → basebeta p K/2 ≤ w.seraph t z o m s Y i k := by classical intro x h let j:=parcel b i let z':= w.amp i; let a:=Y (t i) (z i) k let μ:=x.reflected Y j o m (s j) a have hx : x.apt := w.allure_apt t z hw i have hm : IsLaw μ:= x.reflectedLaw Y (Appearance.witLaw hx ht hn) _ _ _ _ _ obtain ⟨h1,h2,h3⟩:=hp.steadyAxes i have hh := x.demonstrates Y o (m:=m) (s j) K j a δ hd z'.1 z'.2.1.2 (hw.2.2 i) (hw.2.1 i) ht hn h (he _) h1 h2 h3 have hq (y) (h:μ y≠0) (hz:w.sameInk i y): y=w.amp i := by let P := fun x=>w.sameInk i x → x=w.amp i have hb : carried μ P:= x.reflection_exact Y j o m (s j) a P (hp.sufficesP i) exact (show P y from not_not.mp fun hi=>h (hb y hi)) hz have h4 : (z'.1.diagO,z'.2.1.2)=z'.2.1 := Prod.ext (hp.enough i) rfl rw [h4] at hh exact hh.trans ((pr_on_mono hm.nz hq).trans_eq (pr_point' ..))
theorem tinyCell_loss (Y:Silhouette p N r) {δ:ℝ} (hd:0≤δ) (i : Messenger q) (hN: 2*num (Messenger q×Toast p)-(N:ℝ)≤ -1) (hh:2*num (Toast p)-(N:ℝ)≤ -1) : let x:= w.allure t z i let μ:=lawNu p N t z pr μ (fun y=> x.reference Y (Y (t i) (z i) (y i)) < δ) ≤ r*δ+2*netFact (trayPort p t)*bp (-(N:ℝ)/2) := by classical intro a μ let I:=Messenger q let Ω:=fun i=> lawOmega p N (t i) (z i) let S:=fun y=>a.reference Y (Y (t i) (z i) y)<δ let f : ∀ i:Messenger q,Wgt (AtomKey (p:=p) (t i) N) := fun j=> if h:j=i then h ▸ (fun x : AtomKey (p:=p) (t i) N=> ind (S x)) else fun _=>1 have hi : f i=fun x=>ind (S x) := by unfold f; simp have hf j (h:j≠i) : f j=fun _ => 1 := by unfold f; simp [h] have hg j x : |f j x| ≤ 1 := by by_cases h:j=i · subst j; rw [hi]; exact (abs_of_nonneg (ind_nonneg _)).le.trans (ind_le_one _) rw [hf j h]; simp have he x : prodW f x= ind (S (x i)) := by unfold prodW; rw [Finset.prod_eq_single i _ (by simp),hi] intro b _ hb; rw [hf _ hb] have hR : ∏ i,avg (Ω i) (f i) = pr (Ω i) S := by rw [Finset.prod_eq_single i _ (by simp),hi]; rfl intro b _ hb; rw [hf _ hb,(omegaLaw _ _ _ hh).avg_const] let L:=2*netFact (trayPort p t)*bp (-(N:ℝ)/2) have hM : pr μ (fun x=> S (x i)) ≤ pr (Ω i) S+L := by have hm := reference_product t z f hg hN change |avg μ (prodW f)-∏ i,avg (Ω i) (f i)|≤L at hm rw [show prodW f=(fun x=>ind (S (x i))) from funext he,hR] at hm exact sub_le_iff_le_add'.mp ((abs_le.mp hm).2) have hZ : pr (Ω i) S ≤ r*δ := by let Q:=fun x=> a.reference Y x < δ rw [show pr (Ω i) S= pr (a.reference Y) Q from (mapW_pr (Ω i) (Y (t i) (z i)) Q).symm] exact haze_small _ δ hd exact hM.trans (add_le_add_left hZ _)
end Quillend StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125import OAI.Combinatorics.HadwigerCounterexample.FiniteConditioning
namespace OAI
/-! # Conditional Product Laws -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
variable {A B I : Type} [Fintype A] [Fintype B]
theorem subLaw_pair {w : Wgt A} {v : Wgt B} (hw : SubLaw w) (hv : SubLaw v) :
SubLaw (pairW w v) := by
refine ⟨fun x => mul_nonneg (hw.nz _) (hv.nz _),?_⟩
rw [pairW_tot]
exact (mul_le_mul hw.total hv.total (tot_nonneg hv.nz) (by norm_num)).trans_eq (one_mul _)
theorem pair_unif :
unif (α:=A×B) = pairW unif unif := by
funext x; simp [pairW,unif_apply,mul_comm]
theorem unifOn_slice (p : A × B → Prop) (x : A) (y : B) :
unifOn p (x,y) =
mapW (unifOn p) Prod.fst x * unifOn (fun y => p (x,y)) y := by
classical
have hm : mapW (unifOn p) Prod.fst x =
nbr (fun y => p (x,y)) / nbr p := by
simp only [mapW,pr,avg,Fintype.sum_prod_type,unifOn_val, nbr,tot]
rw [Finset.sum_eq_single x]
· simp [ind_true,div_eq_mul_inv,Finset.sum_mul]
· intro b _ hb
simp [ind,hb]
· simp
rw [hm,unifOn_val,unifOn_val]
by_cases h : p (x,y)
· have hh {A : Type} [Fintype A] (p : A → Prop) (x : A) (hx : p x) : 0 < nbr p := by
have hp := weight_le_tot (fun y => ind_nonneg (p y)) x
exact lt_of_lt_of_le (ind_one hx ▸ zero_lt_one) hp
rw [ind_one h]
have hv := hh _ _ h
have hw := hh (fun y => p (x,y)) _ h
field_simp
· rw [ind_zero h]
ring
theorem unifOn_and (p q : A → Prop) :
onW (unifOn p) q = unifOn (fun x => p x ∧ q x) := by
classical
have hp : pr (unifOn p) q = nbr (fun x => p x ∧ q x) / nbr p := by
simp only [pr,avg,unifOn_val,div_eq_mul_inv,ind_and,nbr,tot,Finset.sum_mul]
refine Finset.sum_congr rfl fun i _ => ?_
ring
funext x
rw [onW_val,hp,unifOn_val,unifOn_val,ind_and]
by_cases h : p x
· by_cases g : q x
· have hl (p : A → Prop) (h : p x) : 0 < nbr p :=
lt_of_lt_of_le (ind_one h ▸ zero_lt_one) (weight_le_tot (fun y => ind_nonneg (p y)) x)
have hh := hl p h
have hg := hl (fun x => p x ∧ q x) ⟨h,g⟩
field_simp
· rw [ind_zero g]
ring
· rw [ind_zero h]
ring
theorem unifOn_and_prod (p : A → Prop) (q : B → Prop) :
unifOn (fun x : A × B => p x.1 ∧ q x.2) = pairW (unifOn p) (unifOn q) := by
have h :
nbr (fun x : A × B => p x.1 ∧ q x.2) = nbr p * nbr q := by
change tot _ = _ * _
simp_rw [ind_and]
exact pairW_tot (fun x => ind (p x)) (fun y => ind (q y))
funext x
simp only [pairW,unifOn_val,h,ind_and]
ring_nf
theorem pr_cap {w v : Wgt A} {c : ℝ} (h : ∀ x, w x ≤ c*v x) (p : A → Prop) :
pr w p ≤ c*pr v p := calc
_ ≤ pr (fun x => c*v x) p := pr_mono_left (w:=w) (v:=fun x => c*v x) h _
_ = _ := by simp only [pr,avg,Finset.mul_sum,mul_assoc]
def semi (w : Wgt A) (k : A → Wgt B) : Wgt (A × B) := fun x => w x.1 * k x.1 x.2
theorem semi_avg (w : Wgt A) (k : A → Wgt B) (f : A × B → ℝ) :
avg (semi w k) f = avg w (fun x => avg (k x) (fun y => f (x,y))) := by
simp only [avg,semi,Fintype.sum_prod_type,Finset.mul_sum,mul_assoc]
theorem pair_semi_avg (w w' : Wgt A) (k k' : A → Wgt B) (f : (A × B) × (A × B) → ℝ) :
avg (pairW (semi w k) (semi w' k')) f =
avg (pairW w w') (fun x =>
avg (pairW (k x.1) (k' x.2)) (fun y => f ((x.1,y.1), (x.2,y.2)))) := by
simp only [pairW_avg, semi_avg]
refine avg_congr fun x _ => ?_
exact avg_avg _ _ _
theorem pair_semi_pr (w w' : Wgt A) (k k' : A → Wgt B) (p : A × A → Prop) (q : B × B → Prop) :
pr (pairW (semi w k) (semi w' k')) (fun x => p (x.1.1,x.2.1) ∧ q (x.1.2,x.2.2)) =
avg (pairW w w') (fun x => ind (p x) * pr (pairW (k x.1) (k' x.2)) q) := by
unfold pr
rw [pair_semi_avg]
simp_rw [ind_and]
refine avg_congr fun x _ => ?_
exact avg_mul' _ _ _
variable [Fintype I] [DecidableEq I]
/-- Reassociate two arrays of independent columns into componentwise independent pairs. -/
theorem prodW_pair_pr (w v : I → Wgt A) (p : I → A × A → Prop) :
pr (pairW (prodW w) (prodW v)) (fun x => ∀ i, p i (x.1 i,x.2 i)) =
∏ i, pr (pairW (w i) (v i)) (p i) := by
simp_rw [pr,ind_all,pairW_avg]
have hx (x : I → A) :
avg (prodW v) (fun y => ∏ i, ind (p i (x i,y i))) =
∏ i, avg (v i) (fun y => ind (p i (x i,y))) :=
prodW_avg _ (fun i y => ind (p i (x i,y)))
simp_rw [hx]
exact prodW_avg w (fun i x => avg (v i) (fun y => ind (p i (x,y))))
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.FiniteConditioning
namespace OAI
/-! # Conditional Product Laws -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperators
variable {A B I : Type} [Fintype A] [Fintype B]
theorem subLaw_pair {w : Wgt A} {v : Wgt B} (hw : SubLaw w) (hv : SubLaw v) : SubLaw (pairW w v) := by refine ⟨fun x => mul_nonneg (hw.nz _) (hv.nz _),?_⟩ rw [pairW_tot] exact (mul_le_mul hw.total hv.total (tot_nonneg hv.nz) (by norm_num)).trans_eq (one_mul _)
theorem pair_unif : unif (α:=A×B) = pairW unif unif := by funext x; simp [pairW,unif_apply,mul_comm]
theorem unifOn_slice (p : A × B → Prop) (x : A) (y : B) : unifOn p (x,y) = mapW (unifOn p) Prod.fst x * unifOn (fun y => p (x,y)) y := by classical have hm : mapW (unifOn p) Prod.fst x = nbr (fun y => p (x,y)) / nbr p := by simp only [mapW,pr,avg,Fintype.sum_prod_type,unifOn_val, nbr,tot] rw [Finset.sum_eq_single x] · simp [ind_true,div_eq_mul_inv,Finset.sum_mul] · intro b _ hb simp [ind,hb] · simp rw [hm,unifOn_val,unifOn_val] by_cases h : p (x,y) · have hh {A : Type} [Fintype A] (p : A → Prop) (x : A) (hx : p x) : 0 < nbr p := by have hp := weight_le_tot (fun y => ind_nonneg (p y)) x exact lt_of_lt_of_le (ind_one hx ▸ zero_lt_one) hp rw [ind_one h] have hv := hh _ _ h have hw := hh (fun y => p (x,y)) _ h field_simp · rw [ind_zero h] ring
theorem unifOn_and (p q : A → Prop) : onW (unifOn p) q = unifOn (fun x => p x ∧ q x) := by classical have hp : pr (unifOn p) q = nbr (fun x => p x ∧ q x) / nbr p := by simp only [pr,avg,unifOn_val,div_eq_mul_inv,ind_and,nbr,tot,Finset.sum_mul] refine Finset.sum_congr rfl fun i _ => ?_ ring funext x rw [onW_val,hp,unifOn_val,unifOn_val,ind_and] by_cases h : p x · by_cases g : q x · have hl (p : A → Prop) (h : p x) : 0 < nbr p := lt_of_lt_of_le (ind_one h ▸ zero_lt_one) (weight_le_tot (fun y => ind_nonneg (p y)) x) have hh := hl p h have hg := hl (fun x => p x ∧ q x) ⟨h,g⟩ field_simp · rw [ind_zero g] ring · rw [ind_zero h] ring
theorem unifOn_and_prod (p : A → Prop) (q : B → Prop) : unifOn (fun x : A × B => p x.1 ∧ q x.2) = pairW (unifOn p) (unifOn q) := by have h : nbr (fun x : A × B => p x.1 ∧ q x.2) = nbr p * nbr q := by change tot _ = _ * _ simp_rw [ind_and] exact pairW_tot (fun x => ind (p x)) (fun y => ind (q y)) funext x simp only [pairW,unifOn_val,h,ind_and] ring_nf
theorem pr_cap {w v : Wgt A} {c : ℝ} (h : ∀ x, w x ≤ c*v x) (p : A → Prop) : pr w p ≤ c*pr v p := calc _ ≤ pr (fun x => c*v x) p := pr_mono_left (w:=w) (v:=fun x => c*v x) h _ _ = _ := by simp only [pr,avg,Finset.mul_sum,mul_assoc]
def semi (w : Wgt A) (k : A → Wgt B) : Wgt (A × B) := fun x => w x.1 * k x.1 x.2
theorem semi_avg (w : Wgt A) (k : A → Wgt B) (f : A × B → ℝ) : avg (semi w k) f = avg w (fun x => avg (k x) (fun y => f (x,y))) := by simp only [avg,semi,Fintype.sum_prod_type,Finset.mul_sum,mul_assoc]
theorem pair_semi_avg (w w' : Wgt A) (k k' : A → Wgt B) (f : (A × B) × (A × B) → ℝ) : avg (pairW (semi w k) (semi w' k')) f = avg (pairW w w') (fun x => avg (pairW (k x.1) (k' x.2)) (fun y => f ((x.1,y.1), (x.2,y.2)))) := by simp only [pairW_avg, semi_avg] refine avg_congr fun x _ => ?_ exact avg_avg _ _ _
theorem pair_semi_pr (w w' : Wgt A) (k k' : A → Wgt B) (p : A × A → Prop) (q : B × B → Prop) : pr (pairW (semi w k) (semi w' k')) (fun x => p (x.1.1,x.2.1) ∧ q (x.1.2,x.2.2)) = avg (pairW w w') (fun x => ind (p x) * pr (pairW (k x.1) (k' x.2)) q) := by unfold pr rw [pair_semi_avg] simp_rw [ind_and] refine avg_congr fun x _ => ?_ exact avg_mul' _ _ _
variable [Fintype I] [DecidableEq I]
/-- Reassociate two arrays of independent columns into componentwise independent pairs. -/theorem prodW_pair_pr (w v : I → Wgt A) (p : I → A × A → Prop) : pr (pairW (prodW w) (prodW v)) (fun x => ∀ i, p i (x.1 i,x.2 i)) = ∏ i, pr (pairW (w i) (v i)) (p i) := by simp_rw [pr,ind_all,pairW_avg] have hx (x : I → A) : avg (prodW v) (fun y => ∏ i, ind (p i (x i,y i))) = ∏ i, avg (v i) (fun y => ind (p i (x i,y))) := prodW_avg _ (fun i y => ind (p i (x i,y))) simp_rw [hx] exact prodW_avg w (fun i x => avg (v i) (fun y => ind (p i (x,y))))
end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596import OAI.Combinatorics.HadwigerCounterexample.HistogramBounds
namespace OAI
/-! # Conditional Projection -/
noncomputable section
namespace HadwigerCounterexample
open Finset Real Function
open scoped BigOperators
variable {A B C K : Type} [Fintype A] [Fintype B] [Fintype C]
def dip (μ f g : Wgt A) := avg μ (fun i => f i*g i)
def ode (μ f : Wgt A) := dip μ f f
def cashbook (μ : Wgt A) (f : A→B) (g : Wgt A) :=
fun i => mapW (fun x => μ x*g x) f i / mapW μ f i
def banner (μ : Wgt A) (f : A→B) (g : Wgt A) := cashbook μ f g ∘ f
theorem ode_nonneg {μ : Wgt A} (hμ : ∀ i,0 ≤ μ i) (f : Wgt A) : 0≤ ode μ f :=
avg_nonneg hμ (fun _ => mul_self_nonneg _)
theorem ode_upper {μ : Wgt A} (hμ : SubLaw μ) (f : Wgt A) (B : ℝ)
(hf : ∀ i,|f i|≤B) : ode μ f ≤ B^2 := by
apply hμ.avg_le (sq_nonneg _)
intro i
exact (le_of_eq (Eq.symm (pow_two _))).trans
((le_of_eq (sq_abs (f i)).symm).trans (pow_le_pow_left₀ (abs_nonneg _) (hf i) 2))
theorem dip_sym (μ f g : Wgt A) : dip μ f g=dip μ g f := by unfold dip; simp only [mul_comm]
theorem dip_sub (μ f g h : Wgt A) :
dip μ (fun i=> f i-g i) h=dip μ f h-dip μ g h := by
unfold dip; simp only [sub_mul,avg_sub]
omit [Fintype B] in
theorem cashbook_bound (μ : Wgt A) (hμ : ∀ i,0≤ μ i) (f : A→B) (g : Wgt A)
(b : ℝ) (hb : 0≤b) (h : ∀ i,|g i|≤b) (i) : |cashbook μ f g i| ≤ b := by
have he : cashbook μ f g i=avg (onW μ (fun x=>f x=i)) g := by
unfold cashbook onW
rw [avg_norm,subW_tot]
unfold mapW pr avg subW; congr 1
exact Finset.sum_congr rfl fun j _ => by ring
have hw : SubLaw (onW μ (fun x=>f x=i)) := normW_subLaw (subW_nonneg hμ _)
rw [he]
exact (abs_avg_le hw.nz).trans (hw.avg_le hb h)
theorem cash_orth (μ : Wgt A) (hμ : ∀ i,0≤ μ i) (f : A→B) (g : Wgt A) (h : Wgt B) :
dip μ (banner μ f g) (h ∘ f)=dip μ g (h ∘ f) := by
classical
let w := fun x=> μ x*g x
have he : pour μ f (mapW w f) = fun i => μ i*banner μ f g i := rfl
have hz : lsupp w μ := fun _ hi => left_ne_zero_of_mul hi
have ht := map_pour μ f _ (hz.map hμ f)
rw [he] at ht
have hi := congrArg (fun w' => avg w' h) ht
simp_rw [mapW_avg] at hi
simpa only [w,dip,avg,mul_assoc,Function.comp_apply] using hi
theorem ode_step (μ : Wgt A) (hμ : ∀ i,0≤ μ i) (f : Wgt A)
(p : A→B) (q : B→C) :
ode μ (banner μ p f)=ode μ (banner μ (q∘p) f)+
ode μ (fun i => banner μ p f i - banner μ (q∘p) f i) := by
classical
let g := banner μ p f; let h := banner μ (q ∘ p) f
have hh : ode μ h=dip μ g h :=
(cash_orth μ hμ (q∘p) f (cashbook μ (q∘p) f)).trans
(cash_orth μ hμ p f (cashbook μ (q∘p) f ∘ q)).symm
have hi i : (g i - h i)*(g i-h i)=g i*g i - 2*(g i*h i)+h i*h i := by ring
change ode μ g=ode μ h+dip μ (fun i => g i-h i) (fun i=>g i-h i)
unfold dip
simp_rw [hi,avg_add,avg_sub,avg_mul']
change ode μ g=ode μ h+(ode μ g-2*dip μ g h + ode μ h)
linarith only [hh]
theorem archive_gain {μ : Wgt A} (hw : SubLaw μ) (f : Wgt A)
(p : A→B) (q : B→ C)
(h : Wgt B) (hh : ∀ i:A,|h (p i)| ≤1) :
(dip μ (fun i => f i - banner μ (q∘p) f i) (h ∘ p))^2 ≤
ode μ (banner μ p f)-ode μ (banner μ (q∘p) f) := by
let u := banner μ p f; let v := banner μ (q∘p) f
let w i := u i-v i
rw [ode_step μ hw.nz f p q]
have he : dip μ (fun i=> f i - banner μ (q∘p) f i) (h∘p)=dip μ w (h∘p) := by
unfold w
rw [dip_sub,dip_sub,cash_orth μ hw.nz p f h]
have ht : ode μ (h∘p) ≤ 1 := (ode_upper hw (h∘p) 1 hh).trans_eq (by ring)
have hq : dip μ w (h∘p)^2≤ode μ w*ode μ (h∘p) := by
simpa only [ode,dip,pow_two] using avg_CS hw.nz w (h∘p)
rw [he]
apply le_trans hq
refine (mul_le_mul_of_nonneg_left ht (ode_nonneg hw.nz w)).trans_eq ?_
unfold w u v
ring
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.HistogramBounds
namespace OAI
/-! # Conditional Projection -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Real Functionopen scoped BigOperatorsvariable {A B C K : Type} [Fintype A] [Fintype B] [Fintype C]
def dip (μ f g : Wgt A) := avg μ (fun i => f i*g i)def ode (μ f : Wgt A) := dip μ f fdef cashbook (μ : Wgt A) (f : A→B) (g : Wgt A) := fun i => mapW (fun x => μ x*g x) f i / mapW μ f idef banner (μ : Wgt A) (f : A→B) (g : Wgt A) := cashbook μ f g ∘ f
theorem ode_nonneg {μ : Wgt A} (hμ : ∀ i,0 ≤ μ i) (f : Wgt A) : 0≤ ode μ f := avg_nonneg hμ (fun _ => mul_self_nonneg _)theorem ode_upper {μ : Wgt A} (hμ : SubLaw μ) (f : Wgt A) (B : ℝ) (hf : ∀ i,|f i|≤B) : ode μ f ≤ B^2 := by apply hμ.avg_le (sq_nonneg _) intro i exact (le_of_eq (Eq.symm (pow_two _))).trans ((le_of_eq (sq_abs (f i)).symm).trans (pow_le_pow_left₀ (abs_nonneg _) (hf i) 2))
theorem dip_sym (μ f g : Wgt A) : dip μ f g=dip μ g f := by unfold dip; simp only [mul_comm]theorem dip_sub (μ f g h : Wgt A) : dip μ (fun i=> f i-g i) h=dip μ f h-dip μ g h := by unfold dip; simp only [sub_mul,avg_sub]
omit [Fintype B] intheorem cashbook_bound (μ : Wgt A) (hμ : ∀ i,0≤ μ i) (f : A→B) (g : Wgt A) (b : ℝ) (hb : 0≤b) (h : ∀ i,|g i|≤b) (i) : |cashbook μ f g i| ≤ b := by have he : cashbook μ f g i=avg (onW μ (fun x=>f x=i)) g := by unfold cashbook onW rw [avg_norm,subW_tot] unfold mapW pr avg subW; congr 1 exact Finset.sum_congr rfl fun j _ => by ring have hw : SubLaw (onW μ (fun x=>f x=i)) := normW_subLaw (subW_nonneg hμ _) rw [he] exact (abs_avg_le hw.nz).trans (hw.avg_le hb h)
theorem cash_orth (μ : Wgt A) (hμ : ∀ i,0≤ μ i) (f : A→B) (g : Wgt A) (h : Wgt B) : dip μ (banner μ f g) (h ∘ f)=dip μ g (h ∘ f) := by classical let w := fun x=> μ x*g x have he : pour μ f (mapW w f) = fun i => μ i*banner μ f g i := rfl have hz : lsupp w μ := fun _ hi => left_ne_zero_of_mul hi have ht := map_pour μ f _ (hz.map hμ f) rw [he] at ht have hi := congrArg (fun w' => avg w' h) ht simp_rw [mapW_avg] at hi simpa only [w,dip,avg,mul_assoc,Function.comp_apply] using hi
theorem ode_step (μ : Wgt A) (hμ : ∀ i,0≤ μ i) (f : Wgt A) (p : A→B) (q : B→C) : ode μ (banner μ p f)=ode μ (banner μ (q∘p) f)+ ode μ (fun i => banner μ p f i - banner μ (q∘p) f i) := by classical let g := banner μ p f; let h := banner μ (q ∘ p) f have hh : ode μ h=dip μ g h := (cash_orth μ hμ (q∘p) f (cashbook μ (q∘p) f)).trans (cash_orth μ hμ p f (cashbook μ (q∘p) f ∘ q)).symm have hi i : (g i - h i)*(g i-h i)=g i*g i - 2*(g i*h i)+h i*h i := by ring change ode μ g=ode μ h+dip μ (fun i => g i-h i) (fun i=>g i-h i) unfold dip simp_rw [hi,avg_add,avg_sub,avg_mul'] change ode μ g=ode μ h+(ode μ g-2*dip μ g h + ode μ h) linarith only [hh]
theorem archive_gain {μ : Wgt A} (hw : SubLaw μ) (f : Wgt A) (p : A→B) (q : B→ C) (h : Wgt B) (hh : ∀ i:A,|h (p i)| ≤1) : (dip μ (fun i => f i - banner μ (q∘p) f i) (h ∘ p))^2 ≤ ode μ (banner μ p f)-ode μ (banner μ (q∘p) f) := by let u := banner μ p f; let v := banner μ (q∘p) f let w i := u i-v i rw [ode_step μ hw.nz f p q] have he : dip μ (fun i=> f i - banner μ (q∘p) f i) (h∘p)=dip μ w (h∘p) := by unfold w rw [dip_sub,dip_sub,cash_orth μ hw.nz p f h] have ht : ode μ (h∘p) ≤ 1 := (ode_upper hw (h∘p) 1 hh).trans_eq (by ring) have hq : dip μ w (h∘p)^2≤ode μ w*ode μ (h∘p) := by simpa only [ode,dip,pow_two] using avg_CS hw.nz w (h∘p) rw [he] apply le_trans hq refine (mul_le_mul_of_nonneg_left ht (ode_nonneg hw.nz w)).trans_eq ?_ unfold w u v ringend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110import OAI.Combinatorics.HadwigerCounterexample.CellPositivityScales
namespace OAI
/-! # Conditional Signature Positivity -/
noncomputable section
namespace HadwigerCounterexample
open Filter Finset Matrix Function
open scoped BigOperators Topology
variable {p:Shape} {n N K r d : ℕ}
namespace StatusAnalysis
open Template
namespace Appearance
variable (x : Appearance p) (Y : Silhouette p N r)
theorem smudges (o : UnitType p n N) (m:Mixer p n) (v : Ax p n d) (i:Nodes) (j : Knobs p.g n) :
(x.profile i o m v j).2.1=((scan p x.l x.f j).diagO,stains x.trot m v j) := by
apply Prod.ext
· exact role_scan p _ _ _ _
funext i; exact T_swap m _ _
def nearly (p: Shape) (z: Digest p.g) (u: Par d) (x: Magazine p d) :=
x.1=z∧ x.2.1=u
set_option maxHeartbeats 800000 in
theorem demonstrates (o : UnitType p n N) {m : Mixer p n}
(v : Ax p n d) (K:ℕ) (i:Nodes) (j:Fin r) (δ : ℝ) (hd:0<δ)
(z : Digest p.g) (u:Cell d)
(he : z.feasible x.l x.f) (hf : z.sumBit=x.q) (ht : 1≤p.r) (hn : 2*p.r≤n)
(hh : δ≤ x.reference Y j)
(hs : smoothSilk p δ δ Y m K (onSide o i)) (hK : d≤K^2)
(hV : Injective v) (hv : ∀ x,totalRank (v x) ≤ K) :
basebeta p K/2 ≤ pr (x.reflected Y i o m v j) (nearly p z (z.diagO,u)) := by
classical
have ha : x.apt := ⟨z,he,hf⟩
let μ:= x.reference Y j
let f := onSide o i
obtain ⟨hM,hB⟩:= hs x
specialize hM ha
specialize hB z j he hf hh
let U (y:AtomKey (p:=p) (x.trot.t ()) N) := Y x.l x.q y=j
have hm : basebeta p K*μ ≤
pr (x.wit n) (fun y=> (scan p x.l x.f y=z∧Y x.l x.q (x.face f y)=j) ∧
stains x.trot m v y=u) := by
let h := patrol_beta x.trot U m K z he ht hn f
dsimp only at h
rw [hf] at h
exact h hB d hK v hV hv u
let w := nearly p z (z.diagO,u)
have hq (y : Knobs p.g n) :
(scan p x.l x.f y=z ∧ Y x.l x.q (x.face f y)=j) ∧ stains x.trot m v y=u →
x.showTag Y (onSide o i) y=j∧ w (x.profile i o m v y) := by
rintro ⟨⟨h,h1⟩,h2⟩
refine ⟨h1,h,?_⟩; rw [smudges,h,h2]
have hW := witLaw ha ht hn
have heq := (hm.trans (pr_mono hW.nz hq)).trans_eq (x.show_pr Y i o m v hW j w)
let ν:= x.empirical Y f j
have h2 : ν ≤ 2*μ := by
have hz : |μ-ν|≤δ := le_trans
(Finset.single_le_sum (fun k _ => abs_nonneg (x.reference Y k-x.empirical Y f k))
(Finset.mem_univ j)) hM
change δ≤ μ at hh
linarith [(abs_le.mp hz).1]
let Q := pr (x.reflected Y i o m v j) w
have h3 : basebeta p K*μ≤ ν*Q := heq
have ht := mul_le_mul_of_nonneg_right h2
(show 0≤ Q from pr_nonneg (x.reflectedLaw Y hW i o m v j).nz)
apply le_of_mul_le_mul_right _ (hd.trans_le hh)
change _*μ ≤ Q*μ
linarith only [h3,ht]
def fitsink (x : Appearance p) (w : Magazine p d) :=
w.1.feasible x.l x.f ∧ w.1.sumBit=x.q ∧ w.1.diagO=w.2.1.1
theorem rawink (x : Appearance p) (m : Mixer p n) (i : Nodes) (o : UnitType p n N)
(v : Ax p n d) :
carried (x.wit n) (x.fitsink ∘ x.profile i o m v) := by
let w:=x.wit n
have hC : carried w (fun y=>dialed p x.l x.f y=x.q) :=
normW_carried (subW_carried (spins p n) _)
intro y hi
refine hC y (fun h=>?_); apply hi
refine ⟨?_,h, (role_scan p _ _ _ _).symm⟩
intro j hj
unfold profile; change scan p x.l x.f y j=0
unfold scan
simp [hj]
theorem refInk (i : Nodes) (o : UnitType p n N) (m:Mixer p n) (v : Ax p n d)
(j:Fin r) : carried (x.reflected Y i o m v j) x.fitsink :=
reflection_exact x Y i o m v j _ (rawink x m i o v)
end Appearance
theorem haze_small (w : Wgt (Fin r)) (δ : ℝ) (hδ : 0≤δ) :
pr w (fun x=> w x < δ) ≤ r*δ := by
classical
unfold pr avg
refine (Finset.sum_le_sum (s:=Finset.univ) (g:=fun _=>δ) (fun i _=>?_)).trans_eq (by simp)
dsimp only
by_cases h:w i<δ
· rw [ind_one h,mul_one]; exact h.le
rw [ind_zero h,mul_zero]; exact hδ
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.CellPositivityScales
namespace OAI
/-! # Conditional Signature Positivity -/
noncomputable sectionnamespace HadwigerCounterexampleopen Filter Finset Matrix Functionopen scoped BigOperators Topologyvariable {p:Shape} {n N K r d : ℕ}namespace StatusAnalysisopen Template
namespace Appearancevariable (x : Appearance p) (Y : Silhouette p N r)
theorem smudges (o : UnitType p n N) (m:Mixer p n) (v : Ax p n d) (i:Nodes) (j : Knobs p.g n) : (x.profile i o m v j).2.1=((scan p x.l x.f j).diagO,stains x.trot m v j) := by apply Prod.ext · exact role_scan p _ _ _ _ funext i; exact T_swap m _ _
def nearly (p: Shape) (z: Digest p.g) (u: Par d) (x: Magazine p d) := x.1=z∧ x.2.1=u
set_option maxHeartbeats 800000 intheorem demonstrates (o : UnitType p n N) {m : Mixer p n} (v : Ax p n d) (K:ℕ) (i:Nodes) (j:Fin r) (δ : ℝ) (hd:0<δ) (z : Digest p.g) (u:Cell d) (he : z.feasible x.l x.f) (hf : z.sumBit=x.q) (ht : 1≤p.r) (hn : 2*p.r≤n) (hh : δ≤ x.reference Y j) (hs : smoothSilk p δ δ Y m K (onSide o i)) (hK : d≤K^2) (hV : Injective v) (hv : ∀ x,totalRank (v x) ≤ K) : basebeta p K/2 ≤ pr (x.reflected Y i o m v j) (nearly p z (z.diagO,u)) := by classical have ha : x.apt := ⟨z,he,hf⟩ let μ:= x.reference Y j let f := onSide o i obtain ⟨hM,hB⟩:= hs x specialize hM ha specialize hB z j he hf hh let U (y:AtomKey (p:=p) (x.trot.t ()) N) := Y x.l x.q y=j have hm : basebeta p K*μ ≤ pr (x.wit n) (fun y=> (scan p x.l x.f y=z∧Y x.l x.q (x.face f y)=j) ∧ stains x.trot m v y=u) := by let h := patrol_beta x.trot U m K z he ht hn f dsimp only at h rw [hf] at h exact h hB d hK v hV hv u let w := nearly p z (z.diagO,u) have hq (y : Knobs p.g n) : (scan p x.l x.f y=z ∧ Y x.l x.q (x.face f y)=j) ∧ stains x.trot m v y=u → x.showTag Y (onSide o i) y=j∧ w (x.profile i o m v y) := by rintro ⟨⟨h,h1⟩,h2⟩ refine ⟨h1,h,?_⟩; rw [smudges,h,h2] have hW := witLaw ha ht hn have heq := (hm.trans (pr_mono hW.nz hq)).trans_eq (x.show_pr Y i o m v hW j w) let ν:= x.empirical Y f j have h2 : ν ≤ 2*μ := by have hz : |μ-ν|≤δ := le_trans (Finset.single_le_sum (fun k _ => abs_nonneg (x.reference Y k-x.empirical Y f k)) (Finset.mem_univ j)) hM change δ≤ μ at hh linarith [(abs_le.mp hz).1] let Q := pr (x.reflected Y i o m v j) w have h3 : basebeta p K*μ≤ ν*Q := heq have ht := mul_le_mul_of_nonneg_right h2 (show 0≤ Q from pr_nonneg (x.reflectedLaw Y hW i o m v j).nz) apply le_of_mul_le_mul_right _ (hd.trans_le hh) change _*μ ≤ Q*μ linarith only [h3,ht]
def fitsink (x : Appearance p) (w : Magazine p d) := w.1.feasible x.l x.f ∧ w.1.sumBit=x.q ∧ w.1.diagO=w.2.1.1theorem rawink (x : Appearance p) (m : Mixer p n) (i : Nodes) (o : UnitType p n N) (v : Ax p n d) : carried (x.wit n) (x.fitsink ∘ x.profile i o m v) := by let w:=x.wit n have hC : carried w (fun y=>dialed p x.l x.f y=x.q) := normW_carried (subW_carried (spins p n) _) intro y hi refine hC y (fun h=>?_); apply hi refine ⟨?_,h, (role_scan p _ _ _ _).symm⟩ intro j hj unfold profile; change scan p x.l x.f y j=0 unfold scan simp [hj]theorem refInk (i : Nodes) (o : UnitType p n N) (m:Mixer p n) (v : Ax p n d) (j:Fin r) : carried (x.reflected Y i o m v j) x.fitsink := reflection_exact x Y i o m v j _ (rawink x m i o v)
end Appearance
theorem haze_small (w : Wgt (Fin r)) (δ : ℝ) (hδ : 0≤δ) : pr w (fun x=> w x < δ) ≤ r*δ := by classical unfold pr avg refine (Finset.sum_le_sum (s:=Finset.univ) (g:=fun _=>δ) (fun i _=>?_)).trans_eq (by simp) dsimp only by_cases h:w i<δ · rw [ind_one h,mul_one]; exact h.le rw [ind_zero h,mul_zero]; exact hδ
end StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198import OAI.Combinatorics.HadwigerCounterexample.IndependentWeightCorrelation
namespace OAI
/-! # Conditioned Batch Laws -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix Module LinearMap Submodule Function Finset
variable {I J G H : Type} [Fintype I] [Fintype J] [Fintype G] [Fintype H]
variable [DecidableEq I] [DecidableEq J] [DecidableEq G]
variable {N : ℕ}
def street (g : Route (I×J) G) (i : I) : Route J G := fun j => g (i,j)
def condLane (g : Route (I×J) G) (i : I) (z : G) (k : Port (street g i) z) :
Port g z := ⟨(i,k.val),k.property⟩
def laneM {g : Route (I×J) G} (Z : GeoM g) (i : I) :
GeoM (street g i) :=
fun z => (Z z).submatrix (condLane g i z) (condLane g i z)
private theorem cut_inj {I J : Type} [Fintype I] [Fintype J] [DecidableEq I]
(A : PlusRack I N) (h : Injective A.mulVec) {g : J→I} (hg : Injective g) :
Injective (A.submatrix _root_.id g).mulVec := by
rw [← mul_embedMat]
exact inj_comp_mat _ _ h (embedMat_inj hg)
variable {g : Route (I×J) G}
omit [Fintype G] in
set_option maxHeartbeats 600000 in
theorem laneGram (Z : GeoM g) (x : Rack (I × J) N) (h : bothPart Z x) (i : I) :
bothPart (laneM Z i) (led i x) := by
classical
obtain ⟨hh,hj⟩ := (both_test ..).mp h
apply (both_test ..).mpr
constructor
· refine (part_scores ..).mpr fun q a b => ?_
exact (part_scores ..).mp hh q (condLane g i q a) (condLane g i q b)
intro j
let f := condLane g i j
have he : Injective f := by intro a b h; exact Subtype.ext (congrArg
(fun x : Port g j => x.val.2) h)
exact ⟨cut_inj (rackEquiv g N x j).1 (hj j).1 he,
cut_inj (rackEquiv g N x j).2 (hj j).2 he⟩
def crossroads (g : Route (I×J) G) :=
(crowded g)\(cInside g)
def outsideZ (Z : GeoM g) : Vec (crossroads g) :=
fun x => directions g Z ⟨x.val,Finset.sdiff_subset x.property⟩
omit [Fintype G] in
private theorem road_iff (Z : GeoM g) (x : Rack (I×J) N) :
bothPart Z x ↔ (traced x (crossroads g) (outsideZ Z) ∧
(∀ i,bothPart (laneM Z i) (led i x))) ∧injPart g x := by
classical
constructor
· intro h
have ht := (both_test ..).mp h
refine ⟨⟨?_,laneGram Z x h⟩,ht.2⟩
funext i
exact congr_fun ((match_crowd x g Z).mpr ht.1) (⟨i.val,Finset.sdiff_subset i.property⟩ :
↑(crowded g))
rintro ⟨⟨ht,hH⟩,hf⟩
refine (both_test ..).mpr ⟨(part_scores ..).mpr ?_,hf⟩
intro i a b
rcases a with ⟨⟨l,x'⟩,hl⟩
rcases b with ⟨⟨t,y⟩,hr⟩
subst i
let j := g (l,x')
by_cases hh : l=t
· subst t
let a : Port (street g l) j := ⟨x',rfl⟩
let b : Port (street g l) j := ⟨y,hr⟩
exact (part_scores ..).mp ((both_test ..).mp (hH l)).1 j a b
let z : I×J := (l,x')
let v : I×J := (t,y)
have hv : (z,v)∈crossroads g := Finset.mem_sdiff.mpr
⟨Finset.mem_filter.mpr ⟨mem_univ _,hr.symm⟩,fun h => hh (mem_filter.mp h).2⟩
exact congr_fun ht (⟨(z,v),hv⟩ : ↑(crossroads g))
private def condMean (p : H→Prop) (f : Wgt H) :=
avg unif (fun x => ind (p x)*f x)
private theorem cond_reset [Nonempty H] (p : H→Prop) (f : Wgt H) (h : 0<pr unif p) :
condMean p f=pr unif p * avg (unifOn p) f := by
rw [←on_unif]; unfold onW
rw [avg_norm,subW_tot]
have he : condMean p f = avg (subW unif p) f := by simp only [avg,subW,mul_assoc]; rfl
rw [he]
field_simp
def twinkle (_ : Route (I×J) G) (k : ℝ) (N : ℕ) :=
num G * (2*bp (k-N))+bp (-(N:ℝ)/2)
set_option maxHeartbeats 800000 in
private theorem lane_means (Z : GeoM g) (f : I → Wgt (Rack J N)) (hf : ∀ i x,|f i x|≤1)
(k : ℝ) (hk : ∀ i,num (Port g i)≤k) :
|condMean (bothPart Z) (brightProd f) - bp (-( (crossroads g).card:ℝ)) *
∏ i,condMean (bothPart (laneM Z i)) (f i)|≤twinkle g k N := by
classical
let E := crossroads g
let F i (x : Rack J N) := ind (bothPart (laneM Z i) x)*f i x
have hF i x : |F i x|≤1 := by
unfold F; by_cases h : bothPart (laneM Z i) x <;> simp only [h,ind_true,ind_false,one_mul,
zero_mul]; exact hf i x; norm_num
have hE i (h : i∈E) : i.1.1≠i.2.1 := fun he =>
(mem_sdiff.mp h).2 (mem_filter.mpr ⟨(mem_sdiff.mp h).1,he⟩)
have ht := speed_expand F hF E (outsideZ Z) hE
have hP : avg unif (brightProd F)=∏ i, condMean (bothPart (laneM Z i)) (f i) :=
(led_uniform (prodW F)).trans (prodW_avg _ _)
let A x := ind (traced x E (outsideZ Z))*brightProd F x
have hA x : |A x|≤1 := by
by_cases h : traced x E (outsideZ Z)
· unfold A; rw [ind_one h,one_mul]; exact lane_abs F hF _ x
unfold A; rw [ind_zero h,zero_mul]; norm_num
have hi x :
ind (bothPart Z x) * brightProd f x= ind (injPart g x) * A x := by
rw [road_iff]; unfold A F
simp only [ind_and, ind_all,brightProd,Finset.prod_mul_distrib]
ring
have hg :
|condMean (bothPart Z) (brightProd f) - avg unif A|≤ num G*(2*bp (k-N)) := by
unfold condMean
simp_rw [hi]
rw [← avg_sub]
refine (abs_avg_le unif_law.nz).trans ((avg_mono unif_law.nz (g:=fun x =>
ind (¬injPart g x)) fun i => ?_).trans (injPart_failure g N k hk))
by_cases h : injPart g i <;>
simp only [h,ind_true,not_true,ind_false,one_mul,sub_self,abs_zero,zero_mul,zero_sub,
abs_neg,not_false_eq_true]; exact le_rfl; exact hA _
rw [hP] at ht
unfold twinkle
apply le_trans _ (add_le_add hg ht)
exact abs_sub_le ..
omit [DecidableEq I] in
theorem lane_norm (Z : GeoM g) (hN : ∀ i, 2*num (Port g i)-(N:ℝ)≤ -1)
(i : I) : 0<pr unif (bothPart (laneM Z i) (N:=N)) := by
have he j : Injective (condLane g i j) := by intro a b h; exact Subtype.ext (congrArg
(fun x : Port g j => x.val.2) h)
have hx j : num (Port (street g i) j)≤num (Port g j) := by
exact_mod_cast Fintype.card_le_of_injective _ (he j)
refine lt_of_lt_of_le (inv_pos_of_pos netFact_pos) (net_norm (laneM Z i) N (fun j => ?_)).1
linarith only [hx j,hN j]
set_option maxHeartbeats 800000 in
theorem compare_lanes (Z : GeoM g) (f : I→ Wgt (Rack J N)) (hf : ∀ i x,|f i x|≤1)
(k : ℝ) (hk : ∀ i,num (Port g i)≤k) (hN : ∀ i,2*num (Port g i)-(N:ℝ)≤ -1) :
|avg (rackStation Z N) (brightProd f)- ∏ i,avg (rackStation (laneM Z i) N) (f i)|≤
2*netFact g*twinkle g k N := by
classical
let A := pr unif (bothPart (N:=N) Z)
let B i := pr unif (bothPart (N:=N) (laneM Z i))
let u := avg (rackStation Z N) (brightProd f)
let v i := avg (rackStation (laneM Z i) N) (f i)
let P := bp (- ((crossroads g).card:ℝ))*(∏ i, B i)
let V := ∏ i,v i
have hV : |V|≤1 := by
unfold V
rw [Finset.abs_prod]
have he (i) :
SubLaw (rackStation (laneM Z i) N) := unifOn_sub _
refine (Finset.prod_le_prod₀ (fun i _ => abs_nonneg _)
(fun i _ => (abs_avg_le (he i).nz).trans ((he i).avg_le zero_le_one (hf i)))).trans_eq ?_
simp
have hh := net_norm Z N hN
have h0 : 0<A := (inv_pos_of_pos netFact_pos).trans_le hh.1
have h1 : |A*u-P*V|≤twinkle g k N := by
have hb := lane_norm (N:=N) Z hN
have ht := lane_means Z f hf k hk
rw [cond_reset (bothPart (N:=N) Z) _ h0] at ht
simp_rw [cond_reset _ _ (hb _)] at ht; rw [Finset.prod_mul_distrib] at ht
simpa only [A,B,u,v,P,V,rackStation,mul_assoc] using ht
have h2 : |A-P|≤ twinkle g k N := by
let F (i:I) := fun _ : Rack J N => (1:ℝ)
have ht := lane_means Z F (by intro i x; simp [F]) k hk
have he (i : I) :
condMean (bothPart (laneM Z i)) (F i)=B i := by simp only [F,condMean,mul_one]; rfl
have hx :
condMean (bothPart (N:=N) Z) (brightProd F)=A := by
simp only [F,brightProd,condMean,Finset.prod_const_one,mul_one,A,pr]
simp_rw [he,hx] at ht; exact ht
have hg : A * |u-V|≤2*twinkle g k N := by
have hh : |(A-P)*V|≤twinkle g k N := by
rw [abs_mul]; exact ((mul_le_mul_of_nonneg_left hV (abs_nonneg _)).trans_eq (mul_one _)).trans h2
calc A*|u-V|= |(A*u-P*V)-(A-P)*V| := by
rw [show A*u-P*V-(A-P)*V=(A*(u-V)) by ring,abs_mul,abs_of_nonneg h0.le]
_ ≤ _ := ((abs_sub ..).trans (add_le_add h1 hh)).trans_eq (two_mul _).symm
apply le_of_mul_le_mul_left _ (inv_pos_of_pos (netFact_pos (f:=g)))
exact ((mul_le_mul_of_nonneg_right hh.1 (abs_nonneg _)).trans hg).trans_eq (by
have h := netFact_pos (f:=g)
field_simp)
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.IndependentWeightCorrelation
namespace OAI
/-! # Conditioned Batch Laws -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperatorsopen Matrix Module LinearMap Submodule Function Finsetvariable {I J G H : Type} [Fintype I] [Fintype J] [Fintype G] [Fintype H]variable [DecidableEq I] [DecidableEq J] [DecidableEq G]variable {N : ℕ}
def street (g : Route (I×J) G) (i : I) : Route J G := fun j => g (i,j)def condLane (g : Route (I×J) G) (i : I) (z : G) (k : Port (street g i) z) : Port g z := ⟨(i,k.val),k.property⟩def laneM {g : Route (I×J) G} (Z : GeoM g) (i : I) : GeoM (street g i) := fun z => (Z z).submatrix (condLane g i z) (condLane g i z)
private theorem cut_inj {I J : Type} [Fintype I] [Fintype J] [DecidableEq I] (A : PlusRack I N) (h : Injective A.mulVec) {g : J→I} (hg : Injective g) : Injective (A.submatrix _root_.id g).mulVec := by rw [← mul_embedMat] exact inj_comp_mat _ _ h (embedMat_inj hg)
variable {g : Route (I×J) G}
omit [Fintype G] inset_option maxHeartbeats 600000 intheorem laneGram (Z : GeoM g) (x : Rack (I × J) N) (h : bothPart Z x) (i : I) : bothPart (laneM Z i) (led i x) := by classical obtain ⟨hh,hj⟩ := (both_test ..).mp h apply (both_test ..).mpr constructor · refine (part_scores ..).mpr fun q a b => ?_ exact (part_scores ..).mp hh q (condLane g i q a) (condLane g i q b) intro j let f := condLane g i j have he : Injective f := by intro a b h; exact Subtype.ext (congrArg (fun x : Port g j => x.val.2) h) exact ⟨cut_inj (rackEquiv g N x j).1 (hj j).1 he, cut_inj (rackEquiv g N x j).2 (hj j).2 he⟩
def crossroads (g : Route (I×J) G) := (crowded g)\(cInside g)def outsideZ (Z : GeoM g) : Vec (crossroads g) := fun x => directions g Z ⟨x.val,Finset.sdiff_subset x.property⟩
omit [Fintype G] inprivate theorem road_iff (Z : GeoM g) (x : Rack (I×J) N) : bothPart Z x ↔ (traced x (crossroads g) (outsideZ Z) ∧ (∀ i,bothPart (laneM Z i) (led i x))) ∧injPart g x := by classical constructor · intro h have ht := (both_test ..).mp h refine ⟨⟨?_,laneGram Z x h⟩,ht.2⟩ funext i exact congr_fun ((match_crowd x g Z).mpr ht.1) (⟨i.val,Finset.sdiff_subset i.property⟩ : ↑(crowded g)) rintro ⟨⟨ht,hH⟩,hf⟩ refine (both_test ..).mpr ⟨(part_scores ..).mpr ?_,hf⟩ intro i a b rcases a with ⟨⟨l,x'⟩,hl⟩ rcases b with ⟨⟨t,y⟩,hr⟩ subst i let j := g (l,x') by_cases hh : l=t · subst t let a : Port (street g l) j := ⟨x',rfl⟩ let b : Port (street g l) j := ⟨y,hr⟩ exact (part_scores ..).mp ((both_test ..).mp (hH l)).1 j a b let z : I×J := (l,x') let v : I×J := (t,y) have hv : (z,v)∈crossroads g := Finset.mem_sdiff.mpr ⟨Finset.mem_filter.mpr ⟨mem_univ _,hr.symm⟩,fun h => hh (mem_filter.mp h).2⟩ exact congr_fun ht (⟨(z,v),hv⟩ : ↑(crossroads g))
private def condMean (p : H→Prop) (f : Wgt H) := avg unif (fun x => ind (p x)*f x)private theorem cond_reset [Nonempty H] (p : H→Prop) (f : Wgt H) (h : 0<pr unif p) : condMean p f=pr unif p * avg (unifOn p) f := by rw [←on_unif]; unfold onW rw [avg_norm,subW_tot] have he : condMean p f = avg (subW unif p) f := by simp only [avg,subW,mul_assoc]; rfl rw [he] field_simp
def twinkle (_ : Route (I×J) G) (k : ℝ) (N : ℕ) := num G * (2*bp (k-N))+bp (-(N:ℝ)/2)
set_option maxHeartbeats 800000 inprivate theorem lane_means (Z : GeoM g) (f : I → Wgt (Rack J N)) (hf : ∀ i x,|f i x|≤1) (k : ℝ) (hk : ∀ i,num (Port g i)≤k) : |condMean (bothPart Z) (brightProd f) - bp (-( (crossroads g).card:ℝ)) * ∏ i,condMean (bothPart (laneM Z i)) (f i)|≤twinkle g k N := by classical let E := crossroads g let F i (x : Rack J N) := ind (bothPart (laneM Z i) x)*f i x have hF i x : |F i x|≤1 := by unfold F; by_cases h : bothPart (laneM Z i) x <;> simp only [h,ind_true,ind_false,one_mul, zero_mul]; exact hf i x; norm_num have hE i (h : i∈E) : i.1.1≠i.2.1 := fun he => (mem_sdiff.mp h).2 (mem_filter.mpr ⟨(mem_sdiff.mp h).1,he⟩) have ht := speed_expand F hF E (outsideZ Z) hE have hP : avg unif (brightProd F)=∏ i, condMean (bothPart (laneM Z i)) (f i) := (led_uniform (prodW F)).trans (prodW_avg _ _) let A x := ind (traced x E (outsideZ Z))*brightProd F x have hA x : |A x|≤1 := by by_cases h : traced x E (outsideZ Z) · unfold A; rw [ind_one h,one_mul]; exact lane_abs F hF _ x unfold A; rw [ind_zero h,zero_mul]; norm_num have hi x : ind (bothPart Z x) * brightProd f x= ind (injPart g x) * A x := by rw [road_iff]; unfold A F simp only [ind_and, ind_all,brightProd,Finset.prod_mul_distrib] ring have hg : |condMean (bothPart Z) (brightProd f) - avg unif A|≤ num G*(2*bp (k-N)) := by unfold condMean simp_rw [hi] rw [← avg_sub] refine (abs_avg_le unif_law.nz).trans ((avg_mono unif_law.nz (g:=fun x => ind (¬injPart g x)) fun i => ?_).trans (injPart_failure g N k hk)) by_cases h : injPart g i <;> simp only [h,ind_true,not_true,ind_false,one_mul,sub_self,abs_zero,zero_mul,zero_sub, abs_neg,not_false_eq_true]; exact le_rfl; exact hA _ rw [hP] at ht unfold twinkle apply le_trans _ (add_le_add hg ht) exact abs_sub_le ..
omit [DecidableEq I] intheorem lane_norm (Z : GeoM g) (hN : ∀ i, 2*num (Port g i)-(N:ℝ)≤ -1) (i : I) : 0<pr unif (bothPart (laneM Z i) (N:=N)) := by have he j : Injective (condLane g i j) := by intro a b h; exact Subtype.ext (congrArg (fun x : Port g j => x.val.2) h) have hx j : num (Port (street g i) j)≤num (Port g j) := by exact_mod_cast Fintype.card_le_of_injective _ (he j) refine lt_of_lt_of_le (inv_pos_of_pos netFact_pos) (net_norm (laneM Z i) N (fun j => ?_)).1 linarith only [hx j,hN j]
set_option maxHeartbeats 800000 intheorem compare_lanes (Z : GeoM g) (f : I→ Wgt (Rack J N)) (hf : ∀ i x,|f i x|≤1) (k : ℝ) (hk : ∀ i,num (Port g i)≤k) (hN : ∀ i,2*num (Port g i)-(N:ℝ)≤ -1) : |avg (rackStation Z N) (brightProd f)- ∏ i,avg (rackStation (laneM Z i) N) (f i)|≤ 2*netFact g*twinkle g k N := by classical let A := pr unif (bothPart (N:=N) Z) let B i := pr unif (bothPart (N:=N) (laneM Z i)) let u := avg (rackStation Z N) (brightProd f) let v i := avg (rackStation (laneM Z i) N) (f i) let P := bp (- ((crossroads g).card:ℝ))*(∏ i, B i) let V := ∏ i,v i have hV : |V|≤1 := by unfold V rw [Finset.abs_prod] have he (i) : SubLaw (rackStation (laneM Z i) N) := unifOn_sub _ refine (Finset.prod_le_prod₀ (fun i _ => abs_nonneg _) (fun i _ => (abs_avg_le (he i).nz).trans ((he i).avg_le zero_le_one (hf i)))).trans_eq ?_ simp have hh := net_norm Z N hN have h0 : 0<A := (inv_pos_of_pos netFact_pos).trans_le hh.1 have h1 : |A*u-P*V|≤twinkle g k N := by have hb := lane_norm (N:=N) Z hN have ht := lane_means Z f hf k hk rw [cond_reset (bothPart (N:=N) Z) _ h0] at ht simp_rw [cond_reset _ _ (hb _)] at ht; rw [Finset.prod_mul_distrib] at ht simpa only [A,B,u,v,P,V,rackStation,mul_assoc] using ht have h2 : |A-P|≤ twinkle g k N := by let F (i:I) := fun _ : Rack J N => (1:ℝ) have ht := lane_means Z F (by intro i x; simp [F]) k hk have he (i : I) : condMean (bothPart (laneM Z i)) (F i)=B i := by simp only [F,condMean,mul_one]; rfl have hx : condMean (bothPart (N:=N) Z) (brightProd F)=A := by simp only [F,brightProd,condMean,Finset.prod_const_one,mul_one,A,pr] simp_rw [he,hx] at ht; exact ht have hg : A * |u-V|≤2*twinkle g k N := by have hh : |(A-P)*V|≤twinkle g k N := by rw [abs_mul]; exact ((mul_le_mul_of_nonneg_left hV (abs_nonneg _)).trans_eq (mul_one _)).trans h2 calc A*|u-V|= |(A*u-P*V)-(A-P)*V| := by rw [show A*u-P*V-(A-P)*V=(A*(u-V)) by ring,abs_mul,abs_of_nonneg h0.le] _ ≤ _ := ((abs_sub ..).trans (add_le_add h1 hh)).trans_eq (two_mul _).symm apply le_of_mul_le_mul_left _ (inv_pos_of_pos (netFact_pos (f:=g))) exact ((mul_le_mul_of_nonneg_right hh.1 (abs_nonneg _)).trans hg).trans_eq (by have h := netFact_pos (f:=g) field_simp)
end HadwigerCounterexample
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969712345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697import OAI.Combinatorics.HadwigerCounterexample.BilinearBlockCorrelation
namespace OAI
/-! # Conditioned Correlations -/
noncomputable section
namespace HadwigerCounterexample
open Finset Real Filter Matrix LinearMap Function
open scoped BigOperators
variable {p : Shape} {I A : Type} [Fintype I] [Fintype A]
variable {n : ℕ}
set_option maxHeartbeats 600000 in
theorem spark_condition (p : Shape) (M : Moment p n) (s t : Label p.b) (l j : Tag p.g)
(f g : Flavor p.g) (B) (hB : f.keeps l B) (hB' : g.keeps j B)
(w u : Wgt (Knobs p.g n)) (hw : ∀ i,|w i|≤1) (hu : ∀ i,|u i|≤1)
(μ δ : Wgt (Knobs p.g n)) (hμ : IsLaw μ) (hδ : IsLaw δ)
(C : ℝ) (hC : 0<C)
(hc : ∀ i,μ i ≤ C*unif i) (hc' : ∀ i,δ i ≤ C*unif i)
(hM : n ≤ 5*blockRank B s t M) :
let Q i z := evmat M (spring p l s f i) (spring p j t g z)
|avg (pairW μ δ) (fun x => wsign (Q x.1 x.2)*(w x.1*u x.2))|≤
C^2*bp (-(n:ℝ)/10) := by
classical
intro Q
let V := Knobs p.g n
let fit (f p : Wgt V) := fun i => p i*f i/(C*unif i)
have h0 (i : V) : 0<C*unif i := by rw [unif_apply]; positivity
have hh (t p : Wgt V) (ht : ∀ i, |t i|≤1) (hp : IsLaw p) (h : ∀ i,p i≤C*unif i) i :
|fit t p i|≤1 := by
unfold fit; rw [abs_div,abs_of_pos (h0 i),abs_mul,abs_of_nonneg (hp.nz _)]
refine (div_le_one (h0 i)).mpr ?_
exact ((mul_le_mul_of_nonneg_left (ht _) (hp.nz _)).trans_eq (mul_one _)).trans (h _)
let F (x : V×V) := wsign (Q x.1 x.2)*(w x.1*u x.2)
let Z (x : V×V) := wsign (Q x.1 x.2)*(fit w μ x.1*fit u δ x.2)
have he :
avg (pairW μ δ) F=C^2 * avg (pairW unif unif) Z := by
unfold avg; rw [Finset.mul_sum]
refine sum_congr rfl fun i _ => ?_
unfold Z F fit pairW
have h1 := h0 i.1; have h2 := h0 i.2
have h3 : unif i.1 ≠ 0 := by rw [unif_apply]; positivity
have h4 : unif i.2 ≠ 0 := by rw [unif_apply]; positivity
field_simp
change |avg (pairW μ δ) F|≤_
rw [he,abs_mul,abs_of_nonneg (sq_nonneg _)]
have hi : (n:ℝ)≤5*blockRank B s t M := by exact_mod_cast hM
exact mul_le_mul_of_nonneg_left ((spark_uncap p M s t l j f g B hB hB'
_ _ (hh w μ hw hμ hc) (hh u δ hu hδ hc')).trans (bp_le (by linarith only [hi]))) (sq_nonneg _)
def litFire (p : Shape) {n N : ℕ} (x : UnitType p n N) :=
∀ (s t : Label p.b) (c : Vec (Notches p)), c≠0 →
n≤5*blockRank Block.Z s t (issue p c x)
theorem litFire_calendar (p : Shape) (C : ℝ) (M : ℕ) (hM : 4≤M) :
∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n), 2*num (Full p n)<N →
∀ w : Wgt (UnitType p n N),
(∀ i,w i ≤ bp (C*N)*pairW (raw m N) (raw m N) i) →
pr w (fun i => ¬litFire p i) ≤ bp (-(n:ℝ)*n/8) := by
classical
let I := Label p.b × Label p.b × Vec (Notches p)
have ht := bp_poly_dom_nat (a:=1) zero_lt_one (num I) 0
filter_upwards [issue_live p,ht,(tendsto_natCast_atTop_atTop (R:=ℝ)).eventually
(eventually_ge_atTop (8*(C*M+1)))]
with n hn hp hab N m hN w h
change 8*(C*M+1)≤ (n:ℝ) at hab
refine (pr_cap h _).trans ?_
let Q (i : I) (x : UnitType p n N) :=
i.2.2≠0 ∧ 5*blockRank Block.Z i.1 i.2.1 (issue p i.2.2 x)<n
let v := pairW (raw m N) (raw m N)
have hv : IsLaw v := pairW_law (raw_law m hN) (raw_law m hN)
have he (i : I) : pr v (Q i)≤bp (-(n:ℝ)*n/4) := by
by_cases h : i.2.2=0
· simp only [Q,h,ne_eq,not_true,false_and,pr_false]; exact (bp_pos _).le
exact (pr_mono hv.nz fun x h => h.2).trans
(hn N (by unfold N; nlinarith only [Nat.mul_le_mul_right n hM]) hN m _ _ i.2.2 h)
have hh (x : UnitType p n N) (h : ¬litFire p x) : ∃ i,Q i x := by
unfold litFire at h
push Not at h
obtain ⟨s,t,c,hc,h⟩ := h; exact ⟨(s,t,c),hc,h⟩
have hi : pr v (fun x=> ¬litFire p x) ≤ num I*bp (-(n:ℝ)*n/4) :=
(le_trans (pr_mono hv.nz hh) (pr_exists_le hv.nz Q)).trans ((sum_le_sum
fun i _ => he i).trans_eq (by simp [num]))
refine (mul_le_mul_of_nonneg_left hi (bp_pos _).le).trans ?_
simp only [pow_zero,mul_one,one_mul] at hp
apply (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hp.le
(bp_pos (-(n:ℝ)*n/4)).le) (bp_pos (C*N)).le).trans
rw [← bp_add,← bp_add]
apply bp_le
unfold N; push_cast
nlinarith only [mul_le_mul_of_nonneg_right hab (Nat.cast_nonneg n : 0≤(n:ℝ))]
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.BilinearBlockCorrelation
namespace OAI
/-! # Conditioned Correlations -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Real Filter Matrix LinearMap Functionopen scoped BigOperatorsvariable {p : Shape} {I A : Type} [Fintype I] [Fintype A]variable {n : ℕ}
set_option maxHeartbeats 600000 intheorem spark_condition (p : Shape) (M : Moment p n) (s t : Label p.b) (l j : Tag p.g) (f g : Flavor p.g) (B) (hB : f.keeps l B) (hB' : g.keeps j B) (w u : Wgt (Knobs p.g n)) (hw : ∀ i,|w i|≤1) (hu : ∀ i,|u i|≤1) (μ δ : Wgt (Knobs p.g n)) (hμ : IsLaw μ) (hδ : IsLaw δ) (C : ℝ) (hC : 0<C) (hc : ∀ i,μ i ≤ C*unif i) (hc' : ∀ i,δ i ≤ C*unif i) (hM : n ≤ 5*blockRank B s t M) : let Q i z := evmat M (spring p l s f i) (spring p j t g z) |avg (pairW μ δ) (fun x => wsign (Q x.1 x.2)*(w x.1*u x.2))|≤ C^2*bp (-(n:ℝ)/10) := by classical intro Q let V := Knobs p.g n let fit (f p : Wgt V) := fun i => p i*f i/(C*unif i) have h0 (i : V) : 0<C*unif i := by rw [unif_apply]; positivity have hh (t p : Wgt V) (ht : ∀ i, |t i|≤1) (hp : IsLaw p) (h : ∀ i,p i≤C*unif i) i : |fit t p i|≤1 := by unfold fit; rw [abs_div,abs_of_pos (h0 i),abs_mul,abs_of_nonneg (hp.nz _)] refine (div_le_one (h0 i)).mpr ?_ exact ((mul_le_mul_of_nonneg_left (ht _) (hp.nz _)).trans_eq (mul_one _)).trans (h _) let F (x : V×V) := wsign (Q x.1 x.2)*(w x.1*u x.2) let Z (x : V×V) := wsign (Q x.1 x.2)*(fit w μ x.1*fit u δ x.2) have he : avg (pairW μ δ) F=C^2 * avg (pairW unif unif) Z := by unfold avg; rw [Finset.mul_sum] refine sum_congr rfl fun i _ => ?_ unfold Z F fit pairW have h1 := h0 i.1; have h2 := h0 i.2 have h3 : unif i.1 ≠ 0 := by rw [unif_apply]; positivity have h4 : unif i.2 ≠ 0 := by rw [unif_apply]; positivity field_simp change |avg (pairW μ δ) F|≤_ rw [he,abs_mul,abs_of_nonneg (sq_nonneg _)] have hi : (n:ℝ)≤5*blockRank B s t M := by exact_mod_cast hM exact mul_le_mul_of_nonneg_left ((spark_uncap p M s t l j f g B hB hB' _ _ (hh w μ hw hμ hc) (hh u δ hu hδ hc')).trans (bp_le (by linarith only [hi]))) (sq_nonneg _)
def litFire (p : Shape) {n N : ℕ} (x : UnitType p n N) := ∀ (s t : Label p.b) (c : Vec (Notches p)), c≠0 → n≤5*blockRank Block.Z s t (issue p c x)
theorem litFire_calendar (p : Shape) (C : ℝ) (M : ℕ) (hM : 4≤M) : ∀ᶠ n : ℕ in atTop, let N := M*n; ∀ (m : Mixer p n), 2*num (Full p n)<N → ∀ w : Wgt (UnitType p n N), (∀ i,w i ≤ bp (C*N)*pairW (raw m N) (raw m N) i) → pr w (fun i => ¬litFire p i) ≤ bp (-(n:ℝ)*n/8) := by classical let I := Label p.b × Label p.b × Vec (Notches p) have ht := bp_poly_dom_nat (a:=1) zero_lt_one (num I) 0 filter_upwards [issue_live p,ht,(tendsto_natCast_atTop_atTop (R:=ℝ)).eventually (eventually_ge_atTop (8*(C*M+1)))] with n hn hp hab N m hN w h change 8*(C*M+1)≤ (n:ℝ) at hab refine (pr_cap h _).trans ?_ let Q (i : I) (x : UnitType p n N) := i.2.2≠0 ∧ 5*blockRank Block.Z i.1 i.2.1 (issue p i.2.2 x)<n let v := pairW (raw m N) (raw m N) have hv : IsLaw v := pairW_law (raw_law m hN) (raw_law m hN) have he (i : I) : pr v (Q i)≤bp (-(n:ℝ)*n/4) := by by_cases h : i.2.2=0 · simp only [Q,h,ne_eq,not_true,false_and,pr_false]; exact (bp_pos _).le exact (pr_mono hv.nz fun x h => h.2).trans (hn N (by unfold N; nlinarith only [Nat.mul_le_mul_right n hM]) hN m _ _ i.2.2 h) have hh (x : UnitType p n N) (h : ¬litFire p x) : ∃ i,Q i x := by unfold litFire at h push Not at h obtain ⟨s,t,c,hc,h⟩ := h; exact ⟨(s,t,c),hc,h⟩ have hi : pr v (fun x=> ¬litFire p x) ≤ num I*bp (-(n:ℝ)*n/4) := (le_trans (pr_mono hv.nz hh) (pr_exists_le hv.nz Q)).trans ((sum_le_sum fun i _ => he i).trans_eq (by simp [num])) refine (mul_le_mul_of_nonneg_left hi (bp_pos _).le).trans ?_ simp only [pow_zero,mul_one,one_mul] at hp apply (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hp.le (bp_pos (-(n:ℝ)*n/4)).le) (bp_pos (C*N)).le).trans rw [← bp_add,← bp_add] apply bp_le unfold N; push_cast nlinarith only [mul_le_mul_of_nonneg_right hab (Nat.cast_nonneg n : 0≤(n:ℝ))]end HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100import OAI.Combinatorics.HadwigerCounterexample.RawFrameLaws
namespace OAI
/-! # Construction Scales -/
noncomputable section
namespace HadwigerCounterexample
open scoped BigOperators
open Matrix Filter
theorem card_full (p : Shape) (n : ℕ) :
Fintype.card (Full p n) = psize p * (1+(p.g*p.g+3)*n) + p.h := by
calc
_ = Fintype.card (Row p n) + Fintype.card (Fin p.h) :=
Fintype.card_sum ..
_ = _ := by rw [card_row, Fintype.card_fin]
theorem full_linear (p : Shape) : ∃ B : ℝ, 0 ≤ B ∧ ∀ n : ℕ, 0 < n →
num (Full p n) ≤ B*n := by
let b := psize p*(1+(p.g*p.g+3)) + p.h
refine ⟨↑b,Nat.cast_nonneg b, fun n hn => ?_⟩
have h1 : 1 ≤ n := hn
have h2 : Fintype.card (Full p n) ≤ b*n := by
rw [card_full]
unfold b
calc _ ≤ psize p * (n+(p.g*p.g+3)*n) + p.h*n :=
add_le_add (Nat.mul_le_mul_left _ (by omega)) (by nlinarith)
_ = _ := by ring
exact_mod_cast h2
theorem unit_size (p : Shape) (n N : ℕ) :
num (UnitType p n N) = bp (num (Comp p.g) * 4 * N * num (Full p n)) := by
have hc :
(Fintype.card (UnitType p n N)) =
((Fintype.card (Mat (Fin N) (Full p n)))^2)^(Fintype.card (Comp p.g)) *
((Fintype.card (Mat (Fin N) (Full p n)))^2)^(Fintype.card (Comp p.g)) := by
simp [UnitType, Orient, Oframe, RawFrame, pow_two]
unfold num
rw [hc]
push_cast
rw [card_space,dim_mat,Fintype.card_fin]
push_cast
simp only [← bp_mul_nat,← bp_add]
push_cast; ring_nf
/-- Fixed linear and constant expenses become any fixed small fraction of N. -/
theorem have_budget {δ : ℝ} (hd : 0 < δ) (a b : ℝ) (hb : 0 ≤ b) :
∀ᶠ M : ℕ in atTop, ∀ n : ℕ, 1 ≤ n → a*n+b ≤ δ*(M*n : ℕ) := by
have h : Tendsto (fun M : ℕ => δ*M) atTop atTop :=
(tendsto_const_mul_atTop_of_pos hd).mpr tendsto_natCast_atTop_atTop
filter_upwards [h.eventually (eventually_ge_atTop (a+b))] with M hM n hn
change a+b ≤ δ*M at hM
push_cast
have hn' : 1 ≤ (n:ℝ) := by exact_mod_cast hn
nlinarith only [mul_le_mul_of_nonneg_right hM (Nat.cast_nonneg n : (0:ℝ)≤n),
mul_le_mul_of_nonneg_right hn' hb]
theorem columns_budget (p : Shape) {δ : ℝ} (hd : 0 < δ) (a b : ℝ)
(ha : 0 ≤ a) (hb : 0 ≤ b) :
∀ᶠ M : ℕ in atTop, ∀ n : ℕ, 1 ≤ n →
a*num (Full p n) + b ≤ δ*(M*n:ℕ) := by
obtain ⟨B,hB,h⟩ := full_linear p
filter_upwards [have_budget hd (a*B) b hb] with M hM n hn
refine le_trans ?_ (hM n hn)
rw [mul_assoc]
exact add_le_add_left (mul_le_mul_of_nonneg_left (h _ hn) ha) _
theorem raw_ready (p : Shape) {δ : ℝ} (hd : 0 < δ) :
∀ᶠ M : ℕ in atTop, ∀ᶠ n : ℕ in atTop, let N := M*n;
num (UnitType p n N) ≤ bp ((4*num (Comp p.g))*N^ (2 : ℕ)) ∧
∀ m : Mixer p n, IsLaw (raw m N) ∧ ∀ a : Pin p n N,
pr (pairW (raw m N) (raw m N)) a.agree ≤ bp (-(1-δ)*(planRank a.sp)*N) := by
have hd' : 0 < δ/2 := by positivity
filter_upwards [columns_budget p hd' 2 (4*num (Comp p.g)) (by norm_num)
(by unfold num; positivity),
columns_budget p (δ:=1) (by norm_num) 2 1 (by norm_num) (by norm_num)] with M ha hb
filter_upwards [eventually_ge_atTop 1] with n hn
specialize ha n hn
specialize hb n hn
let N := M*n
have hi : 0 ≤ num (Comp p.g) := Nat.cast_nonneg _
have hj : 0 ≤ num (Full p n) := Nat.cast_nonneg _
rw [one_mul] at hb
have hh : 2*num (Full p n)<N := by unfold N; linarith only [hb]
dsimp only
constructor
· rw [unit_size]
apply bp_le
have hf : num (Full p n) ≤ N := by linarith
exact le_trans (mul_le_mul_of_nonneg_left hf (by positivity))
(le_of_eq (by unfold N; push_cast; ring))
· intro m
refine ⟨raw_law m hh, fun a => reference_cap _ a hd ?_ ?_ ?_⟩ <;> linarith
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.RawFrameLaws
namespace OAI
/-! # Construction Scales -/
noncomputable sectionnamespace HadwigerCounterexampleopen scoped BigOperatorsopen Matrix Filter
theorem card_full (p : Shape) (n : ℕ) : Fintype.card (Full p n) = psize p * (1+(p.g*p.g+3)*n) + p.h := by calc _ = Fintype.card (Row p n) + Fintype.card (Fin p.h) := Fintype.card_sum .. _ = _ := by rw [card_row, Fintype.card_fin]
theorem full_linear (p : Shape) : ∃ B : ℝ, 0 ≤ B ∧ ∀ n : ℕ, 0 < n → num (Full p n) ≤ B*n := by let b := psize p*(1+(p.g*p.g+3)) + p.h refine ⟨↑b,Nat.cast_nonneg b, fun n hn => ?_⟩ have h1 : 1 ≤ n := hn have h2 : Fintype.card (Full p n) ≤ b*n := by rw [card_full] unfold b calc _ ≤ psize p * (n+(p.g*p.g+3)*n) + p.h*n := add_le_add (Nat.mul_le_mul_left _ (by omega)) (by nlinarith) _ = _ := by ring exact_mod_cast h2
theorem unit_size (p : Shape) (n N : ℕ) : num (UnitType p n N) = bp (num (Comp p.g) * 4 * N * num (Full p n)) := by have hc : (Fintype.card (UnitType p n N)) = ((Fintype.card (Mat (Fin N) (Full p n)))^2)^(Fintype.card (Comp p.g)) * ((Fintype.card (Mat (Fin N) (Full p n)))^2)^(Fintype.card (Comp p.g)) := by simp [UnitType, Orient, Oframe, RawFrame, pow_two] unfold num rw [hc] push_cast rw [card_space,dim_mat,Fintype.card_fin] push_cast simp only [← bp_mul_nat,← bp_add] push_cast; ring_nf
/-- Fixed linear and constant expenses become any fixed small fraction of N. -/theorem have_budget {δ : ℝ} (hd : 0 < δ) (a b : ℝ) (hb : 0 ≤ b) : ∀ᶠ M : ℕ in atTop, ∀ n : ℕ, 1 ≤ n → a*n+b ≤ δ*(M*n : ℕ) := by have h : Tendsto (fun M : ℕ => δ*M) atTop atTop := (tendsto_const_mul_atTop_of_pos hd).mpr tendsto_natCast_atTop_atTop filter_upwards [h.eventually (eventually_ge_atTop (a+b))] with M hM n hn change a+b ≤ δ*M at hM push_cast have hn' : 1 ≤ (n:ℝ) := by exact_mod_cast hn nlinarith only [mul_le_mul_of_nonneg_right hM (Nat.cast_nonneg n : (0:ℝ)≤n), mul_le_mul_of_nonneg_right hn' hb]
theorem columns_budget (p : Shape) {δ : ℝ} (hd : 0 < δ) (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : ∀ᶠ M : ℕ in atTop, ∀ n : ℕ, 1 ≤ n → a*num (Full p n) + b ≤ δ*(M*n:ℕ) := by obtain ⟨B,hB,h⟩ := full_linear p filter_upwards [have_budget hd (a*B) b hb] with M hM n hn refine le_trans ?_ (hM n hn) rw [mul_assoc] exact add_le_add_left (mul_le_mul_of_nonneg_left (h _ hn) ha) _
theorem raw_ready (p : Shape) {δ : ℝ} (hd : 0 < δ) : ∀ᶠ M : ℕ in atTop, ∀ᶠ n : ℕ in atTop, let N := M*n; num (UnitType p n N) ≤ bp ((4*num (Comp p.g))*N^ (2 : ℕ)) ∧ ∀ m : Mixer p n, IsLaw (raw m N) ∧ ∀ a : Pin p n N, pr (pairW (raw m N) (raw m N)) a.agree ≤ bp (-(1-δ)*(planRank a.sp)*N) := by have hd' : 0 < δ/2 := by positivity filter_upwards [columns_budget p hd' 2 (4*num (Comp p.g)) (by norm_num) (by unfold num; positivity), columns_budget p (δ:=1) (by norm_num) 2 1 (by norm_num) (by norm_num)] with M ha hb filter_upwards [eventually_ge_atTop 1] with n hn specialize ha n hn specialize hb n hn let N := M*n have hi : 0 ≤ num (Comp p.g) := Nat.cast_nonneg _ have hj : 0 ≤ num (Full p n) := Nat.cast_nonneg _ rw [one_mul] at hb have hh : 2*num (Full p n)<N := by unfold N; linarith only [hb] dsimp only constructor · rw [unit_size] apply bp_le have hf : num (Full p n) ≤ N := by linarith
exact le_trans (mul_le_mul_of_nonneg_left hf (by positivity)) (le_of_eq (by unfold N; push_cast; ring)) · intro m refine ⟨raw_law m hh, fun a => reference_cap _ a hd ?_ ?_ ?_⟩ <;> linarithend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147import OAI.Combinatorics.HadwigerCounterexample.BooleanLabels
import OAI.Combinatorics.HadwigerCounterexample.QuadraticTesters
import OAI.Combinatorics.HadwigerCounterexample.CoordinateEmbeddings
namespace OAI
/-! # Coordinate Blocks -/
noncomputable section
namespace HadwigerCounterexample
open Matrix
open scoped BigOperators
variable {p : Shape} {n : ℕ}
def blockA (p : Shape) (n : ℕ) (B : Block p.g) : Mat (AIdx p.g n) (Fin n) :=
embedMat (fun i => some (B,i))
def blockRay (p : Shape) (n : ℕ) (s : Label p.b) (B : Block p.g) : Mat (Row p n) (Fin n) :=
labMat p n s * blockA p n B
theorem lab_inj (s : Label p.b) : Function.Injective (labMat p n s).mulVec := by
intro x y he
funext i
rw [labMat_act,labMat_act] at he
have h := congr_fun he (emptySel,i)
simpa [putLab,selV,emptySel] using h
theorem joined_lab_inj {s t : Label p.b} (hj : 1≤p.j) (hs : s≠t) :
Function.Injective (fromCols (labMat p n s) (labMat p n t)).mulVec := by
apply inj_fromCols (lab_inj _) (lab_inj _)
classical
rw [disjoint_iff_inf_le]
rintro x ⟨⟨v,rfl⟩,w,h⟩
simp only [mulVecLin_apply,labMat_act] at h
let Z : Label p.b → Vec (AIdx p.g n) := fun i => if i=s then v else -w
have he : ∑ i ∈ ({s,t} : Finset _), putLab p n i (Z i)=0 := by
simp [Z,hs,hs.symm,map_neg,h]
have hi : ({s,t}:Finset _).card ≤ p.j+1 := by
have hh : ({s,t}:Finset _).card=2 := by simp [hs]
omega
have hg := ray_indep _ _ hi he s (by simp)
have hv : v=0 := by simpa [Z] using hg
rw [hv,map_zero]; exact Submodule.zero_mem _
theorem block_inj (B : Block p.g) : Function.Injective (blockA p n B).mulVec :=
embedMat_inj (show Function.Injective (fun i => some (B,i)) from
fun _ _ h => congrArg Prod.snd (Option.some.inj h))
theorem blockRay_inj (p : Shape) (n) (s) (B) :
Function.Injective (blockRay p n s B).mulVec :=
inj_comp_mat _ _ (lab_inj _) (block_inj B)
theorem joined_block_inj {s t : Label p.b} (hj : 1 ≤ p.j) (hs : s ≠ t) (B : Block p.g) :
Function.Injective (fromCols (blockRay p n s B) (blockRay p n t B)).mulVec := by
classical
apply inj_fromCols (blockRay_inj ..) (blockRay_inj ..)
rw [disjoint_iff_inf_le]
rintro x ⟨⟨v,rfl⟩,w,h⟩
simp only [Matrix.mulVecLin_apply,blockRay,← Matrix.mulVec_mulVec] at h
let a := Sum.elim (blockA p n B *ᵥ v) (0 : Vec (AIdx p.g n))
let b := Sum.elim (0 : Vec (AIdx p.g n)) (blockA p n B *ᵥ w)
have heq : a=b := joined_lab_inj hj hs (by
dsimp only [a,b]
rw [fromCols_mulVec_sumElim,fromCols_mulVec_sumElim,Matrix.mulVec_zero,
Matrix.mulVec_zero,zero_add,add_zero,h])
have hg : blockA p n B *ᵥ v = 0 := funext (fun x => congr_fun heq (.inl x))
change blockRay p n s B *ᵥ v ∈ _
rw [blockRay,← Matrix.mulVec_mulVec,hg,Matrix.mulVec_zero]
exact Submodule.zero_mem _
theorem blockRay_eval (p : Shape) (s : Label p.b) (B) (i) (j : Fin n) :
blockRay p n s B i j = if i.2=some (B,j) then monoBit s i.1.val else 0 := by
rw [blockRay,blockA,mul_embedMat]; rfl
theorem project_pick {d B : Block p.g} (hd : d ≠ B) (a) (s) (i) :
(blockRay p n s B)ᵀ *ᵥ pick p n a d i = 0 := by
classical
unfold pick
split
· rename_i hi
rw [Matrix.mulVec_single_one]
ext j
change blockRay p n s B (a,some (d,⟨i,hi⟩)) j=0
simp [blockRay_eval,hd]
rw [Matrix.mulVec_zero]
theorem project_same (B : Block p.g) (a s) (i : Fin n) :
(blockRay p n s B)ᵀ *ᵥ pick p n a B i.val = Pi.single i (monoBit s a.val) := by
classical
rw [pick,dite_eq_left i.isLt,Matrix.mulVec_single_one]
ext j
change blockRay p n s B _ j=_
rw [blockRay_eval]
simp [Pi.single_apply, eq_comm]
def pullM {I J V U : Type} [Fintype V] [Fintype U] (P : Mat V I) (Q : Mat U J) :
Mat V U →ₗ[F] Mat I J := liftM Pᵀ Qᵀ
theorem pullM_def {I J V U : Type} [Fintype V] [Fintype U] (P : Mat V I)
(Q : Mat U J) (M : Mat V U) : pullM P Q M=Pᵀ*M*Q := rfl
theorem pull_test {d B : Block p.g} (h : d≠B) (s s') :
pullM (blockRay p n s B) (blockRay p n s' B) (testM p n d) = 0 := by
unfold testM pullM
simp only [map_sum,liftM_outer,project_pick h]
simp
theorem pull_self_Z (M) (s s' : Label p.b) :
pullM (blockRay p n s Block.Z) (blockRay p n s' Block.Z) (selfM p n M)=0 := by
let L := pullM (blockRay p n s Block.Z) (blockRay p n s' Block.Z)
have hx (i j : Tag p.g) := pull_test (n:=n) (d:=Block.O i j)
(B:=Block.Z) (by simp [Block.O,Block.Z]) s s'
have hs := pull_test (p:=p) (n:=n) (d:=Block.S) (B:=Block.Z) (by simp [Block.S,Block.Z]) s s'
have h (a : SelIdx p.b p.j) (s : Label p.b) (i) :=
project_pick (n:=n) (p:=p) (d:=Block.sharp) (B:=Block.Z) (by simp [Block.sharp,Block.Z]) a s i
rw [selfM]; simp only [map_add,map_sum,hx,hs,Finset.sum_const_zero,zero_add]
unfold sharpM sharpPick pullM
by_cases he : 1 ≤ p.j
· simp only [map_sum,map_smul,map_add, dite_eq_left he,liftM_outer,h]
simp
· simp only [dite_eq_right he]; simp
theorem pull_self_sharp (M) (s s' : Label p.b) (hj : 1≤p.j) :
pullM (blockRay p n s Block.sharp) (blockRay p n s' Block.sharp) (selfM p n M) =
∑ i, (s i+s' i) • M i := by
classical
have hx (i j : Tag p.g) := pull_test (n:=n) (d:=Block.O i j)
(B:=Block.sharp) (by simp [Block.O,Block.sharp]) s s'
have hs := pull_test (p:=p) (n:=n) (d:=Block.S) (B:=Block.sharp) (by simp [Block.S,Block.sharp]) s s'
rw [selfM]; simp only [map_add,map_sum,hx,hs,Finset.sum_const_zero,zero_add]
unfold sharpM sharpPick pullM
simp only [map_sum,map_add,map_smul, dite_eq_left hj,liftM_outer,project_same]
refine Finset.sum_congr rfl fun i _ => ?_
ext a b
simp only [Matrix.sum_apply,Matrix.add_apply,Matrix.smul_apply,smul_eq_mul,
vecMulVec_apply,monoBit,emptySel,Finset.prod_empty,Finset.prod_singleton,Pi.single_apply]
rw [Finset.sum_eq_single a]
· rw [Finset.sum_eq_single b]
· simp; ring
· intro j _ h; simp [h.symm]
· simp
· intro j _ h; simp [h.symm]
simp
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.BooleanLabelsimport OAI.Combinatorics.HadwigerCounterexample.QuadraticTestersimport OAI.Combinatorics.HadwigerCounterexample.CoordinateEmbeddings
namespace OAI
/-! # Coordinate Blocks -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrixopen scoped BigOperatorsvariable {p : Shape} {n : ℕ}
def blockA (p : Shape) (n : ℕ) (B : Block p.g) : Mat (AIdx p.g n) (Fin n) := embedMat (fun i => some (B,i))
def blockRay (p : Shape) (n : ℕ) (s : Label p.b) (B : Block p.g) : Mat (Row p n) (Fin n) := labMat p n s * blockA p n B
theorem lab_inj (s : Label p.b) : Function.Injective (labMat p n s).mulVec := by intro x y he funext i rw [labMat_act,labMat_act] at he have h := congr_fun he (emptySel,i) simpa [putLab,selV,emptySel] using h
theorem joined_lab_inj {s t : Label p.b} (hj : 1≤p.j) (hs : s≠t) : Function.Injective (fromCols (labMat p n s) (labMat p n t)).mulVec := by apply inj_fromCols (lab_inj _) (lab_inj _) classical rw [disjoint_iff_inf_le] rintro x ⟨⟨v,rfl⟩,w,h⟩ simp only [mulVecLin_apply,labMat_act] at h let Z : Label p.b → Vec (AIdx p.g n) := fun i => if i=s then v else -w have he : ∑ i ∈ ({s,t} : Finset _), putLab p n i (Z i)=0 := by simp [Z,hs,hs.symm,map_neg,h] have hi : ({s,t}:Finset _).card ≤ p.j+1 := by have hh : ({s,t}:Finset _).card=2 := by simp [hs] omega have hg := ray_indep _ _ hi he s (by simp) have hv : v=0 := by simpa [Z] using hg rw [hv,map_zero]; exact Submodule.zero_mem _
theorem block_inj (B : Block p.g) : Function.Injective (blockA p n B).mulVec := embedMat_inj (show Function.Injective (fun i => some (B,i)) from fun _ _ h => congrArg Prod.snd (Option.some.inj h))
theorem blockRay_inj (p : Shape) (n) (s) (B) : Function.Injective (blockRay p n s B).mulVec := inj_comp_mat _ _ (lab_inj _) (block_inj B)
theorem joined_block_inj {s t : Label p.b} (hj : 1 ≤ p.j) (hs : s ≠ t) (B : Block p.g) : Function.Injective (fromCols (blockRay p n s B) (blockRay p n t B)).mulVec := by classical apply inj_fromCols (blockRay_inj ..) (blockRay_inj ..) rw [disjoint_iff_inf_le] rintro x ⟨⟨v,rfl⟩,w,h⟩ simp only [Matrix.mulVecLin_apply,blockRay,← Matrix.mulVec_mulVec] at h let a := Sum.elim (blockA p n B *ᵥ v) (0 : Vec (AIdx p.g n)) let b := Sum.elim (0 : Vec (AIdx p.g n)) (blockA p n B *ᵥ w) have heq : a=b := joined_lab_inj hj hs (by dsimp only [a,b] rw [fromCols_mulVec_sumElim,fromCols_mulVec_sumElim,Matrix.mulVec_zero, Matrix.mulVec_zero,zero_add,add_zero,h]) have hg : blockA p n B *ᵥ v = 0 := funext (fun x => congr_fun heq (.inl x)) change blockRay p n s B *ᵥ v ∈ _ rw [blockRay,← Matrix.mulVec_mulVec,hg,Matrix.mulVec_zero] exact Submodule.zero_mem _
theorem blockRay_eval (p : Shape) (s : Label p.b) (B) (i) (j : Fin n) : blockRay p n s B i j = if i.2=some (B,j) then monoBit s i.1.val else 0 := by rw [blockRay,blockA,mul_embedMat]; rfl
theorem project_pick {d B : Block p.g} (hd : d ≠ B) (a) (s) (i) : (blockRay p n s B)ᵀ *ᵥ pick p n a d i = 0 := by classical unfold pick split · rename_i hi rw [Matrix.mulVec_single_one] ext j change blockRay p n s B (a,some (d,⟨i,hi⟩)) j=0 simp [blockRay_eval,hd] rw [Matrix.mulVec_zero]
theorem project_same (B : Block p.g) (a s) (i : Fin n) : (blockRay p n s B)ᵀ *ᵥ pick p n a B i.val = Pi.single i (monoBit s a.val) := by classical rw [pick,dite_eq_left i.isLt,Matrix.mulVec_single_one] ext j change blockRay p n s B _ j=_ rw [blockRay_eval] simp [Pi.single_apply, eq_comm]
def pullM {I J V U : Type} [Fintype V] [Fintype U] (P : Mat V I) (Q : Mat U J) : Mat V U →ₗ[F] Mat I J := liftM Pᵀ Qᵀtheorem pullM_def {I J V U : Type} [Fintype V] [Fintype U] (P : Mat V I) (Q : Mat U J) (M : Mat V U) : pullM P Q M=Pᵀ*M*Q := rfl
theorem pull_test {d B : Block p.g} (h : d≠B) (s s') : pullM (blockRay p n s B) (blockRay p n s' B) (testM p n d) = 0 := by unfold testM pullM simp only [map_sum,liftM_outer,project_pick h] simp
theorem pull_self_Z (M) (s s' : Label p.b) : pullM (blockRay p n s Block.Z) (blockRay p n s' Block.Z) (selfM p n M)=0 := by let L := pullM (blockRay p n s Block.Z) (blockRay p n s' Block.Z) have hx (i j : Tag p.g) := pull_test (n:=n) (d:=Block.O i j) (B:=Block.Z) (by simp [Block.O,Block.Z]) s s' have hs := pull_test (p:=p) (n:=n) (d:=Block.S) (B:=Block.Z) (by simp [Block.S,Block.Z]) s s' have h (a : SelIdx p.b p.j) (s : Label p.b) (i) := project_pick (n:=n) (p:=p) (d:=Block.sharp) (B:=Block.Z) (by simp [Block.sharp,Block.Z]) a s i rw [selfM]; simp only [map_add,map_sum,hx,hs,Finset.sum_const_zero,zero_add] unfold sharpM sharpPick pullM by_cases he : 1 ≤ p.j · simp only [map_sum,map_smul,map_add, dite_eq_left he,liftM_outer,h] simp · simp only [dite_eq_right he]; simp
theorem pull_self_sharp (M) (s s' : Label p.b) (hj : 1≤p.j) : pullM (blockRay p n s Block.sharp) (blockRay p n s' Block.sharp) (selfM p n M) = ∑ i, (s i+s' i) • M i := by classical have hx (i j : Tag p.g) := pull_test (n:=n) (d:=Block.O i j) (B:=Block.sharp) (by simp [Block.O,Block.sharp]) s s' have hs := pull_test (p:=p) (n:=n) (d:=Block.S) (B:=Block.sharp) (by simp [Block.S,Block.sharp]) s s' rw [selfM]; simp only [map_add,map_sum,hx,hs,Finset.sum_const_zero,zero_add] unfold sharpM sharpPick pullM simp only [map_sum,map_add,map_smul, dite_eq_left hj,liftM_outer,project_same] refine Finset.sum_congr rfl fun i _ => ?_ ext a b simp only [Matrix.sum_apply,Matrix.add_apply,Matrix.smul_apply,smul_eq_mul, vecMulVec_apply,monoBit,emptySel,Finset.prod_empty,Finset.prod_singleton,Pi.single_apply] rw [Finset.sum_eq_single a] · rw [Finset.sum_eq_single b] · simp; ring · intro j _ h; simp [h.symm] · simp · intro j _ h; simp [h.symm] simpend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687import OAI.Combinatorics.HadwigerCounterexample.ScalarStatusAlgebra
namespace OAI
/-! # Coordinate Duality -/
noncomputable section
namespace HadwigerCounterexample
open Finset Matrix Module LinearMap Submodule Function
open scoped BigOperators
namespace StatusAnalysis
variable {A B : Rates} {d e : ℕ}
structure DualCoefficients (A B : Rates) where
left : Quota
right : Quota
gam : Grid→F
hed : Grid→F
north : (i:Grid)→ Cell (A i.1)
south : (i:Grid)→ Cell (B i.2)
def DualCoefficients.bet (p : DualCoefficients A B) (i : Grid) (x : LedgerS A B i) :=
p.gam i * x.1 + p.hed i * x.2.1 + (dotProduct (p.north i) x.2.2.1+
dotProduct (p.south i) x.2.2.2)
def DualCoefficients.law (p : DualCoefficients A B) (V : StatusSp A B) :=
∀ i:Grid,∀ v∈V i, p.bet i (want _ _ v) =
p.left i.2 * couple _ v.2.1 + p.right i.1 * couple _ v.2.2
private theorem coordinates (f : Question d e →ₗ[F] F) :
∃ a b : F,∃ (u : Cell d) (v : Cell e),∀ (x:Question d e),
f x=a*x.1+b*x.2.1 + (dotProduct u x.2.2.1+dotProduct v x.2.2.2) := by
let g := f ∘ₗ LinearMap.inr F F _ ∘ₗ LinearMap.inr F F _
obtain ⟨u,hu⟩:=dotL_surj (g ∘ₗ LinearMap.inl F _ _)
obtain ⟨v,hv⟩:=dotL_surj (g ∘ₗ LinearMap.inr F _ _)
let a : Question d e := (1,0); let b : Question d e := (0,1,0)
refine ⟨f a,f b,u,v,?_⟩
rintro ⟨x,y,z,w⟩
have he : ((x,y,z,w):Question d e)=x • a +y • b+((0,0,z,0)+(0,0,0,w)) := by
unfold a b; ext <;> simp
have h1 : f (0,0,z,0)=dotProduct u z := LinearMap.congr_fun hu z
have h2 : f (0,0,0,w)=dotProduct v w := LinearMap.congr_fun hv w
change f (x,y,z,w)=f a*x + f b*y + _
conv_lhs => rw [he]
rw [map_add,map_add,map_add,map_smul,map_smul,h1,h2]; simp [mul_comm]
theorem jargon_score (V : StatusSp A B) (T : Cabinet A B)
(h : ¬scorecard V T) (hh : ∀ i,coverBase (V i)) :
∃ p : DualCoefficients A B, (p.left≠0 ∨ p.right≠0) ∧ p.law V ∧ ∑ i,p.bet i (T i)≠0 := by
obtain ⟨p,hp,hf⟩:= counter_score V T h
choose a b u v he using fun i=>coordinates (p.alf i)
let g : DualCoefficients A B:=⟨p.altL,p.altR,a,b,u,v⟩
have hz i x : g.bet i x=p.alf i x := (he i x).symm
refine ⟨g,critic_nz V T hh p hp hf,fun i x hx=>?_,?_⟩
· rw [hz]; exact hp i x hx
simp_rw [hz]; exact hf
abbrev excessK (V : Space (Signal d e)) := V ⊓ LinearMap.ker (view d e)
theorem signal_dim :
dim (Signal d e) = dim (View d e)+2 := by
simp only [Signal,View,Whole,dim,finrank_prod,finrank_self]
omega
theorem ker_two (V : Space (Signal d e)) :
dim (excessK V) ≤ 2 := by
have he : Surjective (view d e) := by
rintro ⟨i,j,k⟩; exact ⟨(i,(j,0),(k,0)),rfl⟩
have ht := LinearMap.finrank_range_add_finrank_ker (view d e)
change rk (view _ _) + dim _=dim (Signal d e) at ht
rw [rk_surj.mp he,signal_dim] at ht
exact (Submodule.finrank_mono (show excessK V≤_ from inf_le_right)).trans
(by omega : dim (LinearMap.ker (view d e)) ≤ 2)
def overage (V : Space (Signal d e)) := dim V - dim (View d e)
theorem overage_two (V : Space (Signal d e)) : overage V≤2 := by
have hi : dim V ≤ dim (Signal d e) := finrank_le _
rw [signal_dim] at hi; unfold overage; omega
theorem overage_mono {V W : Space (Signal d e)} (h : V≤W) :
overage V≤overage W := Nat.sub_le_sub_right (finrank_mono h) _
theorem overage_lt {V W : Space (Signal d e)} (h : V<W) (he : coverBase V) :
overage V<overage W := by
have hh := finrank_lt_finrank_of_lt h; change dim V<dim W at hh
have hx : dim (View d e) ≤ dim V := LinearMap.finrank_le_finrank_of_surjective he
unfold overage; omega
end StatusAnalysis
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.ScalarStatusAlgebra
namespace OAI
/-! # Coordinate Duality -/
noncomputable sectionnamespace HadwigerCounterexampleopen Finset Matrix Module LinearMap Submodule Functionopen scoped BigOperatorsnamespace StatusAnalysisvariable {A B : Rates} {d e : ℕ}
structure DualCoefficients (A B : Rates) where left : Quota right : Quota gam : Grid→F hed : Grid→F north : (i:Grid)→ Cell (A i.1) south : (i:Grid)→ Cell (B i.2)def DualCoefficients.bet (p : DualCoefficients A B) (i : Grid) (x : LedgerS A B i) := p.gam i * x.1 + p.hed i * x.2.1 + (dotProduct (p.north i) x.2.2.1+ dotProduct (p.south i) x.2.2.2)def DualCoefficients.law (p : DualCoefficients A B) (V : StatusSp A B) := ∀ i:Grid,∀ v∈V i, p.bet i (want _ _ v) = p.left i.2 * couple _ v.2.1 + p.right i.1 * couple _ v.2.2
private theorem coordinates (f : Question d e →ₗ[F] F) : ∃ a b : F,∃ (u : Cell d) (v : Cell e),∀ (x:Question d e), f x=a*x.1+b*x.2.1 + (dotProduct u x.2.2.1+dotProduct v x.2.2.2) := by let g := f ∘ₗ LinearMap.inr F F _ ∘ₗ LinearMap.inr F F _ obtain ⟨u,hu⟩:=dotL_surj (g ∘ₗ LinearMap.inl F _ _) obtain ⟨v,hv⟩:=dotL_surj (g ∘ₗ LinearMap.inr F _ _) let a : Question d e := (1,0); let b : Question d e := (0,1,0) refine ⟨f a,f b,u,v,?_⟩ rintro ⟨x,y,z,w⟩ have he : ((x,y,z,w):Question d e)=x • a +y • b+((0,0,z,0)+(0,0,0,w)) := by unfold a b; ext <;> simp have h1 : f (0,0,z,0)=dotProduct u z := LinearMap.congr_fun hu z have h2 : f (0,0,0,w)=dotProduct v w := LinearMap.congr_fun hv w change f (x,y,z,w)=f a*x + f b*y + _ conv_lhs => rw [he] rw [map_add,map_add,map_add,map_smul,map_smul,h1,h2]; simp [mul_comm]
theorem jargon_score (V : StatusSp A B) (T : Cabinet A B) (h : ¬scorecard V T) (hh : ∀ i,coverBase (V i)) : ∃ p : DualCoefficients A B, (p.left≠0 ∨ p.right≠0) ∧ p.law V ∧ ∑ i,p.bet i (T i)≠0 := by obtain ⟨p,hp,hf⟩:= counter_score V T h choose a b u v he using fun i=>coordinates (p.alf i) let g : DualCoefficients A B:=⟨p.altL,p.altR,a,b,u,v⟩ have hz i x : g.bet i x=p.alf i x := (he i x).symm refine ⟨g,critic_nz V T hh p hp hf,fun i x hx=>?_,?_⟩ · rw [hz]; exact hp i x hx simp_rw [hz]; exact hf
abbrev excessK (V : Space (Signal d e)) := V ⊓ LinearMap.ker (view d e)theorem signal_dim : dim (Signal d e) = dim (View d e)+2 := by simp only [Signal,View,Whole,dim,finrank_prod,finrank_self] omegatheorem ker_two (V : Space (Signal d e)) : dim (excessK V) ≤ 2 := by have he : Surjective (view d e) := by rintro ⟨i,j,k⟩; exact ⟨(i,(j,0),(k,0)),rfl⟩ have ht := LinearMap.finrank_range_add_finrank_ker (view d e) change rk (view _ _) + dim _=dim (Signal d e) at ht rw [rk_surj.mp he,signal_dim] at ht exact (Submodule.finrank_mono (show excessK V≤_ from inf_le_right)).trans (by omega : dim (LinearMap.ker (view d e)) ≤ 2)
def overage (V : Space (Signal d e)) := dim V - dim (View d e)theorem overage_two (V : Space (Signal d e)) : overage V≤2 := by have hi : dim V ≤ dim (Signal d e) := finrank_le _ rw [signal_dim] at hi; unfold overage; omegatheorem overage_mono {V W : Space (Signal d e)} (h : V≤W) : overage V≤overage W := Nat.sub_le_sub_right (finrank_mono h) _theorem overage_lt {V W : Space (Signal d e)} (h : V<W) (he : coverBase V) : overage V<overage W := by have hh := finrank_lt_finrank_of_lt h; change dim V<dim W at hh have hx : dim (View d e) ≤ dim V := LinearMap.finrank_le_finrank_of_surjective he unfold overage; omegaend StatusAnalysisend HadwigerCounterexample
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163import OAI.Combinatorics.HadwigerCounterexample.MatrixRanks
import Mathlib.Data.Matrix.ColumnRowPartitioned
namespace OAI
/-! # Coordinate Embeddings -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Module Function
open scoped BigOperators
variable {U V I J K T : Type} [Fintype U] [Fintype V] [Fintype I] [Fintype J]
[Fintype K] [Fintype T]
def embedMat [DecidableEq U] (f : I → U) : Mat U I := Matrix.of (fun i j => if i=f j then 1 else 0)
omit [Fintype I] in
theorem embedMatT [DecidableEq U] (f : I → U) (x : Vec U) :
(embedMat f)ᵀ *ᵥ x = fun i => x (f i) := by
classical funext i
simp [embedMat,Matrix.mulVec,dotProduct]
omit [Fintype V] [Fintype I] in
theorem mul_embedMat [DecidableEq U] (f : I → U) (M : Mat V U) :
M*embedMat f = M.submatrix _root_.id f := by
ext i j
simp [Matrix.mul_apply,embedMat]
omit [Fintype V] [Fintype I] in
theorem embedMat_mul [DecidableEq U] (f : I → U) (M : Mat U V) :
(embedMat f)ᵀ*M = M.submatrix f _root_.id := by
ext i j
simp [Matrix.mul_apply,embedMat]
omit [Fintype I] in
theorem embedMat_self [DecidableEq I] [DecidableEq U] {f : I → U} (h : Injective f) :
(embedMat f)ᵀ * embedMat f = 1 := by
ext i j
rw [embedMat_mul]
simp only [embedMat,Matrix.submatrix_apply,Matrix.of_apply,id_eq,
Matrix.one_apply,h.eq_iff]
theorem embedMat_inj [DecidableEq U] {f : I → U} (h : Injective f) :
Injective (embedMat f).mulVec := by
classical
intro x y g
change embedMat f *ᵥ x = embedMat f *ᵥ y at g
have he (x : Vec I) : (embedMat f)ᵀ *ᵥ (embedMat f *ᵥ x) = x := by
rw [Matrix.mulVec_mulVec,embedMat_self h,Matrix.one_mulVec]
rw [← he x,g,he]
omit [Fintype U] in
theorem inj_fromCols {A : Mat U I} {B : Mat U J} (hA : Injective A.mulVec)
(hB : Injective B.mulVec) (h : Disjoint (colSp A) (colSp B)) :
Injective (fromCols A B).mulVec := by
rw [← Matrix.coe_mulVecLin,← LinearMap.ker_eq_bot, Matrix.ker_mulVecLin_eq_bot_iff]
intro x hx
let a := fun i => x (Sum.inl i)
let b := fun j => x (Sum.inr j)
rw [fromCols_mulVec] at hx
have he : A*ᵥa=B*ᵥb := add_right_cancel (hx.trans (char_two (B*ᵥb)).symm)
have hi : A*ᵥa ∈ colSp A ⊓ colSp B :=
⟨⟨a,rfl⟩, he.symm ▸ (show B*ᵥb∈colSp B from ⟨b,rfl⟩)⟩
rw [h.eq_bot] at hi
have hg : A*ᵥa=0 := by simpa using hi
have ha : a=0 := hA (hg.trans (Matrix.mulVec_zero A).symm)
rw [he] at hg
have hb : b=0 := hB (hg.trans (Matrix.mulVec_zero B).symm)
funext i
cases i
· exact congr_fun ha _
· exact congr_fun hb _
/-- Specify an arbitrary cross Gram bilinear form between independent columns. -/
theorem prescribe_between {A : Mat U I} {B : Mat V J}
(hA : Injective A.mulVec) (hB : Injective B.mulVec) (M : Mat I J) :
∃ L : Mat U V, Aᵀ*L*B=M := by
classical
obtain ⟨a,ha⟩ := mat_left_inv hA
obtain ⟨b,hb⟩ := mat_left_inv hB
refine ⟨aᵀ*(M*b),?_⟩
rw [← Matrix.mul_assoc Aᵀ,←transpose_mul,ha,transpose_one,Matrix.one_mul,
Matrix.mul_assoc,hb,Matrix.mul_one]
/-- Two opposite-direction restrictions are specifiable on disjoint bases. -/
theorem prescribe_opposite {A : Mat U I} {B : Mat V J} {C : Mat U K} {D : Mat V T}
(hc : Injective (fromCols A C).mulVec) (hd : Injective (fromCols B D).mulVec)
(M : Mat I J) (N : Mat T K) :
∃ L : Mat U V, Aᵀ*L*B=M ∧ Dᵀ*Lᵀ*C=N := by
obtain ⟨L,hL⟩ := prescribe_between hc hd (fromBlocks M 0 0 Nᵀ)
rw [transpose_fromCols, fromRows_mul, fromRows_mul_fromCols] at hL
have hi : Cᵀ*L*D=Nᵀ := congrArg Matrix.toBlocks₂₂ hL
refine ⟨L, congrArg Matrix.toBlocks₁₁ hL, ?_⟩
have hg := congrArg Matrix.transpose hi
rwa [transpose_mul,transpose_mul,transpose_transpose,transpose_transpose,← Matrix.mul_assoc] at hg
omit [Fintype I] in
theorem rank_ge_mul (A : Mat I J) (B : Mat J K) :
A.rank+B.rank ≤ (A*B).rank+Fintype.card J := by
let f := A.mulVecLin
let g := f ∘ₗ (colSp B).subtype
have he : LinearMap.range g = colSp (A*B) := by
change LinearMap.range g = LinearMap.range ((A*B).mulVecLin)
rw [mulVecLin_mul]
unfold g
rw [LinearMap.range_comp,LinearMap.range_comp]
simp [f,colSp]
have hi : dim (LinearMap.ker g) ≤ dim (LinearMap.ker f) := by
let q := ((colSp B).subtype ∘ₗ (LinearMap.ker g).subtype)
have hq (x : LinearMap.ker g) : q x ∈ LinearMap.ker f := x.property
let k := q.codRestrict (LinearMap.ker f) hq
have hk : Injective k := by
intro x y h
have heq := congrArg (fun b : LinearMap.ker f => b.val) h
exact Subtype.ext (Subtype.ext heq)
exact LinearMap.finrank_le_finrank_of_injective hk
have h1 := g.finrank_range_add_finrank_ker
rw [he] at h1
have h2 := f.finrank_range_add_finrank_ker
change (A*B).rank + dim (LinearMap.ker g)=B.rank at h1
change A.rank + dim (LinearMap.ker f)=dim (Vec J) at h2
rw [dim_vec] at h2; omega
theorem rank_ge_congr (A : Mat I I) (B : Mat J I) :
A.rank + 2*B.rank ≤ (liftM B B A).rank + 2*Fintype.card I := by
have h1 := rank_ge_mul B A
have h2 := rank_ge_mul (B*A) Bᵀ
rw [Matrix.rank_transpose] at h2
rw [liftM_def]; omega
/-- Choose a large space in the domain which becomes disjoint from S in the target. -/
theorem choose_free {A : Mat I J} (hA : Injective A.mulVec) (S : Space (Vec I)) :
∃ T : Space (Vec J), Fintype.card J ≤ dim T+dim S ∧
Disjoint S (colSp (A*pack T)) := by
let U := S.comap A.mulVecLin
obtain ⟨T,hT⟩ := U.exists_isCompl
refine ⟨T,?_,?_⟩
· have hi : dim U ≤ dim S := by
let q := A.mulVecLin ∘ₗ U.subtype
have he (x : U) : q x∈S := x.property
let B := q.codRestrict S he
have hb : Injective B := fun x y h => Subtype.ext (hA
(show q x=q y from congrArg Subtype.val h))
exact LinearMap.finrank_le_finrank_of_injective hb
have he := (U.prodEquivOfIsCompl T hT).finrank_eq
rw [finrank_prod,show finrank F (Vec J)=Fintype.card J from dim_vec _] at he
change dim U + dim T = Fintype.card J at he
rw [← he]
exact (Nat.add_le_add_right hi _).trans_eq (Nat.add_comm _ _)
rw [colSp,mulVecLin_mul,LinearMap.range_comp,show LinearMap.range (pack T).mulVecLin = T from
colSp_pack T]
rw [disjoint_iff_inf_le]
rintro x ⟨hx,y,hy,rfl⟩
have hh : y∈U⊓T := ⟨hx,hy⟩
rw [hT.inf_eq_bot] at hh
have he : y=0 := by simpa using hh
rw [he,map_zero]; exact Submodule.zero_mem _
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.MatrixRanksimport Mathlib.Data.Matrix.ColumnRowPartitioned
namespace OAI
/-! # Coordinate Embeddings -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Module Functionopen scoped BigOperatorsvariable {U V I J K T : Type} [Fintype U] [Fintype V] [Fintype I] [Fintype J] [Fintype K] [Fintype T]
def embedMat [DecidableEq U] (f : I → U) : Mat U I := Matrix.of (fun i j => if i=f j then 1 else 0)
omit [Fintype I] intheorem embedMatT [DecidableEq U] (f : I → U) (x : Vec U) : (embedMat f)ᵀ *ᵥ x = fun i => x (f i) := by classical funext i simp [embedMat,Matrix.mulVec,dotProduct]
omit [Fintype V] [Fintype I] intheorem mul_embedMat [DecidableEq U] (f : I → U) (M : Mat V U) : M*embedMat f = M.submatrix _root_.id f := by ext i j simp [Matrix.mul_apply,embedMat]
omit [Fintype V] [Fintype I] intheorem embedMat_mul [DecidableEq U] (f : I → U) (M : Mat U V) : (embedMat f)ᵀ*M = M.submatrix f _root_.id := by ext i j simp [Matrix.mul_apply,embedMat]
omit [Fintype I] intheorem embedMat_self [DecidableEq I] [DecidableEq U] {f : I → U} (h : Injective f) : (embedMat f)ᵀ * embedMat f = 1 := by ext i j rw [embedMat_mul] simp only [embedMat,Matrix.submatrix_apply,Matrix.of_apply,id_eq, Matrix.one_apply,h.eq_iff]
theorem embedMat_inj [DecidableEq U] {f : I → U} (h : Injective f) : Injective (embedMat f).mulVec := by classical intro x y g change embedMat f *ᵥ x = embedMat f *ᵥ y at g have he (x : Vec I) : (embedMat f)ᵀ *ᵥ (embedMat f *ᵥ x) = x := by rw [Matrix.mulVec_mulVec,embedMat_self h,Matrix.one_mulVec] rw [← he x,g,he]
omit [Fintype U] intheorem inj_fromCols {A : Mat U I} {B : Mat U J} (hA : Injective A.mulVec) (hB : Injective B.mulVec) (h : Disjoint (colSp A) (colSp B)) : Injective (fromCols A B).mulVec := by rw [← Matrix.coe_mulVecLin,← LinearMap.ker_eq_bot, Matrix.ker_mulVecLin_eq_bot_iff] intro x hx let a := fun i => x (Sum.inl i) let b := fun j => x (Sum.inr j) rw [fromCols_mulVec] at hx have he : A*ᵥa=B*ᵥb := add_right_cancel (hx.trans (char_two (B*ᵥb)).symm) have hi : A*ᵥa ∈ colSp A ⊓ colSp B := ⟨⟨a,rfl⟩, he.symm ▸ (show B*ᵥb∈colSp B from ⟨b,rfl⟩)⟩ rw [h.eq_bot] at hi have hg : A*ᵥa=0 := by simpa using hi have ha : a=0 := hA (hg.trans (Matrix.mulVec_zero A).symm) rw [he] at hg have hb : b=0 := hB (hg.trans (Matrix.mulVec_zero B).symm) funext i cases i · exact congr_fun ha _ · exact congr_fun hb _
/-- Specify an arbitrary cross Gram bilinear form between independent columns. -/theorem prescribe_between {A : Mat U I} {B : Mat V J} (hA : Injective A.mulVec) (hB : Injective B.mulVec) (M : Mat I J) : ∃ L : Mat U V, Aᵀ*L*B=M := by classical obtain ⟨a,ha⟩ := mat_left_inv hA obtain ⟨b,hb⟩ := mat_left_inv hB refine ⟨aᵀ*(M*b),?_⟩ rw [← Matrix.mul_assoc Aᵀ,←transpose_mul,ha,transpose_one,Matrix.one_mul, Matrix.mul_assoc,hb,Matrix.mul_one]
/-- Two opposite-direction restrictions are specifiable on disjoint bases. -/theorem prescribe_opposite {A : Mat U I} {B : Mat V J} {C : Mat U K} {D : Mat V T} (hc : Injective (fromCols A C).mulVec) (hd : Injective (fromCols B D).mulVec) (M : Mat I J) (N : Mat T K) : ∃ L : Mat U V, Aᵀ*L*B=M ∧ Dᵀ*Lᵀ*C=N := by obtain ⟨L,hL⟩ := prescribe_between hc hd (fromBlocks M 0 0 Nᵀ) rw [transpose_fromCols, fromRows_mul, fromRows_mul_fromCols] at hL have hi : Cᵀ*L*D=Nᵀ := congrArg Matrix.toBlocks₂₂ hL refine ⟨L, congrArg Matrix.toBlocks₁₁ hL, ?_⟩ have hg := congrArg Matrix.transpose hi rwa [transpose_mul,transpose_mul,transpose_transpose,transpose_transpose,← Matrix.mul_assoc] at hg
omit [Fintype I] intheorem rank_ge_mul (A : Mat I J) (B : Mat J K) : A.rank+B.rank ≤ (A*B).rank+Fintype.card J := by let f := A.mulVecLin let g := f ∘ₗ (colSp B).subtype have he : LinearMap.range g = colSp (A*B) := by change LinearMap.range g = LinearMap.range ((A*B).mulVecLin) rw [mulVecLin_mul] unfold g rw [LinearMap.range_comp,LinearMap.range_comp] simp [f,colSp] have hi : dim (LinearMap.ker g) ≤ dim (LinearMap.ker f) := by let q := ((colSp B).subtype ∘ₗ (LinearMap.ker g).subtype) have hq (x : LinearMap.ker g) : q x ∈ LinearMap.ker f := x.property let k := q.codRestrict (LinearMap.ker f) hq have hk : Injective k := by intro x y h have heq := congrArg (fun b : LinearMap.ker f => b.val) h exact Subtype.ext (Subtype.ext heq) exact LinearMap.finrank_le_finrank_of_injective hk have h1 := g.finrank_range_add_finrank_ker rw [he] at h1 have h2 := f.finrank_range_add_finrank_ker change (A*B).rank + dim (LinearMap.ker g)=B.rank at h1 change A.rank + dim (LinearMap.ker f)=dim (Vec J) at h2 rw [dim_vec] at h2; omega
theorem rank_ge_congr (A : Mat I I) (B : Mat J I) : A.rank + 2*B.rank ≤ (liftM B B A).rank + 2*Fintype.card I := by have h1 := rank_ge_mul B A have h2 := rank_ge_mul (B*A) Bᵀ rw [Matrix.rank_transpose] at h2 rw [liftM_def]; omega
/-- Choose a large space in the domain which becomes disjoint from S in the target. -/theorem choose_free {A : Mat I J} (hA : Injective A.mulVec) (S : Space (Vec I)) : ∃ T : Space (Vec J), Fintype.card J ≤ dim T+dim S ∧ Disjoint S (colSp (A*pack T)) := by let U := S.comap A.mulVecLin obtain ⟨T,hT⟩ := U.exists_isCompl refine ⟨T,?_,?_⟩ · have hi : dim U ≤ dim S := by let q := A.mulVecLin ∘ₗ U.subtype have he (x : U) : q x∈S := x.property let B := q.codRestrict S he have hb : Injective B := fun x y h => Subtype.ext (hA (show q x=q y from congrArg Subtype.val h)) exact LinearMap.finrank_le_finrank_of_injective hb have he := (U.prodEquivOfIsCompl T hT).finrank_eq rw [finrank_prod,show finrank F (Vec J)=Fintype.card J from dim_vec _] at he change dim U + dim T = Fintype.card J at he rw [← he] exact (Nat.add_le_add_right hi _).trans_eq (Nat.add_comm _ _) rw [colSp,mulVecLin_mul,LinearMap.range_comp,show LinearMap.range (pack T).mulVecLin = T from colSp_pack T] rw [disjoint_iff_inf_le] rintro x ⟨hx,y,hy,rfl⟩ have hh : y∈U⊓T := ⟨hx,hy⟩ rw [hT.inf_eq_bot] at hh have he : y=0 := by simpa using hh rw [he,map_zero]; exact Submodule.zero_mem _
end HadwigerCounterexample
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485861234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586import OAI.Combinatorics.HadwigerCounterexample.PhaseClassCompatibility
import OAI.Combinatorics.HadwigerCounterexample.LowRankKernelAlternative
namespace OAI
/-! # Cover Alternatives -/
noncomputable section
namespace HadwigerCounterexample
open Matrix Finset Filter
open scoped BigOperators Topology
open PredictionClass
variable {p : Shape} {n N M : ℕ}
theorem longStory (T : Cov p N) (d : ℕ) (hd : cdim p T≤d)
(c : PredictionClass) (α : Party) (r : F) (Δ : UnitType p n N → Ambient p N)
(w : Wgt (UnitType p n N)) (hh : ∀ x,w x≠ 0 → covered p T (Δ x)) :
∃ P : UnitType p n N×UnitType p n N→Prop,named P (bp (3*d*(N:ℝ))) ∧
named (P ∘ Prod.swap) (bp (3*d*(N:ℝ))) ∧
∀ x,pairW w w x≠0→ (P x↔ matchUp Δ α r c x) := by
classical
let Q (x : Daypair p T×Daypair p T) : Prop :=
c.compatible α r (fun i=>x.2.2 i x.1.1, fun i => x.1.2 i x.2.1)
let f := daypair p T Δ w
refine ⟨fun x=>Q (f x.1,f x.2),day_named p T Δ w d hd Q,day_named p T Δ w d hd (Q∘Prod.swap),
fun x hx=>?_⟩
have hs (x y : UnitType p n N) (hz : w x≠0) (i) :
(f y).2 i (f x).1=tone p y (unary i) (Δ x) :=
shadow_valid p T Δ hh x y (unary i) hz
unfold Q matchUp quench
dsimp only
simp_rw [hs _ _ (left_ne_zero_of_mul hx), hs _ _ (right_ne_zero_of_mul hx)]
theorem matSeason (T : Cov p N) (d : ℕ) (hd : cdim p T≤d)
(α : Party) (r : F) (Δ : UnitType p n N → Ambient p N)
(w : Wgt (UnitType p n N)) (hh : ∀ x,w x≠ 0 → covered p T (Δ x)) :
∃ F : Mat (UnitType p n N) (UnitType p n N), F.rank ≤ 2*d*N ∧
(∀ x, F x x=0) ∧ ∀ x,pairW w w x≠0→ (F x.1 x.2=0 ↔ matchUp Δ α r twinned x) := by
let F := circus p T Δ w
have he : F.rank ≤ N*d := (circus_rank ..).trans (Nat.mul_le_mul_left _ hd)
refine ⟨F+Fᵀ, (mrk_add_le F Fᵀ).trans ?_,fun x=>char_two _,fun x hx=>?_⟩
· rw [Matrix.rank_transpose]; nlinarith
· unfold matchUp compatible quench
dsimp only; rw [←tone_vec,←tone_vec]
have h x y (hx : w x ≠ 0) : F x y = tone p y allSide (Δ x) :=
shadow_valid p T Δ hh x y allSide hx
change (F x.1 x.2+F x.2 x.1=0) ↔ _
rw [h _ _ (left_ne_zero_of_mul hx),h _ _ (right_ne_zero_of_mul hx)]
set_option maxHeartbeats 1000000 in
theorem coFiber (l : Filter ℕ) (hz : l≤atTop) {M : ℕ} (hM : 1≤ M) (d : ℕ)
(p : Shape) (w : ∀ n,Wgt (UnitType p n (M*n)))
(α : Party) (r : F) (Δ : ∀ n, UnitType p n (M*n) → Ambient p (M*n))
(h : ∀ᶠ n in l, IsLaw (w n) ∧
∃ T : Cov p (M*n),cdim p T≤d∧∀ x,w n x≠0 → covered p T (Δ n x))
(he : slight l (fun n=>pr (pairW (w n) (w n)) (matchUp (Δ n) α r twinned))) :
∃ S : ∀ n, UnitType p n (M*n)→Prop,warm l (fun n=>((M*n:ℕ):ℝ)) (fun n=>pr (w n) (S n)) ∧
∀ᶠ n in l, ∀ x,S n x.1 → S n x.2 → matchUp (Δ n) α r twinned x := by
classical
let X n:= UnitType p n (M*n)
let q n:= matchUp (Δ n) α r twinned
let c (k : ℕ) := ((k:ℝ)+1)⁻¹
let P n (S : X n→Prop) (k : ℕ) :=
bp (-(c k)*((M*n:ℕ):ℝ)) ≤ pr (w n) S ∧ ∀ x,S x.1 → S x.2 → q n x
have hf (k : ℕ) : ∀ᶠ n in l,∃ S : X n→Prop,P n S k := by
obtain ⟨θ,hθ,hg⟩:= fiber_growth (2*d) (c k) (by unfold c; positivity) (by positivity)
filter_upwards [h,he θ hθ, (trend_sizes l hz hM).1.eventually hg] with n hn hh hF
obtain ⟨hv,T,hT,h⟩:=hn
obtain ⟨F,hf,hz,hc⟩:= matSeason T d hT α r (Δ n) (w n) h
have ht : pr (pairW (w n) (w n)) (fun x => F x.1 x.2=0) ≤ θ :=
(avg_congr (fun x hx => show ind _=ind _ from congrArg ind (propext (hc x hx)))).trans_le hh
have hr : (F.rank:ℝ)≤ 2*d*(M*n:ℕ) := by exact_mod_cast hf
obtain ⟨S,hS,ht⟩:= hF (X n) F (w n) hv hr hz ht
let Y (x:X n) := S x∧ w n x≠0
have he : pr (w n) Y=pr (w n) S := avg_congr (fun x hx=>by simp [Y, hx])
refine ⟨Y, hS.trans_eq he.symm, fun x hx hy =>
(hc x (mul_ne_zero hx.2 hy.2)).mp (ht x.1 hx.1 x.2 hy.1)⟩
obtain ⟨k,hk,hf⟩:= diagonal_gains l hz (fun n k => ∃ S : X n→Prop,P n S k) hf
obtain ⟨S,h⟩:= taking hf
refine ⟨S,fun ε he=>?_, h.mono fun i hi=>hi.2⟩
filter_upwards [h,slight_inv_stage hk ε he] with n hn hh
exact (bp_le (mul_le_mul_of_nonneg_right (neg_le_neg hh) (Nat.cast_nonneg _))).trans hn.1
end HadwigerCounterexample
end
end OAIimport OAI.Combinatorics.HadwigerCounterexample.PhaseClassCompatibilityimport OAI.Combinatorics.HadwigerCounterexample.LowRankKernelAlternative
namespace OAI
/-! # Cover Alternatives -/
noncomputable sectionnamespace HadwigerCounterexampleopen Matrix Finset Filteropen scoped BigOperators Topologyopen PredictionClassvariable {p : Shape} {n N M : ℕ}theorem longStory (T : Cov p N) (d : ℕ) (hd : cdim p T≤d) (c : PredictionClass) (α : Party) (r : F) (Δ : UnitType p n N → Ambient p N) (w : Wgt (UnitType p n N)) (hh : ∀ x,w x≠ 0 → covered p T (Δ x)) : ∃ P : UnitType p n N×UnitType p n N→Prop,named P (bp (3*d*(N:ℝ))) ∧ named (P ∘ Prod.swap) (bp (3*d*(N:ℝ))) ∧ ∀ x,pairW w w x≠0→ (P x↔ matchUp Δ α r c x) := by classical let Q (x : Daypair p T×Daypair p T) : Prop := c.compatible α r (fun i=>x.2.2 i x.1.1, fun i => x.1.2 i x.2.1) let f := daypair p T Δ w refine ⟨fun x=>Q (f x.1,f x.2),day_named p T Δ w d hd Q,day_named p T Δ w d hd (Q∘Prod.swap), fun x hx=>?_⟩ have hs (x y : UnitType p n N) (hz : w x≠0) (i) : (f y).2 i (f x).1=tone p y (unary i) (Δ x) := shadow_valid p T Δ hh x y (unary i) hz unfold Q matchUp quench dsimp only simp_rw [hs _ _ (left_ne_zero_of_mul hx), hs _ _ (right_ne_zero_of_mul hx)]
theorem matSeason (T : Cov p N) (d : ℕ) (hd : cdim p T≤d) (α : Party) (r : F) (Δ : UnitType p n N → Ambient p N) (w : Wgt (UnitType p n N)) (hh : ∀ x,w x≠ 0 → covered p T (Δ x)) : ∃ F : Mat (UnitType p n N) (UnitType p n N), F.rank ≤ 2*d*N ∧ (∀ x, F x x=0) ∧ ∀ x,pairW w w x≠0→ (F x.1 x.2=0 ↔ matchUp Δ α r twinned x) := by let F := circus p T Δ w have he : F.rank ≤ N*d := (circus_rank ..).trans (Nat.mul_le_mul_left _ hd) refine ⟨F+Fᵀ, (mrk_add_le F Fᵀ).trans ?_,fun x=>char_two _,fun x hx=>?_⟩ · rw [Matrix.rank_transpose]; nlinarith · unfold matchUp compatible quench dsimp only; rw [←tone_vec,←tone_vec] have h x y (hx : w x ≠ 0) : F x y = tone p y allSide (Δ x) := shadow_valid p T Δ hh x y allSide hx change (F x.1 x.2+F x.2 x.1=0) ↔ _ rw [h _ _ (left_ne_zero_of_mul hx),h _ _ (right_ne_zero_of_mul hx)]
set_option maxHeartbeats 1000000 intheorem coFiber (l : Filter ℕ) (hz : l≤atTop) {M : ℕ} (hM : 1≤ M) (d : ℕ) (p : Shape) (w : ∀ n,Wgt (UnitType p n (M*n))) (α : Party) (r : F) (Δ : ∀ n, UnitType p n (M*n) → Ambient p (M*n)) (h : ∀ᶠ n in l, IsLaw (w n) ∧ ∃ T : Cov p (M*n),cdim p T≤d∧∀ x,w n x≠0 → covered p T (Δ n x)) (he : slight l (fun n=>pr (pairW (w n) (w n)) (matchUp (Δ n) α r twinned))) : ∃ S : ∀ n, UnitType p n (M*n)→Prop,warm l (fun n=>((M*n:ℕ):ℝ)) (fun n=>pr (w n) (S n)) ∧ ∀ᶠ n in l, ∀ x,S n x.1 → S n x.2 → matchUp (Δ n) α r twinned x := by classical let X n:= UnitType p n (M*n) let q n:= matchUp (Δ n) α r twinned let c (k : ℕ) := ((k:ℝ)+1)⁻¹ let P n (S : X n→Prop) (k : ℕ) := bp (-(c k)*((M*n:ℕ):ℝ)) ≤ pr (w n) S ∧ ∀ x,S x.1 → S x.2 → q n x have hf (k : ℕ) : ∀ᶠ n in l,∃ S : X n→Prop,P n S k := by obtain ⟨θ,hθ,hg⟩:= fiber_growth (2*d) (c k) (by unfold c; positivity) (by positivity) filter_upwards [h,he θ hθ, (trend_sizes l hz hM).1.eventually hg] with n hn hh hF obtain ⟨hv,T,hT,h⟩:=hn obtain ⟨F,hf,hz,hc⟩:= matSeason T d hT α r (Δ n) (w n) h have ht : pr (pairW (w n) (w n)) (fun x => F x.1 x.2=0) ≤ θ := (avg_congr (fun x hx => show ind _=ind _ from congrArg ind (propext (hc x hx)))).trans_le hh have hr : (F.rank:ℝ)≤ 2*d*(M*n:ℕ) := by exact_mod_cast hf obtain ⟨S,hS,ht⟩:= hF (X n) F (w n) hv hr hz ht let Y (x:X n) := S x∧ w n x≠0 have he : pr (w n) Y=pr (w n) S := avg_congr (fun x hx=>by simp [Y, hx]) refine ⟨Y, hS.trans_eq he.symm, fun x hx hy => (hc x (mul_ne_zero hx.2 hy.2)).mp (ht x.1 hx.1 x.2 hy.1)⟩ obtain ⟨k,hk,hf⟩:= diagonal_gains l hz (fun n k => ∃ S : X n→Prop,P n S k) hf obtain ⟨S,h⟩:= taking hf refine ⟨S,fun ε he=>?_, h.mono fun i hi=>hi.2⟩ filter_upwards [h,slight_inv_stage hk ε he] with n hn hh exact (bp_le (mul_le_mul_of_nonneg_right (neg_le_neg hh) (Nat.cast_nonneg _))).trans hn.1end HadwigerCounterexample
end
end OAIlean/OAI/Combinatorics/HadwigerCounterexample/AdaptiveProjectionBounds.lean+124-124
lean/OAI/Combinatorics/HadwigerCounterexample/AdaptiveRecordBounds.lean+102-102
lean/OAI/Combinatorics/HadwigerCounterexample/AdditionalProbeBounds.lean+171-171
lean/OAI/Combinatorics/HadwigerCounterexample/AffineFrames.lean+195-195
lean/OAI/Combinatorics/HadwigerCounterexample/AggregateCostBounds.lean+124-124
lean/OAI/Combinatorics/HadwigerCounterexample/AmbientBatchSlots.lean+211-211
lean/OAI/Combinatorics/HadwigerCounterexample/AnalyticParameters.lean+143-143
lean/OAI/Combinatorics/HadwigerCounterexample/AtomFlavors.lean+148-148
lean/OAI/Combinatorics/HadwigerCounterexample/AttackCutDecomposition.lean+277-277
lean/OAI/Combinatorics/HadwigerCounterexample/BaselineExtension.lean+124-124
lean/OAI/Combinatorics/HadwigerCounterexample/BaselineForms.lean+147-147
lean/OAI/Combinatorics/HadwigerCounterexample/BasisConditioning.lean+113-113
lean/OAI/Combinatorics/HadwigerCounterexample/BatchCharacters.lean+153-153
lean/OAI/Combinatorics/HadwigerCounterexample/BiasedRotationBounds.lean+142-142
lean/OAI/Combinatorics/HadwigerCounterexample/BilinearBlockCorrelation.lean+107-107
lean/OAI/Combinatorics/HadwigerCounterexample/BilinearCompression.lean+126-126
lean/OAI/Combinatorics/HadwigerCounterexample/BinaryEvaluationForms.lean+174-174
lean/OAI/Combinatorics/HadwigerCounterexample/BinaryMatrices.lean+125-125
lean/OAI/Combinatorics/HadwigerCounterexample/BinaryMixingBounds.lean+106-106
lean/OAI/Combinatorics/HadwigerCounterexample/BinaryPrescriptions.lean+265-265
lean/OAI/Combinatorics/HadwigerCounterexample/BinaryStatusComparison.lean+143-143
lean/OAI/Combinatorics/HadwigerCounterexample/BooleanLabels.lean+151-151
lean/OAI/Combinatorics/HadwigerCounterexample/BoundedQueryTemplates.lean+134-134
lean/OAI/Combinatorics/HadwigerCounterexample/CellPositivityScales.lean+177-177
lean/OAI/Combinatorics/HadwigerCounterexample/CellPruning.lean+128-128
lean/OAI/Combinatorics/HadwigerCounterexample/ChannelFactorization.lean+144-144
lean/OAI/Combinatorics/HadwigerCounterexample/ChannelFrameLaws.lean+186-186
lean/OAI/Combinatorics/HadwigerCounterexample/CollisionInequality.lean+204-204
lean/OAI/Combinatorics/HadwigerCounterexample/CommonPartitionRefinement.lean+79-79
lean/OAI/Combinatorics/HadwigerCounterexample/CommonPartitions.lean+119-119
lean/OAI/Combinatorics/HadwigerCounterexample/CommonPredictions.lean+112-112
lean/OAI/Combinatorics/HadwigerCounterexample/CompatibleOptionRealization.lean+130-130
lean/OAI/Combinatorics/HadwigerCounterexample/CompatiblePairTests.lean+105-105
lean/OAI/Combinatorics/HadwigerCounterexample/CompatibleTableEvents.lean+149-149
lean/OAI/Combinatorics/HadwigerCounterexample/ComponentIndices.lean+115-115
lean/OAI/Combinatorics/HadwigerCounterexample/ConcentrationScales.lean+169-169
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalCellEntropy.lean+156-156
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalFlags.lean+107-107
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalFourCorners.lean+101-101
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalLargeSetHits.lean+106-106
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalProductLaws.lean+125-125
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalProjection.lean+96-96
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionalSignaturePositivity.lean+110-110
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionedBatchLaws.lean+198-198
lean/OAI/Combinatorics/HadwigerCounterexample/ConditionedCorrelations.lean+97-97
lean/OAI/Combinatorics/HadwigerCounterexample/ConstructionScales.lean+100-100
lean/OAI/Combinatorics/HadwigerCounterexample/CoordinateBlocks.lean+147-147
lean/OAI/Combinatorics/HadwigerCounterexample/CoordinateDuality.lean+87-87
lean/OAI/Combinatorics/HadwigerCounterexample/CoordinateEmbeddings.lean+163-163
lean/OAI/Combinatorics/HadwigerCounterexample/CoverAlternatives.lean+86-86