Skip to content

subtyping inductive sized types #2411

@bixuanzju

Description

@bixuanzju

I was playing around Datatype a la carte with sized types in Agda, and came across this problem (bug?) in subtyping sized types:

open import Size

data NatF (a : Set) : Set where
  zeroF : NatF a
  succF : a  NatF a

{-# NO_POSITIVITY_CHECK #-}
data μ {i : Size} (F : Set  Set) : Set where
  In : {j : Size< i}  F (μ {j} F)  μ {i} F

pred' :  {i}  μ {i} NatF  μ {i} NatF
pred' (In zeroF) = In zeroF
pred' (In (succF x)) = {!cannot type check with x!}

However the following will type check

data Nat {i : Size}  : Set where
  In : {j : Size< i}  NatF (Nat {j})  Nat {i}

pred :  {i}  Nat {i}  Nat {i}
pred (In zeroF) = In zeroF
pred (In (succF x)) = x

Any pointers would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    polaritypositivityPositivity checking for data-type definitionssized typesSized types, termination checking with sized types, size inferencesubtypingIssues relating to subtyping.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions