interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / docs / turing / TURING_QCONT_RECORDS_V0.md

119 lines · 6332 bytes Raw Blame History Rendered
1# TURING companion records for continuous-value evidence (v0)
2
3Four record domains and the sidecar manifest formats they bind. Code:
4`src/turing/ty_qrecord.om` (pure seeded OM-2, composed after
5`src/turing/ty_core_lib.om`). Tests: `make test-turing-qrecord`. These are
6companion records beside the qint.v1 scorer (`ty_qcont`) and the PRD1 reader;
7no existing `turing.*` record, domain or golden changes.
8
9## Digest recipe
10
11`SHA-256(domain || 0x00 || OMG0 bytes)`, with the OMG0 bytes from
12`omega_canonical_encode` and the hash from `src/sha256.c`, the same recipe as
13`ty_record.c`. A record digest is never an Omega semantic id (OSC-0B). Positive
14T grants nothing.
15
16## Conventions
17
18- One OMG0 object per record; `record` is the first attribute and holds the
19 domain name without `.v0` (for example `turing.qgain`). At most 32 attributes.
20- Every key is shorter than 64 bytes and every value is at most 512 bytes. A
21 longer value is refused (`TY_E_FORMAT`); nothing is truncated.
22- The canonical encoder sorts attributes by key, so insertion order does not
23 change the digest.
24- Renderings: `dec` decimal with no padding; `hex` 64 lowercase hex characters;
25 `hex40` 40 lowercase hex characters; `text` printable ASCII, non-empty;
26 `list` tokens separated by exactly one space. An absent digest is 64 `0`
27 characters; an absent number inside a list is `-1`.
28- The library holds no profile constants. Every descriptive value (names,
29 versions, rule ids, counts, units) is supplied by the caller and carried
30 verbatim.
31- Builders refuse a malformed record. Verifiers rebuild the digest from the
32 fields and compare (`TY_E_DIGEST` on mismatch). `tyqr_file_verify` does the
33 same for a stored record file.
34- Writers are write-once: `<dir>/<record>.<digest hex>.omg0`, opened with
35 `O_CREAT|O_EXCL`, mode 0444, holding the canonical bytes. A second write of
36 the same record returns `TYQR_E_EXISTS` and leaves the file alone.
37
38## turing.qprofile.v0 (constraint, 23 attributes)
39
40`record`, `profile`, `spec` (hex), `packet` (hex), `protocol`, `quantizer`,
41`delta_log2` (dec, signed), `edge_rule`, `sd_min_log2` (dec, signed),
42`floor_rule`, `families` (list), `kmax`, `n_points`, `split` (dec),
43`cells` (hex, digest of the cell-table sidecar), `rider`, `lm_rule`,
44`baselines` (list), `thresholds` (hex, digest of the thresholds sidecar),
45`thresholds_format`, `gen_version`, `bootstrap_b` (dec), `unit`.
46
47## turing.qworld.v0 (evidence, 14 attributes)
48
49`record`, `qprofile` (hex), `mode` (`dev`, `certification`, `discovery`),
50`parent_kind` (`dev`, `sealed`), `qfreeze` (hex), `cell`, `block` (dec),
51`label`, `gen_version`, `generator` (hex), `rep_first`, `rep_count` (dec),
52`traj_manifest` (hex), `traj_format`.
53
54Refused: `mode` and `parent_kind` that disagree (`dev` if and only if `dev`);
55`qfreeze` that is not all zero exactly when `parent_kind` is `dev`; a `cell`
56containing a space.
57
58## turing.qfreeze.v0 (evidence, 21 fixed attributes plus lineage, at most 29)
59
60`record`, `mode` (`certification`, `discovery`), `artifact` (hex),
61`artifact_kind`, `artifact_bin` (hex), `qprofile` (hex), `dev_manifest` (hex),
62`b2_emerging_label` (`POSITIVE`, `NEGATIVE`, `AMBIGUOUS`),
63`bayes_plugin_check` (`AGREE`, `STOP`), `diag_fw_rate_ppm` (list),
64`lengthening_test`, `stability_test` (`PASS`, `FAIL`), `calibration_extra`,
65`run_commit` (hex40), `tree_dirty` (`0`, `1`), `base_commits` (list),
66`producer_tool`, `producer_model`, `prompt_digest` (hex),
67`transcript_digest` (hex), `n_lineage` (0..8), then `lineage.00` to
68`lineage.07` (hex, only indexes below `n_lineage`).
69
70Refused: a ninth predecessor; `artifact_bin` present in certification or absent
71in discovery; in certification, producer fields other than `none` or non-zero
72prompt or transcript digests; in discovery, a zero prompt or transcript digest.
73
74## turing.qgain.v0 (evidence, 29 attributes)
75
76`record`, `qprofile`, `qworld`, `qfreeze` (hex), `mode`, `cell`,
77`gen_version`, `baseline` (`<opcode dec> <artifact hex>`), `candidate` (hex),
78`candidate_opcode` (dec), `prd_b`, `prd_m` (hex), `official` (`0`, `1`),
79`ladder_item`, `lengths` (six signed integers, micro-bit units: `L(B) L(D|B)
80L(M) L(D|M) DL(B,D) DL(M,D)`), `t_ub`, `t_lo_ub`, `t_hi_ub`,
81`numeric_bound_ub`, `mc_err_ub` (dec, signed), `counts` (four unsigned
82integers), `floor_hits`, `protocol_failures` (dec), `leak_flag` (`0`, `1`,
83`INCONCLUSIVE`), `coverage` (three signed integers, `-1` where absent),
84`diag_warnings` (list or `-`), `classification` (`POSITIVE`, `NEGATIVE`,
85`AMBIGUOUS`, `WEAK`, `STOPPED`), `status` (`PASS`, `FAIL_*`, `STOPPED`), `unit`.
86
87Refused: `baseline` opcode outside 1..7; `candidate_opcode` other than 1..7 in
88certification or 255 in discovery; `ladder_item` that is not `-` exactly when
89`official` is 1; `t_ub` that is not `lengths[4] - lengths[5]` (checked with
90`ty_sub`, so int64 overflow is a refusal); `t_lo_ub` above `t_hi_ub`;
91`protocol_failures` other than 0 unless `status` is `STOPPED`.
92
93### Binding
94
95`tyqr_gain_bind` refuses (`TY_E_PROFILE`) a gain unless the gain, its world and
96its freeze all name the same profile digest; the gain names that world and that
97freeze; the world is sealed by that freeze; `mode`, `cell` and `gen_version`
98match the world; the freeze's `mode` matches; and `candidate` equals the
99freeze's `artifact`. All three records are also verified against their digests
100first.
101
102## Sidecar manifests
103
104ASCII, one record per line, fields separated by one space, every line ends with
105LF including the last, no other bytes. The sidecar digest is SHA-256 of the file
106bytes (`tyqr_sidecar_digest`) and is the value stored in the record.
107
108| format | line | order |
109|---|---|---|
110| trajectory manifest, PRD1 manifest | `<rep dec> <digest hex>` | rep strictly ascending |
111| development manifest | `<cell> <block dec> <digest hex>` | cell by byte order, then block, strictly ascending |
112| cell table | `<cell> <field>=<value> ...` | cell by byte order, strictly ascending |
113| thresholds | `<item_id> <field> <value>` | byte order of the whole line, strictly ascending |
114
115The first three have build and parse functions (`tyqr_repman_*`,
116`tyqr_devman_*`); decimals have no sign and no leading zero, digests are
117lowercase hex. The cell table and thresholds have format checkers only
118(`tyqr_celltab_check`, `tyqr_thrtab_check`); their values are supplied by the
119caller.