Docsity

Mathematical Logic - Lecture Notes | CS 3653, Study notes of Computer Science

Toggle sidebar
bg1
CS 3653 Fall 2002 Lecture 14-1 T. Menhaj
Lecture 14
Mathematical Logic
Logic – its subject is reasoning; it measures the value of
reasoning; whether something is correct; it is a set of rules
to draw inferences.
Note: The form of logic is nothing to do with the content of
the subject to which it is applied.
Example 1:
1) All CS graduate students know Discrete Math.
Everyone who knows discrete math knows the
fundamentals of mathematical logic.
Therefore, all CS graduate students know the
fundamentals of mathematical logic.
2) No even natural number has a square root.
4 is an even number.
Therefore, 4 does not have a square root.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Mathematical Logic - Lecture Notes | CS 3653 and more Study notes Computer Science in PDF only on Docsity!

Lecture 14

Mathematical Logic

Logic – its subject is reasoning; it measures the value of reasoning; whether something is correct; it is a set of rules to draw inferences.

Note: The form of logic is nothing to do with the content of the subject to which it is applied. Example 1:

  1. All CS graduate students know Discrete Math. Everyone who knows discrete math knows the fundamentals of mathematical logic. Therefore, all CS graduate students know the fundamentals of mathematical logic.

  2. No even natural number has a square root. 4 is an even number. Therefore, 4 does not have a square root.

Note: The conclusion is false but the reasoning is valid (logically correct); i.e., whenever the premises are true, the conclusion must be true.

  1. No even natural number has a square root. 8 is an even number. Therefore, 8 does not have a square root.

Note: Here the conclusion is true and the reasoning is valid, but is not sound because the first premise is not true. A valid reasoning called sound if the premises are true.

Question: Does logic help us to find out the truth of these statements? NO.

Then why do we need to know mathematical logic?

To check if the computer programs are correct; (logical analysis). Mathematical Induction is one of the general methods in logical analysis to prove that an argument is correct.

p: John is tall. q: John is a CS Graduate Student. r: p and q ≡ John is tall and he is a CS graduate student.

Truth Table: It describes (defines) precisely and concisely the truth values ( meaning ) of compound propositions.

Note: Two propositions are logically equivalent if they have the same truth value.

Compound proposition P consists of elementary propositions p 1 ,…, pn:

p q (^) p∧q p∨q p exor q (^) ¬p T T T T F F T F F T T F F T F T T T F F F F F T

“∧” = “and”, “∨”= “inclusive or”, “ exor ”= “exclusive or”, “¬”= “not”.

Example 2:

p1 : John is tall. p2 : John is a CS student. p3 : John wrote a computer program and implemented the “lucky key” problem.

Either John is tall and it is not the case that he is a CS student or he wrote a computer program to implement the “lucky key” problem:

P: (p 1 ∧ ¬p (^) 2) ∨ p (^3) If all three are true, the value of P is (T ∧ F) ∨ T = T.

Different forms of “and”.

  1. p and q := x is even and y is odd
  2. p; q := x is even; y is odd
  3. whereas p, q := x is even whereas y is odd
  4. p, but q := x is even but y is odd
  5. Although p, q := although x is even, y is odd

q: He will solve the “lucky key” problem.

“ p ” is called the antecedent (hypothesis), if-part. “ q ” is called the consequent (conclusion), then-part.

Example 3:

  1. John may take CS4883 only if he has sophomore, junior, or senior standing ≡ if John takes CS4883, then he has sophomore, junior, or senior standing.

  2. When you talk, I will enjoy ≡ I will enjoy when you talk.

  3. A sufficient condition for John to pass CS3653 is

that he should make at least a C in this course ≡ If John makes at least a C in CS3653, then he will pass it.

The hypothesis expresses the sufficient condition.

  1. A necessary condition for John to take CS 3653 is that he should have taken the prerequisite courses ≡ if

John is taking CS 3653, then John has already taken the prerequisite courses.

The conclusion expresses a necessary condition. Implication Connectives:

p q p^ →^ q p^ ↔ q T T T T T F F F F T T F F F T T

Not making a claim about q if p is false, so p^ →^ q is nothing but to say q is true if p is true.

p iff q ≡ p if and only if q≡ biconditional proposition

≡ equivalence connective, ≡ p is a necessary and sufficient condition for q. ≡¬(p exor q)

let p: 3 < 9 q: 10 < 17

The statement if 3 < 9, then 10 < 17, or the statement p Æ q is true because both p and q are true.

not separated by parentheses, they are evaluated from left to right.

Example 4: ¬p∧q∧s →^ s∧q ¬p (¬p∧q) & s∧q (¬p∧q) ∧s ((¬p∧q) ∧s) →^ ( s∧q)

Definition: Compound propositions P and Q are made up of the propositions p1,…,pn. It is said that P and Q

are logically equivalent, P ≡ Q, if given any truth values pi’s, either P and Q are both true or P and Q are both false.

Example 5:

p q p^ →^ q q∨¬p T T T T T F F F F T T T F F T T

q ∨ ¬p ≡ p → q (these are logically equivalent) Show that

p → q ≡ ¬p → ¬q (Contrapositive or Transposition of p → q) Proof: p q p^ →^ q ¬q→¬p T T T T T F F F F T T T F F T T

Example 6: Show that the following propositions are equivalent.

  1. If it is Sunday and I am not on call, I will drive to a short trip.
  2. If it is Sunday, then if I am not on call, I will drive to a short trip.

Sol’n: Define p: it is Sunday. q: I am not on call. s: I’ll drive to a short trip.