|
| 1 | +--- |
| 2 | +specifies: main.mac |
| 3 | +related: |
| 4 | + - README.md |
| 5 | +--- |
| 6 | + |
| 7 | +# CAS Companion Goals: Numbers as Machines (NAM) |
| 8 | + |
| 9 | +This document specifies goals for an agentic coding process tasked with writing a |
| 10 | +companion verification/experimentation script for the NAM essay. NAM is an |
| 11 | +_architecture_ essay rather than a theorem essay, so the companion's job is to build a |
| 12 | +**small, honest reference prototype** of the generator-VM substrate and to use it to |
| 13 | +**empirically confirm or falsify** the essay's structural claims. |
| 14 | + |
| 15 | +A CAS (Maxima) is useful for the symbolic/number-theoretic checks (periodicity, |
| 16 | +valuations, BBP modular structure, state-dimension recurrences). A systems language |
| 17 | +is not required for the prototype — a high-level language with exact bignums |
| 18 | +(Python+gmpy2, or Maxima's own Lisp layer) suffices to demonstrate every claim. The |
| 19 | +LLVM/ABI claims are validated _structurally_ (state layout, fork cost) rather than by |
| 20 | +actually emitting machine code. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## 0. Infrastructure / Harness Goals |
| 25 | + |
| 26 | +- **G0.1 — The step primitive.** Implement the core interface |
| 27 | + `step : State → (digit, State)` as the single contract every number satisfies. |
| 28 | + Provide a driver that pulls N digits and a `take(vm, N)` helper. |
| 29 | +- **G0.2 — Fork primitive with cost accounting.** Implement `fork(vm)` and instrument |
| 30 | + it to report whether the fork was an O(1) value copy (automaton tier) or required a |
| 31 | + deep copy of growing accumulators (series tier). Cost accounting is the point of |
| 32 | + the two-tier ABI; make it measurable. |
| 33 | +- **G0.3 — Base/codec separation.** Implement `in_base(vm, b)` as a _projection_ |
| 34 | + wrapper, demonstrating that changing base does not change the underlying generator. |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +## 1. The MUX / Coalgebra Foundation |
| 39 | + |
| 40 | +- **G1.1 — MUX combinator.** Implement `MUX(selector, left, right)` as a generator |
| 41 | + over generators and demonstrate it builds: a number (digit function), a vector |
| 42 | + (MUX over numbers), and a matrix (MUX over vectors) — the uniform nesting claim. |
| 43 | +- **G1.2 — Final-coalgebra sanity.** Demonstrate the digit-stream functor framing by |
| 44 | + showing two VMs are bisimilar iff they emit identical streams on a finite prefix |
| 45 | + (necessarily prefix-only, since full equality is undecidable — see G7). |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## 2. Signed-Digit Arithmetic (the carry problem) |
| 50 | + |
| 51 | +- **G2.1 — Carry non-locality demonstration.** Implement _naive_ standard-base addition |
| 52 | + and exhibit the failure: show that the first digit of `0.4999... + 0.5000...` cannot |
| 53 | + be committed from any finite prefix (the combinator stalls). This is the essay's |
| 54 | + motivating pathology; reproduce it concretely. |
| 55 | +- **G2.2 — Avizienis signed-digit fix.** Implement signed-digit (redundant) |
| 56 | + representation with digits in {−(b−1),...,b−1} and show that addition becomes |
| 57 | + digit-local with bounded look-ahead — the same input now commits digits. |
| 58 | +- **G2.3 — Streaming arithmetic.** Confirm addition, subtraction, and multiplication |
| 59 | + are genuinely streaming (online) under signed digits, with the codec layer |
| 60 | + projecting back to a non-redundant alphabet only on emission. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## 3. p-Adics as Periodic Automata (the clean case) |
| 65 | + |
| 66 | +- **G3.1 — Periodic generator.** Implement a p-adic rational as a finite-state machine |
| 67 | + and verify its digit expansion is ultimately periodic with a finite state orbit. |
| 68 | +- **G3.2 — Local digit commitment.** Demonstrate the essay's key contrast: p-adic |
| 69 | + digit commitment is _local_ (no tail oracle, no interval refinement) because a term |
| 70 | + of valuation v affects only positions ≤ v. Implement `valuation(a_n)` and show |
| 71 | + low-order digits computed from a finite term subset. |
| 72 | +- **G3.3 — Metric as product automaton.** Implement the p-adic distance |
| 73 | + `p^{−v_p(x−y)}` for two periodic generators as a product automaton over their state |
| 74 | + spaces, and confirm it is itself a finite periodic machine. |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## 4. The "Odd Primitives" (series tier) |
| 79 | + |
| 80 | +- **G4.1 — Series stepper + tail-bound oracle.** Implement `series_step` and |
| 81 | + `tail_bound` for at least e (Σ1/n!) and one of {π via a known series, log 2}. |
| 82 | + Verify the tail bound is rigorous: the emitted digit never gets revised once |
| 83 | + committed. |
| 84 | +- **G4.2 — Interval refinement engine.** Implement `refine_interval` / |
| 85 | + `emit_digit_if_safe` and demonstrate online digit extraction as the interval |
| 86 | + collapses. |
| 87 | +- **G4.3 — Exact-boundary honesty.** Demonstrate the documented caveat: a value that |
| 88 | + is exactly 0.5 in base 10 may _never_ commit a leading digit in finite time. Show |
| 89 | + the engine correctly returns "pending" rather than lying — and that the |
| 90 | + interval-based predicates (G7) handle it gracefully. |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## 5. State-Dimension Complexity Tiers (the central conjecture) |
| 95 | + |
| 96 | +The essay's headline table claims minimal VM state dimension grows: rationals (1), |
| 97 | +quadratic irrationals (2), classical transcendentals (3–4), higher transcendentals |
| 98 | +(4–6+), inaccessible (unbounded). |
| 99 | + |
| 100 | +- **G5.1 — Minimal recurrence orders.** For rationals and quadratic irrationals, build |
| 101 | + the minimal-state generator and confirm the logical register count (1 and 2 |
| 102 | + respectively) and O(log n) bit-width growth. Symbolically derive the order-2 |
| 103 | + recurrence for √2, φ, √3. |
| 104 | +- **G5.2 — Transcendental state tier.** Build generators for π and e and _measure_ |
| 105 | + live state (number of coupled accumulators + index/error state). Report the observed |
| 106 | + dimension. The script should explicitly flag that this is an _upper witness_, not a |
| 107 | + proven lower bound (the essay is honest that minimality is an open problem). |
| 108 | +- **G5.3 — Non-minimal engine cross-check (ties to PI_RCC).** Implement the x+sin(x) |
| 109 | + cubic engine from the PI_RCC companion _as a generator VM_ and confirm it carries |
| 110 | + MORE live state than the 3–4 minimal figure for π — directly illustrating the |
| 111 | + essay's "the table tracks the floor; specific engines sit on or above it" remark. |
| 112 | + This is the key cross-essay consistency check. |
| 113 | +- **G5.4 — Inaccessible = O(n).** Demonstrate that a "random"/encrypted stream |
| 114 | + generator requires state growing with digits emitted (O(n)), contrasting with the |
| 115 | + O(log n) bit-width of accessible numbers. |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## 6. BBP / Skip-Ahead (automaton-codec resonance) |
| 120 | + |
| 121 | +- **G6.1 — Base-16 π digit extraction.** Implement the BBP formula and a `skip(n)` |
| 122 | + primitive that computes the n-th hex digit of π via repeated-squaring modular |
| 123 | + exponentiation, _without_ computing predecessors. Verify against a reference π in |
| 124 | + base 16. |
| 125 | +- **G6.2 — Fast-forward is O(log n).** Confirm skip cost scales as O(log n) (modular |
| 126 | + exponentiation), not O(n), by timing/operation-counting against n. |
| 127 | +- **G6.3 — Codec dependence.** Demonstrate the essay's "property of the projection, not |
| 128 | + the number" claim: show the base-16 generator admits skip while the base-10 |
| 129 | + generator does not (no _known_ fast-forward). Frame the base-10 absence honestly as |
| 130 | + conjectural, per the essay. |
| 131 | +- **G6.4 — Genuine periodicity vs fast-forwardable.** Contrast a truly periodic case |
| 132 | + (a rational, or a periodic p-adic) where skip is exact finite-orbit jumping, against |
| 133 | + π-in-base-16 where skip is the repeated-squaring structure — confirming the essay's |
| 134 | + flagged distinction that "periodicity" is shorthand that overstates the symmetry in |
| 135 | + the transcendental case. |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## 7. Equality / Comparison (interval-honest, undecidable) |
| 140 | + |
| 141 | +- **G7.1 — Predicate family.** Implement `definitely_less_than`, |
| 142 | + `agrees_with(digits=N)`, and `compare(max_digits=N) → {Less|Greater|Indistinguishable}`. |
| 143 | + Show they never claim exact equality. |
| 144 | +- **G7.2 — Undecidability witness.** Demonstrate concretely (e.g. two different |
| 145 | + generators for the same constant) that `agrees_with` can only ever confirm a finite |
| 146 | + prefix, never decide true equality — the Rice's-theorem boundary made operational. |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +## 8. Randomness as Inaccessible Determinism |
| 151 | + |
| 152 | +- **G8.1 — PRNG-as-number.** Wrap a small deterministic PRNG (e.g. a counter through a |
| 153 | + hash) as a `step`-conforming generator and show it is a perfectly valid number whose |
| 154 | + generator is small but _cryptographically inaccessible_ from the output. |
| 155 | +- **G8.2 — Accessibility classification.** Provide a function/report that classifies a |
| 156 | + generator as accessible / cryptographically-inaccessible / computably-inaccessible, |
| 157 | + and emphasize (per the essay) that the distinction is epistemic, not ontological — |
| 158 | + the digit-driver behaves identically for all three. |
| 159 | + |
| 160 | +--- |
| 161 | + |
| 162 | +## 9. The Two-Tier ABI (structural validation) |
| 163 | + |
| 164 | +- **G9.1 — Struct-layout mirror.** Mirror the essay's `AutomatonVM` (fixed inline |
| 165 | + state[4]) and `SeriesVM` (immutable spec + mutable accumulators) as data structures, |
| 166 | + and verify the fork-cost claims structurally: AutomatonVM fork is a pure value copy; |
| 167 | + SeriesVM fork must deep-copy the accumulators. |
| 168 | +- **G9.2 — Codec-in-payload.** Verify that the base lives in a payload/flag field and |
| 169 | + that swapping it does not alter the ABI or the underlying generator (re-confirms |
| 170 | + G0.3 at the struct level). |
| 171 | + |
| 172 | +--- |
| 173 | + |
| 174 | +## 10. Cross-Essay PNT Consistency |
| 175 | + |
| 176 | +- **G10.1** Confirm the same number-theoretic input `log lcm(1,...,M) = ψ(M) ~ M` |
| 177 | + appears in NAM's series-tier bit-width accounting exactly as in the RCC and PI_RCC |
| 178 | + companions. Run the shared ψ(M)/M → 1 check and assert the constant is consistent |
| 179 | + across all three companion scripts. This is the "load-bearing number-theoretic |
| 180 | + input recurs in all three" thread from the trilogy README. |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## 11. Reporting Contract |
| 185 | + |
| 186 | +Emit a report that, per claim, states: (claim, prototype-verified? yes/no, measured |
| 187 | +quantity, honest caveat where the essay flags one). The headline verdicts are: |
| 188 | +signed-digit makes addition local (G2.2), p-adic commitment is local (G3.2), the |
| 189 | +state-dimension table holds as an _upper-witness_ hierarchy (G5), BBP skip is O(log n) |
| 190 | +and codec-dependent (G6), equality is only prefix-decidable (G7.2), and the two-tier |
| 191 | +fork-cost split is real (G9.1). Every "open problem" the essay flags (state |
| 192 | +minimality, base-10 BBP absence, randomness metaphysics) must be reported as |
| 193 | +_probed but not settled_, never as proven. |
0 commit comments