Download data/lean/OAI/Combinatorics/FiniteCircle/TreeBranching.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 23.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/FiniteCircle/TreeBranching.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/FiniteCircle/TreeBranching.lean
-
curl -L -o TreeBranching.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/FiniteCircle/TreeBranching.lean
23.4 kB
| import OAI.Combinatorics.FiniteCircle.MaskBranching | |
| namespace OAI | |
| namespace FiniteCircle | |
| open scoped BigOperators List | |
| open scoped ComplexConjugate | |
| open RCLike Module | |
| @[reducible] def TreeLeaf (J : β β Type) : β β Type | |
| | 0 => PUnit | |
| | l+1 => J (l+1) Γ TreeLeaf J l | |
| instance treeLeafFintype (J : β β Type) [β l, Fintype (J l)] (l : β) : | |
| Fintype (TreeLeaf J l) := by | |
| induction l with | |
| | zero => exact inferInstanceAs (Fintype PUnit) | |
| | succ l ih => exact @instFintypeProd _ _ inferInstance ih | |
| noncomputable instance treeLeafDecidableEq (J : β β Type) (l : β) : | |
| DecidableEq (TreeLeaf J l) := Classical.decEq _ | |
| noncomputable def treeCheap (J Z : β β Type) [β l, AddCommGroup (Z l)] {M : β} | |
| (Ο : β l, Z l β+ (J l β ZMod M)) : (l : β) β AddSubgroup (TreeLeaf J l β ZMod M) | |
| | 0 => β₯ | |
| | l+1 => { | |
| carrier := {v | β c : J (l+1) β TreeLeaf J l β ZMod M, | |
| (β j, c j β treeCheap J Z Ο l) β§ β z : Z (l+1), β j i, v (j,i) = c j i + Ο (l+1) z j} | |
| zero_mem' := by | |
| refine β¨0, fun j => (treeCheap J Z Ο l).zero_mem, 0, ?_β© | |
| intro j i | |
| change (0:ZMod M) = 0 + Ο (l+1) 0 j | |
| simp | |
| add_mem' := by | |
| rintro v w β¨c,hc,z,hzβ© β¨d,hd,u,huβ© | |
| refine β¨c+d, fun j => (treeCheap J Z Ο l).add_mem (hc j) (hd j), z+u, ?_β© | |
| intro j i | |
| change v (j,i)+w (j,i) = c j i+d j i+Ο (l+1) (z+u) j | |
| simp only [hz, hu, map_add, Pi.add_apply] | |
| abel | |
| neg_mem' := by | |
| rintro v β¨c,hc,z,hzβ© | |
| refine β¨-c, fun j => (treeCheap J Z Ο l).neg_mem (hc j), -z, ?_β© | |
| intro j i | |
| change -v (j,i) = -c j i+Ο (l+1) (-z) j | |
| simp only [hz, map_neg, Pi.neg_apply] | |
| abel } | |
| theorem treeCheap_generator (J Z : β β Type) [β l, AddCommGroup (Z l)] {M : β} | |
| (Ο : β l, Z l β+ (J l β ZMod M)) (l : β) (z : Z (l+1)) : | |
| (fun i : TreeLeaf J (l+1) => Ο (l+1) z i.1) β treeCheap J Z Ο (l+1) := by | |
| exact β¨0, fun _ => (treeCheap J Z Ο l).zero_mem, z, fun _ _ => (zero_add _).symmβ© | |
| theorem treeCheap_child (J Z : β β Type) [β l, AddCommGroup (Z l)] {M : β} | |
| (Ο : β l, Z l β+ (J l β ZMod M)) (l : β) [DecidableEq (J (l+1))] (j : J (l+1)) | |
| (c : TreeLeaf J l β ZMod M) (hc : c β treeCheap J Z Ο l) : | |
| (fun i : TreeLeaf J (l+1) => if i.1 = j then c i.2 else 0) β treeCheap J Z Ο (l+1) := by | |
| classical | |
| refine β¨fun k => if k = j then c else 0, ?_, 0, ?_β© | |
| Β· intro k | |
| dsimp only | |
| split_ifs | |
| Β· exact hc | |
| Β· exact (treeCheap J Z Ο l).zero_mem | |
| Β· intro k i | |
| simp only [map_zero, Pi.zero_apply, add_zero] | |
| split_ifs <;> rfl | |
| noncomputable def treeFrequency (J : β β Type) : | |
| (l : β) β (TreeLeaf J l β β€) β FrequencyTree J l | |
| | 0, ΞΎ => ΞΎ PUnit.unit | |
| | l+1, ΞΎ => fun j => treeFrequency J l (fun i => ΞΎ (j,i)) | |
| theorem treeFrequency_sum (J : β β Type) [β l, Fintype (J l)] (l : β) | |
| (ΞΎ : TreeLeaf J l β β€) : frequencySum J l (treeFrequency J l ΞΎ) = β i, ΞΎ i := by | |
| induction l with | |
| | zero => | |
| change ΞΎ PUnit.unit = β i : PUnit, ΞΎ i | |
| exact (Fintype.sum_unique (fun i : PUnit => ΞΎ i)).symm | |
| | succ l ih => | |
| change (β j, frequencySum J l (treeFrequency J l (fun i => ΞΎ (j,i)))) = | |
| β i : J (l+1) Γ TreeLeaf J l, ΞΎ i | |
| simp only [ih] | |
| exact (Fintype.sum_prod_type (fun i : J (l+1) Γ TreeLeaf J l => ΞΎ i)).symm | |
| theorem treeFrequency_mass (J : β β Type) [β l, Fintype (J l)] (l : β) | |
| (ΞΎ : TreeLeaf J l β β€) : frequencyMass J l (treeFrequency J l ΞΎ) = β i, (ΞΎ i).natAbs := by | |
| induction l with | |
| | zero => | |
| change (ΞΎ PUnit.unit).natAbs = β i : PUnit, (ΞΎ i).natAbs | |
| exact (Fintype.sum_unique (fun i : PUnit => (ΞΎ i).natAbs)).symm | |
| | succ l ih => | |
| change (β j, frequencyMass J l (treeFrequency J l (fun i => ΞΎ (j,i)))) = | |
| β i : J (l+1) Γ TreeLeaf J l, (ΞΎ i).natAbs | |
| simp only [ih] | |
| exact (Fintype.sum_prod_type (fun i : J (l+1) Γ TreeLeaf J l => (ΞΎ i).natAbs)).symm | |
| noncomputable def flatMaskState (h : β) (p : β β β β β) (M : β) : | |
| (l : β) β (TreeLeaf (MaskChildren h p) l β ZMod M) β MaskState h p M l | |
| | 0, v => v PUnit.unit | |
| | l+1, v => fun j => flatMaskState h p M l (fun i => v (j,i)) | |
| theorem flatMaskState_shift (h : β) (p : β β β β β) (M l : β) | |
| (v : TreeLeaf (MaskChildren h p) l β ZMod M) (ΞΈ : ZMod M) : | |
| flatMaskState h p M l (fun i => v i+ΞΈ) = shiftMaskState h p M l (flatMaskState h p M l v) ΞΈ := by | |
| induction l with | |
| | zero => rfl | |
| | succ l ih => | |
| funext j | |
| exact ih (fun i => v (j,i)) | |
| noncomputable def flatExcludedState (m M : β) : | |
| (l : β) β (TreeLeaf (fun _ => Fin m) l β ZMod M) β ExcludedState m M l | |
| | 0, v => v PUnit.unit | |
| | l+1, v => fun j => flatExcludedState m M l (fun i => v (j,i)) | |
| theorem flatExcludedState_shift (m M l : β) | |
| (v : TreeLeaf (fun _ => Fin m) l β ZMod M) (ΞΈ : ZMod M) : | |
| flatExcludedState m M l (fun i => v i+ΞΈ) = shiftExcludedState m M l (flatExcludedState m M l v) ΞΈ := by | |
| induction l with | |
| | zero => rfl | |
| | succ l ih => | |
| funext j | |
| exact ih (fun i => v (j,i)) | |
| theorem char_sum {G : Type*} [AddCommMonoid G] {I : Type*} (Ο : AddChar G β) | |
| (s : Finset I) (f : I β G) : Ο (β i β s, f i) = β i β s, Ο (f i) := by | |
| classical | |
| induction s using Finset.induction_on with | |
| | empty => simp | |
| | @insert i s hi ih => simp only [Finset.sum_insert hi, Finset.prod_insert hi, | |
| AddChar.map_add_eq_mul, ih] | |
| theorem character_dot {I : Type*} [Fintype I] [DecidableEq I] {M : β} [NeZero M] | |
| (Ο : AddChar (I β ZMod M) β) (v : I β ZMod M) : | |
| Ο v = AddChar.zmodAddEquiv (β i, coordinateFrequency Ο i * v i) 1 := by | |
| classical | |
| have hv : v = β i, Pi.single i (v i) := by | |
| ext j | |
| simp [Pi.single_apply] | |
| conv_lhs => rw [hv] | |
| rw [char_sum] | |
| rw [map_sum, AddChar.sum_apply] | |
| apply Finset.prod_congr rfl | |
| intro i _ | |
| rw [character_single, zmod_character_mul] | |
| theorem character_dot_eq_one {I : Type*} [Fintype I] [DecidableEq I] {M : β} [NeZero M] | |
| (Ο : AddChar (I β ZMod M) β) (v : I β ZMod M) : | |
| Ο v = 1 β β i, coordinateFrequency Ο i * v i = 0 := by | |
| rw [character_dot, zmod_character_eq_one, mul_one] | |
| theorem dot_restrict_child (J Z : β β Type) [β l, Fintype (J l)] | |
| [β l, AddCommGroup (Z l)] {M : β} (Ο : β l, Z l β+ (J l β ZMod M)) | |
| (l : β) (ΞΎ : TreeLeaf J (l+1) β β€) | |
| (ha : β c β treeCheap J Z Ο (l+1), β i, (ΞΎ i : ZMod M)*c i = 0) | |
| (j : J (l+1)) (c : TreeLeaf J l β ZMod M) (hc : c β treeCheap J Z Ο l) : | |
| β i, (ΞΎ (j,i):ZMod M)*c i = 0 := by | |
| classical | |
| have ht := ha _ (treeCheap_child J Z Ο l j c hc) | |
| change (β k : J (l+1) Γ TreeLeaf J l, (ΞΎ k : ZMod M)*(if k.1=j then c k.2 else 0)) = 0 at ht | |
| simpa only [Fintype.sum_prod_type, mul_ite, mul_zero, Finset.sum_ite_irrel, | |
| Finset.sum_const_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true] using ht | |
| @[simp] theorem subcircle_intCast {M p : β} (hp : p β£ M) (a : β€) : | |
| subcircle hp (a : ZMod p) = (M/p : ZMod M)*(a : ZMod M) := by | |
| have h := map_zsmul (subcircle hp) a (1 : ZMod p) | |
| have hc : subcircle hp 1 = (M/p : ZMod M) := by | |
| simpa only [Nat.cast_one, mul_one] using subcircle_natCast hp 1 | |
| rw [zsmul_eq_mul, mul_one, hc, zsmul_eq_mul] at h | |
| simpa only [mul_comm] using h | |
| theorem mask_generator_apply {h M l : β} {p : β β β β β} | |
| (hd : β k : Fin h, p l k β£ M) (k : Fin h) (j : MaskTag h p l) : | |
| maskPhaseHom h p M l hd (Pi.single k 1) j = | |
| subcircle (hd k) 1 + if j.1 = k then j.2.val β’ subcircle (hd k) 1 else 0 := by | |
| classical | |
| have hs : (β a : Fin h, subcircle (hd a) ((Pi.single k 1 : MaskResidues h p l) a)) = | |
| subcircle (hd k) 1 := by | |
| rw [Finset.sum_eq_single k] | |
| Β· simp | |
| Β· intro a _ ha | |
| simp [Pi.single_eq_of_ne ha] | |
| Β· simp | |
| change (β a : Fin h, subcircle (hd a) ((Pi.single k 1 : MaskResidues h p l) a)) + | |
| j.2.val β’ subcircle (hd j.1) ((Pi.single k 1 : MaskResidues h p l) j.1) = _ | |
| rw [hs] | |
| congr 1 | |
| by_cases he : j.1 = k | |
| Β· subst k | |
| simp | |
| Β· simp [he] | |
| noncomputable def maskCheap (h : β) (p : β β β β β) (M : β) | |
| (hd : β l (k : Fin h), p l k β£ M) (l : β) : | |
| AddSubgroup (TreeLeaf (MaskChildren h p) l β ZMod M) := | |
| treeCheap (MaskChildren h p) (MaskResidues h p) (fun l => maskPhaseHom h p M l (hd l)) l | |
| theorem mask_dot_generator {h M l : β} {p : β β β β β} | |
| (hd : β k : Fin h, p (l+1) k β£ M) (k : Fin h) | |
| (ΞΎ : TreeLeaf (MaskChildren h p) (l+1) β β€) : | |
| (β i, (ΞΎ i:ZMod M)*maskPhaseHom h p M (l+1) hd (Pi.single k 1) i.1) = | |
| subcircle (hd k) (((β i, ΞΎ i) + β b : Fin (p (l+1) k), (b.val:β€)* | |
| β i : TreeLeaf (MaskChildren h p) l, ΞΎ (β¨k,bβ©,i) : β€) : ZMod (p (l+1) k)) := by | |
| classical | |
| rw [subcircle_intCast] | |
| let q : ZMod M := subcircle (hd k) 1 | |
| have hq : q = (M/p (l+1) k : ZMod M) := by | |
| simpa only [Nat.cast_one, mul_one] using subcircle_natCast (hd k) 1 | |
| simp_rw [mask_generator_apply] | |
| change (β i : MaskTag h p (l+1) Γ TreeLeaf (MaskChildren h p) l, | |
| (ΞΎ i:ZMod M)*(q+if i.1.1=k then i.1.2.val β’ q else 0)) = _ | |
| simp_rw [mul_add, Finset.sum_add_distrib] | |
| rw [β Finset.sum_mul] | |
| have hs : (β i : MaskTag h p (l+1) Γ TreeLeaf (MaskChildren h p) l, | |
| (ΞΎ i:ZMod M)*(if i.1.1=k then i.1.2.val β’ q else 0)) = | |
| (β b : Fin (p (l+1) k), (b.val:ZMod M)*β i : TreeLeaf (MaskChildren h p) l, | |
| (ΞΎ (β¨k,bβ©,i):ZMod M))*q := by | |
| rw [Fintype.sum_prod_type, Fintype.sum_sigma] | |
| simp only [mul_ite, mul_zero, Finset.sum_ite_irrel, Finset.sum_const_zero] | |
| rw [Finset.sum_ite_eq', ite_eq_left (Finset.mem_univ k)] | |
| simp_rw [nsmul_eq_mul, β Finset.sum_mul] | |
| conv_rhs => rw [Finset.sum_mul] | |
| apply Finset.sum_congr rfl | |
| intro b _ | |
| ring | |
| rw [hs, hq] | |
| push_cast | |
| ring | |
| theorem mask_annihilator_congruences {h M : β} {p : β β β β β} [NeZero M] | |
| (hd : β l (k : Fin h), p l k β£ M) (hn : β l (k : Fin h), 0 < p l k) | |
| (l : β) (ΞΎ : TreeLeaf (MaskChildren h p) l β β€) | |
| (ha : β c β maskCheap h p M hd l, β i, (ΞΎ i:ZMod M)*c i = 0) : | |
| MaskCongruences h p l (treeFrequency (MaskChildren h p) l ΞΎ) := by | |
| classical | |
| induction l with | |
| | zero => trivial | |
| | succ l ih => | |
| change (β k : Fin h, (p (l+1) k:β€) β£ _ ) β§ _ | |
| constructor | |
| Β· intro k | |
| let : NeZero (p (l+1) k) := β¨(hn _ k).ne'β© | |
| have hg := treeCheap_generator (MaskChildren h p) (MaskResidues h p) | |
| (fun l => maskPhaseHom h p M l (hd _)) l (Pi.single k 1) | |
| have hz := ha _ hg | |
| rw [mask_dot_generator (hd (l+1)) k ΞΎ] at hz | |
| have he : (((β i, ΞΎ i) + β b : Fin (p (l+1) k), (b.val:β€)* | |
| β i : TreeLeaf (MaskChildren h p) l, ΞΎ (β¨k,bβ©,i) : β€) : ZMod (p (l+1) k)) = 0 := | |
| subcircle_injective (hd _ k) (hz.trans (map_zero _).symm) | |
| have he' := (ZMod.intCast_zmod_eq_zero_iff_dvd _ _).mp he | |
| simp only [treeFrequency, frequencySum, treeFrequency_sum] | |
| convert he' using 1 | |
| congr 1 | |
| exact (Fintype.sum_prod_type (fun i : MaskChildren h p (l+1) Γ TreeLeaf (MaskChildren h p) l => ΞΎ i)).symm | |
| Β· intro j | |
| apply ih | |
| intro c hc | |
| exact dot_restrict_child (MaskChildren h p) (MaskResidues h p) | |
| (fun l => maskPhaseHom h p M l (hd _)) l ΞΎ ha j c hc | |
| theorem mask_character_branching {h M : β} {p : β β β β β} [NeZero M] | |
| (hh : 2 β€ h) (hd : β l (k : Fin h), p l k β£ M) | |
| (hn : β l (k : Fin h), 0 < p l k) | |
| (hp : β l (k : Fin h), 1 β€ l β l β€ h β Nat.Prime (p l k)) | |
| (hinj : β l, 1 β€ l β l β€ h β Function.Injective (fun k : Fin h => p l k)) | |
| (hlarge : β l (k : Fin h), 1 β€ l β l β€ h β h ^ 3 β€ p l k) | |
| (Ο : AddChar (TreeLeaf (MaskChildren h p) h β ZMod M) β) | |
| (ha : Ο.compAddMonoidHom (maskCheap h p M hd h).subtype = 0) | |
| (ΞΈ : ZMod M) (hw : Ο (fun _ => ΞΈ) β 1) : | |
| ((h:β)/2)^h β€ β i, ((coordinateFrequency Ο i).valMinAbs.natAbs:β) := by | |
| classical | |
| let ΞΎ := fun i => (coordinateFrequency Ο i).valMinAbs | |
| have hc := mask_annihilator_congruences hd hn h ΞΎ (fun c hc => by | |
| have hv := congrArg (fun Ο : AddChar (maskCheap h p M hd h) β => Ο β¨c,hcβ©) ha | |
| have he : Ο c = 1 := hv | |
| have hz := (character_dot_eq_one Ο c).mp he | |
| simpa only [ΞΎ, ZMod.coe_valMinAbs] using hz) | |
| have hroot : frequencySum (MaskChildren h p) h (treeFrequency (MaskChildren h p) h ΞΎ) β 0 := by | |
| rw [treeFrequency_sum] | |
| intro he | |
| apply hw | |
| rw [character_dot_eq_one, β Finset.sum_mul] | |
| have hz : β i, coordinateFrequency Ο i = 0 := by | |
| have ht := congrArg (fun n : β€ => (n : ZMod M)) he | |
| simpa only [Int.cast_sum, ΞΎ, ZMod.coe_valMinAbs, Int.cast_zero] using ht | |
| rw [hz, zero_mul] | |
| have hb := mask_frequency_branching hh p hp hinj hlarge _ hc hroot | |
| rw [treeFrequency_mass] at hb | |
| simp only [Nat.cast_sum, ΞΎ] at hb | |
| convert hb using 1 | |
| congr 1 | |
| noncomputable def ExcludedCongruences (h : β) (p : β β β β β) : | |
| (l : β) β FrequencyTree (fun _ => Fin h) l β Prop | |
| | 0, _ => True | |
| | l+1, t => | |
| (β k : Fin h, (p (l+1) k:β€) β£ frequencySum (fun _ => Fin h) (l+1) t - | |
| frequencySum (fun _ => Fin h) l (t k)) β§ | |
| β j, ExcludedCongruences h p l (t j) | |
| theorem many_excluded_children {h : β} (hh : 2 β€ h) (p : Fin h β β) | |
| (hp : β i, Nat.Prime (p i)) (hinj : Function.Injective p) | |
| (hlarge : β i, h ^ 3 β€ p i) (f : Fin h β β€) | |
| {Ξ² : β€} (hΞ² : Ξ² β 0) (hsmall : Ξ².natAbs < h ^ h) | |
| (hc : β k, (p k : β€) β£ Ξ² - f k) : | |
| h β€ 2 * (Finset.univ.filter fun j => f j β 0).card := by | |
| classical | |
| let s := Finset.univ.filter fun j => f j β 0 | |
| let t := Finset.univ.filter fun k => Β¬ (p k : β€) β£ Ξ² | |
| let q := Finset.univ.filter fun k => (p k : β€) β£ Ξ² | |
| have hq : 3 * q.card < h := few_large_prime_divisors hh p hp hinj hlarge hΞ² hsmall | |
| have ht : t β s := by | |
| intro k hk | |
| refine Finset.mem_filter.mpr β¨Finset.mem_univ k, ?_β© | |
| intro he | |
| have hc' := hc k | |
| rw [he, sub_zero] at hc' | |
| exact (Finset.mem_filter.mp hk).2 hc' | |
| have hcard : t.card β€ s.card := Finset.card_le_card ht | |
| have hcount : q.card + t.card = h := by | |
| simpa [q, t] using (Finset.card_filter_add_card_filter_not | |
| (s := (Finset.univ : Finset (Fin h))) (fun k => (p k : β€) β£ Ξ²)) | |
| change h β€ 2 * s.card | |
| omega | |
| theorem excluded_branching_induction {h : β} (hh : 2 β€ h) (p : β β β β β) | |
| (hp : β l (k : Fin h), 1 β€ l β l β€ h β Nat.Prime (p l k)) | |
| (hinj : β l, 1 β€ l β l β€ h β Function.Injective (fun k : Fin h => p l k)) | |
| (hlarge : β l (k : Fin h), 1 β€ l β l β€ h β h ^ 3 β€ p l k) | |
| (l : β) (hl : l β€ h) (t : FrequencyTree (fun _ => Fin h) l) | |
| (hc : ExcludedCongruences h p l t) | |
| (hroot : frequencySum (fun _ => Fin h) l t β 0) | |
| (hsmall : frequencyMass (fun _ => Fin h) l t < h ^ h) : | |
| ((h : β) / 2) ^ l β€ (frequencyMass (fun _ => Fin h) l t : β) := by | |
| classical | |
| induction l with | |
| | zero => | |
| have : 1 β€ frequencyMass (fun _ => Fin h) 0 t := | |
| (Int.natAbs_pos.mpr hroot).trans_le (frequencySum_natAbs_le_mass _ _ _) | |
| simpa using (show (1 : β) β€ frequencyMass (fun _ => Fin h) 0 t by exact_mod_cast this) | |
| | succ l ih => | |
| let f : Fin h β β€ := fun j => frequencySum (fun _ => Fin h) l (t j) | |
| let s := Finset.univ.filter fun j => f j β 0 | |
| have hsumSmall : (frequencySum (fun _ => Fin h) (l + 1) t).natAbs < h ^ h := | |
| (frequencySum_natAbs_le_mass _ _ _).trans_lt hsmall | |
| have hcard : h β€ 2 * s.card := | |
| many_excluded_children hh (fun k => p (l + 1) k) | |
| (fun k => hp _ k (by omega) hl) (hinj _ (by omega) hl) | |
| (fun k => hlarge _ k (by omega) hl) f hroot hsumSmall hc.1 | |
| have hchild : β j, frequencyMass (fun _ => Fin h) l (t j) < h ^ h := by | |
| intro j | |
| apply lt_of_le_of_lt _ hsmall | |
| change frequencyMass (fun _ => Fin h) l (t j) β€ β j, frequencyMass (fun _ => Fin h) l (t j) | |
| exact Finset.single_le_sum (f := fun j => frequencyMass (fun _ => Fin h) l (t j)) | |
| (fun _ _ => Nat.zero_le _) (Finset.mem_univ j) | |
| have hm : β j β s, ((h : β) / 2) ^ l β€ frequencyMass (fun _ => Fin h) l (t j) := by | |
| intro j hj | |
| exact ih (by omega) (t j) (hc.2 j) (Finset.mem_filter.mp hj).2 (hchild j) | |
| have hcardR : (h : β) / 2 β€ s.card := by | |
| have : (h : β) β€ 2 * (s.card : β) := by exact_mod_cast hcard | |
| linarith | |
| calc | |
| ((h : β) / 2) ^ (l + 1) = ((h : β) / 2) * ((h : β) / 2) ^ l := by ring | |
| _ β€ s.card * ((h : β) / 2) ^ l := mul_le_mul_of_nonneg_right hcardR (by positivity) | |
| _ = β j β s, ((h : β) / 2) ^ l := by simp | |
| _ β€ β j β s, (frequencyMass (fun _ => Fin h) l (t j) : β) := Finset.sum_le_sum hm | |
| _ β€ β j, (frequencyMass (fun _ => Fin h) l (t j) : β) := | |
| Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) (fun _ _ _ => by positivity) | |
| _ = (frequencyMass (fun _ => Fin h) (l + 1) t : β) := by | |
| simp only [frequencyMass, Nat.cast_sum] | |
| theorem excluded_frequency_branching {h : β} (hh : 2 β€ h) (p : β β β β β) | |
| (hp : β l (k : Fin h), 1 β€ l β l β€ h β Nat.Prime (p l k)) | |
| (hinj : β l, 1 β€ l β l β€ h β Function.Injective (fun k : Fin h => p l k)) | |
| (hlarge : β l (k : Fin h), 1 β€ l β l β€ h β h ^ 3 β€ p l k) | |
| (t : FrequencyTree (fun _ => Fin h) h) (hc : ExcludedCongruences h p h t) | |
| (hroot : frequencySum (fun _ => Fin h) h t β 0) : | |
| ((h : β) / 2) ^ h β€ (frequencyMass (fun _ => Fin h) h t : β) := by | |
| by_contra hn | |
| have hlt := lt_of_not_ge hn | |
| have hcap : ((h : β) / 2) ^ h β€ (h : β) ^ h := by | |
| apply pow_le_pow_leftβ (by positivity) | |
| have : (0 : β) β€ h := Nat.cast_nonneg h | |
| linarith | |
| have hsmall : frequencyMass (fun _ => Fin h) h t < h ^ h := by | |
| exact_mod_cast hlt.trans_le hcap | |
| exact (not_lt_of_ge (excluded_branching_induction hh p hp hinj hlarge h le_rfl t hc hroot hsmall)) hlt | |
| theorem excluded_generator_apply {h M l : β} {p : β β β β β} | |
| (hd : β k : Fin h, p l k β£ M) (k j : Fin h) : | |
| excludedPhaseHom h p M l hd (Pi.single k 1) j = | |
| subcircle (hd k) 1 - if j = k then subcircle (hd k) 1 else 0 := by | |
| classical | |
| rw [excludedPhaseHom_apply] | |
| have hs : (β a : Fin h, subcircle (hd a) ((Pi.single k 1 : MaskResidues h p l) a)) = | |
| subcircle (hd k) 1 := by | |
| rw [Finset.sum_eq_single k] | |
| Β· simp | |
| Β· intro a _ ha | |
| simp [Pi.single_eq_of_ne ha] | |
| Β· simp | |
| rw [hs] | |
| congr 1 | |
| by_cases he : j = k | |
| Β· subst j | |
| simp | |
| Β· simp [he] | |
| noncomputable def excludedCheap (h : β) (p : β β β β β) (M : β) | |
| (hd : β l (k : Fin h), p l k β£ M) (l : β) : | |
| AddSubgroup (TreeLeaf (fun _ => Fin h) l β ZMod M) := | |
| treeCheap (fun _ => Fin h) (MaskResidues h p) (fun l => excludedPhaseHom h p M l (hd l)) l | |
| theorem excluded_dot_generator {h M l : β} {p : β β β β β} | |
| (hd : β k : Fin h, p (l+1) k β£ M) (k : Fin h) | |
| (ΞΎ : TreeLeaf (fun _ => Fin h) (l+1) β β€) : | |
| (β i, (ΞΎ i:ZMod M)*excludedPhaseHom h p M (l+1) hd (Pi.single k 1) i.1) = | |
| subcircle (hd k) (((β i, ΞΎ i) - | |
| β i : TreeLeaf (fun _ => Fin h) l, ΞΎ (k,i) : β€) : ZMod (p (l+1) k)) := by | |
| classical | |
| rw [subcircle_intCast] | |
| let q : ZMod M := subcircle (hd k) 1 | |
| have hq : q = (M/p (l+1) k : ZMod M) := by | |
| simpa only [Nat.cast_one, mul_one] using subcircle_natCast (hd k) 1 | |
| simp_rw [excluded_generator_apply] | |
| change (β i : Fin h Γ TreeLeaf (fun _ => Fin h) l, | |
| (ΞΎ i:ZMod M)*(q-if i.1=k then q else 0)) = _ | |
| simp_rw [mul_sub, Finset.sum_sub_distrib] | |
| rw [β Finset.sum_mul] | |
| have hs : (β i : Fin h Γ TreeLeaf (fun _ => Fin h) l, | |
| (ΞΎ i:ZMod M)*(if i.1=k then q else 0)) = | |
| (β i : TreeLeaf (fun _ => Fin h) l, (ΞΎ (k,i):ZMod M))*q := by | |
| simp only [Fintype.sum_prod_type, mul_ite, mul_zero] | |
| rw [Finset.sum_comm] | |
| simp only [Finset.sum_ite_eq', Finset.mem_univ, ite_true] | |
| rw [β Finset.sum_mul] | |
| rw [hs, hq] | |
| push_cast | |
| ring | |
| theorem excluded_annihilator_congruences {h M : β} {p : β β β β β} [NeZero M] | |
| (hd : β l (k : Fin h), p l k β£ M) (hn : β l (k : Fin h), 0 < p l k) | |
| (l : β) (ΞΎ : TreeLeaf (fun _ => Fin h) l β β€) | |
| (ha : β c β excludedCheap h p M hd l, β i, (ΞΎ i:ZMod M)*c i = 0) : | |
| ExcludedCongruences h p l (treeFrequency (fun _ => Fin h) l ΞΎ) := by | |
| classical | |
| induction l with | |
| | zero => trivial | |
| | succ l ih => | |
| change (β k : Fin h, (p (l+1) k:β€) β£ _ ) β§ _ | |
| constructor | |
| Β· intro k | |
| let : NeZero (p (l+1) k) := β¨(hn _ k).ne'β© | |
| have hg := treeCheap_generator (fun _ => Fin h) (MaskResidues h p) | |
| (fun l => excludedPhaseHom h p M l (hd _)) l (Pi.single k 1) | |
| have hz := ha _ hg | |
| rw [excluded_dot_generator (hd (l+1)) k ΞΎ] at hz | |
| have he : (((β i, ΞΎ i) - | |
| β i : TreeLeaf (fun _ => Fin h) l, ΞΎ (k,i) : β€) : ZMod (p (l+1) k)) = 0 := | |
| subcircle_injective (hd _ k) (hz.trans (map_zero _).symm) | |
| have he' := (ZMod.intCast_zmod_eq_zero_iff_dvd _ _).mp he | |
| simp only [treeFrequency, frequencySum, treeFrequency_sum] | |
| convert he' using 1 | |
| congr 1 | |
| exact (Fintype.sum_prod_type (fun i : Fin h Γ TreeLeaf (fun _ => Fin h) l => ΞΎ i)).symm | |
| Β· intro j | |
| apply ih | |
| intro c hc | |
| exact dot_restrict_child (fun _ => Fin h) (MaskResidues h p) | |
| (fun l => excludedPhaseHom h p M l (hd _)) l ΞΎ ha j c hc | |
| theorem excluded_character_branching {h M : β} {p : β β β β β} [NeZero M] | |
| (hh : 2 β€ h) (hd : β l (k : Fin h), p l k β£ M) | |
| (hn : β l (k : Fin h), 0 < p l k) | |
| (hp : β l (k : Fin h), 1 β€ l β l β€ h β Nat.Prime (p l k)) | |
| (hinj : β l, 1 β€ l β l β€ h β Function.Injective (fun k : Fin h => p l k)) | |
| (hlarge : β l (k : Fin h), 1 β€ l β l β€ h β h ^ 3 β€ p l k) | |
| (Ο : AddChar (TreeLeaf (fun _ => Fin h) h β ZMod M) β) | |
| (ha : Ο.compAddMonoidHom (excludedCheap h p M hd h).subtype = 0) | |
| (ΞΈ : ZMod M) (hw : Ο (fun _ => ΞΈ) β 1) : | |
| ((h:β)/2)^h β€ β i, ((coordinateFrequency Ο i).valMinAbs.natAbs:β) := by | |
| classical | |
| let ΞΎ := fun i => (coordinateFrequency Ο i).valMinAbs | |
| have hc := excluded_annihilator_congruences hd hn h ΞΎ (fun c hc => by | |
| have hv := congrArg (fun Ο : AddChar (excludedCheap h p M hd h) β => Ο β¨c,hcβ©) ha | |
| have he : Ο c = 1 := hv | |
| have hz := (character_dot_eq_one Ο c).mp he | |
| simpa only [ΞΎ, ZMod.coe_valMinAbs] using hz) | |
| have hroot : frequencySum (fun _ => Fin h) h (treeFrequency (fun _ => Fin h) h ΞΎ) β 0 := by | |
| rw [treeFrequency_sum] | |
| intro he | |
| apply hw | |
| rw [character_dot_eq_one, β Finset.sum_mul] | |
| have hz : β i, coordinateFrequency Ο i = 0 := by | |
| have ht := congrArg (fun n : β€ => (n : ZMod M)) he | |
| simpa only [Int.cast_sum, ΞΎ, ZMod.coe_valMinAbs, Int.cast_zero] using ht | |
| rw [hz, zero_mul] | |
| have hb := excluded_frequency_branching hh p hp hinj hlarge _ hc hroot | |
| rw [treeFrequency_mass] at hb | |
| simp only [Nat.cast_sum, ΞΎ] at hb | |
| simpa only [Nat.cast_sum, ΞΎ] using hb | |
| end FiniteCircle | |
| end OAI | |