Unit-I Mathematical logic by P. Swapna Sreyas Institute of Engineering and Technology Mathematical logic 1 Proposition or statement : sentence either it is true or false. Denoted by A,B,C…P,Q,R,S,….. ex: India is a country 1+101=110 Close the door 1. Primary or simple or automic statements 2. Compound statements : Using logical connective in between two sentences. p ¬p Negation(¬or~): not in the sentence. T F Ex : p:I went to college yesterday. F T ¬p : I did not go to college yesterday. Mathematical logic 2 Logical connectives : not, and ,or ,“if….then”, “if and only if”. Conjunction (∧) : using “and”-true only if both are true. Disjunction (v) : using “or”-true if anyone is true. Exclusive Disjunction ( ⊻ ) : “exclusive or”-true only when p is true or q is true but not both. Conditional (→) : “if….then” –false only when p is true and q is false. Bi conditional (↔) : “if and only if” or (p → q) ∧ (q → p) – true only if both are true or both are false. Mathematical logic 3 EX: p: 2 is an integer q: 9 is multiple of 3 ¬p , p ∧ q , p ∨ q , p → q , P ↔ q , P ⊻ q Truth table: p q ¬p p∧q p∨q p→q P↔q P⊻q T T F T T T T F T F F F T F F T F T T F T T F T F F T F F T T F Statement formulas: any formula Ex: ¬p , p ∧ q , p ∨ q , p ∧ q → r ,p ∧ p ∨ q Well formed formulas : Cannot be interpreted in more than one way (p ∧ q) → r p∧q→r Ex: Mathematical logic p ∧ (q → r) 4 Tautology (To) : True for all possible truth values Contradiction (Fo) : False for all possible truth values P ¬p pv¬p T F T F T T p ¬p p∧¬p T F F F T F Contingency : A compound proposition that can be true or false p q Pvq Mathematical logic T T T T F T F T T F F 5 F Construct truth table for the following ¬(p ∧ q) v ¬ (q ↔ p) p q p∧q ¬(p ∧ q) q↔p ¬ (q ↔ p) ¬(p ∧ q) v ¬ (q ↔ p) T T T F T F F T F F T F T T F T F T F T T F F F T T F T (p v q ) v r p→ (q→ ¬r) [(p ∧ q) v ¬r] ↔ p q ↔(¬ p v ¬q) Mathematical logic 6 u and v have identical truth values /u↔v is a tautology denoted by u⇔v Example: Prove that (p → q) ⇔ ((¬p)vq) Soln: p q (p → q) T T T F T T F F F F F T T T T F F T T T ¬p (¬p) v q (p → q) and (¬p) v q have same truth values so logically equivalent Mathematical logic 7 Law of Double negation: ¬ ( ¬p ) ⇔ p Idempotent Laws : (p v p) ⇔ p and (p ∧ p) ⇔ p Identity Laws : ( p v Fo) ⇔ p and (p ∧ To ) ⇔ p Inverse Laws : ( p v ¬p) ⇔ To and ( p ∧ ¬p) ⇔ Fo Domination Laws : ( p v To) ⇔ To and (p ∧ Fo ) ⇔ Fo Mathematical logic 8 Commutative Laws : (p v q) ⇔ (q v p) and (p ∧ q) ⇔ (q ∧ p) Absorption Laws : [p v (p ∧ q) ] ⇔ p and [p ∧ (p v q) ] ⇔ p Demorgan Laws : ¬ (p v q) ⇔ ¬p ∧ ¬q and ¬ (p ∧ q) ⇔ ¬p v ¬q Associative Laws: (p v (q v r)) ⇔ (p v q) v r and (p ∧ (q ∧ r)) ⇔ (p ∧ q) ∧ r Disributive Laws : (p v (q ∧ r)) ⇔ (p v q) ∧ (p v r) (p ∧ (q v r)) ⇔ (p ∧ q) v (p ∧ r) Mathematical logic 9 Simplify the following compound propositions using the laws of logic (p v q) ∧ ¬ ((¬p) v q) Soln: (p v q) ∧ ¬ ((¬p) v q) ⇔ (p v q) ∧ ( p ∧ ¬q) (Demorgan law) ⇔ ((p v q) ∧ p ) ∧ (¬q) (Associative law) ⇔ (p ∧ (p v q)) ∧ (¬q) (Commutative law) ⇔ p ∧ (¬q) (Absorption law) Mathematical logic 10 ¬(¬((p v q) ∧ r) v ¬q) Soln:¬(¬((p v q) ∧ r) v ¬q) ⇔ ¬ (¬ ((p v q) ∧ r) ∧ q) (Demorgan law) ⇔ ((p v q) ∧ r) ∧ q) (law of double negation) ⇔ (p v q) ∧ (r ∧ q) (Associative law) ⇔ (p v q) ∧ (q ∧ r) (commutative law) ⇔((p v q) ∧ q) ∧ r (Associative law) ⇔ (q ∧ r) (Absorption law) Mathematical logic 11 Prove the following logical equivalences without using truth tables P v [p ∧ (p v q) ] ⇔ p Soln:p v [p ∧ (p v q) ] ⇔ p v p (Absorption law) ⇔p (Idempotent law) Mathematical logic 12 v q v (¬p ∧¬q ∧ r)] ⇔ (p v q v r) Soln: ¬p ∧¬q ∧ r ⇔ (¬p ∧¬q) ∧ r (Associative law) ⇔ ¬(p v q) ∧ r (Demorgan law) Therefore [p v q v (¬p ∧¬q ∧ r)] ⇔ (p v q) v [¬(p v q) ∧ r ] ⇔ [(p v q) v ¬(p v q)] ∧ [(p v q) v r] (Distributive law) ⇔ To ∧ [p v q v r] (inverse law and associative law) ⇔ [p v q v r] ∧ To (Commutative law) ⇔ (p v q v r) [p Mathematical logic 13 Tautological implication (⇒) : A ⇒ B /A→ B is a tautology Ex: Prove that (p → q) ⇒ (¬ q→ ¬ p) Soln: p q ¬p ¬q (p → q) (¬ q→ ¬ p) (p → q) → (¬ q→ ¬ p) T T F F T T T T F F T F F T F T T F T T T F F T T T T T Therefore (p → q) ⇒ (¬ q→ ¬ p) Mathematical logic 14 Prove that (¬ q ∧(p → q) ) ⇒ ¬ p ¬ (p → q) ⇒ p (p → ( q →r)) ⇒(( p →q) →( p →r)) q ⇒ ( p →r) (p ∧ q) ⇒ ( p →q) Mathematical logic 15 NAND (↑) : ‘not’ and ‘and’ (p ↑ q) = ¬ (p ∧ q) ⇔ ¬p v ¬q NOR (↓) : ‘not’ and ‘or’ (p ↓q) = ¬ (p v q) ⇔ ¬p ∧ ¬q p q p↑q p ↓q T T F F T F T F F T T F F F T T For any propositions p,q prove the following ¬ (p ↓q) ⇔ (¬p ↑ ¬q) Soln: ¬ (p ↓q) ⇔ ¬(¬ (p v q) ) ⇔¬(¬p ∧ ¬q) ⇔ (¬p ↑ ¬q) Mathematical logic 16 ¬ (p ↑ q) ⇔ (¬p ↓ ¬q) Soln: ¬ (p ↑ q) ⇔ ¬(¬ (p ∧ q) ) ⇔ ¬(¬p v ¬q) ⇔ (¬p ↓ ¬q) For any propositions p,q,r prove the following p ↑( q ↑ r) ⇔ ¬p v (q ∧ r) Soln: p ↑( q ↑ r) ⇔ ¬(p ∧ ( q ↑ r) ) ⇔ ¬(p ∧ ¬ ( q ∧ r) ) ⇔ ¬p v (q ∧ r) (p ↑ q) ↑ r ⇔ (p ∧ q) v ¬r Soln: (p ↑ q) ↑ r ⇔ ¬((p ↑ q) ∧ r) ⇔¬(¬ (p ∧ q) ∧ r) ⇔ (p ∧ q) v ¬r (p ↓q) ↓ r ⇔ (p v q) ∧ ¬ r p ↓(q ↓ r) ⇔ ¬ p Mathematical ∧ (q v logic r) 17 Elementary product : product of variables and their negations Ex: p , ¬p , ¬ p ∧ q , ¬ q ∧ p ∧ ¬ p , p ∧ ¬ p Elementary sum : sum of variables and their negations Ex: p , ¬p , ¬ p v q , ¬ q v p v ¬ p , p v ¬ p Mathematical logic 18 Disjunctive Normal Forms (d.n.f) : sum of elementary products 2. Conjunctive Nomal Form (c.n.f) : Product of elementary sums Procedure to obtain d.n.f: Replace → , ↔ by ∧ , ∨ and ¬ (p → q) ⇔ ((¬p)vq) p ↔ q ⇔ (p ∧ q) ∨ ¬ (p ∨ q) ⇔ (¬ p ∨ q) ∧ (¬ q ∨ p) Use Demorgans law Apply disrtibutive law 1. Mathematical logic 19 ( p ∨ q) ∧ ( r ∨ s) ⇔ (( p ∨ q) ∧ r ) ∨(( p ∨ q) ∧ s) ⇔ ( p ∧ r) ∨ ( p ∧ s) ∨( q ∧ r) ∨ ( q ∧ s) Ex: Obtain d.n.f of p ∧ (p → q) Soln: p ∧ (p → q) ⇔ p ∧ (¬ p ∨ q) ⇔ (p ∧ ¬ p ) ∨ (p ∧ q) Note: d.n.f and c.n.f are not unique. Mathematical logic 20 Minterms : conjunction in which each statement variable or its negation , but not both , appears only once. Ex : p ∧ q , ¬p ∧ q, p ∧ ¬q, ¬p ∧ ¬q Maxterms : disjunctions in which each statement variable ,or its negation , but not both , appears only once. Principal Disjunctive Normal Form (P.D.N.F) : sum of products canonical form -disjunctions of minterms Principal Conjunctive Normal Form (P.C.N.F): Product of sums canonical form –Conjunctions of maxterms Mathematical logic 21 Procedure to obtain P.D.N.F or P.C.N.F: 1. Replace → , ↔ by ∧ , ∨ and ¬ 2. Use Demorgans law followed by distibutive law 3. Elementary product which is contradiction is dropped. Identical minterms appearing in the disjunction are deleted. Quantifiers: ‘for all’ , ‘for every’ , ‘for each’ , ‘for any’ , ‘for some’ , ‘there exists’ Existential Quantifier: ‘for some’ , ‘there exists’ Universal Quantifier : ‘for all’ , ‘for every’, ‘for each’ , ‘for any’ Mathematical logic 22 q → p: is converse of p → q ¬ p → ¬ q is inverse or opposite of p → q ¬ q → ¬ p is contrapositive of p → q Ex: p: 2 is an integer q: 9 is multiple of 3 1. p → q:if 2 is an integer then 9 is multiple of 3 2. q → p: if 9 is multiple of 3 then 2 is an integer q → p is converse of p → q 3. ¬ p → ¬ q : if 2 is not an integer then 9 is not multiple of 3 4. ¬ q → ¬ p : if 9 is not multiple of 3 then 2 is not an integer Mathematical logic 23
© Copyright 2026 Paperzz