From c087ad35ac9365cad99b022e138348fb68bc9215 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Mon, 4 Jun 2018 19:38:01 +0200 Subject: Prod_comp should have a type constraint. This also fixes a false proof for the dependent sum projection functions. --- HoTT_Theorems.thy | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) (limited to 'HoTT_Theorems.thy') diff --git a/HoTT_Theorems.thy b/HoTT_Theorems.thy index 5922b51..aeddf9f 100644 --- a/HoTT_Theorems.thy +++ b/HoTT_Theorems.thy @@ -16,7 +16,7 @@ section \Functions\ 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" .. @@ -41,9 +41,9 @@ proposition "a : A \ (\<^bold>\x:A. x)`a \ a" by text "Currying:" -lemma "(\<^bold>\x:A. \<^bold>\y:B. f x y)`a \ \<^bold>\y:B. f a y" 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 -lemma "(\<^bold>\x:A. \<^bold>\y:B. \<^bold>\z:C. f x y z)`a`b`c \ f a b c" by simp +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: fixes @@ -56,29 +56,53 @@ proposition wellformed_currying: "\x::Term. C(x): B(x) \ U" shows "\x:A. \y:B(x). C x y : U" proof (rule Prod_formation) - show "\x::Term. x : A \ \y:B(x). C x y : U" + fix x::Term + assume *: "x : A" + show "\y:B(x). C x y : U" proof (rule Prod_formation) - fix x y::Term - assume "x : A" - show "y : B x \ C x y : U" by (rule assms(3)) - qed (rule assms(2)) -qed (rule assms(1)) + show "B(x) : U" using * by (rule assms) + qed (rule assms) +qed (rule assms) + +proposition triply_curried: + fixes + A::Term and + B::"Term \ Term" and + C::"[Term, Term] \ Term" and + D::"[Term, Term, Term] \ Term" + assumes + "A : U" and + "B: A \ U" and + "\x y::Term. y : B(x) \ C(x)(y) : U" and + "\x y z::Term. z : C(x)(y) \ D(x)(y)(z) : U" + shows "\x:A. \y:B(x). \z:C(x)(y). D(x)(y)(z) : U" +proof (rule Prod_formation) + fix x::Term assume 1: "x : A" + show "\y:B(x). \z:C(x)(y). D(x)(y)(z) : U" + proof (rule Prod_formation) + show "B(x) : U" using 1 by (rule assms) + + fix y::Term assume 2: "y : B(x)" + show "\z:C(x)(y). D(x)(y)(z) : U" + proof (rule Prod_formation) + show "C x y : U" using 2 by (rule assms) + show "\z::Term. z : C(x)(y) \ D(x)(y)(z) : U" by (rule assms) + qed + qed +qed (rule assms) lemma fixes a b A::Term and B::"Term \ Term" and f C::"[Term, Term] \ Term" - assumes "\x y::Term. \x : A; y : B(x)\ \ f x y : C x y" + assumes "\x y::Term. f x y : C x y" shows "\<^bold>\x:A. \<^bold>\y:B(x). f x y : \x:A. \y:B(x). C x y" proof fix x::Term - assume *: "x : A" show "\<^bold>\y:B(x). f x y : \y:B(x). C x y" proof - fix y::Term - assume **: "y : B(x)" - show "f x y : C x y" by (rule assms[OF * **]) + show "\y. f x y : C x y" by (rule assms) qed qed -- cgit v1.2.3