First Order Logic
Philipp Koehn 10 March 2020
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
First Order Logic Philipp Koehn 10 March 2020 Philipp Koehn - - PowerPoint PPT Presentation
First Order Logic Philipp Koehn 10 March 2020 Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020 Wittgenstein: Tractatus Logico-Philosophicus 1 1. The world is everything that is the case. 2. What is the case (a fact) is
Philipp Koehn 10 March 2020
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
1
proposition is a truth-function of itself.)
is: [¯ p, ¯ ξ,N(¯ ξ)]. This is the general form of a proposition.
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
2
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
3
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
4
(unlike most data structures and databases)
meaning of B1,1 ∧ P1,2 is derived from meaning of B1,1 and of P1,2
(unlike natural language, where meaning depends on context)
(unlike natural language) E.g., cannot say “pits cause breezes in adjacent squares” except by writing one sentence for each square
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
5
games, wars, centuries ...
brother of, bigger than, inside, part of, has color, occurred after, owns, comes between, ...
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
6
Language Ontological Epistemological Commitment Commitment Propositional logic facts true/false/unknown First-order logic facts, objects, relations true/false/unknown Temporal logic facts, objects, relations, times true/false/unknown Probability theory facts degree of belief Fuzzy logic facts + degree of truth known interval value Higher-order logic: relations and functions operate not only on objects, but also on relations and functions
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
7
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
8
KingJohn, 2, UCB,...
Brother, >,...
Sqrt, LeftLegOf,...
x, y, a, b,...
∧ ∨ ¬ ⇒ ⇔
=
∀ ∃
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
9
= predicate(term1,...,termn)
= function(term1,...,termn)
Brother(KingJohn,RichardTheLionheart) > (Length(LeftLegOf(Richard)),Length(LeftLegOf(KingJohn)))
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
10
¬S, S1 ∧ S2, S1 ∨ S2, S1 ⇒ S2, S1 ⇔ S2
– Sibling(KingJohn,Richard) ⇒ Sibling(Richard,KingJohn) – >(1,2) ∨ ≤(1,2) – >(1,2) ∧ ¬>(1,2)
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
11
– constant symbols → objects – predicate symbols → relations – function symbols → functional relations
iff the objects referred to by term1,...,termn are in the relation referred to by predicate
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
12
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
13
– Richard → Richard the Lionheart – John → the evil King John
– Brother → the brotherhood relation
– Brother(Richard,John) true iff Richard the Lionheart and the evil King John are in the brotherhood relation in the model
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
14
For each k-ary predicate Pk in the vocabulary For each possible k-ary relation on n objects For each constant symbol C in the vocabulary For each choice of referent for C from n objects ...
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
15
∀x At(x,JHU) ⇒ Smart(x)
is true in a model m iff P is true with x being each possible object in the model
(At(KingJohn,JHU) ⇒ Smart(KingJohn)) ∧ (At(Richard,JHU) ⇒ Smart(Richard)) ∧ (At(Jane,JHU) ⇒ Smart(Jane)) ∧ ...
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
16
⇒ is the main connective with ∀
∀x At(x,JHU) ∧ Smart(x) means “Everyone is at JHU and everyone is smart”
∀x At(x,JHU) ⇒ Smart(x) means “For everyone, if she is at JHU, then she is smart”
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
17
∃x At(x,JHU) ∧ Smart(x)
is true in a model m iff P is true with x being some possible object in the model
(At(KingJohn,JHU) ∧ Smart(KingJohn)) ∨ (At(Richard,JHU) ∧ Smart(Richard)) ∨ (At(JHU,JHU) ∧ Smart(JHU)) ∨ ...
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
18
⇒ as the main connective with ∃: ∃x At(x,JHU) ⇒ Smart(x) is true if there is anyone who is not at JHU
∃x At(x,JHU) ∧ Smart(x) is true if there is someone who is at JHU and smart
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
19
“There is a person who loves everyone in the world”
“Everyone in the world is loved by at least one person”
¬∃x ¬Likes(x,IceCream)
¬∀x ¬Likes(x,Broccoli)
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
20
if and only if term1 and term2 refer to the same object
– 1 = 2 and ∀x ×(Sqrt(x),Sqrt(x)) = x are satisfiable – 2 = 2 is true (note: syntax does not imply anything about the semantics of 1, 2, Sqrt(x), etc.)
∀x,y Sibling(x,y) ⇔ [¬(x=y) ∧ ∃m,f ¬(m=f) ∧ Parent(m,x) ∧ Parent(f,x) ∧ Parent(m,y) ∧ Parent(f,y)]
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
21
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
22
∀x,y Brother(x,y) ⇒ Sibling(x,y)
∀x,y Sibling(x,y) ⇔ Sibling(y,x)
∀x,y Mother(x,y) ⇔ (Female(x) ∧ Parent(x,y))
∀x,y FirstCousin(x,y) ⇔ ∃p,ps Parent(p,x)∧Sibling(ps,p)∧Parent(ps,y)
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
23
∀p ∃t Fool(p,t) ∧ ∃p ∀t Fool(p,t) ∧ ¬ ∀p ∀t Fool(p,t)
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
24
– ∀f (Farmer(f) ⇒ ∃d (Donkey(d) ∧ Own(f,d))) – ∃d (Donkey(d) ∧ ∀f (Farmer(f) ∧ Own(f,d)))
– ∃p (Planet(p) ∧ ∀h (Human(h) ∧ LivesOn(h,p)))
– ∀f Farmer(f) ∧ ∃d (Donkey(d) ∧ Own(f,d) ⇒ Beats(f,d)) but what if a farmer has a donkey d1 and a pig d2 and he beats neither Donkey(d2) ∧ Own(f,d2) ⇒ Beats(f,d2) is true (false ∧ true ⇒ false) – ∀f ∀d (Farmer(f) ∧ Donkey(d) ∧ Own(f,d) ⇒ Beats(f,d)) but this means “Every farmer beats every donkey he owns.“
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
25
– “There is at least one thing John has in common with Peter.” Requires a quantifier over predicates. – “The cake is very good.” ∃c Cake(c) ∧ Good(c) but not V ery(c) Functions and relations cannot be qualified.
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
26
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
27
– b either Breeze or ¬Breeze – s either Smell or ¬Smell – g either Glitter or ¬Glitter
– ∀b,g,t Percept([Smell,b,g],t) ⇒ Smelt(t) – ∀s,b,t Percept([s,b,Glitter],t) ⇒ AtGold(t)
⇒ Action(Grab,t)
∀t AtGold(t) ∧ ¬Holding(Gold,t) ⇒ Action(Grab,t)
⇒ keeping track of change is essential
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
28
∀x,t At(Agent,x,t) ∧ Smelt(t) ⇒ Smelly(x) ∀x,t At(Agent,x,t) ∧ Breeze(t) ⇒ Breezy(x)
∀y Breezy(y) ⇒ ∃x Pit(x) ∧ Adjacent(x,y)
∀x,y Pit(x) ∧ Adjacent(x,y) ⇒ Breezy(y)
far away from pits can be breezy
∀y Breezy(y) ⇔ [∃x Pit(x) ∧ Adjacent(x,y)]
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
29
– current position – having an arrow – holding the gold
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
30
E.g., Holding(Gold,Now) rather than just Holding(Gold)
Adds a situation argument to each non-eternal predicate E.g., Now in Holding(Gold,Now) denotes a situation
s′ = Result(a,s) is the situation that results from doing a in s
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
31
∀s AtGold(s) ⇒ Holding(Gold,Result(Grab,s))
∀s HaveArrow(s) ⇒ HaveArrow(Result(Grab,s))
(a) representation: too many frame axioms (b) inference: too many repeated “copy-overs” to keep track of state
what if gold is slippery or nailed down or ...
about the dust on the gold, wear and tear on gloves, ...
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
32
P true afterwards ⇔ [an action made P true ∨ P true already and no action made P false]
∀a,s Holding(Gold,Result(a,s)) ⇔ [(a=Grab ∧ AtGold(s)) ∨ (Holding(Gold,s) ∧ a ≠ Release)]
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
33
At(Agent,[1,1],S0) At(Gold,[1,2],S0)
i.e., in what situation will I be holding the gold?
i.e., go forward and then grab the gold
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
34
has the solution {p/[Forward,Grab]}
∀s PlanResult([],s) = s ∀a,p,s PlanResult([a∣p],s) = PlanResult(p,Result(a,s))
inference more efficiently than a general-purpose reasoner
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020
35
– objects and relations are semantic primitives – syntax: constants, functions, predicates, equality, quantifiers
– conventions for describing actions and change in FOL – can formulate planning as inference on a situation calculus KB
Philipp Koehn Artificial Intelligence: First Order Logic 10 March 2020