src/HOL/Induct/PropLog.ML
author wenzelm
Mon, 13 Mar 2000 13:21:39 +0100
changeset 8434 5e4bba59bfaa
parent 5223 4cb05273f764
child 9101 b643f4d7b9e9
permissions -rw-r--r--
use HOLogic.Not; export indexify_names;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     1
(*  Title:      HOL/ex/pl.ML
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     2
    ID:         $Id$
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     3
    Author:     Tobias Nipkow & Lawrence C Paulson
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     4
    Copyright   1994  TU Muenchen & University of Cambridge
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     5
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     6
Soundness and completeness of propositional logic w.r.t. truth-tables.
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     7
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     8
Prove: If H|=p then G|=p where G:Fin(H)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
     9
*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    10
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    11
(** Monotonicity **)
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    12
Goalw thms.defs "G<=H ==> thms(G) <= thms(H)";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    13
by (rtac lfp_mono 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    14
by (REPEAT (ares_tac basic_monos 1));
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    15
qed "thms_mono";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    16
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    17
(*Rule is called I for Identity Combinator, not for Introduction*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    18
Goal "H |- p->p";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    19
by (best_tac (claset() addIs [thms.K,thms.S,thms.MP]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    20
qed "thms_I";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    21
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    22
(** Weakening, left and right **)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    23
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    24
(* "[| G<=H;  G |- p |] ==> H |- p"
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    25
   This order of premises is convenient with RS
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    26
*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    27
bind_thm ("weaken_left", (thms_mono RS subsetD));
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    28
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    29
(* H |- p ==> insert(a,H) |- p *)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    30
val weaken_left_insert = subset_insertI RS weaken_left;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    31
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    32
val weaken_left_Un1  =    Un_upper1 RS weaken_left;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    33
val weaken_left_Un2  =    Un_upper2 RS weaken_left;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    34
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    35
Goal "H |- q ==> H |- p->q";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    36
by (fast_tac (claset() addIs [thms.K,thms.MP]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    37
qed "weaken_right";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    38
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    39
(*The deduction theorem*)
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    40
Goal "insert p H |- q  ==>  H |- p->q";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    41
by (etac thms.induct 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    42
by (ALLGOALS 
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    43
    (fast_tac (claset() addIs [thms_I, thms.H, thms.K, thms.S, thms.DN, 
4161
ac7f082e64a5 Adapted to removal of UN1_I, etc
paulson
parents: 4089
diff changeset
    44
			       thms.S RS thms.MP RS thms.MP, weaken_right])));
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    45
qed "deduction";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    46
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    47
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    48
(* "[| insert p H |- q; H |- p |] ==> H |- q"
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    49
    The cut rule - not used
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    50
*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    51
val cut = deduction RS thms.MP;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    52
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    53
(* H |- false ==> H |- p *)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    54
val thms_falseE = weaken_right RS (thms.DN RS thms.MP);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    55
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    56
(* [| H |- p->false;  H |- p;  q: pl |] ==> H |- q *)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    57
bind_thm ("thms_notE", (thms.MP RS thms_falseE));
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    58
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    59
(** The function eval **)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    60
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    61
Goalw [eval_def] "tt[false] = False";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    62
by (Simp_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    63
qed "eval_false";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    64
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    65
Goalw [eval_def] "tt[#v] = (v:tt)";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    66
by (Simp_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    67
qed "eval_var";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    68
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    69
Goalw [eval_def] "tt[p->q] = (tt[p]-->tt[q])";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    70
by (Simp_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    71
qed "eval_imp";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    72
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    73
Addsimps [eval_false, eval_var, eval_imp];
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    74
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    75
(*Soundness of the rules wrt truth-table semantics*)
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    76
Goalw [sat_def] "H |- p ==> H |= p";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    77
by (etac thms.induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    78
by (fast_tac (claset() addSDs [eval_imp RS iffD1 RS mp]) 5);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    79
by (ALLGOALS Asm_simp_tac);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    80
qed "soundness";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    81
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    82
(*** Towards the completeness proof ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    83
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
    84
Goal "H |- p->false ==> H |- p->q";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    85
by (rtac deduction 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    86
by (etac (weaken_left_insert RS thms_notE) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    87
by (rtac thms.H 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    88
by (rtac insertI1 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    89
qed "false_imp";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    90
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    91
val [premp,premq] = goal PropLog.thy
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    92
    "[| H |- p;  H |- q->false |] ==> H |- (p->q)->false";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    93
by (rtac deduction 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    94
by (rtac (premq RS weaken_left_insert RS thms.MP) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    95
by (rtac (thms.H RS thms.MP) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    96
by (rtac insertI1 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    97
by (rtac (premp RS weaken_left_insert) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    98
qed "imp_false";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
    99
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   100
(*This formulation is required for strong induction hypotheses*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   101
Goal "hyps p tt |- (if tt[p] then p else p->false)";
4831
dae4d63a1318 Renamed expand_const -> split_const.
nipkow
parents: 4686
diff changeset
   102
by (rtac (split_if RS iffD2) 1);
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5143
diff changeset
   103
by (induct_tac "p" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   104
by (ALLGOALS (simp_tac (simpset() addsimps [thms_I, thms.H])));
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   105
by (fast_tac (claset() addIs [weaken_left_Un1, weaken_left_Un2, 
4161
ac7f082e64a5 Adapted to removal of UN1_I, etc
paulson
parents: 4089
diff changeset
   106
			      weaken_right, imp_false]
ac7f082e64a5 Adapted to removal of UN1_I, etc
paulson
parents: 4089
diff changeset
   107
                       addSEs [false_imp]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   108
qed "hyps_thms_if";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   109
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   110
(*Key lemma for completeness; yields a set of assumptions satisfying p*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   111
val [sat] = goalw PropLog.thy [sat_def] "{} |= p ==> hyps p tt |- p";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   112
by (rtac (sat RS spec RS mp RS if_P RS subst) 1 THEN
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   113
    rtac hyps_thms_if 2);
4161
ac7f082e64a5 Adapted to removal of UN1_I, etc
paulson
parents: 4089
diff changeset
   114
by (Simp_tac 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   115
qed "sat_thms_p";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   116
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   117
(*For proving certain theorems in our new propositional logic*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   118
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   119
AddSIs [deduction];
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   120
AddIs [thms.H, thms.H RS thms.MP];
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   121
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   122
(*The excluded middle in the form of an elimination rule*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   123
Goal "H |- (p->q) -> ((p->false)->q) -> q";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   124
by (rtac (deduction RS deduction) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   125
by (rtac (thms.DN RS thms.MP) 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   126
by (ALLGOALS (best_tac (claset() addSIs prems)));
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   127
qed "thms_excluded_middle";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   128
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   129
(*Hard to prove directly because it requires cuts*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   130
val prems = goal PropLog.thy
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   131
    "[| insert p H |- q;  insert (p->false) H |- q |] ==> H |- q";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   132
by (rtac (thms_excluded_middle RS thms.MP RS thms.MP) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   133
by (REPEAT (resolve_tac (prems@[deduction]) 1));
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   134
qed "thms_excluded_middle_rule";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   135
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   136
(*** Completeness -- lemmas for reducing the set of assumptions ***)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   137
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   138
(*For the case hyps(p,t)-insert(#v,Y) |- p;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   139
  we also have hyps(p,t)-{#v} <= hyps(p, t-{v}) *)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   140
Goal "hyps p (t-{v}) <= insert (#v->false) ((hyps p t)-{#v})";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5143
diff changeset
   141
by (induct_tac "p" 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4161
diff changeset
   142
by (ALLGOALS Simp_tac);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   143
by (Fast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   144
qed "hyps_Diff";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   145
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   146
(*For the case hyps(p,t)-insert(#v -> false,Y) |- p;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   147
  we also have hyps(p,t)-{#v->false} <= hyps(p, insert(v,t)) *)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   148
Goal "hyps p (insert v t) <= insert (#v) (hyps p t-{#v->false})";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5143
diff changeset
   149
by (induct_tac "p" 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4161
diff changeset
   150
by (ALLGOALS Simp_tac);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   151
by (Fast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   152
qed "hyps_insert";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   153
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   154
(** Two lemmas for use with weaken_left **)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   155
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   156
goal Set.thy "B-C <= insert a (B-insert a C)";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   157
by (Fast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   158
qed "insert_Diff_same";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   159
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   160
goal Set.thy "insert a (B-{c}) - D <= insert a (B-insert c D)";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   161
by (Fast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   162
qed "insert_Diff_subset2";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   163
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   164
Goal "finite(hyps p t)";
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   165
by (induct_tac "p" 1);
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   166
by (ALLGOALS Asm_simp_tac);
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   167
qed "hyps_finite";
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   168
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   169
Goal "hyps p t <= (UN v. {#v, #v->false})";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5143
diff changeset
   170
by (induct_tac "p" 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4161
diff changeset
   171
by (ALLGOALS Simp_tac);
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   172
by (Blast_tac 1);
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   173
qed "hyps_subset";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   174
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   175
val Diff_weaken_left = subset_refl RSN (2, Diff_mono) RS weaken_left;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   176
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   177
(*Induction on the finite set of assumptions hyps(p,t0).
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   178
  We may repeatedly subtract assumptions until none are left!*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   179
val [sat] = goal PropLog.thy
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   180
    "{} |= p ==> !t. hyps p t - hyps p t0 |- p";
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   181
by (rtac (hyps_subset RS (hyps_finite RS finite_subset_induct)) 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   182
by (simp_tac (simpset() addsimps [sat RS sat_thms_p]) 1);
3724
f33e301a89f5 Step_tac -> Safe_tac
paulson
parents: 3414
diff changeset
   183
by Safe_tac;
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   184
(*Case hyps(p,t)-insert(#v,Y) |- p *)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   185
by (rtac thms_excluded_middle_rule 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   186
by (rtac (insert_Diff_same RS weaken_left) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   187
by (etac spec 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   188
by (rtac (insert_Diff_subset2 RS weaken_left) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   189
by (rtac (hyps_Diff RS Diff_weaken_left) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   190
by (etac spec 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   191
(*Case hyps(p,t)-insert(#v -> false,Y) |- p *)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   192
by (rtac thms_excluded_middle_rule 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   193
by (rtac (insert_Diff_same RS weaken_left) 2);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   194
by (etac spec 2);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   195
by (rtac (insert_Diff_subset2 RS weaken_left) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   196
by (rtac (hyps_insert RS Diff_weaken_left) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   197
by (etac spec 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   198
qed "completeness_0_lemma";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   199
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   200
(*The base case for completeness*)
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   201
val [sat] = goal PropLog.thy "{} |= p ==> {} |- p";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   202
by (rtac (Diff_cancel RS subst) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   203
by (rtac (sat RS (completeness_0_lemma RS spec)) 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   204
qed "completeness_0";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   205
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   206
(*A semantic analogue of the Deduction Theorem*)
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   207
Goalw [sat_def] "insert p H |= q ==> H |= p->q";
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   208
by (Simp_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   209
by (Fast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   210
qed "sat_imp";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   211
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   212
Goal "finite H ==> !p. H |= p --> H |- p";
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   213
by (etac finite_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   214
by (safe_tac ((claset_of Fun.thy) addSIs [completeness_0]));
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   215
by (rtac (weaken_left_insert RS thms.MP) 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   216
by (fast_tac ((claset_of Fun.thy) addSIs [sat_imp]) 1);
3120
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   217
by (Fast_tac 1);
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   218
qed "completeness_lemma";
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   219
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   220
val completeness = completeness_lemma RS spec RS mp;
c58423c20740 New directory to contain examples of (co)inductive definitions
paulson
parents:
diff changeset
   221
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   222
Goal "finite H ==> (H |- p) = (H |= p)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   223
by (fast_tac (claset() addSEs [soundness, completeness]) 1);
3414
804c8a178a7f Modified a few defs and proofs because of the changes to theory Finite.thy.
nipkow
parents: 3120
diff changeset
   224
qed "syntax_iff_semantics";