(* Title: HoTT/Prod.thy Author: Josh Chen Date: Jun 2018 Dependent product (function) type for the HoTT logic. *) theory Prod imports HoTT_Base begin axiomatization Prod :: "[Term, Typefam] \ Term" and lambda :: "[Term, Term \ Term] \ Term" and \ \Application binds tighter than abstraction.\ appl :: "[Term, Term] \ Term" (infixl "`" 60) section \Syntax\ syntax "_PROD" :: "[idt, Term, Term] \ Term" ("(3\_:_./ _)" 30) "_LAMBDA" :: "[idt, Term, Term] \ Term" ("(1\<^bold>\_:_./ _)" 30) "_PROD_ASCII" :: "[idt, Term, Term] \ Term" ("(3PROD _:_./ _)" 30) "_LAMBDA_ASCII" :: "[idt, Term, Term] \ Term" ("(3%%_:_./ _)" 30) text "The translations below bind the variable \x\ in the expressions \B\ and \b\." translations "\x:A. B" \ "CONST Prod A (\x. B)" "\<^bold>\x:A. b" \ "CONST lambda A (\x. b)" "PROD x:A. B" \ "CONST Prod A (\x. B)" "%%x:A. b" \ "CONST lambda A (\x. b)" section \Type rules\ axiomatization where Prod_form: "\A B. \A : U; B: A \ U\ \ \x:A. B x : U" and Prod_form_cond1: "\A B. (\x:A. B x : U) \ A : U" and Prod_form_cond2: "\A B. (\x:A. B x : U) \ B: A \ U" and Prod_intro: "\A B b. \A : U; \x. x : A \ b x : B x\ \ \<^bold>\x:A. b x : \x:A. B x" and Prod_elim: "\A B f a. \f : \x:A. B x; a : A\ \ f`a : B a" and Prod_comp: "\A B b a. \\x. x : A \ b x : B x; a : A\ \ (\<^bold>\x:A. b x)`a \ b a" and Prod_uniq: "\A B f. f : \x:A. B x \ \<^bold>\x:A. (f`x) \ f" text "Note that the syntax \\<^bold>\\ (bold lambda) used for dependent functions clashes with the proof term syntax (cf. \
2.5.2 of the Isabelle/Isar Implementation)." text "In textbook presentations it is usual to present type formation as a forward implication, stating conditions sufficient for the formation of the type. It is however implicit that the premises of the rule are also necessary, so that for example the only way for one to have that \\x:A. B x : U\ is for \A : U\ and \B: A \ U\ in the first place. This is what the additional formation rules \Prod_form_cond1\ and \Prod_form_cond2\ express." text "The type rules should be able to be used as introduction and elimination rules by the standard reasoner:" lemmas Prod_rules [intro] = Prod_form Prod_intro Prod_elim Prod_comp Prod_uniq lemmas Prod_form_conds [elim, wellform] = Prod_form_cond1 Prod_form_cond2 lemmas Prod_comps [comp] = Prod_comp Prod_uniq text "Nondependent functions are a special case." abbreviation Function :: "[Term, Term] \ Term" (infixr "\" 40) where "A \ B \ \_:A. B" end