2015-09-23 07:42:36 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "util/rc.h"
|
2015-09-29 01:28:11 +00:00
|
|
|
#include "util/rb_map.h"
|
2015-09-29 01:55:24 +00:00
|
|
|
#include "library/blast/expr.h"
|
2015-09-23 07:42:36 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
namespace blast {
|
|
|
|
class hypothesis;
|
2015-09-25 19:45:16 +00:00
|
|
|
class branch;
|
2015-09-23 07:42:36 +00:00
|
|
|
class state;
|
|
|
|
|
2015-09-28 23:40:19 +00:00
|
|
|
typedef rb_tree<unsigned, unsigned_cmp> hypothesis_idx_set;
|
|
|
|
typedef list<unsigned> hypothesis_idx_list;
|
|
|
|
typedef buffer<unsigned> hypothesis_idx_buffer;
|
2015-09-29 01:28:11 +00:00
|
|
|
template<typename T>
|
|
|
|
using hypothesis_idx_map = typename lean::rb_map<unsigned, T, unsigned_cmp>;
|
2015-09-23 07:42:36 +00:00
|
|
|
|
|
|
|
class hypothesis {
|
2015-09-25 19:45:16 +00:00
|
|
|
friend class branch;
|
2015-09-28 23:40:19 +00:00
|
|
|
name m_name; // for pretty printing
|
|
|
|
unsigned m_active:1;
|
|
|
|
unsigned m_depth;
|
|
|
|
hypothesis_idx_set m_deps; // hypotheses used by the type and/or value of this hypothesis.
|
|
|
|
expr m_type;
|
2015-10-05 04:27:39 +00:00
|
|
|
expr m_value; // justification for this object.
|
|
|
|
// Remark: if blast::is_local(m_value) is true, then the hypothesis is an assumption
|
2015-09-23 07:42:36 +00:00
|
|
|
public:
|
2015-10-06 20:02:06 +00:00
|
|
|
hypothesis():m_active(false), m_depth(0) {}
|
2015-09-29 01:28:11 +00:00
|
|
|
name const & get_name() const { return m_name; }
|
2015-09-23 07:42:36 +00:00
|
|
|
bool is_active() const { return m_active; }
|
|
|
|
unsigned get_depth() const { return m_depth; }
|
2015-09-28 23:40:19 +00:00
|
|
|
hypothesis_idx_set const & get_backward_deps() const { return m_deps; }
|
2015-09-23 07:42:36 +00:00
|
|
|
expr const & get_type() const { return m_type; }
|
2015-10-05 04:27:39 +00:00
|
|
|
expr const & get_value() const { return m_value; }
|
2015-09-29 01:55:24 +00:00
|
|
|
/** \brief Return true iff this hypothesis depends on \c h. */
|
2015-09-29 19:13:20 +00:00
|
|
|
bool depends_on(expr const & h) const { return m_deps.contains(href_index(h)); }
|
2015-10-05 04:27:39 +00:00
|
|
|
bool is_assumption() const { return blast::is_local(m_value); }
|
2015-09-23 07:42:36 +00:00
|
|
|
};
|
2015-09-25 19:45:16 +00:00
|
|
|
}}
|