fix(library/inductive_unifier_plugin): avoid potential assertion violation

This commit is contained in:
Leonardo de Moura 2015-06-26 17:15:53 -07:00
parent a680114fd8
commit 31a4ee2ac3

View file

@ -5,6 +5,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura Author: Leonardo de Moura
*/ */
#include "util/lazy_list_fn.h" #include "util/lazy_list_fn.h"
#include "kernel/instantiate.h"
#include "kernel/inductive/inductive.h" #include "kernel/inductive/inductive.h"
#include "library/unifier_plugin.h" #include "library/unifier_plugin.h"
#include "library/unifier.h" #include "library/unifier.h"
@ -73,8 +74,9 @@ class inductive_unifier_plugin_cell : public unifier_plugin_cell {
expr hint = intro_fn; expr hint = intro_fn;
expr intro_type = tc.whnf(inductive::intro_rule_type(intro), cs_intro); expr intro_type = tc.whnf(inductive::intro_rule_type(intro), cs_intro);
while (is_pi(intro_type)) { while (is_pi(intro_type)) {
hint = mk_app(hint, mk_app(mk_aux_metavar_for(ngen, mtype), margs)); expr new_arg = mk_app(mk_aux_metavar_for(ngen, mtype), margs);
intro_type = tc.whnf(binding_body(intro_type), cs_intro); hint = mk_app(hint, new_arg);
intro_type = tc.whnf(instantiate(binding_body(intro_type), new_arg), cs_intro);
} }
constraint c1 = mk_eq_cnstr(meta, hint, j); constraint c1 = mk_eq_cnstr(meta, hint, j);
args[major_idx] = hint; args[major_idx] = hint;