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