Commit b704510 1 parent 4468363 commit b704510 Copy full SHA for b704510
File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ def derive' (P: Lang α) (a: α): Lang α :=
18
18
def null {α: Type } (f: List α -> Prop ): Prop :=
19
19
f []
20
20
21
- def derives {α: Type } (f: List α -> Prop ) (u : List α): (List α -> Prop ) :=
22
- λ v => f (u ++ v )
21
+ def derives {α: Type } (f: List α -> Prop ) (xs : List α): (List α -> Prop ) :=
22
+ λ ys => f (xs ++ ys )
23
23
24
24
def derive {α: Type } (f: List α -> Prop ) (a: α): (List α -> Prop ) :=
25
25
derives f [a]
@@ -29,22 +29,28 @@ attribute [simp] null derive derives
29
29
def derives_emptylist : derives f [] = f :=
30
30
rfl
31
31
32
- def derives_strings (f: List α -> Prop ) (u v : List α): derives f (u ++ v ) = derives (derives f u) v :=
33
- match u with
32
+ def derives_strings (f: List α -> Prop ) (xs ys : List α): derives f (xs ++ ys ) = derives (derives f xs) ys :=
33
+ match xs with
34
34
| [] => rfl
35
- | (a :: u' ) => derives_strings (derive f a) u' v
35
+ | (x :: xs ) => derives_strings (derive f x) xs ys
36
36
37
37
def null_derives (f: List α -> Prop ) (u: List α): (null ∘ derives f) u = f u := by
38
38
simp
39
39
40
- def derives_foldl (f: List α -> Prop ) (u: List α): (derives f) u = (List.foldl derive f) u := by
41
- induction u with
40
+ def derives_foldl (f: List α -> Prop ) (xs: List α): (derives f) xs = (List.foldl derive f) xs := by
41
+ revert f
42
+ induction xs with
42
43
| nil =>
43
44
simp
44
45
unfold derives
45
46
simp
46
47
| cons x xs ih =>
47
- sorry
48
+ intro f
49
+ unfold List.foldl
50
+ have h: x :: xs = [x] ++ xs := by simp
51
+ rw [h]
52
+ rw [derives_strings]
53
+ apply ih
48
54
49
55
def null_emptyset {α: Type }:
50
56
@null α emptyset = False :=
You can’t perform that action at this time.
0 commit comments