Commit dbff7e0
committed
fix: R-0442 — a locally bound callable is not a global name (bug 061)
`PExpr.call "f" args` meant BOTH "call the definition `f`" and "apply the
fn-typed parameter `f`", and `eval` resolved both through the global `FnTable`.
In the one place this project makes soundness claims, a parameter and a
definition of the same spelling were the same thing.
Bug 061 was filed as latent — "no reachable witness in std today". That was
wrong, and the correction is the substance of this change: the witness was
already in the repo. `pureCoreFns` bound the representative callback `f` as a
GLOBAL, because the HOF specs applied their parameter as `.call "f"`. So
option_map_correct / result_map_correct / result_map_err_correct were discharged
by resolving a parameter application against a definition. The conflation was
load-bearing in three shipped theorems. They remain true, and their scope was
always recorded as proof_coverage(representative); the mechanism by which Lean
accepted them was the defect.
Two identities, two namespaces:
PExpr.call fn args -> FnTable.globals only
PExpr.applyVar b args -> FnTable.callables only
`FnTable` became a structure carrying both, and kept its NAME so ~96
`(fns : FnTable)` annotations and ~166 `eval fns …` call sites keep their
meaning; only the three places that APPLY a table had to choose a namespace,
which is where the choice belongs. No `CoeFun FnTable` — an implicit application
would resolve to `globals` and silently reinstate the conflation, the same
reasoning that retired `Coe String SCallee` in R-0436.
Carried through every consumer the task lists: extraction (both sites; indirect
callees map to `.applyVar` rather than being refused — refusing cost three real
proofs), evaluation, fingerprints (call vs callptr, now gated not inspected),
preservation statements (eval_apply_var_reduces, and apply_var_ignores_globals
proving an applied local is STUCK under any global table), reports (`&b(...)`,
`.applyVar`, and both scaffold generators emitting a documented two-namespace
table), proof dependencies (an applied parameter takes no edge), and per-form
completeness: `pexprApplies`/`callableTableComplete` beside
`pexprCalls`/`fnTableComplete`. Two collectors rather than one tagged list,
because a single list is what let one predicate check a parameter against the
global namespace. Kernel-checked `example`s assert the three HOF specs' callable
namespace is complete AND their global namespace is empty — the latter is what
makes a regression visible.
Gate check_proofcore_callable_identity.sh (29 checks), including the source-level
witness said not to exist: one program where `f` is both a definition and a
parameter name, extracting to `.call "f"` and `.applyVar "f"`.
Mutations #31-#33. The two that rebind resolution are killed by the Lean KERNEL,
not the gate — the three map theorems reduce to `⊢ False` when the callback sits
in the wrong namespace. The proofs are themselves evidence for the separation,
which is a stronger outcome than the gate alone; the mutation comment records
that a build-kill is weak only when a LINTER rejects the file.
Frontier moves to R-0004, which required this: its subject digest and receipts
must name an unambiguous application model.1 parent 5629d65 commit dbff7e0
22 files changed
Lines changed: 809 additions & 131 deletions
File tree
- .githooks
- .github/workflows
- Concrete
- ProofKit
- Proof
- Report
- docs/bugs
- proofs/Examples
- ConstantTimeTag
- CryptoVerify
- ElfHeader
- FixedCapacity
- HmacSha256
- ParseValidate
- ProofPatterns
- PureCore
- scripts/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
577 | 580 | | |
578 | 581 | | |
579 | 582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 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 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
107 | 160 | | |
108 | 161 | | |
109 | 162 | | |
| |||
0 commit comments