feat(library/blast/strategies): add 'blast.strategy "preprocess"'

This commit is contained in:
Leonardo de Moura 2015-12-05 18:17:15 -08:00
parent 11400edd4a
commit df567717f8
10 changed files with 27 additions and 7 deletions

View file

@ -4,16 +4,29 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura Author: Leonardo de Moura
*/ */
#include <string>
#include "library/blast/strategies/simple_strategy.h" #include "library/blast/strategies/simple_strategy.h"
#include "library/blast/strategies/preprocess_strategy.h" #include "library/blast/strategies/preprocess_strategy.h"
namespace lean { namespace lean {
namespace blast { namespace blast {
static optional<expr> apply_preprocess() {
return preprocess_and_then([]() { return none_expr(); })();
}
static optional<expr> apply_simple() { static optional<expr> apply_simple() {
return preprocess_and_then(mk_simple_strategy())(); return preprocess_and_then(mk_simple_strategy())();
} }
optional<expr> apply_strategy() { optional<expr> apply_strategy() {
std::string s_name(get_config().m_strategy);
if (s_name == "preprocess") {
return apply_preprocess();
} else if (s_name == "simple") {
return apply_simple(); return apply_simple();
} else {
// TODO(Leo): add more builtin strategies
return apply_simple();
}
} }
}} }}

View file

@ -1,2 +1,4 @@
set_option blast.strategy "preprocess"
example (a b : Prop) (Ha : a) (Hb : b) : a := example (a b : Prop) (Ha : a) (Hb : b) : a :=
by blast by blast

View file

@ -1,3 +1,5 @@
set_option blast.strategy "preprocess"
example (a b : Prop) : forall (Ha : a) (Hb : b), a := example (a b : Prop) : forall (Ha : a) (Hb : b), a :=
by blast by blast

View file

@ -1,4 +1,5 @@
set_option blast.init_depth 10 -- TODO(Leo): use better strategy
set_option blast.strategy "simple"
set_option blast.cc false set_option blast.cc false
example (a b c : Prop) : b → c → b ∧ c := example (a b c : Prop) : b → c → b ∧ c :=

View file

@ -1,3 +1,5 @@
set_option blast.strategy "preprocess"
lemma T1 (a b : Prop) : false → a := lemma T1 (a b : Prop) : false → a :=
by blast by blast

View file

@ -1,4 +1,4 @@
set_option blast.init_depth 10 set_option blast.strategy "preprocess"
example (a b : nat) : a = b → b = a := example (a b : nat) : a = b → b = a :=
by blast by blast

View file

@ -1,4 +1,4 @@
set_option blast.init_depth 10 set_option blast.strategy "preprocess"
lemma lemma1 (bv : nat → Type) (n m : nat) (H : n = m) (b1 : bv n) (b2 : bv m) (H2 : eq.rec_on H b1 = b2) : b1 = eq.rec_on (eq.symm H) b2 := lemma lemma1 (bv : nat → Type) (n m : nat) (H : n = m) (b1 : bv n) (b2 : bv m) (H2 : eq.rec_on H b1 = b2) : b1 = eq.rec_on (eq.symm H) b2 :=
by blast by blast

View file

@ -1,4 +1,4 @@
set_option blast.init_depth 10 set_option blast.strategy "preprocess"
lemma lemma1 (p : Prop) (a b : nat) : a = b → p → p := lemma lemma1 (p : Prop) (a b : nat) : a = b → p → p :=
by blast by blast

View file

@ -1,6 +1,5 @@
open nat open nat
set_option blast.init_depth 10 set_option blast.strategy "preprocess"
set_option blast.max_depth 10
lemma l1 (a : nat) : zero = succ a → a = a → false := lemma l1 (a : nat) : zero = succ a → a = a → false :=
by blast by blast

View file

@ -1,5 +1,6 @@
import data.list import data.list
open list open list
set_option blast.strategy "preprocess"
example (p : Prop) (a b c : nat) : [a, b, c] = [] → p := example (p : Prop) (a b c : nat) : [a, b, c] = [] → p :=
by blast by blast