diff --git a/tests/length.ref b/tests/length.ref new file mode 100644 index 0000000000000000000000000000000000000000..ea57d31f65d6edc1ce466afdecd1ecd7127477ea --- /dev/null +++ b/tests/length.ref @@ -0,0 +1,18 @@ +length : ∀ A : Type, list A → nat + +length is not universe polymorphic +Arguments length {A}%type_scope _%list_scope +length is transparent +Expands to: Constant Coq.Init.Datatypes.length +length : ∀ A : Type, list A → nat + +length is not universe polymorphic +Arguments length {A}%type_scope _%list_scope +length is transparent +Expands to: Constant Coq.Init.Datatypes.length +length : ∀ A : Type, list A → nat + +length is not universe polymorphic +Arguments length {A}%type_scope _%list_scope +length is transparent +Expands to: Constant Coq.Init.Datatypes.length diff --git a/tests/length.v b/tests/length.v new file mode 100644 index 0000000000000000000000000000000000000000..e32ccb2388504f841d3e2d9792294c357bcb0816 --- /dev/null +++ b/tests/length.v @@ -0,0 +1,7 @@ +(** Check that we always get the [length] function on lists, not on strings. *) +From stdpp Require Import prelude. +About length. +From stdpp Require Import strings. +About length. +From stdpp Require Import prelude. +About length. \ No newline at end of file diff --git a/theories/base.v b/theories/base.v index b76f16a28083e3f570ddf870af8cba9e33fa557b..25c52422cbdb63e615545170d3327375acfe7899 100644 --- a/theories/base.v +++ b/theories/base.v @@ -3,7 +3,12 @@ that are used throughout the whole development. Most importantly it contains abstract interfaces for ordered structures, sets, and various other data structures. *) -From Coq Require Export Morphisms RelationClasses List Bool Utf8 Setoid. +(** The order of this [Require Export] is important: The definition of [length] +in [List] should shadow the definition of [length] in [String]. We also need +to export [Datatypes] because [List] contains a [parsing only] notation for +[length], not the actual definition of [length], which is in [Datatypes]. *) +From Coq Require Export String Datatypes List. +From Coq Require Export Morphisms RelationClasses Bool Utf8 Setoid. From Coq Require Import Permutation. Set Default Proof Using "Type". Export ListNotations. diff --git a/theories/strings.v b/theories/strings.v index f83f075b172b0e9483097059351e782e71fa5b48..475603cdae6763b386a627d28abad219f294c56d 100644 --- a/theories/strings.v +++ b/theories/strings.v @@ -1,13 +1,8 @@ From Coq Require Import Ascii. -From Coq Require Export String. From stdpp Require Export list. From stdpp Require Import countable. Set Default Proof Using "Type". -(* To avoid randomly ending up with String.length because this module is -imported hereditarily somewhere. *) -Notation length := List.length. - (** * Fix scopes *) Open Scope string_scope. (* Make sure [list_scope] has priority over [string_scope], so that