diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e8738104c0b1c1f0563597583d5a5f58e8a3608..3b982a91577e991bd11ea24c5253178d5777c1ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ API-breaking change is listed. exported by the prelude. This is a breaking change if one only imports `list.v`, but not the prelude. - Rename `drop_insert` into `drop_insert_gt` and add `drop_insert_le`. -- Added `Countable` instance for `Ascii.ascii`. +- Added `Countable` instances for `Ascii.ascii` and `Byte.byte` from the Coq + standard library. - Make lemma `list_find_Some` more apply friendly. ## std++ 1.3 (released 2020-03-18) diff --git a/theories/strings.v b/theories/strings.v index a9f2bcc535f3bcdb87833ddf0e7f0b71ca19c7a3..0f94448efc84df0368b164111525d636e857a6fd 100644 --- a/theories/strings.v +++ b/theories/strings.v @@ -1,4 +1,5 @@ From Coq Require Import Ascii. +From Coq Require Import Init.Byte. From Coq Require Export String. From stdpp Require Export list. From stdpp Require Import countable. @@ -18,6 +19,7 @@ Arguments String.append : simpl never. (** * Decision of equality *) Instance ascii_eq_dec : EqDecision ascii := ascii_dec. +Instance byte_eq_dec : EqDecision byte := Byte.byte_eq_dec. Instance string_eq_dec : EqDecision string. Proof. solve_decision. Defined. Instance string_app_inj : Inj (=) (=) (String.append s1). @@ -119,3 +121,5 @@ Lemma ascii_of_to_digits a : ascii_of_digits (ascii_to_digits a) = a. Proof. by destruct a as [[][][][][][][][]]. Qed. Instance ascii_countable : Countable ascii := inj_countable' ascii_to_digits ascii_of_digits ascii_of_to_digits. +Instance byte_countable : Countable byte := + inj_countable Byte.to_N Byte.of_N Byte.of_to_N.