在 Agda 中为假设添加定义

Adding Definitions to Postulates in Agda

从仅将类型定义为假设的 Agda 模块开始

module M where 
  postulate 
   U : Set 

我希望能够以不同的方式定义 U。例如:

module B where 
  open M public 
  -- define U as Bool 

module N where 
  open M public 
  -- define U as Nat 

有没有办法在 Agda 中做到这一点?

据我所知,你不能,假设是抽象的。

你可以通过颠倒顺序来实现你想要的:而不是像你那样试图在 module BN 中定义 U,而是

module M (U : Set) where

然后将 U 实例化为 BoolNat