Skip to content

Commit 88e78ed

Browse files
redefine star and derive concat
1 parent 7e7f69d commit 88e78ed

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

Katydid/Regex/Calculus.lean

+22-15
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,20 @@ def null_concat {α: Type} {P Q: Lang α}:
8383
case invFun =>
8484
exact fun ⟨x, y⟩ => ⟨[], [], x, y, rfl⟩
8585

86-
-- def null_star {α: Type} {P: Lang α}:
87-
-- null (star P) <-> (List (null P)) := by
88-
-- refine Iff.intro ?toFun ?invFun
89-
-- case toFun =>
90-
-- sorry
91-
-- case invFun =>
92-
-- sorry
86+
def null_star {α: Type} {P: Lang α}:
87+
null (star P) <-> True := by
88+
refine Iff.intro ?toFun ?invFun
89+
case toFun =>
90+
exact (fun _ => True.intro)
91+
case invFun =>
92+
intro t
93+
simp
94+
exists []
95+
apply And.intro
96+
· exact All.nil
97+
· intro l
98+
intro l'
99+
cases l'
93100

94101
def derive_emptyset {α: Type} {a: α}:
95102
(derive emptyset a) = emptyset :=
@@ -129,17 +136,17 @@ def derive_scalar {α: Type} {a: α} {s: Prop} {P: Lang α}:
129136
rfl
130137

131138
def derive_concat {α: Type} {a: α} {P Q: Lang α} {w: List α}:
132-
(derive (concat P Q) a) w <-> (scalar (null P) (or (derive Q a) (concat (derive P a) Q))) w := by
139+
(derive (concat P Q) a) w <-> (or (concat (derive P a) Q) (scalar (null P) (derive Q a))) w := by
133140
refine Iff.intro ?toFun ?invFun
134141
case toFun =>
135142
sorry
136143
case invFun =>
137144
sorry
138145

139-
-- def derive_star {α: Type} {a: α} {P: Lang α} {w: List α}:
140-
-- (derive (star P) a) w <-> (scalar (List (null P)) (concat (derive P a) (star P))) w := by
141-
-- refine Iff.intro ?toFun ?invFun
142-
-- case toFun =>
143-
-- sorry
144-
-- case invFun =>
145-
-- sorry
146+
def derive_star {α: Type} {a: α} {P: Lang α} {w: List α}:
147+
(derive (star P) a) w <-> (concat (derive P a) (star P)) w := by
148+
refine Iff.intro ?toFun ?invFun
149+
case toFun =>
150+
sorry
151+
case invFun =>
152+
sorry

0 commit comments

Comments
 (0)