Documentation

CslibFrontier.Logics.Propositional.Frege

Frege proofs #

A Frege system Cook and Reckhow is a line-based propositional proof system given by finitely many sound axiom schemes and inference rules that are implicationally complete: whenever Γ semantically implies φ, there is a proof of φ from Γ. This file fixes the Hilbert-style system with the axiom schemes K, S and double-negation elimination for → and ⊥, the usual introduction and elimination schemes for ∧ and ∨, and modus ponens as the only rule (Cslib.Logic.PL.Frege.IsAxiom). A proof from hypotheses Γ is a list of formulas, each a hypothesis, an axiom instance, or obtained by modus ponens from two earlier lines (Cslib.Logic.PL.Frege.IsProof). Implicational completeness of this system is standard (the schemes form a classical axiomatization of →, ⊥, ∧ and ∨) but not yet formalized (#3069). As in CslibFrontier.Logics.Propositional.Resolution.Proof, proofs are listed from their last line to their first, and the size of a proof is its number of lines.

Formulas are cslib's propositions Cslib.Logic.PL.Proposition over the atoms V, with cslib's ⊥ (the constructor Proposition.falsum) as falsity and cslib's Proposition.neg φ = φ → ⊥ as negation. Their Boolean semantics is Cslib.Logic.PL.Proposition.eval at Bool. No other formula type of the library fits: the CNF and QBF types have no implication, and circuit formulas are indexed by a fixed number of inputs.

The file proves soundness (Cslib.Logic.PL.Frege.IsProof.eval) and the tools used to build proofs with explicit line counts:

Main definitions #

Main results #

References #

@[reducible, inline]
abbrev Cslib.Logic.PL.Frege.Formula (V : Type u_2) :
Type u_2

Formulas: cslib's propositions over the atoms V, with ⊥ (Proposition.falsum) as falsity.

@[reducible, inline]
abbrev Cslib.Logic.PL.Frege.Formula.var {V : Type u_1} (v : V) :

A variable.

@[reducible, inline]
abbrev Cslib.Logic.PL.Frege.Formula.imp {V : Type u_1} (φ ψ : Formula V) :

Implication.

def Cslib.Logic.PL.Frege.Formula.imps {V : Type u_1} (Δ : List (Formula V)) (φ : Formula V) :

a₁ → (a₂ → ⋯ → (aₖ → φ)).

@[simp]
theorem Cslib.Logic.PL.Frege.Formula.imps_nil {V : Type u_1} (φ : Formula V) :
imps [] φ = φ
@[simp]
theorem Cslib.Logic.PL.Frege.Formula.imps_cons {V : Type u_1} (a : Formula V) (Δ : List (Formula V)) (φ : Formula V) :
imps (a :: Δ) φ = a.imp (imps Δ φ)
inductive Cslib.Logic.PL.Frege.IsAxiom {V : Type u_1} :

The axiom schemes: K, S, double-negation elimination, and the schemes for ∧ and ∨.

inductive Cslib.Logic.PL.Frege.IsProof {V : Type u_1} (Γ : List (Formula V)) :
List (Formula V) → Prop

Frege proofs from hypotheses Γ, listed from the last line to the first.

theorem Cslib.Logic.PL.Frege.IsAxiom.eval {V : Type u_1} {φ : Formula V} (h : IsAxiom φ) (σ : V → Bool) :

Every axiom instance is true under every assignment.

The rules of the Frege system as Cslib.Logic.PL.LineRules: axiom instances (with no premises) and modus ponens.

theorem Cslib.Logic.PL.Frege.rules_sound {V : Type u_1} {r : LineRule (Formula V)} (hr : r ∈ rules V) {σ : V → Bool} (hp : ∀ φ ∈ r.premises, Proposition.eval σ φ = true) :

Every Frege rule preserves truth under any assignment.

theorem Cslib.Logic.PL.Frege.isProof_iff_lineProof {V : Type u_1} {Γ L : List (Formula V)} :
IsProof Γ L ↔ LineProof (rules V) {φ : Formula V | φ ∈ Γ} L

Frege proofs as LineProof derivations.

theorem Cslib.Logic.PL.Frege.IsProof.eval {V : Type u_1} {Γ L : List (Formula V)} (h : IsProof Γ L) {σ : V → Bool} (hσ : ∀ γ ∈ Γ, Proposition.eval σ γ = true) (φ : Formula V) :
φ ∈ L → Proposition.eval σ φ = true

Soundness: under an assignment satisfying every hypothesis, every line is true.

@[reducible, inline]
abbrev Cslib.Logic.PL.Frege.Grows {V : Type u_1} (Γ L L' : List (Formula V)) (n : ℕ) :

L' extends the proof L by at most n lines.

theorem Cslib.Logic.PL.Frege.Grows.refl {V : Type u_1} {Γ L : List (Formula V)} (h : IsProof Γ L) :
Grows Γ L L 0

No new lines.

theorem Cslib.Logic.PL.Frege.Grows.proof {V : Type u_1} {Γ L L' : List (Formula V)} {n : ℕ} (h : Grows Γ L L' n) :
IsProof Γ L'

The extended list is a proof.

theorem Cslib.Logic.PL.Frege.grows_ax {V : Type u_1} {Γ L : List (Formula V)} (h : IsProof Γ L) {φ : Formula V} (hφ : IsAxiom φ) :
Grows Γ L (φ :: L) 1

Adding an axiom instance.

theorem Cslib.Logic.PL.Frege.grows_hyp {V : Type u_1} {Γ L : List (Formula V)} (h : IsProof Γ L) {φ : Formula V} (hφ : φ ∈ Γ) :
Grows Γ L (φ :: L) 1

Adding a hypothesis.

theorem Cslib.Logic.PL.Frege.grows_mp {V : Type u_1} {Γ L : List (Formula V)} (h : IsProof Γ L) {φ ψ : Formula V} (h₁ : φ ∈ L) (h₂ : φ.imp ψ ∈ L) :
Grows Γ L (ψ :: L) 1

Adding a modus ponens line.

theorem Cslib.Logic.PL.Frege.IsProof.cut {V : Type u_1} {Γ Δ M L : List (Formula V)} (hM : IsProof (Γ ++ Δ) M) (hL : IsProof Γ L) (hΔ : ∀ δ ∈ Δ, δ ∈ L) :
∃ (M' : List (Formula V)), IsProof Γ (M' ++ L) ∧ M'.length ≤ M.length ∧ ∀ φ ∈ M, φ ∈ M' ++ L

Cut: a proof from Γ ++ Δ replays on top of a proof L from Γ containing every formula of Δ, with at most as many new lines.

theorem Cslib.Logic.PL.Frege.IsProof.mono {V : Type u_1} {Γ Γ' L : List (Formula V)} (h : IsProof Γ L) (hΓ : Γ ⊆ Γ') :
IsProof Γ' L

Proofs are monotone in the hypotheses.

def Cslib.Logic.PL.Frege.DerivableInSize {V : Type u_1} (Γ : List (Formula V)) (φ : Formula V) (n : ℕ) :

φ is derivable from Γ in at most n lines.

theorem Cslib.Logic.PL.Frege.IsProof.append {V : Type u_1} {Γ L M : List (Formula V)} (hL : IsProof Γ L) (hM : IsProof Γ M) :
IsProof Γ (M ++ L)

Two proofs from the same hypotheses can be stacked.

theorem Cslib.Logic.PL.Frege.DerivableInSize.mono {V : Type u_1} {Γ : List (Formula V)} {n m : ℕ} {φ : Formula V} (h : DerivableInSize Γ φ n) (hnm : n ≤ m) :

Derivability in n lines implies derivability in m ≥ n lines.

theorem Cslib.Logic.PL.Frege.DerivableInSize.ax {V : Type u_1} {Γ : List (Formula V)} {φ : Formula V} (h : IsAxiom φ) :

An axiom instance in one line.

theorem Cslib.Logic.PL.Frege.DerivableInSize.hyp {V : Type u_1} {Γ : List (Formula V)} {φ : Formula V} (h : φ ∈ Γ) :

A hypothesis in one line.

theorem Cslib.Logic.PL.Frege.DerivableInSize.mp {V : Type u_1} {Γ : List (Formula V)} {m n : ℕ} {φ ψ : Formula V} (h₁ : DerivableInSize Γ (φ.imp ψ) m) (h₂ : DerivableInSize Γ φ n) :
DerivableInSize Γ ψ (m + n + 1)

Modus ponens, stacking the two derivations.

theorem Cslib.Logic.PL.Frege.DerivableInSize.id {V : Type u_1} {Γ : List (Formula V)} (φ : Formula V) :
DerivableInSize Γ (φ.imp φ) 5

φ → φ in five lines.

theorem Cslib.Logic.PL.Frege.DerivableInSize.lift {V : Type u_1} {Γ : List (Formula V)} {n : ℕ} {φ : Formula V} (a : Formula V) (h : DerivableInSize Γ φ n) :
DerivableInSize Γ (a.imp φ) (n + 2)

Weakening under an antecedent a.

theorem Cslib.Logic.PL.Frege.DerivableInSize.trans {V : Type u_1} {Γ : List (Formula V)} {m n : ℕ} {P Q R : Formula V} (h₁ : DerivableInSize Γ (P.imp Q) m) (h₂ : DerivableInSize Γ (Q.imp R) n) :
DerivableInSize Γ (P.imp R) (m + n + 5)

Hypothetical syllogism.

theorem Cslib.Logic.PL.Frege.DerivableInSize.imp_imps_self {V : Type u_1} {Γ : List (Formula V)} (a : Formula V) (Δ : List (Formula V)) :
DerivableInSize Γ (a.imp (Formula.imps Δ a)) (5 + 6 * Δ.length)

a → (b₁ → ⋯ → bₖ → a).

theorem Cslib.Logic.PL.Frege.DerivableInSize.imps_mem {V : Type u_1} {Γ : List (Formula V)} {a : Formula V} {Δ : List (Formula V)} (h : a ∈ Δ) :

b₁ → ⋯ → bₖ → a for a among the bᵢ.

theorem Cslib.Logic.PL.Frege.DerivableInSize.imps_dist {V : Type u_1} {Γ : List (Formula V)} (Δ : List (Formula V)) (φ ψ : Formula V) :
DerivableInSize Γ ((Formula.imps Δ (φ.imp ψ)).imp ((Formula.imps Δ φ).imp (Formula.imps Δ ψ))) (5 + 10 * Δ.length)

Distribution of b₁ → ⋯ → bₖ → over implication.

theorem Cslib.Logic.PL.Frege.Grows.of_derivableInSize {V : Type u_1} {Γ L : List (Formula V)} (hL : IsProof Γ L) {n : ℕ} {φ : Formula V} (h : DerivableInSize Γ φ n) :
∃ (L' : List (Formula V)), Grows Γ L L' n ∧ φ ∈ L'

Appending a derivation from the same hypotheses.

theorem Cslib.Logic.PL.Frege.Grows.imps_of_mem {V : Type u_1} {Γ L : List (Formula V)} (hL : IsProof Γ L) {φ : Formula V} (hφ : φ ∈ L) (Δ : List (Formula V)) :
∃ (L' : List (Formula V)), Grows Γ L L' (2 * Δ.length) ∧ Formula.imps Δ φ ∈ L'

Weakening an available line under the antecedents Δ, two lines per antecedent.

theorem Cslib.Logic.PL.Frege.IsProof.deduction {V : Type u_1} {Γ Δ M : List (Formula V)} (hM : IsProof (Γ ++ Δ) M) {L : List (Formula V)} (hL : IsProof Γ L) :
∃ (L' : List (Formula V)), Grows Γ L L' (10 * (Δ.length + 1) * M.length) ∧ ∀ φ ∈ M, Formula.imps Δ φ ∈ L'

Deduction theorem with linear overhead: a proof from Γ ++ Δ becomes a proof from Γ of Δ ⇒ φ for each of its lines φ, with at most 10 (|Δ| + 1) lines per original line.

theorem Cslib.Logic.PL.Frege.Grows.imps_elim {V : Type u_1} {Γ L : List (Formula V)} (hL : IsProof Γ L) {Δ : List (Formula V)} {φ : Formula V} (h : Formula.imps Δ φ ∈ L) (hΔ : ∀ δ ∈ Δ, δ ∈ L) :
∃ (L' : List (Formula V)), Grows Γ L L' Δ.length ∧ φ ∈ L'

Detaching the antecedents Δ of an available line Δ ⇒ φ, one line per antecedent, when every antecedent is available.

theorem Cslib.Logic.PL.Frege.Grows.collect {V : Type u_1} {Γ L : List (Formula V)} (hL : IsProof Γ L) {Δ : List (Formula V)} (hΔ : ∀ δ ∈ Δ, δ ∈ Γ ∨ δ ∈ L) :
∃ (L' : List (Formula V)), Grows Γ L L' Δ.length ∧ ∀ δ ∈ Δ, δ ∈ L'

Adding hypotheses: every formula of Δ that is a hypothesis or already available becomes available, one line per formula.