2013-09-01 23:59:15 +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
|
2013-09-13 10:35:29 +00:00
|
|
|
#include <utility>
|
2013-09-13 03:04:10 +00:00
|
|
|
#include "util/hash.h"
|
|
|
|
#include "kernel/expr.h"
|
2013-09-01 23:59:15 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
typedef std::pair<expr, expr> expr_pair;
|
|
|
|
/** \brief Functional object for hashing expression pairs. */
|
|
|
|
struct expr_pair_hash {
|
|
|
|
unsigned operator()(expr_pair const & p) const { return hash(p.first.hash(), p.second.hash()); }
|
|
|
|
};
|
2013-11-14 10:31:54 +00:00
|
|
|
/** \brief Functional object for hashing expression pairs (based on their allocation time). */
|
|
|
|
struct expr_pair_hash_alloc {
|
|
|
|
unsigned operator()(expr_pair const & p) const { return hash(p.first.hash_alloc(), p.second.hash_alloc()); }
|
|
|
|
};
|
2013-09-01 23:59:15 +00:00
|
|
|
/** \brief Functional object for comparing expression pairs. */
|
|
|
|
struct expr_pair_eq {
|
|
|
|
unsigned operator()(expr_pair const & p1, expr_pair const & p2) const { return p1.first == p2.first && p1.second == p2.second; }
|
|
|
|
};
|
|
|
|
/** \brief Functional object for comparing expression pairs using pointer equality. */
|
|
|
|
struct expr_pair_eqp {
|
|
|
|
unsigned operator()(expr_pair const & p1, expr_pair const & p2) const { return is_eqp(p1.first, p2.first) && is_eqp(p1.second, p2.second); }
|
|
|
|
};
|
|
|
|
}
|