2013-07-22 11:03:46 +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 <unordered_set>
|
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-07-22 11:03:46 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
|
|
|
|
// =======================================
|
2013-07-23 17:16:47 +00:00
|
|
|
// Expression Set && Expression Offset Set
|
2013-07-22 11:03:46 +00:00
|
|
|
// Remark: to expressions are assumed to be equal if they are "pointer-equal"
|
|
|
|
typedef std::unordered_set<expr, expr_hash, expr_eqp> expr_set;
|
2013-07-23 17:16:47 +00:00
|
|
|
typedef std::unordered_set<expr_offset, expr_offset_hash, expr_offset_eqp> expr_offset_set;
|
2013-07-22 11:03:46 +00:00
|
|
|
// =======================================
|
|
|
|
|
|
|
|
// =======================================
|
|
|
|
// (low level) Expression Cell Set
|
|
|
|
// Remark: to expressions are assumed to be equal if they are "pointer-equal"
|
|
|
|
//
|
|
|
|
// WARNING: use with care, this kind of set
|
|
|
|
// does not prevent an expression from being
|
|
|
|
// garbage collected.
|
|
|
|
typedef std::unordered_set<expr_cell*, expr_cell_hash, expr_cell_eqp> expr_cell_set;
|
2013-07-23 17:16:47 +00:00
|
|
|
typedef std::unordered_set<expr_cell_offset, expr_cell_offset_hash, expr_cell_offset_eqp> expr_cell_offset_set;
|
2013-07-22 11:03:46 +00:00
|
|
|
// =======================================
|
|
|
|
|
|
|
|
// =======================================
|
|
|
|
// (low level) Expression Cell pair Set
|
|
|
|
// Remark: to expressions are assumed to be equal if they are "pointer-equal"
|
|
|
|
//
|
|
|
|
// WARNING: use with care, this kind of set
|
|
|
|
// does not prevent an expression from being
|
|
|
|
// garbage collected.
|
|
|
|
typedef std::pair<expr_cell *, expr_cell *> expr_cell_pair;
|
|
|
|
struct expr_cell_pair_hash {
|
|
|
|
unsigned operator()(expr_cell_pair const & p) const { return hash(p.first->hash(), p.second->hash()); }
|
|
|
|
};
|
|
|
|
struct expr_cell_pair_eqp {
|
|
|
|
bool operator()(expr_cell_pair const & p1, expr_cell_pair const & p2) const {
|
|
|
|
return p1.first == p2.first && p1.second == p2.second;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
typedef std::unordered_set<expr_cell_pair, expr_cell_pair_hash, expr_cell_pair_eqp> expr_cell_pair_set;
|
|
|
|
// =======================================
|
|
|
|
}
|