src/Pure/more_thm.ML
changeset 60938 b316f218ef34
parent 60825 bacfb7c45d81
child 60948 b710a5087116
equal deleted inserted replaced
60937:51425cbe8ce9 60938:b316f218ef34
    21   structure Ctermtab: TABLE
    21   structure Ctermtab: TABLE
    22   structure Thmtab: TABLE
    22   structure Thmtab: TABLE
    23   val aconvc: cterm * cterm -> bool
    23   val aconvc: cterm * cterm -> bool
    24   val add_frees: thm -> cterm list -> cterm list
    24   val add_frees: thm -> cterm list -> cterm list
    25   val add_vars: thm -> cterm list -> cterm list
    25   val add_vars: thm -> cterm list -> cterm list
    26   val all_name: string * cterm -> cterm -> cterm
    26   val all_name: Proof.context -> string * cterm -> cterm -> cterm
    27   val all: cterm -> cterm -> cterm
    27   val all: Proof.context -> cterm -> cterm -> cterm
    28   val mk_binop: cterm -> cterm -> cterm -> cterm
    28   val mk_binop: cterm -> cterm -> cterm -> cterm
    29   val dest_binop: cterm -> cterm * cterm
    29   val dest_binop: cterm -> cterm * cterm
    30   val dest_implies: cterm -> cterm * cterm
    30   val dest_implies: cterm -> cterm * cterm
    31   val dest_equals: cterm -> cterm * cterm
    31   val dest_equals: cterm -> cterm * cterm
    32   val dest_equals_lhs: cterm -> cterm
    32   val dest_equals_lhs: cterm -> cterm
   118 val add_vars = Thm.fold_atomic_cterms (fn a => is_Var (Thm.term_of a) ? insert (op aconvc) a);
   118 val add_vars = Thm.fold_atomic_cterms (fn a => is_Var (Thm.term_of a) ? insert (op aconvc) a);
   119 
   119 
   120 
   120 
   121 (* cterm constructors and destructors *)
   121 (* cterm constructors and destructors *)
   122 
   122 
   123 fun all_name (x, t) A =
   123 fun all_name ctxt (x, t) A =
   124   let
   124   let
   125     val thy = Thm.theory_of_cterm t;
       
   126     val T = Thm.typ_of_cterm t;
   125     val T = Thm.typ_of_cterm t;
   127   in
   126     val all_const = Thm.cterm_of ctxt (Const ("Pure.all", (T --> propT) --> propT));
   128     Thm.apply (Thm.global_cterm_of thy (Const ("Pure.all", (T --> propT) --> propT)))
   127   in Thm.apply all_const (Thm.lambda_name (x, t) A) end;
   129       (Thm.lambda_name (x, t) A)
   128 
   130   end;
   129 fun all ctxt t A = all_name ctxt ("", t) A;
   131 
       
   132 fun all t A = all_name ("", t) A;
       
   133 
   130 
   134 fun mk_binop c a b = Thm.apply (Thm.apply c a) b;
   131 fun mk_binop c a b = Thm.apply (Thm.apply c a) b;
   135 fun dest_binop ct = (Thm.dest_arg1 ct, Thm.dest_arg ct);
   132 fun dest_binop ct = (Thm.dest_arg1 ct, Thm.dest_arg ct);
   136 
   133 
   137 fun dest_implies ct =
   134 fun dest_implies ct =