lean4-htt/tests/lean/run/1051.lean
Leonardo de Moura 3193acecfa fix: flush the CoreM and MetaM caches at modifyEnv
This fix may impact performance. Note that we don't need to flush the
cache if we are "adding" stuff to the environment. We only need to
flush the caches if the change is not monotonic. BTW, most of the
changes are monotonic. I think this is why we did not hit this bug before.

We may also move all these caches to an environment extension. It is
an easy way to make sure we preserve the cache when extending the
environment.

I tried a few benchmarks and did not notice a significant difference.

cc @kha @gebner

fixes #1051
2022-03-17 16:02:30 -07:00

26 lines
936 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

inductive SF : Type u → Type u → Type (u+1) where
| seq {as bs cs: Type u}: SF as bs → SF bs cs → SF as cs
| fan {as bs cs: Type u}: SF as (bs × cs)
inductive SF' (m: Type (u+1) → Type u)[Monad m]: Type u → Type u → Type (u+1) where
| seq {as bs cs: Type u}: SF' m as bs → SF' m bs cs → SF' m as cs
| fan {as bs cs: Type u}: SF' m as (bs × cs)
| rswitcher {as bs cs: Type u}: SF' m as (bs × cs) → SF' m as bs
def SF.step [Monad m] (sa: as): SF as bs → SF' m as bs × bs
| seq sf₁ sf₂ =>
let (sf₁', sb) := sf₁.step sa
let (sf₂', sc) := sf₂.step sb
(sf₁'.seq sf₂', sc)
| fan => sorry
def SF'.step [Monad m] (sa: as): SF' m as bs → SF'.{u} m as bs × bs
| seq sf₁ sf₂ =>
let (sf₁', sb) := sf₁.step sa
let (sf₂', sc) := sf₂.step sb
(sf₁'.seq sf₂', sc)
| fan => sorry
| rswitcher f =>
let x := f.step sa
let (_, (sb, _)) := x
(rswitcher f, sb)