(** * Various generic lemmas that aren't present in the standard library *)
From BusyCoq Require Export LibTactics.
Set Default Goal Selector "!".
(* We are currently in a deprecation cycle where this gets changed from [auto with *] to [auto]. Opt in to silence the warning. *)
Ltac Tauto.intuition_solver ::= auto.
(* sig *)
Notation "[: x :]" := (exist _ x _).
(* sumbool *)
Notation Yes := (left _ _).
Notation No := (right _ _).
Notation Reduce x := (if x then Yes else No).
Notation "a && b" := (if a then b else No).
(* sumor *)
Notation "!!" := (inright _).
Notation "[|| x ||]" := (inleft [: x :]).
Notation "'bind' x <- a ; b" := (match a with | [|| x ||] => b | !! => No end)
(right associativity, at level 60, x pattern).
Notation "'bind' x <-- a ; b" := (match a with | [|| x ||] => b | !! => !! end)
(right associativity, at level 60, x pattern).
Fixpoint lpow {A} (l : list A) (n : nat) : list A :=
match n with
| O => []
| S n => l ++ lpow l n
end.
Notation "l ^^ n" := (lpow l n) (at level 20).
#[export] Hint Rewrite firstn_nil skipn_nil skipn_all firstn_all
firstn_app_2 : list.
(** We define our own [reflect] in [Prop] instead of [Set], as we don't want it to occur in the extracted programs. *)
Inductive reflect (P : Prop) : bool -> Prop :=
| ReflectT : P -> reflect P true
| ReflectF : ~ P -> reflect P false.
#[global]
Hint Constructors reflect : core.

Lemma reflect_andb : forall P Q p q,
reflect P p ->
reflect Q q ->
reflect (P /\ Q) (p && q).