Section HENKIN.
#[local] Infix "=~=" := is_similar_to : type_scope.
Definition augmented_language (L : language) (constant_symbols' : Set) : language :=
{|
function_symbols := L.(function_symbols);
constant_symbols := L.(constant_symbols) + constant_symbols';
relation_symbols := L.(relation_symbols);
function_arity_table := L.(function_arity_table);
relation_arity_table := L.(relation_arity_table);
|}.
Definition Henkin_constants : Set :=
nat.
Context {L : language}.
Notation L' := (augmented_language L Henkin_constants).
Fixpoint HC_occurs_in_trm (hc : Henkin_constants) (t : trm L') : bool :=
match t with
| Var_trm x => false
| Fun_trm f ts => HC_occurs_in_trms hc ts
| Con_trm c =>
match c with
| inl cc => false
| inr hc' => Nat.eqb hc hc'
end
end
with HC_occurs_in_trms {n : nat} (hc : Henkin_constants) (ts : trms L' n) : bool :=
match ts with
| O_trms => false
| S_trms n t ts => HC_occurs_in_trm hc t || HC_occurs_in_trms (n := n) hc ts
end.
#[local] Opaque HC_occurs_in_trm HC_occurs_in_trms.
#[local] Hint Rewrite <- HC_occurs_in_trm_iff_in_accumHCs_trm HC_occurs_in_trms_iff_in_accumHCs_trms : simplication_hints.
#[local] Hint Rewrite <- HC_occurs_in_frm_iff_in_accumHCs_frm.

Lemma last_HC_for_finite_formulae (ps : list (frm L')) (hc : Henkin_constants)
: forall p : frm L', In p ps -> hc > maxs (map (maxs ∘ accum_HCs_frm)%prg ps) -> HC_occurs_in_frm hc p = false.