0% found this document useful (0 votes)
47 views10 pages

CC103 Sit LNT 001 Intro&Logic

Mathematical logic provides tools for precisely representing and reasoning about statements, including propositional logic and predicate logic. [1] Propositional logic uses operators like negation, conjunction, disjunction, implication and biconditional to combine simple statements into compound ones. [2] Predicate logic extends propositional logic to quantify over variables using predicates and quantifiers. [3] These logics allow for objective evaluation of the truth or falsity of statements and formal proofs in mathematics.

Uploaded by

bhabish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views10 pages

CC103 Sit LNT 001 Intro&Logic

Mathematical logic provides tools for precisely representing and reasoning about statements, including propositional logic and predicate logic. [1] Propositional logic uses operators like negation, conjunction, disjunction, implication and biconditional to combine simple statements into compound ones. [2] Predicate logic extends propositional logic to quantify over variables using predicates and quantifiers. [3] These logics allow for objective evaluation of the truth or falsity of statements and formal proofs in mathematics.

Uploaded by

bhabish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Foundations of Logic

(Rosen 7th ed., 1.1-1.4)

Mathematical Logic is a tool for working with complicated compound statements. It


includes:
A language for expressing them.
A concise notation for writing them.
A methodology for objectively reasoning about their truth or falsity.
It is the foundation for expressing formal proofs in all branches of mathematics.

Overview

Propositional logic (1.1-1.2):


Basic definitions. (1.1)
Equivalence rules & derivations. (1.2)
Predicate logic (1.3-1.4)
Predicates.
Quantified predicate expressions.
Equivalences & derivations.

Propositional Logic (1.1)


Propositional Logic is the logic of compound statements built from simpler statements
using so-called Boolean connectives.

Some applications in computer science:


Design of digital electronic circuits.
Expressing conditions in programs.
Queries to databases & search engines.

Definition of a Proposition

A proposition (p, q, r, ) is simply a statement (i.e., a declarative sentence) with a


definite meaning, having a truth value thats either true (T) or false (F) (never both,
neither, or somewhere in between).

(However, you might not know the actual truth value, and it might be situation-
dependent.)
[Later we will study probability theory, in which we assign degrees of certainty to
propositions. But for now: think True/False only!]

1
Examples of Propositions

It is raining. (In a given situation.)


Toronto is the capital of Canada. 1 + 2 = 3

But, the following are NOT propositions:

Whos there? (interrogative, question)


La la la la la. (meaningless interjection)
Just do it! (imperative, command)
Yeah, I sorta dunno, whatever... (vague)
1 + 2 (expression with a non-true/false value)

Operators / Connectives

An operator or connective combines one or more operand expressions into a larger


expression. (E.g., + in numeric exprs.)

Unary operators take 1 operand (e.g., 3); binary operators take 2 operands (eg 3 4).

Propositional or Boolean operators operate on propositions or truth values instead of on


numbers.

Some Popular Boolean Operators


Formal Name Nickname Arity Symbol

Negation operator NOT Unary

Conjunction operator AND Binary

Disjunction operator OR Binary

Exclusive-OR operator XOR Binary

Implication operator IMPLIES Binary

Biconditional operator IFF Binary

2
The Negation Operator

The unary negation operator (NOT) transforms a prop. into its logical negation.

E.g. If p = I have brown hair.


then p = I do not have brown hair.

Truth table for NOT:


p p
T F
F T

T : True; F : False
: means is defined as

The Conjunction Operator

The binary conjunction operator (AND) combines two propositions to form their
logical conjunction.

E.g. If p=I will have rice for lunch. and q=I will have noodles for dinner., then

pq=I will have rice for lunch and


I will have noodles for dinner.

Conjunction Truth Table


p q pq
Note that a
conjunction F F F
p1 p2 pn F T F
of n propositions T F F
will have 2n rows T T T
in its truth table.

Also: and operations together are sufficient to express any Boolean truth
table!

3
The Disjunction Operator

The binary disjunction operator (OR) combines two propositions to form their
logical disjunction.

p=My car has a bad engine.


q= My car has a bad carburetor.

pq=Either my car has a bad engine, or my car has a bad carburetor.

Disjunction Truth Table

Note that pq means that p is true, or q is true, or both are true!


p q pq
F F F
F T T
T F T
T T T
So, this operation is also called inclusive or, because it includes the possibility
that both p and q are true.

and together are also universal.

Nested Propositional Expressions

Use parentheses to group sub-expressions:


I just saw my old friend, and either hes grown or Ive shrunk. = f (g s)
(f g) s would mean something different
f g s would be ambiguous

By convention, takes precedence over both and .
s f means (s) f , not (s f)

A Simple Exercise

Let p=It rained last night,


q=The sprinklers came on last night,
r=The lawn was wet this morning.

Translate each of the following into English:


p =

4
r p =

rpq=

The Exclusive Or Operator

The binary exclusive-or operator (XOR) combines two propositions to form their
logical exclusive or (exjunction?).

p = I will earn an A in this course,


q = I will drop this course,

p q = I will either earn an A for this course, or I will drop it (but not both!)

Exclusive-Or Truth Table

Note that pq means that p is true, or q is true, but not both!


p q pq
F F F
F T T
T F T
T T F

This operation is called exclusive or, because it excludes the


possibility that both p and q are true.

and together are not universal.

The Implication Operator

The implication p q states that p implies q.

I.e., If p is true, then q is true; but if p is not true, then q could be either true or false.

E.g., let p = You study hard.


q = You will get a good grade.

p q = If you study hard, then you will get a good grade.


(else, it could go either way)

5
Implication Truth Table

p q is false only when p is true but q is not true.


p q pq
F F T
F T T
T F F
T T T
p q does not say that p causes q!

p q does not require that p or q are ever true!

E.g. (1=0) pigs can fly is TRUE!

Examples of Implications

If this lecture ends, then the sun will rise tomorrow. True or False?

If Tuesday is a day of the week, then I am a penguin. True or False?

If 1+1=6, then Bush is president. True or False?

If the moon is made of green cheese, then I am richer than Bill Gates. True or
False?

Why does this seem wrong?

Consider a sentence like,


If I wear a red shirt tomorrow, then the U.S. will attack Iraq the same
day.

In logic, we consider the sentence True so long as either I dont wear a red shirt,
or the US attacks.

But in normal English conversation, if I were to make this claim, you would think
I was lying.
Why this discrepancy between logic & language?

6
Resolving the Discrepancy

In English, a sentence if p then q usually really implicitly means something like,


In all possible situations, if p then q.
That is, For p to be true and q false is impossible.
Or, I guarantee that no matter what, if p, then q.

This can be expressed in predicate logic as:


For all situations s, if p is true in situation s, then q is also true in
situation s
Formally, we could write: s, P(s) Q(s)

This sentence is logically False in our example, because for me to wear a red shirt
and the U.S. not to attack Iraq is a possible (even if not actual) situation.
Natural language and logic then agree with each other.

English Phrases Meaning p q

Converse, Inverse, Contrapositive

Some terminology, for an implication p q:

Its converse is: q p.


Its inverse is: p q.
Its contrapositive: q p.

7
One of these three has the same meaning (same truth table) as p q. Can you
figure out which?

How do we know for sure?

Proving the equivalence of p q and its contrapositive using truth tables:

p q q p pq q p
F F T T T T
F T F T T T
T F T F F F
T T F F T T

The biconditional operator

The biconditional p q states that p is true if and only if (IFF) q is true.

p = You can take the flight.


q = You buy a ticket.

p q = You can take the flight if and only if you buy a ticket.

The biconditional p q states that p is true if and only if (IFF) q is true.

p = You can take the flight.


q = You buy a ticket.

p q = You can take the flight if and only if you buy a ticket.

Biconditional Truth Table

p q means that p and q have the same truth value.


p q pq
F F T
F T F
T F F
T T T

Note this truth table is the exact opposite of s!


p q means (p q)

8
p q does not imply p and q are true, or cause each other.

Boolean Operations Summary

We have seen 1 unary operator (out of the 4 possible) and 5 binary operators (out
of the 16 possible). Their truth tables are below.

p q p pq pq pq pq pq
F F T F F F T T
F T T F T T T F
T F F F T T F F
T T F T T F T T

Some Alternative Notations

Name: not and or xor implies iff


Propositional logic:
Boolean algebra: p pq +
C/C++/Java (wordwise): ! && || != ==
C/C++/Java (bitwise): ~ & | ^
Logic gates:

Bits and Bit Operations

A bit is a binary (base 2) digit: 0 or 1.

Bits may be used to represent truth values.

By convention: 0 represents false; 1 represents true.

Boolean algebra is like ordinary algebra except that variables stand for bits, +
means or, and multiplication means and.
See chapter 10 for more details.

Bit Strings

A Bit string of length n is an ordered series or sequence of n0 bits.


More on sequences in 3.2.

9
By convention, bit strings are written left to right: e.g. the first bit of
1001101010 is 1.

When a bit string represents a base-2 number, by convention the first bit is the
most significant bit. Ex. 11012=8+4+1=13.

Bitwise Operations

Boolean operations can be extended to operate on bit strings as well as single bits.

E.g.:

01 1011 0110
11 0001 1101

11 1011 1111 Bit-wise OR

01 0001 0100 Bit-wise AND

10 1010 1011 Bit-wise XOR

End of 1.1
You have learned about:
Propositions: What they are.
Propositional logic operators
Symbolic notations.
English equivalents.
Logical meaning.
Truth tables.
Atomic vs. compound propositions.
Alternative notations.
Bits and bit-strings.
Next section: 1.2
Propositional equivalences.
How to prove them.

10

You might also like