@@ -392,7 +392,7 @@ Proof.
392
392
rewrite jda. clear jda. rewrite runCompressLoop; try (assumption || lia). rewrite (ltac:(lia) : Z.to_nat 100 = length dsu). reflexivity.
393
393
Qed .
394
394
395
- Lemma runUnite (dsu : list Slot) (hL : length dsu = 100) (h1 : noIllegalIndices dsu) (h2 : withoutCyclesN dsu (length dsu)) (a b : Z) (hLt1 : Z.lt a 100) (hLt2 : Z.lt b 100) : invokeContractAux (repeat 1%Z 20) (repeat 0%Z 20) 0 state
395
+ Lemma runUnite (dsu : list Slot) (hL : length dsu = 100) (hL1 : Z.to_nat (dsuLeafCount dsu) = length dsu) ( h1 : noIllegalIndices dsu) (h2 : withoutCyclesN dsu (length dsu)) (a b : Z) (hLe1 : Z.le 0 a) ( hLt1 : Z.lt a 100) (hLe2 : Z.le 0 b ) (hLt2 : Z.lt b 100) : invokeContractAux (repeat 1%Z 20) (repeat 0%Z 20) 0 state
396
396
state [a; b] 1 arrayIndex0 arrayIndexEqualityDecidable0
397
397
(arrayType arrayIndex0 environment0) (λ _0 : arrayIndex0,
398
398
match
@@ -503,7 +503,46 @@ end)
503
503
(unite dsu (Z.to_nat a)
504
504
(Z.to_nat b)))).
505
505
Proof .
506
- unfold funcdef_0__unite. unfold numberLocalGet at 1. rewrite <- !bindAssoc, pushNumberGet2, !leftIdentity, eliminateLift, eliminateLift.
506
+ unfold funcdef_0__unite. unfold numberLocalGet at 1. rewrite -!bindAssoc pushNumberGet2 !leftIdentity eliminateLift eliminateLift -!bindAssoc runAncestor; try (assumption || lia). unfold retrieve at 1. rewrite !pushDispatch2 (ltac:(intros; simpl; reflexivity) : forall effect continuation f, Dispatch _ _ _ effect continuation >>= f = _) unfoldInvoke_S_Retrieve. case_decide as ppp; [| simpl in ppp; lia]. rewrite (ltac:(intros; easy) : forall a c, nth_lt [a] (Z.to_nat 0%Z) c = a). clear ppp. unfold numberLocalSet at 1. rewrite pushNumberSet2.
507
+ assert (le : update
508
+ (λ _0 : varsfuncdef_0__unite,
509
+ match _0 with
510
+ | vardef_0__unite_u => a
511
+ | vardef_0__unite_v => b
512
+ | vardef_0__unite_z => 0%Z
513
+ end) vardef_0__unite_u
514
+ (Z.of_nat (ancestor dsu (length dsu) (Z.to_nat a))) = fun x => match x with | vardef_0__unite_u => Z.of_nat (ancestor dsu (length dsu) (Z.to_nat a)) | vardef_0__unite_v => b | vardef_0__unite_z => 0%Z end). { apply functional_extensionality_dep. intro hh. destruct hh; easy. } rewrite le. clear le.
515
+ unfold numberLocalGet at 1. rewrite pushNumberGet2 !leftIdentity eliminateLift.
516
+ rewrite -!bindAssoc runAncestor; try (assumption || lia). { rewrite pathCompressPreservesLength; (assumption || lia). } { rewrite pathCompressPreservesLength; try (assumption || lia). rewrite pathCompressPreservesLeafCount; try (assumption || lia). } { admit. } { rewrite pathCompressPreservesLength; try (assumption || lia). apply pathCompressPreservesWithoutCycles; try (assumption || lia). } unfold retrieve at 1. rewrite !pushDispatch2 (ltac:(intros; simpl; reflexivity) : forall effect continuation f, Dispatch _ _ _ effect continuation >>= f = _) unfoldInvoke_S_Retrieve. case_decide as ppp; [| simpl in ppp; lia]. rewrite (ltac:(intros; easy) : forall a c, nth_lt [a] (Z.to_nat 0%Z) c = a). clear ppp. unfold numberLocalSet at 1. rewrite pushNumberSet2.
517
+ assert (uwl : update
518
+ (λ _0 : varsfuncdef_0__unite,
519
+ match _0 with
520
+ | vardef_0__unite_u =>
521
+ Z.of_nat (ancestor dsu (length dsu) (Z.to_nat a))
522
+ | vardef_0__unite_v => b
523
+ | vardef_0__unite_z => 0%Z
524
+ end) vardef_0__unite_v
525
+ (Z.of_nat
526
+ (ancestor
527
+ (pathCompress dsu (length dsu) (Z.to_nat a)
528
+ (ancestor dsu (length dsu) (Z.to_nat a)))
529
+ (length
530
+ (pathCompress dsu (length dsu) (Z.to_nat a)
531
+ (ancestor dsu (length dsu) (Z.to_nat a))))
532
+ (Z.to_nat b))) = fun _0 => match _0 with
533
+ | vardef_0__unite_u =>
534
+ Z.of_nat (ancestor dsu (length dsu) (Z.to_nat a))
535
+ | vardef_0__unite_v => Z.of_nat
536
+ (ancestor
537
+ (pathCompress dsu (length dsu) (Z.to_nat a)
538
+ (ancestor dsu (length dsu) (Z.to_nat a)))
539
+ (length
540
+ (pathCompress dsu (length dsu) (Z.to_nat a)
541
+ (ancestor dsu (length dsu) (Z.to_nat a))))
542
+ (Z.to_nat b))
543
+ | vardef_0__unite_z => 0%Z
544
+ end). { apply functional_extensionality_dep. intro iw. destruct iw; easy. } rewrite uwl. clear uwl.
545
+ unfold numberLocalGet at 1. rewrite pushNumberGet2. unfold numberLocalGet at 1. rewrite pushNumberGet2.
507
546
Admitted .
508
547
509
548
Lemma firstInteraction (a b : Z) (hLt1 : Z.lt a 100) (hLt2 : Z.lt b 100) : invokeContract (repeat 1%Z 20) (repeat 0%Z 20) 0%Z state state [a; b] 1 = Some ([a; b], stateAfterInteractions (fun x => match x with | arraydef_0__result => [0%Z] | arraydef_0__hasBeenInitialized => [1%Z] | arraydef_0__dsu => convertToArray (unite (repeat (Ancestor Unit) 100) (Z.to_nat a) (Z.to_nat b)) end ) (dsuScore (unite (repeat (Ancestor Unit) 100) (Z.to_nat a) (Z.to_nat b)))).
0 commit comments