2014-05-25 15:29:47 +00:00
|
|
|
local env = environment()
|
|
|
|
local l = param_univ("l")
|
2014-10-02 23:54:56 +00:00
|
|
|
env = add_decl(env, mk_constant_assumption("group", {l}, mk_sort(l+1)))
|
|
|
|
env = add_decl(env, mk_constant_assumption("abelian_group", {l}, mk_sort(l+1)))
|
2014-05-25 15:29:47 +00:00
|
|
|
local group = Const("group", {l})
|
|
|
|
local ab_group = Const("abelian_group", {l})
|
2014-10-02 23:54:56 +00:00
|
|
|
env = add_decl(env, mk_constant_assumption("carrier", {l}, mk_arrow(group, mk_sort(l))))
|
2014-05-25 15:29:47 +00:00
|
|
|
env = add_coercion(env, "carrier")
|
2014-10-02 23:54:56 +00:00
|
|
|
env = add_decl(env, mk_constant_assumption("abg2g", {l}, mk_arrow(ab_group, group)))
|
2014-05-25 15:29:47 +00:00
|
|
|
env = add_coercion(env, "abg2g")
|
|
|
|
for_each_coercion_sort(env, function(C, f) print(tostring(C) .. " >-> sort : " .. tostring(f)) end)
|
2014-09-14 19:01:14 +00:00
|
|
|
print(get_coercions_to_sort(env, Const("abelian_group", {1})):head())
|
|
|
|
assert(env:type_check(get_coercions_to_sort(env, Const("abelian_group", {1})):head()))
|