Propositional logic / Functional Dependencies1 Propositional logic is the branch of logic that studies ways of joining and/or modifying entire propositions, statements or sentences to form more complicated propositions, statements or sentences, as well as the logical relationships and properties that are derived from these methods of combining or altering statements. Propositions are objects typically represented in various formal deduction systems called propositional calculus. In general a calculus is a formal system that consists of a set of syntactic expressions (well-formed formulas, or wffs), a distinguished subset of these expressions a set of transformation rules. The transformation rules can be used to derive logically equivalent expressions from any given expression. These derivations include as special cases 1. the problem of simplifying expressions and 2. the problem of deciding whether a given expression is equivalent to an expression in the distinguished subset, typically interpreted as the subset of logical axioms. The language of a propositional calculus consists of 1. a set of primitive symbols, referred to as atomic formulas 2. a set of operator symbols interpreted as logical operators or logical connectives. 3. a well-formed formula (wff) is any atomic formula or any formula that can be built up from atomic formulas by means of operator symbols. 1 Extracted from http://en.wikipedia.org/wiki/Propositional_calculus and the Internet Encyclopedia of Phylosophy http://www.iep.utm.edu/p/prop-log.htm (June 6, 2006) 1 Logical Implication The implies operator is a binary truth-functional logical operator taking the form If a then b, also A B, or A B where a and b are statement variables (to be replaced by any meaningful sentence of the language). a is called the antecedent and b is called the consequent The truth of the antecedent is a sufficient condition for the truth of the consequent. The truth of the consequent is a necessary condition for the truth of the antecedent. Definition The truth table associated with the logical implication p implies q (symbolized as p ⇒ q or p → q) is as follows: Truth Table: Logical Implication p q p⇒q F F T F T T T F F T T T p F F T T Truth Table: Disjunction ( p q) q F T T T F F T T 2 Equivalence: A B has the same truth table of ( A B) FALSITY IMPLIES ANYTHING An expression of the form A B in which A is FALSE always evaluates to TRUE (regardless of the veracity of B) A story is told that the famous English mathematician G.H. Hardy made a remark at dinner that falsity implies anything. A guest asked him to prove that 2 + 2 = 5 implies that McTaggart is the Pope. Hardy replied, We also know that 2 + 2 = 4, so that 5 = 4. Subtracting 3 we get 2 = 1. McTaggart and the Pope are two, hence McTaggart and the Pope are one. Professor Godfrey Harold Hardy FRS (February 7, 1877 – December 1, 1947) was a prominent British mathematician, known for his achievements in number theory and mathematical analysis. John McTaggart (1866-1925) was an Idealist metaphysician. In a famous paper The Unreality of Time (1908), McTaggart had argued that our perception of time is an illusion, 3 and that time itself is merely ideal. He introduced the notions of the A-series and B-series interpretations of time, representing two different ways that events in time can be ordered. The A-series corresponds to our everyday notions of past, present, and future. An A-series ordering involves statements such as X occurred in the past, X is occurring now, or X will occur in the future. This is contrasted with the B-series, in which events are placed in a chronological order according to relations of the form X occurred before Y, X occurred at the same time as Y, or X occurred after Y. McTaggart argued that the A-series was a necessary component of any full theory of time, but that it was also selfcontradictory and that our perception of time was therefore an ultimately incoherent illusion. Basic argument forms of the propositional calculus Name Sequent Description Modus Ponens ((p → q) ∧ p) Modus Tollens ((p → q) ∧ ¬q) Hypothetical Syllogism ((p → q) ∧ (q → r)) Disjunctive Syllogism ((p ∨ q) ∧ ¬p) Constructive Dilemma ((p → q) ∧ (r → s) ∧ (p ∨ r)) Destructive Dilemma ((p → q) ∧ (r → s) ∧ (¬q ∨ ¬s)) ¬r) Simplification (p ∧ q) Conjunction p, q p (p ∧ q) q if p then q; p; therefore q ¬p if p then q; not q; therefore not p (p → r) if p then q; if q then r; therefore, if p then r q Either p or q; not p; therefore, q (q ∨ s) (¬p ∨ If p then q; and if r then s; but either p or r; therefore either q or s If p then q; and if r then s; but either not q or not s; therefore either not p or not r p and q are true; therefore p is true p and q are true separately; therefore they are true conjointly 4 Addition p (p ∨ q) p is true; therefore the disjunction (p or q) is true Composition ((p → q) ∧ (p → r)) De Morgan's Theorem (1) ¬(p ∧ q) (¬p ∨ ¬q) The negation of (p and q) is equiv. to (not p or not q) De Morgan's Theorem (2) ¬(p ∨ q) (¬p ∧ ¬q) The negation of (p or q) is equiv. to (not p and not q) Commutation (1) (p ∨ q) (q ∨ p) (p or q) is equiv. to (q or p) Commutation (2) (p ∧ q) (q ∧ p) (p and q) is equiv. to (q and p) Association (1) (p ∨ (q ∨ r)) ((p ∨ q) ∨ r) p or (q or r) is equiv. to (p or q) or r Association (2) (p ∧ (q ∧ r)) ((p ∧ q) ∧ r) p and (q and r) is equiv. to (p and q) and r Distribution (1) (p ∧ (q ∨ r)) ((p ∧ q) ∨ (p ∧ r)) p and (q or r) is equiv. to (p and q) or (p and r) Distribution (2) (p ∨ (q ∧ r)) ((p ∨ q) ∧ (p ∨ r)) p or (q and r) is equiv. to (p or q) and (p or r) Double Negation p Transposition (p → q) (¬q → ¬p) Material Implication (p → q) (¬p ∨ q) ¬¬p (p → (q ∧ r)) If p then q; and if p then r; therefore if p is true then q and r are true p is equivalent to the negation of not p If p then q is equiv. to if not q then not p If p then q is equiv. to either not p or q 5 Material Equivalence (1) (p ↔ q) Material Equivalence (2) (p ↔ q) ├ ((p ∧ q) ∨ (¬q ∧ ¬p)) (p is equiv. to q) means, either (p and q are true) or ( both p and q are false) Exportation ((p ∧ q) → r) (p → (q → r)) from (if p and q are true then r is true) we can prove (if q is true then r is true, if p is true) Importation (p → (q → r)) ((p ∧ q) → r) Tautology p Tertium non datur (Law of Excluded Middle) ((p → q) ∧ (q → p)) (p ∨ p) (p ∨ ¬ p) (p is equiv. to q) means, (if p is true then q is true) and (if q is true then p is true) p is true is equiv. to p is true or p is true p or not p is true 6 Example of a proof The following is an example of a (syntactical) demonstration: Prove: Proof: A→A Number wff Justification 1 A p 2 A∨A From (1) by disjunction introduction 3 (A ∨ A) ∧ A From (1) and (2) by conjunction introduction 4 A From (3) by conjunction elimination 5 A├A Summary of (1) through (4) 6 ├A→A From (5) by conditional proof 7 FUNCTIONAL DEPENDENCIES Data dependencies are constraints (X Y rules) imposed in the data held in a database. Dependencies help in several ways o controlling and eliminating data redundancy, o reducing conflicts associated to the maintenance of relational data, o allowing the designer to choose the most appropriate representation of data among a number of potential formats o capturing (some) business rules included in the real world model Definition Let R(A1, A2, …An) be a relation schema. Let X and Y be subsets of R. We say X Y (X functionally determines Y or Y depends on X) if for whatever relation r(R) it is not possible that r has two tuples that agree in the components for all attributes of the set X yet disagree in one or more components for attributes in the set Y. In other words for any tuples t1 and t2 in r if (t1[X] = t2[X]) then (t1[Y] = t2[y]). 8 EXAMPLE What dependencies can you find in this table? PROJECT PNAME ProductX ProductY ProductZ Computerization Reorganization Newbenefits PNUMBER 1 2 3 10 20 30 PLOCATION Bellaire Sugarland Houston Stafford Houston Stafford DNUM 5 5 5 4 1 4 True / False PNAME DNUM DNUM PLOCATION PLOCATION PNAME … 9 Observation A functional dependency XY implies a one-to-one or many-to-one relationship. An alternative definition of functional dependencies states the expression XY is logically equivalent to the formula X Y Example PartNumber SupplierNumber ProjectNumber P1 P1 P1 ShipmentDate UnitCost 10 15 10 Does PartNumber UnitCost ? For any two tuples t1 and t2 in r(R) Not (t1[PartNumber] = t2[PartNumber]) or (t1[UnitCost] = t2[UnitCost]) 10