SStateAmaranth
Produkt

Funkcje programu · Równoważność osiągalnych stanów DFA

01

Umieść tablice przejść i stany akceptujące obok śladu podziału, aby uzasadnić każde proponowane połączenie stanów.

01

Modele

Dodaj endpoint zgodny z OpenAI lub Anthropic, podając bazowy URL i klucz API, jeśli jest wymagany. Sprawdź połączenie. Lokalny serwer modelu musi działać; zdalne narzędzia mogą przesyłać dane oddzielnie.

02

Projekt

Wybierz folder i poproś asystenta o przeczytanie odpowiednich plików przed ich zmianą. Określ cel oraz granice zadania.

03

Zmiany

Sprawdzaj zmiany i wyniki poleceń. Uruchom testy projektu przed zaakceptowaniem rezultatu; wygenerowany kod nie jest automatycznie przetestowany.

Równoważność osiągalnych stanów DFA

● ● ●StateAmaranth●
Sposoby pracy · Równoważność osiągalnych stanów DFA ×
def dfa_classes(table, accepting):
    if type(table) is not list or not 1 <= len(table) <= 16:
        raise ValueError("state count")
    n = len(table)
    if type(table[0]) is not list or not 1 <= len(table[0]) <= 4:
        raise ValueError("alphabet size")
    width = len(table[0])
    if any(type(row) is not list or len(row) != width or
           any(type(x) is not int or not 0 <= x < n for x in row)
           for row in table):
        raise ValueError("complete transition table")
    if type(accepting) is not set or any(
        type(x) is not int or not 0 <= x < n for x in accepting):
        raise ValueError("accepting states")
    seen, pending = {0}, [0]
    while pending:
        for dest in table[pending.pop()]:
            if dest not in seen:
                seen.add(dest); pending.append(dest)
    groups = [g for g in (seen & accepting, seen - accepting) if g]
    while True:
        owner = {s: i for i, g in enumerate(groups) for s in g}
        refined = []
        for group in groups:
            buckets = {}
            for state in sorted(group):
                key = tuple(owner[d] for d in table[state])
                buckets.setdefault(key, set()).add(state)
            refined.extend(buckets.values())
        if len(refined) == len(groups):
            return sorted([sorted(g) for g in refined])
        groups = refined
✳Pogrupuj osiągalne stany pełnego DFA o najwyżej 16 stanach i czterech symbolach według akceptowanych sufiksów.
✓ ZmianySprawdź przed zastosowaniem ↗
Ilustracja środowiska
Środowisko programowania z AI

Tutaj zaczyna się kolejny pomysł.

Pobierz dla Windows ↗