lean2/tests/lean/map.lean
Leonardo de Moura 110ca84984 feat(library/simplifier): allow the user to associate a simplifier monitor with the lua_State object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-31 13:49:24 -08:00

27 lines
1.1 KiB
Text

import tactic
variable list : Type → Type
variable nil {A : Type} : list A
variable cons {A : Type} : A → list A → list A
variable map {A B : Type} : (A → B) → list A → list B
axiom map_cons {A B : Type} (f : A → B) (a : A) (l : list A) : map f (cons a l) = cons (f a) (map f l)
axiom map_nil {A B : Type} (f : A → B) : (map f nil) = nil
add_rewrite map_cons map_nil
(*
local m = simplifier_monitor(function(s, e)
print("Visit, depth: " .. s:depth() .. ", " .. tostring(e))
end,
function(s, e, new_e, pr)
print("Step: " .. tostring(e) .. " ===> " .. tostring(new_e))
end,
function(s, e, new_e, ceq, ceq_id)
print("Rewrite using: " .. tostring(ceq_id))
print(" " .. tostring(e) .. " ===> " .. tostring(new_e))
end
)
set_simplifier_monitor(m)
*)
theorem T1 : map (λ x, x + 1) (cons 1 (cons 2 nil)) = cons 2 (cons 3 nil)
:= by simp