Truth, deduction, computation; lecture 2

20
Truth, Deduction, Computation Lecture 2 First Order Languages Vlad Patryshev SCU 2013

description

Lecture 2 of my logic course at Santa Clara University

Transcript of Truth, deduction, computation; lecture 2

Page 1: Truth, deduction, computation;   lecture 2

Truth, Deduction, ComputationLecture 2First Order Languages

Vlad PatryshevSCU2013

Page 2: Truth, deduction, computation;   lecture 2

In chapter 1 of LPL book...

● the world consists of existing objects○ some of them have names○ some of them have more than one name

● objects can participate in n-ary relationships○ relationships have names and arity○ equality relationship

● functions ○ given an object, provide another object

Page 3: Truth, deduction, computation;   lecture 2

Objects

Intuitively, they are something we know exists

Examples:● Max, Claire, Scruffy, 1, 2, Saturday

Examples of non-objects:● Pegasus, Zeus, Santa Claus :(

Page 4: Truth, deduction, computation;   lecture 2

Names

Symbols that refer to objects

<name> ::= <number>|<id>

<number> ::= <digit>|<number><digit>

<letterOrDigit> ::= <letter>|<digit>

<id> ::= <letter>|<id><letterOrDigit>

<letters> ::= <letter>|<letters><letter>

E.g. max, claire, scruffy, 42, line1

Page 5: Truth, deduction, computation;   lecture 2

Predicate

Informally, describes a feature of an object.

English: Max likes ClaireFOL: Likes(max, claire)

Page 6: Truth, deduction, computation;   lecture 2

Examples (used throughout the book)Tet(a) a is a tetrahedron

Cube(a) a is a cube

Small(a) a is small

Medium(a) a is medium size

Large(a) a is large

Larger(a,b) a is larger than b

Smaller(a,b) a is smaller than b

SameSize(a,b) a is the same size as b

SameShape(a,b) a is the same shape as b

LeftOf(a,b) a is to the left of b

FrontOf(a,b) I is in front of b

Between(a, b, c) a, b, c are in the same line and a is between b and c

Page 7: Truth, deduction, computation;   lecture 2

Atomic Sentences

<atomic> ::= <predicateName>(<arguments>)

<predicateName> ::= <Capital>

<predicateName> ::= <Capital><letters>

<arguments> ::= <name>|<names>,<name>

They take a value which can be either TRUE or FALSE.

Page 8: Truth, deduction, computation;   lecture 2

Equality Predicate

Equals(a,b)

aka*

a = b (infix form)

aka ≡ Also Known As

Page 9: Truth, deduction, computation;   lecture 2

Function Symbols

<functionTerm> ::= <id>(<arguments>)

<arguments> ::= <term>|<arguments>,<term>

<term> ::= <name>|<functionTerm>

Examples● mother(father(father(max)))● son(father(I))● brother(I)

Page 10: Truth, deduction, computation;   lecture 2

Combining All These

Now redefine atomic formula:<atomic> ::= <predicate>(<arguments>)

Examples:● Taller(father(claire), father(max))● john=father(max)● Taller(clair, mother(mother(claire)))● mother(melanie)=mother(claire)

Page 11: Truth, deduction, computation;   lecture 2

Alternative to Function

Can do without:father(a) → FatherOf(b, a)

In general:f(x1,x2,...,xn) → Is_f(y,x1,x2,...,xn)

Page 12: Truth, deduction, computation;   lecture 2

Applications. Relational DB

--CREATE TABLE users…--CREATE TABLE NSA…

CREATE TABLE NSA_is_watching (

user_id character varying(30) NOT NULL,

bigbrother_id character varying(30) NOT NULL,

last_checked timestamp

CONSTRAINT bigbrother_id_fkey FOREIGN KEY (bigbrother_id)

REFERENCES NSA (id),

CONSTRAINT user_id_fkey FOREIGN KEY (user_id)

REFERENCES users (id)

)

Page 13: Truth, deduction, computation;   lecture 2

Applications. Relational DB

insert into NSA_is_watching values

(‘John Doe’, ‘Agent Smith’, now()),

(‘Jane Dough’, ‘Agent Smith’, now()),

(‘Joe the Plumber’, ‘Agent Smith’, now())

Page 14: Truth, deduction, computation;   lecture 2

Numbers as First Order Language

1. 0, 1 are terms (names, actually)2. a, b terms => a + b is a term (aka +(a,b))3. a, b terms => a * b is a term(aka *(a,b))4. a, b terms => a < b is a formula (aka <(a,b))

Question:Can there be infinitely many terms referring to number 1?

Page 15: Truth, deduction, computation;   lecture 2

Geometry as a First Order Language

1. numbers, points, lines, circles, angles2. line(p1, p2)3. circle(p, r)4. LiesOn(p, l)5. LiesOn(p, c)6. Between(p1, p2, p3)7. Parallel(l1, l2)

Page 16: Truth, deduction, computation;   lecture 2

Geometry as a First Order Language

Sample formulas:● Parallel(line(p1, p2), line(p3, p4))● LiesOn(p1, circle(p2, r))

Page 17: Truth, deduction, computation;   lecture 2

Sets as First Order Language

1. sets; elements (may not be sets)2. a ∈ b, where a is an element, b must be a

set3. a = b4. {a

1,...a

n} is a set, where a

1...a

n are

elements5. s

1 ∩ s

2 is a set, where s

1 and s

2 are sets

6. s1 ∪ s

2 is a set, where s

1 and s

2 are sets

Page 18: Truth, deduction, computation;   lecture 2

Sets as First Order Language

Sample formulas● 5 ∈ {1,2,42}● 0 ∈ {0, {0, {0}} ∩ {1, {1}}}

Page 19: Truth, deduction, computation;   lecture 2

Oriented Graphs

1. nodes and edges2. Between(n1, n2, e)