Documentation

CslibFrontier.Logics.Propositional.LineProof

Line-based DAG derivations #

Propositional proof systems such as resolution, cutting planes and Frege present derivations as sequences of lines in which each line is a hypothesis, an axiom, or inferred from earlier lines by a sound rule. Recording a derivation in reverse chronological order (from its last line to its first) lets a derivation grow by consing a new line in front while referencing any earlier line in the tail, so shared intermediate lines are reused as a directed acyclic graph rather than re-derived as a tree.

This module factors the common DAG proof-list combinators once over an arbitrary line type L:

The bridge from sound derivations of arity at most two to semantic derivations (Cslib.Logic.PL.IsSemanticDerivation) lives in CslibFrontier.Logics.Propositional.LineProof.SemanticDerivation.

Main definitions #

Main results #

References #

structure Cslib.Logic.PL.LineRule (L : Type u_1) :
Type u_1

An inference rule on lines of type L: from premises infer concl. An axiom is a rule with premises = [].

  • premises : List L

    The earlier lines required by the rule.

  • concl : L

    The line inferred by the rule.

theorem Cslib.Logic.PL.LineRule.ext {L : Type u_1} {x y : LineRule L} (premises : x.premises = y.premises) (concl : x.concl = y.concl) :
x = y
inductive Cslib.Logic.PL.LineProof {L : Type u_1} (R : Set (LineRule L)) (Γ : Set L) :
List L → Prop

A line-based DAG derivation using rules R from hypotheses Γ, listed from its last line to its first: every line is either in Γ or the conclusion of a rule in R whose premises already appear below it in the derivation.

theorem Cslib.Logic.PL.LineProof.mono_hyp {L : Type u_1} {R : Set (LineRule L)} {Γ Δ : Set L} {ls : List L} (h : LineProof R Γ ls) (hΓ : Γ ⊆ Δ) :
LineProof R Δ ls

Enlarging the hypothesis set preserves derivations.

theorem Cslib.Logic.PL.LineProof.mono_rules {L : Type u_1} {R R' : Set (LineRule L)} {Γ : Set L} {ls : List L} (h : LineProof R Γ ls) (hR : R ⊆ R') :
LineProof R' Γ ls

Enlarging the rule set preserves derivations.

theorem Cslib.Logic.PL.LineProof.restrict {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls : List L} (h : LineProof R Γ ls) :
LineProof R (Γ ∩ {x : L | x ∈ ls}) ls

A derivation uses only the hypotheses that appear among its lines.

theorem Cslib.Logic.PL.LineProof.append {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls ls' : List L} (h : LineProof R Γ ls) (h' : LineProof R Γ ls') :
LineProof R Γ (ls ++ ls')

Placing a derivation ls on top of a derivation ls' from the same rules and hypotheses gives a derivation ls ++ ls'.

theorem Cslib.Logic.PL.LineProof.holds {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls : List L} {Sem : L → Prop} (h : LineProof R Γ ls) (hΓ : ∀ x ∈ Γ, Sem x) (hR : ∀ r ∈ R, (∀ p ∈ r.premises, Sem p) → Sem r.concl) (x : L) :
x ∈ ls → Sem x

Soundness: if every hypothesis in Γ satisfies Sem and every rule in R preserves Sem from its premises to its conclusion, then every line of ls satisfies Sem.

DAG replay and cut #

theorem Cslib.Logic.PL.LineProof.comp {L : Type u_1} {R : Set (LineRule L)} {Γ Δ : Set L} {ls ls' : List L} (hΔ : LineProof R Δ ls') (h : LineProof R Γ ls) (hΔΓ : ∀ x ∈ Δ, x ∈ Γ ∨ x ∈ ls) :
∃ (ls'' : List L), LineProof R Γ (ls'' ++ ls) ∧ (∀ x ∈ ls', x ∈ ls'' ++ ls) ∧ ls''.Sublist ls' ∧ ls''.Nodup ∧ ∀ x ∈ ls'', x ∉ ls

DAG replay / cut: a derivation ls' from Δ replays on top of a derivation ls from Γ when every line of Δ is in Γ or already in ls. Lines already present in ls (or derived earlier during the replay) are reused rather than emitted again, so the prepended suffix ls'' is a duplicate-free sublist of ls' disjoint from ls.

Bounded-overhead prefix growth and simulation #

def Cslib.Logic.PL.LineProof.Grows {L : Type u_1} (R : Set (LineRule L)) (Γ : Set L) (ls ls' : List L) (n : ℕ) :

ls' extends the derivation ls by prepending at most n lines.

theorem Cslib.Logic.PL.LineProof.Grows.refl {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ : List L} (h : LineProof R Γ ls₁) :
Grows R Γ ls₁ ls₁ 0

Zero prepended lines.

theorem Cslib.Logic.PL.LineProof.Grows.trans {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ ls₂ ls₃ : List L} {m n : ℕ} (h₁ : Grows R Γ ls₁ ls₂ m) (h₂ : Grows R Γ ls₂ ls₃ n) :
Grows R Γ ls₁ ls₃ (m + n)

Growth composes, adding the line bounds.

theorem Cslib.Logic.PL.LineProof.Grows.lineProof {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ ls₂ : List L} {n : ℕ} (h : Grows R Γ ls₁ ls₂ n) :
LineProof R Γ ls₂

The extended list is a valid derivation.

theorem Cslib.Logic.PL.LineProof.Grows.subset {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ ls₂ : List L} {n : ℕ} (h : Grows R Γ ls₁ ls₂ n) :
ls₁ ⊆ ls₂

Growth preserves all earlier lines.

theorem Cslib.Logic.PL.LineProof.Grows.mono {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ ls₂ : List L} {m n : ℕ} (h : Grows R Γ ls₁ ls₂ m) (hmn : m ≤ n) :
Grows R Γ ls₁ ls₂ n

Growth within m lines is growth within any n ≥ m lines.

theorem Cslib.Logic.PL.LineProof.Grows.length_of_nil {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ : List L} {n : ℕ} (h : Grows R Γ [] ls₁ n) :
ls₁.length ≤ n

Growing the empty derivation by at most n lines yields at most n lines.

theorem Cslib.Logic.PL.LineProof.Grows.of_append {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ : List L} {n : ℕ} {m₁ : List L} (h : LineProof R Γ (m₁ ++ ls₁)) (hlen : m₁.length ≤ n) :
Grows R Γ ls₁ (m₁ ++ ls₁) n

Prepending a list m₁ of at most n lines when m₁ ++ ls₁ is a derivation.

theorem Cslib.Logic.PL.LineProof.Grows.hyp {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ : List L} (h : LineProof R Γ ls₁) {x : L} (hx : x ∈ Γ) :
Grows R Γ ls₁ (x :: ls₁) 1

Adding one hypothesis line.

theorem Cslib.Logic.PL.LineProof.Grows.step {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ : List L} (h : LineProof R Γ ls₁) {r : LineRule L} (hr : r ∈ R) (hp : ∀ p ∈ r.premises, p ∈ ls₁) :
Grows R Γ ls₁ (r.concl :: ls₁) 1

Adding one rule step.

theorem Cslib.Logic.PL.LineProof.Grows.comp {L : Type u_1} {R : Set (LineRule L)} {Γ Δ : Set L} {ls' ls₁ : List L} (hΔ : LineProof R Δ ls') (h : LineProof R Γ ls₁) (hΔΓ : ∀ x ∈ Δ, x ∈ Γ ∨ x ∈ ls₁) :
∃ (ls₂ : List L), Grows R Γ ls₁ ls₂ ls'.length ∧ ∀ x ∈ ls', x ∈ ls₂

Replaying a derivation ls' from Δ onto ls₁ via LineProof.comp grows ls₁ by at most ls'.length lines.

theorem Cslib.Logic.PL.LineProof.Grows.collect {L : Type u_1} {R : Set (LineRule L)} {Γ : Set L} {ls₁ : List L} (h : LineProof R Γ ls₁) {xs : List L} (hxs : ∀ x ∈ xs, x ∈ Γ ∨ x ∈ ls₁) :
∃ (ls₂ : List L), Grows R Γ ls₁ ls₂ xs.length ∧ ∀ x ∈ xs, x ∈ ls₂

Making every element of xs that lies in Γ or ls₁ available on the derivation list costs at most xs.length new lines.

theorem Cslib.Logic.PL.LineProof.Grows.simulate {L₁ : Type u_2} {L₂ : Type u_3} {R₁ : Set (LineRule L₁)} {Γ₁ : Set L₁} {R₂ : Set (LineRule L₂)} {Γ₂ : Set L₂} (tr : L₁ → L₂) (k : ℕ) {ls : List L₁} (h : LineProof R₁ Γ₁ ls) {ls₀ : List L₂} (h₀ : LineProof R₂ Γ₂ ls₀) (hhyp : ∀ {ls' : List L₂}, LineProof R₂ Γ₂ ls' → ∀ x ∈ Γ₁, x ∈ ls → ∃ (ls'' : List L₂), Grows R₂ Γ₂ ls' ls'' k ∧ tr x ∈ ls'') (hstep : ∀ {ls' : List L₂}, LineProof R₂ Γ₂ ls' → ∀ r ∈ R₁, r.concl ∈ ls → (∀ p ∈ r.premises, p ∈ ls ∧ tr p ∈ ls') → ∃ (ls'' : List L₂), Grows R₂ Γ₂ ls' ls'' k ∧ tr r.concl ∈ ls'') :
∃ (ls' : List L₂), Grows R₂ Γ₂ ls₀ ls' (k * ls.length) ∧ ∀ x ∈ ls, tr x ∈ ls'

Stepwise simulation over an existing prefix: if each hypothesis and rule step of ls can extend any target derivation already containing the translated premises by at most k lines to include the translated conclusion, then ls extends ls₀ by at most k * ls.length lines.

theorem Cslib.Logic.PL.LineProof.simulate {L₁ : Type u_2} {L₂ : Type u_3} {R₁ : Set (LineRule L₁)} {Γ₁ : Set L₁} {R₂ : Set (LineRule L₂)} {Γ₂ : Set L₂} (tr : L₁ → L₂) (k : ℕ) {ls : List L₁} (h : LineProof R₁ Γ₁ ls) (hhyp : ∀ x ∈ Γ₁, x ∈ ls → ∃ (m : List L₂), LineProof R₂ Γ₂ m ∧ tr x ∈ m ∧ m.length ≤ k) (hstep : ∀ r ∈ R₁, r.concl ∈ ls → (∀ p ∈ r.premises, p ∈ ls) → ∃ (m : List L₂), LineProof R₂ (Γ₂ ∪ {y : L₂ | y ∈ List.map tr r.premises}) m ∧ tr r.concl ∈ m ∧ m.length ≤ k) :
∃ (ls' : List L₂), LineProof R₂ Γ₂ ls' ∧ (∀ x ∈ ls, tr x ∈ ls') ∧ ls'.length ≤ k * ls.length

Stepwise rule simulation: suppose every hypothesis of Γ₁ appearing in ls has a derivation in (R₂, Γ₂) of at most k lines, and every rule r ∈ R₁ applied in ls derives tr r.concl in (R₂, Γ₂ ∪ {y | y ∈ r.premises.map tr}) in at most k lines. Replaying each step via LineProof.comp translates ls into a derivation ls' in (R₂, Γ₂) containing tr x for every x ∈ ls, with at most k * ls.length lines.