lean2/tests/lean/run/match2.lean

35 lines
788 B
Text
Raw Normal View History

import data.nat
open nat
definition two1 : nat := 2
definition two2 : nat := succ (succ (zero))
definition f (x : nat) (y : nat) := y
variable g : nat → nat → nat
variables a b : nat
(*
local tc = type_checker_with_hints(get_env(), true)
local plugin = whnf_match_plugin(tc)
function tst_match(p, t)
local r1, r2 = match(p, t, plugin)
assert(r1)
print("--------------")
for i = 1, #r1 do
print(" expr:#" .. i .. " := " .. tostring(r1[i]))
end
for i = 1, #r2 do
print(" lvl:#" .. i .. " := " .. tostring(r2[i]))
end
end
local f = Const("f")
local g = Const("g")
local a = Const("a")
local b = Const("b")
local x = mk_var(0)
local p = g(x, f(x, a))
local t = g(a, f(b, a))
tst_match(p, t)
tst_match(f(x, x), f(a, b))
*)