diff -r be23597e81db -r f875a25aa72d ProgTutorial/Recipes/Sat.thy --- a/ProgTutorial/Recipes/Sat.thy Fri May 17 07:29:51 2019 +0200 +++ b/ProgTutorial/Recipes/Sat.thy Fri May 17 10:38:01 2019 +0200 @@ -33,7 +33,7 @@ text \ then the resulting propositional formula @{ML pform} is - @{ML [display] "Or (And (BoolVar 1, Not (BoolVar 1)), BoolVar 2)" in Prop_Logic} + @{ML [display] \Or (And (BoolVar 1, Not (BoolVar 1)), BoolVar 2)\ in Prop_Logic} where indices are assigned for the variables @@ -43,8 +43,8 @@ input table is empty (i.e.~@{ML Termtab.empty}) and the output table is @{ML_matchresult_fake [display,gray] - "Termtab.dest table" - "[(Free (\"A\", \"bool\"), 1), (Free (\"B\", \"bool\"), 2)]"} + \Termtab.dest table\ + \[(Free ("A", "bool"), 1), (Free ("B", "bool"), 2)]\} An index is also produced whenever the translation function cannot find an appropriate propositional formula for a term. @@ -55,22 +55,22 @@ Prop_Logic.prop_formula_of_term @{term "\x::nat. P x"} Termtab.empty\ text \ - returns @{ML "BoolVar 1" in Prop_Logic} for @{ML pform'} and the table + returns @{ML \BoolVar 1\ in Prop_Logic} for @{ML pform'} and the table @{ML table'} is: @{ML_matchresult_fake [display,gray] - "map (apfst (Syntax.string_of_term @{context})) (Termtab.dest table')" - "(\x. P x, 1)"} + \map (apfst (Syntax.string_of_term @{context})) (Termtab.dest table')\ + \(\x. P x, 1)\} In the print out of the tabel, we used some pretty printing scaffolding to see better which assignment the table contains. Having produced a propositional formula, you can now call the SAT solvers - with the function @{ML "SAT_Solver.invoke_solver"}. For example + with the function @{ML \SAT_Solver.invoke_solver\}. For example @{ML_matchresult_fake [display,gray] - "SAT_Solver.invoke_solver \"minisat\" pform" - "SAT_Solver.SATISFIABLE assg"} + \SAT_Solver.invoke_solver "minisat" pform\ + \SAT_Solver.SATISFIABLE assg\} \ text \ @@ -78,12 +78,12 @@ the returned function \assg\ @{ML_matchresult [display,gray] -"let - val SAT_Solver.SATISFIABLE assg = SAT_Solver.invoke_solver \"auto\" pform +\let + val SAT_Solver.SATISFIABLE assg = SAT_Solver.invoke_solver "auto" pform in (assg 1, assg 2, assg 3) -end" - "(NONE, SOME true, NONE)"} +end\ + \(NONE, SOME true, NONE)\} we obtain a possible assignment for the variables \A\ an \B\ that makes the formula satisfiable. @@ -102,7 +102,7 @@ done text \ - However, for proving anything more exciting using @{ML "sat_tac" in SAT} you + However, for proving anything more exciting using @{ML \sat_tac\ in SAT} you have to use a SAT solver that can produce a proof. The internal one is not usuable for this.