Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions OWNER_QUESTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,7 @@ it instantiates. A reviewer verifies those citations before the framing.

## Open questions

### 1. Does a data `requires` over an atomic field bound the value the atomic cell holds?

- **Customer:** Lock-free counters with a standing ceiling: a semaphore whose permit count never exceeds its capacity, a ring index that stays below the buffer length, a reference count with a maximum. Each wants a load to yield a bounded value (so `100 - observed` is Exact) and each store or read-modify-write to prove the bound, without a lock. The A–F facts families `atomic_bounded_fetch` and `atomic_bounded_resident` (38 programs) are written this way: `data Cell requires value <= 100 { value: AtomicU32; }`.
- **Contracts checked:** [concurrency, atomic operations](wiki/spec/language/concurrency.md#atomic-operations) (atomics are dedicated core types, not implicitly atomic integers; operation contracts own every atomic event), [access policies](wiki/spec/resources/access.md) (atomic resident lifecycles and matching rules), [data and literals, case constraints](wiki/spec/language/data_and_literals.md) (default-domain clauses over fields), and `source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/read/bodies/atomics.rs` (an atomic cell is a record type in clause reading, so `value <= 100` has no scalar side and is refused as "anonymous integer literal without an expected type").
- **Ambiguity:** No page says what a predicate over an atomic field means. Read as a standing bound on the resident value, every atomic event on that cell (store, swap, fetch, compare-exchange) must prove the new value keeps it, and every load may assume it. That gives atomic operations a proof obligation the concurrency page does not list. Read as a predicate over the cell itself, `value <= 100` compares a non-scalar and is ill-typed. The checker currently refuses these programs as unsupported, so neither reading is enforced.
- **Options:**
1. **A data predicate over an atomic field bounds its resident value (recommended):** each atomic event that writes the cell proves the written value satisfies the clause. A load, and the prior value a fetch or swap returns, carries it. Zero initialization must satisfy it like any other construction.
2. **Bound the operand type instead:** reject predicates over atomic fields. A standing bound is spelled on the cell's value type, for example an atomic over `u32 in AtMost<100>`, and atomic operations take and return that qualified type.
3. **Reject both:** atomics carry no standing bounds. Programs prove ranges from each observation's own contract.
- **Status:** Raised from the A–F facts shard (2026-12-03); awaiting Zac + Jarod ruling.

### 2. Must a count/address `as` cast rest on a stated address model, or may the checker use the address width its route already has?
### 1. Must a count/address `as` cast rest on a stated address model, or may the checker use the address width its route already has?

- **Customer:** Code that turns a number into an address or back: a kernel building a physical address from a page-table entry, a memory scanner converting a scanned address to a `u64` to print or store it, an allocator computing a region's end. [Cathedral](https://github.com/CathedralOS/Cathedral)'s physical-address conversions and Squalr's scan results both do this. The probes `samples/cli/probes/exact_address_conversion` and `samples/cli/probes/address_model_package` write `requires address::Bound == 18446744073709551616` on every machine that converts, including the program entry.
- **Contracts checked:** [counts and addresses, separate roles](wiki/spec/language/counts_and_addresses.md#separate-roles) ("No global width equality or ordering relates counts to addresses … Interpreting a count as address geometry requires an occurrence-specific fit proof"), [bounds and lowering](wiki/spec/language/counts_and_addresses.md#bounds-and-lowering) ("Exact narrowing requires positive evidence that the value fits"), [carrier casts](wiki/spec/language/domains.md#carrier-casts) ("exact widening, or narrowing with representability proved"), [integer certificates](wiki/spec/terminal-psi/integer_certificates.md) (`IntegerCarrierBound`: for an `address` value "accept `0 <= value` independently of target selection. Its mathematical form bounds `MathValue` by the exact retained carrier endpoints, including an address model's width"), and the checker's own contract test `a_clause_states_the_address_bound_as_a_mathematical_integer` ("true at the width the route gives `address`, false at any other").
Expand All @@ -87,7 +76,7 @@ it instantiates. A reviewer verifies those citations before the framing.
3. **Counts and addresses never convert by `as`:** conversions go through named core machines with explicit contracts. The probes and the ports are rewritten.
- **Status:** Raised from the address-cast work (2026-12-04). The compiler implements option 1 because it follows from the carrier the lowered form already has and accepts no conversion that changes a value; option 2 would later refuse programs option 1 accepts. Awaiting Zac + Jarod ruling.

### 3. May a binding that holds a view be reassigned a view of a different input lifetime?
### 2. May a binding that holds a view be reassigned a view of a different input lifetime?

- **Customer:** Code that walks between borrowed inputs with one cursor: a parser that switches from a header buffer to a body buffer, a lookup that falls back from a primary table to a default table, a helper that picks the shorter of two slices and keeps reading through one name. The facts family `shared_byte_view_rebinding` (18 programs) is written this way: `machine replace(mutable selected: @[u8], replacement: @[u8]) -> u8 { selected = replacement; selected[0] }`, with each input carrying its own elided lifetime.
- **Contracts checked:** [lifetimes, returned views](wiki/spec/language/lifetimes.md#returned-views) (elided input lifetimes are separate candidates; "Matching lifetime spellings never authorize returning unrelated storage"), [lifetimes, carried-loan transport](wiki/spec/language/lifetimes.md#carried-loan-transport) ("Assignment evaluates the replacement while old loans stay active, ends the overwritten field's carried loans, and installs the replacement's loans"), [state contracts, contract inputs and working values](wiki/spec/language/state_contracts.md#contract-inputs-and-working-values) (a `mutable` parameter is a working binding), and stage 05 `read/storage/regions/regions.rs` `agrees` ("An annotated local with an elided lifetime thus retains its initializer's region"), which refuses with "nothing relates two lifetimes of one machine".
Expand All @@ -99,7 +88,7 @@ it instantiates. A reviewer verifies those citations before the framing.

<a id="atomic-publication-sequences"></a>

### 4. When a third participant advances an atomic flag, does the flag still publish the original payload?
### 3. When a third participant advances an atomic flag, does the flag still publish the original payload?

A producer fills a queue slot, then publishes its ready flag. A helper advances the flag to show that it claimed the slot. Can a consumer that sees the helper's change rely on the payload the producer wrote?

Expand Down
5 changes: 5 additions & 0 deletions TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ Find Rust owners in the [compiler map](source-rust/README.md#where-code-belongs)
- Support `terminates by <register> -> <View>` on nested `asm machine` blocks across parsing, Stage 05 lowering, and Stage 06 backedge descent checking, keeping enclosing ordinary Omega machine headers free of assembly registers.
- Move `terminates by` onto `asm machine loop` in `checked_asm_rank_decrease`, and add `terminates by` clauses on `asm machine loop` in `checked_asm_countdown` and `checked_asm_zero_branch`.

- **ATOMIC-DOMAIN-RESIDENT.** Implement the ratified `Atomic<T>` domain-qualified resident-value contract in [atomic operations](wiki/spec/language/concurrency.md#atomic-operations) and [data constraints](wiki/spec/language/data_and_literals.md).
- Parameterize builtin atomics as `Atomic<T>` over admitted hardware atomic scalar carriers (`bool`, `i8`/`i16`/`i32`/`i64`, `u8`/`u16`/`u32`/`u64`, optionally qualified `in D`), keeping `AtomicBool`/`AtomicI8`–`AtomicI64`/`AtomicU8`–`AtomicU64` as unqualified shorthands and rejecting non-hardware widths (`u23`, `u69`) and non-atomic types.
- Enforce `T`'s domain on zero-initialization, `store`, `swap`, `compare_exchange`, and RMW `fetch_*` (requiring proof that the post-state stays in `T`'s domain for every prior `old: T`), and return `T` with its domain on `load` and prior-value results.
- Reject `data requires` scalar predicates written directly against atomic cell fields as ill-typed, and rewrite the 38 `atomic_bounded_fetch` and `atomic_bounded_resident` samples onto `Atomic<u32 in AtMost<100>>`.

## Rust compiler release closure

- **WINDOWS-ARM64-TARGET.** The owner ruled on 2026-11-23 that `windows_arm64` (Windows on AArch64, PE/COFF) is the fifth hosted target. Make the compiler produce working Windows ARM64 programs by generalizing the existing AArch64 ([target-aarch64](source-rust/subsystems/compiler/psi-to-native/targets/target-aarch64)) and Windows PE ([image-pe](source-rust/subsystems/compiler/psi-to-native/pipeline/15_objects-to-image/image-pe)) mechanisms, not by copying them. Follow [calling plans](wiki/spec/build/calling_plans.md), [entry roots](wiki/spec/build/entry_roots.md), [provider selection](wiki/spec/build/provider_selection.md#build-owned-target-selection) and [foreign bindings](wiki/spec/build/foreign_bindings.md).
Expand Down
27 changes: 26 additions & 1 deletion wiki/spec/language/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,32 @@ ownership are tracked independently.

## Atomic operations

Atomics are dedicated core types, not ordinary integers made implicitly atomic.
Atomics are dedicated core storage cells, not ordinary integers made implicitly
atomic. `Atomic<T>` parameterizes an atomic cell by its resident value type `T`,
which must have an admitted hardware atomic scalar carrier (`bool`, `i8`, `i16`,
`i32`, `i64`, `u8`, `u16`, `u32`, or `u64`), optionally qualified by a domain
(`T in D`, such as `Atomic<u32 in AtMost<100>>`). `AtomicBool`,
`AtomicI8`–`AtomicI64`, and `AtomicU8`–`AtomicU64` are unqualified shorthands
for `Atomic<bool>`, `Atomic<i8>`–`Atomic<i64>`, and `Atomic<u8>`–`Atomic<u64>`.
Non-hardware integer widths (such as `u23` or `u69`), aggregates, and other
non-atomic types reject: arithmetic capability never creates hardware support,
and Omega never widens a carrier or inserts hidden software locks.

Standing invariants over an atomic cell's resident value belong on `T`'s domain,
never on an enclosing `data` declaration's `requires` clause:

- Zero-initialization and construction must prove the initial value satisfies
`T`'s domain.
- `load` returns `T` (preserving its domain); `store`, `swap`, and
`compare_exchange` take `T` and return displaced or prior values in `T`.
- Read-modify-write `fetch_*` operations are permitted on `Atomic<T>` only when
the operation proves the resulting value stays in `T`'s domain for every
possible prior value in `T` (for example, `fetch_and(mask)` preserves
`AtMost<100>`, while an unbounded `fetch_add` on `AtMost<100>` rejects in
favor of a checked `compare_exchange` loop).
- Borrowing an atomic field yields `@Atomic<T>`, preserving `T`'s domain so no
callee can bypass the standing bound through an unconstrained `@AtomicU32`.

Generic code uses one sealed core requirement per primitive operation, shared by
ordinary atomics and admitted accessors:

Expand Down
6 changes: 5 additions & 1 deletion wiki/spec/language/data_and_literals.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,11 @@ Above, `self.lo` and `self.hi` are legal because the preceding conjunct
establishes the Range case. Inactive payloads cannot be projected, and a
predicate cannot assume the default domain it is proving to justify its own
terms. A field's qualification constrains that field, not the enclosing sum's
case.
case. A `data requires` clause cannot write a scalar predicate directly against
an atomic cell field (such as `value <= 100` for `value: AtomicU32`), because an
atomic cell is a concurrently mutable storage cell rather than a scalar; put
standing bounds on the atomic's domain-qualified value type (`Atomic<u32 in D>`)
instead ([atomic operations](concurrency.md#atomic-operations)).

This adds no case-local generics or hidden existential binders. A conformance
obligation never selects an implementation or creates evidence; ordinary
Expand Down
Loading