module Logic.Propositional.Classical.Compactness where
Compactness of classical propositional logic is a constructive tabooπ
The compactness property, for a logical system, says that we can determine the satisfiability of a set of formulae β no matter how big is! β by checking the truth of every one of its finite subsets,
subset-is-sat : β {Ξ} β (Proposition Ξ β Ξ©) β Type _ subset-is-sat {Ξ} Οs = β[ Ο β (Fin Ξ β Bool) ] ((Ο : Proposition Ξ) β Ο β Οs β β¦ Ο β§ Ο β‘ true) has-compactness : Type has-compactness = β {Ξ} β (Οs : Proposition Ξ β Ξ©) β (β (Οs' : Proposition Ξ β Ξ©) β Οs' β Οs β Finite (β«β Οs') β subset-is-sat Οs') β subset-is-sat Οs
Keep in mind that compactness is not immediate, even classically, since the set of formulae we are testing might be arbitrarily sized β it could be countably infinite, equinumerous with or worse β and so it does not necessarily satisfy any boundedness principles that would allow us to βpatch togetherβ pieces of truth β or even carve out those pieces in the first place.
In fact, while compactness may sound like a natural statement, we will show that this property is too strong to ask of classical propositional logic, in our neutral meta-theory: if compactness holds, then so does weak excluded middle. Here, we formalise an argument due to (Saving 2023).
compactnessβwlem : has-compactness β WLEM compactnessβwlem compact P = Β¬Pβ¨Β¬Β¬P where
We fix an arbitrary proposition of Agda, our meta-logic, and an atom of our object logic. We will apply compactness to the set
of formulae.
x : Proposition 1 x = atom 0 [xβ£P] : Proposition 1 β Ξ© [xβ£P] Ο = elΞ© ((x β‘ Ο) Γ β£ P β£) [Β¬xβ£Β¬P] : Proposition 1 β Ξ© [Β¬xβ£Β¬P] Ο = elΞ© ((βΒ¬β x β‘ Ο) Γ (Β¬ β£ P β£))
Despite the previous examples of bad subset being extremely large, this is actually quite tame! It only has three possible finite subsets, namely the empty set, and all of which are easily seen to be satisfiable. However, showing this to a proof assistant requires quite a bit of work in combinatorics, so the actual formalisation is a slightly nightmarish case bash.
finitely-consistent : (Οs' : Proposition 1 β Ξ©) β Οs' β ([xβ£P] βͺ [Β¬xβ£Β¬P]) β Finite (β«β Οs') β subset-is-sat Οs'
We will set the <details>
aside for the curious reader.
finitely-consistent Οs' sub (fin {zero} β₯enumβ₯) = pure $ (Ξ» _ β true) , Ξ» Ο ΟβΟs' β absurd (card-zeroβempty β₯enumβ₯ (Ο , ΟβΟs')) finitely-consistent Οs' sub (fin {suc zero} β₯enumβ₯) = do enum β β₯enumβ₯ let module enum = Equiv enum let (Ο , ΟβΟs') = enum.from 0 sub Ο ΟβΟs' <&> Ξ» where (inl xp) β (Ξ» _ β true) , Ξ» Ο' Ο'βΟs' β β₯-β₯-out! do sub Ο' Ο'βΟs' >>= Ξ» where (inl xp') β β‘-tr do (x=Ο' , _) β xp' pure (subst (Ξ» e β β¦ e β§ (Ξ» _ β true) β‘ true) x=Ο' refl) (inr Β¬xp') β β‘-tr do (_ , p) β xp (_ , Β¬p) β Β¬xp' absurd (Β¬p p) (inr Β¬xp) β (Ξ» _ β false) , Ξ» Ο' Ο'βΟs' β β₯-β₯-out! do sub Ο' Ο'βΟs' >>= Ξ» where (inl xp') β β‘-tr do (_ , Β¬p) β Β¬xp (_ , p) β xp' absurd (Β¬p p) (inr Β¬xp') β β‘-tr do (Β¬x=Ο' , _) β Β¬xp' pure (subst (Ξ» e β β¦ e β§ (Ξ» _ β false) β‘ true) Β¬x=Ο' refl) finitely-consistent Οs' sub (fin {suc (suc n)} β₯enumβ₯) = do enum β β₯enumβ₯ let module enum = Equiv enum let (Ο , ΟβΟs') = enum.from 0 let (Ο' , Ο'βΟs') = enum.from 1 sub Ο ΟβΟs' >>= Ξ» where (inl xp) β sub Ο' Ο'βΟs' >>= Ξ» where (inl xp') β β‘-tr do (x=Ο , _) β xp (x=Ο' , _) β xp' absurd (fzeroβ fsuc $ sym (enum.Ξ΅ 0) β ap enum.to (Ξ£-prop-path! (sym x=Ο β x=Ο')) β enum.Ξ΅ 1) (inr Β¬xp') β β‘-tr do (_ , p) β xp (_ , Β¬p) β Β¬xp' absurd (Β¬p p) (inr Β¬xp) β sub Ο' Ο'βΟs' >>= Ξ» where (inl xp') β β‘-tr do (_ , Β¬p) β Β¬xp (_ , p) β xp' absurd (Β¬p p) (inr Β¬xp') β β‘-tr do (x=Ο , _) β Β¬xp (x=Ο' , _) β Β¬xp' absurd (fzeroβ fsuc $ sym (enum.Ξ΅ 0) β ap enum.to (Ξ£-prop-path! (sym x=Ο β x=Ο')) β enum.Ξ΅ 1)
By compactness, we must have a satisfying assignment for the set of formulae
which actually consists only of the boolean value assigned to the atom something we can do case analysis on. If our compactness oracle thinks that must be true, then it can not have been the case that holds, since then we would have In other words, we have decided
x-true⬬P : (Ο : Fin 1 β Bool) β (β Ο β Ο β [xβ£P] βͺ [Β¬xβ£Β¬P] β sem-prop Ο Ο β‘ true) β β¦ x β§ Ο β‘ true β Β¬ Β¬ β£ P β£ x-true⬬P Ο sat x-true Β¬p = not-no-fixed $ β¦ x β§ Ο β‘β¨ x-true β©β‘ true β‘Λβ¨ sat (βΒ¬β x) (inc (inr (inc (refl , Β¬p)))) β©β‘Λ not (β¦ x β§ Ο) β
Conversely, if was assigned false, then must not have failed: but the triple negative can be reduced to a single negative, even constructively.
x-falseβΒ¬P : (Ο : Fin 1 β Bool) β (β Ο β Ο β [xβ£P] βͺ [Β¬xβ£Β¬P] β sem-prop Ο Ο β‘ true) β β¦ x β§ Ο β‘ false β Β¬ β£ P β£ x-falseβΒ¬P Ο sat x-false p = not-no-fixed $ β¦ x β§ Ο β‘β¨ sat x (inc (inl (inc (refl , p)))) β©β‘ true β‘Λβ¨ ap not x-false β©β‘Λ not (β¦ x β§ Ο) β
If we put this all together, then we can decide
Β¬Pβ¨Β¬Β¬P : Dec (Β¬ β£ P β£) Β¬Pβ¨Β¬Β¬P = β₯-β₯-out! do (Ο , Ο-sat) β compact ([xβ£P] βͺ [Β¬xβ£Β¬P]) finitely-consistent pure $ Bool-elim (Ξ» b β Ο 0 β‘ b β Dec (Β¬ β£ P β£)) (Ξ» x-true β no (x-true⬬P Ο Ο-sat x-true)) (Ξ» x-false β yes (x-falseβΒ¬P Ο Ο-sat x-false)) (Ο 0) refl
References
- Saving, Mark. 2023. βAnswer to βConstructive Proof of Compactness Theorem for Countable Propositional Languagesβ.β Mathematics Stack Exchange. https://math.stackexchange.com/a/4669653.