lean2/src/library/light_checker.h
Leonardo de Moura 2f29ff70d7 Implement higher-order unification
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-18 20:46:00 -07:00

41 lines
1.2 KiB
C++

/*
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>
#include "kernel/expr.h"
#include "kernel/context.h"
namespace lean {
class environment;
class metavar_env;
class unification_problems;
/**
\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(), metavar_env * menv = nullptr, unification_problems * up = nullptr);
void clear();
void set_interrupt(bool flag);
void interrupt() { set_interrupt(true); }
void reset_interrupt() { set_interrupt(false); }
};
}