2013-09-08 05:33:18 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
2013-09-13 03:04:10 +00:00
|
|
|
#include "kernel/expr.h"
|
|
|
|
#include "kernel/context.h"
|
2013-09-08 05:33:18 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
class environment;
|
|
|
|
/**
|
|
|
|
\brief Functional object for "quickly" inferring the type of expressions.
|
|
|
|
It does not check whether the input expression is type correct or not.
|
|
|
|
The contract is: IF the input expression is type correct, then the inferred
|
|
|
|
type is correct.
|
|
|
|
|
|
|
|
\remark The exceptions produced by this class are not informative.
|
|
|
|
That is, they are not meant for external users, but to sign that the
|
|
|
|
type could not be inferred.
|
|
|
|
*/
|
|
|
|
class light_checker {
|
|
|
|
class imp;
|
|
|
|
std::unique_ptr<imp> m_ptr;
|
|
|
|
public:
|
|
|
|
light_checker(environment const & env);
|
|
|
|
~light_checker();
|
|
|
|
|
|
|
|
expr operator()(expr const & e, context const & ctx = context());
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
void set_interrupt(bool flag);
|
|
|
|
void interrupt() { set_interrupt(true); }
|
|
|
|
void reset_interrupt() { set_interrupt(false); }
|
|
|
|
};
|
|
|
|
}
|