Issue1382.agda 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {-# OPTIONS --allow-unsolved-metas #-}
  2. -- Andreas, 2014-12-06
  3. -- Reported by sanzhiyan, Dec 4 2014
  4. open import Data.Vec
  5. open import Data.Fin
  6. open import Data.Nat renaming (_+_ to _+N_)
  7. open import Data.Nat.Solver
  8. open import Relation.Binary.PropositionalEquality hiding ([_])
  9. open +-*-Solver using (prove; solve; _:=_; con; var; _:+_; _:*_; :-_; _:-_)
  10. data prop : Set where
  11. F T : prop
  12. _∧_ _∨_ : prop → prop → prop
  13. infixl 4 _∧_ _∨_
  14. Γ : (n : ℕ) → Set
  15. Γ n = Vec prop n
  16. infix 1 _⊢_
  17. data _⊢_ : ∀ {n} → Γ n → prop → Set where
  18. hyp : ∀ {n}(C : Γ n)(v : Fin n) → C ⊢ (lookup C v)
  19. andI : ∀ {n}{C : Γ n}{p p' : prop} → C ⊢ p → C ⊢ p' → C ⊢ p ∧ p'
  20. andEL : ∀ {n}{C : Γ n}{p p' : prop} → C ⊢ p ∧ p' → C ⊢ p
  21. andER : ∀ {n}{C : Γ n}{p p' : prop} → C ⊢ p ∧ p' → C ⊢ p'
  22. orIL : ∀ {n}{C : Γ n}{p : prop}(p' : prop) → C ⊢ p → C ⊢ p ∨ p'
  23. orIR : ∀ {n}{C : Γ n}{p' : prop}(p : prop) → C ⊢ p' → C ⊢ p ∨ p'
  24. orE : ∀ {n}{C : Γ n}{p p' c : prop} → C ⊢ p ∨ p' → p ∷ C ⊢ c → p' ∷ C ⊢ c → C ⊢ c
  25. -- WAS:
  26. -- The first two _ could not be solved before today's (2014-12-06) improvement of pruning.
  27. -- Except for variables, they were applied to a huge neutral proof term coming from the ring solver.
  28. -- Agda could not prune before the improved neutrality check implemented by Andrea(s) 2014-12-05/06.
  29. --
  30. -- As a consequence, Agda would often reattempt solving, each time doing the expensive
  31. -- occurs check. This would extremely slow down Agda.
  32. weakening : ∀ {n m p p'}(C : Γ n)(C' : Γ m) → C ++ C' ⊢ p → C ++ [ p' ] ++ C' ⊢ p
  33. weakening {n} {m} {p' = p'} C C' (hyp .(C ++ C') v) = subst (λ R → C ++ (_ ∷ C') ⊢ R) {!!}
  34. (hyp (C ++ (_ ∷ C')) (subst (λ x → Fin x) proof (inject₁ v))) where
  35. proof : suc (n +N m) ≡ n +N suc m
  36. proof = (solve 2 (λ n₁ m₁ → con 1 :+ (n₁ :+ m₁) := n₁ :+ (con 1 :+ m₁)) refl n m)
  37. weakening C C' (andI prf prf') = andI (weakening C C' prf) (weakening C C' prf')
  38. weakening C C' (andEL prf) = andEL (weakening C C' prf)
  39. weakening C C' (andER prf) = andER (weakening C C' prf)
  40. weakening C C' (orIL p'' prf) = orIL p'' (weakening C C' prf)
  41. weakening C C' (orIR p prf) = orIR p (weakening C C' prf)
  42. weakening C C' (orE prf prf₁ prf₂) = orE (weakening C C' prf) (weakening (_ ∷ C) C' prf₁) (weakening (_ ∷ C) C' prf₂)
  43. -- Should check fast now and report the ? as unsolved meta.