Debian Codegraph @

src/Util/ZUtil/DistrIf.v

raw
1 From Coq Require Import ZArith.
2 From Coq Require Import Lia.
3 Require Import Crypto.Util.ZUtil.Hints.Core.
4 Local Open Scope Z_scope.
5
6 Module Z.
7 Definition opp_distr_if (b : bool) x y : -(if b then x else y) = if b then -x else -y.
8 Proof. destruct b; reflexivity. Qed.
9 #[global]
10 Hint Rewrite opp_distr_if : push_Zopp.
11 #[global]
12 Hint Rewrite <- opp_distr_if : pull_Zopp.
13
14 Lemma mul_r_distr_if (b : bool) x y z : z * (if b then x else y) = if b then z * x else z * y.
15 Proof. destruct b; reflexivity. Qed.
16 #[global]
17 Hint Rewrite mul_r_distr_if : push_Zmul.
18 #[global]
19 Hint Rewrite <- mul_r_distr_if : pull_Zmul.
20
21 Lemma mul_l_distr_if (b : bool) x y z : (if b then x else y) * z = if b then x * z else y * z.
22 Proof. destruct b; reflexivity. Qed.
23 #[global]
24 Hint Rewrite mul_l_distr_if : push_Zmul.
25 #[global]
26 Hint Rewrite <- mul_l_distr_if : pull_Zmul.
27
28 Lemma add_r_distr_if (b : bool) x y z : z + (if b then x else y) = if b then z + x else z + y.
29 Proof. destruct b; reflexivity. Qed.
30 #[global]
31 Hint Rewrite add_r_distr_if : push_Zadd.
32 #[global]
33 Hint Rewrite <- add_r_distr_if : pull_Zadd.
34
35 Lemma add_l_distr_if (b : bool) x y z : (if b then x else y) + z = if b then x + z else y + z.
36 Proof. destruct b; reflexivity. Qed.
37 #[global]
38 Hint Rewrite add_l_distr_if : push_Zadd.
39 #[global]
40 Hint Rewrite <- add_l_distr_if : pull_Zadd.
41
42 Lemma sub_r_distr_if (b : bool) x y z : z - (if b then x else y) = if b then z - x else z - y.
43 Proof. destruct b; reflexivity. Qed.
44 #[global]
45 Hint Rewrite sub_r_distr_if : push_Zsub.
46 #[global]
47 Hint Rewrite <- sub_r_distr_if : pull_Zsub.
48
49 Lemma sub_l_distr_if (b : bool) x y z : (if b then x else y) - z = if b then x - z else y - z.
50 Proof. destruct b; reflexivity. Qed.
51 #[global]
52 Hint Rewrite sub_l_distr_if : push_Zsub.
53 #[global]
54 Hint Rewrite <- sub_l_distr_if : pull_Zsub.
55
56 Lemma div_r_distr_if (b : bool) x y z : z / (if b then x else y) = if b then z / x else z / y.
57 Proof. destruct b; reflexivity. Qed.
58 #[global]
59 Hint Rewrite div_r_distr_if : push_Zdiv.
60 #[global]
61 Hint Rewrite <- div_r_distr_if : pull_Zdiv.
62
63 Lemma div_l_distr_if (b : bool) x y z : (if b then x else y) / z = if b then x / z else y / z.
64 Proof. destruct b; reflexivity. Qed.
65 #[global]
66 Hint Rewrite div_l_distr_if : push_Zdiv.
67 #[global]
68 Hint Rewrite <- div_l_distr_if : pull_Zdiv.
69 End Z.