CPS 220 Theory of Computation REGULAR LANGUAGES. Regular expressions



Similar documents
Question 3: How do you find the relative extrema of a function?

New Basis Functions. Section 8. Complex Fourier Series

Lecture 3: Diffusion: Fick s first law

5 2 index. e e. Prime numbers. Prime factors and factor trees. Powers. worked example 10. base. power

The example is taken from Sect. 1.2 of Vol. 1 of the CPN book.

5.4 Exponential Functions: Differentiation and Integration TOOTLIFTST:

Lecture 20: Emitter Follower and Differential Amplifiers

Econ 371: Answer Key for Problem Set 1 (Chapter 12-13)

Factorials! Stirling s formula

A Note on Approximating. the Normal Distribution Function

Adverse Selection and Moral Hazard in a Model With 2 States of the World

Category 7: Employee Commuting

In the previous two chapters, we clarified what it means for a problem to be decidable or undecidable.

ME 612 Metal Forming and Theory of Plasticity. 6. Strain

Traffic Flow Analysis (2)

SPECIAL VOWEL SOUNDS

QUANTITATIVE METHODS CLASSES WEEK SEVEN

by John Donald, Lecturer, School of Accounting, Economics and Finance, Deakin University, Australia

Mathematics. Mathematics 3. hsn.uk.net. Higher HSN23000

Repulsive Force

Basis risk. When speaking about forward or futures contracts, basis risk is the market

CPU. Rasterization. Per Vertex Operations & Primitive Assembly. Polynomial Evaluator. Frame Buffer. Per Fragment. Display List.

Sharp bounds for Sándor mean in terms of arithmetic, geometric and harmonic means

Cloud and Big Data Summer School, Stockholm, Aug., 2015 Jeffrey D. Ullman

Regular Languages and Finite State Machines

(Analytic Formula for the European Normal Black Scholes Formula)

Version 1.0. General Certificate of Education (A-level) January Mathematics MPC3. (Specification 6360) Pure Core 3. Final.

Constraint-Based Analysis of Gene Deletion in a Metabolic Network

Fundamentals: NATURE OF HEAT, TEMPERATURE, AND ENERGY

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

CHAPTER 4c. ROOTS OF EQUATIONS

Who uses our services? We have a growing customer base. with institutions all around the globe.

CIRCUITS AND ELECTRONICS. Basic Circuit Analysis Method (KVL and KCL method)

A Project Management framework for Software Implementation Planning and Management

Projections - 3D Viewing. Overview Lecture 4. Projection - 3D viewing. Projections. Projections Parallel Perspective

Architecture of the proposed standard

Foreign Exchange Markets and Exchange Rates

Budget Optimization in Search-Based Advertising Auctions

AP Calculus AB 2008 Scoring Guidelines

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Use a high-level conceptual data model (ER Model). Identify objects of interest (entities) and relationships between these objects

MAXIMAL CHAINS IN THE TURING DEGREES

GOAL SETTING AND PERSONAL MISSION STATEMENT

Fundamentals of Tensor Analysis

Rent, Lease or Buy: Randomized Algorithms for Multislope Ski Rental

Hardware Modules of the RSA Algorithm

Remember you can apply online. It s quick and easy. Go to Title. Forename(s) Surname. Sex. Male Date of birth D

Section 7.4: Exponential Growth and Decay

Introduction to Finite Element Modeling

Regular Expressions and Automata using Haskell

C H A P T E R 1 Writing Reports with SAS

Job shop scheduling with unit processing times

Authenticated Encryption. Jeremy, Paul, Ken, and Mike

Expert-Mediated Search

Parallel and Distributed Programming. Performance Metrics

SOFTWARE ENGINEERING AND APPLIED CRYPTOGRAPHY IN CLOUD COMPUTING AND BIG DATA

Quantum Graphs I. Some Basic Structures

Performance Evaluation

Lecture notes: 160B revised 9/28/06 Lecture 1: Exchange Rates and the Foreign Exchange Market FT chapter 13

Fetch. Decode. Execute. Memory. PC update

FACULTY SALARIES FALL NKU CUPA Data Compared To Published National Data

Genetic programming with regular expressions

erkeley / uc berkeley extension Be YoUR Best / be est with berkeley / uc berkeley With BerkELEY exten xtension / be your best with berkele

Intermediate Macroeconomic Theory / Macroeconomic Analysis (ECON 3560/5040) Final Exam (Answers)

Logo Design/Development 1-on-1

SPREAD OPTION VALUATION AND THE FAST FOURIER TRANSFORM

est with berkeley / uc berkeley exte xtension / be your best with berkel

Compiler Construction

Using SAS s PROC GPLOT to plot data and lines

A Graph-based Proactive Fault Identification Approach in Computer Networks

AC Circuits Three-Phase Circuits

ESA Support to ESTB Users

Incomplete 2-Port Vector Network Analyzer Calibration Methods

Chapter 10 Function of a Matrix

ICES REPORT January The Institute for Computational Engineering and Sciences The University of Texas at Austin Austin, Texas 78712

Finite Dimensional Vector Spaces.

A Theoretical Model of Public Response to the Homeland Security Advisory System

E X C H A N G E R U L E S A N D C L E A R I N G R U L E S O F N A S D A Q O M X D E R I V A T I V E S M A R K E T S

Free ACA SOLUTION (IRS 1094&1095 Reporting)

Converting Finite Automata to Regular Expressions

Scanner. tokens scanner parser IR. source code. errors

Financial Mathematics

Problem Set 6 Solutions

Enforcing Fine-grained Authorization Policies for Java Mobile Agents

Whole Systems Approach to CO 2 Capture, Transport and Storage

CS5236 Advanced Automata Theory

Rural and Remote Broadband Access: Issues and Solutions in Australia

Important Information Call Through... 8 Internet Telephony... 6 two PBX systems Internet Calls... 3 Internet Telephony... 2

Precise Memory Leak Detection for Java Software Using Container Profiling

Finite Automata. Reading: Chapter 2

Entity-Relationship Model

New Concepts and Methods in Information Aggregation

union scholars program APPLICATION DEADLINE: FEBRUARY 28 YOU CAN CHANGE THE WORLD... AND EARN MONEY FOR COLLEGE AT THE SAME TIME!

The Halting Problem is Undecidable

Current and Resistance

Higher. Exponentials and Logarithms 160

Asset set Liability Management for

Why An Event App... Before You Start... Try A Few Apps... Event Management Features... Generate Revenue... Vendors & Questions to Ask...

STATEMENT OF INSOLVENCY PRACTICE 3.2

June Enprise Rent. Enprise Author: Document Version: Product: Product Version: SAP Version:

Transcription:

CPS 22 Thory of Computation REGULAR LANGUAGES Rgular xprssions Lik mathmatical xprssion (5+3) * 4. Rgular xprssion ar built using rgular oprations. (By th way, rgular xprssions show up in various languags: Prl, Java, Python, tc - grat for pattrn matching oprations). Exampls: a * b ( ) * = (+)* Dfinition. R is a rgular xprssion, if R is on of th following:. ε 2. a, for som a Σ 3. 4. (R R 2 ), whr R and R 2 ar rgular xprssions 5. R R 2, whr R and R 2 ar rgular xprssions 6. (R ) *, whr R is a rgular xprssion Not: it is a inductiv dfinition - it is dfind basd on itslf. Not: th + symbol will at tims b usd for union (+)* R R + + = RR! " = * R L((+)*(+)*) = {w w contains a in th middl} (Not: othr rgular xprssion xampls on p.65)

Equivalnc of Rgular Exprssions and Finit Automata Thorm. A languag is rgular if and only if som rgular xprssion dscribs it. W nd to prov two dirctions:. If a languag is dscribd by a rgular xprssion, thn it is rgular. 2. If a languag is rgular, thn thr is a rgular xprssion that dscribs it. Part. This is th asy part - "If a languag is dscribd by a rgular xprssion, thn it is rgular." Say that a rgular xprssion R dscribs som languag A. W will convrt R to an NFA N that rcognizs A. Thn, A has to b rgular. R has on of six possibl forms:. R = ε. Thn, 2. R = a, for som a Σ. Thn, a 3. R =. Thn, 4. R = R R 2. 5. R = R R 2. 6. R = (R ) * In th last thr cass, th constructions givn in th proofs that th class of rgular languags ar closd undr th rgular oprations can b usd hr as wll. That is, w assum R and R 2 ar rcognizd by NFAs N and N 2, and us th sam constructions to crat N from N and N 2. Convrt th following rgular xprssion to a NFA: (+)*(+)*

Not: using th lttr "" to rprsnt ε Not: For th abov rsulting NFA - major limination of stats and transistion can tak plac. Doubl 's can b rippd out. What ls can b liminatd? Part 2: W nd to show that if a languag is rgular, thn it is dscribd by a rgular xprssion. "If a languag is rgular, thn thr is a rgular xprssion that dscribs it." If a languag A is rgular, thn it is rcognizd by a DFA M. W will show how to convrt an arbitrary DFA M into an quivalnt rgular xprssion. Th main ida is that w will gradually liminat th stats of M. Stratgy: DFA --> GNFA --> rgular xprssions GNFA - gnralizd nondtrministic finit automaton Dfinition (informal dtails in th book). A GNFA is a Finit Automaton, xcpt:. Thr is only on start stat, on final stat, and th two ar distinct. 2. Th start stat has arrows going to vry othr stat. 3. Thr ar no arrows going to th start stat. 4. Th final stat has arrows coming from vry othr stat. 5. Thr ar no arrows laving th final stat. 6. Evry stat (xcpt start & final) has arrows going to vry othr stat. 7. Th labls of th arrows ar rgular xprssions.

To convrt a DFA into a GNFA:. Crat a nw start stat, with ε-transitions to th prvious start stat and -transitions to all othr stats. 2. Crat a nw final stat, with ε-transitions from th prvious final stat and - transitions from all othr stats. 3. Add -transitions from vry stat to vry stat (othr than start & final). Exampl: (Not: a vn mor profound xampl would b a DFA with multipl accpt stats) Th rsulting GNFA always has 2 stats. (It actually always has 3 stats, but now w will start rmoving stats until it has xactly 2 stats.) To convrt from GNFA to RE: W will rmov stats incrmntally, and at th sam tim build up a rgular xprssion. Whnvr th GNFA has 2 stats, w liminat a stat as follows: Th stat q blow is any stat othr than th (uniqu) start and (uniqu) final stats. That stat q, has possibly a numbr of transitions to it, including a slf-transition, and a numbr of transitions from it. q

For vry pair of stats p and r (including start & final), q is btwn p and r: p always has a transition to q, and r always has a transition from q. W rmov q, and in its plac put a rgular xprssion dscribing how to gt from p to r through q: R2 p R q R3 r p RR2*R3 r Th abov 2 GNFA sgmnts ar quivalnt. This ida of quivalncy mans: to gt from p to r, ithr gt through th arrow from p to r, or gt through th old q-path, in which cas you nd to go through th old p-to-q transition, thn possibly loop in q an arbitrary numbr of tims, and thn go through th old q-to-r path. Continu this procss of liminating stats, until w ar lft with just th start and final stats. Thn, E is th rgular xprssion w nd! E will accpt xactly th strings that th old DFA was accpting. Multipl dgs can b rmovd: a+b a a b b a+b Practic.. Find a DFA accpting th languag + ( + )*

Stp. Find NFA 4 3 2 Stp2. Transform NFA to DFA Q $ " Q # = { q} Q Q = { q2} = { q, q4} = { q3} { q2} { q2} { q3}! { q, q4} { q3} { q2}! 2,,4 2 3, 2. Find th rgular xprssion accptd by this NFA.

, 5 2 3 4 Answr: (+)*(+)+ = (+)* Simplifying formulas for REs (prov thm as an xrcis!): Not: E rprsnts th alphabt. + E = E εe = Eε = E E = E = (E * ) * = E * * = ε ε * = ε E + E = E E(F + G) = EF + EG (F + G)E = FE + GE Th UNIX-styl + -oprator, matchs a string onc or mor tims (not zro tims). W could dfin it hr as E + = EE * = E * E. Thn, chck as an xrcis that E * = E + ε. Rfrncs: Introduction to th Thory of Computation (2nd d.) Michal Sipsr Problm Solving in Automata, Languags, and Complxity Ding-Zhu Du and Kr-I Ko