lean2/src/library/opaque_hints.h
Leonardo de Moura faee08591f fix(*): make sure elaborator and type_checker use the same "rules" for treating opaque definitions
This is a big change because we have to store in constraints whether we can use the "relaxed" rules or not.
The "relaxed" case says that when type checking the value of an opaque definition we can treat other opaque definitions in the same module as transparent.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-27 12:12:54 -07:00

32 lines
1.4 KiB
C++

/*
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#pragma once
#include "kernel/environment.h"
namespace lean {
/*
Opaque hints are used to 'help/guide' the elaborator and unifier.
We can use them to mark additional definitions as opaque.
Note that we are not changing the status of the definitions, we are
only changing how the elaborator/unifier treats them.
These hints are not used when we type check a definition before
adding it to the kernel.
*/
/** \brief Mark the definition named \c n as opaque for the elaborator/unifier. */
environment hide_definition(environment const & env, name const & n);
/** \brief Undo the modification made with \c hide_definition. */
environment expose_definition(environment const & env, name const & n);
/** \brief By default, the elaborator/unifier will treat the opaque definitions of the current/main
module as transparent (when allowed). We can change this behavior using this function.
*/
environment set_hide_main_opaque(environment const & env, bool f);
bool get_hide_main_opaque(environment const & env);
/** \brief Create a type checker that takes the hints into account. */
std::unique_ptr<type_checker> mk_type_checker_with_hints(environment const & env, name_generator const & ngen, bool relax_main_opaque);
}