@lapxo/obligations 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -3
- package/TARGET.bound +148 -42
- package/contracts/extension-lineage-participation.json +30 -0
- package/contracts/m0-binomial-bridge.json +6 -0
- package/contracts/m0-diagonal-conditional.json +15 -0
- package/contracts/m0-keff-interval.json +27 -0
- package/contracts/m0-moment-identification.json +42 -0
- package/contracts/m1-diagonal-regions.json +45 -0
- package/contracts/m1-generator-binomial.json +26 -0
- package/contracts/m1-offdiag-limit.json +42 -0
- package/contracts/m1-subcauses.json +66 -0
- package/contracts/model-collapse-1a.json +16 -0
- package/contracts/projection-chain.json +20 -0
- package/docs/contracts/experiment1a-public-attribution.md +1 -0
- package/docs/contracts/extension-lineage-participation.md +13 -0
- package/docs/contracts/installation-046-inputs.md +1 -0
- package/docs/contracts/m0-binomial-bridge.md +1 -0
- package/docs/contracts/m0-diagonal-lindeberg.md +1 -0
- package/docs/contracts/m0-diagonal-moments.md +1 -0
- package/docs/contracts/m0-diagonal-symmetric.md +1 -0
- package/docs/contracts/m0-diagonal-threshold.md +1 -0
- package/docs/contracts/m0-keff-floor-refutation.md +1 -0
- package/docs/contracts/m0-keff-interval.md +1 -0
- package/docs/contracts/m0-moment-identification.md +1 -0
- package/docs/contracts/m0-refuted-inverses.md +1 -0
- package/docs/contracts/m0-wf-floor-refutation.md +1 -0
- package/docs/contracts/m1-diagonal-regions.md +1 -0
- package/docs/contracts/m1-generator-binomial.md +1 -0
- package/docs/contracts/m1-offdiag-limit.md +1 -0
- package/docs/contracts/model-collapse-1a.md +11 -0
- package/docs/contracts/projection-chain.md +1 -0
- package/package.json +1 -1
- package/proofs/definitions-046/declaration.json +11 -0
- package/proofs/experiment1a-046/declaration.json +11 -0
- package/proofs/m0-046/BridgeNegatives.lean +23 -0
- package/proofs/m0-046/M0Bridge.lean +300 -0
- package/proofs/m0-046/Obligations045/ConsensusGrid.lean +72 -0
- package/proofs/m0-046/Obligations045/M0Coincidence.lean +39 -0
- package/proofs/m0-046/Obligations045/M0Diagonal.lean +18 -0
- package/proofs/m0-046/Obligations045/M0Limit.lean +134 -0
- package/proofs/m0-046/Obligations045/M0Offdiag.lean +171 -0
- package/proofs/m0-046/Obligations045.lean +5 -0
- package/proofs/m0-046/lake-manifest.json +116 -0
- package/proofs/m0-046/lakefile.toml +14 -0
- package/proofs/m0-046/lean-toolchain +1 -0
- package/proofs/m0-046-diagonal/BridgeNegatives.lean +23 -0
- package/proofs/m0-046-diagonal/M0Bridge.lean +300 -0
- package/proofs/m0-046-diagonal/M0Diagonal046.lean +235 -0
- package/proofs/m0-046-diagonal/M0Lindeberg046.lean +92 -0
- package/proofs/m0-046-diagonal/M0Moments046.lean +295 -0
- package/proofs/m0-046-diagonal/M0Threshold046.lean +278 -0
- package/proofs/m0-046-diagonal/Obligations045/ConsensusGrid.lean +72 -0
- package/proofs/m0-046-diagonal/Obligations045/M0Coincidence.lean +39 -0
- package/proofs/m0-046-diagonal/Obligations045/M0Diagonal.lean +18 -0
- package/proofs/m0-046-diagonal/Obligations045/M0Limit.lean +134 -0
- package/proofs/m0-046-diagonal/Obligations045/M0Offdiag.lean +171 -0
- package/proofs/m0-046-diagonal/Obligations045.lean +5 -0
- package/proofs/m0-046-diagonal/lake-manifest.json +116 -0
- package/proofs/m0-046-diagonal/lakefile.toml +26 -0
- package/proofs/m0-046-diagonal/lean-toolchain +1 -0
- package/proofs/m0-046-identification/M0Identification046.lean +209 -0
- package/proofs/m0-046-identification/Obligations045/M0Coincidence.lean +39 -0
- package/proofs/m0-046-identification/lake-manifest.json +116 -0
- package/proofs/m0-046-identification/lakefile.toml +12 -0
- package/proofs/m0-046-identification/lean-toolchain +1 -0
- package/proofs/m0-046-uncertainty/BridgeNegatives.lean +23 -0
- package/proofs/m0-046-uncertainty/M0BlockCoverage046.lean +163 -0
- package/proofs/m0-046-uncertainty/M0Bridge.lean +300 -0
- package/proofs/m0-046-uncertainty/M0Diagonal046.lean +235 -0
- package/proofs/m0-046-uncertainty/M0FiniteDiscord046.lean +207 -0
- package/proofs/m0-046-uncertainty/M0Interval046.lean +82 -0
- package/proofs/m0-046-uncertainty/M0Lindeberg046.lean +92 -0
- package/proofs/m0-046-uncertainty/M0Moments046.lean +295 -0
- package/proofs/m0-046-uncertainty/M0Threshold046.lean +278 -0
- package/proofs/m0-046-uncertainty/Obligations045/ConsensusGrid.lean +72 -0
- package/proofs/m0-046-uncertainty/Obligations045/M0Coincidence.lean +39 -0
- package/proofs/m0-046-uncertainty/Obligations045/M0Diagonal.lean +18 -0
- package/proofs/m0-046-uncertainty/Obligations045/M0Limit.lean +134 -0
- package/proofs/m0-046-uncertainty/Obligations045/M0Offdiag.lean +171 -0
- package/proofs/m0-046-uncertainty/Obligations045.lean +5 -0
- package/proofs/m0-046-uncertainty/lake-manifest.json +116 -0
- package/proofs/m0-046-uncertainty/lakefile.toml +35 -0
- package/proofs/m0-046-uncertainty/lean-toolchain +1 -0
- package/proofs/m1-046-bridge/M0Bridge.lean +300 -0
- package/proofs/m1-046-bridge/M1Bridge046.lean +359 -0
- package/proofs/m1-046-bridge/Obligations045/M0Limit.lean +134 -0
- package/proofs/m1-046-bridge/Obligations045/M0Offdiag.lean +171 -0
- package/proofs/m1-046-bridge/lake-manifest.json +116 -0
- package/proofs/m1-046-bridge/lakefile.toml +29 -0
- package/proofs/m1-046-bridge/lean-toolchain +1 -0
- package/proofs/m1-046-diagonal/M0Bridge.lean +300 -0
- package/proofs/m1-046-diagonal/M0Diagonal046.lean +235 -0
- package/proofs/m1-046-diagonal/M0Lindeberg046.lean +92 -0
- package/proofs/m1-046-diagonal/M0Moments046.lean +295 -0
- package/proofs/m1-046-diagonal/M0Threshold046.lean +278 -0
- package/proofs/m1-046-diagonal/M1Bridge046.lean +359 -0
- package/proofs/m1-046-diagonal/M1Diagonal046.lean +334 -0
- package/proofs/m1-046-diagonal/M1Offdiag046.lean +270 -0
- package/proofs/m1-046-diagonal/Obligations045/M0Limit.lean +134 -0
- package/proofs/m1-046-diagonal/Obligations045/M0Offdiag.lean +171 -0
- package/proofs/m1-046-diagonal/lake-manifest.json +116 -0
- package/proofs/m1-046-diagonal/lakefile.toml +35 -0
- package/proofs/m1-046-diagonal/lean-toolchain +1 -0
- package/proofs/m1-046-offdiag/M0Bridge.lean +300 -0
- package/proofs/m1-046-offdiag/M0Diagonal046.lean +235 -0
- package/proofs/m1-046-offdiag/M0Moments046.lean +295 -0
- package/proofs/m1-046-offdiag/M1Bridge046.lean +359 -0
- package/proofs/m1-046-offdiag/M1Offdiag046.lean +270 -0
- package/proofs/m1-046-offdiag/Obligations045/M0Limit.lean +134 -0
- package/proofs/m1-046-offdiag/Obligations045/M0Offdiag.lean +171 -0
- package/proofs/m1-046-offdiag/lake-manifest.json +116 -0
- package/proofs/m1-046-offdiag/lakefile.toml +32 -0
- package/proofs/m1-046-offdiag/lean-toolchain +1 -0
- package/proofs/projection-chain.md +11 -0
- package/protocols/model-collapse-1a.json +108 -0
- package/receipts.bound +578 -210
- package/samples/laws/definitions/no/sample.json +26 -0
- package/samples/laws/definitions/yes/sample.json +12 -0
- package/samples/laws/experiment1a/no/sample.json +16 -0
- package/samples/laws/experiment1a/yes/sample.json +8 -0
- package/samples/laws/m0-binomial-bridge/no/pairwise-is-not-joint.json +59 -0
- package/samples/laws/m0-binomial-bridge/no/sample.json +13 -0
- package/samples/laws/m0-binomial-bridge/yes/sample.json +16 -0
- package/samples/laws/m0-binomial-bridge/yes/small-binomial-table.json +100 -0
- package/samples/laws/m0-diagonal-conditional/no/sample.json +5 -0
- package/samples/laws/m0-diagonal-conditional/yes/sample.json +7 -0
- package/samples/laws/m0-keff-interval/no/sample.json +215 -0
- package/samples/laws/m0-keff-interval/yes/api-rows.json +2002 -0
- package/samples/laws/m0-keff-interval/yes/sample.json +70 -0
- package/samples/laws/m0-moment-identification/no/sample.json +47 -0
- package/samples/laws/m0-moment-identification/yes/sample.json +97 -0
- package/samples/laws/m1-diagonal-regions/no/sample.json +44 -0
- package/samples/laws/m1-diagonal-regions/yes/sample.json +45 -0
- package/samples/laws/m1-generator-binomial/no/sample.json +21 -0
- package/samples/laws/m1-generator-binomial/yes/sample.json +290 -0
- package/samples/laws/m1-offdiag-limit/no/sample.json +17 -0
- package/samples/laws/m1-offdiag-limit/yes/sample.json +87 -0
- package/samples/laws/projection-chain/no/sample.json +26 -0
- package/samples/laws/projection-chain/yes/sample.json +25 -0
- package/samples/no/installed-artifact.json +2 -2
- package/samples/yes/installed-artifact.json +2 -2
- package/src/laws/laws.bound +146 -0
- package/vectors/laws/a7-t90.json +72 -0
- package/vectors/laws/a9-t99.json +110 -0
- package/vectors/laws/definitions.native-capture.json +326 -0
- package/vectors/laws/definitions.native.json +82 -0
- package/vectors/laws/experiment1a-protocol.native-capture.json +391 -0
- package/vectors/laws/experiment1a-protocol.native.json +64 -0
- package/vectors/laws/experiment1a-public-input.native-capture.json +224 -0
- package/vectors/laws/m0-binomial-bridge.lean.json +185 -0
- package/vectors/laws/m0-diagonal-lindeberg.lean.json +167 -0
- package/vectors/laws/m0-diagonal-moments.lean.json +185 -0
- package/vectors/laws/m0-diagonal-symmetric.lean.json +188 -0
- package/vectors/laws/m0-diagonal-threshold.lean.json +199 -0
- package/vectors/laws/m0-identification.lean.json +136 -0
- package/vectors/laws/m0-identification.native-capture.json +230 -0
- package/vectors/laws/m0-keff-interval.json +569 -0
- package/vectors/laws/m0-uncertainty-blocks.lean.json +201 -0
- package/vectors/laws/m0-uncertainty-finite-discord.lean.json +194 -0
- package/vectors/laws/m0-uncertainty-interval.lean.json +189 -0
- package/vectors/laws/m0-uncertainty.native-capture.json +651 -0
- package/vectors/laws/m1-diagonal-partial.lean.json +192 -0
- package/vectors/laws/m1-diagonal-partial.native-capture.json +275 -0
- package/vectors/laws/m1-generator-binomial.lean.json +162 -0
- package/vectors/laws/m1-generator-binomial.native-capture.json +245 -0
- package/vectors/laws/m1-offdiag-limit.lean.json +166 -0
- package/vectors/laws/m1-offdiag-limit.native-capture.json +260 -0
- package/vectors/laws/model-collapse-1a.json +12 -0
- package/vectors/laws/projection-chain.json +61 -0
- package/vectors/laws/projection-chain.native-capture.json +311 -0
- package/vectors/laws/projection-chain.native.json +56 -0
- package/vectors/measures/installed-artifact.cli.json +6 -6
- package/CHANGELOG.md +0 -10
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import Obligations045.M0Limit
|
|
2
|
+
import Mathlib.Probability.StrongLaw
|
|
3
|
+
import Mathlib.MeasureTheory.Integral.DominatedConvergence
|
|
4
|
+
open scoped BigOperators
|
|
5
|
+
open Filter Topology MeasureTheory ProbabilityTheory
|
|
6
|
+
noncomputable section
|
|
7
|
+
namespace Obligations045.M0
|
|
8
|
+
|
|
9
|
+
theorem floor_quota_bounds (M : Domain) (N i : ℕ) :
|
|
10
|
+
(∑ j ∈ Finset.range M.K, allocation M.w N j = N) ∧
|
|
11
|
+
(-1 < (allocation M.w N i : ℝ)-(N:ℝ)*M.w i ∧
|
|
12
|
+
(allocation M.w N i : ℝ)-(N:ℝ)*M.w i < 1) :=
|
|
13
|
+
⟨allocation_sum M N, allocation_discrepancy M N i⟩
|
|
14
|
+
|
|
15
|
+
theorem allocation_ratio (M : Domain) (i : ℕ) :
|
|
16
|
+
Tendsto (fun N : ℕ => (allocation M.w N i : ℝ)/(N:ℝ)) atTop (𝓝 (M.w i)) := by
|
|
17
|
+
have hInv : Tendsto (fun N : ℕ => (1:ℝ)/(N:ℝ)) atTop (𝓝 0) :=
|
|
18
|
+
tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop
|
|
19
|
+
apply tendsto_of_tendsto_of_tendsto_of_le_of_le'
|
|
20
|
+
(by simpa using tendsto_const_nhds.sub hInv)
|
|
21
|
+
(by simpa using tendsto_const_nhds.add hInv)
|
|
22
|
+
· filter_upwards [eventually_ge_atTop 1] with N hN
|
|
23
|
+
have hp : 0 < (N:ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hN)
|
|
24
|
+
rw [le_div_iff₀ hp, sub_mul, inv_mul_cancel₀ hp.ne']
|
|
25
|
+
linarith [(allocation_discrepancy M N i).1]
|
|
26
|
+
· filter_upwards [eventually_ge_atTop 1] with N hN
|
|
27
|
+
have hp : 0 < (N:ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hN)
|
|
28
|
+
rw [div_le_iff₀ hp, add_mul, inv_mul_cancel₀ hp.ne']
|
|
29
|
+
linarith [(allocation_discrepancy M N i).2]
|
|
30
|
+
|
|
31
|
+
theorem allocation_zero (M : Domain) (i : ℕ) (hw : M.w i = 0) (N : ℕ) :
|
|
32
|
+
allocation M.w N i = 0 := by
|
|
33
|
+
simp [allocation, prefix_succ, hw]
|
|
34
|
+
|
|
35
|
+
theorem allocation_atTop (M : Domain) (i : ℕ) (hw : 0 < M.w i) :
|
|
36
|
+
Tendsto (fun N => allocation M.w N i) atTop atTop := by
|
|
37
|
+
apply (tendsto_natCast_atTop_iff (R := ℝ)).mp
|
|
38
|
+
apply tendsto_atTop.2
|
|
39
|
+
intro r
|
|
40
|
+
have he : ∀ᶠ N : ℕ in atTop, (r+1)/M.w i ≤ (N:ℝ) :=
|
|
41
|
+
tendsto_natCast_atTop_atTop.eventually (eventually_ge_atTop _)
|
|
42
|
+
filter_upwards [he] with N hN
|
|
43
|
+
have hmul := (div_le_iff₀ hw).mp hN
|
|
44
|
+
linarith [(allocation_discrepancy M N i).1]
|
|
45
|
+
|
|
46
|
+
theorem lineage_quota_limit (M : Domain) (i : ℕ) (z : ℕ → ℝ) (q : ℝ)
|
|
47
|
+
(hz0 : z 0 = 0)
|
|
48
|
+
(hz : Tendsto (fun n : ℕ => z n/(n:ℝ)) atTop (𝓝 q)) :
|
|
49
|
+
Tendsto (fun N : ℕ => z (allocation M.w N i)/(N:ℝ)) atTop (𝓝 (M.w i*q)) := by
|
|
50
|
+
by_cases hw : M.w i = 0
|
|
51
|
+
· simp [allocation_zero M i hw, hz0, hw]
|
|
52
|
+
· have hp : 0 < M.w i := lt_of_le_of_ne (M.w_nonneg i) (Ne.symm hw)
|
|
53
|
+
have h := (allocation_ratio M i).mul (hz.comp (allocation_atTop M i hp))
|
|
54
|
+
convert h using 1
|
|
55
|
+
funext N
|
|
56
|
+
by_cases hn : allocation M.w N i = 0
|
|
57
|
+
· simp [hn, hz0]
|
|
58
|
+
· dsimp
|
|
59
|
+
rw [div_mul_div_comm, mul_comm (allocation M.w N i : ℝ), mul_div_mul_right _ _ (by exact_mod_cast hn : (allocation M.w N i : ℝ) ≠ 0)]
|
|
60
|
+
|
|
61
|
+
/-- The imported strong law is applied to actual lineage variables; no convergence certificate. -/
|
|
62
|
+
theorem lineage_lgn {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω)
|
|
63
|
+
(X : ℕ → Ω → ℝ) (q : ℝ)
|
|
64
|
+
(hint : Integrable (X 0) μ)
|
|
65
|
+
(hindep : Pairwise (fun i j : ℕ => IndepFun (X i) (X j) μ))
|
|
66
|
+
(hident : ∀ i, IdentDistrib (X i) (X 0) μ μ)
|
|
67
|
+
(hmean : ∫ ω, X 0 ω ∂μ = q) :
|
|
68
|
+
∀ᵐ ω ∂μ, Tendsto (fun n : ℕ => (∑ j ∈ Finset.range n, X j ω)/(n:ℝ))
|
|
69
|
+
atTop (𝓝 q) := by
|
|
70
|
+
simpa only [hmean] using strong_law_ae_real X hint hindep hident
|
|
71
|
+
|
|
72
|
+
def memberAverage {Ω : Type*} (M : Domain) (X : Fin M.K → ℕ → Ω → ℝ)
|
|
73
|
+
(N : ℕ) (ω : Ω) : ℝ :=
|
|
74
|
+
∑ i : Fin M.K, (∑ j ∈ Finset.range (allocation M.w N i), X i j ω)/(N:ℝ)
|
|
75
|
+
|
|
76
|
+
theorem member_average_lgn {Ω : Type*} [MeasurableSpace Ω]
|
|
77
|
+
(M : Domain) (a : Fin M.K → Bool) (μ : Measure Ω)
|
|
78
|
+
(X : Fin M.K → ℕ → Ω → ℝ)
|
|
79
|
+
(hint : ∀ i, Integrable (X i 0) μ)
|
|
80
|
+
(hindep : ∀ i, Pairwise (fun j k : ℕ => IndepFun (X i j) (X i k) μ))
|
|
81
|
+
(hident : ∀ i j, IdentDistrib (X i j) (X i 0) μ μ)
|
|
82
|
+
(hmean : ∀ i, ∫ ω, X i 0 ω ∂μ = q M (a i)) :
|
|
83
|
+
∀ᵐ ω ∂μ, Tendsto (fun N => memberAverage M X N ω) atTop (𝓝 (score M a)) := by
|
|
84
|
+
have hall : ∀ᵐ ω ∂μ, ∀ i : Fin M.K,
|
|
85
|
+
Tendsto (fun n : ℕ => (∑ j ∈ Finset.range n, X i j ω)/(n:ℝ))
|
|
86
|
+
atTop (𝓝 (q M (a i))) := by
|
|
87
|
+
rw [ae_all_iff]
|
|
88
|
+
intro i
|
|
89
|
+
exact lineage_lgn μ (X i) (q M (a i)) (hint i) (hindep i) (hident i) (hmean i)
|
|
90
|
+
filter_upwards [hall] with ω hω
|
|
91
|
+
unfold memberAverage score
|
|
92
|
+
apply tendsto_finset_sum
|
|
93
|
+
intro i _
|
|
94
|
+
exact lineage_quota_limit M i (fun n => ∑ j ∈ Finset.range n, X i j ω)
|
|
95
|
+
(q M (a i)) (by simp) (hω i)
|
|
96
|
+
|
|
97
|
+
theorem floor_limit_offdiag_scalar {f : ℕ → ℝ} {s : ℝ}
|
|
98
|
+
(hf : Tendsto f atTop (𝓝 s)) (hne : s ≠ (1:ℝ)/2) :
|
|
99
|
+
Tendsto (fun N => limitingLoss (f N)) atTop (𝓝 (limitingLoss s)) := by
|
|
100
|
+
by_cases hs : s < (1:ℝ)/2
|
|
101
|
+
· have he : ∀ᶠ N in atTop, f N < (1:ℝ)/2 := hf.eventually (Iio_mem_nhds hs)
|
|
102
|
+
have hEq : (fun N => limitingLoss (f N)) =ᶠ[atTop] (fun _ => (1:ℝ)) :=
|
|
103
|
+
he.mono (fun N hN => by change limitingLoss (f N) = 1; rw [limitingLoss, if_pos hN])
|
|
104
|
+
rw [limitingLoss, if_pos hs]
|
|
105
|
+
exact tendsto_const_nhds.congr' hEq.symm
|
|
106
|
+
· have hg : (1:ℝ)/2 < s := lt_of_le_of_ne (le_of_not_gt hs) (Ne.symm hne)
|
|
107
|
+
have he : ∀ᶠ N in atTop, (1:ℝ)/2 < f N := hf.eventually (Ioi_mem_nhds hg)
|
|
108
|
+
have hEq : (fun N => limitingLoss (f N)) =ᶠ[atTop] (fun _ => (0:ℝ)) :=
|
|
109
|
+
he.mono (fun N hN => by
|
|
110
|
+
change limitingLoss (f N) = 0
|
|
111
|
+
rw [limitingLoss, if_neg (not_lt.mpr hN.le), if_neg (Ne.symm hN.ne)])
|
|
112
|
+
rw [limitingLoss, if_neg hs, if_neg hne]
|
|
113
|
+
exact tendsto_const_nhds.congr' hEq.symm
|
|
114
|
+
|
|
115
|
+
/-- Off-diagonal passage from actual sample averages to error probabilities.
|
|
116
|
+
Unlike the diagonal, no CLT is needed. The lineage strong laws and quota
|
|
117
|
+
composition must supply haverage for the chosen M0 array. -/
|
|
118
|
+
theorem floor_limit_offdiag {Ω : Type*} [MeasurableSpace Ω]
|
|
119
|
+
(μ : Measure Ω) [IsProbabilityMeasure μ]
|
|
120
|
+
(average : ℕ → Ω → ℝ) (s : ℝ)
|
|
121
|
+
(hmeas : ∀ N, AEStronglyMeasurable (fun ω => limitingLoss (average N ω)) μ)
|
|
122
|
+
(haverage : ∀ᵐ ω ∂μ, Tendsto (fun N => average N ω) atTop (𝓝 s))
|
|
123
|
+
(hne : s ≠ (1:ℝ)/2) :
|
|
124
|
+
Tendsto (fun N => ∫ ω, limitingLoss (average N ω) ∂μ)
|
|
125
|
+
atTop (𝓝 (limitingLoss s)) := by
|
|
126
|
+
have hbound : ∀ N, ∀ᵐ ω ∂μ, ‖limitingLoss (average N ω)‖ ≤ (1:ℝ) := by
|
|
127
|
+
intro N
|
|
128
|
+
filter_upwards [] with ω
|
|
129
|
+
unfold limitingLoss
|
|
130
|
+
split_ifs <;> norm_num
|
|
131
|
+
have hlim : ∀ᵐ ω ∂μ, Tendsto (fun N => limitingLoss (average N ω))
|
|
132
|
+
atTop (𝓝 (limitingLoss s)) := haverage.mono (fun ω hω => floor_limit_offdiag_scalar hω hne)
|
|
133
|
+
simpa using tendsto_integral_of_dominated_convergence (fun _ => (1:ℝ)) hmeas
|
|
134
|
+
(integrable_const (1:ℝ)) hbound hlim
|
|
135
|
+
|
|
136
|
+
/-- M0 off-diagonal probability limit from declared lineage laws and the proved quotas.
|
|
137
|
+
The only extra technical input is measurability of the loss; no asymptotic
|
|
138
|
+
convergence hypothesis and no CLT certificate is assumed. -/
|
|
139
|
+
theorem floor_limit_offdiag_M0 {Ω : Type*} [MeasurableSpace Ω]
|
|
140
|
+
(M : Domain) (a : Fin M.K → Bool) (μ : Measure Ω) [IsProbabilityMeasure μ]
|
|
141
|
+
(X : Fin M.K → ℕ → Ω → ℝ)
|
|
142
|
+
(hint : ∀ i, Integrable (X i 0) μ)
|
|
143
|
+
(hindep : ∀ i, Pairwise (fun j k : ℕ => IndepFun (X i j) (X i k) μ))
|
|
144
|
+
(hident : ∀ i j, IdentDistrib (X i j) (X i 0) μ μ)
|
|
145
|
+
(hmean : ∀ i, ∫ ω, X i 0 ω ∂μ = q M (a i))
|
|
146
|
+
(hmeas : ∀ N, AEStronglyMeasurable (fun ω => limitingLoss (memberAverage M X N ω)) μ)
|
|
147
|
+
(hoff : score M a ≠ (1:ℝ)/2) :
|
|
148
|
+
Tendsto (fun N => ∫ ω, limitingLoss (memberAverage M X N ω) ∂μ)
|
|
149
|
+
atTop (𝓝 (limitingLoss (score M a))) := by
|
|
150
|
+
exact floor_limit_offdiag μ (memberAverage M X) (score M a) hmeas
|
|
151
|
+
(member_average_lgn M a μ X hint hindep hident hmean) hoff
|
|
152
|
+
|
|
153
|
+
theorem floor_limit_offdiag_mixture {Ω : Type*} [MeasurableSpace Ω]
|
|
154
|
+
(M : Domain) (μ : Measure Ω) [IsProbabilityMeasure μ]
|
|
155
|
+
(X : (Fin M.K → Bool) → Fin M.K → ℕ → Ω → ℝ)
|
|
156
|
+
(hint : ∀ a i, Integrable (X a i 0) μ)
|
|
157
|
+
(hindep : ∀ a i, Pairwise (fun j k : ℕ => IndepFun (X a i j) (X a i k) μ))
|
|
158
|
+
(hident : ∀ a i j, IdentDistrib (X a i j) (X a i 0) μ μ)
|
|
159
|
+
(hmean : ∀ a i, ∫ ω, X a i 0 ω ∂μ = q M (a i))
|
|
160
|
+
(hmeas : ∀ a N, AEStronglyMeasurable (fun ω => limitingLoss (memberAverage M (X a) N ω)) μ)
|
|
161
|
+
(hoff : ∀ a, score M a ≠ (1:ℝ)/2) :
|
|
162
|
+
Tendsto (fun N => ∑ a : Fin M.K → Bool, latentMass M a *
|
|
163
|
+
∫ ω, limitingLoss (memberAverage M (X a) N ω) ∂μ)
|
|
164
|
+
atTop (𝓝 (floor M)) := by
|
|
165
|
+
unfold floor
|
|
166
|
+
apply tendsto_finset_sum
|
|
167
|
+
intro a _
|
|
168
|
+
exact tendsto_const_nhds.mul (floor_limit_offdiag_M0 M a μ (X a)
|
|
169
|
+
(hint a) (hindep a) (hident a) (hmean a) (hmeas a) (hoff a))
|
|
170
|
+
|
|
171
|
+
end Obligations045.M0
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.1.0",
|
|
3
|
+
"packagesDir": ".lake/packages",
|
|
4
|
+
"packages": [
|
|
5
|
+
{
|
|
6
|
+
"url": "https://github.com/leanprover-community/plausible",
|
|
7
|
+
"type": "git",
|
|
8
|
+
"subDir": null,
|
|
9
|
+
"scope": "leanprover-community",
|
|
10
|
+
"rev": "77e08eddc486491d7b9e470926b3dbe50319451a",
|
|
11
|
+
"name": "plausible",
|
|
12
|
+
"manifestFile": "lake-manifest.json",
|
|
13
|
+
"inputRev": "main",
|
|
14
|
+
"inherited": true,
|
|
15
|
+
"configFile": "lakefile.toml"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"url": "https://github.com/leanprover-community/LeanSearchClient",
|
|
19
|
+
"type": "git",
|
|
20
|
+
"subDir": null,
|
|
21
|
+
"scope": "leanprover-community",
|
|
22
|
+
"rev": "25078369972d295301f5a1e53c3e5850cf6d9d4c",
|
|
23
|
+
"name": "LeanSearchClient",
|
|
24
|
+
"manifestFile": "lake-manifest.json",
|
|
25
|
+
"inputRev": "main",
|
|
26
|
+
"inherited": true,
|
|
27
|
+
"configFile": "lakefile.toml"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"url": "https://github.com/leanprover-community/import-graph",
|
|
31
|
+
"type": "git",
|
|
32
|
+
"subDir": null,
|
|
33
|
+
"scope": "leanprover-community",
|
|
34
|
+
"rev": "e6a9f0f5ee3ccf7443a0070f92b62f8db12ae82b",
|
|
35
|
+
"name": "importGraph",
|
|
36
|
+
"manifestFile": "lake-manifest.json",
|
|
37
|
+
"inputRev": "main",
|
|
38
|
+
"inherited": true,
|
|
39
|
+
"configFile": "lakefile.toml"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"url": "https://github.com/leanprover-community/ProofWidgets4",
|
|
43
|
+
"type": "git",
|
|
44
|
+
"subDir": null,
|
|
45
|
+
"scope": "leanprover-community",
|
|
46
|
+
"rev": "c4919189477c3221e6a204008998b0d724f49904",
|
|
47
|
+
"name": "proofwidgets",
|
|
48
|
+
"manifestFile": "lake-manifest.json",
|
|
49
|
+
"inputRev": "v0.0.57",
|
|
50
|
+
"inherited": true,
|
|
51
|
+
"configFile": "lakefile.lean"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"url": "https://github.com/leanprover-community/aesop",
|
|
55
|
+
"type": "git",
|
|
56
|
+
"subDir": null,
|
|
57
|
+
"scope": "leanprover-community",
|
|
58
|
+
"rev": "5d50b08dedd7d69b3d9b3176e0d58a23af228884",
|
|
59
|
+
"name": "aesop",
|
|
60
|
+
"manifestFile": "lake-manifest.json",
|
|
61
|
+
"inputRev": "master",
|
|
62
|
+
"inherited": true,
|
|
63
|
+
"configFile": "lakefile.toml"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"url": "https://github.com/leanprover-community/quote4",
|
|
67
|
+
"type": "git",
|
|
68
|
+
"subDir": null,
|
|
69
|
+
"scope": "leanprover-community",
|
|
70
|
+
"rev": "fa4f7f15d97591a9cf3aa7724ba371c7fc6dda02",
|
|
71
|
+
"name": "Qq",
|
|
72
|
+
"manifestFile": "lake-manifest.json",
|
|
73
|
+
"inputRev": "master",
|
|
74
|
+
"inherited": true,
|
|
75
|
+
"configFile": "lakefile.toml"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"url": "https://github.com/leanprover-community/batteries",
|
|
79
|
+
"type": "git",
|
|
80
|
+
"subDir": null,
|
|
81
|
+
"scope": "leanprover-community",
|
|
82
|
+
"rev": "f5d04a9c4973d401c8c92500711518f7c656f034",
|
|
83
|
+
"name": "batteries",
|
|
84
|
+
"manifestFile": "lake-manifest.json",
|
|
85
|
+
"inputRev": "main",
|
|
86
|
+
"inherited": true,
|
|
87
|
+
"configFile": "lakefile.toml"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"url": "https://github.com/leanprover/lean4-cli",
|
|
91
|
+
"type": "git",
|
|
92
|
+
"subDir": null,
|
|
93
|
+
"scope": "leanprover",
|
|
94
|
+
"rev": "02dbd02bc00ec4916e99b04b2245b30200e200d0",
|
|
95
|
+
"name": "Cli",
|
|
96
|
+
"manifestFile": "lake-manifest.json",
|
|
97
|
+
"inputRev": "main",
|
|
98
|
+
"inherited": true,
|
|
99
|
+
"configFile": "lakefile.toml"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"url": "https://github.com/leanprover-community/mathlib4.git",
|
|
103
|
+
"type": "git",
|
|
104
|
+
"subDir": null,
|
|
105
|
+
"scope": "",
|
|
106
|
+
"rev": "c44e0c8ee63ca166450922a373c7409c5d26b00b",
|
|
107
|
+
"name": "mathlib",
|
|
108
|
+
"manifestFile": "lake-manifest.json",
|
|
109
|
+
"inputRev": "c44e0c8ee63ca166450922a373c7409c5d26b00b",
|
|
110
|
+
"inherited": false,
|
|
111
|
+
"configFile": "lakefile.lean"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"name": "obligations_lineage",
|
|
115
|
+
"lakeDir": ".lake"
|
|
116
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name = "obligations_lineage"
|
|
2
|
+
version = "0.0.0"
|
|
3
|
+
defaultTargets = ["Obligations045"]
|
|
4
|
+
[[require]]
|
|
5
|
+
name = "mathlib"
|
|
6
|
+
git = "https://github.com/leanprover-community/mathlib4.git"
|
|
7
|
+
rev = "c44e0c8ee63ca166450922a373c7409c5d26b00b"
|
|
8
|
+
[[lean_lib]]
|
|
9
|
+
name = "Obligations045"
|
|
10
|
+
|
|
11
|
+
[[lean_lib]]
|
|
12
|
+
name = "M0Bridge"
|
|
13
|
+
[[lean_lib]]
|
|
14
|
+
name = "BridgeNegatives"
|
|
15
|
+
|
|
16
|
+
[[lean_lib]]
|
|
17
|
+
name = "M0Diagonal046"
|
|
18
|
+
|
|
19
|
+
[[lean_lib]]
|
|
20
|
+
name = "M0Moments046"
|
|
21
|
+
|
|
22
|
+
[[lean_lib]]
|
|
23
|
+
name = "M0Lindeberg046"
|
|
24
|
+
|
|
25
|
+
[[lean_lib]]
|
|
26
|
+
name = "M0Threshold046"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
leanprover/lean4:v4.19.0
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import Obligations045.M0Coincidence
|
|
2
|
+
import Mathlib.Tactic.Linarith
|
|
3
|
+
import Mathlib.Tactic.FieldSimp
|
|
4
|
+
import Mathlib.Tactic.Positivity
|
|
5
|
+
|
|
6
|
+
noncomputable section
|
|
7
|
+
namespace Obligations046.M0Identification
|
|
8
|
+
open Obligations045.M0Coincidence
|
|
9
|
+
|
|
10
|
+
def powers (ws : List ℝ) (k : ℕ) : ℝ := (ws.map (fun w => w^k)).sum
|
|
11
|
+
|
|
12
|
+
def m1 (p : ℝ) (ws : List ℝ) := p*ws.sum
|
|
13
|
+
def m2 (p : ℝ) (ws : List ℝ) := p^2*ws.sum^2+p*(1-p)*powers ws 2
|
|
14
|
+
def m3 (p : ℝ) (ws : List ℝ) := p^3*ws.sum^3+3*p^2*(1-p)*ws.sum*powers ws 2+p*(1-p)*(1-2*p)*powers ws 3
|
|
15
|
+
def m4 (p : ℝ) (ws : List ℝ) := p^4*ws.sum^4+6*p^3*(1-p)*ws.sum^2*powers ws 2+3*(p*(1-p))^2*(powers ws 2)^2+4*p^2*(1-p)*(1-2*p)*ws.sum*powers ws 3+p*(1-p)*(1-6*p*(1-p))*powers ws 4
|
|
16
|
+
|
|
17
|
+
theorem expect_quartic (p : ℝ) (ws : List ℝ) (a b d e f : ℝ) :
|
|
18
|
+
expect p ws (fun x => a*x^4+b*x^3+d*x^2+e*x+f) =
|
|
19
|
+
a*m4 p ws+b*m3 p ws+d*m2 p ws+e*m1 p ws+f := by
|
|
20
|
+
induction ws generalizing a b d e f with
|
|
21
|
+
| nil => simp [expect, m1, m2, m3, m4, powers]
|
|
22
|
+
| cons w ws ih =>
|
|
23
|
+
have hf : (fun x : ℝ => a*(w+x)^4+b*(w+x)^3+d*(w+x)^2+e*(w+x)+f) =
|
|
24
|
+
(fun x => a*x^4+(4*a*w+b)*x^3+(6*a*w^2+3*b*w+d)*x^2+
|
|
25
|
+
(4*a*w^3+3*b*w^2+2*d*w+e)*x+(a*w^4+b*w^3+d*w^2+e*w+f)) := by
|
|
26
|
+
funext x
|
|
27
|
+
ring
|
|
28
|
+
simp only [expect, hf]
|
|
29
|
+
rw [ih, ih]
|
|
30
|
+
simp only [m1, m2, m3, m4, List.sum_cons, powers, List.map_cons]
|
|
31
|
+
ring
|
|
32
|
+
|
|
33
|
+
def r2 (p B : ℝ) := p^2+(1-p)^2+2*p*(1-p)*B
|
|
34
|
+
def r4 (p B C E : ℝ) := p^4+(1-p)^4+6*(p^2+(1-p)^2)*p*(1-p)*B-
|
|
35
|
+
4*p*(1-p)*(1-2*p)^2*C+6*(p*(1-p))^2*B^2+2*p*(1-p)*(1-6*p*(1-p))*E
|
|
36
|
+
|
|
37
|
+
theorem fourth_coincidence (p c : ℝ) (ws : List ℝ) (hw : ws.sum = 1) :
|
|
38
|
+
expect p ws (fun x => ((1-c)*p+c*x)^4+(1-((1-c)*p+c*x))^4) =
|
|
39
|
+
r4 p (c^2*powers ws 2) (c^3*powers ws 3) (c^4*powers ws 4) := by
|
|
40
|
+
have hf : (fun x : ℝ => ((1-c)*p+c*x)^4+(1-((1-c)*p+c*x))^4) =
|
|
41
|
+
(fun x => (2*c^4)*x^4+(4*c^3*(2*(1-c)*p-1))*x^3+
|
|
42
|
+
(6*c^2*(((1-c)*p)^2+(1-(1-c)*p)^2))*x^2+
|
|
43
|
+
(4*c*(((1-c)*p)^3-(1-(1-c)*p)^3))*x+
|
|
44
|
+
(((1-c)*p)^4+(1-(1-c)*p)^4)) := by
|
|
45
|
+
funext x
|
|
46
|
+
ring
|
|
47
|
+
rw [hf, expect_quartic]
|
|
48
|
+
simp only [m1, m2, m3, m4, hw, r4]
|
|
49
|
+
ring
|
|
50
|
+
|
|
51
|
+
def uniformR4 (p B x : ℝ) := r4 p B (B*x) (B*x^2)
|
|
52
|
+
|
|
53
|
+
theorem uniform_fourth_strict (p B x y : ℝ) (hp : 0 < p) (hp1 : p < 1)
|
|
54
|
+
(hB : 0 < B) (hx : 0 < x) (hy : x < y) (hy1 : y ≤ 1) :
|
|
55
|
+
uniformR4 p B y < uniformR4 p B x := by
|
|
56
|
+
have ha : 0 < p*(1-p) := mul_pos hp (sub_pos.mpr hp1)
|
|
57
|
+
have hs : 0 < x+y := by linarith
|
|
58
|
+
have hs2 : x+y ≤ 2 := by linarith
|
|
59
|
+
have hd : 0 ≤ (1-2*p)^2 := sq_nonneg _
|
|
60
|
+
have hn : (1-6*p*(1-p))*(x+y)-2*(1-2*p)^2 < 0 := by
|
|
61
|
+
by_cases h : 0 ≤ 1-6*p*(1-p)
|
|
62
|
+
· have hh := mul_le_mul_of_nonneg_left hs2 h
|
|
63
|
+
nlinarith [sq_nonneg (1-2*p)]
|
|
64
|
+
· have hh : (1-6*p*(1-p))*(x+y) < 0 := mul_neg_of_neg_of_pos (lt_of_not_ge h) hs
|
|
65
|
+
nlinarith
|
|
66
|
+
have hf : uniformR4 p B y-uniformR4 p B x =
|
|
67
|
+
2*p*(1-p)*B*(y-x)*((1-6*p*(1-p))*(x+y)-2*(1-2*p)^2) := by
|
|
68
|
+
unfold uniformR4 r4
|
|
69
|
+
ring
|
|
70
|
+
have hp1' : 0 < 1-p := sub_pos.mpr hp1
|
|
71
|
+
have hgap : 0 < y-x := sub_pos.mpr hy
|
|
72
|
+
have hpos : 0 < 2*p*(1-p)*B*(y-x) := by positivity
|
|
73
|
+
have := mul_neg_of_pos_of_neg hpos hn
|
|
74
|
+
linarith
|
|
75
|
+
|
|
76
|
+
theorem uniform_pair_fourth_injective (p B₁ B₂ x₁ x₂ : ℝ)
|
|
77
|
+
(hp : 0 < p) (hp1 : p < 1) (hB₁ : 0 < B₁) (hB₂ : 0 < B₂)
|
|
78
|
+
(hx₁ : 0 < x₁) (hx₂ : 0 < x₂) (hx₁1 : x₁ ≤ 1) (hx₂1 : x₂ ≤ 1)
|
|
79
|
+
(h2 : r2 p B₁ = r2 p B₂)
|
|
80
|
+
(h4 : uniformR4 p B₁ x₁ = uniformR4 p B₂ x₂) : B₁ = B₂ ∧ x₁ = x₂ := by
|
|
81
|
+
have ha : 0 < p*(1-p) := mul_pos hp (sub_pos.mpr hp1)
|
|
82
|
+
have hB : B₁ = B₂ := by unfold r2 at h2; nlinarith
|
|
83
|
+
subst B₂
|
|
84
|
+
refine ⟨rfl, ?_⟩
|
|
85
|
+
rcases lt_trichotomy x₁ x₂ with h|h|h
|
|
86
|
+
· have := uniform_fourth_strict p B₁ x₁ x₂ hp hp1 hB₁ hx₁ h hx₂1
|
|
87
|
+
linarith
|
|
88
|
+
· exact h
|
|
89
|
+
· have := uniform_fourth_strict p B₁ x₂ x₁ hp hp1 hB₁ hx₂ h hx₁1
|
|
90
|
+
linarith
|
|
91
|
+
|
|
92
|
+
-- Recovery is algebraic only after the explicitly uniform moment model has been justified.
|
|
93
|
+
theorem recover_uniform_parameters (B x c K : ℝ) (hx : x ≠ 0)
|
|
94
|
+
(hB : B = c*x) (hK : c = K*x) : c = B/x ∧ K = B/x^2 := by
|
|
95
|
+
constructor
|
|
96
|
+
· apply (eq_div_iff hx).mpr
|
|
97
|
+
nlinarith
|
|
98
|
+
· apply (eq_div_iff (pow_ne_zero 2 hx)).mpr
|
|
99
|
+
nlinarith [hB, congrArg (fun t : ℝ => t*x) hK]
|
|
100
|
+
|
|
101
|
+
theorem uniform_cK_injective (p c₁ c₂ K₁ K₂ : ℝ)
|
|
102
|
+
(hp : 0 < p) (hp1 : p < 1) (hc₁ : 0 < c₁) (hc₂ : 0 < c₂)
|
|
103
|
+
(hc₁1 : c₁ ≤ 1) (hc₂1 : c₂ ≤ 1) (hK₁ : 1 ≤ K₁) (hK₂ : 1 ≤ K₂)
|
|
104
|
+
(h2 : r2 p (c₁^2/K₁) = r2 p (c₂^2/K₂))
|
|
105
|
+
(h4 : r4 p (c₁^2/K₁) (c₁^3/K₁^2) (c₁^4/K₁^3) =
|
|
106
|
+
r4 p (c₂^2/K₂) (c₂^3/K₂^2) (c₂^4/K₂^3)) : c₁ = c₂ ∧ K₁ = K₂ := by
|
|
107
|
+
have hK₁0 : 0 < K₁ := by linarith
|
|
108
|
+
have hK₂0 : 0 < K₂ := by linarith
|
|
109
|
+
have hf (c K : ℝ) : r4 p (c^2/K) (c^3/K^2) (c^4/K^3) =
|
|
110
|
+
uniformR4 p (c^2/K) (c/K) := by simp only [uniformR4, r4]; ring
|
|
111
|
+
rw [hf, hf] at h4
|
|
112
|
+
have h := uniform_pair_fourth_injective p (c₁^2/K₁) (c₂^2/K₂) (c₁/K₁) (c₂/K₂)
|
|
113
|
+
hp hp1 (by positivity) (by positivity) (by positivity) (by positivity)
|
|
114
|
+
((div_le_one hK₁0).mpr (by linarith)) ((div_le_one hK₂0).mpr (by linarith)) h2 h4
|
|
115
|
+
have rec (c K : ℝ) (hc : 0 < c) (hK : 0 < K) :
|
|
116
|
+
c = (c^2/K)/(c/K) ∧ K = (c^2/K)/(c/K)^2 := by
|
|
117
|
+
have hb : c^2/K = c*(c/K) := by ring
|
|
118
|
+
have hk : c = K*(c/K) := by field_simp [ne_of_gt hK]
|
|
119
|
+
exact recover_uniform_parameters (c^2/K) (c/K) c K (ne_of_gt (div_pos hc hK)) hb hk
|
|
120
|
+
have h₁ := rec c₁ K₁ hc₁ hK₁0
|
|
121
|
+
have h₂ := rec c₂ K₂ hc₂ hK₂0
|
|
122
|
+
constructor
|
|
123
|
+
· rw [h₁.1, h₂.1, h.1, h.2]
|
|
124
|
+
· rw [h₁.2, h₂.2, h.1, h.2]
|
|
125
|
+
|
|
126
|
+
def weightsA : List ℝ := List.replicate 36 (1/42) ++ List.replicate 3 (1/21)
|
|
127
|
+
def weightsB : List ℝ := List.replicate 48 (1/96) ++ List.replicate 16 (1/32)
|
|
128
|
+
|
|
129
|
+
theorem nonuniform_normalized : weightsA.sum = 1 ∧ weightsB.sum = 1 := by
|
|
130
|
+
norm_num [weightsA, weightsB, List.sum_replicate]
|
|
131
|
+
|
|
132
|
+
theorem nonuniform_power_collision :
|
|
133
|
+
(7/10:ℝ)^2*powers weightsA 2 = (4/5:ℝ)^2*powers weightsB 2 ∧
|
|
134
|
+
(7/10:ℝ)^3*powers weightsA 3 = (4/5:ℝ)^3*powers weightsB 3 ∧
|
|
135
|
+
(7/10:ℝ)^4*powers weightsA 4 = (4/5:ℝ)^4*powers weightsB 4 := by
|
|
136
|
+
norm_num [powers, weightsA, weightsB, List.sum_replicate]
|
|
137
|
+
|
|
138
|
+
theorem nonuniform_same_pair_fourth (p : ℝ) :
|
|
139
|
+
r2 p ((7/10)^2*powers weightsA 2) = r2 p ((4/5)^2*powers weightsB 2) ∧
|
|
140
|
+
r4 p ((7/10)^2*powers weightsA 2) ((7/10)^3*powers weightsA 3) ((7/10)^4*powers weightsA 4) =
|
|
141
|
+
r4 p ((4/5)^2*powers weightsB 2) ((4/5)^3*powers weightsB 3) ((4/5)^4*powers weightsB 4) := by
|
|
142
|
+
obtain ⟨h2,h3,h4⟩ := nonuniform_power_collision
|
|
143
|
+
exact ⟨congrArg (r2 p) h2, by rw [h2,h3,h4]⟩
|
|
144
|
+
|
|
145
|
+
theorem nonuniform_distinct_parameters :
|
|
146
|
+
(7/10:ℝ) ≠ 4/5 ∧ (1:ℝ)/powers weightsA 2 = 147/4 ∧
|
|
147
|
+
(1:ℝ)/powers weightsB 2 = 48 := by
|
|
148
|
+
norm_num [powers, weightsA, weightsB, List.sum_replicate]
|
|
149
|
+
|
|
150
|
+
-- Population expectations themselves coincide, not just invented summaries.
|
|
151
|
+
theorem nonuniform_actual_fourth_collision (p : ℝ) :
|
|
152
|
+
expect p weightsA (fun x => ((1-(7/10))*p+(7/10)*x)^4+(1-((1-(7/10))*p+(7/10)*x))^4) =
|
|
153
|
+
expect p weightsB (fun x => ((1-(4/5))*p+(4/5)*x)^4+(1-((1-(4/5))*p+(4/5)*x))^4) := by
|
|
154
|
+
rw [fourth_coincidence p (7/10) weightsA nonuniform_normalized.1,
|
|
155
|
+
fourth_coincidence p (4/5) weightsB nonuniform_normalized.2]
|
|
156
|
+
exact (nonuniform_same_pair_fourth p).2
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def uniformWeights (n : ℕ) : List ℝ := List.replicate n (1/(n:ℝ))
|
|
160
|
+
|
|
161
|
+
theorem uniform_normalized (n : ℕ) (hn : 0 < n) : (uniformWeights n).sum = 1 := by
|
|
162
|
+
have hn0 : (n:ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn)
|
|
163
|
+
simp [uniformWeights, List.sum_replicate, hn0]
|
|
164
|
+
|
|
165
|
+
theorem uniform_powers (n k : ℕ) : powers (uniformWeights n) k = (n:ℝ)*(1/(n:ℝ))^k := by
|
|
166
|
+
simp [powers, uniformWeights, List.sum_replicate]
|
|
167
|
+
|
|
168
|
+
theorem uniform_population_pair (p c : ℝ) (n : ℕ) (hn : 0 < n) :
|
|
169
|
+
expect p (uniformWeights n) (fun x => ((1-c)*p+c*x)^2+(1-((1-c)*p+c*x))^2) =
|
|
170
|
+
r2 p (c^2/(n:ℝ)) := by
|
|
171
|
+
rw [pair_coincidence p c (uniformWeights n) (uniform_normalized n hn)]
|
|
172
|
+
change p^2+(1-p)^2+2*c^2*p*(1-p)*powers (uniformWeights n) 2 = _
|
|
173
|
+
rw [uniform_powers]
|
|
174
|
+
unfold r2
|
|
175
|
+
have hn0 : (n:ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn)
|
|
176
|
+
field_simp
|
|
177
|
+
ring
|
|
178
|
+
|
|
179
|
+
theorem uniform_population_fourth (p c : ℝ) (n : ℕ) (hn : 0 < n) :
|
|
180
|
+
expect p (uniformWeights n) (fun x => ((1-c)*p+c*x)^4+(1-((1-c)*p+c*x))^4) =
|
|
181
|
+
r4 p (c^2/(n:ℝ)) (c^3/(n:ℝ)^2) (c^4/(n:ℝ)^3) := by
|
|
182
|
+
rw [fourth_coincidence p c (uniformWeights n) (uniform_normalized n hn)]
|
|
183
|
+
rw [uniform_powers, uniform_powers, uniform_powers]
|
|
184
|
+
have hn0 : (n:ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn)
|
|
185
|
+
congr 1 <;> field_simp <;> ring
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
theorem uniform_population_identification (p c₁ c₂ : ℝ) (n₁ n₂ : ℕ)
|
|
189
|
+
(hp : 0 < p) (hp1 : p < 1) (hc₁ : 0 < c₁) (hc₂ : 0 < c₂)
|
|
190
|
+
(hc₁1 : c₁ ≤ 1) (hc₂1 : c₂ ≤ 1) (hn₁ : 0 < n₁) (hn₂ : 0 < n₂)
|
|
191
|
+
(h2 : expect p (uniformWeights n₁) (fun x => ((1-c₁)*p+c₁*x)^2+(1-((1-c₁)*p+c₁*x))^2) =
|
|
192
|
+
expect p (uniformWeights n₂) (fun x => ((1-c₂)*p+c₂*x)^2+(1-((1-c₂)*p+c₂*x))^2))
|
|
193
|
+
(h4 : expect p (uniformWeights n₁) (fun x => ((1-c₁)*p+c₁*x)^4+(1-((1-c₁)*p+c₁*x))^4) =
|
|
194
|
+
expect p (uniformWeights n₂) (fun x => ((1-c₂)*p+c₂*x)^4+(1-((1-c₂)*p+c₂*x))^4)) :
|
|
195
|
+
c₁ = c₂ ∧ n₁ = n₂ := by
|
|
196
|
+
rw [uniform_population_pair p c₁ n₁ hn₁, uniform_population_pair p c₂ n₂ hn₂] at h2
|
|
197
|
+
rw [uniform_population_fourth p c₁ n₁ hn₁, uniform_population_fourth p c₂ n₂ hn₂] at h4
|
|
198
|
+
have h := uniform_cK_injective p c₁ c₂ (n₁:ℝ) (n₂:ℝ) hp hp1 hc₁ hc₂ hc₁1 hc₂1
|
|
199
|
+
(by exact_mod_cast hn₁) (by exact_mod_cast hn₂) h2 h4
|
|
200
|
+
exact ⟨h.1, by exact_mod_cast h.2⟩
|
|
201
|
+
|
|
202
|
+
theorem unknown_p_alias (p : ℝ) : r2 p 1 = 1 ∧ r4 p 1 1 1 = 1 := by
|
|
203
|
+
constructor <;> simp only [r2, r4] <;> ring
|
|
204
|
+
|
|
205
|
+
theorem zero_c_alias (p : ℝ) : r2 p 0 = p^2+(1-p)^2 ∧
|
|
206
|
+
r4 p 0 0 0 = p^4+(1-p)^4 := by
|
|
207
|
+
constructor <;> simp only [r2, r4] <;> ring
|
|
208
|
+
|
|
209
|
+
end Obligations046.M0Identification
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Mathlib.Data.Real.Basic
|
|
2
|
+
import Mathlib.Tactic.Ring
|
|
3
|
+
namespace Obligations045.M0Coincidence
|
|
4
|
+
/-- Exact expectation over independent Bernoulli(p) latent lineages.
|
|
5
|
+
The recurrence keeps both branches and their actual probabilities. -/
|
|
6
|
+
def expect (p : ℝ) : List ℝ → (ℝ → ℝ) → ℝ
|
|
7
|
+
| [], f => f 0
|
|
8
|
+
| w :: ws, f => (1-p)*expect p ws f + p*expect p ws (fun x => f (w+x))
|
|
9
|
+
def squares (ws : List ℝ) : ℝ := (ws.map (fun w => w^2)).sum
|
|
10
|
+
|
|
11
|
+
theorem expect_quadratic (p : ℝ) (ws : List ℝ) (a b d : ℝ) :
|
|
12
|
+
expect p ws (fun x => a*x^2+b*x+d) =
|
|
13
|
+
a*(p^2*ws.sum^2+p*(1-p)*squares ws)+b*p*ws.sum+d := by
|
|
14
|
+
induction ws generalizing a b d with
|
|
15
|
+
| nil => simp [expect, squares]
|
|
16
|
+
| cons w ws ih =>
|
|
17
|
+
have hf : (fun x : ℝ => a*(w+x)^2+b*(w+x)+d) =
|
|
18
|
+
(fun x => a*x^2+(2*a*w+b)*x+(a*w^2+b*w+d)) := by
|
|
19
|
+
funext x
|
|
20
|
+
ring
|
|
21
|
+
simp only [expect, hf]
|
|
22
|
+
rw [ih, ih]
|
|
23
|
+
simp only [List.sum_cons, squares, List.map_cons]
|
|
24
|
+
ring
|
|
25
|
+
|
|
26
|
+
theorem pair_coincidence (p c : ℝ) (ws : List ℝ) (hw : ws.sum = 1) :
|
|
27
|
+
expect p ws (fun x => ((1-c)*p+c*x)^2+(1-((1-c)*p+c*x))^2) =
|
|
28
|
+
p^2+(1-p)^2+2*c^2*p*(1-p)*squares ws := by
|
|
29
|
+
have hf : (fun x : ℝ => ((1-c)*p+c*x)^2+(1-((1-c)*p+c*x))^2) =
|
|
30
|
+
(fun x => (2*c^2)*x^2+(2*c*(2*(1-c)*p-1))*x+
|
|
31
|
+
(((1-c)*p)^2+(1-(1-c)*p)^2)) := by
|
|
32
|
+
funext x
|
|
33
|
+
ring
|
|
34
|
+
rw [hf, expect_quadratic, hw]
|
|
35
|
+
ring
|
|
36
|
+
|
|
37
|
+
theorem triple_redundant (q : ℝ) :
|
|
38
|
+
q^3+(1-q)^3 = (3*(q^2+(1-q)^2)-1)/2 := by ring
|
|
39
|
+
end Obligations045.M0Coincidence
|