2015-11-07 03:12:22 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include "library/app_builder.h"
|
|
|
|
#include "library/fun_info_manager.h"
|
|
|
|
|
|
|
|
namespace lean {
|
2015-11-08 01:24:17 +00:00
|
|
|
enum class congr_arg_kind { Fixed, Eq, Cast };
|
|
|
|
|
|
|
|
class congr_lemma {
|
|
|
|
expr m_type;
|
|
|
|
expr m_proof;
|
|
|
|
list<congr_arg_kind> m_arg_kinds;
|
|
|
|
public:
|
|
|
|
congr_lemma(expr const & type, expr const & proof, list<congr_arg_kind> const & ks):
|
|
|
|
m_type(type), m_proof(proof), m_arg_kinds(ks) {}
|
|
|
|
expr const & get_type() const { return m_type; }
|
|
|
|
expr const & get_proof() const { return m_proof; }
|
|
|
|
list<congr_arg_kind> const & get_arg_kinds() const { return m_arg_kinds; }
|
2015-11-17 23:14:42 +00:00
|
|
|
bool all_eq_kind() const;
|
2015-11-08 01:24:17 +00:00
|
|
|
};
|
|
|
|
|
2015-11-07 03:12:22 +00:00
|
|
|
class congr_lemma_manager {
|
|
|
|
struct imp;
|
|
|
|
std::unique_ptr<imp> m_ptr;
|
|
|
|
public:
|
2015-11-17 02:23:17 +00:00
|
|
|
congr_lemma_manager(app_builder & b, fun_info_manager & fm);
|
2015-11-07 03:12:22 +00:00
|
|
|
~congr_lemma_manager();
|
2015-11-08 01:24:17 +00:00
|
|
|
typedef congr_lemma result;
|
2015-11-07 20:06:42 +00:00
|
|
|
|
2015-12-04 00:25:10 +00:00
|
|
|
type_context & ctx();
|
|
|
|
|
2015-11-07 03:12:22 +00:00
|
|
|
optional<result> mk_congr_simp(expr const & fn);
|
2015-11-07 20:06:42 +00:00
|
|
|
optional<result> mk_congr_simp(expr const & fn, unsigned nargs);
|
2015-11-13 02:54:12 +00:00
|
|
|
|
|
|
|
optional<result> mk_congr(expr const & fn);
|
|
|
|
optional<result> mk_congr(expr const & fn, unsigned nargs);
|
2015-11-17 23:14:42 +00:00
|
|
|
|
|
|
|
/** \brief If R is an equivalence relation, construct the congruence lemma
|
|
|
|
|
|
|
|
R a1 a2 -> R b1 b2 -> (R a1 b1) <-> (R a2 b2) */
|
|
|
|
optional<result> mk_rel_iff_congr(expr const & R);
|
|
|
|
|
|
|
|
/** \brief Similar to previous one.
|
|
|
|
It returns none if propext is not available.
|
|
|
|
|
|
|
|
R a1 a2 -> R b1 b2 -> (R a1 b1) = (R a2 b2) */
|
|
|
|
optional<result> mk_rel_eq_congr(expr const & R);
|
2015-11-07 03:12:22 +00:00
|
|
|
};
|
2015-12-08 21:36:11 +00:00
|
|
|
|
|
|
|
void initialize_congr_lemma_manager();
|
|
|
|
void finalize_congr_lemma_manager();
|
2015-11-07 03:12:22 +00:00
|
|
|
}
|