From 91efce41a2319a9fb861ff26d7dc8c49ec726d4c Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Tue, 12 Jun 2018 12:30:54 +0200 Subject: Type rules now have \"all\" premises explicitly stated, matching the formulation in the HoTT book. --- HoTT_Theorems.thy | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'HoTT_Theorems.thy') diff --git a/HoTT_Theorems.thy b/HoTT_Theorems.thy index 95f1d0c..2c2a31d 100644 --- a/HoTT_Theorems.thy +++ b/HoTT_Theorems.thy @@ -1,5 +1,6 @@ theory HoTT_Theorems imports HoTT + begin text "A bunch of theorems and other statements for sanity-checking, as well as things that should be automatically simplified. @@ -9,8 +10,7 @@ Things that *should* be automated: \ Checking that the argument to a (dependent/non-dependent) function matches the type? Also the arguments to a pair?" \ \Turn on trace for unification and the simplifier, for debugging.\ -declare[[unify_trace_simp, unify_trace_types, simp_trace, simp_trace_depth_limit=1]] - +declare[[unify_trace_simp, unify_trace_types, simp_trace, simp_trace_depth_limit=5]] section \\ type\ @@ -22,17 +22,18 @@ lemma "\<^bold>\x:A. x : A\A" .. proposition "A \ B \ \<^bold>\x:A. x : B\A" proof - - assume assm: "A \ B" - have id: "\<^bold>\x:A. x : A\A" .. - from assm have "A\A \ B\A" by simp - with id show "\<^bold>\x:A. x : B\A" .. + 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 qed proposition "\<^bold>\x:A. \<^bold>\y:B. x : A\B\A" proof fix a assume "a : A" - then show "\<^bold>\y:B. a : B \ A" .. + then show "\<^bold>\y:B. a : B \ A" .. qed @@ -42,7 +43,15 @@ proposition "a : A \ (\<^bold>\x:A. x)`a \ a" by text "Currying:" -lemma "\a : A; b : B\ \ (\<^bold>\x:A. \<^bold>\y:B. y)`a`b \ b" by simp +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)"]) + 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 lemma "a : A \ (\<^bold>\x:A. \<^bold>\y:B(x). f x y)`a \ \<^bold>\y:B(a). f a y" by simp -- cgit v1.2.3