Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
This file proposes an implementation of the non-dependent
interface MSetWeakInterface.S using lists without redundancy.
Require Import MSetInterface. Set Implicit Arguments. Unset Strict Implicit.
Functions over lists
Module Ops (X: DecidableType) <: WOps X. Definition elt := X.t. Definition t := list elt. Definition empty : t := nil. Definition is_empty (l : t) : bool := if l then true else false. Fixpoint mem (x : elt) (s : t) : bool := match s with | nil => false | y :: l => if X.eq_dec x y then true else mem x l end. Fixpoint add (x : elt) (s : t) : t := match s with | nil => x :: nil | y :: l => if X.eq_dec x y then s else y :: add x l end. Definition singleton (x : elt) : t := x :: nil. Fixpoint remove (x : elt) (s : t) : t := match s with | nil => nil | y :: l => if X.eq_dec x y then l else y :: remove x l end. Definition fold (B : Type) (f : elt -> B -> B) : t -> B -> B := fold_left (flip f). Definition union (s : t) : t -> t := fold add s. Definition diff (s s' : t) : t := fold remove s' s. Definition inter (s s': t) : t := fold (fun x s => if mem x s' then add x s else s) s nil. Definition subset (s s' : t) : bool := is_empty (diff s s'). Definition equal (s s' : t) : bool := andb (subset s s') (subset s' s). Fixpoint filter (f : elt -> bool) (s : t) : t := match s with | nil => nil | x :: l => if f x then x :: filter f l else filter f l end. Fixpoint for_all (f : elt -> bool) (s : t) : bool := match s with | nil => true | x :: l => if f x then for_all f l else false end. Fixpoint exists_ (f : elt -> bool) (s : t) : bool := match s with | nil => false | x :: l => if f x then true else exists_ f l end. Fixpoint partition (f : elt -> bool) (s : t) : t * t := match s with | nil => (nil, nil) | x :: l => let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2) end. Definition cardinal (s : t) : nat := length s. Definition elements (s : t) : list elt := s. Definition choose (s : t) : option elt := match s with | nil => None | x::_ => Some x end. End Ops.
Module MakeRaw (X:DecidableType) <: WRawSets X. Include Ops X. Section ForNotations. Notation NoDup := (NoDupA X.eq). Notation In := (InA X.eq). (* TODO: modify proofs in order to avoid these hints *) Let eqr:= (@Equivalence_Reflexive _ _ X.eq_equiv). Let eqsym:= (@Equivalence_Symmetric _ _ X.eq_equiv). Let eqtrans:= (@Equivalence_Transitive _ _ X.eq_equiv). Hint Resolve eqr eqtrans : core. Hint Immediate eqsym : core. Definition IsOk := NoDup. Class Ok (s:t) : Prop := ok : NoDup s. Hint Unfold Ok : core. Hint Resolve ok : core. Instance NoDup_Ok s (nd : NoDup s) : Ok s := { ok := nd }. Ltac inv_ok := match goal with | H:Ok (_ :: _) |- _ => inversion_clear H; inv_ok | H:Ok nil |- _ => clear H; inv_ok | H:NoDup ?l |- _ => change (Ok l) in H; inv_ok | _ => idtac end. Ltac inv := invlist InA; inv_ok. Ltac constructors := repeat constructor. Fixpoint isok l := match l with | nil => true | a::l => negb (mem a l) && isok l end. Definition Equal s s' := forall a : elt, In a s <-> In a s'. Definition Subset s s' := forall a : elt, In a s -> In a s'. Definition Empty s := forall a : elt, ~ In a s. Definition For_all (P : elt -> Prop) s := forall x, In x s -> P x. Definition Exists (P : elt -> Prop) s := exists x, In x s /\ P x.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqProper (X.eq ==> eq ==> iff) Ineqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqProper (X.eq ==> eq ==> iff) Ineqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx, y:X.tH:X.eq x yx0, y0:list X.tH0:x0 = y0(In x x0 -> In y y0) /\ (In y y0 -> In x x0)rewrite H; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx, y:X.tH:X.eq x yy0:list X.t(In x y0 -> In y y0) /\ (In y y0 -> In x y0)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt), Ok s -> mem x s = true <-> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt), Ok s -> mem x s = true <-> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx:eltH:Ok nilmem x nil = true <-> In x nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 : elt, Ok s -> mem x0 s = true <-> In x0 sx:eltH:Ok (a :: s)mem x (a :: s) = true <-> In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx:eltH0:mem x nil = trueIn x nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 : elt, Ok s -> mem x0 s = true <-> In x0 sx:eltH:Ok (a :: s)mem x (a :: s) = true <-> In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 : elt, Ok s -> mem x0 s = true <-> In x0 sx:eltH:Ok (a :: s)mem x (a :: s) = true <-> In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 : elt, Ok s -> mem x0 s = true <-> In x0 sx:eltn:~ X.eq x aH0:mem x s = trueH1:~ In a sH2:Ok sIn x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 : elt, Ok s -> mem x0 s = true <-> In x0 sx:eltn:~ X.eq x aH1:In x sH0:~ In a sH2:Ok smem x s = truerewrite IHs; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 : elt, Ok s -> mem x0 s = true <-> In x0 sx:eltn:~ X.eq x aH1:In x sH0:~ In a sH2:Ok smem x s = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall l : t, Ok l <-> isok l = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall l : t, Ok l <-> isok l = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqOk nil <-> isok nil = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueOk (a :: l) <-> isok (a :: l) = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueOk (a :: l) <-> isok (a :: l) = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueOk (a :: l) <-> negb (mem a l) && isok l = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueOk (a :: l) <-> negb (mem a l) = true /\ isok l = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueOk (a :: l) <-> mem a l = false /\ isok l = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueOk (a :: l) <-> mem a l = false /\ Ok leqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH:Ok (a :: l)mem a l = false /\ Ok leqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH:mem a l = false /\ Ok lOk (a :: l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH0:~ In a lH1:Ok lmem a l = false /\ Ok leqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH:mem a l = false /\ Ok lOk (a :: l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH0:~ In a lH1:Ok lmem a l = falseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH:mem a l = false /\ Ok lOk (a :: l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH0:~ In a lH1:Ok lmem a l <> trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH:mem a l = false /\ Ok lOk (a :: l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH:mem a l = false /\ Ok lOk (a :: l)rewrite <- mem_spec; auto; congruence. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:eltl:list eltIHl:Ok l <-> isok l = trueH:mem a l = falseH0:Ok l~ In a leqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eql:list eltisok l = true -> Ok leqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eql:list eltisok l = true -> Ok lapply <- isok_iff; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eql:list eltH:isok l = trueOk leqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x y : elt), Ok s -> In y (add x s) <-> X.eq y x \/ In y seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x y : elt), Ok s -> In y (add x s) <-> X.eq y x \/ In y seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx, y:eltHs:Ok nilIn y (x :: nil) <-> X.eq y x \/ In y nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (add x0 s) <-> X.eq y0 x0 \/ In y0 sx, y:eltHs:Ok (a :: s)In y (if X.eq_dec x a then a :: s else a :: add x s) <-> X.eq y x \/ In y (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (add x0 s) <-> X.eq y0 x0 \/ In y0 sx, y:eltHs:Ok (a :: s)In y (if X.eq_dec x a then a :: s else a :: add x s) <-> X.eq y x \/ In y (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (add x0 s) <-> X.eq y0 x0 \/ In y0 sx, y:elte:X.eq x aH:In a s -> FalseH0:Ok sH2:X.eq y xX.eq y a \/ In y seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (add x0 s) <-> X.eq y0 x0 \/ In y0 sx, y:eltn:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:In y (a :: s)X.eq y a \/ X.eq y x \/ In y sinv; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (add x0 s) <-> X.eq y0 x0 \/ In y0 sx, y:eltn:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:In y (a :: s)X.eq y a \/ X.eq y x \/ In y seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltH:Ok sOk (add x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltH:Ok sOk (add x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx:eltH:Ok nilOk (add x nil)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltH:Ok (a :: s)IHs:Ok s -> Ok (add x s)Ok (add x (a :: s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltH:Ok (a :: s)IHs:Ok s -> Ok (add x s)Ok (add x (a :: s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltIHs:Ok s -> Ok (add x s)H0:~ In a sH1:Ok sOk (add x (a :: s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltIHs:Ok s -> Ok (add x s)H0:~ In a sH1:Ok sOk (if X.eq_dec x a then a :: s else a :: add x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltIHs:Ok s -> Ok (add x s)H0:~ In a sH1:Ok sn:~ X.eq x aOk (a :: add x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltIHs:Ok s -> Ok (add x s)H0:~ In a sH1:Ok sn:~ X.eq x a~ In a (add x s)rewrite add_spec in *; intuition. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltIHs:Ok s -> Ok (add x s)H0:~ In a sH1:Ok sn:~ X.eq x aH:In a (add x s)Falseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x y : elt), Ok s -> In y (remove x s) <-> In y s /\ ~ X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x y : elt), Ok s -> In y (remove x s) <-> In y s /\ ~ X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx, y:eltHs:Ok nilIn y nil <-> In y nil /\ ~ X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ ~ X.eq y0 x0x, y:eltHs:Ok (a :: s)In y (if X.eq_dec x a then s else a :: remove x s) <-> In y (a :: s) /\ ~ X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ ~ X.eq y0 x0x, y:eltHs:Ok (a :: s)In y (if X.eq_dec x a then s else a :: remove x s) <-> In y (a :: s) /\ ~ X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:elte:X.eq x aH:In a s -> FalseH0:Ok sH1:In y sH2:X.eq y xFalseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:elte:X.eq x aH:In a s -> FalseH0:Ok sH3:X.eq y x -> FalseH1:X.eq y aIn y seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:eltHnot:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:X.eq y aH1:X.eq y xFalseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:elte:X.eq x aH:In a s -> FalseH0:Ok sH1:In y sH2:X.eq y xIn a seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:elte:X.eq x aH:In a s -> FalseH0:Ok sH3:X.eq y x -> FalseH1:X.eq y aIn y seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:eltHnot:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:X.eq y aH1:X.eq y xFalseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:elte:X.eq x aH:In a s -> FalseH0:Ok sH3:X.eq y x -> FalseH1:X.eq y aIn y seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:eltHnot:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:X.eq y aH1:X.eq y xFalseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:elte:X.eq x aH:In a s -> FalseH0:Ok sH3:X.eq y x -> FalseH1:X.eq y aX.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:eltHnot:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:X.eq y aH1:X.eq y xFalseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:eltHnot:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:X.eq y aH1:X.eq y xFalseeauto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall x0 y0 : elt, Ok s -> In y0 (remove x0 s) <-> In y0 s /\ (X.eq y0 x0 -> False)x, y:eltHnot:X.eq x a -> FalseH:In a s -> FalseH0:Ok sH2:X.eq y aH1:X.eq y xX.eq x aeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltH:Ok sOk (remove x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltH:Ok sOk (remove x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx:eltH:Ok nilOk nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltH:Ok (a :: s)IHs:Ok s -> Ok (remove x s)Ok (if X.eq_dec x a then s else a :: remove x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltH:Ok (a :: s)IHs:Ok s -> Ok (remove x s)Ok (if X.eq_dec x a then s else a :: remove x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltIHs:Ok s -> Ok (remove x s)n:~ X.eq x aH0:~ In a sH1:Ok sOk (a :: remove x s)rewrite remove_spec; intuition. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltx:eltIHs:Ok s -> Ok (remove x s)n:~ X.eq x aH0:~ In a sH1:Ok s~ In a (remove x s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall x : elt, Ok (singleton x)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall x : elt, Ok (singleton x)intro; inv. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx:elt~ In x nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall x y : elt, In y (singleton x) <-> X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall x y : elt, In y (singleton x) <-> X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx, y:eltH:In y (x :: nil)X.eq y xeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx, y:eltH:X.eq y xIn y (x :: nil)left; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqx, y:eltH:X.eq y xIn y (x :: nil)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqOk emptyunfold empty; constructors. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqOk emptyeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqEmpty emptyunfold Empty, empty; red; intros; inv. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqEmpty emptyeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, is_empty s = true <-> Empty seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, is_empty s = true <-> Empty seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqH:true = truea:elt~ In a nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqe:elts:list eltH:false = truea:elt~ In a (e :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqe:elts:list eltH:forall a : elt, ~ In a (e :: s)false = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqe:elts:list eltH:false = truea:elt~ In a (e :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqe:elts:list eltH:forall a : elt, ~ In a (e :: s)false = trueelim (H e); auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqe:elts:list eltH:forall a : elt, ~ In a (e :: s)false = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt), In x (elements s) <-> In x sunfold elements; intuition. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt), In x (elements s) <-> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> NoDup (elements s)unfold elements; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> NoDup (elements s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (A : Type) (i : A) (f : elt -> A -> A), fold f s i = fold_left (flip f) (elements s) ireflexivity. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (A : Type) (i : A) (f : elt -> A -> A), fold f s i = fold_left (flip f) (elements s) ieqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> Ok (union s s')induction s; simpl; auto; intros; inv; unfold flip; auto with *. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> Ok (union s s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s s' : t) (x : elt), Ok s -> Ok s' -> In x (union s s') <-> In x s \/ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s s' : t) (x : elt), Ok s -> Ok s' -> In x (union s s') <-> In x s \/ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs':tx:eltHs':Ok s'In x s' <-> In x nil \/ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (s'0 : t) (x0 : elt), Ok s -> Ok s'0 -> In x0 (union s s'0) <-> In x0 s \/ In x0 s'0s':tx:eltHs':Ok s'H:~ In a sH0:Ok sIn x (union s (add a s')) <-> In x (a :: s) \/ In x s'rewrite IHs, add_spec, InA_cons; intuition. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (s'0 : t) (x0 : elt), Ok s -> Ok s'0 -> In x0 (union s s'0) <-> In x0 s \/ In x0 s'0s':tx:eltHs':Ok s'H:~ In a sH0:Ok sIn x (union s (add a s')) <-> In x (a :: s) \/ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tH:Ok sH0:Ok s'Ok (inter s s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tH:Ok sH0:Ok s'Ok (inter s s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tH:Ok sH0:Ok s'Ok (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s nil)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tH:Ok sH0:Ok s'acc:=nil:list eltOk (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s acc)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tH:Ok sH0:Ok s'acc:=nil:list eltHacc:Ok accOk (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s acc)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tH:Ok sH0:Ok s'forall acc : list elt, Ok acc -> Ok (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s acc)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list elts':tH:Ok (a :: s)H0:Ok s'IHs:Ok s -> forall acc0 : list elt, Ok acc0 -> Ok (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s acc0)acc:list eltHacc:Ok accOk (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s (if mem a s' then add a acc else acc))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list elts':tH0:Ok s'IHs:Ok s -> forall acc0 : list elt, Ok acc0 -> Ok (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s acc0)acc:list eltHacc:Ok accH1:~ In a sH2:Ok sOk (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s (if mem a s' then add a acc else acc))destruct (mem a s'); auto with *. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list elts':tH0:Ok s'IHs:Ok s -> forall acc0 : list elt, Ok acc0 -> Ok (fold_left (fun (x : t) (y : elt) => if mem y s' then add y x else x) s acc0)acc:list eltHacc:Ok accH1:~ In a sH2:Ok sOk (if mem a s' then add a acc else acc)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s s' : t) (x : elt), Ok s -> Ok s' -> In x (inter s s') <-> In x s /\ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s s' : t) (x : elt), Ok s -> Ok s' -> In x (inter s s') <-> In x s /\ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'In x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s nil) <-> In x s /\ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'acc:=nil:list eltIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x s /\ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'acc:=nil:list eltHacc:Ok accIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x s /\ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'acc:=nil:list eltHacc:Ok accIn x s /\ In x s' <-> In x s /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'acc:=nil:list eltHacc:Ok accIFF:In x s /\ In x s' <-> In x s /\ In x s' \/ In x accIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x s /\ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'acc:=nil:list eltHacc:Ok accIFF:In x s /\ In x s' <-> In x s /\ In x s' \/ In x accIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x s /\ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'acc:=nil:list eltHacc:Ok accIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x s /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tx:eltHs:Ok sHs':Ok s'acc:list eltHacc:Ok accIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x s /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall acc : list elt, Ok acc -> forall (x : elt) (s' : t), Ok s -> Ok s' -> In x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x s /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqacc:list eltHacc:Ok accx:elts':tHs:Ok nilHs':Ok s'In x acc <-> In x nil /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs:Ok (a :: s)Hs':Ok s'In x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s (if mem a s' then add a acc else acc)) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs:Ok (a :: s)Hs':Ok s'In x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s (if mem a s' then add a acc else acc)) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:~ In a sH0:Ok sIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s (if mem a s' then add a acc else acc)) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:~ In a sH0:Ok sHm:mem a s' = trueIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s (add a acc)) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:~ In a sH0:Ok sHm:mem a s' = falseIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:In a s -> FalseH0:Ok sHm:mem a s' = trueH1:X.eq x a(X.eq x a \/ In x s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:~ In a sH0:Ok sHm:mem a s' = falseIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:In a s -> FalseH0:Ok sHm:In a s'H1:X.eq x a(X.eq x a \/ In x s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:~ In a sH0:Ok sHm:mem a s' = falseIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:In a s -> FalseH0:Ok sHm:In a s'H1:X.eq x aIn x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:~ In a sH0:Ok sHm:mem a s' = falseIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:~ In a sH0:Ok sHm:mem a s' = falseIn x (fold_left (fun (x0 : t) (y : elt) => if mem y s' then add y x0 else x0) s acc) <-> In x (a :: s) /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:In a s -> FalseH0:Ok sHm:mem a s' = falseH3:In x s'H2:X.eq x aIn x s /\ In x s' \/ In x acccongruence. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall acc0 : list elt, Ok acc0 -> forall (x0 : elt) (s'0 : t), Ok s -> Ok s'0 -> In x0 (fold_left (fun (x1 : t) (y : elt) => if mem y s'0 then add y x1 else x1) s acc0) <-> In x0 s /\ In x0 s'0 \/ In x0 acc0acc:list eltHacc:Ok accx:elts':tHs':Ok s'H:In a s -> FalseH0:Ok sHm:mem a s' = falseH3:mem a s' = trueH2:X.eq x aIn x s /\ In x s' \/ In x acceqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> Ok (diff s s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> Ok (diff s s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs':tforall s : t, Ok s -> Ok s' -> Ok (fold remove s' s)inv; auto with *. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts':list eltIHs':forall s0 : t, Ok s0 -> Ok s' -> Ok (fold remove s' s0)s:tH:Ok sH0:Ok (a :: s')Ok (fold remove s' (remove a s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s s' : t) (x : elt), Ok s -> Ok s' -> In x (diff s s') <-> In x s /\ ~ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s s' : t) (x : elt), Ok s -> Ok s' -> In x (diff s s') <-> In x s /\ ~ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs':tforall (s : t) (x : elt), Ok s -> Ok s' -> In x (fold remove s' s) <-> In x s /\ ~ In x s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt), Ok s -> Ok nil -> In x s <-> In x s /\ ~ In x nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts':list eltIHs':forall (s : t) (x : elt), Ok s -> Ok s' -> In x (fold remove s' s) <-> In x s /\ ~ In x s'forall (s : t) (x : elt), Ok s -> Ok (a :: s') -> In x (fold remove s' (remove a s)) <-> In x s /\ ~ In x (a :: s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts':list eltIHs':forall (s : t) (x : elt), Ok s -> Ok s' -> In x (fold remove s' s) <-> In x s /\ ~ In x s'forall (s : t) (x : elt), Ok s -> Ok (a :: s') -> In x (fold remove s' (remove a s)) <-> In x s /\ ~ In x (a :: s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts':list eltIHs':forall (s0 : t) (x0 : elt), Ok s0 -> Ok s' -> In x0 (fold remove s' s0) <-> In x0 s0 /\ ~ In x0 s's:tx:eltHs:Ok sHs':Ok (a :: s')In x (fold remove s' (remove a s)) <-> In x s /\ ~ In x (a :: s')rewrite IHs', remove_spec, InA_cons; intuition. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts':list eltIHs':forall (s0 : t) (x0 : elt), Ok s0 -> Ok s' -> In x0 (fold remove s' s0) <-> In x0 s0 /\ ~ In x0 s's:tx:eltHs:Ok sH:~ In a s'H0:Ok s'In x (fold remove s' (remove a s)) <-> In x s /\ ~ In x (a :: s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> subset s s' = true <-> Subset s s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> subset s s' = true <-> Subset s s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'is_empty (diff s s') = true <-> (forall a : elt, In a s -> In a s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'Empty (diff s s') <-> (forall a : elt, In a s -> In a s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'(forall a : elt, ~ In a (diff s s')) <-> (forall a : elt, In a s -> In a s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 (diff s s') -> Falsea:eltH0:In a sIn a s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s -> In a0 s'a:eltH0:In a (diff s s')Falseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'a:eltH:In a (diff s s') -> FalseH0:In a sIn a s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s -> In a0 s'a:eltH0:In a (diff s s')Falseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'a:eltH0:In a sH:(In a s' -> False) -> FalseIn a s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s -> In a0 s'a:eltH0:In a (diff s s')Falseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'a:eltH0:In a sH:(mem a s' = true -> False) -> Falsemem a s' = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s -> In a0 s'a:eltH0:In a (diff s s')Falserewrite diff_spec in H0; intuition. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s -> In a0 s'a:eltH0:In a (diff s s')Falseeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> equal s s' = true <-> Equal s s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s s' : t, Ok s -> Ok s' -> equal s s' = true <-> Equal s s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'subset s s' && subset s' s = true <-> (forall a : elt, In a s <-> In a s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'Subset s s' /\ Subset s' s <-> (forall a : elt, In a s <-> In a s')eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s <-> In a0 s'a:eltH0:In a sIn a s'eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s <-> In a0 s'a:eltH0:In a s'In a srewrite H; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs, s':tHs:Ok sHs':Ok s'H:forall a0 : elt, In a0 s <-> In a0 s'a:eltH0:In a s'In a seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt), choose s = Some x -> In x sdestruct s; simpl; intros; inversion H; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt), choose s = Some x -> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, choose s = None -> Empty seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, choose s = None -> Empty seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqH:None = NoneEmpty nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqe:elts:list eltH:Some e = NoneEmpty (e :: s)inversion H. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqe:elts:list eltH:Some e = NoneEmpty (e :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> cardinal s = length (elements s)auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> cardinal s = length (elements s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : X.t) (f : elt -> bool), In x (filter f s) -> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : X.t) (f : elt -> bool), In x (filter f s) -> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall x : X.t, (elt -> bool) -> In x nil -> In x nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x : X.t) (f : elt -> bool), In x (filter f s) -> In x sforall (x : X.t) (f : elt -> bool), In x (if f a then a :: filter f s else filter f s) -> In x (a :: s)intros; destruct (f a); inv; intuition; right; eauto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x : X.t) (f : elt -> bool), In x (filter f s) -> In x sforall (x : X.t) (f : elt -> bool), In x (if f a then a :: filter f s else filter f s) -> In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt) (f : elt -> bool), Proper (X.eq ==> eq) f -> In x (filter f s) <-> In x s /\ f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (x : elt) (f : elt -> bool), Proper (X.eq ==> eq) f -> In x (filter f s) <-> In x s /\ f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (x : elt) (f : elt -> bool), Proper (X.eq ==> eq) f -> In x nil <-> In x nil /\ f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x : elt) (f : elt -> bool), Proper (X.eq ==> eq) f -> In x (filter f s) <-> In x s /\ f x = trueforall (x : elt) (f : elt -> bool), Proper (X.eq ==> eq) f -> In x (if f a then a :: filter f s else filter f s) <-> In x (a :: s) /\ f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x : elt) (f : elt -> bool), Proper (X.eq ==> eq) f -> In x (filter f s) <-> In x s /\ f x = trueforall (x : elt) (f : elt -> bool), Proper (X.eq ==> eq) f -> In x (if f a then a :: filter f s else filter f s) <-> In x (a :: s) /\ f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x0 : elt) (f0 : elt -> bool), Proper (X.eq ==> eq) f0 -> In x0 (filter f0 s) <-> In x0 s /\ f0 x0 = truex:eltf:elt -> boolH:Proper (X.eq ==> eq) fIn x (if f a then a :: filter f s else filter f s) <-> In x (a :: s) /\ f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x0 : elt) (f0 : elt -> bool), Proper (X.eq ==> eq) f0 -> In x0 (filter f0 s) <-> In x0 s /\ f0 x0 = truex:eltf:elt -> boolH:Proper (X.eq ==> eq) fE:f a = trueH1:X.eq x af x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x0 : elt) (f0 : elt -> bool), Proper (X.eq ==> eq) f0 -> In x0 (filter f0 s) <-> In x0 s /\ f0 x0 = truex:eltf:elt -> boolH:Proper (X.eq ==> eq) fE:f a = falseH2:f x = trueH0:X.eq x aIn x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x0 : elt) (f0 : elt -> bool), Proper (X.eq ==> eq) f0 -> In x0 (filter f0 s) <-> In x0 s /\ f0 x0 = truex:eltf:elt -> boolH:Proper (X.eq ==> eq) fE:f a = falseH2:f x = trueH0:X.eq x aIn x scongruence. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall (x0 : elt) (f0 : elt -> bool), Proper (X.eq ==> eq) f0 -> In x0 (filter f0 s) <-> In x0 s /\ f0 x0 = truex:eltf:elt -> boolH:Proper (X.eq ==> eq) fE:f x = falseH2:f x = trueH0:X.eq x aIn x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tf:elt -> boolH:Ok sOk (filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tf:elt -> boolH:Ok sOk (filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqf:elt -> boolH:Ok nilOk nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltf:elt -> boolH:Ok (a :: s)IHs:Ok s -> Ok (filter f s)Ok (if f a then a :: filter f s else filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltf:elt -> boolH:Ok (a :: s)IHs:Ok s -> Ok (filter f s)Ok (if f a then a :: filter f s else filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltf:elt -> boolIHs:Ok s -> Ok (filter f s)H0:~ In a sH1:Ok sOk (if f a then a :: filter f s else filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltf:elt -> boolIHs:Ok s -> Ok (filter f s)H0:~ In a sH1:Ok sOk (a :: filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltf:elt -> boolIHs:Ok s -> Ok (filter f s)H0:~ In a sH1:Ok s~ In a (filter f s)eapply filter_spec'; eauto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltf:elt -> boolIHs:Ok s -> Ok (filter f s)H1:Ok sH0:In a (filter f s)In a seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> for_all f s = true <-> For_all (fun x : elt => f x = true) seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> for_all f s = true <-> For_all (fun x : elt => f x = true) seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall f : elt -> bool, Proper (X.eq ==> eq) f -> true = true <-> (forall x : X.t, In x nil -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f : elt -> bool, Proper (X.eq ==> eq) f -> for_all f s = true <-> (forall x : X.t, In x s -> f x = true)forall f : elt -> bool, Proper (X.eq ==> eq) f -> (if f a then for_all f s else false) = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqf:elt -> boolH:Proper (X.eq ==> eq) fH0:true = truex:X.tH1:In x nilf x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f : elt -> bool, Proper (X.eq ==> eq) f -> for_all f s = true <-> (forall x : X.t, In x s -> f x = true)forall f : elt -> bool, Proper (X.eq ==> eq) f -> (if f a then for_all f s else false) = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f : elt -> bool, Proper (X.eq ==> eq) f -> for_all f s = true <-> (forall x : X.t, In x s -> f x = true)forall f : elt -> bool, Proper (X.eq ==> eq) f -> (if f a then for_all f s else false) = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) f(if f a then for_all f s else false) = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = truefor_all f s = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsefalse = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x0 : X.t, In x0 s -> f0 x0 = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = trueH0:forall x0 : X.t, In x0 s -> f x0 = truex:X.tH1:In x (a :: s)f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsefalse = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x0 : X.t, In x0 s -> f0 x0 = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = trueH0:forall x0 : X.t, In x0 s -> f x0 = truex:X.tH2:X.eq x af x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsefalse = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsefalse = true <-> (forall x : X.t, In x (a :: s) -> f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falseH':forall x : X.t, In x (a :: s) -> f x = truefalse = truerewrite <- F, <- (H' a); auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> for_all f0 s = true <-> (forall x : X.t, In x s -> f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falseH':forall x : X.t, In x (a :: s) -> f x = truefalse = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> exists_ f s = true <-> Exists (fun x : elt => f x = true) seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> exists_ f s = true <-> Exists (fun x : elt => f x = true) seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall f : elt -> bool, Proper (X.eq ==> eq) f -> false = true <-> (exists x : X.t, In x nil /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f : elt -> bool, Proper (X.eq ==> eq) f -> exists_ f s = true <-> (exists x : X.t, In x s /\ f x = true)forall f : elt -> bool, Proper (X.eq ==> eq) f -> (if f a then true else exists_ f s) = true <-> (exists x : X.t, In x (a :: s) /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f : elt -> bool, Proper (X.eq ==> eq) f -> exists_ f s = true <-> (exists x : X.t, In x s /\ f x = true)forall f : elt -> bool, Proper (X.eq ==> eq) f -> (if f a then true else exists_ f s) = true <-> (exists x : X.t, In x (a :: s) /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x : X.t, In x s /\ f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) f(if f a then true else exists_ f s) = true <-> (exists x : X.t, In x (a :: s) /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x : X.t, In x s /\ f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = truetrue = true <-> (exists x : X.t, In x (a :: s) /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x : X.t, In x s /\ f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falseexists_ f s = true <-> (exists x : X.t, In x (a :: s) /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x : X.t, In x s /\ f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = truetrue = true -> exists x : X.t, In x (a :: s) /\ f x = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x : X.t, In x s /\ f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falseexists_ f s = true <-> (exists x : X.t, In x (a :: s) /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x : X.t, In x s /\ f0 x = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falseexists_ f s = true <-> (exists x : X.t, In x (a :: s) /\ f x = true)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x0 : X.t, In x0 s /\ f0 x0 = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsex:X.tH0:In x (a :: s)H1:f x = trueexists x0 : X.t, In x0 s /\ f x0 = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x0 : X.t, In x0 s /\ f0 x0 = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsex:X.tH1:f x = trueH2:X.eq x aexists x0 : X.t, In x0 s /\ f x0 = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x0 : X.t, In x0 s /\ f0 x0 = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsex:X.tH1:f x = trueH2:In x sexists x0 : X.t, In x0 s /\ f x0 = trueexists x; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> exists_ f0 s = true <-> (exists x0 : X.t, In x0 s /\ f0 x0 = true)f:elt -> boolH:Proper (X.eq ==> eq) fF:f a = falsex:X.tH1:f x = trueH2:In x sexists x0 : X.t, In x0 s /\ f x0 = trueeqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> Equal (fst (partition f s)) (filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> Equal (fst (partition f s)) (filter f s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a : elt, In a nil <-> In a nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (fst (partition f l)) <-> In a0 (filter f l)) -> forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (fst (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2))) <-> In a0 (if f a then a :: filter f l else filter f l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (fst (partition f l)) <-> In a0 (filter f l)) -> forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (fst (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2))) <-> In a0 (if f a then a :: filter f l else filter f l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> forall a : elt, In a (fst (partition f0 l)) <-> In a (filter f0 l)f:elt -> boolHf:Proper (X.eq ==> eq) fforall a : elt, In a (fst (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2))) <-> In a (if f x then x :: filter f l else filter f l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltf:elt -> boolHf:Proper (X.eq ==> eq) f(forall a : elt, In a (fst (partition f l)) <-> In a (filter f l)) -> forall a : elt, In a (fst (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2))) <-> In a (if f x then x :: filter f l else filter f l)case (f x); simpl; firstorder; inversion H0; intros; firstorder. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltf:elt -> boolHf:Proper (X.eq ==> eq) fs1, s2:tH:forall a0 : elt, In a0 s1 <-> In a0 (filter f l)a:eltIn a (fst (if f x then (x :: s1, s2) else (s1, x :: s2))) <-> In a (if f x then x :: filter f l else filter f l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> Equal (snd (partition f s)) (filter (fun x : elt => negb (f x)) s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Proper (X.eq ==> eq) f -> Equal (snd (partition f s)) (filter (fun x : elt => negb (f x)) s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a : elt, In a nil <-> In a nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (snd (partition f l)) <-> In a0 (filter (fun x : elt => negb (f x)) l)) -> forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (snd (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2))) <-> In a0 (if negb (f a) then a :: filter (fun x : elt => negb (f x)) l else filter (fun x : elt => negb (f x)) l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (snd (partition f l)) <-> In a0 (filter (fun x : elt => negb (f x)) l)) -> forall f : elt -> bool, Proper (X.eq ==> eq) f -> forall a0 : elt, In a0 (snd (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2))) <-> In a0 (if negb (f a) then a :: filter (fun x : elt => negb (f x)) l else filter (fun x : elt => negb (f x)) l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Proper (X.eq ==> eq) f0 -> forall a : elt, In a (snd (partition f0 l)) <-> In a (filter (fun x0 : elt => negb (f0 x0)) l)f:elt -> boolHf:Proper (X.eq ==> eq) fforall a : elt, In a (snd (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2))) <-> In a (if negb (f x) then x :: filter (fun x0 : elt => negb (f x0)) l else filter (fun x0 : elt => negb (f x0)) l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltf:elt -> boolHf:Proper (X.eq ==> eq) f(forall a : elt, In a (snd (partition f l)) <-> In a (filter (fun x0 : elt => negb (f x0)) l)) -> forall a : elt, In a (snd (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2))) <-> In a (if negb (f x) then x :: filter (fun x0 : elt => negb (f x0)) l else filter (fun x0 : elt => negb (f x0)) l)case (f x); simpl; firstorder; inversion H0; intros; firstorder. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltf:elt -> boolHf:Proper (X.eq ==> eq) fs1, s2:tH:forall a0 : elt, In a0 s2 <-> In a0 (filter (fun x0 : elt => negb (f x0)) l)a:eltIn a (snd (if f x then (x :: s1, s2) else (s1, x :: s2))) <-> In a (if negb (f x) then x :: filter (fun x0 : elt => negb (f x0)) l else filter (fun x0 : elt => negb (f x0)) l)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> forall (f : elt -> bool) (x : elt), In x (fst (partition f s)) -> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> forall (f : elt -> bool) (x : elt), In x (fst (partition f s)) -> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (fst (partition f0 s)) -> In x0 sHs:Ok (a :: s)f:elt -> boolx:eltH:In x (fst (let (s1, s2) := partition f s in if f a then (a :: s1, s2) else (s1, a :: s2)))In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (fst (partition f0 s)) -> In x0 sf:elt -> boolx:eltH:In x (fst (let (s1, s2) := partition f s in if f a then (a :: s1, s2) else (s1, a :: s2)))H0:~ In a sH1:Ok sIn x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (fst (partition f0 s)) -> In x0 sf:elt -> boolx:eltH:In x (fst (let (s1, s2) := partition f s in if f a then (a :: s1, s2) else (s1, a :: s2)))H0:~ In a sH1:Ok s(In x (fst (partition f s)) -> In x s) -> In x (a :: s)inversion_clear H; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (fst (partition f0 s)) -> In x0 sf:elt -> boolx:eltt0, t1:tH:In x (a :: t0)H0:~ In a sH1:Ok s(In x t0 -> In x s) -> In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> forall (f : elt -> bool) (x : elt), In x (snd (partition f s)) -> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall s : t, Ok s -> forall (f : elt -> bool) (x : elt), In x (snd (partition f s)) -> In x seqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (snd (partition f0 s)) -> In x0 sHs:Ok (a :: s)f:elt -> boolx:eltH:In x (snd (let (s1, s2) := partition f s in if f a then (a :: s1, s2) else (s1, a :: s2)))In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (snd (partition f0 s)) -> In x0 sf:elt -> boolx:eltH:In x (snd (let (s1, s2) := partition f s in if f a then (a :: s1, s2) else (s1, a :: s2)))H0:~ In a sH1:Ok sIn x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (snd (partition f0 s)) -> In x0 sf:elt -> boolx:eltH:In x (snd (let (s1, s2) := partition f s in if f a then (a :: s1, s2) else (s1, a :: s2)))H0:~ In a sH1:Ok s(In x (snd (partition f s)) -> In x s) -> In x (a :: s)inversion_clear H; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqa:elts:list eltIHs:Ok s -> forall (f0 : elt -> bool) (x0 : elt), In x0 (snd (partition f0 s)) -> In x0 sf:elt -> boolx:eltt0, t1:tH:In x (a :: t1)H0:~ In a sH1:Ok s(In x t1 -> In x s) -> In x (a :: s)eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Ok s -> Ok (fst (partition f s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Ok s -> Ok (fst (partition f s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:t(elt -> bool) -> Ok nil -> Ok nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Ok l -> Ok (fst (partition f l))) -> forall f : elt -> bool, Ok (a :: l) -> Ok (fst (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2)))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Ok l -> Ok (fst (partition f l))) -> forall f : elt -> bool, Ok (a :: l) -> Ok (fst (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2)))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Ok l -> Ok (fst (partition f0 l))f:elt -> boolH:~ In x lH0:Ok lOk (fst (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2)))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Ok l -> Ok (fst (partition f0 l))f:elt -> boolH:~ In x lH0:Ok l(In x (fst (partition f l)) -> In x l) -> Ok (fst (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2)))case (f x); case (partition f l); simpl; constructors; auto. Qed.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Ok l -> Ok (fst (partition f0 l))f:elt -> boolH:~ In x lH0:Ok lOk (fst (partition f l)) -> (In x (fst (partition f l)) -> In x l) -> Ok (fst (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2)))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Ok s -> Ok (snd (partition f s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqforall (s : t) (f : elt -> bool), Ok s -> Ok (snd (partition f s))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:t(elt -> bool) -> Ok nil -> Ok nileqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Ok l -> Ok (snd (partition f l))) -> forall f : elt -> bool, Ok (a :: l) -> Ok (snd (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2)))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tforall (a : elt) (l : list elt), (forall f : elt -> bool, Ok l -> Ok (snd (partition f l))) -> forall f : elt -> bool, Ok (a :: l) -> Ok (snd (let (s1, s2) := partition f l in if f a then (a :: s1, s2) else (s1, a :: s2)))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Ok l -> Ok (snd (partition f0 l))f:elt -> boolH:~ In x lH0:Ok lOk (snd (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2)))eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Ok l -> Ok (snd (partition f0 l))f:elt -> boolH:~ In x lH0:Ok l(In x (snd (partition f l)) -> In x l) -> Ok (snd (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2)))case (f x); case (partition f l); simpl; constructors; auto. Qed. End ForNotations. Definition In := InA X.eq. Definition eq := Equal. Instance eq_equiv : Equivalence eq := _. End MakeRaw.eqr:=Equivalence_Reflexive:Reflexive X.eqeqsym:=Equivalence_Symmetric:Symmetric X.eqeqtrans:=Equivalence_Transitive:Transitive X.eqs:tx:eltl:list eltHrec:forall f0 : elt -> bool, Ok l -> Ok (snd (partition f0 l))f:elt -> boolH:~ In x lH0:Ok lOk (snd (partition f l)) -> (In x (snd (partition f l)) -> In x l) -> Ok (snd (let (s1, s2) := partition f l in if f x then (x :: s1, s2) else (s1, x :: s2)))
Encapsulation
Module Make (X: DecidableType) <: WSets with Module E := X. Module Raw := MakeRaw X. Include WRaw2Sets X Raw. End Make.