@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.
Files changed (173) hide show
  1. package/README.md +42 -3
  2. package/TARGET.bound +148 -42
  3. package/contracts/extension-lineage-participation.json +30 -0
  4. package/contracts/m0-binomial-bridge.json +6 -0
  5. package/contracts/m0-diagonal-conditional.json +15 -0
  6. package/contracts/m0-keff-interval.json +27 -0
  7. package/contracts/m0-moment-identification.json +42 -0
  8. package/contracts/m1-diagonal-regions.json +45 -0
  9. package/contracts/m1-generator-binomial.json +26 -0
  10. package/contracts/m1-offdiag-limit.json +42 -0
  11. package/contracts/m1-subcauses.json +66 -0
  12. package/contracts/model-collapse-1a.json +16 -0
  13. package/contracts/projection-chain.json +20 -0
  14. package/docs/contracts/experiment1a-public-attribution.md +1 -0
  15. package/docs/contracts/extension-lineage-participation.md +13 -0
  16. package/docs/contracts/installation-046-inputs.md +1 -0
  17. package/docs/contracts/m0-binomial-bridge.md +1 -0
  18. package/docs/contracts/m0-diagonal-lindeberg.md +1 -0
  19. package/docs/contracts/m0-diagonal-moments.md +1 -0
  20. package/docs/contracts/m0-diagonal-symmetric.md +1 -0
  21. package/docs/contracts/m0-diagonal-threshold.md +1 -0
  22. package/docs/contracts/m0-keff-floor-refutation.md +1 -0
  23. package/docs/contracts/m0-keff-interval.md +1 -0
  24. package/docs/contracts/m0-moment-identification.md +1 -0
  25. package/docs/contracts/m0-refuted-inverses.md +1 -0
  26. package/docs/contracts/m0-wf-floor-refutation.md +1 -0
  27. package/docs/contracts/m1-diagonal-regions.md +1 -0
  28. package/docs/contracts/m1-generator-binomial.md +1 -0
  29. package/docs/contracts/m1-offdiag-limit.md +1 -0
  30. package/docs/contracts/model-collapse-1a.md +11 -0
  31. package/docs/contracts/projection-chain.md +1 -0
  32. package/package.json +1 -1
  33. package/proofs/definitions-046/declaration.json +11 -0
  34. package/proofs/experiment1a-046/declaration.json +11 -0
  35. package/proofs/m0-046/BridgeNegatives.lean +23 -0
  36. package/proofs/m0-046/M0Bridge.lean +300 -0
  37. package/proofs/m0-046/Obligations045/ConsensusGrid.lean +72 -0
  38. package/proofs/m0-046/Obligations045/M0Coincidence.lean +39 -0
  39. package/proofs/m0-046/Obligations045/M0Diagonal.lean +18 -0
  40. package/proofs/m0-046/Obligations045/M0Limit.lean +134 -0
  41. package/proofs/m0-046/Obligations045/M0Offdiag.lean +171 -0
  42. package/proofs/m0-046/Obligations045.lean +5 -0
  43. package/proofs/m0-046/lake-manifest.json +116 -0
  44. package/proofs/m0-046/lakefile.toml +14 -0
  45. package/proofs/m0-046/lean-toolchain +1 -0
  46. package/proofs/m0-046-diagonal/BridgeNegatives.lean +23 -0
  47. package/proofs/m0-046-diagonal/M0Bridge.lean +300 -0
  48. package/proofs/m0-046-diagonal/M0Diagonal046.lean +235 -0
  49. package/proofs/m0-046-diagonal/M0Lindeberg046.lean +92 -0
  50. package/proofs/m0-046-diagonal/M0Moments046.lean +295 -0
  51. package/proofs/m0-046-diagonal/M0Threshold046.lean +278 -0
  52. package/proofs/m0-046-diagonal/Obligations045/ConsensusGrid.lean +72 -0
  53. package/proofs/m0-046-diagonal/Obligations045/M0Coincidence.lean +39 -0
  54. package/proofs/m0-046-diagonal/Obligations045/M0Diagonal.lean +18 -0
  55. package/proofs/m0-046-diagonal/Obligations045/M0Limit.lean +134 -0
  56. package/proofs/m0-046-diagonal/Obligations045/M0Offdiag.lean +171 -0
  57. package/proofs/m0-046-diagonal/Obligations045.lean +5 -0
  58. package/proofs/m0-046-diagonal/lake-manifest.json +116 -0
  59. package/proofs/m0-046-diagonal/lakefile.toml +26 -0
  60. package/proofs/m0-046-diagonal/lean-toolchain +1 -0
  61. package/proofs/m0-046-identification/M0Identification046.lean +209 -0
  62. package/proofs/m0-046-identification/Obligations045/M0Coincidence.lean +39 -0
  63. package/proofs/m0-046-identification/lake-manifest.json +116 -0
  64. package/proofs/m0-046-identification/lakefile.toml +12 -0
  65. package/proofs/m0-046-identification/lean-toolchain +1 -0
  66. package/proofs/m0-046-uncertainty/BridgeNegatives.lean +23 -0
  67. package/proofs/m0-046-uncertainty/M0BlockCoverage046.lean +163 -0
  68. package/proofs/m0-046-uncertainty/M0Bridge.lean +300 -0
  69. package/proofs/m0-046-uncertainty/M0Diagonal046.lean +235 -0
  70. package/proofs/m0-046-uncertainty/M0FiniteDiscord046.lean +207 -0
  71. package/proofs/m0-046-uncertainty/M0Interval046.lean +82 -0
  72. package/proofs/m0-046-uncertainty/M0Lindeberg046.lean +92 -0
  73. package/proofs/m0-046-uncertainty/M0Moments046.lean +295 -0
  74. package/proofs/m0-046-uncertainty/M0Threshold046.lean +278 -0
  75. package/proofs/m0-046-uncertainty/Obligations045/ConsensusGrid.lean +72 -0
  76. package/proofs/m0-046-uncertainty/Obligations045/M0Coincidence.lean +39 -0
  77. package/proofs/m0-046-uncertainty/Obligations045/M0Diagonal.lean +18 -0
  78. package/proofs/m0-046-uncertainty/Obligations045/M0Limit.lean +134 -0
  79. package/proofs/m0-046-uncertainty/Obligations045/M0Offdiag.lean +171 -0
  80. package/proofs/m0-046-uncertainty/Obligations045.lean +5 -0
  81. package/proofs/m0-046-uncertainty/lake-manifest.json +116 -0
  82. package/proofs/m0-046-uncertainty/lakefile.toml +35 -0
  83. package/proofs/m0-046-uncertainty/lean-toolchain +1 -0
  84. package/proofs/m1-046-bridge/M0Bridge.lean +300 -0
  85. package/proofs/m1-046-bridge/M1Bridge046.lean +359 -0
  86. package/proofs/m1-046-bridge/Obligations045/M0Limit.lean +134 -0
  87. package/proofs/m1-046-bridge/Obligations045/M0Offdiag.lean +171 -0
  88. package/proofs/m1-046-bridge/lake-manifest.json +116 -0
  89. package/proofs/m1-046-bridge/lakefile.toml +29 -0
  90. package/proofs/m1-046-bridge/lean-toolchain +1 -0
  91. package/proofs/m1-046-diagonal/M0Bridge.lean +300 -0
  92. package/proofs/m1-046-diagonal/M0Diagonal046.lean +235 -0
  93. package/proofs/m1-046-diagonal/M0Lindeberg046.lean +92 -0
  94. package/proofs/m1-046-diagonal/M0Moments046.lean +295 -0
  95. package/proofs/m1-046-diagonal/M0Threshold046.lean +278 -0
  96. package/proofs/m1-046-diagonal/M1Bridge046.lean +359 -0
  97. package/proofs/m1-046-diagonal/M1Diagonal046.lean +334 -0
  98. package/proofs/m1-046-diagonal/M1Offdiag046.lean +270 -0
  99. package/proofs/m1-046-diagonal/Obligations045/M0Limit.lean +134 -0
  100. package/proofs/m1-046-diagonal/Obligations045/M0Offdiag.lean +171 -0
  101. package/proofs/m1-046-diagonal/lake-manifest.json +116 -0
  102. package/proofs/m1-046-diagonal/lakefile.toml +35 -0
  103. package/proofs/m1-046-diagonal/lean-toolchain +1 -0
  104. package/proofs/m1-046-offdiag/M0Bridge.lean +300 -0
  105. package/proofs/m1-046-offdiag/M0Diagonal046.lean +235 -0
  106. package/proofs/m1-046-offdiag/M0Moments046.lean +295 -0
  107. package/proofs/m1-046-offdiag/M1Bridge046.lean +359 -0
  108. package/proofs/m1-046-offdiag/M1Offdiag046.lean +270 -0
  109. package/proofs/m1-046-offdiag/Obligations045/M0Limit.lean +134 -0
  110. package/proofs/m1-046-offdiag/Obligations045/M0Offdiag.lean +171 -0
  111. package/proofs/m1-046-offdiag/lake-manifest.json +116 -0
  112. package/proofs/m1-046-offdiag/lakefile.toml +32 -0
  113. package/proofs/m1-046-offdiag/lean-toolchain +1 -0
  114. package/proofs/projection-chain.md +11 -0
  115. package/protocols/model-collapse-1a.json +108 -0
  116. package/receipts.bound +578 -210
  117. package/samples/laws/definitions/no/sample.json +26 -0
  118. package/samples/laws/definitions/yes/sample.json +12 -0
  119. package/samples/laws/experiment1a/no/sample.json +16 -0
  120. package/samples/laws/experiment1a/yes/sample.json +8 -0
  121. package/samples/laws/m0-binomial-bridge/no/pairwise-is-not-joint.json +59 -0
  122. package/samples/laws/m0-binomial-bridge/no/sample.json +13 -0
  123. package/samples/laws/m0-binomial-bridge/yes/sample.json +16 -0
  124. package/samples/laws/m0-binomial-bridge/yes/small-binomial-table.json +100 -0
  125. package/samples/laws/m0-diagonal-conditional/no/sample.json +5 -0
  126. package/samples/laws/m0-diagonal-conditional/yes/sample.json +7 -0
  127. package/samples/laws/m0-keff-interval/no/sample.json +215 -0
  128. package/samples/laws/m0-keff-interval/yes/api-rows.json +2002 -0
  129. package/samples/laws/m0-keff-interval/yes/sample.json +70 -0
  130. package/samples/laws/m0-moment-identification/no/sample.json +47 -0
  131. package/samples/laws/m0-moment-identification/yes/sample.json +97 -0
  132. package/samples/laws/m1-diagonal-regions/no/sample.json +44 -0
  133. package/samples/laws/m1-diagonal-regions/yes/sample.json +45 -0
  134. package/samples/laws/m1-generator-binomial/no/sample.json +21 -0
  135. package/samples/laws/m1-generator-binomial/yes/sample.json +290 -0
  136. package/samples/laws/m1-offdiag-limit/no/sample.json +17 -0
  137. package/samples/laws/m1-offdiag-limit/yes/sample.json +87 -0
  138. package/samples/laws/projection-chain/no/sample.json +26 -0
  139. package/samples/laws/projection-chain/yes/sample.json +25 -0
  140. package/samples/no/installed-artifact.json +2 -2
  141. package/samples/yes/installed-artifact.json +2 -2
  142. package/src/laws/laws.bound +146 -0
  143. package/vectors/laws/a7-t90.json +72 -0
  144. package/vectors/laws/a9-t99.json +110 -0
  145. package/vectors/laws/definitions.native-capture.json +326 -0
  146. package/vectors/laws/definitions.native.json +82 -0
  147. package/vectors/laws/experiment1a-protocol.native-capture.json +391 -0
  148. package/vectors/laws/experiment1a-protocol.native.json +64 -0
  149. package/vectors/laws/experiment1a-public-input.native-capture.json +224 -0
  150. package/vectors/laws/m0-binomial-bridge.lean.json +185 -0
  151. package/vectors/laws/m0-diagonal-lindeberg.lean.json +167 -0
  152. package/vectors/laws/m0-diagonal-moments.lean.json +185 -0
  153. package/vectors/laws/m0-diagonal-symmetric.lean.json +188 -0
  154. package/vectors/laws/m0-diagonal-threshold.lean.json +199 -0
  155. package/vectors/laws/m0-identification.lean.json +136 -0
  156. package/vectors/laws/m0-identification.native-capture.json +230 -0
  157. package/vectors/laws/m0-keff-interval.json +569 -0
  158. package/vectors/laws/m0-uncertainty-blocks.lean.json +201 -0
  159. package/vectors/laws/m0-uncertainty-finite-discord.lean.json +194 -0
  160. package/vectors/laws/m0-uncertainty-interval.lean.json +189 -0
  161. package/vectors/laws/m0-uncertainty.native-capture.json +651 -0
  162. package/vectors/laws/m1-diagonal-partial.lean.json +192 -0
  163. package/vectors/laws/m1-diagonal-partial.native-capture.json +275 -0
  164. package/vectors/laws/m1-generator-binomial.lean.json +162 -0
  165. package/vectors/laws/m1-generator-binomial.native-capture.json +245 -0
  166. package/vectors/laws/m1-offdiag-limit.lean.json +166 -0
  167. package/vectors/laws/m1-offdiag-limit.native-capture.json +260 -0
  168. package/vectors/laws/model-collapse-1a.json +12 -0
  169. package/vectors/laws/projection-chain.json +61 -0
  170. package/vectors/laws/projection-chain.native-capture.json +311 -0
  171. package/vectors/laws/projection-chain.native.json +56 -0
  172. package/vectors/measures/installed-artifact.cli.json +6 -6
  173. package/CHANGELOG.md +0 -10
@@ -0,0 +1,295 @@
1
+ import M0Diagonal046
2
+ import Mathlib.Probability.Variance
3
+ open scoped BigOperators
4
+ open Filter Topology MeasureTheory
5
+ noncomputable section
6
+ open Classical Obligations045.M0 Obligations046.Bridge Obligations046.Diagonal
7
+ namespace Obligations046.Moments
8
+
9
+ /-- Finite binomial expectation; no asymptotic certificate. -/
10
+ def binExpect (p : ℝ) (n : ℕ) (f : ℕ → ℝ) : ℝ :=
11
+ ∑ k ∈ Finset.range (n+1), (n.choose k : ℝ)*p^k*(1-p)^(n-k)*f k
12
+
13
+ theorem binExpect_one (p : ℝ) (n : ℕ) : binExpect p n (fun _ => 1) = 1 := by
14
+ unfold binExpect
15
+ simp only [mul_one]
16
+ calc
17
+ _ = (p+(1-p))^n := by
18
+ rw [add_pow]
19
+ apply Finset.sum_congr rfl
20
+ intro k _
21
+ ring
22
+ _ = 1 := by simp
23
+
24
+ theorem binExpect_succ (p : ℝ) (n : ℕ) (f : ℕ → ℝ) :
25
+ binExpect p (n+1) f =
26
+ (1-p)*binExpect p n f + p*binExpect p n (fun k => f (k+1)) := by
27
+ have h := Finset.sum_choose_succ_mul (fun k j => p^k*(1-p)^j*f k) n
28
+ unfold binExpect
29
+ simp only [Nat.add_assoc] at h ⊢
30
+ calc
31
+ _ = (∑ k ∈ Finset.range (n+1), (n.choose k:ℝ)*(p^k*(1-p)^(n+1-k)*f k)) +
32
+ ∑ k ∈ Finset.range (n+1), (n.choose k:ℝ)*(p^(k+1)*(1-p)^(n-k)*f (k+1)) := by
33
+ convert h using 1
34
+ apply Finset.sum_congr rfl
35
+ intro k _
36
+ ring
37
+ _ = _ := by
38
+ rw [Finset.mul_sum, Finset.mul_sum]
39
+ congr 1
40
+ · apply Finset.sum_congr rfl
41
+ intro k hk
42
+ have hk' : k ≤ n := by simpa only [Finset.mem_range, Nat.lt_succ_iff] using hk
43
+ rw [show n+1-k = (n-k)+1 by omega, pow_succ]
44
+ ring
45
+ · apply Finset.sum_congr rfl
46
+ intro k _
47
+ rw [pow_succ]
48
+ ring
49
+
50
+ theorem binExpect_add (p : ℝ) (n : ℕ) (f g : ℕ → ℝ) :
51
+ binExpect p n (fun k => f k+g k) = binExpect p n f + binExpect p n g := by
52
+ simp [binExpect, mul_add, Finset.sum_add_distrib]
53
+
54
+ theorem binExpect_mul_const (p : ℝ) (n : ℕ) (f : ℕ → ℝ) (r : ℝ) :
55
+ binExpect p n (fun k => f k*r) = binExpect p n f*r := by
56
+ simp only [binExpect, ← mul_assoc, Finset.sum_mul]
57
+
58
+ theorem binExpect_const (p r : ℝ) (n : ℕ) : binExpect p n (fun _ => r) = r := by
59
+ simpa only [one_mul, binExpect_one] using binExpect_mul_const p n (fun _ => 1) r
60
+
61
+ theorem binExpect_mean (p : ℝ) (n : ℕ) : binExpect p n (fun k => (k:ℝ)) = (n:ℝ)*p := by
62
+ induction n with
63
+ | zero => simp [binExpect]
64
+ | succ n ih =>
65
+ rw [binExpect_succ]
66
+ have hshift : binExpect p n (fun k => ((k+1:ℕ):ℝ)) = (n:ℝ)*p+1 := by
67
+ simp only [Nat.cast_add, Nat.cast_one]
68
+ rw [binExpect_add, ih, binExpect_const]
69
+ rw [hshift, ih]
70
+ push_cast
71
+ ring
72
+
73
+ theorem binExpect_second (p : ℝ) (n : ℕ) :
74
+ binExpect p n (fun k => (k:ℝ)^2) = (n:ℝ)*p*(1-p)+((n:ℝ)*p)^2 := by
75
+ induction n with
76
+ | zero => simp [binExpect]
77
+ | succ n ih =>
78
+ rw [binExpect_succ, ih]
79
+ have heq : (fun k : ℕ => ((k+1:ℕ):ℝ)^2) =
80
+ (fun k : ℕ => ((k:ℝ)^2 + (k:ℝ)*2) + 1) := by funext k; push_cast; ring
81
+ rw [heq, binExpect_add, binExpect_add, binExpect_mul_const,
82
+ binExpect_mean, binExpect_const, ih]
83
+ push_cast
84
+ ring
85
+
86
+ /-- Finite pushforward of a scalar observable, without an asserted moment. -/
87
+ theorem finite_pushforward {S T : Type*} [Fintype S] [Fintype T] [DecidableEq T]
88
+ (m : S → ℝ) (c : S → T) (f : T → ℝ) :
89
+ (∑ x, m x*f (c x)) = ∑ y, (∑ x, if c x=y then m x else 0)*f y := by
90
+ symm
91
+ simp_rw [Finset.sum_mul]
92
+ rw [Finset.sum_comm]
93
+ apply Finset.sum_congr rfl
94
+ intro x _
95
+ simp_rw [ite_mul, zero_mul]
96
+ simp
97
+
98
+ theorem mass_card_expect (p : ℝ) (n : ℕ) (f : ℕ → ℝ) :
99
+ (∑ x : Finset (Fin n), mass p x*f x.card) = binExpect p n f := by
100
+ calc
101
+ _ = ∑ k : Fin (n+1), binMass p n k*f k := by
102
+ simpa only [count_fiber_mass] using
103
+ finite_pushforward (mass p) (@count n) (fun k => f (k:ℕ))
104
+ _ = binExpect p n f := by
105
+ simp only [binMass, binExpect]
106
+ exact Fin.sum_univ_eq_sum_range
107
+ (fun k : ℕ => (n.choose k:ℝ)*p^k*(1-p)^(n-k)*f k) (n+1)
108
+
109
+ section ProductMoments
110
+ variable {ι : Type*} [Fintype ι] [DecidableEq ι]
111
+ {S : ι → Type*} [∀ i, Fintype (S i)]
112
+
113
+ def expect (m : ∀ i, S i → ℝ) (f : (∀ i, S i) → ℝ) : ℝ :=
114
+ ∑ x, (∏ i, m i (x i))*f x
115
+
116
+ theorem expect_product (m : ∀ i, S i → ℝ) (f : ∀ i, S i → ℝ) :
117
+ expect m (fun x => ∏ i, f i (x i)) = ∏ i, ∑ s, m i s*f i s := by
118
+ simp only [expect, ← Finset.prod_mul_distrib, Fintype.prod_sum]
119
+
120
+ theorem expect_coordinate (m : ∀ i, S i → ℝ) (hm : ∀ i, ∑ s, m i s = 1)
121
+ (f : ∀ i, S i → ℝ) (j : ι) :
122
+ expect m (fun x => f j (x j)) = ∑ s, m j s*f j s := by
123
+ calc
124
+ _ = expect m (fun x => ∏ i, if i=j then f i (x i) else 1) := by simp
125
+ _ = ∏ i, ∑ s, m i s * (if i=j then f i s else 1) := expect_product m (fun i s => if i=j then f i s else 1)
126
+ _ = ∏ i, if i=j then (∑ s, m i s*f i s) else 1 := by
127
+ apply Finset.prod_congr rfl
128
+ intro i _
129
+ by_cases h : i=j <;> simp [h, hm]
130
+ _ = _ := by simp
131
+
132
+ theorem expect_sum {κ : Type*} [Fintype κ] (m : ∀ i, S i → ℝ)
133
+ (f : κ → (∀ i, S i) → ℝ) :
134
+ expect m (fun x => ∑ j, f j x) = ∑ j, expect m (f j) := by
135
+ simp only [expect, Finset.mul_sum]
136
+ rw [Finset.sum_comm]
137
+
138
+ theorem expect_cross_centered (m : ∀ i, S i → ℝ)
139
+ (f : ∀ i, S i → ℝ) (hf : ∀ i, ∑ s, m i s*f i s = 0)
140
+ (i j : ι) (hne : i≠j) :
141
+ expect m (fun x => f i (x i)*f j (x j)) = 0 := by
142
+ calc
143
+ _ = expect m (fun x => ∏ k, if k=i then f k (x k) else if k=j then f k (x k) else 1) := by
144
+ congr 1
145
+ funext x
146
+ rw [Finset.prod_eq_mul_prod_diff_singleton (Finset.mem_univ i)]
147
+ simp only [ite_true]
148
+ congr 1
149
+ symm
150
+ calc
151
+ _ = ∏ k ∈ Finset.univ \ {i}, if k=j then f k (x k) else 1 := by
152
+ apply Finset.prod_congr rfl
153
+ intro k hk
154
+ have hki : k≠i := by simpa using (Finset.mem_sdiff.mp hk).2
155
+ simp only [if_neg hki]
156
+ _ = f j (x j) := by simp [Finset.prod_ite_eq', Ne.symm hne]
157
+ _ = ∏ k, ∑ s, m k s*(if k=i then f k s else if k=j then f k s else 1) :=
158
+ expect_product m (fun k s => if k=i then f k s else if k=j then f k s else 1)
159
+ _ = 0 := Finset.prod_eq_zero (Finset.mem_univ i) (by simpa using hf i)
160
+
161
+ theorem expect_centered_square (m : ∀ i, S i → ℝ)
162
+ (hm : ∀ i, ∑ s, m i s = 1)
163
+ (f : ∀ i, S i → ℝ) (hf : ∀ i, ∑ s, m i s*f i s = 0) :
164
+ expect m (fun x => (∑ i, f i (x i))^2) =
165
+ ∑ i, ∑ s, m i s*(f i s)^2 := by
166
+ simp_rw [pow_two, Fintype.sum_mul_sum, expect_sum]
167
+ apply Finset.sum_congr rfl
168
+ intro i _
169
+ have hc : ∀ j, expect m (fun x => f i (x i)*f j (x j)) =
170
+ if j=i then (∑ s, m i s*(f i s*f i s)) else 0 := by
171
+ intro j
172
+ by_cases h : j=i
173
+ · subst j
174
+ simp only [ite_true]
175
+ exact expect_coordinate m hm (fun k s => f k s*f k s) i
176
+ · rw [if_neg h]
177
+ exact expect_cross_centered m f hf i j (Ne.symm h)
178
+ simp_rw [hc]
179
+ simp
180
+
181
+ end ProductMoments
182
+
183
+ theorem mass_card_mean (p : ℝ) (n : ℕ) :
184
+ (∑ x : Finset (Fin n), mass p x*(x.card:ℝ)) = (n:ℝ)*p := by
185
+ rw [mass_card_expect, binExpect_mean]
186
+
187
+ theorem mass_card_second (p : ℝ) (n : ℕ) :
188
+ (∑ x : Finset (Fin n), mass p x*(x.card:ℝ)^2) =
189
+ (n:ℝ)*p*(1-p)+((n:ℝ)*p)^2 := by
190
+ calc
191
+ _ = binExpect p n (fun k => (k:ℝ)^2) := mass_card_expect _ _ _
192
+ _ = _ := binExpect_second p n
193
+
194
+ theorem mass_centered_mean (p : ℝ) (n : ℕ) :
195
+ (∑ x : Finset (Fin n), mass p x*((x.card:ℝ)-(n:ℝ)*p)) = 0 := by
196
+ simp only [mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul]
197
+ rw [mass_card_mean, mass_sum]
198
+ ring
199
+
200
+ theorem mass_centered_second (p : ℝ) (n : ℕ) :
201
+ (∑ x : Finset (Fin n), mass p x*((x.card:ℝ)-(n:ℝ)*p)^2) =
202
+ (n:ℝ)*p*(1-p) := by
203
+ calc
204
+ _ = (∑ x : Finset (Fin n), mass p x*(x.card:ℝ)^2) -
205
+ (∑ x : Finset (Fin n), mass p x*(x.card:ℝ))*(2*((n:ℝ)*p)) +
206
+ (∑ x : Finset (Fin n), mass p x)*((n:ℝ)*p)^2 := by
207
+ rw [Finset.sum_mul, Finset.sum_mul, ← Finset.sum_sub_distrib, ← Finset.sum_add_distrib]
208
+ apply Finset.sum_congr rfl
209
+ intro x _
210
+ ring
211
+ _ = _ := by rw [mass_card_second, mass_card_mean, mass_sum]; ring
212
+
213
+ section ActualMoments
214
+ variable {ι : Type*} [Fintype ι] [DecidableEq ι]
215
+
216
+ theorem member_total_mean (n : ι → ℕ) (p : ι → ℝ)
217
+ (hp : ∀ i, 0 ≤ p i) (hp1 : ∀ i, p i ≤ 1) :
218
+ (∫ x, (correctCount x:ℝ) ∂(memberLaw n p hp hp1).toMeasure) =
219
+ ∑ i, (n i:ℝ)*p i := by
220
+ rw [memberLaw_expectation]
221
+ change expect (fun i => mass (p i)) (fun x => (correctCount x:ℝ)) = _
222
+ have he : (fun x : World n => (correctCount x:ℝ)) =
223
+ (fun x => ∑ i, ((x i).card:ℝ)) := by funext x; simp [correctCount]
224
+ rw [he, expect_sum]
225
+ apply Finset.sum_congr rfl
226
+ intro i _
227
+ rw [expect_coordinate _ (fun j => mass_sum (p j) (n j))
228
+ (fun j (s : Finset (Fin (n j))) => (s.card:ℝ)), mass_card_mean]
229
+
230
+ theorem member_total_centered_second (n : ι → ℕ) (p : ι → ℝ)
231
+ (hp : ∀ i, 0 ≤ p i) (hp1 : ∀ i, p i ≤ 1) :
232
+ (∫ x, ((correctCount x:ℝ) - ∑ i, (n i:ℝ)*p i)^2
233
+ ∂(memberLaw n p hp hp1).toMeasure) =
234
+ ∑ i, (n i:ℝ)*p i*(1-p i) := by
235
+ rw [memberLaw_expectation]
236
+ change expect (fun i => mass (p i))
237
+ (fun x => ((correctCount x:ℝ) - ∑ i, (n i:ℝ)*p i)^2) = _
238
+ have he : (fun x : World n => ((correctCount x:ℝ) - ∑ i, (n i:ℝ)*p i)^2) =
239
+ (fun x => (∑ i, (((x i).card:ℝ)-(n i:ℝ)*p i))^2) := by
240
+ funext x
241
+ simp only [correctCount, Nat.cast_sum, Finset.sum_sub_distrib]
242
+ rw [he, expect_centered_square _ (fun j => mass_sum (p j) (n j))
243
+ (fun j (s : Finset (Fin (n j))) => (s.card:ℝ)-(n j:ℝ)*p j)
244
+ (fun j => mass_centered_mean (p j) (n j))]
245
+ apply Finset.sum_congr rfl
246
+ intro i _
247
+ exact mass_centered_second (p i) (n i)
248
+
249
+ end ActualMoments
250
+
251
+ theorem model_mean (M : Domain) (a : Fin M.K → Bool) (N : ℕ) :
252
+ (∫ x, (correctCount x:ℝ) ∂(modelLaw M N a).toMeasure) = mean M a N := by
253
+ exact member_total_mean _ _ _ _
254
+
255
+ theorem model_centered_second (M : Domain) (a : Fin M.K → Bool) (N : ℕ) :
256
+ (∫ x, ((correctCount x:ℝ)-mean M a N)^2 ∂(modelLaw M N a).toMeasure) =
257
+ Obligations046.Diagonal.variance M a N := by
258
+ simpa only [mean, Obligations046.Diagonal.variance, mul_assoc] using
259
+ member_total_centered_second (sizes M N) (fun i => q M (a i))
260
+ (fun i => (q_pos M (a i)).le) (fun i => (q_lt_one M (a i)).le)
261
+
262
+ theorem model_variance (M : Domain) (a : Fin M.K → Bool) (N : ℕ) :
263
+ ProbabilityTheory.variance (fun x => (correctCount x:ℝ)) (modelLaw M N a).toMeasure =
264
+ Obligations046.Diagonal.variance M a N := by
265
+ rw [ProbabilityTheory.variance_eq_integral (measurable_of_finite _).aemeasurable,
266
+ model_mean]
267
+ exact model_centered_second M a N
268
+
269
+ /-- The asymptotic variance statements now refer to the actual admitted probability law. -/
270
+ theorem model_variance_rate_limit (M : Domain) (a : Fin M.K → Bool) :
271
+ Tendsto (fun N : ℕ =>
272
+ ProbabilityTheory.variance (fun x => (correctCount x:ℝ)) (modelLaw M N a).toMeasure /
273
+ (N:ℝ)) atTop (𝓝 (varianceRate M a)) := by
274
+ simpa only [model_variance] using variance_rate_limit M a
275
+
276
+ theorem model_variance_atTop (M : Domain) (a : Fin M.K → Bool) :
277
+ Tendsto (fun N : ℕ =>
278
+ ProbabilityTheory.variance (fun x => (correctCount x:ℝ)) (modelLaw M N a).toMeasure)
279
+ atTop atTop := by
280
+ simpa only [model_variance] using variance_atTop M a
281
+
282
+ /-- Counterexample to replacing the joint product law by matching individual marginals.
283
+ Two perfectly correlated Bernoulli(3/4) members have variance 3/4, not 3/8. -/
284
+ theorem correlated_pair_second :
285
+ (∑ b : Bool, (if b then (3:ℝ)/4 else 1/4)*
286
+ ((if b then (2:ℝ) else 0)-3/2)^2) = 3/4 := by
287
+ norm_num [Fintype.sum_bool]
288
+
289
+ theorem correlated_pair_not_independent_variance :
290
+ (∑ b : Bool, (if b then (3:ℝ)/4 else 1/4)*
291
+ ((if b then (2:ℝ) else 0)-3/2)^2) ≠ 2*((3:ℝ)/4)*(1-3/4) := by
292
+ rw [correlated_pair_second]
293
+ norm_num
294
+
295
+ end Obligations046.Moments
@@ -0,0 +1,278 @@
1
+ import M0Lindeberg046
2
+ open scoped BigOperators
3
+ open Filter Topology MeasureTheory
4
+ noncomputable section
5
+ open Classical Obligations045.M0 Obligations046.Bridge Obligations046.Diagonal
6
+ namespace Obligations046.Threshold
7
+
8
+ /-- Threshold transfer, explicitly conditional on all fixed-cut distribution limits.
9
+ This is not a construction of a CLT or an M0 diagonal theorem. -/
10
+ theorem moving_cut_sandwich (C : ℕ → ℝ → ℝ) (F : ℝ → ℝ)
11
+ (t v : ℕ → ℝ) (hF : ContinuousAt F 0)
12
+ (hC : ∀ z, Tendsto (fun N => C N z) atTop (𝓝 (F z)))
13
+ (ht : Tendsto t atTop (𝓝 0))
14
+ (hl : ∀ᶠ N in atTop, ∀ z, z < t N → C N z ≤ v N)
15
+ (hu : ∀ᶠ N in atTop, ∀ z, t N < z → v N ≤ C N z) :
16
+ Tendsto v atTop (𝓝 (F 0)) := by
17
+ have hinv : Tendsto (fun j : ℕ => (1:ℝ)/((j:ℝ)+1)) atTop (𝓝 0) :=
18
+ tendsto_const_nhds.div_atTop (tendsto_atTop_mono
19
+ (fun j : ℕ => show (j:ℝ) ≤ (j:ℝ)+1 by linarith)
20
+ tendsto_natCast_atTop_atTop)
21
+ have hleft : Tendsto (fun j : ℕ => F (-((1:ℝ)/((j:ℝ)+1)))) atTop (𝓝 (F 0)) := by
22
+ exact hF.tendsto.comp (by simpa only [neg_zero] using hinv.neg)
23
+ have hright : Tendsto (fun j : ℕ => F ((1:ℝ)/((j:ℝ)+1))) atTop (𝓝 (F 0)) :=
24
+ hF.tendsto.comp hinv
25
+ apply tendsto_order.2
26
+ constructor
27
+ · intro b hb
28
+ obtain ⟨j,hj⟩ := (hleft.eventually (Ioi_mem_nhds hb)).exists
29
+ let δ : ℝ := (1:ℝ)/((j:ℝ)+1)
30
+ have hd : 0 < δ := by dsimp [δ]; positivity
31
+ have he := (hC (-δ)).eventually (Ioi_mem_nhds hj)
32
+ have hth := ht.eventually (Ioi_mem_nhds (show -δ < (0:ℝ) by linarith))
33
+ filter_upwards [he,hth,hl] with N hN htN hlN
34
+ exact lt_of_lt_of_le hN (hlN (-δ) htN)
35
+ · intro b hb
36
+ obtain ⟨j,hj⟩ := (hright.eventually (Iio_mem_nhds hb)).exists
37
+ let δ : ℝ := (1:ℝ)/((j:ℝ)+1)
38
+ have hd : 0 < δ := by dsimp [δ]; positivity
39
+ have he := (hC δ).eventually (Iio_mem_nhds hj)
40
+ have hth := ht.eventually (Iio_mem_nhds hd)
41
+ filter_upwards [he,hth,hu] with N hN htN huN
42
+ exact lt_of_le_of_lt (huN δ htN) hN
43
+
44
+ def sigma (M : Domain) (a : Fin M.K → Bool) (N : ℕ) : ℝ :=
45
+ Real.sqrt (Obligations046.Diagonal.variance M a N)
46
+ def threshold (M : Domain) (a : Fin M.K → Bool) (N : ℕ) : ℝ :=
47
+ ((N:ℝ)/2-mean M a N)/sigma M a N
48
+
49
+ theorem sigma_pos (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (hN : 0<N) :
50
+ 0 < sigma M a N := by
51
+ apply Real.sqrt_pos.2
52
+ exact lt_of_lt_of_le (mul_pos (by exact_mod_cast hN) (variance_lower_pos M))
53
+ (finite_variance_lower M a N)
54
+
55
+ theorem threshold_limit (M : Domain) (a : Fin M.K → Bool)
56
+ (hdiag : score M a = (1:ℝ)/2) :
57
+ Tendsto (threshold M a) atTop (𝓝 0) := by
58
+ have h := Obligations046.Lindeberg.actual_mean_standardized_drift M a hdiag
59
+ apply (tendsto_zero_iff_norm_tendsto_zero).mpr
60
+ simpa only [threshold, sigma, Real.norm_eq_abs, abs_div,
61
+ abs_of_nonneg (Real.sqrt_nonneg _), abs_sub_comm,
62
+ Obligations046.Moments.model_mean, Obligations046.Moments.model_variance] using h
63
+
64
+ /-- This CDF uses the actual joint member law; the cut is in standard-deviation units. -/
65
+ def cdf (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (z : ℝ) : ℝ :=
66
+ ∫ x, (if ((correctCount x:ℝ)-mean M a N)/sigma M a N ≤ z then (1:ℝ) else 0)
67
+ ∂(modelLaw M N a).toMeasure
68
+
69
+ theorem fair_loss_bounds (b N : ℕ) : 0 ≤ fairLoss b N ∧ fairLoss b N ≤ 1 := by
70
+ unfold fairLoss
71
+ split_ifs <;> norm_num
72
+
73
+ theorem lower_cut_pointwise (b N : ℕ) (μ σ z : ℝ) (hσ : 0<σ)
74
+ (hz : z < ((N:ℝ)/2-μ)/σ) :
75
+ (if ((b:ℝ)-μ)/σ ≤ z then (1:ℝ) else 0) ≤ fairLoss b N := by
76
+ split_ifs with hb
77
+ · have hreal : (b:ℝ)<(N:ℝ)/2 := by
78
+ have := (div_le_iff₀ hσ).mp hb
79
+ have := (lt_div_iff₀ hσ).mp hz
80
+ nlinarith
81
+ have hn : 2*b<N := by exact_mod_cast (show (2:ℝ)*(b:ℝ)<(N:ℝ) by linarith)
82
+ simp [fairLoss, hn]
83
+ · exact (fair_loss_bounds b N).1
84
+
85
+ theorem upper_cut_pointwise (b N : ℕ) (μ σ z : ℝ) (hσ : 0<σ)
86
+ (hz : ((N:ℝ)/2-μ)/σ < z) :
87
+ fairLoss b N ≤ (if ((b:ℝ)-μ)/σ ≤ z then (1:ℝ) else 0) := by
88
+ split_ifs with hb
89
+ · exact (fair_loss_bounds b N).2
90
+ · have hreal : (N:ℝ)/2 < (b:ℝ) := by
91
+ have := (div_lt_iff₀ hσ).mp hz
92
+ have := (lt_div_iff₀ hσ).mp (lt_of_not_ge hb)
93
+ nlinarith
94
+ have hn : N<2*b := by exact_mod_cast (show (N:ℝ)<(2:ℝ)*(b:ℝ) by linarith)
95
+ simp [fairLoss, not_lt.mpr hn.le, Ne.symm hn.ne]
96
+
97
+ theorem cdf_finite (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (z : ℝ) :
98
+ cdf M a N z = ∑ x : World (sizes M N), jointMass (sizes M N)
99
+ (fun i => q M (a i)) x *
100
+ (if ((correctCount x:ℝ)-mean M a N)/sigma M a N ≤ z then (1:ℝ) else 0) := by
101
+ rw [cdf, modelLaw, memberLaw_expectation]
102
+
103
+ theorem error_finite (M : Domain) (a : Fin M.K → Bool) (N : ℕ) :
104
+ conditionalError M N a = ∑ x : World (sizes M N), jointMass (sizes M N)
105
+ (fun i => q M (a i)) x * fairLoss (correctCount x) N := by
106
+ rw [← conditional_error_representation, modelLaw, memberLaw_expectation]
107
+
108
+ theorem joint_nonneg (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (x : World (sizes M N)) :
109
+ 0 ≤ jointMass (sizes M N) (fun i => q M (a i)) x :=
110
+ Finset.prod_nonneg (fun i _ => mass_nonneg _ (q_pos M (a i)).le (q_lt_one M (a i)).le _)
111
+
112
+ theorem lower_cut (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (hN : 0<N)
113
+ (z : ℝ) (hz : z < threshold M a N) : cdf M a N z ≤ conditionalError M N a := by
114
+ rw [cdf_finite, error_finite]
115
+ apply Finset.sum_le_sum
116
+ intro x _
117
+ exact mul_le_mul_of_nonneg_left
118
+ (lower_cut_pointwise _ _ _ _ _ (sigma_pos M a N hN) hz) (joint_nonneg M a N x)
119
+
120
+ theorem upper_cut (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (hN : 0<N)
121
+ (z : ℝ) (hz : threshold M a N < z) : conditionalError M N a ≤ cdf M a N z := by
122
+ rw [cdf_finite, error_finite]
123
+ apply Finset.sum_le_sum
124
+ intro x _
125
+ exact mul_le_mul_of_nonneg_left
126
+ (upper_cut_pointwise _ _ _ _ _ (sigma_pos M a N hN) hz) (joint_nonneg M a N x)
127
+
128
+ /-- Actual finite M0 law, actual majority with fair ties, unchanged quota rule.
129
+ The fixed-cut limit hCLT remains an explicit unpaid hypothesis, not a law claim. -/
130
+ theorem diagonal_transfer_of_fixed_cut_limits (M : Domain) (a : Fin M.K → Bool)
131
+ (hdiag : score M a = (1:ℝ)/2) (F : ℝ → ℝ) (hF : ContinuousAt F 0)
132
+ (hCLT : ∀ z, Tendsto (fun N => cdf M a N z) atTop (𝓝 (F z))) :
133
+ Tendsto (fun N => conditionalError M N a) atTop (𝓝 (F 0)) := by
134
+ apply moving_cut_sandwich (cdf M a) F (threshold M a)
135
+ (fun N => conditionalError M N a) hF hCLT (threshold_limit M a hdiag)
136
+ · filter_upwards [eventually_ge_atTop 1] with N hN
137
+ exact lower_cut M a N (by omega)
138
+ · filter_upwards [eventually_ge_atTop 1] with N hN
139
+ exact upper_cut M a N (by omega)
140
+
141
+ def strictCdf (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (z : ℝ) : ℝ :=
142
+ ∑ x : World (sizes M N), jointMass (sizes M N) (fun i => q M (a i)) x *
143
+ (if ((correctCount x:ℝ)-mean M a N)/sigma M a N < z then (1:ℝ) else 0)
144
+
145
+ theorem cdf_mono (M : Domain) (a : Fin M.K → Bool) (N : ℕ) :
146
+ Monotone (cdf M a N) := by
147
+ intro z y hzy
148
+ rw [cdf_finite, cdf_finite]
149
+ apply Finset.sum_le_sum
150
+ intro x _
151
+ apply mul_le_mul_of_nonneg_left _ (joint_nonneg M a N x)
152
+ split_ifs <;> norm_num
153
+ linarith
154
+
155
+ theorem strict_lower_cut (M : Domain) (a : Fin M.K → Bool) (N : ℕ)
156
+ (z t : ℝ) (hzt : z<t) : cdf M a N z ≤ strictCdf M a N t := by
157
+ rw [cdf_finite, strictCdf]
158
+ apply Finset.sum_le_sum
159
+ intro x _
160
+ apply mul_le_mul_of_nonneg_left _ (joint_nonneg M a N x)
161
+ split_ifs <;> norm_num
162
+ linarith
163
+
164
+ theorem strict_upper_cut (M : Domain) (a : Fin M.K → Bool) (N : ℕ)
165
+ (t z : ℝ) (htz : t<z) : strictCdf M a N t ≤ cdf M a N z := by
166
+ rw [cdf_finite, strictCdf]
167
+ apply Finset.sum_le_sum
168
+ intro x _
169
+ apply mul_le_mul_of_nonneg_left _ (joint_nonneg M a N x)
170
+ split_ifs <;> norm_num
171
+ linarith
172
+
173
+ /-- Both versions at the moving threshold have the same limit, only IF fixed-cut
174
+ convergence to a continuous distribution is supplied. No atomless-limit axiom. -/
175
+ theorem threshold_cdf_limits_of_fixed_cut_limits (M : Domain) (a : Fin M.K → Bool)
176
+ (hdiag : score M a = (1:ℝ)/2) (F : ℝ → ℝ) (hF : ContinuousAt F 0)
177
+ (hCLT : ∀ z, Tendsto (fun N => cdf M a N z) atTop (𝓝 (F z))) :
178
+ Tendsto (fun N => cdf M a N (threshold M a N)) atTop (𝓝 (F 0)) ∧
179
+ Tendsto (fun N => strictCdf M a N (threshold M a N)) atTop (𝓝 (F 0)) := by
180
+ constructor
181
+ · apply moving_cut_sandwich (cdf M a) F (threshold M a)
182
+ (fun N => cdf M a N (threshold M a N)) hF hCLT (threshold_limit M a hdiag)
183
+ · filter_upwards [] with N
184
+ intro z hz
185
+ exact cdf_mono M a N hz.le
186
+ · filter_upwards [] with N
187
+ intro z hz
188
+ exact cdf_mono M a N hz.le
189
+ · apply moving_cut_sandwich (cdf M a) F (threshold M a)
190
+ (fun N => strictCdf M a N (threshold M a N)) hF hCLT (threshold_limit M a hdiag)
191
+ · filter_upwards [] with N
192
+ exact fun z hz => strict_lower_cut M a N z _ hz
193
+ · filter_upwards [] with N
194
+ exact fun z hz => strict_upper_cut M a N _ z hz
195
+
196
+ def tieMass (M : Domain) (a : Fin M.K → Bool) (N : ℕ) : ℝ :=
197
+ ∑ x : World (sizes M N), jointMass (sizes M N) (fun i => q M (a i)) x *
198
+ (if 2*correctCount x=N then (1:ℝ) else 0)
199
+
200
+ theorem standardized_eq_threshold (b N : ℕ) (μ σ : ℝ) (hσ : 0<σ) :
201
+ ((b:ℝ)-μ)/σ = ((N:ℝ)/2-μ)/σ ↔ 2*b=N := by
202
+ constructor
203
+ · intro h
204
+ have hm := congrArg (fun y : ℝ => y*σ) h
205
+ simp only [div_mul_cancel₀ _ hσ.ne'] at hm
206
+ exact_mod_cast (show (2:ℝ)*(b:ℝ)=(N:ℝ) by linarith)
207
+ · intro h
208
+ have hn : (2:ℝ)*(b:ℝ)=(N:ℝ) := by exact_mod_cast h
209
+ congr 1
210
+ linarith
211
+
212
+ theorem weak_strict_indicator_difference (r t : ℝ) :
213
+ (if r≤t then (1:ℝ) else 0) - (if r<t then (1:ℝ) else 0) =
214
+ if r=t then (1:ℝ) else 0 := by
215
+ rcases lt_trichotomy r t with h | h | h
216
+ · simp [h, h.le, h.ne]
217
+ · subst t; simp
218
+ · simp [not_le.mpr h, not_lt.mpr h.le, Ne.symm h.ne]
219
+
220
+ theorem tie_mass_difference (M : Domain) (a : Fin M.K → Bool) (N : ℕ) (hN : 0<N) :
221
+ tieMass M a N = cdf M a N (threshold M a N) -
222
+ strictCdf M a N (threshold M a N) := by
223
+ rw [cdf_finite, strictCdf, ← Finset.sum_sub_distrib]
224
+ unfold tieMass
225
+ apply Finset.sum_congr rfl
226
+ intro x _
227
+ rw [← mul_sub, weak_strict_indicator_difference]
228
+ simp only [show (((correctCount x:ℝ)-mean M a N)/sigma M a N = threshold M a N) ↔
229
+ 2*correctCount x=N from
230
+ standardized_eq_threshold _ _ _ _ (sigma_pos M a N hN)]
231
+
232
+ /-- The tie atom vanishes as a CONSEQUENCE of the explicit fixed-cut CLT hypothesis. -/
233
+ theorem tie_limit_of_fixed_cut_limits (M : Domain) (a : Fin M.K → Bool)
234
+ (hdiag : score M a = (1:ℝ)/2) (F : ℝ → ℝ) (hF : ContinuousAt F 0)
235
+ (hCLT : ∀ z, Tendsto (fun N => cdf M a N z) atTop (𝓝 (F z))) :
236
+ Tendsto (tieMass M a) atTop (𝓝 0) := by
237
+ have h := threshold_cdf_limits_of_fixed_cut_limits M a hdiag F hF hCLT
238
+ have hd := h.1.sub h.2
239
+ have he : (fun N => tieMass M a N) =ᶠ[atTop]
240
+ (fun N => cdf M a N (threshold M a N)-strictCdf M a N (threshold M a N)) := by
241
+ filter_upwards [eventually_ge_atTop 1] with N hN
242
+ exact tie_mass_difference M a N (by omega)
243
+ simpa only [sub_self] using hd.congr' he.symm
244
+
245
+ /-- The final value 1/2 requires F(0)=1/2 in addition to continuity and the unpaid CLT. -/
246
+ theorem floor_limit_diag_of_fixed_cut_limits (M : Domain) (a : Fin M.K → Bool)
247
+ (hdiag : score M a = (1:ℝ)/2) (F : ℝ → ℝ) (hF : ContinuousAt F 0)
248
+ (hF0 : F 0 = (1:ℝ)/2)
249
+ (hCLT : ∀ z, Tendsto (fun N => cdf M a N z) atTop (𝓝 (F z))) :
250
+ Tendsto (fun N => conditionalError M N a) atTop (𝓝 ((1:ℝ)/2)) := by
251
+ simpa only [hF0] using diagonal_transfer_of_fixed_cut_limits M a hdiag F hF hCLT
252
+
253
+ /-- A scalar regression outside the independent M0 law: LLN convergence alone does
254
+ not determine a discontinuous majority limit at the diagonal. -/
255
+ def above (N : ℕ) : ℝ := (1:ℝ)/2 + 1/((N:ℝ)+1)
256
+
257
+ theorem above_limit : Tendsto above atTop (𝓝 ((1:ℝ)/2)) := by
258
+ have hinv : Tendsto (fun N : ℕ => (1:ℝ)/((N:ℝ)+1)) atTop (𝓝 0) :=
259
+ tendsto_const_nhds.div_atTop (tendsto_atTop_mono
260
+ (fun N : ℕ => show (N:ℝ) ≤ (N:ℝ)+1 by linarith)
261
+ tendsto_natCast_atTop_atTop)
262
+ simpa only [above, add_zero] using tendsto_const_nhds.add hinv
263
+
264
+ theorem above_loss_zero (N : ℕ) : limitingLoss (above N) = 0 := by
265
+ have hp : 0 < (1:ℝ)/((N:ℝ)+1) := by positivity
266
+ have hg : (1:ℝ)/2 < above N := by dsimp [above]; linarith
267
+ simp only [limitingLoss, if_neg (not_lt.mpr hg.le), if_neg (Ne.symm hg.ne)]
268
+
269
+ theorem lgn_alone_does_not_give_half :
270
+ ¬ Tendsto (fun N => limitingLoss (above N)) atTop (𝓝 ((1:ℝ)/2)) := by
271
+ intro h
272
+ have hz : Tendsto (fun N => limitingLoss (above N)) atTop (𝓝 0) := by
273
+ simpa only [above_loss_zero] using
274
+ (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0:ℝ)) atTop (𝓝 0))
275
+ have hbad := tendsto_nhds_unique hz h
276
+ norm_num at hbad
277
+
278
+ end Obligations046.Threshold