From 5161a0356d8752f3b1b4f4385e799bca92718814 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Sun, 17 Jun 2018 00:48:01 +0200 Subject: Decided on a new proper scheme for type rules using the idea of implicit well-formed contexts and guaranteed conclusion well-formedness. Product type rules now follow this scheme. --- HoTT_Theorems.thy | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'HoTT_Theorems.thy') diff --git a/HoTT_Theorems.thy b/HoTT_Theorems.thy index ab5374d..871c553 100644 --- a/HoTT_Theorems.thy +++ b/HoTT_Theorems.thy @@ -16,42 +16,39 @@ section \\ type\ subsection \Typing functions\ -text "Declaring \Prod_intro\ with the \intro\ attribute (in HoTT.thy) enables \standard\ to prove the following." +text "Declaring \Prod_intro\ with the \intro\ attribute (in HoTT.thy) enables \standard\ to prove the following." -lemma "\<^bold>\x:A. x : A\A" .. +proposition assumes "A : U" shows "\<^bold>\x:A. x : A\A" using assms .. -proposition "A \ B \ \<^bold>\x:A. x : B\A" +proposition + assumes "A : U" and "A \ B" + shows "\<^bold>\x:A. x : B\A" proof - - assume "A \ B" - then have *: "A\A \ B\A" by simp - - have "\<^bold>\x:A. x : A\A" .. - with * show "\<^bold>\x:A. x : B\A" by simp + have "A\A \ B\A" using assms by simp + moreover have "\<^bold>\x:A. x : A\A" using assms(1) .. + ultimately show "\<^bold>\x:A. x : B\A" by simp qed -proposition "\<^bold>\x:A. \<^bold>\y:B. x : A\B\A" +proposition + assumes "A : U" and "B : U" + shows "\<^bold>\x:A. \<^bold>\y:B. x : A\B\A" proof - fix a - assume "a : A" - then show "\<^bold>\y:B. a : B \ A" .. - - ML_val \@{context} |> Variable.names_of\ - -qed + fix x + assume "x : A" + with assms(2) show "\<^bold>\y:B. x : B\A" .. +qed (rule assms) subsection \Function application\ -proposition "a : A \ (\<^bold>\x:A. x)`a \ a" by simp +proposition assumes "a : A" shows "(\<^bold>\x:A. x)`a \ a" using assms by simp text "Currying:" -term "lambda A (\x. \<^bold>\y:B(x). y)" - -thm Prod_comp[where ?B = "\x. \y:B(x). B(x)"] - -lemma "a : A \ (\<^bold>\x:A. \<^bold>\y:B(x). y)`a \ \<^bold>\y:B(a). y" -proof (rule Prod_comp[where ?B = "\x. \y:B(x). B(x)"]) +lemma + assumes "a : A" + shows "(\<^bold>\x:A. \<^bold>\y:B(x). y)`a \ \<^bold>\y:B(a). y" +proof show "\x. a : A \ x : A \ \<^bold>\y:B x. y : B x \ B x" lemma "\a : A; b : B\ \ (\<^bold>\x:A. \<^bold>\y:B(x). y)`a`b \ b" by simp -- cgit v1.2.3