This PR ensures the type resolution cache properly caches results for
type classe containing output parameters.
It ensures the cache key for a query like
```
HAppend.{0, 0, ?u} (BitVec 8) (BitVec 8) ?m
```
should be independent of the specific metavariable IDs in output
parameter positions. To achieve this, output parameter arguments are
erased from the cache key. Universe levels that only appear in output
parameter types (e.g., ?u corresponding to the result type's universe)
must also be erased to avoid cache misses when the same query is issued
with different universe metavariable IDs.
---------
Co-authored-by: Kim Morrison <kim@tqft.net>
31 lines
1.1 KiB
Text
31 lines
1.1 KiB
Text
/-
|
|
Type class resolution cache.
|
|
Recall that we normalize keys for type class with output parameters only when the input type
|
|
contains metavariables. This is why in the following example we sold
|
|
```
|
|
new: HAppend (List Nat) (List Nat) ?_
|
|
```
|
|
and
|
|
```
|
|
new: HAppend (List Nat) (List Nat) (List Nat)
|
|
```
|
|
-/
|
|
|
|
set_option pp.mvars.anonymous false
|
|
set_option trace.Meta.synthInstance.cache true
|
|
/--
|
|
trace: [Meta.synthInstance.cache] cached: HAppend (List Nat) (List Nat) (List Nat)
|
|
[Meta.synthInstance.cache] cached: HAppend (List Nat) (List Nat) ?_
|
|
---
|
|
trace: [Meta.synthInstance.cache] cached: HAppend (List Nat) (List Nat) (List Nat)
|
|
[Meta.synthInstance.cache] cached: HAppend (List Nat) (List Nat) ?_
|
|
---
|
|
trace: [Meta.synthInstance.cache] cached: HAppend (List Nat) (List Nat) (List Nat)
|
|
[Meta.synthInstance.cache] new: HAppend (List Nat) (List Nat) ?_
|
|
---
|
|
trace: [Meta.synthInstance.cache] new: HAppend (List Nat) (List Nat) (List Nat)
|
|
[Meta.synthInstance.cache] cached: HAppend (List Nat) (List Nat) ?_
|
|
-/
|
|
#guard_msgs (ordering := sorted) in
|
|
def ex (a : List Nat) : List Nat :=
|
|
a ++ a ++ a ++ a ++ a
|