Automata theory - describes to derives string from Context free grammar - derivation and parse tree
normal forms - Chomsky normal form and Griebah normal form
Automata theory - describes to derives string from Context free grammar - derivation and parse tree
normal forms - Chomsky normal form and Griebah normal form
Pushdown Automata
Chapter 12
Recognizing Context-Free Languages
Two notions of recognition:
(1) Say yes or no, just like with FSMs
(2) Say yes or no, AND
if yes, describe the structure
a + b * c
Just Recognizing
We need a device similar to an FSM except that it needs more power.
The insight: Precisely what it needs is a stack, which gives it an unlimited amount of memory with a restricted structure.
Example: Bal (the balanced parentheses language)
(((()))
Definition of a Pushdown Automaton
M = (K, , , , s, A), where:
K is a finite set of states
is the input alphabet
is the stack alphabet
s K is the initial state
A K is the set of accepting states, and
is the transition relation. It is a finite subset of
(K ( {}) *) (K *)
state input or string of statestring of
symbols symbols
to pop to push
from top on top
of stackof stack
Definition of a Pushdown Automaton
A configuration of M is an element of K * *.
The initial configuration of M is (s, w, ).
Manipulating the Stack
c will be written as cab
a
b
If c1c2…cn is pushed onto the stack:
c1
c2
cn
c
a
b
c1c2…cncab
Yields
Let c be any element of {},
Let 1, 2 and be any elements of *, and
Let w be any element of *.
Then:
(q1, cw, 1) |-M (q2, w, 2) iff ((q1, c, 1), (q2, 2)) .
Let |-M* be the reflexive, transitive closure of |-M.
C1 yields configuration C2 iff C1 |-M* C2
Computations
A computation by M is a finite sequence of configurations C0, C1, …, Cn for some n 0 such that:
● C0 is an initial configuration,
● Cn is of the form (q, , ), for some state q KM and
some string in *, and
● C0 |-M C1 |-M C2 |-M … |-M Cn.
Nondeterminism
If M is in some configuration (q1, s, ) it is possible that:
● contains exactly one transition that matches.
● contains more than one transition that matches.
● contains no transition that matches.
Accepting
A computation C of M is an accepting computation iff:
● C = (s, w, ) |-M* (q, , ), and
● q A.
M accepts a string w iff at least one of its computations accepts.
Other paths may:
● Read all the input and halt in a nonaccepting state,
● Read all the input and halt in an accepting state with the stack not
empty,
● Loop forever and never finish reading the input, or
● Reach a dead end where no more input can be read.
The language accepted by M, denoted L(M), is the set of all strings accepted by M.
Rejecting
A computation C of M is a rejecting computation iff:
● C = (s, w, ) |-M* (q, w, ),
● C is not an accepting computation, and
● M has no moves that it can make from (q, , ).
M rejects a string w iff all of its computations reject.
So note that it is poss ...
Toll tax management system project report..pdfKamal Acharya
Toll Tax Management System is a web based application that can provide all the information related to toll plazas and the passenger checks in and pays the amount, then he/she will be provided by a receipt. With this receipt he/she can leave the toll booth without waiting for any verification call.
The information would also cover registration of staff, toll plaza collection, toll plaza collection entry for vehicles, date wise report entry, Vehicle passes and passes reports b/w dates.
Mais conteúdo relacionado
Semelhante a a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
Pushdown Automata
Chapter 12
Recognizing Context-Free Languages
Two notions of recognition:
(1) Say yes or no, just like with FSMs
(2) Say yes or no, AND
if yes, describe the structure
a + b * c
Just Recognizing
We need a device similar to an FSM except that it needs more power.
The insight: Precisely what it needs is a stack, which gives it an unlimited amount of memory with a restricted structure.
Example: Bal (the balanced parentheses language)
(((()))
Definition of a Pushdown Automaton
M = (K, , , , s, A), where:
K is a finite set of states
is the input alphabet
is the stack alphabet
s K is the initial state
A K is the set of accepting states, and
is the transition relation. It is a finite subset of
(K ( {}) *) (K *)
state input or string of statestring of
symbols symbols
to pop to push
from top on top
of stackof stack
Definition of a Pushdown Automaton
A configuration of M is an element of K * *.
The initial configuration of M is (s, w, ).
Manipulating the Stack
c will be written as cab
a
b
If c1c2…cn is pushed onto the stack:
c1
c2
cn
c
a
b
c1c2…cncab
Yields
Let c be any element of {},
Let 1, 2 and be any elements of *, and
Let w be any element of *.
Then:
(q1, cw, 1) |-M (q2, w, 2) iff ((q1, c, 1), (q2, 2)) .
Let |-M* be the reflexive, transitive closure of |-M.
C1 yields configuration C2 iff C1 |-M* C2
Computations
A computation by M is a finite sequence of configurations C0, C1, …, Cn for some n 0 such that:
● C0 is an initial configuration,
● Cn is of the form (q, , ), for some state q KM and
some string in *, and
● C0 |-M C1 |-M C2 |-M … |-M Cn.
Nondeterminism
If M is in some configuration (q1, s, ) it is possible that:
● contains exactly one transition that matches.
● contains more than one transition that matches.
● contains no transition that matches.
Accepting
A computation C of M is an accepting computation iff:
● C = (s, w, ) |-M* (q, , ), and
● q A.
M accepts a string w iff at least one of its computations accepts.
Other paths may:
● Read all the input and halt in a nonaccepting state,
● Read all the input and halt in an accepting state with the stack not
empty,
● Loop forever and never finish reading the input, or
● Reach a dead end where no more input can be read.
The language accepted by M, denoted L(M), is the set of all strings accepted by M.
Rejecting
A computation C of M is a rejecting computation iff:
● C = (s, w, ) |-M* (q, w, ),
● C is not an accepting computation, and
● M has no moves that it can make from (q, , ).
M rejects a string w iff all of its computations reject.
So note that it is poss ...
Toll tax management system project report..pdfKamal Acharya
Toll Tax Management System is a web based application that can provide all the information related to toll plazas and the passenger checks in and pays the amount, then he/she will be provided by a receipt. With this receipt he/she can leave the toll booth without waiting for any verification call.
The information would also cover registration of staff, toll plaza collection, toll plaza collection entry for vehicles, date wise report entry, Vehicle passes and passes reports b/w dates.
Natalia Rutkowska - BIM School Course in Krakówbim.edu.pl
Teaching effects after 128 hours of Building Information Modeling course in Cracow, Poland. Natalia works in Revit, Navisworks and Dynamo for BIM Coordination position. More https://bim.edu.pl or https://bimedu.eu
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Construction method of steel structure space frame .pptxwendy cai
High-altitude bulk installation refers to the method of total assembling of small assembled units or loose parts directly in the design position, applicable to the installation of space structure such as space frame and reticulated shell.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
Fruit shop management system project report.pdfKamal Acharya
The export maintenance system is a fully featured application that can help we manage fruit delivery business and achieve more control and information at a very low cost of total ownership.
A fruit export maintains automatically monitors purchase, sales, supplier information. The system includes receiving fruit from the different supplier. Customer order is placed in the system, based on the order fruit has been sales to the customer.
The report contains the details about product, purchase, sales, stock, and invoice. The main objective of this project is to computerize the company activities and to provide details about the production process at the fruit export maintenance system.
The demand of fresh fruit fruits and processed food items in international and domestic market has shown a decent increase. This estimation is creating a necessity for growing more and more fruit fruits to cater the growing demand of domestic & international market.
The customers effectively and hence help for establishing good relation between customer and fruit shop organization. It contains various customized modules for effectively maintaining fruit and stock information accurately and safely.
When the fruits are sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting fruits for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
The proposed project is developed to manage the fruit shop in the fruits for shop. The first module is the login. The admin should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
A case study of cinema management system project report..pdfKamal Acharya
A computer reservation system or central reservation system is a computerized system used to store and retrieve information and conduct transactions related to air travel, hotels, car rental, or activities. These systems typically allow users to book hotel rooms, rental cars, airline tickets as well as activities and tours. They also provide access to railway reservations and bus reservations in some markets, although these are not always integrated with the main system. For these systems to be accessible on mobile phones and computers outside the premises of the airport, cinema, train station or stadiums, they need to be on the internet or a network.
This project focuses on the design and implementation of a web based cinema management system for the allocation of seat tickets online. The system would feature the registration of users, use of serial numbers and pins gotten from scratch cards sold and a printed slip. The system would have a store of all the seats and automate the generation of fresh serial numbers and pins.
Laundry management system project report.pdfKamal Acharya
Laundry firms currently use a manual system for the management and maintenance of critical information. The current system requires numerous paper forms, with data stores spread throughout the laundry management infrastructure. Often information is incomplete or does not follow management standards. Records are often lost in transit during computation requiring a comprehensive auditing process to ensure that no vital information is lost. Multiple copies of the same information exist in the laundry firm data and may lead to inconsistencies in data in various data stores.
A significant part of the operation of any laundry firm involves the acquisition, management and timely retrieval of great volumes of information. This information typically involves; customer personal information and clothing records history, user information, price of delivery and received date, users scheduling as regards customers details and dealings in service rendered, also our products package waiting list. All of this information must be managed in an efficient and cost wise fashion so that the organization resources may be effectively utilized.
We present the design and implementation of a laundry database management system (LBMS) used in a laundry establishment. Laundry firms are usually faced with difficulties in keeping detailed records of customers clothing; this little problem as seen to most laundry firms is highly discouraging as customers are filled with disappointments, arising from issues such as customer clothes mix-ups and untimely retrieval of clothes. The aim of this application is to determine the number of clothes collected, in relation to their owners, as this also helps the users fix a date for the collection of their clothes. Also customer’s information is secured, as a specific id is allocated per registration to avoid contrasting information.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfKamal Acharya
Online movie ticket booking system for movies is a web-based program. This application allows users to purchase cinema tickets over the portal. To buy tickets, people must first register or log in. This website's backend is PHP and JavaScript, and the front end is HTML and CSS. All phases of the software development life cycle are efficiently managed in order to design and implement software. On the website, there are two panels: one for administrators and one for customers/users. The admin has the ability to add cinemas, movies, delete, halt execution, and add screens, among other things. The website is simple to navigate and appealing, saving the end user time.
2. Context Free Grammars (CFGs)
Recall that a CFG has terminals, variables, and rules.
Grammars generate strings
1. Write down start variable
2. Replace any variable according to a rule
Repeat until only terminals remain
3. Result is the generated string
4. 𝐿(𝐺) is the language of all generated strings
5. We call 𝐿(𝐺) a Context Free Language.
Example of 𝐺1 generating a string
S → 0S1
S → R
R → ε
𝐺1
S
0 S 1
0 S 1
R
ε
S
0S1
00S11
00R11
0011
𝐿 𝐺1 = 0𝑘
1𝑘
𝑘 ≥ 0}
Tree of
substitutions
“parse tree”
Resulting
string
∈ 𝐿 𝐺1
S → 0S1 | R
R → ε
Shorthand:
2
3. CFG – Formal Definition
Defn: A Context Free Grammar (CFG) 𝐺 is a 4-tuple (𝑉, Σ, 𝑅, 𝑆)
𝑉 finite set of variables
Σ finite set of terminal symbols
𝑅 finite set of rules (rule form: 𝑉 → 𝑉 ∪ Σ ∗
)
𝑆 start variable
For 𝑢, 𝑣 ∈ 𝑉 ∪ Σ ∗ write
1) 𝑢 ⇒ 𝑣 if can go from 𝑢 to 𝑣 with one substitution step in 𝐺
2) 𝑢 ⇒ 𝑣 if can go from 𝑢 to 𝑣 with some number of substitution steps in 𝐺
𝑢 ⇒ 𝑢1 ⇒ 𝑢2 ⇒ ⋯ ⇒ 𝑢𝑘 = 𝑣 is called a derivation of 𝑣 from 𝑢.
If 𝑢 = 𝑆 then it is a derivation of 𝑣.
𝐿 𝐺 = 𝑤 𝑤 ∈ Σ∗ and 𝑆 ⇒ 𝑤}
Defn: 𝐴 is a Context Free Language (CFL) if 𝐴 = 𝐿(𝐺) for some CFG 𝐺.
∗
∗
Check-in 4.1
Check-in 4.1
Which of these are valid CFGs?
a) 𝐶1 only
b) 𝐶2 only
c) Both 𝐶1 and 𝐶2
d) Neither
B → 0B1 | ε
B1 → 1B
0B → 0B
𝐶1: S → 0S | S1
R → RR
𝐶2:
3
4. CFG – Example
𝑉 = {E, T, F}
Σ = {+, ×, (, ), a}
𝑅 = the 6 rules above
𝑆 = E
Observe that the parse tree contains additional information,
such as the precedence of × over + .
If a string has two different parse trees then it is derived ambiguously
and we say that the grammar is ambiguous.
E → E+T | T
T → T×F | F
F → ( E ) | a
𝐺2 Parse
tree
∈ 𝐿 𝐺2
Generates a+a×a, (a+a)×a, a, a+a+a, etc.
E
E+T
T+T×F
F+F×a
a+a×a
E
E + T
T T × F
F F a
a a a
Resulting
string
Check-in 4.2
Check-in 4.2
How many reasonable distinct meanings
does the following English sentence have?
The boy saw the girl with the mirror.
(a) 1
(b) 2
(c) 3 or more
4
5. Both 𝐺2 and 𝐺3 recognize the same language, i.e., 𝐿 𝐺2 = 𝐿 𝐺3 .
However 𝐺2 is an unambiguous CFG and 𝐺3 is ambiguous.
Ambiguity
E → E+T | T
T → T×F | F
F → ( E ) | a
𝐺2
E → E+E | E×E | ( E ) | a
𝐺3
E
E E
E E
a + a × a
E E
E E
E
5
6. Pushdown Automata (PDA)
Example: PDA for 𝐷 = 0𝑘1𝑘 𝑘 ≥ 0
1) Read 0s from input, push onto stack until read 1.
2) Read 1s from input, while popping 0s from stack.
3) Enter accept state if stack is empty. (note: acceptance only at end of input)
c
d
d
(pushdown)
stack
Finite
control
a b a b a a
…
input appears on a “tape”
Schematic diagram for DFA or NFA
Schematic diagram for PDA
Operates like an NFA except can write-add or read-remove symbols
from the top of stack.
push pop
“head”
6
7. PDA – Formal Definition
Defn: A Pushdown Automaton (PDA) is a 6-tuple (𝑄, Σ, Γ, 𝛿, 𝑞0, 𝐹)
Σ input alphabet
Γ stack alphabet
𝛿: Q × Σ𝜀 × Γ𝜀 → 𝒫(𝑄 × Γ𝜀)
𝛿 𝑞, a, c = 𝑟1, d , 𝑟2, e
Example: PDA for 𝐵 = {𝑤𝑤ℛ| 𝑤 ∈ 0,1 ∗ }
1) Read and push input symbols.
Nondeterministically either repeat or go to (2).
2) Read input symbols and pop stack symbols, compare.
If ever ≠ then thread rejects.
3) Enter accept state if stack is empty. (do in “software”)
Accept if some thread is in the accept state
at the end of the input string.
The nondeterministic forks replicate the stack.
This language requires nondeterminism.
Our PDA model is nondeterministic.
0 1 1 1 1 0
Sample input:
7
8. Converting CFGs to PDAs
Theorem: If 𝐴 is a CFL then some PDA recognizes 𝐴
Proof: Convert 𝐴’s CFG to a PDA
IDEA: PDA begins with starting variable and guesses substitutions.
It keeps intermediate generated strings on stack. When done, compare with input.
Problem! Access below the top of stack is cheating!
Instead, only substitute variables when on the top of stack.
If a terminal is on the top of stack, pop it and compare with input. Reject if ≠.
…
PDA
E → E+T | T
T → …
F → … CFG
E
E
E + T
T T × F
F F a
a a a
E
E+T
T+T×F
F+F×a
a+a×a
E → E+T | T
T → T×F | F
F → ( E ) | a
𝐺2
E
+
T
T
+
T
T
+
T
×
F
a + a × a
Input:
8
9. Theorem: If 𝐴 is a CFL then some PDA recognizes 𝐴
Proof construction: Convert the CFG for 𝐴 to the following PDA.
1) Push the start symbol on the stack.
2) If the top of stack is
Variable: replace with right hand side of rule (nondet choice).
Terminal: pop it and match with next input symbol.
3) If the stack is empty, accept.
Example:
E
E + T
T T × F
F F a
a a a
E
E+T
T+T×F
F+F×a
a+a×a
E E
+
T
F
+
T
Converting CFGs to PDAs (contd)
T
+
T
a
+
T
+
T
T T
×
F
a + a × a
E → E+T | T
T → T×F | F
F → ( E ) | a
𝐺2
9
10. Theorem: 𝐴 is a CFL iff* some PDA recognizes 𝐴
Done.
In book. You are responsible for knowing
it is true, but not for knowing the proof.
* “iff” = “if an only if” means the implication goes both ways.
So we need to prove both directions: forward (→) and reverse (←).
Equivalence of CFGs and PDAs
Check-in 4.3
Check-in 4.3
Is every Regular Language also
a Context Free Language?
(a) Yes
(b) No
(c) Not sure
10
12. Quick review of today
1. Defined Context Free Grammars (CFGs)
and Context Free Languages (CFLs)
2. Defined Pushdown Automata(PDAs)
3. Gave conversion of CFGs to PDAs.
12