mvcisback / dfa Goto Github PK
View Code? Open in Web Editor NEWA simple python implementation of a DFA.
License: MIT License
A simple python implementation of a DFA.
License: MIT License
Hi,
I started using the package and tried to run the following code described at the README:
parity = DFA(
start=0, inputs={0, 1}, label=lambda s: s,
transition=lambda s, c: (s + c) & 1,
)
self_composed = parity | parity
assert self_composed.label([(0, 0), (1, 0)]) == (1, 0)
and I'm getting the following error:
TypeError: unsupported operand type(s) for |: 'DFA' and 'DFA'
dfa
objects are incompatible with both pickle
and dill
.
import dfa
import dill
dfa1 = dfa.DFA(start=0,
inputs = {0,1},
label=lambda s: (s % 4) == 3,
transition=lambda s, c: (s + c) % 4,
)
with open('temp.dill', 'wb') as f:
dill.dump(dfa1, f)
This code fails with error _pickle.PicklingError: Can't pickle <function _make_lookuper.<locals>.make_lookuper at 0x102a2b5e0>: it's not found as funcy.calc._make_lookuper.<locals>.make_lookuper
.
In paths(...)
in dfa/utils.py
, there is a potential for an infinite loop when there are only a finite number of paths available for a given DFA, but paths is called a greater number of times than that.
@mvcisback and I discovered this issue when iterating on DFAs that were the result of XOR operations between two existing DFAs.
The following code fails, which is slightly unexpected:
dfa1 = DFA(
start=0,
inputs={0, 1},
outputs=None,
label=lambda s: (s % 4) == 3,
transition=lambda s, c: (s + c) % 4,
)
I would expect this to be the same as not setting any outputs.
Setting an empty dictionary yields problems with the lstar library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.