Automata in Python.
Project description
automatata
Automata in Python!
Usage
Here's a Discrete Finite Automaton that accepts words that contain an even number of "a"s and "b"s.
from automatata.models.dfa import DFA
evens = DFA(
language={"a", "b"},
edges={
0: {
"a": 1,
"b": 1,
},
1: {
"a": 0,
"b": 0,
},
},
start=0,
goal={0},
)
assert evens.valid("")
assert not evens.valid("a")
assert evens.valid("ab")
assert evens.valid("ba")
assert not evens.valid("aba")
assert not evens.valid("aab")
assert not evens.valid("abb")
for i in range(10):
for p in permutations("a"*i + "b"+i):
assert evens.valid(p)
assert evens.valid("aaaabb")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
automatata-0.0.1.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file automatata-0.0.1.tar.gz
.
File metadata
- Download URL: automatata-0.0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3444fb3780a425f044b853a861fa4b2e27bea3dec3049b0cfa91268cf656c89c
|
|
MD5 |
50e7725df22b85561dd6cb8e7fd32dfe
|
|
BLAKE2b-256 |
48c05145234351263c439e06728f1bfcf0b16c118912c0c754b6959b8751e932
|
File details
Details for the file automatata-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: automatata-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
2bdb4a78b03b123c29694582ebaf51771627b274d8c4ecbaf801564a53800ffb
|
|
MD5 |
2ed72bae48b1ef5e2359f8a7627ef392
|
|
BLAKE2b-256 |
addfab91d205ee6e8ecf1f6f76453c05407ca4b0885c86b53b162fc3f0127015
|