{"id":2290,"date":"2022-04-16T19:09:26","date_gmt":"2022-04-16T19:09:26","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=2290"},"modified":"2022-04-16T19:09:26","modified_gmt":"2022-04-16T19:09:26","slug":"inference-in-first-order-logic","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/04\/16\/inference-in-first-order-logic\/","title":{"rendered":"Inference in First-Order Logic"},"content":{"rendered":"\n<p>Inference in First-Order Logic is used to deduce new facts or sentences from existing sentences. Before understanding the FOL inference rule, let&#8217;s understand some basic terminologies used in FOL.<\/p>\n\n\n\n<p><strong>Substitution:<\/strong><\/p>\n\n\n\n<p>Substitution is a fundamental operation performed on terms and formulas. It occurs in all inference systems in first-order logic. The substitution is complex in the presence of quantifiers in FOL. If we write&nbsp;<strong>F[a\/x]<\/strong>, so it refers to substitute a constant &#8220;<strong>a<\/strong>&#8221; in place of variable &#8220;<strong>x<\/strong>&#8220;.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Note: First-order logic is capable of expressing facts about some or all objects in the universe.<\/h4>\n\n\n\n<p><strong>Equality:<\/strong><\/p>\n\n\n\n<p>First-Order logic does not only use predicate and terms for making atomic sentences but also uses another way, which is equality in FOL. For this, we can use&nbsp;<strong>equality symbols<\/strong>&nbsp;which specify that the two terms refer to the same object.<\/p>\n\n\n\n<p><strong>Example: Brother (John) = Smith.<\/strong><\/p>\n\n\n\n<p>As in the above example, the object referred by the&nbsp;<strong>Brother (John)<\/strong>&nbsp;is similar to the object referred by&nbsp;<strong>Smith<\/strong>. The equality symbol can also be used with negation to represent that two terms are not the same objects.<\/p>\n\n\n\n<p><strong>Example: \uffe2(x=y) which is equivalent to x \u2260y.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FOL inference rules for quantifier:<\/h2>\n\n\n\n<p>As propositional logic we also have inference rules in first-order logic, so following are some basic inference rules in FOL:<\/p>\n\n\n\n<ul><li><strong>Universal Generalization<\/strong><\/li><li><strong>Universal Instantiation<\/strong><\/li><li><strong>Existential Instantiation<\/strong><\/li><li><strong>Existential introduction<\/strong><\/li><\/ul>\n\n\n\n<p><strong>1. Universal Generalization:<\/strong><\/p>\n\n\n\n<ul><li>Universal generalization is a valid inference rule which states that if premise P(c) is true for any arbitrary element c in the universe of discourse, then we can have a conclusion as \u2200 x P(x).<\/li><li>It can be represented as:&nbsp;<img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-inference-in-first-order-logic.png\" alt=\"Inference in First-Order Logic\">.<\/li><li>This rule can be used if we want to show that every element has a similar property.<\/li><li>In this rule, x must not appear as a free variable.<\/li><\/ul>\n\n\n\n<p><strong>Example:<\/strong>&nbsp;Let&#8217;s represent, P(c): &#8220;<strong>A byte contains 8 bits<\/strong>&#8220;, so for&nbsp;<strong>\u2200 x P(x)<\/strong>&nbsp;&#8220;<strong>All bytes contain 8 bits<\/strong>.&#8221;, it will also be true.<\/p>\n\n\n\n<p><strong>2. Universal Instantiation:<\/strong><\/p>\n\n\n\n<ul><li>Universal instantiation is also called as universal elimination or UI is a valid inference rule. It can be applied multiple times to add new sentences.<\/li><li>The new KB is logically equivalent to the previous KB.<\/li><li>As per UI,&nbsp;<strong>we can infer any sentence obtained by substituting a ground term for the variable<\/strong>.<\/li><li>The UI rule state that we can infer any sentence P(c) by substituting a ground term c (a constant within domain x) from&nbsp;<strong>\u2200 x P(x) for any object in the universe of discourse<\/strong>.<\/li><li>It can be represented as:<img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-inference-in-first-order-logi2.png\" alt=\"Inference in First-Order Logic\">.<\/li><\/ul>\n\n\n\n<p><strong>Example:1.<\/strong><\/p>\n\n\n\n<p>IF &#8220;Every person like ice-cream&#8221;=&gt; \u2200x P(x) so we can infer that<br>&#8220;John likes ice-cream&#8221; =&gt; P(c)<\/p>\n\n\n\n<p><strong>Example: 2.<\/strong><\/p>\n\n\n\n<p>Let&#8217;s take a famous example,<\/p>\n\n\n\n<p>&#8220;All kings who are greedy are Evil.&#8221; So let our knowledge base contains this detail as in the form of FOL:<\/p>\n\n\n\n<p><strong>\u2200x king(x) \u2227 greedy (x) \u2192 Evil (x),<\/strong><\/p>\n\n\n\n<p>So from this information, we can infer any of the following statements using Universal Instantiation:<\/p>\n\n\n\n<ul><li><strong>King(John) \u2227 Greedy (John) \u2192 Evil (John),<\/strong><\/li><li><strong>King(Richard) \u2227 Greedy (Richard) \u2192 Evil (Richard),<\/strong><\/li><li><strong>King(Father(John)) \u2227 Greedy (Father(John)) \u2192 Evil (Father(John)),<\/strong><\/li><\/ul>\n\n\n\n<p><strong>3. Existential Instantiation:<\/strong><\/p>\n\n\n\n<ul><li>Existential instantiation is also called as Existential Elimination, which is a valid inference rule in first-order logic.<\/li><li>It can be applied only once to replace the existential sentence.<\/li><li>The new KB is not logically equivalent to old KB, but it will be satisfiable if old KB was satisfiable.<\/li><li>This rule states that one can infer P(c) from the formula given in the form of \u2203x P(x) for a new constant symbol c.<\/li><li>The restriction with this rule is that c used in the rule must be a new term for which P(c ) is true.<\/li><li>It can be represented as:<img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-inference-in-first-order-logic3.png\" alt=\"Inference in First-Order Logic\"><\/li><\/ul>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<p>From the given sentence:&nbsp;<strong>\u2203x Crown(x) \u2227 OnHead(x, John),<\/strong><\/p>\n\n\n\n<p>So we can infer:&nbsp;<strong>Crown(K) \u2227 OnHead( K, John),<\/strong>&nbsp;as long as K does not appear in the knowledge base.<\/p>\n\n\n\n<ul><li>The above used K is a constant symbol, which is called&nbsp;<strong>Skolem constant<\/strong>.<\/li><li>The Existential instantiation is a special case of&nbsp;<strong>Skolemization process<\/strong>.<\/li><\/ul>\n\n\n\n<p><strong>4. Existential introduction<\/strong><\/p>\n\n\n\n<ul><li>An existential introduction is also known as an existential generalization, which is a valid inference rule in first-order logic.<\/li><li>This rule states that if there is some element c in the universe of discourse which has a property P, then we can infer that there exists something in the universe which has the property P.<\/li><li>It can be represented as:&nbsp;<img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-inference-in-first-order-logic4.png\" alt=\"Inference in First-Order Logic\"><\/li><li><strong>Example: Let&#8217;s say that,<\/strong><br>&#8220;Priyanka got good marks in English.&#8221;<br>&#8220;Therefore, someone got good marks in English.&#8221;<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Generalized Modus Ponens Rule:<\/h2>\n\n\n\n<p>For the inference process in FOL, we have a single inference rule which is called Generalized Modus Ponens. It is lifted version of Modus ponens.<\/p>\n\n\n\n<p>Generalized Modus Ponens can be summarized as, &#8221; P implies Q and P is asserted to be true, therefore Q must be True.&#8221;<\/p>\n\n\n\n<p>According to Modus Ponens, for atomic sentences&nbsp;<strong>pi, pi&#8217;, q<\/strong>. Where there is a substitution \u03b8 such that SUBST&nbsp;<strong>(\u03b8, pi&#8217;,) = SUBST(\u03b8, pi)<\/strong>, it can be represented as:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/ai\/images\/ai-inference-in-first-order-logic5.png\" alt=\"Inference in First-Order Logic\"\/><\/figure>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<p><strong>We will use this rule for Kings are evil, so we will find some x such that x is king, and x is greedy so we can infer that x is evil.<\/strong><a href=\"https:\/\/www.javatpoint.com\/ai-inference-in-first-order-logic#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/ai-inference-in-first-order-logic#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/ai-inference-in-first-order-logic#\"><\/a><\/p>\n\n\n\n<ol><li>Here&nbsp;let&nbsp;say,&nbsp;p1&#8242;&nbsp;is&nbsp;king(John)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p1&nbsp;is&nbsp;king(x)&nbsp;&nbsp;<\/li><li class=\"\">p2&#8242;&nbsp;is&nbsp;Greedy(y)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p2&nbsp;is&nbsp;Greedy(x)&nbsp;&nbsp;<\/li><li>\u03b8&nbsp;is&nbsp;{x\/John,&nbsp;y\/John}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;q&nbsp;is&nbsp;evil(x)&nbsp;&nbsp;<\/li><li class=\"\">SUBST(\u03b8,q).&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Inference in First-Order Logic is used to deduce new facts or sentences from existing sentences. Before understanding the FOL inference rule, let&#8217;s understand some basic terminologies used in FOL. Substitution: Substitution is a fundamental operation performed on terms and formulas. It occurs in all inference systems in first-order logic. The substitution is complex in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[885],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2290"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=2290"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/2290\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=2290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=2290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=2290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}