Skip to content

tb-encode: admission codec + strength-attenuation lemma (self-modification gate, Kani-proven)#91

Open
bahadirarda wants to merge 3 commits into
mainfrom
verify-admit-codec
Open

tb-encode: admission codec + strength-attenuation lemma (self-modification gate, Kani-proven)#91
bahadirarda wants to merge 3 commits into
mainfrom
verify-admit-codec

Conversation

@bahadirarda

Copy link
Copy Markdown
Contributor

What

The pure, host-verifiable value layer of the capability-gated self-modification protocol (docs/cogi-cognitive-architecture.md / cogi-substrate-architecture.md) — the Phase-0 foundation for admitting a proposed organ/skill into a running Yuva.

  • AdmissionRequest (untrusted proposer's ask): organ/witness/spec content digests, claimed strength, proposer id, effect mask, budget. ADMIT_REQ_LEN=117, total LE codec.
  • AdmissionVerdict (trusted verifier plane's decision): admit XOR reject + the granted, attenuated strength & rights, folded into provenance. ADMIT_VERDICT_LEN=86, total LE codec.
  • strength_attenuate — the trust-lattice analogue of tb_caps_core::Rights::intersect: the granted strength is the weaker of claimed vs warranted (PROVEN=1 .. EMPIRICAL=4); out-of-range clamps fail-closed to EMPIRICAL. EMPIRICAL evidence can never be laundered into a PROVEN grant.

#![no_std] + forbid(unsafe_code) + zero-dep, so cargo kani -p tb-encode model-checks the exact bytes the kernel would admit.

Proofs (all VERIFICATION: SUCCESSFUL, local cargo kani -p tb-encode)

harness property
kani_admit_req_roundtrip decode(encode(r)) == r over the full symbolic request
kani_admit_verdict_roundtrip decode(encode(v)) == v over the full symbolic verdict
kani_strength_attenuate_never_inflates c,w ∈ u8×u8: result is a valid level and >= both clamped inputs (the monotone never-inflate lemma)

Each harness carries a negative-control note (the concrete code break that turns it FAILED).

Honesty / scope

The four strengths are not interchangeable and are documented as such: only PROVEN (Kani/CBMC) is actually sound; CONFORMANCE is a single test vector; EFFECT_BOUNDED is as strong as its spec; EMPIRICAL is evidence for a human. The codec also notes the standing caveat that a sound proof of a proposer-authored spec still admits an unsafe organ — the spec must originate in / be countersigned by the trusted ring.

Not yet wired into the kernel boot path — this is the value foundation only; the in-kernel admit-dispatch + witness marker land in a follow-up.

No behavioural change to any existing organ; net-new module, additive only.

…ation gate)

The pure, host-verifiable value layer of the capability-gated self-modification
protocol (docs/cogi-cognitive-architecture.md): an untrusted proposer submits an
AdmissionRequest (organ + witness + spec digests, claimed strength, effect mask,
budget); the trusted verifier plane answers with an AdmissionVerdict (admit XOR
reject + the GRANTED, attenuated strength & rights). Two fixed-layout LE codecs
(ADMIT_REQ_LEN=117, ADMIT_VERDICT_LEN=86), total decoders, no unsafe, zero dep.

strength_attenuate() is the trust-lattice analogue of Rights::intersect: the
granted strength is the WEAKER of claimed vs warranted (PROVEN=1 .. EMPIRICAL=4),
out-of-range clamps fail-closed to EMPIRICAL. So EMPIRICAL evidence can never be
laundered into a PROVEN grant.

Kani (cargo kani -p tb-encode), all SUCCESSFUL:
  * kani_admit_req_roundtrip        - decode(encode(r)) == r, full symbolic input
  * kani_admit_verdict_roundtrip    - decode(encode(v)) == v
  * kani_strength_attenuate_never_inflates - forall c,w in u8xu8: result is a valid
    level AND >= both clamped inputs (the monotone never-inflate lemma)

Not yet wired into the kernel boot path; this is the Phase-0 value foundation.
Yuva is agent-agnostic (docs/spec/yuva-abi-v1.md §8); the module doc must not name
a specific resident agent. Describe the admission gate generically instead.
…35 -> 138)

The prove-encode shards fail closed unless the four pinned lists sum to
EXPECTED_HARNESSES_TOTAL == the proofs.rs '#[kani::proof]' count. Adding the
admission codec harnesses without this lockstep edit left the count at 135 vs
138 in source, so every shard reported the guard failure. Route the three cheap
value-layer harnesses (kani_admit_req_roundtrip / kani_admit_verdict_roundtrip /
kani_strength_attenuate_never_inflates, all <2.5s local) into shard A next to the
thematically-adjacent attest codec, and bump the pin + shard-A count.

SHARD GUARD: OK -- A=58 + B=36 + C=9 + D=35 == 138 == proofs.rs count.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant