Implementation of Pstable Model Semantics
Implementation of Pstable Model Semantics
1 Introduction
2 Background
In this section, we give the necessary definitions to develop our work. Some of the
most outstanding definitions refer to the semantics in question called Pstable.
Thus, definition of the pstable model semantics was show in [2] and it is as
following:
A normal logic program (sometimes a general logic program) is a set of clauses
of the form:
A L1 , , Ln (n 0)
where A is an atom and each Li is a literal. A literal is either an atom or a nbf -
literal of the form not A where A is an atom. not denotes negation by failure.
Stable models [1] also called answer sets provide a simple semantics for
normal logic programs that works even for programs like this:
p(1,2)
q(X) p(X,Y), not q(Y)
This program is not stratified, and not even locally stratified. Yet it seems
to have a clear intuitive meaning (such programs arise very naturally in many
forms of default reasoning). Even in Prolog the query ?-q(X) does not loop and
returns the answer you would intuitively expect. The ideas of stable models
can be generalised very naturally to extended logic programs, which combine
negation-by-failure not with classical(strong, explicit) negation . For a normal
logic program, a stable model is a set of atoms. For an extended logic program,
a stable model (alias an answer set) is a set of literals. We will look at extended
logic programs later. There is a strong connection between stable models and
autoepistemiclogic, which is an attempt to formalize how a rational agent can
reason about its own beliefs. We wont pursue the connection to auto-epistemic
logic.
Definition. For a normal logic program, a stable model is a set of atoms [1].
Textual Implication. This term is used when from the semantics of a text
in natural language, is possible to infer, another text in natural language. More
specifically, if the true of one sentence implies the true of the other one, also call
hypothesis [3].
The previous analysis of graph problems and text implication solving, add to the
intention of solving by using logic, make a big gap, mainly because the classic
logic requires complex modeling, just for pre-solving inconsistencies. There is a
logic extension able to solve inconsistencies, so that is the logic modeling we will
use for our implementation.
Logical solution tools are available; unfortunately, ASP is still weak for pro-
blems as simple as:
a b and
b a and
b.
this look like a contradiction, strangely if we make a deep look of this we can
see it as:
(a or b) and (b or a) and b.
Satisfiability can be done by many SAT solvers, we choose the MINISAT [4]
solver, because won all the industrial categories of the SAT 2005 competition
and the SAT-Race 2006. MiniSat is a good starting point both for future re-
search in SAT, and for applications using SAT, like all sat solvers MINISAT use
the DIMACS CNF format as an input, so if we wanna make a PSTALBE solver
its gonna be important first convert traditional logic input to the exclusively
disjunctive form.
First attempt to make this made us look to Lparse, most of all because works
with variable-free programs that are quite cumbersome to generate by hand also
is a front-end that adds variables (and a lot of other stuff) to the accepted
language of smodels [5] and generates a variable-free simple logic program that
can be given to smodels and we suppose that the resulting file will be easier to
convert in DIMACS CNF file. to do the parsing, but we dont get the expected
result as we show as follows:
input:
a b, not c.
c b, not a.
e c.
b.
output
110 0
121 03
131 14
141 13
0
1b
2e
3c
4a
0
B+
0
B-
0
1
is easy see how its too bounden in with smodels format and that only lead us
to a mayor level of complexity in the final parsing, and its gonna make harder,
analysis-matching of the output with the program for performing the adjustment
and actualization in the body.
taking this as an example, let us show how the program work, the variables
are not stored and converted by alphabetical or numeric order, they are parsed
by order of apparition, the variables are stored in a modified hash table (see
table 1) with sub-classing, if the memory can be seen the table be this:
The table use only numeric values, we put label for easier understanding.
Structured as a dynamic structure has no limits of variables and connections
between them, also make trivial, add actions or deletion, but can increase the
time of searching a negated variable.
Search of a negated variable is tricky because SAT solvers use the disjunc-
tive for of the implication this mean that a variable may be negated in the new
format, so we make a extra table to index the first one:
The table is shown very simplified but, it contains the information of the row
where the variable occur and link the search process with the insert process.
These two structures make easy the iterative process of calculate PSTABLE
models. The process is simple and have these steps:
I. Parsing
II. Build Dynamics tables
III. Convert dynamics tables in to DIMACS CNF file
Table 2. Table for search process
Complement
c False
b True
d True
a True
The application of step 4 to 7 are only performed until the sat solver is unable
to find a solution that can satisfy the program and all possible models where
checked, in this moment all models that can not be satisfied.
Next, we present our application with the plug-in as it is shown in the fol-
lowing figure 1.
The application can support batching and multiple log solving. To illustrate
the complexity of this calculus we compare our demonstrator with the automatic
demonstrator Otter. This demonstrator is well known as one of the best auto-
matic tools.
For the challenge we take 322 text implications of different type in logic form,
in 77 the implication was true, 235 was false and 10 where so complex that even
people could not say if theres or not implication.
With this set of proofs Otter answer to 3 problems with a yes, those were
corrects, but the 319 remaining problems could not been solve and was unable
to gave an answer, this results was very poor but the tools we develop gave much
better results, anwer 32 correct yes 235 corrects no and 3 corrects unknown , to
45 problems answer unknown but the answer must be yes, we think that this is
because the logic was very weak, even with that the pstable model proof to be
a better aproch to the solution of this problem.
5 Conclusions
We decide to do this investigation, and gave this direction, because, hybrid
systems and fuzzy solutions are taking lead in this day so we want to prove
that, classic logic is a prower full tool if its uses properly. During the realization
of this experiments we discover that our Textual Implication tool depend by
the moment of the accuracy, existed in the parsing tool which translate natural
language to logic, we really think that this tool can be improve with Pstable
or Stable models, Any way our tool show to be more precise, and we came to
the conclusion that is because the logic we are using and the way we pass the
problem to the logic, in fact the more important thing is the right modeling of
the problem that why our tool is less sensitive to a bad parsing than, ordinal
logic demonstrators.
References
1. Michael Gelfond and Vladimir Lifschitz.: The stable model semantics for
logic programming. In Robert A. Kowalski and Kenneth Bowen, editors, Pro-
ceedings of the Fifth International Conference on Logic Programming, pages
10701080, Cambridge, Massachusetts, 1988. The MIT Press, URL citeseer.
ist.psu.edu/gelfond88stable.html.
2. Mauricio Osorio Galindo and Juan Antonio Navarro Perez and Jose R. Arrazola
Ramrez and Veronica Borja Macas. Logics with common weak completions. Jour-
nal of Logic and Computation, 2006. URL doi: 10.1093/logcom/exl013
3. Jesus Herrera, Anselmo Penas, Felisa Verdejo Tecnicas Aplicadas al Re-
conocimiento de Implicacion Textual Departamento de Lenguajes y Sistemas In-
formaticos, Universidad Nacional de Educacion a Distancia Madrid, Espana.
4. MiniSat is a minimalistic, open-source SAT solver, developed to help researchers
and developers alike to get started on SAT. It is released under the MIT licence,
and is currently used in a number of projects. http://minisat.se/
5. Niemel and P. Simons. Extending the Smodels system with cardinality and weight
constraints. In Jack Minker, editor, Logic-Based Artificial Intelligence, chapter 21,
pages 491521. Kluwer Academic Publishers, 2000. 435