Docsity

Regular Languages - Computability - Lecture Slide, Slides of Computer Science

Partial preview of the text

Download Regular Languages - Computability - Lecture Slide and more Slides Computer Science in PDF only on Docsity!

1

Regular Languages, Regular

Operations

2

Agenda

Today  Regular languages  Finite languages are regular  Regular operations on languages  Union ()  Concatenation ()  Kleene star (*) For next time:  Read 1.3 and handout on minimization HW1 collected

4

Language Examples

 Unary prime numbers: { 11, 111, 11111, 1111111, 11111111111, … } = {1^2 , 1^3 , 1^5 , 1^7 , 1^11 , 1^13 , … } = { 1^ p^ | p is a prime number }  Unary squares: {, 1, 1^4 , 1^9 , 1^16 , 1^25 , 1^36 , … } = { 1^ n^ | n is a perfect square }  Palindromic bit strings: {, 0, 1, 00, 11, 000, 010, 101, 111, …} = {x  {0,1}* | x = xR^ } o

Will explore whether or not these are regular in future.

5

Finite Languages

All the previous examples had the following

property in common: infinite cardinality

NOTE: The strings which made up the

language were finite (as they always will be in this course); however, the collection of such strings was infinite.

Before looking at infinite languages, should

definitely look at finite languages.

7

Languages of Cardinality 1

A: Yes.

Q: What’s, wrong with this example?

8

Languages of Cardinality 1

A: Nothing, really. This an example of a

nondeterministic FA. This turns out to be the

most concise way to encapsulate the language { banana }

But we will deal with nondeterminism in coming lectures. So:

Q: Is there a way of fixing this and making it deterministic?

11

Two Strings

Q: How about two strings? For example

{ banana, nab }?

12

Two Strings

A: Just add another route:

14

Arbitrary Finite Number of

A1: Strings

15

Arbitrary Finite Number of

Strings: Empty Language

A2: Build a 1-state automaton whose

accept states set F is empty!

17

Infinite Cardinality

Q: Are all regular languages finite?

18

Infinite Cardinality

A: No! Many infinite languages are regular.

Common Mistake 1: The strings of regular languages are finite, therefore the regular languages must be finite.

Common Mistake 2: Regular languages are – by

definition– accepted by finite automata,

therefore regular languages are finite.

Q: Give an example of a infinite but regular

language.

20

Regular Operations

You may have come across the regular operations when doing advanced searches utilizing programs such as emacs, egrep, perl, python, etc. There are three basic operations we will work with:

  1. Union
  2. Concatenation
  3. Kleene-star

And a fourth definable in terms of the previous:

  1. Kleene-plus

21

Regular Operations –

Summarizing Table

Operation Symbol UNIX version Meaning

Union  |

match one of the patterns

Concatenation ^ implicit in

UNIX

match patterns in sequence Kleene- star

Match pattern 0 or more times Kleene- plus

Match pattern 1 or more times