diff --git a/Isabelle_DOF/ontologies/technical_report/technical_report.thy b/Isabelle_DOF/ontologies/technical_report/technical_report.thy index 19aebbf..aa1e3ec 100644 --- a/Isabelle_DOF/ontologies/technical_report/technical_report.thy +++ b/Isabelle_DOF/ontologies/technical_report/technical_report.thy @@ -82,36 +82,31 @@ doc_class report = \index\ ~~ \annex\\<^sup>* )" -(* -ML\@{doc_class "report"}\ -*) + + + + + +section\Experimental\ + ML\ fun get_class_2_ML ctxt (str,_) = let val thy = Context.theory_of ctxt val DOF_core.Onto_Class S = (DOF_core.get_onto_class_global' str thy) - in ML_Syntax.atomic(ML_Syntax.print_string(@{make_string} S)) end \ + in ML_Syntax.atomic(ML_Syntax.print_string(@{make_string} S)) end \ setup\ML_Antiquotation.inline \<^binding>\doc_class2\ - (fn (ctxt,toks) => (AttributeAccess.parse_cid >> get_class_2_ML ctxt) (ctxt, toks))\ + (fn (ctxt,toks) => (AttributeAccess.parse_cid >> get_class_2_ML ctxt) (ctxt, toks))\ ML\@{term \a + b\}\ ML\@{doc_class2 "report"}\ -ML\fun constant_def (decl, spec, prems, params) = #2 o Specification.definition decl params prems spec\ - - -ML\ val DOF_core.Onto_Class S = (DOF_core.get_onto_class_global' "report" @{theory}); - val regexp = #rex S - val binding = #name S - val doc_class_ty = @{typ doc_class} - val rexp_ty = @{typ "doc_class rexp"} - fun meta_eq_const T = Const (\<^const_name>\Pure.eq\, T --> T --> propT); - fun mk_meta_eq (t, u) = meta_eq_const (fastype_of t) $ t $ u; - -\ - - ML\ + fun constant_def (decl, spec, prems, params) = #2 o Specification.definition decl params prems spec + fun meta_eq_const T = Const (\<^const_name>\Pure.eq\, T --> T --> propT); + fun mk_meta_eq (t, u) = meta_eq_const (fastype_of t) $ t $ u; + val rexp_ty = @{typ "doc_class rexp"} + fun define (binding, rhs) (lthy)= let val Const(cname, _) = Syntax.read_term lthy (Binding.name_of binding) val lhs = Const(cname, rexp_ty) @@ -121,37 +116,35 @@ ML\ in constant_def args lthy end; \ -setup\Named_Target.theory_map(define (binding, hd regexp)) \ - -ML\ -val DOF_core.Onto_Class S = (DOF_core.get_onto_class_global' "article" @{theory}); - val regexp = #rex S - val binding = #name S \ - -setup\Named_Target.theory_map(define (binding, hd regexp)) \ - -find_theorems (500) name:report_rexp -thm article_def report_def title_def subtitle_def introduction_def +ML\ val DOF_core.Onto_Class S = (DOF_core.get_onto_class_global' "report" @{theory}) \ +setup\Named_Target.theory_map(define (#name S, hd (#rex S))) \ + + +ML\ val DOF_core.Onto_Class S = (DOF_core.get_onto_class_global' "article" @{theory}) \ +setup\Named_Target.theory_map(define (#name S, hd (#rex S))) \ + + +(* switch on regexp syntax *) notation Star ("\(_)\\<^sup>*" [0]100) notation Plus (infixr "||" 55) notation Times (infixr "~~" 60) notation Atom ("\_\" 65) -lemma regexp_seq_mono : - "Lang(a) \ Lang (a') \ Lang(b) \ Lang (b') \ Lang(a ~~ b) \ Lang(a' ~~ b')" - by auto +lemma regexp_seq_mono: + "Lang(a) \ Lang (a') \ Lang(b) \ Lang (b') \ Lang(a ~~ b) \ Lang(a' ~~ b')" by auto lemma regexp_unit_right : "Lang (a) = Lang (a ~~ One) " by simp lemma regexp_unit_left : "Lang (a) = Lang (One ~~ a) " by simp lemma opt_star_incl :"Lang (opt a) \ Lang (Star a)" by (simp add: opt_def subset_iff) -lemma rep1_star_incl:"Lang (rep1 a) \ Lang (Star a)" - unfolding rep1_def by(subst L_Star, subst L_Conc)(force) -lemma cancel_rep1 : "Lang (a) \ Lang (rep1 a)" - unfolding rep1_def by auto +lemma rep1_star_incl:"Lang (rep1 a) \ Lang (Star a)" + unfolding rep1_def by(subst L_Star, subst L_Conc)(force) + +lemma cancel_rep1 : "Lang (a) \ Lang (rep1 a)" + unfolding rep1_def by auto lemma seq_cancel_opt : "Lang (a) \ Lang (c) \ Lang (a) \ Lang (opt b ~~ c)" by(subst regexp_unit_left, rule regexp_seq_mono)(simp_all add: opt_def) @@ -170,4 +163,5 @@ theorem articles_sub_reports: \(Lang article_monitor) \ Lang rep done + end