From 0036345412d5c145b63693ed672b175018fa3791 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Fri, 22 Feb 2019 19:43:53 +0100 Subject: Proof of pathcomp associativity done. Some comments --- HoTT_Methods.thy | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'HoTT_Methods.thy') diff --git a/HoTT_Methods.thy b/HoTT_Methods.thy index d93680a..099a73e 100644 --- a/HoTT_Methods.thy +++ b/HoTT_Methods.thy @@ -12,25 +12,6 @@ imports HoTT_Base "HOL-Eisbach.Eisbach" "HOL-Eisbach.Eisbach_Tools" begin -section \More method combinators\ - -ML \ -(* Use as "repeat n tac" *) -fun repeat tac = - let - fun cparser_of parser (ctxt, toks) = parser toks ||> (fn toks => (ctxt, toks)) - in - cparser_of Args.text >> - (fn n => fn ctxt => fn facts => - SIMPLE_METHOD ( - REPEAT_DETERM_N - (the (Int.fromString n)) - (tac ctxt)) - facts) - end -\ - - section \Substitution and simplification\ ML_file "~~/src/Tools/misc_legacy.ML" @@ -52,11 +33,9 @@ section \Handling universes\ text \ Methods @{theory_text provelt}, @{theory_text hierarchy}, and @{theory_text cumulativity} prove propositions of the form - \<^item> \n < (Suc (... (Suc n) ...))\, \<^item> \U i: U (Suc (... (Suc i) ...))\, and \<^item> @{prop "A: U i \ A: U j"}, where @{prop "i \ j"}, - respectively. \ @@ -72,7 +51,7 @@ method cumulativity declares form = ( section \Deriving typing judgments\ -method routine uses add = (assumption | rule add | rule)+ +method routine uses add = (rule add | assumption | rule)+ text \ The method @{method routine} proves typing judgments @{prop "a: A"} using the rules declared @{attribute intro} in the respective theory files, as well as any additional lemmas provided with the modifier @{theory_text add}. @@ -88,4 +67,22 @@ It also handles universes using @{method hierarchy} and @{method cumulativity}. method derive uses lems = (routine add: lems | compute comp: lems | cumulativity form: lems | hierarchy)+ + +section \Additional method combinators\ + +text \ +The ML expression @{ML_text "repeat tac"} below yields a @{ML_type "(Proof.context -> Proof.method) context_parser"}, which may be passed to @{command method_setup} to set up a method that scans for an integer n and executes the tactic returned by @{ML_text tac} n times. +See the setup of method @{text quantify} in @{file Prod.thy} for an example. +\ + +ML \ +fun repeat (tac: Proof.context -> tactic) = + let + fun cparser_of parser (ctxt, toks) = parser toks ||> (fn toks => (ctxt, toks)) + in + cparser_of Args.text >> (fn n => fn ctxt => fn facts => + SIMPLE_METHOD (REPEAT_DETERM_N (the (Int.fromString n))(tac ctxt)) facts) + end +\ + end -- cgit v1.2.3