lean4-htt/tests/lean/run/constFun2.lean
2020-11-26 09:48:12 -08:00

19 lines
436 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.

structure ConstantFunction (α β : Type) where
f : α → β
h : ∀ a b, f a = f b
instance : CoeFun (ConstantFunction α β) (fun _ => α → β) where
coe s := s.f
instance : Coe (ConstantFunction α β) (α → β) where
coe s := s.f
def zeroNatNat : ConstantFunction Nat Nat where
f x := 0
h a b := rfl
def tst1 (x : Nat) : Nat :=
zeroNatNat x
def tst2 (xs : List Nat) : List Nat :=
[1, 2].map zeroNatNat