lean4-htt/tests/lean/autoBoundImplicits2.lean
2022-02-08 12:23:24 -08:00

54 lines
1.1 KiB
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.

def f [Add α] (a : α) : α :=
a + a
set_option relaxedAutoImplicit false
def BV (n : Nat) := { a : Array Bool // a.size = n }
def allZero (bv : BV n) : Prop :=
∀ i, i < n → bv.val[i] = false
def foo (b : BV n) (h : allZero b) : BV n :=
b
def optbind (x : Option α) (f : α → Option β) : Option β :=
match x with
| none => none
| some a => f a
instance : Monad Option where
bind := optbind
pure := some
inductive Mem : α → List α → Prop
| head (a : α) (as : List α) : Mem a (a::as)
def g1 {α : Type u} (a : α) : α :=
a
#check g1
set_option autoImplicit false in
def g2 {α : Type u /- Error -/} (a : α) : α :=
a
def g3 {α : Type β /- Error greek letters are not valid auto names for universe -/} (a : α) : α :=
a
def g4 {α : Type v} (a : α) : α :=
a
def g5 {α : Type (v+1)} (a : α) : α :=
a
def g6 {α : Type u} (a : α) :=
let β : Type u := α
let x : β := a
x
inductive M (m : Type v → Type w) where
| f (β : Type v) : M m
variable {m : Type u → Type u}
def h1 (a : m α) := a
#print h1