Fix typos <noupdate>

This commit is contained in:
2024-01-01 17:09:15 +01:00
parent 9e25277c0d
commit a7933cf3ba
27 changed files with 193 additions and 190 deletions

View File

@ -44,7 +44,7 @@
\item[Goal] \marginnote{Goal}
$G := \top \mid \bot \mid A \mid C \mid G_1 \land G_2$
\item[Constraint logic clause] \marginnote{Constraint logic clause}
$K := A \leftarrow G$
$K := A \Leftarrow G$
\item[Constraint logic program] \marginnote{Constraint logic program}
$P := K_1 \dots K_m$, for $m \geq 0$
\end{description}
@ -67,17 +67,17 @@
Starting from the state $\langle A \land G, C \rangle$ of a program $P$, a transition on the atom $A$ can result in:
\begin{description}
\item[Unfold] \marginnote{Unfold}
If there exists a clause $(B \leftarrow H)$ in $P$ and
If there exists a clause $(B \Leftarrow H)$ in $P$ and
an assignment $(B \doteq A)$ such that $((B \doteq A) \land C)$ is still valid,
then we have a transition $\langle A \land G, C \rangle \mapsto \langle H \land G, (B \doteq A) \land C \rangle$.
In other words, we want to develop an atom $A$ and the current constraints are denoted as $C$.
We look for a clause whose head equals $A$, applying an assignment if needed.
If this is possible, we transit from solving $A$ to solving the body of the clause and
If this is possible, we transition from solving $A$ to solving the body of the clause and
add the assignment to the set of active constraints.
\item[Failure] \marginnote{Failure}
If there are no clauses $(B \leftarrow H)$ with a valid assignment $((B \doteq A) \land C)$,
If there are no clauses $(B \Leftarrow H)$ with a valid assignment $((B \doteq A) \land C)$,
then we have a transition $\langle A \land G, C \rangle \mapsto \langle \bot, \bot \rangle$.
\end{description}
@ -100,7 +100,7 @@
\begin{description}
\item[Generate-and-test] \marginnote{Generate-and-test}
Strategy adopted by logic programs.
Every possible assignment to the variables are generated and tested.
Every possible assignment to the variables is generated and tested.
The workflow is the following:
\begin{enumerate}

View File

@ -1,4 +1,4 @@
\chapter{First order logic}
\chapter{First-order logic}
\section{Syntax}
@ -12,12 +12,12 @@ The symbols of propositional logic are:
Unknown elements of the domain. Do not represent truth values.
\item[Function symbols]
Function $f^{(n)}$ applied on $n$ constants to obtain another constant.
Function $f^{(n)}$ applied on $n$ elements of the domain to obtain another element of the domain.
\item[Predicate symbols]
Function $P^{(n)}$ applied on $n$ constants to obtain a truth value.
Function $P^{(n)}$ applied on $n$ elements of the domain to obtain a truth value.
\item[Connectives] $\forall$ $\exists$ $\land$ $\vee$ $\rightarrow$ $\lnot$ $\leftrightarrow$ $\top$ $\bot$ $($ $)$
\item[Connectives] $\forall$ $\exists$ $\land$ $\vee$ $\Rightarrow$ $\lnot$ $\Leftrightarrow$ $\top$ $\bot$ $($ $)$
\end{descriptionlist}
Using the basic syntax, the following constructs can be defined:
@ -27,7 +27,7 @@ Using the basic syntax, the following constructs can be defined:
\item[Proposition] Denotes truth values.
\[
P := \top \,|\, \bot \,|\, P \land P \,|\, P \vee P \,|\, P \rightarrow P \,|\, P \leftrightarrow P \,|\,
P := \top \,|\, \bot \,|\, P \land P \,|\, P \vee P \,|\, P \Rightarrow P \,|\, P \Leftrightarrow P \,|\,
\lnot P \,|\, \forall x. P \,|\, \exists x. P \,|\, (P) \,|\, P^{(n)}(t_1, \dots, t_n)
\]
\end{descriptionlist}
@ -35,7 +35,7 @@ Using the basic syntax, the following constructs can be defined:
\begin{description}
\item[Well-formed formula] \marginnote{Well-formed formula}
The definition of well-formed formula in first order logic extends the one of
The definition of well-formed formula in first-order logic extends the one of
propositional logic by adding the following conditions:
\begin{itemize}
\item If S is well-formed, $\exists X. S$ is well-formed. Where $X$ is a variable.
@ -44,13 +44,13 @@ Using the basic syntax, the following constructs can be defined:
\item[Free variables] \marginnote{Free variables}
The universal and existential quantifiers bind their variable within the scope of the formula.
Let $F_v(F)$ be the set of free variables in a formula $F$, $F_v$ is defined as follows:
Let $\mathcal{F}_v(F)$ be the set of free variables in a formula $F$, $\mathcal{F}_v$ is defined as follows:
\begin{itemize}
\item $F_v(p(t)) = \bigcup \texttt{vars}(t)$
\item $F_v(\top) = F_v(\bot) = \varnothing$
\item $F_v(\lnot F) = F_v(F)$
\item $F_v(F_1 \land F_2) = F_v(F_1 \vee F_2) = F_v(F_1 \rightarrow F_2) = F_v(F_1) \cup F_v(F_2)$
\item $F_v(\forall X.F) = F_v(\exists X.F) = F_v(F) \smallsetminus \{ X \}$
\item $\mathcal{F}_v(p(t)) = \bigcup \{ \text{variables of $t$} \}$
\item $\mathcal{F}_v(\top) = \mathcal{F}_v(\bot) = \varnothing$
\item $\mathcal{F}_v(\lnot F) = \mathcal{F}_v(F)$
\item $\mathcal{F}_v(F_1 \land F_2) = \mathcal{F}_v(F_1 \vee F_2) = \mathcal{F}_v(F_1 \Rightarrow F_2) = \mathcal{F}_v(F_1) \cup \mathcal{F}_v(F_2)$
\item $\mathcal{F}_v(\forall X.F) = \mathcal{F}_v(\exists X.F) = \mathcal{F}_v(F) \smallsetminus \{ X \}$
\end{itemize}
\begin{description}
@ -60,7 +60,7 @@ Using the basic syntax, the following constructs can be defined:
\item[Theory] \marginnote{Theory}
Set of sentences.
\item[Ground term/Formula] \marginnote{Formula}
\item[Ground term/Ground formula] \marginnote{Ground term/Ground formula}
Proposition without variables.
\end{description}
\end{description}
@ -71,13 +71,13 @@ Using the basic syntax, the following constructs can be defined:
\begin{description}
\item[Interpretation] \marginnote{Interpretation}
An interpretation in first order logic $\mathcal{I}$ is a pair $(D, I)$:
An interpretation in first-order logic $\mathcal{I}$ is a pair $(D, I)$:
\begin{itemize}
\item $D$ is the domain of the terms.
\item $I$ is the interpretation function such that:
\begin{itemize}
\item $I(f): D^n \rightarrow D$ for every n-ary function symbol.
\item $I(p) \subseteq D^n$ for every n-ary predicate symbol.
\item The interpretation of an n-ary function symbol is a function $I(f): D^n \rightarrow D$.
\item The interpretation of an n-ary predicate symbol is a relation $I(p) \subseteq D^n$.
\end{itemize}
\end{itemize}
@ -101,22 +101,22 @@ Using the basic syntax, the following constructs can be defined:
\item[Logical consequence] \marginnote{Logical consequence}
A sentence $T_1$ is a logical consequence of $T_2$ ($T_2 \models T_1$) if
every model of $T_2$ is also model of $T_1$:
\[ \mathcal{I} \models T_2 \rightarrow \mathcal{I} \models T_1 \]
\[ \mathcal{I} \models T_2 \Rightarrow \mathcal{I} \models T_1 \]
\begin{theorem}
It is undecidable to determine if a first order logic formula is a tautology.
Determining if a first-order logic formula is a tautology is undecidable.
\end{theorem}
\item[Equivalence] \marginnote{Equivalence}
A sentence $T_1$ is equivalent to $T_2$ if $T_1 \models T_2$ and $T_2 \models T_1$.
A sentence $T_1$ is equivalent to $T_2$ iff $T_1 \models T_2$ and $T_2 \models T_1$.
\end{description}
\begin{theorem}
The following statements are equivalent:
\begin{enumerate}
\item $F_1, \dots, F_n \models G$.
\item $(\bigwedge_{i=1}^{n} F_i) \rightarrow G$ is valid.
\item $(\bigwedge_{i=1}^{n} F_i) \land \lnot G$ is unsatisfiable.
\item $F_1 \land \dots \land F_n \Rightarrow G$ is valid (i.e. deduction).
\item $F_1 \land \dots \land F_n \land \lnot G$ is unsatisfiable (i.e. refutation).
\end{enumerate}
\end{theorem}
@ -125,7 +125,7 @@ Using the basic syntax, the following constructs can be defined:
\begin{description}
\item[Substitution] \marginnote{Substitution}
A substitution $\sigma: \mathcal{V} \rightarrow \mathcal{T}$ is a mapping from variables to terms.
A substitution $\sigma: \mathcal{V} \Rightarrow \mathcal{T}$ is a mapping from variables to terms.
It is written as $\{ X_1 \mapsto t_1, \dots, X_n \mapsto t_n \}$.
The application of a substitution is the following:
@ -134,8 +134,8 @@ Using the basic syntax, the following constructs can be defined:
\item $f(t_1, \dots, t_n)\sigma = fp(t_1\sigma, \dots, t_n\sigma)$
\item $\bot\sigma = \bot$ and $\top\sigma = \top$
\item $(\lnot F)\sigma = (\lnot F\sigma)$
\item $(F_1 \star F_2)\sigma = (F_1\sigma \star F_2\sigma)$ for $\star \in \{ \land, \vee, \rightarrow \}$
\item $(\forall X.F)\sigma = \forall X' (F \sigma[X \mapsto X'])$ where $X'$ is a fresh variable (i.e. does not appear in $F$).
\item $(F_1 \star F_2)\sigma = (F_1\sigma \star F_2\sigma)$ for $\star \in \{ \land, \vee, \Rightarrow \}$
\item $(\forall X.F)\sigma = \forall X' (F \sigma[X \mapsto X'])$ where $X'$ is a fresh variable (i.e. it does not appear in $F$).
\item $(\exists X.F)\sigma = \exists X' (F \sigma[X \mapsto X'])$ where $X'$ is a fresh variable.
\end{itemize}

View File

@ -13,8 +13,8 @@ A logic program has the following components (defined using BNF):
\item[Horn clause] \marginnote{Horn clause}
A clause with at most one positive literal.
\[ K := A \leftarrow G \]
In other words, $A$ and all the literals in $G$ are positive as $A \leftarrow G = A \vee \lnot G$.
\[ K := A \Leftarrow G \]
In other words, $A$ and all the literals in $G$ are positive as $A \Leftarrow G = A \vee \lnot G$.
\item[Program] \marginnote{Program}
$P := K_1 \dots K_m$ for $m \geq 0$
@ -52,14 +52,14 @@ A logic program has the following components (defined using BNF):
\item[Computed answer substitution] \marginnote{Computed answer substitution}
Given a goal $G$ and a program $P$, if there exists a successful derivation
$\langle G, \varepsilon \rangle \mapsto* \langle \top, \theta \rangle$,
$\langle G, \varepsilon \rangle \mapsto^* \langle \top, \theta \rangle$,
then the substitution $\theta$ is the computed answer substitution of $G$.
\item[Transition] \marginnote{Transition}
Starting from the state $\langle A \land G, \theta \rangle$ of a program $P$, a transition on the atom $A$ can result in:
\begin{descriptionlist}
\item[Unfold]
If there exists a clause $(B \leftarrow H)$ in $P$ and
If there exists a clause $(B \Leftarrow H)$ in $P$ and
a (most general) unifier $\beta$ for $A\theta$ and $B$,
then we have a transition: $\langle A \land G, \theta \rangle \mapsto \langle H \land G, \theta\beta \rangle$.
@ -67,7 +67,7 @@ A logic program has the following components (defined using BNF):
To do this, we search for a clause that has as conclusion $A\theta$ and add its premise to the things to prove.
If a unification is needed to match $A\theta$, we add it to the substitutions of the state.
\item[Failure]
If there are no clauses $(B \leftarrow H)$ in $P$ with a unifier for $A\theta$ and $B$,
If there are no clauses $(B \Leftarrow H)$ in $P$ with a unifier for $A\theta$ and $B$,
then we have a transition: $\langle A \land G, \theta \rangle \mapsto \langle \bot, \varepsilon \rangle$.
\end{descriptionlist}
@ -79,7 +79,7 @@ A logic program has the following components (defined using BNF):
This affects the length of the derivation (infinite in the worst case).
\item[Don't-know] \marginnote{Don't-know}
Any clause $(B \rightarrow H)$ in $P$ with an unifier for $A\theta$ and $B$ can be chosen.
Any clause $(B \Leftarrow H)$ in $P$ with a unifier for $A\theta$ and $B$ can be chosen.
This determines the output of the derivation.
\end{descriptionlist}
\end{description}
@ -101,7 +101,7 @@ A logic program has the following components (defined using BNF):
\begin{theorem}[Completeness]
Given a program $P$, a goal $G$ and a substitution $\theta$,
if $P \models G\theta$, then it exists a computed answer substitution $\sigma$ such that $G\theta = G\sigma\beta$.
if $P \models G\theta$, then there exists a computed answer substitution $\sigma$ such that $G\theta = G\sigma\beta$.
\end{theorem}
\begin{theorem}

View File

@ -9,7 +9,7 @@
The symbols of propositional logic are:
\begin{descriptionlist}
\item[Proposition symbols] $p_0$, $p_1$, \dots
\item[Connectives] $\land$ $\vee$ $\rightarrow$ $\leftrightarrow$ $\lnot$ $\bot$ $($ $)$
\item[Connectives] $\land$ $\vee$ $\Rightarrow$ $\Leftrightarrow$ $\lnot$ $\bot$ $($ $)$
\end{descriptionlist}
\begin{description}
@ -22,12 +22,12 @@ The symbols of propositional logic are:
\item If $S_1$ and $S_2$ are well-formed, $S_1 \vee S_2$ is well-formed.
\end{itemize}
Note that the implication $S_1 \rightarrow S_2$ can be written as $\lnot S_1 \vee S_2$.
Note that the implication $S_1 \Rightarrow S_2$ can be written as $\lnot S_1 \vee S_2$.
The BNF definition of a formula is:
\[
F := \texttt{atomic\_proposition} \,|\, F \land F \,|\, F \vee F \,|\,
F \rightarrow F \,|\, F \leftrightarrow F \,|\, \lnot F \,|\, (F)
F \Rightarrow F \,|\, F \Leftrightarrow F \,|\, \lnot F \,|\, (F)
\]
% \[
% \begin{split}
@ -35,8 +35,8 @@ The symbols of propositional logic are:
% &\lnot \texttt{<formula>} \,|\, \\
% &\texttt{<formula>} \land \texttt{<formula>} \,|\, \\
% &\texttt{<formula>} \vee \texttt{<formula>} \,|\, \\
% &\texttt{<formula>} \rightarrow \texttt{<formula>} \,|\, \\
% &\texttt{<formula>} \leftrightarrow \texttt{<formula>} \,|\, \\
% &\texttt{<formula>} \Rightarrow \texttt{<formula>} \,|\, \\
% &\texttt{<formula>} \Leftrightarrow \texttt{<formula>} \,|\, \\
% &(\texttt{<formula>}) \\
% \end{split}
% \]
@ -64,7 +64,7 @@ The symbols of propositional logic are:
to the atoms $\{ A_1, \dots, A_n \}$ an element of $D$.
\end{itemize}
Note: given a formula $F$ of $n$ distinct atoms, there are $2^n$ district interpretations.
Note: given a formula $F$ of $n$ distinct atoms, there are $2^n$ distinct interpretations.
\begin{description}
\item[Model] \marginnote{Model}
@ -100,14 +100,14 @@ The symbols of propositional logic are:
\item $\lnot S$ is true iff $S$ is false.
\item $S_1 \land S_2$ is true iff $S_1$ is true and $S_2$ is true.
\item $S_1 \vee S_2$ is true iff $S_1$ is true or $S_2$ is true.
\item $S_1 \rightarrow S_2$ is true iff $S_1$ is false or $S_2$ is true.
\item $S_1 \leftrightarrow S_2$ is true iff $S_1 \rightarrow S_2$ is true and $S_1 \leftarrow S_2$ is true.
\item $S_1 \Rightarrow S_2$ is true iff $S_1$ is false or $S_2$ is true.
\item $S_1 \Leftrightarrow S_2$ is true iff $S_1 \Rightarrow S_2$ is true and $S_1 \Leftarrow S_2$ is true.
\end{itemize}
\item[Evaluation] \marginnote{Evaluation order}
The connectives of a propositional formula are evaluated in the order:
\[ \leftrightarrow, \rightarrow, \vee, \land, \lnot \]
The connectives of a propositional formula are evaluated in the following order:
\[ \Leftrightarrow, \Rightarrow, \vee, \land, \lnot \]
Formulas in parenthesis have higher priority.
\item[Logical consequence] \marginnote{Logical consequence}
@ -128,9 +128,9 @@ The symbols of propositional logic are:
\item[Associativity]: $((P \land Q) \land R) \equiv (P \land (Q \land R))$
and $((P \vee Q) \vee R) \equiv (P \vee (Q \vee R))$
\item[Double negation elimination]: $\lnot(\lnot P) \equiv P$
\item[Contraposition]: $(P \rightarrow Q) \equiv (\lnot Q \rightarrow \lnot P)$
\item[Implication elimination]: $(P \rightarrow Q) \equiv (\lnot P \vee Q)$
\item[Biconditional elimination]: $(P \leftrightarrow Q) \equiv ((P \rightarrow Q) \land (Q \rightarrow P))$
\item[Contraposition]: $(P \Rightarrow Q) \equiv (\lnot Q \Rightarrow \lnot P)$
\item[Implication elimination]: $(P \Rightarrow Q) \equiv (\lnot P \vee Q)$
\item[Biconditional elimination]: $(P \Leftrightarrow Q) \equiv ((P \Rightarrow Q) \land (Q \Rightarrow P))$
\item[De Morgan]: $\lnot(P \land Q) \equiv (\lnot P \vee \lnot Q)$ and $\lnot(P \vee Q) \equiv (\lnot P \land \lnot Q)$
\item[Distributivity of $\land$ over $\vee$]: $(P \land (Q \vee R)) \equiv ((P \land Q) \vee (P \land R))$
\item[Distributivity of $\vee$ over $\land$]: $(P \vee (Q \land R)) \equiv ((P \vee Q) \land (P \vee R))$
@ -179,34 +179,34 @@ The symbols of propositional logic are:
\begin{description}
\item[Sound] \marginnote{Soundness}
A reasoning method $E$ is sound iff:
\[ (\Gamma \vdash^E F) \rightarrow (\Gamma \models F) \]
\[ (\Gamma \vdash^E F) \Rightarrow (\Gamma \models F) \]
\item[Complete] \marginnote{Completeness}
A reasoning method $E$ is complete iff:
\[ (\Gamma \models F) \rightarrow (\Gamma \vdash^E F) \]
\[ (\Gamma \models F) \Rightarrow (\Gamma \vdash^E F) \]
\end{description}
\item[Deduction theorem] \marginnote{Deduction theorem}
Given a set of formulas $\{ F_1, \dots, F_n \}$ and a formula $G$:
\[ (F_1 \land \dots \land F_n) \models G \,\iff\, \models (F_1 \land \dots \land F_n) \rightarrow G \]
\[ (F_1 \land \dots \land F_n) \models G \,\iff\, \models (F_1 \land \dots \land F_n) \Rightarrow G \]
\begin{proof} \phantom{}
\begin{description}
\item[$\rightarrow$])
\item[$\Rightarrow$])
By hypothesis $(F_1 \land \dots \land F_n) \models G$.
So, for each interpretation $\mathcal{I}$ in which $(F_1 \land \dots \land F_n)$ is true,
$G$ is also true.
Therefore, $\mathcal{I} \models (F_1 \land \dots \land F_n) \rightarrow G$.
Therefore, $\mathcal{I} \models (F_1 \land \dots \land F_n) \Rightarrow G$.
Moreover, for each interpretation $\mathcal{I}'$ in which $(F_1 \land \dots \land F_n)$ is false,
$(F_1 \land \dots \land F_n) \rightarrow G$ is true.
Therefore, $\mathcal{I}' \models (F_1 \land \dots \land F_n) \rightarrow G$.
$(F_1 \land \dots \land F_n) \Rightarrow G$ is true.
Therefore, $\mathcal{I}' \models (F_1 \land \dots \land F_n) \Rightarrow G$.
In conclusion, $\models (F_1 \land \dots \land F_n) \rightarrow G$.
In conclusion, $\models (F_1 \land \dots \land F_n) \Rightarrow G$.
\item[$\leftarrow$])
By hypothesis $\models (F_1 \land \dots \land F_n) \rightarrow G$.
\item[$\Leftarrow$])
By hypothesis $\models (F_1 \land \dots \land F_n) \Rightarrow G$.
Therefore, for each interpretation where $(F_1 \land \dots \land F_n)$ is true,
$G$ is also true.
@ -240,9 +240,9 @@ The symbols of propositional logic are:
\begin{description}
\item[Natural deduction] \marginnote{Natural deduction for propositional logic}
Set of rules to introduce or eliminate connectives.
We consider a subset $\{ \land, \rightarrow, \bot \}$ of functionally complete connectives.
We consider a subset $\{ \land, \Rightarrow, \bot \}$ of functionally complete connectives.
Natural deduction can be represented using a tree like structure:
Natural deduction can be represented using a tree-like structure:
\begin{prooftree}
\AxiomC{[hypothesis]}
\noLine
@ -252,12 +252,14 @@ The symbols of propositional logic are:
\RightLabel{rule name}\UnaryInfC{conclusion}
\end{prooftree}
The conclusion is true when the hypothesis are able to prove the premise.
Another tree can be built on top of premises to prove them.
The conclusion is true when the hypotheses can prove the premise.
Another tree can be built on top of the premises to prove them.
\begin{descriptionlist}
\item[Introduction] \marginnote{Introduction rules}
Usually used to prove the conclusion by splitting it.\\
Usually used to prove the conclusion by splitting it.
Note that $\lnot \psi \equiv (\psi \Rightarrow \bot)$. \\
\begin{minipage}{.4\linewidth}
\begin{prooftree}
\AxiomC{$\psi$}
@ -272,7 +274,7 @@ The symbols of propositional logic are:
\UnaryInfC{\vdots}
\noLine
\UnaryInfC{$\psi$}
\RightLabel{$\rightarrow$I}\UnaryInfC{$\varphi \rightarrow \psi$}
\RightLabel{$\Rightarrow$I}\UnaryInfC{$\varphi \Rightarrow \psi$}
\end{prooftree}
\end{minipage}
@ -293,16 +295,18 @@ The symbols of propositional logic are:
\begin{minipage}{.3\linewidth}
\begin{prooftree}
\AxiomC{$\varphi$}
\AxiomC{$\varphi \rightarrow \psi$}
\RightLabel{$\rightarrow$E}\BinaryInfC{$\psi$}
\AxiomC{$\varphi \Rightarrow \psi$}
\RightLabel{$\Rightarrow$E}\BinaryInfC{$\psi$}
\end{prooftree}
\end{minipage}
\item[Ex falso sequitur quodlibet] \marginnote{Ex falso sequitur quodlibet}
From contradiction, anything follows.
This can be used when we have two contradicting hypothesis.
This can be used when we have two contradicting hypotheses.
\begin{prooftree}
\AxiomC{$\bot$}
\AxiomC{$\psi$}
\AxiomC{$\lnot \psi$}
\BinaryInfC{$\bot$}
\RightLabel{$\bot$}\UnaryInfC{$\varphi$}
\end{prooftree}