(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \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)         *)
(************************************************************************)
(** The type [bool] is defined in the prelude as [Inductive bool : Set := true : bool | false : bool] *)
(** Most of the lemmas in this file are trivial after breaking all booleans *)
Ltac destr_bool :=
intros; destruct_all bool; simpl in *; trivial; try discriminate.
(** Interpretation of booleans as propositions *)
Definition Is_true (b:bool) :=
match b with
| true => True
| false => False
end.
(*******************)
(** * Decidability *)
(*******************)
Hint Resolve diff_true_false : bool.
Hint Resolve diff_false_true : bool.
Hint Extern 1 (false <> true) => exact diff_false_true : core.
(**********************)
(** * Order on booleans *)
(**********************)
Definition leb (b1 b2:bool) :=
match b1 with
| true => b2 = true
| false => True
end.
Hint Unfold leb: bool.
(* Infix "<=" := leb : bool_scope. *)
(*************)
(** * Equality *)
(*************)
Definition eqb (b1 b2:bool) : bool :=
match b1, b2 with
| true, true => true
| true, false => false
| false, true => false
| false, false => true
end.
(************************)
(** * A synonym of [if] on [bool] *)
(************************)
Definition ifb (b1 b2 b3:bool) : bool :=
match b1 with
| true => b2
| false => b3
end.
Open Scope bool_scope.
(****************************)
(** * De Morgan laws          *)
(****************************)
(********************************)
(** * Properties of [negb]    *)
(********************************)
Notation negb_elim := negb_involutive (only parsing).
Notation negb_intro := negb_involutive_reverse (only parsing).
(********************************)
(** * Properties of [orb]     *)
(********************************)
Hint Resolve orb_true_intro: bool.
Hint Resolve orb_false_intro: bool.
(** [true] is a zero for [orb] *)
Hint Resolve orb_true_r: bool.
Notation orb_b_true := orb_true_r (only parsing).
Notation orb_true_b := orb_true_l (only parsing).
(** [false] is neutral for [orb] *)
Hint Resolve orb_false_r: bool.
Hint Resolve orb_false_l: bool.
Notation orb_b_false := orb_false_r (only parsing).
Notation orb_false_b := orb_false_l (only parsing).
(** Complementation *)
Hint Resolve orb_negb_r: bool.
Notation orb_neg_b := orb_negb_r (only parsing).
(** Commutativity *)
(** Associativity *)
Hint Resolve orb_comm orb_assoc: bool.
(*******************************)
(** * Properties of [andb]     *)
(*******************************)
(** [false] is a zero for [andb] *)
Notation andb_b_false := andb_false_r (only parsing).
Notation andb_false_b := andb_false_l (only parsing).
(** [true] is neutral for [andb] *)

Lemma andb_true_r : forall b:bool, b && true = b.