SStateAmaranth
製品

ソフトウェアの機能 · 到達可能なDFA状態の同値性

01

遷移表と受理集合を分割の履歴に並べ、各状態統合の理由を確認できるようにします。

01

モデル

OpenAI互換またはAnthropicのエンドポイントを、ベースURLと必要なAPIキーで設定し、接続をテストします。ローカルのモデルサーバーは起動が必要です。リモートツールは別途データを送信する場合があります。

02

プロジェクト

フォルダーを選び、編集前に関連ファイルを読むようアシスタントに依頼します。作業の目的と変更範囲を明確にしてください。

03

変更内容

変更内容とコマンド出力を確認します。結果を採用する前にプロジェクトの検証を実行してください。生成コードが自動的にテスト済みになるわけではありません。

到達可能なDFA状態の同値性

● ● ●StateAmaranth●
ワークフロー · 到達可能な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
✳最大16状態・4記号の完全DFAで、到達可能状態を受理する接尾辞により分類します。
✓ 変更内容適用前に確認 ↗
ワークスペースのイメージ
AIコーディングワークスペース

次のアイデアはここから。

Windows版をダウンロード ↗