docs: refine checked-type properties and invariant audit inventory
This commit is contained in:
1 parent
4cda44823d
commit
8df6cacf12
7 files changed
+155
-9
No files matched your search
@@ -64,7 +64,7 @@ Initially unsupported bindings are observations of a borrowed/slice result, or a
|
||||
|
||||
## Report rows and canonical form
|
||||
|
||||
For modules declaring the proposed contracts feature, append a `contracts` object after existing `unsafe`. The proposed checked-type and assumption extensions depend on it, so their full declared dependency closure also triggers this section. Otherwise emit exactly today's report bytes. Its fixed field order is `rows`, `totals`. Feature-declared modules with no truth sites emit an empty rows array and four zero totals. Every new object has the field order specified below; no optional omissions, unknown keys, whitespace or floating-point numbers. Use the existing canonical-record string escaping.
|
||||
For modules declaring the proposed contracts feature, append a `contracts` object after existing `unsafe`. The proposed checked-type and assumption extensions depend on it, so their full declared dependency closure also triggers this section. Otherwise emit exactly today's report bytes. Its fixed field order is `rows`, `totals`, then `types` under the [checked inventory refinement](contract-source-and-module-state.md#declared-claims-in-the-report). Feature-declared modules with no truth sites emit an empty rows array and four zero totals; types is empty when no checked identity occurs. Every new object has the field order specified below or in that refinement; no optional omissions, unknown keys, whitespace or floating-point numbers. Use the existing canonical-record string escaping.
|
||||
|
||||
Rows iterate functions, blocks and instructions in textual module order, one per pre/post or make/modify operation. Old/view/take are not truth rows. Snapshot helper execution remains in the call graph. This gives stable declaration-site counts independent of callers, number of returns or invocations.
|
||||
|
||||
@@ -104,4 +104,4 @@ Five current-language probes at `a4181f2` confirm byte-identical reports after A
|
||||
|
||||
The exact-limit vector is attainable within ordinary structural bounds: a 63-parameter helper has 64 bool constants, a one-field Data struct.make, 30 copies and one ret (H=128, N=65). One post covers 8,191 syntactic returns, binds original parameters and has D=O=0, so C=1,048,576. Replacing one unused binding with result from an original parameter gives D=1 and budget fallback at 1,048,577, without changing truth or acceptance. These are proposed classifier vectors, not an executed new-contract test. Old-identity vectors use a two-position identity old helper plus one binding, O=3; Range field predicates have H=17, N=5.
|
||||
|
||||
The [report component vector](contract-report-vector.json) pins field order and all four statuses, including a two-return post and a modify callback. It has five rows and six covered boundaries, with totals counting five sites. It is a proposed contracts component, formatted for inspection, not output captured from today's CLI. Its conceptual function f has pre sites 0..2, old at 3 and post at 4; left/right return different Data parameters, yielding the cost-16 vector above. Function g's modify row is runtime/update. No module-state declaration is implied.
|
||||
The [report component vector](contract-report-vector.json) pins field order and all four statuses, including a two-return post, a modify callback and a constant Range make. It has six rows and seven covered boundaries, with totals counting six sites. It is a proposed contracts component, formatted for inspection, not output captured from today's CLI. Its conceptual function f has pre sites 0..2, old at 3 and post at 4; left/right return different Data parameters, yielding the cost-16 vector above. Function g's modify row is runtime/update over StateRep with an unsupported classifier predicate. Function h constructs Rep {lo:0,hi:5} in raw and makes its checked value at instruction 3. The inventory lists StateRep first through g's signature, Rep second at h's make, and an unused always-true u64 witness last; ordinary declarations and earlier signatures contain no checked type. Universal within stays runtime/not_established even though h's make is proven. No module-state declaration or source provenance is implied.
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"purpose": "Non-normative current-language baselines for the checked-type candidate; no checked feature is implemented.",
|
||||
"compiler": "4cda448",
|
||||
"header": [
|
||||
"module contract.properties",
|
||||
"air 0",
|
||||
"lang 0.1",
|
||||
"features [arc, arrays, atomics, cancellation, capabilities, channels, effects, error_values, heap, islands, linear_aggregates, linear_buffers, ownership, regions, resources, sync, tasks, unsafe]"
|
||||
],
|
||||
"cases": [
|
||||
{
|
||||
"case": "region_identity", "command": "check", "exit": 0, "codes": [],
|
||||
"body": ["fn @w(%value: region) -> region", "effects []", "entry:", " ret %value"]
|
||||
},
|
||||
{
|
||||
"case": "sender_identity", "command": "check", "exit": 0, "codes": [],
|
||||
"body": ["fn @w(%value: sender<u64>) -> sender<u64>", "effects []", "entry:", " ret %value"]
|
||||
},
|
||||
{
|
||||
"case": "wrapped_channel_endpoint", "command": "check", "exit": 1, "codes": ["E0006"],
|
||||
"body": [
|
||||
"type @Box = struct { endpoint: sender<u64> }",
|
||||
"fn @f(%heap: cap<mem.alloc>) -> void", "effects [mem.alloc]", "entry:",
|
||||
" %n = const.usize 1",
|
||||
" channel.make @Box, %n, %heap, ok -> @made, err -> @oom",
|
||||
"made(%tx: sender<@Box>, %rx: receiver<@Box>):", " trap",
|
||||
"oom(%e: alloc_error):", " trap"
|
||||
]
|
||||
},
|
||||
{
|
||||
"case": "wrapped_mutex_endpoint", "command": "check", "exit": 1, "codes": ["E0006"],
|
||||
"body": [
|
||||
"type @Box = struct { endpoint: sender<u64> }",
|
||||
"fn @f(%value: @Box) -> void", "effects []", "entry:", " %m = mutex.make %value", " trap"
|
||||
]
|
||||
},
|
||||
{
|
||||
"case": "copy_cap_zero", "command": "check", "exit": 1, "codes": ["E1001"],
|
||||
"body": ["fn @f() -> void", "effects []", "entry:", " %cell = local.alloc cap<mem.alloc>", " local.zero %cell", " ret"]
|
||||
},
|
||||
{
|
||||
"case": "nominal_atomic", "command": "check", "exit": 1, "codes": ["E1001", "E1001"],
|
||||
"body": ["type @Box = struct { value: u64 }", "fn @w(%value: atomic<@Box>) -> atomic<@Box>", "effects []", "entry:", " ret %value"]
|
||||
},
|
||||
{
|
||||
"case": "checked_identity", "command": "check", "exit": 1, "codes": ["E0004"],
|
||||
"body": [
|
||||
"fn @w(%value: checked<u64,@always>) -> checked<u64,@always>", "effects []", "entry:", " ret %value",
|
||||
"fn @always(%value: ref<u64>) -> bool", "effects []", "entry:", " %yes = const.bool true", " ret %yes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"case": "range_predicate", "command": "run", "fuel": 10000, "exit": 0, "status": "returned", "value": true,
|
||||
"body": [
|
||||
"type @Rep = struct { lo: u64, hi: u64 }",
|
||||
"fn @within(%r: ref<@Rep>) -> bool", "effects []", "entry:",
|
||||
" %lo = borrow.field @Rep.lo, %r", " %hi = borrow.field @Rep.hi, %r",
|
||||
" %a = load %lo", " %b = load %hi", " borrow.end %lo", " borrow.end %hi",
|
||||
" %ok = le.u64 %a, %b", " ret %ok",
|
||||
"fn @main() -> bool", "effects []", "entry:",
|
||||
" %a = const.u64 0", " %b = const.u64 5", " %v = struct.make @Rep(%a, %b)",
|
||||
" %cell = local.alloc @Rep", " local.store %cell, %v", " %r = borrow.ref %cell",
|
||||
" %ok = call @within(%r)", " borrow.end %r", " ret %ok"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -43,7 +43,33 @@
|
||||
"proof": {"result":"none","reason":"update","cost":null,"limit":1048576},
|
||||
"enforcement": "runtime",
|
||||
"boundaries": [{"function":"g","block":"entry","inst":2,"source":null}]
|
||||
},
|
||||
{
|
||||
"site": {"function":"h","block":"entry","inst":3,"source":null},
|
||||
"kind": "make", "scope": "value", "predicate": "within", "callback": null,
|
||||
"bindings": [{"kind":"representation","name":"raw","view":"ref"}],
|
||||
"status": "PROVEN_STATICALLY",
|
||||
"proof": {"result":"proven","reason":"closed_scalar","cost":28,"limit":1048576},
|
||||
"enforcement": "runtime",
|
||||
"boundaries": [{"function":"h","block":"entry","inst":3,"source":null}]
|
||||
}
|
||||
],
|
||||
"totals": {"PROVEN_STATICALLY":1,"CHECKED_AT_RUNTIME":2,"ASSUMED_UNSAFE":1,"UNPROVEN":1}
|
||||
"totals": {"PROVEN_STATICALLY":2,"CHECKED_AT_RUNTIME":2,"ASSUMED_UNSAFE":1,"UNPROVEN":1},
|
||||
"types": [
|
||||
{
|
||||
"type": "checked<@StateRep, @valid_state>", "predicate": "valid_state", "status": "CHECKED_AT_RUNTIME",
|
||||
"proof": {"result":"none","reason":"unsupported_predicate","cost":null,"limit":1048576},
|
||||
"enforcement": "construction_update", "declarations": []
|
||||
},
|
||||
{
|
||||
"type": "checked<@Rep, @within>", "predicate": "within", "status": "CHECKED_AT_RUNTIME",
|
||||
"proof": {"result":"none","reason":"not_established","cost":23,"limit":1048576},
|
||||
"enforcement": "construction_update", "declarations": []
|
||||
},
|
||||
{
|
||||
"type": "checked<u64, @always>", "predicate": "always", "status": "PROVEN_STATICALLY",
|
||||
"proof": {"result":"proven","reason":"closed_scalar","cost":5,"limit":1048576},
|
||||
"enforcement": "construction_update", "declarations": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
# Contract source elaboration and rooted module-state candidate
|
||||
|
||||
Non-normative continuation of [RFC 0039](../rfcs/0039-verifier-visible-contracts.md), [checked representations](contract-invariant-boundaries.md) and [proof/report rules](contract-proof-and-report.md), at `8260d35`. This proposal adds no implemented syntax, feature or normative rule. It preserves full P6-6, including type/module claims and all four statuses. Hidden globals, visibility, property/ABI auditing, diagnostics/dispatch integration, adoption and vertical delivery are not established here.
|
||||
Non-normative continuation of [RFC 0039](../rfcs/0039-verifier-visible-contracts.md), [checked representations](contract-invariant-boundaries.md) and [proof/report rules](contract-proof-and-report.md), initially at `8260d35`, with the property/inventory refinement verified against `4cda448`. This proposal adds no implemented syntax, feature or normative rule. It preserves full P6-6, including type/module claims and all four statuses. Hidden globals, visibility, diagnostics/dispatch integration, adoption and vertical delivery are not established here.
|
||||
|
||||
## Module invariant and identity
|
||||
|
||||
@@ -23,7 +23,7 @@ Two invariant names with the same resolved R and p denote the same type. Distinc
|
||||
|
||||
Resolve these bindings before equality, property tests and specialization-key construction. The canonical type key spells `checked<canonical-R,fn canonical-function-identity>`; an alias spelling does not create a different container specialization. Existing type/function keys are unchanged. Imports retain direct-import lookup; no module name is inferred from AIR mangling. Alias-resolution cycles fail with a stable E7006 reason; expansion depth, specialization count and key bytes use the existing 64/4096/16384 compiler bounds. Nominal representation references stop alias expansion; ordinary recursive-layout validation remains independent.
|
||||
|
||||
Every concrete declaration must reach AIR type verification even when no value is constructed. Candidate lowering emits a generated identity witness `fn @w(%value: checked<R,@p>) -> checked<R,@p> effects [] { ret %value }`. It is never implicitly invoked, holds no global state and validates the type/predicate through its signature. Linear values transfer on its ordinary ret. Its declaration appears in canonical AIR and the report's ordinary functions list, with no calls or check rows. Generic witnesses are emitted for concrete specializations; known template restrictions still check before substitution. This needs a complete representation/type-position audit: the witness must not invent an invalid parameter/return position for a type otherwise admitted by the final checked feature.
|
||||
Every concrete declaration must reach AIR type verification even when no value is constructed. Candidate lowering emits a generated identity witness `fn @w(%value: checked<R,@p>) -> checked<R,@p> effects [] { ret %value }`. It is never implicitly invoked, holds no global state and validates the type/predicate through its signature. Linear values transfer on its ordinary ret. Its declaration appears in canonical AIR and the report's ordinary functions list, with no calls or check rows. Generic witnesses are emitted for concrete specializations; known template restrictions still check before substitution. The representation/type-position rules below require parameter/return admissibility, so this witness does not impose an additional position restriction on an otherwise valid checked type.
|
||||
|
||||
## Source grammar and explicit operations
|
||||
|
||||
@@ -75,11 +75,58 @@ Post helpers receive the snapshot record and result only when needed, alongside
|
||||
|
||||
Generated helper/witness/snapshot names use collision-free deterministic keys containing the defining function/declaration identity, concrete specialization and clause/old ordinal. Original/generated names are reserved before choosing the smallest free suffix, and the emitted generated declarations are sorted by their keys. Existing contract-free specialization ordering/bytes stay unchanged. Exact mangling tags/serializer placement still need integration with spec 15 §15.
|
||||
|
||||
## Representation, properties and positions
|
||||
|
||||
Candidate R validity requires ordinary well-formedness, a complete value, and admissibility as a function parameter and return. Borrow/storage/function-bound content is forbidden along the same content edges as aggregate-member checking, including inside owners, buffers and nested checked types. This combines the shallow `types.complete` test with recursive member validity; `complete` alone is insufficient. Void/never, local, ref/mut/slices, task/scope/shield and guard cannot be wrapped to bypass their ordinary position or transfer rules. An iref is an opaque content leaf; its referent still needs ordinary type validity. Ownership cycles through R retain E1003 and existing stage order. R is not restricted to Copy or Data: borrowed linear-state updates are a required use case.
|
||||
|
||||
The checked feature itself need not depend on linear_aggregates solely because R is a linear complete value. R's own features remain required, and placing a linear checked value in a field/payload/array or individual own content retains the ordinary linear_aggregates gate. This is a proposed dependency choice, not an allocated feature. All checks repeat after generic substitution; a template is rejected early only for a restriction invalid under every substitution.
|
||||
|
||||
| Property/query on checked<R,p> | Candidate rule |
|
||||
|---|---|
|
||||
| Copy / linear | exactly R's Copy / linear classification |
|
||||
| Send / Share / Local | exactly R's corresponding structural property |
|
||||
| IslandSafe / ArcSafe / Freeze | exactly R's corresponding property; the latter two still equal IslandSafe in format 0 |
|
||||
| Data | exactly when R is Data; predicate identity is not a value/member |
|
||||
| Zeroable | false, including constant-true predicates and zeroable R |
|
||||
| Accounted size | size(R), with no predicate-handle charge |
|
||||
| Forbidden content / endpoints / capability kinds | traverse R using each existing query's own edge rules |
|
||||
| Type height / bounded syntax | one checked constructor edge followed by R; predicate identity contributes no edge |
|
||||
| Ownership/layout cycle traversal | enter R; an iref edge remains non-owning |
|
||||
|
||||
Zeroability cannot depend on evaluating p at compile time: zero/local.zero/region zero-fill cannot manufacture a checked claim. Accounted size is not ABI layout. Anonymous checked edges preserve Q-058's nominal-edge size depth, while the separate type-height query counts the constructor. Size/property scans must stay total before type validation, including invalid cycles; use the accounting candidate's fixed-point linearity rather than module-free `Type.isLinear` for representation-dependent answers.
|
||||
|
||||
Keep `Type.inner()`'s storage/borrow/element meaning unchanged. Introduce a dedicated representation accessor and explicit checked cases in equality, canonical type keys, property caches/dependency edges, feature/position checks, finite-layout validation, size, source forbidden witnesses, capability inventory and runtime value traversal. A query that currently has an `else` default needs the same audit as an exhaustive switch. Do not make an ordinary borrow or integer operation accept checked content through a generic inner accessor.
|
||||
|
||||
| Position/operation | Candidate restriction |
|
||||
|---|---|
|
||||
| SSA, parameter, return, block parameter | complete checked value; ordinary linear consumption/edge rules |
|
||||
| Struct/enum/fixed array, individual own | existing linear-member/content feature gate; no new partial moves |
|
||||
| Frame local, region content, repeated own_array content | Copy checked values only; zero initialization remains forbidden |
|
||||
| Buffer | existing complete-member rules and explicit drain obligations |
|
||||
| Channel element / mutex content | Send and existing recursive endpoint/forbidden-content checks through R; channel_transfer is not bypassed |
|
||||
| Island/frozen/arc content | existing graph-content property, inherited from R |
|
||||
| Borrow/slice of checked | ordinary ancestry/alias/loan rules; shared representation access only through checked.view |
|
||||
| Task argument/result | existing Send/Share and transfer rules |
|
||||
| Main parameter | checked is not a capability and cannot receive a grant |
|
||||
| AtomicScalar, arithmetic/casts, field/tag projection | checked remains a distinct type; extract/view R explicitly, then apply ordinary rules |
|
||||
|
||||
A whole checked Copy value may be loaded/stored; a linear one uses complete exchange/transfer. Ordinary struct literals, struct.get/unpack, enum.take and borrow.field cannot expose the capsule's R directly. `checked.take` relinquishes only this outer claim, preserving nested checked claims. These restrictions apply in AIR as well as source. Pure/stable closures may view checked roots and take Copy Data content; make/modify remain excluded, and the initial proof normal form still excludes checked extraction.
|
||||
|
||||
No ABI layout or foreign transparency is granted by size(R). Current FFI declarations are illustrative/unsupported; this refinement claims no FFI implementation. A future FFI feature must prevent foreign construction/writes from publishing checked values without validation. An ordinary foreign adapter should transport R and validate through make on re-entry; any unsafe promise needs its own explicit obligation and compatibility rules. Casts or serialization cannot confer checked identity.
|
||||
|
||||
Propose that canonical run-result rendering recursively renders R, without a checked tag, predicate identity or re-evaluation. Nested struct fields, enum payloads and arrays follow their existing order; opaque values retain their existing rendering. This is output serialization, not an Aji value conversion or validation bypass. Copies/transfers/GC visit the representation exactly as needed for its ordinary values and resource identities; predicate identity remains compile-time metadata with no allocation, refcount or destructor.
|
||||
|
||||
## Declared claims in the report
|
||||
|
||||
Make/modify rows alone omit a library invariant whose type has no construction site. Propose an additional contracts field `types` after rows/totals: distinct checked identities in first structural occurrence order across declarations, signatures, blocks and typed instruction operands. Traverse wrappers/member graphs once with visited identities; do not expand occurrences exponentially or parse a module name out of a generated symbol. The identity witness ensures concrete unused source declarations are represented. Its ordinary return is not an extra invariant-check row.
|
||||
Make/modify rows alone omit a library invariant whose type has no construction site. Append `types` after `rows,totals` in the proposed contracts object; emit an empty array when no checked identity occurs. Contract-free report bytes remain unchanged. Enumerate distinct checked identities in first structural occurrence order: type declarations and members/payloads, then functions in textual order (parameters, return, each block's parameters and instruction type operands). Each walk is preorder, visiting checked identity before R, and follows ordinary type-parameter edges even for phantom iref targets. Visit each nominal declaration once globally and each checked identity once for inventory output; predicate identity is not a traversal edge. Ordinary resolved graph references are required, not string parsing or expansion of shared paths. This is an inventory walk, not the ownership-cycle query. The identity witness ensures concrete unused source declarations are represented. Its ordinary return is not an extra invariant-check row.
|
||||
|
||||
For each identity record the canonical checked type, predicate, status, proof, enforcement and supplied declaration provenance. Proposal: classify p universally over one shared R observation, using the same closed normal form as a pre (B=1, n=1, D=O=0). Predicate truth is not inferred from a successful make. Proven yields PROVEN_STATICALLY, otherwise CHECKED_AT_RUNTIME with runtime enforcement by construction/update; type invariants have no assumed/documented mode. Instance sites retain their own classifications, so a universally unproved Range predicate can coexist with a proven constant make. Type records do not contribute to row totals and have no separate status totals initially. Concrete universal-root term identity, canonical inventory schema/provenance order and property/ABI rules remain integration gates; this is not today's report output.
|
||||
Type-record field order is `type,predicate,status,proof,enforcement,declarations`. Type spells `checked<R, @p>` with one space after the comma and ordinary recursive AIR spelling for R; predicate is the resolved function name without @. Proof uses the existing `result,reason,cost,limit` object. Enforcement is always `construction_update`: ordinary copies/transfers do not rerun p. Type invariants have no assume/document mode. Records contribute neither rows nor row totals, and have no separate totals.
|
||||
|
||||
Classify p over one universally unconstrained shared R observation (B=1, n=1, D=O=0). The universal root term is keyed by resolved checked identity and root parameter ordinal 0; ordinary field paths append resolved nominal declaration/field ordinals. It represents all raw R values, not only those already satisfying p or seen at make sites. Scalar/Data loads retain the existing eligibility rules, including alongside linear fields. A literal-true ref<R> predicate has H=3,N=1,C=5 and is proven. The Range predicate in the baseline vectors has H=17,N=5,C=23; distinct lo/hi terms leave it not_established. A constant {0,5} make can independently be proven at C=28. Unsupported helpers/bindings and budgets use the same closed fallback order. Proof never eliminates runtime evaluation or promises termination.
|
||||
|
||||
Declarations contain supplied source provenance only: ordered objects `name,witness,source`, where name is the canonical source declaration/specialization name, witness is the AIR function name without @, and source is the existing `{file,line,col}` or null. A frontend may supply these records only for its concrete identity witnesses. Before attaching one, require a verified witness with exactly one parameter of this checked type, the same return type, effects [], no trusted/prefix metadata, and one block containing only ret of that parameter. Omit mismatched records; never infer names/modules from mangled symbols. Order by witness function order, then supplied declaration order, deduplicating identical records. AIR-only input has declarations []; missing maps do not suppress a checked identity or alter proof/status. These names/positions make no independent semantic claim. Clearing declarations and other source fields must recover identical semantic reports for identical verified AIR.
|
||||
|
||||
The [report vector](contract-report-vector.json) now includes a constant Range make and three inventory identities, one with no construction site. The unused identity still has its universal proof; the modify identity uses an unsupported predicate and remains runtime. This component is proposed research data, not today's CLI output.
|
||||
|
||||
Valid target: a module exports State holding two correlated counters; unrelated imported code can share it, exchange it, or update it through a callback, and the persistent relation survives every successful update. An in-place update of a borrowed linear buffer representation needs no replacement allocation. Rejected targets: public field writes into State; callback returning a borrow from R; overlapping update arguments; predicate with mutable atomic observations; zero construction; an invariant declaration with wrong predicate signature even when unused. A boundary relation over separate mutable roots remains valid only at its explicit pre/post boundaries.
|
||||
|
||||
@@ -87,7 +134,7 @@ Valid target: a module exports State holding two correlated counters; unrelated
|
||||
|
||||
No new AIR header/type-declaration kind is used. Identity witnesses use ordinary function declarations; checked type operands and operations retain the unknown-constructor/opcode E0004 path, subject to Q-055's dependent-error audit. The evidence below pins complete current spellings without claiming full format-0 compatibility. Source item/header, reserved expression and reserved type positions have the separately recorded E7001/E7002 transitions; existing ordinary identifiers/namespaces are preserved. Wrong static selections/argument types and invalid type positions follow existing E7002/E7005 rules; new source-context conflicts need stable E7006 reasons, not message parsing.
|
||||
|
||||
Costs: one narrow named declaration, clause groups, contextual result/old, four explicit checked operations, capture/snapshot elaboration, identity witnesses and type-level audit records. No module-global instance, hidden checking constructor, general alias system, new runtime function values or boundary-group verifier state is introduced. Compare this against inline checked types and nominal checked-struct syntax before adoption. Measure final Quick Reference/source/AIR growth; this research is outside the bundles. Remaining gates include exact alias/property/ABI/mangling/schema rules, source/semantic diagnostic order, traps and pending dispatch, RFC 0040, owner model selection and full source/AIR/package/generic/GC/schedule validation.
|
||||
Costs: one narrow named declaration, clause groups, contextual result/old, four explicit checked operations, capture/snapshot elaboration, identity witnesses and type-level audit records. No module-global instance, hidden checking constructor, general alias system, new runtime function values or boundary-group verifier state is introduced. Compare this against inline checked types and nominal checked-struct syntax before adoption. Measure final Quick Reference/source/AIR growth; this research is outside the bundles. Remaining gates include exact mangling/source-map integration, source/semantic diagnostic order, traps and pending dispatch, RFC 0040, Q-055 compatibility, owner model selection and full source/AIR/package/generic/GC/schedule validation. Property/position/rendering and inventory rules above are candidate resolutions, not an accepted feature or completed implementation.
|
||||
|
||||
## Verified source compatibility constraints
|
||||
|
||||
@@ -110,3 +157,5 @@ Nineteen current-language probes at `8260d35` contain no implemented contracts.
|
||||
| Same 65 values packed into 64/1 leaf records and a two-field root | accepts; returns last value 64 |
|
||||
|
||||
The reserved-prefix choice is justified by inability to bind its first component, not by assuming every type position is a syntax rejection. The proposed type form changes an E7002 rejection to acceptance; the expression/item/header forms change E7001 rejections. Existing module checked and generic checked types must keep their meaning. Witness acceptance on ordinary R does not prove all checked type/property positions valid. Claude independently read the recorded results and reviewed name/capture/snapshot rules; no language feature or owner policy is adopted.
|
||||
|
||||
At `4cda448`, all twelve previously recorded property probes retain their exit status/code lists: scalar, linear-record, capability, atomic, mutex and buffer identity accept; guard/task/shield transfers reject E0006, borrowed member and linear own_array content reject E1001, and graph resource content rejects E2111. Eight additional [reproducible property vectors](contract-property-vectors.json) verify region/endpoint identity, recursive endpoint gates in channel/mutex, nonzeroable Copy capability, rejected nominal AtomicScalar, E0004 for a complete checked witness, and the ordinary Range predicate returning true with fuel 10,000. Concatenate header/body lines, then run the listed command (run uses the listed fuel). They validate current-language constraints, not the proposed checked feature, universal proofs or inventory output. The property rules incorporate Claude's earlier read-only audit; this refinement has not received a fresh Claude review because the live Herdr channel is unavailable.
|
||||
@@ -409,6 +409,8 @@ P6-6 requires contracts and their four audit statuses, but spec 13 §1/spec 08
|
||||
|
||||
[Module/source research](contract-source-and-module-state.md) proposes a narrow checked-state binding with a generated type-validation witness, explicit reserved-prefix operations, clause capture/snapshot rules and type-level audit inventory. Nineteen complete current-language baselines confirm existing checked namespaces/types and ordinary contract-word identifiers, static function selection, keyword binding rejection, identity-witness behavior and bounded snapshot-record packing. Claude independently reviewed the recorded evidence; checks concern compatibility constraints, not implemented invariants. Rooted module state versus hidden state remains an owner choice; property/ABI, schema, source lowering and diagnostic/dispatch gates remain open.
|
||||
|
||||
The [property/inventory refinement](contract-source-and-module-state.md#representation-properties-and-positions) provides candidate inherited-property, complete-position, zeroability, recursive transfer-gate and ABI/rendering rules. Its exact inventory separates universal raw-representation proof from site proof and source provenance. Twelve prior probes match `4cda448`; eight additional reproducible current-language vectors constrain identity/content rules and predicate shape. The updated report component's totals, ordering and proof costs are independently checked. These refine the Draft, not the normative language. Source-map/mangling, diagnostic/dispatch, Q-055 compatibility, owner model selection and vertical delivery remain open; no contract implementation is claimed.
|
||||
|
||||
## Q-055 — Feature-gated AIR headers and frozen rejection codes
|
||||
|
||||
Spec 07 §8.7 permits changes to earlier E0004/E0006 rejections, not E0001. Source inspection of the parser before commit `0086549` shows that an unfeatured `trusted "..."` header was parsed as a block label and failed while expecting `:`; current spec 13 §6.3 and the parser require E0006 `feature_not_declared`. RFC 0009 calls the header additive, although this diagnostic transition is outside the literal exception. The historical parser has not been executed in this audit.
|
||||
|
||||
@@ -358,3 +358,5 @@ The [proof/report refinement](../design/contract-proof-and-report.md) closes the
|
||||
The [module/source candidate](../design/contract-source-and-module-state.md) develops persistent caller-owned module state without globals or visibility, separate boundary-only relations, narrow checked-type bindings, explicit operations and clause elaboration. Claude's review identified namespace hijacking and old/capture ambiguities; the reserved type.checked prefix preserves accepted checked modules/types, and eager old/document matching is explicit. Nineteen current-language baselines verify names/static applications, namespace collisions and reserved bindings, complete source rejections, Copy/linear/checked witness shapes and flat/tree record packing (runs use fuel 10,000). These constrain the proposal and do not implement contracts. Rooted-state owner selection, checked properties/ABI/positions, mangling/inventory schema, source/diagnostic/dispatch integration and vertical validation remain gates; RFC 0039 stays Draft and full P6-6 remains doing.
|
||||
|
||||
The property/type-position audit exposed a pre-existing accounted-size defect ([Q-058](../design/open-questions.md#q-058--finite-anonymous-types-truncated-by-the-size-cycle-guard)): anonymous array/atomic/mutex edges incorrectly consumed a nominal-cycle depth budget. Corrected finite type sizes now enforce existing value/frame and allocation quotas. AIR/source boundary and rejection fixtures, a named-record heap quota pair and cached/uncached/cyclic unit checks cover the fix; a separate unverified native-recursion concern is recorded as Q-059. This correction adds no contract syntax, feature or adoption decision; checked properties and the remaining full P6-6 gates stay open.
|
||||
|
||||
The [property/inventory refinement](../design/contract-source-and-module-state.md#representation-properties-and-positions) specifies candidate complete representation/position checks, inherited properties, recursive endpoint gates, dedicated representation traversal, forbidden zero manufacture, size versus ABI and representation-only result rendering. The inventory's universal raw-R proof is distinct from construction-site proofs and supplied declaration provenance. Twelve prior property baselines match `4cda448`; eight new reproducible vectors verify ordinary identity/content restrictions and the Range predicate. The report research component includes six sites, seven boundaries and three checked identities with distinct type/site proofs. These are current-language/design checks, not implemented contracts. Claude's earlier property audit is incorporated; the live Herdr channel is unavailable for fresh review. Mangling/source-map, diagnostics/dispatch, compatibility and owner model selection remain gates; RFC 0039 stays Draft and full P6-6 remains doing.
|
||||
@@ -153,7 +153,7 @@ The [invariant-boundary research](../design/contract-invariant-boundaries.md) de
|
||||
|
||||
Module invariants need a definition of their roots and observation boundaries. Source 0.1 has no module-state declarations or visibility modifiers; neither nonexistent globals nor arbitrary private-state semantics may be inferred from spec 13's example. Loop invariants, if included by P6-6, need an explicit initiation/preservation/exit rule. Implementing function contracts alone leaves these requirements and P6-6 open.
|
||||
|
||||
The candidate distinguishes a persistent checked state root owning correlated values from a boundary relation over separately owned roots and an explicit function set. Their audit scopes and coverage claims must differ. The [module/source refinement](../design/contract-source-and-module-state.md) proposes a narrow named binding for caller-owned checked state, collision-safe type.checked syntax, independent type-level audit claims and eager snapshot/capture rules. It adds no boundary-group or hidden-global abstraction. Rooted state as the module-invariant model remains an owner decision; property/ABI/type-position and report integration remain open. Ordinary pre/post reuse alone must not silently redefine module invariants.
|
||||
The candidate distinguishes a persistent checked state root owning correlated values from a boundary relation over separately owned roots and an explicit function set. Their audit scopes and coverage claims must differ. The [module/source refinement](../design/contract-source-and-module-state.md) proposes a narrow named binding for caller-owned checked state, collision-safe type.checked syntax, independent type-level audit claims and eager snapshot/capture rules. Its property/position refinement preserves representation properties and recursive transfer gates, prohibits zero manufacture, keeps accounted size separate from ABI and proposes representation-only JSON rendering. The exact type inventory classifies predicates over raw universal representations, separately from make sites and source provenance. Twenty current-language property baselines constrain these rules; no checked feature, type proof or inventory is implemented. It adds no boundary-group or hidden-global abstraction. Rooted state as the module-invariant model remains an owner decision; source-map/mangling, diagnostics/dispatch and vertical integration remain open. Ordinary pre/post reuse alone must not silently redefine module invariants.
|
||||
|
||||
Remaining decisions: shared observation coverage (Q-057) and invariant-evaluation interactions; source clause elaboration and complete AIR binding grammar; purity/snapshot diagnostics and ordering; proof and assumption modes; invariant boundaries and metadata representation; traps/report schema and tested pending-return dispatch. The RFC stays Draft until these have concrete rules and counterexamples.
|
||||
|
||||
|
||||
Reference in new issue
Block a user