Added old proofs in new style (missing: Z' is hset)

This commit is contained in:
Niels 2017-08-04 20:42:05 +02:00
parent 8cf115c9ab
commit efec2e88f8
1 changed files with 258 additions and 441 deletions

View File

@ -76,7 +76,7 @@ Module Export Ints.
End Z_recursion. End Z_recursion.
Instance FSet_recursion : HitRecursion Z := Instance Z_recursion : HitRecursion Z :=
{ {
indTy := _; recTy := _; indTy := _; recTy := _;
H_inductor := Z_ind; H_recursor := Z_rec }. H_inductor := Z_ind; H_recursor := Z_rec }.
@ -477,9 +477,6 @@ End initial_Z.
(*
Module Export AltInts. Module Export AltInts.
Private Inductive Z' : Type0 := Private Inductive Z' : Type0 :=
@ -488,443 +485,263 @@ Module Export AltInts.
Axiom path : positive 0 = negative 0. Axiom path : positive 0 = negative 0.
Fixpoint Z'_ind Section AltIntsInd.
(P : Z' -> Type) Variable (P : Z' -> Type)
(po : forall (x : nat), P (positive x)) (po : forall (x : nat), P (positive x))
(ne : forall (x : nat), P (negative x)) (ne : forall (x : nat), P (negative x))
(i : path # (po 0) = ne 0) (i : path # (po 0) = ne 0).
(x : Z')
{struct x} Fixpoint Z'_ind (x : Z') {struct x} : P x
: P x
:= :=
(match x return _ -> P x with (match x return _ -> P x with
| positive n => fun _ => po n | positive n => fun _ => po n
| negative n => fun _ => ne n | negative n => fun _ => ne n
end) i. end) i.
Axiom Z'_ind_beta_inv1 : forall Axiom Z'_ind_beta_path : apD Z'_ind path = i.
(P : Z' -> Type) End AltIntsInd.
(po : forall (x : nat), P (positive x))
(ne : forall (x : nat), P (negative x)) Section AltIntsRec.
(i : path # (po 0) = ne 0) Variable (P : Type)
, apD (Z'_ind P po ne i) path = i. (po : nat -> P)
(pn : nat -> P)
(i : po 0 = pn 0).
Definition Z'_rec : Z' -> P.
Proof.
simple refine (Z'_ind _ _ _ _) ; simpl.
- apply po.
- apply pn.
- refine (transport_const _ _ @ i).
Defined.
Definition Z'_rec_beta_path : ap Z'_rec path = i.
Proof.
unfold Z_rec.
eapply (cancelL (transport_const path _)).
simple refine ((apD_const _ _)^ @ _).
apply Z'_ind_beta_path.
Defined.
End AltIntsRec.
Instance Z'_recursion : HitRecursion Z' :=
{
indTy := _; recTy := _;
H_inductor := Z'_ind; H_recursor := Z'_rec
}.
End AltInts. End AltInts.
Definition succ_Z' : Z' -> Z'. Section Isomorphic.
Proof.
refine (Z'_ind _ _ _ _).
Unshelve.
Focus 2.
intro n.
apply (positive (S n)).
Focus 2. Definition succ_Z' : Z' -> Z'.
intro n. Proof.
induction n. simple refine (Z'_rec _ _ _ _).
apply (positive 1). - apply (fun n => positive (S n)).
- induction 1 as [ | n].
* apply (positive 1).
* apply (negative n).
- reflexivity.
Defined.
apply (negative n). Definition pred_Z' : Z' -> Z'.
Proof.
simpl. simple refine (Z'_rec _ _ _ _).
rewrite transport_const. - induction 1 as [ | n].
reflexivity. * apply (negative 1).
Defined. * apply (positive n).
- intro n.
Definition pred_Z' : Z' -> Z'.
Proof.
refine (Z'_ind _ _ _ _).
Unshelve.
Focus 2.
intro n.
induction n.
apply (negative 1).
apply (positive n).
Focus 2.
intro n.
apply (negative (S n)). apply (negative (S n)).
- reflexivity.
Defined.
simpl. Fixpoint Nat_to_Pos (n : nat) : Int.Pos :=
rewrite transport_const.
reflexivity.
Defined.
Fixpoint Nat_to_Pos (n : nat) : Pos :=
match n with match n with
| 0 => Int.one | 0 => Int.one
| S k => succ_pos (Nat_to_Pos k) | S k => succ_pos (Nat_to_Pos k)
end. end.
Definition Z'_to_Int : Z' -> Int. Definition Z'_to_Int : Z' -> Int.
Proof. Proof.
refine (Z'_ind _ _ _ _). simple refine (Z'_rec _ _ _ _).
Unshelve. - induction 1 as [ | n IHn].
Focus 2.
intro x.
induction x.
apply (Int.zero). apply (Int.zero).
apply (succ_int IHx). apply (succ_int IHn).
- induction 1 as [ | n IHn].
Focus 2.
intro x.
induction x.
apply (Int.zero). apply (Int.zero).
apply (pred_int IHx). apply (pred_int IHn).
- reflexivity.
Defined.
simpl. Definition Pos_to_Nat : Int.Pos -> nat.
rewrite transport_const. Proof.
reflexivity. induction 1 as [ | n IHn].
Defined. - apply 1.
- apply (S IHn).
Defined.
Definition Pos_to_Nat : Pos -> nat. Definition Int_to_Z' (x : Int) : Z'.
Proof. Proof.
intro x. induction x as [p | | p].
induction x.
apply 1.
apply (S IHx).
Defined.
Definition Int_to_Z' (x : Int) : Z'.
Proof.
induction x.
apply (negative (Pos_to_Nat p)). apply (negative (Pos_to_Nat p)).
apply (positive 0). apply (positive 0).
apply (positive (Pos_to_Nat p)). apply (positive (Pos_to_Nat p)).
Defined. Defined.
Lemma Z'_to_int_pos_homomorphism : Definition Z'_to_int_pos_homomorphism n :
forall n : nat, Z'_to_Int (positive (S n)) = succ_int (Z'_to_Int (positive n)). Z'_to_Int (positive (S n)) = succ_int (Z'_to_Int (positive n)) := idpath.
Proof.
intro n.
reflexivity.
Qed.
Lemma Z'_to_int_neg_homomorphism : Definition Z'_to_int_neg_homomorphism n :
forall n : nat, Z'_to_Int (negative (S n)) = pred_int (Z'_to_Int (negative n)). Z'_to_Int (negative (S n)) = pred_int (Z'_to_Int (negative n)) := idpath.
Proof.
intro n.
reflexivity.
Qed.
Theorem isoEq1 : forall x : Int, Z'_to_Int(Int_to_Z' x) = x. Theorem Int_to_Z'_to_Int : forall x : Int, Z'_to_Int(Int_to_Z' x) = x.
Proof. Proof.
intro x. induction x as [p | | p].
induction x. - induction p as [ | p IHp ].
induction p. * reflexivity.
reflexivity. * refine (Z'_to_int_neg_homomorphism _ @ ap pred_int IHp).
- reflexivity.
- induction p as [ | p IHp ].
* reflexivity.
* refine (Z'_to_int_pos_homomorphism _ @ ap succ_int IHp).
Defined.
rewrite Z'_to_int_neg_homomorphism. Lemma Int_to_Z'_succ_homomorphism :
rewrite IHp. forall x, Int_to_Z' (succ_int x) = succ_Z' (Int_to_Z' x).
reflexivity. Proof.
induction x as [p | | p].
- induction p as [ | p IHp] ; cbn.
* apply path.
* reflexivity.
- reflexivity.
- induction p ; reflexivity.
Defined.
reflexivity. Lemma Int_to_Z'_pred_homomorphism :
induction p.
reflexivity.
rewrite Z'_to_int_pos_homomorphism.
rewrite IHp.
reflexivity.
Defined.
Lemma Int_to_Z'_succ_homomorphism :
forall x : Int, Int_to_Z' (succ_int x) = succ_Z' (Int_to_Z' x).
Proof.
simpl.
intro x.
simpl.
induction x.
induction p.
compute.
apply path.
reflexivity.
reflexivity.
induction p.
reflexivity.
reflexivity.
Qed.
Lemma Int_to_Z'_pred_homomorphism :
forall x : Int, Int_to_Z' (pred_int x) = pred_Z' (Int_to_Z' x). forall x : Int, Int_to_Z' (pred_int x) = pred_Z' (Int_to_Z' x).
Proof. Proof.
intro x. induction x as [p | | p] ; try (induction p) ; reflexivity.
induction x. Defined.
induction p.
reflexivity.
reflexivity. Theorem Z'_to_Int_to_Z' : forall x : Z', Int_to_Z'(Z'_to_Int x) = x.
Proof.
reflexivity. simple refine (Z'_ind _ _ _ _) ; simpl.
- induction x as [ | x] ; simpl.
induction p. * reflexivity.
reflexivity. * refine (ap Int_to_Z' (Z'_to_int_pos_homomorphism _)^ @ _) ; simpl.
refine (Int_to_Z'_succ_homomorphism _ @ _).
reflexivity. apply (ap succ_Z' IHx).
- induction x as [ | x IHx] ; simpl.
Qed. * apply path.
* refine (ap Int_to_Z' (Z'_to_int_neg_homomorphism _)^ @ _) ; simpl.
Theorem isoEq2 : forall x : Z', Int_to_Z'(Z'_to_Int x) = x. refine (Int_to_Z'_pred_homomorphism _ @ _).
Proof. apply (ap pred_Z' IHx).
refine (Z'_ind _ _ _ _). - simpl.
Unshelve. refine (transport_paths_FlFr path _ @ _).
refine (ap (fun z => _ @ z) (ap_idmap _) @ _).
Focus 2. refine (ap (fun z => z @ _) (concat_p1 _) @ _).
intro x. assert (ap (fun x : Z' => Z'_to_Int x) path = idpath) as X.
induction x. {
reflexivity. apply axiomK_hset ; apply hset_int.
rewrite Z'_to_int_pos_homomorphism. }
rewrite Int_to_Z'_succ_homomorphism. refine (ap (fun z => z^ @ path) (ap_compose Z'_to_Int Int_to_Z' path) @ _).
rewrite IHx. refine (ap (fun z => (ap Int_to_Z' z)^ @ _) X @ _).
reflexivity.
Focus 2.
intro x.
induction x.
apply path.
rewrite Z'_to_int_neg_homomorphism.
rewrite Int_to_Z'_pred_homomorphism.
rewrite IHx.
reflexivity.
simpl.
rewrite @HoTT.Types.Paths.transport_paths_FlFr.
rewrite concat_p1.
rewrite ap_idmap.
enough (ap (fun x : Z' => Z'_to_Int x) path = reflexivity Int.zero).
rewrite ap_compose.
rewrite X.
apply concat_1p. apply concat_1p.
Defined.
apply axiomK_hset. Definition biinv_Z'_to_Int : BiInv Z'_to_Int :=
apply hset_int. ((Int_to_Z' ; Z'_to_Int_to_Z'), (Int_to_Z' ; Int_to_Z'_to_Int)).
Defined.
Theorem adj : Definition equiv_Z'_to_Int : IsEquiv Z'_to_Int :=
forall x : Z', isoEq1 (Z'_to_Int x) = ap Z'_to_Int (isoEq2 x). isequiv_biinv _ biinv_Z'_to_Int.
Proof.
intro x.
apply hset_int.
Defined.
Definition isomorphism : IsEquiv Z'_to_Int. Instance Z'_set : IsHSet Z'.
Proof. Proof.
apply (BuildIsEquiv Z' Int Z'_to_Int Int_to_Z' isoEq1 isoEq2 adj). intros x y p q.
Qed.
Axiom everythingSet : forall T : Type, IsHSet T. Admitted.
Definition Z_to_Z' : Z -> Z'. Definition Z_to_Z' : Z -> Z'.
Proof. Proof.
refine (Z_rec _ _ _ _ _ _). hrecursion.
Unshelve. - apply (positive 0).
Focus 1. - apply succ_Z'.
apply (positive 0). - apply pred_Z'.
- hinduction.
* apply (fun _ => idpath).
* induction x as [ | x IHx] ; simpl.
** apply path^.
** reflexivity.
* apply set_path2.
- hinduction.
* induction x as [ | x IHx] ; simpl.
** apply path.
** reflexivity.
* apply (fun _ => idpath).
* apply set_path2.
Defined.
Focus 3. Definition Z'_to_Z : Z' -> Z.
apply succ_Z'. Proof.
hrecursion.
- induction 1 as [ | x IHx].
* apply zero_Z.
* apply (succ IHx).
- induction 1 as [ | x IHx].
* apply zero_Z.
* apply (pred IHx).
- reflexivity.
Defined.
Focus 3. Theorem Z'_to_Z_to_Z' : forall n : Z', Z_to_Z'(Z'_to_Z n) = n.
apply pred_Z'. Proof.
hinduction.
- induction x as [ | x IHx] ; cbn.
* reflexivity.
* apply (ap succ_Z' IHx).
- induction x as [ | x IHx] ; cbn.
* apply path.
* apply (ap pred_Z' IHx).
- apply set_path2.
Defined.
Focus 1. Lemma Z'_to_Z_succ : forall n, Z'_to_Z(succ_Z' n) = succ(Z'_to_Z n).
refine (Z'_ind _ _ _ _). Proof.
Unshelve. hinduction.
Focus 2. - apply (fun _ => idpath).
intros. - induction x.
reflexivity. * reflexivity.
* apply inv2.
- apply set_path2.
Defined.
Focus 2. Lemma Z'_to_Z_pred : forall n, Z'_to_Z(pred_Z' n) = pred(Z'_to_Z n).
intros. Proof.
induction x. hinduction.
Focus 1. - induction x.
compute. * reflexivity.
apply path^. * apply inv1.
- apply (fun _ => idpath).
- apply set_path2.
Defined.
reflexivity. Theorem Z_to_Z'_to_Z : forall n : Z, Z'_to_Z(Z_to_Z' n) = n.
Proof.
hinduction ; try (intros ; apply set_path2).
- reflexivity.
- intros x Hx.
refine (_ @ ap succ Hx).
apply Z'_to_Z_succ.
- intros x Hx.
refine (_ @ ap pred Hx).
apply Z'_to_Z_pred.
Defined.
apply everythingSet. Definition biinv_Z'_to_Z : BiInv Z'_to_Z :=
((Z_to_Z' ; Z'_to_Z_to_Z'), (Z_to_Z' ; Z_to_Z'_to_Z)).
refine (Z'_ind _ _ _ _). Definition equiv_Z'_to_Z : IsEquiv Z'_to_Z :=
Unshelve. isequiv_biinv _ biinv_Z'_to_Z.
Focus 2.
intros.
induction x.
Focus 1.
compute.
apply path.
reflexivity. End Isomorphic.
Focus 2.
intros.
reflexivity.
apply everythingSet.
Defined.
Definition Z'_to_Z : Z' -> Z.
Proof.
refine (Z'_ind _ _ _ _).
Unshelve.
Focus 2.
induction 1.
apply nul.
apply (succ IHx).
Focus 2.
induction 1.
Focus 1.
apply nul.
apply (pred IHx).
simpl.
rewrite transport_const.
reflexivity.
Defined.
Theorem isoZEq1 : forall n : Z', Z_to_Z'(Z'_to_Z n) = n.
Proof.
refine (Z'_ind _ _ _ _).
Unshelve.
Focus 3.
intros.
induction x.
compute.
apply path.
transitivity (Z_to_Z' (pred (Z'_to_Z (negative x)))).
enough (Z'_to_Z (negative x.+1) = pred (Z'_to_Z (negative x))).
rewrite X.
reflexivity.
reflexivity.
transitivity (pred_Z' (Z_to_Z' (Z'_to_Z (negative x)))).
Focus 1.
reflexivity.
rewrite IHx.
reflexivity.
Focus 2.
intros.
induction x.
Focus 1.
reflexivity.
transitivity (Z_to_Z' (succ (Z'_to_Z (positive x)))).
reflexivity.
transitivity (succ_Z' (Z_to_Z' (Z'_to_Z (positive x)))).
reflexivity.
rewrite IHx.
reflexivity.
apply everythingSet.
Defined.
Theorem isoZEq2 : forall n : Z, Z'_to_Z(Z_to_Z' n) = n.
Proof.
refine (Z_ind _ _ _ _ _ _).
Unshelve.
Focus 1.
reflexivity.
Focus 1.
intros.
apply everythingSet.
Focus 1.
intros.
apply everythingSet.
Focus 1.
intro n.
intro X.
transitivity (Z'_to_Z (succ_Z' (Z_to_Z' n))).
reflexivity.
transitivity (succ (Z'_to_Z (Z_to_Z' n))).
Focus 2.
rewrite X.
reflexivity.
enough (forall m : Z', Z'_to_Z (succ_Z' m) = succ (Z'_to_Z m)).
rewrite X0.
reflexivity.
refine (Z'_ind _ _ _ _).
Unshelve.
Focus 2.
intros.
reflexivity.
Focus 2.
intros.
induction x.
Focus 1.
reflexivity.
compute.
rewrite <- inv2.
reflexivity.
apply everythingSet.
intros.
transitivity (Z'_to_Z (pred_Z' (Z_to_Z' n))).
reflexivity.
transitivity (pred (Z'_to_Z (Z_to_Z' n))).
Focus 2.
rewrite X.
reflexivity.
enough (forall m : Z', Z'_to_Z (pred_Z' m) = pred (Z'_to_Z m)).
rewrite X0.
reflexivity.
refine (Z'_ind _ _ _ _).
Unshelve.
Focus 1.
apply everythingSet.
Focus 1.
intro x.
induction x.
reflexivity.
compute.
rewrite <- inv1.
reflexivity.
intro x.
reflexivity.
Defined.
Theorem adj2 :
forall x : Z', isoZEq2 (Z'_to_Z x) = ap Z'_to_Z (isoZEq1 x).
Proof.
intro x.
apply everythingSet.
Defined.
Definition isomorphism2 : IsEquiv Z'_to_Z.
Proof.
apply (BuildIsEquiv Z' Z Z'_to_Z Z_to_Z' isoZEq2 isoZEq1 adj2).
Qed.
*)