Truth, deduction, computation; lecture 2
-
Upload
vlad-patryshev -
Category
Education
-
view
539 -
download
0
description
Transcript of Truth, deduction, computation; lecture 2
Truth, Deduction, ComputationLecture 2First Order Languages
Vlad PatryshevSCU2013
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
Objects
Intuitively, they are something we know exists
Examples:● Max, Claire, Scruffy, 1, 2, Saturday
Examples of non-objects:● Pegasus, Zeus, Santa Claus :(
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
Predicate
Informally, describes a feature of an object.
English: Max likes ClaireFOL: Likes(max, claire)
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
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.
Equality Predicate
Equals(a,b)
aka*
a = b (infix form)
aka ≡ Also Known As
Function Symbols
<functionTerm> ::= <id>(<arguments>)
<arguments> ::= <term>|<arguments>,<term>
<term> ::= <name>|<functionTerm>
Examples● mother(father(father(max)))● son(father(I))● brother(I)
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)
Alternative to Function
Can do without:father(a) → FatherOf(b, a)
In general:f(x1,x2,...,xn) → Is_f(y,x1,x2,...,xn)
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)
)
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())
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?
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)
Geometry as a First Order Language
Sample formulas:● Parallel(line(p1, p2), line(p3, p4))● LiesOn(p1, circle(p2, r))
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
Sets as First Order Language
Sample formulas● 5 ∈ {1,2,42}● 0 ∈ {0, {0, {0}} ∩ {1, {1}}}
Oriented Graphs
1. nodes and edges2. Between(n1, n2, e)
Reference(s)
List of first-order-theories (wikipedia)