From f88e1c0de030ac32014dd6f4f04fb4c6961b93ab Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Sun, 17 Jun 2018 20:37:33 +0200 Subject: Proof of projection functions now harder. Should look up automation methods. --- HoTT_Base.thy | 2 +- Sum.thy | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/HoTT_Base.thy b/HoTT_Base.thy index 7794601..9b7c3e2 100644 --- a/HoTT_Base.thy +++ b/HoTT_Base.thy @@ -34,7 +34,7 @@ consts is_of_type :: "[Term, Term] \ prop" ("(1_ :/ _)" [0, 0] 1000) axiomatization where - inhabited_implies_type [intro]: "\a A. a : A \ A : U" + inhabited_implies_type: "\a A. a : A \ A : U" section \Type families\ diff --git a/Sum.thy b/Sum.thy index 93b1e72..fbfc15a 100644 --- a/Sum.thy +++ b/Sum.thy @@ -57,10 +57,10 @@ overloading fst_nondep \ fst begin definition fst_dep :: "[Term, Typefam] \ Term" where - "fst_dep A B \ indSum[A,B] (\_. A) (\x y. x)" + "fst_dep A B \ \<^bold>\p: (\x:A. B x). indSum[A,B] (\_. A) (\x y. x) p" definition fst_nondep :: "[Term, Term] \ Term" where - "fst_nondep A B \ indSum[A, \_. B] (\_. A) (\x y. x)" + "fst_nondep A B \ \<^bold>\p: A \ B. indSum[A, \_. B] (\_. A) (\x y. x) p" end overloading @@ -68,24 +68,30 @@ overloading snd_nondep \ snd begin definition snd_dep :: "[Term, Typefam] \ Term" where - "snd_dep A B \ indSum[A,B] (\p. B fst[A,B]`p) (\x y. y)" + "snd_dep A B \ \<^bold>\p: (\x:A. B x). indSum[A,B] (\p. B fst[A,B]`p) (\x y. y) p" definition snd_nondep :: "[Term, Term] \ Term" where - "snd_nondep A B \ indSum[A, \_. B] (\_. B) (\x y. y)" + "snd_nondep A B \ \<^bold>\p: A \ B. indSum[A, \_. B] (\_. B) (\x y. y) p" end text "Properties of projections:" lemma fst_dep_comp: - assumes "a : A" and "b : B a" + assumes "B: A \ U" and "a : A" and "b : B a" shows "fst[A,B]`(a,b) \ a" -proof - - have "A : U" using assms(1) .. +proof (unfold fst_dep_def) (* GOOD AUTOMATION EXAMPLE *) + have "\p. p : \x:A. B x \ indSum[A, B] (\_. A) (\x y. x) p : A" .. + moreover have "(a, b) : \x:A. B x" using assms .. + then have "fst[A,B]`(a,b) \ indSum[A, B] (\_. A) (\x y. x) (a,b)" unfolding fst_dep_def by (simp add: Prod_comp) + have "A : U" using assms(2) .. then have "\_. A: \x:A. B x \ U" . moreover have "\x y. x : A \ (\x y. x) x y : A" . - ultimately show "fst[A,B]`(a,b) \ a" unfolding fst_dep_def using assms by (rule Sum_comp) + moreover + ultimately show "fst[A,B]`(a,b) \ a" unfolding fst_dep_def using assms by simp qed +thm Sum_comp + lemma snd_dep_comp: assumes "a : A" and "b : B a" shows "snd[A,B]`(a,b) \ b" -- cgit v1.2.3