@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.
Files changed (212) hide show
  1. package/README.md +42 -3
  2. package/TARGET.bound +147 -4
  3. package/contracts/extension-lineage-participation.json +30 -0
  4. package/contracts/m0-allocation.json +6 -0
  5. package/contracts/m0-binomial-bridge.json +6 -0
  6. package/contracts/m0-diagonal-conditional.json +15 -0
  7. package/contracts/m0-finite-grid.json +6 -0
  8. package/contracts/m0-keff-interval.json +27 -0
  9. package/contracts/m0-limit-diag.json +6 -0
  10. package/contracts/m0-limit-offdiag.json +6 -0
  11. package/contracts/m0-moment-identification.json +42 -0
  12. package/contracts/m0-pair-coincidence.json +6 -0
  13. package/contracts/m1-diagonal-regions.json +45 -0
  14. package/contracts/m1-generator-binomial.json +26 -0
  15. package/contracts/m1-offdiag-limit.json +42 -0
  16. package/contracts/m1-subcauses.json +66 -0
  17. package/contracts/model-collapse-1a.json +16 -0
  18. package/contracts/projection-chain.json +20 -0
  19. package/docs/contracts/experiment1a-public-attribution.md +1 -0
  20. package/docs/contracts/extension-lineage-participation.md +13 -0
  21. package/docs/contracts/installation-046-inputs.md +1 -0
  22. package/docs/contracts/m0-allocation.md +1 -0
  23. package/docs/contracts/m0-binomial-bridge.md +1 -0
  24. package/docs/contracts/m0-diagonal-lindeberg.md +1 -0
  25. package/docs/contracts/m0-diagonal-moments.md +1 -0
  26. package/docs/contracts/m0-diagonal-symmetric.md +1 -0
  27. package/docs/contracts/m0-diagonal-threshold.md +1 -0
  28. package/docs/contracts/m0-finite-grid.md +1 -0
  29. package/docs/contracts/m0-keff-floor-refutation.md +1 -0
  30. package/docs/contracts/m0-keff-interval.md +1 -0
  31. package/docs/contracts/m0-limit-diag.md +1 -0
  32. package/docs/contracts/m0-limit-offdiag.md +1 -0
  33. package/docs/contracts/m0-moment-identification.md +1 -0
  34. package/docs/contracts/m0-pair-coincidence.md +1 -0
  35. package/docs/contracts/m0-refuted-inverses.md +1 -0
  36. package/docs/contracts/m0-wf-floor-refutation.md +1 -0
  37. package/docs/contracts/m1-diagonal-regions.md +1 -0
  38. package/docs/contracts/m1-generator-binomial.md +1 -0
  39. package/docs/contracts/m1-offdiag-limit.md +1 -0
  40. package/docs/contracts/model-collapse-1a.md +11 -0
  41. package/docs/contracts/projection-chain.md +1 -0
  42. package/docs/proofs/floor-limit-diag.proof.json +29 -0
  43. package/package.json +1 -1
  44. package/proofs/definitions-046/declaration.json +11 -0
  45. package/proofs/experiment1a-046/declaration.json +11 -0
  46. package/proofs/m0-045/Obligations045/ConsensusGrid.lean +72 -0
  47. package/proofs/m0-045/Obligations045/M0Coincidence.lean +39 -0
  48. package/proofs/m0-045/Obligations045/M0Diagonal.lean +18 -0
  49. package/proofs/m0-045/Obligations045/M0Limit.lean +134 -0
  50. package/proofs/m0-045/Obligations045/M0Offdiag.lean +171 -0
  51. package/proofs/m0-045/Obligations045.lean +5 -0
  52. package/proofs/m0-045/lake-manifest.json +116 -0
  53. package/proofs/m0-045/lakefile.toml +9 -0
  54. package/proofs/m0-045/lean-toolchain +1 -0
  55. package/proofs/m0-046/BridgeNegatives.lean +23 -0
  56. package/proofs/m0-046/M0Bridge.lean +300 -0
  57. package/proofs/m0-046/Obligations045/ConsensusGrid.lean +72 -0
  58. package/proofs/m0-046/Obligations045/M0Coincidence.lean +39 -0
  59. package/proofs/m0-046/Obligations045/M0Diagonal.lean +18 -0
  60. package/proofs/m0-046/Obligations045/M0Limit.lean +134 -0
  61. package/proofs/m0-046/Obligations045/M0Offdiag.lean +171 -0
  62. package/proofs/m0-046/Obligations045.lean +5 -0
  63. package/proofs/m0-046/lake-manifest.json +116 -0
  64. package/proofs/m0-046/lakefile.toml +14 -0
  65. package/proofs/m0-046/lean-toolchain +1 -0
  66. package/proofs/m0-046-diagonal/BridgeNegatives.lean +23 -0
  67. package/proofs/m0-046-diagonal/M0Bridge.lean +300 -0
  68. package/proofs/m0-046-diagonal/M0Diagonal046.lean +235 -0
  69. package/proofs/m0-046-diagonal/M0Lindeberg046.lean +92 -0
  70. package/proofs/m0-046-diagonal/M0Moments046.lean +295 -0
  71. package/proofs/m0-046-diagonal/M0Threshold046.lean +278 -0
  72. package/proofs/m0-046-diagonal/Obligations045/ConsensusGrid.lean +72 -0
  73. package/proofs/m0-046-diagonal/Obligations045/M0Coincidence.lean +39 -0
  74. package/proofs/m0-046-diagonal/Obligations045/M0Diagonal.lean +18 -0
  75. package/proofs/m0-046-diagonal/Obligations045/M0Limit.lean +134 -0
  76. package/proofs/m0-046-diagonal/Obligations045/M0Offdiag.lean +171 -0
  77. package/proofs/m0-046-diagonal/Obligations045.lean +5 -0
  78. package/proofs/m0-046-diagonal/lake-manifest.json +116 -0
  79. package/proofs/m0-046-diagonal/lakefile.toml +26 -0
  80. package/proofs/m0-046-diagonal/lean-toolchain +1 -0
  81. package/proofs/m0-046-identification/M0Identification046.lean +209 -0
  82. package/proofs/m0-046-identification/Obligations045/M0Coincidence.lean +39 -0
  83. package/proofs/m0-046-identification/lake-manifest.json +116 -0
  84. package/proofs/m0-046-identification/lakefile.toml +12 -0
  85. package/proofs/m0-046-identification/lean-toolchain +1 -0
  86. package/proofs/m0-046-uncertainty/BridgeNegatives.lean +23 -0
  87. package/proofs/m0-046-uncertainty/M0BlockCoverage046.lean +163 -0
  88. package/proofs/m0-046-uncertainty/M0Bridge.lean +300 -0
  89. package/proofs/m0-046-uncertainty/M0Diagonal046.lean +235 -0
  90. package/proofs/m0-046-uncertainty/M0FiniteDiscord046.lean +207 -0
  91. package/proofs/m0-046-uncertainty/M0Interval046.lean +82 -0
  92. package/proofs/m0-046-uncertainty/M0Lindeberg046.lean +92 -0
  93. package/proofs/m0-046-uncertainty/M0Moments046.lean +295 -0
  94. package/proofs/m0-046-uncertainty/M0Threshold046.lean +278 -0
  95. package/proofs/m0-046-uncertainty/Obligations045/ConsensusGrid.lean +72 -0
  96. package/proofs/m0-046-uncertainty/Obligations045/M0Coincidence.lean +39 -0
  97. package/proofs/m0-046-uncertainty/Obligations045/M0Diagonal.lean +18 -0
  98. package/proofs/m0-046-uncertainty/Obligations045/M0Limit.lean +134 -0
  99. package/proofs/m0-046-uncertainty/Obligations045/M0Offdiag.lean +171 -0
  100. package/proofs/m0-046-uncertainty/Obligations045.lean +5 -0
  101. package/proofs/m0-046-uncertainty/lake-manifest.json +116 -0
  102. package/proofs/m0-046-uncertainty/lakefile.toml +35 -0
  103. package/proofs/m0-046-uncertainty/lean-toolchain +1 -0
  104. package/proofs/m1-046-bridge/M0Bridge.lean +300 -0
  105. package/proofs/m1-046-bridge/M1Bridge046.lean +359 -0
  106. package/proofs/m1-046-bridge/Obligations045/M0Limit.lean +134 -0
  107. package/proofs/m1-046-bridge/Obligations045/M0Offdiag.lean +171 -0
  108. package/proofs/m1-046-bridge/lake-manifest.json +116 -0
  109. package/proofs/m1-046-bridge/lakefile.toml +29 -0
  110. package/proofs/m1-046-bridge/lean-toolchain +1 -0
  111. package/proofs/m1-046-diagonal/M0Bridge.lean +300 -0
  112. package/proofs/m1-046-diagonal/M0Diagonal046.lean +235 -0
  113. package/proofs/m1-046-diagonal/M0Lindeberg046.lean +92 -0
  114. package/proofs/m1-046-diagonal/M0Moments046.lean +295 -0
  115. package/proofs/m1-046-diagonal/M0Threshold046.lean +278 -0
  116. package/proofs/m1-046-diagonal/M1Bridge046.lean +359 -0
  117. package/proofs/m1-046-diagonal/M1Diagonal046.lean +334 -0
  118. package/proofs/m1-046-diagonal/M1Offdiag046.lean +270 -0
  119. package/proofs/m1-046-diagonal/Obligations045/M0Limit.lean +134 -0
  120. package/proofs/m1-046-diagonal/Obligations045/M0Offdiag.lean +171 -0
  121. package/proofs/m1-046-diagonal/lake-manifest.json +116 -0
  122. package/proofs/m1-046-diagonal/lakefile.toml +35 -0
  123. package/proofs/m1-046-diagonal/lean-toolchain +1 -0
  124. package/proofs/m1-046-offdiag/M0Bridge.lean +300 -0
  125. package/proofs/m1-046-offdiag/M0Diagonal046.lean +235 -0
  126. package/proofs/m1-046-offdiag/M0Moments046.lean +295 -0
  127. package/proofs/m1-046-offdiag/M1Bridge046.lean +359 -0
  128. package/proofs/m1-046-offdiag/M1Offdiag046.lean +270 -0
  129. package/proofs/m1-046-offdiag/Obligations045/M0Limit.lean +134 -0
  130. package/proofs/m1-046-offdiag/Obligations045/M0Offdiag.lean +171 -0
  131. package/proofs/m1-046-offdiag/lake-manifest.json +116 -0
  132. package/proofs/m1-046-offdiag/lakefile.toml +32 -0
  133. package/proofs/m1-046-offdiag/lean-toolchain +1 -0
  134. package/proofs/projection-chain.md +11 -0
  135. package/protocols/model-collapse-1a.json +108 -0
  136. package/receipts.bound +684 -208
  137. package/samples/laws/definitions/no/sample.json +26 -0
  138. package/samples/laws/definitions/yes/sample.json +12 -0
  139. package/samples/laws/experiment1a/no/sample.json +16 -0
  140. package/samples/laws/experiment1a/yes/sample.json +8 -0
  141. package/samples/laws/m0-allocation/no/sample.json +5 -0
  142. package/samples/laws/m0-allocation/yes/sample.json +7 -0
  143. package/samples/laws/m0-binomial-bridge/no/pairwise-is-not-joint.json +59 -0
  144. package/samples/laws/m0-binomial-bridge/no/sample.json +13 -0
  145. package/samples/laws/m0-binomial-bridge/yes/sample.json +16 -0
  146. package/samples/laws/m0-binomial-bridge/yes/small-binomial-table.json +100 -0
  147. package/samples/laws/m0-diagonal-conditional/no/sample.json +5 -0
  148. package/samples/laws/m0-diagonal-conditional/yes/sample.json +7 -0
  149. package/samples/laws/m0-finite-grid/no/sample.json +5 -0
  150. package/samples/laws/m0-finite-grid/yes/sample.json +7 -0
  151. package/samples/laws/m0-keff-interval/no/sample.json +215 -0
  152. package/samples/laws/m0-keff-interval/yes/api-rows.json +2002 -0
  153. package/samples/laws/m0-keff-interval/yes/sample.json +70 -0
  154. package/samples/laws/m0-limit-diag/no/sample.json +5 -0
  155. package/samples/laws/m0-limit-diag/yes/sample.json +7 -0
  156. package/samples/laws/m0-limit-offdiag/no/sample.json +5 -0
  157. package/samples/laws/m0-limit-offdiag/yes/sample.json +7 -0
  158. package/samples/laws/m0-moment-identification/no/sample.json +47 -0
  159. package/samples/laws/m0-moment-identification/yes/sample.json +97 -0
  160. package/samples/laws/m0-pair-coincidence/no/sample.json +5 -0
  161. package/samples/laws/m0-pair-coincidence/yes/sample.json +7 -0
  162. package/samples/laws/m1-diagonal-regions/no/sample.json +44 -0
  163. package/samples/laws/m1-diagonal-regions/yes/sample.json +45 -0
  164. package/samples/laws/m1-generator-binomial/no/sample.json +21 -0
  165. package/samples/laws/m1-generator-binomial/yes/sample.json +290 -0
  166. package/samples/laws/m1-offdiag-limit/no/sample.json +17 -0
  167. package/samples/laws/m1-offdiag-limit/yes/sample.json +87 -0
  168. package/samples/laws/projection-chain/no/sample.json +26 -0
  169. package/samples/laws/projection-chain/yes/sample.json +25 -0
  170. package/samples/no/installed-artifact.json +2 -2
  171. package/samples/yes/installed-artifact.json +2 -2
  172. package/src/laws/laws.bound +146 -0
  173. package/vectors/laws/a7-t90.json +72 -0
  174. package/vectors/laws/a9-t99.json +110 -0
  175. package/vectors/laws/definitions.native-capture.json +326 -0
  176. package/vectors/laws/definitions.native.json +82 -0
  177. package/vectors/laws/experiment1a-protocol.native-capture.json +391 -0
  178. package/vectors/laws/experiment1a-protocol.native.json +64 -0
  179. package/vectors/laws/experiment1a-public-input.native-capture.json +224 -0
  180. package/vectors/laws/m0-allocation.lean.json +150 -0
  181. package/vectors/laws/m0-allocation.native.json +104 -0
  182. package/vectors/laws/m0-binomial-bridge.lean.json +185 -0
  183. package/vectors/laws/m0-diagonal-lindeberg.lean.json +167 -0
  184. package/vectors/laws/m0-diagonal-moments.lean.json +185 -0
  185. package/vectors/laws/m0-diagonal-symmetric.lean.json +188 -0
  186. package/vectors/laws/m0-diagonal-threshold.lean.json +199 -0
  187. package/vectors/laws/m0-finite-grid.lean.json +144 -0
  188. package/vectors/laws/m0-finite-grid.native.json +104 -0
  189. package/vectors/laws/m0-identification.lean.json +136 -0
  190. package/vectors/laws/m0-identification.native-capture.json +230 -0
  191. package/vectors/laws/m0-keff-interval.json +569 -0
  192. package/vectors/laws/m0-limit-diag.lean.json +141 -0
  193. package/vectors/laws/m0-limit-diag.native.json +108 -0
  194. package/vectors/laws/m0-limit-offdiag.lean.json +143 -0
  195. package/vectors/laws/m0-limit-offdiag.native.json +104 -0
  196. package/vectors/laws/m0-pair-coincidence.lean.json +139 -0
  197. package/vectors/laws/m0-pair-coincidence.native.json +104 -0
  198. package/vectors/laws/m0-uncertainty-blocks.lean.json +201 -0
  199. package/vectors/laws/m0-uncertainty-finite-discord.lean.json +194 -0
  200. package/vectors/laws/m0-uncertainty-interval.lean.json +189 -0
  201. package/vectors/laws/m0-uncertainty.native-capture.json +651 -0
  202. package/vectors/laws/m1-diagonal-partial.lean.json +192 -0
  203. package/vectors/laws/m1-diagonal-partial.native-capture.json +275 -0
  204. package/vectors/laws/m1-generator-binomial.lean.json +162 -0
  205. package/vectors/laws/m1-generator-binomial.native-capture.json +245 -0
  206. package/vectors/laws/m1-offdiag-limit.lean.json +166 -0
  207. package/vectors/laws/m1-offdiag-limit.native-capture.json +260 -0
  208. package/vectors/laws/model-collapse-1a.json +12 -0
  209. package/vectors/laws/projection-chain.json +61 -0
  210. package/vectors/laws/projection-chain.native-capture.json +311 -0
  211. package/vectors/laws/projection-chain.native.json +56 -0
  212. 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,5 @@
1
+ import Obligations045.M0Limit
2
+ import Obligations045.M0Coincidence
3
+ import Obligations045.ConsensusGrid
4
+ import Obligations045.M0Offdiag
5
+ import Obligations045.M0Diagonal
@@ -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