Spiral.scala
changeset 14 610f14009c0b
parent 13 4868c26268aa
child 15 cd0ceaf89c1d
equal deleted inserted replaced
13:4868c26268aa 14:610f14009c0b
   467   /*    if(bts == cdbts){//test of equality code v = retrieve internalise(r) v if |- v : r
   467   /*    if(bts == cdbts){//test of equality code v = retrieve internalise(r) v if |- v : r
   468       println(bts)
   468       println(bts)
   469       println(cdbts)
   469       println(cdbts)
   470       println("code v = retrieve internalise(r) v if |- v : r")
   470       println("code v = retrieve internalise(r) v if |- v : r")
   471     }
   471     }
       
   472 
       
   473 
       
   474         val r_der_s = bders(st.toList, rg)
       
   475     println(aregx_tree(r_der_s))
       
   476     val bts = retrieve(r_der_s, unsimplified_vl)
       
   477     val cdbts = code(unsimplified_vl)
       
   478     val simprg = bsimp(r_der_s)
       
   479     val frectv = decode(erase(simprg), cdbts)
       
   480     val simpbts = retrieve(simprg, frectv)
       
   481     if(bts == simpbts){
       
   482       println("retrieve r v = retrieve (bsimp r) (decode bsimp(r) code(v))")
       
   483       println("bits:")
       
   484       //println(bts)
       
   485       println(simpbts)
       
   486       println("v = ")
       
   487       println(unsimplified_vl)
       
   488       println("frect v = ")
       
   489       println(frectv)
       
   490     }
   472     */
   491     */
   473   def retrieve_experience(){
   492   def retrieve_experience(){
   474     val rg = 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")))) 
   493     val rg = 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")))) 
   475     val st = "abaab"
   494     val st = "abaab"
   476     val vl = blexing_simp(erase(rg), st)
   495     val r_der_s = ders(st.toList, erase(rg))
   477     //println(vl)
   496     val unsimplified_vl = mkeps(r_der_s)
   478     val bts = retrieve(rg, vl)
   497     val r_bder_s = bders( st.toList, rg)
   479     val cdbts = code(vl)
   498     val s_r_bder_s = bsimp(r_bder_s)
   480     val simprg = bsimp(rg)
   499     val bits1 = retrieve(r_bder_s, unsimplified_vl)
   481     val simpbts = retrieve(simprg, decode(erase(simprg), cdbts))
   500     println(r_bder_s)
   482     if(bts == simpbts){
   501     println(erase(r_bder_s))
   483       println("retrieve r v = retrieve (bsimp r) (decode bsimp(r) code(v))")
   502     println(s_r_bder_s)
   484       println(bts)
   503     println(erase(s_r_bder_s))
   485       println(simpbts)
   504     println(code(unsimplified_vl))
       
   505     val bits2 = retrieve(s_r_bder_s, decode(erase(s_r_bder_s), code(unsimplified_vl)))
       
   506     if(bits1 == bits2){
       
   507       println("retrieve ar v = retrieve (bsimp ar) (decode erase(bsimp(ar)) code(v)) if |- v : r")
       
   508       println("Here v == mkeps r\\s and r == r\\s")
       
   509       println(r_der_s, unsimplified_vl)
       
   510       println(s_r_bder_s, erase(s_r_bder_s), code(unsimplified_vl))
   486     }
   511     }
   487   }
   512   }
   488   def radical_correctness(){
   513   def radical_correctness(){
   489     enum(3, "abc").map(tests_blexer_simp(strs(3, "abc"))).toSet
   514     enum(3, "abc").map(tests_blexer_simp(strs(3, "abc"))).toSet
   490     random_pool(1, 5).map(tests_blexer_simp(strs(5, "abc"))).toSet
   515     random_pool(1, 5).map(tests_blexer_simp(strs(5, "abc"))).toSet