Commit 8f71eaa0 by MARCHE Claude

### proof of binary heaps completed !

`. but need further cleaning`
parent 3a5f3de8
 ... ... @@ -66,6 +66,26 @@ axiom Card_union: forall x y: bag 'a. card (union x y) = (card x) + (card y) axiom Card_zero_empty : forall x: bag 'a. card (x) = 0 -> x = empty_bag (* bag difference *) use import int.MinMax function diff (bag 'a) (bag 'a) : bag 'a axiom Diff_occ: forall b1 b2:bag 'a, x:'a. nb_occ x (diff b1 b2) = max 0 (nb_occ x b1 - nb_occ x b2) lemma Diff_empty_right: forall b:bag 'a. diff b empty_bag = b lemma Diff_empty_left: forall b:bag 'a. diff empty_bag b = empty_bag lemma Diff_add: forall b:bag 'a, x:'a. diff (add x b) (singleton x) = b lemma Diff_comm: forall b b1 b2:bag 'a. diff (diff b b1) b2 = diff (diff b b2) b1 lemma Add_diff: forall b:bag 'a, x:'a. nb_occ x b > 0 -> add x (diff b (singleton x)) = b end (* ... ...
 ... ... @@ -3,8 +3,7 @@ theory Bag_integers (* minimum element of a bag of integers *) use import int.Int clone import comparison.MinMax with type t = int, predicate ge = Int.(>=) use import int.MinMax use export bag.Bag function min_bag (bag int) : int ... ...
 ... ... @@ -2,7 +2,7 @@ theory Elements use import int.Int use import bag.Bag use map.Map as A use import map.Map as A type array 'a = A.map int 'a ... ... @@ -29,24 +29,28 @@ lemma Elements_union2 : forall a:array 'a, i j :int. i < j -> (elements a i j) = (add (A.get a (j-1)) (elements a i (j-1))) lemma Elements_remove_last: forall a:array 'a, i j :int. i < j-1 -> (elements a i (j-1)) = diff (elements a i j) (singleton (A.get a (j-1))) lemma Occ_elements: forall a:array 'a, i j n:int. i <= j < n -> nb_occ a[j] (elements a i n) > 0 lemma Elements_set_outside : forall a:array 'a, i j:int. i <= j -> forall k : int. (k < i || k >= j) -> forall e:'a. (elements (A.set a k e) i j) = (elements a i j) lemma Elements_union3 : forall a:array 'a, i j:int, e:'a. i <= j -> (add e (elements a i j)) = (elements (A.set a j e) i (j+1)) lemma Elements_set2 : forall a:array 'a, i j k:int. i <= k < j -> forall e:'a. (add (A.get a k) (elements (A.set a k e) i j)) = (add e (elements a i j)) lemma Elements_set_inside : forall a:array 'a, i j n: int, e:'a, b:bag 'a. i <= j < n -> (elements a i n) = add (A.get a j) b -> (elements (A.set a j e) i n) = add e b lemma Elements_set_inside2 : forall a:array 'a, i j n: int, e:'a. i <= j < n -> elements (A.set a j e) i n = add e (diff (elements a i n) (singleton (a[j]))) end (* ... ...