声明相互递归类型

Declare mutually recursive types

我有以下两种相互递归的类型(它们有指向彼此的指针):

vtypedef SimpleTextOutputInterface =
   @{ reset = EfiTextReset
    , output_string = [l:addr] (EfiTextString@l | ptr l)
    }

vtypedef EfiTextString = [n:nat][l1,l2:addr] (SimpleTextOutputInterface@l1, @[uint16][n]@l2 | ptr l1, ptr l2) -> uint64

我试过像这样声明一个抽象类型:

absvt@ype SimpleTextOutputInterface

vtypedef EfiTextString = [n:nat][l1,l2:addr] (SimpleTextOutputInterface@l1, @[uint16][n]@l2 | ptr l1, ptr l2) -> uint64

assume SimpleTextOutputInterface =
   @{ reset = EfiTextReset
    , output_string = [l:addr] (EfiTextString@l | ptr l)
    }

但是当我尝试使用它们时遇到了类型错误(好像某处丢失了视图)。

有没有办法让它工作? 如果 ATS 中存在前向声明,可能会有前向声明?

我的"standard"方法是引入一个虚拟函数和一些相关的证明函数:

abst@ype SimpleTextOutputInterface_

prfun encode :
{l:addr} SimpleTextOutputInterface @l -> SimpleTextOutputInterface_@l
prfun decode :
{l:addr} SimpleTextOutputInterface_@l -> SimpleTextOutputInterface @l