Skip to content

Commit b376ce5

Browse files
remove generic Pred parameter from Grammar
1 parent c90e554 commit b376ce5

24 files changed

Lines changed: 147 additions & 147 deletions

Validator/Derive/Enter.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Validator.Expr.Symbol
77

88
namespace Enter
99

10-
def deriveEnter (xs: Rules n α Pred l): IfExprs n α (Symbol.nums xs) :=
10+
def deriveEnter (xs: Rules n (Pred α) l): IfExprs n α (Symbol.nums xs) :=
1111
List.Vector.map
1212
(fun (pred, ref) => IfExpr.mk pred ref)
1313
(Symbol.Symbols.cast
@@ -16,7 +16,7 @@ def deriveEnter (xs: Rules n α Pred l): IfExprs n α (Symbol.nums xs) :=
1616
)
1717

1818
class DeriveEnter (m: Type -> Type u) (n: Nat) (α: outParam Type) where
19-
deriveEnter {l: Nat} (xs: Rules n α Pred l): m (IfExprs n α (Symbol.nums xs))
19+
deriveEnter {l: Nat} (xs: Rules n (Pred α) l): m (IfExprs n α (Symbol.nums xs))
2020

21-
def deriveEnter_list (xs: List (Rule n α Pred)): List (IfExpr n α) :=
21+
def deriveEnter_list (xs: List (Rule n (Pred α))): List (IfExpr n α) :=
2222
List.map (fun (pred, ref) => IfExpr.mk pred ref) (Symbol.extracts_list xs []).2

Validator/Derive/Leave.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Validator.Derive.Enter
55

66
namespace Leave
77

8-
def leave (x: Regex (Fin l)) (es: Symbol.Symbols (Pred α × Ref n) l) (ns: List.Vector Bool l): (Rule n α Pred) :=
8+
def leave (x: Regex (Fin l)) (es: Symbol.Symbols (Pred α × Ref n) l) (ns: List.Vector Bool l): (Rule n (Pred α)) :=
99
match x with
1010
| Regex.emptyset => Regex.emptyset
1111
| Regex.emptystr => Regex.emptyset
@@ -31,7 +31,7 @@ def deriveLeave
3131
(xs: List.Vector (Regex (Fin l1)) l2)
3232
(es: Symbol.Symbols (Pred α × Ref n) l1)
3333
(ns: List.Vector Bool l1)
34-
: (Rules n α Pred l2) :=
34+
: (Rules n (Pred α) l2) :=
3535
match xs with
3636
| ⟨[], h⟩ => ⟨[], h⟩
3737
| ⟨x::xs, h⟩ =>
@@ -46,14 +46,14 @@ def deriveLeave
4646
)
4747

4848
def deriveLeaves
49-
(xs: Rules n α Pred l)
49+
(xs: Rules n (Pred α) l)
5050
(ns: List.Vector Bool (Symbol.nums xs))
51-
: (Rules n α Pred l) :=
51+
: (Rules n (Pred α) l) :=
5252
let (regexes, symbols) := Symbol.extracts xs List.Vector.nil
5353
deriveLeave regexes symbols (Symbol.Symbols.cast ns (by simp only [zero_add]))
5454

55-
def deriveLeaveM [Monad m] {n: Nat} {l: Nat} (xs: Rules n α Pred l) (ns: List.Vector Bool (Symbol.nums xs)): m (Rules n α Pred l) := do
55+
def deriveLeaveM [Monad m] {n: Nat} {l: Nat} (xs: Rules n (Pred α) l) (ns: List.Vector Bool (Symbol.nums xs)): m (Rules n (Pred α) l) := do
5656
return deriveLeaves xs ns
5757

5858
class DeriveLeaveM (m: Type -> Type u) (n: Nat) (α: outParam Type) where
59-
deriveLeaveM {l: Nat} (xs: Rules n α Pred l) (ns: List.Vector Bool (Symbol.nums xs)): m (Rules n α Pred l)
59+
deriveLeaveM {l: Nat} (xs: Rules n (Pred α) l) (ns: List.Vector Bool (Symbol.nums xs)): m (Rules n (Pred α) l)

Validator/Expr/Compress.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,16 @@ def vector_cast (h: n = m) (xs: List.Vector α n): List.Vector α m := by
133133
subst h
134134
exact xs
135135

136-
def compress [DecidableEq α] (xs: Rules n α Pred l1): Σ l2, ((Rules n α Pred l2) × (Indices l2 l1)) :=
137-
let xs_list: List (Rule n α Pred) := xs.toList
136+
def compress [DecidableEq α] (xs: Rules n (Pred α) l1): Σ l2, ((Rules n (Pred α) l2) × (Indices l2 l1)) :=
137+
let xs_list: List (Rule n (Pred α)) := xs.toList
138138
have hn : xs_list.length = l1 := by
139139
simp_all only [List.Vector.toList_length, xs_list]
140140

141141
-- sort to increase chance of cache hit
142142
-- TODO: let sxs := List.mergeSort xs
143143

144144
-- remove duplicates
145-
let xs_noreps: { ys: List (Rule n α Pred) // ∀ x ∈ xs_list, x ∈ ys } := eraseReps_sub xs_list
145+
let xs_noreps: { ys: List (Rule n (Pred α)) // ∀ x ∈ xs_list, x ∈ ys } := eraseReps_sub xs_list
146146

147147
-- get indices
148148
let xs_idxs: List.Vector (Fin (xs_noreps.val).length) (List.length xs_list) := indices xs_noreps
@@ -228,10 +228,10 @@ def indexOf [DecidableEq α] (xs: List.Vector (Regex α) l) (y: Regex α) (h: y
228228
then Index.emptyset
229229
else Index.val (indexOf' xs y (memVector_emptyset h hy))
230230

231-
def ofIndex' (xs: Rules n α Pred l) (index: Fin l): Rule n α Pred :=
231+
def ofIndex' (xs: Rules n (Pred α) l) (index: Fin l): Rule n (Pred α) :=
232232
xs.get index
233233

234-
def ofIndex (xs: Rules n α Pred l) (index: Index l): Rule n α Pred :=
234+
def ofIndex (xs: Rules n (Pred α) l) (index: Index l): Rule n (Pred α) :=
235235
match index with
236236
| Index.emptyset => Regex.emptyset
237237
| Index.val n => ofIndex' xs n
@@ -436,12 +436,12 @@ def smallest [DecidableEq α] [LT α] [DecidableLT α] (xs: List.Vector α l) (y
436436
-- | Option.some dup => sorry
437437
-- | Option.some i => sorry
438438

439-
def compressM [DecidableEq α] [Monad m] (xs: Rules n α Pred l1): m (Σ l2, (Rules n α Pred l2) × Indices l2 l1) := do
439+
def compressM [DecidableEq α] [Monad m] (xs: Rules n (Pred α) l1): m (Σ l2, (Rules n (Pred α) l2) × Indices l2 l1) := do
440440
return compress xs
441441

442442
-- expand expands a list of expressions.
443-
def expand (indices: Indices l1 l2) (xs: Rules n α Pred l1): (Rules n α Pred l2) :=
443+
def expand (indices: Indices l1 l2) (xs: Rules n (Pred α) l1): (Rules n (Pred α) l2) :=
444444
List.Vector.map (ofIndex xs) indices
445445

446-
def expandM [Monad m] (indices: Indices l1 l2) (xs: Rules n α Pred l1): m (Rules n α Pred l2) :=
446+
def expandM [Monad m] (indices: Indices l1 l2) (xs: Rules n (Pred α) l1): m (Rules n (Pred α) l2) :=
447447
return (expand indices xs)

Validator/Expr/Grammar.lean

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,42 @@ import Validator.Expr.Language
1616
-- n = the number of non-terminals
1717
abbrev Ref (n: Nat) := Fin n -- non-terminal
1818

19-
abbrev Rule (n: Nat) (α: Type) (Φ: (α: Type) -> Type) :=
20-
Regex (Φ α × Ref n)
19+
abbrev Rule (n: Nat) (Φ: Type) :=
20+
Regex (Φ × Ref n)
2121

22-
abbrev Rules (n: Nat) (α: Type) (Φ: (α: Type) -> Type) (l: Nat) :=
23-
List.Vector (Rule n α Φ) l
22+
abbrev Rules (n: Nat) (Φ: Type) (l: Nat) :=
23+
List.Vector (Rule n Φ) l
2424

2525
def hashVector [Hashable α] (xs: List.Vector α n): UInt64 :=
2626
hash xs.toList
2727

2828
instance (α: Type) (n: Nat) [Hashable α] : Hashable (List.Vector α n) where
2929
hash := hashVector
3030

31-
def hashRules {n: Nat} {α: Type} {Φ: (α: Type) -> Type} {l: Nat} [Hashable α] [Hashable (Φ α)] (xs: Rules n α Φ l): UInt64 :=
31+
def hashRules {n: Nat} {Φ: Type} {l: Nat} [Hashable Φ] (xs: Rules n Φ l): UInt64 :=
3232
hash xs.toList
3333

34-
instance (n: Nat) (α: Type) (Φ: (α: Type) -> Type) (l: Nat) [Hashable α] [Hashable (Φ α)] : Hashable (Rules n α Φ l) where
34+
instance (n: Nat) (Φ: Type) (l: Nat) [Hashable Φ] : Hashable (Rules n Φ l) where
3535
hash := hashRules
3636

37-
structure Grammar (n: Nat) (α: Type) (Φ: (α: Type) -> Type) where
38-
start: Rule n α Φ
39-
prods: Vector (Rule n α Φ) n
37+
structure Grammar (n: Nat) (Φ: Type) where
38+
start: Rule n Φ
39+
prods: Vector (Rule n Φ) n
4040

41-
def Grammar.lookup {n: Nat} {α: Type} {Φ: (α: Type) -> Type}
42-
(g: Grammar n α Φ) (ref: Fin n): Rule n α Φ :=
41+
def Grammar.lookup {n: Nat} {Φ: Type}
42+
(g: Grammar n Φ) (ref: Fin n): Rule n Φ :=
4343
Vector.get g.prods ref
4444

45-
def Grammar.singleton (x: Rule 0 α Φ): Grammar 0 α Φ :=
45+
def Grammar.singleton (x: Rule 0 Φ): Grammar 0 Φ :=
4646
Grammar.mk x #v[]
4747

48-
def Grammar.emptyset: Grammar 0 α Φ :=
48+
def Grammar.emptyset: Grammar 0 Φ :=
4949
Grammar.mk Regex.emptyset #v[]
5050

51-
def Grammar.emptystr: Grammar 0 α Φ :=
51+
def Grammar.emptystr: Grammar 0 Φ :=
5252
Grammar.mk Regex.emptystr #v[]
5353

54-
example : Grammar 5 String Pred := Grammar.mk
54+
example : Grammar 5 (Pred String) := Grammar.mk
5555
-- start := ("html", Html)
5656
(start := Regex.symbol (Pred.eq "html", 0))
5757
-- production rules
@@ -72,7 +72,7 @@ example : Grammar 5 String Pred := Grammar.mk
7272
, Regex.emptystr
7373
])
7474

75-
def example_grammar: Grammar 1 Char Pred :=
75+
def example_grammar: Grammar 1 (Pred Char) :=
7676
Grammar.mk
7777
(Regex.or Regex.emptystr (Regex.symbol (Pred.eq 'a', 0)))
7878
#v[Regex.emptystr]
@@ -91,7 +91,7 @@ theorem Rule.denote_decreasing {x: Hedge.Node α} {xs: Hedge α} (h: List.IsInfi
9191
simp +arith only at h
9292
omega
9393

94-
def Rule.denote {α: Type} [BEq α] (g: Grammar n α Pred) (r: Rule n α Pred) (xs: Hedge α): Prop :=
94+
def Rule.denote {α: Type} [BEq α] (g: Grammar n (Pred α)) (r: Rule n (Pred α)) (xs: Hedge α): Prop :=
9595
Regex.denote_infix r xs (fun (pred, ref) xs' =>
9696
match xs' with
9797
| Subtype.mk [x] _hx =>
@@ -102,10 +102,10 @@ def Rule.denote {α: Type} [BEq α] (g: Grammar n α Pred) (r: Rule n α Pred) (
102102
termination_by xs
103103
decreasing_by exact (Rule.denote_decreasing _hx)
104104

105-
def Grammar.denote {α: Type} [BEq α] (g: Grammar n α Pred) (xs: Hedge α): Prop :=
105+
def Grammar.denote {α: Type} [BEq α] (g: Grammar n (Pred α)) (xs: Hedge α): Prop :=
106106
Rule.denote g g.start xs
107107

108-
theorem simp_denote_rule' {α: Type} [BEq α] (g: Grammar n α Pred) (r: Rule n α Pred) (xs: Hedge α):
108+
theorem simp_denote_rule' {α: Type} [BEq α] (g: Grammar n (Pred α)) (r: Rule n (Pred α)) (xs: Hedge α):
109109
(Regex.denote_infix r xs (fun (pred, ref) xs' =>
110110
match xs' with
111111
| Subtype.mk [x] _hx =>
@@ -133,7 +133,7 @@ theorem simp_denote_rule' {α: Type} [BEq α] (g: Grammar n α Pred) (r: Rule n
133133
| nil =>
134134
simp
135135

136-
theorem simp_denote_rule {α: Type} [BEq α] (g: Grammar n α Pred) (r: Rule n α Pred) (xs: Hedge α):
136+
theorem simp_denote_rule {α: Type} [BEq α] (g: Grammar n (Pred α)) (r: Rule n (Pred α)) (xs: Hedge α):
137137
Rule.denote g r xs =
138138
Regex.denote_infix r xs (fun (pred, ref) xs' =>
139139
∃ label children, xs'.val = [Hedge.Node.mk label children] /\ Pred.eval pred label /\ Rule.denote g (g.lookup ref) children
@@ -156,22 +156,22 @@ theorem simp_denote_rule {α: Type} [BEq α] (g: Grammar n α Pred) (r: Rule n
156156
obtain ⟨label, children, hxs, h⟩ := h
157157
exists Hedge.Node.mk label children
158158

159-
theorem Rule.denote_emptyset {α: Type} [BEq α] {g: Grammar n α Pred}:
159+
theorem Rule.denote_emptyset {α: Type} [BEq α] {g: Grammar n (Pred α)}:
160160
Rule.denote g Regex.emptyset = Language.emptyset := by
161161
unfold Language.emptyset
162162
funext xs
163163
unfold Rule.denote
164164
simp [Regex.denote_infix_emptyset]
165165

166-
theorem Rule.denote_emptystr {α: Type} [BEq α] {g: Grammar n α Pred}:
166+
theorem Rule.denote_emptystr {α: Type} [BEq α] {g: Grammar n (Pred α)}:
167167
Rule.denote g Regex.emptystr = Language.emptystr := by
168168
unfold Language.emptystr
169169
funext xs
170170
unfold Rule.denote
171171
simp [Regex.denote_infix_emptystr]
172172

173173
theorem denote_rule_symbol' {n: Nat} {α: Type} [BEq α]
174-
{g: Grammar n α Pred} {pred: Pred α} {ref: Ref n} {xs: Hedge α}:
174+
{g: Grammar n (Pred α)} {pred: Pred α} {ref: Ref n} {xs: Hedge α}:
175175
Rule.denote g (Regex.symbol (pred, ref)) xs
176176
<-> Language.tree (Pred.eval pred) (Rule.denote g (g.lookup ref)) xs := by
177177
cases xs with
@@ -218,14 +218,14 @@ theorem denote_rule_symbol' {n: Nat} {α: Type} [BEq α]
218218
apply And.intro hp hg
219219

220220
theorem Rule.denote_symbol {n: Nat} {α: Type} [BEq α]
221-
{g: Grammar n α Pred} {pred: Pred α} {ref: Ref n}:
221+
{g: Grammar n (Pred α)} {pred: Pred α} {ref: Ref n}:
222222
Rule.denote g (Regex.symbol (pred, ref))
223223
= Language.tree (Pred.eval pred) (Rule.denote g (g.lookup ref)) := by
224224
funext xs
225225
rw [denote_rule_symbol']
226226

227227
theorem Rule.denote_or {n: Nat} {α: Type} [BEq α]
228-
{g: Grammar n α Pred} {p q: Rule n α Pred}:
228+
{g: Grammar n (Pred α)} {p q: Rule n (Pred α)}:
229229
Rule.denote g (Regex.or p q)
230230
= Language.or (Rule.denote g p) (Rule.denote g q) := by
231231
funext xs
@@ -234,7 +234,7 @@ theorem Rule.denote_or {n: Nat} {α: Type} [BEq α]
234234
simp [Regex.denote_infix_or]
235235

236236
theorem Rule.denote_concat_n {n: Nat} {α: Type} [BEq α]
237-
{g: Grammar n α Pred} {p q: Rule n α Pred}:
237+
{g: Grammar n (Pred α)} {p q: Rule n (Pred α)}:
238238
Rule.denote g (Regex.concat p q)
239239
= Language.concat_n (Rule.denote g p) (Rule.denote g q) := by
240240
funext xs
@@ -279,15 +279,15 @@ theorem Rule.denote_concat_n {n: Nat} {α: Type} [BEq α]
279279
simp
280280

281281
theorem Rule.denote_concat {n: Nat} {α: Type} [BEq α]
282-
{g: Grammar n α Pred} {p q: Rule n α Pred}:
282+
{g: Grammar n (Pred α)} {p q: Rule n (Pred α)}:
283283
Rule.denote g (Regex.concat p q)
284284
= Language.concat (Rule.denote g p) (Rule.denote g q) := by
285285
rw [Rule.denote_concat_n]
286286
funext xs
287287
rw [Language.concat_is_concat_n]
288288

289289
theorem denote_rule_star_n' {n: Nat} {α: Type} [BEq α]
290-
{g: Grammar n α Pred} {r: Rule n α Pred} (xs: Hedge α):
290+
{g: Grammar n (Pred α)} {r: Rule n (Pred α)} (xs: Hedge α):
291291
Rule.denote g (Regex.star r) xs
292292
<->
293293
Language.star_n (Rule.denote g r) xs := by
@@ -349,23 +349,23 @@ theorem denote_rule_star_n' {n: Nat} {α: Type} [BEq α]
349349
apply List.list_length_drop_lt_cons
350350

351351
theorem Rule.denote_star_n {n: Nat} {α: Type} [BEq α]
352-
{g: Grammar n α Pred} {r: Rule n α Pred}:
352+
{g: Grammar n (Pred α)} {r: Rule n (Pred α)}:
353353
Rule.denote g (Regex.star r)
354354
=
355355
Language.star_n (Rule.denote g r) := by
356356
funext xs
357357
rw [denote_rule_star_n']
358358

359359
theorem Rule.denote_star {n: Nat} {α: Type} [BEq α]
360-
{g: Grammar n α Pred} {r: Rule n α Pred}:
360+
{g: Grammar n (Pred α)} {r: Rule n (Pred α)}:
361361
Rule.denote g (Regex.star r)
362362
=
363363
Language.star (Rule.denote g r) := by
364364
funext xs
365365
rw [denote_rule_star_n']
366366
rw [Language.star_is_star_n]
367367

368-
def Rule.denote_onlyif {α: Type} [BEq α] (condition: Prop) [dcond: Decidable condition] (g: Grammar n α Pred) (x: Rule n α Pred):
368+
def Rule.denote_onlyif {α: Type} [BEq α] (condition: Prop) [dcond: Decidable condition] (g: Grammar n (Pred α)) (x: Rule n (Pred α)):
369369
denote g (Regex.onlyif condition x) = Language.onlyif condition (denote g x) := by
370370
unfold Language.onlyif
371371
unfold Regex.onlyif
@@ -382,13 +382,13 @@ def Rule.denote_onlyif {α: Type} [BEq α] (condition: Prop) [dcond: Decidable c
382382
intro hc'
383383
contradiction
384384

385-
def Rule.nullable (r: Rule n α Φ): Bool :=
385+
def Rule.nullable (r: Rule n Φ): Bool :=
386386
Regex.nullable r
387387

388-
def Grammar.nullable (g: Grammar n α Φ): Bool :=
388+
def Grammar.nullable (g: Grammar n Φ): Bool :=
389389
Rule.nullable g.start
390390

391-
theorem Rule.null_commutes {α: Type} [BEq α] (g: Grammar n α Pred) (x: Rule n α Pred):
391+
theorem Rule.null_commutes {α: Type} [BEq α] (g: Grammar n (Pred α)) (x: Rule n (Pred α)):
392392
((Rule.nullable x) = true) = Language.null (denote g x) := by
393393
induction x with
394394
| emptyset =>

Validator/Expr/IfExpr.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ abbrev IfExprs n α l := List.Vector (IfExpr n α) l
1212

1313
namespace IfExpr
1414

15-
def eval {α: Type} [DecidableEq α] (g: Grammar n α Pred) (ifExpr: IfExpr n α) (t: α): Rule n α Pred :=
15+
def eval {α: Type} [DecidableEq α] (g: Grammar n (Pred α)) (ifExpr: IfExpr n α) (t: α): Rule n (Pred α) :=
1616
match ifExpr with
1717
| IfExpr.mk cnd thn =>
1818
if Pred.eval cnd t
1919
then g.lookup thn
2020
else Regex.emptyset
2121

22-
def evals {α: Type} {n: Nat} [DecidableEq α] (g: Grammar n α Pred) (ifExprs: IfExprs n α l) (t: α): Rules n α Pred l :=
22+
def evals {α: Type} {n: Nat} [DecidableEq α] (g: Grammar n (Pred α)) (ifExprs: IfExprs n α l) (t: α): Rules n (Pred α) l :=
2323
List.Vector.map (fun x => eval g x t) ifExprs
2424

25-
theorem evals_nil_is_nil {α: Type} {n: Nat} [DecidableEq α] (g: Grammar n α Pred) (a: α):
25+
theorem evals_nil_is_nil {α: Type} {n: Nat} [DecidableEq α] (g: Grammar n (Pred α)) (a: α):
2626
evals g (n := n) List.Vector.nil a = List.Vector.nil := by
2727
unfold evals
2828
simp

Validator/Learning/Basic.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Validator.Derive.Leave
1616

1717
namespace Basic
1818

19-
def derive {α: Type} [DecidableEq α] (g: Grammar μ α Pred) (xs: Rules μ α Pred ν) (t: Hedge.Node α): Rules μ α Pred ν :=
19+
def derive {α: Type} [DecidableEq α] (g: Grammar μ (Pred α)) (xs: Rules μ (Pred α) ν) (t: Hedge.Node α): Rules μ (Pred α) ν :=
2020
if List.all xs.toList Regex.unescapable
2121
then xs
2222
else
@@ -25,21 +25,21 @@ def derive {α: Type} [DecidableEq α] (g: Grammar μ α Pred) (xs: Rules μ α
2525
-- enters is one of our two new memoizable functions.
2626
let ifExprs: IfExprs μ α (Symbol.nums xs) := Enter.deriveEnter xs
2727
-- childxs = expressions to evaluate on children.
28-
let childxs: Rules μ α Pred (Symbol.nums xs) := IfExpr.evals g ifExprs label
28+
let childxs: Rules μ (Pred α) (Symbol.nums xs) := IfExpr.evals g ifExprs label
2929
-- dchildxs = derivatives of children.
3030
let dchildxs := List.foldl (derive g) childxs children
3131
-- leaves is the other one of our two new memoizable functions.
3232
Leave.deriveLeaves xs (List.Vector.map Rule.nullable dchildxs)
3333

34-
def derivs {α: Type} [DecidableEq α] (g: Grammar μ α Pred) (x: Rule μ α Pred) (hedge: Hedge α): Rule μ α Pred :=
34+
def derivs {α: Type} [DecidableEq α] (g: Grammar μ (Pred α)) (x: Rule μ (Pred α)) (hedge: Hedge α): Rule μ (Pred α) :=
3535
let dxs := List.foldl (derive g) (List.Vector.cons x List.Vector.nil) hedge
3636
dxs.head
3737

38-
def validate {α: Type} [DecidableEq α] (g: Grammar μ α Pred) (x: Rule μ α Pred) (hedge: Hedge α): Bool :=
38+
def validate {α: Type} [DecidableEq α] (g: Grammar μ (Pred α)) (x: Rule μ (Pred α)) (hedge: Hedge α): Bool :=
3939
let dx := derivs g x hedge
4040
Rule.nullable dx
4141

42-
def run {α: Type} [DecidableEq α] (g: Grammar μ α Pred) (t: Hedge.Node α): Bool :=
42+
def run {α: Type} [DecidableEq α] (g: Grammar μ (Pred α)) (t: Hedge.Node α): Bool :=
4343
validate g g.start [t]
4444

4545
-- Tests

0 commit comments

Comments
 (0)