Stat.Random­Graph.Path­Occupancy

This topic gives finite-sample occupancy bounds for connected components of uniform fine-cell draws on a finite path with independent Bernoulli marks.

Path 4 core · 1 supporting Path connectivity is order convexity of the occupied cells. ★ connected_run_cover

Connected runs on a finite path

Path connectivity is order convexity of the occupied cells. A relation on labelled vertices may omit any eligible edge: only connectivity within the specified set and equality-or-neighbour locality are used to obtain the run and its span.

def Adjacent reviewed
Causalean.Stat.RandomGraph.PathOccupancy

Two fine cells are equal or adjacent on the path.

Definition (Lean source)
K :
ℕ
a b :
Fin K
Adjacent a b :
Prop
clause 1
a.val ≤ b.val + 1
clause 2
b.val ≤ a.val + 1
Causalean.Stat.RandomGraph.PathOccupancy.Adjacent · Causalean/Stat/RandomGraph/PathOccupancy/Path.lean:19
def PathConnected reviewed
Causalean.Stat.RandomGraph.PathOccupancy

A finite set of fine cells contains every cell between any two of its members.

Definition (Lean source)
K :
ℕ
s :
a ∈ s :
b ∈ s :
c :
Fin K
a.val ≤ c.val
c.val ≤ b.val
PathConnected s :
Prop
c ∈ s
Causalean.Stat.RandomGraph.PathOccupancy.PathConnected · Causalean/Stat/RandomGraph/PathOccupancy/Path.lean:23
def ConnectedAssignment reviewed
Causalean.Stat.RandomGraph.PathOccupancy

An assignment to a finite labelled set has connected occupied cells.

Definition (Lean source)
ι :
Type*
K :
ℕ
x :
ι → Fin K
ConnectedAssignment x :
Prop
PathConnected (Finset.univ.image x)
Causalean.Stat.RandomGraph.PathOccupancy.ConnectedAssignment · Causalean/Stat/RandomGraph/PathOccupancy/Path.lean:29
theorem connected_run_cover reviewed
Causalean.Stat.RandomGraph.PathOccupancy

A nonempty, connected set of fine cells has an occupied left endpoint and lies in a run of length its cardinality.

Formal statement
K :
ℕ
s :
hs :
s.Nonempty
hc :
∃ a ∈ s, ∀ b ∈ s, a.val ≤ b.val ∧ b.val < a.val + s.card
Proof (Lean source)
theorem connected_run_cover {K : ℕ} (s : Finset (Fin K)) (hs : s.Nonempty) (hc : PathConnected s) : ∃ a ∈ s, ∀ b ∈ s, a.val ≤ b.val ∧ b.val < a.val + s.card := by obtain ⟨a, ha, hmin⟩ := Finset.exists_min_image s val hs refine ⟨a, ha, fun b hb => ⟨hmin b hb, ?_⟩⟩ have hsub : Icc a.val b.val ⊆ s.image val := by intro n hn obtain ⟨han, hnb⟩ := Finset.mem_Icc.mp hn let c : Fin K := ⟨n, lt_of_le_of_lt hnb b.isLt⟩ exact Finset.mem_image.mpr ⟨c, hc a ha b hb c han hnb, rfl⟩ have hcard := (Finset.card_le_card hsub).trans Finset.card_image_le rw [Nat.card_Icc] at hcard have hab := hmin b hb omega
Causalean.Stat.RandomGraph.PathOccupancy.connected_run_cover · Causalean/Stat/RandomGraph/PathOccupancy/Path.lean:33 · uses PathConnected
1 supporting declaration (lemmas, instances)
  • connected_image_of_local_relation theorem — A connected relation on a labelled subset whose edges join equal or adjacent assigned cells has connected occupied cells under the given assignment.
    ι :
    Type*
    K :
    ℕ
    s :
    x :
    ι → Fin K
    R :
    s → s → Prop
    hlocal :
    ∀ i j
    if
    R i j
    then
    Adjacent (x i) (x j)
    hconn :
    ∀ i j, EqvGen R i j
    PathConnected (s.image x)
    Proof (Lean source)
    theorem connected_image_of_local_relation {ι : Type*} {K : ℕ} (s : Finset ι) (x : ι → Fin K) (R : s → s → Prop) (hlocal : ∀ i j, R i j → Adjacent (x i) (x j)) (hconn : ∀ i j, EqvGen R i j) : PathConnected (s.image x) := by classical intro a ha b hb c hac hcb by_contra hmissing have hne : ∀ i : s, (x i).val ≠ c.val := by intro i heq apply hmissing exact Finset.mem_image.mpr ⟨i, i.property, Fin.ext heq⟩ have hcut : ∀ i j : s, EqvGen R i j → ((x i).val < c.val ↔ (x j).val < c.val) := by intro i j hij induction hij with | rel i j hij => obtain ⟨hij₁, hij₂⟩ := hlocal i j hij have hi := hne i have hj := hne j constructor <;> intro h <;> omega | refl i => exact Iff.rfl | symm i j hij ih => exact ih.symm | trans i j k hij hjk ihij ihjk => exact ihij.trans ihjk obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp ha obtain ⟨j, hj, rfl⟩ := Finset.mem_image.mp hb have hni := hne ⟨i, hi⟩ change (x i).val ≠ c.val at hni have hiff := hcut ⟨i, hi⟩ ⟨j, hj⟩ (hconn ⟨i, hi⟩ ⟨j, hj⟩) change (x i).val < c.val ↔ (x j).val < c.val at hiff have hleft : (x i).val < c.val := by omega have hright := hiff.mp hleft omega
    Causalean.Stat.RandomGraph.PathOccupancy.connected_image_of_local_relation · Causalean/Stat/RandomGraph/PathOccupancy/Path.lean:54
Components 9 core · 3 supporting Components are the equivalence classes of the symmetric, reflexive, transitive closure of the supplied relation. ★ pairedScore_le_subsets

Components of arbitrary local subrelations

Components are the equivalence classes of the symmetric, reflexive, transitive closure of the supplied relation. No eligible edge is required to be present. Pointwise domination by sums over labelled subsets permits the relation to depend on both cells and marks, or on additional randomness.

def component reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The component of a sample label under a relation contains all labels equivalent to it under the equivalence closure.

Definition (Lean source)
n :
ℕ
R :
Fin n → Fin n → Prop
i :
Fin n
component R i :
by classical exact Finset.univ.filter (EqvGen R i)
Causalean.Stat.RandomGraph.PathOccupancy.component · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:21
def components reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The component partition of a relation on labels is the set of its distinct equivalence classes, each included once.

Definition (Lean source)
n :
ℕ
R :
Fin n → Fin n → Prop
components R :
by classical exact Finset.univ.image (component R)
Causalean.Stat.RandomGraph.PathOccupancy.components · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:28
def Admissible reviewed
Causalean.Stat.RandomGraph.PathOccupancy

A relation and cell assignment are admissible for the coarse count, M, when each edge joins equal or neighbouring cells in the same coarse cell.

Definition (Lean source)
n K :
ℕ
M :
ℕ
x :
Fin n → Fin K
R :
Fin n → Fin n → Prop
i j :
R i j
Admissible M x R :
Prop
clause 1
Adjacent (x i) (x j)
clause 2
(x i).val / (K / M) = (x j).val / (K / M)
Causalean.Stat.RandomGraph.PathOccupancy.Admissible · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:35
def SameCoarsePair reviewed
Causalean.Stat.RandomGraph.PathOccupancy

Two subsets and an assignment share a coarse-pair envelope for coarse count M when every cell in both subsets lies in one consecutive paired coarse class.

Definition (Lean source)
n K :
ℕ
M :
ℕ
C D :
x :
Fin n → Fin K
SameCoarsePair M C D x :
Prop
∃ p < M / 2,
clause 1
i ∈ C :
pairClass K M (x i) = p
clause 2
j ∈ D :
pairClass K M (x j) = p
Causalean.Stat.RandomGraph.PathOccupancy.SameCoarsePair · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:43
def singleWeight reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The single-component score of a subset and marking is cardinality to the eighth times eight to the cardinality, when at least two labels are marked, and zero otherwise.

Definition (Lean source)
n :
ℕ
C :
b :
Fin n → Bool
singleWeight C b :
ℝ
by classical exact (C.card : ℝ) ^ 8 * 8 ^ C.card * if 2 ≤ markCount C b then 1 else 0
Causalean.Stat.RandomGraph.PathOccupancy.singleWeight · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:51
def singleScore reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The total single-component score for a relation and marking is the sum of the two-mark single-component weights over its partition.

Definition (Lean source)
n :
ℕ
R :
Fin n → Fin n → Prop
b :
Fin n → Bool
singleScore R b :
ℝ
∑ C ∈ components R, singleWeight C b
Causalean.Stat.RandomGraph.PathOccupancy.singleScore · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:59
def pairWeight reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The paired weight for two subsets, cells, and marks at coarse count M is the product of the two subsets' weights, each weight being the subset's cardinality to the fourth power times eight to the power of that cardinality, if each size is at least two, each contains a mark, and they share a coarse-pair envelope; otherwise it is zero.

Definition (Lean source)
n K :
ℕ
M :
ℕ
C D :
x :
Fin n → Fin K
b :
Fin n → Bool
pairWeight M C D x b :
ℝ
by classical exact if 2 ≤ C.card ∧
2 ≤ D.card ∧
1 ≤ markCount C b ∧
1 ≤ markCount D b ∧
SameCoarsePair M C D x then (C.card : ℝ) ^ 4 * 8 ^ C.card * (D.card : ℝ) ^ 4 * 8 ^ D.card else 0
Causalean.Stat.RandomGraph.PathOccupancy.pairWeight · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:64
def pairedScore reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The distinct-component paired score for coarse count, relation, cells, and marks is half the ordered sum over distinct components of size at least two with at least one mark each and a shared coarse pair.

Definition (Lean source)
n K :
ℕ
M :
ℕ
R :
Fin n → Fin n → Prop
x :
Fin n → Fin K
b :
Fin n → Bool
pairedScore M R x b :
ℝ
by classical exact (1 / 2 : ℝ) * ∑ C ∈ components R, ∑ D ∈ (components R).erase C, pairWeight M C D x b
Causalean.Stat.RandomGraph.PathOccupancy.pairedScore · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:76
theorem pairedScore_le_subsets reviewed
Causalean.Stat.RandomGraph.PathOccupancy

For an admissible relation, the distinct-component score is bounded by half the sum over ordered disjoint connected labelled subsets, for the coarse count, cells, relation, and marks.

Formal statement
n K :
ℕ
M :
ℕ
x :
Fin n → Fin K
R :
Fin n → Fin n → Prop
b :
Fin n → Bool
hR :
Admissible M x R
conclusion 1
pairedScore M R x b
≤ (1 / 2 : ℝ) * ∑ C ∈ Finset.univ.powerset, ∑ D ∈ Finset.univ.powerset, if Disjoint C D
conclusion 2
PathConnected (C.image x)
conclusion 3
PathConnected (D.image x) then pairWeight M C D x b else 0
Proof (Lean source)
theorem pairedScore_le_subsets {n K : ℕ} (M : ℕ) (x : Fin n → Fin K) (R : Fin n → Fin n → Prop) (b : Fin n → Bool) (hR : Admissible M x R) : pairedScore M R x b ≤ (1 / 2 : ℝ) * ∑ C ∈ Finset.univ.powerset, ∑ D ∈ Finset.univ.powerset, if Disjoint C D ∧ PathConnected (C.image x) ∧ PathConnected (D.image x) then pairWeight M C D x b else 0 := by let f : Finset (Fin n) → Finset (Fin n) → ℝ := fun C D => if Disjoint C D ∧ PathConnected (C.image x) ∧ PathConnected (D.image x) then pairWeight M C D x b else 0 have hn : ∀ C D, 0 ≤ f C D := by intro C D dsimp [f] split_ifs · unfold pairWeight split_ifs <;> positivity · exact le_rfl have hsub : components R ⊆ Finset.univ.powerset := by intro C _ exact Finset.mem_powerset.mpr (Finset.subset_univ C) unfold pairedScore apply mul_le_mul_of_nonneg_left _ (by norm_num) calc _ = ∑ C ∈ components R, ∑ D ∈ (components R).erase C, f C D := by apply Finset.sum_congr rfl intro C hC apply Finset.sum_congr rfl intro D hD obtain ⟨hne, hD⟩ := Finset.mem_erase.mp hD have hdis := (components_partition R).2.2 C hC D hD hne.symm dsimp [f] rw [if_pos ⟨hdis, (component_geometry M x R hR C hC).1, (component_geometry M x R hR D hD).1⟩] _ ≤ ∑ C ∈ components R, ∑ D ∈ Finset.univ.powerset, f C D := by apply Finset.sum_le_sum intro C _ exact Finset.sum_le_sum_of_subset_of_nonneg ((Finset.erase_subset C (components R)).trans hsub) (fun D _ _ => hn C D) _ ≤ _ := Finset.sum_le_sum_of_subset_of_nonneg hsub (by intro C _ _ exact Finset.sum_nonneg (fun D _ => hn C D))
Causalean.Stat.RandomGraph.PathOccupancy.pairedScore_le_subsets · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:197 · uses Admissible , PathConnected , pairWeight , pairedScore
3 supporting declarations (lemmas, instances)
  • components_partition theorem — The equivalence classes of any relation are nonempty, cover all sample labels, and are disjoint when distinct.
    n :
    ℕ
    R :
    Fin n → Fin n → Prop
    conclusion 1
    C ∈ components R :
    C.Nonempty
    conclusion 2
    i :
    Fin n
    ∃ C ∈ components R, i ∈ C
    conclusion 3
    C ∈ components R :
    D ∈ components R :
    C ≠ D
    Proof (Lean source)
    theorem components_partition {n : ℕ} (R : Fin n → Fin n → Prop) : (∀ C ∈ components R, C.Nonempty) ∧ (∀ i : Fin n, ∃ C ∈ components R, i ∈ C) ∧ (∀ C ∈ components R, ∀ D ∈ components R, C ≠ D → Disjoint C D) := by classical have hmem : ∀ i j, j ∈ component R i ↔ EqvGen R i j := by intro i j simp [component] refine ⟨?_, ?_, ?_⟩ · intro C hC obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hC exact ⟨i, (hmem i i).mpr (.refl i)⟩ · intro i exact ⟨component R i, Finset.mem_image.mpr ⟨i, Finset.mem_univ i, rfl⟩, (hmem i i).mpr (.refl i)⟩ · intro C hC D hD hne obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hC obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hD apply Finset.disjoint_left.mpr intro k hik hjk apply hne have hij : EqvGen R i j := .trans i k j ((hmem i k).mp hik) (.symm j k ((hmem j k).mp hjk)) ext l rw [hmem, hmem] exact ⟨fun hil => .trans j i l (.symm i j hij) hil, fun hjl => .trans i j l hij hjl⟩
    Causalean.Stat.RandomGraph.PathOccupancy.components_partition · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:85
  • component_geometry theorem — For an admissible local relation, each component has connected occupied cells and lies in one coarse cell, for the coarse count, cells, relation, and component.
    n K :
    ℕ
    M :
    ℕ
    x :
    Fin n → Fin K
    R :
    Fin n → Fin n → Prop
    hR :
    Admissible M x R
    C :
    hC :
    C ∈ components R
    conclusion 1
    PathConnected (C.image x)
    conclusion 2
    ∃ q, ∀ i ∈ C, (x i).val / (K / M) = q
    Proof (Lean source)
    theorem component_geometry {n K : ℕ} (M : ℕ) (x : Fin n → Fin K) (R : Fin n → Fin n → Prop) (hR : Admissible M x R) (C : Finset (Fin n)) (hC : C ∈ components R) : PathConnected (C.image x) ∧ ∃ q, ∀ i ∈ C, (x i).val / (K / M) = q := by classical obtain ⟨a, _, rfl⟩ := Finset.mem_image.mp hC have hmem : ∀ i, i ∈ component R a ↔ EqvGen R a i := by intro i simp [component] let S : component R a → component R a → Prop := fun i j => R i j -- Lift closure paths to the class: each intermediate vertex is equivalent to a. have hlift : ∀ i j, EqvGen R i j → ∀ (hi : i ∈ component R a) (hj : j ∈ component R a), EqvGen S ⟨i, hi⟩ ⟨j, hj⟩ := by intro i j hij induction hij with | rel i j hij => intro hi hj exact .rel _ _ hij | refl i => intro hi hj exact .refl _ | symm i j hij ih => intro hj hi exact .symm _ _ (ih hi hj) | trans i j k hij hjk ihij ihjk => intro hi hk have hj := (hmem j).mpr (.trans a i j ((hmem i).mp hi) hij) exact .trans _ _ _ (ihij hi hj) (ihjk hj hk) constructor · apply connected_image_of_local_relation (component R a) x S · intro i j hij exact (hR i j hij).1 · intro i j have hij : EqvGen R (i : Fin n) (j : Fin n) := .trans (i : Fin n) a (j : Fin n) (.symm a i ((hmem i).mp i.property)) ((hmem j).mp j.property) exact hlift i j hij i.property j.property · refine ⟨(x a).val / (K / M), ?_⟩ intro i hi have heq : ∀ u v, EqvGen R u v → (x u).val / (K / M) = (x v).val / (K / M) := by intro u v huv induction huv with | rel u v huv => exact (hR u v huv).2 | refl u => rfl | symm u v huv ih => exact ih.symm | trans u v w huv hvw ihuv ihvw => exact ihuv.trans ihvw exact (heq a i ((hmem i).mp hi)).symm
    Causalean.Stat.RandomGraph.PathOccupancy.component_geometry · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:115
  • singleScore_le_subsets theorem — For admissible cells and relation, the single-component score is bounded by the sum over all connected labelled subsets, for the given coarse count, cells, relation, and marks.
    n K :
    ℕ
    M :
    ℕ
    x :
    Fin n → Fin K
    R :
    Fin n → Fin n → Prop
    b :
    Fin n → Bool
    hR :
    Admissible M x R
    ≤ ∑ C ∈ Finset.univ.powerset, if PathConnected (C.image x) then singleWeight C b else 0
    Proof (Lean source)
    theorem singleScore_le_subsets {n K : ℕ} (M : ℕ) (x : Fin n → Fin K) (R : Fin n → Fin n → Prop) (b : Fin n → Bool) (hR : Admissible M x R) : singleScore R b ≤ ∑ C ∈ Finset.univ.powerset, if PathConnected (C.image x) then singleWeight C b else 0 := by have hn : ∀ C : Finset (Fin n), 0 ≤ singleWeight C b := by intro C unfold singleWeight positivity unfold singleScore calc _ = ∑ C ∈ components R, if PathConnected (C.image x) then singleWeight C b else 0 := by apply Finset.sum_congr rfl intro C hC rw [if_pos (component_geometry M x R hR C hC).1] _ ≤ _ := Finset.sum_le_sum_of_subset_of_nonneg (fun C _ => Finset.mem_powerset.mpr (Finset.subset_univ C)) (by intro C _ _ split_ifs <;> first | exact hn C | exact le_rfl)
    Causalean.Stat.RandomGraph.PathOccupancy.singleScore_le_subsets · Causalean/Stat/RandomGraph/PathOccupancy/Components.lean:170
Probability 3 core · 4 supporting The model specifies exact uniform singleton masses on the finite path, exact Bernoulli marginals, independence within each family, and independence of the two complete vectors. ★ fixed_subset_assignment_mark_probability

Fixed labelled subset probabilities for uniform samples and independent marks

The model specifies exact uniform singleton masses on the finite path, exact Bernoulli marginals, independence within each family, and independence of the two complete vectors. Thus it is a genuine iid uniform model, with no upper-mass surrogate. All event bounds are derived, rather than assumed in the model.

structure UniformMarkedSample reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The sample measure, cell variables, mark variables, and success probability specify an iid uniform marked sample through probability-law normalization, [a valid mark probability] (hyp:epsilon_nonneg,epsilon_le_one), [measurable cells and marks] (hyp:cells_measurable,marks_measurable), uniform cell and Bernoulli mark marginals, [within-family independence] (hyp:cells_independent,marks_independent), and independence of the two complete vectors.

Definition (Lean source)
Ω :
Type u_1
shared
n K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
probability :
epsilon_nonneg :
0 ≤ ε
epsilon_le_one :
ε ≤ 1
cells_measurable :
∀ i, Measurable (X i)
marks_measurable :
∀ i, Measurable (B i)
cells_uniform :
∀ i a, μ {ω | X i ω = a} = (K : ℝ≥0∞)⁻¹
marks_bernoulli :
∀ i b, μ {ω | B i ω = b} = ofReal (if b = true then ε else 1 - ε)
cells_independent :
iIndepFun X μ
marks_independent :
iIndepFun B μ
blocks_independent :
IndepFun (fun ω i => X i ω) (fun ω i => B i ω) μ
Causalean.Stat.RandomGraph.PathOccupancy.UniformMarkedSample · Causalean/Stat/RandomGraph/PathOccupancy/Probability.lean:24
def markCount reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The marked cardinality of a labelled subset under a Boolean marking is its number of true marks.

Definition (Lean source)
n :
ℕ
s :
b :
Fin n → Bool
markCount s b :
ℕ
(s.filter (fun i => b i = true)).card
Causalean.Stat.RandomGraph.PathOccupancy.markCount · Causalean/Stat/RandomGraph/PathOccupancy/Probability.lean:46
theorem fixed_subset_assignment_mark_probability reviewed
Causalean.Stat.RandomGraph.PathOccupancy

In the uniform marked model, cell assignments on a fixed subset and mark assignments on any fixed subset hold jointly with probability exactly 1/K to the power of the size of the first subset, times the product over the second subset of ε for each label prescribed a true mark and 1 − ε for each label prescribed a false mark. The two subsets may overlap or be different.

Formal statement
Ω :
Type u_1
shared
n K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
h :
s t :
a :
s → Fin K
b :
t → Bool
μ {ω | (∀ i : s, X i ω = a i) ∧ (∀ i : t, B i ω = b i)}
= (K : ℝ≥0∞)⁻¹ ^ s.card * ∏ i : t, ofReal (if b i = true then ε else 1 - ε)
Proof (Lean source)
theorem fixed_subset_assignment_mark_probability {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (s t : Finset (Fin n)) (a : s → Fin K) (b : t → Bool) : μ {ω | (∀ i : s, X i ω = a i) ∧ (∀ i : t, B i ω = b i)} = (K : ℝ≥0∞)⁻¹ ^ s.card * ∏ i : t, ofReal (if b i = true then ε else 1 - ε) := by classical have hi := h.marks_independent.precomp (g := fun i : t => (i : Fin n)) val_injective have hp := hi.measure_inter_preimage_eq_mul Finset.univ (sets := fun i => {b i}) (fun _ _ => MeasurableSet.singleton _) have hm : μ {ω | ∀ i : t, B i ω = b i} = ∏ i : t, ofReal (if b i = true then ε else 1 - ε) := by have he : (⋂ i ∈ (Finset.univ : Finset t), B (i : Fin n) ⁻¹' {b i}) = {ω | ∀ i : t, B i ω = b i} := by ext ω; simp rw [he] at hp simp only [preimage, Set.mem_singleton_iff] at hp exact hp.trans (Finset.prod_congr rfl (fun i _ => h.marks_bernoulli i (b i))) have hb := h.blocks_independent.measure_inter_preimage_eq_mul {x | ∀ i : s, x i = a i} {y | ∀ i : t, y i = b i} (by simpa only [preimage, Set.mem_singleton_iff, Set.iInter_ofPred] using (MeasurableSet.iInter fun i : s => (measurable_pi_apply (i : Fin n) : Measurable (fun x : Fin n → Fin K => x i)) (MeasurableSet.singleton (a i)))) (by simpa only [preimage, Set.mem_singleton_iff, Set.iInter_ofPred] using (MeasurableSet.iInter fun i : t => (measurable_pi_apply (i : Fin n) : Measurable (fun x : Fin n → Bool => x i)) (MeasurableSet.singleton (b i)))) change μ {ω | (∀ i : s, X i ω = a i) ∧ (∀ i : t, B i ω = b i)} = _ at hb rw [hb] change μ {ω | ∀ i : s, X i ω = a i} * μ {ω | ∀ i : t, B i ω = b i} = _ rw [fixed_subset_assignment_probability h, hm]
Causalean.Stat.RandomGraph.PathOccupancy.fixed_subset_assignment_mark_probability · Causalean/Stat/RandomGraph/PathOccupancy/Probability.lean:73 · uses UniformMarkedSample
4 supporting declarations (lemmas, instances)
  • fixed_subset_assignment_probability theorem — In the uniform marked model, any specified assignments on a fixed labelled subset have exact reciprocal-power probability.
    Ω :
    Type u_1
    shared
    n K :
    ℕ
    μ :
    X :
    Fin n → Ω → Fin K
    B :
    Fin n → Ω → Bool
    ε :
    ℝ
    h :
    s :
    a :
    s → Fin K
    μ {ω | ∀ i : s, X i ω = a i} = (K : ℝ≥0∞)⁻¹ ^ s.card
    Proof (Lean source)
    theorem fixed_subset_assignment_probability {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (s : Finset (Fin n)) (a : s → Fin K) : μ {ω | ∀ i : s, X i ω = a i} = (K : ℝ≥0∞)⁻¹ ^ s.card := by classical have hi := h.cells_independent.precomp (g := fun i : s => (i : Fin n)) val_injective have hp := hi.measure_inter_preimage_eq_mul Finset.univ (sets := fun i => {a i}) (fun _ _ => MeasurableSet.singleton _) have he : (⋂ i ∈ (Finset.univ : Finset s), X (i : Fin n) ⁻¹' {a i}) = {ω | ∀ i : s, X i ω = a i} := by ext ω; simp rw [he] at hp simp only [preimage, Set.mem_singleton_iff] at hp simpa only [h.cells_uniform, Finset.prod_const, Finset.card_univ, Fintype.card_coe] using hp
    Causalean.Stat.RandomGraph.PathOccupancy.fixed_subset_assignment_probability · Causalean/Stat/RandomGraph/PathOccupancy/Probability.lean:51
  • assignment_two_specified_marks_probability theorem — A fixed cell assignment and two distinct successful marks under the uniform marked model have the exact product probability.
    Ω :
    Type u_1
    shared
    n K :
    ℕ
    μ :
    X :
    Fin n → Ω → Fin K
    B :
    Fin n → Ω → Bool
    ε :
    ℝ
    h :
    s :
    a :
    s → Fin K
    i j :
    Fin n
    hij :
    i ≠ j
    (μ {ω | (∀ k : s, X k ω = a k) ∧ B i ω = true ∧ B j ω = true}).toReal
    = ε ^ 2 / (K : ℝ) ^ s.card
    Proof (Lean source)
    theorem assignment_two_specified_marks_probability {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (s : Finset (Fin n)) (a : s → Fin K) (i j : Fin n) (hij : i ≠ j) : (μ {ω | (∀ k : s, X k ω = a k) ∧ B i ω = true ∧ B j ω = true}).toReal = ε ^ 2 / (K : ℝ) ^ s.card := by classical have hp := fixed_subset_assignment_mark_probability h s {i, j} a (fun _ => true) have he : {ω | (∀ k : s, X k ω = a k) ∧ ∀ k : (↑({i, j} : Finset (Fin n))), B k ω = true} = {ω | (∀ k : s, X k ω = a k) ∧ B i ω = true ∧ B j ω = true} := by ext ω simp rw [he] at hp simp only [ite_true, Finset.prod_const, Finset.card_univ, Fintype.card_coe, Finset.card_pair hij] at hp rw [hp] simp only [ENNReal.toReal_mul, ENNReal.toReal_pow, ENNReal.toReal_inv, ENNReal.toReal_natCast, ENNReal.toReal_ofReal h.epsilon_nonneg] simp [div_eq_mul_inv, mul_comm]
    Causalean.Stat.RandomGraph.PathOccupancy.assignment_two_specified_marks_probability · Causalean/Stat/RandomGraph/PathOccupancy/Probability.lean:114
  • assignment_two_marks_probability_le theorem — In the independent uniform model, a fixed assignment with at least two marks has probability at most the reciprocal-power cell probability times the quadratic Bernoulli union factor.
    Ω :
    Type u_1
    shared
    n K :
    ℕ
    μ :
    X :
    Fin n → Ω → Fin K
    B :
    Fin n → Ω → Bool
    ε :
    ℝ
    h :
    s :
    a :
    s → Fin K
    (μ {ω | (∀ i : s, X i ω = a i) ∧ 2 ≤ markCount s (fun i => B i ω)}).toReal
    ≤ ε ^ 2 * (s.card : ℝ) ^ 2 / (K : ℝ) ^ s.card
    Proof (Lean source)
    theorem assignment_two_marks_probability_le {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (s : Finset (Fin n)) (a : s → Fin K) : (μ {ω | (∀ i : s, X i ω = a i) ∧ 2 ≤ markCount s (fun i => B i ω)}).toReal ≤ ε ^ 2 * (s.card : ℝ) ^ 2 / (K : ℝ) ^ s.card := by classical have : IsProbabilityMeasure μ := h.probability let E : s × s → Set Ω := fun p => if (p.1 : Fin n) = p.2 then ∅ else {ω | (∀ i : s, X i ω = a i) ∧ B p.1 ω = true ∧ B p.2 ω = true} have hsub : {ω | (∀ i : s, X i ω = a i) ∧ 2 ≤ markCount s (fun i => B i ω)} ⊆ ⋃ p, E p := by intro ω hω obtain ⟨i, hi, j, hj, hij⟩ := Finset.one_lt_card.mp hω.2 obtain ⟨his, hib⟩ := Finset.mem_filter.mp hi obtain ⟨hjs, hjb⟩ := Finset.mem_filter.mp hj refine Set.mem_iUnion.mpr ⟨(⟨i, his⟩, ⟨j, hjs⟩), ?_⟩ simpa [E, hij] using intro hω.1 (intro hib hjb) have hbound : ∀ p : s × s, μ.real (E p) ≤ ε ^ 2 / (K : ℝ) ^ s.card := by intro p by_cases hij : (p.1 : Fin n) = p.2 · simp only [E, if_pos hij, measureReal_empty] exact div_nonneg (sq_nonneg ε) (pow_nonneg (Nat.cast_nonneg K) _) · exact le_of_eq (by simpa only [E, if_neg hij, Measure.real] using assignment_two_specified_marks_probability h s a p.1 p.2 hij) calc _ ≤ μ.real (⋃ p, E p) := measureReal_mono hsub _ ≤ ∑ p : s × s, μ.real (E p) := measureReal_iUnion_fintype_le E _ ≤ ∑ _p : s × s, ε ^ 2 / (K : ℝ) ^ s.card := Finset.sum_le_sum (fun p _ => hbound p) _ = _ := by simp [Fintype.card_prod, Fintype.card_coe]; ring
    Causalean.Stat.RandomGraph.PathOccupancy.assignment_two_marks_probability_le · Causalean/Stat/RandomGraph/PathOccupancy/Probability.lean:137
  • assignment_pair_marks_probability_le theorem — In the independent uniform model, assignments on two disjoint labelled subsets with one mark in each have probability at most the reciprocal-power cell probability times ε² times the two sizes.
    Ω :
    Type u_1
    shared
    n K :
    ℕ
    μ :
    X :
    Fin n → Ω → Fin K
    B :
    Fin n → Ω → Bool
    ε :
    ℝ
    h :
    s t :
    hdisj :
    a :
    s → Fin K
    b :
    t → Fin K
    (μ {ω | (∀ i : s, X i ω = a i) ∧ (∀ i : t, X i ω = b i) ∧ 1 ≤ markCount s (fun i => B i ω) ∧ 1 ≤ markCount t (fun i => B i ω)}).toReal
    ≤ ε ^ 2 * (s.card : ℝ) * (t.card : ℝ) / (K : ℝ) ^ (s.card + t.card)
    Proof (Lean source)
    theorem assignment_pair_marks_probability_le {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (s t : Finset (Fin n)) (hdisj : Disjoint s t) (a : s → Fin K) (b : t → Fin K) : (μ {ω | (∀ i : s, X i ω = a i) ∧ (∀ i : t, X i ω = b i) ∧ 1 ≤ markCount s (fun i => B i ω) ∧ 1 ≤ markCount t (fun i => B i ω)}).toReal ≤ ε ^ 2 * (s.card : ℝ) * (t.card : ℝ) / (K : ℝ) ^ (s.card + t.card) := by classical have : IsProbabilityMeasure μ := h.probability let c : (↑(s ∪ t) : Type) → Fin K := fun i => if hi : (i : Fin n) ∈ s then a ⟨i, hi⟩ else b ⟨i, (Finset.mem_union.mp i.property).resolve_left hi⟩ have hc : ∀ ω, (∀ i : (↑(s ∪ t) : Type), X i ω = c i) ↔ (∀ i : s, X i ω = a i) ∧ (∀ i : t, X i ω = b i) := by intro ω constructor · intro hw constructor · intro i simpa only [c, dif_pos i.property] using hw ⟨i, Finset.mem_union_left t i.property⟩ · intro i have hi : (i : Fin n) ∉ s := fun hs => Finset.disjoint_left.mp hdisj hs i.property simpa only [c, dif_neg hi] using hw ⟨i, mem_union_right s i.property⟩ · rintro ⟨hs, ht⟩ i by_cases hi : (i : Fin n) ∈ s · simpa only [c, dif_pos hi] using hs ⟨i, hi⟩ · simpa only [c, dif_neg hi] using ht ⟨i, (Finset.mem_union.mp i.property).resolve_left hi⟩ let E : s × t → Set Ω := fun p => {ω | (∀ i : (↑(s ∪ t) : Type), X i ω = c i) ∧ B p.1 ω = true ∧ B p.2 ω = true} have hsub : {ω | (∀ i : s, X i ω = a i) ∧ (∀ i : t, X i ω = b i) ∧ 1 ≤ markCount s (fun i => B i ω) ∧ 1 ≤ markCount t (fun i => B i ω)} ⊆ ⋃ p, E p := by rintro ω ⟨hs, ht, hms, hmt⟩ obtain ⟨i, hi⟩ := Finset.one_le_card.mp hms obtain ⟨j, hj⟩ := Finset.one_le_card.mp hmt obtain ⟨his, hib⟩ := Finset.mem_filter.mp hi obtain ⟨hjt, hjb⟩ := Finset.mem_filter.mp hj exact Set.mem_iUnion.mpr ⟨(⟨i, his⟩, ⟨j, hjt⟩), (hc ω).mpr ⟨hs, ht⟩, hib, hjb⟩ have hbound : ∀ p : s × t, μ.real (E p) = ε ^ 2 / (K : ℝ) ^ (s.card + t.card) := by intro p have hij : (p.1 : Fin n) ≠ p.2 := by intro he exact Finset.disjoint_left.mp hdisj p.1.property (he ▸ p.2.property) simpa only [E, Measure.real, Finset.card_union_of_disjoint hdisj] using assignment_two_specified_marks_probability h (s ∪ t) c p.1 p.2 hij calc _ ≤ μ.real (⋃ p, E p) := measureReal_mono hsub _ ≤ ∑ p : s × t, μ.real (E p) := measureReal_iUnion_fintype_le E _ = ∑ _p : s × t, ε ^ 2 / (K : ℝ) ^ (s.card + t.card) := Finset.sum_congr rfl (fun p _ => hbound p) _ = _ := by simp [Fintype.card_prod, Fintype.card_coe]; ring
    Causalean.Stat.RandomGraph.PathOccupancy.assignment_pair_marks_probability_le · Causalean/Stat/RandomGraph/PathOccupancy/Probability.lean:178
Pair­Classes 2 core · 0 supporting A pair class groups two adjacent coarse cells.

Consecutive coarse-cell pair classes

A pair class groups two adjacent coarse cells. These definitions are independent of counting and component proofs, allowing those proof layers to share a stable interface. Divisibility and evenness are imposed by the counting theorems.

def pairClass reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The index of the consecutive coarse-cell pair containing a fine cell, for fine and coarse cell counts K and M, is the cell's position divided by twice the coarse-cell width K/M, both quotients rounded down (and equal to zero when the width K/M rounds down to zero).

Definition (Lean source)
K M :
ℕ
a :
Fin K
pairClass K M a :
ℕ
a.val / (2 * (K / M))
Causalean.Stat.RandomGraph.PathOccupancy.pairClass · Causalean/Stat/RandomGraph/PathOccupancy/PairClasses.lean:16
def SamePair reviewed
Causalean.Stat.RandomGraph.PathOccupancy

Two labelled assignments have all their cells in one common consecutive coarse-cell pair, with pair index below half the coarse count, for the given cell counts.

Definition (Lean source)
ι κ :
Type*
K M :
ℕ
x :
ι → Fin K
y :
κ → Fin K
SamePair K M x y :
Prop
∃ p < M / 2,
clause 1
i :
pairClass K M (x i) = p
clause 2
j :
pairClass K M (y j) = p
Causalean.Stat.RandomGraph.PathOccupancy.SamePair · Causalean/Stat/RandomGraph/PathOccupancy/PairClasses.lean:22
Arithmetic 3 core · 3 supporting Binomial and factorial bounds absorb labelled subset counts into powers of 8 exp(1) n/K. ★ occupancySeries_geometric_le

Finite occupancy majorants

Binomial and factorial bounds absorb labelled subset counts into powers of 8 exp(1) n/K. These finite bounds hold at every positive density; the optional geometric estimate uses the required small-density hypothesis explicitly.

def occupancyZ reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The density parameter for n uniform draws into K cells is eight times exp(1) times n/K.

Definition (Lean source)
n K :
ℕ
occupancyZ n K :
ℝ
8 * exp 1 * n / K
Causalean.Stat.RandomGraph.PathOccupancy.occupancyZ · Causalean/Stat/RandomGraph/PathOccupancy/Arithmetic.lean:21
def occupancySeries reviewed
Causalean.Stat.RandomGraph.PathOccupancy

The finite majorant of order p for sample and cell counts is the sum, over sizes m from two through n, of m to the power p times the density parameter 8 exp(1) n/K raised to the power m; it is zero when n is below two.

Definition (Lean source)
p n K :
ℕ
occupancySeries p n K :
ℝ
∑ j ∈ range (n - 1), (j + 2 : ℝ) ^ p * occupancyZ n K ^ (j + 2)
Causalean.Stat.RandomGraph.PathOccupancy.occupancySeries · Causalean/Stat/RandomGraph/PathOccupancy/Arithmetic.lean:25
theorem occupancySeries_geometric_le reviewed
Causalean.Stat.RandomGraph.PathOccupancy

For an order p, a sample size n, and a cell count K with p at most eleven, K positive, and density n / K at most 2 to the power −40, the finite occupancy series is at most twice its size-two term, namely 2 · 2^p times the square of the occupancy parameter.

Formal statement
p n K :
ℕ
hp :
p ≤ 11
hK :
0 < K
hdensity :
(n : ℝ) / K ≤ (2 : ℝ) ^ (-40 : ℤ)
occupancySeries p n K ≤ 2 * (2 : ℝ) ^ p * occupancyZ n K ^ 2
Proof (Lean source)
theorem occupancySeries_geometric_le (p n K : ℕ) (hp : p ≤ 11) (hK : 0 < K) (hdensity : (n : ℝ) / K ≤ (2 : ℝ) ^ (-40 : ℤ)) : occupancySeries p n K ≤ 2 * (2 : ℝ) ^ p * occupancyZ n K ^ 2 := by obtain ⟨hz, hzsmall⟩ := occupancyZ_small n K hK hdensity have hratio : (2 : ℝ) ^ p * occupancyZ n K ≤ 1 / 2 := by calc _ ≤ (2 : ℝ) ^ 11 * (2 : ℝ) ^ (-35 : ℤ) := by exact mul_le_mul (pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) hp) hzsmall hz (by positivity) _ ≤ 1 / 2 := by norm_num let t : ℕ → ℝ := fun j => (j + 2 : ℝ) ^ p * occupancyZ n K ^ (j + 2) have ht : ∀ j, 0 ≤ t j := by intro j dsimp [t] positivity have hstep : ∀ j, t (j + 1) ≤ t j / 2 := by intro j have hbase : (j : ℝ) + 1 + 2 ≤ 2 * ((j : ℝ) + 2) := by have : (0 : ℝ) ≤ j := Nat.cast_nonneg j linarith calc t (j + 1) ≤ (2 * ((j : ℝ) + 2)) ^ p * occupancyZ n K ^ (j + 1 + 2) := by dsimp [t] push_cast gcongr _ = t j * ((2 : ℝ) ^ p * occupancyZ n K) := by dsimp [t] rw [show j + 1 + 2 = (j + 2) + 1 by omega, pow_succ, mul_pow] ring _ ≤ t j * (1 / 2) := mul_le_mul_of_nonneg_left hratio (ht j) _ = t j / 2 := by ring have hsum : ∀ N, (∑ j ∈ range N, t j) + 2 * t N ≤ 2 * t 0 := by intro N induction N with | zero => simp | succ N ih => rw [Finset.sum_range_succ] have := hstep N change (∑ j ∈ range N, t j) + t N + 2 * t (N + 1) ≤ 2 * t 0 linarith have hb := hsum (n - 1) have hn := ht (n - 1) have : (∑ j ∈ range (n - 1), t j) ≤ 2 * t 0 := by linarith simpa [occupancySeries, t, mul_assoc] using this
Causalean.Stat.RandomGraph.PathOccupancy.occupancySeries_geometric_le · Causalean/Stat/RandomGraph/PathOccupancy/Arithmetic.lean:127 · uses occupancySeries , occupancyZ
3 supporting declarations (lemmas, instances)
  • labelled_weight_majorant theorem — With positive cell count and size at least two, the binomial subset count times the connected-assignment and mark-size weights is bounded by its exponential majorant term, for n,m,K.
    n m K :
    ℕ
    hK :
    0 < K
    hm :
    2 ≤ m
    p :
    ℕ
    (n.choose m : ℝ) * (m : ℝ) ^ p * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m
    ≤ (m : ℝ) ^ (p + 1) * occupancyZ n K ^ m
    Proof (Lean source)
    theorem labelled_weight_majorant (n m K : ℕ) (hK : 0 < K) (hm : 2 ≤ m) (p : ℕ) : (n.choose m : ℝ) * (m : ℝ) ^ p * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m ≤ (m : ℝ) ^ (p + 1) * occupancyZ n K ^ m := by have hmR : (2 : ℝ) ≤ m := by exact_mod_cast hm have hf : (0 : ℝ) < m.factorial := by exact_mod_cast m.factorial_pos have he : 0 < exp (1 : ℝ) := Real.exp_pos _ have hsqrt : 1 ≤ sqrt (2 * pi * m) := by apply Real.one_le_sqrt.mpr nlinarith [Real.pi_gt_three] have hst : ((m : ℝ) / exp 1) ^ m ≤ (m.factorial : ℝ) := by calc _ ≤ sqrt (2 * pi * m) * ((m : ℝ) / exp 1) ^ m := by exact le_mul_of_one_le_left (by positivity) hsqrt _ ≤ _ := Stirling.le_factorial_stirling m have hpow : (m : ℝ) ^ m ≤ (m.factorial : ℝ) * exp 1 ^ m := by rw [div_pow, div_le_iff₀ (by positivity)] at hst exact hst have hc : (n.choose m : ℝ) * (m : ℝ) ^ m ≤ (n : ℝ) ^ m * exp 1 ^ m := by calc _ ≤ ((n : ℝ) ^ m / (m.factorial : ℝ)) * (m : ℝ) ^ m := by gcongr exact Nat.choose_le_pow_div m n _ ≤ ((n : ℝ) ^ m / (m.factorial : ℝ)) * ((m.factorial : ℝ) * exp 1 ^ m) := by gcongr _ = _ := by field_simp have hKpow : (0 : ℝ) < (K : ℝ) ^ m := by positivity calc _ = ((n.choose m : ℝ) * (m : ℝ) ^ m) * ((m : ℝ) ^ p * 8 ^ m) / (K : ℝ) ^ m := by ring _ ≤ ((n : ℝ) ^ m * exp 1 ^ m) * ((m : ℝ) ^ p * 8 ^ m) / (K : ℝ) ^ m := by gcongr _ = (m : ℝ) ^ p * occupancyZ n K ^ m := by simp only [occupancyZ, div_pow, mul_pow] ring _ ≤ (m : ℝ) ^ (p + 1) * occupancyZ n K ^ m := by rw [pow_succ] apply mul_le_mul_of_nonneg_right · exact le_mul_of_one_le_right (by positivity) (by linarith) · unfold occupancyZ positivity
    Causalean.Stat.RandomGraph.PathOccupancy.labelled_weight_majorant · Causalean/Stat/RandomGraph/PathOccupancy/Arithmetic.lean:32
  • finite_labelled_weight_majorant theorem — With at least two draws and positive cell count, the finite sum of labelled occupancy terms is bounded by the finite exponential series, for order and counts.
    p n K :
    ℕ
    hn :
    2 ≤ n
    hK :
    0 < K
    (∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ p * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m)
    ≤ occupancySeries (p + 1) n K
    Proof (Lean source)
    theorem finite_labelled_weight_majorant (p n K : ℕ) (hn : 2 ≤ n) (hK : 0 < K) : (∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ p * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m) ≤ occupancySeries (p + 1) n K := by calc _ ≤ ∑ m ∈ Icc 2 n, (m : ℝ) ^ (p + 1) * occupancyZ n K ^ m := by apply Finset.sum_le_sum intro m hm exact labelled_weight_majorant n m K hK (Finset.mem_Icc.mp hm).1 p _ = occupancySeries (p + 1) n K := by have hi : Icc 2 n = Ico 2 (n + 1) := by ext m simp only [Finset.mem_Icc, Finset.mem_Ico] omega rw [hi, Finset.sum_Ico_eq_sum_range] have hl : n + 1 - 2 = n - 1 := by omega simp only [hl, occupancySeries, Nat.cast_add, Nat.cast_ofNat] congr 1 ext j simp [add_comm]
    Causalean.Stat.RandomGraph.PathOccupancy.finite_labelled_weight_majorant · Causalean/Stat/RandomGraph/PathOccupancy/Arithmetic.lean:82
  • occupancyZ_small theorem — For a sample size n and a cell count K with K positive and density n / K at most 2 to the power −40, the occupancy parameter lies between zero and 2 to the power −35.
    n K :
    ℕ
    hK :
    0 < K
    hdensity :
    (n : ℝ) / K ≤ (2 : ℝ) ^ (-40 : ℤ)
    conclusion 1
    0 ≤ occupancyZ n K
    conclusion 2
    occupancyZ n K ≤ (2 : ℝ) ^ (-35 : ℤ)
    Proof (Lean source)
    theorem occupancyZ_small (n K : ℕ) (hK : 0 < K) (hdensity : (n : ℝ) / K ≤ (2 : ℝ) ^ (-40 : ℤ)) : 0 ≤ occupancyZ n K ∧ occupancyZ n K ≤ (2 : ℝ) ^ (-35 : ℤ) := by have hKR : (0 : ℝ) < K := by exact_mod_cast hK constructor · unfold occupancyZ positivity · have he : exp 1 ≤ 4 := le_trans Real.exp_one_lt_three.le (by norm_num) have hnK : (0 : ℝ) ≤ (n : ℝ) / K := by positivity calc occupancyZ n K = (8 * exp 1) * ((n : ℝ) / K) := by unfold occupancyZ ring _ ≤ (8 * 4) * (2 : ℝ) ^ (-40 : ℤ) := by gcongr _ = (2 : ℝ) ^ (-35 : ℤ) := by norm_num
    Causalean.Stat.RandomGraph.PathOccupancy.occupancyZ_small · Causalean/Stat/RandomGraph/PathOccupancy/Arithmetic.lean:107
Bounds 2 core · 0 supporting The main results apply to every measurable random local subrelation, with exact iid uniform fine-cell draws and independent Bernoulli marks. ★ single_component_occupancy★ paired_component_occupancy

Fixed-sample marked connected-component occupancy bounds

The main results apply to every measurable random local subrelation, with exact iid uniform fine-cell draws and independent Bernoulli marks. The relation need not include all eligible edges and may depend on the marks or extra randomness.

The proof chain exposes fixed-subset event bounds, then labelled-subset union bounds, then elementary finite exponential majorants. Both headline bounds keep the requested finite sums; the paired bound retains the essential size-two cutoff.

theorem single_component_occupancy reviewed
Causalean.Stat.RandomGraph.PathOccupancy

With n at least two, M at least two and even, K at least 16 M, iid uniform fine-cell draws and independent Bernoulli marks, and any measurable local subrelation, the expected two-mark component weight is at most ε² K times the order-eleven finite occupancy series.

Formal statement
Ω :
Type u_1
shared
n M K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
h :
hn :
2 ≤ n
hM :
2 ≤ M
heven :
2 ∣ M
hKM :
16 * M ≤ K
R :
Ω → Fin n → Fin n → Prop
hR :
∀ i j, MeasurableSet {ω | R ω i j}
hlocal :
∀ ω, Admissible M (fun i => X i ω) (R ω)
(∫ ω, singleScore (R ω) (fun i => B i ω) ∂μ) ≤ ε ^ 2 * K * occupancySeries 11 n K
Proof (Lean source)
theorem single_component_occupancy {n M K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (hn : 2 ≤ n) (hM : 2 ≤ M) (heven : 2 ∣ M) (hKM : 16 * M ≤ K) (R : Ω → Fin n → Fin n → Prop) (hR : ∀ i j, MeasurableSet {ω | R ω i j}) (hlocal : ∀ ω, Admissible M (fun i => X i ω) (R ω)) : (∫ ω, singleScore (R ω) (fun i => B i ω) ∂μ) ≤ ε ^ 2 * K * occupancySeries 11 n K := by have hK : 0 < K := by omega calc _ ≤ ε ^ 2 * K * ∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 10 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m := single_expectation_labelled_le h M hK R hR hlocal _ ≤ ε ^ 2 * K * occupancySeries 11 n K := mul_le_mul_of_nonneg_left (finite_labelled_weight_majorant 10 n K hn hK) (by positivity)
Causalean.Stat.RandomGraph.PathOccupancy.single_component_occupancy · Causalean/Stat/RandomGraph/PathOccupancy/Bounds.lean:27 · uses Admissible , UniformMarkedSample , occupancySeries , singleScore
theorem paired_component_occupancy reviewed
Causalean.Stat.RandomGraph.PathOccupancy

Place n ≥ 2 sample points in K fine cells on a path, grouped into M consecutive coarse cells, where M ≥ 2, M is even, M divides K and K ≥ 16 M. Suppose the points' cells are independent and uniform over the K fine cells, each point is marked with probability ε ∈ [0, 1] independently of the other points, and the marks are independent of the cells. Let a random relation on the points be such that each of its edge events is measurable and in every outcome each edge joins two points whose fine cells are equal or neighbouring and lie in the same coarse cell. Then the expected paired score — half the sum, over ordered pairs of distinct connected components C and D of the relation that each have at least two points, each contain at least one marked point, and together lie in one consecutive pair of coarse cells, of |C|⁴ 8^|C| · |D|⁴ 8^|D| — is at most 2 ε² K² / M times the square of the finite occupancy series Σ_{m=2}^{n} m⁶ (8 e n / K)^m.

Formal statement
Ω :
Type u_1
shared
n M K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
h :
hn :
2 ≤ n
hM :
2 ≤ M
heven :
2 ∣ M
hdiv :
M ∣ K
hKM :
16 * M ≤ K
R :
Ω → Fin n → Fin n → Prop
hR :
∀ i j, MeasurableSet {ω | R ω i j}
hlocal :
∀ ω, Admissible M (fun i => X i ω) (R ω)
(∫ ω, pairedScore M (R ω) (fun i => X i ω) (fun i => B i ω) ∂μ)
≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (occupancySeries 6 n K) ^ 2
Proof (Lean source)
theorem paired_component_occupancy {n M K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (hn : 2 ≤ n) (hM : 2 ≤ M) (heven : 2 ∣ M) (hdiv : M ∣ K) (hKM : 16 * M ≤ K) (R : Ω → Fin n → Fin n → Prop) (hR : ∀ i j, MeasurableSet {ω | R ω i j}) (hlocal : ∀ ω, Admissible M (fun i => X i ω) (R ω)) : (∫ ω, pairedScore M (R ω) (fun i => X i ω) (fun i => B i ω) ∂μ) ≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (occupancySeries 6 n K) ^ 2 := by have hK : 0 < K := by omega have hMp : 0 < M := by omega have hsum_nonneg : 0 ≤ (∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 5 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m) := by exact Finset.sum_nonneg (fun m _ => by positivity) have hmajorant := finite_labelled_weight_majorant 5 n K hn hK calc _ ≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 5 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m) ^ 2 := paired_expectation_labelled_le h M hMp hK heven hdiv R hR hlocal _ ≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (occupancySeries 6 n K) ^ 2 := by apply mul_le_mul_of_nonneg_left _ (by positivity) exact pow_le_pow_left₀ hsum_nonneg hmajorant 2
Causalean.Stat.RandomGraph.PathOccupancy.paired_component_occupancy · Causalean/Stat/RandomGraph/PathOccupancy/Bounds.lean:49 · uses Admissible , UniformMarkedSample , occupancySeries , pairedScore
Coarse­Pairs 1 core · 1 supporting For an even coarse count dividing the fine count, all pair classes have width twice the fine-to-coarse ratio. ★ unordered_same_pair_count

Counting fine-cell anchors in consecutive coarse pairs

For an even coarse count dividing the fine count, all pair classes have width twice the fine-to-coarse ratio. Ordered anchor pairs include diagonal pairs; unordered distinct-cell pairs use their unique increasing orientation.

theorem unordered_same_pair_count reviewed
Causalean.Stat.RandomGraph.PathOccupancy

When the coarse count is positive and even and divides the positive fine count, the number of unordered distinct cell pairs within one coarse pair is at most K squared over M. Unordered pairs are represented uniquely by their increasing orientation.

Formal statement
K M :
ℕ
hM :
0 < M
hK :
0 < K
heven :
2 ∣ M
hdiv :
M ∣ K
M * card {p : Fin K × Fin K // p.1.val < p.2.val ∧ pairClass K M p.1 = pairClass K M p.2}
≤ K ^ 2
Proof (Lean source)
theorem unordered_same_pair_count (K M : ℕ) (hM : 0 < M) (hK : 0 < K) (heven : 2 ∣ M) (hdiv : M ∣ K) : M * card {p : Fin K × Fin K // p.1.val < p.2.val ∧ pairClass K M p.1 = pairClass K M p.2} ≤ K ^ 2 := by classical let U := {p : Fin K × Fin K // p.1.val < p.2.val ∧ pairClass K M p.1 = pairClass K M p.2} let O := {p : Fin K × Fin K // pairClass K M p.1 = pairClass K M p.2} let f : Bool × U → O := fun t => if t.1 then ⟨(t.2.val.2, t.2.val.1), t.2.property.2.symm⟩ else ⟨t.2.val, t.2.property.2⟩ have hf : Injective f := by rintro ⟨b, p⟩ ⟨c, q⟩ h have hv := congrArg val h cases b <;> cases c · have hpq : p = q := Subtype.ext (by simpa [f] using hv) subst q; rfl · have h₁ := congrArg (fun t : Fin K × Fin K => t.1.val) hv have h₂ := congrArg (fun t : Fin K × Fin K => t.2.val) hv simp only [f, Bool.false_eq_true, ↓reduceIte] at h₁ h₂ have hp := p.property.1 have hq := q.property.1 omega · have h₁ := congrArg (fun t : Fin K × Fin K => t.1.val) hv have h₂ := congrArg (fun t : Fin K × Fin K => t.2.val) hv simp only [f, Bool.false_eq_true, ↓reduceIte] at h₁ h₂ have hp := p.property.1 have hq := q.property.1 omega · have hpq : p = q := Subtype.ext (by apply Prod.ext · exact congrArg snd hv · exact congrArg fst hv) subst q; rfl have hc : 2 * card U ≤ card O := by have := Nat.card_le_card_of_injective f hf simpa [Nat.card_prod, Nat.card_eq_fintype_card] using this have ho := ordered_same_pair_count K M hM hK heven hdiv have hb := Nat.mul_le_mul_left M hc change M * card U ≤ K ^ 2 change M * card O = 2 * K ^ 2 at ho nlinarith
Causalean.Stat.RandomGraph.PathOccupancy.unordered_same_pair_count · Causalean/Stat/RandomGraph/PathOccupancy/CoarsePairs.lean:91 · uses pairClass
1 supporting declaration (lemmas, instances)
  • ordered_same_pair_count theorem — Under positive even coarse count and divisibility, the ordered same-pair anchor count, including equal anchors, is exactly twice K squared over M, for the cell counts.
    K M :
    ℕ
    hM :
    0 < M
    hK :
    0 < K
    heven :
    2 ∣ M
    hdiv :
    M ∣ K
    M * card {p : Fin K × Fin K // pairClass K M p.1 = pairClass K M p.2} = 2 * K ^ 2
    Proof (Lean source)
    theorem ordered_same_pair_count (K M : ℕ) (hM : 0 < M) (hK : 0 < K) (heven : 2 ∣ M) (hdiv : M ∣ K) : M * card {p : Fin K × Fin K // pairClass K M p.1 = pairClass K M p.2} = 2 * K ^ 2 := by classical let n := M / 2 let w := 2 * (K / M) have hMn : M = 2 * n := (Nat.mul_div_cancel' heven).symm have hKq : M * (K / M) = K := Nat.mul_div_cancel' hdiv have hKw : K = n * w := by calc K = M * (K / M) := hKq.symm _ = (2 * n) * (K / M) := congrArg (fun m => m * (K / M)) hMn _ = n * w := by dsimp [w]; ring have hw : 0 < w := by have : 0 < K / M := Nat.div_pos (Nat.le_of_dvd hK hdiv) hM dsimp [w]; omega let enc (a : Fin K) : Fin n × Fin w := (⟨a.val / w, (Nat.div_lt_iff_lt_mul hw).2 (by rw [← hKw]; exact a.isLt)⟩, ⟨a.val % w, Nat.mod_lt _ hw⟩) let dec (p : Fin n × Fin w) : Fin K := ⟨p.1.val * w + p.2.val, by rw [hKw] exact lt_of_lt_of_le (Nat.add_lt_add_left p.2.isLt _) (by simpa [Nat.add_mul] using Nat.mul_le_mul_right w (succ_le_of_lt p.1.isLt))⟩ have hencdec (p : Fin n × Fin w) : enc (dec p) = p := by apply Prod.ext <;> apply Fin.ext · change (p.1.val * w + p.2.val) / w = p.1.val rw [Nat.add_comm, Nat.mul_comm p.1.val w, Nat.add_mul_div_left _ _ hw, Nat.div_eq_of_lt p.2.isLt, Nat.zero_add] · change (p.1.val * w + p.2.val) % w = p.2.val simp [Nat.add_mod, Nat.mod_eq_of_lt p.2.isLt] have hdecenc (a : Fin K) : dec (enc a) = a := by apply Fin.ext change a.val / w * w + a.val % w = a.val simpa [Nat.mul_comm] using Nat.div_add_mod a.val w let E : {p : Fin K × Fin K // pairClass K M p.1 = pairClass K M p.2} ≃ Fin n × (Fin w × Fin w) := { toFun := fun p => ((enc p.val.1).1, (enc p.val.1).2, (enc p.val.2).2) invFun := fun t => ⟨(dec (t.1, t.2.1), dec (t.1, t.2.2)), by change (enc (dec (t.1, t.2.1))).1.val = (enc (dec (t.1, t.2.2))).1.val rw [hencdec, hencdec]⟩ left_inv := by intro p have hp : (enc p.val.1).1 = (enc p.val.2).1 := Fin.ext p.property apply Subtype.ext apply Prod.ext · exact hdecenc p.val.1 · change dec ((enc p.val.1).1, (enc p.val.2).2) = p.val.2 rw [hp]; exact hdecenc p.val.2 right_inv := by intro t change ((enc (dec (t.1, t.2.1))).1, (enc (dec (t.1, t.2.1))).2, (enc (dec (t.1, t.2.2))).2) = t rw [hencdec, hencdec] } rw [Nat.card_congr E, Nat.card_prod, Nat.card_prod, Nat.card_fin, Nat.card_fin] rw [hMn, hKw] ring
    Causalean.Stat.RandomGraph.PathOccupancy.ordered_same_pair_count · Causalean/Stat/RandomGraph/PathOccupancy/CoarsePairs.lean:20
Connected­Assignments 1 core · 1 supporting Every nonempty connected assignment is encoded by its leftmost occupied cell and one bounded offset for each label. ★ connected_assignment_count

Counting connected labelled assignments

Every nonempty connected assignment is encoded by its leftmost occupied cell and one bounded offset for each label. The resulting injection gives the finite-path assignment count used in occupancy union bounds.

theorem connected_assignment_count reviewed
Causalean.Stat.RandomGraph.PathOccupancy

For a nonempty labelled type, the number of connected assignments to the finite path is at most the number of cells times the cardinality of the labelled type raised to itself.

Formal statement
ι :
Type*
K :
ℕ
hm :
1 ≤ card ι
card {x : ι → Fin K // ConnectedAssignment x} ≤ K * card ι ^ card ι
Proof (Lean source)
theorem connected_assignment_count {ι : Type*} [Fintype ι] (K : ℕ) (hm : 1 ≤ card ι) : card {x : ι → Fin K // ConnectedAssignment x} ≤ K * card ι ^ card ι := by obtain ⟨encode, hinj, _⟩ := connected_assignment_encoding K hm simpa [Nat.card_prod, Nat.card_fun, Nat.card_fin, Nat.card_eq_fintype_card] using Nat.card_le_card_of_injective encode hinj
Causalean.Stat.RandomGraph.PathOccupancy.connected_assignment_count · Causalean/Stat/RandomGraph/PathOccupancy/ConnectedAssignments.lean:80 · uses ConnectedAssignment
1 supporting declaration (lemmas, instances)
  • connected_assignment_encoding theorem — Connected assignments on nonempty labels, to a finite path, have an injective encoding by an occupied anchor and a bounded offset for each label, reconstructing the original fine-cell values.
    ι :
    Type*
    K :
    ℕ
    hm :
    1 ≤ card ι
    ∃ encode : {x : ι → Fin K // ConnectedAssignment x} → Fin K × (ι → Fin (card ι)),
    Injective encode
    conclusion 1
    x :
    (encode x).1 ∈ Finset.univ.image x.val
    i :
    (x.val i).val = (encode x).1.val + ((encode x).2 i).val
    Proof (Lean source)
    theorem connected_assignment_encoding {ι : Type*} [Fintype ι] (K : ℕ) (hm : 1 ≤ card ι) : ∃ encode : {x : ι → Fin K // ConnectedAssignment x} → Fin K × (ι → Fin (card ι)), Injective encode ∧ ∀ x, (encode x).1 ∈ Finset.univ.image x.val ∧ ∀ i, (x.val i).val = (encode x).1.val + ((encode x).2 i).val := by classical have hlabels : (Finset.univ : Finset ι).Nonempty := by apply Finset.card_pos.mp simpa using (Nat.zero_lt_of_lt hm) have hanchor : ∀ x : {x : ι → Fin K // ConnectedAssignment x}, ∃ a ∈ Finset.univ.image x.val, ∀ i, a.val ≤ (x.val i).val ∧ (x.val i).val < a.val + card ι := by intro x have hnonempty : (Finset.univ.image x.val).Nonempty := by obtain ⟨i, hi⟩ := hlabels exact ⟨x.val i, Finset.mem_image.mpr ⟨i, hi, rfl⟩⟩ obtain ⟨a, ha, hcover⟩ := connected_run_cover _ hnonempty x.property refine ⟨a, ha, fun i => ?_⟩ have hi := hcover (x.val i) (Finset.mem_image.mpr ⟨i, Finset.mem_univ i, rfl⟩) have hcard : (Finset.univ.image x.val).card ≤ card ι := by simpa using (Finset.card_image_le (s := Finset.univ) (f := x.val)) constructor · exact hi.1 · exact hi.2.trans_le (Nat.add_le_add_left hcard a.val) let anchor := fun x => choose (hanchor x) have ha := fun x => Classical.choose_spec (hanchor x) let encode : {x : ι → Fin K // ConnectedAssignment x} → Fin K × (ι → Fin (card ι)) := fun x => (anchor x, fun i => ⟨(x.val i).val - (anchor x).val, by have hi := (ha x).2 i change (anchor x).val ≤ (x.val i).val ∧ (x.val i).val < (anchor x).val + card ι at hi omega⟩) have hreconstruct : ∀ x i, (x.val i).val = (encode x).1.val + ((encode x).2 i).val := by intro x i have hi := (ha x).2 i change (anchor x).val ≤ (x.val i).val ∧ (x.val i).val < (anchor x).val + card ι at hi change (x.val i).val = (anchor x).val + ((x.val i).val - (anchor x).val) omega refine ⟨encode, ?_, fun x => ⟨(ha x).1, hreconstruct x⟩⟩ intro x y hxy apply Subtype.ext funext i apply Fin.ext rw [hreconstruct x i, hreconstruct y i, hxy]
    Causalean.Stat.RandomGraph.PathOccupancy.connected_assignment_encoding · Causalean/Stat/RandomGraph/PathOccupancy/ConnectedAssignments.lean:19
Counting 1 core · 0 supporting Two connected labelled assignments in a common consecutive coarse pair have an encoding by their ordered anchors and their labelled offsets. ★ connected_same_pair_assignment_count

Counting connected assignment pairs

Two connected labelled assignments in a common consecutive coarse pair have an encoding by their ordered anchors and their labelled offsets. Equal anchors are retained because distinct components of a local subrelation can occupy the same fine cell. The imported modules expose the individual assignment count and the ordered and unordered fine-cell pair counts.

theorem connected_same_pair_assignment_count reviewed
Causalean.Stat.RandomGraph.PathOccupancy

For two nonempty labelled types and positive even coarse count dividing the fine count, the coarse count M times the number of pairs of connected assignments, one from each labelled type, whose cells all lie in one common coarse pair is at most 2 K² m^m l^l, where K is the fine count and m and l are the sizes of the two labelled types.

Formal statement
ι κ :
Type*
K M :
ℕ
hm :
1 ≤ card ι
hl :
1 ≤ card κ
hM :
0 < M
hK :
0 < K
heven :
2 ∣ M
hdiv :
M ∣ K
M * card {p : (ι → Fin K) × (κ → Fin K) // ConnectedAssignment p.1 ∧ ConnectedAssignment p.2 ∧ SamePair K M p.1 p.2}
≤ 2 * K ^ 2 * card ι ^ card ι * card κ ^ card κ
Proof (Lean source)
theorem connected_same_pair_assignment_count {ι κ : Type*} [Fintype ι] [Fintype κ] (K M : ℕ) (hm : 1 ≤ card ι) (hl : 1 ≤ card κ) (hM : 0 < M) (hK : 0 < K) (heven : 2 ∣ M) (hdiv : M ∣ K) : M * card {p : (ι → Fin K) × (κ → Fin K) // ConnectedAssignment p.1 ∧ ConnectedAssignment p.2 ∧ SamePair K M p.1 p.2} ≤ 2 * K ^ 2 * card ι ^ card ι * card κ ^ card κ := by classical obtain ⟨eι, heι, haι⟩ := connected_assignment_encoding K hm obtain ⟨eκ, heκ, haκ⟩ := connected_assignment_encoding K hl let P := {p : (ι → Fin K) × (κ → Fin K) // ConnectedAssignment p.1 ∧ ConnectedAssignment p.2 ∧ SamePair K M p.1 p.2} let O := {p : Fin K × Fin K // pairClass K M p.1 = pairClass K M p.2} let x (p : P) : {x : ι → Fin K // ConnectedAssignment x} := ⟨p.val.1, p.property.1⟩ let y (p : P) : {y : κ → Fin K // ConnectedAssignment y} := ⟨p.val.2, p.property.2.1⟩ have hanchors (p : P) : pairClass K M (eι (x p)).1 = pairClass K M (eκ (y p)).1 := by obtain ⟨i, _, hi⟩ := Finset.mem_image.mp (haι (x p)).1 obtain ⟨j, _, hj⟩ := Finset.mem_image.mp (haκ (y p)).1 obtain ⟨c, _, hx, hy⟩ := p.property.2.2 rw [← hi, ← hj] exact (hx i).trans (hy j).symm let encode : P → O × ((ι → Fin (card ι)) × (κ → Fin (card κ))) := fun p => (⟨((eι (x p)).1, (eκ (y p)).1), hanchors p⟩, (eι (x p)).2, (eκ (y p)).2) have hinj : Injective encode := by intro p q hpq have hx : x p = x q := heι (Prod.ext (congrArg (fun t => t.1.val.1) hpq) (congrArg (fun t => t.2.1) hpq)) have hy : y p = y q := heκ (Prod.ext (congrArg (fun t => t.1.val.2) hpq) (congrArg (fun t => t.2.2) hpq)) exact Subtype.ext (Prod.ext (congrArg val hx) (congrArg val hy)) have hc : card P ≤ card O * (card ι ^ card ι * card κ ^ card κ) := by simpa [Nat.card_prod, Nat.card_fun, Nat.card_fin, Nat.card_eq_fintype_card] using Nat.card_le_card_of_injective encode hinj have ho : M * card O = 2 * K ^ 2 := ordered_same_pair_count K M hM hK heven hdiv calc M * card P ≤ M * (card O * (card ι ^ card ι * card κ ^ card κ)) := Nat.mul_le_mul_left M hc _ = (M * card O) * (card ι ^ card ι * card κ ^ card κ) := by ring _ = 2 * K ^ 2 * card ι ^ card ι * card κ ^ card κ := by rw [ho]; ring
Causalean.Stat.RandomGraph.PathOccupancy.connected_same_pair_assignment_count · Causalean/Stat/RandomGraph/PathOccupancy/Counting.lean:19 · uses ConnectedAssignment , SamePair
Paired­Expectation 1 core · 0 supporting The marked disjoint-subset event bound and pointwise component domination yield an expected paired score bounded by a square of a finite labelled-subset sum. ★ paired_expectation_labelled_le

Expected paired-component score via labelled subsets

The marked disjoint-subset event bound and pointwise component domination yield an expected paired score bounded by a square of a finite labelled-subset sum. Only deterministic sums are factorized; random components need not be independent. Both component cardinality cutoffs remain at two, and occupied cells may coincide.

theorem paired_expectation_labelled_le reviewed
Causalean.Stat.RandomGraph.PathOccupancy

In the iid uniform marked model, for a measurable local subrelation, the expected distinct-component score is bounded by twice ε² K²/M times the square of the labelled-subset sum, under positive even coarse count and divisibility. The labelled-subset sum runs over sizes m from two through n and adds choose(n, m) · m^5 · 8^m · m^m / K^m.

Formal statement
Ω :
Type u_1
shared
n K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
h :
M :
ℕ
hM :
0 < M
hK :
0 < K
heven :
2 ∣ M
hdiv :
M ∣ K
R :
Ω → Fin n → Fin n → Prop
hR :
∀ i j, MeasurableSet {ω | R ω i j}
hlocal :
∀ ω, Admissible M (fun i => X i ω) (R ω)
(∫ ω, pairedScore M (R ω) (fun i => X i ω) (fun i => B i ω) ∂μ)
≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 5 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m) ^ 2
Proof (Lean source)
theorem paired_expectation_labelled_le {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (M : ℕ) (hM : 0 < M) (hK : 0 < K) (heven : 2 ∣ M) (hdiv : M ∣ K) (R : Ω → Fin n → Fin n → Prop) (hR : ∀ i j, MeasurableSet {ω | R ω i j}) (hlocal : ∀ ω, Admissible M (fun i => X i ω) (R ω)) : (∫ ω, pairedScore M (R ω) (fun i => X i ω) (fun i => B i ω) ∂μ) ≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 5 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m) ^ 2 := by classical let : IsProbabilityMeasure μ := h.probability let E : Finset (Fin n) → Finset (Fin n) → Set Ω := fun C D => {ω | PathConnected (C.image (fun i => X i ω)) ∧ PathConnected (D.image (fun i => X i ω)) ∧ 1 ≤ markCount C (fun i => B i ω) ∧ 1 ≤ markCount D (fun i => B i ω) ∧ SameCoarsePair M C D (fun i => X i ω)} let w : ℕ → ℝ := fun m => (m : ℝ) ^ 4 * 8 ^ m let q : ℕ → ℝ := fun m => if 2 ≤ m then (m : ℝ) ^ 5 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m else 0 let a : ℝ := 2 * ε ^ 2 * (K : ℝ) ^ 2 / M let f : Finset (Fin n) → Finset (Fin n) → Ω → ℝ := fun C D => if Disjoint C D ∧ 2 ≤ C.card ∧ 2 ≤ D.card then (E C D).indicator (fun _ => w C.card * w D.card) else fun _ => 0 have hinput : Measurable (fun ω => (fun i => X i ω, fun i => B i ω)) := (measurable_pi_lambda _ h.cells_measurable).prodMk (measurable_pi_lambda _ h.marks_measurable) have hE (C D : Finset (Fin n)) : MeasurableSet (E C D) := by exact hinput (Set.toFinite {p : (Fin n → Fin K) × (Fin n → Bool) | PathConnected (C.image p.1) ∧ PathConnected (D.image p.1) ∧ 1 ≤ markCount C p.2 ∧ 1 ≤ markCount D p.2 ∧ SameCoarsePair M C D p.1}).measurableSet have hf (C D : Finset (Fin n)) : Integrable (f C D) μ := by dsimp [f] split_ifs · exact (integrable_const _).indicator (hE C D) · exact integrable_const 0 have hq (m : ℕ) : 0 ≤ q m := by dsimp [q]; split_ifs <;> positivity have ha : 0 ≤ a := by dsimp [a]; positivity have hpoint (ω : Ω) : pairedScore M (R ω) (fun i => X i ω) (fun i => B i ω) ≤ (1 / 2 : ℝ) * ∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, ∑ D ∈ (Finset.univ : Finset (Fin n)).powerset, f C D ω := by convert pairedScore_le_subsets M (fun i => X i ω) (R ω) (fun i => B i ω) (hlocal ω) using 1 congr 1 apply Finset.sum_congr rfl intro C _ apply Finset.sum_congr rfl intro D _ simp only [f, E, pairWeight, w] split_ifs <;> simp_all ring have hbound (C D : Finset (Fin n)) : (∫ ω, f C D ω ∂μ) ≤ a * q C.card * q D.card := by by_cases hc : Disjoint C D ∧ 2 ≤ C.card ∧ 2 ≤ D.card · rw [show (∫ ω, f C D ω ∂μ) = μ.real (E C D) * (w C.card * w D.card) by simp only [f, if_pos hc] exact (integral_indicator_const _ (hE C D)).trans (by simp [smul_eq_mul])] have hp := mul_le_mul_of_nonneg_right (subsets_connected_pair_marks_le h M hM hK heven hdiv C D hc.1 hc.2.1 hc.2.2) (show 0 ≤ w C.card * w D.card by dsimp [w]; positivity) calc _ ≤ (a * (C.card : ℝ) ^ (C.card + 1) * (D.card : ℝ) ^ (D.card + 1) / (K : ℝ) ^ (C.card + D.card)) * (w C.card * w D.card) := hp _ = _ := by simp only [q, if_pos hc.2.1, if_pos hc.2.2, w, pow_add, pow_one] ring · simp only [f, if_neg hc, integral_zero] exact mul_nonneg (mul_nonneg ha (hq _)) (hq _) have hgroup : (∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, q C.card) = ∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 5 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m := by calc _ = ∑ m ∈ range (n + 1), (n.choose m : ℝ) * q m := by rw [Finset.sum_powerset_apply_card] simp only [Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] _ = ∑ m ∈ Icc 2 n, (n.choose m : ℝ) * q m := by symm apply Finset.sum_subset · intro m hm simp only [Finset.mem_Icc] at hm simp only [Finset.mem_range] omega · intro m hm hnot have hsmall : ¬ 2 ≤ m := by simp only [Finset.mem_Icc, not_and_or, not_le] at hnot simp only [Finset.mem_range] at hm omega simp [q, hsmall] _ = _ := by apply Finset.sum_congr rfl intro m hm simp only [q, if_pos (Finset.mem_Icc.mp hm).1] ring have hsum : Integrable (fun ω => ∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, ∑ D ∈ (Finset.univ : Finset (Fin n)).powerset, f C D ω) μ := integrable_finsetSum _ (fun C _ => integrable_finsetSum _ (fun D _ => hf C D)) calc _ ≤ ∫ ω, (1 / 2 : ℝ) * (∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, ∑ D ∈ (Finset.univ : Finset (Fin n)).powerset, f C D ω) ∂μ := integral_mono (integrable_pairedScore μ M R X B hR h.cells_measurable h.marks_measurable) (hsum.const_mul _) hpoint _ = (1 / 2 : ℝ) * ∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, ∑ D ∈ (Finset.univ : Finset (Fin n)).powerset, ∫ ω, f C D ω ∂μ := by rw [integral_const_mul, integral_finsetSum _ (fun C _ => integrable_finsetSum _ (fun D _ => hf C D))] congr 1 apply Finset.sum_congr rfl intro C _ exact integral_finsetSum _ (fun D _ => hf C D) _ ≤ (1 / 2 : ℝ) * ∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, ∑ D ∈ (Finset.univ : Finset (Fin n)).powerset, a * q C.card * q D.card := by exact mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun C _ => Finset.sum_le_sum (fun D _ => hbound C D))) (by norm_num : (0 : ℝ) ≤ 1 / 2) _ ≤ ∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, ∑ D ∈ (Finset.univ : Finset (Fin n)).powerset, a * q C.card * q D.card := by have hs : 0 ≤ ∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, ∑ D ∈ (Finset.univ : Finset (Fin n)).powerset, a * q C.card * q D.card := Finset.sum_nonneg (fun C _ => Finset.sum_nonneg (fun D _ => mul_nonneg (mul_nonneg ha (hq _)) (hq _))) exact mul_le_of_le_one_left hs (by norm_num) _ = a * (∑ C ∈ (Finset.univ : Finset (Fin n)).powerset, q C.card) ^ 2 := by rw [pow_two, Finset.sum_mul_sum] simp only [Finset.mul_sum, mul_assoc] _ = _ := by rw [hgroup]
Causalean.Stat.RandomGraph.PathOccupancy.paired_expectation_labelled_le · Causalean/Stat/RandomGraph/PathOccupancy/PairedExpectation.lean:26 · uses Admissible , UniformMarkedSample , pairedScore
Pair­Events 1 core · 0 supporting This layer combines exact uniform assignment probabilities and independent Bernoulli marks with connected-run pair counting. ★ subsets_connected_pair_marks_le

Connected marked pair events on disjoint labelled subsets

This layer combines exact uniform assignment probabilities and independent Bernoulli marks with connected-run pair counting. Disjointness concerns sample labels; the occupied fine cells and run anchors may coincide.

theorem subsets_connected_pair_marks_le reviewed
Causalean.Stat.RandomGraph.PathOccupancy

In the uniform marked model with a coarse cell count that is positive, even, and divides the positive fine cell count, two disjoint label subsets of size at least two satisfy the following: the probability that each subset occupies a path-connected set of cells, each carries at least one mark, and the two share a coarse pair is at most 2 ε² K² / M times |C| to the power |C| + 1 times |D| to the power |D| + 1, divided by K to the power |C| + |D|.

Formal statement
Ω :
Type u_1
shared
n K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
h :
M :
ℕ
hM :
0 < M
hK :
0 < K
heven :
2 ∣ M
hdiv :
M ∣ K
C D :
hdisj :
hC :
2 ≤ C.card
hD :
2 ≤ D.card
(μ {ω | PathConnected (C.image (fun i => X i ω)) ∧ PathConnected (D.image (fun i => X i ω)) ∧ 1 ≤ markCount C (fun i => B i ω) ∧ 1 ≤ markCount D (fun i => B i ω) ∧ SameCoarsePair M C D (fun i => X i ω)}).toReal
≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (C.card : ℝ) ^ (C.card + 1) * (D.card : ℝ) ^ (D.card + 1) / (K : ℝ) ^ (C.card + D.card)
Proof (Lean source)
theorem subsets_connected_pair_marks_le {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (M : ℕ) (hM : 0 < M) (hK : 0 < K) (heven : 2 ∣ M) (hdiv : M ∣ K) (C D : Finset (Fin n)) (hdisj : Disjoint C D) (hC : 2 ≤ C.card) (hD : 2 ≤ D.card) : (μ {ω | PathConnected (C.image (fun i => X i ω)) ∧ PathConnected (D.image (fun i => X i ω)) ∧ 1 ≤ markCount C (fun i => B i ω) ∧ 1 ≤ markCount D (fun i => B i ω) ∧ SameCoarsePair M C D (fun i => X i ω)}).toReal ≤ 2 * ε ^ 2 * (K : ℝ) ^ 2 / M * (C.card : ℝ) ^ (C.card + 1) * (D.card : ℝ) ^ (D.card + 1) / (K : ℝ) ^ (C.card + D.card) := by classical have : IsProbabilityMeasure μ := h.probability let A := {p : (C → Fin K) × (D → Fin K) // ConnectedAssignment p.1 ∧ ConnectedAssignment p.2 ∧ SamePair K M p.1 p.2} let E : A → Set Ω := fun a => {ω | (∀ i : C, X i ω = a.val.1 i) ∧ (∀ i : D, X i ω = a.val.2 i) ∧ 1 ≤ markCount C (fun i => B i ω) ∧ 1 ≤ markCount D (fun i => B i ω)} have himage (S : Finset (Fin n)) (ω : Ω) : Finset.univ.image (fun i : S => X i ω) = S.image (fun i => X i ω) := by ext x simp only [mem_image, Finset.mem_univ, true_and] constructor · rintro ⟨i, hi⟩ exact ⟨i, i.property, hi⟩ · rintro ⟨i, hi, hix⟩ exact ⟨⟨i, hi⟩, hix⟩ have hsub : {ω | PathConnected (C.image (fun i => X i ω)) ∧ PathConnected (D.image (fun i => X i ω)) ∧ 1 ≤ markCount C (fun i => B i ω) ∧ 1 ≤ markCount D (fun i => B i ω) ∧ SameCoarsePair M C D (fun i => X i ω)} ⊆ ⋃ a, E a := by rintro ω ⟨hc, hd, hmc, hmd, hp⟩ have hac : ConnectedAssignment (fun i : C => X i ω) := by simpa only [ConnectedAssignment, himage] using hc have had : ConnectedAssignment (fun i : D => X i ω) := by simpa only [ConnectedAssignment, himage] using hd obtain ⟨p, hpm, hpc, hpd⟩ := hp have hap : SamePair K M (fun i : C => X i ω) (fun i : D => X i ω) := ⟨p, hpm, (fun i => hpc i i.property), (fun i => hpd i i.property)⟩ exact Set.mem_iUnion.mpr ⟨⟨((fun i : C => X i ω), (fun i : D => X i ω)), hac, had, hap⟩, (fun _ => rfl), (fun _ => rfl), hmc, hmd⟩ have hbound (a : A) : μ.real (E a) ≤ ε ^ 2 * (C.card : ℝ) * (D.card : ℝ) / (K : ℝ) ^ (C.card + D.card) := assignment_pair_marks_probability_le h C D hdisj a.val.1 a.val.2 have hcard : (Fintype.card A : ℝ) ≤ 2 * (K : ℝ) ^ 2 * (C.card : ℝ) ^ C.card * (D.card : ℝ) ^ D.card / M := by have hc := connected_same_pair_assignment_count (ι := C) (κ := D) K M (by simpa only [Fintype.card_coe] using (show 1 ≤ C.card by omega)) (by simpa only [Fintype.card_coe] using (show 1 ≤ D.card by omega)) hM hK heven hdiv have hc' : M * Fintype.card A ≤ 2 * K ^ 2 * C.card ^ C.card * D.card ^ D.card := by simpa only [Nat.card_eq_fintype_card, Fintype.card_coe] using hc apply (le_div_iff₀ (Nat.cast_pos.mpr hM)).mpr have hc'' : (M : ℝ) * (Fintype.card A : ℝ) ≤ 2 * (K : ℝ) ^ 2 * (C.card : ℝ) ^ C.card * (D.card : ℝ) ^ D.card := by exact_mod_cast hc' simpa only [mul_comm] using hc'' have hnonneg : 0 ≤ ε ^ 2 * (C.card : ℝ) * (D.card : ℝ) / (K : ℝ) ^ (C.card + D.card) := by positivity calc _ ≤ μ.real (⋃ a, E a) := measureReal_mono hsub _ ≤ ∑ a : A, μ.real (E a) := measureReal_iUnion_fintype_le E _ ≤ ∑ _a : A, ε ^ 2 * (C.card : ℝ) * (D.card : ℝ) / (K : ℝ) ^ (C.card + D.card) := Finset.sum_le_sum (fun a _ => hbound a) _ = (Fintype.card A : ℝ) * (ε ^ 2 * (C.card : ℝ) * (D.card : ℝ) / (K : ℝ) ^ (C.card + D.card)) := by simp _ ≤ (2 * (K : ℝ) ^ 2 * (C.card : ℝ) ^ C.card * (D.card : ℝ) ^ D.card / M) * (ε ^ 2 * (C.card : ℝ) * (D.card : ℝ) / (K : ℝ) ^ (C.card + D.card)) := mul_le_mul_of_nonneg_right hcard hnonneg _ = _ := by simp only [pow_add, pow_one]; ring
Causalean.Stat.RandomGraph.PathOccupancy.subsets_connected_pair_marks_le · Causalean/Stat/RandomGraph/PathOccupancy/PairEvents.lean:22 · uses PathConnected , SameCoarsePair , UniformMarkedSample , markCount
Score­Measurability 1 core · 2 supporting A random relation is encoded by finitely many Boolean edge indicators. ★ integrable_pairedScore

Measurability and integrability of finite component scores

A random relation is encoded by finitely many Boolean edge indicators. Every component statistic then factors through a finite measurable vector of edges, cells, and marks. This proves measurability and integrability without restricting how the relation depends on cells, marks, or additional randomness.

theorem integrable_pairedScore reviewed
Causalean.Stat.RandomGraph.PathOccupancy

Measurable edge events, cells, and marks on a finite-measure space make the random paired-component score integrable, for coarse count, relation, cells, and marks.

Formal statement
Ω :
Type u_1
shared
n K :
ℕ
M :
ℕ
R :
Ω → Fin n → Fin n → Prop
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
hR :
∀ i j, MeasurableSet {ω | R ω i j}
hX :
∀ i, Measurable (X i)
hB :
∀ i, Measurable (B i)
Integrable (fun ω => pairedScore M (R ω) (fun i => X i ω) (fun i => B i ω)) μ
Proof (Lean source)
theorem integrable_pairedScore {n K : ℕ} (μ : Measure Ω) [IsFiniteMeasure μ] (M : ℕ) (R : Ω → Fin n → Fin n → Prop) (X : Fin n → Ω → Fin K) (B : Fin n → Ω → Bool) (hR : ∀ i j, MeasurableSet {ω | R ω i j}) (hX : ∀ i, Measurable (X i)) (hB : ∀ i, Measurable (B i)) : Integrable (fun ω => pairedScore M (R ω) (fun i => X i ω) (fun i => B i ω)) μ := by classical let score : Finset (Finset (Fin n)) × ((Fin n → Fin K) × (Fin n → Bool)) → ℝ := fun p => (1 / 2 : ℝ) * ∑ C ∈ p.1, ∑ D ∈ p.1.erase C, pairWeight M C D p.2.1 p.2.2 have hinput : Measurable (fun ω => (components (R ω), (fun i => X i ω, fun i => B i ω))) := (measurable_components R hR).prodMk ((measurable_pi_lambda _ hX).prodMk (measurable_pi_lambda _ hB)) exact ((SimpleFunc.ofFinite score).comp _ hinput).integrable_of_isFiniteMeasure
Causalean.Stat.RandomGraph.PathOccupancy.integrable_pairedScore · Causalean/Stat/RandomGraph/PathOccupancy/ScoreMeasurability.lean:77 · uses pairedScore
2 supporting declarations (lemmas, instances)
Single­Events 1 core · 0 supporting The single-subset union bound combines the exact uniform assignment law, the quadratic Bernoulli mark bound, and the connected-run assignment count. ★ subset_connected_two_marks_le

Connected two-mark events on a fixed labelled subset

The single-subset union bound combines the exact uniform assignment law, the quadratic Bernoulli mark bound, and the connected-run assignment count. This layer does not depend on paired counting or random component measurability.

theorem subset_connected_two_marks_le reviewed
Causalean.Stat.RandomGraph.PathOccupancy

In the iid uniform marked model, a fixed subset of size at least two has connected occupied cells and at least two marks with probability at most ε² · K · m^(m+2) / K^m, where m is the subset's size, with positive cell count.

Formal statement
Ω :
Type u_1
shared
n K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
h :
hK :
0 < K
C :
hC :
2 ≤ C.card
(μ {ω | PathConnected (C.image (fun i => X i ω)) ∧ 2 ≤ markCount C (fun i => B i ω)}).toReal
≤ ε ^ 2 * K * (C.card : ℝ) ^ (C.card + 2) / (K : ℝ) ^ C.card
Proof (Lean source)
theorem subset_connected_two_marks_le {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (hK : 0 < K) (C : Finset (Fin n)) (hC : 2 ≤ C.card) : (μ {ω | PathConnected (C.image (fun i => X i ω)) ∧ 2 ≤ markCount C (fun i => B i ω)}).toReal ≤ ε ^ 2 * K * (C.card : ℝ) ^ (C.card + 2) / (K : ℝ) ^ C.card := by classical have : IsProbabilityMeasure μ := h.probability let A := {a : C → Fin K // ConnectedAssignment a} let E : A → Set Ω := fun a => {ω | (∀ i : C, X i ω = a.val i) ∧ 2 ≤ markCount C (fun i => B i ω)} have himage (ω : Ω) : Finset.univ.image (fun i : C => X i ω) = C.image (fun i => X i ω) := by ext x simp only [mem_image, Finset.mem_univ, true_and] constructor · rintro ⟨i, hi⟩ exact ⟨i, i.property, hi⟩ · rintro ⟨i, hi, hix⟩ exact ⟨⟨i, hi⟩, hix⟩ have hsub : {ω | PathConnected (C.image (fun i => X i ω)) ∧ 2 ≤ markCount C (fun i => B i ω)} ⊆ ⋃ a, E a := by rintro ω ⟨hc, hm⟩ have ha : ConnectedAssignment (fun i : C => X i ω) := by simpa only [ConnectedAssignment, himage] using hc exact Set.mem_iUnion.mpr ⟨⟨(fun i : C => X i ω), ha⟩, (fun _ => rfl), hm⟩ have hbound (a : A) : μ.real (E a) ≤ ε ^ 2 * (C.card : ℝ) ^ 2 / (K : ℝ) ^ C.card := assignment_two_marks_probability_le h C a.val have hcard : (Fintype.card A : ℝ) ≤ (K : ℝ) * (C.card : ℝ) ^ C.card := by have hc := connected_assignment_count (ι := C) K (by simpa only [Fintype.card_coe] using (show 1 ≤ C.card by omega)) have hc' : Fintype.card A ≤ K * C.card ^ C.card := by simpa only [Nat.card_eq_fintype_card, Fintype.card_coe] using hc exact_mod_cast hc' have hnonneg : 0 ≤ ε ^ 2 * (C.card : ℝ) ^ 2 / (K : ℝ) ^ C.card := div_nonneg (mul_nonneg (sq_nonneg ε) (sq_nonneg _)) (pow_nonneg (le_of_lt (Nat.cast_pos.mpr hK)) _) calc _ ≤ μ.real (⋃ a, E a) := measureReal_mono hsub _ ≤ ∑ a : A, μ.real (E a) := measureReal_iUnion_fintype_le E _ ≤ ∑ _a : A, ε ^ 2 * (C.card : ℝ) ^ 2 / (K : ℝ) ^ C.card := Finset.sum_le_sum (fun a _ => hbound a) _ = (Fintype.card A : ℝ) * (ε ^ 2 * (C.card : ℝ) ^ 2 / (K : ℝ) ^ C.card) := by simp _ ≤ ((K : ℝ) * (C.card : ℝ) ^ C.card) * (ε ^ 2 * (C.card : ℝ) ^ 2 / (K : ℝ) ^ C.card) := mul_le_mul_of_nonneg_right hcard hnonneg _ = _ := by rw [pow_add]; ring
Causalean.Stat.RandomGraph.PathOccupancy.subset_connected_two_marks_le · Causalean/Stat/RandomGraph/PathOccupancy/SingleEvents.lean:22 · uses PathConnected , UniformMarkedSample , markCount
Single­Expectation 1 core · 0 supporting Pointwise domination by all connected labelled subsets, the fixed-subset two-mark event bound, and cardinality grouping give a finite labelled occupancy majorant. ★ single_expectation_labelled_le

Expected single-component score via labelled subsets

Pointwise domination by all connected labelled subsets, the fixed-subset two-mark event bound, and cardinality grouping give a finite labelled occupancy majorant. The random relation may depend on marks and extra randomness.

theorem single_expectation_labelled_le reviewed
Causalean.Stat.RandomGraph.PathOccupancy

In the iid uniform marked model, for a measurable random local subrelation, the expected single score is at most ε² K times the labelled-subset occupancy sum, with positive K and coarse count M. The labelled-subset occupancy sum runs over sizes m from two through n and adds choose(n, m) · m^10 · 8^m · m^m / K^m.

Formal statement
Ω :
Type u_1
shared
n K :
ℕ
μ :
X :
Fin n → Ω → Fin K
B :
Fin n → Ω → Bool
ε :
ℝ
h :
M :
ℕ
hK :
0 < K
R :
Ω → Fin n → Fin n → Prop
hR :
∀ i j, MeasurableSet {ω | R ω i j}
hlocal :
∀ ω, Admissible M (fun i => X i ω) (R ω)
(∫ ω, singleScore (R ω) (fun i => B i ω) ∂μ)
≤ ε ^ 2 * K * ∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 10 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m
Proof (Lean source)
theorem single_expectation_labelled_le {n K : ℕ} {μ : Measure Ω} {X : Fin n → Ω → Fin K} {B : Fin n → Ω → Bool} {ε : ℝ} (h : UniformMarkedSample μ X B ε) (M : ℕ) (hK : 0 < K) (R : Ω → Fin n → Fin n → Prop) (hR : ∀ i j, MeasurableSet {ω | R ω i j}) (hlocal : ∀ ω, Admissible M (fun i => X i ω) (R ω)) : (∫ ω, singleScore (R ω) (fun i => B i ω) ∂μ) ≤ ε ^ 2 * K * ∑ m ∈ Icc 2 n, (n.choose m : ℝ) * (m : ℝ) ^ 10 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m := by classical let : IsProbabilityMeasure μ := h.probability let E : Finset (Fin n) → Set Ω := fun C => {ω | PathConnected (C.image (fun i => X i ω)) ∧ 2 ≤ markCount C (fun i => B i ω)} let w : ℕ → ℝ := fun m => (m : ℝ) ^ 8 * 8 ^ m let f : Finset (Fin n) → Ω → ℝ := fun C => (E C).indicator (fun _ => w C.card) let g : ℕ → ℝ := fun m => if 2 ≤ m then ε ^ 2 * K * (m : ℝ) ^ 10 * 8 ^ m * (m : ℝ) ^ m / (K : ℝ) ^ m else 0 have hinput : Measurable (fun ω => (fun i => X i ω, fun i => B i ω)) := (measurable_pi_lambda _ h.cells_measurable).prodMk (measurable_pi_lambda _ h.marks_measurable) have hE (C : Finset (Fin n)) : MeasurableSet (E C) := by exact hinput (Set.toFinite {p : (Fin n → Fin K) × (Fin n → Bool) | PathConnected (C.image p.1) ∧ 2 ≤ markCount C p.2}).measurableSet have hf (C : Finset (Fin n)) : Integrable (f C) μ := (integrable_const (w C.card)).indicator (hE C) have hpoint (ω : Ω) : singleScore (R ω) (fun i => B i ω) ≤ ∑ C ∈ Finset.univ.powerset, f C ω := by convert singleScore_le_subsets M (fun i => X i ω) (R ω) (fun i => B i ω) (hlocal ω) using 1 apply Finset.sum_congr rfl intro C _ simp only [f, E, indicator, Set.mem_ofPred_eq, singleWeight, w] split_ifs <;> simp_all have hbound (C : Finset (Fin n)) : (∫ ω, f C ω ∂μ) ≤ g C.card := by by_cases hC : 2 ≤ C.card · rw [show (∫ ω, f C ω ∂μ) = μ.real (E C) * w C.card by exact (integral_indicator_const _ (hE C)).trans (by simp [smul_eq_mul])] have hp := mul_le_mul_of_nonneg_right (subset_connected_two_marks_le h hK C hC) (show 0 ≤ w C.card by dsimp [w]; positivity) calc _ ≤ (ε ^ 2 * K * (C.card : ℝ) ^ (C.card + 2) / (K : ℝ) ^ C.card) * w C.card := hp _ = g C.card := by simp only [g, if_pos hC, w, pow_add] ring · have hempty : E C = ∅ := by apply Set.eq_empty_iff_forall_notMem.mpr intro ω hω have hc : markCount C (fun i => B i ω) ≤ C.card := Finset.card_filter_le _ _ exact hC (le_trans hω.2 hc) simp [f, hempty, g, hC] calc _ ≤ ∫ ω, ∑ C ∈ Finset.univ.powerset, f C ω ∂μ := integral_mono (integrable_singleScore μ R B hR h.marks_measurable) (integrable_finsetSum _ (fun C _ => hf C)) hpoint _ = ∑ C ∈ Finset.univ.powerset, ∫ ω, f C ω ∂μ := integral_finsetSum _ (fun C _ => hf C) _ ≤ ∑ C ∈ Finset.univ.powerset, g C.card := Finset.sum_le_sum (fun C _ => hbound C) _ = ∑ m ∈ range (n + 1), (n.choose m : ℝ) * g m := by rw [Finset.sum_powerset_apply_card] simp only [Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] _ = ∑ m ∈ Icc 2 n, (n.choose m : ℝ) * g m := by symm apply Finset.sum_subset · intro m hm simp only [Finset.mem_Icc] at hm simp only [Finset.mem_range] omega · intro m _ hm have hsmall : ¬ 2 ≤ m := by simp only [Finset.mem_Icc, not_and_or, not_le] at hm simp only [Finset.mem_range] at * omega simp [g, hsmall] _ = _ := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro m hm simp only [g, if_pos (Finset.mem_Icc.mp hm).1] ring
Causalean.Stat.RandomGraph.PathOccupancy.single_expectation_labelled_le · Causalean/Stat/RandomGraph/PathOccupancy/SingleExpectation.lean:24 · uses Admissible , UniformMarkedSample , singleScore