Built with Alectryon, running Coq+SerAPI v8.19.0+0.19.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
(** * Defining the natural numbers from univalence and propositional resizing. *)
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Require Import Types.Require Import HProp.Require Import Universes.Smallness.LocalOpen Scope path_scope.(* Be careful about [Import]ing this file! Usually you want to use the standard [Nat] instead. *)(** Using propositional resizing and univalence, we can construct the natural numbers rather than defining them as an inductive type. In concrete practice there is no reason we would want to do this, but semantically it means that an elementary (oo,1)-topos (unlike an elementary 1-topos) automatically has a natural numbers object. *)SectionAssumeStuff.Context {UA:Univalence} {PR:PropResizing}.(** The basic idea is that since the universe is closed under coproducts, it is already "infinite", so we can find the "smallest infinite set" N inside it. To get rid of the automorphisms in the universe coming from univalence and make N a set, instead of the universe of types we consider graphs (we could use posets or many other things too; in fact the graphs we are interested in will be posets). *)(** Here is the readable definition of [Graph]: > Definition Graph := { V : Type & { E : V -> V -> Type & forall x y, IsHProp@{hp} (E x y) }}. However, to enable performance speedups by controlling universes, we write out its universe parameters explicitly, making it less readable. Moreover, since here we will eventually only be interested in those graphs that represent natural numbers, it does no harm to fix these universes at the outset throughout the entire development. *)(** [s] : universe of the vertex and edge types [u] : universe of the graph type, morally [s+1] *)Universes s u.DefinitionGraph@{} := @sig@{u u} Type@{s} (funV => @sig@{u u} (V -> V -> Type@{s}) (funE => forallxy, IsHProp (E x y))).(** We also write out its constructors and fields explicitly to control their universes. *)DefinitionBuild_Graph@{} (vert : Type@{s}) (edge : vert -> vert -> Type@{s})
(ishprop_edge : forallxy, IsHProp (edge x y))
: Graph
:= @exist@{u u} Type@{s} (funV => @sig@{u u} (V -> V -> Type@{s}) (funE => forallxy, IsHProp (E x y)))
vert
(@exist@{u u} (vert -> vert -> Type@{s}) (funE => forallxy, IsHProp (E x y))
edge ishprop_edge).Definitionvert@{} : Graph -> Type@{s} := pr1.Definitionedge@{} (A : Graph) : vert A -> vert A -> Type@{s} := pr1 (pr2 A).Instanceishprop_edge@{} (A : Graph) (x y : vert A) : IsHProp (edge A x y)
:= pr2 (pr2 A) x y.(** We will need universe annotations in a few more places, but not many. *)
UA: Univalence PR: PropResizing A, B: Graph
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)} <~>
A = B
UA: Univalence PR: PropResizing A, B: Graph
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)} <~>
A = B
UA: Univalence PR: PropResizing A, B: Graph
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)} <~>
{p : A.1 = B.1 &
transport
(funV : Type =>
{E : V -> V -> Type & is_mere_relation V E}) p A.2 =
B.2}
UA: Univalence PR: PropResizing A, B: Graph
foralla : vert A <~> vert B,
(funf : vert A <~> vert B =>
forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) a <~>
(funp : A.1 = B.1 =>
transport
(funV : Type =>
{E : V -> V -> Type & is_mere_relation V E}) p A.2 =
B.2) (equiv_path_universe (vert A) (vert B) a)
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B
(forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) <~>
transport
(funV : Type =>
{E : V -> V -> Type & is_mere_relation V E})
(path_universe_uncurried f) A.2 = B.2
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B
(forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) <~>
(transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1;
transportD (funx : Type => x -> x -> Type)
(fun (x : Type) (y : x -> x -> Type) =>
is_mere_relation x y) (path_universe_uncurried f)
(A.2).1 (A.2).2) = B.2
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B
(forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) <~>
(transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1;
transportD (funx : Type => x -> x -> Type)
(fun (x : Type) (y : x -> x -> Type) =>
is_mere_relation x y) (path_universe_uncurried f)
(A.2).1 (A.2).2).1 = (B.2).1
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B
(forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) <~>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 = (B.2).1
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B
(forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) <~>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 == (B.2).1
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B
forallb : vert B,
(funa : vert A =>
forally : vert A, edge A a y <-> edge B (f a) (f y))
(f^-1%equiv b) <~>
(funb0 : vert B =>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 b0 = (B.2).1 b0)
b
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x: vert B
(funa : vert A =>
forally : vert A, edge A a y <-> edge B (f a) (f y))
(f^-1%equiv x) <~>
(funb : vert B =>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 b = (B.2).1 b)
x
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x: vert B
(forally : vert A,
edge A (f^-1%equiv x) y <->
edge B (f (f^-1%equiv x)) (f y)) <~>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 x == (B.2).1 x
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x: vert B
forallb : vert B,
(funa : vert A =>
edge A (f^-1%equiv x) a <->
edge B (f (f^-1%equiv x)) (f a)) (f^-1%equiv b) <~>
(funb0 : vert B =>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 x b0 =
(B.2).1 x b0) b
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x, y: vert B
(funa : vert A =>
edge A (f^-1%equiv x) a <->
edge B (f (f^-1%equiv x)) (f a)) (f^-1%equiv y) <~>
(funb : vert B =>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 x b =
(B.2).1 x b) y
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x, y: vert B
(edge A (f^-1 x) (f^-1 y) <->
edge B (f (f^-1 x)) (f (f^-1 y))) <~>
transport (funx : Type => x -> x -> Type)
(path_universe_uncurried f) (A.2).1 x y =
(B.2).1 x y
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x, y: vert B
(edge A (f^-1 x) (f^-1 y) <->
edge B (f (f^-1 x)) (f (f^-1 y))) <~>
transport (funx : Type => x -> Type)
(path_universe_uncurried f)
((A.2).1
(transport idmap (path_universe_uncurried f)^ x))
y = (B.2).1 x y
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x, y: vert B
(edge A (f^-1 x) (f^-1 y) <->
edge B (f (f^-1 x)) (f (f^-1 y))) <~>
(A.2).1
(transport idmap (path_universe_uncurried f)^ x)
(transport idmap (path_universe_uncurried f)^ y) =
(B.2).1 x y
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x, y: vert B
(edge A (f^-1 x) (f^-1 y) <->
edge B (f (f^-1 x)) (f (f^-1 y))) <~>
(A.2).1 (f^-1 x) (f^-1 y) = (B.2).1 x y
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x, y: vert B
(edge A (f^-1 x) (f^-1 y) <-> edge B x y) <~>
(A.2).1 (f^-1 x) (f^-1 y) = (B.2).1 x y
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B x, y: vert B
(edge A (f^-1 x) (f^-1 y) <-> edge B x y) <~>
((A.2).1 (f^-1 x) (f^-1 y) <~> (B.2).1 x y)
srefine (equiv_equiv_iff_hprop _ _).Qed.(** N will be the set of graphs generated by the empty graph as "zero", and "adding a new top element" as "successor". *)Definitiongraph_zero@{} : Graph
:= Build_Graph Empty
(funxy => @Empty_rec@{u} Type@{s} x)
(funxy => Empty_rec x).
UA: Univalence PR: PropResizing A: Graph
Graph
UA: Univalence PR: PropResizing A: Graph
Graph
UA: Univalence PR: PropResizing A: Graph
vert A + Unit -> vert A + Unit -> Type
UA: Univalence PR: PropResizing A: Graph
is_mere_relation (vert A + Unit) ?edge
UA: Univalence PR: PropResizing A: Graph
vert A + Unit -> vert A + Unit -> Type
UA: Univalence PR: PropResizing A: Graph x, y: vert A
Type
UA: Univalence PR: PropResizing A: Graph x: vert A y: Unit
Type
UA: Univalence PR: PropResizing A: Graph x: Unit y: vert A
Type
UA: Univalence PR: PropResizing A: Graph x, y: Unit
Type
UA: Univalence PR: PropResizing A: Graph x, y: vert A
Type
exact (edge A x y).
UA: Univalence PR: PropResizing A: Graph x: vert A y: Unit
Type
exact Unit.
UA: Univalence PR: PropResizing A: Graph x: Unit y: vert A
Type
exact Empty.
UA: Univalence PR: PropResizing A: Graph x, y: Unit
Type
exact Unit.
UA: Univalence PR: PropResizing A: Graph
is_mere_relation (vert A + Unit)
(funX : vert A + Unit =>
match X with
| inl v =>
(fun (x0 : vert A) (X0 : vert A + Unit) =>
match X0 with
| inl v0 =>
(funy0 : vert A => edge A x0 y0) v0
| inr u => unit_name Unit u
end) v
| inr u =>
unit_name
(funX0 : vert A + Unit =>
match X0 with
| inl v => (fun_ : vert A => Empty) v
| inr u0 => unit_name Unit u0
end) u
end)
cbn; intros [x|x] [y|y]; exact _.Defined.(** The following lemmas about graphs will be used later on to prove the Peano axioms about N. *)
UA: Univalence PR: PropResizing A: Graph x: vert (graph_succ A)
edge (graph_succ A) x (inr tt)
UA: Univalence PR: PropResizing A: Graph x: vert (graph_succ A)
edge (graph_succ A) x (inr tt)
destruct x as [x|x]; exact tt.Qed.
UA: Univalence PR: PropResizing A: Graph y: vert (graph_succ A) yt: forallx : vert (graph_succ A),
edge (graph_succ A) x y
y = inr tt
UA: Univalence PR: PropResizing A: Graph y: vert (graph_succ A) yt: forallx : vert (graph_succ A),
edge (graph_succ A) x y
y = inr tt
UA: Univalence PR: PropResizing A: Graph y: vert A yt: forallx : vert (graph_succ A),
edge (graph_succ A) x (inl y)
inl y = inr tt
UA: Univalence PR: PropResizing A: Graph yt: forallx : vert (graph_succ A),
edge (graph_succ A) x (inr tt)
inr tt = inr tt
UA: Univalence PR: PropResizing A: Graph y: vert A yt: forallx : vert (graph_succ A),
edge (graph_succ A) x (inl y)
inl y = inr tt
destruct (yt (inr tt)).
UA: Univalence PR: PropResizing A: Graph yt: forallx : vert (graph_succ A),
edge (graph_succ A) x (inr tt)
inr tt = inr tt
reflexivity.Qed.Definitiongraph_succ_not_top@{} {A : Graph} (x : vert A)
: ~(edge (graph_succ A) (inr tt) (inl x))
:= idmap.
UA: Univalence PR: PropResizing A: Graph x: vert (graph_succ A) xt: ~ edge (graph_succ A) (inr tt) x
is_inl x
UA: Univalence PR: PropResizing A: Graph x: vert (graph_succ A) xt: ~ edge (graph_succ A) (inr tt) x
is_inl x
UA: Univalence PR: PropResizing A: Graph x: vert A xt: ~ edge (graph_succ A) (inr tt) (inl x)
is_inl (inl x)
UA: Univalence PR: PropResizing A: Graph x: Unit xt: ~ edge (graph_succ A) (inr tt) (inr x)
is_inl (inr x)
UA: Univalence PR: PropResizing A: Graph x: vert A xt: ~ edge (graph_succ A) (inr tt) (inl x)
is_inl (inl x)
exact tt.
UA: Univalence PR: PropResizing A: Graph x: Unit xt: ~ edge (graph_succ A) (inr tt) (inr x)
is_inl (inr x)
destruct (xt tt).Qed.SectionGraph_Succ_Equiv.Context {AB : Graph} (f : vert (graph_succ A) <~> vert (graph_succ B))
(e : forallxy, edge (graph_succ A) x y <-> edge (graph_succ B) (f x) (f y)).
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
f (inr tt) = inr tt
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
f (inr tt) = inr tt
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
forallx : vert (graph_succ B),
edge (graph_succ B) x (f (inr tt))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert (graph_succ B)
edge (graph_succ B) x (f (inr tt))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert (graph_succ B)
edge (graph_succ B) (f (f^-1 x)) (f (inr tt))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert (graph_succ B)
edge (graph_succ A) (f^-1 x) (inr tt)
apply graph_succ_top.Qed.
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
forallx : vert A, is_inl (f (inl x))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
forallx : vert A, is_inl (f (inl x))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A
is_inl (f (inl x))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A
~ edge (graph_succ B) (inr tt) (f (inl x))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A ed: edge (graph_succ B) (f (f^-1 (inr tt)))
(f (inl x))
Empty
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A ed: edge (graph_succ A) (f^-1 (inr tt)) (inl x)
Empty
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A ed: edge (graph_succ A) (f^-1 (inr tt)) (inl x) finr:= graph_succ_equiv_inr: f (inr tt) = inr tt
Empty
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A ed: edge (graph_succ A) (f^-1 (inr tt)) (inl x) finr: inr tt = f^-1 (inr tt)
Empty
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A ed: edge (graph_succ A) (inr tt) (inl x) finr: inr tt = f^-1 (inr tt)
Empty
exact (graph_succ_not_top x ed).Qed.(* Coq bug: without the [:Unit] annotation some floating universe appears. *)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
forallx : Unit, is_inr (f (inr x))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
forallx : Unit, is_inr (f (inr x))
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
is_inr (f (inr tt))
srefine (transport@{s Set} is_inr graph_succ_equiv_inr^ tt).Qed.Definitiongraph_unsucc_equiv_vert@{} : vert A <~> vert B
:= equiv_unfunctor_sum_l@{s s s s s s} f Ha Hb.
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x, y: vert A
edge A x y <->
edge B (graph_unsucc_equiv_vert x)
(graph_unsucc_equiv_vert y)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x, y: vert A
edge A x y <->
edge B (graph_unsucc_equiv_vert x)
(graph_unsucc_equiv_vert y)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x, y: vert A h:= e (inl x) (inl y): edge (graph_succ A) (inl x) (inl y) <->
edge (graph_succ B) (f (inl x)) (f (inl y))
edge A x y <->
edge B (graph_unsucc_equiv_vert x)
(graph_unsucc_equiv_vert y)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x, y: vert A h: edge (graph_succ A) (inl x) (inl y) <->
edge (graph_succ B) (inl (unfunctor_sum_l f Ha x))
(f (inl y))
edge A x y <->
edge B (graph_unsucc_equiv_vert x)
(graph_unsucc_equiv_vert y)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x, y: vert A h: edge (graph_succ A) (inl x) (inl y) <->
edge (graph_succ B) (inl (unfunctor_sum_l f Ha x))
(inl (unfunctor_sum_l f Ha y))
edge A x y <->
edge B (graph_unsucc_equiv_vert x)
(graph_unsucc_equiv_vert y)
exact h.Qed.EndGraph_Succ_Equiv.
UA: Univalence PR: PropResizing A, B: Graph
A = B <~> graph_succ A = graph_succ B
UA: Univalence PR: PropResizing A, B: Graph
A = B <~> graph_succ A = graph_succ B
UA: Univalence PR: PropResizing A, B: Graph
A = B <~>
{f : vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)} <~>
{f : vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)} ->
{f : vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph
{f : vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)} ->
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph
?f o ?g == idmap
UA: Univalence PR: PropResizing A, B: Graph
?g o ?f == idmap
UA: Univalence PR: PropResizing A, B: Graph
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)} ->
{f : vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y)
{f : vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y)
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) ((f +E 1) x) ((f +E 1) y)
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x, y: vert (graph_succ A)
edge (graph_succ A) x y <->
edge (graph_succ B) ((f +E 1) x) ((f +E 1) y)
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x, y: vert A
edge A x y <-> edge B (f x) (f y)
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x: vert A y: Unit
Unit <-> Unit
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x: Unit y: vert A
Empty <-> Empty
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x, y: Unit
Unit <-> Unit
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x, y: vert A
edge A x y <-> edge B (f x) (f y)
apply e.
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x: vert A y: Unit
Unit <-> Unit
split; apply idmap.
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x: Unit y: vert A
Empty <-> Empty
split; apply idmap.
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y) x, y: Unit
Unit <-> Unit
split; apply idmap.
UA: Univalence PR: PropResizing A, B: Graph
{f : vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)} ->
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
{f : vert A <~> vert B &
forallxy : vert A, edge A x y <-> edge B (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
forallxy : vert A,
edge A x y <->
edge B (graph_unsucc_equiv_vert f e x)
(graph_unsucc_equiv_vert f e y)
exact (graph_unsucc_equiv_edge f e).
UA: Univalence PR: PropResizing A, B: Graph
(funX : {f : vert A <~> vert B &
forallxy : vert A,
edge A x y <-> edge B (f x) (f y)} =>
(fun (f : vert A <~> vert B)
(e : forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) =>
(f +E 1;
funxy : vert (graph_succ A) =>
match
x as s
return
(edge (graph_succ A) s y <->
edge (graph_succ B) ((f +E 1) s) ((f +E 1) y))
with
| inl v =>
(funx0 : vert A =>
match
y as s
return
(edge (graph_succ A) (inl x0) s <->
edge (graph_succ B) ((f +E 1) (inl x0))
((f +E 1) s))
with
| inl v0 =>
(funy0 : vert A =>
e x0 y0
:
edge (graph_succ A) (inl x0) (inl y0) <->
edge (graph_succ B) ((f +E 1) (inl x0))
((f +E 1) (inl y0))) v0
| inr u =>
(funy0 : Unit =>
(idmap, idmap)
:
edge (graph_succ A) (inl x0) (inr y0) <->
edge (graph_succ B) ((f +E 1) (inl x0))
((f +E 1) (inr y0))) u
end) v
| inr u =>
(funx0 : Unit =>
match
y as s
return
(edge (graph_succ A) (inr x0) s <->
edge (graph_succ B) ((f +E 1) (inr x0))
((f +E 1) s))
with
| inl v =>
(funy0 : vert A =>
(idmap, idmap)
:
edge (graph_succ A) (inr x0) (inl y0) <->
edge (graph_succ B) ((f +E 1) (inr x0))
((f +E 1) (inl y0))) v
| inr u0 =>
(funy0 : Unit =>
(idmap, idmap)
:
edge (graph_succ A) (inr x0) (inr y0) <->
edge (graph_succ B) ((f +E 1) (inr x0))
((f +E 1) (inr y0))) u0
end) u
end)) X.1 X.2)
o (funX : {f
: vert (graph_succ A) <~> vert (graph_succ B)
&
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)} =>
(fun
(f : vert (graph_succ A) <~> vert (graph_succ B))
(e : forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)) =>
(graph_unsucc_equiv_vert f e;
graph_unsucc_equiv_edge f e)) X.1 X.2) == idmap
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
(graph_unsucc_equiv_vert f e +E 1;
funxy : vert (graph_succ A) =>
match
x as s
return
(edge (graph_succ A) s y <->
edge (graph_succ B)
((graph_unsucc_equiv_vert f e +E 1) s)
((graph_unsucc_equiv_vert f e +E 1) y))
with
| inl v =>
match
y as s
return
(edge (graph_succ A) (inl v) s <->
edge (graph_succ B)
((graph_unsucc_equiv_vert f e +E 1) (inl v))
((graph_unsucc_equiv_vert f e +E 1) s))
with
| inl v0 => graph_unsucc_equiv_edge f e v v0
| inr _ => (idmap, idmap)
end
| inr u =>
match
y as s
return
(edge (graph_succ A) (inr u) s <->
edge (graph_succ B)
((graph_unsucc_equiv_vert f e +E 1) (inr u))
((graph_unsucc_equiv_vert f e +E 1) s))
with
| inl _ => (idmap, idmap)
| inr _ => (idmap, idmap)
endend) = (f; e)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
graph_unsucc_equiv_vert f e +E 1 = f
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A
inl (unfunctor_sum_l f (Ha f e) x) = f (inl x)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
inr tt = f (inr tt)
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y) x: vert A
inl (unfunctor_sum_l f (Ha f e) x) = f (inl x)
apply unfunctor_sum_l_beta.
UA: Univalence PR: PropResizing A, B: Graph f: vert (graph_succ A) <~> vert (graph_succ B) e: forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)
inr tt = f (inr tt)
symmetry; apply graph_succ_equiv_inr, e.
UA: Univalence PR: PropResizing A, B: Graph
(funX : {f
: vert (graph_succ A) <~> vert (graph_succ B) &
forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)} =>
(fun
(f : vert (graph_succ A) <~> vert (graph_succ B))
(e : forallxy : vert (graph_succ A),
edge (graph_succ A) x y <->
edge (graph_succ B) (f x) (f y)) =>
(graph_unsucc_equiv_vert f e;
graph_unsucc_equiv_edge f e)) X.1 X.2)
o (funX : {f : vert A <~> vert B &
forallxy : vert A,
edge A x y <-> edge B (f x) (f y)} =>
(fun (f : vert A <~> vert B)
(e : forallxy : vert A,
edge A x y <-> edge B (f x) (f y)) =>
(f +E 1;
funxy : vert (graph_succ A) =>
match
x as s
return
(edge (graph_succ A) s y <->
edge (graph_succ B) ((f +E 1) s) ((f +E 1) y))
with
| inl v =>
(funx0 : vert A =>
match
y as s
return
(edge (graph_succ A) (inl x0) s <->
edge (graph_succ B) ((f +E 1) (inl x0))
((f +E 1) s))
with
| inl v0 =>
(funy0 : vert A =>
e x0 y0
:
edge (graph_succ A) (inl x0) (inl y0) <->
edge (graph_succ B) ((f +E 1) (inl x0))
((f +E 1) (inl y0))) v0
| inr u =>
(funy0 : Unit =>
(idmap, idmap)
:
edge (graph_succ A) (inl x0) (inr y0) <->
edge (graph_succ B) ((f +E 1) (inl x0))
((f +E 1) (inr y0))) u
end) v
| inr u =>
(funx0 : Unit =>
match
y as s
return
(edge (graph_succ A) (inr x0) s <->
edge (graph_succ B) ((f +E 1) (inr x0))
((f +E 1) s))
with
| inl v =>
(funy0 : vert A =>
(idmap, idmap)
:
edge (graph_succ A) (inr x0) (inl y0) <->
edge (graph_succ B) ((f +E 1) (inr x0))
((f +E 1) (inl y0))) v
| inr u0 =>
(funy0 : Unit =>
(idmap, idmap)
:
edge (graph_succ A) (inr x0) (inr y0) <->
edge (graph_succ B) ((f +E 1) (inr x0))
((f +E 1) (inr y0))) u0
end) u
end)) X.1 X.2) == idmap
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y)
(graph_unsucc_equiv_vert (f +E 1)
(funxy : vert (graph_succ A) =>
match
x as s
return
(edge (graph_succ A) s y <->
edge (graph_succ B) ((f +E 1) s) ((f +E 1) y))
with
| inl v =>
match
y as s
return
(edge (graph_succ A) (inl v) s <->
edge (graph_succ B) ((f +E 1) (inl v))
((f +E 1) s))
with
| inl v0 => e v v0
| inr _ => (idmap, idmap)
end
| inr u =>
match
y as s
return
(edge (graph_succ A) (inr u) s <->
edge (graph_succ B) ((f +E 1) (inr u))
((f +E 1) s))
with
| inl _ => (idmap, idmap)
| inr _ => (idmap, idmap)
endend);
graph_unsucc_equiv_edge (f +E 1)
(funxy : vert (graph_succ A) =>
match
x as s
return
(edge (graph_succ A) s y <->
edge (graph_succ B) ((f +E 1) s) ((f +E 1) y))
with
| inl v =>
match
y as s
return
(edge (graph_succ A) (inl v) s <->
edge (graph_succ B) ((f +E 1) (inl v))
((f +E 1) s))
with
| inl v0 => e v v0
| inr _ => (idmap, idmap)
end
| inr u =>
match
y as s
return
(edge (graph_succ A) (inr u) s <->
edge (graph_succ B) ((f +E 1) (inr u))
((f +E 1) s))
with
| inl _ => (idmap, idmap)
| inr _ => (idmap, idmap)
endend)) = (f; e)
UA: Univalence PR: PropResizing A, B: Graph f: vert A <~> vert B e: forallxy : vert A,
edge A x y <-> edge B (f x) (f y)
graph_unsucc_equiv_vert (f +E 1)
(funxy : vert A + Unit =>
match
x as s
return
(match s with
| inl v =>
funX : vert A + Unit =>
match X with
| inl v0 => edge A v v0
| inr _ => Unit
end
| inr _ =>
funX : vert A + Unit =>
match X with
| inl _ => Empty
| inr _ => Unit
endend y <->
match functor_sum f idmap s with
| inl v =>
funX : vert B + Unit =>
match X with
| inl v0 => edge B v v0
| inr _ => Unit
end
| inr _ =>
funX : vert B + Unit =>
match X with
| inl _ => Empty
| inr _ => Unit
endend (functor_sum f idmap y))
with
| inl v =>
match
y as s
return
(match s with
| inl v0 => edge A v v0
| inr _ => Unit
end <->
match functor_sum f idmap s with
| inl v0 => edge B (f v) v0
| inr _ => Unit
end)
with
| inl v0 => e v v0
| inr _ => (idmap, idmap)
end
| inr _ =>
match
y as s
return
(match s with
| inl _ => Empty
| inr _ => Unit
end <->
match functor_sum f idmap s with
| inl _ => Empty
| inr _ => Unit
end)
with
| inl _ => (idmap, idmap)
| inr _ => (idmap, idmap)
endend) = f
apply path_equiv, path_arrow; intros x; reflexivity.Defined.Definitiongraph_unsucc_path@{} (A B : Graph)
: (graph_succ A = graph_succ B) -> A = B
:= (graph_succ_path_equiv A B)^-1.(** Here is the impredicative definition of N, as the smallest subtype of [Graph] containing [graph_zero] and closed under [graph_succ]. *)Definitionin_N@{p} (n : Graph)
:= forall (P : Graph -> Type@{p}),
(forallA, IsHProp (P A))
-> P graph_zero
-> (forallA, P A -> P (graph_succ A))
-> P n.
UA: Univalence PR: PropResizing n: Graph
IsHProp (in_N n)
UA: Univalence PR: PropResizing n: Graph
IsHProp (in_N n)
apply istrunc_forall.Qed.(** [p] : universe of [N], morally [u+1] i.e. [s+2]. *)Universep.DefinitionN@{} : Type@{p}
:= @sig@{u p} Graph in_N@{u}.Definitionpath_N@{} (n m : N) : n.1 = m.1 -> n = m
:= path_sigma_hprop@{u p p} n m.
UA: Univalence PR: PropResizing
N
UA: Univalence PR: PropResizing
N
UA: Univalence PR: PropResizing
in_N graph_zero
intros P PH P0 Ps; exact P0.Defined.
UA: Univalence PR: PropResizing
N -> N
UA: Univalence PR: PropResizing
N -> N
UA: Univalence PR: PropResizing n: Graph nrec: in_N n
N
UA: Univalence PR: PropResizing n: Graph nrec: in_N n
in_N (graph_succ n)
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P (graph_succ n)
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P n
exact (nrec P PH P0 Ps).Defined.(** First Peano axiom: successor is injective *)
UA: Univalence PR: PropResizing n, m: N p: succ n = succ m
n = m
UA: Univalence PR: PropResizing n, m: N p: succ n = succ m
n = m
UA: Univalence PR: PropResizing n, m: N p: succ n = succ m
n.1 = m.1
UA: Univalence PR: PropResizing n, m: N p: succ n = succ m
graph_succ n.1 = graph_succ m.1
exact (p..1).Qed.(** A slightly more general version of the theorem that N is a set, which will be useful later. *)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
IsHProp (A = B)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
IsHProp (A = B)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
Contr (A = A)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
Contr (graph_zero = graph_zero)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
forallA : Graph,
Contr (A = A) -> Contr (graph_succ A = graph_succ A)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
Contr (graph_zero = graph_zero)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
IsHProp (graph_zero = graph_zero)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
forallxy : graph_zero = graph_zero, x = y
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A fe: {f : vert graph_zero <~> vert graph_zero &
forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f x) (f y)}
forally : graph_zero = graph_zero,
equiv_path_graph graph_zero graph_zero fe = y
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A f: vert graph_zero <~> vert graph_zero e: forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f x) (f y)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A f: vert graph_zero <~> vert graph_zero e: forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f x) (f y) fe': {f : vert graph_zero <~> vert graph_zero &
forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A f: vert graph_zero <~> vert graph_zero e: forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f x) (f y) f': vert graph_zero <~> vert graph_zero e': forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f' x) (f' y)
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A f: vert graph_zero <~> vert graph_zero e: forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f x) (f y) f': vert graph_zero <~> vert graph_zero e': forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f' x) (f' y)
(f; e) = (f'; e')
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A f: vert graph_zero <~> vert graph_zero e: forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f x) (f y) f': vert graph_zero <~> vert graph_zero e': forallxy : vert graph_zero,
edge graph_zero x y <->
edge graph_zero (f' x) (f' y)
(f; e).1 == (f'; e').1
intros [].
UA: Univalence PR: PropResizing A, B: Graph Arec: in_N A
forallA : Graph,
Contr (A = A) -> Contr (graph_succ A = graph_succ A)
UA: Univalence PR: PropResizing A: Graph Arec: in_N A B: Graph BC: Contr (B = B)
Contr (graph_succ B = graph_succ B)
refine (contr_equiv (B = B) (graph_succ_path_equiv B B)).Qed.
UA: Univalence PR: PropResizing n: N A: Graph
IsHProp (n.1 = A)
UA: Univalence PR: PropResizing n: N A: Graph
IsHProp (n.1 = A)
apply ishprop_path_graph_in_N, pr2.Qed.
UA: Univalence PR: PropResizing
IsHSet N
UA: Univalence PR: PropResizing
IsHSet N
UA: Univalence PR: PropResizing
is_mere_relation N paths
UA: Univalence PR: PropResizing n, m: N
IsHProp (n = m)
UA: Univalence PR: PropResizing n, m: N
IsHProp (n = m)
refine (istrunc_equiv_istrunc (n.1 = m.1) (equiv_path_sigma_hprop n m)).Qed.
UA: Univalence PR: PropResizing A: Graph p: graph_zero = graph_succ A f: vert graph_zero <~> vert (graph_succ A) e: forallxy : vert graph_zero,
edge graph_zero x y <->
edge (graph_succ A) (f x) (f y)
Empty
exact (f^-1 (inr tt)).Qed.(** Second Peano axiom: zero is not a successor *)
UA: Univalence PR: PropResizing n: N
zero <> succ n
UA: Univalence PR: PropResizing n: N
zero <> succ n
intros p; apply pr1_path in p; refine (graph_zero_neq_succ p).Qed.(** This tweak is sometimes necessary to avoid universe inconsistency. It's how the impredicativity of propositional resizing enters. *)
UA: Univalence PR: PropResizing n: Graph nrec: in_N n
in_N n
UA: Univalence PR: PropResizing n: Graph nrec: in_N n
in_N n
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P': Graph -> Type PH': forallA : Graph, IsHProp (P' A) P0': P' graph_zero Ps': forallA : Graph, P' A -> P' (graph_succ A)
P' n
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P': Graph -> Type PH': forallA : Graph, IsHProp (P' A) P0': P' graph_zero Ps': forallA : Graph, P' A -> P' (graph_succ A)
smalltype (P' graph_zero)
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P': Graph -> Type PH': forallA : Graph, IsHProp (P' A) P0': P' graph_zero Ps': forallA : Graph, P' A -> P' (graph_succ A)
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P': Graph -> Type PH': forallA : Graph, IsHProp (P' A) P0': P' graph_zero Ps': forallA : Graph, P' A -> P' (graph_succ A)
smalltype (P' graph_zero)
exact ((equiv_smalltype (P' graph_zero))^-1 P0').
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P': Graph -> Type PH': forallA : Graph, IsHProp (P' A) P0': P' graph_zero Ps': forallA : Graph, P' A -> P' (graph_succ A)
UA: Univalence PR: PropResizing n: Graph nrec: in_N n P': Graph -> Type PH': forallA : Graph, IsHProp (P' A) P0': P' graph_zero Ps': forallA : Graph, P' A -> P' (graph_succ A) A: Graph P'A: smalltype (P' A)
UA: Univalence PR: PropResizing n: Graph snrec: in_N (graph_succ n) m: N Hs: n = m.1
in_N n
UA: Univalence PR: PropResizing n: Graph snrec: in_N (graph_succ n) m: N Hs: n = m.1
in_N m.1
exact m.2.Qed.(** Final Peano axiom: induction. Importantly, the universe of the motive [P] is not constrained but can be arbitrary. *)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n)
foralln : N, P n
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n)
foralln : N, P n
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) n: Graph nrec: in_N n
P (n; nrec)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) n: Graph nrec: in_N n Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type
P (n; nrec)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type
Q graph_zero
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type
forallA : Graph, Q A -> Q (graph_succ A)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type
Q graph_zero
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type zrec: in_N graph_zero
P (graph_zero; zrec)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type zrec: in_N graph_zero
zero = (graph_zero; zrec)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type zrec: in_N graph_zero
(fun (P : Graph -> Type)
(_ : forallA : Graph, IsHProp (P A))
(P0 : P graph_zero)
(_ : forallA : Graph, P A -> P (graph_succ A)) =>
P0) = zrec
apply path_ishprop.
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type
forallA : Graph, Q A -> Q (graph_succ A)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type A: Graph QA: Q A Asrec: in_N (graph_succ A)
P (graph_succ A; Asrec)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type A: Graph QA: Q A Asrec: in_N (graph_succ A) m:= (A; pred_in_N A Asrec) : N: N
P (graph_succ A; Asrec)
UA: Univalence PR: PropResizing P: N -> Type H: foralln : N, IsHProp (P n) P0: P zero Ps: foralln : N, P n -> P (succ n) Q:= funm : Graph => forallmrec : in_N m, P (m; mrec): Graph -> Type A: Graph QA: Q A Asrec: in_N (graph_succ A) m:= (A; pred_in_N A Asrec) : N: N
succ m = (graph_succ A; Asrec)
apply path_N; reflexivity.Qed.(** A first application *)
UA: Univalence PR: PropResizing n: N
n <> succ n
UA: Univalence PR: PropResizing n: N
n <> succ n
UA: Univalence PR: PropResizing
foralln : N, IsHProp (n <> succ n)
UA: Univalence PR: PropResizing
zero <> succ zero
UA: Univalence PR: PropResizing
foralln : N, n <> succ n -> succ n <> succ (succ n)
UA: Univalence PR: PropResizing
foralln : N, IsHProp (n <> succ n)
intros n;exact istrunc_arrow@{p p p}.
UA: Univalence PR: PropResizing
zero <> succ zero
apply zero_neq_succ.
UA: Univalence PR: PropResizing
foralln : N, n <> succ n -> succ n <> succ (succ n)
UA: Univalence PR: PropResizing n: N H: n <> succ n e: succ n = succ (succ n)
Empty
UA: Univalence PR: PropResizing n: N H: n <> succ n e: succ n = succ (succ n)
n = succ n
exact (succ_inj n (succ n) e).Qed.(** Now we want to use induction to define recursion. The basic idea is the same as always: define partial attempts and show by induction that they are uniquely defined. But we have to be careful to phrase it in a way that works without assuming any truncation restrictions on the codomain. First we need inequality on N, which we define in terms of addition. Normally addition is defined *using* recursion, but here we can "cheat" because we know how to add graphs, and then prove that it satisfies the recursive equations for addition. *)
UA: Univalence PR: PropResizing A, B: Graph
Graph
UA: Univalence PR: PropResizing A, B: Graph
Graph
UA: Univalence PR: PropResizing A, B: Graph
{E : vert A + vert B -> vert A + vert B -> Type &
is_mere_relation (vert A + vert B) E}
UA: Univalence PR: PropResizing A, B: Graph
forallxy : vert A + vert B,
IsHProp
match x with
| inl a =>
match y with
| inl a' => edge A a a'
| inr _ => Unit
end
| inr b =>
match y with
| inl _ => Empty
| inr b' => edge B b b'
endend
intros [a|b] [a'|b']; exact _.Defined.
UA: Univalence PR: PropResizing A: Graph
graph_add A graph_zero = A
UA: Univalence PR: PropResizing A: Graph
graph_add A graph_zero = A
UA: Univalence PR: PropResizing A: Graph
{f : vert (graph_add A graph_zero) <~> vert A &
forallxy : vert (graph_add A graph_zero),
edge (graph_add A graph_zero) x y <->
edge A (f x) (f y)}
UA: Univalence PR: PropResizing A: Graph
forallxy : vert (graph_add A graph_zero),
edge (graph_add A graph_zero) x y <->
edge A (sum_empty_r (vert A) x)
(sum_empty_r (vert A) y)
UA: Univalence PR: PropResizing A: Graph x, y: vert A
edge (graph_add A graph_zero) (inl x) (inl y) <->
edge A (sum_empty_r (vert A) (inl x))
(sum_empty_r (vert A) (inl y))
apply iff_reflexive@{u s}.Qed.
UA: Univalence PR: PropResizing A: Graph
graph_add graph_zero A = A
UA: Univalence PR: PropResizing A: Graph
graph_add graph_zero A = A
UA: Univalence PR: PropResizing A: Graph
{f : vert (graph_add graph_zero A) <~> vert A &
forallxy : vert (graph_add graph_zero A),
edge (graph_add graph_zero A) x y <->
edge A (f x) (f y)}
UA: Univalence PR: PropResizing A: Graph
forallxy : vert (graph_add graph_zero A),
edge (graph_add graph_zero A) x y <->
edge A (sum_empty_l (vert A) x)
(sum_empty_l (vert A) y)
UA: Univalence PR: PropResizing A: Graph x, y: vert A
edge (graph_add graph_zero A) (inr x) (inr y) <->
edge A (sum_empty_l (vert A) (inr x))
(sum_empty_l (vert A) (inr y))
apply iff_reflexive@{u s}.Qed.
UA: Univalence PR: PropResizing A, B: Graph
graph_add A (graph_succ B) =
graph_succ (graph_add A B)
UA: Univalence PR: PropResizing A, B: Graph
graph_add A (graph_succ B) =
graph_succ (graph_add A B)
UA: Univalence PR: PropResizing A, B: Graph
{f
: vert (graph_add A (graph_succ B)) <~>
vert (graph_succ (graph_add A B)) &
forallxy : vert (graph_add A (graph_succ B)),
edge (graph_add A (graph_succ B)) x y <->
edge (graph_succ (graph_add A B)) (f x) (f y)}
UA: Univalence PR: PropResizing A, B: Graph
forallxy : vert (graph_add A (graph_succ B)),
edge (graph_add A (graph_succ B)) x y <->
edge (graph_succ (graph_add A B))
((equiv_sum_assoc (vert A) (vert B) Unit)^-1%equiv x)
((equiv_sum_assoc (vert A) (vert B) Unit)^-1%equiv y)
graph_add (graph_add A B) C =
graph_add A (graph_add B C)
UA: Univalence PR: PropResizing A, B, C: Graph
graph_add (graph_add A B) C =
graph_add A (graph_add B C)
UA: Univalence PR: PropResizing A, B, C: Graph
{f
: vert (graph_add (graph_add A B) C) <~>
vert (graph_add A (graph_add B C)) &
forallxy : vert (graph_add (graph_add A B) C),
edge (graph_add (graph_add A B) C) x y <->
edge (graph_add A (graph_add B C)) (f x) (f y)}
UA: Univalence PR: PropResizing A, B, C: Graph
forallxy : vert (graph_add (graph_add A B) C),
edge (graph_add (graph_add A B) C) x y <->
edge (graph_add A (graph_add B C))
(equiv_sum_assoc (vert A) (vert B) (vert C) x)
(equiv_sum_assoc (vert A) (vert B) (vert C) y)
intros [[x|x]|x] [[y|y]|y]; apply iff_reflexive@{u s}.Qed.Definitiongraph_one@{} : Graph
:= Build_Graph Unit (fun__ : Unit => Unit) _.
UA: Univalence PR: PropResizing A: Graph
graph_add A graph_one = graph_succ A
UA: Univalence PR: PropResizing A: Graph
graph_add A graph_one = graph_succ A
UA: Univalence PR: PropResizing A: Graph
{f
: vert (graph_add A graph_one) <~> vert (graph_succ A)
&
forallxy : vert (graph_add A graph_one),
edge (graph_add A graph_one) x y <->
edge (graph_succ A) (f x) (f y)}
UA: Univalence PR: PropResizing A: Graph
forallxy : vert (graph_add A graph_one),
edge (graph_add A graph_one) x y <->
edge (graph_succ A) (1%equiv x) (1%equiv y)
UA: Univalence PR: PropResizing P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P graph_one
UA: Univalence PR: PropResizing P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P (graph_succ graph_zero)
apply Ps, P0.Defined.
UA: Univalence PR: PropResizing n, m: N
N
UA: Univalence PR: PropResizing n, m: N
N
UA: Univalence PR: PropResizing n, m: N
in_N (graph_add n.1 m.1)
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P (graph_add n.1 m.1)
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
forallA : Graph, IsHProp (P (graph_add n.1 A))
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P (graph_add n.1 graph_zero)
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
forallA : Graph,
P (graph_add n.1 A) ->
P (graph_add n.1 (graph_succ A))
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
forallA : Graph, IsHProp (P (graph_add n.1 A))
intros; apply PH.
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P (graph_add n.1 graph_zero)
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
P n.1
exact (n.2 P PH P0 Ps).
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A)
forallA : Graph,
P (graph_add n.1 A) ->
P (graph_add n.1 (graph_succ A))
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A) A: Graph PA: P (graph_add n.1 A)
P (graph_add n.1 (graph_succ A))
UA: Univalence PR: PropResizing n, m: N P: Graph -> Type PH: forallA : Graph, IsHProp (P A) P0: P graph_zero Ps: forallA : Graph, P A -> P (graph_succ A) A: Graph PA: P (graph_add n.1 A)
P (graph_succ (graph_add n.1 A))
apply Ps, PA.Defined.Notation"n + m" := (N_add n m).
UA: Univalence PR: PropResizing n: N
zero + n = n
UA: Univalence PR: PropResizing n: N
zero + n = n
apply path_N, graph_add_zero_l.Qed.
UA: Univalence PR: PropResizing n: N
n + zero = n
UA: Univalence PR: PropResizing n: N
n + zero = n
apply path_N, graph_add_zero_r.Qed.
UA: Univalence PR: PropResizing n, m: N
n + succ m = succ (n + m)
UA: Univalence PR: PropResizing n, m: N
n + succ m = succ (n + m)
apply path_N, graph_add_succ.Qed.
UA: Univalence PR: PropResizing n, m, k: N
n + m + k = n + (m + k)
UA: Univalence PR: PropResizing n, m, k: N
n + m + k = n + (m + k)
apply path_N, graph_add_assoc.Qed.
UA: Univalence PR: PropResizing n, m, k: N H: n + k = m + k
n = m
UA: Univalence PR: PropResizing n, m, k: N H: n + k = m + k
n = m
UA: Univalence PR: PropResizing n, m: N
forallk : N, n + k = m + k -> n = m
UA: Univalence PR: PropResizing n, m: N
n + zero = m + zero -> n = m
UA: Univalence PR: PropResizing n, m: N
foralln0 : N,
(n + n0 = m + n0 -> n = m) ->
n + succ n0 = m + succ n0 -> n = m
UA: Univalence PR: PropResizing n, m: N
n + zero = m + zero -> n = m
intros H; rewrite !N_add_zero_r in H; exact H.
UA: Univalence PR: PropResizing n, m: N
foralln0 : N,
(n + n0 = m + n0 -> n = m) ->
n + succ n0 = m + succ n0 -> n = m
UA: Univalence PR: PropResizing n, m, k: N H1: n + k = m + k -> n = m H2: n + succ k = m + succ k
n = m
UA: Univalence PR: PropResizing n, m, k: N H1: n + k = m + k -> n = m H2: succ (n + k) = succ (m + k)
n = m
UA: Univalence PR: PropResizing n, m, k: N H1: n + k = m + k -> n = m H2: succ (n + k) = succ (m + k)
n + k = m + k
exact (succ_inj _ _ H2).Qed.
UA: Univalence PR: PropResizing n, k: N H: k + n = n
k = zero
UA: Univalence PR: PropResizing n, k: N H: k + n = n
k = zero
UA: Univalence PR: PropResizing n, k: N H: k + n = n
k + n = zero + n
UA: Univalence PR: PropResizing n, k: N H: k + n = n
zero + n = n
apply path_N, graph_add_zero_l.Qed.
UA: Univalence PR: PropResizing n: N
n + one = succ n
UA: Univalence PR: PropResizing n: N
n + one = succ n
UA: Univalence PR: PropResizing n: N
graph_add n.1 graph_one = graph_succ n.1
apply graph_add_one_succ.Qed.
UA: Univalence PR: PropResizing n: N
one + n = succ n
UA: Univalence PR: PropResizing n: N
one + n = succ n
UA: Univalence PR: PropResizing
one + zero = succ zero
UA: Univalence PR: PropResizing
foralln : N,
one + n = succ n -> one + succ n = succ (succ n)
UA: Univalence PR: PropResizing
one + zero = succ zero
UA: Univalence PR: PropResizing
one = succ zero
UA: Univalence PR: PropResizing
one.1 = (succ zero).1
symmetry; apply graph_succ_zero.
UA: Univalence PR: PropResizing
foralln : N,
one + n = succ n -> one + succ n = succ (succ n)
UA: Univalence PR: PropResizing n: N H: one + n = succ n
one + succ n = succ (succ n)
UA: Univalence PR: PropResizing n: N H: one + n = succ n
succ (one + n) = succ (succ n)
apply ap, H.Qed.
UA: Univalence PR: PropResizing n, m: N
succ n + m = succ (n + m)
UA: Univalence PR: PropResizing n, m: N
succ n + m = succ (n + m)
UA: Univalence PR: PropResizing n, m: N
n + one + m = succ (n + m)
UA: Univalence PR: PropResizing n, m: N
n + (one + m) = succ (n + m)
UA: Univalence PR: PropResizing n, m: N
n + succ m = succ (n + m)
apply N_add_succ.Qed.(** Now we define inequality in terms of addition. *)DefinitionN_le@{} (n m : N) : Type@{p}
:= { k : N & k + n = m }.Notation"n <= m" := (N_le n m).
UA: Univalence PR: PropResizing n, m: N
IsHProp (n <= m)
UA: Univalence PR: PropResizing n, m: N
IsHProp (n <= m)
UA: Univalence PR: PropResizing n, m: N
forallxy : N, x + n = m -> y + n = m -> x = y
UA: Univalence PR: PropResizing n, m, x, y: N e1: x + n = m e2: y + n = m
x = y
UA: Univalence PR: PropResizing n, m, x, y: N e1: x + n = m e2: y + n = m
x + n = y + n
path_via m.Qed.
UA: Univalence PR: PropResizing n: N
zero <= n
UA: Univalence PR: PropResizing n: N
zero <= n
UA: Univalence PR: PropResizing n: N
n + zero = n
apply N_add_zero_r.Qed.
UA: Univalence PR: PropResizing n: N H: n <= zero
n = zero
UA: Univalence PR: PropResizing n: N H: n <= zero
n = zero
UA: Univalence PR: PropResizing n, k: N H: k + n = zero
n = zero
UA: Univalence PR: PropResizing n, k: N H: (k + n).1 = zero.1
n = zero
UA: Univalence PR: PropResizing n, k: N H: vert (k + n).1 <~> vert zero.1
n = zero
UA: Univalence PR: PropResizing n, k: N H: vert (k + n).1 <~> vert zero.1 f: vert n.1 -> Empty
n = zero
UA: Univalence PR: PropResizing n, k: N H: vert (k + n).1 <~> vert zero.1 f: vert n.1 -> Empty
{f : vert n.1 <~> vert zero.1 &
forallxy : vert n.1,
edge n.1 x y <-> edge zero.1 (f x) (f y)}
UA: Univalence PR: PropResizing n, k: N H: vert (k + n).1 <~> vert zero.1 f: vert n.1 -> Empty
forallxy : vert n.1,
edge n.1 x y <-> Empty_rec (f x)
intros x y; destruct (f x).Qed.
UA: Univalence PR: PropResizing
Contr {n : N & n <= zero}
UA: Univalence PR: PropResizing
Contr {n : N & n <= zero}
UA: Univalence PR: PropResizing
forally : {n : N & n <= zero},
(zero; N_zero_le zero) = y
UA: Univalence PR: PropResizing n: N H: n <= zero
(zero; N_zero_le zero) = (n; H)
UA: Univalence PR: PropResizing n: N H: n <= zero
(zero; N_zero_le zero).1 = (n; H).1
exact (N_le_zero n H)^.Qed.
UA: Univalence PR: PropResizing
Reflexive N_le
UA: Univalence PR: PropResizing
Reflexive N_le
UA: Univalence PR: PropResizing n: N
n <= n
UA: Univalence PR: PropResizing n: N
zero + n = n
apply N_add_zero_l.Qed.DefinitionN_lt@{} (n m : N) : Type@{p}
:= { k : N & (succ k) + n = m }.Notation"n < m" := (N_lt n m).
UA: Univalence PR: PropResizing n, m: N
IsHProp (n < m)
UA: Univalence PR: PropResizing n, m: N
IsHProp (n < m)
UA: Univalence PR: PropResizing n, m: N
forallxy : N,
succ x + n = m -> succ y + n = m -> x = y
UA: Univalence PR: PropResizing n, m, x, y: N e1: succ x + n = m e2: succ y + n = m
x = y
UA: Univalence PR: PropResizing n, m, x, y: N e1: succ x + n = m e2: succ y + n = m
x + succ n = y + succ n
UA: Univalence PR: PropResizing n, m, x, y: N e1: succ x + n = m e2: succ y + n = m
UA: Univalence PR: PropResizing n, k: N H: succ k + n = zero
Empty
UA: Univalence PR: PropResizing n, k: N H: vert (succ k + n).1 <~> vert zero.1
Empty
exact (H (inl (inr tt))).Qed.
UA: Univalence PR: PropResizing n: N
~ (n < n)
UA: Univalence PR: PropResizing n: N
~ (n < n)
UA: Univalence PR: PropResizing
foralln : N, IsHProp (~ (n < n))
UA: Univalence PR: PropResizing
~ (zero < zero)
UA: Univalence PR: PropResizing
foralln : N, ~ (n < n) -> ~ (succ n < succ n)
UA: Univalence PR: PropResizing
foralln : N, IsHProp (~ (n < n))
intros n;exact istrunc_arrow@{p p p}.
UA: Univalence PR: PropResizing
~ (zero < zero)
apply N_lt_zero.
UA: Univalence PR: PropResizing
foralln : N, ~ (n < n) -> ~ (succ n < succ n)
UA: Univalence PR: PropResizing n: N H: ~ (n < n) k: N K: succ k + succ n = succ n
Empty
UA: Univalence PR: PropResizing n: N H: ~ (n < n) k: N K: succ k + succ n = succ n
succ k + n = n
UA: Univalence PR: PropResizing n: N H: ~ (n < n) k: N K: succ (succ k + n) = succ n
succ k + n = n
apply succ_inj; assumption.Qed.
UA: Univalence PR: PropResizing n, m: N H: n <= m
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m: N H: n <= m
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m: N H: n <= m
IsHProp ((n = m) + (n < m))
UA: Univalence PR: PropResizing n, m: N H: n <= m HP: IsHProp ((n = m) + (n < m))
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m: N H: n <= m
IsHProp ((n = m) + (n < m))
UA: Univalence PR: PropResizing n, m: N H: n <= m
n = m -> n < m -> Empty
UA: Univalence PR: PropResizing n, m: N H: n <= m l: N K: succ l + n = n
Empty
UA: Univalence PR: PropResizing n, m: N H: n <= m l: N K: succ l = zero
Empty
symmetry in K; apply zero_neq_succ in K; assumption.
UA: Univalence PR: PropResizing n, m: N H: n <= m HP: IsHProp ((n = m) + (n < m))
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m, k: N K: k + n = m HP: IsHProp ((n = m) + (n < m))
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m, k: N K: k + n = m HP: IsHProp ((n = m) + (n < m)) k0: k = zero
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m, k: N K: k + n = m HP: IsHProp ((n = m) + (n < m)) l: N L: k = succ l
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m, k: N K: k + n = m HP: IsHProp ((n = m) + (n < m)) k0: k = zero
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m, k: N K: zero + n = m HP: IsHProp ((n = m) + (n < m)) k0: k = zero
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m, k: N K: n = m HP: IsHProp ((n = m) + (n < m)) k0: k = zero
((n = m) + (n < m))%type
exact (inl K).
UA: Univalence PR: PropResizing n, m, k: N K: k + n = m HP: IsHProp ((n = m) + (n < m)) l: N L: k = succ l
((n = m) + (n < m))%type
UA: Univalence PR: PropResizing n, m, k, l: N K: succ l + n = m HP: IsHProp ((n = m) + (n < m)) L: k = succ l
((n = m) + (n < m))%type
exact (inr (l;K)).Qed.
UA: Univalence PR: PropResizing n: N
~ (succ n < n)
UA: Univalence PR: PropResizing n: N
~ (succ n < n)
UA: Univalence PR: PropResizing
foralln : N, IsHProp (~ (succ n < n))
UA: Univalence PR: PropResizing
~ (succ zero < zero)
UA: Univalence PR: PropResizing
foralln : N,
~ (succ n < n) -> ~ (succ (succ n) < succ n)
UA: Univalence PR: PropResizing
foralln : N, IsHProp (~ (succ n < n))
intros n;exact istrunc_arrow@{p p p}.
UA: Univalence PR: PropResizing
~ (succ zero < zero)
apply N_lt_zero.
UA: Univalence PR: PropResizing
foralln : N,
~ (succ n < n) -> ~ (succ (succ n) < succ n)
UA: Univalence PR: PropResizing n: N H: ~ (succ n < n) L: succ (succ n) < succ n
Empty
UA: Univalence PR: PropResizing n: N L: succ (succ n) < succ n
succ n < n
UA: Univalence PR: PropResizing n, k: N H: succ k + succ (succ n) = succ n
succ n < n
UA: Univalence PR: PropResizing n, k: N H: succ k + succ (succ n) = succ n
succ k + succ n = n
UA: Univalence PR: PropResizing n, k: N H: succ (succ k + succ n) = succ n
succ k + succ n = n
exact (succ_inj _ _ H).Qed.
UA: Univalence PR: PropResizing n: N
n < succ n
UA: Univalence PR: PropResizing n: N
n < succ n
UA: Univalence PR: PropResizing n: N
succ zero + n = succ n
UA: Univalence PR: PropResizing n: N
succ (zero + n) = succ n
apply ap, N_add_zero_l.Qed.
UA: Univalence PR: PropResizing n, m: N H: n < m
succ n < succ m
UA: Univalence PR: PropResizing n, m: N H: n < m
succ n < succ m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = m
succ n < succ m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = m
succ k + succ n = succ m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = m
succ (succ k + n) = succ m
apply ap; assumption.Qed.
UA: Univalence PR: PropResizing n, m: N H: n < m
n <= m
UA: Univalence PR: PropResizing n, m: N H: n < m
n <= m
UA: Univalence PR: PropResizing n, m, k: N K: succ k + n = m
n <= m
exact (succ k; K).Qed.
UA: Univalence PR: PropResizing n, m: N
n < m <-> succ n <= m
UA: Univalence PR: PropResizing n, m: N
n < m <-> succ n <= m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = m
k + succ n = m
UA: Univalence PR: PropResizing n, m, k: N H: k + succ n = m
succ k + n = m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = m
k + succ n = m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = m
succ k + n = m
assumption.
UA: Univalence PR: PropResizing n, m, k: N H: k + succ n = m
succ k + n = m
UA: Univalence PR: PropResizing n, m, k: N H: k + succ n = m
k + succ n = m
assumption.Qed.
UA: Univalence PR: PropResizing n, m: N
n < succ m <-> n <= m
UA: Univalence PR: PropResizing n, m: N
n < succ m <-> n <= m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = succ m
k + n = m
UA: Univalence PR: PropResizing n, m, k: N H: k + n = m
succ k + n = succ m
UA: Univalence PR: PropResizing n, m, k: N H: succ k + n = succ m
k + n = m
UA: Univalence PR: PropResizing n, m, k: N H: succ (k + n) = succ m
k + n = m
exact (succ_inj _ _ H).
UA: Univalence PR: PropResizing n, m, k: N H: k + n = m
succ k + n = succ m
rewrite N_add_succ_l; apply ap, H.Qed.
UA: Univalence PR: PropResizing n: N
{m : N & m <= n} <~> {m : N & m < n} + Unit
UA: Univalence PR: PropResizing n: N
{m : N & m <= n} <~> {m : N & m < n} + Unit
UA: Univalence PR: PropResizing n: N
{m : N & m <= n} -> {m : N & m < n} + Unit
UA: Univalence PR: PropResizing n: N
{m : N & m < n} + Unit -> {m : N & m <= n}
UA: Univalence PR: PropResizing n: N
?f o ?g == idmap
UA: Univalence PR: PropResizing n: N
?g o ?f == idmap
UA: Univalence PR: PropResizing n: N
{m : N & m <= n} -> {m : N & m < n} + Unit
UA: Univalence PR: PropResizing n: N mH: {m : N & m <= n}
({m : N & m < n} + Unit)%type
UA: Univalence PR: PropResizing n: N mH: {m : N & m <= n} H0: mH.1 = n
({m : N & m < n} + Unit)%type
UA: Univalence PR: PropResizing n: N mH: {m : N & m <= n} Hs: mH.1 < n
({m : N & m < n} + Unit)%type
UA: Univalence PR: PropResizing n: N mH: {m : N & m <= n} H0: mH.1 = n
({m : N & m < n} + Unit)%type
exact (inr tt).
UA: Univalence PR: PropResizing n: N mH: {m : N & m <= n} Hs: mH.1 < n
({m : N & m < n} + Unit)%type
exact (inl (mH.1;Hs)).
UA: Univalence PR: PropResizing n: N
{m : N & m < n} + Unit -> {m : N & m <= n}
UA: Univalence PR: PropResizing n: N mH: {m : N & m < n}
{m : N & m <= n}
UA: Univalence PR: PropResizing n: N u: Unit
{m : N & m <= n}
UA: Univalence PR: PropResizing n: N mH: {m : N & m < n}
{m : N & m <= n}
exact (mH.1; N_lt_le mH.1 n mH.2).
UA: Univalence PR: PropResizing n: N u: Unit
{m : N & m <= n}
existsn; reflexivity.
UA: Univalence PR: PropResizing n: N
(funmH : {m : N & m <= n} =>
lets := N_le_eq_or_lt mH.1 n mH.2inmatch s with
| inl p => (fun_ : mH.1 = n => inr tt) p
| inr n0 => (funHs : mH.1 < n => inl (mH.1; Hs)) n0
end)
o (funX : {m : N & m < n} + Unit =>
match X with
| inl s =>
(funmH : {m : N & m < n} =>
(mH.1; N_lt_le mH.1 n mH.2)) s
| inr u => unit_name (n; reflexive_N_le n) u
end) == idmap
abstract (intros [[m H]|[]]; cbn;
[ generalize (N_le_eq_or_lt m n (N_lt_le m n H));
intros [H0|Hs]; cbn;
[ apply Empty_rec;
rewrite H0 in H; exact (N_lt_irref n H)
| apply ap, ap, path_ishprop ]
| generalize (N_le_eq_or_lt n n (reflexive_N_le n));
intros [H0|Hs];
[ reflexivity
| apply Empty_rec;
exact (N_lt_irref n Hs) ]]).
UA: Univalence PR: PropResizing n: N
(funX : {m : N & m < n} + Unit =>
match X with
| inl s =>
(funmH : {m : N & m < n} =>
(mH.1; N_lt_le mH.1 n mH.2)) s
| inr u => unit_name (n; reflexive_N_le n) u
end)
o (funmH : {m : N & m <= n} =>
lets := N_le_eq_or_lt mH.1 n mH.2inmatch s with
| inl p => (fun_ : mH.1 = n => inr tt) p
| inr n0 =>
(funHs : mH.1 < n => inl (mH.1; Hs)) n0
end) == idmap
{m : N & m < succ n} + Unit <~>
{m : N & m <= n} + Unit
UA: Univalence PR: PropResizing n: N
{m : N & m < succ n} <~> {m : N & m <= n}
UA: Univalence PR: PropResizing n: N
foralla : N, a < succ n <~> a <= n
intros m; apply equiv_iff_hprop_uncurried, N_lt_succ_iff_le.Defined.(** A fancy name for [1] so that we can [rewrite] with it later. *)
UA: Univalence PR: PropResizing n: N mh: {m : N & m <= n}
((equiv_N_segment_succ n)^-1 (inl mh)).1 = mh.1
UA: Univalence PR: PropResizing n: N mh: {m : N & m <= n}
((equiv_N_segment_succ n)^-1 (inl mh)).1 = mh.1
reflexivity.Qed.
UA: Univalence PR: PropResizing n: N
{m : N & m < succ n} <~> {m : N & m <= n}
UA: Univalence PR: PropResizing n: N
{m : N & m < succ n} <~> {m : N & m <= n}
UA: Univalence PR: PropResizing n: N
foralla : N, a < succ n <~> a <= n
intros; apply equiv_iff_hprop; apply N_lt_succ_iff_le.Defined.Definitionzero_seg@{} (n : N) : { m : N & m <= n }
:= (zero ; N_zero_le n).Definitionsucc_seg@{} (n : N)
: { m : N & m < n } -> { m : N & m <= n }
:= funmh =>
let (m,H) := mh in
(succ m; fst (N_lt_iff_succ_le m n) H).
UA: Univalence PR: PropResizing n: N
{m : N & m <= n}
UA: Univalence PR: PropResizing n: N
{m : N & m <= n}
UA: Univalence PR: PropResizing n: N
n <= n
reflexivity.Defined.(** Now we're finally ready to prove recursion. *)SectionNRec.(** Here is the type we will recurse into. Importantly, it doesn't have to be a set! *)(** [nr] is the universe of [partial_Nrec], morally [max(p,x)]. Note that it shouldn't be [large], see constraints on [contr_partial_Nrec_zero]. *)Universes x nr.Context (X : Type@{x}) (x0 : X) (xs : X -> X).(** The type of partially defined recursive functions "up to [n]". *)Local Definitionpartial_Nrec@{} (n : N) : Type@{nr}
:= sig@{nr nr}
(funf : ({ m : N & m <= n} -> X) =>
prod@{x nr} (f (zero_seg n) = x0)
(forall (mh : {m:N & m < n}),
f (succ_seg n mh) = xs (f ((equiv_N_segment n)^-1 (inl mh))))).(** The crucial point that makes it work for arbitrary [X] is to prove in one big induction that these types are always contractible. Here is the base case. *)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr (partial_Nrec zero)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr (partial_Nrec zero)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr
{f : {m : N & m <= zero} -> X &
(f (zero_seg zero) = x0) *
(forallmh : {m : N & m < zero},
f (succ_seg zero mh) =
xs (f ((equiv_N_segment zero)^-1 (inl mh))))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f0: {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0} mh: {m : N & m < zero}
IsEquiv (equiv_N_segment zero)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
{f0
: {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0} &
forallmh : {m : N & m < zero},
f0.1 (succ_seg zero mh) =
xs (f0.1 ((equiv_N_segment zero)^-1 (inl mh)))} <~>
{f : {m : N & m <= zero} -> X &
(f (zero_seg zero) = x0) *
(forallmh : {m : N & m < zero},
f (succ_seg zero mh) =
xs (f ((equiv_N_segment zero)^-1 (inl mh))))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr
{f0
: {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0} &
forallmh : {m : N & m < zero},
f0.1 (succ_seg zero mh) =
xs (f0.1 ((equiv_N_segment zero)^-1 (inl mh)))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f0: {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0} mh: {m : N & m < zero}
IsEquiv (equiv_N_segment zero)
exact _.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
{f0
: {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0} &
forallmh : {m : N & m < zero},
f0.1 (succ_seg zero mh) =
xs (f0.1 ((equiv_N_segment zero)^-1 (inl mh)))} <~>
{f : {m : N & m <= zero} -> X &
(f (zero_seg zero) = x0) *
(forallmh : {m : N & m < zero},
f (succ_seg zero mh) =
xs (f ((equiv_N_segment zero)^-1 (inl mh))))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
{a : {m : N & m <= zero} -> X &
{p : a (zero_seg zero) = x0 &
forallmh : {m : N & m < zero},
(a; p).1 (succ_seg zero mh) =
xs ((a; p).1 ((equiv_N_segment zero)^-1 (inl mh)))}} <~>
{f : {m : N & m <= zero} -> X &
(f (zero_seg zero) = x0) *
(forallmh : {m : N & m < zero},
f (succ_seg zero mh) =
xs (f ((equiv_N_segment zero)^-1 (inl mh))))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: {m : N & m <= zero} -> X
{p : f (zero_seg zero) = x0 &
forallmh : {m : N & m < zero},
(f; p).1 (succ_seg zero mh) =
xs ((f; p).1 ((equiv_N_segment zero)^-1 (inl mh)))} <~>
(f (zero_seg zero) = x0) *
(forallmh : {m : N & m < zero},
f (succ_seg zero mh) =
xs (f ((equiv_N_segment zero)^-1 (inl mh))))
cbn; apply equiv_sigma_prod0.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr
{f0
: {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0} &
forallmh : {m : N & m < zero},
f0.1 (succ_seg zero mh) =
xs (f0.1 ((equiv_N_segment zero)^-1 (inl mh)))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr
{f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
foralla : {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0},
Contr
(forallmh : {m : N & m < zero},
a.1 (succ_seg zero mh) =
xs (a.1 ((equiv_N_segment zero)^-1 (inl mh))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr
{f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
{f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
forally : {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0}, ?center = y
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
{f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0}
exists (fun_ => x0); reflexivity.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
forally : {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0},
(fun_ : {m : N & m <= zero} => x0; 1) = y
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(fun_ : {m : N & m <= zero} => x0; 1) = (g; H)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(fun_ : {m : N & m <= zero} => x0) = g
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
transport
(funf : {m : N & m <= zero} -> X =>
f (zero_seg zero) = x0) ?Goal01 = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(fun_ : {m : N & m <= zero} => x0) = g
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0 m: {m : N & m <= zero}
x0 = g m
exact (H^ @ ap g (path_ishprop _ _)).
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
transport
(funf : {m : N & m <= zero} -> X =>
f (zero_seg zero) = x0)
(path_forall (fun_ : {m : N & m <= zero} => x0) g
((funm : {m : N & m <= zero} =>
H^ @ ap g (path_ishprop (zero_seg zero) m))
:
(fun_ : {m : N & m <= zero} => x0) == g)) 1 = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
transport
(funf : {m : N & m <= zero} -> X =>
f (zero_seg zero) = x0)
(path_forall (fun_ : {m : N & m <= zero} => x0) g
((funm : {m : N & m <= zero} =>
H^ @ ap g (path_ishprop (zero_seg zero) m))
:
(fun_ : {m : N & m <= zero} => x0) == g)) 1 = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(ap
(funx : {m : N & m <= zero} -> X =>
x (zero_seg zero))
(path_forall (fun_ : {m : N & m <= zero} => x0) g
(funm : {m : N & m <= zero} =>
H^ @ ap g (path_ishprop (zero_seg zero) m))))^ @
1 = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(ap10
(path_forall (fun_ : {m : N & m <= zero} => x0) g
(funm : {m : N & m <= zero} =>
H^ @ ap g (path_ishprop (zero_seg zero) m)))
(zero_seg zero))^ @ 1 = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(H^ @
ap g (path_ishprop (zero_seg zero) (zero_seg zero)))^ @
1 = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(ap g (path_ishprop (zero_seg zero) (zero_seg zero)))^ @
H = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(ap g (path_ishprop (zero_seg zero) (zero_seg zero)))^ @
H = (ap g 1)^ @ H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(ap g 1)^ @ H = H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(ap g (path_ishprop (zero_seg zero) (zero_seg zero)))^ @
H = (ap g 1)^ @ H
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
path_ishprop (zero_seg zero) (zero_seg zero) = 1
apply path_ishprop.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X g: {m : N & m <= zero} -> X H: g (zero_seg zero) = x0
(ap g 1)^ @ H = H
apply concat_1p.}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
foralla : {f : {m : N & m <= zero} -> X &
f (zero_seg zero) = x0},
Contr
(forallmh : {m : N & m < zero},
a.1 (succ_seg zero mh) =
xs (a.1 ((equiv_N_segment zero)^-1 (inl mh))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: {m : N & m <= zero} -> X H: f (zero_seg zero) = x0
Contr
(forallmh : {m : N & m < zero},
(f; H).1 (succ_seg zero mh) =
xs ((f; H).1 ((equiv_N_segment zero)^-1 (inl mh))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: {m : N & m <= zero} -> X H: f (zero_seg zero) = x0
forally : forallmh : {m : N & m < zero},
(f; H).1 (succ_seg zero mh) =
xs ((f; H).1 ((equiv_N_segment zero)^-1 (inl mh))),
(funmh : {m : N & m < zero} =>
Empty_rec (N_lt_zero mh.1 mh.2)) = y
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: {m : N & m <= zero} -> X H: f (zero_seg zero) = x0 g: forallmh : {m : N & m < zero},
(f; H).1 (succ_seg zero mh) =
xs ((f; H).1 ((equiv_N_segment zero)^-1 (inl mh)))
(funmh : {m : N & m < zero} =>
Empty_rec (N_lt_zero mh.1 mh.2)) = g
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: {m : N & m <= zero} -> X H: f (zero_seg zero) = x0 g: forallmh : {m : N & m < zero},
(f; H).1 (succ_seg zero mh) =
xs ((f; H).1 ((equiv_N_segment zero)^-1 (inl mh))) m: {m : N & m < zero}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
equiv_N_segment_succ_maps n (f, xsn)
(succ_seg (succ n)
((equiv_N_segment_lt_succ n)^-1%equiv
((equiv_N_segment n)^-1%equiv (inl (m; H))))) =
f (succ_seg n (m; H))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
equiv_N_segment_succ_maps n (f, xsn)
(succ_seg (succ n)
((equiv_N_segment_lt_succ n)^-1%equiv
((equiv_N_segment n)^-1%equiv (inl (m; H))))) =
equiv_N_segment_succ_maps n (f, xsn)
(succ m;
N_lt_le (succ m) (succ n) (N_succ_lt m n H))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
equiv_N_segment_succ_maps n (f, xsn)
(succ m;
N_lt_le (succ m) (succ n) (N_succ_lt m n H)) =
f (succ_seg n (m; H))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
equiv_N_segment_succ_maps n (f, xsn)
(succ_seg (succ n)
((equiv_N_segment_lt_succ n)^-1%equiv
((equiv_N_segment n)^-1%equiv (inl (m; H))))) =
equiv_N_segment_succ_maps n (f, xsn)
(succ m;
N_lt_le (succ m) (succ n) (N_succ_lt m n H))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
succ_seg (succ n)
((equiv_N_segment_lt_succ n)^-1%equiv
((equiv_N_segment n)^-1%equiv (inl (m; H)))) =
(succ m; N_lt_le (succ m) (succ n) (N_succ_lt m n H))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
(succ_seg (succ n)
((equiv_N_segment_lt_succ n)^-1%equiv
((equiv_N_segment n)^-1%equiv (inl (m; H))))).1 =
(succ m; N_lt_le (succ m) (succ n) (N_succ_lt m n H)).1
reflexivity.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
equiv_N_segment_succ_maps n (f, xsn)
(succ m;
N_lt_le (succ m) (succ n) (N_succ_lt m n H)) =
f (succ_seg n (m; H))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
f
(succ m;
fst (N_lt_succ_iff_le (succ m) n) (N_succ_lt m n H)) =
f (succ_seg n (m; H))
apply ap, path_sigma_hprop; reflexivity.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
f (m; N_lt_le m n H) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap
match
N_le_eq_or_lt m (succ n)
(N_lt_le m (succ n)
(snd (N_lt_succ_iff_le m n)
(N_lt_le m n H)))
with
| inl _ => inr tt
| inr n0 => inl (m; n0)
end)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n
foralls : (m = succ n) + (m < succ n),
f (m; N_lt_le m n H) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap
match s with
| inl _ => inr tt
| inr n0 => inl (m; n0)
end)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n L: m = succ n
f (m; N_lt_le m n H) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inr tt))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n L: m < succ n
f (m; N_lt_le m n H) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inl (m; L)))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n L: m = succ n
f (m; N_lt_le m n H) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inr tt))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: succ n < n L: m = succ n
Empty
exact (N_succ_nlt n H).
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n L: m < succ n
f (m; N_lt_le m n H) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inl (m; L)))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X m: N H: m < n L: m < succ n
f (m; N_lt_le m n H) =
f
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)) (m; L))
apply ap, path_sigma_hprop; reflexivity.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X
f (refl_seg n) =
equiv_N_segment_succ_maps n (f, xsn)
((equiv_N_segment (succ n))^-1
(inl
((equiv_N_segment_lt_succ n)^-1%equiv
((equiv_N_segment n)^-1%equiv
(inr (center Unit))))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X
f (refl_seg n) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap
match
N_le_eq_or_lt n (succ n)
(N_lt_le n (succ n)
(snd (N_lt_succ_iff_le n n)
(reflexive_N_le n)))
with
| inl _ => inr tt
| inr n0 => inl (n; n0)
end)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X
foralls : (n = succ n) + (n < succ n),
f (refl_seg n) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap
match s with
| inl _ => inr tt
| inr n0 => inl (n; n0)
end)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X L: n = succ n
f (refl_seg n) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inr tt))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X L: n < succ n
f (refl_seg n) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inl (n; L)))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X L: n = succ n
f (refl_seg n) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inr tt))
case (N_neq_succ n L).
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X L: n < succ n
f (refl_seg n) =
sum_ind_uncurried
(fun_ : {m : N & m <= n} + Unit => X)
(functor_prod idmap (Unit_ind (A:=unit_name X))
(f, xsn))
(functor_sum
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)))
idmap (inl (n; L)))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X L: n < succ n
f (refl_seg n) =
f
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)) (n; L))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X xsn: X L: n < succ n
(refl_seg n).1 =
(functor_sigma idmap
(funa : N => fst (N_lt_succ_iff_le a n)) (n; L)).1
reflexivity.}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
{f : {m : N & m <= n} -> X &
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh))))} <~>
{X0 : ({m : N & m <= n} -> X) * X &
(fun (f : {m : N & m <= n} -> X) (xsn : X) =>
(f (zero_seg n) = x0) *
((forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) *
(xsn = xs (f (refl_seg n))))) (fst X0) (snd X0)}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
{f : {m : N & m <= n} -> X &
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh))))} <~>
{X0 : ({m : N & m <= n} -> X) * X &
(fun (f : {m : N & m <= n} -> X) (xsn : X) =>
(f (zero_seg n) = x0) *
((forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) *
(xsn = xs (f (refl_seg n))))) (fst X0) (snd X0)}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
{f : {m : N & m <= n} -> X &
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh))))} <~>
{a : {m : N & m <= n} -> X &
{b : X &
(a (zero_seg n) = x0) *
((forallmh : {m : N & m < n},
a (succ_seg n mh) =
xs (a ((equiv_N_segment n)^-1 (inl mh)))) *
(b = xs (a (refl_seg n))))}}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
foralla : {m : N & m <= n} -> X,
(a (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
a (succ_seg n mh) =
xs (a ((equiv_N_segment n)^-1 (inl mh)))) <~>
{b : X &
(a (zero_seg n) = x0) *
((forallmh : {m : N & m < n},
a (succ_seg n mh) =
xs (a ((equiv_N_segment n)^-1 (inl mh)))) *
(b = xs (a (refl_seg n))))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) <~>
{b : X &
(f (zero_seg n) = x0) *
((forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) *
(b = xs (f (refl_seg n))))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) <~>
{b : X &
{_ : f (zero_seg n) = x0 &
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) *
(b = xs (f (refl_seg n)))}}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) <~>
{_ : f (zero_seg n) = x0 &
{b : X &
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) *
(b = xs (f (refl_seg n)))}}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X
{_ : f (zero_seg n) = x0 &
forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))} <~>
{_ : f (zero_seg n) = x0 &
{b : X &
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) *
(b = xs (f (refl_seg n)))}}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X f0: f (zero_seg n) = x0
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) <~>
{b : X &
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) *
(b = xs (f (refl_seg n)))}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X f0: f (zero_seg n) = x0
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) <~>
{b : X &
{_
: forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh))) &
b = xs (f (refl_seg n))}}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= n} -> X f0: f (zero_seg n) = x0
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))) <~>
{_
: forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh))) &
{b : X & b = xs (f (refl_seg n))}}
exact ((equiv_sigma_contr _)^-1%equiv).}Defined.Local Definitionpartial_Nrec_succ@{}
:= Evalunfold partial_Nrec_succ0
in partial_Nrec_succ0@{nr nr}.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
Contr (partial_Nrec n)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
Contr (partial_Nrec n)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N H: Contr (partial_Nrec n)
Contr (partial_Nrec (succ n))
refine (istrunc_equiv_istrunc _ (partial_Nrec_succ n)).Qed.(** This will be useful later. *)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
partial_Nrec (succ n) -> partial_Nrec n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N
partial_Nrec (succ n) -> partial_Nrec n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: partial_Nrec (succ n)
partial_Nrec n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
partial_Nrec n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
(f ((equiv_N_segment_succ n)^-1 (inl (zero_seg n))) =
x0) *
(forallmh : {m : N & m < n},
f ((equiv_N_segment_succ n)^-1 (inl (succ_seg n mh))) =
xs
(f
((equiv_N_segment_succ n)^-1
(inl ((equiv_N_segment n)^-1 (inl mh))))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
f ((equiv_N_segment_succ n)^-1 (inl (zero_seg n))) =
x0
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
forallmh : {m : N & m < n},
f ((equiv_N_segment_succ n)^-1 (inl (succ_seg n mh))) =
xs
(f
((equiv_N_segment_succ n)^-1
(inl ((equiv_N_segment n)^-1 (inl mh)))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
f ((equiv_N_segment_succ n)^-1 (inl (zero_seg n))) =
x0
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
f ((equiv_N_segment_succ n)^-1 (inl (zero_seg n))) =
f (zero_seg (succ n))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh)))
forallmh : {m : N & m < n},
f ((equiv_N_segment_succ n)^-1 (inl (succ_seg n mh))) =
xs
(f
((equiv_N_segment_succ n)^-1
(inl ((equiv_N_segment n)^-1 (inl mh)))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh))) mh: {m : N & m < n}
f ((equiv_N_segment_succ n)^-1 (inl (succ_seg n mh))) =
xs
(f
((equiv_N_segment_succ n)^-1
(inl ((equiv_N_segment n)^-1 (inl mh)))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh))) mh: {m : N & m < n}
f ((equiv_N_segment_succ n)^-1 (inl (succ_seg n mh))) =
f
(succ_seg (succ n)
((equiv_N_segment_lt_succ n)^-1
((equiv_N_segment n)^-1 (inl mh))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh))) mh: {m : N & m < n}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh))) mh: {m : N & m < n}
f ((equiv_N_segment_succ n)^-1 (inl (succ_seg n mh))) =
f
(succ_seg (succ n)
((equiv_N_segment_lt_succ n)^-1
((equiv_N_segment n)^-1 (inl mh))))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh))) mh: {m : N & m < n}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh))) mh: {m : N & m < n}
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: {m : N & m <= succ n} -> X f0: f (zero_seg (succ n)) = x0 fs: forallmh : {m : N & m < succ n},
f (succ_seg (succ n) mh) =
xs (f ((equiv_N_segment (succ n))^-1 (inl mh))) mh: {m : N & m < n}
apply path_sigma_hprop; reflexivity.Defined.(** Finally, we want to put all this together to show that the type of fully defined recursive functions is contractible, so that N has the universal property of a natural numbers object. If we attack it directly, this can lead to quite annoying path algebra. Instead, we will show that it is a retract of the product of all the types of partial attempts, which is contractible since each of them is. *)Local Definitionpartials@{} := foralln, partial_Nrec n.Local Instancecontr_partials@{} : Contr partials := istrunc_forall@{p nr nr}.(** From a family of partial attempts, we get a totally defined recursive function. *)SectionPartials.Context (pf : partials).Local DefinitionN_rec'@{} : N -> X
:= funn => (pf n).1 (refl_seg n).
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X pf: partials
N_rec' zero = x0
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X pf: partials
N_rec' zero = x0
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X pf: partials
N_rec' zero = (pf zero).1 (zero_seg zero)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X pf: partials
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X pf: partials n: N
(partial_Nrec_restr n (pf (succ n))).1 = (pf n).1
apply ap, path_contr.Defined.EndPartials.(** Applying this to the "canonical" partial attempts, we get "the recursor". *)DefinitionN_rec@{} : N -> X := N_rec' (center partials).DefinitionN_rec_beta_zero@{} : N_rec zero = x0
:= N_rec_beta_zero' (center partials).DefinitionN_rec_beta_succ@{} (n : N)
: N_rec (succ n) = xs (N_rec n)
:= N_rec_beta_succ' (center partials) n.(** Here is the type of totally defined recursive functions that we want to prove to be contractible. *)DefinitionNRec : Type@{nr}
:= sig@{nr nr} (funf : N -> X =>
prod@{x nr} (f zero = x0)
(forallm:N, f (succ m) = xs (f m))).
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
NRec -> partials
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
NRec -> partials
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: NRec n: N
partial_Nrec n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: NRec n: N
(f.1 (zero_seg n).1 = x0) *
(forallmh : {m : N & m < n},
f.1 (succ_seg n mh).1 =
xs (f.1 ((equiv_N_segment n)^-1 (inl mh)).1))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: NRec n: N
f.1 (zero_seg n).1 = x0
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: NRec n: N
forallmh : {m : N & m < n},
f.1 (succ_seg n mh).1 =
xs (f.1 ((equiv_N_segment n)^-1 (inl mh)).1)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: NRec n: N
f.1 (zero_seg n).1 = x0
exact (fst f.2).
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: NRec n: N
forallmh : {m : N & m < n},
f.1 (succ_seg n mh).1 =
xs (f.1 ((equiv_N_segment n)^-1 (inl mh)).1)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: NRec n: N mh: {m : N & m < n}
exact (snd f.2 mh.1).Defined.(** This is a weird lemma. We could prove it by [path_contr], but we give an explicit proof instead using [path_sigma], so that later on we know what happens when [pr1_path] is applied to it. *)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: NRec
partial_Nrec_restr n (nrec_partials f (succ n)) =
nrec_partials f n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: NRec
partial_Nrec_restr n (nrec_partials f (succ n)) =
nrec_partials f n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: NRec
((partial_Nrec_restr n (nrec_partials f (succ n))).1;
(partial_Nrec_restr n (nrec_partials f (succ n))).2) =
((nrec_partials f n).1; (nrec_partials f n).2)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X n: N f: NRec
transport
(funf : {m : N & m <= n} -> X =>
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh))))) 1
(partial_Nrec_restr n (nrec_partials f (succ n))).2 =
(nrec_partials f n).2
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
(N_rec'
(funn : N =>
(funmh : {m : N & m <= n} => (f; (f0, fs)).1 mh.1;
(fst (f; (f0, fs)).2,
funmh : {m : N & m < n} =>
snd (f; (f0, fs)).2 mh.1)));
(N_rec_beta_zero'
(funn : N =>
(funmh : {m : N & m <= n} => (f; (f0, fs)).1 mh.1;
(fst (f; (f0, fs)).2,
funmh : {m : N & m < n} =>
snd (f; (f0, fs)).2 mh.1))),
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => (f; (f0, fs)).1 mh.1;
(fst (f; (f0, fs)).2,
funmh : {m : N & m < n} =>
snd (f; (f0, fs)).2 mh.1))))) = (f; (f0, fs))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
(N_rec'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1)));
(N_rec_beta_zero'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))),
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))) =
(f; (f0, fs))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
(funn : N => f n;
(ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero) 1) @
f0,
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))) =
(f; (f0, fs))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
fst
(ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero)
1) @ f0,
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1)))) =
fst (f0, fs)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
snd
(ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero)
1) @ f0,
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1)))) =
snd (f0, fs)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
fst
(ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero)
1) @ f0,
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1)))) =
fst (f0, fs)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero) 1) @
f0 = f0
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
ap f
(ap (funx : {m : N & m <= zero} => x.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero)
1)) @ f0 = f0
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
ap f 1 @ f0 = f0
apply concat_1p.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m)
snd
(ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero)
1) @ f0,
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1)))) =
snd (f0, fs)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
snd
(ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero)
1) @ f0,
N_rec_beta_succ'
(funn : N =>
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1)))) n =
snd (f0, fs) n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
snd
(ap (funmh : {m : N & m <= zero} => f mh.1)
(path_sigma_hprop (refl_seg zero) (zero_seg zero)
1) @ f0,
funn : N =>
(ap
(funmh : {m : N & m <= succ n} => f mh.1;
(f0, funmh : {m : N & m < succ n} => fs mh.1)).1
(path_sigma_hprop (refl_seg (succ n))
(succ_seg (succ n) (n; N_lt_succ n)) 1) @
snd
(funmh : {m : N & m <= succ n} => f mh.1;
(f0, funmh : {m : N & m < succ n} => fs mh.1)).2
(n; N_lt_succ n)) @
ap xs
(ap
(funmh : {m : N & m <= succ n} => f mh.1;
(f0, funmh : {m : N & m < succ n} => fs mh.1)).1
(path_sigma_hprop
((equiv_N_segment (succ n))^-1
(inl (n; N_lt_succ n)))
((equiv_N_segment_succ n)^-1
(inl (refl_seg n))) 1) @
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} =>
fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n))) n = snd (f0, fs) n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
(ap (funmh : {m : N & m <= succ n} => f mh.1)
(path_sigma_hprop (refl_seg (succ n))
(succ_seg (succ n) (n; N_lt_succ n)) 1) @ fs n) @
ap xs
(ap (funmh : {m : N & m <= succ n} => f mh.1)
(path_sigma_hprop
(n; N_lt_le n (succ n) (N_lt_succ n))
(n;
N_lt_le n (succ n)
(snd (N_lt_succ_iff_le n n)
(reflexive_N_le n))) 1) @
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = fs n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
(ap f
(ap (funx : {m : N & m <= succ n} => x.1)
(path_sigma_hprop (refl_seg (succ n))
(succ_seg (succ n) (n; N_lt_succ n)) 1)) @
fs n) @
ap xs
(ap (funmh : {m : N & m <= succ n} => f mh.1)
(path_sigma_hprop
(n; N_lt_le n (succ n) (N_lt_succ n))
(n;
N_lt_le n (succ n)
(snd (N_lt_succ_iff_le n n)
(reflexive_N_le n))) 1) @
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = fs n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
(ap f 1 @ fs n) @
ap xs
(ap (funmh : {m : N & m <= succ n} => f mh.1)
(path_sigma_hprop
(n; N_lt_le n (succ n) (N_lt_succ n))
(n;
N_lt_le n (succ n)
(snd (N_lt_succ_iff_le n n)
(reflexive_N_le n))) 1) @
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = fs n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
fs n @
ap xs
(ap (funmh : {m : N & m <= succ n} => f mh.1)
(path_sigma_hprop
(n; N_lt_le n (succ n) (N_lt_succ n))
(n;
N_lt_le n (succ n)
(snd (N_lt_succ_iff_le n n)
(reflexive_N_le n))) 1) @
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = fs n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
fs n @
ap xs
(ap f
(ap pr1
(path_sigma_hprop
(n; N_lt_le n (succ n) (N_lt_succ n))
(n;
N_lt_le n (succ n)
(snd (N_lt_succ_iff_le n n)
(reflexive_N_le n))) 1)) @
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = fs n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
fs n @
ap xs
(ap f 1 @
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = fs n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
fs n @
ap xs
(ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = fs n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N
ap xs
(ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
(refl_seg n)) = 1
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs
(ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
refl_seg_n) = 1
(** Here is where we use [nrec_partials_succ]: the [path_contr] equal to it, which allows us to identify [ap pr1] of the latter. (Note that [ap pr1] of a [path_contr] can be nontrivial even when the endpoints happen to coincide judgmentally, for instance (x;p) and (x;1) in {y:X & y = x}, so there really is something to prove here.) *)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs
(ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
refl_seg_n) =
ap xs
(ap10 (ap pr1 (nrec_partials_succ n (f; (f0, fs))))
refl_seg_n)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs
(ap10 (ap pr1 (nrec_partials_succ n (f; (f0, fs))))
refl_seg_n) = 1
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs
(ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} =>
f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
refl_seg_n) =
ap xs
(ap10 (ap pr1 (nrec_partials_succ n (f; (f0, fs))))
refl_seg_n)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} => f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
refl_seg_n =
ap10 (ap pr1 (nrec_partials_succ n (f; (f0, fs))))
refl_seg_n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
path_contr
(partial_Nrec_restr n
(nrec_partials (f; (f0, fs)) (succ n)))
(nrec_partials (f; (f0, fs)) n) =
nrec_partials_succ n (f; (f0, fs))
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n} p: path_contr
(partial_Nrec_restr n
(nrec_partials (f; (f0, fs)) (succ n)))
(nrec_partials (f; (f0, fs)) n) =
nrec_partials_succ n (f; (f0, fs))
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} => f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
refl_seg_n =
ap10 (ap pr1 (nrec_partials_succ n (f; (f0, fs))))
refl_seg_n
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
path_contr
(partial_Nrec_restr n
(nrec_partials (f; (f0, fs)) (succ n)))
(nrec_partials (f; (f0, fs)) n) =
nrec_partials_succ n (f; (f0, fs))
apply path_contr.
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n} p: path_contr
(partial_Nrec_restr n
(nrec_partials (f; (f0, fs)) (succ n)))
(nrec_partials (f; (f0, fs)) n) =
nrec_partials_succ n (f; (f0, fs))
ap10
(ap pr1
(path_contr
(partial_Nrec_restr n
(funmh : {m : N & m <= succ n} => f mh.1;
(f0,
funmh : {m : N & m < succ n} => fs mh.1)))
(funmh : {m : N & m <= n} => f mh.1;
(f0, funmh : {m : N & m < n} => fs mh.1))))
refl_seg_n =
ap10 (ap pr1 (nrec_partials_succ n (f; (f0, fs))))
refl_seg_n
exact (ap (funh => ap10 (ap pr1 h) refl_seg_n) p).
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs
(ap10 (ap pr1 (nrec_partials_succ n (f; (f0, fs))))
refl_seg_n) = 1
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs
(ap10
(ap pr1
(path_sigma'
(funf : {m : N & m <= n} -> X =>
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))))
1
(nrec_partials_succ_subproof n
(f; (f0, fs))))) refl_seg_n) = 1
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs
(ap10
(ap pr1
(path_sigma
(funf : {m : N & m <= n} -> X =>
(f (zero_seg n) = x0) *
(forallmh : {m : N & m < n},
f (succ_seg n mh) =
xs (f ((equiv_N_segment n)^-1 (inl mh)))))
((partial_Nrec_restr n
(nrec_partials (f; (f0, fs)) (succ n))).1;
(partial_Nrec_restr n
(nrec_partials (f; (f0, fs)) (succ n))).2)
((partial_Nrec_restr n
(nrec_partials (f; (f0, fs)) (succ n))).1;
(nrec_partials (f; (f0, fs)) n).2) 1
(nrec_partials_succ_subproof n
(f; (f0, fs))))) refl_seg_n) = 1
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X f: N -> X f0: f zero = x0 fs: forallm : N, f (succ m) = xs (f m) n: N refl_seg_n:= refl_seg n: {m : N & m <= n}
ap xs (ap10 1 refl_seg_n) = 1
reflexivity.Qed.(** And we're done! *)
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr NRec
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
Contr NRec
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X
IsEquiv partials_nrec
UA: Univalence PR: PropResizing X: Type x0: X xs: X -> X