object
problog_program
Canonical ground ProbLog statement validation and source generation.
logtalk_load(problog(loader))static, context_switching_callsPublic predicates
serialize/2
Serializes a list of fully ground canonical ProbLog statements to character codes.
staticserialize(Statements,Codes)serialize(+list,-list(integer)) - one_or_errorStatements is a partial list or contains a variable:instantiation_errorStatements is not a list:type_error(list,Statements)domain_error(problog_statement,Statement)
Statements: The statement constructors are
fact(Head),rule(Head, Body),probabilistic_fact(P, Head),probabilistic_rule(P, Head, Body),annotated_disjunction(Alternatives, Body),query(Goal),evidence(Goal, Boolean),directive(Goal),comment(Codes), andraw(Codes).Heads and positive goals: Use
function(Name, Arguments); a zero-arity predicate has an empty argument list. Terms areatom(Atom),number(Number),variable(Name),anonymous, nestedfunction(Name, Arguments), properlist(Elements), improperlist(Elements, Tail), andarithmetic(Operator, Arguments). Logic variables are represented by groundvariable(Name)oranonymousnodes, preserving variable sharing without putting Prolog variables in the AST.Goals: Use
true,function(Name, Arguments),conjunction(Goals),disjunction(Goals),negation(Goal), orcomparison(Operator, Left, Right). Arithmetic operators are+,-,*,/,//,mod, and**; comparison operators are=,==,\=,\==,<,=<,>, and>=.Queries and evidence:
query(Goal)writes a native query directive;evidence(Goal, true)andevidence(Goal, false)write positive and negative evidence directives.Annotated disjunctions:
annotated_disjunction(Alternatives, Body)uses at least twoProbability-Headlist elements and writesProbability::Head; ...optionally followed by:- Body.Raw source and comments:
raw(Codes)passes trusted native source through, adding a final newline when needed.comment(Codes)emits comment lines. Both use ground character-code lists.Probabilities: Probabilities are numbers in the inclusive range [0,1]. Annotated-disjunction probabilities must sum to at most one; a residual probability is allowed.
serialize/4
Serializes statements with origins and returns generated line(Start, End, Origin) source-map entries.
staticserialize(Statements,Origins,Codes,SourceMap)serialize(+list,+list,-list(integer),-list(compound)) - one_or_errorStatements or Origins is a partial list or contains a variable:instantiation_errorStatements or Origins is not a list:type_error(list,Statements)domain_error(problog_origins,Origins)Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)