/* Copyright (c) 2014 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #include #include "kernel/metavar.h" namespace lean { bool substitution::is_assigned(name const & m) const { return m_subst.contains(m); } optional> substitution::get_assignment(name const & m) const { auto it = m_subst.find(m); if (it) return optional>(*it); else return optional>(); } optional substitution::get_expr(name const & m) const { auto it = m_subst.find(m); if (it) return some_expr(it->first); else return none_expr(); } void substitution::assign(name const & m, expr const & t, justification const & j) { m_subst.insert(m, mk_pair(t, j)); } void substitution::assign(name const & m, expr const & t) { assign(m, t, justification()); } void substitution::for_each(std::function const & fn) { m_subst.for_each([=](name const & n, std::pair const & a) { fn(n, a.first, a.second); }); } }