Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nicola Botta
IdrisLibs2
Commits
32afa394
Commit
32afa394
authored
Dec 21, 2020
by
Nicola Botta
Browse files
Initial.
parent
3f88ca4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Pair/Properties.lidr
0 → 100644
View file @
32afa394
module Pair.Properties
Pair/tmp/Properties.idr
0 → 100644
View file @
32afa394
module Pair.Properties
import Isomorphism.Isomorphism
import Isomorphism.Properties
import FiniteAsSigmaType.Finite
import FiniteAsSigmaType.Properties
import Sigma.Sigma
import Sigma.Operations
|||
public export
tuplePairIso3 : {a, b, c : Type} -> Iso (a, b, c) ((a, b), c)
tuplePairIso3 {a} {b} {c} = MkIso to from ok1 ok2
where to : (a, b, c) -> ((a, b), c)
to (x, y, z) = ((x, y), z)
from : ((a, b), c) -> (a, b, c)
from ((x, y), z) = (x, y, z)
ok1 : (x : ((a, b), c)) -> to (from x) = x
ok1 ((x, y), z) = Refl
ok2 : (x : (a, b, c)) -> from (to x) = x
ok2 (x, y, z) = Refl
|||
public export
tuplePairIso4 : {a, b, c, d : Type} -> Iso (a, b, c, d) ((a, b, c), d)
tuplePairIso4 {a} {b} {c} {d} = MkIso to from ok1 ok2
where to : (a, b, c, d) -> ((a, b, c), d)
to (w, x, y, z) = ((w, x, y), z)
from : ((a, b, c), d) -> (a, b, c, d)
from ((w, x, y), z) = (w, x, y, z)
ok1 : (x : ((a, b, c), d)) -> to (from x) = x
ok1 ((w, x, y), z) = Refl
ok2 : (x : (a, b, c, d)) -> from (to x) = x
ok2 (w, x, y, z) = Refl
-- Finiteness of pairs and tuples
||| If |P| and |Q| are finite, |(P , Q)| is finite
public export
finitePair : {a, b : Type} -> Finite a -> Finite b -> Finite (a, b)
finitePair = finiteProduct
||| Tuples of 3 finite types are finite
public export
finiteTuple3 : {a, b, c : Type} ->
Finite a -> Finite b -> Finite c ->
Finite (a, b, c)
finiteTuple3 {a} {b} {c} fa fb fc =
MkSigma _ (isoTrans (tuplePairIso3 {a} {b} {c}) (outr fabc)) where
fab : Finite (a, b)
fab = finiteProduct fa fb
fabc : Finite ((a, b), c)
fabc = finiteProduct fab fc
||| Tuples of 4 finite types are finite
public export
finiteTuple4 : {a, b, c, d : Type} ->
Finite a -> Finite b -> Finite c -> Finite d ->
Finite (a, b, c, d)
finiteTuple4 {a} {b} {c} {d} fa fb fc fd =
MkSigma _ (isoTrans (tuplePairIso4 {a} {b} {c} {d}) (outr fabcd)) where
fabc : Finite (a, b, c)
fabc = finiteTuple3 fa fb fc
fabcd : Finite ((a, b, c), d)
fabcd = finiteProduct fabc fd
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment