2013-11-21 01:02:41 +00:00
|
|
|
/*
|
2014-06-27 13:59:17 +00:00
|
|
|
Copyright (c) 2013-2014 Microsoft Corporation. All rights reserved.
|
2013-11-21 01:02:41 +00:00
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <utility>
|
2013-11-27 03:15:49 +00:00
|
|
|
#include "util/lua.h"
|
2013-11-21 01:02:41 +00:00
|
|
|
#include "util/list.h"
|
|
|
|
#include "util/name.h"
|
2013-11-22 00:44:31 +00:00
|
|
|
#include "kernel/formatter.h"
|
2013-11-21 01:02:41 +00:00
|
|
|
#include "kernel/environment.h"
|
2014-06-27 13:59:17 +00:00
|
|
|
#include "library/io_state_stream.h"
|
2013-11-21 01:02:41 +00:00
|
|
|
|
|
|
|
namespace lean {
|
2013-11-25 09:06:11 +00:00
|
|
|
typedef std::pair<name, expr> hypothesis;
|
|
|
|
typedef list<hypothesis> hypotheses;
|
2013-11-21 01:02:41 +00:00
|
|
|
class goal {
|
2013-11-25 09:06:11 +00:00
|
|
|
hypotheses m_hypotheses;
|
|
|
|
expr m_conclusion;
|
2013-11-21 01:02:41 +00:00
|
|
|
public:
|
2013-11-21 23:31:55 +00:00
|
|
|
goal() {}
|
2013-11-25 09:06:11 +00:00
|
|
|
goal(hypotheses const & hs, expr const & c);
|
|
|
|
hypotheses const & get_hypotheses() const { return m_hypotheses; }
|
2013-11-21 01:02:41 +00:00
|
|
|
expr const & get_conclusion() const { return m_conclusion; }
|
2014-06-27 13:59:17 +00:00
|
|
|
format pp(environment const & env, formatter const & fmt, options const & opts) const;
|
2013-11-21 01:02:41 +00:00
|
|
|
};
|
|
|
|
|
2013-11-25 09:06:11 +00:00
|
|
|
inline goal update(goal const & g, expr const & c) { return goal(g.get_hypotheses(), c); }
|
|
|
|
inline goal update(goal const & g, hypotheses const & hs) { return goal(hs, g.get_conclusion()); }
|
|
|
|
inline goal update(goal const & g, buffer<hypothesis> const & hs) { return goal(to_list(hs.begin(), hs.end()), g.get_conclusion()); }
|
|
|
|
inline hypotheses add_hypothesis(name const & h_name, expr const & h, hypotheses const & hs) {
|
|
|
|
return cons(mk_pair(h_name, h), hs);
|
|
|
|
}
|
|
|
|
inline hypotheses add_hypothesis(hypothesis const & h, hypotheses const & hs) {
|
|
|
|
return cons(h, hs);
|
|
|
|
}
|
|
|
|
|
2014-06-27 13:59:17 +00:00
|
|
|
io_state_stream const & operator<<(io_state_stream const & out, goal const & g);
|
2013-11-27 03:15:49 +00:00
|
|
|
|
|
|
|
UDATA_DEFS_CORE(hypotheses)
|
|
|
|
UDATA_DEFS(goal)
|
|
|
|
void open_goal(lua_State * L);
|
2013-11-21 01:02:41 +00:00
|
|
|
}
|