Commit 16788c8 1 parent c028877 commit 16788c8 Copy full SHA for 16788c8
File tree 1 file changed +22
-2
lines changed
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -319,12 +319,32 @@ def orFromList (xs: NonEmptyList (Regex α)): Regex α :=
319
319
| NonEmptyList.mk x1 (x2::xs) =>
320
320
Regex.or x1 (orFromList (NonEmptyList.mk x2 xs))
321
321
322
+ private theorem orFromList_is_or_nonEmptyList (x1 x2: Regex α) (xs: List (Regex α)):
323
+ orFromList (NonEmptyList.mk x1 (x2 :: xs)) = Regex.or x1 (orFromList (NonEmptyList.mk x2 xs )) := by
324
+ simp only [orFromList]
325
+
326
+ private theorem orFromList_cons_NonEmptyList_is_or (x1: Regex α) (xs2: NonEmptyList (Regex α)):
327
+ orFromList (NonEmptyList.cons x1 xs2) = Regex.or x1 (orFromList xs2) := by
328
+ unfold orFromList
329
+ unfold NonEmptyList.cons
330
+ simp only [Regex.or.injEq, true_and]
331
+ cases xs2 with
332
+ | mk head tail =>
333
+ cases tail with
334
+ | nil =>
335
+ simp
336
+ unfold orFromList
337
+ rfl
338
+ | cons t1 t2 =>
339
+ simp
340
+ rw [orFromList_is_or_nonEmptyList]
341
+
322
342
theorem orToList_is_orFromList (x: Regex α):
323
343
orFromList (orToList x) = x := by
324
344
induction x <;> (try simp only [orToList, orFromList])
325
345
· case or x1 x2 ih1 ih2 =>
326
- -- TODO
327
- sorry
346
+ rw [orFromList_cons_NonEmptyList_is_or]
347
+ rw [ih2]
328
348
329
349
-- 1. If x or y is emptyset then return the other (Language.simp_or_emptyset_r_is_l and Language.simp_or_emptyset_l_is_r)
330
350
-- 2. If x or y is star (any) then return star (any) (Language.simp_or_universal_r_is_universal and Language.simp_or_universal_l_is_universal)
You can’t perform that action at this time.
0 commit comments