SYDE 113 Lecture 4
SYDE 113 Lecture 4
113
Logic
:
Example ① Example ②
prove Pcn) :
j=§J=^% Un -7 Pen ) :¥E ,
(21--1-1) =
n
-
f n =\
1 = n% PCKH) =
J¥j Ga ) -
1) = 12 (2k -
1) =
Cntll
'
I = \% PCKH) FÉ j 1) =
,
+ +
1=1 ¥¥( 2kt ) =
¥-16k 1)- +
(26+1) -
1)
.
Base cage hold, EÉ ! (2k 1)
-
= n 't 2h t 1
- :
Base case holds Patti)=k(kt1)t,2C 7¥ ,
(2k 1)
- =
( na )
2
PCKH )=
k¥3kt2 Pln) pcnti )
• :
PCKH ) =
(k+D{k#
Pckxl ) = (kH)§kt
. :
PCK) P(let 1)
Fundamental of Arithmetic
:
1 the product of
Theorem Every positive integer n
primes unique
-
way
,
is in a
, .
4. 2 Propositional Logic :
•
T :
True
•
F :
False
like denotes
•
Assertions seas are NOT propositions until we
say what
✗
↳
Example of function its Truth value function of
proposition
a as -
is a
x
" "
↳ sacs is a function from # s to truth values
Logical Negation
-
by
7
function denoted Returns opposite truth value
•
:
is the NOT . P TP
7
:{ T ,
F } →
{if } T F
F T
Ex . 77 PEP
AND P&g
^
•
:
logical function denoted by : Returns True if I
only if
both are true .
p q p^q AND 0 I
T T T
↳ CONJUNCTION n :{ T ,
F } ✗ {T ,
F } →
{IF } o o o
T F F
I 0 1
F T F
Multiplication
↳
in modulo 2 .
F F F
(
p is
: one .
↳ DISJUNCTION V :
{5-5}×{5-5} →
{ IF } T T T
T F
T
T
F T
T T F
p q p→q
TT T
① Implies does NOT " "
TF F
mean
suggests
T
FT ② Implies does NOT mean
"
causes
"
FF T
③ statements with implies must ALWAYS have a truth valve
Essentially :
if the antecedent is true & the consequent is false then the statement is false
,
Examptes
① (54--2 ^ 95--4) →
530=5
-
FALSE .
: statement false ( we don't even need to look at the consequent)
✗ OR exclusive
dengbeyd ④ 1-+09
:
.
True is p q
T T F 0
↳ Addition in modulo 2 o 1
T
TF
1 I O
F T T
FF F
→ NOTE :
AND I ✗ OR are ISOMORPHIC to
using
modulo 2 arithmetic on the two classes ⇐
z={G3[o) } under
TRUTH TABLES
}
PÉ£
F T T
T T Gp)vq =p →
E
T F F F F ÷. Gp)vq →
(p→q)
FT T T T
Gp)vqÉÉp→q
FF T T T
Example of
tautology something that always true for choice of values for
pdq
•
, is
any
Cp E) (q→p ) } function from {IF } {T }
'
NOTE :
- = → ^ same →
F
p q ,
→É→p→zq-p
T T T T T T
T F F F T F
F T F T F
F
FF T T T T
NANI
↳ NOT AND : 7 (Png) p q 7 (png )
↳ can be used to build any logical function (building block of boolean functions ) T T F
T F T
F T T
↳ You can build ORs ✗ OR 7 Ntn D Fl F l T
,
using
↳ Ex
. TP
=p NAND p É TP
T T F F
F T T
F
formed formulas in propositional logic is the smallest set closed under operations
•
Note :
WFF is the set of all propositional formulas that can be built from propositional variables (piers . . .
T
,
F
. .
)
.
&
logical operations (7 ,
n v,
,
→
,
<→
)
syntax : WFF are
syntactic objects of symbols constructed by iterative application of the formal rites
strings
•
Example :
The expression
7
Cpvq)Ar is a WFF
Proof :
since p, q , r
E V
,
then : (pvq) is a WFF
n (pug) is a WFF
7
Cpvq)^r is a WFF
4. 6 Iteration of well Formed Formulas Via Recursion
Interpretation of WFF
→
is a
recursive
:
process
I :
WFF →
{IF }
→
Interpretation I :
V= {p.gr .
. . .
} →
{IF }
Éfcpvqjrr) G)
→
Example: Find given Icp )=T ,
I E) = F
,
I =
T
=
→ (TV F) ^ T
= 7
(T) ^ T
=
FAT
=
F
process assigning a -
a .
4. 7 Predicate Logic
→
If ✗ EU , Atx) means ✗ c- A →
AGC) is a
predicate meaning x has
U the property of
being a member of the subset A .
A B
→
Given x EU if ✗ c- A then Abc) is true else AGT is false
, ,
→ If I -4A :
x € A = 7A Gc) = RE A-
summary
{
Acx) AGO KEA
see a
AGO is true →
AH ←→x¢p
A
✗ has
property -
AGO ⇐ ✗ c- A- = UIA
:
formulas elements & make
First order logic
-
}
Given: U =
At
" "
PGD for all there exists such that even & multiple of 3
even
y is not a
✗ is x xis
a
,
y
① (g) is a multipleof 3 whish is FALSE since ✗ =3 is not even
P = all evens
Q all multiples of 3
-
-
{ Gay) y} L
Example Lac , ← C- U ✗ 0
Given
g)
: : x
=
,
Find ltx Fy 7L ( x y) ,
= Vx 3- 7 (x Eg )
y
=
x
3g Cx >
g)
T
=
4- 8 Proof
By Contradiction
→
contradiction is absurd impossible statement
any or
→
that proposition & its must hold
both a
negation
Ex .
assertion
Theorem
infinitely many
:
there
prime # s
are
.
Proof [ contradiction )
by
suppose NOT then :
Primes =
{P ,
,
Pz , Pz . . .
PN )
,
/ Primes / =
N
,
CN is finde)
,
Consider M= (P ,
a Pz ✗
Ps .
. . .
✗ PN ) +1 .
Obviously ,
M >
Pj ,
It Pj E Primes
}
And also -
.
M = I Cmod P, )
M= 1 ( mod Pz ) M NOT divisible by any Mis !
Mears is
prime → .
:
prime
:
pn.me#M--1CmodPn
This is a contradiction since the assumption that
) infinite finite is is 1 Primes 1 is
wrong
are .
4.9 Different Infinities :
Countable & Uncountable
set of
countably infinite correspondence
→
primes
is since we can putit in 1 -
to -
1 with N
countably
a
some sets are .
→
Schroeder Borstein Theorem : For set A &B
any
-
1131£ / Al 11-1--1131
1A I a- IBI and if and
only if
{IF}
"
→
we can write any logical function of n
propositional variables B :
{IF } →
in a
simple way
→
For example ,
consider this function of 3 forth valves
B Cr p g)
/
r p q , ,
T T T F
T T F T
T F T F
T F F F
e , , ,
F T F F
F F T T
F F F T
B Cr g) only true if :
→
p , ,
① r= T , P =
-1 , q=F → ( rn p n -
g)
② r=F F- F T
→
( -
rn -
png )
,
g
=
,
③ r=F F- F F →
C- rn pl g)
q
- -
-
, ,
g)
→
This is called the disjunctive normal form (DNF) of the logical function B
literals (variables
→
DNF : OR of Amps of or their
negation)
B (OR) of liberals
→ DNF of written as disjunction conjunctions LANDS ) of
"
→
we can do this for
any logical function B :
{IF} →
{IF }