rfc: define predicate purity and shared observation gate

This commit is contained in:
dev committed 2026-10-09 08:28:31 +03:00
1 parent 8cd933538b
commit a5f84eb170
3 files changed
+50 -7

No files matched your search

+8
View File
@@ -414,3 +414,11 @@ The opcode candidate needs a separate dependent-error audit: at `94414da`, `%old
Spec 15 §4 calls `var x: T = zero` a lowering to `local.zero` for zeroable types, without naming a narrower source set. Spec 07a's `local.zero` includes structs whose fields are zeroable. At `94414da`, source `var range: Range = zero` with two u64 fields rejects E7006 `zero_not_zeroable`; AIR `local.alloc @Range` followed by `local.zero` accepts and runs. `src/frontend/lower.zig` restricts source zeroability to integers, bool and arrays of those types.
Decide whether source intentionally exposes that narrower set (and make spec 15 precise), or whether the missing structural lowering is an implementation gap. This entry changes neither layer. P6-6 invariant coverage must independently include the existing AIR construction path, regardless of the source decision.
## Q-057 — Shared observation of linear variants and nested owner content
Current `match *value` with `value: ref<Outcome>` and `Outcome = enum { ok(own<u64>), err(u64) }` rejects E1001 at the linear load, even when both arms only return bool. Spec 03 §25 forbids observational `enum.switch` on a linear enum; `enum.take` consumes it. There is no borrowed tag/payload projection. Similarly, `*p.payload` through `p: ref<Record>` with a field `payload: own<u64>` rejects E1001; AIR `borrow.ref` on `ref<own<u64>>` keeps that type, and its load cannot copy the owner. A direct `own<u64>` root can expose its contents through existing `borrow.ref`, so distinguish this nested/shared-owner case.
These are specified observation limits, not new verifier bugs. A shared linear struct's Copy field is readable (a count probe returns 7); a read-only contract could likewise need to inspect a linear result's success variant or owned nested data without consuming either. RFC 0039's purity candidate cannot supply missing observation semantics, and the full P6-6 gate remains open.
Decide the required source/AIR observation surface. Candidate directions include a shared-view variant operation yielding borrowed payloads and an explicit shared content view through `ref<own<T>>`; neither is adopted here. Any new primitive requires a registered feature, its full AIR contract, ordinary alias/loan/lifetime enforcement, deterministic behavior, format compatibility and vertical source/Quick Reference/conformance coverage. Do not enable consumption, hidden owner copies or unrestricted partial moves to make predicates expressible.