lemmamem_pointedSet {x a : A} (h : a ≠ x) {k : ℕ} (H : FixedSets (Away x) k) :
a ∈ pointedSet x H↔ (⟨a,h⟩ : Away x) ∈H.val :=by
proof · 7
lines
simp only [pointedSet, Finset.mem_insert, h, false_or, Finset.mem_map]
constructor
· rintro ⟨b,hb,he⟩
have : b=⟨a,h⟩ :=Subtype.ext he
simpa [this] using hb
· intro ha
exact ⟨⟨a,h⟩,ha,rfl⟩
lemmapointedSet_card (x : A) {k : ℕ} (H : FixedSets (Away x) k) :
(pointedSet x H).card = k+1:=by
proof · 5
lines
havehx : x ∉H.val.map ⟨Subtype.val, Subtype.val_injective⟩ :=by
simp only [Finset.mem_map, not_exists, not_and]
intro a _ h
exact a.property h
simp [pointedSet, hx, H.property]
lemmaexpect_coordinate {B : ι →Type*} [∀ i, Fintype (B i)] [∀ i, Nonempty (B i)]
(i : ι) (f : B i →ℝ) : (𝔼 x : ∀ j, B j, f (x i)) = 𝔼 b, f b :=by
proof · 6
lines
calc
_ = 𝔼 p : B i × (∀j : {j // j ≠ i}, B j), f p.1:=by
apply Fintype.expect_equiv (Equiv.piSplitAt i B)
intro x
rfl
_ = _ :=by rw [expect_pair]; simp
lemmaother_point_probability {x u : ι →A} (hu : u ≠ x) {k : ℕ}
(hk : k ≤Fintype.card A-1) :
(𝔼 H : PointedBox x k, ifInBoxH u then (1:ℝ) else0) ≤
(k:ℝ)/(Fintype.card A-1) :=by
proof · 13
lines
classical
have (i : ι) : Nonempty (FixedSets (Away (x i)) k) :=
fixedSets_nonempty (by simpa [card_away] using hk)
obtain ⟨i,hi⟩ :=Function.ne_iff.mp hu
calc
_ ≤ 𝔼 H : PointedBox x k, if u i ∈ pointedSet (x i) (H i) then (1:ℝ) else0:=by
apply Finset.expect_le_expect
intro H _
by_cases h : InBoxH u
· simp [h, h i]
· simp only [h, ite_false]; positivity
_ = _ :=by
rw [expect_coordinate (B:=fun i =>FixedSets (Away (x i)) k) i (funH : FixedSets (Away (x i)) k =>if u i ∈ pointedSet (x i) Hthen (1:ℝ) else0), pointed_membership hi hk]
lemmaexists_indicator_le {T : Type*} (s : FinsetT) (p : T→Prop) :
(if∃ t ∈ s, p t then (1:ℝ) else0) ≤∑ t ∈ s, if p t then1else0:=by
proof · 8
lines
classical
by_cases h : ∃ t ∈ s, p t
· obtain ⟨t,ht,hp⟩ := h
have hb :=Finset.single_le_sum (s := s) (f :=fun t =>if p t then (1:ℝ) else0)
(fun _ _ =>by positivity) ht
simpa [hp, show∃ t ∈ s, p t from ⟨t,ht,hp⟩] using hb
· simp only [h, ite_false]
exact Finset.sum_nonneg (fun _ _ =>by positivity)
lemmaremoval_probability [NonemptyA] {x : ι →A} {k : ℕ} (hk : k ≤Fintype.card A-1)
(P : Finset (ι →A)) (S : Finset (Row ι A)) :
(𝔼 H : PointedBox x k, ifRemovedHPSthen (1:ℝ) else0) ≤
(P.card+S.card)*((k:ℝ)/(Fintype.card A-1)) :=by
proof · 48
lines
classical
have (j : ι) : Nonempty (FixedSets (Away (x j)) k) :=
fixedSets_nonempty (by simpa [card_away] using hk)
havehprob : 0≤ (k:ℝ)/(Fintype.card A-1) :=byhavehc : 1≤Fintype.card A:=Fintype.card_pos
exact div_nonneg (Nat.cast_nonneg _) (sub_nonneg.mpr (by exact_mod_cast hc))
have hp (u : ι →A) :
(𝔼 H : PointedBox x k, if u ≠ x ∧InBoxH u then (1:ℝ) else0) ≤
(k:ℝ)/(Fintype.card A-1) :=byby_cases hu : u=x
· simp [hu]; exact hprob
· simpa only [ne_eq, hu, not_false_eq_true, true_and] using other_point_probability hu hk
have hs (r : Row ι A) :
(𝔼 H : PointedBox x k, if r.2≠ (fun j => x j.val) ∧FaceInBoxH r.1 r.2then (1:ℝ) else0) ≤
(k:ℝ)/(Fintype.card A-1) :=byby_cases hr : r.2=(fun j => x j.val)
· simp [hr]; exact hprob
· simpa only [ne_eq, hr, not_false_eq_true, true_and] using other_face_probability r.1 r.2 hr hk
calc
_ ≤ (𝔼 H : PointedBox x k,
((∑ u ∈P, if u ≠ x ∧InBoxH u then (1:ℝ) else0) +
(∑ r ∈S, if r.2≠ (fun j => x j.val) ∧FaceInBoxH r.1 r.2then (1:ℝ) else0))) :=by
apply Finset.expect_le_expect
intro H _
havehp0 : 0≤∑ u ∈P, if u ≠ x ∧InBoxH u then (1:ℝ) else0:=Finset.sum_nonneg (fun _ _ =>by positivity)
havehs0 : 0≤∑ r ∈S, if r.2≠ (fun j => x j.val) ∧FaceInBoxH r.1 r.2then (1:ℝ) else0:=Finset.sum_nonneg (fun _ _ =>by positivity)
by_cases hh : RemovedHPS
· rw [ite_eq_left hh]
rcases hh with ⟨u,hu,hux,huH⟩ | ⟨r,hr,hrx,hrH⟩
· have h :=Finset.single_le_sum (s :=P)
(f :=fun u =>if u ≠ x ∧InBoxH u then (1:ℝ) else0) (fun _ _ =>by positivity) hu
rw [ite_eq_left ⟨hux,huH⟩] at h
exact h.trans (le_add_of_nonneg_right hs0)
· have h :=Finset.single_le_sum (s :=S)
(f :=fun r =>if r.2≠ (fun j => x j.val) ∧FaceInBoxH r.1 r.2then (1:ℝ) else0) (fun _ _ =>by positivity) hr
rw [ite_eq_left ⟨hrx,hrH⟩] at h
exact h.trans (le_add_of_nonneg_left hp0)
· rw [ite_eq_right hh]
exact add_nonneg hp0 hs0
_ = (∑ u ∈P, 𝔼 H : PointedBox x k, if u ≠ x ∧InBoxH u then (1:ℝ) else0) +
(∑ r ∈S, 𝔼 H : PointedBox x k, if r.2≠ (fun j => x j.val) ∧FaceInBoxH r.1 r.2then (1:ℝ) else0) :=by
rw [Finset.expect_add_distrib, Finset.expect_sum_comm, Finset.expect_sum_comm]
_ ≤ (∑ _u ∈P, (k:ℝ)/(Fintype.card A-1)) +
(∑ _r ∈S, (k:ℝ)/(Fintype.card A-1)) :=
add_le_add (Finset.sum_le_sum (fun u _ => hp u)) (Finset.sum_le_sum (fun r _ => hs r))
_ = _ :=by simp; ring
lemmapositiveSupport_card (I : (ι →A) →ℕ) : (positiveSupport I).card ≤∑ u, I u :=by
proof · 4
lines
calc
_ = ∑ u ∈ positiveSupport I, 1:=by simp
_ ≤∑ u ∈ positiveSupport I, I u :=Finset.sum_le_sum (fun u hu => (Finset.mem_filter.mp hu).2)
_ ≤∑ u, I u :=Finset.sum_le_univ_sum_of_nonneg (fun _ =>Nat.zero_le _)
lemmalocalized_energy_contraction (x : ι →A) {k : ℕ} (hk : k ≤Fintype.card A-1)
(J : Finset (Finset (Row ι A) × ((ι →A) →ℕ)))
(u : (Row ι A→W) → ((ι →A) →ℝ) →ℝ) (hu : ∀B, MemLp (u B) 2 (γpi (ι →A))) :
(𝔼 H : PointedBox x k, jointEnergy (selectedProject (localizedSelection x HJ) u)) ≤ jointEnergy u :=by
proof · 3
lines
have (i : ι) : Nonempty (OuterSmoothness.FixedSets (Away (x i)) k) :=OuterSmoothness.fixedSets_nonempty (by simpa [card_away] using hk)
exact selectedProject_average_contraction _ u hu
lemmadual_local_sum (F : FinsetR) (r s : R) (hrs : r ≠ s) (hr : r ∈F) (hs : s ∈F)
(α : Module.DualF₂ (R→W)) (hm : frequency α r=frequency α s)
(hz : ∀ t ∈F, t ≠ r → t ≠ s → frequency α t=0) (BC : R→W)
(hBC : ∀ t ∉F, B t=C t) :
α B = α (zeroFree FC)+frequency α r (B r+B s) :=by
proof · 16
lines
have he (t : R) : frequency α t (B t) = frequency α t (zeroFree FC t)+
(if t=r then frequency α r (B r) else0)+(if t=s then frequency α s (B s) else0) :=byby_cases htr : t=r
· subst t; simp [zeroFree, hr, hrs]
by_cases hts : t=s
· subst t; simp [zeroFree, hs, hrs.symm]
by_cases htF : t∈F
· simp [hz t htF htr hts, htr, hts]
· simp [zeroFree, htF, htr, hts, hBC t htF]
calc
α B = ∑ t, (frequency α t (zeroFree FC t)+
(if t=r then frequency α r (B r) else0)+(if t=s then frequency α s (B s) else0)) :=by
rw [dual_apply]; exact Finset.sum_congr rfl (fun t _ => he t)
_ = α (zeroFree FC)+frequency α r (B r)+frequency α s (B s) :=by
simp [Finset.sum_add_distrib, ← dual_apply]
_ = _ :=by rw [map_add, hm]; abel
lemmacharacter_local_sum (F : FinsetR) (r s : R) (hrs : r ≠ s) (hr : r ∈F) (hs : s ∈F)
(α : Module.DualF₂ (R→W)) (hm : frequency α r=frequency α s)
(hz : ∀ t ∈F, t ≠ r → t ≠ s → frequency α t=0) (BC : R→W)
(hBC : ∀ t ∉F, B t=C t) :
character α B = character α (zeroFree FC)*character (frequency α r) (B r+B s) :=by
proof · 1
line
simp only [character, dual_local_sum F r s hrs hr hs α hm hz BC hBC, sign_add]
lemmalocalSlice_odd (J : Finset (FinsetR× (ι →ℕ)))
(u : (R→W) → (ι →ℝ) →ℝ) (F : FinsetR) (r : R) (e : W)
(ho : ∀ j ∈J, ∀α : Module.DualF₂ (R→W), mask α=j.1→
coefficient (funB=> coeff (u B) j.2) α ≠0→ frequency α r e=1)
(C : R→W) (c : ι →ℝ) (b : W) :
localSlice J u F r C c (b+e) = -localSlice J u F r C c b :=by
proof · 18
lines
unfold localSlice selectedProject
rw [←Finset.sum_neg_distrib]
apply Finset.sum_congr rfl
intro j hj
simp only [maskHermite_eq, maskProject_expansion]
rw [← mul_neg, ←Finset.sum_neg_distrib]
congr 1
apply Finset.sum_congr rfl
intro α hα
by_cases hmask : mask α=j.1
swap
· simp [hmask]
rw [ite_eq_left hmask, ite_eq_left hmask]
by_cases hc : coefficient (funB=> coeff (u B) j.2) α=0
· simp [hc]
havehe : character (frequency α r) e = -1:=by simp [character,ho j hj α hmask hc]
simp only [character_add, character_single, he]
ring
lemmaodd_coefficient_zero (v : W→ℝ) (e : W) (hv : ∀ b, v (b+e) = -v b)
(α : Module.DualF₂W) (hα : α e≠1) : coefficient v α=0:=by
proof · 9
lines
havehz : α e=0:=byhavehh : ∀a : F₂, a=0∨ a=1:=by decide
exact (hh (α e)).resolve_right hα
have ht := coefficient_translate v α e
havehh : (fun b => v (e+b)) = fun b => -v b :=by funext b; rw [add_comm, hv]
rw [hh] at ht
simp only [coefficient, neg_mul, Finset.expect_neg_distrib, character, hz, BinaryFourier.sign_zero, one_mul] at ht
change -coefficient v α=coefficient v α at ht
linarith
lemmalocalSlice_fourier (J : Finset (FinsetR× (ι →ℕ)))
(u : (R→W) → (ι →ℝ) →ℝ) (F : FinsetR) (r : R) (e : W)
(ho : ∀ j ∈J, ∀α : Module.DualF₂ (R→W), mask α=j.1→
coefficient (funB=> coeff (u B) j.2) α ≠0→ frequency α r e=1)
(C : R→W) (c : ι →ℝ) (b : W) :
localSlice J u F r C c b = ∑ α ∈Finset.univ.filter (funα : Module.DualF₂W=> α e=1),
coefficient (localSlice J u F r C c) α*character α b :=by
proof · 6
lines
rw [← inversion (localSlice J u F r C c) b, Finset.sum_filter]
apply Finset.sum_congr rfl
intro α _
by_cases ha : α e=1
· simp [ha]
· simp [ha, odd_coefficient_zero _ e (localSlice_odd J u F r e ho C c) α ha]
defPairAdmissible (x : Point m n) (I : Point m n →ℕ) (S : Finset (Row m n))
(p : PairClass m) : Prop:=
body · 3
lines
(∀ u, 0 < I u → face u p.val.1≠ face x p.val.1∧ face u p.val.2≠ face x p.val.2) ∧
(∀ y, (⟨p.val.1,y⟩ : Row m n) ∈S→ doubleMatch p.val.1 p.val.2 x (rowFill x ⟨p.val.1,y⟩) → y=face x p.val.1) ∧
(∀ y, (⟨p.val.2,y⟩ : Row m n) ∈S→ doubleMatch p.val.2 p.val.1 x (rowFill x ⟨p.val.2,y⟩) → y=face x p.val.2)
lemmapairAdmissible_exists (x : Point m n) (I : Point m n →ℕ) (S : Finset (Row m n))
(hx : I x=0) (hsize : S.card < (m-(∑ u, I u)).choose 2) :
∃p : PairClass m, PairAdmissible x IS p :=by
proof · 4
lines
obtain ⟨i,j,hij,hu,hi,hj⟩ := admissible_pair x IS hx hsize
rcases lt_or_gt_of_ne hij with h | h
· exact ⟨⟨(i,j),h⟩,hu,hi,hj⟩
· exact ⟨⟨(j,i),h⟩,(fun u h => ⟨(hu u h).2,(hu u h).1⟩),hj,hi⟩
lemmamaskClass_some (x : Point m n) (I : Point m n →ℕ) (S : Finset (Row m n))
(p : PairClass m) (hp : maskClass x IS=some p) : I x=0∧PairAdmissible x IS p :=by
proof · 6
lines
unfold maskClass at hp
split_ifs at hp with hx he
have hp' :=Option.some.inj hp
have hm :=Finset.min'_mem (admissibleClasses x IS) he
rw [hp'] at hm
exact ⟨Nat.eq_zero_of_not_pos hx,(Finset.mem_filter.mp hm).2⟩
lemmamaskClass_none (x : Point m n) (I : Point m n →ℕ) (S : Finset (Row m n))
(hsize : S.card < (m-(∑ u, I u)).choose 2) : maskClass x IS=none ↔0<I x :=by
proof · 8
lines
constructor
· intro he
by_contra hn
obtain ⟨p,hp⟩ := pairAdmissible_exists x IS (Nat.eq_zero_of_not_pos hn) hsize
havehne : (admissibleClasses x IS).Nonempty:= ⟨p,Finset.mem_filter.mpr ⟨Finset.mem_univ _,hp⟩⟩
simp only [maskClass, ite_eq_right hn, dite_eq_left hne] at he
contradiction
· intro hp; simp [maskClass,hp]
lemmaclassSelection_partition (x : Point m n)
(J : Finset (Finset (Row m n) × (Point m n →ℕ)))
(v : (Finset (Row m n) × (Point m n →ℕ)) →ℝ) :
(∑ j ∈J, v j) = ∑a : Option (PairClass m), ∑ j ∈ classSelection x a J, v j :=by
lemmajoint_pair_matching (f : FoldedProofA) {σ : ℝ} (hσ : σ ≠0) (η : ℝ)
(x : Point m n) (I : Point m n →ℕ) (S : Finset (Row m n)) (p : PairClass m)
(hp : PairAdmissible x IS p) (α : Module.DualF₂ (FaceArrayA m n))
(hmask : mask α=S) (hne : jointCoefficient f σ η x α I≠0) :
frequency α ⟨p.val.1,face x p.val.1⟩ = frequency α ⟨p.val.2,face x p.val.2⟩ ∧
frequency α ⟨p.val.1,face x p.val.1⟩ (AffineMap.const F₂A1)=1:=by
proof · 9
lines
havehij : p.val.1≠ p.val.2:= ne_of_lt p.property
refine ⟨?_,joint_local_odd f hσ η x α I hne p.val.1 (fun u hu => (hp.1 u hu).1)⟩
apply LinearMap.ext
intro a
have hh := joint_cylinder_gauge f σ η x α I hne p.val.1 p.val.2 hij x a
rw [frequency_cylinder α x p.val.1 p.val.2 hij
(fun y hy => hp.2.1 y (by rw [← hmask]; simpa [mask] using hy))
(fun y hy => hp.2.2 y (by rw [← hmask]; simpa [mask] using hy))] at hh
exact (BinaryFourier.add_eq_zero_iff _ _).mp hh
lemmalocal_face_in_box (x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k) (i : Fin m) :
Subbox.FaceInBoxH i (face x i) :=fun _ =>Subbox.mem_pointedSet_self _ _
lemmalocal_free_left (x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k) (p : PairClass m) :
(⟨p.val.1,face x p.val.1⟩ : Row m n) ∈ freePairRows x H p :=
proof · 1
line
Finset.mem_filter.mpr ⟨Finset.mem_univ _,Or.inl rfl,local_face_in_box x H _⟩
lemmalocal_free_right (x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k) (p : PairClass m) :
(⟨p.val.2,face x p.val.2⟩ : Row m n) ∈ freePairRows x H p :=
proof · 1
line
Finset.mem_filter.mpr ⟨Finset.mem_univ _,Or.inr rfl,local_face_in_box x H _⟩
lemmaretained_pair_admissible (x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k)
(p : PairClass m) (J : Finset (Finset (Row m n) × (Point m n →ℕ)))
(j : Finset (Row m n) × (Point m n →ℕ)) (hj : j∈retainedClass x H (some p) J) :
PairAdmissible x j.2 j.1 p :=by
proof · 2
lines
have hc := (Finset.mem_filter.mp (Finset.mem_filter.mp hj).1).2
exact (maskClass_some x j.2 j.1 p hc).2
lemmaretained_pair_local (x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k)
(p : PairClass m) (J : Finset (Finset (Row m n) × (Point m n →ℕ)))
(j : Finset (Row m n) × (Point m n →ℕ)) (hj : j∈retainedClass x H (some p) J)
(r : Row m n) (hr : r∈j.1) (hF : r∈freePairRows x H p) :
r=⟨p.val.1,face x p.val.1⟩ ∨ r=⟨p.val.2,face x p.val.2⟩ :=by
proof · 11
lines
have hn := (Finset.mem_filter.mp hj).2have hF' := (Finset.mem_filter.mp hF).2havehl : r.2=face x r.1:=by
by_contra hh
exact hn (Or.inr ⟨r,hr,hh,hF'.2⟩)
rcases r with ⟨t,y⟩
dsimp only at hl hF'
subst y
rcases hF'.1with h | h
· subst t; exact Or.inl rfl
· subst t; exact Or.inr rfl
defpairSlice (f : FoldedProofA) (σ η : ℝ) (x : Point m n)
{k : ℕ} (H : Subbox.PointedBox x k) (p : PairClass m)
(J : Finset (Finset (Row m n) × (Point m n →ℕ)))
(C : FaceArrayA m n) (c : Point m n →ℝ) (b : FormsA) : ℝ:=
body · 2
lines
localSlice (retainedClass x H (some p) J) (funB c => gradient f B σ η c x)
(freePairRows x H p) ⟨p.val.1,face x p.val.1⟩ C c b
theoremretained_local_sum (f : FoldedProofA) {σ : ℝ} (hσ : σ≠0) (η : ℝ)
(x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k) (p : PairClass m)
(J : Finset (Finset (Row m n) × (Point m n →ℕ)))
(BC : FaceArrayA m n) (hBC : ∀ t ∉ freePairRows x H p, B t=C t) (c : Point m n →ℝ) :
selectedProject (retainedClass x H (some p) J) (funB c => gradient f B σ η c x) B c =
pairSlice f σ η x H p JC c (B ⟨p.val.1,face x p.val.1⟩+B ⟨p.val.2,face x p.val.2⟩) :=by
proof · 10
lines
apply selectedProject_local_sum
· intro he
exact (ne_of_lt p.property) (congrArg Sigma.fst he)
· exact local_free_left x H p
· exact local_free_right x H p
· exact retained_pair_local x H p J
· intro j hj α hm hc
exact (joint_pair_matching f hσ η x j.2 j.1 p
(retained_pair_admissible x H p J j hj) α hm hc).1
· exact hBC
theorempairSlice_fourier (f : FoldedProofA) {σ : ℝ} (hσ : σ≠0) (η : ℝ)
(x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k) (p : PairClass m)
(J : Finset (Finset (Row m n) × (Point m n →ℕ)))
(C : FaceArrayA m n) (c : Point m n →ℝ) (b : FormsA) :
pairSlice f σ η x H p JC c b =
∑ α ∈Finset.univ.filter (funα : Module.DualF₂ (FormsA) => α (AffineMap.const F₂A1)=1),
coefficient (pairSlice f σ η x H p JC c) α * character α b :=by
proof · 4
lines
apply localSlice_fourier
intro j hj α hm hc
exact (joint_pair_matching f hσ η x j.2 j.1 p
(retained_pair_admissible x H p J j hj) α hm hc).2
lemmapairSlice_background (f : FoldedProofA) (σ η : ℝ)
(x : Point m n) {k : ℕ} (H : Subbox.PointedBox x k) (p : PairClass m)
(J : Finset (Finset (Row m n) × (Point m n →ℕ)))
(CD : FaceArrayA m n) (hCD : ∀ t ∉ freePairRows x H p, C t=D t) :
pairSlice f σ η x H p JC=pairSlice f σ η x H p JD:=by
proof · 8
lines
havehe : zeroFree (freePairRows x H p) C=zeroFree (freePairRows x H p) D:=by
funext t
by_cases ht : t∈freePairRows x H p
· simp [zeroFree,ht]
· simp [zeroFree,ht,hCD t ht]
funext c b
unfold pairSlice localSlice
rw [he]
lemmapsi_update (I : ι →ℕ) (x : ι) (C : ι →ℝ) (t : ℝ) :
psi I (Function.update C x t) = H (I x) t * ∏ y ∈Finset.univ.erase x, H (I y) (C y) :=by
proof · 7
lines
unfold psi
rw [←Finset.mul_prod_erase Finset.univ (fun y =>H (I y) (Function.update C x t y)) (Finset.mem_univ x)]
rw [Function.update_self]
congr 1
apply Finset.prod_congr rfl
intro y hy
rw [Function.update_of_ne (Finset.mem_erase.mp hy).1]
lemmapsi_localized (I : ι →ℕ) (x : ι) (F : Finset ι)
(hI : ∀ y ∈F, y≠x →I y=0) (c C : ι →ℝ) (hC : ∀ y ∉F, c y=C y) :
psi I c=psi I (Function.update C x (c x)) :=by