diff --git a/library/init/meta/smt/congruence_closure.lean b/library/init/meta/smt/congruence_closure.lean index 6282452091..63d4299ceb 100644 --- a/library/init/meta/smt/congruence_closure.lean +++ b/library/init/meta/smt/congruence_closure.lean @@ -8,20 +8,16 @@ import init.meta.tactic init.meta.set_get_option_tactics structure cc_config := /- If tt, congruence closure will treat implicit instance arguments as constants. -/ -(ignore_instances : bool) +(ignore_instances : bool := tt) /- If tt, congruence closure modulo AC. -/ -(ac : bool) +(ac : bool := tt) /- If ho_fns is (some fns), then full (and more expensive) support for higher-order functions is *only* considered for the functions in fns and local functions. The performance overhead is described in the paper "Congruence Closure in Intensional Type Theory". If ho_fns is none, then full support is provided for *all* constants. -/ -(ho_fns : option (list name)) +(ho_fns : option (list name) := some []) /- If true, then use excluded middle -/ -(em : bool) - - -def default_cc_config : cc_config := -{ignore_instances := tt, ac := tt, ho_fns := some [], em := tt} +(em : bool := tt) /- Congruence closure state -/ meta constant cc_state : Type @@ -52,10 +48,10 @@ meta constant cc_state.proof_for_false : cc_state → tactic expr namespace cc_state meta def mk : cc_state := -cc_state.mk_core default_cc_config +cc_state.mk_core {} meta def mk_using_hs : tactic cc_state := -cc_state.mk_using_hs_core default_cc_config +cc_state.mk_using_hs_core {} meta def roots (s : cc_state) : list expr := cc_state.roots_core s tt @@ -104,7 +100,7 @@ do intros, s ← cc_state.mk_using_hs_core cfg, t ← target, s ← s^.internali } meta def tactic.cc : tactic unit := -tactic.cc_core default_cc_config +tactic.cc_core {} meta def tactic.cc_dbg_core (cfg : cc_config) : tactic unit := save_options $ @@ -112,7 +108,7 @@ save_options $ >> tactic.cc_core cfg meta def tactic.cc_dbg : tactic unit := -tactic.cc_dbg_core default_cc_config +tactic.cc_dbg_core {} meta def tactic.ac_refl : tactic unit := do (lhs, rhs) ← target >>= match_eq, diff --git a/library/init/meta/smt/ematch.lean b/library/init/meta/smt/ematch.lean index 12146db865..9c6a7a5de8 100644 --- a/library/init/meta/smt/ematch.lean +++ b/library/init/meta/smt/ematch.lean @@ -140,10 +140,7 @@ do caching_user_attribute.get_cache attr structure ematch_config := -(max_instances : nat) - -def default_ematch_config : ematch_config := -{max_instances := 10000} +(max_instances : nat := 10000) /- Ematching -/ meta constant ematch_state : Type diff --git a/library/init/meta/smt/smt_tactic.lean b/library/init/meta/smt/smt_tactic.lean index 67ae2a24a5..79b84abc1d 100644 --- a/library/init/meta/smt/smt_tactic.lean +++ b/library/init/meta/smt/smt_tactic.lean @@ -26,14 +26,9 @@ run_command mk_hinst_lemma_attr_set `ematch [] [`ematch_lhs] is used during preprocessing. -/ structure smt_pre_config := -(simp_attr : name) -(max_steps : nat) -(zeta : bool) - -def default_smt_pre_config : smt_pre_config := -{ simp_attr := `pre_smt, - max_steps := 1000000, - zeta := ff } +(simp_attr : name := `pre_smt) +(max_steps : nat := 1000000) +(zeta : bool := ff) /-- Configuration for the smt_state object. @@ -41,16 +36,10 @@ Configuration for the smt_state object. - em_attr: is the attribute name for the hinst_lemmas that are used for ematching -/ structure smt_config := -(cc_cfg : cc_config) -(em_cfg : ematch_config) -(pre_cfg : smt_pre_config) -(em_attr : name) - -def default_smt_config : smt_config := -{cc_cfg := default_cc_config, - em_cfg := default_ematch_config, - pre_cfg := default_smt_pre_config, - em_attr := `ematch} +(cc_cfg : cc_config := {}) +(em_cfg : ematch_config := {}) +(pre_cfg : smt_pre_config := {}) +(em_attr : name := `ematch) meta def smt_config.set_classical (c : smt_config) (b : bool) : smt_config := {c with cc_cfg := { (c^.cc_cfg) with em := b}} @@ -203,7 +192,7 @@ private meta def mk_smt_goals_for (cfg : smt_config) : list expr → list smt_go meta def slift {α : Type} (t : tactic α) : smt_tactic α := λ ss, do _::sgs ← return ss | fail "slift tactic failed, there no smt goals to be solved", - cfg ← return default_smt_config, -- TODO(Leo): use get_config + cfg ← return {smt_config .}, -- TODO(Leo): use get_config tg::tgs ← tactic.get_goals | tactic.failed, tactic.set_goals [tg], a ← t, new_tgs ← tactic.get_goals, @@ -381,4 +370,4 @@ do ss ← smt_state.mk cfg, return () meta def using_smt : smt_tactic unit → tactic unit := -using_smt_core default_smt_config +using_smt_core {} diff --git a/library/tools/super/prover_state.lean b/library/tools/super/prover_state.lean index de82a08a89..0ecc8202c8 100644 --- a/library/tools/super/prover_state.lean +++ b/library/tools/super/prover_state.lean @@ -338,7 +338,7 @@ do passive ← flip monad.lift state_t.read $ λst, st^.passive, for' passive^.t return () def super_cc_config : cc_config := -{ default_cc_config with em := ff } +{ em := ff } meta def do_sat_run : prover (option expr) := do sat_result ← in_sat_solver $ cdcl.run (cdcl.theory_solver_of_tactic $ using_smt $ return ()), diff --git a/tests/lean/run/ematch1.lean b/tests/lean/run/ematch1.lean index 165488d59f..810649b1ba 100644 --- a/tests/lean/run/ematch1.lean +++ b/tests/lean/run/ematch1.lean @@ -12,7 +12,7 @@ meta def add_insts : list (expr × expr) → tactic unit meta def ematch_test (h : name) (e : expr) : tactic unit := do cc ← cc_state.mk_using_hs, - ems ← return $ ematch_state.mk default_ematch_config, + ems ← return $ ematch_state.mk {}, hlemma ← hinst_lemma.mk_from_decl h, (r, cc, ems) ← ematch cc ems hlemma e, add_insts r diff --git a/tests/lean/run/ematch2.lean b/tests/lean/run/ematch2.lean index 6211e17739..e967184913 100644 --- a/tests/lean/run/ematch2.lean +++ b/tests/lean/run/ematch2.lean @@ -17,7 +17,7 @@ meta def internalize_hs : list expr → ematch_state → tactic ematch_state meta def ematch_test (h : name) : tactic unit := do cc ← cc_state.mk_using_hs, ctx ← local_context, - ems ← internalize_hs ctx (ematch_state.mk default_ematch_config), + ems ← internalize_hs ctx (ematch_state.mk {}), tgt ← target, ems ← ems^.internalize tgt, hlemma ← hinst_lemma.mk_from_decl h, diff --git a/tests/lean/run/smt_destruct.lean b/tests/lean/run/smt_destruct.lean index a013ee2eb8..bb05b9425e 100644 --- a/tests/lean/run/smt_destruct.lean +++ b/tests/lean/run/smt_destruct.lean @@ -28,7 +28,7 @@ begin [smt] -- the default configuration is classical end lemma ex5 (p q : Prop) [decidable p] : p ∨ q → p ∨ ¬q → ¬p ∨ q → ¬p ∨ ¬q → false := -begin [smt] with default_smt_config^.set_classical ff, +begin [smt] with {smt_config .}^.set_classical ff, intros, by_cases p -- will fail if p is not decidable end @@ -42,13 +42,13 @@ begin [smt] -- the default configuration is classical end lemma ex7 (p q : Prop) [decidable p] : p ∨ q → p ∨ ¬q → ¬p ∨ q → p ∧ q := -begin [smt] with default_smt_config^.set_classical ff, +begin [smt] with {smt_config .}^.set_classical ff, intros, by_cases p -- will fail if p is not decidable end lemma ex8 (p q : Prop) [decidable p] [decidable q] : p ∨ q → p ∨ ¬q → ¬p ∨ q → p ∧ q := -begin [smt] with default_smt_config^.set_classical ff, +begin [smt] with {smt_config .}^.set_classical ff, intros, by_contradiction, -- will fail if p or q is not decidable trace_state, diff --git a/tests/lean/run/smt_ematch2.lean b/tests/lean/run/smt_ematch2.lean index a365f5bc2e..a0585d92b4 100644 --- a/tests/lean/run/smt_ematch2.lean +++ b/tests/lean/run/smt_ematch2.lean @@ -4,7 +4,7 @@ variables {α : Type u} open smt_tactic meta def no_ac : smt_config := -{ default_smt_config with cc_cfg := { default_cc_config with ac := ff }} +{ cc_cfg := { ac := ff }} meta def blast : tactic unit := using_smt_core no_ac $ intros >> repeat (ematch >> try close) diff --git a/tests/lean/run/smt_ematch3.lean b/tests/lean/run/smt_ematch3.lean index a442f82a00..d169e10981 100644 --- a/tests/lean/run/smt_ematch3.lean +++ b/tests/lean/run/smt_ematch3.lean @@ -18,7 +18,7 @@ lemma app_nil_right {n : nat} (v : vector α n) : app v nil == v := begin induction v, reflexivity, {[smt] ematch_using [app, add_comm, zero_add, add_zero] }, end def smt_cfg : smt_config := -{ default_smt_config with cc_cfg := {default_cc_config with ac := ff}} +{ cc_cfg := {ac := ff}} lemma app_assoc {n₁ n₂ n₃ : nat} (v₁ : vector α n₁) (v₂ : vector α n₂) (v₃ : vector α n₃) : app v₁ (app v₂ v₃) == app (app v₁ v₂) v₃ := diff --git a/tests/lean/run/smt_ematch_alg_issue.lean b/tests/lean/run/smt_ematch_alg_issue.lean index 9eb1242080..e549ca7c4d 100644 --- a/tests/lean/run/smt_ematch_alg_issue.lean +++ b/tests/lean/run/smt_ematch_alg_issue.lean @@ -3,7 +3,7 @@ add_comm open smt_tactic meta def no_ac : smt_config := -{ default_smt_config with cc_cfg := { default_cc_config with ac := ff }} +{ cc_cfg := { ac := ff }} lemma ex {α : Type} [field α] (a b : α) : a + b = b + a := begin [smt] with no_ac, diff --git a/tests/lean/run/test_single.sh b/tests/lean/run/test_single.sh old mode 100644 new mode 100755 diff --git a/tests/lean/run/using_smt3.lean b/tests/lean/run/using_smt3.lean index bd16f183ca..d2cfae2aba 100644 --- a/tests/lean/run/using_smt3.lean +++ b/tests/lean/run/using_smt3.lean @@ -11,11 +11,8 @@ meta def fail_if_success {α : Type} (t : smt_tactic α) : smt_tactic unit := | exception .(α × smt_state) _ _ _ := success ((), ss) ts end -def my_pre_config : smt_pre_config := -{ default_smt_pre_config with zeta := tt } - def my_smt_config : smt_config := -{ default_smt_config with pre_cfg := my_pre_config } +{ pre_cfg := { zeta := tt } } lemma ex2 : let x := 1 in ∀ y, x = y → y = 1 := by using_smt_core my_smt_config $ smt_tactic.intros >> fail_if_success (get_local `x) >> return () diff --git a/tests/lean/structure_instance_bug2.lean b/tests/lean/structure_instance_bug2.lean index 9d3c7b2ec7..58510fb2f3 100644 --- a/tests/lean/structure_instance_bug2.lean +++ b/tests/lean/structure_instance_bug2.lean @@ -1,3 +1,5 @@ +def default_smt_pre_config : smt_pre_config := {} + def my_pre_config1 : smt_pre_config := { default_smt_pre_config . zeta := tt } diff --git a/tests/lean/structure_instance_bug2.lean.expected.out b/tests/lean/structure_instance_bug2.lean.expected.out index 5b4488eed2..0d7ac96c71 100644 --- a/tests/lean/structure_instance_bug2.lean.expected.out +++ b/tests/lean/structure_instance_bug2.lean.expected.out @@ -1 +1 @@ -structure_instance_bug2.lean:2:0: error: invalid structure instance, 'default_smt_pre_config' is not the name of a structure type +structure_instance_bug2.lean:4:0: error: invalid structure instance, 'default_smt_pre_config' is not the name of a structure type