src/Provers/eqsubst.ML
changeset 23064 6ee131d1a618
parent 22727 473c7f67c64f
child 27033 6ef5134fc631
equal deleted inserted replaced
23063:b4ee6ec4f9c6 23064:6ee131d1a618
   104     val search_lr_valid : (Zipper.T -> bool) -> Zipper.T -> Zipper.T Seq.seq
   104     val search_lr_valid : (Zipper.T -> bool) -> Zipper.T -> Zipper.T Seq.seq
   105     val searchf_lr_unify_all :
   105     val searchf_lr_unify_all :
   106        searchinfo -> Term.term -> match Seq.seq Seq.seq
   106        searchinfo -> Term.term -> match Seq.seq Seq.seq
   107     val searchf_lr_unify_valid :
   107     val searchf_lr_unify_valid :
   108        searchinfo -> Term.term -> match Seq.seq Seq.seq
   108        searchinfo -> Term.term -> match Seq.seq Seq.seq
   109 
   109     val searchf_bt_unify_valid :
       
   110        searchinfo -> Term.term -> match Seq.seq Seq.seq
   110 
   111 
   111     (* syntax tools *)
   112     (* syntax tools *)
   112     val ith_syntax : Args.T list -> int list * Args.T list
   113     val ith_syntax : Args.T list -> int list * Args.T list
   113     val options_syntax : Args.T list -> bool * Args.T list
   114     val options_syntax : Args.T list -> bool * Args.T list
   114 
   115 
   311               | Abs _ => here @ [Z.LookIn (Z.move_down_abs z)]
   312               | Abs _ => here @ [Z.LookIn (Z.move_down_abs z)]
   312               | _ => here
   313               | _ => here
   313           end;
   314           end;
   314     in Z.lzy_search sf_valid_td_lr end;
   315     in Z.lzy_search sf_valid_td_lr end;
   315 
   316 
       
   317 (* search from bottom to top, left to right *)
       
   318 
       
   319 fun search_bt_valid validf =
       
   320     let 
       
   321       fun sf_valid_td_lr z = 
       
   322           let val here = if validf z then [Z.Here z] else [] in
       
   323             case Z.trm z 
       
   324              of _ $ _ => [Z.LookIn (Z.move_down_left z), 
       
   325                           Z.LookIn (Z.move_down_right z)] @ here
       
   326               | Abs _ => [Z.LookIn (Z.move_down_abs z)] @ here
       
   327               | _ => here
       
   328           end;
       
   329     in Z.lzy_search sf_valid_td_lr end;
       
   330 
       
   331 fun searchf_unify_gen f (sgn, maxidx, z) lhs =
       
   332     Seq.map (clean_unify_z sgn maxidx lhs) 
       
   333             (Z.limit_apply f z);
       
   334 
   316 (* search all unifications *)
   335 (* search all unifications *)
   317 fun searchf_lr_unify_all (sgn, maxidx, z) lhs =
   336 val searchf_lr_unify_all =
   318     Seq.map (clean_unify_z sgn maxidx lhs) 
   337     searchf_unify_gen search_lr_all;
   319             (Z.limit_apply search_lr_all z);
       
   320 
   338 
   321 (* search only for 'valid' unifiers (non abs subterms and non vars) *)
   339 (* search only for 'valid' unifiers (non abs subterms and non vars) *)
   322 fun searchf_lr_unify_valid (sgn, maxidx, z) lhs  =
   340 val searchf_lr_unify_valid = 
   323     Seq.map (clean_unify_z sgn maxidx lhs) 
   341     searchf_unify_gen (search_lr_valid valid_match_start);
   324             (Z.limit_apply (search_lr_valid valid_match_start) z);
   342 
   325 
   343 val searchf_bt_unify_valid =
       
   344     searchf_unify_gen (search_bt_valid valid_match_start);
   326 
   345 
   327 (* apply a substitution in the conclusion of the theorem th *)
   346 (* apply a substitution in the conclusion of the theorem th *)
   328 (* cfvs are certified free var placeholders for goal params *)
   347 (* cfvs are certified free var placeholders for goal params *)
   329 (* conclthm is a theorem of for just the conclusion *)
   348 (* conclthm is a theorem of for just the conclusion *)
   330 (* m is instantiation/match information *)
   349 (* m is instantiation/match information *)