2015-09-21 23:17:11 +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 "kernel/expr.h"
|
|
|
|
#include "kernel/declaration.h"
|
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
namespace blast {
|
|
|
|
// API for creating maximally shared terms used by the blast tactic.
|
|
|
|
// The API assumes there is a single blast tactic using theses terms.
|
2015-09-30 19:54:03 +00:00
|
|
|
// The expression hash-consing tables are thread local and implemented
|
|
|
|
// in the kernel
|
2015-09-21 23:17:11 +00:00
|
|
|
|
|
|
|
// Remark: All procedures assume the children levels and expressions are maximally shared.
|
|
|
|
// That is, it assumes they have been created using the APIs provided by this module.
|
|
|
|
|
|
|
|
// Auxiliary object for resetting the the thread local hash-consing tables.
|
2015-09-30 19:54:03 +00:00
|
|
|
// It also uses an assertion to make sure it is not being used in a recursion.
|
2015-09-30 20:31:42 +00:00
|
|
|
class scope_hash_consing : public scoped_expr_caching {
|
2015-09-21 23:17:11 +00:00
|
|
|
public:
|
|
|
|
scope_hash_consing();
|
|
|
|
~scope_hash_consing();
|
|
|
|
};
|
|
|
|
|
2015-10-02 22:48:01 +00:00
|
|
|
level mk_uref(unsigned idx);
|
|
|
|
|
|
|
|
bool is_uref(level const & l);
|
|
|
|
unsigned uref_index(level const & l);
|
2015-09-21 23:17:11 +00:00
|
|
|
|
2015-09-29 19:13:20 +00:00
|
|
|
// mk_href and mk_mref are helper functions for creating hypotheses and meta-variables used in the blast tactic.
|
2015-09-28 20:02:15 +00:00
|
|
|
// Remark: the local constants and metavariables manipulated by the blast tactic do **not** store their types.
|
2015-09-29 19:13:20 +00:00
|
|
|
expr mk_href(unsigned idx);
|
2015-09-21 23:17:11 +00:00
|
|
|
expr mk_mref(unsigned idx);
|
|
|
|
|
2015-09-29 19:13:20 +00:00
|
|
|
bool is_href(expr const & e);
|
|
|
|
unsigned href_index(expr const & e);
|
2015-09-28 20:02:15 +00:00
|
|
|
bool is_mref(expr const & e);
|
|
|
|
unsigned mref_index(expr const & e);
|
2015-09-29 19:13:20 +00:00
|
|
|
/** \brief Return true iff \c e contain href's */
|
|
|
|
bool has_href(expr const & e);
|
2015-09-28 23:40:19 +00:00
|
|
|
/** \brief Return true iff \c e contain mref's */
|
|
|
|
bool has_mref(expr const & e);
|
2015-09-21 23:17:11 +00:00
|
|
|
|
2015-11-06 00:18:49 +00:00
|
|
|
inline bool is_local_non_href(expr const & e) {
|
|
|
|
return is_local(e) && !is_href(e);
|
|
|
|
}
|
2015-09-21 23:17:11 +00:00
|
|
|
|
2015-09-28 20:02:15 +00:00
|
|
|
void initialize_expr();
|
|
|
|
void finalize_expr();
|
2015-09-21 23:17:11 +00:00
|
|
|
}
|
|
|
|
}
|