2013-11-21 01:02:41 +00:00
|
|
|
/*
|
2014-06-27 21:49:48 +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-25 18:39:40 +00:00
|
|
|
#include <algorithm>
|
2013-11-27 03:15:49 +00:00
|
|
|
#include "util/lua.h"
|
2013-11-25 09:06:11 +00:00
|
|
|
#include "util/optional.h"
|
2013-11-30 19:28:10 +00:00
|
|
|
#include "util/name_set.h"
|
2014-08-20 05:31:26 +00:00
|
|
|
#include "kernel/metavar.h"
|
2013-11-21 01:02:41 +00:00
|
|
|
#include "library/tactic/goal.h"
|
|
|
|
|
|
|
|
namespace lean {
|
2014-07-01 23:11:19 +00:00
|
|
|
typedef list<goal> goals;
|
2013-11-21 01:02:41 +00:00
|
|
|
class proof_state {
|
2014-06-27 21:49:48 +00:00
|
|
|
goals m_goals;
|
2014-07-01 23:11:19 +00:00
|
|
|
substitution m_subst;
|
2014-06-27 21:49:48 +00:00
|
|
|
name_generator m_ngen;
|
2014-10-15 00:12:57 +00:00
|
|
|
constraints m_postponed;
|
2013-11-21 01:02:41 +00:00
|
|
|
public:
|
2014-10-15 00:12:57 +00:00
|
|
|
proof_state(goals const & gs, substitution const & s, name_generator const & ngen, constraints const & postponed);
|
|
|
|
proof_state(proof_state const & s, goals const & gs, substitution const & subst):
|
|
|
|
proof_state(gs, subst, s.m_ngen, s.m_postponed) {}
|
|
|
|
proof_state(proof_state const & s, goals const & gs):
|
|
|
|
proof_state(s, gs, s.m_subst) {}
|
|
|
|
proof_state(proof_state const & s, name_generator const & ngen):
|
|
|
|
proof_state(s.m_goals, s.m_subst, ngen, s.m_postponed) {}
|
2014-07-01 23:11:19 +00:00
|
|
|
|
2014-06-27 21:49:48 +00:00
|
|
|
goals const & get_goals() const { return m_goals; }
|
2014-07-01 23:11:19 +00:00
|
|
|
substitution const & get_subst() const { return m_subst; }
|
|
|
|
name_generator const & get_ngen() const { return m_ngen; }
|
2014-10-15 00:12:57 +00:00
|
|
|
constraints const & get_postponed() const { return m_postponed; }
|
2014-07-01 23:11:19 +00:00
|
|
|
|
2014-06-30 15:48:01 +00:00
|
|
|
/** \brief Return true iff this state does not have any goals left */
|
|
|
|
bool is_final_state() const { return empty(m_goals); }
|
2014-07-10 17:32:00 +00:00
|
|
|
format pp(formatter const & fmt) const;
|
2013-11-21 01:02:41 +00:00
|
|
|
};
|
2013-11-21 20:34:37 +00:00
|
|
|
|
2014-06-27 21:49:48 +00:00
|
|
|
inline optional<proof_state> some_proof_state(proof_state const & s) { return some(s); }
|
2013-11-25 09:06:11 +00:00
|
|
|
inline optional<proof_state> none_proof_state() { return optional<proof_state> (); }
|
|
|
|
|
2014-10-15 00:12:57 +00:00
|
|
|
proof_state to_proof_state(expr const & meta, expr const & type, substitution const & subst, name_generator ngen);
|
2014-07-02 03:43:53 +00:00
|
|
|
proof_state to_proof_state(expr const & meta, expr const & type, name_generator ngen);
|
2014-06-28 01:35:59 +00:00
|
|
|
|
2014-07-01 23:11:19 +00:00
|
|
|
goals map_goals(proof_state const & s, std::function<optional<goal>(goal const & g)> f);
|
2014-06-28 01:35:59 +00:00
|
|
|
io_state_stream const & operator<<(io_state_stream const & out, proof_state const & s);
|
2013-12-24 22:23:06 +00:00
|
|
|
|
2013-11-27 03:15:49 +00:00
|
|
|
UDATA_DEFS_CORE(goals)
|
|
|
|
UDATA_DEFS(proof_state)
|
|
|
|
void open_proof_state(lua_State * L);
|
2014-09-22 17:27:48 +00:00
|
|
|
|
|
|
|
void initialize_proof_state();
|
|
|
|
void finalize_proof_state();
|
2013-11-21 01:02:41 +00:00
|
|
|
}
|