+(* performs steps of rewrite with the universe, obtaining if possible
+ * a trivial goal *)
+let solve_rewrite_tac ~universe ?(steps=1) (proof,goal as status)=
+ let _,metasenv,_subst,_,_,_ = proof in
+ let _,context,ty = CicUtil.lookup_meta goal metasenv in
+ let eq_uri = eq_of_goal ty in
+ let (active,passive,bag), cache, maxm =
+ (* we take the whole universe (no signature filtering) *)
+ init_cache_and_tables false true false true universe (proof,goal)
+ in
+ let initgoal = [], metasenv, ty in
+ let table =
+ let equalities = (Saturation.list_of_passive passive) in
+ (* we demodulate using both actives passives *)
+ List.fold_left (fun tbl eq -> Indexing.index tbl eq) (snd active) equalities
+ in
+ let env = metasenv,context,CicUniv.empty_ugraph in
+ match Indexing.solve_demodulating bag env table initgoal steps with
+ | Some (proof, metasenv, newty) ->
+ let refl =
+ match newty with
+ | Cic.Appl[Cic.MutInd _;eq_ty;left;_] ->
+ Equality.Exact (Equality.refl_proof eq_uri eq_ty left)
+ | _ -> assert false
+ in
+ let proofterm,_ =
+ Equality.build_goal_proof
+ bag eq_uri proof refl newty [] context metasenv
+ in
+ ProofEngineTypes.apply_tactic
+ (PrimitiveTactics.apply_tac ~term:proofterm) status
+ | None ->
+ raise
+ (ProofEngineTypes.Fail (lazy
+ ("Unable to solve with " ^ string_of_int steps ^ " demodulations")))
+;;
+let solve_rewrite_tac ~universe ?steps () =
+ ProofEngineTypes.mk_tactic (solve_rewrite_tac ~universe ?steps)
+;;
+