Download data/lean/OAI/Combinatorics/GraphThreshold/Predecessor.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.71 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/GraphThreshold/Predecessor.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/GraphThreshold/Predecessor.lean
-
curl -L -o Predecessor.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/GraphThreshold/Predecessor.lean
9.71 kB
| import OAI.Combinatorics.GraphThreshold.Basic | |
| import OAI.Combinatorics.GraphThreshold.LocalFailureNumerics | |
| import OAI.Combinatorics.GraphThreshold.CopyOrbits | |
| import Mathlib.Data.Nat.Choose.Bounds | |
| import Mathlib.Data.Finset.Max | |
| import Mathlib.Analysis.Complex.ExponentialBounds | |
| import Mathlib.Tactic | |
| namespace OAI | |
| /-! | |
| # Maximizing predecessors | |
| The predecessor is chosen by maximization over the actual finite powerset, | |
| including its empty member. The graph application uses distinct group-orbit | |
| copies and the actual containment probability, not labeled embeddings. | |
| -/ | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace LeanBlast.SecondKahnKalai | |
| /-- The standard real binomial upper bound, derived directly from the | |
| exponential series and the factorial upper bound on `choose`. -/ | |
| theorem choose_le_exp_div_pow (h r : β) (hr : 0 < r) : | |
| (h.choose r : β) β€ (Real.exp 1 * (h : β) / (r : β)) ^ r := by | |
| have hr0 : 0 < (r : β) := by exact_mod_cast hr | |
| have hrne : (r : β) β 0 := ne_of_gt hr0 | |
| have hfac : (r.factorial : β) β 0 := by exact_mod_cast Nat.factorial_ne_zero r | |
| have hexp : (r : β) ^ r / (r.factorial : β) β€ Real.exp 1 ^ r := by | |
| simpa only [β Real.exp_nat_mul, mul_one] using | |
| Real.pow_div_factorial_le_exp (r : β) (show 0 β€ (r : β) by positivity) r | |
| calc | |
| (h.choose r : β) β€ (h : β) ^ r / (r.factorial : β) := Nat.choose_le_pow_div r h | |
| _ = ((h : β) / (r : β)) ^ r * ((r : β) ^ r / (r.factorial : β)) := by | |
| rw [div_pow] | |
| field_simp | |
| _ β€ ((h : β) / (r : β)) ^ r * Real.exp 1 ^ r := | |
| mul_le_mul_of_nonneg_left hexp (by positivity) | |
| _ = (Real.exp 1 * (h : β) / (r : β)) ^ r := by | |
| rw [β mul_pow] | |
| congr 1 | |
| ring | |
| theorem two_choose_div_le_predecessor_power (h r : β) (hr : 0 < r) | |
| (hhr : h β€ 17 * r) : | |
| 2 * (h.choose r : β) / (128 : β) ^ r β€ | |
| 2 * (17 * Real.exp 1 / 128) ^ r := by | |
| have hr0 : 0 < (r : β) := by exact_mod_cast hr | |
| have hhr' : (h : β) β€ 17 * (r : β) := by exact_mod_cast hhr | |
| have hbase : Real.exp 1 * (h : β) / (r : β) β€ 17 * Real.exp 1 := by | |
| apply (div_le_iffβ hr0).mpr | |
| calc | |
| Real.exp 1 * (h : β) β€ Real.exp 1 * (17 * (r : β)) := | |
| mul_le_mul_of_nonneg_left hhr' (Real.exp_pos 1).le | |
| _ = _ := by ring | |
| have hchoose : (h.choose r : β) β€ (17 * Real.exp 1) ^ r := | |
| (choose_le_exp_div_pow h r hr).trans (pow_le_pow_leftβ (by positivity) hbase r) | |
| calc | |
| 2 * (h.choose r : β) / (128 : β) ^ r β€ | |
| 2 * (17 * Real.exp 1) ^ r / (128 : β) ^ r := | |
| div_le_div_of_nonneg_right (by nlinarith) (by positivity) | |
| _ = _ := by rw [div_pow]; ring | |
| theorem two_choose_div_lt_one (h r : β) (hr : 0 < r) (hhr : h β€ 17 * r) : | |
| 2 * (h.choose r : β) / (128 : β) ^ r < 1 := | |
| (two_choose_div_le_predecessor_power h r hr hhr).trans_lt | |
| (predecessor_power_lt_one hr) | |
| /-- Arithmetic form of the expectation constraint and internal-copy count bound. -/ | |
| theorem normalized_count_score_bound {a m h r : β} {q : β} | |
| (hq : 0 < q) (hm : 0 < m) (ha : a β€ h.choose r) | |
| (he : (1 / 2 : β) β€ (m : β) * q ^ r) : | |
| ((a : β) / (m : β)) / (128 * q) ^ r β€ | |
| 2 * (h.choose r : β) / (128 : β) ^ r := by | |
| apply (div_le_iffβ (pow_pos (by positivity : 0 < 128 * q) r)).mpr | |
| have hscale : (2 * (h.choose r : β) / (128 : β) ^ r) * (128 * q) ^ r = | |
| 2 * (h.choose r : β) * q ^ r := by | |
| rw [mul_pow] | |
| field_simp | |
| rw [hscale] | |
| apply (div_le_iffβ (show 0 < (m : β) by exact_mod_cast hm)).mpr | |
| have ha' : (a : β) β€ (h.choose r : β) := by exact_mod_cast ha | |
| have hprod := mul_le_mul_of_nonneg_left he | |
| (show 0 β€ 2 * (h.choose r : β) by positivity) | |
| nlinarith | |
| section FiniteMaximum | |
| variable {X : Type*} | |
| private theorem exists_powerset_max (I : Finset X) (score : Finset X β β) : | |
| β S β I.powerset, β U β I.powerset, score U β€ score S := | |
| Finset.exists_max_image I.powerset score β¨β , by simpβ© | |
| /-- A deterministic classical choice of a maximizer over all subsets of `I`. | |
| The empty set is included, so this definition also applies to empty `I`. -/ | |
| def maximizingSubset (I : Finset X) (score : Finset X β β) : Finset X := | |
| (exists_powerset_max I score).choose | |
| theorem maximizingSubset_subset (I : Finset X) (score : Finset X β β) : | |
| maximizingSubset I score β I := | |
| Finset.mem_powerset.mp (exists_powerset_max I score).choose_spec.1 | |
| theorem le_maximizingSubset (I : Finset X) (score : Finset X β β) | |
| {U : Finset X} (hU : U β I) : score U β€ score (maximizingSubset I score) := | |
| (exists_powerset_max I score).choose_spec.2 U (Finset.mem_powerset.mpr hU) | |
| end FiniteMaximum | |
| section OrbitPredecessor | |
| variable (G : Type*) [Group G] [Fintype G] | |
| variable {X : Type*} [DecidableEq X] [MulAction G X] | |
| def predecessorScore (I : Finset X) (Ο : β) (S : Finset X) : β := | |
| containmentProb G I S / Ο ^ S.card | |
| /-- The actual maximizing predecessor; the finite choice includes the empty set. -/ | |
| def maximizingPredecessor (I : Finset X) (Ο : β) : Finset X := | |
| maximizingSubset I (predecessorScore G I Ο) | |
| theorem maximizingPredecessor_subset (I : Finset X) (Ο : β) : | |
| maximizingPredecessor G I Ο β I := | |
| maximizingSubset_subset I _ | |
| theorem predecessorScore_le_max (I : Finset X) (Ο : β) | |
| {S : Finset X} (hS : S β I) : | |
| predecessorScore G I Ο S β€ predecessorScore G I Ο (maximizingPredecessor G I Ο) := | |
| le_maximizingSubset I _ hS | |
| @[simp] | |
| theorem predecessorScore_empty (I : Finset X) (Ο : β) : | |
| predecessorScore G I Ο β = 1 := by | |
| simp [predecessorScore] | |
| theorem one_le_predecessorScore_max (I : Finset X) (Ο : β) : | |
| 1 β€ predecessorScore G I Ο (maximizingPredecessor G I Ο) := by | |
| simpa using predecessorScore_le_max G I Ο (Finset.empty_subset I) | |
| theorem predecessorScore_eq_of_mem_copyOrbit (Ο : β) {I S Sβ : Finset X} | |
| (hSβ : Sβ β copyOrbit G S) : | |
| predecessorScore G I Ο Sβ = predecessorScore G I Ο S := by | |
| rw [predecessorScore, predecessorScore, | |
| containmentProb_eq_of_mem_copyOrbit G hSβ, card_eq_of_mem_copyOrbit G hSβ] | |
| /-- A positive observation pulls back to an actual subset of `I`; zero-probability | |
| observations cannot exceed the empty set's score. Thus the chosen finite | |
| maximum controls every observed set, not only subsets of the original copy. -/ | |
| theorem predecessorScore_le_max_all (I U : Finset X) (Ο : β) : | |
| predecessorScore G I Ο U β€ predecessorScore G I Ο (maximizingPredecessor G I Ο) := by | |
| by_cases hzero : containmentProb G I U = 0 | |
| Β· rw [predecessorScore, hzero, zero_div] | |
| exact zero_le_one.trans (one_le_predecessorScore_max G I Ο) | |
| Β· have hpos : 0 < containmentProb G I U := | |
| lt_of_le_of_ne (containmentProb_nonneg G I U) (Ne.symm hzero) | |
| obtain β¨V, hVI, hcopy, _β© := exists_pullback_of_containmentProb_pos G hpos | |
| rw [predecessorScore_eq_of_mem_copyOrbit G Ο hcopy] | |
| exact predecessorScore_le_max G I Ο hVI | |
| theorem predecessorScore_le_two_choose {I S : Finset X} {q : β} | |
| (hq : 0 < q) | |
| (hE : (1 / 2 : β) β€ (orbitCount G S : β) * q ^ S.card) : | |
| predecessorScore G I (128 * q) S β€ | |
| 2 * (I.card.choose S.card : β) / (128 : β) ^ S.card := by | |
| rw [predecessorScore, containmentProb_eq_internalCopyCount] | |
| exact normalized_count_score_bound hq (orbitCount_pos G S) | |
| (internalCopyCount_le_choose G I S) hE | |
| /-- The maximizing predecessor is less than one seventeenth of the current set. | |
| The only probabilistic input is the actual expectation constraint for its | |
| nonempty edge subsets. -/ | |
| theorem maximizingPredecessor_small (I : Finset X) (hI : I.Nonempty) | |
| {q : β} (hq : 0 < q) | |
| (hE : β S : Finset X, S β I β S.Nonempty β | |
| (1 / 2 : β) β€ (orbitCount G S : β) * q ^ S.card) : | |
| 17 * (maximizingPredecessor G I (128 * q)).card < I.card := by | |
| by_contra hsmall | |
| have hcardI : 0 < I.card := Finset.card_pos.mpr hI | |
| have hlarge : I.card β€ 17 * (maximizingPredecessor G I (128 * q)).card := by omega | |
| have hcardS : 0 < (maximizingPredecessor G I (128 * q)).card := by omega | |
| have hbound := predecessorScore_le_two_choose G (I := I) hq | |
| (hE _ (maximizingPredecessor_subset G I _) (Finset.card_pos.mp hcardS)) | |
| have hlt := hbound.trans_lt (two_choose_div_lt_one I.card _ hcardS hlarge) | |
| have hge := one_le_predecessorScore_max G I (128 * q) | |
| linarith | |
| theorem predecessor_copy_prob_pos (I : Finset X) (Ο : β) {Sβ : Finset X} | |
| (hSβ : Sβ β copyOrbit G (maximizingPredecessor G I Ο)) : | |
| 0 < containmentProb G I Sβ := | |
| containmentProb_pos_of_copy_subset G (maximizingPredecessor_subset G I Ο) hSβ | |
| theorem predecessor_conditional_ratio_le (I : Finset X) {Ο : β} (hΟ : 0 < Ο) | |
| {Sβ J : Finset X} | |
| (hSβ : Sβ β copyOrbit G (maximizingPredecessor G I Ο)) | |
| (hdisj : Disjoint Sβ J) : | |
| containmentProb G I (Sβ βͺ J) / containmentProb G I Sβ β€ Ο ^ J.card := by | |
| have hscore := predecessorScore_le_max_all G I (Sβ βͺ J) Ο | |
| rw [β predecessorScore_eq_of_mem_copyOrbit G Ο hSβ] at hscore | |
| simp only [predecessorScore, Finset.card_union_of_disjoint hdisj, pow_add] at hscore | |
| have hpowS : 0 < Ο ^ Sβ.card := pow_pos hΟ _ | |
| have hpowJ : 0 < Ο ^ J.card := pow_pos hΟ _ | |
| have hclear := (div_le_div_iffβ (mul_pos hpowS hpowJ) hpowS).mp hscore | |
| have hnum : containmentProb G I (Sβ βͺ J) β€ | |
| Ο ^ J.card * containmentProb G I Sβ := by | |
| apply (mul_le_mul_iff_rightβ hpowS).mp | |
| simpa only [mul_assoc, mul_comm, mul_left_comm] using hclear | |
| exact (div_le_iffβ (predecessor_copy_prob_pos G I Ο hSβ)).mpr hnum | |
| end OrbitPredecessor | |
| end LeanBlast.SecondKahnKalai | |
| end | |
| end OAI | |