Skip to content

Commit 7e94c15

Browse files
authored
[DRY] refactor #2479 (#2485)
* [DRY] refactoring * remove deprecations; leave lemma renamed
1 parent 45a46f7 commit 7e94c15

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ Additions to existing modules
155155
∈-concatMap⁻ : y ∈ concatMap f xs → Any ((y ∈_) ∘ f) xs
156156
++-∈⇔ : v ∈ xs ++ ys ⇔ (v ∈ xs ⊎ v ∈ ys)
157157
[]∉map∷ : [] ∉ map (x ∷_) xss
158+
map∷⁻ : xs ∈ map (y ∷_) xss → ∃[ ys ] ys ∈ xss × xs ≡ y ∷ ys
158159
map∷-decomp∈ : (x ∷ xs) ∈ map (y ∷_) xss → x ≡ y × xs ∈ xss
159-
map∷-decomp : xs ∈ map (y ∷_) xss → ∃[ ys ] ys ∈ xss × y ∷ ys ≡ xs
160160
∈-map∷⁻ : xs ∈ map (x ∷_) xss → x ∈ xs
161161
∉[] : x ∉ []
162162
deduplicate-∈⇔ : z ∈ xs ⇔ z ∈ deduplicate _≈?_ xs

src/Data/List/Membership/Propositional/Properties.agda

+6-14
Original file line numberDiff line numberDiff line change
@@ -454,22 +454,14 @@ module _ {R : A → A → Set ℓ} where
454454
------------------------------------------------------------------------
455455
-- nested lists
456456

457+
map∷⁻ : xs ∈ map (y ∷_) xss ∃[ ys ] ys ∈ xss × xs ≡ y ∷ ys
458+
map∷⁻ = ∈-map⁻ (_ ∷_)
459+
457460
[]∉map∷ : (List A ∋ []) ∉ map (x ∷_) xss
458-
[]∉map∷ {xss = _ ∷ _} (there p) = []∉map∷ p
461+
[]∉map∷ p with () map∷ p
459462

460463
map∷-decomp∈ : (List A ∋ x ∷ xs) ∈ map (y ∷_) xss x ≡ y × xs ∈ xss
461-
map∷-decomp∈ {xss = _ ∷ _} = λ where
462-
(here refl) refl , here refl
463-
(there p) map₂ there $ map∷-decomp∈ p
464-
465-
map∷-decomp : xs ∈ map (y ∷_) xss ∃[ ys ] ys ∈ xss × y ∷ ys ≡ xs
466-
map∷-decomp {xss = _ ∷ _} (here refl) = -, here refl , refl
467-
map∷-decomp {xs = []} {xss = _ ∷ _} (there xs∈) = contradiction xs∈ []∉map∷
468-
map∷-decomp {xs = x ∷ xs} {xss = _ ∷ _} (there xs∈) =
469-
let eq , p = map∷-decomp∈ xs∈
470-
in -, there p , cong (_∷ _) (sym eq)
464+
map∷-decomp∈ p with _ , xs∈xss , refl map∷⁻ p = refl , xs∈xss
471465

472466
∈-map∷⁻ : xs ∈ map (x ∷_) xss x ∈ xs
473-
∈-map∷⁻ {xss = _ ∷ _} = λ where
474-
(here refl) here refl
475-
(there p) ∈-map∷⁻ p
467+
∈-map∷⁻ p with _ , _ , refl map∷⁻ p = here refl

0 commit comments

Comments
 (0)