Variable name dictionaries

Author(s): Francisco Bueno, Edison Mera.

Usage and interface

Documentation on exports

REGTYPE

Usage: null_dict(D)

  • Description: D is an empty dictionary.

PREDICATE

Usage: create_dict(Term,Dict)

  • Description: Dict has names for all variables in Term.
  • The following properties should hold at call time:
    (basic_props:term/1)Term is any term.
  • The following properties should hold upon exit:
    (vndict:varnamedict/1)Dict is a dictionary of variable names.

PREDICATE

Usage: create_pretty_dict(Term,Dict)

  • Description: Dict has names for all variables in Term. The difference with create_dict/2 is that prettier names are generated
  • The following properties should hold at call time:
    (basic_props:term/1)Term is any term.
  • The following properties should hold upon exit:
    (vndict:varnamedict/1)Dict is a dictionary of variable names.

PREDICATE

Usage: complete_dict(Dict,Term,NewDict)

  • Description: NewDict is Dict augmented with the variables of Term not yet in Dict.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Dict is currently a term which is not a free variable.
    (term_typing:nonvar/1)Term is currently a term which is not a free variable.
    (term_typing:var/1)NewDict is a free variable.

PREDICATE

Usage: complete_vars_dict(Dict,Vars,NewDict)

  • Description: NewDict is Dict augmented with the variables of the list Vars not yet in Dict.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Dict is currently a term which is not a free variable.
    (term_typing:nonvar/1)Vars is currently a term which is not a free variable.
    (term_typing:var/1)NewDict is a free variable.

PREDICATE

Usage: prune_dict(Term,Dict,NewDict)

  • Description: NewDict is Dict reduced to just the variables of Term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Term is currently a term which is not a free variable.
    (term_typing:nonvar/1)Dict is currently a term which is not a free variable.
    (term_typing:var/1)NewDict is a free variable.

PREDICATE

Usage: sort_dict(D,Dict)

  • Description: D is sorted into Dict.
  • The following properties should hold at call time:
    (vndict:varnamedict/1)D is a dictionary of variable names.
  • The following properties should hold upon exit:
    (vndict:varnamedict/1)Dict is a dictionary of variable names.

PREDICATE

Usage: dict2varnamesl(Dict,VNs)

  • Description: Translates Dict to VNs.
  • The following properties should hold at call time:
    (vndict:varnamedict/1)Dict is a dictionary of variable names.
  • The following properties should hold upon exit:
    (dict_types:varnamesl/1)VNs is a list of Name=Var pairs, where Var is a variable and Name its name.

PREDICATE

Usage: varnamesl2dict(VNs,Dict)

  • Description: Translates VNs to Dict.
  • The following properties should hold at call time:
    (dict_types:varnamesl/1)VNs is a list of Name=Var pairs, where Var is a variable and Name its name.
  • The following properties should hold upon exit:
    (vndict:varnamedict/1)Dict is a dictionary of variable names.

PREDICATE
find_name(Vars,Names,V,Name)

Given that vars_names_dict(Dict,Vars,Names) holds, it acts as rename(X,Dict), but the name of X is given as Name instead of unified with it.

PREDICATE

Usage:

  • Description: Give names to the variables in the term Term using the dictionary Dict. Intended to replace prettyvars/1 in those places where is possible to get the dictionary of variables.
  • Call and exit should be compatible with:
    (basic_props:term/1)Arg1 is any term.
    (dict_types:varnamesl/1)Arg2 is a list of Name=Var pairs, where Var is a variable and Name its name.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Arg2 is currently a term which is not a free variable.

PREDICATE

Usage: rename(Term,Dict)

  • Description: Unifies each variable in Term with its name in Dict. If no name is found, a new name is created.
  • The following properties should hold at call time:
    (vndict:varnamedict/1)Dict is a dictionary of variable names.

REGTYPE

Usage: varnamedict(D)

  • Description: D is a dictionary of variable names.

PREDICATE

Usage: vars_names_dict(Dict,Vars,Names)

  • Description: Varss is a sorted list of variables, and Names is a list of their names, which correspond in the same order.
  • Call and exit should be compatible with:
    (vndict:varnamedict/1)Dict is a dictionary of variable names.
    (basic_props:list/1)Vars is a list.
    (basic_props:list/1)Names is a list.