270 likes | 438 Views
CSNB234 ARTIFICIAL INTELLIGENCE. Chapter 2 Logic. Instructor: Alicia Tang Y. C. LOGIC. A formalization of some aspect of language. a language formalization = syntax, semantic and deduction. A representation of knowledge. A structure at the symbol level. First Order Predicate Logic
E N D
CSNB234ARTIFICIAL INTELLIGENCE Chapter 2 Logic Instructor: Alicia Tang Y. C. COIT, UNITEN
LOGIC • A formalization of some aspect of language. • a language formalization = syntax, semantic and deduction. • A representation of knowledge. • A structure at the symbol level. • First Order Predicate Logic • language suitable for representing qualitative/symbolic information. COIT, UNITEN
TRADITIONAL LOGIC • Identity • A is A • Contradiction • A is not not-A • Excluded Middle • A is not both A and not-A • Each of the above is associated with a truth value, true or false. COIT, UNITEN
Four Statement Forms • All S is P • No S is P • Some S is P • Some S is not P • The Syllogism: • is a set of rules governing what conclusion can be reached from a set of statements written in the four-statement form COIT, UNITEN
Reasoning by Pattern All x are y . All y are z . Therefore,all x are z . All Accord are Hondas. All Hondas are Japanese. Therefore, all Accord are Japanese. All Wajas are Protons. All Protons are made in Malaysia. Therefore, all Wajas are made in Malaysia COIT, UNITEN
Unsound Patterns • All x are y . • Some y are z . • Therefore,some x are z . • Good: • All Hondas are Japanese cars. • Some Japanese cars are made in America. • Therefore,some Hondas are made in America. COIT, UNITEN
Cont.. • Not so good: • All Toyotas are cars. • Some cars are Ferrari. • Therefore,some Toyotas are Ferrari. --- but this is a wrong conclusion! COIT, UNITEN
The Syllogism (I) • The syllogism is a set of rules governing what conclusions can be reached from a set of statements written in the four statement forms. • For example, it indicates that given the following premises (i.e. statements that are assumed to be true): • All Malaysians are car-drivers (1) • All people in KL are Malaysians (2) COIT, UNITEN
The Syllogism (II) • Then the following conclusion is valid: • All people in KL are car drivers (3) • The process of reaching a conclusion from premises is termed as ‘inferencing’, i.e. making an inference or drawing a conclusion. COIT, UNITEN
Syllogism (III) • ALL or NO are known as universal quantifiers that refers to every element of the subject class. • “SOME” is known as an existential quantifier. COIT, UNITEN
Example of Fragments of Information(Symbolic description) • The red block is ON the green block. • The green block is somewhere ABOVE the blue block. • The green block is NOT on the blue block. • The yellow block is on the green OR the blue. • The blue block is on SOME other block. COIT, UNITEN
We will obtain these “Premises” • (from previous slide): • The red block is on the green block. • The green block is somewhere ABOVE the blue block. • The green block is NOT on the blue block. • The yellow block is on the green OR the blue. • The blue block is on SOME other block. COIT, UNITEN
Conclusions • The red block is on the green block. • The green block is on the yellow block. • The yellow block is on the blue block. • The blue block is on the black block. • Main conclusion • The black block is on the table. COIT, UNITEN
Rules of Inference • A rule of inferenceis a pattern of reasoning consisting of one set of sentence schemas, calledpremises, and a second set of sentence schemas, called conclusions. • P Q • P • ----------- • Q COIT, UNITEN
Rule Instances • An instanceof a rule of inference is a rule in which all meta variables have been consistently replaced by expressions in such a way that all premises and conclusions are syntactically legal sentences. COIT, UNITEN
Sound Rules of Inference • A rule of inference is sound if and only if the premises in any instance of the rule logically entail the conclusions. • Modus Ponens • P Q • P • -------- • Q • Modus Tollens • P Q • Q • -------- • P COIT, UNITEN
Sound Rules of Inference • Equivalence Elimination (EE) • P Q • P Q • -------- • Q P • Double Negation (DN) • P • ------- • P COIT, UNITEN
Proof • A proof of a conclusion from a set of premises is a sequence of sentences terminating in the conclusion in which each item is either: • 1. A premise • 2. An instance of an axiom schema • 3. The result of applying a rule of inference to earlier items in sequence. COIT, UNITEN
Example I • When it is raining, the ground is wet. When the ground is wet, it is slippery. It is raining. Prove that it is slippery. • 1. raining wet Premise • 2. wet slippery Premise • 3. raining Premise • 4. wet MP: 1,3 • 5. slippery MP: 2,4 The Question given AI reasoning COIT, UNITEN (Proven!)
Example II: Sample Proof • Whenever p is true, q is true. Whenever q is true, r is true. Prove that, whenever p is true, r is true. • 1. pq Premise • 2. q r Premise • 3. (q r) ( p(q r)) ..given • 4. p (q r) MP: 3,2 • 5. ( p (q r)) (( p q) (p r)) ..given • 6. ( p q) ( p r) MP: 5, 4 • 7. p r (proven) MP: 6,1 Refer next slide COIT, UNITEN
Implication Introduction: s => (t => s) • Implication Distribution: (r => (s => t)) => ((r => s) => (r => t)) Hint: look at the implicit “Patterns”, not “Symbols” COIT, UNITEN
Inference Rules (I) • Modus Ponendo Ponens • If P implies Q, and P is true, then Q is true. • Modus Tollendo Tollens • If P implies Q, and Q is false, then P is false. COIT, UNITEN
Inference Rules (II) • Modus Ponendo Tollens • If P and Q are not both true, and P is true, then Q is false. • Modus Tollendo Ponens • If either P or Q is true, and P is not true, then Q is true. COIT, UNITEN
Well-Formed Formula (wff) • A complex formula that includes logical connectives. The truth value of a wff is known as its semantics or meaning. • TAUTOLOGY • A ¬A is always true no matter what the truth value of A is. • CONTRADICTION • B ¬ B is false, no matter what the truth value of B. COIT, UNITEN
Theories and Axioms A set of well-formed formulas (wffs) constructed for any field of knowledge is said to be the theory of that field. While each individual wff is an axiom. COIT, UNITEN
Some other terms • Proposition • any statement that can be assigned a value of true or false. • Clausal form • using only connectives such as: and , orand not. • Horn clause • contains only one positive literal. • Literal • is an atomic formula or the negation of an atomic formula. COIT, UNITEN
Class Exercise #1 Head I win. Tails you lose. Suppose the coin comes up tails. Show that I win. (Use h = head, t = tail, m = I win, y = you win) Start with: h m (1) t ¬y (2) h ¬t (3) m ¬y (4) t (5) ¬y M.P: 2, 5 (6) m ¬y EE: 4 (7) ¬y m EE: 4 (8) m M.P: 8, 6 -- proven! COIT, UNITEN