In the standard library, we should use explicit universe variables for universe polymorphic definitions. Users that want to declare universe polymorphic definitions but do not want to provide universe level parameters should use Type _ or Type*
42 lines
829 B
Text
42 lines
829 B
Text
open tactic bool
|
||
universe variables u
|
||
constant foo {A : Type u} [inhabited A] (a b : A) : a = default A → a = b
|
||
|
||
example (a b : nat) : a = 0 → a = b :=
|
||
by do
|
||
intro `H,
|
||
apply (expr.const `foo [level.of_nat 1]),
|
||
trace_state,
|
||
assumption
|
||
|
||
definition ex : inhabited (nat × nat × bool) :=
|
||
by apply_instance
|
||
|
||
set_option pp.all true
|
||
print ex
|
||
|
||
set_option pp.all false
|
||
|
||
example (a b : nat) : a = 0 → a = b :=
|
||
by do
|
||
intro `H,
|
||
apply_core semireducible tt ff (expr.const `foo [level.of_nat 1]),
|
||
trace_state,
|
||
a ← get_local `a,
|
||
trace_state,
|
||
mk_app `inhabited.mk [a] >>= exact,
|
||
trace "--------",
|
||
trace_state,
|
||
reflexivity
|
||
|
||
print "----------------"
|
||
set_option pp.all true
|
||
|
||
example (a b : nat) : a = 0 → a = b :=
|
||
by do
|
||
intro `H,
|
||
foo ← mk_const `foo,
|
||
trace foo,
|
||
apply foo,
|
||
trace_state,
|
||
assumption
|