src/HOL/Metis_Examples/Clausify.thy
author blanchet
Thu Apr 14 11:24:05 2011 +0200 (2011-04-14)
changeset 42342 6babd86a54a4
parent 42340 4e4f0665e5be
child 42343 118cc349de35
permissions -rw-r--r--
handle case where the same Skolem name is given different types in different subgoals in the new Skolemizer (this can happen if several type-instances of the same fact are needed by Metis, cf. example in "Clausify.thy") -- the solution reintroduces old code removed in a6725f293377
     1 (*  Title:      HOL/Metis_Examples/Clausifier.thy
     2     Author:     Jasmin Blanchette, TU Muenchen
     3 
     4 Testing Metis's clausifier.
     5 *)
     6 
     7 theory Clausifier
     8 imports Complex_Main
     9 begin
    10 
    11 text {* Definitional CNF for goal *}
    12 
    13 (* FIXME: shouldn't need this *)
    14 declare [[unify_search_bound = 100]]
    15 declare [[unify_trace_bound = 100]]
    16 
    17 axiomatization p :: "nat \<Rightarrow> nat \<Rightarrow> bool" where
    18 pax: "\<exists>b. \<forall>a. ((p b a \<and> p 0 0 \<and> p 1 a) \<or> (p 0 1 \<and> p 1 0 \<and> p a b))"
    19 
    20 declare [[metis_new_skolemizer = false]]
    21 
    22 lemma "\<exists>b. \<forall>a. \<exists>x. (p b a \<or> x) \<and> (p 0 0 \<or> x) \<and> (p 1 a \<or> x) \<and>
    23                    (p 0 1 \<or> \<not> x) \<and> (p 1 0 \<or> \<not> x) \<and> (p a b \<or> \<not> x)"
    24 by (metis pax)
    25 
    26 lemma "\<exists>b. \<forall>a. \<exists>x. (p b a \<or> x) \<and> (p 0 0 \<or> x) \<and> (p 1 a \<or> x) \<and>
    27                    (p 0 1 \<or> \<not> x) \<and> (p 1 0 \<or> \<not> x) \<and> (p a b \<or> \<not> x)"
    28 by (metisFT pax)
    29 
    30 declare [[metis_new_skolemizer]]
    31 
    32 lemma "\<exists>b. \<forall>a. \<exists>x. (p b a \<or> x) \<and> (p 0 0 \<or> x) \<and> (p 1 a \<or> x) \<and>
    33                    (p 0 1 \<or> \<not> x) \<and> (p 1 0 \<or> \<not> x) \<and> (p a b \<or> \<not> x)"
    34 by (metis pax)
    35 
    36 lemma "\<exists>b. \<forall>a. \<exists>x. (p b a \<or> x) \<and> (p 0 0 \<or> x) \<and> (p 1 a \<or> x) \<and>
    37                    (p 0 1 \<or> \<not> x) \<and> (p 1 0 \<or> \<not> x) \<and> (p a b \<or> \<not> x)"
    38 by (metisFT pax)
    39 
    40 text {* New Skolemizer *}
    41 
    42 declare [[metis_new_skolemizer]]
    43 
    44 lemma
    45   fixes x :: real
    46   assumes fn_le: "!!n. f n \<le> x" and 1: "f ----> lim f"
    47   shows "lim f \<le> x"
    48 by (metis 1 LIMSEQ_le_const2 fn_le)
    49 
    50 definition
    51   bounded :: "'a::metric_space set \<Rightarrow> bool" where
    52   "bounded S \<longleftrightarrow> (\<exists>x eee. \<forall>y\<in>S. dist x y \<le> eee)"
    53 
    54 lemma "bounded T \<Longrightarrow> S \<subseteq> T ==> bounded S"
    55 by (metis bounded_def subset_eq)
    56 
    57 lemma
    58   assumes a: "Quotient R Abs Rep"
    59   shows "symp R"
    60 using a unfolding Quotient_def using sympI
    61 by metisFT
    62 
    63 lemma
    64   "(\<exists>x \<in> set xs. P x) \<longleftrightarrow>
    65    (\<exists>ys x zs. xs = ys @ x # zs \<and> P x \<and> (\<forall>z \<in> set zs. \<not> P z))"
    66 by (metis split_list_last_prop [where P = P] in_set_conv_decomp)
    67 
    68 lemma ex_tl: "EX ys. tl ys = xs"
    69 using tl.simps(2) by fast
    70 
    71 lemma "(\<exists>ys\<Colon>nat list. tl ys = xs) \<and> (\<exists>bs\<Colon>int list. tl bs = as)"
    72 by (metis ex_tl)
    73 
    74 end