program_keys (library)

This module handles the format of the structures used to represent the program. It is a list of clauses, where each clause is identified by a key, and the clause body is a conjunction of literals, where each literal is also identified by a key.

When creating a new clause for a predicate H in the program, the following goal will give you a clause in the correct format:

clause_key(H,ClId), rewrite_source_clause(clause(H,Body),ClId,Clause),

Documentation on exports

Cleanups internal database.

PREDICATEclause_key/2

Usage:clause_key(H,ClId)

ClId is the clause key that an additional clause of predicate H should have.

  • The following properties should hold at call time:
    (head/1)H is a clause head identifier.
    (var/1)ClId is a free variable.
  • The following properties should hold upon exit:
    (clkey/1)ClId is an atom that uniquely identifies a program clause.

Usage:clauses_keys(H,ClIds)

ClIds are the clause keys of all clauses already known for predicate H.

  • The following properties should hold at call time:
    (cgoal/1)H is a term which represents a goal, i.e., an atom or a structure.
    (var/1)ClIds is a free variable.
  • The following properties should hold upon exit:
    (cgoal/1)H is a term which represents a goal, i.e., an atom or a structure.
    (list/2)ClIds is a list of clkeys.

No further documentation available for this predicate.

PREDICATEfirst_key/2
No further documentation available for this predicate.

PREDICATElast_clause/1

Usage:last_clause(ClId)

ClId is the clause key of the last known clause of the predicate to which it corresponds.

  • The following properties should hold at call time:
    (clkey/1)ClId is an atom that uniquely identifies a program clause.

PREDICATEmake_atom/2
No further documentation available for this predicate.

No further documentation available for this predicate.

No further documentation available for this predicate.

rewrite_source_all_clauses(Clauses,NewClauses)

NewClauses is the result of applying the format transformation to the list of clauses Clauses.

Usage:rewrite_source_clause(Clause0,ClId,Clause)

Clause is an structure representing the clause Clause0 identified by ClId (does nothing for directives).

Usage:decode_litkey(AtId,F,A,C,G)

AtId identifies the Gth literal of the body of the Cth clause of predicate F/A.

  • Call and exit should be compatible with:
    (litkey/1)AtId is an atom that uniquely identifies a program point of a program clause body literal.
    (atm/1)F is an atom.
    (num/1)A is a number.
    (num/1)C is a number.
    (num/1)G is a number.

Usage:decode_clkey(ClId,F,A,C)

ClId identifies the Cth clause of predicate F/A.

  • Call and exit should be compatible with:
    (clkey/1)ClId is an atom that uniquely identifies a program clause.
    (atm/1)F is an atom.
    (num/1)A is a number.
    (num/1)C is a number.

No further documentation available for this predicate.

Usage:decode_predkey(PredId,F,A)

PredId identifies the predicate F/A.

  • Call and exit should be compatible with:
    (predkey/1)PredId is an atom that uniquely identifies a program predicate.
    (atm/1)F is an atom.
    (num/1)A is a number.

PREDICATEis_clkey/1

Usage:is_clkey(Id)

Succeeds if Id is a valid clause identifier. The predicate name must not contain '/' characters.

  • Call and exit should be compatible with:
    (atm/1)Id is an atom.

PREDICATEis_litkey/1

Usage:is_litkey(Id)

Succeeds if Id is a valid atom identifier. The predicate name must not contain '/' characters.

  • Call and exit should be compatible with:
    (atm/1)Id is an atom.

PREDICATEis_entrykey/1

Usage:is_entrykey(Id)

Succeeds if Id is a valid entry point identifier (predkey for exported predicates, clkey for entry assertions)

  • Call and exit should be compatible with:
    (atm/1)Id is an atom.

No further documentation available for this predicate.

PREDICATEis_clause/4
No further documentation available for this predicate.

orig_clause_id(ClId,Orig_ClId)

Orig_ClId is the clause identifier resulting from replacing the name of a newly generated predicate with the name of its corresponding predicate in the original program.

PREDICATElit_ppkey/3

Usage:

  • Call and exit should be compatible with:
    (literal_ppkey/1)literal_ppkey(Arg1)
    (cgoal/1)Arg2 is a term which represents a goal, i.e., an atom or a structure.
    (litkey/1)Arg3 is an atom that uniquely identifies a program point of a program clause body literal.

Usage:clid_of_atomid(AtomId,ClId)

Returns in ClId the clause identifier corresponding to AtomId goal identifier.

  • Call and exit should be compatible with:
    (atm/1)AtomId is an atom.
    (atm/1)ClId is an atom.
  • The following properties should hold at call time:
    (nonvar/1)AtomId is currently a term which is not a free variable.
    (var/1)ClId is a free variable.

REGTYPEclause/1
Defined as:
clause(clause(Head,Body):Clid) :-
    cgoal(Head),
    clausebody(Body),
    clkey(Clid).
clause(directive(Body):Clid) :-
    clausebody(Body),
    drid(Clid).

PREDICATEclausebody/1
clausebody(Body)

Body is a conjunction of simple goals; if a goal is a meta-predicate, its meta-arguments are terms of the form '$'(Term,Body,Type), where Term is the original goal term, Type the type of meta-term as in the meta_predicate directive, and, if Type corresponds to an executable form of meta-term, Body is the clausebody that corresponds to Term.

clausebody(L) :-
    literal_ppkey(L).
clausebody((L,B)) :-
    literal_ppkey(L),
    clausebody(B).

A regular type, defined as follows:
literal_ppkey(Lit:PPKey) :-
    cgoal(Lit),
    litkey(PPKey).
literal_ppkey(builtin(B):noinfo) :-
    cgoal(B).
literal_ppkey(!).

REGTYPElitkey/1

Usage:litkey(Key)

Key is an atom that uniquely identifies a program point of a program clause body literal.

    REGTYPEclkey/1

    Usage:clkey(Id)

    Id is an atom that uniquely identifies a program clause.

      REGTYPEpredkey/1

      Usage:predkey(Id)

      Id is an atom that uniquely identifies a program predicate.

        PREDICATEcounter/3
        No further documentation available for this predicate. The predicate is of type data.

        PREDICATEget_predkey/3

        Usage:get_predkey(F,A,Key)

        Key is the key corresponding to predicate F/A

        • The following properties should hold at call time:
          (atm/1)F is an atom.
          (atm/1)A is an atom.
          (var/1)Key is a free variable.
        • The following properties should hold upon exit:
          (predkey/1)Key is an atom that uniquely identifies a program predicate.

        Usage:get_predkeys(Preds,Keys)

        Keys is the list of atoms obtained from Preds.

        • The following properties should hold at call time:
          (list/1)Preds is a list.
        • The following properties should hold upon exit:
          (list/2)Keys is a list of predkeys.

        Usage:predkey_from_sg(Sg,Key)

        Key is the key corresponding to functor Sg

        • The following properties should hold at call time:
          (term/1)Sg is any term.
          (var/1)Key is a free variable.
        • The following properties should hold upon exit:
          (predkey/1)Key is an atom that uniquely identifies a program predicate.

        PREDICATEget_clkey/4

        Usage:get_clkey(F,A,Cl,ClKey)

        ClKey is the key corresponding to clause F/A/Cl

        • The following properties should hold at call time:
          (atm/1)F is an atom.
          (atm/1)A is an atom.
          (atm/1)Cl is an atom.
          (var/1)ClKey is a free variable.
        • The following properties should hold upon exit:
          (clkey/1)ClKey is an atom that uniquely identifies a program clause.

        PREDICATEget_litkey/5

        Usage:get_litkey(F,A,Cl,Lit,ClKey)

        ClKey is the key corresponding to clause F/A/Cl/Lit

        • The following properties should hold at call time:
          (atm/1)F is an atom.
          (atm/1)A is an atom.
          (atm/1)Cl is an atom.
          (atm/1)Lit is an atom.
          (var/1)ClKey is a free variable.
        • The following properties should hold upon exit:
          (litkey/1)ClKey is an atom that uniquely identifies a program point of a program clause body literal.

        Documentation on internals

        PREDICATEbody/1
        body(Body)

        Body is a conjunction of simple goals:

        body((G,B)) :-
            cgoal(G),
            body(B).
        body(G) :-
            cgoal(G).
        

        REGTYPEdrid/1

        Usage:drid(Id)

        Id is a number that uniquely identifies a program directive.

          REGTYPEhead/1
          Defined as
          head(0).
          head(1).
          head(X) :-
              cgoal(X).
          

          Usage:head(Head)

          Head is a clause head identifier.

            Documentation on imports

            This module has the following direct dependencies: