Notation.General
Martin Escardo. General terminology and notation.{-# OPTIONS --safe --without-K #-} module Notation.General where open import MLTT.Pi open import MLTT.Sigma open import MLTT.Universes open import MLTT.Id open import MLTT.Negation publicThe notation `Type π€` should be avoided in favour of `π€ Μ`, but some module do use it.Type = Set Typeβ = Setβ fiber : {X : π€ Μ } {Y : π₯ Μ } β (X β Y) β Y β π€ β π₯ Μ fiber f y = Ξ£ x κ domain f , f x οΌ y to-fiber : {X : π€ Μ } {Y : π₯ Μ } (f : X β Y) (x : X) β fiber f (f x) to-fiber f x = x , refl fiber-point : {X : π€ Μ } {Y : π₯ Μ } {f : X β Y} {y : Y} β fiber f y β X fiber-point = prβ fiber-identification : {X : π€ Μ } {Y : π₯ Μ } {f : X β Y} {y : Y} (w : fiber f y) β f (fiber-point w) οΌ y fiber-identification = prβ each-fiber-of : {X : π€ Μ } {Y : π₯ Μ } β (X β Y) β (π€ β π₯ Μ β π¦ Μ ) β π₯ β π¦ Μ each-fiber-of f P = β y β P (fiber f y) fix : {X : π€ Μ } β (f : X β X) β π€ Μ fix f = Ξ£ x κ domain f , x οΌ f x from-fix : {X : π€ Μ } (f : X β X) β fix f β X from-fix f = prβ from-fix-is-fixed : {X : π€ Μ } (f : X β X) (Ο : fix f) β from-fix f Ο οΌ f (from-fix f Ο) from-fix-is-fixed f = prβ 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) 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' right-cancellable : {X : π€ Μ } {Y : π₯ Μ } β (X β Y) β π€Ο right-cancellable f = {π¦ : Universe} {Z : π¦ Μ } (g h : codomain f β Z) β g β f βΌ h β f β g βΌ h _β_ : π€ Μ β π₯ Μ β π€ β π₯ Μ 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β β-sym : {X : π€' Μ } {Y : π₯' Μ } β X β Y β Y β X β-sym (f , g) = (g , f) β-trans : {X : π€' Μ } {Y : π₯' Μ } {Z : π¦' Μ } β X β Y β Y β Z β X β Z β-trans (f , g) (h , k) = (h β f , g β k) β-refl : {X : π€' Μ } β X β X β-refl = (id , id)This is to avoid naming implicit arguments:type-of : {X : π€ Μ } β X β π€ Μ type-of {π€} {X} x = XWe use the following to indicate the type of a subterm (where "βΆ" (typed "\:" in emacs) is not the same as ":"):-id : (X : π€ Μ ) β X β X -id X x = x syntax -id X x = x βΆ XThis is used for efficiency as a substitute for lazy "let" (or "where"):case_of_ : {A : π€ Μ } {B : A β π₯ Μ } β (a : A) β ((a : A) β B a) β B a case x of f = f x Case_of_ : {A : π€ Μ } {B : A β π₯ Μ } β (a : A) β ((x : A) β a οΌ x β B a) β B a Case x of f = f x refl {-# NOINLINE case_of_ #-}Notation to try to make proofs readable:need_which-is-given-by_ : (A : π€ Μ ) β A β A need A which-is-given-by a = a have_by_ : (A : π€ Μ ) β A β A have A 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 MapstoGet rid of this:Ξ£! : {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!Note: Ξ£! is to be avoided, in favour of the contractibility of Ξ£, following univalent mathematics. Ian Ray, 3rd December 2025. We add a new syntax where we reason with functions chained in sequence which is analogous to reasoning by chains of equations or equivalences (see MLTT/Id.lagda and UF/Equiv.lagda to review these ideas). We will include both compostional and diagrammatic order. Notice that reasoning in compositional order with g : B β C and f : A β B C ββ¨ g β© B ββ¨ f β© A β’ amounts to a function A β C (via normal composition), but it appears in the 'bottom up' direction. This may seem strange at first, as one might expect this feature to only be useful in the forward direction, that is, in diagrammatic order. In fact, the above actually reflects a common mode of proof where one proves C by observing it suffices to prove B (and supplying a map from B to C) and then proving B by observing it suffices to prove A (and supplying a map from A to B). For this reason we provide notation that allows us to display proofs of this sort._ββ¨_β©_ : (X : π€ Μ ) {Y : π₯ Μ } {Z : π¦ Μ } β (X β Y) β (Y β Z) β (X β Z) _ ββ¨ f β© g = g β f _ββ¨_β©_ : {X : π€ Μ } {Y : π₯ Μ } (Z : π¦ Μ ) β (Y β Z) β (X β Y) β (X β Z) _ ββ¨ g β© f = g β f _suffices-to-showβ¨_β©_ : {X : π€ Μ } {Y : π₯ Μ } (Z : π¦ Μ ) β (Y β Z) β (X β Y) β (X β Z) _ suffices-to-showβ¨ g β© f = g β f _β’ : (X : π€ Μ ) β X β X X β’ = id by-instance-resolution : {X : π€ Μ } β {{X}} β X by-instance-resolution {{x}} = xFixities:infixl -1 -id infix -1 _β_ infixr 0 _ββ¨_β©_ infixr 0 _ββ¨_β©_ infixr 0 _suffices-to-showβ¨_β©_ infix 1 _β’