coqlogical-foundations

Mix-up of bool and Datatypes.bool after Require Import Omega


I'm going through software foundations and ran into an error.

ERROR : The term "true" has type "bool" while it is expected to have type "Datatypes.bool"

for the proof below.

Theorem beq_nat_true : forall n m,
  beq_nat n m = true -> n = m.

I found out that this is happening when I use Require Import Omega.
Any tips, suggestions or explanations of what Omega introduces into the environment?


Solution

  • The Omega module indirectly imports many definitions of the standard library that manipulate natural numbers, some of which end up shadowing parts of Software Foundations. The beq_nat function is one of them. The problem arises because the version of the standard library for beq_nat returns standard booleans, whereas the one of SF returns its redefined booleans.

    We noticed this problem a while ago, and have already fixed it in the current version. If you don't want to redownload everything (or if you have imported Omega yourself), you can also just qualify beq_nat to use the right version. My guess is that Basics.beq_nat should work.