{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes06 Regular Expressions - CS 373 Theory of Computation...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
1 Operations on Languages Operations on Languages Recall: A language is a set of strings We can consider new languages derived from operations on given languages e.g., L 1 L 2 , L 1 L 2 , 1 2 L , . . . A simple but powerful collection of operations: Union, Concatenation and Kleene Closure Union is a familiar operation on sets. We define and explain the other two operations below. Concatenation of Languages Definition 1. Given languages L 1 and L 2 , we define their concatenation to be the language L 1 L 2 = { xy | x L 1 , y L 2 } Example 2 . L 1 = { hello } and L 2 = { world } then L 1 L 2 = { helloworld } L 1 = { 00 , 10 } ; L 2 = { 0 , 1 } . L 1 L 2 = { 000 , 001 , 100 , 101 } L 1 = set of strings ending in 0; L 2 = set of strings beginning with 01. L 1 L 2 = set of strings containing 001 as a substring L ◦ { } = L . L ◦ ∅ = . Kleene Closure Definition 3. L n = ( { } if n = 0 L n - 1 L otherwise L * = [ i 0 L i i.e., L i is L L ◦ · · · ◦ L (concatenation of i copies of L ), for i > 0. L * , the Kleene Closure of L : set of strings formed by taking any number of strings (possibly none) from L , possibly with repetitions and concatenating all of them. If L = { 0 , 1 } , then L 0 = { } , L 2 = { 00 , 01 , 10 , 11 } . L * = set of all binary strings (including ). • ∅ 0 = { } . For i > 0, i = . * = { } • ∅ is one of only two languages whose Kleene closure is finite. Which is the other? { } * = { } . 2
Background image of page 2
2 Regular Expressions 2.1 Definition and Identities Regular Expressions A Simple Programming Language Figure 1: Stephen Cole Kleene A regular expression is a formula for representing a (complex) language in terms of “elementary” languages combined using the three operations union, concatenation and Kleene closure. Regular Expressions Formal Inductive Definition Syntax and Semantics A regular expression over an alphabet Σ is of one of the following forms: Syntax Semantics L ( ) = {} Basis L ( ) = { } a L ( a ) = { a } ( R 1 R 2 ) L (( R 1 R 2 )) = L ( R 1 ) L ( R 2 ) Induction ( R 1 R 2 ) L (( R 1 R 2 )) = L ( R 1 ) L ( R 2 ) ( R * 1 ) L (( R * 1 )) = L ( R 1 ) *
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}