Professional Documents
Culture Documents
CS103 Cheat Sheet
CS103 Cheat Sheet
Exams:
Multiadd: S -> = | 1S1 | +S | S+
Balanced parentheses: S -> (S)S |
e
Balanced even parentheses:
o E -> e | (E)O | (O)E
o O -> (E)E | (O)O
Generalized pigeonhole
principle: n objects distributed
amongst k containers means that
each contain must contain at least
BINARY RELATIONS
Examples:
HALT in RE
LOOP not
in RE
ATM in RE
LD not in RE
Reflexivity: a A. aRa
Symmetry: a A. b A. (aRb
bRa)
Transitivity:a A. b A. c A.
(aRb bRc aRc)
Antisymmetry: a A. b A. (a
b aRb (bRa)) or a A. b
A. (aRb bRa a = b)
Partial order = reflexive,
antisymmetric, and transitive =
captures prerequisite structures,
something needs to be before
something else
NFA: 3 models:
Tree computation
Perfect guessing
Massive parallelism
If the machine is in an accepting
state at the end of any possible
route, it accepts the input
isshorthandforanycharacterin.
(R1 | R2) = (R1) (R2)
R?isshorthandfor(R|),meaningzeroorone
(R*) = (R)*
copiesofR.
((R)) = (R)
RisshorthandforRR*,meaningoneormore
copiesofR.
Recognizablelanguage=RE=LisinREif
thereexistssomeTuringMachineMsuch
that(M) = L
Decidable language = R = L is in
R if there exists some Turing
Machine M such that (M) = L
U = Universal Turing Machine
{(M,w)|M is a TM that accepts w} =
{(M,w)|M is a TM and w is in the
language of M}
(U) = A = undecidable, but
recognizable
Verifier=Visaverifierifitisadecider,
andforanystringwin*, if w is in L
there is some certificate c for w
such that V accepts (w,c). For
strings not in L, V either rejects or
loops infinitely. Notice (V) != L,
since V only checks certificates.
Polynomialtimereductions:f:* *,
so that for all w in *, if w is in A
then f(w) is in B, where A and B are
languages. So every w in A maps to
some f(w) in B, and every w not in A
maps to some f(w) not in B. We
write A \leq_p B.
Theorems:
If A \leq_p B, and B \in P, A \in
P
If A \leq_p B, and B \in NP, A
\in NP
If A \leq_p B, and A \in NPhard, B \in NP-hard
If A \leq_p B, and A in NPC
and B \in NP, B \in NPC
CobhamEdmondsefficientlycomputable
iffdecidableinpolynomialtime
ChurchTuringTM=computation
P=decidableinpolynomialtimebyDTM
NP=decidableinpolynomialtimebyNTM
or(eqv.)yesanswerscanbeverifiedin
polynomialtimebyDTM
MyhillNerodeTheorem:LetLbea
languageover.IfthereisasetS*
withthefollowingtwoproperties,then
Lisnotregular:
Sisinfinite(i.e.itcontains
infinitelymanystrings).
Ifx,ySandxy,thenxLy
Distinguishabilitytheorem:LetLbea
languageover.Letx*andy*be
stringswherexLy.ThenifDisany
DFAforL,thenDmustendindifferent
stateswhenrunoninputsxandy.