From 68aa069172933b875d70a5ef71e9db0ae685a92d Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Sun, 17 Feb 2019 18:34:38 +0100 Subject: Method "quantify" converts product inhabitation into Pure universal statements. Also misc. cleanups. --- Prod.thy | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'Prod.thy') diff --git a/Prod.thy b/Prod.thy index 4235793..a843c7a 100644 --- a/Prod.thy +++ b/Prod.thy @@ -9,6 +9,7 @@ imports HoTT_Base HoTT_Methods begin + section \Basic type definitions\ axiomatization @@ -35,14 +36,14 @@ The syntax translations above bind the variable @{term x} in the expressions @{t text \Non-dependent functions are a special case:\ abbreviation Fun :: "[t, t] \ t" (infixr "\" 40) -where "A \ B \ \(_: A). B" +where "A \ B \ \_: A. B" axiomatization where \ \Type rules\ Prod_form: "\A: U i; B: A \ U i\ \ \x: A. B x: U i" and - Prod_intro: "\A: U i; \x. x: A \ b x: B x\ \ \x: A. b x: \x: A. B x" and + Prod_intro: "\\x. x: A \ b x: B x; A: U i\ \ \x: A. b x: \x: A. B x" and Prod_elim: "\f: \x: A. B x; a: A\ \ f`a: B a" and @@ -68,6 +69,25 @@ lemmas Prod_routine [intro] = Prod_form Prod_intro Prod_elim lemmas Prod_comp [comp] = Prod_cmp Prod_uniq lemmas Prod_cong [cong] = Prod_form_eq Prod_intro_eq + +section \Universal quantification\ + +text \ +It will often be useful to convert a proof goal asserting the inhabitation of a dependent product to one that instead uses Pure universal quantification. + +Method @{theory_text quantify} converts the goal +@{text "t: \x1: A1. ... \xn: An. B x1 ... xn"}, +where @{term B} is not a product, to +@{text "\x1 ... xn . \x1: A1; ...; xn: An\ \ ?b x1 ... xn: B x1 ... xn"}. + +Method @{theory_text "quantify k"} does the same, but only for the first k unknowns. +\ + +method_setup quantify = \repeat (fn ctxt => Method.rule_tac ctxt [@{thm Prod_intro}] [] 1)\ + +method quantify_all = (rule Prod_intro)+ + + section \Function composition\ definition compose :: "[t, t, t] \ t" @@ -76,6 +96,7 @@ where "compose A g f \ \x: A. g`(f`x)" declare compose_def [comp] syntax "_compose" :: "[t, t] \ t" (infixr "o" 110) +(* parse_translation \ let fun compose_tr ctxt [g, f] = let @@ -98,6 +119,7 @@ in [("_compose", compose_tr)] end \ +*) text \Pretty-printing switch for composition; hides domain type information.\ @@ -120,7 +142,7 @@ by (derive lems: assms cong) lemma compose_comp: assumes "A: U i" and "\x. x: A \ b x: B" and "\x. x: B \ c x: C x" - shows "(\x: B. c x) o (\x: A. b x) \ \x: A. c (b x)" + shows "compose A (\x: B. c x) (\x: A. b x) \ \x: A. c (b x)" by (derive lems: assms cong) abbreviation id :: "t \ t" where "id A \ \x: A. x" -- cgit v1.2.3