From 2f63e165d696688f0fcc721289889a8baa00cc02 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Mon, 25 May 2020 16:27:37 +0200 Subject: slightly nicer homotopy proofs with calculations --- spartan/theories/Equivalence.thy | 43 +++++++++++++--------------------------- spartan/theories/Identity.thy | 3 ++- 2 files changed, 16 insertions(+), 30 deletions(-) (limited to 'spartan') diff --git a/spartan/theories/Equivalence.thy b/spartan/theories/Equivalence.thy index 3415249..2975738 100644 --- a/spartan/theories/Equivalence.thy +++ b/spartan/theories/Equivalence.thy @@ -20,7 +20,7 @@ Lemma homotopy_type [typechk]: shows "f ~ g: U i" unfolding homotopy_def by typechk -Lemma (derive) homotopy_refl: +Lemma (derive) homotopy_refl [refl]: assumes "A: U i" "f: \x: A. B x" @@ -41,21 +41,6 @@ Lemma (derive) hsym: \ by typechk done -lemmas homotopy_symmetric = hsym[rotated 4] - -text \\hsym\ attribute for homotopies:\ - -ML \ -structure HSym_Attr = Sym_Attr ( - struct - val name = "hsym" - val symmetry_rule = @{thm homotopy_symmetric} - end -) -\ - -setup \HSym_Attr.setup\ - Lemma (derive) htrans: assumes "f: \x: A. B x" @@ -74,7 +59,11 @@ Lemma (derive) htrans: \ by typechk done -lemmas homotopy_transitive = htrans[rotated 5] +text \For calculations:\ + +lemmas + homotopy_sym [sym] = hsym[rotated 4] and + homotopy_trans [trans] = htrans[rotated 5] Lemma (derive) commute_homotopy: assumes @@ -266,24 +255,20 @@ Lemma (derive) biinv_imp_qinv: block is used to calculate "forward". \ proof - - have "g \ (id B) ~ g \ f \ h" - by (rule homotopy_funcomp_right) (rule \H2:_\[hsym]) - - moreover have "g \ f \ h ~ (id A) \ h" + have "g ~ g \ (id B)" by reduce refl + also have "g \ (id B) ~ g \ f \ h" + by (rule homotopy_funcomp_right) (rule \H2:_\[symmetric]) + also have "g \ f \ h ~ (id A) \ h" by (subst funcomp_assoc[symmetric]) (rule homotopy_funcomp_left, rule \H1:_\) + also have "(id A) \ h ~ h" by reduce refl + finally have "g ~ h" by this - ultimately have "g ~ h" - apply (rewrite to "g \ (id B)" id_right[symmetric]) - apply (rewrite to "(id A) \ h" id_left[symmetric]) - by (rule homotopy_transitive) (assumption+, typechk) + then have "f \ g ~ f \ h" by (rule homotopy_funcomp_right) - then have "f \ g ~ f \ h" - by (rule homotopy_funcomp_right) - with \H2:_\ show "f \ g ~ id B" - by (rule homotopy_transitive) (assumption+, typechk) + by (rule homotopy_trans) (assumption+, typechk) qed done done diff --git a/spartan/theories/Identity.thy b/spartan/theories/Identity.thy index 01bea46..3a982f6 100644 --- a/spartan/theories/Identity.thy +++ b/spartan/theories/Identity.thy @@ -41,7 +41,8 @@ axiomatization where lemmas [intros] = IdF IdI and [elims "?p" "?a" "?b"] = IdE and - [comps] = Id_comp + [comps] = Id_comp and + [refl] = IdI section \Path induction\ -- cgit v1.2.3