feat(library/init/lean/ir/ir): use name

This commit is contained in:
Leonardo de Moura 2018-05-01 12:17:00 -07:00
parent 263391bdbb
commit 92fa43e7d8
3 changed files with 10 additions and 5 deletions

View file

@ -573,6 +573,7 @@ attribute [elab_simple] bin_tree.node bin_tree.leaf
/-- Like `by apply_instance`, but not dependent on the tactic framework. -/
@[reducible] def infer_instance {α : Type u} [i : α] : α := i
@[reducible, elab_simple] def infer_instance_as (α : Type u) [i : α] : α := i
/- Boolean operators -/

View file

@ -5,6 +5,7 @@ Authors: Leonardo de Moura
-/
prelude
import init.data.rbmap init.data.int init.control.state init.control.except init.control.combinators
import init.lean.name
/-
Missing
@ -34,15 +35,15 @@ inductive literal
| float : string → literal -- for float/double literals
def tag := uint16
def var := string
def fid := string
def blockid := string
def var := name
def fid := name
def blockid := name
instance var_has_lt : has_lt var :=
show has_lt string, from infer_instance
show has_lt name, from name.has_lt_quick
instance blockid_has_lt : has_lt blockid :=
show has_lt string, from infer_instance
show has_lt name, from name.has_lt_quick
def var_set := rbtree var (<)
def blockid_set := rbtree blockid (<)

View file

@ -80,6 +80,9 @@ instance has_decidable_eq : decidable_eq name
protected def has_lt_quick : has_lt name :=
⟨λ a b, name.quick_lt a b = tt⟩
instance : decidable_rel (@has_lt.lt name name.has_lt_quick) :=
infer_instance_as (decidable_rel (λ a b, name.quick_lt a b = tt))
def to_string_with_sep (sep : string) : name → string
| anonymous := "[anonymous]"
| (mk_string anonymous s) := s