src/Pure/logic.ML
changeset 16130 38b111451155
parent 15596 8665d08085df
child 16846 bbebc68a7faf
equal deleted inserted replaced
16129:6fa9ace50240 16130:38b111451155
    20   val list_implies      : term list * term -> term
    20   val list_implies      : term list * term -> term
    21   val strip_imp_prems   : term -> term list
    21   val strip_imp_prems   : term -> term list
    22   val strip_imp_concl   : term -> term
    22   val strip_imp_concl   : term -> term
    23   val strip_prems       : int * term list * term -> term list * term
    23   val strip_prems       : int * term list * term -> term list * term
    24   val count_prems       : term * int -> int
    24   val count_prems       : term * int -> int
       
    25   val nth_prem		: int * term -> term
    25   val mk_conjunction    : term * term -> term
    26   val mk_conjunction    : term * term -> term
    26   val mk_conjunction_list: term list -> term
    27   val mk_conjunction_list: term list -> term
    27   val strip_horn        : term -> term list * term
    28   val strip_horn        : term -> term list * term
    28   val mk_cond_defpair   : term list -> term * term -> string * term
    29   val mk_cond_defpair   : term list -> term * term -> string * term
    29   val mk_defpair        : term * term -> string * term
    30   val mk_defpair        : term * term -> string * term
   110 fun strip_prems (0, As, B) = (As, B)
   111 fun strip_prems (0, As, B) = (As, B)
   111   | strip_prems (i, As, Const("==>", _) $ A $ B) =
   112   | strip_prems (i, As, Const("==>", _) $ A $ B) =
   112         strip_prems (i-1, A::As, B)
   113         strip_prems (i-1, A::As, B)
   113   | strip_prems (_, As, A) = raise TERM("strip_prems", A::As);
   114   | strip_prems (_, As, A) = raise TERM("strip_prems", A::As);
   114 
   115 
   115 (*Count premises -- quicker than (length ostrip_prems) *)
   116 (*Count premises -- quicker than (length o strip_prems) *)
   116 fun count_prems (Const("==>", _) $ A $ B, n) = count_prems (B,n+1)
   117 fun count_prems (Const("==>", _) $ A $ B, n) = count_prems (B,n+1)
   117   | count_prems (_,n) = n;
   118   | count_prems (_,n) = n;
       
   119 
       
   120 (*Select Ai from A1 ==>...Ai==>B*)
       
   121 fun nth_prem (1, Const ("==>", _) $ A $ _) = A
       
   122   | nth_prem (i, Const ("==>", _) $ _ $ B) = nth_prem (i - 1, B)
       
   123   | nth_prem (_, A) = raise TERM ("nth_prem", [A]);
   118 
   124 
   119 (*strip a proof state (Horn clause):
   125 (*strip a proof state (Horn clause):
   120   B1 ==> ... Bn ==> C   goes to   ([B1, ..., Bn], C)    *)
   126   B1 ==> ... Bn ==> C   goes to   ([B1, ..., Bn], C)    *)
   121 fun strip_horn A = (strip_imp_prems A, strip_imp_concl A);
   127 fun strip_horn A = (strip_imp_prems A, strip_imp_concl A);
   122 
   128