Skip to content

Commit 8e9741e

Browse files
committed
Add first direction of Kleene's theorem
1 parent 8ad59b7 commit 8e9741e

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

TraceTheory/TraceTheory/Computability.lean

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Mathlib.Computability.EpsilonNFA
22
import Mathlib.Computability.Language
3+
import Mathlib.Computability.RegularExpressions
34

45
open Classical Computability
56

@@ -608,3 +609,28 @@ theorem IsRegular.singleton {a : α} : IsRegular ({ [a] }) := by
608609
exact DFA.accepts_char
609610

610611
end Language
612+
613+
namespace RegularExpressions
614+
615+
theorem IsRegular.matches (P : RegularExpression α) : Language.IsRegular (P.matches') := by
616+
induction P with
617+
| zero =>
618+
simp
619+
exact Language.IsRegular.zero
620+
| epsilon =>
621+
simp
622+
exact Language.IsRegular.one
623+
| char =>
624+
simp
625+
exact Language.IsRegular.singleton
626+
| plus _ _ ih₁ ih₂ =>
627+
simp
628+
exact Language.IsRegular.add ih₁ ih₂
629+
| comp _ _ ih₁ ih₂ =>
630+
simp
631+
exact Language.IsRegular.mul ih₁ ih₂
632+
| star _ ih =>
633+
simp
634+
exact Language.IsRegular.kstar ih
635+
636+
end RegularExpressions

0 commit comments

Comments
 (0)