lean4-htt/tests/lean/run/coe_to_fn.lean
Gabriel Ebner 7b18d5828d feat(frontends/lean/elaborator): trigger coe_to_fun even when expected type has metavariables
We only need to know that the expected type is a Π to perform
to-function coercion.  Related to #1402.

Fixes https://github.com/gebner/hott3/issues/2
2017-09-06 11:20:04 +02:00

26 lines
No EOL
688 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.

universes u v w
structure equiv (α : Type u) (β : Type v) :=
(f : α → β) (g : β → α)
infix ` ≃ `:50 := equiv
variables {α : Type u} {β : Type v} {γ : Type w}
instance: has_coe_to_fun (α ≃ β) := {
F := λ _, α → β,
coe := equiv.f,
}
@[symm] def equiv.inv : α ≃ β → β ≃ α
| ⟨f,g⟩ := ⟨g,f⟩
local postfix `⁻¹` := equiv.inv
-- coe_fn should be applied at function arguments
def equiv.trans (f : α ≃ β) (g : β ≃ γ) : αγ :=
⟨g ∘ f, f⁻¹ ∘ g⁻¹⟩
example (f : α ≃ β) := function.bijective f
example (f : α ≃ β) (a : α) := f a
example (f : (α ≃ β) ≃ (β ≃ α)) (g : α ≃ β) (b : β) := f g b