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

Implement efficient automata and regular languages #25041

Open
sagetrac-mercatp mannequin opened this issue Mar 27, 2018 · 129 comments
Open

Implement efficient automata and regular languages #25041

sagetrac-mercatp mannequin opened this issue Mar 27, 2018 · 129 comments

Comments

@sagetrac-mercatp
Copy link
Mannequin

sagetrac-mercatp mannequin commented Mar 27, 2018

Define a class DetAutomaton that permits to manipulate deterministic automata, and a class CAutomaton for non-deterministic automata. It implement efficient operations writted in C language to manipulate automata and regular languages.

a class DetAutomatonGenerators is usefull to generate easily DetAutomaton.

The ticket has bee refactore and is in now in a correct situation with doc test, documentation in thematic tutorial.

This ticket is necessary to for the ticket b-adic and the usage of its tools

CC: @seblabbe @videlec @dkrenn

Component: packages: standard

Keywords: automata, regular languages

Author: Paul Mercat, Dominique Benielli

Branch/Commit: public/implement_efficient_automata_and_regular_languages @ ee2753d

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

@sagetrac-mercatp sagetrac-mercatp mannequin added this to the sage-8.2 milestone Mar 27, 2018
@sagetrac-mercatp

This comment has been minimized.

@sagetrac-mercatp sagetrac-mercatp mannequin modified the milestones: sage-8.2, sage-8.3 May 17, 2018
@sagetrac-mercatp sagetrac-mercatp mannequin changed the title Implement efficient automata and computing with regular languages Implement efficient automata and regular languages May 17, 2018
@sagetrac-dbenielli
Copy link
Mannequin

sagetrac-dbenielli mannequin commented May 29, 2018

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 29, 2018

Commit: 7d3215a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 29, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

7d3215aautomaton ticket

@sagetrac-mercatp
Copy link
Mannequin Author

sagetrac-mercatp mannequin commented May 29, 2018

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 29, 2018

Changed commit from 7d3215a to d37f6ad

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 29, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

d37f6adAdd the last changes made in sage-8.1 (the version merged in sage-8.3.beta2 was not the last one).

@sagetrac-dbenielli
Copy link
Mannequin

sagetrac-dbenielli mannequin commented May 29, 2018

@fchapoton
Copy link
Contributor

comment:7

You should look at the patchbot report, and fix everything wrong..


New commits:

29bde5fsmall typo
bb7f446Merge branch 'u/mercatp/implement_efficient_automata_and_regular_languages' of git://trac.sagemath.org/sage into t/25041/implement_efficient_automata_and_regular_languages
7854c83small change for doc
86fe4besmall change for doc
814f67dMerge branch 'u/mercatp/implement_efficient_automata_and_regular_languages' of git://trac.sagemath.org/sage into t/25041/implement_efficient_automata_and_regular_languages

@fchapoton
Copy link
Contributor

Changed commit from d37f6ad to 814f67d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 30, 2018

Changed commit from 814f67d to 43429fd

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 30, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

d39d1e0for test
43429fdbigger alphabet to check

@sagetrac-mercatp
Copy link
Mannequin Author

sagetrac-mercatp mannequin commented Jun 1, 2018

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 5, 2018

Changed commit from 43429fd to 74e9cf7

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 5, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

74e9cf7Correct errors in doctests and doc.

@sagetrac-dbenielli
Copy link
Mannequin

sagetrac-dbenielli mannequin commented Jun 5, 2018

@sagetrac-mercatp
Copy link
Mannequin Author

sagetrac-mercatp mannequin commented Jun 5, 2018

@sagetrac-dbenielli
Copy link
Mannequin

sagetrac-dbenielli mannequin commented Jun 5, 2018

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 5, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

4252638reduce size doc

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 5, 2018

Changed commit from 74e9cf7 to 4252638

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 5, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

4e7aabctypo

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 5, 2018

Changed commit from 4252638 to 4e7aabc

@sagetrac-mercatp
Copy link
Mannequin Author

sagetrac-mercatp mannequin commented Jun 5, 2018

@seblabbe
Copy link
Contributor

comment:75

The branch does not apply anymore on the most recent development version of Sage.

I use the occasion to share some thoughts about this ticket. This is not the first time that a ticket is created to add a ton of new lines of code into Sage and in too many of those cases, the code just became dead on the sage trac for a ton of different reasons that I will not enumerate here (#21295, #16110, #12224 are examples which are taking years to complete). Therefore, now, I want to make sure that this does not happen again with this ticket since I am very interested in having a fast implementation of automaton available in Sage.

While I think that it is a very good idea that this ticket eventually gets merged into Sage, I would like to suggest to the authors of this ticket to consider the possibility of creating an independent Python Package containing this code beside this ticket. To me, this would be benefical for many reasons:

  • Python Package are easy to install, use and maintain.
  • If some important modifications that are backward incompatible are to be done in your code in the next two years, then no one will bother.
  • In Sage, code modification must be backward compatible. This means that you will lose a lot of time in adding deprecation warning to your code in the next years. Also, this means that you have to lose a lot of time right now while thinking about all the different use cases that people you don't know may have during using your code.
  • To me, the creation of a Python Package is a good way of making a new module go into Sage. Being use publically for one or two years as a Python Package before being included into Sage allows to be sure about the proper interface and without losing much time thinking about how other will use your code.
  • This is what I ended up doing for Add a cython implementation of the Kolakoski word #13346, Generation of Double square tiles #13069 and Add file sage/misc/latex_standalone.py and class TikzPicture #20343. Instead of waiting years for a review, I decided to put those module into my own python package (slabbe). And the day someone tells me that some of my code is interresting enough for others, then I will consider updating the ticket with the most recent version of the desired module. Meanwhile, I will not update my code at two places in parallel. The most recent version is in my package and slowly, it converges to something usable for many usage.
  • In the next two years, the code base of Sage may change and this can break the application the branch of this ticket (like right now today!), which makes your code unusable, untestable.

Here are examples of Python packages for Sage:

Good luck:)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 14, 2019

Changed commit from de8830b to 6ce5473

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 14, 2019

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

ca9819bdoc fail
85a6ce5link ok
e582064last fix for pdf generation
151fc61Merge branch 'public/b-adic' of git://trac.sagemath.org/sage into t/21072/public/b-adic
46a45d7Add doc in the thematic tutorial about Automtat and regular languages.
18e8588scale
c21c045Correct the thematic tutorial about automata and regular languages, and correct a little bug with DetAutomaton.plot().
79d2c3cMerge branch 'public/b-adic' of git://trac.sagemath.org/sage into public/b-adic
6d6356csdl .h librairy
6ce5473ticket automaton from -adic

@sagetrac-dbenielli

This comment has been minimized.

@videlec
Copy link
Contributor

videlec commented Feb 11, 2019

comment:78

This is certainly not a package: http://doc.sagemath.org/html/en/developer/packaging.html

@videlec
Copy link
Contributor

videlec commented Feb 11, 2019

comment:79

Are the two methods get_automatonc and get_Automaton the only things you will do to make the current Sage code and your code interact?

@videlec
Copy link
Contributor

videlec commented Feb 11, 2019

comment:80

If you intend to include your Python code in Sage sources then

  • all method names must be lower case with as few abbreviations as possible (e.g. proji is not acceptable)
  • all class names must be CAML case with as few abbreviations as possible (e.g. DetAutomaton should be DeterministicAutomaton)
    This is not an especially nice convention, but this is how it is.

@videlec
Copy link
Contributor

videlec commented Feb 11, 2019

comment:81

Why ON PLACE in the documentation of permut_op in upper case? What does on place mean? Do you want to say inplace?

@videlec
Copy link
Contributor

videlec commented Feb 11, 2019

comment:82

Your usage of sig_on/sig_off is very wrong. For example, the function getDict2 contains Python code on its first line

    A = list(A)

However, you wrote in the code of the method duplicate

        sig_on()
        dC = getDict2(d, self.A, d1=d1)
        sig_off()

As written in the cysignals documentation, the code between sig_on/sig_off should not contain any Python code.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 15, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

7cb0a09fix sig_on sig_off

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 15, 2019

Changed commit from 6ce5473 to 7cb0a09

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 15, 2019

Changed commit from 7cb0a09 to 706ca78

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 15, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

706ca78fix sig_on sig_off

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 15, 2019

Changed commit from 706ca78 to 0c03f34

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 15, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

0c03f34change name DetAutomaton to DeterministicAutomaton

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 21, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

4c341bcChange name "succ" to "successor". Check that the module BetaAdic exists in function WordMorphism.DumontThomas().

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 21, 2019

Changed commit from 0c03f34 to 4c341bc

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 21, 2019

Changed commit from 4c341bc to 5201b04

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 21, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

837d77eMerge branch 'develop' into public/implement_efficient_automata_and_regular_languages
cef8a1ddumont thomas update
5201b04dumont thomas update

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 21, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

598383bMerge branch 'develop' into t/25041/public/implement_efficient_automata_and_regular_languages
6cf74d5Merge branch 'public/implement_efficient_automata_and_regular_languages' of git://trac.sagemath.org/sage into t/25041/public/implement_efficient_automata_and_regular_languages
c0ab4e9Correct a little problem.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 21, 2019

Changed commit from 5201b04 to c0ab4e9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 22, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

ee2753dRename methods in cautomata.pyx in order to avoid shortcuts. Correct a little thing to avoid a bud of DiGraph.edges().

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 22, 2019

Changed commit from c0ab4e9 to ee2753d

@mkoeppe mkoeppe removed this from the sage-8.4 milestone Dec 29, 2022
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

5 participants