Intro to First-Order Logic. Propositional Logic Propositional Logic is a language for creating functions that take N binary values (true or false) as.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
Completeness and Expressiveness
Logic & Critical Reasoning Translation into Propositional Logic.
NP-Hard Nattee Niparnan.
Situation Calculus for Action Descriptions We talked about STRIPS representations for actions. Another common representation is called the Situation Calculus.
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
Knowledge Representation Methods
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
CSRU 1100 Logic. Logic is concerned with determining: Is it True? Is it False?
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Let remember from the previous lesson what is Knowledge representation
Predicate Calculus.
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
The Language of Propositional Logic The Syntax and Semantics of PL.
Ryan Chu. Arithmetic Expressions Arithmetic expressions consist of operators, operands, parentheses, and function calls. The purpose is to specify an.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
First Order Logic Chapter 7. PL is a Weak Representational Language §Propositional Logic (PL) is not a very expressive language because: §Hard to identify.
Atomic Sentences Chapter 1 Language, Proof and Logic.
Variables Tutorial 3c variable A variable is any symbol that can be replaced with a number to solve a math problem. An open sentence has at least one.
Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Database Management Systems, R. Ramakrishnan1 Relational Calculus Chapter 4.
Pattern-directed inference systems
ARTIFICIAL INTELLIGENCE Lecture 3 Predicate Calculus.
Copyright © Curt Hill Mathematical Logic An Introduction.
Course Overview and Road Map Computability and Logic.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
LDK R Logics for Data and Knowledge Representation PL of Classes.
Formal Methods in Software Engineering 1
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Extra slides for Chapter 3: Propositional Calculus & Normal Forms Based on Prof. Lila Kari’s slides For CS2209A, 2009 By Dr. Charles Ling;
CS6133 Software Specification and Verification
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
For Friday Read chapter 8 Homework: –Chapter 7, exercises 2 and 10 Program 1, Milestone 2 due.
Intro to Planning Or, how to represent the planning problem in logic.
Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
Complexity 24-1 Complexity Andrei Bulatov Interactive Proofs.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Propositional Logic. Assignment Write any five rules each from two games which you like by using propositional logic notations.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
Artificial Intelligence Logical Agents Chapter 7.
Parts of an Expression.
COMPUTING FUNDAMENTALS
Semantics In propositional logic, we associate atoms with propositions about the world. We specify the semantics of our logic, giving it a “meaning”. Such.
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Relational Logic Semantics
Logics for Data and Knowledge Representation
Chapter 3: Selection Structures: Making Decisions
Boolean Expressions to Make Comparisons
Herbrand Logic Semantics
Chapter 3: Selection Structures: Making Decisions
Relational Logic Semantics
Logical and Rule-Based Reasoning Part I
Truth tables.
Logics for Data and Knowledge Representation
Presentation transcript:

Intro to First-Order Logic

Propositional Logic Propositional Logic is a language for creating functions that take N binary values (true or false) as input, and return a single binary value. Syntax: variables (lower-case letters): a, x 1, y, z, … logical connectives: () Functions in propositional logic are called sentences. They consist of variables joined together with the logical connectives, like this: ( a b) (c d) This example is a function that takes four binary inputs and returns a binary output. Each input gets mapped to one of the four variables.

Quiz: Propositional Logic Write a function in propositional logic for each of the following descriptions: 1. Create a function that is true if and only if input a has the same value as input b, or input a has the same value as input c. 2. Create a function that is true if and only if exactly one of the three inputs is true. 3. Create a function that is true if and only if there are an even number of true inputs, out of a total of four inputs.

Answer: Propositional Logic 1.(a b) (a c) 2.(a b c) ( a b c) ( a b c) 3.( a b c d) (a b c d) (a b c d) (a b c d)

Model A Model in Propositional Logic is the name for an assignment of values to each of the variables in a sentence. You can also just think of it as binary inputs. For example, heres a sentence: (a b) (a c) And heres a model for it: {a t, b f, c t} (sentence returns true) Heres another model for this sentence: {a f, b t, c t} (sentence returns false

Computational Problems for Propositional Logic A sentence that is always true is called valid. A sentence that is sometimes true, and sometimes not, is called satisfiable. A sentence that is never true is called unsatisfiable. Computational Problems 1.Validity Testing: Given a sentence in PL, is it always true, no matter what the input? 2.Satisfiability: Given a sentence in PL, is there some input that makes it return true?

Quiz: Valid, Satisfiable, or Unsatisfiable? 1.(a b) (a c) 2.(a b c) ( a b c) ( a b c) 3.a a 4.a a

Answers: Valid, Satisfiable, or Unsatisfiable? 1.(a b) (a c) Satisfiable. For instance, when a is true and b is true, the function returns true. But when a is true, b is false, and c is false, the function returns false, so it cant be always true. 2.(a b c) ( a b c) ( a b c) Satisfiable. A true, b false, c false makes this sentence true. A false, b false, c false makes this sentence false. 3.a a Unsatisfiable. If a is true, the sentence is false, and if a is false, the sentence is false. 4.a a Valid. If a is true, the sentence is true, and if a is false, the sentence is true.

Quiz: Properties of the Computational Problems 1. What is the computational complexity of the satisfiability problem? 2. How about validity? 3. Are there any simplifications that are easier?

Answers: Properties of the Computational Problems 1. What is the computational complexity of the satisfiability problem? NP-Complete 2. How about validity? co-NP 3. Are there any simplifications that are easier? 3-SAT is also NP-complete 2-SAT is in P.

One Motivation for First-Order Logic Heres another PL sentence: a (b c) Lets make it more interesting by renaming the variables: Jonny_is_in_water => (Jonny_swims Jonny_sinks) This is still a function from binary variables to binary outputs. Its not a very good description of whats going on. Intuitively, this should be true for anyone, not just Jonny, but in PL we would need to create a copy with different binary variables to describe each new fact.

From Propositional to First-Order Logic Jonny_is_in_water => (Jonny_swims Jonny_sinks) All PL sentences are also FOL sentences. But in FOL we can also add new kinds of syntax. For instance: Is_in(Jonny, water) => (swims(Jonny) sinks(Jonny)) This is a sentence in FOL that is not in PL. It involves some new syntax: Object constants: Jonny, water Relations: Is_in(,); swims(); sinks() The new version of this sentence makes clear that there is an object (called Jonny) that has some properties (if Jonny is in water, he either swims or sinks).

FOL Syntax FOL is a language for creating functions that map from input sets of objects to a binary value. The basic elements are: Constants: Jonny, water, Mary Sue, … Variables (lower-case letters): a, x, y, … Relations (variables with parentheses): Is_in(), swims(), greaterThan(), isPresidentOf(), … Functions (variables with parentheses): heightOf(), engagedTo(), bornOnDate(), … Logical connectives: () Quantifiers: A FOL sentence consists of relations that are connected by the logical connectivies, just like PL variables are connected by logical connectives. One difference is that relations take arguments, either constants, functions, or variables. For each variable used in a sentence, there must be a quantifier.

Example FOL Sentences Single-relation sentences: 1.swims(Jonny) 2.presidentOf(BarackObama, USA) 3. x bornInYear(x, 1960) 4. x bornInYear(x, subtract(2013, age(x))) Multi-relation sentences: 1.Is_in(Jonny, water) => (swims(Jonny) sinks(Jonny)) 2. x Is_in(x, water) => (swims(x) sinks(x)) 3. x,y duck(x) raindrop(y) => dripsOff(y, back(x))

Quiz: FOL Sentences Come up with FOL sentences for each of these English descriptions: 1.Simba is cute. 2.Arnulfo walked to the store. 3.Arnulfo walked to a store. 4.Erin despises Madeleine. 5.Erin loves all people except for Madeleine.

Answers: FOL Sentences Come up with FOL sentences for each of these English descriptions: 1.Simba is cute. cute(Simba) 2.Arnulfo walked to the store. walkedTo(Arnulfo, Store27) 3.Arnulfo walked to a store. x walkedTo(Arnulfo, x) 4.Erin despises Madeleine. despises(Erin, Madeleine) 5.Erin loves all people except for Madeleine. x person(x) =(x, Madeleine) => loves(Erin, x)

Models in FOL A Model in FOL is primarily an assignment of sets of objects to relations (thats usually the most interesting part). However, a model must also assign objects to the constant symbols, and it must assign maps between objects to the function symbols. Heres an example Model: person {ErinLawrence, MaddieMayne, ArnulfoArias} = {(ErinLawrence,ErinLawrence), (MaddieMayne,MaddieMayne), (ArnulfoArias, ArnulfoArias)} loves {(ErinLawrence,ArnulfoArias), (ArnulfoArias,MaddieMayne)} Madeleine MaddieMayne Erin ErinLawrence Arnulfo ArnulfoArias Quiz: Is this sentence true, given the model above? x person(x) =(x, Madeleine) => loves(Erin, x)

Answer: Models in FOL A Model in FOL is primarily an assignment of sets of objects to relations (thats usually the most interesting part). However, a model must also assign objects to the constant symbols, and it must assign maps between objects to the function symbols. Heres an example Model: person {ErinLawrence, MaddieMayne, ArnulfoArias} = {(ErinLawrence,ErinLawrence), (MaddieMayne,MaddieMayne), (ArnulfoArias, ArnulfoArias)} loves {(ErinLawrence,ArnulfoArias), (ArnulfoArias,MaddieMayne)} Madeleine MaddieMayne Erin ErinLawrence Arnulfo ArnulfoArias Answer: This sentence is NOT true using the model above, since ErinLawrence does not love ErinLawrence in the model. x person(x) =(x, Madeleine) => loves(Erin, x)

Intuition for FOL: Describing Possible Worlds You can think of each FOL model as being its own world with its own objects, and relationships between objects. FOL sentences assign a true or false value to every one of these possible worlds. So one way to think about FOL is: Its a way to describe what worlds are actually possible, given everything that I know (or believe). For instance, I believe 2+2=4. So if I write the FOL sentence =(+(2,2), 4), I am describing my belief that all worlds (models) in which 2+2 is not equal to 4 must be false. As another example, I am not sure who will be president of the US in 2017, but lets say (just to keep it simple) I believe that it will be either Marco Rubio or Hillary Clinton. Then if I write presidentOf(MarcoRubio, US, 2017) presidentOf(HillaryClinton, US, 2017), I am saying that I believe I live in some subset of all possible worlds, but in every one of those possible worlds that I believe Im in, either Hillary Clinton or Marco Rubio becomes president in 2017.

Quiz: More FOL Questions Some rules we will assume for models: 1.All models must have at least one object 2.All models must use the normal version of the = relation. Given these rules, determine if the following FOL sentences are valid, satisfiable, or unsatisfiable: 1.x, y. x = y 2.(x. x=x) => (y z. y=z) 3.x p(x) p(x) 4.x p(x)

Answers: More FOL Questions Some rules we will assume for models: 1.All models must have at least one object 2.All models must use the normal version of the = relation. Given these rules, determine if the following FOL sentences are valid, satisfiable, or unsatisfiable: 1.x, y. x = y: valid 2.(x. x=x) => (y z. y=z): valid 3.x p(x) p(x): valid 4.x p(x): satisfiable

Comparison: PL vs. FOL FOL allows for more uncertainty. For example, in PL you can say either x or y is true, but youre not sure which of the two. But in FOL, you can say P(x) is true for some object x, but youre not sure which out of all objects. FOL allows for more shortcuts. (That is, it allows you to express the same thing as PL in a much more compact form.) For example, in PL you can say Jonny_has_two_eyes Susie_has_two_eyes … Zeb_has_two_eyes. In FOL, you can say x human(x) => hasTwoEyes(x) FOL accepts richer inputs (models). In PL, the input is a set of binary values. In FOL, the input is sets of objects, maps between them, etc.