Download data/lean/OAI/Probability/CriticalPercolation/Criticality/BoundaryCount.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.12 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Criticality/BoundaryCount.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Criticality/BoundaryCount.lean
-
curl -L -o BoundaryCount.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Criticality/BoundaryCount.lean
6.12 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Criticality.Weight | |
| import OAI.Probability.CriticalPercolation.GraphGeometry.Link2 | |
| namespace OAI | |
| section | |
| section CurrentModule2 | |
| noncomputable section | |
| open Set | |
| open scoped Classical BigOperators | |
| namespace CriticalPercolation.Sharpness | |
| open FiniteProduct ClusterDeletion | |
| lemma expect_exposure_finiteRange {I A B : Type*} [Fintype I] [Fintype A] | |
| (w : I β A β β) (hw : β e, β a, w e a = 1) | |
| (r : (I β A) β B) (D : B β Set I) | |
| (hr : β b, DependsOn (fun Ο => r Ο = b) (D b)) | |
| (f : B β (I β A) β β) (hf : β b, DependsOn (f b) (D b)αΆ) : | |
| expect w (fun Ο => f (r Ο) Ο) = | |
| expect w (fun Ο => expect w (f (r Ο))) := by | |
| let : Fintype (Set.range r) := (Set.finite_range r).fintype | |
| let r' : (I β A) β Set.range r := fun Ο => β¨r Ο,Ο,rflβ© | |
| exact expect_exposure w hw r' (fun b => D b.val) | |
| (fun b Ο Ο' hΟ => by | |
| apply propext | |
| simpa only [r',Subtype.ext_iff] using (hr b.val hΟ).to_iff) | |
| (fun b => f b.val) (fun b => hf b.val) | |
| variable {V E : Type*} [Fintype E] (G : BondGraph V E) | |
| lemma spatialMarkov (w : E β Prop β β) (hw : β e, β b, w e b = 1) | |
| (T : Set V) (F : Set V β SimpleGraph V β β) : | |
| expect w (fun Ο => F (roots (G.openGraph Ο) T) | |
| (delete (G.openGraph Ο) (roots (G.openGraph Ο) T))) = | |
| expect w (fun Ο => expect w (fun Ο' => F (roots (G.openGraph Ο) T) | |
| (delete (G.openGraph Ο') (roots (G.openGraph Ο) T)))) := by | |
| refine expect_exposure_finiteRange w hw | |
| (fun Ο => roots (G.openGraph Ο) T) G.incidentEdges | |
| (G.dependsOn_exact_roots T) | |
| (fun R Ο => F R (delete (G.openGraph Ο) R)) ?_ | |
| intro R Ο Ο' hΟ | |
| exact congrArg (F R) (G.delete_openGraph_dependsOn R hΟ) | |
| def boundaryCount (o : V) (R : Set V) (H : SimpleGraph V) : β := | |
| β e, if boundaryReach G R H o e then 1 else 0 | |
| def boundaryFlux (p : β) (o : V) (R : Set V) : β := | |
| p * expect (fun _ : E => weight p) | |
| (fun Ο => boundaryCount G o R (delete (G.openGraph Ο) R)) | |
| omit [Fintype E] in | |
| lemma closedPivot_reachesTarget (o : V) (T : Set V) (Ο : Set E) (e : E) : | |
| closedPivot (reachesTarget G o T) e Ο β | |
| o β roots (G.openGraph Ο) T β§ | |
| boundaryReach G (roots (G.openGraph Ο) T) | |
| (delete (G.openGraph Ο) (roots (G.openGraph Ο) T)) o e := by | |
| constructor | |
| Β· rintro β¨_,ho,heβ© | |
| exact β¨ho,(target_creating_iff G o T Ο e ho).mp heβ© | |
| Β· rintro β¨ho,heβ© | |
| exact β¨boundaryReach_closed G o T Ο e he,ho, | |
| (target_creating_iff G o T Ο e ho).mpr heβ© | |
| lemma sum_closedPivot_eq (p : β) (o : V) (T : Set V) : | |
| β e, probability p (closedPivot (reachesTarget G o T) e) = | |
| expect (fun _ : E => weight p) (fun Ο => | |
| if o β roots (G.openGraph Ο) T then | |
| expect (fun _ : E => weight p) (fun Ο' => boundaryCount G o | |
| (roots (G.openGraph Ο) T) | |
| (delete (G.openGraph Ο') (roots (G.openGraph Ο) T))) else 0) := by | |
| have hs := spatialMarkov G (fun _ : E => weight p) (fun _ => weight_sum p) | |
| T (fun R H => if o β R then boundaryCount G o R H else 0) | |
| unfold probability | |
| rw [β expect_sum] | |
| calc | |
| _ = expect (fun _ : E => weight p) (fun Ο => | |
| if o β roots (G.openGraph Ο) T then | |
| boundaryCount G o (roots (G.openGraph Ο) T) | |
| (delete (G.openGraph Ο) (roots (G.openGraph Ο) T)) else 0) := by | |
| congr 1 | |
| funext Ο | |
| have he (e : E) : closedPivot (reachesTarget G o T) e Ο β | |
| o β roots (G.openGraph Ο) T β§ boundaryReach G (roots (G.openGraph Ο) T) | |
| (delete (G.openGraph Ο) (roots (G.openGraph Ο) T)) o e := | |
| closedPivot_reachesTarget G o T Ο e | |
| simp only [he] | |
| by_cases ho : o β roots (G.openGraph Ο) T | |
| Β· simp [ho] | |
| Β· simp [ho,boundaryCount] | |
| _ = _ := by | |
| rw [hs] | |
| congr 1 | |
| funext Ο | |
| split_ifs <;> simp only [expect_zero] | |
| lemma exposedFlux_identity (p : β) (o : V) (T : Set V) : | |
| p * (β e, probability p (closedPivot (reachesTarget G o T) e)) = | |
| expect (fun _ : E => weight p) (fun Ο => | |
| if o β roots (G.openGraph Ο) T then | |
| boundaryFlux G p o (roots (G.openGraph Ο) T) else 0) := by | |
| rw [sum_closedPivot_eq, β expect_const_mul] | |
| congr 1 | |
| funext Ο | |
| split_ifs <;> simp only [boundaryFlux,mul_zero] | |
| theorem derivative_identity {p : β} (hp : p β Ioo 0 1) (o : V) (T : Set V) : | |
| p * (1-p) * deriv (fun q => probability q (reachesTarget G o T)) p = | |
| expect (fun _ : E => weight p) (fun Ο => | |
| if o β roots (G.openGraph Ο) T then | |
| boundaryFlux G p o (roots (G.openGraph Ο) T) else 0) := by | |
| have hd := hasDerivAt_probability_closedPivot hp (reachesTarget G o T) | |
| (fun _ _ h => reachesTarget_mono G o T h) | |
| rw [hd.deriv, β exposedFlux_identity] | |
| field_simp [(sub_pos.mpr hp.2).ne'] | |
| theorem differential_inequality {p a : β} (hp : p β Ioo 0 1) (o : V) (T : Set V) | |
| (hflux : β R : Set V, T β R β o β R β a β€ boundaryFlux G p o R) : | |
| a * (1-probability p (reachesTarget G o T)) β€ | |
| p * (1-p) * deriv (fun q => probability q (reachesTarget G o T)) p := by | |
| rw [derivative_identity G hp o T] | |
| have hcomp : expect (fun _ : E => weight p) | |
| (fun Ο => if o β roots (G.openGraph Ο) T then (1:β) else 0) = | |
| 1-probability p (reachesTarget G o T) := by | |
| calc | |
| _ = expect (fun _ : E => weight p) (fun Ο => | |
| 1-(if reachesTarget G o T Ο then (1:β) else 0)) := by | |
| congr 1 | |
| funext Ο | |
| unfold reachesTarget | |
| by_cases ho : o β roots (G.openGraph Ο) T <;> simp [ho] | |
| _ = _ := by | |
| rw [expect_sub,expect_const _ (fun _ => weight_sum p)] | |
| rfl | |
| rw [β hcomp, β expect_const_mul] | |
| apply expect_mono (fun _ b => weight_nonneg β¨hp.1.le,hp.2.leβ© b) | |
| intro Ο | |
| by_cases ho : o β roots (G.openGraph Ο) T | |
| Β· simp [ho] | |
| Β· simp only [ho,not_false_eq_true,ite_true,mul_one] | |
| exact hflux (roots (G.openGraph Ο) T) (roots_self _ _) ho | |
| end CriticalPercolation.Sharpness | |
| end | |
| end CurrentModule2 | |
| end | |
| end OAI | |