From 912a4a4b909041cb280ae5cecd40867ce34b58de Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Mon, 18 Jun 2018 11:20:11 +0200 Subject: Removed all [simp] attributes, these will be added later when I set up the simplifier. Proved simplification rule for dependent fst. --- Sum.thy | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'Sum.thy') diff --git a/Sum.thy b/Sum.thy index fbfc15a..8e7ccd6 100644 --- a/Sum.thy +++ b/Sum.thy @@ -15,6 +15,9 @@ axiomatization pair :: "[Term, Term] \ Term" ("(1'(_,/ _'))") and indSum :: "[Term, Typefam, Typefam, [Term, Term] \ Term, Term] \ Term" ("(1indSum[_,/ _])") + +section \Syntax\ + syntax "_SUM" :: "[idt, Term, Term] \ Term" ("(3\_:_./ _)" 20) "_SUM_ASCII" :: "[idt, Term, Term] \ Term" ("(3SUM _:_./ _)" 20) @@ -23,30 +26,35 @@ translations "\x:A. B" \ "CONST Sum A (\x. B)" "SUM x:A. B" \ "CONST Sum A (\x. B)" + +section \Type rules\ + axiomatization where - Sum_form [intro]: "\A B. \A : U; B: A \ U\ \ \x:A. B x : U" + Sum_form: "\A B. \A : U; B: A \ U\ \ \x:A. B x : U" and - Sum_intro [intro]: "\A B a b. \B: A \ U; a : A; b : B a\ \ (a,b) : \x:A. B x" + Sum_intro: "\A B a b. \B: A \ U; a : A; b : B a\ \ (a,b) : \x:A. B x" and - Sum_elim [elim]: "\A B C f p. \ + Sum_elim: "\A B C f p. \ C: \x:A. B x \ U; \x y. \x : A; y : B x\ \ f x y : C (x,y); p : \x:A. B x \ \ indSum[A,B] C f p : C p" and - Sum_comp [simp]: "\A B C f a b. \ + Sum_comp: "\A B C f a b. \ C: \x:A. B x \ U; \x y. \x : A; y : B x\ \ f x y : C (x,y); a : A; b : B a \ \ indSum[A,B] C f (a,b) \ f a b" +lemmas Sum_rules [intro] = Sum_form Sum_intro Sum_elim Sum_comp + \ \Nondependent pair\ abbreviation Pair :: "[Term, Term] \ Term" (infixr "\" 50) where "A \ B \ \_:A. B" -section \Projections\ +section \Projection functions\ consts fst :: "[Term, 'a] \ Term" ("(1fst[/_,/ _])") @@ -74,23 +82,28 @@ begin "snd_nondep A B \ \<^bold>\p: A \ B. indSum[A, \_. B] (\_. B) (\x y. y) p" end -text "Properties of projections:" +text "Simplifying projections:" -lemma fst_dep_comp: +lemma fst_dep_comp: (* Potential for automation *) assumes "B: A \ U" and "a : A" and "b : B a" shows "fst[A,B]`(a,b) \ a" -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" . - moreover - ultimately show "fst[A,B]`(a,b) \ a" unfolding fst_dep_def using assms by simp -qed +proof (unfold fst_dep_def) + \ "Write about this proof: unfolding, how we set up the introduction rules (explain \..\), do a trace of the proof, explain the meaning of keywords, etc." -thm Sum_comp + have *: "A : U" using assms(2) .. (* I keep thinking this should not have to be done explicitly, but rather automated. *) + + then 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 .. + + ultimately have "(\<^bold>\p: (\x:A. B x). indSum[A,B] (\_. A) (\x y. x) p)`(a,b) \ + indSum[A,B] (\_. A) (\x y. x) (a,b)" .. + + also have "indSum[A,B] (\_. A) (\x y. x) (a,b) \ a" + by (rule Sum_comp) (rule *, assumption, (rule assms)+) + + finally show "(\<^bold>\p: (\x:A. B x). indSum[A,B] (\_. A) (\x y. x) p)`(a,b) \ a" . +qed lemma snd_dep_comp: assumes "a : A" and "b : B a" -- cgit v1.2.3