Strings and Languages Denning, Section 2.7. Alphabet An alphabet V is a finite nonempty set of symbols. Each symbol is a non- divisible or atomic object.

Slides:



Advertisements
Similar presentations
Chapter 2 Revision of Mathematical Notations and Techniques
Advertisements

Formal Languages Languages: English, Spanish,... PASCAL, C,... Problem: How do we define a language? i.e. what sentences belong to a language? e.g.Large.
Chapter 6 Languages: finite state machines
Properties of Regular Languages
1 Lecture 32 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union,
Automata and Formal Languages Tim Sheard 1 Lecture 9 Reasoning with DFAs.
1.  We have studied groups, which is an algebraic structure equipped with one binary operation. Now we shall study rings which is an algebraic structure.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Formal Languages and Automata Theory Applied to Transportation Engineering Problem of Incident Management Neveen Shlayan Ph.D. Candidate.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
Sets Definition of a Set: NAME = {list of elements or description of elements} i.e. B = {1,2,3} or C = {x  Z + | -4 < x < 4} Axiom of Extension: A set.
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 Languages and Finite Automata or how to talk to machines...
1 Module 31 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union, concatenation.
Costas Busch - RPI1 Mathematical Preliminaries. Costas Busch - RPI2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
Fall 2006Costas Busch - RPI1 Languages. Fall 2006Costas Busch - RPI2 Language: a set of strings String: a sequence of symbols from some alphabet Example:
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 Set Theory. Notation S={a, b, c} refers to the set whose elements are a, b and c. a  S means “a is an element of set S”. d  S means “d is not an element.
Lecture 1 String and Language. String string is a finite sequence of symbols. For example, string ( s, t, r, i, n, g) CS4384 ( C, S, 4, 3, 8) (1,
Rosen 1.6. Approaches to Proofs Membership tables (similar to truth tables) Convert to a problem in propositional logic, prove, then convert back Use.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
CSC312 Automata Theory Lecture # 2 Languages.
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,
Mathematical Preliminaries Strings and Languages Preliminaries 1.
1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,
MA/CSSE 474 Theory of Computation Functions, Closure, Decision Problems.
1 Chapter 1 Introduction to the Theory of Computation.
Languages, Grammars, and Regular Expressions Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth.
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
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 Exercise: Prove that the set S = { π : π is a permutation of {1, 2, 3, …, n} for some integer n ≥ 1 } is countable.
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
1 Module 31 Closure Properties for CFL’s –Kleene Closure –Union –Concatenation CFL’s versus regular languages –regular languages subset of CFL.
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
Discrete Mathematics R. Johnsonbaugh
Sets. Definitions (I) Collection of elements such that: There are no duplicates There is no order Special sets Universe (U or E): all elements under consideration.
Discrete Mathematical Structures 4 th Edition Kolman, Busby, Ross © 2000 by Prentice-Hall, Inc. ISBN
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010.
Rosen 1.6, 1.7. Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by.
Introduction to Real Analysis Dr. Weihu Hong Clayton State University 8/27/2009.
CS 203: Introduction to Formal Languages and Automata
November 2003Computational Morphology III1 CSA405: Advanced Topics in NLP Xerox Notation.
(2 + 1) + 4 = 2 + (1 + 4) Associative Property of Addition.
1 Topic Sets (5.1, 5.2, 5.3). 2 Original author of the slides: Vadim Bulitko University of Alberta Modified by.
Introduction Why do we study Theory of Computation ?
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
1 Strings and Languages Lecture 2-3 Ref. Handout p12-17.
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
Languages and Strings Chapter 2. (1) Lexical analysis: Scan the program and break it up into variable names, numbers, etc. (2) Parsing: Create a tree.
Alphabet, String, Language. 2 Alphabet and Strings An alphabet is a finite, non-empty set of symbols. –Denoted by  –{ 0, 1 } is a binary alphabet. –{
A Universal Turing Machine
Set Theory.
Languages.
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
Languages, prefixes, sets, cardinality, functions
Closure Properties of Regular Languages
Closure Properties of Regular Languages
Languages, prefixes, sets, cardinality, functions
Introduction Reading: Sections 1.5 – 1.7.
Chapter 1 Introduction to the Theory of Computation
CSC102 - Discrete Structures (Discrete Mathematics) Set Operations
CSC312 Automata Theory Lecture # 2 Languages.
Languages Fall 2018.
Terminology and Symbols
Presentation transcript:

Strings and Languages Denning, Section 2.7

Alphabet An alphabet V is a finite nonempty set of symbols. Each symbol is a non- divisible or atomic object used in the construction of sentences. Examples V 1 = { a, b, c, d, e, …, z } V 2 = { 0, 1 }

Strings A string w of length k on an alphabet V is a sequence of k symbols w = a 1 a 2 a 3 … a k where each symbol a j comes from alphabet V. Examples aabakkejaa is a string of length 10 from V is a string of length 8 from V 2

Length of String The string w = a 1 a 2 a 3 … a k has length k and we write: |w| = k The unique string containing no symbols is called the empty string, denoted by or . Thus | | = 0. Examples: |bababaako| = 9 | | = 0 | | = 8

Set of All Strings on V If V is an alphabet, we denote by W k the set of all strings of length k on V: W k = {w ; |w| = k }. We denote by W 0 the set containing just the empty string W 0 = { }. The set of all strings on V is W, and is defined by W =  W k where k = 0 to . Thus W = W 0  W 1  W 2 …  W k …

Concatenation on W Concatenation is a binary operation on W which takes two strings w 1 and w 2 and produces a third string w 1 w 2 by juxtaposing w 2 after w 1. Example: If V = {0, 1}, and W is the set of all strings from V, and if w 1 = 00011, w 2 = , then w 1 w 2 =

Prefixes and suffixes If  and  are two strings from W, and if  = , then we say that  is a prefix of , and  is a suffix of . If  is not empty, then  is a proper prefix of . Similarly, if  is not empty, then  is a proper suffix of .

Properties of Concatenation W is closed under concatenation. If   W, and   W, then   W. Concatenation is associative. If , ,   W, then  (  ) = (  ) . The empty string is the identity element. For each string  in W,  =  = .

More Properties Concatenation is not commutative. If ,   W, then   , in general. For all ,   W, the lengths are related as follows: |  | = |  | + |  |.

Some Notation w k is the concatenation of k copies of w, that is w k = www … w, k times. If w = a 1 a 2 a 3 … a k, then w R = a k a k-1 … a 3 a 2 a 1. w R is called the reverse of w.

Denumerability of W Proposition 2.9: Let V be an alphabet (finite nonempty set of atomic symbols), and let W be the set of all strings from V. Then W is denumerable, that is W is countably infinite.

Outline of Proof Let |V| = n, and let h(v) be a function that associates the numbers 1, 2, 3, …, n to the symbols v in V. Define a function f(w) on W such that f( ) = 0 f(wv) = nf(w) + h(v), where w  W, v  V Prove that f( ) is one-to-one and onto.

Languages A language L on an alphabet V is any set L of strings on V. That is L  W, where W is the set of all strings on V. The set of all languages on V is the set of all subsets of W, that is P (W) the powerset of W. Since W is countably infinite, then P (W) is uncountably infinite.

Examples of languages V = {0, 1} L = {00, 01, 10, 11} V = {a} L = {, a, a 2, a 3, a 4,... } = { a k | k  0 } V = {0, 1} L = {1, 01, 001, 0001,... }

Operations on Languages Set operations on languages A and B union A  B intersection A  B complement A c = W – A Concatenation of languages A and B AB = {  |   Kleene closure A*

Concatenation of Languages Example: A = {a, ab} B = {c, bc} AB = {ac, abc, abbc} BA = {ca, cab, bca, bcab} Thus AB  BA

Kleene Closure A* If V is an alphabet, W the set of all strings on V, A  W, A a language on V, then the Kleene closure of A, denoted by A*, is defined as follows: A 0 = { } =  A 1 = A, A 2 = AA A 3 = A 2 A,..., A k+1 = A k A,... A* = A 0  A 1  A 2  A 3 ...

Special Languages = {  set containing empty string  = { } = the empty set For any language A, A  =  A = A For any language A, A  =  A = 

Properties of Concatenation Concatenation of sets is associative A(BC) = (AB)C Concatenation is not commutative AB  BA Concatenation distributes over union A(B  C) = AB  AC Concat does NOT distribute over intersection A(B  C)  AB  AC

Exercises Denning, p48, No – 2.31 No Let A, B, C be arbitrary languages on an alphabet V. If true, then prove. Else give a counterexample: A(BA)* = (AB)*A (AB)* = A*B* A(B*  C*) = AB*  AC*