test/Tools/isac/ProgLang/prog_expr.sml
author Walther Neuper <walther.neuper@jku.at>
Thu, 26 Mar 2020 16:17:21 +0100
changeset 59841 aeeec4898fd1
parent 59633 f854e130f851
child 59847 566d1b41dd55
permissions -rw-r--r--
improve classification of assumptions (True, False, indeterminate)
     1 (* Title:  ProgLang/program.sml
     2    Author: Walther Neuper 190922
     3    (c) due to copyright terms
     4 *)
     5 
     6 "-----------------------------------------------------------------------------------------------";
     7 "-----------------------------------------------------------------------------------------------";
     8 "table of contents -----------------------------------------------------------------------------";
     9 "-----------------------------------------------------------------------------------------------";
    10 "-------- fun eval_equal for x \<noteq> 0: \<rightarrow> indetermined, NOT \<rightarrow> 'True' -----------------------------";
    11 "-----------------------------------------------------------------------------------------------";
    12 "-----------------------------------------------------------------------------------------------";
    13 "-----------------------------------------------------------------------------------------------";
    14 
    15 
    16 "-------- fun eval_equal for x \<noteq> 0: \<rightarrow> indetermined, NOT \<rightarrow> 'True' -----------------------------";
    17 "-------- fun eval_equal for x \<noteq> 0: \<rightarrow> indetermined, NOT \<rightarrow> 'True' -----------------------------";
    18 "-------- fun eval_equal for x \<noteq> 0: \<rightarrow> indetermined, NOT \<rightarrow> 'True' -----------------------------";
    19 val thy = @{theory}
    20 
    21 val t = str2term "x = 0";
    22 val NONE(*= indetermined*) = eval_equal "equal_" "HOL.eq" t thy;
    23 
    24 val t = str2term "(x + 1) = (x + 1)";
    25 val (Const _(*op0,t0*) $ t1 $ t2 ) = t
    26 val SOME ("equal_(x + 1)_(x + 1)", t') = eval_equal "equal_" "HOL.eq" t thy;
    27 if term2str t' = "(x + 1 = x + 1) = True" then () else error "(x + 1) = (x + 1) CHANGED";
    28 
    29 val t as Const _ $ v $ c = str2term "1 = 0";
    30 val false = variable_constant_pair (v, c);
    31 val SOME ("equal_(1)_(0)", t') = eval_equal "equal_" "HOL.eq" t thy;
    32 if term2str t' = "(1 = 0) = False" then () else error "1 = 0 CHANGED";
    33 
    34 val t = str2term "0 = 0";
    35 val SOME ("equal_(0)_(0)", t') = eval_equal "equal_" "HOL.eq" t thy;
    36 if term2str t' = "(0 = 0) = True" then () else error "0 = 0 CHANGED";