Beth.Completeness


namespace Beth

namespace Completeness


open Syntax (Ctxt Pf Tm)


structure World where
  carrier : Ctxt
  consistent : ¬ Pf carrier Tm.ff


instance : Preorder World where
  le Γ Δ := Γ.carrierΔ.carrier
  le_refl _ := le_rfl
  le_trans _ _ _ := le_trans


def context_sieve (Γ : World) (L : List Tm) : Sieve Γ where
  carrier := { Δ : World | (Γ.carrierΔ.carrier) ∧ (∃ AL, Pf Δ.carrier A) }
  bounded := by
Γ : World
L : List Tm
∀ {q : World}, q {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}Γ q
intro Δ
Γ : World
L : List Tm
Δ : World
: Δ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
Γ Δ
exact .1 upward_closed := by
Γ : World
L : List Tm
∀ {q r : World}, r {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}r qq {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
intro Δ Θ
Γ : World
L : List Tm
Δ : World
Θ : World
Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}Θ ΔΔ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
Γ : World
L : List Tm
Δ : World
Θ : World
: Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
Θ ΔΔ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
hle
Γ : World
L : List Tm
Δ : World
Θ : World
: Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
hle : Θ Δ
Δ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
constructor
left
Γ : World
L : List Tm
Δ : World
Θ : World
: Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
hle : Θ Δ
Γ.carrier Δ.carrier
right
Γ : World
L : List Tm
Δ : World
Θ : World
: Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
hle : Θ Δ
AL, Pf Δ.carrier A
·
left
Γ : World
L : List Tm
Δ : World
Θ : World
: Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
hle : Θ Δ
Γ.carrier Δ.carrier
exact List.IsSuffix.trans .1 hle ·
right
Γ : World
L : List Tm
Δ : World
Θ : World
: Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
hle : Θ Δ
AL, Pf Δ.carrier A
rcases .2 withA, hA, hPf
right
Γ : World
L : List Tm
Δ : World
Θ : World
: Θ {Δ | Γ.carrier Δ.carrier AL, Pf Δ.carrier A}
hle : Θ Δ
A : Tm
hA : A L
hPf : Pf Θ.carrier A
AL, Pf Δ.carrier A
exact A, hA, Pf.wk hle hPf


def mk_disjunction : CtxtTm
  | [] => Tm.ff
  | t :: ts => Tm.or t (mk_disjunction ts)


theorem disjunction_intro {t : Tm} {Γ Δ : Ctxt}
    (t_in : tΔ) (pf : Pf Γ t) : Pf Γ (mk_disjunction Δ) := by
t : Tm
Γ : Ctxt
Δ : Ctxt
t_in : t Δ
pf : Pf Γ t
Pf Γ (mk_disjunction Δ)
induction Δ with | nil =>
nil
t : Tm
Γ : Ctxt
pf : Pf Γ t
t_in : t []
cases t_in | cons a Δ ih =>
cons
t : Tm
Γ : Ctxt
pf : Pf Γ t
a : Tm
Δ : List Tm
ih : t ΔPf Γ (mk_disjunction Δ)
t_in : t a :: Δ
Pf Γ (mk_disjunction (a :: Δ))
simp at t_in
cons
t : Tm
Γ : Ctxt
pf : Pf Γ t
a : Tm
Δ : List Tm
ih : t ΔPf Γ (mk_disjunction Δ)
t_in : t = a t Δ
Pf Γ (mk_disjunction (a :: Δ))
rcases t_in with rfl | ht
cons.inl
t : Tm
Γ : Ctxt
pf : Pf Γ t
Δ : List Tm
ih : t ΔPf Γ (mk_disjunction Δ)
Pf Γ (mk_disjunction (t :: Δ))
cons.inr
t : Tm
Γ : Ctxt
pf : Pf Γ t
a : Tm
Δ : List Tm
ih : t ΔPf Γ (mk_disjunction Δ)
ht : t Δ
Pf Γ (mk_disjunction (a :: Δ))
·
cons.inl
t : Tm
Γ : Ctxt
pf : Pf Γ t
Δ : List Tm
ih : t ΔPf Γ (mk_disjunction Δ)
Pf Γ (mk_disjunction (t :: Δ))
exact Pf.or_I₁ pf ·
cons.inr
t : Tm
Γ : Ctxt
pf : Pf Γ t
a : Tm
Δ : List Tm
ih : t ΔPf Γ (mk_disjunction Δ)
ht : t Δ
Pf Γ (mk_disjunction (a :: Δ))
simpa [mk_disjunction] using Pf.or_I₂ (ih ht)


theorem disjunction_elim {p : Tm} {Γ : Ctxt} (Δ : Ctxt) :
    (∀ {t : Tm}, tΔPf (t :: Γ) p) →
    Pf Γ (mk_disjunction Δ) → Pf Γ p := by
p : Tm
Γ : Ctxt
Δ : Ctxt
(∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
intro htcase
p : Tm
Γ : Ctxt
Δ : Ctxt
htcase : ∀ {t : Tm}, t ΔPf (t :: Γ) p
: Pf Γ (mk_disjunction Δ)
Pf Γ p
induction Δ generalizing Γ with | nil =>
nil
p : Tm
Γ : Ctxt
htcase : ∀ {t : Tm}, t []Pf (t :: Γ) p
: Pf Γ (mk_disjunction [])
Pf Γ p
simp [mk_disjunction] at
nil
p : Tm
Γ : Ctxt
htcase : ∀ {t : Tm}, t []Pf (t :: Γ) p
: Pf Γ Tm.ff
Pf Γ p
exact Pf.ff_E | cons a Δ ih =>
cons
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (mk_disjunction (a :: Δ))
Pf Γ p
simp [mk_disjunction] at
cons
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
Pf Γ p
apply Pf.or_E
cons.a
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
Pf (a :: Γ) p
cons.a
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
Pf (mk_disjunction Δ :: Γ) p
·
cons.a
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
Pf (a :: Γ) p
exact htcase (by
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
a a :: Δ
simp) ·
cons.a
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
Pf (mk_disjunction Δ :: Γ) p
have htail : ∀ {t : Tm}, tΔPf (t :: mk_disjunction Δ :: Γ) p := by
p : Tm
Γ : Ctxt
Δ : Ctxt
(∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
intro t ht
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Pf (t :: mk_disjunction Δ :: Γ) p
apply Syntax.Pf.monotone_mem (Γ := t :: Γ) (Δ := t :: mk_disjunction Δ :: Γ) (P := p)
hmem
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Qt :: Γ, Q t :: mk_disjunction Δ :: Γ
a
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Pf (t :: Γ) p
·
hmem
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Qt :: Γ, Q t :: mk_disjunction Δ :: Γ
intro Q hQ
hmem
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Q : Tm
hQ : Q t :: Γ
Q t :: mk_disjunction Δ :: Γ
have : Q = tQΓ := by
p : Tm
Γ : Ctxt
Δ : Ctxt
(∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
simpa using hQ rcases this with rfl | hmem
hmem.inl
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
Q : Tm
ht : Q Δ
hQ : Q Q :: Γ
Q Q :: mk_disjunction Δ :: Γ
hmem.inr
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Q : Tm
hQ : Q t :: Γ
hmem : Q Γ
Q t :: mk_disjunction Δ :: Γ
·
hmem.inl
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
Q : Tm
ht : Q Δ
hQ : Q Q :: Γ
Q Q :: mk_disjunction Δ :: Γ
simp ·
hmem.inr
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Q : Tm
hQ : Q t :: Γ
hmem : Q Γ
Q t :: mk_disjunction Δ :: Γ
simp [hmem] ·
a
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
Pf (t :: Γ) p
exact htcase (by
p : Tm
a : Tm
Δ : List Tm
ih : ∀ {Γ : Ctxt}, (∀ {t : Tm}, t ΔPf (t :: Γ) p) → Pf Γ (mk_disjunction Δ) → Pf Γ p
Γ : Ctxt
htcase : ∀ {t : Tm}, t a :: ΔPf (t :: Γ) p
: Pf Γ (a.or (mk_disjunction Δ))
t : Tm
ht : t Δ
t a :: Δ
simpa using Or.inr ht) exact ih htail Pf.assume


theorem disjunction_two {Γ : Ctxt} {φ ψ : Tm} :
    Pf Γ (Tm.or φ ψ) → Pf Γ (mk_disjunction [φ, ψ]) := by
Γ : Ctxt
φ : Tm
ψ : Tm
Pf Γ (φ.or ψ) → Pf Γ (mk_disjunction [φ, ψ])
intro h
Γ : Ctxt
φ : Tm
ψ : Tm
h : Pf Γ (φ.or ψ)
Pf Γ (mk_disjunction [φ, ψ])
simp [mk_disjunction]
Γ : Ctxt
φ : Tm
ψ : Tm
h : Pf Γ (φ.or ψ)
Pf Γ (φ.or (ψ.or Tm.ff))
apply Pf.or_E h
a
Γ : Ctxt
φ : Tm
ψ : Tm
h : Pf Γ (φ.or ψ)
Pf (φ :: Γ) (φ.or (ψ.or Tm.ff))
a
Γ : Ctxt
φ : Tm
ψ : Tm
h : Pf Γ (φ.or ψ)
Pf (ψ :: Γ) (φ.or (ψ.or Tm.ff))
·
a
Γ : Ctxt
φ : Tm
ψ : Tm
h : Pf Γ (φ.or ψ)
Pf (φ :: Γ) (φ.or (ψ.or Tm.ff))
exact Pf.or_I₁ Pf.assume ·
a
Γ : Ctxt
φ : Tm
ψ : Tm
h : Pf Γ (φ.or ψ)
Pf (ψ :: Γ) (φ.or (ψ.or Tm.ff))
exact Pf.or_I₂ (Pf.or_I₁ Pf.assume)


inductive ContextCovers : (Γ : World) → Sieve ΓProp where
  | basic (Γ : World) (L : List Tm) {S : Sieve Γ} :
      Pf Γ.carrier (mk_disjunction L) →
      (context_sieve Γ L).carrierS.carrierContextCovers Γ S
  | maximal (Γ : World) :
      ContextCovers Γ (maximal_sieve Γ)
  | trans (Γ : World) (U V : Sieve Γ) :
      ContextCovers Γ U →
      (∀ q : U.carrier, ContextCovers (q : World) (pullback (U.bounded q.property) V)) →
      ContextCovers Γ V


theorem ContextCovers.stable {Γ Δ : World} {U : Sieve Γ} (h : ΓΔ) :
    ContextCovers Γ UContextCovers Δ (pullback h U) := by
Γ : World
Δ : World
U : Sieve Γ
h : Γ Δ
ContextCovers Γ UContextCovers Δ (pullback h U)
intro hU
Γ : World
Δ : World
U : Sieve Γ
h : Γ Δ
hU : ContextCovers Γ U
ContextCovers Δ (pullback h U)
induction hU with | basic Γ L hpf hsub =>
basic
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
ContextCovers Δ (pullback h S✝)
apply ContextCovers.basic Δ L
basic.a
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
basic.a
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
·
basic.a
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
exact Pf.wk h hpf ·
basic.a
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
intro Θ
basic.a
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Θ (pullback h S✝).carrier
constructor
basic.a.left
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Θ S✝.carrier
basic.a.right
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Δ Θ
·
basic.a.left
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Θ S✝.carrier
apply hsub
basic.a.left.a
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Θ (context_sieve Γ L).carrier
constructor
basic.a.left.a.left
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Γ.carrier Θ.carrier
basic.a.left.a.right
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
AL, Pf Θ.carrier A
·
basic.a.left.a.left
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Γ.carrier Θ.carrier
exact List.IsSuffix.trans h .1 ·
basic.a.left.a.right
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
AL, Pf Θ.carrier A
exact .2 ·
basic.a.right
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
L : List Tm
S✝ : Sieve Γ
hsub : (context_sieve Γ L).carrier S✝.carrier
h : Γ Δ
Θ : World
: Θ (context_sieve Δ L).carrier
Δ Θ
exact .1 | maximal Γ =>
maximal
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
have hEq : pullback h (maximal_sieve Γ) = maximal_sieve Δ := by
Γ : World
Δ : World
U : Sieve Γ
h : Γ Δ
ContextCovers Γ UContextCovers Δ (pullback h U)
apply Sieve.ext
h
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
funext Θ
h.h
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
apply propext
h.h.a
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
constructor
h.h.a.mp
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
(pullback h (maximal_sieve Γ)).carrier Θ → (maximal_sieve Δ).carrier Θ
h.h.a.mpr
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
(maximal_sieve Δ).carrier Θ → (pullback h (maximal_sieve Γ)).carrier Θ
·
h.h.a.mp
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
(pullback h (maximal_sieve Γ)).carrier Θ → (maximal_sieve Δ).carrier Θ
intro
h.h.a.mp
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
: (pullback h (maximal_sieve Γ)).carrier Θ
exact .2 ·
h.h.a.mpr
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
(maximal_sieve Δ).carrier Θ → (pullback h (maximal_sieve Γ)).carrier Θ
intro
h.h.a.mpr
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
: (maximal_sieve Δ).carrier Θ
constructor
h.h.a.mpr.left
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
: (maximal_sieve Δ).carrier Θ
h.h.a.mpr.right
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
: (maximal_sieve Δ).carrier Θ
Δ Θ
·
h.h.a.mpr.left
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
: (maximal_sieve Δ).carrier Θ
exact List.IsSuffix.trans h ·
h.h.a.mpr.right
Γ✝ : World
Δ : World
U : Sieve Γ
Γ : World
h : Γ Δ
Θ : World
: (maximal_sieve Δ).carrier Θ
Δ Θ
exact simpa [hEq] using ContextCovers.maximal Δ | trans Γ U V hU hV ihU ihV =>
trans
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
ContextCovers Δ (pullback h V)
apply ContextCovers.trans Δ (pullback h U)
trans.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
ContextCovers Δ (pullback h U)
trans.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
∀ (q : ↑(pullback h U).carrier), ContextCovers (↑q) (pullback ⋯ (pullback h V))
·
trans.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
ContextCovers Δ (pullback h U)
exact ihU h ·
trans.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
∀ (q : ↑(pullback h U).carrier), ContextCovers (↑q) (pullback ⋯ (pullback h V))
intro q
trans.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
ContextCovers (↑q) (pullback ⋯ (pullback h V))
have hq : (q : World) ∈ U.carrier := q.property.1
trans.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
ContextCovers (↑q) (pullback ⋯ (pullback h V))
have q_le : Δq := q.property.2
trans.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
ContextCovers (↑q) (pullback ⋯ (pullback h V))
have hEq : pullback ((pullback h U).bounded q.property) (pullback h V) = pullback (U.bounded hq) V := by
Γ : World
Δ : World
U : Sieve Γ
h : Γ Δ
ContextCovers Γ UContextCovers Δ (pullback h U)
apply Sieve.ext
h
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
(pullback ⋯ (pullback h V)).carrier = (pullbackV).carrier
funext r
h.h
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
(pullback ⋯ (pullback h V)).carrier r = (pullbackV).carrier r
apply propext
h.h.a
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
(pullback ⋯ (pullback h V)).carrier r (pullbackV).carrier r
constructor
h.h.a.mp
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
(pullback ⋯ (pullback h V)).carrier r → (pullbackV).carrier r
h.h.a.mpr
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
(pullbackV).carrier r → (pullback ⋯ (pullback h V)).carrier r
·
h.h.a.mp
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
(pullback ⋯ (pullback h V)).carrier r → (pullbackV).carrier r
intro hr
h.h.a.mp
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : (pullback ⋯ (pullback h V)).carrier r
(pullbackV).carrier r
exact hr.1.1, hr.2 ·
h.h.a.mpr
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
(pullbackV).carrier r → (pullback ⋯ (pullback h V)).carrier r
intro hr
h.h.a.mpr
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : (pullbackV).carrier r
(pullback ⋯ (pullback h V)).carrier r
simp [pullback] at hr
h.h.a.mpr
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : {r | r V.carrier q r} r
(pullback ⋯ (pullback h V)).carrier r
constructor
h.h.a.mpr.left
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : {r | r V.carrier q r} r
r (pullback h V).carrier
h.h.a.mpr.right
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : {r | r V.carrier q r} r
q r
·
h.h.a.mpr.left
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : {r | r V.carrier q r} r
r (pullback h V).carrier
simp [pullback]
h.h.a.mpr.left
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : {r | r V.carrier q r} r
r V.carrier Δ r
exact hr.1, List.IsSuffix.trans q_le hr.2 ·
h.h.a.mpr.right
Γ✝ : World
Δ : World
U✝ : Sieve Γ
Γ : World
U : Sieve Γ
V : Sieve Γ
hU : ContextCovers Γ U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
ihU : ∀ (h : Γ Δ), ContextCovers Δ (pullback h U)
ihV : ∀ (q : ↑U.carrier) (h : ↑q Δ), ContextCovers Δ (pullback h (pullbackV))
h : Γ Δ
q : ↑(pullback h U).carrier
hq : q U.carrier
q_le : Δ q
r : World
hr : {r | r V.carrier q r} r
q r
exact hr.2 simpa [hEq] using hV (q : World), hq


def contextCoverage : Coverage World where
  covers := ContextCovers
  maximal := ContextCovers.maximal
  transitive := by
∀ (p : World) (U V : Sieve p), ContextCovers p U → (∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)) → ContextCovers p V
intro p U
p : World
U : Sieve p
∀ (V : Sieve p), ContextCovers p U → (∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)) → ContextCovers p V
V
p : World
U : Sieve p
V : Sieve p
ContextCovers p U → (∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)) → ContextCovers p V
hU
p : World
U : Sieve p
V : Sieve p
hU : ContextCovers p U
(∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)) → ContextCovers p V
hV
p : World
U : Sieve p
V : Sieve p
hU : ContextCovers p U
hV : ∀ (q : ↑U.carrier), ContextCovers (↑q) (pullbackV)
exact ContextCovers.trans p U V hU hV stability := by
∀ {p q : World} {U : Sieve p}, ContextCovers p U → ∀ (p_le_q : p q), ContextCovers q (pullback p_le_q U)
intro p q
p : World
q : World
∀ {U : Sieve p}, ContextCovers p U → ∀ (p_le_q : p q), ContextCovers q (pullback p_le_q U)
U
p : World
q : World
U : Sieve p
ContextCovers p U → ∀ (p_le_q : p q), ContextCovers q (pullback p_le_q U)
hU
p : World
q : World
U : Sieve p
hU : ContextCovers p U
∀ (p_le_q : p q), ContextCovers q (pullback p_le_q U)
hpq
p : World
q : World
U : Sieve p
hU : ContextCovers p U
hpq : p q
ContextCovers q (pullback hpq U)
exact ContextCovers.stable hpq hU


theorem pf_sheaf {Γ : World} {S : Sieve Γ} {r : Tm} :
    ContextCovers Γ S →
    (∀ ΔS.carrier, Pf Δ.carrier r) →
    Pf Γ.carrier r := by
Γ : World
S : Sieve Γ
r : Tm
ContextCovers Γ S → (∀ ΔS.carrier, Pf Δ.carrier r) → Pf Γ.carrier r
intro hCov hS
Γ : World
S : Sieve Γ
r : Tm
hCov : ContextCovers Γ S
hS : ΔS.carrier, Pf Δ.carrier r
Pf Γ.carrier r
induction hCov
basic
Γ : World
S : Sieve Γ
r : Tm
Γ✝ : World
L✝ : List Tm
S✝ : Sieve Γ✝
a✝¹ : Pf Γ✝.carrier (mk_disjunction L✝)
a✝ : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
Pf Γ✝.carrier r
maximal
Γ : World
S : Sieve Γ
r : Tm
Γ✝ : World
hS : Δ ∈ (maximal_sieve Γ✝).carrier, Pf Δ.carrier r
Pf Γ✝.carrier r
trans
Γ : World
S : Sieve Γ
r : Tm
Γ✝ : World
U✝ : Sieve Γ✝
V✝ : Sieve Γ✝
a✝¹ : ContextCovers Γ✝ U✝
a✝ : ∀ (q : ↑U✝.carrier), ContextCovers (↑q) (pullbackV✝)
a_ih✝¹ : (∀ ΔU✝.carrier, Pf Δ.carrier r) → Pf Γ✝.carrier r
a_ih✝ : ∀ (q : ↑U✝.carrier), (∀ Δ ∈ (pullbackV✝).carrier, Pf Δ.carrier r) → Pf (↑q).carrier r
hS : ΔV✝.carrier, Pf Δ.carrier r
Pf Γ✝.carrier r
case basic Γ0 L S0 hPf hSub =>
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
Pf Γ✝.carrier r
refine disjunction_elim (Γ := Γ0.carrier) L ?_ hPf
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
∀ {t : Tm}, t LPf (t :: Γ0.carrier) r
intro t ht
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
Pf (t :: Γ0.carrier) r
by_cases hff : Pf (t :: Γ0.carrier) Tm.ff
pos
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : Pf (t :: Γ0.carrier) Tm.ff
Pf (t :: Γ0.carrier) r
neg
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : ¬Pf (t :: Γ0.carrier) Tm.ff
Pf (t :: Γ0.carrier) r
·
pos
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : Pf (t :: Γ0.carrier) Tm.ff
Pf (t :: Γ0.carrier) r
exact Pf.ff_E hff ·
neg
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : ¬Pf (t :: Γ0.carrier) Tm.ff
Pf (t :: Γ0.carrier) r
let Δ : World := t :: Γ0.carrier, hff
neg
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : ¬Pf (t :: Γ0.carrier) Tm.ff
Δ : World := { carrier := t :: Γ0.carrier, consistent := hff }
Pf (t :: Γ0.carrier) r
have hin : Δ ∈ (context_sieve Γ0 L).carrier := by
Γ : World
S : Sieve Γ
r : Tm
ContextCovers Γ S → (∀ ΔS.carrier, Pf Δ.carrier r) → Pf Γ.carrier r
constructor
left
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : ¬Pf (t :: Γ0.carrier) Tm.ff
Δ : World := { carrier := t :: Γ0.carrier, consistent := hff }
Γ0.carrier Δ.carrier
right
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : ¬Pf (t :: Γ0.carrier) Tm.ff
Δ : World := { carrier := t :: Γ0.carrier, consistent := hff }
AL, Pf Δ.carrier A
·
left
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : ¬Pf (t :: Γ0.carrier) Tm.ff
Δ : World := { carrier := t :: Γ0.carrier, consistent := hff }
Γ0.carrier Δ.carrier
exact List.suffix_cons t Γ0.carrier ·
right
Γ : World
S : Sieve Γ
r : Tm
Γ0 : World
L : List Tm
S0 : Sieve Γ✝
hPf : Pf Γ✝.carrier (mk_disjunction L✝)
hSub : (context_sieve Γ✝ L✝).carrier S✝.carrier
hS : ΔS✝.carrier, Pf Δ.carrier r
t : Tm
ht : t L
hff : ¬Pf (t :: Γ0.carrier) Tm.ff
Δ : World := { carrier := t :: Γ0.carrier, consistent := hff }
AL, Pf Δ.carrier A
exact t, ht, Pf.assume exact hS Δ (hSub hin) case maximal Γ =>
Γ✝ : World
S : Sieve Γ
r : Tm
Γ : World
hS : Δ ∈ (maximal_sieve Γ✝).carrier, Pf Δ.carrier r
Pf Γ✝.carrier r
exact hS Γ (show ΓΓ from le_rfl) case trans Γ U V hU hV ihU ihV =>
Γ✝ : World
S : Sieve Γ
r : Tm
Γ : World
U : Sieve Γ✝
V : Sieve Γ✝
hU : ContextCovers Γ✝ U✝
hV : ∀ (q : ↑U✝.carrier), ContextCovers (↑q) (pullbackV✝)
ihU : (∀ ΔU✝.carrier, Pf Δ.carrier r) → Pf Γ✝.carrier r
ihV : ∀ (q : ↑U✝.carrier), (∀ Δ ∈ (pullbackV✝).carrier, Pf Δ.carrier r) → Pf (↑q).carrier r
hS : ΔV✝.carrier, Pf Δ.carrier r
Pf Γ✝.carrier r
apply ihU
Γ✝ : World
S : Sieve Γ
r : Tm
Γ : World
U : Sieve Γ✝
V : Sieve Γ✝
hU : ContextCovers Γ✝ U✝
hV : ∀ (q : ↑U✝.carrier), ContextCovers (↑q) (pullbackV✝)
ihU : (∀ ΔU✝.carrier, Pf Δ.carrier r) → Pf Γ✝.carrier r
ihV : ∀ (q : ↑U✝.carrier), (∀ Δ ∈ (pullbackV✝).carrier, Pf Δ.carrier r) → Pf (↑q).carrier r
hS : ΔV✝.carrier, Pf Δ.carrier r
ΔU.carrier, Pf Δ.carrier r
intro Δ
Γ✝ : World
S : Sieve Γ
r : Tm
Γ : World
U : Sieve Γ✝
V : Sieve Γ✝
hU : ContextCovers Γ✝ U✝
hV : ∀ (q : ↑U✝.carrier), ContextCovers (↑q) (pullbackV✝)
ihU : (∀ ΔU✝.carrier, Pf Δ.carrier r) → Pf Γ✝.carrier r
ihV : ∀ (q : ↑U✝.carrier), (∀ Δ ∈ (pullbackV✝).carrier, Pf Δ.carrier r) → Pf (↑q).carrier r
hS : ΔV✝.carrier, Pf Δ.carrier r
Δ : World
: Δ U.carrier
Pf Δ.carrier r
exact ihV Δ, (fun Θ => hS Θ .1)


instance : BethFrame World where
  coverage := contextCoverage
  val w i := Pf w.carrier (Tm.var i)
  le_val hle hPf := Pf.wk hle hPf
  sheaf_condition := by
∀ {i : } {w : World} {S : Sieve w}, covers w S → (∀ qS, Pf q.carrier (Tm.var i)) → Pf w.carrier (Tm.var i)
intro i w
i :
w : World
∀ {S : Sieve w}, covers w S → (∀ qS, Pf q.carrier (Tm.var i)) → Pf w.carrier (Tm.var i)
S
i :
w : World
S : Sieve w
covers w S → (∀ qS, Pf q.carrier (Tm.var i)) → Pf w.carrier (Tm.var i)
S_cov
i :
w : World
S : Sieve w
S_cov : covers w S
(∀ qS, Pf q.carrier (Tm.var i)) → Pf w.carrier (Tm.var i)
var_on_S
i :
w : World
S : Sieve w
S_cov : covers w S
var_on_S : qS, Pf q.carrier (Tm.var i)
Pf w.carrier (Tm.var i)
exact pf_sheaf S_cov var_on_S nonempty_covers := by
∀ {w : World} {S : Sieve w}, covers w SNonemptyS.carrier
intro w S
w : World
S : Sieve w
covers w SNonemptyS.carrier
hS
w : World
S : Sieve w
hS : covers w S
NonemptyS.carrier
change ContextCovers w S at hS
w : World
S : Sieve w
hS : ContextCovers w S
NonemptyS.carrier
by_contra hne
w : World
S : Sieve w
hS : ContextCovers w S
hne : ¬NonemptyS.carrier
False
apply w.consistent
w : World
S : Sieve w
hS : ContextCovers w S
hne : ¬NonemptyS.carrier
apply pf_sheaf hS
w : World
S : Sieve w
hS : ContextCovers w S
hne : ¬NonemptyS.carrier
ΔS.carrier, Pf Δ.carrier Tm.ff
intro Δ
w : World
S : Sieve w
hS : ContextCovers w S
hne : ¬NonemptyS.carrier
Δ : World
: Δ S.carrier
exact False.elim (hne Δ, )



theorem truth_lemma (w : World) : ∀ φ : Tm, at_world w φPf w.carrier φ
  | Tm.var i =>
w : World
i :
by
w : World
i :
rfl | Tm.and φ ψ =>
w : World
φ : Tm
ψ : Tm
at_world w (φ.and ψ) Pf w.carrier (φ.and ψ)
by
w : World
φ : Tm
ψ : Tm
at_world w (φ.and ψ) Pf w.carrier (φ.and ψ)
constructor
mp
w : World
φ : Tm
ψ : Tm
at_world w (φ.and ψ) → Pf w.carrier (φ.and ψ)
mpr
w : World
φ : Tm
ψ : Tm
Pf w.carrier (φ.and ψ) → at_world w (φ.and ψ)
·
mp
w : World
φ : Tm
ψ : Tm
at_world w (φ.and ψ) → Pf w.carrier (φ.and ψ)
intro h
mp
w : World
φ : Tm
ψ : Tm
h : at_world w (φ.and ψ)
Pf w.carrier (φ.and ψ)
exact Pf.and_I ((truth_lemma w φ).1 h.1) ((truth_lemma w ψ).1 h.2) ·
mpr
w : World
φ : Tm
ψ : Tm
Pf w.carrier (φ.and ψ) → at_world w (φ.and ψ)
intro h
mpr
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.and ψ)
at_world w (φ.and ψ)
constructor
mpr.left
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.and ψ)
at_world w φ
mpr.right
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.and ψ)
at_world w ψ
·
mpr.left
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.and ψ)
at_world w φ
rw [truth_lemma w φ]
mpr.left
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.and ψ)
Pf w.carrier φ
exact Pf.and_E₁ h ·
mpr.right
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.and ψ)
at_world w ψ
rw [truth_lemma w ψ]
mpr.right
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.and ψ)
Pf w.carrier ψ
exact Pf.and_E₂ h | Tm.or φ ψ =>
w : World
φ : Tm
ψ : Tm
at_world w (φ.or ψ) Pf w.carrier (φ.or ψ)
by
w : World
φ : Tm
ψ : Tm
at_world w (φ.or ψ) Pf w.carrier (φ.or ψ)
constructor
mp
w : World
φ : Tm
ψ : Tm
at_world w (φ.or ψ) → Pf w.carrier (φ.or ψ)
mpr
w : World
φ : Tm
ψ : Tm
Pf w.carrier (φ.or ψ) → at_world w (φ.or ψ)
·
mp
w : World
φ : Tm
ψ : Tm
at_world w (φ.or ψ) → Pf w.carrier (φ.or ψ)
intro h
mp
w : World
φ : Tm
ψ : Tm
h : at_world w (φ.or ψ)
Pf w.carrier (φ.or ψ)
rcases h withS, hS, hLocal
mp
w : World
φ : Tm
ψ : Tm
S : Sieve w
hS : covers w S
hLocal : w'S, at_world w' φ at_world w' ψ
Pf w.carrier (φ.or ψ)
change ContextCovers w S at hS
mp
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Pf w.carrier (φ.or ψ)
apply pf_sheaf hS
mp
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
ΔS.carrier, Pf Δ.carrier (φ.or ψ)
intro Δ
mp
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
Pf Δ.carrier (φ.or ψ)
rcases hLocal Δ with |
mp.inl
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ φ
Pf Δ.carrier (φ.or ψ)
mp.inr
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ ψ
Pf Δ.carrier (φ.or ψ)
·
mp.inl
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ φ
Pf Δ.carrier (φ.or ψ)
apply Pf.or_I₁
mp.inl.a
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ φ
Pf Δ.carrier φ
rw [<- truth_lemma Δ φ]
mp.inl.a
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ φ
at_world Δ φ
exact ·
mp.inr
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ ψ
Pf Δ.carrier (φ.or ψ)
apply Pf.or_I₂
mp.inr.a
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ ψ
Pf Δ.carrier ψ
rw [<- truth_lemma Δ ψ]
mp.inr.a
w : World
φ : Tm
ψ : Tm
S : Sieve w
hLocal : w'S, at_world w' φ at_world w' ψ
hS : ContextCovers w S
Δ : World
: Δ S.carrier
: at_world Δ ψ
at_world Δ ψ
exact ·
mpr
w : World
φ : Tm
ψ : Tm
Pf w.carrier (φ.or ψ) → at_world w (φ.or ψ)
intro h
mpr
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
at_world w (φ.or ψ)
refine context_sieve w [φ, ψ], ?_, ?_
mpr.refine_1
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
covers w (context_sieve w [φ, ψ])
mpr.refine_2
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
w'context_sieve w [φ, ψ], at_world w' φ at_world w' ψ
·
mpr.refine_1
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
covers w (context_sieve w [φ, ψ])
change ContextCovers w (context_sieve w [φ, ψ])
mpr.refine_1
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
apply ContextCovers.basic w [φ, ψ]
mpr.refine_1.a
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
mpr.refine_1.a
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
·
mpr.refine_1.a
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
exact disjunction_two h ·
mpr.refine_1.a
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
apply subset_rfl ·
mpr.refine_2
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
w'context_sieve w [φ, ψ], at_world w' φ at_world w' ψ
intro Δ
mpr.refine_2
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
at_world Δ φ at_world Δ ψ
rcases .2 withA, hA, hPf
mpr.refine_2
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
A : Tm
hA : A [φ, ψ]
hPf : Pf Δ.carrier A
at_world Δ φ at_world Δ ψ
simp at hA
mpr.refine_2
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
A : Tm
hPf : Pf Δ.carrier A
hA : A = φ A = ψ
at_world Δ φ at_world Δ ψ
rcases hA with hA | hA
mpr.refine_2.inl
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
A : Tm
hPf : Pf Δ.carrier A
hA : A = φ
at_world Δ φ at_world Δ ψ
mpr.refine_2.inr
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
A : Tm
hPf : Pf Δ.carrier A
hA : A = ψ
at_world Δ φ at_world Δ ψ
·
mpr.refine_2.inl
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
A : Tm
hPf : Pf Δ.carrier A
hA : A = φ
at_world Δ φ at_world Δ ψ
subst A
mpr.refine_2.inl
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
hPf : Pf Δ.carrier φ
at_world Δ φ at_world Δ ψ
apply Or.inl
mpr.refine_2.inl.h
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
hPf : Pf Δ.carrier φ
at_world Δ φ
rw [truth_lemma Δ φ]
mpr.refine_2.inl.h
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
hPf : Pf Δ.carrier φ
Pf Δ.carrier φ
exact hPf ·
mpr.refine_2.inr
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
A : Tm
hPf : Pf Δ.carrier A
hA : A = ψ
at_world Δ φ at_world Δ ψ
subst A
mpr.refine_2.inr
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
hPf : Pf Δ.carrier ψ
at_world Δ φ at_world Δ ψ
apply Or.inr
mpr.refine_2.inr.h
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
hPf : Pf Δ.carrier ψ
at_world Δ ψ
rw [truth_lemma Δ ψ]
mpr.refine_2.inr.h
w : World
φ : Tm
ψ : Tm
h : Pf w.carrier (φ.or ψ)
Δ : World
: Δ context_sieve w [φ, ψ]
hPf : Pf Δ.carrier ψ
Pf Δ.carrier ψ
exact hPf | Tm.imp φ ψ =>
w : World
φ : Tm
ψ : Tm
at_world w (φ.imp ψ) Pf w.carrier (φ.imp ψ)
by
w : World
φ : Tm
ψ : Tm
at_world w (φ.imp ψ) Pf w.carrier (φ.imp ψ)
constructor
mp
w : World
φ : Tm
ψ : Tm
at_world w (φ.imp ψ) → Pf w.carrier (φ.imp ψ)
mpr
w : World
φ : Tm
ψ : Tm
Pf w.carrier (φ.imp ψ) → at_world w (φ.imp ψ)
·
mp
w : World
φ : Tm
ψ : Tm
at_world w (φ.imp ψ) → Pf w.carrier (φ.imp ψ)
intro hImp
mp
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
Pf w.carrier (φ.imp ψ)
by_cases hff : Pf (φ :: w.carrier) Tm.ff
pos
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : Pf (φ :: w.carrier) Tm.ff
Pf w.carrier (φ.imp ψ)
neg
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : ¬Pf (φ :: w.carrier) Tm.ff
Pf w.carrier (φ.imp ψ)
·
pos
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : Pf (φ :: w.carrier) Tm.ff
Pf w.carrier (φ.imp ψ)
exact Pf.imp_I (Pf.ff_E hff) ·
neg
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : ¬Pf (φ :: w.carrier) Tm.ff
Pf w.carrier (φ.imp ψ)
let v : World := φ :: w.carrier, hff
neg
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : ¬Pf (φ :: w.carrier) Tm.ff
Pf w.carrier (φ.imp ψ)
have hwv : wv := List.suffix_cons φ w.carrier
neg
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : ¬Pf (φ :: w.carrier) Tm.ff
hwv : w v
Pf w.carrier (φ.imp ψ)
have hφv : at_world v φ := (truth_lemma v φ).2 Pf.assume
neg
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : ¬Pf (φ :: w.carrier) Tm.ff
hwv : w v
hφv : at_world v φ
Pf w.carrier (φ.imp ψ)
have hψv : at_world v ψ := hImp v hwv hφv
neg
w : World
φ : Tm
ψ : Tm
hImp : at_world w (φ.imp ψ)
hff : ¬Pf (φ :: w.carrier) Tm.ff
hwv : w v
hφv : at_world v φ
hψv : at_world v ψ
Pf w.carrier (φ.imp ψ)
exact Pf.imp_I ((truth_lemma v ψ).1 hψv) ·
mpr
w : World
φ : Tm
ψ : Tm
Pf w.carrier (φ.imp ψ) → at_world w (φ.imp ψ)
intro hImp v
mpr
w : World
φ : Tm
ψ : Tm
hImp : Pf w.carrier (φ.imp ψ)
v : World
w vat_world v φat_world v ψ
hwv
mpr
w : World
φ : Tm
ψ : Tm
hImp : Pf w.carrier (φ.imp ψ)
v : World
hwv : w v
at_world v φat_world v ψ
hφv
mpr
w : World
φ : Tm
ψ : Tm
hImp : Pf w.carrier (φ.imp ψ)
v : World
hwv : w v
hφv : at_world v φ
at_world v ψ
have hImpv : Pf v.carrier (Tm.imp φ ψ) := Pf.wk hwv hImp
mpr
w : World
φ : Tm
ψ : Tm
hImp : Pf w.carrier (φ.imp ψ)
v : World
hwv : w v
hφv : at_world v φ
hImpv : Pf v.carrier (φ.imp ψ)
at_world v ψ
have hφp : Pf v.carrier φ := (truth_lemma v φ).1 hφv
mpr
w : World
φ : Tm
ψ : Tm
hImp : Pf w.carrier (φ.imp ψ)
v : World
hwv : w v
hφv : at_world v φ
hImpv : Pf v.carrier (φ.imp ψ)
hφp : Pf v.carrier φ
at_world v ψ
exact (truth_lemma v ψ).2 (Pf.imp_E hImpv hφp) | Tm.tt => by constructor
mp
w : World
mpr
w : World
·
mp
w : World
intro _
mp
w : World
a✝ : at_world w Tm.tt
exact Pf.tt_I ·
mpr
w : World
intro _
mpr
w : World
a✝ : Pf w.carrier Tm.tt
trivial | Tm.ff => by constructor
mp
w : World
mpr
w : World
·
mp
w : World
intro h exact False.elim h ·
mpr
w : World
intro h
mpr
exact False.elim (w.consistent h)



theorem all_at_world_self : ∀ w : World, all_at_world w w.carrier := by
∀ (w : World), all_at_world w w.carrier
intro w cases w with | mk carrier consistent =>
mk
carrier : Ctxt
consistent : ¬Pf carrier Tm.ff
all_at_world { carrier := carrier, consistent := consistent } { carrier := carrier, consistent := consistent }.carrier
induction carrier with | nil =>
mk.nil
consistent : ¬Pf [] Tm.ff
simp | cons φ Γ ih =>
mk.cons
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
all_at_world { carrier := φ :: Γ, consistent := consistent } { carrier := φ :: Γ, consistent := consistent }.carrier
have htail : ¬ Pf Γ Tm.ff := by
∀ (w : World), all_at_world w w.carrier
intro hff
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
hff : Pf Γ Tm.ff
False
exact consistent (Pf.wk (List.suffix_cons φ Γ) hff) constructor
mk.cons.left
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
htail : ¬Pf Γ Tm.ff
at_world { carrier := φ :: Γ, consistent := consistent } φ
mk.cons.right
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
htail : ¬Pf Γ Tm.ff
all_at_world { carrier := φ :: Γ, consistent := consistent } Γ
·
mk.cons.left
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
htail : ¬Pf Γ Tm.ff
at_world { carrier := φ :: Γ, consistent := consistent } φ
rw [truth_lemma φ :: Γ, consistent φ]
mk.cons.left
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
htail : ¬Pf Γ Tm.ff
Pf { carrier := φ :: Γ, consistent := consistent }.carrier φ
apply Pf.assume ·
mk.cons.right
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
htail : ¬Pf Γ Tm.ff
all_at_world { carrier := φ :: Γ, consistent := consistent } Γ
have Γ_le : Γφ :: Γ := by
∀ (w : World), all_at_world w w.carrier
apply List.suffix_cons have w_le : (Γ, htail : World) ≤ (φ :: Γ), consistent := by
∀ (w : World), all_at_world w w.carrier
exact Γ_le apply mono_all w_le
mk.cons.right
φ : Tm
Γ : List Tm
ih : ∀ (consistent : ¬Pf Γ Tm.ff), all_at_world { carrier := Γ, consistent := consistent } { carrier := Γ, consistent := consistent }.carrier
consistent : ¬Pf (φ :: Γ) Tm.ff
htail : ¬Pf Γ Tm.ff
Γ_le : Γ φ :: Γ
w_le : { carrier := Γ, consistent := htail } { carrier := φ :: Γ, consistent := consistent }
apply ih htail


theorem completeness {Γ : Ctxt} {P : Tm} : Beth.SemEntails.{0} Γ PPf Γ P := by
Γ : Ctxt
P : Tm
SemEntails Γ PPf Γ P
intro hsem
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
Pf Γ P
by_cases hff : Pf Γ Tm.ff
pos
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : Pf Γ Tm.ff
Pf Γ P
neg
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : ¬Pf Γ Tm.ff
Pf Γ P
·
pos
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : Pf Γ Tm.ff
Pf Γ P
exact Pf.ff_E hff ·
neg
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : ¬Pf Γ Tm.ff
Pf Γ P
let w : World := Γ, hff
neg
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : ¬Pf Γ Tm.ff
w : World := { carrier := Γ, consistent := hff }
Pf Γ P
have : all_at_world w Γ := all_at_world_self w
neg
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : ¬Pf Γ Tm.ff
w : World := { carrier := Γ, consistent := hff }
: all_at_world w Γ
Pf Γ P
have hP : at_world w P := hsem World w
neg
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : ¬Pf Γ Tm.ff
w : World := { carrier := Γ, consistent := hff }
: all_at_world w Γ
hP : at_world w P
Pf Γ P
rw [<- truth_lemma w P]
neg
Γ : Ctxt
P : Tm
hsem : SemEntails Γ P
hff : ¬Pf Γ Tm.ff
w : World := { carrier := Γ, consistent := hff }
: all_at_world w Γ
hP : at_world w P
at_world w P
exact hP


end Completeness

end Beth