Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Computing with Finite Automata 290N: The Unknown Component Problem Lecture 9."— Presentation transcript:

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

2 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”)

3 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

4 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

5 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}

6 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

7 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

8 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

9 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

10 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

11 An Extension of Fixed New states Old states

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

13 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”)

14 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

15 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

16 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

17 Example of Prefixed Close

18 Example of Progressive

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

20 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”)

21 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

22 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

23 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

24 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’) ]

25 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

26 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

27 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


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

Similar presentations


Ads by Google