Attribution Non-Commercial (BY-NC)

673 views

Attribution Non-Commercial (BY-NC)

- math formulas
- CS8391 DATA STRUCTURES.docx
- Lab Manual - Ds
- Graph
- Algorithm(TB)
- IMO2008SL
- lec30_2003
- ch4
- Chapter 4
- CATA2017-HenriqueRaiaPlentz
- Payroll
- Philips Placement Papers 1305641447
- Dynamic Dictionaries
- Datastructures& Algorithms QA
- 02b RunningTime (Optional)
- Mathematical Induction
- Coms w3134 Midterm Review
- Play With Trees
- m1 unit5 sati protected
- B. Review of Proofs

You are on page 1of 5

X (e.g., integers, trees) in two parts:

X directly.

than" X ; prove S (X ) using that assumption.

Example

A binary tree with n leaves has 2n , 1 nodes.

Formally, S (T ): if T is a binary tree with n

leaves, then T has 2n , 1 nodes.

Induction is on the size = number of nodes of

T.

2 1 , 1 so OK.

Induction : Assume S (U ) for trees with fewer

nodes than T . In particular, assume for the

subtrees of T .

T must be a root plus two subtrees U and V .

If U and V have u and v leaves, respectively,

and T has t leaves, then u + v = t.

By the inductive hypothesis, U and V have

2u , 1 and 2v , 1 nodes, respectively.

Then T has 1 + (2u , 1) + (2v , 1) nodes.

✦ = 2(u + v) , 1.

✦ = 2t , 1, proving the inductive step.

If-And-Only-If Proofs

Often, a statement we need to prove is of the form

\X if and only if Y ." We are then required to do

two things:

1. Prove the if-part : Assume Y and prove X .

2. Prove the only-if-part : Assume X , prove Y .

Remember:

The if and only-if parts are converses of each

other.

One part, say \if X then Y ," says nothing

about whether Y is true when X is false.

An equivalent form to \if X then Y " is \if not

Y then not X "; the latter is the contrapositive

of the former.

1

Equivalence of Sets

Many important facts in language theory are of

the form that two sets of strings, described in two

dierent ways, are really the same set. To prove

sets S and T are the same, prove:

x is in S if and only if x is in T . That is:

✦ Assume x is in S ; prove x is in T .

✦ Assume x is in T ; prove x is in S .

Here are two ways that we can dene \balanced

parentheses":

1. Grammatically :

a) The empty string is balanced.

b) If w is balanced, then (w) is balanced.

c) If w and x are balanced, then so is wx.

2. By Scanning : w is balanced if and only if:

a) w has an equal number of left and right

parentheses.

b) Every prex of w has at least as many

left as right parentheses.

Call these GB and SB properties, respectively.

Theorem: a string of parentheses w is GB if

and only if it is SB.

If

An induction on jwj (length of w). Assume w is

SB; prove it is GB.

Basis : If w = (length = 0), then w is GB by rule

(a).

Notice that we do not even have to address

the question of whether is SB (it is,

however).

Induction : Suppose the statement \SB implies

GB" is true for strings shorter than w.

1. Case 1: w is not , but has no nonempty

prex that has an equal number of ( and ).

Then w must begin with ( and end with ); i.e.,

w = (x).

✦ x must be SB (why?).

✦ By the IH, x is GB.

✦ By rule (b), (x) is GB; but (x) = w, so w

is GB.

2

2. Case 2: w = xy, where x is the shortest,

nonempty prex of w with an equal number

of ( and ), and y 6= .

✦ x and y are both SB (why)?

✦ By the IH, x and y are GB.

✦ w is GB by rule (c).

Only-If

An induction on jwj. Assume w is GB; prove it is

SB.

Basis : w = . Clearly w obeys the conditions for

being SB.

Induction : Assume \GB implies SB" for strings

shorter than w, and assume w 6= .

1. Case 1: w is GB because of rule (b); i.e., w =

(x) and x is GB.

✦ by the IH, x is SB.

✦ Since x has equal numbers of ('s and )'s,

so does (x).

✦ Since x has no prex with more ('s than

)'s, so does (x).

2. Case 2: w is not and is GB because of rule

(c); i.e., w = xy, and x and y are GB.

✦ By the IH, x and y are SB.

✦ (Aside) Trickier than it looks: we have

to argue that neither x nor y could be ,

because if one were, the other would be

w, and this rule application could not be

the one that rst shows w to be GB.

✦ xy has equal numbers of ('s and )'s

because x and y both do.

✦ If w had a prex with more )'s than ('s,

that prex would either be a prex of

x (contradicting the fact that x has no

such prex) or it would be x followed by

a prex of y (contradicting the fact that y

also has no such prex).

✦ (Aside) Above is an example of proof by

contradiction. We assumed our conclusion

about w was false and showed it would

imply something that we know is false.

3

Languages

Alphabet = nite set of symbols, e.g., f0; 1g

(binary alphabet) or ASCII.

String = nite sequence of symbols

chosen from some alphabet, e.g., 01101 or

abracadabra.

Language = set of strings chosen from some

alphabet.

✦ Subtle point: the language may be

innite, but there is some nite set

of symbols of which all its strings are

composed.

Example; Languages

The set of all binary strings consisting of some

number of 0's followed by an equal number of

1's; that is, f; 01; 0011; 000111; : : :g.

C (the set of compilable C programs).

English.

Finite Automata

An important way to describe certain simple, but

highly useful languages called \regular languages."

A graph with a nite number of nodes, called

states.

Arcs are labeled with one or more symbols

from some alphabet.

One state is designated the start state or

initial state.

Some states are nal states or accepting states.

The language of the FA is the set of strings

that label paths that go from the start state

to some accepting state.

Example

Below FA scans HTML documents, looking

for a list of what could be title-author pairs,

perhaps in a reading list for some literature

course.

It accepts whenever it nds the end of a list

item.

4

In an application, the strings that matched

the title (before ' by ') and author (after)

would be stored in a table of title-author pairs

being accumulated.

any non-tag

Start < OL>, <UL> < LI>

1 2 3

space

4

b

<LI> 5

y

6

space

9 8 7

</OL>, </UL> < /LI>

any non-tag

- math formulasUploaded byapi-442249468
- CS8391 DATA STRUCTURES.docxUploaded byabinaya
- Lab Manual - DsUploaded byMithun Aremmal
- GraphUploaded bySia Sharma
- Algorithm(TB)Uploaded byRachit Khandelwal
- IMO2008SLUploaded byHimansu Mookherjee
- lec30_2003Uploaded bycass
- ch4Uploaded byLimitless Bonois
- Chapter 4Uploaded byShimeque Smith
- CATA2017-HenriqueRaiaPlentzUploaded byAllan Renato Sabino
- PayrollUploaded byssvallabhaneni
- Philips Placement Papers 1305641447Uploaded byPrateek Prabhash
- Dynamic DictionariesUploaded bymanishbhardwaj8131
- Datastructures& Algorithms QAUploaded byRajesh Paul
- 02b RunningTime (Optional)Uploaded byfrankjamison
- Mathematical InductionUploaded byrickyspaceguy
- Coms w3134 Midterm ReviewUploaded bysgtb3
- Play With TreesUploaded byLippyHeart
- m1 unit5 sati protectedUploaded byapi-286106888
- B. Review of ProofsUploaded bydjunker
- Automated Induction for Complex Data StructuresUploaded byflorentj
- Cheat Sheet CsaUploaded byNguyen David
- Cse373 12wi Midterm1.KeyUploaded byRitu Phogat
- Non ClassicUploaded bySerge Garin
- Induccion MatematicaUploaded byJosé Luis Guevara Rodríguez
- Elite Study MaterialUploaded bylijo
- CS---302.pdfUploaded byMaz Har Ul
- Chapter17.pptxUploaded byBicycle Thief
- CSN261_pptUploaded byLeshna Balara
- DS-NOTES.docxUploaded bySajina Paulose

- Slides 15Uploaded byatul
- Slides 16Uploaded byashutoshfriends
- Slides 14Uploaded byatul
- Slides 13Uploaded byashutoshfriends
- filelanguage and automata 12Uploaded byashutoshfriends
- filelanguage and automata 11Uploaded byashutoshfriends
- filelanguage and automata10Uploaded byashutoshfriends
- filelanguage and automata 9Uploaded byashutoshfriends
- filelanguage and automata 8Uploaded byashutoshfriends
- filelanguage and automata 7Uploaded byashutoshfriends
- filelanguage and automata 6Uploaded byashutoshfriends
- filelanguage and automata 5Uploaded byashutoshfriends
- filelanguage and automata 4Uploaded byashutoshfriends
- filelanguage and automata 3Uploaded byashutoshfriends
- filelanguage and automataUploaded byashutoshfriends

- Recursion Practice Problems c++Uploaded byarjunvenugopalachary
- Tonnetz Grid PaperUploaded byAndrew Robbie
- Fermat's Factorization MethodUploaded bycatalinatorre
- exam2-sol(1)Uploaded byAdilson Khouri
- worksheet 3.docxUploaded byMharaToot
- Floorplaning_L28_29Uploaded byNeha Pachauri
- 09Decoding Block CodesUploaded byMuhammad Reza Aditya
- Chapter 4 Intro to Coding TheoryUploaded bytrevorsum123
- 42 Directed GraphsUploaded byRavi Sankar
- Analysis of Algorithms.docxUploaded byDanish Hussain
- Set3Uploaded byyogitha2792
- Prim Pol 1Uploaded bysidhushelly
- dfsFinalsUploaded byMohammad Usman
- vendorsUploaded bychummatest321
- hackathon_ suridUploaded bySamin Afnan
- Graph TheoryUploaded byRanjith M Kumar
- On NP Complete Problems IUploaded byhumejias
- Question Bank - i to v- Part a and Part B-1Uploaded byJose Clark
- GATEOverflow Book.pdfUploaded byAd Ri Ta
- Huffman CodingUploaded byUmar Naeem
- Formal Lang and Automation TheoryUploaded byShivank Agarwal
- Coco 4Uploaded byBarun Bansal
- zbus1Uploaded bydivya1587
- Chemistry NotesUploaded byJessicaBleach
- Block CodesUploaded byvip_temaa
- soln to comp netowrksUploaded byAnandi Venougopal
- My-Hill Nerode TheoremUploaded bymaddhuri_anusha
- reed-solomonUploaded byHerdawati Tiansin
- L9 - Analysis of AlgorithmsUploaded bymurad
- Number Theory DarrangUploaded byRichard Good

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.