summaryrefslogtreecommitdiff
path: root/test-suite/success/fix.v
blob: 374029bba9a1eb02e2073fa2090a195213cb56c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)
(* Ancien bug signale par Laurent Thery sur la condition de garde *)

Require Import Bool.
Require Import ZArith.

Definition rNat := positive.

Inductive rBoolOp: Set :=
     rAnd: rBoolOp
    | rEq: rBoolOp .

Definition rlt: rNat -> rNat ->Prop := [a, b:rNat](compare a b EGAL)=INFERIEUR.

Definition rltDec: (m, n:rNat){(rlt m n)}+{(rlt n m) \/ m=n}.
Intros n m; Generalize (compare_convert_INFERIEUR n m);
 Generalize (compare_convert_SUPERIEUR n m);
 Generalize (compare_convert_EGAL n m); Case (compare n m EGAL).
Intros H' H'0 H'1; Right; Right; Auto.
Intros H' H'0 H'1; Left; Unfold rlt.
Apply convert_compare_INFERIEUR; Auto.
Intros H' H'0 H'1; Right; Left; Unfold rlt.
Apply convert_compare_INFERIEUR; Auto.
Apply H'0; Auto.
Defined.


Definition rmax: rNat -> rNat ->rNat.
Intros n m; Case (rltDec n m); Intros Rlt0.
Exact m.
Exact n.
Defined.

Inductive rExpr: Set :=
     rV: rNat ->rExpr
    | rN: rExpr ->rExpr
    | rNode: rBoolOp -> rExpr -> rExpr ->rExpr .

Fixpoint maxVar[e:rExpr]: rNat :=
   Cases e of
       (rV n) => n
      | (rN p) => (maxVar p)
      | (rNode n p q) => (rmax (maxVar p) (maxVar q))
   end.