816 // val d = (lex_simp(NOTREG, prog0.toList)) |
818 // val d = (lex_simp(NOTREG, prog0.toList)) |
817 // println(d) |
819 // println(d) |
818 val pderSTAR = pderUNIV(STARREG) |
820 val pderSTAR = pderUNIV(STARREG) |
819 |
821 |
820 val refSize = pderSTAR.map(size(_)).sum |
822 val refSize = pderSTAR.map(size(_)).sum |
821 println("different partial derivative terms:") |
823 // println("different partial derivative terms:") |
822 pderSTAR.foreach(r => r match { |
824 // pderSTAR.foreach(r => r match { |
823 |
825 |
824 case SEQ(head, rstar) => |
826 // case SEQ(head, rstar) => |
825 println(shortRexpOutput(head) ++ "~STARREG") |
827 // println(shortRexpOutput(head) ++ "~STARREG") |
826 case STAR(rstar) => |
828 // case STAR(rstar) => |
827 println("STARREG") |
829 // println("STARREG") |
828 |
830 |
829 } |
831 // } |
830 ) |
832 // ) |
831 println("the total number of terms is") |
833 // println("the total number of terms is") |
832 //println(refSize) |
834 // //println(refSize) |
833 println(pderSTAR.size) |
835 // println(pderSTAR.size) |
834 |
836 |
835 val A : Rexp= ("c" | (ONE | "b") ~ "d") ~((ONE).%) |
837 val A : Rexp= ("c" | (ONE | "b") ~ "d") ~((ONE).%) |
836 val B : Rexp = ((ONE).%) |
838 val B : Rexp = ((ONE).%) |
837 val C : Rexp = ("d") ~ ((ONE).%) |
839 val C : Rexp = ("d") ~ ((ONE).%) |
838 val PRUNE_REG : Rexp = (C | B | A) |
840 val PRUNE_REG : Rexp = (C | B | A) |
839 val APRUNE_REG = internalise(PRUNE_REG) |
841 val APRUNE_REG = internalise(PRUNE_REG) |
840 // val program_solution = pruneRexp(APRUNE_REG, breakIntoTerms(PRUNE_REG)) |
842 // // val program_solution = pruneRexp(APRUNE_REG, breakIntoTerms(PRUNE_REG)) |
841 // println("program executes and gives: as disired!") |
843 // // println("program executes and gives: as disired!") |
842 // println(shortRexpOutput(erase(program_solution))) |
844 // // println(shortRexpOutput(erase(program_solution))) |
843 val simpedPruneReg = strongBsimp(APRUNE_REG) |
845 // val simpedPruneReg = strongBsimp(APRUNE_REG) |
844 println(shortRexpOutput(erase(simpedPruneReg))) |
846 |
845 for(i <- List(100, 900 ) ){// 100, 400, 800, 840, 841, 900 |
847 // println(shortRexpOutput(erase(simpedPruneReg))) |
846 val prog0 = "a" * i |
848 // for(i <- List(1,2 ) ){// 100, 400, 800, 840, 841, 900 |
847 //println(s"test: $prog0") |
849 // val prog0 = "a" * i |
848 println(s"testing with $i a's" ) |
850 // //println(s"test: $prog0") |
849 //val bd = bdersSimp(prog0, STARREG)//DB |
851 // println(s"testing with $i a's" ) |
850 val sbd = bdersSimpS(prog0, STARREG)//strongDB |
852 // //val bd = bdersSimp(prog0, STARREG)//DB |
851 starPrint(erase(sbd)) |
853 // val sbd = bdersSimpS(prog0, STARREG)//strongDB |
852 val subTerms = breakIntoTerms(erase(sbd)) |
854 // starPrint(erase(sbd)) |
853 //val subTermsLarge = breakIntoTerms(erase(bd)) |
855 // val subTerms = breakIntoTerms(erase(sbd)) |
|
856 // //val subTermsLarge = breakIntoTerms(erase(bd)) |
854 |
857 |
855 println(s"subterms of regex with strongDB: ${subTerms.length}")//, standard DB: ${subTermsLarge.length}") |
858 // println(s"subterms of regex with strongDB: ${subTerms.length}")//, standard DB: ${subTermsLarge.length}") |
856 |
859 |
857 |
860 |
858 |
861 |
859 println("the number of distinct subterms for bsimp with strongDB") |
862 // println("the number of distinct subterms for bsimp with strongDB") |
860 println(subTerms.distinct.size) |
863 // println(subTerms.distinct.size) |
861 //println(subTermsLarge.distinct.size) |
864 // //println(subTermsLarge.distinct.size) |
862 println("which coincides with the number of PDER terms") |
865 // println("which coincides with the number of PDER terms") |
863 |
866 |
864 |
867 |
865 // println(shortRexpOutput(erase(sbd))) |
868 // // println(shortRexpOutput(erase(sbd))) |
866 // println(shortRexpOutput(erase(bd))) |
869 // // println(shortRexpOutput(erase(bd))) |
867 |
870 |
868 println("pdersize, original, strongSimp") |
871 // println("pdersize, original, strongSimp") |
869 println(refSize, size(STARREG), asize(sbd)) |
872 // println(refSize, size(STARREG), asize(sbd)) |
870 |
873 |
871 val vres = strong_blexing_simp( STARREG, prog0) |
874 // val vres = strong_blexing_simp( STARREG, prog0) |
872 println(vres) |
875 // println(vres) |
873 } |
876 // } |
874 // println(vs.length) |
877 // println(vs.length) |
875 // println(vs) |
878 // println(vs) |
876 |
879 |
877 |
880 |
878 // val prog1 = """read n; write n""" |
881 // val prog1 = """read n; write n""" |
879 // println(s"test: $prog1") |
882 // println(s"test: $prog1") |
880 // println(lexing_simp(WHILE_REGS, prog1)) |
883 // println(lexing_simp(WHILE_REGS, prog1)) |
|
884 val display = ("a"| "ab").% |
|
885 val adisplay = internalise(display) |
|
886 bders_simp( "aaaaa".toList, adisplay) |
881 } |
887 } |
882 |
888 |
883 small() |
889 small() |