src/HOL/Tools/int_factor_simprocs.ML
author huffman
Wed Feb 18 15:01:53 2009 -0800 (2009-02-18)
changeset 29981 7d0ed261b712
parent 29038 90f42c138585
child 30031 bd786c37af84
permissions -rw-r--r--
generalize int_dvd_cancel_factor simproc to idom class
wenzelm@23164
     1
(*  Title:      HOL/int_factor_simprocs.ML
wenzelm@23164
     2
    ID:         $Id$
wenzelm@23164
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
wenzelm@23164
     4
    Copyright   2000  University of Cambridge
wenzelm@23164
     5
wenzelm@23164
     6
Factor cancellation simprocs for the integers (and for fields).
wenzelm@23164
     7
wenzelm@23164
     8
This file can't be combined with int_arith1 because it requires IntDiv.thy.
wenzelm@23164
     9
*)
wenzelm@23164
    10
wenzelm@23164
    11
wenzelm@23164
    12
(*To quote from Provers/Arith/cancel_numeral_factor.ML:
wenzelm@23164
    13
wenzelm@23164
    14
Cancels common coefficients in balanced expressions:
wenzelm@23164
    15
wenzelm@23164
    16
     u*#m ~~ u'*#m'  ==  #n*u ~~ #n'*u'
wenzelm@23164
    17
wenzelm@23164
    18
where ~~ is an appropriate balancing operation (e.g. =, <=, <, div, /)
wenzelm@23164
    19
and d = gcd(m,m') and n=m/d and n'=m'/d.
wenzelm@23164
    20
*)
wenzelm@23164
    21
huffman@29038
    22
val rel_number_of = [@{thm eq_number_of_eq}, @{thm less_number_of}, @{thm le_number_of}];
wenzelm@23164
    23
wenzelm@23164
    24
local
wenzelm@23164
    25
  open Int_Numeral_Simprocs
wenzelm@23164
    26
in
wenzelm@23164
    27
wenzelm@23164
    28
structure CancelNumeralFactorCommon =
wenzelm@23164
    29
  struct
wenzelm@23164
    30
  val mk_coeff          = mk_coeff
wenzelm@23164
    31
  val dest_coeff        = dest_coeff 1
wenzelm@23164
    32
  val trans_tac         = fn _ => trans_tac
wenzelm@23164
    33
wenzelm@23164
    34
  val norm_ss1 = HOL_ss addsimps minus_from_mult_simps @ mult_1s
wenzelm@23164
    35
  val norm_ss2 = HOL_ss addsimps simps @ mult_minus_simps
haftmann@23881
    36
  val norm_ss3 = HOL_ss addsimps @{thms mult_ac}
wenzelm@23164
    37
  fun norm_tac ss =
wenzelm@23164
    38
    ALLGOALS (simp_tac (Simplifier.inherit_context ss norm_ss1))
wenzelm@23164
    39
    THEN ALLGOALS (simp_tac (Simplifier.inherit_context ss norm_ss2))
wenzelm@23164
    40
    THEN ALLGOALS (simp_tac (Simplifier.inherit_context ss norm_ss3))
wenzelm@23164
    41
wenzelm@23164
    42
  val numeral_simp_ss = HOL_ss addsimps rel_number_of @ simps
wenzelm@23164
    43
  fun numeral_simp_tac ss = ALLGOALS (simp_tac (Simplifier.inherit_context ss numeral_simp_ss))
wenzelm@23164
    44
  val simplify_meta_eq = Int_Numeral_Simprocs.simplify_meta_eq
wenzelm@23164
    45
    [@{thm add_0}, @{thm add_0_right}, @{thm mult_zero_left},
huffman@26086
    46
      @{thm mult_zero_right}, @{thm mult_Bit1}, @{thm mult_1_right}];
wenzelm@23164
    47
  end
wenzelm@23164
    48
wenzelm@23164
    49
(*Version for integer division*)
wenzelm@23164
    50
structure IntDivCancelNumeralFactor = CancelNumeralFactorFun
wenzelm@23164
    51
 (open CancelNumeralFactorCommon
wenzelm@23164
    52
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
wenzelm@23164
    53
  val mk_bal   = HOLogic.mk_binop @{const_name Divides.div}
wenzelm@23164
    54
  val dest_bal = HOLogic.dest_bin @{const_name Divides.div} HOLogic.intT
nipkow@23401
    55
  val cancel = @{thm zdiv_zmult_zmult1} RS trans
wenzelm@23164
    56
  val neg_exchanges = false
wenzelm@23164
    57
)
wenzelm@23164
    58
wenzelm@23164
    59
(*Version for fields*)
wenzelm@23164
    60
structure DivideCancelNumeralFactor = CancelNumeralFactorFun
wenzelm@23164
    61
 (open CancelNumeralFactorCommon
wenzelm@23164
    62
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
wenzelm@23164
    63
  val mk_bal   = HOLogic.mk_binop @{const_name HOL.divide}
wenzelm@23164
    64
  val dest_bal = HOLogic.dest_bin @{const_name HOL.divide} Term.dummyT
nipkow@23413
    65
  val cancel = @{thm mult_divide_mult_cancel_left} RS trans
wenzelm@23164
    66
  val neg_exchanges = false
wenzelm@23164
    67
)
wenzelm@23164
    68
wenzelm@23164
    69
structure EqCancelNumeralFactor = CancelNumeralFactorFun
wenzelm@23164
    70
 (open CancelNumeralFactorCommon
wenzelm@23164
    71
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
wenzelm@23164
    72
  val mk_bal   = HOLogic.mk_eq
wenzelm@23164
    73
  val dest_bal = HOLogic.dest_bin "op =" Term.dummyT
wenzelm@23164
    74
  val cancel = @{thm mult_cancel_left} RS trans
wenzelm@23164
    75
  val neg_exchanges = false
wenzelm@23164
    76
)
wenzelm@23164
    77
wenzelm@23164
    78
structure LessCancelNumeralFactor = CancelNumeralFactorFun
wenzelm@23164
    79
 (open CancelNumeralFactorCommon
wenzelm@23164
    80
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
haftmann@23881
    81
  val mk_bal   = HOLogic.mk_binrel @{const_name HOL.less}
haftmann@23881
    82
  val dest_bal = HOLogic.dest_bin @{const_name HOL.less} Term.dummyT
wenzelm@23164
    83
  val cancel = @{thm mult_less_cancel_left} RS trans
wenzelm@23164
    84
  val neg_exchanges = true
wenzelm@23164
    85
)
wenzelm@23164
    86
wenzelm@23164
    87
structure LeCancelNumeralFactor = CancelNumeralFactorFun
wenzelm@23164
    88
 (open CancelNumeralFactorCommon
wenzelm@23164
    89
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
haftmann@23881
    90
  val mk_bal   = HOLogic.mk_binrel @{const_name HOL.less_eq}
haftmann@23881
    91
  val dest_bal = HOLogic.dest_bin @{const_name HOL.less_eq} Term.dummyT
wenzelm@23164
    92
  val cancel = @{thm mult_le_cancel_left} RS trans
wenzelm@23164
    93
  val neg_exchanges = true
wenzelm@23164
    94
)
wenzelm@23164
    95
wenzelm@23164
    96
val cancel_numeral_factors =
wenzelm@23164
    97
  map Int_Numeral_Base_Simprocs.prep_simproc
wenzelm@23164
    98
   [("ring_eq_cancel_numeral_factor",
wenzelm@23164
    99
     ["(l::'a::{idom,number_ring}) * m = n",
wenzelm@23164
   100
      "(l::'a::{idom,number_ring}) = m * n"],
wenzelm@23164
   101
     K EqCancelNumeralFactor.proc),
wenzelm@23164
   102
    ("ring_less_cancel_numeral_factor",
wenzelm@23164
   103
     ["(l::'a::{ordered_idom,number_ring}) * m < n",
wenzelm@23164
   104
      "(l::'a::{ordered_idom,number_ring}) < m * n"],
wenzelm@23164
   105
     K LessCancelNumeralFactor.proc),
wenzelm@23164
   106
    ("ring_le_cancel_numeral_factor",
wenzelm@23164
   107
     ["(l::'a::{ordered_idom,number_ring}) * m <= n",
wenzelm@23164
   108
      "(l::'a::{ordered_idom,number_ring}) <= m * n"],
wenzelm@23164
   109
     K LeCancelNumeralFactor.proc),
wenzelm@23164
   110
    ("int_div_cancel_numeral_factors",
wenzelm@23164
   111
     ["((l::int) * m) div n", "(l::int) div (m * n)"],
wenzelm@23164
   112
     K IntDivCancelNumeralFactor.proc),
wenzelm@23164
   113
    ("divide_cancel_numeral_factor",
wenzelm@23164
   114
     ["((l::'a::{division_by_zero,field,number_ring}) * m) / n",
wenzelm@23164
   115
      "(l::'a::{division_by_zero,field,number_ring}) / (m * n)",
wenzelm@23164
   116
      "((number_of v)::'a::{division_by_zero,field,number_ring}) / (number_of w)"],
wenzelm@23164
   117
     K DivideCancelNumeralFactor.proc)];
wenzelm@23164
   118
wenzelm@23164
   119
(* referenced by rat_arith.ML *)
wenzelm@23164
   120
val field_cancel_numeral_factors =
wenzelm@23164
   121
  map Int_Numeral_Base_Simprocs.prep_simproc
wenzelm@23164
   122
   [("field_eq_cancel_numeral_factor",
wenzelm@23164
   123
     ["(l::'a::{field,number_ring}) * m = n",
wenzelm@23164
   124
      "(l::'a::{field,number_ring}) = m * n"],
wenzelm@23164
   125
     K EqCancelNumeralFactor.proc),
wenzelm@23164
   126
    ("field_cancel_numeral_factor",
wenzelm@23164
   127
     ["((l::'a::{division_by_zero,field,number_ring}) * m) / n",
wenzelm@23164
   128
      "(l::'a::{division_by_zero,field,number_ring}) / (m * n)",
wenzelm@23164
   129
      "((number_of v)::'a::{division_by_zero,field,number_ring}) / (number_of w)"],
wenzelm@23164
   130
     K DivideCancelNumeralFactor.proc)]
wenzelm@23164
   131
wenzelm@23164
   132
end;
wenzelm@23164
   133
wenzelm@23164
   134
Addsimprocs cancel_numeral_factors;
wenzelm@23164
   135
wenzelm@23164
   136
(*examples:
wenzelm@23164
   137
print_depth 22;
wenzelm@23164
   138
set timing;
wenzelm@23164
   139
set trace_simp;
wenzelm@23164
   140
fun test s = (Goal s; by (Simp_tac 1));
wenzelm@23164
   141
wenzelm@23164
   142
test "9*x = 12 * (y::int)";
wenzelm@23164
   143
test "(9*x) div (12 * (y::int)) = z";
wenzelm@23164
   144
test "9*x < 12 * (y::int)";
wenzelm@23164
   145
test "9*x <= 12 * (y::int)";
wenzelm@23164
   146
wenzelm@23164
   147
test "-99*x = 132 * (y::int)";
wenzelm@23164
   148
test "(-99*x) div (132 * (y::int)) = z";
wenzelm@23164
   149
test "-99*x < 132 * (y::int)";
wenzelm@23164
   150
test "-99*x <= 132 * (y::int)";
wenzelm@23164
   151
wenzelm@23164
   152
test "999*x = -396 * (y::int)";
wenzelm@23164
   153
test "(999*x) div (-396 * (y::int)) = z";
wenzelm@23164
   154
test "999*x < -396 * (y::int)";
wenzelm@23164
   155
test "999*x <= -396 * (y::int)";
wenzelm@23164
   156
wenzelm@23164
   157
test "-99*x = -81 * (y::int)";
wenzelm@23164
   158
test "(-99*x) div (-81 * (y::int)) = z";
wenzelm@23164
   159
test "-99*x <= -81 * (y::int)";
wenzelm@23164
   160
test "-99*x < -81 * (y::int)";
wenzelm@23164
   161
wenzelm@23164
   162
test "-2 * x = -1 * (y::int)";
wenzelm@23164
   163
test "-2 * x = -(y::int)";
wenzelm@23164
   164
test "(-2 * x) div (-1 * (y::int)) = z";
wenzelm@23164
   165
test "-2 * x < -(y::int)";
wenzelm@23164
   166
test "-2 * x <= -1 * (y::int)";
wenzelm@23164
   167
test "-x < -23 * (y::int)";
wenzelm@23164
   168
test "-x <= -23 * (y::int)";
wenzelm@23164
   169
*)
wenzelm@23164
   170
wenzelm@23164
   171
(*And the same examples for fields such as rat or real:
wenzelm@23164
   172
test "0 <= (y::rat) * -2";
wenzelm@23164
   173
test "9*x = 12 * (y::rat)";
wenzelm@23164
   174
test "(9*x) / (12 * (y::rat)) = z";
wenzelm@23164
   175
test "9*x < 12 * (y::rat)";
wenzelm@23164
   176
test "9*x <= 12 * (y::rat)";
wenzelm@23164
   177
wenzelm@23164
   178
test "-99*x = 132 * (y::rat)";
wenzelm@23164
   179
test "(-99*x) / (132 * (y::rat)) = z";
wenzelm@23164
   180
test "-99*x < 132 * (y::rat)";
wenzelm@23164
   181
test "-99*x <= 132 * (y::rat)";
wenzelm@23164
   182
wenzelm@23164
   183
test "999*x = -396 * (y::rat)";
wenzelm@23164
   184
test "(999*x) / (-396 * (y::rat)) = z";
wenzelm@23164
   185
test "999*x < -396 * (y::rat)";
wenzelm@23164
   186
test "999*x <= -396 * (y::rat)";
wenzelm@23164
   187
wenzelm@23164
   188
test  "(- ((2::rat) * x) <= 2 * y)";
wenzelm@23164
   189
test "-99*x = -81 * (y::rat)";
wenzelm@23164
   190
test "(-99*x) / (-81 * (y::rat)) = z";
wenzelm@23164
   191
test "-99*x <= -81 * (y::rat)";
wenzelm@23164
   192
test "-99*x < -81 * (y::rat)";
wenzelm@23164
   193
wenzelm@23164
   194
test "-2 * x = -1 * (y::rat)";
wenzelm@23164
   195
test "-2 * x = -(y::rat)";
wenzelm@23164
   196
test "(-2 * x) / (-1 * (y::rat)) = z";
wenzelm@23164
   197
test "-2 * x < -(y::rat)";
wenzelm@23164
   198
test "-2 * x <= -1 * (y::rat)";
wenzelm@23164
   199
test "-x < -23 * (y::rat)";
wenzelm@23164
   200
test "-x <= -23 * (y::rat)";
wenzelm@23164
   201
*)
wenzelm@23164
   202
wenzelm@23164
   203
wenzelm@23164
   204
(** Declarations for ExtractCommonTerm **)
wenzelm@23164
   205
wenzelm@23164
   206
local
wenzelm@23164
   207
  open Int_Numeral_Simprocs
wenzelm@23164
   208
in
wenzelm@23164
   209
wenzelm@23164
   210
(*Find first term that matches u*)
wenzelm@23164
   211
fun find_first_t past u []         = raise TERM ("find_first_t", [])
wenzelm@23164
   212
  | find_first_t past u (t::terms) =
wenzelm@23164
   213
        if u aconv t then (rev past @ terms)
wenzelm@23164
   214
        else find_first_t (t::past) u terms
wenzelm@23164
   215
        handle TERM _ => find_first_t (t::past) u terms;
wenzelm@23164
   216
wenzelm@23164
   217
(** Final simplification for the CancelFactor simprocs **)
wenzelm@23164
   218
val simplify_one = Int_Numeral_Simprocs.simplify_meta_eq  
haftmann@25481
   219
  [@{thm mult_1_left}, @{thm mult_1_right}, @{thm zdiv_1}, @{thm numeral_1_eq_1}];
wenzelm@23164
   220
wenzelm@23164
   221
fun cancel_simplify_meta_eq cancel_th ss th =
wenzelm@23164
   222
    simplify_one ss (([th, cancel_th]) MRS trans);
wenzelm@23164
   223
wenzelm@23164
   224
structure CancelFactorCommon =
wenzelm@23164
   225
  struct
wenzelm@23164
   226
  val mk_sum            = long_mk_prod
wenzelm@23164
   227
  val dest_sum          = dest_prod
wenzelm@23164
   228
  val mk_coeff          = mk_coeff
wenzelm@23164
   229
  val dest_coeff        = dest_coeff
wenzelm@23164
   230
  val find_first        = find_first_t []
wenzelm@23164
   231
  val trans_tac         = fn _ => trans_tac
haftmann@23881
   232
  val norm_ss = HOL_ss addsimps mult_1s @ @{thms mult_ac}
wenzelm@23164
   233
  fun norm_tac ss = ALLGOALS (simp_tac (Simplifier.inherit_context ss norm_ss))
wenzelm@23164
   234
  end;
wenzelm@23164
   235
wenzelm@23164
   236
(*mult_cancel_left requires a ring with no zero divisors.*)
wenzelm@23164
   237
structure EqCancelFactor = ExtractCommonTermFun
wenzelm@23164
   238
 (open CancelFactorCommon
wenzelm@23164
   239
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
wenzelm@23164
   240
  val mk_bal   = HOLogic.mk_eq
wenzelm@23164
   241
  val dest_bal = HOLogic.dest_bin "op =" Term.dummyT
wenzelm@23164
   242
  val simplify_meta_eq  = cancel_simplify_meta_eq @{thm mult_cancel_left}
wenzelm@23164
   243
);
wenzelm@23164
   244
nipkow@23401
   245
(*zdiv_zmult_zmult1_if is for integer division (div).*)
wenzelm@23164
   246
structure IntDivCancelFactor = ExtractCommonTermFun
wenzelm@23164
   247
 (open CancelFactorCommon
wenzelm@23164
   248
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
wenzelm@23164
   249
  val mk_bal   = HOLogic.mk_binop @{const_name Divides.div}
wenzelm@23164
   250
  val dest_bal = HOLogic.dest_bin @{const_name Divides.div} HOLogic.intT
nipkow@23401
   251
  val simplify_meta_eq  = cancel_simplify_meta_eq @{thm zdiv_zmult_zmult1_if}
wenzelm@23164
   252
);
wenzelm@23164
   253
nipkow@24395
   254
structure IntModCancelFactor = ExtractCommonTermFun
nipkow@24395
   255
 (open CancelFactorCommon
nipkow@24395
   256
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
nipkow@24395
   257
  val mk_bal   = HOLogic.mk_binop @{const_name Divides.mod}
nipkow@24395
   258
  val dest_bal = HOLogic.dest_bin @{const_name Divides.mod} HOLogic.intT
nipkow@24395
   259
  val simplify_meta_eq  = cancel_simplify_meta_eq @{thm zmod_zmult_zmult1}
nipkow@24395
   260
);
nipkow@24395
   261
nipkow@23969
   262
structure IntDvdCancelFactor = ExtractCommonTermFun
nipkow@23969
   263
 (open CancelFactorCommon
nipkow@23969
   264
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
haftmann@27651
   265
  val mk_bal   = HOLogic.mk_binrel @{const_name Ring_and_Field.dvd}
huffman@29981
   266
  val dest_bal = HOLogic.dest_bin @{const_name Ring_and_Field.dvd} Term.dummyT
huffman@29981
   267
  val simplify_meta_eq  = cancel_simplify_meta_eq @{thm dvd_mult_cancel_left}
nipkow@23969
   268
);
nipkow@23969
   269
wenzelm@23164
   270
(*Version for all fields, including unordered ones (type complex).*)
wenzelm@23164
   271
structure DivideCancelFactor = ExtractCommonTermFun
wenzelm@23164
   272
 (open CancelFactorCommon
wenzelm@23164
   273
  val prove_conv = Int_Numeral_Base_Simprocs.prove_conv
wenzelm@23164
   274
  val mk_bal   = HOLogic.mk_binop @{const_name HOL.divide}
wenzelm@23164
   275
  val dest_bal = HOLogic.dest_bin @{const_name HOL.divide} Term.dummyT
nipkow@23413
   276
  val simplify_meta_eq  = cancel_simplify_meta_eq @{thm mult_divide_mult_cancel_left_if}
wenzelm@23164
   277
);
wenzelm@23164
   278
wenzelm@23164
   279
val cancel_factors =
wenzelm@23164
   280
  map Int_Numeral_Base_Simprocs.prep_simproc
wenzelm@23164
   281
   [("ring_eq_cancel_factor",
nipkow@23400
   282
     ["(l::'a::{idom}) * m = n",
nipkow@23400
   283
      "(l::'a::{idom}) = m * n"],
wenzelm@23164
   284
    K EqCancelFactor.proc),
wenzelm@23164
   285
    ("int_div_cancel_factor",
wenzelm@23164
   286
     ["((l::int) * m) div n", "(l::int) div (m * n)"],
wenzelm@23164
   287
     K IntDivCancelFactor.proc),
nipkow@24395
   288
    ("int_mod_cancel_factor",
nipkow@24395
   289
     ["((l::int) * m) mod n", "(l::int) mod (m * n)"],
nipkow@24395
   290
     K IntModCancelFactor.proc),
huffman@29981
   291
    ("dvd_cancel_factor",
huffman@29981
   292
     ["((l::'a::idom) * m) dvd n", "(l::'a::idom) dvd (m * n)"],
nipkow@23969
   293
     K IntDvdCancelFactor.proc),
wenzelm@23164
   294
    ("divide_cancel_factor",
nipkow@23400
   295
     ["((l::'a::{division_by_zero,field}) * m) / n",
nipkow@23400
   296
      "(l::'a::{division_by_zero,field}) / (m * n)"],
wenzelm@23164
   297
     K DivideCancelFactor.proc)];
wenzelm@23164
   298
wenzelm@23164
   299
end;
wenzelm@23164
   300
wenzelm@23164
   301
Addsimprocs cancel_factors;
wenzelm@23164
   302
wenzelm@23164
   303
wenzelm@23164
   304
(*examples:
wenzelm@23164
   305
print_depth 22;
wenzelm@23164
   306
set timing;
wenzelm@23164
   307
set trace_simp;
wenzelm@23164
   308
fun test s = (Goal s; by (Asm_simp_tac 1));
wenzelm@23164
   309
wenzelm@23164
   310
test "x*k = k*(y::int)";
wenzelm@23164
   311
test "k = k*(y::int)";
wenzelm@23164
   312
test "a*(b*c) = (b::int)";
wenzelm@23164
   313
test "a*(b*c) = d*(b::int)*(x*a)";
wenzelm@23164
   314
wenzelm@23164
   315
test "(x*k) div (k*(y::int)) = (uu::int)";
wenzelm@23164
   316
test "(k) div (k*(y::int)) = (uu::int)";
wenzelm@23164
   317
test "(a*(b*c)) div ((b::int)) = (uu::int)";
wenzelm@23164
   318
test "(a*(b*c)) div (d*(b::int)*(x*a)) = (uu::int)";
wenzelm@23164
   319
*)
wenzelm@23164
   320
wenzelm@23164
   321
(*And the same examples for fields such as rat or real:
wenzelm@23164
   322
print_depth 22;
wenzelm@23164
   323
set timing;
wenzelm@23164
   324
set trace_simp;
wenzelm@23164
   325
fun test s = (Goal s; by (Asm_simp_tac 1));
wenzelm@23164
   326
wenzelm@23164
   327
test "x*k = k*(y::rat)";
wenzelm@23164
   328
test "k = k*(y::rat)";
wenzelm@23164
   329
test "a*(b*c) = (b::rat)";
wenzelm@23164
   330
test "a*(b*c) = d*(b::rat)*(x*a)";
wenzelm@23164
   331
wenzelm@23164
   332
wenzelm@23164
   333
test "(x*k) / (k*(y::rat)) = (uu::rat)";
wenzelm@23164
   334
test "(k) / (k*(y::rat)) = (uu::rat)";
wenzelm@23164
   335
test "(a*(b*c)) / ((b::rat)) = (uu::rat)";
wenzelm@23164
   336
test "(a*(b*c)) / (d*(b::rat)*(x*a)) = (uu::rat)";
wenzelm@23164
   337
wenzelm@23164
   338
(*FIXME: what do we do about this?*)
wenzelm@23164
   339
test "a*(b*c)/(y*z) = d*(b::rat)*(x*a)/z";
wenzelm@23164
   340
*)