src/HOL/ex/PropLog.ML
author berghofe
Tue, 25 Jun 1996 13:11:29 +0200
changeset 1824 44254696843a
parent 1820 e381e1c51689
child 1888 acb7363994cb
permissions -rw-r--r--
Changed argument order of nat_rec.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
     1
(*  Title:      HOL/ex/pl.ML
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
     3
    Author:     Tobias Nipkow & Lawrence C Paulson
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1994  TU Muenchen & University of Cambridge
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     5
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     6
Soundness and completeness of propositional logic w.r.t. truth-tables.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     7
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     8
Prove: If H|=p then G|=p where G:Fin(H)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     9
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    10
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    11
open PropLog;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    12
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    13
(** Monotonicity **)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    14
goalw PropLog.thy thms.defs "!!G H. G<=H ==> thms(G) <= thms(H)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    15
by (rtac lfp_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    16
by (REPEAT (ares_tac basic_monos 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    17
qed "thms_mono";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    18
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    19
(*Rule is called I for Identity Combinator, not for Introduction*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    20
goal PropLog.thy "H |- p->p";
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
    21
by(best_tac (!claset addIs [thms.K,thms.S,thms.MP]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    22
qed "thms_I";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    23
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    24
(** Weakening, left and right **)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    25
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    26
(* "[| G<=H;  G |- p |] ==> H |- p"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    27
   This order of premises is convenient with RS
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    28
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    29
bind_thm ("weaken_left", (thms_mono RS subsetD));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    30
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    31
(* H |- p ==> insert(a,H) |- p *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    32
val weaken_left_insert = subset_insertI RS weaken_left;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    33
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    34
val weaken_left_Un1  =    Un_upper1 RS weaken_left;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    35
val weaken_left_Un2  =    Un_upper2 RS weaken_left;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    36
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    37
goal PropLog.thy "!!H. H |- q ==> H |- p->q";
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
    38
by(fast_tac (!claset addIs [thms.K,thms.MP]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    39
qed "weaken_right";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    40
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    41
(*The deduction theorem*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    42
goal PropLog.thy "!!H. insert p H |- q  ==>  H |- p->q";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    43
by (etac thms.induct 1);
1769
abdab44dcb8b Simplified proof of deduction theorem
paulson
parents: 1465
diff changeset
    44
by (ALLGOALS 
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
    45
    (fast_tac (!claset addIs [thms_I, thms.H, thms.K, thms.S, thms.DN, 
1769
abdab44dcb8b Simplified proof of deduction theorem
paulson
parents: 1465
diff changeset
    46
			     thms.S RS thms.MP RS thms.MP, weaken_right])));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    47
qed "deduction";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    48
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    49
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    50
(* "[| insert p H |- q; H |- p |] ==> H |- q"
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    51
    The cut rule - not used
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    52
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    53
val cut = deduction RS thms.MP;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    54
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    55
(* H |- false ==> H |- p *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    56
val thms_falseE = weaken_right RS (thms.DN RS thms.MP);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    57
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    58
(* [| H |- p->false;  H |- p;  q: pl |] ==> H |- q *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    59
bind_thm ("thms_notE", (thms.MP RS thms_falseE));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    60
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    61
(** The function eval **)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    62
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    63
goalw PropLog.thy [eval_def] "tt[false] = False";
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
    64
by (Simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    65
qed "eval_false";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    66
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    67
goalw PropLog.thy [eval_def] "tt[#v] = (v:tt)";
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
    68
by (Simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    69
qed "eval_var";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    70
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    71
goalw PropLog.thy [eval_def] "tt[p->q] = (tt[p]-->tt[q])";
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
    72
by (Simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    73
qed "eval_imp";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    74
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
    75
Addsimps [eval_false, eval_var, eval_imp];
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    76
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    77
(*Soundness of the rules wrt truth-table semantics*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    78
goalw PropLog.thy [sat_def] "!!H. H |- p ==> H |= p";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    79
by (etac thms.induct 1);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
    80
by (fast_tac (!claset addSDs [eval_imp RS iffD1 RS mp]) 5);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
    81
by (ALLGOALS Asm_simp_tac);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    82
qed "soundness";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    83
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    84
(*** Towards the completeness proof ***)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    85
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    86
goal PropLog.thy "!!H. H |- p->false ==> H |- p->q";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    87
by (rtac deduction 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    88
by (etac (weaken_left_insert RS thms_notE) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    89
by (rtac thms.H 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    90
by (rtac insertI1 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    91
qed "false_imp";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    92
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    93
val [premp,premq] = goal PropLog.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    94
    "[| H |- p;  H |- q->false |] ==> H |- (p->q)->false";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    95
by (rtac deduction 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    96
by (rtac (premq RS weaken_left_insert RS thms.MP) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    97
by (rtac (thms.H RS thms.MP) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    98
by (rtac insertI1 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    99
by (rtac (premp RS weaken_left_insert) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   100
qed "imp_false";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   101
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   102
(*This formulation is required for strong induction hypotheses*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   103
goal PropLog.thy "hyps p tt |- (if tt[p] then p else p->false)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   104
by (rtac (expand_if RS iffD2) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   105
by(PropLog.pl.induct_tac "p" 1);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   106
by (ALLGOALS (simp_tac (!simpset addsimps [thms_I, thms.H])));
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   107
by (fast_tac (!claset addIs [weaken_left_Un1, weaken_left_Un2, 
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
   108
                           weaken_right, imp_false]
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   109
                    addSEs [false_imp]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   110
qed "hyps_thms_if";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   111
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   112
(*Key lemma for completeness; yields a set of assumptions satisfying p*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   113
val [sat] = goalw PropLog.thy [sat_def] "{} |= p ==> hyps p tt |- p";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   114
by (rtac (sat RS spec RS mp RS if_P RS subst) 1 THEN
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   115
    rtac hyps_thms_if 2);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   116
by (Fast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   117
qed "sat_thms_p";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   118
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   119
(*For proving certain theorems in our new propositional logic*)
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   120
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   121
AddSIs [deduction];
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   122
AddIs [thms.H, thms.H RS thms.MP];
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   123
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   124
(*The excluded middle in the form of an elimination rule*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   125
goal PropLog.thy "H |- (p->q) -> ((p->false)->q) -> q";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   126
by (rtac (deduction RS deduction) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   127
by (rtac (thms.DN RS thms.MP) 1);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   128
by (ALLGOALS (best_tac (!claset addSIs prems)));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   129
qed "thms_excluded_middle";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   130
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   131
(*Hard to prove directly because it requires cuts*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   132
val prems = goal PropLog.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   133
    "[| insert p H |- q;  insert (p->false) H |- q |] ==> H |- q";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   134
by (rtac (thms_excluded_middle RS thms.MP RS thms.MP) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   135
by (REPEAT (resolve_tac (prems@[deduction]) 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   136
qed "thms_excluded_middle_rule";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   137
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   138
(*** Completeness -- lemmas for reducing the set of assumptions ***)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   139
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   140
(*For the case hyps(p,t)-insert(#v,Y) |- p;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   141
  we also have hyps(p,t)-{#v} <= hyps(p, t-{v}) *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   142
goal PropLog.thy "hyps p (t-{v}) <= insert (#v->false) ((hyps p t)-{#v})";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   143
by (PropLog.pl.induct_tac "p" 1);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   144
by (Simp_tac 1);
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   145
by (simp_tac (!simpset setloop (split_tac [expand_if])) 1);
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   146
by (Simp_tac 1);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   147
by (Fast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   148
qed "hyps_Diff";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   149
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   150
(*For the case hyps(p,t)-insert(#v -> false,Y) |- p;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   151
  we also have hyps(p,t)-{#v->false} <= hyps(p, insert(v,t)) *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   152
goal PropLog.thy "hyps p (insert v t) <= insert (#v) (hyps p t-{#v->false})";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   153
by (PropLog.pl.induct_tac "p" 1);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   154
by (Simp_tac 1);
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   155
by (simp_tac (!simpset setloop (split_tac [expand_if])) 1);
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   156
by (Simp_tac 1);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   157
by (Fast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   158
qed "hyps_insert";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   159
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   160
(** Two lemmas for use with weaken_left **)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   161
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   162
goal Set.thy "B-C <= insert a (B-insert a C)";
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   163
by (Fast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   164
qed "insert_Diff_same";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   165
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   166
goal Set.thy "insert a (B-{c}) - D <= insert a (B-insert c D)";
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   167
by (Fast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   168
qed "insert_Diff_subset2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   169
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   170
(*The set hyps(p,t) is finite, and elements have the form #v or #v->false;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   171
 could probably prove the stronger hyps(p,t) : Fin(hyps(p,{}) Un hyps(p,nat))*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   172
goal PropLog.thy "hyps p t : Fin(UN v:{x.True}. {#v, #v->false})";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   173
by (PropLog.pl.induct_tac "p" 1);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   174
by (ALLGOALS (simp_tac (!simpset setloop (split_tac [expand_if]))));
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   175
by (ALLGOALS (fast_tac (!claset addSIs Fin.intrs@[Fin_UnI])));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   176
qed "hyps_finite";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   177
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   178
val Diff_weaken_left = subset_refl RSN (2, Diff_mono) RS weaken_left;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   179
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   180
(*Induction on the finite set of assumptions hyps(p,t0).
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   181
  We may repeatedly subtract assumptions until none are left!*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   182
val [sat] = goal PropLog.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   183
    "{} |= p ==> !t. hyps p t - hyps p t0 |- p";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   184
by (rtac (hyps_finite RS Fin_induct) 1);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   185
by (simp_tac (!simpset addsimps [sat RS sat_thms_p]) 1);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   186
by (safe_tac (!claset));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   187
(*Case hyps(p,t)-insert(#v,Y) |- p *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   188
by (rtac thms_excluded_middle_rule 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   189
by (rtac (insert_Diff_same RS weaken_left) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   190
by (etac spec 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   191
by (rtac (insert_Diff_subset2 RS weaken_left) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   192
by (rtac (hyps_Diff RS Diff_weaken_left) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   193
by (etac spec 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   194
(*Case hyps(p,t)-insert(#v -> false,Y) |- p *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   195
by (rtac thms_excluded_middle_rule 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   196
by (rtac (insert_Diff_same RS weaken_left) 2);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   197
by (etac spec 2);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   198
by (rtac (insert_Diff_subset2 RS weaken_left) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   199
by (rtac (hyps_insert RS Diff_weaken_left) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   200
by (etac spec 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   201
qed "completeness_0_lemma";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   202
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   203
(*The base case for completeness*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   204
val [sat] = goal PropLog.thy "{} |= p ==> {} |- p";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   205
by (rtac (Diff_cancel RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   206
by (rtac (sat RS (completeness_0_lemma RS spec)) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   207
qed "completeness_0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   208
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   209
(*A semantic analogue of the Deduction Theorem*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   210
val [sat] = goalw PropLog.thy [sat_def] "insert p H |= q ==> H |= p->q";
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 969
diff changeset
   211
by (Simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   212
by (cfast_tac [sat] 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   213
qed "sat_imp";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   214
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   215
val [finite] = goal PropLog.thy "H: Fin({p.True}) ==> !p. H |= p --> H |- p";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   216
by (rtac (finite RS Fin_induct) 1);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   217
by (safe_tac ((claset_of "Fun") addSIs [completeness_0]));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   218
by (rtac (weaken_left_insert RS thms.MP) 1);
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   219
by (fast_tac ((claset_of "Fun") addSIs [sat_imp]) 1);
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   220
by (Fast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   221
qed "completeness_lemma";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   222
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   223
val completeness = completeness_lemma RS spec RS mp;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   224
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   225
val [finite] = goal PropLog.thy "H: Fin({p.True}) ==> (H |- p) = (H |= p)";
1820
e381e1c51689 Classical tactics now use default claset.
berghofe
parents: 1769
diff changeset
   226
by (fast_tac (!claset addSEs [soundness, finite RS completeness]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   227
qed "thms_iff";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   228
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   229
writeln"Reached end of file.";