lean4-htt/old_tests/tests/lean/run/coe_to_fn.lean
2018-04-10 12:56:55 -07: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