agda / agda

Agda is a dependently typed programming language / interactive theorem prover.

Home Page:https://wiki.portal.chalmers.se/agda/pmwiki.php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

--type-based-termination: --size-preservation analysis comes too late for nested functions

andreasabel opened this issue · comments

With nest : forall i -> Nat i -> Nat i the nest function termination checks, but the size preservation analysis seems to come too late to certify termination of nest:

{-# OPTIONS --type-based-termination #-}
{-# OPTIONS --no-syntax-based-termination #-}
{-# OPTIONS --size-preservation #-}

{-# OPTIONS -v term.tbt:50 #-}

data Nat : Set where  -- ∀[∞]. ⁺t₀
  zero : Nat          -- ∀[∞]. ⁺t₀
  suc : Nat  Nat     -- ∀[<1, ∞]. ⁺t₀ → ⁺t₁

nest : Nat  Nat      -- ∀[∞]. ⁺t₀ → ⁺∞
nest zero = zero
nest (suc x) = nest (nest x)

-- Signature of nest after size-preservation inference:
--   ∀[∞]. ⁺t₀ → ⁺t₀

Termination checking failed for the following functions:
nest
Problematic calls:
nest (nest x)

RFC: @knisht