src/HOL/Induct/PropLog.ML
changeset 3414 804c8a178a7f
parent 3120 c58423c20740
child 3724 f33e301a89f5
equal deleted inserted replaced
3413:c1f63cc3a768 3414:804c8a178a7f
   165 
   165 
   166 goal Set.thy "insert a (B-{c}) - D <= insert a (B-insert c D)";
   166 goal Set.thy "insert a (B-{c}) - D <= insert a (B-insert c D)";
   167 by (Fast_tac 1);
   167 by (Fast_tac 1);
   168 qed "insert_Diff_subset2";
   168 qed "insert_Diff_subset2";
   169 
   169 
   170 (*The set hyps(p,t) is finite, and elements have the form #v or #v->false;
   170 goal PropLog.thy "finite(hyps p t)";
   171  could probably prove the stronger hyps(p,t) : Fin(hyps(p,{}) Un hyps(p,nat))*)
   171 by (induct_tac "p" 1);
   172 goal PropLog.thy "hyps p t : Fin(UN v:{x.True}. {#v, #v->false})";
   172 by (ALLGOALS Asm_simp_tac);
       
   173 qed "hyps_finite";
       
   174 
       
   175 goal PropLog.thy "hyps p t <= (UN v. {#v, #v->false})";
   173 by (PropLog.pl.induct_tac "p" 1);
   176 by (PropLog.pl.induct_tac "p" 1);
   174 by (ALLGOALS (simp_tac (!simpset setloop (split_tac [expand_if]))));
   177 by (ALLGOALS (simp_tac (!simpset setloop (split_tac [expand_if]))));
   175 by (ALLGOALS (fast_tac (!claset addSIs Fin.intrs@[Fin_UnI])));
   178 by (Blast_tac 1);
   176 qed "hyps_finite";
   179 qed "hyps_subset";
   177 
   180 
   178 val Diff_weaken_left = subset_refl RSN (2, Diff_mono) RS weaken_left;
   181 val Diff_weaken_left = subset_refl RSN (2, Diff_mono) RS weaken_left;
   179 
   182 
   180 (*Induction on the finite set of assumptions hyps(p,t0).
   183 (*Induction on the finite set of assumptions hyps(p,t0).
   181   We may repeatedly subtract assumptions until none are left!*)
   184   We may repeatedly subtract assumptions until none are left!*)
   182 val [sat] = goal PropLog.thy
   185 val [sat] = goal PropLog.thy
   183     "{} |= p ==> !t. hyps p t - hyps p t0 |- p";
   186     "{} |= p ==> !t. hyps p t - hyps p t0 |- p";
   184 by (rtac (hyps_finite RS Fin_induct) 1);
   187 by (rtac (hyps_subset RS (hyps_finite RS finite_subset_induct)) 1);
   185 by (simp_tac (!simpset addsimps [sat RS sat_thms_p]) 1);
   188 by (simp_tac (!simpset addsimps [sat RS sat_thms_p]) 1);
   186 by (safe_tac (!claset));
   189 by (Step_tac 1);
   187 (*Case hyps(p,t)-insert(#v,Y) |- p *)
   190 (*Case hyps(p,t)-insert(#v,Y) |- p *)
   188 by (rtac thms_excluded_middle_rule 1);
   191 by (rtac thms_excluded_middle_rule 1);
   189 by (rtac (insert_Diff_same RS weaken_left) 1);
   192 by (rtac (insert_Diff_same RS weaken_left) 1);
   190 by (etac spec 1);
   193 by (etac spec 1);
   191 by (rtac (insert_Diff_subset2 RS weaken_left) 1);
   194 by (rtac (insert_Diff_subset2 RS weaken_left) 1);
   210 goalw PropLog.thy [sat_def] "!!p H. insert p H |= q ==> H |= p->q";
   213 goalw PropLog.thy [sat_def] "!!p H. insert p H |= q ==> H |= p->q";
   211 by (Simp_tac 1);
   214 by (Simp_tac 1);
   212 by (Fast_tac 1);
   215 by (Fast_tac 1);
   213 qed "sat_imp";
   216 qed "sat_imp";
   214 
   217 
   215 val [finite] = goal PropLog.thy "H: Fin({p.True}) ==> !p. H |= p --> H |- p";
   218 goal PropLog.thy "!!H. finite H ==> !p. H |= p --> H |- p";
   216 by (rtac (finite RS Fin_induct) 1);
   219 by (etac finite_induct 1);
   217 by (safe_tac ((claset_of "Fun") addSIs [completeness_0]));
   220 by (safe_tac ((claset_of "Fun") addSIs [completeness_0]));
   218 by (rtac (weaken_left_insert RS thms.MP) 1);
   221 by (rtac (weaken_left_insert RS thms.MP) 1);
   219 by (fast_tac ((claset_of "Fun") addSIs [sat_imp]) 1);
   222 by (fast_tac ((claset_of "Fun") addSIs [sat_imp]) 1);
   220 by (Fast_tac 1);
   223 by (Fast_tac 1);
   221 qed "completeness_lemma";
   224 qed "completeness_lemma";
   222 
   225 
   223 val completeness = completeness_lemma RS spec RS mp;
   226 val completeness = completeness_lemma RS spec RS mp;
   224 
   227 
   225 val [finite] = goal PropLog.thy "H: Fin({p.True}) ==> (H |- p) = (H |= p)";
   228 goal PropLog.thy "!!H. finite H ==> (H |- p) = (H |= p)";
   226 by (fast_tac (!claset addSEs [soundness, finite RS completeness]) 1);
   229 by (fast_tac (!claset addSEs [soundness, completeness]) 1);
   227 qed "thms_iff";
   230 qed "syntax_iff_semantics";
   228 
       
   229 writeln"Reached end of file.";