123456789101112131415161718192021222324252627282930313233343536373839404142434445464748-------------------------------------------------------------------------- The Agda standard library---- Properties of unique lists (setoid equality) using K------------------------------------------------------------------------ {-# OPTIONS --safe --with-K #-} module Data.List.Relation.Unary.Unique.Propositional.Properties.WithK where open import Data.Emptyopen import Data.List using (List)open import Data.List.Membership.Propositionalopen import Data.List.Relation.Binary.BagAndSetEqualityopen import Data.List.Relation.Unary.All.Propertiesopen import Data.List.Relation.Unary.Anyopen import Data.List.Relation.Unary.Unique.Propositionalopen import Data.Productopen import Function.Bundlesopen import Level using (Level)open import Relation.Binary.PropositionalEqualityopen import Relation.Nullary private variable a : Level A : Set a l l' : List A -------------------------------------------------------------------------- membership unique⇒∈-prop : Unique l → (x : A) → Irrelevant (x ∈ l)unique⇒∈-prop (hx ∷ h) x (here refl) (here refl) = reflunique⇒∈-prop (hx ∷ h) x (here refl) (there b) = ⊥-elim (All¬⇒¬Any hx b)unique⇒∈-prop (hx ∷ h) x (there a) (here refl) = ⊥-elim (All¬⇒¬Any hx a)unique⇒∈-prop (hx ∷ h) x (there a) (there b) rewrite unique⇒∈-prop h x a b = refl unique∧set⇒bag : Unique l → Unique l' → l ∼[ set ] l' → l ∼[ bag ] l'unique∧set⇒bag h h' eq {a} = record { to = to ; from = from ; to-cong = to-cong ; from-cong = from-cong ; inverse = (λ {x} {y} _ → unique⇒∈-prop h' a (to y) x) , (λ {x} {y} _ → unique⇒∈-prop h a (from y) x) } where open Equivalence (eq {a})