diff --git a/Tactic.Assumption.html b/Tactic.Assumption.html index f7dfb0f..9aeb06f 100644 --- a/Tactic.Assumption.html +++ b/Tactic.Assumption.html @@ -1,47 +1,45 @@
{-# OPTIONS --safe --without-K #-} - -{-# OPTIONS -v allTactics:100 #-} --------------------------------------------------------------------------------- --- assumption: try to solve the goal with one of the available assumptions --------------------------------------------------------------------------------- - -module Tactic.Assumption where - -open import Meta.Prelude -open import Meta.Init - -open import Class.Functor -open import Class.Monad -open import Class.MonadError.Instances -open import Class.MonadReader.Instances -open import Class.MonadTC.Instances - -open import Reflection.Tactic -open import Reflection.Utils -open import Reflection.Utils.TCI - -instance - _ = Functor-M - -assumption' : ITactic -assumption' = inDebugPath "assumption" do - c ← getContext - foldl (λ x k → do - catch (unifyWithGoal (♯ k) >> debugLog ("Success with: " ∷ᵈ ♯ k ∷ᵈ [])) (λ _ → x)) - (logAndError1 "No valid assumption!") (downFrom $ length c) - -module _ ⦃ _ : TCOptions ⦄ where - macro - assumption = initTac assumption' - assumptionOpts = initTacOpts assumption' - -private - open import Tactic.Defaults - module Test where - test₁ : {A B : Set} → A → B → A - test₁ a b = assumption - - test₂ : {A B : Set} → A → B → B - test₂ a b = assumption +-------------------------------------------------------------------------------- +-- assumption: try to solve the goal with one of the available assumptions +-------------------------------------------------------------------------------- + +module Tactic.Assumption where + +open import Meta.Prelude +open import Meta.Init + +open import Class.Functor +open import Class.Monad +open import Class.MonadError.Instances +open import Class.MonadReader.Instances +open import Class.MonadTC.Instances + +open import Reflection.Tactic +open import Reflection.Utils +open import Reflection.Utils.TCI + +instance + _ = Functor-M + +assumption' : ITactic +assumption' = inDebugPath "assumption" do + c ← getContext + foldl (λ x k → do + catch (unifyWithGoal (♯ k) >> debugLog ("Success with: " ∷ᵈ ♯ k ∷ᵈ [])) (λ _ → x)) + (logAndError1 "No valid assumption!") (downFrom $ length c) + +module _ ⦃ _ : TCOptions ⦄ where + macro + assumption = initTac assumption' + assumptionOpts = initTacOpts assumption' + +private + open import Tactic.Defaults + module Test where + test₁ : {A B : Set} → A → B → A + test₁ a b = assumption + + test₂ : {A B : Set} → A → B → B + test₂ a b = assumption\ No newline at end of file diff --git a/Tactic.Case.html b/Tactic.Case.html index 8401b93..77deeb0 100644 --- a/Tactic.Case.html +++ b/Tactic.Case.html @@ -53,17 +53,17 @@ b : B test₁ : A × B → A - test₁ x = by (case x assumption') + test₁ x = by (case x assumption') test₂ : A × B → B - test₂ x = by (case x assumption') + test₂ x = by (case x assumption') test₃ : A ⊎ A → A - test₃ x = by (case x assumption') + test₃ x = by (case x assumption') test₄ : TestType → A - test₄ x = by (case x assumption') + test₄ x = by (case x assumption') test₅ : TestType → B - test₅ x = by (case x assumption') + test₅ x = by (case x assumption')