{ localUrl: '../page/intro_modern_logic.html', arbitalUrl: 'https://arbital.com/p/intro_modern_logic', rawJsonUrl: '../raw/661.json', likeableId: '3541', likeableType: 'page', myLikeValue: '0', likeCount: '4', dislikeCount: '0', likeScore: '4', individualLikes: [ 'EricBruylant', 'PatrickStevens', 'TravisRivera', 'JaimeSevillaMolina' ], pageId: 'intro_modern_logic', edit: '8', editSummary: '', prevEdit: '5', currentEdit: '8', wasPublished: 'true', type: 'wiki', title: 'An introductory guide to modern logic', clickbait: 'Logic, provability, Löb, Gödel and more!', textLength: '19102', alias: 'intro_modern_logic', externalUrl: '', sortChildrenBy: 'likes', hasVote: 'false', voteType: '', votesAnonymous: 'false', editCreatorId: 'JaimeSevillaMolina', editCreatedAt: '2016-10-21 17:27:08', pageCreatorId: 'JaimeSevillaMolina', pageCreatedAt: '2016-09-24 21:09:30', seeDomainId: '0', editDomainId: 'AlexeiAndreev', submitToDomainId: '0', isAutosave: 'false', isSnapshot: 'false', isLiveEdit: 'true', isMinorEdit: 'false', indirectTeacher: 'false', todoCount: '17', isEditorComment: 'false', isApprovedComment: 'true', isResolved: 'false', snapshotText: '', anchorContext: '', anchorText: '', anchorOffset: '0', mergedInto: '', isDeleted: 'false', viewCount: '155', text: 'Welcome! We are about to start a journey through modern logic, in which we will visit two central results of this branch of mathematics, which are often misunderstood and sometimes even misquoted: [ Löb's theorem] and [ Gödel's second incompleteness theorem].\n\nModern logic can be said to have been born in the ideas of Gödel regarding the amazing property of self-reference that plagues arithmetic. Badly explained, this means that we can force an interpretation over natural numbers which relates how deductions are made in arithmetic to statements about arithmetical concepts such as divisibility.\n\n[toc:]\n\nThis guide is targets people who are already comfortable with mathematical thinking and mathematical notation. It requires however no specific background knowledge about logic or math to be read. The guide starts lightweight and gets progressively more technical.\n\n#Formal proofs\nWhat is logic anyway? A short explanation refers to the fact that we humans happen to be able to draw conclusions about things we have not experienced by using facts about how the world is. For example, if you see somebody entering the room and is dripping water, then you infer that it is raining outside, even though you have not seen the rain yourself.\n\nThis may seem trivial, but what if we are trying to program that into a computer? How can we capture this intuition of what reasoning is and write down the rules for proper reasoning in a way precise enough to be turned into a program?\n\nTo accomplish that is to do logic. The ultimate goal is to have an efficient procedure that if followed will allow to **deduce** every true consequence of a set of premises, so simple that it could be taught to a dumb machine which only follows mechanical operations.\n\nSo let's try to formalize reasoning!\n\nWe are going to draw inspiration from mathematicians and see what they are doing when proving a result.\n\nThough the method is often convoluted, non linear and hard to understand, in essence what they are doing is writing down some hypothesis and facts that they assume to be true. Then they apply some manipulation rules which they assume that when applied on true premises allow to derive true facts. After iterating this process, they arrive to the wanted result.\n\n## Getting formal\n\nWell, let's wrap together this intuitive process in a formal definition. \n\n> A [ proof of a sentence $\\phi$] is a sequence of [ well formed sentences] such that every sentence in the sequence is either an [-6cd] or can be derived of the previous sentences using a [ derivation rule], and the final sentence in the sequence is $\\phi$. A sentence which has a proof is called a [ theorem].\n\nDon't be scared by all the new terms! Let's go briefly over them.\n\nA **well formed sentence** is just a combination of letters which satisfies a certain criteria which makes them easy to interpret. The sentences we will be dealing with are logical formulas, which use a particular set of symbols such as $=, \\wedge, \\implies$. Our goal is to assign truth values to sentences. That is, to say if particular sentences are true or false.\n\nAn **axiom** is something that we assume to be true without requiring a proof. For example, a common axiom in arithmetic is assuming that $0$ is different than $n+1$ for all natural numbers $n$. Or expressed as a well formed sentence, $\\forall n. 0 \\not = n+1$. %%note:The symbol $\\forall$ is an upside-down A and means "[ for all]".%%\n\nA **derivation rule** is a valid basic step in a proof. Perhaps the simplest example is [ modus ponens] . Modus ponens tells you that if you have deduced somehow that $A\\implies B$ and also $A$, then you can deduce from both facts $B$.\n\nThose three components constitute the basis of a **logical system** for reasoning: a criteria for constructing [ well formed sentences], a set of [6cd axioms] which we know to be true %%note: The set of axioms does not have to be finite! In particular, we can specify a criteria to identify infinitely many axioms. This is called an [ axiom schema]%% and some [ derivation rules] which allow us to deduce new conclusions.\n\n%%hidden(Show example):\nFor a rather silly example, let's consider the system $A$ with the following components:\n* Well formed sentences: the set of words in the Webster dictionary.\n* Axioms: The word 'break'.\n* Deduction rules: If a word $w$ is a theorem of $A$, then so it is a word which only differs in one letter of $w$, either by adding, substracting or replacing it anywhere in $w$.\n\nThus the word 'trend' is a theorem of $A$, as shown by the 4 steps long proof 'break - bread - tread - trend'. The first sentence in the proof is an axiom. Every sentence after is deduced from our deduction rule using the previous sentence as a premise.\n%%\n\n## Interpretations\n\nGiven how we defined a logical system, there is a certain degree of freedom we have, as we can choose the underlying sets of well formed sentences, the axioms and the deduction rules. However, as shown in the example above, if we want to make meaningful deductions we should be careful in what components do we choose for our logical system.\n\nThe criteria we use to choose these components is intertwined with the [-model] we are trying to reason about. Models can be anything that captures an aspect of the world, or just a mathematical concept. To put it simply, they are the thing we are trying to reason *about*.\n\nDepending on what kind of entities the model has, we will lean towards a particular choice of sentences. For example, if our model consists in just facts which are subject to some known logical relations we could use the language of [-propositional_logic]. But if our model contains different objects which are related in different ways, we will prefer to use the language of [first_order_logic].\n\nEach model has an interpretation associated, which relates the terms in the sentences to aspects of the model. For all practical purposes, a model and its interpretation are the same once we have fixed the language, and thus we will use the terms as synonyms.\n\nThen, depending on how the model evolves and what things can we infer from what facts we should choose some deduction rules. Together, the sentences and the deduction rules specify a class of possible models. If the deduction rules correctly capture the properties of the class of models we had in mind, in the sense that from true premises we really derive true consequences, then we will say that they are [-sound]. \n\nIntuitively, we say that the choice of language and deduction rules decides the "shape" that our models will have. Every model with such a shape will be part of the universe of models specified by those components of a logical system.\n\nWith this imagery of a class of models, we can think of axioms as an attempt to reduce the class of models and pin down the concrete model we are interested in, by choosing as axioms sentences whose interpretation is true in only the model we are interested in and in no other model %%note: sadly, there are occasions in which this is just not possible%%.\n\nA property tightly related to soundness is [-completeness]. A system is complete if every sentence which is true under all interpretations which satisfy our axioms has a proof.\n\nIt is important to realize that logical systems can be talking about many models at once. In particular, if two interpretations satisfy the axioms but disagree on the truth of a particular sentence, then that sentence will be [ undecidable] in our model.\n\nThis suggest a technique for proving independence of logical statements. To show that a certain sentence is independent from some axioms, construct two models which satisfy those axioms but contradict each other on the value of the statement. A nice example of this is how Lobachevsky showed that [Euclides Fifth postulate is independent from the other four postulates](https://en.wikipedia.org/wiki/Parallel_postulate#History).\n\n[todo: add more examples everywhere]\n\n## Introducing PA\n\nFor our purposes, we will stick to a particular logical system called [3ft Peano arithmetic]. This particular choice of axioms and deduction rules is interesting because it reflects a lot of our intuitions about how numbers work, which in turn can be used to talk about many phenomena in the real world. In particular, *they can talk about themselves*.\n\nBefore we move on to this "talking about themselves" business I am going to introduce more notation. We will refer to Peano Arithmetic as $PA$. If a sentence $\\phi$ follows from the axioms of $PA$ and its deduction rules %%note: ie, there is a proof of $\\phi$ using only axioms and deduction rules from $PA$%%, we will say that $PA\\vdash \\phi$, read as "$PA$ proves $\\phi$".\n\n#Self reference and the provability predicate\nLet's try to get an intuition of what I mean when I say that numbers can talk about themselves.\n\nThe first key intuition is that we can refer to arbitrary sequences of characters using numbers. For example, I can declare that from now onwards the number $1$ is going to refer to the sequence of letters "I love Peano Arithmetic". Furthermore, using a clever rule to relate numbers and sentences I can make sure that every possible finite sentence gets assigned a number %%note: This is called [-encoding]%%.\n\nA simple encoding goes by the name of **Gödel encoding**, and consists of assigning to every symbol we are going to allow to be used in sentences a number. For example, $=$ could be $1$, and $a$ could be $0$, and so on and so forth. Then we could encode a sentence consisting of $n$ symbols as the number $2^{a_1}3^{a_2}5^{a_3}\\cdots p(n)^{a_n}$. That is, we take the number which is the product of the $n$th first primes with exponents equal to the assigned numbers.%%note:This is possible because every number can be [-5rh decomposed as a unique product of primes].%%\n\nThe process can be repeated to encode sequences of sentences as single numbers. Thus, we can encode whole proofs as single numbers. We could also encode sequences of sequences of sentences, but that is going too far for our purposes.\n\n[todo: whole example of Gödel encoding, define carefully notation of godelquotes]\n\nSo the point is, we can exchange sentences by numbers and vice versa. Can we also talk about deduction using numbers?\n\nIt turns out we can! With the encoding we have chosen it is cumbersome to show, but we can write a **predicate** $Axiom(x)$ %%note: A predicate is a well formed sentence in which we have left one or more "holes" in the form of variables which we can substitute for literal numbers or quantify over. For example, we can have the predicate $IsEqualTo42(x)$ of the form $x = 42$. Then $PA\\vdash IsEqualTo42(42)$ and $PA\\vdash \\exists x IsEqualTo42(x)$, but $PA\\not\\vdash IsEqualTo42(7)$%% in the language of Peano Arithmetic such that $PA\\vdash Axiom(\\textbf{n})$ if and only if $n$ is a number which encodes an axiom of $PA$. \n\nFurthermore, deduction rules which require $n$ premises can be represented by $n+1$ predicates $Rule(p_1, p_2,..., p_n, r)$ which is provable in $PA$ if and only if $p_1, ...., p_n$ are numbers encoding valid premises for the rule and $r$ is the corresponding deduced fact.\n\nA bit more of work and we can put together a predicate $Proof(x,y)$, which is provable in $PA$ if and only if $x$ encodes the valid proof of the sentence $y$. Isn't that neat!? \n\nSince we are not too interested in the proof itself, and more in the fact that there is a proof at all, we are going to construct the **provability predicate** $\\exists x. Proof(x,y)$, which we will call $\\square_{PA}(y)$.%%note: $\\exists$ is a backwards E and means "there exists"%%. So then, $\\square_{PA}(x)$ literally means "There is a proof in $PA$ of $x$". \n\nThus we can say that if the number $\\ulcorner 1+1=2 \\urcorner$ corresponds to the sentence $1+1=2$%%note: This notation remains in effect for the rest of the article.%%, then $PA\\vdash \\square_{PA}(\\ulcorner 1+1=2 \\urcorner)$. That is, $PA$ proves that there is a proof in $PA$ of $1+1=2$.\n\nNow, the predicates we have seen so far are quite intuitive and nicely behaved, in the sense that their deducibility from $PA$ matches quite well what we would expect from our intuition. However, adding the existential quantifier in front of $Proof(x,y)$ we get some nasty side effects.\n\nWarning! Really bad analogy incoming!\n\nThe thing is that $PA$ "hallucinates" numbers which it is not sure whether they exist or not. Those are no mere natural numbers, but infinite numbers further in the horizon of math. While $PA$ cannot prove their existence, it neither cannot prove its non existence. So $PA$ becomes wary of asserting that proofs do not exist for a certain false sentence. After all, one of those **non standard** numbers may encode the proof of the false sentence! Who is to prove otherwise?\n\nCan we patch this somehow? Maybe by adding more axioms or deduction rules to $PA$ so that it can prove that those numbers do not exists? The answer is yes but not really. While it is doable in principle, the resulting theory becomes too difficult to manage, and we can no longer use it for effective deduction %%note: Technically, $PA$ loses its [ semidecidability] that way.%%.\n\nWe will now proceed to prove two technical results which better formalize this idea: Löb's theorem and Gödel's Second Incompleteness Theorem.\n\n#Löb's theorem\n\nLöb's result follows from the intuitive properties of deduction that the provability predicate actually manages to capture. This points to the fact that it is not our definition what is wrong, but rather to a fundamental impossibility in logic.\n\nThe intuitive, good properties of $\\square_{PA}$ are known as the Hilbert-Bernais derivability conditions, and are as follows:\n\n1. If $PA\\vdash A$, then $PA\\vdash \\square_{PA}(\\ulcorner A\\urcorner)$.\n2. $PA\\vdash \\square_{PA}(\\ulcorner A\\rightarrow B\\urcorner) \\rightarrow [\\square_{PA}(\\ulcorner A \\urcorner)\\rightarrow \\square_{PA}(\\ulcorner B \\urcorner)]$\n3. $PA\\vdash \\square_{PA}(\\ulcorner A\\urcorner) \\rightarrow \\square_{PA} \\square_{PA} (\\ulcorner A\\urcorner)$.\n\nLet's go over each of them in turn. \n\n1) says reasonably that if $PA$ proves a sentence $A$, then it also proves that there is a proof of $A$.\n\n2) affirms that if you can prove that $A$ implies $B$ then the existence of a proof of $A$ implies the existence of a proof of $B$. This is quite intuitive, as we can concatenate a proof of $A$ with a proof of $A\\rightarrow B$ and deduce $B$ from an application of *modus ponens*.\n\n3) is a technical result which states that the formalization of 1) is provable when we are dealing with sentences of the form $\\square_{PA}(\\ulcorner A \\urcorner)$.\n\nOne more ingredient is needed to derive Löb's: the [-59c], which states that for all predicates $\\phi(x)$ there is a formula $\\psi$ such that $PA\\vdash \\psi \\leftrightarrow \\phi(\\ulcorner \\psi \\urcorner)$.\n\nThe details of the proof can be found in [59b]. \n\nThe details are not essential to the main idea, but it can be illustrative to work through the formal proof. Plus the intuition behind related to the non-standard numbers we talked about before.\n\nWhat is really interesting is that now we are in position to enunciate and understand Löb's theorem!\n\n> **Löb's theorem**\n\n> If $PA\\vdash \\square_{PA}(\\ulcorner A\\urcorner) \\rightarrow A$, then $PA\\vdash A$.\n\n> (or equivalently, if $PA\\not\\vdash A$ then $PA\\not\\vdash \\square_{PA}(\\ulcorner A\\urcorner) \\rightarrow A$).\n\nTalk about an unintuitive result! Let's take a moment to ponder about its meaning.\n\nIntuitively, we should be able to derive from the existence of a proof of $A$ that $A$ is true. After all, proofs are guarantees that something really follows from the axioms, so if we got those right and our derivation rules are correct then $A$ should be true. However, $PA$ does not trust that being able to find the existence of a proof is enough to make $A$ true!\n\nIndeed, he needs to be able to see by himself the proof. In other words, there must be a $n$ such that $PA\\vdash Proof(\\textbf n, \\ulcorner A\\urcorner)$. Then he will trust that it is indeed the case that $A$.\n\nI will repeat that again because it looks like a tongue twister. Suppose somebody came and assured $PA$ that from the axioms of $PA$ it follows that there exists a number $n$ satisfying $Proof(\\textbf n,\\ulcorner A\\urcorner)$. Then $PA$ would say, show me the proof or I am going to assume that that $n$ is actually a non standard number and you a friggin' liar.\n\nIf somebody just comes saying he has a proof, but produces none, $PA$ becomes suspicious. After all, the proof in question could be a non-standard proof encoded by one of the dreaded non standard numbers! Who is going to trust that!\n\n\n#Gödel II\nAnd finally we arrive to Gödel's Second Incompleteness Theorem, perhaps the most widely misunderstood theorem of all mathematics.\n\nWe first need to introduce the notion of [ consistency.] Simply enough, a logical system is consistent if it does not prove a contradiction, where a contradiction is something impossible. For example, it cannot ever be the case that $P\\wedge \\neg P$, so $P\\wedge \\neg P$ is a contradiction no matter what $P$ is. We use the symbol $\\bot$ to represent a contradiction.\n\nThe statement of GII is as follows:\n\n> Gödel Second Incompleteness Theorem (concrete form)\n> If $PA$ is consistent, then $PA\\not \\vdash \\neg \\square_{PA}(\\bot)$\n\nNotice that GII follows quite directly from Löb's theorem. Actually, it is the case that Löb's theorem also follows from GII, so [5hs both results are equivalent].\n\nThis result can be interpreted as follows: you cannot make a system as complex as $PA$ in which you can talk about deduction with complete certainty, and thus about consistency. In particular, such a system cannot prove that he himself is consistent.\n\nThe result is startling, but in the light of our previous exposition is clear what is going on! There is always the shadow of non standard numbers menacing our deductions.\n\n#Summary\nAnd that concludes our introduction to formal logic!\n\nTo recall some important things we have learned:\n\n* Logical systems capture the intuition behind deductive reasoning. They are composed of axioms and deductive rules that are chained to compose proofs.\n* Simple logical systems that are used to talk about numbers, such as $PA$, can be interpreted as talking about many things through encodings, and in particular they can talk about themselves.\n* There are expressions in logic that capture the concepts involved in deductions. However, the most important of them, the provability predicate $\\square_{PA}$, fails to satisfy some intuitive properties due to the inability of $PA$ to prove that non standard numbers do not exists.\n* Löb's theorem says that if $PA$ cannot prove $A$, then it can neither prove that from $\\square_{PA}(\\ulcorner A\\urcorner$ follows $A$.\n* $PA$ cannot prove its own consistency, in the sense that it cannot prove that the standard predicate is never satisfied by a contradiction.\n\nIf you want to get deeper in the rabbit hole, read about [ model theory] and [-semantics] or [-534]. ', metaText: '', isTextLoaded: 'true', isSubscribedToDiscussion: 'false', isSubscribedToUser: 'false', isSubscribedAsMaintainer: 'false', discussionSubscriberCount: '2', maintainerCount: '2', userSubscriberCount: '0', lastVisit: '', hasDraft: 'false', votes: [], voteSummary: 'null', muVoteSummary: '0', voteScaling: '0', currentUserVote: '-2', voteCount: '0', lockedVoteType: '', maxEditEver: '0', redLinkCount: '0', lockedBy: '', lockedUntil: '', nextPageId: '', prevPageId: '', usedAsMastery: 'false', proposalEditNum: '0', permissions: { edit: { has: 'false', reason: 'You don't have domain permission to edit this page' }, proposeEdit: { has: 'true', reason: '' }, delete: { has: 'false', reason: 'You don't have domain permission to delete this page' }, comment: { has: 'false', reason: 'You can't comment in this domain because you are not a member' }, proposeComment: { has: 'true', reason: '' } }, summaries: {}, creatorIds: [ 'JaimeSevillaMolina', 'MarkChimes' ], childIds: [], parentIds: [ 'math' ], commentIds: [ '668', '6fl' ], questionIds: [], tagIds: [], relatedIds: [], markIds: [], explanations: [], learnMore: [], requirements: [], subjects: [ { id: '6421', parentId: 'lobs_theorem', childId: 'intro_modern_logic', type: 'subject', creatorId: 'JaimeSevillaMolina', createdAt: '2016-09-24 21:08:49', level: '1', isStrong: 'true', everPublished: 'true' }, { id: '6422', parentId: 'standard_provability_predicate', childId: 'intro_modern_logic', type: 'subject', creatorId: 'JaimeSevillaMolina', createdAt: '2016-09-24 21:08:56', level: '1', isStrong: 'true', everPublished: 'true' } ], lenses: [], lensParentId: '', pathPages: [], learnMoreTaughtMap: {}, learnMoreCoveredMap: {}, learnMoreRequiredMap: {}, editHistory: {}, domainSubmissions: {}, answers: [], answerCount: '0', commentCount: '0', newCommentCount: '0', linkedMarkCount: '0', changeLogs: [ { likeableId: '3640', likeableType: 'changeLog', myLikeValue: '0', likeCount: '1', dislikeCount: '0', likeScore: '1', individualLikes: [], id: '20231', pageId: 'intro_modern_logic', userId: 'JaimeSevillaMolina', edit: '8', type: 'newEdit', createdAt: '2016-10-21 17:27:08', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '3639', likeableType: 'changeLog', myLikeValue: '0', likeCount: '1', dislikeCount: '0', likeScore: '1', individualLikes: [], id: '20222', pageId: 'intro_modern_logic', userId: 'JaimeSevillaMolina', edit: '5', type: 'newEdit', createdAt: '2016-10-21 14:58:56', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '3594', likeableType: 'changeLog', myLikeValue: '0', likeCount: '1', dislikeCount: '0', likeScore: '1', individualLikes: [], id: '19989', pageId: 'intro_modern_logic', userId: 'MarkChimes', edit: '4', type: 'newEdit', createdAt: '2016-10-10 19:30:47', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '3593', likeableType: 'changeLog', myLikeValue: '0', likeCount: '1', dislikeCount: '0', likeScore: '1', individualLikes: [], id: '19988', pageId: 'intro_modern_logic', userId: 'MarkChimes', edit: '3', type: 'newEdit', createdAt: '2016-10-10 19:26:32', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '19727', pageId: 'intro_modern_logic', userId: 'JaimeSevillaMolina', edit: '2', type: 'newEdit', createdAt: '2016-09-25 13:28:59', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '19724', pageId: 'intro_modern_logic', userId: 'EricBruylant', edit: '0', type: 'newParent', createdAt: '2016-09-25 13:17:26', auxPageId: 'math', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '19719', pageId: 'intro_modern_logic', userId: 'JaimeSevillaMolina', edit: '0', type: 'newSubject', createdAt: '2016-09-24 21:09:32', auxPageId: 'standard_provability_predicate', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '19717', pageId: 'intro_modern_logic', userId: 'JaimeSevillaMolina', edit: '0', type: 'newSubject', createdAt: '2016-09-24 21:09:31', auxPageId: 'lobs_theorem', oldSettingsValue: '', newSettingsValue: '' }, { likeableId: '0', likeableType: 'changeLog', myLikeValue: '0', likeCount: '0', dislikeCount: '0', likeScore: '0', individualLikes: [], id: '19715', pageId: 'intro_modern_logic', userId: 'JaimeSevillaMolina', edit: '1', type: 'newEdit', createdAt: '2016-09-24 21:09:30', auxPageId: '', oldSettingsValue: '', newSettingsValue: '' } ], feedSubmissions: [], searchStrings: {}, hasChildren: 'false', hasParents: 'true', redAliases: {}, improvementTagIds: [], nonMetaTagIds: [], todos: [], slowDownMap: 'null', speedUpMap: 'null', arcPageIds: 'null', contentRequests: {} }