Require Import List Vbase Varith Vlistbase Vlist.
Require Import Permutation Classical.
Set Implicit Arguments.

Notation sval := (@proj1_sig _ _).
Notation "@ ´sval´" := (@proj1_sig) (at level 10, format "@ 'sval'").


Lemma forall_and_dist T (P Q: TProp):
  ( x, P x Q x) ( x, P x) ( x, Q x).

Lemma list_destruct_end: A (l: list A), l = nil a, l = ++ a :: nil.

Ltac des_list_tail l a :=
  let F := fresh in destruct (list_destruct_end l) as [ | [ F]]; [ | destruct F as [a]]; subst l.

Ltac find_in_list := (by repeat progress (rewrite ?In_app; ins); eauto 8).

Lemma map_is_nil: T1 T2 (f: T1T2) l, map f l = nill = nil.

Lemma not_or_and_iff : P Q, ¬ (P Q) ¬ P ¬ Q.

Lemma true_imp_b: (b : bool), (trueb) b = true.

Definition disjoint A (l1 l2 : list A) :=
   a (IN1: In a l1) (IN2: In a l2), False.

Lemma nodup_one A (x: A) : NoDup (x :: nil).
Hint Resolve NoDup_nil nodup_one.

Lemma nodup_map:
   (A B: Type) (f: AB) (l: list A),
  NoDup l
  ( x y, In x lIn y lx yf x f y) →
  NoDup (map f l).

Lemma nodup_append_commut:
   (A: Type) (a b: list A),
  NoDup (a ++ b) → NoDup (b ++ a).

Lemma nodup_cons A (x: A) l:
  NoDup (x :: l) ¬ In x l NoDup l.

Lemma NoDup_two A: (x y: A), NoDup (x :: y :: nil) x y.

Lemma nodup_app:
   (A: Type) (l1 l2: list A),
  NoDup (l1 ++ l2)
  NoDup l1 NoDup l2 disjoint l1 l2.

Lemma nodup_append:
   (A: Type) (l1 l2: list A),
  NoDup l1NoDup l2disjoint l1 l2
  NoDup (l1 ++ l2).

Lemma nodup_append_right:
   (A: Type) (l1 l2: list A),
  NoDup (l1 ++ l2) → NoDup l2.

Lemma nodup_append_left:
   (A: Type) (l1 l2: list A),
  NoDup (l1 ++ l2) → NoDup l1.



Definition mupd (A: eqType) B (h : AB) y z :=
  fun xif x == y then z else h x.

Lemma mupds (A: eqType) B (f: AB) x y : mupd f x y x = y.

Lemma mupdo (A: eqType) B (f: AB) x y z : x zmupd f x y z = f z.


Lemma In_perm A l (P: perm_eq (T:=A) l ) x : In x l In x .

Lemma In_implies_perm A (x : A) l (IN: In x l) :
   , Permutation l (x :: ).

Lemma nodup_perm A l (P: perm_eq (T:=A) l ) : NoDup l NoDup .

Lemma Permutation_filter_split T:
   (l: list T) (f: Tbool), Permutation l ((filter f l) ++ (filter (fun xnegb (f x)) l)).

Lemma In_mem_eq (A: eqType) (l : list A) (P: l =i ) x : In x l In x .

Lemma NoDup_filter A (l: list A) (ND: NoDup l) f : NoDup (filter f l).

Hint Resolve NoDup_filter.

Lemma NoDup_eq_one A (x : A) l :
   NoDup lIn x l → ( y (IN: In y l), y = x) → l = x :: nil.

Lemma map_perm :
   A B (f: AB) l , Permutation l Permutation (map f l) (map f ).

Lemma perm_from_subset :
   A (l : list A) ,
    NoDup
    ( x, In x In x l) →
     l´´, Permutation l ( ++ l´´).

Lemma Permutation_NoDup A ( l : list A) :
  Permutation l NoDup lNoDup .

Lemma NoDup_mapD A B (f : AB) l :
  NoDup (map f l) → NoDup l.

Lemma NoDup_neq: {A} a b (l: list A), NoDup (a :: b :: l) → a b.

Lemma olast_inv A l x :
  olast (T:=A) l = Some x prefix, l = prefix ++ x :: nil.

Lemma In_flatten A (x:A) l :
  In x (flatten l) y, In x y In y l.

Lemma list_not_nil: {A} (l: list A), l nil a, In a l.

Lemma list_zero_one: {A} a (l: list A) (ND: NoDup l),
                     ( x (IN: In x l), x = a) l = nil l = a :: nil.

Lemma neq_contra: (x: nat), ¬ (x != x).

Lemma subset_perm: {A} (X Y: list A) (NDX: NoDup X) (NDY: NoDup Y)
                          (SUBSET: a, In a YIn a X),
                    , Permutation X (Y ++ ).

Require Import Wf Wf_nat.

Lemma first_exists:
   A (l: list A) phi (EX: a, In a l phi a),
   l1 l2, l = l1 ++ :: l2 phi b (IN: In b l1), ¬ phi b.

Lemma last_exists:
   A (l: list A) phi (EX: a, In a l phi a),
   l1 l2, l = l1 ++ :: l2 phi b (IN: In b l2), ¬ phi b.

Lemma map_eq A B:
   (f g: AB) (l: list A) (fEQ: x (IN: In x l), f x = g x), map f l = map g l.


This page has been generated by coqdoc