# HG changeset patch # User blanchet # Date 1272457166 -7200 # Node ID 5abf45444a1626bf82911a5965fb84b0332db3d3 # Parent 2b2a2c55d78732d6f82e6a3bb92a6f126e39c538 redo Sledgehammer proofs (and get rid of "neg_clausify") diff -r 2b2a2c55d787 -r 5abf45444a16 src/HOL/Metis_Examples/TransClosure.thy --- a/src/HOL/Metis_Examples/TransClosure.thy Wed Apr 28 13:32:45 2010 +0200 +++ b/src/HOL/Metis_Examples/TransClosure.thy Wed Apr 28 14:19:26 2010 +0200 @@ -5,7 +5,7 @@ *) theory TransClosure -imports Main +imports Sledgehammer2d (* ### *) begin types addr = nat @@ -17,45 +17,33 @@ | Intg int -- "integer value" | Addr addr -- "addresses of objects in the heap" -consts R::"(addr \ addr) set" +consts R :: "(addr \ addr) set" -consts f:: "addr \ val" +consts f :: "addr \ val" -declare [[ atp_problem_prefix = "TransClosure__test" ]] -lemma "\ f c = Intg x; \ y. f b = Intg y \ y \ x; (a,b) \ R\<^sup>*; (b,c) \ R\<^sup>* \ - \ \ c. (b,c) \ R \ (a,c) \ R\<^sup>*" -by (metis Transitive_Closure.rtrancl_into_rtrancl converse_rtranclE trancl_reflcl) +lemma "\f c = Intg x; \y. f b = Intg y \ y \ x; (a, b) \ R\<^sup>*; (b, c) \ R\<^sup>*\ + \ \c. (b, c) \ R \ (a, c) \ R\<^sup>*" +by (metis converse_rtranclE transitive_closure_trans(6)) -lemma "\ f c = Intg x; \ y. f b = Intg y \ y \ x; (a,b) \ R\<^sup>*; (b,c) \ R\<^sup>* \ - \ \ c. (b,c) \ R \ (a,c) \ R\<^sup>*" -proof (neg_clausify) -assume 0: "f c = Intg x" -assume 1: "(a, b) \ R\<^sup>*" -assume 2: "(b, c) \ R\<^sup>*" -assume 3: "f b \ Intg x" -assume 4: "\A. (b, A) \ R \ (a, A) \ R\<^sup>*" -have 5: "b = c \ b \ Domain R" - by (metis Not_Domain_rtrancl 2) -have 6: "\X1. (a, X1) \ R\<^sup>* \ (b, X1) \ R" - by (metis Transitive_Closure.rtrancl_into_rtrancl 1) -have 7: "\X1. (b, X1) \ R" - by (metis 6 4) -have 8: "b \ Domain R" - by (metis 7 DomainE) -have 9: "c = b" - by (metis 5 8) -have 10: "f b = Intg x" - by (metis 0 9) -show "False" - by (metis 10 3) +lemma "\f c = Intg x; \y. f b = Intg y \ y \ x; (a, b) \ R\<^sup>*; (b,c) \ R\<^sup>*\ + \ \c. (b, c) \ R \ (a, c) \ R\<^sup>*" +(* sledgehammer [isar_proof, shrink_factor = 2] *) +proof - + assume A1: "f c = Intg x" + assume A2: "\y. f b = Intg y \ y \ x" + assume A3: "(a, b) \ R\<^sup>*" + assume A4: "(b, c) \ R\<^sup>*" + have "(R\<^sup>*) (a, b)" using A3 by (metis mem_def) + hence F1: "(a, b) \ R\<^sup>*" by (metis mem_def) + have "b \ c" using A1 A2 by metis + hence "\x\<^isub>1. (b, x\<^isub>1) \ R" using A4 by (metis mem_def converse_rtranclE) + thus "\c. (b, c) \ R \ (a, c) \ R\<^sup>*" using F1 by (metis transitive_closure_trans(6)) qed -declare [[ atp_problem_prefix = "TransClosure__test_simpler" ]] -lemma "\ f c = Intg x; \ y. f b = Intg y \ y \ x; (a,b) \ R\<^sup>*; (b,c) \ R\<^sup>* \ - \ \ c. (b,c) \ R \ (a,c) \ R\<^sup>*" -apply (erule_tac x="b" in converse_rtranclE) -apply (metis rel_pow_0_E rel_pow_0_I) -apply (metis DomainE Domain_iff Transitive_Closure.rtrancl_into_rtrancl) -done +lemma "\f c = Intg x; \y. f b = Intg y \ y \ x; (a, b) \ R\<^sup>*; (b, c) \ R\<^sup>*\ + \ \c. (b, c) \ R \ (a, c) \ R\<^sup>*" +apply (erule_tac x = b in converse_rtranclE) + apply metis +by (metis transitive_closure_trans(6)) end