public static string NonRegularGetUnpumpableWord(ArithmeticLanguage language, SymbolicString unpumpableWord, int n) { Dictionary <VariableType, int> assignment = new Dictionary <VariableType, int>(); assignment.Add(VariableType.Variable("n"), n); string word = pumpedWord(unpumpableWord, assignment); SymbolicString ss = SymbolicString.FromTextDescription(language.alphabet.ToList(), word); while (!ProofChecker.checkContainment(ss, language, LogicalExpression.True())) { assignment[VariableType.Variable("n")]++; word = pumpedWord(unpumpableWord, assignment); ss = SymbolicString.FromTextDescription(language.alphabet.ToList(), word); } return(word); }
private static SymbolicString splitToSymbStr(List <string> alphabet, string start, string mid, string end) { VariableType freshVar = VariableType.FreshVariable(); List <SymbolicString> strings = new List <SymbolicString>(); if (!start.Equals("")) { strings.Add(SymbolicString.FromTextDescription(alphabet, start)); } SymbolicString pumpedMid = SymbolicString.Repeat(SymbolicString.FromTextDescription(alphabet, mid), LinearIntegerExpression.Variable(freshVar.ToString())); strings.Add(pumpedMid); if (!end.Equals("")) { strings.Add(SymbolicString.FromTextDescription(alphabet, end)); } SymbolicString matchingString = SymbolicString.Concat(strings); return(matchingString); }
public static int NonRegularGetI(ArithmeticLanguage language, string start, string mid, string end) { SymbolicString matchingString = splitToSymbStr(language.alphabet.ToList(), start, mid, end); if (ProofChecker.checkContainment(matchingString, language, LogicalExpression.True())) { return(1); // AI surrenders } else { int i = 0; do { string word = pumpMid(start, mid, end, i); SymbolicString ss = SymbolicString.FromTextDescription(language.alphabet.ToList(), word); if (!ProofChecker.checkContainment(ss, language, LogicalExpression.True())) { return(i); } i++; } while (i < 99); //for debugging purposes return(-1); } }