Martin Escardo, 30 May - 3rd June 2020. Further additions 6th July.
We look at
* Quasidecidable propositions (generalizing semidecidable propositions).
* The initial ฯ-frame.
* The free ฯ-sup-lattice on one generator.
Their definitions are given below verbally and in Agda.
We work in a spartan univalent type theory with ฮ , ฮฃ, +, Id, ๐, ๐, โ,
perhaps W-types, universes, propositional-truncation, propositional
extensionality and function extensionality - univalence is not
needed. Most of the time full univalence is not needed - propositional
and functional extenstionality suffice. Sometimes we also consider
propositional resizing, as an explicit assumption each time it is
used.
The above notions don't seem to be definable in our spartan univalent
type theory (but they are definable with higher-inductive
types). Their specifications are as follows:
* Quasidecidable propositions.
They are the smallest set of propositions closed under ๐,๐, and
countable existential quantification, or countable joins in the
frame of propositions.
They form a dominance.
* The initial ฯ-frame.
A ฯ-frame has finite meets โค and โง and countable joins โ, such
that โง distributes over โ, with homomorphisms that preserve them.
* The free ฯ-sup-lattice on one generator.
A ฯ-sup-lattice has an empty join โฅ and countable joins โ with
homomorphisms that preserve them. It automatically has binary
joins, which are automatically preserved by homomorphisms, and the
generator is automatically the maximum element.
We have:
* The type of quasidecidable propositions exists if and only if the
free ฯ-sup-lattice on one generator exists.
The quasidecidable propositions form a dominance.
* The free ฯ-sup-lattice on one generator, if it exists, is also the
initial ฯ-frame.
We have that ฯ-sup-lattice homomorphisms from the free
ฯ-sup-lattice on one generator into a ฯ-frame qua ฯ-sup-lattice
automatically preserve finite meets and hence are ฯ-frame
homomorphisms.
* Assuming that the free ฯ-sup-lattice on one generator exists, we
have that ฯ-sup-lattices (and hence ฯ-frames) have joins of
families indexed by quasidecidable propositions.
\begin{code}
{-# OPTIONS --safe --without-K #-}
open import MLTT.Spartan
open import UF.FunExt
open import UF.PropTrunc
open import UF.Sets
open import UF.Subsingletons
open import UF.SubtypeClassifier renaming (โฅ to โฅฮฉ ; โค to โคฮฉ)
open import UF.SubtypeClassifier-Properties
\end{code}
We assume function extensionality, propositional extensionality and
the existence of propositional truncations, as explicit hypotheses for
this file.
\begin{code}
module NotionsOfDecidability.QuasiDecidable
(fe : Fun-Ext)
(pe : Prop-Ext)
(pt : propositional-truncations-exist)
where
open import UF.Size
import OrderedTypes.Frame
import OrderedTypes.sigma-frame
import OrderedTypes.sigma-sup-lattice
open PropositionalTruncation pt
\end{code}
The following three definitions are parametrized by a universe ๐ฃ,
which we may wish to be the first universe ๐คโ in practice.
We adopt the following notational conventions:
* ๐ฃ is the universe where the quasidecidable truth values live.
Typically ๐ฃ will be ๐คโ or ๐คโ.
* ๐ is the universe where the knowledge they are quasidecidable lives.
Typically ๐ will be ๐ฃ or ๐ฃ โบ
Recall that ๐ค, ๐ฅ, ๐ฆ, ๐ฃ range over universes. We add ๐ to this list.
\begin{code}
variable ๐ : Universe
\end{code}
The notion of existence of quasidecidable propositions, formulated as
a record:
\begin{code}
record quasidecidable-propositions-exist (๐ฃ ๐ : Universe) : ๐คฯ where
constructor
quasidecidable-propositions
field
is-quasidecidable : ๐ฃ ฬ โ ๐ ฬ
being-quasidecidable-is-prop : โ P โ is-prop (is-quasidecidable P)
๐-is-quasidecidable : is-quasidecidable ๐
๐-is-quasidecidable : is-quasidecidable ๐
quasidecidable-closed-under-ฯ-joins
: (P : โ โ ๐ฃ ฬ )
โ ((n : โ) โ is-quasidecidable (P n))
โ is-quasidecidable (โ n ๊ โ , P n)
quasidecidable-induction
: โ {๐ค}
(F : ๐ฃ ฬ โ ๐ค ฬ )
โ ((P : ๐ฃ ฬ ) โ is-prop (F P))
โ F ๐
โ F ๐
โ ((P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n))
โ (P : ๐ฃ ฬ ) โ is-quasidecidable P โ F P
\end{code}
(It follows automatically that quasidecidable types are propositions -
see below.)
We also formulate the existence of the initial ฯ-frame as a record.
\begin{code}
record initial-ฯ-frame-exists (๐ฃ : Universe) : ๐คฯ where
constructor
initial-ฯ-frame
open OrderedTypes.sigma-frame fe
field
๐ : ฯ-Frame ๐ฃ
๐-is-initial : {๐ค : Universe} (๐ : ฯ-Frame ๐ค)
โ โ! f ๊ (โจ ๐ โฉ โ โจ ๐ โฉ), is-ฯ-frame-hom ๐ ๐ f
\end{code}
And finally the existence of the free ฯ-sup-lattice on one generator,
called โค (because it will be automatically the top element).
\begin{code}
record free-ฯ-SupLat-on-one-generator-exists (๐ฃ ๐ : Universe) : ๐คฯ where
constructor
free-ฯ-SupLat-on-one-generator
open OrderedTypes.sigma-sup-lattice fe
field
๐ : ฯ-SupLat ๐ฃ ๐
โค : โจ ๐ โฉ
๐-free : {๐ฅ ๐ฆ : Universe} (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ)
โ โ! f ๊ (โจ ๐ โฉ โ โจ ๐ โฉ) , is-ฯ-suplat-hom ๐ ๐ f
ร (f โค ๏ผ t)
\end{code}
The main theorems are as follows, where the proofs are given after we
have developed enough material:
\begin{code}
theoremโ : quasidecidable-propositions-exist ๐ฃ ๐
โ free-ฯ-SupLat-on-one-generator-exists (๐ฃ โบ โ ๐) ๐ฃ
theoremโ : free-ฯ-SupLat-on-one-generator-exists ๐ฃ ๐ค
โ quasidecidable-propositions-exist ๐ฃ ๐ฃ
theoremโ : free-ฯ-SupLat-on-one-generator-exists ๐ฃ ๐
โ initial-ฯ-frame-exists ๐ฃ
theoremโ : Propositional-Resizing
โ quasidecidable-propositions-exist ๐ฃ ๐
\end{code}
* We first work with a hypothetical collection of quasidecidable
propositions and show that they form the initial ฯ-frame.
This is in the submodule hypothetical-quasidecidability.
* Then we construct it assuming propositional resizing.
This is in the submodule quasidecidability-construction-from-resizing.
* Assuming a hypothetical free ฯ-sup-lattice on one generator, it is
automatically the initial ฯ-frame, and from it we can define the
notion of quasidecidable proposition.
Can we construct them without resizing and without higher-inductive
types other than propositional truncation?
\begin{code}
open import UF.Base
open import UF.Embeddings
open import UF.Equiv
open import UF.Equiv-FunExt
open import UF.EquivalenceExamples
open import UF.Powerset
open import UF.Subsingletons-FunExt
open import UF.UA-FunExt
open import UF.Yoneda
open import Dominance.Definition
\end{code}
Digression. Before considering quasidecidable propositions, we review
semidecidable ones.
A proposition is semidecidable if it is a countable join of decidable
propositions. See the paper
https://www.cs.bham.ac.uk/~mhe/papers/partial-elements-and-recursion.pdf
by Martin Escardo and Cory Knapp.
NB. Semidecidable propositions are called Rosolini propositions in the
above reference.
\begin{code}
is-semidecidable : ๐ค ฬ โ ๐ค ฬ
is-semidecidable X = โ ฮฑ ๊ (โ โ ๐), X โ (โ n ๊ โ , ฮฑ n ๏ผ โ)
\end{code}
Exercise. X is semidecidable iff it is a countable join of decidable
propositions:
\begin{code}
is-semidecidable' : ๐ค ฬ โ ๐ค โบ ฬ
is-semidecidable' {๐ค} X = โ A ๊ (โ โ ๐ค ฬ )
, ((n : โ) โ is-decidable (A n))
ร (X โ (โ n ๊ โ , A n))
\end{code}
The following shows that we need to truncate, because the Cantor type
(โ โ ๐) is certainly not the type of semidecidable propositions:
\begin{code}
semidecidability-data : ๐ค ฬ โ ๐ค ฬ
semidecidability-data X = ฮฃ ฮฑ ๊ (โ โ ๐), X โ (โ n ๊ โ , ฮฑ n ๏ผ โ)
module only-use-of-univalence-in-this-file where
open import UF.Univalence
totality-of-semidecidability-data
: is-univalent ๐คโ
โ (ฮฃ X ๊ ๐คโ ฬ , semidecidability-data X) โ (โ โ ๐)
totality-of-semidecidability-data ua =
(ฮฃ X ๊ ๐คโ ฬ , ฮฃ ฮฑ ๊ (โ โ ๐), X โ (โ n ๊ โ , ฮฑ n ๏ผ โ)) โโจ i โฉ
(ฮฃ ฮฑ ๊ (โ โ ๐), ฮฃ X ๊ ๐คโ ฬ , X โ (โ n ๊ โ , ฮฑ n ๏ผ โ)) โโจ ii โฉ
(ฮฃ ฮฑ ๊ (โ โ ๐), ฮฃ X ๊ ๐คโ ฬ , (โ n ๊ โ , ฮฑ n ๏ผ โ) โ X) โโจ iii โฉ
(โ โ ๐) ร ๐ {๐คโ} โโจ iv โฉ
(โ โ ๐) โ
where
i = ฮฃ-flip
ii = ฮฃ-cong (ฮป ฮฑ โ ฮฃ-cong (ฮป X โ โ-Sym'' (univalence-gives-funext ua)))
iii = ฮฃ-cong (ฮป ฮฑ โ singleton-โ-๐
(univalence-via-singletonsโ
ua
(โ n ๊ โ , ฮฑ n ๏ผ โ)))
iv = ๐-rneutral
\end{code}
End of module only-use-of-univalence-in-this-file.
\begin{code}
๐ข : ๐คโ ฬ
๐ข = ฮฃ X ๊ ๐คโ ฬ , is-semidecidable X
\end{code}
The type ๐ข of semidecidable propositions is not a ฯ-frame unless we
have enough countable choice - see the Escardo-Knapp reference above.
End of digression.
The set of quasidecidable propositions, if it exists, is the smallest
collection of propositions containing ๐ and ๐ and closed under
countable joins.
Exercise. It exists under propositional resizing assumptions (just
take the intersection of all subsets with ๐ and ๐ as members and
closed under countable joins). This exercise is solved below in the
submodule quasidecidability-construction-from-resizing.
We now assume that there is a such a smallest collection of types,
called quasidecidable, satisfying the above closure property. The
types in this collection are automatically propositions. The
minimality condition of the collection amounts to an induction
principle.
We recall the above conventions:
* ๐ฃ is the universe where the quasidecidable truth values live.
Typically ๐ฃ will be ๐คโ or ๐คโ.
* ๐ is the universe where the knowledge they are quasidecidable lives.
Typically ๐ will be ๐ฃ or ๐ฃโบ.
\begin{code}
module hypothetical-quasidecidability
{๐ฃ ๐ : Universe}
(qde : quasidecidable-propositions-exist ๐ฃ ๐)
where
\end{code}
As promised, the quasidecidable types are automatically propositions,
with a proof by induction:
\begin{code}
open quasidecidable-propositions-exist qde
quasidecidable-types-are-props : โ P โ is-quasidecidable P โ is-prop P
quasidecidable-types-are-props = quasidecidable-induction
is-prop
(ฮป _ โ being-prop-is-prop fe)
๐-is-prop
๐-is-prop
(ฮป P ฯ โ โ-is-prop)
\end{code}
We collect the quasidecidable propositions in the type ๐ :
\begin{code}
๐ : ๐ฃ โบ โ ๐ ฬ
๐ = ฮฃ P ๊ ๐ฃ ฬ , is-quasidecidable P
_is-true : ๐ โ ๐ฃ ฬ
_is-true (P , i) = P
being-true-is-quasidecidable : (๐ก : ๐ ) โ is-quasidecidable (๐ก is-true)
being-true-is-quasidecidable (P , i) = i
being-true-is-prop : (๐ก : ๐ ) โ is-prop (๐ก is-true)
being-true-is-prop (P , i) = quasidecidable-types-are-props P i
๐ -to-ฮฉ : ๐ โ ฮฉ ๐ฃ
๐ -to-ฮฉ (P , i) = P , quasidecidable-types-are-props P i
๐ -to-ฮฉ-is-embedding : is-embedding ๐ -to-ฮฉ
๐ -to-ฮฉ-is-embedding = Natฮฃ-is-embedding
is-quasidecidable
is-prop
ฮถ
ฮถ-is-embedding
where
ฮถ : (P : ๐ฃ ฬ ) โ is-quasidecidable P โ is-prop P
ฮถ = quasidecidable-types-are-props
ฮถ-is-embedding : (P : ๐ฃ ฬ ) โ is-embedding (ฮถ P)
ฮถ-is-embedding P = maps-of-props-are-embeddings (ฮถ P)
(being-quasidecidable-is-prop P)
(being-prop-is-prop fe)
๐ -is-set : is-set ๐
๐ -is-set = subtypes-of-sets-are-sets ๐ -to-ฮฉ
๐ -to-ฮฉ-is-embedding
(ฮฉ-is-set fe pe)
โฅ : ๐
โฅ = ๐ , ๐-is-quasidecidable
โค : ๐
โค = ๐ , ๐-is-quasidecidable
โ : (โ โ ๐ ) โ ๐
โ ๐ก = (โ n ๊ โ , ๐ก n is-true) ,
quasidecidable-closed-under-ฯ-joins
(ฮป n โ ๐ก n is-true)
(ฮป n โ being-true-is-quasidecidable (๐ก n))
\end{code}
We formulate and prove induction on ๐ in two different, equivalent
ways.
\begin{code}
๐ -induction : (G : ๐ โ ๐ค ฬ )
โ ((๐ก : ๐ ) โ is-prop (G ๐ก))
โ G โฅ
โ G โค
โ ((๐ก : โ โ ๐ ) โ ((n : โ) โ G (๐ก n)) โ G (โ ๐ก))
โ (๐ก : ๐ ) โ G ๐ก
๐ -induction {๐ค} G G-is-prop-valued gโ gโ gฯ (P , i) = ฮณ
where
F : ๐ฃ ฬ โ ๐ โ ๐ค ฬ
F P = ฮฃ j ๊ is-quasidecidable P , G (P , j)
F-is-prop-valued : โ P โ is-prop (F P)
F-is-prop-valued P = ฮฃ-is-prop
(being-quasidecidable-is-prop P)
(ฮป j โ G-is-prop-valued (P , j))
Fโ : F ๐
Fโ = ๐-is-quasidecidable , gโ
Fโ : F ๐
Fโ = ๐-is-quasidecidable , gโ
Fฯ : (Q : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (Q n)) โ F (โ n ๊ โ , Q n)
Fฯ Q ฯ = quasidecidable-closed-under-ฯ-joins Q (ฮป n โ prโ (ฯ n)) ,
gฯ (ฮป n โ (Q n , prโ (ฯ n))) (ฮป n โ prโ (ฯ n))
ฮด : ฮฃ j ๊ is-quasidecidable P , G (P , j)
ฮด = quasidecidable-induction F F-is-prop-valued Fโ Fโ Fฯ P i
j : is-quasidecidable P
j = prโ ฮด
g : G (P , j)
g = prโ ฮด
r : j ๏ผ i
r = being-quasidecidable-is-prop P j i
ฮณ : G (P , i)
ฮณ = transport (ฮป - โ G (P , -)) r g
๐ -induction' : (๐ : ๐ โ ฮฉ ๐ค)
โ โฅ โ ๐
โ โค โ ๐
โ ((๐ก : โ โ ๐ ) โ ((n : โ) โ ๐ก n โ ๐) โ โ ๐ก โ ๐)
โ (๐ก : ๐ ) โ ๐ก โ ๐
๐ -induction' {๐ค} ๐ = ๐ -induction (ฮป ๐ก โ prโ (๐ ๐ก)) (ฮป ๐ก โ prโ (๐ ๐ก))
\end{code}
The quasidecidable propositions form a dominance, with a proof by
quasidecidable-induction. The main dominance condition generalizes
closure under binary products (that is, conjunctions, or meets):
\begin{code}
quasidecidable-types-form-a-dominance
: (P : ๐ฃ ฬ )
โ is-quasidecidable P
โ (Q : ๐ฃ ฬ )
โ (P โ is-quasidecidable Q)
โ is-quasidecidable (P ร Q)
quasidecidable-types-form-a-dominance
= quasidecidable-induction F F-is-prop-valued Fโ Fโ Fฯ
where
F : ๐ฃ ฬ โ ๐ฃ โบ โ ๐ ฬ
F P = (Q : ๐ฃ ฬ ) โ (P โ is-quasidecidable Q) โ is-quasidecidable (P ร Q)
F-is-prop-valued : (P : ๐ฃ ฬ ) โ is-prop (F P)
F-is-prop-valued P = ฮ โ-is-prop fe
(ฮป Q _ โ being-quasidecidable-is-prop (P ร Q))
Fโ : F ๐
Fโ Q ฯ = transport is-quasidecidable r ๐-is-quasidecidable
where
r : ๐ ๏ผ ๐ ร Q
r = pe ๐-is-prop (ฮป (z , q) โ ๐-elim z) unique-from-๐ prโ
Fโ : F ๐
Fโ Q ฯ = transport is-quasidecidable r (ฯ โ)
where
i : is-prop Q
i = quasidecidable-types-are-props Q (ฯ โ)
r : Q ๏ผ ๐ ร Q
r = pe i (ร-is-prop ๐-is-prop i) (ฮป q โ (โ , q)) prโ
Fฯ : (P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n)
Fฯ P f Q ฯ = ฮณ
where
ฯ' : (n : โ) โ P n โ is-quasidecidable Q
ฯ' n p = ฯ โฃ n , p โฃ
a : (n : โ) โ is-quasidecidable (P n ร Q)
a n = f n Q (ฯ' n)
b : is-quasidecidable (โ n ๊ โ , P n ร Q)
b = quasidecidable-closed-under-ฯ-joins (ฮป n โ P n ร Q) a
c : (โ n ๊ โ , P n ร Q) โ ((โ n ๊ โ , P n) ร Q)
c s = (t , q)
where
t : โ n ๊ โ , P n
t = โฅโฅ-rec โ-is-prop (ฮป (n , (p , q)) โ โฃ n , p โฃ) s
i : is-prop Q
i = quasidecidable-types-are-props Q (ฯ t)
q : Q
q = โฅโฅ-rec i (ฮป (n , (p , q)) โ q) s
d : ((โ n ๊ โ , P n) ร Q) โ (โ n ๊ โ , P n ร Q)
d (t , q) = โฅโฅ-functor (ฮป (n , p) โ n , (p , q)) t
r : (โ n ๊ โ , P n ร Q) ๏ผ ((โ n ๊ โ , P n) ร Q)
r = pe โ-is-prop
(ร-prop-criterion
((ฮป _ โ โ-is-prop) ,
(ฮป e โ quasidecidable-types-are-props Q (ฯ e))))
c
d
ฮณ : is-quasidecidable ((โ n ๊ โ , P n) ร Q)
ฮณ = transport is-quasidecidable r b
\end{code}
This condition automatically implies closure under ฮฃ, or joins indexed
by quasidecidable propositions:
\begin{code}
quasidecidable-closed-under-ฮฃ
: (P : ๐ฃ ฬ )
โ (Q : P โ ๐ฃ ฬ )
โ is-quasidecidable P
โ ((p : P) โ is-quasidecidable (Q p))
โ is-quasidecidable (ฮฃ Q)
quasidecidable-closed-under-ฮฃ
= D3-and-D5'-give-D5 pe is-quasidecidable
(quasidecidable-types-are-props)
(ฮป P Q' i โ quasidecidable-types-form-a-dominance P i Q')
\end{code}
Notice that ฮฃ Q is equivalent to โ Q as quasidecidable types are
propositions, and propositions are closed under ฮฃ:
\begin{code}
NB : (P : ๐ฃ ฬ )
โ (Q : P โ ๐ฃ ฬ )
โ is-quasidecidable P
โ ((p : P) โ is-quasidecidable (Q p))
โ ฮฃ Q โ โ Q
NB P Q i j = logically-equivalent-props-are-equivalent
k
โ-is-prop
(ฮป (p , q) โ โฃ p , q โฃ)
(โฅโฅ-rec k id)
where
k : is-prop (ฮฃ Q)
k = quasidecidable-types-are-props
(ฮฃ Q)
(quasidecidable-closed-under-ฮฃ P Q i j)
\end{code}
The following summarizes the dominance conditions:
\begin{code}
quasidecidability-is-dominance : is-dominance is-quasidecidable
quasidecidability-is-dominance = being-quasidecidable-is-prop ,
quasidecidable-types-are-props ,
๐-is-quasidecidable ,
quasidecidable-closed-under-ฮฃ
\end{code}
We now give the quasidecidable propositions the structure of a
ฯ-sup-lattice. We have already defined โฅ, โค and โ.
\begin{code}
_โค_ : ๐ โ ๐ โ ๐ฃ ฬ
๐ก โค ๐ข = ๐ก is-true โ ๐ข is-true
โค-is-prop-valued : (๐ก ๐ข : ๐ ) โ is-prop (๐ก โค ๐ข)
โค-is-prop-valued ๐ก ๐ข = ฮ -is-prop fe (ฮป _ โ being-true-is-prop ๐ข)
โค-refl : (๐ก : ๐ ) โ ๐ก โค ๐ก
โค-refl ๐ก = id
โค-trans : (๐ก ๐ข ๐ฃ : ๐ ) โ ๐ก โค ๐ข โ ๐ข โค ๐ฃ โ ๐ก โค ๐ฃ
โค-trans ๐ก ๐ข ๐ฃ l m = m โ l
โค-antisym : (๐ก ๐ข : ๐ ) โ ๐ก โค ๐ข โ ๐ข โค ๐ก โ ๐ก ๏ผ ๐ข
โค-antisym ๐ก ๐ข l m = to-subtype-๏ผ
being-quasidecidable-is-prop
(pe (being-true-is-prop ๐ก) (being-true-is-prop ๐ข) l m)
โฅ-is-minimum : (๐ก : ๐ ) โ โฅ โค ๐ก
โฅ-is-minimum ๐ก = unique-from-๐
โค-is-maximum : (๐ก : ๐ ) โ ๐ก โค โค
โค-is-maximum ๐ก = unique-to-๐
โ-is-ub : (๐ก : โ โ ๐ ) โ (n : โ) โ ๐ก n โค โ ๐ก
โ-is-ub ๐ก n = (ฮป p โ โฃ n , p โฃ)
โ-is-lb-of-ubs : (๐ก : โ โ ๐ ) โ (๐ฆ : ๐ ) โ ((n : โ) โ ๐ก n โค ๐ฆ) โ โ ๐ก โค ๐ฆ
โ-is-lb-of-ubs ๐ก (U , i) ฯ = ฮณ
where
ฮด : (ฮฃ n ๊ โ , ๐ก n is-true) โ U
ฮด (n , p) = ฯ n p
ฮณ : (โ n ๊ โ , ๐ก n is-true) โ U
ฮณ = โฅโฅ-rec (quasidecidable-types-are-props U i) ฮด
\end{code}
Putting these axioms together we get the ฯ-sup-lattice of
quasidecidable propositions:
\begin{code}
open import OrderedTypes.sigma-sup-lattice fe
QD : ฯ-SupLat (๐ฃ โบ โ ๐) ๐ฃ
QD = ๐ ,
(โฅ , โ) ,
_โค_ ,
โค-is-prop-valued ,
โค-refl ,
โค-trans ,
โค-antisym ,
โฅ-is-minimum ,
โ-is-ub ,
โ-is-lb-of-ubs
\end{code}
We now show that QD is the free ฯ-sup-lattice on one generator. For
this purpose, we assume that we are give a ฯ-sup-lattice ๐ with a
distinguished element t.
\begin{code}
module _ {๐ค ๐ฅ : Universe}
(๐ : ฯ-SupLat ๐ค ๐ฅ)
(t : โจ ๐ โฉ)
where
\end{code}
We introduce some abbreviations, private to this anonymous module, for
notational convenience:
\begin{code}
private
A = โจ ๐ โฉ
โฅ' = โฅโจ ๐ โฉ
โ' = โโจ ๐ โฉ
_โค'_ : A โ A โ ๐ฅ ฬ
a โค' b = a โคโจ ๐ โฉ b
\end{code}
And then, again by ๐ -induction, there is at most one homomorphism from
๐ to ๐:
\begin{code}
at-most-one-hom : (g h : ๐ โ A)
โ is-ฯ-suplat-hom QD ๐ g
โ is-ฯ-suplat-hom QD ๐ h
โ g โค ๏ผ t
โ h โค ๏ผ t
โ g ๏ผ h
at-most-one-hom g h (gโฅ , gโ) (hโฅ , hโ) gโค hโค = dfunext fe r
where
iโ = g โฅ ๏ผโจ gโฅ โฉ
โฅ' ๏ผโจ hโฅ โปยน โฉ
h โฅ โ
iโ = g โค ๏ผโจ gโค โฉ
t ๏ผโจ hโค โปยน โฉ
h โค โ
iฯ : (๐ก : โ โ ๐ ) โ ((n : โ) โ g (๐ก n) ๏ผ h (๐ก n)) โ g (โ ๐ก) ๏ผ h (โ ๐ก)
iฯ ๐ก ฯ = g (โ ๐ก) ๏ผโจ gโ ๐ก โฉ
โ' (n โฆ g (๐ก n)) ๏ผโจ ap โ' (dfunext fe ฯ) โฉ
โ' (n โฆ h (๐ก n)) ๏ผโจ (hโ ๐ก)โปยน โฉ
h (โ ๐ก) โ
r : g โผ h
r = ๐ -induction (ฮป ๐ก โ g ๐ก ๏ผ h ๐ก) (ฮป ๐ก โ โจ ๐ โฉ-is-set {g ๐ก} {h ๐ก}) iโ iโ iฯ
\end{code}
The condition in the conclusion of the following lemma says that the
element a : A is the least upper bound of the (weakly) constant family
ฮป (p : P) โ t. Because least upper bounds are unique when they
exist, the type in the conclusion of the lemma is a proposition. This
is crucial because the induction principle can be applied to
proposition-valued predicates only.
\begin{code}
freeness-lemma : (P : ๐ฃ ฬ )
โ is-quasidecidable P
โ ฮฃ a ๊ A , (P โ t โค' a) ร ((u : A) โ (P โ t โค' u) โ a โค' u)
freeness-lemma = quasidecidable-induction F F-is-prop-valued Fโ Fโ Fฯ
where
F : ๐ฃ ฬ โ ๐ฃ โ ๐ค โ ๐ฅ ฬ
F P = ฮฃ a ๊ A , (P โ t โค' a) ร ((u : A) โ (P โ t โค' u) โ a โค' u)
F-is-prop-valued : (P : ๐ฃ ฬ ) โ is-prop (F P)
F-is-prop-valued P (a , ฮฑ , ฮฒ) (a' , ฮฑ' , ฮฒ') = ฮณ
where
j : (a : A) โ is-prop ((P โ t โค' a) ร ((u : A) โ (P โ t โค' u) โ a โค' u))
j a = ร-is-prop
(ฮ -is-prop fe (ฮป _ โ โจ ๐ โฉ-order-is-prop-valued t a))
(ฮ โ-is-prop fe (ฮป u _ โ โจ ๐ โฉ-order-is-prop-valued a u))
r : a ๏ผ a'
r = โจ ๐ โฉ-antisym a a' (ฮฒ a' ฮฑ') (ฮฒ' a ฮฑ)
ฮณ : (a , ฮฑ , ฮฒ) ๏ผ (a' , ฮฑ' , ฮฒ')
ฮณ = to-subtype-๏ผ j r
Fโ : F ๐
Fโ = โฅ' , unique-from-๐ , (ฮป u ฯ โ โจ ๐ โฉ-โฅ-is-minimum u)
Fโ : F ๐
Fโ = t , (ฮป _ โ โจ ๐ โฉ-refl t) , (ฮป u ฯ โ ฯ โ)
Fฯ : (P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n)
Fฯ P ฯ = aโ , ฮฑโ , ฮฒโ
where
a : โ โ A
a n = prโ (ฯ n)
ฮฑ : (n : โ) โ P n โ t โค' a n
ฮฑ n = prโ (prโ (ฯ n))
ฮฒ : (n : โ) (u : A) โ (P n โ t โค' u) โ a n โค' u
ฮฒ n = prโ (prโ (ฯ n))
aโ : A
aโ = โ' a
ฮฑโ : (โ n ๊ โ , P n) โ t โค' aโ
ฮฑโ = โฅโฅ-rec (โจ ๐ โฉ-order-is-prop-valued t aโ) ฮฑโ'
where
ฮฑโ' : (ฮฃ n ๊ โ , P n) โ t โค' aโ
ฮฑโ' (n , p) = โจ ๐ โฉ-trans t (a n) aโ (ฮฑ n p) (โจ ๐ โฉ-โ-is-ub a n)
ฮฒโ : (u : A) โ ((โ n ๊ โ , P n) โ t โค' u) โ aโ โค' u
ฮฒโ u ฯ = โจ ๐ โฉ-โ-is-lb-of-ubs a u l
where
l : (n : โ) โ a n โค' u
l n = ฮฒ n u (ฮป p โ ฯ โฃ n , p โฃ)
\end{code}
We now have enough constructions and lemmas to show that the type of
quasidecidable propositions is the free ฯ-sup-lattice on one
generator. It remains to show that the function ๐ โ A induced by the
initiality lemma is a ฯ-sup-lattice homomorphism.
\begin{code}
QD-is-free-ฯ-SupLat : โ! f ๊ (โจ QD โฉ โ โจ ๐ โฉ) , is-ฯ-suplat-hom QD ๐ f
ร (f โค ๏ผ t)
QD-is-free-ฯ-SupLat = ฮณ
where
f : ๐ โ A
f (P , i) = prโ (freeness-lemma P i)
ฮฑ : (๐ก : ๐ ) โ ๐ก is-true โ t โค' f ๐ก
ฮฑ (P , i) = prโ (prโ (freeness-lemma P i))
ฮฒ : (๐ก : ๐ ) โ ((u : A) โ (๐ก is-true โ t โค' u) โ f ๐ก โค' u)
ฮฒ (P , i) = prโ (prโ (freeness-lemma P i))
\end{code}
The conditions ฮฑ and ฮฒ on f are crucial to prove that f is indeed a
homomorphism, and are all we need for that purpose.
\begin{code}
fโค : f โค ๏ผ t
fโค = โจ ๐ โฉ-antisym (f โค) t (ฮฒ โค t (ฮป _ โ โจ ๐ โฉ-refl t)) (ฮฑ โค โ)
fโฅ : f โฅ ๏ผ โฅ'
fโฅ = โจ ๐ โฉ-antisym (f โฅ) โฅ' (ฮฒ โฅ โฅ' unique-from-๐) (โจ ๐ โฉ-โฅ-is-minimum (f โฅ))
f-is-monotone : (๐ก ๐ข : ๐ ) โ ๐ก โค ๐ข โ f ๐ก โค' f ๐ข
f-is-monotone ๐ก ๐ข l = ฮฒ ๐ก (f ๐ข) (ฮป p โ ฮฑ ๐ข (l p))
fโ : (๐ก : โ โ ๐ ) โ f (โ ๐ก) ๏ผ โ' (n โฆ f (๐ก n))
fโ ๐ก = โจ ๐ โฉ-antisym (f (โ ๐ก)) (โ' (n โฆ f (๐ก n))) v w
where
ฯ' : (ฮฃ n ๊ โ , ๐ก n is-true) โ t โค' โ' (n โฆ f (๐ก n))
ฯ' (n , p) = โจ ๐ โฉ-trans t (f (๐ก n)) (โ' (n โฆ f (๐ก n))) r s
where
r : t โค' f (๐ก n)
r = ฮฑ (๐ก n) p
s : f (๐ก n) โค' โ' (n โฆ f (๐ก n))
s = โจ ๐ โฉ-โ-is-ub (n โฆ f (๐ก n)) n
ฯ : (โ n ๊ โ , ๐ก n is-true) โ t โค' โ' (n โฆ f (๐ก n))
ฯ = โฅโฅ-rec (โจ ๐ โฉ-order-is-prop-valued _ _) ฯ'
v : f (โ ๐ก) โค' โ' (n โฆ f (๐ก n))
v = ฮฒ (โ ๐ก) (โ' (n โฆ f (๐ก n))) ฯ
l : (n : โ) โ ๐ก n โค โ ๐ก
l = โ-is-ub ๐ก
m : (n : โ) โ f (๐ก n) โค' f (โ ๐ก)
m n = f-is-monotone (๐ก n) (โ ๐ก) (l n)
w : โ' (n โฆ f (๐ก n)) โค' f (โ ๐ก)
w = โจ ๐ โฉ-โ-is-lb-of-ubs (n โฆ f (๐ก n)) (f (โ ๐ก)) m
\end{code}
And then we are done:
\begin{code}
f-is-hom : is-ฯ-suplat-hom QD ๐ f
f-is-hom = fโฅ , fโ
ฮณ : โ! f ๊ (โจ QD โฉ โ A) , is-ฯ-suplat-hom QD ๐ f
ร (f โค ๏ผ t)
ฮณ = (f , f-is-hom , fโค) ,
(ฮป (g , g-is-hom , gโค) โ to-subtype-๏ผ
(ฮป f โ ร-is-prop
(being-ฯ-suplat-hom-is-prop QD ๐ f)
โจ ๐ โฉ-is-set)
(at-most-one-hom f g f-is-hom g-is-hom fโค gโค))
\end{code}
This concludes the module hypothetical-quasidecidability.
We discussed above the specification of the notion of quasidecidable
proposition. But can we define or construct it? Yes if, for example,
propositional resizing is available:
\begin{code}
module quasidecidability-construction-from-resizing
(๐ฃ ๐ : Universe)
(ฯ : Propositional-Resizing)
where
open import UF.Powerset-Resizing fe ฯ
\end{code}
This assumption says that any proposition in the universe ๐ค is
equivalent to some proposition in the universe ๐ฅ, for any two
universes ๐ค and ๐ฅ.
The crucial fact exploited here is that intersections of collections
of subcollections ๐ : ๐ (๐ X) exist under propositional resizing.
To define the type of quasi-decidable propositions, we take the
intersection of the collections of types satisfying the following
closure condition:
\begin{code}
QD-closed-types : (๐ค ฬ โ ฮฉ ๐ฅ) โ ฮฉ (๐ค โบ โ ๐ฅ)
QD-closed-types {๐ค} {๐ฅ} A = closure-condition , i
where
closure-condition : ๐ค โบ โ ๐ฅ ฬ
closure-condition =
(๐ โ A)
ร (๐ โ A)
ร ((P : โ โ ๐ค ฬ ) โ ((n : โ) โ P n โ A) โ (โ n ๊ โ , P n) โ A)
i : is-prop closure-condition
i = รโ-is-prop
(โ-is-prop A ๐)
(โ-is-prop A ๐)
(ฮ โ-is-prop fe (ฮป P _ โ โ-is-prop A (โ n ๊ โ , P n)))
is-quasidecidable : ๐ฃ ฬ โ ๐ ฬ
is-quasidecidable P = P โ โ QD-closed-types
being-quasidecidable-is-prop : โ P โ is-prop (is-quasidecidable P)
being-quasidecidable-is-prop = โ-is-prop (โ QD-closed-types)
๐-is-quasidecidable : is-quasidecidable ๐
๐-is-quasidecidable = to-โ QD-closed-types ๐ (ฮป A (cโ , cโ , cฯ) โ cโ)
๐-is-quasidecidable : is-quasidecidable ๐
๐-is-quasidecidable = to-โ QD-closed-types ๐ (ฮป A (cโ , cโ , cฯ) โ cโ)
quasidecidable-closed-under-ฯ-joins : (P : โ โ ๐ฃ ฬ )
โ ((n : โ) โ is-quasidecidable (P n))
โ is-quasidecidable (โ n ๊ โ , P n)
quasidecidable-closed-under-ฯ-joins P ฯ = to-โ QD-closed-types (โ P) vi
where
i : (n : โ) โ P n โ โ QD-closed-types
i = ฯ
ii : (n : โ) (A : ๐ฃ ฬ โ ฮฉ ๐) โ A โ QD-closed-types โ P n โ A
ii n = from-โ QD-closed-types (P n) (i n)
iii : (A : ๐ฃ ฬ โ ฮฉ ๐) โ A โ QD-closed-types โ โ P โ A
iii A (cโ , cโ , cฯ) = cฯ P (ฮป n โ ii n A (cโ , cโ , cฯ))
iv : โ P โ โ QD-closed-types
iv = to-โ QD-closed-types (โ P) iii
vi : (A : ๐ฃ ฬ โ ฮฉ ๐) โ A โ QD-closed-types โ โ P โ A
vi = from-โ QD-closed-types (โ P) iv
\end{code}
The full induction principle requires a further application of
resizing. We first prove a particular case and then reduce the general
case to this particular case.
\begin{code}
quasidecidable-inductionโ
: (F : ๐ฃ ฬ โ ๐ ฬ )
โ ((P : ๐ฃ ฬ ) โ is-prop (F P))
โ F ๐
โ F ๐
โ ((P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n))
โ (P : ๐ฃ ฬ ) โ is-quasidecidable P โ F P
quasidecidable-inductionโ F F-is-prop-valued Fโ Fโ Fฯ P P-is-quasidecidable
= ฮณ
where
A : (P : ๐ฃ ฬ ) โ ฮฉ ๐
A P = F P , F-is-prop-valued P
A-is-QD-closed : A โ QD-closed-types
A-is-QD-closed = Fโ , Fโ , Fฯ
pqd : P โ โ QD-closed-types
pqd = P-is-quasidecidable
ฮด : P โ A
ฮด = from-โ QD-closed-types P pqd A A-is-QD-closed
ฮณ : F P
ฮณ = ฮด
\end{code}
To get the full induction principle we apply the above particular case
with back and forth resizing coercions. The point is that now F has
values in any universe ๐ค rather than the universe ๐ as above.
\begin{code}
quasidecidable-induction
: {๐ค : Universe}
(F : ๐ฃ ฬ โ ๐ค ฬ )
โ ((P : ๐ฃ ฬ ) โ is-prop (F P))
โ F ๐
โ F ๐
โ ((P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n))
โ (P : ๐ฃ ฬ ) โ is-quasidecidable P โ F P
quasidecidable-induction {๐ค} F F-is-prop Fโ Fโ Fฯ P P-is-quasidecidable = ฮณ
where
i = F-is-prop
F' : ๐ฃ ฬ โ ๐ ฬ
F' P = resize ฯ (F P) (i P)
i' : (P : ๐ฃ ฬ ) โ is-prop (F' P)
i' P = resize-is-prop ฯ (F P) (i P)
ฮด : F' P
ฮด = quasidecidable-inductionโ
F'
i'
(to-resize ฯ (F ๐) (i ๐) Fโ)
(to-resize ฯ (F ๐) (i ๐) Fโ)
(ฮป P Q โ to-resize ฯ
(F (โ P))
(i (โ P))
(Fฯ P (ฮป n โ from-resize ฯ
(F (P n))
(i (P n))
(Q n))))
P
P-is-quasidecidable
ฮณ : F P
ฮณ = from-resize ฯ (F P) (i P) ฮด
\end{code}
Hence the free ฯ-sup-lattice on one generator exists under
propositional resizing: we simply plug the construction of the
quasidecidable propositions to the above hypothetical development.
\begin{code}
open OrderedTypes.sigma-sup-lattice fe
free-ฯ-suplat-on-one-generator-exists
: ฮฃ ๐ ๊ ฯ-SupLat (๐ฃ โบ โ ๐) ๐ฃ
, ฮฃ t ๊ โจ ๐ โฉ
, ((๐ : ฯ-SupLat ๐ค ๐ฅ) (u : โจ ๐ โฉ)
โ โ! f ๊ (โจ ๐ โฉ โ โจ ๐ โฉ) , is-ฯ-suplat-hom ๐ ๐ f
ร (f t ๏ผ u))
free-ฯ-suplat-on-one-generator-exists {๐ค} {๐ฅ}
= QD , โค , QD-is-free-ฯ-SupLat
where
open hypothetical-quasidecidability
(quasidecidable-propositions
is-quasidecidable
being-quasidecidable-is-prop
๐-is-quasidecidable
๐-is-quasidecidable
quasidecidable-closed-under-ฯ-joins
quasidecidable-induction)
\end{code}
This concludes the module quasidecidability-construction-from-resizing.
The initial ฯ-frame can also be constructed as a higher-inductive
type, as is well known.
The ฯ-sup-lattice on one generator is automatically the initial
ฯ-frame. This is shown below.
TODO. Write in Agda some of the proofs of the above reference with
Cory Knapp, particularly regarding choice. E.g. the semidecidable
properties form a dominance if and only if a certain particular case
of countable choice holds.
TODO. This certain particular case of countable choice holds if and
only if the quasidecidable propositions are semidecidable. This is not
in the paper, but the methods of proof of the paper should apply more
or less directly.
Question. Can we construct the collection of quasidecidable
propositions without resizing and without higher-inductive types other
than propositional truncation?
We now explore the consequences of the hypothetical existence of a
free ฯ-sup-lattice on one generator โค.
\begin{code}
module hypothetical-free-ฯ-SupLat-on-one-generator where
open import OrderedTypes.sigma-sup-lattice fe
module assumptions
{๐ฃ ๐ : Universe}
(๐ : ฯ-SupLat ๐ฃ ๐)
(โค : โจ ๐ โฉ)
(๐-free : {๐ฅ ๐ฆ : Universe} (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ)
โ โ! f ๊ (โจ ๐ โฉ โ โจ ๐ โฉ) , is-ฯ-suplat-hom ๐ ๐ f
ร (f โค ๏ผ t))
where
\end{code}
We first introduce some abbreviations:
\begin{code}
private
A = โจ ๐ โฉ
โฅ = โฅโจ ๐ โฉ
โ = โโจ ๐ โฉ
_โค_ : A โ A โ ๐ ฬ
a โค b = a โคโจ ๐ โฉ b
ฯ-rec : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) โ โจ ๐ โฉ โ โจ ๐ โฉ โ โจ ๐ โฉ
ฯ-rec ๐ t = prโ (center (๐-free ๐ t))
ฯ-rec-is-hom : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ)
โ is-ฯ-suplat-hom ๐ ๐ (ฯ-rec ๐ t)
ฯ-rec-is-hom ๐ t = prโ (prโ (center (๐-free ๐ t)))
ฯ-rec-โฅ : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ)
โ ฯ-rec ๐ t โฅ ๏ผ โฅโจ ๐ โฉ
ฯ-rec-โฅ ๐ t = ฯ-suplat-hom-โฅ ๐ ๐ (ฯ-rec ๐ t) (ฯ-rec-is-hom ๐ t)
ฯ-rec-โ : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ) (a : โ โ A)
โ ฯ-rec ๐ t (โ a) ๏ผ โโจ ๐ โฉ (n โฆ ฯ-rec ๐ t (a n))
ฯ-rec-โ ๐ t = ฯ-suplat-hom-โ ๐ ๐ (ฯ-rec ๐ t) (ฯ-rec-is-hom ๐ t)
ฯ-rec-โค : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ)
โ ฯ-rec ๐ t โค ๏ผ t
ฯ-rec-โค ๐ t = prโ (prโ (center (๐-free ๐ t)))
ฯ-rec-is-unique : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ)
(f : A โ โจ ๐ โฉ)
โ is-ฯ-suplat-hom ๐ ๐ f
โ f โค ๏ผ t
โ ฯ-rec ๐ t ๏ผ f
ฯ-rec-is-unique ๐ t f i p = ap prโ (centrality (๐-free ๐ t) (f , i , p))
at-most-one-hom : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ)
(f g : A โ โจ ๐ โฉ)
โ is-ฯ-suplat-hom ๐ ๐ f
โ is-ฯ-suplat-hom ๐ ๐ g
โ f โค ๏ผ t
โ g โค ๏ผ t
โ f ๏ผ g
at-most-one-hom ๐ t f g i j p q = ap prโ
(singletons-are-props
(๐-free ๐ t)
(f , i , p)
(g , j , q))
\end{code}
We now establish the induction principle for the free ฯ-sup-lattice on
one generator by constructing a ฯ-sup-lattice from the property we
want to prove.
\begin{code}
ฯ-induction : (P : A โ ๐ฅ ฬ )
โ ((a : A) โ is-prop (P a))
โ P โค
โ P โฅ
โ ((a : โ โ A) โ ((n : โ) โ P (a n)) โ P (โ a))
โ (a : A) โ P a
ฯ-induction {๐ฅ} P P-is-prop-valued โค-closure โฅ-closure โ-closure = ฮณ
where
X = ฮฃ a ๊ A , P a
โค' โฅ' : X
โค' = (โค , โค-closure)
โฅ' = (โฅ , โฅ-closure)
โ' : (โ โ X) โ X
โ' x = (โ (prโ โ x) , โ-closure (prโ โ x) (prโ โ x))
_โค'_ : X โ X โ ๐ ฬ
(a , _) โค' (b , _) = a โค b
๐ : ฯ-SupLat (๐ฃ โ ๐ฅ) ๐
๐ = X ,
(โฅ' , โ') ,
_โค'_ ,
(ฮป (a , _) (b , _) โ โจ ๐ โฉ-order-is-prop-valued a b) ,
(ฮป (a , _) โ โจ ๐ โฉ-refl a) ,
(ฮป (a , _) (b , _) (c , _) โ โจ ๐ โฉ-trans a b c) ,
(ฮป (a , _) (b , _) l m โ to-subtype-๏ผ
P-is-prop-valued
(โจ ๐ โฉ-antisym a b l m)) ,
(ฮป (a , _) โ โจ ๐ โฉ-โฅ-is-minimum a) ,
(ฮป x n โ โจ ๐ โฉ-โ-is-ub (prโ โ x) n) ,
(ฮป x (u , _) ฯ โ โจ ๐ โฉ-โ-is-lb-of-ubs (prโ โ x) u ฯ)
g : X โ A
g = prโ
g-is-hom : is-ฯ-suplat-hom ๐ ๐ g
g-is-hom = refl , (ฮป ๐ โ refl)
h : A โ A
h = g โ ฯ-rec ๐ โค'
hโค : h โค ๏ผ โค
hโค = ap g (ฯ-rec-โค ๐ โค')
h-is-hom : is-ฯ-suplat-hom ๐ ๐ h
h-is-hom = โ-ฯ-suplat-hom ๐ ๐ ๐ (ฯ-rec ๐ โค') g (ฯ-rec-is-hom ๐ โค') g-is-hom
H : h ๏ผ id
H = at-most-one-hom ๐ โค h id h-is-hom (id-is-ฯ-suplat-hom ๐) hโค refl
ฮด : (a : A) โ P (h a)
ฮด a = prโ (ฯ-rec ๐ โค' a)
ฮณ : (a : A) โ P a
ฮณ a = transport P (happly H a) (ฮด a)
\end{code}
For example, we see that the generator โค is the maximum element by
ฯ-induction:
\begin{code}
โค-is-maximum : (a : A) โ a โค โค
โค-is-maximum = ฯ-induction
(_โค โค)
(ฮป a โ โจ ๐ โฉ-order-is-prop-valued a โค)
(โจ ๐ โฉ-refl โค)
(โจ ๐ โฉ-โฅ-is-minimum โค)
(ฮป a โ โจ ๐ โฉ-โ-is-lb-of-ubs a โค)
\end{code}
We use the following little lemma a couple of times:
\begin{code}
โ-โค : (a : โ โ A) (n : โ) โ a n ๏ผ โค โ โ a ๏ผ โค
โ-โค a n p = โจ ๐ โฉ-antisym (โ a) โค
(โค-is-maximum (โ a))
(โจ ๐ โฉ-trans โค (a n) (โ a)
(โจ ๐ โฉ-๏ผ-gives-โค (p โปยน))
(โจ ๐ โฉ-โ-is-ub a n))
\end{code}
We now characterize ฯ-rec as a least upper bound, or join. We first
define joins and their basic properties:
\begin{code}
join-of : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) {I : ๐ฆ' ฬ } โ (I โ โจ ๐ โฉ) โ โจ ๐ โฉ โ ๐ฅ โ ๐ฆ โ ๐ฆ' ฬ
join-of ๐ f x = (โ i โ f i โคโจ ๐ โฉ x)
ร ((u : โจ ๐ โฉ) โ (โ i โ f i โคโจ ๐ โฉ u) โ x โคโจ ๐ โฉ u)
syntax join-of ๐ f x = x is-the-join-of f on ๐
being-join-is-prop : (๐ : ฯ-SupLat ๐ฅ ๐ฆ)
{I : ๐ฆ' ฬ }
(x : โจ ๐ โฉ)
(f : I โ โจ ๐ โฉ)
โ is-prop (x is-the-join-of f on ๐)
being-join-is-prop ๐ x f = ร-is-prop
(ฮ -is-prop fe
(ฮป i โ โจ ๐ โฉ-order-is-prop-valued (f i) x))
(ฮ โ-is-prop fe
(ฮป u _ โ โจ ๐ โฉ-order-is-prop-valued x u))
at-most-one-join : (๐ : ฯ-SupLat ๐ฅ ๐ฆ)
{I : ๐ฆ' ฬ }
(x x' : โจ ๐ โฉ)
(f : I โ โจ ๐ โฉ)
โ x is-the-join-of f on ๐
โ x' is-the-join-of f on ๐
โ x ๏ผ x'
at-most-one-join ๐ x x' f (ฮฑ , ฮฒ) (ฮฑ' , ฮฒ') =
โจ ๐ โฉ-antisym x x' (ฮฒ x' ฮฑ') (ฮฒ' x ฮฑ)
\end{code}
We have that the following characterization of (ฯ-rec ๐ t a) as the
least upper bound of the weakly constant family ฮป (_ : a ๏ผ โค) โ t:
\begin{code}
ฯ-rec-is-join : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ) (a : A)
โ (ฯ-rec ๐ t a) is-the-join-of (ฮป (_ : a ๏ผ โค) โ t) on ๐
ฯ-rec-is-join ๐ t a = ฮฑ , ฮฒ
where
h : A โ โจ ๐ โฉ
h = ฯ-rec ๐ t
ฮฑ : a ๏ผ โค โ t โคโจ ๐ โฉ h a
ฮฑ p = โจ ๐ โฉ-๏ผ-gives-โค (t ๏ผโจ (ฯ-rec-โค ๐ t)โปยน โฉ
h โค ๏ผโจ ap (h) (p โปยน) โฉ
h a โ)
ฮฒ : (u : โจ ๐ โฉ) โ (a ๏ผ โค โ t โคโจ ๐ โฉ u) โ h a โคโจ ๐ โฉ u
ฮฒ = ฯ-induction
(ฮป a โ (u : โจ ๐ โฉ) โ (a ๏ผ โค โ t โคโจ ๐ โฉ u) โ h a โคโจ ๐ โฉ u)
(ฮป a โ ฮ โ-is-prop fe (ฮป u p โ โจ ๐ โฉ-order-is-prop-valued (h a) u))
ฮฒโค
ฮฒโฅ
ฮฒโ
a
where
ฮฒโค : (u : โจ ๐ โฉ) โ (โค ๏ผ โค โ t โคโจ ๐ โฉ u) โ h โค โคโจ ๐ โฉ u
ฮฒโค u ฯ = transport
(ฮป - โ - โคโจ ๐ โฉ u)
((ฯ-rec-โค ๐ t )โปยน)
(ฯ refl)
ฮฒโฅ : (u : โจ ๐ โฉ) โ (โฅ ๏ผ โค โ t โคโจ ๐ โฉ u) โ h โฅ โคโจ ๐ โฉ u
ฮฒโฅ u ฯ = transport
(ฮป - โ - โคโจ ๐ โฉ u)
((ฯ-rec-โฅ ๐ t)โปยน)
(โจ ๐ โฉ-โฅ-is-minimum u)
ฮฒโ : (c : โ โ A)
โ ((n : โ) (u : โจ ๐ โฉ) โ (c n ๏ผ โค โ t โคโจ ๐ โฉ u) โ h (c n) โคโจ ๐ โฉ u)
โ (u : โจ ๐ โฉ) โ (โ c ๏ผ โค โ t โคโจ ๐ โฉ u) โ h (โ c) โคโจ ๐ โฉ u
ฮฒโ c ฯ u ฯ = transport (ฮป - โ - โคโจ ๐ โฉ u) ((ฯ-rec-โ ๐ t c)โปยน) ฮณ
where
ฮณ : โโจ ๐ โฉ (h โ c) โคโจ ๐ โฉ u
ฮณ = โจ ๐ โฉ-โ-is-lb-of-ubs
(h โ c)
u
(ฮป n โ ฯ n u (ฮป (p : c n ๏ผ โค) โ ฯ (โ-โค c n p)))
ฯ-rec-is-ub : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ) (a : A)
โ a ๏ผ โค โ t โคโจ ๐ โฉ ฯ-rec ๐ t a
ฯ-rec-is-ub ๐ t a = prโ (ฯ-rec-is-join ๐ t a)
ฯ-rec-is-lb-of-ubs : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ) (a : A)
โ (u : โจ ๐ โฉ) โ (a ๏ผ โค โ t โคโจ ๐ โฉ u) โ ฯ-rec ๐ t a โคโจ ๐ โฉ u
ฯ-rec-is-lb-of-ubs ๐ t a = prโ (ฯ-rec-is-join ๐ t a)
\end{code}
Such joins are absolute, in the sense that they are preserved by all
homomorphisms:
\begin{code}
ฯ-suplat-homs-preserve-ฯ-rec : (๐ : ฯ-SupLat ๐ฅ ๐ฆ)
(๐ : ฯ-SupLat ๐ฃ' ๐ฅ')
(f : โจ ๐ โฉ โ โจ ๐ โฉ)
โ is-ฯ-suplat-hom ๐ ๐ f
โ (t : โจ ๐ โฉ)
(a : A)
โ f (ฯ-rec ๐ t a) ๏ผ ฯ-rec ๐ (f t) a
ฯ-suplat-homs-preserve-ฯ-rec ๐ ๐ f i t = happly ฮณ
where
composite-is-hom : is-ฯ-suplat-hom ๐ ๐ (f โ ฯ-rec ๐ t)
composite-is-hom = โ-ฯ-suplat-hom ๐ ๐ ๐ (ฯ-rec ๐ t) f (ฯ-rec-is-hom ๐ t) i
ฮณ : f โ ฯ-rec ๐ t ๏ผ ฯ-rec ๐ (f t)
ฮณ = at-most-one-hom ๐ (f t)
(f โ ฯ-rec ๐ t)
(ฯ-rec ๐ (f t))
composite-is-hom
(ฯ-rec-is-hom ๐ (f t))
(ap f (ฯ-rec-โค ๐ t))
(ฯ-rec-โค ๐ (f t))
\end{code}
In particular, ฯ-rec preserves ฯ-rec:
\begin{code}
ฯ-rec-preserves-ฯ-rec : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (t : โจ ๐ โฉ) (a b : A)
โ ฯ-rec ๐ t (ฯ-rec ๐ a b) ๏ผ ฯ-rec ๐ (ฯ-rec ๐ t a) b
ฯ-rec-preserves-ฯ-rec ๐ t = ฯ-suplat-homs-preserve-ฯ-rec ๐ ๐
(ฯ-rec ๐ t)
(ฯ-rec-is-hom ๐ t)
\end{code}
We now derive the existence of binary meets in ฯ-sup-lattice ๐ on one
generator โค from the above kind of joins.
\begin{code}
_โง_ : A โ A โ A
a โง b = ฯ-rec ๐ a b
meetโค : (a : A) โ a โง โค ๏ผ a
meetโค = ฯ-rec-โค ๐
meetโฅ : (a : A) โ a โง โฅ ๏ผ โฅ
meetโฅ = ฯ-rec-โฅ ๐
meetโ : (a : A) (b : โ โ A) โ a โง โ b ๏ผ โ (n โฆ a โง b n)
meetโ = ฯ-rec-โ ๐
infix 100 _โง_
โง-associative : (a b c : A) โ a โง (b โง c) ๏ผ (a โง b) โง c
โง-associative = ฯ-rec-preserves-ฯ-rec ๐
โง-is-lb-left : (a b : A) โ a โง b โค a
โง-is-lb-left a b = ฯ-rec-is-lb-of-ubs ๐ a b a
(ฮป (_ : b ๏ผ โค) โ โจ ๐ โฉ-refl a)
โง-is-lb-right : (a b : A) โ a โง b โค b
โง-is-lb-right a b = ฯ-rec-is-lb-of-ubs ๐ a b b
(ฮป (r : b ๏ผ โค) โ transport (a โค_) (r โปยน) (โค-is-maximum a))
\end{code}
Using this, we show that a โง b is the greatest lower bound of a and b.
One step needs ฯ-induction:
\begin{code}
โง-is-ub-of-lbs : (a b c : A) โ c โค a โ c โค b โ c โค a โง b
โง-is-ub-of-lbs a b = ฯ-induction
(ฮป c โ c โค a โ c โค b โ c โค a โง b)
(ฮป c โ ฮ โ-is-prop fe
(ฮป _ _ โ โจ ๐ โฉ-order-is-prop-valued c (a โง b)))
pโค
pโฅ
pโ
where
pโค : โค โค a โ โค โค b โ โค โค a โง b
pโค l m = โจ ๐ โฉ-trans _ _ _ l ii
where
i : b ๏ผ โค
i = โจ ๐ โฉ-antisym _ _ (โค-is-maximum b) m
ii : a โค a โง b
ii = ฯ-rec-is-ub ๐ a b i
pโฅ : โฅ โค a โ โฅ โค b โ โฅ โค a โง b
pโฅ _ _ = โจ ๐ โฉ-โฅ-is-minimum (a โง b)
pโ : (d : โ โ A)
โ ((n : โ) โ d n โค a โ d n โค b โ d n โค a โง b)
โ โ d โค a
โ โ d โค b
โ โ d โค (a โง b)
pโ d ฯ l m = โจ ๐ โฉ-โ-is-lb-of-ubs d (a โง b)
(ฮป n โ ฯ n (โจ ๐ โฉ-trans (d n) _ a (โจ ๐ โฉ-โ-is-ub d n) l)
(โจ ๐ โฉ-trans (d n) _ b (โจ ๐ โฉ-โ-is-ub d n) m))
โง-idempotent : (a : A) โ a โง a ๏ผ a
โง-idempotent a = โจ ๐ โฉ-antisym _ _ l m
where
l : a โง a โค a
l = โง-is-lb-left a a
m : a โค a โง a
m = โง-is-ub-of-lbs a a a (โจ ๐ โฉ-refl a) (โจ ๐ โฉ-refl a)
โง-commutative : (a b : A) โ a โง b ๏ผ b โง a
โง-commutative a b = โจ ๐ โฉ-antisym _ _ (l a b) (l b a)
where
l : (a b : A) โ a โง b โค b โง a
l a b = โง-is-ub-of-lbs b a (a โง b) (โง-is-lb-right a b) (โง-is-lb-left a b)
\end{code}
The intrinsic order coincides with the โง-semilattice order:
\begin{code}
from-โค : (a b : A) โ a โค b โ a โง b ๏ผ a
from-โค a b l = โจ ๐ โฉ-antisym _ _ (โง-is-lb-left a b) m
where
m : a โค a โง b
m = โง-is-ub-of-lbs _ _ _ (โจ ๐ โฉ-refl a) l
to-โค : (a b : A) โ a โง b ๏ผ a โ a โค b
to-โค a b p = โจ ๐ โฉ-trans _ _ _ l (โง-is-lb-right a b)
where
l : a โค a โง b
l = โจ ๐ โฉ-๏ผ-gives-โค (p โปยน)
\end{code}
We now show that the the ฯ-suplat on one generator is also the initial
ฯ-frame. The following renaming is annoying.
\begin{code}
open OrderedTypes.sigma-frame fe
hiding (order)
renaming
(โจ_โฉ to โจ_โฉ' ;
โฅโจ_โฉ to โฅโจ_โฉ' ;
โคโจ_โฉ to โคโจ_โฉ' ;
meet to meet' ;
โโจ_โฉ to โโจ_โฉ' ;
โจ_โฉ-is-set to โจ_โฉ'-is-set ;
โจ_โฉ-refl to โจ_โฉ'-refl ;
โจ_โฉ-trans to โจ_โฉ'-trans ;
โจ_โฉ-antisym to โจ_โฉ'-antisym ;
โจ_โฉ-โค-maximum to โจ_โฉ'-โค-maximum ;
โจ_โฉ-โฅ-minimum to โจ_โฉ'-โฅ-minimum ;
โจ_โฉ-โ-is-ub to โจ_โฉ'-โ-is-ub ;
โจ_โฉ-โ-is-lb-of-ubs to โจ_โฉ'-โ-is-lb-of-ubs)
A-qua-ฯ-frame : ฯ-Frame ๐ฃ
A-qua-ฯ-frame = A ,
(โค , _โง_ , โฅ , โ) ,
โจ ๐ โฉ-is-set ,
โง-idempotent ,
โง-commutative ,
โง-associative ,
(ฮป a โ โง-commutative โฅ a โ meetโฅ a) ,
meetโค ,
meetโ ,
(ฮป a n โ from-โค (a n) (โ a)
(โจ ๐ โฉ-โ-is-ub a n)) ,
(ฮป a u ฯ โ from-โค (โ a) u
(โจ ๐ โฉ-โ-is-lb-of-ubs a u
(ฮป n โ to-โค (a n) u (ฯ n))))
A-qua-ฯ-frame-is-initial : (๐ : ฯ-Frame ๐ฅ)
โ โ! f ๊ (A โ โจ ๐ โฉ), is-ฯ-frame-hom A-qua-ฯ-frame ๐ f
A-qua-ฯ-frame-is-initial {๐ฅ} ๐ = ฮณ
where
B = โจ ๐ โฉ
_โง'_ : B โ B โ B
_โง'_ = meet' ๐
๐-qua-ฯ-suplat : ฯ-SupLat ๐ฅ ๐ฅ
๐-qua-ฯ-suplat = ฯ-frames-are-ฯ-suplats ๐
โค' : B
โค' = โคโจ ๐ โฉ'
f : A โ B
f = ฯ-rec ๐-qua-ฯ-suplat โค'
f-is-hom : is-ฯ-suplat-hom ๐ ๐-qua-ฯ-suplat f
f-is-hom = ฯ-rec-is-hom ๐-qua-ฯ-suplat โค'
f-preserves-โง : (a b : A) โ f (a โง b) ๏ผ f a โง' f b
f-preserves-โง a = ฯ-induction
(ฮป b โ f (a โง b) ๏ผ f a โง' f b)
(ฮป b โ โจ ๐ โฉ'-is-set)
fโค
fโฅ
fโ
where
fโค = f (a โง โค) ๏ผโจ I โฉ
f a ๏ผโจ II โฉ
f a โง' โค' ๏ผโจ III โฉ
f a โง' f โค โ
where
I = ap f (meetโค a)
II = (โจ ๐ โฉ'-โค-maximum (f a))โปยน
III = ap (f a โง'_) ((ฯ-rec-โค ๐-qua-ฯ-suplat โค')โปยน)
fโฅ = f (a โง โฅ) ๏ผโจ I โฉ
f โฅ ๏ผโจ II โฉ
โฅโจ ๐ โฉ' ๏ผโจ III โฉ
โฅโจ ๐ โฉ' โง' f a ๏ผโจ IV โฉ
f โฅ โง' f a ๏ผโจ V โฉ
f a โง' f โฅ โ
where
I = ap f (meetโฅ a)
II = ฯ-suplat-hom-โฅ ๐ ๐-qua-ฯ-suplat f f-is-hom
III = (โจ ๐ โฉ'-โฅ-minimum (f a))โปยน
IV = ap (ฮป - โ - โง' f a)
((ฯ-suplat-hom-โฅ ๐ ๐-qua-ฯ-suplat f f-is-hom)โปยน)
V = โจ ๐ โฉ-commutativity (f โฅ) (f a)
fโ = ฮป c p โ
f (a โง โ c) ๏ผโจ I c โฉ
f (โ (n โฆ a โง c n)) ๏ผโจ II c โฉ
โโจ ๐ โฉ' (n โฆ f (a โง c n)) ๏ผโจ III c p โฉ
โโจ ๐ โฉ' (n โฆ f a โง' f (c n)) ๏ผโจ IV c โฉ
f a โง' โโจ ๐ โฉ' (ฮป n โ f (c n)) ๏ผโจ V c โฉ
f a โง' f (โ c) โ
where
I = ฮป (c : โ โ โจ ๐ โฉ) โ ap f (meetโ a c)
II = ฮป (c : โ โ โจ ๐ โฉ) โ ฯ-suplat-hom-โ
๐
๐-qua-ฯ-suplat
f
f-is-hom
(ฮป n โ a โง c n)
III = ฮป (c : โ โ โจ ๐ โฉ)
(p : (n : โ) โ _ ๏ผ meet' ๐ (f a) (f (c n)))
โ ap โโจ ๐ โฉ' (dfunext fe p)
IV = ฮป (c : โ โ โจ ๐ โฉ) โ (โจ ๐ โฉ-distributivity (f a) (ฮป n โ f (c n)))โปยน
V = ฮป (c : โ โ โจ ๐ โฉ) โ ap (f a โง'_)
((ฯ-suplat-hom-โ ๐ ๐-qua-ฯ-suplat f f-is-hom c)โปยน)
f-is-hom' : is-ฯ-frame-hom A-qua-ฯ-frame ๐ f
f-is-hom' = ฯ-rec-โค ๐-qua-ฯ-suplat โค' ,
f-preserves-โง ,
ฯ-suplat-hom-โฅ ๐ ๐-qua-ฯ-suplat f f-is-hom ,
ฯ-suplat-hom-โ ๐ ๐-qua-ฯ-suplat f f-is-hom
forget : (g : A โ B)
โ is-ฯ-frame-hom A-qua-ฯ-frame ๐ g
โ is-ฯ-suplat-hom ๐ ๐-qua-ฯ-suplat g
forget g (i , ii , iii , iv) = (iii , iv)
f-uniqueness : (g : A โ B) โ is-ฯ-frame-hom A-qua-ฯ-frame ๐ g โ f ๏ผ g
f-uniqueness g g-is-hom' = at-most-one-hom ๐-qua-ฯ-suplat โค' f g
f-is-hom
(forget g g-is-hom')
(ฯ-rec-โค ๐-qua-ฯ-suplat โค')
(ฯ-frame-hom-โค A-qua-ฯ-frame ๐ g g-is-hom')
ฮณ : โ! f ๊ (A โ B), is-ฯ-frame-hom A-qua-ฯ-frame ๐ f
ฮณ = (f , f-is-hom') ,
(ฮป (g , g-is-hom') โ to-subtype-๏ผ
(being-ฯ-frame-hom-is-prop A-qua-ฯ-frame ๐)
(f-uniqueness g g-is-hom'))
\end{code}
We now regard the type of propositions as a ฯ-sup-lattice:
\begin{code}
ฮฉ-qua-ฯ-Frame : ฯ-Frame (๐ฃ โบ)
ฮฉ-qua-ฯ-Frame = OrderedTypes.sigma-frame.ฮฉ-qua-ฯ-frame fe pe pt
ฮฉ-qua-ฯ-SupLat : ฯ-SupLat (๐ฃ โบ) (๐ฃ โบ)
ฮฉ-qua-ฯ-SupLat = OrderedTypes.sigma-frame.ฮฉ-qua-ฯ-suplat fe pe pt
private
โฅ' = โฅโจ ฮฉ-qua-ฯ-SupLat โฉ
โค' = โคโจ ฮฉ-qua-ฯ-Frame โฉ'
โ' = โโจ ฮฉ-qua-ฯ-SupLat โฉ
_โค'_ : ฮฉ ๐ฃ โ ฮฉ ๐ฃ โ ๐ฃ โบ ฬ
x โค' y = x โคโจ ฮฉ-qua-ฯ-SupLat โฉ y
๏ผ-gives-โค' : (p q : ฮฉ ๐ฃ) โ p ๏ผ q โ p โค' q
๏ผ-gives-โค' p q r = โจ ฮฉ-qua-ฯ-SupLat โฉ-๏ผ-gives-โค r
\end{code}
In a frame the bottom element is not taken explicitly as part of the
structure and is defined to be the join of the family indexed by the
empty set. In the particular case of the frame of propositions, this
is equal to the empty type ๐, but not definitionally:
\begin{code}
โฅ-holds-is-๐ : โฅ' holds ๏ผ ๐
โฅ-holds-is-๐ = p
where
p : (โ x ๊ ๐ , unique-from-๐ x holds) ๏ผ ๐
p = pe โ-is-prop
๐-is-prop
(โฅโฅ-rec ๐-is-prop (unique-from-๐ โ prโ))
unique-from-๐
ฮฉ-non-trivial : โฅ' โ โค'
ฮฉ-non-trivial q = ๐-is-not-๐ r
where
r : ๐ ๏ผ ๐
r = (โฅ-holds-is-๐)โปยน โ ap _holds q
\end{code}
The following map ฯ will play an important role:
\begin{code}
ฯ : A โ ฮฉ ๐ฃ
ฯ = ฯ-rec ฮฉ-qua-ฯ-SupLat โค'
ฯ-is-hom : is-ฯ-suplat-hom ๐ ฮฉ-qua-ฯ-SupLat ฯ
ฯ-is-hom = ฯ-rec-is-hom ฮฉ-qua-ฯ-SupLat โค'
\end{code}
Using ฯ we derive the non-triviality of ๐ from that of ฮฉ:
\begin{code}
๐-non-trivial : โฅ โ โค
๐-non-trivial p = ฮฉ-non-trivial q
where
q = โฅ' ๏ผโจ (ฯ-suplat-hom-โฅ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom)โปยน โฉ
ฯ โฅ ๏ผโจ ap ฯ p โฉ
ฯ โค ๏ผโจ ฯ-rec-โค ฮฉ-qua-ฯ-SupLat โค' โฉ
โค' โ
\end{code}
A crucial property of the map ฯ is that it reflects top elements (in
point-free topological terms, this says that ฯ is dense):
\begin{code}
ฯ-reflects-โค : (a : A) โ ฯ a ๏ผ โค' โ a ๏ผ โค
ฯ-reflects-โค = ฯ-induction
(ฮป a โ ฯ a ๏ผ โค' โ a ๏ผ โค)
(ฮป a โ ฮ -is-prop fe (ฮป _ โ โจ ๐ โฉ-is-set))
iโค
iโฅ
iโ
where
iโค : ฯ โค ๏ผ โค' โ โค ๏ผ โค
iโค _ = refl
iโฅ : ฯ โฅ ๏ผ โค' โ โฅ ๏ผ โค
iโฅ p = ๐-elim (ฮฉ-non-trivial q)
where
q : โฅ' ๏ผ โค'
q = (ฯ-suplat-hom-โฅ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom)โปยน โ p
iโ : (a : โ โ A)
โ ((n : โ) โ ฯ (a n) ๏ผ โค' โ a n ๏ผ โค)
โ ฯ (โ a) ๏ผ โค'
โ โ a ๏ผ โค
iโ a ฯ p = โฅโฅ-rec โจ ๐ โฉ-is-set iii ii
where
i : โ' (ฯ โ a) ๏ผ โค'
i = (ฯ-suplat-hom-โ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom a)โปยน โ p
ii : โ n ๊ โ , ฯ (a n) holds
ii = equal-โค-gives-holds (โ' (ฯ โ a)) i
iii : (ฮฃ n ๊ โ , ฯ (a n) holds) โ โ a ๏ผ โค
iii (n , h) = vi
where
iv : ฯ (a n) ๏ผ โค'
iv = holds-gives-equal-โค pe fe (ฯ (a n)) h
v : a n ๏ผ โค
v = ฯ n iv
vi : โ a ๏ผ โค
vi = โ-โค a n v
\end{code}
A frame is called compact if every cover of its top element has a
finite subcover. It is supercompact (I think the terminology is due to
John Isbell) if every cover of the top element has a singleton
subcover. This motivates the name of the following theorem, whose
crucial ingredient is the homomorphism ฯ and the fact that it reflects
top elements.
\begin{code}
๐-is-ฯ-supercompact : (a : โ โ A) โ โ a ๏ผ โค โ โ n ๊ โ , a n ๏ผ โค
๐-is-ฯ-supercompact a p = vi
where
i = โ' (ฯ โ a) ๏ผโจ (ฯ-suplat-hom-โ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom a)โปยน โฉ
ฯ (โ a) ๏ผโจ ap ฯ p โฉ
ฯ โค ๏ผโจ ฯ-rec-โค ฮฉ-qua-ฯ-SupLat โค' โฉ
โค' โ
ii : (โ n ๊ โ , ฯ (a n) holds) ๏ผ ๐
ii = ap _holds i
iii : (ฮฃ n ๊ โ , ฯ (a n) holds) โ (ฮฃ n ๊ โ , a n ๏ผ โค)
iii (n , h) = n , v
where
iv : ฯ (a n) ๏ผ โค'
iv = holds-gives-equal-โค pe fe (ฯ (a n)) h
v : a n ๏ผ โค
v = ฯ-reflects-โค (a n) iv
vi : โ n ๊ โ , a n ๏ผ โค
vi = โฅโฅ-functor iii (equal-๐-gives-holds (โ n ๊ โ , ฯ (a n) holds) ii)
\end{code}
We have that ฯ a holds precisely when a ๏ผ โค (hence the name ฯ for the
function):
\begin{code}
ฯ-characโ : (a : A) โ ฯ a holds โ a ๏ผ โค
ฯ-characโ a h = ฯ-reflects-โค a (holds-gives-equal-โค pe fe (ฯ a) h)
ฯ-characโ : (a : A) โ a ๏ผ โค โ ฯ a holds
ฯ-characโ a p = equal-โค-gives-holds (ฯ a)
(ฯ a ๏ผโจ ap ฯ p โฉ
ฯ โค ๏ผโจ ฯ-rec-โค ฮฉ-qua-ฯ-SupLat โค' โฉ
โค' โ)
ฯ-charac' : (a : A) โ ฯ a holds ๏ผ (a ๏ผ โค)
ฯ-charac' a = pe (holds-is-prop (ฯ a)) โจ ๐ โฉ-is-set (ฯ-characโ a) (ฯ-characโ a)
ฯ-charac : (a : A) โ ฯ a ๏ผ ((a ๏ผ โค) , โจ ๐ โฉ-is-set)
ฯ-charac a = to-subtype-๏ผ (ฮป a โ being-prop-is-prop fe) (ฯ-charac' a)
\end{code}
The following criterion for a โค b will be useful:
\begin{code}
โค-criterion : (a b : A) โ (a ๏ผ โค โ b ๏ผ โค) โ a โค b
โค-criterion = ฯ-induction
(ฮป a โ (b : A) โ (a ๏ผ โค โ b ๏ผ โค) โ a โค b)
(ฮป a โ ฮ โ-is-prop fe (ฮป b _ โ โจ ๐ โฉ-order-is-prop-valued a b))
iโค
iโฅ
iโ
where
iโค : (b : A) โ (โค ๏ผ โค โ b ๏ผ โค) โ โค โค b
iโค b f = โจ ๐ โฉ-๏ผ-gives-โค ((f refl)โปยน)
iโฅ : (b : A) โ (โฅ ๏ผ โค โ b ๏ผ โค) โ โฅ โค b
iโฅ b _ = โจ ๐ โฉ-โฅ-is-minimum b
iโ : (a : โ โ A)
โ ((n : โ) (b : A) โ (a n ๏ผ โค โ b ๏ผ โค) โ a n โค b)
โ (b : A)
โ (โ a ๏ผ โค โ b ๏ผ โค)
โ โ a โค b
iโ a ฯ b ฯ = โจ ๐ โฉ-โ-is-lb-of-ubs a b
(ฮป n โ ฯ n b (ฮป (p : a n ๏ผ โค) โ ฯ (โ-โค a n p)))
โค-criterion-converse : (a b : A) โ a โค b โ (a ๏ผ โค โ b ๏ผ โค)
โค-criterion-converse a b l p =
โจ ๐ โฉ-antisym _ _
(โค-is-maximum b)
(โจ ๐ โฉ-trans _ _ _ (โจ ๐ โฉ-๏ผ-gives-โค (p โปยน)) l)
\end{code}
The map ฯ reflects order and hence is left-cancellable, and therefore
is an embedding (its fibers are propositions) because it is a map into
a set:
\begin{code}
ฯ-order-lc : (a b : A) โ ฯ a โค' ฯ b โ a โค b
ฯ-order-lc a b l = iv
where
i : ฯ a holds โ ฯ b holds
i = OrderedTypes.Frame.from-โคฮฉ fe pe pt {๐ฃ} {ฯ a} {ฯ b} l
ii : ฯ a ๏ผ โค' โ ฯ b ๏ผ โค'
ii p = holds-gives-equal-โค pe fe (ฯ b) (i (equal-โค-gives-holds (ฯ a) p))
iii : a ๏ผ โค โ b ๏ผ โค
iii q = ฯ-reflects-โค b (ii r)
where
r = ฯ a ๏ผโจ ap ฯ q โฉ
ฯ โค ๏ผโจ ฯ-rec-โค ฮฉ-qua-ฯ-SupLat โค' โฉ
โค' โ
iv : a โค b
iv = โค-criterion a b iii
ฯ-lc : left-cancellable ฯ
ฯ-lc {a} {b} p = โจ ๐ โฉ-antisym a b l r
where
l : a โค b
l = ฯ-order-lc a b (๏ผ-gives-โค' (ฯ a) (ฯ b) p)
r : b โค a
r = ฯ-order-lc b a (๏ผ-gives-โค' (ฯ b) (ฯ a) (p โปยน))
ฯ-is-embedding : is-embedding ฯ
ฯ-is-embedding = lc-maps-into-sets-are-embeddings ฯ ฯ-lc (ฮฉ-is-set fe pe)
holds-is-embedding : is-embedding (_holds {๐ฃ})
holds-is-embedding = prโ-is-embedding (ฮป _ โ being-prop-is-prop fe)
\end{code}
Hence the composite ฯ-holds is an embedding of A into the universe ๐ฃ:
\begin{code}
ฯ-holds : A โ ๐ฃ ฬ
ฯ-holds a = ฯ a holds
ฯ-holds-is-embedding : is-embedding ฯ-holds
ฯ-holds-is-embedding = โ-is-embedding ฯ-is-embedding holds-is-embedding
\end{code}
Using this we define the notion of quasidecidability and its required
properties. We define the quasidecidability of the type P to be the
type
fiber ฯ-holds P,
which amounts to the type
ฮฃ a ๊ A , (ฯ a holds ๏ผ P)
by construction:
\begin{code}
is-quasidecidable : ๐ฃ ฬ โ ๐ฃ โบ ฬ
is-quasidecidable P = ฮฃ a ๊ A , (ฯ a holds ๏ผ P)
being-quasidecidable-is-prop : โ P โ is-prop (is-quasidecidable P)
being-quasidecidable-is-prop = ฯ-holds-is-embedding
quasidecidable-types-are-props : โ P โ is-quasidecidable P โ is-prop P
quasidecidable-types-are-props P (a , p) =
transport is-prop p (holds-is-prop (ฯ a))
๐-is-quasidecidable : is-quasidecidable ๐
๐-is-quasidecidable = โฅ ,
(ฯ โฅ holds ๏ผโจ I โฉ
โฅ' holds ๏ผโจ II โฉ
๐ โ)
where
I = ap _holds
(ฯ-suplat-hom-โฅ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom)
II = โฅ-holds-is-๐
๐-is-quasidecidable : is-quasidecidable ๐
๐-is-quasidecidable = โค , ap _holds (ฯ-rec-โค ฮฉ-qua-ฯ-SupLat โค')
quasidecidable-closed-under-ฯ-joins
: (P : โ โ ๐ฃ ฬ )
โ ((n : โ) โ is-quasidecidable (P n))
โ is-quasidecidable (โ n ๊ โ , P n)
quasidecidable-closed-under-ฯ-joins P ฯ = vii
where
i : (n : โ) โ ฯ-holds (fiber-point (ฯ n)) ๏ผ P n
i n = fiber-identification (ฯ n)
ii : (n : โ)
โ ฯ (fiber-point (ฯ n))
๏ผ (P n , quasidecidable-types-are-props (P n) (ฯ n))
ii n = to-subtype-๏ผ (ฮป _ โ being-prop-is-prop fe) (i n)
iii : ฯ (โ (n โฆ fiber-point (ฯ n)))
๏ผ โ' (ฮป n โ P n , quasidecidable-types-are-props (P n) (ฯ n))
iii = ฯ (โ (n โฆ fiber-point (ฯ n))) ๏ผโจ iv โฉ
โ' (n โฆ ฯ (fiber-point (ฯ n))) ๏ผโจ v โฉ
โ' (n โฆ (P n , quasidecidable-types-are-props (P n) (ฯ n))) โ
where
iv = ฯ-suplat-hom-โ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom (ฮป n โ fiber-point (ฯ n))
v = ap โ' (dfunext fe ii)
vi : ฯ-holds (โ (n โฆ fiber-point (ฯ n))) ๏ผ (โ n ๊ โ , P n)
vi = ap _holds iii
vii : is-quasidecidable (โ n ๊ โ , P n)
vii = โ (n โฆ fiber-point (ฯ n)) , vi
\end{code}
Then we get quasidecidable induction by ฯ-induction:
\begin{code}
quasidecidable-induction :
(F : ๐ฃ ฬ โ ๐ฅ ฬ )
โ ((P : ๐ฃ ฬ ) โ is-prop (F P))
โ F ๐
โ F ๐
โ ((P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n))
โ (P : ๐ฃ ฬ ) โ is-quasidecidable P โ F P
quasidecidable-induction {๐ฅ} F i Fโ Fโ Fฯ P (a , r) = ฮณ a P r
where
ฮณโค : (P : ๐ฃ ฬ ) โ ฯ โค holds ๏ผ P โ F P
ฮณโค P s = transport F (t โปยน โ s) Fโ
where
t : ฯ โค holds ๏ผ ๐
t = ap _holds (ฯ-rec-โค ฮฉ-qua-ฯ-SupLat โค')
ฮณโฅ : (P : ๐ฃ ฬ ) โ ฯ โฅ holds ๏ผ P โ F P
ฮณโฅ P s = transport F (t โปยน โ s) Fโ
where
t : ฯ โฅ holds ๏ผ ๐
t = ap _holds (ฯ-suplat-hom-โฅ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom) โ โฅ-holds-is-๐
ฮณโ : (a : โ โ A)
โ ((n : โ) (P : ๐ฃ ฬ ) โ (ฯ (a n) holds) ๏ผ P โ F P)
โ (P : ๐ฃ ฬ ) โ (ฯ (โ a) holds) ๏ผ P โ F P
ฮณโ a ฯ P s = transport F (t โปยน โ s) (Fฯ (ฮป n โ ฯ (a n) holds) ฯ)
where
t : ฯ (โ a) holds ๏ผ (โ n ๊ โ , ฯ (a n) holds)
t = ap _holds (ฯ-suplat-hom-โ ๐ ฮฉ-qua-ฯ-SupLat ฯ ฯ-is-hom a)
ฯ : (n : โ) โ F (ฯ (a n) holds)
ฯ n = ฯ n (ฯ (a n) holds) refl
ฮณ : (a : A) (P : ๐ฃ ฬ ) โ ฯ a holds ๏ผ P โ F P
ฮณ = ฯ-induction
(ฮป a โ (P : ๐ฃ ฬ ) โ ฯ a holds ๏ผ P โ F P)
(ฮป a โ ฮ โ-is-prop fe (ฮป P _ โ i P))
ฮณโค
ฮณโฅ
ฮณโ
\end{code}
We then get the dominance axiom for quasidecidable propositions by an
application of the submodule hypothetical-quasidecidability.
\begin{code}
quasidecidable-closed-under-ฮฃ
: (P : ๐ฃ ฬ )
โ (Q : P โ ๐ฃ ฬ )
โ is-quasidecidable P
โ ((p : P) โ is-quasidecidable (Q p))
โ is-quasidecidable (ฮฃ Q)
quasidecidable-closed-under-ฮฃ
= hypothetical-quasidecidability.quasidecidable-closed-under-ฮฃ
(quasidecidable-propositions
is-quasidecidable
being-quasidecidable-is-prop
๐-is-quasidecidable
๐-is-quasidecidable
quasidecidable-closed-under-ฯ-joins
quasidecidable-induction)
\end{code}
Here are some consequences for the sake of illustration of the meaning
of this.
\begin{code}
dependent-binary-meet
: (a : A) (b : ฯ a holds โ A)
โ ฮฃ c ๊ A , (ฯ c holds ๏ผ (ฮฃ h ๊ ฯ a holds , ฯ (b h) holds))
dependent-binary-meet a b = quasidecidable-closed-under-ฮฃ
(ฯ a holds)
(ฮป h โ ฯ (b h) holds)
(a , refl)
(ฮป h โ b h , refl)
\end{code}
The following just applies back-and-forth the characterization of
ฯ a holds as a ๏ผ โค.
\begin{code}
dependent-binary-meet' : (a : A) (b : a ๏ผ โค โ A)
โ ฮฃ c ๊ A , (c ๏ผ โค โ (ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค))
dependent-binary-meet' a b = f ฯ
where
b' : ฯ a holds โ A
b' h = b (ฯ-characโ a h)
ฯ : ฮฃ c ๊ A , (ฯ c holds) ๏ผ (ฮฃ h ๊ ฯ a holds , ฯ (b' h) holds)
ฯ = dependent-binary-meet a b'
f : (ฮฃ c ๊ A , (ฯ c holds) ๏ผ (ฮฃ h ๊ ฯ a holds , ฯ (b' h) holds))
โ ฮฃ c ๊ A , ((c ๏ผ โค) โ (ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค))
f ( c , q) = c , g , h
where
g : c ๏ผ โค โ ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค
g r = ฯ-characโ a (prโ (Idtofun q (ฯ-characโ c r))) ,
transport (ฮป - โ b - ๏ผ โค)
(โจ ๐ โฉ-is-set _ _)
(ฯ-characโ (b _) (prโ (Idtofun q (ฯ-characโ c r))))
h : (ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค) โ c ๏ผ โค
h (p , s) = ฯ-characโ c
(Idtofun
(q โปยน)
(ฯ-characโ a p , ฯ-characโ (b' (ฯ-characโ a p))
(transport (ฮป - โ b - ๏ผ โค) (โจ ๐ โฉ-is-set _ _) s)))
\end{code}
We can replace the bi-implication by an equality:
\begin{code}
dependent-binary-meet'' : (a : A) (b : a ๏ผ โค โ A)
โ ฮฃ c ๊ A , ((c ๏ผ โค) ๏ผ (ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค))
dependent-binary-meet'' a b = f (dependent-binary-meet' a b)
where
f : (ฮฃ c ๊ A , (c ๏ผ โค โ (ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค)))
โ ฮฃ c ๊ A , ((c ๏ผ โค) ๏ผ (ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค))
f (c , g , h) = c , โ prop-univalent-โ pe fe (c ๏ผ โค) (ฮฃ p ๊ a ๏ผ โค , b p ๏ผ โค)
(ฮฃ-is-prop โจ ๐ โฉ-is-set (ฮป p โ โจ ๐ โฉ-is-set)) โโปยน
(logically-equivalent-props-are-equivalent
โจ ๐ โฉ-is-set
(ฮฃ-is-prop
โจ ๐ โฉ-is-set
(ฮป p โ โจ ๐ โฉ-is-set)) g h)
\end{code}
The non-dependent special case:
\begin{code}
binary-meet : (a b : A) โ ฮฃ c ๊ A , (c ๏ผ โค โ ((a ๏ผ โค) ร (b ๏ผ โค)))
binary-meet a b = dependent-binary-meet' a (ฮป _ โ b)
\end{code}
Using the criterion for โค we get that this does indeed give binary
meets:
\begin{code}
binary-meet'-is-โง : (a b c : A)
โ (c ๏ผ โค โ ((a ๏ผ โค) ร (b ๏ผ โค)))
โ c ๏ผ a โง b
binary-meet'-is-โง a b c (f , g) = viii
where
i : c โค a
i = โค-criterion c a (ฮป (p : c ๏ผ โค) โ prโ (f p))
ii : c โค b
ii = โค-criterion c b (ฮป (p : c ๏ผ โค) โ prโ (f p))
iii : c โค a โง b
iii = โง-is-ub-of-lbs a b c i ii
iv : a โง b ๏ผ โค โ a ๏ผ โค
iv p = โจ ๐ โฉ-antisym a โค
(โค-is-maximum a)
(โจ ๐ โฉ-trans โค (a โง b) a
(โจ ๐ โฉ-๏ผ-gives-โค (p โปยน))
(โง-is-lb-left a b))
v : a โง b ๏ผ โค โ b ๏ผ โค
v p = โจ ๐ โฉ-antisym b โค
(โค-is-maximum b)
(โจ ๐ โฉ-trans โค (a โง b) b
(โจ ๐ โฉ-๏ผ-gives-โค (p โปยน))
(โง-is-lb-right a b))
vi : a โง b ๏ผ โค โ c ๏ผ โค
vi p = g (iv p , v p)
vii : a โง b โค c
vii = โค-criterion (a โง b) c vi
viii : c ๏ผ a โง b
viii = โจ ๐ โฉ-antisym c (a โง b) iii vii
\end{code}
ฯ-sup-lattices have joins of quasidecidable-indexed families:
\begin{code}
ฯ-suplats-have-quasidecidable-joins : (๐ : ฯ-SupLat ๐ฅ ๐ฆ) (P : ๐ฃ ฬ )
โ is-quasidecidable P
โ (f : P โ โจ ๐ โฉ)
โ ฮฃ b ๊ โจ ๐ โฉ , (b is-the-join-of f on ๐)
ฯ-suplats-have-quasidecidable-joins {๐ฅ} {๐ฆ} ๐ =
quasidecidable-induction F F-is-prop-valued Fโ Fโ Fฯ
where
F : ๐ฃ ฬ โ ๐ฃ โ ๐ฅ โ ๐ฆ ฬ
F P = (f : P โ โจ ๐ โฉ) โ ฮฃ b ๊ โจ ๐ โฉ , (b is-the-join-of f on ๐)
F-is-prop-valued : โ P โ is-prop (F P)
F-is-prop-valued P = ฮ -is-prop fe
(ฮป f (b , i) (b' , i')
โ to-subtype-๏ผ
(ฮป b โ being-join-is-prop ๐ b f)
(at-most-one-join ๐ b b' f i i'))
Fโ : F ๐
Fโ f = โฅโจ ๐ โฉ , (ฮป (i : ๐) โ ๐-elim i) , ฮป u ฯ โ โจ ๐ โฉ-โฅ-is-minimum u
Fโ : F ๐
Fโ f = f โ , (ฮป โ โ โจ ๐ โฉ-refl (f โ)) , ฮป u ฯ โ ฯ โ
Fฯ : ((P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n))
Fฯ P ฯ f = bโ , ฮฑโ , ฮฒโ
where
g : (n : โ) โ P n โ โจ ๐ โฉ
g n p = f โฃ n , p โฃ
h : (n : โ) โ ฮฃ b ๊ โจ ๐ โฉ , (b is-the-join-of g n on ๐)
h n = ฯ n (g n)
b : โ โ โจ ๐ โฉ
b n = prโ (h n)
ฮฑ : (n : โ) (p : P n) โ g n p โคโจ ๐ โฉ b n
ฮฑ n = prโ (prโ (h n))
ฮฒ : (n : โ) (u : โจ ๐ โฉ) โ ((p : P n) โ (g n p) โคโจ ๐ โฉ u) โ b n โคโจ ๐ โฉ u
ฮฒ n = prโ (prโ (h n))
bโ : โจ ๐ โฉ
bโ = โโจ ๐ โฉ b
ฮฑโ : (q : โ n ๊ โ , P n) โ f q โคโจ ๐ โฉ bโ
ฮฑโ = โฅโฅ-induction (ฮป s โ โจ ๐ โฉ-order-is-prop-valued (f s) bโ) ฮฑโ'
where
ฮฑโ' : (ฯ : ฮฃ n ๊ โ , P n) โ f โฃ ฯ โฃ โคโจ ๐ โฉ bโ
ฮฑโ' (n , p) = โจ ๐ โฉ-trans (g n p) (b n) bโ (ฮฑ n p) (โจ ๐ โฉ-โ-is-ub b n)
ฮฒโ : (u : โจ ๐ โฉ) โ ((q : โ n ๊ โ , P n) โ f q โคโจ ๐ โฉ u) โ bโ โคโจ ๐ โฉ u
ฮฒโ u ฯ = โจ ๐ โฉ-โ-is-lb-of-ubs b u l
where
l : (n : โ) โ b n โคโจ ๐ โฉ u
l n = ฮฒ n u (ฮป p โ ฯ โฃ n , p โฃ)
\end{code}
We repackage the above.
\begin{code}
module _ {๐ฅ ๐ฆ : Universe}
(๐ : ฯ-SupLat ๐ฅ ๐ฆ)
(P : ๐ฃ ฬ )
(i : is-quasidecidable P)
(f : P โ โจ ๐ โฉ)
where
sup : โจ ๐ โฉ
sup = prโ (ฯ-suplats-have-quasidecidable-joins ๐ P i f)
sup-is-ub : (p : P) โ f p โคโจ ๐ โฉ sup
sup-is-ub = prโ (prโ (ฯ-suplats-have-quasidecidable-joins ๐ P i f))
sup-is-lb-of-ubs : (u : โจ ๐ โฉ) โ ((p : P) โ f p โคโจ ๐ โฉ u) โ sup โคโจ ๐ โฉ u
sup-is-lb-of-ubs = prโ (prโ (ฯ-suplats-have-quasidecidable-joins ๐ P i f))
\end{code}
We say that a map is a q-embedding if its fibers are all
quasidecidable. We define three versions of the same definition to
help Agda to solve constraints.
\begin{code}
is-q-embedding : {X : ๐ฃ ฬ } {Y : ๐ฃ ฬ } โ (X โ Y) โ ๐ฃ โบ ฬ
is-q-embedding f = โ y โ is-quasidecidable (fiber f y)
is-q-embeddingl : {X : ๐ฃ ฬ } {Y : ๐คโ ฬ } โ (X โ Y) โ ๐ฃ โบ ฬ
is-q-embeddingl f = โ y โ is-quasidecidable (fiber f y)
is-q-embeddingr : {X : ๐คโ ฬ } {Y : ๐ฃ ฬ } โ (X โ Y) โ ๐ฃ โบ ฬ
is-q-embeddingr f = โ y โ is-quasidecidable (fiber f y)
\end{code}
The following generalizes the existence of quasidecidable-indexed
joins.
\begin{code}
ฯ-suplats-have-quasidecidable-joins'
: (๐ : ฯ-SupLat ๐ฅ ๐ฆ) {I : ๐ฃ ฬ }
โ (f : I โ โ)
โ is-q-embeddingl f
โ (b : โ โ โจ ๐ โฉ)
โ ฮฃ c ๊ โจ ๐ โฉ , (c is-the-join-of (b โ f) on ๐)
ฯ-suplats-have-quasidecidable-joins' {๐ฅ} {๐ฆ} ๐ {I} f q b
= c , ฮฑ , ฮฒ
where
g : I โ โจ ๐ โฉ
g = b โ f
a : โ โ A
a n = prโ (q n)
e : (n : โ) โ ฯ (a n) holds ๏ผ (ฮฃ i ๊ I , f i ๏ผ n)
e n = prโ (q n)
ฮณ : (n : โ) โ ฯ (a n) holds โ (ฮฃ i ๊ I , f i ๏ผ n)
ฮณ n = Idtofun (e n)
ฮด : (n : โ) โ (ฮฃ i ๊ I , f i ๏ผ n) โ ฯ (a n) holds
ฮด n = Idtofun ((e n)โปยน)
g' : (n : โ) โ ฯ (a n) holds โ โจ ๐ โฉ
g' n h = g (prโ (ฮณ n h))
b' : โ โ โจ ๐ โฉ
b' n = sup ๐ (ฯ (a n) holds) (a n , refl) (g' n)
c : โจ ๐ โฉ
c = โโจ ๐ โฉ b'
ฮฑ : โ i โ b (f i) โคโจ ๐ โฉ c
ฮฑ i = โจ ๐ โฉ-trans (b (f i)) (b' (f i)) c lโ lโ
where
lโ : b' (f i) โคโจ ๐ โฉ c
lโ = โจ ๐ โฉ-โ-is-ub b' (f i)
lโ : g' (f i) (ฮด (f i) (i , refl)) โคโจ ๐ โฉ b' (f i)
lโ = sup-is-ub ๐
(ฯ (a (f i)) holds)
(a (f i) , refl)
(g' (f i))
(ฮด (f i)
(i , refl))
r : g' (f i) (ฮด (f i) (i , refl))
๏ผ b (f (prโ (ฮณ (f i) (ฮด (f i) (i , refl)))))
r = refl
s : b (f (prโ (ฮณ (f i) (ฮด (f i) (i , refl))))) ๏ผ b (f i)
s = ap (ฮป - โ b (f (prโ -))) (Idtofun-retraction (e (f i)) (i , refl))
t : g' (f i) (ฮด (f i) (i , refl)) ๏ผ b (f i)
t = s
lโ : b (f i) โคโจ ๐ โฉ b' (f i)
lโ = transport (ฮป - โ - โคโจ ๐ โฉ b' (f i)) s lโ
ฮฒ : (u : โจ ๐ โฉ) โ (โ i โ b (f i) โคโจ ๐ โฉ u) โ c โคโจ ๐ โฉ u
ฮฒ u ฯ = โจ ๐ โฉ-โ-is-lb-of-ubs b' u l
where
ฯ' : (n : โ) (h : ฯ (a n) holds) โ g' n h โคโจ ๐ โฉ u
ฯ' n h = ฯ (prโ (ฮณ n h))
l : (n : โ) โ b' n โคโจ ๐ โฉ u
l n = sup-is-lb-of-ubs ๐ (ฯ (a n) holds) (a n , refl) (g' n) u (ฯ' n)
\end{code}
We now generalize and resize part of the above (without resizing
axioms) by replacing equality by equivalence in the definition of
quasidecidability:
\begin{code}
is-quasidecidable' : ๐ฅ ฬ โ ๐ฃ โ ๐ฅ ฬ
is-quasidecidable' P = ฮฃ a ๊ A , (ฯ a holds โ P)
is-quasidecidableโ : ๐ฃ ฬ โ ๐ฃ ฬ
is-quasidecidableโ = is-quasidecidable' {๐ฃ}
quasidecidability-resizing : (P : ๐ฃ ฬ )
โ is-quasidecidable P โ is-quasidecidableโ P
quasidecidability-resizing P = ฮฃ-cong e
where
e : (a : A) โ (ฯ a holds ๏ผ P) โ (ฯ a holds โ P)
e a = prop-univalent-โ' pe fe P (ฯ a holds) (holds-is-prop (ฯ a))
being-quasidecidableโ-is-prop : (P : ๐ฃ ฬ ) โ is-prop (is-quasidecidableโ P)
being-quasidecidableโ-is-prop P = equiv-to-prop
(โ-sym (quasidecidability-resizing P))
(being-quasidecidable-is-prop P)
๐-is-quasidecidableโ : is-quasidecidableโ ๐
๐-is-quasidecidableโ = โ quasidecidability-resizing ๐ โ ๐-is-quasidecidable
๐-is-quasidecidableโ : is-quasidecidableโ ๐
๐-is-quasidecidableโ = โ quasidecidability-resizing ๐ โ ๐-is-quasidecidable
quasidecidableโ-closed-under-ฯ-joins
: (P : โ โ ๐ฃ ฬ )
โ ((n : โ) โ is-quasidecidableโ (P n))
โ is-quasidecidableโ (โ n ๊ โ , P n)
quasidecidableโ-closed-under-ฯ-joins P ฯ =
โ quasidecidability-resizing (โ n ๊ โ , P n) โ
(quasidecidable-closed-under-ฯ-joins P ฯ')
where
ฯ' : (n : โ) โ is-quasidecidable (P n)
ฯ' n = โ quasidecidability-resizing (P n) โโปยน (ฯ n)
quasidecidableโ-induction
: (F : ๐ฃ ฬ โ ๐ฅ ฬ )
โ ((P : ๐ฃ ฬ ) โ is-prop (F P))
โ F ๐
โ F ๐
โ ((P : โ โ ๐ฃ ฬ ) โ ((n : โ) โ F (P n)) โ F (โ n ๊ โ , P n))
โ (P : ๐ฃ ฬ ) โ is-quasidecidableโ P โ F P
quasidecidableโ-induction F i Fโ Fโ Fฯ P q
= quasidecidable-induction F i Fโ Fโ Fฯ P (โ quasidecidability-resizing P โโปยน q)
\end{code}
This concludes the module hypothetical-free-ฯ-SupLat-on-one-generator.
We now give the proofs of the main theorems by calling the above modules.
\begin{code}
theoremโ {๐ฃ} {๐ค} q = free-ฯ-SupLat-on-one-generator QD โค QD-is-free-ฯ-SupLat
where
open quasidecidable-propositions-exist q
open hypothetical-quasidecidability {๐ฃ} {๐ค}
(quasidecidable-propositions
is-quasidecidable
being-quasidecidable-is-prop
๐-is-quasidecidable
๐-is-quasidecidable
quasidecidable-closed-under-ฯ-joins
quasidecidable-induction)
theoremโ {๐ฃ} {๐ค} f = quasidecidable-propositions
is-quasidecidableโ
being-quasidecidableโ-is-prop
๐-is-quasidecidableโ
๐-is-quasidecidableโ
quasidecidableโ-closed-under-ฯ-joins
quasidecidableโ-induction
where
open free-ฯ-SupLat-on-one-generator-exists f
open hypothetical-free-ฯ-SupLat-on-one-generator
open assumptions {๐ฃ} {๐ค} ๐ โค ๐-free
theoremโ {๐ฃ} {๐} f = initial-ฯ-frame A-qua-ฯ-frame A-qua-ฯ-frame-is-initial
where
open free-ฯ-SupLat-on-one-generator-exists f
open hypothetical-free-ฯ-SupLat-on-one-generator
open assumptions {๐ฃ} {๐} ๐ โค ๐-free
theoremโ {๐ฃ} {๐} ฯ = quasidecidable-propositions
is-quasidecidable
being-quasidecidable-is-prop
๐-is-quasidecidable
๐-is-quasidecidable
quasidecidable-closed-under-ฯ-joins
quasidecidable-induction
where
open quasidecidability-construction-from-resizing ๐ฃ ๐ ฯ
\end{code}
TODO.
* Very little here has to do with the nature of the type โ. We never used
zero, successor, or induction! (But they are used in
OrderedTypes.sigma-sup-lattice to construct binary joins, which are not
used here.) Any indexing type replacing โ works in the above development,
with the definition of ฯ-sup-lattice generalized to have an arbitrary (but
fixed) indexing type in place of โ. (We could have multiple indexing types,
but this would require a modification of the above development.)
* Define, by induction (or as a W-type) a type similar to the
Brouwer ordinals, with two constructors 0 and 1 and a formal
โ-indexed sup operation. We have a unique map to the initial
ฯ-sup-lattice that transforms formal sups into sups and maps 0 to
โฅ and 1 to โค. Is this function a surjection (it is definitely not
an injection), or what (known) axioms are needed for it to be a
surjection? Countable choice suffices. But is it necessary? It
seems likely that the choice principle studied in the above paper
with Cory Knapp is necessary and sufficient. This principle
implies that the quasidecidable propositions agree with the
semidecidable ones.