Download data/lean/OAI/Probability/SKBarriers/Dynamics/BankCoverage.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.32 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKBarriers/Dynamics/BankCoverage.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKBarriers/Dynamics/BankCoverage.lean
-
curl -L -o BankCoverage.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKBarriers/Dynamics/BankCoverage.lean
5.32 kB
| import Mathlib | |
| import OAI.Probability.SKBarriers.SpinGlass.FiniteLaw | |
| import OAI.Probability.SKBarriers.SpinGlass.FiniteSampling | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open scoped BigOperators | |
| open Classical | |
| namespace SK.Analytic | |
| namespace FiniteLaw | |
| variable {X I A : Type*} [Fintype X] [Fintype I] [Fintype A] [DecidableEq I] [DecidableEq A] | |
| theorem iid_random_cell_miss (P : FiniteLaw X) (K : β) (u : A β I) (v : Fin K β I) | |
| (he : Function.Injective (Sum.elim u v)) | |
| (C : (A β X) β X β Prop) (R : X β X β Prop) {a Ξ΄ : β} (ha : 0β€a) | |
| (hcov : β w, P.prob (fun x => C w x β§ P.prob (fun y => C w y β§ R x y)<a) β€ Ξ΄) : | |
| (P.iid I).expect (fun z => P.prob (fun x => C (z β u) x β§ | |
| β k, Β¬(C (z β u) (z (v k)) β§ R x (z (v k))))) β€ Ξ΄+Real.exp (-a*K) := by | |
| classical | |
| let F (w : A β Fin K β X) : β := P.prob (fun x => C (w β Sum.inl) x β§ | |
| β k, Β¬(C (w β Sum.inl) (w (Sum.inr k)) β§ R x (w (Sum.inr k)))) | |
| have H := P.iid_expect_injective (Sum.elim u v) he F | |
| change (P.iid I).expect (fun z => F (z β Sum.elim u v)) β€ _ | |
| rw [H,P.iid_expect_sum F] | |
| calc | |
| _ β€ (P.iid A).expect (fun _ => Ξ΄+Real.exp (-a*K)) := by | |
| apply expect_mono | |
| intro w | |
| exact P.iid_cell_miss_bound (C w) R K ha (hcov w) | |
| _ = _ := expect_const _ _ | |
| end FiniteLaw | |
| abbrev BankIndex {p : β} (K : Fin p β β) := (j : Fin p) Γ Fin (K j) | |
| abbrev BankPrior {p : β} (pred : Fin p β Finset (Fin p)) (j : Fin p) := {i : Fin p // iβpred j} | |
| abbrev BankTuple {p : β} (K : Fin p β β) (pred : Fin p β Finset (Fin p)) (j : Fin p) := | |
| (i : BankPrior pred j) β Fin (K i.val) | |
| def bankJointIndex {p : β} (K : Fin p β β) (pred : Fin p β Finset (Fin p)) (j : Fin p) | |
| (T : BankTuple K pred j) : BankPrior pred j β Fin (K j) β BankIndex K := | |
| Sum.elim (fun i => β¨i.val,T iβ©) (fun a => β¨j,aβ©) | |
| theorem bankJointIndex_injective {p : β} (K : Fin p β β) (pred : Fin p β Finset (Fin p)) | |
| (j : Fin p) (hj : jβpred j) (T : BankTuple K pred j) : | |
| Function.Injective (bankJointIndex K pred j T) := by | |
| intro a b H | |
| cases a with | |
| | inl i => | |
| cases b with | |
| | inl k => | |
| have he : i.val=k.val := congrArg Sigma.fst H | |
| exact congrArg Sum.inl (Subtype.ext he) | |
| | inr k => | |
| have he : i.val=j := congrArg Sigma.fst H | |
| apply False.elim; apply hj; simpa only [he] using i.property | |
| | inr i => | |
| cases b with | |
| | inl k => | |
| have he : j=k.val := congrArg Sigma.fst H | |
| apply False.elim; apply hj; simpa only [β he] using k.property | |
| | inr k => | |
| have he : HEq i k := (Sigma.mk.inj_iff.mp H).2 | |
| exact congrArg Sum.inr (eq_of_heq he) | |
| def bankCell {n p : β} (K : Fin p β β) (pred : Fin p β Finset (Fin p)) (t : β) | |
| (z : BankIndex K β Config n) (j : Fin p) (T : BankTuple K pred j) (x : Config n) : Prop := | |
| β i : BankPrior pred j, |overlap (z β¨i.val,T iβ©) x|β€3*t | |
| def bankCoverageBad {n p : β} (K : Fin p β β) (pred : Fin p β Finset (Fin p)) (t q : β) | |
| (z : BankIndex K β Config n) (x : Config n) : Prop := | |
| β j : Fin p, β T : BankTuple K pred j, bankCell K pred t z j T x β§ | |
| β a : Fin (K j), Β¬(bankCell K pred t z j T (z β¨j,aβ©) β§ qβ€|overlap x (z β¨j,aβ©)|) | |
| theorem expected_bank_coverage_bad {n p : β} (P : FiniteLaw (Config n)) (K : Fin p β β) | |
| (pred : Fin p β Finset (Fin p)) (hpred : β j, jβpred j) (t q : β) (a Ξ΄ : Fin p β β) | |
| (ha : β j,0β€a j) | |
| (hcov : β j, β w : BankPrior pred j β Config n, | |
| P.prob (fun x => (βi,|overlap (w i) x|β€3*t) β§ | |
| P.prob (fun y => (βi,|overlap (w i) y|β€3*t) β§ qβ€|overlap x y|)<a j)β€Ξ΄ j) : | |
| (P.iid (BankIndex K)).expect (fun z => P.prob (bankCoverageBad K pred t q z)) β€ | |
| β j, Fintype.card (BankTuple K pred j)*(Ξ΄ j+Real.exp (-(a j)*(K j))) := by | |
| classical | |
| calc | |
| _ β€ (P.iid (BankIndex K)).expect (fun z => β j : Fin p, β T : BankTuple K pred j, | |
| P.prob (fun x => bankCell K pred t z j T x β§ | |
| β a : Fin (K j), Β¬(bankCell K pred t z j T (z β¨j,aβ©) β§ qβ€|overlap x (z β¨j,aβ©)|))) := by | |
| apply FiniteLaw.expect_mono | |
| intro z | |
| refine (P.prob_exists _).trans ?_ | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| exact P.prob_exists _ | |
| _ = β j : Fin p, β T : BankTuple K pred j, (P.iid (BankIndex K)).expect (fun z => | |
| P.prob (fun x => bankCell K pred t z j T x β§ | |
| β a : Fin (K j), Β¬(bankCell K pred t z j T (z β¨j,aβ©) β§ qβ€|overlap x (z β¨j,aβ©)|))) := by | |
| rw [FiniteLaw.expect_sum] | |
| apply Finset.sum_congr rfl | |
| intro j _ | |
| exact FiniteLaw.expect_sum _ _ | |
| _ β€ β j : Fin p, β _T : BankTuple K pred j, (Ξ΄ j+Real.exp (-(a j)*(K j))) := by | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| apply Finset.sum_le_sum | |
| intro T _ | |
| exact P.iid_random_cell_miss (I := BankIndex K) (A := BankPrior pred j) (K j) (fun i : BankPrior pred j => (β¨i.val,T iβ© : BankIndex K)) (fun b => (β¨j,bβ© : BankIndex K)) | |
| (bankJointIndex_injective K pred j (hpred j) T) (fun w x => βi,|overlap (w i) x|β€3*t) | |
| (fun x y => qβ€|overlap x y|) (ha j) (hcov j) | |
| _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] | |
| end SK.Analytic | |
| end | |
| end | |
| end OAI | |