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.

Theorem mkModel_isModel (p : frm L')
(CONSISTENT : X ⊬ Bot_frm)
: p \in Delta <-> interpret_frm mkModel ivar_interpret p.