Built with Alectryon, running Coq+SerAPI v8.18.0+0.18.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.
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Require Import Nat.Core. Require Import Spaces.Int.Core. Require Import Spaces.Finite.Fin. Require Import WildCat.Core. Local Set Universe Minimization ToSet. (** * Successor Structures. *) (** A successor structure is just a type with a endofunctor on it, called 'successor'. Typical examples include either the integers or natural numbers with the successor (or predecessor) operation. *) Record SuccStr : Type := { ss_carrier :> Type ; ss_succ : ss_carrier -> ss_carrier ; }. Declare Scope succ_scope. Local Open Scope nat_scope. Local Open Scope type_scope. Local Open Scope succ_scope. Delimit Scope succ_scope with succ. Arguments ss_succ {_} _. Notation "x .+1" := (ss_succ x) : succ_scope. (** Successor structure of naturals *) Definition NatSucc : SuccStr := Build_SuccStr nat Nat.Core.succ. (** Successor structure of integers *) Definition IntSucc : SuccStr := Build_SuccStr Int int_succ. Notation "'+N'" := NatSucc : succ_scope. Notation "'+Z'" := IntSucc : succ_scope. (** Stratified successor structures *) (** If [N] has a successor structure, then so does the product [N * Fin n]. The successor operation increases the second factor, and if it wraps around, it also increases the first factor. *) Definition StratifiedType (N : SuccStr) (n : nat) := N * Fin n.
N: SuccStr
n: nat
x: StratifiedType N n

StratifiedType N n
N: SuccStr
n: nat
x: StratifiedType N n

StratifiedType N n
N: SuccStr
n: nat
x: StratifiedType N n

N
N: SuccStr
n: nat
x: StratifiedType N n
Fin n
N: SuccStr
n: nat
x: StratifiedType N n

N
N: SuccStr
x: StratifiedType N 0

N
N: SuccStr
n: nat
x: StratifiedType N n.+1
N
N: SuccStr
x: StratifiedType N 0

N
exact (Empty_rec _ (snd x)).
N: SuccStr
n: nat
x: StratifiedType N n.+1

N
N: SuccStr
n: nat
x: StratifiedType N n.+1
p: snd x = inr tt

N
N: SuccStr
n: nat
x: StratifiedType N n.+1
n0: snd x <> inr tt
N
N: SuccStr
n: nat
x: StratifiedType N n.+1
p: snd x = inr tt

N
exact (ss_succ (fst x)).
N: SuccStr
n: nat
x: StratifiedType N n.+1
n0: snd x <> inr tt

N
exact (fst x).
N: SuccStr
n: nat
x: StratifiedType N n

Fin n
exact (fsucc_mod (snd x)). Defined. Definition Stratified (N : SuccStr) (n : nat) : SuccStr := Build_SuccStr (StratifiedType N n) (stratified_succ N n). (** Addition in successor structures *) Definition ss_add {N : SuccStr} (n : N) (k : nat) : N := nat_iter k ss_succ n. Infix "+" := ss_add : succ_scope. Definition ss_add_succ {N : SuccStr} (n : N) (k : nat) : n + k.+1 = n.+1 + k := nat_iter_succ_r k ss_succ n. Definition ss_add_sum {N : SuccStr} (n : N) (k l : nat) : n + (k + l) = (n + l) + k := nat_iter_add k l ss_succ n. (** Nat and Int segmented by triples *) Notation "'N3'" := (Stratified (+N) 3) : succ_scope. Notation "'Z3'" := (Stratified (+Z) 3) : succ_scope. (** ** Category of successor structures *) (** Inspired by the construction of the wildcat structure on pType, we can give SuccStr a wildcat structure in a similar manner (all the way up). *) Record ssFam (A : SuccStr) := { ss_fam :> A -> Type; dss_succ {x} : ss_fam x -> ss_fam (x.+1); }. Arguments ss_fam {_ _} _. Arguments dss_succ {_ _ _}. Record ssForall {A : SuccStr} (B : ssFam A) := { ss_fun :> forall x, B x; ss_fun_succ : forall x, ss_fun x.+1 = dss_succ (ss_fun x); }. Arguments ss_fun {_ _} _ _. Arguments ss_fun_succ {_ _} _ _. Definition ssfam_const {A : SuccStr} (B : SuccStr) : ssFam A := Build_ssFam A (fun _ => B) (fun _ => ss_succ).
A: SuccStr
P: ssFam A
f, g: ssForall P

ssFam A
A: SuccStr
P: ssFam A
f, g: ssForall P

ssFam A
A: SuccStr
P: ssFam A
f, g: ssForall P

A -> Type
A: SuccStr
P: ssFam A
f, g: ssForall P
forall x : A, ?ss_fam x -> ?ss_fam x.+1
A: SuccStr
P: ssFam A
f, g: ssForall P

forall x : A, (fun x0 : A => f x0 = g x0) x -> (fun x0 : A => f x0 = g x0) x.+1
A: SuccStr
P: ssFam A
f, g: ssForall P
x: A
p: f x = g x

f x.+1 = g x.+1
refine (ss_fun_succ f x @ ap dss_succ p @ (ss_fun_succ g x)^). Defined. Definition ssHomotopy {A : SuccStr} {P : ssFam A} (f g : ssForall P) := ssForall (ssfam_sshomotopy f g).

IsGraph SuccStr

IsGraph SuccStr

SuccStr -> SuccStr -> Type
X, Y: SuccStr

Type
exact (@ssForall X (ssfam_const Y)). Defined.
A: SuccStr
P: ssFam A

IsGraph (ssForall P)
A: SuccStr
P: ssFam A

IsGraph (ssForall P)
A: SuccStr
P: ssFam A

ssForall P -> ssForall P -> Type
exact ssHomotopy. Defined. Global Instance is2graph_ssforall {A : SuccStr} (P : ssFam A) : Is2Graph (ssForall P) := {}. Global Instance is2graph_ss : Is2Graph SuccStr := {}. Global Instance is3graph_ss : Is3Graph SuccStr := {}. Ltac sselim_elim eq x := match type of (eq x) with | ?lhs = _ => generalize dependent (eq x); generalize dependent lhs | _ => fail "sselim: no lhs found" end. Ltac sselim f := let eq := fresh "eq" in destruct f as [f eq]; cbn in *; match type of eq with | forall x : ?X, _ = _ => multimatch goal with | x : X |- _ => sselim_elim eq x | f : ?Y -> X |- _ => match goal with | y : Y |- _ => sselim_elim eq (f y) | g : ?Z -> Y |- _ => match goal with | z : Z |- _ => sselim_elim eq (f (g z)) end end | _ => fail "sselim: no hyp found" end | _ => fail "sselim: no eq found" end; nrapply paths_ind_r; try clear eq; try clear f. Tactic Notation "sselim" constr(x0) := sselim x0. Tactic Notation "sselim" constr(x0) constr(x1) := sselim x0; sselim x1. Tactic Notation "sselim" constr(x0) constr(x1) constr(x2) := sselim x0; sselim x1 x2. Tactic Notation "sselim" constr(x0) constr(x1) constr(x2) constr(x3) := sselim x0; sselim x1 x2 x3. Tactic Notation "sselim" constr(x0) constr(x1) constr(x2) constr(x3) constr(x4) := sselim x0; sselim x1 x2 x3 x4. Tactic Notation "sselim" constr(x0) constr(x1) constr(x2) constr(x3) constr(x4) constr(x5) := sselim x0; sselim x1 x2 x3 x4 x5. Tactic Notation "sselim" constr(x0) constr(x1) constr(x2) constr(x3) constr(x4) constr(x5) constr(x6) := sselim x0; sselim x1 x2 x3 x4 x5 x6.

Is01Cat SuccStr

Is01Cat SuccStr

forall a : SuccStr, a $-> a

forall a b c : SuccStr, (b $-> c) -> (a $-> b) -> a $-> c

forall a : SuccStr, a $-> a
X: SuccStr

X $-> X
X: SuccStr

forall x : X, ssfam_const X x
X: SuccStr
forall x : X, ?ss_fun x.+1 = dss_succ (?ss_fun x)
X: SuccStr

forall x : X, ssfam_const X x
exact (fun x => x).
X: SuccStr

forall x : X, idmap x.+1 = dss_succ (idmap x)
reflexivity.

forall a b c : SuccStr, (b $-> c) -> (a $-> b) -> a $-> c
X, Y, Z: SuccStr
f: Y $-> Z
g: X $-> Y

X $-> Z
X, Y, Z: SuccStr
f: Y $-> Z
g: X $-> Y

forall x : X, ssfam_const Z x
X, Y, Z: SuccStr
f: Y $-> Z
g: X $-> Y
forall x : X, ?ss_fun x.+1 = dss_succ (?ss_fun x)
X, Y, Z: SuccStr
f: Y $-> Z
g: X $-> Y

forall x : X, ssfam_const Z x
X, Y, Z: SuccStr
f: Y $-> Z
g: X $-> Y
x: X

ssfam_const Z x
exact (f (g x)).
X, Y, Z: SuccStr
f: Y $-> Z
g: X $-> Y

forall x : X, (fun x0 : X => f (g x0)) x.+1 = dss_succ ((fun x0 : X => f (g x0)) x)
X, Y, Z: SuccStr
f: Y $-> Z
g: X $-> Y
x: X

(fun x : X => f (g x)) x.+1 = dss_succ ((fun x : X => f (g x)) x)
exact (ap f (ss_fun_succ g x) @ ss_fun_succ f (g x)). Defined.
A: SuccStr
P: ssFam A

Is01Cat (ssForall P)
A: SuccStr
P: ssFam A

Is01Cat (ssForall P)
A: SuccStr
P: ssFam A

forall a : ssForall P, a $-> a
A: SuccStr
P: ssFam A
forall a b c : ssForall P, (b $-> c) -> (a $-> b) -> a $-> c
A: SuccStr
P: ssFam A

forall a : ssForall P, a $-> a
A: SuccStr
P: ssFam A
f: ssForall P

f $-> f
A: SuccStr
P: ssFam A
f: ssForall P

forall x : A, ssfam_sshomotopy f f x
A: SuccStr
P: ssFam A
f: ssForall P
forall x : A, ?ss_fun x.+1 = dss_succ (?ss_fun x)
A: SuccStr
P: ssFam A
f: ssForall P

forall x : A, ssfam_sshomotopy f f x
reflexivity.
A: SuccStr
P: ssFam A
f: ssForall P

forall x : A, (fun x0 : A => 1) x.+1 = dss_succ ((fun x0 : A => 1) x)
A: SuccStr
P: ssFam A
f: ssForall P
x: A

1 = (ss_fun_succ f x @ 1) @ (ss_fun_succ f x)^
by destruct (ss_fun_succ f x).
A: SuccStr
P: ssFam A

forall a b c : ssForall P, (b $-> c) -> (a $-> b) -> a $-> c
A: SuccStr
P: ssFam A
f, g, h: ssForall P
p: g $-> h
q: f $-> g

f $-> h
A: SuccStr
P: ssFam A
f, g, h: ssForall P
p: g $-> h
q: f $-> g

forall x : A, ssfam_sshomotopy f h x
A: SuccStr
P: ssFam A
f, g, h: ssForall P
p: g $-> h
q: f $-> g
forall x : A, ?ss_fun x.+1 = dss_succ (?ss_fun x)
A: SuccStr
P: ssFam A
f, g, h: ssForall P
p: g $-> h
q: f $-> g

forall x : A, ssfam_sshomotopy f h x
A: SuccStr
P: ssFam A
f, g, h: ssForall P
p: g $-> h
q: f $-> g
x: A

ssfam_sshomotopy f h x
exact (q x @ p x).
A: SuccStr
P: ssFam A
f, g, h: ssForall P
p: g $-> h
q: f $-> g

forall x : A, (fun x0 : A => q x0 @ p x0) x.+1 = dss_succ ((fun x0 : A => q x0 @ p x0) x)
A: SuccStr
P: ssFam A
f, g, h: ssForall P
p: g $-> h
q: f $-> g
x: A

q x.+1 @ p x.+1 = (ss_fun_succ f x @ ap dss_succ (q x @ p x)) @ (ss_fun_succ h x)^
A: SuccStr
P: ssFam A
f, g, h: forall x : A, P x
p: forall x : A, g x = h x
q: forall x : A, f x = g x
x: A

((1 @ ap dss_succ (q x)) @ 1) @ ((1 @ ap dss_succ (p x)) @ 1^) = (1 @ ap dss_succ (q x @ p x)) @ 1^
A: SuccStr
P: ssFam A
f, g, h: forall x : A, P x
p: forall x : A, g x = h x
q: forall x : A, f x = g x
x: A

((1 @ ap dss_succ (q x)) @ 1) @ ((1 @ ap dss_succ (p x)) @ 1) = (1 @ ap dss_succ (q x @ p x)) @ 1
by destruct (p x), (q x). Defined.
A: SuccStr
P: ssFam A

Is0Gpd (ssForall P)
A: SuccStr
P: ssFam A

Is0Gpd (ssForall P)
A: SuccStr
P: ssFam A

forall a b : ssForall P, (a $-> b) -> b $-> a
A: SuccStr
P: ssFam A
f, g: ssForall P
p: f $-> g

g $-> f
A: SuccStr
P: ssFam A
f, g: ssForall P
p: f $-> g

forall x : A, ssfam_sshomotopy g f x
A: SuccStr
P: ssFam A
f, g: ssForall P
p: f $-> g
forall x : A, ?ss_fun x.+1 = dss_succ (?ss_fun x)
A: SuccStr
P: ssFam A
f, g: ssForall P
p: f $-> g

forall x : A, ssfam_sshomotopy g f x
A: SuccStr
P: ssFam A
f, g: ssForall P
p: f $-> g
x: A

ssfam_sshomotopy g f x
exact (p x)^.
A: SuccStr
P: ssFam A
f, g: ssForall P
p: f $-> g

forall x : A, (fun x0 : A => (p x0)^) x.+1 = dss_succ ((fun x0 : A => (p x0)^) x)
A: SuccStr
P: ssFam A
f, g: ssForall P
p: f $-> g
x: A

(p x.+1)^ = (ss_fun_succ g x @ ap dss_succ (p x)^) @ (ss_fun_succ f x)^
A: SuccStr
P: ssFam A
f, g: forall x : A, P x
p: forall x : A, f x = g x
x: A

((1 @ ap dss_succ (p x)) @ 1^)^ = (1 @ ap dss_succ (p x)^) @ 1
by destruct (p x). Defined.

Is1Cat SuccStr

Is1Cat SuccStr

forall a b : SuccStr, Is01Cat (a $-> b)

forall a b : SuccStr, Is0Gpd (a $-> b)

forall (a b c : SuccStr) (g : b $-> c), Is0Functor (cat_postcomp a g)

forall (a b c : SuccStr) (f : a $-> b), Is0Functor (cat_precomp c f)

forall (a b c d : SuccStr) (f : a $-> b) (g : b $-> c) (h : c $-> d), h $o g $o f $== h $o (g $o f)

forall (a b : SuccStr) (f : a $-> b), Id b $o f $== f

forall (a b : SuccStr) (f : a $-> b), f $o Id a $== f

forall (a b c : SuccStr) (g : b $-> c), Is0Functor (cat_postcomp a g)

forall (a b c : SuccStr) (f : a $-> b), Is0Functor (cat_precomp c f)

forall (a b c d : SuccStr) (f : a $-> b) (g : b $-> c) (h : c $-> d), h $o g $o f $== h $o (g $o f)

forall (a b : SuccStr) (f : a $-> b), Id b $o f $== f

forall (a b : SuccStr) (f : a $-> b), f $o Id a $== f

forall (a b c : SuccStr) (g : b $-> c), Is0Functor (cat_postcomp a g)
X, Y, Z: SuccStr
g: Y $-> Z

Is0Functor (cat_postcomp X g)
X, Y, Z: SuccStr
g: Y $-> Z

forall a b : X $-> Y, (a $-> b) -> cat_postcomp X g a $-> cat_postcomp X g b
X, Y, Z: SuccStr
g: Y $-> Z
f, h: X $-> Y
p: f $-> h

cat_postcomp X g f $-> cat_postcomp X g h
X, Y, Z: SuccStr
g: Y $-> Z
f, h: X $-> Y
p: f $-> h

forall x : X, ssfam_sshomotopy (cat_postcomp X g f) (cat_postcomp X g h) x
X, Y, Z: SuccStr
g: Y $-> Z
f, h: X $-> Y
p: f $-> h
forall x : X, ?ss_fun x.+1 = dss_succ (?ss_fun x)
X, Y, Z: SuccStr
g: Y $-> Z
f, h: X $-> Y
p: f $-> h

forall x : X, ssfam_sshomotopy (cat_postcomp X g f) (cat_postcomp X g h) x
X, Y, Z: SuccStr
g: Y $-> Z
f, h: X $-> Y
p: f $-> h
x: X

ssfam_sshomotopy (cat_postcomp X g f) (cat_postcomp X g h) x
exact (ap g (p x)).
X, Y, Z: SuccStr
g: Y $-> Z
f, h: X $-> Y
p: f $-> h

forall x : X, (fun x0 : X => ap g (p x0)) x.+1 = dss_succ ((fun x0 : X => ap g (p x0)) x)
X, Y, Z: SuccStr
g: Y $-> Z
f, h: X $-> Y
p: f $-> h
x: X

ap g (p x.+1) = ((ap g (ss_fun_succ f x) @ ss_fun_succ g (f x)) @ ap ss_succ (ap g (p x))) @ (ap g (ss_fun_succ h x) @ ss_fun_succ g (h x))^
X, Y, Z: SuccStr
g: ssForall (ssfam_const Z)
f, h: X -> Y
p: forall x : X, f x = h x
x: X

ap g ((1 @ ap ss_succ (p x)) @ 1^) = ((1 @ ss_fun_succ g (f x)) @ ap ss_succ (ap g (p x))) @ (ap g 1 @ ss_fun_succ g (h x))^
X, Y, Z: SuccStr
g: ssForall (ssfam_const Z)
f, h: X -> Y
x: X

1 = ((1 @ ss_fun_succ g (f x)) @ 1) @ (1 @ ss_fun_succ g (f x))^
X, Y, Z: SuccStr
g: Y -> Z
eq: forall x : Y, g x.+1 = (g x).+1
f, h: X -> Y
x: X

1 = ((1 @ eq (f x)) @ 1) @ (1 @ eq (f x))^
by destruct (eq (f x)).

forall (a b c : SuccStr) (f : a $-> b), Is0Functor (cat_precomp c f)
X, Y, Z: SuccStr
g: X $-> Y

Is0Functor (cat_precomp Z g)
X, Y, Z: SuccStr
g: X $-> Y

forall a b : Y $-> Z, (a $-> b) -> cat_precomp Z g a $-> cat_precomp Z g b
X, Y, Z: SuccStr
g: X $-> Y
f, h: Y $-> Z
q: f $-> h

cat_precomp Z g f $-> cat_precomp Z g h
X, Y, Z: SuccStr
g: X $-> Y
f, h: Y $-> Z
q: f $-> h

forall x : X, ssfam_sshomotopy (cat_precomp Z g f) (cat_precomp Z g h) x
X, Y, Z: SuccStr
g: X $-> Y
f, h: Y $-> Z
q: f $-> h
forall x : X, ?ss_fun x.+1 = dss_succ (?ss_fun x)
X, Y, Z: SuccStr
g: X $-> Y
f, h: Y $-> Z
q: f $-> h

forall x : X, ssfam_sshomotopy (cat_precomp Z g f) (cat_precomp Z g h) x
X, Y, Z: SuccStr
g: X $-> Y
f, h: Y $-> Z
q: f $-> h
x: X

ssfam_sshomotopy (cat_precomp Z g f) (cat_precomp Z g h) x
apply q.
X, Y, Z: SuccStr
g: X $-> Y
f, h: Y $-> Z
q: f $-> h

forall x : X, (fun x0 : X => let X0 := ss_fun q in X0 (g x0)) x.+1 = dss_succ ((fun x0 : X => let X0 := ss_fun q in X0 (g x0)) x)
X, Y, Z: SuccStr
g: X $-> Y
f, h: Y $-> Z
q: f $-> h
x: X

q (g x.+1) = ((ap f (ss_fun_succ g x) @ ss_fun_succ f (g x)) @ ap ss_succ (q (g x))) @ (ap h (ss_fun_succ g x) @ ss_fun_succ h (g x))^
by sselim g q f h.

forall (a b c d : SuccStr) (f : a $-> b) (g : b $-> c) (h : c $-> d), h $o g $o f $== h $o (g $o f)
X, Y, Z, W: SuccStr
f: X $-> Y
g: Y $-> Z
h: Z $-> W

h $o g $o f $== h $o (g $o f)
X, Y, Z, W: SuccStr
f: X $-> Y
g: Y $-> Z
h: Z $-> W

forall x : X, ssfam_sshomotopy (h $o g $o f) (h $o (g $o f)) x
X, Y, Z, W: SuccStr
f: X $-> Y
g: Y $-> Z
h: Z $-> W
forall x : X, ?ss_fun x.+1 = dss_succ (?ss_fun x)
X, Y, Z, W: SuccStr
f: X $-> Y
g: Y $-> Z
h: Z $-> W

forall x : X, ssfam_sshomotopy (h $o g $o f) (h $o (g $o f)) x
X, Y, Z, W: SuccStr
f: X $-> Y
g: Y $-> Z
h: Z $-> W
x: X

ssfam_sshomotopy (h $o g $o f) (h $o (g $o f)) x
reflexivity.
X, Y, Z, W: SuccStr
f: X $-> Y
g: Y $-> Z
h: Z $-> W

forall x : X, (fun x0 : X => 1) x.+1 = dss_succ ((fun x0 : X => 1) x)
X, Y, Z, W: SuccStr
f: X $-> Y
g: Y $-> Z
h: Z $-> W
x: X

1 = ((ap (fun x : Y => h (g x)) (ss_fun_succ f x) @ (ap h (ss_fun_succ g (f x)) @ ss_fun_succ h (g (f x)))) @ 1) @ (ap h (ap g (ss_fun_succ f x) @ ss_fun_succ g (f x)) @ ss_fun_succ h (g (f x)))^
by sselim f g h.

forall (a b : SuccStr) (f : a $-> b), Id b $o f $== f
X, Y: SuccStr
f: X $-> Y

Id Y $o f $== f
X, Y: SuccStr
f: X $-> Y

forall x : X, ssfam_sshomotopy (Id Y $o f) f x
X, Y: SuccStr
f: X $-> Y
forall x : X, ?ss_fun x.+1 = dss_succ (?ss_fun x)
X, Y: SuccStr
f: X $-> Y

forall x : X, (fun x0 : X => 1) x.+1 = dss_succ ((fun x0 : X => 1) x)
X, Y: SuccStr
f: X $-> Y
x: X

(fun x : X => 1) x.+1 = dss_succ ((fun x : X => 1) x)
by sselim f.

forall (a b : SuccStr) (f : a $-> b), f $o Id a $== f
X, Y: SuccStr
f: X $-> Y

f $o Id X $== f
X, Y: SuccStr
f: X $-> Y

forall x : X, ssfam_sshomotopy (f $o Id X) f x
X, Y: SuccStr
f: X $-> Y
forall x : X, ?ss_fun x.+1 = dss_succ (?ss_fun x)
X, Y: SuccStr
f: X $-> Y

forall x : X, (fun x0 : X => 1) x.+1 = dss_succ ((fun x0 : X => 1) x)
X, Y: SuccStr
f: X $-> Y
x: X

(fun x : X => 1) x.+1 = dss_succ ((fun x : X => 1) x)
by sselim f. Defined.