diff -r dfcf3fa58d7f -r c8ef391dd6f7 Spiral.scala --- a/Spiral.scala Wed Mar 04 13:25:52 2020 +0000 +++ b/Spiral.scala Fri Apr 10 11:58:11 2020 +0100 @@ -858,28 +858,43 @@ println(bsimp(bders( "a".toList, internalise(reg)))) println(result1) } + def finj_test0(c: Char, r: ARexp){ + val dr = bsimp(bder(c, r)) + val v = if(bnullable(dr)) mkeps(erase(dr)) else mkchr(erase(dr)) + val v0 = if(bnullable(dr)) mkeps(erase(bder(c,r))) else mkchr(erase(bder(c, r))) + val v1 = inj(erase(r), c, v0) + val v2 = fuzzy_inj(r, c, v) + println(v1) + println(v2) + + } def main(args: Array[String]) { - //println(S.toString) - //find_re() - //tellmewhy() - //correctness_proof_convenient_path() - tellmewhy() - //have_fun() - //string_der_test() - //comp(rd_string_gen(3,6).toList, random_struct_gen(7)) - //newxp1() - //contains7() - //retrieve_encode_STARS() - //check_all() - //radical_correctness() - //correctness_proof_convenient_path() - //retrieve_experience() - //neat_retrieve() - //test_bsimp2() - //christian_def2() - //christian_def() - //essence_posix() - //speed_test() - } + //finj_test0('b', fuse(List(S, Z), internalise( ( ("a"|"b")% ) ) )) + //finj_test0('a', fuse(List(S, Z), internalise( ( ("a"|"b")% ) ) )) + //finj_test0('b', bder('a', internalise( (("c" | "ab")%) ))) + //finj_test0('a', internalise( (("c" | "ab")%) )) + //this example gives us an exception + val r = internalise(ALTS(List(STAR(CHAR('c')), STAR(CHAR('b'))))) + val c = 'c' + //println(bits_print(r)) + //println(c) + //finj_test0(c, r) + for(i <- 1 to 1000){ + val r = random_struct_gen(3)//[{ a}*~{{a}*}*] + val c = (ran.nextInt(3) + 97).toChar//Sequ(Stars(List()),Stars(List())) + val dr = der(c, r) + val bdr = bder(c, internalise(r)) + if(nullable(dr)){ + println("bohooooooooooooooooo!") + val dv = mkeps(dr) + val target_vr = bsimp2(bdr, dv) + println(bits_print(target_vr._1)) + println(target_vr._2) + println(vunsimp(bdr, dv)(target_vr._2)) + } + } + + } + } //List( ASTAR(List(Z),ACHAR(List(),a)), AALTS(List(S),List(ACHAR(List(Z),b), ACHAR(List(S),a))) )