673 views

Uploaded by atul

- Neo4j for all
- Bifocal Display
- Getting Started With People Soft Query
- Experiement No 5
- avl
- iterlevel2
- Augmented Data Structure
- research article
- Testing in C
- The Ring programming language version 1.3 book - Part 27 of 88
- Sh Neiderman 2011 Innovation
- Basic Tutorial 4_2D Analysis of Stage Contructed Embankment
- Tree Doc
- DB Driven Vertical Menu
- Superimposition- A Language-Independent Approach to Software Composition
- try
- Colloquium Presentation
- Parse Trees
- Chapter 3 Pages 57-85
- MELJUN_CORTES_JEDI Slides Data Structures Chapter00 Introduction

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

- Neo4j for allUploaded byMrinny
- Bifocal DisplayUploaded byno theenks
- Getting Started With People Soft QueryUploaded bySiji Surendran
- Experiement No 5Uploaded byAnand Sonawane
- avlUploaded byRirin Hutagalung
- iterlevel2Uploaded byakg299
- Augmented Data StructureUploaded bySirc Ann Ares
- research articleUploaded byAzhar Ali Zafar
- Testing in CUploaded byTommy Lee
- The Ring programming language version 1.3 book - Part 27 of 88Uploaded byMahmoud Samir Fayed
- Sh Neiderman 2011 InnovationUploaded byRichard Sapienza
- Basic Tutorial 4_2D Analysis of Stage Contructed EmbankmentUploaded byPiotr Zieliński
- Tree DocUploaded byawadhesh.kumar
- DB Driven Vertical MenuUploaded byVikram Kohli
- Superimposition- A Language-Independent Approach to Software CompositionUploaded byGeorge
- tryUploaded byEdgardo Ricardo Bajan
- Colloquium PresentationUploaded byAnkit Gupta
- Parse TreesUploaded byRaj Singh
- Chapter 3 Pages 57-85Uploaded bymanny oluan
- MELJUN_CORTES_JEDI Slides Data Structures Chapter00 IntroductionUploaded byMELJUN CORTES, MBA,MPA
- CC6052 Lecture Wk04 Decisions 2012Uploaded byguineapi9
- NVivo9 an Introductory CourseUploaded bysuper_betty
- iterlevelUploaded byakg299
- riga-treUploaded byaravindmc
- Class2Uploaded byFernando Cahueñas
- ps3solUploaded byJayesh Gorasia
- 08-splayUploaded byPavithraRam
- access controllUploaded bymilosvbl
- Avl Trees ReportUploaded byAnshu Mittal
- DtsUploaded byHarsha Vardhan

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

- MATLAB-Manual Rtw GsUploaded byTanNguyễn
- Review of SQL SELECT Statements_l1Uploaded byradebap
- Security Compliance Objects Using UML SysMLUploaded byEitaglobal EG
- Marcus T. Anthony- Book Review of Allan Combs’ Consciousness Explained BetterUploaded byAuLaitRS
- PCM600_EjemploUploaded byCarlos Joan Camarena
- Separating Fact From Fiction in the IoniUploaded byKoray Konuk
- FFT in MatlabUploaded byrettyraja
- Comm Plan_CommentsUploaded byAve Mejia
- KSRSD-ISD Annual Report 2016-17Uploaded byRema Saraswathy
- Chinese HoroscopeUploaded byKarl Jacobs
- REDCap_Guide to REDCap Exported FilesUploaded byits4krishna3776
- RYieldUploaded bySachi Desai
- Thermo Fisher to Acquire Life Technologies IR PresentationUploaded byTariq Motiwala
- Dessertation EditUploaded byKapil Singh
- Putts Minus GreensUploaded byMark Hachey
- Guidelines for Ultrasonic InspectionUploaded byloukas_p
- January Sunrise Drive Testing LetterUploaded byMizuzPens
- The Statistical Probability of Love at First SightUploaded byJennica Gyrl G. Delfin
- EVSUploaded bySock Rex
- Capabilities Marine RisersUploaded bymesserklinge
- Communicative competence and communicative language teachingUploaded byX-fans Glazov
- LM hiwinUploaded byRaja Shankar Jeeva
- Database ScriptsUploaded bygmasay
- Introduction to Earned Value Management 2018Uploaded byPrakhar Kaushik Tyagi
- ICDFUploaded byTony Bani
- 94523.pdfUploaded by0917802400
- Sartre, Skinner and AuthenticityUploaded byCorodeanu Carmen Paunica
- ART 2000 2100 Flyer [Search Manual Online.com]Uploaded byMarcus Drago
- IRB460Uploaded byLucas Vinícius Costa
- Review of Indian StandardsUploaded bymaddy_scribd