chore(*): create alias for std::pair
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
fcf1778ee0
commit
4cf3d32e0c
53 changed files with 100 additions and 109 deletions
|
@ -23,7 +23,7 @@ Author: Leonardo de Moura
|
|||
|
||||
namespace lean {
|
||||
struct calc_ext : public environment_extension {
|
||||
typedef rb_map<name, std::pair<name, unsigned>, name_quick_cmp> refl_table;
|
||||
typedef rb_map<name, pair<name, unsigned>, name_quick_cmp> refl_table;
|
||||
typedef rb_map<name_pair, std::tuple<name, name, unsigned>, name_pair_quick_cmp> trans_table;
|
||||
optional<name> m_subst;
|
||||
unsigned m_subst_num_args;
|
||||
|
@ -175,7 +175,7 @@ void register_calc_cmds(cmd_table & r) {
|
|||
}
|
||||
|
||||
typedef std::tuple<name, expr, expr> calc_pred;
|
||||
typedef std::pair<calc_pred, expr> calc_step;
|
||||
typedef pair<calc_pred, expr> calc_step;
|
||||
inline name const & pred_op(calc_pred const & p) { return std::get<0>(p); }
|
||||
inline expr const & pred_lhs(calc_pred const & p) { return std::get<1>(p); }
|
||||
inline expr const & pred_rhs(calc_pred const & p) { return std::get<2>(p); }
|
||||
|
|
|
@ -711,7 +711,7 @@ public:
|
|||
The result is a pair <tt>new_f, f_type</tt>, where new_f is the new value for \c f,
|
||||
and \c f_type is its type (and a Pi-expression)
|
||||
*/
|
||||
std::pair<expr, expr> ensure_fun(expr f) {
|
||||
pair<expr, expr> ensure_fun(expr f) {
|
||||
expr f_type = infer_type(f);
|
||||
if (!is_pi(f_type))
|
||||
f_type = whnf(f_type);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace lean {
|
|||
*/
|
||||
template<typename V>
|
||||
class local_decls {
|
||||
typedef rb_map<name, std::pair<V, unsigned>, name_quick_cmp> map;
|
||||
typedef rb_map<name, pair<V, unsigned>, name_quick_cmp> map;
|
||||
typedef list<std::tuple<map, unsigned, list<V>>> scopes;
|
||||
map m_map;
|
||||
unsigned m_counter;
|
||||
|
|
|
@ -81,7 +81,7 @@ using notation::mk_ext_lua_action;
|
|||
using notation::transition;
|
||||
using notation::action;
|
||||
|
||||
static std::pair<notation_entry, optional<token_entry>> parse_mixfix_notation(parser & p, mixfix_kind k, bool overload) {
|
||||
static pair<notation_entry, optional<token_entry>> parse_mixfix_notation(parser & p, mixfix_kind k, bool overload) {
|
||||
std::string tk = parse_symbol(p, "invalid notation declaration, quoted symbol or identifier expected");
|
||||
optional<unsigned> prec;
|
||||
if (p.curr_is_token(g_colon)) {
|
||||
|
|
|
@ -264,9 +264,9 @@ transition replace(transition const & t, std::function<expr(expr const &)> const
|
|||
}
|
||||
|
||||
struct parse_table::cell {
|
||||
bool m_nud;
|
||||
list<expr> m_accept;
|
||||
rb_map<name, std::pair<action, parse_table>, name_quick_cmp> m_children;
|
||||
bool m_nud;
|
||||
list<expr> m_accept;
|
||||
rb_map<name, pair<action, parse_table>, name_quick_cmp> m_children;
|
||||
MK_LEAN_RC(); // Declare m_rc counter
|
||||
void dealloc() { delete this; }
|
||||
cell(bool nud = true):m_nud(nud), m_rc(1) {}
|
||||
|
@ -280,12 +280,12 @@ parse_table::parse_table(parse_table && s):m_ptr(s.m_ptr) { s.m_ptr = nullptr; }
|
|||
parse_table::~parse_table() { if (m_ptr) m_ptr->dec_ref(); }
|
||||
parse_table & parse_table::operator=(parse_table const & s) { LEAN_COPY_REF(s); }
|
||||
parse_table & parse_table::operator=(parse_table && s) { LEAN_MOVE_REF(s); }
|
||||
optional<std::pair<action, parse_table>> parse_table::find(name const & tk) const {
|
||||
optional<pair<action, parse_table>> parse_table::find(name const & tk) const {
|
||||
auto * it = m_ptr->m_children.find(tk);
|
||||
if (it)
|
||||
return optional<std::pair<action, parse_table>>(*it);
|
||||
return optional<pair<action, parse_table>>(*it);
|
||||
else
|
||||
return optional<std::pair<action, parse_table>>();
|
||||
return optional<pair<action, parse_table>>();
|
||||
}
|
||||
|
||||
list<expr> const & parse_table::is_accepting() const {
|
||||
|
@ -355,7 +355,7 @@ parse_table parse_table::add(unsigned num, transition const * ts, expr const & a
|
|||
void parse_table::for_each(buffer<transition> & ts, std::function<void(unsigned, transition const *, list<expr> const &)> const & fn) const {
|
||||
if (!is_nil(m_ptr->m_accept))
|
||||
fn(ts.size(), ts.data(), m_ptr->m_accept);
|
||||
m_ptr->m_children.for_each([&](name const & k, std::pair<action, parse_table> const & p) {
|
||||
m_ptr->m_children.for_each([&](name const & k, pair<action, parse_table> const & p) {
|
||||
ts.push_back(transition(k, p.first));
|
||||
p.second.for_each(ts, fn);
|
||||
ts.pop_back();
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
return add(ts.size(), ts.begin(), a, true);
|
||||
}
|
||||
parse_table merge(parse_table const & s, bool overload) const;
|
||||
optional<std::pair<action, parse_table>> find(name const & tk) const;
|
||||
optional<pair<action, parse_table>> find(name const & tk) const;
|
||||
list<expr> const & is_accepting() const;
|
||||
void for_each(std::function<void(unsigned, transition const *, list<expr> const &)> const & fn) const;
|
||||
|
||||
|
|
|
@ -705,7 +705,7 @@ expr parser::parse_binder() {
|
|||
represents the type of the identifiers.
|
||||
*/
|
||||
void parser::parse_binder_block(buffer<expr> & r, binder_info const & bi) {
|
||||
buffer<std::pair<pos_info, name>> names;
|
||||
buffer<pair<pos_info, name>> names;
|
||||
while (curr_is_identifier()) {
|
||||
auto p = pos();
|
||||
names.emplace_back(p, check_atomic_id_next("invalid binder, atomic identifier expected"));
|
||||
|
|
|
@ -47,7 +47,7 @@ static unsigned to_rbp(lua_State * L, int idx) {
|
|||
return idx < nargs ? 0 : lua_tointeger(L, idx);
|
||||
}
|
||||
|
||||
typedef std::pair<local_environment, std::vector<expr>> local_scope_cell;
|
||||
typedef pair<local_environment, std::vector<expr>> local_scope_cell;
|
||||
typedef std::shared_ptr<local_scope_cell> local_scope;
|
||||
DECL_UDATA(local_scope);
|
||||
static const struct luaL_Reg local_scope_m[] = {
|
||||
|
|
|
@ -7,6 +7,7 @@ Author: Leonardo de Moura
|
|||
#pragma once
|
||||
#include <utility>
|
||||
#include <limits>
|
||||
#include "util/pair.h"
|
||||
#include "util/name_map.h"
|
||||
#include "util/name_set.h"
|
||||
#include "util/sexpr/options.h"
|
||||
|
@ -17,7 +18,7 @@ Author: Leonardo de Moura
|
|||
namespace lean {
|
||||
class pretty_fn {
|
||||
public:
|
||||
typedef std::pair<format, unsigned> result;
|
||||
typedef pair<format, unsigned> result;
|
||||
private:
|
||||
environment m_env;
|
||||
type_checker m_tc;
|
||||
|
|
|
@ -35,7 +35,7 @@ static name g_tmp_prefix = name::mk_internal_unique_name();
|
|||
|
||||
struct structure_cmd_fn {
|
||||
typedef std::unique_ptr<type_checker> type_checker_ptr;
|
||||
typedef std::vector<std::pair<name, name>> rename_vector;
|
||||
typedef std::vector<pair<name, name>> rename_vector;
|
||||
parser & m_p;
|
||||
environment m_env;
|
||||
name_generator m_ngen;
|
||||
|
|
|
@ -6,6 +6,7 @@ Author: Leonardo de Moura
|
|||
*/
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
#include "util/pair.h"
|
||||
#include "frontends/lean/token_table.h"
|
||||
|
||||
namespace lean {
|
||||
|
@ -64,7 +65,7 @@ static char const * g_cup = "\u2294";
|
|||
|
||||
token_table init_token_table() {
|
||||
token_table t;
|
||||
std::pair<char const *, unsigned> builtin[] =
|
||||
pair<char const *, unsigned> builtin[] =
|
||||
{{"fun", 0}, {"Pi", 0}, {"let", 0}, {"in", 0}, {"have", 0}, {"show", 0}, {"obtain", 0}, {"by", 0}, {"then", 0},
|
||||
{"from", 0}, {"(", g_max_prec}, {")", 0}, {"{", g_max_prec}, {"}", 0}, {"_", g_max_prec},
|
||||
{"[", g_max_prec}, {"]", 0}, {"⦃", g_max_prec}, {"⦄", 0}, {".{", 0}, {"Type", g_max_prec}, {"Type'", g_max_prec},
|
||||
|
@ -80,11 +81,11 @@ token_table init_token_table() {
|
|||
"exit", "set_option", "using", "calc_subst", "calc_refl", "calc_trans", "tactic_hint",
|
||||
"add_proof_qed", "set_proof_qed", "instance", "#erase_cache", nullptr};
|
||||
|
||||
std::pair<char const *, char const *> aliases[] =
|
||||
pair<char const *, char const *> aliases[] =
|
||||
{{g_lambda_unicode, "fun"}, {"forall", "Pi"}, {g_forall_unicode, "Pi"}, {g_pi_unicode, "Pi"},
|
||||
{nullptr, nullptr}};
|
||||
|
||||
std::pair<char const *, char const *> cmd_aliases[] =
|
||||
pair<char const *, char const *> cmd_aliases[] =
|
||||
{{"parameter", "variable"}, {"parameters", "variables"}, {"lemma", "theorem"},
|
||||
{"hypothesis", "axiom"}, {"conjecture", "axiom"}, {"corollary", "theorem"},
|
||||
{nullptr, nullptr}};
|
||||
|
|
|
@ -634,8 +634,8 @@ inline name const & named_expr_name(expr const & e) { return is_constant(e) ? co
|
|||
|
||||
// =======================================
|
||||
// Expression+Offset
|
||||
typedef std::pair<expr, unsigned> expr_offset;
|
||||
typedef std::pair<expr_cell*, unsigned> expr_cell_offset;
|
||||
typedef pair<expr, unsigned> expr_offset;
|
||||
typedef pair<expr_cell*, unsigned> expr_cell_offset;
|
||||
// =======================================
|
||||
|
||||
// =======================================
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef std::unordered_set<expr_cell_offset, expr_cell_offset_hash, expr_cell_of
|
|||
// 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;
|
||||
typedef 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_alloc(), p.second->hash_alloc()); }
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ class for_each_fn {
|
|||
std::function<bool(expr const &, unsigned)> m_f; // NOLINT
|
||||
|
||||
void apply(expr const & e, unsigned offset) {
|
||||
buffer<std::pair<expr const &, unsigned>> todo;
|
||||
buffer<pair<expr const &, unsigned>> todo;
|
||||
todo.emplace_back(e, offset);
|
||||
while (true) {
|
||||
begin_loop:
|
||||
|
|
|
@ -38,7 +38,7 @@ bool is_internal_name(name n) {
|
|||
}
|
||||
|
||||
static name g_x("x");
|
||||
std::pair<expr, expr> binding_body_fresh(expr const & b, bool preserve_type) {
|
||||
pair<expr, expr> binding_body_fresh(expr const & b, bool preserve_type) {
|
||||
lean_assert(is_binding(b));
|
||||
name n = binding_name(b);
|
||||
if (is_internal_name(n))
|
||||
|
|
|
@ -22,10 +22,10 @@ bool is_used_name(expr const & t, name const & n);
|
|||
|
||||
\remark If preserve_type is false, then the local constant will not use binding_domain.
|
||||
*/
|
||||
std::pair<expr, expr> binding_body_fresh(expr const & b, bool preserve_type = false);
|
||||
pair<expr, expr> binding_body_fresh(expr const & b, bool preserve_type = false);
|
||||
|
||||
/** \brief Return the body of the let-expression \c l, where variable #0 is replaced by a local constant with a "fresh" name. */
|
||||
std::pair<expr, expr> let_body_fresh(expr const & l, bool preserve_type = false);
|
||||
pair<expr, expr> let_body_fresh(expr const & l, bool preserve_type = false);
|
||||
|
||||
class formatter {
|
||||
std::function<format(expr const &, options const &)> m_fn;
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
};
|
||||
|
||||
/** \brief Introduction rule */
|
||||
typedef std::pair<name, expr> intro_rule;
|
||||
typedef pair<name, expr> intro_rule;
|
||||
|
||||
inline name const & intro_rule_name(intro_rule const & r) { return r.first; }
|
||||
inline expr const & intro_rule_type(intro_rule const & r) { return r.second; }
|
||||
|
|
|
@ -196,7 +196,7 @@ level mk_succ(level const & l) {
|
|||
}
|
||||
|
||||
/** \brief Convert (succ^k l) into (l, k). If l is not a succ, then return (l, 0) */
|
||||
std::pair<level, unsigned> to_offset(level l) {
|
||||
pair<level, unsigned> to_offset(level l) {
|
||||
unsigned k = 0;
|
||||
while (is_succ(l)) {
|
||||
l = succ_of(l);
|
||||
|
|
|
@ -63,7 +63,7 @@ void substitution::assign(name const & m, level const & l, justification const &
|
|||
m_level_jsts.insert(m, j);
|
||||
}
|
||||
|
||||
std::pair<level, justification> substitution::instantiate_metavars(level const & l, bool use_jst) {
|
||||
pair<level, justification> substitution::instantiate_metavars(level const & l, bool use_jst) {
|
||||
if (!has_meta(l))
|
||||
return mk_pair(l, justification());
|
||||
justification j;
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
justification const & get_justification() const { return m_jst; }
|
||||
};
|
||||
|
||||
std::pair<expr, justification> substitution::instantiate_metavars_core(expr const & e, bool inst_local_types) {
|
||||
pair<expr, justification> substitution::instantiate_metavars_core(expr const & e, bool inst_local_types) {
|
||||
if (!has_metavar(e)) {
|
||||
return mk_pair(e, justification());
|
||||
} else {
|
||||
|
|
|
@ -24,15 +24,15 @@ class substitution {
|
|||
jst_map m_level_jsts;
|
||||
|
||||
friend class instantiate_metavars_fn;
|
||||
std::pair<level, justification> instantiate_metavars(level const & l, bool use_jst);
|
||||
pair<level, justification> instantiate_metavars(level const & l, bool use_jst);
|
||||
expr instantiate_metavars_wo_jst(expr const & e, bool inst_local_types);
|
||||
std::pair<expr, justification> instantiate_metavars_core(expr const & e, bool inst_local_types);
|
||||
pair<expr, justification> instantiate_metavars_core(expr const & e, bool inst_local_types);
|
||||
bool occurs_expr_core(name const & m, expr const & e, name_set & visited) const;
|
||||
|
||||
public:
|
||||
substitution();
|
||||
typedef optional<std::pair<expr, justification>> opt_expr_jst;
|
||||
typedef optional<std::pair<level, justification>> opt_level_jst;
|
||||
typedef optional<pair<expr, justification>> opt_expr_jst;
|
||||
typedef optional<pair<level, justification>> opt_level_jst;
|
||||
|
||||
bool is_expr_assigned(name const & m) const;
|
||||
opt_expr_jst get_expr_assignment(name const & m) const;
|
||||
|
@ -54,14 +54,14 @@ public:
|
|||
void assign(level const & m, level const & t, justification const & j) { assign(meta_id(m), t, j); }
|
||||
void assign(level const & m, level const & t) { assign(m, t, justification ()); }
|
||||
|
||||
std::pair<level, justification> instantiate_metavars(level const & l) { return instantiate_metavars(l, true); }
|
||||
pair<level, justification> instantiate_metavars(level const & l) { return instantiate_metavars(l, true); }
|
||||
|
||||
/** \brief Instantiate metavariables occurring in \c e, by default this method does not visit the types of local constants.
|
||||
For substituting the metavariables occurring in local constants, use instantiate_metavars_all.
|
||||
*/
|
||||
std::pair<expr, justification> instantiate_metavars(expr const & e) { return instantiate_metavars_core(e, false); }
|
||||
pair<expr, justification> instantiate_metavars(expr const & e) { return instantiate_metavars_core(e, false); }
|
||||
/** \brief \c see instantiate_metavars */
|
||||
std::pair<expr, justification> instantiate_metavars_all(expr const & e) { return instantiate_metavars_core(e, true); }
|
||||
pair<expr, justification> instantiate_metavars_all(expr const & e) { return instantiate_metavars_core(e, true); }
|
||||
/** \brief Similar to \c instantiate_metavars, but does not compute a justification for the substitutions. */
|
||||
expr instantiate(expr const & e) { return instantiate_metavars_wo_jst(e, false); }
|
||||
/** \brief Similar to instantiate, but also substitute metavariables occurring in the types of local constansts */
|
||||
|
|
|
@ -10,7 +10,7 @@ Author: Leonardo de Moura
|
|||
#include "kernel/expr.h"
|
||||
|
||||
namespace lean {
|
||||
typedef std::pair<unsigned, unsigned> pos_info; //!< Line and column information
|
||||
typedef pair<unsigned, unsigned> pos_info; //!< Line and column information
|
||||
/**
|
||||
\brief Abstract class for providing expression position information (line number and column).
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,7 @@ Author: Leonardo de Moura
|
|||
#include "kernel/environment.h"
|
||||
|
||||
namespace lean { namespace record {
|
||||
typedef std::pair<name, expr> field;
|
||||
typedef pair<name, expr> field;
|
||||
inline name const & field_name(field const & f) { return f.first; }
|
||||
inline expr const & field_type(field const & f) { return f.second; }
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ optional<expr> type_checker::expand_macro(expr const & m) {
|
|||
\brief Return the body of the given binder, where the free variable #0 is replaced with a fresh local constant.
|
||||
It also returns the fresh local constant.
|
||||
*/
|
||||
std::pair<expr, expr> type_checker::open_binding_body(expr const & e) {
|
||||
pair<expr, expr> type_checker::open_binding_body(expr const & e) {
|
||||
expr local = mk_local(m_gen.next(), binding_name(e), binding_domain(e), binding_info(e));
|
||||
return mk_pair(instantiate(binding_body(e), local), local);
|
||||
}
|
||||
|
|
|
@ -85,12 +85,12 @@ class type_checker {
|
|||
level_param_names const * m_params;
|
||||
buffer<constraint> m_cs; // temporary cache of constraints
|
||||
unsigned m_cs_qhead;
|
||||
buffer<std::pair<unsigned, unsigned>> m_trail;
|
||||
buffer<pair<unsigned, unsigned>> m_trail;
|
||||
|
||||
friend class converter; // allow converter to access the following methods
|
||||
name mk_fresh_name() { return m_gen.next(); }
|
||||
optional<expr> expand_macro(expr const & m);
|
||||
std::pair<expr, expr> open_binding_body(expr const & e);
|
||||
pair<expr, expr> open_binding_body(expr const & e);
|
||||
void add_cnstr(constraint const & c);
|
||||
expr ensure_sort_core(expr e, expr const & s);
|
||||
expr ensure_pi_core(expr e, expr const & s);
|
||||
|
|
|
@ -69,7 +69,7 @@ struct coercion_info {
|
|||
struct coercion_state {
|
||||
rb_map<name, list<coercion_info>, name_quick_cmp> m_coercion_info;
|
||||
// m_from and m_to contain "direct" coercions
|
||||
rb_map<name, list<std::pair<coercion_class, expr>>, name_quick_cmp> m_from; // map user-class -> list of (class, coercion-fun)
|
||||
rb_map<name, list<pair<coercion_class, expr>>, name_quick_cmp> m_from; // map user-class -> list of (class, coercion-fun)
|
||||
rb_map<coercion_class, list<name>, coercion_class_cmp_fn> m_to;
|
||||
rb_tree<name, name_quick_cmp> m_coercions;
|
||||
coercion_info get_info(name const & from, coercion_class const & to) {
|
||||
|
@ -155,7 +155,7 @@ optional<coercion_class> type_to_coercion_class(expr const & t) {
|
|||
}
|
||||
}
|
||||
|
||||
typedef list<std::pair<name, coercion_class>> arrows;
|
||||
typedef list<pair<name, coercion_class>> arrows;
|
||||
static bool contains(arrows const & a, name const & C, coercion_class const & D) {
|
||||
return std::find(a.begin(), a.end(), mk_pair(C, D)) != a.end();
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ coercion_state add_coercion(environment const & env, io_state const & ios, coerc
|
|||
}
|
||||
}
|
||||
|
||||
typedef std::pair<name, name> coercion_entry;
|
||||
typedef pair<name, name> coercion_entry;
|
||||
struct coercion_config {
|
||||
typedef coercion_state state;
|
||||
typedef coercion_entry entry;
|
||||
|
|
|
@ -87,23 +87,6 @@ static void display_error(io_state_stream const & ios, pos_info_provider const *
|
|||
ios << " " << mk_pair(j.pp(fmt, p, ex.get_substitution()), opts) << endl;
|
||||
}
|
||||
|
||||
// struct delta_pos_info_provider : public pos_info_provider {
|
||||
// unsigned m_delta;
|
||||
// std::string m_file_name;
|
||||
// pos_info_provider const & m_provider;
|
||||
// delta_pos_info_provider(unsigned d, char const * fname, pos_info_provider const & p):m_delta(d), m_file_name(fname), m_provider(p) {}
|
||||
// virtual std::pair<unsigned, unsigned> get_pos_info(expr const & e) const {
|
||||
// auto r = m_provider.get_pos_info(e);
|
||||
// return mk_pair(r.first + m_delta, r.second);
|
||||
// }
|
||||
// virtual char const * get_file_name() const { return m_file_name.c_str(); }
|
||||
// virtual std::pair<unsigned, unsigned> get_some_pos() const {
|
||||
// auto r = m_provider.get_some_pos();
|
||||
// return mk_pair(r.first + m_delta, r.second);
|
||||
// }
|
||||
// };
|
||||
|
||||
|
||||
static void display_error(io_state_stream const & ios, pos_info_provider const * p, script_exception const & ex) {
|
||||
if (p) {
|
||||
char const * msg = ex.get_msg();
|
||||
|
|
|
@ -11,7 +11,7 @@ Author: Leonardo de Moura
|
|||
#include "library/expr_lt.h"
|
||||
|
||||
namespace lean {
|
||||
typedef std::pair<expr, expr> expr_pair;
|
||||
typedef 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()); }
|
||||
|
|
|
@ -116,7 +116,7 @@ using inductive::intro_rule;
|
|||
using inductive::intro_rule_name;
|
||||
using inductive::intro_rule_type;
|
||||
|
||||
std::pair<level_param_names, list<inductive_decl>> sanitize_level_params(level_param_names const & ls, list<inductive_decl> const & decls) {
|
||||
pair<level_param_names, list<inductive_decl>> sanitize_level_params(level_param_names const & ls, list<inductive_decl> const & decls) {
|
||||
name_set globals;
|
||||
for (auto const & d : decls) {
|
||||
collect_global_levels(inductive_decl_type(d), globals);
|
||||
|
|
|
@ -18,6 +18,6 @@ declaration sanitize_level_params(declaration const & d);
|
|||
\brief Return new level parameters and inductive decls equivalent to \c decls,
|
||||
but where level parameter names do not conflict with global parameter names also used in \c decls.
|
||||
*/
|
||||
std::pair<level_param_names, list<inductive::inductive_decl>> sanitize_level_params(level_param_names const & ls,
|
||||
list<inductive::inductive_decl> const & decls);
|
||||
pair<level_param_names, list<inductive::inductive_decl>> sanitize_level_params(level_param_names const & ls,
|
||||
list<inductive::inductive_decl> const & decls);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class match_fn : public match_context {
|
|||
name_generator m_ngen;
|
||||
name_map<name> * m_name_subst;
|
||||
match_plugin const * m_plugin;
|
||||
buffer<std::pair<bool, unsigned>> m_stack;
|
||||
buffer<pair<bool, unsigned>> m_stack;
|
||||
buffer<unsigned> m_scopes;
|
||||
|
||||
void push() {
|
||||
|
|
|
@ -33,7 +33,7 @@ corrupted_file_exception::corrupted_file_exception(std::string const & fname):
|
|||
exception(sstream() << "failed to import '" << fname << "', file is corrupted") {
|
||||
}
|
||||
|
||||
typedef std::pair<std::string, std::function<void(serializer &)>> writer;
|
||||
typedef pair<std::string, std::function<void(serializer &)>> writer;
|
||||
|
||||
struct module_ext : public environment_extension {
|
||||
list<module_name> m_direct_imports;
|
||||
|
|
|
@ -40,7 +40,7 @@ static environment preserve_private_data(environment const & env, name const & r
|
|||
return module::add(env, g_prv_key, [=](serializer & s) { s << n << r; });
|
||||
}
|
||||
|
||||
std::pair<environment, name> add_private_name(environment const & env, name const & n, optional<unsigned> const & extra_hash) {
|
||||
pair<environment, name> add_private_name(environment const & env, name const & n, optional<unsigned> const & extra_hash) {
|
||||
private_ext ext = get_extension(env);
|
||||
unsigned h = hash(n.hash(), ext.m_counter);
|
||||
if (extra_hash)
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace lean {
|
|||
|
||||
The mapping between \c n and the "hidden" name is saved in the .olean files.
|
||||
*/
|
||||
std::pair<environment, name> add_private_name(environment const & env, name const & n, optional<unsigned> const & base_hash);
|
||||
pair<environment, name> add_private_name(environment const & env, name const & n, optional<unsigned> const & base_hash);
|
||||
|
||||
/**
|
||||
\brief Return the user name associated with the hidden name \c n.
|
||||
|
|
|
@ -24,7 +24,6 @@ using std::endl;
|
|||
using std::initializer_list;
|
||||
using std::make_pair;
|
||||
using std::ostream;
|
||||
using std::pair;
|
||||
|
||||
namespace lean {
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ static buffer<app_arg_info>::iterator find_arg_info(buffer<app_arg_info> & arg_i
|
|||
});
|
||||
}
|
||||
|
||||
static std::pair<unsigned, bool> find_hypothesis(buffer<app_arg_info> & arg_infos, unsigned vidx, unsigned num) {
|
||||
static pair<unsigned, bool> find_hypothesis(buffer<app_arg_info> & arg_infos, unsigned vidx, unsigned num) {
|
||||
for (auto const & info : arg_infos) {
|
||||
if (vidx == info.get_pos_at_proof()) {
|
||||
return mk_pair(info.get_arg_pos(), false);
|
||||
|
@ -162,7 +162,7 @@ congr_theorem_info check_congr_theorem(ro_environment const & env, expr const &
|
|||
<< " does not match conclusion of the theorem");
|
||||
if (!it->m_proof_proof_pos) {
|
||||
bool ctx_pos;
|
||||
std::pair<unsigned, bool> p;
|
||||
pair<unsigned, bool> p;
|
||||
if (is_var(abst_domain(d))) {
|
||||
ctx_pos = true;
|
||||
p = find_hypothesis(arg_infos, num - var_idx(abst_domain(d)) - 1, num);
|
||||
|
|
|
@ -103,7 +103,7 @@ tactic trace_tactic(char const * msg) {
|
|||
return trace_tactic(std::string(msg));
|
||||
}
|
||||
|
||||
tactic trace_state_tactic(std::string const & fname, std::pair<unsigned, unsigned> const & pos) {
|
||||
tactic trace_state_tactic(std::string const & fname, pair<unsigned, unsigned> const & pos) {
|
||||
return tactic1([=](environment const & env, io_state const & ios, proof_state const & s) -> proof_state {
|
||||
diagnostic(env, ios) << fname << ":" << pos.first << ":" << pos.second << ": proof state\n"
|
||||
<< s << endl;
|
||||
|
|
|
@ -52,7 +52,7 @@ class sstream;
|
|||
tactic trace_tactic(sstream const & msg);
|
||||
tactic trace_tactic(std::string const & msg);
|
||||
/** \brief Return a tactic that just displays the input state in the diagnostic channel. */
|
||||
tactic trace_state_tactic(std::string const & fname, std::pair<unsigned, unsigned> const & pos);
|
||||
tactic trace_state_tactic(std::string const & fname, pair<unsigned, unsigned> const & pos);
|
||||
tactic trace_state_tactic();
|
||||
/** \brief Create a tactic that applies \c t, but suppressing diagnostic messages. */
|
||||
tactic suppress_trace(tactic const & t);
|
||||
|
|
|
@ -241,7 +241,7 @@ cnstr_group get_choice_cnstr_group(constraint const & c) {
|
|||
|
||||
/** \brief Auxiliary functional object for implementing simultaneous higher-order unification */
|
||||
struct unifier_fn {
|
||||
typedef std::pair<constraint, unsigned> cnstr; // constraint + idx
|
||||
typedef pair<constraint, unsigned> cnstr; // constraint + idx
|
||||
struct cnstr_cmp {
|
||||
int operator()(cnstr const & c1, cnstr const & c2) const { return c1.second < c2.second ? -1 : (c1.second == c2.second ? 0 : 1); }
|
||||
};
|
||||
|
@ -653,7 +653,7 @@ struct unifier_fn {
|
|||
return is_eq_cnstr(c) && is_eq_deltas(cnstr_lhs_expr(c), cnstr_rhs_expr(c));
|
||||
}
|
||||
|
||||
std::pair<constraint, bool> instantiate_metavars(constraint const & c) {
|
||||
pair<constraint, bool> instantiate_metavars(constraint const & c) {
|
||||
if (is_eq_cnstr(c)) {
|
||||
auto lhs_jst = m_subst.instantiate_metavars(cnstr_lhs_expr(c));
|
||||
auto rhs_jst = m_subst.instantiate_metavars(cnstr_rhs_expr(c));
|
||||
|
|
|
@ -41,7 +41,7 @@ static void tst1() {
|
|||
format("c"),
|
||||
format("d")});
|
||||
|
||||
std::vector<std::pair<std::string, format> > v =
|
||||
std::vector<pair<std::string, format>> v =
|
||||
{{"f1", f1},
|
||||
{"f2", f2},
|
||||
{"f3", f3},
|
||||
|
@ -57,7 +57,7 @@ static void tst1() {
|
|||
};
|
||||
|
||||
std::for_each(v.begin(), v.end(),
|
||||
[](std::pair<std::string, format> const & p) {
|
||||
[](pair<std::string, format> const & p) {
|
||||
cout << "---- " << p.first << " ----------" << endl
|
||||
<< p.second << endl
|
||||
<< "--------------------" << endl << endl;
|
||||
|
|
|
@ -148,7 +148,7 @@ static void tst11(int sz, int num) {
|
|||
}
|
||||
|
||||
static void tst12() {
|
||||
list<std::pair<int, char const *>> l;
|
||||
list<pair<int, char const *>> l;
|
||||
lean_assert(is_nil(l));
|
||||
l.emplace_front(20, "world");
|
||||
l.emplace_front(10, "hello");
|
||||
|
|
|
@ -9,6 +9,7 @@ Author: Leonardo de Moura
|
|||
#include "util/debug.h"
|
||||
#include "util/rc.h"
|
||||
#include "util/optional.h"
|
||||
#include "util/pair.h"
|
||||
|
||||
namespace lean {
|
||||
/**
|
||||
|
@ -17,7 +18,7 @@ namespace lean {
|
|||
template<typename T>
|
||||
class lazy_list {
|
||||
public:
|
||||
typedef optional<std::pair<T, lazy_list>> maybe_pair; // head and tail pair
|
||||
typedef optional<pair<T, lazy_list>> maybe_pair; // head and tail pair
|
||||
private:
|
||||
class cell_base {
|
||||
MK_LEAN_RC();
|
||||
|
|
|
@ -66,7 +66,7 @@ list<T> reverse(list<T> const & l) {
|
|||
<tt>append(l1, l2) == l</tt>
|
||||
*/
|
||||
template<typename T>
|
||||
std::pair<list<T>, list<T>> split(list<T> const & l) {
|
||||
pair<list<T>, list<T>> split(list<T> const & l) {
|
||||
if (is_nil(l)) {
|
||||
return mk_pair(l, l);
|
||||
} else if (is_nil(cdr(l))) {
|
||||
|
@ -87,7 +87,7 @@ std::pair<list<T>, list<T>> split(list<T> const & l) {
|
|||
<tt>append(l1, reverse(l2)) == l</tt>
|
||||
*/
|
||||
template<typename T>
|
||||
std::pair<list<T>, list<T>> split_reverse_second(list<T> const & l) {
|
||||
pair<list<T>, list<T>> split_reverse_second(list<T> const & l) {
|
||||
if (is_nil(l)) {
|
||||
return mk_pair(l, l);
|
||||
} else if (is_nil(cdr(l))) {
|
||||
|
|
|
@ -10,9 +10,9 @@ Author: Leonardo de Moura
|
|||
|
||||
namespace lean {
|
||||
#define DEFINE_LUA_PAIR_CORE(T1, PushVal1, ToVal1, T2, PushVal2, ToVal2, MK_Name, IS_Name) \
|
||||
typedef std::pair<T1, T2> pair_ ## T1 ## _ ## T2; \
|
||||
typedef pair<T1, T2> pair_ ## T1 ## _ ## T2; \
|
||||
DECL_UDATA(pair_ ## T1 ## _ ## T2) \
|
||||
std::pair<T1, T2> to_pair_ ## T1 ## _ ## T2 ## _ext(lua_State * L, int idx) { \
|
||||
pair<T1, T2> to_pair_ ## T1 ## _ ## T2 ## _ext(lua_State * L, int idx) { \
|
||||
if (is_pair_ ## T1 ## _ ## T2(L, idx)) { \
|
||||
return to_pair_ ## T1 ## _ ## T2(L, idx); \
|
||||
} else if (lua_istable(L, idx)) { \
|
||||
|
@ -22,14 +22,14 @@ std::pair<T1, T2> to_pair_ ## T1 ## _ ## T2 ## _ext(lua_State * L, int idx) { \
|
|||
throw exception(sstream() << "arg #" << idx << " must be a table of size 2"); \
|
||||
lua_rawgeti(L, -1, 1); \
|
||||
lua_rawgeti(L, -2, 2); \
|
||||
std::pair<T1, T2> r(ToVal1(L, -2), ToVal2(L, -1)); \
|
||||
pair<T1, T2> r(ToVal1(L, -2), ToVal2(L, -1)); \
|
||||
lua_pop(L, 3); \
|
||||
return r; \
|
||||
} else { \
|
||||
throw exception(sstream() << "arg #" << idx << " must be a pair or a Lua table"); \
|
||||
} \
|
||||
} \
|
||||
static int pair_ ## T1 ## _ ## T2 ## _mk(lua_State * L) { return push_pair_ ## T1 ## _ ## T2(L, std::pair<T1, T2>(ToVal1(L, 1), ToVal2(L, 2))); } \
|
||||
static int pair_ ## T1 ## _ ## T2 ## _mk(lua_State * L) { return push_pair_ ## T1 ## _ ## T2(L, pair<T1, T2>(ToVal1(L, 1), ToVal2(L, 2))); } \
|
||||
static int pair_ ## T1 ## _ ## T2 ## _first(lua_State * L) { return PushVal1(L, to_pair_ ## T1 ## _ ## T2(L, 1).first); } \
|
||||
static int pair_ ## T1 ## _ ## T2 ## _second(lua_State * L) { return PushVal2(L, to_pair_ ## T1 ## _ ## T2(L, 1).second); } \
|
||||
static const struct luaL_Reg pair_ ## T1 ## _ ## T2 ## _m[] = { \
|
||||
|
@ -53,7 +53,7 @@ static void open_pair_ ## T1 ## _ ## T2 (lua_State * L) { \
|
|||
// A Pair (T, T)
|
||||
#define DEFINE_LUA_HOMO_PAIR(T, PushVal, ToVal) DEFINE_LUA_PAIR_CORE(T, PushVal, ToVal, T, PushVal, ToVal, "pair_" #T, "is_pair_" #T) \
|
||||
static void open_pair_ ## T(lua_State * L) { open_pair_ ## T ## _ ## T(L); } \
|
||||
std::pair<T, T> & to_pair_ ## T(lua_State * L, int idx) { return to_pair_ ## T ## _ ## T(L, idx); } \
|
||||
std::pair<T, T> to_pair_ ## T ## _ext(lua_State * L, int idx) { return to_pair_ ## T ## _ ## T ## _ext(L, idx); } \
|
||||
int push_pair_ ## T(lua_State * L, std::pair<T, T> const & p) { return push_pair_ ## T ## _ ## T(L, p); }
|
||||
pair<T, T> & to_pair_ ## T(lua_State * L, int idx) { return to_pair_ ## T ## _ ## T(L, idx); } \
|
||||
pair<T, T> to_pair_ ## T ## _ext(lua_State * L, int idx) { return to_pair_ ## T ## _ ## T ## _ext(L, idx); } \
|
||||
int push_pair_ ## T(lua_State * L, pair<T, T> const & p) { return push_pair_ ## T ## _ ## T(L, p); }
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ Author: Leonardo de Moura
|
|||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include "util/pair.h"
|
||||
#include "util/lua.h"
|
||||
#include "util/serializer.h"
|
||||
#include "util/optional.h"
|
||||
|
@ -171,7 +172,7 @@ inline bool independent(name const & a, name const & b) {
|
|||
return !is_prefix_of(a, b) && !is_prefix_of(b, a);
|
||||
}
|
||||
|
||||
typedef std::pair<name, name> name_pair;
|
||||
typedef pair<name, name> name_pair;
|
||||
struct name_pair_quick_cmp {
|
||||
int operator()(name_pair const & p1, name_pair const & p2) const {
|
||||
int r = cmp(p1.first, p2.first);
|
||||
|
|
|
@ -8,9 +8,12 @@ Author: Leonardo de Moura
|
|||
#include <utility>
|
||||
|
||||
namespace lean {
|
||||
template<typename T1, typename T2>
|
||||
using pair = typename std::pair<T1, T2>;
|
||||
|
||||
/** \brief Alias for make_pair */
|
||||
template<typename T1, typename T2>
|
||||
inline std::pair<T1, T2> mk_pair(T1 const & v1, T2 const & v2) {
|
||||
inline pair<T1, T2> mk_pair(T1 const & v1, T2 const & v2) {
|
||||
return std::make_pair(v1, v2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ Author: Leonardo de Moura
|
|||
|
||||
namespace lean {
|
||||
|
||||
class power : public std::pair<unsigned, unsigned> {
|
||||
class power : public pair<unsigned, unsigned> {
|
||||
public:
|
||||
typedef unsigned var;
|
||||
power(var v, unsigned d):std::pair<var, unsigned>(v, d) {}
|
||||
power(var v, unsigned d):pair<var, unsigned>(v, d) {}
|
||||
var get_var() const { return first; }
|
||||
void set_var(var x) { first = x; }
|
||||
unsigned degree() const { return second; }
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace lean {
|
|||
template<typename K, typename T, typename CMP>
|
||||
class rb_map : public CMP {
|
||||
public:
|
||||
typedef std::pair<K, T> entry;
|
||||
typedef pair<K, T> entry;
|
||||
private:
|
||||
struct entry_cmp : public CMP {
|
||||
entry_cmp(CMP const & c):CMP(c) {}
|
||||
|
|
|
@ -11,6 +11,7 @@ Author: Leonardo de Moura
|
|||
#include <utility>
|
||||
#include <functional>
|
||||
#include "util/debug.h"
|
||||
#include "util/pair.h"
|
||||
|
||||
#ifndef LEAN_SCOPED_MAP_INITIAL_BUCKET_SIZE
|
||||
#define LEAN_SCOPED_MAP_INITIAL_BUCKET_SIZE 8
|
||||
|
@ -26,9 +27,9 @@ class scoped_map {
|
|||
typedef typename map::size_type size_type;
|
||||
typedef typename map::value_type value_type;
|
||||
enum class action_kind { Insert, Replace, Erase };
|
||||
map m_map;
|
||||
std::vector<std::pair<action_kind, value_type>> m_actions;
|
||||
std::vector<unsigned> m_scopes;
|
||||
map m_map;
|
||||
std::vector<pair<action_kind, value_type>> m_actions;
|
||||
std::vector<unsigned> m_scopes;
|
||||
public:
|
||||
explicit scoped_map(size_type bucket_count = LEAN_SCOPED_MAP_INITIAL_BUCKET_SIZE,
|
||||
const Hash& hash = Hash(),
|
||||
|
|
|
@ -10,6 +10,7 @@ Author: Leonardo de Moura
|
|||
#include <utility>
|
||||
#include <functional>
|
||||
#include "util/debug.h"
|
||||
#include "util/pair.h"
|
||||
|
||||
#ifndef LEAN_SCOPED_SET_INITIAL_BUCKET_SIZE
|
||||
#define LEAN_SCOPED_SET_INITIAL_BUCKET_SIZE 8
|
||||
|
@ -24,9 +25,9 @@ class scoped_set {
|
|||
typedef std::unordered_set<Key, Hash, KeyEqual> set;
|
||||
typedef typename set::size_type size_type;
|
||||
enum class action_kind { Insert, Erase };
|
||||
set m_set;
|
||||
std::vector<std::pair<action_kind, Key>> m_actions;
|
||||
std::vector<unsigned> m_scopes;
|
||||
set m_set;
|
||||
std::vector<pair<action_kind, Key>> m_actions;
|
||||
std::vector<unsigned> m_scopes;
|
||||
public:
|
||||
explicit scoped_set(size_type bucket_count = LEAN_SCOPED_SET_INITIAL_BUCKET_SIZE,
|
||||
const Hash& hash = Hash(),
|
||||
|
|
|
@ -194,7 +194,7 @@ struct space_exceeded {};
|
|||
/**
|
||||
\brief Return true iff the space upto line break fits in the available space.
|
||||
*/
|
||||
bool format::space_upto_line_break_list_exceeded(sexpr const & s, int available, std::vector<std::pair<sexpr, unsigned>> const & todo) {
|
||||
bool format::space_upto_line_break_list_exceeded(sexpr const & s, int available, std::vector<pair<sexpr, unsigned>> const & todo) {
|
||||
try {
|
||||
bool found_newline = false;
|
||||
available -= space_upto_line_break(s, available, found_newline);
|
||||
|
@ -271,7 +271,7 @@ format operator^(format const & f1, format const & f2) {
|
|||
|
||||
std::ostream & format::pretty(std::ostream & out, unsigned w, bool colors, format const & f) {
|
||||
unsigned pos = 0;
|
||||
std::vector<std::pair<sexpr, unsigned>> todo;
|
||||
std::vector<pair<sexpr, unsigned>> todo;
|
||||
todo.push_back(std::make_pair(f.m_value, 0));
|
||||
while (!todo.empty()) {
|
||||
auto pair = todo.back();
|
||||
|
@ -346,7 +346,7 @@ std::ostream & operator<<(std::ostream & out, format const & f) {
|
|||
return pretty(out, LEAN_DEFAULT_PP_WIDTH, LEAN_DEFAULT_PP_COLORS, f);
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & out, std::pair<format const &, options const &> const & p) {
|
||||
std::ostream & operator<<(std::ostream & out, pair<format const &, options const &> const & p) {
|
||||
return pretty(out, p.second, p.first);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ private:
|
|||
}
|
||||
|
||||
// Functions used inside of pretty printing
|
||||
static bool space_upto_line_break_list_exceeded(sexpr const & s, int available, std::vector<std::pair<sexpr, unsigned>> const & todo);
|
||||
static bool space_upto_line_break_list_exceeded(sexpr const & s, int available, std::vector<pair<sexpr, unsigned>> const & todo);
|
||||
static int space_upto_line_break(sexpr const & s, int available, bool & found);
|
||||
|
||||
static bool is_fnil(format const & f) {
|
||||
|
@ -217,7 +217,7 @@ public:
|
|||
friend std::ostream & pretty(std::ostream & out, options const & o, format const & f);
|
||||
|
||||
friend std::ostream & operator<<(std::ostream & out, format const & f);
|
||||
friend std::ostream & operator<<(std::ostream & out, std::pair<format const &, options const &> const & p);
|
||||
friend std::ostream & operator<<(std::ostream & out, pair<format const &, options const &> const & p);
|
||||
|
||||
/** \brief Return true iff f is just a name */
|
||||
friend bool is_name(format const & f) { return format::is_text(f) && ::lean::is_name(cdr(f.m_value)); }
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace lean {
|
|||
template<typename K, typename T, typename CMP>
|
||||
class splay_map : public CMP {
|
||||
public:
|
||||
typedef std::pair<K, T> entry;
|
||||
typedef pair<K, T> entry;
|
||||
private:
|
||||
struct entry_cmp : public CMP {
|
||||
entry_cmp(CMP const & c):CMP(c) {}
|
||||
|
|
|
@ -13,7 +13,7 @@ Author: Leonardo de Moura
|
|||
|
||||
namespace lean {
|
||||
static mutex g_code_mutex;
|
||||
static std::vector<std::pair<bool, std::string>> g_code;
|
||||
static std::vector<pair<bool, std::string>> g_code;
|
||||
static mutex g_state_mutex;
|
||||
static std::vector<script_state> g_states;
|
||||
static std::vector<script_state> g_available_states;
|
||||
|
|
Loading…
Reference in a new issue