The Classical Deliberation Validator and Derivation Trace Instrument — Reference Suite v0.5.3
The Classical Deliberation Validator and Derivation Trace Instrument — Reference Suite v0.5.3
Theoretical foundations: Grant C. Sterling (Eastern Illinois University). Analysis and synthesis: Dave Kelly. Prose rendering: Claude (Anthropic). 2026.
Architecture and protocol design: Dave Kelly. Code: v0.5.2 written by Gemini (Google); v0.5.3 revision by Claude (Anthropic). Release date: September 30, 2026. Dedicated to the public domain under CC0 1.0 Universal.
The Beginning
Everyone wants happiness. Incomplete happiness is not worth accepting if complete happiness is available. Complete happiness must therefore lie wholly within our control. Only assent lies wholly within our control. Happiness is therefore correct assent, correct when it matches the truth about value. The truth about value is that only virtue is good and only vice is evil. Everything else is indifferent.
A decision is an assent to an action proposition. This suite checks the structure of such a proposition before the assent is given. It never gives it.
What the Suite Is
The suite is a single Python file. It uses only the standard library and runs on Python 3.7 or later. It has three parts:
- A compiler reads a case written in a small, strict notation: the facts, the evidence, the roles and duties the evidence establishes, the aims, and the candidate actions. Any line it cannot parse stops compilation.
- A kernel passes every candidate action through thirteen gates and issues a certificate. An action that passes every gate is assent-eligible: it is prepared for the operator’s assent.
- A verifier, the Derivation Trace Instrument, reads the certificate alone. It does not trust the kernel. It rebuilds the graph, checks that the certificate’s records match the graph, and replays every condition for every surviving action.
The operator supplies the case, classifies its claims, and gives or withholds assent. The machine checks only whether the case he wrote holds together under the gates.
The Gates
Each gate rests on a stated proposition of the corpus.
- Value contamination. A proposition that calls an external good or evil is invalid, and any action depending on it fails. Only virtue is good and only vice is evil (SLE Prop 17); the belief that any external is good or evil is false (SLE Prop 20).
- Aims. An aim is its own kind of node. It has no truth status, because it is aimed at, not asserted. It must be a preferred indifferent, and it may never be a criterion of success (SLE Props 22 and 60; The Subordination Test).
- The action is the choice. An action must be located in the faculty that chooses, not in the external deed (SLE Prop 32; Sterling, Excerpt 10).
- Reservation. Every action must be chosen with reservation: if it can be done (SLE Prop 62).
- Vice. An action that commits a vice fails, whatever the duty says (SLE Props 17 and 61).
- Facts. Every fact an action depends on must be verified.
- Roles and duties. The role must be granted, and the duty mandated, by verified evidence. The duty must bind that role, and the action’s mode must match the duty’s (SLE Props 64–66).
- The path to the corpus. An action is certified only if its chain of dependencies reaches a registered corpus anchor. The anchors are the six commitments and stated SLE propositions, each with its text. An unregistered or altered anchor is rejected.
Where two or more actions pass every gate, all are certified. In rare cases there is a small set of equally right actions (SLE Prop 68).
What the Suite Does Not Do
- It checks labels, not content. If a case labels the claim “keeping my job is an intrinsic moral good” as a preferred indifferent, the gates pass it. Correct labelling is the operator’s assent, not the code’s.
- It cannot see whether reservation is held. Reservation is recorded as true or false. The code cannot tell reservation actually held from reservation held in name only (SLE Prop 79).
- Anchoring is structural. The suite requires a path to a registered anchor. It does not judge whether the anchor is the right one for the case.
- A certificate is not a verdict that the act is right. Only the operator assents. The certificate says that the act survived the gates and is eligible for his assent.
These limits are the D2 failure mode: the right words with no act of assent behind them. The driver runs two cases that pass by design to show the first two limits plainly. The check on all of them is the operator’s ratification.
Conformance
Running the file runs the whole battery:
- Seven test cases. Three are certified: the baseline cargo release, two equally right actions, and one right action beside one without reservation. Four are halted: an act of deceit its duty did not forbid, value contamination, no path to the corpus, and an action coded as an external deed.
- Seventeen mutants. Each corrupts a valid certificate at one point only, so that the guard named for it is the one that fires. Each checks for the exact flag that guard raises.
- Two declared-limit demonstrations, printed as such.
A complete run ends with this line:
CONFORMANCE: ALL CASES AND MUTANTS DISCRIMINATED AS EXPECTED
To run it in an AI chat, attach the file and ask: “Run this file with Python and show me the output.” Code execution must be switched on. A real run shows a code-execution step, and its output comes from the tool. A reply without that step is a description of what the output would be, not a run.
Changes from v0.5.2
- v0.5.2 did not run as published. Its compiler read keyword lines as item headers and stopped at the first test case. Its conformance claims could not have been produced by that file. The fault is fixed.
- The forged-anchor test now reaches its guard. In v0.5.2, once the crash was patched, that test was caught by a different check.
- The “single-edge counterfactual necessity” check is removed. It removed the duty link and confirmed that a condition requiring the duty link then failed. That could never fail, so it proved nothing. In its place, the verifier now checks independently that the evidence granting the role and mandating the duty is verified.
- Four rulings, 30 September 2026:
- vice fails an action unconditionally;
- certification requires a path to the corpus;
- the action is the choice;
- aims are typed apart from facts.
- Corrected claims. v0.5.2’s page described six modules in six files, an out-of-process JSON boundary, a signed certificate and an eighteen-mutant battery. v0.5.3 is one file with six modules, the certificate is an unsigned record, and the battery has seventeen mutants.
- Canonical names. Two commitment identifiers now follow the canonical names: C2 Libertarian Free Will and C5 Correspondence Theory of Truth.
Integrity
The SHA-256 hash of the release file, cdv_suite_v0_5_3.py, is:
e1ce53f882076a4ff3de829c9fa31895135c1aec9b2e8b3d869c627d0e176e55 cdv_suite_v0_5_3.py
The hash is computed on the file itself. Text copied from this page may differ in line endings or spacing, and its hash will then differ. To check a downloaded copy, run sha256sum cdv_suite_v0_5_3.py and compare.
Source
The complete source of v0.5.3 follows. Save it as cdv_suite_v0_5_3.py and run it with python3 cdv_suite_v0_5_3.py.
"""
CDV/DTI REFERENCE SUITE -- BUILD v0.5.3 (CONSOLIDATED RELEASE)
==============================================================
Classical Deliberation Validator (CDV) & Derivation Trace Instrument (DTI)
Theoretical foundations: Grant C. Sterling (Eastern Illinois University).
Architecture and engineering: Dave Kelly.
Code: v0.5.2 written by Gemini (Google); v0.5.3 revision by Claude
(Anthropic).
Release date: September 2026.
License: CC0 1.0 Universal (dedicated to the public domain).
Modules consolidated in this file:
1. types Closed enums, node schemas, corpus anchor registry
2. compiler Line-oriented DSL scanner producing a CaseAST
3. kernel Gates G1-G13, per-action findings, certificate generation
4. dti Independent proof verifier (Levels 1A, 1B, 2)
5. oracle Mutation battery: 17 mutants, each aimed at one guard
6. pipeline Test cases, declared-limit demonstrations, driver
WHAT THE SUITE DOES
-------------------
The kernel takes a case (facts, evidence, roles, duties, aims, candidate
actions) and finds which actions survive every gate. A surviving action
is "assent-eligible": the suite prepares it for the operator's assent.
It never assents. The DTI verifier then re-derives each survivor from the
certificate alone, without trusting the kernel.
WHAT THE SUITE DOES NOT DO (declared limits)
--------------------------------------------
L1. It checks labels, not content. If a case labels the claim "keeping my
job is an intrinsic moral good" as a PREFERRED_INDIFFERENT, the gates
pass it. Correct labelling is the operator's assent, not the code's.
(Demonstrated in the driver.)
L2. Reservation is recorded as TRUE or FALSE. The code cannot tell
reservation actually held from reservation held in name only
(SLE Prop 79). (Demonstrated in the driver.)
L3. Corpus anchoring is structural. G12 requires that a certified action
reach at least one registered corpus anchor; it does not check that
the anchor is the right one for the case.
L4. A certificate is not a verdict that the act is correct. Under the
corpus only the operator assents; the certificate states that the act
survived the gates and is eligible for his assent. These limits are
the D2 failure mode, and operator ratification is the check on them.
CHANGES FROM v0.5.2
-------------------
Fixes (v0.5.2 did not run as published):
* Compiler: keyword lines (ASSERTS:, DEPENDS_ON:, etc.) were parsed as
item headers, crashing the first test case. Fixed.
* Mutant 6 (forged anchor) was caught by the metadata check, not the
anchor guard it claimed to test. Every mutant now keeps the
certificate consistent except at the guard under test, and each
mutant asserts its expected flag.
* The "duty necessity" counterfactual removed the duty edge and checked
that a predicate requiring that edge then failed. It could never fail,
so it proved nothing. Removed. In its place the DTI now independently
checks that the evidence granting the role and mandating the duty is
VERIFIED, which v0.5.2's verifier did not check.
* Header claims corrected: 17 mutants (not 18); gates are G1-G13 (not
"Stages 2-11").
* Status: one good action plus one rejected action gave kernel HALT but
DTI CERTIFIED; two good actions gave PASS but DTI REJECTED. Findings
are now per action. Status is PASS if any action survives, and the
DTI audits every survivor (SLE Prop 68 allows a small set of equally
right actions).
Doctrinal rulings (operator, 30 September 2026):
* Vice fails an action unconditionally (G9; SLE Props 17, 61). In
v0.5.2 an act of deceit passed whenever its duty did not list deceit.
* Certification requires a path to the corpus base (G12).
* The action is the choice (SLE Prop 32; Excerpt 10): an action's locus
must be PROHAIRESIS_INTERNAL (G7).
* Aims are their own node type, with no truth status. An aim must be a
preferred indifferent (SLE Props 22, 60) and may not be a criterion
of success (G5, G6).
* Commitment ids follow the canonical names (C2 Libertarian Free Will;
C5 Correspondence Theory of Truth).
* Execution mode is now checked: the action's mode must match its
duty's (G11). EvidenceTier and PropositionType remain descriptive
metadata; no gate reads them.
"""
from __future__ import annotations
import copy
import dataclasses
import json
import re
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Dict, List, Optional, Set, Tuple
SCHEMA_VERSION = "0.5.3"
# ============================================================================
# MODULE 1: types
# ============================================================================
class EpistemicStatus(str, Enum):
UNASSERTED = "UNASSERTED"
VERIFIED = "VERIFIED"
CONTRADICTED = "CONTRADICTED"
CONFLICTED = "CONFLICTED"
class PropositionType(str, Enum): # descriptive metadata
EMPIRICAL = "EMPIRICAL"
DERIVED = "DERIVED"
class AxiologicalPolarity(str, Enum):
MORAL_GOOD = "MORAL_GOOD"
MORAL_EVIL = "MORAL_EVIL"
PREFERRED_INDIFFERENT = "PREFERRED_INDIFFERENT"
DISPREFERRED_INDIFFERENT = "DISPREFERRED_INDIFFERENT"
ABSOLUTE_INDIFFERENT = "ABSOLUTE_INDIFFERENT"
class AxiologicalLocus(str, Enum):
PROHAIRESIS_INTERNAL = "PROHAIRESIS_INTERNAL"
EXTERNAL_STATE = "EXTERNAL_STATE"
class EvidenceTier(str, Enum): # descriptive metadata
STATUTORY_LEGAL = "STATUTORY_LEGAL"
PROFESSIONAL_REGULATORY = "PROFESSIONAL_REGULATORY"
CONTRACTUAL_AGREEMENT = "CONTRACTUAL_AGREEMENT"
ORGANIZATIONAL_POLICY = "ORGANIZATIONAL_POLICY"
EMPIRICAL_DOCUMENTATION = "EMPIRICAL_DOCUMENTATION"
CORPUS_BASE = "CORPUS_BASE"
class ExecutionMode(str, Enum):
AFFIRMATIVE_EXECUTION = "AFFIRMATIVE_EXECUTION"
CONDITIONAL_BYPASS = "CONDITIONAL_BYPASS"
PRECAUTIONARY_WITHHOLDING = "PRECAUTIONARY_WITHHOLDING"
REGULATORY_DISCLOSURE = "REGULATORY_DISCLOSURE"
EMERGENCY_DEVIATION = "EMERGENCY_DEVIATION"
class EdgeType(str, Enum):
ASSERTS = "ASSERTS"
GRANTS_ROLE = "GRANTS_ROLE"
MANDATES_DUTY = "MANDATES_DUTY"
BINDS_ROLE = "BINDS_ROLE"
DEPENDS_ON = "DEPENDS_ON"
EXECUTES_DUTY = "EXECUTES_DUTY"
TARGETS_AIM = "TARGETS_AIM"
class ViceType(str, Enum):
VICE_DECEIT_01 = "VICE_DECEIT_01"
VICE_BAD_FAITH_01 = "VICE_BAD_FAITH_01"
VICE_PARTIALITY_01 = "VICE_PARTIALITY_01"
VICE_RECKLESS_NEGLECT_01 = "VICE_RECKLESS_NEGLECT_01"
VICE_COWARDLY_EVASION_01 = "VICE_COWARDLY_EVASION_01"
class CorpusRuleRegistry:
"""Registered corpus anchors. Texts of SLE Propositions are quoted from
the Sterling Logic Engine v4.4, Part 4 (mirror of v4.0)."""
ANCHORS: Dict[str, str] = {
"STERLING_CORE_01_SUBSTANCE_DUALISM":
"C1 Substance Dualism.",
"STERLING_CORE_02_LIBERTARIAN_FREE_WILL":
"C2 Libertarian Free Will.",
"STERLING_CORE_03_ETHICAL_INTUITIONISM":
"C3 Ethical Intuitionism.",
"STERLING_CORE_04_FOUNDATIONALISM":
"C4 Foundationalism.",
"STERLING_CORE_05_CORRESPONDENCE_THEORY":
"C5 Correspondence Theory of Truth.",
"STERLING_CORE_06_MORAL_REALISM":
"C6 Moral Realism.",
"CORPUS_BASE_AXIOM_1_VALUE_INTERNAL":
"Only virtue is genuinely good; only vice is genuinely evil "
"(SLE Prop 17). The belief that any external is good or evil "
"is factually false (SLE Prop 20).",
"CORPUS_BASE_AXIOM_2_AIM_SUBORDINATION":
"A rational goal is a preferred indifferent held as an "
"appropriate object of aim. It is not a desired outcome held "
"as a genuine good (SLE Prop 60).",
"SLE_PROP_32_ACTION_IS_CHOICE":
"An action, properly understood, is an act of choice/will, not "
"a physical outcome.",
"SLE_PROP_61_RATIONAL_MEANS":
"Rational means are those genuinely designed to realize the "
"rational goal, that are not themselves immoral, and that are "
"proportionate to the full range of the agent's rational goals "
"at that moment.",
"SLE_PROP_62_RESERVATION":
"Reservation is the constitutive framing of every rational act "
"of will.",
"SLE_PROP_64_ROLE_DUTIES":
"Every agent occupies multiple social roles simultaneously. "
"Each role generates role-duties.",
}
DERIVATIONAL_TYPES: Set[str] = {
EdgeType.DEPENDS_ON.value,
EdgeType.EXECUTES_DUTY.value,
EdgeType.TARGETS_AIM.value,
}
@classmethod
def is_anchor(cls, node_id: str) -> bool:
return node_id in cls.ANCHORS
@staticmethod
def looks_like_anchor(node_id: str) -> bool:
return node_id.startswith(("CORPUS_", "STERLING_", "SLE_PROP_"))
@dataclass
class PropositionNode:
prop_id: str
prop_type: PropositionType
epistemic_status: EpistemicStatus
polarity: AxiologicalPolarity
locus: AxiologicalLocus
description: str
@dataclass
class AimNode:
"""An object of aim. It has no truth status: it is aimed at, not
asserted (operator ruling 4.4)."""
aim_id: str
polarity: AxiologicalPolarity
locus: AxiologicalLocus
description: str
is_criterion: bool = False
@dataclass
class DutyNode:
duty_id: str
role_id: str
desc: str
mode: ExecutionMode
priority: int
proscribed_vices: List[ViceType] = field(default_factory=list)
@dataclass
class EvidenceNode:
ev_id: str
tier: EvidenceTier
epistemic_status: EpistemicStatus
asserts_props: List[str] = field(default_factory=list)
grants_roles: List[str] = field(default_factory=list)
mandates_duties: List[DutyNode] = field(default_factory=list)
@dataclass
class ActionNode:
act_id: str
mode: ExecutionMode
locus: AxiologicalLocus
desc: str
role: str
duty: str
aim: str
reservation: bool
depends_on: List[str] = field(default_factory=list)
vices: List[ViceType] = field(default_factory=list)
@dataclass
class GraphEdge:
source_id: str
target_id: str
edge_type: EdgeType
@dataclass
class CaseAST:
case_id: str
situation: str
propositions: Dict[str, PropositionNode]
aims: Dict[str, AimNode]
evidence: Dict[str, EvidenceNode]
actions: Dict[str, ActionNode]
edges: List[GraphEdge]
# ============================================================================
# MODULE 2: compiler
# ============================================================================
_KEYWORDS = (
"ASSERTS", "GRANTS_ROLES", "MANDATES", "DUTY", "DESC", "MODE",
"PRIORITY", "PROSCRIBES", "ROLE", "AIM", "RESERVATION", "DEPENDS_ON",
"VICES",
)
_KEYWORD_LINE = re.compile(r"^(?:%s):" % "|".join(_KEYWORDS))
_ITEM_HEADER = re.compile(r"^([A-Za-z0-9_]+):\s*\[([^\]]+)\]$")
_DESCRIBED_ITEM = re.compile(r'^([A-Za-z0-9_]+):\s*\[([^\]]+)\]\s*"([^"]*)"(.*)$')
_DUTY_HEADER = re.compile(r"^DUTY\s+([A-Za-z0-9_]+)\s+FOR\s+([A-Za-z0-9_]+):$")
def _list_value(line: str) -> List[str]:
raw = line.split(":", 1)[1].strip().strip("[]")
return [x.strip() for x in raw.split(",") if x.strip()]
def _tokens(tuple_str: str, n: int, what: str) -> List[str]:
toks = [t.strip() for t in tuple_str.split(",")]
if len(toks) != n:
raise ValueError(f"{what} requires exactly {n} tokens, got {len(toks)}")
return toks
class CDVCompiler:
BLOCKS = ("PROPOSITIONS:", "AIMS:", "EVIDENCE:", "ACTIONS:")
@staticmethod
def compile(dsl_text: str) -> CaseAST:
lines = [ln.strip() for ln in dsl_text.splitlines()
if ln.strip() and not ln.strip().startswith("#")]
case_id, situation = "", ""
props: Dict[str, PropositionNode] = {}
aims: Dict[str, AimNode] = {}
evidence: Dict[str, EvidenceNode] = {}
actions: Dict[str, ActionNode] = {}
edges: List[GraphEdge] = []
declared: Set[str] = set()
block: Optional[str] = None
cur_ev: Optional[EvidenceNode] = None
cur_duty: Optional[DutyNode] = None
cur_act: Optional[ActionNode] = None
def declare(node_id: str) -> None:
if node_id in declared:
raise ValueError(f"Duplicate id: {node_id}")
declared.add(node_id)
for line in lines:
if line.startswith("CASE "):
case_id = line[5:].rstrip(":").strip()
continue
if line.startswith("SITUATION:"):
situation = line.split(":", 1)[1].strip().strip('"')
continue
if line in CDVCompiler.BLOCKS:
block = line[:-1]
cur_ev = cur_duty = cur_act = None
continue
if block == "PROPOSITIONS":
m = _DESCRIBED_ITEM.match(line)
if not m:
raise ValueError(f"Malformed proposition line: {line}")
pid, tup, desc, _extra = m.groups()
t = _tokens(tup, 4, f"Proposition {pid}")
declare(pid)
props[pid] = PropositionNode(
pid, PropositionType(t[0]), EpistemicStatus(t[1]),
AxiologicalPolarity(t[2]), AxiologicalLocus(t[3]), desc)
continue
if block == "AIMS":
m = _DESCRIBED_ITEM.match(line)
if not m:
raise ValueError(f"Malformed aim line: {line}")
aid, tup, desc, extra = m.groups()
t = _tokens(tup, 2, f"Aim {aid}")
declare(aid)
aims[aid] = AimNode(
aid, AxiologicalPolarity(t[0]), AxiologicalLocus(t[1]),
desc, is_criterion="IS_CRITERION" in extra)
continue
if block == "EVIDENCE":
if not _KEYWORD_LINE.match(line) and _ITEM_HEADER.match(line):
eid, tup = _ITEM_HEADER.match(line).groups()
t = _tokens(tup, 2, f"Evidence {eid}")
declare(eid)
cur_ev = EvidenceNode(eid, EvidenceTier(t[0]),
EpistemicStatus(t[1]))
evidence[eid] = cur_ev
cur_duty = None
continue
if cur_ev is None:
raise ValueError(f"Evidence field outside an item: {line}")
if line.startswith("ASSERTS:"):
for pid in _list_value(line):
cur_ev.asserts_props.append(pid)
edges.append(GraphEdge(cur_ev.ev_id, pid, EdgeType.ASSERTS))
continue
if line.startswith("GRANTS_ROLES:"):
for rid in _list_value(line):
cur_ev.grants_roles.append(rid)
edges.append(GraphEdge(cur_ev.ev_id, rid, EdgeType.GRANTS_ROLE))
continue
if line.startswith("MANDATES:"):
continue
dm = _DUTY_HEADER.match(line)
if dm:
did, rid = dm.groups()
declare(did)
cur_duty = DutyNode(did, rid, "",
ExecutionMode.AFFIRMATIVE_EXECUTION, 1)
cur_ev.mandates_duties.append(cur_duty)
edges.append(GraphEdge(cur_ev.ev_id, did, EdgeType.MANDATES_DUTY))
edges.append(GraphEdge(did, rid, EdgeType.BINDS_ROLE))
continue
if cur_duty is None:
raise ValueError(f"Unrecognized evidence line: {line}")
if line.startswith("DESC:"):
cur_duty.desc = line.split(":", 1)[1].strip().strip('"')
elif line.startswith("MODE:"):
cur_duty.mode = ExecutionMode(line.split(":", 1)[1].strip())
elif line.startswith("PRIORITY:"):
cur_duty.priority = int(line.split(":", 1)[1].strip())
elif line.startswith("PROSCRIBES:"):
cur_duty.proscribed_vices = [ViceType(v) for v in _list_value(line)]
else:
raise ValueError(f"Unrecognized duty line: {line}")
continue
if block == "ACTIONS":
if not _KEYWORD_LINE.match(line) and _ITEM_HEADER.match(line):
aid, tup = _ITEM_HEADER.match(line).groups()
t = _tokens(tup, 2, f"Action {aid}")
declare(aid)
cur_act = ActionNode(aid, ExecutionMode(t[0]),
AxiologicalLocus(t[1]),
"", "", "", "", False)
actions[aid] = cur_act
continue
if cur_act is None:
raise ValueError(f"Action field outside an item: {line}")
val = line.split(":", 1)[1].strip()
if line.startswith("DESC:"):
cur_act.desc = val.strip('"')
elif line.startswith("ROLE:"):
cur_act.role = val
elif line.startswith("DUTY:"):
cur_act.duty = val
edges.append(GraphEdge(cur_act.act_id, val, EdgeType.EXECUTES_DUTY))
elif line.startswith("AIM:"):
cur_act.aim = val
edges.append(GraphEdge(cur_act.act_id, val, EdgeType.TARGETS_AIM))
elif line.startswith("RESERVATION:"):
cur_act.reservation = val.upper() == "TRUE"
elif line.startswith("DEPENDS_ON:"):
for pid in _list_value(line):
cur_act.depends_on.append(pid)
edges.append(GraphEdge(cur_act.act_id, pid, EdgeType.DEPENDS_ON))
elif line.startswith("VICES:"):
cur_act.vices = [ViceType(v) for v in _list_value(line)]
else:
raise ValueError(f"Unrecognized action line: {line}")
continue
raise ValueError(f"Line outside any block: {line}")
return CaseAST(case_id, situation, props, aims, evidence, actions, edges)
# ============================================================================
# MODULE 3: kernel
# ============================================================================
#
# Case-level gates (reported in case_flags):
# G1 EPISTEMIC_CONFLICT_DETECTED a proposition is CONFLICTED
# G2 VALUE_INVALID_<prop> an external is labelled good/evil
# G3 AIM_AS_CRITERION_<aim> an aim is marked a criterion
# G4 AIM_POLARITY_INVALID_<aim> an aim is not a preferred indifferent
# Action-level gates (reported in action_flags):
# G5 AIM_UNSUBORDINATED targets an aim failing G3 or G4
# G6 AIM_UNDECLARED targets no declared aim
# G7 ACTION_LOCUS_INVALID locus is not PROHAIRESIS_INTERNAL
# G8 RESERVATION_ABSENT
# G9 VICE_PRESENT any vice, unconditionally
# G10 FACT_UNVERIFIED / CONTAMINATION_PRESENT on a dependency
# G11 ROLE_UNGROUNDED / DUTY_UNMANDATED / DUTY_ROLE_MISMATCH / MODE_MISMATCH
# G12 CORPUS_UNANCHORED derivational closure reaches no anchor
# G13 FORGED_ANCHOR anchor-like id not in the registry
def derivational_closure(start: str, edges: List[Dict[str, str]]) -> Set[str]:
closure: Set[str] = set()
frontier = [start]
while frontier:
cur = frontier.pop(0)
if cur in closure:
continue
closure.add(cur)
frontier.extend(e["target_id"] for e in edges
if e["source_id"] == cur
and e["edge_type"] in CorpusRuleRegistry.DERIVATIONAL_TYPES)
return closure
def canonical_thesis(act_id: str, role: str, duty: str) -> str:
return (f"Action {act_id} is assent-eligible under Role {role} "
f"to execute Duty {duty} with reservation.")
class CDVKernel:
@staticmethod
def evaluate(ast: CaseAST) -> Dict[str, Any]:
case_flags: List[str] = []
action_flags: Dict[str, List[str]] = {}
survivors: List[str] = []
props = ast.propositions
edge_dicts = [{"source_id": e.source_id, "target_id": e.target_id,
"edge_type": e.edge_type.value} for e in ast.edges]
# G1
if any(p.epistemic_status == EpistemicStatus.CONFLICTED for p in props.values()):
case_flags.append("EPISTEMIC_CONFLICT_DETECTED")
# G2
invalid_props = {p.prop_id for p in props.values()
if p.locus == AxiologicalLocus.EXTERNAL_STATE
and p.polarity in (AxiologicalPolarity.MORAL_GOOD,
AxiologicalPolarity.MORAL_EVIL)}
case_flags += [f"VALUE_INVALID_{pid}" for pid in sorted(invalid_props)]
# G3, G4
bad_aims: Set[str] = set()
for a in ast.aims.values():
if a.is_criterion:
case_flags.append(f"AIM_AS_CRITERION_{a.aim_id}")
bad_aims.add(a.aim_id)
if a.polarity != AxiologicalPolarity.PREFERRED_INDIFFERENT:
case_flags.append(f"AIM_POLARITY_INVALID_{a.aim_id}")
bad_aims.add(a.aim_id)
# Roles and duties come only from VERIFIED evidence.
granted_roles: Set[str] = set()
duties: Dict[str, DutyNode] = {}
for ev in ast.evidence.values():
if ev.epistemic_status == EpistemicStatus.VERIFIED:
granted_roles.update(ev.grants_roles)
for d in ev.mandates_duties:
duties[d.duty_id] = d
for act in ast.actions.values():
f: List[str] = []
if act.aim not in ast.aims:
f.append("AIM_UNDECLARED") # G6
elif act.aim in bad_aims:
f.append("AIM_UNSUBORDINATED") # G5
if act.locus != AxiologicalLocus.PROHAIRESIS_INTERNAL:
f.append("ACTION_LOCUS_INVALID") # G7
if not act.reservation:
f.append("RESERVATION_ABSENT") # G8
if act.vices:
f.append("VICE_PRESENT") # G9
for dep in act.depends_on: # G10, G13
if CorpusRuleRegistry.is_anchor(dep):
continue
if CorpusRuleRegistry.looks_like_anchor(dep):
f.append(f"FORGED_ANCHOR_{dep}")
continue
p = props.get(dep)
if p is None or p.epistemic_status != EpistemicStatus.VERIFIED:
f.append(f"FACT_UNVERIFIED_{dep}")
if dep in invalid_props:
f.append(f"CONTAMINATION_PRESENT_{dep}")
if act.role not in granted_roles: # G11
f.append("ROLE_UNGROUNDED")
d = duties.get(act.duty)
if d is None:
f.append("DUTY_UNMANDATED")
else:
if d.role_id != act.role:
f.append("DUTY_ROLE_MISMATCH")
if d.mode != act.mode:
f.append("MODE_MISMATCH")
closure = derivational_closure(act.act_id, edge_dicts) # G12
if not any(CorpusRuleRegistry.is_anchor(n) for n in closure):
f.append("CORPUS_UNANCHORED")
action_flags[act.act_id] = f
if not f:
survivors.append(act.act_id)
theses = {a: canonical_thesis(a, ast.actions[a].role, ast.actions[a].duty)
for a in survivors}
used_anchors = sorted({e.target_id for e in ast.edges
if CorpusRuleRegistry.is_anchor(e.target_id)})
return {
"schema_version": SCHEMA_VERSION,
"case_id": ast.case_id,
"situation": ast.situation,
"nodes": {
"propositions": [dataclasses.asdict(p) for p in props.values()],
"aims": [dataclasses.asdict(a) for a in ast.aims.values()],
"evidence": [{
"ev_id": e.ev_id, "tier": e.tier.value,
"epistemic_status": e.epistemic_status.value,
"asserts_props": list(e.asserts_props),
"grants_roles": list(e.grants_roles),
"mandates_duties": [dataclasses.asdict(d) for d in e.mandates_duties],
} for e in ast.evidence.values()],
"actions": [dataclasses.asdict(a) for a in ast.actions.values()],
"corpus_anchors": [{"anchor_id": a, "text": CorpusRuleRegistry.ANCHORS[a]}
for a in used_anchors],
},
"edges": edge_dicts,
"case_flags": case_flags,
"action_flags": action_flags,
"survivors": survivors,
"canonical_theses": theses,
"status": "PASS" if survivors else "HALT",
}
# ============================================================================
# MODULE 4: dti -- independent proof verifier
# ============================================================================
#
# The verifier reads only the certificate. It does not import kernel
# results; it replays every condition from the certificate's nodes.
def _plain(v: Any) -> Any:
return v.value if isinstance(v, Enum) else v
class CDVDTIProofValidator:
@staticmethod
def audit_certificate(cert_in: Any) -> Dict[str, Any]:
cert = json.loads(cert_in) if isinstance(cert_in, str) else \
json.loads(json.dumps(cert_in, default=_plain))
nodes, edges, survivors = cert["nodes"], cert["edges"], cert["survivors"]
def reject(flag: str, detail: str) -> Dict[str, Any]:
return {"verdict": "REJECTED", "flag": flag, "detail": detail}
# ---- LEVEL 1A: topological well-formedness ------------------------
for a in nodes.get("corpus_anchors", []):
if not CorpusRuleRegistry.is_anchor(a["anchor_id"]):
return reject("FOUNDATION_GUARD_FORGED_ANCHOR",
f"Unregistered anchor: {a['anchor_id']}")
if a["text"] != CorpusRuleRegistry.ANCHORS[a["anchor_id"]]:
return reject("FOUNDATION_GUARD_ALTERED_ANCHOR",
f"Anchor text altered: {a['anchor_id']}")
v_ids: Set[str] = {a["anchor_id"] for a in nodes.get("corpus_anchors", [])}
v_ids |= {p["prop_id"] for p in nodes["propositions"]}
v_ids |= {a["aim_id"] for a in nodes["aims"]}
for e in nodes["evidence"]:
v_ids.add(e["ev_id"])
v_ids.update(e["grants_roles"])
for d in e["mandates_duties"]:
v_ids.update((d["duty_id"], d["role_id"]))
v_ids |= {a["act_id"] for a in nodes["actions"]}
seen: Set[Tuple[str, str, str]] = set()
for ed in edges:
triple = (ed["source_id"], ed["target_id"], ed["edge_type"])
if triple in seen:
return reject("GRAPH_TOPOLOGY_MALFORMED", f"Duplicate edge: {triple}")
seen.add(triple)
if ed["source_id"] not in v_ids or ed["target_id"] not in v_ids:
if CorpusRuleRegistry.looks_like_anchor(ed["target_id"]) and \
not CorpusRuleRegistry.is_anchor(ed["target_id"]):
return reject("FOUNDATION_GUARD_FORGED_ANCHOR",
f"Unregistered anchor: {ed['target_id']}")
return reject("GRAPH_TOPOLOGY_MALFORMED", f"Dangling endpoint: {triple}")
# ---- LEVEL 1B: metadata matches graph -----------------------------
for a in nodes["actions"]:
aid = a["act_id"]
out = [ed for ed in edges if ed["source_id"] == aid]
duty_e = [ed for ed in out if ed["edge_type"] == "EXECUTES_DUTY"]
aim_e = [ed for ed in out if ed["edge_type"] == "TARGETS_AIM"]
dep_e = {ed["target_id"] for ed in out if ed["edge_type"] == "DEPENDS_ON"}
if len(duty_e) != 1 or duty_e[0]["target_id"] != a["duty"]:
return reject("METADATA_GRAPH_DIVERGENCE", f"Duty mismatch: {aid}")
if len(aim_e) != 1 or aim_e[0]["target_id"] != a["aim"]:
return reject("METADATA_GRAPH_DIVERGENCE", f"Aim mismatch: {aid}")
if dep_e != set(a["depends_on"]):
return reject("METADATA_GRAPH_DIVERGENCE", f"Dependency mismatch: {aid}")
# ---- LEVEL 2: predicate replay on every survivor ------------------
if not survivors:
return {"verdict": "HALTED", "flag": "NO_SURVIVING_ACTIONS",
"detail": cert.get("action_flags", {})}
props = {p["prop_id"]: p for p in nodes["propositions"]}
aims = {a["aim_id"]: a for a in nodes["aims"]}
evs = {e["ev_id"]: e for e in nodes["evidence"]}
duty_nodes = {d["duty_id"]: d for e in nodes["evidence"] for d in e["mandates_duties"]}
def psi(act: Dict[str, Any]) -> Tuple[bool, str]:
aid = act["act_id"]
if act["locus"] != "PROHAIRESIS_INTERNAL":
return False, "PREDICATE_P1_FAIL_ACTION_LOCUS"
if not act.get("reservation", False):
return False, "PREDICATE_P2_FAIL_RESERVATION_ABSENT"
if act.get("vices"):
return False, "PREDICATE_P3_FAIL_VICE_PRESENT"
duty_id = act["duty"]
duty = duty_nodes.get(duty_id)
if duty is None:
return False, "PREDICATE_P4_FAIL_DUTY_UNDECLARED"
if duty["role_id"] != act["role"]:
return False, "PREDICATE_P4_FAIL_ROLE_MISMATCH"
if duty["mode"] != act["mode"]:
return False, "PREDICATE_P4_FAIL_MODE_MISMATCH"
# Independent grounding: the duty's mandating evidence and the
# role's granting evidence must themselves be VERIFIED.
mandating = [e["source_id"] for e in edges
if e["target_id"] == duty_id and e["edge_type"] == "MANDATES_DUTY"]
if not any(evs.get(s, {}).get("epistemic_status") == "VERIFIED" for s in mandating):
return False, "PREDICATE_P5_FAIL_DUTY_EVIDENCE_UNVERIFIED"
granting = [e["source_id"] for e in edges
if e["target_id"] == act["role"] and e["edge_type"] == "GRANTS_ROLE"]
if not any(evs.get(s, {}).get("epistemic_status") == "VERIFIED" for s in granting):
return False, "PREDICATE_P5_FAIL_ROLE_EVIDENCE_UNVERIFIED"
for dep in act["depends_on"]:
if CorpusRuleRegistry.is_anchor(dep):
continue
p = props.get(dep)
if p is None or p["epistemic_status"] != "VERIFIED":
return False, "PREDICATE_P6_FAIL_UNVERIFIED_DEPENDENCY"
if p["locus"] == "EXTERNAL_STATE" and p["polarity"] in ("MORAL_GOOD", "MORAL_EVIL"):
return False, "PREDICATE_P6_FAIL_VALUE_CONTAMINATION"
aim = aims.get(act["aim"])
if aim is None:
return False, "PREDICATE_P7_FAIL_NO_AIM"
if aim.get("is_criterion") or aim["polarity"] != "PREFERRED_INDIFFERENT":
return False, "PREDICATE_P7_FAIL_AIM_UNSUBORDINATED"
closure = derivational_closure(aid, edges)
if not any(CorpusRuleRegistry.is_anchor(n) for n in closure):
return False, "PREDICATE_P8_FAIL_CORPUS_UNANCHORED"
return True, "PREDICATE_SATISFIED"
theses = cert.get("canonical_theses", {})
certified: Dict[str, str] = {}
for sid in survivors:
act = next((a for a in nodes["actions"] if a["act_id"] == sid), None)
if act is None:
return reject("SURVIVOR_UNDECLARED", sid)
ok, reason = psi(act)
if not ok:
return reject(reason, f"Predicate replay failed for {sid}")
expected = canonical_thesis(sid, act["role"], act["duty"])
if theses.get(sid) != expected:
return reject("THESIS_RECONSTRUCTION_MISMATCH", f"Expected: {expected}")
certified[sid] = expected
return {"verdict": "CERTIFIED", "flag": "PREDICATE_REPLAY_SATISFIED",
"theses": certified}
# ============================================================================
# MODULE 5: oracle -- mutation battery
# ============================================================================
#
# Each mutant alters a valid certificate at one point and keeps it
# consistent everywhere else, so the guard under test is the one that
# fires. Each asserts the exact flag expected.
def _act(c: Dict[str, Any]) -> Dict[str, Any]:
return c["nodes"]["actions"][0]
def _aim(c: Dict[str, Any]) -> Dict[str, Any]:
return c["nodes"]["aims"][0]
def _first_ev(c: Dict[str, Any]) -> Dict[str, Any]:
return c["nodes"]["evidence"][0]
def _mutants() -> List[Tuple[str, str, Any]]:
def m01(c): # dangling edge, metadata kept consistent
sid = c["survivors"][0]
c["edges"].append({"source_id": sid, "target_id": "NON_EXISTENT_NODE",
"edge_type": "DEPENDS_ON"})
_act(c)["depends_on"].append("NON_EXISTENT_NODE")
def m02(c):
c["edges"].append(copy.deepcopy(c["edges"][0]))
def m03(c):
_act(c)["duty"] = "FORGED_DUTY_ID"
def m04(c):
_act(c)["reservation"] = False
def m05(c):
c["canonical_theses"][c["survivors"][0]] = "Altered thesis text."
def m06(c): # forged anchor, metadata kept consistent
fid = "CORPUS_BASE_FORGED_AXIOM"
c["nodes"]["corpus_anchors"].append({"anchor_id": fid, "text": "Fake"})
c["edges"].append({"source_id": c["survivors"][0], "target_id": fid,
"edge_type": "DEPENDS_ON"})
_act(c)["depends_on"].append(fid)
def m07(c):
c["nodes"]["corpus_anchors"][0]["text"] = "Altered anchor text."
def m08(c):
_act(c)["vices"] = ["VICE_DECEIT_01"]
def m09(c):
_act(c)["locus"] = "EXTERNAL_STATE"
def m10(c):
_aim(c)["is_criterion"] = True
def m11(c):
_aim(c)["polarity"] = "MORAL_GOOD"
def m12(c): # role-granting / duty-mandating evidence not verified
_first_ev(c)["epistemic_status"] = "UNASSERTED"
def m13(c): # remove every anchor dependency, metadata kept consistent
sid = c["survivors"][0]
anchors = {a["anchor_id"] for a in c["nodes"]["corpus_anchors"]}
c["edges"] = [e for e in c["edges"]
if not (e["source_id"] == sid and e["target_id"] in anchors)]
_act(c)["depends_on"] = [d for d in _act(c)["depends_on"] if d not in anchors]
c["nodes"]["corpus_anchors"] = []
def m14(c):
dep = next(d for d in _act(c)["depends_on"] if not CorpusRuleRegistry.is_anchor(d))
p = next(p for p in c["nodes"]["propositions"] if p["prop_id"] == dep)
p["polarity"] = "MORAL_GOOD"
def m15(c):
dep = next(d for d in _act(c)["depends_on"] if not CorpusRuleRegistry.is_anchor(d))
p = next(p for p in c["nodes"]["propositions"] if p["prop_id"] == dep)
p["epistemic_status"] = "UNASSERTED"
def m16(c):
_first_ev(c)["mandates_duties"][0]["role_id"] = "ROLE_OTHER"
for e in c["edges"]:
if e["edge_type"] == "BINDS_ROLE":
e["target_id"] = "ROLE_OTHER"
def m17(c):
_act(c)["mode"] = "EMERGENCY_DEVIATION"
return [
("MUTANT_01_DANGLING_EDGE", "GRAPH_TOPOLOGY_MALFORMED", m01),
("MUTANT_02_DUPLICATE_EDGE", "GRAPH_TOPOLOGY_MALFORMED", m02),
("MUTANT_03_METADATA_DIVERGENCE", "METADATA_GRAPH_DIVERGENCE", m03),
("MUTANT_04_RESERVATION_FALSE", "PREDICATE_P2_FAIL_RESERVATION_ABSENT", m04),
("MUTANT_05_THESIS_MISMATCH", "THESIS_RECONSTRUCTION_MISMATCH", m05),
("MUTANT_06_FORGED_ANCHOR", "FOUNDATION_GUARD_FORGED_ANCHOR", m06),
("MUTANT_07_ALTERED_ANCHOR_TEXT", "FOUNDATION_GUARD_ALTERED_ANCHOR", m07),
("MUTANT_08_VICE_PRESENT", "PREDICATE_P3_FAIL_VICE_PRESENT", m08),
("MUTANT_09_ACTION_LOCUS_EXTERNAL", "PREDICATE_P1_FAIL_ACTION_LOCUS", m09),
("MUTANT_10_AIM_AS_CRITERION", "PREDICATE_P7_FAIL_AIM_UNSUBORDINATED", m10),
("MUTANT_11_AIM_POLARITY_MORAL", "PREDICATE_P7_FAIL_AIM_UNSUBORDINATED", m11),
("MUTANT_12_EVIDENCE_UNVERIFIED", "PREDICATE_P5_FAIL_DUTY_EVIDENCE_UNVERIFIED", m12),
("MUTANT_13_CORPUS_UNANCHORED", "PREDICATE_P8_FAIL_CORPUS_UNANCHORED", m13),
("MUTANT_14_VALUE_CONTAMINATION", "PREDICATE_P6_FAIL_VALUE_CONTAMINATION", m14),
("MUTANT_15_UNVERIFIED_DEPENDENCY", "PREDICATE_P6_FAIL_UNVERIFIED_DEPENDENCY", m15),
("MUTANT_16_DUTY_ROLE_MISMATCH", "PREDICATE_P4_FAIL_ROLE_MISMATCH", m16),
("MUTANT_17_MODE_MISMATCH", "PREDICATE_P4_FAIL_MODE_MISMATCH", m17),
]
class CDVMutationOracle:
@staticmethod
def run_battery(base_cert: Dict[str, Any]) -> Dict[str, Tuple[bool, str, str]]:
base = json.loads(json.dumps(base_cert, default=_plain))
results: Dict[str, Tuple[bool, str, str]] = {}
for name, expected, mutate in _mutants():
m = copy.deepcopy(base)
mutate(m)
got = CDVDTIProofValidator.audit_certificate(m)["flag"]
results[name] = (got == expected, expected, got)
return results
# ============================================================================
# MODULE 6: pipeline -- cases, demonstrations, driver
# ============================================================================
CDV_IN_01 = """
CASE CDV_IN_01_CARGO_RELEASE:
SITUATION: "Cargo inspector is scheduled to sign a release order for conforming cargo matching manifest."
PROPOSITIONS:
PROP_MANIFEST_VERIFIED: [EMPIRICAL, VERIFIED, ABSOLUTE_INDIFFERENT, EXTERNAL_STATE] "Sealed cargo matches the manifest"
AIMS:
AIM_TIMELY_RELEASE: [PREFERRED_INDIFFERENT, EXTERNAL_STATE] "Timely release of conforming goods"
EVIDENCE:
EV_CONTRACT_01: [CONTRACTUAL_AGREEMENT, VERIFIED]
ASSERTS: [PROP_MANIFEST_VERIFIED]
GRANTS_ROLES: [ROLE_CARGO_INSPECTOR]
MANDATES:
DUTY DUTY_RELEASE_01 FOR ROLE_CARGO_INSPECTOR:
DESC: "Sign release order when manifest matches verified sealed cargo"
MODE: AFFIRMATIVE_EXECUTION
PRIORITY: 1
PROSCRIBES: [VICE_DECEIT_01]
ACTIONS:
ACT_RELEASE_01: [AFFIRMATIVE_EXECUTION, PROHAIRESIS_INTERNAL]
DESC: "Choose to sign and submit the conforming release document"
ROLE: ROLE_CARGO_INSPECTOR
DUTY: DUTY_RELEASE_01
AIM: AIM_TIMELY_RELEASE
RESERVATION: TRUE
DEPENDS_ON: [PROP_MANIFEST_VERIFIED, CORPUS_BASE_AXIOM_2_AIM_SUBORDINATION, SLE_PROP_64_ROLE_DUTIES]
VICES: []
"""
CDV_IN_02_DECEIT_UNPROSCRIBED = CDV_IN_01.replace(
"CASE CDV_IN_01_CARGO_RELEASE:", "CASE CDV_IN_02_DECEIT_UNPROSCRIBED:"
).replace("PROSCRIBES: [VICE_DECEIT_01]", "PROSCRIBES: []"
).replace("VICES: []", "VICES: [VICE_DECEIT_01]")
_SECOND_ACTION = """
{act_id}: [AFFIRMATIVE_EXECUTION, PROHAIRESIS_INTERNAL]
DESC: "{desc}"
ROLE: ROLE_CARGO_INSPECTOR
DUTY: DUTY_RELEASE_01
AIM: AIM_TIMELY_RELEASE
RESERVATION: {reservation}
DEPENDS_ON: [PROP_MANIFEST_VERIFIED, CORPUS_BASE_AXIOM_2_AIM_SUBORDINATION]
VICES: []
"""
CDV_IN_03_TWO_SURVIVORS = CDV_IN_01.replace(
"CASE CDV_IN_01_CARGO_RELEASE:", "CASE CDV_IN_03_TWO_SURVIVORS:"
) + _SECOND_ACTION.format(act_id="ACT_RELEASE_02",
desc="Choose to sign the release electronically",
reservation="TRUE")
CDV_IN_04_MIXED = CDV_IN_01.replace(
"CASE CDV_IN_01_CARGO_RELEASE:", "CASE CDV_IN_04_MIXED:"
) + _SECOND_ACTION.format(act_id="ACT_RELEASE_NO_RESERVATION",
desc="Choose to sign, staking contentment on the outcome",
reservation="FALSE")
CDV_IN_05_VALUE_CONTAMINATION = """
CASE CDV_IN_05_CONTAMINATED:
SITUATION: "Worker attempts to justify action on the premise that corporate tenure is an intrinsic moral good."
PROPOSITIONS:
PROP_JOB_SECURITY: [DERIVED, VERIFIED, MORAL_GOOD, EXTERNAL_STATE] "Retaining company position is an intrinsic moral good"
AIMS:
AIM_KEEP_JOB: [PREFERRED_INDIFFERENT, EXTERNAL_STATE] "Continued employment"
EVIDENCE:
EV_POLICY_01: [ORGANIZATIONAL_POLICY, VERIFIED]
ASSERTS: [PROP_JOB_SECURITY]
GRANTS_ROLES: [ROLE_STAFF]
MANDATES:
DUTY DUTY_COMPLY FOR ROLE_STAFF:
DESC: "Comply with executive demands"
MODE: AFFIRMATIVE_EXECUTION
PRIORITY: 1
PROSCRIBES: []
ACTIONS:
ACT_COMPLY_01: [AFFIRMATIVE_EXECUTION, PROHAIRESIS_INTERNAL]
DESC: "Choose to comply to preserve job security"
ROLE: ROLE_STAFF
DUTY: DUTY_COMPLY
AIM: AIM_KEEP_JOB
RESERVATION: TRUE
DEPENDS_ON: [PROP_JOB_SECURITY, CORPUS_BASE_AXIOM_2_AIM_SUBORDINATION]
VICES: []
"""
CDV_IN_06_UNANCHORED = CDV_IN_01.replace(
"CASE CDV_IN_01_CARGO_RELEASE:", "CASE CDV_IN_06_UNANCHORED:"
).replace("DEPENDS_ON: [PROP_MANIFEST_VERIFIED, CORPUS_BASE_AXIOM_2_AIM_SUBORDINATION, SLE_PROP_64_ROLE_DUTIES]",
"DEPENDS_ON: [PROP_MANIFEST_VERIFIED]")
CDV_IN_07_ACTION_AS_DEED = CDV_IN_01.replace(
"CASE CDV_IN_01_CARGO_RELEASE:", "CASE CDV_IN_07_ACTION_AS_DEED:"
).replace("ACT_RELEASE_01: [AFFIRMATIVE_EXECUTION, PROHAIRESIS_INTERNAL]",
"ACT_RELEASE_01: [AFFIRMATIVE_EXECUTION, EXTERNAL_STATE]")
# Declared-limit demonstrations: these PASS, and that is the point.
LIMIT_L1_MISLABELLED = CDV_IN_05_VALUE_CONTAMINATION.replace(
"CASE CDV_IN_05_CONTAMINATED:", "CASE LIMIT_L1_MISLABELLED:"
).replace("[DERIVED, VERIFIED, MORAL_GOOD, EXTERNAL_STATE]",
"[DERIVED, VERIFIED, PREFERRED_INDIFFERENT, EXTERNAL_STATE]")
LIMIT_L2_NOMINAL_RESERVATION = CDV_IN_01.replace(
"CASE CDV_IN_01_CARGO_RELEASE:", "CASE LIMIT_L2_NOMINAL_RESERVATION:"
).replace('DESC: "Choose to sign and submit the conforming release document"',
'DESC: "Sign, saying if it can be done while staking everything on release"')
CASES: List[Tuple[str, str, str]] = [
# (name, dsl, expected DTI verdict)
("CDV_IN_01 baseline", CDV_IN_01, "CERTIFIED"),
("CDV_IN_02 deceit not proscribed by duty", CDV_IN_02_DECEIT_UNPROSCRIBED, "HALTED"),
("CDV_IN_03 two equally right actions", CDV_IN_03_TWO_SURVIVORS, "CERTIFIED"),
("CDV_IN_04 one right, one without reservation", CDV_IN_04_MIXED, "CERTIFIED"),
("CDV_IN_05 value contamination", CDV_IN_05_VALUE_CONTAMINATION, "HALTED"),
("CDV_IN_06 no path to the corpus base", CDV_IN_06_UNANCHORED, "HALTED"),
("CDV_IN_07 action coded as external deed", CDV_IN_07_ACTION_AS_DEED, "HALTED"),
]
LIMITS: List[Tuple[str, str]] = [
("L1 value claim mislabelled as indifferent", LIMIT_L1_MISLABELLED),
("L2 reservation held in name only", LIMIT_L2_NOMINAL_RESERVATION),
]
def run_suite() -> bool:
line = "=" * 72
print(line)
print(f"CDV/DTI REFERENCE SUITE v{SCHEMA_VERSION} -- EXECUTION DRIVER")
print(line)
ok = True
print("\n[1] Test cases")
base_cert = None
for name, dsl, expected in CASES:
cert = CDVKernel.evaluate(CDVCompiler.compile(dsl))
audit = CDVDTIProofValidator.audit_certificate(cert)
passed = audit["verdict"] == expected
ok &= passed
print(f" {name:<48} kernel {cert['status']:<4} DTI {audit['verdict']:<9} "
f"[{'PASSED' if passed else 'FAILED'}]")
rejected = {a: f for a, f in cert["action_flags"].items() if f}
for a, f in rejected.items():
print(f" {a}: {', '.join(f)}")
if name.startswith("CDV_IN_01"):
base_cert = cert
for sid, thesis in audit.get("theses", {}).items():
print(f' thesis: "{thesis}"')
print("\n[2] Mutation battery on the CDV_IN_01 certificate")
for m_id, (passed, expected, got) in CDVMutationOracle.run_battery(base_cert).items():
ok &= passed
note = "" if passed else f" expected {expected}, got {got}"
print(f" {m_id:<36} [{'PASSED' if passed else 'FAILED'}]{note}")
print("\n[3] Declared limits (these pass the gates by design; see header L1-L2)")
for name, dsl in LIMITS:
audit = CDVDTIProofValidator.audit_certificate(CDVKernel.evaluate(CDVCompiler.compile(dsl)))
print(f" {name:<48} DTI {audit['verdict']} (operator ratification required)")
print("\n" + line)
print("CONFORMANCE: ALL CASES AND MUTANTS DISCRIMINATED AS EXPECTED" if ok
else "CONFORMANCE: FAILURE DETECTED")
print(line)
return ok
if __name__ == "__main__":
raise SystemExit(0 if run_suite() else 1)
Version Note
v0.5.3 supersedes v0.5.2. Revised 30 September 2026 under the operator’s rulings of that day. This page replaces the v0.5.2 announcement.
Theoretical foundations: Grant C. Sterling (Eastern Illinois University). Analysis and synthesis: Dave Kelly. Prose rendering: Claude (Anthropic). 2026.


0 Comments:
Post a Comment
<< Home