Download data/lean/OAI/Combinatorics/EditDistance/RecursiveControl.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.66 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditDistance/RecursiveControl.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditDistance/RecursiveControl.lean
-
curl -L -o RecursiveControl.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditDistance/RecursiveControl.lean
4.66 kB
| import OAI.Combinatorics.EditDistance.Families | |
| import OAI.Combinatorics.EditDistance.DirectSums | |
| import OAI.Combinatorics.EditDistance.Slots | |
| namespace OAI | |
| /-! | |
| # Averaged displacement control for recursive word families | |
| -/ | |
| namespace EditFamily | |
| open scoped BigOperators | |
| open EditDistortion EditAverage EditFourier EditSlots | |
| section InductiveControl | |
| variable {J : Type} [Fintype J] [DecidableEq J] (i : J) | |
| noncomputable def weight (j : J) : β := (EditSlots.multiplicity i j : β) / (2 * (2 * Fintype.card J - 1)) | |
| lemma weight_pos (j : J) : 0 < weight i j := by | |
| have hb : 0 < (Fintype.card J : β) := by | |
| exact_mod_cast Fintype.card_pos_iff.mpr β¨iβ© | |
| have hb' : (1 : β) β€ Fintype.card J := by | |
| exact_mod_cast (show 1 β€ Fintype.card J by exact Fintype.card_pos_iff.mpr β¨iβ©) | |
| have hc : 0 < (EditSlots.multiplicity i j : β) := by | |
| by_cases hj : j = i <;> simp [EditSlots.multiplicity, hj, hb] | |
| exact div_pos hc (by linarith) | |
| lemma sum_weight : (β j : J, weight i j) = 1 / 2 := by | |
| have hb : (1 : β) β€ Fintype.card J := by | |
| exact_mod_cast (show 1 β€ Fintype.card J by exact Fintype.card_pos_iff.mpr β¨iβ©) | |
| simp only [weight, β Finset.sum_div, sum_multiplicity] | |
| field_simp [show (2 * (Fintype.card J : β) - 1) β 0 by linarith] | |
| variable {p : J β β} {m A : β} {Ξ± Q : β} | |
| variable (F : β j, Family (p j) m A Ξ± Q) | |
| abbrev ProductState := β j, (F j).State | |
| def lift (j : J) (e : (F j).State) : ProductState F := Pi.single j e | |
| def allPhase : ProductState F := fun j => (F j).v | |
| lemma sum_lift_vectors : (β j, lift F j (F j).v) = allPhase F := by | |
| ext j | |
| simp [lift, allPhase] | |
| omit [Fintype J] in | |
| lemma lift_nsmul (j : J) (u : β) (e : (F j).State) : | |
| lift F j (u β’ e) = u β’ lift F j e := by | |
| ext k | |
| by_cases hk : k = j | |
| Β· subst k; simp [lift] | |
| Β· simp [lift, hk] | |
| lemma variation_zero (H : ProductState F β L1) : variation H 0 = 0 := by | |
| simp [variation, avg] | |
| lemma component_control (hQ : 0 β€ Q) (H : ProductState F β L1) | |
| (hh : β j e r, (e,r) β (F j).steps β | |
| variation H (lift F j e) β€ weight i j * r) | |
| (j : J) (a : β) (ha : a < p j) : | |
| variation H (a β’ lift F j (F j).v) β€ weight i j * Q := by | |
| by_cases ha0 : a = 0 | |
| Β· simp only [ha0, zero_nsmul, variation_zero] | |
| exact mul_nonneg (weight_pos i j).le hQ | |
| let T := EditSlices.slice (fun j => (F j).State) H j (weight i j) | |
| have hT : β e r, (e,r) β (F j).steps β variation T e β€ r := by | |
| intro e r her | |
| rw [EditSlices.variation_slice _ H j _ (weight_pos i j)] | |
| apply (div_le_iffβ (weight_pos i j)).mpr | |
| simpa only [lift, mul_comm] using hh j e r her | |
| have hC := (F j).control T hT a (Nat.pos_of_ne_zero ha0) ha | |
| rw [EditSlices.variation_slice _ H j _ (weight_pos i j)] at hC | |
| have hC' := (div_le_iffβ (weight_pos i j)).mp hC | |
| change variation H (lift F j (a β’ (F j).v)) β€ Q * weight i j at hC' | |
| rw [lift_nsmul] at hC' | |
| simpa only [mul_comm] using hC' | |
| theorem successor_control | |
| (hp : β j, (p j).Prime) (hinj : Function.Injective p) | |
| (P : β) (hP : 1 β€ 2 * P) (hpP : β j, (p j : β) β€ 2 * P) | |
| (h : β) (hh : 0 < h) (L : β) (hQ : 0 β€ Q) | |
| (H : ProductState F β L1) (hΟ : variation H (allPhase F) β€ 2 / L) | |
| (hlift : β j e r, (e,r) β (F j).steps β | |
| variation H (lift F j e) β€ weight i j * r) | |
| (u : β) (hu : u < p i) : | |
| variation H (u β’ lift F i (F i).v) β€ | |
| 2 * (2 * P) ^ (2 * h) / L + Q / h := by | |
| let (j : J) : NeZero (p j) := β¨(hp j).ne_zeroβ© | |
| have hv (j : J) : p j β’ lift F j (F j).v = 0 := by | |
| rw [β lift_nsmul, (F j).annihilate] | |
| simp [lift] | |
| have hc := prime_vector_displacement p (fun j => lift F j (F j).v) hv hp hinj | |
| P hP hpP h hh H i (u : ZMod (p i)) | |
| rw [ZMod.val_natCast_of_lt hu, sum_lift_vectors] at hc | |
| have hb (j : J) : avg (fun a : ZMod (p j) => variation H (a.val β’ lift F j (F j).v)) β€ | |
| weight i j * Q := by | |
| rw [β avg_const (X := ZMod (p j)) (weight i j * Q)] | |
| exact avg_mono (fun a => component_control i F hQ H hlift j a.val (ZMod.val_lt a)) | |
| calc | |
| _ β€ (2 * P) ^ (2 * h) * variation H (allPhase F) + | |
| (2 / (h : β)) * β j, avg (fun a : ZMod (p j) => | |
| variation H (a.val β’ lift F j (F j).v)) := hc | |
| _ β€ (2 * P) ^ (2 * h) * (2 / (L : β)) + | |
| (2 / (h : β)) * β j, weight i j * Q := by | |
| apply add_le_add | |
| Β· exact mul_le_mul_of_nonneg_left hΟ (pow_nonneg (by linarith) _) | |
| Β· exact mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun j _ => hb j)) (by positivity) | |
| _ = _ := by rw [β Finset.sum_mul, sum_weight]; ring | |
| end InductiveControl | |
| end EditFamily | |
| end OAI | |