Title: CIS341 Artificial Intelligence
1CIS341 Artificial Intelligence
- Weeks 8 11
- Predicate calculus and tableau proofs
- Natural language syntax and parsing
- Search and problem solving
- Parsing as proof, proof as a search problem
- Coursework 2 proposed dates
- Given out Friday March 13, due in Friday April
3rd
2Week 8 logic and inference revisited
- Revision of propositional logic
- Brief overview of proof techniques
- Introduction to predicate calculus
- Demonstration of tableau proofs on whiteboard
3Automated reasoning and formal logic
- Logic is concerned with validity of inference
- A central concern of 20th-century mathematical
logic was to develop systematic, mechanical
techniques for proving logical consequence - The AI subfields of logic programming and
automated reasoning have built on these efforts
to develop systems to perform logical inferences. - Considerations of speed and efficiency put
limitations on the kinds of inference that can be
implemented.
4Overview of classical logic
- Just as many people understand the word music to
refer to European classical music composed
between the 17th and 20th centuries, so the word
logic is often shorthand for a variant called
classical logic. - The remainder of these slides provide an overview
of classical logic, comprising - Boolean or propositional logic
- First-order predicate calculus (the words
first-order are often omitted) - There are many non-classical logics but they do
not come into this course.
5Some important terminology
- A proposition is something that can be true or
false - A proposition is consistent if it is possible for
it to be true - A proposition is inconsistent or contradictory if
it is not possible for it to be true - A proposition is a necessary truth or a tautology
if it is not possible for it to be false. - Class exercise 1 think up examples in each of
these categories.
6Boolean or propositional logic
- Boolean logic is so-called because logical
formulas are interpreted in terms of Boolean
truth values - True or False
- T or F
- 1 or 0
- The semantics of Boolean logic tells us how to
calculate the truth values of complex formulas as
a function of the truth values of their
constituent literals using truth tables - Simple propositions generally written P, Q etc.
7Syntax of propositional logic
- Formulas of Boolean logic are made up of
propositional letters P, Q, R etc and the symbols - or ? conjunction, read as and
- ? inclusive disjunction, read as or
- ? or negation, read as not
- ? or ? implication, read as implies or if
then - ? or ? biconditional, read as if and only if
or iff
8Truth tables
9Truth table for
10Truth table for implication
11Inference involving implication
- If the solution is acid, the paper will turn
red. - True ? True the solution is acid, the paper
turns red. The implication is verified. - True ? False the solution is acid, the paper
does not turn red. The implication is falsified. - False ? True the solution is not acid, the paper
still turns red. - False ? False the solution is not acid, the
paper does not turn red. - Is the implication verified or falsified in cases
3 and 4?
12Class/self-study exercise 2
- Construct truth tables for
- ?P ? Q
- ?(P Q)
- ?(P ? Q)
- ?(P ? Q)
13Validity of inference
- An inference is valid if it is not possible for
the premises to be true and the conclusion false. - Valid
- P, P ?Q / Q
- ?(P ? Q) / ?P
- Invalid
- ?(P Q) / ?P
- Q, P ?Q / P
- Validity in propositional logic can be checked
using truth tables.
14Some proof techniques
- Modus ponens
- P ? Q P / Q
- Modus tollens
- P ? Q ?Q / ?P
- Provide a short cut for calculating inferences
without constructing truth tables. - A proof theory consists of a set of such rules
- There are proof theories for propositional logic
which allow all valid inferences to be proved.
15Resolution rule
- Equivalent of modus ponens
- ?P ? Q P / Q
- Basis of logic programming
- Requires disjunctions with at most one positive
literal, for example - (P Q) ? R
- ? (P Q) ? R
- ?P ? ? Q ? R
16Tableau proof
- A graphic proof technique based on tree
diagrams called semantic tableaux - Will be covered in later slides
- Good tutorial in Wilfred Hodges, Logic
- Useful online tutorial at http//logic.philosophy.
ox.ac.uk/main.htm designed for Oxford philosophy
students - Key point there are many proof techniques which
are all equally sound and complete, i.e. they
will prove all and only valid arguments.
17Shortcomings of propositional logic
- A simple proof
- Fred is ill.
- If Fred is ill, he should not drive.
- So, Fred should not drive.
- In symbolic form
- P Fred is ill''
- Q Fred should not drive
- Modus ponens
- P ? Q, P / Q
18Shortcomings of propositional logic (cont.)
- So far, so good. But what if Charlie is ill?
- Do we construct a separate rule for every
individual? - P2 Charlie is ill''
- Q2 Charlie should not drive
- P2 ? Q2
19From propositional logic to predicate calculus
- Solution is to decompose statements into
predicates and arguments - P(x) x is ill''
- Q(x) x should not drive
- P(x) ? Q(x)
- Proof will look more like this
- P(x) ? Q(x)
- P(fred)
- P(fred) ? Q(fred)
- ? Q(fred)
20From propositional logic to predicate calculus
(cont.)
- Boolean logic is the logic of propositions.
- Predicate calculus introduces predicates and
arguments. - Arguments can be constant terms or variables.
- Predicates have to be constant terms in the
first-order predicate calculus. - There are higher-order logics with predicate
variables but we will not be concerned with them.
21Quantifiers in predicate calculus I
- Implicational rules are generally written like
this - ?x(P(x) ? Q(x))
- The upsidedown A is called the universal
quantifier this means that the implication is
true for all values of x (i.e. for any
individual). - Read as for all x, P(x) implies Q(x)
- Can also be read as all Ps are Q or all Ps Q
- ?x(fish(x) ? swim(x))
- ?x(cow(x) ? mammal(x))
22Quantifiers in predicate calculus II
- The existential quantifier ? means that statement
that follows it is true of some individual,
though we may not know which. - ?x(Px Qx)
- Read as
- there exists an x such that P(x) and Q(x)
- some P is a Q
- some Ps Q
- ?x(mammal(x) lays-eggs(x))
23Quantifiers in predicate calculus III
- You may have noticed that ? generally goes with
the conjunction and ? goes with the
implication ? - This is very important. What would the following
mean? Are they true? - ?x(fish(x) ? sings(x))
- ?x(cow(x) mammal(x))
- This is probably what beginning logic students
most often get wrong.
24Quantifiers in predicate calculus IV
- Multiple quantifiers can be combined in the same
formula - ?x(student(x) ? ?y (tutor(y,x)))
- Every student has a tutor
- ?x(professor(x) ??y(course(y) teach(x,y)))
- There is a professor who does not teach any
courses
25Duality of first-order quantifiers
- The quantifiers ? and ? can be defined in terms
of each other, using Boolean equivalences - ?x(P(x) ? Q(x))
- ??x?(P(x) ? Q(x))
- ??x(P(x) ?Q(x))
- ?x(P(x) Q(x))
- ??x?(P(x) Q(x))
- ??x(P(x) ? ?Q(x))
- Class/self-study exercise 3
- Convince yourself that the above equivalences are
correct.
26Class/self-study exercise 3
- Convert the following to predicate calculus
- All mammals are vertebrates.
- Not all vertebrates are mammals.
- Only fish swim.
- Some primates have tails.
- No primates have feathers.
- Rhinos eat either leaves or grass.
27Inference in predicate calculus
- Techniques such as modus ponens and tableau proof
are applicable to predicate calculus, with extra
complications caused by the use of variables. - Example given the premises
- ?x(P(x) ? Q(x))
- ?y(Q(y) ? R(y))
- P(fred)
- we can infer via modus ponens or using tableaux
(several steps omitted) - Q(fred) R(fred)
28Beginning tableau proofs
- The Tableau method uses a standard technique of
proof by contradiction - To show whether an argument is valid, attempt to
show that the premises are inconsistent with the
negation of the conclusion - To show whether a complex proposition is a
tautology, attempt to show that its negation is
inconsistent - (see whiteboard and handouts)
29Useful further reading
- Books
- A very short introduction to logic, Graham
Priest, OUP. A clear and stimulating guide to
basic concepts of logic. - Logic, Wilfred Hodges, Penguin. Goes into a lot
more detail than Priest, useful for
reference/revision. - Website
- Introduction to logic, http//logic.philosophy.ox.
ac.uk/main.htm - Tutorial on propositional and predicate logic
aimed at Oxford philosophy students. May not
display correctly in all browsers. Seems to work
best in Internet Explorer.