(* Title: HoTT/HoTT_Base.thy Author: Josh Chen Date: Jun 2018 Basic setup and definitions of a homotopy type theory object logic. *) theory HoTT_Base imports Pure begin section \Foundational definitions\ text "A single meta-type \Term\ suffices to implement the object-logic types and terms." typedecl Term section \Named theorems\ text "Named theorems to be used by proof methods later (see HoTT_Methods.thy). \wellform\ declares necessary wellformedness conditions for type and inhabitation judgments, while \comp\ declares computation rules, which are used by the simplification method as equational rewrite rules." named_theorems wellform named_theorems comp section \Judgments\ text "Formalize the basic judgments. For judgmental equality we use the existing Pure equality \\\ and hence do not need to define a separate judgment for it. The judgment \is_a_type A\ expresses the statement ``A is an inhabitant of some universe type'', i.e. ``A is a type''." consts is_of_type :: "[Term, Term] \ prop" ("(1_ : _)" [0, 1000] 1000) is_a_type :: "Term \ prop" ("(1_ : U)" [0] 1000) text "The following fact is used to make explicit the assumption of well-formed contexts." axiomatization where inhabited_implies_type [intro, elim, wellform]: "\a A. a : A \ A : U" section \Universes\ text "Strictly-ordered meta-level natural numbers to index the universes." typedecl Numeral axiomatization O :: Numeral ("0") and S :: "Numeral \ Numeral" ("S_") and lt :: "[Numeral, Numeral] \ prop" (infix "<-" 999) where Numeral_lt_min: "\n. 0 <- S n" and Numeral_lt_trans: "\m n. m <- n \ S m <- S n" \ \This lets \standard\ prove ordering statements on Numerals.\ lemmas Numeral_lt_rules [intro] = Numeral_lt_min Numeral_lt_trans text "Universe types:" axiomatization U :: "Numeral \ Term" ("U_") where Universe_hierarchy: "\i j. i <- j \ U(i) : U(j)" and Universe_cumulative: "\a i j. \a : U(i); i <- j\ \ a : U(j)" lemmas Universe_rules [intro] = Universe_hierarchy Universe_cumulative section \Type families\ text "A (one-variable) type family is a meta lambda term \P :: Term \ Term\ that further satisfies the following property." type_synonym Typefam = "Term \ Term" abbreviation (input) is_type_family :: "[Typefam, Term] \ prop" ("(3_:/ _ \ U)") where "P: A \ U \ (\x. x : A \ P x : U)" \ \There is an obvious generalization to multivariate type families, but implementing such an abbreviation would probably involve writing ML code, and is for the moment not really crucial.\ end