Code Monkey home page Code Monkey logo

Comments (6)

mvcisback avatar mvcisback commented on June 5, 2024

hi, what version of python and the dfa package are you using?

from dfa.

mvcisback avatar mvcisback commented on June 5, 2024

Hi @tomyaacov

Sorry about the confusion. I just realized that there was a regression in the readme. The composition API was dropped a while back and it was removed from the readme.

It looks like it was accidentally brought back when cherry picking and old patch.

from dfa.

tomyaacov avatar tomyaacov commented on June 5, 2024

Ok.. thanks for replying. Is there an older version of the package which includes composition?

from dfa.

mvcisback avatar mvcisback commented on June 5, 2024

So it was explored in an experimental feature branch.

I actually think it might be good to try and explore adding the feature again, but I won't have time to really investigate (and then commit to maintaining) until ~May.

I'm happy to accept a PR though.

Are you just interested in parallel composition? Or do you generally want parallel + sequential composition?

For small alphabets, it's fairly easy to write code that implements these. For example parallel composition should be something like:

from dfa import DFA

def par_compose(dfas: list[DFA]) -> DFA:
    def transition(state, char):
        return tuple(d._transition(s, c) for d, s, c in zip(dfas, state, char))
        
   def label(state):
       return tuple(d._label(s) for s in zip(dfas, state))
       
   return DFA(
       start=tuple(d.start for d in dfas),
       inputs=product(d.inputs for d in dfas),
       outputs=product(d.outputs for d in dfas),
       label=label,
       transition=transition,
   )

from dfa.

mvcisback avatar mvcisback commented on June 5, 2024

To be clear, the real pain is writing logic to symbolically handle sum and product alphabets.

It's not impossible, but I recall there being subtle edge cases.

Typically, I do composition at the circuit level using the py-aiger library.

from dfa.

tomyaacov avatar tomyaacov commented on June 5, 2024

Will check it out. Thanks!

from dfa.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.