1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(* Certification of Imperative Programs / Jean-Christophe Filli�tre *)
11
(* $Id: ProgBool.v 5920 2004-07-16 20:01:26Z herbelin $ *)
13
Require Import ZArith.
14
Require Export Bool_nat.
15
Require Export Sumbool.
17
Definition annot_bool :
18
forall b:bool, {b' : bool | if b' then b = true else b = false}.
21
exists b. case b; trivial.
25
(* Logical connectives *)
27
Definition spec_and (A B C D:Prop) (b:bool) := if b then A /\ C else B \/ D.
29
Definition prog_bool_and :
30
forall Q1 Q2:bool -> Prop,
33
{b : bool | if b then Q1 true /\ Q2 true else Q1 false \/ Q2 false}.
36
elim H1. intro b1. elim H2. intro b2.
37
case b1; case b2; intros.
39
exists false; auto. exists false; auto. exists false; auto.
42
Definition spec_or (A B C D:Prop) (b:bool) := if b then A \/ C else B /\ D.
44
Definition prog_bool_or :
45
forall Q1 Q2:bool -> Prop,
48
{b : bool | if b then Q1 true \/ Q2 true else Q1 false /\ Q2 false}.
51
elim H1. intro b1. elim H2. intro b2.
52
case b1; case b2; intros.
53
exists true; auto. exists true; auto. exists true; auto.
57
Definition spec_not (A B:Prop) (b:bool) := if b then B else A.
59
Definition prog_bool_not :
60
forall Q:bool -> Prop, sig Q -> {b : bool | if b then Q false else Q true}.
65
exists false; auto. exists true; auto.