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. --- Sum.thy | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'Sum.thy') 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