From f83534561085c224ab30343b945ee74d1ce547f4 Mon Sep 17 00:00:00 2001 From: Josh Chen Date: Tue, 14 Aug 2018 15:08:37 +0200 Subject: Equality inverse and composition done. Cleaned up methods and method example theory. --- HoTT_Methods.thy | 67 +++++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 42 deletions(-) (limited to 'HoTT_Methods.thy') diff --git a/HoTT_Methods.thy b/HoTT_Methods.thy index f80b99b..e2eb4f1 100644 --- a/HoTT_Methods.thy +++ b/HoTT_Methods.thy @@ -13,69 +13,52 @@ theory HoTT_Methods begin -section \Setup\ - -text "Import the \subst\ method, used by \simplify\." - -ML_file "~~/src/Tools/misc_legacy.ML" -ML_file "~~/src/Tools/IsaPlanner/isand.ML" -ML_file "~~/src/Tools/IsaPlanner/rw_inst.ML" -ML_file "~~/src/Tools/IsaPlanner/zipper.ML" -ML_file "~~/src/Tools/eqsubst.ML" - - section \Method definitions\ subsection \Simple type rule proof search\ -text "Prove type judgments \A : U\ and inhabitation judgments \a : A\ using rules declared [intro] and [elim], as well as additional provided lemmas. - -Can also perform typechecking, and search for elements of a type." +text " + Prove type judgments \A : U\ and inhabitation judgments \a : A\ using the type rules declared [intro] and [elim] (in the respective theory files), as well as additional provided lemmas. + + Can also perform typechecking, and search for elements of a type. +" -method simple uses lems = (assumption | rule lems | standard)+ +method simple uses lem = (assumption | rule lem | standard)+ subsection \Wellformedness checker\ -text "Find a proof of any valid typing judgment derivable from a given wellformed judgment. -The named theorem \wellform\ is declared in HoTT_Base.thy." +text " + \wellformed\ finds a proof of any valid typing judgment derivable from the judgments passed as \lem\. + The named theorem \wellform\ is declared in HoTT_Base.thy. +" -method wellformed uses jdgmt declares wellform = +method wellformed' uses jmt declares wellform = match wellform in rl: "PROP ?P" \ \( - catch \rule rl[OF jdgmt]\ \fail\ | - catch \wellformed jdgmt: rl[OF jdgmt]\ \fail\ + catch \rule rl[OF jmt]\ \fail\ | + catch \wellformed' jmt: rl[OF jmt]\ \fail\ )\ +method wellformed uses lem = + match lem in lem: "?X : ?Y" \ \wellformed' jmt: lem\ -subsection \Derivation search\ - -text "Combine \simple\, \wellformed\ and the universe hierarchy rules to search for derivations of judgments. -\wellformed\ uses the facts passed as \lems\ to derive any required typing judgments. -Definitions passed as \unfolds\ are unfolded throughout." - -method derive uses lems unfolds = ( - unfold unfolds | - simple lems: lems | - match lems in lem: "?X : ?Y" \ \wellformed jdgmt: lem\ | - rule U_hierarchy (*| - (rule U_cumulative, simple lems: lems) | - (rule U_cumulative, match lems in lem: "?X : ?Y" \ \wellformed jdgmt: lem\)*) - )+ +subsection \Derivation search\ -subsection \Simplification\ +text " Combine \simple\ and \wellformed\ to search for derivations of judgments." -text "The methods \rsimplify\ and \simplify\ search for lambda applications to simplify and are suitable for solving definitional equalities, as well as harder proofs where \derive\ fails. +method derive uses lem = (simple lem: lem | wellformed lem: lem)+ -It is however not true that these methods are strictly stronger; if they fail to find a suitable substitution they will fail where \derive\ may succeed. -\simplify\ is allowed to use the Pure Simplifier and is hence unsuitable for simplifying lambda expressions using only the type rules. -In this case use \rsimplify\ instead." +subsection \Substitution and simplification\ -method rsimplify uses lems = (subst (0) comp, derive lems: lems)+ - \ \\subst\ performs an equational rewrite according to some computation rule declared as [comp], after which \derive\ attempts to solve any new assumptions that arise.\ +text "Import the \subst\ method, used for substituting definitional equalities." -method simplify uses lems = (simp add: lems | rsimplify lems: lems)+ +ML_file "~~/src/Tools/misc_legacy.ML" +ML_file "~~/src/Tools/IsaPlanner/isand.ML" +ML_file "~~/src/Tools/IsaPlanner/rw_inst.ML" +ML_file "~~/src/Tools/IsaPlanner/zipper.ML" +ML_file "~~/src/Tools/eqsubst.ML" end \ No newline at end of file -- cgit v1.2.3