Library monadpure.misc

Pure support used by the delayed-MCP model. Only the two list lemmas and rewrite rules needed from Monad's former misc.v are retained; this module imports neither C++ semantics nor proprietary proof automation.
Require Export skylabs.prelude.prelude.
From Stdlib Require Export Lia.

Set Default Goal Selector "!".

Lemma forallCons {T} (P : T → Prop) (l : list T) (h : T) :
  (∀ t, t ∈ h :: l → P t) →
  P h ∧ ∀ t, t ∈ l → P t.
Proof.
  intros HP. split.
  { apply HP. apply elem_of_cons. left. reflexivity. }
  { intros t Ht. apply HP. apply elem_of_cons. right. exact Ht. }
Qed.

Lemma forallb_spec {T} (f : T → bool) l :
  forallb f l = true ↔ (∀ x, x ∈ l → f x = true).
Proof.
  rewrite forallb_forall.
  split; intros ? ?;
    (rewrite list_elem_of_In || rewrite <- list_elem_of_In); auto.
Qed.

Create HintDb syntactic.
Create HintDb iff.
#[export] Hint Rewrite orb_false_l orb_false_r : syntactic.
#[export] Hint Rewrite @elem_of_cons @elem_of_nil : iff.
#[export] Hint Rewrite bool_decide_eq_true orb_true_iff andb_true_iff : iff.