src/HOL/Tools/Sledgehammer/metis_tactics.ML
changeset 36945 9bec62c10714
parent 36909 7d5587f6d5f7
child 36966 adc11fb3f3aa
equal deleted inserted replaced
36944:dbf831a50e4a 36945:9bec62c10714
    33 
    33 
    34 (* ------------------------------------------------------------------------- *)
    34 (* ------------------------------------------------------------------------- *)
    35 (* Useful Theorems                                                           *)
    35 (* Useful Theorems                                                           *)
    36 (* ------------------------------------------------------------------------- *)
    36 (* ------------------------------------------------------------------------- *)
    37 val EXCLUDED_MIDDLE = @{lemma "P ==> ~ P ==> False" by (rule notE)}
    37 val EXCLUDED_MIDDLE = @{lemma "P ==> ~ P ==> False" by (rule notE)}
    38 val REFL_THM = incr_indexes 2 @{lemma "t ~= t ==> False" by simp}
    38 val REFL_THM = Thm.incr_indexes 2 @{lemma "t ~= t ==> False" by simp}
    39 val subst_em = @{lemma "s = t ==> P s ==> ~ P t ==> False" by simp}
    39 val subst_em = @{lemma "s = t ==> P s ==> ~ P t ==> False" by simp}
    40 val ssubst_em = @{lemma "s = t ==> P t ==> ~ P s ==> False" by simp}
    40 val ssubst_em = @{lemma "s = t ==> P t ==> ~ P s ==> False" by simp}
    41 
    41 
    42 (* ------------------------------------------------------------------------- *)
    42 (* ------------------------------------------------------------------------- *)
    43 (* Useful Functions                                                          *)
    43 (* Useful Functions                                                          *)
   362       val [vx] = Term.add_vars (prop_of th) []
   362       val [vx] = Term.add_vars (prop_of th) []
   363       val substs = [(cterm_of thy (Var vx), cterm_of thy i_atm)]
   363       val substs = [(cterm_of thy (Var vx), cterm_of thy i_atm)]
   364   in  cterm_instantiate substs th  end;
   364   in  cterm_instantiate substs th  end;
   365 
   365 
   366 (* INFERENCE RULE: AXIOM *)
   366 (* INFERENCE RULE: AXIOM *)
   367 fun axiom_inf thpairs th = incr_indexes 1 (lookth thpairs th);
   367 fun axiom_inf thpairs th = Thm.incr_indexes 1 (lookth thpairs th);
   368     (*This causes variables to have an index of 1 by default. SEE ALSO mk_var above.*)
   368     (*This causes variables to have an index of 1 by default. SEE ALSO mk_var above.*)
   369 
   369 
   370 (* INFERENCE RULE: ASSUME *)
   370 (* INFERENCE RULE: ASSUME *)
   371 fun assume_inf ctxt mode atm =
   371 fun assume_inf ctxt mode atm =
   372   inst_excluded_middle
   372   inst_excluded_middle
   525       val tm_abs = Term.Abs("x", Term.type_of tm_subst, body)
   525       val tm_abs = Term.Abs("x", Term.type_of tm_subst, body)
   526       val _ = trace_msg (fn () => "abstraction: " ^ Syntax.string_of_term ctxt tm_abs)
   526       val _ = trace_msg (fn () => "abstraction: " ^ Syntax.string_of_term ctxt tm_abs)
   527       val _ = trace_msg (fn () => "i_tm: " ^ Syntax.string_of_term ctxt i_tm)
   527       val _ = trace_msg (fn () => "i_tm: " ^ Syntax.string_of_term ctxt i_tm)
   528       val _ = trace_msg (fn () => "located term: " ^ Syntax.string_of_term ctxt tm_subst)
   528       val _ = trace_msg (fn () => "located term: " ^ Syntax.string_of_term ctxt tm_subst)
   529       val imax = maxidx_of_term (i_tm $ tm_abs $ tm_subst)  (*ill typed but gives right max*)
   529       val imax = maxidx_of_term (i_tm $ tm_abs $ tm_subst)  (*ill typed but gives right max*)
   530       val subst' = incr_indexes (imax+1) (if pos then subst_em else ssubst_em)
   530       val subst' = Thm.incr_indexes (imax+1) (if pos then subst_em else ssubst_em)
   531       val _ = trace_msg (fn () => "subst' " ^ Display.string_of_thm ctxt subst')
   531       val _ = trace_msg (fn () => "subst' " ^ Display.string_of_thm ctxt subst')
   532       val eq_terms = map (pairself (cterm_of thy))
   532       val eq_terms = map (pairself (cterm_of thy))
   533         (ListPair.zip (OldTerm.term_vars (prop_of subst'), [tm_abs, tm_subst, i_tm]))
   533         (ListPair.zip (OldTerm.term_vars (prop_of subst'), [tm_abs, tm_subst, i_tm]))
   534   in  cterm_instantiate eq_terms subst'  end;
   534   in  cterm_instantiate eq_terms subst'  end;
   535 
   535