environment environment::replace(certified_declaration const & t) const { if (!m_id.is_descendant(t.get_id())) throw_incompatible_environment(*this); name const & n = t.get_declaration().get_name(); auto ax = find(n); if (!ax) throw_kernel_exception(*this, "invalid replacement of axiom with theorem, the environment does not have an axiom with the given name"); if (!ax->is_axiom()) throw_kernel_exception(*this, "invalid replacement of axiom with theorem, the current declaration in the environment is not an axiom"); if (!t.get_declaration().is_theorem()) throw_kernel_exception(*this, "invalid replacement of axiom with theorem, the new declaration is not a theorem"); if (ax->get_type() != t.get_declaration().get_type()) throw_kernel_exception(*this, "invalid replacement of axiom with theorem, the 'replace' operation can only be used when the axiom and theorem have the same type"); if (ax->get_univ_params() != t.get_declaration().get_univ_params()) throw_kernel_exception(*this, "invalid replacement of axiom with theorem, the 'replace' operation can only be used when the axiom and theorem have the same universe parameters"); return environment(m_header, m_id, insert(m_declarations, n, t.get_declaration()), m_global_levels, m_extensions); }
unsigned declaration::get_num_univ_params() const { return length(get_univ_params()); }