progs/re4.scala
author Christian Urban <urbanc@in.tum.de>
Sun, 05 Aug 2018 21:52:40 +0100
changeset 554 2509c670e3a2
parent 550 71fc4a7a7039
child 623 47a299e7010f
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
477
b78664a24f5d updated
Christian Urban <urbanc@in.tum.de>
parents: 467
diff changeset
     1
// Version which attempts to move whole strings, not
b78664a24f5d updated
Christian Urban <urbanc@in.tum.de>
parents: 467
diff changeset
     2
// just characters, under derivatives whenever possible
b78664a24f5d updated
Christian Urban <urbanc@in.tum.de>
parents: 467
diff changeset
     3
   
422
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
     4
abstract class Rexp
407
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
     5
case object ZERO extends Rexp
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
     6
case object ONE extends Rexp
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
case class CHAR(c: Char) extends Rexp
422
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
     8
case class ALT(r1: Rexp, r2: Rexp) extends Rexp 
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
     9
case class SEQ(r1: Rexp, r2: Rexp) extends Rexp 
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    10
case class STAR(r: Rexp) extends Rexp 
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    11
case class NTIMES(r: Rexp, n: Int) extends Rexp 
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
// nullable function: tests whether the regular 
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
// expression can recognise the empty string
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
def nullable (r: Rexp) : Boolean = r match {
407
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    16
  case ZERO => false
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    17
  case ONE => true
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
  case CHAR(_) => false
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
  case ALT(r1, r2) => nullable(r1) || nullable(r2)
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
  case SEQ(r1, r2) => nullable(r1) && nullable(r2)
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  case STAR(_) => true
121
43c116860e47 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    22
  case NTIMES(r, i) => if (i == 0) true else nullable(r)
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
}
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
// derivative of a regular expression w.r.t. a character
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
def der (c: Char, r: Rexp) : Rexp = r match {
407
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    27
  case ZERO => ZERO
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    28
  case ONE => ZERO
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    29
  case CHAR(d) => if (c == d) ONE else ZERO
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
  case ALT(r1, r2) => ALT(der(c, r1), der(c, r2))
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
  case SEQ(r1, r2) => 
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
    if (nullable(r1)) ALT(SEQ(der(c, r1), r2), der(c, r2))
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
    else SEQ(der(c, r1), r2)
441
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
    34
  case STAR(r1) => SEQ(der(c, r1), STAR(r1))
455
1dbf84ade62c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 441
diff changeset
    35
  case NTIMES(r1, i) => 
1dbf84ade62c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 441
diff changeset
    36
    if (i == 0) ZERO else der(c, SEQ(r1, NTIMES(r1, i - 1)))
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
}
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
422
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    39
def simp(r: Rexp) : Rexp = r match {
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    40
  case ALT(r1, r2) => (simp(r1), simp(r2)) match {
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    41
    case (ZERO, r2s) => r2s
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    42
    case (r1s, ZERO) => r1s
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    43
    case (r1s, r2s) => if (r1s == r2s) r1s else ALT (r1s, r2s)
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    44
  }
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    45
  case SEQ(r1, r2) =>  (simp(r1), simp(r2)) match {
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    46
    case (ZERO, _) => ZERO
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    47
    case (_, ZERO) => ZERO
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    48
    case (ONE, r2s) => r2s
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    49
    case (r1s, ONE) => r1s
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    50
    case (r1s, r2s) => SEQ(r1s, r2s)
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    51
  }
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    52
  case r => r
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    53
}
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    54
546
6589afc6789b updated
Christian Urban <urbanc@in.tum.de>
parents: 477
diff changeset
    55
//example
6589afc6789b updated
Christian Urban <urbanc@in.tum.de>
parents: 477
diff changeset
    56
val r = SEQ(SEQ(CHAR('x'), CHAR('y')), CHAR('z'))
6589afc6789b updated
Christian Urban <urbanc@in.tum.de>
parents: 477
diff changeset
    57
der('x', r)
6589afc6789b updated
Christian Urban <urbanc@in.tum.de>
parents: 477
diff changeset
    58
der('y', der('x', r))
6589afc6789b updated
Christian Urban <urbanc@in.tum.de>
parents: 477
diff changeset
    59
der('z', der('y', der('x', r)))
6589afc6789b updated
Christian Urban <urbanc@in.tum.de>
parents: 477
diff changeset
    60
simp(der('z', der('y', der('x', r))))
6589afc6789b updated
Christian Urban <urbanc@in.tum.de>
parents: 477
diff changeset
    61
477
b78664a24f5d updated
Christian Urban <urbanc@in.tum.de>
parents: 467
diff changeset
    62
// *new*
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
// derivative w.r.t. a string (iterates der)
414
065ca01b62ae updated
Christian Urban <urbanc@in.tum.de>
parents: 412
diff changeset
    64
def ders2(s: List[Char], r: Rexp) : Rexp = (s, r) match {
407
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    65
  case (Nil, r) => r
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    66
  case (s, ZERO) => ZERO
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    67
  case (s, ONE) => if (s == Nil) ONE else ZERO
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    68
  case (s, CHAR(c)) => if (s == List(c)) ONE else 
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    69
                       if (s == Nil) CHAR(c) else ZERO
467
b5ec11e89768 fixed bug
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 455
diff changeset
    70
  case (s, ALT(r1, r2)) => ALT(ders2(s, r1), ders2(s, r2))
422
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    71
  case (c::s, r) => ders2(s, simp(der(c, r)))
407
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    72
}
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    73
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
// main matcher function
407
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    75
def matcher(r: Rexp, s: String) : Boolean = nullable(ders2(s.toList, r))
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    77
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    78
//one or zero
407
4b454a6d1814 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 121
diff changeset
    79
def OPT(r: Rexp) = ALT(r, ONE)
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    80
477
b78664a24f5d updated
Christian Urban <urbanc@in.tum.de>
parents: 467
diff changeset
    81
b78664a24f5d updated
Christian Urban <urbanc@in.tum.de>
parents: 467
diff changeset
    82
// Test Cases
b78664a24f5d updated
Christian Urban <urbanc@in.tum.de>
parents: 467
diff changeset
    83
422
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    84
def EVIL1(n: Int) = SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n))
441
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
    85
val EVIL2 = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
422
5deefcc8cffa updated programs
Christian Urban <urbanc@in.tum.de>
parents: 415
diff changeset
    86
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    87
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    88
def time_needed[T](i: Int, code: => T) = {
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    89
  val start = System.nanoTime()
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    90
  for (j <- 1 to i) code
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    91
  val end = System.nanoTime()
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    92
  (end - start)/(i * 1.0e9)
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    93
}
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    94
441
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
    95
//test: (a?{n}) (a{n})
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
    96
for (i <- 1 to 7000001 by 500000) {
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
    97
  println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL1(i), "a" * i))))
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
    98
}
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    99
441
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   100
for (i <- 1 to 7000001 by 500000) {
414
065ca01b62ae updated
Christian Urban <urbanc@in.tum.de>
parents: 412
diff changeset
   101
  println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL1(i), "a" * i))))
92
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
}
e85600529ca5 moved scala files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   103
441
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   104
//test: (a*)* b
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   105
for (i <- 1 to 7000001 by 500000) {
414
065ca01b62ae updated
Christian Urban <urbanc@in.tum.de>
parents: 412
diff changeset
   106
  println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL2, "a" * i))))
065ca01b62ae updated
Christian Urban <urbanc@in.tum.de>
parents: 412
diff changeset
   107
}
065ca01b62ae updated
Christian Urban <urbanc@in.tum.de>
parents: 412
diff changeset
   108
441
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   109
for (i <- 1 to 7000001 by 500000) {
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   110
  println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL2, "a" * i))))
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   111
}
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   112
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   113
028816884f70 updated
Christian Urban <urbanc@in.tum.de>
parents: 425
diff changeset
   114
550
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   115
// size of a regular expressions - for testing purposes 
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   116
def size(r: Rexp) : Int = r match {
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   117
  case ZERO => 1
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   118
  case ONE => 1
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   119
  case CHAR(_) => 1
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   120
  case ALT(r1, r2) => 1 + size(r1) + size(r2)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   121
  case SEQ(r1, r2) => 1 + size(r1) + size(r2)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   122
  case STAR(r) => 1 + size(r)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   123
  case NTIMES(r, _) => 1 + size(r)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   124
}
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   125
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   126
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   127
// string of a regular expressions - for testing purposes 
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   128
def string(r: Rexp) : String = r match {
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   129
  case ZERO => "0"
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   130
  case ONE => "1"
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   131
  case CHAR(c) => c.toString 
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   132
  case ALT(r1, r2) => s"(${string(r1)} + ${string(r2)})"
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   133
  case SEQ(CHAR(c), CHAR(d)) => s"${c}${d}"
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   134
  case SEQ(r1, r2) => s"(${string(r1)} ~ ${string(r2)})"
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   135
  case STAR(r) => s"(${string(r)})*"
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   136
  case NTIMES(r, n) =>  s"(${string(r)}){${n}}"
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   137
}
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   138
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   139
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   140
// test: ("a" | "aa")*
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   141
val EVIL3 = STAR(ALT(CHAR('a'), SEQ(CHAR('a'), CHAR('a'))))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   142
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   143
//test: ("" | "a" | "aa")*
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   144
val EVIL3 = STAR(ALT(ONE, ALT(CHAR('a'), SEQ(CHAR('a'), CHAR('a')))))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   145
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   146
val t1  = ders2("a".toList, EVIL3)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   147
val t1s = simp(t1) 
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   148
val t2  = ders2("aa".toList, t1s)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   149
val t2s = simp(t2)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   150
val t3  = ders2("aaa".toList, t2s)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   151
val t3s = simp(t3)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   152
val t4  = ders2("aaaa".toList, t3s)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   153
val t4s = simp(t4)
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   154
println(string(t1) + "    " + size(t1))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   155
println("s " + string(t1s) + "    " + size(t1s))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   156
println(string(t2) + "    " + size(t2))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   157
println("s " + string(t2s) + "    " + size(t2s))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   158
println(string(t3) + "    " + size(t3))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   159
println("s " + string(t3s) + "    " + size(t3s))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   160
println(string(t4) + "    " + size(t4))
71fc4a7a7039 updated
Christian Urban <urbanc@in.tum.de>
parents: 546
diff changeset
   161
println("s " + string(t4s) + "    " + size(t4s))