if (kbm_print_level > 1)
printf(" #Number of states of minred before minimisation = %d.\n",
minred->states->size); if (fsa_minimize(minred) == -1) exit(1); if (kbm_print_level > 1)
printf(" #Number of states of minred after minimisation = %d.\n",
minred->states->size);
base_prefix(fsaname);
strcat(fsaname, ".minred");
wfile = fopen(outf, "w");
fsa_print(wfile, minred, fsaname);
fclose(wfile); if (kbm_print_level > 0)
printf("#Minimal reducible word acceptor with %d states computed.\n",
minred->states->size);
/* Now do the second part - construct the minimal KB-rules machine. */
strcpy(inf, gpname);
strcat(inf, ".diff2");
strcpy(outf, gpname);
strcat(outf, ".minkb");
if ((rfile = fopen(inf, "r")) == 0) {
fprintf(stderr, "Cannot open file %s.\n", inf); exit(1);
} /* Read in the second-word difference machine for word-reduction */
tmalloc(rs_wd.wd_fsa, fsa, 1);
fsa_read(rfile, rs_wd.wd_fsa, DENSE, 0, 0, TRUE, fsaname);
fclose(rfile);
if (kbm_print_level > 1)
printf(" #Number of states of minkb before minimisation = %d.\n",
minkb->states->size); if (fsa_minimize(minkb) == -1) exit(1); if (kbm_print_level > 1)
printf(" #Number of states of minkb after minimisation = %d.\n",
minkb->states->size);
if (kbm_print_level > 0)
printf("#Minimal Knuth-Bendix equation fsa with %d states computed.\n",
minkb->states->size);
fsa_clear(minkb);
/* Now the third part - construct the correct diff1 machine. */
strcpy(inf, gpname);
strcat(inf, ".minkb");
strcpy(outf, gpname);
strcat(outf, ".diff1c");
/* We re-read the minkb machine to get it into dense format. */ if ((rfile = fopen(inf, "r")) == 0) {
fprintf(stderr, "Cannot open file %s.\n", inf); exit(1);
}
fsa_read(rfile, minkb, DENSE, 0, 0, TRUE, fsaname);
fclose(rfile);
diffc = fsa_diff(minkb, &rs_wd, op_store2); if (diffc == 0) exit(1);
if (kbm_print_level > 1)
printf(" #Number of word-differences in correct diff1 machine = %d.\n",
diffc->states->size);
/* Now the final part - construct the correct diff2 machine. */
strcpy(inf, gpname);
strcat(inf, ".gm");
strcpy(outf, gpname);
strcat(outf, ".diff2c");
/* Read in general multiplier */ if ((rfile = fopen(inf, "r")) == 0) {
fprintf(stderr, "Cannot open file %s.\n", inf); exit(1);
}
fsa_read(rfile, &gm, DENSE, 0, 0, TRUE, fsaname);
fclose(rfile);
diffc = fsa_diff(&gm, &rs_wd, op_store2); if (diffc == 0) exit(1);
if (kbm_print_level > 1)
printf(" #Number of word-differences in correct diff2 machine = %d.\n",
diffc->states->size);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.