Commit 854d606
authored
specialize ℕ→ℤ end to end — real refinement witnesses, the first lifting (R3-M1) (#91)
R3-M1: ℕ is the first specialized carrier. The reifiers (both bridges)
emit the ℤ image of a ℕ goal — `Int.ofNat` cast shells, folded literals
(closed `^`, so 2^24-scale numerals ride through), `_pb_nonneg_*`
hypotheses, and a `primitive`-kind metadata entry whose
`embedding_witness:` tags name the actual embedding lemmas, each with a
content-hashed `library_provenance` entry. `Refinement.run` stops
fabricating its witness: `soundness_witness` is the joined tag payloads,
and no witness means no specialization (fail closed; method specs
likewise need a target-level witness — additive-optional schema field,
v1.1-bound). The first lifting code: term mode casts every witness-named
hypothesis to ℤ by term construction (decidable-byContra wrappers; Lean
rides kernel defeq, Rocq uses explicit constructive push lemmas — its ℕ
term-mode footprint is EMPTY) and runs the shared Int Farkas fold; the
walker gets a cast layer + atom-override context in front of
`walkProof`. Cert-consuming closers gate on the recorded specializations
being exactly the invertible set. Nonlinear ℕ products atomize to
spec-§4.4 `Opaque` payload atoms (the R4-D1 shape, first live `Opaque`
producer); ℕ subtraction/division/modulo and nested ℕ quantifiers fail
fast. 7 new corpus goals (2^24, ∀ℕ, D1 included) close live-strict via
`proof_broker_walker` on both bridges — live-mintable 24/24.
check.py/validate.py cross-check every specialization witness against
`library_provenance` (IR tags and paired certs). Decision record:
delta.md §5.4. This is the C3a mid-phase checkpoint; M2 (polymorphic α)
and M3 (def-unfold) follow in-phase.
Fourteen commits, reviewable one at a time: `4514cc1` (refinement
witnesses, fail closed), `3d6bc32` (SDK cast transparency + Opaque),
`449c60c` (content_hash FFI), `e3f91db` (Lean reifier), `c126d58` (Lean
lift), `243e920` (Lean tests), `6fb0087` (Rocq port), `d439547`
(corpus), `f62d370` (fixtures), `d89d122` (delta §5.4); C3a ROUND 1
fixes: `fbc99ac` (coverage/status honest about static-vs-live replay),
`e84799d` (spec gate pinned by synthetic-cert tests, both bridges),
`800f98a` (gate covers case-split + plain-path walker attempts),
`d727b0f` (atomization refuses hidden ℕ sub/div/mod); C3a ROUND 2 fix:
`2ab86bd` (atom scan covers spelled core names + Nat.pred).
Validation (local, verbatim CI commands, 2026-09-01, tree `2ab86bd`;
tails in `R3-REVIEW.local.md`, Gate status + the ROUND records; review
CONVERGED after 2 rounds): schemas all 17 steps exit 0; sdk 29 suites +
cross-tool 3/3 + FFI T1–T6; lean pipefail 880 jobs, "OK: all 135
allowlisted theorem(s) within their axiom ceiling", roundtrip 37 OK;
rocq from `dune clean` "OK: all 176 within ceiling", corpus drift-free.
Rocq `pb_nat_term*_axiom_free` print "Closed under the global context";
Lean `pb_nat_term*` pinned at `[propext, Quot.sound]`; the
specialization gate's throw branches are test-pinned on both bridges.
Base: `21f07be`. Allowlist: additions only (Lean +15, Rocq +35), no
ceiling raised on any existing theorem. Scoped follow-ups (not in this
PR): M2/M3; Tier-1 rescue for goals whose cvc5 traces lack `la_generic`;
a cast-layer `walker_test` for the static CorpusReplay (ℕ goals carry
`static_replay_skip`); reifier accumulator state threading
(parallel-elaboration hygiene).1 parent 21f07be commit 854d606
75 files changed
Lines changed: 6633 additions & 232 deletions
File tree
- corpus
- goals
- traces
- examples
- lean-bridge
- ProofBroker
- Test
- rocq-bridge
- src
- theories
- schemas/v1.0
- sdk
- ffi
- test
- lib
- test
- tools
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| 68 | + | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
68 | 133 | | |
69 | 134 | | |
70 | 135 | | |
71 | 136 | | |
72 | 137 | | |
73 | 138 | | |
74 | 139 | | |
| 140 | + | |
75 | 141 | | |
76 | 142 | | |
77 | 143 | | |
78 | 144 | | |
79 | 145 | | |
80 | 146 | | |
81 | 147 | | |
| 148 | + | |
82 | 149 | | |
83 | 150 | | |
84 | 151 | | |
85 | 152 | | |
86 | 153 | | |
87 | 154 | | |
88 | 155 | | |
| 156 | + | |
89 | 157 | | |
90 | 158 | | |
91 | 159 | | |
92 | 160 | | |
93 | 161 | | |
94 | 162 | | |
95 | 163 | | |
| 164 | + | |
96 | 165 | | |
97 | 166 | | |
98 | 167 | | |
99 | 168 | | |
100 | 169 | | |
101 | 170 | | |
102 | 171 | | |
| 172 | + | |
103 | 173 | | |
104 | 174 | | |
105 | 175 | | |
106 | 176 | | |
107 | 177 | | |
108 | 178 | | |
109 | 179 | | |
| 180 | + | |
110 | 181 | | |
111 | 182 | | |
112 | 183 | | |
113 | 184 | | |
114 | 185 | | |
115 | 186 | | |
116 | 187 | | |
| 188 | + | |
117 | 189 | | |
118 | 190 | | |
119 | 191 | | |
120 | 192 | | |
121 | 193 | | |
122 | 194 | | |
123 | 195 | | |
| 196 | + | |
124 | 197 | | |
125 | 198 | | |
126 | 199 | | |
127 | 200 | | |
128 | 201 | | |
129 | 202 | | |
130 | 203 | | |
| 204 | + | |
131 | 205 | | |
132 | 206 | | |
133 | 207 | | |
| |||
0 commit comments