Before this commit, we were inferring whether an inductive/structure/class were meta or not. This was bad since the user had no clue whether the type was trusted (non meta) or not. Moreover, users could get confused by this behavior and assume the kernel was allowing trusted code to rely on untrusted one.
39 lines
1.7 KiB
C++
39 lines
1.7 KiB
C++
/*
|
|
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Daniel Selsam
|
|
*/
|
|
#include "kernel/inductive/inductive.h"
|
|
#include "kernel/abstract.h"
|
|
#include "util/sexpr/option_declarations.h"
|
|
#include "library/locals.h"
|
|
#include "library/module.h"
|
|
#include "library/attribute_manager.h"
|
|
#include "library/inductive_compiler/compiler.h"
|
|
#include "library/inductive_compiler/basic.h"
|
|
#include "library/inductive_compiler/mutual.h"
|
|
#include "library/inductive_compiler/nested.h"
|
|
#include "library/inductive_compiler/ginductive.h"
|
|
|
|
namespace lean {
|
|
environment add_inner_inductive_declaration(environment const & env, options const & opts,
|
|
name_map<implicit_infer_kind> implicit_infer_map,
|
|
ginductive_decl const & decl, bool is_trusted) {
|
|
lean_assert(decl.get_inds().size() == decl.get_intro_rules().size());
|
|
if (optional<environment> new_env = add_nested_inductive_decl(env, opts, implicit_infer_map, decl, is_trusted)) {
|
|
return register_ginductive_decl(*new_env, decl, ginductive_kind::NESTED);
|
|
} else if (decl.is_mutual()) {
|
|
return register_ginductive_decl(add_mutual_inductive_decl(env, opts, implicit_infer_map, decl, is_trusted),
|
|
decl, ginductive_kind::MUTUAL);
|
|
} else {
|
|
lean_assert(!decl.is_mutual());
|
|
return register_ginductive_decl(add_basic_inductive_decl(env, opts, implicit_infer_map, decl, is_trusted),
|
|
decl, ginductive_kind::BASIC);
|
|
}
|
|
}
|
|
|
|
void initialize_inductive_compiler() {}
|
|
void finalize_inductive_compiler() {}
|
|
|
|
}
|