Download data/lean/OAI/Probability/SATComputability/DeletionIncrement.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.88 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SATComputability/DeletionIncrement.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SATComputability/DeletionIncrement.lean
-
curl -L -o DeletionIncrement.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SATComputability/DeletionIncrement.lean
5.88 kB
| import OAI.Probability.SATComputability.VariableDeletion | |
| import OAI.Probability.DilutedSpin.FiniteLaw | |
| namespace OAI | |
| namespace FixedClauseThreshold.Computability | |
| open Finset | |
| open DilutedSpinGlass | |
| open scoped BigOperators | |
| def allowedDeletions (n r : β) : Finset (Finset (Fin n)) := | |
| univ.filter (fun D => D.card β€ r) | |
| theorem allowedDeletions_nonempty (n r : β) : (allowedDeletions n r).Nonempty := | |
| β¨β , by simp [allowedDeletions]β© | |
| noncomputable def bestDeletionTime {n : β} (t : Finset (Fin n) β β) (r : β) : β := | |
| (allowedDeletions n r).sup' (allowedDeletions_nonempty n r) t | |
| noncomputable def freeDeletionTime {n : β} (t : Finset (Fin n) β β) | |
| (r : β) (v : Fin n) : β := | |
| (allowedDeletions n r).sup' (allowedDeletions_nonempty n r) (fun D => t (insert v D)) | |
| theorem bestDeletionTime_mono {n : β} (t : Finset (Fin n) β β) : | |
| Monotone (bestDeletionTime t) := by | |
| intro r s hrs | |
| apply Finset.sup'_le | |
| intro D hD | |
| apply Finset.le_sup' | |
| simp only [allowedDeletions, Finset.mem_filter, Finset.mem_univ, true_and] at hD β’ | |
| exact hD.trans hrs | |
| theorem bestDeletionTime_le_free {n : β} {t : Finset (Fin n) β β} | |
| (ht : Monotone t) (r : β) (v : Fin n) : | |
| bestDeletionTime t r β€ freeDeletionTime t r v := by | |
| apply Finset.sup'_le | |
| intro D hD | |
| apply (ht (Finset.subset_insert v D)).trans | |
| exact Finset.le_sup' (fun E => t (insert v E)) hD | |
| theorem freeDeletionTime_le_next {n : β} (t : Finset (Fin n) β β) | |
| (r : β) (v : Fin n) : | |
| freeDeletionTime t r v β€ bestDeletionTime t (r+1) := by | |
| apply Finset.sup'_le | |
| intro D hD | |
| apply Finset.le_sup' | |
| simp only [allowedDeletions, Finset.mem_filter, Finset.mem_univ, true_and] at hD β’ | |
| exact (Finset.card_insert_le _ _).trans (Nat.add_le_add_right hD 1) | |
| theorem freeDeletionTime_eq_at_max {n r : β} (t : Finset (Fin n) β β) | |
| (hr : 1 β€ r) {D : Finset (Fin n)} (hD : D.card = r) | |
| (hmax : bestDeletionTime t r = t D) {v : Fin n} (hv : v β D) : | |
| freeDeletionTime t (r-1) v = bestDeletionTime t r := by | |
| apply le_antisymm | |
| Β· simpa only [Nat.sub_add_cancel hr] using freeDeletionTime_le_next t (r-1) v | |
| Β· rw [hmax] | |
| have he : D.erase v β allowedDeletions n (r-1) := by | |
| simp only [allowedDeletions, Finset.mem_filter, Finset.mem_univ, true_and, | |
| Finset.card_erase_of_mem hv, hD, le_refl] | |
| have h := Finset.le_sup' (fun E => t (insert v E)) he | |
| simpa only [freeDeletionTime, Finset.insert_erase hv] using h | |
| theorem deletion_increment_rpow {n r : β} {t : Finset (Fin n) β β} | |
| (ht : Monotone t) (hr : 1 β€ r) {p : β} (hp : 0 < p) : | |
| (r : β) * (bestDeletionTime t r - bestDeletionTime t (r-1))^p β€ | |
| β v : Fin n, (freeDeletionTime t (r-1) v - bestDeletionTime t (r-1))^p := by | |
| obtain β¨D, hD, hmaxβ© := Finset.exists_mem_eq_sup' | |
| (allowedDeletions_nonempty n r) t | |
| change bestDeletionTime t r = t D at hmax | |
| have hcard : D.card β€ r := by simpa only [allowedDeletions, Finset.mem_filter, | |
| Finset.mem_univ, true_and] using hD | |
| have hnonneg (v : Fin n) : | |
| 0 β€ freeDeletionTime t (r-1) v - bestDeletionTime t (r-1) := | |
| sub_nonneg.mpr (bestDeletionTime_le_free ht (r-1) v) | |
| by_cases hsmall : D.card < r | |
| Β· have he : D β allowedDeletions n (r-1) := by | |
| simp only [allowedDeletions, Finset.mem_filter, Finset.mem_univ, true_and] | |
| omega | |
| have hle : bestDeletionTime t r β€ bestDeletionTime t (r-1) := by | |
| rw [hmax] | |
| exact Finset.le_sup' t he | |
| have heq := le_antisymm hle (bestDeletionTime_mono t (Nat.sub_le r 1)) | |
| rw [heq, sub_self, Real.zero_rpow hp.ne', mul_zero] | |
| exact Finset.sum_nonneg (fun v _ => Real.rpow_nonneg (hnonneg v) _) | |
| Β· have hcard' : D.card = r := by omega | |
| calc | |
| _ = β v β D, (bestDeletionTime t r - bestDeletionTime t (r-1))^p := by | |
| simp only [Finset.sum_const, nsmul_eq_mul, hcard'] | |
| _ = β v β D, (freeDeletionTime t (r-1) v - bestDeletionTime t (r-1))^p := by | |
| apply Finset.sum_congr rfl | |
| intro v hv | |
| rw [freeDeletionTime_eq_at_max t hr hcard' hmax hv] | |
| _ β€ _ := Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ D) | |
| (fun v _ _ => Real.rpow_nonneg (hnonneg v) _) | |
| theorem mean_deletion_increment {Ξ© : Type*} [Fintype Ξ©] (P : FiniteLaw Ξ©) | |
| {n r : β} (t : Ξ© β Finset (Fin n) β β) (ht : β Ο, Monotone (t Ο)) | |
| (hr : 1 β€ r) {p C : β} (hp : 1 β€ p) | |
| (hmoment : β v : Fin n, P.expect (fun Ο => | |
| (freeDeletionTime (t Ο) (r-1) v - bestDeletionTime (t Ο) (r-1))^p) β€ C) : | |
| P.expect (fun Ο => bestDeletionTime (t Ο) r - bestDeletionTime (t Ο) (r-1)) β€ | |
| ((n : β) * C / r) ^ (1/p) := by | |
| let delta := fun Ο => bestDeletionTime (t Ο) r - bestDeletionTime (t Ο) (r-1) | |
| have hd (Ο : Ξ©) : 0 β€ delta Ο := | |
| sub_nonneg.mpr (bestDeletionTime_mono (t Ο) (Nat.sub_le r 1)) | |
| have hpow : (r : β) * P.expect (fun Ο => (delta Ο)^p) β€ n*C := by | |
| have hi := P.expect_mono (fun Ο => deletion_increment_rpow (ht Ο) hr | |
| (show 0 < p by linarith)) | |
| rw [FiniteLaw.expect_mul_left, FiniteLaw.expect_fintype_sum] at hi | |
| apply hi.trans | |
| have hs := Finset.sum_le_sum (fun v (_ : v β (Finset.univ : Finset (Fin n))) => | |
| hmoment v) | |
| simpa only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] using hs | |
| have hr0 : (0 : β) < r := by exact_mod_cast (Nat.zero_lt_of_lt hr) | |
| have hi : P.expect (fun Ο => (delta Ο)^p) β€ (n : β)*C/r := | |
| (le_div_iffβ hr0).mpr (by simpa only [mul_comm] using hpow) | |
| have hm := Real.arith_mean_le_rpow_mean Finset.univ P.weight delta | |
| (fun Ο _ => P.nonneg Ο) P.total (fun Ο _ => hd Ο) hp | |
| change P.expect delta β€ _ at hm | |
| apply hm.trans | |
| exact Real.rpow_le_rpow (P.expect_nonneg (fun Ο => Real.rpow_nonneg (hd Ο) p)) hi | |
| (by positivity) | |
| end FixedClauseThreshold.Computability | |
| end OAI | |