将Maude代码翻译成Coq

将Maude代码翻译成Coq,coq,Coq,我想把我以前写的Maude代码翻译成Coq,因为Coq的表达式比Maude更强大 我不知道如何表示以下代码: 如上所示,GuardPostfix有三个子部分:GuardPostfix1、GuardPostfix2和GuardPostfix3 我使用归纳类型来表示GCcomponent。但是,在定义类型GComponent时,GComponent1有两个构造函数,分别使用构造函数GuardPostfix1和GuardPostfix2 如何在Coq中定义这些类型?我认为一般的方法是将所有Maude

我想把我以前写的Maude代码翻译成Coq,因为Coq的表达式比Maude更强大

我不知道如何表示以下代码:

如上所示,GuardPostfix有三个子部分:GuardPostfix1GuardPostfix2GuardPostfix3

我使用归纳类型来表示GCcomponent。但是,在定义类型GComponent时,GComponent1有两个构造函数,分别使用构造函数GuardPostfix1GuardPostfix2


如何在Coq中定义这些类型?

我认为一般的方法是将所有Maude排序转换为Coq类型,并将Maude子排序关系表示为具有其所有子排序构造函数的超级排序(例如,
子排序A B
变为
定义C:=A+B
)。遵循这条一般规则,下面是我如何翻译您的示例的。请注意,我不了解Maude,所以可能是我遗漏了示例本身的一些内容。此外,我强烈建议使用一个新的归纳而不是泛型和类型(<代码> +/COD>),用于<代码> GuordPoxFix< /C>和Gbuts>代码>,但这取决于您。
Module GuardedComponent.

  Parameter BoolExp:Type.
  Parameter Assignment:Type.
  Parameter Program:Type.
  Parameter Index:Type.
  Parameter EndPoint:Type.
  Parameter Null:Type.
  Parameter EventGuard:Type.
  Parameter TimeControl:Type.

  Inductive AssignmentGuard :=
  | mkAssignmentGuard (_:BoolExp) (_:Assignment).

  Inductive GuardPostfix1 :=
  | mkGuardPostfix1 (_:Program) (_:Index).

  Inductive GuardPostfix2 :=
  | mkGuardPostfix2 (_:Program) (_:EndPoint).

  Inductive GuardPostfix3 :=
  | mkGuardPostfix3 (_:Program) (_:Null).

  Definition GuardPostfix : Type :=
    GuardPostfix1 + GuardPostfix2 + GuardPostfix3.

  Inductive GComponent1 :=
  | comp1_post1 (_:GuardPostfix1)
  | comp1_post2 (_:GuardPostfix2).

  Inductive GComponent2 :=
  | mkGComponent2 (_:EventGuard) (_:GuardPostfix3).

  Inductive GComponent3 :=
  | mkGComponent3 (_:TimeControl) (_:GuardPostfix3).

  Definition GComponent : Type :=
    GComponent1 + GComponent2 + GComponent3.

End GuardedComponent.

如果我定义的函数可能返回GComponent1、GComponent2或GComponent3的类型,我可以使用GComponent类型来表示不同的类型吗?是的,但您必须显式使用
inl(inl…
inl(inr…)
inr…
以便从子组件类型转换为
g组件