Section UNION.
Variable f : nat -> ensemble (frm L).
Definition union_f : ensemble (frm L) :=
fun p => exists n, p \in f n.
Hypothesis incl : forall n1 : nat, forall n2 : nat, forall LE : n1 <= n2, f n1 \subseteq f n2.
Hypothesis equiconsistent : forall n : nat, inconsistent (f n) <-> inconsistent (f (S n)).
End UNION.
#[local] Hint Resolve fact1_of_1_2_8 fact2_of_1_2_8 fact3_of_1_2_8 fact4_of_1_2_8 fact5_of_1_2_8 lemma1_of_1_2_11 : core.
Context {enum_frm_L : isEnumerable formula}.
#[global]
Instance LindenbaumBooleanAlgebra : isCBA formula (SETOID := formula_isSetoid) :=
{ CBA_isBA := formula_isBA
; CBA_satisfiesBooleanAlgebraLaws := LBA_satisfiesBooleanAlgebraLaws
; CBA_countable := enum_frm_L
}.
Fixpoint axiom_set (X : ensemble formula) (n : nat) {struct n} : ensemble formula :=
match n with
| O => X
| S n => E.union (axiom_set X n) (insertion (improveFilter (Th X) n) n)
end.
Proof with eauto with *.
revert X; induction n as [ | n IH]; [reflexivity | intros X b].
simpl. unfold Insertion. rewrite cl_eq_Th, IH. split; intros b_in.
- rewrite <- cl_eq_Th. rewrite <- cl_eq_Th in b_in. revert b b_in.
change ((cl (E.union (Th (axiom_set X n)) (insertion (Th (axiom_set X n)) n))) \subseteq (cl (E.union (axiom_set X n) (insertion (Th (axiom_set X n)) n)))).
transitivity (cl (cl (E.union (axiom_set X n) (insertion (Th (axiom_set X n)) n)))).
+ eapply fact4_of_1_2_8. intros b [b_in | b_in].
* rewrite <- cl_eq_Th in b_in. revert b b_in. eapply fact4_of_1_2_8. ii; left...
* rewrite cl_eq_Th. econstructor. eapply ByAssumption. right...
+ eapply fact5_of_1_2_8...
- rewrite <- cl_eq_Th. rewrite <- cl_eq_Th in b_in. revert b b_in.
eapply fact4_of_1_2_8. intros b [b_in | b_in].
+ left. econstructor. eapply ByAssumption...
+ right...
Qed.
Proof with eauto with *.
split.
- do 2 rewrite inconsistent_iff. intros INCONSISTENT. eapply extend_infers... done!.
- do 2 rewrite inconsistent_iff. do 2 rewrite <- in_Th_iff. intros INCONSISTENT.
rewrite <- lemma1_of_1_3_9 in *. pose proof (lemma2_of_1_2_13 (Th X)) as claim. eapply fact5_of_1_2_8.
+ eapply @lemma1_of_1_2_11 with (CBA := LindenbaumBooleanAlgebra). eapply lemma1_of_1_3_8.
+ rewrite cl_eq_Th. rewrite in_Th_iff. rewrite <- inconsistent_iff. rewrite inconsistent_okay. rewrite cl_eq_Th.
enough (WTS : inconsistent' (improveFilter (Th X) n)).
{ eapply inconsistent_compatWith_isSubsetOf... ii. rewrite in_Th_iff. eapply ByAssumption... }
eapply claim with (n2 := S n).
* eapply lemma1_of_1_3_8.
* enough (INFERS : improveFilter (Th X) (S n) ⊢ Bot_frm).
{ rewrite <- inconsistent_iff in INFERS. rewrite inconsistent_okay in INFERS.
eapply inconsistent_compatWith_isSubsetOf with (X := cl (improveFilter (Th X) (S n)))...
eapply fact5_of_1_2_8... eapply @lemma1_of_1_2_11 with (CBA := LindenbaumBooleanAlgebra). eapply lemma1_of_1_3_8.
}
simpl in INCONSISTENT. rewrite cl_eq_Th in INCONSISTENT. rewrite in_Th_iff in INCONSISTENT. simpl.
eapply extend_infers...
Qed.
Definition MaximallyConsistentSet (X : ensemble formula) : ensemble formula :=
completeFilterOf (Th X).
Definition full_axiom_set (X : ensemble formula) : ensemble formula :=
union_f (axiom_set X).
Proof with eauto with *.
revert X FINITE_SUBSET. induction xs as [ | x xs IH]; simpl; ii.
- exists 0. tauto.
- assert (claim1 : forall z : formula, In z xs -> z \in full_axiom_set X) by now firstorder.
assert (claim2 : x \in full_axiom_set X) by now firstorder.
destruct claim2 as [n IN].
assert (claim3 : x \in improveFilter (Th X) n).
{ eapply lemma1_of_1_3_9. econstructor. eapply ByAssumption... }
pose proof (IH X claim1) as [m claim4].
assert (m <= n \/ n <= m) as [m_le_n | n_lt_m] by lia.
+ exists n. intros z [x_eq_z | z_in_xs].
{ subst z... }
{ eapply lemma1_of_1_2_12... }
+ exists m. intros z [x_eq_z | z_in_xs].
{ subst z. eapply lemma1_of_1_2_12... }
{ eapply claim4... }
Qed.

Lemma lemma3_of_1_3_9 (X : ensemble formula)
: Th (full_axiom_set X) \subseteq MaximallyConsistentSet X.