From a7303e36651ea1f8ec50958415fa0db7295ad957 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Fri, 1 Jun 2018 03:39:51 +0200 Subject: Should be final version of Prod. Theorems proving stuff about currying. Rules for Sum, going to change them to use object-level arguments more. --- HoTT.thy | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'HoTT.thy') diff --git a/HoTT.thy b/HoTT.thy index 6de4efb..8c9fa20 100644 --- a/HoTT.thy +++ b/HoTT.thy @@ -23,20 +23,9 @@ subsection \Type families\ text "Type families are implemented as meta-level lambda terms of type \Term \ Term\ that further satisfy the following property." -abbreviation is_type_family :: "[(Term \ Term), Term] \ prop" ("(3_:/ _ \ U)") +abbreviation is_type_family :: "[Term \ Term, Term] \ prop" ("(3_:/ _ \ U)") where "P: A \ U \ (\x::Term. x : A \ P(x) : U)" -\ \ -I originally wrote the following, but I'm not sure it's useful. -\theorem constant_type_family': "B : U \ \_. B: A \ U" - proof - - assume "B : U" - then show "\_. B: A \ U" . - qed - -lemmas constant_type_family = constant_type_family' constant_type_family'[rotated]\ -\ - subsection \Definitional equality\ text "We take the meta-equality \\\, defined by the Pure framework for any of its terms, and use it additionally for definitional/judgmental equality of types and terms in our theory. @@ -58,8 +47,8 @@ subsection \Basic types\ subsubsection \Dependent function/product\ consts - Prod :: "[Term, (Term \ Term)] \ Term" - lambda :: "[Term, (Term \ Term)] \ Term" + Prod :: "[Term, Term \ Term] \ Term" + lambda :: "[Term, Term \ Term] \ Term" syntax "_Prod" :: "[idt, Term, Term] \ Term" ("(3\_:_./ _)" 10) "__lambda" :: "[idt, Term, Term] \ Term" ("(3\<^bold>\_:_./ _)" 10) @@ -76,13 +65,13 @@ axiomatization where Prod_form: "\(A::Term) (B::Term \ Term). \A : U; B : A \ U\ \ \x:A. B(x) : U" and - Prod_intro [intro]: "\(A::Term) (b::Term \ Term) (B::Term \ Term). + Prod_intro [intro]: "\(A::Term) (B::Term \ Term) (b::Term \ Term). (\x::Term. x : A \ b(x) : B(x)) \ \<^bold>\x:A. b(x) : \x:A. B(x)" and - Prod_elim [elim]: "\(f::Term) (A::Term) (B::Term \ Term) (a::Term). + Prod_elim [elim]: "\(A::Term) (B::Term \ Term) (f::Term) (a::Term). \f : \x:A. B(x); a : A\ \ f`a : B(a)" and - Prod_comp [simp]: "\(a::Term) (A::Term) (b::Term \ Term). a : A \ (\<^bold>\x:A. b(x))`a \ b(a)" and + Prod_comp [simp]: "\(A::Term) (b::Term \ Term) (a::Term). (\<^bold>\x:A. b(x))`a \ b(a)" and Prod_uniq [simp]: "\(A::Term) (f::Term). \<^bold>\x:A. (f`x) \ f" @@ -104,21 +93,25 @@ abbreviation Pair :: "[Term, Term] \ Term" (infixr "\" 50) axiomatization pair :: "[Term, Term] \ Term" ("(1'(_,/ _'))") and - indSum :: "[Term \ Term, Term \ Term, Term] \ Term" + indSum :: "[Term \ Term, [Term, Term] \ Term, Term] \ Term" where Sum_form: "\(A::Term) (B::Term \ Term). \A : U; B: A \ U\ \ \x:A. B(x) : U" and Sum_intro [intro]: "\(A::Term) (B::Term \ Term) (a::Term) (b::Term). \a : A; b : B(a)\ \ (a, b) : \x:A. B(x)" and - Sum_elim [elim]: "\(A::Term) (B::Term \ Term) (C::Term \ Term) (f::Term \ Term) (p::Term). - \C: \x:A. B(x) \ U; \x y::Term. \x : A; y : B(x)\ \ f((x,y)) : C((x,y)); p : \x:A. B(x)\ \ (indSum C f p) : C(p)" and + Sum_elim [elim]: "\(A::Term) (B::Term \ Term) (C::Term \ Term) (f::[Term, Term] \ Term) (p::Term). + \C: \x:A. B(x) \ U; \x y::Term. \x : A; y : B(x)\ \ f x y : C((x,y)); p : \x:A. B(x)\ \ (indSum C f p) : C(p)" and - Sum_comp [simp]: "\(A::Term) (B::Term \ Term) (C::Term \ Term) (f::Term \ Term) (a::Term) (b::Term). - (indSum C f (a,b)) \ f((a,b))" + Sum_comp [simp]: "\(C::Term \ Term) (f::[Term, Term] \ Term) (a::Term) (b::Term). (indSum C f (a,b)) \ f a b" lemmas Sum_formation = Sum_form Sum_form[rotated] +definition fst :: "[Term, [Term, Term] \ Term] \ (Term \ Term)" ("(1fst[/_,/ _])") + where "fst[A, B] \ indSum (\_. A) (\a. \b. a)" + +lemma "fst[A, B](a,b) \ a" unfolding fst_def by simp + text "A choice had to be made for the elimination rule: we formalize the function \f\ taking \a : A\ and \b : B(x)\ and returning \C((a,b))\ as a meta level \f::Term \ Term\ instead of an object logic dependent function \f : \x:A. B(x)\. However we should be able to later show the equivalence of the formalizations." -- cgit v1.2.3