/
Chapter one Alphabets and Languages Alphabets A  symbol  is an undefined term. (Cf. an Chapter one Alphabets and Languages Alphabets A  symbol  is an undefined term. (Cf. an

Chapter one Alphabets and Languages Alphabets A symbol is an undefined term. (Cf. an - PowerPoint Presentation

jane-oiler
jane-oiler . @jane-oiler
Follow
342 views
Uploaded On 2019-10-31

Chapter one Alphabets and Languages Alphabets A symbol is an undefined term. (Cf. an - PPT Presentation

Chapter one Alphabets and Languages Alphabets A symbol is an undefined term Cf an abstract entity like point or line in geometry Eg S s An alphabet Σ is a ID: 761358

string chapter theory computation chapter string computation theory aba induction symbols strings prime sequence languages concatenation empty definition set

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Chapter one Alphabets and Languages Alph..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Chapter one Alphabets and Languages

Alphabets A symbol is an undefined term. (Cf. an abstract entity like point or line in geometry.) E.g. S, s, #, %, @, $, *, ?, !, =, +, -An alphabet Σ is a finite set of symbols. Letters: Σ = {a, b, c} Digits: Σ = {0, 1}Turing: cognitive distinguishability Theory of Computation: Chapter 1 2

Strings A string is a finite sequence of juxtaposed symbols from an alphabet, Σ. The length of a string is denoted by |…|.Examples: u = 101 |u| = 3 v = accba |v| = 5The empty string , ε, is sequence of zero symbols. |ε| = 0 by definition. Algebraically: a monoid is a set with an associative operation and an identity.String: an element of the finitely generated free monoid over Σ. Notation: u, v, w, x, y, z, … Theory of Computation: Chapter 1 3

Relations A prefix/suffix of a string is a contiguous sequence of leading/trailing symbols starting with the first/last.Prefixes of aba: ε, a, ab, aba Suffixes of aba: ε, a, ba, aba Non-trivial: preclude empty string Proper : preclude whole stringA substring is a contiguous subsequence of a string, written x ⊆ y ⇔ uxv = y, where u is a prefix of y and v is a suffix of y.Substrings of aba: How many? Subsequence: x ⊑ y iff there is an embedding from x into y Theory of Computation: Chapter 1 4

THE PRIME GAME Ask a friend to write down a prime number. Bet them that you can always strike out 0 or more digits to get a prime on this card.2, 3, 5, 7, 11, 19, 41, 61, 89, 409, 449, 499, 881, 991,6469, 6949, 9001, 9049, 9649, 9949, 60649,666649, 946669, 60000049, 66000049, 66600049@2007-shallit©cs.uwaterloo.eaTheory of Computation: Chapter 1 5

Operations on strings The concatenation of two strings is juxtaposing them together. Example: Let u = aba, v = bab. Then uv = ababab.Fact: concatenation is associative but not commutative ( xy ≠ yx ) The empty string is the identity: wε = εw = w.Powers are defined by induction: w⁰ = ε wⁿ ⁺¹ = wⁿ ·w for n ≥ 0 Clearly, given any u , v : | uv| = |u| + |v| Theory of Computation: Chapter 1 6

Reversal The reversal of a string is denoted as wR.Definition: Basis: εR = ε Induction: (xσ)R = σxR for any σ in Σ Theorem: (xy ) R = yRxR Proof: By induction on |y|. Base Case: |y| = 0 → y = ε. (xε)R = (x)R = εxR = εRx R Induction Step: | y | > 0 ⇒ y = zσ for some σ in Σ. So, (xy)R = ( xz σ ) R = σ (xz)R = (by induction hypothesis) = σzRxR = (zσ)RxR = yRxR . Compare to this definition: if w = σ₁ … σᵢ, then wR = σᵢ … σ₁ 7 Theory of Computation: Chapter 1

Languages A language is a set of strings over some (finite) alphabet.Examples: ∅ = {} Σ* = {σ₁…σᵢ : where i ≥ 0 and for 1 ≤ j ≤ i, σⱼ ∈ Σ}E.g. L = {w  {a, b, c}* : w = w R} “palindromes”Σ* is countable – enumerate by length lexicographically:If |x| < |y| then x appears before yIf | x| = |y | then order alphabetically Σ = {a 1, …, aᵢ }, let a 1 < … < aᵢ E.g. {0, 1} * = ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, …Theory of Computation: Chapter 1 8

Operations on languages Concatenation: L ₁·L₂ = {xy : x ∈ L₁, y ∈ L₂} L·∅ = ∅·L = ∅ L·{ε } = L = {ε}·L L⁰ = {ε}; Lⁿ⁺¹ = LⁿL L* = L ⁰ ∪ L ¹ ∪ L ² ∪ … = ⋃ {Lⁿ : n ≥ 0}; L ⁺ = LL * Examples :L₁ = {a}* L₂ = { b}* L₁L ₂ = { a}*{b}* = {aⁱbⁿ : i, n ≥ 0}∅* = { ε } { a , b }* = Show: (L*)* = L*; (L⁺)⁺ = L⁺ = L¹ ∪ L² ∪ … = ⋃ {Lⁿ : n ≥ 1} Theory of Computation: Chapter 1 9