diff -r 143f58bb34f9 -r 0909deb8059b src/HOL/Nitpick_Examples/Manual_Nits.thy --- a/src/HOL/Nitpick_Examples/Manual_Nits.thy Thu May 26 16:57:14 2016 +0200 +++ b/src/HOL/Nitpick_Examples/Manual_Nits.thy Thu May 26 17:51:22 2016 +0200 @@ -5,7 +5,7 @@ Examples from the Nitpick manual. *) -section {* Examples from the Nitpick Manual *} +section \Examples from the Nitpick Manual\ (* The "expect" arguments to Nitpick in this theory and the other example theories are there so that the example can also serve as a regression test @@ -15,12 +15,12 @@ imports Real "~~/src/HOL/Library/Quotient_Product" begin -section {* 2. First Steps *} +section \2. First Steps\ nitpick_params [sat_solver = MiniSat_JNI, max_threads = 1, timeout = 240] -subsection {* 2.1. Propositional Logic *} +subsection \2.1. Propositional Logic\ lemma "P \ Q" nitpick [expect = genuine] @@ -30,14 +30,14 @@ oops -subsection {* 2.2. Type Variables *} +subsection \2.2. Type Variables\ lemma "x \ A \ (THE y. y \ A) \ A" nitpick [verbose, expect = genuine] oops -subsection {* 2.3. Constants *} +subsection \2.3. Constants\ lemma "x \ A \ (THE y. y \ A) \ A" nitpick [show_consts, expect = genuine] @@ -51,7 +51,7 @@ by (metis the_equality) -subsection {* 2.4. Skolemization *} +subsection \2.4. Skolemization\ lemma "\g. \x. g (f x) = x \ \y. \x. y = f x" nitpick [expect = genuine] @@ -66,7 +66,7 @@ oops -subsection {* 2.5. Natural Numbers and Integers *} +subsection \2.5. Natural Numbers and Integers\ lemma "\i \ j; n \ (m::int)\ \ i * n + j * m \ i * m + j * n" nitpick [expect = genuine] @@ -87,7 +87,7 @@ oops -subsection {* 2.6. Inductive Datatypes *} +subsection \2.6. Inductive Datatypes\ lemma "hd (xs @ [y, y]) = hd xs" nitpick [expect = genuine] @@ -99,7 +99,7 @@ oops -subsection {* 2.7. Typedefs, Records, Rationals, and Reals *} +subsection \2.7. Typedefs, Records, Rationals, and Reals\ definition "three = {0::nat, 1, 2}" typedef three = three @@ -129,16 +129,16 @@ nitpick [show_types, expect = genuine] oops -ML {* +ML \ fun my_int_postproc _ _ _ T (Const _ $ (Const _ $ t1 $ t2)) = HOLogic.mk_number T (snd (HOLogic.dest_number t1) - snd (HOLogic.dest_number t2)) | my_int_postproc _ _ _ _ t = t -*} +\ -declaration {* +declaration \ Nitpick_Model.register_term_postprocessor @{typ my_int} my_int_postproc -*} +\ lemma "add x y = add x x" nitpick [show_types] @@ -157,7 +157,7 @@ oops -subsection {* 2.8. Inductive and Coinductive Predicates *} +subsection \2.8. Inductive and Coinductive Predicates\ inductive even where "even 0" | @@ -200,7 +200,7 @@ oops -subsection {* 2.9. Coinductive Datatypes *} +subsection \2.9. Coinductive Datatypes\ codatatype 'a llist = LNil | LCons 'a "'a llist" @@ -221,7 +221,7 @@ sorry -subsection {* 2.10. Boxing *} +subsection \2.10. Boxing\ datatype tm = Var nat | Lam tm | App tm tm @@ -258,7 +258,7 @@ sorry -subsection {* 2.11. Scope Monotonicity *} +subsection \2.11. Scope Monotonicity\ lemma "length xs = length ys \ rev (zip xs ys) = zip xs (rev ys)" nitpick [verbose, expect = genuine] @@ -270,7 +270,7 @@ oops -subsection {* 2.12. Inductive Properties *} +subsection \2.12. Inductive Properties\ inductive_set reach where "(4::nat) \ reach" | @@ -299,12 +299,12 @@ by (induct set: reach) arith+ -section {* 3. Case Studies *} +section \3. Case Studies\ nitpick_params [max_potential = 0] -subsection {* 3.1. A Context-Free Grammar *} +subsection \3.1. A Context-Free Grammar\ datatype alphabet = a | b @@ -379,7 +379,7 @@ sorry -subsection {* 3.2. AA Trees *} +subsection \3.2. AA Trees\ datatype 'a aa_tree = \ | N "'a::linorder" nat "'a aa_tree" "'a aa_tree"