diff -r 6e2479089226 -r cecd7a941885 ProgTutorial/Package/Ind_Extensions.thy --- a/ProgTutorial/Package/Ind_Extensions.thy Tue May 14 16:59:53 2019 +0200 +++ b/ProgTutorial/Package/Ind_Extensions.thy Tue May 14 17:10:47 2019 +0200 @@ -2,7 +2,7 @@ imports Simple_Inductive_Package Ind_Intro begin -section {* Extensions of the Package (TBD) *} +section \Extensions of the Package (TBD)\ (* text {* @@ -29,7 +29,7 @@ *} *) -text {* +text \ Things to include at the end: \begin{itemize} @@ -39,7 +39,7 @@ \item say something about the two interfaces for calling packages \end{itemize} -*} +\ (* simple_inductive @@ -129,32 +129,32 @@ accpartI: "(\y. R y x \ accpart'' R y) \ accpart'' R x" *) -text {* +text \ \begin{exercise} In Section~\ref{sec:nutshell} we required that introduction rules must be of the form \begin{isabelle} - @{text "rule ::= \xs. As \ (\ys. Bs \ pred ss)\<^sup>* \ pred ts"} + \rule ::= \xs. As \ (\ys. Bs \ pred ss)\<^sup>* \ pred ts\ \end{isabelle} - where the @{text "As"} and @{text "Bs"} can be any collection of formulae - not containing the @{text "preds"}. This requirement is important, + where the \As\ and \Bs\ can be any collection of formulae + not containing the \preds\. This requirement is important, because if violated, the theory behind the inductive package does not work and also the proofs break. Write code that tests whether the introduction rules given by the user fit into the scheme described above. Hint: It is not important in which order the premises ar given; the - @{text "As"} and @{text "(\ys. Bs \ pred ss)"} premises can occur + \As\ and \(\ys. Bs \ pred ss)\ premises can occur in any order. \end{exercise} -*} +\ -text_raw {* +text_raw \ \begin{exercise} - If you define @{text even} and @{text odd} with the standard inductive + If you define \even\ and \odd\ with the standard inductive package \begin{isabelle} -*} +\ inductive even_2 and odd_2 where @@ -162,11 +162,11 @@ | evenS_2: "odd_2 m \ even_2 (Suc m)" | oddS_2: "even_2 m \ odd_2 (Suc m)" -text_raw{* +text_raw\ \end{isabelle} - you will see that the generated induction principle for @{text "even'"} (namely - @{text "even_2_odd_2.inducts"} has the additional assumptions + you will see that the generated induction principle for \even'\ (namely + \even_2_odd_2.inducts\ has the additional assumptions @{prop "odd_2 m"} and @{prop "even_2 m"} in the recursive cases. These additional assumptions can sometimes make ``life easier'' in proofs. Since more assumptions can be made when proving properties, these induction principles @@ -186,29 +186,29 @@ provides a richer reasoning infrastructure. The code of this package can be found in @{ML_file "HOL/Tools/inductive.ML"}. \end{readmore} -*} +\ -section {* Definitional Packages *} +section \Definitional Packages\ -text {* Type declarations *} +text \Type declarations\ (* ML %grayML{*Typedef.add_typedef_global (@{binding test}, [], NoSyn) @{term "{1}::nat set"} NONE (simp_tac @{context} 1) @{theory} *} *) -ML %grayML{*fun pat_completeness_auto ctxt = +ML %grayML\fun pat_completeness_auto ctxt = Pat_Completeness.pat_completeness_tac ctxt 1 - THEN auto_tac ctxt*} + THEN auto_tac ctxt\ -ML {* +ML \ val conf = Function_Common.default_config -*} +\ datatype foo = Foo nat -local_setup{*Function.add_function [(@{binding "baz"}, NONE, NoSyn)] +local_setup\Function.add_function [(@{binding "baz"}, NONE, NoSyn)] [((Binding.empty_atts,@{term "\x. baz (Foo x) = x"}),[],[])] - conf pat_completeness_auto #> snd*} + conf pat_completeness_auto #> snd\ (*<*)end(*>*)