Skip to content

Commit

Permalink
[ subterm ] CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Nov 8, 2014
1 parent c21c624 commit bde2950
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG
Expand Up @@ -128,6 +128,45 @@ Type checking

See issues 1023, 1264, 1292.

Termination checking
====================

* The termination checker can now recognize simple subterms in dot
patterns.

data Subst : (d : Nat) → Set where
c₁ : ∀ {d} → Subst d → Subst d
c₂ : ∀ {d₁ d₂} → Subst d₁ → Subst d₂ → Subst (suc d₁ + d₂)

postulate
comp : ∀ {d₁ d₂} → Subst d₁ → Subst d₂ → Subst (d₁ + d₂)

lookup : ∀ d → Nat → Subst d → Set₁
lookup d zero (c₁ ρ) = Set
lookup d (suc v) (c₁ ρ) = lookup d v ρ
lookup .(suc d₁ + d₂) v (c₂ {d₁} {d₂} ρ σ) = lookup (d₁ + d₂) v (comp ρ σ)

The dot pattern here is actually normalized, so it is

suc (d₁ + d₂)

and the corresponding recursive call argument is (d₁ + d₂).
In such simple cases, Agda can now recognize that the pattern is
constructor applied to call argument, which is valid descent.

Note however, that Agda only looks for syntactic equality when
identifying subterms, since she is not allowed to normalize terms on
the rhs during termination checking.

Actually writing the dot pattern has no effect, this works as well,
and looks pretty magical... ;-)

hidden : ∀{d} → Nat → Subst d → Set₁
hidden zero (c₁ ρ) = Set
hidden (suc v) (c₁ ρ) = hidden v ρ
hidden v (c₂ ρ σ) = hidden v (comp ρ σ)


Bug fixes
=========

Expand Down

0 comments on commit bde2950

Please sign in to comment.