diff -r 143f58bb34f9 -r 0909deb8059b src/HOL/Imperative_HOL/ex/SatChecker.thy --- a/src/HOL/Imperative_HOL/ex/SatChecker.thy Thu May 26 16:57:14 2016 +0200 +++ b/src/HOL/Imperative_HOL/ex/SatChecker.thy Thu May 26 17:51:22 2016 +0200 @@ -2,22 +2,22 @@ Author: Lukas Bulwahn, TU Muenchen *) -section {* An efficient checker for proofs from a SAT solver *} +section \An efficient checker for proofs from a SAT solver\ theory SatChecker imports "~~/src/HOL/Library/RBT_Impl" Sorted_List "../Imperative_HOL" begin -section{* General settings and functions for our representation of clauses *} +section\General settings and functions for our representation of clauses\ -subsection{* Types for Literals, Clauses and ProofSteps *} -text {* We encode Literals as integers and Clauses as sorted Lists. *} +subsection\Types for Literals, Clauses and ProofSteps\ +text \We encode Literals as integers and Clauses as sorted Lists.\ type_synonym ClauseId = nat type_synonym Lit = int type_synonym Clause = "Lit list" -text {* This resembles exactly to Isat's Proof Steps *} +text \This resembles exactly to Isat's Proof Steps\ type_synonym Resolvants = "ClauseId * (Lit * ClauseId) list" datatype ProofStep = @@ -27,8 +27,8 @@ | Delete ClauseId | Xstep ClauseId ClauseId -subsection{* Interpretation of Literals, Clauses, and an array of Clauses *} -text {* Specific definitions for Literals as integers *} +subsection\Interpretation of Literals, Clauses, and an array of Clauses\ +text \Specific definitions for Literals as integers\ definition compl :: "Lit \ Lit" where @@ -54,7 +54,7 @@ lemma compl_exists: "\l'. l = compl l'" unfolding compl_def by arith -text {* Specific definitions for Clauses as sorted lists *} +text \Specific definitions for Clauses as sorted lists\ definition interpClause :: "(nat \ bool) \ Clause \ bool" where @@ -116,12 +116,12 @@ unfolding inconsistent_def correctClause_def by auto -text {* Specific definition for derived clauses in the Array *} +text \Specific definition for derived clauses in the Array\ definition array_ran :: "('a::heap) option array \ heap \ 'a set" where "array_ran a h = {e. Some e \ set (Array.get h a)}" - -- {*FIXME*} + \ \FIXME\ lemma array_ranI: "\ Some b = Array.get h a ! i; i < Array.length h a \ \ b \ array_ran a h" unfolding array_ran_def Array.length_def by simp @@ -165,11 +165,11 @@ by auto -section{* Improved version of SatChecker *} +section\Improved version of SatChecker\ -text{* This version just uses a single list traversal. *} +text\This version just uses a single list traversal.\ -subsection{* Function definitions *} +subsection\Function definitions\ primrec res_mem :: "Lit \ Clause \ Clause Heap" where @@ -209,7 +209,7 @@ declare res_mem.simps [simp del] resolve1.simps [simp del] resolve2.simps [simp del] res_thm'.simps [simp del] -subsection {* Proofs about these functions *} +subsection \Proofs about these functions\ lemma res_mem: assumes "effect (res_mem l xs) h h' r" @@ -408,7 +408,7 @@ done qed -subsection {* res_thm and doProofStep *} +subsection \res_thm and doProofStep\ definition get_clause :: "Clause option array \ ClauseId \ Clause Heap" where @@ -598,9 +598,9 @@ apply (drule bspec) by (rule array_ranI, auto) -section {* Functional version with Lists as Array *} +section \Functional version with Lists as Array\ -subsection {* List specific definitions *} +subsection \List specific definitions\ definition list_ran :: "'a option list \ 'a set" where @@ -636,7 +636,7 @@ "correctList rootcls xs = (\cl \ list_ran xs. correctClause rootcls cl \ sorted cl \ distinct cl)" -subsection {* Checker functions *} +subsection \Checker functions\ primrec lres_thm :: "Clause option list \ (Lit * ClauseId) \ Clause \ Clause Heap" where @@ -670,7 +670,7 @@ }" -section {* Functional version with RedBlackTrees *} +section \Functional version with RedBlackTrees\ primrec tres_thm :: "(ClauseId, Clause) RBT_Impl.rbt \ Lit \ ClauseId \ Clause \ Clause Heap" where