Knowledge of Uncertain Worlds: Programming with Logical Constraints

10/23/2019 ∙ by Yanhong A. Liu, et al. ∙ 0

Programming with logic for sophisticated applications must deal with recursion and negation, which have created significant challenges in logic, leading to many different, conflicting semantics of rules. This paper describes a unified language, DA logic, for design and analysis logic, based on the unifying founded semantics and constraint semantics, that support the power and ease of programming with different intended semantics. The key idea is to provide meta constraints, support the use of uncertain information in the form of either undefined values or possible combinations of values, and promote the use of knowledge units that can be instantiated by any new predicates, including predicates with additional arguments.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Programming with logic has allowed many design and analysis problems to be expressed more easily and clearly at a high level. Examples include problems in program analysis, network management, security frameworks, and decision support. However, when sophisticated problems require reasoning with negation and recursion, possibly causing contradiction in cyclic reasoning, programming with logic has been a challenge. Many languages and semantics have been proposed, but they have different, conflicting underlying assumptions that are subtle and do not work for all problems.

This paper describes a unified language, DA logic, for design and analysis logic, for programming with logic using logical constraints. It supports logic rules with unrestricted negation in recursion, as well as unrestricted universal and existential quantification. It is based on the unifying founded semantics and constraint semantics, and it supports the power and ease of programming with different intended semantics without causing contradictions in cyclic reasoning.

  • The language provides meta-constraints on predicates. These meta-constraints capture the different underlying assumptions of different logic language semantics.

  • The language supports the use of uncertain information in the results of different semantics, in the form of either undefined values or possible combinations of values.

  • The language further supports the use of knowledge units that can be instantiated by any new predicates, including predicates with additional arguments.

Together, the language allows complex problems to be expressed clearly and easily, where different assumptions can be easily used, combined, and compared for expressing and solving a problem modularly, unit by unit.

We present examples from different games that show the power and ease of programming with DA logic.

2 Need of easier programming with logic

We discuss the challenges of understanding and programming with negation and recursion. We use a small well-known example, the win-not-win game, for illustration.

Consider the following rule, called the win rule. It says that x is a winning position if there is a move from x to y and y is not a winning position.

win(x) \(\leftarrow\) move(x,y) \(\land\) \(\neg\) win(y).

This seems to be a reasonable rule, because it captures the rule for winning for many games, including in chess for the King to not be captured, giving winning, losing, and draw positions. However, there could be potential problems. For example if there is a move(1,1) for some position 1, then the win rule would imply: win(1) if not win(1), and thus the truth value of win(1) becomes unclear.

Inductive definitions. 

Instead of the single win rule, one could use the following three rules to determine the winning, losing, and draw positions.

win(x) \(\leftarrow\) \(\exists\) y | move(x,y) \(\land\) lose(y).
lose(x) \(\leftarrow\) \(\forall\) y | \(\neg\) move(x,y) \(\lor\) win(y).
draw(x) \(\leftarrow\) \(\neg\) win(x) \(\land\) \(\neg\) lose(x).
The first two rules form inductive definitions [HDCD10, DVdHJD15], avoiding the potential problems of the single win rule. The base case is the set of positions that have no moves to any other position and thus are losing positions. With winning and losing positions defined, the draw positions are those in cycles of moves that have no moves to losing positions.

However, clearly, these rules are much more cumbersome than the single win rule.

Well-founded semantics. 

Indeed, with well-founded semantics (WFS) [VRS91], which computes a 3-valued model, the single win rule above gives win(x) being True, False, or Unknown for each x, corresponding to x being a winning, losing, or draw position, respectively. However, win(x) being 3-valued does not allow the three outcomes to be used as three predicates or sets for further computation; the three predicates defined by the three rules do allow this.

For example, there is no way to use the Unknown positions explicitly, say to find all reachable nodes following another kind of moves from draw positions. One might try to do it by adding two additional rules to the single win rule:

lose(x) \(\leftarrow\) \(\neg\) win(x)
draw(x) \(\leftarrow\) \(\neg\) win(x) \(\land\) \(\neg\) lose(x)
However, the result is that draw(x) is False for all positions that win(x) is True or False, and is Unknown for all draw positions.

Stable model semantics. 

Stable model semantics (SMS) [GL88] computes a set of 2-valued models, instead a single 3-valued model. It has been used for solving many constraint problems in answer set programming (ASP), because its set of 2-valued models can provide the set of satisfying solutions.

For example, for the singl win rule, if besides winning and losing positions, there is a separate cycle of even length, say move(1,2) and move(2,1), then instead of win being Unknown for 1 and 2 as in WFS, SMS returns two models: one with win being True for 1 and other winning positions but not 2, and one with win being True for 2 and other winning positions but not 1. This is a very different interpretation of the win-not-win rule.

However, for the single rule above, when there are draw positions, SMS may also return just an empty set, that is, a set with no models at all. For example, if besides winning and losing positions, there is a separate cycle of moves of odd length, say simply

move(1,1), then SMS returns simply the empty set. This is clearly undesired for the win-not-win game.

Founded semantics and constraint semantics. 

Founded semantics and constraint semantics [LS18] unify different prior semantics. It allows different underlying assumptions to be specified for each predicate, and computes the desired semantics as a simple least fixed point to return a 3-valued model and, if there are undefined values, as constraint solving to return a set of 2-valued models.

For the win-not-win game, one can write the single win rule, with the default assumption that win is complete, that is, the win rule is the only rule that infers win, which is an implicit assumption underlying WFS and SMS.

  • With founded semantics, the three rules that use inductive definitions can be automatically derived, and True, False, and Undefined positions for win are inferred, corresponding to the three predicates from inductive definitions and the 3-valued results from WFS.

  • Then constraint semantics, if desired, computes all combinations of True and False values for the Undefined values for the draw positions, that satisfy all the rules as constraints. It equals SMS for the single win rule.

Both WFS and SMS also assume that if nothing is said about some p, then p is false. When this is not desired, some programming tricks are used to get around it. For example, with SMS, to allow p to be possibly true in some models, one can introduce some new q and two new rules as below, to make it possible that, in some models, p is true and q is false.

p \(\leftarrow\) \(\neg\) q
q \(\leftarrow\) \(\neg\) p
Founded semantics and constraint semantics allow p to be simply declared as uncertain.

Both WFS and SMS also assume that if all ways that can infer p require using p in the condition of some rule, then p is false. Founded semantics and constraint semantics allow this reasoning to be used where desired, by applying it if p is declared as closed.

Founded semantics and constraint semantics also allow unrestricted universal and existential quantifications and unrestricted nesting of Boolean conditions; these are not supported in WFS and SMS.

However, founded semantics and constraint semantics alone do not address how to use different semantics seamlessly in a single logic program.

Programming with logical constraints. 

Because different assumptions and semantics help solve different problems or different parts of a problem, easier programming with logic requires supporting all assumptions and semantics in a simple and integrated design.

This paper treats different assumptions as different meta-constraints for expressing a problem or parts of a problem, and support results from different semantics to be used easily and directly. For the win-not-win example:

  • We name the positions for which win is true, false, and undefined in founded semantics using three predicates, win.T, win.F, and win.U, corresponding exactly to the inductively defined win, lose, and draw. These predicates can be used explicitly and directly for further reasoning, unlike with the truth values of WFS or founded semantics.

  • We let CS be the constraint semantics of a set of rules and facts. For m CS, we use m.win(x) to denote the truth value of win(x) in model m. Predicate CS(m) means exactly m CS and can be used directly for further reasoning, unlike the set of models in SMS or constraint semantics.

Table 1 summarizes the meta-constraints that can be used to express different assumptions, corresponding declarations and resulting predicates in founded semantics and constraint semantics, and corresponding other prior semantics if all predicates use the same meta-constraint. Columns 2 and 4 are presented and proved in our prior work [LS18]. Columns 1 and 3 are introduced in DA logic.

More fundamentally, we must enable easy specification of problems with reusable parts and where different parts may use different assumptions and semantics. To that end, we support instantiation and re-use of existing parts, and allow predicates in any existing parts to be bound to other given predicates, including predicates with additional arguments.

Even with all this power, DA logic is decidable, because it does not include function symbols and is over finite domains.

Meta-constraint Founded/Constraint Semantics Other Prior Semantics
on predicate Declarations on Resulting predicates
certain() certain .T, .F Stratified (Perfect,
Inductive Definition)
open() uncertain,
not complete
.T, .F, .U
. for .CS
First-Order Logic
complete() uncertain,
complete
as above
Fitting (Kripke-Kleene)
Supported
closed() uncertain,
complete, closed
as above
WFS
SMS
Table 1: Meta constraints and corresponding prior semantics.

3 DA logic

This section presents the syntax and informal meaning of DA logic, for design and analysis logic. The constructs described in the paragraphs on “Conjunctive rules with unrestricted negation”, “Disjunction”, and “Quantification” appear in our prior work on founded semantics and constraint semantics [LS18]. The other features are new.

Knowledge unit. 

A program is a set of knowledge units. A knowledge unit, abbreviated as kunit, is a set of rules, facts, and meta-constraints, defined below. The definition of a kunit has the following form, where is the name of the kunit, and is a set of rules, facts, meta-constraints, and instantiations of other kunits:

kunit \(K\):
  \(body\)
The scope of a predicate is the kunit in which it appears. Predicates with the same name, but appearing in different kunits, are distinct.

Example.  A kunit for the single win rule is

kunit win_unit:
  win(x) \(\leftarrow\) move(x,y) \(\land\) \(\neg\) win(y).

Kunits provide structure and allow knowledge to be re-used in other contexts by instantiation, as described below.

Conjunctive rules with unrestricted negation. 

We first present a simple core form of logic rules and then describe additional constructs that can appear in rules. The core form of a rule is the following, where any may be preceded with :

(1)

and the are predicates, each argument and is a constant or a variable, and each variable in the arguments of must also be in the arguments of some . In arguments of predicates in example programs, we use numbers for constants and letters for variables.

If , there is no or , and each must be a constant, in which case is called a fact. For the rest of the paper, “rule” refers only to the case where , in which case the left side of the backward implication is called the conclusion, the right side is called the body, and each conjunct in the body is called a hypothesis.

These rules have the same syntax as in Datalog with negation, but are used here in a more general setting, because variables can range over complex values, such as constraint models, as described below.

Predicates as sets. 

We use a syntactic sugar in which a predicate is also regarded as the set of such that holds. For example, we may write move = {(1,2), (1,3)} instead of the facts move(1,2) and move(1,3); to ensure the equality holds, this shorthand is used only when there are no other facts or rules defining the predicate.

Disjunction. 

The hypotheses of a rule may be combined using disjunction as well as conjunction. Conjunction and disjunction may be nested arbitrarily.

Quantification. 

Existential and universal quantifications in the hypotheses of rules are written using the following notations:

  existential quantification
  universal quantification
(2)

In quantifications of this form, the domain of each quantified variable is the set of all constants in the containing kunit. As syntactic sugar, a domain can be specified for a quantified variable, using a unary predicate regarded as a set. For example, x win | move(x,x) is syntactic sugar for x | win(x) move(x,x), and x in win | move(x,x) is syntactic sugar for x | win(x) move(x,x).

Meta-constraints. 

Assumptions about predicates are indicated in programs using the meta-constraints in the first column of Table 1. Each meta-constraint specifies the declarations listed in the second column of Table 1. For example, if a kunit contains open(), we say that is declared uncertain and incomplete in that kunit. In each kunit, at most one meta-constraint may be given for each predicate.

A predicate declared certain means that each assertion of the predicate has a unique true () or false () value. A predicate declared uncertain means that each assertion of the predicate has a unique true, false, or undefined () value. A predicate declared complete means that all rules with that predicate in the conclusion are given in the containing kunit. A predicate declared closed means that an assertion of the predicate is made false, called self-false, if inferring it to be true using the given rules and facts requires assuming itself to be true.

A predicate in the conclusion of a rule is said to be defined using the predicates or their negation in the hypotheses of the rule, and this defined-ness relation is transitive. A predicate must be declared uncertain (using one of the corresponding meta-constraints) if it is defined transitively using its own negation, or is defined using an uncertain predicate; otherwise, it may be declared certain or uncertain and is by default certain. A predicate may be declared complete or not only if it is uncertain, and it is by default complete. If a meta-constraint is not given for a predicate, these default declarations apply.

Using kunits with instantiation. 

The body of a kunit can use another kunit using an instantiation of the form:

(3)

This has the same effect as applying the following substitution to the body of and inlining the result in the body of : for each in , replace each occurrence of predicate with . Note that arguments of specified in the use construct are appended to the argument list of each occurrence of in , hence the number of such arguments must be . The check for having at most one meta-constraint per predicate, and the determination of default declarations, are performed after expansion of all use constructs. A kunit has a use-dependency on kunit if uses . The use-dependency relation must be acyclic.

Example.  For the example kunit win_unit given earlier in this section, the following kunit is an instantiation of the win-not-win game with different predicates for moving and winning:

kunit win2_unit:
  use win_unit (move = move2, win = win2)

In some logic programming languages, including our prior work on founded semantics [LS18], a program is an unstructured set of rules and facts. The structure and re-use provided by kunits is vital for development of larger programs for practical applications.

Referencing founded semantics. 

The founded semantics of a predicate can be referenced using special predicates , , and . For each of the three truth values , is true if has truth value , and is false otherwise. To ensure that the semantics of is fully determined before these predicates are used, these predicates cannot be used in rules defining or any predicate on which depends. Predicates that reference founded semantics are implicitly declared certain and can appear only in rule bodies.

When referencing the undefined part of a predicate, it is sometimes desirable to prune uninteresting values. For example, consider the rule draw(x) win.U(x). If the kunit contains constants representing players as well as positions, and win() is undefined when is a player, and the user wants draw to hold only for positions, then the user could add to the rule an additional hypothesis position(x), defined to hold only for positions.

Referencing constraint semantics. 

The constraint semantics of a kunit can be referenced in another kunit using the special predicate , where is the name of another kunit in the program. Using this special predicate in any rule in has the effect of adding all of the constraint models of to the domain (that is, set of constants) of . In other words, the possible values of variables in include the constraint models of . The assertion is true when is a constraint model of and is false for all other constants. The constraint models of a kunit can be referenced using only if does not reference its own founded semantics (using predicates such as ). When the value of a variable is a constraint model of , a predicate of can be accessed using the notation . If the value of is not a constraint model, or is not a predicate defined in that constraint model, then is undefined, regardless of the arguments. Predicates that reference constraint semantics are implicitly declared certain and can appear only in rule bodies. A kunit has a CS-dependency on another kunit if uses . The CS-dependency relation must be acyclic.

4 Formal definition of semantics of DA logic

This section extends the definitions of founded semantics and constraint semantics in [LS18] to handle the new features of DA logic.

Handling kunits is relatively straightforward. Since each kunit defines a distinct set of predicates, the founded semantics of the program is simply a collection of the founded semantics of its kunits, and similarly for the constraint semantics. All use constructs in a kunit are expanded, as described in Section 3, before considering its semantics. Therefore, the constants, facts, rules, and meta-constraints of a kunit include the corresponding elements (appropriately instantiated) of the kunits it uses.

Handling references to founded semantics and constraint semantics requires changes in the definitions of domain, literal, interpretation, and dependency graph.

Handling disjunction, which is mentioned as an extension in [LS18] but not considered in the detailed definitions, requires changes in the definition of completion rules and the handling of closed predicates.

The paragraphs “Founded semantics of DA logic without closed declarations”, “Least fixed point”, and “Constraint semantics of DA logic” are essentially the same as in [LS18]; they are included for completeness.

Atoms, literals, and projection. 

Let be a program. Let be a kunit in . A predicate is intensional in if it appears in the conclusion of at least one rule in ; otherwise, it is extensional in . The domain of is the set of constants in plus, for each kunit such that appears in , the constraint models of , computed as defined below. The requirement that the CS-dependency relation is acyclic ensures the constraint models of are determined before the semantics of is considered.

An atom of is a formula formed by applying a predicate in with arity to constants in the domain of . A literal of is a formula of the form or , for any atom of where is a predicate that does not reference founded semantics or constraint semantics. These are called positive literals and negative literals for , respectively. A set of literals is consistent if it does not contain positive and negative literals for the same atom. The projection of a kunit onto a set of predicates, denoted , contains all facts of for predicates in and all rules of whose conclusions contain predicates in .

Interpretations, ground instances, models, and derivability. 

An interpretation of is a consistent set of literals of . Interpretations are generally 3-valued. For predicates that does not reference founded or constraint semantics, is true () in if contains , is false () in if contains , and is undefined () in if contains neither nor . For the predicates that reference founded semantics, for each of the three truth values , is true in if has truth value in , and is false otherwise. For the predicates that reference constraint semantics, is true in if is a constraint model of , as defined below, and is false otherwise; the requirement that the CS-dependency relation is acyclic ensures that the constraint models of are determined before the semantics of is considered. If is a constraint model that provides a truth value for , then has the same truth value in that has in , otherwise it is undefined. An interpretation of is 2-valued if every atom of is true or false in , that is, no atom is undefined. Interpretations are ordered by set inclusion .

A ground instance of a rule is any rule that can be obtained from by expanding universal quantifications into conjunctions over all constants in the domain, instantiating existential quantifications with constants, and instantiating the remaining variables with constants. An interpretation is a model of a kunit if it contains all facts in the kunit and satisfies all rules of the kunit, interpreted as formulas in 3-valued logic [Fit85], that is, for each ground instance of each rule, if the body is true, then so is the conclusion. A collection of interpretations, one per kunit in a program , is a model of if each interpretation is a model of the corresponding kunit.

The one-step derivability operator performs one step of inference using rules of , starting from a given interpretation. Formally, iff is a fact of or there is a ground instance of a rule in with conclusion such that the body of is true in .

Dependency graph. 

The dependency graph of kunit is a directed graph with a node for each predicate of that does not reference founded semantics and constraint semantics (including these predicates is unnecessary, because they cannot appear in conclusions), and an edge from to labeled (respectively, ) if a rule whose conclusion contains has a positive (respectively, negative) hypothesis that contains . If the node for predicate is in a cycle containing only positive edges, then has circular positive dependency in ; if it is in a cycle containing a negative edge, then has circular negative dependency in .

Founded semantics of DA logic without closed declarations. 

We first define a version of founded semantics, denoted , that does not take declarations of predicates as closed into account; below we extend the definition to handle those declarations. Intuitively, the founded model of a kunit ignoring closed declarations, denoted , is the least set of literals that are given as facts or can be inferred by repeated use of the rules. We define , where functions , , and , are defined as follows.

Completion. 

The completion function, , returns the completed version of . Formally, , where and are defined as follows.

The function returns the kunit obtained from by replacing the facts and rules defining each uncertain complete predicate with a single combined rule for that is logically equivalent to those facts and rules. The detailed definition of combined rule is the same as in [LS18], except generalized in a straightforward way to allow rule bodies to contain disjunction and quantifiers. Similar completion rules are used in [Cla78, Fit85].

The function returns the kunit obtained from by adding, for each uncertain complete predicate , a completion rule that derives negative literals for . The completion rule for is obtained from the inverse of the combined rule defining (recall that the inverse of is ), by putting the body of the rule in negation normal form, that is, using equivalences of predicate logic to move negation inwards and eliminate double negations, so that negation is applied only to atoms.

Least fixed point. 

Explicit use of negation is eliminated before the least fixed point is computed, by applying the function . The function returns the kunit obtained from by replacing each with .

The function uses a least fixed point to infer facts for each strongly connected component (SCC) in the dependency graph of , as follows. Let be a list of the SCCs in dependency order, so earlier SCCs do not depend on later ones; it is easy to show that any linearization of the dependency order leads to the same result for . For convenience, we overload to also denote the set of predicates in the SCC . Define , where and for . is the least fixed point of function . The least fixed point is well-defined, because is monotonic, because the kunit was transformed by and hence does not contain negation. The function returns the interpretation obtained from interpretation by adding completion facts for certain predicates in to ; specifically, for each such predicate , for each combination of values of arguments of , if does not contain , then add .

Founded semantics of DA logic with closed declarations. 

Informally, when an uncertain complete predicate of kunit is declared closed, an atom of the predicate is false in an interpretation , called self-false in , if every ground instance of rules that concludes , or recursively concludes some hypothesis of that rule instance, has a hypothesis that is false or, recursively, is self-false in . A formal definition of , the set of self-false atoms of kunit with respect to interpretation , appears in [LS18]; it is the same as the definition of greatest unfounded set [VRS91], except limited to closed predicates. The definition does not take disjunction into account, so each rule containing disjunction is put into disjunctive normal form (DNF) and then replaced with multiple rules (one per disjunct of the DNF) not containing disjunction, before determining the self-false atoms.

The founded semantics is defined by repeatedly computing the semantics given by (the founded semantics without closed declarations) and then setting self-false atoms to false, until a least fixed point is reached. For a set of positive literals, let . For a kunit and an interpretation , let denote with the literals in added to its body. Formally, the founded semantics is , where .

Constraint semantics of DA logic. 

Constraint semantics is a set of 2-valued models based on founded semantics. A constraint model of is a consistent 2-valued interpretation of such that is a model of and such that and . Let denote the set of constraint models of . Constraint models can be computed from by iterating over all assignments of true and false to atoms that are undefined in , and checking which of the resulting interpretations satisfy all rules in and satisfy .

Properties of DA logic semantics. 

The following theorems express the most important properties of the semantics.

Theorem 1. The founded model and constraint models of a program are consistent.

Proof:  First we consider founded semantics. Each kunit in the program defines a distinct set of predicates, so consistency can be established one kunit at a time, considering them in CS-dependency order. For each kunit , the proof of consistency is a straightfoward extension of the proof of consistency of founded semantics [LS17, Theorem 1]. The extension is needed to show that consistency holds for the new predicates that reference founded semantics and constraint semantics.

For predicates that reference founded semantics, we prove this for each SCC in the dependency graph for ; the proof is by induction on . The predicates used in SCC to reference founded semantics have the same truth values as the referenced predicates in earlier SCCs, and by the induction hypothesis, the interpretation computed for predicates in earlier SCCs is consistent.

For predicates that reference constraint semantics, the proof is by induction on the kunits in CS-dependency order. The predicates used in kunit to reference constraint semantics have the same truth values as the referenced predicates in earlier kunits, and by the induction hypothesis, the interpretation computed for predicates in earlier kunits is consistent.

For constraint semantics, note that constraint models are consistent by definition.

Theorem 2. The founded model of a kunit is a model of and . The constraint models of are 2-valued models of and .

Proof:  The proof that is a model of is essentially the same as the proof that is a model of [LS17, Theorem 2], because the proof primarily depends on the behavior of , , and the one-step derivability operator, and they handle atoms of predicates that reference founded semantics and constraint semantics in exactly the same way as other atoms. Constraint models are 2-valued models of by definition. Any model of is also a model of , because is logically equivalent to the subset of obtained by removing the completion rules added by .

Theorem 3. DA logic is decidable.

Proof:  DA logic has a finite number of constants from given facts, and has sets of finite nesting depths bounded by the depths of CS-dependencies. In particular, it has no function symbols to build infinite domains in recursive rules. Thus, DA logic is over finite domains and is decidable.

5 Additional examples

We present additional examples that show the power of our language. They are challenging or impossible to express and solve using prior languages and semantics. We use - - to prefix comments.

Same different games. 

The same win-not-win game can be over different kinds of moves, forming different games, as introduced with kunit instantiation. However, the fundamental winning, losing, or draw situations stay the same, parameterized by the moves. The moves could also be defined easily using another kunit instantiation.

Example.  A new game can use winning, losing, draw positions defined by win_unit in Section 2, whose moves use paths defined by path_unit, whose edges use given links.

kunit path_unit:
  path(x,y) \(\leftarrow\) edge(x,y)
  path(x,y) \(\leftarrow\) edge(x,z) \(\land\) path(z,y)

kunit win_path_unit:
  link = {(1,2), (1,3), ...}   -- shorthand for link(1,2), link(1,3), ...
  use path_unit (edge = link)  -- instantiate path_unit with edge replaced by link
  use win_unit (move = path)   -- instantiate win_unit with move replaced by path
One could also define edge in place of link above, and then path_unit can be used without rebinding the name edge, as follows.
kunit win_path_unit:           -- as above
  edge = {(1,2), (1,3), ...}   -- as above but use edge in place of link
  use path_unit ()             -- as above but without replacing edge by link
  use win_unit (move = path)   -- as above

Defined from undefined positions. 

Sets and predicates can be defined using the set of values of arguments for which a given predicate is undefined. This is not possible in previous 3-valued logic like WFS, because anything depending on undefined can only be undefined.

Example.  Using the win-not-win game, the predicates move_to_draw and reach_from_draw below define the set of positions that have a move to a draw position, and the set of positions that have a special move from a draw position, respectively.

kunit draw_unit:
  move = {(1,1), (2,3), (3,1)}
  use win_unit ()
  move_to_draw(x) \(\leftarrow\) move(x,y) \(\land\) win.U(y)
  special_move = {(1,4), (4,2)}
  use path_unit (edge = special_move)
  reach_from_draw(y) \(\leftarrow\)  win.U(x) \(\land\) path(x,y)
In draw_unit, we have win.U(1), that is, 1 is a draw position. Then we have move_to_draw(3), and we have reach_from_draw(4) and reach_from_draw(2).

Note that we could copy the single win rule here in place of use win_unit () and obtain an equivalent draw_unit. We avoid copying when possible because this is a good principle, and in general, a kunit may contain many rules and facts.

Unique undefined positions. 

Among the most critical information is information that is true in all possible ways of satisfying given constraints but cannot be determined to be true by just following founded reasoning. Having both founded semantics and constraint semantics at the same time allows one to find such information.

Example.  Predicate unique in cmp_unit below finds positions in the game in win_unit1 that are in the founded model but, if a constraint model exists, are winning in all possible models in constraint semantics .

kunit win_unit1:
  prolog \(\leftarrow\) \(\neg\) asp
  asp \(\leftarrow\) \(\neg\) prolog
  move(1,0) \(\leftarrow\) prolog
  move(1,0) \(\leftarrow\) asp
  move(1,1)
  use win_unit ()
kunit cmp_unit:
  use win_unit1 ()
  unique(x) \(\leftarrow\) win.U(x) \(\land\) \(\exists\) m \(\in\) win_unit1.CS \(\land\) \(\forall\) m \(\in\) win_unit1.CS | m.win(x)
In win_unit1, founded semantics gives move.T(1,1), move.U(1,0), win.U(0), and win.U(1). win_unit1.CS = {{move(1,1), move(1,0), win(1)}}, that is, win(1) is true, and win(0) is false. So win.U(1) and win.U(0) are imprecise, and unique(1) is true in cmp_unit.

Multiple uncertain worlds. 

Given multiple worlds with different models, different uncertainties can arise from different worlds, yielding multiple uncertain worlds. It is simple to represent this using predicates that are possibly 3-valued and that are parameterized by a 2-valued model.

Example.  The game in win_unit2 uses win_unit on a set of moves. The game in win_set_unit has its own moves, but the moves are valid if and only if they follow from a position that is a winning position in the constraint semantics of win_unit2.

kunit win_unit2:
  move = {(1,4),(4,1)}
  use win_unit ()
kunit win_set_unit:
  move = {(1,2),(2,3),(3,1),(4,4),(5,6)}
  valid_move(x,y,m) \(\leftarrow\) move(x,y), win_unit2.CS(m), m.win(z), path(z,x)
  use win_unit (move = valid_move(m), win = valid_win(m))
  win_some(x) \(\leftarrow\) valid_win(x,m)
  win_each(x) \(\leftarrow\) win_some(x) \(\land\) \(\forall\) m \(\in\) win_unit2.CS | valid_win(x,m)
In win_unit2, there is a 2-edge cycle of moves, so win_unit2.CS = {m1,m2}, where m1.win = {1} and m2.win = {4}. In win_set_unit, each m in win_unit2 leads to a separately defined predicate valid_move under argument m, which is then used to define a separate predicate valid_win under argument m by instantiating win_unit with move and win parameterized by additional argument m.

6 Related work and conclusion

Many logic languages and semantics have been proposed. Several overview articles [AB94, Prz94, RU95, Fit02, Tru18] give a good sense of the complications and challenges when there is unrestricted negation. Notable different semantics include Clark completion [Cla78] and similar additions, e.g., [LT84, ST84, JLM86, Cha88, FRTW88, Stu91], Fitting semantics or Kripke-Kleene semantics [Fit85], supported model semantics [ABW88], stratified semantics [ABW88], WFS [VRS91], and SMS [GL88]. Note that these semantics disagree, in contrast to different styles of semantics that agree [EGS87].

There are also a variety of works on relating and unifying different semantics. These include Dung’s study of relationships [Dun92], partial stable models, also called stationary models [Prz94], Loop fomulas [LZ04], FO(ID) [DT08], and founded semantics and constraint semantics [LS18]. FO(ID) is more powerful than works prior to it, by supporting both first-order logic and inductive definitions while also being similar to SMS [BDT16]. However, it does not support any 3-valued semantics. Founded semantics and constraint semantics uniquely unify different semantics, by capturing their different assumptions using predicates declared to be certain, complete, and closed, or not.

However, founded semantics and constraint semantics by themselves do not provide a way for different semantics to be used for solving different parts of a problem or even the same part of the problem. DA logic supports these, and supports everything completely declaratively, in a unified language.

Specifically, DA logic allows different assumptions under different semantics to be specified easily as meta-constraints, and allows the results of different semantics to be built upon, including defining predicates using undefined values in a 3-valued model and using models in a set of 2-valued models, and parameterizing predicates by a set of 2-valued models. More fundamentally, DA logic allows different parts of a problem to be solved with different knowledge units, where every predicate is a parameter that can be instantiated with new predicates, including new predicates with additional arguments. These are not supported in prior languages.

Among many directions for future work, one particularly important and intriguing problem is to study precise complexity guarantees for inference and queries for DA logic.

References

  • [AB94] Krzysztof R. Apt and Roland N. Bol. Logic programming and negation: A survey. Journal of Logic Programming, 19:9–71, 1994.
  • [ABW88] Krzysztof R. Apt, Howard A. Blair, and Adrian Walker. Towards a theory of declarative knowledge. In Foundations of Deductive Databases and Logic Programming, pages 89–148. Morgan Kaufman, 1988.
  • [BDT16] Maurice Bruynooghe, Marc Denecker, and Miroslaw Truszczynski. First order logic with inductive definitions for model-based problem solving. AI Magazine, 37(3):69–80, 2016.
  • [Cha88] David Chan. Constructive negation based on the completed database. In Proceedings of the 5th International Conference and Symposium on Logic Programming, pages 111–125. MIT Press, 1988.
  • [Cla78] Keith L. Clark. Negation as failure. In H. Gallaire and J. Minker, editors, Logic and Databases, pages 293–322. Plenum Press, 1978.
  • [DT08] Marc Denecker and Eugenia Ternovska. A logic of nonmonotone inductive definitions. ACM Transactions on Computational Logic, 9(2):14, 2008.
  • [Dun92] Phan Minh Dung. On the relations between stable and well-founded semantics of logic programs. Theoretical Computer Science, 105(1):7–25, 1992.
  • [DVdHJD15] Ingmar Dasseville, Matthias Van der Hallen, Gerda Janssens, and Marc Denecker. Semantics of templates in a compositional framework for building logics. Theory and Practice of Logic Programming, 15(4-5):681–695, 2015.
  • [EGS87] Yu. L. Ershov, S. S. Goncharov, and D. I. Sviridenko. Semantic foundations of programming. In International Conference on Fundamentals of Computation Theory, pages 116–122. Springer, 1987.
  • [Fit85] Melvin Fitting. A Kripke-Kleene semantics for logic programs. Journal of Logic Programming, 2(4):295–312, 1985.
  • [Fit02] Melvin Fitting. Fixpoint semantics for logic programming: A survey. Theoretical Computer Science, 278(1):25–51, 2002.
  • [FRTW88] Norman Y. Foo, Anand S. Rao, Andrew Taylor, and Adrian Walker. Deduced relevant types and constructive negation. In Proceedings of the 5th International Conference and Symposium on Logic Programming, pages 126–139, 1988.
  • [GL88] Michael Gelfond and Vladimir Lifschitz. The stable model semantics for logic programming. In Proceedings of the 5th International Conference and Symposium on Logic Programming, pages 1070–1080. MIT Press, 1988.
  • [HDCD10] P. Hou, B. De Cat, and M. Denecker. FO(FD): Extending classical logic with rule-based fixpoint definitions. Theory and Practice of Logic Programming, 10(4-6):581–596, 2010.
  • [JLM86] Joxan Jaffar, Jean-Louis Lassez, and Michael J. Maher. Some issues and trends in the semantics of logic programming. In Proceedings of the 3rd International Conference on Logic Programming, pages 223–241. Springer, 1986.
  • [LS17] Yanhong A. Liu and Scott D. Stoller. Founded semantics and constraint semantics of logic rules. Computing Research Repository, arXiv:1606.06269 [cs.LO], June 2016 (Revised April 2017). http://arxiv.org/abs/1606.06269.
  • [LS18] Yanhong A. Liu and Scott D. Stoller. Founded semantics and constraint semantics of logic rules. In Proceedings of the International Symposium on Logical Foundations of Computer Science, pages 221–241. Springer, 2018.
  • [LT84] John W. Lloyd and Rodney W. Topor. Making Prolog more expressive. Journal of Logic Programming, 1(3):225–240, 1984.
  • [LZ04] Fangzhen Lin and Yuting Zhao. Assat: Computing answer sets of a logic program by sat solvers. Artificial Intelligence, 157(1-2):115–137, 2004.
  • [Prz94] Teodor C. Przymusinski. Well-founded and stationary models of logic programs. Annals of Mathematics and Artificial Intelligence, 12(3):141–187, 1994.
  • [RU95] Raghu Ramakrishnan and Jeffrey D Ullman. A survey of deductive database systems. Journal of Logic Programming, 23(2):125–149, 1995.
  • [ST84] Taisuke Sato and Hisao Tamaki. Transformational logic program synthesis. In Proceedings of the International Conference on Fifth Generation Computer Systems, pages 195–201, 1984.
  • [Stu91] Peter J Stuckey. Constructive negation for constraint logic programming. In Proceedings of the 6th Annual IEEE Symposium on Logic in Computer Science, pages 328–339, 1991.
  • [Tru18] Miroslaw Truszczynski. An introduction to the stable and well-founded semantics of logic programs. In Michael Kifer and Yanhong Annie Liu, editors, Declarative Logic Programming: Theory, Systems, and Applications, pages 121–177. ACM and Morgan & Claypool, 2018.
  • [VRS91] Allen Van Gelder, Kenneth Ross, and John S. Schlipf. The well-founded semantics for general logic programs. Journal of the ACM, 38(3):620–650, 1991.