Spiral.scala
changeset 16 c51178fa85fe
parent 15 cd0ceaf89c1d
child 17 3241b1e71633
--- a/Spiral.scala	Sun May 05 22:02:29 2019 +0100
+++ b/Spiral.scala	Wed May 08 22:09:59 2019 +0100
@@ -445,19 +445,19 @@
         val r = ("ab"| SEQ(ONE, "ab"))//internalise(random_struct_gen(4))//ASTAR(List(),AALTS(List(),List(ASTAR(List(Z),ACHAR(List(),'a')), ASEQ(List(S),ACHAR(List(),'a'),ACHAR(List(),'b')))))//internalise(balanced_struct_gen(3))//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
         for(j <- 0 to s.length - 1){
           val ss = s.slice(0, j+ 1)
-          val nangao = ders_simp(r, ss.toList)
-          val easy = bsimp(bders(ss.toList, r))
+          val nangao = ders_simp(internalise(r), ss.toList)
+          val easy = bsimp(bders(ss.toList, internalise(r)))
           if(!(nangao == easy || pushbits(nangao) == (easy))){
             println(j)
             println("not equal")
             println("string")
             println(ss)
             println("original regex")
-            println(annotated_tree(r))
+            println(regx_tree(r))
             println("regex after ders simp")
             println(annotated_tree(nangao))
             println("regex after ders")
-            println(annotated_tree(bders(ss.toList, r)))//flats' fuse when opening up AALTS causes the difference
+            println(annotated_tree(bders(ss.toList, internalise(r))))//flats' fuse when opening up AALTS causes the difference
             println("regex after ders and then a single simp")
             println(annotated_tree(easy))
           }
@@ -551,16 +551,24 @@
     println(bs3)
   }
   def essence_posix(){
-    val s = "abab"//rd_string_gen(alphabet_size, 3)//"abaa"//rd_string_gen(alphabet_size, 3)
-    val r = STAR("ab"| SEQ(ONE, "ab"))//internalise(random_struct_gen(4))//ASTAR(List(),AALTS(List(),List(ASTAR(List(Z),ACHAR(List(),'a')), ASEQ(List(S),ACHAR(List(),'a'),ACHAR(List(),'b')))))//internalise(balanced_struct_gen(3))//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
-    ders(s.toList, r)
+    //val s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"//rd_string_gen(alphabet_size, 3)//"abaa"//rd_string_gen(alphabet_size, 3)
+    val s0 = "a"
+    val r = SEQ(STAR(ALT("a", "aa")), "b")//internalise(random_struct_gen(4))//ASTAR(List(),AALTS(List(),List(ASTAR(List(Z),ACHAR(List(),'a')), ASEQ(List(S),ACHAR(List(),'a'),ACHAR(List(),'b')))))//internalise(balanced_struct_gen(3))//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
+    for(i <- 1 to 40){
+      val s = s0*i
+      //printf("%d  %d\n",i, size(ders(s.toList, r)))
+      printf("%d  %d\n",i, asize(ders_simp( internalise(r), s.toList)))
+      //println(asize(ders_simp( internalise(r), s.toList)))
+    }
   }
+
   def main(args: Array[String]) {
     //check_all()   
     //radical_correctness()
     //correctness_proof_convenient_path()
     //retrieve_experience()
-    christian_def()
+    //christian_def()
+    essence_posix()
   } 
 }