Cs 1502 formal methods in computer science
Download
1 / 35

CS 1502 Formal Methods in Computer Science - PowerPoint PPT Presentation


  • 249 Views
  • Uploaded on

CS 1502 Formal Methods in Computer Science. Lecture Notes 12 Variables and Quantifiers. Variables. A variable is a placeholder for a name in a sentence FOL gives us an infinite number of variables Tarski’s World/Fitch/Boole gives us only u , v , w , x , y , and z as variables.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CS 1502 Formal Methods in Computer Science' - jana


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cs 1502 formal methods in computer science

CS 1502 Formal Methods in Computer Science

Lecture Notes 12

Variables and Quantifiers


Variables
Variables

  • A variable is a placeholder for a name in a sentence

  • FOL gives us an infinite number of variables

  • Tarski’s World/Fitch/Boole gives us only u, v, w, x, y, and z as variables


Atomic wffs
Atomic wffs

  • Cube(b)

  • Cube(x)

  • LeftOf(c,y)

  • Between(z,b,d)

  • Larger(x,y)


Variables1

sentence

not a

sentence

Variables

  • Cube(b)  Cube(d)The truth of this sentence is determined by the truth- values of Cube(b) and Cube(d).

  • Cube(x)  Cube(d)Cube(x) is neither true nor false, since x is a placeholder for the name of an object. x is said to be free or unbound.


Forming wff
Forming wff

  • If P is wff then so is P.

  • If P1, P2, … , Pn are wffs then so is (P1  P2  …  Pn).

  • If P1, P2, … , Pn are wffs then so is (P1  P2  …  Pn).

  • If P and Q are wffs, so is (P  Q).

  • If P and Q are wffs, so is (P  Q).

  • If P is a wff and vis a variable, then v P is a wff. Every occurrence of v is said to be bound.

  • If P is a wff and v is a variable, then v P is a wff. Every occurrence of v is said to be bound.


Sentences
Sentences

  • A sentence is a well-formed formula with no unbound (free) variables.

  • The scope of a quantifier is defined as those variables that fall under the quantifier’s influence as indicated by the enclosing parentheses.


Which are sentences
Which are Sentences?

  • x LeftOf(x, y)

  • x (Cube(x)  Large(x))

  • x (Small(x)  Tet(y))

  • x (Cube(c)  SameRow(x, c))


Satisfaction diff meaning of a wff
Satisfaction (diff meaning!) of a wff

  • Let S(x) be a wff with free variable x. Object b is said to satisfy S(x) if and only if S(b) is a true sentence. EG, b satisfies Cube(x).


Semantics of quantifiers
Semantics of Quantifiers

  • x S(x) is true if and only if there is at least one object that satisfies S(x).

  • x S(x) is true if and only if every object satisfies S(x).

The truth-value is determined with

respect to a domain of discourse

(or world, or universe)


Example

x Prime(x)

x RightmostDigitIsPrime(x)

x Prime(x)

x RightmostDigitIsPrime(x)

Example

  • Universe = {2, 5, 17, 93, 67}


Some Tetrahedron is to the left of c.

Some Cube is to the left of c.

a is to the left of every Cube.

Every Cube is in back of c.

C is supposed to be back one square – as it is on the next slide


Aristotelian forms

Q

+ P

Aristotelian Forms

  • All P’s are Q’s

x [P(x)  Q(x)]


Aristotelian forms1

Q

P +

Aristotelian Forms

  • Some P’s are Q’s

x [P(x)  Q(x)]


Q

+P

Aristotelian Forms

  • No P’s are Q’s

x [P(x)  Q(x)]


Q

+ P

Aristotelian Forms

  • Some P’s are not Q’s

x [P(x)  Q(x)]


Translation
Translation

  • x (Tet(x)  LeftOf(x, c))

  • x (Tet(x)  Large(x)  LeftOf(x, c))

  • x [Cube(x)  BackOf(x, c)]

  • x [(Small(x)  Cube(x))  BackOf(x, c)]

Some Tet is to the left of c.

Some large Tet is to the left of c.

Every cube is in back of c.

Every small cube is in back of c.


Translation1
Translation

  • all x (Student(x)  Smart(x)).

    “Every student is smart.’’

    “Pick anything at all. Either it’s not a student or it’s smart (or both!)”

    “Pick anything at all. It cannot be a student who is not smart.”

    “Pick anything at all. If it’s a student, it’s smart.”


What s wrong with this translation
What’s wrong with this translation?

  • “Every student is smart”

  • Bad translation:

    all x (Student(x) ^ Smart(x))

  • Good translation:

    all x (Student(x)  Smart(x))


What s wrong with this translation1
What’s wrong with this translation?

  • “Some student is smart”

  • Bad translation:

    exists x (student(x)  smart(x))

  • Good translation:

    exists x (student(x) ^ smart(x))


Translation2
Translation

  • x and 

  • x and 


Quantifiers and functions
Quantifiers and Functions

  • Everyone is taller than Max’s father.

  • Someone’s father is taller than Max.

  • e is the leftmost object in the row of something.

x (Person(x) ^ ~(x = father(max)))  Taller(x, father(max))

x (Person(x) ^ Taller(father(x), Max))

x (lm(x) = e)


Quantifiers can make things interesting which are valid

  • exist x (Student(x))

  • exist x (Smart(x))

  • exist x (Student(x) ^ Smart(x))

Quantifiers can make things interesting…Which are valid?

Yup!

  • all x (Student(x)  Smart(x))

  • all x (Student(x))

  • all x (Smart(x))

  • exist x (Student(x)  Smart(x))

  • exist x (Student(x))

  • exist x (Smart(x))

Nope!

Yup!

Nope!


Quantifiers and tautology
Quantifiers and Tautology

  • When is a sentence involving quantifiers a tautology?Example: x Cube(x)  x Cube(x)

    Example: x Small(x)  x Small(x)

No!

Yes!


Tautologies and quantifiers
Tautologies and Quantifiers

  • One way to arrive at tautologies is to substitute complex sentences into known tautologies

  • P v ~P is a tautology. Thus, so is:

  • (all x (Doctor(x)  Rich(x))) v

    ~(all x (Doctor(x)  Rich(x)))


Truth functional form algorithm
Truth-Functional Form Algorithm

  • Start at the beginning of sentence S and proceed to the right. If you encounter a quantifier, underline thequantifier and the stuff in its scope.If you encounter anatomic sentence simply underline it. When you come to the end of an underline assign a letter (A, B, C, …). If anunderlined sentence is identical to a previous one (character for character), use the sameletter.If the sentence formed from the letters is a tautology, then the original is too.Note: Small(a) is not the same as Small(b). Similarly, Small(x) is not the same as Small(y).


When is a sentence a tautology
When is a sentence a tautology?

  • A quantified sentence S is a tautology if and only if its truth-functional form is a tautology.

  • Example:

    (exist y (P(y) v R(y))  all x (P(x) ^ Q(x))) 

    (~all x (P(x) ^ Q(x))  ~exist y (P(y) v R(y)))

TFF: (A  B)  (~B  ~A)

Tautology? Yes


Another example

A

B

Another Example

  • x Cube(x)  x Cube(x)

Since A  B is not a tautology, then neither is the sentence above.


Another example1

A

A

Another Example

  • x Cube(x)  [x Cube(x)]

Since A A is a tautology, then so is the sentence above.


Another example2

A

B

A

C

Another Example

  • (Tet(d)  x Small(x))  (Tet(d)  y Small(y))

(A  B)  (A  C)


Tautological valid
Tautological Valid?

  • Is the following argument valid or invalid?

x Cube(x)x Small(x)

x (Cube(x) Small(x))

ABC

Not tautologically valid!!!In fact, it is not logically valid.


A  BAB

Tautological Valid?

  • Is the following argument valid or invalid?

x Cube(x) x Small(x)x Cube(x)

x Small(x)

Is tautologically valid!!!


Note

  • An argument that is not tautologically valid may still be logically valid. In this case, we cannot recognize it is valid by checking all the rows of the truth table.


A BC

Tautological Valid?

  • Is the following argument valid or invalid?

x [Cube(x)  Small(x)]x Cube(x)

x Small(x)

Is not tautologically valid.It is logically valid!


ad