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
eda5a110
Commit
eda5a110
authored
Dec 21, 2020
by
Nicola Botta
Browse files
Initial.
parent
7f0148a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Bool/Properties.lidr
0 → 100644
View file @
eda5a110
> module Bool.Properties
> import Data.Fin
> import Control.Isomorphism
> import Basic.Predicates
> import Finite.Predicates
> import Sigma.Sigma
> %default total
> %access public export
> %auto_implicits off
> ||| Bool is not empty
> notEmptyBool : Not (Empty Bool)
> notEmptyBool = \ contra => contra False
> ||| Bool is finite
> finiteBool : Finite Bool
> finiteBool = MkSigma 2 (MkIso to from toFrom fromTo) where
>
> to : Bool -> Fin 2
> to False = FZ
> to True = FS FZ
>
> from : Fin 2 -> Bool
> from FZ = False
> from (FS FZ) = True
> from (FS (FS k)) = absurd k
> toFrom : (k : Fin 2) -> to (from k) = k
> toFrom FZ = Refl
> toFrom (FS FZ) = Refl
> toFrom (FS (FS k)) = absurd k
> fromTo : (b : Bool) -> from (to b) = b
> fromTo False = Refl
> fromTo True = Refl
> ||| Equality of Bools is decidable
> decidableEqBool : DecEq Bool
> decidableEqBool = %implementation
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