12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152(** Symbols and signature for unification rules.
This module provides a signature to be used to handle unification rules.
The signature is not attached to any real lambdapi file and is henceforth
qualified to be a "ghost" signature. *)openCommonopenTimedopenTerm(** Path of signature containing unificaton rules symbols. *)letpath=Path.ghost"unif_rule"(** Ghost signature holding the symbols used in unification rules.
- All signatures depend on it (dependency set in
{!val:Sig_state.create_sign}).
- All signatures open it (opened in {!val:Sig_state.of_sign}).
- It is automatically loaded. *)letsign:Sign.t=letdummy=Sign.dummy()inletsign={dummywithSign.sign_path=path}inSign.loaded:=Path.Map.addpathsign!(Sign.loaded);sign(** Symbol "≡". *)letequiv:sym=letid=Pos.none"≡"inlets=Sign.add_symbolsignPublicDefinEagerfalseidmk_Kind[]inSign.add_notationsigns(Infix(Pratter.Neither,2.0));s(** Symbol ";". *)letcons:sym=letid=Pos.none";"inlets=Sign.add_symbolsignPublicConstEagertrueidmk_Kind[]inSign.add_notationsigns(Infix(Pratter.Right,1.0));s(** [unpack eqs] transforms a term of the form
[cons (equiv t u) (cons (equiv v w) ...)]
into a list [[(t,u); (v,w); ...]]. *)letrecunpack:term->(term*term)list=funeqs->matchget_argseqswith|(Symb(s),[v;w])->ifs==consthenmatchget_argsvwith|(Symb(e),[t;u])whene==equiv->(t,u)::unpackw|_->assertfalseelseifs==equivthen[(v,w)]elseassertfalse|_->assertfalse(** [mem s] is true iff [s] belongs to [sign]. *)letmem:sym->bool=funs->s==equiv||s==cons