(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(****************************************************************)
(*           The Calculus of Inductive Constructions            *)
(*                       COQ v5.10                              *)
(*                                                              *)
(* Laurent Arditi.  Laboratoire I3S. CNRS ura 1376.             *)
(* Universite de Nice - Sophia Antipolis                        *)
(* arditi@unice.fr, http://wwwi3s.unice.fr/~arditi/lolo.html    *)
(*                                                              *)
(* date: may 1995                                               *)
(* file: Bool_compl.v                                           *)
(* contents: additional lemmas about bool, definition of xor,   *)
(* bool_to_nat and if_then_else                                 *)
(****************************************************************)
Require Export Bool.
simple induction a; simple induction b; auto.
Qed. Hint Resolve neg_eq.
auto.
Qed.
auto.
Qed.
Definition xorb (b1 b2 : bool) : bool := b1 && negb b2 || negb b1 && b2.
simple induction b; auto.
Qed. Hint Resolve xorb_b_b.
simple induction b; auto.
Qed. Hint Resolve xorb_b_false.
simple induction b; auto.
Qed. Hint Resolve xorb_b_true.
(****************************************************************)
Definition bool_to_nat (b : bool) :=
match b with
| true => 1
| false => 0
end.
simple induction b; auto.
Qed. Hint Resolve bool_to_nat_all.
(* Lemma bool_to_nat_negb : (b:bool) (bool_to_nat (negb b))=(minus (S O) (bool_to_nat b)). Induction b;Auto. Qed. Hints Resolve bool_to_nat_negb. *)
(****************************************************************)
(* Conditionnelle polymorphique: le test est un booleen,        *)
(* les clauses d'un type quelconque (le meme pour les 2 clauses *)
Definition If (T : Set) (b : bool) (x y : T) :=
match b with
| true => x
| false => y
end.
simple induction b; simpl in |- *; trivial.
Qed. Hint Resolve If_neg.
simple induction b; simpl in |- *; trivial.
Qed. Hint Resolve If_eq.
simple induction b2; auto.
Qed.
unfold not in |- *. simple induction a; auto.
Qed.
unfold not in |- *. simple induction a. simpl in |- *. intros. absurd (x = y). auto.
exact H0. auto.
Qed.

Lemma F_If :
forall (T T' : Set) (a : bool) (x y : T) (F : T -> T'),
F (If T a x y) = If T' a (F x) (F y).