@lapxo/obligations 0.4.4 β 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 +147 -4
- package/contracts/extension-lineage-participation.json +30 -0
- package/contracts/m0-allocation.json +6 -0
- package/contracts/m0-binomial-bridge.json +6 -0
- package/contracts/m0-diagonal-conditional.json +15 -0
- package/contracts/m0-finite-grid.json +6 -0
- package/contracts/m0-keff-interval.json +27 -0
- package/contracts/m0-limit-diag.json +6 -0
- package/contracts/m0-limit-offdiag.json +6 -0
- package/contracts/m0-moment-identification.json +42 -0
- package/contracts/m0-pair-coincidence.json +6 -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-allocation.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-finite-grid.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-limit-diag.md +1 -0
- package/docs/contracts/m0-limit-offdiag.md +1 -0
- package/docs/contracts/m0-moment-identification.md +1 -0
- package/docs/contracts/m0-pair-coincidence.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/docs/proofs/floor-limit-diag.proof.json +29 -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-045/Obligations045/ConsensusGrid.lean +72 -0
- package/proofs/m0-045/Obligations045/M0Coincidence.lean +39 -0
- package/proofs/m0-045/Obligations045/M0Diagonal.lean +18 -0
- package/proofs/m0-045/Obligations045/M0Limit.lean +134 -0
- package/proofs/m0-045/Obligations045/M0Offdiag.lean +171 -0
- package/proofs/m0-045/Obligations045.lean +5 -0
- package/proofs/m0-045/lake-manifest.json +116 -0
- package/proofs/m0-045/lakefile.toml +9 -0
- package/proofs/m0-045/lean-toolchain +1 -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 +684 -208
- 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-allocation/no/sample.json +5 -0
- package/samples/laws/m0-allocation/yes/sample.json +7 -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-finite-grid/no/sample.json +5 -0
- package/samples/laws/m0-finite-grid/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-limit-diag/no/sample.json +5 -0
- package/samples/laws/m0-limit-diag/yes/sample.json +7 -0
- package/samples/laws/m0-limit-offdiag/no/sample.json +5 -0
- package/samples/laws/m0-limit-offdiag/yes/sample.json +7 -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/m0-pair-coincidence/no/sample.json +5 -0
- package/samples/laws/m0-pair-coincidence/yes/sample.json +7 -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-allocation.lean.json +150 -0
- package/vectors/laws/m0-allocation.native.json +104 -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-finite-grid.lean.json +144 -0
- package/vectors/laws/m0-finite-grid.native.json +104 -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-limit-diag.lean.json +141 -0
- package/vectors/laws/m0-limit-diag.native.json +108 -0
- package/vectors/laws/m0-limit-offdiag.lean.json +143 -0
- package/vectors/laws/m0-limit-offdiag.native.json +104 -0
- package/vectors/laws/m0-pair-coincidence.lean.json +139 -0
- package/vectors/laws/m0-pair-coincidence.native.json +104 -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
|
@@ -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
|