aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/Coquplib.v
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-06-20 00:31:10 +0100
committerYann Herklotz <git@yannherklotz.com>2020-06-20 00:31:10 +0100
commit2d10f818ff05b028ab2930d3ccfddd5a11bb1ad0 (patch)
treeef1d019119386d64a553c93a88391823836f3732 /src/common/Coquplib.v
parent9215c5c6ec3312a44a0808481d03210baa859beb (diff)
parentd216c3b6dfbd80f49296b47ba46d18603c723804 (diff)
downloadvericert-2d10f818ff05b028ab2930d3ccfddd5a11bb1ad0.tar.gz
vericert-2d10f818ff05b028ab2930d3ccfddd5a11bb1ad0.zip
Merge remote-tracking branch 'james/arrays-proof' into develop
Diffstat (limited to 'src/common/Coquplib.v')
-rw-r--r--src/common/Coquplib.v19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/Coquplib.v b/src/common/Coquplib.v
index 47360d6..efa1323 100644
--- a/src/common/Coquplib.v
+++ b/src/common/Coquplib.v
@@ -41,6 +41,19 @@ Ltac solve_by_inverts n :=
Ltac solve_by_invert := solve_by_inverts 1.
+Ltac invert x := inversion x; subst; clear x.
+
+Ltac clear_obvious :=
+ repeat match goal with
+ | [ H : ex _ |- _ ] => invert H
+ | [ H : ?C _ = ?C _ |- _ ] => invert H
+ | [ H : _ /\ _ |- _ ] => invert H
+ end.
+
+Ltac simplify := simpl in *; clear_obvious; simpl in *; try discriminate.
+
+Global Opaque Nat.div.
+
(* Definition const (A B : Type) (a : A) (b : B) : A := a.
Definition compose (A B C : Type) (f : B -> C) (g : A -> B) (x : A) : C := f (g x). *)
@@ -71,6 +84,12 @@ Definition bind {A B : Type} (f : option A) (g : A -> option B) : option B :=
| _ => None
end.
+Definition join {A : Type} (a : option (option A)) : option A :=
+ match a with
+ | None => None
+ | Some a' => a'
+ end.
+
Module Notation.
Notation "'do' X <- A ; B" := (bind A (fun X => B))
(at level 200, X ident, A at level 100, B at level 200).