【发布时间】:2014-03-30 09:51:29
【问题描述】:
Coq - IP 表示法
我想为 IP 地址创建一个符号。以下是我的符号定义,可以正常工作:
Inductive IP := ip : nat -> nat -> nat -> nat -> IP.
Notation "a . b . c . d" := (ip a b c d) (at level 100).
但是当我尝试使用它时,
Definition ex := ( 192 . 168 . 1 . 1 ).
我收到以下错误:
Syntax error: [constr:operconstr level 200] expected after "." (in [constr:operconstr]).
我必须进行哪些更改才能修复此错误。
【问题讨论】:
-
我不是 100% 确定,但我认为您不能在符号中使用 ''.''。我尝试使用 Notation "(a 'foo' b 'foo' c 'foo' d )" := (ip a b c d) (在 100 级)。定义 ex := (192 foo 168 foo 1 foo 1)。 (注意额外的括号)并且它有效,但与 ''.'' 相同也失败了。您可能必须声明一个新范围或其他内容。