From 593faab277de53cbe2cb0c2feca5de307d9334ac Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Sat, 9 Jun 2018 00:11:39 +0200 Subject: Reorganize code --- HoTT_Theorems.thy | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) (limited to 'HoTT_Theorems.thy') diff --git a/HoTT_Theorems.thy b/HoTT_Theorems.thy index f05363a..95f1d0c 100644 --- a/HoTT_Theorems.thy +++ b/HoTT_Theorems.thy @@ -6,13 +6,13 @@ text "A bunch of theorems and other statements for sanity-checking, as well as t Things that *should* be automated: \ Checking that \A\ is a well-formed type, when writing things like \x : A\ and \A : U\. - \ Checking that the argument to a (dependent/non-dependent) function matches the type? Also the arguments to a pair? -" + \ 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]] -section \Functions\ + +section \\ type\ subsection \Typing functions\ @@ -35,6 +35,7 @@ proof then show "\<^bold>\y:B. a : B \ A" .. qed + subsection \Function application\ proposition "a : A \ (\<^bold>\x:A. x)`a \ a" by simp @@ -47,7 +48,10 @@ lemma "a : A \ (\<^bold>\x:A. \<^bold>\y:B(x). f lemma "\a : A; b : B(a); c : C(a)(b)\ \ (\<^bold>\x:A. \<^bold>\y:B(x). \<^bold>\z:C(x)(y). f x y z)`a`b`c \ f a b c" by simp -proposition wellformed_currying: + +subsection \Currying functions\ + +proposition curried_function_formation: fixes A::Term and B::"Term \ Term" and @@ -67,7 +71,7 @@ proof qed (rule assms) (**** GOOD CANDIDATE FOR AUTOMATION - EISBACH! ****) -proposition triply_curried: +proposition higher_order_currying_formation: fixes A::Term and B::"Term \ Term" and @@ -94,7 +98,8 @@ proof qed qed (rule assms) -lemma curried_type: +(**** AND PROBABLY THIS TOO? ****) +lemma curried_type_judgment: fixes a b A::Term and B::"Term \ Term" and @@ -115,6 +120,9 @@ qed text "Note that the propositions and proofs above often say nothing about the well-formedness of the types, or the well-typedness of the lambdas involved; one has to be very explicit and prove such things separately! This is the result of the choices made regarding the premises of the type rules." + +section \\ type\ + text "The following shows that the dependent sum inductor has the type we expect it to have:" lemma @@ -126,7 +134,7 @@ proof - "P \ \x:A. B(x)" have "\<^bold>\f:F. \<^bold>\p:P. indSum(C)`f`p : \f:F. \p:P. C(p)" - proof (rule curried_type) + proof (rule curried_type_judgment) fix f p::Term assume "f : F" and "p : P" with assms show "indSum(C)`f`p : C(p)" unfolding F_def P_def .. @@ -135,15 +143,42 @@ proof - then show "indSum(C) : \f:F. \p:P. C(p)" by simp qed +(**** AUTOMATION CANDIDATE ****) +text "Propositional uniqueness principle for dependent sums:" + +text "We would like to eventually automate proving that 'a given type \A\ is inhabited', i.e. search for an element \a:A\. + +A good starting point would be to automate the application of elimination rules." + +notepad begin + +fix A B assume "A : U" and "B: A \ U" + +define C where "C \ \p. p =[\x:A. B(x)] (fst[A,B]`p, snd[A,B]`p)" +have *: "C: \x:A. B(x) \ U" +proof - + fix p assume "p : \x:A. B(x)" + have "(fst[A,B]`p, snd[A,B]`p) : \x:A. B(x)" + +define f where "f \ \<^bold>\x:A. \<^bold>\y:B(x). refl((x,y))" +have "f`x`y : C((x,y))" +sorry + +have "p : \x:A. B(x) \ indSum(C)`f`p : C(p)" using * ** by (rule Sum_elim) + +end + +section \Universes and polymorphism\ + text "Polymorphic identity function." consts Ui::Term definition Id where "Id \ \<^bold>\A:Ui. \<^bold>\x:A. x" -(* Have to think about universes... *) + (* -section \Nats\ +section \Natural numbers\ text "Here's a dumb proof that 2 is a natural number." -- cgit v1.2.3