Opened 5 years ago

Closed 5 years ago

#16061 closed enhancement (fixed)

New method intersection (for automata and transducers) and new behavior of cartesian_product for transducers

Reported by: skropf Owned by:
Priority: major Milestone: sage-6.2
Component: combinatorics Keywords: finite_state_machine
Cc: dkrenn, cheuberg, slabbe Merged in:
Authors: Sara Kropf Reviewers: Daniel Krenn
Report Upstream: N/A Work issues:
Branch: 7633cac (Commits) Commit: 7633cacfb8a13dc5fc808a947e7f4db3e1bd9ef8
Dependencies: #16016 Stopgaps:


Intersection now constructs the automaton (or transducer) which accepts (computes) the intersection of the languages of the given automata (transducers). This was earlier done by cartesian_product. A given input is accepted if it was accepted by both given finite state machines. Furthermore, for transducers, the output has to be same in both given transducer. Furthermore, transitions with empty input (or output, for transducers) are not allowed.

For an automaton, cartesian_product does the same as intersection. But for transducers, it returns a transducer which computes the pairs of output labels of the given transducer with a given input. Thus, the output sequences of both given transducers for a given input are combined into a sequence of pairs of outputlabels.

A deprecation warning is given when Transducer.cartesian_product is called as the output has changed substantially.

Change History (3)

comment:1 Changed 5 years ago by skropf

  • Branch set to u/skropf/fsm/cartesian-product-intersection
  • Cc slabbe added
  • Commit set to 7633cacfb8a13dc5fc808a947e7f4db3e1bd9ef8
  • Status changed from new to needs_review

Last 10 new commits:

bb59856Corrected docstring of intersection and cartesian_product
a5cf1c7Transducer.cartesian_product: replaced FSMEmptyWordSymbol by None
30cba42Automaton.intersection: docstring remove_epsilon_transition corrected
4e26b52Merge branch 'fsm/cartesian-product-intersection' of into fsm/cartesian-product-intersection
d0f8287improved docstrings: linked methods
29fd372Transducer.cartesian_product: one example added with transducer and automaton
f37a4d3Transducer.cartesian_product: ticket number for deprecation warning corrected
1e310b0Minor changes: docstring, indentation
83b0341corrected one whitespace error
7633cacTransducer.cartesian_product: small correction in docstring

comment:2 Changed 5 years ago by dkrenn

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


  • I've reviewed, doctests pass, documentation looks fine
  • I made a couple of minor changes; those were cross-reviewed by the authors
  • my suggested improvements were included; I've reviewed those
  • it merges on 6.2.beta7

Therefore, this is a positive review for me.

comment:3 Changed 5 years ago by vbraun

  • Branch changed from u/skropf/fsm/cartesian-product-intersection to 7633cacfb8a13dc5fc808a947e7f4db3e1bd9ef8
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.