From 9ffa5ed2a972db4ae6274a7852de37945a32ab0e Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Tue, 3 Jul 2018 17:06:58 +0200 Subject: Rewrote methods: wellformed now two lines, uses named theorems. New, more powerful derive method. Used these to rewrite proofs. --- Proj.thy | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'Proj.thy') diff --git a/Proj.thy b/Proj.thy index c4703d7..fe80c4c 100644 --- a/Proj.thy +++ b/Proj.thy @@ -49,16 +49,7 @@ text "Typing judgments and computation rules for the dependent and non-dependent lemma fst_dep_type: assumes "p : \x:A. B x" shows "fst[A,B]`p : A" - -proof - show "fst[A,B]: (\x:A. B x) \ A" - proof (unfold fst_dep_def, standard) - show "\p. p : \x:A. B x \ indSum[A,B] (\_. A) (\x y. x) p : A" - proof - show "A : U" by (wellformed jdgmt: assms) - qed - qed (wellformed jdgmt: assms) -qed (rule assms) + by (derive lems: fst_dep_def assms) lemma fst_dep_comp: @@ -67,18 +58,10 @@ lemma fst_dep_comp: proof - have "fst[A,B]`(a,b) \ indSum[A,B] (\_. A) (\x y. x) (a,b)" - proof (unfold fst_dep_def, standard) - show "(a,b) : \x:A. B x" using assms .. - show "\p. p : \x:A. B x \ indSum[A,B] (\_. A) (\x y. x) p : A" - proof - show "A : U" by (wellformed jdgmt: assms(2)) - qed - qed + by (derive lems: fst_dep_def assms) also have "indSum[A,B] (\_. A) (\x y. x) (a,b) \ a" - proof - show "A : U" by (wellformed jdgmt: assms(2)) - qed (assumption, (rule assms)+) + by (derive lems: assms) finally show "fst[A,B]`(a,b) \ a" . qed @@ -89,12 +72,8 @@ text "In proving results about the second dependent projection function we often lemma lemma1: assumes "p : \x:A. B x" shows "B (fst[A,B]`p) : U" + by (derive lems: assms fst_dep_def) -proof - - have *: "B: A \ U" by (wellformed jdgmt: assms) - have "fst[A,B]`p : A" using assms by (rule fst_dep_type) - then show "B (fst[A,B]`p) : U" by (rule *) -qed lemma lemma2: assumes "B: A \ U" and "x : A" and "y : B x" @@ -110,7 +89,7 @@ lemma snd_dep_type: assumes "p : \x:A. B x" shows "snd[A,B]`p : B (fst[A,B]`p)" -proof +proof (derive lems: assms snd_dep_def) show "snd[A, B] : \p:(\x:A. B x). B (fst[A,B]`p)" proof (unfold snd_dep_def, standard) show "\p. p : \x:A. B x \ indSum[A,B] (\q. B (fst[A,B]`q)) (\x y. y) p : B (fst[A,B]`p)" @@ -216,7 +195,7 @@ lemma snd_nondep_comp: proof - have "snd[A,B]`(a,b) \ indSum[A, \_. B] (\_. B) (\x y. y) (a,b)" proof (unfold snd_nondep_def, standard) - show "(a,b) : A \ B" using assms .. + show "(a,b) : A \ B" by (simple conds: assms) show "\p. p : A \ B \ indSum[A, \_. B] (\_. B) (\x y. y) p : B" proof show "B : U" by (wellformed jdgmt: assms(2)) -- cgit v1.2.3