# HG changeset patch # User haftmann # Date 1554829140 0 # Node ID 70841633b3e181302fdd8e2084530eae39f458d8 # Parent 10fe23659be3f7303ae2144ad0fd4b10d6604e02 some more explicit document structure diff -r 10fe23659be3 -r 70841633b3e1 src/HOL/Decision_Procs/Cooper.thy --- a/src/HOL/Decision_Procs/Cooper.thy Tue Apr 09 15:31:14 2019 +0100 +++ b/src/HOL/Decision_Procs/Cooper.thy Tue Apr 09 16:59:00 2019 +0000 @@ -2,15 +2,15 @@ Author: Amine Chaieb *) +section \Presburger arithmetic based on Cooper's algorithm\ + theory Cooper imports Complex_Main "HOL-Library.Code_Target_Numeral" begin -section \Periodicity of \dvd\\ - -subsection \Shadow syntax and semantics\ +subsection \Basic formulae\ datatype (plugins del: size) num = C int | Bound nat | CN nat int num | Neg num | Add num num | Sub num num @@ -146,7 +146,7 @@ | "qfree p \ True" -text \Boundedness and substitution\ +subsection \Boundedness and substitution\ primrec numbound0 :: "num \ bool" \ \a \num\ is \<^emph>\independent\ of Bound 0\ where @@ -418,7 +418,7 @@ qed -text \Simplification\ +subsection \Simplification\ text \Algebraic simplifications for nums\ @@ -819,7 +819,9 @@ apply (case_tac "simpnum a", auto)+ done -text \Generic quantifier elimination\ + +subsection \Generic quantifier elimination\ + fun qelim :: "fm \ (fm \ fm) \ fm" where "qelim (E p) = (\qe. DJ qe (qelim p qe))" @@ -2249,7 +2251,7 @@ qed -text \Cooper's Algorithm\ +subsection \Cooper's Algorithm\ definition cooper :: "fm \ fm" where @@ -2371,16 +2373,8 @@ theorem mirqe: "Ifm bbs bs (pa p) = Ifm bbs bs p \ qfree (pa p)" using qelim_ci cooper prep by (auto simp add: pa_def) -definition cooper_test :: "unit \ fm" - where "cooper_test u = - pa (E (A (Imp (Ge (Sub (Bound 0) (Bound 1))) - (E (E (Eq (Sub (Add (Mul 3 (Bound 1)) (Mul 5 (Bound 0))) (Bound 2))))))))" -ML_val \@{code cooper_test} ()\ - -(*code_reflect Cooper_Procedure - functions pa T Bound nat_of_integer integer_of_nat int_of_integer integer_of_int - file "~~/src/HOL/Tools/Qelim/cooper_procedure.ML"*) +subsection \Setup\ oracle linzqe_oracle = \ let @@ -2535,7 +2529,7 @@ \ "decision procedure for linear integer arithmetic" -text \Tests\ +subsection \Tests\ lemma "\(j::int). \x\j. \a b. x = 3*a+5*b" by cooper @@ -2666,4 +2660,11 @@ theorem "(\m::nat. n = 2 * m) \ (n + 1) div 2 = n div 2" by cooper + +subsection \Variant for HOL-Main\ + +-(*code_reflect Cooper_Procedure +- functions pa T Bound nat_of_integer integer_of_nat int_of_integer integer_of_int +- file "~~/src/HOL/Tools/Qelim/cooper_procedure.ML"*) + end