Presentation is loading. Please wait.

Presentation is loading. Please wait.

Languages.

Similar presentations


Presentation on theme: "Languages."— Presentation transcript:

1 Languages

2 Languages A language is a set of strings String: A sequence of letters
Examples: “cat”, “dog”, “house”, … Defined over an alphabet:

3 Alphabets and Strings We will use small alphabets: Strings

4 String Operations Concatenation

5 Reverse

6 String Length Length: Examples:

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

8 Length of Concatenation
Example:

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

10 Inductive hypothesis:
for Inductive step: we will prove

11 Inductive Step Write , where From definition of length:
From inductive hypothesis: Thus:

12 Empty String A string with no letters: Observations:

13 Substring Substring of string: a subsequence of consecutive characters

14 Prefix and Suffix Prefixes Suffixes prefix suffix

15 Another Operation Example: Definition:

16 The * Operation : the set of all possible strings from alphabet

17 The + Operation : the set of all possible strings from alphabet except

18 Language A language is any subset of Example: Languages:

19 Another Example An infinite language

20 Operations on Languages
The usual set operations Complement:

21 Reverse Definition: Examples:

22 Concatenation Definition: Example:

23 Another Operation Definition: Special case:

24 More Examples

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

26 Positive Closure Definition:

27 Finite Automata

28 Finite Automaton Input String Output Finite Automaton String

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

30 Transition Graph Abba -Finite Accepter initial state final state

31 Initial Configuration
Input String

32 Reading the Input

33

34

35

36 Input finished Output: “accept”

37 Rejection

38

39

40

41 Input finished Output: “reject”

42 Another Example

43

44

45

46 Input finished Output: “accept”

47 Rejection

48

49

50

51 Input finished Output: “reject”

52 Formalities Deterministic Finite Accepter (DFA) : set of states
: input alphabet : transition function : initial state : set of final states

53 Input Alphabet

54 Set of States

55 Initial State

56 Set of Final States

57 Transition Function

58

59

60

61 Transition Function

62 Extended Transition Function

63

64

65

66 Observation: There is a walk from to
with label

67 Recursive Definition

68

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

70 Example accept

71 Another Example accept accept accept

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

73 Observation Language accepted by : Language rejected by :

74 More Examples trap state accept

75 = { all substrings with prefix }
accept

76 = { all strings without substring }

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

78 Example The language is regular:


Download ppt "Languages."

Similar presentations


Ads by Google