Anda di halaman 1dari 2

# Example CFGs from past PSETs and

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

## Example CFGs from past

PSETs and Exams:
Palindrome with abba:
o S ->
abbaTabba |
aSa | bSb |
abbabba |
abba

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

## Injective function: a A. a A. (f(a) = f(a) a = a)

Surjective function: b B. a A. f(a) = b
Bijective function: Injective and surjective

## Equivalence relation = reflexive,

symmetric, and transitive
Equivalence class = [x]R={yA|
xRy}=allelementsinArelatedtoxbyR
EachelementinAbelongstoexactlyone
equivalenceclassunderR
Language of an automaton D:
(D) = { w * | D accepts w }
DFA: exactly one transition defined
for each symbol for each state
Regular language: if there exists
a DFA D such that (D) = L.
Theorem: If L and L are regular
languages over an alphabet , then so
are the following languages: L, L
L, L L, LL, L*

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

## The Subset Construction

This construction for transforming an NFA into a DFA is called the subset
construction (or sometimes the powerset construction).
States of the new DFA correspond to sets of states of the NFA.
The initial state is the start state, plus all states reachable from the start
state via -transitions.
Transition on state S on character a is found by following all possible
transitions on a for each state in S, then taking the set of states reachable
from there by -transitions.
Accepting states are any set of states where some state in the set is an
Regexes: () = {}, () = ,
Shorthands:
RnisshorthandforRRR(ntimes),edgecase:
(a) = {a}
defineR0=.
(R1R2) = (R1) (R2)

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
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
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.