Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Structure (mathematical logic) wikipedia , lookup
Abductive reasoning wikipedia , lookup
Truth-bearer wikipedia , lookup
Hyperreal number wikipedia , lookup
Quasi-set theory wikipedia , lookup
Boolean satisfiability problem wikipedia , lookup
Natural deduction wikipedia , lookup
Interpretation (logic) wikipedia , lookup
Laws of Form wikipedia , lookup
Canonical normal form wikipedia , lookup
Propositional calculus wikipedia , lookup
MODULE I MATHEMATICAL LOGIC Statements or Propositions A statement or proposition is defined to be a declarative sentence to which it is possible to assign a true value true or false but not both simultaneously. The statement or proposition that cannot be broken into simpler statements are called primary or primitive statements. They are usually denoted by the alphabets A,B,C,... or by suffix capital letters P1,P2,... Compound propositions Statements or propositions which can further be simplified into atomic statements or propositions are called compound propositions. Eg. Ram and Rahim went up the hill. Two valued logic Since propositions have two values true or false the logic is called two- valued logic. They may also be denoted by the symbols 1 or 0. Connectives The connecting words between two atomic statements is called connectives. The connectives generally used in English are 'and' and 'or'. Eg.1.Ram and Rahim went up the hill. 2.Today is a holiday or tomorrow is a holiday. Negation If 'P' denote a statement then the negation of 'P' is written as 'ךP' and is read as 'not P'. Eg.1.Ram is an intelligent boy.(P) 2.Ram is not an intelligent boy.(ךP) Negation does not connect two statements but it modifies one statement and it is also taken as a connective. Truth Table of ךP P ךP T F F T Conjunction If P and Q are two statements, their conjunction is a statement denoted by PΛQ which is read as P and Q. The statement PΛQ has true value T only when both P and Q have trhth value T.In all other cases it has truth value F. Truth Table of PΛQ P Q PΛQ T T T T F F F T F F F F Eg. P: Jack went up the hill. Q: Jill went up the hill. PΛQ: Jack and Jill went up the hill. Disjunction Let P and Q be two given statements.Then the disjunction of the statements is denoted by PVQ and is read as P or Q. The new statement has truth value F only if both P and Q have truth value F. In all other cases it is T. In other words the statement PVQ is true if at least one of the statement P or Q is true. Truth Table of PVQ P Q PVQ T T T T F T F T T F F F Statement formula The statement which contain one or more atomic statements and connective are called statement formula. Eg. ךP, PVQ , PΛQ , ( ךPVQ), (ךPΛQ) etc. Problems 1.Construct the truth table for PΛךQ P Q ךQ PΛךQ T T F F T F T T F F T F F T F F Construct the truth table of the following statements. 1) PvךQ 2) ┐ ( ךPΛךQ) 3) ┐ ( ךPvךQ) Conditional If P and Q are any two statements then the statement P→Q which is read as if P then Q is called a conditional statement. Eg. There is a flood : P Crop will be destroyed : Q Truth Table of p→Q P Q P→Q T T T T F F F T T F F T The statement P→Q has the truth value F when P has truth value T and Q has truth value F. Otherwise the result is true. Problems Write in symbolic form. If either Ram takes maths or Raj takes physics then Rahim will take english. Ram takes maths. : P Raj takes physics. : Q Rahim takes english. : R Symbolic form : (PVQ→R) Write the truth table for the following. 1.(P→Q) Λ (Q→P) P Q P→Q Q→P (P→Q) Λ (Q→P) T T T T T T F F T F F T T F F F F T T T 2.QΛ(P→Q)→P 3.(P→Q) → (Q→R) Biconditional Statements. If P and Q are any two statements then the statement P↔Q is called a biconditional statement. It is read as P if and only if Q. ( P iff Q) The statement has the truthvalue T if either, P and Q has truthvalue T , or both have truthvalue F. It is defined by the following truth table. P T T F F Q T F T F PQ T F F T Actually this statement P↔Q is equivalent to the conjunction of two implications P→Q and Q→P. eg. P- Two lines are parallel. Q- Two lines have same slope. PQ – Two lines are parallel if they have same slope. Write the truth table for the formulas 1)┐(PQ) ┐P┐Q 2)┐(P(QR)) PQ )PR) [H.W] Ans.(1) P Q PQ ┐(PQ) ┐P ┐Q ┐P┐Q T T F F T F T F T F F F F T T T F F T T F T F T F T T T ┐(PQ) ┐P┐Q T T T T Well formed formula A statement formula is an expression which is a string consisting of statement variables, parenthesis and connecting symbols which produces a statement when the variables are replaced by symbols. But every string of these symbols is not a formula. Definition A well formed formula (wff) can be generated by the following rules. 1) A statement variable standing alone is a wff. 2) If A is a wff then ┐A is also a wff. 3) If A and B are wff, then AVB, AΛB, A→B and A↔B are wff. 4) A string of symbols containing statement variables, connectives and parenthesis is a wff iff it can be obtained by finitely many applications of rules 1, 2 and 3. eg. ┐PQ), ┐(PQ ), ( P→(PQ), ((P→Q) Λ (Q→R)↔(P→R)) The following are not wff. 1) (P→Q) →( Q) Since Q is not wff. 2) ( P→Q The wff is (P→Q). Tautology (Logical truth) A statement formula which is true regardless of the truthvalue of the statement which replace the variable in it, is called tautology. In other words if each entry in the final column of the truth table of a statement formula is true, then it is called a tautology. Similarly, a statement formula which is false regardless of the truthvalue of the statement which replace the variable in it, is called contradiction. In other words if each entry in the final column of the truth table of a statement formula is false, then it is called a contradiction. We can call tautology as identical true statement and contradiction as identical false statement. Notes: 1) The negation of a tautology is a contradiction and negation of a contradiction is a tautology. 2) The conjunction and disjunction of two tautologies is a tautology and the conjunction and disjunction of two contradictions is a contradiction. 3) The disjunction of a tautology and any other formula is a tautology. 4) The conjunction of a contradiction and any other formula is a contradiction. 5) Check whether the formula given is tautology or not. 1) (P┐P) ┐P (P┐P) ┐P P ┐P T F F T F T T T P┐P It is a tautology. 2) (P→Q) →P 3) (P→Q→R)) → ((P→Q)→(P→R)) 4)(┐P→Q)→(Q→P) [HW] Equivalence formula Two statements A and B are said to be equivalent to each other iff the formula AB is a tautology. We write AB and it is read as A is equivalent to B or A is implies and implied in B. Notes: It is a symmetric relation. It is transitive. Ie; if AB and BC then AC. Prove the following. 1) (PQ) P→Q)(Q→P) P→Q)(Q→P) P Q PQ P→Q Q→P T T T T T T T F F F T F F T F T F F F F T T T T Note If the truthvalue of A is equal to the truthvalue of B then A and B are said to be equivalent formulas. 2) ┐(P→Q) P┐Q) 3) (PQ) (P┐Q) P 4) ┐(PQ) ┐P┐Q 5) ┐┐PP 6) PQQP 7) P QQP 8) (P Q)R P (QR) 9) (PQ)R P(QR) 10) ┐(P Q)┐P┐Q 11) P PP 12) PPP Some important equivalent formulas 1) Idempotent laws P PP PPP 2) Associative laws (P Q)R P (QR) (PQ)R P(QR) 3) Commutative laws PQQP P QQP 4) Distributive laws P (QR) (P Q) ( PR) P (QR) (PQ) ( PR) 5) Absorption laws P(PQ) P P(P Q)P 6) Demorgan's laws ┐(P Q)┐P┐Q ┐(PQ) ┐P┐Q 7) Some more results P FP PTP P T PFF PQ P→Q)(Q→P) P→Q┐PQ Q→P┐QP ┐(P→Q) P┐Q) Replacement process Let A be the formula P→(Q→R). The formula Q→R is a part of the formula A. We can replace Q→R by ┐QR. Now A becomes P→ (┐QR). Let this formula be B. It can be easily verified that A and B are equivalent to each other. This process of obtaining B from A by replacing a part of the formula A by an equivalent formula is known as Replacement process. This can be used to obtain a simpler formula equivalent to a given formula. Also it can be used to determine the given formula is a tautology. (I)Show the following without using truthtable. 1)(A→ B) (C→ B) (A C)→ B LHS = (A→ B) (C→ B) ┐AB) (┐C B) B┐A) (B┐C) B┐A ┐C) B┐AC ) ┐AC )B AC )→ B = RHS 2) P→(Q→R) PQ) →R 3) A(A→ B)→ B T 4) P→ (Q→R) ┐P→ (P→Q) [H W] Tautological implications A statement formula A is said to be tautologically imply a statement B iff A→ B is a tautology and it is denoted by AB and it is read as A implies B. 1)Prove that ┐QP→Q) ┐P ┐Q P Q T T F F T F F T T F F T ┐P→ Q) P PQQ P (PQ) Q PQ Q P→Q 2) 3) 4) 5) 6) P→Q ┐P [A] T F T T F F T T ┐QP→Q) [B] F F F T A→ B T T T T [H W] Joint implications Let H1, H2,.....,H m be m formulas. We say that H1, H2,.....,H m jointly implies a formula Q if ( H1 H2 .....H m) Q. ie if H1, H2,.....,H m→ Q is a tautology .In this case we write H1, H2,.....,H mQ. H1, H2,.....,Hm are called premises and Q is called conclusion. Theorem If H1, H2,.....,Hm,PQ then H1, H2,.....,Hm P→Q Proof By using the result, PQ) →R P→(Q→R) If, If H1, H2,.....,H m,PQ, H1 H2 .....H m P→ Q is a tautology. m → (P→Q) This is also a tautology. H1, H2,.....,H mP→Q Law of duality Let A be a formula containing the connectives ┐,andonly. If A contains any other connectives, it may be replaced by an equivalent formula containing these connectives only. Then let A * be the formula obtained by this replacing byand by Then A and A* are said to be duals of each other. The connectives andare also calledduals of each other. If A contains the special variables T or F then replace T with F and F with T to get its dual A* eg,1) If A: (P Q) R then A*: (P Q) R 2) P1: ┐PQ) P*:┐PQ)F Result Let A and A* be dual formulas and P1, P2,.....,Pn be all the atomic variables occur in A and A*. ie; A : A( P1, P2,.....,Pn) and A*: A*( P1, P2,.....,Pn) Then, ┐A( P1, P2,.....,Pn) A*( ┐ P1, ┐P2,.....,┐Pn) eg. ┐(P Q) ┐P ┐Q eg. Show that ┐( ┐ P┐(QR)) P Q R) Let A(P,Q,R) be ┐ P┐(QR) Then, A* (P,Q,R) is ┐P┐(QR) and A* (┐P,┐Q,┐R) is ┐┐P┐┐Q ┐R) ie; P Q R) But ┐A( P,Q,R ) A* (┐P,┐Q,┐R) ┐( ┐ P┐(QR)) P Q R). 3) Result If any two formulas are equivalent, then their duals are also equivalent to each other. Ie; if A then A** Normal forms Here we use 'product' in place of conjunction and 'sum' in place of disjunction. Elementary Product A product of variables and their negation in a formula is called an elementary product. eg. P Q, P┐Q Elementary Sum A sum of variables and their negation in a formula is called an elementary sum. eg. PQ, P┐Q, P┐QR Disjunctive normal form (DNF) A formula which is equivalent to a given formula and which consists of sum of elementary product is known as DNF. 1) Obtain the disjunctive normal form of P (P→ Q) P (P→ Q) P (┐PQ) ( P ┐P)(PQ) Extended Distributive law (PQ) (RS) (PR)(PS) (QR)(Q S) Obtain the DNF of 1) ┐(P→ QR) ) ┐(┐P(QR)) ┐┐P ┐QR) P(┐Q ┐R) P┐QP┐Rwhich is a dnf. 2) ((PQ)(P┐Q)) ((P┐Q)(┐P┐Q)) 3) ( P┐(QR)( PQ)┐R)P) Disjunctive normal form of a given formula is not unique. They are equivalent. Conjunctive normal form (DNF) A formula which is equivalent to a given formula and which consists of product of elementary sum is known as CNF. 1) Obtain the conjunctive normal form of P (P→ Q) P (┐PQ) 2) QP┐Q) ┐P┐Q)) 3) ┐( PQ) PQ Minterms minterm consists of conjunction in which each statement variable or its negation , not both appears only once. For two variables P and Q there are 22 minterms. These are known as Boolean conjunction of P and Q. From the truth table of these minterms it is clear that no minterms are equivalent. Each minterms have truth value T for exactly one combination of truth values of the variables P and Q. Principal disjunctive normal form (PDNF). For a given formula consisting of disjunction of minterms is known as PDNF. (I)Obtain pdnf of 1) ┐PQ ┐PQ (┐P)Q) (┐PQ┐Q))(QP┐P)) (┐PQ)(┐P┐Q) QP)(Q ┐P) (┐PQ)(┐P┐Q) QP) 2) Find the pdnf of the following. i) P→((P→ Q) ┐(┐Q┐P) ii) ( PQ)(┐PR)QR) iii) P(┐PQ) PQ iv) P(┐P┐QR) v) P( PQ)P (II)Obtain pcnf of the following. i) Q( P┐Q) Q( P┐Q) (QF)( P┐Q) (Q( P┐P)) ( P┐Q) (Q P)(Q┐P) ( P┐Q) ii) (Q→ P)(┐PQ) iii) P(┐P→ (Q(┐Q → R)) iv) (┐P→R)(Q P) The theory of inference for statement calculus 1)Determine whether the conclusion C follows logically from the premises H1 and H2 H1:P→Q, H2: P, C:Q P (H2) T P→ Q (Q) Q (C) T T T F F F T T F F F We observed that the first row is the only row in which both the premises have the value T. The conclusion also have the value T in this case. Hence it is valid. 2) Check whether the statements given are is valid or not. H1:P→Q, H2:┐P, C:Q 3) H1:P→Q, H2:┐(PQ), C:┐P Without using truthtable The truth value techniques become difficult when the no. of atomic variables is large. So we have to consider some other method of derivation. For this purpose we may use the result of equivalence and implications we have already seen. The important results of implications and equivalence are listed below. Implications Simplification I1:PQ P I2:PQ Q Addition I3:PPQ I4:QPQ I5:┐PPQ I6:QP→Q I7:┐(P→Q)P I8:┐(P→Q)┐Q I9:P,QPQ I10:┐P,PQQ I11:P,P→Q Q (modus ponens) I12:┐Q,P→Q┐P (modus tollens) I13:P→Q ,Q→RP→R I14:PQ,P→R Q→R R Equivalence E1 :┐┐P P E2: PQQP E3 : PQQP E4: (PQ)RP(QR) E5 : (PQ)RPQR) E6:PQR) PQ) (PR) E7 :P(QR) (PQ)( PR) E8:┐( PQ) ┐P┐Q E9 : ┐( PQ) ┐P ┐Q E10: PPP E11 :PP P E12:P┐P T E13 :P┐PF E14: PTT E15 :PTP E16 :PF P E17: PFF E18 : P→Q┐PQ E19:┐(P→Q) P┐Q E20 :P→Q ┐Q→ ┐P E21: P→(Q→R)PQ)→ R E22 :┐(PQ )P┐Q E23 : PQ┐PQ) ( ┐QP) E24:PQ (PQ) (┐P┐Q) Using these results by replacement process, we may derive a required implication. But there is another way for a formal proof. It is a step by step derivation mentioning the justification for each step. For this purpose, in addition to the above results we may use the following 3 rules of inference. Rule P We may introduce a premise at any point of the derivation. Rule T We may introduce a formula S in a derivation if S is tautologically implied by one or more of the preceding formulas in the derivation. Rule CP If we can derive S from R and a set of premises, then we can derive R→S from from the set of premises alone. iePR)→ S P→(R→S) 1)P┐Q, Q R, ┐SP, ┐R S. show that S is a valid statement. Step No. Statement Reason 1 Q R Rule P 2 ┐R Rule P 3 Q Rule T [from steps 1 and 2] Q R┐R Q 4 P┐Q Rule P 5 ┐P Rule T 6 ┐SP Rule P 7 S Rule T [from steps 3 and 4] [from steps 5 and 6] Hence S is a valid statement. 2) Show that ┐( P ┐Q) ( ┐QR) ┐R ┐P 3) Show that RS logically follows from CD,(CD) ┐H, ┐H A ┐B ,(A ┐B)RS 4) Show that RPQ) is a valid conclusion from PQ, QR, PM, ┐M. 5) Show that SR is a valid conclusion from the premises PQ, PR, QS. 6) Derive P→(Q→S) from the premises P→(Q→R), Q→(R→S). Indirect method of proof The technique of indirect method of proof is as follows. 1. Introduce the negation of the desired conclusion as a new premise. ie;assume the conclusion C is false and consider ┐C as an additional premise. 2. From the additional or new premise, together with the new premises derive a contradiction. 3. Assert a desired conclusion as a logical inference from the premises. Thus C follows logically from the premises H1, H2, ........,Hn. Def: A set of formulas H1, H2, ........,Hn is said to be consistent if their conjunction has the truth value T for some assignment of the truth values to the atomic variables appearing in H1, H2, ........,Hn. If for every assignment of the truth value to the atomic variable, at least one of the formulas H1, H2, ........,Hn is false, so their conjunction is identically false. Therefore the formulas H1, H2, ........,Hn are inconsistent. In other words, a set of formulas contradiction. ie; H1, H2, ........,Hn is consistent if their conjunction implies a H1 H2 .......Hn R┐R 1) Show that ┐( PQ) follows from ┐P┐Q by indirect method. C = ┐( PQ) ┐C = ┐( ┐P ┐Q) = PQ (Additional premise.) Step No. Statement Reason 1 PQ Rule P 2 P Rule T 3 ┐P┐Q Rule P 4 ┐P Rule T 5 ┐PP Rule T The statement in step 5 is a contradiction. Hence we say that ┐( PQ) follows from ┐P┐Q. Show that the following premises are inconsistent. 1. P→Q, P→R, Q→ ┐R, P. Step No. Statement Reason 1 P→Q Rule P 2 Q→ ┐R Rule P 3 P→ ┐R Rule T 4 PR Rule P 5 ┐R→ ┐P Rule T 6 P┐P Rule T 7 ┐P ┐P Rule T [from step 6] P→Q┐PQ 8 ┐P Rule T 9 P Rule P 10 ┐PP [from steps 1 and 2] P→Q ,Q→ R P→R [from steps 3 and 4] Rule T Therefore the given premises are inconsistent. 2) By indirect method show that ┐Q ,P→Q, PRR 3) By indirect method show that P→Q, Q→R,PRR Predicate calculus Consider the statements – John is a student, Raj is a student. In the statement calculus we need different statement symbols foe these statements even though they have a common feature. The statement “John is a student” has two parts. “John” is the subject and “is a student” is the predicate. Now we may represent the predicate “is a student” by B and the name by “j”. Then the above statement can be written as B(j), B(r). Generally we may say that B(x) represent “x is a student”. Here “B” represents the “predicate” “is a student” and x is a place holder. B(x) may be called as a statement function or predicate and x is the object or variable. Usually predicates are represented by capital letters and object by small letters. In general, the statement of the form “p is Q” is represented by Q(p). In the above eg. B(x) where x is a student is a one-place predicate, since it is related to one object. Now consider “< : is less than”. We may consider a two place predicate L(x,y) : x is less than y. S(x,y,z) : x sit b/w y and z. S : sit b/w.........3-place predicate In general, an n-place predicate requires n names of objects to be inserted in fixed positions in order to obtain a statement. A single proposition or statement may be considered as a zero place predicate. Quantifiers Certain statement involves words that indicate quantity such as all, some, none, one etc. Since such words indicate quantity , they are called quantifiers. The quantifier “all” is the universal quantifier. The symbol, x represents the phrases, for all x, for every x, for each x, everything x is such that, each thing x is such that etc. The quantifier some is an existential quantifier. We denote this by the symbol x. This represent the phrases for some x, some x such that, there exist an x such that, there is an x such that, there is at least one x such that, etc. eg.1) Consider the statement – All roses are red. We can rewrite the above statement as, for all x if x is a rose then x is red. R(x) : x is a rose. C(x) : x is red. Then the above statement can be written as, x(R(x)C(x)) eg.2) All men are good. M(x) : x is a man. G(x) : x is good. Then the statement becomes, x(M(x)G(x)) eg.3) Some people who trust others are rewarded. There exist x, x is a person, x trust others and x is rewarded. P(x) : x is a person. T(x) : x trust others. R(x) : x is rewarded. x (P(x)T(x)R(x)) Predicate calculus – Rules of inference Rule P : Rule P implies given result. Rule T : Implies derived result. Rule US : (Universal specification) x A(x) A(y) Rule UG : (Universal generalization) x A(y)x A(x) Rule ES : (Existential specification) x A(x) A(y) Rule EG : (Existential generalization) A(y)x A(x) 1) Show that x M(x) follows logically from the premises (x)(H(x) M(x)) and x H(x). Step No. Statement Reason 1 x H(x) Rule P 2 H(y) Rule ES 3 (x)(H(x) M(x)) Rule P 4 H(y) M(y) Rule US; P,PQQ M(y) x M (x) 6 Rule T Rule EG 2) Prove that x(P(x)Q(x))x P(x)x Q(x) 3)Verify the validity All men are mortal. Socrates is a man. He is mortal. 4) Verify the validity of the following argument Tigers are dangerous animals. There are tigers. Therefore there are dangerous animals. Let T(x) : x is a tiger D(x): x is a dangerous animal Then the inference pattern is, (x) ( H(x) M(x)) x T(x) x D(x) 1 x T(x) Rule P 2 T(b) Rule ES, 1 3 (x) ( T(x) D(x)) Rule P 4 T(b) D(b) Rule US, 3 5 D(b) Rule T, 2,3 6 x D(x) Rule EG,5 Thus the inference is valid. Universe of discourse Consider the statement.- All men are giant. Let : M(x) : x is a man. G(x) : x is giant. Then the above statement can be written as (x) ( M(x) G(x)) However if we restrict the variable x to the universe which is the class of men. Then the statement becomes (x) (G(x)) . Such a restricted class is called universe of discourse. Write the predicate : Given any positive integer, there exist a greater positive integer with and without giving the universe of discourse. P(x) : x is a positive integer. G(y,x) : y is greater than x. (x) ( P(x) G(y,x)) i) x ( P(x) (y) (G(y,x))) or x ( P(x) (y) (P(y)G(y,x)) ii) x ((y)G(y,x)) *****************************************