Lecture notes 20190507
Denotations Versus Triples 5
Require Import Coq.Lists.List.
Require Import PL.Imp9.
Import OneBinRel_FOL.
Local Open Scope FOL.
Require Import PL.Imp9.
Import OneBinRel_FOL.
Local Open Scope FOL.
Definition complete: Prop :=
∀P: prop, ⊨ P → ⊢ P.
This definition of completeness is also called weak completeness. What is
strong completeness instead?
Definition derive (Gamma: prop → Prop) (P: prop): Prop :=
∃l, Forall Gamma l ∧ ⊢ fold_right PImpl P l.
Notation "Gamma ⊢ P" := (derive Gamma P) (at level 90, no associativity): FOL_scope.
∃l, Forall Gamma l ∧ ⊢ fold_right PImpl P l.
Notation "Gamma ⊢ P" := (derive Gamma P) (at level 90, no associativity): FOL_scope.
Here, Forall Gamma l says that all elements in l are elements in
Gamma. Here is the definition of Forall in Coq standard library.
Intuitively, if propositions Gamma derive P, there is one Gamma's finite
subset, such that the conjunction of this subset implies P.
Print Forall.
If derive is a generalization of provable, then entail is a
generalization of valid.
Definition entail (Gamma: prop → Prop) (P: prop): Prop :=
∀J, (∀Q, Gamma Q → J ⊨ Q) → J ⊨ P.
Notation "Gamma |= P" := (entail Gamma P) (at level 90, no associativity): FOL_scope.
∀J, (∀Q, Gamma Q → J ⊨ Q) → J ⊨ P.
Notation "Gamma |= P" := (entail Gamma P) (at level 90, no associativity): FOL_scope.
In logic, if a set of propositions Gamma entails P, we say that P is
a consequence (语义后承) of Gamma. The double turnstile symbol is usually
overloaded in logic text books. Here is its different meaning.
In this course, we only use ⊨ for the first two notation definitions but
use |= for the last one.
After defining derive and entail, we are ready to state the strong
completeness property.
- J ⊨ P, in which J is an interpretation and P is a
proposition. It says J satisfies P, or satisfies J P
in our Coq definition;
- ⊨ P, in which P is a proposition. It says that P is
valid. In other words, for any J, J ⊨ P;
- J ⊨ Gamma, in which J is an interpretation and Gamma
is a set of propositions. It says that J satisfies every
proposition in Gamma;
- Gamma ⊨ P, in which Gamma is a set of propositions and P is one single proposition. It says that P is a consequence of Gamma.
Definition strongly_complete: Prop :=
∀Gamma P,
Gamma |= P → Gamma ⊢ P.
∀Gamma P,
Gamma |= P → Gamma ⊢ P.
Obvious, if a logic is strongly complete, it must be complete. To prove
this theorem, we only need to let the proposition set Gamma to be empty. In
Coq, an empty set is defined by "no element is in it".
Definition Empty_pset: prop → Prop := fun P ⇒ False.
It is easy to prove that an empty set derives an assertion P if and only
if this assertion P is provable.
Lemma Empty_derive_spec: ∀P, Empty_pset ⊢ P ↔ ⊢ P.
Proof.
intros.
split; intros.
+ destruct H as [l [? ?]].
inversion H; subst.
- simpl in H0.
exact H0.
- unfold Empty_pset in H1.
destruct H1.
+ ∃nil.
split.
- apply Forall_nil.
- simpl.
exact H.
Qed.
Proof.
intros.
split; intros.
+ destruct H as [l [? ?]].
inversion H; subst.
- simpl in H0.
exact H0.
- unfold Empty_pset in H1.
destruct H1.
+ ∃nil.
split.
- apply Forall_nil.
- simpl.
exact H.
Qed.
Also, being a consequence of the empty proposition set is equivalent with
being valid.
Lemma Empty_entail_spec: ∀P, Empty_pset |= P ↔ ⊨ P.
Proof.
intros.
unfold entail, valid.
unfold Empty_pset.
firstorder.
Qed.
Theorem strong_completeness_is_stronger: strongly_complete → complete.
Proof.
unfold strongly_complete, complete.
intros SC.
specialize (SC Empty_pset).
intros.
apply Empty_derive_spec.
apply Empty_entail_spec in H.
apply SC.
apply H.
Qed.
Proof.
intros.
unfold entail, valid.
unfold Empty_pset.
firstorder.
Qed.
Theorem strong_completeness_is_stronger: strongly_complete → complete.
Proof.
unfold strongly_complete, complete.
intros SC.
specialize (SC Empty_pset).
intros.
apply Empty_derive_spec.
apply Empty_entail_spec in H.
apply SC.
apply H.
Qed.
Important FOL theorems
Lemma IMPLY_refl: ∀P, ⊢ P IMPLY P.
Admitted.
Lemma IMPLY_trans: ∀P Q R, ⊢ P IMPLY Q → ⊢ Q IMPLY R → ⊢ P IMPLY R.
Admitted.
Lemma IMPLY_swap: ∀P Q R, ⊢ P IMPLY Q IMPLY R → ⊢ Q IMPLY P IMPLY R.
Admitted.
Lemma EM_assu: ∀P Q, ⊢ P IMPLY Q → ⊢ NOT P IMPLY Q → ⊢ Q.
Admitted.
Lemma FORALL_rename: ∀P (x y: logical_var),
prop_free_occur y P = O →
⊢ (FORALL x, P) IMPLY (FORALL y, P [x ⟼ y]).
Admitted.
Lemma PEq_trans: ∀t1 t2 t3,
⊢ t1 == t2 IMPLY t2 == t3 IMPLY t1 == t3.
Admitted.
Lemma derive_assu: ∀(Gamma: prop → Prop) P,
Gamma P →
Gamma ⊢ P.
Admitted.
Definition pset_included (Gamma Gamma': prop → Prop): Prop :=
∀P, Gamma P → Gamma' P.
Lemma derive_expand: ∀Gamma Gamma' P,
pset_included Gamma Gamma' →
Gamma ⊢ P →
Gamma' ⊢ P.
Admitted.
Definition pset_snoc (Gamma: prop → Prop) (P: prop): prop → Prop :=
fun Q ⇒ Gamma Q ∨ P = Q.
Notation "Gamma ':;' P" := (pset_snoc Gamma P) (at level 81, left associativity): FOL_scope.
Lemma deduction_theorem: ∀Gamma P Q,
Gamma:; P ⊢ Q ↔ Gamma ⊢ P IMPLY Q.
Admitted.
Lemma derive_modus_ponens: ∀Gamma P Q,
Gamma:; P ⊢ Q →
Gamma ⊢ P →
Gamma ⊢ Q.
Admitted.
Lemma derive_NOT_NOT: ∀Gamma P,
Gamma ⊢ P ↔ Gamma ⊢ NOT NOT P.
Admitted.
Lemma derive_EXISTS_intros: ∀Gamma P Q x,
(∀R, (Gamma:; Q) R → prop_free_occur x R = O) →
Gamma:; P ⊢ Q →
Gamma:; EXISTS x, P ⊢ Q.
Admitted.
Lemma PRel_congr: ∀Gamma t1 t2 t3 t4,
Gamma:; t1 == t2:; t3 == t4:; PRel t1 t3 ⊢ PRel t2 t4.
Admitted.
Admitted.
Lemma IMPLY_trans: ∀P Q R, ⊢ P IMPLY Q → ⊢ Q IMPLY R → ⊢ P IMPLY R.
Admitted.
Lemma IMPLY_swap: ∀P Q R, ⊢ P IMPLY Q IMPLY R → ⊢ Q IMPLY P IMPLY R.
Admitted.
Lemma EM_assu: ∀P Q, ⊢ P IMPLY Q → ⊢ NOT P IMPLY Q → ⊢ Q.
Admitted.
Lemma FORALL_rename: ∀P (x y: logical_var),
prop_free_occur y P = O →
⊢ (FORALL x, P) IMPLY (FORALL y, P [x ⟼ y]).
Admitted.
Lemma PEq_trans: ∀t1 t2 t3,
⊢ t1 == t2 IMPLY t2 == t3 IMPLY t1 == t3.
Admitted.
Lemma derive_assu: ∀(Gamma: prop → Prop) P,
Gamma P →
Gamma ⊢ P.
Admitted.
Definition pset_included (Gamma Gamma': prop → Prop): Prop :=
∀P, Gamma P → Gamma' P.
Lemma derive_expand: ∀Gamma Gamma' P,
pset_included Gamma Gamma' →
Gamma ⊢ P →
Gamma' ⊢ P.
Admitted.
Definition pset_snoc (Gamma: prop → Prop) (P: prop): prop → Prop :=
fun Q ⇒ Gamma Q ∨ P = Q.
Notation "Gamma ':;' P" := (pset_snoc Gamma P) (at level 81, left associativity): FOL_scope.
Lemma deduction_theorem: ∀Gamma P Q,
Gamma:; P ⊢ Q ↔ Gamma ⊢ P IMPLY Q.
Admitted.
Lemma derive_modus_ponens: ∀Gamma P Q,
Gamma:; P ⊢ Q →
Gamma ⊢ P →
Gamma ⊢ Q.
Admitted.
Lemma derive_NOT_NOT: ∀Gamma P,
Gamma ⊢ P ↔ Gamma ⊢ NOT NOT P.
Admitted.
Lemma derive_EXISTS_intros: ∀Gamma P Q x,
(∀R, (Gamma:; Q) R → prop_free_occur x R = O) →
Gamma:; P ⊢ Q →
Gamma:; EXISTS x, P ⊢ Q.
Admitted.
Lemma PRel_congr: ∀Gamma t1 t2 t3 t4,
Gamma:; t1 == t2:; t3 == t4:; PRel t1 t3 ⊢ PRel t2 t4.
Admitted.
Proof By Contraposition: Satisfiability and Consistency
Definition consistent (Gamma: prop → Prop): Prop :=
¬(Gamma ⊢ PFalse).
¬(Gamma ⊢ PFalse).
A proposition set is consistent if we cannot derive false from it. For any
Gamma and P, Gamma do not derive P if and only if Gamma and NOT P
are consistent.
Lemma not_derive_spec: ∀Gamma P,
¬(Gamma ⊢ P) ↔ consistent (Gamma:; (NOT P)).
¬(Gamma ⊢ P) ↔ consistent (Gamma:; (NOT P)).
Proof.
intros.
unfold consistent.
rewrite deduction_theorem.
pose proof derive_NOT_NOT Gamma P.
unfold PNot.
unfold PNot in H.
tauto.
Qed.
intros.
unfold consistent.
rewrite deduction_theorem.
pose proof derive_NOT_NOT Gamma P.
unfold PNot.
unfold PNot in H.
tauto.
Qed.
A proposition set is satisfiable if there is an interpretation that satisfies
all propositions in the set. For any Gamma and P, P is not Gamma's
consequence if and only if Gamma and NOT P are satisfiable.
Definition satisfiable (Gamma: prop → Prop): Prop :=
∃J, ∀P, Gamma P → J ⊨ P.
Lemma not_entail_spec: ∀Gamma P,
¬(Gamma |= P) ↔ satisfiable (Gamma:; (NOT P)).
∃J, ∀P, Gamma P → J ⊨ P.
Lemma not_entail_spec: ∀Gamma P,
¬(Gamma |= P) ↔ satisfiable (Gamma:; (NOT P)).
Proof.
intros.
unfold satisfiable, entail.
split; intros.
+ apply not_all_ex_not in H.
intros.
unfold satisfiable, entail.
split; intros.
+ apply not_all_ex_not in H.
In case that you are curious about what this theorem
not_all_ex_not is:
not_all_ex_not
: ∀(U : Type) (P : U → Prop),
¬(∀n : U, P n) → ∃n : U, ¬P n
: ∀(U : Type) (P : U → Prop),
¬(∀n : U, P n) → ∃n : U, ¬P n
destruct H as [J ?].
assert ((∀Q : prop, Gamma Q → J ⊨ Q) ∧ ¬(J ⊨ P)).
{ tauto. }
clear H.
destruct H0.
∃J.
unfold pset_snoc.
intros.
destruct H1.
- apply H.
exact H1.
- subst P0.
simpl.
tauto.
+ unfold not.
intros.
destruct H as [J ?].
specialize (H0 J).
assert (∀Q : prop, Gamma Q → J ⊨ Q).
{
intros.
apply H.
unfold pset_snoc.
tauto.
}
assert (¬(J ⊨ P)).
{
assert ((Gamma:; NOT P) (NOT P)).
{ unfold pset_snoc. right. reflexivity. }
specialize (H _ H2).
simpl in H.
tauto.
}
tauto.
Qed.
assert ((∀Q : prop, Gamma Q → J ⊨ Q) ∧ ¬(J ⊨ P)).
{ tauto. }
clear H.
destruct H0.
∃J.
unfold pset_snoc.
intros.
destruct H1.
- apply H.
exact H1.
- subst P0.
simpl.
tauto.
+ unfold not.
intros.
destruct H as [J ?].
specialize (H0 J).
assert (∀Q : prop, Gamma Q → J ⊨ Q).
{
intros.
apply H.
unfold pset_snoc.
tauto.
}
assert (¬(J ⊨ P)).
{
assert ((Gamma:; NOT P) (NOT P)).
{ unfold pset_snoc. right. reflexivity. }
specialize (H _ H2).
simpl in H.
tauto.
}
tauto.
Qed.
Thus, in order to build completeness, it suffices to prove that every
consistent set is satisfiable.
Lemma proof_by_contraposition:
(∀Gamma, consistent Gamma → satisfiable Gamma) →
strongly_complete.
Proof.
intros.
unfold strongly_complete.
intros Gamma P.
assert (¬(Gamma ⊢ P) → ¬(Gamma |= P)); [| tauto].
intros.
apply not_derive_spec in H0.
apply not_entail_spec.
apply H.
exact H0.
Qed.
(∀Gamma, consistent Gamma → satisfiable Gamma) →
strongly_complete.
Proof.
intros.
unfold strongly_complete.
intros Gamma P.
assert (¬(Gamma ⊢ P) → ¬(Gamma |= P)); [| tauto].
intros.
apply not_derive_spec in H0.
apply not_entail_spec.
apply H.
exact H0.
Qed.
Henkin Style Proof and Maximal Consistent Set
Definition maximal_consistent (Gamma: prop → Prop): Prop :=
consistent Gamma ∧
(∀Gamma', pset_included Gamma Gamma' →
consistent Gamma' →
pset_included Gamma' Gamma).
consistent Gamma ∧
(∀Gamma', pset_included Gamma Gamma' →
consistent Gamma' →
pset_included Gamma' Gamma).
In a simplest Henkin style proof, MCS is enough for canonical model
construction. For first order logics's completeness, we need to use maximal
consistent set with witnesses.
Definition witnessed (Gamma: prop → Prop): Prop :=
∀(x: logical_var) (P: prop),
Gamma (EXISTS x, P) →
∃(t: term), Gamma (P [ x ⟼ t ]).
∀(x: logical_var) (P: prop),
Gamma (EXISTS x, P) →
∃(t: term), Gamma (P [ x ⟼ t ]).
Here is the proof skeleton of our Henkin style proof.
Lemma Henkin_FOL:
(∀Gamma, consistent Gamma →
∃Gamma',
maximal_consistent Gamma' ∧
witnessed Gamma' ∧
(satisfiable Gamma' → satisfiable Gamma)) →
(∀Gamma,
maximal_consistent Gamma →
witnessed Gamma →
satisfiable Gamma) →
(∀Gamma, consistent Gamma → satisfiable Gamma).
Proof.
intros.
specialize (H Gamma H1).
destruct H as [Gamma' [? [? ?]]].
specialize (H0 Gamma' H H2).
pose proof H3 H0.
exact H4.
Qed.
(∀Gamma, consistent Gamma →
∃Gamma',
maximal_consistent Gamma' ∧
witnessed Gamma' ∧
(satisfiable Gamma' → satisfiable Gamma)) →
(∀Gamma,
maximal_consistent Gamma →
witnessed Gamma →
satisfiable Gamma) →
(∀Gamma, consistent Gamma → satisfiable Gamma).
Proof.
intros.
specialize (H Gamma H1).
destruct H as [Gamma' [? [? ?]]].
specialize (H0 Gamma' H H2).
pose proof H3 H0.
exact H4.
Qed.
Lindenbaum Lemma: Constructing MCS with witness
Step 1.
Step 2.
P(1), P(2), ...
We construct
Gamma(1), Gamma(2), ...
in order. Specifically, for every natural number n, we construct Gamma(n+1)
from Gamma(n) according to the following rules:
- case a. if Gamma(n):; P(n+1) is consistent and
P(n+1) has a form of EXISTS x. Q, then
let Gamma(n+1) be Gamma(n) :; Q[x ⟼ y] :; P(n+1)
in which y is a variable that does not occur in
Gamma(n) or P(n+1).
- case b. if Gamma(n):; P(n+1) is consistent and
P(n+1) does not have a form of EXISTS x. Q, then
let Gamma(n+1) be Gamma(n):; P(n+1).
- case c. if Gamma(n):; P(n+1) is inconsistent, then let Gamma(n+1) be Gamma(n).
- Gamma(n) is consistent for all n;
- P(n) is an element of Gamma(m) if and only if P(n) is in
Gamma(n) for any n < m;
- Gamma(0) is a subset of Gamma(n) for all n.
- Suppose Gamma(n):; P(n+1) is consistent and P(n+1) = EXISTS x. Q. Prove that Gamma(n) :; Q[x ⟼ y] :; P(n+1) is also consistent in which y is a variable that does not occur in Gamma(n) or P(n+1).
Gamma(n) :; Q[x ⟼ y] :; EXISTS x. Q ⊢ PFalse.
Since ⊢ Q [x ⟼ y] IMPLY EXISTS x. Q, we have
Gamma(n) :; Q [x ⟼ y] ⊢ PFalse.
But y does not appear in Gamma(n). So,
Gamma(n) :; EXISTS y. Q [x ⟼ y] ⊢ PFalse.
It is equivalent to say:
Gamma(n) :; EXISTS x. Q ⊢ PFalse.
This contradicts with the fact that Gamma(n):; P(n+1) is consistent.
Step 3
P(n(1)) IMPLY P(n(2)) IMPLY ... IMPLY P(n(k)) IMPLY PFalse
is provable. Without loss of generality, we can assume that
n(1) < n(2) < ... < n(k).
Thus, these k propositions must all be Gamma(n(k))'s elements! So,
Gamma(n(k)) ⊢ PFalse
which contradicts with the fact that Gamma(n(k)) is consistent.
Summary
Canonical Model Construction and Truth Lemma
⊢ NOT P IMPLY P IMPLY PFalse.
On the other hand, if neither P nor NOT P is in Gamma, we know
Gamma :; P ⊢ PFalse
by the definition of maximal consistency. It tells us, P IMPLY PFalse, i.e.
NOT P, is an element of Gamma (according to the deduction theorem and the
fact that Gamma is derive-closed). This contradicts with the fact that
NOT P is not in Gamma.
- Given Gamma which is witnessed and maximally consistent, we can construct an interpretation J satisfying all propositions in Gamma.
Constructing the domain
Constructing the relation symbol's interpretation
Constructing variables' interpretation
Truth lemma
- If P1 is not an element of Gamma, NOT P1 must be an element of Gamma. Thus, P1 IMPLY P2 is also an element of Gamma.
- If P2 is an element of Gamma, obviously, P1 IMPLY P2 is also an element of Gamma.
- If P1 is an element of Gamma and P2 is not an element of Gamma, then NOT P2 must be an element of Gamma. Thus, NOT (P1 IMPLY P2) is also an element of Gamma which means P1 IMPLY P2 is not in Gamma.
( D, Rel, La [x ⟼ y*] ) |=/= P1
which tells us that J does not satisfy FORALL x. P1.
(* Mon May 6 16:26:04 UTC 2019 *)