# 1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.

## Presentation on theme: "1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In."— Presentation transcript:

1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In symbolic logic rules and procedures are used to draw conclusions using various logical techniques.

2 The general form of a logical process Logical Process (using logic to Reason) Premises Or Facts Inferences OR Conclusions Inference is a process that is used to derive new facts from the ones that are known.

3 Logic Propositional Logic A^B C First Order Logic (Predicate Logic or Predicate Calculus) A system of computing Not differential or integral calculus \/ x (ODD(x)→EVEN(add(x,1))) Higher order Logics \/ P (P(x)) \/ f (P(f(x)))

4 Propositional Logic and Automated Reasoning A: Today is Monday. B: It is raining now. Not A: Today is not Monday. Not B: It is not raining now. A proposition is a declaration: New Zealand is beautiful. The sun is made of chocolate. Symbols like A,B,C,… are used to denote propositions. These are called atoms. A proposition can either be true or false but not both. This is called its truth value and it is assigned not inherent to the proposition.

5 A Formula A formula is built with atoms, parantheses and the following five logical operators: Negation ~not Conjunction /\and Disjunction \/or Implication -> if…then Double implication if and only if Example formulae A (~A) (( B \/ C) /\ ~D ) ((( A -> B) /\ C) /\ D) Order of precedence ~ /\ \/ -> (((~A)/\B) -> (C\/D)) ≡ ~A /\ B -> C \/ D

6 A Recursive Definition of Formulae in Propositional Logic An atom is a formula. If F is a formula then ~F is a formula. If F and G are formlae then F /\ G F \/ G F -> G F G Are formulae. There are no formulae other than these just defined

7 Formulae have truth values. Truth value of a formula can be obtained from its atoms and logical operators. B C D (B\/C) (~C) ((B\/C)/\~C) (((B\/C)/\~C)\/D) true true true true false false true true true false true false false false true false true true true true true true false false true true true true false true true true false false true false true false true false false false false false true false true false true false false false false true false false Interpretation of Formulae An interpretation of a formula F is an assignment of truth values to every atom. A formula having n atoms has 2^n interpretations (a table with 2^n rows).

8 A formula is a tautology (or a valid formula) if and only if it is true under all interpretations. B \/ ~B A formula is an inconsistency if and only if it is false under all interpretations. A formula is a tautology if and only if its negation is an inconsistency (or unsatisfiable formula). (~B /\ B) A formula is consistent (or satisfiable) if it is not inconsistent. In other words, a formula is consistent if it is true under at least one interpretation. If a formula is a tautology it is consistent but the converse may not hold. A formula F is equivalent to formula G if and only if the truth value of F is equivalent to the truth value of G under all interpretations.

9 A Proof Formula G is said to be the logical consequence of formulae F1, F2,…, Fn if and only if every interpretation that satisfies (F1/\F2/\…/\Fn) also satisfies G. We may also say, F1, F2,…,Fn imply G. G is called the Goal and the Fi are called the premisses. To demonstrate that G is a logical consequence of the Fs is to prove that ((F1/\F2/\…/\Fn) -> G) is a theorem. The demonstartion is the proof. The formulae we will work on will be the ones that are consistent.

10 A proof may be a direct proof a refutation proof Direct method: ((F1/\F2/\…/\Fn) -> G) is a tautology. Refutation method: ~((F1/\F2/\…/\Fn) -> G) is an inconsistency. Since the negation of a tautology is an inconsistency these are equivalent. ~((F1/\F2/\…/\Fn) -> G) ≡ ~(~(F1/\F2/\…/\Fn) \/ G ) ≡ ((F1/\F2/\…/\Fn) /\ ~G)

11 F G ~G F->G F/\(F -> G) (F/\(F -> G)) -> G (F/\(F -> G)) /\ ~ G true true false true true true false true false true false false true false false true false true false true false false false true true false true false Example Prove by both methods that G is a logical consequence of F and F-> G We need 4 rows because we have 2 atoms. This shows that there exists a finite procedure in propositional logic to decide whether a given goal is a theorem or not. Propositional logic is thus decidable. This is known as modus ponens.

12 As the number of atoms (n) increases the number of rows in the table increases exponentially which makes the use of truth table for proving theorems impractical. There are other methods that may be used. Rules of inference What we proved using the table (modus ponens) is called a rule of inference and is written as, if F and (F-> G) then G A rule of inference applied to a set of premises produces a formula. In the case of modus ponens above we can say that G is deduced from F and F-> G by modus ponens. There are other rules of inference and these rules are used in a theorem proving method called the natural deduction.

13 Natural Deduction A rule of inference is applied to a set of given premises to deduce the Logical consequence formula which is added to the set of premises. New formulae is deduced and added to a set by applying various rules of inference until we deduce a formula that is identical to the goal or we can no longer deduce new formulae. One of these cases occurs in finite time. Natural deduction is a direct method. Using this method of Proof we may produce formulae that are not useful in reaching the goal. This is not a computationally desirable method There is a refutation proof method called the resolution principle which Uses one rule of inference called the resolution which is effective enough to make other rules secondary. We will look at this rule and its theorem proving procedure.

14 1)A 2)B 3)A/\C -> D 4)B->C 5)Cmodus ponens on 2 and 4 6)A/\Cintroducing conjunction on 1 and 5 7)Dmodus ponens on 3 and 6 The goal has been deduce as a logical consequence of the premises. The goal has been proved to be a theorem. Example Proving D Given

Similar presentations