Skip to content

Instantly share code, notes, and snippets.

@oldaccountarchived
Created January 10, 2014 19:29
Show Gist options
  • Save oldaccountarchived/8360896 to your computer and use it in GitHub Desktop.
Save oldaccountarchived/8360896 to your computer and use it in GitHub Desktop.

Discrete Mathematics

Propositional Logic (Sec. 1.1 - 1.3)

  • Basic Defintions
  • Equivalence rules & Derivations

What is Prop. Logic?

  • Definition: The logic of compound staements built from simpler statements using boolean connectives.
  • Applications
    • Design of digital circuits
    • Expressing conditions
    • Queries

Definition of a Proposition

  • a statement with a definite meaning, having a truth value (never both, neither or something in between).
  • In probablility theory we assign degrees of certainty to propositions (For now True/False only).

Examples of Propositions

  • It is raining (Given a situation)
  • Beijing is the capital of China (depends on the history)
  • “1 + 2 = 5”

Given any instance we can decide if it’s true or false.

THE FOLLOWING ARE NOT PROPOSITIONS:

  • “Who’s there?” (interog)

More on keynote.

Boolean operators

  • Negation (NOT)
  • Cunjunction (AND)
  • Disjunction (OR)
  • Exclusive-Or (XOR)
  • Implication (IF)
  • Bi-conditional (IFF)

Operators/Connectives

  • An operator or connective combines one or more operand expressions into a larger expression. (e.g., “+” in numeric exprs.)
  • Unary operators take one operator (-3) Binary take two (2 + 4)
  • More in keynote.

Truth Tables

  • The unary negation operator “-|” (NOT) transforms a prop. into it’s logical negation.

Conjunction Truth Table (AND)

If p^q we have 3 col. and 4 rows.

pqp^q
FFF
FTF
TFF
TTT

2^2 for p^q

for p^q^r we would have 2^3 or 8 rows.

Disjuction Truth Table (OR (Non Exclusive))

pqpvq
FFF
FTT
TFT
TTT

Exclusive OR Truth Table

Symbol (+)

pqp(XOR)q
FFF
FTT
TFT
TTF

ASSUME “OR” MEANS INCLUSIVE

Implication Operator

  • p -> q states p implies q
  • It is false only in the case that p is TRUE but q is False.

e.g p = “I am elected” q = “Taxes will be lowered”

Terminology p: Hypothesis q: Conclusion

pqp -> q
FFT
FTT
TFF
TTT

0 = 1 -> “Pigs will fly”

  • Inverse of p -> q is: (NOT)p -> (NOT)q
  • Converse of p -> q is: q -> p
  • The contropositive of p -> q: is (NOT)q -> (NOT)p

For any p -> q the contrapositive is also true.

pqnot pnot qp -> qnot q -> not p
FFTTTT
FTFTTT
TFTFFF
TTFFTT

Biconditional Operator

  • The biconditional p <-> q states p is true if and only if (IFF) q is true.
  • p <-> q is true if the two have the same truth values.
pqp<->q
FFT
FTF
TFF
TTT

Precedence of Logical Operators

OperatorPrecedence
NOT1
AND2
OR3
IF4
IFF5

Nested propositional expressions

  • “I just saw my old friend, and either he’s grown or I’ve shrunk.” f ^ (g v s)
  • f ^ g v s - “I just saw my old friend he has grown or I have shrunk.”

NOT takes precedence over both “^” and “v” NOT s ^ f is like (NOT s) ^ f.

Alternative Notations

namenotandorxorimpliesiff
Propositional-^v(plus)-><->
Boolean Algebrapbarpq+(plus)
MORE IN SLIDE

Bits and Bit Operations

  • A bit is a binary base 2 digit
  • May be used to display truth values

01 1011 0110 11 0001 1101


11 1011 1111 - Bitwise OR 01 0001 0100 - Bitwise AND 10 1010 1011 - Bitwise XOR

Propositional Equivalence

Two syntactically different propositions could be semantically identical we call them equivilent.

TERMS

Tautology - a compound proposition that is true no matter what the truth values of its atomic propositions are.

Ex. p or NOT p

pNOT pp v NOT p
TFT
FTT

Contridiction is a comp.prop that is false no matter what!

Ex. p ^ NOT p

pNOT Pp ^ NOT P
TFF
FTF

Proving Equivalences

Compound propositions P and ! are logically equivalent to each other IFF P and Q contain the same truth values as each other in all rows of their truth tables.

Compound proposition P is logically equivalent to the compound proposition Q, written P <=> Q, IFF the compound proposition P <-> is a tautology.

Proving Equivalences using a Truth Table

pqpvqNOT pNOT qNOT p ^ NOT qNOT(NOT p ^ NOT q)
FFFTTTF
FTTTFFT
TFTFTFT
TTTFFFT

Equivalence Laws - Examples

Identity

p^T <=> p pvF <=> p

Domination

pvT <=> T p^F <=> F

Idempotent

pvp <=> p p^p <=> p

Double negation

NOT NOT p <=> p

Communitative

pvq <=> qvp p^q <=> q^p

Associative

(pvq)vr <=> pv(qvr) (p^q)^r <=> p^(q^r)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment