Skip to content

Commit 2054e53

Browse files
committed
Verify YAML structural key identities
1 parent cd1c3bb commit 2054e53

8 files changed

Lines changed: 4474 additions & 6 deletions

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ explicit Verus verification targets rather than delegated to an external YAML pa
6767
| Content-addressed artifact identity | Verified SHA-256, complete canonical codec, typed algorithm dispatch, checksum-pinned NIST vectors, and integrity checks; object store pending |
6868
| Evidence and provenance graph | Verified structural admission, append-only/idempotent transitions, borrowed retries, normative edge direction, and atomic multi-input derivations; persistence pending |
6969
| Trusted-boundary enforcement | Verified scanner/reconciliation, approved baseline, and CI known-defect fixture |
70-
| Crucible YAML implementation | Verified profile-1 UTF-8/BOM decoding, bounded lexical atoms, exact line/indentation layout, lossless structural candidates, authenticated context-sensitive quoted/plain/block scalars, completed YAML token formation, and nonrecursive CST parsing for the complete presentation grammar. The CST retains six exact document regions and all trivia, binds properties/scalars/markers/entries to exact syntax ownership, enforces block/flow grammar and caller-lowered limits with typed first-impossible diagnostics, and has a total fueled pure model with strict progress, determinism, child-before-parent acyclicity, adversarial anti-forgery proofs, and exact executable correspondence. Semantic resolution now has verified YAML 1.2.2 Core plain-scalar classification, host-width-independent decimal/octal/hex integer conversion into one canonical arbitrary-width magnitude, exact finite-decimal conversion into canonical arbitrary-width coefficient and signed-exponent digits, canonical signed-infinity/NaN conversion, semantic decoding for all five scalar styles, authenticated CST-node dispatch, complete scalar-value composition, complete collection-tag composition for implicit Core, explicit standard, non-specific, and losslessly retained custom tags, document-scoped explicit tag-property resolution, presentation-ordered anchor/alias binding with exact Unicode shadowing and document reset, a bounded exact semantic-topology projection retaining every document root, CST node identity/range, sequence edge, and mapping edge, exact scalar-table population covering every scalar/empty CST node with aggregate decoded-content accounting, an owned semantic node table assigning every CST node exactly one scalar, collection, or alias slot with exact collection values and alias redirects, exact alias-cycle rejection with proved strictly descending graph edges, per-node semantic depths, visit completion, and a retained deepest path, and collision-free canonical byte identities for every resolved scalar with complete custom-tag identity and byte provenance. These machines retain exact source ranges, exclude YAML 1.1 coercions and host numeric rounding, enforce caller-lowered limits at exact source anchors, and prove executable-to-pure correspondence. Collection structural-key identity, duplicate/merge-key handling, lowering, schema validation, canonical serialization, and self-fuzzing remain committed work |
70+
| Crucible YAML implementation | Verified profile-1 UTF-8/BOM decoding, bounded lexical atoms, exact line/indentation layout, lossless structural candidates, authenticated context-sensitive quoted/plain/block scalars, completed YAML token formation, and nonrecursive CST parsing for the complete presentation grammar. The CST retains six exact document regions and all trivia, binds properties/scalars/markers/entries to exact syntax ownership, enforces block/flow grammar and caller-lowered limits with typed first-impossible diagnostics, and has a total fueled pure model with strict progress, determinism, child-before-parent acyclicity, adversarial anti-forgery proofs, and exact executable correspondence. Semantic resolution now has verified YAML 1.2.2 Core plain-scalar classification, host-width-independent decimal/octal/hex integer conversion into one canonical arbitrary-width magnitude, exact finite-decimal conversion into canonical arbitrary-width coefficient and signed-exponent digits, canonical signed-infinity/NaN conversion, semantic decoding for all five scalar styles, authenticated CST-node dispatch, complete scalar-value composition, complete collection-tag composition for implicit Core, explicit standard, non-specific, and losslessly retained custom tags, document-scoped explicit tag-property resolution, presentation-ordered anchor/alias binding with exact Unicode shadowing and document reset, a bounded exact semantic-topology projection retaining every document root, CST node identity/range, sequence edge, and mapping edge, exact scalar-table population covering every scalar/empty CST node with aggregate decoded-content accounting, an owned semantic node table assigning every CST node exactly one scalar, collection, or alias slot with exact collection values and alias redirects, exact alias-cycle rejection with proved strictly descending graph edges, per-node semantic depths, visit completion, and a retained deepest path, collision-free canonical byte identities for every resolved scalar, and recursive canonical structural identities for every semantic node. Structural identity is alias-transparent, sequence-order-sensitive, mapping-order-insensitive, custom-tag-complete, length-delimited, provenance-retaining, and produced by a verified iterative bottom-up merge sort under independent record, key-byte, aggregate-byte, and mapping-scratch caps. These machines retain exact source ranges, exclude YAML 1.1 coercions and host numeric rounding, enforce caller-lowered limits at exact source anchors, and prove executable-to-pure correspondence. Duplicate/merge-key handling, lowering, schema validation, canonical serialization, and self-fuzzing remain committed work |
7171
| Execution and evidence core | Not yet implemented |
7272
| Bug-finding engines and target adapters | Planned in staged phases |
7373

‎ROADMAP.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ Current work establishes and extends:
144144
lowered record, per-key byte, and aggregate-byte limits; allocation-free streaming over retained
145145
scalar/tag content; total executable-to-pure correspondence; and public exact-result proof
146146
contracts;
147+
- verified canonical structural-key identities over every semantic node, reusing exact scalar
148+
identities, making aliases byte-for-byte transparent, preserving sequence order, ignoring
149+
mapping presentation order through a verified iterative bottom-up merge sort over canonical
150+
key/value pairs, and retaining complete custom collection-tag identity; one exact record per
151+
node, explicit markers and length delimiters, exact per-code-point custom-tag provenance and
152+
per-byte child provenance, independently caller-lowered record/per-key/aggregate/mapping-sort
153+
caps at exact node anchors, total executable-to-pure correspondence, public exact-result proof
154+
contracts, all mapping permutations, nested collection-key, alias, and exact-boundary fixtures;
147155
- verified trusted-boundary scanning, ledger/approval reconciliation, and code CI.
148156

149157
Exit requires every Phase 0 implementation and acceptance criterion in the design specification;

‎crates/crucible-yaml/src/lib.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub mod resolve;
1111
pub mod resolve_alias_cycle;
1212
pub mod resolve_anchor;
1313
pub mod resolve_canonical_scalar_key;
14+
pub mod resolve_canonical_structural_key;
1415
pub mod resolve_collection_tag;
1516
pub mod resolve_float;
1617
pub mod resolve_integer;
@@ -84,6 +85,15 @@ pub use resolve_canonical_scalar_key::{
8485
MAX_PROFILE1_CANONICAL_SCALAR_KEY_RECORDS, MAX_PROFILE1_TOTAL_CANONICAL_SCALAR_KEY_BYTES,
8586
};
8687

88+
pub use resolve_canonical_structural_key::{
89+
canonical_structural_key_limits, compose_profile1_canonical_structural_keys,
90+
CanonicalStructuralKeyError, CanonicalStructuralKeyErrorKind, CanonicalStructuralKeyLimits,
91+
CanonicalStructuralKeyRecord, CanonicalStructuralKeySource,
92+
CANONICAL_STRUCTURAL_KEY_TRANSFORMATION_VERSION, MAX_PROFILE1_CANONICAL_STRUCTURAL_KEY_BYTES,
93+
MAX_PROFILE1_CANONICAL_STRUCTURAL_KEY_RECORDS, MAX_PROFILE1_MAPPING_SORT_ENTRIES,
94+
MAX_PROFILE1_TOTAL_CANONICAL_STRUCTURAL_KEY_BYTES,
95+
};
96+
8797
pub use resolve_anchor::{
8898
resolve_profile1_anchor_aliases, AliasBinding, AnchorAliasError, AnchorAliasErrorKind,
8999
AnchorAliasLimits, AnchorAliasSource, AnchorDeclaration, ANCHOR_ALIAS_RESOLUTION_VERSION,

‎crates/crucible-yaml/src/resolve_canonical_scalar_key.rs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl View for CanonicalKeyByte {
173173
}
174174

175175
impl CanonicalKeyByte {
176-
fn new(value: u8, source_byte_offset: u64) -> (byte: Self)
176+
pub(crate) fn new(value: u8, source_byte_offset: u64) -> (byte: Self)
177177
ensures
178178
byte@ == (CanonicalKeyByteView { value, source_byte_offset }),
179179
{
@@ -201,7 +201,10 @@ pub open spec fn canonical_key_byte_views_spec(values: Seq<CanonicalKeyByte>) ->
201201
Seq::new(values.len(), |index: int| values[index]@)
202202
}
203203

204-
proof fn lemma_canonical_key_byte_views_push(values: Seq<CanonicalKeyByte>, value: CanonicalKeyByte)
204+
pub(crate) proof fn lemma_canonical_key_byte_views_push(
205+
values: Seq<CanonicalKeyByte>,
206+
value: CanonicalKeyByte,
207+
)
205208
ensures
206209
canonical_key_byte_views_spec(values.push(value)) == canonical_key_byte_views_spec(
207210
values,

0 commit comments

Comments
 (0)