examples::Thompson – set of Thompson automata

examples::Thompson(A,S) creates a domain for Thompson automata with multiplicities over the alphabet A to which we add a new letter called "epsilon" and the component semi-ring S.

The domain element examples::Thompson(A,S)(expression) represents the Thompson automaton built from a rational math-expression denoted by expression.

→ Examples

Creating the Type

examples::Thompson(A, S)

Thompson(A,S)(expression)

Parameters:

A

an alphabet, i.e., a list of letters

S

a semiring, i.e., a domain of category Cat::SemiRing

expression

a string.

Superdomain

Dom::BaseDomain

Related Domains:

Dom::BooleanSemiRing, Dom::MaxMinSemiRing, Dom::MaxPlusSemiRing, Dom::MinMaxSemiRing, Dom::MinPlusSemiRing, Dom::RationalExpression, Dom::SemiRing, Dom::WeightedAutomaton

Example 1:

Let us consider the set of Thompson automata defined over the alphabet {a,b} and whose scalars are taken in the set of integer numbers. First, we define the set of scalars and the alphabet:

Z:=Dom::Integer:

 

alphabet:=[a,b]:

 

Then the set of Z-Thompson automata is introduced:

TZ:=examples::Thompson(alphabet,Z):

 

Now we show how to create a Z-Thompson automaton corresponding to a rational Z-expression. Here, we distinguish between rational Z-expressions as objects of Dom::RationalExpression and their writings as strings because we do not need to create them:

TZ("2*star(a)+b")

+-                                           -+

| 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |,

+-                                           -+

 

             +-                                             -+

             |  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0  |

             |                                               |

             |  0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0  |

             |                                               |

   epsilon = |  0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0  |,

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1  |

             |                                               |

             |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

             +-                                             -+

 

       +-                                             -+

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

   a = |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |,

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       |                                               |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |

       +-                                             -+

 

       +-                                             -+  +-   -+

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  2  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

   b = |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |, |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  0  |

       |                                               |  |     |

       |  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  |  |  1  |

       +-                                             -+  +-   -+

 

Changes in MuPAD 4.0

New Function.