From aa2b38f7cf8fbb95697d97192184c0e23eb3815e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 02:23:52 +0000 Subject: [PATCH] repo: move the Psi wire encoding out of the spec and beside its codec The Psi wire encoding page described the compiler's file format but lived in `wiki/spec/`, where only the owners may edit. Each codec change left it stale and turned into an owner question. Jarod ruled that the specification is the truth for the language and that compiler detail is separate, so the page now sits beside the codec that implements it and agents keep it current. The page moves unchanged from `wiki/spec/terminal-psi/encoding.md` to `source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`. The tag-table test reads it from the crate directory. Every link and path citation in active code, READMEs, drafts and the archive now points at the new place. Three stale parts of the page are fixed against the codec: - The proposition table gains tag 24, `IsMere`, which the decoder accepts. Without the row `every_marked_tag_table_matches_its_decoder` failed on `main`. - Marker 300 is described: a theorem contract ends with its own proof parameters and a theorem application with the proofs it gives them. The contract, hypothesis and application rows match `theorem_wire` in `module_wire.rs`. - The envelope table names semantic marker 300, not 293. Specification text changes only where it linked to the page. Five pages have their links repointed: `build/optimizations.md` and, under `terminal-psi/`, `product.md`, `calls_and_outcomes.md`, `fact_validity.md` and `dynamic_dispatch.md`. Owner question 4, which asked permission to make the marker 300 edits, is resolved by the move. Its slot now records the one thing the move leaves open: the page also states some reader checks and trust rules that no specification page restates, and they share sentences with the layout, so an agent could not leave them behind without writing new specification text. The entry lists them and recommends leaving them with the codec. `AGENTS.md` and the Psi README now say where the page lives and that a codec change updates it in the same PR. Validation: `mbx test -p terminal-wire --lib spec_tag_tables` passes both tests. `mbx xtask check-rules`, `mbx xtask fmt --check` and `mbx xtask check-boundary` are clean against `origin/main` at badf8d1f. Agent: Claude Code | Model: unavailable | Effort: medium | Tokens: 3.19M in (3.06M cached), 21.5k out | Steps: 22 | Time: 14m22s | Steers: 0 --- AGENTS.md | 6 ++ OWNER_QUESTIONS.md | 78 +++++++---------- _recycling/omega-rust-v2/PLAN.md | 2 +- .../CONTRACT.md | 10 +-- .../src/machines/casts.rs | 2 +- .../src/machines/construction/zero.rs | 2 +- .../tests/ieee_predicates.rs | 2 +- .../psi-consumer/src/domain_completions.rs | 2 +- .../representations/psi/src/blocks.rs | 2 +- .../representations/psi/src/domains.rs | 2 +- .../tools/spec-corpus/l5_refusals.tsv | 4 +- _recycling/omega-rust-v2/wiki/README.md | 4 +- _recycling/tests/product/alpha/README.md | 2 +- .../applied_requirement_indices/README.md | 2 +- .../README.md | 2 +- .../compiler/psi-to-native/README.md | 2 +- .../tests/saved_linux_program.rs | 2 +- source-rust/subsystems/compiler/psi/README.md | 4 +- .../compiler/psi/artifact/codec/README.md | 2 +- .../artifact/codec/src/canonical_artifact.rs | 2 +- .../declaration-encoding/src/terms/table.rs | 2 +- .../compiler/psi/artifact/wire/README.md | 2 +- .../compiler/psi/artifact/wire}/encoding.md | 86 ++++++++++++------- .../artifact/wire/src/identity_formations.rs | 2 +- .../psi/artifact/wire/src/spec_tag_tables.rs | 9 +- .../driver/parse_source_batch/parsed_files.rs | 2 +- .../README.md | 2 +- .../src/declare.rs | 2 +- .../src/lower.rs | 2 +- .../tests/variant_parent_identity.rs | 2 +- .../src/publication/mathematics.rs | 2 +- .../source-to-psi/tests/stage_source.rs | 2 +- .../symbol_resolved_trees.omg | 2 +- .../linux_x86_64.md | 2 +- wiki/README.md | 4 +- .../drafts/designs/deferred_callback_reach.md | 2 +- .../drafts/designs/proof_kernel_core_audit.md | 2 +- wiki/drafts/designs/self_hosting_layers.md | 2 +- .../crosscheck/G06a.md | 2 +- .../terminal_no_normal_invocations.md | 2 +- wiki/spec/build/optimizations.md | 2 +- wiki/spec/terminal-psi/calls_and_outcomes.md | 6 +- wiki/spec/terminal-psi/dynamic_dispatch.md | 2 +- wiki/spec/terminal-psi/fact_validity.md | 2 +- wiki/spec/terminal-psi/product.md | 2 +- 45 files changed, 150 insertions(+), 131 deletions(-) rename {wiki/spec/terminal-psi => source-rust/subsystems/compiler/psi/artifact/wire}/encoding.md (97%) diff --git a/AGENTS.md b/AGENTS.md index b1f3e7ef45f3..4b66bbce8173 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,6 +63,12 @@ a spec sentence inaccurate, don't make the change. Record the sentence, the proposed text and the reason in [OWNER_QUESTIONS.md](OWNER_QUESTIONS.md), and keep building to the current text. +The Psi wire encoding (numeric tags, field layouts and format markers) is the +compiler's file format, not specification. It lives beside the codec in +[encoding.md](source-rust/subsystems/compiler/psi/artifact/wire/encoding.md). +Update it in the same PR as the codec change it describes; its tag tables are +tested against the decoder by `mbx test -p terminal-wire --lib spec_tag_tables`. + ## Bootstrap mandate For bootstrap construction work, [bootstrap/MINIMIZATION.md](bootstrap/MINIMIZATION.md) diff --git a/OWNER_QUESTIONS.md b/OWNER_QUESTIONS.md index ea12e07d05d2..d2e5687696a7 100644 --- a/OWNER_QUESTIONS.md +++ b/OWNER_QUESTIONS.md @@ -159,51 +159,39 @@ hold. Alternatively, remove these sections from the package-review spec and the evidence schema now, and delete the decoders and the vocabulary together. Should package review report these sections? - -### 4. May the encoding spec describe a theorem contract's own proof parameters? - -A logical contract may take a proof parameter in its own header -([logical hypotheses](wiki/spec/proofs/mathematical_bindings.md#logical-hypotheses-and-machine-use): -"If the contract itself takes a proof parameter, that parameter belongs to the -contract's own header. The outer caller supplies one proof of the whole -contract."). The compiler now carries this as Psi format marker 300, so these -sentences of [logical theorem parameters](wiki/spec/terminal-psi/encoding.md#logical-theorem-parameters) -no longer describe the bytes: - -- "| theorem contract | counted scalar formal declarations + counted requires - propositions + counted ensures propositions |" -- "| theorem application | owner machine id + edge id + successor block id + - proof source + counted fixed scalar subjects + counted premise obligation ids |" -- The marker paragraph names 299 as the latest marker. - -Proposed text. Add before the marker 299 paragraph: "Marker 300 ends each -theorem contract with its counted proof parameters, as in -`machine(n: u8)`, and each theorem application with -the counted proofs it gives them, as in `Step::(n)`. Readers reject -earlier markers before reading the payload, so a saved program from marker 299 -or earlier must be rebuilt." Replace the contract row with "| theorem contract -| theorem hypothesis + counted theorem hypotheses |" and "| theorem hypothesis | -counted scalar formal declarations + counted requires propositions + counted -ensures propositions |". End the application row with "+ counted theorem -instantiations". Add after the instantiation paragraph: "A theorem contract's -hypotheses are its own proof parameters, in its header order; each is a -contract with none of its own. Its complete type binds them after its subjects -and before its premises: `Π subjects. Π hypotheses. Π premises. conclusion`. -Each hypothesis's type arrives with the declarations it names, appended after -the subjects', so the same contract always has the same type. A supply for such -a parameter names a machine whose own proof formals have exactly those -contracts, in order, and carries no instantiation; its derivations are -unchanged. An application of such a parameter carries one instantiation for -each hypothesis, checked as a supply's instantiation is against that -hypothesis. Every other application carries none." - -The marker 299 paragraph and the theorem supply and instantiation rows were -added by an agent in #6291, which merged half an hour after the ruling that -only owners edit `wiki/spec/`. Keep or rewrite them as you see fit. - -**Recommend adopting the proposed text.** Psi encoding design is delegated, -and the spec page is the only description a separate reader has of these rows. -Should the encoding spec describe them this way? + +### 4. Should the specification restate the Psi receiving rules that moved with the wire encoding? + +The Psi wire encoding moved out of `wiki/spec/` on Jarod's word that the +compiler's file format is not language specification. It now sits beside the +codec as [encoding.md](source-rust/subsystems/compiler/psi/artifact/wire/encoding.md), +and agents keep it current with the code. The page is mostly tags and field +layouts, but some paragraphs state what a reader must check or what a row +grants, and no page in `wiki/spec/` restates them: + +- [Scalar completion prerequisites](source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#scalar-completion-prerequisites) + and the return-origin paragraphs after the origin table. [Scalar qualifications](wiki/spec/terminal-psi/calls_and_outcomes.md#scalar-qualifications) + summarizes them and links to this page for the rest. +- The prerequisite and completed-result roles under + [retained scalar conditions](source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#retained-scalar-conditions-and-application-scope). +- [Retained access custody](source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#retained-access-custody), + [installation and semantic-code attribution](source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#installation-and-semantic-code-attribution) + and [register event service authority](source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#register-event-service-authority). + +The layout and the rules share sentences, so an agent could not leave the rules +behind without writing new specification text. The same change repointed the +links to this page in five specification pages +(`build/optimizations.md` and `terminal-psi/` `product.md`, +`calls_and_outcomes.md`, `fact_validity.md`, `dynamic_dispatch.md`) and changed +no other specification text. + +**Recommend leaving them where they are.** They say how a reader validates +rows of the compiler's own format, and [changes to Psi](source-rust/subsystems/compiler/psi/README.md#changes-to-psi) +already requires a codec change to keep trust guarantees intact and to bring +an unresolved trust decision here. Alternatively, an owner restates the ones +that should bind every implementation in `wiki/spec/terminal-psi/`, and agents +then cut the copies from the encoding page. +Should the specification own any of these rules? ### 5. Which field type makes a record field mathematical evidence rather than a callable selection? diff --git a/_recycling/omega-rust-v2/PLAN.md b/_recycling/omega-rust-v2/PLAN.md index 8269aa6322bd..c01a6da42ded 100644 --- a/_recycling/omega-rust-v2/PLAN.md +++ b/_recycling/omega-rust-v2/PLAN.md @@ -716,7 +716,7 @@ The first checkpoint used a pair of same-typed owned fields. Moving one field mu **Suspension evidence.** For two incoming byte views, the prepared call’s operand identifies the selected formal and its suspension acknowledgement. Changing that operand from `left` to `right` changes which loan the incomplete callee holds. The continuation reads the other view. The Psi-only reader rejects an exchange of the two descriptor identities even when their types, access modes and row count agree. Before a branch selects between two views, a suspending call retains both possible inputs and the selector needed on completion. After the join, the selected descriptor leads back through the actual arrival. The Psi reader detects swapped branch operands. When an arm supplies a shared view returned by a completed local call, the defining call, its selected machine’s normal return and the ordered actuals trace the view back to its input. Nested calls, terminal forwarding and locally supplied members use those same records. For an elided shared-view boundary result with a single shared-view input and otherwise primitive scalar inputs, the applied requirement identifies its input lifetime anchor. The descriptor retains the boundary completion, not a guessed alias of the actual. Other boundary result frontiers still stop at the crossing. [Returned views](layers/05_prepared-trees-to-terminal-psi/tests/returned_view.rs) · [Prepared calls and nested forwarding](layers/05_prepared-trees-to-terminal-psi/tests/returned_view_inputs.rs) [Branch-join consumer](layers/05_prepared-trees-to-terminal-psi/tests/joined_loans.rs) · [Nested joins and terminal calls](layers/05_prepared-trees-to-terminal-psi/tests/joined_loan_inputs.rs) · [Prepared operand and Psi tests](layers/05_prepared-trees-to-terminal-psi/tests/parked_byte_views.rs) · [Ordinary and terminal calls](layers/05_prepared-trees-to-terminal-psi/tests/suspension.rs) -**Coverage before lock.** These seven groups organize implementation. Before sign-off, reconcile individual source forms and typed obligations against the governing spec and the L5 operation, predicate and terminator variants. Include element views and bounds, access policies and storage custody, finite callable families, proof-only recursion, float meaning and integer goals, external observations, and operation identities used for work accounting. For each rule record its spec section, producing fact, emitted record and accept/reject test. If an earlier stage owns a refusal, record the diagnostic there and test the positive handoff at L5. If a valid construct still reaches an unsupported lowering path, keep its rule open. The encoding inventory helps find omitted semantic records. Artifact serialization, proof verdicts, optimization, installation and native realization have their own owners. [Psi product](../wiki/spec/terminal-psi/product.md) · [Semantic rows](../wiki/spec/terminal-psi/encoding.md) · [Integer goals](../wiki/spec/terminal-psi/integer_certificates.md) · [Observations](../wiki/spec/terminal-psi/observations.md) · [Logical work](../wiki/spec/resources/logical_work.md) +**Coverage before lock.** These seven groups organize implementation. Before sign-off, reconcile individual source forms and typed obligations against the governing spec and the L5 operation, predicate and terminator variants. Include element views and bounds, access policies and storage custody, finite callable families, proof-only recursion, float meaning and integer goals, external observations, and operation identities used for work accounting. For each rule record its spec section, producing fact, emitted record and accept/reject test. If an earlier stage owns a refusal, record the diagnostic there and test the positive handoff at L5. If a valid construct still reaches an unsupported lowering path, keep its rule open. The encoding inventory helps find omitted semantic records. Artifact serialization, proof verdicts, optimization, installation and native realization have their own owners. [Psi product](../wiki/spec/terminal-psi/product.md) · [Semantic rows](../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md) · [Integer goals](../wiki/spec/terminal-psi/integer_certificates.md) · [Observations](../wiki/spec/terminal-psi/observations.md) · [Logical work](../wiki/spec/resources/logical_work.md) **Sign-off run.** For each contested handoff, inspect the product after dropping the prepared trees. Use a source twin to catch a legal but wrong choice, such as selecting a same-typed sibling. Use an independently malformed product or an exact diagnostic to test a refusal at its owning layer. Extend the existing reachable-block and unique-operation invariant over new successor forms. Run the affected producer tests, the complete lowering crate, the published corpus, the dependency check and all-target Clippy through `mbx`. Record the measured L5 suite time and unresolved behavior in the layer table. Jarod signs off after the rule-level review. [Current invariant](layers/05_prepared-trees-to-terminal-psi/tests/support/control_flow.rs) · [Sign-off criteria](#what-solid-means) diff --git a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/CONTRACT.md b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/CONTRACT.md index ab72f35388bb..6c174a24225b 100644 --- a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/CONTRACT.md +++ b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/CONTRACT.md @@ -20,13 +20,13 @@ Reading a scalar field such as `cells[i].value` in an affine fixed array keeps t A return carries the identity of its scalar value or structural source place. Two parameters of the same fixed-array type still have different places. For example, changing the body of `choose(a, b)` from `a` to `b` changes the source place on the return edge. Changing a static width instead changes the corresponding shape in the type table. The consumer can make both observations after the prepared trees and source text are dropped. [Handoff tests](tests/handoff.rs) -`omega source lower ` runs preparation and lowering and reports the first refusal with a source location. The Rust API returns the owned package. Its IDs are scoped to the produced package or machine. Artifact encoding, publication and execution are later consumers. [Source command](../../application/src/source.rs) · [Encoding](../../../wiki/spec/terminal-psi/encoding.md) +`omega source lower ` runs preparation and lowering and reports the first refusal with a source location. The Rust API returns the owned package. Its IDs are scoped to the produced package or machine. Artifact encoding, publication and execution are later consumers. [Source command](../../application/src/source.rs) · [Encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md) A bodyless trait requirement publishes its synchronous entry ceiling. Each `invokes` occurrence names its applied entry, runtime parameter or static binder and retains its source span. Omission gives a bodyless requirement an empty ceiling. A closed machine publishes its own written clauses alongside the entry set typing propagated through its calls. Service reach and pause effects retain their separate meanings. [Entry handoff tests](tests/requirement_interfaces.rs) · [Synchronous entries](../../../wiki/spec/language/effects.md) ## Operations and declarations -A local without an initializer takes its type from L4's `ZeroValue` obligation at the binding. An unqualified primitive receives a typed zero constant. Taking its address establishes one storage home shared by subsequent borrows, assignments and reads. A structural local uses the same zero construction as an omitted field: nested records retain their declared fields, and only the first case of a sum supplies a payload. A zero-initialized scalar-leaf record local retains its existing whole-record establishment and any selected scope cleanup. The establishment operation names its storage at the binding site. Discarding that local at return identifies the same storage. A `requires` clause on the record does not stop the local: the schema keeps the clause, and the checker judges the binding's `ZeroValue` obligation by evaluating that clause with every field zero, so `Nonzero` and `Small` lower alike. When L4 supplies a `ZeroField` obligation for an omitted field, the constructor puts the zero of that field's declared type in its declared slot. Written initializers still execute in source order, and every zero is established after them at the literal's site. A Boolean, fixed-width integer or float field receives a zero constant of its carrier; a float's zero is the all-zero bits of its format. A record or fixed array whose every leaf is a scalar receives one `EstablishZeroedStructural` whose result names the whole type, so its extent never sizes the output: `bytes:[u8;65536]` and a `[Cell;4294967296]` of scalar-leaf records each take one operation. This compact form applies when the complete record has the supported scalar-leaf representation. Any other structural field is built from the operations its own all-omitted literal would use: a record is `EstablishRecord` over the zeros of its fields, a sum is `EstablishCase` of its first declared case over the zeros of that payload, and a fixed array establishes one zero per element. [Operation 94](../../../wiki/spec/terminal-psi/encoding.md#operation-rows) lists records and fixed arrays, not sums, so a sum is never zeroed whole. For example, with `data Slot{case Empty; case Entry(value:u8);}`, an omitted `[Slot;2]` field is one `EstablishStructuralArray` over two separate `EstablishCase` places for `Slot::Empty`, and `Entry` is never established. `..` supplies no borrowed reference and no callable. An omitted field whose type borrows one referent, such as `@u8`, therefore makes the literal invalid, and so does a structural field whose zero would hold one in a record field, an array element or the first case's payload; lowering rejects both at the literal and names the field that needs the borrow. A reference in a case other than the first does not stop the sum's zero. Lowering stops, without calling the program invalid, where it has no operation for the zero: a domain-qualified value, an empty borrowed view or by-value sequence, a linear record, and a record with authored cleanup. No source extent stops a zero. An element-by-element zero counts its operations with checked arithmetic and reserves their storage before emitting any; lowering refuses it only when that count does not fit the host's address space or the host cannot allocate it. [Explicit field omission](../../../wiki/spec/language/data_and_literals.md#explicit-field-omission) [Omitted field handoff](tests/formation_handoff.rs) [Omitted structural fields](tests/omitted_structural_fields.rs) [Zero-value handoff](tests/obligation_outputs.rs) +A local without an initializer takes its type from L4's `ZeroValue` obligation at the binding. An unqualified primitive receives a typed zero constant. Taking its address establishes one storage home shared by subsequent borrows, assignments and reads. A structural local uses the same zero construction as an omitted field: nested records retain their declared fields, and only the first case of a sum supplies a payload. A zero-initialized scalar-leaf record local retains its existing whole-record establishment and any selected scope cleanup. The establishment operation names its storage at the binding site. Discarding that local at return identifies the same storage. A `requires` clause on the record does not stop the local: the schema keeps the clause, and the checker judges the binding's `ZeroValue` obligation by evaluating that clause with every field zero, so `Nonzero` and `Small` lower alike. When L4 supplies a `ZeroField` obligation for an omitted field, the constructor puts the zero of that field's declared type in its declared slot. Written initializers still execute in source order, and every zero is established after them at the literal's site. A Boolean, fixed-width integer or float field receives a zero constant of its carrier; a float's zero is the all-zero bits of its format. A record or fixed array whose every leaf is a scalar receives one `EstablishZeroedStructural` whose result names the whole type, so its extent never sizes the output: `bytes:[u8;65536]` and a `[Cell;4294967296]` of scalar-leaf records each take one operation. This compact form applies when the complete record has the supported scalar-leaf representation. Any other structural field is built from the operations its own all-omitted literal would use: a record is `EstablishRecord` over the zeros of its fields, a sum is `EstablishCase` of its first declared case over the zeros of that payload, and a fixed array establishes one zero per element. [Operation 94](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#operation-rows) lists records and fixed arrays, not sums, so a sum is never zeroed whole. For example, with `data Slot{case Empty; case Entry(value:u8);}`, an omitted `[Slot;2]` field is one `EstablishStructuralArray` over two separate `EstablishCase` places for `Slot::Empty`, and `Entry` is never established. `..` supplies no borrowed reference and no callable. An omitted field whose type borrows one referent, such as `@u8`, therefore makes the literal invalid, and so does a structural field whose zero would hold one in a record field, an array element or the first case's payload; lowering rejects both at the literal and names the field that needs the borrow. A reference in a case other than the first does not stop the sum's zero. Lowering stops, without calling the program invalid, where it has no operation for the zero: a domain-qualified value, an empty borrowed view or by-value sequence, a linear record, and a record with authored cleanup. No source extent stops a zero. An element-by-element zero counts its operations with checked arithmetic and reserves their storage before emitting any; lowering refuses it only when that count does not fit the host's address space or the host cannot allocate it. [Explicit field omission](../../../wiki/spec/language/data_and_literals.md#explicit-field-omission) [Omitted field handoff](tests/formation_handoff.rs) [Omitted structural fields](tests/omitted_structural_fields.rs) [Zero-value handoff](tests/obligation_outputs.rs) An executable record or case constructor owes every `requires` clause of its structural result's nominal data schema. At that operation, `self` is the value formed by the selected case (if any) and the complete, declaration-ordered field operands, including any zero supplied for an omitted field. A zero operand does not discharge a clause about that field. The record or case established for an omitted structural field is such a constructor too: it owes its own schema's clauses over its zero operands, so an omitted `holder:Holder` under `data Holder requires self.n<=2 {slot:Slot; n:u64;}` owes that bound with `n` bound to the zero constant. A record zeroed whole by `EstablishZeroedStructural` owes the same clauses, and those of every schema inside it, for the all-zero value. L6 checks the clauses under this substitution; an `EstablishRecord` or `EstablishCase` operation in unchecked Psi is not a validity verdict. This handoff does not establish frozen constants or admit omitted reference fields without backing storage. [Formation inputs and Psi](tests/formation_handoff.rs) · [Record construction](tests/nominal_construction.rs) @@ -38,9 +38,9 @@ Canonical `f32` and `f64` operators lower to one `Float` operation that names th A user-declared operator in a contract predicate selects its ordinary machine. The application retains the nominal operand types, their order, and the premises owed at the call. [Record operator predicates](tests/ieee_predicates.rs) -A predicate that observes borrowed storage includes one `Referent` step per readable reference it crosses. For example, `r.field` on a reference and `($r).field` select the same field, while an inline record has only the field step. The containing clause determines when the observation is made. [Predicate path encoding](../../../wiki/spec/terminal-psi/encoding.md) · [Borrowed and inline subjects](tests/declarations.rs) · [Independent predicate reader](tests/ieee_predicates.rs) +A predicate that observes borrowed storage includes one `Referent` step per readable reference it crosses. For example, `r.field` on a reference and `($r).field` select the same field, while an inline record has only the field step. The containing clause determines when the observation is made. [Predicate path encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md) · [Borrowed and inline subjects](tests/declarations.rs) · [Independent predicate reader](tests/ieee_predicates.rs) -An IEEE comparison in a requirement, guarantee, crash guard or domain predicate is a typed proposition, not an executable operation. It consumes its two terms and names the format and one canonical kind: `Equal`, `NotEqual`, `LessThan` or `LessOrEqual`. `a > b` and `a >= b` read their operands in reverse, so they state the same proposition as `b < a` and `b <= a`; `!=` keeps `NotEqual`, and `!(a < b)` stays a Boolean negation of `LessThan`. A qualified float formal retains its exact domain in the signature. Explicit domain removal presents its unchanged float carrier to the comparison. A term may also be an unqualified float formal, `result`, `self`, a float field of a record subject, a frozen float constant, or the exact bits that preparation landed for a literal or anonymous number. Integer order laws and mathematical or `FloatMeaning` equality do not apply to these propositions. A user-selected operator remains a call, which a contract predicate refuses, and never becomes an IEEE comparison. The checker judges each proposition; lowering keeps a false premise or a broken guarantee exactly as written. [IEEE predicates](tests/ieee_predicates.rs) · [Psi-only reader](tests/psi-consumer/src/ieee_predicates.rs) · [IEEE comparison kinds](../../../wiki/spec/terminal-psi/encoding.md#ieee-comparison-kinds) +An IEEE comparison in a requirement, guarantee, crash guard or domain predicate is a typed proposition, not an executable operation. It consumes its two terms and names the format and one canonical kind: `Equal`, `NotEqual`, `LessThan` or `LessOrEqual`. `a > b` and `a >= b` read their operands in reverse, so they state the same proposition as `b < a` and `b <= a`; `!=` keeps `NotEqual`, and `!(a < b)` stays a Boolean negation of `LessThan`. A qualified float formal retains its exact domain in the signature. Explicit domain removal presents its unchanged float carrier to the comparison. A term may also be an unqualified float formal, `result`, `self`, a float field of a record subject, a frozen float constant, or the exact bits that preparation landed for a literal or anonymous number. Integer order laws and mathematical or `FloatMeaning` equality do not apply to these propositions. A user-selected operator remains a call, which a contract predicate refuses, and never becomes an IEEE comparison. The checker judges each proposition; lowering keeps a false premise or a broken guarantee exactly as written. [IEEE predicates](tests/ieee_predicates.rs) · [Psi-only reader](tests/psi-consumer/src/ieee_predicates.rs) · [IEEE comparison kinds](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#ieee-comparison-kinds) Float arithmetic and negation inside a contract predicate publish in-memory Psi terms with the selected operation, binary format, and nearest-even semantics. The operands occur in source order and no operation is added to the executable body. The shared byte encoding still needs a scalar term for these operations. [Rounded predicate terms](tests/ieee_predicates.rs) @@ -78,7 +78,7 @@ A lowered operator machine retains the checked token, its site, effective visibi An explicit scalar cast that adds local predicate-free tags or erases local route-free scalar domains carries the change on a successor edge. Its argument identifies the source value and its destination is a fresh block parameter of the new qualified type. The edge retains the cast site. When the cast also changes integer width, the exact conversion produces a bare value before the qualification edge. Keeping the same domains forwards the existing value. When a cast both removes and adds memberships, the same jump carries a `Replace` change for its argument and one completion per added atom. The source and destination qualifications identify exactly what was removed, retained and added. A predicate on an added atom still binds the fresh parameter and requires proof from that arrival. Removing another atom supplies no predicate or issuer evidence. A tag addition checks one typed establishment obligation per new atom, including a closed predicate-free family application or the parent and child in an inherited tag set. [Qualification handoff](tests/domain_qualification_handoff.rs) · [Domain cast tests](tests/domains.rs) · [Scalar qualification edges](../../../wiki/spec/terminal-psi/calls_and_outcomes.md#scalar-qualifications) -A predicate-bearing scalar cast that only adds unrestricted memberships uses one jump with a completion for each newly added domain, in destination order. A completion identifies the argument ordinal, the exact domain atom with its closed arguments, and the origin of its membership. A predicate domain gets a proved origin and a destination block invariant binding its complete requirements to the fresh parameter. A predicate-free, route-free tag introduced alongside it gets a vacuous origin. An inherited child requires its exact parent on the same incoming value. The cast can retain that parent or add it on the same arrival under the parent’s own rules. Writing `+P::Child` and spelling out its parent produce the same memberships and obligations. For `Five = Above<5>` the row names `Above` with argument `5`. L6 judges every predicate on every incoming path using the evidence at that arrival. A routed introduction still requires its own issuer evidence. [Predicate casts and inherited memberships](tests/domains.rs) · [Independent Psi reader](tests/psi-consumer/src/domain_completions.rs) · [Scalar return origins](../../../wiki/spec/terminal-psi/encoding.md) +A predicate-bearing scalar cast that only adds unrestricted memberships uses one jump with a completion for each newly added domain, in destination order. A completion identifies the argument ordinal, the exact domain atom with its closed arguments, and the origin of its membership. A predicate domain gets a proved origin and a destination block invariant binding its complete requirements to the fresh parameter. A predicate-free, route-free tag introduced alongside it gets a vacuous origin. An inherited child requires its exact parent on the same incoming value. The cast can retain that parent or add it on the same arrival under the parent’s own rules. Writing `+P::Child` and spelling out its parent produce the same memberships and obligations. For `Five = Above<5>` the row names `Above` with argument `5`. L6 judges every predicate on every incoming path using the evidence at that arrival. A routed introduction still requires its own issuer evidence. [Predicate casts and inherited memberships](tests/domains.rs) · [Independent Psi reader](tests/psi-consumer/src/domain_completions.rs) · [Scalar return origins](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md) A trait requirement carries its own identity, formal parameters, value indices, predicates and effect bounds. A finite list of index tuples preserves the correlations in the authored alternatives. An implementation must still satisfy the other predicates. Mathematical definitions carry their checked terms and the boundary assumptions those terms depend on. [Requirement tests](tests/requirement_interfaces.rs) · [Mathematical declarations](tests/mathematics.rs) diff --git a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/casts.rs b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/casts.rs index 72afa31ebe51..11314c232861 100644 --- a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/casts.rs +++ b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/casts.rs @@ -87,7 +87,7 @@ pub(super) enum ScalarChange { /// Whether it may issue a domain that selects an access policy is decided by /// that policy's executed plan, which lowering does not have: a plan can admit /// no issuer, and then the domain has no establishment route for any machine -/// (`wiki/spec/terminal-psi/encoding.md`, domain rows). The package therefore +/// (`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`, domain rows). The package therefore /// reports each such cast to its driver, and this refuses one it does not report. pub(super) fn scalar_cast<'a>( operation: &'a TypedOperation, diff --git a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/construction/zero.rs b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/construction/zero.rs index ac63dafb782e..b43bd7532ff5 100644 --- a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/construction/zero.rs +++ b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/src/machines/construction/zero.rs @@ -9,7 +9,7 @@ //! record that receives it still owes its predicates over a visible operand. //! - A record or fixed array whose every leaf is a scalar is one //! `EstablishZeroedStructural` of the whole type, whatever its extent -//! (`wiki/spec/terminal-psi/encoding.md`, operation 94). That operation owes +//! (`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`, operation 94). That operation owes //! the predicates of the result's schema and of every schema inside it. //! - Any other record is `EstablishRecord` over the zeros of its fields, a sum //! is `EstablishCase` of its first declared case over the zeros of that diff --git a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/ieee_predicates.rs b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/ieee_predicates.rs index 42554a546129..8ac3662abe09 100644 --- a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/ieee_predicates.rs +++ b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/ieee_predicates.rs @@ -1,7 +1,7 @@ //! IEEE comparisons in contracts and domain predicates are typed propositions, //! not executable operations. //! [Comparisons](../../../../wiki/spec/language/numeric_values.md#meaning-comparisons-and-representation) -//! · [IEEE comparison kinds](../../../../wiki/spec/terminal-psi/encoding.md#ieee-comparison-kinds) +//! · [IEEE comparison kinds](../../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#ieee-comparison-kinds) #[path = "support/source.rs"] mod sources; use omega_lowering::{ diff --git a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/psi-consumer/src/domain_completions.rs b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/psi-consumer/src/domain_completions.rs index cf8c999796bc..b23ee150aa38 100644 --- a/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/psi-consumer/src/domain_completions.rs +++ b/_recycling/omega-rust-v2/layers/05_prepared-trees-to-terminal-psi/tests/psi-consumer/src/domain_completions.rs @@ -1,5 +1,5 @@ //! Read the domains a jump establishes from published Psi alone, applying the -//! completion rules of `wiki/spec/terminal-psi/encoding.md` (scalar return origins). +//! completion rules of `source-rust/subsystems/compiler/psi/artifact/wire/encoding.md` (scalar return origins). //! This reader checks the accounting; it proves no predicate. use omega_psi::{BlockTerminator, CompletionOrigin, DomainAtom, LoweredPackage, MachineBody, SuccessorEdge, TypeShape, ValueOrigin}; diff --git a/_recycling/omega-rust-v2/representations/psi/src/blocks.rs b/_recycling/omega-rust-v2/representations/psi/src/blocks.rs index ab91ee087fcb..4711a41bb76b 100644 --- a/_recycling/omega-rust-v2/representations/psi/src/blocks.rs +++ b/_recycling/omega-rust-v2/representations/psi/src/blocks.rs @@ -96,7 +96,7 @@ pub struct DomainCompletion { pub origin: CompletionOrigin, } -/// The completion origins of `wiki/spec/terminal-psi/encoding.md` (scalar return origins). +/// The completion origins of `source-rust/subsystems/compiler/psi/artifact/wire/encoding.md` (scalar return origins). #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum CompletionOrigin { /// A predicate-free, route-free tag. Its carrier’s required memberships must diff --git a/_recycling/omega-rust-v2/representations/psi/src/domains.rs b/_recycling/omega-rust-v2/representations/psi/src/domains.rs index e327bba0df53..b0c4438f6154 100644 --- a/_recycling/omega-rust-v2/representations/psi/src/domains.rs +++ b/_recycling/omega-rust-v2/representations/psi/src/domains.rs @@ -3,7 +3,7 @@ use crate::{ContractClause, DeclarationId, Site, TypeId}; /// Who may introduce a domain's qualification on a value that lacks it. A /// value that already carries the qualification moves and forwards either way. /// -/// `wiki/spec/terminal-psi/encoding.md` saves this as the domain row's optional +/// `source-rust/subsystems/compiler/psi/artifact/wire/encoding.md` saves this as the domain row's optional /// establishment routes: `Unrestricted` is an absent list and `Nobody` is a /// present list with no route. A list that names routes has no value here /// because no validated access plan can supply one yet. diff --git a/_recycling/omega-rust-v2/tools/spec-corpus/l5_refusals.tsv b/_recycling/omega-rust-v2/tools/spec-corpus/l5_refusals.tsv index a5b078cfdb19..95a1877c7c69 100644 --- a/_recycling/omega-rust-v2/tools/spec-corpus/l5_refusals.tsv +++ b/_recycling/omega-rust-v2/tools/spec-corpus/l5_refusals.tsv @@ -13,5 +13,5 @@ tests/formation_handoff.rs an_omitted_reference_field_has_no_zero_in_a_closed_bo tests/omitted_structural_fields.rs a_sum_zero_establishes_only_its_first_case_and_never_a_reference plan.omg omitted field `Plan::first` of type `app\Slot>` needs a borrowed reference for `Slot::Held::at`, which `..` never supplies 1 invalid - CONTRACT.md#operations-and-declarations; wiki/spec/language/data_and_literals.md#explicit-field-omission (the marker supplies no borrowed reference merely because storage can be zeroed); src/machines/construction/zero.rs A sum's zero is its first declared case, and `Held` stores a `@'r u8`, so the omitted slot would need a borrow that `..` never supplies. With `Empty` declared first the same literal lowers and `Held` is never established; with a `u8` payload the first case is established from its zero. tests/omitted_structural_fields.rs a_reference_below_an_omitted_field_refuses_at_the_literal plan.omg omitted field `Plan::reach` of type `app\Reach>` needs a borrowed reference for `Reach::at`, which `..` never supplies 1 invalid - CONTRACT.md#operations-and-declarations; wiki/spec/language/data_and_literals.md#explicit-field-omission (the marker supplies no borrowed reference merely because storage can be zeroed); src/machines/construction/zero.rs The omitted record's own zero holds a `@'r u8` field, and no zero of that type borrows anything, so the omission can never be supplied. Changing only that field to `u8` lowers the same literal. tests/omitted_structural_fields.rs a_reference_below_an_omitted_field_refuses_at_the_literal plan.omg omitted field `Plan::reaches` of type `[app\Reach>; 2]` needs a borrowed reference for `Reach::at`, which `..` never supplies 1 invalid - CONTRACT.md#operations-and-declarations; wiki/spec/language/data_and_literals.md#explicit-field-omission (the marker supplies no borrowed reference merely because storage can be zeroed); src/machines/construction/zero.rs Every element of the omitted array is a record holding a `@'r u8` field, so no element has a zero that borrows nothing. The record twin in the same test lowers once the field is a `u8`. -tests/immutable_sequences.rs a_linear_element_or_one_that_needs_cleanup_is_invalid_in_a_sequence sequences.omg an immutable sequence cannot hold an element that is linear or needs cleanup 3 invalid - CONTRACT.md#handoffs-and-remaining-work (an element that is linear or needs cleanup anywhere inside it is invalid); wiki/spec/terminal-psi/structural_access.md:422-428 (this form admits no linear claims or executable affine cleanup); wiki/spec/terminal-psi/encoding.md:959,2167; src/machines/ownership/cleanup.rs The stored-length ElementView form of EstablishStructuralArray admits no linear claim and no executable affine cleanup. The three programs are a [linear] element, an element that holds a [linear] record, and an element with `dropped by`. Each is refused at the element's declaration from the formal alone. The same formal with a plain record is a sequence row in this test. -tests/sum_cleanup_contexts.rs an_unrepresentably_large_dispatched_array_refuses_before_expansion case.omg fixed-array cleanup exceeds the Psi block count 1 invalid - CONTRACT.md#handoffs-and-remaining-work; wiki/spec/terminal-psi/ownership.md#partial-ownership-and-residuals; wiki/spec/terminal-psi/encoding.md#field-encodings This input requires a distinct case-selection block for each of 9223372036854775807 intact elements in a statically enumerated disposal. Its required block count cannot be represented by a portable u32 count. +tests/immutable_sequences.rs a_linear_element_or_one_that_needs_cleanup_is_invalid_in_a_sequence sequences.omg an immutable sequence cannot hold an element that is linear or needs cleanup 3 invalid - CONTRACT.md#handoffs-and-remaining-work (an element that is linear or needs cleanup anywhere inside it is invalid); wiki/spec/terminal-psi/structural_access.md:422-428 (this form admits no linear claims or executable affine cleanup); source-rust/subsystems/compiler/psi/artifact/wire/encoding.md:959,2167; src/machines/ownership/cleanup.rs The stored-length ElementView form of EstablishStructuralArray admits no linear claim and no executable affine cleanup. The three programs are a [linear] element, an element that holds a [linear] record, and an element with `dropped by`. Each is refused at the element's declaration from the formal alone. The same formal with a plain record is a sequence row in this test. +tests/sum_cleanup_contexts.rs an_unrepresentably_large_dispatched_array_refuses_before_expansion case.omg fixed-array cleanup exceeds the Psi block count 1 invalid - CONTRACT.md#handoffs-and-remaining-work; wiki/spec/terminal-psi/ownership.md#partial-ownership-and-residuals; source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#field-encodings This input requires a distinct case-selection block for each of 9223372036854775807 intact elements in a statically enumerated disposal. Its required block count cannot be represented by a portable u32 count. diff --git a/_recycling/omega-rust-v2/wiki/README.md b/_recycling/omega-rust-v2/wiki/README.md index 839e572b2993..70fbaa900061 100644 --- a/_recycling/omega-rust-v2/wiki/README.md +++ b/_recycling/omega-rust-v2/wiki/README.md @@ -29,7 +29,7 @@ development artifacts working. This does not remove the current format discriminator or exact schema identity: incompatible bytes must reject rather than be interpreted under a new layout. Package pins, producer authorization, selected-provider identity and contracted runtime replacement are live correctness -mechanisms, not historical baggage. The [encoding contract](../../wiki/spec/terminal-psi/encoding.md) +mechanisms, not historical baggage. The [encoding contract](../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md) owns these requirements. A missing implementation, test or difficult repair stays with its owning task. @@ -117,7 +117,7 @@ public spellings. [structural claims and cleanup](../../wiki/spec/terminal-psi/ownership.md), [runtime callable dispatch](../../wiki/spec/terminal-psi/dynamic_dispatch.md), [observations](../../wiki/spec/terminal-psi/observations.md), - [encoding](../../wiki/spec/terminal-psi/encoding.md), + [encoding](../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md), [fact validity](../../wiki/spec/terminal-psi/fact_validity.md), [mathematical proof values](../../wiki/spec/terminal-psi/mathematical_values.md), and [integer certificates](../../wiki/spec/terminal-psi/integer_certificates.md). diff --git a/_recycling/tests/product/alpha/README.md b/_recycling/tests/product/alpha/README.md index 3455799ce172..bcda70ea3fc8 100644 --- a/_recycling/tests/product/alpha/README.md +++ b/_recycling/tests/product/alpha/README.md @@ -90,7 +90,7 @@ source-owned lowering orchestration. Its adjacent `layout.omg`, `storage.omg`, `expressions.omg` and `statements.omg` retain type layouts, owned places and transfers, expression evaluation and control. Stable machine/value/field identities use the existing memory, call, control and return meanings from the -[operation vocabulary](../../../wiki/spec/terminal-psi/encoding.md#operation-rows) +[operation vocabulary](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#operation-rows) and [normal results](../../../wiki/spec/terminal-psi/calls_and_outcomes.md#normal-results). It is an internal lowering slice, not another portable artifact format. Full Psi publication must additionally retain canonical declaration, result, obligation diff --git a/samples/cli/facts/applied_requirement_indices/README.md b/samples/cli/facts/applied_requirement_indices/README.md index f51709e87e49..f675cb35ed85 100644 --- a/samples/cli/facts/applied_requirement_indices/README.md +++ b/samples/cli/facts/applied_requirement_indices/README.md @@ -123,7 +123,7 @@ Completing the nine-place row exposed and fixed three checking gaps in `omega-ru 2. **Identity and lifetime:** Each value's normalized domain instance (`Tagged`, `Tagged>`, `Pair`, `Pair`) remains attached to its exact storage or value version across local bindings, generic record fields (`Holder`), parameters, nested call results, `match` arm joins, `const` initializers, state transitions (`selected`), cross-machine forwarding (`Relay::relay`), and selected ordinary implementation bodies ([fact validity](../../../../wiki/spec/terminal-psi/fact_validity.md), [lifetimes](../../../../wiki/spec/language/lifetimes.md), [ownership](../../../../wiki/spec/language/ownership.md), [content custody](../../../../wiki/spec/resources/content_custody.md)). Two distinct calls to `Identity::paired` in the same expression maintain distinct invocation namespaces without conflating result facts. 3. **Composition:** Applied requirement calls substitute both the outer trait telescope (`Identity`) and the member telescope (`paired`) into parameter types, return types, `requires`, and `ensures` clauses ([machines](../../../../wiki/spec/language/machines.md), [evaluation](../../../../wiki/spec/language/evaluation.md), [patterns](../../../../wiki/spec/language/patterns.md), [structural predicates](../../../../wiki/spec/terminal-psi/structural_predicates.md)). For each place, `/main.omg` and `/invalid/main.omg` differ by a single type-index token on that place's construct (`Value` -> `Alt`, `Inner` -> `Alt`, or `Word` -> `Other`). 4. **Soundness boundaries:** Every `/invalid/main.omg` twin fails closed during compile-time checking with `error: index compatibility condition ... is not established: actual ... and expected ... are distinct normalized instances` when an unproved or mismatched type index is transported into a local, field, parameter, nested call argument, match join, const initializer, state parameter, machine return type, or target body ([mathematical bindings](../../../../wiki/spec/proofs/mathematical_bindings.md), [mathematical values](../../../../wiki/spec/terminal-psi/mathematical_values.md), [quotients](../../../../wiki/spec/proofs/quotients.md), [inductive profile](../../../../wiki/spec/proofs/inductive_profile.md), [termination](../../../../wiki/spec/language/termination.md), [authority](../../../../wiki/spec/resources/authority.md)). -5. **Checked-to-Terminal Psi lowering (`Psi 06–08`):** Checked trees lower applied boundary requirement calls, specialized generic helpers, state transitions, and match dispatches into canonical target-neutral Terminal Psi (`PSITERM\0`), erasing static domain index tags after discharging `IndexCompatibilityFacts` (`ClosedEvaluation` and `LicensedNormalization`) while retaining boundary-application demands and ordinary selected implementation identities ([product](../../../../wiki/spec/terminal-psi/product.md), [encoding](../../../../wiki/spec/terminal-psi/encoding.md), [calls and outcomes](../../../../wiki/spec/terminal-psi/calls_and_outcomes.md), [control flow](../../../../wiki/spec/terminal-psi/control_flow.md), [dynamic dispatch](../../../../wiki/spec/terminal-psi/dynamic_dispatch.md), [ownership](../../../../wiki/spec/terminal-psi/ownership.md), [loans](../../../../wiki/spec/terminal-psi/loans.md), [boundary calls](../../../../wiki/spec/terminal-psi/boundary_calls.md), [observations](../../../../wiki/spec/terminal-psi/observations.md), [integer certificates](../../../../wiki/spec/terminal-psi/integer_certificates.md)). +5. **Checked-to-Terminal Psi lowering (`Psi 06–08`):** Checked trees lower applied boundary requirement calls, specialized generic helpers, state transitions, and match dispatches into canonical target-neutral Terminal Psi (`PSITERM\0`), erasing static domain index tags after discharging `IndexCompatibilityFacts` (`ClosedEvaluation` and `LicensedNormalization`) while retaining boundary-application demands and ordinary selected implementation identities ([product](../../../../wiki/spec/terminal-psi/product.md), [encoding](../../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md), [calls and outcomes](../../../../wiki/spec/terminal-psi/calls_and_outcomes.md), [control flow](../../../../wiki/spec/terminal-psi/control_flow.md), [dynamic dispatch](../../../../wiki/spec/terminal-psi/dynamic_dispatch.md), [ownership](../../../../wiki/spec/terminal-psi/ownership.md), [loans](../../../../wiki/spec/terminal-psi/loans.md), [boundary calls](../../../../wiki/spec/terminal-psi/boundary_calls.md), [observations](../../../../wiki/spec/terminal-psi/observations.md), [integer certificates](../../../../wiki/spec/terminal-psi/integer_certificates.md)). 6. **Provider settlement, layout geometry, and ABI calling plans (`Omega 00–02`):** Build companion rows (`ProgramEntry` for all four hosted targets, `accept_boundary`, `select_provider`) join each closed boundary requirement (`Identity::identity`, `compound`, `paired`, `paired`, `stated`) to `Provider`'s concrete specializations without reopening source, evaluate `Payload` and `Holder` layouts, and lower calls into validated `CallPlan` and `StatePlan` placements ([provider selection](../../../../wiki/spec/build/provider_selection.md), [assumed binding contracts](../../../../wiki/spec/build/assumed_binding_contracts.md), [foreign bindings](../../../../wiki/spec/build/foreign_bindings.md), [private callbacks](../../../../wiki/spec/build/private_callbacks.md), [layout plans](../../../../wiki/spec/layouts/plans.md), [recasts](../../../../wiki/spec/layouts/recasts.md), [codecs](../../../../wiki/spec/layouts/codecs.md), [calling plans](../../../../wiki/spec/build/calling_plans.md), [byte views](../../../../wiki/spec/terminal-psi/byte_views.md)). 7. **Instruction selection, register homes, and activation frame realization (`Omega 03–06`):** Backend lowering selects target ISA instructions for 64-bit payload transport, equality comparisons, and conditional branches across `forward`, `field`, `forward_pair`, `later`, `Relay::relay`, and `Provider` states, assigns register homes and spill slots, and composes bounded worst-case stack usage (WCSU) ([storage](../../../../wiki/spec/resources/storage.md), [activation storage](../../../../wiki/spec/resources/activation_storage.md), [machine-state evidence](../../../../wiki/spec/build/machine_state_evidence.md), [checked assembly](../../../../wiki/spec/language/assembly.md)). 8. **Form encoding, branch relaxation, relocations, and native image emission (`Omega 07–09` + emission):** Final encoding resolves stack displacements and basic-block branch offsets, validates machine-state footprint evidence, and emits native executables that exit `0` and agree with Terminal Psi (`omega run --both`) across the root witness and all nine transport places ([machine-state evidence](../../../../wiki/spec/build/machine_state_evidence.md), [executable installation](../../../../wiki/spec/build/executable_installation.md), [calling plans](../../../../wiki/spec/build/calling_plans.md)). diff --git a/samples/cli/facts/unsigned_32bit_division_remainder_bound/README.md b/samples/cli/facts/unsigned_32bit_division_remainder_bound/README.md index 111593b9881d..b3e4a5dc954f 100644 --- a/samples/cli/facts/unsigned_32bit_division_remainder_bound/README.md +++ b/samples/cli/facts/unsigned_32bit_division_remainder_bound/README.md @@ -67,7 +67,7 @@ omega --check samples/cli/facts/unsigned_32bit_division_remainder_bound// - **Identity and lifetime** ([fact validity](../../../../wiki/spec/terminal-psi/fact_validity.md), [lifetimes](../../../../wiki/spec/language/lifetimes.md), [ownership](../../../../wiki/spec/language/ownership.md), [content custody](../../../../wiki/spec/resources/content_custody.md)): The `u32` remainder scalar retains its value identity and bounds across copies and transports. In all nine places (local variables, nominal struct fields `Operands`, parameter bindings, function return contracts, branch joins, constant references, state arguments, cross-machine calls, and target bodies), the upper bound `rem <= 15u32` is preserved intact. - **Composition** ([machines](../../../../wiki/spec/language/machines.md), [evaluation](../../../../wiki/spec/language/evaluation.md), [patterns](../../../../wiki/spec/language/patterns.md), [structural predicates](../../../../wiki/spec/terminal-psi/structural_predicates.md)): Bounded remainder composes through calling conventions and control flow. In `call_result`, `compute_remainder` formally proves postcondition `ensures result <= 15u32`; in `match_join`, both arms establish identical remainder bounds across the join; in `other_state` and `other_machine`, contract arrivals verify incoming bounds. - **Soundness boundaries** ([mathematical bindings](../../../../wiki/spec/proofs/mathematical_bindings.md), [mathematical values](../../../../wiki/spec/terminal-psi/mathematical_values.md), [quotients](../../../../wiki/spec/proofs/quotients.md), [inductive profile](../../../../wiki/spec/proofs/inductive_profile.md), [termination](../../../../wiki/spec/language/termination.md), [authority](../../../../wiki/spec/resources/authority.md)): All 9 `/invalid/main.omg` reject twins enforce compile-time verification failure when the divisor bound is widened to `divisor <= 17u32`. Because the remainder bound `rem <= 16u32` admits values above `15u32`, `let headroom: u32 = 15u32 - rem;` fails closed with diagnostic `exact arithmetic in machine ... local headroom may overflow \`u32\``. No underflowing subtraction escapes into code generation. - - **Checked-to-Terminal Psi lowering (`Psi 06–08`)** ([product](../../../../wiki/spec/terminal-psi/product.md), [encoding](../../../../wiki/spec/terminal-psi/encoding.md), [calls and outcomes](../../../../wiki/spec/terminal-psi/calls_and_outcomes.md), [control flow](../../../../wiki/spec/terminal-psi/control_flow.md), [integer certificates](../../../../wiki/spec/terminal-psi/integer_certificates.md)): Unsigned remainder lowers into target-neutral Terminal Psi (`PSITERM\0`) integer operations with unsigned remainder certificates (`rem < divisor`). Proof obligations for non-zero divisor and interval boundaries are satisfied and erased while preserving executable semantics. All 10 positive programs execute in the Terminal Psi interpreter (`omega run --both`), observing exit 0. + - **Checked-to-Terminal Psi lowering (`Psi 06–08`)** ([product](../../../../wiki/spec/terminal-psi/product.md), [encoding](../../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md), [calls and outcomes](../../../../wiki/spec/terminal-psi/calls_and_outcomes.md), [control flow](../../../../wiki/spec/terminal-psi/control_flow.md), [integer certificates](../../../../wiki/spec/terminal-psi/integer_certificates.md)): Unsigned remainder lowers into target-neutral Terminal Psi (`PSITERM\0`) integer operations with unsigned remainder certificates (`rem < divisor`). Proof obligations for non-zero divisor and interval boundaries are satisfied and erased while preserving executable semantics. All 10 positive programs execute in the Terminal Psi interpreter (`omega run --both`), observing exit 0. - **Provider settlement, layout geometry, and ABI calling plans (`Omega 00–02`)** ([provider selection](../../../../wiki/spec/build/provider_selection.md), [layout plans](../../../../wiki/spec/layouts/plans.md), [calling plans](../../../../wiki/spec/build/calling_plans.md)): `ProgramEntry` settles across all four hosted targets (`windows_x86_64`, `linux_x86_64`, `macos_arm64`, `linux_arm64`). Scalar layout geometry validates 4-byte stored width for `u32` (`size_of = 4`, align 4). Calling plans allocate 32-bit registers (`ecx`/`edx` on Windows x86_64, `edi`/`esi` on Linux x86_64, `w0`/`w1` on AArch64) according to target ABIs. - **Instruction selection, register homes, and activation frame realization (`Omega 03–06`)** ([storage](../../../../wiki/spec/resources/storage.md), [activation storage](../../../../wiki/spec/resources/activation_storage.md), [machine-state evidence](../../../../wiki/spec/build/machine_state_evidence.md)): Backend lowering selects 32-bit unsigned division and remainder instructions: on x86_64, clearing `edx` (`xor edx, edx`) followed by `div r32` operating on `edx:eax`, where remainder is returned directly in `edx`; on AArch64, `udiv w-quot, w-dividend, w-divisor` followed by `msub w-rem, w-quot, w-divisor, w-dividend` (`rem = dividend - quot * divisor`). Register allocation assigns 32-bit registers with zero-extended register semantics and bounded activation claims. - **Form encoding, branch relaxation, relocations, and native image emission (`Omega 07–09` + emission)** ([machine-state evidence](../../../../wiki/spec/build/machine_state_evidence.md), [executable installation](../../../../wiki/spec/build/executable_installation.md), [calling plans](../../../../wiki/spec/build/calling_plans.md)): Basic blocks and conditional jumps relax with offset reflow. Transitive machine-state footprints validate within host ceilings, and native executable images (PE/ELF/Mach-O) are emitted. The four hosted bindings remain authored. Native/Terminal execution claims apply only to the hosts identified by the retained run records; the fresh capture below covers `macos_arm64`. diff --git a/source-rust/subsystems/compiler/psi-to-native/README.md b/source-rust/subsystems/compiler/psi-to-native/README.md index 4de444fe0170..3256459f3b15 100644 --- a/source-rust/subsystems/compiler/psi-to-native/README.md +++ b/source-rust/subsystems/compiler/psi-to-native/README.md @@ -12,7 +12,7 @@ The native entry accepts an authorized Psi program, its deployment target and th | Complete the requested product | The [program driver](driver/mod.rs) returns the interpreter’s provisions at runtime admission. An image request [collects the required bodies](driver/image/mod.rs) and [stage 15](pipeline/15_objects-to-image/) publishes the finished image. [Entry signature and storage contract](representations/program-entry-contracts/program_entry.rs) · [Target arrival ABI](targets/calling-conventions/src/process_entry.rs) | | Verify an emitted object | An [explicit stage validator](verification/stage_validators.rs) requests originals from the emission and gives them to [published-object verification](verification/published-objects/). Its checks compare the root and private callable objects against their retained stage inputs before the caller releases the image. | -The public standalone program file is the portable `.psi` artifact. The historical `OMGNTI41` record captured a native realization proposal for a particular artifact and target. Its reader and writer are retained in [the native derivation archive](../../../../_recycling/source-rust/subsystems/compiler/psi-to-native/native-derivation-record/). [Portable Psi encoding](../../../../wiki/spec/terminal-psi/encoding.md) +The public standalone program file is the portable `.psi` artifact. The historical `OMGNTI41` record captured a native realization proposal for a particular artifact and target. Its reader and writer are retained in [the native derivation archive](../../../../_recycling/source-rust/subsystems/compiler/psi-to-native/native-derivation-record/). [Portable Psi encoding](../psi/artifact/wire/encoding.md) The image driver plans reachable private callables and emits callback thunks. Runtime admission prepares target ABI adapters for foreign calls. [Callback thunks](driver/image/callback_thunks.rs) · [Foreign adapters](driver/runtime/foreign_adapters.rs) · [Interpreter provisions](driver/runtime/mod.rs) diff --git a/source-rust/subsystems/compiler/psi-to-native/tests/saved_linux_program.rs b/source-rust/subsystems/compiler/psi-to-native/tests/saved_linux_program.rs index 920d4d9f792a..310af63c09d6 100644 --- a/source-rust/subsystems/compiler/psi-to-native/tests/saved_linux_program.rs +++ b/source-rust/subsystems/compiler/psi-to-native/tests/saved_linux_program.rs @@ -148,7 +148,7 @@ fn pre_namespace_publication_does_not_supply_the_current_physical_entry() { ); // The specimen was saved under semantic format marker 289, which format 290 // (#5035) retired; older markers are rejected before their payload is read - // (wiki/spec/terminal-psi/encoding.md#machine-rows). Its unqualified + // (source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#machine-rows). Its unqualified // physical arrival therefore never reaches native admission. assert!(matches!( CanonicalTerminalArtifact::from_bytes(old), diff --git a/source-rust/subsystems/compiler/psi/README.md b/source-rust/subsystems/compiler/psi/README.md index 2fbd5895174f..5a2266db939f 100644 --- a/source-rust/subsystems/compiler/psi/README.md +++ b/source-rust/subsystems/compiler/psi/README.md @@ -23,7 +23,9 @@ Implementers choose the representation, operations, encoding and reconstruction needed for accepted Omega behavior. Human design review takes place when the owner requests it. Carry a change through its versioned schema, producers, -consumers and the program that exercises it. Keep source behavior, trust +consumers and the program that exercises it. Update the +[wire encoding page](artifact/wire/encoding.md) in the same change as the bytes +it describes. Keep source behavior, trust guarantees and the boundary between Psi and native compilation intact. Compiler checking and rejection tests continue at the documented diff --git a/source-rust/subsystems/compiler/psi/artifact/codec/README.md b/source-rust/subsystems/compiler/psi/artifact/codec/README.md index fcc17c9a3414..26ae9e2f6e0b 100644 --- a/source-rust/subsystems/compiler/psi/artifact/codec/README.md +++ b/source-rust/subsystems/compiler/psi/artifact/codec/README.md @@ -1,6 +1,6 @@ # Psi artifact codec -The artifact codec seals a [Psi program](../../../../../../wiki/spec/terminal-psi/product.md) and packages its sections for another stage or host to reopen. It re-exports [terminal-wire](../wire/README.md), which validates and encodes the program according to the [canonical encoding specification](../../../../../../wiki/spec/terminal-psi/encoding.md). The [receiving host](../authorization/authorization.rs) decides whether to trust the producer. +The artifact codec seals a [Psi program](../../../../../../wiki/spec/terminal-psi/product.md) and packages its sections for another stage or host to reopen. It re-exports [terminal-wire](../wire/README.md), which validates and encodes the program according to the [canonical encoding specification](../wire/encoding.md). The [receiving host](../authorization/authorization.rs) decides whether to trust the producer. Native code encodes structural domains, access plans and quotient declarations through [declaration encoding](../declaration-encoding/src/lib.rs). Other native consumers use the wire codecs for the records they carry. `mbx xtask check-boundary` keeps representations after stage 02 independent of the artifact codec. diff --git a/source-rust/subsystems/compiler/psi/artifact/codec/src/canonical_artifact.rs b/source-rust/subsystems/compiler/psi/artifact/codec/src/canonical_artifact.rs index 6daca2c9db71..ffd3c7475e96 100644 --- a/source-rust/subsystems/compiler/psi/artifact/codec/src/canonical_artifact.rs +++ b/source-rust/subsystems/compiler/psi/artifact/codec/src/canonical_artifact.rs @@ -762,7 +762,7 @@ mod tests { // The pre-namespace specimen was saved under semantic format marker 289. // Format 290 (#5035) retired its sealed byte reader, and the encoding // rejects older markers before reading their payload - // (wiki/spec/terminal-psi/encoding.md#machine-rows). + // (source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#machine-rows). #[test] fn pre_namespace_linux_program_is_refused_by_its_retired_format_marker() { let bytes = include_bytes!( diff --git a/source-rust/subsystems/compiler/psi/artifact/declaration-encoding/src/terms/table.rs b/source-rust/subsystems/compiler/psi/artifact/declaration-encoding/src/terms/table.rs index 8dfc19cba86f..3864c91493c9 100644 --- a/source-rust/subsystems/compiler/psi/artifact/declaration-encoding/src/terms/table.rs +++ b/source-rust/subsystems/compiler/psi/artifact/declaration-encoding/src/terms/table.rs @@ -9,7 +9,7 @@ then one `u32` handle per recursive child, in the child's declared order. A handle names an earlier entry of the same table, so nesting depth is bounded only by the table's encoded size, and encoding and decoding are loops over an explicit stack rather than host-stack recursion -(`wiki/spec/terminal-psi/encoding.md#canonical-form`). +(`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#canonical-form`). The table is a tree, not a DAG: every entry except the roots is the child of exactly the next entry that consumes it. The decoder keeps the entries not yet diff --git a/source-rust/subsystems/compiler/psi/artifact/wire/README.md b/source-rust/subsystems/compiler/psi/artifact/wire/README.md index 10201fcf623f..b91f9b22ce6c 100644 --- a/source-rust/subsystems/compiler/psi/artifact/wire/README.md +++ b/source-rust/subsystems/compiler/psi/artifact/wire/README.md @@ -1,6 +1,6 @@ # Psi wire format -The wire codec turns a [Psi program](../../../../../../wiki/spec/terminal-psi/product.md) into bytes and checks the structure of a program it reads. The [encoding specification](../../../../../../wiki/spec/terminal-psi/encoding.md) defines the canonical form and identifies each section. The individual operation payloads currently live in the vocabulary reference. +The wire codec turns a [Psi program](../../../../../../wiki/spec/terminal-psi/product.md) into bytes and checks the structure of a program it reads. The [encoding specification](encoding.md) defines the canonical form and identifies each section. The individual operation payloads currently live in the vocabulary reference. This crate reads and writes the complete program, validates incoming records, computes fingerprints and handles companion sections. The [artifact codec](../codec/README.md) seals each program with its bytes and manifest. The optimizer and native structural catalog get the bytes for structural domains, access plans and quotient declarations directly from [declaration encoding](../declaration-encoding/src/lib.rs). Both the complete artifact and the native compiler use those same field definitions. diff --git a/wiki/spec/terminal-psi/encoding.md b/source-rust/subsystems/compiler/psi/artifact/wire/encoding.md similarity index 97% rename from wiki/spec/terminal-psi/encoding.md rename to source-rust/subsystems/compiler/psi/artifact/wire/encoding.md index 4503aec8e8bc..71dddd29c1e8 100644 --- a/wiki/spec/terminal-psi/encoding.md +++ b/source-rust/subsystems/compiler/psi/artifact/wire/encoding.md @@ -1,10 +1,16 @@ # Terminal canonical encoding and identities -[Portable product](product.md) | [Observations](observations.md) +[Portable product](../../../../../../wiki/spec/terminal-psi/product.md) | [Observations](../../../../../../wiki/spec/terminal-psi/observations.md) + +This page describes the compiler's file format for Psi programs. It sits beside +the [wire codec](README.md) that implements it, and a codec change updates it +in the same pull request ([changes to Psi](../../README.md#changes-to-psi)). +The language specification in `wiki/spec/` owns what programs mean; a trust or +admission rule stated here must stay intact when the layout changes. This is the canonical encoding contract; it is not a complete byte-level decoder -specification. The [documentation index](../../README.md) lists operation subjects. -[Proof values](mathematical_values.md) and [certificate rules](integer_certificates.md) +specification. The [documentation index](../../../../../../wiki/README.md) lists operation subjects. +[Proof values](../../../../../../wiki/spec/terminal-psi/mathematical_values.md) and [certificate rules](../../../../../../wiki/spec/terminal-psi/integer_certificates.md) define semantics; the tables below give the physical layout of every operation, terminator, scalar-term, and proposition form the codec accepts, plus the catalog, scalar-block-invariant, and machine rows. @@ -42,6 +48,12 @@ table spelling. An entry count larger than the remaining bytes rejects as truncation before any entry is read. Encoding and decoding walk a table with an explicit stack; nesting depth never consumes host stack. +Marker 300 ends each theorem contract with its counted proof parameters, as in +`machine(n: u8)`, and each theorem application with +the counted proofs it gives them, as in `Step::(n)`. Readers reject +earlier markers before reading the payload, so a saved program from marker 299 +or earlier must be rebuilt. + Marker 299 ends each [theorem supply](#logical-theorem-parameters) with its counted instantiation: one proof for each of the cited theorem's own proof formals, as in `lifted::`. Readers reject earlier markers before @@ -52,7 +64,7 @@ Marker 297 adds the packed integer operations. Each row carries a structural result and one or two shared structural arguments. The operation determines the element type and extent of each input and the result. Readers check the operation selector, immediate bounds, access, and array shape before execution. -[Fixed-width SIMD values](../language/simd.md) +[Fixed-width SIMD values](../../../../../../wiki/spec/language/simd.md) Marker 296 states FloatMeaning equality as the general Identity row, [proposition](#propositions) tag 23 at the FloatMeaning carrier, and retires @@ -137,7 +149,7 @@ semantic changes move producer, codec, interpreter, and lowerers together. Current golden bytes establish the current format, not historical acceptance. -[Static machines](../language/machines.md#static-declarations-and-explicit-state) +[Static machines](../../../../../../wiki/spec/language/machines.md#static-declarations-and-explicit-state) use ordinary explicit parameter positions and identities. Structural parameters, provider signature parameters, structural places and retained-borrow parameter roots carry no `self` flag. Removing that byte changes the canonical format; @@ -146,7 +158,7 @@ as a compatibility dialect. Access, multiplicity, qualifications and custody remain independently checked for every ordinary parameter. Legacy runtime conformance selectors are not callable-package evidence. -[Machine values](../language/machine_values.md) and [some packages](../language/some_packages.md) +[Machine values](../../../../../../wiki/spec/language/machine_values.md) and [some packages](../../../../../../wiki/spec/language/some_packages.md) replace source `dyn`; static named conformances remain. `SelectImplementation` (109), `CallDynamic` (110), and section 25 describe legacy wire forms. They do not authorize source `dyn` and must not be silently decoded as runtime callable @@ -160,7 +172,7 @@ requires no global witness/target roster. Source checking produces these plans; lowering carries them; independent verification validates them. Update the semantic marker, producer, codec, interpreter, verifier and consumers together. New numeric tags and their byte payloads must be specified with that -implementation, not guessed here. The [migration plan](../../drafts/designs/machine_values_some.md) +implementation, not guessed here. The [migration plan](../../../../../../wiki/drafts/designs/machine_values_some.md) owns replacement of the legacy rows and retirement of their decoders. Operation variants are closed and typed. Their referenced values must be @@ -205,16 +217,16 @@ A destination invariant, another origin row or evidence from a different arrival cannot serve as its proof. A routed ancestor still needs its authorized provenance. Canonical identity-table references retain -[stable index identity](../proofs/contracts.md#stable-canonical-index-identity). +[stable index identity](../../../../../../wiki/spec/proofs/contracts.md#stable-canonical-index-identity). Producers agree on canonical typed structure, selected operation/application, arithmetic policy, fixed core simplifications, ordering, and encoding. No expansion cutoff or caller-selected law set enters open-index key normalization. Compiler-local handles and compression cannot change published identity. -[Compatibility evidence](../proofs/contracts.md#exact-matching-and-evidence-transport) +[Compatibility evidence](../../../../../../wiki/spec/proofs/contracts.md#exact-matching-and-evidence-transport) retains its exact proposition, subjects, substitution and selected law authority separately from keys. Reuse of established judgments follows -[Psi admission](product.md#publication-and-separate-consumption): the host +[Psi admission](../../../../../../wiki/spec/terminal-psi/product.md#publication-and-separate-consumption): the host authorizes the trusted producer's exact artifact. Receipt requires neither theorem rediscovery nor certificate replay. Proof-discovery policy and usage are accounting; they neither rename applications nor establish claims. Closed @@ -239,7 +251,7 @@ the `PSICORE` framing remain supported canonical encodings. Their presence grant no truth, producer trust, execution permission or provider authority. Decoding checks their representation under shared count, byte and work limits; it does not re-decide the encoded judgment. The -[inspection/preparation split](../build/embedding.md#loading-and-preparation) +[inspection/preparation split](../../../../../../wiki/spec/build/embedding.md#loading-and-preparation) preserves canonical and structural validation while assigning execution-only analyses to authorized preparation. No wire-format retirement follows from this admission policy. @@ -319,7 +331,7 @@ ordered strictly by `(machine, edge, argument ordinal)`; float entry ranges by these bytes participate in semantic identity. Canonical encoding does not itself authorize membership. Verification compares the exact same-carrier sets at the named source and destination under the -[scalar qualification rules](calls_and_outcomes.md#scalar-qualifications). +[scalar qualification rules](../../../../../../wiki/spec/terminal-psi/calls_and_outcomes.md#scalar-qualifications). An ordinary strict addition introduces only predicate-free, route-free atoms. Predicate or routed membership still requires a checked completion. A pure erasure goes to a strict subset, including the bare set. For a replacement, @@ -527,7 +539,7 @@ header. Absence of that header does not classify a selected contract as nongener ## Field encodings -The [width-indexed integer contract](../language/numeric_values.md#width-indexed-integers) +The [width-indexed integer contract](../../../../../../wiki/spec/language/numeric_values.md#width-indexed-integers) requires a versioned migration of integer type/value and structural scalar encodings: retain positive `u64` semantic widths and exact values beyond 128 bits without truncation. The legacy `u16` width and `i128`/`u128` value fields @@ -580,7 +592,7 @@ byte limit. Any tag value absent from a closed-sum table rejects. Additional input qualifications distinguish facts supplied for a call from requirements owed by the original storage, following -[lender-domain restoration](../language/dependent_values.md#mutable-receivers-and-declared-field-domains). +[lender-domain restoration](../../../../../../wiki/spec/language/dependent_values.md#mutable-receivers-and-declared-field-domains). Each row uses the projected-qualification encoding; an empty path names a whole-value qualification. The list is strictly ordered, and every row also appears in the value's ordinary whole or projected qualification list. It grants @@ -821,7 +833,7 @@ Transformation derivations and their input/output rosters are unordered sets, strictly sorted by the representation's lexicographic field order; duplicates and alternative ordering reject. Parent arguments retain positional operand order. Neither order supplies authority. The reconstructed obligations and -execution behavior follow the [ownership contract](ownership.md). +execution behavior follow the [ownership contract](../../../../../../wiki/spec/terminal-psi/ownership.md). Lineage steps retain causal order; each step's input and output claim rosters are strictly increasing sets. Marker 183 adds these completed producer links @@ -864,6 +876,7 @@ integer math and content operands are their own encodings inside the row. | 21 | IeeeFloatIntegerExact | scalar source + integer type | | 22 | IntegerIeeeFloatExact | scalar integer source + IEEE target format | | 23 | Identity | counted Identity values + `u32` left value position + `u32` right value position | +| 24 | IsMere | proposition | Tags 12, 18 and 19 are retired; a decoder rejects them. @@ -942,7 +955,7 @@ This encoding retains explicit typed data identity without enumerating fields or array elements and does not encode an executable equality operation. A source `==` fact cannot populate it without checked evidence connecting the selected comparison to identity. -The ratified [float identity rule](mathematical_values.md#float-equality-and-source-identity) +The ratified [float identity rule](../../../../../../wiki/spec/terminal-psi/mathematical_values.md#float-equality-and-source-identity) requires exact raw IEEE representation identity to remain distinct from IEEE comparison and payload-erased meaning equality. This table does not itself add a scalar identity encoding or validate an old artifact under new semantics. @@ -1467,7 +1480,7 @@ External provider rows now retain an optional sealed native meaning immediately after their optional numeric intrinsic. Its `u8` outer tag is `1` for hosted operations and `2` for fixed-image operations. Hosted `u8` tags are `2` for console byte write and `4` for core process exit. Tag `3` designated a byte reader that trapped on input failure and must be -rejected. Standard input now uses the [checked reader](../resources/bounded_input.md) +rejected. Standard input now uses the [checked reader](../../../../../../wiki/spec/resources/bounded_input.md) with a recoverable error result. Tag `1`, formerly console process exit, also rejects. Fixed-image tags are `1` program-storage entry and `2` retained-suffix start. @@ -1838,7 +1851,7 @@ fingerprints. These records supply no producer trust or execution authority. The caller separately supplies authorization for the exact canonical artifact; attachment checks each seal's module, execution site and goal. Receipt does not require proof-kernel replay, as defined by -[publication and separate consumption](product.md#publication-and-separate-consumption). +[publication and separate consumption](../../../../../../wiki/spec/terminal-psi/product.md#publication-and-separate-consumption). Psi's semantic format and identity are unchanged by this companion. @@ -1861,7 +1874,7 @@ An ordinary machine's parameter and result type identities retain their declared lifetime relation in one signature context. Its own lifetime binders use `region(owner(schema),ordinal(...))`; elided inputs mint distinct binders and an elided result uses the signature's unambiguous relation under -[returned-view elision](../language/lifetimes.md#returned-views). Captured +[returned-view elision](../../../../../../wiki/spec/language/lifetimes.md#returned-views). Captured lifetimes retain their portable declaration owner instead of becoming invocation binders. Binder names do not affect these identities. The contract commitment uses these same complete type identities, so an input-related result promise @@ -1928,7 +1941,7 @@ followed by its nonempty counted `requires` clauses as canonical propositions in authored order. The sum wrapper remains tag `18`, with its ordinary sum payload followed by the same counted clauses. Each clause names its own fields and cases, with `self` as place 1, under the -[structural access contract](structural_access.md#complete-record-construction). +[structural access contract](../../../../../../wiki/spec/terminal-psi/structural_access.md#complete-record-construction). A wrapper with zero clauses or a record wrapper around another constructor is rejected. Declarations without clauses retain their ordinary encoding. This records the invariant; the receiving checker still proves construction, @@ -1979,7 +1992,7 @@ checked on canonical reload. | entry claim | claim id + input place id + structural path; strictly ordered by claim id | | block-entry claim binding | claim id + owned block parameter place id + structural path; strictly ordered by claim id; names the arriving obligation without establishing one | | service ceiling | counted service ids; the published ceiling is strictly ordered | -| synchronous entries | counted service ids, strictly ordered: the requirement identities of the callbacks and inbound entries control may arrive at before the machine returns ([direct synchronous invocation](../language/effects.md#direct-synchronous-invocation)); no parent closure | +| synchronous entries | counted service ids, strictly ordered: the requirement identities of the callbacks and inbound entries control may arrive at before the machine returns ([direct synchronous invocation](../../../../../../wiki/spec/language/effects.md#direct-synchronous-invocation)); no parent closure | | structural result declaration | place id + structural type id + structural multiplicity + counted domain identities + counted projected qualifications + counted reference result sources | | reference result source | result structural path + source structural argument; strictly ordered by result path | | machine contract | contract id + crash routes + counted erased scalar formal declarations + counted erased proof formals + counted requires propositions + counted ensures clauses + counted outcome-specific ensures | @@ -2124,7 +2137,7 @@ the bound was omitted and the exact service identities of a finite bound. ### Deferred static reach summaries -The [deferred reach contract](../language/effects.md#static-callback-reach-dependencies) +The [deferred reach contract](../../../../../../wiki/spec/language/effects.md#static-callback-reach-dependencies) requires published summaries to distinguish an open bound from every finite bound, including empty. Preserve structural and nominal machine-binder origins, and conformance projections keyed by evidence binder, exact requirement member @@ -2133,7 +2146,7 @@ commitments and the resulting finite rows. Runtime callable ceilings stay finite an installed root cannot retain unresolved static projections. Canonical identities include these distinctions. An old empty bound cannot be -reinterpreted as an open one. The [migration](../../drafts/designs/deferred_callback_reach.md#implementation) +reinterpreted as an open one. The [migration](../../../../../../wiki/drafts/designs/deferred_callback_reach.md#implementation) must update the reach schema, wire-field tables, commitments and codecs together, with exact round-trip and refusal coverage. Source omission alone cannot recover an absent dependency from a previously published interface. @@ -2343,7 +2356,7 @@ initialized fixed-array backing for one borrowed call argument. Both endpoints participate in canonical identity, including empty windows. This terminal segment follows the backing's field-only path; it does not identify an owned subtree or an escaping reference. The call's type, access, bounds, and overlap -checks remain required by [byte views](byte_views.md#calls-and-control-transfers). +checks remain required by [byte views](../../../../../../wiki/spec/terminal-psi/byte_views.md#calls-and-control-transfers). @@ -2887,9 +2900,10 @@ and its implication is its `requires` and `ensures`. | Row | Fields | | --- | --- | -| theorem contract | counted scalar formal declarations + counted requires propositions + counted ensures propositions | +| theorem contract | theorem hypothesis + counted theorem hypotheses | +| theorem hypothesis | counted scalar formal declarations + counted requires propositions + counted ensures propositions | | theorem parameter | owner machine id + `u32` proof position + theorem contract | -| theorem application | owner machine id + edge id + successor block id + proof source + counted fixed scalar subjects + counted premise obligation ids | +| theorem application | owner machine id + edge id + successor block id + proof source + counted fixed scalar subjects + counted premise obligation ids + counted theorem instantiations | | theorem supply | caller machine id + invocation site + `u32` proof position + proof source + counted certificate envelopes + counted theorem instantiations | | theorem instantiation | proof source + counted certificate envelopes | | proof source | `u8`: 1 + cited machine id; 2 + `u32` caller proof-formal position | @@ -2897,7 +2911,7 @@ and its implication is its `requires` and `ensures`. An application supplies every substituted premise on its edge. Only its unique ordinary successor may use the conclusions. The recorded subjects are captured scalar values or literals; this metadata grants no storage access or runtime -call. The [logical-hypothesis rule](../proofs/mathematical_bindings.md#logical-hypotheses-and-machine-use) +call. The [logical-hypothesis rule](../../../../../../wiki/spec/proofs/mathematical_bindings.md#logical-hypotheses-and-machine-use) requires the whole implication over arbitrary admitted subjects, even when a particular caller supplies a constant. @@ -2909,7 +2923,7 @@ mathematical type. Ordinary decoding checks each recorded judgment’s source, role and subjects, its invocation, and the actual certificate’s canonical encoding and declared type. Source-bound validation can replay the derivations. The receiving host authorizes the exact artifact and its assumption dependencies -under [publication and separate consumption](product.md#publication-and-separate-consumption). A forwarded supply names the caller's exact +under [publication and separate consumption](../../../../../../wiki/spec/terminal-psi/product.md#publication-and-separate-consumption). A forwarded supply names the caller's exact proof formal, carries no new derivation, and must have the same complete type. The selected theorem remains derivation provenance; it does not select runtime code or determine Strict proof identity. @@ -2923,6 +2937,18 @@ and a forwarded one names the caller's exact proof formal, carries no derivation and must have the same complete type as the cited machine's formal. An instantiation cannot itself be instantiated or name the cited machine. +A theorem contract's hypotheses are its own proof parameters, in its header +order; each is a contract with none of its own. Its complete type binds them +after its subjects and before its premises: +`Π subjects. Π hypotheses. Π premises. conclusion`. Each hypothesis's type +arrives with the declarations it names, appended after the subjects', so the +same contract always has the same type. A supply for such a parameter names a +machine whose own proof formals have exactly those contracts, in order, and +carries no instantiation; its derivations are unchanged. An application of such +a parameter carries one instantiation for each hypothesis, checked as a +supply's instantiation is against that hypothesis. Every other application +carries none. + ### Closed conformance applications The legacy `optional subject identity` below is not part of conformance @@ -3260,7 +3286,7 @@ outside this codec. | Envelope | Magic | `u16` marker | Vocabulary field | | --- | --- | --- | --- | -| semantic module | `PSITERM\0` | 293 | yes | +| semantic module | `PSITERM\0` | 300 | yes | | canonical artifact | `PSIART\0\0` | 3 | no | | debug map | `PSIDBG\0\0` | 1 | yes | | optimization execution | `PSIOEXE\0` | 2 | no | @@ -3305,7 +3331,7 @@ Emitted operations and return edges retain semantic site, operation ordinal, function-relative offset, and byte count. Metadata-only settlement rows have zero-byte intervals. This is replay/analysis provenance, not native instruction cost or runtime charging. Structural call placement must preserve the -[borrow identity contract](structural_access.md); +[borrow identity contract](../../../../../../wiki/spec/terminal-psi/structural_access.md); it cannot stage every borrowed parameter as an owned copy merely because the installation record can describe one. diff --git a/source-rust/subsystems/compiler/psi/artifact/wire/src/identity_formations.rs b/source-rust/subsystems/compiler/psi/artifact/wire/src/identity_formations.rs index 8e3d1e416acb..60b1f8f3c257 100644 --- a/source-rust/subsystems/compiler/psi/artifact/wire/src/identity_formations.rs +++ b/source-rust/subsystems/compiler/psi/artifact/wire/src/identity_formations.rs @@ -3,7 +3,7 @@ //! The catalog abstracts checked source subjects into ordinary mathematical //! lambdas. Decoding checks only the catalog's canonical shape: like every //! other carried mathematical certificate, it does not re-decide the encoded -//! judgment (`wiki/spec/terminal-psi/encoding.md`, mathematical certificates). +//! judgment (`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`, mathematical certificates). //! Source-bound receiving rechecks the signature in the kernel and requires //! real `Id` bodies; neither an opaque structural-equality row nor a Boolean //! comparison can stand in for this kernel type constructor. diff --git a/source-rust/subsystems/compiler/psi/artifact/wire/src/spec_tag_tables.rs b/source-rust/subsystems/compiler/psi/artifact/wire/src/spec_tag_tables.rs index f215dfdb3821..c3eb7f159dfd 100644 --- a/source-rust/subsystems/compiler/psi/artifact/wire/src/spec_tag_tables.rs +++ b/source-rust/subsystems/compiler/psi/artifact/wire/src/spec_tag_tables.rs @@ -1,6 +1,6 @@ /* -The tag tables in `wiki/spec/terminal-psi/encoding.md` are closed: a tag the -table omits must reject, and a tag it lists must decode. These tests read every +The tag tables in this crate's `encoding.md` are closed: a tag the table omits +must reject, and a tag it lists must decode. These tests read every marked table straight from the page and feed every `u8` to the codec's decoder for that space, so a codec tag the page does not list, or a page row the codec no longer accepts, fails here instead of surviving as silent drift. @@ -17,10 +17,7 @@ use crate::sections::debug_map; use crate::wire_fields::Field; use crate::wire_fields::wire::Reader; -const ENCODING_PAGE: &str = include_str!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/../../../../../../wiki/spec/terminal-psi/encoding.md" -)); +const ENCODING_PAGE: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/encoding.md")); /// Marked tables this test cannot drive, each with the reason. const UNCHECKED_TABLES: &[(&str, &str)] = &[( diff --git a/source-rust/subsystems/compiler/source-to-psi/driver/parse_source_batch/parsed_files.rs b/source-rust/subsystems/compiler/source-to-psi/driver/parse_source_batch/parsed_files.rs index b8fec8fb257b..19019a64d57d 100644 --- a/source-rust/subsystems/compiler/source-to-psi/driver/parse_source_batch/parsed_files.rs +++ b/source-rust/subsystems/compiler/source-to-psi/driver/parse_source_batch/parsed_files.rs @@ -105,7 +105,7 @@ impl SourceSyntax { /// loader met them. Resolution, typing and lowering number declarations, /// record types and identities in the order they meet root items, so /// without this the same program captured in another order publishes - /// other numbers (`wiki/spec/terminal-psi/encoding.md`, "Canonical + /// other numbers (`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`, "Canonical /// form": unordered sets are sorted by stable identity). Items keep their /// written order within a file. fn canonicalize_file_order( diff --git a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/README.md b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/README.md index 93eccad847ec..d822e595d3bf 100644 --- a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/README.md +++ b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/README.md @@ -793,7 +793,7 @@ the first slice of the clauses name it like any formal, and no runtime lane: Terminal Psi declares it in `MachineContract::erased_scalar_formals`, not in `parameters` or `parameter_order` - ([encoding](../../../../../../wiki/spec/terminal-psi/encoding.md): "Erased + ([encoding](../../../psi/artifact/wire/encoding.md): "Erased formals occupy no tag."). Its identity comes after the result pseudo-value; `Signature::formal_values` is the one numbering the reader and lowering share. diff --git a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/declare.rs b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/declare.rs index 4f5cbe04bd3c..ce57afa24b5f 100644 --- a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/declare.rs +++ b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/declare.rs @@ -7,7 +7,7 @@ it, and native admission compares it with the entry the Build bound. `wiki/spec/terminal-psi/product.md`: "Source-produced machine bodies retain a portable checked declaration identity: exact-owner callable and initial state, contract commitment, and optional specialization template/commitment." -`wiki/spec/terminal-psi/encoding.md` gives the row: the exact-owner machine, +`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md` gives the row: the exact-owner machine, initial state and semantic declaration, the parameter types, the callable and the result type as identity-table entries, the 32-byte contract commitment, and the published suspension and blocking Booleans. diff --git a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/lower.rs b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/lower.rs index 77197f174b24..812e15c6d0eb 100644 --- a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/lower.rs +++ b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/lower.rs @@ -796,7 +796,7 @@ impl Lowering<'_> { // The erased scalar formals come after the result pseudo-value. Each is // an invocation formal with a value identity and no runtime lane: // Terminal Psi declares it in the contract, not among the parameters - // (`wiki/spec/terminal-psi/encoding.md`: "Erased formals occupy no tag"). + // (`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`: "Erased formals occupy no tag"). for position in &signature.erased { let Some(ValueType::Scalar(scalar_type, _)) = signature.parameters.get(*position).copied() diff --git a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/tests/variant_parent_identity.rs b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/tests/variant_parent_identity.rs index 8ad19176f58a..bbe419872da6 100644 --- a/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/tests/variant_parent_identity.rs +++ b/source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/tests/variant_parent_identity.rs @@ -13,7 +13,7 @@ //! The lowered program records the owner in one way. Every case of every sum //! has its own `StructuralCaseId`, unique in the module, and a dispatch edge //! or a `Case` path step names a case by that id -//! (`wiki/spec/terminal-psi/encoding.md`: a `StructuralCase` terminator +//! (`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`: a `StructuralCase` terminator //! carries "edge id + target block id + case id + counted field ids" for //! each successor). So the id an arm carries is the whole statement of which //! sum it selects from, and the tests below require it to be an id of the diff --git a/source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/publication/mathematics.rs b/source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/publication/mathematics.rs index 7aaedef12994..a934be4b2fcc 100644 --- a/source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/publication/mathematics.rs +++ b/source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/publication/mathematics.rs @@ -1,5 +1,5 @@ //! Writes the judged mathematical signature into the Psi tables the encoding -//! specifies for it (`wiki/spec/terminal-psi/encoding.md`, "A mathematical +//! specifies for it (`source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`, "A mathematical //! carrier row"). //! //! Only the carrier table is written. Each data declaration gets one row that diff --git a/source-rust/subsystems/compiler/source-to-psi/tests/stage_source.rs b/source-rust/subsystems/compiler/source-to-psi/tests/stage_source.rs index 53057199f3a4..976686cac479 100644 --- a/source-rust/subsystems/compiler/source-to-psi/tests/stage_source.rs +++ b/source-rust/subsystems/compiler/source-to-psi/tests/stage_source.rs @@ -2336,7 +2336,7 @@ fn a_file_qualified_domain_still_requires_its_declared_carrier() { /// `b.omg`. One compilation captures and imports `a` before `b`, the other /// `b` before `a`; nothing else differs, so the published bytes must not. /// -/// `wiki/spec/terminal-psi/encoding.md`, "Canonical form": "Unordered sets +/// `source-rust/subsystems/compiler/psi/artifact/wire/encoding.md`, "Canonical form": "Unordered sets /// are strictly sorted by stable identity or canonical bytes". #[test] fn the_order_files_are_met_in_does_not_change_the_published_psi() { diff --git a/source/subsystems/compiler/source_to_psi/representations/symbol_resolved_trees/symbol_resolved_trees.omg b/source/subsystems/compiler/source_to_psi/representations/symbol_resolved_trees/symbol_resolved_trees.omg index 4988e54acb76..d729b4e3ff13 100644 --- a/source/subsystems/compiler/source_to_psi/representations/symbol_resolved_trees/symbol_resolved_trees.omg +++ b/source/subsystems/compiler/source_to_psi/representations/symbol_resolved_trees/symbol_resolved_trees.omg @@ -140,7 +140,7 @@ public data OverloadLinks [copy] { } // The primitive byte predicates over a byte view -// (wiki/spec/terminal-psi/byte_views.md, wiki/spec/terminal-psi/encoding.md): +// (wiki/spec/terminal-psi/byte_views.md, source-rust/subsystems/compiler/psi/artifact/wire/encoding.md): // `valid_utf8`, `no_nul`, `ascii_only` and `non_empty`. A declaration of the // same spelling is found first. public data BytePredicate [copy] { diff --git a/tests/fixtures/calls/run/scalar_contract_route_exit/linux_x86_64.md b/tests/fixtures/calls/run/scalar_contract_route_exit/linux_x86_64.md index b161b77173f3..906729b37515 100644 --- a/tests/fixtures/calls/run/scalar_contract_route_exit/linux_x86_64.md +++ b/tests/fixtures/calls/run/scalar_contract_route_exit/linux_x86_64.md @@ -21,7 +21,7 @@ It was published from commit `c5c47a53b080` with the change that introduced sema ## Historical wire specimen `linux_x86_64.pre_namespace.psi` records the saved program from -`43499fe37809c7318739414a97c86697028e4786` under semantic format marker 289. Format 290 retired that marker, and the encoding rejects older markers before reading their payload ([encoding](../../../../../wiki/spec/terminal-psi/encoding.md#machine-rows)). The codec and native regressions check that the specimen is refused that way, so its unqualified physical arrival never reaches native admission. +`43499fe37809c7318739414a97c86697028e4786` under semantic format marker 289. Format 290 retired that marker, and the encoding rejects older markers before reading their payload ([encoding](../../../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#machine-rows)). The codec and native regressions check that the specimen is refused that way, so its unqualified physical arrival never reaches native admission. The program was issued through source stages 00–07 using this directory's `main.omg`, the sorted top-level Omega sources in `source/library/core`, and diff --git a/wiki/README.md b/wiki/README.md index 53e8a1207ef9..2e31c9521f42 100644 --- a/wiki/README.md +++ b/wiki/README.md @@ -29,7 +29,7 @@ development artifacts working. This does not remove the current format discriminator or exact schema identity: incompatible bytes must reject rather than be interpreted under a new layout. Package pins, producer authorization, selected-provider identity and contracted runtime replacement are live correctness -mechanisms, not historical baggage. The [encoding contract](spec/terminal-psi/encoding.md) +mechanisms, not historical baggage. The [encoding contract](../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md) owns these requirements. A missing implementation, test or difficult repair stays with its owning task. @@ -118,7 +118,7 @@ public spellings. [structural claims and cleanup](spec/terminal-psi/ownership.md), [runtime callable dispatch](spec/terminal-psi/dynamic_dispatch.md), [observations](spec/terminal-psi/observations.md), - [encoding](spec/terminal-psi/encoding.md), + [encoding](../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md), [fact validity](spec/terminal-psi/fact_validity.md), [mathematical proof values](spec/terminal-psi/mathematical_values.md), and [integer certificates](spec/terminal-psi/integer_certificates.md). diff --git a/wiki/drafts/designs/deferred_callback_reach.md b/wiki/drafts/designs/deferred_callback_reach.md index 08ed57cad741..23e2e9bf5299 100644 --- a/wiki/drafts/designs/deferred_callback_reach.md +++ b/wiki/drafts/designs/deferred_callback_reach.md @@ -59,7 +59,7 @@ published summaries, library customers and existing suites before closing it. caller admission, evaluation and installation. A ceiling contributes no reach. 4. Carry the summaries through specialization and lowering without scanning source again. Update canonical identities and the - [reach encoding](../../spec/terminal-psi/encoding.md#deferred-static-reach-summaries), + [reach encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#deferred-static-reach-summaries), schema versions, wire tables and codecs together. Existing empty-bound metadata must never be silently reinterpreted as open. This docs change assigns no new wire tags and changes no serialized bytes. diff --git a/wiki/drafts/designs/proof_kernel_core_audit.md b/wiki/drafts/designs/proof_kernel_core_audit.md index 974a04717b1b..5e8d15f5428a 100644 --- a/wiki/drafts/designs/proof_kernel_core_audit.md +++ b/wiki/drafts/designs/proof_kernel_core_audit.md @@ -629,7 +629,7 @@ checked against the code but not built. | --- | --- | --- | --- | | L1 | **One term reader in stage 05.** One function reads an expression into a term at every position. `ClauseScope` supplies only what each name denotes there (a formal, the entry snapshot for `old`, the result, a field of the value being built). | the position axis: a term form served once is served in every clause, domain predicate, definition body and erased argument | readers per term form: 1; refusals that name a position: 0 | | L2 | **Four general term forms.** Add an application of a published declaration to argument terms, `Id` at a type, a constructor of a `data` case applied to its fields, and a projection of a field from a term. These are the four forms the old judge's term type had and `Proposition` lacks. The existing scalar, integer and float forms stay as the cases the arithmetic rules work on. | the operand axis: Identity for every type (C5), a call to a machine with no body, a definition with binders (C1) and a quotient relation (C10) become the same four forms, with one reader, one prover route (reflexivity, symmetry, transitivity, congruence, constructor injectivity) and one translation to the kernel | equality forms a new type needs: 0 | -| L3 | **One signature table in the lowered program**, written by stage 05 and checked once by stage 06 with `check_signature`. Publication fills the three tables the wire format already specifies (indexed theorem rows, mathematical carriers and the Id formation catalog with its shared certificate, [encoding](../../spec/terminal-psi/encoding.md)) from that one table. The wire format does not change: [Psi claim admission](psi_claim_admission.md) says "No codec retirement". An earlier version of this row replaced the three wire tables; a reviewer pointed out that they are ratified. | a table and a wire reader per construct | writers per declaration kind: 1 | +| L3 | **One signature table in the lowered program**, written by stage 05 and checked once by stage 06 with `check_signature`. Publication fills the three tables the wire format already specifies (indexed theorem rows, mathematical carriers and the Id formation catalog with its shared certificate, [encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md)) from that one table. The wire format does not change: [Psi claim admission](psi_claim_admission.md) says "No codec retirement". An earlier version of this row replaced the three wire tables; a reviewer pointed out that they are ratified. | a table and a wire reader per construct | writers per declaration kind: 1 | | L4 | Done in #5715: **a shape the kernel cannot translate is refused.** `MathematicalCoreDecision` has only `Judged`; every translation error refuses the certificate. | a second basis of trust that nobody measures | accepted without the kernel's judgment: 0 | | L5 | **Typed identities in `ProofTerm`** in place of `type_identity: String`. | decisions keyed on text | text keys in `ProofTerm`: 0 | diff --git a/wiki/drafts/designs/self_hosting_layers.md b/wiki/drafts/designs/self_hosting_layers.md index c181629dd0ff..040ea1f59c1f 100644 --- a/wiki/drafts/designs/self_hosting_layers.md +++ b/wiki/drafts/designs/self_hosting_layers.md @@ -123,7 +123,7 @@ are an optimization to add only if measured compilation time requires them. Everything before Terminal Psi has a Rust counterpart and everything after does not. Under matched identity allocation, lowering and selected Psi optimization profiles, byte-identical PSITERM is a useful differential check. -The [encoding contract](../../spec/terminal-psi/encoding.md#canonical-form) +The [encoding contract](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#canonical-form) canonicalizes one module; it does not require independent frontends to choose that same module. [Selected optimization](../../spec/terminal-psi/product.md#optimization-ordering) may also change it. When modules differ, inspect the decoded difference and diff --git a/wiki/drafts/reference/deleted_checker_full_read/crosscheck/G06a.md b/wiki/drafts/reference/deleted_checker_full_read/crosscheck/G06a.md index 1c09d2d728f9..6c34330aaa6e 100644 --- a/wiki/drafts/reference/deleted_checker_full_read/crosscheck/G06a.md +++ b/wiki/drafts/reference/deleted_checker_full_read/crosscheck/G06a.md @@ -32,7 +32,7 @@ Two old surfaces, descriptor-table operations and activation-storage Establish/S | Rule | What the old code did (where) | What you searched | Your reading | |---|---|---|---| -| L27 Descriptor-table operations have fixed operand/result shapes and exactly their MachineControl service | Own table plus service lookup (esc:382-407; calls.rs:1985-2055; control.rs:4609-4620) | `DescriptorTable`, `GlobalDescriptorTable`, `descriptor table` across `source-to-psi` and `wiki/spec`. It appears only in `wiki/spec/terminal-psi/encoding.md:1005` and native-compiler crates (`psi-to-native/representations/target-operations/src/operations.rs`). There is no sealed intrinsic in `foundation/language-core/src/sealed_intrinsics.rs:78-86` and no stage 05 producer. | Cannot tell. Most likely no source construct reaches it, so a program using it would meet a generic refusal (for example "intrinsic selection", `S05/src/read/calls.rs:607`). If a library boundary call stands in for it, the boundary rules apply. The fixed-shape rule itself is not checked in the source compiler. | +| L27 Descriptor-table operations have fixed operand/result shapes and exactly their MachineControl service | Own table plus service lookup (esc:382-407; calls.rs:1985-2055; control.rs:4609-4620) | `DescriptorTable`, `GlobalDescriptorTable`, `descriptor table` across `source-to-psi` and `wiki/spec`. It appears only in `source-rust/subsystems/compiler/psi/artifact/wire/encoding.md:1005` and native-compiler crates (`psi-to-native/representations/target-operations/src/operations.rs`). There is no sealed intrinsic in `foundation/language-core/src/sealed_intrinsics.rs:78-86` and no stage 05 producer. | Cannot tell. Most likely no source construct reaches it, so a program using it would meet a generic refusal (for example "intrinsic selection", `S05/src/read/calls.rs:607`). If a library boundary call stands in for it, the boundary rules apply. The fixed-shape rule itself is not checked in the source compiler. | | L29 Activation-storage Establish/Split need a storage bound; Release has no result | Contract lookup (calls.rs:2272-2346; control.rs:4609-4620) | `ActivationStorage`, `EstablishActivationClaim`, `activation storage`. The validator `PSEM/storage/activation_storage.rs:13-107` checks claim shape (exact closed bound, two outcomes, one linear claim), and `source-rust/subsystems/compiler/source-to-psi/representations/checked-program/checked_program.rs:332` runs it on every published module. No stage 05 code emits `EstablishActivationClaim`. | Likely enforced at Psi level but unreachable from source today. The Establish bound is checked; nothing checks Split or Release. | | L44 A call inside a transition guard may not complete a transition arm | `validation::transition_call_target` (control.rs:1691-1703) | `guard` with `call` in `S05/src/read/transitions.rs`, and the evaluation-order section of `S05/README.md:984-1010`. Guards lower as ordinary expressions whose calls are operations. | Cannot tell, leaning towards no longer applicable: the lowering treats a guard's call as an operation that runs before the arm, so a guard call cannot "complete" the arm. I found no explicit refusal. | diff --git a/wiki/drafts/reference/terminal_no_normal_invocations.md b/wiki/drafts/reference/terminal_no_normal_invocations.md index b83b2065edd2..29219935cca8 100644 --- a/wiki/drafts/reference/terminal_no_normal_invocations.md +++ b/wiki/drafts/reference/terminal_no_normal_invocations.md @@ -26,4 +26,4 @@ completion promise or authority. The owning representation is [Terminal control flow](../../../omega-rust/psi/compilation/representations/terminal-psi/src/terminal_module/control_flow/termination.rs). Its canonical wire marker is documented in -[encoding](../../spec/terminal-psi/encoding.md). +[encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md). diff --git a/wiki/spec/build/optimizations.md b/wiki/spec/build/optimizations.md index cf924d88eaaf..22782f51d0f5 100644 --- a/wiki/spec/build/optimizations.md +++ b/wiki/spec/build/optimizations.md @@ -92,7 +92,7 @@ unoptimized check's module unchanged. Publication retains the exact Psi selection and the input and output semantic identities in the -[optimization execution](../terminal-psi/encoding.md#optimization-execution) +[optimization execution](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#optimization-execution) record. Decoding checks the recorded output identity against the published semantics. Those identities are not the lowered-form verdict. Proof identities remain internal validation provenance. Empty execution may claim only equal diff --git a/wiki/spec/terminal-psi/calls_and_outcomes.md b/wiki/spec/terminal-psi/calls_and_outcomes.md index 45794d2d03d7..094745b65a14 100644 --- a/wiki/spec/terminal-psi/calls_and_outcomes.md +++ b/wiki/spec/terminal-psi/calls_and_outcomes.md @@ -89,12 +89,12 @@ The caller's operand types remain unchanged. Predicate and routed scalar domains retain their declared theory in the same catalog. Establishment additionally names a checked completion under the -[retained origin rules](encoding.md): a predicate is the exact +[retained origin rules](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md): a predicate is the exact destination invariant proved on every actual arrival, while an issuer route must independently match the checked callable or closed conformance. Neither a predicate-free tag coercion nor a proved predicate grants issuer authority. A child addition accounts for its ancestors on the same incoming argument under the -[scalar completion rules](encoding.md#scalar-completion-prerequisites). Short and +[scalar completion rules](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#scalar-completion-prerequisites). Short and explicit source spellings carry the same normalized obligations. Qualified scalar formals and results retain their predicates in the ordinary entry and result contracts; missing predicates reject before those contracts @@ -117,7 +117,7 @@ the destination's memberships; a matching structural type alone does not. `value as +D` and `value as -D` on a structural value are the only changes. Each is a successor edge into a fresh block parameter, named by one structural -qualification change row ([encoding](encoding.md)). A change strictly adds or +qualification change row ([encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md)). A change strictly adds or strictly erases whole-value domains and keeps every projected membership. An added domain with issuer routes names the route the enclosing callable issues it by, matched against that callable's checked declaration exactly as a scalar diff --git a/wiki/spec/terminal-psi/dynamic_dispatch.md b/wiki/spec/terminal-psi/dynamic_dispatch.md index 78443161093d..e0133ba852cd 100644 --- a/wiki/spec/terminal-psi/dynamic_dispatch.md +++ b/wiki/spec/terminal-psi/dynamic_dispatch.md @@ -137,7 +137,7 @@ verification rejects forged descriptors, stale openings, mismatched witnesses, wrong contracts and missing custody transfers. The interpreter and native realization must agree, including mutable referent writes and returned loans. -The [encoding contract](encoding.md) records current wire forms separately from +The [encoding contract](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md) records current wire forms separately from this ratified target. Implement producer, codec, interpreter, verifier and native consumers together; do not silently reinterpret legacy selector-table bytes as machine values or invent unsupported operation tags in documentation. diff --git a/wiki/spec/terminal-psi/fact_validity.md b/wiki/spec/terminal-psi/fact_validity.md index c658c3bafa2a..632f25aefab7 100644 --- a/wiki/spec/terminal-psi/fact_validity.md +++ b/wiki/spec/terminal-psi/fact_validity.md @@ -3,7 +3,7 @@ These rules decide when a fact may justify a later obligation in Terminal Psi. Psi checking applies them when it discharges operation, call, crash-site and arrival obligations; the Omega optimizer applies them when it consumes checked -facts. See the [product](product.md), [encoding](encoding.md), and +facts. See the [product](product.md), [encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md), and [observation](observations.md) contracts. Runtime cycles follow [control flow and ranking](control_flow.md). diff --git a/wiki/spec/terminal-psi/product.md b/wiki/spec/terminal-psi/product.md index 480f0315df47..b92d21a2e019 100644 --- a/wiki/spec/terminal-psi/product.md +++ b/wiki/spec/terminal-psi/product.md @@ -195,7 +195,7 @@ The portable envelope retains canonical semantics, contracts, mathematical claims, exact subjects, selected operations, assumptions and dependencies. It also retains pre-Terminal selection provenance and optional debug information. The existing mathematical-certificate forms remain carried and canonically -decoded as specified by [encoding](encoding.md#mathematical-certificate). +decoded as specified by [encoding](../../../source-rust/subsystems/compiler/psi/artifact/wire/encoding.md#mathematical-certificate). Their presence grants no truth, execution authority or producer trust, and receipt does not require kernel replay. Local source proving keeps its kernel.