Spiral.scala
changeset 13 4868c26268aa
parent 12 768b833d6230
child 14 610f14009c0b
equal deleted inserted replaced
12:768b833d6230 13:4868c26268aa
   462             println(annotated_tree(easy))
   462             println(annotated_tree(easy))
   463           }
   463           }
   464         }
   464         }
   465     }
   465     }
   466   }
   466   }
       
   467   /*    if(bts == cdbts){//test of equality code v = retrieve internalise(r) v if |- v : r
       
   468       println(bts)
       
   469       println(cdbts)
       
   470       println("code v = retrieve internalise(r) v if |- v : r")
       
   471     }
       
   472     */
   467   def retrieve_experience(){
   473   def retrieve_experience(){
   468     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")))) 
   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")))) 
   469     val st = "abaab"
   475     val st = "abaab"
   470     val vl = blexing_simp(erase(rg), st)
   476     val vl = blexing_simp(erase(rg), st)
   471     //println(vl)
   477     //println(vl)
   472     val bts = retrieve(rg, vl)
   478     val bts = retrieve(rg, vl)
   473     val cdbts = code(vl)
   479     val cdbts = code(vl)
   474     if(bts == cdbts){//test of equality code v = retrieve internalise(r) v if |- v : r
   480     val simprg = bsimp(rg)
       
   481     val simpbts = retrieve(simprg, decode(erase(simprg), cdbts))
       
   482     if(bts == simpbts){
       
   483       println("retrieve r v = retrieve (bsimp r) (decode bsimp(r) code(v))")
   475       println(bts)
   484       println(bts)
   476       println(cdbts)
   485       println(simpbts)
   477       println("code v = retrieve internalise(r) v if |- v : r")
       
   478     }
   486     }
   479   }
   487   }
   480   def radical_correctness(){
   488   def radical_correctness(){
   481     enum(3, "abc").map(tests_blexer_simp(strs(3, "abc"))).toSet
   489     enum(3, "abc").map(tests_blexer_simp(strs(3, "abc"))).toSet
   482     random_pool(1, 5).map(tests_blexer_simp(strs(5, "abc"))).toSet
   490     random_pool(1, 5).map(tests_blexer_simp(strs(5, "abc"))).toSet