# HG changeset patch # User haftmann # Date 1236757557 -3600 # Node ID aad3cd70e25a2f5f298ad004c6425da76735271e # Parent 699afca335277d9b7cf3eff68e71e13c20c81db2# Parent 836b71e950b52c7be9b62c0ae47872d00c53633e merged diff -r 699afca33527 -r aad3cd70e25a src/HOL/Code_Eval.thy --- a/src/HOL/Code_Eval.thy Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/Code_Eval.thy Wed Mar 11 08:45:57 2009 +0100 @@ -134,6 +134,10 @@ lemma [code, code del]: "(term_of \ typerep \ term) = term_of" .. lemma [code, code del]: "(term_of \ term \ term) = term_of" .. lemma [code, code del]: "(term_of \ message_string \ term) = term_of" .. +lemma [code, code del]: + "(Code_Eval.term_of \ 'a::{type, term_of} Predicate.pred \ Code_Eval.term) = Code_Eval.term_of" .. +lemma [code, code del]: + "(Code_Eval.term_of \ 'a::{type, term_of} Predicate.seq \ Code_Eval.term) = Code_Eval.term_of" .. lemma term_of_char [unfolded typerep_fun_def typerep_char_def typerep_nibble_def, code]: "Code_Eval.term_of c = (let (n, m) = nibble_pair_of_char c diff -r 699afca33527 -r aad3cd70e25a src/HOL/Decision_Procs/Decision_Procs.thy --- a/src/HOL/Decision_Procs/Decision_Procs.thy Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/Decision_Procs/Decision_Procs.thy Wed Mar 11 08:45:57 2009 +0100 @@ -1,5 +1,7 @@ +header {* Various decision procedures. typically involving reflection *} + theory Decision_Procs -imports Cooper Ferrack MIR Approximation Dense_Linear_Order +imports Cooper Ferrack MIR Approximation Dense_Linear_Order "ex/Approximation_Ex" "ex/Dense_Linear_Order_Ex" begin end \ No newline at end of file diff -r 699afca33527 -r aad3cd70e25a src/HOL/Decision_Procs/ex/Approximation_Ex.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Decision_Procs/ex/Approximation_Ex.thy Wed Mar 11 08:45:57 2009 +0100 @@ -0,0 +1,52 @@ +(* Title: HOL/ex/ApproximationEx.thy + Author: Johannes Hoelzl 2009 +*) + +theory Approximation_Ex +imports Complex_Main "~~/src/HOL/Decision_Procs/Approximation" +begin + +text {* + +Here are some examples how to use the approximation method. + +The parameter passed to the method specifies the precision used by the computations, it is specified +as number of bits to calculate. When a variable is used it needs to be bounded by an interval. This +interval is specified as a conjunction of the lower and upper bound. It must have the form +@{text "\ l\<^isub>1 \ x\<^isub>1 \ x\<^isub>1 \ u\<^isub>1 ; \ ; l\<^isub>n \ x\<^isub>n \ x\<^isub>n \ u\<^isub>n \ \ F"} where @{term F} is the formula, and +@{text "x\<^isub>1, \, x\<^isub>n"} are the variables. The lower bounds @{text "l\<^isub>1, \, l\<^isub>n"} and the upper bounds +@{text "u\<^isub>1, \, u\<^isub>n"} must either be integer numerals, floating point numbers or of the form +@{term "m * pow2 e"} to specify a exact floating point value. + +*} + +section "Compute some transcendental values" + +lemma "\ ln 2 - 544531980202654583340825686620847 / 785593587443817081832229725798400 \ < inverse (2^51) " + by (approximation 80) + +lemma "\ exp 1.626 - 5.083499996273 \ < (inverse 10 ^ 10 :: real)" + by (approximation 80) + +lemma "\ sqrt 2 - 1.4142135623730951 \ < inverse 10 ^ 16" + by (approximation 80) + +lemma "\ pi - 3.1415926535897932385 \ < inverse 10 ^ 18" + by (approximation 80) + +section "Use variable ranges" + +lemma "0.5 \ x \ x \ 4.5 \ \ arctan x - 0.91 \ < 0.455" + by (approximation 10) + +lemma "0.49 \ x \ x \ 4.49 \ \ arctan x - 0.91 \ < 0.455" + by (approximation 20) + +lemma "1 * pow2 -1 \ x \ x \ 9 * pow2 -1 \ \ arctan x - 0.91 \ < 0.455" + by (approximation 10) + +lemma "0 \ x \ x \ 1 \ 0 \ sin x" + by (approximation 10) + +end + diff -r 699afca33527 -r aad3cd70e25a src/HOL/Decision_Procs/ex/Dense_Linear_Order_Ex.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Decision_Procs/ex/Dense_Linear_Order_Ex.thy Wed Mar 11 08:45:57 2009 +0100 @@ -0,0 +1,153 @@ +(* Author: Amine Chaieb, TU Muenchen *) + +header {* Examples for Ferrante and Rackoff's quantifier elimination procedure *} + +theory Dense_Linear_Order_Ex +imports Complex_Main "~~/src/HOL/Decision_Procs/Dense_Linear_Order" +begin + +lemma + "\(y::'a::{ordered_field,recpower,number_ring, division_by_zero}) <2. x + 3* y < 0 \ x - y >0" + by ferrack + +lemma "~ (ALL x (y::'a::{ordered_field,recpower,number_ring, division_by_zero}). x < y --> 10*x < 11*y)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x < y --> (10*(x + 5*y + -1) < 60*y)" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x ~= y --> x < y" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (x ~= y & 10*x ~= 9*y & 10*x < y) --> x < y" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (x ~= y & 5*x <= y) --> 500*x <= 100*y" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX (y::'a::{ordered_field,recpower,number_ring, division_by_zero}). 4*x + 3*y <= 0 & 4*x + 3*y >= -1)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) < 0. (EX (y::'a::{ordered_field,recpower,number_ring, division_by_zero}) > 0. 7*x + y > 0 & x - y <= 9)" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (0 < x & x < 1) --> (ALL y > 1. x + y ~= 1)" + by ferrack + +lemma "EX x. (ALL (y::'a::{ordered_field,recpower,number_ring, division_by_zero}). y < 2 --> 2*(y - x) \ 0 )" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). x < 10 | x > 20 | (EX y. y>= 0 & y <= 10 & x+y = 20)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. x + y < z --> y >= z --> x < 0" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. x + 7*y < 5* z & 5*y >= 7*z & x < 0" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. abs (x + y) <= z --> (abs z = z)" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. x + 7*y - 5* z < 0 & 5*y + 7*z + 3*x < 0" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. (abs (5*x+3*y+z) <= 5*x+3*y+z & abs (5*x+3*y+z) >= - (5*x+3*y+z)) | (abs (5*x+3*y+z) >= 5*x+3*y+z & abs (5*x+3*y+z) <= - (5*x+3*y+z))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x < y --> (EX z>0. x+z = y)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x < y --> (EX z>0. x+z = y)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX z>0. abs (x - y) <= z )" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (ALL z>=0. abs (3*x+7*y) <= 2*z + 1)" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero})>0. (ALL y. (EX z. 13* abs z \ abs (12*y - x) & 5*x - 3*(abs y) <= 7*z))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). abs (4*x + 17) < 4 & (ALL y . abs (x*34 - 34*y - 9) \ 0 \ (EX z. 5*x - 3*abs y <= 7*z))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y > abs (23*x - 9). (ALL z > abs (3*y - 19* abs x). x+z > 2*y))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y< abs (3*x - 1). (ALL z >= (3*abs x - 1). abs (12*x - 13*y + 19*z) > abs (23*x) ))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). abs x < 100 & (ALL y > x. (EX z<2*y - x. 5*x - 3*y <= 7*z))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. 7*x<3*y --> 5*y < 7*z --> z < 2*w --> 7*(2*w-x) > 2*y" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. 5*x + 3*z - 17*w + abs (y - 8*x + z) <= 89" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. 5*x + 3*z - 17*w + 7* (y - 8*x + z) <= max y (7*z - x + w)" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. (EX w >= (x+y+z). w <= abs x + abs y + abs z)" + by ferrack + +lemma "~(ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y z w. 3* x + z*4 = 3*y & x + y < z & x> w & 3*x < w + y))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX z w. abs (x-y) = (z-w) & z*1234 < 233*x & w ~= y)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. (ALL w >= abs (x+y+z). w >= abs x + abs y + abs z)" + by ferrack + +lemma "EX z. (ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX w >= (x+y+z). w <= abs x + abs y + abs z))" + by ferrack + +lemma "EX z. (ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) < abs z. (EX y w. x< y & x < z & x> w & 3*x < w + y))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX z. (ALL w. abs (x-y) = abs (z-w) --> z < x & w ~= y))" + by ferrack + +lemma "EX y. (ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) z. (ALL w >= 13*x - 4*z. (EX y. w >= abs x + abs y + z))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (ALL y < x. (EX z > (x+y). + (ALL w. 5*w + 10*x - z >= y --> w + 7*x + 3*z >= 2*y)))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (ALL y. (EX z > y. + (ALL w . w < 13 --> w + 10*x - z >= y --> 5*w + 7*x + 13*z >= 2*y)))" + by ferrack + +lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (y - x) < w)))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (x + z) < w - y)))" + by ferrack + +lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y. abs y ~= abs x & (ALL z> max x y. (EX w. w ~= y & w ~= z & 3*w - z >= x + y)))" + by ferrack + +end diff -r 699afca33527 -r aad3cd70e25a src/HOL/FunDef.thy --- a/src/HOL/FunDef.thy Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/FunDef.thy Wed Mar 11 08:45:57 2009 +0100 @@ -225,10 +225,10 @@ subsection {* Concrete orders for SCNP termination proofs *} definition "pair_less = less_than <*lex*> less_than" -definition "pair_leq = pair_less^=" +definition [code del]: "pair_leq = pair_less^=" definition "max_strict = max_ext pair_less" -definition "max_weak = max_ext pair_leq \ {({}, {})}" -definition "min_strict = min_ext pair_less" +definition [code del]: "max_weak = max_ext pair_leq \ {({}, {})}" +definition [code del]: "min_strict = min_ext pair_less" definition "min_weak = min_ext pair_leq \ {({}, {})}" lemma wf_pair_less[simp]: "wf pair_less" diff -r 699afca33527 -r aad3cd70e25a src/HOL/IsaMakefile --- a/src/HOL/IsaMakefile Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/IsaMakefile Wed Mar 11 08:45:57 2009 +0100 @@ -680,6 +680,8 @@ Decision_Procs/MIR.thy \ Decision_Procs/mir_tac.ML \ Decision_Procs/Decision_Procs.thy \ + Decision_Procs/ex/Dense_Linear_Order_Ex.thy \ + Decision_Procs/ex/Approximation_Ex.thy \ Decision_Procs/ROOT.ML @$(ISABELLE_TOOL) usedir $(OUT)/HOL Decision_Procs @@ -823,13 +825,13 @@ $(LOG)/HOL-ex.gz: $(OUT)/HOL Library/Commutative_Ring.thy \ Library/Primes.thy ex/Abstract_NAT.thy ex/Antiquote.thy \ - ex/ApproximationEx.thy ex/Arith_Examples.thy \ + ex/Arith_Examples.thy \ ex/Arithmetic_Series_Complex.thy ex/BT.thy ex/BinEx.thy \ ex/Binary.thy ex/CTL.thy ex/Chinese.thy ex/Classical.thy \ ex/CodegenSML_Test.thy ex/Codegenerator.thy \ ex/Codegenerator_Pretty.thy ex/Coherent.thy \ ex/Commutative_RingEx.thy ex/Commutative_Ring_Complete.thy \ - ex/Dense_Linear_Order_Ex.thy ex/Efficient_Nat_examples.thy \ + ex/Efficient_Nat_examples.thy \ ex/Eval_Examples.thy ex/ExecutableContent.thy \ ex/Formal_Power_Series_Examples.thy ex/Fundefs.thy \ ex/Groebner_Examples.thy ex/Guess.thy ex/HarmonicSeries.thy \ diff -r 699afca33527 -r aad3cd70e25a src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/Library/Multiset.thy Wed Mar 11 08:45:57 2009 +0100 @@ -1487,7 +1487,7 @@ by auto definition "ms_strict = mult pair_less" -definition "ms_weak = ms_strict \ Id" +definition [code del]: "ms_weak = ms_strict \ Id" lemma ms_reduction_pair: "reduction_pair (ms_strict, ms_weak)" unfolding reduction_pair_def ms_strict_def ms_weak_def pair_less_def diff -r 699afca33527 -r aad3cd70e25a src/HOL/Predicate.thy --- a/src/HOL/Predicate.thy Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/Predicate.thy Wed Mar 11 08:45:57 2009 +0100 @@ -588,7 +588,39 @@ by (simp add: adjunct_sup sup_assoc sup_commute sup_left_commute) qed -declare eq_pred_def [code, code del] +primrec contained :: "'a seq \ 'a pred \ bool" where + "contained Empty Q \ True" + | "contained (Insert x P) Q \ eval Q x \ P \ Q" + | "contained (Join P xq) Q \ P \ Q \ contained xq Q" + +lemma single_less_eq_eval: + "single x \ P \ eval P x" + by (auto simp add: single_def less_eq_pred_def mem_def) + +lemma contained_less_eq: + "contained xq Q \ pred_of_seq xq \ Q" + by (induct xq) (simp_all add: single_less_eq_eval) + +lemma less_eq_pred_code [code]: + "Seq f \ Q = (case f () + of Empty \ True + | Insert x P \ eval Q x \ P \ Q + | Join P xq \ P \ Q \ contained xq Q)" + by (cases "f ()") + (simp_all add: Seq_def single_less_eq_eval contained_less_eq) + +lemma eq_pred_code [code]: + fixes P Q :: "'a::eq pred" + shows "eq_class.eq P Q \ P \ Q \ Q \ P" + unfolding eq by auto + +lemma [code]: + "pred_case f P = f (eval P)" + by (cases P) simp + +lemma [code]: + "pred_rec f P = f (eval P)" + by (cases P) simp no_notation inf (infixl "\" 70) and @@ -601,6 +633,6 @@ hide (open) type pred seq hide (open) const Pred eval single bind if_pred not_pred - Empty Insert Join Seq member "apply" adjunct + Empty Insert Join Seq member pred_of_seq "apply" adjunct end diff -r 699afca33527 -r aad3cd70e25a src/HOL/Tools/datatype_package.ML --- a/src/HOL/Tools/datatype_package.ML Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/Tools/datatype_package.ML Wed Mar 11 08:45:57 2009 +0100 @@ -677,15 +677,14 @@ val thy = ProofContext.theory_of ctxt; val (vs, cos) = the_datatype_spec thy dtco; val ty = Type (dtco, map TFree vs); - fun pretty_typ_br ty = - let - val p = Syntax.pretty_typ ctxt ty; - val s = explode (Pretty.str_of p); (* FIXME do not inspect pretty output! *) - in if member (op =) s " " then Pretty.enclose "(" ")" [p] else p end; + fun pretty_typ_bracket (ty as Type (_, _ :: _)) = + Pretty.enclose "(" ")" [Syntax.pretty_typ ctxt ty] + | pretty_typ_bracket ty = + Syntax.pretty_typ ctxt ty; fun pretty_constr (co, tys) = (Pretty.block o Pretty.breaks) (Syntax.pretty_term ctxt (Const (co, tys ---> ty)) :: - map pretty_typ_br tys); + map pretty_typ_bracket tys); val pretty_datatype = Pretty.block (Pretty.command "datatype" :: Pretty.brk 1 :: diff -r 699afca33527 -r aad3cd70e25a src/HOL/Wellfounded.thy --- a/src/HOL/Wellfounded.thy Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/Wellfounded.thy Wed Mar 11 08:45:57 2009 +0100 @@ -960,4 +960,10 @@ declare "prod.size" [noatp] +lemma [code]: + "size (P :: 'a Predicate.pred) = 0" by (cases P) simp + +lemma [code]: + "pred_size f P = 0" by (cases P) simp + end diff -r 699afca33527 -r aad3cd70e25a src/HOL/ex/ApproximationEx.thy --- a/src/HOL/ex/ApproximationEx.thy Tue Mar 10 22:50:19 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -(* Title: HOL/ex/ApproximationEx.thy - Author: Johannes Hoelzl 2009 -*) - -theory ApproximationEx -imports "~~/src/HOL/Decision_Procs/Approximation" -begin - -text {* - -Here are some examples how to use the approximation method. - -The parameter passed to the method specifies the precision used by the computations, it is specified -as number of bits to calculate. When a variable is used it needs to be bounded by an interval. This -interval is specified as a conjunction of the lower and upper bound. It must have the form -@{text "\ l\<^isub>1 \ x\<^isub>1 \ x\<^isub>1 \ u\<^isub>1 ; \ ; l\<^isub>n \ x\<^isub>n \ x\<^isub>n \ u\<^isub>n \ \ F"} where @{term F} is the formula, and -@{text "x\<^isub>1, \, x\<^isub>n"} are the variables. The lower bounds @{text "l\<^isub>1, \, l\<^isub>n"} and the upper bounds -@{text "u\<^isub>1, \, u\<^isub>n"} must either be integer numerals, floating point numbers or of the form -@{term "m * pow2 e"} to specify a exact floating point value. - -*} - -section "Compute some transcendental values" - -lemma "\ ln 2 - 544531980202654583340825686620847 / 785593587443817081832229725798400 \ < inverse (2^51) " - by (approximation 80) - -lemma "\ exp 1.626 - 5.083499996273 \ < (inverse 10 ^ 10 :: real)" - by (approximation 80) - -lemma "\ sqrt 2 - 1.4142135623730951 \ < inverse 10 ^ 16" - by (approximation 80) - -lemma "\ pi - 3.1415926535897932385 \ < inverse 10 ^ 18" - by (approximation 80) - -section "Use variable ranges" - -lemma "0.5 \ x \ x \ 4.5 \ \ arctan x - 0.91 \ < 0.455" - by (approximation 10) - -lemma "0.49 \ x \ x \ 4.49 \ \ arctan x - 0.91 \ < 0.455" - by (approximation 20) - -lemma "1 * pow2 -1 \ x \ x \ 9 * pow2 -1 \ \ arctan x - 0.91 \ < 0.455" - by (approximation 10) - -lemma "0 \ x \ x \ 1 \ 0 \ sin x" - by (approximation 10) - -end - diff -r 699afca33527 -r aad3cd70e25a src/HOL/ex/Dense_Linear_Order_Ex.thy --- a/src/HOL/ex/Dense_Linear_Order_Ex.thy Tue Mar 10 22:50:19 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -(* Author: Amine Chaieb, TU Muenchen *) - -header {* Examples for Ferrante and Rackoff's quantifier elimination procedure *} - -theory Dense_Linear_Order_Ex -imports "~~/src/HOL/Decision_Procs/Dense_Linear_Order" Main -begin - -lemma - "\(y::'a::{ordered_field,recpower,number_ring, division_by_zero}) <2. x + 3* y < 0 \ x - y >0" - by ferrack - -lemma "~ (ALL x (y::'a::{ordered_field,recpower,number_ring, division_by_zero}). x < y --> 10*x < 11*y)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x < y --> (10*(x + 5*y + -1) < 60*y)" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x ~= y --> x < y" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (x ~= y & 10*x ~= 9*y & 10*x < y) --> x < y" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (x ~= y & 5*x <= y) --> 500*x <= 100*y" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX (y::'a::{ordered_field,recpower,number_ring, division_by_zero}). 4*x + 3*y <= 0 & 4*x + 3*y >= -1)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) < 0. (EX (y::'a::{ordered_field,recpower,number_ring, division_by_zero}) > 0. 7*x + y > 0 & x - y <= 9)" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (0 < x & x < 1) --> (ALL y > 1. x + y ~= 1)" - by ferrack - -lemma "EX x. (ALL (y::'a::{ordered_field,recpower,number_ring, division_by_zero}). y < 2 --> 2*(y - x) \ 0 )" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). x < 10 | x > 20 | (EX y. y>= 0 & y <= 10 & x+y = 20)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. x + y < z --> y >= z --> x < 0" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. x + 7*y < 5* z & 5*y >= 7*z & x < 0" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. abs (x + y) <= z --> (abs z = z)" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. x + 7*y - 5* z < 0 & 5*y + 7*z + 3*x < 0" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. (abs (5*x+3*y+z) <= 5*x+3*y+z & abs (5*x+3*y+z) >= - (5*x+3*y+z)) | (abs (5*x+3*y+z) >= 5*x+3*y+z & abs (5*x+3*y+z) <= - (5*x+3*y+z))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x < y --> (EX z>0. x+z = y)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. x < y --> (EX z>0. x+z = y)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX z>0. abs (x - y) <= z )" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (ALL z>=0. abs (3*x+7*y) <= 2*z + 1)" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (ALL z<0. (z < x --> z <= y) & (z > y --> z >= x))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero})>0. (ALL y. (EX z. 13* abs z \ abs (12*y - x) & 5*x - 3*(abs y) <= 7*z))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). abs (4*x + 17) < 4 & (ALL y . abs (x*34 - 34*y - 9) \ 0 \ (EX z. 5*x - 3*abs y <= 7*z))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y > abs (23*x - 9). (ALL z > abs (3*y - 19* abs x). x+z > 2*y))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y< abs (3*x - 1). (ALL z >= (3*abs x - 1). abs (12*x - 13*y + 19*z) > abs (23*x) ))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). abs x < 100 & (ALL y > x. (EX z<2*y - x. 5*x - 3*y <= 7*z))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. 7*x<3*y --> 5*y < 7*z --> z < 2*w --> 7*(2*w-x) > 2*y" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. 5*x + 3*z - 17*w + abs (y - 8*x + z) <= 89" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. 5*x + 3*z - 17*w + 7* (y - 8*x + z) <= max y (7*z - x + w)" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. (EX w >= (x+y+z). w <= abs x + abs y + abs z)" - by ferrack - -lemma "~(ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y z w. 3* x + z*4 = 3*y & x + y < z & x> w & 3*x < w + y))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX z w. abs (x-y) = (z-w) & z*1234 < 233*x & w ~= y)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z. (ALL w >= abs (x+y+z). w >= abs x + abs y + abs z)" - by ferrack - -lemma "EX z. (ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX w >= (x+y+z). w <= abs x + abs y + abs z))" - by ferrack - -lemma "EX z. (ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) < abs z. (EX y w. x< y & x < z & x> w & 3*x < w + y))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y. (EX z. (ALL w. abs (x-y) = abs (z-w) --> z < x & w ~= y))" - by ferrack - -lemma "EX y. (ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) z. (ALL w >= 13*x - 4*z. (EX y. w >= abs x + abs y + z))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (ALL y < x. (EX z > (x+y). - (ALL w. 5*w + 10*x - z >= y --> w + 7*x + 3*z >= 2*y)))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (ALL y. (EX z > y. - (ALL w . w < 13 --> w + 10*x - z >= y --> 5*w + 7*x + 13*z >= 2*y)))" - by ferrack - -lemma "EX (x::'a::{ordered_field,recpower,number_ring, division_by_zero}) y z w. min (5*x + 3*z) (17*w) + 5* abs (y - 8*x + z) <= max y (7*z - x + w)" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (y - x) < w)))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y. (ALL z>19. y <= x + z & (EX w. abs (x + z) < w - y)))" - by ferrack - -lemma "ALL (x::'a::{ordered_field,recpower,number_ring, division_by_zero}). (EX y. abs y ~= abs x & (ALL z> max x y. (EX w. w ~= y & w ~= z & 3*w - z >= x + y)))" - by ferrack - -end diff -r 699afca33527 -r aad3cd70e25a src/HOL/ex/ExecutableContent.thy --- a/src/HOL/ex/ExecutableContent.thy Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/ex/ExecutableContent.thy Wed Mar 11 08:45:57 2009 +0100 @@ -24,24 +24,6 @@ "~~/src/HOL/ex/Records" begin -lemma [code, code del]: - "(size :: 'a::size Predicate.pred => nat) = size" .. -lemma [code, code del]: - "pred_size = pred_size" .. -lemma [code, code del]: - "pred_case = pred_case" .. -lemma [code, code del]: - "pred_rec = pred_rec" .. -lemma [code, code del]: - "(Code_Eval.term_of \ 'a::{type, term_of} Predicate.pred \ Code_Eval.term) = Code_Eval.term_of" .. -lemma [code, code del]: - "(Code_Eval.term_of \ 'a::{type, term_of} Predicate.seq \ Code_Eval.term) = Code_Eval.term_of" .. - -text {* However, some aren't executable *} - -declare pair_leq_def[code del] -declare max_weak_def[code del] -declare min_weak_def[code del] -declare ms_weak_def[code del] +declare min_weak_def [code del] end diff -r 699afca33527 -r aad3cd70e25a src/HOL/ex/ROOT.ML --- a/src/HOL/ex/ROOT.ML Tue Mar 10 22:50:19 2009 +0100 +++ b/src/HOL/ex/ROOT.ML Wed Mar 11 08:45:57 2009 +0100 @@ -60,7 +60,6 @@ "Code_Antiq", "Termination", "Coherent", - "Dense_Linear_Order_Ex", "PresburgerEx", "ReflectionEx", "BinEx",