Computing with Finite Automata 290N: The Unknown Component Problem Lecture 9.

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

CSE 311 Foundations of Computing I
4b Lexical analysis Finite Automata
CMPS 3223 Theory of Computation
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Outline Node minimization dcmin complete combinational behavior? using latch_expose FSM “Windowing”
1Basic Mathematics - Finite-State Methods in Natural-Language Processing: Basic Mathematics Ronald M. Kaplan and Martin Kay.
CSE 311: Foundations of Computing Fall 2013 Lecture 23: Finite state machines and minimization.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Timed Automata.
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,
Determinization of Büchi Automata
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
ECE 331 – Digital System Design
Languages. A Language is set of finite length strings on the symbol set i.e. a subset of (a b c a c d f g g g) At this point, we don’t care how the language.
Equivalence, DFA, NDFA Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 2 Updated and modified by.
Penn ESE 535 Spring DeHon 1 ESE535: Electronic Design Automation Day 13: March 4, 2009 FSM Equivalence Checking.
ECE C03 Lecture 111 Lecture 11 Finite State Machine Optimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Conformance Simulation Relation ( ) Let and be two automata over the same alphabet simulates () if there exists a simulation relation such that Note that.
Sequential System Synthesis -- Finite State Machine.
Subset Construction 290N: The Unknown Component Problem Lecture 13.
Reachability Analysis using AIGs (instead of BDDs?) 290N: The Unknown Component Problem Lecture 23.
Computation Engines: BDDs and SAT (part 2) 290N: The Unknown Component Problem Lecture 8.
Efficient Solution of Language Equations Using Partitioned Representations Alan Mishchenko UC Berkeley, US Robert Brayton UC Berkeley, US Roland Jiang.
Normal forms for Context-Free Grammars
Exact State Minimization of Non-Deterministic FSMs 290N: The Unknown Component Problem Lecture 17.
Languages. A Language is set of finite length strings on the symbol set i.e. a subset of (a b c a c d f g g g) At this point, we don’t care how the language.
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
Automating Construction of Lexers. Example in javacc TOKEN: { ( | | "_")* > | ( )* > | } SKIP: { " " | "\n" | "\t" } --> get automatically generated code.
Computing with Finite Automata (part 2) 290N: The Unknown Component Problem Lecture 10.
State Minimization and Determinization EECS 290A Sequential Logic Synthesis and Verification.
CSE 311: Foundations of Computing Fall 2014 Lecture 23: State Minimization, NFAs.
Regular Model Checking Ahmed Bouajjani,Benget Jonsson, Marcus Nillson and Tayssir Touili Moran Ben Tulila
Rosen 5th ed., ch. 11 Ref: Wikipedia
Zvi Kohavi and Niraj K. Jha 1 Capabilities, Minimization, and Transformation of Sequential Machines.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions.
CSC312 Automata Theory Lecture # 19 Chapter # 8 by Cohen Finite Automata with Output.
Automating Construction of Lexers. Example in javacc TOKEN: { ( | | "_")* > | ( )* > | } SKIP: { " " | "\n" | "\t" } --> get automatically generated code.
Lexical Analysis Constructing a Scanner from Regular Expressions.
CALTECH CS137 Spring DeHon CS137: Electronic Design Automation Day 9: May 6, 2002 FSM Equivalence Checking.
Decidable Questions About Regular languages 1)Membership problem: “Given a specification of known type and a string w, is w in the language specified?”
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Why consider ND-MV networks? Multi-Values: Multi-valued domains can be used to explore larger optimization spaces. Several interesting direct applications.
Complexity and Computability Theory I Lecture #8 Instructor: Rina Zviel-Girshin Lea Epstein.
Finite State Machines 1.Finite state machines with output 2.Finite state machines with no output 3.DFA 4.NDFA.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Exercise: (aa)* | (aaa)* Construct automaton and eliminate epsilons.
Nondeterministic Finite State Machines Chapter 5.
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,
CS412/413 Introduction to Compilers Radu Rugina Lecture 3: Finite Automata 25 Jan 02.
Lecture # 16. Applications of Incrementing and Complementing machines 1’s complementing and incrementing machines which are basically Mealy machines are.
Sequential Networks and Finite State Machines
Sequential Flexibility
Lexical analysis Finite Automata
FORMAL LANGUAGES AND AUTOMATA THEORY
Two issues in lexical analysis
Chapter 2 FINITE AUTOMATA.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
Alan Mishchenko UC Berkeley, US Robert Brayton UC Berkeley, US
CSE322 Minimization of finite Automaton & REGULAR LANGUAGES
4b Lexical analysis Finite Automata
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
MA/CSSE 474 Theory of Computation
4b Lexical analysis Finite Automata
Some Graph Algorithms.
Mealy and Moore Machines
Presentation transcript:

Computing with Finite Automata 290N: The Unknown Component Problem Lecture 9

Outline  Problem solving flow Example of a traffic light controller Example of a traffic light controller  Representation of automata  Simple operations Complementing (“complement”) Complementing (“complement”) Completing (“complete”) Completing (“complete”)  Filtering states Making prefix closed (“prefix”) Making prefix closed (“prefix”) Progressive (“progressive”) Progressive (“progressive”) Moore-reduction (“moore”) Moore-reduction (“moore”)  State minimization (“minimize”)  Reachability analysis  Product computation (“product”)  Verification by language containment (“check”)  Determinization by subset construction (“determinize”)  Don’t-care minimization (“dcmin”)

Problem Solving Flow  Determine the interaction topology  Specify the fixed part and the spec as automata, FSMs, or multi- level multi-valued networks  Create the script, which implements the flow Special attention should be paid to projection and lifting of variables (command “support”) because it is closely related to the selected topology Special attention should be paid to projection and lifting of variables (command “support”) because it is closely related to the selected topology  Run the script on MVSIS and debug it if necessary  Analyze the resulting solution Is it prefix closed and progressive? (commands “prefix”, “progressive”) Is it prefix closed and progressive? (commands “prefix”, “progressive”) Is it deterministic as an FSM? (command “check_nd”) Is it deterministic as an FSM? (command “check_nd”) Is it state-minimum? (command “minimize”) Is it state-minimum? (command “minimize”) Compare the language of this solution with other solutions if available (command “volume”) Compare the language of this solution with other solutions if available (command “volume”)  Make conclusions Formulate and prove new theorems Formulate and prove new theorems Create new examples Create new examples

Example: Traffic Light Controller I O UV Fixed Unknown F X Specification S z v Fixed Unknown F X Specification S General Topology This example

Traffic Light Controller (fixed part).model fixed.inputs v z.outputs Acc.mv v 2 wait go.mv z 3 red green yellow.mv CS, NS 3 Fr Fg Fy.latch NS CS.reset CS Fr.table ->Acc 1.table v z CS ->NS wait red Fr Fr go red Fr Fg wait green Fg Fg go green Fg Fy wait yellow Fy Fy go yellow Fy Fr.end z v Fixed F z = {red, green, yellow} v = {wait, go}

Traffic Light Controller (spec).model spec.inputs z.outputs Acc.mv z 3 red green yellow.mv CS,NS 4 S1 S2 S3 S4.table ->Acc 1.latch NS CS.reset CS S1.table z CS ->NS red S1 S2 red S2 S3 green S3 S4 yellow S4 S1.end z Specification S

Traffic Light Controller (script) echo "Synthesis..." determinize -lci spec.mva spec_dci.mva support v(2),z(3) spec_dci.mva spec_dci_supp.mva support v(2),z(3) fixed.mva fixed_supp.mva product -l fixed_supp.mva spec_dci_supp.mva p.mva support v(2) p.mva p_supp.mva determinize -lci p_supp.mva p_dci.mva progressive -i 0 p_dci.mva x.mva echo "Verification..." support v(2),z(3) x.mva x_supp.mva product x_supp.mva fixed_supp.mva prod.mva support v(2),z(3) spec.mva spec_supp.mva check prod.mva spec_supp.mva z v Fixed Unknown F X Specification S

Traffic Light Controller (solution).model solution.inputs v.outputs Acc.mv v 2 wait go.mv CS, NS 4 \ FrS1 FrS2 FgS3 FyS4 FrS1 FrS2 FgS3 FyS4.latch NS CS.reset CS FrS1.table ->Acc 1.table v CS ->NS wait FrS1 FrS2 go FrS2 FgS3 go FgS3 FyS4 go FyS4 FrS1.end v Unknown X

Traffic Light Controller (script2) echo "Synthesis..." determinize -lci spec.mva spec_dci.mva support v(2),z(3) spec_dci.mva spec_dci_supp.mva support v(2),z(3) fixed.mva fixed_supp.mva product -l fixed_supp.mva spec_dci_supp.mva p.mva support z(3),v(2) p.mva p_supp.mva determinize -lci p_supp.mva p_dci.mva progressive -i 1 p_dci.mva x.mva echo "Verification..." support v(2),z(3) x.mva x_supp.mva product x_supp.mva fixed_supp.mva prod.mva support v(2),z(3) spec.mva spec_supp.mva check prod.mva spec_supp.mva z v Fixed Unknown F X Specification S

Further Experiments  Run both scripts and see how solution differs  Make Spec non-deterministic and see what happens  Make Fixed non-deterministic and see what happens  Try more complex Fixed For example, make Fixed depend on an additional variable s, which shifts it from one set of states to another set of states For example, make Fixed depend on an additional variable s, which shifts it from one set of states to another set of states In one set, Fixed behaves as before In one set, Fixed behaves as before In other set, Fixed already behaves according to the spec In other set, Fixed already behaves according to the spec

An Extension of Fixed New states Old states

Two Topologies to Try z v Fixed Unknown F X Specification S z v Fixed Unknown F X Specification S s s

Outline  Problem solving flow Example of a traffic light controller Example of a traffic light controller  Representation of automata  Simple operations Complementing (“complement”) Complementing (“complement”) Completing (“complete”) Completing (“complete”)  Filtering states Making prefix closed (“prefix”) Making prefix closed (“prefix”) Progressive (“progressive”) Progressive (“progressive”) Moore-reduction (“moore”) Moore-reduction (“moore”)  State minimization (“minimize”)  Reachability analysis  Product computation (“product”)  Verification by language containment (“check”)  Determinization by subset construction (“determinize”)  Don’t-care minimization (“dcmin”)

Representation of Automata  Completely explicit (MVSIS package “au”) Both STG and transition conditions are represented explicitly (STG is a graph; conditions are SOPs) Both STG and transition conditions are represented explicitly (STG is a graph; conditions are SOPs)  Completely implicit (monolithic) (MVSIS package “lang”) Automaton is represented by a single transition relation and char functions of accepting states Automaton is represented by a single transition relation and char functions of accepting states  Completely implicit (partitioned) (MVSIS package “mvn” (mvnSolve.c)) Can only be used for automata derived from multi-level networks Can only be used for automata derived from multi-level networks Automaton is represented by a set of partitions (one partition for each latch excitation function) Automaton is represented by a set of partitions (one partition for each latch excitation function)  Hybrid representation (MVSIS package “aut”) STG is represented explicitly (as a graph) STG is represented explicitly (as a graph) Transition conditions are represented implicitly as BDDs Transition conditions are represented implicitly as BDDs

Simple Operations  Complementing swap the sets of accepting and non-accepting states swap the sets of accepting and non-accepting states deterministic automata only! deterministic automata only!  Completing For each state, compute the input domain when the transitions are defined For each state, compute the input domain when the transitions are defined If this domain is constant 1 for all states, the automaton is complete If this domain is constant 1 for all states, the automaton is complete Otherwise Otherwise create a new non-accepting state (DC state) with the self- loop under all inputscreate a new non-accepting state (DC state) with the self- loop under all inputs create transitions from each incompletely specified state into the DC state, under the previously undefined conditioncreate transitions from each incompletely specified state into the DC state, under the previously undefined condition

Filtering States  Prefix-closed Removes all the non-accepting states Removes all the non-accepting states Removes the accepting states not reachable from the initial state Removes the accepting states not reachable from the initial state  Progressive (I-progressive) Iteratively removes all the states whose I/O behavior represented as a multi-output relation is not well-defined Iteratively removes all the states whose I/O behavior represented as a multi-output relation is not well-defined  Moore-reduction Given an arbitrary Mealy machine, reduce it to a Moore machine Given an arbitrary Mealy machine, reduce it to a Moore machine

Example of Prefixed Close

Example of Progressive

Example of Moore-Reduction CSF computed after splitting latches of benchmark “dk27.blif” The results of Moore-reduction Number of inputs = 3.

Outline  Problem solving flow Example of a traffic light controller Example of a traffic light controller  Representation of automata  Simple operations Complementing (“complement”) Complementing (“complement”) Completing (“complete”) Completing (“complete”)  Filtering states Making prefix closed (“prefix”) Making prefix closed (“prefix”) Progressive (“progressive”) Progressive (“progressive”) Moore-reduction (“moore”) Moore-reduction (“moore”)  State minimization (“minimize”)  Reachability analysis  Product computation (“product”)  Verification by language containment (“check”)  Determinization by subset construction (“determinize”)  Don’t-care minimization (“dcmin”)

State Minimization of FA  Requirements for the automaton Deterministic (if not, first determinize) Deterministic (if not, first determinize) Complete (if not, first complete) Complete (if not, first complete)  Definition of state equivalence  Two ways of computing equivalence classes Implicit Implicit Explicit Explicit  The explicit algorithm in detail  Example

State Equivalence of FA  Definition. A string is accepted by the automation in state s iff it drives the automaton into an accepting state.  Definition. Two states s1 and s2 are distinguishable iff there exists a string, which is accepted in state s1 and not accepted in state s2.  Definition. States s1 and s2 are equivalent if they are not distinguishable. Example: States A and C are distinguishable States B and C are equivalent

Outline of the Algorithm  The automaton is given by State transition graph State transition graph The set of accepting states The set of accepting states  Compute the set of distance-0 distinguishable pairs by combining each accepting state with each non-accepting state  For each pair, find all the pairs reachable in backward traversal from the distinguishable pairs, under all input combinations Collect these pairs and explore them until no new pairs can be found Collect these pairs and explore them until no new pairs can be found  The remaining pairs are pairs of equivalent states  Reduce the automaton by replacing each state by one selected representative of its equivalence class

Implicit Implementation  The automaton is given by Transition relation R(x,cs,ns) Transition relation R(x,cs,ns) Characteristic function of accepting states A(cs) Characteristic function of accepting states A(cs)  Compute the set of distance-0 distinguishable pairs (when one state is accepting while the other is not) D 0 (cs,cs’) = A(cs)  A(cs’) D 0 (cs,cs’) = A(cs)  A(cs’)  Compute the pair transition relation P(cs,cs’,ns,ns’) =  x [R(x,cs,ns) & R(x,cs’,ns’)] P(cs,cs’,ns,ns’) =  x [R(x,cs,ns) & R(x,cs’,ns’)]  Starting from the distance-0 distinguishable pairs, iteratively compute distance-k distinguishable pairs, until convergence D i+1 (cs,cs’) =  ns,ns’ [P(cs,cs’,ns,ns’) & D i (ns,ns’)] D i+1 (cs,cs’) =  ns,ns’ [P(cs,cs’,ns,ns’) & D i (ns,ns’)]  The equivalence relation is E(cs,cs’) = NOT[D i+1 (cs,cs’)] E(cs,cs’) = NOT[D i+1 (cs,cs’)]  Reduce the automaton by replacing each state by one representative taken from its equivalence class P(cs,cs’) = CompatibleProjection( E(cs,cs’), {cs} ) P(cs,cs’) = CompatibleProjection( E(cs,cs’), {cs} ) R(x,cs,ns) =  cs’,ns’[ R(x,cs’,ns’) & P(cs,cs’) & P(ns,ns’) ] R(x,cs,ns) =  cs’,ns’[ R(x,cs’,ns’) & P(cs,cs’) & P(ns,ns’) ]

Explicit Implementation  The automaton The linked list of states The linked list of states The accepting states are marked The accepting states are marked  Additional data structures Q: The FIFO queue of distinguishable state pairs to be explored Q: The FIFO queue of distinguishable state pairs to be explored H: The hash table hashing every pair into {visited, not visited} H: The hash table hashing every pair into {visited, not visited}  Initialization for each accepting state s for each non-accepting state s’ for each non-accepting state s’ insert pair (s,s’) into Q and H insert pair (s,s’) into Q and H  Computation while Q is not empty, extract one pair (s,s’) from Q for each pair (t,t’), which transits into (s,s’) under some input for each pair (t,t’), which transits into (s,s’) under some input if (t,t’) is not in H (that is, (t,t’) has not been visited) if (t,t’) is not in H (that is, (t,t’) has not been visited) insert pair (t,t’) into Q and into H insert pair (t,t’) into Q and into H

Reducing the Automaton  The automaton The linked list of states The linked list of states The accepting states are marked The accepting states are marked  The equivalence relation Maps pair (s,s’) into {distinguishable, equivalent} Maps pair (s,s’) into {distinguishable, equivalent} The same as hash table H: visited = distinguishable; not visited = equivalentThe same as hash table H: visited = distinguishable; not visited = equivalent  Computation Construct the equivalence classes of states using the equivalence relation Construct the equivalence classes of states using the equivalence relation Select one representative state from each equivalence class Select one representative state from each equivalence class Create the mapping of each state in the original automaton into the representative state from its equivalence class Create the mapping of each state in the original automaton into the representative state from its equivalence class start the new automaton add a new state for each representative state of the old automaton for all representative states s1 for each transition (s1->s2) from the representative state s1 into some other state s2 add transition from the new state corresponding to s1 into the new state corresponding to s2 Set the new initial state to be the new state corresponding to the representative of the class, to which the original initial state belongs Set the new initial state to be the new state corresponding to the representative of the class, to which the original initial state belongs

Example of State Minimization  Distinguishable pairs after initialization (A,DC), (C,DC), (B,DC) (A,DC), (C,DC), (B,DC)  Computed distinguishable pairs (A,DC)  (A,C) (A,DC)  (A,C) (A,DC)  (A,B) (A,DC)  (A,B)  Remaining equivalent pairs (B,C) (B,C)  The derived reduced graph