`automaton`

`.eliminate_state(`

`state`

`)`

¶In the Brzozowski-McCluskey procedure, remove one state.

Preconditions:

- The labelset is oneset (i.e., the automaton is spontaneous).
- The weightset is expressionset (i.e., the weights are expressions).
- The
is indeed a state of the automaton, or it is -1, in which case a heuristics is used to select the next state.`state`

See also:

In [1]:

```
import vcsn
```

The following examples will use this automaton as input.

In [2]:

```
a0 = vcsn.B.expression('ab*c').standard()
a0
```

Out[2]:

*automaton*.lift.

In [3]:

```
a1 = a0.lift()
a1
```

Out[3]:

Let's remove state 2:

In [4]:

```
a2 = a1.eliminate_state(2)
a2
```

Out[4]:

Note that the result is a fresh automaton: the original automaton is not modified:

In [5]:

```
a1
```

Out[5]:

Let's eliminate state 1.

In [6]:

```
a3 = a2.eliminate_state(1)
a3
```

Out[6]:

We can also remove the initial and final states.

In [7]:

```
a4 = a3.eliminate_state(0)
a4
```

Out[7]:

*broken* automaton, with no states, but a "lone transition" that bears the answer.

In [8]:

```
a5 = a4.eliminate_state(1)
a5
```

Out[8]:

Use -1 (or no argument at all) to leave the choice of the next state to eliminate to Vcsn. This is how automaton.expression works.

In [9]:

```
a1.eliminate_state()
```

Out[9]:

In [10]:

```
a1.eliminate_state().eliminate_state().eliminate_state().eliminate_state()
```

Out[10]:

You may use the following widgets to see, step by step, how state elimination works.

In [11]:

```
a2 = a1 ** 2
%demo a2 eliminate_state
```