General terminology and notation.
\begin{code}
{-# OPTIONS --without-K --exact-split --safe #-}
module GeneralNotation where
open import Sigma
open import Universes
open import Id
open import Negation public
Type = Set
Typeโ = Setโ
reflexive : {X : ๐ค ฬ } โ (X โ X โ ๐ฅ ฬ ) โ ๐ค โ ๐ฅ ฬ
reflexive R = โ x โ R x x
symmetric : {X : ๐ค ฬ } โ (X โ X โ ๐ฅ ฬ ) โ ๐ค โ ๐ฅ ฬ
symmetric R = โ x y โ R x y โ R y x
antisymmetric : {X : ๐ค ฬ } โ (X โ X โ ๐ฅ ฬ ) โ ๐ค โ ๐ฅ ฬ
antisymmetric R = โ x y โ R x y โ R y x โ x โก y
transitive : {X : ๐ค ฬ } โ (X โ X โ ๐ฅ ฬ ) โ ๐ค โ ๐ฅ ฬ
transitive R = โ x y z โ R x y โ R y z โ R x z
idempotent-map : {X : ๐ฅ ฬ } โ (f : X โ X) โ ๐ฅ ฬ
idempotent-map f = โ x โ f (f x) โก f x
involutive : {X : ๐ฅ ฬ } โ (f : X โ X) โ ๐ฅ ฬ
involutive f = โ x โ f (f x) โก x
left-neutral : {X : ๐ค ฬ } โ X โ (X โ X โ X) โ ๐ค ฬ
left-neutral e _ยท_ = โ x โ e ยท x โก x
right-neutral : {X : ๐ค ฬ } โ X โ (X โ X โ X) โ ๐ค ฬ
right-neutral e _ยท_ = โ x โ x ยท e โก x
associative : {X : ๐ค ฬ } โ (X โ X โ X) โ ๐ค ฬ
associative _ยท_ = โ x y z โ (x ยท y) ยท z โก x ยท (y ยท z)
commutative : {X : ๐ค ฬ } โ (X โ X โ X) โ ๐ค ฬ
commutative _ยท_ = โ x y โ (x ยท y) โก (y ยท x)
left-cancellable : {X : ๐ค ฬ } {Y : ๐ฅ ฬ } โ (X โ Y) โ ๐ค โ ๐ฅ ฬ
left-cancellable f = โ {x x'} โ f x โก f x' โ x โก x'
left-cancellable' : {X : ๐ค ฬ } {Y : ๐ฅ ฬ } โ (X โ Y) โ ๐ค โ ๐ฅ ฬ
left-cancellable' f = โ x x' โ f x โก f x' โ x โก x'
_โ_ : ๐ค ฬ โ ๐ฅ ฬ โ ๐ค โ ๐ฅ ฬ
A โ B = (A โ B) ร (B โ A)
lr-implication : {X : ๐ค ฬ } {Y : ๐ฅ ฬ } โ (X โ Y) โ (X โ Y)
lr-implication = prโ
rl-implication : {X : ๐ค ฬ } {Y : ๐ฅ ฬ } โ (X โ Y) โ (Y โ X)
rl-implication = prโ
\end{code}
This is to avoid naming implicit arguments:
\begin{code}
type-of : {X : ๐ค ฬ } โ X โ ๐ค ฬ
type-of {๐ค} {X} x = X
\end{code}
We use the following to indicate the type of a subterm (where "โถ"
(typed "\:" in emacs) is not the same as ":"):
\begin{code}
-id : (X : ๐ค ฬ ) โ X โ X
-id X x = x
syntax -id X x = x โถ X
\end{code}
This is used for efficiency as a substitute for lazy "let" (or "where"):
\begin{code}
case_of_ : {A : ๐ค ฬ } {B : A โ ๐ฅ ฬ } โ (a : A) โ ((a : A) โ B a) โ B a
case x of f = f x
{-# NOINLINE case_of_ #-}
\end{code}
Notation to try to make proofs readable:
\begin{code}
need_which-is-given-by_ : (A : ๐ค ฬ ) โ A โ A
need A which-is-given-by a = a
have_so_ : {A : ๐ค ฬ } {B : ๐ฅ ฬ } โ A โ B โ B
have a so b = b
have_so-use_ : {A : ๐ค ฬ } {B : ๐ฅ ฬ } โ A โ B โ B
have a so-use b = b
have_and_ : {A : ๐ค ฬ } {B : ๐ฅ ฬ } โ A โ B โ B
have a and b = b
apply_to_ : {A : ๐ค ฬ } {B : ๐ฅ ฬ } โ (A โ B) โ A โ B
apply f to a = f a
have_so-apply_ : {A : ๐ค ฬ } {B : ๐ฅ ฬ } โ A โ (A โ B) โ B
have a so-apply f = f a
assume-then : (A : ๐ค ฬ ) {B : A โ ๐ฅ ฬ } โ ((a : A) โ B a) โ (a : A) โ B a
assume-then A f x = f x
syntax assume-then A (ฮป x โ b) = assume x โถ A then b
assume-and : (A : ๐ค ฬ ) {B : A โ ๐ฅ ฬ } โ ((a : A) โ B a) โ (a : A) โ B a
assume-and A f x = f x
syntax assume-and A (ฮป x โ b) = assume x โถ A and b
mapsto : {A : ๐ค ฬ } {B : A โ ๐ฅ ฬ } โ ((a : A) โ B a) โ (a : A) โ B a
mapsto f = f
syntax mapsto (ฮป x โ b) = x โฆ b
infixr 10 mapsto
Mapsto : (A : ๐ค ฬ ) {B : A โ ๐ฅ ฬ } โ ((a : A) โ B a) โ (a : A) โ B a
Mapsto A f = f
syntax Mapsto A (ฮป x โ b) = x ๊ A โฆ b
infixr 10 Mapsto
\end{code}
Get rid of this:
\begin{code}
ฮฃ! : {X : ๐ค ฬ } (A : X โ ๐ฅ ฬ ) โ ๐ค โ ๐ฅ ฬ
ฮฃ! {๐ค} {๐ฅ} {X} A = (ฮฃ x ๊ X , A x) ร ((x x' : X) โ A x โ A x' โ x โก x')
Sigma! : (X : ๐ค ฬ ) (A : X โ ๐ฅ ฬ ) โ ๐ค โ ๐ฅ ฬ
Sigma! X A = ฮฃ! A
syntax Sigma! A (ฮป x โ b) = ฮฃ! x ๊ A , b
infixr -1 Sigma!
\end{code}
Note: ฮฃ! is to be avoided, in favour of the contractibility of ฮฃ,
following univalent mathematics.
Fixities:
\begin{code}
infixl -1 -id
infix -1 _โ_
\end{code}