introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
7.01 kB
import Mathlib
import OAI.Probability.CriticalPercolation.GraphGeometry.Column
import OAI.Probability.CriticalPercolation.GraphGeometry.UpdateKernel
namespace OAI
section
section
open Set MeasureTheory ProbabilityTheory
open scoped BigOperators
namespace CriticalPercolation.BondGraph
open CriticalPercolation.FiniteProduct CriticalPercolation.ClusterDeletion
open CriticalPercolation.ClusterColumns
open scoped Classical Matrix
variable {V E : Type*} [Fintype V] [Fintype E] (G : BondGraph V E)
noncomputable def clusterMatrix {n : β„•} (w : E β†’ Prop β†’ ℝ) (x : Fin n β†’ V) :
Matrix (Fin n) (Fin n) ℝ := fun i k => G.column w x k (fun _ => 1) i
omit [Fintype V] in
lemma column_zero_of_lt {n : β„•} (w : E β†’ Prop β†’ ℝ) (x : Fin n β†’ V)
{k i : Fin n} (hik : i < k) (F : Set V β†’ ℝ) : G.column w x k F i = 0 := by
unfold column
simp only [select_zero_of_lt _ _ hik, zero_mul, expect_zero]
omit [Fintype V] in
lemma column_diag {n : β„•} (w : E β†’ Prop β†’ ℝ) (x : Fin n β†’ V)
(k : Fin n) (F : Set V β†’ ℝ) :
G.column w x k F k = G.avoidedAverage w (earlier x k) (x k) F := by
unfold column avoidedAverage
simp only [select_diag, first]
congr 1
funext Ο‰
split_ifs <;> simp_all
omit [Fintype V] in
lemma clusterMatrix_lower {n : β„•} (w : E β†’ Prop β†’ ℝ) (x : Fin n β†’ V) :
(G.clusterMatrix w x).IsLowerTriangular := by
intro i k hik
exact G.column_zero_of_lt w x hik _
omit [Fintype V] in
lemma clusterMatrix_det_pos {n : β„•} (w : E β†’ Prop β†’ ℝ)
(hpos : βˆ€ e b, 0 ≀ w e b) (hclosed : βˆ€ e, 0 < w e False)
(x : Fin n β†’ V) (hx : Function.Injective x) : 0 < (G.clusterMatrix w x).det := by
rw [Matrix.det_of_isLowerTriangular _ (G.clusterMatrix_lower w x)]
apply Finset.prod_pos
intro k _
change 0 < G.column w x k (fun _ => 1) k
rw [G.column_diag]
exact G.avoidance_pos w hpos hclosed _ _ (root_not_mem_earlier hx k)
noncomputable def inverseColumn {n : β„•} (w : E β†’ Prop β†’ ℝ) (x : Fin n β†’ V)
(k : Fin n) (F : Set V β†’ ℝ) : Fin n β†’ ℝ :=
(G.clusterMatrix w x)⁻¹ *α΅₯ G.column w x k F
omit [Fintype V] in
lemma inverseColumn_const {n : β„•} (w : E β†’ Prop β†’ ℝ)
(hpos : βˆ€ e b, 0 ≀ w e b) (hclosed : βˆ€ e, 0 < w e False)
(x : Fin n β†’ V) (hx : Function.Injective x) (k : Fin n) (c : ℝ) :
G.inverseColumn w x k (fun _ => c) = c β€’ Pi.single k 1 := by
have hc : G.column w x k (fun _ => c) = c β€’ G.column w x k (fun _ => 1) := by
funext i
change expect w _ = c * expect w _
rw [← expect_const_mul]
congr 1
funext Ο‰
ring
have hunit : IsUnit (G.clusterMatrix w x).det :=
isUnit_iff_ne_zero.mpr (ne_of_gt (G.clusterMatrix_det_pos w hpos hclosed x hx))
unfold inverseColumn
rw [hc, Matrix.mulVec_smul]
congr 1
have hcol : G.column w x k (fun _ => 1) = G.clusterMatrix w x *α΅₯ Pi.single k 1 := by
ext i
simp [Matrix.mulVec_single, clusterMatrix]
rw [hcol, Matrix.mulVec_mulVec, Matrix.nonsing_inv_mul _ hunit, Matrix.one_mulVec]
lemma inverseColumn_decomposition {n : β„•} (w : E β†’ Prop β†’ ℝ)
(hw : βˆ€ e, βˆ‘ b, w e b = 1) (x : Fin n β†’ V) (k : Fin n) (F : Set V β†’ ℝ) :
G.inverseColumn w x k F =
G.inverseColumn w x k (G.clusterUpdate w (earlier x k) (x k) F) +
βˆ‘ l, if k < l then G.inverseColumn w x l
(G.expectedResidual w (earlier x k) (x k) F) else 0 := by
have hc : G.column w x k F =
G.column w x k (G.clusterUpdate w (earlier x k) (x k) F) +
βˆ‘ l, if k < l then G.column w x l
(G.expectedResidual w (earlier x k) (x k) F) else 0 := by
ext i
simpa only [Pi.add_apply, Finset.sum_apply, ite_apply, Pi.zero_apply] using
G.column_decomposition w hw x k F i
unfold inverseColumn
rw [hc, Matrix.mulVec_add, Matrix.mulVec_sum]
congr 1
apply Finset.sum_congr rfl
intro l _
split_ifs <;> simp
omit [Fintype V] in
lemma continuous_inverseColumn {n : β„•} (w : E β†’ Prop β†’ ℝ) (x : Fin n β†’ V)
(k i : Fin n) : Continuous (fun F : Set V β†’ ℝ => G.inverseColumn w x k F i) := by
unfold inverseColumn Matrix.mulVec dotProduct column expect
fun_prop
lemma inverseColumn_nonneg {n : β„•} (w : E β†’ Prop β†’ ℝ)
(hw : βˆ€ e, βˆ‘ b, w e b = 1) (hpos : βˆ€ e b, 0 ≀ w e b)
(hclosed : βˆ€ e, 0 < w e False) (x : Fin n β†’ V) (hx : Function.Injective x)
(k : Fin n) {F : Set V β†’ ℝ} (hF : Monotone F) (hF0 : βˆ€ U, 0 ≀ F U) :
βˆ€ i, 0 ≀ G.inverseColumn w x k F i := by
induction k using WellFoundedGT.induction generalizing F with
| ind k ih =>
have hstep (f : Set V β†’ ℝ) (hf : Monotone f) (i : Fin n) :
G.inverseColumn w x k (G.clusterUpdate w (earlier x k) (x k) f) i ≀
G.inverseColumn w x k f i := by
have hd := congrFun (G.inverseColumn_decomposition w hw x k f) i
simp only [Pi.add_apply, Finset.sum_apply, ite_apply, Pi.zero_apply] at hd
have hr : 0 ≀ βˆ‘ l, if k < l then G.inverseColumn w x l
(G.expectedResidual w (earlier x k) (x k) f) i else 0 := by
apply Finset.sum_nonneg
intro l _
split_ifs with hkl
Β· exact ih l hkl (G.expectedResidual_monotone w hw hpos _ _ hf)
(G.expectedResidual_nonneg w hw hpos _ _ hf) i
Β· exact le_rfl
linarith only [hd, hr]
have hmono (j : β„•) : Monotone ((G.clusterUpdate w (earlier x k) (x k))^[j] F) := by
induction j with
| zero => exact hF
| succ j hj =>
rw [Function.iterate_succ_apply']
exact G.clusterUpdate_monotone w hpos _ _ hj
have hbound (j : β„•) (i : Fin n) :
G.inverseColumn w x k ((G.clusterUpdate w (earlier x k) (x k))^[j] F) i ≀
G.inverseColumn w x k F i := by
induction j with
| zero => exact le_rfl
| succ j hj =>
rw [Function.iterate_succ_apply']
exact (hstep _ (hmono j) i).trans hj
let m := G.avoidedAverage w (earlier x k) (x k) F /
G.avoidedAverage w (earlier x k) (x k) (fun _ => 1)
have hm : 0 ≀ m := by
apply div_nonneg
Β· unfold avoidedAverage
apply expect_nonneg hpos
intro Ο‰
split_ifs
Β· exact le_rfl
Β· exact hF0 _
Β· exact le_of_lt (G.avoidance_pos w hpos hclosed _ _ (root_not_mem_earlier hx k))
have hlim : Filter.Tendsto
(fun j => (G.clusterUpdate w (earlier x k) (x k))^[j] F) Filter.atTop
(nhds (fun _ => m)) :=
tendsto_pi_nhds.mpr (fun U => G.tendsto_clusterUpdate w hw hpos hclosed _ _
(root_not_mem_earlier hx k) F U)
intro i
have hi := (G.continuous_inverseColumn w x k i).tendsto (fun _ => m) |>.comp hlim
have hb := le_of_tendsto hi (Filter.Eventually.of_forall (fun j => hbound j i))
rw [G.inverseColumn_const w hpos hclosed x hx] at hb
apply le_trans _ hb
change 0 ≀ m * (Pi.single (M := fun _ : Fin n => ℝ) k 1 i)
apply mul_nonneg hm
by_cases hki : k = i <;> simp [hki]
end CriticalPercolation.BondGraph
end
end
end OAI