2015-02-03 23:15:04 +00:00
|
|
|
import data.nat.basic
|
2014-09-03 23:00:38 +00:00
|
|
|
open nat
|
2014-08-05 17:07:56 +00:00
|
|
|
|
|
|
|
definition two1 : nat := 2
|
|
|
|
definition two2 : nat := succ (succ (zero))
|
|
|
|
definition f (x : nat) (y : nat) := y
|
2014-10-02 23:20:52 +00:00
|
|
|
constant g : nat → nat → nat
|
|
|
|
constants a b : nat
|
2014-08-05 17:07:56 +00:00
|
|
|
|
|
|
|
(*
|
2015-05-08 21:36:38 +00:00
|
|
|
local tc = type_checker_with_hints(get_env())
|
2014-08-05 17:07:56 +00:00
|
|
|
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
|
|
|
|
|
2015-02-03 23:15:04 +00:00
|
|
|
local nat = Const("nat")
|
2014-08-05 17:07:56 +00:00
|
|
|
local f = Const("f")
|
|
|
|
local g = Const("g")
|
|
|
|
local a = Const("a")
|
|
|
|
local b = Const("b")
|
2015-06-08 22:52:50 +00:00
|
|
|
local x = mk_idx_metavar(0, nat)
|
2014-08-05 17:07:56 +00:00
|
|
|
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))
|
|
|
|
*)
|