Up to index of Isabelle/HOL/MetisExamples
theory TransClosure(* Title: HOL/MetisTest/TransClosure.thy ID: $Id: TransClosure.thy,v 1.1 2007/06/21 11:23:35 paulson Exp $ Author: Lawrence C Paulson, Cambridge University Computer Laboratory Testing the metis method *) theory TransClosure imports Main begin types addr = nat datatype val = Unit -- "dummy result value of void expressions" | Null -- "null reference" | Bool bool -- "Boolean value" | Intg int -- "integer value" | Addr addr -- "addresses of objects in the heap" consts R::"(addr × addr) set" consts f:: "addr => val" ML {*ResAtp.problem_name := "TransClosure__test"*} lemma "[| f c = Intg x; ∀ y. f b = Intg y --> y ≠ x; (a,b) ∈ R*; (b,c) ∈ R* |] ==> ∃ c. (b,c) ∈ R ∧ (a,c) ∈ R*" 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*; (b,c) ∈ R* |] ==> ∃ c. (b,c) ∈ R ∧ (a,c) ∈ R*" proof (neg_clausify) assume 0: "f c = Intg x" assume 1: "(a, b) ∈ R*" assume 2: "(b, c) ∈ R*" assume 3: "f b ≠ Intg x" assume 4: "!!A. (b, A) ∉ R ∨ (a, A) ∉ R*" have 5: "b = c ∨ b ∈ Domain R" by (metis Not_Domain_rtrancl 2) have 6: "!!X1. (a, X1) ∈ R* ∨ (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) qed ML {*ResAtp.problem_name := "TransClosure__test_simpler"*} lemma "[| f c = Intg x; ∀ y. f b = Intg y --> y ≠ x; (a,b) ∈ R*; (b,c) ∈ R* |] ==> ∃ c. (b,c) ∈ R ∧ (a,c) ∈ R*" 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 end
lemma
[| f c = Intg x; ∀y. f b = Intg y --> y ≠ x; (a, b) ∈ R*; (b, c) ∈ R* |]
==> ∃c. (b, c) ∈ R ∧ (a, c) ∈ R*
lemma
[| f c = Intg x; ∀y. f b = Intg y --> y ≠ x; (a, b) ∈ R*; (b, c) ∈ R* |]
==> ∃c. (b, c) ∈ R ∧ (a, c) ∈ R*
lemma
[| f c = Intg x; ∀y. f b = Intg y --> y ≠ x; (a, b) ∈ R*; (b, c) ∈ R* |]
==> ∃c. (b, c) ∈ R ∧ (a, c) ∈ R*