This document discusses propositions and predicate logic. It defines propositions as statements that are either true or false. It describes logical connectives like "and", "or", "implication", and "equivalence" that are used to combine simple propositions into compound statements. It also discusses topics like tautologies, contradictions, three-valued logic, and predicate logic where variables are bound to make statements about sets.
This document discusses propositions and predicate logic. It defines propositions as statements that are either true or false. It describes logical connectives like "and", "or", "implication", and "equivalence" that are used to combine simple propositions into compound statements. It also discusses topics like tautologies, contradictions, three-valued logic, and predicate logic where variables are bound to make statements about sets.
This document discusses propositions and predicate logic. It defines propositions as statements that are either true or false. It describes logical connectives like "and", "or", "implication", and "equivalence" that are used to combine simple propositions into compound statements. It also discusses topics like tautologies, contradictions, three-valued logic, and predicate logic where variables are bound to make statements about sets.
This document discusses propositions and predicate logic. It defines propositions as statements that are either true or false. It describes logical connectives like "and", "or", "implication", and "equivalence" that are used to combine simple propositions into compound statements. It also discusses topics like tautologies, contradictions, three-valued logic, and predicate logic where variables are bound to make statements about sets.
Download as PPTX, PDF, TXT or read online from Scribd
Download as pptx, pdf, or txt
You are on page 1of 40
Propositions and Predicate Logic
Hafiz Muhammad Tahir
[email protected] Propositions • In classical logic, propositions are statements that are either TRUE or FALSE. • The following are examples of propositions that evaluate to TRUE: – There are seven days in a week – Accra is the capital of Ghana –2+4=6 Contd… • The following propositions evaluate to FALSE: – The angles of a triangle add up to 360 – London is the capital of France • 2–4=7 • In mathematics we often represent a proposition symbolically by a variable name such as P or Q. For example: – P: I go shopping on Wednesdays – Q: 102.001 > 101.31 LOGICAL CONNECTIVES • Simple propositions can be combined into compound statements by operators called logical connectives. The and operator • The operator known as and is represented by the symbol ^. – The statement P and Q is therefore represented by: • P^Q • Thus if P represented the statement I like shopping and Q represented the statement The sun is shining then P ^ Q would represent the statement I like shopping and the sun is shining. • This relationship is called conjunction. Truth Table of and The or operator • The operator known as or is represented by the symbol ˅. • The statement P or Q is therefore represented by: – P˅Q • Thus if P represented the statement ‘It is raining’ and Q represented the statement ‘Today is Tuesday’ then P ˅ Q would represent the statement ‘It is raining or today is Tuesday’. • This relationship is called disjunction. Truth table of or The Implication Operator • The implication operator is represented by the symbol ⇒. –P⇒Q • Thus if P represents ‘It is Wednesday’ and Q represents ‘I do the Ironing’, then the expression P ⇒ Q becomes ‘If it is Wednesday then I do the ironing’. Truth Table of Implication The Equivalence Operator • The idea of equivalence deals with the ‘otherwise’ part of implication, and is analogous to an IF… THEN … ELSE statement in a programming language. • it is represented by the symbol ⇔. – P⇔Q or – P iff Q Truth Table of Equivalence The Exclusive or • The natural language ‘or’ usually implies that only one or other of the statements is TRUE but not both. • This corresponds to the logical operator known as exclusive or (sometimes referred to as xor), which is represented by ⊕. – P:I will go to the theatre – Q:I will go to the cinema • So (P ⊕ Q). Truth Table of exclusive or Not • The operation known as negation yields a proposition with a value opposite to that of the original one. • The operator in question is called the not operator and is represented by the symbol ¬ (or sometimes by ~). • Thus if P is a proposition, then not P is represented by: ¬P Truth Table of NOT COMPOUND STATEMENTS AND THE ORDER OF PRECEDENCE OF OPERATORS • Ambiguity can easily arise in compound statements that contain more than one proposition. E.g. P˄Q˅R. – Order of precedence in VDM • ¬, ˄ , ˅ , ⇒, ⇔ • Brackets are used to indicate the highest precedence of all. • ¬P ˄ Q means the conjunction of ¬P with Q, whereas the expression • ¬(P ˄ Q) means the negation of the conjunction of P with Q. Logical Equivalence • Two compound propositions are said to be logically equivalent if identical results are obtained from constructing their truth tables. • This is denoted by the symbol ≡. – Two examples. • ¬(P ˄ Q) ≡ ¬P ˅ ¬Q • (P ˄ Q) ˅ R ≠ P ˄ (Q ˅ R) ¬(P ˄ Q) ¬P ˅ ¬Q (P ˄ Q) ˅ R P ˄ (Q ˅ R) Tautologies and Contradictions • A statement which is always TRUE (that is, all the rows of the truth table evaluate to TRUE) is called a tautology. • A statement which is always FALSE (i.e. all rows of the truth table evaluate to FALSE) is called a contradiction. Tautology Contradiction Three Valued Logic • Classical logic assumes that all expressions evaluate to TRUE or FALSE. In reality, this is not always the case when evaluating an expression, because sometimes an expression can be undefined – for example, the expression 0/0. • For example, when a variable is first declared and has not yet been assigned a value. P^Q P˅Q P⇒Q P⇔Q P⊕Q P and ¬ P Predicate Logic • For the purpose of reasoning about sets of values, a more powerful tool than the propositional logic has been devised, namely the predicate logic. • A predicate is a truth-valued expression containing free variables. These allow the expression to be evaluated by giving different values to the variables. Once the variables are evaluated they are said to be bound. Predicate Logic • A = {s, d, f, h, k} • B = {a, b, c, d, e, f} • The symbol Є means ‘is an element of’. Therefore the statement ‘d is an element of A’ is written: –dЄA • The statement ‘p is not an element of A’ is written: –p∉A EXAMPLES OF PREDICATES • C(x): x is a cat • Studies(x,y): x studies y • Prime(n): n is a prime number • A statement such as C(x) can be read C of x. Binding Variables: By Substitution • C(Simba): Simba is a cat • Studies(john, physics): john studies physics • Prime(3): 3 is a prime number • The above expressions now have a value of TRUE or FALSE. Binding Variables: By Quantification The universal quantifier ∀ • This quantifier enables a predicate to make a statement about all the elements in a particular set. – For example, if M(x) is the predicate x chases mice, we could write: – ∀x Є Cats ● M(x) • This reads For all the x which are members of the set Cats, x chases mice, or, more simply, – All cats chase mice. The existential quantifier ∃ • In this case, a statement is made about whether or not at least one element of a set meets a particular criterion. For example, if, as above, P(n) is the predicate n is a prime number, then we could write: – ∃n Є ℕ ● P(n) • This reads There exists an n in the set of natural numbers such that n is a prime number, or, put another way, • There exists at least one prime number in the set of natural numbers. The unique existential quantifier ∃! • This quantifier modifies a predicate to make a statement about whether or not precisely one element of a set meets a particular criterion. – For example, if G(x) is the predicate x is green, we could write – ∃!x Є Cats ● G(x) • This would mean There is one and only one cat that is green. • If the set over which the predicate is defined is clearly stated in advance, it can be omitted from the expression.