The document defines deterministic finite automata (DFA) and provides examples to illustrate their components and operation. It then discusses applications of finite automata in areas like compiler construction, hardware design, games, and more. The document also defines non-deterministic finite automata (NFA) and describes the process to convert an NFA to an equivalent DFA in 4 steps: 1) Set the starting state, 2) Determine new states and transitions, 3) Identify accepting states, 4) Make the starting state accepting if epsilon is allowed. An example NFA is converted to DFA using this process.
This document provides an introduction to automata theory and finite automata. It defines an automaton as an abstract computing device that follows a predetermined sequence of operations automatically. A finite automaton has a finite number of states and can be deterministic or non-deterministic. The document outlines the formal definitions and representations of finite automata. It also discusses related concepts like alphabets, strings, languages, and the conversions between non-deterministic and deterministic finite automata. Methods for minimizing deterministic finite automata using Myhill-Nerode theorem and equivalence theorem are also introduced.
This document provides information about non-deterministic finite automata (NFA) and deterministic finite automata (DFA). It defines what an automaton is and explains that a finite automaton has a finite number of states. An automaton can be represented as a 5-tuple containing the states, alphabet, transition function, initial state, and final states. It then discusses the differences between NFAs and DFAs, including that NFAs allow non-deterministic (multiple) transitions while DFAs only allow single deterministic transitions. The document provides an example of an NFA and DFA for the regular expression (a|b)*abb.
The document discusses techniques for converting non-deterministic finite automata (NFAs) to deterministic finite automata (DFAs) in three steps:
1) Using subset construction to determinize an NFA by considering sets of reachable states from each transition as single states in the DFA.
2) Minimizing the number of states in the resulting DFA using an algorithm that merges equivalent states that have identical transitions for all inputs.
3) Computing equivalent state sets using partition refinement, which iteratively partitions states based on their transitions for each input symbol.
Finite automata is a state machine that takes a string of symbols as input and changes states accordingly. It consists of a finite set of states, input symbols, a start state, final states, and a transition function. Finite automata can be deterministic (DFA) or nondeterministic (NFA). A DFA transitions to exactly one state for each input, while an NFA may transition to multiple states. NFAs allow empty string transitions while DFAs do not.
NFA to DFA Conversion Using Subset Construction MethodZihan Islam
Explore a step-by-step guide to converting a Non-deterministic Finite Automaton (NFA) into a Deterministic Finite Automaton (DFA) using the Subset Construction Method. This presentation created by American International University Bangladesh, covers the key concepts, detailed examples, and practical tips for mastering the transformation process. Perfect for students, educators, and anyone learning automata theory.
Topics include:
1. NFA TO DFA (Subset Construction Method)
2. Subset Construction Algorithm
3. DFA Designing
4. Example
5. Exercise
6. References
Download the slides to strengthen your understanding of automata theory!
Here are the steps to solve the assignments:
1. Draw NFA and DFA over L = {0, 1} where machine should only accept at least two 1s
NFA:
A
1
B
0,1
1
C
DFA:
A
1
B
1
C
2. Draw DFA for following state transition table of NFA:
A {A} {A, B}
B {C} {C}
C Փ Փ
0 1
DFA:
A
0,1
B
1
C
The key steps are to identify the states of the N
This document provides an overview of automata and formal languages. It defines key terms like automata, finite automata, deterministic finite automaton (DFA), non-deterministic finite automaton (NDFA), and grammars. It also explains the differences between DFAs and NDFAs, and between Mealy and Moore machines. Formal definitions of these concepts are given using common notation like tuples.
This document discusses the limits of deterministic finite automata (DFAs) and nondeterministic finite automata (NDFAs). It shows that some languages, such as the language of palindromes, cannot be recognized by a DFA. While NDFAs are more powerful than DFAs, any NDFA can be converted to an equivalent DFA. The document provides an example of converting an NDFA to a DFA by constructing a new DFA with powerset states based on the NDFA's transition function. In conclusion, finite automata are not powerful enough to recognize languages like arithmetic expressions; more powerful machines will be discussed in later chapters.
The document discusses compilers and their components. It begins by defining a compiler as a program that translates programs written in one language into another language. It then describes the main components of a compiler: lexical analysis, syntax analysis, semantic analysis, code generation, and code optimization. The document provides details on each component and how they work together in the compilation process from a source language to a target language.
This document defines and provides examples of deterministic finite automata (DFAs). It begins by defining a DFA as a finite state machine where the transition function is deterministic. Formally, a DFA is defined as a 5-tuple consisting of a finite set of states, a finite input alphabet, a transition function, an initial state, and a set of final/accepting states. The document provides examples of representing DFAs using state diagrams and transition tables and discusses how to represent the extended transition function. It concludes by posing several problems about designing DFAs with certain language definitions.
1. Regular expressions are used to compactly represent sets of strings and are the basis for specifying patterns in lexical analysis.
2. Finite state automata are constructed to recognize strings belonging to the language defined by a regular expression. For every regular expression there is a corresponding finite state automaton.
3. The input string is checked for membership in the regular language by tracing a path through the automaton corresponding to the regular expression. If a complete path is found that reads the input string, it is accepted.
The document discusses deterministic finite automata (DFA) and regular languages. It defines a DFA as a 5-tuple (Q, Σ, δ, q0, F) where Q is a finite set of states, Σ is an input alphabet, δ is the transition function, q0 is the initial state, and F is a set of accepting states. A language is regular if there exists a DFA that accepts it. The document provides several examples of DFAs and the regular languages they accept.
This document contains information about a computer science examination from May 2017, including sections and questions. Section A contains 10 two-mark questions about topics like finite automata, regular expressions, pumping lemma, context-free grammars, pushdown automata, Turing machines, and Post correspondence problem. Section B has 5 five-mark questions. Section C contains 3 fifteen-mark questions. Section D has 1 ten-mark question. The document provides details about the exam format, sections, question types and marks for each question.
This document contains information about a computer science examination from May 2017, including sections and questions. Section A contains 10 two-mark questions about topics like finite automata, regular expressions, pumping lemma, context-free grammars, pushdown automata, Turing machines, and Post correspondence problem. Section B has 5 five-mark questions. Section C contains 3 fifteen-mark questions. Section D has 1 ten-mark question. The document provides details about the exam format, sections, question types and marks for each question.
This document contains information about a computer science examination from May 2017, including sections and questions. Section A contains 10 two-mark questions about topics like finite automata, regular expressions, pumping lemma, context-free grammars, pushdown automata, Turing machines, and Post correspondence problem. Section B has 5 five-mark questions. Section C contains 3 fifteen-mark questions. Section D has 1 ten-mark question. The document provides details about the exam format, sections, question types and marks for each question.
This document discusses finite automata, including:
- Finite automata are machines that recognize patterns in input sequences.
- There are two main types: deterministic finite automata (DFAs) and non-deterministic finite automata (NFAs).
- DFAs have a single transition between states for each input, while NFAs may have multiple possible next states for each input.
1. The document discusses various concepts in automata theory including finite automata, deterministic finite automata (DFA), pushdown automata (PDA), Mealy machines, and Moore machines.
2. It provides examples of alphabets, strings, and languages in automata. It also explains the key components of finite automata, DFAs, Mealy machines, Moore machines, and PDAs.
3. The document solves examples of DFAs that do or do not accept certain strings and compares the differences between Mealy machines and Moore machines.
Finite automata can be used to model software for designing digital circuits, lexical analyzers for compilers, and searching files or protocols. Nondeterministic finite automata (NFAs) can be converted to deterministic finite automata (DFAs) using the subset construction algorithm. This algorithm works by taking the epsilon closure of states and using those closures to form the states of the new DFA along with a transition table.
This document contains the solutions to homework 3 for the course CS 341: Foundations of Computer Science II. It includes solutions to problems involving constructing NFAs and DFAs for various languages, proving properties of NFAs and regular expressions, and constructing regular expressions and DFAs.
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...parmeet834
CS 162 Fall 2015
Homework 1 Problems
September 29, 2015 Timothy Johnson
1. Exercise 2.2.4 on page 53 of Hopcroft et al. Give DFA’s accepting the following languages over the alphabet {0,1}. (a) The set of all strings ending in 0
The document provides an introduction to automata theory and finite automata. It discusses key concepts such as alphabets, strings, languages, deterministic finite automata (DFAs), nondeterministic finite automata (NFAs), epsilon-NFAs, and the process of converting an NFA to a DFA using subset construction. The summary is:
[1] Automata theory studies abstract computing devices called automata and finite automata are a useful model for hardware and software. [2] Finite automata can be deterministic (DFAs) or nondeterministic (NFAs) and accept regular languages. [3] NFAs allow ambiguous transitions while DFAs have a single unambiguous transition for each state
The document discusses finite automata and deterministic finite automata (DFAs) in particular. It defines DFAs using a 5-tuple notation and explains that a DFA has a single possible state transition for each input symbol. The document provides examples of constructing DFAs to recognize specific languages and describes the step-by-step process of using a DFA to determine if a string is accepted by the language. It also gives examples of building DFAs for languages containing certain substrings and strings with a minimum length.
This document describes the process of converting a non-deterministic finite automaton (NFA) to a deterministic finite automaton (DFA) using subset construction. It provides examples to demonstrate how to determine the states and transitions of the equivalent DFA by tracking all possible states the NFA could be in after reading each input symbol. The key steps involve using e-closure and move operations on state sets to iteratively build up the DFA states and transition table until all states are determined.
Formal Languages and Automata Theory Unit 1Srimatre K
The document describes the minimization of a deterministic finite automaton (DFA) using the equivalence theorem. It involves partitioning the states into sets where states in the same set are indistinguishable based on their transitions. The initial partition P0 separates final and non-final states. Subsequent partitions P1, P2, etc. further split sets if states within are distinguishable. The process stops when the partition no longer changes, resulting in the minimized DFA with states merged within each final set. An example application of the steps to a 6-state DFA is also provided.
This document discusses the limits of deterministic finite automata (DFAs) and nondeterministic finite automata (NDFAs). It shows that some languages, such as the language of palindromes, cannot be recognized by a DFA. While NDFAs are more powerful than DFAs, any NDFA can be converted to an equivalent DFA. The document provides an example of converting an NDFA to a DFA by constructing a new DFA with powerset states based on the NDFA's transition function. In conclusion, finite automata are not powerful enough to recognize languages like arithmetic expressions; more powerful machines will be discussed in later chapters.
The document discusses compilers and their components. It begins by defining a compiler as a program that translates programs written in one language into another language. It then describes the main components of a compiler: lexical analysis, syntax analysis, semantic analysis, code generation, and code optimization. The document provides details on each component and how they work together in the compilation process from a source language to a target language.
This document defines and provides examples of deterministic finite automata (DFAs). It begins by defining a DFA as a finite state machine where the transition function is deterministic. Formally, a DFA is defined as a 5-tuple consisting of a finite set of states, a finite input alphabet, a transition function, an initial state, and a set of final/accepting states. The document provides examples of representing DFAs using state diagrams and transition tables and discusses how to represent the extended transition function. It concludes by posing several problems about designing DFAs with certain language definitions.
1. Regular expressions are used to compactly represent sets of strings and are the basis for specifying patterns in lexical analysis.
2. Finite state automata are constructed to recognize strings belonging to the language defined by a regular expression. For every regular expression there is a corresponding finite state automaton.
3. The input string is checked for membership in the regular language by tracing a path through the automaton corresponding to the regular expression. If a complete path is found that reads the input string, it is accepted.
The document discusses deterministic finite automata (DFA) and regular languages. It defines a DFA as a 5-tuple (Q, Σ, δ, q0, F) where Q is a finite set of states, Σ is an input alphabet, δ is the transition function, q0 is the initial state, and F is a set of accepting states. A language is regular if there exists a DFA that accepts it. The document provides several examples of DFAs and the regular languages they accept.
This document contains information about a computer science examination from May 2017, including sections and questions. Section A contains 10 two-mark questions about topics like finite automata, regular expressions, pumping lemma, context-free grammars, pushdown automata, Turing machines, and Post correspondence problem. Section B has 5 five-mark questions. Section C contains 3 fifteen-mark questions. Section D has 1 ten-mark question. The document provides details about the exam format, sections, question types and marks for each question.
This document contains information about a computer science examination from May 2017, including sections and questions. Section A contains 10 two-mark questions about topics like finite automata, regular expressions, pumping lemma, context-free grammars, pushdown automata, Turing machines, and Post correspondence problem. Section B has 5 five-mark questions. Section C contains 3 fifteen-mark questions. Section D has 1 ten-mark question. The document provides details about the exam format, sections, question types and marks for each question.
This document contains information about a computer science examination from May 2017, including sections and questions. Section A contains 10 two-mark questions about topics like finite automata, regular expressions, pumping lemma, context-free grammars, pushdown automata, Turing machines, and Post correspondence problem. Section B has 5 five-mark questions. Section C contains 3 fifteen-mark questions. Section D has 1 ten-mark question. The document provides details about the exam format, sections, question types and marks for each question.
This document discusses finite automata, including:
- Finite automata are machines that recognize patterns in input sequences.
- There are two main types: deterministic finite automata (DFAs) and non-deterministic finite automata (NFAs).
- DFAs have a single transition between states for each input, while NFAs may have multiple possible next states for each input.
1. The document discusses various concepts in automata theory including finite automata, deterministic finite automata (DFA), pushdown automata (PDA), Mealy machines, and Moore machines.
2. It provides examples of alphabets, strings, and languages in automata. It also explains the key components of finite automata, DFAs, Mealy machines, Moore machines, and PDAs.
3. The document solves examples of DFAs that do or do not accept certain strings and compares the differences between Mealy machines and Moore machines.
Finite automata can be used to model software for designing digital circuits, lexical analyzers for compilers, and searching files or protocols. Nondeterministic finite automata (NFAs) can be converted to deterministic finite automata (DFAs) using the subset construction algorithm. This algorithm works by taking the epsilon closure of states and using those closures to form the states of the new DFA along with a transition table.
This document contains the solutions to homework 3 for the course CS 341: Foundations of Computer Science II. It includes solutions to problems involving constructing NFAs and DFAs for various languages, proving properties of NFAs and regular expressions, and constructing regular expressions and DFAs.
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...parmeet834
CS 162 Fall 2015
Homework 1 Problems
September 29, 2015 Timothy Johnson
1. Exercise 2.2.4 on page 53 of Hopcroft et al. Give DFA’s accepting the following languages over the alphabet {0,1}. (a) The set of all strings ending in 0
The document provides an introduction to automata theory and finite automata. It discusses key concepts such as alphabets, strings, languages, deterministic finite automata (DFAs), nondeterministic finite automata (NFAs), epsilon-NFAs, and the process of converting an NFA to a DFA using subset construction. The summary is:
[1] Automata theory studies abstract computing devices called automata and finite automata are a useful model for hardware and software. [2] Finite automata can be deterministic (DFAs) or nondeterministic (NFAs) and accept regular languages. [3] NFAs allow ambiguous transitions while DFAs have a single unambiguous transition for each state
The document discusses finite automata and deterministic finite automata (DFAs) in particular. It defines DFAs using a 5-tuple notation and explains that a DFA has a single possible state transition for each input symbol. The document provides examples of constructing DFAs to recognize specific languages and describes the step-by-step process of using a DFA to determine if a string is accepted by the language. It also gives examples of building DFAs for languages containing certain substrings and strings with a minimum length.
This document describes the process of converting a non-deterministic finite automaton (NFA) to a deterministic finite automaton (DFA) using subset construction. It provides examples to demonstrate how to determine the states and transitions of the equivalent DFA by tracking all possible states the NFA could be in after reading each input symbol. The key steps involve using e-closure and move operations on state sets to iteratively build up the DFA states and transition table until all states are determined.
Formal Languages and Automata Theory Unit 1Srimatre K
The document describes the minimization of a deterministic finite automaton (DFA) using the equivalence theorem. It involves partitioning the states into sets where states in the same set are indistinguishable based on their transitions. The initial partition P0 separates final and non-final states. Subsequent partitions P1, P2, etc. further split sets if states within are distinguishable. The process stops when the partition no longer changes, resulting in the minimized DFA with states merged within each final set. An example application of the steps to a 6-state DFA is also provided.
This chapter provides an in-depth overview of the viscosity of macromolecules, an essential concept in biophysics and medical sciences, especially in understanding fluid behavior like blood flow in the human body.
Key concepts covered include:
✅ Definition and Types of Viscosity: Dynamic vs. Kinematic viscosity, cohesion, and adhesion.
⚙️ Methods of Measuring Viscosity:
Rotary Viscometer
Vibrational Viscometer
Falling Object Method
Capillary Viscometer
🌡️ Factors Affecting Viscosity: Temperature, composition, flow rate.
🩺 Clinical Relevance: Impact of blood viscosity in cardiovascular health.
🌊 Fluid Dynamics: Laminar vs. turbulent flow, Reynolds number.
🔬 Extension Techniques:
Chromatography (adsorption, partition, TLC, etc.)
Electrophoresis (protein/DNA separation)
Sedimentation and Centrifugation methods.
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 795 from Texas, New Mexico, Oklahoma, and Kansas. 95 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessMark Soia
Boost your chances of passing the 2V0-11.25 exam with CertsExpert reliable exam dumps. Prepare effectively and ace the VMware certification on your first try
Quality dumps. Trusted results. — Visit CertsExpert Now: https://www.certsexpert.com/2V0-11.25-pdf-questions.html
As of Mid to April Ending, I am building a new Reiki-Yoga Series. No worries, they are free workshops. So far, I have 3 presentations so its a gradual process. If interested visit: https://www.slideshare.net/YogaPrincess
https://ldmchapels.weebly.com
Blessings and Happy Spring. We are hitting Mid Season.
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...Celine George
Analytic accounts are used to track and manage financial transactions related to specific projects, departments, or business units. They provide detailed insights into costs and revenues at a granular level, independent of the main accounting system. This helps to better understand profitability, performance, and resource allocation, making it easier to make informed financial decisions and strategic planning.
INTRO TO STATISTICS
INTRO TO SPSS INTERFACE
CLEANING MULTIPLE CHOICE RESPONSE DATA WITH EXCEL
ANALYZING MULTIPLE CHOICE RESPONSE DATA
INTERPRETATION
Q & A SESSION
PRACTICAL HANDS-ON ACTIVITY
How to Subscribe Newsletter From Odoo 18 WebsiteCeline George
Newsletter is a powerful tool that effectively manage the email marketing . It allows us to send professional looking HTML formatted emails. Under the Mailing Lists in Email Marketing we can find all the Newsletter.
The Pala kings were people-protectors. In fact, Gopal was elected to the throne only to end Matsya Nyaya. Bhagalpur Abhiledh states that Dharmapala imposed only fair taxes on the people. Rampala abolished the unjust taxes imposed by Bhima. The Pala rulers were lovers of learning. Vikramshila University was established by Dharmapala. He opened 50 other learning centers. A famous Buddhist scholar named Haribhadra was to be present in his court. Devpala appointed another Buddhist scholar named Veerdeva as the vice president of Nalanda Vihar. Among other scholars of this period, Sandhyakar Nandi, Chakrapani Dutta and Vajradatta are especially famous. Sandhyakar Nandi wrote the famous poem of this period 'Ramcharit'.
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 817 from Texas, New Mexico, Oklahoma, and Kansas. 97 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
CURRENT CASE COUNT: 817 (As of 05/3/2025)
• Texas: 688 (+20)(62% of these cases are in Gaines County).
• New Mexico: 67 (+1 )(92.4% of the cases are from Eddy County)
• Oklahoma: 16 (+1)
• Kansas: 46 (32% of the cases are from Gray County)
HOSPITALIZATIONS: 97 (+2)
• Texas: 89 (+2) - This is 13.02% of all TX cases.
• New Mexico: 7 - This is 10.6% of all NM cases.
• Kansas: 1 - This is 2.7% of all KS cases.
DEATHS: 3
• Texas: 2 – This is 0.31% of all cases
• New Mexico: 1 – This is 1.54% of all cases
US NATIONAL CASE COUNT: 967 (Confirmed and suspected):
INTERNATIONAL SPREAD (As of 4/2/2025)
• Mexico – 865 (+58)
‒Chihuahua, Mexico: 844 (+58) cases, 3 hospitalizations, 1 fatality
• Canada: 1531 (+270) (This reflects Ontario's Outbreak, which began 11/24)
‒Ontario, Canada – 1243 (+223) cases, 84 hospitalizations.
• Europe: 6,814
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsDrNidhiAgarwal
Unemployment is a major social problem, by which not only rural population have suffered but also urban population are suffered while they are literate having good qualification.The evil consequences like poverty, frustration, revolution
result in crimes and social disorganization. Therefore, it is
necessary that all efforts be made to have maximum.
employment facilities. The Government of India has already
announced that the question of payment of unemployment
allowance cannot be considered in India
GDGLSPGCOER - Git and GitHub Workshop.pptxazeenhodekar
This presentation covers the fundamentals of Git and version control in a practical, beginner-friendly way. Learn key commands, the Git data model, commit workflows, and how to collaborate effectively using Git — all explained with visuals, examples, and relatable humor.
How to Set warnings for invoicing specific customers in odooCeline George
Odoo 16 offers a powerful platform for managing sales documents and invoicing efficiently. One of its standout features is the ability to set warnings and block messages for specific customers during the invoicing process.
Odoo Inventory Rules and Routes v17 - Odoo SlidesCeline George
Odoo's inventory management system is highly flexible and powerful, allowing businesses to efficiently manage their stock operations through the use of Rules and Routes.
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetSritoma Majumder
Introduction
All the materials around us are made up of elements. These elements can be broadly divided into two major groups:
Metals
Non-Metals
Each group has its own unique physical and chemical properties. Let's understand them one by one.
Physical Properties
1. Appearance
Metals: Shiny (lustrous). Example: gold, silver, copper.
Non-metals: Dull appearance (except iodine, which is shiny).
2. Hardness
Metals: Generally hard. Example: iron.
Non-metals: Usually soft (except diamond, a form of carbon, which is very hard).
3. State
Metals: Mostly solids at room temperature (except mercury, which is a liquid).
Non-metals: Can be solids, liquids, or gases. Example: oxygen (gas), bromine (liquid), sulphur (solid).
4. Malleability
Metals: Can be hammered into thin sheets (malleable).
Non-metals: Not malleable. They break when hammered (brittle).
5. Ductility
Metals: Can be drawn into wires (ductile).
Non-metals: Not ductile.
6. Conductivity
Metals: Good conductors of heat and electricity.
Non-metals: Poor conductors (except graphite, which is a good conductor).
7. Sonorous Nature
Metals: Produce a ringing sound when struck.
Non-metals: Do not produce sound.
Chemical Properties
1. Reaction with Oxygen
Metals react with oxygen to form metal oxides.
These metal oxides are usually basic.
Non-metals react with oxygen to form non-metallic oxides.
These oxides are usually acidic.
2. Reaction with Water
Metals:
Some react vigorously (e.g., sodium).
Some react slowly (e.g., iron).
Some do not react at all (e.g., gold, silver).
Non-metals: Generally do not react with water.
3. Reaction with Acids
Metals react with acids to produce salt and hydrogen gas.
Non-metals: Do not react with acids.
4. Reaction with Bases
Some non-metals react with bases to form salts, but this is rare.
Metals generally do not react with bases directly (except amphoteric metals like aluminum and zinc).
Displacement Reaction
More reactive metals can displace less reactive metals from their salt solutions.
Uses of Metals
Iron: Making machines, tools, and buildings.
Aluminum: Used in aircraft, utensils.
Copper: Electrical wires.
Gold and Silver: Jewelry.
Zinc: Coating iron to prevent rusting (galvanization).
Uses of Non-Metals
Oxygen: Breathing.
Nitrogen: Fertilizers.
Chlorine: Water purification.
Carbon: Fuel (coal), steel-making (coke).
Iodine: Medicines.
Alloys
An alloy is a mixture of metals or a metal with a non-metal.
Alloys have improved properties like strength, resistance to rusting.
2.
2
A Finite-State Machine (1)
A Finite-State Machine (1)
A finite state machine is a mathematical model of a
A finite state machine is a mathematical model of a
system, with discrete inputs and outputs
system, with discrete inputs and outputs
3.
3
A Finite-State Machine (2)
A Finite-State Machine (2)
Finite Automata FA:
Finite Automata FA:
a finite set of states
a set of transitions (edges)
a start state
a set of final states
Defining a FA is a kind of programming.
Defining a FA is a kind of programming.
Problem definition
Problem definition
Includes defining possible actions & accepting
condition.
States
States
structure of program
structure of program
Includes designating which are initial & final.
Transitions
Transitions
program
program
4.
4
2.1: Deterministic Finite Automata (1)
2.1: Deterministic Finite Automata (1)
DFA M = (Q,
DFA M = (Q,
,
,
,
, q
q0
0, F)
, F)
Q = a finite set of states
= a finite set called the alphabet
= transition function
total function Q Q
q0 = start state q0 Q
F = final or accepting states F Q
5.
5
Deterministic Finite Automata (2)
Deterministic Finite Automata (2)
DFA M
DFA M
Q = {q0, q1}
= {a, b}
F = {q1}
The transition function is given in a tabular
form called the transition table
(q0, a) = q1 (q0, b) = q0
(q1, a) = q1 (q1, b) = q0
6.
6
Deterministic Finite Automata (3)
Deterministic Finite Automata (3)
A
A DFA
DFA M can be considered to be a language
M can be considered to be a language
acceptor.
acceptor.
The
The language
language of M,
of M, L(M)
L(M), is the set of strings
, is the set of strings
*
*
accepted by M.
accepted by M.
A
A DFA
DFA M reads an input string from left to right.
M reads an input string from left to right.
The
The next state
next state depends on the
depends on the current state
current state and
and
the
the unread (unprocessed) symbol
unread (unprocessed) symbol.
.
7.
7
Deterministic Finite Automata (5)
Deterministic Finite Automata (5)
The DFA
The DFA M
M accepts the set of strings over {a, b} that
accepts the set of strings over {a, b} that
contain the substring
contain the substring bb
bb
M : Q = {q0, q1, q2}, = {a, b}, F = {q2}
The transition function is given in a tabular form
called the transition table
(q0, a) = q0 (q0, b) = q1
(q1, a) = q0 (q1, b) = q2
(q2, a) = q2 (q2, b) = q2
Is
Is abba
abba
L(M)? Yes, since the computation halts in state
L(M)? Yes, since the computation halts in state
q
q2
2, which is a final state
, which is a final state
Is
Is abab
abab
L(M)? No, since the computation halts in state
L(M)? No, since the computation halts in state
q
q1
1, which is
, which is NOT
NOT a final state
a final state
8.
8
Deterministic Finite Automata (6)
Deterministic Finite Automata (6)
Extended transition function
Extended transition function
*
*
of a DFA with
of a DFA with
transition function
transition function
is a function from Q
is a function from Q
*
*
Q
Q
defined recursively on the length of the input string
defined recursively on the length of the input string
w
w
Basis: |w| = 0. Then w = and *
(qi, ) = qi
Recursive step: Let |w| = 1. Then
*
(qi, av) = *
((qi, a), v)
qi Q, a , v *
9.
9
Deterministic Finite Automata (7)
Deterministic Finite Automata (7)
A string
A string w
w is accepted if
is accepted if
*
*
(q
(q0
0,
, w
w)
)
F
F
The language of a DFA
The language of a DFA M
M is
is
L(M) = {w *
| *
(q0, w) F}
DFA M = (Q,
DFA M = (Q,
,
,
, q
, q0
0, F) accepts
, F) accepts w
w
*
*
*
(q0, w) F
10.
10
Deterministic Finite Automata (8)
Deterministic Finite Automata (8)
Two possibilities for DFA M running on
Two possibilities for DFA M running on w
w
M accepts w
M accepts w iff the computation of M on w ends up
(halts) in an accepting configuration
*
(q0, w) F
M rejects w
M rejects w iff the computation of M on w ends up
(halts) in a rejecting configuration
*
(q0, w) F
11.
11
The state diagram of a DFA M =
The state diagram of a DFA M = (Q,
(Q,
,
,
,q
,q0
0, F)
, F) is a
is a
labeled graph
labeled graph G
G defined by the following
defined by the following
conditions:
conditions:
The nodes of G are the elements of Q
The labels on the arcs of G are elements of
q0 is the start node, denoted by
F is the set of accepting nodes, denoted by
There is an arc from node qi to qj labeled a if
(qi, a) = qj
For every node qi and symbol a , there is
exactly one arc labeled a leaving qi
State Diagrams and Examples (1)
State Diagrams and Examples (1)
q0
a
12.
12
State Diagrams and Examples (2)
State Diagrams and Examples (2)
Deterministic Finite Automata DFA
Deterministic Finite Automata DFA
all outgoing edges are labelled with an input
character
no state has - transition, transition on input
no two edges leaving a given state have the
same label
for each state s and input symbol a, there is at most
one edge label a leaving s
Therefore: the next state can be determined
uniquely, given the current state and the current
input character
13.
13
State Diagrams and Examples (1)
State Diagrams and Examples (1)
strings over {
strings over {a
a,
,b
b} with at least 3
} with at least 3 a
a’s
’s
1 a 2 a 3+ a
0 a
a a a
b b b
14.
14
State Diagrams and Examples (2)
State Diagrams and Examples (2)
strings over {
strings over {a
a,
,b
b} with length mod 3 = 0
} with length mod 3 = 0
1 2
0
15.
15
State Diagrams and Examples (3)
State Diagrams and Examples (3)
strings over {
strings over {a
a,
,b
b}
} without
without 3 consecutive
3 consecutive a
a’s
’s
A simple example of “strings not of the form …”.
A simple example of “strings not of the form …”.
1 a 2 a
Has
aaa
0 a
a a a
b
b
b
16.
16
State Diagrams and Examples (4)
State Diagrams and Examples (4)
Draw a state diagram for DFA
Draw a state diagram for DFA M
M that accepts the
that accepts the
set of strings over {a, b} that contain the substring
set of strings over {a, b} that contain the substring
bb
bb
The string
The string ababb
ababb is accepted since the halting state
is accepted since the halting state
is the accepting state
is the accepting state q
q2
2
q1 q2
q0
b b
a
a
a, b
17.
17
State Diagrams and Examples (5)
State Diagrams and Examples (5)
The DFA
The DFA
accepts (
accepts (b
b|
|ab
ab)
)*
*
(
(a
a|
|
)
)
the set of strings over {a, b} that
the set of strings over {a, b} that do not
do not contain
contain
the substring
the substring aa
aa
1 a 2 a
0 a
a a
b
b
18.
18
State Diagrams and Examples (6)
State Diagrams and Examples (6)
The language {
The language {a
an
n
b
bn
n
,
, n
n
0} is not regular, so we can not
0} is not regular, so we can not
build a DFA that accept this language
build a DFA that accept this language
It needs an infinite number of states
It needs an infinite number of states
But {
But {a
an
n
b
bn
n
, 1
, 1
n
n
3} is regular and its DFA is
3} is regular and its DFA is
q0
a q1
a q2
a q3
q4
b
q5
b
b
q6
b
b
This DFA is NOT
Complete
19.
19
State Diagrams and Examples (7)
State Diagrams and Examples (7)
strings over {a, b} that contain the substring
strings over {a, b} that contain the substring bb
bb OR
OR
do not
do not contain the substring
contain the substring aa
aa
This language is the union of the languages of the
This language is the union of the languages of the
previous examples
previous examples
1 a 2 a
0 a
a a
b
a
1 b 2 b
b
b
a
2 a
b
a
b
20.
20
State Diagrams and Examples (8)
State Diagrams and Examples (8)
strings over {a, b} that contain an
strings over {a, b} that contain an even
even number of
number of
a
a’s
’s AND
AND an
an odd
odd number of
number of b
b’s
’s
[ea, eb] [ea, ob]
a
[oa, eb] [oa, ob]
b
a a
a
b
b
b
21.
21
State Diagrams and Examples (9)
State Diagrams and Examples (9)
Let
Let M
M be the DFA previous slide
be the DFA previous slide
A DFA
A DFA M’
M’ that accepts all strings over {a, b} that
that accepts all strings over {a, b} that do not
do not
contain an
contain an even
even number of
number of a
a’s
’s AND
AND an
an odd
odd number of
number of b
b’s
’s
is shown below
is shown below
L(M’) = {a, b}*
- L(M) = *
- L(M)
Any string accepted by
Any string accepted by M
M is rejected by
is rejected by M’
M’ and vice versa
and vice versa
[ea, eb] [ea, ob]
a
[oa, eb] [oa, ob]
b
a a
a
b
b
b
22.
22
State Diagrams and Examples (10)
State Diagrams and Examples (10)
Let
Let
= {0, 1, 2, 3}. A string in
= {0, 1, 2, 3}. A string in
*
*
is a sequence of integers
is a sequence of integers
from
from
The DFA
The DFA M
M determines whether the
determines whether the sum of elements
sum of elements of a
of a
string is
string is divisible by 4
divisible by 4
The string
The string 12302
12302 and
and 0130
0130 should be accepted and
should be accepted and 0111
0111
rejected by M
rejected by M
w mod 4 = 0
0
2 2
1
3
w mod 4 = 1
0
w mod 4 = 2
0
1
3
w mod 4 = 3
0
2 2
1
3
1
3
23.
23
State Diagrams and Examples (11)
State Diagrams and Examples (11)
DFA
DFA M1
M1 accepts
accepts (ab)
(ab)*
*
c
c
M1
M1 is
is incomplete determinism
incomplete determinism
The string
The string abcc
abcc is
is rejected
rejected since
since M1
M1 is unable to process
is unable to process
the final
the final c
c from state
from state q
q2
2
q0 q1
c
q2
a
b
M1
24.
24
State Diagrams and Examples (12)
State Diagrams and Examples (12)
M2
M2 accepts the same language as
accepts the same language as M1
M1 in previous example
in previous example
(ab)
(ab)*
*
c
c
The state
The state q
qe
e is the error state (dead end)
is the error state (dead end)
q0 q1
c
q2
a
b
qe
b
a, c
a, b, c
M2
25.
25
State Diagrams and Examples (13)
State Diagrams and Examples (13)
strings over {
strings over {a
a,
,b
b} with next-to-last symbol =
} with next-to-last symbol = a
a
…aa …ab
a
…ba …bb
a
b
b
a
b
b
b
a
a
a
a
a
b
b
b
26.
26
State Diagrams and Examples (14)
State Diagrams and Examples (14)
start
0 3
b
2
1 b
a
b
a
b
a
a
What Language is Accepted?
27.
27
2.2: Nondeterministic Finite Automata (1)
2.2: Nondeterministic Finite Automata (1)
Finite Automata : A recognizer that takes an input
string & determines whether it’s a
valid sentence of the language
Non-Deterministic : Has more than one (or no)
alternative action for the same input
symbol.
Deterministic : Has at most one action for every
given input symbol.
28.
28
Nondeterministic Finite Automata (2)
Nondeterministic Finite Automata (2)
NFA: Formal Definition
NFA: Formal Definition
NFA M = (Q,
NFA M = (Q,
,
,
, q
, q0
0, F)
, F)
Q = a finite set of states
= a finite set alphabet
= transition function
total function Q (Q) = 2Q
- power set of Q
q0 = initial/starting state q0 Q
F = final or accepting states F Q
29.
29
Nondeterministic Finite Automata (3)
Nondeterministic Finite Automata (3)
Q = { 0, 1, 2, 3 }
q0 = 0
F = { 3 }
= { a, b }
start
0 3
b
2
1 b
a
a
b
What Language is defined ?
What is the Transition Table ?
s
t
a
t
e
i n p u t
0
1
2
a b
{ 0, 1 }
{ 2 }
{ 3 }
{ 0 }
30.
30
Nondeterministic Finite Automata (4)
Nondeterministic Finite Automata (4)
Change in
Change in
For an DFA M, (q, a) results in one and only
one state for all states q and alphabet a
For an NFA M, (q, a) can result in a set of
states, zero, one, or more states:
qn
a
qi qn
a
qi
qj
qk
a
a
qn
(q
(qn
n, a) = {q
, a) = {qi
i}
}
(q
(qn
n, a) = {q
, a) = {qi
i, q
, qj ,
j , q
qk
k }
}
(q
(qn
n, a) = {} =
, a) = {} =
32.
32
Nondeterministic Finite Automata (6)
Nondeterministic Finite Automata (6)
Computing with NFA’s
Computing with NFA’s
Computations are different
Computations are different
We always start from start state. Call it the root of
We always start from start state. Call it the root of
the computation.
the computation.
Then we might go to different states on one symbol.
Then we might go to different states on one symbol.
Then from those states to new sets of states,
Then from those states to new sets of states,
creating a
creating a tree-like
tree-like computation.
computation.
If one path ends up in a final state, then ACCEPT,
If one path ends up in a final state, then ACCEPT,
else REJECT
else REJECT
33.
33
Nondeterministic Finite Automata (7)
Nondeterministic Finite Automata (7)
start
0 3
b
2
1 b
a
a
b • Given an input string, we trace moves
• If no more input & in final state, ACCEPT
EXAMPLE:
Input: ababb
Path 1: 0 -> 0 -> 0 -> 0 -> 0 -> 0
(REJECT)
Path 2: 0 -> 0 -> 0 -> 1 -> 2 -> 3
(ACCEPT)
34.
34
Nondeterministic Finite Automata (8)
Nondeterministic Finite Automata (8)
Extended transition function
Extended transition function
*
*
of a NFA with
of a NFA with
transition function
transition function
is a function from Q
is a function from Q
*
*
2
2Q
Q
(power set) defined recursively on the length of
(power set) defined recursively on the length of
the input string
the input string w
w
Basis: |w| = 0. Then w = and *
(qi, ) = {qi}
Recursive step: Let |w| = 1. Then
*
(qi, av) = U *
(qj, v), qj (qi, a)
qi Q, qj Q , a , v *
The language of a NFA
The language of a NFA M
M is
is
L(M) = {w *
| *
(q0, w) F ≠
}
35.
35
NFA (9)
NFA (9)
The state diagram
The state diagram DFA
DFA M1 and
M1 and NFA
NFA M2 accepts
M2 accepts
(a|b)
(a|b)*
*
bb(a|b)
bb(a|b)*
*
a a, b
start
0 2
1 b
b
a
M1
start
0 2
1 b
b
a, b a, b
M2
36.
36
NFA (10)
NFA (10)
An NFA that accepts string over {a, b} with
An NFA that accepts string over {a, b} with
substring
substring aa
aa or
or bb
bb
There are 2 distinct acceptance paths for the string
There are 2 distinct acceptance paths for the string
abaaabb
abaaabb
start
0 2
1 a
a
a, b a, b
4
3 b
b a, b
37.
37
NFA (11)
NFA (11)
The state diagram
The state diagram DFA
DFA M1 and
M1 and NFA
NFA M2 accepts
M2 accepts
(a|b)
(a|b)*
*
abba(a|b)
abba(a|b)*
*
start
0 4
1 b
a
b a, b
a
M1 2 b 3 a
a
b
start
0 4
1 b
a
a, b a, b
M2 2 b 3 a
38.
38
NFA with
NFA with
-Transitions (1)
-Transitions (1)
NFA with
NFA with
-transitions, denoted by NFA-
-transitions, denoted by NFA-
Formal Definition
Formal Definition
NFA-
NFA-
M = (Q,
M = (Q,
,
,
, q
, q0
0, F)
, F)
Q = a finite set of states
= a finite set alphabet
= transition function
total function Q ( (Q)
q0 = initial/starting state q0 Q
F = final or accepting states F Q
transitions
j
i
Switch state but do not
use any input symbol
39.
39
-Transitions (2)
-Transitions (2)
The input string
The input string w
w is accepted using
is accepted using NFA-
NFA-
if there
if there
is a computation that processes the
is a computation that processes the entire string
entire string
and halts in an
and halts in an accepting state
accepting state
A computation may continue using
A computation may continue using
-transition
-transition
after the input string has been completely
after the input string has been completely
processed
processed
40.
40
-Transitions (3)
-Transitions (3)
L(M
L(M1
1) = (a|b)
) = (a|b)*
*
bb(a|b)
bb(a|b)*
*
, L(M
, L(M2
2) = (b|ab)
) = (b|ab)*
*
(a|
(a|
)
)
L(M) = L(M
L(M) = L(M1
1)
)
L(M
L(M2
2)
)
q1,1 q1,2
a, b
b
b
q1,0
b
a
q2,0
0
a, b
q2,1
b
q1,1 q1,2
a, b
b
b
q1,0
a, b
b
a
q2,0 q2,1
b
M1
M
M2
41.
41
-Transitions (4)
-Transitions (4)
L(M
L(M1
1) = (a|b)
) = (a|b)*
*
bb(a|b)
bb(a|b)*
*
, L(M
, L(M2
2) = (b|ab)
) = (b|ab)*
*
(a|
(a|
)
)
L(M) = L(M
L(M) = L(M1
1)L(M
)L(M2
2)
)
q1,1 q1,2
a, b
b
b
q1,0
b
a
q2,0
a, b
q2,1
b
q1,1 q1,2
a, b
b
b
q1,0
a, b
b
a
q2,0 q2,1
b
M1
M
M2
51.
51
2.3: Equivalence of DFA & NFA (1)
2.3: Equivalence of DFA & NFA (1)
Is NFA more powerful than DFA? NO!
Is NFA more powerful than DFA? NO!
NFA inefficient to implement directly, so
convert to a DFA that recognizes the same
strings
Is there a language accepted by an NFA that is not
Is there a language accepted by an NFA that is not
accepted by any DFA? No
accepted by any DFA? No
NFA is equivalent to DFA.
NFA is equivalent to DFA.
Each state in DFA corresponds to a SET of
states of the NFA
52.
52
Removing Nondeterminism (2)
Removing Nondeterminism (2)
-closure
-closure
In an NFA-
In an NFA-
, the
, the
-closure(
-closure(q
q)
) of a state
of a state q
q is the set
is the set
of all states that can be reached from
of all states that can be reached from q
q by
by
following a path whose edges are all labeled by
following a path whose edges are all labeled by
.
.
q0 q1
q2
q3
b
a
b
Start
-closure(q0) = {q0, q1, q2, q3}
-
-closure(q1) = {q1,q3}
-
-closure(q2) = {q1,q2,q3}
53.
53
Removing Nondeterminism (3)
Removing Nondeterminism (3)
NFA- N = (Q, , , q0, F)
-closure(q) : q Q
: set of NFA- states that are reachable from q
on -transitions only
-closure(T) : T Q
: NFA- states reachable from some state t T
on -transitions only
move(T, a) : T Q, a
: set of states to which there is a transition on
input a from some state t T
move({q1, q2, …, qi}, a) = (q1, a) (q2, a) … (qi, a)
These 3 operations are utilized by algorithms /
techniques to facilitate the conversion process
No input is
consumed
54.
54
Removing Nondeterminism (4)
Removing Nondeterminism (4)
-closure(0) = {0, 1, 2, 4, 7} (all states reachable from 0 on -moves)
-closure(0, 6) = -closure(0) -closure(6)
= {0, 1, 2, 4, 7} {6, 1, 2, 4,7} = {0, 1, 2, 4,
6, 7}
move({0, 1, 2, 4, 7}, a) = {3, 8} (since move(2, a)=3 and move(7, a)=8)
0 1
2 3
5
4
6 7 8 9
10
a
a
b
b
b
start
55.
55
NFA-
NFA-
DFA
DFA with Subset Construction
with Subset Construction
NFA- N DFA M construction:
Given N = (Q, , , q0, F), define M = (Q’, , ’, q’0, F’)
Q’ P(Q), all the possible NFA- states M could be in.
q’0 = -closure(q0)
F’ = {q’ Q’ | q’ F }
’(q’, a) = -closure(move(q’, a))
DFA M has a state ERR
DFA M has a state ERR
Q’ = P(Q)
Q’ = P(Q)
serves as the “error” state, when needed
’(ERR, a) = ERR, a By definition of ’
56.
56
Subset Construction
Subset Construction
Algorithm Concepts
Algorithm Concepts
First we calculate: -closure(0) (i.e., state 0)
-closure(0) = {0, 1, 2, 4, 7} (all states reachable from 0 on -moves)
Let A = {0, 1, 2, 4, 7} be a state of new DFA M
Start with NFA-: (a | b)*abb
0 1
2 3
5
4
6 7 8 9
10
a
a
b
b
b
start
57.
57
Conversion Example (1)
Conversion Example (1)
b : -closure(move(A,b)) = -closure(move({0,1,2,4,7}, b))
adds {5} (since move(4, b) = 5)
From this we have : -closure({5}) = {1,2,4,5,6,7}
(since 5614, 67, and 12 all by -moves)
Let C = {1,2,4,5,6,7} be a new state in D. Define M(A, b) = C
2nd
, we calculate : a : -closure(move(A, a)) and
b : -closure(move(A, b))
a : -closure(move(A, a)) = -closure(move({0,1,2,4,7}, a))}
adds {3, 8} (since move(2, a) = 3 and move(7, a) = 8)
From this we have : -closure({3, 8}) = {1,2,3,4,6,7,8}
(since 3614, 67, and 12 all by -moves)
Let B = {1,2,3,4,6,7,8} be a new state in D. Define M(A, a) = B
58.
58
Conversion Example (2)
Conversion Example (2)
3rd
, we calculate for state B on {a, b}
a : -closure(move(B, a)) = -closure(move({1,2,3,4,6,7,8}, a))}
= {1,2,3,4,6,7,8} = B
Define M(B, a) = B
b : -closure(move(B, b)) = -closure(move({1,2,3,4,6,7,8}, b))}
= {1,2,4,5,6,7,9} = D
Define M(B, b) = D
4th
, we calculate for state C on {a, b}
a : -closure(move(C, a)) = -closure(move({1,2,4,5,6,7}, a))}
= {1,2,3,4,6,7,8} = B
Define M(C, a) = B
b : -closure(move(C, b)) = -closure(move({1,2,4,5,6,7}, b))}
= {1,2,4,5,6,7} = C
Define M(C, b) = C
59.
59
Conversion Example (3)
Conversion Example (3)
5th
, we calculate for state D on {a, b}
a : -closure(move(D, a)) = -closure(move({1,2,4,5,6,7,9}, a))}
= {1,2,3,4,6,7,8} = B
Define M(D, a) = B
b : -closure(move(D, b)) = -closure(move({1,2,4,5,6,7,9}, b))}
= {1,2,4,5,6,7,10} = E
Define M(D, b) = E
Finally, we calculate for state E on {a, b}
a : -closure(move(E, a)) = -closure(move({1,2,4,5,6,7,10}, a))}
= {1,2,3,4,6,7,8} = B
Define M(E, a) = B
b : -closure(move(E, b)) = -closure(move({1,2,4,5,6,7,10}, b))}
= {1,2,4,5,6,7} = C
Define M(E, b) = C
60.
60
Conversion Example (4)
Conversion Example (4)
State
Input Symbol
a b
A B C
B B D
C B C
E B C
D B E
…
A
…b
C
…a
B
…
abD
…
abbE
start b
b
b
b
b
a
a
a
a
This gives the transition table for the DFA M of:
a
61.
61
Converting NFA-
Converting NFA-
to DFA – 2
to DFA – 2nd
nd
Example
Example
0 8
5
4
7
3
6
2
1
b
a
c
RE: c*(ab)*c*
1st
we calculate: -closure(0) -closure(0) = {0, 1, 2, 6, 8}
(all states reachable from 0 on -moves)
Let A={0, 1, 2, 6, 8} be a state of new DFA M
62.
62
Conversion Example (1)
Conversion Example (1)
b : -closure(move(A,b)) = -closure(move({0,1,2,6,8}, b))
There is NO transition on b for all states 0,1,2,6 and 8
Define M(A, b) = Reject
2nd
, we calculate : a : -closure(move(A, a)) and
b : -closure(move(A, b))
c : -closure(move(A, c))
a : -closure(move(A, a)) = -closure(move({0,1,2,6,8}, a))}
adds {3} (since move(2, a) = 3)
From this we have : -closure({3}) = {3} (since 33 by -moves)
Let B = {3} be a new state. Define M(A, a) = B
c : -closure(move(A, c)) = -closure(move({0,1,2,6,8}, c))
adds {7} (since move(6, c) = 7)
From this we have : -closure({7}) = {1,2,5,6,7,8}
(since 758, 7512, and 7516 by -moves)
Let C = {1,2,5,6,7,8} be a new state. Define M(A, c) = C
63.
63
Conversion Example (2)
Conversion Example (2)
b : -closure(move(B, b)) = -closure(move({3}, b))
adds {4} (since move(3, b) = 4)
From this we have : -closure({4}) = {1,2,4,5,6,8}
(since 458, 4512, and 4516 by -moves)
Let D = {1,2,4,5,6,8} be a new state. Define M(B, b) = D
3rd
, we calculate : a : -closure(move(B, a)) and
b : -closure(move(B, b))
c : -closure(move(B, c))
a : -closure(move(B, a)) = -cclosure(move({3}, a))}
There is NO transition on a for state 3
Define M(B, a) = Reject
c : -closure(move(B, c)) = -closure(move({3}, c))
There is NO transition on c for state 3
Define M(B, c) = Reject
64.
64
Conversion Example (3)
Conversion Example (3)
b : -closure(move(C, b)) = -closure(move({1,2,5,6,7,8},b))
There is NO transition on b for all states 1,2,5,6, and 7
Define M(C, b) = Reject
4th
, we calculate : a : -closure(move(C, a)) and
b : -closure(move(C, b))
c : -closure(move(C, c))
a : -cclosure(move(C, a)) = -closure(move({1,2,5,6,7,8},a))}
adds {3} (since move(2, a) = 3)
-closure({3}) = {3} Define M(C, a) = B
c : -closure(move(C, c)) = -closure(move({1,2,5,6,7,8},c))
adds {7} (since move(6, c) = 7)
From this we have : -closure({7}) = {1,2,5,6,7,8}
(since 758, 7512, and 7516 by -moves)
Define M(C, c) = C
65.
65
Conversion Example (4)
Conversion Example (4)
b : -closure(move(D, b)) = -closure(move({1,2,4,5,6,8}, b))
There is NO transition on b for all states 1,2,4,5,6, and 8
Define M(D, b) = Reject
5th
, we calculate : a : -closure(move(D, a)) and
b : -closure(move(D, b))
c : -closure(move(D, c))
a : -closure(move(D, a)) = -closure(move({1,2,4,5,6,8},a))}
adds {3} (since move(2, a) = 3)
-closure({3}) = {3} Define M(D, a) = B
c : -closure(move(D, c)) = -closure(move({1,2,4,5,6,8},c))
adds {7} (since move(6, c) = 7)
From this we have : -closure({7}) = {1,2,5,6,7,8}
(since 758, 7512, and 7516 by -moves)
Define M(D, c) = C
66.
66
The Resulting DFA M
The Resulting DFA M
Which States are FINAL States ?
1, 2, 5, 6, 7, 8
1, 2, 4, 5, 6, 8
0, 1, 2, 6, 8 3
c
b
a
a
a
c
c
D
C
A
B
c
b
a
a
a
c
c
67.
67
NFA-
NFA-
DFA: Example
DFA: Example
strings over {a,b} with next-to-last symbol = a
a
a/b
a/b
q2
q1
q0
a b
q0 {q0, q1} {q0}
q1
{q2} {q2}
q2
M = ({q0, q1, q2}, {a,b}, , q0, {q2})
q0
q2
q0
q0
q1
q0
q1
q2
a
a
a
a
b
b
b
b
Equivalent DFA
Equivalent DFA
68.
68
An Example of NFA-
An Example of NFA-
DFA
DFA
Consider a simple NFA:
Consider a simple NFA:
Construct a corresponding DFA:
Construct a corresponding DFA:
0
1
1
Start
0 1
q0 q1
{q0}
{q0, q1}
{q1}
ERR
ERR
Start 1
0 1
0
1,0 1,0
70.
70
Class Discussion
Class Discussion
Construct a DFA equivalent to this NFA:
Construct a DFA equivalent to this NFA:
Start
0,1
q0 q1
0 q2
1
{q0, q1}
Start
1
{q0}
0 1 {q0,q2}
0
1
0
0
71.
71
b
a,b,c
An NFA
a
1 2
a
0
b,c
c
start
Notice that the state with label {0, 1, 2} is from the set of states given by the
nondeterministic transition (0, a) = {0, 1, 2}. Also notice that any state
whose label contains an accepting state is defined as an accepting state in the
deterministic machine.
{0,1,2}
{2}
a
a
{1,2}
b
c
b
c
c
Converted DFA
0
start
b,c
Class Discussion
Class Discussion
72.
72
2.4 Reduction of the Number of States in FA
2.4 Reduction of the Number of States in FA
Self study
Self study
but not included in the exams material