system modelling
play

System Modelling Introduction Finite State Machines Petri Nets - PowerPoint PPT Presentation

System Modelling Introduction Finite State Machines Petri Nets Untimed Model of Computation Synchronous Model of Computation Timed Model of Computation Integration of Computational Models Tightly Coupled Process Networks System Modelling,


  1. System Modelling Introduction Finite State Machines Petri Nets Untimed Model of Computation Synchronous Model of Computation Timed Model of Computation Integration of Computational Models Tightly Coupled Process Networks

  2. System Modelling, Jan-Feb 2005, Kista Finite State Machines 1 The Man, Wolf, Goat, Cabbage Problem ✤ ✜ ✤ ✜ m g MWGC- ∅ WC-MG MWC-G ✣ ✢ ✣ ✢ ❚ ✓ ❚ ✓ c ❚ w ✓ ❚ ✓ ✤ ✜ ✤ ✜ ✓ ❚ C-MWG W-MCG ✣ ✢ ✣ ✢ g g ✤ ✜ ✤ ✜ MWG-C MGC-W ✣ ✢ ✣ ✢ ✡ ❚ ✡ ❚ ✡ c w ❚ ★ ✥ ✤ ✜ ✤ ✡ ✜ ✤ ✜ ❚ ✡ ❚ g m ∅ -MWGC G-MWC MG-WC ✣ ✢ ✣ ✢ ✧ ✦ ✣ ✢ A. Jantsch, KTH

  3. System Modelling, Jan-Feb 2005, Kista Finite State Machines 2 Finite State Machine Definition Definition: A finite state machine is a five-tuple (Σ , X, g, x 0 , F ) where Σ is a finite alphabet X is a finite set of states is a state transition function, g : X × Σ → X g x 0 is the initial state, x 0 ∈ X F is the set of final states, F ⊆ X . A. Jantsch, KTH

  4. System Modelling, Jan-Feb 2005, Kista Finite State Machines 3 The Man-Wolf-Goat-Cabbage Problem as FSM M = (Σ , X, g, x 0 , F ) , where Σ = { m, w, g, c } X = { ( x, y ) | x, y ⊆ { M, W, G, C } and y = { M, W, G, C } \ x } x 0 = { ( { M, W, G, C } , ∅ ) } F = { ( ∅ , { M, W, G, C } ) } g (( { M, W, G, C } , ∅ ) , g ) = ( { W, C } , { M, G } ) , g (( { W, C } , { M, G } ) , m ) = ( { W, C, M } , { G } ) , g (( { M, W, C } , { G } ) , w ) = ( { C } , { M, W, G } ) , g (( { M, W, C } , { G } ) , c ) = ( { W } , { M, G, C } ) , g (( { C } , { M, W, G } ) , g ) ( { M, G, C } , { W } ) , = g (( { W } , { M, G, C } ) , g ) ( { M, W, G } , { C } ) , = g (( { M, G, C } , { W } ) , c ) ( { G } , { M, W, C } ) , = g (( { M, W, C } , { G } ) , w ) ( { G } , { M, W, C } ) , = g (( { G } , { M, W, C } ) , m ) = ( { M, G } , { W, C } ) , g (( { M, G } , { W, C } ) , g ) = ( ∅ , { M, W, G, C } ) . A. Jantsch, KTH

  5. System Modelling, Jan-Feb 2005, Kista Finite State Machines 4 Some Definitions • Σ ∗ is the set of strings formed from elements of alphabet Σ . • Let g : X × Σ → X be a state transition function. Then g ∗ : X × Σ ∗ → X is defined as follows ∀ x ∈ X, a ∈ Σ , r ∈ Σ ∗ . g ∗ ( x, ǫ ) = x g ∗ ( x, a ) = g ( x, a ) g ∗ ( x, “ a ” + r ) g ∗ ( g ( x, a ) , r ) = A. Jantsch, KTH

  6. System Modelling, Jan-Feb 2005, Kista Finite State Machines 5 More Definitions • A finite state machine M = (Σ , X, g, x 0 , F ) accepts an input string r ∈ Σ ∗ iff g ∗ ( x 0 , r ) ∈ F . • The language accepted by M , designated L ( M ) , is the set of strings accepted by M , i.e. L ( M ) = { r ∈ Σ ∗ | g ∗ ( x 0 , r ) ∈ F } . E.g. in the Man-Wolf-Goat-Cabbage problem the machine M accepts strings “ gmwgcmg ” and “ gmcgwmg ” but no other strings. Thus L ( M ) = { “ gmwgcmg ” , “ gmcgwmg ” } . A. Jantsch, KTH

  7. System Modelling, Jan-Feb 2005, Kista Finite State Machines 6 FSM Accepting an Even Number of Symbols M = (Σ , X, g, x 0 , F ) , where ✗✔ 1 Σ = { 0 , 1 } x 0 ✖✕ x 1 X = { x 0 , x 1 , x 2 , x 3 } 1 { x 0 , x 3 } F = 0 0 0 0 ✤✜ ✗✔ ✗✔ 1 g ( x 0 , 0) = x 2 , g ( x 0 , 1) = x 1 g ( x 1 , 0) = x 3 , g ( x 1 , 1) = x 0 ✖✕ ✖✕ x 3 x 2 ✣✢ g ( x 2 , 0) = x 0 , g ( x 2 , 1) = x 3 1 g ( x 3 , 0) = x 1 , g ( x 3 , 1) = x 2 . • x 0 represents an even number of both zeros and ones; • x 3 represents an odd number of both zeros and ones; • x 1 represents an even number of zeros and an odd number of ones; • x 2 represents an odd number of zeros and an even number of ones; • F = { x 0 , x 3 } ⇒ L ( M ) = { r ∈ Σ ∗ | # r mod 2 = 0 } . A. Jantsch, KTH

  8. System Modelling, Jan-Feb 2005, Kista Finite State Machines 7 Non-finite State Machines Definition: A state machine is a five-tuple (Σ , X, g, x 0 , F ) where Σ is a countable alphabet X is a countable set of states is a state transition function, g : X × Σ → X g x 0 is the initial state, x 0 ∈ X F is the set of final states, F ⊆ X . A. Jantsch, KTH

  9. System Modelling, Jan-Feb 2005, Kista Finite State Machines 8 Nondeterministic Finite State Machines Definition: A nondeterministic finite state machine is a five tuple (Σ , X, g, x 0 , F ) where Σ is a finite alphabet X is a finite set of states g is a state transition mapping, g : X × Σ → ℘ ( X ) x 0 is the initial state, x 0 ∈ X F is the set of final states, F ⊆ X . A. Jantsch, KTH

  10. System Modelling, Jan-Feb 2005, Kista Finite State Machines 9 An Example Nondeterministic FSM M = (Σ , X, x 0 , g, F ) is defined as follows. a Σ = { a, b } { x 0 , x 1 } X = ✗✔ a { x 0 } F = x 1 ✖✕ x 0 b { x 0 , x 1 } , ∅ g ( x 0 , a ) = g ( x 0 , b ) = g ( x 1 , a ) = ∅ , g ( x 1 , b ) = { x 0 } A. Jantsch, KTH

  11. System Modelling, Jan-Feb 2005, Kista Finite State Machines 10 Extended Transition Function for Nondeterministic FSM g : X × Σ → ℘ ( X ) is a state transition function Then g ∗ : X × Σ ∗ → ℘ ( X ) is defined as follows ∀ x ∈ X, a ∈ Σ , r ∈ Σ ∗ . g ∗ ( x, ǫ ) { x } = g ∗ ( x, a ) = g ( x, a ) g ∗ ( x, r + “ a ” ) { z | z ∈ g ( y, r ) for some y ∈ g ∗ ( x, r ) } = A. Jantsch, KTH

  12. System Modelling, Jan-Feb 2005, Kista Finite State Machines 11 An Execution Example of a Nondeterministic FSM For input string “ abaab ”: g ∗ ( { x 0 } , “ abaab ” ) step 1 a = g ∗ ( { x 0 , x 1 } , “ baab ” ) step 2 ✗✔ a = g ∗ ( { x 0 } , “ aab ” ) step 3 = g ∗ ( { x 0 , x 1 } , “ ab ” ) step 4 x 1 ✖✕ x 0 = g ∗ ( { x 0 , x 1 } , “ b ” ) step 5 b = g ∗ ( { x 0 } , ǫ ) = { x 0 } A. Jantsch, KTH

  13. System Modelling, Jan-Feb 2005, Kista Finite State Machines 12 Equivalence of Deterministic and Nondeterministic FSMs Theorem: For every deterministic finite state machine M there is a nondeterministic finite state machine M ND with L ( M ) = L ( M ND ) . For every nondeterministic finite state Theorem: machine M there is a deterministic finite state machine M D with L ( M ) = L ( M D ) . A. Jantsch, KTH

  14. System Modelling, Jan-Feb 2005, Kista Finite State Machines 13 Construction of a Deterministic FSM Deterministic machine: a M D = (Σ D , X D , x D 0 , g D , F D ) ✗✔ a Σ D = Σ ✖✕ x 1 x 0 X D = { y ∅ , y 0 , y 1 , y 01 } x D b = y 0 0 F D = { y 0 , y 01 } g D ( y ∅ , a ) g D ( y ∅ , b ) = y ∅ , = y ∅ M = (Σ , X, x 0 , g, F ) g D ( y 0 , a ) g D ( y 0 , b ) = y 01 , = y ∅ Σ = { a, b } g D ( y 1 , a ) g D ( y 1 , b ) = y ∅ , = y 0 X = { x 0 , x 1 } g D ( y 01 , a ) g D ( y 01 , b ) = y 01 , = y 0 F = { x 0 } Intuitively, we have the following correspondence: = { x 0 , x 1 } g ( x 0 , a ) y ∅ : ∅ : “no possible state of M ” g ( x 0 , b ) = ∅ y 0 : { x 0 } : x 0 g ( x 1 , a ) = ∅ y 1 : { x 1 } : x 1 g ( x 1 , b ) = { x 0 } y 01 : { x 0 , x 1 } : “either state x 0 or state x 1 ”. A. Jantsch, KTH

  15. System Modelling, Jan-Feb 2005, Kista Finite State Machines 14 Construction of a Deterministic FSM - cont’d Deterministic FSM: ✗✔ a b ✖✕ y ∅ Nondeterministic FSM: ★ a ★ b ★ ✗✔ ★ ✗✔ a b ✖✕ y 0 y 1 x 1 ✖✕ x 0 b a ✤✜ ✗✔ b a y 01 ✖✕ ✣✢ A. Jantsch, KTH

  16. System Modelling, Jan-Feb 2005, Kista Finite State Machines 15 Finite State Machnines with ǫ -Moves Definition: A nondeterministic finite state machine with ǫ -moves is a five tuple (Σ , X, g, x 0 , F ) where Σ is a finite alphabet X is a finite set of states g is a state transition mapping, g : X × (Σ ∪ { ǫ } ) → ℘ ( X ) x 0 is the initial state, x 0 ∈ X F is the set of final states, F ⊆ X . A. Jantsch, KTH

  17. System Modelling, Jan-Feb 2005, Kista Finite State Machines 16 Finite State Machnines with ǫ -Moves - cont’d Example: c a b ✛✘ ✗✔ ✗✔ ǫ ǫ ✖✕ ✖✕ x 2 x 1 ✚✙ x 0 Theorem: For every nondeterministic finite state machine with ǫ -moves M there is a nondeterministic finite state machine M D with L ( M ) = L ( M D ) . A. Jantsch, KTH

  18. System Modelling, Jan-Feb 2005, Kista Finite State Machines 17 State Equivalence Definition: Let M = (Σ , X, g, x 0 , F ) be a finite state machine. Two states x and y are equivalent, denoted by x ∼ y , iff ∀ r ∈ Σ ∗ : g ∗ ( x, r ) ∈ F ⇔ g ∗ ( y, r ) ∈ F. A set R ⊆ X is a set of equivalent states iff ∀ x, y ∈ R, r ∈ Σ ∗ : x ∼ y. A. Jantsch, KTH

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend