Theory of Computation Study Notes
Theory of Computation - CSE1008
- Instructor: Dr. Manomita Chakraborty
- Affiliation: SCOPE, VIT-AP University, Amaravati, AP, India
- Date: 3/10/2026
MODULE 3 & 4
- Coverage of closure properties for regular languages, decision properties, and applications of regular grammar.
Closure Properties for Regular Languages
- Definition: A closure property is a characteristic of a class of languages such that applying specific operations (union, intersection, etc.) to languages within that class results in a language that remains within the same class.
Closure Properties
Union Operation:
- For languages L and M represented by regular expressions R and S, respectively,
- The resulting regular expression is , which denotes the language L igcup M.
- Example: If L = {0, 1} and M = {10, 11}, then R + S = {0, 1, 10, 11}.
Intersection:
- Given languages L and M, the regular expression for their intersection can be represented as:
- R ext{ for } L igcap M.
Complement:
- The complement of a language L over an alphabet Σ is defined as .
- Since is regular, the complement of a regular language is always regular.
Kleen Closure:
- For any regular expression R, defines a language that can be formed by concatenating strings in L zero or more times.
Positive Closure:
- For a language L, is a regular expression denoting one or more concatenations of strings in L.
Reverse Operator:
- Given a language L, defines the set of strings whose reversal is in L.
- Example: If L = {0, 01, 100}, then .
Set Difference Operator:
- If L and M are regular languages, then represents the set of strings in L but not in M.
Homomorphism:
- A mapping that substitutes each symbol of an input language with a string, resulting in another language that is also regular.
- Example: If and , and given L = {aa, bab}, then .
- If L is regular and H is a homomorphism, then is regular.
Inverse Homomorphism:
- The process of mapping elements of a homomorphic language back to the original. If L is regular, then its inverse homomorphism H^{-1}(L) is also regular.
- Example: If , , and , taking L = {0011001}, we get .
Decision Properties for Regular Languages
Definition: A decision property is characterized by algorithms that determine whether certain conditions hold for formal language structures, such as Deterministic Finite Automata (DFA).
Bibliography: Review sections 4.2 and 4.3 from "Automata Theory, Languages, and Computation" by John E. Hopcroft, Rajeev Motwani, and Jeffrey D. Ullman.
Applications of Regular Grammar
- Use cases for regular grammar include:
- Lexical analyzers in compilers
- Text searching
- Pattern matching (like regex)
- Finite state machines in digital design
- Regular grammars need to be in standard forms:
- Right Linear
- Left Linear
Right Linear Grammar
- In right linear grammar, non-terminals appear on the rightmost side of the production:
- Syntax: A ⇢ a | aB | ε
- Example Productions:
Left Linear Grammar
- In left linear grammar, non-terminals exist at the leftmost side of the production:
- Syntax: A ⇢ a | Ba | ε
- Example Productions:
Finite Automata to Right Linear Grammar
- Steps to convert:
- Define states on input 'a':
- Define states on input 'b':
- Continue similar definitions for B and C.
- Add final state transitions accordingly.
Finite Automata to Left Linear Grammar
- Steps involve:
- Reverse the finite automata.
- Write in right linear grammar format.
- Reverse the right linear grammar to obtain left linear grammar.
Context-Free Grammar (CFG)
- Definition: A CFG is represented as a quadruple (V, T, P, S) where:
- V: Set of non-terminal symbols
- T: Set of terminal symbols where V ∩ T = ∅
- P: Finite set of production rules of the form A → α
- S: The start symbol
Example CFGs
1.** CFG for language {a, b, c}:**
- CFG for nested structures:
Context-Free Languages
- Definition: CFGs define context-free languages (CFLs).
- If is a CFG, then is the language of G.
- Properties:
- CFGs are powerful in representing nested structures.
- Some languages, like {0^n1^n | n ≥ 0}, are CFL yet not regular.
Applications of Context-Free Languages
- Used in compiler parsing, markup languages (like HTML/XML), and syntactic checking for programming constructs.
Derivations in Context-Free Grammars
- Derivation Definition: The process of replacing variables in a string with the right side of production rules to produce strings purely composed of terminals.
- Examples of derivation sequences and parse trees are provided for various context-free languages.
Ambiguity in Context-Free Grammars
- A context-free grammar is ambiguous if a string can have more than one valid derivation tree.
- Discussion includes methods to remove ambiguity, such as left factoring and precedence rules.