Logic: The Big Picture

Similar documents
Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Bound and Free Variables. Theorems and Proofs. More valid formulas involving quantifiers:

Propositional Logic: Syntax

Logic. Propositional Logic: Syntax. Wffs

Logic. Propositional Logic: Syntax

Regular Languages and Finite Automata

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

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

Victoria Gitman and Thomas Johnstone. New York City College of Technology, CUNY

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

Part I: Propositional Calculus

Propositional Logic Not Enough

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

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

02 Propositional Logic

First Order Logic (FOL) 1 znj/dm2017

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

First Order Logic: Syntax and Semantics

Gödel s Incompleteness Theorem. Overview. Computability and Logic

x = a Yes No x = x Yes No xcube(y) Yes No x x xcube(x) Yes No x Yes No x(x Cube(x)) Yes No x(tall(x) Short(tim)) Yes No

CHAPTER 2. FIRST ORDER LOGIC

An Introduction to Modal Logic III

Class 29 - November 3 Semantics for Predicate Logic

Ling 130 Notes: Predicate Logic and Natural Deduction

Propositional Logic: Part II - Syntax & Proofs 0-0

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

03 Review of First-Order Logic

Gödel s Incompleteness Theorem. Overview. Computability and Logic

Learning Goals of CS245 Logic and Computation

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

Predicate Logic: Sematics Part 1

Discrete Mathematics and Probability Theory Fall 2012 Vazirani Note 1

Gödel s Incompleteness Theorems

6-1 Computational Complexity

Predicate Calculus - Syntax

CS21 Decidability and Tractability

Proposi'onal Logic Not Enough

Mathematical Logic. Introduction to Reasoning and Automated Reasoning. Hilbert-style Propositional Reasoning. Chiara Ghidini. FBK-IRST, Trento, Italy

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

An Introduction to Modal Logic V

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

Introduction to Metalogic

Proofs. Chapter 2 P P Q Q

Marie Duží

About the relationship between formal logic and complexity classes

185.A09 Advanced Mathematical Logic

MCS-236: Graph Theory Handout #A4 San Skulrattanakulchai Gustavus Adolphus College Sep 15, Methods of Proof


Herbrand Theorem, Equality, and Compactness

Relations to first order logic

Formal Logic: Quantifiers, Predicates, and Validity. CS 130 Discrete Structures

Logic and Probability Lecture 3: Beyond Boolean Logic

Propositional and Predicate Logic - XIII

Lecture 11: Measuring the Complexity of Proofs

Proofs. Chapter 2 P P Q Q

ILP = Logic, CS, ML Stop counting, start reasoning

Informal Statement Calculus

Notation for Logical Operators:

MAGIC Set theory. lecture 2

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

Introduction to Logic

Relational Reasoning in Natural Language

Reasoning. Inference. Knowledge Representation 4/6/2018. User

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

Predicate Logic - Deductive Systems

CS70 is a course about on Discrete Mathematics for Computer Scientists. The purpose of the course is to teach you about:

Predicate Logic. Andreas Klappenecker

Part II Logic and Set Theory

Math 267a - Propositional Proof Complexity. Lecture #1: 14 January 2002

MAI0203 Lecture 7: Inference and Predicate Calculus

COMP 2600: Formal Methods for Software Engineeing

CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE

Announcements CompSci 102 Discrete Math for Computer Science

CSE 311: Foundations of Computing. Lecture 6: More Predicate Logic

... The Sequel. a.k.a. Gödel's Girdle

How to determine if a statement is true or false. Fuzzy logic deal with statements that are somewhat vague, such as: this paint is grey.

Arithmetic and Incompleteness. Will Gunther. Goals. Coding with Naturals. Logic and Incompleteness. Will Gunther. February 6, 2013

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

September 13, Cemela Summer School. Mathematics as language. Fact or Metaphor? John T. Baldwin. Framing the issues. structures and languages

On the Complexity of the Reflected Logic of Proofs

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1

Proof Rules for Correctness Triples

Final Exam (100 points)

The Complexity and Proof Complexity of the Comparator Circuit Value Problem

First order logic. Example The deduction of statements: This reasoning is intuitively correct. Every man is mortal. Since Ade is a man, he is mortal.

Logic Part I: Classical Logic and Its Semantics

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

Introduction to Sets and Logic (MATH 1190)

Chapter 3. Formal Number Theory

A An Overview of Complexity Theory for the Algorithm Designer

Every formula evaluates to either \true" or \false." To say that the value of (x = y) is true is to say that the value of the term x is the same as th

Exercises 1 - Solutions

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

First Order Logic: Syntax and Semantics

23.1 Gödel Numberings and Diagonalization

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Propositional, First-Order And Higher-Order Logics: Basic Definitions, Rules of Inference, and Examples

Transcription:

Logic: The Big Picture A typical logic is described in terms of syntax: what are the legitimate formulas semantics: under what circumstances is a formula true proof theory/ axiomatization: rules for proving a formula true Truth and provability are quite different. What is provable depends on the axioms and inference rules you use Provability is a mechanical, turn-the-crank process What is true depends on the semantics

Hilbert-style proof systems Prof. George talked about what are called natural deduction systems. Here is a slightly different (but related!) approach to proof systems. An axiom system consists of axioms (special formulas) rules of inference: ways of getting new formulas from other formulas. These have the form A 1,..., A n B Read this as from A 1,..., A n, infer B. Think of the axioms as tautologies, while the rules of inference give you a way to derive new tautologies from old ones.

Derivations A derivation (or proof ) in an axiom system AX is a sequence of formulas C 1,..., C N ; each formula C k is either an axiom in AX or follows from previous formulas using an inference rule in AX : i.e., there is an inference rule A 1,..., A n B such that A i = C ji for some j i < N and B = C N. This is said to be a derivation or proof of C N. A derivation is a syntactic object: it s just a sequence of formulas that satisfy certain constraints. Whether a formula is derivable depends on the axiom system Different axioms different formulas derivable Derivation has nothing to do with truth! How can we connect derivability and truth? In propositional logic, what is true depends on the truth assignment In first-order logic, truth depends on the interpretation

Typical axioms of propositional logic: P P P (Q P) What makes an axiom acceptable? it s a tautology

Typical axioms of propositional logic: P P P (Q P) What makes an axiom acceptable? it s a tautology Typical rule of inference is modus ponens A B, A B What makes an inference rule acceptable? it preserves validity if the formulas on the left-hand side of are tautologies, then so is the formula on the right-hand side of

Sound and Complete Axiomatizations Standard question in logic: Can we come up with a nice sound and complete axiomatization: a (small, natural) collection of axioms and inference rules from which it is possible to derive all and only the tautologies? Soundness says that only tautologies are derivable Completeness says you can derive all tautologies If all the axioms are valid and all rules of inference preserve validity, then all formulas that are derivable must be valid. Proof: by induction on the length of the derivation It s not so easy to find a complete axiomatization.

A Sound and Complete Axiomatization for Propositional Logic Consider the following axiom schemes: A1. A (B A) A2. (A (B C)) ((A B) (A C)) A3. ((A B) (A B)) A These are axioms schemes; each one encodes an infinite set of axioms: P (Q P) and (P R) (Q (P R)) are instances of A1.

A Sound and Complete Axiomatization for Propositional Logic Consider the following axiom schemes: A1. A (B A) A2. (A (B C)) ((A B) (A C)) A3. ((A B) (A B)) A These are axioms schemes; each one encodes an infinite set of axioms: P (Q P) and (P R) (Q (P R)) are instances of A1. Theorem: A1, A2, A3 + modus ponens give a sound and complete axiomatization for formulas in propositional logic involving only and. Recall: can define and using and P Q is equivalent to P Q P Q is equivalent to (P Q)

A Sample Proof Derivation of P P: 1. P ((P P) P) [instance of A1: take A = P, B = P P] 2. (P ((P P) P)) ((P (P P)) (P P)) [instance of A2: take A = C = P, B = P P] 3. (P (P P)) (P P) [applying modus ponens to 1, 2] 4. P (P P) [instance of A1: take A = B = P] 5. P P [applying modus ponens to 3, 4] Try deriving P P from these axioms it s hard!

It s typically easier to check that a formula is a tautology than it is to prove that it s true, using the axioms Just try all truth assignments Once you prove that an axiom system is sound and complete, you know that if ϕ is a tautology, then there is a derivation of ϕ from the axioms (even if it s hard to find)

Syntax of First-Order Logic We have: constant symbols: Alice, Bob variables: x, y, z,... predicate symbols of each arity: P, Q, R,... A unary predicate symbol takes one argument: P(Alice), Q(z) A binary predicate symbol takes two arguments: Loves(Bob,Alice), Taller(Alice,Bob). An atomic expression is a predicate symbol together with the appropriate number of arguments. Atomic expressions act like primitive propositions in propositional logic we can apply,, to them we can also quantify the variables that appear in them Typical formula: x y(p(x, y) zq(x, z))

Semantics of First-Order Logic Assume we have some domain D. The domain could be finite: {1, 2, 3, 4, 5} the people in this room The domain could be infinite N, R,... A statement like xp(x) means that P(d) is true for each d in the domain. If the domain is N, then xp(x) is equivalent to P(0) P(1) P(2)... Similarly, xp(x) means that P(d) is true for some d in the domain. If the domain is N, then xp(x) is equivalent to P(0) P(1) P(2)...

Is x(x 2 = 2) true? Yes if the domain is R; no if the domain is N. How about x y((x < y) z(x < z < y))?

First-Order Logic: Formal Semantics How do we decide if a first-order formula is true? Need: a domain D (what are you quantifying over) an interpretation I that interprets the constants and predicate symbols: for each constant symbol c, I (c) D Which domain element is Alice? for each unary predicate P, I (P) is a predicate on domain D formally, I (P)(d) {true,false} for each d D Is Alice Tall? How about Bob? for each binary predicate Q, I (Q) is a predicate on D D: formally, I (Q)(d 1, d 2) {true,false} for each d 1, d 2 D Is Alice taller than Bob? a valuation V associating with each variable x an element V (x) D. To figure out if P(x) is true, you need to know what x is.

Defining Truth in First-Order Logic Now we can define whether a formula A is true, given a domain D, an interpretation I, and a valuation V, written (I, D, V ) = A. Read this from right to left: A is true at ( =) (I, D, V )

Defining Truth in First-Order Logic Now we can define whether a formula A is true, given a domain D, an interpretation I, and a valuation V, written (I, D, V ) = A. Read this from right to left: A is true at ( =) (I, D, V ) The definition is by induction: (I, D, V ) = P(x) if I (P)(V (x)) = true

Defining Truth in First-Order Logic Now we can define whether a formula A is true, given a domain D, an interpretation I, and a valuation V, written (I, D, V ) = A. Read this from right to left: A is true at ( =) (I, D, V ) The definition is by induction: (I, D, V ) = P(x) if I (P)(V (x)) = true (I, D, V ) = P(c) if I (P)(I (c))) = true

Defining Truth in First-Order Logic Now we can define whether a formula A is true, given a domain D, an interpretation I, and a valuation V, written (I, D, V ) = A. Read this from right to left: A is true at ( =) (I, D, V ) The definition is by induction: (I, D, V ) = P(x) if I (P)(V (x)) = true (I, D, V ) = P(c) if I (P)(I (c))) = true (I, D, V ) = xa if (I, D, V ) = A for all valuations V that agree with V except possibly on x V (y) = V (y) for all y x V (x) can be arbitrary (I, D, V ) = xa if (I, D, V ) = A for some valuation V that agrees with V except possibly on x.

Defining Truth in First-Order Logic Now we can define whether a formula A is true, given a domain D, an interpretation I, and a valuation V, written (I, D, V ) = A. Read this from right to left: A is true at ( =) (I, D, V ) The definition is by induction: (I, D, V ) = P(x) if I (P)(V (x)) = true (I, D, V ) = P(c) if I (P)(I (c))) = true (I, D, V ) = xa if (I, D, V ) = A for all valuations V that agree with V except possibly on x V (y) = V (y) for all y x V (x) can be arbitrary (I, D, V ) = xa if (I, D, V ) = A for some valuation V that agrees with V except possibly on x.

Translating from English to First-Order Logic All men are mortal Socrates is a man Therefore Socrates is mortal There is two unary predicates: Mortal and Man There is one constant: Socrates The domain is the set of all people x(man(x) Mortal(x)) Man(Socrates) Mortal(Socrates)

More on Quantifiers x yp(x, y) is equivalent to y xp(x, y) P is true for every choice of x and y Similarly x yp(x, y) is equivalent to y xp(x, y) P is true for some choice of (x, y). What about x yp(x, y)? Is it equivalent to y xp(x, y)? Suppose the domain is the natural numbers. Compare: x y(y x) y x(y x) In general, y xp(x, y) x yp(x, y) is logically valid. A logically valid formula in first-order logic is the analogue of a tautology in propositional logic. A formula is logically valid if it s true in every domain and for every interpretation of the predicate symbols.

More valid formulas involving quantifiers: xp(x) x P(x) Replacing P by P, we get: x P(x) x P(x) Therefore x P(x) xp(x) Similarly, we have xp(x) x P(x) x P(x) xp(x)

Axiomatizing First-Order Logic Just as in propositional logic, there are axioms and rules of inference that provide a sound and complete axiomatization for first-order logic, independent of the domain. A typical axiom: x(p(x) Q(x)) ( xp(x) xq(x)). A typical rule of inference is Universal Generalization: ϕ(x) xϕ(x) Gödel provided a sound and complete axioms system for first-order logic in 1930.

Axiomatizing Arithmetic Suppose we restrict the domain to the natural numbers, and allow only the standard symbols of arithmetic (+,, =, >, 0, 1). Typical true formulas include: x y(x y = x) x y(x = y + y x = y + y + 1) Let Prime(x) be an abbreviation of When is Prime(x) true? y z((x = y z) ((y = 1) (y = x)))

Axiomatizing Arithmetic Suppose we restrict the domain to the natural numbers, and allow only the standard symbols of arithmetic (+,, =, >, 0, 1). Typical true formulas include: x y(x y = x) x y(x = y + y x = y + y + 1) Let Prime(x) be an abbreviation of y z((x = y z) ((y = 1) (y = x))) When is Prime(x) true? If x is prime!

Axiomatizing Arithmetic Suppose we restrict the domain to the natural numbers, and allow only the standard symbols of arithmetic (+,, =, >, 0, 1). Typical true formulas include: x y(x y = x) x y(x = y + y x = y + y + 1) Let Prime(x) be an abbreviation of y z((x = y z) ((y = 1) (y = x))) When is Prime(x) true? If x is prime! What does the following formula say? x( y(y > 1 x = y + y) z 1 z 2 (Prime(z 1 ) Prime(z 2 ) x = z 1 + z 2 ))

Axiomatizing Arithmetic Suppose we restrict the domain to the natural numbers, and allow only the standard symbols of arithmetic (+,, =, >, 0, 1). Typical true formulas include: x y(x y = x) x y(x = y + y x = y + y + 1) Let Prime(x) be an abbreviation of y z((x = y z) ((y = 1) (y = x))) When is Prime(x) true? If x is prime! What does the following formula say? x( y(y > 1 x = y + y) z 1 z 2 (Prime(z 1 ) Prime(z 2 ) x = z 1 + z 2 )) This is Goldbach s conjecture: every even number other than 2 is the sum of two primes. Is it true? We don t know.

Gödel s Incompleteness Theorem Is there a nice (technically: recursive, so that a program can check whether a formula is an axiom) sound and complete axiomatization for arithmetic? Gödel s Incompleteness Theorem: NO! This is arguably the most important result in mathematics of the 20th century.

Connections: Random Graphs Suppose we have a random graph with n vertices. How likely is it to be connected? What is a random graph? If it has n vertices, there are C(n, 2) possible edges, and 2 C(n,2) possible graphs. What fraction of them is connected? One way of thinking about this. Build a graph using a random process, that puts each edge in with probability 1/2.

Given three vertices a, b, and c, what s the probability that there is an edge between a and b and between b and c? 1/4 What is the probability that there is no path of length 2 between a and c? (3/4) n 2 What is the probability that there is a path of length 2 between a and c? 1 (3/4) n 2 What is the probability that there is a path of length 2 between a and every other vertex? > (1 (3/4) n 2 ) n 1 Now use the binomial theorem to compute (1 (3/4) n 2 ) n 1 (1 (3/4) n 2 ) n 1 = 1 (n 1)(3/4) n 2 + C(n 1, 2)(3/4) 2(n 2) + For sufficiently large n, this will be (just about) 1. Bottom line: If n is large, then it is almost certain that a random graph will be connected. In fact, with probability approaching 1, all nodes are connected by a path of length at most 2.

This is not a fluke! Suppose we consider first-order logic with one binary predicate R. Interpretation: R(x, y) is true in a graph if there is a directed edge from x to y. What does this formula say: x y(r(x, y) z(r(x, z) R(z, y) Theorem: [Fagin, 1976] If P is any property expressible in first-order logic using a single binary predicate R, it is either true in almost all graphs, or false in almost all graphs. This is called a 0-1 law. This is an example of a deep connection between logic, probability, and graph theory. There are lots of others!

Eight Powerful Ideas Counting: Count without counting (combinatorics)

Eight Powerful Ideas Counting: Count without counting (combinatorics) Induction: Recognize it in all its guises.

Eight Powerful Ideas Counting: Count without counting (combinatorics) Induction: Recognize it in all its guises. Exemplification: Find a sense in which you can try out a problem or solution on small examples.

Eight Powerful Ideas Counting: Count without counting (combinatorics) Induction: Recognize it in all its guises. Exemplification: Find a sense in which you can try out a problem or solution on small examples. Abstraction: Abstract away the inessential features of a problem. represent it as a graph describe it in first-order logic

Eight Powerful Ideas Counting: Count without counting (combinatorics) Induction: Recognize it in all its guises. Exemplification: Find a sense in which you can try out a problem or solution on small examples. Abstraction: Abstract away the inessential features of a problem. represent it as a graph describe it in first-order logic Modularity: Decompose a complex problem into simpler subproblems.

Eight Powerful Ideas Counting: Count without counting (combinatorics) Induction: Recognize it in all its guises. Exemplification: Find a sense in which you can try out a problem or solution on small examples. Abstraction: Abstract away the inessential features of a problem. represent it as a graph describe it in first-order logic Modularity: Decompose a complex problem into simpler subproblems. Representation: Understand the relationships between different representations of the same information or idea. Graphs vs. matrices vs. relations

Eight Powerful Ideas Counting: Count without counting (combinatorics) Induction: Recognize it in all its guises. Exemplification: Find a sense in which you can try out a problem or solution on small examples. Abstraction: Abstract away the inessential features of a problem. represent it as a graph describe it in first-order logic Modularity: Decompose a complex problem into simpler subproblems. Representation: Understand the relationships between different representations of the same information or idea. Graphs vs. matrices vs. relations Probabilistic inference: Drawing inferences from data Bayes rule Probabilistic methods: Flipping a coin can be surprisingly helpful! probabilistic primality checking

(A Little Bit on) NP (No details here; just a rough sketch of the ideas. Take CS 4810/4820 if you want more.) NP = nondeterministic polynomial time a language (set of strings) L is in NP if, for each x L, you can guess a witness y showing that x L and quickly (in polynomial time) verify that it s correct. Examples: Does a graph have a Hamiltonian path? guess a Hamiltonian path Is a formula satisfiable? guess a satisfying assignment Is there a schedule that satisfies certain constraints?... Formally, L is in NP if there exists a language L such that 1. x L iff there exists a y such that (x, y) L, and 2. checking if (x, y) L can be done in polynomial time

NP-completeness A problem is NP-hard if every NP problem can be reduced to it. A problem is NP-complete if it is in NP and NP-hard Intuitively, if it is one of the hardest problems in NP. There are lots of problems known to be NP-complete If any NP complete problem is doable in polynomial time, then they all are. Hamiltonian path satisfiability scheduling... If you can prove P = NP, you ll get a Turing award.