简体   繁体   中英

Coq, true datatype

So I have this problem:

In environment n: nat The term "true" has type "Datatypes.bool" while it is expected to have type "bool".

I have no idea what does it mean. trying to prove: Theorem eqb_0_l: forall n:nat, 0 =? n = true -> n = 0.

I guess you are working with Software Foundations - which has at least in the introductory chapters its own definition of bool. If you Require modules from both, Software Foundations and the Coq standard library, you easily end up with multiple definitions of bool, nat, ... .

The solution is to not Require anything from the Coq standard library in the introductory chapters from Software Foundations. Only Require modules which come with SF.

SF does this so because it explains how to define nat and bool and how to prove basic lemmas about these taypes. This can't be done without actually defining them, which leads to the mentioned problems.

I think all you need to do is define bool:

Inductive bool : Type :=
  | true
  | false.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM