@@ -71,18 +71,18 @@ def Cache (α : Type) [DecidableEq α] [Hashable α] (decls : Array (Decl α)) :
71
71
/--
72
72
Create an empty `Cache`, valid with respect to any `Array Decl`.
73
73
-/
74
- @[irreducible]
74
+ @[irreducible, inline ]
75
75
def Cache.empty (decls : Array (Decl α)) : Cache α decls := ⟨{}, WF.empty⟩
76
76
77
- @[inherit_doc Cache.WF.push_id, irreducible]
77
+ @[inherit_doc Cache.WF.push_id, irreducible, inline ]
78
78
def Cache.noUpdate (cache : Cache α decls) : Cache α (decls.push decl) :=
79
79
⟨cache.val, Cache.WF.push_id cache.property⟩
80
80
81
81
/-
82
82
We require the `decls` as an explicit argument because we use `decls.size` so accidentally mutating
83
83
`decls` before calling `Cache.insert` will destroy `decl` linearity.
84
84
-/
85
- @[inherit_doc Cache.WF.push_cache, irreducible]
85
+ @[inherit_doc Cache.WF.push_cache, irreducible, inline ]
86
86
def Cache.insert (decls : Array (Decl α)) (cache : Cache α decls) (decl : Decl α) :
87
87
Cache α (decls.push decl) :=
88
88
⟨cache.val.insert decl decls.size, Cache.WF.push_cache cache.property⟩
@@ -167,13 +167,8 @@ theorem Cache.get?_property {decls : Array (Decl α)} {idx : Nat} (c : Cache α
167
167
/--
168
168
Lookup a `Decl` in a `Cache`.
169
169
-/
170
- opaque Cache.get? (cache : Cache α decls) (decl : Decl α) : Option (CacheHit decls decl) :=
171
- /-
172
- This function is marked as `opaque` to make sure it never, ever gets unfolded anywhere.
173
- Unfolding it will often cause `HashMap.find?` to be symbolically evaluated by reducing
174
- it either in `whnf` or in the kernel. This causes *huge* performance issues in practice.
175
- The function can still be fully verified as all the proofs we need are in `CacheHit`.
176
- -/
170
+ @[irreducible, inline]
171
+ def Cache.get? (cache : Cache α decls) (decl : Decl α) : Option (CacheHit decls decl) :=
177
172
match hfound : cache.val[decl]? with
178
173
| some hit =>
179
174
some ⟨hit, Cache.get?_bounds _ _ hfound, Cache.get?_property _ _ hfound⟩
0 commit comments