2014-01-15 02:22:33 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "util/lua.h"
|
|
|
|
#include "kernel/environment.h"
|
|
|
|
#include "library/expr_pair.h"
|
|
|
|
namespace lean {
|
|
|
|
/**
|
|
|
|
\brief Given a proposition \c e and its proof H, return a list of conditional equations (and proofs) extracted from \c e.
|
|
|
|
|
|
|
|
The following rules are used to convert \c e into conditional equations.
|
|
|
|
|
|
|
|
[not P] ---> P = false
|
|
|
|
[P /\ Q] ---> [P], [Q]
|
|
|
|
[if P then Q else R] ---> P -> [Q], not P -> [Q]
|
|
|
|
[P -> Q] ---> P -> [Q]
|
|
|
|
[forall x : A, P] ---> forall x : A, [P]
|
2014-01-15 23:30:16 +00:00
|
|
|
[a ≠ b] ---> (a = b) = false
|
2014-01-15 02:22:33 +00:00
|
|
|
|
|
|
|
P ---> P = true (if none of the rules above apply and P is not an equality)
|
2014-01-15 20:05:14 +00:00
|
|
|
|
|
|
|
\remark if the left-hand-side of an equation does not contain all variables, then it is
|
|
|
|
discarded. That is, all elements in the resultant list satisfy the predicate \c is_ceq.
|
2014-01-15 02:22:33 +00:00
|
|
|
*/
|
|
|
|
list<expr_pair> to_ceqs(ro_environment const & env, expr const & e, expr const & H);
|
2014-01-15 20:05:14 +00:00
|
|
|
/**
|
|
|
|
\brief Return true iff \c e is a conditional equation.
|
|
|
|
|
|
|
|
A conditional equation ceq has the form
|
|
|
|
<code>
|
|
|
|
ceq := (forall x : A, ceq)
|
|
|
|
| lhs = rhs
|
|
|
|
| lhs == rhs
|
|
|
|
</code>
|
|
|
|
|
|
|
|
Moreover, for <tt>(forall x : A, ceq)</tt>, the variable x must occur in the \c ceq left-hand-size
|
|
|
|
when \c A is not a proposition.
|
|
|
|
*/
|
|
|
|
bool is_ceq(ro_environment const & env, expr e);
|
2014-01-16 03:53:52 +00:00
|
|
|
/**
|
|
|
|
\brief Return true iff the lhs is identical to the rhs modulo a
|
|
|
|
permutation of the conditional equation arguments.
|
|
|
|
*/
|
|
|
|
bool is_permutation_ceq(expr e);
|
2014-01-15 02:22:33 +00:00
|
|
|
void open_ceq(lua_State * L);
|
|
|
|
}
|