字符串和Ascii的Coq导入问题

时间:2019-05-01 08:24:29

标签: import coq

我正在尝试在Coq中编写一个简单的strchr函数,然后将其导出到 哈斯克尔。我遇到的导入问题可能与this post(?)相似,但似乎无法解决。这是我的验证码:

(***********)
(* IMPORTS *)
(***********)
Require Import Coq.Arith.PeanoNat.
Require Import Coq.Lists.List.
Require Import Coq.Strings.String.
Require Import Coq.Strings.Ascii. 

(**********)
(* strchr *)
(**********)
Fixpoint strchr (haystack : string) (needle : ascii) : string :=
  match haystack with
  | EmptyString => EmptyString
  | String c s' => match (Ascii.eqb needle c) with
                   | true => s
                   | false => strchr s' needle
                   end
  end.

(********************************)
(* Extraction Language: Haskell *)
(********************************)
Extraction Language Haskell.

(***************************)
(* Extract to Haskell file *)
(***************************)
Extraction "/home/oren/GIT/kMemLoops/strchr.hs" strchr.

这是我得到的错误:

Error: The reference Ascii.eqb was not found in the current environment.

1 个答案:

答案 0 :(得分:2)

eqb已添加about a year ago,并且仅是coq 8.9+的一部分。您碰巧有旧版本吗?