update coq proofs for name changes in Map and Array

(sorry for not doing it earlier)
This commit is contained in:
Andrei Paskevich
2011-06-03 14:05:59 +02:00
parent 7ea7e37d30
commit 322d901cee
3 changed files with 116 additions and 118 deletions

View File

@@ -4,13 +4,9 @@ Require Import ZArith.
Require Import Rbase.
Definition unit := unit.
Parameter ignore: forall (a:Type), a -> unit.
Parameter label : Type.
Implicit Arguments ignore.
Parameter label_ : Type.
Parameter at1: forall (a:Type), a -> label_ -> a.
Parameter at1: forall (a:Type), a -> label -> a.
Implicit Arguments at1.
@@ -30,22 +26,21 @@ Implicit Arguments contents.
Parameter map : forall (a:Type) (b:Type), Type.
Parameter mixfix_lbrb: forall (a:Type) (b:Type), (map a b) -> a -> b.
Parameter get: forall (a:Type) (b:Type), (map a b) -> a -> b.
Implicit Arguments mixfix_lbrb.
Implicit Arguments get.
Parameter mixfix_lblsmnrb: forall (a:Type) (b:Type), (map a b) -> a -> b ->
(map a b).
Parameter set: forall (a:Type) (b:Type), (map a b) -> a -> b -> (map a b).
Implicit Arguments mixfix_lblsmnrb.
Implicit Arguments set.
Axiom Select_eq : forall (a:Type) (b:Type), forall (m:(map a b)),
forall (a1:a) (a2:a), forall (b1:b), (a1 = a2) ->
((mixfix_lbrb (mixfix_lblsmnrb m a1 b1) a2) = b1).
forall (a1:a) (a2:a), forall (b1:b), (a1 = a2) -> ((get (set m a1 b1)
a2) = b1).
Axiom Select_neq : forall (a:Type) (b:Type), forall (m:(map a b)),
forall (a1:a) (a2:a), forall (b1:b), (~ (a1 = a2)) ->
((mixfix_lbrb (mixfix_lblsmnrb m a1 b1) a2) = (mixfix_lbrb m a2)).
forall (a1:a) (a2:a), forall (b1:b), (~ (a1 = a2)) -> ((get (set m a1 b1)
a2) = (get m a2)).
Parameter const: forall (b:Type) (a:Type), b -> (map a b).
@@ -53,8 +48,8 @@ Set Contextual Implicit.
Implicit Arguments const.
Unset Contextual Implicit.
Axiom Const : forall (b:Type) (a:Type), forall (b1:b) (a1:a),
((mixfix_lbrb (const(b1):(map a b)) a1) = b1).
Axiom Const : forall (b:Type) (a:Type), forall (b1:b) (a1:a), ((get (const(
b1):(map a b)) a1) = b1).
Inductive array (a:Type) :=
| mk_array : Z -> (map Z a) -> array a.
@@ -72,24 +67,22 @@ Definition length (a:Type)(u:(array a)): Z :=
end.
Implicit Arguments length.
Definition mixfix_lbrb1 (a:Type)(a1:(array a)) (i:Z): a :=
(mixfix_lbrb (elts a1) i).
Implicit Arguments mixfix_lbrb1.
Definition get1 (a:Type)(a1:(array a)) (i:Z): a := (get (elts a1) i).
Implicit Arguments get1.
Definition mixfix_lblsmnrb1 (a:Type)(a1:(array a)) (i:Z) (v:a): (array a) :=
Definition set1 (a:Type)(a1:(array a)) (i:Z) (v:a): (array a) :=
match a1 with
| mk_array xcl0 _ => (mk_array xcl0 (mixfix_lblsmnrb (elts a1) i v))
| mk_array xcl0 _ => (mk_array xcl0 (set (elts a1) i v))
end.
Implicit Arguments mixfix_lblsmnrb1.
Implicit Arguments set1.
Definition decrease1(a:(array Z)): Prop := forall (i:Z), ((0%Z <= i)%Z /\
(i < ((length a) - 1%Z)%Z)%Z) -> (((mixfix_lbrb1 a
i) - 1%Z)%Z <= (mixfix_lbrb1 a (i + 1%Z)%Z))%Z.
(i < ((length a) - 1%Z)%Z)%Z) -> (((get1 a i) - 1%Z)%Z <= (get1 a
(i + 1%Z)%Z))%Z.
Theorem decrease1_induction : forall (a:(array Z)), (decrease1 a) ->
forall (i:Z) (j:Z), (((0%Z <= i)%Z /\ (i <= j)%Z) /\
(j < (length a))%Z) -> ((((mixfix_lbrb1 a
i) + i)%Z - j)%Z <= (mixfix_lbrb1 a j))%Z.
(j < (length a))%Z) -> ((((get1 a i) + i)%Z - j)%Z <= (get1 a j))%Z.
(* YOU MAY EDIT THE PROOF BELOW *)
unfold decrease1.
intros a Ha i j Hij.
@@ -102,11 +95,11 @@ destruct H4.
subst x.
ring_simplify.
omega.
apply Zle_trans with (mixfix_lbrb1 a (x-1) - 1)%Z.
apply Zle_trans with (get1 a (x-1) - 1)%Z.
assert (i <= x-1 < x)%Z by omega.
assert (0 <= i <= x-1 /\ x-1 < length a)%Z by omega.
generalize (H (x-1)%Z H8 H9); clear H; intuition.
apply Zle_trans with (mixfix_lbrb1 a (x-1+1))%Z.
apply Zle_trans with (get1 a (x-1+1))%Z.
apply (Ha (x-1)%Z); omega.
ring_simplify (x-1+1)%Z.
omega.