CS 361 Meeting 8 9/24/18

Similar documents
λ-harmonious Graph Colouring Lauren DeDieu

MAPPING THE DATA FLOW MODEL OF COMPUTATION INTO AN ENHANCED VON NEUMANN PROCESSOR * Peter M. Maurer

Trees. Linear vs. Branching CSE 143. Branching Structures in CS. What s in a Node? A Tree. [Chapter 10]

Geometry. The Method of the Center of Mass (mass points): Solving problems using the Law of Lever (mass points). Menelaus theorem. Pappus theorem.

Defining and Surveying Wireless Link Virtualization and Wireless Network Virtualization

The Internal Conflict of a Belief Function

Smarter Balanced Assessment Consortium Claims, Targets, and Standard Alignment for Math

Clustering. Cluster Analysis of Microarray Data. Microarray Data for Clustering. Data for Clustering

Privacy-preserving String-Matching With PRAM Algorithms

Mapping Data in Peer-to-Peer Systems: Semantics and Algorithmic Issues

Verifying the structure and behavior in UML/OCL models using satisfiability solvers

Gromov-Hausdorff Distance Between Metric Graphs

Heterogeneous Radial Basis Function Networks

Vodafone MachineLink. Port Forwarding / DMZ Configuration Guide

Weeks 1 3 Weeks 4 6 Unit/Topic Number and Operations in Base 10

Detection of Outliers and Reduction of their Undesirable Effects for Improving the Accuracy of K-means Clustering Algorithm

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Prove Theorems about Lines and Angles

14.1 Encoding for different models of computation

Theoretical Analysis of Local Search and Simple Evolutionary Algorithms for the Generalized Travelling Salesperson Problem

Analysing Real-Time Communications: Controller Area Network (CAN) *

Computer Aided Drafting, Design and Manufacturing Volume 26, Number 2, June 2016, Page 13

Modeling Parallel Applications Performance on Heterogeneous Systems

Fair Resource Allocation for Heterogeneous Tasks

6.1 Topological relations between two simple geometric objects

The Unit Bar Visibility Number of a Graph

International Journal of Scientific & Engineering Research, Volume 4, Issue 10, October ISSN

Brian Noguchi CS 229 (Fall 05) Project Final Writeup A Hierarchical Application of ICA-based Feature Extraction to Image Classification Brian Noguchi

Homework 1. An Introduction to Neural Networks

Data & Knowledge Engineering

Polynomial-Time Isomorphism of 1-L-Complete Sets

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

Grading Results Total 100

Predicting x86 Program Runtime for Intel Processor

L11 Balanced Trees. Alice E. Fischer. Fall Alice E. Fischer L11 Balanced Trees... 1/34 Fall / 34

FINITE STATE DESCRIPTION OF COMMUNICATION PROTOCOLS*

cm3520 cm3525 Security Function

Effective Tracking of the Players and Ball in Indoor Soccer Games in the Presence of Occlusion

Entity-Relationship Models of Information Artefacts

I-0 Introduction. I-1 Introduction. Objectives: Quote:

CS 181 B&C EXAM #1 NAME. You have 90 minutes to complete this exam. You may assume without proof any statement proved in class.

On the Computation and Application of Prototype Point Patterns

6 NFA and Regular Expressions

OPTIMAL COMPLEX SERVICES COMPOSITION IN SOA SYSTEMS

Scheduling Parallel Real-Time Recurrent Tasks on Multicore Platforms

Example: Computer, SRC Simple RISC Computer

1 Extended Boolean Model

Available online at Procedia Computer Science 9 (2012 ) International Conference on Computational Science, ICCS 2012

M a c intosh Cyr i l lic Lang u age Ki t. Installation and User s Manual Manuel d installation et d u t i l i s a t i o n

Optimal Route Queries with Arbitrary Order Constraints

Data Caching for Enhancing Anonymity

A Learning Framework for Nearest Neighbor Search

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Approximate String Matching with Reduced Alphabet

Theory of Computations Spring 2016 Practice Final Exam Solutions

(Refer Slide Time: 0:19)

CS103 Handout 42 Spring 2017 May 31, 2017 Practice Final Exam 1

1 P a g e. F x,x...,x,.,.' written as F D, is the same.

Guillotine subdivisions approximate polygonal subdivisions: Part III { Faster polynomial-time approximation schemes for

Colorado School of Mines. Computer Vision. Professor William Hoff Dept of Electrical Engineering &Computer Science.

Abstract Matrix Arithmetic

A Learning Framework for Nearest Neighbor Search

Chapter Seven: Regular Expressions

Depth Estimation of 2-D Magnetic Anomalous Sources by Using Euler Deconvolution Method

TensorFlow and Keras-based Convolutional Neural Network in CAT Image Recognition Ang LI 1,*, Yi-xiang LI 2 and Xue-hui LI 3

NFAs and Myhill-Nerode. CS154 Chris Pollett Feb. 22, 2006.

QUERY ROUTING OPTIMIZATION IN SENSOR COMMUNICATION NETWORKS

Collaborative Web Caching Based on Proxy Affinities

Control Message Reduction Techniques in Backward Learning Ad Hoc Routing Protocols

Lecture 2 Finite Automata

Evaluation of a multi-frame blind deconvolution algorithm using Cramér-Rao bounds

Gearing Up for Honors Geometry!

Ranking Spatial Data by Quality Preferences

Approaching the Skyline in Z Order

Carving Differential Unit Test Cases from System Test Cases

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1

INSERTION SORT is O(n log n)

Efficient Estimation of Inclusion Coefficient using HyperLogLog Sketches

In the Proceedings of the 7 th ACM International Conference on Supercomputing,

Interleaving Execution and Planning for Nondeterministic, Partially Observable Domains

Lexical Analysis. Lecture 2-4

Compiling an Honest but Curious Protocol

Research on the Classification and Selection of Archive Texts with the Improved C4.5 Algorithm

Identifying Converging Pairs of Nodes on a Budget

Page 1. Embedded (Computer) System. The User s View of a Computer. Four Views of a Computer. Machine/assembly Language Programmer s View

Efficient Constraint Evaluation Algorithms for Hierarchical Next-Best-View Planning

Solving the Damage Localization Problem in Structural Health Monitoring Using Techniques in Pattern Classification

Two hours UNIVERSITY OF MANCHESTER. January Answer any THREE questions. Answer each question in a separate book

CS103 Handout 14 Winter February 8, 2013 Problem Set 5

COMPUTER GENERATED HOLOGRAMS Optical Sciences 627 W.J. Dallas (Monday, August 23, 2004, 12:38 PM) PART III: CHAPTER ONE DIFFUSERS FOR CGH S

Four Views of a Computer. The User s View of a Computer

Using an induction prover for verifying arithmetic circuits

Cristina Cifuentes. School of Computing Science. Queensland University of Technology. GPO Box 2434, Brisbane, QLD 4001, Australia

Structural Balance in Networks. An Optimizational Approach. Andrej Mrvar. Faculty of Social Sciences. University of Ljubljana. Kardeljeva pl.

Resource Optimization for Web Service Composition

Handling Indivisibilities. Notes for AGEC 622. Bruce McCarl Regents Professor of Agricultural Economics Texas A&M University

Energy-Efficient Disk Replacement and File Placement Techniques for Mobile Systems with Hard Disks

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Chapter 17: Wave Optics Solutions

Transcription:

CS 36 Meeting 8 9/4/8 Announceents. Hoework 3 due Friday. Review. The closure properties of regular languages provide a way to describe regular languages by building the out of sipler regular languages using the operations union, product and closure.. The notation called regular expressions is based on this fact. Definition: Given soe finite alphabet Σ, we define e to be a regular expression if e is a for soe a Σ ε e e, where e and e are regular expressions e e = e e where e and e are regular expressions e where e is a regular expression. (e ) where e is a regular expression. 3. We view regular expressions as another foralis for describing languages. If e is a regular expression, the language defined by e is denoted by L(e) and defined recursively/inductively as follows: Base clauses L(x) for soe a Σ is just {a} L( ) is L(ε) is {ɛ} Recursive clauses L(e e ) is L(e ) L(e ) L(e e ) is L(e )L(e ) Click here to view the slides for this class L(e ) is L(e ) L((e )) is L(e ) 4. Given the closure properties we have just shown, it is clear that all regular expressions describe regular languages. It is also true, though far fro clear, that every regular language can be described by soe regular expression. Our first goal to day will be to justify this clai. 5. Here are soe languages one ight want to describe with regular expressions Binary strings of length or less: ( ɛ)( ɛ). Binary strings that end in : ( ). Binary strings that don t end in : ( ɛ)( ɛ) ( ) ( ) Binary strings that are ultiples of 3:? 6. The last exaple raises the question of whether or not every regular language can be described by a regular expression. Generalize Nondeterinistic Finite Autoata. The book presents an algorith that translates the description of a DFA into a regular expression describing the sae language. The existence of and correctness of this algorith proves that all regular languages are described by soe regular expression.. To introduce this algorith, let s think about how we would convert the divisible by 3 FDA we have considered previously into a regular expression:

3. Looking at the diagra for this achine, it is clear that for the achine to go fro state to state and then get back to state again, it ust encounter an input substring described by the regular expression. Given this fact, if we don t really want to have to think about state, we could use the following diagra to capture the behavior of the achine. to use regular expressions. The idea is that the achine can ove fro one state to another if it finds a sequence of input sybols that atch the regular expression on the edge connecting the states. The word ay is critical here. Like an NFA, we assue this achine is very clever at guessing which strings to atch with the regular expressions labeling its edges. 5. Just as we were able to eliinate state in our diagra by adding an edge labeled with a regular expression to account for its absence we can also eliinate state. In the reduced version of the achine, there is a path fro to through and there is also a path fro back to itself through. We will need to account for both paths with new edges. To follow the path fro to we ust see a string that atches ( ). To follow the path fro back to itself, we siilarly ust see a string that atches ( ). This leads to the GNFA shown below. (*)* (*)* * 4. This diagra is an exaple of what the text calls a generalized nondeterinistic finite autoata or GNFA. It is basically a NFA where instead of labeling transitions with siple sybols, we allow ourselves 6. We now have ultiple edges fro to and fro back to itself. In an NFA, this would not bother us. In a GNFA, however, since we have the power to use regular expressions as labels, we can eliinate such edges by creating a single edge labeled with the union of the regular expressions on the existing edges. Doing this to our achine yields.

U ( (*)* ) ( U ( (*)* )) ( U ( (*)* ) )* U ( (*)* ) 7. At this point, you should be able to tell what regular expression describes the language of this achine. But it would be nice if we could continue the approach of reoving nodes fro the achine until we got to the point where we had a single edge labeled with the desired regular expression. This is hard to do when the achine reaches the point that all we have left is the only state and the only state and they are different states. 8. Given that we have ɛ-transitions, we can fix this by creating a single, external state with ɛ-transitions going fro what would norally be our states to this new state. U ( (*)* ) U ( (*)* ) 9. Now we can use the sae approach we used to eliinate states and to eliinate state giving:. Aazingly, if you think about it you will (ay?) realize that ( (( ) ))( (( ) )) actually does describe the language of binary nubers divisible by 3.. The algorith in the book takes the basic approach that we just followed, but strealines things in several ways. First, rather than waiting to add a single, separate state when they get in trouble, the algorith s by adding both a new state and a new state and connecting these new states to the original state and states with epsilontransitions. Second, so that they don t have to handle the erging of edges as a special case, they iediately add edges between all states not connected directly by edges (except for their new and state) that are labeled with the regular expression. They can get away with this because such edges act as if they are not there. In class and when doing your hoework, it is not worth adding these edges. Just erge or add edges when appropriate. With this in ind, let s consider the ultiples of 3 achine again. To ake it interesting, we can reove states in a different order. Also, I will ask you to help by telling e which edges I will have to add or augent when I reove an existing state and by telling e what the labels on these edges should be. 3

3. As our first step, rather than waiting until we get in trouble, we iediately augent the achine with a new state and a new state. We add epsilon-transitions fro the new state to the old one and fro all old states to the new one. U U U 5. Next we will reove state. This requires updating the labels of the edges fro to and fro to itself to reflect the paths between these sources and destinations that currently pass through. U U ( U )* U U ( U )* 4. Now, instead of reoving state, let s try reoving state first. This will require adding edges fro to, fro to, and fro to. We will also have to update the label of the edges fro to, and the loops fro to itself and fro to itself. The result looks like: 6. Finally, since the only edge fro to is an epsilon-transition, it is clear that we can reove both states and to obtain: 4

( U U ( U )*) ( U U ( U )*)*. After spending hours aking up the slides showing how to extract a regular expression for a language fro a DFA that recognizes the language, I could not help thinking that it would be nice to have soe sort of regular expression checker that would tell e for sure that two regular expressions actually do describe the sae languages. 3. If you think about it, you will realize that what I really wanted was a decider for the language: 7. If you have a really good eory, you will have already noticed that we obtained a different regular expression by perforing this sequence of state eliinations that we did last tie. Eliinating then then and gave us: ( (( ) ))( (( ) )) Eliinating then then and gave us: ( ( ) )( ( ) ) Hopefully, these two regular expressions describe the sae sets! 8. My hope is that this practice gives you a clear enough understanding of how to use GNFAs to extract a regular expression that describes the language of a DFA. The book gives a ore foral presentation (alost a proof). You should reread (or read) that section now to solidify you understanding and convince yourselves that the algorith can be applied to any DFA. Languages that are not regular. We have seen two distinct exaples regular expressions that (should/ight) describe the sae language binary representations of nubers divisible by 3: Jason s and ( ( ) )( ( ) ) L EQ RE = {e = e e & e are regular expressions over Σ and L(e) = L(e )} 4. This language is a bit ore interesting than ost of the exaples we have been talking about so far this seester. Certainly, it would be harder for you to write a progra that decided whether an input belonged to this language than it would be to decide if a binary string represented a nuber divisible by 3. 5. If this proble does not ipress you, consider the siilar proble for a language soewhat richer than the language of regular expressions: L EQ Java = {j = j j & j are Java progras that behave identically} Those in the know ight even suspect that writing a progra to recognize strings that belong to this language is ore than difficult. 6. For now, let s stick to regular languages and ask whether a set like L EQ RE = {e = e e & e are regular expressions over Σ and L(e) = L(e )} is regular. 7. In fact, let s with soething even easier. In your last hoework assignent I entioned that {a+b = c a, b, c {, } and the su of the nubers represented by a and b in binary notation is the nuber represented by c } was not regular. Let s consider an even sipler representation of addition: 5

{a + b = c a, b, c {} and the su of the nubers represented by a and b in unary notation is the nuber represented by c } 8. That is, we would like to deterine whether the language L UnaryAdd = { a + b = c k refers to a string of k s and a + b = c} is regular. Getting Loopy. One approach to showing that a particular language is not regular involves recognizing that strings of sufficient length will encounter loops of states as they are processed by a DFA. I want to ake this notion very concrete for you before using it in a ore abstract way to show languages are not regular. varying lengths that take the achine fro state to state while repeating at least one but as few as possible of the states in the path. Here are soe exaples: input path ɛ ɛ 3 ɛ ɛ 3 I haven t included inputs that caused siple cycles of length 5 and 6 because there are no such siple cycles in this achine s state graph. Consider the following achine (which happens to be the 5 version of the binary nubers that are ultiples of N DFA we presented using our foral notation earlier). 3 4 What I would like to do with this achine is look for siple cycles. To be ore precise I would like to look for strings of 6