Exercises for the Logic Course

Similar documents
Logic: First Order Logic

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

Mathematical Logics. 12. Soundness and Completeness of tableaux reasoning in first order logic. Luciano Serafini

Mathematical Logic. Reasoning in First Order Logic. Chiara Ghidini. FBK-IRST, Trento, Italy

Lecture 10: Predicate Logic and Its Language

CHAPTER 2. FIRST ORDER LOGIC

Quantifiers and Functions in Intuitionistic Logic

Final Exam (100 points)

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Introduction to Logic in Computer Science: Autumn 2006

Logic: Propositional Logic Truth Tables

Predicate Logic - Semantic Tableau

Notes for the Logic Course 2010/2011

Predicate Calculus - Syntax

Foundations of Mathematics Worksheet 2

Chapter 4: Classical Propositional Semantics

Logic: Propositional Logic Tableaux

Notes on Propositional and First-Order Logic (CPSC 229 Class Notes, January )

Relations to first order logic

INF3170 Logikk Spring Homework #8 For Friday, March 18

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Handout Proof Methods in Computer Science

Propositional and Predicate Logic - VII

Phase 1. Phase 2. Phase 3. History. implementation of systems based on incomplete structural subsumption algorithms

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

Incomplete version for students of easllc2012 only. 6.6 The Model Existence Game 99

Logic Part I: Classical Logic and Its Semantics

AAA615: Formal Methods. Lecture 2 First-Order Logic

Lecture 13: Soundness, Completeness and Compactness

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Discrete Mathematics

2-4: The Use of Quantifiers

Logical Structures in Natural Language: First order Logic (FoL)

Formal (Natural) Deduction for Predicate Calculus

Logic for Computer Scientists

Computational Logic. Recall of First-Order Logic. Damiano Zanardini

CHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS

Logics with Counting. Ian Pratt-Hartmann School of Computer Science University of Manchester Manchester M13 9PL, UK

Predicate Logic: Sematics Part 1

Logic for Computer Scientists

Lloyd-Topor Completion and General Stable Models

Introduction to Sets and Logic (MATH 1190)

Logic: The Big Picture

Logic: Propositional Logic (Part I)

Principles of Knowledge Representation and Reasoning

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

Modal Logic & Kripke Semantics

Fuzzy Description Logics

Classical First-Order Logic

arxiv: v1 [math.lo] 8 Mar 2018

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Introduction to Logic in Computer Science: Autumn 2007

Syntax of FOL. Introduction to Logic in Computer Science: Autumn Tableaux for First-order Logic. Syntax of FOL (2)

Deductive Systems. Lecture - 3

Temporal Logic - Soundness and Completeness of L

First-Order Logic. Chapter Overview Syntax

Propositional Logic Language

Ling 130 Notes: Predicate Logic and Natural Deduction

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

arxiv: v1 [cs.lo] 8 Jan 2013

Logic for Computer Scientists

List of errors in and suggested modifications for First-Order Modal Logic Melvin Fitting and Richard L. Mendelsohn August 11, 2013

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf

MAT2345 Discrete Math

Logic: First Order Logic (Part I)

Some Rewriting Systems as a Background of Proving Methods

INTRODUCTION TO LOGIC

Saturation up to Redundancy for Tableau and Sequent Calculi

Math Fundamentals of Higher Math

Lecture 2: Syntax. January 24, 2018

Logics for Data and Knowledge Representation

INTRODUCTION TO LOGIC 8 Identity and Definite Descriptions

All psychiatrists are doctors All doctors are college graduates All psychiatrists are college graduates

Logic: First Order Logic

Introduction to first-order logic:

Theory of Computer Science

Herbrand Theorem, Equality, and Compactness

First-Order Logic (FOL)

G52DOA - Derivation of Algorithms Predicate Logic

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

Forcing in Lukasiewicz logic

CS156: The Calculus of Computation Zohar Manna Winter 2010

INTRODUCTION TO LOGIC 8 Identity and Definite Descriptions

Handout #7 Predicate Logic Trees

2. Use quantifiers to express the associative law for multiplication of real numbers.

.. Discrete Mathematics. Yi Li. June 9, Software School Fudan University. Yi Li (Fudan University) Discrete Mathematics June 9, / 15

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

Classical First-Order Logic

Discrete Mathematics

COMP 409: Logic Homework 5

cis32-ai lecture # 18 mon-3-apr-2006

Translating Ontologies from Predicate-based to Frame-based Languages

Introduction to Predicate Logic Part 1. Professor Anita Wasilewska Lecture Notes (1)

Proseminar on Semantic Theory Fall 2013 Ling 720 First Order (Predicate) Logic: Syntax and Natural Deduction 1

First-order resolution for CTL

Lecture 7. Logic. Section1: Statement Logic.

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation

06 From Propositional to Predicate Logic

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

Transcription:

Exercises for the Logic Course First Order Logic Course Web Page http://www.inf.unibz.it/~artale/dml/dml.htm Computer Science Free University of Bozen-Bolzano December 22, 2017

1 Exercises 1.1 Formalisation 1.1.1 Graph properties Formalise properties of the below graph first using the language with only the binary relation symbol R, and then using the language with the binary relation symbol R, and the constant symbols c 1 and c 2. 1 2 1.1.2 Program properties (Homework) Write a first-order formula expressing that an array of size 3 is sorted in decreasing order. Solution. A sentence expressing this is ( ( ) ( i (0 = i 0 < i) i < 3 arr ( i ) < arr ( s(i) ))) with L = <; s, arr; 3, 0 where 0 is a constant symbol which stands for 0, 3 is a constant symbol which stands for 3 (the size of the array), s is a unary function symbol and s(i) stands for successor of i, arr is a unary function symbol and arr(i) stands for i-th element of the array, < is a binary relation symbol which stands for the standard linear order over naturals (we wrote s < t instead of <(s, t) for keeping the sentence readable). 1.2 Substitutions Consider a language with a constant symbol c, binary predicate r and unary predicate p. Compute the following simultaneous substitutions of the constant symbol for all the free occurrences of a variable: y r(x, y)[x/c] (read: substitution of c for x ); x p(x)[x/c]; y ( x r(x, y) r(x, y) ) [x/c]; ( r(x, y) y r(x, y) ) [x/c, y/d]. 1.3 Semantics and Informal Semantic Arguments 1.3.1 Model Checking Read Definition 7.19 in your textbook (p. 137) and Theorem 7.20 (p. 138) for tackling the following exercises. 1

(1) Consider a first order language with a binary predicate r, and a unary predicate p. Consider the interpretation I with domain {0, 1}, and p I = {0, 1} ; r I = {(0, 0), (0, 1)}. Check whether I is a model or a counter-model of the following three formulae, and justify your answers: xp(x); x y r(x, y); x y r(x, y). (Visualisation aid: depict the interpretation as a (directed) graph with nodes 0, 1 and p I predicating that both nodes are, say, pink coloured. Then check the above properties also pictorially.) (2) (Homework) Consider the graph on the right and the first-order language with only the binary predicate r. Define in set-theoretic terms the interpretation I with: domain equal to the set of nodes of the graph; r I equal to the set of edges of the graph. Determine which of the following formulas I satisfies: (i) x r(x, x); (ii) x y(r(x, y) r(y, x)). Define a closed formula different than the above two and of which I is a model. Justify your answers. 1.3.2 Satisfiability: Model or Countermodel Building (1) Consider a first-order language with one binary predicate, r, and one constant, c. Let ϕ be the following closed formula: x y ( r(x, y) r(y, c) ). Define two interpretations I 1 and I 2, each with underlying domain {0, 1}, such that I 1 = ϕ (i.e., I 1 is a model of ϕ) and I 2 = ϕ (i.e., I 2 is a counter-model of ϕ). Solution. Take I 1 and I 2 as follows: both r I1 and r I2 are ; c I1 is 0, whereas c I2 is 1. Then I 1 = ϕ but I 2 = ϕ (prove it as in 1.3.1) (2) (Homework) Consider the language with one binary predicate, r. Let ϕ be the following closed formula: ( x y r(x, y) z ( r(y, z) r(x, z) )). Define two interpretations I 1 and I 2 for ϕ so that: both have domains equal to the set of all natural numbers, N, but I 1 is a model of ϕ, and I 2 is a counter-model of ϕ. Solution. Define r I1 as the successor relation over natural numbers and r I2 as <. (3) Consider a language with a unary predicate p and constant c. Find an interpretation that falsifies (a.k.a., is a countermodel of) xp(x) p(c). 1 2 3 1.3.3 Validity and Unsatisfiability Consider a first-order language with at least a constant c and a predicate p. following closed formulae of the language: Consider the 2

1. xϕ x ϕ; 2. xϕ x ϕ; 3. x(ϕ(x) ψ(x)) ( xϕ(x) xψ(x)) (homework); 4. x(ϕ(x) ψ(x)) ( xϕ(x) xψ(x)) (homework); 5. xϕ x ϕ. Using an informal semantic argument, prove that (1) (4) are valid, and (5) is unsatisfiable. Solution. Let us prove that = x(ϕ(x) ψ(x)) ( xϕ(x) xψ(x)). This means that, for all interpretations I, we have I = x(ϕ(x) ψ(x)) ( xϕ(x) xψ(x)), that is, I = x(ϕ(x) ψ(x)) iff I = xϕ(x) xψ(x). We prove the following claim: (1) we assume I = x(ϕ(x) ψ(x)) and prove I = xϕ(x) xψ(x); (2) then we assume I = xϕ(x) xψ(x) and prove I = x(ϕ(x) ψ(x)). (1) I = x(ϕ(x) ψ(x)) means that, for every d in the domain in I, we have I, [x/d] = ϕ(x) ψ(x) (this is a shortand for: for all assignments v, we have I, v [x d] = ϕ(x) ψ). Therefore I, [x/d] = ϕ(x) and I, [x/d] = ψ(x). This amounts to saying that, for all d in the domain of I, I = ϕ(x) and I = ψ(x), that is, I = xϕ(x) xψ(x). (2) I = xϕ(x) xψ(x) means that I = xϕ(x) and I = xψ(x). This means that, for every d in the domain in I, we have I, [x/d] = ϕ(x) and I, [x/d] = ψ(x). Therefore I, [x/d] = ϕ(x) ψ(x), for every d in the domain in I, and hence I = x(ϕ(x) ψ(x)). Let us prove that = xϕ(x) x ϕ(x). We prove a stronger claim, that is, the formula is unsatisfiable: no interpretation satisfies it. We reason by contradition and assume that there exists I so that I = xϕ(x) x ϕ(x). Then I = xϕ(x) (*) and I = x ϕ(x) (**). Now, (*) means that, for every d in the domain of I, we have I, [x/d] = ϕ(x). Instead (**) means that there exists d in the domain of I so that I, [x/d ] = ϕ(x), that is, I, [x/d ] = ϕ(x). Such two statements are contraditory. 1.4 The Tableau Calculus and Procedure 1.4.1 Scaffolding Exercises Detect what s wrong in the following tableau procedures, constructed as in the lecture slides, and fix them to prove what is required. 1 Prove that xp(x) xq(x) is satisfiable. What s wrong with the following tableau for proving it? Fix it. xp(x) xq(x) [ xp(x)] [ xq(x)] p(c) q(c) 3

2 Prove that xϕ(x) x ϕ(x) is unsatisfiable. What s wrong with the following tableau for proving it? Fix it. xϕ(x) x ϕ(x) xϕ(x) [ x ϕ(x)] ϕ(d) ϕ(c) xϕ(x) 3 Prove that xp(x) xp(x) is valid. What s wrong with the following tableau for proving it? Fix it. xp(x) xp(x) x p(x) xp(x) x p(x) p(c) xp(x) p(d) 1.4.2 For Satisfiability 1. Use the tableau procedure to prove that xr(x, x) is satisfiable, where r is a binary predicate symbol. Use the tableau to construct a model for the formula. Solution. We build an tableau for xr(x, x) for proving this to be satisfiable and defining a model for it. xr(x, x) r(a, a) xr(x, x) A model I is given by the (single) branch: it has domain D = {a} and r I = {(a, a)}. 2. Use the tableau procedure to prove that x y(r(x, y) r(y, x)) is satisfiable, where r is a binary predicate symbol. Use the tableau to construct a model for the formula. Solution. We first transform the formula into negated normal form (NNF) and then build an tableau for this to prove that x y(r(x, y) r(y, x)) is satisfiable and define a model for it. The NNF is the equivalent formula x y( r(x, y) r(y, x)). 4

x y( r(x, y) r(y, x)) y( r(a, y) r(y, a)) x y( r(x, y) r(y, x)) [ r(a, a) r(a, a)] y( r(a, y) r(y, a)) r(a, a) r(a, a) The two branches give two models, both with the same domain D = {a}; in one r I = ; in the other r I = {(a, a)}. 1.4.3 For Validity 1. Consider the following closed formulae of a first-order language with only predicates and constants. Use tableaux to prove that they are valid. xp(x) xp(x); (1) yp(y) xp(x); (2) x(p(x) p (x)) xp(x); (3) x(p(x) p (x)) xp(x); (4) x(p(x) p (x)) x(p(x) p (x)). (5) Solution. To prove that (1) and (2) are valid, we first negate them and transform the negated formulae into NNF; we finally build a closed tableau for each of the resulting NNF formulae. (1) ( xp(x) xp(x)) xp(x) x p(x). (2) ( yp(y) xp(x)) yp(y) x p(x). xp(x) x p(x) xp(x) x p(x) p(c) xp(x) p(c) x p(x) closed 5

yp(y) x p(x) yp(y) [ x p(x)] yp(y) p(c) p(c) yp(y) closed 2. Consider the following closed formulae of a first-order language with only a binary predicate: ϕ is xr(x, x), ψ is x y(r(x, y) r(y, x)). Using a semantic argument or the tableau procedure, verify whether the following two formulae 1. ϕ ψ 2. ψ ϕ are valid. In case the given formulae are not valid, define counter-models for them. Solution. To prove that the given formulae are not valid, we negate them and transform the negated formulae into NNF; we finally build an tableau for each of the resulting NNF formulae. The negation of the first formula is equivalent to xr(x, x) x y(r(x, y) r(y, x)). A tableau for it is as follows: xr(x, x) x y(r(x, y) r(y, x)) xr(x, x) [ x y(r(x, y) r(y, x))] [ y(r(a, y) r(y, a))] [r(a, b) r(b, a)] r(a, b) r(b, a) r(a, a) r(b, b) xr(x, x) An interpretation I that is a counter-model of the formula is found along the branch of the tableau: r I = {(a, b), (a, a), (b, b)}. The negation of the second formula is equivalent to x r(x, x) x y( r(x, y) r(y, x)). A tableau for it is as follows: 6

x r(x, x) x y( r(x, y) r(y, x)) [ x r(x, x)] x y( r(x, y) r(y, x)) r(a, a) y( r(a, y) r(y, a)) x y( r(x, y) r(y, x)) r(a, a) r(a, a) y( r(a, y) r(y, a)) r(a, a) r(a, a) closed An interpretation I that is a counter-model of the formula is found along the branch of the tableau: r I =. 7