Download presentation
Presentation is loading. Please wait.
1
1 Languages and Finite Automata or how to talk to machines...
2
2 A language is a set of strings String: A sequence of letters (a word) Examples: “cat”, “dog”, “house”, … Defined over an alphabet: set of symbols (letters) Languages
3
3 Alphabets and Strings We will use small alphabets Strings
4
4 String Operations Concatenation Reverse
5
5 String Length Length: Examples:
6
6 Recursive Definition of Length For any letter: For any string : Example:
7
7 Length of Concatenation Example:
8
8 Proof of Concatenation Length Claim: Proof: By induction on the length Induction basis: is only one symbol From definition of length:
9
9 Inductive hypothesis: for all with Inductive step: we will prove for
10
10 Inductive Step Write, where From definition of length: From inductive hypothesis: Thus:
11
11 Empty String A string with no letters: Observations:
12
12 Substring Definition: A substring of a string is any sequence of consecutive characters Example: Substrings
13
13 Prefix and Suffix Prefixes Suffixes prefix suffix
14
14 Another Operation Example: Definition for any :
15
15 The * Operation : the set of all possible strings from alphabet Example:
16
16 Language A language is any subset of Examples: A string is called “sentence”
17
17 Another Example An infinite language
18
18 Operations on Languages The usual set operations Complement:
19
19 Reverse Definition: Examples:
20
20 Concatenation Definition: Example:
21
21 Another Operation Definition: Example: Special case:
22
22 Example
23
23 Star-Closure (Kleene *) Definition: Example:
24
24 Positive Closure Definition:
25
25 Finite Automata Input String Output String Finite Automaton
26
26 Finite Accepter Input “Accept” or “Reject” String Finite Automaton Output
27
27 Transition Graph initial state final state “accept” state transition Abba -Finite Accepter
28
28 Initial Configuration Input String
29
29 Reading the Input
30
30
31
31
32
32 Output: “accept”
33
33 Rejection
34
34
35
35
36
36 Output: “reject”
37
37 Formalities Deterministic Finite Accepter (DFA) : set of states : input alphabet : transition function : initial state : set of final states
38
38 Input Aplhabet
39
39 Set of States
40
40 Initial State
41
41 Set of Final States
42
42 Transition Function
43
43 Transition Function
44
44 Extended Transition Function
45
45 Recursive Definition
46
46 Languages Accepted by DFAs Take DFA Definition: The language accepted by contains all input strings accepted by In other words: = { strings that drive to a final state}
47
47 Example accept
48
48 Another Example accept
49
49 Formally For a DFA Language accepted by : alphabet transition function initial state final states
50
50 Observation Language accepted by : Language rejected by :
51
51 More Examples accept trap state
52
52 = { all substrings with prefix } accept
53
53 = { all strings without substring }
54
54 Regular Languages Definition: A language is regular if there is a DFA such that All the regular languages form a family
55
55 Example The language is regular:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.