Available online at www.sciencedirect.com
ScienceDirect Indagationes Mathematicae (
)
– www.elsevier.com/locate/indag
Virtual Special Issue – L.E.J. Brouwer after 50 years
Answer set programming in intuitionistic logic Aleksy Schubert, Paweł Urzyczyn ∗ University of Warsaw, Poland
Abstract As a demonstration of the flexibility of constructive mathematics, we propose an interpretation of propositional answer set programming (ASP) in terms of intuitionistic proof theory, in particular in terms of simply typed lambda calculus. While connections between ASP and intuitionistic logic are well-known, they usually take the form of characterizations of stable models with the help of some intuitionistic theories represented by specific classes of Kripke models. As such the known results are model-theoretic rather than proof-theoretic. In contrast, we offer an explanation of ASP using constructive proofs. c 2017 Royal Dutch Mathematical Society (KWG). Published by Elsevier B.V. All rights reserved. ⃝
1. Introduction Answer Set Programming (ASP) is a programming paradigm that originated from logic programming with negation understood as “fixpoint” [1–3]. The paradigm proved useful by reducing search problems to the existence of so called stable models of declarative programs. It has been observed long ago [6–8] that ASP can be interpreted using certain intuitionistic theories or intermediate logics, of which equilibrium logic of Pearce [8] is the most fundamental example. This is commonly summarized as applying intuitionistic logic to ASP. But what is actually done is representing answer sets as specific Kripke models (often two-state models). We propose another way to interpret ASP in intuitionistic logic, namely we want to represent ASP inference (entailment in stable models) by intuitionistic provability. We use the ordinary intuitionistic logic (without any additional axioms) for this purpose. Our proof-theoretical account brings new insights into the operational semantics of answer set programming. This seems to suggest that intuitionistic provers can serve as natural ASP-solvers. Yet differently, ∗ Corresponding author.
E-mail addresses:
[email protected] (A. Schubert),
[email protected] (P. Urzyczyn). http://dx.doi.org/10.1016/j.indag.2017.05.006 c 2017 Royal Dutch Mathematical Society (KWG). Published by Elsevier B.V. All rights reserved. 0019-3577/⃝
Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
2
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
perhaps intuitionistic logic (together with its highly intuitive and natural lambda-notation) should itself be seen as a programming paradigm, competitive to ASP. In the present note we only consider propositional ASP and we reduce it to the implicational fragment (in particular no negation is needed) of propositional intuitionistic logic (IPC). To be more specific, for a given logic program P with negations and a given atom Ω , we define in Section 2 a propositional formula ϕ P,Ω (using the implication as the only connective) so that P entails Ω under stable model semantics if and only if ϕ P,Ω is intuitionistically provable (Theorem 11). For Ω not occurring in P, a routine argument yields the equivalence “P has no stable model if and only if ϕ P,Ω is provable”. We believe this approach should turn out to be very flexible by easily accommodating various extensions of ASP. In particular, it should be applicable to first-order ASP. One can hardly aim at a converse reduction from the P SPACE-complete intuitionistic propositional logic to ASP because the latter problem is in NP. However, we demonstrate in Section 3 how answer set programming can handle a subset of propositional formulas, in the following sense (Theorem 27): for a given formula ϕ one defines a program Pϕ so that Pϕ has a stable model if and only if ϕ is refutable (i.e., not provable). We show this property for pseudo-DNF formulas, a class of formulas including all formulas of the form ϕ P,Ω , constructed in Section 2. A normal proof of a pseudo-DNF formula consists of a sequence of case splits (universal choices) followed in each case by an existential choice and ending up at a polynomially tractable formula. This resembles the process of verifying that a classical disjunctive normal form is a tautology, where for each binary valuation we choose a component of the disjunction which is satisfied by the valuation. Dually, to classically disprove (refute) a disjunctive normal form we guess a single valuation and then verify that all the components evaluate to false. The crucial property of our formulas is similar: a refutable pseudo-DNF formula always has a “uniform” refutation defined by a concise strategy. The refutability of pseudo-DNF formulas is therefore in the class NP. The class of pseudo-DNF formulas is quite restricted, and not much larger than what is actually necessary for the proof of Theorem 11. We believe though that the techniques used here should be quite robustly applicable for wider classes of formulas satisfying a form of uniformity. We thus conclude that ASP entailment is equivalent to a co-NP-complete fragment of intuitionistic propositional logic. Basic definitions: Strings of positive integers (members of the set (N−{0})∗ ) are called positions. Concatenation of two positions ρ and π is written ρ · π . The empty position is denoted by ε, and the symbol ⊆ stands for the prefix relation between positions. That is, ρ ⊆ π holds when π = ρ · µ, for some µ. A tree is a partial function S from positions to some set of labels, such that the domain of S is downward closed with respect to ⊆. The subtree of a tree S rooted at node π is the tree S|π defined by S|π(ρ) = S(π · ρ). We imagine trees growing top-down. Thus if π ⊆ σ then we say that the position π is above σ and that σ is below π . We sometimes apply set-theoretic notation to vectors. For example, if X⃗ = (X 1 , . . . , X n ) then Y ∈ X⃗ means that Y = X i , for some i = 1, . . . , n. Also X⃗ ⊆ A means that {X 1 , . . . , X n } is a subset of A. Propositional ASP. A literal is a propositional atom or its negation. A clause is an expression of the form X :−X 1 , . . . , X n , where X is a propositional atom and X 1 , . . . , X n are literals. A program is a finite set of clauses. A model is a set M of atoms, identified with a Boolean valuation vM such that vM (X ) = true if and only if X ∈ M. Given a program P and a model M, we obtain P M from P as follows: Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
3
• For X ̸∈ M, delete ¬X from the rhs of all clauses of P; • For X ∈ M, delete all clauses of P with ¬X at the rhs. The interpretation of P under M, denoted I (P, M), is the least fixed point of the operator: F(I) = I ∪ {X | there is a clause X :−X 1 , . . . , X n in P M such that all X i are in I}. (1) ⋃ Note that I (P, M) = {F j (∅) | j ≤ m}, where m is the number of clauses in P. Indeed, every iteration of F adds the lhs of some clauses to the union until the sequence stabilizes, which must happen no later than after m iterations. A model M of P is stable (or it is an answer set for P) iff M = I (P, M). We also say that P entails an atom X under SMS, written P|HSMS X , iff every stable model of P satisfies X . It is known [2,4] that the existence of a stable model and the entailment under SMS are, respectively, NP and co-NP complete problems. Lemma 1. Let Ω be an atom not occurring in a program P. Then P|HSMS Ω iff P has no stable model. Proof. For any M, all atoms in I (P, M) must be left-hand sides of clauses of P. Hence if Ω does not occur in P, and P has a stable model, then P|HSMS Ω yields a contradiction. □ Intuitionistic logic. We consider formulas of minimal propositional logic with → as the only propositional connective. That is, our formulas are just simple types, and intuitionistic proofs can be identified with simply-typed lambda-terms. The convention is that → associates to the right, i.e., ϕ → ψ → ϑ stands for ϕ → (ψ → ϑ). Every formula ϕ can thus be written as ψ1 → · · · → ψn → X , where X is a propositional atom, called the target of ϕ. (We write target(ϕ) = X .) The formulas ψ1 , . . . , ψn are called axioms of ϕ. Following the style of [5] we draw formulas as finite trees, with nodes labeled by propositional atoms. That is, ψ1 → · · · → ψn → X is drawn this way: X ψ1 ψ2 . . . ψn Natural deduction rules for our logic are given in Fig. 1 in the form of type-assignment rules for the simply typed lambda-calculus λ→ . The symbol Γ stands for a type environment, i.e. a set of declarations of the form x : τ , where x is a variable and τ is a formula. A type environment Γ = {x1 : τ1 , . . . , xm : τm } erases to a set of formulas Γ = {τ1 , . . . , τm } and we have the following well-known fact (see e.g. [9]): Fact 2. If the judgment Γ ⊢ ϕ is provable then there exists a proof term N in long normal form such that Γ ⊢ N : ϕ. As every set of formulas has the form Γ , for some environment Γ , one can ignore the distinction for simplicity, and so we do in all that follows. In other words, we tacitly assume that every assumption is labeled by a variable. Because of Fact 2 one can restrict attention to normal proofs, and this yields the following Wajsberg/Ben-Yelles algorithm: To find a proof of Γ ⊢ τ proceed as follows: Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
4
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
Fig. 1. The rules of λ→ .
1. If τ is a propositional atom X , find an assumption in Γ of the form σ1 → · · · → σn → X and prove that Γ ⊢ σi , for each i. 2. Otherwise τ = σ1 → · · · → σn → X . Then proceed to the judgment Γ , σ1 , . . . , σn ⊢ X . The two cases correspond respectively to proof terms of shape x N1 . . . Nn and λx1 : σ1 . . . σn .N , where N1 : σ1 , . . . , Nn : σn (resp. N : X ) are to be constructed next. 2. From ASP to IPC Given a program P with negations, and a propositional atom Ω , we define below an implicational formula ϕ P,Ω such that P entails Ω under stable model semantics (i.e. P|HSMS Ω ) if and only if ϕ P,Ω is intuitionistically provable. Assume that Ω and all propositional atoms occurring in P are among X 1 , . . . , X n . Let P be obtained from P by replacing all occurrences of negations ¬X i by the corresponding X i . Then let P! be obtained from P by replacing every X i with a fresh atom X i !. A clause of the form X :−Y1 , . . . , Yn (without negations) is identified with the formula Y1 → · · · → Yn → X . The program P can thus be seen as a set of implicational formulas. Let M be a model. To give a logical interpretation of I (P, M) we consider the set of assumptions P/M = P ∪ {X i | i ∈ {1, . . . , n} ∧ X i ̸∈ M}. The following lemma states that normal forms in the environment P/M are very simple, in fact all normal forms of atomic types are long. Lemma 3. If P/M ⊢ M : X , where X is a propositional atom and M is a normal form, then the term M contains no lambda-abstraction. In addition, if a variable x : τ is free in M then M has a subterm of type target(τ ). Proof. All formulas in P/M are atoms or clauses. Thus, a normal proof of X is either a variable of type X or has the form x M1 . . . Mn , where x : Y1 → · · · → Yn → X and M1 , . . . , Mn are proofs of Y1 , . . . , Yn , respectively. The claim follows by straightforward induction. □ Lemma 4. I (P, M) = {X | P/M ⊢ X }. Proof. (⊆) Let X ∈ I (P, M). Induction with respect to the least n with X ∈ F n (∅). There is a clause C of the form X :−Y1 , . . . , Yk in P M such that all Yi are in F n−1 (∅). (In case n = 1 this means that the rhs of the clause is empty.) By the induction hypothesis all these Yi have proofs in P/M. The clause C is obtained from a clause X :−Y1 , . . . , Yk , ¬Z 1 , . . . , ¬Z p , occurring in the program P, by deleting the negations because Z 1 , . . . , Z p ̸∈ M. But then Z 1 , . . . , Z p ∈ P/M, whence X can be derived from P/M using the formula in P corresponding to clause C, namely Y1 → · · · → Yk → Z 1 → · · · → Z p → X . (⊇) For the other direction assume that P/M ⊢ X . There is a proof in normal form and we proceed by induction with respect to the size of it. The proof must be obtained by elimination Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
5
Fig. 2. Various forms of axioms in ϕ P,Ω .
from an assumption in P of the form Y1 → · · · → Yk → Z 1 → · · · → Z p → X , using proofs N1 : Y1 , . . . , Nk : Yk and assumptions Z 1 , . . . , Z p ∈ P/M. In P we then have the clause X :−Y1 , . . . , Yk , ¬Z 1 , . . . , ¬Z p , and in P M there is the clause X :−Y1 , . . . , Yk . By the induction hypothesis, all Yi are in I (P, M), whence so is X . □ Corollary 5. A model M of P is stable if and only if M = {X | P/M ⊢ X }. We now turn to the construction of ϕ P,Ω . Assume that P consists of m clauses, that are numbered from 1 to m. The vocabulary of ϕ P,Ω consists of the propositional atoms 0, 1, . . . , n, X 1 , . . . , X n , X 1 , . . . , X n , X 1 ! . . . , X n !, X 1 ? . . . , X n ?, A, B, K 1 , . . . , K m . The formula ϕ P,Ω has the form ψ1 → · · · → ψd → 0. The axioms ψ1 , . . . , ψd are defined below (cf. Fig. 2). • The first n axioms are as follows: – ψ1 = (X 1 → 1) → (X 1 → 1) → 0; .. . – ψn = (X n → n) → (X n → n) → n − 1. The next m axioms are the clauses of P! Then we have three formulas: Ω → n, A → n, B → n, with target n. For every i = 1, . . . , n, there are axioms X i → X i ! → A and X i → X i ? → B. For i = 1, . . . , n, there is an axiom (X i ? → K s1 ) → · · · → (X i ? → K sri ) → X i ?, where s1 , . . . , sri are numbers of all the clauses of P with target X i . • If the atom X i occurs at the rhs of the sth clause of P then there is an axiom X i ? → K s . • If the literal ¬X i occurs at the rhs of the sth clause of P then there is an axiom X i → K s . • • • •
Clearly, a Turing Machine can enumerate all axioms (i.e., write down the whole formula) in time polynomial in the size of the program. To prove the formula ϕ P,Ω one must prove the atom 0 from the axioms. The intended meaning of those in a long normal proof of ϕ P,Ω is as follows. Axioms ψ1 , . . . , ψn are used in the initial phase of the proof. In order to prove 0 one must use the formula ψ1 , as no other formula has target 0. This splits the proof task into two: one is to prove 1 from the assumptions ψ1 , . . . , ψd , X 1 , and the other is to prove 1 from ψ1 , . . . , ψd , X 1 . In both cases the only applicable axiom is ψ2 and that splits again the two problems into four: Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
6
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
we need to construct proofs of the atom 2 from each of the following sets: {ψ1 , . . . , ψd , X 1 , X 2 }, {ψ1 , . . . , ψd , X 1 , X 2 }, {ψ1 , . . . , ψd , X 1 , X 2 }, {ψ1 , . . . , ψd , X 1 , X 2 }. And so on. Eventually we obtain 2n proof obligations to prove the atom n under all possible choices of X i or X i , for each i = 1, . . . , n. Every such choice represents a binary valuation of the propositional atoms X 1 , . . . , X n in which atom X i is assigned 1 when X i is present in the environment and is assigned 0 when X i is. Observe that in this way each proof obligation represents a different model where the program P may be interpreted. In other words, the formula ϕ P,Ω is provable if and only if one can prove n under assumptions representing every possible model. We want to make sure that it is possible if and only if every stable model of P satisfies Ω . There are three ways in which the entailment P |H Ω holds in a given model: either Ω holds, or the model is unstable because P/M proves too much (P is unsound for M), or the model is unstable because P/M does not prove what is needed (P is incomplete for M). The three possibilities are reflected by the three axioms with target n. Exactly one of them must be used at every of the 2n proof branches and each of the three corresponds to a certain property of the model we have in mind for any given branch. If Ω holds in the model (i.e., the assumption Ω is available) there is little to do. The axiom Ω → n can be used to complete the proof. The two other possibilities are represented by A and B, respectively. One proves A when P is unsound for our model because P M forces some X i to hold (that is, X i ∈ I (P, M)), but X i is chosen. The intended meaning of the atom X i ! is “P/M ⊢ X i ”. Proving B means that P is incomplete: it is unable to derive an atom X i which is present in the model. The propositional atoms X i ? and K s are understood as “X i has no proof from P/M” and “the target of the sth clause has no proof”, respectively. The latter may happen for two reasons: either because there is a wrong negated atom on the rhs of the sth clause, or because some non-negated atom occurring there has no proof. The axiom with target X i ? should be understood as follows: no clause with target X i has a proof unless such a proof recursively refers to the proof goal X i . Supported refutations. Fix an M. A refutation for X? with support Y⃗ ? = Y1 ?, . . . , Ym ? is a finite literal-labeled tree, such that the root has label X ? and one of the following holds: • The root is the only node and X ? = Yi ? for some i. • The root has as many immediate subtrees as there are clauses in P with target X . For every such clause, the corresponding subtree – either is a refutation for Z ? with support X ?, Y⃗ ?, for some atom Z occurring at the rhs of the clause, – or consists of a single node labeled Z , where Z ∈ M and ¬Z occurs at the rhs of the clause. A refutation with support can be understood as a strategy of the universal player (∀phrodite in [10]) in a proof-construction game where any repetition of a proof goal or a proof goal in the support makes her winning position. To make this more precise we define an unnested proof as Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
7
a lambda-term M such that no subterm of M is properly contained in another subterm of M of the same type. We also say that a proof term M avoids Y⃗ when, for every object atom x, if x is free in M and has type τ then target(τ ) ̸∈ Y⃗ . By Lemma 3 this is the same as “no subterm of M is of type Y ∈ Y⃗ ”. Lemma 6. There is a refutation for X i ? with support Y⃗ ? if and only if there is no unnested normal proof of P/M ⊢ X i which avoids Y⃗ ?. Proof. (⇒) Assume that there is an unnested normal proof M of P/M ⊢ X i which avoids Y⃗ ?. We show by induction with respect to M that there is no refutation for X i ? with support Y⃗ ?. The proof M must begin with a head variable x : Y1 → · · · → Yk → Z 1 → · · · → Z p → X i , applied to long normal proofs N1 : Y1 , . . . , Nk : Yk , and assumptions of types Z 1 , . . . , Z p ∈ P/M. The variable x corresponds to a certain clause C of P with target X i . In a refutation for X i ? we should have a subtree corresponding to clause C, but this is impossible. Indeed, we cannot place any Z j ( j = 1, . . . , p) there, as Z j in P/M means Z j ̸∈ M. In addition, since M is unnested, it has no proper subterm of type X i . Hence, by Lemma 3, the variable X i cannot be a target of type of any variable in N1 , . . . , Nk . That is, N1 , . . . , Nk avoid not only Y⃗ but also X i . By the induction hypothesis there are no refutations for Y1 , . . . , Yk with support Y⃗ , X i . Consequently, there is no refutation that could form the immediate subtree for the clause C in a refutation for X i ?. (⇐) Backward induction with respect to the size of Y⃗ . Suppose that there is no unnested normal proof of P/M ⊢ X i which avoids Y⃗ . We define a refutation of X i ? with support Y⃗ ? as follows. There may be two reasons for the non-existence of a proof avoiding Y⃗ . One is that X i ∈ Y⃗ , which yields a trivial refutation. (This happens in the base case when all atoms are in Y⃗ .) Otherwise every assumption of the form V1 → · · · → Vk → Z 1 → · · · → Z p → X i must have a defect preventing it from being the head variable in a proof. The possible defects are: (1) One of the Z j is not available, i.e., Z j ∈ M. (2) One of the V j has no unnested proof avoiding X i , Y⃗ . By the induction hypothesis we then have appropriate refutations. Since the above happens for every assumption with target X i , a refutation for X i ? can now easily be constructed by inspecting the clauses of P. □ Lemma 7. If P/M ⊢ Y , where Y is an atom, then there is an unnested long normal proof M such that P/M ⊢ M : Y . Proof. Let M be the shortest long normal term such that P/M ⊢ M : Y , and suppose that a subterm N1 of M is properly contained in another subterm N2 of the same type, say τ . By Lemma 3, the term M contains no lambda abstraction. Therefore P/M ⊢ N1 : τ , and P/M ⊢ N2 : τ , because all variables free in N1 and N2 are free in M. If we replace N2 in M by the shorter term N1 then we obtain a proof of Y , shorter than M, a contradiction. □ Corollary 8. There is a refutation for X i ? with empty support iff X ̸∈ I (P, M). Proof. Follows from Lemmas 4, 6 and 7.
□
For a given model M, take ∆M = M ∪ {X i | X i ̸∈ M}. Then let ΓM = ∆M ∪ {ψℓ | ℓ > n}. That is, ΓM contains all axioms of ϕ P,Ω except the first n axioms, which are replaced by atoms determined by M. Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
8
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
Lemma 9. There is a refutation for X i ? with support Y⃗ ? iff ΓM , Y⃗ ? ⊢ X i ?. Proof. For the “only if” part one uses induction with respect to the definition of refutation. If the variable X i ? is among Y⃗ ? then a trivial proof of X i ? consists of a single variable. Otherwise we have an assumption x in ΓM of type (X i ? → K s1 ) → · · · → (X i ? → K sri ) → X i ?, and we construct a proof of X i ? of the form x N1 . . . Nri , where N j : X i ? → K s j , for every j = 1, . . . , ri . The subterms N j are determined by the subtree of the refutation corresponding to clause number s j . If it is a single node labeled Z then Z ∈ M and ¬Z occurs in clause number s j . Then ΓM contains assumptions v : Z → K s j and u : Z , and we define N j = λy : X i ?(vu). Otherwise we have an atom Z in clause s j and a refutation for Z ? with support X i ?, Y⃗ ? By the induction hypothesis there is a proof ΓM , X ?, Y⃗ ? ⊢ N ′ : Z ?, and we also have an assumption v : Z ? → K s j . Therefore we can define N j as λy:X i ?(v N ′ ). In the “if” part we proceed by induction with respect to the size of a long normal proof. If the proof is a variable then we have a one-node refutation. Otherwise the proof must be of the form x Ns1 . . . Nsri , with x of type (X i ? → K s1 ) → · · · → (X i ? → K sri ) → X i ?, because there is no other assumption with target X i ?. Terms N j : X i ? → K s j are long normal forms so they must be abstractions λy : X i ? N ′j , where each N ′j is of type K s j . The available assumptions with target K s j are either of the form X ℓ ? → K s j or of the form X ℓ → K s j , so we must have N ′j = v N ′′j for some N ′′j of type X ℓ ? or X ℓ , respectively. In the first case we apply the induction hypothesis to N ′′j and we obtain a refutation for X ℓ ? with support X ℓ ?, Y⃗ ? (we added X ℓ ? because X ℓ may occur in N ′′j ). In the second case note that the only possible assumption with target X ℓ must be X ℓ itself, whence X ℓ ∈ M. Putting all this together we obtain a refutation for X i as required. □ It follows that ΓM ⊢ X i ? holds if and only if X i ̸∈ I (P, M). We still need one more lemma. Lemma 10. There is a proof of ΓM ⊢ X i ! if and only if X i ∈ I (P, M). Proof. This is an immediate consequence of Lemma 4. The set ΓM contains the subset P! ∪ {B | B ̸∈ M}, which is the same as P/M up to the renaming of all X to X !. These are the only assumptions that may be used in a proof of X i ! (all induced proof subgoals are either of the form X j or of the form X j !). □ Putting together all the above, we obtain the main result of this section. Theorem 11. For every program P and every atom Ω one can effectively construct a formula ϕ P,Ω such that P entails Ω under SMS if and only if ϕ P,Ω is provable. Proof. Suppose that P|HSMS Ω . Then every model either satisfies Ω or it is unstable because of unsoundness or incompleteness of P. For every model M we thus either have Ω ∈ ΓM or X i ∈ I (P, M), for some X i ̸∈ M, or by Corollary 8 there is a refutation for some X i ? with empty support, while X i ∈ M. By Lemmas 9 and 10, in each of these cases we can derive either Ω or A or B from ΓM and thus obtain a proof of ϕ P,Ω . For the converse we check that the only way to prove ϕ P,Ω is by verifying the entailment P|HSMS Ω at every model M. Indeed, it is necessary to prove the atom n from every set of the form ΓM and to complete a proof of n we must either show Ω or A or B. There is no axiom with target Ω , so the first case may only happen if Ω ∈ M. Otherwise we must appeal to one of the axioms X i → X i ! → A and X i → X i ? → B. In the first case an atom X i ̸∈ M belongs Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
9
to I (P, M), by Lemma 10. In the second case we refute an atom X i ∈ M, whence X i ̸∈ I (P, M) (Corollary 8 and Lemma 9). □ If Ω is an atom not occurring in P then, by Lemma 1, we can read Theorem 11 as “the program P has no stable model if and only if ϕ P,Ω is provable”. This reduces answer set programming to intuitionistic logic. Observe that we use here a very restricted class of formulas. 3. From IPC to ASP In this section we show a form of converse to Theorem 11. We define the notion of a pseudo-DNF formula and, for a given pseudo-DNF formula ϕ, we define a program Pϕ so that Pϕ has a stable model if and only if ϕ is not provable. A few definitions are handy here. An axiom is a formula ψ of the form (A) Z 1 → · · · → Z k → T , or of the form (B) (U1 → Z 1 ) → · · · → (Uk → Z k ) → T , where k ≥ 0, and T and Ui , and Z i are atoms. The atoms Z i are called questions in ψ. Sometimes we need to distinguish different occurrences of the same atom. In particular, if we refer to a “question” in an axiom of the form (B) then we always mean a specific occurrence of an atom Z i . The corresponding Ui is then called the witness of that specific occurrence. A straight formula is one of the form ϕ = ψ1 → · · · → ψ N → X 0 , where the ψi are axioms (we call them axioms in ϕ). If target(ψi ) = T , for some i, and Z is a question in ψi , then we write T ▷ϕ Z , or rather T ▷ Z , when ϕ is known. We say that an atom T is cyclic in ϕ when there are atoms T0 , T1 , . . . , Tn such that T = T0 ▷ T1 ▷ · · · ▷ Tn = T . We say that a straight formula ϕ is a pseudo-DNF formula when the set of propositional atoms in ϕ can be partitioned into active or passive atoms so that the following hold: 1. The target X 0 is active. 2. Every active atom has only one occurrence as a target of an axiom. 3. If an atom T is passive then either all axioms of target T are of the form (A), or all are of the form (B), in which case all witnesses in these axioms are just T . In the first case we say that T is weak, otherwise it is strong. 4. If the target of any axiom is passive then all questions in that axiom are passive. 5. No active atom is cyclic. From now on we fix a pseudo-DNF formula ϕ = ψ1 → · · · → ψ N → X 0 , and we use the notation Γ0 = {ψ1 , . . . , ψ N }. Without loss of generality we assume that every question is always different from its witness (a premise of the form Z → Z can always be deleted). Uniform strategies. We interpret proof-search as a game between two players. The existential player, called ∃ros, attempts to construct a proof of a formula, while the universal player, ∀phrodite, is trying to disprove it. The game is played in turns. Each turn in position (Γ ⊢ X ) begins with an ∃ros’ move. ∃ros picks from Γ a formula ψ1 → · · · → ψn → X (in the hope that the proof can be constructed this way). Then ∀phrodite chooses some ψi = ϕ1 → · · · → ϕm → Y (in the hope that the corresponding branch of the proof cannot be completed by ∃ros). This choice results in the position (Γ , ϕ1 , . . . , ϕm ⊢ Y ). We are interested in winning strategies of ∀phrodite, henceforth called just “strategies”. The following definition is a slight variation of the one in [10], adjusted to the specific case of our formula ϕ. Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
10
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
A strategy is a possibly infinite tree S labeled by judgments satisfying the following conditions: 1. S(ε) = (Γ0 ⊢ X 0 ). 2. If S(π ) = (Γ ⊢ X ), for some π ∈ dom(S), and ψr1 , . . . , ψrm are all the axioms in ϕ with target X , then S(π · i) = (Γi′ ⊢ Yi ), for i = 1, . . . , m, where • Yi is a question in ψri ; • Γi′ = Γ , Z , if Z is the witness of Yi , and Γi′ = Γ , if there is no witness. Otherwise S(π · i) is undefined. 3. If S(π ) = (Γ ⊢ X ) then X ̸∈ Γ . In particular, if S(π ) = (Γ ⊢ X ), and there is no axiom with target X , then the position π is a leaf (it is a winning position of ∀phrodite). On the other extreme, if X is an atomic axiom then it has no questions, and therefore S(π) = (Γ ⊢ X ) is impossible in a strategy (in such a position ∀phrodite would lose). For S(π ) = (Γ ⊢ X ) we write Se (π ) = Γ and Sg (π ) = X . We say that X is the goal at π and that Γ is the environment at π . Unless stated otherwise, an occurrence of an atom X in S is understood as an occurrence of X as a goal. For example, we say that there is an occurrence of Y below an occurrence of X when Sg (π ) = X and Sg (σ ) = Y , for some π ⊆ σ . In this case we can also say that in S there is a play from X to Y . A position π is called passive or active when the goal Sg (π ) is, respectively, passive or active. A propositional atom X is global when X ∈ Se (π ), for all passive π . Lemma 12. Let S be a strategy. 1. If S(π) = (Γ ⊢ X ) then Γ = Γ0 , ∆, and ∆ consists of propositional atoms (each of those is a witness in some axiom). 2. If S(π ) = (Γ ⊢ X ) and S(π · ρ) = (Γ ′ ⊢ Y ) then Γ ⊆ Γ ′ . 3. If Sg (π) = X , and X is strong, then Sg (π · ρ) ̸= X , for all ρ ̸= ε. 4. An active atom occurs at most once in S. 5. If at least one position in S is passive then there is a unique least passive position π0 which is a prefix of all passive positions. All atoms in Se (π0 ) are global. 6. If X is passive, Sg (π) = X and Y ∈ Se (π) then Y is either strong or global. 7. A passive global atom cannot be a goal in a strategy. Proof. (1, 2) Trivial induction. (3) Because X ∈ Se (π · ρ), for all ρ ̸= ε. (4) Recall that the atom X 0 is active. Now if Sg (π) = X and X is active then there is at most one immediate successor position π ·i of π in the strategy. The initial part of S thus consists of a single branch of active positions. In addition, there is no repetition, by condition (5) in the definition of a pseudoDNF formula. (5) The initial branch in S of active positions must end with the last active position. The position π0 is its only successor. (6) Only strong atoms can be introduced between π0 and π , so if Y is not strong it must belong to Se (π0 ) and be global. (7) This follows from condition (3) in the definition of a strategy, as a global atom occurs in all environments below π0 (i.e., all environments with passive goals). □ It follows from [10] that either ϕ has a proof or there exists a (winning) strategy of ∀phrodite. We aim at showing that for our formulas if there is any strategy then there is always a uniform Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
11
strategy, that is one in which ∀phrodite’s moves only depend on the current goal. To put it differently, any two subtrees with the same goal at the root are the same with respect to all the further goals. Formally, S is uniform iff for all π1 , π2 with Sg (π1 ) = Sg (π2 ) it holds that Sg |π1 = Sg |π2 . A propositional atom X is uniform in S iff all subtrees Sg |µ, with Sg (µ) = X , are identical. Note that Lemma 12(4) guarantees uniformity for active atoms. We only need to deal with the passive ones. The next sequence of lemmas serves this purpose. Unless stated otherwise we only consider passive positions in these lemmas. Lemma 13. Let S be a strategy. Let π and µ be passive positions such that S(π ) = (Γ ⊢ X ) and S(µ) = (Σ ⊢ X ). Assume that no propositional atom in Σ is in the range of Sg |π . Consider a tree S ′ defined as follows: • S ′ (µ · ρ) = (Σ , ∆ ⊢ Y ) when S(π · ρ) = (Γ , ∆ ⊢ Y ) with Γ ∩ ∆ = ∅. • S ′ (σ ) = S(σ ), for all σ with µ ̸⊆ σ . Then S ′ is a strategy. Proof. The same axioms are available at every position. Therefore it is routine to check that S ′ satisfies the first two conditions in the definition of a strategy. Only the last one is not immediate. Thus for S ′ (µ · ρ) = (Σ , ∆ ⊢ Y ) we need to check that Y ̸∈ Σ , ∆. We know that Y ̸∈ Σ by assumption, and Y ̸∈ ∆ because S is a strategy and S(π · ρ) = (Γ , ∆ ⊢ Y ). □ The meaning of the lemma is: one can copy a substrategy starting at π to another position µ, provided the substrategy avoids (as proof goals) the atoms assumed at µ. The strategy S ′ defined as in Lemma 13 will be denoted by S[π ↦→ µ]. Since strategies are possibly infinite trees, we sometimes need to replace infinitely many subtrees at once. Therefore we generalize the operation S[π ↦→ µ] to S[πi ↦→ µi ]i∈I , for an arbitrary set of pairs {(πi , µi ) | i ∈ I } of passive positions such that: • Sg (πi ) = Sg (µi ), for all i ∈ I . • Positions µi are pairwise incomparable with respect to ⊆. Assuming that Se (πi ) = Γi and Se (µi ) = Σi , the tree S[πi ↦→ µi ]i∈I is defined thus: • S[πi ↦→ µi ]i∈I (µi · ρ) = (Σi , ∆ ⊢ Y ) when S(πi · ρ) = (Γi , ∆ ⊢ Y ) with Γi ∩ ∆ = ∅. • S[πi ↦→ µi ]i∈I (σ ) = S(σ ), when σ is such that µi ̸⊆ σ , for all i ∈ I . Lemma 13 generalizes to: Lemma 14. Let S be a strategy and assume that, for all i ∈ I , no atom in Se (µi ) is in the range of Sg |πi . If S[πi ↦→ µi ]i∈I is defined then it is a strategy. Proof. Similar to the proof of Lemma 13.
□
There are some important special cases of the substitution operation defined above. If Sg (π ) = X but Sg (π ′ ) ̸= X , for π ′ ⊊ π , then we say that π is a minimal occurrence of X in S. The notation S[π ↦→ X ] then stands for S[πi ↦→ µi ]i∈I , where µi are all minimal occurrences of X and πi = π is one fixed minimal occurrence. Assume that Se (π) = Γ and Se (µi ) = Σi . Then we have: Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
12
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
• S[π ↦→ X ](µi · ρ) = (Σi , ∆ ⊢ Y ), if S(π · ρ) = (Γ , ∆ ⊢ Y ), and Γ ∩ ∆ = ∅. • S[π ↦→ X ](ρ) = S(ρ), if there is no occurrence of X above ρ. Lemma 15. Let π be a minimal occurrence of a passive atom X in S. Assume that the range of Sg |π is disjoint with the environment Se (µ), for every minimal occurrence µ of X in S. Then S[π ↦→ X ] is a strategy. Proof. Immediate from Lemma 14.
□
Strategies are in general infinite trees but they are finitely branching so there must be repetitions along the infinite paths, because the number of different judgments (in particular different goals) is finite. Recall that, by Lemma 12(3), a strong atom cannot occur below itself. For a weak atom Sg (π ), there are two possible forms of repetition: a safe loop ρ at π when S(π ) = S(π · ρ), for some ρ ̸= ε and an unsafe loop ρ at π when Sg (π ) = Sg (π · ρ) and Se (π ) ⊊ Se (π · ρ). The latter happens when a strong goal occurs between π and π · ρ. Lemmas 16–19 demonstrate how to “uniformize” any strategy in a bottom-up style. An invariant to be observed is that no unsafe loops are introduced on the way. Lemma 16. Let S be a strategy and let Z be a set of strong passive atoms, all of them uniform in S. Let Z be “final” in the following sense: • If X ∈ Z and a strong Y occurs in S below X then Y ∈ Z. Assume also that for some π we have Sg (π ) = X , where X is a strong passive atom not in Z, and π is such that: • If Sg (π · ρ) = Y and Y is strong then Y ∈ Z. Then S ′ = S[π ↦→ X ] is a strategy and all atoms in Z ∪ {X } are uniform in S ′ . In addition, if in S there is no unsafe loop below the position π nor below occurrences of atoms in Z, then in S ′ there is no unsafe loop below occurrences of Z ∪ {X }. Proof. That S ′ is a strategy follows from Lemma 15. Indeed, consider a minimal occurrence µ of X in S. We prove that the range of Sg |π and the environment Se (µ) are disjoint. Let an atom Y be in the range of Sg |π . This means that Y occurs as a goal below π , in particular Y is passive. By our assumption, either Y is weak or Y ∈ Z. On the other hand, if Y ∈ Se (µ) then it is either strong or global, by Lemma 12(6). The latter is impossible, because a passive global atom cannot be a goal. So Y must be strong, which implies that Y ∈ Z. But if Y ∈ Z then it cannot occur above X . Therefore the range of Sg |π is always disjoint with Se (µ) and Lemma 15 can be applied. As X is strong, it follows from Lemma 12(3) that all occurrences of X in S are minimal. Therefore X is uniform in S[π ↦→ X ]. If Y ∈ Z then Y is also uniform in S[π ↦→ X ]. Indeed, suppose that S[π ↦→ X ]g (ν) = Y . Then S[π ↦→ X ]g |ν is identical to some Sg |ζ with Sg (ζ ) = Y . This is because Y cannot occur above X , so we either have Sg (ν) = Y or ν = µ · ρ, for some µ with Sg (µ) = X , and Sg (π · ρ) = Y . Then the tree S[π ↦→ X ]g |ν is the same as Sg |π · ρ. It should also be clear that, for a similar reason, no unsafe loop can be introduced below any atom in Z ∪ {X }, as an analogous unsafe loop would otherwise occur already in S. □ Lemma 17. Let S and Z be as in Lemma 16 with no unsafe loop below occurrences of atoms in Z. Let π be a position such that all strong atoms below π are in Z. Let {πi | i ∈ I } be all Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
13
minimal positions below π with unsafe loops ρi at πi . Then the strategy S ′ = S[πi · ρi ↦→ πi ]i∈I has no unsafe loops below π and all members of Z are uniform in S ′ . Proof. It follows from Lemma 14 that S ′ = S[πi · ρi ↦→ πi ]i∈I is a strategy. We show that the operation S[πi · ρi ↦→ πi ]i∈I eliminates all unsafe loops (not only those at the minimal positions πi ). Indeed, suppose we have an unsafe loop ρ at some πi · σ . As it is unsafe, we have a strong atom X occurring as a goal between πi · σ and πi · σ · ρ. Then X ∈ Z because it is below π. There is also an occurrence of a strong atom Y ∈ Z between πi and πi · ρi . Were ρi a prefix of σ , we would have an unsafe loop below Y . Therefore the position πi ·σ is either above πi · ρi or it is incomparable with πi · ρi . In either case the judgment S(πi · σ ) is simply erased from the strategy together with its unsafe loop. Uniformity of elements of Z follows from the observation that substrategies beginning at X ∈ Z can only be erased or moved, but cannot be altered (because there are no unsafe loops below X ). □ Lemma 18. Let S and Z be as in Lemma 16 with no unsafe loop below occurrences of atoms in Z. Then there exists a strategy where all strong atoms are uniform and with no unsafe loops. Proof. Induction with respect to the number of strong atoms not in Z. If it is zero we apply Lemma 17 to π = ε. Otherwise we find a strong atom X and a position π satisfying the assumption of Lemmas 16 and 17. Then we apply Lemma 17 to π, and we obtain a strategy S ′ , where X and π still satisfy the assumptions of Lemma 16. Now the strategy S ′′ = S ′ [π ↦→ X ] has no unsafe loop below atoms in Z ∪ {X } and we can apply the induction hypothesis. □ Lemma 19. If there exists any strategy then there is a uniform one. Proof. Applying Lemma 18 with Z = ∅ gives us a strategy S without unsafe loops and such that all strong atoms are uniform. We only need to uniformize weak atoms. First we turn the tree S into a finite graph by cutting it wherever a weak atom X occurs for the second time on a path and redirecting the cut edge back to X thus forming a loop. Then we unfold all loops and we have a regular tree S ′ . This is a strategy because no unsafe loop was present. Now we choose a minimal occurrence π of a weak atom X and replace S ′ by S ′ [π ↦→ X ]. It follows from Lemma 15 that S ′ [π ↦→ X ] is a strategy. Indeed, suppose that an atom Y occurs below π and belongs to some Se (µ), where Sg (µ) = X . By Lemma 12(6), the atom Y is either strong or global. Then it must be strong, because a passive global atom cannot be a goal. And thus it must also occur above µ. But Y is uniform so an occurrence of X at µ must correspond to some occurrence of X below π resulting in an unsafe loop at π . Also what was uniform in S ′ remains uniform in S ′ [π ↦→ X ]. This way we can obtain a strategy where all atoms are uniform. □ Strategies as stable models. Given a pseudo-DNF formula ϕ = ψ1 → · · · → ψd → X 0 , we define a program Pϕ such that Pϕ has a stable model if and only if the formula ϕ is refutable. More specifically we show how a uniform strategy of ∀phrodite can be represented as a stable model. While our formulas are defined in a very restricted way, just for simplicity, the construction to follow is quite generic and should generalize to any class of propositional formulas with the “uniformity property”: If ∀ phrodite has a strategy then she has a uniform one. Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
14
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
We begin with a few tricks learned from Brewka et al. [1]. First we fix an atom ω which is from now on assumed not to occur in programs but in clauses of form ω:−X 1 , X 2 , . . . , X k , ¬ω. These clauses are abbreviated :−X 1 , X 2 , . . . , X k , and called contradiction clauses. Such a clause enforces that the set {X 1 , . . . , X k } is not satisfiable in stable models. Lemma 20. If M is a stable model of P then, for every contradiction clause :−X 1 , X 2 , . . . , X k in P, there is at least one component X i not in M. Proof. Consider a contradiction clause ω:−X 1 , X 2 , . . . , X k , ¬ω in P. If ω ̸∈ M then we have the clause ω:−X 1 , X 2 , . . . , X k in P M , and if all X i are in M then also ω ∈ M, a contradiction. And if ω ∈ M then all contradiction clauses would be erased, whence ω ̸∈ I (P, M), and the model is not stable. □ The abbreviation X 1 ⊕ · · · ⊕ X k :−Y , where k > 0, stands for a collection of the k clauses: X 1 :−¬X 2 , ¬X 3 , . . . , ¬X k , Y, X 2 :−¬X 1 , ¬X 3 , . . . , ¬X k , Y, .. .
X k :−¬X 1 , ¬X 2 , . . . , ¬X k−1 , Y.
The purpose of this construction is to ensure that exactly one of X 1 , . . . , X k must occur in a stable model whenever Y does. Lemma 21. Let X 1 ⊕ · · · ⊕ X k :−Y be in P and assume that there is no other clause with target X i , for any i = 1, . . . , k. If M is a stable model of P, such that Y ∈ M, then exactly one component X i belongs to M. Proof. Assume that Y ∈ M. We inspect what part of X 1 ⊕ · · · ⊕ X k :−Y remains in the program P M . If at least two different components X i , X j are in M then all clauses get erased, because each one contains either ¬X i or ¬X j . Hence X i , X j ∈ M − I (P, M), and the model is unstable. If no X i is in M then all clauses remain in P M in the reduced form X i :−Y , and again the model is unstable, because all components are in I (P, M) − M. □ The program. The vocabulary of Pϕ consists of the following atoms: • • • •
All propositional atoms of ϕ. All occurrences of propositional atoms in ϕ. Atoms C X Y , for all pairs X, Y of propositional atoms in ϕ. The auxiliary atom ω.
To distinguish between atoms and occurrences of atoms we use the convention that occurrences of an atom X are denoted as X ′ , X ′′ , etc. Actually, not all occurrences of atoms are needed: only the “positive” ones, that is, the target occurrence X 0′ of X 0 , and the questions. Recall that if α1 → · · · → αs → X is an axiom, and αi = (U → V ′ ), then U is called the witness of the occurrence V ′ of V . The program Pϕ consists of the following clauses. 1. The clause X 0′ :− is in Pϕ , where X 0′ is the target occurrence in ϕ. 2. The clause X :−X ′ is in Pϕ , for every occurrence X ′ of any atom X . Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
15
3. All clauses of the form C X Z :−C X Y , CY Z are in Pϕ . 4. For every axiom of the form α1 → · · · → αs → X , with s > 0 and target(αi ) = Yi′ : (a) the clause Y1′ ⊕ · · · ⊕ Ys′ :−X is in Pϕ , and (b) all clauses C X Yi :−Yi′ , for i = 1, . . . , s, are in Pϕ . 5. For every atomic axiom X , the clause :−X is in Pϕ . 6. If U is the witness of V ′ then the clause :−C V U , V ′ is in Pϕ . Observe that Pϕ can be effectively constructed in time polynomial in the size of ϕ. A uniform strategy yields a stable model. A uniform strategy S can be seen as a partial function Sˆ ˆ a (possibly empty) vector of questions S(X ˆ ), which assigns to a propositional atom X ∈ Dom( S) one question for each axiom with target X . To be more precise, define a blueprint to be a partial function B such that, for every atom X , • X 0 ∈ Dom(B); • if ψr1 , . . . , ψrm are all the axioms in ϕ with target X , then B(X ) = (Y1′ , . . . , Ym′ ), where each Yi′ is a question in ψri ; • if B(X ) = (Y1′ , . . . , Ym′ ) then Y1 , . . . , Ym ∈ Dom(B). Every such function determines a model M B defined as the least set of atoms such that: a. b. c. d.
The target occurrence X 0′ is in M B . If some occurrence X ′ of X is in M B then X ∈ M B . If C X Z and C Z Y are in M B then C X Y ∈ M B . If X is in M B and Y ′ ∈ B(X ) then Y ′ and C X Y belong to M B .
Observe that an atom X is in M B if and only if some occurrence X ′ of X belongs to M B . Given a uniform strategy S, we define a blueprint Sˆ as follows. Let S(π ) = (Γ ⊢ X ) and let ψr1 , . . . , ψrm are all the axioms in ϕ with target X . Then for i = 1, . . . , rm we either have S(π · i) = (Γ ⊢ Yi ), for some Yi (the case of weak X ) or S(π · i) = (Γ , Z i ⊢ Yi ), for some Yi , Z i ˆ ) = (Y ′ , . . . , Ym′ ), where each Yi′ is an occurrence of (the case of strong X ). Then we define S(X 1 Yi as a question in ψri . The Yi′ is selected so that if X is strong then Z i is the witness of Yi′ . Apart from that the choice of Yi′ is inessential (one can take the leftmost suitable occurrence). Lemma 22. Let S be a strategy. Then: 1. If Y ′ ∈ M Sˆ then there exists a position π such that S(π) = (Γ ⊢ Y ), and if Y ′ has a witness U then U ∈ Γ . 2. If C X Y is in M Sˆ then there is a play in S from X to Y . Proof. The proof is by induction with respect to the definition of M Sˆ . (1) If Y ′ is the target ˆ ), for some X ∈ M ˆ . Hence occurrence of X 0 then the claim is obvious. Otherwise Y ′ ∈ S(X S ′ ′ X ∈ M Sˆ , for some X , and by the induction hypothesis we have Γ ⊢ X at some position in S. One of the successive positions is of the form Γ ⊢ Y or Γ , U ⊢ Y . (2) The base case is when ˆ ), for some occurrence Y ′ of Y . Then the play consists of a single move. X ∈ M Sˆ and Y ′ ∈ S(X The other possibility is that C X Z , C Z Y ∈ M Sˆ , for some Z , and we can apply induction because of uniformity. □ Corollary 23. It follows from Lemma 22 that, for a uniform strategy S: Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
16
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
1. If X is an atomic axiom then X ̸∈ M Sˆ . 2. If U is a witness of Y ′ then Y ′ and CY U cannot both belong to M Sˆ . Lemma 24. If ϕ has a uniform strategy then Pϕ has a stable model. Mˆ
Proof. We claim that M Sˆ is a stable model of Pϕ , i.e., that M Sˆ = I (Pϕ , M Sˆ ). Recall that Pϕ S differs from Pϕ in that certain clauses are deleted and some are reduced by omitting negated components. This applies to clauses of types 4a, 5, and 6. We prove two inclusions. (⊆) Induction with respect to the definition of M Sˆ . Cases (a), (b), and (c), use respectively clauses of types 1, 2 and 3, and the induction hypothesis. In case (d) we know that Y ′ is the only question among those at the right-hand side of the appropriate clause of type 4a that belongs Mˆ to M Sˆ . Therefore we have in Pϕ S the clause Y ′ :−X . By the induction hypothesis, X belongs to I (Pϕ , M Sˆ ) whence so does Y ′ . Now C X Y ∈ I (Pϕ , M Sˆ ) as well, using clause 4b. (⊇) Induction with respect to the definition of I (Pϕ , M Sˆ ). If an atom belongs to I (Pϕ , M Sˆ ) because it is a target of a clause of type 1, 2, or 3 then it must belong to M Sˆ thanks to conditions (a), (b), or (c), in the definition of M Sˆ , respectively, and the induction hypothesis. In case 4(a) we may have Yi′ ∈ I (Pϕ , M S ), only when Yi′ ∈ M Sˆ , by the definition of ⊕. In case 4(b), the atom C X Yi belongs to the model due to condition (d) in the definition of M Sˆ . Suppose that ω ∈ I (Pϕ , M Sˆ ) using a clause :−X (that is, ω:−X, ¬ω) of type 5. This means that X ∈ I (Pϕ , M Sˆ ), so by the induction hypothesis the atomic axiom X is in the model, an option excluded by Corollary 23(1). Similarly, if ω ∈ I (Pϕ , M Sˆ ) using a clause of type 6, then we C V U , V ′ ∈ I (Pϕ , M Sˆ ), hence C V U , V ′ ∈ M Sˆ by the induction hypothesis. By Corollary 23(2) this cannot happen. □ Lemma 25. If M is a stable model of Pϕ and C X Y ∈ M, then Y ∈ M. Proof. Induction with respect to definition of M as I (Pϕ , M). If C X Y ∈ M then it is either by clause 4b (base case when Y ′ ∈ M, for some Y ′ ) or by clause 3 (easy induction step). □ Lemma 26. If Pϕ has a stable model then ϕ has a uniform strategy. Proof. Suppose that we have a model M of Pϕ . For every X ∈ M and every axiom with target X we have exactly one question Yi′ in that axiom which belongs to M. This is because there is no other clause with target Yi′ except the appropriate part of 4(a). Thus, M defines a blueprint B such that Dom(B) ⊆ M. Observe that, for every member Y ′ of B(X ), we have C X Y ∈ M using clause 4b. ˆ because clauses 5 and 6 guarantee that The function B defines a strategy S, such that B = S, a provable position cannot occur. More specifically, we say that a judgment Γ ⊢ X is safe if X ̸∈ Γ and C X Y ̸∈ M, for all atoms Y ∈ Γ . We prove by induction that if ∀phrodite plays according to B then every reachable judgment is safe. We start with the initial judgment Γ0 ⊢ X 0 . Since X 0 ∈ M, we cannot have X 0 ∈ Γ0 because of clause 5. And if Y ∈ Γ0 then C X 0 Y ̸∈ M, as otherwise Y ∈ M, by Lemma 25. Now suppose that Γ ⊢ X is safe and the next position in a play is of the form Γ , U ⊢ Y . Then U is a witness of an occurrence Y ′ ∈ B(X ) ⊆ M, whence CY U cannot be in M because there is a clause :−CY U , Y ′ of type 6 in Pϕ . But C X Y ∈ M, so if Z ∈ Γ and CY Z ∈ M then we would have C X Z ∈ M, excluded by the induction hypothesis. Thus CY Z ̸∈ M. The condition Y ̸∈ Γ also follows from C X Y ∈ M and the safety of Γ ⊢ X . Recall that Y ̸= U by definition, and we Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.
A. Schubert, P. Urzyczyn / Indagationes Mathematicae (
)
–
17
can conclude that Γ , U ⊢ Y is a safe judgment. In case there is no witness and the next position is Γ ⊢ Y , the argument is even simpler. It follows that S is indeed a strategy of ∀phrodite. □ Theorem 27. For every formula ϕ one can effectively construct a program Pϕ with negations such that ϕ is provable in intuitionistic logic iff Pϕ has no stable model. Note that Theorem 27 can be rephrased as “for every ϕ there are Pϕ and X such that ⊢ ϕ if and only if Pϕ |HSMS X ”. Indeed, it suffices to pick an X not occurring in Pϕ . Acknowledgment The authors are greatly indebted to Konrad Zdanowski for numerous discussions and suggestions regarding this work. References [1] Gerhard Brewka, Thomas Eiter, Mirosław Truszczy´nski, Answer set programming at a glance, Commun. ACM 54 (12) (2011) 92–103. [2] Phokion G. Kolaitis, Christos H. Papadimitriou, Why not negation by fixpoint? in: Proceedings of the Seventh ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, PODS’88, ACM, New York, NY, USA, 1988, pp. 231–239. [3] Vladimir Lifschitz, What is answer set programming? in: Proceedings of the 23rd National Conference on Artificial Intelligence - Volume 3, AAAI’08, AAAI Press, 2008, pp. 1594–1597. [4] Wiktor Marek, Mirosław Truszczy´nski, Autoepistemic logic, J. ACM 38 (3) (1991) 587–618. [5] H. Nickau, Hereditarily sequential functionals, in: A. Nerode, Y. Matiyasevich (Eds.), Logical Foundations of Computer Science, in: Lecture Notes in Computer Science, vol. 813, Springer, 1994, pp. 253–264. [6] Mauricio Osorio, Juan A. Navarro, Jos´e Arrazola, Applications of intuitionistic logic in answer set programming, Theory Pract. Log. Program. 4 (3) (2004) 325–354. [7] David Pearce, Stable inference as intuitionistic validity, J. Log. Program. 38 (1) (1999) 79–91. [8] David Pearce, Equilibrium logic, Ann. Math. Artif. Intell. 47 (1–2) (2006) 3–41. [9] Morten H. Sørensen, Paweł Urzyczyn, Lectures on the Curry-Howard Isomorphism, in: Studies in Logic and the Foundations of Mathematics, vol. 149, 2006 Elsevier. [10] Paweł Urzyczyn, Intuitionistic games: Determinacy, completeness, and normalization, Studia Logica 104 (5) (2016) 957–1001.
Please cite this article in press as: A. Schubert, P. Urzyczyn, Answer set programming in intuitionistic logic, Indagationes Mathematicae (2017), http://dx.doi.org/10.1016/j.indag.2017.05.006.