Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determinization #24

Merged
merged 28 commits into from
Oct 8, 2024
Merged

Determinization #24

merged 28 commits into from
Oct 8, 2024

Conversation

stschaef
Copy link
Collaborator

@stschaef stschaef commented Oct 8, 2024

Demonstrate the weak equivalence between an NFA and its epsilon-saturated powerset DFA

Defining the term from NFA traces to DFA traces is straightforward

 NFA→DFA : ∀ q →
    N.Trace true q ⊢
      &[ X ∈ ε-closed ]
      &[ q∈X ∈ q ∈-ε-closed X ] ℙN.Trace true X

Defining the map back needs a way to order the many traces that the DFA encodes and then take the smallest. Given a trace in the DFA into subset X, we may choose the smallest NFA trace that X encodes

  DFA→NFA : ∀ X →
    ℙN.Trace true X ⊢
      ⊕[ q ∈ ⟨ N.Q ⟩ ]
      ⊕[ q∈X ∈ q ∈-ε-closed X ] N.Trace true q

and then we compose that with a function that pulls this trace back to the initial state

  fold-walk :
    (q : ⟨ N.Q ⟩) → (X : ⟨ FinSetDecℙ N.Q ⟩) →
    (q' : ⟨ N.Q ⟩) →
    (q∈εX : q ∈-ε-closed ε-closure X) →
    (q'-[ε*]→q : GraphWalk' ε-graph q q') →
    N.Trace true q ⊢ N.Trace true q'

To all result in the function we really want

  DFA→NFA-init :
    ℙN.Trace true (ε-closure (SingletonDecℙ {A = N.Q} N.init))
      ⊢ N.Trace true (N .init)

@stschaef stschaef requested a review from maxsnew October 8, 2024 08:48
@stschaef stschaef mentioned this pull request Oct 8, 2024
@maxsnew
Copy link
Owner

maxsnew commented Oct 8, 2024

it's not compiling rn

@maxsnew
Copy link
Owner

maxsnew commented Oct 8, 2024

Looks like it's because you deleted the old NFA code instead of making a new module so all of the regex stuff is just broken. I'll add it back in a separate module and I might do a big re-org

@maxsnew maxsnew merged commit 7e76a4a into main Oct 8, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants