Exemplo n.º 1
0
void tmp_type_context::update_assignment(level const & u, level const & v) {
    unsigned idx = to_meta_idx(u);
    lean_assert(idx < m_uassignment.size()); // see comments above
    m_uassignment[idx] = v;
    if (!m_scopes.empty())
        m_trail.emplace_back(trail_kind::Level, idx);
}
Exemplo n.º 2
0
optional<expr> tmp_type_context::get_assignment(expr const & m) const {
    unsigned idx = to_meta_idx(m);
    // if the following assetion is violated, we have two options:
    // 1- We should create the meta-variable using mk_mvar
    // 2- We create using mk_idx_metavar, and notify this object using
    //    set_next_mvar_idx
    lean_assert(idx < m_eassignment.size());
    return m_eassignment[idx];
}
Exemplo n.º 3
0
optional<level> tmp_type_context::get_assignment(level const & u) const {
    unsigned idx = to_meta_idx(u);
    // if the following assetion is violated, we have two options:
    // 1- We should create the meta-variable using mk_uvar
    // 2- We create using mk_idx_metauniv, and notify this object using
    //    set_next_uvar_idx
    lean_assert(idx < m_uassignment.size());
    return m_uassignment[idx];
}
Exemplo n.º 4
0
void tmp_type_context::update_assignment(expr const & m, expr const & v) {
    unsigned idx = to_meta_idx(m);
    lean_assert(idx < m_eassignment.size()); // see comments above
    // Remark: type class resolution may update an already assigned meta-variable with a
    // definitionally equal, but the new assignment is "nicer", i.e., it has not been
    // accidentally unfolded by the unifier.
    // We only add the entry to the trail if it was not assigned before.
    bool was_assigned  = static_cast<bool>(m_eassignment[idx]);
    m_eassignment[idx] = v;
    if (!m_scopes.empty() && !was_assigned)
        m_trail.emplace_back(trail_kind::Expr, idx);
}