Title: Formal Methods in Computer Science CS1502 Atomic Sentences
1Formal Methods in Computer ScienceCS1502Atomic
Sentences
- Patchrawat Uthaisombut
- University of Pittsburgh
2Goals
- What logic is about.
- To learn about basic notions in logic
- Models, worlds, FOL, atomic sentences,
predicates, names - To gain skills in creating logic models.
3What logic is about
- Logic is the study of claims and reasoning about
claims. - Logic is the study of systematic and strategic
reasoning to determine if a claim is true or
false, given certain assumptions.
4Example
- Suppose the following.
- Socrates is a man.
- All men are mortal.
- No mortal lives forever.
- Everyone who will eventually die sometimes
worries about it. - Can we conclude this?
- Socrates sometimes worries about dying.
5Too easy / Too hard
Hard to comprehend
Our ability with the help of formal logic
Our everyday ability to reason about the world
Easy to comprehend
6What are the basic pieces we need?
- A way to represent English sentences
- Create a mathematical model that can be used to
represent English sentences - Logic sentence, Predicates, Names, Terms
- Functions, boolean connectives, quantifiers, etc
- Formalize a procedure for reasoning
- Truth tables
- Inference rules
- Proofs, etc.
7Sentences
- What kind of sentences are we interested in in
logic? - Paris is the capital of France
- 22 4
- Toronto is in Asia
- Is Philosophy 101 harder than Gen Chem 101?
- Add sugar, then add salt.
- Declarative Sentences
8Sentences
- Break each sentence into two parts
- Objects that the sentence refer to.
- Names
- Properties/relationships that the sentence refer
to. - Predicates
- Form a sentence by combining names and a
predicate. - AtSchool(abby)
- AtLibrary(john)
9Worlds and models
- Do our predicate and names apply only to the real
world? - AtSchool(abby)
- AtLibrary(john)
- Taller(john,jack)
- It also works on a similar hypothetical world.
- A set of similar worlds is called a model.
10World and Model
- A model describes what worlds are possible within
the model. - Thus, a model is a set of worlds.
- A world consists of a number of objects with
various properties and relationships among them. - FOL is a family of languages having a similar
grammar and sharing similar components. - Such a language used to describe, and make claims
about worlds in a model. - Different models have different languages.
- We use Taskis worlds model to study logic.
11A Taskis World
12Example Taskis Worlds Model
- A world in the Taskis worlds model is an
arrangement of objects in a 8x8 chess board. - 3 kinds of Objects Cube, Tetrahedron,
Dodecahedron - 3 sizes
- Etc.
- Other restrictions
- An object must locate in a square of the board
- No 2 objects can be in the same position.
- An object can have only 1 shape.
- An object can have only 1 size.
- Etc.
13Taskis Model
- We are not interested in
- The precise position of the object.
- The color of the objects.
- (Cubes are always green, )
- The density of the objects.
14Example of Claims
- English
- Object b is a cube.
- Object a is small.
- Object c is to the left of object f.
- Object d and object e have the same shape.(false
claim)
- FOL
- Cube(b)
- Small(b)
- LeftOf(c,f)
- SameShape(d,e)(false claim)
15(No Transcript)
16Names
- Constants are used to name existing objects
- a, b, c, d, e, f
- max, claire, carl
- No constant can name more than one object
- An object can have more than one name or no name
at all
17(No Transcript)
18Predicates
- A property possessed by an object
- Shape (e.g., Tet, Cube)
- Size (e.g., Small, Large)
- A relationship among objects
- Shape relationship (e.g., SameShape)
- Size relationship (e.g., Smaller)
- Positional relationship (e.g., Between, LeftOf)
- Equality
19Predicates
- Each predicate has a fixed number of arguments or
arity. This is the number of constants the
predicate needs to form a sentence. - In English, OK, but not in logic
- Sam is taller than Jim
- Sam is taller than Jim and John
20Predicates
- Predicates must be determinate
- Suppose p is an n-ary predicate.
- For every n-tuple lto1,o2,,oNgt of objects,
p(o1,o2,,oN) is true or false (not kind of
true). - Whats an n-tuple?
- An n-tuple is a collection of n objects where
order matters. Duplicates are allowed. In
contrast, sets may not have duplicates, and the
members of sets are not ordered.
21Atomic Sentences (so far)
- A sentence formed by a single predicate followed
by one or more names - Max is tall Tall(max)
- e is larger than b Larger(e,b)
- e is identical to a e a
- A sentence expresses a claim that is either true
or false
22Atomic Sentences (so far)
- Predicate(arg1, arg2,, argn)
- Predicates have names beginning with an uppercase
letter or are represented by an operator symbol - The number of arguments is called the predicates
arity - The order of the arguments is importantLarger(e,c
) e is larger than cLarger(c,e) c is larger
than eBetween(a,b,e) a is between b and
eBetween(b,a,e) b is between a and e - (a,b)
- a and b are identical
- Usually, written in infix form a b
23Exercise Creating Models
- Divide into small groups
- Create your own model
- Give a description of your model.
- Create your own language
- Predicates
- Names
- Give an example world of your model
- Give a few sentences.
- Indicate if the sentences are true in your world.
- Words home, friend, program, fast, before,
stone, letters, students, snow, basketball, team,
logistic, heavy, book.
24Function Symbols
- A function is used to express complex names (a
reference to an individual without using a name) - father(b) bs father
- Used in a sentence Tall(father(b))
- password(c) cs password
- Used in a sentence Long(password(c))
- A function may be nested
- father(father(max))
- Used in a sentence Short(father(father(max)))
- Cant nest predicates
- Tall(Tall(max)) not a legal sentence
25Functional Expressions
- Function(arg1, arg2,, argn)
- Function names begin with a lowercase letter or
are expressed with a symbol - father(max) Maxs father
- father(mother(max)) Maxs mothers father
- youngestChild(max,ann) Max and Anns youngest
child - (5,(2,4)) 30
- starship(son(dr_crusher)) Dr_Crushers sons
starship
26Atomic Sentences (so far)
- A sentence formed by a single predicate followed
by one or more terms - A term is either a constant or a functional
expression
27Predicates vs Functions
- Syntax is similar
- Predicate(arg1, arg2,, argn)
- Function(arg1, arg2,, argn)
- Difference
- After applying a predicate to terms, we get a
sentence - Cannot be nested
- After applying a function to terms, we get
another term. - Can be nested
28Example Atomic Sentences (which are functions
and which are predicates?)
- Predicate(term1,term2,,term_n)
- Happy(bossof(sally))
- Father(bill)
- Tall(fatherOf(motherOf(sally)))
- Happier(motherOf(bill),bossof(fatherOf(max)))
- Fake(santa(rossParkMall)))
- Real(santa(robinsonTownCenter)))
29Functions in Taskis model
- lm(x) Leftmost
- Refer to the leftmost object in the same row as x
- It could be x itself
- rm(x) Rightmost
- fm(x) Frontmost
- bm(x) Backmost
30Exercise Creating Models with Functions
- Divide into small groups
- Add some functions to your model created earlier.
- Give an example world of your model
- Give a few sentences with functions.
- Indicate if the sentences are true in your world.
- Words home, friend, program, fast, before,
stone, letters, students, snow, basketball, team,
logistic, heavy, book.
31First Order Logic
- Names
- Predicates
- Functions
- Connectives
Are there more?
32Example FOL
33Translation
- Brando is Nancys favorite actor.
- brando favoriteActor(nancy)
- BetterActor(favoriteActor(nancy),
favoriteActor(max))
- Nancys favorite actor is better than Maxs
favorite actor.
- Sean is his own favorite actor.
- Brando is someones favorite actor.
- ?x(brando favoriteActor(x))
34ConnectivesApply to sentences tocreate more
complex sentences.
- Not ?
- And, Or ?, ?
- Material Conditional ?
- Biconditional ?
35Examples
- ?Larger(e,c)
- Cube(b) ? Large(b)
- SameRow(e,c) ? BackOf(e,b)
e is not larger than c
b is a cube or b is large
e and c are in the same row and e is in back of b
36Quantifiers and Variables
- For every x ?x
- ?x (man(x) ? mortal(x))
- There exists y ?y
- ?x(brando favoriteActor(x))
37First Order Logic
- Names
- Predicates
- Functions
- Connectives
- Quantifiers and variables
Revised List
38Goals Have you archived the followings?
- What logic is about.
- To learn about basic notions in logic
- Models, worlds, FOL, atomic sentences,
predicates, names - To gain skills in creating logic models.