extra files

This commit is contained in:
wadler 2019-10-14 12:18:28 +01:00
parent 7daec17224
commit 2a68a579fb
3 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,18 @@
#### Exercise `Any-∃` (practice)
Show that `Any P xs` is isomorphic to `∃[ x ] (x ∈ xs × P x)`.
```
Any-∃ : ∀ {A : Set} {P : A → Set} {xs : List A} → Any P xs ≃ ∃[ x ] (x ∈ xs × P x)
Any-∃ {A} {P} {xs} = record
{ to = to
; from = {!!}
; from∘to = {!!}
; to∘from = {!!} }
where
to : ∀ {A : Set} {P : A → Set} {xs : List A} → Any P xs → ∃[ x ] (x ∈ xs × P x)
to (here {x = x} px) = ⟨ x , ⟨ here refl , px ⟩ ⟩
to (there anyp) with to anyp
... | ⟨ x , ⟨ x∈xs , px ⟩ ⟩ = ⟨ x , ⟨ there x∈xs , px ⟩ ⟩
```

7
extra/extra/Rec1.agda Normal file
View file

@ -0,0 +1,7 @@
module Rec1 where
import Rec2
y :
y = x

10
extra/extra/Rec2.agda Normal file
View file

@ -0,0 +1,10 @@
module Rec2 where
open import Data.Nat
open import Rec1
x :
x = 42
z :
z = y