Add FAIKR2 probabilistic logic programming

This commit is contained in:
2023-12-08 20:58:52 +01:00
parent 04835d2cea
commit f24af7b16a
4 changed files with 129 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<mxfile host="app.diagrams.net" modified="2023-12-08T19:47:25.292Z" agent="Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0" etag="OSZXvqEczNiZXNqwfc7z" version="22.1.7" type="device">
<diagram name="Pagina-1" id="ed2_-DnoGlUrIFm0Tw4G">
<mxGraphModel dx="989" dy="500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-1" value="&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;sneezing(bob) :- flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;sneezing(bob) :- hay_fever(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;hay_fever(bob).&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;align=left;verticalAlign=top;fontFamily=Courier New;fontSize=16;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="80" y="250" width="320" height="90" as="geometry" />
</mxCell>
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-2" value="&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;null :- flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;sneezing(bob) :- hay_fever(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;hay_fever(bob).&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;align=left;verticalAlign=top;fontFamily=Courier New;fontSize=16;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="420" y="250" width="320" height="90" as="geometry" />
</mxCell>
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-3" value="&lt;font style=&quot;font-size: 20px;&quot;&gt;P&lt;/font&gt;&lt;font style=&quot;font-size: 20px;&quot;&gt;(w&lt;sub style=&quot;font-size: 20px;&quot;&gt;1&lt;/sub&gt;) = 0.7 · 0.8&lt;br style=&quot;font-size: 20px;&quot;&gt;&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Times New Roman;fontSize=20;" parent="1" vertex="1">
<mxGeometry x="80" y="220" width="320" height="30" as="geometry" />
</mxCell>
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-4" value="&lt;font style=&quot;font-size: 20px;&quot;&gt;P&lt;/font&gt;&lt;font style=&quot;font-size: 20px;&quot;&gt;(w&lt;sub style=&quot;font-size: 20px;&quot;&gt;2&lt;/sub&gt;) = 0.3 · 0.8&lt;br style=&quot;font-size: 20px;&quot;&gt;&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Times New Roman;fontSize=20;" parent="1" vertex="1">
<mxGeometry x="420" y="220" width="320" height="30" as="geometry" />
</mxCell>
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-5" value="&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;sneezing(bob) :- flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;null :- hay_fever(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;hay_fever(bob).&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;align=left;verticalAlign=top;fontFamily=Courier New;fontSize=16;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="80" y="390" width="320" height="90" as="geometry" />
</mxCell>
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-6" value="&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;null :- flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;null :- hay_fever(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;flu(bob).&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;hay_fever(bob).&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 16px;&quot;&gt;&lt;font style=&quot;font-size: 16px;&quot;&gt;&lt;br style=&quot;font-size: 16px;&quot;&gt;&lt;/font&gt;&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;align=left;verticalAlign=top;fontFamily=Courier New;fontSize=16;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="420" y="390" width="320" height="90" as="geometry" />
</mxCell>
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-7" value="&lt;font style=&quot;font-size: 20px;&quot;&gt;P&lt;/font&gt;&lt;font style=&quot;font-size: 20px;&quot;&gt;(w&lt;sub style=&quot;font-size: 20px;&quot;&gt;3&lt;/sub&gt;) = 0.7 · 0.2&lt;br style=&quot;font-size: 20px;&quot;&gt;&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Times New Roman;fontSize=20;" parent="1" vertex="1">
<mxGeometry x="80" y="360" width="320" height="30" as="geometry" />
</mxCell>
<mxCell id="ZAoLLnpvm8W4UGgeYZgy-8" value="&lt;font style=&quot;font-size: 20px;&quot;&gt;P&lt;/font&gt;&lt;font style=&quot;font-size: 20px;&quot;&gt;(w&lt;sub style=&quot;font-size: 20px;&quot;&gt;4&lt;/sub&gt;) = 0.3 · 0.2&lt;br style=&quot;font-size: 20px;&quot;&gt;&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Times New Roman;fontSize=20;" parent="1" vertex="1">
<mxGeometry x="420" y="360" width="320" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -12,5 +12,6 @@
\input{sections/_descriptive_logic.tex} \input{sections/_descriptive_logic.tex}
\input{sections/_semantic_web.tex} \input{sections/_semantic_web.tex}
\input{sections/_time_reasoning.tex} \input{sections/_time_reasoning.tex}
\input{sections/_probabilistic_reasoning.tex}
\end{document} \end{document}

View File

@ -0,0 +1,94 @@
\chapter{Probabilistic logic reasoning}
\begin{description}
\item[Probabilistic logic programming] \marginnote{Probabilistic logic programming}
Adds probability distributions over logic programs allowing to define different worlds.
Joint distributions can also be defined over worlds and allows to answer to queries.
\end{description}
\section{Logic programs with annotated disjunctions (LPAD)}
\marginnote{LPAD}
\subsection{Syntax}
\begin{description}
\item[\texttt{null}]
Atom that can only appear in the head of a clause and
cancels the clause (i.e. equivalent of not having the clause).
\end{description}
The head of each clause is defined as a disjunction of atoms, each with a probability.
More specifically, each clause has a probability distribution over its head.
\begin{example}
\phantom{}
\begin{lstlisting}
sneezing(X):0.7 ; null:0.3 :- flu(X).
sneezing(X):0.8 ; null:0.2 :- hay_fever(X).
\end{lstlisting}
\end{example}
\subsection{Distribution semantics}
\begin{description}
\item[Worlds] \marginnote{World}
Given a clause $C$ and a substitution $\theta$ such that $C\theta$ is ground,
the following operations are defined for LPAD:
\begin{descriptionlist}
\item[Atomic choice] \marginnote{Atomic choice}
An atomic choice $(C, \theta, i)$ is the selection of the $i$-th atom in the head of $C$ for grounding.
\item[Composite choice] \marginnote{Composite choice}
A composite choice $\kappa$ is a set of atomic choices.
The probability of a composite choice is the following:
\[ \prob{\kappa} = \prod_{(C, \theta, i) \in \kappa} \prob{C, i} \]
where $\prob{C, i}$ is the probability of choosing the $i$-th atom in the head of $C$.
\item[Selection] \marginnote{Selection}
A selection $\sigma$ is a composite choice where an atom from the head of each clause for each grounding has been chosen.
In other words, a selection can be defined only when the program is ground.
A selection $\sigma$ identifies a world $w_\sigma$ and has probability:
\[ \prob{w_\sigma} = \prob{\sigma} = \prod_{(C, \theta, i) \in \sigma} \prob{C, i} \]
\end{descriptionlist}
\begin{example}
Given the program:
\begin{lstlisting}
sneezing(X):0.7 ; null:0.3 :- flu(X).
sneezing(X):0.8 ; null:0.2 :- hay_fever(X).
\end{lstlisting}
The possible worlds are:
\begin{center}
\includegraphics[width=0.7\textwidth]{img/_probabilistic_logic_example.pdf}
\end{center}
\end{example}
\item[Queries] \marginnote{Queries}
Given a ground query $Q$ and a world $w$, the probability of $Q$ being true in $w$ is trivially:
\[
\prob{Q \mid w}
\begin{cases}
1 & \text{ if $Q$ is true in $w$}\\
0 & \text{ otherwise}
\end{cases}
\]
The overall probability of $Q$ is:
\[ \prob{Q} = \sum_w \prob{Q, w} = \sum_w \prob{Q \mid w}\prob{w} = \sum_{w \models Q} \prob{w} \]
\begin{example}
Given the program:
\begin{lstlisting}
sneezing(X):0.7 ; null:0.3 :- flu(X).
sneezing(X):0.8 ; null:0.2 :- hay_fever(X).
\end{lstlisting}
The probability of \texttt{sneezing(bob)} is:
\[ \prob{\texttt{sneezing(bob)}} = \prob{w_1} + \prob{w_2} + \prob{w_3} \]
\end{example}
\end{description}