Skip to content

Commit c152a4a

Browse files
authored
Add variant of first? to Data.List.Relation.Unary.First.Properties (#1475)
1 parent bfb790f commit c152a4a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,11 @@ Other minor additions
448448
all-upTo : All (_< n) (upTo n)
449449
```
450450

451+
* Added new proof in `Data.List.Relation.Unary.First.Properties`:
452+
```agda
453+
cofirst? : Decidable P → Decidable (First (∁ P) P)
454+
```
455+
451456
* Added new operations in `Data.List.Relation.Unary.Linked`:
452457
```agda
453458
head′ : Linked R (x ∷ xs) → Connected R (just x) (head xs)

src/Data/List/Relation/Unary/First/Properties.agda

+5
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ module _ {a p} {A : Set a} {P : Pred A p} where
8585
$ Sum.map₂ (All⇒¬First contradiction)
8686
$ first (Sum.fromDec ∘ P?) xs
8787

88+
cofirst? : Decidable P Decidable (First (∁ P) P)
89+
cofirst? P? xs = Sum.toDec
90+
$ Sum.map₂ (All⇒¬First id)
91+
$ first (Sum.swap ∘ Sum.fromDec ∘ P?) xs
92+
8893
------------------------------------------------------------------------
8994
-- Conversion to Any
9095

0 commit comments

Comments
 (0)