Opened 7 years ago

Closed 7 years ago

#19199 closed defect (fixed)

FiniteStateMachine: do not mess with color 'None'

Reported by: cheuberg Owned by:
Priority: major Milestone: sage-6.9
Component: finite state machines Keywords: color
Cc: skropf, dkrenn Merged in:
Authors: Clemens Heuberger Reviewers: Daniel Krenn
Report Upstream: N/A Work issues:
Branch: bcbbf62 (Commits, GitHub, GitLab) Commit: bcbbf6204602729400478cf149dc8fbcbe1ec0da
Dependencies: #19201, #18966, #19204 Stopgaps:

Status badges

Description

Currently, determinisation, product_FiniteStateMachine and related functions construct colors as frozensets or tuples of colors of its constituent states. If all colors are None, this leads to strange artifacts:

sage: A = Automaton([(0, 0, 0)], initial_states=[0], final_states=[0])
sage: [s.color for s in A.determinisation().iter_states()]
[frozenset({None})]
sage: [s.color for s in A.cartesian_product(A).iter_states()]
[(None, None)]
sage: T = Transducer([(0, 0, 0, 0)], initial_states=[0], final_states=[0])
sage: [s.color for s in T.composition(T).iter_states()]
[(None, None)]
sage: [s.color
....:  for s in T.product_FiniteStateMachine(
....:       T, lambda t1, t2: (0, 0)).iter_states()]
[(None, None)]

In those case, just use the color None if all constituent states have color None.

Change History (4)

comment:1 Changed 7 years ago by cheuberg

  • Branch set to u/cheuberg/fsm/color-None

comment:2 Changed 7 years ago by cheuberg

  • Commit set to bcbbf6204602729400478cf149dc8fbcbe1ec0da
  • Dependencies set to #19201, #18966, #19204
  • Status changed from new to needs_review

New commits:

04c9311Trac #19201: FiniteStateMachine.disjoint_union: fix doctests
23c9573Trac #18966: Merge #18964 (Kleene star), #18981 (completion), #18965 (concatenation)
5dceb30Trac #18966: Implement Automaton.complement
c67540aFix doctests
b1a6b60Trac #18966: Fix doctests
985b456Trac #19204: Implement Automaton.is_equivalent
af42518Trac #19201: Merge #19204 (Automaton.is_equivalent)
2278303Trac #19201: Rewrite doctest using is_equivalent
bcbbf62Trac #19199: FiniteStateMachine: do not mess with color 'None'

comment:3 Changed 7 years ago by dkrenn

  • Reviewers set to Daniel Krenn
  • Status changed from needs_review to positive_review

Code is fine, doc builds.

comment:4 Changed 7 years ago by vbraun

  • Branch changed from u/cheuberg/fsm/color-None to bcbbf6204602729400478cf149dc8fbcbe1ec0da
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.