lean4-htt/tests/lean/run/3146.lean
Arthur Adjedj 7150a0d538
fix: reduce let-bodies correctly in StructInst (#3152)
Closes #3146

Reduction doesn't trigger correctly on the bodies of `let`-expressions
in `StructInst`, leading some meta-variables to linger in the terms of
some fields. Because of this, default fields may try multiple times (and
fail) to be generated, leading to an unexpected error.

The solution implemented here is to modify the values of the introduced
variables in the local context so as to reduce them correctly.
2024-10-24 23:33:33 +00:00

13 lines
411 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.

/-
Verifies that `let`-bodies are reduced accordingly when trying to construct default fields.
Fixes `#3146`
-/
def Product (m₁ : Type → Type) (m₂ : Type → Type) (α : Type) := m₁ α × m₂ α
instance [Monad m₁] [Monad m₂] : Monad (Product m₁ m₂) where
pure x := (pure x, pure x)
bind o f :=
let y₁ := do f (← o.1) |>.1
let y₂ := do f (← o.2) |>.2
(y₁, y₂)