aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYishuai Li2020-09-24 03:41:37 -0400
committerYishuai Li2020-12-03 13:06:20 -0500
commitaab8634bcda7829004c369644e9d4600692913f0 (patch)
treeab2bc06ce37fb6d1075cf37a412b4117f9fb2a69
parentafbc39d8c4f24e2e8ccda0fcb861fb947f3f4c71 (diff)
Ascii: add leb and ltb
-rw-r--r--doc/changelog/10-standard-library/13080-ascii.rst4
-rw-r--r--theories/Strings/Ascii.v8
2 files changed, 12 insertions, 0 deletions
diff --git a/doc/changelog/10-standard-library/13080-ascii.rst b/doc/changelog/10-standard-library/13080-ascii.rst
new file mode 100644
index 0000000000..167002283e
--- /dev/null
+++ b/doc/changelog/10-standard-library/13080-ascii.rst
@@ -0,0 +1,4 @@
+- **Added:**
+ ``leb`` and ``ltb`` functions for ``ascii``
+ (`#13080 <https://github.com/coq/coq/pull/13080>`_,
+ by Yishuai Li).
diff --git a/theories/Strings/Ascii.v b/theories/Strings/Ascii.v
index 06b02ab211..37d30a282c 100644
--- a/theories/Strings/Ascii.v
+++ b/theories/Strings/Ascii.v
@@ -173,6 +173,14 @@ Proof.
apply N_ascii_bounded.
Qed.
+Definition ltb (a b : ascii) : bool :=
+ (N_of_ascii a <? N_of_ascii b)%N.
+
+Definition leb (a b : ascii) : bool :=
+ (N_of_ascii a <=? N_of_ascii b)%N.
+
+Infix "<?" := ltb : char_scope.
+Infix "<=?" := leb : char_scope.
(** * Concrete syntax *)