Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FiniteStateMachine.composition: check types #16758

Closed
cheuberg opened this issue Aug 4, 2014 · 8 comments
Closed

FiniteStateMachine.composition: check types #16758

cheuberg opened this issue Aug 4, 2014 · 8 comments

Comments

@cheuberg
Copy link
Contributor

cheuberg commented Aug 4, 2014

The output of an automaton should not be feedable into a transducer (because there is none); when composing an automaton with a transducer, the result should be an automaton.

The aim would be:

sage: from sage.combinat.finite_state_machine import (
....:     is_Automaton, is_Transducer)
sage: T = Transducer([(0, 0, 0, 0)], initial_states=[0])
sage: A = Automaton([(0, 0, 0)], initial_states=[0])
sage: T.composition(A, algorithm='direct')
Traceback (most recent call last):
...
TypeError: Composition with automaton is not possible.
sage: T.composition(A, algorithm='explorative')
Traceback (most recent call last):
...
TypeError: Composition with automaton is not possible.
sage: A.composition(A, algorithm='direct')
Traceback (most recent call last):
...
TypeError: Composition with automaton is not possible.
sage: A.composition(A, algorithm='explorative')
Traceback (most recent call last):
...
TypeError: Composition with automaton is not possible.
sage: is_Automaton(A.composition(T, algorithm='direct'))
True
sage: is_Automaton(A.composition(T, algorithm='explorative'))
True

This is now achieved by this patch.

CC: @sagetrac-skropf @dkrenn

Component: finite state machines

Keywords: composition

Author: Clemens Heuberger

Branch/Commit: 61f6acf

Reviewer: Daniel Krenn

Issue created by migration from https://trac.sagemath.org/ticket/16758

@cheuberg
Copy link
Contributor Author

cheuberg commented Aug 4, 2014

New commits:

5704b11trac #16758: Add failing doctests
6dc0263trac #16758: Disallow composition with automaton
61f6acftrac #16758: Use class of outer machine in composition

@cheuberg
Copy link
Contributor Author

cheuberg commented Aug 4, 2014

Branch: u/cheuberg/fsm/composition-types

@cheuberg

This comment has been minimized.

@cheuberg
Copy link
Contributor Author

cheuberg commented Aug 4, 2014

Commit: 61f6acf

@cheuberg
Copy link
Contributor Author

cheuberg commented Aug 4, 2014

Author: Clemens Heuberger

@dkrenn
Copy link
Contributor

dkrenn commented Aug 5, 2014

Reviewer: Daniel Krenn

@dkrenn
Copy link
Contributor

dkrenn commented Aug 5, 2014

comment:3

Fine for me.

@vbraun
Copy link
Member

vbraun commented Aug 6, 2014

Changed branch from u/cheuberg/fsm/composition-types to 61f6acf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants