From 6857e783fa5cb91f058be322a18fb9ea583f2aad Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Tue, 18 Sep 2018 11:38:54 +0200 Subject: Overhaul of the theory presentations. New methods in HoTT_Methods.thy for handling universes. Commit for release 0.1.0! --- ex/HoTT book/Ch1.thy | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) (limited to 'ex/HoTT book/Ch1.thy') diff --git a/ex/HoTT book/Ch1.thy b/ex/HoTT book/Ch1.thy index a577fca..263f43d 100644 --- a/ex/HoTT book/Ch1.thy +++ b/ex/HoTT book/Ch1.thy @@ -1,55 +1,50 @@ -(* Title: HoTT/ex/HoTT book/Ch1.thy - Author: Josh Chen +(* +Title: ex/HoTT book/Ch1.thy +Author: Josh Chen +Date: 2018 A formalization of some content of Chapter 1 of the Homotopy Type Theory book. *) theory Ch1 - imports "../../HoTT" +imports "../../HoTT" + begin chapter \HoTT Book, Chapter 1\ -section \1.6 Dependent pair types (\-types)\ +section \1.6 Dependent pair types (\-types)\ -text "Propositional uniqueness principle:" +paragraph \Propositional uniqueness principle.\ schematic_goal - assumes "(\x:A. B(x)): U(i)" and "p: \x:A. B(x)" - shows "?a: p =[\x:A. B(x)] " + assumes "A: U i" and "B: A \ U i" and "p: \x:A. B x" + shows "?a: p =[\x:A. B x] " -text "Proof by induction on \p: \x:A. B(x)\:" +text \Proof by induction on @{term "p: \x:A. B x"}:\ proof (rule Sum_elim[where ?p=p]) - text "We just need to prove the base case; the rest will be taken care of automatically." - - fix x y assume asm: "x: A" "y: B(x)" show - "refl(): =[\x:A. B(x)] , snd >" - proof (subst (0 1) comp) - text " - The computation rules for \fst\ and \snd\ require that \x\ and \y\ have appropriate types. - The automatic proof methods have trouble picking the appropriate types, so we state them explicitly, - " - show "x: A" and "y: B(x)" by (fact asm)+ - - text "...twice, once each for the substitutions of \fst\ and \snd\." - show "x: A" and "y: B(x)" by (fact asm)+ + text \We prove the base case.\ + fix x y assume asm: "x: A" "y: B x" show "refl : =[\x:A. B x] , snd >" + proof compute + show "x: A" and "y: B x" by (fact asm)+ \ \Hint the correct types.\ + text \And now @{method derive} takes care of the rest. +\ qed (derive lems: assms asm) - qed (derive lems: assms) section \Exercises\ -text "Exercise 1.13" +paragraph \Exercise 1.13\ -abbreviation "not" ("\'(_')") where "\(A) \ A \ \" +abbreviation "not" ("\_") where "\A \ A \ \" text "This proof requires the use of universe cumulativity." -proposition assumes "A: U(i)" shows "\<^bold>\f. f`(inr(\<^bold>\a. f`inl(a))): \(\(A + \(A)))" -by (derive lems: assms U_cumulative[where ?A=\ and ?i=O and ?j=i]) +proposition assumes "A: U i" shows "\<^bold>\f. f`(inr(\<^bold>\a. f`(inl a))): \(\(A + \A))" +by (derive lems: assms) end -- cgit v1.2.3