Download data/lean/OAI/Probability/RandomSAT/Main.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.57 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/RandomSAT/Main.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/RandomSAT/Main.lean
-
curl -L -o Main.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/RandomSAT/Main.lean
6.57 kB
| import OAI.Probability.RandomSAT.Convergence | |
| namespace OAI | |
| /-! | |
| For every fixed clause size at least three, the proper-clause satisfiability | |
| probability has a positive finite limiting threshold. No conclusion is asserted | |
| at the critical density. | |
| -/ | |
| namespace FixedClauseThreshold | |
| open Finset | |
| noncomputable section | |
| attribute [local instance] Classical.propDecidable | |
| def limitingCenter (k : β) : β := Filter.limsup (fun n : β => center n k) Filter.atTop | |
| theorem center_tendsto (k : β) (hk : 3 β€ k) : | |
| Filter.Tendsto (fun n : β => center n k) Filter.atTop (nhds (limitingCenter k)) := by | |
| have hb := center_bounds_eventually k hk | |
| have hUpper : Filter.IsBoundedUnder (Β· β€ Β·) Filter.atTop (fun n : β => center n k) := | |
| Filter.isBoundedUnder_of_eventually_le (hb.mono (fun _ h => h.2)) | |
| have hLower : Filter.IsBoundedUnder (Β· β₯ Β·) Filter.atTop (fun n : β => center n k) := | |
| Filter.isBoundedUnder_of_eventually_ge (hb.mono (fun _ h => h.1)) | |
| apply summable_min_convergence (fun n => center n k) (by norm_num : (0 : β) β€ 4) | |
| (delta_pos hk) hUpper hLower | |
| obtain β¨N, hadd, hnextβ© := center_comparisons k hk | |
| refine β¨N, ?_, ?_β© | |
| Β· intro r hr s hs | |
| simpa only [densityWindow, Nat.cast_min] using hadd r hr s hs | |
| Β· intro s hs | |
| exact hnext s hs | |
| theorem limitingCenter_bounds (k : β) (hk : 3 β€ k) : | |
| lowerCenterBound β€ limitingCenter k β§ limitingCenter k β€ (2 : β)^k + 1 := by | |
| have ht := center_tendsto k hk | |
| have hb := center_bounds_eventually k hk | |
| exact β¨ge_of_tendsto ht (hb.mono (fun _ h => h.1)), le_of_tendsto ht (hb.mono (fun _ h => h.2))β© | |
| theorem limitingCenter_pos (k : β) (hk : 3 β€ k) : 0 < limitingCenter k := | |
| lowerCenterBound_pos.trans_le (limitingCenter_bounds k hk).1 | |
| theorem limitingCenter_lt_cap (k : β) (hk : 3 β€ k) : limitingCenter k < capMultiplier k := by | |
| have hp : (1 : β) < 2^k := one_lt_powβ (by norm_num) (by omega : k β 0) | |
| have he : (capMultiplier k : β) = 2^k * 2 := by simp [capMultiplier, pow_succ] | |
| rw [he] | |
| have h := (limitingCenter_bounds k hk).2 | |
| linarith | |
| theorem floor_density_le_cap {n k : β} {c : β} (hc0 : 0 β€ c) (hcL : c β€ capMultiplier k) : | |
| βc * (n : β)ββ β€ mainCap n k := by | |
| have h := (Nat.floor_le (mul_nonneg hc0 (Nat.cast_nonneg n : (0 : β) β€ n))).trans | |
| (mul_le_mul_of_nonneg_right hcL (Nat.cast_nonneg n : (0 : β) β€ n)) | |
| exact_mod_cast (show (βc * (n : β)ββ : β) β€ (mainCap n k : β) by | |
| simpa only [mainCap, Nat.cast_mul] using h) | |
| theorem subcritical_limit (k : β) (hk : 3 β€ k) (c : β) (hc0 : 0 β€ c) | |
| (hc : c < limitingCenter k) : | |
| Filter.Tendsto (fun n : β => properSATProbability n k βc * (n : β)ββ) | |
| Filter.atTop (nhds 1) := by | |
| have hcL : c β€ capMultiplier k := (hc.trans (limitingCenter_lt_cap k hk)).le | |
| have hcenter : Filter.Tendsto (fun n : β => center n k - densityWindow n k) | |
| Filter.atTop (nhds (limitingCenter k)) := by | |
| simpa only [sub_zero] using (center_tendsto k hk).sub (densityWindow_tendsto k hk) | |
| have hmargin := hcenter.eventually (Ioi_mem_nhds hc) | |
| have hlower : βαΆ n : β in Filter.atTop, | |
| 1 - concentrationError n k β€ properSATProbability n k βc * (n : β)ββ := by | |
| filter_upwards [hmargin, Filter.eventually_ge_atTop (k + 1)] with n hmargin hn | |
| apply properSATProbability_center_lower hk hn (floor_density_le_cap hc0 hcL) | |
| have hn0 : 0 < n := by omega | |
| have hn' : (0 : β) < n := by exact_mod_cast hn0 | |
| rw [fluctuationWindow_eq_mul hn0] | |
| have hmul := mul_le_mul_of_nonneg_left hmargin.le hn'.le | |
| have hf := Nat.floor_le (mul_nonneg hc0 hn'.le) | |
| nlinarith | |
| have hlowT : Filter.Tendsto (fun n : β => 1 - concentrationError n k) Filter.atTop (nhds 1) := by | |
| simpa only [sub_zero] using (concentrationError_tendsto k hk).const_sub 1 | |
| exact tendsto_of_tendsto_of_tendsto_of_le_of_le' hlowT tendsto_const_nhds hlower | |
| (Filter.Eventually.of_forall fun n => properSATProbability_le_one n k _) | |
| theorem supercritical_limit_below_cap (k : β) (hk : 3 β€ k) (c : β) | |
| (hc : limitingCenter k < c) (hcL : c β€ capMultiplier k) : | |
| Filter.Tendsto (fun n : β => properSATProbability n k βc * (n : β)ββ) | |
| Filter.atTop (nhds 0) := by | |
| have hc0 : 0 β€ c := ((limitingCenter_pos k hk).trans hc).le | |
| have hd : Filter.Tendsto (fun n : β => 2 * densityWindow n k) Filter.atTop (nhds 0) := by | |
| simpa only [mul_zero] using (densityWindow_tendsto k hk).const_mul (2 : β) | |
| have hcenter : Filter.Tendsto (fun n : β => center n k + 2 * densityWindow n k) | |
| Filter.atTop (nhds (limitingCenter k)) := by | |
| simpa only [add_zero] using (center_tendsto k hk).add hd | |
| have hmargin := hcenter.eventually_lt_const hc | |
| have hupper : βαΆ n : β in Filter.atTop, | |
| properSATProbability n k βc * (n : β)ββ β€ concentrationError n k := by | |
| filter_upwards [hmargin, Filter.eventually_ge_atTop (k + 1)] with n hmargin hn | |
| apply properSATProbability_center_upper hk hn (floor_density_le_cap hc0 hcL) | |
| have hn0 : 0 < n := by omega | |
| have hn' : (0 : β) < n := by exact_mod_cast hn0 | |
| have hw := fluctuationWindow_one_le (n := n) hk hn0 | |
| have he := fluctuationWindow_eq_mul (k := k) hn0 | |
| have hmul := mul_le_mul_of_nonneg_left hmargin.le hn'.le | |
| have hf := Nat.lt_floor_add_one (c * (n : β)) | |
| nlinarith | |
| exact squeeze_zero' (Filter.Eventually.of_forall fun n => properSATProbability_nonneg n k _) | |
| hupper (concentrationError_tendsto k hk) | |
| theorem supercritical_limit (k : β) (hk : 3 β€ k) (c : β) | |
| (hc : limitingCenter k < c) : | |
| Filter.Tendsto (fun n : β => properSATProbability n k βc * (n : β)ββ) | |
| Filter.atTop (nhds 0) := by | |
| let d := min c (capMultiplier k : β) | |
| have hd : limitingCenter k < d := lt_min hc (limitingCenter_lt_cap k hk) | |
| have hdL : d β€ capMultiplier k := min_le_right _ _ | |
| have ht := supercritical_limit_below_cap k hk d hd hdL | |
| apply squeeze_zero' (Filter.Eventually.of_forall fun n => properSATProbability_nonneg n k _) _ ht | |
| filter_upwards [Filter.eventually_ge_atTop k] with n hn | |
| apply properSATProbability_antitone hn | |
| exact Nat.floor_mono (mul_le_mul_of_nonneg_right (min_le_left c (capMultiplier k : β)) (Nat.cast_nonneg n)) | |
| theorem main (k : β) (hk : 3 β€ k) : HasLimitingThreshold k := by | |
| refine β¨limitingCenter k, limitingCenter_pos k hk, ?_, ?_β© | |
| Β· intro c hc0 hc | |
| exact subcritical_limit k hk c hc0 hc | |
| Β· intro c hc | |
| exact supercritical_limit k hk c hc | |
| end | |
| end FixedClauseThreshold | |
| end OAI | |