2013-09-19 08:27:41 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Soonho Kong
|
|
|
|
*/
|
|
|
|
#pragma once
|
2013-09-27 08:44:05 +00:00
|
|
|
#include "util/scoped_map.h"
|
2013-09-19 08:27:41 +00:00
|
|
|
#include "kernel/expr.h"
|
|
|
|
#include "kernel/context.h"
|
2014-01-02 21:37:50 +00:00
|
|
|
#include "library/printer.h"
|
2013-09-19 08:27:41 +00:00
|
|
|
|
|
|
|
namespace lean {
|
2013-09-27 08:44:05 +00:00
|
|
|
using subst_map = scoped_map<unsigned, expr>;
|
2013-09-19 08:27:41 +00:00
|
|
|
|
|
|
|
class fo_match {
|
|
|
|
private:
|
2013-09-19 19:21:29 +00:00
|
|
|
bool match_var(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_constant(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_value(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_app(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_lambda(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_pi(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_type(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_let(expr const & p, expr const & t, unsigned o, subst_map & s);
|
|
|
|
bool match_metavar(expr const & p, expr const & t, unsigned o, subst_map & s);
|
2013-09-27 08:44:05 +00:00
|
|
|
bool match_main(expr const & p, expr const & t, unsigned o, subst_map & s);
|
2013-12-08 07:21:07 +00:00
|
|
|
bool match_main(optional<expr> const & p, optional<expr> const & t, unsigned o, subst_map & s);
|
2013-09-19 19:21:29 +00:00
|
|
|
|
2013-09-19 08:27:41 +00:00
|
|
|
public:
|
2013-09-19 19:21:29 +00:00
|
|
|
bool match(expr const & p, expr const & t, unsigned o, subst_map & s);
|
2013-09-19 08:27:41 +00:00
|
|
|
};
|
|
|
|
}
|