1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.

Slides:



Advertisements
Similar presentations
Finite-State Machines with No Output Ying Lu
Advertisements

1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2005.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 2 School of Innovation, Design and Engineering Mälardalen University 2011.
YES-NO machines Finite State Automata as language recognizers.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
1 CSCI-2400 Models of Computation. 2 Computation CPU memory.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
CS 310 – Fall 2006 Pacific University CS310 Strings, String Operators, and Languages Sections: August 30, 2006.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
1 Finite Automata. 2 Finite Automaton Input “Accept” or “Reject” String Finite Automaton Output.
1 Languages and Finite Automata or how to talk to machines...
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
Costas Busch - RPI1 Mathematical Preliminaries. Costas Busch - RPI2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
Fall 2006Costas Busch - RPI1 Languages. Fall 2006Costas Busch - RPI2 Language: a set of strings String: a sequence of symbols from some alphabet Example:
Finite Automata Costas Busch - RPI.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Fall 2004COMP 3351 Languages. Fall 2004COMP 3352 A language is a set of strings String: A sequence of letters/symbols Examples: “cat”, “dog”, “house”,
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Finite-State Machines with No Output Longin Jan Latecki Temple University Based on Slides by Elsa L Gunter, NJIT, and by Costas Busch Costas Busch.
Finite-State Machines with No Output
CSC312 Automata Theory Lecture # 2 Languages.
Costas Busch - LSU1 Languages. Costas Busch - LSU2 Language: a set of strings String: a sequence of symbols from some alphabet Example: Strings: cat,
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
1 Chapter 1 Introduction to the Theory of Computation.
Mathematical Preliminaries. Sets Functions Relations Graphs Proof Techniques.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet:
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010.
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
Natural Language Processing Lecture 4 : Regular Expressions and Automata.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 2 School of Innovation, Design and Engineering Mälardalen University 2012.
CS 203: Introduction to Formal Languages and Automata
Modeling Computation: Finite State Machines without Output
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Formal Languages Finite Automata Dr.Hamed Alrjoub 1FA1.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2006.
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
Akram Salah ISSR Basic Concepts Languages Grammar Automata (Automaton)
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Chapter 1 INTRODUCTION TO THE THEORY OF COMPUTATION.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
Languages.
Non Deterministic Automata
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
REGULAR LANGUAGES AND REGULAR GRAMMARS
CSE322 Finite Automata Lecture #2.
Some slides by Elsa L Gunter, NJIT, and by Costas Busch
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Principles of Computing – UFCFA3-30-1
Non-Deterministic Finite Automata
Non Deterministic Automata
Chapter 1 Introduction to the Theory of Computation
Languages Fall 2018.
CSCE 355 Foundations of Computation
Presentation transcript:

1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006

2 Content Languages, Alphabets and Strings Strings & String Operations Languages & Language Operations Regular Expressions Finite Automata, FA Deterministic Finite Automata, DFA

3 Languages, Alphabets and Strings

4 defined over an alphabet: Languages A language is a set of strings A String is a sequence of letters An alphabet is a set of symbols

5 Alphabets and Strings We will use small alphabets: Strings

6 Operations on Strings

7 String Operations m n bbbv aaaw     y  bbbaaa x  abba Concatenation (sammanfogning) xy  abbabbbaaa

8 Reverse (reversering) Example: Longest odd length palindrome in a natural language: saippuakauppias (Finnish: soap sailsman)

9 String Length Length: Examples:

10 Recursive Definition of Length For any letter: For any string : Example:

11 Length of Concatenation   vuuv aababaabuv 5, 3,   vabaabv uaabu Example:

12 Proof of Concatenation Length Claim: Proof: By induction on the length Induction basis: From definition of length:

13 Inductive hypothesis: Inductive step: we will prove for

14 Inductive Step Write, where From definition of length: From inductive hypothesis: Thus: END OF PROOF

15 Empty String A string with no letters: (Also denoted as  ) Observations:

16 Substring (delsträng) Substring of string: a subsequence of consecutive characters String Substring

17 Prefix and Suffix Suffixes prefix suffix Prefixes

18 Repetition Example: Definition: n n  } (String repeated n times)

19 The * (Kleene star) Operation the set of all possible strings from alphabet [Kleene is pronounced "clay-knee“]

20 The + Operation : the set of all possible strings from alphabet except ,ba  ,,,,,,,,,*aabaaabbbaabaaba  

21 Example    *, oj, fy, usch, ojoj, fyfy,uschusch, ojfy, ojusch     *  ,fyoj , usch    oj, fy, usch, ojoj, fyfy,uschusch, ojfy, ojusch   

22 Operations on Languages

23 Language A language is any subset of Example: Languages:   ,,,,,,,,*, aaabbbaabaaba ba     },,,,,{,, aaaaaaabaababaabba aabaaa

24 Example An infinite language

25 Operations on Languages The usual set operations  ,,,,,,,,,*aabaaabbbaabaaba  Complement:

26 Reverse Examples: Definition:

27 Concatenation Definition: Example

28 Repeat Definition: Special case:

29 Example

30 Star-Closure (Kleene *) Definition: Example:

31 Positive Closure Definition   *L    2 1 L LL 

32 Regular Expressions

33 Regular Expressions: Recursive Definition are Regular Expressions Primitive regular expressions: Given regular expressions and

34 Examples A regular expression: Not a regular expression:

35 Zero or more. a* means "zero or more a's." To say "zero or more ab's," that is, {, ab, abab, ababab,...}, you need to say (ab)*. ab* denotes {a, ab, abb, abbb, abbbb,...}. Building Regular Expressions

36 One or more. Since a* means "zero or more a's", you can use aa* (or equivalently, a*a) to mean "one or more a's.“ Similarly, to describe "one or more ab's," that is, {ab, abab, ababab,...}, you can use ab(ab)*. Building Regular Expressions

37 Any string at all. To describe any string at all (with = {a, b, c}), you can use (a+b+c)*. Any nonempty string. This can be written as any character from followed by any string at all: (a+b+c)(a+b+c)*. Building Regular Expressions

38 Any string not containing.... To describe any string at all that doesn't contain an a (with = {a, b, c}), you can use (b+c)*. Any string containing exactly one... To describe any string that contains exactly one a, put "any string not containing an a," on either side of the a, like this: (b+c)*a(b+c)*. Building Regular Expressions

39 Languages of Regular Expressions Example language of regular expression

40 Definition For primitive regular expressions:

41 Definition (continued) For regular expressions and

42 Example Regular expression:

43 Example Regular expression

44 Example Regular expression

45 Example Regular expression  { all strings with at least two consecutive 0 }

46 Example Regular expression (consists of repeating 1’s and 01’s). = { all strings without two consecutive 0 }

47 Example = { all strings without two consecutive 0 } (In order not to get 00 in a string, after each 0 there must be an 1, which means that strings of the form are repeated. That is the first parenthesis. To take into account strings that end with 0, and those consisting of 1’s solely, the rest of the expression is added.) Equivalent solution:

48 Equivalent Regular Expressions Regular expressions and are equivalent if Definition:

49 Example = { all strings without two consecutive 0 } and are equivalent regular expressions.

50 Finite Automata FA

51 There is no formal definition for "automaton". Instead, there are various kinds of automata, each with it's own formal definition. has some form of input has some form of output has internal states, may or may not have some form of storage is hard-wired rather than programmable Generally, an automaton

52 Finite Automaton Input String Output String Finite Automaton

53 Finite Accepter Input “Accept” or “Reject” String Finite Automaton Output

54 Nodes = States Edges = Transitions An edge with several symbols is a short-hand for several edges: FA as Directed Graph

55 Deterministic Finite Automata DFA

56 Deterministic there is no element of choice Finite only a finite number of states and arcs Acceptors produce only a yes/no answer DFA

57 Transition Graph initial state final state “accept” state transition abba -Finite Acceptor Alphabet =

58 Initial Configuration Input String

59 Reading the Input

60

61

62

63 Output: “accept”

64 Rejection

65

66

67

68 Output: “reject”

69 Another Example

70

71

72

73 Output: “accept”

74 Rejection

75

76

77

78 Output: “reject”

79 Formal definitions Deterministic Finite Accepter (DFA) : set of states : input alphabet : transition function : initial state : set of final states

80 Input Aplhabet

81 Set of States

82 Initial State

83 Set of Final States

84 Transition Function

85

86

87

88 Transition Function

89 Extended Transition Function

90

91

92

93 Observation: There is a walk from to with label

94 Recursive Definition

95      ,,,,,,* ),,(*,* q bq baq baq baq abq          

96 Languages Accepted by DFAs Take DFA Definition: The language contains all input strings accepted by = { strings that drive to a final state}

97 Example accept Alphabet =

98 Another Example accept Alphabet =

99 Formally For a DFA Language accepted by : alphabet transition function initial state final states

100 Observation Language accepted by Language rejected by

101 More Examples accept trap state Alphabet =

102 = { all strings with prefix } accept Alphabet =

103 = { all strings without substring } Alphabet =

104 Regular Languages All regular languages form a language family A language is regular if there is a DFA such that

105 Example is regular The language Alphabet =