def Prime (T : Theory) : Prop :=
∀ ⦃φ ψ : Tm⦄, (φ ∨ ψ) ∈ T → φ ∈ T ∨ ψ ∈ T
lemma subset_closure {T : Theory} : T ⊆ closure T := by
intro φ φ_in_T
refine ⟨[φ], ?_, ?_⟩
· intro ψ ψ_in_ls
have : ψ = φ := by
simpa using ψ_in_ls
simpa [this] using φ_in_T
· exact Pf.assume
lemma closure_mono {S T : Theory} (S_in_T : S ⊆ T) : closure S ⊆ closure T := by
intro φ φ_in_clS
rcases φ_in_clS with ⟨Γ, Γ_in_S, pf_φ⟩
exists Γ⊢ (∀
ψ ∈
Γ,
ψ ∈ T)
∧ Pf Γ φ
constructor
· intro ψ ψ_in_Γ
apply S_in_T
apply Γ_in_S ψ ψ_in_Γ
· exact pf_φ
lemma provable_merge {T : Theory} :
∀ Γ : Ctxt, (∀ ψ ∈ Γ, ProvableFrom T ψ) →
∃ Δ : Ctxt, (∀ ξ ∈ Δ, ξ ∈ T) ∧ ∀ ψ ∈ Γ, Pf Δ ψ
| [], _ =>⊢ ∃
Δ, (∀
ξ ∈
Δ,
ξ ∈ T)
∧ ∀
ψ ∈
[],
Pf Δ ψ by⊢ ∃
Δ, (∀
ξ ∈
Δ,
ξ ∈ T)
∧ ∀
ψ ∈
[],
Pf Δ ψ
exists []
aesop
| ψ :: Γ, Γ_from_T =>⊢ ∃
Δ, (∀
ξ ∈
Δ,
ξ ∈ T)
∧ ∀
ψ_1 ∈
ψ :: Γ,
Pf Δ ψ_1 by⊢ ∃
Δ, (∀
ξ ∈
Δ,
ξ ∈ T)
∧ ∀
ψ_1 ∈
ψ :: Γ,
Pf Δ ψ_1
rcases Γ_from_T ψ (by simp) with ⟨Δψ, Δψ_in_T, pf_ψ⟩
have Γ_T : ∀ ξ ∈ Γ , ProvableFrom T ξ := by⊢ ∃
Δ, (∀
ξ ∈
Δ,
ξ ∈ T)
∧ ∀
ψ_1 ∈
ψ :: Γ,
Pf Δ ψ_1
intro ξ ξ_in_ΓΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
apply Γ_from_TaΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
simp [ξ_in_Γ]
rcases provable_merge Γ Γ_T with ⟨Δ, Δ_in_T, pf_Γ⟩Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ⊢ ∃
Δ, (∀
ξ ∈
Δ,
ξ ∈ T)
∧ ∀
ψ_1 ∈
ψ :: Γ,
Pf Δ ψ_1
-- Δψ is a context from which we can prove φ
-- Δ is a context from which we can prove each of Γ
-- so the concatenation should be able to prove φ :: Γ
set tot_Γ : Ctxt := Δψ ++ ΔΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ⊢ ∃
Δ, (∀
ξ ∈
Δ,
ξ ∈ T)
∧ ∀
ψ_1 ∈
ψ :: Γ,
Pf Δ ψ_1
refine ⟨tot_Γ, ?_, ?_⟩refine_1Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T refine_2Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ⊢ ∀
ψ_1 ∈
ψ :: Γ,
Pf tot_Γ ψ_1
·refine_1Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T intro ξ ξ_in_totrefine_1Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
simp [tot_Γ] at ξ_in_totrefine_1Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ξ_in_tot : ξ ∈ Δψ ∨ ξ ∈ Δ
apply ξ_in_tot.elimrefine_1.leftΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ξ_in_tot : ξ ∈ Δψ ∨ ξ ∈ Δ refine_1.rightΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ξ_in_tot : ξ ∈ Δψ ∨ ξ ∈ Δ
·refine_1.leftΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ξ_in_tot : ξ ∈ Δψ ∨ ξ ∈ Δ intro ξ_in_Δψrefine_1.leftΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ξ_in_tot : ξ ∈ Δψ ∨ ξ ∈ Δ ; exact Δψ_in_T ξ ξ_in_Δψ
·refine_1.rightΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ξ_in_tot : ξ ∈ Δψ ∨ ξ ∈ Δ intro ξ_in_Δrefine_1.rightΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ξ_in_tot : ξ ∈ Δψ ∨ ξ ∈ Δ ; exact Δ_in_T ξ ξ_in_Δ
·refine_2Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T ⊢ ∀
ψ_1 ∈
ψ :: Γ,
Pf tot_Γ ψ_1 intro ξ ξ_in_Γ'refine_2Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
simp at ξ_in_Γ'refine_2Δψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
rcases ξ_in_Γ' with rfl | hξrefine_2.inlΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T refine_2.inrΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
·refine_2.inlΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T apply Pf.monotone_mem Δψ (Δψ ++ Δ)refine_2.inl.hmemΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T refine_2.inl.aΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
·refine_2.inl.hmemΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T intro tm tm_in_Δψrefine_2.inl.hmemΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
simp [tm_in_Δψ]
·refine_2.inl.aΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T exact pf_ψ
·refine_2.inrΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T apply Pf.monotone_mem Δ (Δψ ++ Δ)refine_2.inr.hmemΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T refine_2.inr.aΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
·refine_2.inr.hmemΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T intro tm tm_in_Δrefine_2.inr.hmemΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T
simp [tm_in_Δ]
·refine_2.inr.aΔψ_in_T : ∀ ψ ∈ Δψ, ψ ∈ T exact (pf_Γ ξ hξ)
def contextSet (Γ : Ctxt) : Theory := {φ | φ ∈ Γ}
lemma contextSet_mem {Γ : Ctxt} {φ : Tm} (φ_in_Γ : φ ∈ Γ) : φ ∈ theoryOf Γ :=
subset_closure φ_in_Γ
-- if a context is provably from a union of a chain of theories,
-- then there is some theory that proves everything in the context
lemma chain_member_for_ctxt
{c : Set Theory} (hc : IsChain (· ⊆ ·) c) (hne : c.Nonempty) :
∀ Γ : Ctxt, (∀ ψ ∈ Γ, ψ ∈ sUnion c) → ∃ T ∈ c, ∀ ψ ∈ Γ, ψ ∈ T
| [], hΓ =>⊢ ∃
T ∈
c, ∀
ψ ∈
[],
ψ ∈ T by⊢ ∃
T ∈
c, ∀
ψ ∈
[],
ψ ∈ T
rcases hne with ⟨T, T_in_c⟩⊢ ∃
T ∈
c, ∀
ψ ∈
[],
ψ ∈ T
exists T⊢ T ∈ c ∧ ∀
ψ ∈
[],
ψ ∈ T
aesop
| ψ :: Γ, Γ_in =>Γ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T byΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T
rcases Γ_in ψ (byΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c simp) with ⟨Tψ, Tψ_in_c, ψ_in_Tψ⟩
have : ∃ T ∈ c, ∀ ψ ∈ Γ, ψ ∈ T := byΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T
apply chain_member_for_ctxt hc hne ΓΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c
aesop
rcases this with ⟨TΓ, TΓ_in_c, Γ_in_TΓ⟩Γ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T
by_cases hEq : Tψ = TΓposΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T negΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T
·posΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T refine ⟨TΓ, TΓ_in_c, ?_⟩posΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ TΓ
aesop
·negΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T rcases hc Tψ_in_c TΓ_in_c hEq with hsub | hsubneg.inlΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T neg.inrΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T
·neg.inlΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T refine ⟨TΓ, TΓ_in_c, ?_⟩neg.inlΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ TΓ
aesop
·neg.inrΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∃
T ∈
c, ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ T refine ⟨Tψ, Tψ_in_c, ?_⟩neg.inrΓ_in : ∀ ψ_1 ∈ ψ :: Γ, ψ_1 ∈ ⋃₀ c Γ_in_TΓ : ∀ ψ ∈ Γ, ψ ∈ TΓ ⊢ ∀
ψ_1 ∈
ψ :: Γ,
ψ_1 ∈ Tψ
aesop
lemma sUnion_closed {c : Set Theory} (hc : IsChain (· ⊆ ·) c) (hne : c.Nonempty)
(hclosed : ∀ T ∈ c, Closed T) : Closed (sUnion c) := by
intro φ φ_prov
rcases φ_prov with ⟨Γ, Γ_in_union, φ_pf⟩Γ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c
rcases chain_member_for_ctxt hc hne Γ Γ_in_union with ⟨T, T_in_c, φ_in_T⟩Γ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c
apply mem_sUnion_of_memhxΓ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c htΓ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c tΓ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c
·hxΓ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c apply hclosed T T_in_chx.aΓ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c
exact ⟨Γ, φ_in_T, φ_pf⟩
·htΓ_in_union : ∀ ψ ∈ Γ, ψ ∈ ⋃₀ c exact T_in_c
lemma closure_insert_imp {T : Theory} {φ tm : Tm} (T_closed : Closed T)
(htm : tm ∈ closure (Set.insert φ T)) : (φ ⇒ tm) ∈ T := by
rcases htm with ⟨Γ, Γ_in_T', pf_tm⟩
let Δ : Ctxt := Γ.filter (· ∈ T)
have Δ_in_T : ∀ ξ ∈ Δ, ξ ∈ T := by
intro ξ hξ
simp [Δ] at hξ
exact hξ.2
have tm_ass_φ : Pf (φ :: Δ) tm := by
apply Pf.multicut pf_tm
intro ξ ξ_in_Γ
have ξ_in_T' := Γ_in_T' ξ ξ_in_Γ
rcases ξ_in_T' with rfl | ξ_in_T
· exact Pf.assume
· have ξ_in_Δ' : ξ ∈ φ :: Δ := by
simp [Δ, ξ_in_Γ, ξ_in_T]
exact Pf.of_mem ξ_in_Δ'
apply T_closed
exact ⟨Δ, Δ_in_T, Pf.imp_I tm_ass_φ⟩
theorem prime_extension_avoiding {S : Theory} {A : Tm}
(S_closed : Closed S) (S_consistent : Consistent S) (not_A_in_S : A ∉ S) :
∃ T, Admissible S A T ∧ Prime T := by
let candidates : Set Theory := {T | Admissible S A T}
have S_in_candidates : S ∈ candidates :=
⟨subset_rfl, S_closed, S_consistent, not_A_in_S⟩not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
obtain ⟨M, hSM, M_maximal⟩ : ∃ m, S ⊆ m ∧ Maximal (· ∈ candidates) m := bynot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates ⊢ ∃
m,
S ⊆ m ∧ Maximal (fun
x =>
x ∈ candidates)
m
-- if we for any non-empty chain c in candidates, we have an upper bound (also in candidates),
-- then for any candidate we can find a maximal candidate set containing it
apply zorn_subset_nonempty candidatesHnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates ⊢ ∀
c ⊆
candidates,
IsChain (fun
x1 x2 =>
x1 ⊆ x2)
c →
c.
Nonempty → ∃
ub ∈
candidates, ∀
s ∈
c,
s ⊆ ub hxnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
intro c c_in_CHnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates hxnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates hcChainHnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates ⊢ c.
Nonempty → ∃
ub ∈
candidates, ∀
s ∈
c,
s ⊆ ub hxnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates c_neHnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates ⊢ ∃
ub ∈
candidates, ∀
s ∈
c,
s ⊆ ub hxnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
refine ⟨sUnion c, ?_, ?_⟩H.refine_1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates H.refine_2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates hxnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
-- show that the union of a chain is a candidate
have union_closed : Closed (⋃₀ c) := bynot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates ⊢ ∃
m,
S ⊆ m ∧ Maximal (fun
x =>
x ∈ candidates)
m
apply sUnion_closed hcChain c_nenot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
intro T T_in_cnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
apply (c_in_C T_in_c).closed
·H.refine_1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates refine ⟨?_, union_closed , ?_, ?_⟩H.refine_1.refine_1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates H.refine_1.refine_2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates H.refine_1.refine_3not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
·H.refine_1.refine_1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates intro φ φ_in_SH.refine_1.refine_1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
rcases c_ne with ⟨tms, tms_in_c⟩H.refine_1.refine_1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
-- φ is in S and so in any candidate admissible theory
have φ_in_tms : φ ∈ tms := bynot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates ⊢ ∃
m,
S ⊆ m ∧ Maximal (fun
x =>
x ∈ candidates)
m
apply (c_in_C tms_in_c).baseanot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
exact φ_in_S
apply mem_sUnion_of_mem φ_in_tmsH.refine_1.refine_1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
exact tms_in_c
·H.refine_1.refine_2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates intro ff_in_UcH.refine_1.refine_2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
rcases ff_in_Uc with ⟨T, T_in_c, ff_in_T⟩H.refine_1.refine_2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
exact (c_in_C T_in_c).consistent ff_in_T
·H.refine_1.refine_3not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates intro A_in_UcH.refine_1.refine_3not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
rcases A_in_Uc with ⟨T, T_in_c, A_in_T⟩H.refine_1.refine_3not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
exact (c_in_C T_in_c).avoids A_in_T
·H.refine_2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates intro s s_in_cH.refine_2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates
exact subset_sUnion_of_mem s_in_c
·hxnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates exact S_in_candidates
have M_admissible : Admissible S A M := by
apply M_maximal.1
refine ⟨M, M_admissible, ?_⟩not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M
-- prove that M = ⋃₀ c is prime:
intro φ ψnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M or_in_Mnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M
by_contra hPrimenot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M
push Not at hPrimenot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M
have not_φ_in_M : φ ∉ M := hPrime.1not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
have not_ψ_in_M : ψ ∉ M := hPrime.2not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
let Mφ : Theory := closure (Set.insert φ M)not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
let Mψ : Theory := closure (Set.insert ψ M)not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
have hMφ : M ⊆ Mφ := by
intro tm tm_in_Mnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply subset_closureanot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
exact Or.inr tm_in_M
have hMψ : M ⊆ Mψ := by
intro tm tm_in_Mnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply subset_closureanot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
exact Or.inr tm_in_M
-- neither Mφ not Mψ are admissible as then they would be equal to M
-- by maximality, but then either φ or ψ would be in M
have Mφ_not_addmissble : ¬ Admissible S A Mφ := by
intro Mφ_admissiblenot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
have hEq : M = Mφ := M_maximal.eq_of_subset Mφ_admissible hMφnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply not_φ_in_Mnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
rw [hEq]not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply subset_closureanot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply Or.inla.hnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
rfl
have Mψ_not_admissible : ¬ Admissible S A Mψ := by
intro Mψ_admissiblenot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
have hEq : M = Mψ := M_maximal.eq_of_subset Mψ_admissible hMψnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply not_ψ_in_Mnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
rw [hEq]not_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply subset_closureanot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply Or.inla.hnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
rfl
have φ_imp_A_in_M : (φ ⇒ A) ∈ M := by
apply imp_target_of_failureT_closednot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
ext_withnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply M_admissible.closedext_withnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
apply (closure_insert_failure M_admissible.base Mφ_not_addmissble)
have ψ_imp_A_in_M : (ψ ⇒ A) ∈ M := by
apply imp_target_of_failureT_closednot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ext_withnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M
apply M_admissible.closedext_withnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M
apply closure_insert_failure M_admissible.base Mψ_not_admissible
have hA : A ∈ M := by
apply M_admissible.closedanot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M
·anot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M exists [φ ∨ ψ, φ ⇒ A, ψ ⇒ A]anot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M
constructora.leftnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M ⊢ ∀
ψ_1 ∈
[φ ∨ ψ, φ ⇒ A, ψ ⇒ A],
ψ_1 ∈ M a.rightnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M
·a.leftnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M ⊢ ∀
ψ_1 ∈
[φ ∨ ψ, φ ⇒ A, ψ ⇒ A],
ψ_1 ∈ M intro tm tm_in_ctxta.leftnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M
simp at tm_in_ctxta.leftnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M
rcases tm_in_ctxt with rfl | rfl | rfla.left.inlnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M a.left.inr.inlnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M a.left.inr.inrnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M
·a.left.inlnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M exact or_in_M
·a.left.inr.inlnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M exact φ_imp_A_in_M
·a.left.inr.inrnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M exact ψ_imp_A_in_M
·a.rightnot_A_in_S : A ∉ S
S_in_candidates : S ∈ candidates M_maximal : Maximal (fun x => x ∈ candidates) M not_φ_in_M : φ ∉ M
not_ψ_in_M : ψ ∉ M
φ_imp_A_in_M : (φ ⇒ A) ∈ M ψ_imp_A_in_M : (ψ ⇒ A) ∈ M exact Pf.or_cases_to φ ψ A
exact M_admissible.avoids hA
theorem truth_lemma (w : World) : ∀ φ : Tm, at_world w φ ↔ φ ∈ w.carrier
| Tm.var i => Iff.rfl
| Tm.and φ ψ => by
constructor
· intro at_w_and
have hφ : φ ∈ w.carrier := by
rw [<- truth_lemma w φ]
apply And.left
apply at_w_and
have hψ : ψ ∈ w.carrier := by
rw [<- truth_lemma w ψ]
apply And.right
apply at_w_and
-- use that w is deductively closed
apply w.closed
exists [φ, ψ]
constructor
· aesop
· have hφmem : φ ∈ [φ, ψ] := by simp
have hψmem : ψ ∈ [φ, ψ] := by simp
exact Pf.and_I (Pf.of_mem hφmem) (Pf.of_mem hψmem)
· intro both_in_w
constructor
· rw [truth_lemma w φ]
apply w.closed
exists [φ ∧ ψ]
constructor
· simpa using both_in_w
· have hmem : (φ ∧ ψ) ∈ [φ ∧ ψ] := by simp
exact Pf.and_E₁ (Pf.of_mem hmem)
· rw [truth_lemma w ψ]
apply w.closed
exists [φ ∧ ψ]
constructor
· simpa using both_in_w
· have hmem : (φ ∧ ψ) ∈ [φ ∧ ψ] := by simp
exact Pf.and_E₂ (Pf.of_mem hmem)
| Tm.or φ ψ => by
constructor
· intro or_at_w
rcases or_at_w with φ_at_w | ψ_at_w
· apply w.closed
exists [φ]
constructor
· simp
rw [<- truth_lemma w φ]
exact φ_at_w
· have hmem : φ ∈ [φ] := by simp
exact Pf.or_I₁ (Pf.of_mem hmem)
· apply w.closed
exists [ψ]
constructor
· simp
rw [<- truth_lemma w ψ]
exact ψ_at_w
· have hmem : ψ ∈ [ψ] := by simp
exact Pf.or_I₂ (Pf.of_mem hmem)
· intro or_in_w
rcases w.prime or_in_w with φ_in_w | ψ_in_w
· simp
rw [truth_lemma w φ]
apply Or.inl
assumption
· simp
rw [truth_lemma w ψ]
apply Or.inr
assumption
| Tm.imp φ ψ => by
constructor
· intro imp_at_w
by_contra imp_not_in_w
have ψ_not_in_clos : ψ ∉ closure (Set.insert φ w.carrier) := by
intro ψ_in_clos
apply imp_not_in_w
apply closure_insert_imp
apply w.closed
exact ψ_in_clos
have w'_consistent : Consistent (closure (Set.insert φ w.carrier)) := by
intro ff_in_w'
have not_φ_in_w : (φ ⇒ Tm.ff) ∈ w.carrier :=
closure_insert_imp w.closed ff_in_w'
apply imp_not_in_w
apply w.closed
exists
[φ ⇒ Tm.ff]
constructor
· simpa using not_φ_in_w
· exact Pf.quodlibet φ ψ
-- construct a world containing w and φ, which extends w, and where
-- φ holds but ψ doesn't
obtain ⟨T, T_adm, T_prime⟩ :=
prime_extension_avoiding (closure_closed _) w'_consistent ψ_not_in_clos
let v : World :=
⟨T, T_adm.closed, T_adm.consistent, T_prime⟩
have w_le_v : w ≤ v := by
intro χ hχ
exact T_adm.base (subset_closure (Or.inr hχ))
have φ_at_v : at_world v φ := by
apply (truth_lemma v φ).2
exact T_adm.base (subset_closure (Or.inl rfl))
have not_ψ_at_v : ¬ at_world v ψ := by
intro hψv
exact T_adm.avoids ((truth_lemma v ψ).1 hψv)
apply not_ψ_at_v
apply imp_at_w v w_le_v φ_at_v
· intro imp_in_w v w_le_v φ_at_v
have imp_in_v : (φ ⇒ ψ) ∈ v.carrier := w_le_v imp_in_w
have φ_in_v : φ ∈ v.carrier := by
rw [<- truth_lemma v φ]
exact φ_at_v
have ψ_in_v : ψ ∈ v.carrier := by
apply v.closed
exists [φ ⇒ ψ, φ]
constructor
· intro tm tm_in_ctxa.lefttm_in_ctx : tm ∈ [φ ⇒ ψ, φ]
simp at tm_in_ctxa.lefttm_in_ctx : tm = (φ ⇒ ψ) ∨ tm = φ
rcases tm_in_ctx with rfl | rfl
· exact imp_in_v
· exact φ_in_v
· have imp_mem : (φ ⇒ ψ) ∈ [φ ⇒ ψ, φ] := by simp
have φ_mem: φ ∈ [φ ⇒ ψ, φ] := by simp
exact Pf.imp_E (Pf.of_mem imp_mem) (Pf.of_mem φ_mem)
rw [truth_lemma v ψ]
exact ψ_in_v
| Tm.tt => by
constructor
· intro _
exact w.closed ⟨[], by simp, Pf.tt_I⟩
· aesop
| Tm.ff => by
constructor
· intro ff_at_w
exact False.elim ff_at_w
· intro ff_in_w
exfalso
exact w.consistent ff_in_w
theorem countermodel {Γ : Ctxt} {tm : Tm} (neg_pf : ¬ Pf Γ tm) :
¬ Kripke.SemEntails.{0} Γ tm := by
have tm_avoids_T : tm ∉ theoryOf Γ := by
intro htm
apply neg_pf
rw [<- mem_theoryOf]
assumption
have ΓT_Cons : Consistent (theoryOf Γ) := by
intro hff
apply neg_pf
apply Pf.ff_E
rw [<- mem_theoryOf]
assumption
obtain ⟨T, T_admissible, T_prime⟩ :=
prime_extension_avoiding (closure_closed _) ΓT_Cons tm_avoids_T
let w : World := ⟨T, T_admissible.closed, T_admissible.consistent, T_prime⟩
have all_in_T : ∀ Δ : Ctxt, (∀ φ ∈ Δ, φ ∈ T) → all_at_world w Δ := by
intro Δ hΔ
induction Δ with
| nil =>
simp
| cons φ Δ ih =>conshΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T
constructorcons.lefthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T cons.righthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T
·cons.lefthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T rw [truth_lemma w φ]cons.lefthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T
apply hΔ φcons.lefthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T
simp
·cons.righthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T apply ihcons.righthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T
intro ψ hψcons.righthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T
apply hΔ ψcons.righthΔ : ∀ φ_1 ∈ φ :: Δ, φ_1 ∈ T
simp [hψ]
have all_at_Γ : all_at_world w Γ := by
apply all_in_T Γ
intro φ φ_in_Γ
apply T_admissible.base (contextSet_mem φ_in_Γ)
have not_tm_at_w : ¬ at_world w tm := by
intro tm_at_w
apply T_admissible.avoids
rw [<- truth_lemma w tm]
apply tm_at_w
intro sem_tm
apply not_tm_at_w
apply sem_tm
apply all_at_Γ