Commit d580f4f6 by Jakob Botsch Nielsen

### Some preliminary work on proving LocalBlockchain is a chain

parent ed136fc6
 From Coq Require Import ZArith. From Coq Require Import Arith ZArith. From Coq Require Import List. From Coq Require Import PeanoNat. From Coq Require Import Psatz. From Coq Require Import Permutation. From SmartContracts Require Import Oak. ... ... @@ -309,7 +308,7 @@ Section Transfer. outgoing_txs post from = tx :: outgoing_txs pre from. Record TransferBase : Prop := build_transfer { build_transfer_base { amount_nonnegative : amount >= 0; head_block_post : head_block post = head_block pre; account_balance_pre_from_enough : account_balance pre from >= amount; ... ...
 ... ... @@ -217,18 +217,15 @@ Module BoundedN. Global Instance BoundedNCountable {bound : N} : Countable (BoundedN bound). Proof. refine {| encode n := encode (proj1_sig n); decode n := do n' <- (decode n : option N); _; |}. Unshelve. all: cycle 1. - destruct (N_lt_dec n' bound). + exact (Some (exist _ n' l)). + exact None. - intros [x lt]. rewrite decode_encode. simpl. destruct (N_lt_dec x bound). + assert (lt = l) by (apply UIP_dec; decide equality). now subst. + tauto. decode n := of_N =<< decode n; |}. intros [x lt]. rewrite decode_encode. simpl. unfold of_N. destruct (BoundedN.N_lt_dec x bound). - assert (lt = l) by (apply UIP_dec; decide equality). congruence. - tauto. Qed. End Stdpp. ... ...
 ... ... @@ -22,17 +22,44 @@ Module FMap. Notation elements := fin_maps.map_to_list. Notation size := stdpp.base.size. Notation of_list := fin_maps.list_to_map. Notation union := stdpp.base.union. Proposition of_elements_eq {A B : Type} `{countable.Countable A} (m : FMap A B) : of_list (elements m) = m. Proof. apply fin_maps.list_to_map_to_list. Qed. Section Theories. Context {K V : Type} `{countable.Countable K}. Proposition of_elements_eq (m : FMap K V) : of_list (elements m) = m. Proof. apply fin_maps.list_to_map_to_list. Qed. Lemma find_union_None (m1 m2 : FMap K V) (k : K) : find k m1 = None -> find k m2 = None -> find k (union m1 m2) = None. Proof. intros find1 find2. apply fin_maps.lookup_union_None; auto. Qed. Lemma find_union_Some_l (m1 m2 : FMap K V) (k : K) (v : V) : find k m1 = Some v -> find k (union m1 m2) = Some v. Proof. apply fin_maps.lookup_union_Some_l. Qed. Lemma find_add (m : FMap K V) (k : K) (v : V) : find k (add k v m) = Some v. Proof. apply fin_maps.lookup_insert. Qed. Lemma find_add_ne (m : FMap K V) (k k' : K) (v : V) : k <> k' -> find k' (add k v m) = find k' m. Proof. apply fin_maps.lookup_insert_ne. Qed. End Theories. End FMap. Hint Resolve FMap.find_union_None. Hint Resolve FMap.find_union_Some_l. Hint Resolve FMap.find_add. Hint Resolve FMap.find_add_ne. Instance empty_set_eq_dec : stdpp.base.EqDecision Empty_set. Proof. decidable.solve_decision. Defined. Program Instance empty_set_countable : countable.Countable Empty_set := ... ...