Skip to main content

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")

Release files for automatata 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for automatata 0.0.1
File Size Uploaded
automatata-0.0.1.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for automatata 0.0.1
File Interpreter ABI Platform
automatata-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.9 kB

Release files / automatata-0.0.1.tar.gz

Download URL automatata-0.0.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3444fb3780a425f044b853a861fa4b2e27bea3dec3049b0cfa91268cf656c89c
BLAKE2b-256 checksum
How to use checksums
48c05145234351263c439e06728f1bfcf0b16c118912c0c754b6959b8751e932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / automatata-0.0.1-py3-none-any.whl

Download URL automatata-0.0.1-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bdb4a78b03b123c29694582ebaf51771627b274d8c4ecbaf801564a53800ffb
BLAKE2b-256 checksum
How to use checksums
addfab91d205ee6e8ecf1f6f76453c05407ca4b0885c86b53b162fc3f0127015
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page