diff --git a/src/library/tactic/apply_tactic.cpp b/src/library/tactic/apply_tactic.cpp index 967bb935a..aed4ad198 100644 --- a/src/library/tactic/apply_tactic.cpp +++ b/src/library/tactic/apply_tactic.cpp @@ -185,6 +185,12 @@ proof_state_seq apply_tactic_core(environment const & env, io_state const & ios, return apply_tactic_core(env, ios, s, e, tmp_cs, AddDiff, AddSubgoals); } +proof_state_seq fapply_tactic_core(environment const & env, io_state const & ios, proof_state const & s, expr const & e, constraint_seq const & cs) { + buffer tmp_cs; + cs.linearize(tmp_cs); + return apply_tactic_core(env, ios, s, e, tmp_cs, AddDiff, AddAllSubgoals); +} + tactic apply_tactic_core(expr const & e, constraint_seq const & cs) { return tactic([=](environment const & env, io_state const & ios, proof_state const & s) { return apply_tactic_core(env, ios, s, e, cs); diff --git a/src/library/tactic/apply_tactic.h b/src/library/tactic/apply_tactic.h index 1c1a4f5d9..7919052c9 100644 --- a/src/library/tactic/apply_tactic.h +++ b/src/library/tactic/apply_tactic.h @@ -9,6 +9,7 @@ Author: Leonardo de Moura #include "library/tactic/elaborate.h" namespace lean { proof_state_seq apply_tactic_core(environment const & env, io_state const & ios, proof_state const & s, expr const & e, constraint_seq const & cs); +proof_state_seq fapply_tactic_core(environment const & env, io_state const & ios, proof_state const & s, expr const & e, constraint_seq const & cs); tactic apply_tactic_core(expr const & e, constraint_seq const & cs = constraint_seq()); tactic apply_tactic(elaborate_fn const & fn, expr const & e); tactic fapply_tactic(elaborate_fn const & fn, expr const & e); diff --git a/src/library/tactic/constructor_tactic.cpp b/src/library/tactic/constructor_tactic.cpp index 114cfaa25..19e7f4e67 100644 --- a/src/library/tactic/constructor_tactic.cpp +++ b/src/library/tactic/constructor_tactic.cpp @@ -83,7 +83,7 @@ tactic constructor_tactic(elaborate_fn const & elab, optional _i, opti return proof_state_seq(); } } - return apply_tactic_core(env, ios, new_s, C, cs); + return fapply_tactic_core(env, ios, new_s, C, cs); }; if (_i) { diff --git a/tests/lean/run/676.lean b/tests/lean/run/676.lean new file mode 100644 index 000000000..136d199d0 --- /dev/null +++ b/tests/lean/run/676.lean @@ -0,0 +1,12 @@ +import data.nat +open nat + +inductive foo : Prop := +mk : ∀ {a : nat}, a > 0 → foo + +example (b : nat) (h : b > 1) : foo := +begin + constructor, + exact b, + exact lt_of_succ_lt h +end diff --git a/tests/lean/run/soundness.lean b/tests/lean/run/soundness.lean index 5c33e2d07..e1cd93b95 100644 --- a/tests/lean/run/soundness.lean +++ b/tests/lean/run/soundness.lean @@ -90,26 +90,26 @@ namespace PropF lemma weakening2 : ∀ {Γ A Δ}, Γ ⊢ A → Γ ⊆ Δ → Δ ⊢ A | Γ ⌞A⌟ Δ (Nax Γ A Hin) Hs := by constructor; exact Hs Hin | Γ ⌞A ⇒ B⌟ Δ (ImpI Γ A B H) Hs := by constructor; exact weakening2 H (cons_sub_cons A Hs) - | Γ ⌞B⌟ Δ (ImpE Γ A B H₁ H₂) Hs := by constructor; exact weakening2 H₁ Hs; exact weakening2 H₂ Hs + | Γ ⌞B⌟ Δ (ImpE Γ A B H₁ H₂) Hs := by constructor; eassumption; exact weakening2 H₁ Hs; exact weakening2 H₂ Hs | Γ ⌞A⌟ Δ (BotC Γ A H) Hs := by constructor; exact weakening2 H (cons_sub_cons (~A) Hs) | Γ ⌞A ∧ B⌟ Δ (AndI Γ A B H₁ H₂) Hs := by constructor; exact weakening2 H₁ Hs; exact weakening2 H₂ Hs - | Γ ⌞A⌟ Δ (AndE₁ Γ A B H) Hs := by constructor; exact weakening2 H Hs - | Γ ⌞B⌟ Δ (AndE₂ Γ A B H) Hs := by constructor; exact weakening2 H Hs + | Γ ⌞A⌟ Δ (AndE₁ Γ A B H) Hs := by constructor; eassumption; exact weakening2 H Hs + | Γ ⌞B⌟ Δ (AndE₂ Γ A B H) Hs := by constructor; eassumption; exact weakening2 H Hs | Γ ⌞A ∨ B⌟ Δ (OrI₁ Γ A B H) Hs := by constructor; exact weakening2 H Hs | Γ ⌞A ∨ B⌟ Δ (OrI₂ Γ A B H) Hs := by constructor; exact weakening2 H Hs | Γ ⌞C⌟ Δ (OrE Γ A B C H₁ H₂ H₃) Hs := - by constructor; exact weakening2 H₁ Hs; exact weakening2 H₂ (cons_sub_cons A Hs); exact weakening2 H₃ (cons_sub_cons B Hs) + by constructor; eassumption; eassumption; exact weakening2 H₁ Hs; exact weakening2 H₂ (cons_sub_cons A Hs); exact weakening2 H₃ (cons_sub_cons B Hs) lemma weakening : ∀ Γ Δ A, Γ ⊢ A → Γ++Δ ⊢ A := λ Γ Δ A H, weakening2 H (sub_append_left Γ Δ) lemma deduction : ∀ Γ A B, Γ ⊢ A ⇒ B → A::Γ ⊢ B := - λ Γ A B H, by constructor; exact weakening2 H (sub_cons A Γ); constructor; exact mem_cons A Γ + λ Γ A B H, by constructor; exact A; exact weakening2 H (sub_cons A Γ); constructor; exact mem_cons A Γ lemma prov_impl : ∀ A B, Provable (A ⇒ B) → ∀ Γ, Γ ⊢ A → Γ ⊢ B := λ A B Hp Γ Ha, assert wHp : Γ ⊢ (A ⇒ B), from !weakening Hp, - by constructor; eassumption; eassumption + by constructor; eassumption; eassumption; eassumption lemma Satisfies_cons : ∀ {A Γ v}, Satisfies v Γ → is_true (TrueQ v A) → Satisfies v (A::Γ) := λ A Γ v s t B BinAG,