feat(library/blast/intros): intros is now a silent step.
This commit is contained in:
parent
4aa20fcff0
commit
0a25652885
2 changed files with 15 additions and 2 deletions
|
@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
|
|||
|
||||
Author: Leonardo de Moura
|
||||
*/
|
||||
#include <limits>
|
||||
#include "kernel/abstract.h"
|
||||
#include "kernel/instantiate.h"
|
||||
#include "library/blast/blast.h"
|
||||
|
@ -18,9 +19,11 @@ struct intros_proof_step_cell : public proof_step_cell {
|
|||
expr new_pr = mk_proof_lambda(curr_state(), m_new_hs, unfold_hypotheses_ge(curr_state(), pr));
|
||||
return action_result::solved(new_pr);
|
||||
}
|
||||
|
||||
virtual bool is_silent() const override { return true; }
|
||||
};
|
||||
|
||||
bool intros_action() {
|
||||
bool intros_action(unsigned max) {
|
||||
state & s = curr_state();
|
||||
expr target = whnf(s.get_target());
|
||||
if (!is_pi(target))
|
||||
|
@ -28,7 +31,9 @@ bool intros_action() {
|
|||
auto pcell = new intros_proof_step_cell();
|
||||
s.push_proof_step(pcell);
|
||||
buffer<expr> new_hs;
|
||||
while (is_pi(target)) {
|
||||
for (unsigned i = 0; i < max; i++) {
|
||||
if (!is_pi(target))
|
||||
break;
|
||||
expr href = s.mk_hypothesis(binding_name(target), binding_domain(target));
|
||||
new_hs.push_back(href);
|
||||
target = whnf(instantiate(binding_body(target), href));
|
||||
|
@ -37,4 +42,8 @@ bool intros_action() {
|
|||
s.set_target(target);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool intros_action() {
|
||||
return intros_action(std::numeric_limits<unsigned>::max());
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -7,5 +7,9 @@ Author: Leonardo de Moura
|
|||
#pragma once
|
||||
namespace lean {
|
||||
namespace blast {
|
||||
/** \brief Introduce upto \c max hypotheses.
|
||||
Return false if there is nothing to introduce, that is, target is not a Pi-type. */
|
||||
bool intros_action(unsigned max);
|
||||
/** \brief Keep introducing until target is not a Pi-type. */
|
||||
bool intros_action();
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue