next_inactive up previous







Computational Logic
Logic Programming:
Model and Fixpoint Semantics

Towards the Model and Fixpoint Semantics

Declarative Semantics - Herbrand Base and Universe

Declarative Semantics - Herbrand Base and Universe (example)

Herbrand Interpretations and Models

Declarative Semantics, Completeness, Correctness

Towards a Fixpoint Semantics for LP - Fixpoint Basics

Towards a Fixpoint Semantics for LP - Fixpoint Basics (Contd.)

Lattice Structures

\begin{center}\vbox{\input{/home/logalg/public_html/slides/Figs/finiteness_land.latex}
}\end{center}

A Fixpoint Semantics for Logic Programs

A Fixpoint Semantics for Logic Programs: Example 1 (finite)


$P = \{ $ $ p(X,a) \leftarrow q(X).$ 

$ p(X,Y) \leftarrow q(X),r(Y).$
$ q(a).     r(b).$
$ q(b).     r(c). $ }

$U_P = \{ a,b,c \}$


$B_P = \{ $ $p(a,a), p(a,b), p(a,c), p(b,a), p(b,b), p(b,c), p(c,a), p(c,b), p(c,c), $

$q(a), q(b), q(c), $
$r(a), r(b), r(c) \}$
$I_P = $ all subsets of $B_P$
$H_P = \{ q(a), q(b), r(b), r(c), p(a,a), p(b,a), p(a,b),
p(b,b), p(a,c), p(b,c) \}$

$T_P \uparrow 0 = \{ q(a), q(b), r(b), r(c) \}$
$T_P \uparrow 1 = \{ q(a), q(b), r(b), r(c) \} \cup \{ p(a,a), p(b,a), p(a,b), p(b,b), p(a,c), p(b,c) \}$
$T_P \uparrow 2 = T_P \uparrow 1 = lfp(T_P) = H_P$

A Fixpoint Semantics for Logic Programs: Example 2 (infinite)


$P = \{ $ $ p(f(X)) \leftarrow p(X).$ 

$ p(a).$
$ q(a).$
$ q(b). $ }
$U_P = \{a,b,f(a),f(b),f(f(a)),f(f(b)),\ldots\}$
$B_P = \{p(a),p(b),q(a),q(b),p(f(a)),p(f(b)),q(f(a)),\ldots\}$
$I_P = $ all subsets of $B_P$
$H_P = \{q(a),q(b),p(a) \} \cup \{ p(f^n(a))  \vert  n \in \cal{N} \}$
where we define $f^n(a)$ to be $f$ nested $n$ times and then applied to $a$.
(i.e., $q(a),q(b),p(a),p(f(a)),p(f(f(a))),p(f(f(f(a)))), ...$)

$T_P\uparrow 0 = \{p(a),q(a),q(b)\}$
$T_P\uparrow 1 = \{p(a),q(a),q(b),p(f(a))\}$
$T_P\uparrow 2 = \{p(a),q(a),q(b),p(f(a)),p(f(f(a)))\}$
$\ldots$
$T_P\uparrow \omega = H_P$

A Fixpoint Semantics for Logic Programs: Example 3 (infinite)

A Fixpoint Semantics for Logic Programs: Example 3 (infinite, cont.)


Constructing the least fixpoint of the $T_P$ operator:


$T_P \uparrow 0 $ = $\{ nat(0) \} \cup \{ sum(0,x,x)  \vert  x \in U_P \}$

$ T_P \uparrow 1 $ = $T_P \uparrow 0 $ $\cup  \{ nat(s(0)) \}$
$\cup  \{ sum(s(0),y,s(y))  \vert  y \in U_P \}$

$ T_P \uparrow 2 $ = $ T_P \uparrow 1 $ $\cup  \{ nat(s(s(0))) \}$
$\cup  \{ sum(s(s(0)),y,s(s(y)))  \vert  y \in U_P \}$

$T_P \uparrow 3 $ = $ T_P \uparrow 2 $ $\cup  \{ nat(s(s(s(0)))) \}$
$\cup  \{ sum(s(s(s(0))),y,s(s(s(y))))  \vert  y \in U_P \}$

...

$T_P \uparrow \omega $ = $\{ nat(x)  \vert  x \in U_P \}  \cup $
$\{ sum(s^n(0),y,s^n(y))  \vert  y \in U_P \wedge n \in \cal{N} \}$

where we define $s^x(y)$ to be $s$ nested $x$ times and then applied to $y$.

Semantics - Equivalences


next_inactive up previous
Last modification: Wed Jan 3 19:10:57 CET 2007 <webmaster@clip.dia.fi.upm.es>[CLIP] [FIM] [UNM]