2014-04-25 22:26:03 +00:00
|
|
|
/*
|
|
|
|
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 "util/name.h"
|
2014-08-20 05:31:26 +00:00
|
|
|
#include "kernel/constraint.h"
|
2014-04-25 22:26:03 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
class environment;
|
2014-05-15 16:31:11 +00:00
|
|
|
class delayed_justification;
|
2014-04-25 22:26:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
\brief Extension context (aka API provided to macro_definitions and normalizer_extensions).
|
|
|
|
The extension can request
|
|
|
|
1) the environment being used.
|
|
|
|
2) the weak head normal form of an expression.
|
|
|
|
3) the type of an expression.
|
|
|
|
4) a new fresh name.
|
|
|
|
5) registration of a new constraint.
|
|
|
|
*/
|
|
|
|
class extension_context {
|
|
|
|
public:
|
|
|
|
virtual ~extension_context() {}
|
|
|
|
virtual environment const & env() const = 0;
|
2014-08-20 05:31:26 +00:00
|
|
|
virtual pair<expr, constraint_seq> whnf(expr const & e) = 0;
|
|
|
|
virtual pair<bool, constraint_seq> is_def_eq(expr const & e1, expr const & e2, delayed_justification & j) = 0;
|
|
|
|
virtual pair<expr, constraint_seq> infer_type(expr const & e) = 0;
|
2014-04-25 22:26:03 +00:00
|
|
|
virtual name mk_fresh_name() = 0;
|
|
|
|
};
|
|
|
|
}
|