rfc: specify closed contract proof and report rules
This commit is contained in:
1 parent
a4181f2d8d
commit
8260d3521e
8 files changed
+185
-4
No files matched your search
@@ -85,7 +85,7 @@ Decision rules are closed: compare typed constants with their declared signednes
|
||||
|
||||
Examples: a Data identity function whose every return is x can prove `result == old(x)` when old merely captures x. A second return of y prevents that classification. A constant Range representation or `{lo:x, hi:x}` can prove lo <= hi through shared field inspection. A pre over unrelated lo/hi remains runtime. `x + 0 == x`, hashing and mutation-based restoration remain runtime even when mathematically true.
|
||||
|
||||
Classification also needs an exact work bound. Candidate logical cost per record is helper operand-position work, relevant old-helper work only when used, reachable result/representation-origin DAG work, and boundary_count times the helper's normalized node count. Pre has one boundary and no body-origin work; adding unrelated body instructions cannot make a pre proof exceed its budget. Post/make inspect only their required origin DAG, charging each reachable definition once per record, including shared definitions across return sites. An instruction contributes one plus its operand positions; a normalized instruction produces at most one node. The proposed bound is 1,048,576 per record. Exceeding it, arithmetic overflow or an unsupported form yields proof none with a structured reason, without rejecting or weakening mandatory runtime enforcement. Cache helpers/origin DAGs, but count this logical cost independently of cache hits. Exact operand/node conventions and conformance vectors remain an integration gate; do not claim toolchain-independent PROVEN output until that rule is fully specified.
|
||||
The [proof/report candidate](contract-proof-and-report.md) refines the work bound with exact opcode/node charges, binding-substitution positions, checked u64 counters and ordered fallback reasons. Pre has one boundary and no body-origin work; adding unrelated body instructions cannot make a pre proof exceed its budget. Post/make charge each required origin definition once per record, including shared definitions across return sites. The proposed bound is 1,048,576 per record. Excess, overflow or unsupported forms yield proof none without rejecting or weakening runtime enforcement; logical costs are independent of cache hits. The concrete candidate and its vectors await adoption and implementation rather than an implementation-dependent prover choice.
|
||||
|
||||
## Diagnostics and report
|
||||
|
||||
@@ -97,4 +97,4 @@ At ret, virtual clause checks run before ownership return transfer and leak chec
|
||||
|
||||
Emit the proposed additive `contracts` section only for modules declaring the relevant feature; contract-free canonical report bytes stay unchanged. Each row identifies function/block/instruction, helper, kind, scope (`boundary` or persistent `value`), status, proof and enforcement, plus covered return sites and positions. A pre row belongs to the callee declaration, not a selected caller. A type guarantee and a relation over listed functions require distinct scopes. Include per-status site totals; totals are not sums over executions or returned branches. Snapshot metadata is not itself a truth obligation. Rejected modules still produce diagnostics and no audit document.
|
||||
|
||||
Required tests include max/sum activation cases, invalid descriptors before SSA, argument/work limits, all four modes, mixed executable/documented snapshot use, unsafe/trap/fuel behavior, multi-return and trap-only coverage, proof-budget fallback, old/current mutation counterexamples, callback/GC pending values, exact rejection ordering and identical contract-free report bytes. Predicate/trap rows must survive generic/package/source mapping. Owner adoption, exact proof-cost/schema grammar, module-claim selection, RFC 0040 observations and full vertical implementation remain gates. This file changes no normative bundle.
|
||||
Required tests include max/sum activation cases, invalid descriptors before SSA, argument/work limits, all four modes, mixed executable/documented snapshot use, unsafe/trap/fuel behavior, multi-return and trap-only coverage, proof-budget fallback, old/current mutation counterexamples, callback/GC pending values, exact rejection ordering and identical contract-free report bytes. Predicate/trap rows must survive generic/package/source mapping. The linked research supplies a concrete function/value report grammar and classifier; module-claim representation, owner adoption, RFC 0040 observations, diagnostic collection and full vertical implementation remain gates. This file changes no normative bundle.
|
||||
Reference in new issue
Block a user