boltzmann-brain icon indicating copy to clipboard operation
boltzmann-brain copied to clipboard

What is the syntax for rational grammars?

Open Kerl13 opened this issue 4 years ago • 4 comments

I don't understand the syntax of rational grammars from the examples. How should I write the specification for aaabb or aa*bb* for instance ?

I tried writing them in the algebraic format but then paganini cannot tune the system (I guess it runs the singular tuner).

Kerl13 avatar Sep 18 '20 11:09 Kerl13

The syntax is meant to follow the construction of NFA. For instance, for the simple language aaabb we need two things. First, we need to specify the alphabet { a, b }. Secondly, we need to define the automaton:

State_1 -> State_2 (a)
State_2 -> State_3 (a)
State_3 -> State_4 (a)
State_4 -> State_5 (b)
State_5 -> State_6 (b)
State_6 -> _

and define, in the header of the file

@generate State_1

The above rule define transitions in form of <state> -> <state> (letter). Optionally, you can use the underscore _ to denote an epsilon (think of it as an epsilon transition to some implicit final state). If you need more rules for a single state, say for a* you can write something like:

State -> State (a)
          | _

Regarding the remark of singular tuning, I think that boltzmann-brain should perhaps drop it's use entirely. Actual, singular tuners are a rare phenomenon (usually we can just approximate them). A better interface might just specify the target size and assume an implicit size, say size = 1, 000, 000, to be a reasonable approximation of a singular tuner. That also would be a nice feature to have. Sadly, I cannot guarantee when it's going to be implemented, though.

maciej-bendkowski avatar Sep 18 '20 18:09 maciej-bendkowski

Oh I understand, I failed to recognize that this was an automaton description, everything is clearer now. Maybe it would be nice to write this in the README.

Concerning singular sampling, I guess you're right. From a practical point of view, targeting a specific size seems more convenient and reliable.

Kerl13 avatar Nov 24 '20 20:11 Kerl13

FYI: Most recent changes of boltzmann-brain drop rational input specifications and, consequently, rational grammars. It should, however, be easier to implement ad-hoc sampler generators using boltzmann-brain as a tuning tool.

maciej-bendkowski avatar Nov 24 '20 22:11 maciej-bendkowski

Ahah I see that my answer is so late that the initial question is already out-dated ^^

Kerl13 avatar Nov 24 '20 22:11 Kerl13