state-machine

What finite-state machine captures binary strings with equal numbers of '01' and '10'?

▼魔方 西西 提交于 2019-12-02 02:20:15
I need help designing a finite state machine that accepts binary strings containing as many occurrences of the pattern 01 as occurrences of the pattern 10 . I kinda have a hard time understanding exactly which strings should be accepted and which should be rejected. Any guidance would be welcome. What is the language in question? [...] binary strings containing as many occurrences of the pattern 01 as occurrences of the pattern 10 . I kinda have a hard time understanding exactly which strings should be accepted and which should be rejected. The language defined by your specs is in fact none

How can one simulate nondeterministic finite transducers?

时间秒杀一切 提交于 2019-12-01 06:28:44
A nondeterministic automaton can be simulated easily on an input string by just keeping track of the states the automaton is in, and how far in the input string it has gotten. But how can a nondeterministic transducer (a transducer, of course, can translate input symbols to output symbols, and give as output a string, not just a boolean value) be simulated? It seems that this is more complicated, since we need to keep track, somehow, of the output strings, which can be numerous because of the nondeterminism. First of all, some theory. The following are distinct algebraic structures: generators

Possible to simulate a simple CPU in prolog?

你。 提交于 2019-12-01 06:23:27
问题 My understanding is that a simple model of a CPU is a state machine. When I look at prolog, it appears to tree-search (or graph search) combinations, whilst stopping at constraints running until its goals are found. I've been told that you can simulate a simple CPU in prolog. Is it possible to represent a state machine model like a simple CPU in prolog? 回答1: Prolog is a Turing-complete language, so you can express arbitrary computations in it, including the simulation of a CPU. You can

How can one simulate nondeterministic finite transducers?

戏子无情 提交于 2019-12-01 04:56:40
问题 A nondeterministic automaton can be simulated easily on an input string by just keeping track of the states the automaton is in, and how far in the input string it has gotten. But how can a nondeterministic transducer (a transducer, of course, can translate input symbols to output symbols, and give as output a string, not just a boolean value) be simulated? It seems that this is more complicated, since we need to keep track, somehow, of the output strings, which can be numerous because of the

Rails cancan and State Machine - Authorizing states

若如初见. 提交于 2019-12-01 01:23:49
I've been using the two awesome gems, state_machine and cancan recently in my rails application but I'm curious as to the best way to integrate them cleanly. Currently I've placed state transitions on buttons that go on actions authorized by the controller. This works perfectly, I can restrict who can perform that action. I would like to give the user the ability to change the objects state in the edit form as well. I've noticed that state_machine will pick up on the state_event key in the hash, with the value of the action to perform (so it will go through all of state_machines callbacks).

State Machine with no function pointer

﹥>﹥吖頭↗ 提交于 2019-12-01 00:33:57
I have implemented a complex state machine with numerous state transitions for a safety SIL 4 system. The back bone for this implementation was done using function pointers. When all was sailing smoothly, the V&V opposed the use of function pointers in a SIL 4 system. Reference- Rule 9 NASA .Misra C 2004 however doesnt say that function pointers cant be used. Is there any other way to implement complex state machines without any function pointers? First of all, that NASA document is not canon. Start by asking which law/directive/standard/requirement/document that enforces you to follow the

Auto advancing state machine with Stateless

北慕城南 提交于 2019-11-30 19:57:52
I've been experimenting with Stateless (HSM in C#) ( https://code.google.com/p/stateless/ ) lately and I've come across something that I'm not really sure how to achieve. Let's say I have the following states: Start. Connect Read Finish What I'm trying to achieve is: when the TCP connection (in the Connect state) is established, advance to the Read state. Or, if it fails, advance to the Finish state (where it may return to the Connect state and attempt a new connection after a timeout period). How can I achieve this auto advancing feature using Stateless, since firing triggers from within the

Does statemachine and statechart mean the same?

☆樱花仙子☆ 提交于 2019-11-30 14:52:38
问题 I have heard people using these terms. I wonder if they refer to the same thing or is there a difference between these two? 回答1: Wikipedia actually covers this pretty well. http://en.wikipedia.org/wiki/State_diagram State machines have been around for a long time (decades at least). They consist of states (usually circles) and arrows between the states where certain actions can trigger an transition along an arrow. Moore and Mealy machines are the two main variants, which indicate whether the

Finite State Transducers in Haskell?

强颜欢笑 提交于 2019-11-30 12:11:06
问题 I've been wondering if there is a way to define and work with finite state transducers in Haskell in an idiomatic way. You can approach FSTs as generators (it generates an output of type {x1,x2}), or as recognizers (given an input of type {x1,x2} it recognizes it if it belongs to the rational relation), or as translators (given an input tape, it translates it into an output tape). Would the representation change depending on the approach? Would it also be possible to model a FST in a way that

Java library to check whether a String contains a number *without* exceptions

橙三吉。 提交于 2019-11-30 08:27:17
问题 I'm looking for a method that returns a boolean if the String it is passed is a valid number (e.g. "123.55e-9", "-333,556"). I don't want to just do: public boolean isANumber(String s) { try { BigDecimal a = new BigDecimal(s); return true; } catch (NumberFormatException e) { return false; } } Clearly, the function should use a state machine (DFA) to parse the string to make sure invalid examples don't fool it (e.g. "-21,22.22.2", "33-2"). Do you know if any such library exists? I don't really