Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
Closes #164: a certified token says which artefact was accepted (#245)
Fabio Rovai924992c24c24
diff --git a/src/closure_diff.rs b/src/closure_diff.rsindex 3b95c58a..ed93925b 100644--- a/src/closure_diff.rs+++ b/src/closure_diff.rs@@ -64,9 +64,12 @@ pub type NtTriple = Spelled;/// ```compile_fail/// use open_ontologies::closure_diff::Warrant;/// use open_ontologies::verdict::Certified;-/// let w = Warrant::Checked(Certified { theorem: "OOCert.certificate_sound" });+/// let w = Warrant::Checked(Certified {+/// theorem: "OOCert.certificate_sound",+/// subject: [0u8; 32],+/// });/// ```-#[derive(Clone, Copy, Debug, PartialEq, Eq)]+#[derive(Clone, Debug, PartialEq, Eq)]pub enum Warrant {/// The triple IS in the asserted graph. No rule fired, nothing was proved,/// and nothing needed to be: a lookup, not an entailment claim. Listed@@ -84,7 +87,7 @@ pub enum Warrant {}impl Warrant {- pub fn name(self) -> &'static str {+ pub fn name(&self) -> &'static str {match self {Warrant::AssertedInSource => "asserted_in_source",Warrant::Checked(_) => "checked",@@ -94,13 +97,13 @@ impl Warrant {/// The theorem, named only where one stands behind the word. It comes out/// of the evidence now, not out of a match arm, so an unchecked run has no/// way to print it.- pub fn theorem(self) -> Option<&'static str> {+ pub fn theorem(&self) -> Option<&'static str> {match self {Warrant::Checked(c) => Some(c.theorem()),_ => None,}}- pub fn is_checked(self) -> bool {+ pub fn is_checked(&self) -> bool {matches!(self, Warrant::Checked(_))}}@@ -218,9 +221,12 @@ impl CertificateVerdict {// new status silently becomes "checked" one refactor later.CheckerStatus::NotNeeded { what } => (ClosureVerdict::EngineOpinion, None, Some(what.clone())),};+ // Read before the move, because the verdict is no longer `Copy`: the+ // token it may carry belongs to one report and not to two.+ let theorem = verdict.theorem();CertificateVerdict {verdict,- theorem: verdict.theorem(),+ theorem,asserted,derivations,checker_report: match status {@@ -236,8 +242,11 @@ impl CertificateVerdict {}fn warrant_for_derived(&self) -> Warrant {- match self.verdict {- ClosureVerdict::Checked(c) => Warrant::Checked(c),+ match &self.verdict {+ // The one intended duplication: the row's warrant is the same+ // acceptance the certificate verdict carries, so it is the same+ // token, and `.clone()` says so where a `Copy` said nothing.+ ClosureVerdict::Checked(c) => Warrant::Checked(c.clone()),_ => Warrant::EngineOpinion,}}@@ -756,11 +765,15 @@ impl SourceClosure {});}if lost.len() < opts.max_rows {+ // Read before the move: a warrant that carries a token is no+ // longer `Copy`, and this row owns the one it was given.+ let warrant_word = warrant.name();+ let warrant_theorem = warrant.theorem();lost.push(LostEntailment {triple: t.clone(),warrant,- warrant_word: warrant.name(),- theorem: warrant.theorem(),+ warrant_word,+ theorem: warrant_theorem,rule: derivation.map(|(r, _)| r.clone()),blocking_premises: blocking,in_projection_vocabulary: in_vocab,diff --git a/src/conservativity.rs b/src/conservativity.rsindex 37bfbd27..97e478c4 100644--- a/src/conservativity.rs+++ b/src/conservativity.rs@@ -385,7 +385,7 @@ pub fn conservativity_check(rows.push(NewConsequence {triple: lost.triple.clone(),over_old_signature: true,- warrant: lost.warrant,+ warrant: lost.warrant.clone(),warrant_word: lost.warrant_word,theorem: lost.theorem,rule: lost.rule.clone(),diff --git a/src/fol_solve.rs b/src/fol_solve.rsindex 4f5b2d12..c1945364 100644--- a/src/fol_solve.rs+++ b/src/fol_solve.rs@@ -661,22 +661,30 @@ pub fn solve(problem: &FolProblem, opts: &SolveOptions, dir: &Path) -> anyhow::R// is the only constructor of the evidence `FolVerdict::// ModelChecked` requires, so this is the only place it CAN be// reached, and a second one would have to run a checker too.+ let problem_path = dir.join("problem.tsv");let mut cmd = Command::new(&checker);- cmd.arg(dir.join("problem.tsv")).arg(&model_path);- let run = CheckerRun::spawn(&CheckerBinary::found_at(checker.clone()), cmd)?;+ cmd.arg(&problem_path).arg(&model_path);+ let run = CheckerRun::spawn(+ &CheckerBinary::found_at(checker.clone()),+ cmd,+ &[&problem_path, &model_path],+ )?;let report = run.stdout().trim().to_string();std::fs::write(dir.join("checker.json"), &report)?;let exit = run.exit();out.checker_exit = Some(exit);out.checker_report = Some(report.clone());if let Some(cert) = run.accepted_naming(&[FOL_THEOREM]) {- out.verdict = FolVerdict::ModelChecked(cert);+ // Both read off the token before it moves into the verdict.out.theorem = Some(cert.theorem().to_string());// Read the goal flag back off the CHECKER's report, not// off this side's intention. The `cert` argument is the// "and the verdict is model_checked" half of the rule,- // carried by the signature instead of by this comment.- out.owl_reading = run.owl_reading(cert);+ // carried by the signature instead of by this comment. It+ // is cloned because the token also has to reach the+ // verdict, and both uses are the same acceptance.+ out.owl_reading = run.owl_reading(cert.clone());+ out.verdict = FolVerdict::ModelChecked(cert);} else {out.verdict = FolVerdict::SatisfiableOracle;out.disagreement = Some(Disagreement {diff --git a/src/projection_entailment.rs b/src/projection_entailment.rsindex b9488462..559df5d5 100644--- a/src/projection_entailment.rs+++ b/src/projection_entailment.rs@@ -667,8 +667,11 @@ impl Accepted {}/// The evidence, so a downstream verdict carries the token this run/// earned rather than re-asserting the acceptance on its own authority.+ /// A clone, because this is where the token travels from the run that+ /// earned it to the verdict that will carry it. That is the one move the+ /// token is for, and it is now written down rather than implicit.pub fn certified(&self) -> Certified {- self.certified+ self.certified.clone()}pub fn theorem(&self) -> &'static str {self.certified.theorem()@@ -796,9 +799,13 @@ pub fn run_checker(}};let mut cmd = std::process::Command::new(&bin);+ // The files this run is about, collected in the same arm that puts them on+ // the command line so the two cannot disagree.+ let mut inputs: Vec<&Path> = Vec::new();match kind {CertKind::OoCert => {cmd.arg(asserted).arg(derivations);+ inputs.extend_from_slice(&[asserted, derivations]);}CertKind::OoHorn => {let Some(r) = rules else {@@ -809,9 +816,10 @@ pub fn run_checker(};};cmd.arg("check").arg(r).arg(asserted).arg(derivations);+ inputs.extend_from_slice(&[r, asserted, derivations]);}}- let run = match CheckerRun::spawn(&CheckerBinary::found_at(bin.clone()), cmd) {+ let run = match CheckerRun::spawn(&CheckerBinary::found_at(bin.clone()), cmd, &inputs) {Ok(r) => r,Err(e) => {return CheckerStatus::Absent {@@ -871,9 +879,12 @@ pub fn run_checker(/// ```compile_fail/// use open_ontologies::projection_entailment::GoalVerdict;/// use open_ontologies::verdict::Certified;-/// let v = GoalVerdict::PreservedChecked(Certified { theorem: "OOCert.certificate_sound" });+/// let v = GoalVerdict::PreservedChecked(Certified {+/// theorem: "OOCert.certificate_sound",+/// subject: [0u8; 32],+/// });/// ```-#[derive(Clone, Copy, Debug, PartialEq, Eq)]+#[derive(Clone, Debug, PartialEq, Eq)]pub enum GoalVerdict {/// `P` entails `q`, machine-checked over `P`'s own asserted graph.PreservedChecked(Certified),@@ -908,7 +919,7 @@ impl GoalVerdict {/// "snake_case")]` used to derive, and the single source of the string now/// that the two checked variants carry a payload serde would otherwise/// have wrapped in an object.- pub fn word(self) -> &'static str {+ pub fn word(&self) -> &'static str {match self {GoalVerdict::PreservedChecked(_) => "preserved_checked",GoalVerdict::PreservedUnderSuppliedRulesChecked(_) => {@@ -929,17 +940,17 @@ impl GoalVerdict {/// enum is where the discipline is easy and the serialisation is where it/// leaks. The name now comes OUT OF THE EVIDENCE rather than out of a/// match arm, so a run that never ran the checker cannot name a theorem.- pub fn warrant(self) -> &'static str {+ pub fn warrant(&self) -> &'static str {match self {GoalVerdict::PreservedChecked(c)| GoalVerdict::PreservedUnderSuppliedRulesChecked(c) => c.theorem(),_ => "none",}}- pub fn is_checked(self) -> bool {+ pub fn is_checked(&self) -> bool {self.warrant() != "none"}- pub fn is_preserved(self) -> bool {+ pub fn is_preserved(&self) -> bool {matches!(self,GoalVerdict::PreservedChecked(_)@@ -948,7 +959,7 @@ impl GoalVerdict {| GoalVerdict::PreservedUnchecked)}- pub fn means(self) -> &'static str {+ pub fn means(&self) -> &'static str {match self {GoalVerdict::PreservedChecked(_) =>"the projection entails this goal: true in every model of the projection under the \@@ -1572,12 +1583,16 @@ pub fn check_entailment_preservation(goal: format!("{} {} {}", g.triple.0, g.triple.1, g.triple.2),source,projection,- verdict,+ // All three read before the move. The verdict may carry a token,+ // and this row is the one place it belongs.warrant: verdict.warrant(),means: verdict.means(),certificate,bounded_by_iteration_cap: bounded && !verdict.is_preserved(),goal_outside_seed_neighbourhood: outside,+ // Last, because it MOVES: the token this verdict may carry belongs+ // to this row and to nothing after it.+ verdict,});}@@ -1609,19 +1624,19 @@ pub fn check_entailment_preservation(let coverage_proxy = coverage_proxy(graph, &opts.seed_iris, &projected_ttl);// ── Counts and the verdict on the run ───────────────────────────────- let count = |f: fn(GoalVerdict) -> bool| per_goal.iter().filter(|g| f(g.verdict)).count();+ let count = |f: fn(&GoalVerdict) -> bool| per_goal.iter().filter(|g| f(&g.verdict)).count();let preserved_checked = count(|v| {matches!(v,GoalVerdict::PreservedChecked(_) | GoalVerdict::PreservedUnderSuppliedRulesChecked(_))});- let preserved_asserted = count(|v| v == GoalVerdict::PreservedAsserted);- let preserved_unchecked = count(|v| v == GoalVerdict::PreservedUnchecked);- let lost = count(|v| v == GoalVerdict::LostUnderProfileUnchecked);- let ungrounded = count(|v| v == GoalVerdict::UngroundedInSource);- let projection_only = count(|v| v == GoalVerdict::ProjectionOnly);- let certificate_rejected = count(|v| v == GoalVerdict::CertificateRejected);+ let preserved_asserted = count(|v| *v == GoalVerdict::PreservedAsserted);+ let preserved_unchecked = count(|v| *v == GoalVerdict::PreservedUnchecked);+ let lost = count(|v| *v == GoalVerdict::LostUnderProfileUnchecked);+ let ungrounded = count(|v| *v == GoalVerdict::UngroundedInSource);+ let projection_only = count(|v| *v == GoalVerdict::ProjectionOnly);+ let certificate_rejected = count(|v| *v == GoalVerdict::CertificateRejected);let exit_code = if stop_the_line.is_some() {2diff --git a/src/sat.rs b/src/sat.rsindex dfd4b93d..a95d3202 100644--- a/src/sat.rs+++ b/src/sat.rs@@ -144,7 +144,7 @@ pub fn refute(clauses: &[Clause], dir: &Path) -> anyhow::Result<SatOutcome> {let mut cmd = Command::new(checker.clone());cmd.arg(&cnf).arg(&lrat);- let checked = CheckerRun::spawn(&CheckerBinary::found_at(checker), cmd)?;+ let checked = CheckerRun::spawn(&CheckerBinary::found_at(checker), cmd, &[&cnf, &lrat])?;match checked.accepted_naming(&["Lrat.unsat_of_check"]) {Some(cert) => Ok(SatOutcome::Refuted(cert)),None => Ok(SatOutcome::Undetermined(format!(diff --git a/src/shacl_verified.rs b/src/shacl_verified.rsindex 62df6057..632fb226 100644--- a/src/shacl_verified.rs+++ b/src/shacl_verified.rs@@ -148,7 +148,7 @@ pub fn validate_verified(let mut cmd = Command::new(checker.path());cmd.arg("validate").arg(&data_path).arg(&shapes_path);- let run = CheckerRun::spawn(&checker, cmd)?;+ let run = CheckerRun::spawn(&checker, cmd, &[&data_path, &shapes_path])?;let _ = std::fs::remove_dir_all(&dir);// The checker's own JSON, echoed rather than restated. Its verdict wordsdiff --git a/src/tstp.rs b/src/tstp.rsindex 4262bd82..a1fa040e 100644--- a/src/tstp.rs+++ b/src/tstp.rs@@ -2778,7 +2778,11 @@ fn certify(r: &Report, form: &ProblemForm, proof_text: &str, dir: &Path, stem: &};let mut cmd = Command::new(&bin);cmd.arg(&path);- let run = match crate::verdict::CheckerRun::spawn(&crate::verdict::CheckerBinary::found_at(bin.clone()), cmd) {+ let run = match crate::verdict::CheckerRun::spawn(+ &crate::verdict::CheckerBinary::found_at(bin.clone()),+ cmd,+ &[&path],+ ) {Ok(run) => run,Err(e) => return Some(CertificateOutcome::CheckerRefused { exit: -1, output: e.to_string(), certificate: shown }),};diff --git a/src/verdict.rs b/src/verdict.rsindex bea82e57..7222d6d0 100644--- a/src/verdict.rs+++ b/src/verdict.rs@@ -48,12 +48,21 @@//! against the `SHASUMS.txt` a release publishes. What that buys is a way//! for an HONEST build to say which build it is; a hostile binary can print//! the same block with any numbers in it, and nothing here would notice.-//! 2. **Which artefact was accepted.** A [`Certified`] is `Copy`. Code that-//! ran the checker over goal A could attach the token to goal B. Callers-//! mint one token per run, inside the arm that owns that run's output, and-//! the token carries the theorem name so at least the WARRANT cannot drift-//! from the run that earned it. Binding the token to an artefact digest is-//! the obvious next tightening and is not done here.+//! 2. **Which artefact was accepted.** Mostly closed, and what remains is+//! named rather than rounded off. A [`Certified`] now carries the digest of+//! the inputs the accepting run was handed, computed by+//! [`CheckerRun::spawn`] from those files before it spawned, and+//! [`Certified::is_about`] lets a holder of an artefact ask whether the+//! token is about the thing in their hand. The token is no longer `Copy`,+//! so a value earned over goal A cannot silently reappear on goal B.+//!+//! What is left: it is still `Clone`, so duplication is possible, and the+//! difference is only that `.clone()` is visible where an implicit copy was+//! not. And the digest is over the files the CALLER named as the run's+//! inputs; a caller that names the wrong files gets a token bound to the+//! wrong thing. That is a lie a reader can see in the argument list next to+//! the command, which is where it should be, and it is not a lie the type+//! system prevents.//! 3. **Deserialisation.** None of these verdict types implements//! `Deserialize`, deliberately. Reading `"model_checked"` out of somebody//! else's JSON is not the same act as earning it, and a `Deserialize` impl@@ -102,12 +111,52 @@ impl CheckerBinary {#[derive(Clone, Debug)]pub struct CheckerRun {binary: PathBuf,+ subject: [u8; 32],code: Option<i32>,exit: i32,stdout: String,stderr: String,}+/// The digest of a set of files, in the framing [`CheckerRun::spawn`] uses.+///+/// Public because the comparison is the point: a holder of an artefact asks+/// whether a [`Certified`] is about THAT artefact, and both sides of that+/// question have to be computed the same way. This is the one function that+/// computes it, so the two sides cannot drift.+///+/// Each file contributes its base name, its length and its bytes, each+/// length-prefixed, so no two different sets of inputs can frame to the same+/// bytes by running together at the seam. The base name is included because+/// `oo-cert A D` handed `derivations.tsv` as the asserted file and+/// `asserted.tsv` as the derivations file is a different run from the right+/// one, and the digest should say so. The full path is NOT included: it+/// differs between machines, and a digest that changes when a directory moves+/// is a digest nobody can compare.+///+/// An unreadable input is an error and never a digest. A run whose inputs+/// could not be read cannot mint a token bound to them.+pub fn subject_digest(inputs: &[&Path]) -> std::io::Result<[u8; 32]> {+ use sha2::{Digest, Sha256};+ let mut h = Sha256::new();+ h.update(b"oo-checker-subject/1\n");+ h.update((inputs.len() as u64).to_le_bytes());+ for p in inputs {+ let name = p.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();+ h.update((name.len() as u64).to_le_bytes());+ h.update(name.as_bytes());+ let bytes = std::fs::read(p)?;+ h.update((bytes.len() as u64).to_le_bytes());+ h.update(&bytes);+ }+ Ok(h.finalize().into())+}++/// A digest as the lower-case hex a report prints.+pub fn hex32(d: &[u8; 32]) -> String {+ d.iter().map(|b| format!("{b:02x}")).collect()+}+impl CheckerRun {/// Run `cmd` and capture what it said. THE ONLY CONSTRUCTOR.///@@ -116,10 +165,26 @@ impl CheckerRun {/// code is read here and nowhere else. An error from the spawn itself is/// returned as an error and never as a run: a checker that could not be/// started did not accept anything.- pub fn spawn(binary: &CheckerBinary, mut cmd: Command) -> std::io::Result<CheckerRun> {+ pub fn spawn(+ binary: &CheckerBinary,+ mut cmd: Command,+ inputs: &[&Path],+ ) -> std::io::Result<CheckerRun> {+ // BEFORE the spawn, so the digest is of what the checker is about to+ // read rather than of whatever is on disk once it has finished. A+ // checker that writes into its own input directory would otherwise be+ // hashed after the fact.+ if inputs.is_empty() {+ return Err(std::io::Error::new(+ std::io::ErrorKind::InvalidInput,+ "a checker run must name the files it is about. A token bound to no inputs is bound to nothing, and every such token would be interchangeable with every other, which is the drift this binding exists to stop",+ ));+ }+ let subject = subject_digest(inputs)?;let out = cmd.output()?;Ok(CheckerRun {binary: binary.path().to_path_buf(),+ subject,// Kept as the `Option` the OS gave, because `None` (killed by a// signal) and `Some(n)` are different facts and one report prints// the difference.@@ -219,7 +284,7 @@ impl CheckerRun {.iter().copied().find(|t| *t == named.as_str())- .map(|theorem| Certified { theorem })+ .map(|theorem| Certified { theorem, subject: self.subject })}}@@ -232,24 +297,65 @@ impl CheckerRun {/// carries one is unreachable on any path that did not run a checker.////// ```compile_fail-/// // A struct literal: the field is private.-/// let c = open_ontologies::verdict::Certified { theorem: "OOCert.certificate_sound" };+/// // A struct literal: the fields are private.+/// let c = open_ontologies::verdict::Certified {+/// theorem: "OOCert.certificate_sound",+/// subject: [0u8; 32],+/// };/// ```////// ```compile_fail/// // And there is no constructor function to reach for either./// let c = open_ontologies::verdict::Certified::new("OOCert.certificate_sound");/// ```-#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]+///+/// ```compile_fail+/// // NOT `Copy`, so a token earned over goal A cannot silently reappear on+/// // goal B. Restoring the derive would make this compile, and a+/// // `compile_fail` doctest that compiles is a failure.+/// fn assert_copy<T: Copy>() {}+/// assert_copy::<open_ontologies::verdict::Certified>();+/// ```+/// # Which artefact, and what `Clone` still allows+///+/// The token carries the digest of the inputs the accepting run was handed,+/// computed by [`CheckerRun::spawn`] before it spawned. So a token proves+/// acceptance OF SOMETHING NAMED rather than acceptance in the abstract, and+/// [`Certified::is_about`] lets a holder of an artefact ask whether this token+/// is about the artefact in their hand.+///+/// It is deliberately NOT `Copy`. While it was, a token earned over goal A+/// could be attached to goal B by any use of the value, silently, with nothing+/// in the source to see. It is still `Clone`, so a determined caller can still+/// duplicate one — but `.clone()` is a visible act that a reader and a grep+/// can both find, which an implicit copy was not. That is the whole of the+/// difference and it is not more than that.+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]pub struct Certified {theorem: &'static str,+ subject: [u8; 32],}impl Certified {/// The machine-checked statement behind the word.- pub fn theorem(self) -> &'static str {+ pub fn theorem(&self) -> &'static str {self.theorem}++ /// The digest of what the accepting run was handed, as hex.+ pub fn subject_sha256(&self) -> String {+ hex32(&self.subject)+ }++ /// Is this token about the artefact the caller is holding?+ ///+ /// The caller computes their side with [`subject_digest`] over the same+ /// files in the same order. A `false` here means the token was earned over+ /// something else, which is exactly the drift this type could not detect+ /// before.+ pub fn is_about(&self, digest: &[u8; 32]) -> bool {+ &self.subject == digest+ }}// ───────────────────────────────────────────────────────────────────────────@@ -265,9 +371,9 @@ impl Certified {/// ```compile_fail/// use open_ontologies::verdict::{Certified, FolVerdict};/// // The laundering line, as it would have to be written today.-/// let v = FolVerdict::ModelChecked(Certified { theorem: "Fol.satisfiable_of_check" });+/// let v = FolVerdict::ModelChecked(Certified { theorem: "Fol.satisfiable_of_check", subject: [0u8; 32] });/// ```-#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]pub enum FolVerdict {/// CERTIFIED. `oo-folmodel` accepted the structure. Requires exit 0.ModelChecked(Certified),@@ -283,7 +389,7 @@ pub enum FolVerdict {impl FolVerdict {/// The wire word. Byte-identical to the string literals this replaced.- pub fn word(self) -> &'static str {+ pub fn word(&self) -> &'static str {match self {FolVerdict::ModelChecked(_) => "model_checked",FolVerdict::SatisfiableOracle => "satisfiable_oracle",@@ -293,7 +399,7 @@ impl FolVerdict {}}/// The theorem, named only where one stands behind the word.- pub fn theorem(self) -> Option<&'static str> {+ pub fn theorem(&self) -> Option<&'static str> {match self {FolVerdict::ModelChecked(c) => Some(c.theorem()),_ => None,@@ -320,7 +426,7 @@ impl FolVerdict {/// `goal_negated_present` AND the verdict is `model_checked`. Both conditions/// are now arguments that cannot be faked — the report is read off/// [`CheckerRun::output`], and the `Certified` is the verdict's own evidence.-#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]pub struct OwlReading(Certified);impl OwlReading {@@ -328,7 +434,7 @@ impl OwlReading {/// `OwlLean.adequacy` in a sibling project AND on a Rust-to-Lean/// correspondence that decision 0005 item 2 says is pinned by tests and/// NOT proved.- pub fn word(self) -> &'static str {+ pub fn word(&self) -> &'static str {"not_entailed_under_unproved_translation"}}@@ -355,9 +461,9 @@ impl CheckerRun {////// ```compile_fail/// use open_ontologies::verdict::{Certified, ClosureVerdict};-/// let v = ClosureVerdict::Checked(Certified { theorem: "OOCert.certificate_sound" });+/// let v = ClosureVerdict::Checked(Certified { theorem: "OOCert.certificate_sound", subject: [0u8; 32] });/// ```-#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]pub enum ClosureVerdict {/// CERTIFIED. `oo-cert` or `oo-horn` accepted the whole certificate.Checked(Certified),@@ -369,14 +475,14 @@ pub enum ClosureVerdict {}impl ClosureVerdict {- pub fn word(self) -> &'static str {+ pub fn word(&self) -> &'static str {match self {ClosureVerdict::Checked(_) => "checked",ClosureVerdict::Rejected => "rejected",ClosureVerdict::EngineOpinion => "engine_opinion",}}- pub fn theorem(self) -> Option<&'static str> {+ pub fn theorem(&self) -> Option<&'static str> {match self {ClosureVerdict::Checked(c) => Some(c.theorem()),_ => None,@@ -499,10 +605,10 @@ mod tests {fn no_engine_word_is_a_checker_word() {let mut ours: Vec<&str> = Vec::new();ours.extend(FolVerdict::WORDS);- ours.push(OwlReading::word(OwlReading(Certified { theorem: "x" })));+ ours.push(OwlReading(Certified { theorem: "x", subject: [0u8; 32] }).word());ours.push(ClosureVerdict::Rejected.word());ours.push(ClosureVerdict::EngineOpinion.word());- ours.push(ClosureVerdict::Checked(Certified { theorem: "x" }).word());+ ours.push(ClosureVerdict::Checked(Certified { theorem: "x", subject: [0u8; 32] }).word());ours.push(EngineRefutation::ClashFoundByThisEngine.word());ours.push(EngineRefutation::RefutationWrittenNotYetChecked.word());for w in ours {@@ -558,11 +664,20 @@ mod tests {}}+ /// A file for the shell runs to be ABOUT. They test exit codes and theorem+ /// names, not content, but a run must name its inputs, so they name this.+ fn a_file(tag: &str, body: &str) -> PathBuf {+ let p = std::env::temp_dir()+ .join(format!("oo-verdict-{tag}-{}.txt", std::process::id()));+ std::fs::write(&p, body).expect("write the scratch input");+ p+ }+/// A non-zero exit mints nothing, and there is no other route to a token.#[test]fn a_non_zero_exit_yields_no_certificate() {let (bin, c) = shell_exiting(1);- let run = CheckerRun::spawn(&bin, c).expect("the system shell runs");+ let run = CheckerRun::spawn(&bin, c, &[&a_file("shell", "input")]).expect("the system shell runs");assert_eq!(run.exit(), 1);assert!(run.accepted_naming(&["OOCert.certificate_sound"]).is_none());}@@ -570,10 +685,10 @@ mod tests {#[test]fn a_zero_exit_mints_the_theorem_the_checker_named() {let (bin, c) = shell_exiting(0);- let run = CheckerRun::spawn(&bin, c).expect("the system shell runs");+ let run = CheckerRun::spawn(&bin, c, &[&a_file("shell", "input")]).expect("the system shell runs");let cert = run.accepted_naming(&["OOCert.certificate_sound"]).expect("exit 0");assert_eq!(cert.theorem(), "OOCert.certificate_sound");- assert_eq!(FolVerdict::ModelChecked(cert).word(), "model_checked");+ assert_eq!(FolVerdict::ModelChecked(cert.clone()).word(), "model_checked");assert_eq!(FolVerdict::ModelChecked(cert).theorem(), Some("OOCert.certificate_sound"));}@@ -584,7 +699,7 @@ mod tests {#[test]fn a_zero_exit_naming_another_theorem_mints_nothing() {let (bin, c) = shell_saying(0, Some("OOCert.something_weaker"));- let run = CheckerRun::spawn(&bin, c).expect("the system shell runs");+ let run = CheckerRun::spawn(&bin, c, &[&a_file("shell", "input")]).expect("the system shell runs");assert_eq!(run.exit(), 0);assert_eq!(run.named_theorem().as_deref(), Some("OOCert.something_weaker"));assert!(run.accepted_naming(&["OOCert.certificate_sound"]).is_none());@@ -595,7 +710,7 @@ mod tests {#[test]fn a_zero_exit_naming_no_theorem_mints_nothing() {let (bin, c) = shell_saying(0, None);- let run = CheckerRun::spawn(&bin, c).expect("the system shell runs");+ let run = CheckerRun::spawn(&bin, c, &[&a_file("shell", "input")]).expect("the system shell runs");assert_eq!(run.exit(), 0);assert_eq!(run.named_theorem(), None);assert!(run.accepted_naming(&["OOCert.certificate_sound"]).is_none());@@ -607,7 +722,7 @@ mod tests {let allowed = ["OOCert.horn_certificate_sound", "OOCert.entails_of_builtin_horn"];for named in allowed {let (bin, c) = shell_saying(0, Some(named));- let run = CheckerRun::spawn(&bin, c).expect("the system shell runs");+ let run = CheckerRun::spawn(&bin, c, &[&a_file("shell", "input")]).expect("the system shell runs");let cert = run.accepted_naming(&allowed).expect("exit 0 naming an allowed theorem");assert_eq!(cert.theorem(),@@ -623,7 +738,7 @@ mod tests {fn a_checker_that_cannot_start_is_not_a_run() {let bin = CheckerBinary::found_at(PathBuf::from("/nonexistent/oo-cert"));let c = Command::new("/nonexistent/oo-cert");- assert!(CheckerRun::spawn(&bin, c).is_err());+ assert!(CheckerRun::spawn(&bin, c, &[&a_file("shell", "input")]).is_err());}/// The wire words, pinned as literals. A rename that changed one of these@@ -640,9 +755,17 @@ mod tests {serde_json::to_string(&EngineRefutation::ClashFoundByThisEngine).unwrap(),"\"clash_found_by_this_engine\"");- let cert = Certified { theorem: "Fol.satisfiable_of_check" };- assert_eq!(serde_json::to_string(&FolVerdict::ModelChecked(cert)).unwrap(), "\"model_checked\"");- assert_eq!(serde_json::to_string(&ClosureVerdict::Checked(cert)).unwrap(), "\"checked\"");+ let cert = Certified { theorem: "Fol.satisfiable_of_check", subject: [0u8; 32] };+ // `.clone()` three times where a `Copy` token needed none. That is the+ // change this issue asked for, visible at its first call site.+ assert_eq!(+ serde_json::to_string(&FolVerdict::ModelChecked(cert.clone())).unwrap(),+ "\"model_checked\""+ );+ assert_eq!(+ serde_json::to_string(&ClosureVerdict::Checked(cert.clone())).unwrap(),+ "\"checked\""+ );assert_eq!(serde_json::to_string(&OwlReading(cert)).unwrap(),"\"not_entailed_under_unproved_translation\""diff --git a/tests/certified_token_binding_test.rs b/tests/certified_token_binding_test.rsnew file mode 100644index 00000000..7b863f40--- /dev/null+++ b/tests/certified_token_binding_test.rs@@ -0,0 +1,179 @@+//! A certified token says WHICH artefact was accepted, not merely that+//! something was.+//!+//! Issue #164. `Certified` proved *an* acceptance: it carried the theorem name+//! the checker printed, so the warrant could not drift from the run that+//! earned it, but nothing tied it to the thing the run was about. It was also+//! `Copy`, so a token earned over goal A could reappear on goal B through any+//! use of the value, invisibly. The issue called the existing safety what it+//! was: discipline, not a type.+//!+//! Two changes, and the second is what makes the first structural.+//!+//! The token now carries the digest of the inputs the accepting run was+//! handed, computed by `CheckerRun::spawn` from those files **before** it+//! spawned, so a checker that writes into its own input directory is hashed as+//! it was read rather than as it was left. `Certified::is_about` lets a holder+//! of an artefact ask whether the token is about the thing in their hand.+//!+//! And the token is no longer `Copy`. It is still `Clone`, which this file+//! does not pretend otherwise about: the difference is that `.clone()` is a+//! visible act a reader and a grep can both find, where an implicit copy was+//! neither.+//!+//! A shell script is not `oo-cert`, and `src/verdict.rs` states plainly that+//! the type system cannot tell the two apart — that is residual hole 1 and+//! this issue does not close it. What a script CAN do is exit zero while+//! naming a theorem, which is the whole of what the mint reads, so it is+//! enough to test what the mint does with the digest.++use open_ontologies::verdict::{subject_digest, CheckerBinary, CheckerRun};+use std::path::{Path, PathBuf};+use std::process::Command;++const THEOREM: &str = "OOCert.certificate_sound";++/// ONE DIRECTORY PER TEST, and the reason is worth writing down.+///+/// These tests first shared a single directory keyed on the process id, and+/// two of them wrote a file called `asserted.tsv` into it. Cargo runs tests in+/// parallel threads of one process, so one test's write landed between+/// another's run and its recomputation, and the digests disagreed. It passed+/// on my machine and failed on CI, which is the signature of exactly this.+/// The script the fake checker runs lives here too: writing over a file+/// another thread is executing is `ETXTBSY` on Linux.+fn dir(tag: &str) -> PathBuf {+ let d = std::env::temp_dir().join(format!("oo-token-binding-{}-{tag}", std::process::id()));+ std::fs::create_dir_all(&d).unwrap();+ d+}++fn file(tag: &str, name: &str, body: &str) -> PathBuf {+ let p = dir(tag).join(name);+ std::fs::write(&p, body).unwrap();+ p+}++/// A script that exits zero and prints a theorem, which is all the mint reads.+fn fake_checker(tag: &str) -> PathBuf {+ let ext = if cfg!(windows) { "cmd" } else { "sh" };+ let p = dir(tag).join(format!("accepts.{ext}"));+ let say = format!(r#"{{"ok":true,"theorem":"{THEOREM}"}}"#);+ let body = if cfg!(windows) {+ format!("@echo off\r\necho {say}\r\nexit /b 0\r\n")+ } else {+ format!("#!/bin/sh\necho '{say}'\nexit 0\n")+ };+ std::fs::write(&p, body).unwrap();+ #[cfg(unix)]+ {+ use std::os::unix::fs::PermissionsExt as _;+ std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o755)).unwrap();+ }+ p+}++fn run_over(tag: &str, inputs: &[&Path]) -> std::io::Result<CheckerRun> {+ let bin = fake_checker(tag);+ let mut cmd = Command::new(&bin);+ for i in inputs {+ cmd.arg(i);+ }+ CheckerRun::spawn(&CheckerBinary::found_at(bin), cmd, inputs)+}++#[test]+fn a_token_is_about_the_artefact_its_run_was_handed() {+ let a = file("about", "asserted.tsv", "s\tp\to\n");+ let run = run_over("about", &[&a]).expect("the script runs");+ let token = run.accepted_naming(&[THEOREM]).expect("exit 0 naming the theorem");++ let mine = subject_digest(&[&a]).expect("the caller hashes the same file");+ assert!(+ token.is_about(&mine),+ "a holder of the artefact the checker was handed must be able to recognise the token"+ );+ assert_eq!(token.subject_sha256().len(), 64, "a sha256 in hex");+}++#[test]+fn a_token_earned_over_one_artefact_is_not_about_another() {+ let a = file("other", "goal-a.tsv", "a\tp\to\n");+ let b = file("other", "goal-b.tsv", "b\tp\to\n");+ let token = run_over("other", &[&a]).unwrap().accepted_naming(&[THEOREM]).expect("minted");++ let other = subject_digest(&[&b]).unwrap();+ assert!(+ !token.is_about(&other),+ "THE DEFECT THIS CLOSES. A token earned over one artefact answered nothing about \+ another, so a caller could attach it to a second goal and no check objected"+ );+}++#[test]+fn the_digest_is_of_the_bytes_and_not_of_the_path() {+ // The same content under two directories is the same subject: a digest that+ // changed when a directory moved would be a digest nobody could compare.+ let one = dir("bytes").join("one");+ let two = dir("bytes").join("two");+ std::fs::create_dir_all(&one).unwrap();+ std::fs::create_dir_all(&two).unwrap();+ let p1 = one.join("asserted.tsv");+ let p2 = two.join("asserted.tsv");+ std::fs::write(&p1, "s\tp\to\n").unwrap();+ std::fs::write(&p2, "s\tp\to\n").unwrap();+ assert_eq!(subject_digest(&[&p1]).unwrap(), subject_digest(&[&p2]).unwrap());++ // And a different byte is a different subject.+ std::fs::write(&p2, "s\tp\tOTHER\n").unwrap();+ assert_ne!(subject_digest(&[&p1]).unwrap(), subject_digest(&[&p2]).unwrap());+}++#[test]+fn the_digest_knows_which_file_played_which_part() {+ // `oo-cert A D` handed the derivations as the asserted file is a different+ // run from the right one, and the digest has to say so. The base name is in+ // the framing for exactly this.+ let a = file("parts", "asserted.tsv", "same bytes\n");+ let d = file("parts", "derivations.tsv", "same bytes\n");+ assert_ne!(+ subject_digest(&[&a, &d]).unwrap(),+ subject_digest(&[&d, &a]).unwrap(),+ "swapping which file is the asserted one must change the subject"+ );+}++#[test]+fn a_run_that_names_no_inputs_mints_nothing_because_it_cannot_start() {+ let e = run_over("empty", &[]).expect_err("a run about nothing is refused");+ assert_eq!(e.kind(), std::io::ErrorKind::InvalidInput);+ assert!(+ e.to_string().contains("must name the files it is about"),+ "the refusal must say why: {e}"+ );+}++#[test]+fn an_unreadable_input_is_an_error_and_never_a_digest() {+ let missing = dir("missing").join("was-never-written.tsv");+ assert!(subject_digest(&[&missing]).is_err());+ assert!(+ run_over("missing", &[&missing]).is_err(),+ "a run whose inputs could not be read must not mint a token bound to them"+ );+}++/// The `Copy` removal, asserted where a reader will look for it.+///+/// A trait bound is the only way to state this from outside the crate, and a+/// `compile_fail` doctest is the only way to assert that a bound does NOT+/// hold. This test exists so the claim has a home in the test suite; the+/// enforcing half is the doctest on `Certified` itself.+#[test]+fn the_token_is_clone_but_not_copy() {+ fn assert_clone<T: Clone>() {}+ assert_clone::<open_ontologies::verdict::Certified>();+ // `assert_copy::<Certified>()` is a compile error, asserted by the+ // `compile_fail` doctest in src/verdict.rs. Restoring `Copy` would make+ // that doctest compile, and a `compile_fail` doctest that compiles fails.+}diff --git a/tests/checker_self_identification_test.rs b/tests/checker_self_identification_test.rsindex f5b00bee..a9ea570c 100644--- a/tests/checker_self_identification_test.rs+++ b/tests/checker_self_identification_test.rs@@ -204,9 +204,11 @@ fn the_rust_side_reads_the_block_and_invents_nothing() {let bin = bin_dir().join("oo-cert");let mut cmd = Command::new(&bin);cmd.arg(&a).arg(&der);+ // Gated, and naming the files it is about (#164): the same two the command+ // line carries.let run = {let _gate = common::exec_gate();- CheckerRun::spawn(&CheckerBinary::found_at(bin.clone()), cmd)+ CheckerRun::spawn(&CheckerBinary::found_at(bin.clone()), cmd, &[&a, &der])}.expect("runs");let block = run.checker_block().expect("an oo-cert since #204 prints one");@@ -239,10 +241,16 @@ fn something_that_prints_no_block_yields_none() {std::fs::set_permissions(&script, std::fs::Permissions::from_mode(0o755)).unwrap();}}+ // A file for the run to be ABOUT. Since #164 a run must name its inputs,+ // because a token bound to nothing would be interchangeable with every+ // other one. This fake reads it no more than a real checker would read an+ // argument it ignores; what matters here is what it PRINTS.+ let about = d.join("about.tsv");+ std::fs::write(&about, "<a>\t<b>\t<c>\n").unwrap();let cmd = Command::new(&script);let run = {let _gate = common::exec_gate();- CheckerRun::spawn(&CheckerBinary::found_at(script), cmd)+ CheckerRun::spawn(&CheckerBinary::found_at(script), cmd, &[&about])}.expect("runs");assert_eq!(run.named_theorem().as_deref(), Some("OOCert.certificate_sound"));diff --git a/tests/fol_solver_verdict_test.rs b/tests/fol_solver_verdict_test.rsindex 7a896360..62e3a0a4 100644--- a/tests/fol_solver_verdict_test.rs+++ b/tests/fol_solver_verdict_test.rs@@ -370,7 +370,7 @@ fn the_owl_reading_is_read_off_the_checkers_own_report() {// the presence of the value is what says the checker reported a negated// goal on a run it accepted.assert_eq!(- withgoal.owl_reading.map(|r| r.word()),+ withgoal.owl_reading.as_ref().map(|r| r.word()),Some("not_entailed_under_unproved_translation"));assert!(diff --git a/tests/lean_projection_entailment_test.rs b/tests/lean_projection_entailment_test.rsindex 38048388..e42582ab 100644--- a/tests/lean_projection_entailment_test.rs+++ b/tests/lean_projection_entailment_test.rs@@ -366,10 +366,10 @@ fn a_claim_entailed_by_neither_is_not_lost() {&format!("{PREFIXES}:a a :Ghost .\n"),&opts("cell-ungrounded", &[]),);- let v = r.per_goal[0].verdict;- assert_eq!(v, GoalVerdict::UngroundedInSource, "{}", r.headline);+ let v = &r.per_goal[0].verdict;+ assert_eq!(*v, GoalVerdict::UngroundedInSource, "{}", r.headline);assert!(!v.is_preserved(), "an ungrounded claim is not preserved");- assert_ne!(v, GoalVerdict::LostUnderProfileUnchecked, "and it is not lost either");+ assert_ne!(*v, GoalVerdict::LostUnderProfileUnchecked, "and it is not lost either");assert!(r.per_goal[0].means.contains("generator"),"the report must send this to the right team: {}",@@ -649,12 +649,12 @@ fn a_rejected_slice_never_downgrades_to_preserved_unchecked() {&format!("{PREFIXES}:a a :C .\n"),&o,);- let v = r.per_goal[0].verdict;- assert_ne!(v, GoalVerdict::PreservedUnchecked, "a rejection must NOT downgrade: {v:?}");- assert_ne!(v, "preserved_checked");+ let v = &r.per_goal[0].verdict;+ assert_ne!(*v, GoalVerdict::PreservedUnchecked, "a rejection must NOT downgrade: {v:?}");+ assert_ne!(*v, "preserved_checked");assert!(!v.is_preserved(), "a rejected sub-certificate is not a preserved goal: {v:?}");assert_eq!(- v,+ *v,GoalVerdict::CertificateRejected,"and it gets its own word rather than borrowing projection_only's, whose `means` would \say the source does not derive the goal, which is false here"diff --git a/tests/verdict_vocabulary_test.rs b/tests/verdict_vocabulary_test.rsindex 1d6ed729..281609ec 100644--- a/tests/verdict_vocabulary_test.rs+++ b/tests/verdict_vocabulary_test.rs@@ -111,14 +111,35 @@ fn script_saying(code: i32, theorem: &str) -> PathBuf {/// type system cannot tell the two apart. What it CAN say is that a process/// ran and exited zero, and that is exactly what this borrows in order to name/// the certified variants below.+/// A file for the fake checker run to be ABOUT. A run must name its inputs,+/// because a token bound to nothing would be interchangeable with every other.+fn input_file() -> std::path::PathBuf {+ // A fresh path per call. Several tests in this file call `earned()` at+ // once, in parallel threads of one process, and a shared path means one+ // thread rewriting a file while another reads it to compute the run's+ // subject digest. Nothing here asserts on that digest, so the worst case+ // today is a torn read nobody notices, which is precisely the kind of+ // latent race that becomes a mystery the day somebody does assert on it.+ static NEXT_INPUT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);+ let serial = NEXT_INPUT.fetch_add(1, std::sync::atomic::Ordering::Relaxed);+ let p = std::env::temp_dir()+ .join(format!("oo-vocab-{}-{serial}.txt", std::process::id()));+ std::fs::write(&p, "the artefact this fake run is about").expect("write it");+ p+}+fn earned(theorem: &'static str) -> Certified {// The fake has to PRINT the theorem, because that is now what the mint// reads. A shell that exits zero in silence is a checker that named// nothing, and it correctly mints nothing.let (bin, cmd) = shell_naming(theorem);+ // Both halves belong. The gate is main's, so no fork is in flight while a+ // file is being written; the named input is this change's, because a run+ // must say what it is about. `input_file()` writes, so it is called INSIDE+ // the gate rather than before it.let run = {let _gate = common::exec_gate();- CheckerRun::spawn(&bin, cmd)+ CheckerRun::spawn(&bin, cmd, &[&input_file()])}.expect("the system shell must be runnable");assert_eq!(run.exit(), 0);@@ -152,23 +173,23 @@ fn every_word() -> Vec<(&'static str, String)> {let cert = earned("OOCert.certificate_sound");vec![// decision 0006, `onto_fol_model`- ("FolVerdict::ModelChecked", FolVerdict::ModelChecked(cert).word().to_string()),+ ("FolVerdict::ModelChecked", FolVerdict::ModelChecked(cert.clone()).word().to_string()),("FolVerdict::SatisfiableOracle", FolVerdict::SatisfiableOracle.word().to_string()),("FolVerdict::NoModelUpToSizeK", FolVerdict::NoModelUpToSizeK.word().to_string()),("FolVerdict::UnsatisfiableOracle", FolVerdict::UnsatisfiableOracle.word().to_string()),("FolVerdict::UnknownOracle", FolVerdict::UnknownOracle.word().to_string()),// decision 0002 / 0007, the closure certificate- ("ClosureVerdict::Checked", ClosureVerdict::Checked(cert).word().to_string()),+ ("ClosureVerdict::Checked", ClosureVerdict::Checked(cert.clone()).word().to_string()),("ClosureVerdict::Rejected", ClosureVerdict::Rejected.word().to_string()),("ClosureVerdict::EngineOpinion", ClosureVerdict::EngineOpinion.word().to_string()),- ("Warrant::Checked", Warrant::Checked(cert).name().to_string()),+ ("Warrant::Checked", Warrant::Checked(cert.clone()).name().to_string()),("Warrant::AssertedInSource", Warrant::AssertedInSource.name().to_string()),("Warrant::EngineOpinion", Warrant::EngineOpinion.name().to_string()),// decision 0007, per goal- ("GoalVerdict::PreservedChecked", GoalVerdict::PreservedChecked(cert).word().to_string()),+ ("GoalVerdict::PreservedChecked", GoalVerdict::PreservedChecked(cert.clone()).word().to_string()),("GoalVerdict::PreservedUnderSuppliedRulesChecked",- GoalVerdict::PreservedUnderSuppliedRulesChecked(cert).word().to_string(),+ GoalVerdict::PreservedUnderSuppliedRulesChecked(cert.clone()).word().to_string(),),("GoalVerdict::PreservedAsserted", GoalVerdict::PreservedAsserted.word().to_string()),("GoalVerdict::PreservedUnchecked", GoalVerdict::PreservedUnchecked.word().to_string()),@@ -244,20 +265,20 @@ fn the_wire_words_are_exactly_these() {fn serde_writes_the_bare_word_and_never_an_object() {let cert = earned("OOCert.certificate_sound");let cases: Vec<(String, &str)> = vec![- (serde_json::to_string(&FolVerdict::ModelChecked(cert)).unwrap(), "\"model_checked\""),+ (serde_json::to_string(&FolVerdict::ModelChecked(cert.clone())).unwrap(), "\"model_checked\""),(serde_json::to_string(&FolVerdict::SatisfiableOracle).unwrap(),"\"satisfiable_oracle\"",),- (serde_json::to_string(&ClosureVerdict::Checked(cert)).unwrap(), "\"checked\""),- (serde_json::to_string(&Warrant::Checked(cert)).unwrap(), "\"checked\""),+ (serde_json::to_string(&ClosureVerdict::Checked(cert.clone())).unwrap(), "\"checked\""),+ (serde_json::to_string(&Warrant::Checked(cert.clone())).unwrap(), "\"checked\""),(serde_json::to_string(&Warrant::AssertedInSource).unwrap(), "\"asserted_in_source\""),(- serde_json::to_string(&GoalVerdict::PreservedChecked(cert)).unwrap(),+ serde_json::to_string(&GoalVerdict::PreservedChecked(cert.clone())).unwrap(),"\"preserved_checked\"",),(- serde_json::to_string(&GoalVerdict::PreservedUnderSuppliedRulesChecked(cert)).unwrap(),+ serde_json::to_string(&GoalVerdict::PreservedUnderSuppliedRulesChecked(cert.clone())).unwrap(),"\"preserved_under_supplied_rules_checked\"",),(@@ -296,9 +317,9 @@ fn no_word_the_engine_states_is_a_word_a_lean_checker_states() {#[test]fn a_theorem_is_named_only_where_the_evidence_is() {let cert = earned("OOCert.certificate_sound");- assert_eq!(GoalVerdict::PreservedChecked(cert).warrant(), "OOCert.certificate_sound");- assert_eq!(Warrant::Checked(cert).theorem(), Some("OOCert.certificate_sound"));- assert_eq!(ClosureVerdict::Checked(cert).theorem(), Some("OOCert.certificate_sound"));+ assert_eq!(GoalVerdict::PreservedChecked(cert.clone()).warrant(), "OOCert.certificate_sound");+ assert_eq!(Warrant::Checked(cert.clone()).theorem(), Some("OOCert.certificate_sound"));+ assert_eq!(ClosureVerdict::Checked(cert.clone()).theorem(), Some("OOCert.certificate_sound"));for v in [GoalVerdict::PreservedAsserted,