Stability: [beta] Most of the functionality is there but it is still missing some testing and/or verification.
This module implements the abstract operations of a simple groundness domain for the PLAI framework of abstract interpretation. An abstract substitution is a list of Var/Mode elements, where Var is a variable and Mode is any, g or ng.
The abstract domain lattice is:
any / \ / \ (ground) g ng (not ground) \ / \ / $bottom
Usage:unknown_entry(Sg,Qv,Call)
Gives the top value for the variables involved in a literal whose definition is not present, and adds this top value to Call. In this domain the top value is X/any forall X in the set of variables.
Usage:empty_entry(Sg,Vars,Entry)
Gives the empty value in this domain for a given set of variables Vars, resulting in the abstract substitution Entry. I.e., obtains the abstraction of a substitution in which all variables Vars are unbound: free and unaliased. In this domain the empty value is equivalent to the unknown value.
Usage:abs_sort(Asub,Asub_s)
It sorts the set of X/Value in Asub obtaining Asub_s.
Usage:project(Sg,Vars,HvFv_u,Asub,Proj)
Proj is the result of eliminating from Asub all X/Value such that X is not in Vars. HvFv_u may be a list or 'not_provided_HvFv_u'. This predicate may be used with Proj instantiated, see call_to_success_builtin/6.
Usage:call_to_entry(Sv,Sg,Hv,Head,K,Fv,Proj,Entry,ExtraInfo)
It obtains the abstract substitution Entry which results from adding the abstraction of the Sg = Head to Proj, later projecting the resulting substitution onto Hv + Fv. This is done as follows:
Usage:exit_to_prime(Sg,Hv,Head,Sv,Exit,ExtraInfo,Prime)
It computes the prime abstract substitution Prime, i.e. the result of going from the abstract substitution over the head variables Exit, to the abstract substitution over the variables in the subgoal. It will:
Usage:compute_lub(ListASub,Lub)
It computes the least upper bound of a set of abstract substitutions. For each two abstract substitutions ASub1 and ASub2 in ListASub, obtaining the lub is just:
foreach X/Value1 in ASub1 and X/Value2 in ASub2:
Usage:extend(Sg,Prime,Sv,Call,Succ)
If Prime = $bottom, Succ = $bottom. If Sv = [], Call = Succ. Otherwise, Succ is computed updating the values of Call with those in Prime.
Usage:call_to_success_fact(Sg,Hv,Head,K,Sv,Call,Proj,Prime,Succ)
Specialized version of call_to_entry/9 + exit_to_prime/7 + extend/5 for facts.
Usage:special_builtin(Pred,Sg,Subgoal,Type,Condvars)
Satisfied if the builtin does not need a very complex action. It divides builtins into groups determined by the flag returned in the second argument + some special handling for some builtins:
Usage:success_builtin(Type,Sv_u,Condv,HvFv_u,Call,Succ)
Obtains the success for some particular builtins:
Usage:call_to_success_builtin(SgKey,Sg,Sv,Call,Proj,Succ)
Handles those builtins for which computing Proj is easier than Succ.
Usage:input_user_interface(InputUser,Qv,ASub,Sg,MaybeCallASub)
Obtains the abstract substitution for gr from the native properties found in the user supplied info.
Usage:asub_to_native(ASub,Qv,OutFlag,ASub_user,Comps)
The user friendly format consists in extracting the ground variables and the nonground variables.
Usage:unknown_call(Sg,Vars,Call,Succ)
Gives the top value for the variables involved in a literal whose definition is not present, and adds this top value to Call.
Usage:less_or_equal(ASub0,ASub1)
Succeeds if ASub1 is more general or equal to ASub0. It's assumed the two abstract substitutions are defined on the same variables.
Usage:glb(ASub0,ASub1,Glb)
Glb is the great lower bound of ASub0 and ASub1.
Usage:asub(A)
A is a well-formed abstract substitution of the gr domain.
Usage:asub_elem(E)
E is a single substitution.
Usage:gr_mode(M)
M is g (ground), ng (nonground), or any.
Usage:binds(B)
B is a list of bindings.
Usage:binding(B)
B is a triple (X,Term,Vars), where X is a variable, Term is a term and Vars is the set of variables in Term.