Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cslib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public import Cslib.Computability.Automata.DA.Prod
public import Cslib.Computability.Automata.DA.ToNA
public import Cslib.Computability.Automata.EpsilonNA.Basic
public import Cslib.Computability.Automata.EpsilonNA.ToNA
public import Cslib.Computability.Automata.EpsilonNA.ToSingleAccept
public import Cslib.Computability.Automata.NA.Basic
public import Cslib.Computability.Automata.NA.BuchiEquiv
public import Cslib.Computability.Automata.NA.BuchiInter
Expand All @@ -32,7 +33,7 @@ public import Cslib.Computability.Languages.MyhillNerode
public import Cslib.Computability.Languages.OmegaLanguage
public import Cslib.Computability.Languages.OmegaRegularLanguage
public import Cslib.Computability.Languages.RegularLanguage
public import Cslib.Computability.Machines.SingleTapeTuring.Basic
public import Cslib.Computability.Machines.Turing.SingleTape.Deterministic
public import Cslib.Computability.URM.Basic
public import Cslib.Computability.URM.Computable
public import Cslib.Computability.URM.Defs
Expand Down Expand Up @@ -81,6 +82,7 @@ public import Cslib.Foundations.Semantics.LTS.Divergence
public import Cslib.Foundations.Semantics.LTS.Execution
public import Cslib.Foundations.Semantics.LTS.HasTau
public import Cslib.Foundations.Semantics.LTS.LTSCat.Basic
public import Cslib.Foundations.Semantics.LTS.Map
public import Cslib.Foundations.Semantics.LTS.Notation
public import Cslib.Foundations.Semantics.LTS.OmegaExecution
public import Cslib.Foundations.Semantics.LTS.Relation
Expand Down
5 changes: 2 additions & 3 deletions Cslib/Computability/Automata/EpsilonNA/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ namespace FinAcc
that trace from the start state. -/
@[scoped grind =]
instance : Acceptor (FinAcc State Symbol) Symbol where
Accepts (a : FinAcc State Symbol) (xs : List Symbol) :=
∃ s ∈ a.εClosure a.start, ∃ s' ∈ a.accept,
a.saturate.MTr s (xs.map (some ·)) s'
Accepts (a : FinAcc State Symbol) (xs : List Symbol) :=
∃ s ∈ a.start, ∃ s' ∈ a.accept, a.SMTr s (xs.map Option.some) s'
Comment on lines +49 to +50

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old indentation pattern is the correct one.


end FinAcc

Expand Down
69 changes: 34 additions & 35 deletions Cslib/Computability/Automata/EpsilonNA/ToNA.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,13 @@ Authors: Fabrizio Montesi
module

public import Cslib.Computability.Automata.EpsilonNA.Basic
public import Cslib.Foundations.Semantics.LTS.Map

/-! # Translation of εNA into NA -/

@[expose] public section

namespace Cslib

/-- Converts an `LTS` with Option labels into an `LTS` on the carried label type, by removing all
ε-transitions. -/
@[local grind =]
def LTS.noε (lts : LTS State (Option Label)) : LTS State Label where
Tr s μ s' := lts.Tr s (some μ) s'

@[local grind .]
private lemma LTS.noε_saturate_tr
{lts : LTS State (Option Label)} {h : μ = some μ'} :
lts.saturate.Tr s μ s' ↔ lts.saturate.noε.Tr s μ' s' := by
grind

@[scoped grind =]
lemma LTS.noε_saturate_mTr {lts : LTS State (Option Label)} :
lts.saturate.MTr s (μs.map some) = lts.saturate.noε.MTr s μs := by
ext s'
induction μs generalizing s <;> grind [<= LTS.MTr.stepL]

namespace Automata.εNA.FinAcc
namespace Cslib.Automata.εNA.FinAcc

variable {State Symbol : Type*}

Expand All @@ -41,21 +22,39 @@ variable {State Symbol : Type*}
def toNAFinAcc (a : εNA.FinAcc State Symbol) : NA.FinAcc State Symbol where
start := a.εClosure a.start
accept := a.accept
Tr := a.saturate.noε.Tr
toLTS := a.saturate.mapLabel Option.some

open Acceptor in
open scoped NA.FinAcc in
open scoped NA.FinAcc LTS LTS.MTr LTS.STr LTS.SMTr in
/-- Correctness of `toNAFinAcc`. -/
@[scoped grind _=_]
theorem toNAFinAcc_language_eq {ena : εNA.FinAcc State Symbol} :
language ena.toNAFinAcc = language ena := by
@[scoped grind =]
theorem toNAFinAcc_language_eq {a : εNA.FinAcc State Symbol} :
language a.toNAFinAcc = language a := by
ext xs
have : ∀ s s', ena.saturate.MTr s (xs.map some) s' = ena.saturate.noε.MTr s xs s' := by
simp [LTS.noε_saturate_mTr]
#adaptation_note
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
grind [Accepts]

end Automata.εNA.FinAcc

end Cslib
apply Iff.intro <;> intro h <;> rcases h with ⟨s, hs, s', hs', h⟩

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intro and rcases can be merged into rintro.

case mp =>
have h_start : ∃ sStart ∈ a.start, a.τSTr sStart s := by
simp only [toNAFinAcc, εClosure, LTS.τClosure, LTS.setImage, Set.mem_iUnion,
exists_prop] at hs
rcases hs with ⟨sStart, h_sStart, hs⟩
exists sStart
apply And.intro h_sStart
simp only [LTS.image, LTS.saturate, Set.mem_setOf_eq] at hs
grind only [LTS.sTr_τSTr_iff]
rcases h_start with ⟨sStart, h_sStart, h_start⟩
exists sStart
apply And.intro (by grind)
exists s'
apply And.intro (by grind)
apply LTS.SMTr.comp (μs₁ := []) (s₂ := s) <;> grind
case mpr =>
cases xs with
| nil =>
exists s'
simp only [toNAFinAcc, LTS.saturate, LTS.τClosure]
grind [cases LTS.SMTr]
| cons x xs =>
exists s
grind

end Cslib.Automata.εNA.FinAcc
Loading
Loading