lean4-htt/tests/lean/2040.lean
Gabriel Ebner d4b9a532d2 fix: calc: synthesize default instances
This is necessary to figure out the types with exponentiations.

Fixes #2079
2023-02-02 14:29:21 -08:00

36 lines
1,022 B
Text

example (n : Nat) (a : Int) : a = 22 :=
calc
a = 2 ^ n := sorry -- error
_ = (22 : Int) := sorry
example (n : Nat) (a : Int) : a = 22 :=
calc
a = (37 : Int) := sorry
_ = 2 ^ n := sorry -- should be same error as above
_ = (22 : Int) := sorry
example (n : Nat) (a : Int) : a = (2 : Int) ^ n :=
calc
a = (37 : Int) := sorry
_ = 2 ^ n := sorry -- should be same error as above
example (n : Nat) (h : n = 42) : 42 = (n : Int) :=
calc
(42 : Int) = 42 := rfl
_ = n := h ▸ rfl
--^ coe needs to be inserted here
example (n : Nat) (h : n = 42) : 42 = (n : Int) :=
calc
(42 : Int) = 42 := rfl -- TODO: type of 42 should match goal (i.e., `Int`)
_ = n := h ▸ rfl
--^ coe needs to be inserted here
example (n : Nat) (h : n = 42) : 42 = (n : Int) :=
calc
(_ : Int) = 42 := rfl -- TODO: type of 42 should match goal (i.e., `Int`)
_ = n := h ▸ rfl
--^ coe needs to be inserted here
example := calc 1 = 1 := rfl
example := by calc 1 = 1 := rfl