CSE 2353 – September 4th 2002 Logic
Review Propositions Operators Truth Tables Precedence Conditionals Implication Others Truth Tables Precedence Conditionals Contrapositive, Inverse, Converse Tautologies and Contradictions
Operations And (conjunction) ^ Or (inclusive disjunction) v Xor (exclusive disjunction) v Not (negation) ~ If … then (implication) Iff (biconditional) Nand | Nor Construct sentences with words
Implication If p then q (otherwise q or ~q) Telecomm Example: “e” = equipped; “s” = in service; “d” = diags If s then e If d then e If s then d
Implication Consistency Check() If (s and e) or ~s then If (d and e) or ~d then If (s and d) or ~s then Return success Return failure
Implication Consistency check() Simpler code; multiple return points If (s and ~e) then return fail If (d and ~e) then return fail If (s and ~d) then return fail Return success Simpler code; multiple return points
Implication Consistency check() Simpler code; no branches; one return. Val = true; Val &= (~s or e); Val &= (~d or e); Val &= (~s or d); Return Val; Simpler code; no branches; one return.
Implication Simplest code. Or Return (~s or e) and (~d or e) and (~s or d); Or Return ( ~s or d) and (~d or e);
Duality Swap t,f Swap ^,v Example (p ^ q) v ~p Dual (p v q) ^ ~p If expressions are equivalent, so are duals
Arguments If you insulted Bob then I’ll never speak to you again. You insulted Bob so I’ll never speak to you again. Premise Conclusion
Arguments If you are a mathematician then you are clever. You are clever and rich. Therefore If you are rich then you are a mathematician. Premise Conclustion
Laws Idempotent Commutative Associative Absorption Distributive Involution De Morgan’s Complement
Laws Example Prove that (~p ^ q) v ~(p v q) ~p.
Predicates Universal Quantifier All rats are grey R(x): x is a rat. G(x): x is grey (x)[R(x) G(x)]
Predicates Existential Quantifier Some rats are grey R(x): x is a rat. G(x): x is grey (x) [R(x) ^ G(x)]
Examples Some children didn’t apologize
Examples All students who did their homework passed the final exam.
Examples Some body set off the fire alarm and everybody left the building.
2 Place Predicates P(x,y) x + y = 7 (x)(y) [ P(x,y) ] is true (y) (x) [ P(x,y) ] is not true
Negation, Specification, and Generalization ~(x)[F(x)] = ~(x)[G(x)] =