尽管导入了 Arith,但“_/_”的未知解释
Unknown Interpretation for "_/_" despite importing Arith
我试图编写一个函数将 nat
转换为 coq
中的 string
。这是我的尝试。
Require Import Arith String.
(*
append is part of the string library. Its signature is
(s1 : string) : string -> string
*)
Fixpoint convert_nat_to_string (n : nat) : string :=
match n with
| 0 => String "0" EmptyString
| 1 => String "1" EmptyString
| 2 => String "2" EmptyString
| 3 => String "3" EmptyString
| 4 => String "4" EmptyString
| 5 => String "5" EmptyString
| 6 => String "6" EmptyString
| 7 => String "7" EmptyString
| 8 => String "8" EmptyString
| 9 => String "9" EmptyString
| _ => (append (convert_nat_to_string (n/10))) (convert_nat_to_string (n mod 10))
end.
然而,在最后一个分支上,coqide
给我一个错误
Error: Unknown interpretation for notation "_ / _".
尽管我已经导入了 Arith
库。有谁知道我为什么会收到此错误消息?
证明 /
是 Arith
的一部分:
Coq < Require Import Arith.
[Loading ML file z_syntax_plugin.cmxs ... done]
[Loading ML file quote_plugin.cmxs ... done]
[Loading ML file newring_plugin.cmxs ... done]
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
Coq < Check 5/10.
5 / 10
: nat
从 Coq 8.6 开始,此函数在 Coq.Arith.PeanoNat
中可用。
Require Import Coq.Arith.PeanoNat.
Check 10 / 5. (* --> 10 / 5 : nat *)
我试图编写一个函数将 nat
转换为 coq
中的 string
。这是我的尝试。
Require Import Arith String.
(*
append is part of the string library. Its signature is
(s1 : string) : string -> string
*)
Fixpoint convert_nat_to_string (n : nat) : string :=
match n with
| 0 => String "0" EmptyString
| 1 => String "1" EmptyString
| 2 => String "2" EmptyString
| 3 => String "3" EmptyString
| 4 => String "4" EmptyString
| 5 => String "5" EmptyString
| 6 => String "6" EmptyString
| 7 => String "7" EmptyString
| 8 => String "8" EmptyString
| 9 => String "9" EmptyString
| _ => (append (convert_nat_to_string (n/10))) (convert_nat_to_string (n mod 10))
end.
然而,在最后一个分支上,coqide
给我一个错误
Error: Unknown interpretation for notation "_ / _".
尽管我已经导入了 Arith
库。有谁知道我为什么会收到此错误消息?
证明 /
是 Arith
的一部分:
Coq < Require Import Arith.
[Loading ML file z_syntax_plugin.cmxs ... done]
[Loading ML file quote_plugin.cmxs ... done]
[Loading ML file newring_plugin.cmxs ... done]
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
<W> Grammar extension: in [tactic:simple_tactic], some rule has been masked
Coq < Check 5/10.
5 / 10
: nat
从 Coq 8.6 开始,此函数在 Coq.Arith.PeanoNat
中可用。
Require Import Coq.Arith.PeanoNat.
Check 10 / 5. (* --> 10 / 5 : nat *)