1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/Tools/isac/Knowledge/Test.thy Wed Aug 25 16:20:07 2010 +0200
1.3 @@ -0,0 +1,169 @@
1.4 +(* use_thy"Knowledge/Test";
1.5 + *)
1.6 +
1.7 +Test = Atools + Rational + Root + Poly +
1.8 +
1.9 +consts
1.10 +
1.11 +(*"cancel":: [real, real] => real (infixl "'/'/'/" 70) ...divide 2002*)
1.12 +
1.13 + Expand'_binomtest
1.14 + :: "['y, \
1.15 + \ 'y] => 'y"
1.16 + ("((Script Expand'_binomtest (_ =))// \
1.17 + \ (_))" 9)
1.18 +
1.19 + Solve'_univar'_err
1.20 + :: "[bool,real,bool, \
1.21 + \ bool list] => bool list"
1.22 + ("((Script Solve'_univar'_err (_ _ _ =))// \
1.23 + \ (_))" 9)
1.24 +
1.25 + Solve'_linear
1.26 + :: "[bool,real, \
1.27 + \ bool list] => bool list"
1.28 + ("((Script Solve'_linear (_ _ =))// \
1.29 + \ (_))" 9)
1.30 +
1.31 +(*17.9.02 aus SqRoot.thy------------------------------vvv---*)
1.32 +
1.33 + "is'_root'_free" :: 'a => bool ("is'_root'_free _" 10)
1.34 + "contains'_root" :: 'a => bool ("contains'_root _" 10)
1.35 +
1.36 + Solve'_root'_equation
1.37 + :: "[bool,real, \
1.38 + \ bool list] => bool list"
1.39 + ("((Script Solve'_root'_equation (_ _ =))// \
1.40 + \ (_))" 9)
1.41 +
1.42 + Solve'_plain'_square
1.43 + :: "[bool,real, \
1.44 + \ bool list] => bool list"
1.45 + ("((Script Solve'_plain'_square (_ _ =))// \
1.46 + \ (_))" 9)
1.47 +
1.48 + Norm'_univar'_equation
1.49 + :: "[bool,real, \
1.50 + \ bool] => bool"
1.51 + ("((Script Norm'_univar'_equation (_ _ =))// \
1.52 + \ (_))" 9)
1.53 +
1.54 + STest'_simplify
1.55 + :: "['z, \
1.56 + \ 'z] => 'z"
1.57 + ("((Script STest'_simplify (_ =))// \
1.58 + \ (_))" 9)
1.59 +
1.60 +(*17.9.02 aus SqRoot.thy------------------------------^^^---*)
1.61 +
1.62 +rules (*stated as axioms, todo: prove as theorems*)
1.63 +
1.64 + radd_mult_distrib2 "(k::real) * (m + n) = k * m + k * n"
1.65 + rdistr_right_assoc "(k::real) + l * n + m * n = k + (l + m) * n"
1.66 + rdistr_right_assoc_p "l * n + (m * n + (k::real)) = (l + m) * n + k"
1.67 + rdistr_div_right "((k::real) + l) / n = k / n + l / n"
1.68 + rcollect_right
1.69 + "[| l is_const; m is_const |] ==> (l::real)*n + m*n = (l + m) * n"
1.70 + rcollect_one_left
1.71 + "m is_const ==> (n::real) + m * n = (1 + m) * n"
1.72 + rcollect_one_left_assoc
1.73 + "m is_const ==> (k::real) + n + m * n = k + (1 + m) * n"
1.74 + rcollect_one_left_assoc_p
1.75 + "m is_const ==> n + (m * n + (k::real)) = (1 + m) * n + k"
1.76 +
1.77 + rtwo_of_the_same "a + a = 2 * a"
1.78 + rtwo_of_the_same_assoc "(x + a) + a = x + 2 * a"
1.79 + rtwo_of_the_same_assoc_p"a + (a + x) = 2 * a + x"
1.80 +
1.81 + rcancel_den "not(a=0) ==> a * (b / a) = b"
1.82 + rcancel_const "[| a is_const; b is_const |] ==> a*(x/b) = a/b*x"
1.83 + rshift_nominator "(a::real) * b / c = a / c * b"
1.84 +
1.85 + exp_pow "(a ^^^ b) ^^^ c = a ^^^ (b * c)"
1.86 + rsqare "(a::real) * a = a ^^^ 2"
1.87 + power_1 "(a::real) ^^^ 1 = a"
1.88 + rbinom_power_2 "((a::real) + b)^^^ 2 = a^^^ 2 + 2*a*b + b^^^ 2"
1.89 +
1.90 + rmult_1 "1 * k = (k::real)"
1.91 + rmult_1_right "k * 1 = (k::real)"
1.92 + rmult_0 "0 * k = (0::real)"
1.93 + rmult_0_right "k * 0 = (0::real)"
1.94 + radd_0 "0 + k = (k::real)"
1.95 + radd_0_right "k + 0 = (k::real)"
1.96 +
1.97 + radd_real_const_eq
1.98 + "[| a is_const; c is_const; d is_const |] ==> a/d + c/d = (a+c)/(d::real)"
1.99 + radd_real_const
1.100 + "[| a is_const; b is_const; c is_const; d is_const |] ==> a/b + c/d = (a*d + b*c)/(b*(d::real))"
1.101 +
1.102 +(*for AC-operators*)
1.103 + radd_commute "(m::real) + (n::real) = n + m"
1.104 + radd_left_commute "(x::real) + (y + z) = y + (x + z)"
1.105 + radd_assoc "(m::real) + n + k = m + (n + k)"
1.106 + rmult_commute "(m::real) * n = n * m"
1.107 + rmult_left_commute "(x::real) * (y * z) = y * (x * z)"
1.108 + rmult_assoc "(m::real) * n * k = m * (n * k)"
1.109 +
1.110 +(*for equations: 'bdv' is a meta-constant*)
1.111 + risolate_bdv_add "((k::real) + bdv = m) = (bdv = m + (-1)*k)"
1.112 + risolate_bdv_mult_add "((k::real) + n*bdv = m) = (n*bdv = m + (-1)*k)"
1.113 + risolate_bdv_mult "((n::real) * bdv = m) = (bdv = m / n)"
1.114 +
1.115 + rnorm_equation_add
1.116 + "~(b =!= 0) ==> (a = b) = (a + (-1)*b = 0)"
1.117 +
1.118 +(*17.9.02 aus SqRoot.thy------------------------------vvv---*)
1.119 + root_ge0 "0 <= a ==> 0 <= sqrt a"
1.120 + (*should be dropped with better simplification in eval_rls ...*)
1.121 + root_add_ge0
1.122 + "[| 0 <= a; 0 <= b |] ==> (0 <= sqrt a + sqrt b) = True"
1.123 + root_ge0_1
1.124 + "[| 0<=a; 0<=b; 0<=c |] ==> (0 <= a * sqrt b + sqrt c) = True"
1.125 + root_ge0_2
1.126 + "[| 0<=a; 0<=b; 0<=c |] ==> (0 <= sqrt a + b * sqrt c) = True"
1.127 +
1.128 +
1.129 + rroot_square_inv "(sqrt a)^^^ 2 = a"
1.130 + rroot_times_root "sqrt a * sqrt b = sqrt(a*b)"
1.131 + rroot_times_root_assoc "(a * sqrt b) * sqrt c = a * sqrt(b*c)"
1.132 + rroot_times_root_assoc_p "sqrt b * (sqrt c * a)= sqrt(b*c) * a"
1.133 +
1.134 +
1.135 +(*for root-equations*)
1.136 + square_equation_left
1.137 + "[| 0 <= a; 0 <= b |] ==> (((sqrt a)=b)=(a=(b^^^ 2)))"
1.138 + square_equation_right
1.139 + "[| 0 <= a; 0 <= b |] ==> ((a=(sqrt b))=((a^^^ 2)=b))"
1.140 + (*causes frequently non-termination:*)
1.141 + square_equation
1.142 + "[| 0 <= a; 0 <= b |] ==> ((a=b)=((a^^^ 2)=b^^^ 2))"
1.143 +
1.144 + risolate_root_add "(a+ sqrt c = d) = ( sqrt c = d + (-1)*a)"
1.145 + risolate_root_mult "(a+b*sqrt c = d) = (b*sqrt c = d + (-1)*a)"
1.146 + risolate_root_div "(a * sqrt c = d) = ( sqrt c = d / a)"
1.147 +
1.148 +(*for polynomial equations of degree 2; linear case in RatArith*)
1.149 + mult_square "(a*bdv^^^2 = b) = (bdv^^^2 = b / a)"
1.150 + constant_square "(a + bdv^^^2 = b) = (bdv^^^2 = b + -1*a)"
1.151 + constant_mult_square "(a + b*bdv^^^2 = c) = (b*bdv^^^2 = c + -1*a)"
1.152 +
1.153 + square_equality
1.154 + "0 <= a ==> (x^^^2 = a) = ((x=sqrt a) | (x=-1*sqrt a))"
1.155 + square_equality_0
1.156 + "(x^^^2 = 0) = (x = 0)"
1.157 +
1.158 +(*isolate root on the LEFT hand side of the equation
1.159 + otherwise shuffling from left to right would not terminate*)
1.160 +
1.161 + rroot_to_lhs
1.162 + "is_root_free a ==> (a = sqrt b) = (a + (-1)*sqrt b = 0)"
1.163 + rroot_to_lhs_mult
1.164 + "is_root_free a ==> (a = c*sqrt b) = (a + (-1)*c*sqrt b = 0)"
1.165 + rroot_to_lhs_add_mult
1.166 + "is_root_free a ==> (a = d+c*sqrt b) = (a + (-1)*c*sqrt b = d)"
1.167 +
1.168 +
1.169 +(*17.9.02 aus SqRoot.thy------------------------------^^^---*)
1.170 +
1.171 +
1.172 +end