Skip to content

sizeOf generation failure on higher-order nested types #11828

@arthur-adjedj

Description

@arthur-adjedj

Prerequisites

Description

When defining certain kinds of nested inductive types, lean may throw a kernel error related to auxiliary theorems produced when generating the SizeOf instance.

Steps to Reproduce

inductive Higher (f : TypeType) (A : Type) where
  | c_higher : f A → Higher f A

inductive Bar where
  | bar : Higher List Bar → Bar

Expected behavior: No error

Actual behavior:

(kernel) application type mismatch
  Eq.trans (congrArg (Nat.add 1) (Bar._sizeOf_3_eq a✝))
    (Eq.symm (Higher.c_higher.sizeOf_spec List Bar (fun a => List._sizeOf_inst a) Bar._sizeOf_inst a✝))
argument has type
  1 + sizeOf a✝ = sizeOf (Higher.c_higher List Bar a✝)
but function has type
  Nat.add 1 (sizeOf a✝) = sizeOf (Higher.c_higher List Bar a✝) →
    Nat.add 1 (Bar._sizeOf_3 a✝) = sizeOf (Higher.c_higher List Bar a✝)

Versions

Lean 4.28.0-nightly-2025-12-28
Target: x86_64-unknown-linux-gnu

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions