Section MODEL_EXISTENCE.
Variable X : ensemble (frm L).
Let Delta : ensemble (frm L') :=
MaximallyConsistentSet (AddHenkin (E.image embed_frm X)).
Let D : Type :=
trm L'.
Definition interpret_equation (lhs : D) (rhs : D) : Prop :=
Delta ⊢ Eqn_frm lhs rhs.
#[global]
Instance interpret_equation_Equivalence
: Equivalence interpret_equation.
Proof with eauto.
unfold interpret_equation. split.
- intros x. eapply proves_reflexivity...
- intros x y EQ. eapply proves_symmetry...
- intros x y z EQ EQ'. eapply proves_transitivity...
Qed.
#[local, program]
Instance mkModel : isStructureOf L' :=
{ domain_of_discourse := D
; equation_interpret := {| eqProp := interpret_equation; eqProp_Equivalence := interpret_equation_Equivalence |}
; function_interpret f vs := Fun_trm f (vec_to_trms vs)
; constant_interpret c := Con_trm c
; relation_interpret R vs := Delta ⊢ Rel_frm R (vec_to_trms vs)
}.
Next Obligation.
econs. exact (Var_trm 0).
Qed.
Next Obligation.
red. eapply proves_eqn_fun. eapply pairwise_equal_intro; trivial.
Qed.
Next Obligation.
split; intros INFERS.
- eapply for_Imp_E. eapply proves_eqn_rel. 2: exact INFERS. eapply pairwise_equal_intro; trivial.
- eapply for_Imp_E. eapply proves_eqn_rel. 2: exact INFERS. eapply pairwise_equal_symmetry; eapply pairwise_equal_intro; trivial.
Qed.
Definition ivar_interpret : ivar -> domain_of_discourse :=
Var_trm.
Proof with eauto with *.
exploit (@theorem_of_1_2_14 (frm L') (@formula_isSetoid L') LindenbaumBooleanAlgebra (Th (AddHenkin (E.image embed_frm X)))).
{ eapply lemma1_of_1_3_8. }
intros [SUBSET' IS_FILTER' COMPLETE' EQUICONSISTENT']. fold (MaximallyConsistentSet (AddHenkin (E.image embed_frm X))) in SUBSET', IS_FILTER', COMPLETE', EQUICONSISTENT'.
fold Delta in SUBSET', IS_FILTER', COMPLETE', EQUICONSISTENT'.
pose proof (theorem_of_1_3_10 X) as [? ? ? ? ? ?]. fold Delta in SUBSET, EQUICONSISTENT, CLOSED_infers, META_DN, IMPLICATION_FAITHFUL, FORALL_FAITHFUL. unnw.
assert (CONSISTENT' : Delta ⊬ Bot_frm).
{ intros INCONSISTENT.
assert (claim1 : ~ inconsistent' Delta).
{ red in EQUICONSISTENT'. rewrite <- EQUICONSISTENT'. rewrite <- cl_eq_Th. rewrite <- inconsistent_okay. rewrite <- AddHenkin_equiconsistent.
- rewrite <- similar_equiconsistent with (Gamma := X).
+ rewrite inconsistent_iff; trivial.
+ rewrite <- embed_frms_spec. reflexivity.
- ii. rewrite E.in_image_iff in H. destruct H as [q [-> IN]]. eapply embed_frm_HC_free.
}
contradiction claim1. rewrite <- inconsistent_iff in INCONSISTENT.
rewrite inconsistent_okay in INCONSISTENT. eapply inconsistent_compatWith_isSubsetOf... eapply fact5_of_1_2_8...
}
rewrite CLOSED_infers. pattern p. revert p. eapply @frm_depth_lt_ind. intros [R ts | t1 t2 | p1 | p1 p2 | y p1]; simpl; i.
- rewrite interpret_trms_MkModel_ivar_interpret. reflexivity.
- do 2 rewrite interpret_trm_MkModel_ivar_interpret. reflexivity.
- rewrite <- IH with (p' := p1). 2: lia. split.
+ intros INFERS1 INFERS2. contradiction CONSISTENT'.
eapply ContradictionI with (A := p1); trivial.
+ intros NO. eapply NNPP. intros CONTRA. contradiction NO.
rewrite <- CLOSED_infers. eapply META_DN. intros INFERS. rewrite CLOSED_infers in INFERS. contradiction.
- rewrite <- IH with (p' := p1). 2: lia. rewrite <- IH with (p' := p2). 2: lia. split.
+ intros INFERS1 INFERS2. eapply ImplicationE with (A := p1); trivial.
+ intros INFERS. rewrite <- CLOSED_infers. eapply IMPLICATION_FAITHFUL. do 2 rewrite CLOSED_infers; trivial.
- unfold D. split.
+ intros INFERS t. rename y into x. set (s := one_subst x t).
assert (IFF : interpret_frm mkModel ivar_interpret (subst_frm s p1) <-> interpret_frm mkModel (upd_env x t ivar_interpret) p1).
{ rewrite <- substitution_lemma_frm. eapply interpret_frm_ext. ii. unfold compose, upd_env, s, one_subst, cons_subst, nil_subst.
destruct (eq_dec z x) as [EQ1 | NE1]; trivial. eapply interpret_trm_MkModel_ivar_interpret.
}
rewrite <- IFF. rewrite <- IH with (p' := subst_frm s p1). 2: rewrite subst_preserves_rank; lia.
unfold s. eapply for_All_E; trivial.
+ intros INTERPRET. rewrite <- CLOSED_infers. eapply FORALL_FAITHFUL.
intros t. eapply CLOSED_infers. rewrite -> IH with (p' := subst_frm (one_subst y t) p1). 2: rewrite subst_preserves_rank; lia.
rewrite <- substitution_lemma_frm. eapply interpret_frm_ext with (env' := upd_env y (interpret_trm mkModel ivar_interpret t) ivar_interpret). ii. unfold compose, upd_env, one_subst, cons_subst, nil_subst.
destruct (eq_dec z y) as [EQ1 | NE1]; trivial. eapply INTERPRET.
Qed.
End MODEL_EXISTENCE.
#[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.

Theorem HilbertCalculus_complete (X : ensemble (frm L)) (b : frm L)
(CONSEQUENCE : X ⊨ b)
: X ⊢ b.