content/first-order-logic/beyond/beyond.tex
1% Part: first-order-logic2% Chapter: beyond34\documentclass[../../../include/open-logic-chapter]{subfiles}56\begin{document}78\olchapter{fol}{byd}{Beyond First-order Logic}910\begin{editorial}11 This chapter, adapted from Jeremy Avigad's logic notes, gives the12 briefest of glimpses into which other logical systems there are. It13 is intended as a chapter suggesting further topics for study in a14 course that does not cover them. Each one of the topics mentioned15 here will---hopefully---eventually receive its own part-level16 treatment in the Open Logic Project.17\end{editorial}1819\olimport{introduction}2021\olimport{many-sorted-logic}2223\olimport{second-order-logic}2425\olimport{higher-order-logic}2627\olimport{intuitionistic-logic}2829\olimport{modal-logics}3031\olimport{other-logics}3233\OLEndChapterHook3435\end{document}
content/first-order-logic/beyond/introduction.tex
1% Part: first-order-logic2% Chapter: beyond3% Section: introduction45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{fol}{byd}{int}1011\olsection{Overview}1213First-order logic is not the only system of logic of interest: there14are many extensions and variations of first-order logic. A logic15typically consists of the formal specification of a language, usually,16but not always, a deductive system, and usually, but not always, an17intended semantics. But the technical use of the term raises an18obvious question: what do logics that are not first-order logic have19to do with the word ``logic,'' used in the intuitive or philosophical20sense? All of the systems described below are designed to model21reasoning of some form or another; can we say what makes them logical?2223No easy answers are forthcoming. The word ``logic'' is used in24different ways and in different contexts, and the notion, like that of25``truth,'' has been analyzed from numerous philosophical stances. For26example, one might take the goal of logical reasoning to be the27determination of which statements are necessarily true, true a priori,28true independent of the interpretation of the nonlogical terms, true29by virtue of their form, or true by linguistic convention; and each of30these conceptions requires a good deal of clarification. Even if one31restricts one's attention to the kind of logic used in mathematics,32there is little agreement as to its scope. For example, in the33\textit{Principia Mathematica}, Russell and Whitehead tried to develop34mathematics on the basis of logic, in the {\em logicist} tradition35begun by Frege. Their system of logic was a form of higher-type logic36similar to the one described below. In the end they were forced to37introduce axioms which, by most standards, do not seem purely logical38(notably, the axiom of infinity, and the axiom of reducibility), but39one might nonetheless hold that some forms of higher-order reasoning40should be accepted as logical. In contrast, Quine, whose ontology does41not admit ``propositions'' as legitimate objects of discourse, argues42that second-order and higher-order logic are really manifestations of43set theory in sheep's clothing; in other words, systems involving44quantification over predicates are not purely logical.4546For now, it is best to leave such philosophical issues for a rainy47day, and simply think of the systems below as formal idealizations of48various kinds of reasoning, logical or otherwise.4950\end{document}
content/first-order-logic/beyond/many-sorted-logic.tex
1% Part: first-order-logic2% Chapter: beyond3% Section: many-sorted-logic45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{fol}{byd}{msl}1011\olsection{Many-Sorted Logic}1213In first-order logic, variables and quantifiers range over a single14!!{domain}. But it is often useful to have multiple (disjoint)15!!{domain}s: for example, you might want to have !!a{domain} of numbers,16!!a{domain} of geometric objects, !!a{domain} of functions from17numbers to numbers, !!a{domain} of abelian groups, and so on.1819Many-sorted logic provides this kind of framework. One starts with a20list of ``sorts''---the ``sort'' of an object indicates the21``!!{domain}'' it is supposed to inhabit. One then has !!{variable}s22and quantifiers for each sort, and (usually) an !!{identity} for each23sort. Functions and relations are also ``typed'' by the sorts of24objects they can take as arguments. Otherwise, one keeps the usual25rules of first-order logic, with versions of the quantifier-rules26repeated for each sort.2728For example, to study international relations we might choose a29language with two sorts of objects, French citizens and German30citizens. We might have a unary relation, ``drinks wine,'' for objects31of the first sort; another unary relation, ``eats wurst,'' for objects32of the second sort; and a binary relation, ``forms a multinational33married couple,'' which takes two arguments, where the first argument34is of the first sort and the second argument is of the second sort. If35we use variables $a$, $b$, $c$ to range over French citizens and $x$, $y$, $z$36to range over German citizens, then37\[38\lforall[a][\lforall x][(\Atom{\Obj{MarriedTo}}{a,x} \lif39(\Atom{\Obj{DrinksWine}}{a} \lor \lnot \Atom{\Obj{EatsWurst}}{x})]]40\]41asserts that if any French person is married to a German, either the42French person drinks wine or the German doesn't eat wurst.4344Many-sorted logic can be embedded in first-order logic in a natural45way, by lumping all the objects of the many-sorted !!{domain}s together46into one first-order !!{domain}, using unary !!{predicate}s to keep track of47the sorts, and relativizing quantifiers. For example, the first-order48language corresponding to the example above would have unary !!{predicate}s49``$\Obj{German}$'' and ``$\Obj{French}$,'' in addition to the other relations50described, with the sort requirements erased. A sorted quantifier $\lforall[x][!A]$, where $x$ is !!a{variable} of the German sort, translates to51\[52\lforall[x][(\Atom{\Obj{German}}{x} \lif !A)].53\]54We need to add axioms that insure that the sorts are separate---e.g.,55$\lforall[x][\lnot (\Atom{\Obj{German}}{x} \land56 \Atom{\Obj{French}}{x})]$---as well as axioms that guarantee that57``drinks wine'' only holds of objects satisfying the predicate58$\Atom{\Obj{French}}{x}$, etc. With these conventions and axioms, it59is not difficult to show that many-sorted !!{sentence}s translate to60first-order !!{sentence}s, and many-sorted !!{derivation}s translate61to first-order !!{derivation}s. Also, many-sorted !!{structure}s62``translate'' to corresponding first-order !!{structure}s and63vice-versa, so we also have a completeness theorem for many-sorted64logic.6566\end{document}67
content/first-order-logic/beyond/second-order-logic.tex
1% Part: first-order-logic2% Chapter: beyond3% Section: second-order-logic45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{fol}{byd}{sol}1011\olsection{Second-Order logic}1213The language of second-order logic allows one to quantify not just14over !!a{domain} of individuals, but over relations on that15!!{domain} as well. Given a first-order language $\Lang{L}$, for each16$k$ one adds !!{variable}s $R$ which range over $k$-ary relations, and17allows quantification over those variables. If $R$ is !!a{variable} for a18$k$-ary relation, and $t_1$, \dots,~$t_k$ are ordinary (first-order) terms,19$\Atom{R}{t_1,\dots,t_k}$ is an atomic !!{formula}. Otherwise, the set of20!!{formula}s is defined just as in the case of first-order logic, with21additional clauses for second-order quantification. Note that we only22have the !!{identity} for first-order terms: if $R$ and $S$ are relation23!!{variable}s of the same arity~$k$, we can define $\eq[R][S]$ to be an24abbreviation for25\[26\lforall[x_1 \dots][\lforall[x_k][(\Atom{R}{x_1, \dots, x_k} \liff27 \Atom{S}{x_1, \dots, x_k})]].28\]2930The rules for second-order logic simply extend the quantifier rules to31the new second order variables. Here, however, one has to be a little32bit careful to explain how these variables interact with the !!{predicate}s33of~$\Lang{L}$, and with !!{formula}s of~$\Lang{L}$ more generally. At the bare34minimum, relation variables count as terms, so one has inferences of35the form36\[37!A(R) \Proves \lexists[R][!A(R)]38\]39But if $\Lang{L}$ is the language of arithmetic with a constant40relation symbol~$<$, one would also expect the following inference to41be valid:42\[43x < y \Proves \lexists[R][\Atom{R}{x,y}]44\]45or for a given !!{formula}~$!A$,46\[47!A(x_1, \dots, x_k) \Proves \lexists[R][\Atom{R}{x_1,\dots,x_k}]48\]49More generally, we might want to allow inferences of the form50\[51\Subst{!A}{\lambd[\vec x][!B(\vec x)]}{R} \Proves52\lexists[R][!A]53\]54where $\Subst{!A}{\lambd[\vec x][!B(\vec x)]}{R}$ denotes the result55of replacing every atomic !!{formula} of the form56$\Obj{R}{t_1,\dots,t_k}$ in~$!A$ by $!B(t_1, \dots, t_k)$. This last57rule is equivalent to having a {\em comprehension schema}, i.e., an58axiom of the form59\[60\lexists[R][\lforall[x_1, \dots, x_k][(!A(x_1, \dots, x_k) \liff61\Atom{R}{x_1, \dots, x_k})]],62\]63one for each !!{formula}~$!A$ in the second-order language, in which64$R$ is not a free variable. (Exercise: show that if $R$ is allowed to65occur in~$!A$, this schema is inconsistent!)6667When logicians refer to the ``axioms of second-order logic'' they68usually mean the minimal extension of first-order logic by69second-order quantifier rules together with the comprehension70schema. But it is often interesting to study weaker subsystems of71these axioms and rules. For example, note that in its full generality72the axiom schema of comprehension is \emph{impredicative}: it allows73one to assert the existence of a relation $\Atom{R}{x_1, \dots, x_k}$74that is ``defined'' by !!a{formula} with second-order quantifiers; and75these quantifiers range over the set of all such relations---a set76which includes $R$ itself!{} Around the turn of the twentieth century, a77common reaction to Russell's paradox was to lay the blame on such78definitions, and to avoid them in developing the foundations of79mathematics. If one prohibits the use of second-order quantifiers in80the !!{formula}~$!A$, one has a {\em predicative} form of81comprehension, which is somewhat weaker.8283From the semantic point of view, one can think of a second-order84!!{structure} as consisting of a first-order !!{structure} for the85language, coupled with a set of relations on the !!{domain} over which86the second-order quantifiers range (more precisely, for each $k$ there87is a set of relations of arity~$k$). Of course, if comprehension is88included in the !!{derivation} system, then we have the added requirement that89there are enough relations in the ``second-order part'' to satisfy the90comprehension axioms---otherwise the !!{derivation} system is not sound!{} One91easy way to ensure that there are enough relations around is to take92the second-order part to consist of \emph{all} the relations on the93first-order part. Such !!a{structure} is called \emph{full}, and, in a94sense, is really the ``intended !!{structure}'' for the language. If95we restrict our attention to full !!{structure}s we have what is known96as the \emph{full} second-order semantics. In that case, specifying a97!!{structure} boils down to specifying the first-order part, since the98contents of the second-order part follow from that implicitly.99100To summarize, there is some ambiguity when talking about second-order101logic. In terms of the !!{derivation} system, one might have in mind either102\begin{enumerate}103\item A ``minimal'' second-order !!{derivation} system, together with some104 comprehension axioms.105\item The ``standard'' second-order !!{derivation} system, with full106 comprehension.107\end{enumerate}108In terms of the semantics, one might be interested in either109\begin{enumerate}110\item The ``weak'' semantics, where !!a{structure} consists of a first-order111 part, together with a second-order part big enough to satisfy the112 comprehension axioms.113\item The ``standard'' second-order semantics, in which one considers114 full !!{structure}s only.115\end{enumerate}116When logicians do not specify the !!{derivation} system or the semantics they117have in mind, they are usually referring to the second item on each118list. The advantage to using this semantics is that, as we will see,119it gives us categorical descriptions of many natural mathematical120structures; at the same time, the !!{derivation} system is quite strong, and121sound for this semantics. The drawback is that the !!{derivation} system is122\emph{not} complete for the semantics; in fact, \emph{no} effectively123given !!{derivation} system is complete for the full second-order semantics. On124the other hand, we will see that the !!{derivation} system \emph{is} complete125for the weakened semantics; this implies that if a sentence is not126provable, then there is \emph{some} !!{structure}, not necessarily the127full one, in which it is false.128129The language of second-order logic is quite rich. One can identify130unary relations with subsets of the !!{domain}, and so in particular you131can quantify over these sets; for example, one can express induction132for the natural numbers with a single axiom133\[134\lforall[R][((\Atom{R}{\Obj{0}} \land \lforall[x][(\Atom{R}{x} \lif135 \Atom{R}{x'})]) \lif \lforall[x][\Atom{R}{x}])].136\]137If one takes the language of arithmetic to have symbols $\Obj 0, \Obj \prime, +,138\times$ and $<$, one can add the following axioms to describe their139behavior:140\begin{enumerate}141\item $\lforall[x][\lnot x' = \Obj 0]$142\item $\lforall[x][\lforall[y][(s(x) = s(y) \lif x = y)]]$143\item $\lforall[x][(x + \Obj 0) = x]$144\item $\lforall[x][\lforall[y][(x + y') = (x + y)']]$145\item $\lforall[x][(x \times \Obj 0) = \Obj 0]$146\item $\lforall[x][\lforall[y][(x \times y') = ((x \times y) + x)]]$147\item $\lforall[x][\lforall[y][(x < y \liff \lexists[z][y = (x + z')])]]$148\end{enumerate}149It is not difficult to show that these axioms, together with the axiom150of induction above, provide a categorical description of the151!!{structure}~$\Struct{N}$, the standard model of arithmetic, provided152we are using the full second-order semantics. Given any153!!{structure}~$\Struct{M}$ in which these axioms are true, define a154function~$f$ from $\Nat$ to the !!{domain} of $\Struct{M}$ using155ordinary recursion on $\Nat$, so that $f(0) = \Assign{\Obj 0}{M}$ and156$f(x+1) = \Assign{\prime}{M}(f(x))$. Using ordinary induction157on~$\Nat$ and the fact that axioms (1) and~(2) hold in~$\Struct M$, we158see that $f$ is !!{injective}. To see that $f$ is !!{surjective},159let~$P$ be the set of elements of~$\Domain{M}$ that are in the range160of~$f$. Since $\Struct M$ is full, $P$ is in the second-order161!!{domain}. By the construction of~$f$, we know that $\Assign{\Obj162 0}{M}$ is in~$P$, and that $P$~is closed under163$\Assign{\prime}{M}$. The fact that the induction axiom holds in164$\Struct M$ (in particular, for~$P$) guarantees that $P$~is equal to165the entire first-order !!{domain} of~$\Struct M$. This shows that $f$166is !!a{bijection}. Showing that $f$ is a homomorphism is no more167difficult, using ordinary induction on $\Nat$ repeatedly.168169In set-theoretic terms, a function is just a special kind of relation;170for example, a unary function~$f$ can be identified with a binary171relation~$R$ satisfying $\lforall[x][\lexists![y][R(x,y)]]$. As a result, one172can quantify over functions too. Using the full semantics, one can173then define the class of infinite !!{structure}s to be the class of174!!{structure}s $\Struct M$ for which there is an injective function from the175!!{domain} of $\Struct M$ to a proper subset of itself:176\[177\lexists[f][(\lforall[x][\lforall[y][(\eq[f(x)][f(y)] \lif \eq[x][y])]]178 \land \lexists[y][\lforall[x][\eq/[f(x)][y]]])].179\]180The negation of this sentence then defines the class of finite181!!{structure}s.182183In addition, one can define the class of well-orderings, by adding the184following to the definition of a linear ordering:185\[186\lforall[P][(\lexists[x][\Atom{P}{x}] \lif \lexists[x][(\Atom{P}{x}187 \land \lforall[y][(y < x \lif \lnot \Atom{P}{y})])])].188\]189This asserts that every non-empty set has a least element, modulo the190identification of ``set'' with ``one-place relation''. For another191example, one can express the notion of connectedness for graphs, by192saying that there is no nontrivial separation of the vertices into193disconnected parts:194\[195\lnot \lexists[A][(\lexists[x][A(x)] \land \lexists[y][\lnot A(y)]196 \land \lforall[w][\lforall[z][((\Atom{A}{w} \land \lnot \Atom{A}{z})197 \lif \lnot \Atom{R}{w,z})]])].198\]199For yet another example, you might try as an exercise to define the200class of finite !!{structure}s whose !!{domain} has even size. More201strikingly, one can provide a categorical description of the real202numbers as a complete ordered field containing the rationals.203204In short, second-order logic is much more expressive than first-order205logic. That's the good news; now for the bad. We have already206mentioned that there is no effective !!{derivation} system that is complete for207the full second-order semantics. For better or for worse, many of the208properties of first-order logic are absent, including compactness and209the L\"owenheim--Skolem theorems.210211On the other hand, if one is willing to give up the full second-order212semantics in terms of the weaker one, then the minimal second-order213!!{derivation} system is complete for this semantics. In other words, if we214read $\Proves$ as ``proves in the minimal system'' and $\Entails$ as215``logically implies in the weaker semantics'', we can show that216whenever $\Gamma \Entails !A$ then $\Gamma \Proves !A$. If one wants217to include specific comprehension axioms in the !!{derivation} system, one has218to restrict the semantics to second-order structures that satisfy219these axioms: for example, if $\Delta$ consists of a set of220comprehension axioms (possibly all of them), we have that if $\Gamma221\cup \Delta \Entails !A$, then $\Gamma \cup \Delta \Proves !A$. In222particular, if $!A$ is not provable using the comprehension axioms we223are considering, then there is a model of $\lnot !A$ in which these224comprehension axioms nonetheless hold.225226The easiest way to see that the completeness theorem holds for the227weaker semantics is to think of second-order logic as a many-sorted228logic, as follows. One sort is interpreted as the ordinary229``first-order'' !!{domain}, and then for each $k$ we have !!a{domain}230of ``relations of arity $k$.'' We take the language to have built-in231relation symbols ``$\Atom{\Obj{true}_k}{R,x_1,\dots,x_k}$'' which is232meant to assert that $R$ holds of $x_1$, \dots,~$x_k$, where $R$ is a233variable of the sort ``$k$-ary relation'' and $x_1$, \dots,~$x_k$ are234objects of the first-order sort.235236With this identification, the weak second-order semantics is essentially237the usual semantics for many-sorted logic; and we have already238observed that many-sorted logic can be embedded in first-order logic.239Modulo the translations back and forth, then, the weaker conception of240second-order logic is really a form of first-order logic in disguise,241where the !!{domain} contains both ``objects'' and ``relations''242governed by the appropriate axioms.243244\end{document}245
content/first-order-logic/beyond/higher-order-logic.tex
1% Part: first-order-logic2% Chapter: beyond3% Section: higher-order-logic45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{fol}{byd}{hol}1011\olsection{Higher-Order logic}1213Passing from first-order logic to second-order logic enabled us to14talk about sets of objects in the first-order !!{domain}, within the15formal language. Why stop there? For example, third-order logic should16enable us to deal with sets of sets of objects, or perhaps even sets17which contain both objects and sets of objects. And fourth-order logic18will let us talk about sets of objects of that kind. As you may have19guessed, one can iterate this idea arbitrarily.2021In practice, higher-order logic is often !!{formula}ted in terms of22functions instead of relations. (Modulo the natural identifications,23this difference is inessential.) Given some basic ``sorts'' $A$, $B$,24$C$,~\dots (which we will now call ``types''), we can create new ones25by stipulating26\begin{quote}27If $\sigma$ and $\tau$ are finite types then so is $\sigma \to \tau$.28\end{quote}29Think of types as syntactic ``labels,'' which classify the objects we30want in our !!{domain}; $\sigma \to \tau$ describes those objects that31are functions which take objects of type~$\sigma$ to objects of32type~$\tau$. For example, we might want to have a type $\Omega$ of33truth values, ``true'' and ``false,'' and a type $\Nat$ of natural34numbers. In that case, you can think of objects of type $\Nat \to35\Omega$ as unary relations, or subsets of $\Nat$; objects of type36$\Nat \to \Nat$ are functions from natural numbers to natural numbers;37and objects of type $(\Nat \to \Nat) \to \Nat$ are ``functionals,''38that is, higher-type functions that take functions to numbers.3940As in the case of second-order logic, one can think of higher-order41logic as a kind of many-sorted logic, where there is a sort for each42type of object we want to consider. But it is usually clearer just to43define the syntax of higher-type logic from the ground up. For44example, we can define a set of finite types inductively, as follows:45\begin{enumerate}46\item $\Nat$ is a finite type.47\item If $\sigma$ and $\tau$ are finite types, then so is $\sigma48 \to \tau$.49\item If $\sigma$ and $\tau$ are finite types, so is $\sigma \times50 \tau$.51\end{enumerate}52Intuitively, $\Nat$ denotes the type of the natural numbers,53$\sigma \to \tau$ denotes the type of functions from $\sigma$ to54$\tau$, and $\sigma \times \tau$ denotes the type of pairs of objects,55one from $\sigma$ and one from $\tau$. We can then define a set of56terms inductively, as follows:57\begin{enumerate}58\item For each type $\sigma$, there is a stock of variables $x$, $y$,59 $z$, \dots of type $\sigma$60\item $\Obj 0$ is a term of type $\Nat$61\item $\Obj S$ (successor) is a term of type $\Nat \to \Nat$62\item If $s$ is a term of type $\sigma$, and $t$ is a term of type63 $\Nat \to (\sigma \to \sigma)$, then $\Obj{R}_{st}$ is a term of type64 $\Nat \to \sigma$65\item If $s$ is a term of type $\tau \to \sigma$ and $t$ is a66 term of type~$\tau$, then $s(t)$ is a term of type $\sigma$67\item If $s$ is a term of type~$\sigma$ and $x$ is a variable of68 type~$\tau$, then $\lambd[x][s]$ is a term of type $\tau \to \sigma$.69\item If $s$ is a term of type~$\sigma$ and $t$ is a term of70 type~$\tau$, then $\tuple{s, t}$ is a term of type $\sigma \times71 \tau$.72\item If $s$ is a term of type~$\sigma \times \tau$ then $p_1(s)$ is a73 term of type~$\sigma$ and $p_2(s)$ is a term of type~$\tau$.74\end{enumerate}75Intuitively, $\Obj{R}_{st}$ denotes the function defined recursively by76\begin{align*}77\Obj{R}_{st}(0) & = s \\78\Obj{R}_{st}(x+1) & = t(x, R_{st}(x)),79\end{align*}80$\tuple{s, t}$ denotes the pair whose first component is~$s$ and whose81second component is~$t$, and $p_1(s)$ and~$p_2(s)$ denote the first82and second elements (``projections'') of~$s$. Finally, $\lambd[x][s]$83denotes the function~$f$ defined by84\[85f(x) = s86\]87for any~$x$ of type~$\sigma$; so item (6) gives us a form of88comprehension, enabling us to define functions using89terms. !!^{formula}s are built up from !!{identity} statements $\eq[s][t]$90between terms of the same type, the usual propositional connectives,91and higher-type quantification. One can then take the axioms of the92system to be the basic equations governing the terms defined above,93together with the usual rules of logic with quantifiers and !!{identity}.9495If one augments the finite type system with a type $\Omega$ of truth96values, one has to include axioms which govern its use as well. In97fact, if one is clever, one can get rid of complex !!{formula}s98entirely, replacing them with terms of type $\Omega$!{} The proof99system can then be modified accordingly. The result is essentially the100\emph{simple theory of types} set forth by Alonzo Church in the 1930s.101102As in the case of second-order logic, there are different versions of103higher-type semantics that one might want to use. In the full version,104variables of type $\sigma \to \tau$ range over the set of \emph{all}105functions from the objects of type~$\sigma$ to objects of type~$\tau$.106As you might expect, this semantics is too strong to admit a complete,107effective !!{derivation} system. But one can consider a weaker semantics, in108which !!a{structure} consists of sets of elements $T_\tau$ for each109type $\tau$, together with appropriate operations for application,110projection, etc. If the details are carried out correctly, one can111obtain completeness theorems for the kinds of !!{derivation} systems described112above.113114Higher-type logic is attractive because it provides a framework in115which we can embed a good deal of mathematics in a natural way:116starting with $\Nat$, one can define real numbers, continuous117functions, and so on. It is also particularly attractive in the118context of intuitionistic logic, since the types have clear119``constructive'' interpretations. In fact, one can develop constructive120versions of higher-type semantics (based on intuitionistic, rather121than classical logic) that clarify these constructive interpretations122quite nicely, and are, in many ways, more interesting than the123classical counterparts.124125\end{document}
content/first-order-logic/beyond/intuitionistic-logic.tex
1% Part: first-order-logic2% Chapter: beyond3% Section: intuitionistic-logic45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{fol}{byd}{il}1011\olsection{Intuitionistic Logic}1213In contrast to second-order and higher-order logic, intuitionistic14first-order logic represents a restriction of the classical version,15intended to model a more ``constructive'' kind of reasoning. The16following examples may serve to illustrate some of the underlying17motivations.1819Suppose someone came up to you one day and announced that they had20determined a natural number~$x$, with the property that if $x$ is21prime, the Riemann hypothesis is true, and if $x$ is composite, the22Riemann hypothesis is false. Great news!{} Whether the Riemann23hypothesis is true or not is one of the big open questions of24mathematics, and here they seem to have reduced the problem to one of25calculation, that is, to the determination of whether a specific26number is prime or not.2728What is the magic value of $x$? They describe it as follows: $x$ is29the natural number that is equal to $7$ if the Riemann hypothesis is30true, and $9$ otherwise.3132Angrily, you demand your money back. From a classical point of view,33the description above does in fact determine a unique value of $x$;34but what you really want is a value of $x$ that is given35\emph{explicitly}.3637To take another, perhaps less contrived example, consider the38following question. We know that it is possible to raise an irrational39number to a rational power, and get a rational result. For example,40$\sqrt{2}^2 = 2$. What is less clear is whether or not it is possible41to raise an irrational number to an \emph{irrational} power, and get a42rational result. The following theorem answers this in the43affirmative:4445\begin{thm}46There are irrational numbers $a$ and $b$ such that $a^b$ is rational.47\end{thm}4849\begin{proof}50Consider $\sqrt{2}^{\sqrt{2}}$. If this is rational, we are done:51we can let $a = b = \sqrt{2}$. Otherwise, it is irrational. Then we52have53\[54(\sqrt{2}^{\sqrt{2}})^{\sqrt{2}} = \sqrt{2}^{\sqrt{2} \cdot55 \sqrt{2}} = \sqrt{2}^2 = 2,56\]57which is certainly rational. So, in this case, let $a$ be58$\sqrt{2}^{\sqrt{2}}$, and let $b$ be~$\sqrt 2$.59\end{proof}6061Does this constitute a valid proof? Most mathematicians feel that it62does. But again, there is something a little bit unsatisfying here: we63have proved the existence of a pair of real numbers with a certain64property, without being able to say \emph{which} pair of numbers it65is. It is possible to prove the same result, but in such a way that66the pair $a$, $b$ \emph{is} given in the proof: take $a = \sqrt{3}$67and $b = \log_3 4$. Then68\[69a^b = \sqrt{3}^{\log_3 4} = 3^{1/2 \cdot \log_3 4} = (3^{\log_370 4})^{1/2} = 4^{1/2}= 2,71\]72since $3^{\log_3 x} = x$.7374Intuitionistic logic is designed to model a kind of reasoning where75moves like the one in the first proof are disallowed. Proving the76existence of an $x$ satisfying~$!A(x)$ means that you have to give a77specific~$x$, and a proof that it satisfies $!A$, like in the second78proof. Proving that $!A$ or $!B$ holds requires that you can prove one79or the other.8081Formally speaking, intuitionistic first-order logic is what you get if82you restrict !!a{derivation} system for first-order logic in a certain83way. Similarly, there are intuitionistic versions of second-order or84higher-order logic. From the mathematical point of view, these are85just formal deductive systems, but, as already noted, they are86intended to model a kind of mathematical reasoning. One can take this87to be the kind of reasoning that is justified on a certain88philosophical view of mathematics (such as Brouwer's intuitionism);89one can take it to be a kind of mathematical reasoning which is more90``concrete'' and satisfying (along the lines of Bishop's91constructivism); and one can argue about whether or not the formal92description captures the informal motivation. But whatever93philosophical positions we may hold, we can study intuitionistic logic94as a formally presented logic; and for whatever reasons, many95mathematical logicians find it interesting to do so.9697There is an informal constructive interpretation of the intuitionist98connectives, usually known as the BHK interpretation (named after99Brouwer, Heyting, and Kolmogorov). It runs as follows: a proof of $!A100\land !B$ consists of a proof of $!A$ paired with a proof of $!B$; a101proof of $!A \lor !B$ consists of either a proof of $!A$, or a proof102of $!B$, where we have explicit information as to which is the case; a103proof of $!A \lif !B$ consists of a procedure, which transforms a104proof of $!A$ to a proof of~$!B$; a proof of $\lforall[x][!A(x)]$105consists of a procedure which returns a proof of $!A(x)$ for any value106of~$x$; and a proof of $\lexists[x][!A(x)]$ consists of a value107of~$x$, together with a proof that this value satisfies~$!A$. One can108describe the interpretation in computational terms known as the109``Curry--Howard isomorphism'' or the ``!!{formula}s-as-types110paradigm'': think of !!a{formula} as specifying a certain kind of111data type, and proofs as computational objects of these data types112that enable us to see that the corresponding !!{formula} is true.113114Intuitionistic logic is often thought of as being classical logic115``minus'' the law of the excluded middle. This following theorem makes116this more precise.117\begin{thm}118Intuitionistically, the following axiom schemata are equivalent:119\begin{enumerate}120\item $(\lnot !A \lif \lfalse) \lif !A$.121\item $!A \lor \lnot !A$122\item $\lnot \lnot !A \lif !A$123\end{enumerate}124\end{thm}125Obtaining instances of one schema from either of the others is a good126exercise in intuitionistic logic.127128The first deductive systems for intuitionistic propositional129logic, put forth as formalizations of Brouwer's intuitionism, are due,130independently, to Kolmogorov, Glivenko, and Heyting. The first131formalization of intuitionistic first-order logic (and parts of132intuitionist mathematics) is due to Heyting. Though a number of133classically valid schemata are not intuitionistically valid, many are.134135The \emph{double-negation translation} describes an important136relationship between classical and intuitionist logic. It is defined137inductively follows (think of $!A^N$ as the ``intuitionist''138translation of the classical !!{formula}~$!A$):139\begin{align*}140!A^N & \ident \lnot\lnot !A \quad \text{for atomic !!{formula}s $!A$} \\141(!A \land !B)^N & \ident (!A^N \land !B^N) \\142(!A \lor !B)^N & \ident \lnot\lnot (!A^N \lor !B^N) \\143(!A \lif !B)^N & \ident (!A^N \lif !B^N) \\144(\lforall[x][!A])^N & \ident \lforall[x][!A^N] \\145(\lexists[x][!A])^N & \ident \lnot\lnot\lexists[x][!A^N]146\end{align*}147Kolmogorov and Glivenko had versions of this translation for148propositional logic; for predicate logic, it is due to G\"odel and149Gentzen, independently. We have150151\begin{thm}152\begin{enumerate}153\item $!A \liff !A^N$ is provable classically154\item If $!A$ is provable classically, then $!A^N$ is provable155 intuitionistically.156\end{enumerate}157\end{thm}158159We can now envision the following dialogue. Classical mathematician:160``I've proved $!A$!'' Intuitionist mathematician: ``Your proof isn't161valid. What you've really proved is $!A^N$.'' Classical mathematician:162``Fine by me!'' As far as the classical mathematician is concerned, the163intuitionist is just splitting hairs, since the two are164equivalent. But the intuitionist insists there is a difference.165166Note that the above translation concerns pure logic only; it does not167address the question as to what the appropriate \emph{nonlogical}168axioms are for classical and intuitionistic mathematics, or what the169relationship is between them. But the following slight extension of170the theorem above provides some useful information:171172\begin{thm}173If $\Gamma$ proves $!A$ classically, $\Gamma^N$ proves $!A^N$174intuitionistically.175\end{thm}176177In other words, if $!A$ is provable from some hypotheses classically,178then $!A^N$ is provable from their double-negation translations.179180To show that a sentence or propositional !!{formula} is intuitionistically181valid, all you have to do is provide a proof. But how can you show182that it is not valid? For that purpose, we need a semantics183that is sound, and preferably complete. A semantics184due to Kripke nicely fits the bill.185186We can play the same game we did for classical logic: define the187semantics, and prove soundness and completeness. It is worthwhile,188however, to note the following distinction. In the case of classical189logic, the semantics was the ``obvious'' one, in a sense implicit in190the meaning of the connectives. Though one can provide some intuitive191motivation for Kripke semantics, the latter does not offer the same192feeling of inevitability. In addition, the notion of a classical193!!{structure} is a natural mathematical one, so we can either take the194notion of !!a{structure} to be a tool for studying classical first-order195logic, or take classical first-order logic to be a tool for studying196mathematical !!{structure}s. In contrast, Kripke !!{structure}s can only be197viewed as a logical construct; they don't seem to have independent198mathematical interest.199200A Kripke !!{structure}~$\mModel M = \tuple{W, R, V}$ for a propositional201language consists of a set~$W$, partial order~$R$ on~$W$ with a least202!!{element}, and an ``monotone'' assignment of propositional variables to203the !!{element}s of~$W$. The intuition is that the !!{element}s of $W$204represent ``worlds,'' or ``states of knowledge''; an element $v \geq205u$ represents a ``possible future state'' of~$u$; and the206propositional variables assigned to~$u$ are the propositions that are207known to be true in state~$u$. The forcing relation $\mSat{M}{!A}[w]$208then extends this relationship to arbitrary !!{formula}s in the209language; read $\mSat{M}{!A}[w]$ as ``$!A$ is true in state~$w$.'' The210relationship is defined inductively, as follows:211\begin{enumerate}212\item $\mSat{M}{\Obj p_i}[w]$ iff $\Obj p_i$ is one of the213 propositional variables assigned to~$w$.214\item $\mSat/{M}{\lfalse}[w]$.215\item $\mSat{M}{(!A \land !B)}[w]$ iff $\mSat{M}{!A}[w]$ and $\mSat{M}{!B}[w]$.216\item $\mSat{M}{(!A \lor !B)}[w]$ iff $\mSat{M}{!A}[w]$ or $\mSat{M}{!B}[w]$.217\item $\mSat{M}{(!A \lif !B)}[w]$ iff, whenever $w' \geq w$ and218 $\mSat{M}{!A}[w']$, then $\mSat{M}{!B}[w']$.219\end{enumerate}220It is a good exercise to try to show that $\lnot (p \land q) \lif221(\lnot p \lor \lnot q)$ is not intuitionistically valid, by cooking up a222Kripke !!{structure} that provides a counterexample.223224\end{document}
content/first-order-logic/beyond/modal-logics.tex
1% Part: first-order-logic2% Chapter: beyond3% Section: modal-logics45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{fol}{byd}{mod}1011\olsection{Modal Logics}1213Consider the following example of a conditional sentence:14\begin{quote}15 If Jeremy is alone in that room, then he is drunk and naked and16 dancing on the chairs.17\end{quote}18This is an example of a conditional assertion that may be materially19true but nonetheless misleading, since it seems to suggest that there20is a stronger link between the antecedent and conclusion other than21simply that either the antecedent is false or the consequent22true. That is, the wording suggests that the claim is not only true in23this particular world (where it may be trivially true, because Jeremy24is not alone in the room), but that, moreover, the conclusion25\emph{would have} been true \emph{had} the antecedent been true. In26other words, one can take the assertion to mean that the claim is true27not just in this world, but in any ``possible'' world; or that it is28\emph{necessarily} true, as opposed to just true in this particular29world.3031Modal logic was designed to make sense of this kind of necessity. One32obtains modal propositional logic from ordinary33propositional logic by adding a box operator; which is to say, if34$!A$ is !!a{formula}, so is $\Box !A$. Intuitively, $\Box !A$35asserts that $!A$ is \emph{necessarily} true, or true in any possible36world. $\Diamond !A$ is usually taken to be an abbreviation for37$\lnot \Box \lnot !A$, and can be read as asserting that $!A$ is38\emph{possibly} true. Of course, modality can be added to predicate39logic as well.4041Kripke !!{structure}s can be used to provide a semantics for modal42logic; in fact, Kripke first designed this semantics with modal logic43in mind. Rather than restricting to partial orders, more generally one44has a set of ``possible worlds,'' $P$, and a binary ``accessibility''45relation $\Atom{R}{x,y}$ between worlds. Intuitively, $\Atom{R}{p,q}$46asserts that the world~$q$ is compatible with~$p$; i.e., if we are47``in'' world~$p$, we have to entertain the possibility that the48world could have been like~$q$.4950Modal logic is sometimes called an ``intensional'' logic, as opposed51to an ``extensional'' one. The intended semantics for an extensional52logic, like classical logic, will only refer to a single world, the53``actual'' one; while the semantics for an ``intensional'' logic54relies on a more elaborate ontology. In addition to !!{structure}ing55necessity, one can use modality to !!{structure} other linguistic56constructions, reinterpreting $\Box$ and $\Diamond$ according to the57application. For example:58\begin{enumerate}59\item In provability logic, $\Box !A$ is read ``$!A$ is provable''60 and $\Diamond !A$ is read ``$!A$ is consistent.''61\item In epistemic logic, one might read $\Box !A$ as ``I know62 $!A$'' or ``I believe $!A$.''63\item In temporal logic, one can read $\Box !A$ as ``$!A$ is always64 true'' and $\Diamond !A$ as ``$!A$ is sometimes true.''65\end{enumerate}6667One would like to augment logic with rules and axioms dealing with68modality. For example, the system $\Log{S4}$ consists of the ordinary69axioms and rules of propositional logic, together with the following70axioms:71\begin{align*}72& \Box (!A \lif !B) \lif (\Box !A \lif \Box !B)\\73& \Box !A \lif !A \\74& \Box !A \lif \Box \Box !A75\intertext{as well as a rule, ``from $!A$ conclude $\Box !A$.''76 $\Log{S5}$ adds the following axiom:}77& \Diamond !A \lif \Box \Diamond !A78\end{align*}79Variations of these axioms may be suitable for different applications;80for example, S5 is usually taken to characterize the notion of logical81necessity. And the nice thing is that one can usually find a semantics82for which the !!{derivation} system is sound and complete by restricting the83accessibility relation in the Kripke !!{structure}s in natural84ways. For example, $\Log{S4}$ corresponds to the class of Kripke85!!{structure}s in which the accessibility relation is reflexive and86transitive. $\Log{S5}$ corresponds to the class of Kripke87!!{structure}s in which the accessibility relation is {\em universal},88which is to say that every world is accessible from every other; so89$\Box !A$ holds if and only if $!A$ holds in every world.9091\end{document}
content/first-order-logic/beyond/other-logics.tex
1% Part: first-order-logic2% Chapter: beyond3% Section: other-logics45\documentclass[../../../include/open-logic-section]{subfiles}67\begin{document}89\olfileid{fol}{byd}{oth}1011\olsection{Other Logics}1213As you may have gathered by now, it is not hard to design a new logic.14You too can create your own a syntax, make up a deductive system, and15fashion a semantics to go with it. You might have to be a bit clever16if you want the !!{derivation} system to be complete for the semantics, and it17might take some effort to convince the world at large that your logic18is truly interesting. But, in return, you can enjoy hours of good,19clean fun, exploring your logic's mathematical and computational20properties.2122Recent decades have witnessed a veritable explosion of formal logics.23Fuzzy logic is designed to model reasoning about vague24properties. Probabilistic logic is designed to model25reasoning about uncertainty. Default logics and nonmonotonic logics26are designed to model defeasible forms of reasoning, which is27to say, ``reasonable'' inferences that can later be overturned in the28face of new information. There are epistemic logics, designed to29model reasoning about knowledge; causal logics, designed to30model reasoning about causal relationships; and even31``deontic'' logics, which are designed to model reasoning32about moral and ethical obligations. Depending on whether the primary33motivation for introducing these systems is philosophical,34mathematical, or computational, you may find such creatures studies35under the rubric of mathematical logic, philosophical logic,36artificial intelligence, cognitive science, or elsewhere.3738The list goes on and on, and the possibilities seem endless. We39may never attain Leibniz' dream of reducing all of human reason to40calculation---but that can't stop us from trying.4142\end{document}