diff --git a/README.md b/README.md index 05ffec47..d654bb25 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,10 @@ nothing knocks `d1` down). Run 1 of the same example discharges external validity: it declares the same argument `a1` with `external_validity` left open, so `c1` has no complete support and reports **gap**, and the verdict's `holes` section names `a1` and -the open question `external_validity`. +the open question `external_validity`. Run 1b +([`run1b/`](examples/running-example/run1b/)) adds `e6`, so `a1` is complete, +but does not yet lower the dead end to the undercut `d1`: nothing attacks +`a1`, and `c1` reports **justified**. One artifact is one paper, and a **map** is several of them. A `.laramap` manifest names independently authored, independently checkable `.lara` members diff --git a/examples/running-example/run1b/empirical-v3.policy.lara b/examples/running-example/run1b/empirical-v3.policy.lara new file mode 100644 index 00000000..01ea2951 --- /dev/null +++ b/examples/running-example/run1b/empirical-v3.policy.lara @@ -0,0 +1,149 @@ +# empirical-v3 — the running example's claim-support policy (fig:example) +# +# A policy is a *versioned trusted input* (spec §4, assumption A2). Artifact programs may +# instantiate these schemes but may not define or modify them at runtime. +# +# empirical-v3 is empirical-v1 (the policy the A/B worked examples share) extended with the +# running example's one deductive step: the score-cell vocabulary (`score_cell`, `num_lt`, +# `M0`) and the strict rule `lt_recheck`, certified by the registered ord@1 backend +# against this policy's own (empty) theory. Nothing about the artifact's @0.6 symbolic +# premise-slot spelling reaches this file: a policy declares which certifier a strict rule +# accepts and which theory its certificates cite, and the named-slot spelling is lowered +# away before any certificate is replayed. The version numbering is chronological, not a +# containment chain: empirical-v3 extends v1 alone and does NOT include empirical-v2's +# defense vocabulary (the E4/E5 reinstatement layer). +# +# Every attack in the example is licensed here, not in the artifact program: `undercut` needs an +# `exception` declaration, `rebut`/`undermine` need a `contrary` pair. This is the point of §7 — +# an ARA dead end or a reviewer note only becomes an edge if it can construct one of these typed +# forms against a declaration in THIS file. + +policy empirical-v3 + +# --- Signature (spec §2, §3.4; lara-core@0.2, issue #89) ------------------------------------------- +# The many-sorted proposition signature the checker enforces as rejection class R2 at stage 2. +# The base is empirical-v1's Σ (generated by `scripts/infer-sigma.hs` over the shared worked +# examples; see examples/A/empirical-v1.policy.lara), extended by hand with the running +# example's cell vocabulary: `M0` (the baseline system), `score_cell` (a second Report constructor, so the one +# `reports` predicate covers both effect summaries and score cells), and `num_lt`. `Num` and +# `Str` are the two built-in base sorts (the sorts of numeric and string literals) and are not +# declarable. + +sort Experiment, Report, System, Measurand, Dataset, Direction + +con D : Dataset +con D_c : Dataset +con D_d : Dataset +con D_j : Dataset +con M : System +con M0 : System +con M_c : System +con M_d : System +con M_j : System +con accuracy : Measurand +con effect(System, Measurand, Dataset, Direction) : Report +con exp_1 : Experiment +con exp_3 : Experiment +con exp_9 : Experiment +con exp_c : Experiment +con exp_cn : Experiment +con exp_cp : Experiment +con exp_d : Experiment +con exp_j : Experiment +con exp_me : Experiment +con exp_ow : Experiment +con kv_quant : System +con latency : Measurand +con mobile_edge : Dataset +con negligible : Direction +con openweb : Dataset +con paperA_exp1 : Experiment +con paperB_exp1 : Experiment +con positive : Direction +con python_code : Dataset +con score_cell(System, Measurand, Dataset, Num) : Report + +pred distribution_shift(System, Measurand, Dataset) +pred generalizes(System, Measurand, Dataset) +pred improves(System, Measurand, Dataset) +pred not_generalizes(System, Measurand, Dataset) +pred not_improves(System, Measurand, Dataset) +pred num_lt(Num, Num) +pred powered(Experiment) +pred randomized(Experiment) +pred reports(Experiment, Report) + +# --- Inference schemes ------------------------------------------------------------------------- + +# The evidence -> empirical-claim bridge is defeasible (observation O4): a positive experimental +# report presumptively supports an improvement claim, subject to critical questions. +rule controlled_experiment(M, Q, D, Exp) + mode = defeasible + premises = [ reports(Exp, effect(M, Q, D, positive)) ] + conclusion = improves(M, Q, D) + question randomization : randomized(Exp) (mandatory) + question adequate_power : powered(Exp) (mandatory) + question external_validity: generalizes(M, Q, D) (mandatory) + +# A symmetric scheme for a null / negative replication. Concludes the declared contrary of +# `improves`, so an instance of this scheme rebuts an instance of `controlled_experiment` on the +# same (M, Q, D) — this is what lets a *second paper* attack the first (example B). +rule null_result(M, Q, D, Exp) + mode = defeasible + premises = [ reports(Exp, effect(M, Q, D, negligible)) ] + conclusion = not_improves(M, Q, D) + question randomization : randomized(Exp) (mandatory) + question adequate_power : powered(Exp) (mandatory) + +# --- The certificate-checked ordered comparison ------------------------------------------------ +# The running example's one deductive step: an exact ordered re-check of the two reported +# accuracy cells, certified by the registered ord@1 backend (src/Lara/Strict/Ord.hs, +# lean/Lara/Ord.lean). Slot order is the premise list order: slot 0 is the baseline cell, +# slot 1 the system cell. The artifact's certificate cites those slots by the leaf names that +# fill them (lara-syntax@0.6, #105); that spelling is lowered to the numeric slots at +# elaboration, before this rule's certificate is ever replayed. +# +# Both compared values trace to a consulted premise (design §2.4): a threshold or public +# baseline is not a bare goal constant, it enters as a leaf feeding a premise slot. + +rule lt_recheck(S, B, Q, D, Exp, Sv, Bv) + mode = strict + premises = [ reports(Exp, score_cell(B, Q, D, Bv)), + reports(Exp, score_cell(S, Q, D, Sv)) ] + conclusion = num_lt(Bv, Sv) + allow-trusted = false + certifiers = [ (ord@1, sha256:empv3-t0) ] + +# The empty theory the ord@1 certificates cite: the certified comparison is pure arithmetic, so +# the theory contributes no entries — the digest is selection identity only (the S1 precedent). +theory sha256:empv3-t0 = [] + +# --- Conflict ---------------------------------------------------------------------------------- + +# The ONLY source of propositional conflict (spec §4, §3.2). Declared in BOTH directions on +# purpose: v0.1 `contrary` is asymmetric (spec §4.1), and `rebut` needs (concl w, concl u) to be +# a declared pair. Mutual rebuttal — two papers each defeating the other into a `contested` +# 2-cycle — therefore requires both orientations. If we later adopt the Path-A involutive +# contradictory map (spec §8.1 flip criterion) this pair collapses to a single `-improves`. +contrary improves(M, Q, D) not_improves(M, Q, D) +contrary not_improves(M, Q, D) improves(M, Q, D) + +# Contrary on the external-validity (generalization) proposition, used by the undermine +# attack in example A: the robustness appendix's `not_generalizes` defeats the leaf that +# discharges a1's external_validity CQ (`generalizes`). +contrary generalizes(M, Q, D) not_generalizes(M, Q, D) +contrary not_generalizes(M, Q, D) generalizes(M, Q, D) + +# --- Exceptions (undercutting conditions) ------------------------------------------------------ + +# "Shown otherwise", not "not shown": if the eval distribution provably shifts, the +# external-validity of a controlled_experiment instance is defeated (an undercut), not merely +# left open as a gap. Per spec §4.2 a policy chooses, per question, gap-producing (a `question`) +# vs defeat-producing (an `exception`). external_validity appears as BOTH by design. +exception controlled_experiment : distribution_shift(M, Q, D) + +# WELL-FORMEDNESS (spec §8.1, Path B): the only strict rule is lt_recheck, whose conclusion +# pattern num_lt(Bv, Sv) heads no contrary pair, so no contrary side is strict-reachable and +# every proposition in a `contrary` pair remains defeasibly attackable. The policy is therefore +# accepted; a contrary pair touching a strict-reachable proposition would be rejected at compile +# time (R12). diff --git a/examples/running-example/run1b/example.core.sexp b/examples/running-example/run1b/example.core.sexp new file mode 100644 index 00000000..7e256db5 --- /dev/null +++ b/examples/running-example/run1b/example.core.sexp @@ -0,0 +1 @@ +(check-input (replay-id (core lara-core@0.3) (policy empirical-v3) (backends (backend nd 1) (backend ord 1)) (theories sha256:empv3-t0) (artifact sha256:aaaa...)) (unit (sigma (sorts Experiment Report System Measurand Dataset Direction) (cons (con D (args) Dataset) (con D_c (args) Dataset) (con D_d (args) Dataset) (con D_j (args) Dataset) (con M (args) System) (con M0 (args) System) (con M_c (args) System) (con M_d (args) System) (con M_j (args) System) (con accuracy (args) Measurand) (con effect (args System Measurand Dataset Direction) Report) (con exp_1 (args) Experiment) (con exp_3 (args) Experiment) (con exp_9 (args) Experiment) (con exp_c (args) Experiment) (con exp_cn (args) Experiment) (con exp_cp (args) Experiment) (con exp_d (args) Experiment) (con exp_j (args) Experiment) (con exp_me (args) Experiment) (con exp_ow (args) Experiment) (con kv_quant (args) System) (con latency (args) Measurand) (con mobile_edge (args) Dataset) (con negligible (args) Direction) (con openweb (args) Dataset) (con paperA_exp1 (args) Experiment) (con paperB_exp1 (args) Experiment) (con positive (args) Direction) (con python_code (args) Dataset) (con score_cell (args System Measurand Dataset Num) Report)) (preds (pred distribution_shift (args System Measurand Dataset)) (pred generalizes (args System Measurand Dataset)) (pred improves (args System Measurand Dataset)) (pred not_generalizes (args System Measurand Dataset)) (pred not_improves (args System Measurand Dataset)) (pred num_lt (args Num Num)) (pred powered (args Experiment)) (pred randomized (args Experiment)) (pred reports (args Experiment Report)))) (policy (rules (rule controlled_experiment (mode defeasible) (params M Q D Exp) (premises (apat reports (var Exp) (con effect (var M) (var Q) (var D) (con positive)))) (conclusion (apat improves (var M) (var Q) (var D))) (questions (question randomization (apat randomized (var Exp)) mandatory) (question adequate_power (apat powered (var Exp)) mandatory) (question external_validity (apat generalizes (var M) (var Q) (var D)) mandatory)) (allow-trusted false) (certifiers)) (rule null_result (mode defeasible) (params M Q D Exp) (premises (apat reports (var Exp) (con effect (var M) (var Q) (var D) (con negligible)))) (conclusion (apat not_improves (var M) (var Q) (var D))) (questions (question randomization (apat randomized (var Exp)) mandatory) (question adequate_power (apat powered (var Exp)) mandatory)) (allow-trusted false) (certifiers)) (rule lt_recheck (mode strict) (params S B Q D Exp Sv Bv) (premises (apat reports (var Exp) (con score_cell (var B) (var Q) (var D) (var Bv))) (apat reports (var Exp) (con score_cell (var S) (var Q) (var D) (var Sv)))) (conclusion (apat num_lt (var Bv) (var Sv))) (questions) (allow-trusted false) (certifiers (certifier ord 1 sha256:empv3-t0)))) (contraries (contrary (apat improves (var M) (var Q) (var D)) (apat not_improves (var M) (var Q) (var D))) (contrary (apat not_improves (var M) (var Q) (var D)) (apat improves (var M) (var Q) (var D))) (contrary (apat generalizes (var M) (var Q) (var D)) (apat not_generalizes (var M) (var Q) (var D))) (contrary (apat not_generalizes (var M) (var Q) (var D)) (apat generalizes (var M) (var Q) (var D)))) (exceptions (exception controlled_experiment (apat distribution_shift (var M) (var Q) (var D))))) (theories (theory sha256:empv3-t0)) (leaves (leaf e1 (atom reports (con exp_3) (con effect (con M) (con accuracy) (con D) (con positive)))) (leaf base (atom reports (con exp_3) (con score_cell (con M0) (con accuracy) (con D) (num 0.71)))) (leaf ours (atom reports (con exp_3) (con score_cell (con M) (con accuracy) (con D) (num 0.74)))) (leaf e2 (atom randomized (con exp_3))) (leaf e3 (atom powered (con exp_3))) (leaf e4 (atom distribution_shift (con M) (con accuracy) (con D))) (leaf e6 (atom generalizes (con M) (con accuracy) (con D)))) (args (arg s1 (inst lt_recheck (subst (S (con M)) (B (con M0)) (Q (con accuracy)) (D (con D)) (Exp (con exp_3)) (Sv (num 0.74)) (Bv (num 0.71))) (premises (leaf base) (leaf ours)) (discharges) (holes) (assurance (cert ord 1 sha256:empv3-t0 (ordcmp (prem 0) (prem 1)))))) (arg a1 (inst controlled_experiment (subst (M (con M)) (Q (con accuracy)) (D (con D)) (Exp (con exp_3))) (premises (leaf e1)) (discharges (randomization (leaf e2)) (adequate_power (leaf e3)) (external_validity (leaf e6))) (holes) (assurance none)))) (queries (atom improves (con M) (con accuracy) (con D)) (atom num_lt (num 0.71) (num 0.74))))) diff --git a/examples/running-example/run1b/example.lara b/examples/running-example/run1b/example.lara new file mode 100644 index 00000000..c3c97eb0 --- /dev/null +++ b/examples/running-example/run1b/example.lara @@ -0,0 +1,72 @@ +# fig:example run 1b — the external-validity question is discharged by e6, +# so a1 is complete; the recorded dead end e4 is declared but not yet lowered +# to an attack, so nothing challenges a1. +# +# This is run 2 without the undercut d1: the empirical claim c1 has complete, +# unattacked support and is justified, and the strict ord@1 step s1 (authored +# in the same current surface as runs 1 and 2) keeps c2 justified. Between +# run 1 (c1 gap) and run 2 (c1 defeated), this run isolates the effect of +# discharging the question before any attack arrives. + +artifact paper_17 at sha256:aaaa... +policy empirical-v3 +use backends [nd@1, ord@1] + +let base_score = 0.71 +let ours_score = 0.74 + +claim c1 + nl = "Method M improves accuracy on distribution D" + formal = improves(M, accuracy, D) + binding = { author = alice, audit-status = reviewed } + +claim c2 + nl = "The baseline accuracy {base_score} is strictly below {ours_score}" + formal = num_lt(base_score, ours_score) + binding = { author = alice, audit-status = reviewed } + +leaf e1 : reports(exp_3, effect(M, accuracy, D, positive)) + kind = observed + provenance = ai-executed + refs = [evidence/table_2.csv#row=mean] + +leaf base : reports(exp_3, score_cell(M0, accuracy, D, base_score)) + kind = observed + provenance = ai-executed + refs = [evidence/table_2.csv#row=base] + +leaf ours : reports(exp_3, score_cell(M, accuracy, D, ours_score)) + kind = observed + provenance = ai-executed + refs = [evidence/table_2.csv#row=ours] + +leaf e2 : randomized(exp_3) + kind = attested + provenance = user + refs = [paper_17.pdf#sec=4.1] + +leaf e3 : powered(exp_3) + kind = attested + provenance = user + refs = [paper_17.pdf#sec=4.1] + +leaf e4 : distribution_shift(M, accuracy, D) + kind = attested + provenance = user + refs = [paper_17.pdf#sec=7-limitations] + +arg s1 : supports(c2) by lt_recheck from [base, ours] + assurance = cert(ord@1, sha256:empv3-t0, (ordcmp (prem base) (prem ours))) + +leaf e6 : generalizes(M, accuracy, D) + kind = observed + provenance = ai-executed + refs = [evidence/table_4.csv#row=ood] + +arg a1 : supports(c1) by controlled_experiment from [e1] + discharge randomization with e2 + discharge adequate_power with e3 + discharge external_validity with e6 + +status c1 +status c2 diff --git a/examples/running-example/run1b/expected.json b/examples/running-example/run1b/expected.json new file mode 100644 index 00000000..6bdfbd24 --- /dev/null +++ b/examples/running-example/run1b/expected.json @@ -0,0 +1,46 @@ +{ + "replay-id": { + "core": "lara-core@0.3", + "policy": "empirical-v3", + "backends": [ + "nd@1", + "ord@1" + ], + "theories": [ + "sha256:empv3-t0" + ], + "artifact": "sha256:aaaa..." + }, + "verdict-class": "accept", + "located-diagnostic": { + "kind": "accept", + "statuses": [ + { + "claim": "improves(M, accuracy, D)", + "status": "justified", + "complete-support": 1, + "holes": 0, + "incomplete-alternative": false + }, + { + "claim": "num_lt(0.71, 0.74)", + "status": "justified", + "complete-support": 1, + "holes": 0, + "incomplete-alternative": false + } + ], + "labels": [ + { + "arg": "s1", + "index": 0, + "label": "in" + }, + { + "arg": "a1", + "index": 1, + "label": "in" + } + ] + } +} diff --git a/fixtures/ANCHORS.tsv b/fixtures/ANCHORS.tsv index 4607fa35..8d8aefd0 100644 --- a/fixtures/ANCHORS.tsv +++ b/fixtures/ANCHORS.tsv @@ -117,6 +117,7 @@ examples/rebuttal-replay/round0/example.core.sexp examples/rebuttal-replay/round1/example.core.sexp examples/rebuttal-replay/round2/example.core.sexp examples/running-example/run1/example.core.sexp +examples/running-example/run1b/example.core.sexp examples/running-example/run2/example.core.sexp fixtures/corpus/accept-located-hole.sexp fixtures/corpus/accept-nested-hole-sites.sexp diff --git a/measurements/frozen/running-example.txt b/measurements/frozen/running-example.txt index 88a067e1..19af6156 100644 --- a/measurements/frozen/running-example.txt +++ b/measurements/frozen/running-example.txt @@ -6,6 +6,10 @@ $ lara check examples/running-example/run1/example.lara (verdict (replay-id (core lara-core@0.3) (policy empirical-v3) (backends (backend nd 1) (backend ord 1)) (theories sha256:empv3-t0) (artifact sha256:aaaa...)) accept (labels (0 in)) (edges) (statuses (status (atom improves (con M) (con accuracy) (con D)) gap) (status (atom num_lt (num 0.71) (num 0.74)) justified)) (holes (arg 1 a1 (obligations (obligation external_validity (pos))) (attacks)))) [exit 0] +$ lara check examples/running-example/run1b/example.lara +(verdict (replay-id (core lara-core@0.3) (policy empirical-v3) (backends (backend nd 1) (backend ord 1)) (theories sha256:empv3-t0) (artifact sha256:aaaa...)) accept (labels (0 in) (1 in)) (edges) (statuses (status (atom improves (con M) (con accuracy) (con D)) justified) (status (atom num_lt (num 0.71) (num 0.74)) justified))) +[exit 0] + $ lara check examples/running-example/run2/example.lara (verdict (replay-id (core lara-core@0.3) (policy empirical-v3) (backends (backend nd 1) (backend ord 1)) (theories sha256:empv3-t0) (artifact sha256:aaaa...)) accept (labels (0 in) (1 out) (2 in)) (edges (2 1)) (statuses (status (atom improves (con M) (con accuracy) (con D)) defeated) (status (atom num_lt (num 0.71) (num 0.74)) justified))) [exit 0] diff --git a/scripts/render-running-example.hs b/scripts/render-running-example.hs index 46c62913..77d51a11 100644 --- a/scripts/render-running-example.hs +++ b/scripts/render-running-example.hs @@ -1,6 +1,6 @@ -- | Emit the running example's pinned checker reports (P6). -- --- Thin IO shim over the pure "Lara.RunningExample": load both run programs, +-- Thin IO shim over the pure "Lara.RunningExample": load every run program, -- check them through the CLI's own pipeline, and write the golden document -- the paper pastes from. Writes directly to the frozen path — the rendering -- is environment-free, so re-running reproduces the committed bytes, and diff --git a/src/Lara/RunningExample.hs b/src/Lara/RunningExample.hs index c3d0bab3..2524bf4d 100644 --- a/src/Lara/RunningExample.hs +++ b/src/Lara/RunningExample.hs @@ -1,4 +1,4 @@ --- | The paper's running example (fig:example) as two checked programs, with +-- | The paper's running example (fig:example) as three checked programs, with -- their checker reports rendered for pasting into the paper (P6). -- -- Run 1 (@examples\/running-example\/run1@) declares the empirical claim, its @@ -6,14 +6,15 @@ -- argument @a1@. The mandatory @external_validity@ critical question has no -- discharging leaf, so @a1@ leaves it open: @a1@ is a located hole (spec §4.4), -- the claim has no complete support and is @gap@, and the verdict's @holes@ --- section names @a1@ with that obligation. Both runs also carry the +-- section names @a1@ with that obligation. All runs also carry the -- artifact's one deductive step @s1@: a strict ord\@1 comparison of the two -- reported accuracy cells, authored in the current surface (value bindings, -- an inferred instantiation, and a certificate citing its premise slots by --- leaf name), unattacked in both runs, so the certified comparison @c2@ --- stays @justified@. Run 2 (@…\/run2@) adds the discharging leaf @e6@, so --- @a1@ completes, the dead end lowers to the undercut @d1@, and the --- empirical claim flips to @defeated@. +-- leaf name), unattacked in every run, so the certified comparison @c2@ +-- stays @justified@. Run 1b (@…\/run1b@) adds the discharging leaf @e6@, so +-- @a1@ completes; nothing attacks it yet, so the empirical claim is +-- @justified@. Run 2 (@…\/run2@) additionally lowers the dead end to the +-- undercut @d1@, and the empirical claim flips to @defeated@. -- -- The rendered document reproduces the @lara check@ CLI bytes exactly: the -- CLI prints @printSExpr (encodeVerdict verdict)@ plus one newline @@ -43,10 +44,11 @@ import Lara.Elaborate import qualified Lara.Syntax as Syntax import Lara.Wire (Outcome (..), Verdict (..), encodeVerdict, printSExpr) --- | The two run programs, in paper order. +-- | The three run programs, in paper order. runPaths :: [FilePath] runPaths = [ "examples/running-example/run1/example.lara" + , "examples/running-example/run1b/example.lara" , "examples/running-example/run2/example.lara" ] diff --git a/src/Lara/WorkedExamples.hs b/src/Lara/WorkedExamples.hs index 742c8d8f..76b2bfbe 100644 --- a/src/Lara/WorkedExamples.hs +++ b/src/Lara/WorkedExamples.hs @@ -71,6 +71,7 @@ workedExamples = , ("examples/rebuttal-replay/round1", "rebuttal-v1.policy.lara") , ("examples/rebuttal-replay/round2", "rebuttal-v1.policy.lara") , ("examples/running-example/run1", "empirical-v3.policy.lara") + , ("examples/running-example/run1b", "empirical-v3.policy.lara") , ("examples/running-example/run2", "empirical-v3.policy.lara") ] diff --git a/test/DifferentialSpec.hs b/test/DifferentialSpec.hs index 670bbc8e..7ceb0ad9 100644 --- a/test/DifferentialSpec.hs +++ b/test/DifferentialSpec.hs @@ -511,9 +511,9 @@ workedExampleGoldens = ++ " (status (atom contributes (con kurtosis_salience) (con apt_llama2_7b) (con openllm_avg)) justified)))" ) , -- The paper's running example. 'RunningExampleSpec' already pins its - -- /shape/ (run 1 gap beside the justified strict comparison, run 2 - -- defeated via the undercut) and byte-diffs the rendered report against - -- @measurements/frozen/running-example.txt@; these two entries add the + -- /shape/ (run 1 gap beside the justified strict comparison, run 1b + -- justified, run 2 defeated via the undercut) and byte-diffs the rendered + -- report against @measurements/frozen/running-example.txt@; these entries add the -- exact verdict bytes, which nothing pinned before -- 'prop_goldensCoverAnchors' surfaced them. ( "examples/running-example/run1/example.core.sexp" @@ -522,6 +522,11 @@ workedExampleGoldens = ++ " (status (atom num_lt (num 0.71) (num 0.74)) justified))" ++ " (holes (arg 1 a1 (obligations (obligation external_validity (pos))) (attacks))))" ) + , ( "examples/running-example/run1b/example.core.sexp" + , "(verdict accept (labels (0 in) (1 in)) (edges)" + ++ " (statuses (status (atom improves (con M) (con accuracy) (con D)) justified)" + ++ " (status (atom num_lt (num 0.71) (num 0.74)) justified)))" + ) , ( "examples/running-example/run2/example.core.sexp" , "(verdict accept (labels (0 in) (1 out) (2 in)) (edges (2 1))" ++ " (statuses (status (atom improves (con M) (con accuracy) (con D)) defeated)" diff --git a/test/RunningExampleSpec.hs b/test/RunningExampleSpec.hs index c3f084c8..a19dec0d 100644 --- a/test/RunningExampleSpec.hs +++ b/test/RunningExampleSpec.hs @@ -1,7 +1,7 @@ -- | The paper's running example (fig:example) as a standing freshness test -- (P6): the committed golden -- @measurements\/frozen\/running-example.txt@ must reproduce byte-for-byte --- from re-checking the two run programs through the pure +-- from re-checking the three run programs through the pure -- "Lara.RunningExample" pipeline — the same module -- @scripts\/render-running-example.hs@ uses, so the pasted paper excerpt and -- the shipped checker cannot drift apart silently. @@ -9,6 +9,8 @@ -- A second property pins the semantic shape the paper narrates: run 1 -- accepts with the empirical claim @gap@, the certified comparison -- @justified@, and only the unattacked strict step @s1@ in the framework; +-- run 1b accepts with @s1@ and @a1@ both in, no edges, and both claims +-- @justified@; -- run 2 accepts with @a1@ labelled out, @d1@ in, one closure edge, the -- empirical claim @defeated@, and the certified comparison still -- @justified@. @@ -26,8 +28,8 @@ import Lara.Wire (Outcome (..), PublicStatus (..), Verdict (..), encodeVerdict, runningExampleSpecProps :: [(String, IO Result)] runningExampleSpecProps = [ ("running-example: rendered reports re-diff the committed frozen golden", quickCheckResult prop_frozenGolden) - , ("running-example: run 1 is gap beside the justified strict step, run 2 is defeated via the undercut", quickCheckResult prop_shape) - , ("running-example: c2's value-reference nl interpolates to the bound scores in both runs", quickCheckResult prop_nlInterpolation) + , ("running-example: run 1 is gap beside the justified strict step, run 1b is justified, run 2 is defeated via the undercut", quickCheckResult prop_shape) + , ("running-example: c2's value-reference nl interpolates to the bound scores in every run", quickCheckResult prop_nlInterpolation) , ("running-example: the README's quoted verdict block is run 2's verdict bytes", quickCheckResult prop_readmeVerdict) ] @@ -50,11 +52,13 @@ prop_shape :: Property prop_shape = once $ ioProperty $ do runs <- checkedRuns case map (verdictOutcome . snd) runs of - [Accept ls1 es1 sts1 _, Accept ls2 es2 sts2 _] -> + [Accept ls1 es1 sts1 _, Accept ls1b es1b sts1b _, Accept ls2 es2 sts2 _] -> pure $ conjoin [ counterexample "run 1 framework is the strict step alone, in" (map snd ls1 === [LIn] .&&. es1 === []) , counterexample "run 1 statuses are gap then justified" (map snd sts1 === [Published Gap, Published Justified]) + , counterexample "run 1b labels s1 in, a1 in, no edges" (map snd ls1b === [LIn, LIn] .&&. es1b === []) + , counterexample "run 1b statuses are justified then justified" (map snd sts1b === [Published Justified, Published Justified]) , counterexample "run 2 labels s1 in, a1 out, d1 in" (map snd ls2 === [LIn, LOut, LIn]) , counterexample "run 2 has the one closure edge" (es2 === [(2, 1)]) , counterexample "run 2 statuses are defeated then justified" (map snd sts2 === [Published Defeated, Published Justified]) @@ -65,7 +69,7 @@ prop_shape = once $ ioProperty $ do -- | The @0.4 value-reference interpolation in c2's @nl@ is the one surface -- feature of this example no golden can observe: 'claimNl' never reaches -- 'Unit', so it is absent from @example.core.sexp@, @expected.json@, and the --- frozen report. Pin the expanded prose directly: both runs' c2 must read +-- frozen report. Pin the expanded prose directly: every run's c2 must read -- with the bound scores substituted (the general mechanism is covered by -- ValueBindingsSpec; this pins THIS example's use of it). prop_nlInterpolation :: Property @@ -73,8 +77,8 @@ prop_nlInterpolation = once $ ioProperty $ do nls <- mapM expandedC2 runPaths pure $ counterexample - "expanded c2 nl in both runs" - (nls === replicate 2 "The baseline accuracy 0.71 is strictly below 0.74") + "expanded c2 nl in every run" + (nls === replicate (length runPaths) "The baseline accuracy 0.71 is strictly below 0.74") where expandedC2 path = do (progText, polText) <- loadRun path diff --git a/test/WorkedExamplesSpec.hs b/test/WorkedExamplesSpec.hs index e04f87cf..3c853dd2 100644 --- a/test/WorkedExamplesSpec.hs +++ b/test/WorkedExamplesSpec.hs @@ -1,8 +1,8 @@ -- | Golden verdicts for E1–E5 / R1–R4 plus strict-certificate example S1; -- the teaching examples A and B join them in 'examplePolicies' for the -- freshness and coverage properties, together with the D3 agreement-map and --- the three D1 rebuttal-replay rounds (round0–round2), and the two running-example --- runs (run1–run2). 'examplePolicies' is the authoritative list; no count is +-- the three D1 rebuttal-replay rounds (round0–round2), and the three running-example +-- runs (run1, run1b, run2). 'examplePolicies' is the authoritative list; no count is -- repeated in prose, so it cannot drift again. -- -- Each property loads the committed @.lara@ artifact and its co-located policy