Download presentation

Presentation is loading. Please wait.

Published byLesly Goodnough Modified over 3 years ago

1
Intro to First-Order Logic

2
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.

3
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.

4
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)

5
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

6
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?

7
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

8
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.

9
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?

10
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.

11
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.

12
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).

13
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.

14
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))

15
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.

16
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)

17
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)

18
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)

19
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.

20
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)

21
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

22
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.

Similar presentations

OK

Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.

Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on condition monitoring services Ppt on recycling of waste in korea Ppt on commercial use of microorganisms Ppt on grooming and etiquettes of life Ppt on asymptotic notation of algorithms Ppt on bakery business plan Ppt on autism Ppt on wild animals Ppt on different solid figures games Ppt on building information modeling system