aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Bool.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2016-10-21 18:13:27 -0400
committerGravatar Jason Gross <jgross@mit.edu>2016-10-21 18:13:27 -0400
commit39431e210dc35b188c59025a6eb266f11431c7f6 (patch)
tree2fdb200859ed837a2f5c23869b9c74c842c8b257 /src/Util/Bool.v
parent0709bc79077cf52682d01ce432b0f35c6f27665e (diff)
Add Bool lemmas about if statements
Diffstat (limited to 'src/Util/Bool.v')
-rw-r--r--src/Util/Bool.v10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Util/Bool.v b/src/Util/Bool.v
index 5293268df..7b94c503e 100644
--- a/src/Util/Bool.v
+++ b/src/Util/Bool.v
@@ -41,3 +41,13 @@ Hint Rewrite Bool.orb_andb_distrib_r Bool.orb_andb_distrib_l : push_orb.
Hint Rewrite <- Bool.andb_orb_distrib_r Bool.andb_orb_distrib_l : push_orb.
Hint Rewrite <- Bool.orb_andb_distrib_r Bool.orb_andb_distrib_l : pull_orb.
Hint Rewrite Bool.andb_orb_distrib_r Bool.andb_orb_distrib_l : pull_orb.
+
+Definition pull_bool_if_dep {A B} (f : forall b : bool, A b -> B b) (b : bool) (x : A true) (y : A false)
+ : (if b return B b then f _ x else f _ y) = f b (if b return A b then x else y)
+ := if b return ((if b return B b then f _ x else f _ y) = f b (if b return A b then x else y))
+ then eq_refl
+ else eq_refl.
+
+Definition pull_bool_if {A B} (f : A -> B) (b : bool) (x : A) (y : A)
+ : (if b then f x else f y) = f (if b then x else y)
+ := @pull_bool_if_dep (fun _ => A) (fun _ => B) (fun _ => f) b x y.