Section RESTRICT_STRUCTURE.
#[local] Existing Instance V.vec_isSetoid.
#[local]
Instance restrict_structure (STRUCTURE : isStructureOf L') : isStructureOf L :=
{ domain_of_discourse := STRUCTURE.(domain_of_discourse)
; equation_interpret := STRUCTURE.(equation_interpret)
; function_interpret (f : L.(function_symbols)) := STRUCTURE.(function_interpret) f
; constant_interpret (c : L.(constant_symbols)) := STRUCTURE.(constant_interpret) (inl c)
; relation_interpret (R : L.(relation_symbols)) := STRUCTURE.(relation_interpret) R
; domain_is_nonempty := STRUCTURE.(domain_is_nonempty)
; function_interpret_preserves_eqProp := STRUCTURE.(function_interpret_preserves_eqProp)
; relation_interpret_preserves_eqProp := STRUCTURE.(relation_interpret_preserves_eqProp)
}.
End RESTRICT_STRUCTURE.
Fixpoint twilight_trm' (t : trm L') : trm L :=
match t with
| Var_trm x => @Var_trm L (x * 2)
| Fun_trm f ts => @Fun_trm L f (twilight_trms' ts)
| Con_trm c =>
match c with
| inl cc => @Con_trm L cc
| inr hc => @Var_trm L (hc * 2 + 1)
end
end
with twilight_trms' {n : nat} (ts : trms L' n) : trms L n :=
match ts with
| O_trms => @O_trms L
| S_trms n t ts => @S_trms L n (twilight_trm' t) (twilight_trms' ts)
end.
#[local] Hint Rewrite twilight_trm_decomposition twilight_trms_decomposition : simplication_hints.
#[local] Hint Rewrite twilight_frm_decomposition.
Fixpoint unembed_trm (t : trm L') : trm L :=
match t with
| Var_trm x => @Var_trm L x
| Fun_trm f ts => @Fun_trm L f (unembed_trms ts)
| Con_trm c =>
match c with
| inl cc => @Con_trm L cc
| inr hc => @Var_trm L hc
end
end
with unembed_trms {n : nat} (ts : trms L' n) : trms L n :=
match ts with
| O_trms => @O_trms L
| S_trms n t ts => @S_trms L n (unembed_trm t) (unembed_trms ts)
end.
Fixpoint unembed_frm (p : frm L') : frm L :=
match p with
| Rel_frm R ts => @Rel_frm L R (unembed_trms ts)
| Eqn_frm t1 t2 => @Eqn_frm L (unembed_trm t1) (unembed_trm t2)
| Neg_frm p1 => @Neg_frm L (unembed_frm p1)
| Imp_frm p1 p2 => @Imp_frm L (unembed_frm p1) (unembed_frm p2)
| All_frm y p1 => @All_frm L y (unembed_frm p1)
end.
#[local] Hint Rewrite unembed_trm_lemma unembed_trms_lemma : simplication_hints.
End SIM.
Context {enum_frm_L' : isEnumerable (frm L')}.
Fixpoint Henkin (n : nat) {struct n} : Vector.t (frm L') n -> Vector.t Henkin_constants n -> Prop :=
match n with
| O => fun thetas => fun cs => thetas = VNil /\ cs = VNil
| S n' => fun thetas => fun cs =>
let x : ivar := fst (cp n') in
let phi : frm L' := enum (snd (cp n')) in
let PROP (c : Henkin_constants) : Prop := HC_occurs_in_frm c phi = false /\ V.forallb (fun theta_k => negb (HC_occurs_in_frm c theta_k)) (V.tail thetas) = true in
V.head thetas = (Imp_frm (subst_frm (one_subst x (@Con_trm L' (inr (V.head cs)))) phi) (All_frm x phi)) /\ Henkin n' (V.tail thetas) (V.tail cs) /\ PROP (V.head cs) /\ ⟪ MIN : forall c, PROP c -> c >= V.head cs ⟫
end.
#[local] Opaque enum.
#[local] Opaque cp.
#[local] Open Scope vec_scope.
Definition nth_Henkin_axiom (n : nat) : frm L' :=
V.head (fst (proj1_sig (Henkin_exists (S n)))).
Definition nth_Henkin_constant (n : nat) : Henkin_constants :=
V.head (snd (proj1_sig (Henkin_exists (S n)))).

Lemma Henkin_constant_does_not_occur_in_enum n
: HC_occurs_in_frm (nth_Henkin_constant n) (enum (snd (cp n))) = false.