如何处理模块导入中的循环依赖?

How to handle circular dependency in module import?

我有一个模块 Reflexive,它导入了一个模块 Irreflexive:

module Reflexive
open Irreflexive

Irreflexive 模块导入了 Reflexive 模块:

module Irreflexive
open Reflexive

导致此错误消息:

Circular dependency in module import.

我真的想要一个导入非自反模块的自反模块(自反关系的补集是非自反的)。

而且我确实想要一个导入自反模块的非自反模块(非自反关系的补语是自反的)。

有没有什么方法可以在不将所有内容合并到一个模块中的情况下处理这种循环依赖?

您的问题的一个直接解决方案是声明第三个模块,其中声明所有 predicates/functions/facts 同时需要自反和非自反概念(例如您提到的补语)。 然后,该模块可以在没有任何循环依赖的情况下打开自反和非自反模块。