Section SIM.
#[global]
Instance constant_symbols_sim : Similarity L.(constant_symbols) L'.(constant_symbols) :=
fun c : L.(constant_symbols) => fun c' : L'.(constant_symbols) => inl c = c'.
#[global]
Instance trm_sim : Similarity (trm L) (trm L') :=
trm_similarity_instance L.(function_symbols) L.(relation_symbols) L.(function_arity_table) L.(relation_arity_table) L.(constant_symbols) (L.(constant_symbols) + Henkin_constants) constant_symbols_sim.
#[global]
Instance trms_sim (n : nat) : Similarity (trms L n) (trms L' n) :=
trms_similarity_instance L.(function_symbols) L.(relation_symbols) L.(function_arity_table) L.(relation_arity_table) L.(constant_symbols) (L.(constant_symbols) + Henkin_constants) constant_symbols_sim n.
#[global]
Instance frm_sim : Similarity (frm L) (frm L') :=
frm_similarity_instance L.(function_symbols) L.(relation_symbols) L.(function_arity_table) L.(relation_arity_table) L.(constant_symbols) (L.(constant_symbols) + Henkin_constants) constant_symbols_sim.
#[global]
Instance frms_sim : Similarity (ensemble (frm L)) (ensemble (frm L')) :=
frms_similarity_instance L.(function_symbols) L.(relation_symbols) L.(function_arity_table) L.(relation_arity_table) L.(constant_symbols) (L.(constant_symbols) + Henkin_constants) constant_symbols_sim.
Fixpoint embed_trm (t : trm L) : trm L' :=
match t with
| Var_trm x => @Var_trm L' x
| Fun_trm f ts => @Fun_trm L' f (embed_trms ts)
| Con_trm c => @Con_trm L' (inl c)
end
with embed_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 (embed_trm t) (embed_trms ts)
end.

Lemma embed_trm_unfold (t : trm L) :
embed_trm t =
match t with
| Var_trm x => @Var_trm L' x
| Fun_trm f ts => @Fun_trm L' f (embed_trms ts)
| Con_trm c => @Con_trm L' (inl c)
end.