(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
Require Export Stdlib.Init.Byte.
Local Set Implicit Arguments.
Definition eqb (a b : byte) : bool
:= let '(a0, (a1, (a2, (a3, (a4, (a5, (a6, a7))))))) := to_bits a in
let '(b0, (b1, (b2, (b3, (b4, (b5, (b6, b7))))))) := to_bits b in
(Bool.eqb a0 b0 && Bool.eqb a1 b1 && Bool.eqb a2 b2 && Bool.eqb a3 b3 &&
Bool.eqb a4 b4 && Bool.eqb a5 b5 && Bool.eqb a6 b6 && Bool.eqb a7 b7)%bool.
Module Export ByteNotations.
Export ByteSyntaxNotations.
Infix "=?" := eqb (at level 70) : byte_scope.
End ByteNotations.

(* Specifications: *)
Lemma byte_dec_lb x y : x = y -> eqb x y = true.
Lemma eqb_false x y : eqb x y = false -> x <> y.
Lemma to_of_nat_iff x y : of_nat x = Some y <-> to_nat y = x.
Lemma to_nat_bounded x : to_nat x <= 255.
Lemma of_nat_None_iff x : of_nat x = None <-> 255 < x.
End nat.