Example 1
VUZFIn set theory, the mathematical structure is provided by a set X and a binary relation \leq on X. Moreover, this relation is required to be reflexive, transitive and antisymmetric. Reflexivity, \forall_{x \in X} x \leq x is a logical statement that is bivalent.
In type theory, if we define {\leq} : {X \to X \to \mathsf{Type}}, with \mathsf{Type} some type universe, then the type encoding reflexivity, \prod_{x : X} x \leq x, may have more than one element. This is a fundamental difference with set theory.
In Coq, we could instead define {\leq} : {X \to X \to \texttt{Prop}}, where \texttt{Prop} is Coq’s special sort of propositions. This sort is defined such that (for instance) reflexivity, \forall_{x : X}\,x \leq x, is again in \texttt{Prop}.
The crucial difference between these approaches and the univalent approach, is that in univalent type theory, we prove that something is a proposition (truth value). Following Voevodsky, we define a type to be a proposition (truth value, subsingleton) if it has at most one element with respect to its identity type, i.e. up to propositional equality. To define posets, we then ask for a witness that the type x \leq y is a proposition for every x,y : X. This allows us, in the presence of function extensionality (which is a consequence of the univalence axiom), to prove that reflexivity and transitivity are propositions. For example, for reflexivity, we wish to show that the type \prod_{x : X} x \leq x is a proposition. So let f,g be two elements of this type. By function extensionality, it suffices to show that f(x) = g(x) for every x : X. But the type of f(x) and g(x) is x \leq x, which is a proposition by requirement, so f(x) and g(x) must be (propositionally) equal, as desired. Finally, we require X to be a set: any two elements of X are equal in at most one way. This ensures, using function extensionality again, that antisymmetry is a proposition.