src/HOL/MetisExamples/Abstraction.thy
author paulson
Thu, 21 Jun 2007 13:23:33 +0200
changeset 23449 dd874e6a3282
child 23519 a4ffa756d8eb
permissions -rw-r--r--
integration of Metis prover
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23449
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     1
(*  Title:      HOL/MetisExamples/Abstraction.thy
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     2
    ID:         $Id$
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     4
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     5
Testing the metis method
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     6
*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     7
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     8
theory Abstraction imports FuncSet
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
     9
begin
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    10
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    11
(*For Christoph Benzmueller*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    12
lemma "x<1 & ((op=) = (op=)) ==> ((op=) = (op=)) & (x<(2::nat))";
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    13
  by (metis One_nat_def less_Suc0 not_less0 not_less_eq numeral_2_eq_2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    14
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    15
(*this is a theorem, but we can't prove it unless ext is applied explicitly
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    16
lemma "(op=) = (%x y. y=x)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    17
*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    18
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    19
consts
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    20
  monotone :: "['a => 'a, 'a set, ('a *'a)set] => bool"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    21
  pset  :: "'a set => 'a set"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    22
  order :: "'a set => ('a * 'a) set"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    23
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    24
ML{*ResAtp.problem_name := "Abstraction__Collect_triv"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    25
lemma (*Collect_triv:*) "a \<in> {x. P x} ==> P a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    26
proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    27
assume 0: "(a\<Colon>'a\<Colon>type) \<in> Collect (P\<Colon>'a\<Colon>type \<Rightarrow> bool)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    28
assume 1: "\<not> (P\<Colon>'a\<Colon>type \<Rightarrow> bool) (a\<Colon>'a\<Colon>type)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    29
have 2: "(P\<Colon>'a\<Colon>type \<Rightarrow> bool) (a\<Colon>'a\<Colon>type)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    30
  by (metis CollectD 0)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    31
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    32
  by (metis 2 1)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    33
qed
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    34
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    35
lemma Collect_triv: "a \<in> {x. P x} ==> P a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    36
by (metis member_Collect_eq member_def)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    37
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    38
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    39
ML{*ResAtp.problem_name := "Abstraction__Collect_mp"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    40
lemma "a \<in> {x. P x --> Q x} ==> a \<in> {x. P x} ==> a \<in> {x. Q x}"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    41
  by (metis CollectI Collect_imp_eq ComplD UnE memberI member_Collect_eq);
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    42
  --{*34 secs*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    43
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    44
ML{*ResAtp.problem_name := "Abstraction__Sigma_triv"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    45
lemma "(a,b) \<in> Sigma A B ==> a \<in> A & b \<in> B a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    46
proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    47
assume 0: "(a\<Colon>'a\<Colon>type, b\<Colon>'b\<Colon>type) \<in> Sigma (A\<Colon>'a\<Colon>type set) (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    48
assume 1: "(a\<Colon>'a\<Colon>type) \<notin> (A\<Colon>'a\<Colon>type set) \<or> (b\<Colon>'b\<Colon>type) \<notin> (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set) a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    49
have 2: "(a\<Colon>'a\<Colon>type) \<in> (A\<Colon>'a\<Colon>type set)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    50
  by (metis SigmaD1 0)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    51
have 3: "(b\<Colon>'b\<Colon>type) \<in> (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set) (a\<Colon>'a\<Colon>type)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    52
  by (metis SigmaD2 0)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    53
have 4: "(b\<Colon>'b\<Colon>type) \<notin> (B\<Colon>'a\<Colon>type \<Rightarrow> 'b\<Colon>type set) (a\<Colon>'a\<Colon>type)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    54
  by (metis 1 2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    55
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    56
  by (metis 3 4)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    57
qed
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    58
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    59
lemma Sigma_triv: "(a,b) \<in> Sigma A B ==> a \<in> A & b \<in> B a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    60
by (metis SigmaD1 SigmaD2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    61
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    62
ML{*ResAtp.problem_name := "Abstraction__Sigma_Collect"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    63
lemma "(a,b) \<in> (SIGMA x: A. {y. x = f y}) ==> a \<in> A & a = f b"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    64
(*???metis cannot prove this
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    65
by (metis CollectD SigmaD1 SigmaD2 UN_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    66
Also, UN_eq is unnecessary*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    67
by (meson CollectD SigmaD1 SigmaD2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    68
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    69
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    70
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    71
(*single-step*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    72
lemma "(a,b) \<in> (SIGMA x: A. {y. x = f y}) ==> a \<in> A & a = f b"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    73
proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    74
assume 0: "(a, b) \<in> Sigma A (llabs_subgoal_1 f)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    75
assume 1: "\<And>f x. llabs_subgoal_1 f x = Collect (COMBB (op = x) f)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    76
assume 2: "a \<notin> A \<or> a \<noteq> f b"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    77
have 3: "a \<in> A"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    78
  by (metis SigmaD1 0)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    79
have 4: "b \<in> llabs_subgoal_1 f a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    80
  by (metis SigmaD2 0)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    81
have 5: "\<And>X1 X2. X2 -` {X1} = llabs_subgoal_1 X2 X1"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    82
  by (metis 1 vimage_Collect_eq singleton_conv2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    83
have 6: "\<And>X1 X2 X3. X1 X2 = X3 \<or> X2 \<notin> llabs_subgoal_1 X1 X3"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    84
  by (metis vimage_singleton_eq 5)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    85
have 7: "f b \<noteq> a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    86
  by (metis 2 3)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    87
have 8: "f b = a"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    88
  by (metis 6 4)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    89
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    90
  by (metis 8 7)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    91
qed finish_clausify
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    92
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    93
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    94
ML{*ResAtp.problem_name := "Abstraction__CLF_eq_in_pp"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    95
lemma "(cl,f) \<in> CLF ==> CLF = (SIGMA cl: CL.{f. f \<in> pset cl}) ==> f \<in> pset cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    96
apply (metis Collect_mem_eq SigmaD2);
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    97
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    98
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
    99
lemma "(cl,f) \<in> CLF ==> CLF = (SIGMA cl: CL.{f. f \<in> pset cl}) ==> f \<in> pset cl"proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   100
assume 0: "(cl, f) \<in> CLF"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   101
assume 1: "CLF = Sigma CL llabs_subgoal_1"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   102
assume 2: "\<And>cl. llabs_subgoal_1 cl =
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   103
     Collect (llabs_Predicate_XRangeP_def_2_ op \<in> (pset cl))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   104
assume 3: "f \<notin> pset cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   105
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   106
  by (metis 0 1 SigmaD2 3 2 Collect_mem_eq)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   107
qed finish_clausify (*ugly hack: combinators??*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   108
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   109
ML{*ResAtp.problem_name := "Abstraction__Sigma_Collect_Pi"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   110
lemma
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   111
    "(cl,f) \<in> (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl}) ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   112
    f \<in> pset cl \<rightarrow> pset cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   113
apply (metis Collect_mem_eq SigmaD2);
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   114
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   115
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   116
lemma
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   117
    "(cl,f) \<in> (SIGMA cl::'a set : CL. {f. f \<in> pset cl \<rightarrow> pset cl}) ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   118
    f \<in> pset cl \<rightarrow> pset cl" 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   119
proof (neg_clausify)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   120
assume 0: "(cl, f) \<in> Sigma CL llabs_subgoal_1"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   121
assume 1: "\<And>cl. llabs_subgoal_1 cl =
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   122
     Collect
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   123
      (llabs_Predicate_XRangeP_def_2_ op \<in> (Pi (pset cl) (COMBK (pset cl))))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   124
assume 2: "f \<notin> Pi (pset cl) (COMBK (pset cl))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   125
show "False"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   126
  by (metis Collect_mem_eq 1 2 SigmaD2 0 member2_def)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   127
qed finish_clausify
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   128
    (*Hack to prevent the "Additional hypotheses" error*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   129
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   130
ML{*ResAtp.problem_name := "Abstraction__Sigma_Collect_Int"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   131
lemma
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   132
    "(cl,f) \<in> (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   133
   f \<in> pset cl \<inter> cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   134
by (metis Collect_mem_eq SigmaD2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   135
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   136
ML{*ResAtp.problem_name := "Abstraction__Sigma_Collect_Pi_mono"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   137
lemma
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   138
    "(cl,f) \<in> (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl & monotone f (pset cl) (order cl)}) ==>
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   139
   (f \<in> pset cl \<rightarrow> pset cl)  &  (monotone f (pset cl) (order cl))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   140
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   141
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   142
ML{*ResAtp.problem_name := "Abstraction__CLF_subset_Collect_Int"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   143
lemma "(cl,f) \<in> CLF ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   144
   CLF \<subseteq> (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   145
   f \<in> pset cl \<inter> cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   146
by (metis Collect_mem_eq Int_def SigmaD2 UnCI Un_absorb1)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   147
  --{*@{text Int_def} is redundant}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   148
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   149
ML{*ResAtp.problem_name := "Abstraction__CLF_eq_Collect_Int"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   150
lemma "(cl,f) \<in> CLF ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   151
   CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<inter> cl}) ==>
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   152
   f \<in> pset cl \<inter> cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   153
by (metis Collect_mem_eq Int_commute SigmaD2)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   154
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   155
ML{*ResAtp.problem_name := "Abstraction__CLF_subset_Collect_Pi"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   156
lemma 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   157
   "(cl,f) \<in> CLF ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   158
    CLF \<subseteq> (SIGMA cl': CL. {f. f \<in> pset cl' \<rightarrow> pset cl'}) ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   159
    f \<in> pset cl \<rightarrow> pset cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   160
by (metis Collect_mem_eq SigmaD2 subsetD)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   161
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   162
ML{*ResAtp.problem_name := "Abstraction__CLF_eq_Collect_Pi"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   163
lemma 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   164
  "(cl,f) \<in> CLF ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   165
   CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl}) ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   166
   f \<in> pset cl \<rightarrow> pset cl"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   167
by (metis Collect_mem_eq SigmaD2 contra_subsetD equalityE)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   168
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   169
ML{*ResAtp.problem_name := "Abstraction__CLF_eq_Collect_Pi_mono"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   170
lemma 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   171
  "(cl,f) \<in> CLF ==> 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   172
   CLF = (SIGMA cl: CL. {f. f \<in> pset cl \<rightarrow> pset cl & monotone f (pset cl) (order cl)}) ==>
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   173
   (f \<in> pset cl \<rightarrow> pset cl)  &  (monotone f (pset cl) (order cl))"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   174
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   175
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   176
ML{*ResAtp.problem_name := "Abstraction__map_eq_zipA"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   177
lemma "map (%x. (f x, g x)) xs = zip (map f xs) (map g xs)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   178
apply (induct xs)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   179
(*sledgehammer*)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   180
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   181
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   182
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   183
ML{*ResAtp.problem_name := "Abstraction__map_eq_zipB"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   184
lemma "map (%w. (w -> w, w \<times> w)) xs = 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   185
       zip (map (%w. w -> w) xs) (map (%w. w \<times> w) xs)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   186
apply (induct xs)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   187
(*sledgehammer*)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   188
apply auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   189
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   190
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   191
ML{*ResAtp.problem_name := "Abstraction__image_evenA"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   192
lemma "(%x. Suc(f x)) ` {x. even x} <= A ==> (\<forall>x. even x --> Suc(f x) \<in> A)";
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   193
(*sledgehammer*)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   194
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   195
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   196
ML{*ResAtp.problem_name := "Abstraction__image_evenB"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   197
lemma "(%x. f (f x)) ` ((%x. Suc(f x)) ` {x. even x}) <= A 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   198
       ==> (\<forall>x. even x --> f (f (Suc(f x))) \<in> A)";
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   199
(*sledgehammer*)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   200
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   201
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   202
ML{*ResAtp.problem_name := "Abstraction__image_curry"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   203
lemma "f \<in> (%u v. b \<times> u \<times> v) ` A ==> \<forall>u v. P (b \<times> u \<times> v) ==> P(f y)" 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   204
(*sledgehammer*)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   205
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   206
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   207
ML{*ResAtp.problem_name := "Abstraction__image_TimesA"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   208
lemma image_TimesA: "(%(x,y). (f x, g y)) ` (A \<times> B) = (f`A) \<times> (g`B)"
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   209
(*sledgehammer*) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   210
apply (rule equalityI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   211
(***Even the two inclusions are far too difficult
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   212
ML{*ResAtp.problem_name := "Abstraction__image_TimesA_simpler"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   213
***)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   214
apply (rule subsetI)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   215
apply (erule imageE)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   216
(*V manages from here with help: Abstraction__image_TimesA_simpler_1_b.p*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   217
apply (erule ssubst)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   218
apply (erule SigmaE)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   219
(*V manages from here: Abstraction__image_TimesA_simpler_1_a.p*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   220
apply (erule ssubst)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   221
apply (subst split_conv)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   222
apply (rule SigmaI) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   223
apply (erule imageI) +
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   224
txt{*subgoal 2*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   225
apply (clarify );
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   226
apply (simp add: );  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   227
apply (rule rev_image_eqI)  
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   228
apply (blast intro: elim:); 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   229
apply (simp add: );
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   230
done
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   231
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   232
(*Given the difficulty of the previous problem, these two are probably
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   233
impossible*)
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   234
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   235
ML{*ResAtp.problem_name := "Abstraction__image_TimesB"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   236
lemma image_TimesB:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   237
    "(%(x,y,z). (f x, g y, h z)) ` (A \<times> B \<times> C) = (f`A) \<times> (g`B) \<times> (h`C)" 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   238
(*sledgehammer*) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   239
by force
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   240
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   241
ML{*ResAtp.problem_name := "Abstraction__image_TimesC"*}
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   242
lemma image_TimesC:
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   243
    "(%(x,y). (x \<rightarrow> x, y \<times> y)) ` (A \<times> B) = 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   244
     ((%x. x \<rightarrow> x) ` A) \<times> ((%y. y \<times> y) ` B)" 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   245
(*sledgehammer*) 
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   246
by auto
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   247
dd874e6a3282 integration of Metis prover
paulson
parents:
diff changeset
   248
end