mirror of
https://github.com/Z3Prover/z3
synced 2025-08-04 10:20:23 +00:00
Z3 sources
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3f9edad676
commit
e9eab22e5c
1186 changed files with 381859 additions and 0 deletions
53
lib/expr_offset.h
Normal file
53
lib/expr_offset.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*++
|
||||
Copyright (c) 2006 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
expr_offset.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Expressions + Offsets.
|
||||
In order to avoid creating variants of terms, we use a pair (expression, offset),
|
||||
where offset is just a small integer.
|
||||
Non ground terms with different offsets are always considered
|
||||
disequal. For example, (f x):1 is different from (f x):2, and
|
||||
(f x):1 is unifiable with x:2.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2008-01-28.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _EXPR_OFFSET_H_
|
||||
#define _EXPR_OFFSET_H_
|
||||
|
||||
#include"ast.h"
|
||||
|
||||
class expr_offset {
|
||||
expr * m_expr;
|
||||
unsigned m_offset;
|
||||
public:
|
||||
expr_offset():m_expr(0), m_offset(0) {}
|
||||
expr_offset(expr * e, unsigned o):m_expr(e), m_offset(o) {}
|
||||
|
||||
expr * get_expr() const { return m_expr; }
|
||||
unsigned get_offset() const { return m_offset; }
|
||||
bool operator==(expr_offset const & other) const { return m_expr == other.m_expr && m_offset == other.m_offset; }
|
||||
bool operator!=(expr_offset const & other) const { return !operator==(other); }
|
||||
|
||||
unsigned hash() const {
|
||||
unsigned a = m_expr->get_id();
|
||||
unsigned b = m_offset;
|
||||
unsigned c = 17;
|
||||
mix(a, b, c);
|
||||
return c;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::pair<expr_offset, expr_offset> expr_offset_pair;
|
||||
typedef pair_hash<obj_hash<expr_offset>, obj_hash<expr_offset> > expr_offset_pair_hash;
|
||||
|
||||
#endif /* _EXPR_OFFSET_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue