@stevenvo780/st-lang 4.11.0 → 4.12.0

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 (209) hide show
  1. package/dist/proof-systems/fol-prover-advanced/index.d.ts +7 -0
  2. package/dist/proof-systems/fol-prover-advanced/index.d.ts.map +1 -0
  3. package/dist/proof-systems/fol-prover-advanced/index.js +34 -0
  4. package/dist/proof-systems/fol-prover-advanced/index.js.map +1 -0
  5. package/dist/proof-systems/fol-prover-advanced/ordering.d.ts +34 -0
  6. package/dist/proof-systems/fol-prover-advanced/ordering.d.ts.map +1 -0
  7. package/dist/proof-systems/fol-prover-advanced/ordering.js +197 -0
  8. package/dist/proof-systems/fol-prover-advanced/ordering.js.map +1 -0
  9. package/dist/proof-systems/fol-prover-advanced/prover.d.ts +22 -0
  10. package/dist/proof-systems/fol-prover-advanced/prover.d.ts.map +1 -0
  11. package/dist/proof-systems/fol-prover-advanced/prover.js +219 -0
  12. package/dist/proof-systems/fol-prover-advanced/prover.js.map +1 -0
  13. package/dist/proof-systems/fol-prover-advanced/resolve.d.ts +43 -0
  14. package/dist/proof-systems/fol-prover-advanced/resolve.d.ts.map +1 -0
  15. package/dist/proof-systems/fol-prover-advanced/resolve.js +297 -0
  16. package/dist/proof-systems/fol-prover-advanced/resolve.js.map +1 -0
  17. package/dist/proof-systems/fol-prover-advanced/subsumption.d.ts +28 -0
  18. package/dist/proof-systems/fol-prover-advanced/subsumption.d.ts.map +1 -0
  19. package/dist/proof-systems/fol-prover-advanced/subsumption.js +172 -0
  20. package/dist/proof-systems/fol-prover-advanced/subsumption.js.map +1 -0
  21. package/dist/proof-systems/fol-prover-advanced/types.d.ts +68 -0
  22. package/dist/proof-systems/fol-prover-advanced/types.d.ts.map +1 -0
  23. package/dist/proof-systems/fol-prover-advanced/types.js +12 -0
  24. package/dist/proof-systems/fol-prover-advanced/types.js.map +1 -0
  25. package/dist/proof-systems/fol-prover-advanced/unify.d.ts +15 -0
  26. package/dist/proof-systems/fol-prover-advanced/unify.d.ts.map +1 -0
  27. package/dist/proof-systems/fol-prover-advanced/unify.js +144 -0
  28. package/dist/proof-systems/fol-prover-advanced/unify.js.map +1 -0
  29. package/dist/reasoning/combinatorics/basic-counts.d.ts +6 -0
  30. package/dist/reasoning/combinatorics/basic-counts.d.ts.map +1 -0
  31. package/dist/reasoning/combinatorics/basic-counts.js +82 -0
  32. package/dist/reasoning/combinatorics/basic-counts.js.map +1 -0
  33. package/dist/reasoning/combinatorics/bigint-helpers.d.ts +5 -0
  34. package/dist/reasoning/combinatorics/bigint-helpers.d.ts.map +1 -0
  35. package/dist/reasoning/combinatorics/bigint-helpers.js +8 -0
  36. package/dist/reasoning/combinatorics/bigint-helpers.js.map +1 -0
  37. package/dist/reasoning/combinatorics/burnside.d.ts +15 -0
  38. package/dist/reasoning/combinatorics/burnside.d.ts.map +1 -0
  39. package/dist/reasoning/combinatorics/burnside.js +91 -0
  40. package/dist/reasoning/combinatorics/burnside.js.map +1 -0
  41. package/dist/reasoning/combinatorics/generating-functions.d.ts +12 -0
  42. package/dist/reasoning/combinatorics/generating-functions.d.ts.map +1 -0
  43. package/dist/reasoning/combinatorics/generating-functions.js +67 -0
  44. package/dist/reasoning/combinatorics/generating-functions.js.map +1 -0
  45. package/dist/reasoning/combinatorics/generators.d.ts +5 -0
  46. package/dist/reasoning/combinatorics/generators.d.ts.map +1 -0
  47. package/dist/reasoning/combinatorics/generators.js +111 -0
  48. package/dist/reasoning/combinatorics/generators.js.map +1 -0
  49. package/dist/reasoning/combinatorics/inclusion-exclusion.d.ts +8 -0
  50. package/dist/reasoning/combinatorics/inclusion-exclusion.d.ts.map +1 -0
  51. package/dist/reasoning/combinatorics/inclusion-exclusion.js +45 -0
  52. package/dist/reasoning/combinatorics/inclusion-exclusion.js.map +1 -0
  53. package/dist/reasoning/combinatorics/index.d.ts +10 -0
  54. package/dist/reasoning/combinatorics/index.d.ts.map +1 -0
  55. package/dist/reasoning/combinatorics/index.js +44 -0
  56. package/dist/reasoning/combinatorics/index.js.map +1 -0
  57. package/dist/reasoning/combinatorics/partitions.d.ts +4 -0
  58. package/dist/reasoning/combinatorics/partitions.d.ts.map +1 -0
  59. package/dist/reasoning/combinatorics/partitions.js +90 -0
  60. package/dist/reasoning/combinatorics/partitions.js.map +1 -0
  61. package/dist/reasoning/combinatorics/permutations.d.ts +6 -0
  62. package/dist/reasoning/combinatorics/permutations.d.ts.map +1 -0
  63. package/dist/reasoning/combinatorics/permutations.js +124 -0
  64. package/dist/reasoning/combinatorics/permutations.js.map +1 -0
  65. package/dist/reasoning/combinatorics/set-partitions.d.ts +3 -0
  66. package/dist/reasoning/combinatorics/set-partitions.d.ts.map +1 -0
  67. package/dist/reasoning/combinatorics/set-partitions.js +46 -0
  68. package/dist/reasoning/combinatorics/set-partitions.js.map +1 -0
  69. package/dist/reasoning/combinatorics/special-numbers.d.ts +7 -0
  70. package/dist/reasoning/combinatorics/special-numbers.d.ts.map +1 -0
  71. package/dist/reasoning/combinatorics/special-numbers.js +128 -0
  72. package/dist/reasoning/combinatorics/special-numbers.js.map +1 -0
  73. package/dist/reasoning/constructive-analysis/cauchy.d.ts +51 -0
  74. package/dist/reasoning/constructive-analysis/cauchy.d.ts.map +1 -0
  75. package/dist/reasoning/constructive-analysis/cauchy.js +77 -0
  76. package/dist/reasoning/constructive-analysis/cauchy.js.map +1 -0
  77. package/dist/reasoning/constructive-analysis/compact.d.ts +35 -0
  78. package/dist/reasoning/constructive-analysis/compact.d.ts.map +1 -0
  79. package/dist/reasoning/constructive-analysis/compact.js +61 -0
  80. package/dist/reasoning/constructive-analysis/compact.js.map +1 -0
  81. package/dist/reasoning/constructive-analysis/continuity.d.ts +62 -0
  82. package/dist/reasoning/constructive-analysis/continuity.d.ts.map +1 -0
  83. package/dist/reasoning/constructive-analysis/continuity.js +112 -0
  84. package/dist/reasoning/constructive-analysis/continuity.js.map +1 -0
  85. package/dist/reasoning/constructive-analysis/index.d.ts +24 -0
  86. package/dist/reasoning/constructive-analysis/index.d.ts.map +1 -0
  87. package/dist/reasoning/constructive-analysis/index.js +36 -0
  88. package/dist/reasoning/constructive-analysis/index.js.map +1 -0
  89. package/dist/reasoning/constructive-analysis/integral.d.ts +31 -0
  90. package/dist/reasoning/constructive-analysis/integral.d.ts.map +1 -0
  91. package/dist/reasoning/constructive-analysis/integral.js +59 -0
  92. package/dist/reasoning/constructive-analysis/integral.js.map +1 -0
  93. package/dist/reasoning/constructive-analysis/ivt.d.ts +41 -0
  94. package/dist/reasoning/constructive-analysis/ivt.d.ts.map +1 -0
  95. package/dist/reasoning/constructive-analysis/ivt.js +115 -0
  96. package/dist/reasoning/constructive-analysis/ivt.js.map +1 -0
  97. package/dist/reasoning/constructive-reals/index.d.ts +23 -0
  98. package/dist/reasoning/constructive-reals/index.d.ts.map +1 -1
  99. package/dist/reasoning/constructive-reals/index.js +52 -1
  100. package/dist/reasoning/constructive-reals/index.js.map +1 -1
  101. package/dist/reasoning/linear-algebra/index.d.ts +69 -0
  102. package/dist/reasoning/linear-algebra/index.d.ts.map +1 -0
  103. package/dist/reasoning/linear-algebra/index.js +859 -0
  104. package/dist/reasoning/linear-algebra/index.js.map +1 -0
  105. package/dist/reasoning/set-theory/hf-functions.d.ts +35 -0
  106. package/dist/reasoning/set-theory/hf-functions.d.ts.map +1 -0
  107. package/dist/reasoning/set-theory/hf-functions.js +147 -0
  108. package/dist/reasoning/set-theory/hf-functions.js.map +1 -0
  109. package/dist/reasoning/set-theory/hf-sets.d.ts +79 -0
  110. package/dist/reasoning/set-theory/hf-sets.d.ts.map +1 -0
  111. package/dist/reasoning/set-theory/hf-sets.js +338 -0
  112. package/dist/reasoning/set-theory/hf-sets.js.map +1 -0
  113. package/dist/reasoning/set-theory/index.d.ts +7 -0
  114. package/dist/reasoning/set-theory/index.d.ts.map +1 -0
  115. package/dist/reasoning/set-theory/index.js +44 -0
  116. package/dist/reasoning/set-theory/index.js.map +1 -0
  117. package/dist/reasoning/set-theory/zfc-axioms.d.ts +59 -0
  118. package/dist/reasoning/set-theory/zfc-axioms.d.ts.map +1 -0
  119. package/dist/reasoning/set-theory/zfc-axioms.js +245 -0
  120. package/dist/reasoning/set-theory/zfc-axioms.js.map +1 -0
  121. package/dist/tests/proof-systems/fol-prover-advanced/prover.test.d.ts +2 -0
  122. package/dist/tests/proof-systems/fol-prover-advanced/prover.test.d.ts.map +1 -0
  123. package/dist/tests/proof-systems/fol-prover-advanced/prover.test.js +253 -0
  124. package/dist/tests/proof-systems/fol-prover-advanced/prover.test.js.map +1 -0
  125. package/dist/tests/reasoning/combinatorics/combinatorics.test.d.ts +2 -0
  126. package/dist/tests/reasoning/combinatorics/combinatorics.test.d.ts.map +1 -0
  127. package/dist/tests/reasoning/combinatorics/combinatorics.test.js +256 -0
  128. package/dist/tests/reasoning/combinatorics/combinatorics.test.js.map +1 -0
  129. package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.d.ts +2 -0
  130. package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.d.ts.map +1 -0
  131. package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.js +174 -0
  132. package/dist/tests/reasoning/constructive-analysis/constructive-analysis.test.js.map +1 -0
  133. package/dist/tests/reasoning/linear-algebra/linear-algebra.test.d.ts +2 -0
  134. package/dist/tests/reasoning/linear-algebra/linear-algebra.test.d.ts.map +1 -0
  135. package/dist/tests/reasoning/linear-algebra/linear-algebra.test.js +369 -0
  136. package/dist/tests/reasoning/linear-algebra/linear-algebra.test.js.map +1 -0
  137. package/dist/tests/reasoning/set-theory/hf-functions.test.d.ts +2 -0
  138. package/dist/tests/reasoning/set-theory/hf-functions.test.d.ts.map +1 -0
  139. package/dist/tests/reasoning/set-theory/hf-functions.test.js +122 -0
  140. package/dist/tests/reasoning/set-theory/hf-functions.test.js.map +1 -0
  141. package/dist/tests/reasoning/set-theory/hf-sets.test.d.ts +2 -0
  142. package/dist/tests/reasoning/set-theory/hf-sets.test.d.ts.map +1 -0
  143. package/dist/tests/reasoning/set-theory/hf-sets.test.js +177 -0
  144. package/dist/tests/reasoning/set-theory/hf-sets.test.js.map +1 -0
  145. package/dist/tests/reasoning/set-theory/zfc-axioms.test.d.ts +2 -0
  146. package/dist/tests/reasoning/set-theory/zfc-axioms.test.d.ts.map +1 -0
  147. package/dist/tests/reasoning/set-theory/zfc-axioms.test.js +56 -0
  148. package/dist/tests/reasoning/set-theory/zfc-axioms.test.js.map +1 -0
  149. package/dist/tests/tooling/doc-gen/doc-gen.test.d.ts +2 -0
  150. package/dist/tests/tooling/doc-gen/doc-gen.test.d.ts.map +1 -0
  151. package/dist/tests/tooling/doc-gen/doc-gen.test.js +350 -0
  152. package/dist/tests/tooling/doc-gen/doc-gen.test.js.map +1 -0
  153. package/dist/tests/tooling/test-harness/test-harness.test.d.ts +2 -0
  154. package/dist/tests/tooling/test-harness/test-harness.test.d.ts.map +1 -0
  155. package/dist/tests/tooling/test-harness/test-harness.test.js +208 -0
  156. package/dist/tests/tooling/test-harness/test-harness.test.js.map +1 -0
  157. package/dist/tooling/doc-gen/extract.d.ts +13 -0
  158. package/dist/tooling/doc-gen/extract.d.ts.map +1 -0
  159. package/dist/tooling/doc-gen/extract.js +379 -0
  160. package/dist/tooling/doc-gen/extract.js.map +1 -0
  161. package/dist/tooling/doc-gen/generate.d.ts +9 -0
  162. package/dist/tooling/doc-gen/generate.d.ts.map +1 -0
  163. package/dist/tooling/doc-gen/generate.js +116 -0
  164. package/dist/tooling/doc-gen/generate.js.map +1 -0
  165. package/dist/tooling/doc-gen/index.d.ts +7 -0
  166. package/dist/tooling/doc-gen/index.d.ts.map +1 -0
  167. package/dist/tooling/doc-gen/index.js +39 -0
  168. package/dist/tooling/doc-gen/index.js.map +1 -0
  169. package/dist/tooling/doc-gen/jsdoc.d.ts +31 -0
  170. package/dist/tooling/doc-gen/jsdoc.d.ts.map +1 -0
  171. package/dist/tooling/doc-gen/jsdoc.js +140 -0
  172. package/dist/tooling/doc-gen/jsdoc.js.map +1 -0
  173. package/dist/tooling/doc-gen/render.d.ts +29 -0
  174. package/dist/tooling/doc-gen/render.d.ts.map +1 -0
  175. package/dist/tooling/doc-gen/render.js +206 -0
  176. package/dist/tooling/doc-gen/render.js.map +1 -0
  177. package/dist/tooling/doc-gen/types.d.ts +51 -0
  178. package/dist/tooling/doc-gen/types.d.ts.map +1 -0
  179. package/dist/tooling/doc-gen/types.js +10 -0
  180. package/dist/tooling/doc-gen/types.js.map +1 -0
  181. package/dist/tooling/test-harness/combinators.d.ts +14 -0
  182. package/dist/tooling/test-harness/combinators.d.ts.map +1 -0
  183. package/dist/tooling/test-harness/combinators.js +122 -0
  184. package/dist/tooling/test-harness/combinators.js.map +1 -0
  185. package/dist/tooling/test-harness/coverage.d.ts +3 -0
  186. package/dist/tooling/test-harness/coverage.d.ts.map +1 -0
  187. package/dist/tooling/test-harness/coverage.js +32 -0
  188. package/dist/tooling/test-harness/coverage.js.map +1 -0
  189. package/dist/tooling/test-harness/generators.d.ts +6 -0
  190. package/dist/tooling/test-harness/generators.d.ts.map +1 -0
  191. package/dist/tooling/test-harness/generators.js +66 -0
  192. package/dist/tooling/test-harness/generators.js.map +1 -0
  193. package/dist/tooling/test-harness/index.d.ts +7 -0
  194. package/dist/tooling/test-harness/index.d.ts.map +1 -0
  195. package/dist/tooling/test-harness/index.js +27 -0
  196. package/dist/tooling/test-harness/index.js.map +1 -0
  197. package/dist/tooling/test-harness/mutation.d.ts +4 -0
  198. package/dist/tooling/test-harness/mutation.d.ts.map +1 -0
  199. package/dist/tooling/test-harness/mutation.js +28 -0
  200. package/dist/tooling/test-harness/mutation.js.map +1 -0
  201. package/dist/tooling/test-harness/snapshot.d.ts +5 -0
  202. package/dist/tooling/test-harness/snapshot.d.ts.map +1 -0
  203. package/dist/tooling/test-harness/snapshot.js +86 -0
  204. package/dist/tooling/test-harness/snapshot.js.map +1 -0
  205. package/dist/tooling/test-harness/types.d.ts +32 -0
  206. package/dist/tooling/test-harness/types.d.ts.map +1 -0
  207. package/dist/tooling/test-harness/types.js +3 -0
  208. package/dist/tooling/test-harness/types.js.map +1 -0
  209. package/package.json +1 -1
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ /**
3
+ * Constructive Cauchy sequences with explicit modulus of convergence.
4
+ *
5
+ * In Bishop's school, a "Cauchy sequence" without a modulus is not enough
6
+ * data to extract a limit constructively — one needs an explicit
7
+ * `modulus(eps)` returning an index N(eps) such that
8
+ * for all m, n >= N(eps), |x_m - x_n| < eps.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.cauchyFrom = exports.limit = exports.isCauchy = void 0;
12
+ const constructive_reals_1 = require("../constructive-reals");
13
+ /**
14
+ * Sound (one-sided) check: returns true if the modulus genuinely
15
+ * witnesses Cauchy-ness at precision `eps` for the first few terms.
16
+ *
17
+ * Constructively we cannot inspect "all m, n >= N" — we sample a window
18
+ * and verify the bound holds. If the modulus is correct this will
19
+ * return true; if it is a counterexample for some sampled pair, false.
20
+ *
21
+ * `sampleWindow` controls how many terms past N we inspect. Default 8
22
+ * is enough to expose almost all wrong moduli.
23
+ */
24
+ const isCauchy = (seq, epsPrecision, sampleWindow = 8) => {
25
+ if (!Number.isInteger(epsPrecision) || epsPrecision <= 0) {
26
+ throw new RangeError('[cauchy] epsPrecision must be a positive integer');
27
+ }
28
+ const N = seq.modulus(epsPrecision);
29
+ if (!Number.isInteger(N) || N < 0)
30
+ return false;
31
+ for (let i = 0; i <= sampleWindow; i++) {
32
+ for (let j = i + 1; j <= sampleWindow; j++) {
33
+ const diff = (0, constructive_reals_1.abs)((0, constructive_reals_1.sub)(seq.approx(N + i), seq.approx(N + j)));
34
+ // We want diff < 1/eps. Pick precision p such that
35
+ // approxLT(diff, 1/eps, p) is sensitive enough. p = 4 * eps works.
36
+ if (!(0, constructive_reals_1.approxLT)(diff, (0, constructive_reals_1.fromFloat)(1 / epsPrecision), 4 * epsPrecision)) {
37
+ return false;
38
+ }
39
+ }
40
+ }
41
+ return true;
42
+ };
43
+ exports.isCauchy = isCauchy;
44
+ /**
45
+ * Limit of a Cauchy sequence with modulus.
46
+ *
47
+ * `bits` (the CReal precision argument) is the number of binary fractional
48
+ * bits required. We need |limit - approx| < 2^{-bits}.
49
+ *
50
+ * Strategy: find index N such that the N-th term x_N is within 2^{-(bits+1)}
51
+ * of the true limit. By the triangle inequality, evaluating x_N at (bits+1)
52
+ * binary bits gives a result within 2^{-bits} of the limit.
53
+ *
54
+ * The modulus(eps) guarantees |x_m - x_n| < 1/eps for m,n >= N(eps).
55
+ * We need 1/eps <= 2^{-(bits+1)}, so eps >= 2^{bits+1}.
56
+ */
57
+ const limit = (seq) => ({
58
+ approx: (bits) => {
59
+ if (!Number.isInteger(bits) || bits <= 0) {
60
+ throw new RangeError('[cauchy.limit] precision must be a positive integer');
61
+ }
62
+ const eps = Math.pow(2, bits + 1);
63
+ const N = seq.modulus(eps);
64
+ return seq.approx(N).approx(bits + 1);
65
+ }
66
+ });
67
+ exports.limit = limit;
68
+ /**
69
+ * Convenience: builds a Cauchy seq from a generator + a known rate `1/f(eps)`.
70
+ * `f(eps)` must return an integer N with |x_m - x_n| < 1/eps for m, n >= N.
71
+ */
72
+ const cauchyFrom = (term, modulus) => ({
73
+ approx: term,
74
+ modulus
75
+ });
76
+ exports.cauchyFrom = cauchyFrom;
77
+ //# sourceMappingURL=cauchy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cauchy.js","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/cauchy.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,8DAAkF;AAalF;;;;;;;;;;GAUG;AACI,MAAM,QAAQ,GAAG,CACtB,GAA0B,EAC1B,YAAoB,EACpB,YAAY,GAAG,CAAC,EACP,EAAE;IACX,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,UAAU,CAAC,kDAAkD,CAAC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,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC;AATU,QAAA,KAAK,SASf;AAEH;;;GAGG;AACI,MAAM,UAAU,GAAG,CACxB,IAA0B,EAC1B,OAAgC,EACT,EAAE,CAAC,CAAC;IAC3B,MAAM,EAAE,IAAI;IACZ,OAAO;CACR,CAAC,CAAC;AANU,QAAA,UAAU,cAMpB"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Constructive Heine-Borel: every covering of a compact interval [a, b]
3
+ * by open rational intervals has a finite subcover.
4
+ *
5
+ * Bishop's proof is fully constructive: enumerate the cover, and use
6
+ * uniform continuity of the indicator-as-membership predicate via the
7
+ * Lebesgue number lemma. We give a direct algorithmic version: walk
8
+ * from `a` to `b` taking the rightmost reachable endpoint of any
9
+ * interval that contains the current frontier; if we can always
10
+ * advance, we accept; if we get stuck, we reject.
11
+ *
12
+ * The intervals are pairs `[lo, hi]` of CReals; the cover is "open" in
13
+ * the sense `lo < x < hi` (we work with the open interior).
14
+ */
15
+ import { type CReal } from '../constructive-reals';
16
+ export interface ConstructiveOpenCover {
17
+ intervals: ReadonlyArray<readonly [CReal, CReal]>;
18
+ }
19
+ /**
20
+ * Returns true if `cover` constructively covers `[a, b]` and the algorithm
21
+ * found a finite subcover (which in this case is just a subset of the
22
+ * given finite list, so trivially finite — the question is whether the
23
+ * cover suffices).
24
+ *
25
+ * Approach: scan with a frontier `x` initialized to `a`. At each step we
26
+ * search for an interval `(lo, hi)` with `lo < x < hi` (or `lo < x` and
27
+ * `x <= a + tol` at the start) and advance `x := hi`. If we reach
28
+ * `x >= b`, we accept. If we cannot advance, we reject.
29
+ *
30
+ * `tol` is a tiny tolerance for the frontier to handle the fact that we
31
+ * read CReals as JS numbers. Default 1e-12 (well above floating noise
32
+ * for the precision range we use).
33
+ */
34
+ export declare const hasFiniteSubcover: (cover: ConstructiveOpenCover, compact: readonly [CReal, CReal], tol?: number) => boolean;
35
+ //# sourceMappingURL=compact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/compact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,qBAAqB,EAC5B,SAAS,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,EAChC,YAAW,KACV,OAuBF,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * Constructive Heine-Borel: every covering of a compact interval [a, b]
4
+ * by open rational intervals has a finite subcover.
5
+ *
6
+ * Bishop's proof is fully constructive: enumerate the cover, and use
7
+ * uniform continuity of the indicator-as-membership predicate via the
8
+ * Lebesgue number lemma. We give a direct algorithmic version: walk
9
+ * from `a` to `b` taking the rightmost reachable endpoint of any
10
+ * interval that contains the current frontier; if we can always
11
+ * advance, we accept; if we get stuck, we reject.
12
+ *
13
+ * The intervals are pairs `[lo, hi]` of CReals; the cover is "open" in
14
+ * the sense `lo < x < hi` (we work with the open interior).
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.hasFiniteSubcover = void 0;
18
+ const constructive_reals_1 = require("../constructive-reals");
19
+ /**
20
+ * Returns true if `cover` constructively covers `[a, b]` and the algorithm
21
+ * found a finite subcover (which in this case is just a subset of the
22
+ * given finite list, so trivially finite — the question is whether the
23
+ * cover suffices).
24
+ *
25
+ * Approach: scan with a frontier `x` initialized to `a`. At each step we
26
+ * search for an interval `(lo, hi)` with `lo < x < hi` (or `lo < x` and
27
+ * `x <= a + tol` at the start) and advance `x := hi`. If we reach
28
+ * `x >= b`, we accept. If we cannot advance, we reject.
29
+ *
30
+ * `tol` is a tiny tolerance for the frontier to handle the fact that we
31
+ * read CReals as JS numbers. Default 1e-12 (well above floating noise
32
+ * for the precision range we use).
33
+ */
34
+ const hasFiniteSubcover = (cover, compact, tol = 1e-12) => {
35
+ const [aR, bR] = compact;
36
+ const a = (0, constructive_reals_1.toNumber)(aR);
37
+ const b = (0, constructive_reals_1.toNumber)(bR);
38
+ if (!(b >= a))
39
+ return false;
40
+ const ivs = cover.intervals.map(([loR, hiR]) => ({
41
+ lo: (0, constructive_reals_1.toNumber)(loR),
42
+ hi: (0, constructive_reals_1.toNumber)(hiR)
43
+ }));
44
+ let x = a;
45
+ // Ensure start is covered: some interval has lo < a < hi (or a == b edge).
46
+ let safety = ivs.length + 2;
47
+ while (x < b - tol && safety-- > 0) {
48
+ let bestHi = x;
49
+ for (const iv of ivs) {
50
+ if (iv.lo < x + tol && iv.hi > x + tol && iv.hi > bestHi) {
51
+ bestHi = iv.hi;
52
+ }
53
+ }
54
+ if (bestHi <= x + tol)
55
+ return false; // stuck
56
+ x = bestHi;
57
+ }
58
+ return x >= b - tol;
59
+ };
60
+ exports.hasFiniteSubcover = hasFiniteSubcover;
61
+ //# sourceMappingURL=compact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compact.js","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/compact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,8DAA6D;AAM7D;;;;;;;;;;;;;;GAcG;AACI,MAAM,iBAAiB,GAAG,CAC/B,KAA4B,EAC5B,OAAgC,EAChC,GAAG,GAAG,KAAK,EACF,EAAE;IACX,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC;IACzB,MAAM,CAAC,GAAG,IAAA,6BAAQ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* comes with an explicit modulus of uniform continuity
6
+ * omega : Q_>0 -> Q_>0
7
+ * such that |x - y| < omega(eps) implies |f(x) - f(y)| < eps,
8
+ * for all x, y in [a, b].
9
+ *
10
+ * On a general (non-compact) domain, "pointwise" continuity is the wrong
11
+ * notion constructively. We only model uniform continuity on intervals.
12
+ *
13
+ * Modulus convention: we use `modulus(epsPrecision) -> deltaPrecision`,
14
+ * both positive integers, encoding `1/eps -> 1/delta`. So
15
+ * modulus(k) = m means |x - y| < 1/m => |f(x) - f(y)| < 1/k.
16
+ */
17
+ import { type CReal } from '../constructive-reals';
18
+ export interface ConstructiveContinuous {
19
+ /** The function itself. */
20
+ fn: (x: CReal) => CReal;
21
+ /**
22
+ * Modulus of uniform continuity.
23
+ * Given `epsPrecision = k`, returns `deltaPrecision = m` with
24
+ * |x - y| < 1/m => |f(x) - f(y)| < 1/k.
25
+ */
26
+ modulus: (epsPrecision: number) => number;
27
+ }
28
+ /**
29
+ * Sound sampling-based check that the modulus is correct on `[a, b]`.
30
+ *
31
+ * Constructively, "for all x, y in [a, b]" is not decidable. Instead we
32
+ * sample `samples` pairs of points at distance ~1/m within [a, b] and
33
+ * verify the implication holds at each one. If the modulus is correct
34
+ * this returns true; a wrong modulus gets exposed on any failing sample.
35
+ */
36
+ export declare const isUniformlyContinuousOn: (f: ConstructiveContinuous, interval: readonly [CReal, CReal], epsPrecision?: number, samples?: number) => boolean;
37
+ /**
38
+ * Composition of uniformly continuous functions.
39
+ *
40
+ * If g has modulus `omega_g` and f has modulus `omega_f`, then `f . g`
41
+ * has modulus `omega_g . omega_f`:
42
+ * |x - y| < 1 / omega_g(omega_f(eps))
43
+ * => |g(x) - g(y)| < 1/omega_f(eps)
44
+ * => |f(g(x)) - f(g(y))| < 1/eps.
45
+ */
46
+ export declare const composition: (f: ConstructiveContinuous, g: ConstructiveContinuous) => ConstructiveContinuous;
47
+ /**
48
+ * Constant function. Modulus is trivial (any positive integer works).
49
+ */
50
+ export declare const constant: (c: CReal) => ConstructiveContinuous;
51
+ /**
52
+ * Identity. Lipschitz-1, modulus(eps) = eps.
53
+ */
54
+ export declare const identity: () => ConstructiveContinuous;
55
+ /**
56
+ * Lipschitz function from a JS callback with known Lipschitz constant L.
57
+ * Useful for tests. Modulus(eps) = ceil(L * eps).
58
+ *
59
+ * The caller is responsible for the Lipschitz bound being correct.
60
+ */
61
+ export declare const lipschitz: (fn: (x: CReal) => CReal, lipschitzConstant: number) => ConstructiveContinuous;
62
+ //# sourceMappingURL=continuity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuity.d.ts","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/continuity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,KAAK,KAAK,EAMX,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,sBAAsB;IACrC,2BAA2B;IAC3B,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,CAAC;IACxB;;;;OAIG;IACH,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAClC,GAAG,sBAAsB,EACzB,UAAU,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,EACjC,qBAAkB,EAClB,gBAAY,KACX,OA+BF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GACtB,GAAG,sBAAsB,EACzB,GAAG,sBAAsB,KACxB,sBAGD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,KAAK,KAAG,sBAGlC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAO,sBAG1B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GACpB,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,EACvB,mBAAmB,MAAM,KACxB,sBAQF,CAAC"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Constructive (uniform) continuity on a compact interval.
4
+ *
5
+ * Bishop's framework: a function f : [a, b] -> R is continuous iff it
6
+ * comes with an explicit modulus of uniform continuity
7
+ * omega : Q_>0 -> Q_>0
8
+ * such that |x - y| < omega(eps) implies |f(x) - f(y)| < eps,
9
+ * for all x, y in [a, b].
10
+ *
11
+ * On a general (non-compact) domain, "pointwise" continuity is the wrong
12
+ * notion constructively. We only model uniform continuity on intervals.
13
+ *
14
+ * Modulus convention: we use `modulus(epsPrecision) -> deltaPrecision`,
15
+ * both positive integers, encoding `1/eps -> 1/delta`. So
16
+ * modulus(k) = m means |x - y| < 1/m => |f(x) - f(y)| < 1/k.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.lipschitz = exports.identity = exports.constant = exports.composition = exports.isUniformlyContinuousOn = void 0;
20
+ const constructive_reals_1 = require("../constructive-reals");
21
+ /**
22
+ * Sound sampling-based check that the modulus is correct on `[a, b]`.
23
+ *
24
+ * Constructively, "for all x, y in [a, b]" is not decidable. Instead we
25
+ * sample `samples` pairs of points at distance ~1/m within [a, b] and
26
+ * verify the implication holds at each one. If the modulus is correct
27
+ * this returns true; a wrong modulus gets exposed on any failing sample.
28
+ */
29
+ const isUniformlyContinuousOn = (f, interval, epsPrecision = 100, samples = 32) => {
30
+ if (!Number.isInteger(epsPrecision) || epsPrecision <= 0) {
31
+ throw new RangeError('[continuity] epsPrecision must be a positive integer');
32
+ }
33
+ if (!Number.isInteger(samples) || samples <= 0) {
34
+ throw new RangeError('[continuity] samples must be a positive integer');
35
+ }
36
+ const [aR, bR] = interval;
37
+ const a = (0, constructive_reals_1.toNumber)(aR);
38
+ const b = (0, constructive_reals_1.toNumber)(bR);
39
+ if (!(b > a))
40
+ return false;
41
+ const m = f.modulus(epsPrecision);
42
+ if (!Number.isInteger(m) || m <= 0)
43
+ return false;
44
+ const delta = 1 / (m + 1);
45
+ const epsBound = (0, constructive_reals_1.fromFloat)(1 / epsPrecision);
46
+ for (let i = 0; i < samples; i++) {
47
+ const t = i / Math.max(1, samples - 1);
48
+ const x = a + t * (b - a);
49
+ // Pair x with x + delta/2, clipped into [a, b]. Distance < 1/m.
50
+ let y = x + delta / 2;
51
+ if (y > b)
52
+ y = x - delta / 2;
53
+ if (y < a)
54
+ y = (a + b) / 2;
55
+ const fx = f.fn((0, constructive_reals_1.fromFloat)(x));
56
+ const fy = f.fn((0, constructive_reals_1.fromFloat)(y));
57
+ const diff = (0, constructive_reals_1.abs)((0, constructive_reals_1.sub)(fx, fy));
58
+ // We need diff < 1/eps. Use precision 4 * eps for sound comparison.
59
+ if (!(0, constructive_reals_1.approxLT)(diff, epsBound, 4 * epsPrecision)) {
60
+ return false;
61
+ }
62
+ }
63
+ return true;
64
+ };
65
+ exports.isUniformlyContinuousOn = isUniformlyContinuousOn;
66
+ /**
67
+ * Composition of uniformly continuous functions.
68
+ *
69
+ * If g has modulus `omega_g` and f has modulus `omega_f`, then `f . g`
70
+ * has modulus `omega_g . omega_f`:
71
+ * |x - y| < 1 / omega_g(omega_f(eps))
72
+ * => |g(x) - g(y)| < 1/omega_f(eps)
73
+ * => |f(g(x)) - f(g(y))| < 1/eps.
74
+ */
75
+ const composition = (f, g) => ({
76
+ fn: (x) => f.fn(g.fn(x)),
77
+ modulus: (eps) => g.modulus(f.modulus(eps))
78
+ });
79
+ exports.composition = composition;
80
+ /**
81
+ * Constant function. Modulus is trivial (any positive integer works).
82
+ */
83
+ const constant = (c) => ({
84
+ fn: () => c,
85
+ modulus: () => 1
86
+ });
87
+ exports.constant = constant;
88
+ /**
89
+ * Identity. Lipschitz-1, modulus(eps) = eps.
90
+ */
91
+ const identity = () => ({
92
+ fn: (x) => x,
93
+ modulus: (eps) => eps
94
+ });
95
+ exports.identity = identity;
96
+ /**
97
+ * Lipschitz function from a JS callback with known Lipschitz constant L.
98
+ * Useful for tests. Modulus(eps) = ceil(L * eps).
99
+ *
100
+ * The caller is responsible for the Lipschitz bound being correct.
101
+ */
102
+ const lipschitz = (fn, lipschitzConstant) => {
103
+ if (!(lipschitzConstant > 0) || !Number.isFinite(lipschitzConstant)) {
104
+ throw new RangeError('[continuity.lipschitz] L must be finite positive');
105
+ }
106
+ return {
107
+ fn,
108
+ modulus: (eps) => Math.max(1, Math.ceil(lipschitzConstant * eps))
109
+ };
110
+ };
111
+ exports.lipschitz = lipschitz;
112
+ //# sourceMappingURL=continuity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuity.js","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/continuity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,8DAO+B;AAa/B;;;;;;;GAOG;AACI,MAAM,uBAAuB,GAAG,CACrC,CAAyB,EACzB,QAAiC,EACjC,YAAY,GAAG,GAAG,EAClB,OAAO,GAAG,EAAE,EACH,EAAE;IACX,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,UAAU,CAAC,sDAAsD,CAAC,CAAC;IAC/E,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,UAAU,CAAC,iDAAiD,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC;IAC1B,MAAM,CAAC,GAAG,IAAA,6BAAQ,EAAC,EAAE,CAAC,CAAC;IACvB,MAAM,CAAC,GAAG,IAAA,6BAAQ,EAAC,EAAE,CAAC,CAAC;IACvB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,C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;KAC1E,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,SAAS,aAWpB"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Bishop-style constructive real analysis.
3
+ *
4
+ * Re-exports the four pillars:
5
+ * - Cauchy sequences with explicit modulus (`./cauchy`)
6
+ * - Uniform continuity on compact intervals (`./continuity`)
7
+ * - Bishop integral (`./integral`)
8
+ * - Heine-Borel compactness (`./compact`)
9
+ * - Intermediate value + mean value approximations (`./ivt`)
10
+ *
11
+ * All operations are constructive: no LEM, no unrestricted choice, and
12
+ * every claim of convergence/continuity is backed by an explicit
13
+ * modulus function. The CReal primitive lives in
14
+ * `../constructive-reals`.
15
+ */
16
+ export type { ConstructiveCauchySeq } from './cauchy';
17
+ export { isCauchy, limit, cauchyFrom } from './cauchy';
18
+ export type { ConstructiveContinuous } from './continuity';
19
+ export { isUniformlyContinuousOn, composition, constant, identity, lipschitz } from './continuity';
20
+ export { bishopIntegral } from './integral';
21
+ export type { ConstructiveOpenCover } from './compact';
22
+ export { hasFiniteSubcover } from './compact';
23
+ export { intermediateValueTheorem, meanValueConstructive } from './ivt';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Bishop-style constructive real analysis.
4
+ *
5
+ * Re-exports the four pillars:
6
+ * - Cauchy sequences with explicit modulus (`./cauchy`)
7
+ * - Uniform continuity on compact intervals (`./continuity`)
8
+ * - Bishop integral (`./integral`)
9
+ * - Heine-Borel compactness (`./compact`)
10
+ * - Intermediate value + mean value approximations (`./ivt`)
11
+ *
12
+ * All operations are constructive: no LEM, no unrestricted choice, and
13
+ * every claim of convergence/continuity is backed by an explicit
14
+ * modulus function. The CReal primitive lives in
15
+ * `../constructive-reals`.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.meanValueConstructive = exports.intermediateValueTheorem = exports.hasFiniteSubcover = exports.bishopIntegral = exports.lipschitz = exports.identity = exports.constant = exports.composition = exports.isUniformlyContinuousOn = exports.cauchyFrom = exports.limit = exports.isCauchy = void 0;
19
+ var cauchy_1 = require("./cauchy");
20
+ Object.defineProperty(exports, "isCauchy", { enumerable: true, get: function () { return cauchy_1.isCauchy; } });
21
+ Object.defineProperty(exports, "limit", { enumerable: true, get: function () { return cauchy_1.limit; } });
22
+ Object.defineProperty(exports, "cauchyFrom", { enumerable: true, get: function () { return cauchy_1.cauchyFrom; } });
23
+ var continuity_1 = require("./continuity");
24
+ Object.defineProperty(exports, "isUniformlyContinuousOn", { enumerable: true, get: function () { return continuity_1.isUniformlyContinuousOn; } });
25
+ Object.defineProperty(exports, "composition", { enumerable: true, get: function () { return continuity_1.composition; } });
26
+ Object.defineProperty(exports, "constant", { enumerable: true, get: function () { return continuity_1.constant; } });
27
+ Object.defineProperty(exports, "identity", { enumerable: true, get: function () { return continuity_1.identity; } });
28
+ Object.defineProperty(exports, "lipschitz", { enumerable: true, get: function () { return continuity_1.lipschitz; } });
29
+ var integral_1 = require("./integral");
30
+ Object.defineProperty(exports, "bishopIntegral", { enumerable: true, get: function () { return integral_1.bishopIntegral; } });
31
+ var compact_1 = require("./compact");
32
+ Object.defineProperty(exports, "hasFiniteSubcover", { enumerable: true, get: function () { return compact_1.hasFiniteSubcover; } });
33
+ var ivt_1 = require("./ivt");
34
+ Object.defineProperty(exports, "intermediateValueTheorem", { enumerable: true, get: function () { return ivt_1.intermediateValueTheorem; } });
35
+ Object.defineProperty(exports, "meanValueConstructive", { enumerable: true, get: function () { return ivt_1.meanValueConstructive; } });
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,mCAAuD;AAA9C,kGAAA,QAAQ,OAAA;AAAE,+FAAA,KAAK,OAAA;AAAE,oGAAA,UAAU,OAAA;AAGpC,2CAMsB;AALpB,qHAAA,uBAAuB,OAAA;AACvB,yGAAA,WAAW,OAAA;AACX,sGAAA,QAAQ,OAAA;AACR,sGAAA,QAAQ,OAAA;AACR,uGAAA,SAAS,OAAA;AAGX,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AAGvB,qCAA8C;AAArC,4GAAA,iBAAiB,OAAA;AAE1B,6BAAwE;AAA/D,+GAAA,wBAAwB,OAAA;AAAE,4GAAA,qBAAqB,OAAA"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Constructive Bishop integral on a compact interval.
3
+ *
4
+ * For uniformly continuous f on [a, b], the integral
5
+ * I = ∫_a^b f(x) dx
6
+ * is computed as the limit of Riemann sums. The explicit modulus of
7
+ * uniform continuity gives us the rate.
8
+ *
9
+ * Specifically: given a partition of mesh h, and any choice of sample
10
+ * points, the Riemann sum S_h satisfies
11
+ * |S_h - I| <= (b - a) * sup{ |f(x) - f(y)| : |x - y| <= h }
12
+ *
13
+ * If we want |S_h - I| < 1/N, pick eps with eps * (b - a) < 1/N, i.e.
14
+ * eps > N * (b - a). Then choose h < 1/omega_f(eps).
15
+ */
16
+ import { type CReal } from '../constructive-reals';
17
+ import type { ConstructiveContinuous } from './continuity';
18
+ /**
19
+ * Bishop integral of `f` over `[from, to]`.
20
+ *
21
+ * `precision` is a positive integer N; the result is a rational `q` with
22
+ * |q - ∫_from^to f| < 1/N.
23
+ *
24
+ * Implementation: midpoint rule with mesh < 1/m where
25
+ * m = omega_f(ceil(N * length) + 1)
26
+ *
27
+ * which guarantees the bound above. We then wrap the rational in a CReal
28
+ * for compositionality (the same precision N is exposed as 1/N error).
29
+ */
30
+ export declare const bishopIntegral: (f: ConstructiveContinuous, from: CReal, to: CReal, precision: number) => CReal;
31
+ //# sourceMappingURL=integral.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integral.d.ts","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/integral.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,KAAK,EAAuB,MAAM,uBAAuB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GACzB,GAAG,sBAAsB,EACzB,MAAM,KAAK,EACX,IAAI,KAAK,EACT,WAAW,MAAM,KAChB,KAwBF,CAAC"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /**
3
+ * Constructive Bishop integral on a compact interval.
4
+ *
5
+ * For uniformly continuous f on [a, b], the integral
6
+ * I = ∫_a^b f(x) dx
7
+ * is computed as the limit of Riemann sums. The explicit modulus of
8
+ * uniform continuity gives us the rate.
9
+ *
10
+ * Specifically: given a partition of mesh h, and any choice of sample
11
+ * points, the Riemann sum S_h satisfies
12
+ * |S_h - I| <= (b - a) * sup{ |f(x) - f(y)| : |x - y| <= h }
13
+ *
14
+ * If we want |S_h - I| < 1/N, pick eps with eps * (b - a) < 1/N, i.e.
15
+ * eps > N * (b - a). Then choose h < 1/omega_f(eps).
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.bishopIntegral = void 0;
19
+ const constructive_reals_1 = require("../constructive-reals");
20
+ /**
21
+ * Bishop integral of `f` over `[from, to]`.
22
+ *
23
+ * `precision` is a positive integer N; the result is a rational `q` with
24
+ * |q - ∫_from^to f| < 1/N.
25
+ *
26
+ * Implementation: midpoint rule with mesh < 1/m where
27
+ * m = omega_f(ceil(N * length) + 1)
28
+ *
29
+ * which guarantees the bound above. We then wrap the rational in a CReal
30
+ * for compositionality (the same precision N is exposed as 1/N error).
31
+ */
32
+ const bishopIntegral = (f, from, to, precision) => {
33
+ if (!Number.isInteger(precision) || precision <= 0) {
34
+ throw new RangeError('[bishopIntegral] precision must be a positive integer');
35
+ }
36
+ const a = (0, constructive_reals_1.toNumber)(from);
37
+ const b = (0, constructive_reals_1.toNumber)(to);
38
+ if (a === b)
39
+ return (0, constructive_reals_1.fromFloat)(0);
40
+ const sign = b > a ? 1 : -1;
41
+ const lo = Math.min(a, b);
42
+ const hi = Math.max(a, b);
43
+ const length = hi - lo;
44
+ // Need eps such that eps * length < 1/precision.
45
+ // Use eps = ceil(precision * length) + 1 as positive integer threshold.
46
+ const eps = Math.max(1, Math.ceil(precision * length) + 1);
47
+ const m = f.modulus(eps);
48
+ // Mesh: 1/(m+1). Number of subintervals: N := ceil(length * (m+1)) + 1.
49
+ const N = Math.max(1, Math.ceil(length * (m + 1)) + 1);
50
+ const h = length / N;
51
+ let sum = 0;
52
+ for (let i = 0; i < N; i++) {
53
+ const xi = lo + (i + 0.5) * h; // midpoint
54
+ sum += (0, constructive_reals_1.toNumber)(f.fn((0, constructive_reals_1.fromFloat)(xi)), Math.max(eps, 1_000));
55
+ }
56
+ return (0, constructive_reals_1.fromFloat)(sign * sum * h);
57
+ };
58
+ exports.bishopIntegral = bishopIntegral;
59
+ //# sourceMappingURL=integral.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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AC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;IACrB,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW;QAC1C,GAAG,IAAI,IAAA,6BAAQ,EAAC,CAAC,CAAC,EAAE,CAAC,IAAA,8BAAS,EAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,IAAA,8BAAS,EAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC;AA7BW,QAAA,cAAc,kBA6BzB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Constructive Intermediate Value Theorem and Mean Value approximation.
3
+ *
4
+ * Classically: if f is continuous on [a, b] and f(a) <= target <= f(b),
5
+ * then there exists c in [a, b] with f(c) = target. Constructively the
6
+ * exact statement is unprovable without LEM (deciding equality on R is
7
+ * not decidable), but the *approximate* IVT is fully constructive:
8
+ *
9
+ * Given precision N, we can compute c in [a, b] with |f(c) - target| < 1/N.
10
+ *
11
+ * Algorithm (bisection with explicit witness):
12
+ * - require f(a) and f(b) to bracket `target` (with a tolerance);
13
+ * - bisect, picking the half where the target still lies between the
14
+ * endpoints' images at sufficient precision;
15
+ * - stop when |f(c) - target| < 1/N (witnessed at precision 4N).
16
+ *
17
+ * Mean value (constructive): for uniformly continuous f, the average
18
+ * value `(1/(b-a)) * ∫_a^b f` is a real in the closure of the image of f.
19
+ * The constructive MVT-approximation finds c in [a, b] with
20
+ * |f(c) - average| < 1/N.
21
+ */
22
+ import { type CReal } from '../constructive-reals';
23
+ import type { ConstructiveContinuous } from './continuity';
24
+ /**
25
+ * Returns a CReal `c` with |f(c) - target| < 1/precision, or null if no
26
+ * such c is bracketed in [a, b] at the given precision.
27
+ *
28
+ * Requires f(a) <= target <= f(b) or the reverse (we don't assume a
29
+ * specific direction; we use a generalized sign test).
30
+ */
31
+ export declare const intermediateValueTheorem: (f: ConstructiveContinuous, a: CReal, b: CReal, target: CReal, precision: number) => CReal | null;
32
+ /**
33
+ * Constructive mean value approximation: find c in [a, b] with
34
+ * |f(c) - (1/(b-a)) * ∫_a^b f(x) dx| < 1/precision,
35
+ * if such c is bracketed at this precision; null otherwise.
36
+ *
37
+ * Strategy: compute the average via Bishop integral, then call IVT to
38
+ * locate c.
39
+ */
40
+ export declare const meanValueConstructive: (f: ConstructiveContinuous, a: CReal, b: CReal, precision: number) => CReal | null;
41
+ //# sourceMappingURL=ivt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ivt.d.ts","sourceRoot":"","sources":["../../../src/reasoning/constructive-analysis/ivt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,KAAK,KAAK,EAMX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAK3D;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,GAAG,sBAAsB,EACzB,GAAG,KAAK,EACR,GAAG,KAAK,EACR,QAAQ,KAAK,EACb,WAAW,MAAM,KAChB,KAAK,GAAG,IAmDV,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAChC,GAAG,sBAAsB,EACzB,GAAG,KAAK,EACR,GAAG,KAAK,EACR,WAAW,MAAM,KAChB,KAAK,GAAG,IAcV,CAAC"}