0
言語foo
からbar
に些細な翻訳である:Wellsortednessエラーが...ここでのソート等しくない
type_synonym vname = "string"
type_synonym 'a env = "vname ⇒ 'a option"
datatype foo_exp = FooBConst bool
datatype foo_type = FooBType | FooIType | FooSType
datatype bar_exp = BarBConst bool
datatype bar_type = BarBType | BarIType
fun foo_to_bar_type :: "foo_type ⇒ bar_type option" where
"foo_to_bar_type FooBType = Some BarBType" |
"foo_to_bar_type FooIType = Some BarIType" |
"foo_to_bar_type _ = None"
inductive foo_to_bar :: "foo_type env ⇒ foo_exp ⇒ bar_type env ⇒ bar_exp ⇒ bool" where
"Γ⇩B = map_comp foo_to_bar_type Γ⇩F ⟹
foo_to_bar Γ⇩F (FooBConst c) Γ⇩B (BarBConst c)"
code_pred [show_modes] foo_to_bar .
values "{t. foo_to_bar Map.empty (FooBConst True) Map.empty t}"
最後の行には、次のエラーが発生します。
Wellsortedness error
(in code equation foo_to_bar_i_i_i_o ?x ?xa ?xb ≡
Predicate.bind (Predicate.single (?x, ?xa, ?xb))
(λ(Γ⇩F_, aa, Γ⇩B_).
case aa of
FooBConst c_ ⇒
Predicate.bind (eq_i_i Γ⇩B_ (foo_to_bar_type ∘⇩m Γ⇩F_))
(λ(). Predicate.single (BarBConst c_))),
with dependency "Pure.dummy_pattern" -> "foo_to_bar_i_i_i_o"):
Type char list ⇒ bar_type option not of sort equal
No type arity list :: enum
あなたはどのように私を示唆でしたそれを修正するには?
また、foo_to_bar
のモードはi => i => o => o => boolpos
です。第3引数と第4引数の両方を生成するためにvalues
を実行するにはどうすればよいですか?