test/Tools/isac/Test_Isac.thy
author Walther Neuper <neuper@ist.tugraz.at>
Thu, 18 Jul 2013 14:26:49 +0200
changeset 52063 5d55c6c812aa
parent 48895 35751d90365e
child 52065 41f6e90abf36
child 52067 164befaaa9f9
permissions -rwxr-xr-x
GCD_Poly trials with naive Euclidean Algorithm

Interestingly, the Euclidan Algorithm works in Z[x], albeit with large numbers intermediately.
This suggests to replace the modular approach to Z[x] by the conceptionally much sipler Euclid,
since arbitrary-precision arithmetic is available.
     1 (* Title:  All tests on isac; observe outcommented
     2    Author: Walther Neuper 101001
     3    (c) copyright due to lincense terms.
     4 
     5 $ cd /usr/local/isabisac/test/Tools/isac
     6 $ /usr/local/isabisac/bin/isabelle jedit -l Isac Test_Isac.thy &
     7 *)
     8 
     9 theory Test_Isac imports "~~/src/Tools/isac/Build_Isac"
    10   "ADDTESTS/Ctxt"
    11   "ADDTESTS/test-depend/Build_Test"
    12   "ADDTESTS/All_Ctxt"
    13   "ADDTESTS/course/phst11/T1_Basics"
    14   "ADDTESTS/course/phst11/T2_Rewriting"
    15   "ADDTESTS/course/phst11/T3_MathEngine"
    16   "ADDTESTS/file-depend/Build_Test"
    17   "ADDTESTS/course/SignalProcess/Build_Inverse_Z_Transform"
    18   "../../Pure/Isar/Test_Parsers"
    19 (*"../../Pure/Isar/Pure/Isar/Struct_Deriv" update 2009-2-->2011*)
    20   "../../Pure/Isar/Test_Parse_Term"
    21 
    22 uses 
    23   (         "library.sml")
    24   (         "calcelems.sml")
    25   ("ProgLang/termC.sml")      
    26   ("ProgLang/calculate.sml")
    27   ("ProgLang/rewrite.sml")
    28   (*"ProgLang/listC.sml"*)
    29   ("ProgLang/scrtools.sml")
    30   ("ProgLang/tools.sml")
    31 
    32   ("Minisubpbl/000-comments.sml")
    33   ("Minisubpbl/100-init-rootpbl.sml")
    34   ("Minisubpbl/150-add-given.sml")
    35   ("Minisubpbl/200-start-method.sml")
    36   ("Minisubpbl/300-init-subpbl.sml")
    37   ("Minisubpbl/400-start-meth-subpbl.sml")
    38   ("Minisubpbl/490-nxt-Check_Postcond.sml")
    39   ("Minisubpbl/500-met-sub-to-root.sml")
    40   ("Minisubpbl/530-error-Check_Elementwise.sml")
    41   ("Minisubpbl/600-postcond.sml")
    42 
    43   ("Interpret/mstools.sml") 
    44   ("Interpret/ctree.sml")
    45   ("Interpret/ptyps.sml") 
    46   ("Interpret/generate.sml")
    47   ("Interpret/calchead.sml") 
    48   ("Interpret/appl.sml")
    49   ("Interpret/rewtools.sml") 
    50   ("Interpret/script.sml")
    51   ("Interpret/solve.sml") 
    52   ("Interpret/inform.sml")
    53   ("Interpret/mathengine.sml")
    54 
    55   ("xmlsrc/mathml.sml")
    56   ("xmlsrc/datatypes.sml")
    57   ("xmlsrc/pbl-met-hierarchy.sml")
    58   (*"xmlsrc/thy-hierarchy.sml"*)
    59   ("xmlsrc/interface-xml.sml")
    60 
    61   ("Frontend/messages.sml")
    62   ("Frontend/states.sml")
    63   ("Frontend/interface.sml")
    64   ("print_exn_G.sml")
    65 
    66   ("Knowledge/delete.sml")
    67   ("Knowledge/descript.sml")
    68   ("Knowledge/atools.sml")
    69   ("Knowledge/simplify.sml")
    70   ("Knowledge/poly.sml")
    71 (*THIS WAITS UNTIL Isabelle2013: ("Knowledge/gcd_poly.sml") ("Knowledge/gcd_poly_winkler.sml")
    72   IN THIS SEQUENCE: SEE Test_Some2.thy*)
    73   (*"Knowledge/rational.sml"*)
    74   ("Knowledge/equation.sml")
    75   ("Knowledge/root.sml")
    76   ("Knowledge/lineq.sml")
    77   (*"Knowledge/rooteq.sml"*)
    78   ("Knowledge/rateq.sml")
    79   ("Knowledge/rootrateq.sml")
    80   ("Knowledge/polyeq.sml")
    81   ("Knowledge/calculus.sml")
    82   ("Knowledge/trig.sml")
    83   (*"Knowledge/logexp.sml"*)
    84   ("Knowledge/diff.sml")
    85   ("Knowledge/integrate.sml")
    86   ("Knowledge/eqsystem.sml")
    87   ("Knowledge/test.sml")
    88   ("Knowledge/partial_fractions.sml")
    89   ("Knowledge/polyminus.sml")
    90   ("Knowledge/vect.sml")
    91   ("Knowledge/diffapp.sml")
    92   ("Knowledge/biegelinie.sml")
    93   ("Knowledge/algein.sml")
    94   ("Knowledge/diophanteq.sml")
    95   ("Knowledge/Inverse_Z_Transform/inverse_z_transform.sml")
    96   ("Knowledge/isac.sml")
    97   ("Knowledge/build_thydata.sml")
    98 
    99 begin
   100 section {* test ML Code of isac *}
   101   ML {*"%%%%%%%%%%%%%%%%% start ProgLang.thy %%%%%%%%%%%%%%%%%%%";*}
   102   use          "library.sml"
   103   use          "calcelems.sml"
   104   use "ProgLang/termC.sml"
   105   use "ProgLang/calculate.sml"
   106   use "ProgLang/rewrite.sml"
   107 (*use "ProgLang/listC.sml"            2002*)
   108   use "ProgLang/scrtools.sml"
   109   use "ProgLang/tools.sml"
   110   ML {*"%%%%%%%%%%%%%%%%% end ProgLang.thy %%%%%%%%%%%%%%%%%%%%%";*}
   111   ML {*"%%%%%%%%%%%%%%%%% start Minisubpbl %%%%%%%%%%%%%%%%%%%%%";*}
   112   use "Minisubpbl/000-comments.sml"
   113   use "Minisubpbl/100-init-rootpbl.sml"
   114   use "Minisubpbl/150-add-given.sml"
   115   use "Minisubpbl/200-start-method.sml"
   116   use "Minisubpbl/300-init-subpbl.sml"
   117   use "Minisubpbl/400-start-meth-subpbl.sml"
   118   use "Minisubpbl/490-nxt-Check_Postcond.sml"
   119   use "Minisubpbl/500-met-sub-to-root.sml"
   120   use "Minisubpbl/530-error-Check_Elementwise.sml"
   121   use "Minisubpbl/600-postcond.sml"
   122   ML {*"%%%%%%%%%%%%%%%%% end Minisubpbl.thy %%%%%%%%%%%%%%%%%%%%%%%";*}
   123   ML {*"%%%%%%%%%%%%%%%%% start Interpret.thy %%%%%%%%%%%%%%%%%%";*}
   124   use "Interpret/mstools.sml"
   125   use "Interpret/ctree.sml"         (*!...!see(25)*)
   126   use "Interpret/ptyps.sml"
   127   ML {* (*check_unsynchronized_ref (); ==== trick on error: CUT AND PASTE THIS LINE =========*) *}
   128 (*TRICK DOESN'T WORK: get_pbt not found: ["IsacKnowledge","Diff","Theorems","diff_sin_chain"]*)
   129   use "Interpret/generate.sml"
   130 (*WITHOUT inhibit exn WN1130621 Isabelle2012-->13 !thehier! THIS ERROR OCCURS:
   131   ... SAME ERROR HERE ON ISABELLE2012 AS IN ISAC ON ISABELLE2011*)
   132   use "Interpret/calchead.sml"
   133   use "Interpret/appl.sml"          (*complete "WEGEN INTERMED TESTCODE"                          *)
   134   use "Interpret/rewtools.sml"      (*complete, isac's Context broken at 2009-2 --> 2011, thehier!*)
   135   use "Interpret/script.sml"
   136   use "Interpret/solve.sml"
   137   use "Interpret/inform.sml"
   138 (*WITHOUT inhibit exn WN1130621 Isabelle2012-->13 !thehier! THIS ERROR OCCURS:
   139   ... SAME ERROR HERE ON ISABELLE2012 AS IN ISAC ON ISABELLE2011*)
   140   use "Interpret/mathengine.sml"    (*!part.*)
   141   ML {*"%%%%%%%%%%%%%%%%% end Interpret.thy %%%%%%%%%%%%%%%%%%%%";*}
   142   ML {*"%%%%%%%%%%%%%%%%% start xmlsrc.thy %%%%%%%%%%%%%%%%%%%%%";*}
   143   use "xmlsrc/mathml.sml"           (*part.*)
   144   use "xmlsrc/datatypes.sml"        (*TODO/part.*)
   145   use "xmlsrc/pbl-met-hierarchy.sml"(*TODO after 2009-2/part.*)
   146 (*use "xmlsrc/thy-hierarchy.sml"      TODO after 2009-2/part | Isabelle2012-->13 !thehier! *)
   147 (*WITHOUT inhibit exn WN1130621 Isabelle2012-->13 !thehier! THIS ERROR OCCURS:
   148 val it = "----------- ### thes2file ... Exception- Match raised -----------": string
   149 :
   150 val it = "~~~~~ fun thes2file, args:": string
   151 val p = "../../tmp/": path
   152 val it = (): unit
   153  exception Bind raised (line 359 of "~~/test/Tools/isac/xmlsrc/thy-hierarchy.sml")
   154                                                  ...CONCERNED WITH thehier
   155 *)
   156   use "xmlsrc/interface-xml.sml"     (*TODO after 2009-2*)
   157   ML {*"%%%%%%%%%%%%%%%%% end xmlsrc.thy %%%%%%%%%%%%%%%%%%%%%%%";*}
   158   ML {*"%%%%%%%%%%%%%%%%% start Frontend.thy %%%%%%%%%%%%%%%%%%%";*}
   159   use "Frontend/messages.sml"
   160   use "Frontend/states.sml"
   161   use "Frontend/interface.sml"
   162 (*WITHOUT inhibit exn WN1130621 Isabelle2012-->13 !thehier! THIS ERROR OCCURS:
   163   ... SAME ERROR HERE ON ISABELLE2012 AS IN ISAC ON ISABELLE2011*)
   164   use          "print_exn_G.sml"
   165   ML {*"%%%%%%%%%%%%%%%%% end Frontend.thy %%%%%%%%%%%%%%%%%%%%%";*}
   166   ML {*"%%%%%%%%%%%%%%%%% start Knowledge %%%%%%%%%%%%%%%%%%%%%%";*}
   167   use "Knowledge/delete.sml"
   168   use "Knowledge/descript.sml"
   169   use "Knowledge/atools.sml"
   170   use "Knowledge/simplify.sml"
   171   use "Knowledge/poly.sml"
   172 (*THIS WAITS UNTIL Isabelle2013 IN THIS SEQUENCE (SEE Test_Some2.thy):0
   173   use "Knowledge/gcd_poly.sml" (*type error 'nth' etc*)
   174   use "Knowledge/gcd_poly_winkler.sml"*)
   175 (*use "Knowledge/rational.sml"  WN120317.TODO postponed to joint work with dmeindl *)
   176   use "Knowledge/equation.sml"
   177   use "Knowledge/root.sml"
   178   use "Knowledge/lineq.sml"
   179 (*use "Knowledge/rooteq.sml"    some complicated equations not recovered from 2002 *)
   180   use "Knowledge/rateq.sml"   (*some complicated equations not recovered from 2002 *)
   181   use "Knowledge/rootrat.sml"
   182   use "Knowledge/rootrateq.sml"(*ome complicated equations not recovered from 2002 *)
   183   use "Knowledge/partial_fractions.sml"
   184   use "Knowledge/polyeq.sml"
   185 (*use "Knowledge/rlang.sml"     much to clean up, not urgent due to similar tests  *)
   186   use "Knowledge/calculus.sml"
   187   use "Knowledge/trig.sml"
   188 (*use "Knowledge/logexp.sml"    not included as stuff for presentation of authoring*) 
   189   use "Knowledge/diff.sml"
   190   use "Knowledge/integrate.sml"
   191   use "Knowledge/eqsystem.sml"
   192   use "Knowledge/test.sml"
   193   use "Knowledge/polyminus.sml"
   194   use "Knowledge/vect.sml"
   195   use "Knowledge/diffapp.sml"        (* postponed to dev. specification | TP-prog. *)
   196   use "Knowledge/biegelinie.sml"
   197   use "Knowledge/algein.sml"
   198   use "Knowledge/diophanteq.sml"
   199   use "Knowledge/Inverse_Z_Transform/inverse_z_transform.sml"
   200   use "Knowledge/isac.sml"
   201   use "Knowledge/build_thydata.sml"
   202   ML {*"%%%%%%%%%%%%%%%%% end Knowledge %%%%%%%%%%%%%%%%%%%%%%%%";*}
   203   ML {*"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%";*}
   204   ML {*"%%%%%%%%%%%%%%%%% all tests successful %%%%%%%%%%%%%%%%%";*}
   205   ML {*"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%";*}
   206 
   207 section {* history of tests *}
   208 text {*
   209   Systematic regression tests have been introduced to isac development in 2003.
   210   Sanity of the regression test suffered from updates following Isabelle development,
   211   which mostly exceeded the resources available in isac's development.
   212 
   213   The survey below shall support to efficiently use the tests for isac 
   214   on different Isabelle versions. Conclusion in most cases will be: 
   215 
   216   !!! Use most recent tests or go back to the old notebook
   217       with isac on Isabelle2002. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   218 *}
   219 
   220 subsection {* isac on Isabelle2013 *}
   221 subsubsection {* Summary of development *}
   222 text {*
   223 *}
   224 subsubsection {* Run tests *}
   225 text {*
   226 *}
   227 subsubsection {* State of tests *}
   228 text {*
   229 *}
   230 subsubsection {* Changesets of begin and end *}
   231 text {*
   232 *}
   233 
   234 subsection {* isac on Isabelle2012 *}
   235 subsubsection {* Summary of development *}
   236 text {*
   237   isac on Isabelle2012 is considered just a transitional stage
   238   within the update from Isabelle2011 to Isabelle2013; thus no further development of isac;
   239   For considerations on the transition see 
   240   ~~/src/Tools/isac/Knowledge/Build_Thydata/thy, section "updating isac..".
   241 *}
   242 subsubsection {* Run tests *}
   243 text {*
   244 $ cd /usr/local/isabisac12/
   245 $ ./bin/isabelle jedit -l HOL src/Tools/isac/Build_Isac.thy
   246 $ ./bin/isabelle jedit -l Isac test/Tools/isac/Test_Isac.thy
   247 *}
   248 subsubsection {* State of tests *}
   249 text {*
   250   At least the tests from isac on Isabelle2011 run again.
   251   However, Test_Isac.thy shows erratic behaviour; no errors are obtained when scrolling 
   252   in parallel with evaluation.
   253 
   254   Counting "error in kernel" for Frontend/interface.sml (the tests considered most significant)
   255   yields 69 hits, some of which were already present before Isabelle2002-->2009-2
   256   (i.e. on the old notebook from 2002).
   257 
   258   Now many tests with (*...=== inhibit exn ...*) give a reason or at least the origin:
   259   # === inhibit exn WN1130621 Isabelle2012-->13 !thehier! === ...see Build_Thydata.thy
   260   # === inhibit exn AK110726 === ...reliable work by Alexander Kargl, most likely go back to 2002
   261   # === inhibit exn WN1130701 broken at Isabelle2002 --> 2009-2 === , most likely go back to 2002
   262   Reasons for outcommented tests are also found in Test_Isac.thy near the respective file.sml.
   263 
   264   Some tests have been re-activated (e.g. error patterns, fill patterns).
   265 *}
   266 subsubsection {* Changesets of begin and end *}
   267 text {*
   268   TODO
   269   :
   270   : isac on Isablle2012 
   271   :
   272   Changeset: 48757 (74eb3dfc33cc) updated src from Isabelle2011 to Isabelle2012
   273   User: Walther Neuper <neuper@ist.tugraz.at>
   274   Date: 2012-09-24 18:35:13 +0200 (8 months)
   275   ------------------------------------------------------------------------------
   276   Changeset: 48756 (7443906996a8) merged
   277   User: Walther Neuper <neuper@ist.tugraz.at>
   278   Date: 2012-09-24 18:15:49 +0200 (8 months)
   279 *}
   280 
   281 subsection {* isac on Isabelle2011 *}
   282 subsubsection {* Summary of development *}
   283 text {*
   284   isac's mathematics engine has been extended by two developments:
   285   (1) Isabelle's contexts were introduced by Mathias Lehnfeld
   286   (2) "error patterns" were introduced by Gabriella Daroczy
   287   Regressions tests have been added for both.
   288 *}
   289 subsubsection {* Run tests *}
   290 text {*
   291   $ cd /usr/local/isabisac11/
   292   $ ./bin/isabelle jedit -l HOL src/Tools/isac/Build_Isac.thy
   293   $ ./bin/isabelle jedit -l Isac test/Tools/isac/Test_Isac.thy
   294 *}
   295 subsubsection {* State of tests *}
   296 text {* 
   297   Systematic efforts outcommented less significant tests by (*...=== inhibit exn ...*) 
   298   and sometimes give reasons for failing tests.
   299   (*...=== inhibit exn AK...*) was done by Alexander Kargl; this is reliable
   300   work, some of which couldn't be revised (and renamed) by WN and thus survived some time.
   301 
   302   Tests with functions decomposed for single-stepping are marked with
   303   "~~~~~ fun , args:"; val 
   304 
   305   The most signification tests (in particular Frontend/interface.sml) run,
   306   however, many "error in kernel" are not caught by an exception.
   307   ------------------------------------------------------------------------------
   308   After the changeset below Test_Isac worked with check_unsynchronized_ref ():
   309   ------------------------------------------------------------------------------
   310   Changeset: 42457 (ca691a84b81a) PROVISIONALLY MADE TESTS RUN with Unsynchronized.ref
   311   User: Walther Neuper <neuper@ist.tugraz.at>
   312   Date: 2012-08-06 10:38:11 +0200 (11 months)
   313 *}
   314 subsubsection {* Changesets of begin and end *}
   315 text {*
   316   isac development was done between these changesets:
   317   ------------------------------------------------------------------------------
   318   Changeset: 42519 (1f3b4270363e) meeting dmeindl: added missing files
   319   User: Walther Neuper <neuper@ist.tugraz.at>
   320   Date: 2012-09-24 16:39:30 +0200 (8 months)
   321   :
   322   : isac on Isablle2011
   323   :
   324   Changeset:41897 (355be7f60389) merged isabisac with Isabelle2011
   325   Branch: decompose-isar 
   326   User: Walther Neuper <neuper@ist.tugraz.at>
   327   Date: 2011-02-25 13:04:56 +0100 (2011-02-25)
   328   ------------------------------------------------------------------------------
   329 *}
   330 
   331 subsection {* isac on Isabelle2009-2 *}
   332 subsubsection {* Summary of development *}
   333 text {*
   334   In 2009 the update of isac from Isabelle2002 started with switching from CVS to hg.
   335   The update was painful (bridging 7 years of Isabelle development) and cut short 
   336   due to the start of introducing Isabelle's contexts (Mathias Lehnfeld) and
   337   going on to Isabelle2011 although most of the tests did not run.
   338 *}
   339 subsubsection {* Run tests *}
   340 text {*
   341   $ cd /usr/local/isabisac09-2/
   342   $ ./bin/isabelle emacs -l HOL src/Tools/isac/Build_Isac.thy
   343   $ ./bin/isabelle emacs -l Isac src/Tools/isac/Test_Isac.thy
   344   NOT THE RIGHT VERSION.....    test/Tools/isac/Test_Isac.thy !!!
   345 *}
   346 subsubsection {* State of tests *}
   347 text {* 
   348   Most tests are broken by the update from Isabelle2002 to Isabelle2009-2.
   349   If really necessary, go back to the old notebook with Isabelle2002.
   350 *}
   351 subsubsection {* Changesets of begin and end *}
   352 text {*
   353   isac development was done between these changesets:
   354   ------------------------------------------------------------------------------
   355   Changeset: 38115 (940a5feea094) Little improvements of isac-plugin
   356   Branch: decompose-isar 
   357   User: Marco Steger <m.steger@student.tugraz.at>
   358   Date: 2011-02-06 18:30:28 +0100 (2011-02-06)
   359   :
   360   : isac on Isablle2009-2
   361   :
   362   Changeset: 37870 (5100a9c3abf8) created branch isac-from-Isabelle2009-2
   363   Branch: isac-from-Isabelle2009-2 
   364   User: Walther Neuper <neuper@ist.tugraz.at>
   365   Date: 2010-07-21 09:59:35 +0200 (2010-07-21)
   366   ------------------------------------------------------------------------------
   367 *}
   368 
   369 subsection {* isac on Isabelle2002 *}
   370 subsubsection {* Summary of development *}
   371 text {*
   372   From 1999 to 2010 all the basic functionality (except "ctxt" and "error pattern")
   373   of isac's mathematics engine has been implemented.
   374 *}
   375 subsubsection {* Run tests *}
   376 subsubsection {* State of tests *}
   377 text {* 
   378   All tests work on an old notebook (the right PolyML coudn't be upgraded to more
   379   recent Linux versions)
   380 *}
   381 subsubsection {* Changesets of begin and end *}
   382 text {*
   383   Up to the above Mercurial changeset 5100a9c3abf8 isac used CVS;
   384   see https://intra.ist.tugraz.at/hg/isac containing a conversion to Mercurial.
   385 *}
   386 
   387 end
   388 (*========== inhibit exn 110628 ================================================
   389 ============ inhibit exn 110628 ==============================================*)
   390 
   391 (*-.-.-.-.-.-isolate response.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
   392 Pending source file dependencies: "Knowledge/algein.sml" 
   393   -.-.-.-.-.-.-isolate response.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.*)
   394