Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
149 changes: 149 additions & 0 deletions examples/running-example/run1b/empirical-v3.policy.lara
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions examples/running-example/run1b/example.core.sexp
Original file line number Diff line number Diff line change
@@ -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)))))
72 changes: 72 additions & 0 deletions examples/running-example/run1b/example.lara
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions examples/running-example/run1b/expected.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
1 change: 1 addition & 0 deletions fixtures/ANCHORS.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions measurements/frozen/running-example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion scripts/render-running-example.hs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading
Loading