@@ -570,7 +570,7 @@ Lemma arith_with_casts_rewrite_rules_proofs (adc_no_carry_to_add : bool)
570
570
Proof using Type .
571
571
start_proof; auto; intros; try lia.
572
572
all: repeat interp_good_t_step_related.
573
- 11: { replace (ident.cast rland v) with (ident.cast rland (ident.cast rv v)).
573
+ (* 11: { replace (ident.cast rland v) with (ident.cast rland (ident.cast rv v)).
574
574
- interp_good_t_step_arith. interp_good_t_step_arith. rewrite Z.land_ones.
575
575
+ replace (2 ^ Z.succ (Z.log2 (upper rland))) with (upper rland + 1).
576
576
-- rewrite <- ident.cast_out_of_bounds_simple_0_mod.
@@ -592,7 +592,7 @@ Proof using Type.
592
592
+ lia.
593
593
+ Search Z.ones. rewrite H0. apply Ones.Z.ones_nonneg.
594
594
remember (Z.log2_nonneg (upper)). lia.
595
- }
595
+ } *)
596
596
(* Search Z.ones. rewrite H0. apply Ones.Z.ones_nonneg.
597
597
remember (Z.log2_nonneg (upper)). lia.
598
598
}
@@ -861,6 +861,30 @@ Proof using Type.
861
861
by (intros; apply Z.pow_gt_lin_r; auto with zarith).
862
862
863
863
start_proof; auto; intros; try lia.
864
+ 1: {
865
+ replace (ident.cast rland v) with (ident.cast rland (ident.cast rv v)).
866
+ - interp_good_t_step_arith. interp_good_t_step_arith. rewrite Z.land_ones.
867
+ + replace (2 ^ Z.succ (Z.log2 (upper rland))) with (upper rland + 1).
868
+ -- rewrite <- ident.cast_out_of_bounds_simple_0_mod.
869
+ ++ destruct rland. simpl in *. subst. apply ident.cast_idempotent.
870
+ ++ rewrite H2. apply Ones.Z.ones_nonneg. remember (Z.log2_nonneg (upper rland)). lia.
871
+ -- remember (Z.log2 _) as x. rewrite H2. subst. rewrite Z.ones_equiv. lia.
872
+ + remember (Z.log2_nonneg (upper rland)). lia.
873
+ - Search ident.cast. destruct rland. destruct rv. simpl in *. subst.
874
+ (*Search ident.cast. Search ZRange.normalize.
875
+ repeat rewrite <- (ident.cast_normalize r[0~>upper]).
876
+ repeat rewrite <- (ident.cast_normalize r[0~>upper0]). *)
877
+ Check ident.cast_out_of_bounds_simple_0_mod.
878
+ repeat rewrite ident.cast_out_of_bounds_simple_0_mod.
879
+ + Search ((_ mod _) mod _). rewrite <- Z.mod_div_mod_full.
880
+ -- reflexivity.
881
+ -- Search Z.divide. rewrite <- Z.mod_divide_full. assumption.
882
+ + Search Z.ones. rewrite H2. apply Ones.Z.ones_nonneg.
883
+ remember (Z.log2_nonneg (upper)). lia.
884
+ + lia.
885
+ + Search Z.ones. rewrite H2. apply Ones.Z.ones_nonneg.
886
+ remember (Z.log2_nonneg (upper)). lia.
887
+ }
864
888
all: repeat interp_good_t_step_related.
865
889
all: systematically_handle_casts; autorewrite with zsimplify_fast; try reflexivity.
866
890
all: subst; rewrite !ident.platform_specific_cast_0_is_mod, ?Z.sub_add, ?Z.mod_mod by lia; try reflexivity.
0 commit comments