feat(library/init/id_locked): add auxiliary definition id_locked

This commit is contained in:
Leonardo de Moura 2016-09-04 18:30:26 -07:00
parent 7747c83915
commit 89e852446a
2 changed files with 25 additions and 1 deletions

View file

@ -13,4 +13,4 @@ import init.monad_combinators
import init.timeit init.trace init.unsigned init.ordering init.list_classes init.coe
import init.wf init.nat_div init.meta init.instances
import init.wf_k init.sigma_lex
import init.simplifier
import init.simplifier init.id_locked

View file

@ -0,0 +1,24 @@
/-
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
prelude
import init.meta.tactic init.meta.constructor_tactic
open tactic
/-
Define id_locked using meta-programming because we don't have
syntax for setting reducibility_hints.
See module init.meta.declaration.
-/
run_command do
l ← return $ level.param `l,
Ty ← return $ expr.sort l,
type ← to_expr `(Π {A : %%Ty}, A → A),
val ← to_expr `(λ {A : %%Ty} (a : A), a),
add_decl (declaration.defn `id_locked [`l] type val reducibility_hints.opaque tt)
lemma id_locked_eq {A : Type} (a : A) : id_locked a = a :=
rfl