-
Notifications
You must be signed in to change notification settings - Fork 1
core: Veridicality module — Provenance + Claim<'T> + validate predicates (5th graduation) #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,121 @@ | ||||||||||||||||||||||||||||||||||||
| namespace Zeta.Core | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| open System | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| /// **Veridicality — provenance-aware claim scoring (foundation).** | ||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||
| /// This module hosts the primitives for what the bootstrap-era | ||||||||||||||||||||||||||||||||||||
| /// conversation called the "bullshit detector" and Amara's | ||||||||||||||||||||||||||||||||||||
| /// subsequent ferries (7th-10th) formalized as veridicality | ||||||||||||||||||||||||||||||||||||
| /// scoring. The name `Veridicality` (from Latin *veridicus*, | ||||||||||||||||||||||||||||||||||||
| /// "truth-telling") names the scorable quantity: how true-to- | ||||||||||||||||||||||||||||||||||||
| /// reality a claim looks given its provenance, falsifiability, | ||||||||||||||||||||||||||||||||||||
| /// coherence, drift, and compression-gap signals. "Bullshit" is | ||||||||||||||||||||||||||||||||||||
| /// the informal inverse (`bullshit = 1 - veridicality`). | ||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||
| /// **First graduation (this file):** `Provenance` + `Claim<'T>` | ||||||||||||||||||||||||||||||||||||
| /// record types + `validateProvenance`. These are the input | ||||||||||||||||||||||||||||||||||||
| /// shapes for every downstream scorer. The actual veridicality | ||||||||||||||||||||||||||||||||||||
| /// scorer (`V(c) = σ(β₀ + β₁(1-P) + β₂(1-F) + β₃(1-K) + …)` from | ||||||||||||||||||||||||||||||||||||
| /// Amara's 7th ferry, or `BS(c) = σ(w₁·C + w₂·(1-P) + …)` from | ||||||||||||||||||||||||||||||||||||
| /// the 10th ferry) is a separate graduation that composes over | ||||||||||||||||||||||||||||||||||||
| /// these types. | ||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||
| /// **Attribution.** | ||||||||||||||||||||||||||||||||||||
| /// * **Concept** — the bullshit-detector / provenance-aware- | ||||||||||||||||||||||||||||||||||||
| /// scoring framing is Aaron's design, present in the bootstrap | ||||||||||||||||||||||||||||||||||||
| /// conversation (`docs/amara-full-conversation/**`) before | ||||||||||||||||||||||||||||||||||||
| /// Amara's ferries formalized it. Aaron 2026-04-24 Otto-112: | ||||||||||||||||||||||||||||||||||||
| /// *"bullshit, it was in our conversation history too, not | ||||||||||||||||||||||||||||||||||||
| /// just her ferry."* | ||||||||||||||||||||||||||||||||||||
| /// * **Formalization** — Amara (7th/8th/9th/10th ferries): | ||||||||||||||||||||||||||||||||||||
| /// veridicality formula, semantic-canonicalization "rainbow | ||||||||||||||||||||||||||||||||||||
| /// table", oracle-rule specification, 7-feature composite. | ||||||||||||||||||||||||||||||||||||
| /// * **Implementation** — Otto, under the Otto-105 graduation | ||||||||||||||||||||||||||||||||||||
| /// cadence. Fifth graduation. | ||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||
| /// Future graduations add (in priority order): `antiConsensusGate` | ||||||||||||||||||||||||||||||||||||
| /// (requires `Provenance`); `canonicalizeClaim` (semantic | ||||||||||||||||||||||||||||||||||||
| /// canonicalization → `CanonicalClaimKey`); `scoreVeridicality` | ||||||||||||||||||||||||||||||||||||
| /// (the composite function). | ||||||||||||||||||||||||||||||||||||
| [<AutoOpen>] | ||||||||||||||||||||||||||||||||||||
| module Veridicality = | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| /// **Provenance** — the evidence trail behind a claim. | ||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||
| /// Every accepted claim MUST carry provenance with at minimum | ||||||||||||||||||||||||||||||||||||
| /// `SourceId`, `RootAuthority`, `ArtifactHash`, and | ||||||||||||||||||||||||||||||||||||
| /// `SignatureOk = true`. Empty-string `SourceId` or | ||||||||||||||||||||||||||||||||||||
| /// `RootAuthority`, empty `ArtifactHash`, or `SignatureOk = | ||||||||||||||||||||||||||||||||||||
| /// false` all indicate unverified or missing evidence. | ||||||||||||||||||||||||||||||||||||
| /// | ||||||||||||||||||||||||||||||||||||
| /// Fields match Amara's 9th/10th ferry specification verbatim | ||||||||||||||||||||||||||||||||||||
| /// (`docs/aurora/2026-04-23-amara-aurora-deep-research- | ||||||||||||||||||||||||||||||||||||
| /// report-10th-ferry.md` §ADR-style spec for oracle rules and | ||||||||||||||||||||||||||||||||||||
| /// implementation). | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+54
to
+56
|
||||||||||||||||||||||||||||||||||||
| /// (`docs/aurora/2026-04-23-amara-aurora-deep-research- | |
| /// report-10th-ferry.md` §ADR-style spec for oracle rules and | |
| /// implementation). | |
| /// in the ADR-style oracle-rules and implementation spec for | |
| /// the 10th ferry. |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The snippet shown as "Matches Amara's 10th-ferry snippet" uses c.Prov.*, but validateProvenance here accepts a Provenance and accesses p.*. As written, the snippet no longer matches the function signature and can mislead readers; either update the snippet to match Provenance or move it under validateClaim (which actually takes a claim).
| /// Matches Amara's 10th-ferry snippet: | |
| /// | |
| /// ``` | |
| /// let validateProvenance c = | |
| /// c.Prov.SourceId <> "" | |
| /// && c.Prov.RootAuthority <> "" | |
| /// && c.Prov.ArtifactHash <> "" | |
| /// && c.Prov.SignatureOk | |
| /// Matches Amara's 10th-ferry snippet after projecting to | |
| /// bare provenance: | |
| /// | |
| /// ``` | |
| /// let validateProvenance p = | |
| /// p.SourceId <> "" | |
| /// && p.RootAuthority <> "" | |
| /// && p.ArtifactHash <> "" | |
| /// && p.SignatureOk |
Copilot
AI
Apr 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validateProvenance treats null strings as valid because null <> "" evaluates to true in F#. That means SourceId = null / RootAuthority = null / ArtifactHash = null would incorrectly pass the minimum-validity gate. Consider using String.IsNullOrWhiteSpace (or at least String.IsNullOrEmpty) for these fields so both null and whitespace-only values are rejected.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| module Zeta.Tests.Algebra.VeridicalityTests | ||
|
|
||
| open System | ||
| open FsUnit.Xunit | ||
| open global.Xunit | ||
| open Zeta.Core | ||
|
|
||
|
|
||
| // ─── Provenance / validateProvenance ───────── | ||
|
|
||
| let private goodProv () : Veridicality.Provenance = | ||
| { SourceId = "repo/amara/ferry-10" | ||
| RootAuthority = "amara@aurora" | ||
| ArtifactHash = "blake3:3f8e..." | ||
| BuilderId = Some "otto-115" | ||
| TimestampUtc = DateTimeOffset.UtcNow | ||
| EvidenceClass = "research" | ||
| SignatureOk = true } | ||
|
|
||
| [<Fact>] | ||
| let ``validateProvenance accepts a fully-populated signed provenance`` () = | ||
| Veridicality.validateProvenance (goodProv ()) |> should equal true | ||
|
|
||
| [<Fact>] | ||
| let ``validateProvenance rejects empty SourceId`` () = | ||
| let p = { goodProv () with SourceId = "" } | ||
| Veridicality.validateProvenance p |> should equal false | ||
|
|
||
| [<Fact>] | ||
| let ``validateProvenance rejects empty RootAuthority`` () = | ||
| let p = { goodProv () with RootAuthority = "" } | ||
| Veridicality.validateProvenance p |> should equal false | ||
|
|
||
| [<Fact>] | ||
| let ``validateProvenance rejects empty ArtifactHash`` () = | ||
| let p = { goodProv () with ArtifactHash = "" } | ||
| Veridicality.validateProvenance p |> should equal false | ||
|
|
||
| [<Fact>] | ||
| let ``validateProvenance rejects SignatureOk = false`` () = | ||
| let p = { goodProv () with SignatureOk = false } | ||
| Veridicality.validateProvenance p |> should equal false | ||
|
|
||
| [<Fact>] | ||
| let ``validateProvenance accepts BuilderId = None (not a hard gate)`` () = | ||
| // BuilderId is a quality signal, not a validity gate. An | ||
| // artifact can be legitimately signed without a builder | ||
| // identity (e.g., a human-authored doc signed with a personal | ||
| // key). | ||
| let p = { goodProv () with BuilderId = None } | ||
| Veridicality.validateProvenance p |> should equal true | ||
|
|
||
|
|
||
| // ─── Claim<'T> / validateClaim ───────── | ||
|
|
||
| [<Fact>] | ||
| let ``validateClaim wraps validateProvenance on the claim's provenance`` () = | ||
| let c = | ||
| { Id = "claim-001" | ||
| Payload = 42 | ||
| Weight = 1L | ||
| Prov = goodProv () } | ||
| Veridicality.validateClaim c |> should equal true | ||
|
|
||
| [<Fact>] | ||
| let ``validateClaim is polymorphic over the Payload type`` () = | ||
| // Same validation whether payload is int, string, record, etc. | ||
| // The provenance discipline doesn't depend on payload shape. | ||
| let c = | ||
| { Id = "claim-002" | ||
| Payload = "Zeta is a retraction-native substrate." | ||
| Weight = 1L | ||
| Prov = goodProv () } | ||
| Veridicality.validateClaim c |> should equal true | ||
|
|
||
| [<Fact>] | ||
| let ``validateClaim rejects a claim with invalid provenance`` () = | ||
| let c = | ||
| { Id = "claim-003" | ||
| Payload = () | ||
| Weight = 1L | ||
| Prov = { goodProv () with SignatureOk = false } } | ||
| Veridicality.validateClaim c |> should equal false | ||
|
|
||
| [<Fact>] | ||
| let ``Claim supports negative Weight for retraction semantics`` () = | ||
| // Z-set style: negative weight = retraction. validateClaim | ||
| // does NOT inspect Weight; a retraction claim is valid if its | ||
| // provenance is valid. Retraction semantics are at the ledger | ||
| // level, not the claim-validity level. | ||
| let c = | ||
| { Id = "claim-004" | ||
| Payload = 7 | ||
| Weight = -1L | ||
| Prov = goodProv () } | ||
| Veridicality.validateClaim c |> should equal true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This attribution block uses personal names in a code doc comment. Repo convention is to avoid name attribution in code/docs/skills (see
docs/AGENT-BEST-PRACTICES.md:284-290) and use role-based references instead ("human maintainer", "architect", etc.), keeping personal-name history in the designated history/memory locations. Please rewrite this section to comply with that convention.